Composes the API Note: As of being a builder pattern, this need to call this method as last
Adds the AccountApi to be composed
A map of creator/factory functions for the endpoints
Adds the AliasApi to be composed
A map of creator/factory functions for the endpoints
Adds the AssetApi to be composed
A map of creator/factory functions for the endpoints
Adds the BlockApi to be composed
A map of creator/factory functions for the endpoints
Adds the ContractApi to be composed
A map of creator/factory functions for the endpoints
Adds the MessageApi to be composed
A map of creator/factory functions for the endpoints
Adds the NetworkApi to be composed
A map of creator/factory functions for the endpoints
Adds the TransactionApi to be composed
A map of creator/factory functions for the endpoints
Creates the composer instance
the composer instance
The API composer mounts the API for given service and selected methods
Usually you would use composeApi, which gives you all available API methods. Unfortunately, this will import almost all dependencies, even if you need only a fraction of the methods. To take advantage of tree-shaking (dead code elimination) you can compose your own API with the methods you need. This can reduce your final bundle significantly.
Usage:
const chainService = new ChainService({ nodeHost: 'https://testnet.burst.fun', }) const api = apiComposer .create(chainService) .withMessageApi({ sendTextMessage }) .withAccountApi({ getAccountTransactions, getUnconfirmedAccountTransactions, getAccountBalance, generateSendTransactionQRCode, generateSendTransactionQRCodeAddress, }) .compose();
The
with<section>Api
uses factory methods from the api.core.factories package