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
package/tempo/Decorator.ts
CHANGED
|
@@ -4,13 +4,13 @@ import { bindActionDecorators, type Client } from '../clients/createClient.js'
|
|
|
4
4
|
import type { Transport } from '../clients/transports/createTransport.js'
|
|
5
5
|
import type { Chain } from '../types/chain.js'
|
|
6
6
|
import * as accessKeyActions from './actions/accessKey.js'
|
|
7
|
+
import * as accountsActions from './actions/accounts.js'
|
|
7
8
|
import * as ammActions from './actions/amm.js'
|
|
8
9
|
import * as channelActions from './actions/channel.js'
|
|
9
10
|
import * as dexActions from './actions/dex.js'
|
|
10
11
|
import * as earnActions from './actions/earn.js'
|
|
11
12
|
import * as faucetActions from './actions/faucet.js'
|
|
12
13
|
import * as feeActions from './actions/fee.js'
|
|
13
|
-
import * as multisigActions from './actions/multisig.js'
|
|
14
14
|
import * as nonceActions from './actions/nonce.js'
|
|
15
15
|
import * as policyActions from './actions/policy.js'
|
|
16
16
|
import * as propAmmActions from './actions/propAmm.js'
|
|
@@ -308,13 +308,41 @@ type DecoratorBase<
|
|
|
308
308
|
parameters: accessKeyActions.revokeSync.Parameters<chain, account>,
|
|
309
309
|
) => Promise<accessKeyActions.revokeSync.ReturnValue>
|
|
310
310
|
/**
|
|
311
|
-
*
|
|
311
|
+
* Saves a signed key authorization to a relay with key authorization storage.
|
|
312
|
+
*
|
|
313
|
+
* The relay attaches the authorization to the access key's next transaction
|
|
314
|
+
* until the key is active onchain. Requires a relay running the
|
|
315
|
+
* `Relay.keyAuthorization` plugin.
|
|
316
|
+
*
|
|
317
|
+
* @example
|
|
318
|
+
* ```ts
|
|
319
|
+
* import { createClient, http } from 'viem'
|
|
320
|
+
* import { tempo } from 'viem/chains'
|
|
321
|
+
* import { tempoActions, withRelay } from 'viem/tempo'
|
|
322
|
+
*
|
|
323
|
+
* const client = createClient({
|
|
324
|
+
* chain: tempo,
|
|
325
|
+
* transport: withRelay(http(), http('https://relay.example.com'), {
|
|
326
|
+
* keyAuthorization: true,
|
|
327
|
+
* }),
|
|
328
|
+
* }).extend(tempoActions())
|
|
329
|
+
*
|
|
330
|
+
* await client.accessKey.saveAuthorization({ keyAuthorization })
|
|
331
|
+
* ```
|
|
332
|
+
*
|
|
333
|
+
* @param parameters - Parameters.
|
|
334
|
+
*/
|
|
335
|
+
saveAuthorization: (
|
|
336
|
+
parameters: accessKeyActions.saveAuthorization.Parameters,
|
|
337
|
+
) => Promise<accessKeyActions.saveAuthorization.ReturnValue>
|
|
338
|
+
/**
|
|
339
|
+
* Signs a key authorization or adds one coordinated owner approval.
|
|
312
340
|
*
|
|
313
341
|
* @example
|
|
314
342
|
* ```ts
|
|
315
343
|
* const pending = await client.accessKey.signAuthorization({
|
|
316
344
|
* accessKey,
|
|
317
|
-
* account:
|
|
345
|
+
* account: configurable,
|
|
318
346
|
* owner: owner_1,
|
|
319
347
|
* })
|
|
320
348
|
* const success = await client.accessKey.signAuthorization({
|
|
@@ -324,7 +352,7 @@ type DecoratorBase<
|
|
|
324
352
|
* ```
|
|
325
353
|
*
|
|
326
354
|
* @param parameters - Authorization fields, or a stored operation hash.
|
|
327
|
-
* @returns A signed key authorization with
|
|
355
|
+
* @returns A signed key authorization with account operation metadata when coordinated.
|
|
328
356
|
*/
|
|
329
357
|
signAuthorization: {
|
|
330
358
|
(
|
|
@@ -474,6 +502,48 @@ type DecoratorBase<
|
|
|
474
502
|
parameters: accessKeyActions.watchWitnessBurned.Parameters,
|
|
475
503
|
) => ReturnType<typeof accessKeyActions.watchWitnessBurned>
|
|
476
504
|
}
|
|
505
|
+
accounts: {
|
|
506
|
+
/**
|
|
507
|
+
* Gets the current cached config for a configurable account.
|
|
508
|
+
*
|
|
509
|
+
* @param parameters - Parameters.
|
|
510
|
+
* @returns The config, or `null` when it is unknown.
|
|
511
|
+
*/
|
|
512
|
+
getConfig: (
|
|
513
|
+
parameters: accountsActions.getConfig.Parameters,
|
|
514
|
+
) => Promise<accountsActions.getConfig.ReturnValue>
|
|
515
|
+
/** Gets the current configuration commitment for a configurable account. */
|
|
516
|
+
getConfigCommitment: (
|
|
517
|
+
parameters: accountsActions.getConfigCommitment.Parameters,
|
|
518
|
+
) => Promise<accountsActions.getConfigCommitment.ReturnValue>
|
|
519
|
+
/**
|
|
520
|
+
* Gets a coordinated account operation by its hash.
|
|
521
|
+
*
|
|
522
|
+
* @param parameters - Parameters.
|
|
523
|
+
* @returns The operation, or `null` when it is unknown.
|
|
524
|
+
*/
|
|
525
|
+
getOperation: (
|
|
526
|
+
parameters: accountsActions.getOperation.Parameters,
|
|
527
|
+
) => Promise<accountsActions.getOperation.ReturnValue>
|
|
528
|
+
/**
|
|
529
|
+
* Replaces the current configuration for a configurable account.
|
|
530
|
+
*
|
|
531
|
+
* @param parameters - New configuration and transaction parameters.
|
|
532
|
+
* @returns The transaction hash.
|
|
533
|
+
*/
|
|
534
|
+
updateConfig: (
|
|
535
|
+
parameters: accountsActions.updateConfig.Parameters<chain, account>,
|
|
536
|
+
) => Promise<accountsActions.updateConfig.ReturnValue>
|
|
537
|
+
/**
|
|
538
|
+
* Replaces a configurable account configuration and waits for confirmation.
|
|
539
|
+
*
|
|
540
|
+
* @param parameters - New configuration and transaction parameters.
|
|
541
|
+
* @returns The update event and transaction receipt.
|
|
542
|
+
*/
|
|
543
|
+
updateConfigSync: (
|
|
544
|
+
parameters: accountsActions.updateConfigSync.Parameters<chain, account>,
|
|
545
|
+
) => Promise<accountsActions.updateConfigSync.ReturnValue>
|
|
546
|
+
}
|
|
477
547
|
amm: {
|
|
478
548
|
/**
|
|
479
549
|
* Gets the reserves for a liquidity pool.
|
|
@@ -2392,48 +2462,6 @@ type DecoratorBase<
|
|
|
2392
2462
|
parameters: faucetActions.fundSync.Parameters,
|
|
2393
2463
|
) => Promise<faucetActions.fundSync.ReturnValue>
|
|
2394
2464
|
}
|
|
2395
|
-
multisig: {
|
|
2396
|
-
/**
|
|
2397
|
-
* Gets the current cached config for a multisig account.
|
|
2398
|
-
*
|
|
2399
|
-
* @param parameters - Parameters.
|
|
2400
|
-
* @returns The config, or `null` when it is unknown.
|
|
2401
|
-
*/
|
|
2402
|
-
getConfig: (
|
|
2403
|
-
parameters: multisigActions.getConfig.Parameters,
|
|
2404
|
-
) => Promise<multisigActions.getConfig.ReturnValue>
|
|
2405
|
-
/** Gets the current configuration commitment for a multisig account. */
|
|
2406
|
-
getConfigCommitment: (
|
|
2407
|
-
parameters: multisigActions.getConfigCommitment.Parameters,
|
|
2408
|
-
) => Promise<multisigActions.getConfigCommitment.ReturnValue>
|
|
2409
|
-
/**
|
|
2410
|
-
* Gets a coordinated multisig operation by its hash.
|
|
2411
|
-
*
|
|
2412
|
-
* @param parameters - Parameters.
|
|
2413
|
-
* @returns The operation, or `null` when it is unknown.
|
|
2414
|
-
*/
|
|
2415
|
-
getOperation: (
|
|
2416
|
-
parameters: multisigActions.getOperation.Parameters,
|
|
2417
|
-
) => Promise<multisigActions.getOperation.ReturnValue>
|
|
2418
|
-
/**
|
|
2419
|
-
* Replaces the current configuration for a native multisig account.
|
|
2420
|
-
*
|
|
2421
|
-
* @param parameters - New configuration and transaction parameters.
|
|
2422
|
-
* @returns The transaction hash.
|
|
2423
|
-
*/
|
|
2424
|
-
updateConfig: (
|
|
2425
|
-
parameters: multisigActions.updateConfig.Parameters<chain, account>,
|
|
2426
|
-
) => Promise<multisigActions.updateConfig.ReturnValue>
|
|
2427
|
-
/**
|
|
2428
|
-
* Replaces a native multisig configuration and waits for confirmation.
|
|
2429
|
-
*
|
|
2430
|
-
* @param parameters - New configuration and transaction parameters.
|
|
2431
|
-
* @returns The update event and transaction receipt.
|
|
2432
|
-
*/
|
|
2433
|
-
updateConfigSync: (
|
|
2434
|
-
parameters: multisigActions.updateConfigSync.Parameters<chain, account>,
|
|
2435
|
-
) => Promise<multisigActions.updateConfigSync.ReturnValue>
|
|
2436
|
-
}
|
|
2437
2465
|
nonce: {
|
|
2438
2466
|
/**
|
|
2439
2467
|
* Gets the nonce for an account and nonce key.
|
|
@@ -6049,9 +6077,11 @@ type DecorateNamespace<namespace, actions> = {
|
|
|
6049
6077
|
? namespace[key] & BoundActionHelpers<actions[key]>
|
|
6050
6078
|
: namespace[key]
|
|
6051
6079
|
} & {
|
|
6052
|
-
|
|
6053
|
-
|
|
6054
|
-
|
|
6080
|
+
// Error classes and resolvers are not actions; skipping them by name avoids evaluating their types.
|
|
6081
|
+
[key in Exclude<
|
|
6082
|
+
keyof actions,
|
|
6083
|
+
keyof namespace | `${string}Error` | 'errorResolvers'
|
|
6084
|
+
> as actions[key] extends (...parameters: any) => any
|
|
6055
6085
|
? key
|
|
6056
6086
|
: never]: BoundAction<actions[key]>
|
|
6057
6087
|
}
|
|
@@ -6064,6 +6094,10 @@ export type Decorator<
|
|
|
6064
6094
|
DecoratorBase<chain, account>['accessKey'],
|
|
6065
6095
|
typeof accessKeyActions
|
|
6066
6096
|
>
|
|
6097
|
+
accounts: DecorateNamespace<
|
|
6098
|
+
DecoratorBase<chain, account>['accounts'],
|
|
6099
|
+
typeof accountsActions
|
|
6100
|
+
>
|
|
6067
6101
|
amm: DecorateNamespace<
|
|
6068
6102
|
DecoratorBase<chain, account>['amm'],
|
|
6069
6103
|
typeof ammActions
|
|
@@ -6084,10 +6118,6 @@ export type Decorator<
|
|
|
6084
6118
|
DecoratorBase<chain, account>['faucet'],
|
|
6085
6119
|
typeof faucetActions
|
|
6086
6120
|
>
|
|
6087
|
-
multisig: DecorateNamespace<
|
|
6088
|
-
DecoratorBase<chain, account>['multisig'],
|
|
6089
|
-
typeof multisigActions
|
|
6090
|
-
>
|
|
6091
6121
|
nonce: DecorateNamespace<
|
|
6092
6122
|
DecoratorBase<chain, account>['nonce'],
|
|
6093
6123
|
typeof nonceActions
|
|
@@ -6166,6 +6196,7 @@ export function decorator() {
|
|
|
6166
6196
|
'prepareAuthorization',
|
|
6167
6197
|
'revoke',
|
|
6168
6198
|
'revokeSync',
|
|
6199
|
+
'saveAuthorization',
|
|
6169
6200
|
'signAuthorization',
|
|
6170
6201
|
'updateLimit',
|
|
6171
6202
|
'updateLimitSync',
|
|
@@ -6174,6 +6205,13 @@ export function decorator() {
|
|
|
6174
6205
|
'watchWitness',
|
|
6175
6206
|
'watchWitnessBurned',
|
|
6176
6207
|
]),
|
|
6208
|
+
accounts: bindActions(client, accountsActions, [
|
|
6209
|
+
'getConfig',
|
|
6210
|
+
'getConfigCommitment',
|
|
6211
|
+
'getOperation',
|
|
6212
|
+
'updateConfig',
|
|
6213
|
+
'updateConfigSync',
|
|
6214
|
+
]),
|
|
6177
6215
|
amm: bindActions(client, ammActions, [
|
|
6178
6216
|
'getPool',
|
|
6179
6217
|
'getLiquidityBalance',
|
|
@@ -6262,13 +6300,6 @@ export function decorator() {
|
|
|
6262
6300
|
'withdrawExactSync',
|
|
6263
6301
|
]),
|
|
6264
6302
|
faucet: bindActions(client, faucetActions, ['fund', 'fundSync']),
|
|
6265
|
-
multisig: bindActions(client, multisigActions, [
|
|
6266
|
-
'getConfig',
|
|
6267
|
-
'getConfigCommitment',
|
|
6268
|
-
'getOperation',
|
|
6269
|
-
'updateConfig',
|
|
6270
|
-
'updateConfigSync',
|
|
6271
|
-
]),
|
|
6272
6303
|
nonce: bindActions(client, nonceActions, [
|
|
6273
6304
|
'getNonce',
|
|
6274
6305
|
'watchNonceIncremented',
|
package/tempo/ExecutionError.ts
CHANGED
|
@@ -8,7 +8,7 @@ import { formatAbiItem } from '../utils/abi/formatAbiItem.js'
|
|
|
8
8
|
import { toFunctionSelector } from '../utils/hash/toFunctionSelector.js'
|
|
9
9
|
import * as Abis from './Abis.js'
|
|
10
10
|
|
|
11
|
-
type AllAbis = typeof Abis.
|
|
11
|
+
type AllAbis = typeof Abis.coreErrors
|
|
12
12
|
type AbiErrorName = Extract<AllAbis[number], { type: 'error' }>['name']
|
|
13
13
|
|
|
14
14
|
type DecodedError<error = DecodeErrorResultReturnType<AllAbis>> =
|
|
@@ -114,7 +114,7 @@ export const messages: Record<`${AbiErrorName}(${string})`, string> = {
|
|
|
114
114
|
'InvalidMasterAddress()': 'Invalid master address.',
|
|
115
115
|
'InvalidMigrationIndex()': 'Invalid migration index.',
|
|
116
116
|
'InvalidMode()': 'Invalid mode.',
|
|
117
|
-
'InvalidMultisigOwner()': 'Invalid
|
|
117
|
+
'InvalidMultisigOwner()': 'Invalid owner.',
|
|
118
118
|
'InvalidNonceKey()': 'Invalid nonce key.',
|
|
119
119
|
'InvalidOwner()': 'Invalid owner.',
|
|
120
120
|
'InvalidOwnerOrder()': 'Invalid owner order.',
|
|
@@ -230,6 +230,88 @@ export const messages: Record<`${AbiErrorName}(${string})`, string> = {
|
|
|
230
230
|
'ZeroPublicKey()': 'Public key cannot be zero.',
|
|
231
231
|
}
|
|
232
232
|
|
|
233
|
+
/** Steps to resolve an error, keyed by error signature in `Abis.core`. */
|
|
234
|
+
export const hints: Partial<Record<keyof typeof messages, readonly string[]>> =
|
|
235
|
+
{
|
|
236
|
+
'CallNotAllowed()': [
|
|
237
|
+
"The access key's scopes do not allow this target, selector, or recipient.",
|
|
238
|
+
'Authorize an access key whose scopes include this call.',
|
|
239
|
+
],
|
|
240
|
+
'ContractPaused()': [
|
|
241
|
+
'The token is paused. An account with the unpause role can unpause it.',
|
|
242
|
+
],
|
|
243
|
+
'ExpiringNonceReplay()': ['Resend the transaction with a new nonce.'],
|
|
244
|
+
'ExpiryInPast()': ['Set the expiry to a future time.'],
|
|
245
|
+
'InsufficientAllowance()': [
|
|
246
|
+
'Approve the spender for at least this amount.',
|
|
247
|
+
],
|
|
248
|
+
'InsufficientBalance(uint256,uint256,address)': [
|
|
249
|
+
'Fund the account or lower the amount.',
|
|
250
|
+
],
|
|
251
|
+
'InsufficientFeeTokenBalance()': [
|
|
252
|
+
'Fund the account with the fee token, or pay fees with another token.',
|
|
253
|
+
],
|
|
254
|
+
'KeyAlreadyExists()': ['Use a new access key, or revoke the existing one.'],
|
|
255
|
+
'KeyAlreadyRevoked()': [
|
|
256
|
+
'Revoked access keys cannot be used or re-authorized. Authorize a new access key.',
|
|
257
|
+
],
|
|
258
|
+
'KeyExpired()': ['Authorize a new access key.'],
|
|
259
|
+
'KeyNotFound()': [
|
|
260
|
+
'Authorize the access key first, or authorize it in the same transaction with a key authorization.',
|
|
261
|
+
],
|
|
262
|
+
'PolicyForbids()': [
|
|
263
|
+
'The token transfer policy forbids this sender or recipient.',
|
|
264
|
+
],
|
|
265
|
+
'SpendingLimitExceeded()': [
|
|
266
|
+
'Raise the spending limit, or wait for a periodic limit to reset.',
|
|
267
|
+
],
|
|
268
|
+
'UnauthorizedCaller()': ['Sign with the root key or an admin access key.'],
|
|
269
|
+
'AmountExceedsDeposit()': [
|
|
270
|
+
'Top up the channel, or use a voucher for a smaller amount.',
|
|
271
|
+
],
|
|
272
|
+
'AmountNotIncreasing()': [
|
|
273
|
+
'Use a voucher with a higher cumulative amount than the amount already settled.',
|
|
274
|
+
],
|
|
275
|
+
'BelowMinimumOrderSize(uint128)': ['Place a larger order.'],
|
|
276
|
+
'ChannelNotFound()': [
|
|
277
|
+
'Check the channel details, or open the channel first.',
|
|
278
|
+
],
|
|
279
|
+
'CloseNotReady()': [
|
|
280
|
+
'Request a close, then wait for the grace period to end before withdrawing.',
|
|
281
|
+
],
|
|
282
|
+
'InsufficientBalance()': [
|
|
283
|
+
'Deposit more of the token, or lower the amount.',
|
|
284
|
+
],
|
|
285
|
+
'InsufficientLiquidity()': ['Use a smaller amount.'],
|
|
286
|
+
'InsufficientOutput()': [
|
|
287
|
+
'Lower the minimum output amount, or sell a smaller amount.',
|
|
288
|
+
],
|
|
289
|
+
'InsufficientReserves()': ['Use a smaller amount.'],
|
|
290
|
+
'InvalidExpiringNonceExpiry()': [
|
|
291
|
+
'Set the transaction expiry to a time in the near future.',
|
|
292
|
+
],
|
|
293
|
+
'InvalidFlipTick()': [
|
|
294
|
+
'Choose a flip tick on the correct side of the order tick.',
|
|
295
|
+
],
|
|
296
|
+
'MaxInputExceeded()': [
|
|
297
|
+
'Raise the maximum input amount, or buy a smaller amount.',
|
|
298
|
+
],
|
|
299
|
+
'OrderDoesNotExist()': [
|
|
300
|
+
'Check the order ID. Filled and cancelled orders no longer exist.',
|
|
301
|
+
],
|
|
302
|
+
'OrderNotStale()': [
|
|
303
|
+
'Only orders whose maker lost authorization can be cancelled as stale.',
|
|
304
|
+
],
|
|
305
|
+
'PairDoesNotExist()': ['Create the trading pair first.'],
|
|
306
|
+
'PolicyNotFound()': ['Check the policy ID, or create the policy first.'],
|
|
307
|
+
'SignatureTypeMismatch(uint8,uint8)': [
|
|
308
|
+
'Sign with the same key type the access key was authorized with.',
|
|
309
|
+
],
|
|
310
|
+
'SupplyCapExceeded()': ['Mint a smaller amount, or raise the supply cap.'],
|
|
311
|
+
'TickOutOfBounds(int16)': ['Use a tick within the allowed range.'],
|
|
312
|
+
'Unauthorized()': ['The account lacks the permission this call requires.'],
|
|
313
|
+
}
|
|
314
|
+
|
|
233
315
|
/** Interpolate `{0}`, `{1}`, … placeholders with args. */
|
|
234
316
|
function interpolate(template: string, args?: readonly unknown[]): string {
|
|
235
317
|
if (!args) return template
|
|
@@ -370,7 +452,7 @@ function parse(error: Exclude<from.Parameters, Hex>): ExecutionError {
|
|
|
370
452
|
const data = extractRevertData(error)
|
|
371
453
|
if (data) {
|
|
372
454
|
try {
|
|
373
|
-
const decoded = decodeErrorResult({ abi: Abis.
|
|
455
|
+
const decoded = decodeErrorResult({ abi: Abis.coreErrors, data })
|
|
374
456
|
const template =
|
|
375
457
|
messages[formatAbiItem(decoded.abiItem) as keyof typeof messages]
|
|
376
458
|
return {
|
|
@@ -382,7 +464,7 @@ function parse(error: Exclude<from.Parameters, Hex>): ExecutionError {
|
|
|
382
464
|
} as never
|
|
383
465
|
} catch {
|
|
384
466
|
if (data.length === 10) {
|
|
385
|
-
const abiItem = Abis.
|
|
467
|
+
const abiItem = Abis.coreErrors.find(
|
|
386
468
|
(item) =>
|
|
387
469
|
item.type === 'error' &&
|
|
388
470
|
toFunctionSelector(formatAbiItem(item)) === data.toLowerCase(),
|
|
@@ -399,6 +481,22 @@ function parse(error: Exclude<from.Parameters, Hex>): ExecutionError {
|
|
|
399
481
|
}
|
|
400
482
|
}
|
|
401
483
|
|
|
484
|
+
// Nodes print zero-argument errors as `Name(Name)`, whose revert data is the selector alone.
|
|
485
|
+
const debugMatch = /\b(\w+)\(\1\)/.exec(raw)
|
|
486
|
+
const abiItem = debugMatch
|
|
487
|
+
? Abis.coreErrors.find(
|
|
488
|
+
(item) => item.name === debugMatch[1] && item.inputs.length === 0,
|
|
489
|
+
)
|
|
490
|
+
: undefined
|
|
491
|
+
if (abiItem)
|
|
492
|
+
return {
|
|
493
|
+
abiItem,
|
|
494
|
+
args: undefined,
|
|
495
|
+
data: toFunctionSelector(formatAbiItem(abiItem)),
|
|
496
|
+
errorName: abiItem.name,
|
|
497
|
+
message: messages[formatAbiItem(abiItem) as keyof typeof messages]!,
|
|
498
|
+
} as DecodedError
|
|
499
|
+
|
|
402
500
|
// Human-readable names cannot distinguish overloads with different templates.
|
|
403
501
|
const nameMatch = /:\s*(\w+)\(([^)]*)\)/.exec(raw)
|
|
404
502
|
if (nameMatch) {
|
package/tempo/Formatters.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import type { Address } from 'abitype'
|
|
4
4
|
import * as Hex from 'ox/Hex'
|
|
5
5
|
import {
|
|
6
|
-
|
|
6
|
+
AccountOperation,
|
|
7
7
|
Transaction as ox_Transaction,
|
|
8
8
|
TransactionRequest as ox_TransactionRequest,
|
|
9
9
|
} from 'ox/tempo'
|
|
@@ -12,7 +12,7 @@ import { parseAccount } from '../accounts/utils/parseAccount.js'
|
|
|
12
12
|
import { formatTransaction as viem_formatTransaction } from '../utils/formatters/transaction.js'
|
|
13
13
|
import { formatTransactionReceipt as viem_formatTransactionReceipt } from '../utils/formatters/transactionReceipt.js'
|
|
14
14
|
import { formatTransactionRequest as viem_formatTransactionRequest } from '../utils/formatters/transactionRequest.js'
|
|
15
|
-
import type { Account,
|
|
15
|
+
import type { Account, ConfigurableAccount } from './Account.js'
|
|
16
16
|
import {
|
|
17
17
|
isTempo,
|
|
18
18
|
type Transaction,
|
|
@@ -33,7 +33,7 @@ export function formatTransaction(
|
|
|
33
33
|
transaction.blockTimestamp == null
|
|
34
34
|
? undefined
|
|
35
35
|
: BigInt(transaction.blockTimestamp)
|
|
36
|
-
const
|
|
36
|
+
const operation = transaction.operation
|
|
37
37
|
const {
|
|
38
38
|
feePayerSignature,
|
|
39
39
|
gasPrice: _,
|
|
@@ -53,8 +53,8 @@ export function formatTransaction(
|
|
|
53
53
|
yParity: feePayerSignature.yParity,
|
|
54
54
|
}
|
|
55
55
|
: undefined,
|
|
56
|
-
multisig: formatMultisig(multisig),
|
|
57
56
|
nonce: Number(nonce),
|
|
57
|
+
operation: formatOperation(operation),
|
|
58
58
|
typeHex:
|
|
59
59
|
ox_Transaction.toRpcType[
|
|
60
60
|
tx.type as keyof typeof ox_Transaction.toRpcType
|
|
@@ -69,7 +69,7 @@ export function formatTransactionReceipt(
|
|
|
69
69
|
const transactionReceipt = viem_formatTransactionReceipt(receipt as never)
|
|
70
70
|
return {
|
|
71
71
|
...transactionReceipt,
|
|
72
|
-
|
|
72
|
+
operation: formatOperation(receipt.operation),
|
|
73
73
|
...(receipt.status === 'pending'
|
|
74
74
|
? { status: 'pending', type: 'tempo' }
|
|
75
75
|
: {}),
|
|
@@ -77,11 +77,11 @@ export function formatTransactionReceipt(
|
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
/** Formats a transaction operation attached to an RPC result. */
|
|
80
|
-
function
|
|
80
|
+
function formatOperation(value: AccountOperation.TransactionRpc | undefined) {
|
|
81
81
|
if (!value) return undefined
|
|
82
|
-
const operation =
|
|
82
|
+
const operation = AccountOperation.fromRpc(value)
|
|
83
83
|
if (operation.type !== 'transaction')
|
|
84
|
-
throw new Error('Expected
|
|
84
|
+
throw new Error('Expected an account transaction operation.')
|
|
85
85
|
return operation
|
|
86
86
|
}
|
|
87
87
|
|
|
@@ -98,21 +98,21 @@ export function formatTransactionRequest(
|
|
|
98
98
|
keyData?: Hex.Hex | undefined
|
|
99
99
|
keyId?: Address | undefined
|
|
100
100
|
keyType?: 'p256' | 'secp256k1' | 'webAuthn' | undefined
|
|
101
|
-
owner?: viem_Account |
|
|
101
|
+
owner?: viem_Account | ConfigurableAccount | Address | undefined
|
|
102
102
|
signatures?: unknown
|
|
103
103
|
}
|
|
104
104
|
const account = request.account
|
|
105
105
|
? parseAccount<Account | viem_Account | Address>(request.account)
|
|
106
106
|
: undefined
|
|
107
107
|
const owner = request.owner
|
|
108
|
-
? parseAccount<Account |
|
|
108
|
+
? parseAccount<Account | ConfigurableAccount | viem_Account | Address>(
|
|
109
109
|
request.owner,
|
|
110
110
|
)
|
|
111
111
|
: undefined
|
|
112
112
|
|
|
113
113
|
if (owner?.type === 'json-rpc')
|
|
114
114
|
throw new Error(
|
|
115
|
-
'A local owner account is required to approve a
|
|
115
|
+
'A local owner account is required to approve a configurable account transaction.',
|
|
116
116
|
)
|
|
117
117
|
|
|
118
118
|
// If the request is not a Tempo transaction, route to Viem formatter.
|
|
@@ -147,7 +147,7 @@ export function formatTransactionRequest(
|
|
|
147
147
|
if (request.feePayer === true && !request.feePayerSignature)
|
|
148
148
|
delete request.feeToken
|
|
149
149
|
|
|
150
|
-
// Client-only TIP-
|
|
150
|
+
// Client-only TIP-1107 fields drive local signing and envelope assembly.
|
|
151
151
|
const { owner: _owner, signatures: _signatures, ...rpcRequest } = request
|
|
152
152
|
|
|
153
153
|
const rpc = ox_TransactionRequest.toRpc({
|
|
@@ -191,7 +191,8 @@ export function formatTransactionRequest(
|
|
|
191
191
|
...(keyData ? { keyData } : {}),
|
|
192
192
|
...(keyId ? { keyId } : {}),
|
|
193
193
|
...(keyType ? { keyType } : {}),
|
|
194
|
-
// Keep
|
|
194
|
+
// Keep client-only keys visible to `extract`; undefined values never reach JSON-RPC.
|
|
195
|
+
...(request.accountSimulation ? { accountSimulation: undefined } : {}),
|
|
195
196
|
...(request.owner ? { owner: undefined } : {}),
|
|
196
197
|
...(typeof request.feePayer !== 'undefined'
|
|
197
198
|
? {
|
|
@@ -1,49 +1,101 @@
|
|
|
1
1
|
import type { Address } from 'abitype'
|
|
2
|
-
import
|
|
2
|
+
import { KeyAuthorization } from 'ox/tempo'
|
|
3
3
|
import type { MaybePromise } from '../types/utils.js'
|
|
4
|
+
import * as Store from './Store.js'
|
|
4
5
|
|
|
6
|
+
/** Identifies a pending key authorization by account, access key, and chain. */
|
|
5
7
|
export type Key = {
|
|
8
|
+
/** Account the access key acts for. */
|
|
6
9
|
address: Address
|
|
10
|
+
/** Access key address. */
|
|
7
11
|
accessKey: Address
|
|
12
|
+
/** Chain the authorization is for. */
|
|
8
13
|
chainId: number
|
|
9
14
|
}
|
|
10
15
|
|
|
16
|
+
/** Pending key authorizations that the client attaches to an access key's next transaction. */
|
|
11
17
|
export type KeyAuthorizationManager = {
|
|
18
|
+
/** Reads the pending authorization for a key. */
|
|
12
19
|
get(key: Key): MaybePromise<KeyAuthorization.Signed | undefined>
|
|
20
|
+
/** Removes the pending authorization for a key. */
|
|
13
21
|
remove(key: Key): MaybePromise<void>
|
|
22
|
+
/** Stores a pending authorization for a key. */
|
|
14
23
|
set(key: Key, keyAuthorization: KeyAuthorization.Signed): MaybePromise<void>
|
|
15
24
|
}
|
|
16
25
|
|
|
26
|
+
/**
|
|
27
|
+
* Creates a key authorization manager backed by a store.
|
|
28
|
+
*
|
|
29
|
+
* Entries use the same keys as the `Relay.keyAuthorization` plugin, so both can
|
|
30
|
+
* share one store.
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```ts
|
|
34
|
+
* import { Account, KeyAuthorizationManager, Store } from 'viem/tempo'
|
|
35
|
+
*
|
|
36
|
+
* const accessKey = Account.fromP256(privateKey, {
|
|
37
|
+
* access: root,
|
|
38
|
+
* keyAuthorizationManager: KeyAuthorizationManager.from({
|
|
39
|
+
* store: Store.session(),
|
|
40
|
+
* }),
|
|
41
|
+
* })
|
|
42
|
+
* ```
|
|
43
|
+
*
|
|
44
|
+
* @param options - Manager options.
|
|
45
|
+
* @returns A key authorization manager.
|
|
46
|
+
*/
|
|
17
47
|
export function from(options: from.Options): KeyAuthorizationManager {
|
|
18
|
-
|
|
48
|
+
const { store } = options
|
|
49
|
+
return {
|
|
50
|
+
async get(key) {
|
|
51
|
+
const value = await store.getItem(getStoreKey(key))
|
|
52
|
+
if (!value) return undefined
|
|
53
|
+
try {
|
|
54
|
+
return KeyAuthorization.deserialize(
|
|
55
|
+
value as `0x${string}`,
|
|
56
|
+
) as KeyAuthorization.Signed
|
|
57
|
+
} catch {
|
|
58
|
+
return undefined
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
async remove(key) {
|
|
62
|
+
await store.removeItem(getStoreKey(key))
|
|
63
|
+
},
|
|
64
|
+
async set(key, keyAuthorization) {
|
|
65
|
+
await store.setItem(
|
|
66
|
+
getStoreKey(key),
|
|
67
|
+
KeyAuthorization.serialize(keyAuthorization),
|
|
68
|
+
)
|
|
69
|
+
},
|
|
70
|
+
}
|
|
19
71
|
}
|
|
20
72
|
|
|
21
73
|
export declare namespace from {
|
|
22
74
|
type Options = {
|
|
23
|
-
|
|
75
|
+
/** Store for pending key authorizations. */
|
|
76
|
+
store: Store.Store
|
|
24
77
|
}
|
|
25
78
|
}
|
|
26
79
|
|
|
80
|
+
/**
|
|
81
|
+
* Creates a key authorization manager backed by a process-local memory store.
|
|
82
|
+
*
|
|
83
|
+
* @example
|
|
84
|
+
* ```ts
|
|
85
|
+
* import { KeyAuthorizationManager } from 'viem/tempo'
|
|
86
|
+
*
|
|
87
|
+
* const keyAuthorizationManager = KeyAuthorizationManager.memory()
|
|
88
|
+
* ```
|
|
89
|
+
*
|
|
90
|
+
* @returns A key authorization manager.
|
|
91
|
+
*/
|
|
27
92
|
export function memory(): KeyAuthorizationManager {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
return from({
|
|
31
|
-
source: {
|
|
32
|
-
get(key) {
|
|
33
|
-
return keyAuthorizations.get(serializeKey(key))
|
|
34
|
-
},
|
|
35
|
-
remove(key) {
|
|
36
|
-
keyAuthorizations.delete(serializeKey(key))
|
|
37
|
-
},
|
|
38
|
-
set(key, keyAuthorization) {
|
|
39
|
-
keyAuthorizations.set(serializeKey(key), keyAuthorization)
|
|
40
|
-
},
|
|
41
|
-
},
|
|
42
|
-
})
|
|
93
|
+
return from({ store: Store.memory() })
|
|
43
94
|
}
|
|
44
95
|
|
|
45
|
-
function
|
|
96
|
+
function getStoreKey(key: Key) {
|
|
46
97
|
return [
|
|
98
|
+
'keyAuthorization',
|
|
47
99
|
key.chainId,
|
|
48
100
|
key.address.toLowerCase(),
|
|
49
101
|
key.accessKey.toLowerCase(),
|