UNPKG

@tristeroresearch/mach-sdk

Version:

A TypeScript SDK for integrating with Mach's API.

1,693 lines (1,692 loc) 60.1 kB
[ { "inputs": [ { "internalType": "address", "name": "_endpoint", "type": "address" }, { "internalType": "address", "name": "_owner", "type": "address" }, { "internalType": "uint32", "name": "_lzEid", "type": "uint32" } ], "stateMutability": "nonpayable", "type": "constructor" }, { "inputs": [], "name": "InvalidDelegate", "type": "error" }, { "inputs": [], "name": "InvalidEndpointCall", "type": "error" }, { "inputs": [ { "internalType": "bytes", "name": "options", "type": "bytes" } ], "name": "InvalidOptions", "type": "error" }, { "inputs": [], "name": "LzTokenUnavailable", "type": "error" }, { "inputs": [ { "internalType": "uint32", "name": "eid", "type": "uint32" } ], "name": "NoPeer", "type": "error" }, { "inputs": [ { "internalType": "uint256", "name": "msgValue", "type": "uint256" } ], "name": "NotEnoughNative", "type": "error" }, { "inputs": [ { "internalType": "address", "name": "addr", "type": "address" } ], "name": "OnlyEndpoint", "type": "error" }, { "inputs": [ { "internalType": "uint32", "name": "eid", "type": "uint32" }, { "internalType": "bytes32", "name": "sender", "type": "bytes32" } ], "name": "OnlyPeer", "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": [], "name": "ReentrancyGuardReentrantCall", "type": "error" }, { "inputs": [ { "internalType": "address", "name": "token", "type": "address" } ], "name": "SafeERC20FailedOperation", "type": "error" }, { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "address", "name": "challenger", "type": "address" }, { "components": [ { "internalType": "address", "name": "srcAsset", "type": "address" }, { "internalType": "bytes32", "name": "dstAsset", "type": "bytes32" }, { "internalType": "uint32", "name": "dstLzc", "type": "uint32" } ], "indexed": false, "internalType": "struct TradeInterface.OrderDirection", "name": "direction", "type": "tuple" }, { "indexed": false, "internalType": "uint32", "name": "srcIndex", "type": "uint32" }, { "indexed": false, "internalType": "address", "name": "bonder", "type": "address" }, { "indexed": false, "internalType": "uint32", "name": "dstIndex", "type": "uint32" } ], "name": "ChallengeRaised", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": false, "internalType": "bool", "name": "challenge_status", "type": "bool" } ], "name": "ChallengeResult", "type": "event" }, { "anonymous": false, "inputs": [ { "components": [ { "internalType": "uint32", "name": "eid", "type": "uint32" }, { "internalType": "uint16", "name": "msgType", "type": "uint16" }, { "internalType": "bytes", "name": "options", "type": "bytes" } ], "indexed": false, "internalType": "struct EnforcedOptionParam[]", "name": "_enforcedOptions", "type": "tuple[]" } ], "name": "EnforcedOptionSet", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "address", "name": "bonder", "type": "address" }, { "components": [ { "internalType": "address", "name": "srcAsset", "type": "address" }, { "internalType": "bytes32", "name": "dstAsset", "type": "bytes32" }, { "internalType": "uint32", "name": "dstLzc", "type": "uint32" } ], "indexed": false, "internalType": "struct TradeInterface.OrderDirection", "name": "direction", "type": "tuple" }, { "indexed": false, "internalType": "uint32", "name": "orderIndex", "type": "uint32" }, { "indexed": false, "internalType": "uint16", "name": "bondFee", "type": "uint16" } ], "name": "MatchConfirmed", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "address", "name": "bonder", "type": "address" }, { "components": [ { "internalType": "address", "name": "srcAsset", "type": "address" }, { "internalType": "bytes32", "name": "dstAsset", "type": "bytes32" }, { "internalType": "uint32", "name": "dstLzc", "type": "uint32" } ], "indexed": false, "internalType": "struct TradeInterface.OrderDirection", "name": "direction", "type": "tuple" }, { "indexed": false, "internalType": "uint32", "name": "orderIndex", "type": "uint32" }, { "indexed": false, "internalType": "uint96", "name": "srcQuantity", "type": "uint96" }, { "indexed": false, "internalType": "uint96", "name": "dstQuantity", "type": "uint96" }, { "indexed": false, "internalType": "address", "name": "taker", "type": "address" }, { "indexed": false, "internalType": "bytes32", "name": "maker", "type": "bytes32" }, { "indexed": false, "internalType": "uint96", "name": "blockNumber", "type": "uint96" } ], "name": "MatchCreated", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "address", "name": "maker", "type": "address" }, { "components": [ { "internalType": "address", "name": "srcAsset", "type": "address" }, { "internalType": "bytes32", "name": "dstAsset", "type": "bytes32" }, { "internalType": "uint32", "name": "dstLzc", "type": "uint32" } ], "indexed": false, "internalType": "struct TradeInterface.OrderDirection", "name": "direction", "type": "tuple" }, { "indexed": false, "internalType": "uint32", "name": "takerIndex", "type": "uint32" }, { "indexed": false, "internalType": "uint96", "name": "takerQuantity", "type": "uint96" }, { "indexed": false, "internalType": "address", "name": "target", "type": "address" } ], "name": "MatchExecuted", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "address", "name": "bonder", "type": "address" }, { "components": [ { "internalType": "address", "name": "srcAsset", "type": "address" }, { "internalType": "bytes32", "name": "dstAsset", "type": "bytes32" }, { "internalType": "uint32", "name": "dstLzc", "type": "uint32" } ], "indexed": false, "internalType": "struct TradeInterface.OrderDirection", "name": "direction", "type": "tuple" }, { "indexed": false, "internalType": "uint32", "name": "orderIndex", "type": "uint32" } ], "name": "MatchUnwound", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": false, "internalType": "string", "name": "message", "type": "string" }, { "indexed": false, "internalType": "uint32", "name": "senderEid", "type": "uint32" }, { "indexed": false, "internalType": "bytes32", "name": "sender", "type": "bytes32" } ], "name": "MessageReceived", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": false, "internalType": "bytes", "name": "message", "type": "bytes" }, { "indexed": false, "internalType": "uint32", "name": "dstEid", "type": "uint32" } ], "name": "MessageSent", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "address", "name": "sender", "type": "address" }, { "components": [ { "internalType": "address", "name": "srcAsset", "type": "address" }, { "internalType": "bytes32", "name": "dstAsset", "type": "bytes32" }, { "internalType": "uint32", "name": "dstLzc", "type": "uint32" } ], "indexed": false, "internalType": "struct TradeInterface.OrderDirection", "name": "direction", "type": "tuple" }, { "indexed": false, "internalType": "uint32", "name": "orderIndex", "type": "uint32" } ], "name": "OrderCancelled", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "address", "name": "sender", "type": "address" }, { "components": [ { "internalType": "address", "name": "srcAsset", "type": "address" }, { "internalType": "bytes32", "name": "dstAsset", "type": "bytes32" }, { "internalType": "uint32", "name": "dstLzc", "type": "uint32" } ], "indexed": false, "internalType": "struct TradeInterface.OrderDirection", "name": "direction", "type": "tuple" }, { "indexed": false, "internalType": "uint32", "name": "orderIndex", "type": "uint32" }, { "components": [ { "internalType": "uint96", "name": "srcQuantity", "type": "uint96" }, { "internalType": "uint96", "name": "dstQuantity", "type": "uint96" }, { "internalType": "uint16", "name": "bondFee", "type": "uint16" }, { "internalType": "address", "name": "bondAsset", "type": "address" }, { "internalType": "uint96", "name": "bondAmount", "type": "uint96" } ], "indexed": false, "internalType": "struct TradeInterface.OrderFunding", "name": "funding", "type": "tuple" }, { "components": [ { "internalType": "uint32", "name": "timestamp", "type": "uint32" }, { "internalType": "uint16", "name": "challengeOffset", "type": "uint16" }, { "internalType": "uint16", "name": "challengeWindow", "type": "uint16" } ], "indexed": false, "internalType": "struct TradeInterface.OrderExpiration", "name": "expiration", "type": "tuple" }, { "indexed": false, "internalType": "bytes32", "name": "target", "type": "bytes32" }, { "indexed": false, "internalType": "address", "name": "filler", "type": "address" } ], "name": "OrderPlaced", "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": "eid", "type": "uint32" }, { "indexed": false, "internalType": "bytes32", "name": "peer", "type": "bytes32" } ], "name": "PeerSet", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": false, "internalType": "string", "name": "message", "type": "string" }, { "indexed": false, "internalType": "uint32", "name": "dstEid", "type": "uint32" } ], "name": "ReturnMessageSent", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "address", "name": "maker", "type": "address" }, { "components": [ { "internalType": "address", "name": "srcAsset", "type": "address" }, { "internalType": "bytes32", "name": "dstAsset", "type": "bytes32" }, { "internalType": "uint32", "name": "dstLzc", "type": "uint32" } ], "indexed": false, "internalType": "struct TradeInterface.OrderDirection", "name": "direction", "type": "tuple" }, { "indexed": false, "internalType": "uint32", "name": "orderIndex", "type": "uint32" }, { "indexed": false, "internalType": "uint96", "name": "srcQuantity", "type": "uint96" }, { "indexed": false, "internalType": "uint96", "name": "dstQuantity", "type": "uint96" }, { "indexed": false, "internalType": "address", "name": "taker", "type": "address" }, { "indexed": false, "internalType": "address", "name": "target", "type": "address" }, { "indexed": false, "internalType": "uint96", "name": "blockNumber", "type": "uint96" } ], "name": "SwapFilled", "type": "event" }, { "inputs": [ { "components": [ { "internalType": "uint32", "name": "srcEid", "type": "uint32" }, { "internalType": "bytes32", "name": "sender", "type": "bytes32" }, { "internalType": "uint64", "name": "nonce", "type": "uint64" } ], "internalType": "struct Origin", "name": "origin", "type": "tuple" } ], "name": "allowInitializePath", "outputs": [ { "internalType": "bool", "name": "", "type": "bool" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "uint256", "name": "number", "type": "uint256" }, { "internalType": "uint256", "name": "_fee", "type": "uint256" } ], "name": "applyFee", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "pure", "type": "function" }, { "inputs": [ { "internalType": "uint256", "name": "number", "type": "uint256" }, { "internalType": "uint256", "name": "_fee", "type": "uint256" } ], "name": "bondFee", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "pure", "type": "function" }, { "inputs": [ { "internalType": "uint256", "name": "", "type": "uint256" }, { "internalType": "bytes32", "name": "", "type": "bytes32" }, { "internalType": "address", "name": "", "type": "address" } ], "name": "book", "outputs": [ { "internalType": "address", "name": "src", "type": "address" }, { "internalType": "address", "name": "dst", "type": "address" }, { "internalType": "uint16", "name": "lzc", "type": "uint16" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "components": [ { "internalType": "address", "name": "srcAsset", "type": "address" }, { "internalType": "bytes32", "name": "dstAsset", "type": "bytes32" }, { "internalType": "uint32", "name": "dstLzc", "type": "uint32" } ], "internalType": "struct TradeInterface.OrderDirection", "name": "direction", "type": "tuple" }, { "internalType": "uint32", "name": "orderIndex", "type": "uint32" } ], "name": "cancelOrder", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "components": [ { "internalType": "address", "name": "srcAsset", "type": "address" }, { "internalType": "bytes32", "name": "dstAsset", "type": "bytes32" }, { "internalType": "uint32", "name": "dstLzc", "type": "uint32" } ], "internalType": "struct TradeInterface.OrderDirection", "name": "direction", "type": "tuple" }, { "internalType": "uint32", "name": "srcIndex", "type": "uint32" }, { "internalType": "bytes", "name": "_extraSendOptions", "type": "bytes" }, { "internalType": "bytes", "name": "_extraReturnOptions", "type": "bytes" } ], "name": "challengeMatch", "outputs": [], "stateMutability": "payable", "type": "function" }, { "inputs": [ { "internalType": "uint32", "name": "_eid", "type": "uint32" }, { "internalType": "uint16", "name": "_msgType", "type": "uint16" }, { "internalType": "bytes", "name": "_extraOptions", "type": "bytes" } ], "name": "combineOptions", "outputs": [ { "internalType": "bytes", "name": "", "type": "bytes" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "components": [ { "internalType": "address", "name": "srcAsset", "type": "address" }, { "internalType": "bytes32", "name": "dstAsset", "type": "bytes32" }, { "internalType": "uint32", "name": "dstLzc", "type": "uint32" } ], "internalType": "struct TradeInterface.OrderDirection", "name": "direction", "type": "tuple" }, { "internalType": "uint32", "name": "srcIndex", "type": "uint32" } ], "name": "confirmMatch", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "components": [ { "internalType": "address", "name": "srcAsset", "type": "address" }, { "internalType": "bytes32", "name": "dstAsset", "type": "bytes32" }, { "internalType": "uint32", "name": "dstLzc", "type": "uint32" } ], "internalType": "struct TradeInterface.OrderDirection", "name": "direction", "type": "tuple" }, { "internalType": "uint32", "name": "srcIndex", "type": "uint32" }, { "internalType": "bytes32", "name": "counterparty", "type": "bytes32" }, { "internalType": "uint96", "name": "srcQuantity", "type": "uint96" } ], "name": "createMatch", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "bytes", "name": "encodedMessage", "type": "bytes" } ], "name": "decodeMessage", "outputs": [ { "components": [ { "internalType": "address", "name": "challenger", "type": "address" }, { "internalType": "address", "name": "srcToken", "type": "address" }, { "internalType": "bytes32", "name": "dstToken", "type": "bytes32" }, { "internalType": "uint32", "name": "srcIndex", "type": "uint32" }, { "internalType": "bytes32", "name": "counterparty", "type": "bytes32" }, { "internalType": "bytes32", "name": "target", "type": "bytes32" }, { "internalType": "uint256", "name": "minAmount", "type": "uint256" }, { "internalType": "uint256", "name": "status", "type": "uint256" } ], "internalType": "struct TradeInterface.Payload", "name": "message", "type": "tuple" }, { "internalType": "uint16", "name": "msgType", "type": "uint16" }, { "internalType": "uint256", "name": "extraOptionsStart", "type": "uint256" }, { "internalType": "uint256", "name": "extraOptionsLength", "type": "uint256" } ], "stateMutability": "pure", "type": "function" }, { "inputs": [], "name": "endpoint", "outputs": [ { "internalType": "contract ILayerZeroEndpointV2", "name": "", "type": "address" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "uint32", "name": "eid", "type": "uint32" }, { "internalType": "uint16", "name": "msgType", "type": "uint16" } ], "name": "enforcedOptions", "outputs": [ { "internalType": "bytes", "name": "enforcedOption", "type": "bytes" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "components": [ { "internalType": "address", "name": "srcAsset", "type": "address" }, { "internalType": "bytes32", "name": "dstAsset", "type": "bytes32" }, { "internalType": "uint32", "name": "dstLzc", "type": "uint32" } ], "internalType": "struct TradeInterface.OrderDirection", "name": "direction", "type": "tuple" }, { "internalType": "uint32", "name": "takerIndex", "type": "uint32" }, { "internalType": "address", "name": "target", "type": "address" }, { "internalType": "uint96", "name": "payoutQuantity", "type": "uint96" }, { "internalType": "bool", "name": "isUnwrap", "type": "bool" } ], "name": "executeMatch", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "components": [ { "internalType": "address", "name": "srcAsset", "type": "address" }, { "internalType": "bytes32", "name": "dstAsset", "type": "bytes32" }, { "internalType": "uint32", "name": "dstLzc", "type": "uint32" } ], "internalType": "struct TradeInterface.OrderDirection", "name": "direction", "type": "tuple" }, { "internalType": "uint32", "name": "orderIndex", "type": "uint32" } ], "name": "fillSwap", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "getCurrentBlockNumber", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "srcAsset", "type": "address" }, { "internalType": "bytes32", "name": "dstAsset", "type": "bytes32" }, { "internalType": "uint256", "name": "dstLzc", "type": "uint256" }, { "internalType": "uint256", "name": "index", "type": "uint256" } ], "name": "getMatch", "outputs": [ { "components": [ { "internalType": "uint32", "name": "index", "type": "uint32" }, { "internalType": "uint96", "name": "srcQuantity", "type": "uint96" }, { "internalType": "uint96", "name": "dstQuantity", "type": "uint96" }, { "internalType": "bytes32", "name": "maker", "type": "bytes32" }, { "internalType": "bytes32", "name": "target", "type": "bytes32" }, { "internalType": "address", "name": "bonder", "type": "address" }, { "internalType": "uint96", "name": "blockNumber", "type": "uint96" }, { "internalType": "bool", "name": "finalized", "type": "bool" }, { "internalType": "bool", "name": "challenged", "type": "bool" } ], "internalType": "struct TradeInterface.Match", "name": "_match", "type": "tuple" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "srcAsset", "type": "address" }, { "internalType": "bytes32", "name": "dstAsset", "type": "bytes32" }, { "internalType": "uint256", "name": "dstLzc", "type": "uint256" }, { "internalType": "uint256", "name": "index", "type": "uint256" } ], "name": "getOrder", "outputs": [ { "components": [ { "internalType": "address", "name": "sender", "type": "address" }, { "components": [ { "internalType": "uint96", "name": "srcQuantity", "type": "uint96" }, { "internalType": "uint96", "name": "dstQuantity", "type": "uint96" }, { "internalType": "uint16", "name": "bondFee", "type": "uint16" }, { "internalType": "address", "name": "bondAsset", "type": "address" }, { "internalType": "uint96", "name": "bondAmount", "type": "uint96" } ], "internalType": "struct TradeInterface.OrderFunding", "name": "funding", "type": "tuple" }, { "components": [ { "internalType": "uint32", "name": "timestamp", "type": "uint32" }, { "internalType": "uint16", "name": "challengeOffset", "type": "uint16" }, { "internalType": "uint16", "name": "challengeWindow", "type": "uint16" } ], "internalType": "struct TradeInterface.OrderExpiration", "name": "expiration", "type": "tuple" }, { "internalType": "uint96", "name": "settled", "type": "uint96" }, { "internalType": "bytes32", "name": "target", "type": "bytes32" }, { "internalType": "address", "name": "filler", "type": "address" } ], "internalType": "struct TradeInterface.Order", "name": "_order", "type": "tuple" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "srcAsset", "type": "address" }, { "internalType": "bytes32", "name": "dstAsset", "type": "bytes32" }, { "internalType": "uint256", "name": "dstLzc", "type": "uint256" } ], "name": "getOrders", "outputs": [ { "components": [ { "internalType": "address", "name": "sender", "type": "address" }, { "components": [ { "internalType": "uint96", "name": "srcQuantity", "type": "uint96" }, { "internalType": "uint96", "name": "dstQuantity", "type": "uint96" }, { "internalType": "uint16", "name": "bondFee", "type": "uint16" }, { "internalType": "address", "name": "bondAsset", "type": "address" }, { "internalType": "uint96", "name": "bondAmount", "type": "uint96" } ], "internalType": "struct TradeInterface.OrderFunding", "name": "funding", "type": "tuple" }, { "components": [ { "internalType": "uint32", "name": "timestamp", "type": "uint32" }, { "internalType": "uint16", "name": "challengeOffset", "type": "uint16" }, { "internalType": "uint16", "name": "challengeWindow", "type": "uint16" } ], "internalType": "struct TradeInterface.OrderExpiration", "name": "expiration", "type": "tuple" }, { "internalType": "uint96", "name": "settled", "type": "uint96" }, { "internalType": "bytes32", "name": "target", "type": "bytes32" }, { "internalType": "address", "name": "filler", "type": "address" } ], "internalType": "struct TradeInterface.Order[]", "name": "orders", "type": "tuple[]" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "srcAsset", "type": "address" }, { "internalType": "bytes32", "name": "dstAsset", "type": "bytes32" }, { "internalType": "uint256", "name": "dstLzc", "type": "uint256" }, { "internalType": "uint256", "name": "srcIndex", "type": "uint256" }, { "internalType": "bytes32", "name": "target", "type": "bytes32" } ], "name": "getReceipt", "outputs": [ { "internalType": "uint256", "name": "_receipt", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "components": [ { "internalType": "uint32", "name": "srcEid", "type": "uint32" }, { "internalType": "bytes32", "name": "sender", "type": "bytes32" }, { "internalType": "uint64", "name": "nonce", "type": "uint64" } ], "internalType": "struct Origin", "name": "", "type": "tuple" }, { "internalType": "bytes", "name": "", "type": "bytes" }, { "internalType": "address", "name": "_sender", "type": "address" } ], "name": "isComposeMsgSender", "outputs": [ { "internalType": "bool", "name": "", "type": "bool" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "components": [ { "internalType": "uint32", "name": "srcEid", "type": "uint32" }, { "internalType": "bytes32", "name": "sender", "type": "bytes32" }, {