View on GitHub

reachduck

A front-end helper for your blockchain DApp.

Blockchain Helpers

🦆 General blockchain utility helpers


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

top


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" | ...

top


NetworkInterface.fetchAccount

Fetch account details from network

NetworkInterface.fetchAccount(acc: string | any): any | Promise<any>;

top


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>;

top


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;

top


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

top


NetworkInterface.getWalletConnectClientOpts

Get a WalletConnect client instance

NetworkInterface.getWalletConnectClientOpts(): any;

top


NetworkInterface.getWebWalletClientOpts

Get an object with a key containing a wallet fallback for stdlib. Defaults to MyAlgoConnect on Algorand.

NetworkInterface.getWebWalletClientOpts(): any;

top


NetworkInterface.searchAssetsByName

Search for an asset/token by its name. Returns a list

NetworkInterface.searchAssetsByName(assetName: string): any;

top


NetworkInterface.searchForTransactions

Search for transactions for this addr

NetworkInterface.searchForTransactions(addr: string, opts?: any): any;

top



top