viem 2.57.4 → 2.57.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +34 -0
- package/_cjs/actions/public/waitForTransactionReceipt.js +5 -2
- package/_cjs/actions/public/waitForTransactionReceipt.js.map +1 -1
- package/_cjs/actions/wallet/waitForCallsStatus.js +25 -2
- package/_cjs/actions/wallet/waitForCallsStatus.js.map +1 -1
- package/_cjs/chains/definitions/arcTestnet.js +11 -8
- package/_cjs/chains/definitions/arcTestnet.js.map +1 -1
- package/_cjs/chains/definitions/qmsTestnet.js +30 -0
- package/_cjs/chains/definitions/qmsTestnet.js.map +1 -0
- package/_cjs/chains/definitions/tempo.js +1 -1
- package/_cjs/chains/definitions/tempoModerato.js +2 -2
- package/_cjs/chains/index.js +7 -5
- package/_cjs/chains/index.js.map +1 -1
- package/_cjs/clients/transports/ipc.js +19 -10
- package/_cjs/clients/transports/ipc.js.map +1 -1
- package/_cjs/clients/transports/webSocket.js +19 -10
- package/_cjs/clients/transports/webSocket.js.map +1 -1
- package/_cjs/errors/version.js +1 -1
- package/_cjs/tempo/Abis.js +297 -1
- package/_cjs/tempo/Abis.js.map +1 -1
- package/_cjs/tempo/Account.js +40 -40
- package/_cjs/tempo/Account.js.map +1 -1
- package/_cjs/tempo/Addresses.js +2 -1
- package/_cjs/tempo/Addresses.js.map +1 -1
- package/_cjs/tempo/Decorator.js +9 -8
- package/_cjs/tempo/Decorator.js.map +1 -1
- package/_cjs/tempo/ExecutionError.js +95 -4
- package/_cjs/tempo/ExecutionError.js.map +1 -1
- package/_cjs/tempo/Formatters.js +8 -7
- package/_cjs/tempo/Formatters.js.map +1 -1
- package/_cjs/tempo/KeyAuthorizationManager.js +25 -16
- package/_cjs/tempo/KeyAuthorizationManager.js.map +1 -1
- package/_cjs/tempo/Relay.js +9 -4
- package/_cjs/tempo/Relay.js.map +1 -1
- package/_cjs/tempo/Transaction.js +9 -9
- package/_cjs/tempo/Transaction.js.map +1 -1
- package/_cjs/tempo/Transport.js +21 -11
- package/_cjs/tempo/Transport.js.map +1 -1
- package/_cjs/tempo/{multisig → accounts}/Config.js +8 -8
- package/_cjs/tempo/{multisig → accounts}/Config.js.map +1 -1
- package/_cjs/tempo/{multisig → accounts}/Operation.js +10 -10
- package/_cjs/tempo/{multisig → accounts}/Operation.js.map +1 -1
- package/_cjs/tempo/{multisig → accounts}/Signature.js +2 -2
- package/_cjs/tempo/accounts/Signature.js.map +1 -0
- package/_cjs/tempo/actions/accessKey.js +442 -47
- package/_cjs/tempo/actions/accessKey.js.map +1 -1
- package/_cjs/tempo/actions/{multisig.js → accounts.js} +16 -20
- package/_cjs/tempo/actions/accounts.js.map +1 -0
- package/_cjs/tempo/actions/amm.js +90 -4
- package/_cjs/tempo/actions/amm.js.map +1 -1
- package/_cjs/tempo/actions/channel.js +183 -7
- package/_cjs/tempo/actions/channel.js.map +1 -1
- package/_cjs/tempo/actions/dex.js +507 -14
- package/_cjs/tempo/actions/dex.js.map +1 -1
- package/_cjs/tempo/actions/earn/deployment.js +4 -3
- package/_cjs/tempo/actions/earn/deployment.js.map +1 -1
- package/_cjs/tempo/actions/earn.js +22 -21
- package/_cjs/tempo/actions/earn.js.map +1 -1
- package/_cjs/tempo/actions/fee.js +85 -5
- package/_cjs/tempo/actions/fee.js.map +1 -1
- package/_cjs/tempo/actions/index.js +2 -2
- package/_cjs/tempo/actions/index.js.map +1 -1
- package/_cjs/tempo/actions/nonce.js +54 -1
- package/_cjs/tempo/actions/nonce.js.map +1 -1
- package/_cjs/tempo/actions/policy.js +35 -6
- package/_cjs/tempo/actions/policy.js.map +1 -1
- package/_cjs/tempo/actions/propAmm.js +18 -8
- package/_cjs/tempo/actions/propAmm.js.map +1 -1
- package/_cjs/tempo/actions/receivePolicy.js +7 -6
- package/_cjs/tempo/actions/receivePolicy.js.map +1 -1
- package/_cjs/tempo/actions/reward.js +7 -6
- package/_cjs/tempo/actions/reward.js.map +1 -1
- package/_cjs/tempo/actions/token.js +433 -22
- package/_cjs/tempo/actions/token.js.map +1 -1
- package/_cjs/tempo/actions/validator.js +12 -11
- package/_cjs/tempo/actions/validator.js.map +1 -1
- package/_cjs/tempo/actions/virtualAddress.js +3 -2
- package/_cjs/tempo/actions/virtualAddress.js.map +1 -1
- package/_cjs/tempo/actions/zone.js +12 -11
- package/_cjs/tempo/actions/zone.js.map +1 -1
- package/_cjs/tempo/chainConfig.js +37 -37
- package/_cjs/tempo/chainConfig.js.map +1 -1
- package/_cjs/tempo/errors.js +57 -1
- package/_cjs/tempo/errors.js.map +1 -1
- package/_cjs/tempo/index.js +3 -3
- package/_cjs/tempo/index.js.map +1 -1
- package/_cjs/tempo/internal/errors.js +46 -0
- package/_cjs/tempo/internal/errors.js.map +1 -0
- package/_cjs/tempo/internal/relay/{multisig.js → accounts.js} +90 -93
- package/_cjs/tempo/internal/relay/accounts.js.map +1 -0
- package/_cjs/tempo/internal/relay/keyAuthorization.js +296 -0
- package/_cjs/tempo/internal/relay/keyAuthorization.js.map +1 -0
- package/_cjs/tempo/internal/relay/plugin.js +17 -7
- package/_cjs/tempo/internal/relay/plugin.js.map +1 -1
- package/_cjs/tempo/internal/resolveError.js +128 -0
- package/_cjs/tempo/internal/resolveError.js.map +1 -0
- package/_cjs/tempo/internal/utils.js +1 -0
- package/_cjs/tempo/internal/utils.js.map +1 -1
- package/_cjs/utils/hash/normalizeSignature.js +1 -1
- package/_cjs/utils/hash/normalizeSignature.js.map +1 -1
- package/_cjs/utils/rpc/http.js +66 -31
- package/_cjs/utils/rpc/http.js.map +1 -1
- package/_cjs/utils/rpc/socket.js +1 -1
- package/_cjs/utils/rpc/socket.js.map +1 -1
- package/_esm/actions/public/waitForTransactionReceipt.js +5 -2
- package/_esm/actions/public/waitForTransactionReceipt.js.map +1 -1
- package/_esm/actions/wallet/waitForCallsStatus.js +39 -2
- package/_esm/actions/wallet/waitForCallsStatus.js.map +1 -1
- package/_esm/chains/definitions/arcTestnet.js +11 -8
- package/_esm/chains/definitions/arcTestnet.js.map +1 -1
- package/_esm/chains/definitions/qmsTestnet.js +27 -0
- package/_esm/chains/definitions/qmsTestnet.js.map +1 -0
- package/_esm/chains/definitions/tempo.js +1 -1
- package/_esm/chains/definitions/tempoModerato.js +2 -2
- package/_esm/chains/index.js +1 -0
- package/_esm/chains/index.js.map +1 -1
- package/_esm/clients/transports/ipc.js +21 -10
- package/_esm/clients/transports/ipc.js.map +1 -1
- package/_esm/clients/transports/webSocket.js +21 -10
- package/_esm/clients/transports/webSocket.js.map +1 -1
- package/_esm/errors/version.js +1 -1
- package/_esm/tempo/Abis.js +297 -0
- package/_esm/tempo/Abis.js.map +1 -1
- package/_esm/tempo/Account.js +42 -42
- package/_esm/tempo/Account.js.map +1 -1
- package/_esm/tempo/Addresses.js +1 -0
- package/_esm/tempo/Addresses.js.map +1 -1
- package/_esm/tempo/Client.js +3 -3
- package/_esm/tempo/Decorator.js +9 -8
- package/_esm/tempo/Decorator.js.map +1 -1
- package/_esm/tempo/ExecutionError.js +96 -3
- package/_esm/tempo/ExecutionError.js.map +1 -1
- package/_esm/tempo/Formatters.js +11 -10
- package/_esm/tempo/Formatters.js.map +1 -1
- package/_esm/tempo/KeyAuthorizationManager.js +58 -16
- package/_esm/tempo/KeyAuthorizationManager.js.map +1 -1
- package/_esm/tempo/Relay.js +49 -8
- package/_esm/tempo/Relay.js.map +1 -1
- package/_esm/tempo/Transaction.js +11 -11
- package/_esm/tempo/Transaction.js.map +1 -1
- package/_esm/tempo/Transport.js +22 -12
- package/_esm/tempo/Transport.js.map +1 -1
- package/_esm/tempo/{multisig → accounts}/Config.js +14 -14
- package/_esm/tempo/{multisig → accounts}/Config.js.map +1 -1
- package/_esm/tempo/{multisig → accounts}/Operation.js +17 -17
- package/_esm/tempo/{multisig → accounts}/Operation.js.map +1 -1
- package/_esm/tempo/accounts/Signature.js +9 -0
- package/_esm/tempo/accounts/Signature.js.map +1 -0
- package/_esm/tempo/actions/accessKey.js +499 -48
- package/_esm/tempo/actions/accessKey.js.map +1 -1
- package/_esm/tempo/actions/{multisig.js → accounts.js} +34 -38
- package/_esm/tempo/actions/accounts.js.map +1 -0
- package/_esm/tempo/actions/amm.js +95 -4
- package/_esm/tempo/actions/amm.js.map +1 -1
- package/_esm/tempo/actions/channel.js +191 -7
- package/_esm/tempo/actions/channel.js.map +1 -1
- package/_esm/tempo/actions/dex.js +537 -14
- package/_esm/tempo/actions/dex.js.map +1 -1
- package/_esm/tempo/actions/earn/deployment.js +4 -3
- package/_esm/tempo/actions/earn/deployment.js.map +1 -1
- package/_esm/tempo/actions/earn.js +22 -21
- package/_esm/tempo/actions/earn.js.map +1 -1
- package/_esm/tempo/actions/fee.js +90 -6
- package/_esm/tempo/actions/fee.js.map +1 -1
- package/_esm/tempo/actions/index.js +1 -1
- package/_esm/tempo/actions/index.js.map +1 -1
- package/_esm/tempo/actions/nonce.js +57 -1
- package/_esm/tempo/actions/nonce.js.map +1 -1
- package/_esm/tempo/actions/policy.js +36 -6
- package/_esm/tempo/actions/policy.js.map +1 -1
- package/_esm/tempo/actions/propAmm.js +18 -8
- package/_esm/tempo/actions/propAmm.js.map +1 -1
- package/_esm/tempo/actions/receivePolicy.js +7 -6
- package/_esm/tempo/actions/receivePolicy.js.map +1 -1
- package/_esm/tempo/actions/reward.js +7 -6
- package/_esm/tempo/actions/reward.js.map +1 -1
- package/_esm/tempo/actions/token.js +461 -22
- package/_esm/tempo/actions/token.js.map +1 -1
- package/_esm/tempo/actions/validator.js +12 -11
- package/_esm/tempo/actions/validator.js.map +1 -1
- package/_esm/tempo/actions/virtualAddress.js +3 -2
- package/_esm/tempo/actions/virtualAddress.js.map +1 -1
- package/_esm/tempo/actions/zone.js +12 -11
- package/_esm/tempo/actions/zone.js.map +1 -1
- package/_esm/tempo/chainConfig.js +38 -38
- package/_esm/tempo/chainConfig.js.map +1 -1
- package/_esm/tempo/errors.js +63 -0
- package/_esm/tempo/errors.js.map +1 -1
- package/_esm/tempo/index.js +2 -1
- package/_esm/tempo/index.js.map +1 -1
- package/_esm/tempo/internal/errors.js +51 -0
- package/_esm/tempo/internal/errors.js.map +1 -0
- package/_esm/tempo/internal/relay/{multisig.js → accounts.js} +93 -98
- package/_esm/tempo/internal/relay/accounts.js.map +1 -0
- package/_esm/tempo/internal/relay/feePayer.js +1 -1
- package/_esm/tempo/internal/relay/feePayer.js.map +1 -1
- package/_esm/tempo/internal/relay/keyAuthorization.js +334 -0
- package/_esm/tempo/internal/relay/keyAuthorization.js.map +1 -0
- package/_esm/tempo/internal/relay/plugin.js +15 -6
- package/_esm/tempo/internal/relay/plugin.js.map +1 -1
- package/_esm/tempo/internal/resolveError.js +130 -0
- package/_esm/tempo/internal/resolveError.js.map +1 -0
- package/_esm/tempo/internal/utils.js +2 -0
- package/_esm/tempo/internal/utils.js.map +1 -1
- package/_esm/utils/hash/normalizeSignature.js +3 -2
- package/_esm/utils/hash/normalizeSignature.js.map +1 -1
- package/_esm/utils/rpc/http.js +74 -31
- package/_esm/utils/rpc/http.js.map +1 -1
- package/_esm/utils/rpc/socket.js +3 -1
- package/_esm/utils/rpc/socket.js.map +1 -1
- package/_types/actions/public/waitForTransactionReceipt.d.ts.map +1 -1
- package/_types/actions/wallet/waitForCallsStatus.d.ts.map +1 -1
- package/_types/chains/definitions/arcTestnet.d.ts +5 -5
- package/_types/chains/definitions/arcTestnet.d.ts.map +1 -1
- package/_types/chains/definitions/qmsTestnet.d.ts +50 -0
- package/_types/chains/definitions/qmsTestnet.d.ts.map +1 -0
- package/_types/chains/definitions/tempo.d.ts +2 -2
- package/_types/chains/definitions/tempoModerato.d.ts +4 -4
- package/_types/chains/index.d.ts +1 -0
- package/_types/chains/index.d.ts.map +1 -1
- package/_types/clients/transports/ipc.d.ts.map +1 -1
- package/_types/clients/transports/webSocket.d.ts.map +1 -1
- package/_types/errors/version.d.ts +1 -1
- package/_types/tempo/Abis.d.ts +807 -0
- package/_types/tempo/Abis.d.ts.map +1 -1
- package/_types/tempo/Account.d.ts +28 -28
- package/_types/tempo/Account.d.ts.map +1 -1
- package/_types/tempo/Addresses.d.ts +1 -0
- package/_types/tempo/Addresses.d.ts.map +1 -1
- package/_types/tempo/Client.d.ts +3 -3
- package/_types/tempo/Decorator.d.ts +64 -38
- package/_types/tempo/Decorator.d.ts.map +1 -1
- package/_types/tempo/ExecutionError.d.ts +3 -1
- package/_types/tempo/ExecutionError.d.ts.map +1 -1
- package/_types/tempo/Formatters.d.ts.map +1 -1
- package/_types/tempo/KeyAuthorizationManager.d.ts +45 -2
- package/_types/tempo/KeyAuthorizationManager.d.ts.map +1 -1
- package/_types/tempo/Relay.d.ts +62 -12
- package/_types/tempo/Relay.d.ts.map +1 -1
- package/_types/tempo/Transaction.d.ts +14 -11
- package/_types/tempo/Transaction.d.ts.map +1 -1
- package/_types/tempo/Transport.d.ts +20 -7
- package/_types/tempo/Transport.d.ts.map +1 -1
- package/_types/tempo/{multisig → accounts}/Config.d.ts +7 -7
- package/_types/tempo/accounts/Config.d.ts.map +1 -0
- package/_types/tempo/{multisig → accounts}/Operation.d.ts +7 -7
- package/_types/tempo/accounts/Operation.d.ts.map +1 -0
- package/_types/tempo/{multisig → accounts}/Signature.d.ts +1 -1
- package/_types/tempo/accounts/Signature.d.ts.map +1 -0
- package/_types/tempo/actions/accessKey.d.ts +214 -25
- package/_types/tempo/actions/accessKey.d.ts.map +1 -1
- package/_types/tempo/actions/{multisig.d.ts → accounts.d.ts} +31 -29
- package/_types/tempo/actions/accounts.d.ts.map +1 -0
- package/_types/tempo/actions/amm.d.ts +39 -0
- package/_types/tempo/actions/amm.d.ts.map +1 -1
- package/_types/tempo/actions/channel.d.ts +77 -7
- package/_types/tempo/actions/channel.d.ts.map +1 -1
- package/_types/tempo/actions/dex.d.ts +222 -16
- package/_types/tempo/actions/dex.d.ts.map +1 -1
- package/_types/tempo/actions/earn/deployment.d.ts +7 -6
- package/_types/tempo/actions/earn/deployment.d.ts.map +1 -1
- package/_types/tempo/actions/earn.d.ts +15 -14
- package/_types/tempo/actions/earn.d.ts.map +1 -1
- package/_types/tempo/actions/fee.d.ts +32 -6
- package/_types/tempo/actions/fee.d.ts.map +1 -1
- package/_types/tempo/actions/index.d.ts +1 -1
- package/_types/tempo/actions/index.d.ts.map +1 -1
- package/_types/tempo/actions/nonce.d.ts +35 -0
- package/_types/tempo/actions/nonce.d.ts.map +1 -1
- package/_types/tempo/actions/policy.d.ts +29 -8
- package/_types/tempo/actions/policy.d.ts.map +1 -1
- package/_types/tempo/actions/propAmm.d.ts +9 -1
- package/_types/tempo/actions/propAmm.d.ts.map +1 -1
- package/_types/tempo/actions/receivePolicy.d.ts +10 -6
- package/_types/tempo/actions/receivePolicy.d.ts.map +1 -1
- package/_types/tempo/actions/reward.d.ts +7 -3
- package/_types/tempo/actions/reward.d.ts.map +1 -1
- package/_types/tempo/actions/token.d.ts +200 -32
- package/_types/tempo/actions/token.d.ts.map +1 -1
- package/_types/tempo/actions/validator.d.ts +17 -5
- package/_types/tempo/actions/validator.d.ts.map +1 -1
- package/_types/tempo/actions/virtualAddress.d.ts +4 -3
- package/_types/tempo/actions/virtualAddress.d.ts.map +1 -1
- package/_types/tempo/actions/zone.d.ts +10 -9
- package/_types/tempo/actions/zone.d.ts.map +1 -1
- package/_types/tempo/errors.d.ts +63 -1
- package/_types/tempo/errors.d.ts.map +1 -1
- package/_types/tempo/index.d.ts +3 -2
- package/_types/tempo/index.d.ts.map +1 -1
- package/_types/tempo/internal/errors.d.ts +59 -0
- package/_types/tempo/internal/errors.d.ts.map +1 -0
- package/_types/tempo/internal/relay/accounts.d.ts +15 -0
- package/_types/tempo/internal/relay/accounts.d.ts.map +1 -0
- package/_types/tempo/internal/relay/keyAuthorization.d.ts +25 -0
- package/_types/tempo/internal/relay/keyAuthorization.d.ts.map +1 -0
- package/_types/tempo/internal/relay/plugin.d.ts +6 -3
- package/_types/tempo/internal/relay/plugin.d.ts.map +1 -1
- package/_types/tempo/internal/resolveError.d.ts +8 -0
- package/_types/tempo/internal/resolveError.d.ts.map +1 -0
- package/_types/tempo/internal/utils.d.ts.map +1 -1
- package/_types/utils/hash/normalizeSignature.d.ts.map +1 -1
- package/_types/utils/rpc/http.d.ts.map +1 -1
- package/_types/utils/rpc/socket.d.ts.map +1 -1
- package/actions/public/waitForTransactionReceipt.ts +8 -2
- package/actions/wallet/waitForCallsStatus.ts +41 -2
- package/chains/definitions/arcTestnet.ts +11 -8
- package/chains/definitions/qmsTestnet.ts +27 -0
- package/chains/definitions/tempo.ts +1 -1
- package/chains/definitions/tempoModerato.ts +2 -2
- package/chains/index.ts +1 -0
- package/clients/transports/ipc.ts +38 -29
- package/clients/transports/webSocket.ts +42 -33
- package/errors/version.ts +1 -1
- package/package.json +2 -2
- package/tempo/Abis.ts +298 -0
- package/tempo/Account.ts +95 -84
- package/tempo/Addresses.ts +1 -0
- package/tempo/Client.ts +3 -3
- package/tempo/Decorator.ts +91 -60
- package/tempo/ExecutionError.ts +102 -4
- package/tempo/Formatters.ts +14 -13
- package/tempo/KeyAuthorizationManager.ts +71 -19
- package/tempo/Relay.ts +70 -14
- package/tempo/Transaction.ts +31 -23
- package/tempo/Transport.ts +49 -21
- package/tempo/{multisig → accounts}/Config.ts +21 -21
- package/tempo/{multisig → accounts}/Operation.ts +26 -26
- package/tempo/{multisig → accounts}/Signature.ts +5 -3
- package/tempo/actions/accessKey.ts +675 -104
- package/tempo/actions/{multisig.ts → accounts.ts} +54 -59
- package/tempo/actions/amm.ts +126 -4
- package/tempo/actions/channel.ts +248 -14
- package/tempo/actions/dex.ts +599 -33
- package/tempo/actions/earn/deployment.ts +11 -9
- package/tempo/actions/earn.ts +40 -35
- package/tempo/actions/fee.ts +111 -9
- package/tempo/actions/index.ts +1 -1
- package/tempo/actions/nonce.ts +86 -1
- package/tempo/actions/policy.ts +66 -14
- package/tempo/actions/propAmm.ts +36 -9
- package/tempo/actions/receivePolicy.ts +26 -15
- package/tempo/actions/reward.ts +17 -9
- package/tempo/actions/token.ts +519 -54
- package/tempo/actions/validator.ts +40 -16
- package/tempo/actions/virtualAddress.ts +7 -5
- package/tempo/actions/zone.ts +25 -20
- package/tempo/chainConfig.ts +52 -52
- package/tempo/errors.ts +114 -1
- package/tempo/index.ts +5 -4
- package/tempo/internal/errors.ts +110 -0
- package/tempo/internal/relay/{multisig.ts → accounts.ts} +118 -118
- package/tempo/internal/relay/feePayer.ts +1 -1
- package/tempo/internal/relay/keyAuthorization.ts +415 -0
- package/tempo/internal/relay/plugin.ts +20 -7
- package/tempo/internal/resolveError.ts +169 -0
- package/tempo/internal/utils.ts +2 -0
- package/utils/hash/normalizeSignature.ts +3 -2
- package/utils/rpc/http.ts +76 -30
- package/utils/rpc/socket.ts +3 -1
- package/_cjs/tempo/actions/multisig.js.map +0 -1
- package/_cjs/tempo/internal/relay/multisig.js.map +0 -1
- package/_cjs/tempo/multisig/Signature.js.map +0 -1
- package/_esm/tempo/actions/multisig.js.map +0 -1
- package/_esm/tempo/internal/relay/multisig.js.map +0 -1
- package/_esm/tempo/multisig/Signature.js +0 -9
- package/_esm/tempo/multisig/Signature.js.map +0 -1
- package/_types/tempo/actions/multisig.d.ts.map +0 -1
- package/_types/tempo/internal/relay/multisig.d.ts +0 -4
- package/_types/tempo/internal/relay/multisig.d.ts.map +0 -1
- package/_types/tempo/multisig/Config.d.ts.map +0 -1
- package/_types/tempo/multisig/Operation.d.ts.map +0 -1
- package/_types/tempo/multisig/Signature.d.ts.map +0 -1
|
@@ -4,9 +4,9 @@ import * as Hash from 'ox/Hash'
|
|
|
4
4
|
import * as Hex from 'ox/Hex'
|
|
5
5
|
import * as RpcResponse from 'ox/RpcResponse'
|
|
6
6
|
import {
|
|
7
|
+
AccountConfig,
|
|
8
|
+
AccountOperation,
|
|
7
9
|
KeyAuthorization,
|
|
8
|
-
MultisigConfig,
|
|
9
|
-
MultisigOperation,
|
|
10
10
|
Transaction as ox_Transaction,
|
|
11
11
|
SignatureEnvelope,
|
|
12
12
|
TxEnvelopeTempo,
|
|
@@ -18,9 +18,9 @@ import { decodeFunctionData } from '../../../utils/abi/decodeFunctionData.js'
|
|
|
18
18
|
import { isAddressEqual } from '../../../utils/address/isAddressEqual.js'
|
|
19
19
|
import * as Abis from '../../Abis.js'
|
|
20
20
|
import * as Addresses from '../../Addresses.js'
|
|
21
|
-
import
|
|
22
|
-
import * as
|
|
23
|
-
import
|
|
21
|
+
import * as ConfigStore from '../../accounts/Config.js'
|
|
22
|
+
import * as OperationStore from '../../accounts/Operation.js'
|
|
23
|
+
import { getConfigCommitment } from '../../actions/accounts.js'
|
|
24
24
|
import type * as Relay from '../../Relay.js'
|
|
25
25
|
import type * as Store from '../../Store.js'
|
|
26
26
|
import * as Transaction from '../../Transaction.js'
|
|
@@ -29,16 +29,16 @@ import * as Plugin from './plugin.js'
|
|
|
29
29
|
const submissionTtl = 30_000
|
|
30
30
|
const pollingInterval = 100
|
|
31
31
|
|
|
32
|
-
/** Creates middleware for
|
|
32
|
+
/** Creates middleware for owner approval coordination. @internal */
|
|
33
33
|
export function create(
|
|
34
|
-
options: Relay.
|
|
35
|
-
): Relay.
|
|
34
|
+
options: Relay.accounts.Options,
|
|
35
|
+
): Relay.accounts.ReturnType {
|
|
36
36
|
if (!options.store.compareAndSet)
|
|
37
37
|
throw new RpcResponse.InvalidParamsError({
|
|
38
38
|
message:
|
|
39
|
-
'
|
|
39
|
+
'Account coordination requires a store with atomic `compareAndSet`.',
|
|
40
40
|
})
|
|
41
|
-
return Plugin.
|
|
41
|
+
return Plugin.accounts({
|
|
42
42
|
async handleRequest(context, forward) {
|
|
43
43
|
const { request, options: requestOptions_ } = context
|
|
44
44
|
const requestOptions = await resolveRequestOptions({
|
|
@@ -62,7 +62,7 @@ export function create(
|
|
|
62
62
|
),
|
|
63
63
|
})
|
|
64
64
|
|
|
65
|
-
if (request.method === '
|
|
65
|
+
if (request.method === 'account_getConfig') {
|
|
66
66
|
const value = request.params?.[0]
|
|
67
67
|
const address =
|
|
68
68
|
value && typeof value === 'object' && 'address' in value
|
|
@@ -74,7 +74,7 @@ export function create(
|
|
|
74
74
|
Hex.toBigInt(address) === 0n
|
|
75
75
|
)
|
|
76
76
|
throw new RpcResponse.InvalidParamsError({
|
|
77
|
-
message: 'Expected a
|
|
77
|
+
message: 'Expected a configurable account address.',
|
|
78
78
|
})
|
|
79
79
|
const blockNumber = await getBlockNumber(client, { cacheTime: 0 })
|
|
80
80
|
const commitment = await getConfigCommitment(client, {
|
|
@@ -86,20 +86,20 @@ export function create(
|
|
|
86
86
|
commitment,
|
|
87
87
|
})
|
|
88
88
|
if (!config) return null
|
|
89
|
-
return
|
|
89
|
+
return AccountConfig.toRpc(config)
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
-
if (request.method === '
|
|
92
|
+
if (request.method === 'account_getOperation') {
|
|
93
93
|
const hash = request.params?.[0]
|
|
94
94
|
if (typeof hash !== 'string' || !Hash.validate(hash))
|
|
95
95
|
throw new RpcResponse.InvalidParamsError({
|
|
96
|
-
message: 'Expected
|
|
96
|
+
message: 'Expected an account operation hash.',
|
|
97
97
|
})
|
|
98
98
|
const operation = await OperationStore.read(options.store, hash)
|
|
99
|
-
return operation ?
|
|
99
|
+
return operation ? AccountOperation.toRpc(operation) : null
|
|
100
100
|
}
|
|
101
101
|
|
|
102
|
-
if (request.method === '
|
|
102
|
+
if (request.method === 'account_approveKeyAuthorization')
|
|
103
103
|
return await approveKeyAuthorization({
|
|
104
104
|
client,
|
|
105
105
|
request,
|
|
@@ -139,7 +139,7 @@ export function create(
|
|
|
139
139
|
: operation
|
|
140
140
|
return {
|
|
141
141
|
...receipt,
|
|
142
|
-
|
|
142
|
+
operation: AccountOperation.toRpc(success),
|
|
143
143
|
}
|
|
144
144
|
}
|
|
145
145
|
if (operation.status === 'pending')
|
|
@@ -168,15 +168,15 @@ export function create(
|
|
|
168
168
|
: operation
|
|
169
169
|
return {
|
|
170
170
|
...transaction,
|
|
171
|
-
|
|
171
|
+
operation: AccountOperation.toRpc(success),
|
|
172
172
|
}
|
|
173
173
|
}
|
|
174
174
|
|
|
175
175
|
if (
|
|
176
176
|
request.method !== 'eth_sendRawTransaction' &&
|
|
177
177
|
request.method !== 'eth_sendRawTransactionSync' &&
|
|
178
|
-
request.method !== '
|
|
179
|
-
request.method !== '
|
|
178
|
+
request.method !== 'account_approveRawTransaction' &&
|
|
179
|
+
request.method !== 'account_approveRawTransactionSync'
|
|
180
180
|
)
|
|
181
181
|
return forward()
|
|
182
182
|
|
|
@@ -187,7 +187,8 @@ export function create(
|
|
|
187
187
|
if (!isSerializedTempoTransaction(serialized)) {
|
|
188
188
|
if (standard) return forward()
|
|
189
189
|
throw new RpcResponse.InvalidParamsError({
|
|
190
|
-
message:
|
|
190
|
+
message:
|
|
191
|
+
'Expected a serialized Tempo configurable account transaction.',
|
|
191
192
|
})
|
|
192
193
|
}
|
|
193
194
|
|
|
@@ -220,14 +221,14 @@ async function submit(options: submit.Options) {
|
|
|
220
221
|
}
|
|
221
222
|
})()
|
|
222
223
|
const signature = transaction?.signature
|
|
223
|
-
if (!transaction || signature?.type !== '
|
|
224
|
+
if (!transaction || signature?.type !== 'configurable') {
|
|
224
225
|
if (
|
|
225
226
|
options.method === 'eth_sendRawTransaction' ||
|
|
226
227
|
options.method === 'eth_sendRawTransactionSync'
|
|
227
228
|
)
|
|
228
229
|
return await options.next(options.request, options.requestOptions)
|
|
229
230
|
throw new RpcResponse.InvalidParamsError({
|
|
230
|
-
message: 'Expected a
|
|
231
|
+
message: 'Expected a configurable account transaction signature.',
|
|
231
232
|
})
|
|
232
233
|
}
|
|
233
234
|
|
|
@@ -238,14 +239,14 @@ async function submit(options: submit.Options) {
|
|
|
238
239
|
options.serialized.startsWith(TxEnvelopeTempo.feePayerMagic),
|
|
239
240
|
)
|
|
240
241
|
const blockNumber = await getBlockNumber(options.client, { cacheTime: 0 })
|
|
241
|
-
const config =
|
|
242
|
+
const config = AccountConfig.from(signature.config)
|
|
242
243
|
const configCommitment = await validateConfig({
|
|
243
244
|
account: signature.account,
|
|
244
245
|
blockNumber,
|
|
245
246
|
client: options.client,
|
|
246
247
|
config,
|
|
247
248
|
})
|
|
248
|
-
const operationHash =
|
|
249
|
+
const operationHash = AccountOperation.getHash({
|
|
249
250
|
account: signature.account,
|
|
250
251
|
config,
|
|
251
252
|
transaction: serializedUnsigned,
|
|
@@ -256,7 +257,7 @@ async function submit(options: submit.Options) {
|
|
|
256
257
|
)
|
|
257
258
|
if (incoming.length === 0)
|
|
258
259
|
throw new RpcResponse.InvalidParamsError({
|
|
259
|
-
message: 'A
|
|
260
|
+
message: 'A owner approval envelope must include a signature.',
|
|
260
261
|
})
|
|
261
262
|
const now = Date.now()
|
|
262
263
|
const expiredSubmissionIds = new Set<Hex.Hex>()
|
|
@@ -285,7 +286,7 @@ async function submit(options: submit.Options) {
|
|
|
285
286
|
hash: operationHash,
|
|
286
287
|
approvals: [...(existingApprovals?.approvals ?? []), ...incoming],
|
|
287
288
|
})
|
|
288
|
-
return
|
|
289
|
+
return AccountOperation.from({
|
|
289
290
|
account: signature.account,
|
|
290
291
|
approvals: approvals.approvals,
|
|
291
292
|
config,
|
|
@@ -339,7 +340,7 @@ async function submit(options: submit.Options) {
|
|
|
339
340
|
const timeout = options.request.params?.[1]
|
|
340
341
|
const synchronous =
|
|
341
342
|
options.method === 'eth_sendRawTransactionSync' ||
|
|
342
|
-
options.method === '
|
|
343
|
+
options.method === 'account_approveRawTransactionSync'
|
|
343
344
|
const leaseTtl =
|
|
344
345
|
synchronous &&
|
|
345
346
|
typeof timeout === 'number' &&
|
|
@@ -358,7 +359,7 @@ async function submit(options: submit.Options) {
|
|
|
358
359
|
return current
|
|
359
360
|
if (current.weight < current.threshold) return current
|
|
360
361
|
const now = Date.now()
|
|
361
|
-
return
|
|
362
|
+
return AccountOperation.from({
|
|
362
363
|
...current,
|
|
363
364
|
expiresAt: Math.min(now + leaseTtl, Number.MAX_SAFE_INTEGER),
|
|
364
365
|
status: 'submitting',
|
|
@@ -392,7 +393,7 @@ async function submit(options: submit.Options) {
|
|
|
392
393
|
hash: claim.hash,
|
|
393
394
|
approvals: claim.approvals,
|
|
394
395
|
})
|
|
395
|
-
const final =
|
|
396
|
+
const final = AccountOperation.serializeTransaction(claim, {
|
|
396
397
|
approvals: finalApprovals.selectedApprovals,
|
|
397
398
|
})
|
|
398
399
|
const transactionHash = TxEnvelopeTempo.hash(
|
|
@@ -431,7 +432,7 @@ async function submit(options: submit.Options) {
|
|
|
431
432
|
{
|
|
432
433
|
method:
|
|
433
434
|
options.method === 'eth_sendRawTransaction' ||
|
|
434
|
-
options.method === '
|
|
435
|
+
options.method === 'account_approveRawTransaction'
|
|
435
436
|
? 'eth_sendRawTransaction'
|
|
436
437
|
: 'eth_sendRawTransactionSync',
|
|
437
438
|
params: [final, ...(options.request.params?.slice(1) ?? [])],
|
|
@@ -488,7 +489,7 @@ async function submit(options: submit.Options) {
|
|
|
488
489
|
)
|
|
489
490
|
throw new OperationStore.InvalidStoreValueError()
|
|
490
491
|
const { expiresAt: _, submissionId: __, ...operation } = current
|
|
491
|
-
return
|
|
492
|
+
return AccountOperation.from({
|
|
492
493
|
...operation,
|
|
493
494
|
status: 'success',
|
|
494
495
|
transactionHash,
|
|
@@ -504,7 +505,7 @@ async function submit(options: submit.Options) {
|
|
|
504
505
|
result &&
|
|
505
506
|
typeof result === 'object'
|
|
506
507
|
)
|
|
507
|
-
return { ...result,
|
|
508
|
+
return { ...result, operation: AccountOperation.toRpc(success) }
|
|
508
509
|
return await submittedResult(options, success)
|
|
509
510
|
}
|
|
510
511
|
|
|
@@ -517,8 +518,8 @@ declare namespace submit {
|
|
|
517
518
|
method:
|
|
518
519
|
| 'eth_sendRawTransaction'
|
|
519
520
|
| 'eth_sendRawTransactionSync'
|
|
520
|
-
| '
|
|
521
|
-
| '
|
|
521
|
+
| 'account_approveRawTransaction'
|
|
522
|
+
| 'account_approveRawTransactionSync'
|
|
522
523
|
/** Downstream RPC request handler. */
|
|
523
524
|
next: Relay.handleRequest.Handler
|
|
524
525
|
/** Original RPC request. */
|
|
@@ -527,12 +528,12 @@ declare namespace submit {
|
|
|
527
528
|
requestOptions?: Relay.handleRequest.RequestOptions | undefined
|
|
528
529
|
/** Serialized Tempo transaction. */
|
|
529
530
|
serialized: Hex.Hex
|
|
530
|
-
/** Shared
|
|
531
|
+
/** Shared account store. */
|
|
531
532
|
store: Store.Atomic
|
|
532
533
|
}
|
|
533
534
|
}
|
|
534
535
|
|
|
535
|
-
/** Collects approvals for a
|
|
536
|
+
/** Collects approvals for a configurable account key authorization. @internal */
|
|
536
537
|
// biome-ignore lint/correctness/noUnusedVariables: declaration merge
|
|
537
538
|
async function approveKeyAuthorization(
|
|
538
539
|
options: approveKeyAuthorization.Options,
|
|
@@ -540,7 +541,7 @@ async function approveKeyAuthorization(
|
|
|
540
541
|
const value = options.request.params?.[0]
|
|
541
542
|
if (!value || typeof value !== 'object')
|
|
542
543
|
throw new RpcResponse.InvalidParamsError({
|
|
543
|
-
message: 'Expected a
|
|
544
|
+
message: 'Expected a configurable account key authorization approval.',
|
|
544
545
|
})
|
|
545
546
|
|
|
546
547
|
const approval = await (async () => {
|
|
@@ -552,14 +553,15 @@ async function approveKeyAuthorization(
|
|
|
552
553
|
)
|
|
553
554
|
} catch {
|
|
554
555
|
throw new RpcResponse.InvalidParamsError({
|
|
555
|
-
message: 'Invalid
|
|
556
|
+
message: 'Invalid configurable account key authorization.',
|
|
556
557
|
})
|
|
557
558
|
}
|
|
558
559
|
})()
|
|
559
560
|
const signature = authorization.signature
|
|
560
|
-
if (signature?.type !== '
|
|
561
|
+
if (signature?.type !== 'configurable')
|
|
561
562
|
throw new RpcResponse.InvalidParamsError({
|
|
562
|
-
message:
|
|
563
|
+
message:
|
|
564
|
+
'Expected a configurable account key authorization signature.',
|
|
563
565
|
})
|
|
564
566
|
if (
|
|
565
567
|
!authorization.account ||
|
|
@@ -567,14 +569,14 @@ async function approveKeyAuthorization(
|
|
|
567
569
|
)
|
|
568
570
|
throw new RpcResponse.InvalidParamsError({
|
|
569
571
|
message:
|
|
570
|
-
'
|
|
572
|
+
'Configurable account key authorization account does not match its signature.',
|
|
571
573
|
})
|
|
572
574
|
const { signature: _, ...unsigned } = authorization
|
|
573
575
|
const keyAuthorization = KeyAuthorization.serialize(
|
|
574
576
|
KeyAuthorization.from(unsigned),
|
|
575
577
|
)
|
|
576
|
-
const config =
|
|
577
|
-
const hash =
|
|
578
|
+
const config = AccountConfig.from(signature.config)
|
|
579
|
+
const hash = AccountOperation.getHash({
|
|
578
580
|
account: signature.account,
|
|
579
581
|
config,
|
|
580
582
|
keyAuthorization,
|
|
@@ -594,12 +596,13 @@ async function approveKeyAuthorization(
|
|
|
594
596
|
if ('hash' in value && 'signature' in value) {
|
|
595
597
|
if (typeof value.hash !== 'string' || !Hash.validate(value.hash))
|
|
596
598
|
throw new RpcResponse.InvalidParamsError({
|
|
597
|
-
message: 'Expected
|
|
599
|
+
message: 'Expected an account operation hash.',
|
|
598
600
|
})
|
|
599
601
|
const operation = await OperationStore.read(options.store, value.hash)
|
|
600
602
|
if (!operation || operation.type !== 'keyAuthorization')
|
|
601
603
|
throw new RpcResponse.InvalidParamsError({
|
|
602
|
-
message:
|
|
604
|
+
message:
|
|
605
|
+
'Configurable account key authorization operation was not found.',
|
|
603
606
|
})
|
|
604
607
|
if (operation.status === 'success') return { operation }
|
|
605
608
|
const signature = (() => {
|
|
@@ -609,7 +612,7 @@ async function approveKeyAuthorization(
|
|
|
609
612
|
)
|
|
610
613
|
} catch {
|
|
611
614
|
throw new RpcResponse.InvalidParamsError({
|
|
612
|
-
message: 'Invalid
|
|
615
|
+
message: 'Invalid owner signature.',
|
|
613
616
|
})
|
|
614
617
|
}
|
|
615
618
|
})()
|
|
@@ -623,14 +626,13 @@ async function approveKeyAuthorization(
|
|
|
623
626
|
}
|
|
624
627
|
|
|
625
628
|
throw new RpcResponse.InvalidParamsError({
|
|
626
|
-
message: 'Expected a
|
|
629
|
+
message: 'Expected a configurable account key authorization approval.',
|
|
627
630
|
})
|
|
628
631
|
})()
|
|
629
|
-
if ('operation' in approval)
|
|
630
|
-
return MultisigOperation.toRpc(approval.operation)
|
|
632
|
+
if ('operation' in approval) return AccountOperation.toRpc(approval.operation)
|
|
631
633
|
if (approval.approvals.length === 0)
|
|
632
634
|
throw new RpcResponse.InvalidParamsError({
|
|
633
|
-
message: 'A
|
|
635
|
+
message: 'A owner approval envelope must include a signature.',
|
|
634
636
|
})
|
|
635
637
|
|
|
636
638
|
const blockNumber = await getBlockNumber(options.client, { cacheTime: 0 })
|
|
@@ -651,8 +653,8 @@ async function approveKeyAuthorization(
|
|
|
651
653
|
if (
|
|
652
654
|
existing &&
|
|
653
655
|
(existing.account.toLowerCase() !== approval.account.toLowerCase() ||
|
|
654
|
-
|
|
655
|
-
|
|
656
|
+
AccountConfig.getCommitment(existing.config).toLowerCase() !==
|
|
657
|
+
AccountConfig.getCommitment(approval.config).toLowerCase() ||
|
|
656
658
|
existing.keyAuthorization.toLowerCase() !==
|
|
657
659
|
approval.keyAuthorization.toLowerCase())
|
|
658
660
|
)
|
|
@@ -696,10 +698,10 @@ async function approveKeyAuthorization(
|
|
|
696
698
|
weight: approvals.weight,
|
|
697
699
|
} as const
|
|
698
700
|
if (approvals.weight < approvals.threshold)
|
|
699
|
-
return
|
|
700
|
-
return
|
|
701
|
+
return AccountOperation.from({ ...pending, status: 'pending' })
|
|
702
|
+
return AccountOperation.from({
|
|
701
703
|
...pending,
|
|
702
|
-
keyAuthorization:
|
|
704
|
+
keyAuthorization: AccountOperation.serializeKeyAuthorization(
|
|
703
705
|
approval.keyAuthorization,
|
|
704
706
|
{
|
|
705
707
|
account: approval.account,
|
|
@@ -718,7 +720,7 @@ async function approveKeyAuthorization(
|
|
|
718
720
|
})
|
|
719
721
|
if (operation.type !== 'keyAuthorization')
|
|
720
722
|
throw new OperationStore.InvalidStoreValueError()
|
|
721
|
-
return
|
|
723
|
+
return AccountOperation.toRpc(operation)
|
|
722
724
|
}
|
|
723
725
|
|
|
724
726
|
declare namespace approveKeyAuthorization {
|
|
@@ -728,7 +730,7 @@ declare namespace approveKeyAuthorization {
|
|
|
728
730
|
client: ReturnType<typeof createClient>
|
|
729
731
|
/** Original RPC request. */
|
|
730
732
|
request: Relay.handleRequest.Request
|
|
731
|
-
/** Shared
|
|
733
|
+
/** Shared account store. */
|
|
732
734
|
store: Store.Atomic
|
|
733
735
|
}
|
|
734
736
|
}
|
|
@@ -750,34 +752,35 @@ function deserialize(serialized: Hex.Hex) {
|
|
|
750
752
|
function assertConfig(options: {
|
|
751
753
|
account: `0x${string}`
|
|
752
754
|
commitment: Hex.Hex
|
|
753
|
-
config:
|
|
755
|
+
config: AccountConfig.Config
|
|
754
756
|
}) {
|
|
755
757
|
const { account, commitment, config } = options
|
|
756
758
|
if (
|
|
757
759
|
config.version === 0n &&
|
|
758
|
-
|
|
760
|
+
AccountConfig.getAddress(config, {
|
|
759
761
|
factory: Addresses.nativeMultisigFactory,
|
|
760
762
|
}).toLowerCase() !== account.toLowerCase()
|
|
761
763
|
)
|
|
762
764
|
throw new RpcResponse.InvalidParamsError({
|
|
763
|
-
message:
|
|
765
|
+
message:
|
|
766
|
+
'Initial account config does not match the configurable account.',
|
|
764
767
|
})
|
|
765
768
|
if (config.version === 0n && Hex.toBigInt(commitment) === 0n) return
|
|
766
769
|
if (
|
|
767
770
|
commitment.toLowerCase() !==
|
|
768
|
-
|
|
771
|
+
AccountConfig.getCommitment(config).toLowerCase()
|
|
769
772
|
)
|
|
770
773
|
throw new RpcResponse.InvalidParamsError({
|
|
771
|
-
message: `
|
|
774
|
+
message: `Account config does not match account ${account}.`,
|
|
772
775
|
})
|
|
773
776
|
}
|
|
774
777
|
|
|
775
|
-
/** Reads and validates a config commitment at one block. */
|
|
776
|
-
async function validateConfig(options: {
|
|
778
|
+
/** Reads and validates a config commitment at one block. @internal */
|
|
779
|
+
export async function validateConfig(options: {
|
|
777
780
|
account: `0x${string}`
|
|
778
781
|
blockNumber: bigint
|
|
779
782
|
client: ReturnType<typeof createClient>
|
|
780
|
-
config:
|
|
783
|
+
config: AccountConfig.Config
|
|
781
784
|
}) {
|
|
782
785
|
const { account, blockNumber, client, config } = options
|
|
783
786
|
const commitment = await getConfigCommitment(client, {
|
|
@@ -810,25 +813,20 @@ async function cacheNextConfigs(options: cacheNextConfigs.Options) {
|
|
|
810
813
|
const [current, threshold, owners] = decoded.args
|
|
811
814
|
const suppliedConfig = (() => {
|
|
812
815
|
try {
|
|
813
|
-
return
|
|
816
|
+
return AccountConfig.from(current)
|
|
814
817
|
} catch {
|
|
815
818
|
return undefined
|
|
816
819
|
}
|
|
817
820
|
})()
|
|
818
821
|
if (
|
|
819
822
|
!suppliedConfig ||
|
|
820
|
-
|
|
821
|
-
|
|
823
|
+
AccountConfig.getCommitment(suppliedConfig).toLowerCase() !==
|
|
824
|
+
AccountConfig.getCommitment(currentConfig).toLowerCase()
|
|
822
825
|
)
|
|
823
826
|
continue
|
|
824
827
|
const config = (() => {
|
|
825
828
|
try {
|
|
826
|
-
return
|
|
827
|
-
owners,
|
|
828
|
-
salt: suppliedConfig.salt,
|
|
829
|
-
threshold,
|
|
830
|
-
version: suppliedConfig.version + 1n,
|
|
831
|
-
})
|
|
829
|
+
return AccountConfig.update(suppliedConfig, { owners, threshold })
|
|
832
830
|
} catch {
|
|
833
831
|
return undefined
|
|
834
832
|
}
|
|
@@ -836,7 +834,7 @@ async function cacheNextConfigs(options: cacheNextConfigs.Options) {
|
|
|
836
834
|
if (!config) continue
|
|
837
835
|
await ConfigStore.write(options.store, {
|
|
838
836
|
address: options.account,
|
|
839
|
-
commitment:
|
|
837
|
+
commitment: AccountConfig.getCommitment(config),
|
|
840
838
|
config,
|
|
841
839
|
})
|
|
842
840
|
currentConfig = config
|
|
@@ -846,25 +844,25 @@ async function cacheNextConfigs(options: cacheNextConfigs.Options) {
|
|
|
846
844
|
declare namespace cacheNextConfigs {
|
|
847
845
|
/** Parameters for {@link cacheNextConfigs}. */
|
|
848
846
|
export type Options = {
|
|
849
|
-
/** Root
|
|
847
|
+
/** Root configurable account. */
|
|
850
848
|
account: Address
|
|
851
849
|
/** Root config used to authorize the transaction. */
|
|
852
|
-
config:
|
|
853
|
-
/** Shared
|
|
850
|
+
config: AccountConfig.Config
|
|
851
|
+
/** Shared account store. */
|
|
854
852
|
store: Store.Store
|
|
855
853
|
/** Submitted transaction containing potential config updates. */
|
|
856
854
|
transaction: Transaction.TransactionSerializableTempo
|
|
857
855
|
}
|
|
858
856
|
}
|
|
859
857
|
|
|
860
|
-
/** Validates primitive approvals and translates invalid input into an RPC error. */
|
|
861
|
-
async function selectApprovals(
|
|
862
|
-
options:
|
|
858
|
+
/** Validates primitive approvals and translates invalid input into an RPC error. @internal */
|
|
859
|
+
export async function selectApprovals(
|
|
860
|
+
options: AccountOperation.selectApprovals.Options,
|
|
863
861
|
) {
|
|
864
862
|
try {
|
|
865
|
-
return await
|
|
863
|
+
return await AccountOperation.selectApprovals(options)
|
|
866
864
|
} catch (error) {
|
|
867
|
-
if (error instanceof
|
|
865
|
+
if (error instanceof AccountOperation.InvalidApprovalError)
|
|
868
866
|
throw new RpcResponse.InvalidParamsError({ message: error.shortMessage })
|
|
869
867
|
throw error
|
|
870
868
|
}
|
|
@@ -873,15 +871,15 @@ async function selectApprovals(
|
|
|
873
871
|
/** Returns an existing successful operation through the requested send method. */
|
|
874
872
|
async function submittedResult(
|
|
875
873
|
options: submit.Options,
|
|
876
|
-
operation:
|
|
874
|
+
operation: AccountOperation.TransactionOperation,
|
|
877
875
|
) {
|
|
878
876
|
if (
|
|
879
877
|
options.method === 'eth_sendRawTransaction' ||
|
|
880
|
-
options.method === '
|
|
878
|
+
options.method === 'account_approveRawTransaction'
|
|
881
879
|
)
|
|
882
880
|
return operation.hash
|
|
883
|
-
if (options.method === '
|
|
884
|
-
return
|
|
881
|
+
if (options.method === 'account_approveRawTransactionSync')
|
|
882
|
+
return AccountOperation.toRpc(operation)
|
|
885
883
|
const timeout = options.request.params?.[1]
|
|
886
884
|
const deadline =
|
|
887
885
|
Date.now() +
|
|
@@ -895,9 +893,11 @@ async function submittedResult(
|
|
|
895
893
|
options.requestOptions,
|
|
896
894
|
)
|
|
897
895
|
if (receipt && typeof receipt === 'object')
|
|
898
|
-
return { ...receipt,
|
|
896
|
+
return { ...receipt, operation: AccountOperation.toRpc(operation) }
|
|
899
897
|
if (Date.now() >= deadline)
|
|
900
|
-
throw new Error(
|
|
898
|
+
throw new Error(
|
|
899
|
+
'Timed out while waiting for the configurable account transaction.',
|
|
900
|
+
)
|
|
901
901
|
await new Promise((resolve) => setTimeout(resolve, pollingInterval))
|
|
902
902
|
}
|
|
903
903
|
}
|
|
@@ -905,11 +905,11 @@ async function submittedResult(
|
|
|
905
905
|
/** Waits for the relay that owns a live submission lease. */
|
|
906
906
|
async function submittingResult(
|
|
907
907
|
options: submit.Options,
|
|
908
|
-
operation:
|
|
908
|
+
operation: AccountOperation.TransactionOperation,
|
|
909
909
|
): Promise<unknown> {
|
|
910
910
|
if (
|
|
911
911
|
options.method === 'eth_sendRawTransaction' ||
|
|
912
|
-
options.method === '
|
|
912
|
+
options.method === 'account_approveRawTransaction'
|
|
913
913
|
)
|
|
914
914
|
return operation.hash
|
|
915
915
|
const timeout = options.request.params?.[1]
|
|
@@ -932,15 +932,15 @@ async function submittingResult(
|
|
|
932
932
|
/** Returns a pending result for an operation that has not reached quorum. */
|
|
933
933
|
function pendingResult(
|
|
934
934
|
method: submit.Options['method'],
|
|
935
|
-
operation:
|
|
935
|
+
operation: AccountOperation.TransactionOperation,
|
|
936
936
|
) {
|
|
937
937
|
if (
|
|
938
938
|
method === 'eth_sendRawTransaction' ||
|
|
939
|
-
method === '
|
|
939
|
+
method === 'account_approveRawTransaction'
|
|
940
940
|
)
|
|
941
941
|
return operation.hash
|
|
942
|
-
if (method === '
|
|
943
|
-
return
|
|
942
|
+
if (method === 'account_approveRawTransactionSync')
|
|
943
|
+
return AccountOperation.toRpc(operation)
|
|
944
944
|
return {
|
|
945
945
|
blockHash: null,
|
|
946
946
|
blockNumber: null,
|
|
@@ -951,7 +951,7 @@ function pendingResult(
|
|
|
951
951
|
gasUsed: null,
|
|
952
952
|
logs: [],
|
|
953
953
|
logsBloom: null,
|
|
954
|
-
|
|
954
|
+
operation: AccountOperation.toRpc(operation),
|
|
955
955
|
status: 'pending',
|
|
956
956
|
to: null,
|
|
957
957
|
transactionHash: operation.hash,
|
|
@@ -963,7 +963,7 @@ function pendingResult(
|
|
|
963
963
|
/** Marks a transaction as successful after a lookup proves that it was submitted. */
|
|
964
964
|
async function completeSubmission(
|
|
965
965
|
store: Store.Atomic,
|
|
966
|
-
operation:
|
|
966
|
+
operation: AccountOperation.TransactionOperation,
|
|
967
967
|
transactionHash: Hex.Hex,
|
|
968
968
|
) {
|
|
969
969
|
if (operation.status !== 'submitting' || !operation.submissionId)
|
|
@@ -993,7 +993,7 @@ async function completeSubmission(
|
|
|
993
993
|
transactionHash: ___,
|
|
994
994
|
...value
|
|
995
995
|
} = current
|
|
996
|
-
return
|
|
996
|
+
return AccountOperation.from({
|
|
997
997
|
...value,
|
|
998
998
|
status: 'success',
|
|
999
999
|
transactionHash,
|
|
@@ -1002,7 +1002,7 @@ async function completeSubmission(
|
|
|
1002
1002
|
},
|
|
1003
1003
|
)
|
|
1004
1004
|
await removeSettledSubmission(store, operation.hash, operation.submissionId)
|
|
1005
|
-
return success as
|
|
1005
|
+
return success as AccountOperation.TransactionOperation
|
|
1006
1006
|
}
|
|
1007
1007
|
|
|
1008
1008
|
/** Releases a failed submission lease without discarding collected approvals. */
|
|
@@ -1020,7 +1020,7 @@ async function releaseSubmission(
|
|
|
1020
1020
|
)
|
|
1021
1021
|
return current
|
|
1022
1022
|
const { expiresAt: _, submissionId: __, ...operation } = current
|
|
1023
|
-
return
|
|
1023
|
+
return AccountOperation.from({
|
|
1024
1024
|
...operation,
|
|
1025
1025
|
status: 'pending',
|
|
1026
1026
|
updatedAt: Date.now(),
|
|
@@ -1054,11 +1054,11 @@ function mergeTransaction(existing: Hex.Hex | undefined, incoming: Hex.Hex) {
|
|
|
1054
1054
|
/** Returns a synthetic transaction while the downstream transaction is unavailable. */
|
|
1055
1055
|
async function toTransaction(
|
|
1056
1056
|
client: ReturnType<typeof createClient>,
|
|
1057
|
-
operation:
|
|
1057
|
+
operation: AccountOperation.TransactionOperation,
|
|
1058
1058
|
) {
|
|
1059
1059
|
const approvals = await (async () => {
|
|
1060
1060
|
if (operation.status !== 'pending')
|
|
1061
|
-
return await
|
|
1061
|
+
return await AccountOperation.selectApprovals({
|
|
1062
1062
|
account: operation.account,
|
|
1063
1063
|
approvals: operation.approvals,
|
|
1064
1064
|
config: operation.config,
|
|
@@ -1080,7 +1080,7 @@ async function toTransaction(
|
|
|
1080
1080
|
})()
|
|
1081
1081
|
const current =
|
|
1082
1082
|
operation.status === 'pending'
|
|
1083
|
-
?
|
|
1083
|
+
? AccountOperation.from({
|
|
1084
1084
|
...operation,
|
|
1085
1085
|
approvals: approvals.approvals,
|
|
1086
1086
|
signatureCount: approvals.signatureCount,
|
|
@@ -1088,7 +1088,7 @@ async function toTransaction(
|
|
|
1088
1088
|
weight: approvals.weight,
|
|
1089
1089
|
})
|
|
1090
1090
|
: operation
|
|
1091
|
-
const serialized =
|
|
1091
|
+
const serialized = AccountOperation.serializeTransaction(current, {
|
|
1092
1092
|
approvals: approvals.selectedApprovals,
|
|
1093
1093
|
})
|
|
1094
1094
|
const transaction = deserialize(serialized)
|
|
@@ -1104,14 +1104,14 @@ async function toTransaction(
|
|
|
1104
1104
|
} as never,
|
|
1105
1105
|
{ pending: true },
|
|
1106
1106
|
),
|
|
1107
|
-
|
|
1107
|
+
operation: AccountOperation.toRpc(current),
|
|
1108
1108
|
}
|
|
1109
1109
|
}
|
|
1110
1110
|
|
|
1111
1111
|
/** Returns the persisted transaction hash for a submitting or successful operation. */
|
|
1112
1112
|
async function getSubmittedTransactionHash(
|
|
1113
1113
|
store: Store.Store,
|
|
1114
|
-
operation:
|
|
1114
|
+
operation: AccountOperation.TransactionOperation,
|
|
1115
1115
|
) {
|
|
1116
1116
|
if (operation.status === 'success') return operation.transactionHash!
|
|
1117
1117
|
if (operation.status !== 'submitting' || !operation.submissionId)
|
|
@@ -1148,7 +1148,7 @@ function maintainSubmissionLease(
|
|
|
1148
1148
|
current.submissionId !== submissionId
|
|
1149
1149
|
)
|
|
1150
1150
|
return current
|
|
1151
|
-
return
|
|
1151
|
+
return AccountOperation.from({
|
|
1152
1152
|
...current,
|
|
1153
1153
|
expiresAt: Math.min(
|
|
1154
1154
|
Date.now() + leaseTtl,
|
|
@@ -1204,7 +1204,7 @@ function getTransactionHash(result: unknown): Hex.Hex {
|
|
|
1204
1204
|
Hash.validate(result.transactionHash)
|
|
1205
1205
|
)
|
|
1206
1206
|
return result.transactionHash
|
|
1207
|
-
throw new Error('Expected transaction hash in
|
|
1207
|
+
throw new Error('Expected transaction hash in account broadcast result.')
|
|
1208
1208
|
}
|
|
1209
1209
|
|
|
1210
1210
|
/** Resolves and validates the chain used by a handled request. */
|
|
@@ -1246,12 +1246,12 @@ async function resolveRequestChainId(
|
|
|
1246
1246
|
value && typeof value === 'object' && 'chainId' in value
|
|
1247
1247
|
? parseChainId(value.chainId)
|
|
1248
1248
|
: undefined
|
|
1249
|
-
const
|
|
1249
|
+
const chainId_operation = await (async () => {
|
|
1250
1250
|
if (
|
|
1251
1251
|
request.method === 'eth_sendRawTransaction' ||
|
|
1252
1252
|
request.method === 'eth_sendRawTransactionSync' ||
|
|
1253
|
-
request.method === '
|
|
1254
|
-
request.method === '
|
|
1253
|
+
request.method === 'account_approveRawTransaction' ||
|
|
1254
|
+
request.method === 'account_approveRawTransactionSync'
|
|
1255
1255
|
) {
|
|
1256
1256
|
if (!isSerializedTempoTransaction(value)) return undefined
|
|
1257
1257
|
try {
|
|
@@ -1262,7 +1262,7 @@ async function resolveRequestChainId(
|
|
|
1262
1262
|
}
|
|
1263
1263
|
|
|
1264
1264
|
if (
|
|
1265
|
-
request.method === '
|
|
1265
|
+
request.method === 'account_approveKeyAuthorization' &&
|
|
1266
1266
|
value &&
|
|
1267
1267
|
typeof value === 'object' &&
|
|
1268
1268
|
'keyAuthorization' in value
|
|
@@ -1285,7 +1285,7 @@ async function resolveRequestChainId(
|
|
|
1285
1285
|
)
|
|
1286
1286
|
return value
|
|
1287
1287
|
if (
|
|
1288
|
-
request.method === '
|
|
1288
|
+
request.method === 'account_approveKeyAuthorization' &&
|
|
1289
1289
|
value &&
|
|
1290
1290
|
typeof value === 'object' &&
|
|
1291
1291
|
'hash' in value
|
|
@@ -1309,13 +1309,13 @@ async function resolveRequestChainId(
|
|
|
1309
1309
|
|
|
1310
1310
|
if (
|
|
1311
1311
|
chainId_body !== undefined &&
|
|
1312
|
-
|
|
1313
|
-
chainId_body !==
|
|
1312
|
+
chainId_operation !== undefined &&
|
|
1313
|
+
chainId_body !== chainId_operation
|
|
1314
1314
|
)
|
|
1315
1315
|
throw new RpcResponse.InvalidParamsError({
|
|
1316
1316
|
message: 'Conflicting chain ids.',
|
|
1317
1317
|
})
|
|
1318
|
-
return chainId_body ??
|
|
1318
|
+
return chainId_body ?? chainId_operation
|
|
1319
1319
|
}
|
|
1320
1320
|
|
|
1321
1321
|
/** Parses a supported chain ID representation. */
|