UNPKG

@chainlink/functions-toolkit

Version:

An NPM package with collection of functions that can be used for working with Chainlink Functions.

1,640 lines 155 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.FunctionsRouterSource = void 0; exports.FunctionsRouterSource = { _format: 'hh-sol-artifact-1', contractName: 'FunctionsRouter', sourceName: 'FunctionsRouter.sol', abi: [ { inputs: [ { internalType: 'address', name: 'linkToken', type: 'address', }, { components: [ { internalType: 'uint16', name: 'maxConsumersPerSubscription', type: 'uint16', }, { internalType: 'uint72', name: 'adminFee', type: 'uint72', }, { internalType: 'bytes4', name: 'handleOracleFulfillmentSelector', type: 'bytes4', }, { internalType: 'uint16', name: 'gasForCallExactCheck', type: 'uint16', }, { internalType: 'uint32[]', name: 'maxCallbackGasLimits', type: 'uint32[]', }, { internalType: 'uint16', name: 'subscriptionDepositMinimumRequests', type: 'uint16', }, { internalType: 'uint72', name: 'subscriptionDepositJuels', type: 'uint72', }, ], internalType: 'struct FunctionsRouter.Config', name: 'config', type: 'tuple', }, ], stateMutability: 'nonpayable', type: 'constructor', }, { inputs: [], name: 'CannotRemoveWithPendingRequests', type: 'error', }, { inputs: [ { internalType: 'bytes32', name: 'requestId', type: 'bytes32', }, ], name: 'DuplicateRequestId', type: 'error', }, { inputs: [], name: 'EmptyRequestData', type: 'error', }, { inputs: [ { internalType: 'uint32', name: 'limit', type: 'uint32', }, ], name: 'GasLimitTooBig', type: 'error', }, { inputs: [ { internalType: 'bytes32', name: 'id', type: 'bytes32', }, ], name: 'IdentifierIsReserved', type: 'error', }, { inputs: [ { internalType: 'uint96', name: 'currentBalanceJuels', type: 'uint96', }, ], name: 'InsufficientBalance', type: 'error', }, { inputs: [], name: 'InvalidCalldata', type: 'error', }, { inputs: [], name: 'InvalidConsumer', type: 'error', }, { inputs: [ { internalType: 'uint8', name: 'value', type: 'uint8', }, ], name: 'InvalidGasFlagValue', type: 'error', }, { inputs: [], name: 'InvalidProposal', type: 'error', }, { inputs: [], name: 'InvalidSubscription', type: 'error', }, { inputs: [ { internalType: 'address', name: 'proposedOwner', type: 'address', }, ], name: 'MustBeProposedOwner', type: 'error', }, { inputs: [], name: 'MustBeSubscriptionOwner', type: 'error', }, { inputs: [], name: 'OnlyCallableFromCoordinator', type: 'error', }, { inputs: [], name: 'OnlyCallableFromLink', type: 'error', }, { inputs: [ { internalType: 'bytes32', name: 'id', type: 'bytes32', }, ], name: 'RouteNotFound', type: 'error', }, { inputs: [ { internalType: 'address', name: 'sender', type: 'address', }, ], name: 'SenderMustAcceptTermsOfService', type: 'error', }, { inputs: [], name: 'TimeoutNotExceeded', type: 'error', }, { inputs: [ { internalType: 'uint16', name: 'maximumConsumers', type: 'uint16', }, ], name: 'TooManyConsumers', type: 'error', }, { anonymous: false, inputs: [ { components: [ { internalType: 'uint16', name: 'maxConsumersPerSubscription', type: 'uint16', }, { internalType: 'uint72', name: 'adminFee', type: 'uint72', }, { internalType: 'bytes4', name: 'handleOracleFulfillmentSelector', type: 'bytes4', }, { internalType: 'uint16', name: 'gasForCallExactCheck', type: 'uint16', }, { internalType: 'uint32[]', name: 'maxCallbackGasLimits', type: 'uint32[]', }, { internalType: 'uint16', name: 'subscriptionDepositMinimumRequests', type: 'uint16', }, { internalType: 'uint72', name: 'subscriptionDepositJuels', type: 'uint72', }, ], indexed: false, internalType: 'struct FunctionsRouter.Config', name: '', type: 'tuple', }, ], name: 'ConfigUpdated', type: 'event', }, { anonymous: false, inputs: [ { indexed: false, internalType: 'bytes32', name: 'proposedContractSetId', type: 'bytes32', }, { indexed: false, internalType: 'address', name: 'proposedContractSetFromAddress', type: 'address', }, { indexed: false, internalType: 'address', name: 'proposedContractSetToAddress', type: 'address', }, ], name: 'ContractProposed', type: 'event', }, { anonymous: false, inputs: [ { indexed: false, internalType: 'bytes32', name: 'id', type: 'bytes32', }, { indexed: false, internalType: 'address', name: 'from', type: 'address', }, { indexed: false, internalType: 'address', name: 'to', type: 'address', }, ], name: 'ContractUpdated', type: 'event', }, { anonymous: false, inputs: [ { indexed: false, internalType: 'address', name: 'to', type: 'address', }, { indexed: false, internalType: 'uint256', name: 'amount', type: 'uint256', }, ], name: 'FundsRecovered', type: 'event', }, { anonymous: false, inputs: [ { indexed: true, internalType: 'address', name: 'from', type: 'address', }, { indexed: true, internalType: 'address', name: 'to', type: 'address', }, ], name: 'OwnershipTransferRequested', type: 'event', }, { anonymous: false, inputs: [ { indexed: true, internalType: 'address', name: 'from', type: 'address', }, { indexed: true, internalType: 'address', name: 'to', type: 'address', }, ], name: 'OwnershipTransferred', type: 'event', }, { anonymous: false, inputs: [ { indexed: false, internalType: 'address', name: 'account', type: 'address', }, ], name: 'Paused', type: 'event', }, { anonymous: false, inputs: [ { indexed: true, internalType: 'bytes32', name: 'requestId', type: 'bytes32', }, { indexed: false, internalType: 'address', name: 'coordinator', type: 'address', }, { indexed: false, internalType: 'address', name: 'transmitter', type: 'address', }, { indexed: false, internalType: 'enum FunctionsResponse.FulfillResult', name: 'resultCode', type: 'uint8', }, ], name: 'RequestNotProcessed', type: 'event', }, { anonymous: false, inputs: [ { indexed: true, internalType: 'bytes32', name: 'requestId', type: 'bytes32', }, { indexed: true, internalType: 'uint64', name: 'subscriptionId', type: 'uint64', }, { indexed: false, internalType: 'uint96', name: 'totalCostJuels', type: 'uint96', }, { indexed: false, internalType: 'address', name: 'transmitter', type: 'address', }, { indexed: false, internalType: 'enum FunctionsResponse.FulfillResult', name: 'resultCode', type: 'uint8', }, { indexed: false, internalType: 'bytes', name: 'response', type: 'bytes', }, { indexed: false, internalType: 'bytes', name: 'err', type: 'bytes', }, { indexed: false, internalType: 'bytes', name: 'callbackReturnData', type: 'bytes', }, ], name: 'RequestProcessed', type: 'event', }, { anonymous: false, inputs: [ { indexed: true, internalType: 'bytes32', name: 'requestId', type: 'bytes32', }, { indexed: true, internalType: 'bytes32', name: 'donId', type: 'bytes32', }, { indexed: true, internalType: 'uint64', name: 'subscriptionId', type: 'uint64', }, { indexed: false, internalType: 'address', name: 'subscriptionOwner', type: 'address', }, { indexed: false, internalType: 'address', name: 'requestingContract', type: 'address', }, { indexed: false, internalType: 'address', name: 'requestInitiator', type: 'address', }, { indexed: false, internalType: 'bytes', name: 'data', type: 'bytes', }, { indexed: false, internalType: 'uint16', name: 'dataVersion', type: 'uint16', }, { indexed: false, internalType: 'uint32', name: 'callbackGasLimit', type: 'uint32', }, { indexed: false, internalType: 'uint96', name: 'estimatedTotalCostJuels', type: 'uint96', }, ], name: 'RequestStart', type: 'event', }, { anonymous: false, inputs: [ { indexed: true, internalType: 'bytes32', name: 'requestId', type: 'bytes32', }, ], name: 'RequestTimedOut', type: 'event', }, { anonymous: false, inputs: [ { indexed: true, internalType: 'uint64', name: 'subscriptionId', type: 'uint64', }, { indexed: false, internalType: 'address', name: 'fundsRecipient', type: 'address', }, { indexed: false, internalType: 'uint256', name: 'fundsAmount', type: 'uint256', }, ], name: 'SubscriptionCanceled', type: 'event', }, { anonymous: false, inputs: [ { indexed: true, internalType: 'uint64', name: 'subscriptionId', type: 'uint64', }, { indexed: false, internalType: 'address', name: 'consumer', type: 'address', }, ], name: 'SubscriptionConsumerAdded', type: 'event', }, { anonymous: false, inputs: [ { indexed: true, internalType: 'uint64', name: 'subscriptionId', type: 'uint64', }, { indexed: false, internalType: 'address', name: 'consumer', type: 'address', }, ], name: 'SubscriptionConsumerRemoved', type: 'event', }, { anonymous: false, inputs: [ { indexed: true, internalType: 'uint64', name: 'subscriptionId', type: 'uint64', }, { indexed: false, internalType: 'address', name: 'owner', type: 'address', }, ], name: 'SubscriptionCreated', type: 'event', }, { anonymous: false, inputs: [ { indexed: true, internalType: 'uint64', name: 'subscriptionId', type: 'uint64', }, { indexed: false, internalType: 'uint256', name: 'oldBalance', type: 'uint256', }, { indexed: false, internalType: 'uint256', name: 'newBalance', type: 'uint256', }, ], name: 'SubscriptionFunded', type: 'event', }, { anonymous: false, inputs: [ { indexed: true, internalType: 'uint64', name: 'subscriptionId', type: 'uint64', }, { indexed: false, internalType: 'address', name: 'from', type: 'address', }, { indexed: false, internalType: 'address', name: 'to', type: 'address', }, ], name: 'SubscriptionOwnerTransferRequested', type: 'event', }, { anonymous: false, inputs: [ { indexed: true, internalType: 'uint64', name: 'subscriptionId', type: 'uint64', }, { indexed: false, internalType: 'address', name: 'from', type: 'address', }, { indexed: false, internalType: 'address', name: 'to', type: 'address', }, ], name: 'SubscriptionOwnerTransferred', type: 'event', }, { anonymous: false, inputs: [ { indexed: false, internalType: 'address', name: 'account', type: 'address', }, ], name: 'Unpaused', type: 'event', }, { inputs: [], name: 'MAX_CALLBACK_RETURN_BYTES', outputs: [ { internalType: 'uint16', name: '', type: 'uint16', }, ], stateMutability: 'view', type: 'function', }, { inputs: [], name: 'acceptOwnership', outputs: [], stateMutability: 'nonpayable', type: 'function', }, { inputs: [ { internalType: 'uint64', name: 'subscriptionId', type: 'uint64', }, ], name: 'acceptSubscriptionOwnerTransfer', outputs: [], stateMutability: 'nonpayable', type: 'function', }, { inputs: [ { internalType: 'uint64', name: 'subscriptionId', type: 'uint64', }, { internalType: 'address', name: 'consumer', type: 'address', }, ], name: 'addConsumer', outputs: [], stateMutability: 'nonpayable', type: 'function', }, { inputs: [ { internalType: 'uint64', name: 'subscriptionId', type: 'uint64', }, { internalType: 'address', name: 'to', type: 'address', }, ], name: 'cancelSubscription', outputs: [], stateMutability: 'nonpayable', type: 'function', }, { inputs: [], name: 'createSubscription', outputs: [ { internalType: 'uint64', name: 'subscriptionId', type: 'uint64', }, ], stateMutability: 'nonpayable', type: 'function', }, { inputs: [ { internalType: 'address', name: 'consumer', type: 'address', }, ], name: 'createSubscriptionWithConsumer', outputs: [ { internalType: 'uint64', name: 'subscriptionId', type: 'uint64', }, ], stateMutability: 'nonpayable', type: 'function', }, { inputs: [ { internalType: 'bytes', name: 'response', type: 'bytes', }, { internalType: 'bytes', name: 'err', type: 'bytes', }, { internalType: 'uint96', name: 'juelsPerGas', type: 'uint96', }, { internalType: 'uint96', name: 'costWithoutCallback', type: 'uint96', }, { internalType: 'address', name: 'transmitter', type: 'address', }, { components: [ { internalType: 'bytes32', name: 'requestId', type: 'bytes32', }, { internalType: 'address', name: 'coordinator', type: 'address', }, { internalType: 'uint96', name: 'estimatedTotalCostJuels', type: 'uint96', }, { internalType: 'address', name: 'client', type: 'address', }, { internalType: 'uint64', name: 'subscriptionId', type: 'uint64', }, { internalType: 'uint32', name: 'callbackGasLimit', type: 'uint32', }, { internalType: 'uint72', name: 'adminFee', type: 'uint72', }, { internalType: 'uint72', name: 'donFee', type: 'uint72', }, { internalType: 'uint40', name: 'gasOverheadBeforeCallback', type: 'uint40', }, { internalType: 'uint40', name: 'gasOverheadAfterCallback', type: 'uint40', }, { internalType: 'uint32', name: 'timeoutTimestamp', type: 'uint32', }, ], internalType: 'struct FunctionsResponse.Commitment', name: 'commitment', type: 'tuple', }, ], name: 'fulfill', outputs: [ { internalType: 'enum FunctionsResponse.FulfillResult', name: 'resultCode', type: 'uint8', }, { internalType: 'uint96', name: '', type: 'uint96', }, ], stateMutability: 'nonpayable', type: 'function', }, { inputs: [], name: 'getAdminFee', outputs: [ { internalType: 'uint72', name: '', type: 'uint72', }, ], stateMutability: 'view', type: 'function', }, { inputs: [], name: 'getAllowListId', outputs: [ { internalType: 'bytes32', name: '', type: 'bytes32', }, ], stateMutability: 'view', type: 'function', }, { inputs: [], name: 'getConfig', outputs: [ { components: [ { internalType: 'uint16', name: 'maxConsumersPerSubscription', type: 'uint16', }, { internalType: 'uint72', name: 'adminFee', type: 'uint72', }, { internalType: 'bytes4', name: 'handleOracleFulfillmentSelector', type: 'bytes4', }, { internalType: 'uint16', name: 'gasForCallExactCheck', type: 'uint16', }, { internalType: 'uint32[]', name: 'maxCallbackGasLimits', type: 'uint32[]', }, { internalType: 'uint16', name: 'subscriptionDepositMinimumRequests', type: 'uint16', }, { internalType: 'uint72', name: 'subscriptionDepositJuels', type: 'uint72', }, ], internalType: 'struct FunctionsRouter.Config', name: '', type: 'tuple', }, ], stateMutability: 'view', type: 'function', }, { inputs: [ { internalType: 'address', name: 'client', type: 'address', }, { internalType: 'uint64', name: 'subscriptionId', type: 'uint64', }, ], name: 'getConsumer', outputs: [ { components: [ { internalType: 'bool', name: 'allowed', type: 'bool', }, { internalType: 'uint64', name: 'initiatedRequests', type: 'uint64', }, { internalType: 'uint64', name: 'completedRequests', type: 'uint64', }, ], internalType: 'struct IFunctionsSubscriptions.Consumer', name: '', type: 'tuple', }, ], stateMutability: 'view', type: 'function', }, { inputs: [ { internalType: 'bytes32', name: 'id', type: 'bytes32', }, ], name: 'getContractById', outputs: [ { internalType: 'address', name: '', type: 'address', }, ], stateMutability: 'view', type: 'function', }, { inputs: [ { internalType: 'uint64', name: 'subscriptionId', type: 'uint64', }, ], name: 'getFlags', outputs: [ { internalType: 'bytes32', name: '', type: 'bytes32', }, ], stateMutability: 'view', type: 'function', }, { inputs: [ { internalType: 'bytes32', name: 'id', type: 'bytes32', }, ], name: 'getProposedContractById', outputs: [ { internalType: 'address', name: '', type: 'address', }, ], stateMutability: 'view', type: 'function', }, { inputs: [], name: 'getProposedContractSet', outputs: [ { internalType: 'bytes32[]', name: '', type: 'bytes32[]', }, { internalType: 'address[]', name: '', type: 'address[]', }, ], stateMutability: 'view', type: 'function', }, { inputs: [ { internalType: 'uint64', name: 'subscriptionId', type: 'uint64', }, ], name: 'getSubscription', outputs: [ { components: [ { internalType: 'uint96', name: 'balance', type: 'uint96', }, { internalType: 'address', name: 'owner', type: 'address', }, { internalType: 'uint96', name: 'blockedBalance', type: 'uint96', }, { internalType: 'address', name: 'proposedOwner', type: 'address', }, { internalType: 'address[]', name: 'consumers', type: 'address[]', }, { internalType: 'bytes32', name: 'flags', type: 'bytes32', }, ], internalType: 'struct IFunctionsSubscriptions.Subscription', name: '', type: 'tuple', }, ], stateMutability: 'view', type: 'function', }, { inputs: [], name: 'getSubscriptionCount', outputs: [ { internalType: 'uint64', name: '', type: 'uint64', }, ], stateMutability: 'view', type: 'function', }, { inputs: [ { internalType: 'uint64', name: 'subscriptionIdStart', type: 'uint64', }, { internalType: 'uint64', name: 'subscriptionIdEnd', type: 'uint64', }, ], name: 'getSubscriptionsInRange', outputs: [ { components: [ { internalType: 'uint96', name: 'balance', type: 'uint96', }, { internalType: 'address', name: 'owner', type: 'address', }, { internalType: 'uint96', name: 'blockedBalance', type: 'uint96', }, { internalType: 'address', name: 'proposedOwner', type: 'address', }, { internalType: 'address[]', name: 'consumers', type: 'address[]', }, { internalType: 'bytes32', name: 'flags', type: 'bytes32', }, ], internalType: 'struct IFunctionsSubscriptions.Subscription[]', name: 'subscriptions', type: 'tuple[]', }, ], stateMutability: 'view', type: 'function', }, { inputs: [], name: 'getTotalBalance', outputs: [ { internalType: 'uint96', name: '', type: 'uint96', }, ], stateMutability: 'view', type: 'function', }, { inputs: [ { internalType: 'uint64', name: 'subscriptionId', type: 'uint64', }, { internalType: 'uint32', name: 'callbackGasLimit', type: 'uint32', }, ], name: 'isValidCallbackGasLimit', outputs: [], stateMutability: 'view', type: 'function', }, { inputs: [ { internalType: 'address', name: '', type: 'address', }, { internalType: 'uint256', name: 'amount', type: 'uint256', }, { internalType: 'bytes', name: 'data', type: 'bytes', }, ], name: 'onTokenTransfer', outputs: [], stateMutability: 'nonpayable', type: 'function', }, { inputs: [ { internalType: 'address', name: 'recipient', type: 'address', }, { internalType: 'uint96', name: 'amount', type: 'uint96', }, ], name: 'oracleWithdraw', outputs: [], stateMutability: 'nonpayable', type: 'function', }, { inputs: [], name: 'owner', outputs: [ { internalType: 'address', name: '', type: 'address', }, ], stateMutability: 'view', type: 'function', }, { inputs: [ { internalType: 'uint64', name: 'subscriptionId', type: 'uint64', }, ], name: 'ownerCancelSubscription', outputs: [], stateMutability: 'nonpayable', type: 'function', }, { inputs: [ { internalType: 'address', name: 'recipient', type: 'address', }, { internalType: 'uint96', name: 'amount', type: 'uint96', }, ], name: 'ownerWithdraw', outputs: [], stateMutability: 'nonpayable', type: 'function', }, { inputs: [], name: 'pause', outputs: [], stateMutability: 'nonpayable', type: 'function', }, { inputs: [], name: 'paused', outputs: [ { internalType: 'bool', name: '', type: 'bool', }, ], stateMutability: 'view', type: 'function', }, { inputs: [ { internalType: 'uint64', name: 'subscriptionId', type: 'uint64', }, ], name: 'pendingRequestExists', outputs: [ { internalType: 'bool', name: '', type: 'bool', }, ], stateMutability: 'view', type: 'function', }, { inputs: [ { internalType: 'bytes32[]', name: 'proposedContractSetIds', type: 'bytes32[]', }, { internalType: 'address[]', name: 'proposedContractSetAddresses', type: 'address[]', }, ], name: 'proposeContractsUpdate', outputs: [], stateMutability: 'nonpayable', type: 'function', }, { inputs: [ { internalType: 'uint64', name: 'subscriptionId', type: 'uint64', }, { internalType: 'address', name: 'newOwner', type: 'address', }, ], name: 'proposeSubscriptionOwnerTransfer', outputs: [], stateMutability: 'nonpayable', type: 'function', }, { inputs: [ { internalType: 'address', name: 'to', type: 'address', }, ], name: 'recoverFunds', outputs: [], stateMutability: 'nonpayable', type: 'function', }, { inputs: [ { internalType: 'uint64', name: 'subscriptionId', type: 'uint64', }, { internalType: 'address', name: 'consumer', type: 'address', }, ], name: 'removeConsumer', outputs: [], stateMutability: 'nonpayable', type: 'function', }, { inputs: [ { internalType: 'uint64', name: 'subscriptionId', type: 'uint64', }, { internalType: 'bytes', name: 'data', type: 'bytes', }, { internalType: 'uint16', name: 'dataVersion', type: 'uint16', }, { internalType: 'uint32', name: 'callbackGasLimit', type: 'uint32', }, { internalType: 'bytes32', name: 'donId', type: 'bytes32', }, ], name: 'sendRequest', outputs: [ { internalType: 'bytes32', name: '', type: 'bytes32', }, ], stateMutability: 'nonpayable', type: 'function', }, { inputs: [ { internalType: 'uint64', name: 'subscriptionId', type: 'uint64', }, { internalType: 'bytes', name: 'data', type: 'bytes', }, { internalType: 'uint16', name: 'dataVersion', type: 'uint16', }, { internalType: 'uint32', name: 'callbackGasLimit', type: 'uint32', }, { internalType: 'bytes32', name: 'donId', type: 'bytes32', }, ], name: 'sendRequestToProposed', outputs: [ { internalType: 'bytes32', name: '', type: 'bytes32', }, ], stateMutability: 'nonpayable', type: 'function', }, { inputs: [ { internalType: 'bytes32', name: 'allowListId', type: 'bytes32', }, ], name: 'setAllowListId', outputs: [], stateMutability: 'nonpayable', type: 'function', }, { inputs: [ { internalType: 'uint64', name: 'subscriptionId', type: 'uint64', }, { internalType: 'bytes32', name: 'flags', type: 'bytes32', }, ], name: 'setFlags', outputs: [], stateMutability: 'nonpayable', type: 'function', }, { inputs: [ { components: [ { internalType: 'bytes32', name: 'requestId', type: 'bytes32', }, { internalType: 'address', name: 'coordinator', type: 'address', }, { internalType: 'uint96', name: 'estimatedTotalCostJuels', type: 'uint96', }, { internalType: 'address', name: 'client', type: 'address', }, { internalType: 'uint64', name: 'subscriptionId', type: 'uint64', }, { internalType: 'uint32', name: 'callbackGasLimit', type: 'uint32', }, { internalType: 'uint72', name: 'adminFee', type: 'uint72', }, { internalType: 'uint72', name: 'donFee', type: 'uint72', }, { internalType: 'uint40', name: 'gasOverheadBeforeCallback', type: 'uint40', }, { internalType: 'uint40', name: 'gasOverheadAfterCallback', type: 'uint40', }, { internalType: 'uint32', name: 'timeoutTimestamp', type: 'uint32', }, ], internalType: 'struct FunctionsResponse.Commitment[]', name: 'requestsToTimeoutByCommitment', type: 'tuple[]', }, ], name: 'timeoutRequests', outputs: [], stateMutability: 'nonpayable', type: 'function', }, { inputs: [ { internalTy