@liquidapps/dapp-client

Dapp Client Library

The dapp-client library makes using DAPP Network services much easier. It also allows you to easily tap into the dappservices (core DAPP Network Smart contract) and dappairhodl1 (Air-HODL smart contract) RAM tables with precision utilizing secondary and tertiary indices without the hassle.

To setup the library, first install it:

npm i -g @liquidapps/dapp-client

From there include the library’s client creator script:

const { createClient } = require('@liquidapps/dapp-client');

Then pass your desired arguments to the creator function

/*
    * network: specify your network of choice: mainnet, kylin, jungle 
    * httpEndpoint: you may also specify an endpoint to use instead of our defaults
    * fetch: pass a fetch reference as needed
    // if using dfuse
    * dfuse_key: Dfuse API key
    * dfuse_guarantee: Dfuse Push Guarantee(in-block, handoff:1, handoffs:2, handoffs:3, irreversible)
    * dfuse_network: Dfuse Network ( mainnet, testnet (eosio testnet), kylin, worbli, wax)
*/

export const getClient = async() => {
  return await createClient({ network: "kylin", httpEndpoint: endpoint, fetch: window.fetch.bind(window) });
};

Finally, setup the service you would like to interact along with your smart contract name:

Here is a full list of service options. The library comes with a push_guarantee function, similar to dfuse’s push guarantee, it accepts in-block, handoffs:1-3, or irreversible. There are DAPP Network service extensions and dappservices / dappairhodl1 RAM row calls.

Last updated

Was this helpful?