viem 2.43.2 → 2.43.4
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 +20 -0
- package/_cjs/account-abstraction/index.js +3 -1
- package/_cjs/account-abstraction/index.js.map +1 -1
- package/_cjs/account-abstraction/utils/userOperation/getInitCode.js +6 -5
- package/_cjs/account-abstraction/utils/userOperation/getInitCode.js.map +1 -1
- package/_cjs/account-abstraction/utils/userOperation/getUserOperationHash.js +4 -2
- package/_cjs/account-abstraction/utils/userOperation/getUserOperationHash.js.map +1 -1
- package/_cjs/account-abstraction/utils/userOperation/getUserOperationTypedData.js +1 -1
- package/_cjs/account-abstraction/utils/userOperation/getUserOperationTypedData.js.map +1 -1
- package/_cjs/account-abstraction/utils/userOperation/toPackedUserOperation.js +2 -2
- package/_cjs/account-abstraction/utils/userOperation/toPackedUserOperation.js.map +1 -1
- package/_cjs/actions/wallet/prepareTransactionRequest.js +4 -5
- package/_cjs/actions/wallet/prepareTransactionRequest.js.map +1 -1
- package/_cjs/chains/definitions/cpchain.js +24 -0
- package/_cjs/chains/definitions/cpchain.js.map +1 -0
- package/_cjs/chains/definitions/tempoDevnet.js +3 -3
- package/_cjs/chains/definitions/tempoDevnet.js.map +1 -1
- package/_cjs/chains/index.js +14 -12
- package/_cjs/chains/index.js.map +1 -1
- package/_cjs/errors/version.js +1 -1
- package/_cjs/tempo/Capabilities.js +3 -0
- package/_cjs/tempo/Capabilities.js.map +1 -0
- package/_cjs/tempo/Formatters.js +5 -1
- package/_cjs/tempo/Formatters.js.map +1 -1
- package/_cjs/tempo/Transport.js +3 -1
- package/_cjs/tempo/Transport.js.map +1 -1
- package/_cjs/tempo/actions/nonce.js.map +1 -1
- package/_cjs/tempo/chainConfig.js +37 -28
- package/_cjs/tempo/chainConfig.js.map +1 -1
- package/_cjs/tempo/index.js +3 -1
- package/_cjs/tempo/index.js.map +1 -1
- package/_cjs/utils/abi/getAbiItem.js +2 -1
- package/_cjs/utils/abi/getAbiItem.js.map +1 -1
- package/_esm/account-abstraction/index.js +2 -1
- package/_esm/account-abstraction/index.js.map +1 -1
- package/_esm/account-abstraction/utils/userOperation/getInitCode.js +6 -5
- package/_esm/account-abstraction/utils/userOperation/getInitCode.js.map +1 -1
- package/_esm/account-abstraction/utils/userOperation/getUserOperationHash.js +4 -2
- package/_esm/account-abstraction/utils/userOperation/getUserOperationHash.js.map +1 -1
- package/_esm/account-abstraction/utils/userOperation/getUserOperationTypedData.js +1 -1
- package/_esm/account-abstraction/utils/userOperation/getUserOperationTypedData.js.map +1 -1
- package/_esm/account-abstraction/utils/userOperation/toPackedUserOperation.js +2 -2
- package/_esm/account-abstraction/utils/userOperation/toPackedUserOperation.js.map +1 -1
- package/_esm/actions/wallet/prepareTransactionRequest.js +4 -5
- package/_esm/actions/wallet/prepareTransactionRequest.js.map +1 -1
- package/_esm/chains/definitions/cpchain.js +21 -0
- package/_esm/chains/definitions/cpchain.js.map +1 -0
- package/_esm/chains/definitions/tempoDevnet.js +3 -3
- package/_esm/chains/definitions/tempoDevnet.js.map +1 -1
- package/_esm/chains/index.js +1 -0
- package/_esm/chains/index.js.map +1 -1
- package/_esm/errors/version.js +1 -1
- package/_esm/tempo/Capabilities.js +2 -0
- package/_esm/tempo/Capabilities.js.map +1 -0
- package/_esm/tempo/Formatters.js +5 -1
- package/_esm/tempo/Formatters.js.map +1 -1
- package/_esm/tempo/Transport.js +3 -1
- package/_esm/tempo/Transport.js.map +1 -1
- package/_esm/tempo/actions/nonce.js +2 -44
- package/_esm/tempo/actions/nonce.js.map +1 -1
- package/_esm/tempo/chainConfig.js +38 -29
- package/_esm/tempo/chainConfig.js.map +1 -1
- package/_esm/tempo/index.js +2 -1
- package/_esm/tempo/index.js.map +1 -1
- package/_esm/utils/abi/getAbiItem.js +2 -1
- package/_esm/utils/abi/getAbiItem.js.map +1 -1
- package/_types/account-abstraction/index.d.ts +2 -1
- package/_types/account-abstraction/index.d.ts.map +1 -1
- package/_types/account-abstraction/utils/userOperation/getInitCode.d.ts +5 -1
- package/_types/account-abstraction/utils/userOperation/getInitCode.d.ts.map +1 -1
- package/_types/account-abstraction/utils/userOperation/getUserOperationHash.d.ts.map +1 -1
- package/_types/account-abstraction/utils/userOperation/toPackedUserOperation.d.ts +5 -1
- package/_types/account-abstraction/utils/userOperation/toPackedUserOperation.d.ts.map +1 -1
- package/_types/actions/wallet/prepareTransactionRequest.d.ts.map +1 -1
- package/_types/chains/definitions/cpchain.d.ts +48 -0
- package/_types/chains/definitions/cpchain.d.ts.map +1 -0
- package/_types/chains/definitions/tempoDevnet.d.ts +16 -8
- package/_types/chains/definitions/tempoDevnet.d.ts.map +1 -1
- package/_types/chains/definitions/tempoLocalnet.d.ts +10 -2
- package/_types/chains/definitions/tempoLocalnet.d.ts.map +1 -1
- package/_types/chains/definitions/tempoTestnet.d.ts +10 -2
- package/_types/chains/definitions/tempoTestnet.d.ts.map +1 -1
- package/_types/chains/index.d.ts +1 -0
- package/_types/chains/index.d.ts.map +1 -1
- package/_types/errors/version.d.ts +1 -1
- package/_types/tempo/Capabilities.d.ts +9 -0
- package/_types/tempo/Capabilities.d.ts.map +1 -0
- package/_types/tempo/Formatters.d.ts.map +1 -1
- package/_types/tempo/Transport.d.ts.map +1 -1
- package/_types/tempo/actions/nonce.d.ts +2 -44
- package/_types/tempo/actions/nonce.d.ts.map +1 -1
- package/_types/tempo/chainConfig.d.ts +5 -1
- package/_types/tempo/chainConfig.d.ts.map +1 -1
- package/_types/tempo/index.d.ts +2 -1
- package/_types/tempo/index.d.ts.map +1 -1
- package/_types/utils/abi/getAbiItem.d.ts.map +1 -1
- package/account-abstraction/index.ts +8 -1
- package/account-abstraction/utils/userOperation/getInitCode.ts +11 -4
- package/account-abstraction/utils/userOperation/getUserOperationHash.ts +11 -6
- package/account-abstraction/utils/userOperation/getUserOperationTypedData.ts +1 -1
- package/account-abstraction/utils/userOperation/toPackedUserOperation.ts +8 -1
- package/actions/wallet/prepareTransactionRequest.ts +24 -11
- package/chains/definitions/cpchain.ts +21 -0
- package/chains/definitions/tempoDevnet.ts +3 -3
- package/chains/index.ts +1 -0
- package/errors/version.ts +1 -1
- package/package.json +2 -2
- package/tempo/Capabilities.ts +9 -0
- package/tempo/Formatters.ts +7 -1
- package/tempo/Transport.ts +3 -1
- package/tempo/actions/nonce.ts +2 -44
- package/tempo/chainConfig.ts +42 -29
- package/tempo/index.ts +2 -1
- package/utils/abi/getAbiItem.ts +8 -3
|
@@ -54,11 +54,14 @@ export function getUserOperationHash<
|
|
|
54
54
|
if (entryPointVersion === '0.6') {
|
|
55
55
|
const factory = userOperation.initCode?.slice(0, 42) as Hex
|
|
56
56
|
const factoryData = userOperation.initCode?.slice(42) as Hex | undefined
|
|
57
|
-
const initCode = getInitCode(
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
57
|
+
const initCode = getInitCode(
|
|
58
|
+
{
|
|
59
|
+
authorization,
|
|
60
|
+
factory,
|
|
61
|
+
factoryData,
|
|
62
|
+
},
|
|
63
|
+
{ forHash: true },
|
|
64
|
+
)
|
|
62
65
|
return encodeAbiParameters(
|
|
63
66
|
[
|
|
64
67
|
{ type: 'address' },
|
|
@@ -88,7 +91,9 @@ export function getUserOperationHash<
|
|
|
88
91
|
}
|
|
89
92
|
|
|
90
93
|
if (entryPointVersion === '0.7') {
|
|
91
|
-
const packedUserOp = toPackedUserOperation(userOperation
|
|
94
|
+
const packedUserOp = toPackedUserOperation(userOperation, {
|
|
95
|
+
forHash: true,
|
|
96
|
+
})
|
|
92
97
|
return encodeAbiParameters(
|
|
93
98
|
[
|
|
94
99
|
{ type: 'address' },
|
|
@@ -33,7 +33,7 @@ export function getUserOperationTypedData(
|
|
|
33
33
|
): GetUserOperationTypedDataReturnType {
|
|
34
34
|
const { chainId, entryPointAddress, userOperation } = parameters
|
|
35
35
|
|
|
36
|
-
const packedUserOp = toPackedUserOperation(userOperation)
|
|
36
|
+
const packedUserOp = toPackedUserOperation(userOperation, { forHash: true })
|
|
37
37
|
|
|
38
38
|
return {
|
|
39
39
|
types,
|
|
@@ -7,8 +7,14 @@ import type {
|
|
|
7
7
|
} from '../../types/userOperation.js'
|
|
8
8
|
import { getInitCode } from './getInitCode.js'
|
|
9
9
|
|
|
10
|
+
export type ToPackedUserOperationOptions = {
|
|
11
|
+
/** Prepare the packed user operation for hashing. */
|
|
12
|
+
forHash?: boolean | undefined
|
|
13
|
+
}
|
|
14
|
+
|
|
10
15
|
export function toPackedUserOperation(
|
|
11
16
|
userOperation: UserOperation,
|
|
17
|
+
options: ToPackedUserOperationOptions = {},
|
|
12
18
|
): PackedUserOperation {
|
|
13
19
|
const {
|
|
14
20
|
callGasLimit,
|
|
@@ -29,7 +35,8 @@ export function toPackedUserOperation(
|
|
|
29
35
|
pad(numberToHex(verificationGasLimit || 0n), { size: 16 }),
|
|
30
36
|
pad(numberToHex(callGasLimit || 0n), { size: 16 }),
|
|
31
37
|
])
|
|
32
|
-
const initCode = getInitCode(userOperation)
|
|
38
|
+
const initCode = getInitCode(userOperation, options)
|
|
39
|
+
|
|
33
40
|
const gasFees = concat([
|
|
34
41
|
pad(numberToHex(maxPriorityFeePerGas || 0n), { size: 16 }),
|
|
35
42
|
pad(numberToHex(maxFeePerGas || 0n), { size: 16 }),
|
|
@@ -270,10 +270,14 @@ export async function prepareTransactionRequest<
|
|
|
270
270
|
let request = args as PrepareTransactionRequestParameters
|
|
271
271
|
|
|
272
272
|
request.account ??= client.account
|
|
273
|
-
request.chain ??= client.chain
|
|
274
273
|
request.parameters ??= defaultParameters
|
|
275
274
|
|
|
276
|
-
const {
|
|
275
|
+
const {
|
|
276
|
+
account: account_,
|
|
277
|
+
chain = client.chain,
|
|
278
|
+
nonceManager,
|
|
279
|
+
parameters,
|
|
280
|
+
} = request
|
|
277
281
|
|
|
278
282
|
const prepareTransactionRequest = (() => {
|
|
279
283
|
if (typeof chain?.prepareTransactionRequest === 'function')
|
|
@@ -320,9 +324,12 @@ export async function prepareTransactionRequest<
|
|
|
320
324
|
prepareTransactionRequest?.fn &&
|
|
321
325
|
prepareTransactionRequest.runAt?.includes('beforeFillTransaction')
|
|
322
326
|
) {
|
|
323
|
-
request = await prepareTransactionRequest.fn(
|
|
324
|
-
|
|
325
|
-
|
|
327
|
+
request = await prepareTransactionRequest.fn(
|
|
328
|
+
{ ...request, chain },
|
|
329
|
+
{
|
|
330
|
+
phase: 'beforeFillTransaction',
|
|
331
|
+
},
|
|
332
|
+
)
|
|
326
333
|
nonce ??= request.nonce
|
|
327
334
|
}
|
|
328
335
|
|
|
@@ -433,9 +440,12 @@ export async function prepareTransactionRequest<
|
|
|
433
440
|
prepareTransactionRequest?.fn &&
|
|
434
441
|
prepareTransactionRequest.runAt?.includes('beforeFillParameters')
|
|
435
442
|
) {
|
|
436
|
-
request = await prepareTransactionRequest.fn(
|
|
437
|
-
|
|
438
|
-
|
|
443
|
+
request = await prepareTransactionRequest.fn(
|
|
444
|
+
{ ...request, chain },
|
|
445
|
+
{
|
|
446
|
+
phase: 'beforeFillParameters',
|
|
447
|
+
},
|
|
448
|
+
)
|
|
439
449
|
}
|
|
440
450
|
|
|
441
451
|
let block: Block | undefined
|
|
@@ -580,9 +590,12 @@ export async function prepareTransactionRequest<
|
|
|
580
590
|
prepareTransactionRequest?.fn &&
|
|
581
591
|
prepareTransactionRequest.runAt?.includes('afterFillParameters')
|
|
582
592
|
)
|
|
583
|
-
request = await prepareTransactionRequest.fn(
|
|
584
|
-
|
|
585
|
-
|
|
593
|
+
request = await prepareTransactionRequest.fn(
|
|
594
|
+
{ ...request, chain },
|
|
595
|
+
{
|
|
596
|
+
phase: 'afterFillParameters',
|
|
597
|
+
},
|
|
598
|
+
)
|
|
586
599
|
|
|
587
600
|
assertRequest(request as AssertRequestParameters)
|
|
588
601
|
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { defineChain } from '../../utils/chain/defineChain.js'
|
|
2
|
+
|
|
3
|
+
export const cpchain = /*#__PURE__*/ defineChain({
|
|
4
|
+
id: 86608,
|
|
5
|
+
name: 'CpChain',
|
|
6
|
+
nativeCurrency: {
|
|
7
|
+
decimals: 18,
|
|
8
|
+
name: 'CpChain',
|
|
9
|
+
symbol: 'CP',
|
|
10
|
+
},
|
|
11
|
+
rpcUrls: {
|
|
12
|
+
default: { http: ['https://rpc.cpchain.com'] },
|
|
13
|
+
},
|
|
14
|
+
blockExplorers: {
|
|
15
|
+
default: {
|
|
16
|
+
name: 'CpChain Explorer',
|
|
17
|
+
url: 'https://explorer.cpchain.com',
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
testnet: false,
|
|
21
|
+
})
|
|
@@ -3,7 +3,7 @@ import { defineChain } from '../../utils/chain/defineChain.js'
|
|
|
3
3
|
|
|
4
4
|
export const tempoDevnet = /*#__PURE__*/ defineChain({
|
|
5
5
|
...chainConfig,
|
|
6
|
-
id:
|
|
6
|
+
id: 42429,
|
|
7
7
|
name: 'Tempo Devnet',
|
|
8
8
|
nativeCurrency: {
|
|
9
9
|
name: 'USD',
|
|
@@ -12,8 +12,8 @@ export const tempoDevnet = /*#__PURE__*/ defineChain({
|
|
|
12
12
|
},
|
|
13
13
|
rpcUrls: {
|
|
14
14
|
default: {
|
|
15
|
-
http: ['https://rpc.devnet.
|
|
16
|
-
webSocket: ['wss://rpc.devnet.
|
|
15
|
+
http: ['https://rpc.devnet.tempoxyz.dev'],
|
|
16
|
+
webSocket: ['wss://rpc.devnet.tempoxyz.dev'],
|
|
17
17
|
},
|
|
18
18
|
},
|
|
19
19
|
})
|
package/chains/index.ts
CHANGED
|
@@ -121,6 +121,7 @@ export { coreTestnet1 } from './definitions/coreTestnet1.js'
|
|
|
121
121
|
export { coreTestnet2 } from './definitions/coreTestnet2.js'
|
|
122
122
|
export { corn } from './definitions/corn.js'
|
|
123
123
|
export { cornTestnet } from './definitions/cornTestnet.js'
|
|
124
|
+
export { cpchain } from './definitions/cpchain.js'
|
|
124
125
|
export { crab } from './definitions/crab.js'
|
|
125
126
|
export { creatorTestnet } from './definitions/creatorTestnet.js'
|
|
126
127
|
export { creditCoin3Devnet } from './definitions/creditCoin3Devnet.js'
|
package/errors/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '2.43.
|
|
1
|
+
export const version = '2.43.4'
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "viem",
|
|
3
3
|
"description": "TypeScript Interface for Ethereum",
|
|
4
|
-
"version": "2.43.
|
|
4
|
+
"version": "2.43.4",
|
|
5
5
|
"main": "./_cjs/index.js",
|
|
6
6
|
"module": "./_esm/index.js",
|
|
7
7
|
"types": "./_types/index.d.ts",
|
|
@@ -217,7 +217,7 @@
|
|
|
217
217
|
"@scure/bip39": "1.6.0",
|
|
218
218
|
"abitype": "1.2.3",
|
|
219
219
|
"isows": "1.0.7",
|
|
220
|
-
"ox": "0.
|
|
220
|
+
"ox": "0.11.1",
|
|
221
221
|
"ws": "8.18.3"
|
|
222
222
|
},
|
|
223
223
|
"license": "MIT",
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { DefaultCapabilitiesSchema } from '../types/capabilities.js'
|
|
2
|
+
import type { ExactPartial } from '../types/utils.js'
|
|
3
|
+
import type { TransactionRequestTempo } from './Transaction.js'
|
|
4
|
+
|
|
5
|
+
export type Schema = Omit<DefaultCapabilitiesSchema, 'sendCalls'> & {
|
|
6
|
+
sendCalls: {
|
|
7
|
+
Request: ExactPartial<TransactionRequestTempo>
|
|
8
|
+
}
|
|
9
|
+
}
|
package/tempo/Formatters.ts
CHANGED
|
@@ -121,10 +121,16 @@ export function formatTransactionRequest(
|
|
|
121
121
|
return [undefined, undefined]
|
|
122
122
|
})()
|
|
123
123
|
|
|
124
|
+
const keyId =
|
|
125
|
+
account && 'accessKeyAddress' in account
|
|
126
|
+
? account.accessKeyAddress
|
|
127
|
+
: undefined
|
|
128
|
+
|
|
124
129
|
return {
|
|
125
130
|
...rpc,
|
|
126
|
-
...(keyType ? { keyType } : {}),
|
|
127
131
|
...(keyData ? { keyData } : {}),
|
|
132
|
+
...(keyId ? { keyId } : {}),
|
|
133
|
+
...(keyType ? { keyType } : {}),
|
|
128
134
|
...(request.feePayer
|
|
129
135
|
? {
|
|
130
136
|
feePayer:
|
package/tempo/Transport.ts
CHANGED
|
@@ -132,7 +132,7 @@ export function walletNamespaceCompat(
|
|
|
132
132
|
if (request.method === 'wallet_sendCalls') {
|
|
133
133
|
const params = request.params[0] ?? {}
|
|
134
134
|
const { capabilities, chainId, from } = params
|
|
135
|
-
const { sync } = capabilities ?? {}
|
|
135
|
+
const { sync, ...properties } = capabilities ?? {}
|
|
136
136
|
|
|
137
137
|
if (!chainId) throw new Provider.UnsupportedChainIdError()
|
|
138
138
|
if (Number(chainId) !== client.chain.id)
|
|
@@ -150,11 +150,13 @@ export function walletNamespaceCompat(
|
|
|
150
150
|
if (!sync)
|
|
151
151
|
return sendTransaction(client, {
|
|
152
152
|
account,
|
|
153
|
+
...(properties ? properties : {}),
|
|
153
154
|
calls,
|
|
154
155
|
})
|
|
155
156
|
|
|
156
157
|
const { transactionHash } = await sendTransactionSync(client, {
|
|
157
158
|
account,
|
|
159
|
+
...(properties ? properties : {}),
|
|
158
160
|
calls,
|
|
159
161
|
})
|
|
160
162
|
return transactionHash
|
package/tempo/actions/nonce.ts
CHANGED
|
@@ -111,27 +111,7 @@ export namespace getNonce {
|
|
|
111
111
|
}
|
|
112
112
|
|
|
113
113
|
/**
|
|
114
|
-
*
|
|
115
|
-
*
|
|
116
|
-
* @example
|
|
117
|
-
* ```ts
|
|
118
|
-
* import { createClient, http } from 'viem'
|
|
119
|
-
* import { tempo } from 'tempo.ts/chains'
|
|
120
|
-
* import { Actions } from 'tempo.ts/viem'
|
|
121
|
-
*
|
|
122
|
-
* const client = createClient({
|
|
123
|
-
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' }),
|
|
124
|
-
* transport: http(),
|
|
125
|
-
* })
|
|
126
|
-
*
|
|
127
|
-
* const count = await Actions.nonce.getNonceKeyCount(client, {
|
|
128
|
-
* account: '0x...',
|
|
129
|
-
* })
|
|
130
|
-
* ```
|
|
131
|
-
*
|
|
132
|
-
* @param client - Client.
|
|
133
|
-
* @param parameters - Parameters.
|
|
134
|
-
* @returns The number of active nonce keys.
|
|
114
|
+
* @deprecated This function has been deprecated post-AllegroModerato. It will be removed in a future version.
|
|
135
115
|
*/
|
|
136
116
|
export async function getNonceKeyCount<
|
|
137
117
|
chain extends Chain | undefined,
|
|
@@ -203,29 +183,7 @@ export namespace getNonceKeyCount {
|
|
|
203
183
|
}
|
|
204
184
|
|
|
205
185
|
/**
|
|
206
|
-
*
|
|
207
|
-
*
|
|
208
|
-
* @example
|
|
209
|
-
* ```ts
|
|
210
|
-
* import { createClient, http } from 'viem'
|
|
211
|
-
* import { tempo } from 'tempo.ts/chains'
|
|
212
|
-
* import { Actions } from 'tempo.ts/viem'
|
|
213
|
-
*
|
|
214
|
-
* const client = createClient({
|
|
215
|
-
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' }),
|
|
216
|
-
* transport: http(),
|
|
217
|
-
* })
|
|
218
|
-
*
|
|
219
|
-
* const unwatch = Actions.nonce.watchNonceIncremented(client, {
|
|
220
|
-
* onNonceIncremented: (args, log) => {
|
|
221
|
-
* console.log('Nonce incremented:', args)
|
|
222
|
-
* },
|
|
223
|
-
* })
|
|
224
|
-
* ```
|
|
225
|
-
*
|
|
226
|
-
* @param client - Client.
|
|
227
|
-
* @param parameters - Parameters.
|
|
228
|
-
* @returns A function to unsubscribe from the event.
|
|
186
|
+
* @deprecated This function has been deprecated post-AllegroModerato. It will be removed in a future version.
|
|
229
187
|
*/
|
|
230
188
|
export function watchNonceIncremented<
|
|
231
189
|
chain extends Chain | undefined,
|
package/tempo/chainConfig.ts
CHANGED
|
@@ -31,41 +31,54 @@ export const chainConfig = {
|
|
|
31
31
|
format: Formatters.formatTransactionRequest,
|
|
32
32
|
}),
|
|
33
33
|
},
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
34
|
+
prepareTransactionRequest: [
|
|
35
|
+
async (r, { phase }) => {
|
|
36
|
+
const request = r as Transaction.TransactionRequest & {
|
|
37
|
+
account?: Account | undefined
|
|
38
|
+
chain?:
|
|
39
|
+
| (Chain & { feeToken?: TokenId.TokenIdOrAddress | undefined })
|
|
40
|
+
| undefined
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
if (phase === 'afterFillParameters') {
|
|
44
|
+
if (typeof request.nonceKey === 'bigint' && request.nonceKey > 0n)
|
|
45
|
+
request.gas = (request.gas ?? 0n) + 40_000n
|
|
46
|
+
return request as unknown as typeof r
|
|
47
|
+
}
|
|
41
48
|
|
|
42
|
-
|
|
43
|
-
|
|
49
|
+
request.nonceKey = (() => {
|
|
50
|
+
if (
|
|
51
|
+
typeof request.nonceKey !== 'undefined' &&
|
|
52
|
+
request.nonceKey !== 'random'
|
|
53
|
+
)
|
|
54
|
+
return request.nonceKey
|
|
44
55
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
56
|
+
const address = request.account?.address ?? request.from
|
|
57
|
+
if (!address) return undefined
|
|
58
|
+
if (!request.chain) return undefined
|
|
59
|
+
const nonceKey = NonceKeyStore.getNonceKey(NonceKeyStore.store, {
|
|
60
|
+
address,
|
|
61
|
+
chainId: request.chain.id,
|
|
62
|
+
})
|
|
52
63
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
64
|
+
if (nonceKey === 0n) return undefined
|
|
65
|
+
return nonceKey
|
|
66
|
+
})()
|
|
56
67
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
68
|
+
request.nonce = (() => {
|
|
69
|
+
if (typeof request.nonce === 'number') return request.nonce
|
|
70
|
+
// TODO: remove this line once `eth_fillTransaction` supports nonce keys.
|
|
71
|
+
if (request.nonceKey) return 0
|
|
72
|
+
return undefined
|
|
73
|
+
})()
|
|
63
74
|
|
|
64
|
-
|
|
65
|
-
|
|
75
|
+
if (!request.feeToken && request.chain?.feeToken)
|
|
76
|
+
request.feeToken = request.chain.feeToken
|
|
66
77
|
|
|
67
|
-
|
|
68
|
-
|
|
78
|
+
return request as unknown as typeof r
|
|
79
|
+
},
|
|
80
|
+
{ runAt: ['beforeFillTransaction', 'afterFillParameters'] },
|
|
81
|
+
],
|
|
69
82
|
serializers: {
|
|
70
83
|
// TODO: casting to satisfy viem – viem v3 to have more flexible serializer type.
|
|
71
84
|
transaction: ((transaction, signature) =>
|
package/tempo/index.ts
CHANGED
|
@@ -15,6 +15,7 @@ export * as Abis from './Abis.js'
|
|
|
15
15
|
export * as Account from './Account.js'
|
|
16
16
|
export * as Addresses from './Addresses.js'
|
|
17
17
|
export * as Actions from './actions/index.js'
|
|
18
|
+
export * as Capabilities from './Capabilities.js'
|
|
18
19
|
export {
|
|
19
20
|
type Decorator as TempoActions,
|
|
20
21
|
decorator as tempoActions,
|
|
@@ -54,6 +55,6 @@ export type {
|
|
|
54
55
|
} from './Transaction.js'
|
|
55
56
|
export * as Transaction from './Transaction.js'
|
|
56
57
|
export * as Transport from './Transport.js'
|
|
57
|
-
export { withFeePayer } from './Transport.js'
|
|
58
|
+
export { walletNamespaceCompat, withFeePayer } from './Transport.js'
|
|
58
59
|
export * as WebAuthnP256 from './WebAuthnP256.js'
|
|
59
60
|
export * as WebCryptoP256 from './WebCryptoP256.js'
|
package/utils/abi/getAbiItem.ts
CHANGED
|
@@ -171,9 +171,14 @@ export function isArgOfType(arg: unknown, abiParameter: AbiParameter): boolean {
|
|
|
171
171
|
if (abiParameterType === 'tuple' && 'components' in abiParameter)
|
|
172
172
|
return Object.values(abiParameter.components).every(
|
|
173
173
|
(component, index) => {
|
|
174
|
-
return
|
|
175
|
-
|
|
176
|
-
|
|
174
|
+
return (
|
|
175
|
+
argType === 'object' &&
|
|
176
|
+
isArgOfType(
|
|
177
|
+
Object.values(arg as unknown[] | Record<string, unknown>)[
|
|
178
|
+
index
|
|
179
|
+
],
|
|
180
|
+
component as AbiParameter,
|
|
181
|
+
)
|
|
177
182
|
)
|
|
178
183
|
},
|
|
179
184
|
)
|