hector-rubic-sdk
Version:
Simplify dApp creation
66 lines (65 loc) • 3.06 kB
TypeScript
import { BlockchainName } from '../../../../../core/blockchain/models/blockchain-name';
import { PriceTokenAmount } from '../../../../../core/blockchain/tokens/price-token-amount';
import { Token } from '../../../../../core/blockchain/tokens/token';
import { BatchCall } from '../../../../../core/blockchain/web3-public/models/batch-call';
import { ContractMulticallResponse } from '../../../../../core/blockchain/web3-public/models/contract-multicall-response';
import { GasFeeInfo } from '../../../models/gas-fee-info';
import { InstantTrade } from '../../../instant-trade';
import { SwapTransactionOptions } from '../../../models/swap-transaction-options';
import { ExactInputOutputSwapMethodsList } from './constants/SWAP_METHOD';
import { DefaultEstimatedGas } from './models/default-estimated-gas';
import BigNumber from 'bignumber.js';
import { EncodeTransactionOptions, TradeType } from '../../../..';
import { TransactionConfig } from 'web3-core';
import { TransactionReceipt } from 'web3-eth';
import { AbiItem } from 'web3-utils';
import { Exact } from '../../../models/exact';
export declare type UniswapV2TradeStruct = {
from: PriceTokenAmount;
to: PriceTokenAmount;
exact: Exact;
wrappedPath: ReadonlyArray<Token> | Token[];
deadlineMinutes: number;
slippageTolerance: number;
gasFeeInfo?: GasFeeInfo | null;
};
export declare abstract class UniswapV2AbstractTrade extends InstantTrade {
static getContractAddress(blockchain: BlockchainName): string;
static get type(): TradeType;
static readonly contractAbi: AbiItem[];
static readonly swapMethods: ExactInputOutputSwapMethodsList;
static readonly defaultEstimatedGasInfo: DefaultEstimatedGas;
static callForRoutes(blockchain: BlockchainName, exact: Exact, routesMethodArguments: [string, string[]][]): Promise<ContractMulticallResponse<{
amounts: string[];
}>[]>;
deadlineMinutes: number;
slippageTolerance: number;
readonly from: PriceTokenAmount;
readonly to: PriceTokenAmount;
gasFeeInfo: GasFeeInfo | null;
readonly path: ReadonlyArray<Token>;
readonly wrappedPath: ReadonlyArray<Token>;
readonly exact: Exact;
get type(): TradeType;
set settings(value: {
deadlineMinutes?: number;
slippageTolerance?: number;
});
private get deadlineMinutesTimestamp();
private get nativeValueToSend();
private get regularSwapMethod();
private get supportedFeeSwapMethod();
private get regularSwapMethodKey();
protected constructor(tradeStruct: UniswapV2TradeStruct);
private getAmountInAndAmountOut;
swap(options?: SwapTransactionOptions): Promise<TransactionReceipt>;
private createAnyToAnyTrade;
encode(options: EncodeTransactionOptions): Promise<TransactionConfig>;
private getCallParameters;
private getMethodName;
private getSwapParametersByMethod;
private convertSwapParametersToCallParameters;
getEstimatedGasCallData(): BatchCall;
getDefaultEstimatedGas(): BigNumber;
private estimateGasForAnyToAnyTrade;
}