The programming interface uses a builder pattern to mount an API.
For sake of simplicity the composeApi method mounts the entire API, i.e.
all available methods are mounted using this class
const api = composeApi({
nodeHost: 'https://europe.signum.network', // one of the mainnet nodes
})
While this is a straightforward way to have access to all API functionality, this methods
has the disadvantage of including all needed dependencies, thus leading to a bigger bundle, for those
who use bundlers like webpack. To reduce the bundle size, one may mount the API
conforming his needs using the ApiComposer class.
This leaks the underlying service instance to interact with the chain nodes API directly, e.g. to use an API method that
is not supported by SignumJS yet.
The API structure returned by composeApi
The programming interface uses a builder pattern to mount an API. For sake of simplicity the composeApi method mounts the entire API, i.e. all available methods are mounted using this class
const api = composeApi({ nodeHost: 'https://europe.signum.network', // one of the mainnet nodes })
While this is a straightforward way to have access to all API functionality, this methods has the disadvantage of including all needed dependencies, thus leading to a bigger bundle, for those who use bundlers like webpack. To reduce the bundle size, one may mount the API conforming his needs using the ApiComposer class.