viem 3.0.0-next.10 → 3.0.0-next.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/dist/chains/definitions/arc.d.ts +15 -1
- package/dist/chains/definitions/arc.d.ts.map +1 -1
- package/dist/chains/definitions/arc.js +19 -1
- package/dist/chains/definitions/arc.js.map +1 -1
- package/dist/chains/definitions/berachainBepolia.d.ts +1 -1
- package/dist/chains/definitions/berachainBepolia.js +1 -1
- package/dist/chains/definitions/blockdag.d.ts +18 -0
- package/dist/chains/definitions/blockdag.d.ts.map +1 -0
- package/dist/chains/definitions/blockdag.js +18 -0
- package/dist/chains/definitions/blockdag.js.map +1 -0
- package/dist/chains/definitions/candyChain.d.ts +27 -0
- package/dist/chains/definitions/candyChain.d.ts.map +1 -0
- package/dist/chains/definitions/candyChain.js +26 -0
- package/dist/chains/definitions/candyChain.js.map +1 -0
- package/dist/chains/definitions/creditCoin3Devnet.d.ts +6 -0
- package/dist/chains/definitions/creditCoin3Devnet.d.ts.map +1 -1
- package/dist/chains/definitions/creditCoin3Devnet.js +6 -0
- package/dist/chains/definitions/creditCoin3Devnet.js.map +1 -1
- package/dist/chains/definitions/creditCoin3Mainnet.d.ts +5 -1
- package/dist/chains/definitions/creditCoin3Mainnet.d.ts.map +1 -1
- package/dist/chains/definitions/creditCoin3Mainnet.js +4 -0
- package/dist/chains/definitions/creditCoin3Mainnet.js.map +1 -1
- package/dist/chains/definitions/creditCoin3Testnet.d.ts +5 -1
- package/dist/chains/definitions/creditCoin3Testnet.d.ts.map +1 -1
- package/dist/chains/definitions/creditCoin3Testnet.js +4 -0
- package/dist/chains/definitions/creditCoin3Testnet.js.map +1 -1
- package/dist/chains/definitions/crymad.d.ts +25 -0
- package/dist/chains/definitions/crymad.d.ts.map +1 -0
- package/dist/chains/definitions/crymad.js +23 -0
- package/dist/chains/definitions/crymad.js.map +1 -0
- package/dist/chains/definitions/crymadL2.d.ts +26 -0
- package/dist/chains/definitions/crymadL2.d.ts.map +1 -0
- package/dist/chains/definitions/crymadL2.js +24 -0
- package/dist/chains/definitions/crymadL2.js.map +1 -0
- package/dist/chains/definitions/eCanna.d.ts +18 -0
- package/dist/chains/definitions/eCanna.d.ts.map +1 -0
- package/dist/chains/definitions/eCanna.js +18 -0
- package/dist/chains/definitions/eCanna.js.map +1 -0
- package/dist/chains/definitions/eCannaTestnet.d.ts +19 -0
- package/dist/chains/definitions/eCannaTestnet.d.ts.map +1 -0
- package/dist/chains/definitions/eCannaTestnet.js +19 -0
- package/dist/chains/definitions/eCannaTestnet.js.map +1 -0
- package/dist/chains/definitions/hausTestnet.d.ts +20 -0
- package/dist/chains/definitions/hausTestnet.d.ts.map +1 -0
- package/dist/chains/definitions/hausTestnet.js +18 -0
- package/dist/chains/definitions/hausTestnet.js.map +1 -0
- package/dist/chains/definitions/hyveChain.d.ts +26 -0
- package/dist/chains/definitions/hyveChain.d.ts.map +1 -0
- package/dist/chains/definitions/hyveChain.js +22 -0
- package/dist/chains/definitions/hyveChain.js.map +1 -0
- package/dist/chains/definitions/kortana.d.ts +18 -0
- package/dist/chains/definitions/kortana.d.ts.map +1 -0
- package/dist/chains/definitions/kortana.js +16 -0
- package/dist/chains/definitions/kortana.js.map +1 -0
- package/dist/chains/definitions/morphTachyon.d.ts +18 -0
- package/dist/chains/definitions/morphTachyon.d.ts.map +1 -0
- package/dist/chains/definitions/morphTachyon.js +16 -0
- package/dist/chains/definitions/morphTachyon.js.map +1 -0
- package/dist/chains/definitions/morphTachyonTestnet.d.ts +19 -0
- package/dist/chains/definitions/morphTachyonTestnet.d.ts.map +1 -0
- package/dist/chains/definitions/morphTachyonTestnet.js +17 -0
- package/dist/chains/definitions/morphTachyonTestnet.js.map +1 -0
- package/dist/chains/definitions/rabbitChainTestnet.d.ts +19 -0
- package/dist/chains/definitions/rabbitChainTestnet.d.ts.map +1 -0
- package/dist/chains/definitions/rabbitChainTestnet.js +19 -0
- package/dist/chains/definitions/rabbitChainTestnet.js.map +1 -0
- package/dist/chains/definitions/robinhood.d.ts +2 -1
- package/dist/chains/definitions/robinhood.d.ts.map +1 -1
- package/dist/chains/definitions/robinhood.js +6 -2
- package/dist/chains/definitions/robinhood.js.map +1 -1
- package/dist/chains/definitions/tempo.d.ts +11 -3
- package/dist/chains/definitions/tempo.d.ts.map +1 -1
- package/dist/chains/definitions/tempo.js +10 -0
- package/dist/chains/definitions/tempo.js.map +1 -1
- package/dist/chains/definitions/tempoModerato.d.ts +11 -3
- package/dist/chains/definitions/tempoModerato.d.ts.map +1 -1
- package/dist/chains/definitions/tempoModerato.js +10 -0
- package/dist/chains/definitions/tempoModerato.js.map +1 -1
- package/dist/chains/definitions/whitechainSepolia.d.ts +54 -2
- package/dist/chains/definitions/whitechainSepolia.d.ts.map +1 -1
- package/dist/chains/definitions/whitechainSepolia.js +27 -3
- package/dist/chains/definitions/whitechainSepolia.js.map +1 -1
- package/dist/chains/definitions/xgrTestnet.d.ts +19 -0
- package/dist/chains/definitions/xgrTestnet.d.ts.map +1 -0
- package/dist/chains/definitions/xgrTestnet.js +19 -0
- package/dist/chains/definitions/xgrTestnet.js.map +1 -0
- package/dist/chains/definitions/ynxTestnet.d.ts +19 -0
- package/dist/chains/definitions/ynxTestnet.d.ts.map +1 -0
- package/dist/chains/definitions/ynxTestnet.js +17 -0
- package/dist/chains/definitions/ynxTestnet.js.map +1 -0
- package/dist/chains/definitions/zagros.d.ts +26 -0
- package/dist/chains/definitions/zagros.d.ts.map +1 -0
- package/dist/chains/definitions/zagros.js +26 -0
- package/dist/chains/definitions/zagros.js.map +1 -0
- package/dist/chains/index.d.ts +16 -0
- package/dist/chains/index.d.ts.map +1 -1
- package/dist/chains/index.js +15 -0
- package/dist/chains/index.js.map +1 -1
- package/dist/core/actions/address/getStorageValues.d.ts +30 -0
- package/dist/core/actions/address/getStorageValues.d.ts.map +1 -0
- package/dist/core/actions/address/getStorageValues.js +29 -0
- package/dist/core/actions/address/getStorageValues.js.map +1 -0
- package/dist/core/actions/address/index.d.ts +1 -0
- package/dist/core/actions/address/index.d.ts.map +1 -1
- package/dist/core/actions/address/index.js +1 -0
- package/dist/core/actions/address/index.js.map +1 -1
- package/dist/core/actions/block/simulate.d.ts +2 -0
- package/dist/core/actions/block/simulate.d.ts.map +1 -1
- package/dist/core/actions/block/simulate.js +3 -0
- package/dist/core/actions/block/simulate.js.map +1 -1
- package/dist/core/actions/multicall.d.ts.map +1 -1
- package/dist/core/actions/multicall.js +7 -1
- package/dist/core/actions/multicall.js.map +1 -1
- package/dist/core/actions/siwe/verify.d.ts.map +1 -1
- package/dist/core/actions/siwe/verify.js +2 -1
- package/dist/core/actions/siwe/verify.js.map +1 -1
- package/dist/core/actions/transaction/Errors.d.ts +1 -0
- package/dist/core/actions/transaction/Errors.d.ts.map +1 -1
- package/dist/core/actions/transaction/Errors.js +1 -0
- package/dist/core/actions/transaction/Errors.js.map +1 -1
- package/dist/core/actions/transaction/fill.d.ts +10 -1
- package/dist/core/actions/transaction/fill.d.ts.map +1 -1
- package/dist/core/actions/transaction/fill.js +71 -38
- package/dist/core/actions/transaction/fill.js.map +1 -1
- package/dist/core/actions/transaction/prepare.d.ts.map +1 -1
- package/dist/core/actions/transaction/prepare.js +4 -1
- package/dist/core/actions/transaction/prepare.js.map +1 -1
- package/dist/core/actions/transaction/sign.d.ts.map +1 -1
- package/dist/core/actions/transaction/sign.js +3 -1
- package/dist/core/actions/transaction/sign.js.map +1 -1
- package/dist/core/actions/wallet/sendCalls.d.ts.map +1 -1
- package/dist/core/actions/wallet/sendCalls.js +1 -0
- package/dist/core/actions/wallet/sendCalls.js.map +1 -1
- package/dist/core/internal/transport.js +1 -1
- package/dist/core/internal/transport.js.map +1 -1
- package/dist/erc4337/actions/userOperation/get.d.ts.map +1 -1
- package/dist/erc4337/actions/userOperation/get.js +3 -1
- package/dist/erc4337/actions/userOperation/get.js.map +1 -1
- package/dist/erc4337/actions/userOperation/waitForReceipt.js +1 -1
- package/dist/erc4337/actions/userOperation/waitForReceipt.js.map +1 -1
- package/dist/internal/inference.d.ts +24 -0
- package/dist/internal/inference.d.ts.map +1 -1
- package/dist/node/transports/ipc.d.ts.map +1 -1
- package/dist/node/transports/ipc.js +20 -2
- package/dist/node/transports/ipc.js.map +1 -1
- package/dist/op-stack/actions/l1/getGame.js +1 -1
- package/dist/op-stack/actions/l1/getGame.js.map +1 -1
- package/dist/op-stack/actions/l1/getGames.js +1 -1
- package/dist/op-stack/actions/l1/getGames.js.map +1 -1
- package/dist/op-stack/actions/l1/getTimeToNextGame.js +1 -1
- package/dist/op-stack/actions/l1/getTimeToNextGame.js.map +1 -1
- package/dist/op-stack/actions/l1/getTimeToNextL2Output.js +1 -1
- package/dist/op-stack/actions/l1/getTimeToNextL2Output.js.map +1 -1
- package/dist/tempo/Abis.d.ts +36662 -5677
- package/dist/tempo/Abis.d.ts.map +1 -1
- package/dist/tempo/Abis.js +5626 -1536
- package/dist/tempo/Abis.js.map +1 -1
- package/dist/tempo/Account.d.ts +86 -29
- package/dist/tempo/Account.d.ts.map +1 -1
- package/dist/tempo/Account.js +204 -70
- package/dist/tempo/Account.js.map +1 -1
- package/dist/tempo/Addresses.d.ts +16 -1
- package/dist/tempo/Addresses.d.ts.map +1 -1
- package/dist/tempo/Addresses.js +41 -1
- package/dist/tempo/Addresses.js.map +1 -1
- package/dist/tempo/Capabilities.d.ts +7 -13
- package/dist/tempo/Capabilities.d.ts.map +1 -1
- package/dist/tempo/Client.d.ts.map +1 -1
- package/dist/tempo/Client.js +1 -1
- package/dist/tempo/Client.js.map +1 -1
- package/dist/tempo/Decorator.d.ts +226 -7
- package/dist/tempo/Decorator.d.ts.map +1 -1
- package/dist/tempo/Decorator.js +27 -5
- package/dist/tempo/Decorator.js.map +1 -1
- package/dist/tempo/ExecutionError.d.ts +81 -0
- package/dist/tempo/ExecutionError.d.ts.map +1 -0
- package/dist/tempo/ExecutionError.js +309 -0
- package/dist/tempo/ExecutionError.js.map +1 -0
- package/dist/tempo/Relay.d.ts +303 -0
- package/dist/tempo/Relay.d.ts.map +1 -0
- package/dist/tempo/Relay.js +170 -0
- package/dist/tempo/Relay.js.map +1 -0
- package/dist/tempo/Selectors.d.ts +219 -66
- package/dist/tempo/Selectors.d.ts.map +1 -1
- package/dist/tempo/Selectors.js +220 -67
- package/dist/tempo/Selectors.js.map +1 -1
- package/dist/tempo/Store.d.ts +62 -0
- package/dist/tempo/Store.d.ts.map +1 -0
- package/dist/tempo/Store.js +107 -0
- package/dist/tempo/Store.js.map +1 -0
- package/dist/tempo/Transport.d.ts +48 -2
- package/dist/tempo/Transport.d.ts.map +1 -1
- package/dist/tempo/Transport.js +116 -34
- package/dist/tempo/Transport.js.map +1 -1
- package/dist/tempo/Zone.d.ts +51 -0
- package/dist/tempo/Zone.d.ts.map +1 -0
- package/dist/tempo/Zone.js +40 -0
- package/dist/tempo/Zone.js.map +1 -0
- package/dist/tempo/actions/accessKey/authorizeSync.d.ts.map +1 -1
- package/dist/tempo/actions/accessKey/authorizeSync.js +2 -0
- package/dist/tempo/actions/accessKey/authorizeSync.js.map +1 -1
- package/dist/tempo/actions/accessKey/burnWitnessSync.d.ts.map +1 -1
- package/dist/tempo/actions/accessKey/burnWitnessSync.js +2 -0
- package/dist/tempo/actions/accessKey/burnWitnessSync.js.map +1 -1
- package/dist/tempo/actions/accessKey/index.d.ts +1 -0
- package/dist/tempo/actions/accessKey/index.d.ts.map +1 -1
- package/dist/tempo/actions/accessKey/index.js +1 -0
- package/dist/tempo/actions/accessKey/index.js.map +1 -1
- package/dist/tempo/actions/accessKey/prepareAuthorization.d.ts +76 -0
- package/dist/tempo/actions/accessKey/prepareAuthorization.d.ts.map +1 -0
- package/dist/tempo/actions/accessKey/prepareAuthorization.js +62 -0
- package/dist/tempo/actions/accessKey/prepareAuthorization.js.map +1 -0
- package/dist/tempo/actions/accessKey/revokeSync.d.ts.map +1 -1
- package/dist/tempo/actions/accessKey/revokeSync.js +2 -0
- package/dist/tempo/actions/accessKey/revokeSync.js.map +1 -1
- package/dist/tempo/actions/accessKey/signAuthorization.d.ts +43 -38
- package/dist/tempo/actions/accessKey/signAuthorization.d.ts.map +1 -1
- package/dist/tempo/actions/accessKey/signAuthorization.js +102 -44
- package/dist/tempo/actions/accessKey/signAuthorization.js.map +1 -1
- package/dist/tempo/actions/accessKey/updateLimitSync.d.ts.map +1 -1
- package/dist/tempo/actions/accessKey/updateLimitSync.js +2 -0
- package/dist/tempo/actions/accessKey/updateLimitSync.js.map +1 -1
- package/dist/tempo/actions/amm/burnSync.d.ts.map +1 -1
- package/dist/tempo/actions/amm/burnSync.js +2 -0
- package/dist/tempo/actions/amm/burnSync.js.map +1 -1
- package/dist/tempo/actions/amm/mintSync.d.ts.map +1 -1
- package/dist/tempo/actions/amm/mintSync.js +2 -0
- package/dist/tempo/actions/amm/mintSync.js.map +1 -1
- package/dist/tempo/actions/amm/rebalanceSwapSync.d.ts.map +1 -1
- package/dist/tempo/actions/amm/rebalanceSwapSync.js +2 -0
- package/dist/tempo/actions/amm/rebalanceSwapSync.js.map +1 -1
- package/dist/tempo/actions/channel/closeSync.d.ts.map +1 -1
- package/dist/tempo/actions/channel/closeSync.js +2 -0
- package/dist/tempo/actions/channel/closeSync.js.map +1 -1
- package/dist/tempo/actions/channel/openSync.d.ts.map +1 -1
- package/dist/tempo/actions/channel/openSync.js +2 -0
- package/dist/tempo/actions/channel/openSync.js.map +1 -1
- package/dist/tempo/actions/channel/requestCloseSync.d.ts.map +1 -1
- package/dist/tempo/actions/channel/requestCloseSync.js +2 -0
- package/dist/tempo/actions/channel/requestCloseSync.js.map +1 -1
- package/dist/tempo/actions/channel/settleSync.d.ts.map +1 -1
- package/dist/tempo/actions/channel/settleSync.js +2 -0
- package/dist/tempo/actions/channel/settleSync.js.map +1 -1
- package/dist/tempo/actions/channel/topUpSync.d.ts.map +1 -1
- package/dist/tempo/actions/channel/topUpSync.js +2 -0
- package/dist/tempo/actions/channel/topUpSync.js.map +1 -1
- package/dist/tempo/actions/channel/withdrawSync.d.ts.map +1 -1
- package/dist/tempo/actions/channel/withdrawSync.js +2 -0
- package/dist/tempo/actions/channel/withdrawSync.js.map +1 -1
- package/dist/tempo/actions/dex/cancelStaleSync.d.ts.map +1 -1
- package/dist/tempo/actions/dex/cancelStaleSync.js +2 -0
- package/dist/tempo/actions/dex/cancelStaleSync.js.map +1 -1
- package/dist/tempo/actions/dex/cancelSync.d.ts.map +1 -1
- package/dist/tempo/actions/dex/cancelSync.js +2 -0
- package/dist/tempo/actions/dex/cancelSync.js.map +1 -1
- package/dist/tempo/actions/dex/createPairSync.d.ts.map +1 -1
- package/dist/tempo/actions/dex/createPairSync.js +2 -0
- package/dist/tempo/actions/dex/createPairSync.js.map +1 -1
- package/dist/tempo/actions/dex/placeFlipSync.d.ts.map +1 -1
- package/dist/tempo/actions/dex/placeFlipSync.js +2 -0
- package/dist/tempo/actions/dex/placeFlipSync.js.map +1 -1
- package/dist/tempo/actions/dex/placeSync.d.ts.map +1 -1
- package/dist/tempo/actions/dex/placeSync.js +2 -0
- package/dist/tempo/actions/dex/placeSync.js.map +1 -1
- package/dist/tempo/actions/dex/withdrawSync.d.ts.map +1 -1
- package/dist/tempo/actions/dex/withdrawSync.js +2 -0
- package/dist/tempo/actions/dex/withdrawSync.js.map +1 -1
- package/dist/tempo/actions/earn/deployment.d.ts +36 -21
- package/dist/tempo/actions/earn/deployment.d.ts.map +1 -1
- package/dist/tempo/actions/earn/deployment.js +96 -32
- package/dist/tempo/actions/earn/deployment.js.map +1 -1
- package/dist/tempo/actions/earn.d.ts +21 -21
- package/dist/tempo/actions/earn.d.ts.map +1 -1
- package/dist/tempo/actions/earn.js +24 -9
- package/dist/tempo/actions/earn.js.map +1 -1
- package/dist/tempo/actions/fee/setUserTokenSync.d.ts.map +1 -1
- package/dist/tempo/actions/fee/setUserTokenSync.js +2 -0
- package/dist/tempo/actions/fee/setUserTokenSync.js.map +1 -1
- package/dist/tempo/actions/fee/setValidatorTokenSync.d.ts.map +1 -1
- package/dist/tempo/actions/fee/setValidatorTokenSync.js +2 -0
- package/dist/tempo/actions/fee/setValidatorTokenSync.js.map +1 -1
- package/dist/tempo/actions/index.d.ts +3 -0
- package/dist/tempo/actions/index.d.ts.map +1 -1
- package/dist/tempo/actions/index.js +3 -0
- package/dist/tempo/actions/index.js.map +1 -1
- package/dist/tempo/actions/multisig/getConfig.d.ts +34 -0
- package/dist/tempo/actions/multisig/getConfig.d.ts.map +1 -0
- package/dist/tempo/actions/multisig/getConfig.js +27 -0
- package/dist/tempo/actions/multisig/getConfig.js.map +1 -0
- package/dist/tempo/actions/multisig/getConfigCommitment.d.ts +72 -0
- package/dist/tempo/actions/multisig/getConfigCommitment.d.ts.map +1 -0
- package/dist/tempo/actions/multisig/getConfigCommitment.js +55 -0
- package/dist/tempo/actions/multisig/getConfigCommitment.js.map +1 -0
- package/dist/tempo/actions/multisig/getOperation.d.ts +23 -0
- package/dist/tempo/actions/multisig/getOperation.d.ts.map +1 -0
- package/dist/tempo/actions/multisig/getOperation.js +18 -0
- package/dist/tempo/actions/multisig/getOperation.js.map +1 -0
- package/dist/tempo/actions/multisig/index.d.ts +6 -0
- package/dist/tempo/actions/multisig/index.d.ts.map +1 -0
- package/dist/tempo/actions/multisig/index.js +6 -0
- package/dist/tempo/actions/multisig/index.js.map +1 -0
- package/dist/tempo/actions/multisig/updateConfig.d.ts +193 -0
- package/dist/tempo/actions/multisig/updateConfig.d.ts.map +1 -0
- package/dist/tempo/actions/multisig/updateConfig.js +170 -0
- package/dist/tempo/actions/multisig/updateConfig.js.map +1 -0
- package/dist/tempo/actions/multisig/updateConfigSync.d.ts +50 -0
- package/dist/tempo/actions/multisig/updateConfigSync.d.ts.map +1 -0
- package/dist/tempo/actions/multisig/updateConfigSync.js +55 -0
- package/dist/tempo/actions/multisig/updateConfigSync.js.map +1 -0
- package/dist/tempo/actions/policy/createSync.d.ts.map +1 -1
- package/dist/tempo/actions/policy/createSync.js +2 -0
- package/dist/tempo/actions/policy/createSync.js.map +1 -1
- package/dist/tempo/actions/policy/modifyBlacklistSync.d.ts.map +1 -1
- package/dist/tempo/actions/policy/modifyBlacklistSync.js +2 -0
- package/dist/tempo/actions/policy/modifyBlacklistSync.js.map +1 -1
- package/dist/tempo/actions/policy/modifyWhitelistSync.d.ts.map +1 -1
- package/dist/tempo/actions/policy/modifyWhitelistSync.js +2 -0
- package/dist/tempo/actions/policy/modifyWhitelistSync.js.map +1 -1
- package/dist/tempo/actions/policy/setAdminSync.d.ts.map +1 -1
- package/dist/tempo/actions/policy/setAdminSync.js +2 -0
- package/dist/tempo/actions/policy/setAdminSync.js.map +1 -1
- package/dist/tempo/actions/propAmm.d.ts +1025 -0
- package/dist/tempo/actions/propAmm.d.ts.map +1 -0
- package/dist/tempo/actions/propAmm.js +541 -0
- package/dist/tempo/actions/propAmm.js.map +1 -0
- package/dist/tempo/actions/receivePolicy/burnSync.d.ts.map +1 -1
- package/dist/tempo/actions/receivePolicy/burnSync.js +2 -0
- package/dist/tempo/actions/receivePolicy/burnSync.js.map +1 -1
- package/dist/tempo/actions/receivePolicy/claimSync.d.ts.map +1 -1
- package/dist/tempo/actions/receivePolicy/claimSync.js +2 -0
- package/dist/tempo/actions/receivePolicy/claimSync.js.map +1 -1
- package/dist/tempo/actions/receivePolicy/setSync.d.ts.map +1 -1
- package/dist/tempo/actions/receivePolicy/setSync.js +2 -0
- package/dist/tempo/actions/receivePolicy/setSync.js.map +1 -1
- package/dist/tempo/actions/token/approveSync.d.ts.map +1 -1
- package/dist/tempo/actions/token/approveSync.js +2 -0
- package/dist/tempo/actions/token/approveSync.js.map +1 -1
- package/dist/tempo/actions/token/burn.d.ts +38 -9
- package/dist/tempo/actions/token/burn.d.ts.map +1 -1
- package/dist/tempo/actions/token/burn.js +12 -5
- package/dist/tempo/actions/token/burn.js.map +1 -1
- package/dist/tempo/actions/token/burnBlockedSync.d.ts.map +1 -1
- package/dist/tempo/actions/token/burnBlockedSync.js +2 -0
- package/dist/tempo/actions/token/burnBlockedSync.js.map +1 -1
- package/dist/tempo/actions/token/burnSync.d.ts +2 -0
- package/dist/tempo/actions/token/burnSync.d.ts.map +1 -1
- package/dist/tempo/actions/token/burnSync.js +2 -0
- package/dist/tempo/actions/token/burnSync.js.map +1 -1
- package/dist/tempo/actions/token/changeTransferPolicySync.d.ts.map +1 -1
- package/dist/tempo/actions/token/changeTransferPolicySync.js +2 -0
- package/dist/tempo/actions/token/changeTransferPolicySync.js.map +1 -1
- package/dist/tempo/actions/token/createSync.d.ts.map +1 -1
- package/dist/tempo/actions/token/createSync.js +2 -0
- package/dist/tempo/actions/token/createSync.js.map +1 -1
- package/dist/tempo/actions/token/grantRolesSync.d.ts.map +1 -1
- package/dist/tempo/actions/token/grantRolesSync.js +2 -0
- package/dist/tempo/actions/token/grantRolesSync.js.map +1 -1
- package/dist/tempo/actions/token/mintSync.d.ts.map +1 -1
- package/dist/tempo/actions/token/mintSync.js +2 -0
- package/dist/tempo/actions/token/mintSync.js.map +1 -1
- package/dist/tempo/actions/token/pauseSync.d.ts.map +1 -1
- package/dist/tempo/actions/token/pauseSync.js +2 -0
- package/dist/tempo/actions/token/pauseSync.js.map +1 -1
- package/dist/tempo/actions/token/prepareUpdateQuoteTokenSync.d.ts.map +1 -1
- package/dist/tempo/actions/token/prepareUpdateQuoteTokenSync.js +2 -0
- package/dist/tempo/actions/token/prepareUpdateQuoteTokenSync.js.map +1 -1
- package/dist/tempo/actions/token/renounceRolesSync.d.ts.map +1 -1
- package/dist/tempo/actions/token/renounceRolesSync.js +2 -0
- package/dist/tempo/actions/token/renounceRolesSync.js.map +1 -1
- package/dist/tempo/actions/token/revokeRolesSync.d.ts.map +1 -1
- package/dist/tempo/actions/token/revokeRolesSync.js +2 -0
- package/dist/tempo/actions/token/revokeRolesSync.js.map +1 -1
- package/dist/tempo/actions/token/setRoleAdminSync.d.ts.map +1 -1
- package/dist/tempo/actions/token/setRoleAdminSync.js +2 -0
- package/dist/tempo/actions/token/setRoleAdminSync.js.map +1 -1
- package/dist/tempo/actions/token/setSupplyCapSync.d.ts.map +1 -1
- package/dist/tempo/actions/token/setSupplyCapSync.js +2 -0
- package/dist/tempo/actions/token/setSupplyCapSync.js.map +1 -1
- package/dist/tempo/actions/token/transferSync.d.ts.map +1 -1
- package/dist/tempo/actions/token/transferSync.js +2 -0
- package/dist/tempo/actions/token/transferSync.js.map +1 -1
- package/dist/tempo/actions/token/unpauseSync.d.ts.map +1 -1
- package/dist/tempo/actions/token/unpauseSync.js +2 -0
- package/dist/tempo/actions/token/unpauseSync.js.map +1 -1
- package/dist/tempo/actions/token/updateQuoteTokenSync.d.ts.map +1 -1
- package/dist/tempo/actions/token/updateQuoteTokenSync.js +2 -0
- package/dist/tempo/actions/token/updateQuoteTokenSync.js.map +1 -1
- package/dist/tempo/actions/virtualAddress/registerMasterSync.d.ts.map +1 -1
- package/dist/tempo/actions/virtualAddress/registerMasterSync.js +2 -0
- package/dist/tempo/actions/virtualAddress/registerMasterSync.js.map +1 -1
- package/dist/tempo/actions/zone/deposit.d.ts +56 -13
- package/dist/tempo/actions/zone/deposit.d.ts.map +1 -1
- package/dist/tempo/actions/zone/deposit.js +8 -10
- package/dist/tempo/actions/zone/deposit.js.map +1 -1
- package/dist/tempo/actions/zone/depositSync.d.ts.map +1 -1
- package/dist/tempo/actions/zone/depositSync.js +2 -0
- package/dist/tempo/actions/zone/depositSync.js.map +1 -1
- package/dist/tempo/actions/zone/encryptedDeposit.d.ts +15 -15
- package/dist/tempo/actions/zone/encryptedDeposit.d.ts.map +1 -1
- package/dist/tempo/actions/zone/encryptedDeposit.js +12 -12
- package/dist/tempo/actions/zone/encryptedDeposit.js.map +1 -1
- package/dist/tempo/actions/zone/getEncryptionKey.d.ts +3 -4
- package/dist/tempo/actions/zone/getEncryptionKey.d.ts.map +1 -1
- package/dist/tempo/actions/zone/getEncryptionKey.js +18 -7
- package/dist/tempo/actions/zone/getEncryptionKey.js.map +1 -1
- package/dist/tempo/actions/zone/getPortalInfo.d.ts +61 -0
- package/dist/tempo/actions/zone/getPortalInfo.d.ts.map +1 -0
- package/dist/tempo/actions/zone/getPortalInfo.js +63 -0
- package/dist/tempo/actions/zone/getPortalInfo.js.map +1 -0
- package/dist/tempo/actions/zone/getWithdrawalFee.d.ts.map +1 -1
- package/dist/tempo/actions/zone/getWithdrawalFee.js +1 -1
- package/dist/tempo/actions/zone/getWithdrawalFee.js.map +1 -1
- package/dist/tempo/actions/zone/index.d.ts +1 -0
- package/dist/tempo/actions/zone/index.d.ts.map +1 -1
- package/dist/tempo/actions/zone/index.js +1 -0
- package/dist/tempo/actions/zone/index.js.map +1 -1
- package/dist/tempo/actions/zone/requestVerifiableWithdrawal.d.ts +8 -8
- package/dist/tempo/actions/zone/requestVerifiableWithdrawal.d.ts.map +1 -1
- package/dist/tempo/actions/zone/requestVerifiableWithdrawal.js +1 -1
- package/dist/tempo/actions/zone/requestVerifiableWithdrawal.js.map +1 -1
- package/dist/tempo/actions/zone/requestWithdrawal.d.ts +8 -8
- package/dist/tempo/actions/zone/requestWithdrawal.d.ts.map +1 -1
- package/dist/tempo/actions/zone/requestWithdrawal.js +1 -1
- package/dist/tempo/actions/zone/requestWithdrawal.js.map +1 -1
- package/dist/tempo/actions/zone/requestWithdrawalSync.d.ts.map +1 -1
- package/dist/tempo/actions/zone/requestWithdrawalSync.js +2 -0
- package/dist/tempo/actions/zone/requestWithdrawalSync.js.map +1 -1
- package/dist/tempo/actions/zone/signAuthorizationToken.d.ts +3 -3
- package/dist/tempo/actions/zone/signAuthorizationToken.d.ts.map +1 -1
- package/dist/tempo/actions/zone/signAuthorizationToken.js +5 -5
- package/dist/tempo/actions/zone/signAuthorizationToken.js.map +1 -1
- package/dist/tempo/actions/zone/types.d.ts +1 -1
- package/dist/tempo/actions/zone/types.d.ts.map +1 -1
- package/dist/tempo/chainConfig.d.ts +33 -17
- package/dist/tempo/chainConfig.d.ts.map +1 -1
- package/dist/tempo/chainConfig.js +188 -72
- package/dist/tempo/chainConfig.js.map +1 -1
- package/dist/tempo/index.d.ts +11 -5
- package/dist/tempo/index.d.ts.map +1 -1
- package/dist/tempo/index.js +9 -3
- package/dist/tempo/index.js.map +1 -1
- package/dist/tempo/internal/relay/cache.d.ts +9 -0
- package/dist/tempo/internal/relay/cache.d.ts.map +1 -0
- package/dist/tempo/internal/relay/cache.js +72 -0
- package/dist/tempo/internal/relay/cache.js.map +1 -0
- package/dist/tempo/internal/relay/deadline.d.ts +4 -0
- package/dist/tempo/internal/relay/deadline.d.ts.map +1 -0
- package/dist/tempo/internal/relay/deadline.js +34 -0
- package/dist/tempo/internal/relay/deadline.js.map +1 -0
- package/dist/tempo/internal/relay/error.d.ts +47 -0
- package/dist/tempo/internal/relay/error.d.ts.map +1 -0
- package/dist/tempo/internal/relay/error.js +101 -0
- package/dist/tempo/internal/relay/error.js.map +1 -0
- package/dist/tempo/internal/relay/feePayer.d.ts +70 -0
- package/dist/tempo/internal/relay/feePayer.d.ts.map +1 -0
- package/dist/tempo/internal/relay/feePayer.js +442 -0
- package/dist/tempo/internal/relay/feePayer.js.map +1 -0
- package/dist/tempo/internal/relay/feeToken.d.ts +38 -0
- package/dist/tempo/internal/relay/feeToken.d.ts.map +1 -0
- package/dist/tempo/internal/relay/feeToken.js +143 -0
- package/dist/tempo/internal/relay/feeToken.js.map +1 -0
- package/dist/tempo/internal/relay/multisig.d.ts +4 -0
- package/dist/tempo/internal/relay/multisig.d.ts.map +1 -0
- package/dist/tempo/internal/relay/multisig.js +1039 -0
- package/dist/tempo/internal/relay/multisig.js.map +1 -0
- package/dist/tempo/internal/relay/plugin.d.ts +5 -0
- package/dist/tempo/internal/relay/plugin.d.ts.map +1 -0
- package/dist/tempo/internal/relay/plugin.js +10 -0
- package/dist/tempo/internal/relay/plugin.js.map +1 -0
- package/dist/tempo/internal/relay/preflight.d.ts +17 -0
- package/dist/tempo/internal/relay/preflight.d.ts.map +1 -0
- package/dist/tempo/internal/relay/preflight.js +53 -0
- package/dist/tempo/internal/relay/preflight.js.map +1 -0
- package/dist/tempo/internal/relay/request.d.ts +16 -0
- package/dist/tempo/internal/relay/request.d.ts.map +1 -0
- package/dist/tempo/internal/relay/request.js +327 -0
- package/dist/tempo/internal/relay/request.js.map +1 -0
- package/dist/tempo/internal/relay/simulate.d.ts +62 -0
- package/dist/tempo/internal/relay/simulate.d.ts.map +1 -0
- package/dist/tempo/internal/relay/simulate.js +284 -0
- package/dist/tempo/internal/relay/simulate.js.map +1 -0
- package/dist/tempo/internal/relay/utils.d.ts +346 -0
- package/dist/tempo/internal/relay/utils.d.ts.map +1 -0
- package/dist/tempo/internal/relay/utils.js +185 -0
- package/dist/tempo/internal/relay/utils.js.map +1 -0
- package/dist/tempo/internal/relay/virtualAddress.d.ts +9 -0
- package/dist/tempo/internal/relay/virtualAddress.d.ts.map +1 -0
- package/dist/tempo/internal/relay/virtualAddress.js +73 -0
- package/dist/tempo/internal/relay/virtualAddress.js.map +1 -0
- package/dist/tempo/internal/relay.d.ts +4 -0
- package/dist/tempo/internal/relay.d.ts.map +1 -0
- package/dist/tempo/internal/relay.js +132 -0
- package/dist/tempo/internal/relay.js.map +1 -0
- package/dist/tempo/internal/types.d.ts +2 -2
- package/dist/tempo/internal/types.d.ts.map +1 -1
- package/dist/tempo/internal/utils.d.ts +1 -0
- package/dist/tempo/internal/utils.d.ts.map +1 -1
- package/dist/tempo/internal/utils.js +2 -1
- package/dist/tempo/internal/utils.js.map +1 -1
- package/dist/tempo/multisig/Config.d.ts +43 -0
- package/dist/tempo/multisig/Config.d.ts.map +1 -0
- package/dist/tempo/multisig/Config.js +92 -0
- package/dist/tempo/multisig/Config.js.map +1 -0
- package/dist/tempo/multisig/Operation.d.ts +34 -0
- package/dist/tempo/multisig/Operation.d.ts.map +1 -0
- package/dist/tempo/multisig/Operation.js +179 -0
- package/dist/tempo/multisig/Operation.js.map +1 -0
- package/dist/tempo/multisig/Signature.d.ts +4 -0
- package/dist/tempo/multisig/Signature.d.ts.map +1 -0
- package/dist/tempo/multisig/Signature.js +9 -0
- package/dist/tempo/multisig/Signature.js.map +1 -0
- package/dist/tempo/zones/Abis.d.ts +2 -2
- package/dist/tempo/zones/Abis.d.ts.map +1 -1
- package/dist/tempo/zones/Abis.js +2 -2
- package/dist/tempo/zones/Abis.js.map +1 -1
- package/dist/tempo/zones/transport.d.ts +1 -33
- package/dist/tempo/zones/transport.d.ts.map +1 -1
- package/dist/tempo/zones/transport.js +1 -49
- package/dist/tempo/zones/transport.js.map +1 -1
- package/dist/tokens/definitions/cirbtc.d.ts +1 -0
- package/dist/tokens/definitions/cirbtc.d.ts.map +1 -1
- package/dist/tokens/definitions/cirbtc.js +1 -0
- package/dist/tokens/definitions/cirbtc.js.map +1 -1
- package/dist/tokens/definitions/eurc.d.ts +2 -0
- package/dist/tokens/definitions/eurc.d.ts.map +1 -1
- package/dist/tokens/definitions/eurc.js +2 -0
- package/dist/tokens/definitions/eurc.js.map +1 -1
- package/dist/tokens/definitions/ousd.d.ts +26 -0
- package/dist/tokens/definitions/ousd.d.ts.map +1 -0
- package/dist/tokens/definitions/ousd.js +26 -0
- package/dist/tokens/definitions/ousd.js.map +1 -0
- package/dist/tokens/definitions/usdc.d.ts +2 -0
- package/dist/tokens/definitions/usdc.d.ts.map +1 -1
- package/dist/tokens/definitions/usdc.js +2 -0
- package/dist/tokens/definitions/usdc.js.map +1 -1
- package/dist/tokens/index.d.ts +2 -0
- package/dist/tokens/index.d.ts.map +1 -1
- package/dist/tokens/index.js +2 -0
- package/dist/tokens/index.js.map +1 -1
- package/dist/tokens/sets.d.ts +40 -0
- package/dist/tokens/sets.d.ts.map +1 -1
- package/dist/tokens/sets.js +4 -1
- package/dist/tokens/sets.js.map +1 -1
- package/dist/utils/Siwe.d.ts +7 -0
- package/dist/utils/Siwe.d.ts.map +1 -1
- package/dist/utils/Siwe.js +28 -0
- package/dist/utils/Siwe.js.map +1 -1
- package/dist/utils/TxEnvelope.d.ts.map +1 -1
- package/dist/utils/TxEnvelope.js +2 -1
- package/dist/utils/TxEnvelope.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +2 -2
- package/src/chains/definitions/arc.ts +19 -1
- package/src/chains/definitions/berachainBepolia.ts +1 -1
- package/src/chains/definitions/blockdag.ts +18 -0
- package/src/chains/definitions/candyChain.ts +26 -0
- package/src/chains/definitions/creditCoin3Devnet.ts +6 -0
- package/src/chains/definitions/creditCoin3Mainnet.ts +4 -0
- package/src/chains/definitions/creditCoin3Testnet.ts +4 -0
- package/src/chains/definitions/crymad.ts +23 -0
- package/src/chains/definitions/crymadL2.ts +24 -0
- package/src/chains/definitions/eCanna.ts +18 -0
- package/src/chains/definitions/eCannaTestnet.ts +19 -0
- package/src/chains/definitions/hausTestnet.ts +18 -0
- package/src/chains/definitions/hyveChain.ts +22 -0
- package/src/chains/definitions/kortana.ts +16 -0
- package/src/chains/definitions/morphTachyon.ts +16 -0
- package/src/chains/definitions/morphTachyonTestnet.ts +17 -0
- package/src/chains/definitions/rabbitChainTestnet.ts +19 -0
- package/src/chains/definitions/robinhood.ts +6 -2
- package/src/chains/definitions/tempo.ts +10 -0
- package/src/chains/definitions/tempoModerato.ts +10 -0
- package/src/chains/definitions/whitechainSepolia.ts +28 -3
- package/src/chains/definitions/xgrTestnet.ts +19 -0
- package/src/chains/definitions/ynxTestnet.ts +17 -0
- package/src/chains/definitions/zagros.ts +26 -0
- package/src/chains/index.ts +17 -0
- package/src/core/actions/address/getStorageValues.ts +55 -0
- package/src/core/actions/address/index.ts +1 -0
- package/src/core/actions/block/simulate.ts +6 -0
- package/src/core/actions/multicall.ts +8 -1
- package/src/core/actions/siwe/verify.ts +3 -1
- package/src/core/actions/transaction/Errors.ts +1 -0
- package/src/core/actions/transaction/fill.ts +83 -41
- package/src/core/actions/transaction/prepare.ts +6 -1
- package/src/core/actions/transaction/sign.ts +4 -1
- package/src/core/actions/wallet/sendCalls.ts +1 -0
- package/src/core/internal/transport.ts +1 -1
- package/src/erc4337/actions/userOperation/get.ts +3 -1
- package/src/erc4337/actions/userOperation/waitForReceipt.ts +1 -1
- package/src/internal/inference.ts +24 -0
- package/src/node/transports/ipc.ts +17 -2
- package/src/op-stack/actions/l1/getGame.ts +1 -1
- package/src/op-stack/actions/l1/getGames.ts +1 -1
- package/src/op-stack/actions/l1/getTimeToNextGame.ts +1 -1
- package/src/op-stack/actions/l1/getTimeToNextL2Output.ts +1 -1
- package/src/tempo/Abis.ts +5619 -1513
- package/src/tempo/Account.ts +387 -82
- package/src/tempo/Addresses.ts +46 -17
- package/src/tempo/Capabilities.ts +7 -15
- package/src/tempo/Client.ts +1 -1
- package/src/tempo/Decorator.ts +304 -22
- package/src/tempo/ExecutionError.ts +428 -0
- package/src/tempo/Relay.ts +430 -0
- package/src/tempo/Selectors.ts +248 -78
- package/src/tempo/Store.ts +170 -0
- package/src/tempo/Transport.ts +202 -5
- package/src/tempo/Zone.ts +72 -0
- package/src/tempo/actions/accessKey/authorizeSync.ts +4 -0
- package/src/tempo/actions/accessKey/burnWitnessSync.ts +4 -0
- package/src/tempo/actions/accessKey/index.ts +2 -0
- package/src/tempo/actions/accessKey/prepareAuthorization.ts +132 -0
- package/src/tempo/actions/accessKey/revokeSync.ts +4 -0
- package/src/tempo/actions/accessKey/signAuthorization.ts +222 -53
- package/src/tempo/actions/accessKey/updateLimitSync.ts +4 -0
- package/src/tempo/actions/amm/burnSync.ts +4 -0
- package/src/tempo/actions/amm/mintSync.ts +4 -0
- package/src/tempo/actions/amm/rebalanceSwapSync.ts +4 -0
- package/src/tempo/actions/channel/closeSync.ts +4 -0
- package/src/tempo/actions/channel/openSync.ts +4 -0
- package/src/tempo/actions/channel/requestCloseSync.ts +4 -0
- package/src/tempo/actions/channel/settleSync.ts +4 -0
- package/src/tempo/actions/channel/topUpSync.ts +4 -0
- package/src/tempo/actions/channel/withdrawSync.ts +4 -0
- package/src/tempo/actions/dex/cancelStaleSync.ts +4 -0
- package/src/tempo/actions/dex/cancelSync.ts +4 -0
- package/src/tempo/actions/dex/createPairSync.ts +4 -0
- package/src/tempo/actions/dex/placeFlipSync.ts +4 -0
- package/src/tempo/actions/dex/placeSync.ts +4 -0
- package/src/tempo/actions/dex/withdrawSync.ts +4 -0
- package/src/tempo/actions/earn/deployment.ts +108 -42
- package/src/tempo/actions/earn.ts +35 -15
- package/src/tempo/actions/fee/setUserTokenSync.ts +4 -0
- package/src/tempo/actions/fee/setValidatorTokenSync.ts +4 -0
- package/src/tempo/actions/index.ts +4 -0
- package/src/tempo/actions/multisig/getConfig.ts +46 -0
- package/src/tempo/actions/multisig/getConfigCommitment.ts +79 -0
- package/src/tempo/actions/multisig/getOperation.ts +37 -0
- package/src/tempo/actions/multisig/index.ts +5 -0
- package/src/tempo/actions/multisig/updateConfig.ts +210 -0
- package/src/tempo/actions/multisig/updateConfigSync.ts +80 -0
- package/src/tempo/actions/policy/createSync.ts +4 -0
- package/src/tempo/actions/policy/modifyBlacklistSync.ts +4 -0
- package/src/tempo/actions/policy/modifyWhitelistSync.ts +4 -0
- package/src/tempo/actions/policy/setAdminSync.ts +4 -0
- package/src/tempo/actions/propAmm.ts +985 -0
- package/src/tempo/actions/receivePolicy/burnSync.ts +4 -0
- package/src/tempo/actions/receivePolicy/claimSync.ts +4 -0
- package/src/tempo/actions/receivePolicy/setSync.ts +5 -1
- package/src/tempo/actions/token/approveSync.ts +5 -1
- package/src/tempo/actions/token/burn.ts +21 -9
- package/src/tempo/actions/token/burnBlockedSync.ts +5 -1
- package/src/tempo/actions/token/burnSync.ts +7 -1
- package/src/tempo/actions/token/changeTransferPolicySync.ts +4 -0
- package/src/tempo/actions/token/createSync.ts +4 -0
- package/src/tempo/actions/token/grantRolesSync.ts +4 -0
- package/src/tempo/actions/token/mintSync.ts +5 -1
- package/src/tempo/actions/token/pauseSync.ts +4 -0
- package/src/tempo/actions/token/prepareUpdateQuoteTokenSync.ts +4 -0
- package/src/tempo/actions/token/renounceRolesSync.ts +4 -0
- package/src/tempo/actions/token/revokeRolesSync.ts +4 -0
- package/src/tempo/actions/token/setRoleAdminSync.ts +4 -0
- package/src/tempo/actions/token/setSupplyCapSync.ts +4 -0
- package/src/tempo/actions/token/transferSync.ts +5 -1
- package/src/tempo/actions/token/unpauseSync.ts +4 -0
- package/src/tempo/actions/token/updateQuoteTokenSync.ts +4 -0
- package/src/tempo/actions/virtualAddress/registerMasterSync.ts +4 -0
- package/src/tempo/actions/zone/deposit.ts +13 -24
- package/src/tempo/actions/zone/depositSync.ts +4 -0
- package/src/tempo/actions/zone/encryptedDeposit.ts +18 -26
- package/src/tempo/actions/zone/getEncryptionKey.ts +20 -8
- package/src/tempo/actions/zone/getPortalInfo.ts +126 -0
- package/src/tempo/actions/zone/getWithdrawalFee.ts +1 -1
- package/src/tempo/actions/zone/index.ts +2 -0
- package/src/tempo/actions/zone/requestVerifiableWithdrawal.ts +1 -1
- package/src/tempo/actions/zone/requestWithdrawal.ts +1 -1
- package/src/tempo/actions/zone/requestWithdrawalSync.ts +4 -0
- package/src/tempo/actions/zone/signAuthorizationToken.ts +7 -7
- package/src/tempo/actions/zone/types.ts +1 -1
- package/src/tempo/chainConfig.ts +287 -86
- package/src/tempo/index.ts +15 -4
- package/src/tempo/internal/relay/cache.ts +82 -0
- package/src/tempo/internal/relay/deadline.ts +45 -0
- package/src/tempo/internal/relay/error.ts +129 -0
- package/src/tempo/internal/relay/feePayer.ts +693 -0
- package/src/tempo/internal/relay/feeToken.ts +190 -0
- package/src/tempo/internal/relay/multisig.ts +1357 -0
- package/src/tempo/internal/relay/plugin.ts +13 -0
- package/src/tempo/internal/relay/preflight.ts +83 -0
- package/src/tempo/internal/relay/request.ts +401 -0
- package/src/tempo/internal/relay/simulate.ts +394 -0
- package/src/tempo/internal/relay/utils.ts +213 -0
- package/src/tempo/internal/relay/virtualAddress.ts +95 -0
- package/src/tempo/internal/relay.ts +149 -0
- package/src/tempo/internal/types.ts +2 -1
- package/src/tempo/internal/utils.ts +2 -0
- package/src/tempo/multisig/Config.ts +139 -0
- package/src/tempo/multisig/Operation.ts +213 -0
- package/src/tempo/multisig/Signature.ts +11 -0
- package/src/tempo/zones/Abis.ts +2 -2
- package/src/tempo/zones/transport.ts +1 -66
- package/src/tokens/definitions/cirbtc.ts +1 -0
- package/src/tokens/definitions/eurc.ts +2 -0
- package/src/tokens/definitions/ousd.ts +26 -0
- package/src/tokens/definitions/usdc.ts +2 -0
- package/src/tokens/index.ts +2 -0
- package/src/tokens/sets.ts +4 -1
- package/src/utils/Siwe.ts +36 -0
- package/src/utils/TxEnvelope.ts +3 -1
- package/src/version.ts +1 -1
- package/dist/tempo/Storage.d.ts +0 -43
- package/dist/tempo/Storage.d.ts.map +0 -1
- package/dist/tempo/Storage.js +0 -96
- package/dist/tempo/Storage.js.map +0 -1
- package/src/tempo/Storage.ts +0 -119
|
@@ -0,0 +1,1357 @@
|
|
|
1
|
+
import type { Address } from 'abitype'
|
|
2
|
+
import { AbiFunction, Address as Address_, Hash, Hex, RpcResponse } from 'ox'
|
|
3
|
+
import {
|
|
4
|
+
KeyAuthorization,
|
|
5
|
+
MultisigConfig,
|
|
6
|
+
MultisigOperation,
|
|
7
|
+
Transaction as ox_Transaction,
|
|
8
|
+
SignatureEnvelope,
|
|
9
|
+
TxEnvelopeTempo,
|
|
10
|
+
} from 'ox/tempo'
|
|
11
|
+
import { getNumber as getBlockNumber } from '../../../core/actions/block/getNumber.js'
|
|
12
|
+
import { create as createClient } from '../../../core/Client.js'
|
|
13
|
+
import * as Abis from '../../Abis.js'
|
|
14
|
+
import * as Addresses from '../../Addresses.js'
|
|
15
|
+
import { getConfigCommitment } from '../../actions/multisig/getConfigCommitment.js'
|
|
16
|
+
import * as ConfigStore from '../../multisig/Config.js'
|
|
17
|
+
import * as OperationStore from '../../multisig/Operation.js'
|
|
18
|
+
import type * as Relay from '../../Relay.js'
|
|
19
|
+
import type * as Store from '../../Store.js'
|
|
20
|
+
import * as Plugin from './plugin.js'
|
|
21
|
+
|
|
22
|
+
const submissionTtl = 30_000
|
|
23
|
+
const pollingInterval = 100
|
|
24
|
+
|
|
25
|
+
/** Creates middleware for multisig approval coordination. @internal */
|
|
26
|
+
export function create(
|
|
27
|
+
options: Relay.multisig.Options,
|
|
28
|
+
): Relay.multisig.ReturnType {
|
|
29
|
+
if (!options.store.compareAndSet)
|
|
30
|
+
throw new RpcResponse.InvalidParamsError({
|
|
31
|
+
message:
|
|
32
|
+
'Multisig coordination requires a store with atomic `compareAndSet`.',
|
|
33
|
+
})
|
|
34
|
+
return Plugin.multisig({
|
|
35
|
+
async handleRequest(context, forward) {
|
|
36
|
+
const { request, options: requestOptions_ } = context
|
|
37
|
+
const requestOptions = await resolveRequestOptions({
|
|
38
|
+
request,
|
|
39
|
+
requestOptions: requestOptions_,
|
|
40
|
+
store: options.store,
|
|
41
|
+
})
|
|
42
|
+
context.options = requestOptions ?? {}
|
|
43
|
+
const next: Relay.handleRequest.Handler = async (request, options) => {
|
|
44
|
+
return context
|
|
45
|
+
.getClient(options?.chainId)
|
|
46
|
+
.request(request as never, options)
|
|
47
|
+
}
|
|
48
|
+
const client = createClient({
|
|
49
|
+
transport: {
|
|
50
|
+
key: 'multisig-forward',
|
|
51
|
+
name: 'Multisig Forwarding',
|
|
52
|
+
type: 'multisig-forward',
|
|
53
|
+
setup: () => ({
|
|
54
|
+
request: ((
|
|
55
|
+
request: Relay.handleRequest.Request,
|
|
56
|
+
options?: Relay.handleRequest.RequestOptions,
|
|
57
|
+
) =>
|
|
58
|
+
next(request, { ...requestOptions, ...options })) as ReturnType<
|
|
59
|
+
typeof createClient
|
|
60
|
+
>['request'],
|
|
61
|
+
}),
|
|
62
|
+
},
|
|
63
|
+
})
|
|
64
|
+
|
|
65
|
+
if (request.method === 'multisig_getConfig') {
|
|
66
|
+
const value = request.params?.[0]
|
|
67
|
+
const address =
|
|
68
|
+
value && typeof value === 'object' && 'address' in value
|
|
69
|
+
? value.address
|
|
70
|
+
: undefined
|
|
71
|
+
if (
|
|
72
|
+
typeof address !== 'string' ||
|
|
73
|
+
!Address_.validate(address) ||
|
|
74
|
+
Hex.toBigInt(address) === 0n
|
|
75
|
+
)
|
|
76
|
+
throw new RpcResponse.InvalidParamsError({
|
|
77
|
+
message: 'Expected a multisig account address.',
|
|
78
|
+
})
|
|
79
|
+
const blockNumber = await getBlockNumber(client, { cacheTime: 0 })
|
|
80
|
+
const commitment = await getConfigCommitment(client, {
|
|
81
|
+
account: address,
|
|
82
|
+
blockNumber,
|
|
83
|
+
})
|
|
84
|
+
const config = await ConfigStore.read(options.store, {
|
|
85
|
+
address,
|
|
86
|
+
commitment,
|
|
87
|
+
})
|
|
88
|
+
if (!config) return null
|
|
89
|
+
return MultisigConfig.toRpc(config)
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
if (request.method === 'multisig_getOperation') {
|
|
93
|
+
const hash = request.params?.[0]
|
|
94
|
+
if (typeof hash !== 'string' || !Hash.validate(hash))
|
|
95
|
+
throw new RpcResponse.InvalidParamsError({
|
|
96
|
+
message: 'Expected a multisig operation hash.',
|
|
97
|
+
})
|
|
98
|
+
const operation = await OperationStore.read(options.store, hash)
|
|
99
|
+
return operation ? MultisigOperation.toRpc(operation) : null
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
if (request.method === 'multisig_approveKeyAuthorization')
|
|
103
|
+
return await approveKeyAuthorization({
|
|
104
|
+
client,
|
|
105
|
+
request,
|
|
106
|
+
store: options.store,
|
|
107
|
+
})
|
|
108
|
+
|
|
109
|
+
if (
|
|
110
|
+
request.method === 'eth_getTransactionByHash' ||
|
|
111
|
+
request.method === 'eth_getTransactionReceipt'
|
|
112
|
+
) {
|
|
113
|
+
const hash = request.params?.[0]
|
|
114
|
+
if (typeof hash !== 'string' || !Hash.validate(hash)) return forward()
|
|
115
|
+
const operation = await OperationStore.read(options.store, hash)
|
|
116
|
+
if (!operation || operation.type !== 'transaction') return forward()
|
|
117
|
+
if (request.method === 'eth_getTransactionReceipt') {
|
|
118
|
+
if (operation.status === 'pending') return null
|
|
119
|
+
const transactionHash = await getSubmittedTransactionHash(
|
|
120
|
+
options.store,
|
|
121
|
+
operation,
|
|
122
|
+
)
|
|
123
|
+
if (!transactionHash) return null
|
|
124
|
+
const receipt = await next(
|
|
125
|
+
{
|
|
126
|
+
...request,
|
|
127
|
+
params: [transactionHash],
|
|
128
|
+
},
|
|
129
|
+
requestOptions,
|
|
130
|
+
)
|
|
131
|
+
if (!receipt || typeof receipt !== 'object') return receipt
|
|
132
|
+
const success =
|
|
133
|
+
operation.status === 'submitting'
|
|
134
|
+
? await completeSubmission(
|
|
135
|
+
options.store,
|
|
136
|
+
operation,
|
|
137
|
+
transactionHash,
|
|
138
|
+
)
|
|
139
|
+
: operation
|
|
140
|
+
return {
|
|
141
|
+
...receipt,
|
|
142
|
+
multisig: MultisigOperation.toRpc(success),
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
if (operation.status === 'pending')
|
|
146
|
+
return await toTransaction(client, operation)
|
|
147
|
+
const transactionHash = await getSubmittedTransactionHash(
|
|
148
|
+
options.store,
|
|
149
|
+
operation,
|
|
150
|
+
)
|
|
151
|
+
if (!transactionHash) return await toTransaction(client, operation)
|
|
152
|
+
const transaction = await next(
|
|
153
|
+
{
|
|
154
|
+
...request,
|
|
155
|
+
params: [transactionHash],
|
|
156
|
+
},
|
|
157
|
+
requestOptions,
|
|
158
|
+
)
|
|
159
|
+
if (!transaction || typeof transaction !== 'object')
|
|
160
|
+
return await toTransaction(client, operation)
|
|
161
|
+
const success =
|
|
162
|
+
operation.status === 'submitting'
|
|
163
|
+
? await completeSubmission(
|
|
164
|
+
options.store,
|
|
165
|
+
operation,
|
|
166
|
+
transactionHash,
|
|
167
|
+
)
|
|
168
|
+
: operation
|
|
169
|
+
return {
|
|
170
|
+
...transaction,
|
|
171
|
+
multisig: MultisigOperation.toRpc(success),
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
if (
|
|
176
|
+
request.method !== 'eth_sendRawTransaction' &&
|
|
177
|
+
request.method !== 'eth_sendRawTransactionSync' &&
|
|
178
|
+
request.method !== 'multisig_approveRawTransaction' &&
|
|
179
|
+
request.method !== 'multisig_approveRawTransactionSync'
|
|
180
|
+
)
|
|
181
|
+
return forward()
|
|
182
|
+
|
|
183
|
+
const standard =
|
|
184
|
+
request.method === 'eth_sendRawTransaction' ||
|
|
185
|
+
request.method === 'eth_sendRawTransactionSync'
|
|
186
|
+
const serialized = request.params?.[0]
|
|
187
|
+
if (!isSerializedTempoTransaction(serialized)) {
|
|
188
|
+
if (standard) return forward()
|
|
189
|
+
throw new RpcResponse.InvalidParamsError({
|
|
190
|
+
message: 'Expected a serialized Tempo multisig transaction.',
|
|
191
|
+
})
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
return await submit({
|
|
195
|
+
client,
|
|
196
|
+
method: request.method,
|
|
197
|
+
next,
|
|
198
|
+
request,
|
|
199
|
+
requestOptions,
|
|
200
|
+
serialized,
|
|
201
|
+
store: options.store,
|
|
202
|
+
})
|
|
203
|
+
},
|
|
204
|
+
})
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
/** Collects approvals and submits a transaction after quorum. @internal */
|
|
208
|
+
// biome-ignore lint/correctness/noUnusedVariables: declaration merge
|
|
209
|
+
async function submit(options: submit.Options) {
|
|
210
|
+
const transaction = (() => {
|
|
211
|
+
try {
|
|
212
|
+
return deserialize(options.serialized)
|
|
213
|
+
} catch (error) {
|
|
214
|
+
if (
|
|
215
|
+
options.method !== 'eth_sendRawTransaction' &&
|
|
216
|
+
options.method !== 'eth_sendRawTransactionSync'
|
|
217
|
+
)
|
|
218
|
+
throw error
|
|
219
|
+
return undefined
|
|
220
|
+
}
|
|
221
|
+
})()
|
|
222
|
+
const signature = transaction?.signature
|
|
223
|
+
if (!transaction || signature?.type !== 'multisig') {
|
|
224
|
+
if (
|
|
225
|
+
options.method === 'eth_sendRawTransaction' ||
|
|
226
|
+
options.method === 'eth_sendRawTransactionSync'
|
|
227
|
+
)
|
|
228
|
+
return await options.next(options.request, options.requestOptions)
|
|
229
|
+
throw new RpcResponse.InvalidParamsError({
|
|
230
|
+
message: 'Expected a multisig transaction signature.',
|
|
231
|
+
})
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
const { signature: _, ...unsigned } = transaction
|
|
235
|
+
const envelope = TxEnvelopeTempo.from(unsigned)
|
|
236
|
+
const serializedUnsigned = serializeUnsigned(
|
|
237
|
+
envelope,
|
|
238
|
+
options.serialized.startsWith(TxEnvelopeTempo.feePayerMagic),
|
|
239
|
+
)
|
|
240
|
+
const blockNumber = await getBlockNumber(options.client, { cacheTime: 0 })
|
|
241
|
+
const config = MultisigConfig.from(signature.config)
|
|
242
|
+
const configCommitment = await validateConfig({
|
|
243
|
+
account: signature.account,
|
|
244
|
+
blockNumber,
|
|
245
|
+
client: options.client,
|
|
246
|
+
config,
|
|
247
|
+
})
|
|
248
|
+
const operationHash = MultisigOperation.getHash({
|
|
249
|
+
account: signature.account,
|
|
250
|
+
config,
|
|
251
|
+
transaction: serializedUnsigned,
|
|
252
|
+
type: 'transaction',
|
|
253
|
+
})
|
|
254
|
+
const incoming = signature.signatures.map((signature) =>
|
|
255
|
+
SignatureEnvelope.serialize(signature),
|
|
256
|
+
)
|
|
257
|
+
if (incoming.length === 0)
|
|
258
|
+
throw new RpcResponse.InvalidParamsError({
|
|
259
|
+
message: 'A multisig approval envelope must include a signature.',
|
|
260
|
+
})
|
|
261
|
+
const now = Date.now()
|
|
262
|
+
const expiredSubmissionIds = new Set<Hex.Hex>()
|
|
263
|
+
const operation = await OperationStore.update(
|
|
264
|
+
options.store,
|
|
265
|
+
operationHash,
|
|
266
|
+
async (existing) => {
|
|
267
|
+
if (existing && existing.type !== 'transaction')
|
|
268
|
+
throw new OperationStore.InvalidStoreValueError()
|
|
269
|
+
if (existing?.status === 'success') return existing
|
|
270
|
+
if (existing?.status === 'submitting' && existing.expiresAt! > now)
|
|
271
|
+
return existing
|
|
272
|
+
if (existing?.status === 'submitting')
|
|
273
|
+
expiredSubmissionIds.add(existing.submissionId!)
|
|
274
|
+
const existingApprovals = existing
|
|
275
|
+
? await selectApprovals({
|
|
276
|
+
account: signature.account,
|
|
277
|
+
config,
|
|
278
|
+
hash: operationHash,
|
|
279
|
+
approvals: existing.approvals,
|
|
280
|
+
})
|
|
281
|
+
: undefined
|
|
282
|
+
const approvals = await selectApprovals({
|
|
283
|
+
account: signature.account,
|
|
284
|
+
config,
|
|
285
|
+
hash: operationHash,
|
|
286
|
+
approvals: [...(existingApprovals?.approvals ?? []), ...incoming],
|
|
287
|
+
})
|
|
288
|
+
return MultisigOperation.from({
|
|
289
|
+
account: signature.account,
|
|
290
|
+
approvals: approvals.approvals,
|
|
291
|
+
config,
|
|
292
|
+
createdAt: existing?.createdAt ?? now,
|
|
293
|
+
hash: operationHash,
|
|
294
|
+
signatureCount: approvals.signatureCount,
|
|
295
|
+
status: 'pending',
|
|
296
|
+
threshold: approvals.threshold,
|
|
297
|
+
transaction: mergeTransaction(
|
|
298
|
+
existing?.transaction,
|
|
299
|
+
serializedUnsigned,
|
|
300
|
+
),
|
|
301
|
+
type: 'transaction',
|
|
302
|
+
updatedAt: now,
|
|
303
|
+
weight: approvals.weight,
|
|
304
|
+
})
|
|
305
|
+
},
|
|
306
|
+
)
|
|
307
|
+
|
|
308
|
+
for (const submissionId of expiredSubmissionIds) {
|
|
309
|
+
if (
|
|
310
|
+
operation.status === 'submitting' &&
|
|
311
|
+
operation.submissionId?.toLowerCase() === submissionId.toLowerCase()
|
|
312
|
+
)
|
|
313
|
+
continue
|
|
314
|
+
await removeSettledSubmission(options.store, operationHash, submissionId)
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
await ConfigStore.write(options.store, {
|
|
318
|
+
address: signature.account,
|
|
319
|
+
commitment: configCommitment,
|
|
320
|
+
config,
|
|
321
|
+
})
|
|
322
|
+
await cacheNextConfigs({
|
|
323
|
+
account: signature.account,
|
|
324
|
+
config,
|
|
325
|
+
store: options.store,
|
|
326
|
+
transaction,
|
|
327
|
+
})
|
|
328
|
+
|
|
329
|
+
if (operation.type !== 'transaction')
|
|
330
|
+
throw new OperationStore.InvalidStoreValueError()
|
|
331
|
+
if (operation.status === 'success')
|
|
332
|
+
return await submittedResult(options, operation)
|
|
333
|
+
if (operation.status === 'submitting' && operation.expiresAt! > Date.now())
|
|
334
|
+
return await submittingResult(options, operation)
|
|
335
|
+
if (operation.weight < operation.threshold)
|
|
336
|
+
return pendingResult(options.method, operation)
|
|
337
|
+
|
|
338
|
+
const submissionId = Hex.random(32)
|
|
339
|
+
const timeout = options.request.params?.[1]
|
|
340
|
+
const synchronous =
|
|
341
|
+
options.method === 'eth_sendRawTransactionSync' ||
|
|
342
|
+
options.method === 'multisig_approveRawTransactionSync'
|
|
343
|
+
const leaseTtl =
|
|
344
|
+
synchronous &&
|
|
345
|
+
typeof timeout === 'number' &&
|
|
346
|
+
Number.isSafeInteger(timeout) &&
|
|
347
|
+
timeout >= 0
|
|
348
|
+
? timeout + submissionTtl
|
|
349
|
+
: submissionTtl
|
|
350
|
+
const claim = await OperationStore.update(
|
|
351
|
+
options.store,
|
|
352
|
+
operationHash,
|
|
353
|
+
(current) => {
|
|
354
|
+
if (!current || current.type !== 'transaction')
|
|
355
|
+
throw new OperationStore.InvalidStoreValueError()
|
|
356
|
+
if (current.status === 'success') return current
|
|
357
|
+
if (current.status === 'submitting' && current.expiresAt! > Date.now())
|
|
358
|
+
return current
|
|
359
|
+
if (current.weight < current.threshold) return current
|
|
360
|
+
const now = Date.now()
|
|
361
|
+
return MultisigOperation.from({
|
|
362
|
+
...current,
|
|
363
|
+
expiresAt: Math.min(now + leaseTtl, Number.MAX_SAFE_INTEGER),
|
|
364
|
+
status: 'submitting',
|
|
365
|
+
submissionId,
|
|
366
|
+
updatedAt: now,
|
|
367
|
+
})
|
|
368
|
+
},
|
|
369
|
+
)
|
|
370
|
+
if (claim.type !== 'transaction')
|
|
371
|
+
throw new OperationStore.InvalidStoreValueError()
|
|
372
|
+
if (claim.status === 'success') return await submittedResult(options, claim)
|
|
373
|
+
if (claim.status === 'pending') return pendingResult(options.method, claim)
|
|
374
|
+
if (claim.submissionId !== submissionId)
|
|
375
|
+
return await submittingResult(options, claim)
|
|
376
|
+
|
|
377
|
+
const { final, transactionHash: initialTransactionHash } =
|
|
378
|
+
await (async () => {
|
|
379
|
+
try {
|
|
380
|
+
const blockNumber = await getBlockNumber(options.client, {
|
|
381
|
+
cacheTime: 0,
|
|
382
|
+
})
|
|
383
|
+
await validateConfig({
|
|
384
|
+
account: claim.account,
|
|
385
|
+
blockNumber,
|
|
386
|
+
client: options.client,
|
|
387
|
+
config: claim.config,
|
|
388
|
+
})
|
|
389
|
+
const finalApprovals = await selectApprovals({
|
|
390
|
+
account: claim.account,
|
|
391
|
+
config: claim.config,
|
|
392
|
+
hash: claim.hash,
|
|
393
|
+
approvals: claim.approvals,
|
|
394
|
+
})
|
|
395
|
+
const final = MultisigOperation.serializeTransaction(claim, {
|
|
396
|
+
approvals: finalApprovals.selectedApprovals,
|
|
397
|
+
})
|
|
398
|
+
const transactionHash = TxEnvelopeTempo.hash(
|
|
399
|
+
TxEnvelopeTempo.deserialize(final) as TxEnvelopeTempo.Signed,
|
|
400
|
+
)
|
|
401
|
+
await OperationStore.writeSubmission(
|
|
402
|
+
options.store,
|
|
403
|
+
operationHash,
|
|
404
|
+
submissionId,
|
|
405
|
+
final,
|
|
406
|
+
)
|
|
407
|
+
return { final, transactionHash }
|
|
408
|
+
} catch (error) {
|
|
409
|
+
await releaseSubmission(options.store, operationHash, submissionId)
|
|
410
|
+
throw error
|
|
411
|
+
}
|
|
412
|
+
})()
|
|
413
|
+
let transactionHash = initialTransactionHash
|
|
414
|
+
|
|
415
|
+
let result: unknown
|
|
416
|
+
const stopLease = maintainSubmissionLease(
|
|
417
|
+
options.store,
|
|
418
|
+
operationHash,
|
|
419
|
+
submissionId,
|
|
420
|
+
leaseTtl,
|
|
421
|
+
)
|
|
422
|
+
let leaseStopped = false
|
|
423
|
+
const stopLeaseOnce = async () => {
|
|
424
|
+
if (leaseStopped) return
|
|
425
|
+
leaseStopped = true
|
|
426
|
+
await stopLease()
|
|
427
|
+
}
|
|
428
|
+
try {
|
|
429
|
+
try {
|
|
430
|
+
result = await options.next(
|
|
431
|
+
{
|
|
432
|
+
method:
|
|
433
|
+
options.method === 'eth_sendRawTransaction' ||
|
|
434
|
+
options.method === 'multisig_approveRawTransaction'
|
|
435
|
+
? 'eth_sendRawTransaction'
|
|
436
|
+
: 'eth_sendRawTransactionSync',
|
|
437
|
+
params: [final, ...(options.request.params?.slice(1) ?? [])],
|
|
438
|
+
},
|
|
439
|
+
options.requestOptions,
|
|
440
|
+
)
|
|
441
|
+
const returnedHash = getTransactionHash(result)
|
|
442
|
+
if (returnedHash.toLowerCase() !== transactionHash.toLowerCase())
|
|
443
|
+
transactionHash = returnedHash
|
|
444
|
+
} catch (error) {
|
|
445
|
+
const submittedHash = await OperationStore.readSubmission(
|
|
446
|
+
options.store,
|
|
447
|
+
claim,
|
|
448
|
+
submissionId,
|
|
449
|
+
)
|
|
450
|
+
const transaction = await (async () => {
|
|
451
|
+
if (!submittedHash) return null
|
|
452
|
+
try {
|
|
453
|
+
return await options.next({
|
|
454
|
+
method: 'eth_getTransactionByHash',
|
|
455
|
+
params: [submittedHash],
|
|
456
|
+
})
|
|
457
|
+
} catch {
|
|
458
|
+
return null
|
|
459
|
+
}
|
|
460
|
+
})()
|
|
461
|
+
await stopLeaseOnce()
|
|
462
|
+
if (!submittedHash || !transaction) {
|
|
463
|
+
await releaseSubmission(options.store, operationHash, submissionId)
|
|
464
|
+
throw error
|
|
465
|
+
}
|
|
466
|
+
transactionHash = submittedHash
|
|
467
|
+
}
|
|
468
|
+
} finally {
|
|
469
|
+
await stopLeaseOnce()
|
|
470
|
+
}
|
|
471
|
+
const success = await OperationStore.update(
|
|
472
|
+
options.store,
|
|
473
|
+
operationHash,
|
|
474
|
+
(current) => {
|
|
475
|
+
if (!current || current.type !== 'transaction')
|
|
476
|
+
throw new OperationStore.InvalidStoreValueError()
|
|
477
|
+
if (current.status === 'success') {
|
|
478
|
+
if (
|
|
479
|
+
current.transactionHash?.toLowerCase() !==
|
|
480
|
+
transactionHash.toLowerCase()
|
|
481
|
+
)
|
|
482
|
+
throw new OperationStore.InvalidStoreValueError()
|
|
483
|
+
return current
|
|
484
|
+
}
|
|
485
|
+
if (
|
|
486
|
+
current.status !== 'submitting' ||
|
|
487
|
+
current.submissionId !== submissionId
|
|
488
|
+
)
|
|
489
|
+
throw new OperationStore.InvalidStoreValueError()
|
|
490
|
+
const { expiresAt: _, submissionId: __, ...operation } = current
|
|
491
|
+
return MultisigOperation.from({
|
|
492
|
+
...operation,
|
|
493
|
+
status: 'success',
|
|
494
|
+
transactionHash,
|
|
495
|
+
updatedAt: Date.now(),
|
|
496
|
+
})
|
|
497
|
+
},
|
|
498
|
+
)
|
|
499
|
+
if (success.type !== 'transaction' || success.status !== 'success')
|
|
500
|
+
throw new OperationStore.InvalidStoreValueError()
|
|
501
|
+
await removeSettledSubmission(options.store, operationHash, submissionId)
|
|
502
|
+
if (
|
|
503
|
+
options.method === 'eth_sendRawTransactionSync' &&
|
|
504
|
+
result &&
|
|
505
|
+
typeof result === 'object'
|
|
506
|
+
)
|
|
507
|
+
return { ...result, multisig: MultisigOperation.toRpc(success) }
|
|
508
|
+
return await submittedResult(options, success)
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
declare namespace submit {
|
|
512
|
+
/** Options for {@link submit}. */
|
|
513
|
+
export type Options = {
|
|
514
|
+
/** Client used to validate configs. */
|
|
515
|
+
client: ReturnType<typeof createClient>
|
|
516
|
+
/** RPC submission method. */
|
|
517
|
+
method:
|
|
518
|
+
| 'eth_sendRawTransaction'
|
|
519
|
+
| 'eth_sendRawTransactionSync'
|
|
520
|
+
| 'multisig_approveRawTransaction'
|
|
521
|
+
| 'multisig_approveRawTransactionSync'
|
|
522
|
+
/** Downstream RPC request handler. */
|
|
523
|
+
next: Relay.handleRequest.Handler
|
|
524
|
+
/** Original RPC request. */
|
|
525
|
+
request: Relay.handleRequest.Request
|
|
526
|
+
/** Original request overrides. */
|
|
527
|
+
requestOptions?: Relay.handleRequest.RequestOptions | undefined
|
|
528
|
+
/** Serialized Tempo transaction. */
|
|
529
|
+
serialized: Hex.Hex
|
|
530
|
+
/** Shared multisig store. */
|
|
531
|
+
store: Store.Atomic
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
/** Collects approvals for a multisig key authorization. @internal */
|
|
536
|
+
// biome-ignore lint/correctness/noUnusedVariables: declaration merge
|
|
537
|
+
async function approveKeyAuthorization(
|
|
538
|
+
options: approveKeyAuthorization.Options,
|
|
539
|
+
) {
|
|
540
|
+
const value = options.request.params?.[0]
|
|
541
|
+
if (!value || typeof value !== 'object')
|
|
542
|
+
throw new RpcResponse.InvalidParamsError({
|
|
543
|
+
message: 'Expected a multisig key authorization approval.',
|
|
544
|
+
})
|
|
545
|
+
|
|
546
|
+
const approval = await (async () => {
|
|
547
|
+
if ('keyAuthorization' in value) {
|
|
548
|
+
const authorization = (() => {
|
|
549
|
+
try {
|
|
550
|
+
return KeyAuthorization.fromRpc(
|
|
551
|
+
value.keyAuthorization as KeyAuthorization.Rpc,
|
|
552
|
+
)
|
|
553
|
+
} catch {
|
|
554
|
+
throw new RpcResponse.InvalidParamsError({
|
|
555
|
+
message: 'Invalid multisig key authorization.',
|
|
556
|
+
})
|
|
557
|
+
}
|
|
558
|
+
})()
|
|
559
|
+
const signature = authorization.signature
|
|
560
|
+
if (signature?.type !== 'multisig')
|
|
561
|
+
throw new RpcResponse.InvalidParamsError({
|
|
562
|
+
message: 'Expected a multisig key authorization signature.',
|
|
563
|
+
})
|
|
564
|
+
if (
|
|
565
|
+
!authorization.account ||
|
|
566
|
+
!Address_.isEqual(authorization.account, signature.account)
|
|
567
|
+
)
|
|
568
|
+
throw new RpcResponse.InvalidParamsError({
|
|
569
|
+
message:
|
|
570
|
+
'Multisig key authorization account does not match its signature.',
|
|
571
|
+
})
|
|
572
|
+
const { signature: _, ...unsigned } = authorization
|
|
573
|
+
const keyAuthorization = KeyAuthorization.serialize(
|
|
574
|
+
KeyAuthorization.from(unsigned),
|
|
575
|
+
)
|
|
576
|
+
const config = MultisigConfig.from(signature.config)
|
|
577
|
+
const hash = MultisigOperation.getHash({
|
|
578
|
+
account: signature.account,
|
|
579
|
+
config,
|
|
580
|
+
keyAuthorization,
|
|
581
|
+
type: 'keyAuthorization',
|
|
582
|
+
})
|
|
583
|
+
return {
|
|
584
|
+
account: signature.account,
|
|
585
|
+
approvals: signature.signatures.map((signature) =>
|
|
586
|
+
SignatureEnvelope.serialize(signature),
|
|
587
|
+
),
|
|
588
|
+
config,
|
|
589
|
+
hash,
|
|
590
|
+
keyAuthorization,
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
if ('hash' in value && 'signature' in value) {
|
|
595
|
+
if (typeof value.hash !== 'string' || !Hash.validate(value.hash))
|
|
596
|
+
throw new RpcResponse.InvalidParamsError({
|
|
597
|
+
message: 'Expected a multisig operation hash.',
|
|
598
|
+
})
|
|
599
|
+
const operation = await OperationStore.read(options.store, value.hash)
|
|
600
|
+
if (!operation || operation.type !== 'keyAuthorization')
|
|
601
|
+
throw new RpcResponse.InvalidParamsError({
|
|
602
|
+
message: 'Multisig key authorization operation was not found.',
|
|
603
|
+
})
|
|
604
|
+
if (operation.status === 'success') return { operation }
|
|
605
|
+
const signature = (() => {
|
|
606
|
+
try {
|
|
607
|
+
return SignatureEnvelope.serialize(
|
|
608
|
+
SignatureEnvelope.from(value.signature as Hex.Hex),
|
|
609
|
+
)
|
|
610
|
+
} catch {
|
|
611
|
+
throw new RpcResponse.InvalidParamsError({
|
|
612
|
+
message: 'Invalid multisig owner signature.',
|
|
613
|
+
})
|
|
614
|
+
}
|
|
615
|
+
})()
|
|
616
|
+
return {
|
|
617
|
+
account: operation.account,
|
|
618
|
+
approvals: [signature],
|
|
619
|
+
config: operation.config,
|
|
620
|
+
hash: operation.hash,
|
|
621
|
+
keyAuthorization: operation.keyAuthorization,
|
|
622
|
+
}
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
throw new RpcResponse.InvalidParamsError({
|
|
626
|
+
message: 'Expected a multisig key authorization approval.',
|
|
627
|
+
})
|
|
628
|
+
})()
|
|
629
|
+
if ('operation' in approval)
|
|
630
|
+
return MultisigOperation.toRpc(approval.operation)
|
|
631
|
+
if (approval.approvals.length === 0)
|
|
632
|
+
throw new RpcResponse.InvalidParamsError({
|
|
633
|
+
message: 'A multisig approval envelope must include a signature.',
|
|
634
|
+
})
|
|
635
|
+
|
|
636
|
+
const blockNumber = await getBlockNumber(options.client, { cacheTime: 0 })
|
|
637
|
+
const commitment = await validateConfig({
|
|
638
|
+
account: approval.account,
|
|
639
|
+
blockNumber,
|
|
640
|
+
client: options.client,
|
|
641
|
+
config: approval.config,
|
|
642
|
+
})
|
|
643
|
+
const now = Date.now()
|
|
644
|
+
const operation = await OperationStore.update(
|
|
645
|
+
options.store,
|
|
646
|
+
approval.hash,
|
|
647
|
+
async (existing) => {
|
|
648
|
+
if (existing && existing.type !== 'keyAuthorization')
|
|
649
|
+
throw new OperationStore.InvalidStoreValueError()
|
|
650
|
+
if (existing?.status === 'success') return existing
|
|
651
|
+
if (
|
|
652
|
+
existing &&
|
|
653
|
+
(existing.account.toLowerCase() !== approval.account.toLowerCase() ||
|
|
654
|
+
MultisigConfig.getCommitment(existing.config).toLowerCase() !==
|
|
655
|
+
MultisigConfig.getCommitment(approval.config).toLowerCase() ||
|
|
656
|
+
existing.keyAuthorization.toLowerCase() !==
|
|
657
|
+
approval.keyAuthorization.toLowerCase())
|
|
658
|
+
)
|
|
659
|
+
throw new OperationStore.InvalidStoreValueError()
|
|
660
|
+
const existingApprovals = existing
|
|
661
|
+
? await selectApprovals({
|
|
662
|
+
account: approval.account,
|
|
663
|
+
approvals: existing.approvals,
|
|
664
|
+
config: approval.config,
|
|
665
|
+
hash: approval.hash,
|
|
666
|
+
})
|
|
667
|
+
: undefined
|
|
668
|
+
const approvals = await selectApprovals({
|
|
669
|
+
account: approval.account,
|
|
670
|
+
approvals: [
|
|
671
|
+
...(existingApprovals?.approvals ?? []),
|
|
672
|
+
...approval.approvals,
|
|
673
|
+
],
|
|
674
|
+
config: approval.config,
|
|
675
|
+
hash: approval.hash,
|
|
676
|
+
})
|
|
677
|
+
if (
|
|
678
|
+
existing &&
|
|
679
|
+
approvals.approvals.length === existing.approvals.length &&
|
|
680
|
+
approvals.approvals.every(
|
|
681
|
+
(approval, index) => approval === existing.approvals[index],
|
|
682
|
+
)
|
|
683
|
+
)
|
|
684
|
+
return existing
|
|
685
|
+
const pending = {
|
|
686
|
+
account: approval.account,
|
|
687
|
+
approvals: approvals.approvals,
|
|
688
|
+
config: approval.config,
|
|
689
|
+
createdAt: existing?.createdAt ?? now,
|
|
690
|
+
hash: approval.hash,
|
|
691
|
+
keyAuthorization: approval.keyAuthorization,
|
|
692
|
+
signatureCount: approvals.signatureCount,
|
|
693
|
+
threshold: approvals.threshold,
|
|
694
|
+
type: 'keyAuthorization',
|
|
695
|
+
updatedAt: now,
|
|
696
|
+
weight: approvals.weight,
|
|
697
|
+
} as const
|
|
698
|
+
if (approvals.weight < approvals.threshold)
|
|
699
|
+
return MultisigOperation.from({ ...pending, status: 'pending' })
|
|
700
|
+
return MultisigOperation.from({
|
|
701
|
+
...pending,
|
|
702
|
+
keyAuthorization: MultisigOperation.serializeKeyAuthorization(
|
|
703
|
+
approval.keyAuthorization,
|
|
704
|
+
{
|
|
705
|
+
account: approval.account,
|
|
706
|
+
approvals: approvals.selectedApprovals,
|
|
707
|
+
config: approval.config,
|
|
708
|
+
},
|
|
709
|
+
),
|
|
710
|
+
status: 'success',
|
|
711
|
+
})
|
|
712
|
+
},
|
|
713
|
+
)
|
|
714
|
+
await ConfigStore.write(options.store, {
|
|
715
|
+
address: approval.account,
|
|
716
|
+
commitment,
|
|
717
|
+
config: approval.config,
|
|
718
|
+
})
|
|
719
|
+
if (operation.type !== 'keyAuthorization')
|
|
720
|
+
throw new OperationStore.InvalidStoreValueError()
|
|
721
|
+
return MultisigOperation.toRpc(operation)
|
|
722
|
+
}
|
|
723
|
+
|
|
724
|
+
declare namespace approveKeyAuthorization {
|
|
725
|
+
/** Options for {@link approveKeyAuthorization}. */
|
|
726
|
+
export type Options = {
|
|
727
|
+
/** Client used to validate configs. */
|
|
728
|
+
client: ReturnType<typeof createClient>
|
|
729
|
+
/** Original RPC request. */
|
|
730
|
+
request: Relay.handleRequest.Request
|
|
731
|
+
/** Shared multisig store. */
|
|
732
|
+
store: Store.Atomic
|
|
733
|
+
}
|
|
734
|
+
}
|
|
735
|
+
|
|
736
|
+
/** Deserializes a Tempo transaction or throws an RPC parameter error. */
|
|
737
|
+
function deserialize(serialized: Hex.Hex) {
|
|
738
|
+
try {
|
|
739
|
+
return TxEnvelopeTempo.deserialize(serialized as TxEnvelopeTempo.Serialized)
|
|
740
|
+
} catch {
|
|
741
|
+
throw new RpcResponse.InvalidParamsError({
|
|
742
|
+
message: 'Invalid serialized Tempo transaction.',
|
|
743
|
+
})
|
|
744
|
+
}
|
|
745
|
+
}
|
|
746
|
+
|
|
747
|
+
/** Validates a config against an observed chain commitment. */
|
|
748
|
+
function assertConfig(options: {
|
|
749
|
+
account: `0x${string}`
|
|
750
|
+
commitment: Hex.Hex
|
|
751
|
+
config: MultisigConfig.Config
|
|
752
|
+
}) {
|
|
753
|
+
const { account, commitment, config } = options
|
|
754
|
+
if (
|
|
755
|
+
config.version === 0n &&
|
|
756
|
+
MultisigConfig.getAddress(config, {
|
|
757
|
+
factory: Addresses.nativeMultisigFactory,
|
|
758
|
+
}).toLowerCase() !== account.toLowerCase()
|
|
759
|
+
)
|
|
760
|
+
throw new RpcResponse.InvalidParamsError({
|
|
761
|
+
message: 'Initial multisig config does not match the multisig account.',
|
|
762
|
+
})
|
|
763
|
+
if (config.version === 0n && Hex.toBigInt(commitment) === 0n) return
|
|
764
|
+
if (
|
|
765
|
+
commitment.toLowerCase() !==
|
|
766
|
+
MultisigConfig.getCommitment(config).toLowerCase()
|
|
767
|
+
)
|
|
768
|
+
throw new RpcResponse.InvalidParamsError({
|
|
769
|
+
message: `Multisig config does not match account ${account}.`,
|
|
770
|
+
})
|
|
771
|
+
}
|
|
772
|
+
|
|
773
|
+
/** Reads and validates a config commitment at one block. */
|
|
774
|
+
async function validateConfig(options: {
|
|
775
|
+
account: `0x${string}`
|
|
776
|
+
blockNumber: bigint
|
|
777
|
+
client: ReturnType<typeof createClient>
|
|
778
|
+
config: MultisigConfig.Config
|
|
779
|
+
}) {
|
|
780
|
+
const { account, blockNumber, client, config } = options
|
|
781
|
+
const commitment = await getConfigCommitment(client, {
|
|
782
|
+
account,
|
|
783
|
+
blockNumber,
|
|
784
|
+
})
|
|
785
|
+
assertConfig({ account, commitment, config })
|
|
786
|
+
return commitment
|
|
787
|
+
}
|
|
788
|
+
|
|
789
|
+
/** Caches candidate configs from valid native update calls. */
|
|
790
|
+
// biome-ignore lint/correctness/noUnusedVariables: declaration merge
|
|
791
|
+
async function cacheNextConfigs(options: cacheNextConfigs.Options) {
|
|
792
|
+
let currentConfig = options.config
|
|
793
|
+
for (const call of options.transaction.calls) {
|
|
794
|
+
if (
|
|
795
|
+
!call.to ||
|
|
796
|
+
!Address_.isEqual(call.to, Addresses.nativeMultisig) ||
|
|
797
|
+
!call.data
|
|
798
|
+
)
|
|
799
|
+
continue
|
|
800
|
+
const decoded = (() => {
|
|
801
|
+
try {
|
|
802
|
+
const item = AbiFunction.fromAbi(Abis.nativeMultisig, 'updateConfig')
|
|
803
|
+
if (!call.data.startsWith(AbiFunction.getSelector(item)))
|
|
804
|
+
return undefined
|
|
805
|
+
return {
|
|
806
|
+
functionName: item.name,
|
|
807
|
+
args: AbiFunction.decodeData(item, call.data),
|
|
808
|
+
}
|
|
809
|
+
} catch {
|
|
810
|
+
return undefined
|
|
811
|
+
}
|
|
812
|
+
})()
|
|
813
|
+
if (decoded?.functionName !== 'updateConfig') continue
|
|
814
|
+
const [current, threshold, owners] = decoded.args
|
|
815
|
+
const suppliedConfig = (() => {
|
|
816
|
+
try {
|
|
817
|
+
return MultisigConfig.from(current)
|
|
818
|
+
} catch {
|
|
819
|
+
return undefined
|
|
820
|
+
}
|
|
821
|
+
})()
|
|
822
|
+
if (
|
|
823
|
+
!suppliedConfig ||
|
|
824
|
+
MultisigConfig.getCommitment(suppliedConfig).toLowerCase() !==
|
|
825
|
+
MultisigConfig.getCommitment(currentConfig).toLowerCase()
|
|
826
|
+
)
|
|
827
|
+
continue
|
|
828
|
+
const config = (() => {
|
|
829
|
+
try {
|
|
830
|
+
return MultisigConfig.from({
|
|
831
|
+
owners,
|
|
832
|
+
salt: suppliedConfig.salt,
|
|
833
|
+
threshold,
|
|
834
|
+
version: suppliedConfig.version + 1n,
|
|
835
|
+
})
|
|
836
|
+
} catch {
|
|
837
|
+
return undefined
|
|
838
|
+
}
|
|
839
|
+
})()
|
|
840
|
+
if (!config) continue
|
|
841
|
+
await ConfigStore.write(options.store, {
|
|
842
|
+
address: options.account,
|
|
843
|
+
commitment: MultisigConfig.getCommitment(config),
|
|
844
|
+
config,
|
|
845
|
+
})
|
|
846
|
+
currentConfig = config
|
|
847
|
+
}
|
|
848
|
+
}
|
|
849
|
+
|
|
850
|
+
declare namespace cacheNextConfigs {
|
|
851
|
+
/** Parameters for {@link cacheNextConfigs}. */
|
|
852
|
+
export type Options = {
|
|
853
|
+
/** Root multisig account. */
|
|
854
|
+
account: Address
|
|
855
|
+
/** Root config used to authorize the transaction. */
|
|
856
|
+
config: MultisigConfig.Config
|
|
857
|
+
/** Shared multisig store. */
|
|
858
|
+
store: Store.Store
|
|
859
|
+
/** Submitted transaction containing potential config updates. */
|
|
860
|
+
transaction: TxEnvelopeTempo.TxEnvelopeTempo
|
|
861
|
+
}
|
|
862
|
+
}
|
|
863
|
+
|
|
864
|
+
/** Validates primitive approvals and translates invalid input into an RPC error. */
|
|
865
|
+
async function selectApprovals(
|
|
866
|
+
options: MultisigOperation.selectApprovals.Options,
|
|
867
|
+
) {
|
|
868
|
+
try {
|
|
869
|
+
return await MultisigOperation.selectApprovals(options)
|
|
870
|
+
} catch (error) {
|
|
871
|
+
if (error instanceof MultisigOperation.InvalidApprovalError)
|
|
872
|
+
throw new RpcResponse.InvalidParamsError({ message: error.shortMessage })
|
|
873
|
+
throw error
|
|
874
|
+
}
|
|
875
|
+
}
|
|
876
|
+
|
|
877
|
+
/** Returns an existing successful operation through the requested send method. */
|
|
878
|
+
async function submittedResult(
|
|
879
|
+
options: submit.Options,
|
|
880
|
+
operation: MultisigOperation.TransactionOperation,
|
|
881
|
+
) {
|
|
882
|
+
if (
|
|
883
|
+
options.method === 'eth_sendRawTransaction' ||
|
|
884
|
+
options.method === 'multisig_approveRawTransaction'
|
|
885
|
+
)
|
|
886
|
+
return operation.hash
|
|
887
|
+
if (options.method === 'multisig_approveRawTransactionSync')
|
|
888
|
+
return MultisigOperation.toRpc(operation)
|
|
889
|
+
const timeout = options.request.params?.[1]
|
|
890
|
+
const deadline =
|
|
891
|
+
Date.now() +
|
|
892
|
+
(typeof timeout === 'number' && timeout >= 0 ? timeout : submissionTtl)
|
|
893
|
+
while (true) {
|
|
894
|
+
const receipt = await options.next(
|
|
895
|
+
{
|
|
896
|
+
method: 'eth_getTransactionReceipt',
|
|
897
|
+
params: [operation.transactionHash],
|
|
898
|
+
},
|
|
899
|
+
options.requestOptions,
|
|
900
|
+
)
|
|
901
|
+
if (receipt && typeof receipt === 'object')
|
|
902
|
+
return { ...receipt, multisig: MultisigOperation.toRpc(operation) }
|
|
903
|
+
if (Date.now() >= deadline)
|
|
904
|
+
throw new Error('Timed out while waiting for the multisig transaction.')
|
|
905
|
+
await new Promise((resolve) => setTimeout(resolve, pollingInterval))
|
|
906
|
+
}
|
|
907
|
+
}
|
|
908
|
+
|
|
909
|
+
/** Waits for the relay that owns a live submission lease. */
|
|
910
|
+
async function submittingResult(
|
|
911
|
+
options: submit.Options,
|
|
912
|
+
operation: MultisigOperation.TransactionOperation,
|
|
913
|
+
): Promise<unknown> {
|
|
914
|
+
if (
|
|
915
|
+
options.method === 'eth_sendRawTransaction' ||
|
|
916
|
+
options.method === 'multisig_approveRawTransaction'
|
|
917
|
+
)
|
|
918
|
+
return operation.hash
|
|
919
|
+
const timeout = options.request.params?.[1]
|
|
920
|
+
const deadline =
|
|
921
|
+
Date.now() +
|
|
922
|
+
(typeof timeout === 'number' && timeout >= 0 ? timeout : submissionTtl)
|
|
923
|
+
while (true) {
|
|
924
|
+
const current = await OperationStore.read(options.store, operation.hash)
|
|
925
|
+
if (!current || current.type !== 'transaction')
|
|
926
|
+
throw new OperationStore.InvalidStoreValueError()
|
|
927
|
+
if (current.status === 'success')
|
|
928
|
+
return await submittedResult(options, current)
|
|
929
|
+
if (current.status === 'pending' || current.expiresAt! <= Date.now())
|
|
930
|
+
return await submit(options)
|
|
931
|
+
if (Date.now() >= deadline) return pendingResult(options.method, current)
|
|
932
|
+
await new Promise((resolve) => setTimeout(resolve, pollingInterval))
|
|
933
|
+
}
|
|
934
|
+
}
|
|
935
|
+
|
|
936
|
+
/** Returns a pending result for an operation that has not reached quorum. */
|
|
937
|
+
function pendingResult(
|
|
938
|
+
method: submit.Options['method'],
|
|
939
|
+
operation: MultisigOperation.TransactionOperation,
|
|
940
|
+
) {
|
|
941
|
+
if (
|
|
942
|
+
method === 'eth_sendRawTransaction' ||
|
|
943
|
+
method === 'multisig_approveRawTransaction'
|
|
944
|
+
)
|
|
945
|
+
return operation.hash
|
|
946
|
+
if (method === 'multisig_approveRawTransactionSync')
|
|
947
|
+
return MultisigOperation.toRpc(operation)
|
|
948
|
+
return {
|
|
949
|
+
blockHash: null,
|
|
950
|
+
blockNumber: null,
|
|
951
|
+
contractAddress: null,
|
|
952
|
+
cumulativeGasUsed: null,
|
|
953
|
+
effectiveGasPrice: null,
|
|
954
|
+
from: operation.account,
|
|
955
|
+
gasUsed: null,
|
|
956
|
+
logs: [],
|
|
957
|
+
logsBloom: null,
|
|
958
|
+
multisig: MultisigOperation.toRpc(operation),
|
|
959
|
+
status: 'pending',
|
|
960
|
+
to: null,
|
|
961
|
+
transactionHash: operation.hash,
|
|
962
|
+
transactionIndex: null,
|
|
963
|
+
type: '0x76',
|
|
964
|
+
} as const
|
|
965
|
+
}
|
|
966
|
+
|
|
967
|
+
/** Marks a transaction as successful after a lookup proves that it was submitted. */
|
|
968
|
+
async function completeSubmission(
|
|
969
|
+
store: Store.Atomic,
|
|
970
|
+
operation: MultisigOperation.TransactionOperation,
|
|
971
|
+
transactionHash: Hex.Hex,
|
|
972
|
+
) {
|
|
973
|
+
if (operation.status !== 'submitting' || !operation.submissionId)
|
|
974
|
+
throw new OperationStore.InvalidStoreValueError()
|
|
975
|
+
const success = await OperationStore.update(
|
|
976
|
+
store,
|
|
977
|
+
operation.hash,
|
|
978
|
+
(current) => {
|
|
979
|
+
if (!current || current.type !== 'transaction')
|
|
980
|
+
throw new OperationStore.InvalidStoreValueError()
|
|
981
|
+
if (current.status === 'success') {
|
|
982
|
+
if (
|
|
983
|
+
current.transactionHash?.toLowerCase() !==
|
|
984
|
+
transactionHash.toLowerCase()
|
|
985
|
+
)
|
|
986
|
+
throw new OperationStore.InvalidStoreValueError()
|
|
987
|
+
return current
|
|
988
|
+
}
|
|
989
|
+
if (
|
|
990
|
+
current.status !== 'submitting' ||
|
|
991
|
+
current.submissionId !== operation.submissionId
|
|
992
|
+
)
|
|
993
|
+
throw new OperationStore.InvalidStoreValueError()
|
|
994
|
+
const {
|
|
995
|
+
expiresAt: _,
|
|
996
|
+
submissionId: __,
|
|
997
|
+
transactionHash: ___,
|
|
998
|
+
...value
|
|
999
|
+
} = current
|
|
1000
|
+
return MultisigOperation.from({
|
|
1001
|
+
...value,
|
|
1002
|
+
status: 'success',
|
|
1003
|
+
transactionHash,
|
|
1004
|
+
updatedAt: Date.now(),
|
|
1005
|
+
})
|
|
1006
|
+
},
|
|
1007
|
+
)
|
|
1008
|
+
await removeSettledSubmission(store, operation.hash, operation.submissionId)
|
|
1009
|
+
return success as MultisigOperation.TransactionOperation
|
|
1010
|
+
}
|
|
1011
|
+
|
|
1012
|
+
/** Releases a failed submission lease without discarding collected approvals. */
|
|
1013
|
+
async function releaseSubmission(
|
|
1014
|
+
store: Store.Atomic,
|
|
1015
|
+
hash: Hex.Hex,
|
|
1016
|
+
submissionId: Hex.Hex,
|
|
1017
|
+
) {
|
|
1018
|
+
await OperationStore.update(store, hash, (current) => {
|
|
1019
|
+
if (!current || current.type !== 'transaction')
|
|
1020
|
+
throw new OperationStore.InvalidStoreValueError()
|
|
1021
|
+
if (
|
|
1022
|
+
current.status !== 'submitting' ||
|
|
1023
|
+
current.submissionId !== submissionId
|
|
1024
|
+
)
|
|
1025
|
+
return current
|
|
1026
|
+
const { expiresAt: _, submissionId: __, ...operation } = current
|
|
1027
|
+
return MultisigOperation.from({
|
|
1028
|
+
...operation,
|
|
1029
|
+
status: 'pending',
|
|
1030
|
+
updatedAt: Date.now(),
|
|
1031
|
+
})
|
|
1032
|
+
})
|
|
1033
|
+
await OperationStore.removeSubmission(store, hash, submissionId)
|
|
1034
|
+
}
|
|
1035
|
+
|
|
1036
|
+
/** Removes settled submission data without replacing a successful result with a cleanup error. */
|
|
1037
|
+
async function removeSettledSubmission(
|
|
1038
|
+
store: Store.Store,
|
|
1039
|
+
hash: Hex.Hex,
|
|
1040
|
+
submissionId: Hex.Hex,
|
|
1041
|
+
) {
|
|
1042
|
+
try {
|
|
1043
|
+
await OperationStore.removeSubmission(store, hash, submissionId)
|
|
1044
|
+
} catch {}
|
|
1045
|
+
}
|
|
1046
|
+
|
|
1047
|
+
/** Preserves or upgrades a fee-payer envelope without removing an existing signature. */
|
|
1048
|
+
function mergeTransaction(existing: Hex.Hex | undefined, incoming: Hex.Hex) {
|
|
1049
|
+
if (!existing) return incoming
|
|
1050
|
+
const existingTransaction = TxEnvelopeTempo.deserialize(
|
|
1051
|
+
existing as TxEnvelopeTempo.Serialized,
|
|
1052
|
+
)
|
|
1053
|
+
const incomingTransaction = TxEnvelopeTempo.deserialize(
|
|
1054
|
+
incoming as TxEnvelopeTempo.Serialized,
|
|
1055
|
+
)
|
|
1056
|
+
if (!('feePayerSignature' in incomingTransaction)) return existing
|
|
1057
|
+
if (incomingTransaction.feePayerSignature !== null) return incoming
|
|
1058
|
+
if (!('feePayerSignature' in existingTransaction)) return incoming
|
|
1059
|
+
return existing
|
|
1060
|
+
}
|
|
1061
|
+
|
|
1062
|
+
/** Returns a synthetic transaction while the downstream transaction is unavailable. */
|
|
1063
|
+
async function toTransaction(
|
|
1064
|
+
client: ReturnType<typeof createClient>,
|
|
1065
|
+
operation: MultisigOperation.TransactionOperation,
|
|
1066
|
+
) {
|
|
1067
|
+
const approvals = await (async () => {
|
|
1068
|
+
if (operation.status !== 'pending')
|
|
1069
|
+
return await MultisigOperation.selectApprovals({
|
|
1070
|
+
account: operation.account,
|
|
1071
|
+
approvals: operation.approvals,
|
|
1072
|
+
config: operation.config,
|
|
1073
|
+
hash: operation.hash,
|
|
1074
|
+
})
|
|
1075
|
+
const blockNumber = await getBlockNumber(client, { cacheTime: 0 })
|
|
1076
|
+
await validateConfig({
|
|
1077
|
+
account: operation.account,
|
|
1078
|
+
blockNumber,
|
|
1079
|
+
client,
|
|
1080
|
+
config: operation.config,
|
|
1081
|
+
})
|
|
1082
|
+
return await selectApprovals({
|
|
1083
|
+
account: operation.account,
|
|
1084
|
+
approvals: operation.approvals,
|
|
1085
|
+
config: operation.config,
|
|
1086
|
+
hash: operation.hash,
|
|
1087
|
+
})
|
|
1088
|
+
})()
|
|
1089
|
+
const current =
|
|
1090
|
+
operation.status === 'pending'
|
|
1091
|
+
? MultisigOperation.from({
|
|
1092
|
+
...operation,
|
|
1093
|
+
approvals: approvals.approvals,
|
|
1094
|
+
signatureCount: approvals.signatureCount,
|
|
1095
|
+
threshold: approvals.threshold,
|
|
1096
|
+
weight: approvals.weight,
|
|
1097
|
+
})
|
|
1098
|
+
: operation
|
|
1099
|
+
const serialized = MultisigOperation.serializeTransaction(current, {
|
|
1100
|
+
approvals: approvals.selectedApprovals,
|
|
1101
|
+
})
|
|
1102
|
+
const transaction = deserialize(serialized)
|
|
1103
|
+
return {
|
|
1104
|
+
...ox_Transaction.toRpc(
|
|
1105
|
+
{
|
|
1106
|
+
...transaction,
|
|
1107
|
+
blockHash: null,
|
|
1108
|
+
blockNumber: null,
|
|
1109
|
+
from: operation.account,
|
|
1110
|
+
hash: operation.hash,
|
|
1111
|
+
transactionIndex: null,
|
|
1112
|
+
} as Parameters<typeof ox_Transaction.toRpc>[0],
|
|
1113
|
+
{ pending: true },
|
|
1114
|
+
),
|
|
1115
|
+
multisig: MultisigOperation.toRpc(current),
|
|
1116
|
+
}
|
|
1117
|
+
}
|
|
1118
|
+
|
|
1119
|
+
/** Returns the persisted transaction hash for a submitting or successful operation. */
|
|
1120
|
+
async function getSubmittedTransactionHash(
|
|
1121
|
+
store: Store.Store,
|
|
1122
|
+
operation: MultisigOperation.TransactionOperation,
|
|
1123
|
+
) {
|
|
1124
|
+
if (operation.status === 'success') return operation.transactionHash!
|
|
1125
|
+
if (operation.status !== 'submitting' || !operation.submissionId)
|
|
1126
|
+
throw new OperationStore.InvalidStoreValueError()
|
|
1127
|
+
return await OperationStore.readSubmission(
|
|
1128
|
+
store,
|
|
1129
|
+
operation,
|
|
1130
|
+
operation.submissionId,
|
|
1131
|
+
)
|
|
1132
|
+
}
|
|
1133
|
+
|
|
1134
|
+
/** Renews a submission lease until the returned cleanup function runs. */
|
|
1135
|
+
function maintainSubmissionLease(
|
|
1136
|
+
store: Store.Atomic,
|
|
1137
|
+
hash: Hex.Hex,
|
|
1138
|
+
submissionId: Hex.Hex,
|
|
1139
|
+
leaseTtl: number,
|
|
1140
|
+
) {
|
|
1141
|
+
let active = true
|
|
1142
|
+
let error: unknown
|
|
1143
|
+
let renewal = Promise.resolve()
|
|
1144
|
+
const timer = setInterval(() => {
|
|
1145
|
+
renewal = renewal.then(async () => {
|
|
1146
|
+
if (!active || error) return
|
|
1147
|
+
try {
|
|
1148
|
+
const operation = await OperationStore.update(
|
|
1149
|
+
store,
|
|
1150
|
+
hash,
|
|
1151
|
+
(current) => {
|
|
1152
|
+
if (!current || current.type !== 'transaction')
|
|
1153
|
+
throw new OperationStore.InvalidStoreValueError()
|
|
1154
|
+
if (
|
|
1155
|
+
current.status !== 'submitting' ||
|
|
1156
|
+
current.submissionId !== submissionId
|
|
1157
|
+
)
|
|
1158
|
+
return current
|
|
1159
|
+
return MultisigOperation.from({
|
|
1160
|
+
...current,
|
|
1161
|
+
expiresAt: Math.min(
|
|
1162
|
+
Date.now() + leaseTtl,
|
|
1163
|
+
Number.MAX_SAFE_INTEGER,
|
|
1164
|
+
),
|
|
1165
|
+
updatedAt: Date.now(),
|
|
1166
|
+
})
|
|
1167
|
+
},
|
|
1168
|
+
)
|
|
1169
|
+
if (
|
|
1170
|
+
operation.type !== 'transaction' ||
|
|
1171
|
+
operation.status !== 'submitting' ||
|
|
1172
|
+
operation.submissionId !== submissionId
|
|
1173
|
+
)
|
|
1174
|
+
throw new OperationStore.InvalidStoreValueError()
|
|
1175
|
+
} catch (cause) {
|
|
1176
|
+
error = cause
|
|
1177
|
+
}
|
|
1178
|
+
})
|
|
1179
|
+
}, submissionTtl / 2)
|
|
1180
|
+
|
|
1181
|
+
return async () => {
|
|
1182
|
+
active = false
|
|
1183
|
+
clearInterval(timer)
|
|
1184
|
+
await renewal
|
|
1185
|
+
if (error) throw error
|
|
1186
|
+
}
|
|
1187
|
+
}
|
|
1188
|
+
|
|
1189
|
+
/** Canonically serializes an unsigned Tempo transaction. */
|
|
1190
|
+
function serializeUnsigned(
|
|
1191
|
+
envelope: Omit<TxEnvelopeTempo.TxEnvelopeTempo, 'signature'>,
|
|
1192
|
+
feePayer: boolean,
|
|
1193
|
+
) {
|
|
1194
|
+
return TxEnvelopeTempo.serialize(
|
|
1195
|
+
envelope,
|
|
1196
|
+
feePayer
|
|
1197
|
+
? envelope.from
|
|
1198
|
+
? { format: 'feePayer', sender: envelope.from }
|
|
1199
|
+
: { format: 'feePayer' }
|
|
1200
|
+
: {},
|
|
1201
|
+
)
|
|
1202
|
+
}
|
|
1203
|
+
|
|
1204
|
+
/** Extracts a transaction hash from an RPC submission result. */
|
|
1205
|
+
function getTransactionHash(result: unknown): Hex.Hex {
|
|
1206
|
+
if (typeof result === 'string' && Hash.validate(result)) return result
|
|
1207
|
+
if (
|
|
1208
|
+
result &&
|
|
1209
|
+
typeof result === 'object' &&
|
|
1210
|
+
'transactionHash' in result &&
|
|
1211
|
+
typeof result.transactionHash === 'string' &&
|
|
1212
|
+
Hash.validate(result.transactionHash)
|
|
1213
|
+
)
|
|
1214
|
+
return result.transactionHash
|
|
1215
|
+
throw new Error('Expected transaction hash in multisig broadcast result.')
|
|
1216
|
+
}
|
|
1217
|
+
|
|
1218
|
+
/** Resolves and validates the chain used by a handled request. */
|
|
1219
|
+
async function resolveRequestOptions(options: {
|
|
1220
|
+
request: Relay.handleRequest.Request
|
|
1221
|
+
requestOptions?: Relay.handleRequest.RequestOptions | undefined
|
|
1222
|
+
store: Store.Store
|
|
1223
|
+
}): Promise<Relay.handleRequest.RequestOptions | undefined> {
|
|
1224
|
+
const { request, requestOptions, store } = options
|
|
1225
|
+
const chainId_explicit = requestOptions?.chainId
|
|
1226
|
+
if (
|
|
1227
|
+
chainId_explicit !== undefined &&
|
|
1228
|
+
(!Number.isSafeInteger(chainId_explicit) || chainId_explicit <= 0)
|
|
1229
|
+
)
|
|
1230
|
+
throw new RpcResponse.InvalidParamsError({
|
|
1231
|
+
message: 'Expected a valid chain ID.',
|
|
1232
|
+
})
|
|
1233
|
+
const chainId_request = await resolveRequestChainId(request, store)
|
|
1234
|
+
if (
|
|
1235
|
+
chainId_explicit !== undefined &&
|
|
1236
|
+
chainId_request !== undefined &&
|
|
1237
|
+
chainId_explicit !== chainId_request
|
|
1238
|
+
)
|
|
1239
|
+
throw new RpcResponse.InvalidParamsError({
|
|
1240
|
+
message: 'Conflicting chain ids.',
|
|
1241
|
+
})
|
|
1242
|
+
const chainId = chainId_explicit ?? chainId_request
|
|
1243
|
+
if (chainId === undefined) return requestOptions
|
|
1244
|
+
return { ...requestOptions, chainId }
|
|
1245
|
+
}
|
|
1246
|
+
|
|
1247
|
+
/** Resolves a chain from request fields, envelopes, or stored operations. */
|
|
1248
|
+
async function resolveRequestChainId(
|
|
1249
|
+
request: Relay.handleRequest.Request,
|
|
1250
|
+
store: Store.Store,
|
|
1251
|
+
) {
|
|
1252
|
+
const value = request.params?.[0]
|
|
1253
|
+
const chainId_body =
|
|
1254
|
+
value && typeof value === 'object' && 'chainId' in value
|
|
1255
|
+
? parseChainId(value.chainId)
|
|
1256
|
+
: undefined
|
|
1257
|
+
const chainId_multisig = await (async () => {
|
|
1258
|
+
if (
|
|
1259
|
+
request.method === 'eth_sendRawTransaction' ||
|
|
1260
|
+
request.method === 'eth_sendRawTransactionSync' ||
|
|
1261
|
+
request.method === 'multisig_approveRawTransaction' ||
|
|
1262
|
+
request.method === 'multisig_approveRawTransactionSync'
|
|
1263
|
+
) {
|
|
1264
|
+
if (!isSerializedTempoTransaction(value)) return undefined
|
|
1265
|
+
try {
|
|
1266
|
+
return parseChainId(
|
|
1267
|
+
TxEnvelopeTempo.deserialize(value as TxEnvelopeTempo.Serialized)
|
|
1268
|
+
.chainId,
|
|
1269
|
+
)
|
|
1270
|
+
} catch {
|
|
1271
|
+
return undefined
|
|
1272
|
+
}
|
|
1273
|
+
}
|
|
1274
|
+
|
|
1275
|
+
if (
|
|
1276
|
+
request.method === 'multisig_approveKeyAuthorization' &&
|
|
1277
|
+
value &&
|
|
1278
|
+
typeof value === 'object' &&
|
|
1279
|
+
'keyAuthorization' in value
|
|
1280
|
+
) {
|
|
1281
|
+
try {
|
|
1282
|
+
return parseChainId(
|
|
1283
|
+
KeyAuthorization.fromRpc(
|
|
1284
|
+
value.keyAuthorization as KeyAuthorization.Rpc,
|
|
1285
|
+
).chainId,
|
|
1286
|
+
)
|
|
1287
|
+
} catch {
|
|
1288
|
+
return undefined
|
|
1289
|
+
}
|
|
1290
|
+
}
|
|
1291
|
+
|
|
1292
|
+
const hash = (() => {
|
|
1293
|
+
if (
|
|
1294
|
+
request.method === 'eth_getTransactionByHash' ||
|
|
1295
|
+
request.method === 'eth_getTransactionReceipt'
|
|
1296
|
+
)
|
|
1297
|
+
return value
|
|
1298
|
+
if (
|
|
1299
|
+
request.method === 'multisig_approveKeyAuthorization' &&
|
|
1300
|
+
value &&
|
|
1301
|
+
typeof value === 'object' &&
|
|
1302
|
+
'hash' in value
|
|
1303
|
+
)
|
|
1304
|
+
return value.hash
|
|
1305
|
+
return undefined
|
|
1306
|
+
})()
|
|
1307
|
+
if (typeof hash !== 'string' || !Hash.validate(hash)) return undefined
|
|
1308
|
+
const operation = await OperationStore.read(store, hash)
|
|
1309
|
+
if (!operation) return undefined
|
|
1310
|
+
if (operation.type === 'transaction')
|
|
1311
|
+
return parseChainId(
|
|
1312
|
+
TxEnvelopeTempo.deserialize(
|
|
1313
|
+
operation.transaction as TxEnvelopeTempo.Serialized,
|
|
1314
|
+
).chainId,
|
|
1315
|
+
)
|
|
1316
|
+
return parseChainId(
|
|
1317
|
+
KeyAuthorization.deserialize(operation.keyAuthorization).chainId,
|
|
1318
|
+
)
|
|
1319
|
+
})()
|
|
1320
|
+
|
|
1321
|
+
if (
|
|
1322
|
+
chainId_body !== undefined &&
|
|
1323
|
+
chainId_multisig !== undefined &&
|
|
1324
|
+
chainId_body !== chainId_multisig
|
|
1325
|
+
)
|
|
1326
|
+
throw new RpcResponse.InvalidParamsError({
|
|
1327
|
+
message: 'Conflicting chain ids.',
|
|
1328
|
+
})
|
|
1329
|
+
return chainId_body ?? chainId_multisig
|
|
1330
|
+
}
|
|
1331
|
+
|
|
1332
|
+
/** Parses a supported chain ID representation. */
|
|
1333
|
+
function parseChainId(value: unknown) {
|
|
1334
|
+
const chainId = (() => {
|
|
1335
|
+
if (typeof value === 'number') return value
|
|
1336
|
+
if (typeof value === 'bigint') return Number(value)
|
|
1337
|
+
if (typeof value === 'string' && Hex.validate(value)) {
|
|
1338
|
+
try {
|
|
1339
|
+
return Hex.toNumber(value)
|
|
1340
|
+
} catch {
|
|
1341
|
+
return undefined
|
|
1342
|
+
}
|
|
1343
|
+
}
|
|
1344
|
+
return undefined
|
|
1345
|
+
})()
|
|
1346
|
+
if (chainId === undefined || !Number.isSafeInteger(chainId) || chainId <= 0)
|
|
1347
|
+
return undefined
|
|
1348
|
+
return chainId
|
|
1349
|
+
}
|
|
1350
|
+
|
|
1351
|
+
/** Checks whether a value is a serialized Tempo transaction. */
|
|
1352
|
+
function isSerializedTempoTransaction(value: unknown): value is Hex.Hex {
|
|
1353
|
+
return (
|
|
1354
|
+
typeof value === 'string' &&
|
|
1355
|
+
(value.startsWith('0x76') || value.startsWith('0x78'))
|
|
1356
|
+
)
|
|
1357
|
+
}
|