UNPKG

@dojima-wallet/connection

Version:

Initialise and connection for layer 1&2 blockchain

41 lines (40 loc) 2.06 kB
import { ChainClientParams, Network } from "../client"; import * as ethers from "ethers"; import Web3 from "web3"; import { DojTransferParams, DojTxData } from "./types"; import { PoolData, SwapFeeResult } from "../swap_utils"; import { SwapAssetList } from "@dojima-wallet/utils"; export type DojRpcParams = { privateKey: string; rpcUrl: string; infuraApiKey?: string; }; declare class DojimaClient { protected network: Network; protected web3: Web3; protected rpcUrl: string; protected provider: ethers.ethers.providers.JsonRpcProvider; protected account: ethers.ethers.Wallet; private phrase; private privateKey; constructor({ phrase, privateKey, network, rpcUrl, }: ChainClientParams & DojRpcParams); getAddress(): string; getBalance(address: string): Promise<number>; estimateGasFee(amount: number, memo?: string): Promise<number>; estimateGasLimit(tx: ethers.providers.TransactionRequest): Promise<ethers.BigNumber>; getCurrentGasPrice(): Promise<ethers.BigNumber>; calculateGasFee(recipient: string, amount: number, memo?: string): Promise<string>; transfer(params: DojTransferParams): Promise<string>; dummyTx(recipient: string, amount: number): Promise<string>; getTransactionData(hash: string): Promise<DojTxData>; getSwapOutput(inputAmount: number, pool: PoolData, toDoj: boolean): number; getDoubleSwapOutput(inputAmount: number, pool1: PoolData, pool2: PoolData): number; getSwapSlip(inputAmount: number, pool: PoolData, toDoj: boolean): number; getDoubleSwapSlip(inputAmount: number, pool1: PoolData, pool2: PoolData): number; getSwapFeesData(): Promise<SwapFeeResult>; getDojimaInboundAddress(hermesApiUrl: string): Promise<string>; getDefaultLiquidityPoolGasFee(hermesApiUrl: string): Promise<number>; addLiquidityPool(amount: number, inboundAddress: string, hermesAddress?: string): Promise<string>; swap(amount: number, token: SwapAssetList, inboundAddress: string, recipient: string): Promise<string>; } export { DojimaClient };