@d20dao/vrf-sdk 0.3.4 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/abi.js CHANGED
@@ -1,3 +1,4 @@
1
1
  // Generated from canonical protocol sources with solc 0.8.28+commit.7893614a.Emscripten.clang.
2
2
  export const coordinatorAbi = [{ "inputs": [], "stateMutability": "nonpayable", "type": "constructor" }, { "inputs": [{ "internalType": "address", "name": "target", "type": "address" }], "name": "AddressEmptyCode", "type": "error" }, { "inputs": [], "name": "AlreadyDelivered", "type": "error" }, { "inputs": [], "name": "AlreadyFulfilled", "type": "error" }, { "inputs": [], "name": "BlockHashUnavailable", "type": "error" }, { "inputs": [], "name": "ContractConsumerRequired", "type": "error" }, { "inputs": [{ "internalType": "address", "name": "implementation", "type": "address" }], "name": "ERC1967InvalidImplementation", "type": "error" }, { "inputs": [], "name": "ERC1967NonPayable", "type": "error" }, { "inputs": [], "name": "EpochUnavailable", "type": "error" }, { "inputs": [], "name": "EvidencePacketTooLarge", "type": "error" }, { "inputs": [], "name": "FailedCall", "type": "error" }, { "inputs": [], "name": "FeeOverflow", "type": "error" }, { "inputs": [{ "internalType": "uint256", "name": "expected", "type": "uint256" }, { "internalType": "uint256", "name": "actual", "type": "uint256" }], "name": "IncorrectFee", "type": "error" }, { "inputs": [], "name": "InsufficientCallbackGas", "type": "error" }, { "inputs": [], "name": "InvalidBatch", "type": "error" }, { "inputs": [], "name": "InvalidCallbackGas", "type": "error" }, { "inputs": [], "name": "InvalidConfig", "type": "error" }, { "inputs": [], "name": "InvalidInitialization", "type": "error" }, { "inputs": [], "name": "InvalidMapping", "type": "error" }, { "inputs": [], "name": "InvalidPublicKey", "type": "error" }, { "inputs": [], "name": "InvalidRefundAddress", "type": "error" }, { "inputs": [], "name": "InvalidScan", "type": "error" }, { "inputs": [], "name": "NoKeeperCredit", "type": "error" }, { "inputs": [], "name": "NoRefundCredit", "type": "error" }, { "inputs": [], "name": "NotFulfilled", "type": "error" }, { "inputs": [], "name": "NotInitializing", "type": "error" }, { "inputs": [], "name": "NotReady", "type": "error" }, { "inputs": [], "name": "NotRefunded", "type": "error" }, { "inputs": [], "name": "OnlyFeeRecipient", "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": [], "name": "RefundCallbackAlreadyDelivered", "type": "error" }, { "inputs": [], "name": "RefundNotAvailable", "type": "error" }, { "inputs": [], "name": "RenounceDisabled", "type": "error" }, { "inputs": [], "name": "RequestExpired", "type": "error" }, { "inputs": [], "name": "RequestRefunded", "type": "error" }, { "inputs": [], "name": "TransferFailed", "type": "error" }, { "inputs": [], "name": "UUPSUnauthorizedCallContext", "type": "error" }, { "inputs": [{ "internalType": "bytes32", "name": "slot", "type": "bytes32" }], "name": "UUPSUnsupportedProxiableUUID", "type": "error" }, { "inputs": [], "name": "UnknownRequest", "type": "error" }, { "inputs": [], "name": "WrongPublicKey", "type": "error" }, { "inputs": [], "name": "WrongSeed", "type": "error" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "uint256", "name": "requestId", "type": "uint256" }, { "indexed": false, "internalType": "uint64", "name": "targetBlock", "type": "uint64" }, { "indexed": false, "internalType": "bytes32", "name": "blockHash", "type": "bytes32" }], "name": "BlockHashStored", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "uint256", "name": "requestId", "type": "uint256" }, { "indexed": false, "internalType": "bool", "name": "success", "type": "bool" }, { "indexed": false, "internalType": "uint32", "name": "gasLimit", "type": "uint32" }], "name": "CallbackAttempted", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "uint256", "name": "requestId", "type": "uint256" }, { "indexed": true, "internalType": "address", "name": "refundAddress", "type": "address" }, { "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" }], "name": "FeeOverpaymentCredited", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "address", "name": "previousRecipient", "type": "address" }, { "indexed": true, "internalType": "address", "name": "newRecipient", "type": "address" }], "name": "FeeRecipientChanged", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "address", "name": "recipient", "type": "address" }, { "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" }], "name": "FeesWithdrawn", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "uint256", "name": "requestId", "type": "uint256" }, { "indexed": true, "internalType": "bytes32", "name": "transcriptHash", "type": "bytes32" }, { "indexed": false, "internalType": "bytes", "name": "packet", "type": "bytes" }], "name": "FulfillmentEvidence", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "uint256", "name": "requestId", "type": "uint256" }, { "indexed": false, "internalType": "uint8", "name": "reason", "type": "uint8" }], "name": "FulfillmentSkipped", "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": "keeper", "type": "address" }, { "indexed": true, "internalType": "address", "name": "recipient", "type": "address" }, { "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" }], "name": "KeeperCreditWithdrawn", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": false, "internalType": "uint16", "name": "previousBps", "type": "uint16" }, { "indexed": false, "internalType": "uint16", "name": "newBps", "type": "uint16" }], "name": "KeeperFeeBpsChanged", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "uint256", "name": "requestId", "type": "uint256" }, { "indexed": true, "internalType": "address", "name": "keeper", "type": "address" }, { "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" }, { "indexed": false, "internalType": "bool", "name": "paid", "type": "bool" }], "name": "KeeperFeePaid", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "uint256", "name": "requestId", "type": "uint256" }, { "indexed": true, "internalType": "bytes32", "name": "mappingHash", "type": "bytes32" }, { "components": [{ "internalType": "enum RandomnessMapping.Operation", "name": "operation", "type": "uint8" }, { "internalType": "uint256", "name": "lower", "type": "uint256" }, { "internalType": "uint256", "name": "upper", "type": "uint256" }, { "internalType": "uint32", "name": "count", "type": "uint32" }, { "internalType": "uint32", "name": "population", "type": "uint32" }], "indexed": false, "internalType": "struct RandomnessMapping.Spec", "name": "spec", "type": "tuple" }], "name": "MappingRequested", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "address", "name": "previousOwner", "type": "address" }, { "indexed": true, "internalType": "address", "name": "newOwner", "type": "address" }], "name": "OwnershipTransferStarted", "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": "uint256", "name": "minFee", "type": "uint256" }, { "indexed": false, "internalType": "uint16", "name": "feeMultiplier", "type": "uint16" }, { "indexed": false, "internalType": "uint32", "name": "fulfillGasOverhead", "type": "uint32" }], "name": "PricingChanged", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "uint256", "name": "requestId", "type": "uint256" }, { "indexed": true, "internalType": "bytes32", "name": "keyHash", "type": "bytes32" }, { "indexed": false, "internalType": "uint256", "name": "seed", "type": "uint256" }, { "indexed": false, "internalType": "bytes32", "name": "proofHash", "type": "bytes32" }], "name": "ProofVerified", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "uint256", "name": "requestId", "type": "uint256" }, { "indexed": false, "internalType": "bytes32", "name": "randomness", "type": "bytes32" }, { "indexed": true, "internalType": "address", "name": "submitter", "type": "address" }], "name": "RandomnessFulfilled", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "uint256", "name": "requestId", "type": "uint256" }, { "indexed": true, "internalType": "address", "name": "consumer", "type": "address" }, { "indexed": true, "internalType": "bytes32", "name": "keyHash", "type": "bytes32" }, { "indexed": false, "internalType": "bytes32", "name": "clientSeed", "type": "bytes32" }, { "indexed": false, "internalType": "uint64", "name": "requestBlock", "type": "uint64" }, { "indexed": false, "internalType": "uint32", "name": "callbackGasLimit", "type": "uint32" }, { "indexed": false, "internalType": "uint256", "name": "feePaid", "type": "uint256" }, { "indexed": false, "internalType": "address", "name": "refundAddress", "type": "address" }, { "indexed": false, "internalType": "uint64", "name": "deadline", "type": "uint64" }], "name": "RandomnessRequested", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": false, "internalType": "uint16", "name": "previousBps", "type": "uint16" }, { "indexed": false, "internalType": "uint16", "name": "newBps", "type": "uint16" }], "name": "RefundBpsChanged", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "uint256", "name": "requestId", "type": "uint256" }, { "indexed": true, "internalType": "address", "name": "consumer", "type": "address" }, { "indexed": false, "internalType": "bool", "name": "success", "type": "bool" }, { "indexed": false, "internalType": "uint32", "name": "gasLimit", "type": "uint32" }], "name": "RefundCallbackAttempted", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "address", "name": "owner", "type": "address" }, { "indexed": true, "internalType": "address", "name": "recipient", "type": "address" }, { "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" }], "name": "RefundCreditWithdrawn", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "uint256", "name": "requestId", "type": "uint256" }, { "indexed": true, "internalType": "address", "name": "refundAddress", "type": "address" }, { "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" }, { "indexed": false, "internalType": "bool", "name": "paid", "type": "bool" }], "name": "RequestRefundedTo", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "uint256", "name": "requestId", "type": "uint256" }, { "indexed": true, "internalType": "uint256", "name": "serveIndex", "type": "uint256" }], "name": "RequestServed", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "address", "name": "implementation", "type": "address" }], "name": "Upgraded", "type": "event" }, { "inputs": [], "name": "CONFIG_DOMAIN", "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "MAX_CALLBACK_GAS", "outputs": [{ "internalType": "uint32", "name": "", "type": "uint32" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "MAX_EVIDENCE_PACKET_BYTES", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "MAX_FEE_MULTIPLIER", "outputs": [{ "internalType": "uint16", "name": "", "type": "uint16" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "MAX_FULFILL_BATCH", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "MAX_FULFILL_GAS_OVERHEAD", "outputs": [{ "internalType": "uint32", "name": "", "type": "uint32" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "MAX_MIN_FEE", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "MIN_CALLBACK_GAS", "outputs": [{ "internalType": "uint32", "name": "", "type": "uint32" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "MIN_FULFILL_GAS_OVERHEAD", "outputs": [{ "internalType": "uint32", "name": "", "type": "uint32" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "MIN_REFUND_BPS", "outputs": [{ "internalType": "uint16", "name": "", "type": "uint16" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "REFUND_CALLBACK_GAS", "outputs": [{ "internalType": "uint32", "name": "", "type": "uint32" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "RESPONSE_TIMEOUT", "outputs": [{ "internalType": "uint64", "name": "", "type": "uint64" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "SEED_DOMAIN", "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "TRANSCRIPT_DOMAIN", "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "UPGRADE_INTERFACE_VERSION", "outputs": [{ "internalType": "string", "name": "", "type": "string" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "acceptOwnership", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "confirmationBlocks", "outputs": [{ "internalType": "uint16", "name": "", "type": "uint16" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "earnedFees", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "epochRegistry", "outputs": [{ "internalType": "contract EpochEntropy", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "feeMultiplier", "outputs": [{ "internalType": "uint16", "name": "", "type": "uint16" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "feeRecipient", "outputs": [{ "internalType": "address", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "fulfillGasOverhead", "outputs": [{ "internalType": "uint32", "name": "", "type": "uint32" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint256", "name": "requestId", "type": "uint256" }, { "components": [{ "internalType": "uint256[2]", "name": "pk", "type": "uint256[2]" }, { "internalType": "uint256[2]", "name": "gamma", "type": "uint256[2]" }, { "internalType": "uint256", "name": "c", "type": "uint256" }, { "internalType": "uint256", "name": "s", "type": "uint256" }, { "internalType": "uint256", "name": "seed", "type": "uint256" }, { "internalType": "address", "name": "uWitness", "type": "address" }, { "internalType": "uint256[2]", "name": "cGammaWitness", "type": "uint256[2]" }, { "internalType": "uint256[2]", "name": "sHashWitness", "type": "uint256[2]" }, { "internalType": "uint256", "name": "zInv", "type": "uint256" }], "internalType": "struct VRF.Proof", "name": "proof", "type": "tuple" }], "name": "fulfillRandomness", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "uint256[]", "name": "ids", "type": "uint256[]" }, { "components": [{ "internalType": "uint256[2]", "name": "pk", "type": "uint256[2]" }, { "internalType": "uint256[2]", "name": "gamma", "type": "uint256[2]" }, { "internalType": "uint256", "name": "c", "type": "uint256" }, { "internalType": "uint256", "name": "s", "type": "uint256" }, { "internalType": "uint256", "name": "seed", "type": "uint256" }, { "internalType": "address", "name": "uWitness", "type": "address" }, { "internalType": "uint256[2]", "name": "cGammaWitness", "type": "uint256[2]" }, { "internalType": "uint256[2]", "name": "sHashWitness", "type": "uint256[2]" }, { "internalType": "uint256", "name": "zInv", "type": "uint256" }], "internalType": "struct VRF.Proof[]", "name": "proofs", "type": "tuple[]" }], "name": "fulfillRandomnessBatch", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "uint256", "name": "requestId", "type": "uint256" }], "name": "getMappedResult", "outputs": [{ "internalType": "uint256[]", "name": "", "type": "uint256[]" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint256", "name": "requestId", "type": "uint256" }], "name": "getMapping", "outputs": [{ "components": [{ "internalType": "enum RandomnessMapping.Operation", "name": "operation", "type": "uint8" }, { "internalType": "uint256", "name": "lower", "type": "uint256" }, { "internalType": "uint256", "name": "upper", "type": "uint256" }, { "internalType": "uint32", "name": "count", "type": "uint32" }, { "internalType": "uint32", "name": "population", "type": "uint32" }], "internalType": "struct RandomnessMapping.Spec", "name": "", "type": "tuple" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint256", "name": "fromId", "type": "uint256" }, { "internalType": "uint256", "name": "limit", "type": "uint256" }], "name": "getPendingRequestIds", "outputs": [{ "internalType": "uint256[]", "name": "ids", "type": "uint256[]" }, { "internalType": "uint256", "name": "nextCursor", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint256", "name": "requestId", "type": "uint256" }], "name": "getProofContext", "outputs": [{ "internalType": "uint256", "name": "seed", "type": "uint256" }, { "internalType": "uint64", "name": "deadline", "type": "uint64" }, { "internalType": "bool", "name": "fulfilled", "type": "bool" }, { "internalType": "bool", "name": "refunded", "type": "bool" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint256", "name": "requestId", "type": "uint256" }], "name": "getRequest", "outputs": [{ "components": [{ "internalType": "address", "name": "consumer", "type": "address" }, { "internalType": "uint32", "name": "callbackGasLimit", "type": "uint32" }, { "internalType": "uint64", "name": "requestBlock", "type": "uint64" }, { "internalType": "uint64", "name": "targetBlock", "type": "uint64" }, { "internalType": "uint64", "name": "deadline", "type": "uint64" }, { "internalType": "address", "name": "refundAddress", "type": "address" }, { "internalType": "bytes32", "name": "clientSeed", "type": "bytes32" }, { "internalType": "bytes32", "name": "mappingHash", "type": "bytes32" }, { "internalType": "bytes32", "name": "blockHash", "type": "bytes32" }, { "internalType": "bytes32", "name": "randomness", "type": "bytes32" }, { "internalType": "bytes32", "name": "proofHash", "type": "bytes32" }, { "internalType": "bytes32", "name": "transcriptHash", "type": "bytes32" }, { "internalType": "bool", "name": "fulfilled", "type": "bool" }, { "internalType": "bool", "name": "delivered", "type": "bool" }, { "internalType": "bool", "name": "refunded", "type": "bool" }, { "internalType": "uint64", "name": "epochId", "type": "uint64" }, { "internalType": "bytes32", "name": "epochHash", "type": "bytes32" }], "internalType": "struct D20VRFCoordinator.Request", "name": "result", "type": "tuple" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "initialFeeRecipient", "outputs": [{ "internalType": "address", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "initialMinFee", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint256[2]", "name": "publicKey", "type": "uint256[2]" }, { "internalType": "address", "name": "initialOwner", "type": "address" }, { "internalType": "address", "name": "recipient", "type": "address" }, { "internalType": "uint256", "name": "fee", "type": "uint256" }, { "internalType": "uint16", "name": "confirmations", "type": "uint16" }, { "internalType": "contract EpochEntropy", "name": "registry", "type": "address" }, { "internalType": "uint16", "name": "keeperBps", "type": "uint16" }], "name": "initialize", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "", "type": "address" }], "name": "keeperCredits", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "keeperFeeBps", "outputs": [{ "internalType": "uint16", "name": "", "type": "uint16" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "keyHash", "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "lastServedIndex", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "lastServedRequestId", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "bytes32", "name": "randomness", "type": "bytes32" }, { "components": [{ "internalType": "enum RandomnessMapping.Operation", "name": "operation", "type": "uint8" }, { "internalType": "uint256", "name": "lower", "type": "uint256" }, { "internalType": "uint256", "name": "upper", "type": "uint256" }, { "internalType": "uint32", "name": "count", "type": "uint32" }, { "internalType": "uint32", "name": "population", "type": "uint32" }], "internalType": "struct RandomnessMapping.Spec", "name": "spec", "type": "tuple" }], "name": "mapRandomness", "outputs": [{ "internalType": "uint256[]", "name": "", "type": "uint256[]" }], "stateMutability": "pure", "type": "function" }, { "inputs": [], "name": "minFee", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "nextRequestId", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "owner", "outputs": [{ "internalType": "address", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "pendingOwner", "outputs": [{ "internalType": "address", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "pricing", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }, { "internalType": "uint16", "name": "", "type": "uint16" }, { "internalType": "uint32", "name": "", "type": "uint32" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "protocolConfigurationHash", "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "proxiableUUID", "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "publicKeyX", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "publicKeyY", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint32", "name": "callbackGasLimit", "type": "uint32" }], "name": "quoteFee", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint32", "name": "callbackGasLimit", "type": "uint32" }, { "internalType": "uint256", "name": "baseFee", "type": "uint256" }], "name": "quoteFeeAt", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "refundBps", "outputs": [{ "internalType": "uint16", "name": "", "type": "uint16" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "name": "refundCallbackDelivered", "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "", "type": "address" }], "name": "refundCredits", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint256", "name": "requestId", "type": "uint256" }], "name": "refundRequest", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "renounceOwnership", "outputs": [], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint256", "name": "requestId", "type": "uint256" }], "name": "requestFeePaid", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "bytes32", "name": "clientSeed", "type": "bytes32" }, { "internalType": "uint32", "name": "callbackGasLimit", "type": "uint32" }, { "internalType": "address", "name": "_refundAddress", "type": "address" }, { "components": [{ "internalType": "enum RandomnessMapping.Operation", "name": "operation", "type": "uint8" }, { "internalType": "uint256", "name": "lower", "type": "uint256" }, { "internalType": "uint256", "name": "upper", "type": "uint256" }, { "internalType": "uint32", "name": "count", "type": "uint32" }, { "internalType": "uint32", "name": "population", "type": "uint32" }], "internalType": "struct RandomnessMapping.Spec", "name": "spec", "type": "tuple" }], "name": "requestMappedRandomness", "outputs": [{ "internalType": "uint256", "name": "requestId", "type": "uint256" }], "stateMutability": "payable", "type": "function" }, { "inputs": [{ "internalType": "bytes32", "name": "clientSeed", "type": "bytes32" }, { "internalType": "uint32", "name": "callbackGasLimit", "type": "uint32" }, { "internalType": "address", "name": "_refundAddress", "type": "address" }], "name": "requestRandomness", "outputs": [{ "internalType": "uint256", "name": "requestId", "type": "uint256" }], "stateMutability": "payable", "type": "function" }, { "inputs": [{ "internalType": "uint256", "name": "requestId", "type": "uint256" }], "name": "requestRefundBps", "outputs": [{ "internalType": "uint16", "name": "", "type": "uint16" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint256", "name": "requestId", "type": "uint256" }], "name": "requestSeed", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint256", "name": "requestId", "type": "uint256" }, { "internalType": "uint32", "name": "gasLimit", "type": "uint32" }], "name": "retryCallback", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "uint256", "name": "requestId", "type": "uint256" }, { "internalType": "uint32", "name": "gasLimit", "type": "uint32" }], "name": "retryRefundCallback", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "name": "servedRequestAt", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "next", "type": "address" }], "name": "setFeeRecipient", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "uint16", "name": "next", "type": "uint16" }], "name": "setKeeperFeeBps", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "uint256", "name": "nextMinFee", "type": "uint256" }, { "internalType": "uint16", "name": "multiplier", "type": "uint16" }, { "internalType": "uint32", "name": "overhead", "type": "uint32" }], "name": "setPricing", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "uint16", "name": "next", "type": "uint16" }], "name": "setRefundBps", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "uint256", "name": "requestId", "type": "uint256" }], "name": "storeBlockHash", "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "totalKeeperCredits", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "totalRefundCredits", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "newOwner", "type": "address" }], "name": "transferOwnership", "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": "uint256", "name": "requestId", "type": "uint256" }, { "components": [{ "internalType": "uint256[2]", "name": "pk", "type": "uint256[2]" }, { "internalType": "uint256[2]", "name": "gamma", "type": "uint256[2]" }, { "internalType": "uint256", "name": "c", "type": "uint256" }, { "internalType": "uint256", "name": "s", "type": "uint256" }, { "internalType": "uint256", "name": "seed", "type": "uint256" }, { "internalType": "address", "name": "uWitness", "type": "address" }, { "internalType": "uint256[2]", "name": "cGammaWitness", "type": "uint256[2]" }, { "internalType": "uint256[2]", "name": "sHashWitness", "type": "uint256[2]" }, { "internalType": "uint256", "name": "zInv", "type": "uint256" }], "internalType": "struct VRF.Proof", "name": "proof", "type": "tuple" }], "name": "verifyRequestProof", "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address payable", "name": "recipient", "type": "address" }], "name": "withdrawFees", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "address payable", "name": "recipient", "type": "address" }], "name": "withdrawKeeperCredit", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "address payable", "name": "recipient", "type": "address" }], "name": "withdrawRefundCredit", "outputs": [], "stateMutability": "nonpayable", "type": "function" }];
3
- export const epochEntropyAbi = [{ "inputs": [], "stateMutability": "nonpayable", "type": "constructor" }, { "inputs": [{ "internalType": "address", "name": "target", "type": "address" }], "name": "AddressEmptyCode", "type": "error" }, { "inputs": [], "name": "AlreadyCommitted", "type": "error" }, { "inputs": [], "name": "AnchorUnavailable", "type": "error" }, { "inputs": [], "name": "ECDSAInvalidSignature", "type": "error" }, { "inputs": [{ "internalType": "uint256", "name": "length", "type": "uint256" }], "name": "ECDSAInvalidSignatureLength", "type": "error" }, { "inputs": [{ "internalType": "bytes32", "name": "s", "type": "bytes32" }], "name": "ECDSAInvalidSignatureS", "type": "error" }, { "inputs": [{ "internalType": "address", "name": "implementation", "type": "address" }], "name": "ERC1967InvalidImplementation", "type": "error" }, { "inputs": [], "name": "ERC1967NonPayable", "type": "error" }, { "inputs": [], "name": "FailedCall", "type": "error" }, { "inputs": [], "name": "FallbackNotOpen", "type": "error" }, { "inputs": [], "name": "InvalidConfig", "type": "error" }, { "inputs": [], "name": "InvalidData", "type": "error" }, { "inputs": [], "name": "InvalidEpoch", "type": "error" }, { "inputs": [], "name": "InvalidFallback", "type": "error" }, { "inputs": [], "name": "InvalidInitialization", "type": "error" }, { "inputs": [], "name": "InvalidSigner", "type": "error" }, { "inputs": [], "name": "InvalidTime", "type": "error" }, { "inputs": [], "name": "NotInitializing", "type": "error" }, { "inputs": [], "name": "OnlyCommitter", "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": "PacketTooLarge", "type": "error" }, { "inputs": [], "name": "PreparationClosed", "type": "error" }, { "inputs": [], "name": "RenounceDisabled", "type": "error" }, { "inputs": [], "name": "UUPSUnauthorizedCallContext", "type": "error" }, { "inputs": [{ "internalType": "bytes32", "name": "slot", "type": "bytes32" }], "name": "UUPSUnsupportedProxiableUUID", "type": "error" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "uint64", "name": "fromEpoch", "type": "uint64" }, { "indexed": true, "internalType": "bytes32", "name": "catalogHash", "type": "bytes32" }, { "indexed": false, "internalType": "address[4]", "name": "signers", "type": "address[4]" }], "name": "CatalogScheduled", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "address", "name": "previousCommitter", "type": "address" }, { "indexed": true, "internalType": "address", "name": "newCommitter", "type": "address" }], "name": "CommitterChanged", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "uint64", "name": "epochId", "type": "uint64" }, { "indexed": true, "internalType": "bytes32", "name": "epochHash", "type": "bytes32" }, { "indexed": false, "internalType": "bytes", "name": "packet", "type": "bytes" }], "name": "EpochCommitted", "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": "OwnershipTransferStarted", "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": true, "internalType": "address", "name": "implementation", "type": "address" }], "name": "Upgraded", "type": "event" }, { "inputs": [], "name": "EPOCH_DOMAIN", "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "EPOCH_LENGTH", "outputs": [{ "internalType": "uint64", "name": "", "type": "uint64" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "FALLBACK_DELAY_BLOCKS", "outputs": [{ "internalType": "uint64", "name": "", "type": "uint64" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "MAX_ATTESTATION_AGE", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "MAX_FALLBACK_ATTEMPT", "outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "MAX_PACKET_BYTES", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "RECIPE_DOMAIN", "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "SELECT_DOMAIN", "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "UPGRADE_INTERFACE_VERSION", "outputs": [{ "internalType": "string", "name": "", "type": "string" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "acceptOwnership", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "anuSigner", "outputs": [{ "internalType": "address", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "btcTradeSigner", "outputs": [{ "internalType": "address", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "catalogHash", "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint64", "name": "epochId", "type": "uint64" }], "name": "catalogHashAt", "outputs": [{ "internalType": "bytes32", "name": "hash", "type": "bytes32" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint64", "name": "epochId", "type": "uint64" }], "name": "checkpointEpoch", "outputs": [{ "internalType": "bytes32", "name": "anchor", "type": "bytes32" }], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "uint64", "name": "epochId", "type": "uint64" }, { "components": [{ "internalType": "uint256", "name": "timestamp", "type": "uint256" }, { "internalType": "bytes", "name": "data", "type": "bytes" }, { "internalType": "bytes", "name": "signature", "type": "bytes" }], "internalType": "struct EpochEntropy.Attestation", "name": "a", "type": "tuple" }], "name": "commitEpoch", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "uint64", "name": "epochId", "type": "uint64" }, { "internalType": "uint8", "name": "attempt", "type": "uint8" }, { "components": [{ "internalType": "uint256", "name": "timestamp", "type": "uint256" }, { "internalType": "bytes", "name": "data", "type": "bytes" }, { "internalType": "bytes", "name": "signature", "type": "bytes" }], "internalType": "struct EpochEntropy.Attestation", "name": "a", "type": "tuple" }], "name": "commitEpochFallback", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "committer", "outputs": [{ "internalType": "address", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint64", "name": "", "type": "uint64" }], "name": "epochAnchors", "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint256", "name": "number", "type": "uint256" }], "name": "epochForBlock", "outputs": [{ "internalType": "uint64", "name": "", "type": "uint64" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint64", "name": "epochId", "type": "uint64" }], "name": "epochStart", "outputs": [{ "internalType": "uint64", "name": "", "type": "uint64" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "ethTradeSigner", "outputs": [{ "internalType": "address", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint64", "name": "epochId", "type": "uint64" }, { "internalType": "uint8", "name": "attempt", "type": "uint8" }], "name": "fallbackOpensAt", "outputs": [{ "internalType": "uint64", "name": "", "type": "uint64" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "firstEpochStart", "outputs": [{ "internalType": "uint64", "name": "", "type": "uint64" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint64", "name": "epochId", "type": "uint64" }], "name": "getEpoch", "outputs": [{ "components": [{ "internalType": "bytes32", "name": "epochHash", "type": "bytes32" }, { "internalType": "bytes32", "name": "catalogHash", "type": "bytes32" }, { "internalType": "bytes32", "name": "anchorHash", "type": "bytes32" }, { "internalType": "uint8", "name": "source", "type": "uint8" }, { "internalType": "bytes32", "name": "queryHash", "type": "bytes32" }, { "internalType": "bytes32", "name": "dataHash", "type": "bytes32" }, { "internalType": "bytes32", "name": "attestationHash", "type": "bytes32" }, { "internalType": "uint256", "name": "signedAt", "type": "uint256" }, { "internalType": "uint64", "name": "committedBlock", "type": "uint64" }], "internalType": "struct EpochEntropy.Epoch", "name": "", "type": "tuple" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint64", "name": "epochId", "type": "uint64" }, { "internalType": "uint8", "name": "attempt", "type": "uint8" }], "name": "getEpochFallbackSelection", "outputs": [{ "components": [{ "internalType": "uint8", "name": "source", "type": "uint8" }, { "internalType": "address", "name": "airnode", "type": "address" }, { "internalType": "bytes32", "name": "selector", "type": "bytes32" }, { "internalType": "bytes32", "name": "queryHash", "type": "bytes32" }, { "internalType": "string", "name": "canonicalRequest", "type": "string" }], "internalType": "struct EpochEntropy.Selection", "name": "s", "type": "tuple" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint64", "name": "epochId", "type": "uint64" }], "name": "getEpochSelection", "outputs": [{ "components": [{ "internalType": "uint8", "name": "source", "type": "uint8" }, { "internalType": "address", "name": "airnode", "type": "address" }, { "internalType": "bytes32", "name": "selector", "type": "bytes32" }, { "internalType": "bytes32", "name": "queryHash", "type": "bytes32" }, { "internalType": "string", "name": "canonicalRequest", "type": "string" }], "internalType": "struct EpochEntropy.Selection", "name": "s", "type": "tuple" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "hyperliquidSigner", "outputs": [{ "internalType": "address", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address[4]", "name": "signers", "type": "address[4]" }, { "internalType": "address", "name": "initialOwner", "type": "address" }, { "internalType": "address", "name": "initialCommitter", "type": "address" }], "name": "initialize", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "uint256", "name": "number", "type": "uint256" }], "name": "nextEpochToPrepare", "outputs": [{ "internalType": "uint64", "name": "", "type": "uint64" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "owner", "outputs": [{ "internalType": "address", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "pendingOwner", "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": "view", "type": "function" }, { "inputs": [{ "internalType": "address[4]", "name": "signers", "type": "address[4]" }, { "internalType": "uint64", "name": "fromEpoch", "type": "uint64" }], "name": "scheduleCatalog", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "next", "type": "address" }], "name": "setCommitter", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "uint64", "name": "epochId", "type": "uint64" }], "name": "signersAt", "outputs": [{ "internalType": "address[4]", "name": "signers", "type": "address[4]" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "newOwner", "type": "address" }], "name": "transferOwnership", "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" }];
3
+ export const epochEntropyAbi = [{ "inputs": [], "stateMutability": "nonpayable", "type": "constructor" }, { "inputs": [{ "internalType": "address", "name": "target", "type": "address" }], "name": "AddressEmptyCode", "type": "error" }, { "inputs": [], "name": "AlreadyCommitted", "type": "error" }, { "inputs": [], "name": "AnchorUnavailable", "type": "error" }, { "inputs": [], "name": "BeaconGasTooLow", "type": "error" }, { "inputs": [], "name": "ECDSAInvalidSignature", "type": "error" }, { "inputs": [{ "internalType": "uint256", "name": "length", "type": "uint256" }], "name": "ECDSAInvalidSignatureLength", "type": "error" }, { "inputs": [{ "internalType": "bytes32", "name": "s", "type": "bytes32" }], "name": "ECDSAInvalidSignatureS", "type": "error" }, { "inputs": [{ "internalType": "address", "name": "implementation", "type": "address" }], "name": "ERC1967InvalidImplementation", "type": "error" }, { "inputs": [], "name": "ERC1967NonPayable", "type": "error" }, { "inputs": [], "name": "FailedCall", "type": "error" }, { "inputs": [], "name": "FallbackNotOpen", "type": "error" }, { "inputs": [], "name": "InvalidConfig", "type": "error" }, { "inputs": [], "name": "InvalidData", "type": "error" }, { "inputs": [], "name": "InvalidEpoch", "type": "error" }, { "inputs": [], "name": "InvalidFallback", "type": "error" }, { "inputs": [], "name": "InvalidInitialization", "type": "error" }, { "inputs": [], "name": "InvalidRecipe", "type": "error" }, { "inputs": [], "name": "InvalidSigner", "type": "error" }, { "inputs": [], "name": "InvalidTemplate", "type": "error" }, { "inputs": [], "name": "InvalidTime", "type": "error" }, { "inputs": [], "name": "NotInitializing", "type": "error" }, { "inputs": [], "name": "OnlyCommitter", "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": "PacketTooLarge", "type": "error" }, { "inputs": [], "name": "PreparationClosed", "type": "error" }, { "inputs": [], "name": "RenounceDisabled", "type": "error" }, { "inputs": [{ "internalType": "uint256", "name": "value", "type": "uint256" }, { "internalType": "uint256", "name": "length", "type": "uint256" }], "name": "StringsInsufficientHexLength", "type": "error" }, { "inputs": [], "name": "UUPSUnauthorizedCallContext", "type": "error" }, { "inputs": [{ "internalType": "bytes32", "name": "slot", "type": "bytes32" }], "name": "UUPSUnsupportedProxiableUUID", "type": "error" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "address", "name": "account", "type": "address" }, { "indexed": false, "internalType": "bool", "name": "allowed", "type": "bool" }], "name": "BackupCommitterSet", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "uint8", "name": "recipe", "type": "uint8" }, { "indexed": true, "internalType": "address", "name": "verifier", "type": "address" }, { "indexed": true, "internalType": "bytes32", "name": "chainHash", "type": "bytes32" }, { "indexed": false, "internalType": "bytes", "name": "publicKey", "type": "bytes" }, { "indexed": false, "internalType": "uint64", "name": "genesis", "type": "uint64" }, { "indexed": false, "internalType": "uint64", "name": "period", "type": "uint64" }], "name": "BeaconRegistered", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "uint64", "name": "fromEpoch", "type": "uint64" }, { "indexed": true, "internalType": "bytes32", "name": "catalogHash", "type": "bytes32" }, { "indexed": false, "internalType": "uint8[]", "name": "recipes", "type": "uint8[]" }, { "indexed": false, "internalType": "address[]", "name": "signers", "type": "address[]" }], "name": "CatalogScheduled", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "address", "name": "previousCommitter", "type": "address" }, { "indexed": true, "internalType": "address", "name": "newCommitter", "type": "address" }], "name": "CommitterChanged", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "uint64", "name": "epochId", "type": "uint64" }, { "indexed": true, "internalType": "bytes32", "name": "epochHash", "type": "bytes32" }, { "indexed": false, "internalType": "bytes", "name": "packet", "type": "bytes" }], "name": "EpochCommitted", "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": "OwnershipTransferStarted", "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": true, "internalType": "uint8", "name": "recipe", "type": "uint8" }, { "indexed": true, "internalType": "bytes32", "name": "queryHash", "type": "bytes32" }, { "indexed": false, "internalType": "string", "name": "canonicalRequest", "type": "string" }, { "indexed": false, "internalType": "bytes", "name": "template", "type": "bytes" }, { "indexed": false, "internalType": "string", "name": "body", "type": "string" }], "name": "RecipeRegistered", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "address", "name": "implementation", "type": "address" }], "name": "Upgraded", "type": "event" }, { "inputs": [], "name": "BEACON_DOMAIN", "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "BEACON_VERIFY_GAS", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "EPOCH_DOMAIN", "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "EPOCH_LENGTH", "outputs": [{ "internalType": "uint64", "name": "", "type": "uint64" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "FALLBACK_DELAY_BLOCKS", "outputs": [{ "internalType": "uint64", "name": "", "type": "uint64" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "MAX_ATTESTATION_AGE", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "MAX_BACKUP_COMMITTERS", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "MAX_BODY_BYTES", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "MAX_DATA_BYTES", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "MAX_PACKET_BYTES", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "MAX_RECIPES", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "MAX_REQUEST_BYTES", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "MAX_SOURCES", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "MAX_TEMPLATE_BYTES", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "RECIPE_DOMAIN", "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "SELECT_DOMAIN", "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "UPGRADE_INTERFACE_VERSION", "outputs": [{ "internalType": "string", "name": "", "type": "string" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "acceptOwnership", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "backupCommitterCount", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint8", "name": "recipe", "type": "uint8" }], "name": "beaconOf", "outputs": [{ "components": [{ "internalType": "address", "name": "verifier", "type": "address" }, { "internalType": "uint64", "name": "genesis", "type": "uint64" }, { "internalType": "uint64", "name": "period", "type": "uint64" }, { "internalType": "bytes32", "name": "chainHash", "type": "bytes32" }, { "internalType": "bytes", "name": "publicKey", "type": "bytes" }], "internalType": "struct EpochEntropy.Beacon", "name": "", "type": "tuple" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "btcTradeSigner", "outputs": [{ "internalType": "address", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint64", "name": "epochId", "type": "uint64" }], "name": "catalogAt", "outputs": [{ "internalType": "bytes32", "name": "hash", "type": "bytes32" }, { "internalType": "uint8[]", "name": "recipes", "type": "uint8[]" }, { "internalType": "address[]", "name": "signers", "type": "address[]" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "catalogHash", "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint64", "name": "epochId", "type": "uint64" }], "name": "checkpointEpoch", "outputs": [{ "internalType": "bytes32", "name": "anchor", "type": "bytes32" }], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "uint64", "name": "epochId", "type": "uint64" }, { "components": [{ "internalType": "uint256", "name": "timestamp", "type": "uint256" }, { "internalType": "bytes", "name": "data", "type": "bytes" }, { "internalType": "bytes", "name": "signature", "type": "bytes" }], "internalType": "struct EpochEntropy.Attestation", "name": "a", "type": "tuple" }], "name": "commitEpoch", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "uint64", "name": "epochId", "type": "uint64" }, { "internalType": "uint8", "name": "attempt", "type": "uint8" }, { "components": [{ "internalType": "uint256", "name": "timestamp", "type": "uint256" }, { "internalType": "bytes", "name": "data", "type": "bytes" }, { "internalType": "bytes", "name": "signature", "type": "bytes" }], "internalType": "struct EpochEntropy.Attestation", "name": "a", "type": "tuple" }], "name": "commitEpochFallback", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "committer", "outputs": [{ "internalType": "address", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint64", "name": "", "type": "uint64" }], "name": "epochAnchors", "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint256", "name": "number", "type": "uint256" }], "name": "epochForBlock", "outputs": [{ "internalType": "uint64", "name": "", "type": "uint64" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint64", "name": "epochId", "type": "uint64" }], "name": "epochStart", "outputs": [{ "internalType": "uint64", "name": "", "type": "uint64" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "ethTradeSigner", "outputs": [{ "internalType": "address", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "ethereumBlockSigner", "outputs": [{ "internalType": "address", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint64", "name": "epochId", "type": "uint64" }, { "internalType": "uint8", "name": "attempt", "type": "uint8" }], "name": "fallbackOpensAt", "outputs": [{ "internalType": "uint64", "name": "", "type": "uint64" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "firstEpochStart", "outputs": [{ "internalType": "uint64", "name": "", "type": "uint64" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint64", "name": "epochId", "type": "uint64" }], "name": "getEpoch", "outputs": [{ "components": [{ "internalType": "bytes32", "name": "epochHash", "type": "bytes32" }, { "internalType": "bytes32", "name": "catalogHash", "type": "bytes32" }, { "internalType": "bytes32", "name": "anchorHash", "type": "bytes32" }, { "internalType": "uint8", "name": "source", "type": "uint8" }, { "internalType": "bytes32", "name": "queryHash", "type": "bytes32" }, { "internalType": "bytes32", "name": "dataHash", "type": "bytes32" }, { "internalType": "bytes32", "name": "attestationHash", "type": "bytes32" }, { "internalType": "uint256", "name": "signedAt", "type": "uint256" }, { "internalType": "uint64", "name": "committedBlock", "type": "uint64" }], "internalType": "struct EpochEntropy.Epoch", "name": "", "type": "tuple" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint64", "name": "epochId", "type": "uint64" }, { "internalType": "uint8", "name": "attempt", "type": "uint8" }], "name": "getEpochFallbackSelection", "outputs": [{ "components": [{ "internalType": "uint8", "name": "source", "type": "uint8" }, { "internalType": "uint8", "name": "recipe", "type": "uint8" }, { "internalType": "address", "name": "airnode", "type": "address" }, { "internalType": "bytes32", "name": "selector", "type": "bytes32" }, { "internalType": "bytes32", "name": "queryHash", "type": "bytes32" }, { "internalType": "string", "name": "canonicalRequest", "type": "string" }], "internalType": "struct EpochEntropy.Selection", "name": "s", "type": "tuple" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint64", "name": "epochId", "type": "uint64" }], "name": "getEpochSelection", "outputs": [{ "components": [{ "internalType": "uint8", "name": "source", "type": "uint8" }, { "internalType": "uint8", "name": "recipe", "type": "uint8" }, { "internalType": "address", "name": "airnode", "type": "address" }, { "internalType": "bytes32", "name": "selector", "type": "bytes32" }, { "internalType": "bytes32", "name": "queryHash", "type": "bytes32" }, { "internalType": "string", "name": "canonicalRequest", "type": "string" }], "internalType": "struct EpochEntropy.Selection", "name": "s", "type": "tuple" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint8", "name": "recipe", "type": "uint8" }], "name": "getRecipe", "outputs": [{ "internalType": "bytes32", "name": "queryHash", "type": "bytes32" }, { "internalType": "string", "name": "canonicalRequest", "type": "string" }, { "internalType": "bytes", "name": "template", "type": "bytes" }, { "internalType": "string", "name": "body", "type": "string" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "hyperliquidSigner", "outputs": [{ "internalType": "address", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address[4]", "name": "signers", "type": "address[4]" }, { "internalType": "address", "name": "initialOwner", "type": "address" }, { "internalType": "address", "name": "initialCommitter", "type": "address" }], "name": "initialize", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "initializeRecipeRegistry", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "account", "type": "address" }], "name": "isAuthorizedCommitter", "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "account", "type": "address" }], "name": "isBackupCommitter", "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint256", "name": "number", "type": "uint256" }], "name": "nextEpochToPrepare", "outputs": [{ "internalType": "uint64", "name": "", "type": "uint64" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "owner", "outputs": [{ "internalType": "address", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "pendingOwner", "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": "recipeCount", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint8", "name": "recipe", "type": "uint8" }], "name": "recipeRequest", "outputs": [{ "internalType": "string", "name": "", "type": "string" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "verifier", "type": "address" }, { "internalType": "bytes32", "name": "chainHash", "type": "bytes32" }, { "internalType": "bytes", "name": "publicKey", "type": "bytes" }, { "internalType": "uint64", "name": "genesis", "type": "uint64" }, { "internalType": "uint64", "name": "period", "type": "uint64" }, { "internalType": "uint64", "name": "sampleRound", "type": "uint64" }, { "internalType": "bytes", "name": "sampleSignature", "type": "bytes" }], "name": "registerBeacon", "outputs": [{ "internalType": "uint8", "name": "recipe", "type": "uint8" }], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "string", "name": "canonicalRequest", "type": "string" }, { "internalType": "bytes", "name": "template", "type": "bytes" }, { "internalType": "string", "name": "body", "type": "string" }], "name": "registerRecipe", "outputs": [{ "internalType": "uint8", "name": "recipe", "type": "uint8" }], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "renounceOwnership", "outputs": [], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint8[]", "name": "recipes", "type": "uint8[]" }, { "internalType": "address[]", "name": "signers", "type": "address[]" }, { "internalType": "uint64", "name": "fromEpoch", "type": "uint64" }], "name": "scheduleCatalog", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "account", "type": "address" }, { "internalType": "bool", "name": "allowed", "type": "bool" }], "name": "setBackupCommitter", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "next", "type": "address" }], "name": "setCommitter", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "uint8", "name": "recipe", "type": "uint8" }], "name": "slotSigner", "outputs": [{ "internalType": "address", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint64", "name": "epochId", "type": "uint64" }], "name": "sourceCountAt", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "newOwner", "type": "address" }], "name": "transferOwnership", "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": "uint8", "name": "recipe", "type": "uint8" }, { "internalType": "uint64", "name": "round", "type": "uint64" }, { "internalType": "bytes", "name": "signature", "type": "bytes" }], "name": "verifyBeacon", "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], "stateMutability": "view", "type": "function" }];
4
+ export const beaconVerifierAbi = [{ "inputs": [{ "internalType": "uint256[4]", "name": "input", "type": "uint256[4]" }], "name": "BNAddFailed", "type": "error" }, { "inputs": [], "name": "InsufficientGas", "type": "error" }, { "inputs": [{ "internalType": "bytes", "name": "dst", "type": "bytes" }], "name": "InvalidDSTLength", "type": "error" }, { "inputs": [{ "internalType": "uint256", "name": "x", "type": "uint256" }], "name": "InvalidFieldElement", "type": "error" }, { "inputs": [{ "internalType": "uint256", "name": "noSqrt", "type": "uint256" }], "name": "MapToPointFailed", "type": "error" }, { "inputs": [{ "internalType": "uint256", "name": "base", "type": "uint256" }, { "internalType": "uint256", "name": "exponent", "type": "uint256" }, { "internalType": "uint256", "name": "modulus", "type": "uint256" }], "name": "ModExpFailed", "type": "error" }, { "inputs": [], "name": "DST", "outputs": [{ "internalType": "bytes", "name": "", "type": "bytes" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "PAIRING_GAS", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "bytes", "name": "publicKey", "type": "bytes" }], "name": "isValidPublicKey", "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], "stateMutability": "pure", "type": "function" }, { "inputs": [{ "internalType": "uint64", "name": "round", "type": "uint64" }], "name": "roundMessage", "outputs": [{ "internalType": "uint256[2]", "name": "", "type": "uint256[2]" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "bytes", "name": "publicKey", "type": "bytes" }, { "internalType": "uint64", "name": "round", "type": "uint64" }, { "internalType": "bytes", "name": "signature", "type": "bytes" }], "name": "verifyRound", "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], "stateMutability": "view", "type": "function" }];
@@ -0,0 +1,28 @@
1
+ import { type BytesLike } from "ethers";
2
+ export interface BeaconRegistration {
3
+ verifier: string;
4
+ chainHash: string;
5
+ publicKey: string;
6
+ genesis: bigint;
7
+ period: bigint;
8
+ }
9
+ export declare const BEACON_DST = "BLS_SIG_BN254G1_XMD:KECCAK-256_SVDW_RO_NUL_";
10
+ export declare const BEACON_DOMAIN: string;
11
+ export declare const DRAND_EVMNET: Readonly<{
12
+ chainHash: "0x04f1e9062b8a81f848fded9c12306733282b2727ecced50032187751166ec8c3";
13
+ publicKey: "0x07e1d1d335df83fa98462005690372c643340060d205306a9aa8106b6bd0b3820557ec32c2ad488e4d4f6008f89a346f18492092ccc0d594610de2732c8b808f0095685ae3a85ba243747b1b2f426049010f6b73a0cf1d389351d5aaaa1047f6297d3a4f9749b33eb2d904c9d9ebf17224150ddd7abd7567a9bec6c74480ee0b";
14
+ genesis: 1727521075n;
15
+ period: 3n;
16
+ }>;
17
+ export declare const BEACON_TEMPLATE: string;
18
+ export declare function beaconCanonicalRequest(chainHash: string): string;
19
+ export declare function beaconSlotSigner(b: BeaconRegistration): string;
20
+ export declare function beaconRoundTime(b: Pick<BeaconRegistration, "genesis" | "period">, round: bigint): bigint;
21
+ export declare function beaconRoundAt(b: Pick<BeaconRegistration, "genesis" | "period">, timestamp: bigint): bigint;
22
+ export declare function encodeBeaconRound(round: bigint): string;
23
+ export declare function decodeBeaconRound(data: BytesLike): bigint;
24
+ export declare function beaconRoundMessage(round: bigint): {
25
+ x: bigint;
26
+ y: bigint;
27
+ };
28
+ export declare function verifyBeaconRound(publicKey: BytesLike, round: bigint, signature: BytesLike): boolean;
package/dist/beacon.js ADDED
@@ -0,0 +1,133 @@
1
+ // Public computation only, safe to bundle for browsers.
2
+ import { bn254 } from "@noble/curves/bn254";
3
+ import { mod, pow } from "@noble/curves/abstract/modular";
4
+ import { AbiCoder, concat, dataSlice, getAddress, getBytes, hexlify, id, keccak256, toBeHex, toUtf8Bytes, toUtf8String } from "ethers";
5
+ import { encodeDataTemplate, matchesDataTemplate } from "./templates.js";
6
+ /// RFC 9380 domain separation tag of the bls-bn254-unchained-on-g1 hash-to-curve, as in D20BeaconVerifier.
7
+ export const BEACON_DST = "BLS_SIG_BN254G1_XMD:KECCAK-256_SVDW_RO_NUL_";
8
+ export const BEACON_DOMAIN = id("D20_EPOCH_BEACON");
9
+ /// drand's evmnet, the network D20's beacon recipe follows: its chain hash, group key in drand's word order, and schedule.
10
+ export const DRAND_EVMNET = Object.freeze({
11
+ chainHash: "0x04f1e9062b8a81f848fded9c12306733282b2727ecced50032187751166ec8c3",
12
+ publicKey: "0x07e1d1d335df83fa98462005690372c643340060d205306a9aa8106b6bd0b3820557ec32c2ad488e4d4f6008f89a346f18492092ccc0d594610de2732c8b808f0095685ae3a85ba243747b1b2f426049010f6b73a0cf1d389351d5aaaa1047f6297d3a4f9749b33eb2d904c9d9ebf17224150ddd7abd7567a9bec6c74480ee0b",
13
+ genesis: 1727521075n, period: 3n,
14
+ });
15
+ const abi = AbiCoder.defaultAbiCoder();
16
+ // The BN254 base field order, written out (it is bn254.fields.Fp.ORDER). bn254 is read only inside the functions that verify or
17
+ // hash, never at module scope: a bundler can then drop noble's bn254 setup, about 45 ms to evaluate, from every chunk that
18
+ // imports this library without verifying a round, such as server chunks that run under a 10 ms CPU budget.
19
+ const P = 21888242871839275222246405745257275088696311157297823662689037894645226208583n;
20
+ const MAX_ROUND = (1n << 64n) - 1n, ROUND_DIGITS = 19;
21
+ /// A round's signed data is its number in decimal: 1 to 19 digits, no leading zero.
22
+ export const BEACON_TEMPLATE = encodeDataTemplate([{ integer: { minDigits: 1, maxDigits: ROUND_DIGITS } }]);
23
+ /// The canonical request, and body, of a beacon recipe: ["drand","<chainHash>"] with the hash in lowercase hex.
24
+ export function beaconCanonicalRequest(chainHash) {
25
+ if (getBytes(chainHash).length !== 32)
26
+ throw new Error("A beacon chain hash is 32 bytes");
27
+ return `["drand","${hexlify(chainHash)}"]`;
28
+ }
29
+ /// The signer a catalog lists for a beacon recipe: an identity derived from its registration, not a key.
30
+ export function beaconSlotSigner(b) {
31
+ return getAddress(dataSlice(keccak256(abi.encode(["bytes32", "address", "bytes32", "bytes32", "uint64", "uint64"], [BEACON_DOMAIN, b.verifier, b.chainHash, keccak256(b.publicKey), b.genesis, b.period])), 12));
32
+ }
33
+ // Rounds are uint64 onchain. A round the registry commits is at least 1: its template refuses a leading zero.
34
+ const isRound = (round, min) => typeof round === "bigint" && round >= min && round <= MAX_ROUND;
35
+ /// When round is scheduled: genesis + (round - 1) × period, as the registry computes it.
36
+ export function beaconRoundTime(b, round) {
37
+ if (!isRound(round, 1n))
38
+ throw new Error("Invalid beacon round");
39
+ return b.genesis + (round - 1n) * b.period;
40
+ }
41
+ /// The latest round scheduled at or before timestamp; 0 before genesis.
42
+ export function beaconRoundAt(b, timestamp) {
43
+ return timestamp < b.genesis ? 0n : (timestamp - b.genesis) / b.period + 1n;
44
+ }
45
+ /// The data a round is committed with: its number in decimal, as ASCII bytes.
46
+ export function encodeBeaconRound(round) {
47
+ if (round < 1n || round.toString().length > ROUND_DIGITS)
48
+ throw new Error("Invalid beacon round");
49
+ return hexlify(toUtf8Bytes(round.toString()));
50
+ }
51
+ /// Throws unless data is exactly a round number in canonical decimal, the only data a beacon recipe accepts.
52
+ export function decodeBeaconRound(data) {
53
+ if (!matchesDataTemplate(BEACON_TEMPLATE, data))
54
+ throw new Error("Invalid beacon round data");
55
+ return BigInt(toUtf8String(data));
56
+ }
57
+ // RFC 9380 hash_to_curve for BN254 G1 as BLS.sol computes it, line for line: expand_message_xmd with keccak256, two
58
+ // 48-byte field elements, the Shallue-van de Woestijne map with Z = 1, then their sum. G1 has cofactor 1, so no clearing.
59
+ const C1 = 4n, C2 = (P - 1n) / 2n; // g(Z), and -Z / 2, which is also the Legendre exponent
60
+ const C3 = 0x16789af3a83522eb353c98fc6b36d713d5d8d1cc5dffffffan; // sqrt(-12), the even root
61
+ const C4 = 0x10216f7ba065e00de81ac1e7808072c9dd2b2385cd7b438469602eb24829a9bdn; // -16 / 3
62
+ const g = (x) => mod(x * x * x + 3n, P);
63
+ const isSquare = (a) => pow(a, C2, P) === 1n;
64
+ // expand_message_xmd (RFC 9380 section 5.3.1) to 96 bytes: keccak256 has 32-byte digests and 136-byte blocks.
65
+ function expandMessage(message) {
66
+ const dst = toUtf8Bytes(BEACON_DST), suffix = concat([dst, Uint8Array.of(dst.length)]);
67
+ const b0 = getBytes(keccak256(concat([new Uint8Array(136), message, Uint8Array.of(0, 96, 0), suffix])));
68
+ const blocks = [];
69
+ for (let i = 1; i <= 3; i++)
70
+ blocks.push(getBytes(keccak256(concat([i === 1 ? b0 : b0.map((byte, at) => byte ^ blocks[i - 2][at]), Uint8Array.of(i), suffix]))));
71
+ return getBytes(concat(blocks));
72
+ }
73
+ function mapToPoint(u) {
74
+ let tv1 = mod(u * u * C1, P);
75
+ const tv2 = mod(1n + tv1, P);
76
+ tv1 = mod(1n - tv1, P);
77
+ const tv3 = pow(mod(tv1 * tv2, P), P - 2n, P); // inv0: zero maps to zero
78
+ const tv5 = mod(mod(mod(u * tv1, P) * tv3, P) * C3, P);
79
+ const x1 = mod(C2 - tv5, P), x2 = mod(C2 + tv5, P);
80
+ const tv8 = mod(mod(tv2 * tv2, P) * tv3, P);
81
+ const x3 = mod(1n + C4 * mod(tv8 * tv8, P), P);
82
+ const x = isSquare(g(x1)) ? x1 : isSquare(g(x2)) ? x2 : x3;
83
+ const y = pow(g(x), (P + 1n) / 4n, P);
84
+ if (mod(y * y, P) !== g(x))
85
+ throw new Error("Map to curve failed");
86
+ return { x, y: (y & 1n) === (u & 1n) ? y : P - y }; // sgn0 is parity
87
+ }
88
+ /// The G1 point that round's signature signs: hash-to-curve of keccak256(round as 8 big-endian bytes) under BEACON_DST.
89
+ export function beaconRoundMessage(round) {
90
+ if (!isRound(round, 0n))
91
+ throw new Error("Invalid beacon round");
92
+ const uniform = expandMessage(getBytes(keccak256(toBeHex(round, 8)))), G1 = bn254.G1.Point;
93
+ const [p0, p1] = [uniform.subarray(0, 48), uniform.subarray(48)].map(bytes => G1.fromAffine(mapToPoint(BigInt(hexlify(bytes)) % P)));
94
+ const { x, y } = p0.add(p1).toAffine();
95
+ return { x, y };
96
+ }
97
+ const words = (bytes) => Array.from({ length: bytes.length / 32 }, (_, i) => BigInt(hexlify(bytes.subarray(32 * i, 32 * i + 32))));
98
+ // Points must be canonical (coordinates below the field order), not the infinity encoding, and on the curve; a G2 key must
99
+ // also lie in the prime-order subgroup, which D20BeaconVerifier leaves to the pairing precompile.
100
+ function g1Point(bytes) {
101
+ const [x, y] = words(bytes);
102
+ if (x >= P || y >= P)
103
+ throw new Error("Non-canonical G1 point");
104
+ const point = bn254.G1.Point.fromAffine({ x, y });
105
+ if (point.is0())
106
+ throw new Error("G1 point at infinity");
107
+ point.assertValidity();
108
+ return point;
109
+ }
110
+ function g2Point(bytes) {
111
+ const [xIm, xRe, yIm, yRe] = words(bytes); // drand's order: the imaginary word first
112
+ if ([xIm, xRe, yIm, yRe].some(word => word >= P))
113
+ throw new Error("Non-canonical G2 point");
114
+ const point = bn254.G2.Point.fromAffine({ x: { c0: xRe, c1: xIm }, y: { c0: yRe, c1: yIm } });
115
+ if (point.is0())
116
+ throw new Error("G2 point at infinity");
117
+ point.assertValidity();
118
+ return point;
119
+ }
120
+ /// Whether signature (64 bytes, x ‖ y) is the beacon's signature of round under publicKey (128 bytes, x_im ‖ x_re ‖ y_im
121
+ /// ‖ y_re): e(signature, G2) == e(H(round), publicKey). Malformed input is false, never a throw.
122
+ export function verifyBeaconRound(publicKey, round, signature) {
123
+ try {
124
+ const key = getBytes(publicKey), sig = getBytes(signature);
125
+ if (key.length !== 128 || sig.length !== 64 || !isRound(round, 0n))
126
+ return false;
127
+ const pk = g2Point(key), sigma = g1Point(sig), { Fp12 } = bn254.fields;
128
+ return Fp12.eql(bn254.pairing(sigma, bn254.G2.Point.BASE), bn254.pairing(bn254.G1.Point.fromAffine(beaconRoundMessage(round)), pk));
129
+ }
130
+ catch {
131
+ return false;
132
+ }
133
+ }
package/dist/epoch.d.ts CHANGED
@@ -1,15 +1,20 @@
1
- import { type ApiAttestation } from "./sources.js";
1
+ import { type BlockTag, type ContractRunner } from "ethers";
2
+ import { type ApiAttestation, type ApiRequest, type PassthroughRequest } from "./sources.js";
3
+ import { type BeaconRegistration } from "./beacon.js";
2
4
  import { type VRFProof, type RequestContext } from "./verification.js";
3
5
  import type { XY } from "./verification.js";
4
6
  export declare const EPOCH_LENGTH = 200n;
5
7
  export declare const MAX_ATTESTATION_AGE = 240n;
6
8
  export declare const EPOCH_RECIPE_DOMAIN: string;
7
- export type EpochSigners = readonly [string, string, string, string];
9
+ export declare const MAX_EPOCH_SOURCES = 10, FALLBACK_DELAY_BLOCKS = 20n;
10
+ export type EpochSigners = readonly string[];
8
11
  export interface EpochCatalog {
9
12
  signers: EpochSigners;
13
+ recipes?: readonly number[];
10
14
  registry: string;
11
15
  chainId: bigint;
12
16
  firstEpochStart: bigint;
17
+ recipeBook?: EpochRecipeBook;
13
18
  }
14
19
  export interface EpochRecord {
15
20
  epochHash: string;
@@ -32,55 +37,55 @@ export interface EpochProtocolConfiguration {
32
37
  catalogHash: string;
33
38
  firstEpochStart: bigint;
34
39
  }
35
- export declare function epochCatalogHash(signers: EpochSigners): string;
40
+ export declare const MAX_EPOCH_RECIPES = 256, MAX_RECIPE_REQUEST_BYTES = 1024, MAX_RECIPE_BODY_BYTES = 2048;
41
+ export interface EpochRecipe {
42
+ canonicalRequest: string;
43
+ template: string;
44
+ body: string;
45
+ beacon?: BeaconRegistration;
46
+ }
47
+ export type EpochRecipeBook = {
48
+ readonly [recipe: number]: EpochRecipe | undefined;
49
+ };
50
+ export type EpochProvider = "hyperliquid" | "drpc" | "tickerlayer" | "nodary";
51
+ export interface BuiltinEpochRecipe extends EpochRecipe {
52
+ id: number;
53
+ provider: EpochProvider;
54
+ description: string;
55
+ request: ApiRequest;
56
+ }
57
+ export declare const BUILTIN_EPOCH_RECIPES: readonly BuiltinEpochRecipe[];
58
+ export declare const INITIAL_EPOCH_RECIPES: readonly number[];
59
+ export declare const PASSTHROUGH_EPOCH_REQUESTS: readonly PassthroughRequest[];
60
+ export declare function passthroughEpochRecipe(builtinRecipe: number): EpochRecipe;
61
+ export declare function validateEpochRecipe(recipe: EpochRecipe): void;
62
+ export declare function canonicalRequestOfBody(body: string): string;
63
+ export declare function readEpochRecipes(runner: ContractRunner, registry: string, ids: Iterable<number>, options?: {
64
+ blockTag?: BlockTag;
65
+ }): Promise<Record<number, EpochRecipe>>;
66
+ export declare function validateEpochData(template: string, data: string): void;
67
+ export declare function epochCatalogRecipes(catalog: Pick<EpochCatalog, "signers" | "recipes">): readonly number[];
68
+ export declare function epochRecipe(catalog: Pick<EpochCatalog, "recipeBook">, recipe: number): EpochRecipe;
69
+ export declare function epochCatalogHash(signers: EpochSigners, recipes?: readonly number[]): string;
70
+ export declare function resolveEpochCatalog(base: Omit<EpochCatalog, "signers" | "recipes">, view: {
71
+ hash: string;
72
+ recipes: readonly (number | bigint)[];
73
+ signers: readonly string[];
74
+ }): EpochCatalog;
36
75
  export declare function epochStart(firstEpochStart: bigint, epochId: bigint): bigint;
37
76
  export declare function epochForBlock(firstEpochStart: bigint, block: bigint): bigint;
38
- export declare const FALLBACK_DELAY_BLOCKS = 20n, MAX_FALLBACK_ATTEMPT = 3;
39
77
  export declare function fallbackOpensAt(firstEpochStart: bigint, epochId: bigint, attempt: number): bigint;
40
78
  export declare function selectEpoch(catalog: EpochCatalog, epochId: bigint, anchorHash: string, attempt?: number): {
79
+ beacon?: BeaconRegistration | undefined;
41
80
  source: number;
81
+ recipe: number;
42
82
  attempt: number;
43
83
  airnode: string;
44
84
  selector: string;
45
85
  canonicalRequest: string;
46
86
  queryHash: string;
47
- request: {
48
- operation: string;
49
- parameters: {
50
- dex: string;
51
- type?: undefined;
52
- length?: undefined;
53
- size?: undefined;
54
- assetClass?: undefined;
55
- symbol?: undefined;
56
- };
57
- responseProjection: {
58
- symbol: string;
59
- value: string;
60
- };
61
- } | {
62
- operation: string;
63
- parameters: {
64
- type: string;
65
- length: number;
66
- size: number;
67
- dex?: undefined;
68
- assetClass?: undefined;
69
- symbol?: undefined;
70
- };
71
- responseProjection?: undefined;
72
- } | {
73
- operation: string;
74
- parameters: {
75
- assetClass: string;
76
- symbol: string;
77
- dex?: undefined;
78
- type?: undefined;
79
- length?: undefined;
80
- size?: undefined;
81
- };
82
- responseProjection?: undefined;
83
- };
87
+ template: string;
88
+ body: string;
84
89
  };
85
90
  export declare function verifyEpochAttestation(selected: ReturnType<typeof selectEpoch>, a: ApiAttestation, commitTimestamp: bigint): {
86
91
  dataHash: string;
@@ -105,49 +110,16 @@ export declare function replayEpochCommitment(input: {
105
110
  signer: string;
106
111
  epochHash: string;
107
112
  selected: {
113
+ beacon?: BeaconRegistration | undefined;
108
114
  source: number;
115
+ recipe: number;
109
116
  attempt: number;
110
117
  airnode: string;
111
118
  selector: string;
112
119
  canonicalRequest: string;
113
120
  queryHash: string;
114
- request: {
115
- operation: string;
116
- parameters: {
117
- dex: string;
118
- type?: undefined;
119
- length?: undefined;
120
- size?: undefined;
121
- assetClass?: undefined;
122
- symbol?: undefined;
123
- };
124
- responseProjection: {
125
- symbol: string;
126
- value: string;
127
- };
128
- } | {
129
- operation: string;
130
- parameters: {
131
- type: string;
132
- length: number;
133
- size: number;
134
- dex?: undefined;
135
- assetClass?: undefined;
136
- symbol?: undefined;
137
- };
138
- responseProjection?: undefined;
139
- } | {
140
- operation: string;
141
- parameters: {
142
- assetClass: string;
143
- symbol: string;
144
- dex?: undefined;
145
- type?: undefined;
146
- length?: undefined;
147
- size?: undefined;
148
- };
149
- responseProjection?: undefined;
150
- };
121
+ template: string;
122
+ body: string;
151
123
  };
152
124
  };
153
125
  export declare function epochProtocolConfigurationHash(c: EpochProtocolConfiguration): string;