@xswap-link/xswap-common
Version:
JavaScript library for xSwap common components
1,242 lines • 26.3 kB
JSON
[
{
"inputs": [],
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"inputs": [
{
"internalType": "uint64",
"name": "destinationChainSelector",
"type": "uint64"
}
],
"name": "DestinationChainNotWhitelisted",
"type": "error"
},
{
"inputs": [],
"name": "FailedToSendNative",
"type": "error"
},
{
"inputs": [],
"name": "IncorrectArrayLength",
"type": "error"
},
{
"inputs": [],
"name": "InvalidAddress",
"type": "error"
},
{
"inputs": [
{
"internalType": "address",
"name": "router",
"type": "address"
}
],
"name": "InvalidRouter",
"type": "error"
},
{
"inputs": [
{
"internalType": "address",
"name": "messageExecutor",
"type": "address"
}
],
"name": "MessageAlreadyExecuted",
"type": "error"
},
{
"inputs": [],
"name": "MessageMustTransferOnlyOneToken",
"type": "error"
},
{
"inputs": [
{
"internalType": "uint64",
"name": "chainId",
"type": "uint64"
}
],
"name": "NoXSwapRouterOnSelectedChain",
"type": "error"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "currentBalance",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "calculatedFees",
"type": "uint256"
}
],
"name": "NotEnoughBalance",
"type": "error"
},
{
"inputs": [
{
"internalType": "uint64",
"name": "sourceChainSelector",
"type": "uint64"
},
{
"internalType": "address",
"name": "sender",
"type": "address"
}
],
"name": "SenderNotWhitelisted",
"type": "error"
},
{
"inputs": [
{
"internalType": "address",
"name": "token",
"type": "address"
}
],
"name": "TokenNotWhitelisted",
"type": "error"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "address",
"name": "previousAdmin",
"type": "address"
},
{
"indexed": false,
"internalType": "address",
"name": "newAdmin",
"type": "address"
}
],
"name": "AdminChanged",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "beacon",
"type": "address"
}
],
"name": "BeaconUpgraded",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "address",
"name": "token",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "tokenAmount",
"type": "uint256"
}
],
"name": "EmergencyWithdraw",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "bytes32",
"name": "messageId",
"type": "bytes32"
},
{
"indexed": true,
"internalType": "uint64",
"name": "sourceChainSelector",
"type": "uint64"
},
{
"indexed": true,
"internalType": "address",
"name": "sender",
"type": "address"
},
{
"indexed": false,
"internalType": "bytes",
"name": "data",
"type": "bytes"
},
{
"indexed": false,
"internalType": "address",
"name": "token",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "tokenAmount",
"type": "uint256"
}
],
"name": "ExecutorRunFailed",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "address",
"name": "newExecutor",
"type": "address"
}
],
"name": "ExecutorUpdated",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "bytes32",
"name": "messageId",
"type": "bytes32"
},
{
"indexed": true,
"internalType": "address",
"name": "messageExecutor",
"type": "address"
},
{
"indexed": true,
"internalType": "bytes32",
"name": "executionHash",
"type": "bytes32"
},
{
"indexed": false,
"internalType": "address",
"name": "token",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "tokenAmount",
"type": "uint256"
}
],
"name": "FundsReturnedForMessageExecution",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "uint8",
"name": "version",
"type": "uint8"
}
],
"name": "Initialized",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "bytes32",
"name": "messageId",
"type": "bytes32"
},
{
"indexed": true,
"internalType": "uint64",
"name": "sourceChainSelector",
"type": "uint64"
},
{
"indexed": true,
"internalType": "address",
"name": "sender",
"type": "address"
},
{
"indexed": false,
"internalType": "bytes",
"name": "data",
"type": "bytes"
},
{
"indexed": false,
"internalType": "address",
"name": "token",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "tokenAmount",
"type": "uint256"
}
],
"name": "MessageReceived",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "bytes32",
"name": "messageId",
"type": "bytes32"
},
{
"indexed": true,
"internalType": "uint64",
"name": "destinationChainSelector",
"type": "uint64"
},
{
"indexed": true,
"internalType": "address",
"name": "sender",
"type": "address"
},
{
"indexed": false,
"internalType": "bytes",
"name": "data",
"type": "bytes"
},
{
"indexed": false,
"internalType": "address",
"name": "token",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "tokenAmount",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "valueForInstantCcipRecieve",
"type": "uint256"
},
{
"indexed": false,
"internalType": "address",
"name": "transferedToken",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "transferedTokenAmount",
"type": "uint256"
}
],
"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"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "address",
"name": "newFeeCollectorAddress",
"type": "address"
}
],
"name": "SetFeeCollectorAddress",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "address",
"name": "newFeeOracleAddress",
"type": "address"
}
],
"name": "SetFeeOracleAddress",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "implementation",
"type": "address"
}
],
"name": "Upgraded",
"type": "event"
},
{
"inputs": [
{
"components": [
{
"internalType": "bytes32",
"name": "messageId",
"type": "bytes32"
},
{
"internalType": "uint64",
"name": "sourceChainSelector",
"type": "uint64"
},
{
"internalType": "bytes",
"name": "sender",
"type": "bytes"
},
{
"internalType": "bytes",
"name": "data",
"type": "bytes"
},
{
"components": [
{
"internalType": "address",
"name": "token",
"type": "address"
},
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"internalType": "struct Client.EVMTokenAmount[]",
"name": "destTokenAmounts",
"type": "tuple[]"
}
],
"internalType": "struct Client.Any2EVMMessage",
"name": "message",
"type": "tuple"
}
],
"name": "ccipReceive",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint64",
"name": "",
"type": "uint64"
}
],
"name": "chainSelectorToXSwapRouterMap",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "_tokenToWithdraw",
"type": "address"
},
{
"internalType": "uint256",
"name": "_amountToWithdraw",
"type": "uint256"
}
],
"name": "emergencyWithdraw",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "feeCollectorAddress",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "feeOracleAddress",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "_paymentToken",
"type": "address"
},
{
"internalType": "uint64",
"name": "_destinationChainSelector",
"type": "uint64"
},
{
"components": [
{
"internalType": "address",
"name": "receiver",
"type": "address"
},
{
"internalType": "address",
"name": "tokenOut",
"type": "address"
},
{
"internalType": "uint256",
"name": "estimatedAmountOut",
"type": "uint256"
},
{
"components": [
{
"internalType": "enum CallType",
"name": "callType",
"type": "uint8"
},
{
"internalType": "address",
"name": "target",
"type": "address"
},
{
"internalType": "uint256",
"name": "value",
"type": "uint256"
},
{
"internalType": "bytes",
"name": "callData",
"type": "bytes"
},
{
"internalType": "bytes",
"name": "payload",
"type": "bytes"
}
],
"internalType": "struct Call[]",
"name": "calls",
"type": "tuple[]"
}
],
"internalType": "struct SwapDataDestination",
"name": "_swapDestinationData",
"type": "tuple"
},
{
"internalType": "address",
"name": "_token",
"type": "address"
},
{
"internalType": "uint256",
"name": "_amount",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "_gasLimit",
"type": "uint256"
}
],
"name": "getFees",
"outputs": [
{
"components": [
{
"internalType": "uint256",
"name": "ccipFee",
"type": "uint256"
},
{
"components": [
{
"internalType": "uint256",
"name": "tokenFee",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "nativeFee",
"type": "uint256"
}
],
"internalType": "struct XSwapFee",
"name": "xSwapFee",
"type": "tuple"
}
],
"internalType": "struct MessageFees",
"name": "fees",
"type": "tuple"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "getRouter",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "_ccipRouter",
"type": "address"
},
{
"internalType": "address",
"name": "_feeOracle",
"type": "address"
},
{
"internalType": "address",
"name": "_feeCollector",
"type": "address"
},
{
"internalType": "address",
"name": "_xSwapExecutor",
"type": "address"
},
{
"internalType": "address",
"name": "_owner",
"type": "address"
}
],
"name": "initialize",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"components": [
{
"internalType": "bytes32",
"name": "messageId",
"type": "bytes32"
},
{
"internalType": "uint64",
"name": "sourceChainSelector",
"type": "uint64"
},
{
"internalType": "bytes",
"name": "sender",
"type": "bytes"
},
{
"internalType": "bytes",
"name": "data",
"type": "bytes"
},
{
"components": [
{
"internalType": "address",
"name": "token",
"type": "address"
},
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"internalType": "struct Client.EVMTokenAmount[]",
"name": "destTokenAmounts",
"type": "tuple[]"
}
],
"internalType": "struct Client.Any2EVMMessage",
"name": "_any2EvmMessage",
"type": "tuple"
}
],
"name": "instantCcipReceive",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "bytes32",
"name": "",
"type": "bytes32"
}
],
"name": "messageExecutionHashToExecutorMap",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "owner",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "proxiableUUID",
"outputs": [
{
"internalType": "bytes32",
"name": "",
"type": "bytes32"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "renounceOwnership",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "_feeCollectorAddress",
"type": "address"
}
],
"name": "setFeeCollectorAddress",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "_feeOracleAddress",
"type": "address"
}
],
"name": "setFeeOracleAddress",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "_router",
"type": "address"
}
],
"name": "setRouter",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "_xSwapExecutor",
"type": "address"
}
],
"name": "setXSwapExecutor",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "bytes4",
"name": "interfaceId",
"type": "bytes4"
}
],
"name": "supportsInterface",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "pure",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "_paymentToken",
"type": "address"
},
{
"internalType": "uint64",
"name": "_destinationChainSelector",
"type": "uint64"
},
{
"components": [
{
"internalType": "address",
"name": "receiver",
"type": "address"
},
{
"internalType": "address",
"name": "tokenOut",
"type": "address"
},
{
"internalType": "uint256",
"name": "estimatedAmountOut",
"type": "uint256"
},
{
"components": [
{
"internalType": "enum CallType",
"name": "callType",
"type": "uint8"
},
{
"internalType": "address",
"name": "target",
"type": "address"
},
{
"internalType": "uint256",
"name": "value",
"type": "uint256"
},
{
"internalType": "bytes",
"name": "callData",
"type": "bytes"
},
{
"internalType": "bytes",
"name": "payload",
"type": "bytes"
}
],
"internalType": "struct Call[]",
"name": "calls",
"type": "tuple[]"
}
],
"internalType": "struct SwapDataDestination",
"name": "_swapDestinationData",
"type": "tuple"
},
{
"components": [
{
"internalType": "address",
"name": "tokenIn",
"type": "address"
},
{
"internalType": "uint256",
"name": "amountIn",
"type": "uint256"
},
{
"internalType": "address",
"name": "tokenOut",
"type": "address"
},
{
"internalType": "uint256",
"name": "estimatedAmountOut",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "valueForDestinationGas",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "valueForInstantCcipRecieve",
"type": "uint256"
},
{
"components": [
{
"internalType": "enum CallType",
"name": "callType",
"type": "uint8"
},
{
"internalType": "address",
"name": "target",
"type": "address"
},
{
"internalType": "uint256",
"name": "value",
"type": "uint256"
},
{
"internalType": "bytes",
"name": "callData",
"type": "bytes"
},
{
"internalType": "bytes",
"name": "payload",
"type": "bytes"
}
],
"internalType": "struct Call[]",
"name": "calls",
"type": "tuple[]"
}
],
"internalType": "struct SwapDataOrigin",
"name": "_swapOriginData",
"type": "tuple"
},
{
"internalType": "uint256",
"name": "_gasLimit",
"type": "uint256"
}
],
"name": "swapAndSendMessage",
"outputs": [
{
"internalType": "bytes32",
"name": "messageId",
"type": "bytes32"
}
],
"stateMutability": "payable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "newOwner",
"type": "address"
}
],
"name": "transferOwnership",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint64",
"name": "_chainSelector",
"type": "uint64"
},
{
"internalType": "address",
"name": "_xSwapRouter",
"type": "address"
}
],
"name": "updateChainSelectorToXSwapRouterMap",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint64[]",
"name": "_chainSelectors",
"type": "uint64[]"
},
{
"internalType": "address[]",
"name": "_xSwapRouters",
"type": "address[]"
}
],
"name": "updateChainSelectorToXSwapRouterMapMany",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint64",
"name": "_sourceChainSelector",
"type": "uint64"
},
{
"internalType": "address",
"name": "_sender",
"type": "address"
},
{
"internalType": "bool",
"name": "_isWhitelisted",
"type": "bool"
}
],
"name": "updateWhitelistSender",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint64[]",
"name": "_sourceChainSelectors",
"type": "uint64[]"
},
{
"internalType": "address[]",
"name": "_senders",
"type": "address[]"
},
{
"internalType": "bool[]",
"name": "_areWhitelisted",
"type": "bool[]"
}
],
"name": "updateWhitelistSenderMany",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "_token",
"type": "address"
},
{
"internalType": "bool",
"name": "_isWhitelisted",
"type": "bool"
}
],
"name": "updateWhitelistToken",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "newImplementation",
"type": "address"
}
],
"name": "upgradeTo",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "newImplementation",
"type": "address"
},
{
"internalType": "bytes",
"name": "data",
"type": "bytes"
}
],
"name": "upgradeToAndCall",
"outputs": [],
"stateMutability": "payable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint64",
"name": "",
"type": "uint64"
},
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"name": "whitelistedSenders",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"name": "whitelistedTokens",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "xSwapExecutor",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"stateMutability": "payable",
"type": "receive"
}
]