@coinbase/cdp-sdk
Version:
SDK for interacting with the Coinbase Developer Platform Wallet API
716 lines • 31.8 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.SPEND_PERMISSION_MANAGER_ABI = exports.SPEND_PERMISSION_MANAGER_ADDRESS = void 0;
exports.SPEND_PERMISSION_MANAGER_ADDRESS = "0xf85210B21cC50302F477BA56686d2019dC9b67Ad";
exports.SPEND_PERMISSION_MANAGER_ABI = [
{
inputs: [
{
internalType: "contract PublicERC6492Validator",
name: "publicERC6492Validator",
type: "address",
},
{ internalType: "address", name: "magicSpend", type: "address" },
],
stateMutability: "nonpayable",
type: "constructor",
},
{
inputs: [
{ internalType: "uint48", name: "currentTimestamp", type: "uint48" },
{ internalType: "uint48", name: "end", type: "uint48" },
],
name: "AfterSpendPermissionEnd",
type: "error",
},
{
inputs: [
{ internalType: "uint48", name: "currentTimestamp", type: "uint48" },
{ internalType: "uint48", name: "start", type: "uint48" },
],
name: "BeforeSpendPermissionStart",
type: "error",
},
{
inputs: [{ internalType: "address", name: "token", type: "address" }],
name: "ERC721TokenNotSupported",
type: "error",
},
{ inputs: [], name: "EmptySpendPermissionBatch", type: "error" },
{
inputs: [
{ internalType: "uint256", name: "value", type: "uint256" },
{ internalType: "uint256", name: "allowance", type: "uint256" },
],
name: "ExceededSpendPermission",
type: "error",
},
{
inputs: [
{
components: [
{ internalType: "uint48", name: "start", type: "uint48" },
{ internalType: "uint48", name: "end", type: "uint48" },
{ internalType: "uint160", name: "spend", type: "uint160" },
],
internalType: "struct SpendPermissionManager.PeriodSpend",
name: "actualLastUpdatedPeriod",
type: "tuple",
},
{
components: [
{ internalType: "uint48", name: "start", type: "uint48" },
{ internalType: "uint48", name: "end", type: "uint48" },
{ internalType: "uint160", name: "spend", type: "uint160" },
],
internalType: "struct SpendPermissionManager.PeriodSpend",
name: "expectedLastUpdatedPeriod",
type: "tuple",
},
],
name: "InvalidLastUpdatedPeriod",
type: "error",
},
{
inputs: [
{ internalType: "address", name: "sender", type: "address" },
{ internalType: "address", name: "expected", type: "address" },
],
name: "InvalidSender",
type: "error",
},
{ inputs: [], name: "InvalidSignature", type: "error" },
{
inputs: [
{ internalType: "uint48", name: "start", type: "uint48" },
{ internalType: "uint48", name: "end", type: "uint48" },
],
name: "InvalidStartEnd",
type: "error",
},
{
inputs: [
{ internalType: "uint128", name: "noncePostfix", type: "uint128" },
{ internalType: "uint128", name: "permissionHashPostfix", type: "uint128" },
],
name: "InvalidWithdrawRequestNonce",
type: "error",
},
{
inputs: [
{ internalType: "address", name: "firstAccount", type: "address" },
{ internalType: "address", name: "secondAccount", type: "address" },
],
name: "MismatchedAccounts",
type: "error",
},
{
inputs: [{ internalType: "address", name: "token", type: "address" }],
name: "SafeERC20FailedOperation",
type: "error",
},
{
inputs: [
{ internalType: "address", name: "spendToken", type: "address" },
{ internalType: "address", name: "withdrawAsset", type: "address" },
],
name: "SpendTokenWithdrawAssetMismatch",
type: "error",
},
{
inputs: [{ internalType: "uint256", name: "value", type: "uint256" }],
name: "SpendValueOverflow",
type: "error",
},
{
inputs: [
{ internalType: "uint256", name: "spendValue", type: "uint256" },
{ internalType: "uint256", name: "withdrawAmount", type: "uint256" },
],
name: "SpendValueWithdrawAmountMismatch",
type: "error",
},
{ inputs: [], name: "UnauthorizedSpendPermission", type: "error" },
{
inputs: [
{ internalType: "uint256", name: "received", type: "uint256" },
{ internalType: "uint256", name: "expected", type: "uint256" },
],
name: "UnexpectedReceiveAmount",
type: "error",
},
{ inputs: [], name: "ZeroAllowance", type: "error" },
{ inputs: [], name: "ZeroPeriod", type: "error" },
{ inputs: [], name: "ZeroSpender", type: "error" },
{ inputs: [], name: "ZeroToken", type: "error" },
{ inputs: [], name: "ZeroValue", type: "error" },
{
anonymous: false,
inputs: [
{ indexed: true, internalType: "bytes32", name: "hash", type: "bytes32" },
{
components: [
{ internalType: "address", name: "account", type: "address" },
{ internalType: "address", name: "spender", type: "address" },
{ internalType: "address", name: "token", type: "address" },
{ internalType: "uint160", name: "allowance", type: "uint160" },
{ internalType: "uint48", name: "period", type: "uint48" },
{ internalType: "uint48", name: "start", type: "uint48" },
{ internalType: "uint48", name: "end", type: "uint48" },
{ internalType: "uint256", name: "salt", type: "uint256" },
{ internalType: "bytes", name: "extraData", type: "bytes" },
],
indexed: false,
internalType: "struct SpendPermissionManager.SpendPermission",
name: "spendPermission",
type: "tuple",
},
],
name: "SpendPermissionApproved",
type: "event",
},
{
anonymous: false,
inputs: [
{ indexed: true, internalType: "bytes32", name: "hash", type: "bytes32" },
{
components: [
{ internalType: "address", name: "account", type: "address" },
{ internalType: "address", name: "spender", type: "address" },
{ internalType: "address", name: "token", type: "address" },
{ internalType: "uint160", name: "allowance", type: "uint160" },
{ internalType: "uint48", name: "period", type: "uint48" },
{ internalType: "uint48", name: "start", type: "uint48" },
{ internalType: "uint48", name: "end", type: "uint48" },
{ internalType: "uint256", name: "salt", type: "uint256" },
{ internalType: "bytes", name: "extraData", type: "bytes" },
],
indexed: false,
internalType: "struct SpendPermissionManager.SpendPermission",
name: "spendPermission",
type: "tuple",
},
],
name: "SpendPermissionRevoked",
type: "event",
},
{
anonymous: false,
inputs: [
{ indexed: true, internalType: "bytes32", name: "hash", type: "bytes32" },
{ indexed: true, internalType: "address", name: "account", type: "address" },
{ indexed: true, internalType: "address", name: "spender", type: "address" },
{ indexed: false, internalType: "address", name: "token", type: "address" },
{
components: [
{ internalType: "uint48", name: "start", type: "uint48" },
{ internalType: "uint48", name: "end", type: "uint48" },
{ internalType: "uint160", name: "spend", type: "uint160" },
],
indexed: false,
internalType: "struct SpendPermissionManager.PeriodSpend",
name: "periodSpend",
type: "tuple",
},
],
name: "SpendPermissionUsed",
type: "event",
},
{
inputs: [],
name: "MAGIC_SPEND",
outputs: [{ internalType: "address", name: "", type: "address" }],
stateMutability: "view",
type: "function",
},
{
inputs: [],
name: "NATIVE_TOKEN",
outputs: [{ internalType: "address", name: "", type: "address" }],
stateMutability: "view",
type: "function",
},
{
inputs: [],
name: "PERMISSION_DETAILS_TYPEHASH",
outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }],
stateMutability: "view",
type: "function",
},
{
inputs: [],
name: "PUBLIC_ERC6492_VALIDATOR",
outputs: [{ internalType: "contract PublicERC6492Validator", name: "", type: "address" }],
stateMutability: "view",
type: "function",
},
{
inputs: [],
name: "SPEND_PERMISSION_BATCH_TYPEHASH",
outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }],
stateMutability: "view",
type: "function",
},
{
inputs: [],
name: "SPEND_PERMISSION_TYPEHASH",
outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }],
stateMutability: "view",
type: "function",
},
{
inputs: [
{
components: [
{ internalType: "address", name: "account", type: "address" },
{ internalType: "address", name: "spender", type: "address" },
{ internalType: "address", name: "token", type: "address" },
{ internalType: "uint160", name: "allowance", type: "uint160" },
{ internalType: "uint48", name: "period", type: "uint48" },
{ internalType: "uint48", name: "start", type: "uint48" },
{ internalType: "uint48", name: "end", type: "uint48" },
{ internalType: "uint256", name: "salt", type: "uint256" },
{ internalType: "bytes", name: "extraData", type: "bytes" },
],
internalType: "struct SpendPermissionManager.SpendPermission",
name: "spendPermission",
type: "tuple",
},
],
name: "approve",
outputs: [{ internalType: "bool", name: "", type: "bool" }],
stateMutability: "nonpayable",
type: "function",
},
{
inputs: [
{
components: [
{ internalType: "address", name: "account", type: "address" },
{ internalType: "uint48", name: "period", type: "uint48" },
{ internalType: "uint48", name: "start", type: "uint48" },
{ internalType: "uint48", name: "end", type: "uint48" },
{
components: [
{ internalType: "address", name: "spender", type: "address" },
{ internalType: "address", name: "token", type: "address" },
{ internalType: "uint160", name: "allowance", type: "uint160" },
{ internalType: "uint256", name: "salt", type: "uint256" },
{ internalType: "bytes", name: "extraData", type: "bytes" },
],
internalType: "struct SpendPermissionManager.PermissionDetails[]",
name: "permissions",
type: "tuple[]",
},
],
internalType: "struct SpendPermissionManager.SpendPermissionBatch",
name: "spendPermissionBatch",
type: "tuple",
},
{ internalType: "bytes", name: "signature", type: "bytes" },
],
name: "approveBatchWithSignature",
outputs: [{ internalType: "bool", name: "", type: "bool" }],
stateMutability: "nonpayable",
type: "function",
},
{
inputs: [
{
components: [
{ internalType: "address", name: "account", type: "address" },
{ internalType: "address", name: "spender", type: "address" },
{ internalType: "address", name: "token", type: "address" },
{ internalType: "uint160", name: "allowance", type: "uint160" },
{ internalType: "uint48", name: "period", type: "uint48" },
{ internalType: "uint48", name: "start", type: "uint48" },
{ internalType: "uint48", name: "end", type: "uint48" },
{ internalType: "uint256", name: "salt", type: "uint256" },
{ internalType: "bytes", name: "extraData", type: "bytes" },
],
internalType: "struct SpendPermissionManager.SpendPermission",
name: "permissionToApprove",
type: "tuple",
},
{
components: [
{ internalType: "address", name: "account", type: "address" },
{ internalType: "address", name: "spender", type: "address" },
{ internalType: "address", name: "token", type: "address" },
{ internalType: "uint160", name: "allowance", type: "uint160" },
{ internalType: "uint48", name: "period", type: "uint48" },
{ internalType: "uint48", name: "start", type: "uint48" },
{ internalType: "uint48", name: "end", type: "uint48" },
{ internalType: "uint256", name: "salt", type: "uint256" },
{ internalType: "bytes", name: "extraData", type: "bytes" },
],
internalType: "struct SpendPermissionManager.SpendPermission",
name: "permissionToRevoke",
type: "tuple",
},
{
components: [
{ internalType: "uint48", name: "start", type: "uint48" },
{ internalType: "uint48", name: "end", type: "uint48" },
{ internalType: "uint160", name: "spend", type: "uint160" },
],
internalType: "struct SpendPermissionManager.PeriodSpend",
name: "expectedLastUpdatedPeriod",
type: "tuple",
},
],
name: "approveWithRevoke",
outputs: [{ internalType: "bool", name: "", type: "bool" }],
stateMutability: "nonpayable",
type: "function",
},
{
inputs: [
{
components: [
{ internalType: "address", name: "account", type: "address" },
{ internalType: "address", name: "spender", type: "address" },
{ internalType: "address", name: "token", type: "address" },
{ internalType: "uint160", name: "allowance", type: "uint160" },
{ internalType: "uint48", name: "period", type: "uint48" },
{ internalType: "uint48", name: "start", type: "uint48" },
{ internalType: "uint48", name: "end", type: "uint48" },
{ internalType: "uint256", name: "salt", type: "uint256" },
{ internalType: "bytes", name: "extraData", type: "bytes" },
],
internalType: "struct SpendPermissionManager.SpendPermission",
name: "spendPermission",
type: "tuple",
},
{ internalType: "bytes", name: "signature", type: "bytes" },
],
name: "approveWithSignature",
outputs: [{ internalType: "bool", name: "", type: "bool" }],
stateMutability: "nonpayable",
type: "function",
},
{
inputs: [],
name: "eip712Domain",
outputs: [
{ internalType: "bytes1", name: "fields", type: "bytes1" },
{ internalType: "string", name: "name", type: "string" },
{ internalType: "string", name: "version", type: "string" },
{ internalType: "uint256", name: "chainId", type: "uint256" },
{ internalType: "address", name: "verifyingContract", type: "address" },
{ internalType: "bytes32", name: "salt", type: "bytes32" },
{ internalType: "uint256[]", name: "extensions", type: "uint256[]" },
],
stateMutability: "view",
type: "function",
},
{
inputs: [
{
components: [
{ internalType: "address", name: "account", type: "address" },
{ internalType: "uint48", name: "period", type: "uint48" },
{ internalType: "uint48", name: "start", type: "uint48" },
{ internalType: "uint48", name: "end", type: "uint48" },
{
components: [
{ internalType: "address", name: "spender", type: "address" },
{ internalType: "address", name: "token", type: "address" },
{ internalType: "uint160", name: "allowance", type: "uint160" },
{ internalType: "uint256", name: "salt", type: "uint256" },
{ internalType: "bytes", name: "extraData", type: "bytes" },
],
internalType: "struct SpendPermissionManager.PermissionDetails[]",
name: "permissions",
type: "tuple[]",
},
],
internalType: "struct SpendPermissionManager.SpendPermissionBatch",
name: "spendPermissionBatch",
type: "tuple",
},
],
name: "getBatchHash",
outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }],
stateMutability: "view",
type: "function",
},
{
inputs: [
{
components: [
{ internalType: "address", name: "account", type: "address" },
{ internalType: "address", name: "spender", type: "address" },
{ internalType: "address", name: "token", type: "address" },
{ internalType: "uint160", name: "allowance", type: "uint160" },
{ internalType: "uint48", name: "period", type: "uint48" },
{ internalType: "uint48", name: "start", type: "uint48" },
{ internalType: "uint48", name: "end", type: "uint48" },
{ internalType: "uint256", name: "salt", type: "uint256" },
{ internalType: "bytes", name: "extraData", type: "bytes" },
],
internalType: "struct SpendPermissionManager.SpendPermission",
name: "spendPermission",
type: "tuple",
},
],
name: "getCurrentPeriod",
outputs: [
{
components: [
{ internalType: "uint48", name: "start", type: "uint48" },
{ internalType: "uint48", name: "end", type: "uint48" },
{ internalType: "uint160", name: "spend", type: "uint160" },
],
internalType: "struct SpendPermissionManager.PeriodSpend",
name: "",
type: "tuple",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [
{
components: [
{ internalType: "address", name: "account", type: "address" },
{ internalType: "address", name: "spender", type: "address" },
{ internalType: "address", name: "token", type: "address" },
{ internalType: "uint160", name: "allowance", type: "uint160" },
{ internalType: "uint48", name: "period", type: "uint48" },
{ internalType: "uint48", name: "start", type: "uint48" },
{ internalType: "uint48", name: "end", type: "uint48" },
{ internalType: "uint256", name: "salt", type: "uint256" },
{ internalType: "bytes", name: "extraData", type: "bytes" },
],
internalType: "struct SpendPermissionManager.SpendPermission",
name: "spendPermission",
type: "tuple",
},
],
name: "getHash",
outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }],
stateMutability: "view",
type: "function",
},
{
inputs: [
{
components: [
{ internalType: "address", name: "account", type: "address" },
{ internalType: "address", name: "spender", type: "address" },
{ internalType: "address", name: "token", type: "address" },
{ internalType: "uint160", name: "allowance", type: "uint160" },
{ internalType: "uint48", name: "period", type: "uint48" },
{ internalType: "uint48", name: "start", type: "uint48" },
{ internalType: "uint48", name: "end", type: "uint48" },
{ internalType: "uint256", name: "salt", type: "uint256" },
{ internalType: "bytes", name: "extraData", type: "bytes" },
],
internalType: "struct SpendPermissionManager.SpendPermission",
name: "spendPermission",
type: "tuple",
},
],
name: "getLastUpdatedPeriod",
outputs: [
{
components: [
{ internalType: "uint48", name: "start", type: "uint48" },
{ internalType: "uint48", name: "end", type: "uint48" },
{ internalType: "uint160", name: "spend", type: "uint160" },
],
internalType: "struct SpendPermissionManager.PeriodSpend",
name: "",
type: "tuple",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [
{
components: [
{ internalType: "address", name: "account", type: "address" },
{ internalType: "address", name: "spender", type: "address" },
{ internalType: "address", name: "token", type: "address" },
{ internalType: "uint160", name: "allowance", type: "uint160" },
{ internalType: "uint48", name: "period", type: "uint48" },
{ internalType: "uint48", name: "start", type: "uint48" },
{ internalType: "uint48", name: "end", type: "uint48" },
{ internalType: "uint256", name: "salt", type: "uint256" },
{ internalType: "bytes", name: "extraData", type: "bytes" },
],
internalType: "struct SpendPermissionManager.SpendPermission",
name: "spendPermission",
type: "tuple",
},
],
name: "isApproved",
outputs: [{ internalType: "bool", name: "", type: "bool" }],
stateMutability: "view",
type: "function",
},
{
inputs: [
{
components: [
{ internalType: "address", name: "account", type: "address" },
{ internalType: "address", name: "spender", type: "address" },
{ internalType: "address", name: "token", type: "address" },
{ internalType: "uint160", name: "allowance", type: "uint160" },
{ internalType: "uint48", name: "period", type: "uint48" },
{ internalType: "uint48", name: "start", type: "uint48" },
{ internalType: "uint48", name: "end", type: "uint48" },
{ internalType: "uint256", name: "salt", type: "uint256" },
{ internalType: "bytes", name: "extraData", type: "bytes" },
],
internalType: "struct SpendPermissionManager.SpendPermission",
name: "spendPermission",
type: "tuple",
},
],
name: "isRevoked",
outputs: [{ internalType: "bool", name: "", type: "bool" }],
stateMutability: "view",
type: "function",
},
{
inputs: [
{
components: [
{ internalType: "address", name: "account", type: "address" },
{ internalType: "address", name: "spender", type: "address" },
{ internalType: "address", name: "token", type: "address" },
{ internalType: "uint160", name: "allowance", type: "uint160" },
{ internalType: "uint48", name: "period", type: "uint48" },
{ internalType: "uint48", name: "start", type: "uint48" },
{ internalType: "uint48", name: "end", type: "uint48" },
{ internalType: "uint256", name: "salt", type: "uint256" },
{ internalType: "bytes", name: "extraData", type: "bytes" },
],
internalType: "struct SpendPermissionManager.SpendPermission",
name: "spendPermission",
type: "tuple",
},
],
name: "isValid",
outputs: [{ internalType: "bool", name: "", type: "bool" }],
stateMutability: "view",
type: "function",
},
{
inputs: [
{
components: [
{ internalType: "address", name: "account", type: "address" },
{ internalType: "address", name: "spender", type: "address" },
{ internalType: "address", name: "token", type: "address" },
{ internalType: "uint160", name: "allowance", type: "uint160" },
{ internalType: "uint48", name: "period", type: "uint48" },
{ internalType: "uint48", name: "start", type: "uint48" },
{ internalType: "uint48", name: "end", type: "uint48" },
{ internalType: "uint256", name: "salt", type: "uint256" },
{ internalType: "bytes", name: "extraData", type: "bytes" },
],
internalType: "struct SpendPermissionManager.SpendPermission",
name: "spendPermission",
type: "tuple",
},
],
name: "revoke",
outputs: [],
stateMutability: "nonpayable",
type: "function",
},
{
inputs: [
{
components: [
{ internalType: "address", name: "account", type: "address" },
{ internalType: "address", name: "spender", type: "address" },
{ internalType: "address", name: "token", type: "address" },
{ internalType: "uint160", name: "allowance", type: "uint160" },
{ internalType: "uint48", name: "period", type: "uint48" },
{ internalType: "uint48", name: "start", type: "uint48" },
{ internalType: "uint48", name: "end", type: "uint48" },
{ internalType: "uint256", name: "salt", type: "uint256" },
{ internalType: "bytes", name: "extraData", type: "bytes" },
],
internalType: "struct SpendPermissionManager.SpendPermission",
name: "spendPermission",
type: "tuple",
},
],
name: "revokeAsSpender",
outputs: [],
stateMutability: "nonpayable",
type: "function",
},
{
inputs: [
{
components: [
{ internalType: "address", name: "account", type: "address" },
{ internalType: "address", name: "spender", type: "address" },
{ internalType: "address", name: "token", type: "address" },
{ internalType: "uint160", name: "allowance", type: "uint160" },
{ internalType: "uint48", name: "period", type: "uint48" },
{ internalType: "uint48", name: "start", type: "uint48" },
{ internalType: "uint48", name: "end", type: "uint48" },
{ internalType: "uint256", name: "salt", type: "uint256" },
{ internalType: "bytes", name: "extraData", type: "bytes" },
],
internalType: "struct SpendPermissionManager.SpendPermission",
name: "spendPermission",
type: "tuple",
},
{ internalType: "uint160", name: "value", type: "uint160" },
],
name: "spend",
outputs: [],
stateMutability: "nonpayable",
type: "function",
},
{
inputs: [
{
components: [
{ internalType: "address", name: "account", type: "address" },
{ internalType: "address", name: "spender", type: "address" },
{ internalType: "address", name: "token", type: "address" },
{ internalType: "uint160", name: "allowance", type: "uint160" },
{ internalType: "uint48", name: "period", type: "uint48" },
{ internalType: "uint48", name: "start", type: "uint48" },
{ internalType: "uint48", name: "end", type: "uint48" },
{ internalType: "uint256", name: "salt", type: "uint256" },
{ internalType: "bytes", name: "extraData", type: "bytes" },
],
internalType: "struct SpendPermissionManager.SpendPermission",
name: "spendPermission",
type: "tuple",
},
{ internalType: "uint160", name: "value", type: "uint160" },
{
components: [
{ internalType: "bytes", name: "signature", type: "bytes" },
{ internalType: "address", name: "asset", type: "address" },
{ internalType: "uint256", name: "amount", type: "uint256" },
{ internalType: "uint256", name: "nonce", type: "uint256" },
{ internalType: "uint48", name: "expiry", type: "uint48" },
],
internalType: "struct MagicSpend.WithdrawRequest",
name: "withdrawRequest",
type: "tuple",
},
],
name: "spendWithWithdraw",
outputs: [],
stateMutability: "nonpayable",
type: "function",
},
{ stateMutability: "payable", type: "receive" },
];
//# sourceMappingURL=constants.js.map