rubic-sdk-next
Version:
Simplify dApp creation
64 lines (63 loc) • 3.97 kB
TypeScript
import { SuiBlockchainName } from '@cryptorubic/core';
import BigNumber from 'bignumber.js';
import { PriceTokenAmount } from '../../../../../../common/tokens';
import { EvmBasicTransactionOptions } from '../../../../../../core/blockchain/web3-private-service/web3-private/evm-web3-private/models/evm-basic-transaction-options';
import { EvmTransactionOptions } from '../../../../../../core/blockchain/web3-private-service/web3-private/evm-web3-private/models/evm-transaction-options';
import { SuiWeb3Private } from '../../../../../../core/blockchain/web3-private-service/web3-private/sui-web3-private/sui-web3-private';
import { SuiWeb3Public } from '../../../../../../core/blockchain/web3-public-service/web3-public/sui-web3-public/sui-web3-public';
import { SuiEncodeConfig } from '../../../../../../core/blockchain/web3-pure/typed-web3-pure/sui-web3-pure/sui-encode-config';
import { EncodeTransactionOptions } from '../../../../../common/models/encode-transaction-options';
import { SwapTransactionOptions } from '../../../../../common/models/swap-transaction-options';
import { FeeInfo } from '../../../../../cross-chain/calculation-manager/providers/common/models/fee-info';
import { RubicStep } from '../../../../../cross-chain/calculation-manager/providers/common/models/rubicStep';
import { IsDeflationToken } from '../../../../../deflation-token-manager/models/is-deflation-token';
import { GasFeeInfo } from '../evm-on-chain-trade/models/gas-fee-info';
import { OnChainTrade } from '../on-chain-trade';
import { SuiOnChainTradeStruct } from './sui-on-chain-trade-struct';
import { SuiEncodedConfigAndToAmount } from '../../../models/aggregator-on-chain-types';
import { TransactionConfig } from 'web3-core';
import { TransactionReceipt } from 'web3-eth';
export declare abstract class SuiOnChainTrade extends OnChainTrade {
protected lastTransactionConfig: SuiEncodeConfig | null;
readonly from: PriceTokenAmount<SuiBlockchainName>;
readonly to: PriceTokenAmount<SuiBlockchainName>;
readonly slippageTolerance: number;
readonly path: RubicStep[];
/**
* Gas fee info, including gas limit and gas price.
*/
readonly gasFeeInfo: GasFeeInfo | null;
readonly feeInfo: FeeInfo;
/**
* True, if trade must be swapped through on-chain proxy contract.
*/
readonly useProxy: boolean;
/**
* Contains from amount, from which proxy fees were subtracted.
* If proxy is not used, then amount is equal to from amount.
*/
protected readonly fromWithoutFee: PriceTokenAmount<SuiBlockchainName>;
protected readonly withDeflation: {
from: IsDeflationToken;
to: IsDeflationToken;
};
protected get spenderAddress(): string;
abstract readonly dexContractAddress: string;
protected get web3Public(): SuiWeb3Public;
protected get web3Private(): SuiWeb3Private;
private readonly apiQuote;
private readonly apiResponse;
protected constructor(tradeStruct: SuiOnChainTradeStruct, providerAddress: string);
approve(_options: EvmBasicTransactionOptions, _checkNeedApprove?: boolean, _amount?: BigNumber | 'infinity'): Promise<TransactionReceipt>;
encodeApprove(_tokenAddress: string, _spenderAddress: string, _value: BigNumber | 'infinity', _options?: EvmTransactionOptions): Promise<TransactionConfig>;
protected checkAllowanceAndApprove(): Promise<void>;
/**
* Calculates value for swap transaction.
* @param providerValue Value, returned from cross-chain provider.
*/
protected getSwapValue(providerValue?: BigNumber | string | number | null): string;
swap(options?: SwapTransactionOptions): Promise<string | never>;
encode(options: EncodeTransactionOptions): Promise<SuiEncodeConfig>;
protected getTransactionConfigAndAmount(options?: EncodeTransactionOptions): Promise<SuiEncodedConfigAndToAmount>;
protected setTransactionConfig(options: EncodeTransactionOptions): Promise<SuiEncodeConfig>;
}