Options
All
  • Public
  • Public/Protected
  • All
Menu

Class ApiComposer

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

Hierarchy

  • ApiComposer

Index

Methods

compose

  • compose(): Api

withAccountApi

withAliasApi

withAssetApi

withBlockApi

withContractApi

withMessageApi

withNetworkApi

withTransactionApi

Static create