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/actions/nonce.ts
CHANGED
|
@@ -6,12 +6,20 @@ import type { WatchContractEventParameters } from '../../actions/public/watchCon
|
|
|
6
6
|
import { watchContractEvent } from '../../actions/public/watchContractEvent.js'
|
|
7
7
|
import type { Client } from '../../clients/createClient.js'
|
|
8
8
|
import type { Transport } from '../../clients/transports/createTransport.js'
|
|
9
|
+
import type { BaseErrorType } from '../../errors/base.js'
|
|
9
10
|
import type { Chain } from '../../types/chain.js'
|
|
10
11
|
import type { ExtractAbiItem, GetEventArgs } from '../../types/contract.js'
|
|
11
12
|
import type { Log as viem_Log } from '../../types/log.js'
|
|
12
13
|
import type { UnionOmit } from '../../types/utils.js'
|
|
13
14
|
import * as Abis from '../Abis.js'
|
|
14
15
|
import * as Addresses from '../Addresses.js'
|
|
16
|
+
import type * as Errors from '../errors.js'
|
|
17
|
+
import { TempoExecutionError } from '../errors.js'
|
|
18
|
+
import {
|
|
19
|
+
formatTime,
|
|
20
|
+
type Resolvers,
|
|
21
|
+
withExecutionError,
|
|
22
|
+
} from '../internal/errors.js'
|
|
15
23
|
import type { ReadParameters } from '../internal/types.js'
|
|
16
24
|
import { defineCall } from '../internal/utils.js'
|
|
17
25
|
|
|
@@ -47,7 +55,7 @@ export async function getNonce<
|
|
|
47
55
|
parameters: getNonce.Parameters,
|
|
48
56
|
): Promise<getNonce.ReturnValue> {
|
|
49
57
|
const { account, nonceKey, ...rest } = parameters
|
|
50
|
-
return readContract(client, {
|
|
58
|
+
return withExecutionError(readContract)(client, {
|
|
51
59
|
...rest,
|
|
52
60
|
...getNonce.call({ account, nonceKey }),
|
|
53
61
|
})
|
|
@@ -108,6 +116,8 @@ export namespace getNonce {
|
|
|
108
116
|
functionName: 'getNonce',
|
|
109
117
|
})
|
|
110
118
|
}
|
|
119
|
+
|
|
120
|
+
export type ErrorType = Errors.ExecutionErrorType | BaseErrorType
|
|
111
121
|
}
|
|
112
122
|
|
|
113
123
|
export function watchNonceIncremented<
|
|
@@ -153,3 +163,78 @@ export declare namespace watchNonceIncremented {
|
|
|
153
163
|
onNonceIncremented: (args: Args, log: Log) => void
|
|
154
164
|
}
|
|
155
165
|
}
|
|
166
|
+
|
|
167
|
+
// Errors
|
|
168
|
+
|
|
169
|
+
/** Errors this module throws for decoded Tempo errors. Narrow with `error.name`. */
|
|
170
|
+
export type ExecutionErrorType =
|
|
171
|
+
| NonceInvalidExpiryErrorType
|
|
172
|
+
| NonceReplayErrorType
|
|
173
|
+
|
|
174
|
+
/** `NonceReplayError` with a literal `name`, for narrowing. */
|
|
175
|
+
export type NonceReplayErrorType = NonceReplayError & {
|
|
176
|
+
name: 'NonceReplayError'
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/** Thrown when an expiring nonce transaction was already submitted. */
|
|
180
|
+
export class NonceReplayError extends TempoExecutionError<
|
|
181
|
+
Errors.TempoExecutionError.Decoded<'ExpiringNonceReplay'>
|
|
182
|
+
> {
|
|
183
|
+
/** Transaction expiry (Unix seconds), when known. */
|
|
184
|
+
validBefore: number | bigint | undefined
|
|
185
|
+
|
|
186
|
+
constructor(
|
|
187
|
+
parameters: Errors.TempoExecutionError.Parameters & {
|
|
188
|
+
validBefore?: number | bigint | undefined
|
|
189
|
+
},
|
|
190
|
+
) {
|
|
191
|
+
super(parameters, {
|
|
192
|
+
details: { 'valid before': formatTime(parameters.validBefore) },
|
|
193
|
+
name: 'NonceReplayError',
|
|
194
|
+
})
|
|
195
|
+
this.validBefore = parameters.validBefore
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
/** `NonceInvalidExpiryError` with a literal `name`, for narrowing. */
|
|
200
|
+
export type NonceInvalidExpiryErrorType = NonceInvalidExpiryError & {
|
|
201
|
+
name: 'NonceInvalidExpiryError'
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/** Thrown when an expiring nonce transaction's `validBefore` is in the past or too far ahead. */
|
|
205
|
+
export class NonceInvalidExpiryError extends TempoExecutionError<
|
|
206
|
+
Errors.TempoExecutionError.Decoded<'InvalidExpiringNonceExpiry'>
|
|
207
|
+
> {
|
|
208
|
+
/** Current time (Unix seconds) when the error was handled. */
|
|
209
|
+
now: number
|
|
210
|
+
/** Transaction expiry (Unix seconds), when known. */
|
|
211
|
+
validBefore: number | bigint | undefined
|
|
212
|
+
|
|
213
|
+
constructor(
|
|
214
|
+
parameters: Errors.TempoExecutionError.Parameters & {
|
|
215
|
+
validBefore?: number | bigint | undefined
|
|
216
|
+
},
|
|
217
|
+
) {
|
|
218
|
+
const now = Math.floor(Date.now() / 1000)
|
|
219
|
+
super(parameters, {
|
|
220
|
+
details: {
|
|
221
|
+
'valid before': formatTime(parameters.validBefore),
|
|
222
|
+
now: formatTime(now),
|
|
223
|
+
},
|
|
224
|
+
name: 'NonceInvalidExpiryError',
|
|
225
|
+
})
|
|
226
|
+
this.now = now
|
|
227
|
+
this.validBefore = parameters.validBefore
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
/** @internal */
|
|
232
|
+
export const errorResolvers: Resolvers = {
|
|
233
|
+
'ExpiringNonceReplay()': ({ base, parameters }) =>
|
|
234
|
+
new NonceReplayError({ ...base, validBefore: parameters.validBefore }),
|
|
235
|
+
'InvalidExpiringNonceExpiry()': ({ base, parameters }) =>
|
|
236
|
+
new NonceInvalidExpiryError({
|
|
237
|
+
...base,
|
|
238
|
+
validBefore: parameters.validBefore,
|
|
239
|
+
}),
|
|
240
|
+
}
|
package/tempo/actions/policy.ts
CHANGED
|
@@ -18,6 +18,9 @@ import type { Compute, UnionOmit } from '../../types/utils.js'
|
|
|
18
18
|
import { parseEventLogs } from '../../utils/abi/parseEventLogs.js'
|
|
19
19
|
import * as Abis from '../Abis.js'
|
|
20
20
|
import * as Addresses from '../Addresses.js'
|
|
21
|
+
import type * as Errors from '../errors.js'
|
|
22
|
+
import { TempoExecutionError } from '../errors.js'
|
|
23
|
+
import { type Resolvers, withExecutionError } from '../internal/errors.js'
|
|
21
24
|
import type { ReadParameters, WriteParameters } from '../internal/types.js'
|
|
22
25
|
import { defineCall } from '../internal/utils.js'
|
|
23
26
|
import type { TransactionReceipt } from '../Transaction.js'
|
|
@@ -87,7 +90,7 @@ export namespace create {
|
|
|
87
90
|
export type ReturnValue = WriteContractReturnType
|
|
88
91
|
|
|
89
92
|
// TODO: exhaustive error type
|
|
90
|
-
export type ErrorType = BaseErrorType
|
|
93
|
+
export type ErrorType = Errors.ExecutionErrorType | BaseErrorType
|
|
91
94
|
|
|
92
95
|
/** @internal */
|
|
93
96
|
export async function inner<
|
|
@@ -112,7 +115,7 @@ export namespace create {
|
|
|
112
115
|
const admin = parseAccount(account).address!
|
|
113
116
|
|
|
114
117
|
const call = create.call({ admin, type, addresses })
|
|
115
|
-
return action(client, {
|
|
118
|
+
return withExecutionError(action)(client, {
|
|
116
119
|
...rest,
|
|
117
120
|
account,
|
|
118
121
|
chain,
|
|
@@ -261,7 +264,7 @@ export namespace createSync {
|
|
|
261
264
|
>
|
|
262
265
|
|
|
263
266
|
// TODO: exhaustive error type
|
|
264
|
-
export type ErrorType = BaseErrorType
|
|
267
|
+
export type ErrorType = Errors.ExecutionErrorType | BaseErrorType
|
|
265
268
|
}
|
|
266
269
|
|
|
267
270
|
/**
|
|
@@ -316,7 +319,7 @@ export namespace setAdmin {
|
|
|
316
319
|
export type ReturnValue = WriteContractReturnType
|
|
317
320
|
|
|
318
321
|
// TODO: exhaustive error type
|
|
319
|
-
export type ErrorType = BaseErrorType
|
|
322
|
+
export type ErrorType = Errors.ExecutionErrorType | BaseErrorType
|
|
320
323
|
|
|
321
324
|
/** @internal */
|
|
322
325
|
export async function inner<
|
|
@@ -330,7 +333,7 @@ export namespace setAdmin {
|
|
|
330
333
|
): Promise<ReturnType<action>> {
|
|
331
334
|
const { policyId, admin, ...rest } = parameters
|
|
332
335
|
const call = setAdmin.call({ policyId, admin })
|
|
333
|
-
return (await action(client, {
|
|
336
|
+
return (await withExecutionError(action)(client, {
|
|
334
337
|
...rest,
|
|
335
338
|
...call,
|
|
336
339
|
} as never)) as never
|
|
@@ -466,7 +469,7 @@ export namespace setAdminSync {
|
|
|
466
469
|
>
|
|
467
470
|
|
|
468
471
|
// TODO: exhaustive error type
|
|
469
|
-
export type ErrorType = BaseErrorType
|
|
472
|
+
export type ErrorType = Errors.ExecutionErrorType | BaseErrorType
|
|
470
473
|
}
|
|
471
474
|
|
|
472
475
|
/**
|
|
@@ -524,7 +527,7 @@ export namespace modifyWhitelist {
|
|
|
524
527
|
export type ReturnValue = WriteContractReturnType
|
|
525
528
|
|
|
526
529
|
// TODO: exhaustive error type
|
|
527
|
-
export type ErrorType = BaseErrorType
|
|
530
|
+
export type ErrorType = Errors.ExecutionErrorType | BaseErrorType
|
|
528
531
|
|
|
529
532
|
/** @internal */
|
|
530
533
|
export async function inner<
|
|
@@ -542,7 +545,7 @@ export namespace modifyWhitelist {
|
|
|
542
545
|
allowed,
|
|
543
546
|
policyId,
|
|
544
547
|
})
|
|
545
|
-
return (await action(client, {
|
|
548
|
+
return (await withExecutionError(action)(client, {
|
|
546
549
|
...rest,
|
|
547
550
|
...call,
|
|
548
551
|
} as never)) as never
|
|
@@ -681,7 +684,7 @@ export namespace modifyWhitelistSync {
|
|
|
681
684
|
>
|
|
682
685
|
|
|
683
686
|
// TODO: exhaustive error type
|
|
684
|
-
export type ErrorType = BaseErrorType
|
|
687
|
+
export type ErrorType = Errors.ExecutionErrorType | BaseErrorType
|
|
685
688
|
}
|
|
686
689
|
|
|
687
690
|
/**
|
|
@@ -739,7 +742,7 @@ export namespace modifyBlacklist {
|
|
|
739
742
|
export type ReturnValue = WriteContractReturnType
|
|
740
743
|
|
|
741
744
|
// TODO: exhaustive error type
|
|
742
|
-
export type ErrorType = BaseErrorType
|
|
745
|
+
export type ErrorType = Errors.ExecutionErrorType | BaseErrorType
|
|
743
746
|
|
|
744
747
|
/** @internal */
|
|
745
748
|
export async function inner<
|
|
@@ -757,7 +760,7 @@ export namespace modifyBlacklist {
|
|
|
757
760
|
policyId,
|
|
758
761
|
restricted,
|
|
759
762
|
})
|
|
760
|
-
return (await action(client, {
|
|
763
|
+
return (await withExecutionError(action)(client, {
|
|
761
764
|
...rest,
|
|
762
765
|
...call,
|
|
763
766
|
} as never)) as never
|
|
@@ -896,7 +899,7 @@ export namespace modifyBlacklistSync {
|
|
|
896
899
|
>
|
|
897
900
|
|
|
898
901
|
// TODO: exhaustive error type
|
|
899
|
-
export type ErrorType = BaseErrorType
|
|
902
|
+
export type ErrorType = Errors.ExecutionErrorType | BaseErrorType
|
|
900
903
|
}
|
|
901
904
|
|
|
902
905
|
/**
|
|
@@ -927,7 +930,7 @@ export async function getData<chain extends Chain | undefined>(
|
|
|
927
930
|
parameters: getData.Parameters,
|
|
928
931
|
): Promise<getData.ReturnValue> {
|
|
929
932
|
const { policyId, ...rest } = parameters
|
|
930
|
-
const result = await readContract(client, {
|
|
933
|
+
const result = await withExecutionError(readContract)(client, {
|
|
931
934
|
...rest,
|
|
932
935
|
...getData.call({ policyId }),
|
|
933
936
|
})
|
|
@@ -967,6 +970,8 @@ export namespace getData {
|
|
|
967
970
|
functionName: 'policyData',
|
|
968
971
|
})
|
|
969
972
|
}
|
|
973
|
+
|
|
974
|
+
export type ErrorType = Errors.ExecutionErrorType | BaseErrorType
|
|
970
975
|
}
|
|
971
976
|
|
|
972
977
|
/**
|
|
@@ -998,7 +1003,7 @@ export async function isAuthorized<chain extends Chain | undefined>(
|
|
|
998
1003
|
parameters: isAuthorized.Parameters,
|
|
999
1004
|
): Promise<isAuthorized.ReturnValue> {
|
|
1000
1005
|
const { policyId, user, ...rest } = parameters
|
|
1001
|
-
return readContract(client, {
|
|
1006
|
+
return withExecutionError(readContract)(client, {
|
|
1002
1007
|
...rest,
|
|
1003
1008
|
...isAuthorized.call({ policyId, user }),
|
|
1004
1009
|
})
|
|
@@ -1035,6 +1040,8 @@ export namespace isAuthorized {
|
|
|
1035
1040
|
functionName: 'isAuthorized',
|
|
1036
1041
|
})
|
|
1037
1042
|
}
|
|
1043
|
+
|
|
1044
|
+
export type ErrorType = Errors.ExecutionErrorType | BaseErrorType
|
|
1038
1045
|
}
|
|
1039
1046
|
|
|
1040
1047
|
/**
|
|
@@ -1335,3 +1342,48 @@ export declare namespace watchBlacklistUpdated {
|
|
|
1335
1342
|
onBlacklistUpdated: (args: Args, log: Log) => void
|
|
1336
1343
|
}
|
|
1337
1344
|
}
|
|
1345
|
+
|
|
1346
|
+
// Errors
|
|
1347
|
+
|
|
1348
|
+
/** Errors this module throws for decoded Tempo errors. Narrow with `error.name`. */
|
|
1349
|
+
export type ExecutionErrorType = PolicyNotFoundErrorType
|
|
1350
|
+
|
|
1351
|
+
/** `PolicyNotFoundError` with a literal `name`, for narrowing. */
|
|
1352
|
+
export type PolicyNotFoundErrorType = PolicyNotFoundError & {
|
|
1353
|
+
name: 'PolicyNotFoundError'
|
|
1354
|
+
}
|
|
1355
|
+
|
|
1356
|
+
/** Thrown when a transfer policy does not exist. */
|
|
1357
|
+
export class PolicyNotFoundError extends TempoExecutionError<
|
|
1358
|
+
Errors.TempoExecutionError.Decoded<'PolicyNotFound'>
|
|
1359
|
+
> {
|
|
1360
|
+
/** Policy ID, when known. */
|
|
1361
|
+
policyId: bigint | undefined
|
|
1362
|
+
|
|
1363
|
+
constructor(
|
|
1364
|
+
parameters: Errors.TempoExecutionError.Parameters & {
|
|
1365
|
+
policyId?: bigint | undefined
|
|
1366
|
+
},
|
|
1367
|
+
) {
|
|
1368
|
+
const { policyId } = parameters
|
|
1369
|
+
super(parameters, {
|
|
1370
|
+
details: { policy: policyId },
|
|
1371
|
+
name: 'PolicyNotFoundError',
|
|
1372
|
+
shortMessage:
|
|
1373
|
+
policyId === undefined
|
|
1374
|
+
? undefined
|
|
1375
|
+
: `Transfer policy ${policyId} does not exist.`,
|
|
1376
|
+
})
|
|
1377
|
+
this.policyId = policyId
|
|
1378
|
+
}
|
|
1379
|
+
}
|
|
1380
|
+
|
|
1381
|
+
/** @internal */
|
|
1382
|
+
export const errorResolvers: Resolvers = {
|
|
1383
|
+
'PolicyNotFound()': ({ base, call }) =>
|
|
1384
|
+
new PolicyNotFoundError({
|
|
1385
|
+
...base,
|
|
1386
|
+
policyId:
|
|
1387
|
+
call?.arg<bigint>('policyId') ?? call?.arg<bigint>('newPolicyId'),
|
|
1388
|
+
}),
|
|
1389
|
+
}
|
package/tempo/actions/propAmm.ts
CHANGED
|
@@ -23,6 +23,8 @@ import { isAddressEqual } from '../../utils/address/isAddressEqual.js'
|
|
|
23
23
|
import { pad } from '../../utils/data/pad.js'
|
|
24
24
|
import * as Abis from '../Abis.js'
|
|
25
25
|
import * as Expiry from '../Expiry.js'
|
|
26
|
+
import type * as Errors from '../errors.js'
|
|
27
|
+
import { withExecutionError } from '../internal/errors.js'
|
|
26
28
|
import type { ReadParameters, WriteParameters } from '../internal/types.js'
|
|
27
29
|
import { defineCall, pickWriteParameters } from '../internal/utils.js'
|
|
28
30
|
import type { TransactionReceipt } from '../Transaction.js'
|
|
@@ -52,7 +54,10 @@ export async function baseToken<chain extends Chain | undefined>(
|
|
|
52
54
|
parameters: baseToken.Parameters,
|
|
53
55
|
): Promise<baseToken.ReturnValue> {
|
|
54
56
|
const { pool, ...rest } = parameters
|
|
55
|
-
return readContract(client, {
|
|
57
|
+
return withExecutionError(readContract)(client, {
|
|
58
|
+
...rest,
|
|
59
|
+
...baseToken.call({ pool }),
|
|
60
|
+
})
|
|
56
61
|
}
|
|
57
62
|
|
|
58
63
|
export namespace baseToken {
|
|
@@ -78,6 +83,8 @@ export namespace baseToken {
|
|
|
78
83
|
functionName: 'baseToken',
|
|
79
84
|
})
|
|
80
85
|
}
|
|
86
|
+
|
|
87
|
+
export type ErrorType = Errors.ExecutionErrorType | BaseErrorType
|
|
81
88
|
}
|
|
82
89
|
|
|
83
90
|
/**
|
|
@@ -103,7 +110,10 @@ export async function quoteToken<chain extends Chain | undefined>(
|
|
|
103
110
|
parameters: quoteToken.Parameters,
|
|
104
111
|
): Promise<quoteToken.ReturnValue> {
|
|
105
112
|
const { pool, ...rest } = parameters
|
|
106
|
-
return readContract(client, {
|
|
113
|
+
return withExecutionError(readContract)(client, {
|
|
114
|
+
...rest,
|
|
115
|
+
...quoteToken.call({ pool }),
|
|
116
|
+
})
|
|
107
117
|
}
|
|
108
118
|
|
|
109
119
|
export namespace quoteToken {
|
|
@@ -129,6 +139,8 @@ export namespace quoteToken {
|
|
|
129
139
|
functionName: 'quoteToken',
|
|
130
140
|
})
|
|
131
141
|
}
|
|
142
|
+
|
|
143
|
+
export type ErrorType = Errors.ExecutionErrorType | BaseErrorType
|
|
132
144
|
}
|
|
133
145
|
|
|
134
146
|
/**
|
|
@@ -154,7 +166,10 @@ export async function paused<chain extends Chain | undefined>(
|
|
|
154
166
|
parameters: paused.Parameters,
|
|
155
167
|
): Promise<paused.ReturnValue> {
|
|
156
168
|
const { pool, ...rest } = parameters
|
|
157
|
-
return readContract(client, {
|
|
169
|
+
return withExecutionError(readContract)(client, {
|
|
170
|
+
...rest,
|
|
171
|
+
...paused.call({ pool }),
|
|
172
|
+
})
|
|
158
173
|
}
|
|
159
174
|
|
|
160
175
|
export namespace paused {
|
|
@@ -180,6 +195,8 @@ export namespace paused {
|
|
|
180
195
|
functionName: 'paused',
|
|
181
196
|
})
|
|
182
197
|
}
|
|
198
|
+
|
|
199
|
+
export type ErrorType = Errors.ExecutionErrorType | BaseErrorType
|
|
183
200
|
}
|
|
184
201
|
|
|
185
202
|
/**
|
|
@@ -205,7 +222,7 @@ export async function takerAllowed<chain extends Chain | undefined>(
|
|
|
205
222
|
parameters: takerAllowed.Parameters,
|
|
206
223
|
): Promise<takerAllowed.ReturnValue> {
|
|
207
224
|
const { pool, taker, ...rest } = parameters
|
|
208
|
-
return readContract(client, {
|
|
225
|
+
return withExecutionError(readContract)(client, {
|
|
209
226
|
...rest,
|
|
210
227
|
...takerAllowed.call({ pool, taker }),
|
|
211
228
|
})
|
|
@@ -237,6 +254,8 @@ export namespace takerAllowed {
|
|
|
237
254
|
functionName: 'takerAllowed',
|
|
238
255
|
})
|
|
239
256
|
}
|
|
257
|
+
|
|
258
|
+
export type ErrorType = Errors.ExecutionErrorType | BaseErrorType
|
|
240
259
|
}
|
|
241
260
|
|
|
242
261
|
/**
|
|
@@ -262,7 +281,7 @@ export async function recipientAllowed<chain extends Chain | undefined>(
|
|
|
262
281
|
parameters: recipientAllowed.Parameters,
|
|
263
282
|
): Promise<recipientAllowed.ReturnValue> {
|
|
264
283
|
const { pool, recipient, ...rest } = parameters
|
|
265
|
-
return readContract(client, {
|
|
284
|
+
return withExecutionError(readContract)(client, {
|
|
266
285
|
...rest,
|
|
267
286
|
...recipientAllowed.call({ pool, recipient }),
|
|
268
287
|
})
|
|
@@ -294,6 +313,8 @@ export namespace recipientAllowed {
|
|
|
294
313
|
functionName: 'recipientAllowed',
|
|
295
314
|
})
|
|
296
315
|
}
|
|
316
|
+
|
|
317
|
+
export type ErrorType = Errors.ExecutionErrorType | BaseErrorType
|
|
297
318
|
}
|
|
298
319
|
|
|
299
320
|
/**
|
|
@@ -319,7 +340,7 @@ export async function resolveRecipient<chain extends Chain | undefined>(
|
|
|
319
340
|
parameters: resolveRecipient.Parameters,
|
|
320
341
|
): Promise<resolveRecipient.ReturnValue> {
|
|
321
342
|
const { pool, recipient, ...rest } = parameters
|
|
322
|
-
return readContract(client, {
|
|
343
|
+
return withExecutionError(readContract)(client, {
|
|
323
344
|
...rest,
|
|
324
345
|
...resolveRecipient.call({ pool, recipient }),
|
|
325
346
|
})
|
|
@@ -351,6 +372,8 @@ export namespace resolveRecipient {
|
|
|
351
372
|
functionName: 'resolveRecipient',
|
|
352
373
|
})
|
|
353
374
|
}
|
|
375
|
+
|
|
376
|
+
export type ErrorType = Errors.ExecutionErrorType | BaseErrorType
|
|
354
377
|
}
|
|
355
378
|
|
|
356
379
|
/**
|
|
@@ -396,7 +419,9 @@ export async function getSwapQuote(
|
|
|
396
419
|
if (!recipient) throw new AccountNotFoundError()
|
|
397
420
|
const baseToQuote = parameters.baseToQuote ?? true
|
|
398
421
|
const customerId = parameters.customerId ?? pad(taker, { size: 32 })
|
|
399
|
-
const [amount, price, updatedAt, creditAfter] = await (
|
|
422
|
+
const [amount, price, updatedAt, creditAfter] = await (withExecutionError(
|
|
423
|
+
readContract,
|
|
424
|
+
)(client, {
|
|
400
425
|
...parameters,
|
|
401
426
|
...getSwapQuote.call({
|
|
402
427
|
...parameters,
|
|
@@ -766,7 +791,7 @@ export namespace swap {
|
|
|
766
791
|
|
|
767
792
|
export type ReturnValue = SendTransactionReturnType
|
|
768
793
|
|
|
769
|
-
export type ErrorType = BaseErrorType
|
|
794
|
+
export type ErrorType = Errors.ExecutionErrorType | BaseErrorType
|
|
770
795
|
|
|
771
796
|
/** @internal */
|
|
772
797
|
export async function inner<
|
|
@@ -778,7 +803,7 @@ export namespace swap {
|
|
|
778
803
|
client: Client<Transport, chain, account>,
|
|
779
804
|
parameters: Parameters<chain, account>,
|
|
780
805
|
): Promise<ReturnType<action>> {
|
|
781
|
-
return (await action(client, {
|
|
806
|
+
return (await withExecutionError(action)(client, {
|
|
782
807
|
...parameters,
|
|
783
808
|
calls: await getCalls(client, parameters),
|
|
784
809
|
} as never)) as never
|
|
@@ -995,4 +1020,6 @@ export namespace swapSync {
|
|
|
995
1020
|
receipt: TransactionReceipt
|
|
996
1021
|
}
|
|
997
1022
|
>
|
|
1023
|
+
|
|
1024
|
+
export type ErrorType = swap.ErrorType
|
|
998
1025
|
}
|
|
@@ -22,6 +22,8 @@ import { parseEventLogs } from '../../utils/abi/parseEventLogs.js'
|
|
|
22
22
|
import { isAddressEqual } from '../../utils/index.js'
|
|
23
23
|
import * as Abis from '../Abis.js'
|
|
24
24
|
import * as Addresses from '../Addresses.js'
|
|
25
|
+
import type * as Errors from '../errors.js'
|
|
26
|
+
import { withExecutionError } from '../internal/errors.js'
|
|
25
27
|
import type {
|
|
26
28
|
GetAccountParameter,
|
|
27
29
|
ReadParameters,
|
|
@@ -138,7 +140,7 @@ export namespace burn {
|
|
|
138
140
|
export type ReturnValue = WriteContractReturnType
|
|
139
141
|
|
|
140
142
|
// TODO: exhaustive error type
|
|
141
|
-
export type ErrorType = BaseErrorType
|
|
143
|
+
export type ErrorType = Errors.ExecutionErrorType | BaseErrorType
|
|
142
144
|
|
|
143
145
|
/** @internal */
|
|
144
146
|
export async function inner<
|
|
@@ -160,7 +162,7 @@ export namespace burn {
|
|
|
160
162
|
if (!account) throw new Error('`account` is required')
|
|
161
163
|
|
|
162
164
|
const call = burn.call({ receipt })
|
|
163
|
-
return action(client, {
|
|
165
|
+
return withExecutionError(action)(client, {
|
|
164
166
|
...rest,
|
|
165
167
|
account,
|
|
166
168
|
chain,
|
|
@@ -267,7 +269,7 @@ export namespace burnSync {
|
|
|
267
269
|
>
|
|
268
270
|
|
|
269
271
|
// TODO: exhaustive error type
|
|
270
|
-
export type ErrorType = BaseErrorType
|
|
272
|
+
export type ErrorType = Errors.ExecutionErrorType | BaseErrorType
|
|
271
273
|
}
|
|
272
274
|
|
|
273
275
|
/**
|
|
@@ -322,7 +324,7 @@ export namespace claim {
|
|
|
322
324
|
export type ReturnValue = WriteContractReturnType
|
|
323
325
|
|
|
324
326
|
// TODO: exhaustive error type
|
|
325
|
-
export type ErrorType = BaseErrorType
|
|
327
|
+
export type ErrorType = Errors.ExecutionErrorType | BaseErrorType
|
|
326
328
|
|
|
327
329
|
/** @internal */
|
|
328
330
|
export async function inner<
|
|
@@ -345,7 +347,7 @@ export namespace claim {
|
|
|
345
347
|
if (!account) throw new Error('`account` is required')
|
|
346
348
|
|
|
347
349
|
const call = claim.call({ to, receipt })
|
|
348
|
-
return action(client, {
|
|
350
|
+
return withExecutionError(action)(client, {
|
|
349
351
|
...rest,
|
|
350
352
|
account,
|
|
351
353
|
chain,
|
|
@@ -453,7 +455,7 @@ export namespace claimSync {
|
|
|
453
455
|
>
|
|
454
456
|
|
|
455
457
|
// TODO: exhaustive error type
|
|
456
|
-
export type ErrorType = BaseErrorType
|
|
458
|
+
export type ErrorType = Errors.ExecutionErrorType | BaseErrorType
|
|
457
459
|
}
|
|
458
460
|
|
|
459
461
|
/**
|
|
@@ -496,7 +498,7 @@ export async function get<
|
|
|
496
498
|
tokenPolicyId,
|
|
497
499
|
tokenPolicyType,
|
|
498
500
|
recoveryAuthority,
|
|
499
|
-
] = await readContract(client, {
|
|
501
|
+
] = await withExecutionError(readContract)(client, {
|
|
500
502
|
...rest,
|
|
501
503
|
account: null as never,
|
|
502
504
|
...get.call({ account: account.address }),
|
|
@@ -554,6 +556,8 @@ export namespace get {
|
|
|
554
556
|
args: [account],
|
|
555
557
|
})
|
|
556
558
|
}
|
|
559
|
+
|
|
560
|
+
export type ErrorType = Errors.ExecutionErrorType | BaseErrorType
|
|
557
561
|
}
|
|
558
562
|
|
|
559
563
|
/**
|
|
@@ -584,7 +588,7 @@ export async function getBlockedBalance<chain extends Chain | undefined>(
|
|
|
584
588
|
parameters: getBlockedBalance.Parameters,
|
|
585
589
|
): Promise<getBlockedBalance.ReturnValue> {
|
|
586
590
|
const { receipt, ...rest } = parameters
|
|
587
|
-
return readContract(client, {
|
|
591
|
+
return withExecutionError(readContract)(client, {
|
|
588
592
|
...rest,
|
|
589
593
|
...getBlockedBalance.call({ receipt }),
|
|
590
594
|
})
|
|
@@ -619,6 +623,8 @@ export namespace getBlockedBalance {
|
|
|
619
623
|
args: [receipt],
|
|
620
624
|
})
|
|
621
625
|
}
|
|
626
|
+
|
|
627
|
+
export type ErrorType = Errors.ExecutionErrorType | BaseErrorType
|
|
622
628
|
}
|
|
623
629
|
|
|
624
630
|
/**
|
|
@@ -690,7 +696,7 @@ export namespace set {
|
|
|
690
696
|
export type ReturnValue = WriteContractReturnType
|
|
691
697
|
|
|
692
698
|
// TODO: exhaustive error type
|
|
693
|
-
export type ErrorType = BaseErrorType
|
|
699
|
+
export type ErrorType = Errors.ExecutionErrorType | BaseErrorType
|
|
694
700
|
|
|
695
701
|
/** @internal */
|
|
696
702
|
export async function inner<
|
|
@@ -721,7 +727,7 @@ export namespace set {
|
|
|
721
727
|
tokenFilterId: resolvePolicyRef(tokenPolicyId),
|
|
722
728
|
recoveryAuthority,
|
|
723
729
|
})
|
|
724
|
-
return action(client, {
|
|
730
|
+
return withExecutionError(action)(client, {
|
|
725
731
|
...rest,
|
|
726
732
|
account,
|
|
727
733
|
chain,
|
|
@@ -849,7 +855,7 @@ export namespace setSync {
|
|
|
849
855
|
>
|
|
850
856
|
|
|
851
857
|
// TODO: exhaustive error type
|
|
852
|
-
export type ErrorType = BaseErrorType
|
|
858
|
+
export type ErrorType = Errors.ExecutionErrorType | BaseErrorType
|
|
853
859
|
}
|
|
854
860
|
|
|
855
861
|
/**
|
|
@@ -886,10 +892,13 @@ export async function validate<chain extends Chain | undefined>(
|
|
|
886
892
|
parameters: validate.Parameters,
|
|
887
893
|
): Promise<validate.ReturnValue> {
|
|
888
894
|
const { token, sender, receiver, ...rest } = parameters
|
|
889
|
-
const [authorized, blockedReason] = await readContract(
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
895
|
+
const [authorized, blockedReason] = await withExecutionError(readContract)(
|
|
896
|
+
client,
|
|
897
|
+
{
|
|
898
|
+
...rest,
|
|
899
|
+
...validate.call({ token, sender, receiver }),
|
|
900
|
+
},
|
|
901
|
+
)
|
|
893
902
|
return {
|
|
894
903
|
authorized,
|
|
895
904
|
blockedReason: blockedReasons[blockedReason] ?? 'none',
|
|
@@ -930,6 +939,8 @@ export namespace validate {
|
|
|
930
939
|
args: [token, sender, receiver],
|
|
931
940
|
})
|
|
932
941
|
}
|
|
942
|
+
|
|
943
|
+
export type ErrorType = Errors.ExecutionErrorType | BaseErrorType
|
|
933
944
|
}
|
|
934
945
|
|
|
935
946
|
/**
|