kipay-sdk
Version:
A comprehensive SDK for interacting with the Kira Pay protocol and various blockchain networks
2,685 lines (2,655 loc) • 153 kB
text/typescript
import { TokenInfo } from '@uniswap/token-lists';
import { Eip1193Provider, TransactionRequest, TransactionResponse, TransactionReceipt, JsonRpcApiProvider, ContractRunner, ethers as ethers$1 } from 'ethers-latest';
import { Protocol } from '@uniswap/router-sdk';
import { AlphaRouter, V2SubgraphPool, V3SubgraphPool, URISubgraphProvider, AlphaRouterConfig, SwapOptionsUniversalRouter, SwapRoute as SwapRoute$1, MethodParameters } from '@uniswap/smart-order-router';
import { ethers as ethers$2 } from 'ethers';
import { Currency } from '@uniswap/sdk-core';
import { FeeOptions } from '@uniswap/v3-sdk';
import { BigNumber } from 'bignumber.js';
export { BigNumber } from 'bignumber.js';
import { ApiPromise, ApiRx } from '@polkadot/api';
import { WsProvider } from '@polkadot/rpc-provider';
import { ApiOptions, ApiInterfaceEvents } from '@polkadot/api/types';
import { ProviderInterfaceEmitCb } from '@polkadot/rpc-provider/types';
var ERC20 = [
{
inputs: [
{
internalType: "address",
name: "owner",
type: "address"
},
{
internalType: "address",
name: "spender",
type: "address"
}
],
name: "allowance",
outputs: [
{
internalType: "uint256",
name: "",
type: "uint256"
}
],
stateMutability: "view",
type: "function"
},
{
inputs: [
{
internalType: "address",
name: "spender",
type: "address"
},
{
internalType: "uint256",
name: "value",
type: "uint256"
}
],
name: "approve",
outputs: [
{
internalType: "bool",
name: "",
type: "bool"
}
],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [
{
internalType: "address",
name: "owner",
type: "address"
}
],
name: "balanceOf",
outputs: [
{
internalType: "uint256",
name: "",
type: "uint256"
}
],
stateMutability: "view",
type: "function"
},
{
inputs: [
{
internalType: "address",
name: "spender",
type: "address"
},
{
internalType: "uint256",
name: "addedValue",
type: "uint256"
}
],
name: "increaseAllowance",
outputs: [
{
internalType: "bool",
name: "",
type: "bool"
}
],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [
],
name: "decimals",
outputs: [
{
name: "",
type: "uint8"
}
],
payable: false,
stateMutability: "view",
type: "function"
},
{
inputs: [
{
name: "to",
type: "address"
},
{
name: "value",
type: "uint256"
}
],
name: "transfer",
outputs: [
{
name: "",
type: "bool"
}
],
payable: false,
stateMutability: "nonpayable",
type: "function"
}
];
var WETH9$1 = [
{
constant: true,
inputs: [
],
name: "name",
outputs: [
{
name: "",
type: "string"
}
],
payable: false,
stateMutability: "view",
type: "function"
},
{
constant: false,
inputs: [
{
name: "guy",
type: "address"
},
{
name: "wad",
type: "uint256"
}
],
name: "approve",
outputs: [
{
name: "",
type: "bool"
}
],
payable: false,
stateMutability: "nonpayable",
type: "function"
},
{
constant: true,
inputs: [
],
name: "totalSupply",
outputs: [
{
name: "",
type: "uint256"
}
],
payable: false,
stateMutability: "view",
type: "function"
},
{
constant: false,
inputs: [
{
name: "src",
type: "address"
},
{
name: "dst",
type: "address"
},
{
name: "wad",
type: "uint256"
}
],
name: "transferFrom",
outputs: [
{
name: "",
type: "bool"
}
],
payable: false,
stateMutability: "nonpayable",
type: "function"
},
{
constant: false,
inputs: [
{
name: "wad",
type: "uint256"
}
],
name: "withdraw",
outputs: [
],
payable: false,
stateMutability: "nonpayable",
type: "function"
},
{
constant: true,
inputs: [
],
name: "decimals",
outputs: [
{
name: "",
type: "uint8"
}
],
payable: false,
stateMutability: "view",
type: "function"
},
{
constant: true,
inputs: [
{
name: "",
type: "address"
}
],
name: "balanceOf",
outputs: [
{
name: "",
type: "uint256"
}
],
payable: false,
stateMutability: "view",
type: "function"
},
{
constant: true,
inputs: [
],
name: "symbol",
outputs: [
{
name: "",
type: "string"
}
],
payable: false,
stateMutability: "view",
type: "function"
},
{
constant: false,
inputs: [
{
name: "dst",
type: "address"
},
{
name: "wad",
type: "uint256"
}
],
name: "transfer",
outputs: [
{
name: "",
type: "bool"
}
],
payable: false,
stateMutability: "nonpayable",
type: "function"
},
{
constant: false,
inputs: [
],
name: "deposit",
outputs: [
],
payable: true,
stateMutability: "payable",
type: "function"
},
{
constant: true,
inputs: [
{
name: "",
type: "address"
},
{
name: "",
type: "address"
}
],
name: "allowance",
outputs: [
{
name: "",
type: "uint256"
}
],
payable: false,
stateMutability: "view",
type: "function"
},
{
payable: true,
stateMutability: "payable",
type: "fallback"
},
{
anonymous: false,
inputs: [
{
indexed: true,
name: "src",
type: "address"
},
{
indexed: true,
name: "guy",
type: "address"
},
{
indexed: false,
name: "wad",
type: "uint256"
}
],
name: "Approval",
type: "event"
},
{
anonymous: false,
inputs: [
{
indexed: true,
name: "src",
type: "address"
},
{
indexed: true,
name: "dst",
type: "address"
},
{
indexed: false,
name: "wad",
type: "uint256"
}
],
name: "Transfer",
type: "event"
},
{
anonymous: false,
inputs: [
{
indexed: true,
name: "dst",
type: "address"
},
{
indexed: false,
name: "wad",
type: "uint256"
}
],
name: "Deposit",
type: "event"
},
{
anonymous: false,
inputs: [
{
indexed: true,
name: "src",
type: "address"
},
{
indexed: false,
name: "wad",
type: "uint256"
}
],
name: "Withdrawal",
type: "event"
}
];
var universalRouter = [
{
inputs: [
{
components: [
{
internalType: "address",
name: "permit2",
type: "address"
},
{
internalType: "address",
name: "weth9",
type: "address"
},
{
internalType: "address",
name: "v2Factory",
type: "address"
},
{
internalType: "address",
name: "v3Factory",
type: "address"
},
{
internalType: "bytes32",
name: "pairInitCodeHash",
type: "bytes32"
},
{
internalType: "bytes32",
name: "poolInitCodeHash",
type: "bytes32"
},
{
internalType: "address",
name: "v4PoolManager",
type: "address"
},
{
internalType: "address",
name: "v3NFTPositionManager",
type: "address"
},
{
internalType: "address",
name: "v4PositionManager",
type: "address"
}
],
internalType: "struct RouterParameters",
name: "params",
type: "tuple"
}
],
stateMutability: "nonpayable",
type: "constructor"
},
{
inputs: [
],
name: "BalanceTooLow",
type: "error"
},
{
inputs: [
],
name: "ContractLocked",
type: "error"
},
{
inputs: [
{
internalType: "Currency",
name: "currency",
type: "address"
}
],
name: "DeltaNotNegative",
type: "error"
},
{
inputs: [
{
internalType: "Currency",
name: "currency",
type: "address"
}
],
name: "DeltaNotPositive",
type: "error"
},
{
inputs: [
],
name: "ETHNotAccepted",
type: "error"
},
{
inputs: [
{
internalType: "uint256",
name: "commandIndex",
type: "uint256"
},
{
internalType: "bytes",
name: "message",
type: "bytes"
}
],
name: "ExecutionFailed",
type: "error"
},
{
inputs: [
],
name: "FromAddressIsNotOwner",
type: "error"
},
{
inputs: [
],
name: "InputLengthMismatch",
type: "error"
},
{
inputs: [
],
name: "InsufficientBalance",
type: "error"
},
{
inputs: [
],
name: "InsufficientETH",
type: "error"
},
{
inputs: [
],
name: "InsufficientToken",
type: "error"
},
{
inputs: [
{
internalType: "bytes4",
name: "action",
type: "bytes4"
}
],
name: "InvalidAction",
type: "error"
},
{
inputs: [
],
name: "InvalidBips",
type: "error"
},
{
inputs: [
{
internalType: "uint256",
name: "commandType",
type: "uint256"
}
],
name: "InvalidCommandType",
type: "error"
},
{
inputs: [
],
name: "InvalidEthSender",
type: "error"
},
{
inputs: [
],
name: "InvalidPath",
type: "error"
},
{
inputs: [
],
name: "InvalidReserves",
type: "error"
},
{
inputs: [
],
name: "LengthMismatch",
type: "error"
},
{
inputs: [
{
internalType: "uint256",
name: "tokenId",
type: "uint256"
}
],
name: "NotAuthorizedForToken",
type: "error"
},
{
inputs: [
],
name: "NotPoolManager",
type: "error"
},
{
inputs: [
],
name: "OnlyMintAllowed",
type: "error"
},
{
inputs: [
],
name: "SliceOutOfBounds",
type: "error"
},
{
inputs: [
],
name: "TransactionDeadlinePassed",
type: "error"
},
{
inputs: [
],
name: "UnsafeCast",
type: "error"
},
{
inputs: [
{
internalType: "uint256",
name: "action",
type: "uint256"
}
],
name: "UnsupportedAction",
type: "error"
},
{
inputs: [
],
name: "V2InvalidPath",
type: "error"
},
{
inputs: [
],
name: "V2TooLittleReceived",
type: "error"
},
{
inputs: [
],
name: "V2TooMuchRequested",
type: "error"
},
{
inputs: [
],
name: "V3InvalidAmountOut",
type: "error"
},
{
inputs: [
],
name: "V3InvalidCaller",
type: "error"
},
{
inputs: [
],
name: "V3InvalidSwap",
type: "error"
},
{
inputs: [
],
name: "V3TooLittleReceived",
type: "error"
},
{
inputs: [
],
name: "V3TooMuchRequested",
type: "error"
},
{
inputs: [
{
internalType: "uint256",
name: "minAmountOutReceived",
type: "uint256"
},
{
internalType: "uint256",
name: "amountReceived",
type: "uint256"
}
],
name: "V4TooLittleReceived",
type: "error"
},
{
inputs: [
{
internalType: "uint256",
name: "maxAmountInRequested",
type: "uint256"
},
{
internalType: "uint256",
name: "amountRequested",
type: "uint256"
}
],
name: "V4TooMuchRequested",
type: "error"
},
{
inputs: [
],
name: "V3_POSITION_MANAGER",
outputs: [
{
internalType: "contract INonfungiblePositionManager",
name: "",
type: "address"
}
],
stateMutability: "view",
type: "function"
},
{
inputs: [
],
name: "V4_POSITION_MANAGER",
outputs: [
{
internalType: "contract IPositionManager",
name: "",
type: "address"
}
],
stateMutability: "view",
type: "function"
},
{
inputs: [
{
internalType: "bytes",
name: "commands",
type: "bytes"
},
{
internalType: "bytes[]",
name: "inputs",
type: "bytes[]"
}
],
name: "execute",
outputs: [
],
stateMutability: "payable",
type: "function"
},
{
inputs: [
{
internalType: "bytes",
name: "commands",
type: "bytes"
},
{
internalType: "bytes[]",
name: "inputs",
type: "bytes[]"
},
{
internalType: "uint256",
name: "deadline",
type: "uint256"
}
],
name: "execute",
outputs: [
],
stateMutability: "payable",
type: "function"
},
{
inputs: [
],
name: "msgSender",
outputs: [
{
internalType: "address",
name: "",
type: "address"
}
],
stateMutability: "view",
type: "function"
},
{
inputs: [
],
name: "poolManager",
outputs: [
{
internalType: "contract IPoolManager",
name: "",
type: "address"
}
],
stateMutability: "view",
type: "function"
},
{
inputs: [
{
internalType: "int256",
name: "amount0Delta",
type: "int256"
},
{
internalType: "int256",
name: "amount1Delta",
type: "int256"
},
{
internalType: "bytes",
name: "data",
type: "bytes"
}
],
name: "uniswapV3SwapCallback",
outputs: [
],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [
{
internalType: "bytes",
name: "data",
type: "bytes"
}
],
name: "unlockCallback",
outputs: [
{
internalType: "bytes",
name: "",
type: "bytes"
}
],
stateMutability: "nonpayable",
type: "function"
},
{
stateMutability: "payable",
type: "receive"
}
];
var zenswap = [
{
inputs: [
{
internalType: "address",
name: "_universalRouter",
type: "address"
},
{
internalType: "address",
name: "_permit2",
type: "address"
}
],
stateMutability: "nonpayable",
type: "constructor"
},
{
inputs: [
],
name: "ErrorInvalidIntermediateToken",
type: "error"
},
{
inputs: [
],
name: "ErrorNotEnoughNativeToken",
type: "error"
},
{
inputs: [
],
name: "ErrorSwapFailed",
type: "error"
},
{
inputs: [
{
internalType: "address",
name: "token",
type: "address"
}
],
name: "SafeERC20FailedOperation",
type: "error"
},
{
inputs: [
{
internalType: "bytes",
name: "rawParams",
type: "bytes"
},
{
internalType: "uint256",
name: "amountIn",
type: "uint256"
}
],
name: "onReceive",
outputs: [
],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [
],
name: "permit2",
outputs: [
{
internalType: "contract IPermit2",
name: "",
type: "address"
}
],
stateMutability: "view",
type: "function"
},
{
inputs: [
{
components: [
{
internalType: "address",
name: "tokenIn",
type: "address"
},
{
internalType: "address",
name: "tokenOut",
type: "address"
},
{
internalType: "uint256",
name: "deadline",
type: "uint256"
},
{
internalType: "bytes",
name: "commands",
type: "bytes"
},
{
internalType: "bytes[]",
name: "inputs",
type: "bytes[]"
}
],
internalType: "struct UniswapWrapper.SwapParams",
name: "sourceParams",
type: "tuple"
},
{
internalType: "address payable",
name: "recipient",
type: "address"
},
{
internalType: "uint256",
name: "amountIn",
type: "uint256"
}
],
name: "swap",
outputs: [
],
stateMutability: "payable",
type: "function"
},
{
inputs: [
{
internalType: "bytes",
name: "pluginParams",
type: "bytes"
},
{
components: [
{
internalType: "address",
name: "tokenIn",
type: "address"
},
{
internalType: "address",
name: "tokenOut",
type: "address"
},
{
internalType: "uint256",
name: "deadline",
type: "uint256"
},
{
internalType: "bytes",
name: "commands",
type: "bytes"
},
{
internalType: "bytes[]",
name: "inputs",
type: "bytes[]"
}
],
internalType: "struct UniswapWrapper.SwapParams",
name: "sourceParams",
type: "tuple"
},
{
components: [
{
internalType: "address",
name: "tokenIn",
type: "address"
},
{
internalType: "address",
name: "tokenOut",
type: "address"
},
{
internalType: "uint256",
name: "deadline",
type: "uint256"
},
{
internalType: "bytes",
name: "commands",
type: "bytes"
},
{
internalType: "bytes[]",
name: "inputs",
type: "bytes[]"
}
],
internalType: "struct UniswapWrapper.SwapParams",
name: "destParams",
type: "tuple"
},
{
internalType: "address payable",
name: "recipient",
type: "address"
},
{
internalType: "address",
name: "plugin",
type: "address"
},
{
internalType: "uint256",
name: "amountIn",
type: "uint256"
}
],
name: "swapSend",
outputs: [
],
stateMutability: "payable",
type: "function"
},
{
inputs: [
],
name: "universalRouter",
outputs: [
{
internalType: "contract IUniversalRouter",
name: "",
type: "address"
}
],
stateMutability: "view",
type: "function"
},
{
stateMutability: "payable",
type: "receive"
}
];
var zenswapGmpPlugin = [
{
inputs: [
],
name: "ErrorCCTPReceiveFailure",
type: "error"
},
{
inputs: [
],
name: "ErrorInvalidFallbackRecipient",
type: "error"
},
{
inputs: [
],
name: "ErrorInvalidGateway",
type: "error"
},
{
inputs: [
],
name: "ErrorInvalidRecipient",
type: "error"
},
{
inputs: [
],
name: "ErrorNotEnoughForFee",
type: "error"
},
{
inputs: [
],
name: "InvalidInitialization",
type: "error"
},
{
inputs: [
],
name: "NotInitializing",
type: "error"
},
{
inputs: [
{
internalType: "address",
name: "owner",
type: "address"
}
],
name: "OwnableInvalidOwner",
type: "error"
},
{
inputs: [
{
internalType: "address",
name: "account",
type: "address"
}
],
name: "OwnableUnauthorizedAccount",
type: "error"
},
{
inputs: [
{
internalType: "address",
name: "token",
type: "address"
}
],
name: "SafeERC20FailedOperation",
type: "error"
},
{
anonymous: false,
inputs: [
{
indexed: false,
internalType: "address",
name: "sender",
type: "address"
},
{
indexed: false,
internalType: "bytes32",
name: "id",
type: "bytes32"
},
{
indexed: false,
internalType: "bytes",
name: "payload",
type: "bytes"
}
],
name: "GmpReceived",
type: "event"
},
{
anonymous: false,
inputs: [
{
indexed: false,
internalType: "uint64",
name: "version",
type: "uint64"
}
],
name: "Initialized",
type: "event"
},
{
anonymous: false,
inputs: [
{
indexed: false,
internalType: "bytes",
name: "message",
type: "bytes"
}
],
name: "MessageSent",
type: "event"
},
{
anonymous: false,
inputs: [
{
indexed: true,
internalType: "address",
name: "previousOwner",
type: "address"
},
{
indexed: true,
internalType: "address",
name: "newOwner",
type: "address"
}
],
name: "OwnershipTransferred",
type: "event"
},
{
inputs: [
],
name: "cctpMessageTransmitter",
outputs: [
{
internalType: "contract IMessageTransmitter",
name: "",
type: "address"
}
],
stateMutability: "view",
type: "function"
},
{
inputs: [
],
name: "cctpReceiver",
outputs: [
{
internalType: "contract IReceiver",
name: "",
type: "address"
}
],
stateMutability: "view",
type: "function"
},
{
inputs: [
],
name: "cctpTokenMessenger",
outputs: [
{
internalType: "contract ITokenMessenger",
name: "",
type: "address"
}
],
stateMutability: "view",
type: "function"
},
{
inputs: [
{
internalType: "uint16",
name: "networkId",
type: "uint16"
},
{
internalType: "uint256",
name: "messageSize",
type: "uint256"
},
{
internalType: "uint256",
name: "gasLimit",
type: "uint256"
}
],
name: "estimateMessageCost",
outputs: [
{
internalType: "uint256",
name: "",
type: "uint256"
}
],
stateMutability: "view",
type: "function"
},
{
inputs: [
],
name: "fee",
outputs: [
{
internalType: "uint256",
name: "",
type: "uint256"
}
],
stateMutability: "view",
type: "function"
},
{
inputs: [
{
internalType: "address",
name: "recipient",
type: "address"
},
{
internalType: "uint256",
name: "amount",
type: "uint256"
},
{
internalType: "bytes",
name: "message",
type: "bytes"
},
{
internalType: "bytes",
name: "attestation",
type: "bytes"
}
],
name: "forceCctpReceive",
outputs: [
],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [
],
name: "gmpGateway",
outputs: [
{
internalType: "contract IGateway",
name: "",
type: "address"
}
],
stateMutability: "view",
type: "function"
},
{
inputs: [
{
internalType: "address",
name: "_gmpGateway",
type: "address"
},
{
internalType: "address",
name: "_cctpMessenger",
type: "address"
},
{
internalType: "address",
name: "_cctpReceiver",
type: "address"
},
{
internalType: "address",
name: "_usdc",
type: "address"
},
{
internalType: "uint256",
name: "_fee",
type: "uint256"
}
],
name: "initialize",
outputs: [
],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [
{
internalType: "bytes32",
name: "id",
type: "bytes32"
},
{
internalType: "uint128",
name: "",
type: "uint128"
},
{
internalType: "bytes32",
name: "",
type: "bytes32"
},
{
internalType: "uint64",
name: "",
type: "uint64"
},
{
internalType: "bytes",
name: "payload",
type: "bytes"
}
],
name: "onGmpReceived",
outputs: [
{
internalType: "bytes32",
name: "",
type: "bytes32"
}
],
stateMutability: "payable",
type: "function"
},
{
inputs: [
],
name: "owner",
outputs: [
{
internalType: "address",
name: "",
type: "address"
}
],
stateMutability: "view",
type: "function"
},
{
inputs: [
],
name: "renounceOwnership",
outputs: [
],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [
{
internalType: "bytes",
name: "pluginParams",
type: "bytes"
},
{
internalType: "bytes",
name: "extraData",
type: "bytes"
},
{
internalType: "uint256",
name: "amount",
type: "uint256"
}
],
name: "submit",
outputs: [
],
stateMutability: "payable",
type: "function"
},
{
inputs: [
{
internalType: "address",
name: "recipient",
type: "address"
}
],
name: "takeFee",
outputs: [
],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [
{
internalType: "address",
name: "newOwner",
type: "address"
}
],
name: "transferOwnership",
outputs: [
],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [
{
internalType: "uint256",
name: "newFee",
type: "uint256"
}
],
name: "updateFee",
outputs: [
],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [
{
internalType: "address",
name: "newGateway",
type: "address"
}
],
name: "updateGateway",
outputs: [
],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [
{
internalType: "address",
name: "_gmpGateway",
type: "address"
},
{
internalType: "address",
name: "_cctpMessenger",
type: "address"
},
{
internalType: "address",
name: "_cctpReceiver",
type: "address"
},
{
internalType: "address",
name: "_usdc",
type: "address"
},
{
internalType: "uint256",
name: "_fee",
type: "uint256"
}
],
name: "updateParams",
outputs: [
],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [
],
name: "usdc",
outputs: [
{
internalType: "contract IERC20",
name: "",
type: "address"
}
],
stateMutability: "view",
type: "function"
}
];
var zenswapCctpV2Plugin = [
{
inputs: [
],
name: "ErrorCCTPReceiveFailure",
type: "error"
},
{
inputs: [
],
name: "ErrorHookParsingFailed",
type: "error"
},
{
inputs: [
],
name: "ErrorInvalidFallbackRecipient",
type: "error"
},
{
inputs: [
],
name: "ErrorInvalidMessageBodyVersion",
type: "error"
},
{
inputs: [
],
name: "ErrorInvalidMessageVersion",
type: "error"
},
{
inputs: [
],
name: "ErrorInvalidPlugin",
type: "error"
},
{
inputs: [
],
name: "ErrorInvalidRecipient",
type: "error"
},
{
inputs: [
],
name: "ErrorInvalidRewardAmount",
type: "error"
},
{
inputs: [
],
name: "ErrorNoUSDC",
type: "error"
},
{
inputs: [
],
name: "ErrorNotEnoughForFee",
type: "error"
},
{
inputs: [
],
name: "InvalidInitialization",
type: "error"
},
{
inputs: [
],
name: "NotInitializing",
type: "error"
},
{
inputs: [
{
internalType: "address",
name: "owner",
type: "address"
}
],
name: "OwnableInvalidOwner",
type: "error"
},
{
inputs: [
{
internalType: "address",
name: "account",
type: "address"
}
],
name: "OwnableUnauthorizedAccount",
type: "error"
},
{
inputs: [
{
internalType: "address",
name: "token",
type: "address"
}
],
name: "SafeERC20FailedOperation",
type: "error"
},
{
anonymous: false,
inputs: [
{
indexed: false,
internalType: "address",
name: "recipient",
type: "address"
},
{
indexed: false,
internalType: "uint256",
name: "amount",
type: "uint256"
},
{
indexed: false,
internalType: "bool",
name: "isFallback",
type: "bool"
}
],
name: "Executed",
type: "event"
},
{
anonymous: false,
inputs: [
{
indexed: false,
internalType: "uint64",
name: "version",
type: "uint64"
}
],
name: "Initialized",
type: "event"
},
{
anonymous: false,
inputs: [
{
indexed: true,
internalType: "address",
name: "previousOwner",
type: "address"
},
{
indexed: true,
internalType: "address",
name: "newOwner",
type: "address"
}
],
name: "OwnershipTransferred",
type: "event"
},
{
anonymous: false,
inputs: [
{
indexed: false,
internalType: "uint32",
name: "cctpDestinationDomain",
type: "uint32"
},
{
indexed: false,
internalType: "address",
name: "destPlugin",
type: "address"
},
{
indexed: false,
internalType: "address",
name: "recipient",
type: "address"
},
{
indexed: false,
internalType: "address",
name: "fallbackRecipient",
type: "address"
},
{
indexed: false,
internalType: "uint256",
name: "amount",
type: "uint256"
},
{
indexed: false,
internalType: "uint256",
name: "rewardAmount",
type: "uint256"
}
],
name: "PluginMessageSent",
type: "event"
},
{
inputs: [
],
name: "cctpMessageTransmitter",
outputs: [
{
internalType: "contract IMessageTransmitterV2",
name: "",
type: "address"
}
],
stateMutability: "view",
type: "function"
},
{
inputs: [
],
name: "cctpReceiver",
outputs: [
{
internalType: "contract IReceiverV2",
name: "",
type: "address"
}
],
stateMutability: "view",
type: "function"
},
{
inputs: [
],
name: "cctpTokenMessenger",
outputs: [
{
internalType: "contract ITokenMessengerV2",
name: "",
type: "address"
}
],
stateMutability: "view",
type: "function"
},
{
inputs: [
],
name: "fee",
outputs: [
{
internalType: "uint256",
name: "",
type: "uint256"
}
],
stateMutability: "view",
type: "function"
},
{
inputs: [
{
internalType: "address",
name: "recipient",
type: "address"
},
{
internalType: "bytes",
name: "message",
type: "bytes"
},
{
internalType: "bytes",
name: "attestation",
type: "bytes"
}
],
name: "forceCctpReceive",
outputs: [
],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [
{
internalType: "address",
name: "_cctpMessenger",
type: "address"
},
{
internalType: "address",
name: "_cctpReceiver",
type: "address"
},
{
internalType: "address",
name: "_usdc",
type: "address"
},
{
internalType: "uint256",
name: "_fee",
type: "uint256"
}
],
name: "initialize",
outputs: [
],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [
],
name: "owner",
outputs: [
{
internalType: "address",
name: "",
type: "address"
}
],
stateMutability: "view",
type: "function"
},
{
inputs: [
{
internalType: "bytes",
name: "message",
type: "bytes"
},
{
internalType: "bytes",
name: "attestation",
type: "bytes"
}
],
name: "receiveMessage",
outputs: [
],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [
],
name: "renounceOwnership",
outputs: [
],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [
{
internalType: "bytes",
name: "pluginParams",
type: "bytes"
},
{
internalType: "bytes",
name: "extraData",
type: "bytes"
},
{
internalType: "uint256",
name: "amount",
type: "uint256"
}
],
name: "submit",
outputs: [
],
stateMutability: "payable",
type: "function"
},
{
inputs: [
],
name: "supportedMessageBodyVersion",
outputs: [
{
internalType: "uint32",
name: "",
type: "uint32"
}
],
stateMutability: "view",
type: "function"
},
{
inputs: [
],
name: "supportedMessageVersion",
outputs: [
{
internalType: "uint32",
name: "",
type: "uint32"
}
],
stateMutability: "view",
type: "function"
},
{
inputs: [
{
internalType: "address",
name: "recipient",
type: "address"
}
],
name: "takeFee",
outputs: [
],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [
{
internalType: "address",
name: "newOwner",
type: "address"
}
],
name: "transferOwnership",
outputs: [
],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [
{
internalType: "uint256",
name: "newFee",
type: "uint256"
}
],
name: "updateFee",
outputs: [
],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [
{
internalType: "address",
name: "_cctpMessenger",
type: "address"
},
{
internalType: "address",
name: "_cctpReceiver",
type: "address"
},
{
internalType: "address",
name: "_usdc",
type: "address"
},
{
internalType: "uint256",
name: "_fee",
type: "uint256"
}
],
name: "updateParams",
outputs: [
],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [
],
name: "usdc",
outputs: [
{
internalType: "contract IERC20",
name: "",
type: "address"
}
],
stateMutability: "view",
type: "function"
}
];
declare const ZeroStringValue = "0";
declare const MaxUint256 = "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff";
declare enum NetworkId {
EthereumMainnet = "mainnet",
EthereumSepolia = "sepolia",
BnbMainnet = "bnb-mainnet",
BnbTestnet = "bnb-testnet",
PolygonMainnet = "polygon-mainnet",
PolygonAmoy = "polygon-amoy",
AvalancheMainnet = "avalanche-mainnet",
AvalancheFuji = "avalanche-fuji",
ArbitrumMainnet = "arbitrum-mainnet",
ArbitrumSepolia = "arbitrum-sepolia",
BaseMainnet = "base-mainnet",
BaseSepolia = "base-sepolia",
OptimismMainnet = "optimism-mainnet",
OptimismSepolia = "optimism-sepolia",
BlastMainnet = "blast-mainnet",
BlastSepolia = "blast-sepolia",
CeloMainnet = "celo-mainnet",
CeloAlfajores = "celo-alfajores",
UnichainMainnet = "unichain-mainnet",
UnichainSepolia = "unichain-sepolia",
EthereumSepoliaMirror = "sepolia-mirror"
}
declare enum ChainId {
EthereumMainnet = 1,
EthereumSepolia = 11155111,
BnbMainnet = 56,
BnbTestnet = 97,
PolygonMainnet = 137,
PolygonAmoy = 80002,
AvalancheMainnet = 43114,
AvalancheFuji = 43113,
ArbitrumMainnet = 42161,
ArbitrumSepolia = 421614,
BaseMainnet = 8453,
BaseSepolia = 84532,
OptimismMainnet = 10,
OptimismSepolia = 11155420,
BlastMainnet = 81457,
BlastSepolia = 168587773,
CeloMainnet = 42220,
CeloAlfajores = 44787,
UnichainMainnet = 130,
UnichainSepolia = 1301,
EthereumSepoliaMirror = 9007199254740991
}
declare const MAINNET_CHAINS: ChainId[];
type NumberIsh = string | number;
type BigintIsh = string | number | bigint;
type WithRequiredProp<Type, Key extends keyof Type> = Type & Required<Pick<Type, Key>>;
type EvmNetworkId = string;
type EvmChainId = number;
declare function getNetworkId(chainId: number): NetworkId;
declare function getChainId(networkId: string): ChainId;
declare function getL1Chain(chainId: EvmChainId): EvmChainId;
declare function addressesAreEqual(a: string, b: string): boolean;
declare function parseUnits(amount: string, decimals: number): bigint;
declare function formatUnits(amount: BigintIsh, decimals?: number): string;
declare function hexToNumber(hex: string): number;
declare function isNullableAddress(address: string): boolean;
declare function isValidAddress(address: string): boolean;
type BasicToken = {
decimals: number;
symbol?: string;
name?: string;
icon?: string;
};
type NetworkTokenId = {
address: string;
networkId: EvmNetworkId;
};
type NetworkToken = BasicToken & NetworkTokenId;
type TokenNetworksMap = {
[id: EvmNetworkId]: NetworkToken;
};
declare const NATIVE: TokenNetworksMap;
declare const USDC: TokenNetworksMap;
declare const WETH9: TokenNetworksMap;
declare const tokenId: <T extends NetworkTokenId>(token: T) => string;
declare const tokenInfoToNetworkToken: (token: TokenInfo) => NetworkToken | null;
declare const getMaxValue: (balance: string, fee?: number | string, isNative?: boolean) => string;
declare const getUSDC: (networkId: EvmNetworkId) => NetworkToken | null;
declare const isUSDC: <T extends NetworkTokenId>(token: T) => boolean;
declare const getNative: (networkId: EvmNetworkId) => NetworkToken;
declare const isNative: <T extends NetworkTokenId>(token: T) => boolean;
declare const getWrappedNative: (networkId: EvmNetworkId) => NetworkToken | null;
declare const isWrappedNative: <T extends NetworkTokenId>(token: T) => boolean;
interface NetworkData {
id: EvmNetworkId;
chainId: EvmChainId;
name: string;
nativeCurrency: NetworkToken;
blockExplorerUrls: string[];
shortName: string;
rpcUrls: string[];
wssUrls?: string[];
}
declare const MAINNETS: string[];
declare const TESTNETS: string[];
declare const EVM_NETWORKS: Record<EvmNetworkId, NetworkData>;
declare const getNetworkData: (id: EvmNetworkId) => NetworkData;
declare const isMainnet: (networkId: EvmNetworkId) => boolean;
declare const getNetworkIconName: (networkId: EvmNetworkId) => string;
declare const getBlockProductionTime: (networkId: EvmNetworkId) => number | null;
declare enum PredefinedProvider {
Fearless = "Fearless Wallet",
WalletConnect = "WalletConnect",
MetaMask = "MetaMask"
}
declare enum ProviderError {
DisconnectedFromChain = 1013,
UserRejectedRequest = 4001,
UnsupportedMethod = 4200,
AlreadyProcessing = -32002
}
type TxRequest = TransactionRequest;
type TxResponse = TransactionResponse;
type TxReceipt = TransactionReceipt;
type EthersProvider = JsonRpcApiProvider;
type EthersContractRunner = ContractRunner;
type Nullable<T> = T | null | undefined;
type ChainsProps = {
chains: EvmChainId[];
optionalChains?: EvmChainId[];
};
type EIP1193Provider = Eip1193Provider & {
connect?: (...args: unknown[]) => Promise<void>;
disconnect?: () => void;
on?: (e: string, cb: any) => void;
off?: (e: string, cb: any) => void;
addListener?: (e: string, cb: any) => void;
removeListener?: (e: string, cb: any) => void;
};
type EIP6963ProviderInfo = {
rdns: string;
uuid: string;
name: string;
icon: string;
};
type EIP6963ProviderDetail = {
info: EIP6963ProviderInfo;
provider: EIP1193Provider;
};
type EIP6963AnnounceProviderEvent = {
detail: EIP6963ProviderDetail;
};
type AppEIPProvider = EIP6963ProviderInfo & {
installed?: boolean;
installUrl?: string;
getProvider: (chainProps?: ChainsProps) => Promise<Nullable<EIP1193Provider>>;
};
declare const getInstallUrl: ({ chromeUrl, mozillaUrl }: {
chromeUrl: string;
mozillaUrl: string;
}) => string;
declare const FearlessWalletProvider: AppEIPProvider;
declare const MetamaskProvider: AppEIPProvider;
type FnWithoutArgs<T = void> = () => T;
declare function getProvidersList(onProviderAnnouncement: (event: EIP6963AnnounceProviderEvent) => void): () => void;
declare const handleRpcProviderError: (error: any) => string;
declare function connectEvmProvider(appEvmProvider: AppEIPProvider, chainsProps: ChainsProps): Promise<string>;
declare function disconnectEvmProvider(): void;
declare function getEthersProvider(provider?: EthersProvider): EthersProvider;
declare function getSigner(provider?: EthersProvider): Promise<ethers$1.JsonRpcSigner>;
declare function getAccount(): Promise<string>;
declare function getContract(contractAddress: string, contractAbi: ethers$1.Interface | ethers$1.InterfaceAbi, runner?: EthersContractRunner | null): Promise<ethers$1.Contract>;
declare function getTokenContract(tokenAddress: string, runner?: EthersContractRunner | null): Promise<ethers$1.Contract>;
/**
* Get account native token balance (ETH for Ethereum)
* @param accountAddress address of account
*/
declare function getBalance(accountAddress: string, provider?: EthersProvider): Promise<bigint>;
declare function getTokenBalance(accountAddress: string, token: NetworkToken, runner?: EthersContractRunner | null): Promise<bigint>;
declare function getTokenDecimals(tokenAddress: string, runner?: EthersContractRunner | null): Promise<number | undefined>;
declare function getAllowance(accountAddress: string, contractAddress: string, token: NetworkToken, runner?: EthersContractRunner | null): Promise<bigint | null>;
declare function approveToken(contractAddress: string, tokenAddress: string, runner?: EthersContractRunner | null, amount?: string | bigint): Promise<any>;
declare function watchEthereum(cb: {
onAccountChange: (addressList: string[]) => void;
onNetworkChange: (networkId: string) => void;
onDisconnect: (error: any) => void;
}): Promise<FnWithoutArgs>;
declare function requestWalletAccounts(): Promise<string[]>;
declare function revokeWalletAccounts(): Promise<void>;
declare function addToken(address: string, symbol: string, decimals: number, image?: string): Promise<void>;
/**
* Add chain to Metamask
* @param network network data
* @param chainName translated chain name
*/
declare function switchOrAddChain(network: NetworkData): Promise<void>;
declare function getEvmChainId(provider?: EthersProvider): Promise<number>;
declare function waitForEvmTransaction(hash: string, provider?: EthersProvider): Promise<TxReceipt | null>;
declare function getEvmTransaction(hash: string, provider?: EthersProvider): Promise<TxResponse | null>;
declare function getEvmTransactionReceipt(hash: string, provider?: EthersProvider): Promise<TxReceipt | null>;
declare function getBlock(number: number, provider?: EthersProvider): Promise<ethers$1.Block | null>;
declare function getBlockNumber(provider?: EthersProvider): Promise<number>;
declare function sendTransaction(tx: TxRequest): Promise<TxResponse>;
declare function waitForEvmTransactionMined(tx: TxResponse | null, replaceCallback?: (tx: TxResponse | null) => void, provider?: EthersProvider): Promise<TxReceipt | null>;
declare const getEvmTransactionFee: (tx: TxResponse | TxReceipt) => bigint;
type GasData = {
baseFeePerGas: bigint | null;
maxPriorityFeePerGas: bigint | null;
};
declare class OnchainProvider {
static getChainUrl(networkId: EvmNetworkId, rpcOnly?: boolean): string;
static getProvider(networkId: EvmNetworkId, rpcOnly?: boolean): ethers$1.WebSocketProvider | ethers$1.JsonRpcProvider;
static getGasData(networkId: EvmNetworkId): Promise<GasData>;
static estimateGasUsed(networkId: EvmNetworkId, tx: ethers$1.TransactionRequest): Promise<bigint>;
}
declare enum SwapStrategy {
/** Swap in chain A */
Swap = "Swap",
/** Swap in chain A, Transfer to chain B */
SwapAndTransfer = "SwapAndTransfer",
/** Transfer to chain B, Swap in chain B */
TransferAndSwap = "TransferAndSwap",
/** Transfer to chain B */
Transfer = "Transfer",
/** Swap in chain A, Transfer to chain B, Swap in chain B */
SwapAndSwap = "SwapAndSwap",
/** Swap in chain A from Native to Wrapped */
Wrap = "WrapNative",
/** Swap in chain A from Wrapped to Native */
Unwrap = "Unwrap"
}
declare enum RouteType {
Swap = "Swap",
Transfer = "Transfer"
}
declare enum RouterError {
RouterContractSource = "RouterContractSource",
RouterContractDestination = "RouterContractDestination",
RouterPlugin = "RouterPlugin",
RouterPluginSource = "RouterPluginSource",
RouterPluginDestination = "RouterPluginDestination",
RouterTransferTokenSource = "RouterTransferTokenSource",
RouterTransferTokenDestination = "RouterTransferTokenDestination",
InputAmountIsZero = "InputAmountIsZero",
InsufficientAmountToPayTransferFees = "InsufficientAmountToPayTransferFees",
InsufficientAmountToPayPluginFee = "InsufficientAmountToPayPluginFee",
RouteNotFound = "RouteNotFound",
RouteNotFoundSource = "RouteNotFoundSource",
RouteNotFoundDestination = "RouteNotFoundDestination",
TransferAllowanceIsExceeded = "TransferAllowanceIsExceeded"
}
declare class SwapTransferFee implements ISwapTransferFee {
token: NetworkToken;
gasLimit: bigint;
value: bigint;
constructor(token: NetworkToken, gasLimit?: bigint | null, value?: bigint | null);
get amount(): string;
}
declare class SwapFee implements ISwapFee {
token: NetworkToken;
gasLimit: bigint;
baseFeePerGas: bigint;
baseCoeff: number;
priorityFeePerGas: bigint;
priorityCoeff: number;
additionalValue: bigint;
constructor(token: NetworkToken, gasLimit?: bigint | null, baseFeePerGas?: bigint | null);
get maxPriorityFeePerGas(): bigint;
get maxFeePerGas(): bigint;
get amount(): string;
}
type CctpTxMessage = {
message: string;
eventNonce: string;
attestation: string;
cctpVersion: number;
status: string;
};
declare class CircleCCTPApi {
protected static getEndpoint(mainnet?: boolean): string;
/**
* Returns the fees for USDC fast burn transfers between specified source and destination chains.
* @param sourceChainId The source chain ID for the transfer.
* @param destChainId The destination chain ID for the transfer.
* @returns The minimum fee for the transaction, in percent (0.01%).
*/
static v2FastBurnMinimumFee(sourceChainId: EvmChainId, destChainId: EvmChainId): Promise<number>;
/**
* Retrieves the current USDC Fast Transfer allowance remaining.
* @param chainId The source chain ID for the transfer.
* @returns The current USDC Fast Burn allowance remaining, in full units of USDC up to 6 decimals; for example, 123999.999999 USDC.
*/
static v2FastBurnAllowance(chainId: EvmChainId): Promise<number>;
/**
* Retrieves messages and attestations for a given transaction or nonce, supporting both V1 and V2 messages.
* @param chainId The source chain ID associated with the transaction message.
* @param txHash The transaction hash to filter messages.
* @returns CCTP transaction messages.
*/
static getTransactionMessages(chainId: EvmChainId, txHash: string): Promise<CctpTxMessage[]>;
protected static request(url: string): Promise<any>;
}
declare enum CCTP_DOMAIN_V1 {
Ethereum = 0,
Avalanche = 1,
Optimism = 2,
Arbitrum = 3,
Noble = 4,
Solana = 5,
Base = 6,
Polygon = 7,
Sui = 8,
Aptos = 9,
Unichain = 10,
Test = 99
}
declare enum CCTP_DOMAIN_V2 {
Ethereum = 0,
Avalanche = 1,
Arbitrum = 3,
Base = 6,
Linea = 11,
Sonic = 13,
Test = 99
}
declare enum CCTP_API_ENDPOINT {
Testnet = "https://iris-api-sandbox.circle.com",
Mainnet = "https://iris-api.circle.com"
}
declare enum CCTP_THRESHOLD {
Fast = 1000,
Standart = 2000
}
declare function getDomainV1(chainId: EvmChainId, isTest?: boolean): CCTP_DOMAIN_V1;
declare function getDomainV2(chainId: EvmChainId, isTest?: boolean): CCTP_DOMAIN_V2;
type AttestationBlocksData = {
count: number;
onChain: EvmChainId;
};
declare function getAttestationBlocksStandart(chainId: EvmChainId): AttestationBlocksData;
declare function getAttestationBlocksFast(chainId: EvmChainId): AttestationBlocksData;
declare function receiveCCTPMessage(sourceChainId: EvmChainId, sourceTxHash: string, destChainId: EvmChainId, destPluginAddress: string, provider?: EthersProvider): Promise<any>;
type ZenswapContracts = {
[chainId: EvmChainId]: {
kirapay: string;
gmpPlugin: string;
gmpGateway: string;
cctpV2Plugin?: string;
};
};
type GmpIds = {
[chainId: EvmChainId]: number;
};
interface ParamsStruct<Args, Params> {
args: Args;
params: Params;
}
type GmpPluginArgs = {
/** Plugin address on destination chain */
destPlugin: string;
/** Extra data recipient (Kirapay contract) */
recipient: string;
/** USDC recipient in case of onReceived fail (user) */
fallbackRecipient: string;
/** CCTP V1 destination domain */
cctpDestinationDomain: number;
/** GMP destination network id */
gmpDestNetwork: number;
/** GMP gas limit */
gmpGasLimit: bigint;
};
type CctpV2PluginArgs = {
/** Plugin address on destination chain */
destPlugin: string;
/** Extra data recipient (Kirapay contract) */
recipient: string;
/** USDC recipient in case of `onReceived` fail (user) */
fallbackRecipient: string;
/** CCTP V2 destination domain */
cctpDestinationDomain: number;
/** Maximum fee to pay on destination domain (USDC) */
maxFee: BigintIsh;
/** Minimum finality threshold for attestation */
minFinalityThreshold: number;
/** Reward amount for `receiveMessage` caller */
rewardAmount: BigintIsh;
};
type ZenswapPluginArgs = GmpPluginArgs | CctpV2PluginArgs;
type IPluginParamsStruct<T extends ZenswapPluginArgs> = ParamsStruct<T, string>;
type UniswapSwapArgs = {
tokenIn: string;
tokenOut: string;
deadline: bigint;
commands: string;
inputs: string[];
};
type UniswapSwapParams = [
UniswapSwapArgs["tokenIn"],
UniswapSwapArgs["tokenOut"],
UniswapSwapArgs["deadline"],
UniswapSwapArgs["commands"],
UniswapSwapArgs["inputs"]
];
type ISwapParamsStruct = ParamsStruct<UniswapSwapArgs, UniswapSwapParams>;
type ZenswapSwapMethodArgs = {
sourceParams: ISwapParamsStruct;
recipient: string;
amountIn: bigint;
};
type ZenswapSwapSendMethodArgs = {
pluginParams: IPluginParamsStruct<ZenswapPluginArgs>;
sourceParams: ISwapParamsStruct;
destParams: ISwapParamsStruct;
recipient: string;
plugin: string;
amountIn: bigint;
};
interface SwapAmount {
token: NetworkToken;
amount: string;
}
interface SwapAmountMin extends SwapAmount {
amountMin: string;
}
interface ISwapTransferFee extends SwapAmount {
gasLimit: bigint;
}
interface TransferError {
code: string;
message: string;
requiredFee?: SwapAmount;
minimumAmount?: SwapAmount;
}
interface ISwapFee extends SwapAmount {
gasLimit: bigint;
baseFeePerGas: bigint;
maxFeePerGas: bigint;
maxPriorityFeePerGas: bigint;
}
interface SwapPath {
input: SwapAmount;
output: SwapAmount;
percent: number;
path: NetworkToken[];
protocol?: string;
}
interface SwapRoute {
type: RouteType;
input: SwapAmount;
output: SwapAmount;
route: SwapPath[];
}
type SwapRoutes = SwapRoute[];
interface SwapMethodParameters {
/**
* The hex encoded calldata to perform the given operation
*/
data: string;
/**
* The amount of ether (wei) to send.
*/
value: bigint;
/**
* Router address
*/
to: string;
}
interface SwapMethod {
/**
* Method name
*/
name: string;
/**
* Method abi fragment
*/
signature: string;
/**
* Method args
*/
args: Record<string, any>;
/**
* Method parameters for direct swap
*/
parameters: SwapMethodParameters;
}
interface SwapSettings {
/** Recipient address or empty string */
recipient: string;
/** Slippage tolerance percent. Example: `0.5` - 0.5% */
slippagePercent: number;
/** Transaction deadline is seconds. Example: `600` - 10 minutes */
deadlineInSeconds: number;
}
interface SwapBoostParams {
/** Reward amount for `receiveMessage` caller in destination, in USDC */
rewardAmount?: string;
/** Relayer USDC fee defined in BPS */
relayerFeeBPS?: number;
/** the minimum level of confirmation required for Circle's attestation service */
minFinalityThreshold?: number;
}
interface SwapBoostFee {
/** in USDC */
maxFeeAmount: SwapAmount;
/** in USDC */
rewardAmount: SwapAmount;
/** in USDC */
premiumAmount: SwapAmount;
}
interface SwapBoostOptions extends SwapBoostFee {
/** the minimum level of confirmation required for Circle's attestation service */
minFinalityThreshold: CCTP_THRESHOLD;
}
interface SwapRouterInput extends SwapSettings {
input: NetworkToken;
output: NetworkToken;
amount: string;
/** Should the swap input amount be overwritten to the router balance */
a