viem 2.57.14 → 2.57.16
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 +58 -0
- package/_cjs/account-abstraction/utils/formatters/userOperationReceipt.js +2 -0
- package/_cjs/account-abstraction/utils/formatters/userOperationReceipt.js.map +1 -1
- package/_cjs/actions/public/estimateGas.js +5 -2
- package/_cjs/actions/public/estimateGas.js.map +1 -1
- package/_cjs/actions/public/fillTransaction.js +2 -0
- package/_cjs/actions/public/fillTransaction.js.map +1 -1
- package/_cjs/actions/public/getFilterChanges.js +1 -0
- package/_cjs/actions/public/getFilterChanges.js.map +1 -1
- package/_cjs/actions/public/getFilterLogs.js +1 -0
- package/_cjs/actions/public/getFilterLogs.js.map +1 -1
- package/_cjs/actions/public/watchBlockNumber.js +3 -1
- package/_cjs/actions/public/watchBlockNumber.js.map +1 -1
- package/_cjs/actions/public/watchBlocks.js +20 -8
- package/_cjs/actions/public/watchBlocks.js.map +1 -1
- package/_cjs/actions/public/watchContractEvent.js +10 -3
- package/_cjs/actions/public/watchContractEvent.js.map +1 -1
- package/_cjs/actions/public/watchEvent.js +5 -0
- package/_cjs/actions/public/watchEvent.js.map +1 -1
- package/_cjs/actions/wallet/prepareTransactionRequest.js +3 -2
- package/_cjs/actions/wallet/prepareTransactionRequest.js.map +1 -1
- package/_cjs/actions/wallet/sendTransaction.js +4 -2
- package/_cjs/actions/wallet/sendTransaction.js.map +1 -1
- package/_cjs/actions/wallet/sendTransactionSync.js +48 -7
- package/_cjs/actions/wallet/sendTransactionSync.js.map +1 -1
- package/_cjs/chains/definitions/hashKeyChain.js +4 -4
- package/_cjs/chains/definitions/hashKeyChain.js.map +1 -1
- package/_cjs/chains/definitions/hashkeyChainTestnet.js +4 -4
- package/_cjs/chains/definitions/hashkeyChainTestnet.js.map +1 -1
- package/_cjs/chains/definitions/turkchain.js +26 -0
- package/_cjs/chains/definitions/turkchain.js.map +1 -0
- package/_cjs/chains/definitions/zksync.js +1 -1
- package/_cjs/chains/definitions/zksync.js.map +1 -1
- package/_cjs/chains/index.js +4 -2
- package/_cjs/chains/index.js.map +1 -1
- package/_cjs/clients/createClient.js.map +1 -1
- package/_cjs/clients/transports/fallback.js +5 -0
- package/_cjs/clients/transports/fallback.js.map +1 -1
- package/_cjs/errors/node.js +10 -4
- package/_cjs/errors/node.js.map +1 -1
- package/_cjs/errors/typedData.js +4 -2
- package/_cjs/errors/typedData.js.map +1 -1
- package/_cjs/errors/version.js +1 -1
- package/_cjs/index.js +5 -4
- package/_cjs/index.js.map +1 -1
- package/_cjs/tempo/Account.js +85 -12
- package/_cjs/tempo/Account.js.map +1 -1
- package/_cjs/tempo/Gateway.js +195 -0
- package/_cjs/tempo/Gateway.js.map +1 -0
- package/_cjs/tempo/GatewayDecorator.js +168 -0
- package/_cjs/tempo/GatewayDecorator.js.map +1 -0
- package/_cjs/tempo/Transaction.js +2 -1
- package/_cjs/tempo/Transaction.js.map +1 -1
- package/_cjs/tempo/actions/ai.js +69 -0
- package/_cjs/tempo/actions/ai.js.map +1 -0
- package/_cjs/tempo/actions/bucket.js +85 -0
- package/_cjs/tempo/actions/bucket.js.map +1 -0
- package/_cjs/tempo/actions/compute.js +165 -0
- package/_cjs/tempo/actions/compute.js.map +1 -0
- package/_cjs/tempo/actions/gateway.js +8 -0
- package/_cjs/tempo/actions/gateway.js.map +1 -0
- package/_cjs/tempo/actions/index.js +6 -1
- package/_cjs/tempo/actions/index.js.map +1 -1
- package/_cjs/tempo/actions/kv.js +44 -0
- package/_cjs/tempo/actions/kv.js.map +1 -0
- package/_cjs/tempo/chainConfig.js +4 -12
- package/_cjs/tempo/chainConfig.js.map +1 -1
- package/_cjs/tempo/index.js +4 -1
- package/_cjs/tempo/index.js.map +1 -1
- package/_cjs/tempo/internal/ndjson.js +43 -0
- package/_cjs/tempo/internal/ndjson.js.map +1 -0
- package/_cjs/tempo/internal/relay/feePayer.js +18 -5
- package/_cjs/tempo/internal/relay/feePayer.js.map +1 -1
- package/_cjs/utils/abi/decodeEventLog.js +57 -7
- package/_cjs/utils/abi/decodeEventLog.js.map +1 -1
- package/_cjs/utils/abi/getAbiItem.js +27 -6
- package/_cjs/utils/abi/getAbiItem.js.map +1 -1
- package/_cjs/utils/abi/parseEventLogs.js +27 -4
- package/_cjs/utils/abi/parseEventLogs.js.map +1 -1
- package/_cjs/utils/authorization/recoverAuthorizationAddress.js +9 -2
- package/_cjs/utils/authorization/recoverAuthorizationAddress.js.map +1 -1
- package/_cjs/utils/authorization/verifyAuthorization.js +14 -4
- package/_cjs/utils/authorization/verifyAuthorization.js.map +1 -1
- package/_cjs/utils/buildRequest.js +4 -0
- package/_cjs/utils/buildRequest.js.map +1 -1
- package/_cjs/utils/ccip.js +134 -28
- package/_cjs/utils/ccip.js.map +1 -1
- package/_cjs/utils/ccipTunnel.js +5 -1
- package/_cjs/utils/ccipTunnel.js.map +1 -1
- package/_cjs/utils/ens/localBatchGatewayRequest.js +55 -5
- package/_cjs/utils/ens/localBatchGatewayRequest.js.map +1 -1
- package/_cjs/utils/hash/toSignatureHash.js +10 -1
- package/_cjs/utils/hash/toSignatureHash.js.map +1 -1
- package/_cjs/utils/internal/http.js +79 -0
- package/_cjs/utils/internal/http.js.map +1 -0
- package/_cjs/utils/nonceManager.js.map +1 -1
- package/_cjs/utils/rpc/http.js +9 -76
- package/_cjs/utils/rpc/http.js.map +1 -1
- package/_cjs/utils/rpc/socket.js +20 -9
- package/_cjs/utils/rpc/socket.js.map +1 -1
- package/_cjs/utils/transaction/assertRequest.js +2 -2
- package/_cjs/utils/transaction/assertRequest.js.map +1 -1
- package/_cjs/utils/transaction/assertTransaction.js +2 -2
- package/_cjs/utils/transaction/assertTransaction.js.map +1 -1
- package/_cjs/utils/transaction/parseTransaction.js +21 -7
- package/_cjs/utils/transaction/parseTransaction.js.map +1 -1
- package/_cjs/utils/typedData.js +19 -6
- package/_cjs/utils/typedData.js.map +1 -1
- package/_cjs/zksync/actions/finalizeWithdrawal.js +4 -2
- package/_cjs/zksync/actions/finalizeWithdrawal.js.map +1 -1
- package/_cjs/zksync/actions/isWithdrawalFinalized.js +4 -5
- package/_cjs/zksync/actions/isWithdrawalFinalized.js.map +1 -1
- package/_esm/account-abstraction/utils/formatters/userOperationReceipt.js +2 -0
- package/_esm/account-abstraction/utils/formatters/userOperationReceipt.js.map +1 -1
- package/_esm/actions/public/estimateGas.js +10 -5
- package/_esm/actions/public/estimateGas.js.map +1 -1
- package/_esm/actions/public/fillTransaction.js +2 -0
- package/_esm/actions/public/fillTransaction.js.map +1 -1
- package/_esm/actions/public/getFilterChanges.js +1 -0
- package/_esm/actions/public/getFilterChanges.js.map +1 -1
- package/_esm/actions/public/getFilterLogs.js +1 -0
- package/_esm/actions/public/getFilterLogs.js.map +1 -1
- package/_esm/actions/public/watchBlockNumber.js +5 -1
- package/_esm/actions/public/watchBlockNumber.js.map +1 -1
- package/_esm/actions/public/watchBlocks.js +28 -8
- package/_esm/actions/public/watchBlocks.js.map +1 -1
- package/_esm/actions/public/watchContractEvent.js +15 -5
- package/_esm/actions/public/watchContractEvent.js.map +1 -1
- package/_esm/actions/public/watchEvent.js +11 -2
- package/_esm/actions/public/watchEvent.js.map +1 -1
- package/_esm/actions/wallet/prepareTransactionRequest.js +3 -2
- package/_esm/actions/wallet/prepareTransactionRequest.js.map +1 -1
- package/_esm/actions/wallet/sendTransaction.js +6 -2
- package/_esm/actions/wallet/sendTransaction.js.map +1 -1
- package/_esm/actions/wallet/sendTransactionSync.js +59 -8
- package/_esm/actions/wallet/sendTransactionSync.js.map +1 -1
- package/_esm/chains/definitions/hashKeyChain.js +4 -4
- package/_esm/chains/definitions/hashKeyChain.js.map +1 -1
- package/_esm/chains/definitions/hashkeyChainTestnet.js +4 -4
- package/_esm/chains/definitions/hashkeyChainTestnet.js.map +1 -1
- package/_esm/chains/definitions/turkchain.js +23 -0
- package/_esm/chains/definitions/turkchain.js.map +1 -0
- package/_esm/chains/definitions/zksync.js +1 -1
- package/_esm/chains/definitions/zksync.js.map +1 -1
- package/_esm/chains/index.js +1 -0
- package/_esm/chains/index.js.map +1 -1
- package/_esm/clients/createClient.js.map +1 -1
- package/_esm/clients/transports/fallback.js +8 -0
- package/_esm/clients/transports/fallback.js.map +1 -1
- package/_esm/errors/node.js +10 -4
- package/_esm/errors/node.js.map +1 -1
- package/_esm/errors/typedData.js +5 -2
- package/_esm/errors/typedData.js.map +1 -1
- package/_esm/errors/version.js +1 -1
- package/_esm/index.js +1 -1
- package/_esm/index.js.map +1 -1
- package/_esm/tempo/Account.js +122 -11
- package/_esm/tempo/Account.js.map +1 -1
- package/_esm/tempo/Gateway.js +294 -0
- package/_esm/tempo/Gateway.js.map +1 -0
- package/_esm/tempo/GatewayDecorator.js +207 -0
- package/_esm/tempo/GatewayDecorator.js.map +1 -0
- package/_esm/tempo/Transaction.js +2 -0
- package/_esm/tempo/Transaction.js.map +1 -1
- package/_esm/tempo/actions/ai.js +132 -0
- package/_esm/tempo/actions/ai.js.map +1 -0
- package/_esm/tempo/actions/bucket.js +181 -0
- package/_esm/tempo/actions/bucket.js.map +1 -0
- package/_esm/tempo/actions/compute.js +424 -0
- package/_esm/tempo/actions/compute.js.map +1 -0
- package/_esm/tempo/actions/gateway.js +22 -0
- package/_esm/tempo/actions/gateway.js.map +1 -0
- package/_esm/tempo/actions/index.js +10 -0
- package/_esm/tempo/actions/index.js.map +1 -1
- package/_esm/tempo/actions/kv.js +124 -0
- package/_esm/tempo/actions/kv.js.map +1 -0
- package/_esm/tempo/chainConfig.js +13 -15
- package/_esm/tempo/chainConfig.js.map +1 -1
- package/_esm/tempo/index.js +9 -0
- package/_esm/tempo/index.js.map +1 -1
- package/_esm/tempo/internal/ndjson.js +45 -0
- package/_esm/tempo/internal/ndjson.js.map +1 -0
- package/_esm/tempo/internal/relay/feePayer.js +24 -7
- package/_esm/tempo/internal/relay/feePayer.js.map +1 -1
- package/_esm/utils/abi/decodeEventLog.js +69 -7
- package/_esm/utils/abi/decodeEventLog.js.map +1 -1
- package/_esm/utils/abi/getAbiItem.js +34 -6
- package/_esm/utils/abi/getAbiItem.js.map +1 -1
- package/_esm/utils/abi/parseEventLogs.js +43 -10
- package/_esm/utils/abi/parseEventLogs.js.map +1 -1
- package/_esm/utils/authorization/recoverAuthorizationAddress.js +11 -2
- package/_esm/utils/authorization/recoverAuthorizationAddress.js.map +1 -1
- package/_esm/utils/authorization/verifyAuthorization.js +15 -4
- package/_esm/utils/authorization/verifyAuthorization.js.map +1 -1
- package/_esm/utils/buildRequest.js +6 -0
- package/_esm/utils/buildRequest.js.map +1 -1
- package/_esm/utils/ccip.js +163 -31
- package/_esm/utils/ccip.js.map +1 -1
- package/_esm/utils/ccipTunnel.js +5 -1
- package/_esm/utils/ccipTunnel.js.map +1 -1
- package/_esm/utils/ens/localBatchGatewayRequest.js +69 -4
- package/_esm/utils/ens/localBatchGatewayRequest.js.map +1 -1
- package/_esm/utils/hash/toSignatureHash.js +11 -1
- package/_esm/utils/hash/toSignatureHash.js.map +1 -1
- package/_esm/utils/internal/http.js +83 -0
- package/_esm/utils/internal/http.js.map +1 -0
- package/_esm/utils/nonceManager.js.map +1 -1
- package/_esm/utils/rpc/http.js +12 -78
- package/_esm/utils/rpc/http.js.map +1 -1
- package/_esm/utils/rpc/socket.js +24 -9
- package/_esm/utils/rpc/socket.js.map +1 -1
- package/_esm/utils/transaction/assertRequest.js +2 -2
- package/_esm/utils/transaction/assertRequest.js.map +1 -1
- package/_esm/utils/transaction/assertTransaction.js +2 -2
- package/_esm/utils/transaction/assertTransaction.js.map +1 -1
- package/_esm/utils/transaction/parseTransaction.js +24 -7
- package/_esm/utils/transaction/parseTransaction.js.map +1 -1
- package/_esm/utils/typedData.js +25 -8
- package/_esm/utils/typedData.js.map +1 -1
- package/_esm/zksync/actions/finalizeWithdrawal.js +5 -2
- package/_esm/zksync/actions/finalizeWithdrawal.js.map +1 -1
- package/_esm/zksync/actions/isWithdrawalFinalized.js +5 -5
- package/_esm/zksync/actions/isWithdrawalFinalized.js.map +1 -1
- package/_types/account-abstraction/utils/formatters/userOperationReceipt.d.ts.map +1 -1
- package/_types/actions/public/estimateGas.d.ts.map +1 -1
- package/_types/actions/public/fillTransaction.d.ts.map +1 -1
- package/_types/actions/public/getFilterChanges.d.ts.map +1 -1
- package/_types/actions/public/getFilterLogs.d.ts.map +1 -1
- package/_types/actions/public/watchBlockNumber.d.ts +6 -2
- package/_types/actions/public/watchBlockNumber.d.ts.map +1 -1
- package/_types/actions/public/watchBlocks.d.ts +7 -2
- package/_types/actions/public/watchBlocks.d.ts.map +1 -1
- package/_types/actions/public/watchContractEvent.d.ts.map +1 -1
- package/_types/actions/public/watchEvent.d.ts.map +1 -1
- package/_types/actions/wallet/prepareTransactionRequest.d.ts.map +1 -1
- package/_types/actions/wallet/sendTransaction.d.ts.map +1 -1
- package/_types/actions/wallet/sendTransactionSync.d.ts.map +1 -1
- package/_types/chains/definitions/hashKeyChain.d.ts +4 -4
- package/_types/chains/definitions/hashkeyChainTestnet.d.ts +4 -4
- package/_types/chains/definitions/turkchain.d.ts +53 -0
- package/_types/chains/definitions/turkchain.d.ts.map +1 -0
- package/_types/chains/definitions/zksync.d.ts +1 -1
- package/_types/chains/index.d.ts +1 -0
- package/_types/chains/index.d.ts.map +1 -1
- package/_types/clients/createClient.d.ts +6 -0
- package/_types/clients/createClient.d.ts.map +1 -1
- package/_types/clients/transports/fallback.d.ts.map +1 -1
- package/_types/errors/node.d.ts.map +1 -1
- package/_types/errors/typedData.d.ts.map +1 -1
- package/_types/errors/version.d.ts +1 -1
- package/_types/index.d.ts +1 -1
- package/_types/index.d.ts.map +1 -1
- package/_types/tempo/Account.d.ts +77 -4
- package/_types/tempo/Account.d.ts.map +1 -1
- package/_types/tempo/Gateway.d.ts +337 -0
- package/_types/tempo/Gateway.d.ts.map +1 -0
- package/_types/tempo/GatewayDecorator.d.ts +635 -0
- package/_types/tempo/GatewayDecorator.d.ts.map +1 -0
- package/_types/tempo/Relay.d.ts +1 -1
- package/_types/tempo/Relay.d.ts.map +1 -1
- package/_types/tempo/Transaction.d.ts +2 -0
- package/_types/tempo/Transaction.d.ts.map +1 -1
- package/_types/tempo/actions/ai.d.ts +145 -0
- package/_types/tempo/actions/ai.d.ts.map +1 -0
- package/_types/tempo/actions/bucket.d.ts +210 -0
- package/_types/tempo/actions/bucket.d.ts.map +1 -0
- package/_types/tempo/actions/compute.d.ts +628 -0
- package/_types/tempo/actions/compute.d.ts.map +1 -0
- package/_types/tempo/actions/gateway.d.ts +25 -0
- package/_types/tempo/actions/gateway.d.ts.map +1 -0
- package/_types/tempo/actions/index.d.ts +10 -0
- package/_types/tempo/actions/index.d.ts.map +1 -1
- package/_types/tempo/actions/kv.d.ts +167 -0
- package/_types/tempo/actions/kv.d.ts.map +1 -0
- package/_types/tempo/chainConfig.d.ts.map +1 -1
- package/_types/tempo/index.d.ts +11 -0
- package/_types/tempo/index.d.ts.map +1 -1
- package/_types/tempo/internal/ndjson.d.ts +9 -0
- package/_types/tempo/internal/ndjson.d.ts.map +1 -0
- package/_types/tempo/internal/relay/feePayer.d.ts.map +1 -1
- package/_types/tempo/internal/relay/utils.d.ts +8 -8
- package/_types/utils/abi/decodeEventLog.d.ts +13 -1
- package/_types/utils/abi/decodeEventLog.d.ts.map +1 -1
- package/_types/utils/abi/getAbiItem.d.ts.map +1 -1
- package/_types/utils/abi/parseEventLogs.d.ts.map +1 -1
- package/_types/utils/authorization/recoverAuthorizationAddress.d.ts +2 -1
- package/_types/utils/authorization/recoverAuthorizationAddress.d.ts.map +1 -1
- package/_types/utils/authorization/verifyAuthorization.d.ts.map +1 -1
- package/_types/utils/buildRequest.d.ts.map +1 -1
- package/_types/utils/ccip.d.ts +24 -4
- package/_types/utils/ccip.d.ts.map +1 -1
- package/_types/utils/ccipTunnel.d.ts.map +1 -1
- package/_types/utils/ens/localBatchGatewayRequest.d.ts +26 -0
- package/_types/utils/ens/localBatchGatewayRequest.d.ts.map +1 -1
- package/_types/utils/hash/toSignatureHash.d.ts +1 -1
- package/_types/utils/hash/toSignatureHash.d.ts.map +1 -1
- package/_types/utils/internal/http.d.ts +16 -0
- package/_types/utils/internal/http.d.ts.map +1 -0
- package/_types/utils/nonceManager.d.ts +15 -1
- package/_types/utils/nonceManager.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/_types/utils/transaction/parseTransaction.d.ts.map +1 -1
- package/_types/utils/typedData.d.ts.map +1 -1
- package/account-abstraction/utils/formatters/userOperationReceipt.ts +1 -0
- package/actions/public/estimateGas.ts +12 -5
- package/actions/public/fillTransaction.ts +2 -0
- package/actions/public/getFilterChanges.ts +1 -0
- package/actions/public/getFilterLogs.ts +1 -0
- package/actions/public/watchBlockNumber.ts +11 -2
- package/actions/public/watchBlocks.ts +46 -14
- package/actions/public/watchContractEvent.ts +22 -4
- package/actions/public/watchEvent.ts +17 -1
- package/actions/wallet/prepareTransactionRequest.ts +6 -2
- package/actions/wallet/sendTransaction.ts +9 -3
- package/actions/wallet/sendTransactionSync.ts +74 -12
- package/chains/definitions/hashKeyChain.ts +4 -4
- package/chains/definitions/hashkeyChainTestnet.ts +4 -4
- package/chains/definitions/turkchain.ts +23 -0
- package/chains/definitions/zksync.ts +1 -1
- package/chains/index.ts +1 -0
- package/clients/createClient.ts +6 -0
- package/clients/transports/fallback.ts +11 -0
- package/errors/node.ts +11 -5
- package/errors/typedData.ts +5 -2
- package/errors/version.ts +1 -1
- package/index.ts +2 -0
- package/package.json +5 -1
- package/tempo/Account.ts +202 -16
- package/tempo/Gateway.ts +477 -0
- package/tempo/GatewayDecorator.ts +909 -0
- package/tempo/Relay.ts +1 -1
- package/tempo/Transaction.ts +3 -0
- package/tempo/actions/ai.ts +250 -0
- package/tempo/actions/bucket.ts +324 -0
- package/tempo/actions/compute.ts +894 -0
- package/tempo/actions/gateway.ts +33 -0
- package/tempo/actions/index.ts +10 -0
- package/tempo/actions/kv.ts +229 -0
- package/tempo/chainConfig.ts +13 -15
- package/tempo/index.ts +12 -0
- package/tempo/internal/ndjson.ts +51 -0
- package/tempo/internal/relay/feePayer.ts +30 -7
- package/utils/abi/decodeEventLog.ts +97 -10
- package/utils/abi/getAbiItem.ts +35 -5
- package/utils/abi/parseEventLogs.ts +48 -11
- package/utils/authorization/recoverAuthorizationAddress.ts +18 -2
- package/utils/authorization/verifyAuthorization.ts +12 -7
- package/utils/buildRequest.ts +4 -0
- package/utils/ccip.ts +199 -33
- package/utils/ccipTunnel.ts +5 -1
- package/utils/ens/localBatchGatewayRequest.ts +82 -4
- package/utils/hash/toSignatureHash.ts +12 -2
- package/utils/internal/http.ts +92 -0
- package/utils/nonceManager.ts +16 -1
- package/utils/rpc/http.ts +12 -86
- package/utils/rpc/socket.ts +28 -15
- package/utils/transaction/assertRequest.ts +2 -2
- package/utils/transaction/assertTransaction.ts +2 -2
- package/utils/transaction/parseTransaction.ts +32 -7
- package/utils/typedData.ts +31 -8
- package/zksync/actions/finalizeWithdrawal.ts +5 -2
- package/zksync/actions/isWithdrawalFinalized.ts +5 -5
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { defineChain } from '../../utils/chain/defineChain.js'
|
|
2
|
+
|
|
3
|
+
export const turkchain = /*#__PURE__*/ defineChain({
|
|
4
|
+
id: 1919,
|
|
5
|
+
name: 'Turkchain',
|
|
6
|
+
nativeCurrency: {
|
|
7
|
+
decimals: 18,
|
|
8
|
+
name: 'TC',
|
|
9
|
+
symbol: 'TURK',
|
|
10
|
+
},
|
|
11
|
+
rpcUrls: {
|
|
12
|
+
default: {
|
|
13
|
+
http: ['https://rpc.turkscan.com'],
|
|
14
|
+
webSocket: ['wss://evm-ws.turkscan.com'],
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
blockExplorers: {
|
|
18
|
+
default: {
|
|
19
|
+
name: 'TurkScan',
|
|
20
|
+
url: 'https://turkscan.com',
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
})
|
|
@@ -21,7 +21,7 @@ export const zksync = /*#__PURE__*/ defineChain({
|
|
|
21
21
|
blockExplorers: {
|
|
22
22
|
default: {
|
|
23
23
|
name: 'ZKsync Explorer',
|
|
24
|
-
url: 'https://explorer.zksync.io
|
|
24
|
+
url: 'https://explorer.zksync.io',
|
|
25
25
|
apiUrl: 'https://block-explorer-api.mainnet.zksync.io/api',
|
|
26
26
|
},
|
|
27
27
|
},
|
package/chains/index.ts
CHANGED
|
@@ -689,6 +689,7 @@ export { treasureTopaz } from './definitions/treasureTopaz.js'
|
|
|
689
689
|
export { tron } from './definitions/tron.js'
|
|
690
690
|
export { tronNile } from './definitions/tronNile.js'
|
|
691
691
|
export { tronShasta } from './definitions/tronShasta.js'
|
|
692
|
+
export { turkchain } from './definitions/turkchain.js'
|
|
692
693
|
export { ubiq } from './definitions/ubiq.js'
|
|
693
694
|
export { ultra } from './definitions/ultra.js'
|
|
694
695
|
export { ultraTestnet } from './definitions/ultraTestnet.js'
|
package/clients/createClient.ts
CHANGED
|
@@ -62,6 +62,12 @@ export type ClientConfig<
|
|
|
62
62
|
/**
|
|
63
63
|
* [CCIP Read](https://eips.ethereum.org/EIPS/eip-3668) configuration.
|
|
64
64
|
* If `false`, the client will not support offchain CCIP lookups.
|
|
65
|
+
*
|
|
66
|
+
* Gateway URLs must be HTTP(S). A lookup follows at most 4 nested callbacks
|
|
67
|
+
* and 4 nested local batches, and makes at most 256 gateway requests to
|
|
68
|
+
* contract-chosen URLs, 16 at a time. Each gateway request, including the
|
|
69
|
+
* response body, uses the transport timeout (default 10 seconds; the longest
|
|
70
|
+
* of a `fallback`'s transports) and reads at most 10 MiB.
|
|
65
71
|
*/
|
|
66
72
|
ccipRead?:
|
|
67
73
|
| {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { BaseError } from '../../errors/base.js'
|
|
1
2
|
import { ExecutionRevertedError } from '../../errors/node.js'
|
|
2
3
|
import {
|
|
3
4
|
TransactionRejectedRpcError,
|
|
@@ -164,6 +165,16 @@ export function fallback<const transports extends readonly Transport[]>(
|
|
|
164
165
|
|
|
165
166
|
if (shouldThrow_(err as Error)) throw err
|
|
166
167
|
|
|
168
|
+
// The node accepted the transaction but stopped waiting for its
|
|
169
|
+
// receipt (EIP-7966), so do not send it to the next one. Custom
|
|
170
|
+
// transports wrap the provider's error, so check the causes too.
|
|
171
|
+
if (
|
|
172
|
+
method === 'eth_sendRawTransactionSync' &&
|
|
173
|
+
err instanceof BaseError &&
|
|
174
|
+
err.walk((e) => (e as { code?: unknown } | null)?.code === 4)
|
|
175
|
+
)
|
|
176
|
+
throw err
|
|
177
|
+
|
|
167
178
|
// If we've reached the end of the fallbacks, throw the error.
|
|
168
179
|
if (i === transports.length - 1) throw err
|
|
169
180
|
|
package/errors/node.ts
CHANGED
|
@@ -53,7 +53,9 @@ export class FeeCapTooHighError extends BaseError {
|
|
|
53
53
|
} = {}) {
|
|
54
54
|
super(
|
|
55
55
|
`The fee cap (\`maxFeePerGas\`${
|
|
56
|
-
|
|
56
|
+
typeof maxFeePerGas === 'bigint'
|
|
57
|
+
? ` = ${formatGwei(maxFeePerGas)} gwei`
|
|
58
|
+
: ''
|
|
57
59
|
}) cannot be higher than the maximum allowed value (2^256-1).`,
|
|
58
60
|
{
|
|
59
61
|
cause,
|
|
@@ -78,8 +80,10 @@ export class FeeCapTooLowError extends BaseError {
|
|
|
78
80
|
} = {}) {
|
|
79
81
|
super(
|
|
80
82
|
`The fee cap (\`maxFeePerGas\`${
|
|
81
|
-
|
|
82
|
-
|
|
83
|
+
typeof maxFeePerGas === 'bigint'
|
|
84
|
+
? ` = ${formatGwei(maxFeePerGas)} gwei`
|
|
85
|
+
: ''
|
|
86
|
+
}) cannot be lower than the block base fee.`,
|
|
83
87
|
{
|
|
84
88
|
cause,
|
|
85
89
|
name: 'FeeCapTooLowError',
|
|
@@ -249,11 +253,13 @@ export class TipAboveFeeCapError extends BaseError {
|
|
|
249
253
|
super(
|
|
250
254
|
[
|
|
251
255
|
`The provided tip (\`maxPriorityFeePerGas\`${
|
|
252
|
-
maxPriorityFeePerGas
|
|
256
|
+
typeof maxPriorityFeePerGas === 'bigint'
|
|
253
257
|
? ` = ${formatGwei(maxPriorityFeePerGas)} gwei`
|
|
254
258
|
: ''
|
|
255
259
|
}) cannot be higher than the fee cap (\`maxFeePerGas\`${
|
|
256
|
-
|
|
260
|
+
typeof maxFeePerGas === 'bigint'
|
|
261
|
+
? ` = ${formatGwei(maxFeePerGas)} gwei`
|
|
262
|
+
: ''
|
|
257
263
|
}).`,
|
|
258
264
|
].join('\n'),
|
|
259
265
|
{
|
package/errors/typedData.ts
CHANGED
|
@@ -51,9 +51,12 @@ export type InvalidTypedDataTypeErrorType = InvalidTypedDataTypeError & {
|
|
|
51
51
|
}
|
|
52
52
|
export class InvalidTypedDataTypeError extends BaseError {
|
|
53
53
|
constructor({ type }: { type: string }) {
|
|
54
|
-
|
|
54
|
+
// Suggest the canonical type only for the `int`/`uint` aliases.
|
|
55
|
+
const isAlias = /^u?int(\[[0-9]*\])*$/.test(type)
|
|
55
56
|
super(`Type "${type}" is not a valid EIP-712 type.`, {
|
|
56
|
-
metaMessages:
|
|
57
|
+
metaMessages: isAlias
|
|
58
|
+
? [`Use "${type.replace(/^(u?int)/, '$&256')}" instead.`]
|
|
59
|
+
: undefined,
|
|
57
60
|
name: 'InvalidTypedDataTypeError',
|
|
58
61
|
})
|
|
59
62
|
}
|
package/errors/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '2.57.
|
|
1
|
+
export const version = '2.57.16'
|
package/index.ts
CHANGED
|
@@ -1350,6 +1350,8 @@ export {
|
|
|
1350
1350
|
decodeErrorResult,
|
|
1351
1351
|
} from './utils/abi/decodeErrorResult.js'
|
|
1352
1352
|
export {
|
|
1353
|
+
AbiEventAmbiguityError,
|
|
1354
|
+
type AbiEventAmbiguityErrorType,
|
|
1353
1355
|
type DecodeEventLogErrorType,
|
|
1354
1356
|
type DecodeEventLogParameters,
|
|
1355
1357
|
type DecodeEventLogReturnType,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "viem",
|
|
3
3
|
"description": "TypeScript Interface for Ethereum",
|
|
4
|
-
"version": "2.57.
|
|
4
|
+
"version": "2.57.16",
|
|
5
5
|
"main": "./_cjs/index.js",
|
|
6
6
|
"module": "./_esm/index.js",
|
|
7
7
|
"types": "./_types/index.d.ts",
|
|
@@ -215,9 +215,13 @@
|
|
|
215
215
|
}
|
|
216
216
|
},
|
|
217
217
|
"peerDependencies": {
|
|
218
|
+
"mppx": ">=0.17.0",
|
|
218
219
|
"typescript": ">=5.0.4"
|
|
219
220
|
},
|
|
220
221
|
"peerDependenciesMeta": {
|
|
222
|
+
"mppx": {
|
|
223
|
+
"optional": true
|
|
224
|
+
},
|
|
221
225
|
"typescript": {
|
|
222
226
|
"optional": true
|
|
223
227
|
}
|
package/tempo/Account.ts
CHANGED
|
@@ -17,6 +17,7 @@ import type {
|
|
|
17
17
|
Account as viem_Account,
|
|
18
18
|
} from '../accounts/types.js'
|
|
19
19
|
import { parseAccount } from '../accounts/utils/parseAccount.js'
|
|
20
|
+
import { BaseError } from '../errors/base.js'
|
|
20
21
|
import type { TransactionSerializable } from '../types/transaction.js'
|
|
21
22
|
import type { OneOf, RequiredBy } from '../types/utils.js'
|
|
22
23
|
import { hashAuthorization } from '../utils/authorization/hashAuthorization.js'
|
|
@@ -93,6 +94,73 @@ export type AccessKeyAccount = Account_base<'accessKey'> & {
|
|
|
93
94
|
|
|
94
95
|
export type Account = OneOf<RootAccount | AccessKeyAccount>
|
|
95
96
|
|
|
97
|
+
/**
|
|
98
|
+
* Rebuilds a configurable account (TIP-1107) from the value of {@link serialize},
|
|
99
|
+
* such as one read from storage, without a request.
|
|
100
|
+
*
|
|
101
|
+
* Passkeys among `credentials` sign as owners when their public key derives an
|
|
102
|
+
* owner's address; others are ignored. A version-zero config must derive
|
|
103
|
+
* `address`, and a later version keeps `address`.
|
|
104
|
+
*
|
|
105
|
+
* @example
|
|
106
|
+
* ```ts
|
|
107
|
+
* import { Account } from 'viem/tempo'
|
|
108
|
+
*
|
|
109
|
+
* const account = Account.deserialize(JSON.parse(localStorage.getItem('account')!), {
|
|
110
|
+
* credentials: [credential],
|
|
111
|
+
* })
|
|
112
|
+
* ```
|
|
113
|
+
*
|
|
114
|
+
* @param value Serialized account.
|
|
115
|
+
* @param options Options.
|
|
116
|
+
* @returns Configurable account.
|
|
117
|
+
*/
|
|
118
|
+
export function deserialize(
|
|
119
|
+
value: Serialized,
|
|
120
|
+
options: deserialize.Options = {},
|
|
121
|
+
): ConfigurableAccount {
|
|
122
|
+
const { address, config } = value
|
|
123
|
+
const { credentials = [], getFn } = options
|
|
124
|
+
if (!config) return fromConfig(address)
|
|
125
|
+
|
|
126
|
+
const owners = config.owners.map(({ owner, weight }) => {
|
|
127
|
+
const credential = credentials.find((credential) =>
|
|
128
|
+
Address.isEqual(
|
|
129
|
+
Address.fromPublicKey(PublicKey.fromHex(credential.publicKey)),
|
|
130
|
+
owner,
|
|
131
|
+
),
|
|
132
|
+
)
|
|
133
|
+
if (!credential) return { owner, weight }
|
|
134
|
+
const { rpId } = credential
|
|
135
|
+
return { owner: fromWebAuthnP256(credential, { getFn, rpId }), weight }
|
|
136
|
+
})
|
|
137
|
+
const { salt, threshold } = config
|
|
138
|
+
const version = BigInt(config.version)
|
|
139
|
+
const account =
|
|
140
|
+
version === 0n
|
|
141
|
+
? fromConfig({ owners, salt, threshold })
|
|
142
|
+
: fromConfig({ address, owners, salt, threshold, version })
|
|
143
|
+
if (!Address.isEqual(account.address, address))
|
|
144
|
+
throw new AddressMismatchError({ address, derived: account.address })
|
|
145
|
+
return account
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
export declare namespace deserialize {
|
|
149
|
+
export type Credential = fromWebAuthnP256.Credential & {
|
|
150
|
+
/** Relying party ID of the passkey, such as `example.com`. */
|
|
151
|
+
rpId?: string | undefined
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
export type Options = {
|
|
155
|
+
/** Passkeys that may hold owner keys of the account. */
|
|
156
|
+
credentials?: readonly Credential[] | undefined
|
|
157
|
+
/** Runs a passkey owner's ceremony in place of `navigator.credentials.get`. */
|
|
158
|
+
getFn?: fromWebAuthnP256.Options['getFn'] | undefined
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
export type ErrorType = AddressMismatchError | Error
|
|
162
|
+
}
|
|
163
|
+
|
|
96
164
|
/** Instantiates an Account. */
|
|
97
165
|
export function from<const parameters extends from.Parameters>(
|
|
98
166
|
parameters: parameters | from.Parameters,
|
|
@@ -137,13 +205,19 @@ export function fromHeadlessWebAuthn<
|
|
|
137
205
|
privateKey: Hex.Hex,
|
|
138
206
|
options: options | fromHeadlessWebAuthn.Options,
|
|
139
207
|
): fromHeadlessWebAuthn.ReturnValue<options> {
|
|
140
|
-
const {
|
|
141
|
-
|
|
208
|
+
const {
|
|
209
|
+
access,
|
|
210
|
+
keyAuthorization,
|
|
211
|
+
keyAuthorizationManager,
|
|
212
|
+
rpId,
|
|
213
|
+
origin,
|
|
214
|
+
internal_version,
|
|
215
|
+
} = options
|
|
142
216
|
|
|
143
217
|
const publicKey = P256.getPublicKey({ privateKey })
|
|
144
218
|
|
|
145
219
|
return from({
|
|
146
|
-
...(access ? { access, keyAuthorizationManager } : {}),
|
|
220
|
+
...(access ? { access, keyAuthorization, keyAuthorizationManager } : {}),
|
|
147
221
|
internal_version,
|
|
148
222
|
keyType: 'webAuthn',
|
|
149
223
|
publicKey,
|
|
@@ -176,7 +250,10 @@ export declare namespace fromHeadlessWebAuthn {
|
|
|
176
250
|
> &
|
|
177
251
|
Pick<
|
|
178
252
|
from.Parameters,
|
|
179
|
-
|
|
253
|
+
| 'access'
|
|
254
|
+
| 'internal_version'
|
|
255
|
+
| 'keyAuthorization'
|
|
256
|
+
| 'keyAuthorizationManager'
|
|
180
257
|
> & {
|
|
181
258
|
rpId: string
|
|
182
259
|
origin: string
|
|
@@ -203,11 +280,16 @@ export function fromP256<const options extends fromP256.Options>(
|
|
|
203
280
|
privateKey: Hex.Hex,
|
|
204
281
|
options: options | fromP256.Options = {},
|
|
205
282
|
): fromP256.ReturnValue<options> {
|
|
206
|
-
const {
|
|
283
|
+
const {
|
|
284
|
+
access,
|
|
285
|
+
keyAuthorization,
|
|
286
|
+
keyAuthorizationManager,
|
|
287
|
+
internal_version,
|
|
288
|
+
} = options
|
|
207
289
|
const publicKey = P256.getPublicKey({ privateKey })
|
|
208
290
|
|
|
209
291
|
return from({
|
|
210
|
-
...(access ? { access, keyAuthorizationManager } : {}),
|
|
292
|
+
...(access ? { access, keyAuthorization, keyAuthorizationManager } : {}),
|
|
211
293
|
internal_version,
|
|
212
294
|
keyType: 'p256',
|
|
213
295
|
publicKey,
|
|
@@ -225,7 +307,10 @@ export function fromP256<const options extends fromP256.Options>(
|
|
|
225
307
|
export declare namespace fromP256 {
|
|
226
308
|
export type Options = Pick<
|
|
227
309
|
from.Parameters,
|
|
228
|
-
|
|
310
|
+
| 'access'
|
|
311
|
+
| 'internal_version'
|
|
312
|
+
| 'keyAuthorization'
|
|
313
|
+
| 'keyAuthorizationManager'
|
|
229
314
|
>
|
|
230
315
|
|
|
231
316
|
export type ReturnValue<options extends Options = Options> =
|
|
@@ -249,11 +334,16 @@ export function fromSecp256k1<const options extends fromSecp256k1.Options>(
|
|
|
249
334
|
privateKey: Hex.Hex,
|
|
250
335
|
options: options | fromSecp256k1.Options = {},
|
|
251
336
|
): fromSecp256k1.ReturnValue<options> {
|
|
252
|
-
const {
|
|
337
|
+
const {
|
|
338
|
+
access,
|
|
339
|
+
keyAuthorization,
|
|
340
|
+
keyAuthorizationManager,
|
|
341
|
+
internal_version,
|
|
342
|
+
} = options
|
|
253
343
|
const publicKey = Secp256k1.getPublicKey({ privateKey })
|
|
254
344
|
|
|
255
345
|
return from({
|
|
256
|
-
...(access ? { access, keyAuthorizationManager } : {}),
|
|
346
|
+
...(access ? { access, keyAuthorization, keyAuthorizationManager } : {}),
|
|
257
347
|
internal_version,
|
|
258
348
|
keyType: 'secp256k1',
|
|
259
349
|
publicKey,
|
|
@@ -268,7 +358,10 @@ export function fromSecp256k1<const options extends fromSecp256k1.Options>(
|
|
|
268
358
|
export declare namespace fromSecp256k1 {
|
|
269
359
|
export type Options = Pick<
|
|
270
360
|
from.Parameters,
|
|
271
|
-
|
|
361
|
+
| 'access'
|
|
362
|
+
| 'internal_version'
|
|
363
|
+
| 'keyAuthorization'
|
|
364
|
+
| 'keyAuthorizationManager'
|
|
272
365
|
>
|
|
273
366
|
|
|
274
367
|
export type ReturnValue<options extends Options = Options> =
|
|
@@ -745,11 +838,16 @@ export function fromWebCryptoP256<
|
|
|
745
838
|
keyPair: Awaited<ReturnType<typeof WebCryptoP256.createKeyPair>>,
|
|
746
839
|
options: options | fromWebCryptoP256.Options = {},
|
|
747
840
|
): fromWebCryptoP256.ReturnValue<options> {
|
|
748
|
-
const {
|
|
841
|
+
const {
|
|
842
|
+
access,
|
|
843
|
+
keyAuthorization,
|
|
844
|
+
keyAuthorizationManager,
|
|
845
|
+
internal_version,
|
|
846
|
+
} = options
|
|
749
847
|
const { publicKey, privateKey } = keyPair
|
|
750
848
|
|
|
751
849
|
return from({
|
|
752
|
-
...(access ? { access, keyAuthorizationManager } : {}),
|
|
850
|
+
...(access ? { access, keyAuthorization, keyAuthorizationManager } : {}),
|
|
753
851
|
internal_version,
|
|
754
852
|
keyType: 'p256',
|
|
755
853
|
publicKey,
|
|
@@ -768,7 +866,10 @@ export function fromWebCryptoP256<
|
|
|
768
866
|
export declare namespace fromWebCryptoP256 {
|
|
769
867
|
export type Options = Pick<
|
|
770
868
|
from.Parameters,
|
|
771
|
-
|
|
869
|
+
| 'access'
|
|
870
|
+
| 'internal_version'
|
|
871
|
+
| 'keyAuthorization'
|
|
872
|
+
| 'keyAuthorizationManager'
|
|
772
873
|
>
|
|
773
874
|
|
|
774
875
|
export type ReturnValue<options extends Options = Options> =
|
|
@@ -1114,17 +1215,52 @@ declare namespace fromRoot {
|
|
|
1114
1215
|
|
|
1115
1216
|
// biome-ignore lint/correctness/noUnusedVariables: _
|
|
1116
1217
|
function fromAccessKey(parameters: fromAccessKey.Parameters): AccessKeyAccount {
|
|
1117
|
-
const { access,
|
|
1218
|
+
const { access, keyAuthorization } = parameters
|
|
1118
1219
|
const { address: parentAddress } = parseAccount(access)
|
|
1119
|
-
const
|
|
1220
|
+
const accessKeyAddress = Address.fromPublicKey(parameters.publicKey)
|
|
1221
|
+
if (
|
|
1222
|
+
keyAuthorization &&
|
|
1223
|
+
!Address.isEqual(keyAuthorization.address, accessKeyAddress)
|
|
1224
|
+
)
|
|
1225
|
+
throw new Error('Key authorization does not authorize this access key.')
|
|
1226
|
+
const keyAuthorizationManager =
|
|
1227
|
+
parameters.keyAuthorizationManager ??
|
|
1228
|
+
(keyAuthorization ? pending(keyAuthorization) : undefined)
|
|
1229
|
+
const account = fromBase({
|
|
1230
|
+
...parameters,
|
|
1231
|
+
keyAuthorizationManager,
|
|
1232
|
+
parentAddress,
|
|
1233
|
+
})
|
|
1120
1234
|
return {
|
|
1121
1235
|
...account,
|
|
1122
|
-
accessKeyAddress
|
|
1236
|
+
accessKeyAddress,
|
|
1123
1237
|
keyAuthorizationManager,
|
|
1124
1238
|
source: 'accessKey',
|
|
1125
1239
|
}
|
|
1126
1240
|
}
|
|
1127
1241
|
|
|
1242
|
+
/**
|
|
1243
|
+
* Returns a key authorization manager that holds `keyAuthorization` until the
|
|
1244
|
+
* chain registers its access key.
|
|
1245
|
+
*/
|
|
1246
|
+
function pending(
|
|
1247
|
+
keyAuthorization: KeyAuthorization.Signed,
|
|
1248
|
+
): KeyAuthorizationManager {
|
|
1249
|
+
let value: KeyAuthorization.Signed | undefined = keyAuthorization
|
|
1250
|
+
const matches = (key: { accessKey: Address.Address; chainId: number }) =>
|
|
1251
|
+
Address.isEqual(key.accessKey, keyAuthorization.address) &&
|
|
1252
|
+
BigInt(key.chainId) === BigInt(keyAuthorization.chainId)
|
|
1253
|
+
return {
|
|
1254
|
+
get: (key) => (matches(key) ? value : undefined),
|
|
1255
|
+
remove(key) {
|
|
1256
|
+
if (matches(key)) value = undefined
|
|
1257
|
+
},
|
|
1258
|
+
set(key, next) {
|
|
1259
|
+
if (matches(key)) value = next
|
|
1260
|
+
},
|
|
1261
|
+
}
|
|
1262
|
+
}
|
|
1263
|
+
|
|
1128
1264
|
declare namespace fromAccessKey {
|
|
1129
1265
|
export type Parameters = fromBase.Parameters & {
|
|
1130
1266
|
/**
|
|
@@ -1133,6 +1269,12 @@ declare namespace fromAccessKey {
|
|
|
1133
1269
|
* the parent account's address as the keychain address.
|
|
1134
1270
|
*/
|
|
1135
1271
|
access: viem_Account | Address.Address
|
|
1272
|
+
/**
|
|
1273
|
+
* Signed key authorization of the access key, which the account attaches
|
|
1274
|
+
* to its transactions until the chain registers the access key. Ignored
|
|
1275
|
+
* when `keyAuthorizationManager` is set.
|
|
1276
|
+
*/
|
|
1277
|
+
keyAuthorization?: KeyAuthorization.Signed | undefined
|
|
1136
1278
|
/** Pending key authorization manager. */
|
|
1137
1279
|
keyAuthorizationManager?: KeyAuthorizationManager | undefined
|
|
1138
1280
|
}
|
|
@@ -1190,6 +1332,50 @@ export declare namespace resolveAccessKey {
|
|
|
1190
1332
|
}
|
|
1191
1333
|
}
|
|
1192
1334
|
|
|
1335
|
+
/**
|
|
1336
|
+
* Returns a configurable account (TIP-1107) as JSON-safe public values: its
|
|
1337
|
+
* address and, when known, its config. {@link deserialize} rebuilds it.
|
|
1338
|
+
*
|
|
1339
|
+
* @example
|
|
1340
|
+
* ```ts
|
|
1341
|
+
* import { Account } from 'viem/tempo'
|
|
1342
|
+
*
|
|
1343
|
+
* localStorage.setItem('account', JSON.stringify(Account.serialize(account)))
|
|
1344
|
+
* ```
|
|
1345
|
+
*
|
|
1346
|
+
* @param account Configurable account.
|
|
1347
|
+
* @returns Serialized account.
|
|
1348
|
+
*/
|
|
1349
|
+
export function serialize(account: ConfigurableAccount): Serialized {
|
|
1350
|
+
const { address, config } = account
|
|
1351
|
+
return {
|
|
1352
|
+
address,
|
|
1353
|
+
...(config ? { config: AccountConfig.toRpc(config) } : {}),
|
|
1354
|
+
}
|
|
1355
|
+
}
|
|
1356
|
+
|
|
1357
|
+
/** Configurable account as JSON, which {@link serialize} returns and {@link deserialize} rebuilds. */
|
|
1358
|
+
export type Serialized = {
|
|
1359
|
+
/** Account address. */
|
|
1360
|
+
address: Address.Address
|
|
1361
|
+
/** Current config, in RPC format. Absent for an address-only account. */
|
|
1362
|
+
config?: AccountConfig.Rpc | undefined
|
|
1363
|
+
}
|
|
1364
|
+
|
|
1365
|
+
/** Thrown when a version-zero config does not derive the account's address. */
|
|
1366
|
+
export class AddressMismatchError extends BaseError {
|
|
1367
|
+
/** Address the config derives. */
|
|
1368
|
+
readonly derived: Address.Address
|
|
1369
|
+
|
|
1370
|
+
constructor(options: { address: Address.Address; derived: Address.Address }) {
|
|
1371
|
+
const { address, derived } = options
|
|
1372
|
+
super(`Account config derives ${derived}, not ${address}.`, {
|
|
1373
|
+
name: 'Account.AddressMismatchError',
|
|
1374
|
+
})
|
|
1375
|
+
this.derived = derived
|
|
1376
|
+
}
|
|
1377
|
+
}
|
|
1378
|
+
|
|
1193
1379
|
// Export types required for inference.
|
|
1194
1380
|
// biome-ignore lint/performance/noBarrelFile: _
|
|
1195
1381
|
export {
|