viem 2.57.11 → 2.57.13
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/CHANGELOG.md +62 -0
- package/_cjs/actions/public/fillTransaction.js +6 -3
- package/_cjs/actions/public/fillTransaction.js.map +1 -1
- package/_cjs/actions/public/waitForTransactionReceipt.js +83 -23
- package/_cjs/actions/public/waitForTransactionReceipt.js.map +1 -1
- package/_cjs/actions/public/watchContractEvent.js +58 -29
- package/_cjs/actions/public/watchContractEvent.js.map +1 -1
- package/_cjs/actions/public/watchEvent.js +58 -28
- package/_cjs/actions/public/watchEvent.js.map +1 -1
- package/_cjs/actions/token/approve.js +1 -1
- package/_cjs/actions/token/approve.js.map +1 -1
- package/_cjs/actions/token/getAllowance.js +1 -1
- package/_cjs/actions/token/getAllowance.js.map +1 -1
- package/_cjs/actions/token/getBalance.js +1 -1
- package/_cjs/actions/token/getBalance.js.map +1 -1
- package/_cjs/actions/token/getTotalSupply.js +1 -1
- package/_cjs/actions/token/getTotalSupply.js.map +1 -1
- package/_cjs/actions/token/transfer.js +1 -1
- package/_cjs/actions/token/transfer.js.map +1 -1
- package/_cjs/actions/wallet/sendCalls.js +1 -1
- package/_cjs/actions/wallet/sendCalls.js.map +1 -1
- package/_cjs/chains/definitions/molibra.js +21 -0
- package/_cjs/chains/definitions/molibra.js.map +1 -0
- package/_cjs/chains/definitions/valuechain.js +22 -0
- package/_cjs/chains/definitions/valuechain.js.map +1 -0
- package/_cjs/chains/definitions/valuechainTestnet.js +23 -0
- package/_cjs/chains/definitions/valuechainTestnet.js.map +1 -0
- package/_cjs/chains/index.js +13 -7
- package/_cjs/chains/index.js.map +1 -1
- package/_cjs/clients/decorators/public.js.map +1 -1
- package/_cjs/clients/transports/http.js +5 -1
- package/_cjs/clients/transports/http.js.map +1 -1
- package/_cjs/errors/node.js +1 -1
- package/_cjs/errors/node.js.map +1 -1
- package/_cjs/errors/request.js +20 -2
- package/_cjs/errors/request.js.map +1 -1
- package/_cjs/errors/typedData.js +3 -1
- package/_cjs/errors/typedData.js.map +1 -1
- package/_cjs/errors/version.js +1 -1
- package/_cjs/op-stack/abis.js +52 -0
- package/_cjs/op-stack/abis.js.map +1 -1
- package/_cjs/op-stack/actions/getTimeToFinalize.js +53 -4
- package/_cjs/op-stack/actions/getTimeToFinalize.js.map +1 -1
- package/_cjs/op-stack/actions/getTimeToProve.js +29 -2
- package/_cjs/op-stack/actions/getTimeToProve.js.map +1 -1
- package/_cjs/op-stack/actions/getWithdrawalStatus.js +20 -4
- package/_cjs/op-stack/actions/getWithdrawalStatus.js.map +1 -1
- package/_cjs/op-stack/actions/waitToProve.js +28 -2
- package/_cjs/op-stack/actions/waitToProve.js.map +1 -1
- package/_cjs/op-stack/errors/withdrawal.js +12 -1
- package/_cjs/op-stack/errors/withdrawal.js.map +1 -1
- package/_cjs/tempo/Account.js +6 -9
- package/_cjs/tempo/Account.js.map +1 -1
- package/_cjs/tempo/Addresses.js +1 -2
- package/_cjs/tempo/Addresses.js.map +1 -1
- package/_cjs/tempo/Formatters.js +13 -2
- package/_cjs/tempo/Formatters.js.map +1 -1
- package/_cjs/tempo/Relay.js.map +1 -1
- package/_cjs/tempo/Transaction.js.map +1 -1
- package/_cjs/tempo/accounts/Config.js +22 -12
- package/_cjs/tempo/accounts/Config.js.map +1 -1
- package/_cjs/tempo/actions/accessKey.js +8 -8
- package/_cjs/tempo/actions/accessKey.js.map +1 -1
- package/_cjs/tempo/actions/accounts.js +5 -5
- package/_cjs/tempo/actions/accounts.js.map +1 -1
- package/_cjs/tempo/actions/amm.js +4 -4
- package/_cjs/tempo/actions/amm.js.map +1 -1
- package/_cjs/tempo/actions/channel.js +7 -7
- package/_cjs/tempo/actions/channel.js.map +1 -1
- package/_cjs/tempo/actions/dex.js +14 -14
- package/_cjs/tempo/actions/dex.js.map +1 -1
- package/_cjs/tempo/actions/earn/deployment.js +3 -3
- package/_cjs/tempo/actions/earn/deployment.js.map +1 -1
- package/_cjs/tempo/actions/earn.js +6 -6
- package/_cjs/tempo/actions/earn.js.map +1 -1
- package/_cjs/tempo/actions/fee.js +4 -4
- package/_cjs/tempo/actions/fee.js.map +1 -1
- package/_cjs/tempo/actions/nonce.js +1 -1
- package/_cjs/tempo/actions/nonce.js.map +1 -1
- package/_cjs/tempo/actions/policy.js +6 -6
- package/_cjs/tempo/actions/policy.js.map +1 -1
- package/_cjs/tempo/actions/propAmm.js +10 -10
- package/_cjs/tempo/actions/propAmm.js.map +1 -1
- package/_cjs/tempo/actions/receivePolicy.js +6 -6
- package/_cjs/tempo/actions/receivePolicy.js.map +1 -1
- package/_cjs/tempo/actions/reward.js +6 -6
- package/_cjs/tempo/actions/reward.js.map +1 -1
- package/_cjs/tempo/actions/token.js +21 -21
- package/_cjs/tempo/actions/token.js.map +1 -1
- package/_cjs/tempo/actions/validator.js +11 -11
- package/_cjs/tempo/actions/validator.js.map +1 -1
- package/_cjs/tempo/actions/virtualAddress.js +2 -2
- package/_cjs/tempo/actions/virtualAddress.js.map +1 -1
- package/_cjs/tempo/chainConfig.js +11 -4
- package/_cjs/tempo/chainConfig.js.map +1 -1
- package/_cjs/tempo/internal/relay/accounts.js +42 -7
- package/_cjs/tempo/internal/relay/accounts.js.map +1 -1
- package/_cjs/tempo/internal/relay/feePayer.js +4 -1
- package/_cjs/tempo/internal/relay/feePayer.js.map +1 -1
- package/_cjs/utils/abi/getAbiItem.js +33 -12
- package/_cjs/utils/abi/getAbiItem.js.map +1 -1
- package/_cjs/utils/abi/parseEventLogs.js +18 -10
- package/_cjs/utils/abi/parseEventLogs.js.map +1 -1
- package/_cjs/utils/authorization/serializeAuthorizationList.js +4 -1
- package/_cjs/utils/authorization/serializeAuthorizationList.js.map +1 -1
- package/_cjs/utils/buildRequest.js +25 -14
- package/_cjs/utils/buildRequest.js.map +1 -1
- package/_cjs/utils/data/isHex.js +3 -1
- package/_cjs/utils/data/isHex.js.map +1 -1
- package/_cjs/utils/hash/normalizeSignature.js +1 -1
- package/_cjs/utils/hash/normalizeSignature.js.map +1 -1
- package/_cjs/utils/rpc/http.js +24 -4
- package/_cjs/utils/rpc/http.js.map +1 -1
- package/_cjs/utils/signature/compactSignatureToSignature.js +3 -2
- package/_cjs/utils/signature/compactSignatureToSignature.js.map +1 -1
- package/_cjs/utils/signature/hashTypedData.js +1 -2
- package/_cjs/utils/signature/hashTypedData.js.map +1 -1
- package/_cjs/utils/signature/signatureToCompactSignature.js +15 -7
- package/_cjs/utils/signature/signatureToCompactSignature.js.map +1 -1
- package/_cjs/utils/siwe/createSiweMessage.js +1 -1
- package/_cjs/utils/siwe/createSiweMessage.js.map +1 -1
- package/_cjs/utils/typedData.js +6 -7
- package/_cjs/utils/typedData.js.map +1 -1
- package/_cjs/utils/wait.js +1 -1
- package/_cjs/utils/wait.js.map +1 -1
- package/_esm/actions/public/fillTransaction.js +8 -3
- package/_esm/actions/public/fillTransaction.js.map +1 -1
- package/_esm/actions/public/waitForTransactionReceipt.js +101 -23
- package/_esm/actions/public/waitForTransactionReceipt.js.map +1 -1
- package/_esm/actions/public/watchContractEvent.js +73 -36
- package/_esm/actions/public/watchContractEvent.js.map +1 -1
- package/_esm/actions/public/watchEvent.js +73 -35
- package/_esm/actions/public/watchEvent.js.map +1 -1
- package/_esm/actions/token/approve.js +1 -1
- package/_esm/actions/token/approve.js.map +1 -1
- package/_esm/actions/token/getAllowance.js +1 -1
- package/_esm/actions/token/getAllowance.js.map +1 -1
- package/_esm/actions/token/getBalance.js +1 -1
- package/_esm/actions/token/getBalance.js.map +1 -1
- package/_esm/actions/token/getTotalSupply.js +1 -1
- package/_esm/actions/token/getTotalSupply.js.map +1 -1
- package/_esm/actions/token/transfer.js +1 -1
- package/_esm/actions/token/transfer.js.map +1 -1
- package/_esm/actions/wallet/sendCalls.js +1 -1
- package/_esm/actions/wallet/sendCalls.js.map +1 -1
- package/_esm/chains/definitions/molibra.js +18 -0
- package/_esm/chains/definitions/molibra.js.map +1 -0
- package/_esm/chains/definitions/valuechain.js +20 -0
- package/_esm/chains/definitions/valuechain.js.map +1 -0
- package/_esm/chains/definitions/valuechainTestnet.js +21 -0
- package/_esm/chains/definitions/valuechainTestnet.js.map +1 -0
- package/_esm/chains/index.js +5 -0
- package/_esm/chains/index.js.map +1 -1
- package/_esm/clients/decorators/public.js.map +1 -1
- package/_esm/clients/transports/http.js +6 -1
- package/_esm/clients/transports/http.js.map +1 -1
- package/_esm/errors/node.js +1 -1
- package/_esm/errors/node.js.map +1 -1
- package/_esm/errors/request.js +22 -2
- package/_esm/errors/request.js.map +1 -1
- package/_esm/errors/typedData.js +3 -1
- package/_esm/errors/typedData.js.map +1 -1
- package/_esm/errors/version.js +1 -1
- package/_esm/op-stack/abis.js +52 -0
- package/_esm/op-stack/abis.js.map +1 -1
- package/_esm/op-stack/actions/getTimeToFinalize.js +64 -6
- package/_esm/op-stack/actions/getTimeToFinalize.js.map +1 -1
- package/_esm/op-stack/actions/getTimeToProve.js +30 -2
- package/_esm/op-stack/actions/getTimeToProve.js.map +1 -1
- package/_esm/op-stack/actions/getWithdrawalStatus.js +24 -5
- package/_esm/op-stack/actions/getWithdrawalStatus.js.map +1 -1
- package/_esm/op-stack/actions/waitToProve.js +30 -3
- package/_esm/op-stack/actions/waitToProve.js.map +1 -1
- package/_esm/op-stack/errors/withdrawal.js +10 -0
- package/_esm/op-stack/errors/withdrawal.js.map +1 -1
- package/_esm/tempo/Account.js +6 -9
- package/_esm/tempo/Account.js.map +1 -1
- package/_esm/tempo/Addresses.js +0 -2
- package/_esm/tempo/Addresses.js.map +1 -1
- package/_esm/tempo/Formatters.js +12 -2
- package/_esm/tempo/Formatters.js.map +1 -1
- package/_esm/tempo/Relay.js.map +1 -1
- package/_esm/tempo/Transaction.js.map +1 -1
- package/_esm/tempo/accounts/Config.js +28 -16
- package/_esm/tempo/accounts/Config.js.map +1 -1
- package/_esm/tempo/actions/accessKey.js +8 -8
- package/_esm/tempo/actions/accessKey.js.map +1 -1
- package/_esm/tempo/actions/accounts.js +7 -7
- package/_esm/tempo/actions/accounts.js.map +1 -1
- package/_esm/tempo/actions/amm.js +4 -4
- package/_esm/tempo/actions/amm.js.map +1 -1
- package/_esm/tempo/actions/channel.js +7 -7
- package/_esm/tempo/actions/channel.js.map +1 -1
- package/_esm/tempo/actions/dex.js +14 -14
- package/_esm/tempo/actions/dex.js.map +1 -1
- package/_esm/tempo/actions/earn/deployment.js +3 -3
- package/_esm/tempo/actions/earn/deployment.js.map +1 -1
- package/_esm/tempo/actions/earn.js +6 -6
- package/_esm/tempo/actions/earn.js.map +1 -1
- package/_esm/tempo/actions/fee.js +4 -4
- package/_esm/tempo/actions/fee.js.map +1 -1
- package/_esm/tempo/actions/nonce.js +1 -1
- package/_esm/tempo/actions/nonce.js.map +1 -1
- package/_esm/tempo/actions/policy.js +6 -6
- package/_esm/tempo/actions/policy.js.map +1 -1
- package/_esm/tempo/actions/propAmm.js +10 -10
- package/_esm/tempo/actions/propAmm.js.map +1 -1
- package/_esm/tempo/actions/receivePolicy.js +6 -6
- package/_esm/tempo/actions/receivePolicy.js.map +1 -1
- package/_esm/tempo/actions/reward.js +6 -6
- package/_esm/tempo/actions/reward.js.map +1 -1
- package/_esm/tempo/actions/token.js +21 -21
- package/_esm/tempo/actions/token.js.map +1 -1
- package/_esm/tempo/actions/validator.js +11 -11
- package/_esm/tempo/actions/validator.js.map +1 -1
- package/_esm/tempo/actions/virtualAddress.js +2 -2
- package/_esm/tempo/actions/virtualAddress.js.map +1 -1
- package/_esm/tempo/chainConfig.js +13 -4
- package/_esm/tempo/chainConfig.js.map +1 -1
- package/_esm/tempo/internal/relay/accounts.js +44 -7
- package/_esm/tempo/internal/relay/accounts.js.map +1 -1
- package/_esm/tempo/internal/relay/feePayer.js +4 -1
- package/_esm/tempo/internal/relay/feePayer.js.map +1 -1
- package/_esm/utils/abi/getAbiItem.js +36 -14
- package/_esm/utils/abi/getAbiItem.js.map +1 -1
- package/_esm/utils/abi/parseEventLogs.js +25 -11
- package/_esm/utils/abi/parseEventLogs.js.map +1 -1
- package/_esm/utils/authorization/serializeAuthorizationList.js +7 -1
- package/_esm/utils/authorization/serializeAuthorizationList.js.map +1 -1
- package/_esm/utils/buildRequest.js +29 -15
- package/_esm/utils/buildRequest.js.map +1 -1
- package/_esm/utils/data/isHex.js +3 -1
- package/_esm/utils/data/isHex.js.map +1 -1
- package/_esm/utils/hash/normalizeSignature.js +1 -1
- package/_esm/utils/hash/normalizeSignature.js.map +1 -1
- package/_esm/utils/hash/toSignature.js +1 -1
- package/_esm/utils/hash/toSignatureHash.js +1 -1
- package/_esm/utils/rpc/http.js +29 -7
- package/_esm/utils/rpc/http.js.map +1 -1
- package/_esm/utils/signature/compactSignatureToSignature.js +3 -2
- package/_esm/utils/signature/compactSignatureToSignature.js.map +1 -1
- package/_esm/utils/signature/hashTypedData.js +1 -2
- package/_esm/utils/signature/hashTypedData.js.map +1 -1
- package/_esm/utils/signature/signatureToCompactSignature.js +16 -7
- package/_esm/utils/signature/signatureToCompactSignature.js.map +1 -1
- package/_esm/utils/siwe/createSiweMessage.js +1 -1
- package/_esm/utils/siwe/createSiweMessage.js.map +1 -1
- package/_esm/utils/typedData.js +12 -8
- package/_esm/utils/typedData.js.map +1 -1
- package/_esm/utils/wait.js +2 -1
- package/_esm/utils/wait.js.map +1 -1
- package/_types/actions/getContract.d.ts +1 -1
- package/_types/actions/public/fillTransaction.d.ts.map +1 -1
- package/_types/actions/public/waitForTransactionReceipt.d.ts +31 -1
- package/_types/actions/public/waitForTransactionReceipt.d.ts.map +1 -1
- package/_types/actions/public/watchContractEvent.d.ts +1 -1
- package/_types/actions/public/watchContractEvent.d.ts.map +1 -1
- package/_types/actions/public/watchEvent.d.ts +1 -1
- package/_types/actions/public/watchEvent.d.ts.map +1 -1
- package/_types/chains/definitions/molibra.d.ts +52 -0
- package/_types/chains/definitions/molibra.d.ts.map +1 -0
- package/_types/chains/definitions/tempo.d.ts +14 -6
- package/_types/chains/definitions/tempo.d.ts.map +1 -1
- package/_types/chains/definitions/tempoDevnet.d.ts +14 -6
- package/_types/chains/definitions/tempoDevnet.d.ts.map +1 -1
- package/_types/chains/definitions/tempoLocalnet.d.ts +14 -6
- package/_types/chains/definitions/tempoLocalnet.d.ts.map +1 -1
- package/_types/chains/definitions/tempoModerato.d.ts +14 -6
- package/_types/chains/definitions/tempoModerato.d.ts.map +1 -1
- package/_types/chains/definitions/valuechain.d.ts +53 -0
- package/_types/chains/definitions/valuechain.d.ts.map +1 -0
- package/_types/chains/definitions/valuechainTestnet.d.ts +53 -0
- package/_types/chains/definitions/valuechainTestnet.d.ts.map +1 -0
- package/_types/chains/index.d.ts +5 -0
- package/_types/chains/index.d.ts.map +1 -1
- package/_types/clients/decorators/public.d.ts +5 -2
- package/_types/clients/decorators/public.d.ts.map +1 -1
- package/_types/clients/transports/http.d.ts.map +1 -1
- package/_types/errors/node.d.ts.map +1 -1
- package/_types/errors/request.d.ts +7 -1
- package/_types/errors/request.d.ts.map +1 -1
- package/_types/errors/typedData.d.ts.map +1 -1
- package/_types/errors/version.d.ts +1 -1
- package/_types/op-stack/abis.d.ts +40 -0
- package/_types/op-stack/abis.d.ts.map +1 -1
- package/_types/op-stack/actions/getTimeToFinalize.d.ts +3 -2
- package/_types/op-stack/actions/getTimeToFinalize.d.ts.map +1 -1
- package/_types/op-stack/actions/getTimeToProve.d.ts +3 -1
- package/_types/op-stack/actions/getTimeToProve.d.ts.map +1 -1
- package/_types/op-stack/actions/getWithdrawalStatus.d.ts +2 -2
- package/_types/op-stack/actions/getWithdrawalStatus.d.ts.map +1 -1
- package/_types/op-stack/actions/waitToProve.d.ts +3 -1
- package/_types/op-stack/actions/waitToProve.d.ts.map +1 -1
- package/_types/op-stack/errors/withdrawal.d.ts +8 -0
- package/_types/op-stack/errors/withdrawal.d.ts.map +1 -1
- package/_types/tempo/Account.d.ts +14 -5
- package/_types/tempo/Account.d.ts.map +1 -1
- package/_types/tempo/Addresses.d.ts +0 -2
- package/_types/tempo/Addresses.d.ts.map +1 -1
- package/_types/tempo/Formatters.d.ts +3 -0
- package/_types/tempo/Formatters.d.ts.map +1 -1
- package/_types/tempo/Relay.d.ts +20 -0
- package/_types/tempo/Relay.d.ts.map +1 -1
- package/_types/tempo/Transaction.d.ts +7 -2
- package/_types/tempo/Transaction.d.ts.map +1 -1
- package/_types/tempo/accounts/Config.d.ts +24 -2
- package/_types/tempo/accounts/Config.d.ts.map +1 -1
- package/_types/tempo/actions/accounts.d.ts +2 -2
- package/_types/tempo/chainConfig.d.ts +8 -3
- package/_types/tempo/chainConfig.d.ts.map +1 -1
- package/_types/tempo/internal/relay/accounts.d.ts.map +1 -1
- package/_types/tempo/internal/relay/feePayer.d.ts.map +1 -1
- package/_types/utils/abi/getAbiItem.d.ts.map +1 -1
- package/_types/utils/abi/parseEventLogs.d.ts.map +1 -1
- package/_types/utils/authorization/serializeAuthorizationList.d.ts.map +1 -1
- package/_types/utils/buildRequest.d.ts.map +1 -1
- package/_types/utils/data/isHex.d.ts +12 -1
- package/_types/utils/data/isHex.d.ts.map +1 -1
- package/_types/utils/hash/toSignature.d.ts +1 -1
- package/_types/utils/hash/toSignatureHash.d.ts +1 -1
- package/_types/utils/rpc/http.d.ts +2 -2
- package/_types/utils/rpc/http.d.ts.map +1 -1
- package/_types/utils/signature/compactSignatureToSignature.d.ts +2 -1
- package/_types/utils/signature/compactSignatureToSignature.d.ts.map +1 -1
- package/_types/utils/signature/hashTypedData.d.ts.map +1 -1
- package/_types/utils/signature/signatureToCompactSignature.d.ts +2 -1
- package/_types/utils/signature/signatureToCompactSignature.d.ts.map +1 -1
- package/_types/utils/typedData.d.ts.map +1 -1
- package/_types/utils/wait.d.ts.map +1 -1
- package/actions/getContract.ts +1 -1
- package/actions/public/fillTransaction.ts +12 -3
- package/actions/public/waitForTransactionReceipt.ts +164 -33
- package/actions/public/watchContractEvent.ts +82 -39
- package/actions/public/watchEvent.ts +82 -38
- package/actions/wallet/sendCalls.ts +1 -1
- package/chains/definitions/molibra.ts +18 -0
- package/chains/definitions/valuechain.ts +20 -0
- package/chains/definitions/valuechainTestnet.ts +21 -0
- package/chains/index.ts +5 -0
- package/clients/decorators/public.ts +5 -2
- package/clients/transports/http.ts +6 -1
- package/errors/node.ts +1 -1
- package/errors/request.ts +15 -1
- package/errors/typedData.ts +3 -1
- package/errors/version.ts +1 -1
- package/op-stack/abis.ts +52 -0
- package/op-stack/actions/getTimeToFinalize.ts +89 -10
- package/op-stack/actions/getTimeToProve.ts +43 -2
- package/op-stack/actions/getWithdrawalStatus.ts +30 -6
- package/op-stack/actions/waitToProve.ts +45 -3
- package/op-stack/errors/withdrawal.ts +17 -0
- package/package.json +2 -2
- package/tempo/Account.ts +20 -22
- package/tempo/Addresses.ts +0 -3
- package/tempo/Formatters.ts +19 -7
- package/tempo/Relay.ts +26 -0
- package/tempo/Transaction.ts +10 -2
- package/tempo/accounts/Config.ts +40 -25
- package/tempo/actions/accounts.ts +2 -2
- package/tempo/chainConfig.ts +15 -4
- package/tempo/internal/relay/accounts.ts +45 -9
- package/tempo/internal/relay/feePayer.ts +6 -1
- package/utils/abi/getAbiItem.ts +49 -17
- package/utils/abi/parseEventLogs.ts +32 -11
- package/utils/authorization/serializeAuthorizationList.ts +7 -1
- package/utils/buildRequest.ts +29 -14
- package/utils/data/isHex.ts +18 -1
- package/utils/hash/normalizeSignature.ts +1 -1
- package/utils/hash/toSignature.ts +1 -1
- package/utils/hash/toSignatureHash.ts +1 -1
- package/utils/rpc/http.ts +33 -8
- package/utils/signature/compactSignatureToSignature.ts +4 -2
- package/utils/signature/hashTypedData.ts +1 -2
- package/utils/signature/signatureToCompactSignature.ts +13 -8
- package/utils/siwe/createSiweMessage.ts +1 -1
- package/utils/typedData.ts +11 -8
- package/utils/wait.ts +8 -4
|
@@ -18,9 +18,12 @@ import type { TransactionReceipt } from '../../types/transaction.js'
|
|
|
18
18
|
import type { OneOf } from '../../types/utils.js'
|
|
19
19
|
import { anchorStateRegistryAbi, portal2Abi, portalAbi } from '../abis.js'
|
|
20
20
|
import {
|
|
21
|
+
L2TimestampRequiredError,
|
|
22
|
+
type L2TimestampRequiredErrorType,
|
|
21
23
|
ReceiptContainsNoWithdrawalsError,
|
|
22
24
|
type ReceiptContainsNoWithdrawalsErrorType,
|
|
23
25
|
} from '../errors/withdrawal.js'
|
|
26
|
+
import { isSuperGameType } from '../gameTypes.js'
|
|
24
27
|
import type { TargetChain } from '../types/chain.js'
|
|
25
28
|
import type { GetContractAddressParameter } from '../types/contract.js'
|
|
26
29
|
import {
|
|
@@ -106,6 +109,7 @@ export type GetWithdrawalStatusErrorType =
|
|
|
106
109
|
| GetL2OutputErrorType
|
|
107
110
|
| GetTimeToFinalizeErrorType
|
|
108
111
|
| GetWithdrawalsErrorType
|
|
112
|
+
| L2TimestampRequiredErrorType
|
|
109
113
|
| ReadContractErrorType
|
|
110
114
|
| ReceiptContainsNoWithdrawalsErrorType
|
|
111
115
|
| ErrorType
|
|
@@ -152,6 +156,7 @@ export async function getWithdrawalStatus<
|
|
|
152
156
|
chain = client.chain,
|
|
153
157
|
gameLimit = 100,
|
|
154
158
|
receipt,
|
|
159
|
+
l2Timestamp,
|
|
155
160
|
targetChain: targetChain_,
|
|
156
161
|
logIndex = 0,
|
|
157
162
|
} = parameters
|
|
@@ -165,7 +170,7 @@ export async function getWithdrawalStatus<
|
|
|
165
170
|
})()
|
|
166
171
|
|
|
167
172
|
const l2BlockNumber =
|
|
168
|
-
|
|
173
|
+
l2Timestamp ?? receipt?.blockNumber ?? parameters.l2BlockNumber
|
|
169
174
|
|
|
170
175
|
const withdrawal = (() => {
|
|
171
176
|
if (receipt) {
|
|
@@ -254,17 +259,36 @@ export async function getWithdrawalStatus<
|
|
|
254
259
|
args: [withdrawal.withdrawalHash, numProofSubmitters - 1n],
|
|
255
260
|
}).catch(() => withdrawal.sender)
|
|
256
261
|
|
|
262
|
+
// Super-root games anchor on L2 timestamps instead of L2 block numbers.
|
|
263
|
+
// Not awaited, so a missing L2 timestamp only fails the game lookup and a
|
|
264
|
+
// finalized withdrawal still resolves.
|
|
265
|
+
const gameL2BlockNumber = (async () => {
|
|
266
|
+
if (typeof l2Timestamp === 'bigint') return l2Timestamp
|
|
267
|
+
const gameType = await readContract(client, {
|
|
268
|
+
abi: portal2Abi,
|
|
269
|
+
address: portalAddress,
|
|
270
|
+
functionName: 'respectedGameType',
|
|
271
|
+
})
|
|
272
|
+
if (!isSuperGameType(gameType)) return l2BlockNumber
|
|
273
|
+
const timestamp = receipt?.logs[0]?.blockTimestamp
|
|
274
|
+
if (typeof timestamp !== 'bigint')
|
|
275
|
+
throw new L2TimestampRequiredError({ gameType })
|
|
276
|
+
return timestamp
|
|
277
|
+
})()
|
|
278
|
+
|
|
257
279
|
const [
|
|
258
280
|
disputeGameResult,
|
|
259
281
|
provenWithdrawalsResult,
|
|
260
282
|
checkWithdrawalResult,
|
|
261
283
|
finalizedResult,
|
|
262
284
|
] = await Promise.allSettled([
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
285
|
+
gameL2BlockNumber.then((l2BlockNumber) =>
|
|
286
|
+
getGame(client, {
|
|
287
|
+
...parameters,
|
|
288
|
+
l2BlockNumber,
|
|
289
|
+
limit: gameLimit,
|
|
290
|
+
} as GetGameParameters),
|
|
291
|
+
),
|
|
268
292
|
readContract(client, {
|
|
269
293
|
abi: portal2Abi,
|
|
270
294
|
address: portalAddress,
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import {
|
|
2
|
+
type ReadContractErrorType,
|
|
3
|
+
readContract,
|
|
4
|
+
} from '../../actions/public/readContract.js'
|
|
1
5
|
import type { Client } from '../../clients/createClient.js'
|
|
2
6
|
import type { Transport } from '../../clients/transports/createTransport.js'
|
|
3
7
|
import type { ErrorType } from '../../errors/utils.js'
|
|
@@ -9,7 +13,14 @@ import type {
|
|
|
9
13
|
} from '../../types/chain.js'
|
|
10
14
|
import type { TransactionReceipt } from '../../types/transaction.js'
|
|
11
15
|
import type { OneOf } from '../../types/utils.js'
|
|
12
|
-
import {
|
|
16
|
+
import { portal2Abi } from '../abis.js'
|
|
17
|
+
import {
|
|
18
|
+
L2TimestampRequiredError,
|
|
19
|
+
type L2TimestampRequiredErrorType,
|
|
20
|
+
ReceiptContainsNoWithdrawalsError,
|
|
21
|
+
} from '../errors/withdrawal.js'
|
|
22
|
+
import { isSuperGameType } from '../gameTypes.js'
|
|
23
|
+
import type { TargetChain } from '../types/chain.js'
|
|
13
24
|
import type { GetContractAddressParameter } from '../types/contract.js'
|
|
14
25
|
import type { Withdrawal } from '../types/withdrawal.js'
|
|
15
26
|
import {
|
|
@@ -68,6 +79,8 @@ export type WaitToProveReturnType = {
|
|
|
68
79
|
|
|
69
80
|
export type WaitToProveErrorType =
|
|
70
81
|
| GetWithdrawalsErrorType
|
|
82
|
+
| L2TimestampRequiredErrorType
|
|
83
|
+
| ReadContractErrorType
|
|
71
84
|
| WaitForNextL2OutputErrorType
|
|
72
85
|
| ErrorType
|
|
73
86
|
|
|
@@ -109,7 +122,15 @@ export async function waitToProve<
|
|
|
109
122
|
client: Client<Transport, chain, account>,
|
|
110
123
|
parameters: WaitToProveParameters<chain, chainOverride>,
|
|
111
124
|
): Promise<WaitToProveReturnType> {
|
|
112
|
-
const {
|
|
125
|
+
const {
|
|
126
|
+
chain = client.chain,
|
|
127
|
+
gameLimit,
|
|
128
|
+
l2Timestamp,
|
|
129
|
+
receipt,
|
|
130
|
+
targetChain: targetChain_,
|
|
131
|
+
} = parameters
|
|
132
|
+
|
|
133
|
+
const targetChain = targetChain_ as unknown as TargetChain
|
|
113
134
|
|
|
114
135
|
const [withdrawal] = getWithdrawals(receipt)
|
|
115
136
|
|
|
@@ -144,10 +165,31 @@ export async function waitToProve<
|
|
|
144
165
|
}
|
|
145
166
|
}
|
|
146
167
|
|
|
168
|
+
const portalAddress = (() => {
|
|
169
|
+
if (parameters.portalAddress) return parameters.portalAddress
|
|
170
|
+
if (chain) return targetChain.contracts.portal[chain.id].address
|
|
171
|
+
return Object.values(targetChain.contracts.portal)[0].address
|
|
172
|
+
})()
|
|
173
|
+
|
|
174
|
+
// Super-root games anchor on L2 timestamps instead of L2 block numbers.
|
|
175
|
+
const l2BlockNumber = await (async () => {
|
|
176
|
+
if (typeof l2Timestamp === 'bigint') return l2Timestamp
|
|
177
|
+
const gameType = await readContract(client, {
|
|
178
|
+
abi: portal2Abi,
|
|
179
|
+
address: portalAddress,
|
|
180
|
+
functionName: 'respectedGameType',
|
|
181
|
+
})
|
|
182
|
+
if (!isSuperGameType(gameType)) return receipt.blockNumber
|
|
183
|
+
const timestamp = receipt.logs[0]?.blockTimestamp
|
|
184
|
+
if (typeof timestamp !== 'bigint')
|
|
185
|
+
throw new L2TimestampRequiredError({ gameType })
|
|
186
|
+
return timestamp
|
|
187
|
+
})()
|
|
188
|
+
|
|
147
189
|
const game = await waitForNextGame(client, {
|
|
148
190
|
...parameters,
|
|
149
191
|
limit: gameLimit,
|
|
150
|
-
l2BlockNumber
|
|
192
|
+
l2BlockNumber,
|
|
151
193
|
} as WaitForNextGameParameters)
|
|
152
194
|
return {
|
|
153
195
|
game,
|
|
@@ -22,3 +22,20 @@ export class ReceiptContainsNoWithdrawalsError extends BaseError {
|
|
|
22
22
|
)
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
|
+
|
|
26
|
+
export type L2TimestampRequiredErrorType = L2TimestampRequiredError & {
|
|
27
|
+
name: 'L2TimestampRequiredError'
|
|
28
|
+
}
|
|
29
|
+
export class L2TimestampRequiredError extends BaseError {
|
|
30
|
+
constructor({ gameType }: { gameType: number }) {
|
|
31
|
+
super(
|
|
32
|
+
`Dispute game type ${gameType} anchors on L2 timestamps, so the L2 timestamp of the withdrawal is required.`,
|
|
33
|
+
{
|
|
34
|
+
metaMessages: [
|
|
35
|
+
'Pass `l2Timestamp`, or a receipt whose logs include `blockTimestamp`.',
|
|
36
|
+
],
|
|
37
|
+
name: 'L2TimestampRequiredError',
|
|
38
|
+
},
|
|
39
|
+
)
|
|
40
|
+
}
|
|
41
|
+
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "viem",
|
|
3
3
|
"description": "TypeScript Interface for Ethereum",
|
|
4
|
-
"version": "2.57.
|
|
4
|
+
"version": "2.57.13",
|
|
5
5
|
"main": "./_cjs/index.js",
|
|
6
6
|
"module": "./_esm/index.js",
|
|
7
7
|
"types": "./_types/index.d.ts",
|
|
@@ -229,7 +229,7 @@
|
|
|
229
229
|
"@scure/bip39": "1.6.0",
|
|
230
230
|
"abitype": "1.2.3",
|
|
231
231
|
"isows": "1.0.7",
|
|
232
|
-
"ox": "0.14.
|
|
232
|
+
"ox": "0.14.59",
|
|
233
233
|
"ws": "8.21.0"
|
|
234
234
|
},
|
|
235
235
|
"license": "MIT",
|
package/tempo/Account.ts
CHANGED
|
@@ -24,7 +24,6 @@ import { keccak256 } from '../utils/hash/keccak256.js'
|
|
|
24
24
|
import { hashMessage } from '../utils/signature/hashMessage.js'
|
|
25
25
|
import { hashTypedData } from '../utils/signature/hashTypedData.js'
|
|
26
26
|
import type { SerializeTransactionFn } from '../utils/transaction/serializeTransaction.js'
|
|
27
|
-
import { configurableAccountRecoveryFactory } from './Addresses.js'
|
|
28
27
|
import { parseApproval } from './accounts/Signature.js'
|
|
29
28
|
import type { KeyAuthorizationManager } from './KeyAuthorizationManager.js'
|
|
30
29
|
import * as Transaction from './Transaction.js'
|
|
@@ -295,6 +294,14 @@ export declare namespace fromSecp256k1 {
|
|
|
295
294
|
* Normalizes supplied config fields with `AccountConfig.from`, so callers do
|
|
296
295
|
* not need to normalize owner ordering themselves.
|
|
297
296
|
*
|
|
297
|
+
* `sign`, `signMessage`, and `signTypedData` return a configurable signature
|
|
298
|
+
* envelope with local owner approvals up to the config threshold. Signatures
|
|
299
|
+
* verify against the account's current config, so a config update invalidates
|
|
300
|
+
* earlier signatures. Verify them with `verifyHash`, `verifyMessage`, or
|
|
301
|
+
* `verifyTypedData` on a Tempo client, which use the signature verifier
|
|
302
|
+
* precompile. Configurable accounts have no code and do not implement ERC-1271
|
|
303
|
+
* `isValidSignature`, so ERC-1271 verifiers do not accept their signatures.
|
|
304
|
+
*
|
|
298
305
|
* @example
|
|
299
306
|
* ```ts
|
|
300
307
|
* import { Account } from 'viem/tempo'
|
|
@@ -331,11 +338,7 @@ export function fromConfig(value: fromConfig.Parameters): ConfigurableAccount {
|
|
|
331
338
|
const configInput = (() => {
|
|
332
339
|
if (typeof value === 'string') return undefined
|
|
333
340
|
if ('upgrade' in value) return value.upgrade
|
|
334
|
-
const {
|
|
335
|
-
address: _,
|
|
336
|
-
factory: __,
|
|
337
|
-
...config
|
|
338
|
-
} = value as fromConfig.InitialConfig
|
|
341
|
+
const { address: _, ...config } = value as fromConfig.InitialConfig
|
|
339
342
|
return config
|
|
340
343
|
})()
|
|
341
344
|
const config = (() => {
|
|
@@ -371,9 +374,7 @@ export function fromConfig(value: fromConfig.Parameters): ConfigurableAccount {
|
|
|
371
374
|
(() => {
|
|
372
375
|
if (typeof value === 'string') return value
|
|
373
376
|
if (value.address === undefined || value.address === 'infer')
|
|
374
|
-
return AccountConfig.getAddress(config
|
|
375
|
-
factory: value.factory ?? configurableAccountRecoveryFactory,
|
|
376
|
-
})
|
|
377
|
+
return AccountConfig.getAddress(config!)
|
|
377
378
|
return value.address
|
|
378
379
|
})(),
|
|
379
380
|
)
|
|
@@ -413,10 +414,8 @@ export function fromConfig(value: fromConfig.Parameters): ConfigurableAccount {
|
|
|
413
414
|
await signConfigurable(account, { payload: hash }),
|
|
414
415
|
)
|
|
415
416
|
},
|
|
416
|
-
async signMessage() {
|
|
417
|
-
|
|
418
|
-
'`signMessage` is not supported for configurable accounts.',
|
|
419
|
-
)
|
|
417
|
+
async signMessage({ message }) {
|
|
418
|
+
return await account.sign({ hash: hashMessage(message) })
|
|
420
419
|
},
|
|
421
420
|
async signTransaction(transaction, options) {
|
|
422
421
|
const { serializer = Transaction.serialize } = options ?? {}
|
|
@@ -463,10 +462,8 @@ export function fromConfig(value: fromConfig.Parameters): ConfigurableAccount {
|
|
|
463
462
|
signature as never,
|
|
464
463
|
)) as Hex.Hex
|
|
465
464
|
},
|
|
466
|
-
async signTypedData() {
|
|
467
|
-
|
|
468
|
-
'`signTypedData` is not supported for configurable accounts.',
|
|
469
|
-
)
|
|
465
|
+
async signTypedData(typedData) {
|
|
466
|
+
return await account.sign({ hash: hashTypedData(typedData) })
|
|
470
467
|
},
|
|
471
468
|
}
|
|
472
469
|
return account
|
|
@@ -494,11 +491,6 @@ export declare namespace fromConfig {
|
|
|
494
491
|
export type InitialConfig = {
|
|
495
492
|
/** Derives the stable account address from this initial config. */
|
|
496
493
|
address?: 'infer' | undefined
|
|
497
|
-
/**
|
|
498
|
-
* Recovery factory used to derive the address.
|
|
499
|
-
* @default `Addresses.configurableAccountRecoveryFactory`
|
|
500
|
-
*/
|
|
501
|
-
factory?: Address.Address | undefined
|
|
502
494
|
/** Weighted owners. */
|
|
503
495
|
owners: readonly Owner[]
|
|
504
496
|
/** Caller-chosen 32-byte salt. */
|
|
@@ -540,6 +532,12 @@ export declare namespace fromConfig {
|
|
|
540
532
|
}
|
|
541
533
|
}
|
|
542
534
|
|
|
535
|
+
/**
|
|
536
|
+
* Configurable account (TIP-1107) returned by {@link fromConfig}.
|
|
537
|
+
*
|
|
538
|
+
* Its signatures verify against the account's current config through Tempo's
|
|
539
|
+
* `verifyHash`, not ERC-1271, and a config update invalidates earlier signatures.
|
|
540
|
+
*/
|
|
543
541
|
export type ConfigurableAccount<
|
|
544
542
|
config extends AccountConfig.Config | undefined =
|
|
545
543
|
| AccountConfig.Config
|
package/tempo/Addresses.ts
CHANGED
|
@@ -13,9 +13,6 @@ export const accountKeychain = '0xaAAAaaAA00000000000000000000000000000000'
|
|
|
13
13
|
export const accountRegistrar = '0x7702ac0000000000000000000000000000000000'
|
|
14
14
|
export const addressRegistry = '0xfdc0000000000000000000000000000000000000'
|
|
15
15
|
export const configurableAccount = '0xAACC000000000000000000000000000000000000'
|
|
16
|
-
/** Default configurable account recovery factory. Temporary until the production address is finalized. */
|
|
17
|
-
export const configurableAccountRecoveryFactory =
|
|
18
|
-
'0x7171717171717171717171717171717171717171'
|
|
19
16
|
/** Current consensus committee precompile address, used with `Abis.currentCommittee` to read committee members. */
|
|
20
17
|
export const currentCommittee = '0xC077e00000000000000000000000000000000000'
|
|
21
18
|
export const feeManager = '0xfeec000000000000000000000000000000000000'
|
package/tempo/Formatters.ts
CHANGED
|
@@ -9,6 +9,9 @@ import {
|
|
|
9
9
|
} from 'ox/tempo'
|
|
10
10
|
import type { Account as viem_Account } from '../accounts/types.js'
|
|
11
11
|
import { parseAccount } from '../accounts/utils/parseAccount.js'
|
|
12
|
+
import type { Block } from '../types/block.js'
|
|
13
|
+
import type { RpcBlock } from '../types/rpc.js'
|
|
14
|
+
import { formatBlock as viem_formatBlock } from '../utils/formatters/block.js'
|
|
12
15
|
import { formatTransaction as viem_formatTransaction } from '../utils/formatters/transaction.js'
|
|
13
16
|
import { formatTransactionReceipt as viem_formatTransactionReceipt } from '../utils/formatters/transactionReceipt.js'
|
|
14
17
|
import { formatTransactionRequest as viem_formatTransactionRequest } from '../utils/formatters/transactionRequest.js'
|
|
@@ -23,6 +26,18 @@ import {
|
|
|
23
26
|
type TransactionRpc,
|
|
24
27
|
} from './Transaction.js'
|
|
25
28
|
|
|
29
|
+
export function formatBlock(block: RpcBlock): Block {
|
|
30
|
+
const { transactions = [], ...rest } = block
|
|
31
|
+
return {
|
|
32
|
+
...viem_formatBlock({ ...rest, transactions: [] }),
|
|
33
|
+
transactions: transactions.map((transaction) =>
|
|
34
|
+
typeof transaction === 'string'
|
|
35
|
+
? transaction
|
|
36
|
+
: formatTransaction(transaction as never),
|
|
37
|
+
),
|
|
38
|
+
} as never
|
|
39
|
+
}
|
|
40
|
+
|
|
26
41
|
export function formatTransaction(
|
|
27
42
|
transaction: TransactionRpc,
|
|
28
43
|
): Transaction<bigint, number, boolean> {
|
|
@@ -34,12 +49,9 @@ export function formatTransaction(
|
|
|
34
49
|
? undefined
|
|
35
50
|
: BigInt(transaction.blockTimestamp)
|
|
36
51
|
const operation = transaction.operation
|
|
37
|
-
const {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
nonce,
|
|
41
|
-
...tx
|
|
42
|
-
} = ox_Transaction.fromRpc(transaction as never) as ox_Transaction.Tempo
|
|
52
|
+
const { feePayerSignature, nonce, ...tx } = ox_Transaction.fromRpc(
|
|
53
|
+
transaction as never,
|
|
54
|
+
) as ox_Transaction.Tempo
|
|
43
55
|
|
|
44
56
|
return {
|
|
45
57
|
...tx,
|
|
@@ -53,7 +65,7 @@ export function formatTransaction(
|
|
|
53
65
|
yParity: feePayerSignature.yParity,
|
|
54
66
|
}
|
|
55
67
|
: undefined,
|
|
56
|
-
nonce:
|
|
68
|
+
nonce: nonce ?? 0n,
|
|
57
69
|
operation: formatOperation(operation),
|
|
58
70
|
typeHex:
|
|
59
71
|
ox_Transaction.toRpcType[
|
package/tempo/Relay.ts
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import type { Address } from 'abitype'
|
|
2
|
+
import type * as Hex from 'ox/Hex'
|
|
2
3
|
import * as RpcResponse from 'ox/RpcResponse'
|
|
4
|
+
import type { AccountConfig } from 'ox/tempo'
|
|
3
5
|
import type { LocalAccount } from '../accounts/types.js'
|
|
4
6
|
import type { Client as Client_ } from '../clients/createClient.js'
|
|
5
7
|
import { ChainNotConfiguredError } from '../clients/createClientResolver.js'
|
|
6
8
|
import type { EIP1193RequestOptions } from '../types/eip1193.js'
|
|
9
|
+
import type { MaybePromise } from '../types/utils.js'
|
|
7
10
|
import * as Accounts from './internal/relay/accounts.js'
|
|
8
11
|
import * as Sponsorship from './internal/relay/feePayer.js'
|
|
9
12
|
import * as FeeToken from './internal/relay/feeToken.js'
|
|
@@ -342,9 +345,32 @@ export function accounts(options: accounts.Options): accounts.ReturnType {
|
|
|
342
345
|
export declare namespace accounts {
|
|
343
346
|
/** Configurable account options. */
|
|
344
347
|
export type Options = {
|
|
348
|
+
/**
|
|
349
|
+
* Resolves a config that `store` does not hold, such as from an indexer of
|
|
350
|
+
* `ConfigurableAccountConfigUpdated` events. The plugin stores and returns
|
|
351
|
+
* a resolved config only when it matches the account and commitment.
|
|
352
|
+
*/
|
|
353
|
+
resolveConfig?:
|
|
354
|
+
| ((
|
|
355
|
+
options: resolveConfig.Options,
|
|
356
|
+
) => MaybePromise<AccountConfig.Config | null | undefined>)
|
|
357
|
+
| undefined
|
|
345
358
|
/** Store shared by relays, with atomic compare-and-set support. */
|
|
346
359
|
store: Store.Atomic
|
|
347
360
|
}
|
|
361
|
+
|
|
362
|
+
export namespace resolveConfig {
|
|
363
|
+
/** Lookup that `resolveConfig` receives. */
|
|
364
|
+
export type Options = {
|
|
365
|
+
/** Configurable account address. */
|
|
366
|
+
address: Address
|
|
367
|
+
/** Chain whose commitment the config must match. */
|
|
368
|
+
chainId: number
|
|
369
|
+
/** Config commitment read from the chain. */
|
|
370
|
+
commitment: Hex.Hex
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
|
|
348
374
|
/** Middleware advertising configurable account support. */
|
|
349
375
|
export type ReturnType = Plugin & { readonly [accountsBrand]: true }
|
|
350
376
|
}
|
package/tempo/Transaction.ts
CHANGED
|
@@ -72,7 +72,10 @@ export type TransactionTempo<
|
|
|
72
72
|
isPending extends boolean = boolean,
|
|
73
73
|
type = 'tempo',
|
|
74
74
|
> = PartialBy<
|
|
75
|
-
Omit<
|
|
75
|
+
Omit<
|
|
76
|
+
TransactionBase<quantity, index, isPending>,
|
|
77
|
+
'input' | 'nonce' | 'value' | 'to'
|
|
78
|
+
>,
|
|
76
79
|
'r' | 's' | 'v' | 'yParity'
|
|
77
80
|
> & {
|
|
78
81
|
accessList: AccessList
|
|
@@ -83,12 +86,17 @@ export type TransactionTempo<
|
|
|
83
86
|
feePayerSignature?: viem_Signature | undefined
|
|
84
87
|
keyAuthorization?: KeyAuthorization.Signed<quantity, index> | null | undefined
|
|
85
88
|
operation?: AccountOperation.TransactionOperation | undefined
|
|
89
|
+
/** Sequence number, or for expiring nonce transactions (TIP-1106) an opaque `uint64` discriminator, often above `Number.MAX_SAFE_INTEGER`. */
|
|
90
|
+
nonce: quantity
|
|
86
91
|
nonceKey?: quantity | undefined
|
|
87
92
|
signature: SignatureEnvelope.SignatureEnvelope
|
|
88
93
|
type: type
|
|
89
94
|
validBefore?: index | undefined
|
|
90
95
|
validAfter?: index | undefined
|
|
91
|
-
} & FeeValuesEIP1559<quantity>
|
|
96
|
+
} & Omit<FeeValuesEIP1559<quantity>, 'gasPrice'> & {
|
|
97
|
+
/** Effective gas price the transaction paid, once included. */
|
|
98
|
+
gasPrice?: quantity | undefined
|
|
99
|
+
}
|
|
92
100
|
|
|
93
101
|
export type TransactionRequest<
|
|
94
102
|
bigintType = bigint,
|
package/tempo/accounts/Config.ts
CHANGED
|
@@ -4,7 +4,6 @@ import type * as Hex from 'ox/Hex'
|
|
|
4
4
|
import * as Json from 'ox/Json'
|
|
5
5
|
import { AccountConfig } from 'ox/tempo'
|
|
6
6
|
import { BaseError } from '../../errors/base.js'
|
|
7
|
-
import { configurableAccountRecoveryFactory } from '../Addresses.js'
|
|
8
7
|
import type * as Store from '../Store.js'
|
|
9
8
|
|
|
10
9
|
/** A valid 48-owner config is much smaller; 64 KiB bounds hostile store parsing work. */
|
|
@@ -18,8 +17,8 @@ export async function read(
|
|
|
18
17
|
store: Store.Store,
|
|
19
18
|
options: read.Options,
|
|
20
19
|
): Promise<AccountConfig.Config | null> {
|
|
21
|
-
const { address, commitment } = options
|
|
22
|
-
const value = await store.getItem(key({ address, commitment }))
|
|
20
|
+
const { address, chainId, commitment } = options
|
|
21
|
+
const value = await store.getItem(key({ address, chainId, commitment }))
|
|
23
22
|
if (value === null || value === undefined) return null
|
|
24
23
|
const config = deserialize(value)
|
|
25
24
|
assertKey({ address, commitment, config })
|
|
@@ -31,25 +30,43 @@ export declare namespace read {
|
|
|
31
30
|
export type Options = {
|
|
32
31
|
/** Configurable account address. */
|
|
33
32
|
address: Address.Address
|
|
33
|
+
/** Chain whose commitment selects the config. */
|
|
34
|
+
chainId: number
|
|
34
35
|
/** Config commitment observed onchain. */
|
|
35
36
|
commitment: Hex.Hex
|
|
36
37
|
}
|
|
37
38
|
}
|
|
38
39
|
|
|
39
|
-
/**
|
|
40
|
+
/**
|
|
41
|
+
* Writes a validated account config.
|
|
42
|
+
*
|
|
43
|
+
* Each key fixes one config, through its commitment or, before initialization, the account
|
|
44
|
+
* address. An existing key therefore holds the same config and is not written again.
|
|
45
|
+
*/
|
|
40
46
|
export async function write(
|
|
41
|
-
store: Store.
|
|
47
|
+
store: Store.Atomic,
|
|
42
48
|
options: write.Options,
|
|
43
49
|
): Promise<void> {
|
|
44
|
-
const { address, commitment } = options
|
|
45
|
-
const config =
|
|
50
|
+
const { address, chainId, commitment } = options
|
|
51
|
+
const config = (() => {
|
|
52
|
+
try {
|
|
53
|
+
return AccountConfig.from(options.config)
|
|
54
|
+
} catch (cause) {
|
|
55
|
+
throw new InvalidStoreValueError({ cause })
|
|
56
|
+
}
|
|
57
|
+
})()
|
|
46
58
|
assertKey({ address, commitment, config })
|
|
47
59
|
const value = serialize(config)
|
|
48
|
-
await store.
|
|
60
|
+
await store.compareAndSet(key({ address, chainId, commitment }), null, value)
|
|
49
61
|
// Initialization commits the version-zero config without changing its version.
|
|
50
62
|
if (commitment.toLowerCase() === zeroCommitment)
|
|
51
|
-
await store.
|
|
52
|
-
key({
|
|
63
|
+
await store.compareAndSet(
|
|
64
|
+
key({
|
|
65
|
+
address,
|
|
66
|
+
chainId,
|
|
67
|
+
commitment: AccountConfig.getCommitment(config),
|
|
68
|
+
}),
|
|
69
|
+
null,
|
|
53
70
|
value,
|
|
54
71
|
)
|
|
55
72
|
}
|
|
@@ -59,6 +76,8 @@ export declare namespace write {
|
|
|
59
76
|
export type Options = {
|
|
60
77
|
/** Configurable account address. */
|
|
61
78
|
address: Address.Address
|
|
79
|
+
/** Chain whose commitment selects the config. */
|
|
80
|
+
chainId: number
|
|
62
81
|
/** Config commitment used for lookup. */
|
|
63
82
|
commitment: Hex.Hex
|
|
64
83
|
/** Complete config. */
|
|
@@ -76,14 +95,7 @@ function assertKey(options: {
|
|
|
76
95
|
if (!Address.validate(address) || !Hash.validate(commitment))
|
|
77
96
|
throw new InvalidStoreValueError()
|
|
78
97
|
if (config.version === 0n) {
|
|
79
|
-
if (
|
|
80
|
-
!Address.isEqual(
|
|
81
|
-
AccountConfig.getAddress(config, {
|
|
82
|
-
factory: configurableAccountRecoveryFactory,
|
|
83
|
-
}),
|
|
84
|
-
address,
|
|
85
|
-
)
|
|
86
|
-
)
|
|
98
|
+
if (!Address.isEqual(AccountConfig.getAddress(config), address))
|
|
87
99
|
throw new InvalidStoreValueError()
|
|
88
100
|
if (commitment.toLowerCase() === zeroCommitment) return
|
|
89
101
|
}
|
|
@@ -105,10 +117,14 @@ function deserialize(value: string): AccountConfig.Config {
|
|
|
105
117
|
}
|
|
106
118
|
}
|
|
107
119
|
|
|
108
|
-
/** Returns the store key for an account and config commitment. */
|
|
109
|
-
function key(options: {
|
|
110
|
-
|
|
111
|
-
|
|
120
|
+
/** Returns the store key for an account and config commitment on one chain. */
|
|
121
|
+
function key(options: {
|
|
122
|
+
address: Address.Address
|
|
123
|
+
chainId: number
|
|
124
|
+
commitment: Hex.Hex
|
|
125
|
+
}) {
|
|
126
|
+
const { address, chainId, commitment } = options
|
|
127
|
+
return `configurableAccount:config:${chainId}:${address.toLowerCase()}:${commitment.toLowerCase()}`
|
|
112
128
|
}
|
|
113
129
|
|
|
114
130
|
/** Serializes an account config for storage. */
|
|
@@ -124,8 +140,7 @@ function serialize(config: AccountConfig.Config): string {
|
|
|
124
140
|
}
|
|
125
141
|
|
|
126
142
|
/** Thrown when a stored account config is malformed or mismatched. */
|
|
127
|
-
|
|
128
|
-
class InvalidStoreValueError extends BaseError {
|
|
143
|
+
export class InvalidStoreValueError extends BaseError {
|
|
129
144
|
/** Creates an invalid store value error. */
|
|
130
145
|
constructor(options: InvalidStoreValueError.Options = {}) {
|
|
131
146
|
super('Stored account config is malformed or mismatched.', {
|
|
@@ -135,7 +150,7 @@ class InvalidStoreValueError extends BaseError {
|
|
|
135
150
|
}
|
|
136
151
|
}
|
|
137
152
|
|
|
138
|
-
declare namespace InvalidStoreValueError {
|
|
153
|
+
export declare namespace InvalidStoreValueError {
|
|
139
154
|
/** Error construction options. */
|
|
140
155
|
export type Options = {
|
|
141
156
|
/** Underlying error. */
|
|
@@ -28,8 +28,8 @@ import type * as Transaction from '../Transaction.js'
|
|
|
28
28
|
* Derives a configurable account address from an initial config with the
|
|
29
29
|
* configurable account precompile.
|
|
30
30
|
*
|
|
31
|
-
* The precompile validates the config and derives the address
|
|
32
|
-
*
|
|
31
|
+
* The precompile validates the config and derives the address from its hash.
|
|
32
|
+
* To derive the address locally, use
|
|
33
33
|
* `AccountConfig.getAddress` or `Account.fromConfig({ address: 'infer' })`.
|
|
34
34
|
*
|
|
35
35
|
* @example
|
package/tempo/chainConfig.ts
CHANGED
|
@@ -15,6 +15,7 @@ import { maxUint256 } from '../constants/number.js'
|
|
|
15
15
|
import { BaseError } from '../errors/base.js'
|
|
16
16
|
import { ContractFunctionRevertedError } from '../errors/contract.js'
|
|
17
17
|
import type { Chain, ChainConfig as viem_ChainConfig } from '../types/chain.js'
|
|
18
|
+
import type { RpcBlock } from '../types/rpc.js'
|
|
18
19
|
import { isAddressEqual } from '../utils/address/isAddressEqual.js'
|
|
19
20
|
import { extendSchema } from '../utils/chain/defineChain.js'
|
|
20
21
|
import { defineTransaction } from '../utils/formatters/transaction.js'
|
|
@@ -41,6 +42,8 @@ const maxExpirySecs = 25
|
|
|
41
42
|
const serializeTransaction = ((transaction, signature) =>
|
|
42
43
|
Transaction.serialize(transaction, signature)) as SerializeTransactionFn
|
|
43
44
|
|
|
45
|
+
// The base formatters decode nonces as safe integers and throw on Tempo expiring nonces (random
|
|
46
|
+
// u64 values), so Tempo formats every transaction itself, including those inside blocks.
|
|
44
47
|
export const chainConfig = {
|
|
45
48
|
blockTime: 1_000,
|
|
46
49
|
extendSchema: extendSchema<{
|
|
@@ -48,10 +51,18 @@ export const chainConfig = {
|
|
|
48
51
|
hardfork?: Hardfork | undefined
|
|
49
52
|
}>(),
|
|
50
53
|
formatters: {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}
|
|
54
|
+
block: {
|
|
55
|
+
format: (block: RpcBlock) => Formatters.formatBlock(block),
|
|
56
|
+
type: 'block' as const,
|
|
57
|
+
},
|
|
58
|
+
transaction: {
|
|
59
|
+
...defineTransaction({
|
|
60
|
+
exclude: ['aaAuthorizationList' as never],
|
|
61
|
+
format: Formatters.formatTransaction,
|
|
62
|
+
}),
|
|
63
|
+
format: (transaction: Transaction.TransactionRpc) =>
|
|
64
|
+
Formatters.formatTransaction(transaction),
|
|
65
|
+
},
|
|
55
66
|
transactionReceipt: defineTransactionReceipt({
|
|
56
67
|
format: Formatters.formatTransactionReceipt,
|
|
57
68
|
}),
|