@swapkit/core
SwapKit Client that wraps wallets and method in clear and easy to use interface.
Includes @swapkit/api & @swapkit/helpers
Getting started
Installation
Usage
Methods
getAddress(chain: Chain): string
Returns address of previously connected chains with `connectX` method from wallet, if not connected returns empty string
getBalance(chain: Chain, refresh?: boolean): Promise<AssetValue[]>
Returns current chain wallet balance. Can fetch newest available balance when provided with `refresh` param
getExplorerAddressUrl(params: { address: string; chain: Chain }): string
Returns url for address explorer. Useful for tracking connected addresses
getExplorerTxUrl(params: { txHash: string; chain: Chain }): string
Returns url for transaction explorer. Useful for tracking executed transactions
getWallet(chain: Chain): ChainWallet
Returns connected wallet chain info
getWalletWithBalance(chain: Chain): Promise<ChainWallet>
Fetches newest wallet balances, updated connected wallet with it and returns chain wallet. Useful for loading initial balance for connected chains.
swap(params: { pluginName: PluginName, ...paramsForPluginSwap }): Promise<string>
Returns transaction hash after successful execution. Params depeds on connected/used plugin. Check thorchain or chainflip swap params
validateAddress(params: { address: string; chain: Chain }): boolean
Validates given address for chain.
This function works only for connected chains
Last updated