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
|
@@ -29,6 +29,8 @@ import { isAddressEqual } from '../../../utils/address/isAddressEqual.js'
|
|
|
29
29
|
import { getChainContractAddress } from '../../../utils/chain/getChainContractAddress.js'
|
|
30
30
|
import * as Abis from '../../Abis.js'
|
|
31
31
|
import * as Addresses from '../../Addresses.js'
|
|
32
|
+
import type * as Errors from '../../errors.js'
|
|
33
|
+
import { withExecutionError } from '../../internal/errors.js'
|
|
32
34
|
import type {
|
|
33
35
|
WriteParameters,
|
|
34
36
|
WriteSyncParameters,
|
|
@@ -195,7 +197,7 @@ export namespace createErc4626Engine {
|
|
|
195
197
|
export type ReturnValue = WriteContractReturnType
|
|
196
198
|
|
|
197
199
|
// TODO: exhaustive error type
|
|
198
|
-
export type ErrorType = BaseErrorType
|
|
200
|
+
export type ErrorType = Errors.ExecutionErrorType | BaseErrorType
|
|
199
201
|
|
|
200
202
|
/** @internal */
|
|
201
203
|
export async function inner<
|
|
@@ -221,7 +223,7 @@ export namespace createErc4626Engine {
|
|
|
221
223
|
if (!account) throw new AccountNotFoundError()
|
|
222
224
|
if (!owner_) throw new Error('`owner` is required.')
|
|
223
225
|
const owner = parseAccount(owner_).address
|
|
224
|
-
return (await action(client, {
|
|
226
|
+
return (await withExecutionError(action)(client, {
|
|
225
227
|
...rest,
|
|
226
228
|
account,
|
|
227
229
|
chain,
|
|
@@ -389,7 +391,7 @@ export namespace createErc4626EngineSync {
|
|
|
389
391
|
> & { receipt: TransactionReceipt }
|
|
390
392
|
>
|
|
391
393
|
// TODO: exhaustive error type
|
|
392
|
-
export type ErrorType = BaseErrorType
|
|
394
|
+
export type ErrorType = Errors.ExecutionErrorType | BaseErrorType
|
|
393
395
|
}
|
|
394
396
|
|
|
395
397
|
/**
|
|
@@ -462,7 +464,7 @@ export namespace createStack {
|
|
|
462
464
|
export type ReturnValue = WriteContractReturnType
|
|
463
465
|
|
|
464
466
|
// TODO: exhaustive error type
|
|
465
|
-
export type ErrorType = BaseErrorType
|
|
467
|
+
export type ErrorType = Errors.ExecutionErrorType | BaseErrorType
|
|
466
468
|
|
|
467
469
|
/** @internal */
|
|
468
470
|
export async function inner<
|
|
@@ -489,7 +491,7 @@ export namespace createStack {
|
|
|
489
491
|
} = parameters
|
|
490
492
|
if (!account) throw new AccountNotFoundError()
|
|
491
493
|
if (!owner_) throw new Error('`owner` is required.')
|
|
492
|
-
return (await action(client, {
|
|
494
|
+
return (await withExecutionError(action)(client, {
|
|
493
495
|
...rest,
|
|
494
496
|
account,
|
|
495
497
|
chain,
|
|
@@ -657,7 +659,7 @@ export namespace createStackSync {
|
|
|
657
659
|
> & { receipt: TransactionReceipt }
|
|
658
660
|
>
|
|
659
661
|
// TODO: exhaustive error type
|
|
660
|
-
export type ErrorType = BaseErrorType
|
|
662
|
+
export type ErrorType = Errors.ExecutionErrorType | BaseErrorType
|
|
661
663
|
}
|
|
662
664
|
|
|
663
665
|
/**
|
|
@@ -713,7 +715,7 @@ export namespace bindEngine {
|
|
|
713
715
|
> = WriteParameters<chain, account> & Args
|
|
714
716
|
export type ReturnValue = WriteContractReturnType
|
|
715
717
|
// TODO: exhaustive error type
|
|
716
|
-
export type ErrorType = BaseErrorType
|
|
718
|
+
export type ErrorType = Errors.ExecutionErrorType | BaseErrorType
|
|
717
719
|
|
|
718
720
|
/** @internal */
|
|
719
721
|
export async function inner<
|
|
@@ -726,7 +728,7 @@ export namespace bindEngine {
|
|
|
726
728
|
parameters: Parameters<chain, account>,
|
|
727
729
|
): Promise<ReturnType<action>> {
|
|
728
730
|
const { engine, finalOwner, vault, ...rest } = parameters
|
|
729
|
-
return (await action(client, {
|
|
731
|
+
return (await withExecutionError(action)(client, {
|
|
730
732
|
...rest,
|
|
731
733
|
...bindEngine.call({ engine, finalOwner, vault }),
|
|
732
734
|
} as never)) as never
|
|
@@ -860,7 +862,7 @@ export namespace bindEngineSync {
|
|
|
860
862
|
vault: Address
|
|
861
863
|
}
|
|
862
864
|
// TODO: exhaustive error type
|
|
863
|
-
export type ErrorType = BaseErrorType
|
|
865
|
+
export type ErrorType = Errors.ExecutionErrorType | BaseErrorType
|
|
864
866
|
}
|
|
865
867
|
|
|
866
868
|
export type DeployErc4626StackErrorType = DeployErc4626StackError & {
|
package/tempo/actions/earn.ts
CHANGED
|
@@ -40,6 +40,7 @@ import { withResolvers } from '../../utils/promise/withResolvers.js'
|
|
|
40
40
|
import { stringify } from '../../utils/stringify.js'
|
|
41
41
|
import * as Abis from '../Abis.js'
|
|
42
42
|
import * as Addresses from '../Addresses.js'
|
|
43
|
+
import type * as Errors from '../errors.js'
|
|
43
44
|
import {
|
|
44
45
|
GetVaultEngineChangedError,
|
|
45
46
|
type GetVaultEngineChangedErrorType,
|
|
@@ -48,6 +49,7 @@ import {
|
|
|
48
49
|
WaitForPrivateRedeemTimeoutError,
|
|
49
50
|
type WaitForPrivateRedeemTimeoutErrorType,
|
|
50
51
|
} from '../errors.js'
|
|
52
|
+
import { withExecutionError } from '../internal/errors.js'
|
|
51
53
|
import type {
|
|
52
54
|
GetAccountParameter,
|
|
53
55
|
ReadParameters,
|
|
@@ -277,20 +279,20 @@ export async function validateExitSafePolicy<chain extends Chain | undefined>(
|
|
|
277
279
|
parameters
|
|
278
280
|
const [tokenPolicyId, compound, simplePolicy, memberResults] =
|
|
279
281
|
await Promise.all([
|
|
280
|
-
readContract(client, {
|
|
282
|
+
withExecutionError(readContract)(client, {
|
|
281
283
|
...rest,
|
|
282
284
|
abi: Abis.tip20,
|
|
283
285
|
address: shareToken,
|
|
284
286
|
functionName: 'transferPolicyId',
|
|
285
287
|
}),
|
|
286
|
-
readContract(client, {
|
|
288
|
+
withExecutionError(readContract)(client, {
|
|
287
289
|
...rest,
|
|
288
290
|
abi: Abis.tip403Registry,
|
|
289
291
|
address: Addresses.tip403Registry,
|
|
290
292
|
args: [policy.transferPolicyId],
|
|
291
293
|
functionName: 'compoundPolicyData',
|
|
292
294
|
}),
|
|
293
|
-
readContract(client, {
|
|
295
|
+
withExecutionError(readContract)(client, {
|
|
294
296
|
...rest,
|
|
295
297
|
abi: Abis.tip403Registry,
|
|
296
298
|
address: Addresses.tip403Registry,
|
|
@@ -300,14 +302,14 @@ export async function validateExitSafePolicy<chain extends Chain | undefined>(
|
|
|
300
302
|
Promise.all(
|
|
301
303
|
requiredMembers.map(async (member) => {
|
|
302
304
|
const [recipient, mintRecipient] = await Promise.all([
|
|
303
|
-
readContract(client, {
|
|
305
|
+
withExecutionError(readContract)(client, {
|
|
304
306
|
...rest,
|
|
305
307
|
abi: Abis.tip403Registry,
|
|
306
308
|
address: Addresses.tip403Registry,
|
|
307
309
|
args: [policy.transferPolicyId, member],
|
|
308
310
|
functionName: 'isAuthorizedRecipient',
|
|
309
311
|
}),
|
|
310
|
-
readContract(client, {
|
|
312
|
+
withExecutionError(readContract)(client, {
|
|
311
313
|
...rest,
|
|
312
314
|
abi: Abis.tip403Registry,
|
|
313
315
|
address: Addresses.tip403Registry,
|
|
@@ -359,7 +361,7 @@ export namespace validateExitSafePolicy {
|
|
|
359
361
|
export type Parameters = Omit<ReadParameters, 'account'> & Args
|
|
360
362
|
export type ReturnValue = void
|
|
361
363
|
// TODO: exhaustive error type
|
|
362
|
-
export type ErrorType = BaseErrorType
|
|
364
|
+
export type ErrorType = Errors.ExecutionErrorType | BaseErrorType
|
|
363
365
|
}
|
|
364
366
|
|
|
365
367
|
/**
|
|
@@ -427,7 +429,7 @@ export namespace deposit {
|
|
|
427
429
|
> = WriteParameters<chain, account> & Args
|
|
428
430
|
export type ReturnValue = SendTransactionReturnType
|
|
429
431
|
// TODO: exhaustive error type
|
|
430
|
-
export type ErrorType = BaseErrorType
|
|
432
|
+
export type ErrorType = Errors.ExecutionErrorType | BaseErrorType
|
|
431
433
|
|
|
432
434
|
/** @internal Shared dispatch; reads the asset for the approval. */
|
|
433
435
|
export async function inner<
|
|
@@ -441,13 +443,13 @@ export namespace deposit {
|
|
|
441
443
|
): Promise<ReturnType<action>> {
|
|
442
444
|
const [args, assetToken] = await Promise.all([
|
|
443
445
|
toDepositArgs(client, parameters as never),
|
|
444
|
-
readContract(client, {
|
|
446
|
+
withExecutionError(readContract)(client, {
|
|
445
447
|
abi: Abis.earnVault,
|
|
446
448
|
address: parameters.vault,
|
|
447
449
|
functionName: 'asset',
|
|
448
450
|
}),
|
|
449
451
|
])
|
|
450
|
-
return (await action(client, {
|
|
452
|
+
return (await withExecutionError(action)(client, {
|
|
451
453
|
...parameters,
|
|
452
454
|
calls: deposit.calls({ ...args, assetToken }),
|
|
453
455
|
} as never)) as never
|
|
@@ -659,7 +661,7 @@ export namespace depositSync {
|
|
|
659
661
|
shareAmount: bigint
|
|
660
662
|
}>
|
|
661
663
|
// TODO: exhaustive error type
|
|
662
|
-
export type ErrorType = BaseErrorType
|
|
664
|
+
export type ErrorType = Errors.ExecutionErrorType | BaseErrorType
|
|
663
665
|
}
|
|
664
666
|
|
|
665
667
|
/**
|
|
@@ -730,7 +732,7 @@ export namespace depositShares {
|
|
|
730
732
|
> = WriteParameters<chain, account> & Args
|
|
731
733
|
export type ReturnValue = SendTransactionReturnType
|
|
732
734
|
// TODO: exhaustive error type
|
|
733
|
-
export type ErrorType = BaseErrorType
|
|
735
|
+
export type ErrorType = Errors.ExecutionErrorType | BaseErrorType
|
|
734
736
|
|
|
735
737
|
/** @internal Shared dispatch; reads the engine for the approval. */
|
|
736
738
|
export async function inner<
|
|
@@ -742,12 +744,12 @@ export namespace depositShares {
|
|
|
742
744
|
client: Client<Transport, chain, account>,
|
|
743
745
|
parameters: depositShares.Parameters<chain, account>,
|
|
744
746
|
): Promise<ReturnType<action>> {
|
|
745
|
-
const engine = await readContract(client, {
|
|
747
|
+
const engine = await withExecutionError(readContract)(client, {
|
|
746
748
|
abi: Abis.earnVault,
|
|
747
749
|
address: parameters.vault,
|
|
748
750
|
functionName: 'engine',
|
|
749
751
|
})
|
|
750
|
-
return (await action(client, {
|
|
752
|
+
return (await withExecutionError(action)(client, {
|
|
751
753
|
...parameters,
|
|
752
754
|
calls: depositShares.calls({
|
|
753
755
|
...toDepositSharesArgs(client, parameters as never),
|
|
@@ -968,7 +970,7 @@ export namespace depositSharesSync {
|
|
|
968
970
|
venueShareAmount: bigint
|
|
969
971
|
}>
|
|
970
972
|
// TODO: exhaustive error type
|
|
971
|
-
export type ErrorType = BaseErrorType
|
|
973
|
+
export type ErrorType = Errors.ExecutionErrorType | BaseErrorType
|
|
972
974
|
}
|
|
973
975
|
|
|
974
976
|
/**
|
|
@@ -1326,7 +1328,7 @@ export async function getFeeState<chain extends Chain | undefined>(
|
|
|
1326
1328
|
parameters: getFeeState.Parameters,
|
|
1327
1329
|
): Promise<getFeeState.ReturnValue> {
|
|
1328
1330
|
const { recipient, vault, ...rest } = parameters
|
|
1329
|
-
const fees = await readContract(client, {
|
|
1331
|
+
const fees = await withExecutionError(readContract)(client, {
|
|
1330
1332
|
...rest,
|
|
1331
1333
|
abi: Abis.earnVault,
|
|
1332
1334
|
address: vault,
|
|
@@ -1363,7 +1365,7 @@ export async function getFeeState<chain extends Chain | undefined>(
|
|
|
1363
1365
|
// consistent with the batched id.
|
|
1364
1366
|
const feeConfig = async (configId: bigint) =>
|
|
1365
1367
|
toFeeConfig(
|
|
1366
|
-
await readContract(client, {
|
|
1368
|
+
await withExecutionError(readContract)(client, {
|
|
1367
1369
|
...rest,
|
|
1368
1370
|
abi: Abis.earnFees,
|
|
1369
1371
|
address: fees,
|
|
@@ -1439,7 +1441,7 @@ export namespace getFeeState {
|
|
|
1439
1441
|
targetBase: bigint
|
|
1440
1442
|
}
|
|
1441
1443
|
// TODO: exhaustive error type
|
|
1442
|
-
export type ErrorType = BaseErrorType
|
|
1444
|
+
export type ErrorType = Errors.ExecutionErrorType | BaseErrorType
|
|
1443
1445
|
}
|
|
1444
1446
|
|
|
1445
1447
|
/** Vault fee configuration. */
|
|
@@ -1571,7 +1573,7 @@ export async function getPosition<
|
|
|
1571
1573
|
],
|
|
1572
1574
|
deployless: true,
|
|
1573
1575
|
})
|
|
1574
|
-
const value = await readContract(client, {
|
|
1576
|
+
const value = await withExecutionError(readContract)(client, {
|
|
1575
1577
|
...rest,
|
|
1576
1578
|
abi: Abis.earnVault,
|
|
1577
1579
|
address: vault,
|
|
@@ -1615,7 +1617,7 @@ export namespace getPosition {
|
|
|
1615
1617
|
value: bigint
|
|
1616
1618
|
}
|
|
1617
1619
|
// TODO: exhaustive error type
|
|
1618
|
-
export type ErrorType = BaseErrorType
|
|
1620
|
+
export type ErrorType = Errors.ExecutionErrorType | BaseErrorType
|
|
1619
1621
|
}
|
|
1620
1622
|
|
|
1621
1623
|
/**
|
|
@@ -1647,7 +1649,7 @@ export async function getRedeemQuote<chain extends Chain | undefined>(
|
|
|
1647
1649
|
parameters: getRedeemQuote.Parameters,
|
|
1648
1650
|
): Promise<getRedeemQuote.ReturnValue> {
|
|
1649
1651
|
const { shareAmount, vault, ...rest } = parameters
|
|
1650
|
-
return readContract(client, {
|
|
1652
|
+
return withExecutionError(readContract)(client, {
|
|
1651
1653
|
...rest,
|
|
1652
1654
|
...getRedeemQuote.call({ shareAmount, vault }),
|
|
1653
1655
|
})
|
|
@@ -1668,7 +1670,7 @@ export namespace getRedeemQuote {
|
|
|
1668
1670
|
never
|
|
1669
1671
|
>
|
|
1670
1672
|
// TODO: exhaustive error type
|
|
1671
|
-
export type ErrorType = BaseErrorType
|
|
1673
|
+
export type ErrorType = Errors.ExecutionErrorType | BaseErrorType
|
|
1672
1674
|
|
|
1673
1675
|
/**
|
|
1674
1676
|
* Defines a call to the vault's `previewRedeem` function.
|
|
@@ -1732,13 +1734,13 @@ export async function getVault<chain extends Chain | undefined>(
|
|
|
1732
1734
|
): Promise<getVault.ReturnValue> {
|
|
1733
1735
|
const { vault, ...rest } = parameters
|
|
1734
1736
|
const [engine, fees] = await Promise.all([
|
|
1735
|
-
readContract(client, {
|
|
1737
|
+
withExecutionError(readContract)(client, {
|
|
1736
1738
|
...rest,
|
|
1737
1739
|
abi: Abis.earnVault,
|
|
1738
1740
|
address: vault,
|
|
1739
1741
|
functionName: 'engine',
|
|
1740
1742
|
}),
|
|
1741
|
-
readContract(client, {
|
|
1743
|
+
withExecutionError(readContract)(client, {
|
|
1742
1744
|
...rest,
|
|
1743
1745
|
abi: Abis.earnVault,
|
|
1744
1746
|
address: vault,
|
|
@@ -1849,7 +1851,10 @@ export namespace getVault {
|
|
|
1849
1851
|
shareToken: Address
|
|
1850
1852
|
}
|
|
1851
1853
|
// TODO: exhaustive error type
|
|
1852
|
-
export type ErrorType =
|
|
1854
|
+
export type ErrorType =
|
|
1855
|
+
| Errors.ExecutionErrorType
|
|
1856
|
+
| GetVaultEngineChangedErrorType
|
|
1857
|
+
| BaseErrorType
|
|
1853
1858
|
|
|
1854
1859
|
/**
|
|
1855
1860
|
* Defines the reads used by {@link getVault}. Pass the current engine and
|
|
@@ -1999,7 +2004,7 @@ export async function getWithdrawQuote<chain extends Chain | undefined>(
|
|
|
1999
2004
|
parameters: getWithdrawQuote.Parameters,
|
|
2000
2005
|
): Promise<getWithdrawQuote.ReturnValue> {
|
|
2001
2006
|
const { assetAmount, vault, ...rest } = parameters
|
|
2002
|
-
return readContract(client, {
|
|
2007
|
+
return withExecutionError(readContract)(client, {
|
|
2003
2008
|
...rest,
|
|
2004
2009
|
...getWithdrawQuote.call({ assetAmount, vault }),
|
|
2005
2010
|
})
|
|
@@ -2020,7 +2025,7 @@ export namespace getWithdrawQuote {
|
|
|
2020
2025
|
never
|
|
2021
2026
|
>
|
|
2022
2027
|
// TODO: exhaustive error type
|
|
2023
|
-
export type ErrorType = BaseErrorType
|
|
2028
|
+
export type ErrorType = Errors.ExecutionErrorType | BaseErrorType
|
|
2024
2029
|
|
|
2025
2030
|
/**
|
|
2026
2031
|
* Defines a call to the vault's `previewWithdraw` function.
|
|
@@ -2122,7 +2127,7 @@ export namespace redeem {
|
|
|
2122
2127
|
> = WriteParameters<chain, account> & Args
|
|
2123
2128
|
export type ReturnValue = SendTransactionReturnType
|
|
2124
2129
|
// TODO: exhaustive error type
|
|
2125
|
-
export type ErrorType = BaseErrorType
|
|
2130
|
+
export type ErrorType = Errors.ExecutionErrorType | BaseErrorType
|
|
2126
2131
|
|
|
2127
2132
|
/** @internal Shared dispatch; reads the Earn share token for the approval. */
|
|
2128
2133
|
export async function inner<
|
|
@@ -2136,13 +2141,13 @@ export namespace redeem {
|
|
|
2136
2141
|
): Promise<ReturnType<action>> {
|
|
2137
2142
|
const [args, shareToken] = await Promise.all([
|
|
2138
2143
|
toRedeemArgs(client, parameters as never),
|
|
2139
|
-
readContract(client, {
|
|
2144
|
+
withExecutionError(readContract)(client, {
|
|
2140
2145
|
abi: Abis.earnVault,
|
|
2141
2146
|
address: parameters.vault,
|
|
2142
2147
|
functionName: 'earnShare',
|
|
2143
2148
|
}),
|
|
2144
2149
|
])
|
|
2145
|
-
return (await action(client, {
|
|
2150
|
+
return (await withExecutionError(action)(client, {
|
|
2146
2151
|
...parameters,
|
|
2147
2152
|
calls: redeem.calls({ ...args, shareToken }),
|
|
2148
2153
|
} as never)) as never
|
|
@@ -2354,7 +2359,7 @@ export namespace redeemSync {
|
|
|
2354
2359
|
shareAmount: bigint
|
|
2355
2360
|
}>
|
|
2356
2361
|
// TODO: exhaustive error type
|
|
2357
|
-
export type ErrorType = BaseErrorType
|
|
2362
|
+
export type ErrorType = Errors.ExecutionErrorType | BaseErrorType
|
|
2358
2363
|
}
|
|
2359
2364
|
|
|
2360
2365
|
/**
|
|
@@ -2780,7 +2785,7 @@ export namespace withdrawExact {
|
|
|
2780
2785
|
> = WriteParameters<chain, account> & Args
|
|
2781
2786
|
export type ReturnValue = SendTransactionReturnType
|
|
2782
2787
|
// TODO: exhaustive error type
|
|
2783
|
-
export type ErrorType = BaseErrorType
|
|
2788
|
+
export type ErrorType = Errors.ExecutionErrorType | BaseErrorType
|
|
2784
2789
|
|
|
2785
2790
|
/** @internal Shared dispatch; reads the Earn share token for the approval. */
|
|
2786
2791
|
export async function inner<
|
|
@@ -2794,13 +2799,13 @@ export namespace withdrawExact {
|
|
|
2794
2799
|
): Promise<ReturnType<action>> {
|
|
2795
2800
|
const [args, shareToken] = await Promise.all([
|
|
2796
2801
|
toWithdrawExactArgs(client, parameters as never),
|
|
2797
|
-
readContract(client, {
|
|
2802
|
+
withExecutionError(readContract)(client, {
|
|
2798
2803
|
abi: Abis.earnVault,
|
|
2799
2804
|
address: parameters.vault,
|
|
2800
2805
|
functionName: 'earnShare',
|
|
2801
2806
|
}),
|
|
2802
2807
|
])
|
|
2803
|
-
return (await action(client, {
|
|
2808
|
+
return (await withExecutionError(action)(client, {
|
|
2804
2809
|
...parameters,
|
|
2805
2810
|
calls: withdrawExact.calls({ ...args, shareToken }),
|
|
2806
2811
|
} as never)) as never
|
|
@@ -3021,7 +3026,7 @@ export namespace withdrawExactSync {
|
|
|
3021
3026
|
shareAmount: bigint
|
|
3022
3027
|
}>
|
|
3023
3028
|
// TODO: exhaustive error type
|
|
3024
|
-
export type ErrorType = BaseErrorType
|
|
3029
|
+
export type ErrorType = Errors.ExecutionErrorType | BaseErrorType
|
|
3025
3030
|
}
|
|
3026
3031
|
|
|
3027
3032
|
type MinimumShareAmountParameters = OneOf<
|
|
@@ -3402,7 +3407,7 @@ async function toBaseUnitsLive(
|
|
|
3402
3407
|
if (typeof amount === 'bigint') return amount
|
|
3403
3408
|
if (amount.decimals !== undefined)
|
|
3404
3409
|
return internal_Token.toBaseUnits(amount, amount.decimals)
|
|
3405
|
-
const address = await readContract(client, {
|
|
3410
|
+
const address = await withExecutionError(readContract)(client, {
|
|
3406
3411
|
abi: Abis.earnVault,
|
|
3407
3412
|
address: vault,
|
|
3408
3413
|
functionName: token === 'asset' ? 'asset' : 'earnShare',
|
package/tempo/actions/fee.ts
CHANGED
|
@@ -19,12 +19,20 @@ import type { Compute, UnionOmit } from '../../types/utils.js'
|
|
|
19
19
|
import { parseEventLogs } from '../../utils/abi/parseEventLogs.js'
|
|
20
20
|
import * as Abis from '../Abis.js'
|
|
21
21
|
import * as Addresses from '../Addresses.js'
|
|
22
|
+
import type * as Errors from '../errors.js'
|
|
22
23
|
import {
|
|
23
24
|
FeeTokenNotTip20Error,
|
|
24
25
|
FeeTokenNotUsdError,
|
|
25
26
|
FeeTokenPausedError,
|
|
26
27
|
InvalidFeeTokenError,
|
|
28
|
+
TempoExecutionError,
|
|
27
29
|
} from '../errors.js'
|
|
30
|
+
import {
|
|
31
|
+
formatAmount,
|
|
32
|
+
getFeeToken,
|
|
33
|
+
type Resolvers,
|
|
34
|
+
withExecutionError,
|
|
35
|
+
} from '../internal/errors.js'
|
|
28
36
|
import type {
|
|
29
37
|
GetAccountParameter,
|
|
30
38
|
ReadParameters,
|
|
@@ -81,7 +89,7 @@ export async function validateToken<chain extends Chain | undefined>(
|
|
|
81
89
|
|
|
82
90
|
const isPathUsd = address.toLowerCase() === Addresses.pathUsd.toLowerCase()
|
|
83
91
|
if (!isPathUsd) {
|
|
84
|
-
const isTip20 = await readContract(client, {
|
|
92
|
+
const isTip20 = await withExecutionError(readContract)(client, {
|
|
85
93
|
...rest,
|
|
86
94
|
address: Addresses.tip20Factory,
|
|
87
95
|
abi: Abis.tip20Factory,
|
|
@@ -136,6 +144,7 @@ export declare namespace validateToken {
|
|
|
136
144
|
}>
|
|
137
145
|
|
|
138
146
|
export type ErrorType =
|
|
147
|
+
| Errors.ExecutionErrorType
|
|
139
148
|
| FeeTokenNotTip20Error
|
|
140
149
|
| FeeTokenNotUsdError
|
|
141
150
|
| FeeTokenPausedError
|
|
@@ -178,7 +187,7 @@ export async function getUserToken<
|
|
|
178
187
|
const { account: account_ = client.account, ...rest } = parameters[0] ?? {}
|
|
179
188
|
if (!account_) throw new Error('account is required.')
|
|
180
189
|
const account = parseAccount(account_)
|
|
181
|
-
const address = await readContract(client, {
|
|
190
|
+
const address = await withExecutionError(readContract)(client, {
|
|
182
191
|
...rest,
|
|
183
192
|
...getUserToken.call({ account: account.address }),
|
|
184
193
|
})
|
|
@@ -219,6 +228,8 @@ export namespace getUserToken {
|
|
|
219
228
|
functionName: 'userTokens',
|
|
220
229
|
})
|
|
221
230
|
}
|
|
231
|
+
|
|
232
|
+
export type ErrorType = Errors.ExecutionErrorType | BaseErrorType
|
|
222
233
|
}
|
|
223
234
|
|
|
224
235
|
/**
|
|
@@ -270,7 +281,7 @@ export namespace setUserToken {
|
|
|
270
281
|
export type ReturnValue = WriteContractReturnType
|
|
271
282
|
|
|
272
283
|
// TODO: exhaustive error type
|
|
273
|
-
export type ErrorType = BaseErrorType
|
|
284
|
+
export type ErrorType = Errors.ExecutionErrorType | BaseErrorType
|
|
274
285
|
|
|
275
286
|
/** @internal */
|
|
276
287
|
export async function inner<
|
|
@@ -284,7 +295,7 @@ export namespace setUserToken {
|
|
|
284
295
|
): Promise<ReturnType<action>> {
|
|
285
296
|
const { token, ...rest } = parameters
|
|
286
297
|
const call = setUserToken.call({ token })
|
|
287
|
-
return (await action(client, {
|
|
298
|
+
return (await withExecutionError(action)(client, {
|
|
288
299
|
...rest,
|
|
289
300
|
...call,
|
|
290
301
|
} as never)) as never
|
|
@@ -411,7 +422,7 @@ export namespace setUserTokenSync {
|
|
|
411
422
|
>
|
|
412
423
|
|
|
413
424
|
// TODO: exhaustive error type
|
|
414
|
-
export type ErrorType = BaseErrorType
|
|
425
|
+
export type ErrorType = Errors.ExecutionErrorType | BaseErrorType
|
|
415
426
|
}
|
|
416
427
|
|
|
417
428
|
/**
|
|
@@ -514,7 +525,7 @@ export async function getValidatorToken<
|
|
|
514
525
|
parameters: getValidatorToken.Parameters,
|
|
515
526
|
): Promise<getValidatorToken.ReturnValue> {
|
|
516
527
|
const { validator, ...rest } = parameters
|
|
517
|
-
const address = await readContract(client, {
|
|
528
|
+
const address = await withExecutionError(readContract)(client, {
|
|
518
529
|
...rest,
|
|
519
530
|
...getValidatorToken.call({ validator }),
|
|
520
531
|
})
|
|
@@ -553,6 +564,8 @@ export namespace getValidatorToken {
|
|
|
553
564
|
functionName: 'validatorTokens',
|
|
554
565
|
})
|
|
555
566
|
}
|
|
567
|
+
|
|
568
|
+
export type ErrorType = Errors.ExecutionErrorType | BaseErrorType
|
|
556
569
|
}
|
|
557
570
|
|
|
558
571
|
/**
|
|
@@ -604,7 +617,7 @@ export namespace setValidatorToken {
|
|
|
604
617
|
export type ReturnValue = WriteContractReturnType
|
|
605
618
|
|
|
606
619
|
// TODO: exhaustive error type
|
|
607
|
-
export type ErrorType = BaseErrorType
|
|
620
|
+
export type ErrorType = Errors.ExecutionErrorType | BaseErrorType
|
|
608
621
|
|
|
609
622
|
/** @internal */
|
|
610
623
|
export async function inner<
|
|
@@ -618,7 +631,7 @@ export namespace setValidatorToken {
|
|
|
618
631
|
): Promise<ReturnType<action>> {
|
|
619
632
|
const { token, ...rest } = parameters
|
|
620
633
|
const call = setValidatorToken.call({ token })
|
|
621
|
-
return (await action(client, {
|
|
634
|
+
return (await withExecutionError(action)(client, {
|
|
622
635
|
...rest,
|
|
623
636
|
...call,
|
|
624
637
|
} as never)) as never
|
|
@@ -745,7 +758,7 @@ export namespace setValidatorTokenSync {
|
|
|
745
758
|
>
|
|
746
759
|
|
|
747
760
|
// TODO: exhaustive error type
|
|
748
|
-
export type ErrorType = BaseErrorType
|
|
761
|
+
export type ErrorType = Errors.ExecutionErrorType | BaseErrorType
|
|
749
762
|
}
|
|
750
763
|
|
|
751
764
|
/**
|
|
@@ -820,3 +833,92 @@ export declare namespace watchSetValidatorToken {
|
|
|
820
833
|
onValidatorTokenSet: (args: Args, log: Log) => void
|
|
821
834
|
}
|
|
822
835
|
}
|
|
836
|
+
|
|
837
|
+
// Errors
|
|
838
|
+
|
|
839
|
+
/** Errors this module throws for decoded Tempo errors. Narrow with `error.name`. */
|
|
840
|
+
export type ExecutionErrorType = FeeInsufficientBalanceErrorType
|
|
841
|
+
|
|
842
|
+
/** `FeeInsufficientBalanceError` with a literal `name`, for narrowing. */
|
|
843
|
+
export type FeeInsufficientBalanceErrorType = FeeInsufficientBalanceError & {
|
|
844
|
+
name: 'FeeInsufficientBalanceError'
|
|
845
|
+
}
|
|
846
|
+
|
|
847
|
+
/** Thrown when an account cannot pay transaction fees in its fee token. */
|
|
848
|
+
export class FeeInsufficientBalanceError extends TempoExecutionError<
|
|
849
|
+
Errors.TempoExecutionError.Decoded<'InsufficientFeeTokenBalance'>
|
|
850
|
+
> {
|
|
851
|
+
/** Fee token balance, when known. */
|
|
852
|
+
balance: bigint | undefined
|
|
853
|
+
/** Token decimals, when known. */
|
|
854
|
+
decimals: number | undefined
|
|
855
|
+
/** Fee token, when known. */
|
|
856
|
+
feeToken: Address | undefined
|
|
857
|
+
|
|
858
|
+
constructor(
|
|
859
|
+
parameters: Errors.TempoExecutionError.Parameters & {
|
|
860
|
+
balance?: bigint | undefined
|
|
861
|
+
decimals?: number | undefined
|
|
862
|
+
feeToken?: Address | undefined
|
|
863
|
+
},
|
|
864
|
+
) {
|
|
865
|
+
const { balance, decimals, feeToken } = parameters
|
|
866
|
+
super(parameters, {
|
|
867
|
+
details: {
|
|
868
|
+
'fee token': feeToken,
|
|
869
|
+
balance: formatAmount(balance, decimals),
|
|
870
|
+
},
|
|
871
|
+
name: 'FeeInsufficientBalanceError',
|
|
872
|
+
shortMessage: `Insufficient balance to pay fees${feeToken ? ` in token "${feeToken}"` : ''}.`,
|
|
873
|
+
})
|
|
874
|
+
this.balance = balance
|
|
875
|
+
this.decimals = decimals
|
|
876
|
+
this.feeToken = feeToken
|
|
877
|
+
}
|
|
878
|
+
}
|
|
879
|
+
|
|
880
|
+
/** @internal */
|
|
881
|
+
export const errorResolvers: Resolvers = {
|
|
882
|
+
'InsufficientFeeTokenBalance()': async (context) => {
|
|
883
|
+
const { feePayer } = context.parameters
|
|
884
|
+
// A local fee payer pays instead of the sender. External fee payers cannot be read.
|
|
885
|
+
const payer =
|
|
886
|
+
typeof feePayer === 'object'
|
|
887
|
+
? parseAccount(feePayer).address
|
|
888
|
+
: feePayer
|
|
889
|
+
? undefined
|
|
890
|
+
: context.signer?.address
|
|
891
|
+
if (!payer) return new FeeInsufficientBalanceError(context.base)
|
|
892
|
+
const [userToken] = getFeeToken(context)
|
|
893
|
+
? []
|
|
894
|
+
: await context.read([
|
|
895
|
+
{
|
|
896
|
+
address: Addresses.feeManager,
|
|
897
|
+
abi: Abis.feeManager,
|
|
898
|
+
functionName: 'userTokens',
|
|
899
|
+
args: [payer],
|
|
900
|
+
},
|
|
901
|
+
])
|
|
902
|
+
const feeToken =
|
|
903
|
+
getFeeToken(context) ??
|
|
904
|
+
(userToken?.result && userToken.result !== zeroAddress
|
|
905
|
+
? userToken.result
|
|
906
|
+
: undefined)
|
|
907
|
+
if (!feeToken) return new FeeInsufficientBalanceError(context.base)
|
|
908
|
+
const [balance, decimals] = await context.read([
|
|
909
|
+
{
|
|
910
|
+
address: feeToken,
|
|
911
|
+
abi: Abis.tip20,
|
|
912
|
+
functionName: 'balanceOf',
|
|
913
|
+
args: [payer],
|
|
914
|
+
},
|
|
915
|
+
{ address: feeToken, abi: Abis.tip20, functionName: 'decimals' },
|
|
916
|
+
])
|
|
917
|
+
return new FeeInsufficientBalanceError({
|
|
918
|
+
...context.base,
|
|
919
|
+
balance: balance?.result,
|
|
920
|
+
decimals: decimals?.result,
|
|
921
|
+
feeToken,
|
|
922
|
+
})
|
|
923
|
+
},
|
|
924
|
+
}
|
package/tempo/actions/index.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
// biome-ignore lint/performance/noBarrelFile: _
|
|
2
2
|
export * as accessKey from './accessKey.js'
|
|
3
|
+
export * as accounts from './accounts.js'
|
|
3
4
|
export * as amm from './amm.js'
|
|
4
5
|
export * as channel from './channel.js'
|
|
5
6
|
export * as dex from './dex.js'
|
|
6
7
|
export * as earn from './earn.js'
|
|
7
8
|
export * as faucet from './faucet.js'
|
|
8
9
|
export * as fee from './fee.js'
|
|
9
|
-
export * as multisig from './multisig.js'
|
|
10
10
|
export * as nonce from './nonce.js'
|
|
11
11
|
export * as policy from './policy.js'
|
|
12
12
|
export * as propAmm from './propAmm.js'
|