THORSwap SwapKit
Ask or search…
K
Links
Comment on page

@swapkit/core

Installation

pnpm
yarn
npm
pnpm add @swapkit/core
yarn add @swapkit/core
npm add @swapkit/core

Class properties

Property
Description
Return Data
connectedChains
connected chains data after usage of connectX method
{
address: string;
balance: AssetValue[];
walletType: WalletOption
}
connectedWallets
connected wallet methods after usage of connectX method

Methods

Method
Params
approveAssetValue
(assetValue: AssetValue, contractAddress?: string)
=> Promise<string>
isAssetValueApproved
(assetValue: AssetValue, contractAddress?: string)
=> Promise<boolean>
disconnectChain
(chain: Chain) => void
getAddress
(chain: Chain) => string
getExplorerAddressUrl
(chain: Chain, address: string) => string
getExplorerTxUrl
(chain: Chain, txHash: string) => string
getWalletByChain
(chain: Chain) => Promise<{
address: string;
balance: AssetValue[];
walletType: WalletOption;
} | null>
getBalance
(chain: Chain, refresh?: boolean) => Promise<AssetValue[]>
getWallet
(chain: Chain) => WalletMethods[T]
swap
(params: {
recipient: string;
streamSwap?: boolean | undefined;
route: QuoteRoute;
feeOptionKey: FeeOption;
}) => Promise<string>
validateAddress
(params: {
address: string;
chain: Chain
}) => boolean | Promise<boolean> | undefined
extend
(params: {
excludedChains?: Chain[];
config?: {
stagenet?: boolean;
/**
* @required for AVAX & BSC
*/
covalentApiKey?: string;
/**
* @required for ETH
*/
ethplorerApiKey?: string;
/**
* @required for BTC, LTC, DOGE & BCH
*/
utxoApiKey?: string;
/**
* @required for Walletconnect
*/
walletConnectProjectId?: string;
/**
* @optional for Trezor config
*/
trezorManifest?: {
email: string;
appUrl: string;
};
},
rpcUrls?: { [chain in Chain]?: string; };
apis?: {
[key in UTXOChain]?: string | any;
} & {
[key in EVMChain]?: string | any;
} & {
[key in CosmosChain]?: string;
},
wallets: {
connectMethodName: ConnectMethodNames | WalletConnectMethodNames;
connect: (params: ConnectWalletParams) => (...params: any) => Promise<any>;
}[];
}) => void

THORChain Methods (included in instance) - Required COSMOS Toolbox

Method
Params
savings
(params: {
assetValue: AssetValue;
memo?: string | undefined;
} & ({
type: 'add';
percent?: undefined;
} | {
type: 'withdraw';
percent: number;
})) => Promise<string>
loan
(params: {
assetValue: AssetValue;
memo?: string | undefined;
minAmount: AssetValue;
type: 'open' | 'close';
}) => Promise<string>
addLiquidity
(params: {
poolIdentifier: string;
runeAssetValue: AssetValue;
assetValue: AssetValue;
isPendingSymmAsset?: boolean;
runeAddr?: string;
assetAddr?: string;
mode?: 'sym' | 'rune' | 'asset';
}) => Promise<{ runeTx?: string; assetTx?: string }>
createLiquidity
(params: {
runeAssetValue: AssetValue;
assetValue: AssetValue;
}) => Promise<{ runeTx: string; assetTx: string }>
withdraw
(params: {
memo?: string | undefined;
assetValue: AssetValue;
percent: number;
from: 'sym' | 'rune' | 'asset';
to: 'sym' | 'rune';
}) => Promise<string>
registerThorname
(params: {
address: string;
assetValue: AssetValue
chain: string;
expiryBlock?: string | undefined;
name: string;
owner?: string | undefined;
preferredAsset?: string | undefined;
}) => Promise<string>
nodeAction
(params: {
address: string;
} & ({
type: 'bond' | 'unbond';
assetValue: AssetValue;
} | {
type: 'leave';
assetValue?: undefined;
})) => Promise<string>
deposit
(params: {
assetValue: AssetValue;
data?: string | undefined;
expiration?: number | undefined;
from?: string | undefined;
feeOptionKey?: FeeOption | undefined;
feeRate?: number | undefined;
memo?: string | undefined;
router?: string
recipient: string;
}) => Promise<string>
transfer
(params: {
assetValue: AssetValue;
data?: string | undefined;
expiration?: number | undefined;
from?: string | undefined;
feeOptionKey?: FeeOption | undefined;
feeRate?: number | undefined;
memo?: string | undefined;
router?: string
recipient: string;
}) => Promise<string>