viem 2.56.1 → 2.56.3
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 +18 -0
- package/_cjs/actions/wallet/sendTransaction.js +9 -1
- package/_cjs/actions/wallet/sendTransaction.js.map +1 -1
- package/_cjs/actions/wallet/sendTransactionSync.js +9 -1
- package/_cjs/actions/wallet/sendTransactionSync.js.map +1 -1
- package/_cjs/errors/version.js +1 -1
- package/_cjs/tempo/Abis.js +11 -23
- package/_cjs/tempo/Abis.js.map +1 -1
- package/_cjs/tempo/Account.js +66 -61
- package/_cjs/tempo/Account.js.map +1 -1
- package/_cjs/tempo/Client.js +10 -2
- package/_cjs/tempo/Client.js.map +1 -1
- package/_cjs/tempo/Decorator.js +2 -1
- package/_cjs/tempo/Decorator.js.map +1 -1
- package/_cjs/tempo/Formatters.js +29 -9
- package/_cjs/tempo/Formatters.js.map +1 -1
- package/_cjs/tempo/Multisig.js +1093 -0
- package/_cjs/tempo/Multisig.js.map +1 -0
- package/_cjs/tempo/Selectors.js +2 -3
- package/_cjs/tempo/Selectors.js.map +1 -1
- package/_cjs/tempo/{Storage.js → Store.js} +34 -9
- package/_cjs/tempo/Store.js.map +1 -0
- package/_cjs/tempo/Transaction.js +15 -30
- package/_cjs/tempo/Transaction.js.map +1 -1
- package/_cjs/tempo/Transport.js +51 -5
- package/_cjs/tempo/Transport.js.map +1 -1
- package/_cjs/tempo/Zone.js.map +1 -1
- package/_cjs/tempo/actions/accessKey.js +102 -8
- package/_cjs/tempo/actions/accessKey.js.map +1 -1
- package/_cjs/tempo/actions/amm.js +6 -0
- package/_cjs/tempo/actions/amm.js.map +1 -1
- package/_cjs/tempo/actions/channel.js +12 -0
- package/_cjs/tempo/actions/channel.js.map +1 -1
- package/_cjs/tempo/actions/dex.js +10 -0
- package/_cjs/tempo/actions/dex.js.map +1 -1
- package/_cjs/tempo/actions/earn/deployment.js +13 -1
- package/_cjs/tempo/actions/earn/deployment.js.map +1 -1
- package/_cjs/tempo/actions/earn.js +17 -0
- package/_cjs/tempo/actions/earn.js.map +1 -1
- package/_cjs/tempo/actions/fee.js +4 -0
- package/_cjs/tempo/actions/fee.js.map +1 -1
- package/_cjs/tempo/actions/multisig.js +86 -28
- package/_cjs/tempo/actions/multisig.js.map +1 -1
- package/_cjs/tempo/actions/policy.js +8 -0
- package/_cjs/tempo/actions/policy.js.map +1 -1
- package/_cjs/tempo/actions/receivePolicy.js +6 -0
- package/_cjs/tempo/actions/receivePolicy.js.map +1 -1
- package/_cjs/tempo/actions/reward.js +4 -0
- package/_cjs/tempo/actions/reward.js.map +1 -1
- package/_cjs/tempo/actions/token.js +32 -0
- package/_cjs/tempo/actions/token.js.map +1 -1
- package/_cjs/tempo/actions/virtualAddress.js +2 -0
- package/_cjs/tempo/actions/virtualAddress.js.map +1 -1
- package/_cjs/tempo/actions/zone.js +7 -5
- package/_cjs/tempo/actions/zone.js.map +1 -1
- package/_cjs/tempo/chainConfig.js +180 -69
- package/_cjs/tempo/chainConfig.js.map +1 -1
- package/_cjs/tempo/index.js +5 -2
- package/_cjs/tempo/index.js.map +1 -1
- package/_cjs/tempo/internal/utils.js +2 -1
- package/_cjs/tempo/internal/utils.js.map +1 -1
- package/_cjs/tempo/multisig/Config.js +80 -0
- package/_cjs/tempo/multisig/Config.js.map +1 -0
- package/_cjs/tempo/multisig/Operation.js +163 -0
- package/_cjs/tempo/multisig/Operation.js.map +1 -0
- package/_cjs/utils/encoding/fromHex.js +1 -1
- package/_cjs/utils/encoding/fromHex.js.map +1 -1
- package/_cjs/utils/hash/isHash.js +1 -2
- package/_cjs/utils/hash/isHash.js.map +1 -1
- package/_esm/actions/wallet/sendTransaction.js +9 -1
- package/_esm/actions/wallet/sendTransaction.js.map +1 -1
- package/_esm/actions/wallet/sendTransactionSync.js +9 -1
- package/_esm/actions/wallet/sendTransactionSync.js.map +1 -1
- package/_esm/errors/version.js +1 -1
- package/_esm/tempo/Abis.js +11 -23
- package/_esm/tempo/Abis.js.map +1 -1
- package/_esm/tempo/Account.js +66 -61
- package/_esm/tempo/Account.js.map +1 -1
- package/_esm/tempo/Client.js +22 -3
- package/_esm/tempo/Client.js.map +1 -1
- package/_esm/tempo/Decorator.js +2 -1
- package/_esm/tempo/Decorator.js.map +1 -1
- package/_esm/tempo/Formatters.js +32 -11
- package/_esm/tempo/Formatters.js.map +1 -1
- package/_esm/tempo/Multisig.js +1126 -0
- package/_esm/tempo/Multisig.js.map +1 -0
- package/_esm/tempo/Selectors.js +2 -3
- package/_esm/tempo/Selectors.js.map +1 -1
- package/_esm/tempo/{Storage.js → Store.js} +37 -26
- package/_esm/tempo/Store.js.map +1 -0
- package/_esm/tempo/Transaction.js +16 -31
- package/_esm/tempo/Transaction.js.map +1 -1
- package/_esm/tempo/Transport.js +71 -6
- package/_esm/tempo/Transport.js.map +1 -1
- package/_esm/tempo/Zone.js +1 -2
- package/_esm/tempo/Zone.js.map +1 -1
- package/_esm/tempo/actions/accessKey.js +104 -20
- package/_esm/tempo/actions/accessKey.js.map +1 -1
- package/_esm/tempo/actions/amm.js +6 -0
- package/_esm/tempo/actions/amm.js.map +1 -1
- package/_esm/tempo/actions/channel.js +12 -0
- package/_esm/tempo/actions/channel.js.map +1 -1
- package/_esm/tempo/actions/dex.js +10 -0
- package/_esm/tempo/actions/dex.js.map +1 -1
- package/_esm/tempo/actions/earn/deployment.js +13 -1
- package/_esm/tempo/actions/earn/deployment.js.map +1 -1
- package/_esm/tempo/actions/earn.js +17 -0
- package/_esm/tempo/actions/earn.js.map +1 -1
- package/_esm/tempo/actions/fee.js +4 -0
- package/_esm/tempo/actions/fee.js.map +1 -1
- package/_esm/tempo/actions/multisig.js +129 -63
- package/_esm/tempo/actions/multisig.js.map +1 -1
- package/_esm/tempo/actions/policy.js +8 -0
- package/_esm/tempo/actions/policy.js.map +1 -1
- package/_esm/tempo/actions/receivePolicy.js +6 -0
- package/_esm/tempo/actions/receivePolicy.js.map +1 -1
- package/_esm/tempo/actions/reward.js +4 -0
- package/_esm/tempo/actions/reward.js.map +1 -1
- package/_esm/tempo/actions/token.js +32 -0
- package/_esm/tempo/actions/token.js.map +1 -1
- package/_esm/tempo/actions/virtualAddress.js +2 -0
- package/_esm/tempo/actions/virtualAddress.js.map +1 -1
- package/_esm/tempo/actions/zone.js +8 -6
- package/_esm/tempo/actions/zone.js.map +1 -1
- package/_esm/tempo/chainConfig.js +188 -86
- package/_esm/tempo/chainConfig.js.map +1 -1
- package/_esm/tempo/index.js +5 -3
- package/_esm/tempo/index.js.map +1 -1
- package/_esm/tempo/internal/utils.js +2 -1
- package/_esm/tempo/internal/utils.js.map +1 -1
- package/_esm/tempo/multisig/Config.js +84 -0
- package/_esm/tempo/multisig/Config.js.map +1 -0
- package/_esm/tempo/multisig/Operation.js +170 -0
- package/_esm/tempo/multisig/Operation.js.map +1 -0
- package/_esm/utils/encoding/fromHex.js +1 -1
- package/_esm/utils/encoding/fromHex.js.map +1 -1
- package/_esm/utils/hash/isHash.js +1 -2
- package/_esm/utils/hash/isHash.js.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/tempo.d.ts +72 -92
- package/_types/chains/definitions/tempo.d.ts.map +1 -1
- package/_types/chains/definitions/tempoDevnet.d.ts +72 -92
- package/_types/chains/definitions/tempoDevnet.d.ts.map +1 -1
- package/_types/chains/definitions/tempoLocalnet.d.ts +72 -92
- package/_types/chains/definitions/tempoLocalnet.d.ts.map +1 -1
- package/_types/chains/definitions/tempoModerato.d.ts +72 -92
- package/_types/chains/definitions/tempoModerato.d.ts.map +1 -1
- package/_types/errors/version.d.ts +1 -1
- package/_types/tempo/Abis.d.ts +54 -108
- package/_types/tempo/Abis.d.ts.map +1 -1
- package/_types/tempo/Account.d.ts +47 -20
- package/_types/tempo/Account.d.ts.map +1 -1
- package/_types/tempo/Client.d.ts +23 -1
- package/_types/tempo/Client.d.ts.map +1 -1
- package/_types/tempo/Decorator.d.ts +30 -5
- package/_types/tempo/Decorator.d.ts.map +1 -1
- package/_types/tempo/Formatters.d.ts.map +1 -1
- package/_types/tempo/Multisig.d.ts +37 -0
- package/_types/tempo/Multisig.d.ts.map +1 -0
- package/_types/tempo/Selectors.d.ts +2 -3
- package/_types/tempo/Selectors.d.ts.map +1 -1
- package/_types/tempo/Store.d.ts +62 -0
- package/_types/tempo/Store.d.ts.map +1 -0
- package/_types/tempo/Transaction.d.ts +12 -31
- package/_types/tempo/Transaction.d.ts.map +1 -1
- package/_types/tempo/Transport.d.ts +37 -5
- package/_types/tempo/Transport.d.ts.map +1 -1
- package/_types/tempo/Zone.d.ts +35 -6799
- package/_types/tempo/Zone.d.ts.map +1 -1
- package/_types/tempo/actions/accessKey.d.ts +38 -8
- package/_types/tempo/actions/accessKey.d.ts.map +1 -1
- package/_types/tempo/actions/amm.d.ts.map +1 -1
- package/_types/tempo/actions/channel.d.ts.map +1 -1
- package/_types/tempo/actions/dex.d.ts.map +1 -1
- package/_types/tempo/actions/earn/deployment.d.ts +3 -3
- package/_types/tempo/actions/earn/deployment.d.ts.map +1 -1
- package/_types/tempo/actions/earn.d.ts.map +1 -1
- package/_types/tempo/actions/fee.d.ts.map +1 -1
- package/_types/tempo/actions/multisig.d.ts +139 -136
- package/_types/tempo/actions/multisig.d.ts.map +1 -1
- package/_types/tempo/actions/policy.d.ts.map +1 -1
- package/_types/tempo/actions/receivePolicy.d.ts.map +1 -1
- package/_types/tempo/actions/reward.d.ts.map +1 -1
- package/_types/tempo/actions/token.d.ts.map +1 -1
- package/_types/tempo/actions/virtualAddress.d.ts.map +1 -1
- package/_types/tempo/actions/zone.d.ts +4 -4
- package/_types/tempo/actions/zone.d.ts.map +1 -1
- package/_types/tempo/chainConfig.d.ts +38 -48
- package/_types/tempo/chainConfig.d.ts.map +1 -1
- package/_types/tempo/index.d.ts +5 -5
- package/_types/tempo/index.d.ts.map +1 -1
- package/_types/tempo/internal/types.d.ts +1 -1
- package/_types/tempo/internal/types.d.ts.map +1 -1
- package/_types/tempo/internal/utils.d.ts +1 -0
- package/_types/tempo/internal/utils.d.ts.map +1 -1
- package/_types/tempo/multisig/Config.d.ts +42 -0
- package/_types/tempo/multisig/Config.d.ts.map +1 -0
- package/_types/tempo/multisig/Operation.d.ts +32 -0
- package/_types/tempo/multisig/Operation.d.ts.map +1 -0
- package/_types/types/chain.d.ts +10 -0
- package/_types/types/chain.d.ts.map +1 -1
- package/_types/utils/hash/isHash.d.ts +1 -2
- package/_types/utils/hash/isHash.d.ts.map +1 -1
- package/actions/wallet/sendTransaction.ts +9 -1
- package/actions/wallet/sendTransactionSync.ts +9 -1
- package/errors/version.ts +1 -1
- package/package.json +2 -2
- package/tempo/Abis.ts +11 -23
- package/tempo/Account.ts +136 -105
- package/tempo/Client.ts +46 -3
- package/tempo/Decorator.ts +40 -8
- package/tempo/Formatters.ts +39 -21
- package/tempo/Multisig.ts +1490 -0
- package/tempo/Selectors.ts +2 -3
- package/tempo/Store.ts +170 -0
- package/tempo/Transaction.ts +39 -64
- package/tempo/Transport.ts +125 -10
- package/tempo/Zone.ts +30 -4
- package/tempo/actions/accessKey.ts +210 -23
- package/tempo/actions/amm.ts +7 -0
- package/tempo/actions/channel.ts +12 -0
- package/tempo/actions/dex.ts +10 -0
- package/tempo/actions/earn/deployment.ts +16 -3
- package/tempo/actions/earn.ts +19 -0
- package/tempo/actions/fee.ts +4 -0
- package/tempo/actions/multisig.ts +192 -94
- package/tempo/actions/policy.ts +8 -0
- package/tempo/actions/receivePolicy.ts +6 -0
- package/tempo/actions/reward.ts +5 -0
- package/tempo/actions/token.ts +33 -0
- package/tempo/actions/virtualAddress.ts +2 -0
- package/tempo/actions/zone.ts +10 -8
- package/tempo/chainConfig.ts +259 -100
- package/tempo/index.ts +5 -4
- package/tempo/internal/types.ts +3 -2
- package/tempo/internal/utils.ts +2 -0
- package/tempo/multisig/Config.ts +131 -0
- package/tempo/multisig/Operation.ts +211 -0
- package/types/chain.ts +14 -0
- package/utils/encoding/fromHex.ts +1 -1
- package/utils/hash/isHash.ts +2 -3
- package/_cjs/tempo/Storage.js.map +0 -1
- package/_cjs/tempo/internal/multisig.js +0 -56
- package/_cjs/tempo/internal/multisig.js.map +0 -1
- package/_esm/tempo/Storage.js.map +0 -1
- package/_esm/tempo/internal/multisig.js +0 -56
- package/_esm/tempo/internal/multisig.js.map +0 -1
- package/_types/tempo/Storage.d.ts +0 -42
- package/_types/tempo/Storage.d.ts.map +0 -1
- package/_types/tempo/internal/multisig.d.ts +0 -13
- package/_types/tempo/internal/multisig.d.ts.map +0 -1
- package/tempo/Storage.ts +0 -115
- package/tempo/internal/multisig.ts +0 -72
package/tempo/Formatters.ts
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import type { Address } from 'abitype'
|
|
4
4
|
import * as Hex from 'ox/Hex'
|
|
5
5
|
import {
|
|
6
|
+
MultisigOperation,
|
|
6
7
|
Transaction as ox_Transaction,
|
|
7
8
|
TransactionRequest as ox_TransactionRequest,
|
|
8
9
|
} from 'ox/tempo'
|
|
@@ -11,7 +12,7 @@ import { parseAccount } from '../accounts/utils/parseAccount.js'
|
|
|
11
12
|
import { formatTransaction as viem_formatTransaction } from '../utils/formatters/transaction.js'
|
|
12
13
|
import { formatTransactionReceipt as viem_formatTransactionReceipt } from '../utils/formatters/transactionReceipt.js'
|
|
13
14
|
import { formatTransactionRequest as viem_formatTransactionRequest } from '../utils/formatters/transactionRequest.js'
|
|
14
|
-
import type { Account } from './Account.js'
|
|
15
|
+
import type { Account, MultisigAccount } from './Account.js'
|
|
15
16
|
import {
|
|
16
17
|
isTempo,
|
|
17
18
|
type Transaction,
|
|
@@ -32,6 +33,7 @@ export function formatTransaction(
|
|
|
32
33
|
transaction.blockTimestamp == null
|
|
33
34
|
? undefined
|
|
34
35
|
: BigInt(transaction.blockTimestamp)
|
|
36
|
+
const multisig = transaction.multisig
|
|
35
37
|
const {
|
|
36
38
|
feePayerSignature,
|
|
37
39
|
gasPrice: _,
|
|
@@ -51,6 +53,7 @@ export function formatTransaction(
|
|
|
51
53
|
yParity: feePayerSignature.yParity,
|
|
52
54
|
}
|
|
53
55
|
: undefined,
|
|
56
|
+
multisig: formatMultisig(multisig),
|
|
54
57
|
nonce: Number(nonce),
|
|
55
58
|
typeHex:
|
|
56
59
|
ox_Transaction.toRpcType[
|
|
@@ -63,7 +66,23 @@ export function formatTransaction(
|
|
|
63
66
|
export function formatTransactionReceipt(
|
|
64
67
|
receipt: TransactionReceiptRpc,
|
|
65
68
|
): TransactionReceipt {
|
|
66
|
-
|
|
69
|
+
const transactionReceipt = viem_formatTransactionReceipt(receipt as never)
|
|
70
|
+
return {
|
|
71
|
+
...transactionReceipt,
|
|
72
|
+
multisig: formatMultisig(receipt.multisig),
|
|
73
|
+
...(receipt.status === 'pending'
|
|
74
|
+
? { status: 'pending', type: 'tempo' }
|
|
75
|
+
: {}),
|
|
76
|
+
} as never
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/** Formats a transaction operation attached to an RPC result. */
|
|
80
|
+
function formatMultisig(value: MultisigOperation.TransactionRpc | undefined) {
|
|
81
|
+
if (!value) return undefined
|
|
82
|
+
const operation = MultisigOperation.fromRpc(value)
|
|
83
|
+
if (operation.type !== 'transaction')
|
|
84
|
+
throw new Error('Expected a multisig transaction operation.')
|
|
85
|
+
return operation
|
|
67
86
|
}
|
|
68
87
|
|
|
69
88
|
export function formatTransactionRequest(
|
|
@@ -79,12 +98,22 @@ export function formatTransactionRequest(
|
|
|
79
98
|
keyData?: Hex.Hex | undefined
|
|
80
99
|
keyId?: Address | undefined
|
|
81
100
|
keyType?: 'p256' | 'secp256k1' | 'webAuthn' | undefined
|
|
82
|
-
|
|
101
|
+
owner?: viem_Account | MultisigAccount | Address | undefined
|
|
83
102
|
signatures?: unknown
|
|
84
103
|
}
|
|
85
104
|
const account = request.account
|
|
86
105
|
? parseAccount<Account | viem_Account | Address>(request.account)
|
|
87
106
|
: undefined
|
|
107
|
+
const owner = request.owner
|
|
108
|
+
? parseAccount<Account | MultisigAccount | viem_Account | Address>(
|
|
109
|
+
request.owner,
|
|
110
|
+
)
|
|
111
|
+
: undefined
|
|
112
|
+
|
|
113
|
+
if (owner?.type === 'json-rpc')
|
|
114
|
+
throw new Error(
|
|
115
|
+
'A local owner account is required to approve a multisig transaction.',
|
|
116
|
+
)
|
|
88
117
|
|
|
89
118
|
// If the request is not a Tempo transaction, route to Viem formatter.
|
|
90
119
|
if (!isTempo(request))
|
|
@@ -119,16 +148,7 @@ export function formatTransactionRequest(
|
|
|
119
148
|
delete request.feeToken
|
|
120
149
|
|
|
121
150
|
// Client-only TIP-1061 fields drive local signing and envelope assembly.
|
|
122
|
-
|
|
123
|
-
const {
|
|
124
|
-
multisig: _multisig,
|
|
125
|
-
multisigInit,
|
|
126
|
-
multisigOwnerStates: _multisigOwnerStates,
|
|
127
|
-
multisigSignatureCount,
|
|
128
|
-
multisigVersion: _multisigVersion,
|
|
129
|
-
signatures: _signatures,
|
|
130
|
-
...rpcRequest
|
|
131
|
-
} = request
|
|
151
|
+
const { owner: _owner, signatures: _signatures, ...rpcRequest } = request
|
|
132
152
|
|
|
133
153
|
const rpc = ox_TransactionRequest.toRpc({
|
|
134
154
|
...rpcRequest,
|
|
@@ -144,9 +164,9 @@ export function formatTransactionRequest(
|
|
|
144
164
|
rpc.data = undefined
|
|
145
165
|
rpc.value = undefined
|
|
146
166
|
|
|
167
|
+
const signer = owner ?? account
|
|
147
168
|
const [keyType, keyData] = (() => {
|
|
148
|
-
const type =
|
|
149
|
-
account && 'keyType' in account ? account.keyType : account?.source
|
|
169
|
+
const type = signer && 'keyType' in signer ? signer.keyType : signer?.source
|
|
150
170
|
if (!type) return [request.keyType, shimKeyData(request.keyData)]
|
|
151
171
|
if (type === 'webAuthn')
|
|
152
172
|
// Send a 2-byte big-endian length hint (1400 = 0x0578) instead of a
|
|
@@ -159,22 +179,20 @@ export function formatTransactionRequest(
|
|
|
159
179
|
})()
|
|
160
180
|
|
|
161
181
|
const keyId =
|
|
162
|
-
|
|
163
|
-
?
|
|
182
|
+
signer && 'accessKeyAddress' in signer
|
|
183
|
+
? signer.accessKeyAddress
|
|
164
184
|
: request.keyId
|
|
165
185
|
|
|
166
186
|
if (account) rpc.from = account.address
|
|
167
187
|
|
|
168
188
|
return {
|
|
169
189
|
...rpc,
|
|
170
|
-
...(multisigInit ? { multisigInit } : {}),
|
|
171
|
-
...(typeof multisigSignatureCount !== 'undefined'
|
|
172
|
-
? { multisigSignatureCount }
|
|
173
|
-
: {}),
|
|
174
190
|
...(request.capabilities ? { capabilities: request.capabilities } : {}),
|
|
175
191
|
...(keyData ? { keyData } : {}),
|
|
176
192
|
...(keyId ? { keyId } : {}),
|
|
177
193
|
...(keyType ? { keyType } : {}),
|
|
194
|
+
// Keep the key visible to `extract`; the undefined value never reaches JSON-RPC.
|
|
195
|
+
...(request.owner ? { owner: undefined } : {}),
|
|
178
196
|
...(typeof request.feePayer !== 'undefined'
|
|
179
197
|
? {
|
|
180
198
|
feePayer:
|