barterjs-sdk
Version:
Barter Network SDK
55 lines (54 loc) • 2.79 kB
TypeScript
import { Contract as EthersContract } from 'ethers';
import { Contract as Web3Contract } from 'web3-eth-contract';
import { IMapCrossChainService } from '../interfaces/IMapCrossChainService';
import { BarterTransactionResponse } from '../../types/responseTypes';
import { TransferOutOptions } from '../../types';
import { BarterProviderType } from '../../types/paramTypes';
export declare class RelayCrossChainService implements IMapCrossChainService {
contract: EthersContract | Web3Contract;
provider: BarterProviderType;
constructor(contractAddress: string, abi: any, signerOrProvider: BarterProviderType);
/**
* transfer out token(not native coin) from source chain to designated token on target chain
* @param fromAddress
* @param tokenAddress input token address
* @param amount amount in minimal unit
* @param toAddress target chain receiving address
* @param toChainId target chain id
* @param options
*/
doTransferOutToken(fromAddress: string, tokenAddress: string, amount: string, toAddress: string, toChainId: string, options: TransferOutOptions): Promise<BarterTransactionResponse>;
gasEstimateTransferOutToken(tokenAddress: string, amount: string, toAddress: string, toChainId: string): Promise<string>;
/**
* transfer out native coin from source chain to designated token on target chain
* @param fromAddress
* @param toAddress target chain receiving address
* @param toChainId target chain id
* @param amount amount to bridge in minimal unit
* @param options
*/
doTransferOutNative(fromAddress: string, toAddress: string, toChainId: string, amount: string, options: TransferOutOptions): Promise<BarterTransactionResponse>;
gasEstimateTransferOutNative(toAddress: string, toChainId: string, amount: string): Promise<string>;
doDepositOutToken(tokenAddress: string, from: string, to: string, amount: string): Promise<string>;
/**
* set id table
* @param chainId
* @param id
*/
/**
* specify token decimal for the convertion of different token on different chain
* @param selfTokenAddress
* @param chainId
* @param decimals
*/
doSetTokenOtherChainDecimals(selfTokenAddress: string, chainId: string, decimals: number): Promise<string>;
doAddAuthToken(tokens: string[]): Promise<string>;
/**
* set accepted bridge address
* @param chainId chain id of the bridge address is residing on
* @param bridgeAddress bridge address
*/
doSetBridgeAddress(chainId: string, bridgeAddress: string): Promise<string>;
setVaultBalance(toChain: number, address: string, amount: string): Promise<string>;
getVaultBalance(toChainId: number, tokenAddress: string): Promise<string>;
}