viem 2.57.4 → 2.57.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +34 -0
- package/_cjs/actions/public/waitForTransactionReceipt.js +5 -2
- package/_cjs/actions/public/waitForTransactionReceipt.js.map +1 -1
- package/_cjs/actions/wallet/waitForCallsStatus.js +25 -2
- package/_cjs/actions/wallet/waitForCallsStatus.js.map +1 -1
- package/_cjs/chains/definitions/arcTestnet.js +11 -8
- package/_cjs/chains/definitions/arcTestnet.js.map +1 -1
- package/_cjs/chains/definitions/qmsTestnet.js +30 -0
- package/_cjs/chains/definitions/qmsTestnet.js.map +1 -0
- package/_cjs/chains/definitions/tempo.js +1 -1
- package/_cjs/chains/definitions/tempoModerato.js +2 -2
- package/_cjs/chains/index.js +7 -5
- package/_cjs/chains/index.js.map +1 -1
- package/_cjs/clients/transports/ipc.js +19 -10
- package/_cjs/clients/transports/ipc.js.map +1 -1
- package/_cjs/clients/transports/webSocket.js +19 -10
- package/_cjs/clients/transports/webSocket.js.map +1 -1
- package/_cjs/errors/version.js +1 -1
- package/_cjs/tempo/Abis.js +297 -1
- package/_cjs/tempo/Abis.js.map +1 -1
- package/_cjs/tempo/Account.js +40 -40
- package/_cjs/tempo/Account.js.map +1 -1
- package/_cjs/tempo/Addresses.js +2 -1
- package/_cjs/tempo/Addresses.js.map +1 -1
- package/_cjs/tempo/Decorator.js +9 -8
- package/_cjs/tempo/Decorator.js.map +1 -1
- package/_cjs/tempo/ExecutionError.js +95 -4
- package/_cjs/tempo/ExecutionError.js.map +1 -1
- package/_cjs/tempo/Formatters.js +8 -7
- package/_cjs/tempo/Formatters.js.map +1 -1
- package/_cjs/tempo/KeyAuthorizationManager.js +25 -16
- package/_cjs/tempo/KeyAuthorizationManager.js.map +1 -1
- package/_cjs/tempo/Relay.js +9 -4
- package/_cjs/tempo/Relay.js.map +1 -1
- package/_cjs/tempo/Transaction.js +9 -9
- package/_cjs/tempo/Transaction.js.map +1 -1
- package/_cjs/tempo/Transport.js +21 -11
- package/_cjs/tempo/Transport.js.map +1 -1
- package/_cjs/tempo/{multisig → accounts}/Config.js +8 -8
- package/_cjs/tempo/{multisig → accounts}/Config.js.map +1 -1
- package/_cjs/tempo/{multisig → accounts}/Operation.js +10 -10
- package/_cjs/tempo/{multisig → accounts}/Operation.js.map +1 -1
- package/_cjs/tempo/{multisig → accounts}/Signature.js +2 -2
- package/_cjs/tempo/accounts/Signature.js.map +1 -0
- package/_cjs/tempo/actions/accessKey.js +442 -47
- package/_cjs/tempo/actions/accessKey.js.map +1 -1
- package/_cjs/tempo/actions/{multisig.js → accounts.js} +16 -20
- package/_cjs/tempo/actions/accounts.js.map +1 -0
- package/_cjs/tempo/actions/amm.js +90 -4
- package/_cjs/tempo/actions/amm.js.map +1 -1
- package/_cjs/tempo/actions/channel.js +183 -7
- package/_cjs/tempo/actions/channel.js.map +1 -1
- package/_cjs/tempo/actions/dex.js +507 -14
- package/_cjs/tempo/actions/dex.js.map +1 -1
- package/_cjs/tempo/actions/earn/deployment.js +4 -3
- package/_cjs/tempo/actions/earn/deployment.js.map +1 -1
- package/_cjs/tempo/actions/earn.js +22 -21
- package/_cjs/tempo/actions/earn.js.map +1 -1
- package/_cjs/tempo/actions/fee.js +85 -5
- package/_cjs/tempo/actions/fee.js.map +1 -1
- package/_cjs/tempo/actions/index.js +2 -2
- package/_cjs/tempo/actions/index.js.map +1 -1
- package/_cjs/tempo/actions/nonce.js +54 -1
- package/_cjs/tempo/actions/nonce.js.map +1 -1
- package/_cjs/tempo/actions/policy.js +35 -6
- package/_cjs/tempo/actions/policy.js.map +1 -1
- package/_cjs/tempo/actions/propAmm.js +18 -8
- package/_cjs/tempo/actions/propAmm.js.map +1 -1
- package/_cjs/tempo/actions/receivePolicy.js +7 -6
- package/_cjs/tempo/actions/receivePolicy.js.map +1 -1
- package/_cjs/tempo/actions/reward.js +7 -6
- package/_cjs/tempo/actions/reward.js.map +1 -1
- package/_cjs/tempo/actions/token.js +433 -22
- package/_cjs/tempo/actions/token.js.map +1 -1
- package/_cjs/tempo/actions/validator.js +12 -11
- package/_cjs/tempo/actions/validator.js.map +1 -1
- package/_cjs/tempo/actions/virtualAddress.js +3 -2
- package/_cjs/tempo/actions/virtualAddress.js.map +1 -1
- package/_cjs/tempo/actions/zone.js +12 -11
- package/_cjs/tempo/actions/zone.js.map +1 -1
- package/_cjs/tempo/chainConfig.js +37 -37
- package/_cjs/tempo/chainConfig.js.map +1 -1
- package/_cjs/tempo/errors.js +57 -1
- package/_cjs/tempo/errors.js.map +1 -1
- package/_cjs/tempo/index.js +3 -3
- package/_cjs/tempo/index.js.map +1 -1
- package/_cjs/tempo/internal/errors.js +46 -0
- package/_cjs/tempo/internal/errors.js.map +1 -0
- package/_cjs/tempo/internal/relay/{multisig.js → accounts.js} +90 -93
- package/_cjs/tempo/internal/relay/accounts.js.map +1 -0
- package/_cjs/tempo/internal/relay/keyAuthorization.js +296 -0
- package/_cjs/tempo/internal/relay/keyAuthorization.js.map +1 -0
- package/_cjs/tempo/internal/relay/plugin.js +17 -7
- package/_cjs/tempo/internal/relay/plugin.js.map +1 -1
- package/_cjs/tempo/internal/resolveError.js +128 -0
- package/_cjs/tempo/internal/resolveError.js.map +1 -0
- package/_cjs/tempo/internal/utils.js +1 -0
- package/_cjs/tempo/internal/utils.js.map +1 -1
- package/_cjs/utils/hash/normalizeSignature.js +1 -1
- package/_cjs/utils/hash/normalizeSignature.js.map +1 -1
- package/_cjs/utils/rpc/http.js +66 -31
- package/_cjs/utils/rpc/http.js.map +1 -1
- package/_cjs/utils/rpc/socket.js +1 -1
- package/_cjs/utils/rpc/socket.js.map +1 -1
- package/_esm/actions/public/waitForTransactionReceipt.js +5 -2
- package/_esm/actions/public/waitForTransactionReceipt.js.map +1 -1
- package/_esm/actions/wallet/waitForCallsStatus.js +39 -2
- package/_esm/actions/wallet/waitForCallsStatus.js.map +1 -1
- package/_esm/chains/definitions/arcTestnet.js +11 -8
- package/_esm/chains/definitions/arcTestnet.js.map +1 -1
- package/_esm/chains/definitions/qmsTestnet.js +27 -0
- package/_esm/chains/definitions/qmsTestnet.js.map +1 -0
- package/_esm/chains/definitions/tempo.js +1 -1
- package/_esm/chains/definitions/tempoModerato.js +2 -2
- package/_esm/chains/index.js +1 -0
- package/_esm/chains/index.js.map +1 -1
- package/_esm/clients/transports/ipc.js +21 -10
- package/_esm/clients/transports/ipc.js.map +1 -1
- package/_esm/clients/transports/webSocket.js +21 -10
- package/_esm/clients/transports/webSocket.js.map +1 -1
- package/_esm/errors/version.js +1 -1
- package/_esm/tempo/Abis.js +297 -0
- package/_esm/tempo/Abis.js.map +1 -1
- package/_esm/tempo/Account.js +42 -42
- package/_esm/tempo/Account.js.map +1 -1
- package/_esm/tempo/Addresses.js +1 -0
- package/_esm/tempo/Addresses.js.map +1 -1
- package/_esm/tempo/Client.js +3 -3
- package/_esm/tempo/Decorator.js +9 -8
- package/_esm/tempo/Decorator.js.map +1 -1
- package/_esm/tempo/ExecutionError.js +96 -3
- package/_esm/tempo/ExecutionError.js.map +1 -1
- package/_esm/tempo/Formatters.js +11 -10
- package/_esm/tempo/Formatters.js.map +1 -1
- package/_esm/tempo/KeyAuthorizationManager.js +58 -16
- package/_esm/tempo/KeyAuthorizationManager.js.map +1 -1
- package/_esm/tempo/Relay.js +49 -8
- package/_esm/tempo/Relay.js.map +1 -1
- package/_esm/tempo/Transaction.js +11 -11
- package/_esm/tempo/Transaction.js.map +1 -1
- package/_esm/tempo/Transport.js +22 -12
- package/_esm/tempo/Transport.js.map +1 -1
- package/_esm/tempo/{multisig → accounts}/Config.js +14 -14
- package/_esm/tempo/{multisig → accounts}/Config.js.map +1 -1
- package/_esm/tempo/{multisig → accounts}/Operation.js +17 -17
- package/_esm/tempo/{multisig → accounts}/Operation.js.map +1 -1
- package/_esm/tempo/accounts/Signature.js +9 -0
- package/_esm/tempo/accounts/Signature.js.map +1 -0
- package/_esm/tempo/actions/accessKey.js +499 -48
- package/_esm/tempo/actions/accessKey.js.map +1 -1
- package/_esm/tempo/actions/{multisig.js → accounts.js} +34 -38
- package/_esm/tempo/actions/accounts.js.map +1 -0
- package/_esm/tempo/actions/amm.js +95 -4
- package/_esm/tempo/actions/amm.js.map +1 -1
- package/_esm/tempo/actions/channel.js +191 -7
- package/_esm/tempo/actions/channel.js.map +1 -1
- package/_esm/tempo/actions/dex.js +537 -14
- package/_esm/tempo/actions/dex.js.map +1 -1
- package/_esm/tempo/actions/earn/deployment.js +4 -3
- package/_esm/tempo/actions/earn/deployment.js.map +1 -1
- package/_esm/tempo/actions/earn.js +22 -21
- package/_esm/tempo/actions/earn.js.map +1 -1
- package/_esm/tempo/actions/fee.js +90 -6
- package/_esm/tempo/actions/fee.js.map +1 -1
- package/_esm/tempo/actions/index.js +1 -1
- package/_esm/tempo/actions/index.js.map +1 -1
- package/_esm/tempo/actions/nonce.js +57 -1
- package/_esm/tempo/actions/nonce.js.map +1 -1
- package/_esm/tempo/actions/policy.js +36 -6
- package/_esm/tempo/actions/policy.js.map +1 -1
- package/_esm/tempo/actions/propAmm.js +18 -8
- package/_esm/tempo/actions/propAmm.js.map +1 -1
- package/_esm/tempo/actions/receivePolicy.js +7 -6
- package/_esm/tempo/actions/receivePolicy.js.map +1 -1
- package/_esm/tempo/actions/reward.js +7 -6
- package/_esm/tempo/actions/reward.js.map +1 -1
- package/_esm/tempo/actions/token.js +461 -22
- package/_esm/tempo/actions/token.js.map +1 -1
- package/_esm/tempo/actions/validator.js +12 -11
- package/_esm/tempo/actions/validator.js.map +1 -1
- package/_esm/tempo/actions/virtualAddress.js +3 -2
- package/_esm/tempo/actions/virtualAddress.js.map +1 -1
- package/_esm/tempo/actions/zone.js +12 -11
- package/_esm/tempo/actions/zone.js.map +1 -1
- package/_esm/tempo/chainConfig.js +38 -38
- package/_esm/tempo/chainConfig.js.map +1 -1
- package/_esm/tempo/errors.js +63 -0
- package/_esm/tempo/errors.js.map +1 -1
- package/_esm/tempo/index.js +2 -1
- package/_esm/tempo/index.js.map +1 -1
- package/_esm/tempo/internal/errors.js +51 -0
- package/_esm/tempo/internal/errors.js.map +1 -0
- package/_esm/tempo/internal/relay/{multisig.js → accounts.js} +93 -98
- package/_esm/tempo/internal/relay/accounts.js.map +1 -0
- package/_esm/tempo/internal/relay/feePayer.js +1 -1
- package/_esm/tempo/internal/relay/feePayer.js.map +1 -1
- package/_esm/tempo/internal/relay/keyAuthorization.js +334 -0
- package/_esm/tempo/internal/relay/keyAuthorization.js.map +1 -0
- package/_esm/tempo/internal/relay/plugin.js +15 -6
- package/_esm/tempo/internal/relay/plugin.js.map +1 -1
- package/_esm/tempo/internal/resolveError.js +130 -0
- package/_esm/tempo/internal/resolveError.js.map +1 -0
- package/_esm/tempo/internal/utils.js +2 -0
- package/_esm/tempo/internal/utils.js.map +1 -1
- package/_esm/utils/hash/normalizeSignature.js +3 -2
- package/_esm/utils/hash/normalizeSignature.js.map +1 -1
- package/_esm/utils/rpc/http.js +74 -31
- package/_esm/utils/rpc/http.js.map +1 -1
- package/_esm/utils/rpc/socket.js +3 -1
- package/_esm/utils/rpc/socket.js.map +1 -1
- package/_types/actions/public/waitForTransactionReceipt.d.ts.map +1 -1
- package/_types/actions/wallet/waitForCallsStatus.d.ts.map +1 -1
- package/_types/chains/definitions/arcTestnet.d.ts +5 -5
- package/_types/chains/definitions/arcTestnet.d.ts.map +1 -1
- package/_types/chains/definitions/qmsTestnet.d.ts +50 -0
- package/_types/chains/definitions/qmsTestnet.d.ts.map +1 -0
- package/_types/chains/definitions/tempo.d.ts +2 -2
- package/_types/chains/definitions/tempoModerato.d.ts +4 -4
- package/_types/chains/index.d.ts +1 -0
- package/_types/chains/index.d.ts.map +1 -1
- package/_types/clients/transports/ipc.d.ts.map +1 -1
- package/_types/clients/transports/webSocket.d.ts.map +1 -1
- package/_types/errors/version.d.ts +1 -1
- package/_types/tempo/Abis.d.ts +807 -0
- package/_types/tempo/Abis.d.ts.map +1 -1
- package/_types/tempo/Account.d.ts +28 -28
- package/_types/tempo/Account.d.ts.map +1 -1
- package/_types/tempo/Addresses.d.ts +1 -0
- package/_types/tempo/Addresses.d.ts.map +1 -1
- package/_types/tempo/Client.d.ts +3 -3
- package/_types/tempo/Decorator.d.ts +64 -38
- package/_types/tempo/Decorator.d.ts.map +1 -1
- package/_types/tempo/ExecutionError.d.ts +3 -1
- package/_types/tempo/ExecutionError.d.ts.map +1 -1
- package/_types/tempo/Formatters.d.ts.map +1 -1
- package/_types/tempo/KeyAuthorizationManager.d.ts +45 -2
- package/_types/tempo/KeyAuthorizationManager.d.ts.map +1 -1
- package/_types/tempo/Relay.d.ts +62 -12
- package/_types/tempo/Relay.d.ts.map +1 -1
- package/_types/tempo/Transaction.d.ts +14 -11
- package/_types/tempo/Transaction.d.ts.map +1 -1
- package/_types/tempo/Transport.d.ts +20 -7
- package/_types/tempo/Transport.d.ts.map +1 -1
- package/_types/tempo/{multisig → accounts}/Config.d.ts +7 -7
- package/_types/tempo/accounts/Config.d.ts.map +1 -0
- package/_types/tempo/{multisig → accounts}/Operation.d.ts +7 -7
- package/_types/tempo/accounts/Operation.d.ts.map +1 -0
- package/_types/tempo/{multisig → accounts}/Signature.d.ts +1 -1
- package/_types/tempo/accounts/Signature.d.ts.map +1 -0
- package/_types/tempo/actions/accessKey.d.ts +214 -25
- package/_types/tempo/actions/accessKey.d.ts.map +1 -1
- package/_types/tempo/actions/{multisig.d.ts → accounts.d.ts} +31 -29
- package/_types/tempo/actions/accounts.d.ts.map +1 -0
- package/_types/tempo/actions/amm.d.ts +39 -0
- package/_types/tempo/actions/amm.d.ts.map +1 -1
- package/_types/tempo/actions/channel.d.ts +77 -7
- package/_types/tempo/actions/channel.d.ts.map +1 -1
- package/_types/tempo/actions/dex.d.ts +222 -16
- package/_types/tempo/actions/dex.d.ts.map +1 -1
- package/_types/tempo/actions/earn/deployment.d.ts +7 -6
- package/_types/tempo/actions/earn/deployment.d.ts.map +1 -1
- package/_types/tempo/actions/earn.d.ts +15 -14
- package/_types/tempo/actions/earn.d.ts.map +1 -1
- package/_types/tempo/actions/fee.d.ts +32 -6
- package/_types/tempo/actions/fee.d.ts.map +1 -1
- package/_types/tempo/actions/index.d.ts +1 -1
- package/_types/tempo/actions/index.d.ts.map +1 -1
- package/_types/tempo/actions/nonce.d.ts +35 -0
- package/_types/tempo/actions/nonce.d.ts.map +1 -1
- package/_types/tempo/actions/policy.d.ts +29 -8
- package/_types/tempo/actions/policy.d.ts.map +1 -1
- package/_types/tempo/actions/propAmm.d.ts +9 -1
- package/_types/tempo/actions/propAmm.d.ts.map +1 -1
- package/_types/tempo/actions/receivePolicy.d.ts +10 -6
- package/_types/tempo/actions/receivePolicy.d.ts.map +1 -1
- package/_types/tempo/actions/reward.d.ts +7 -3
- package/_types/tempo/actions/reward.d.ts.map +1 -1
- package/_types/tempo/actions/token.d.ts +200 -32
- package/_types/tempo/actions/token.d.ts.map +1 -1
- package/_types/tempo/actions/validator.d.ts +17 -5
- package/_types/tempo/actions/validator.d.ts.map +1 -1
- package/_types/tempo/actions/virtualAddress.d.ts +4 -3
- package/_types/tempo/actions/virtualAddress.d.ts.map +1 -1
- package/_types/tempo/actions/zone.d.ts +10 -9
- package/_types/tempo/actions/zone.d.ts.map +1 -1
- package/_types/tempo/errors.d.ts +63 -1
- package/_types/tempo/errors.d.ts.map +1 -1
- package/_types/tempo/index.d.ts +3 -2
- package/_types/tempo/index.d.ts.map +1 -1
- package/_types/tempo/internal/errors.d.ts +59 -0
- package/_types/tempo/internal/errors.d.ts.map +1 -0
- package/_types/tempo/internal/relay/accounts.d.ts +15 -0
- package/_types/tempo/internal/relay/accounts.d.ts.map +1 -0
- package/_types/tempo/internal/relay/keyAuthorization.d.ts +25 -0
- package/_types/tempo/internal/relay/keyAuthorization.d.ts.map +1 -0
- package/_types/tempo/internal/relay/plugin.d.ts +6 -3
- package/_types/tempo/internal/relay/plugin.d.ts.map +1 -1
- package/_types/tempo/internal/resolveError.d.ts +8 -0
- package/_types/tempo/internal/resolveError.d.ts.map +1 -0
- package/_types/tempo/internal/utils.d.ts.map +1 -1
- package/_types/utils/hash/normalizeSignature.d.ts.map +1 -1
- package/_types/utils/rpc/http.d.ts.map +1 -1
- package/_types/utils/rpc/socket.d.ts.map +1 -1
- package/actions/public/waitForTransactionReceipt.ts +8 -2
- package/actions/wallet/waitForCallsStatus.ts +41 -2
- package/chains/definitions/arcTestnet.ts +11 -8
- package/chains/definitions/qmsTestnet.ts +27 -0
- package/chains/definitions/tempo.ts +1 -1
- package/chains/definitions/tempoModerato.ts +2 -2
- package/chains/index.ts +1 -0
- package/clients/transports/ipc.ts +38 -29
- package/clients/transports/webSocket.ts +42 -33
- package/errors/version.ts +1 -1
- package/package.json +2 -2
- package/tempo/Abis.ts +298 -0
- package/tempo/Account.ts +95 -84
- package/tempo/Addresses.ts +1 -0
- package/tempo/Client.ts +3 -3
- package/tempo/Decorator.ts +91 -60
- package/tempo/ExecutionError.ts +102 -4
- package/tempo/Formatters.ts +14 -13
- package/tempo/KeyAuthorizationManager.ts +71 -19
- package/tempo/Relay.ts +70 -14
- package/tempo/Transaction.ts +31 -23
- package/tempo/Transport.ts +49 -21
- package/tempo/{multisig → accounts}/Config.ts +21 -21
- package/tempo/{multisig → accounts}/Operation.ts +26 -26
- package/tempo/{multisig → accounts}/Signature.ts +5 -3
- package/tempo/actions/accessKey.ts +675 -104
- package/tempo/actions/{multisig.ts → accounts.ts} +54 -59
- package/tempo/actions/amm.ts +126 -4
- package/tempo/actions/channel.ts +248 -14
- package/tempo/actions/dex.ts +599 -33
- package/tempo/actions/earn/deployment.ts +11 -9
- package/tempo/actions/earn.ts +40 -35
- package/tempo/actions/fee.ts +111 -9
- package/tempo/actions/index.ts +1 -1
- package/tempo/actions/nonce.ts +86 -1
- package/tempo/actions/policy.ts +66 -14
- package/tempo/actions/propAmm.ts +36 -9
- package/tempo/actions/receivePolicy.ts +26 -15
- package/tempo/actions/reward.ts +17 -9
- package/tempo/actions/token.ts +519 -54
- package/tempo/actions/validator.ts +40 -16
- package/tempo/actions/virtualAddress.ts +7 -5
- package/tempo/actions/zone.ts +25 -20
- package/tempo/chainConfig.ts +52 -52
- package/tempo/errors.ts +114 -1
- package/tempo/index.ts +5 -4
- package/tempo/internal/errors.ts +110 -0
- package/tempo/internal/relay/{multisig.ts → accounts.ts} +118 -118
- package/tempo/internal/relay/feePayer.ts +1 -1
- package/tempo/internal/relay/keyAuthorization.ts +415 -0
- package/tempo/internal/relay/plugin.ts +20 -7
- package/tempo/internal/resolveError.ts +169 -0
- package/tempo/internal/utils.ts +2 -0
- package/utils/hash/normalizeSignature.ts +3 -2
- package/utils/rpc/http.ts +76 -30
- package/utils/rpc/socket.ts +3 -1
- package/_cjs/tempo/actions/multisig.js.map +0 -1
- package/_cjs/tempo/internal/relay/multisig.js.map +0 -1
- package/_cjs/tempo/multisig/Signature.js.map +0 -1
- package/_esm/tempo/actions/multisig.js.map +0 -1
- package/_esm/tempo/internal/relay/multisig.js.map +0 -1
- package/_esm/tempo/multisig/Signature.js +0 -9
- package/_esm/tempo/multisig/Signature.js.map +0 -1
- package/_types/tempo/actions/multisig.d.ts.map +0 -1
- package/_types/tempo/internal/relay/multisig.d.ts +0 -4
- package/_types/tempo/internal/relay/multisig.d.ts.map +0 -1
- package/_types/tempo/multisig/Config.d.ts.map +0 -1
- package/_types/tempo/multisig/Operation.d.ts.map +0 -1
- package/_types/tempo/multisig/Signature.d.ts.map +0 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.errorResolvers = exports.TokenUnauthorizedError = exports.TokenPausedError = exports.TokenPolicyForbidsError = exports.TokenSupplyCapExceededError = exports.TokenInsufficientAllowanceError = exports.TokenInsufficientBalanceError = void 0;
|
|
3
4
|
exports.approve = approve;
|
|
4
5
|
exports.approveSync = approveSync;
|
|
5
6
|
exports.burnBlocked = burnBlocked;
|
|
@@ -59,19 +60,22 @@ const sendTransaction_js_1 = require("../../actions/wallet/sendTransaction.js");
|
|
|
59
60
|
const sendTransactionSync_js_1 = require("../../actions/wallet/sendTransactionSync.js");
|
|
60
61
|
const writeContract_js_1 = require("../../actions/wallet/writeContract.js");
|
|
61
62
|
const writeContractSync_js_1 = require("../../actions/wallet/writeContractSync.js");
|
|
63
|
+
const address_js_1 = require("../../constants/address.js");
|
|
62
64
|
const account_js_1 = require("../../errors/account.js");
|
|
63
65
|
const encodeFunctionData_js_1 = require("../../utils/abi/encodeFunctionData.js");
|
|
64
66
|
const parseEventLogs_js_1 = require("../../utils/abi/parseEventLogs.js");
|
|
65
67
|
const formatUnits_js_1 = require("../../utils/unit/formatUnits.js");
|
|
66
68
|
const Abis = require("../Abis.js");
|
|
67
69
|
const Addresses = require("../Addresses.js");
|
|
70
|
+
const errors_js_1 = require("../errors.js");
|
|
71
|
+
const errors_js_2 = require("../internal/errors.js");
|
|
68
72
|
const utils_js_1 = require("../internal/utils.js");
|
|
69
73
|
async function approve(client, parameters) {
|
|
70
74
|
return approve.inner(writeContract_js_1.writeContract, client, parameters);
|
|
71
75
|
}
|
|
72
76
|
(function (approve) {
|
|
73
77
|
async function inner(action, client, parameters) {
|
|
74
|
-
return (await action(client, {
|
|
78
|
+
return (await (0, errors_js_2.withExecutionError)(action)(client, {
|
|
75
79
|
...parameters,
|
|
76
80
|
...approve.call(client, parameters),
|
|
77
81
|
}));
|
|
@@ -141,7 +145,7 @@ async function burnBlocked(client, parameters) {
|
|
|
141
145
|
async function inner(action, client, parameters) {
|
|
142
146
|
const { amount, from, token, ...rest } = parameters;
|
|
143
147
|
const call = burnBlocked.call(client, { amount, from, token });
|
|
144
|
-
return (await action(client, {
|
|
148
|
+
return (await (0, errors_js_2.withExecutionError)(action)(client, {
|
|
145
149
|
...rest,
|
|
146
150
|
...call,
|
|
147
151
|
}));
|
|
@@ -192,7 +196,7 @@ async function burn(client, parameters) {
|
|
|
192
196
|
async function inner(action, client, parameters) {
|
|
193
197
|
const { amount, from, memo, token, ...rest } = parameters;
|
|
194
198
|
const call = burn.call(client, { amount, from, memo, token });
|
|
195
|
-
return (await action(client, {
|
|
199
|
+
return (await (0, errors_js_2.withExecutionError)(action)(client, {
|
|
196
200
|
...rest,
|
|
197
201
|
...call,
|
|
198
202
|
}));
|
|
@@ -259,7 +263,7 @@ async function changeTransferPolicy(client, parameters) {
|
|
|
259
263
|
async function inner(action, client, parameters) {
|
|
260
264
|
const { policyId, token, ...rest } = parameters;
|
|
261
265
|
const call = changeTransferPolicy.call(client, { policyId, token });
|
|
262
|
-
return (await action(client, {
|
|
266
|
+
return (await (0, errors_js_2.withExecutionError)(action)(client, {
|
|
263
267
|
...rest,
|
|
264
268
|
...call,
|
|
265
269
|
}));
|
|
@@ -312,7 +316,7 @@ async function create(client, parameters) {
|
|
|
312
316
|
if (!admin)
|
|
313
317
|
throw new Error('admin is required.');
|
|
314
318
|
const call = create.call(client, { ...rest, admin: admin.address });
|
|
315
|
-
return (await action(client, {
|
|
319
|
+
return (await (0, errors_js_2.withExecutionError)(action)(client, {
|
|
316
320
|
...parameters,
|
|
317
321
|
account,
|
|
318
322
|
chain,
|
|
@@ -380,7 +384,7 @@ async function createSync(client, parameters) {
|
|
|
380
384
|
async function getAllowance(client, parameters) {
|
|
381
385
|
const { account, decimals, spender, token, ...rest } = parameters;
|
|
382
386
|
const [amount, { decimals: resolved }] = await Promise.all([
|
|
383
|
-
(0, readContract_js_1.readContract)(client, {
|
|
387
|
+
(0, errors_js_2.withExecutionError)(readContract_js_1.readContract)(client, {
|
|
384
388
|
...rest,
|
|
385
389
|
...getAllowance.call(client, { account, spender, token }),
|
|
386
390
|
}),
|
|
@@ -409,7 +413,7 @@ async function getBalance(client, parameters) {
|
|
|
409
413
|
throw new account_js_1.AccountNotFoundError();
|
|
410
414
|
const account = (0, parseAccount_js_1.parseAccount)(account_).address;
|
|
411
415
|
const [amount, { decimals: resolved }] = await Promise.all([
|
|
412
|
-
(0, readContract_js_1.readContract)(client, {
|
|
416
|
+
(0, errors_js_2.withExecutionError)(readContract_js_1.readContract)(client, {
|
|
413
417
|
...rest,
|
|
414
418
|
...getBalance.call(client, { account, token }),
|
|
415
419
|
}),
|
|
@@ -566,7 +570,7 @@ async function readMetadataContracts(client, parameters) {
|
|
|
566
570
|
deployless: true,
|
|
567
571
|
});
|
|
568
572
|
const { contracts, ...rest } = parameters;
|
|
569
|
-
const results = await Promise.allSettled(contracts.map((contract) => (0, readContract_js_1.readContract)(client, {
|
|
573
|
+
const results = await Promise.allSettled(contracts.map((contract) => (0, errors_js_2.withExecutionError)(readContract_js_1.readContract)(client, {
|
|
570
574
|
...rest,
|
|
571
575
|
...contract,
|
|
572
576
|
})));
|
|
@@ -585,7 +589,7 @@ function unwrapMulticallResult(response, ...fallback) {
|
|
|
585
589
|
async function getTotalSupply(client, parameters) {
|
|
586
590
|
const { decimals, token, ...rest } = parameters;
|
|
587
591
|
const [amount, { decimals: resolved }] = await Promise.all([
|
|
588
|
-
(0, readContract_js_1.readContract)(client, {
|
|
592
|
+
(0, errors_js_2.withExecutionError)(readContract_js_1.readContract)(client, {
|
|
589
593
|
...rest,
|
|
590
594
|
...getTotalSupply.call(client, { token }),
|
|
591
595
|
}),
|
|
@@ -609,7 +613,7 @@ async function getTotalSupply(client, parameters) {
|
|
|
609
613
|
getTotalSupply.call = call;
|
|
610
614
|
})(getTotalSupply || (exports.getTotalSupply = getTotalSupply = {}));
|
|
611
615
|
async function getRoleAdmin(client, parameters) {
|
|
612
|
-
return (0, readContract_js_1.readContract)(client, {
|
|
616
|
+
return (0, errors_js_2.withExecutionError)(readContract_js_1.readContract)(client, {
|
|
613
617
|
...parameters,
|
|
614
618
|
...getRoleAdmin.call(client, parameters),
|
|
615
619
|
});
|
|
@@ -632,7 +636,7 @@ async function hasRole(client, parameters) {
|
|
|
632
636
|
const address = account ? (0, parseAccount_js_1.parseAccount)(account).address : undefined;
|
|
633
637
|
if (!address)
|
|
634
638
|
throw new Error('account is required.');
|
|
635
|
-
return (0, readContract_js_1.readContract)(client, {
|
|
639
|
+
return (0, errors_js_2.withExecutionError)(readContract_js_1.readContract)(client, {
|
|
636
640
|
...parameters,
|
|
637
641
|
...hasRole.call(client, { ...parameters, account: address }),
|
|
638
642
|
});
|
|
@@ -655,7 +659,7 @@ async function grantRoles(client, parameters) {
|
|
|
655
659
|
}
|
|
656
660
|
(function (grantRoles) {
|
|
657
661
|
async function inner(action, client, parameters) {
|
|
658
|
-
return (await action(client, {
|
|
662
|
+
return (await (0, errors_js_2.withExecutionError)(action)(client, {
|
|
659
663
|
...parameters,
|
|
660
664
|
calls: parameters.roles.map((role) => {
|
|
661
665
|
const call = grantRoles.call(client, { ...parameters, role });
|
|
@@ -713,7 +717,13 @@ async function mint(client, parameters) {
|
|
|
713
717
|
async function inner(action, client, parameters) {
|
|
714
718
|
const { amount, memo, to, token, ...rest } = parameters;
|
|
715
719
|
const call = mint.call(client, { amount, memo, to, token });
|
|
716
|
-
return (await
|
|
720
|
+
return (await (0, errors_js_2.withExecutionError)(action, {
|
|
721
|
+
hints: {
|
|
722
|
+
Unauthorized: [
|
|
723
|
+
'Minting requires the issuer role. Grant it to this account first.',
|
|
724
|
+
],
|
|
725
|
+
},
|
|
726
|
+
})(client, {
|
|
717
727
|
...rest,
|
|
718
728
|
...call,
|
|
719
729
|
}));
|
|
@@ -773,7 +783,7 @@ async function pause(client, parameters) {
|
|
|
773
783
|
async function inner(action, client, parameters) {
|
|
774
784
|
const { token, ...rest } = parameters;
|
|
775
785
|
const call = pause.call(client, { token });
|
|
776
|
-
return (await action(client, {
|
|
786
|
+
return (await (0, errors_js_2.withExecutionError)(action)(client, {
|
|
777
787
|
...rest,
|
|
778
788
|
...call,
|
|
779
789
|
}));
|
|
@@ -821,7 +831,7 @@ async function renounceRoles(client, parameters) {
|
|
|
821
831
|
}
|
|
822
832
|
(function (renounceRoles) {
|
|
823
833
|
async function inner(action, client, parameters) {
|
|
824
|
-
return (await action(client, {
|
|
834
|
+
return (await (0, errors_js_2.withExecutionError)(action)(client, {
|
|
825
835
|
...parameters,
|
|
826
836
|
calls: parameters.roles.map((role) => {
|
|
827
837
|
const call = renounceRoles.call(client, { ...parameters, role });
|
|
@@ -878,7 +888,7 @@ async function revokeRoles(client, parameters) {
|
|
|
878
888
|
(function (revokeRoles) {
|
|
879
889
|
async function inner(action, client, parameters) {
|
|
880
890
|
const { from: _, ...rest } = parameters;
|
|
881
|
-
return (await action(client, {
|
|
891
|
+
return (await (0, errors_js_2.withExecutionError)(action)(client, {
|
|
882
892
|
...rest,
|
|
883
893
|
calls: parameters.roles.map((role) => {
|
|
884
894
|
const call = revokeRoles.call(client, { ...parameters, role });
|
|
@@ -936,7 +946,7 @@ async function setSupplyCap(client, parameters) {
|
|
|
936
946
|
async function inner(action, client, parameters) {
|
|
937
947
|
const { supplyCap, token, ...rest } = parameters;
|
|
938
948
|
const call = setSupplyCap.call(client, { supplyCap, token });
|
|
939
|
-
return (await action(client, {
|
|
949
|
+
return (await (0, errors_js_2.withExecutionError)(action)(client, {
|
|
940
950
|
...rest,
|
|
941
951
|
...call,
|
|
942
952
|
}));
|
|
@@ -986,7 +996,7 @@ async function setRoleAdmin(client, parameters) {
|
|
|
986
996
|
async function inner(action, client, parameters) {
|
|
987
997
|
const { adminRole, role, token, ...rest } = parameters;
|
|
988
998
|
const call = setRoleAdmin.call(client, { adminRole, role, token });
|
|
989
|
-
return (await action(client, {
|
|
999
|
+
return (await (0, errors_js_2.withExecutionError)(action)(client, {
|
|
990
1000
|
...rest,
|
|
991
1001
|
...call,
|
|
992
1002
|
}));
|
|
@@ -1036,7 +1046,7 @@ async function transfer(client, parameters) {
|
|
|
1036
1046
|
}
|
|
1037
1047
|
(function (transfer) {
|
|
1038
1048
|
async function inner(action, client, parameters) {
|
|
1039
|
-
return (await action(client, {
|
|
1049
|
+
return (await (0, errors_js_2.withExecutionError)(action)(client, {
|
|
1040
1050
|
...parameters,
|
|
1041
1051
|
...transfer.call(client, parameters),
|
|
1042
1052
|
}));
|
|
@@ -1127,7 +1137,7 @@ async function unpause(client, parameters) {
|
|
|
1127
1137
|
async function inner(action, client, parameters) {
|
|
1128
1138
|
const { token, ...rest } = parameters;
|
|
1129
1139
|
const call = unpause.call(client, { token });
|
|
1130
|
-
return (await action(client, {
|
|
1140
|
+
return (await (0, errors_js_2.withExecutionError)(action)(client, {
|
|
1131
1141
|
...rest,
|
|
1132
1142
|
...call,
|
|
1133
1143
|
}));
|
|
@@ -1177,7 +1187,7 @@ async function prepareUpdateQuoteToken(client, parameters) {
|
|
|
1177
1187
|
async function inner(action, client, parameters) {
|
|
1178
1188
|
const { quoteToken, token, ...rest } = parameters;
|
|
1179
1189
|
const call = prepareUpdateQuoteToken.call(client, { quoteToken, token });
|
|
1180
|
-
return (await action(client, {
|
|
1190
|
+
return (await (0, errors_js_2.withExecutionError)(action)(client, {
|
|
1181
1191
|
...rest,
|
|
1182
1192
|
...call,
|
|
1183
1193
|
}));
|
|
@@ -1223,7 +1233,7 @@ async function updateQuoteToken(client, parameters) {
|
|
|
1223
1233
|
async function inner(action, client, parameters) {
|
|
1224
1234
|
const { token, ...rest } = parameters;
|
|
1225
1235
|
const call = updateQuoteToken.call(client, { token });
|
|
1226
|
-
return (await action(client, {
|
|
1236
|
+
return (await (0, errors_js_2.withExecutionError)(action)(client, {
|
|
1227
1237
|
...rest,
|
|
1228
1238
|
...call,
|
|
1229
1239
|
}));
|
|
@@ -1383,4 +1393,405 @@ function watchUpdateQuoteToken(client, parameters) {
|
|
|
1383
1393
|
strict: true,
|
|
1384
1394
|
});
|
|
1385
1395
|
}
|
|
1396
|
+
class TokenInsufficientBalanceError extends errors_js_1.TempoExecutionError {
|
|
1397
|
+
constructor(parameters) {
|
|
1398
|
+
const { decimals } = parameters;
|
|
1399
|
+
const [available, required, token] = parameters.error.args;
|
|
1400
|
+
super(parameters, {
|
|
1401
|
+
details: {
|
|
1402
|
+
token,
|
|
1403
|
+
available: (0, errors_js_2.formatAmount)(available, decimals),
|
|
1404
|
+
required: (0, errors_js_2.formatAmount)(required, decimals),
|
|
1405
|
+
shortfall: (0, errors_js_2.formatAmount)(required - available, decimals),
|
|
1406
|
+
},
|
|
1407
|
+
name: 'TokenInsufficientBalanceError',
|
|
1408
|
+
shortMessage: `Insufficient balance of token "${token}".`,
|
|
1409
|
+
});
|
|
1410
|
+
Object.defineProperty(this, "available", {
|
|
1411
|
+
enumerable: true,
|
|
1412
|
+
configurable: true,
|
|
1413
|
+
writable: true,
|
|
1414
|
+
value: void 0
|
|
1415
|
+
});
|
|
1416
|
+
Object.defineProperty(this, "decimals", {
|
|
1417
|
+
enumerable: true,
|
|
1418
|
+
configurable: true,
|
|
1419
|
+
writable: true,
|
|
1420
|
+
value: void 0
|
|
1421
|
+
});
|
|
1422
|
+
Object.defineProperty(this, "required", {
|
|
1423
|
+
enumerable: true,
|
|
1424
|
+
configurable: true,
|
|
1425
|
+
writable: true,
|
|
1426
|
+
value: void 0
|
|
1427
|
+
});
|
|
1428
|
+
Object.defineProperty(this, "token", {
|
|
1429
|
+
enumerable: true,
|
|
1430
|
+
configurable: true,
|
|
1431
|
+
writable: true,
|
|
1432
|
+
value: void 0
|
|
1433
|
+
});
|
|
1434
|
+
this.available = available;
|
|
1435
|
+
this.decimals = decimals;
|
|
1436
|
+
this.required = required;
|
|
1437
|
+
this.token = token;
|
|
1438
|
+
}
|
|
1439
|
+
}
|
|
1440
|
+
exports.TokenInsufficientBalanceError = TokenInsufficientBalanceError;
|
|
1441
|
+
class TokenInsufficientAllowanceError extends errors_js_1.TempoExecutionError {
|
|
1442
|
+
constructor(parameters) {
|
|
1443
|
+
const { allowance, amount, decimals, owner, spender, token } = parameters;
|
|
1444
|
+
super(parameters, {
|
|
1445
|
+
details: {
|
|
1446
|
+
token,
|
|
1447
|
+
owner,
|
|
1448
|
+
spender,
|
|
1449
|
+
allowance: (0, errors_js_2.formatAmount)(allowance, decimals),
|
|
1450
|
+
amount: (0, errors_js_2.formatAmount)(amount, decimals),
|
|
1451
|
+
},
|
|
1452
|
+
name: 'TokenInsufficientAllowanceError',
|
|
1453
|
+
shortMessage: `Spender "${spender}" has an insufficient allowance from "${owner}" for token "${token}".`,
|
|
1454
|
+
});
|
|
1455
|
+
Object.defineProperty(this, "allowance", {
|
|
1456
|
+
enumerable: true,
|
|
1457
|
+
configurable: true,
|
|
1458
|
+
writable: true,
|
|
1459
|
+
value: void 0
|
|
1460
|
+
});
|
|
1461
|
+
Object.defineProperty(this, "amount", {
|
|
1462
|
+
enumerable: true,
|
|
1463
|
+
configurable: true,
|
|
1464
|
+
writable: true,
|
|
1465
|
+
value: void 0
|
|
1466
|
+
});
|
|
1467
|
+
Object.defineProperty(this, "decimals", {
|
|
1468
|
+
enumerable: true,
|
|
1469
|
+
configurable: true,
|
|
1470
|
+
writable: true,
|
|
1471
|
+
value: void 0
|
|
1472
|
+
});
|
|
1473
|
+
Object.defineProperty(this, "owner", {
|
|
1474
|
+
enumerable: true,
|
|
1475
|
+
configurable: true,
|
|
1476
|
+
writable: true,
|
|
1477
|
+
value: void 0
|
|
1478
|
+
});
|
|
1479
|
+
Object.defineProperty(this, "spender", {
|
|
1480
|
+
enumerable: true,
|
|
1481
|
+
configurable: true,
|
|
1482
|
+
writable: true,
|
|
1483
|
+
value: void 0
|
|
1484
|
+
});
|
|
1485
|
+
Object.defineProperty(this, "token", {
|
|
1486
|
+
enumerable: true,
|
|
1487
|
+
configurable: true,
|
|
1488
|
+
writable: true,
|
|
1489
|
+
value: void 0
|
|
1490
|
+
});
|
|
1491
|
+
this.allowance = allowance;
|
|
1492
|
+
this.amount = amount;
|
|
1493
|
+
this.decimals = decimals;
|
|
1494
|
+
this.owner = owner;
|
|
1495
|
+
this.spender = spender;
|
|
1496
|
+
this.token = token;
|
|
1497
|
+
}
|
|
1498
|
+
}
|
|
1499
|
+
exports.TokenInsufficientAllowanceError = TokenInsufficientAllowanceError;
|
|
1500
|
+
class TokenSupplyCapExceededError extends errors_js_1.TempoExecutionError {
|
|
1501
|
+
constructor(parameters) {
|
|
1502
|
+
const { amount, decimals, supplyCap, token, totalSupply } = parameters;
|
|
1503
|
+
super(parameters, {
|
|
1504
|
+
details: {
|
|
1505
|
+
token,
|
|
1506
|
+
amount: (0, errors_js_2.formatAmount)(amount, decimals),
|
|
1507
|
+
'total supply': (0, errors_js_2.formatAmount)(totalSupply, decimals),
|
|
1508
|
+
'supply cap': (0, errors_js_2.formatAmount)(supplyCap, decimals),
|
|
1509
|
+
'mintable amount': supplyCap !== undefined && totalSupply !== undefined
|
|
1510
|
+
? (0, errors_js_2.formatAmount)(supplyCap - totalSupply, decimals)
|
|
1511
|
+
: undefined,
|
|
1512
|
+
},
|
|
1513
|
+
name: 'TokenSupplyCapExceededError',
|
|
1514
|
+
shortMessage: `Minting exceeds the supply cap of token "${token}".`,
|
|
1515
|
+
});
|
|
1516
|
+
Object.defineProperty(this, "amount", {
|
|
1517
|
+
enumerable: true,
|
|
1518
|
+
configurable: true,
|
|
1519
|
+
writable: true,
|
|
1520
|
+
value: void 0
|
|
1521
|
+
});
|
|
1522
|
+
Object.defineProperty(this, "decimals", {
|
|
1523
|
+
enumerable: true,
|
|
1524
|
+
configurable: true,
|
|
1525
|
+
writable: true,
|
|
1526
|
+
value: void 0
|
|
1527
|
+
});
|
|
1528
|
+
Object.defineProperty(this, "supplyCap", {
|
|
1529
|
+
enumerable: true,
|
|
1530
|
+
configurable: true,
|
|
1531
|
+
writable: true,
|
|
1532
|
+
value: void 0
|
|
1533
|
+
});
|
|
1534
|
+
Object.defineProperty(this, "token", {
|
|
1535
|
+
enumerable: true,
|
|
1536
|
+
configurable: true,
|
|
1537
|
+
writable: true,
|
|
1538
|
+
value: void 0
|
|
1539
|
+
});
|
|
1540
|
+
Object.defineProperty(this, "totalSupply", {
|
|
1541
|
+
enumerable: true,
|
|
1542
|
+
configurable: true,
|
|
1543
|
+
writable: true,
|
|
1544
|
+
value: void 0
|
|
1545
|
+
});
|
|
1546
|
+
this.amount = amount;
|
|
1547
|
+
this.decimals = decimals;
|
|
1548
|
+
this.supplyCap = supplyCap;
|
|
1549
|
+
this.token = token;
|
|
1550
|
+
this.totalSupply = totalSupply;
|
|
1551
|
+
}
|
|
1552
|
+
}
|
|
1553
|
+
exports.TokenSupplyCapExceededError = TokenSupplyCapExceededError;
|
|
1554
|
+
class TokenPolicyForbidsError extends errors_js_1.TempoExecutionError {
|
|
1555
|
+
constructor(parameters) {
|
|
1556
|
+
const { from, policyId, recipientAuthorized, senderAuthorized, to, token } = parameters;
|
|
1557
|
+
const party = senderAuthorized === false
|
|
1558
|
+
? `sender "${from}"`
|
|
1559
|
+
: recipientAuthorized === false
|
|
1560
|
+
? `recipient "${to}"`
|
|
1561
|
+
: 'this transfer';
|
|
1562
|
+
super(parameters, {
|
|
1563
|
+
details: {
|
|
1564
|
+
token,
|
|
1565
|
+
policy: policyId,
|
|
1566
|
+
from,
|
|
1567
|
+
to,
|
|
1568
|
+
'sender authorized': senderAuthorized?.toString(),
|
|
1569
|
+
'recipient authorized': recipientAuthorized?.toString(),
|
|
1570
|
+
},
|
|
1571
|
+
name: 'TokenPolicyForbidsError',
|
|
1572
|
+
shortMessage: `The transfer policy of token "${token}" forbids ${party}.`,
|
|
1573
|
+
});
|
|
1574
|
+
Object.defineProperty(this, "from", {
|
|
1575
|
+
enumerable: true,
|
|
1576
|
+
configurable: true,
|
|
1577
|
+
writable: true,
|
|
1578
|
+
value: void 0
|
|
1579
|
+
});
|
|
1580
|
+
Object.defineProperty(this, "policyId", {
|
|
1581
|
+
enumerable: true,
|
|
1582
|
+
configurable: true,
|
|
1583
|
+
writable: true,
|
|
1584
|
+
value: void 0
|
|
1585
|
+
});
|
|
1586
|
+
Object.defineProperty(this, "recipientAuthorized", {
|
|
1587
|
+
enumerable: true,
|
|
1588
|
+
configurable: true,
|
|
1589
|
+
writable: true,
|
|
1590
|
+
value: void 0
|
|
1591
|
+
});
|
|
1592
|
+
Object.defineProperty(this, "senderAuthorized", {
|
|
1593
|
+
enumerable: true,
|
|
1594
|
+
configurable: true,
|
|
1595
|
+
writable: true,
|
|
1596
|
+
value: void 0
|
|
1597
|
+
});
|
|
1598
|
+
Object.defineProperty(this, "to", {
|
|
1599
|
+
enumerable: true,
|
|
1600
|
+
configurable: true,
|
|
1601
|
+
writable: true,
|
|
1602
|
+
value: void 0
|
|
1603
|
+
});
|
|
1604
|
+
Object.defineProperty(this, "token", {
|
|
1605
|
+
enumerable: true,
|
|
1606
|
+
configurable: true,
|
|
1607
|
+
writable: true,
|
|
1608
|
+
value: void 0
|
|
1609
|
+
});
|
|
1610
|
+
this.from = from;
|
|
1611
|
+
this.policyId = policyId;
|
|
1612
|
+
this.recipientAuthorized = recipientAuthorized;
|
|
1613
|
+
this.senderAuthorized = senderAuthorized;
|
|
1614
|
+
this.to = to;
|
|
1615
|
+
this.token = token;
|
|
1616
|
+
}
|
|
1617
|
+
}
|
|
1618
|
+
exports.TokenPolicyForbidsError = TokenPolicyForbidsError;
|
|
1619
|
+
class TokenPausedError extends errors_js_1.TempoExecutionError {
|
|
1620
|
+
constructor(parameters) {
|
|
1621
|
+
super(parameters, {
|
|
1622
|
+
name: 'TokenPausedError',
|
|
1623
|
+
shortMessage: `Token "${parameters.token}" is paused.`,
|
|
1624
|
+
});
|
|
1625
|
+
Object.defineProperty(this, "token", {
|
|
1626
|
+
enumerable: true,
|
|
1627
|
+
configurable: true,
|
|
1628
|
+
writable: true,
|
|
1629
|
+
value: void 0
|
|
1630
|
+
});
|
|
1631
|
+
this.token = parameters.token;
|
|
1632
|
+
}
|
|
1633
|
+
}
|
|
1634
|
+
exports.TokenPausedError = TokenPausedError;
|
|
1635
|
+
class TokenUnauthorizedError extends errors_js_1.TempoExecutionError {
|
|
1636
|
+
constructor(parameters) {
|
|
1637
|
+
const { account, role, token } = parameters;
|
|
1638
|
+
super(parameters, {
|
|
1639
|
+
details: { token, account, role },
|
|
1640
|
+
name: 'TokenUnauthorizedError',
|
|
1641
|
+
shortMessage: `Account "${account}" does not have the "${role}" role on token "${token}".`,
|
|
1642
|
+
});
|
|
1643
|
+
Object.defineProperty(this, "account", {
|
|
1644
|
+
enumerable: true,
|
|
1645
|
+
configurable: true,
|
|
1646
|
+
writable: true,
|
|
1647
|
+
value: void 0
|
|
1648
|
+
});
|
|
1649
|
+
Object.defineProperty(this, "role", {
|
|
1650
|
+
enumerable: true,
|
|
1651
|
+
configurable: true,
|
|
1652
|
+
writable: true,
|
|
1653
|
+
value: void 0
|
|
1654
|
+
});
|
|
1655
|
+
Object.defineProperty(this, "token", {
|
|
1656
|
+
enumerable: true,
|
|
1657
|
+
configurable: true,
|
|
1658
|
+
writable: true,
|
|
1659
|
+
value: void 0
|
|
1660
|
+
});
|
|
1661
|
+
this.account = account;
|
|
1662
|
+
this.role = role;
|
|
1663
|
+
this.token = token;
|
|
1664
|
+
}
|
|
1665
|
+
}
|
|
1666
|
+
exports.TokenUnauthorizedError = TokenUnauthorizedError;
|
|
1667
|
+
const requiredRoles = {
|
|
1668
|
+
burn: 'issuer',
|
|
1669
|
+
burnAt: 'burnAt',
|
|
1670
|
+
burnBlocked: 'burnBlocked',
|
|
1671
|
+
burnWithMemo: 'issuer',
|
|
1672
|
+
changeTransferPolicyId: 'defaultAdmin',
|
|
1673
|
+
completeQuoteTokenUpdate: 'defaultAdmin',
|
|
1674
|
+
mint: 'issuer',
|
|
1675
|
+
mintWithMemo: 'issuer',
|
|
1676
|
+
pause: 'pause',
|
|
1677
|
+
setLogoURI: 'defaultAdmin',
|
|
1678
|
+
setNextQuoteToken: 'defaultAdmin',
|
|
1679
|
+
setSupplyCap: 'defaultAdmin',
|
|
1680
|
+
unpause: 'unpause',
|
|
1681
|
+
};
|
|
1682
|
+
exports.errorResolvers = {
|
|
1683
|
+
'ContractPaused()': ({ base, call }) => (0, errors_js_2.isTip20)(call?.address)
|
|
1684
|
+
? new TokenPausedError({ ...base, token: call.address })
|
|
1685
|
+
: undefined,
|
|
1686
|
+
'InsufficientAllowance()': async (context) => {
|
|
1687
|
+
const { base, call, signer } = context;
|
|
1688
|
+
const owner = call?.arg('from');
|
|
1689
|
+
if (!(0, errors_js_2.isTip20)(call?.address) || !owner || !signer)
|
|
1690
|
+
return undefined;
|
|
1691
|
+
const token = call.address;
|
|
1692
|
+
const [allowance, decimals] = await context.read([
|
|
1693
|
+
{
|
|
1694
|
+
address: token,
|
|
1695
|
+
abi: Abis.tip20,
|
|
1696
|
+
functionName: 'allowance',
|
|
1697
|
+
args: [owner, signer.address],
|
|
1698
|
+
},
|
|
1699
|
+
{ address: token, abi: Abis.tip20, functionName: 'decimals' },
|
|
1700
|
+
]);
|
|
1701
|
+
return new TokenInsufficientAllowanceError({
|
|
1702
|
+
...base,
|
|
1703
|
+
allowance: allowance?.result,
|
|
1704
|
+
amount: call.arg('amount'),
|
|
1705
|
+
decimals: decimals?.result,
|
|
1706
|
+
owner,
|
|
1707
|
+
spender: signer.address,
|
|
1708
|
+
token,
|
|
1709
|
+
});
|
|
1710
|
+
},
|
|
1711
|
+
'InsufficientBalance(uint256,uint256,address)': async (context) => {
|
|
1712
|
+
const token = context.base.error.args?.[2];
|
|
1713
|
+
if (!token)
|
|
1714
|
+
return undefined;
|
|
1715
|
+
const [decimals] = await context.read([
|
|
1716
|
+
{ address: token, abi: Abis.tip20, functionName: 'decimals' },
|
|
1717
|
+
]);
|
|
1718
|
+
return new TokenInsufficientBalanceError({
|
|
1719
|
+
...context.base,
|
|
1720
|
+
decimals: decimals?.result,
|
|
1721
|
+
});
|
|
1722
|
+
},
|
|
1723
|
+
'PolicyForbids()': async (context) => {
|
|
1724
|
+
const { base, call, signer } = context;
|
|
1725
|
+
if (!(0, errors_js_2.isTip20)(call?.address))
|
|
1726
|
+
return undefined;
|
|
1727
|
+
const token = call.address;
|
|
1728
|
+
const mint = call.functionName.startsWith('mint');
|
|
1729
|
+
const from = mint
|
|
1730
|
+
? undefined
|
|
1731
|
+
: (call.arg('from') ?? signer?.address);
|
|
1732
|
+
const to = call.arg('to');
|
|
1733
|
+
const [policyId] = await context.read([
|
|
1734
|
+
{ address: token, abi: Abis.tip20, functionName: 'transferPolicyId' },
|
|
1735
|
+
]);
|
|
1736
|
+
const registry = {
|
|
1737
|
+
address: Addresses.tip403Registry,
|
|
1738
|
+
abi: Abis.tip403Registry,
|
|
1739
|
+
};
|
|
1740
|
+
const [sender, recipient] = policyId?.result === undefined
|
|
1741
|
+
? []
|
|
1742
|
+
: await context.read([
|
|
1743
|
+
{
|
|
1744
|
+
...registry,
|
|
1745
|
+
functionName: 'isAuthorizedSender',
|
|
1746
|
+
args: [policyId.result, from ?? address_js_1.zeroAddress],
|
|
1747
|
+
},
|
|
1748
|
+
{
|
|
1749
|
+
...registry,
|
|
1750
|
+
functionName: mint
|
|
1751
|
+
? 'isAuthorizedMintRecipient'
|
|
1752
|
+
: 'isAuthorizedRecipient',
|
|
1753
|
+
args: [policyId.result, to ?? address_js_1.zeroAddress],
|
|
1754
|
+
},
|
|
1755
|
+
]);
|
|
1756
|
+
return new TokenPolicyForbidsError({
|
|
1757
|
+
...base,
|
|
1758
|
+
from,
|
|
1759
|
+
policyId: policyId?.result,
|
|
1760
|
+
recipientAuthorized: to ? recipient?.result : undefined,
|
|
1761
|
+
senderAuthorized: from ? sender?.result : undefined,
|
|
1762
|
+
to,
|
|
1763
|
+
token,
|
|
1764
|
+
});
|
|
1765
|
+
},
|
|
1766
|
+
'SupplyCapExceeded()': async (context) => {
|
|
1767
|
+
const { base, call } = context;
|
|
1768
|
+
if (!(0, errors_js_2.isTip20)(call?.address))
|
|
1769
|
+
return undefined;
|
|
1770
|
+
const token = call.address;
|
|
1771
|
+
const [supplyCap, totalSupply, decimals] = await context.read([
|
|
1772
|
+
{ address: token, abi: Abis.tip20, functionName: 'supplyCap' },
|
|
1773
|
+
{ address: token, abi: Abis.tip20, functionName: 'totalSupply' },
|
|
1774
|
+
{ address: token, abi: Abis.tip20, functionName: 'decimals' },
|
|
1775
|
+
]);
|
|
1776
|
+
return new TokenSupplyCapExceededError({
|
|
1777
|
+
...base,
|
|
1778
|
+
amount: call.arg('amount'),
|
|
1779
|
+
decimals: decimals?.result,
|
|
1780
|
+
supplyCap: supplyCap?.result,
|
|
1781
|
+
token,
|
|
1782
|
+
totalSupply: totalSupply?.result,
|
|
1783
|
+
});
|
|
1784
|
+
},
|
|
1785
|
+
'Unauthorized()': ({ base, call, signer }) => {
|
|
1786
|
+
const role = call && requiredRoles[call.functionName];
|
|
1787
|
+
if (!(0, errors_js_2.isTip20)(call?.address) || !role || !signer)
|
|
1788
|
+
return undefined;
|
|
1789
|
+
return new TokenUnauthorizedError({
|
|
1790
|
+
...base,
|
|
1791
|
+
account: signer.address,
|
|
1792
|
+
role,
|
|
1793
|
+
token: call.address,
|
|
1794
|
+
});
|
|
1795
|
+
},
|
|
1796
|
+
};
|
|
1386
1797
|
//# sourceMappingURL=token.js.map
|