UNPKG

@kaiachain/web3js-ext

Version:
11 lines (10 loc) 1.23 kB
import { EthExecutionAPI, Numbers, Transaction, Web3Context, Web3Eth } from "web3"; import { Contract } from "web3-eth-contract"; import { GaslessSwapRouterAbi } from "../abi/GaslessSwapRouter.js"; export type GaslessSwapRouter = Contract<typeof GaslessSwapRouterAbi>; export declare function getGaslessSwapRouter(context: Web3Context<EthExecutionAPI>, address?: string): Promise<GaslessSwapRouter>; export declare function getAmountRepay(approveRequired: boolean, gasPrice: Numbers): bigint; export declare function getMinAmountOut(amountRepay: Numbers, appTxFee: Numbers, commissionRateBps: Numbers): bigint; export declare function getAmountIn(router: GaslessSwapRouter, tokenAddress: string, minAmountOut: Numbers, slippageBps: Numbers): Promise<bigint>; export declare function getApproveTx(context: Web3Context<EthExecutionAPI>, eth: Web3Eth, fromAddress: string, tokenAddress: string, routerAddress: string, gasPrice: Numbers): Promise<Transaction>; export declare function getSwapTx(eth: Web3Eth, fromAddress: string, tokenAddress: string, routerAddress: string, amountIn: Numbers, minAmountOut: Numbers, amountRepay: Numbers, gasPrice: Numbers, approveRequired: boolean, deadlineBuffer: Numbers): Promise<Transaction>;