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
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.create = create;
|
|
4
|
+
exports.validateConfig = validateConfig;
|
|
5
|
+
exports.selectApprovals = selectApprovals;
|
|
4
6
|
const Address_ = require("ox/Address");
|
|
5
7
|
const Hash = require("ox/Hash");
|
|
6
8
|
const Hex = require("ox/Hex");
|
|
@@ -13,9 +15,9 @@ const decodeFunctionData_js_1 = require("../../../utils/abi/decodeFunctionData.j
|
|
|
13
15
|
const isAddressEqual_js_1 = require("../../../utils/address/isAddressEqual.js");
|
|
14
16
|
const Abis = require("../../Abis.js");
|
|
15
17
|
const Addresses = require("../../Addresses.js");
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
const
|
|
18
|
+
const ConfigStore = require("../../accounts/Config.js");
|
|
19
|
+
const OperationStore = require("../../accounts/Operation.js");
|
|
20
|
+
const accounts_js_1 = require("../../actions/accounts.js");
|
|
19
21
|
const Transaction = require("../../Transaction.js");
|
|
20
22
|
const Plugin = require("./plugin.js");
|
|
21
23
|
const submissionTtl = 30_000;
|
|
@@ -23,9 +25,9 @@ const pollingInterval = 100;
|
|
|
23
25
|
function create(options) {
|
|
24
26
|
if (!options.store.compareAndSet)
|
|
25
27
|
throw new RpcResponse.InvalidParamsError({
|
|
26
|
-
message: '
|
|
28
|
+
message: 'Account coordination requires a store with atomic `compareAndSet`.',
|
|
27
29
|
});
|
|
28
|
-
return Plugin.
|
|
30
|
+
return Plugin.accounts({
|
|
29
31
|
async handleRequest(context, forward) {
|
|
30
32
|
const { request, options: requestOptions_ } = context;
|
|
31
33
|
const requestOptions = await resolveRequestOptions({
|
|
@@ -44,7 +46,7 @@ function create(options) {
|
|
|
44
46
|
request: (request, options) => next(request, { ...requestOptions, ...options }),
|
|
45
47
|
}, { retryCount: 0 }),
|
|
46
48
|
});
|
|
47
|
-
if (request.method === '
|
|
49
|
+
if (request.method === 'account_getConfig') {
|
|
48
50
|
const value = request.params?.[0];
|
|
49
51
|
const address = value && typeof value === 'object' && 'address' in value
|
|
50
52
|
? value.address
|
|
@@ -53,10 +55,10 @@ function create(options) {
|
|
|
53
55
|
!Address_.validate(address) ||
|
|
54
56
|
Hex.toBigInt(address) === 0n)
|
|
55
57
|
throw new RpcResponse.InvalidParamsError({
|
|
56
|
-
message: 'Expected a
|
|
58
|
+
message: 'Expected a configurable account address.',
|
|
57
59
|
});
|
|
58
60
|
const blockNumber = await (0, getBlockNumber_js_1.getBlockNumber)(client, { cacheTime: 0 });
|
|
59
|
-
const commitment = await (0,
|
|
61
|
+
const commitment = await (0, accounts_js_1.getConfigCommitment)(client, {
|
|
60
62
|
account: address,
|
|
61
63
|
blockNumber,
|
|
62
64
|
});
|
|
@@ -66,18 +68,18 @@ function create(options) {
|
|
|
66
68
|
});
|
|
67
69
|
if (!config)
|
|
68
70
|
return null;
|
|
69
|
-
return tempo_1.
|
|
71
|
+
return tempo_1.AccountConfig.toRpc(config);
|
|
70
72
|
}
|
|
71
|
-
if (request.method === '
|
|
73
|
+
if (request.method === 'account_getOperation') {
|
|
72
74
|
const hash = request.params?.[0];
|
|
73
75
|
if (typeof hash !== 'string' || !Hash.validate(hash))
|
|
74
76
|
throw new RpcResponse.InvalidParamsError({
|
|
75
|
-
message: 'Expected
|
|
77
|
+
message: 'Expected an account operation hash.',
|
|
76
78
|
});
|
|
77
79
|
const operation = await OperationStore.read(options.store, hash);
|
|
78
|
-
return operation ? tempo_1.
|
|
80
|
+
return operation ? tempo_1.AccountOperation.toRpc(operation) : null;
|
|
79
81
|
}
|
|
80
|
-
if (request.method === '
|
|
82
|
+
if (request.method === 'account_approveKeyAuthorization')
|
|
81
83
|
return await approveKeyAuthorization({
|
|
82
84
|
client,
|
|
83
85
|
request,
|
|
@@ -108,7 +110,7 @@ function create(options) {
|
|
|
108
110
|
: operation;
|
|
109
111
|
return {
|
|
110
112
|
...receipt,
|
|
111
|
-
|
|
113
|
+
operation: tempo_1.AccountOperation.toRpc(success),
|
|
112
114
|
};
|
|
113
115
|
}
|
|
114
116
|
if (operation.status === 'pending')
|
|
@@ -127,13 +129,13 @@ function create(options) {
|
|
|
127
129
|
: operation;
|
|
128
130
|
return {
|
|
129
131
|
...transaction,
|
|
130
|
-
|
|
132
|
+
operation: tempo_1.AccountOperation.toRpc(success),
|
|
131
133
|
};
|
|
132
134
|
}
|
|
133
135
|
if (request.method !== 'eth_sendRawTransaction' &&
|
|
134
136
|
request.method !== 'eth_sendRawTransactionSync' &&
|
|
135
|
-
request.method !== '
|
|
136
|
-
request.method !== '
|
|
137
|
+
request.method !== 'account_approveRawTransaction' &&
|
|
138
|
+
request.method !== 'account_approveRawTransactionSync')
|
|
137
139
|
return forward();
|
|
138
140
|
const standard = request.method === 'eth_sendRawTransaction' ||
|
|
139
141
|
request.method === 'eth_sendRawTransactionSync';
|
|
@@ -142,7 +144,7 @@ function create(options) {
|
|
|
142
144
|
if (standard)
|
|
143
145
|
return forward();
|
|
144
146
|
throw new RpcResponse.InvalidParamsError({
|
|
145
|
-
message: 'Expected a serialized Tempo
|
|
147
|
+
message: 'Expected a serialized Tempo configurable account transaction.',
|
|
146
148
|
});
|
|
147
149
|
}
|
|
148
150
|
return await submit({
|
|
@@ -170,26 +172,26 @@ async function submit(options) {
|
|
|
170
172
|
}
|
|
171
173
|
})();
|
|
172
174
|
const signature = transaction?.signature;
|
|
173
|
-
if (!transaction || signature?.type !== '
|
|
175
|
+
if (!transaction || signature?.type !== 'configurable') {
|
|
174
176
|
if (options.method === 'eth_sendRawTransaction' ||
|
|
175
177
|
options.method === 'eth_sendRawTransactionSync')
|
|
176
178
|
return await options.next(options.request, options.requestOptions);
|
|
177
179
|
throw new RpcResponse.InvalidParamsError({
|
|
178
|
-
message: 'Expected a
|
|
180
|
+
message: 'Expected a configurable account transaction signature.',
|
|
179
181
|
});
|
|
180
182
|
}
|
|
181
183
|
const { signature: _, ...unsigned } = transaction;
|
|
182
184
|
const envelope = tempo_1.TxEnvelopeTempo.from(unsigned);
|
|
183
185
|
const serializedUnsigned = serializeUnsigned(envelope, options.serialized.startsWith(tempo_1.TxEnvelopeTempo.feePayerMagic));
|
|
184
186
|
const blockNumber = await (0, getBlockNumber_js_1.getBlockNumber)(options.client, { cacheTime: 0 });
|
|
185
|
-
const config = tempo_1.
|
|
187
|
+
const config = tempo_1.AccountConfig.from(signature.config);
|
|
186
188
|
const configCommitment = await validateConfig({
|
|
187
189
|
account: signature.account,
|
|
188
190
|
blockNumber,
|
|
189
191
|
client: options.client,
|
|
190
192
|
config,
|
|
191
193
|
});
|
|
192
|
-
const operationHash = tempo_1.
|
|
194
|
+
const operationHash = tempo_1.AccountOperation.getHash({
|
|
193
195
|
account: signature.account,
|
|
194
196
|
config,
|
|
195
197
|
transaction: serializedUnsigned,
|
|
@@ -198,7 +200,7 @@ async function submit(options) {
|
|
|
198
200
|
const incoming = signature.signatures.map((signature) => tempo_1.SignatureEnvelope.serialize(signature));
|
|
199
201
|
if (incoming.length === 0)
|
|
200
202
|
throw new RpcResponse.InvalidParamsError({
|
|
201
|
-
message: 'A
|
|
203
|
+
message: 'A owner approval envelope must include a signature.',
|
|
202
204
|
});
|
|
203
205
|
const now = Date.now();
|
|
204
206
|
const expiredSubmissionIds = new Set();
|
|
@@ -225,7 +227,7 @@ async function submit(options) {
|
|
|
225
227
|
hash: operationHash,
|
|
226
228
|
approvals: [...(existingApprovals?.approvals ?? []), ...incoming],
|
|
227
229
|
});
|
|
228
|
-
return tempo_1.
|
|
230
|
+
return tempo_1.AccountOperation.from({
|
|
229
231
|
account: signature.account,
|
|
230
232
|
approvals: approvals.approvals,
|
|
231
233
|
config,
|
|
@@ -268,7 +270,7 @@ async function submit(options) {
|
|
|
268
270
|
const submissionId = Hex.random(32);
|
|
269
271
|
const timeout = options.request.params?.[1];
|
|
270
272
|
const synchronous = options.method === 'eth_sendRawTransactionSync' ||
|
|
271
|
-
options.method === '
|
|
273
|
+
options.method === 'account_approveRawTransactionSync';
|
|
272
274
|
const leaseTtl = synchronous &&
|
|
273
275
|
typeof timeout === 'number' &&
|
|
274
276
|
Number.isSafeInteger(timeout) &&
|
|
@@ -285,7 +287,7 @@ async function submit(options) {
|
|
|
285
287
|
if (current.weight < current.threshold)
|
|
286
288
|
return current;
|
|
287
289
|
const now = Date.now();
|
|
288
|
-
return tempo_1.
|
|
290
|
+
return tempo_1.AccountOperation.from({
|
|
289
291
|
...current,
|
|
290
292
|
expiresAt: Math.min(now + leaseTtl, Number.MAX_SAFE_INTEGER),
|
|
291
293
|
status: 'submitting',
|
|
@@ -318,7 +320,7 @@ async function submit(options) {
|
|
|
318
320
|
hash: claim.hash,
|
|
319
321
|
approvals: claim.approvals,
|
|
320
322
|
});
|
|
321
|
-
const final = tempo_1.
|
|
323
|
+
const final = tempo_1.AccountOperation.serializeTransaction(claim, {
|
|
322
324
|
approvals: finalApprovals.selectedApprovals,
|
|
323
325
|
});
|
|
324
326
|
const transactionHash = tempo_1.TxEnvelopeTempo.hash(tempo_1.TxEnvelopeTempo.deserialize(final));
|
|
@@ -344,7 +346,7 @@ async function submit(options) {
|
|
|
344
346
|
try {
|
|
345
347
|
result = await options.next({
|
|
346
348
|
method: options.method === 'eth_sendRawTransaction' ||
|
|
347
|
-
options.method === '
|
|
349
|
+
options.method === 'account_approveRawTransaction'
|
|
348
350
|
? 'eth_sendRawTransaction'
|
|
349
351
|
: 'eth_sendRawTransactionSync',
|
|
350
352
|
params: [final, ...(options.request.params?.slice(1) ?? [])],
|
|
@@ -392,7 +394,7 @@ async function submit(options) {
|
|
|
392
394
|
current.submissionId !== submissionId)
|
|
393
395
|
throw new OperationStore.InvalidStoreValueError();
|
|
394
396
|
const { expiresAt: _, submissionId: __, ...operation } = current;
|
|
395
|
-
return tempo_1.
|
|
397
|
+
return tempo_1.AccountOperation.from({
|
|
396
398
|
...operation,
|
|
397
399
|
status: 'success',
|
|
398
400
|
transactionHash,
|
|
@@ -405,14 +407,14 @@ async function submit(options) {
|
|
|
405
407
|
if (options.method === 'eth_sendRawTransactionSync' &&
|
|
406
408
|
result &&
|
|
407
409
|
typeof result === 'object')
|
|
408
|
-
return { ...result,
|
|
410
|
+
return { ...result, operation: tempo_1.AccountOperation.toRpc(success) };
|
|
409
411
|
return await submittedResult(options, success);
|
|
410
412
|
}
|
|
411
413
|
async function approveKeyAuthorization(options) {
|
|
412
414
|
const value = options.request.params?.[0];
|
|
413
415
|
if (!value || typeof value !== 'object')
|
|
414
416
|
throw new RpcResponse.InvalidParamsError({
|
|
415
|
-
message: 'Expected a
|
|
417
|
+
message: 'Expected a configurable account key authorization approval.',
|
|
416
418
|
});
|
|
417
419
|
const approval = await (async () => {
|
|
418
420
|
if ('keyAuthorization' in value) {
|
|
@@ -422,24 +424,24 @@ async function approveKeyAuthorization(options) {
|
|
|
422
424
|
}
|
|
423
425
|
catch {
|
|
424
426
|
throw new RpcResponse.InvalidParamsError({
|
|
425
|
-
message: 'Invalid
|
|
427
|
+
message: 'Invalid configurable account key authorization.',
|
|
426
428
|
});
|
|
427
429
|
}
|
|
428
430
|
})();
|
|
429
431
|
const signature = authorization.signature;
|
|
430
|
-
if (signature?.type !== '
|
|
432
|
+
if (signature?.type !== 'configurable')
|
|
431
433
|
throw new RpcResponse.InvalidParamsError({
|
|
432
|
-
message: 'Expected a
|
|
434
|
+
message: 'Expected a configurable account key authorization signature.',
|
|
433
435
|
});
|
|
434
436
|
if (!authorization.account ||
|
|
435
437
|
!(0, isAddressEqual_js_1.isAddressEqual)(authorization.account, signature.account))
|
|
436
438
|
throw new RpcResponse.InvalidParamsError({
|
|
437
|
-
message: '
|
|
439
|
+
message: 'Configurable account key authorization account does not match its signature.',
|
|
438
440
|
});
|
|
439
441
|
const { signature: _, ...unsigned } = authorization;
|
|
440
442
|
const keyAuthorization = tempo_1.KeyAuthorization.serialize(tempo_1.KeyAuthorization.from(unsigned));
|
|
441
|
-
const config = tempo_1.
|
|
442
|
-
const hash = tempo_1.
|
|
443
|
+
const config = tempo_1.AccountConfig.from(signature.config);
|
|
444
|
+
const hash = tempo_1.AccountOperation.getHash({
|
|
443
445
|
account: signature.account,
|
|
444
446
|
config,
|
|
445
447
|
keyAuthorization,
|
|
@@ -456,12 +458,12 @@ async function approveKeyAuthorization(options) {
|
|
|
456
458
|
if ('hash' in value && 'signature' in value) {
|
|
457
459
|
if (typeof value.hash !== 'string' || !Hash.validate(value.hash))
|
|
458
460
|
throw new RpcResponse.InvalidParamsError({
|
|
459
|
-
message: 'Expected
|
|
461
|
+
message: 'Expected an account operation hash.',
|
|
460
462
|
});
|
|
461
463
|
const operation = await OperationStore.read(options.store, value.hash);
|
|
462
464
|
if (!operation || operation.type !== 'keyAuthorization')
|
|
463
465
|
throw new RpcResponse.InvalidParamsError({
|
|
464
|
-
message: '
|
|
466
|
+
message: 'Configurable account key authorization operation was not found.',
|
|
465
467
|
});
|
|
466
468
|
if (operation.status === 'success')
|
|
467
469
|
return { operation };
|
|
@@ -471,7 +473,7 @@ async function approveKeyAuthorization(options) {
|
|
|
471
473
|
}
|
|
472
474
|
catch {
|
|
473
475
|
throw new RpcResponse.InvalidParamsError({
|
|
474
|
-
message: 'Invalid
|
|
476
|
+
message: 'Invalid owner signature.',
|
|
475
477
|
});
|
|
476
478
|
}
|
|
477
479
|
})();
|
|
@@ -484,14 +486,14 @@ async function approveKeyAuthorization(options) {
|
|
|
484
486
|
};
|
|
485
487
|
}
|
|
486
488
|
throw new RpcResponse.InvalidParamsError({
|
|
487
|
-
message: 'Expected a
|
|
489
|
+
message: 'Expected a configurable account key authorization approval.',
|
|
488
490
|
});
|
|
489
491
|
})();
|
|
490
492
|
if ('operation' in approval)
|
|
491
|
-
return tempo_1.
|
|
493
|
+
return tempo_1.AccountOperation.toRpc(approval.operation);
|
|
492
494
|
if (approval.approvals.length === 0)
|
|
493
495
|
throw new RpcResponse.InvalidParamsError({
|
|
494
|
-
message: 'A
|
|
496
|
+
message: 'A owner approval envelope must include a signature.',
|
|
495
497
|
});
|
|
496
498
|
const blockNumber = await (0, getBlockNumber_js_1.getBlockNumber)(options.client, { cacheTime: 0 });
|
|
497
499
|
const commitment = await validateConfig({
|
|
@@ -508,8 +510,8 @@ async function approveKeyAuthorization(options) {
|
|
|
508
510
|
return existing;
|
|
509
511
|
if (existing &&
|
|
510
512
|
(existing.account.toLowerCase() !== approval.account.toLowerCase() ||
|
|
511
|
-
tempo_1.
|
|
512
|
-
tempo_1.
|
|
513
|
+
tempo_1.AccountConfig.getCommitment(existing.config).toLowerCase() !==
|
|
514
|
+
tempo_1.AccountConfig.getCommitment(approval.config).toLowerCase() ||
|
|
513
515
|
existing.keyAuthorization.toLowerCase() !==
|
|
514
516
|
approval.keyAuthorization.toLowerCase()))
|
|
515
517
|
throw new OperationStore.InvalidStoreValueError();
|
|
@@ -548,10 +550,10 @@ async function approveKeyAuthorization(options) {
|
|
|
548
550
|
weight: approvals.weight,
|
|
549
551
|
};
|
|
550
552
|
if (approvals.weight < approvals.threshold)
|
|
551
|
-
return tempo_1.
|
|
552
|
-
return tempo_1.
|
|
553
|
+
return tempo_1.AccountOperation.from({ ...pending, status: 'pending' });
|
|
554
|
+
return tempo_1.AccountOperation.from({
|
|
553
555
|
...pending,
|
|
554
|
-
keyAuthorization: tempo_1.
|
|
556
|
+
keyAuthorization: tempo_1.AccountOperation.serializeKeyAuthorization(approval.keyAuthorization, {
|
|
555
557
|
account: approval.account,
|
|
556
558
|
approvals: approvals.selectedApprovals,
|
|
557
559
|
config: approval.config,
|
|
@@ -566,7 +568,7 @@ async function approveKeyAuthorization(options) {
|
|
|
566
568
|
});
|
|
567
569
|
if (operation.type !== 'keyAuthorization')
|
|
568
570
|
throw new OperationStore.InvalidStoreValueError();
|
|
569
|
-
return tempo_1.
|
|
571
|
+
return tempo_1.AccountOperation.toRpc(operation);
|
|
570
572
|
}
|
|
571
573
|
function deserialize(serialized) {
|
|
572
574
|
try {
|
|
@@ -581,23 +583,23 @@ function deserialize(serialized) {
|
|
|
581
583
|
function assertConfig(options) {
|
|
582
584
|
const { account, commitment, config } = options;
|
|
583
585
|
if (config.version === 0n &&
|
|
584
|
-
tempo_1.
|
|
586
|
+
tempo_1.AccountConfig.getAddress(config, {
|
|
585
587
|
factory: Addresses.nativeMultisigFactory,
|
|
586
588
|
}).toLowerCase() !== account.toLowerCase())
|
|
587
589
|
throw new RpcResponse.InvalidParamsError({
|
|
588
|
-
message: 'Initial
|
|
590
|
+
message: 'Initial account config does not match the configurable account.',
|
|
589
591
|
});
|
|
590
592
|
if (config.version === 0n && Hex.toBigInt(commitment) === 0n)
|
|
591
593
|
return;
|
|
592
594
|
if (commitment.toLowerCase() !==
|
|
593
|
-
tempo_1.
|
|
595
|
+
tempo_1.AccountConfig.getCommitment(config).toLowerCase())
|
|
594
596
|
throw new RpcResponse.InvalidParamsError({
|
|
595
|
-
message: `
|
|
597
|
+
message: `Account config does not match account ${account}.`,
|
|
596
598
|
});
|
|
597
599
|
}
|
|
598
600
|
async function validateConfig(options) {
|
|
599
601
|
const { account, blockNumber, client, config } = options;
|
|
600
|
-
const commitment = await (0,
|
|
602
|
+
const commitment = await (0, accounts_js_1.getConfigCommitment)(client, {
|
|
601
603
|
account,
|
|
602
604
|
blockNumber,
|
|
603
605
|
});
|
|
@@ -624,24 +626,19 @@ async function cacheNextConfigs(options) {
|
|
|
624
626
|
const [current, threshold, owners] = decoded.args;
|
|
625
627
|
const suppliedConfig = (() => {
|
|
626
628
|
try {
|
|
627
|
-
return tempo_1.
|
|
629
|
+
return tempo_1.AccountConfig.from(current);
|
|
628
630
|
}
|
|
629
631
|
catch {
|
|
630
632
|
return undefined;
|
|
631
633
|
}
|
|
632
634
|
})();
|
|
633
635
|
if (!suppliedConfig ||
|
|
634
|
-
tempo_1.
|
|
635
|
-
tempo_1.
|
|
636
|
+
tempo_1.AccountConfig.getCommitment(suppliedConfig).toLowerCase() !==
|
|
637
|
+
tempo_1.AccountConfig.getCommitment(currentConfig).toLowerCase())
|
|
636
638
|
continue;
|
|
637
639
|
const config = (() => {
|
|
638
640
|
try {
|
|
639
|
-
return tempo_1.
|
|
640
|
-
owners,
|
|
641
|
-
salt: suppliedConfig.salt,
|
|
642
|
-
threshold,
|
|
643
|
-
version: suppliedConfig.version + 1n,
|
|
644
|
-
});
|
|
641
|
+
return tempo_1.AccountConfig.update(suppliedConfig, { owners, threshold });
|
|
645
642
|
}
|
|
646
643
|
catch {
|
|
647
644
|
return undefined;
|
|
@@ -651,7 +648,7 @@ async function cacheNextConfigs(options) {
|
|
|
651
648
|
continue;
|
|
652
649
|
await ConfigStore.write(options.store, {
|
|
653
650
|
address: options.account,
|
|
654
|
-
commitment: tempo_1.
|
|
651
|
+
commitment: tempo_1.AccountConfig.getCommitment(config),
|
|
655
652
|
config,
|
|
656
653
|
});
|
|
657
654
|
currentConfig = config;
|
|
@@ -659,20 +656,20 @@ async function cacheNextConfigs(options) {
|
|
|
659
656
|
}
|
|
660
657
|
async function selectApprovals(options) {
|
|
661
658
|
try {
|
|
662
|
-
return await tempo_1.
|
|
659
|
+
return await tempo_1.AccountOperation.selectApprovals(options);
|
|
663
660
|
}
|
|
664
661
|
catch (error) {
|
|
665
|
-
if (error instanceof tempo_1.
|
|
662
|
+
if (error instanceof tempo_1.AccountOperation.InvalidApprovalError)
|
|
666
663
|
throw new RpcResponse.InvalidParamsError({ message: error.shortMessage });
|
|
667
664
|
throw error;
|
|
668
665
|
}
|
|
669
666
|
}
|
|
670
667
|
async function submittedResult(options, operation) {
|
|
671
668
|
if (options.method === 'eth_sendRawTransaction' ||
|
|
672
|
-
options.method === '
|
|
669
|
+
options.method === 'account_approveRawTransaction')
|
|
673
670
|
return operation.hash;
|
|
674
|
-
if (options.method === '
|
|
675
|
-
return tempo_1.
|
|
671
|
+
if (options.method === 'account_approveRawTransactionSync')
|
|
672
|
+
return tempo_1.AccountOperation.toRpc(operation);
|
|
676
673
|
const timeout = options.request.params?.[1];
|
|
677
674
|
const deadline = Date.now() +
|
|
678
675
|
(typeof timeout === 'number' && timeout >= 0 ? timeout : submissionTtl);
|
|
@@ -682,15 +679,15 @@ async function submittedResult(options, operation) {
|
|
|
682
679
|
params: [operation.transactionHash],
|
|
683
680
|
}, options.requestOptions);
|
|
684
681
|
if (receipt && typeof receipt === 'object')
|
|
685
|
-
return { ...receipt,
|
|
682
|
+
return { ...receipt, operation: tempo_1.AccountOperation.toRpc(operation) };
|
|
686
683
|
if (Date.now() >= deadline)
|
|
687
|
-
throw new Error('Timed out while waiting for the
|
|
684
|
+
throw new Error('Timed out while waiting for the configurable account transaction.');
|
|
688
685
|
await new Promise((resolve) => setTimeout(resolve, pollingInterval));
|
|
689
686
|
}
|
|
690
687
|
}
|
|
691
688
|
async function submittingResult(options, operation) {
|
|
692
689
|
if (options.method === 'eth_sendRawTransaction' ||
|
|
693
|
-
options.method === '
|
|
690
|
+
options.method === 'account_approveRawTransaction')
|
|
694
691
|
return operation.hash;
|
|
695
692
|
const timeout = options.request.params?.[1];
|
|
696
693
|
const deadline = Date.now() +
|
|
@@ -710,10 +707,10 @@ async function submittingResult(options, operation) {
|
|
|
710
707
|
}
|
|
711
708
|
function pendingResult(method, operation) {
|
|
712
709
|
if (method === 'eth_sendRawTransaction' ||
|
|
713
|
-
method === '
|
|
710
|
+
method === 'account_approveRawTransaction')
|
|
714
711
|
return operation.hash;
|
|
715
|
-
if (method === '
|
|
716
|
-
return tempo_1.
|
|
712
|
+
if (method === 'account_approveRawTransactionSync')
|
|
713
|
+
return tempo_1.AccountOperation.toRpc(operation);
|
|
717
714
|
return {
|
|
718
715
|
blockHash: null,
|
|
719
716
|
blockNumber: null,
|
|
@@ -724,7 +721,7 @@ function pendingResult(method, operation) {
|
|
|
724
721
|
gasUsed: null,
|
|
725
722
|
logs: [],
|
|
726
723
|
logsBloom: null,
|
|
727
|
-
|
|
724
|
+
operation: tempo_1.AccountOperation.toRpc(operation),
|
|
728
725
|
status: 'pending',
|
|
729
726
|
to: null,
|
|
730
727
|
transactionHash: operation.hash,
|
|
@@ -748,7 +745,7 @@ async function completeSubmission(store, operation, transactionHash) {
|
|
|
748
745
|
current.submissionId !== operation.submissionId)
|
|
749
746
|
throw new OperationStore.InvalidStoreValueError();
|
|
750
747
|
const { expiresAt: _, submissionId: __, transactionHash: ___, ...value } = current;
|
|
751
|
-
return tempo_1.
|
|
748
|
+
return tempo_1.AccountOperation.from({
|
|
752
749
|
...value,
|
|
753
750
|
status: 'success',
|
|
754
751
|
transactionHash,
|
|
@@ -766,7 +763,7 @@ async function releaseSubmission(store, hash, submissionId) {
|
|
|
766
763
|
current.submissionId !== submissionId)
|
|
767
764
|
return current;
|
|
768
765
|
const { expiresAt: _, submissionId: __, ...operation } = current;
|
|
769
|
-
return tempo_1.
|
|
766
|
+
return tempo_1.AccountOperation.from({
|
|
770
767
|
...operation,
|
|
771
768
|
status: 'pending',
|
|
772
769
|
updatedAt: Date.now(),
|
|
@@ -796,7 +793,7 @@ function mergeTransaction(existing, incoming) {
|
|
|
796
793
|
async function toTransaction(client, operation) {
|
|
797
794
|
const approvals = await (async () => {
|
|
798
795
|
if (operation.status !== 'pending')
|
|
799
|
-
return await tempo_1.
|
|
796
|
+
return await tempo_1.AccountOperation.selectApprovals({
|
|
800
797
|
account: operation.account,
|
|
801
798
|
approvals: operation.approvals,
|
|
802
799
|
config: operation.config,
|
|
@@ -817,7 +814,7 @@ async function toTransaction(client, operation) {
|
|
|
817
814
|
});
|
|
818
815
|
})();
|
|
819
816
|
const current = operation.status === 'pending'
|
|
820
|
-
? tempo_1.
|
|
817
|
+
? tempo_1.AccountOperation.from({
|
|
821
818
|
...operation,
|
|
822
819
|
approvals: approvals.approvals,
|
|
823
820
|
signatureCount: approvals.signatureCount,
|
|
@@ -825,7 +822,7 @@ async function toTransaction(client, operation) {
|
|
|
825
822
|
weight: approvals.weight,
|
|
826
823
|
})
|
|
827
824
|
: operation;
|
|
828
|
-
const serialized = tempo_1.
|
|
825
|
+
const serialized = tempo_1.AccountOperation.serializeTransaction(current, {
|
|
829
826
|
approvals: approvals.selectedApprovals,
|
|
830
827
|
});
|
|
831
828
|
const transaction = deserialize(serialized);
|
|
@@ -838,7 +835,7 @@ async function toTransaction(client, operation) {
|
|
|
838
835
|
hash: operation.hash,
|
|
839
836
|
transactionIndex: null,
|
|
840
837
|
}, { pending: true }),
|
|
841
|
-
|
|
838
|
+
operation: tempo_1.AccountOperation.toRpc(current),
|
|
842
839
|
};
|
|
843
840
|
}
|
|
844
841
|
async function getSubmittedTransactionHash(store, operation) {
|
|
@@ -863,7 +860,7 @@ function maintainSubmissionLease(store, hash, submissionId, leaseTtl) {
|
|
|
863
860
|
if (current.status !== 'submitting' ||
|
|
864
861
|
current.submissionId !== submissionId)
|
|
865
862
|
return current;
|
|
866
|
-
return tempo_1.
|
|
863
|
+
return tempo_1.AccountOperation.from({
|
|
867
864
|
...current,
|
|
868
865
|
expiresAt: Math.min(Date.now() + leaseTtl, Number.MAX_SAFE_INTEGER),
|
|
869
866
|
updatedAt: Date.now(),
|
|
@@ -903,7 +900,7 @@ function getTransactionHash(result) {
|
|
|
903
900
|
typeof result.transactionHash === 'string' &&
|
|
904
901
|
Hash.validate(result.transactionHash))
|
|
905
902
|
return result.transactionHash;
|
|
906
|
-
throw new Error('Expected transaction hash in
|
|
903
|
+
throw new Error('Expected transaction hash in account broadcast result.');
|
|
907
904
|
}
|
|
908
905
|
async function resolveRequestOptions(options) {
|
|
909
906
|
const { request, requestOptions, store } = options;
|
|
@@ -930,11 +927,11 @@ async function resolveRequestChainId(request, store) {
|
|
|
930
927
|
const chainId_body = value && typeof value === 'object' && 'chainId' in value
|
|
931
928
|
? parseChainId(value.chainId)
|
|
932
929
|
: undefined;
|
|
933
|
-
const
|
|
930
|
+
const chainId_operation = await (async () => {
|
|
934
931
|
if (request.method === 'eth_sendRawTransaction' ||
|
|
935
932
|
request.method === 'eth_sendRawTransactionSync' ||
|
|
936
|
-
request.method === '
|
|
937
|
-
request.method === '
|
|
933
|
+
request.method === 'account_approveRawTransaction' ||
|
|
934
|
+
request.method === 'account_approveRawTransactionSync') {
|
|
938
935
|
if (!isSerializedTempoTransaction(value))
|
|
939
936
|
return undefined;
|
|
940
937
|
try {
|
|
@@ -944,7 +941,7 @@ async function resolveRequestChainId(request, store) {
|
|
|
944
941
|
return undefined;
|
|
945
942
|
}
|
|
946
943
|
}
|
|
947
|
-
if (request.method === '
|
|
944
|
+
if (request.method === 'account_approveKeyAuthorization' &&
|
|
948
945
|
value &&
|
|
949
946
|
typeof value === 'object' &&
|
|
950
947
|
'keyAuthorization' in value) {
|
|
@@ -959,7 +956,7 @@ async function resolveRequestChainId(request, store) {
|
|
|
959
956
|
if (request.method === 'eth_getTransactionByHash' ||
|
|
960
957
|
request.method === 'eth_getTransactionReceipt')
|
|
961
958
|
return value;
|
|
962
|
-
if (request.method === '
|
|
959
|
+
if (request.method === 'account_approveKeyAuthorization' &&
|
|
963
960
|
value &&
|
|
964
961
|
typeof value === 'object' &&
|
|
965
962
|
'hash' in value)
|
|
@@ -976,12 +973,12 @@ async function resolveRequestChainId(request, store) {
|
|
|
976
973
|
return parseChainId(tempo_1.KeyAuthorization.deserialize(operation.keyAuthorization).chainId);
|
|
977
974
|
})();
|
|
978
975
|
if (chainId_body !== undefined &&
|
|
979
|
-
|
|
980
|
-
chainId_body !==
|
|
976
|
+
chainId_operation !== undefined &&
|
|
977
|
+
chainId_body !== chainId_operation)
|
|
981
978
|
throw new RpcResponse.InvalidParamsError({
|
|
982
979
|
message: 'Conflicting chain ids.',
|
|
983
980
|
});
|
|
984
|
-
return chainId_body ??
|
|
981
|
+
return chainId_body ?? chainId_operation;
|
|
985
982
|
}
|
|
986
983
|
function parseChainId(value) {
|
|
987
984
|
const chainId = (() => {
|
|
@@ -1007,4 +1004,4 @@ function isSerializedTempoTransaction(value) {
|
|
|
1007
1004
|
return (typeof value === 'string' &&
|
|
1008
1005
|
(value.startsWith('0x76') || value.startsWith('0x78')));
|
|
1009
1006
|
}
|
|
1010
|
-
//# sourceMappingURL=
|
|
1007
|
+
//# sourceMappingURL=accounts.js.map
|