@devasher/kuru-sdk
Version:
Ethers v6 SDK to interact with Kuru (forked from @kuru-labs/kuru-sdk)
34 lines • 2.58 kB
TypeScript
import { ethers } from 'ethers';
import { TransactionOptions, SlippageOptions } from '../types';
import { RouteOutput } from '../types/pool';
export declare abstract class TokenSwap {
/**
* @dev Constructs a transaction for token swapping.
* @param signer - The signer instance.
* @param routerAddress - The address of the router contract.
* @param routeOutput - The route output containing path and other swap details.
* @param tokenInAmount - The amount of input tokens.
* @param minTokenOutAmount - The minimum amount of output tokens to receive.
* @param txOptions - Optional transaction parameters.
* @returns A promise that resolves to the transaction request object.
*/
static constructSwapTransaction(signer: ethers.AbstractSigner, routerAddress: string, routeOutput: RouteOutput, tokenInAmount: bigint, minTokenOutAmount: bigint, txOptions?: TransactionOptions): Promise<ethers.TransactionRequest>;
/**
* @dev Executes a token swap.
* @param providerOrSigner - The ethers.js provider or signer to interact with the blockchain.
* @param routerAddress - The address of the router contract.
* @param routeOutput - The route output containing path and other swap details.
* @param amountIn - The amount of input tokens.
* @param inTokenDecimals - The decimals of the input token.
* @param outTokenDecimals - The decimals of the output token.
* @param slippageTolerance - The maximum acceptable slippage.
* @param approveTokens - Whether to approve token spending before the swap.
* @param approvalCallback - Callback function for approval transaction hash.
* @param txOptions - Optional transaction parameters.
* @param slippageOptions - Optional slippage options.
* @returns A promise that resolves to the transaction receipt.
*/
static swap(providerOrSigner: ethers.JsonRpcProvider | ethers.AbstractSigner, routerAddress: string, routeOutput: RouteOutput, amountIn: number, inTokenDecimals: number, outTokenDecimals: number, slippageTolerance: number, approveTokens: boolean, approvalCallback: (txHash: string | null) => void, txOptions?: TransactionOptions, slippageOptions?: SlippageOptions): Promise<ethers.TransactionReceipt>;
static estimateGas(providerOrSigner: ethers.JsonRpcProvider | ethers.AbstractSigner, routerAddress: string, routeOutput: RouteOutput, amountIn: number, inTokenDecimals: number, outTokenDecimals: number, slippageTolerance: number, approveTokens: boolean): Promise<bigint>;
}
//# sourceMappingURL=swap.d.ts.map