Nanoseconds Produce Minutes


    0.1.3 • Public • Published

    Actions Status GitHub License


    A TypeScript client library for the Regen Ledger.

    🚧 Warning

    This API is still under heavy construction, be ready for unexpected breaking changes. In particular, the Regen team is discussing with CosmJS on using ts-proto for client JS code generation across the whole Cosmos ecosystem.

    Get Started

    The library exposes one main TypeScript class: the RegenApi class. Here is an example of fetching the user's balance.

    import { RegenApi } from '@regen-network/api';
    import { QueryClientImpl } from '@regen-network/api/lib/generated/cosmos/bank/v1beta1/query';
    // Create a new instance of the RegenApi class.
    const api = RegenApi.connect({
    	// RegenApi supports multiple client connections to interact with a node:
    	// - via the Tendermint RPC
    	// - via gRPC
    	// - via gRPC-web
    	// - via REST and gRPC-gateway
    	connection: {
    		// Here, we are using the Tendermint RPC client connection.
    		type: 'tendermint',
    		url: '',
    // Create a client for the x/bank module.
    const bankClient = new QueryClientImpl(api.connection.queryConnection);
    // Fetch the balance of an address.
    const myAddress = 'regen:1j9...';
    const balances = await bankClient.AllBalances({
    	address: myAddress,
    console.log(balances); // Prints `{"balances":[{"denom":"utree","amount":"10000000000"}],"pagination":{"total":1}}`
    Click to see some ideas on a future more user-friendly API.
    import { RegenApi } from '@regen-network/api';
    // Same as above.
    const api = new RegenApi({ ... });
    // Fetch the balance of an address with new API.
    const myAddress = 'regen:1j9...';
    const balances = await{
    address: myAddress,
    console.log(balances); // Prints `{"balances":[{"denom":"utree","amount":"10000000000"}],"pagination":{"total":1}}`

    Feel free to comment on issue #2 if you have ideas of user-facing APIs you'd like to see.


    The list of all available methods to call can be found in:

    Alternatively, you can just explore the ./src/generated/ folder, all methods are commented in the code.

    Differences with CosmJS

    The main difference with CosmJS is that RegenJS is 100%-generated TS client, while CosmJS recommends manually decorating your own TS classes. For this code generation, RegenJS uses ts-proto. However, the generated types create imcompatibilities with CosmJS (which uses protobufjs).

    Regen's team goal is not to divide the JS/TS community in the Cosmos ecosystem. We are currently actively talking with the CosmJS team to discuss to use the same foundation, based on ts-proto. The progress can be followed here.

    Other than that, RegenJS actually plans to use multiple components of CosmJS under the hood: the Tendermint client, the proto-signing package...

    Long-term Roadmap

    • Create a "JS Client generator": you input some proto files, the generator outputs a fully-functional TS client.
    • Make it compatible with CosmJS.




    npm i @regen-network/api

    DownloadsWeekly Downloads






    Unpacked Size

    2.07 MB

    Total Files


    Last publish


    • amaurym
    • blushi