@goat-sdk/plugin-plunderswap
Version:
<div align="center"> <a href="https://github.com/goat-sdk/goat">
54 lines (51 loc) • 1.82 kB
text/typescript
import { ZilliqaWalletClientViemOnly } from '@goat-sdk/wallet-zilliqa';
import { TokensParameters, BalanceParameters, QuoteParameters, SwapParameters, WZilDepositParameters, WZilWithdrawParameters } from './types.mjs';
import '@goat-sdk/core';
import 'zod';
type HexString = `0x${string}`;
type LiquidityPair = {
tokens: [Token, Token];
reserves: [bigint, bigint];
};
type Token = {
symbol: string;
address: HexString;
decimals: number;
};
type TradePlan = {
tokenPath: Token[];
quote: bigint;
};
declare class PlunderSwapService {
private erc20Abi;
private pairAbi;
private factoryAbi;
private routerAbi;
private wZilAbi;
private tokensByChain;
private ensureTokens;
private getLiquidityPair;
private getLiquidityPairs;
planSwap(liquidityPairs: LiquidityPair[], fromToken: Token, fromAmount: bigint, toToken: Token): Promise<TradePlan>;
private ensureApproval;
getTokens(walletClient: ZilliqaWalletClientViemOnly, _parameters: TokensParameters): Promise<{
tokens: string[];
}>;
getBalance(walletClient: ZilliqaWalletClientViemOnly, parameters: BalanceParameters): Promise<{
amount: string;
}>;
getQuote(walletClient: ZilliqaWalletClientViemOnly, parameters: QuoteParameters): Promise<{
amount: string;
tokenPath: string[];
}>;
swap(walletClient: ZilliqaWalletClientViemOnly, parameters: SwapParameters): Promise<{
txHashes: `0x${string}`[];
}>;
wzil_deposit(walletClient: ZilliqaWalletClientViemOnly, parameters: WZilDepositParameters): Promise<{
txHash: `0x${string}`;
}>;
wzil_withdraw(walletClient: ZilliqaWalletClientViemOnly, parameters: WZilWithdrawParameters): Promise<{
txHash: `0x${string}`;
}>;
}
export { PlunderSwapService };