Blockchain Helpers
🦆 General blockchain utility helpers
- Blockchain Helpers
createConnectorAPINetworkInterface.chainNetworkInterface.fetchAccountNetworkInterface.fetchAssetByIdNetworkInterface.getProviderEnvNetworkInterface.loadAssetsNetworkInterface.getWalletConnectClientOptsNetworkInterface.getWebWalletClientOptsNetworkInterface.searchAssetsByNameNetworkInterface.searchForTransactions
- Site Menu
createConnectorAPI
Returns a ConnectorAPI with the following helper methods.
Note: BetaNet network option is only accepted by Algorand. Values default to ALGO and TestNet if none are provided.
function createConnectorAPI(
chain?: "ALGO" | "ETH",
network?: "TestNet" | "BetaNet" | "MainNet"
): NetworkInterface
NetworkInterface.chain
Returns the network to which the current ConnectorAPI is configured.
Note: Values default to ALGO and TestNet if none are provided on init.
NetworkInterface.chain?: "ALGO" | "ETH" | ...
NetworkInterface.fetchAccount
Fetch account details from network
NetworkInterface.fetchAccount(acc: string | any): any | Promise<any>;
NetworkInterface.fetchAssetById
Fetch an asset/token by its ID from the chain’s block explorer. If an asset balance is provided, it will be returned in the full formatted response.
NetworkInterface.
fetchAssetById(
assetId: number,
assetBalance?: number
): Promise<ReachToken | null>;
NetworkInterface.getProviderEnv
Returns a blockchain-specific configuration that can be used for stdlib, or to derive properties like the indexer URL for the current blockchain network.
NetworkInterface.getProviderEnv(network?: string): void;
NetworkInterface.loadAssets
Fetch account assets from network .
NetworkInterface.loadAssets(
address: string,
limit?: number, // max number of assets to fetch; default 10
assets?: number, // list of assets to fetch (not supported on all)
): any | Promise<ReachToken[]>;
Parameters
limit?: number; max number of assets to fetch (default10)assets?: number; List of asset ids to fetch. Not supported on all networks.
NetworkInterface.getWalletConnectClientOpts
Get a WalletConnect client instance
NetworkInterface.getWalletConnectClientOpts(): any;
NetworkInterface.getWebWalletClientOpts
Get an object with a key containing a wallet fallback for stdlib. Defaults to MyAlgoConnect on Algorand.
NetworkInterface.getWebWalletClientOpts(): any;
NetworkInterface.searchAssetsByName
Search for an asset/token by its name. Returns a list
NetworkInterface.searchAssetsByName(assetName: string): any;
NetworkInterface.searchForTransactions
Search for transactions for this addr
NetworkInterface.searchForTransactions(addr: string, opts?: any): any;