tempo.ts 0.5.3 → 0.6.0
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/dist/ox/Transaction.d.ts +0 -2
- package/dist/ox/Transaction.d.ts.map +1 -1
- package/dist/ox/Transaction.js +0 -8
- package/dist/ox/Transaction.js.map +1 -1
- package/dist/ox/TransactionReceipt.d.ts +155 -0
- package/dist/ox/TransactionReceipt.d.ts.map +1 -0
- package/dist/ox/TransactionReceipt.js +136 -0
- package/dist/ox/TransactionReceipt.js.map +1 -0
- package/dist/prool/Instance.d.ts +2 -2
- package/dist/prool/Instance.d.ts.map +1 -1
- package/dist/prool/Instance.js +2 -2
- package/dist/prool/Instance.js.map +1 -1
- package/dist/viem/Actions/faucet.d.ts +2 -0
- package/dist/viem/Actions/faucet.d.ts.map +1 -1
- package/dist/viem/Actions/faucet.js +6 -1
- package/dist/viem/Actions/faucet.js.map +1 -1
- package/dist/viem/Chain.d.ts +25 -6
- package/dist/viem/Chain.d.ts.map +1 -1
- package/dist/viem/Chain.js +4 -1
- package/dist/viem/Chain.js.map +1 -1
- package/dist/viem/Formatters.d.ts +4 -3
- package/dist/viem/Formatters.d.ts.map +1 -1
- package/dist/viem/Formatters.js +8 -5
- package/dist/viem/Formatters.js.map +1 -1
- package/dist/viem/Transaction.d.ts +7 -2
- package/dist/viem/Transaction.d.ts.map +1 -1
- package/dist/viem/Transaction.js.map +1 -1
- package/dist/viem/internal/account.d.ts.map +1 -1
- package/dist/viem/internal/account.js +0 -8
- package/dist/viem/internal/account.js.map +1 -1
- package/dist/wagmi/Connector.d.ts +6 -0
- package/dist/wagmi/Connector.d.ts.map +1 -1
- package/dist/wagmi/Connector.js +26 -2
- package/dist/wagmi/Connector.js.map +1 -1
- package/package.json +1 -1
- package/src/ox/Transaction.test.ts +0 -3
- package/src/ox/Transaction.ts +0 -14
- package/src/ox/TransactionReceipt.ts +190 -0
- package/src/ox/e2e.test.ts +145 -106
- package/src/prool/Instance.ts +4 -4
- package/src/viem/Actions/faucet.ts +10 -1
- package/src/viem/Chain.ts +4 -0
- package/src/viem/Formatters.ts +13 -4
- package/src/viem/Transaction.ts +19 -1
- package/src/viem/e2e.test.ts +4 -16
- package/src/viem/internal/account.ts +0 -12
- package/src/wagmi/Connector.ts +29 -2
package/src/ox/e2e.test.ts
CHANGED
|
@@ -13,6 +13,7 @@ import { client, fundAddress } from '../../test/viem/config.js'
|
|
|
13
13
|
import { SignatureEnvelope } from './index.js'
|
|
14
14
|
import * as Transaction from './Transaction.js'
|
|
15
15
|
import * as TransactionEnvelopeAA from './TransactionEnvelopeAA.js'
|
|
16
|
+
import * as TransactionReceipt from './TransactionReceipt.js'
|
|
16
17
|
|
|
17
18
|
test('behavior: default (secp256k1)', async () => {
|
|
18
19
|
const privateKey = Secp256k1.randomPrivateKey()
|
|
@@ -50,18 +51,21 @@ test('behavior: default (secp256k1)', async () => {
|
|
|
50
51
|
signature: SignatureEnvelope.from(signature),
|
|
51
52
|
})
|
|
52
53
|
|
|
53
|
-
const receipt = await client
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
54
|
+
const receipt = (await client
|
|
55
|
+
.request({
|
|
56
|
+
method: 'eth_sendRawTransactionSync',
|
|
57
|
+
params: [serialized_signed],
|
|
58
|
+
})
|
|
59
|
+
.then((tx) => TransactionReceipt.fromRpc(tx as any)))!
|
|
58
60
|
expect(receipt).toBeDefined()
|
|
59
61
|
|
|
60
62
|
{
|
|
61
|
-
const response = await client
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
63
|
+
const response = await client
|
|
64
|
+
.request({
|
|
65
|
+
method: 'eth_getTransactionByHash',
|
|
66
|
+
params: [receipt.transactionHash],
|
|
67
|
+
})
|
|
68
|
+
.then((tx) => Transaction.fromRpc(tx as any))
|
|
65
69
|
if (!response) throw new Error()
|
|
66
70
|
|
|
67
71
|
const {
|
|
@@ -69,14 +73,13 @@ test('behavior: default (secp256k1)', async () => {
|
|
|
69
73
|
blockHash,
|
|
70
74
|
chainId,
|
|
71
75
|
hash,
|
|
72
|
-
// @ts-expect-error
|
|
73
76
|
feeToken: _,
|
|
74
77
|
from,
|
|
75
78
|
nonce,
|
|
76
79
|
maxFeePerGas,
|
|
77
80
|
maxPriorityFeePerGas,
|
|
78
|
-
// @ts-expect-error
|
|
79
81
|
signature,
|
|
82
|
+
transactionIndex,
|
|
80
83
|
...rest
|
|
81
84
|
} = response
|
|
82
85
|
|
|
@@ -89,26 +92,27 @@ test('behavior: default (secp256k1)', async () => {
|
|
|
89
92
|
expect(maxPriorityFeePerGas).toBeDefined()
|
|
90
93
|
expect(nonce).toBeDefined()
|
|
91
94
|
expect(signature).toBeDefined()
|
|
95
|
+
expect(transactionIndex).toBeDefined()
|
|
92
96
|
expect(rest).toMatchInlineSnapshot(`
|
|
93
97
|
{
|
|
94
98
|
"aaAuthorizationList": [],
|
|
95
99
|
"accessList": [],
|
|
96
100
|
"calls": [
|
|
97
101
|
{
|
|
98
|
-
"data":
|
|
99
|
-
"input": "0x",
|
|
102
|
+
"data": "0x",
|
|
100
103
|
"to": "0x0000000000000000000000000000000000000000",
|
|
101
|
-
"value":
|
|
104
|
+
"value": 0n,
|
|
102
105
|
},
|
|
103
106
|
],
|
|
107
|
+
"data": undefined,
|
|
104
108
|
"feePayerSignature": null,
|
|
105
|
-
"gas":
|
|
106
|
-
"gasPrice":
|
|
107
|
-
"nonceKey":
|
|
108
|
-
"
|
|
109
|
-
"type": "0x76",
|
|
109
|
+
"gas": 100000n,
|
|
110
|
+
"gasPrice": 20000000000n,
|
|
111
|
+
"nonceKey": 0n,
|
|
112
|
+
"type": "aa",
|
|
110
113
|
"validAfter": null,
|
|
111
114
|
"validBefore": null,
|
|
115
|
+
"value": 0n,
|
|
112
116
|
}
|
|
113
117
|
`)
|
|
114
118
|
}
|
|
@@ -116,30 +120,34 @@ test('behavior: default (secp256k1)', async () => {
|
|
|
116
120
|
const {
|
|
117
121
|
blockNumber,
|
|
118
122
|
blockHash,
|
|
119
|
-
|
|
123
|
+
feePayer,
|
|
120
124
|
feeToken: _,
|
|
121
125
|
from,
|
|
122
126
|
logs,
|
|
123
127
|
logsBloom,
|
|
124
128
|
transactionHash,
|
|
129
|
+
transactionIndex,
|
|
125
130
|
...rest
|
|
126
131
|
} = receipt
|
|
127
132
|
|
|
128
133
|
expect(blockNumber).toBeDefined()
|
|
129
134
|
expect(blockHash).toBeDefined()
|
|
135
|
+
expect(feePayer).toBeDefined()
|
|
130
136
|
expect(from).toBe(address)
|
|
131
137
|
expect(logs).toBeDefined()
|
|
132
138
|
expect(logsBloom).toBeDefined()
|
|
133
139
|
expect(transactionHash).toBe(receipt.transactionHash)
|
|
140
|
+
expect(transactionIndex).toBeDefined()
|
|
134
141
|
expect(rest).toMatchInlineSnapshot(`
|
|
135
142
|
{
|
|
143
|
+
"blobGasPrice": undefined,
|
|
144
|
+
"blobGasUsed": undefined,
|
|
136
145
|
"contractAddress": null,
|
|
137
|
-
"cumulativeGasUsed":
|
|
138
|
-
"effectiveGasPrice":
|
|
139
|
-
"gasUsed":
|
|
140
|
-
"status": "
|
|
146
|
+
"cumulativeGasUsed": 23600n,
|
|
147
|
+
"effectiveGasPrice": 20000000000n,
|
|
148
|
+
"gasUsed": 23600n,
|
|
149
|
+
"status": "success",
|
|
141
150
|
"to": "0x0000000000000000000000000000000000000000",
|
|
142
|
-
"transactionIndex": "0x1",
|
|
143
151
|
"type": "0x76",
|
|
144
152
|
}
|
|
145
153
|
`)
|
|
@@ -181,33 +189,36 @@ test('behavior: default (p256)', async () => {
|
|
|
181
189
|
}),
|
|
182
190
|
})
|
|
183
191
|
|
|
184
|
-
const receipt = await client
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
192
|
+
const receipt = (await client
|
|
193
|
+
.request({
|
|
194
|
+
method: 'eth_sendRawTransactionSync',
|
|
195
|
+
params: [serialized_signed],
|
|
196
|
+
})
|
|
197
|
+
.then((tx) => TransactionReceipt.fromRpc(tx as any)))!
|
|
188
198
|
|
|
189
199
|
expect(receipt).toBeDefined()
|
|
190
200
|
|
|
191
201
|
{
|
|
192
|
-
const response = await client
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
202
|
+
const response = await client
|
|
203
|
+
.request({
|
|
204
|
+
method: 'eth_getTransactionByHash',
|
|
205
|
+
params: [receipt.transactionHash],
|
|
206
|
+
})
|
|
207
|
+
.then((tx) => Transaction.fromRpc(tx as any))
|
|
196
208
|
if (!response) throw new Error()
|
|
197
209
|
|
|
198
210
|
const {
|
|
199
211
|
blockNumber,
|
|
200
212
|
blockHash,
|
|
201
213
|
chainId,
|
|
202
|
-
// @ts-expect-error
|
|
203
214
|
feeToken: _,
|
|
204
215
|
from,
|
|
205
216
|
hash,
|
|
206
217
|
nonce,
|
|
207
218
|
maxFeePerGas,
|
|
208
219
|
maxPriorityFeePerGas,
|
|
209
|
-
// @ts-expect-error
|
|
210
220
|
signature,
|
|
221
|
+
transactionIndex,
|
|
211
222
|
...rest
|
|
212
223
|
} = response
|
|
213
224
|
|
|
@@ -220,26 +231,27 @@ test('behavior: default (p256)', async () => {
|
|
|
220
231
|
expect(maxFeePerGas).toBeDefined()
|
|
221
232
|
expect(maxPriorityFeePerGas).toBeDefined()
|
|
222
233
|
expect(signature).toBeDefined()
|
|
234
|
+
expect(transactionIndex).toBeDefined()
|
|
223
235
|
expect(rest).toMatchInlineSnapshot(`
|
|
224
236
|
{
|
|
225
237
|
"aaAuthorizationList": [],
|
|
226
238
|
"accessList": [],
|
|
227
239
|
"calls": [
|
|
228
240
|
{
|
|
229
|
-
"data":
|
|
230
|
-
"input": "0x",
|
|
241
|
+
"data": "0x",
|
|
231
242
|
"to": "0x0000000000000000000000000000000000000000",
|
|
232
|
-
"value":
|
|
243
|
+
"value": 0n,
|
|
233
244
|
},
|
|
234
245
|
],
|
|
246
|
+
"data": undefined,
|
|
235
247
|
"feePayerSignature": null,
|
|
236
|
-
"gas":
|
|
237
|
-
"gasPrice":
|
|
238
|
-
"nonceKey":
|
|
239
|
-
"
|
|
240
|
-
"type": "0x76",
|
|
248
|
+
"gas": 100000n,
|
|
249
|
+
"gasPrice": 20000000000n,
|
|
250
|
+
"nonceKey": 0n,
|
|
251
|
+
"type": "aa",
|
|
241
252
|
"validAfter": null,
|
|
242
253
|
"validBefore": null,
|
|
254
|
+
"value": 0n,
|
|
243
255
|
}
|
|
244
256
|
`)
|
|
245
257
|
}
|
|
@@ -247,30 +259,34 @@ test('behavior: default (p256)', async () => {
|
|
|
247
259
|
const {
|
|
248
260
|
blockNumber,
|
|
249
261
|
blockHash,
|
|
250
|
-
|
|
262
|
+
feePayer,
|
|
251
263
|
feeToken: _,
|
|
252
264
|
from,
|
|
253
265
|
logs,
|
|
254
266
|
logsBloom,
|
|
255
267
|
transactionHash,
|
|
268
|
+
transactionIndex,
|
|
256
269
|
...rest
|
|
257
270
|
} = receipt
|
|
258
271
|
|
|
259
272
|
expect(blockNumber).toBeDefined()
|
|
260
273
|
expect(blockHash).toBeDefined()
|
|
274
|
+
expect(feePayer).toBeDefined()
|
|
261
275
|
expect(from).toBe(address)
|
|
262
276
|
expect(logs).toBeDefined()
|
|
263
277
|
expect(logsBloom).toBeDefined()
|
|
264
278
|
expect(transactionHash).toBe(receipt.transactionHash)
|
|
279
|
+
expect(transactionIndex).toBeDefined()
|
|
265
280
|
expect(rest).toMatchInlineSnapshot(`
|
|
266
281
|
{
|
|
282
|
+
"blobGasPrice": undefined,
|
|
283
|
+
"blobGasUsed": undefined,
|
|
267
284
|
"contractAddress": null,
|
|
268
|
-
"cumulativeGasUsed":
|
|
269
|
-
"effectiveGasPrice":
|
|
270
|
-
"gasUsed":
|
|
271
|
-
"status": "
|
|
285
|
+
"cumulativeGasUsed": 28600n,
|
|
286
|
+
"effectiveGasPrice": 20000000000n,
|
|
287
|
+
"gasUsed": 28600n,
|
|
288
|
+
"status": "success",
|
|
272
289
|
"to": "0x0000000000000000000000000000000000000000",
|
|
273
|
-
"transactionIndex": "0x1",
|
|
274
290
|
"type": "0x76",
|
|
275
291
|
}
|
|
276
292
|
`)
|
|
@@ -311,18 +327,22 @@ test('behavior: default (p256 - webcrypto)', async () => {
|
|
|
311
327
|
}),
|
|
312
328
|
})
|
|
313
329
|
|
|
314
|
-
const receipt = await client
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
330
|
+
const receipt = (await client
|
|
331
|
+
.request({
|
|
332
|
+
method: 'eth_sendRawTransactionSync',
|
|
333
|
+
params: [serialized_signed],
|
|
334
|
+
})
|
|
335
|
+
.then((tx) => TransactionReceipt.fromRpc(tx as any)))!
|
|
318
336
|
|
|
319
337
|
expect(receipt).toBeDefined()
|
|
320
338
|
|
|
321
339
|
{
|
|
322
|
-
const response = await client
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
340
|
+
const response = await client
|
|
341
|
+
.request({
|
|
342
|
+
method: 'eth_getTransactionByHash',
|
|
343
|
+
params: [receipt.transactionHash],
|
|
344
|
+
})
|
|
345
|
+
.then((tx) => Transaction.fromRpc(tx as any))
|
|
326
346
|
if (!response) throw new Error()
|
|
327
347
|
|
|
328
348
|
const {
|
|
@@ -336,6 +356,7 @@ test('behavior: default (p256 - webcrypto)', async () => {
|
|
|
336
356
|
maxFeePerGas,
|
|
337
357
|
maxPriorityFeePerGas,
|
|
338
358
|
signature,
|
|
359
|
+
transactionIndex,
|
|
339
360
|
...rest
|
|
340
361
|
} = response as any
|
|
341
362
|
|
|
@@ -348,26 +369,27 @@ test('behavior: default (p256 - webcrypto)', async () => {
|
|
|
348
369
|
expect(maxFeePerGas).toBeDefined()
|
|
349
370
|
expect(maxPriorityFeePerGas).toBeDefined()
|
|
350
371
|
expect(signature).toBeDefined()
|
|
372
|
+
expect(transactionIndex).toBeDefined()
|
|
351
373
|
expect(rest).toMatchInlineSnapshot(`
|
|
352
374
|
{
|
|
353
375
|
"aaAuthorizationList": [],
|
|
354
376
|
"accessList": [],
|
|
355
377
|
"calls": [
|
|
356
378
|
{
|
|
357
|
-
"data":
|
|
358
|
-
"input": "0x",
|
|
379
|
+
"data": "0x",
|
|
359
380
|
"to": "0x0000000000000000000000000000000000000000",
|
|
360
|
-
"value":
|
|
381
|
+
"value": 0n,
|
|
361
382
|
},
|
|
362
383
|
],
|
|
384
|
+
"data": undefined,
|
|
363
385
|
"feePayerSignature": null,
|
|
364
|
-
"gas":
|
|
365
|
-
"gasPrice":
|
|
366
|
-
"nonceKey":
|
|
367
|
-
"
|
|
368
|
-
"type": "0x76",
|
|
386
|
+
"gas": 100000n,
|
|
387
|
+
"gasPrice": 20000000000n,
|
|
388
|
+
"nonceKey": 0n,
|
|
389
|
+
"type": "aa",
|
|
369
390
|
"validAfter": null,
|
|
370
391
|
"validBefore": null,
|
|
392
|
+
"value": 0n,
|
|
371
393
|
}
|
|
372
394
|
`)
|
|
373
395
|
}
|
|
@@ -375,30 +397,34 @@ test('behavior: default (p256 - webcrypto)', async () => {
|
|
|
375
397
|
const {
|
|
376
398
|
blockNumber,
|
|
377
399
|
blockHash,
|
|
378
|
-
|
|
400
|
+
feePayer,
|
|
379
401
|
feeToken: _,
|
|
380
402
|
from,
|
|
381
403
|
logs,
|
|
382
404
|
logsBloom,
|
|
383
405
|
transactionHash,
|
|
406
|
+
transactionIndex,
|
|
384
407
|
...rest
|
|
385
408
|
} = receipt
|
|
386
409
|
|
|
387
410
|
expect(blockNumber).toBeDefined()
|
|
388
411
|
expect(blockHash).toBeDefined()
|
|
412
|
+
expect(feePayer).toBeDefined()
|
|
389
413
|
expect(from).toBeDefined()
|
|
390
414
|
expect(logs).toBeDefined()
|
|
391
415
|
expect(logsBloom).toBeDefined()
|
|
392
416
|
expect(transactionHash).toBe(receipt.transactionHash)
|
|
417
|
+
expect(transactionIndex).toBeDefined()
|
|
393
418
|
expect(rest).toMatchInlineSnapshot(`
|
|
394
419
|
{
|
|
420
|
+
"blobGasPrice": undefined,
|
|
421
|
+
"blobGasUsed": undefined,
|
|
395
422
|
"contractAddress": null,
|
|
396
|
-
"cumulativeGasUsed":
|
|
397
|
-
"effectiveGasPrice":
|
|
398
|
-
"gasUsed":
|
|
399
|
-
"status": "
|
|
423
|
+
"cumulativeGasUsed": 28600n,
|
|
424
|
+
"effectiveGasPrice": 20000000000n,
|
|
425
|
+
"gasUsed": 28600n,
|
|
426
|
+
"status": "success",
|
|
400
427
|
"to": "0x0000000000000000000000000000000000000000",
|
|
401
|
-
"transactionIndex": "0x1",
|
|
402
428
|
"type": "0x76",
|
|
403
429
|
}
|
|
404
430
|
`)
|
|
@@ -446,32 +472,35 @@ test('behavior: default (webauthn)', async () => {
|
|
|
446
472
|
}),
|
|
447
473
|
})
|
|
448
474
|
|
|
449
|
-
const receipt = await client
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
475
|
+
const receipt = (await client
|
|
476
|
+
.request({
|
|
477
|
+
method: 'eth_sendRawTransactionSync',
|
|
478
|
+
params: [serialized_signed],
|
|
479
|
+
})
|
|
480
|
+
.then((tx) => TransactionReceipt.fromRpc(tx as any)))!
|
|
453
481
|
|
|
454
482
|
expect(receipt).toBeDefined()
|
|
455
483
|
|
|
456
484
|
{
|
|
457
|
-
const response = await client
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
485
|
+
const response = await client
|
|
486
|
+
.request({
|
|
487
|
+
method: 'eth_getTransactionByHash',
|
|
488
|
+
params: [receipt.transactionHash],
|
|
489
|
+
})
|
|
490
|
+
.then((tx) => Transaction.fromRpc(tx as any))
|
|
461
491
|
if (!response) throw new Error()
|
|
462
492
|
|
|
463
493
|
const {
|
|
464
494
|
blockNumber,
|
|
465
495
|
blockHash,
|
|
466
496
|
chainId,
|
|
467
|
-
// @ts-expect-error
|
|
468
497
|
feeToken: _,
|
|
469
498
|
from,
|
|
470
499
|
hash,
|
|
471
500
|
nonce,
|
|
472
501
|
maxFeePerGas,
|
|
473
502
|
maxPriorityFeePerGas,
|
|
474
|
-
|
|
503
|
+
transactionIndex,
|
|
475
504
|
signature,
|
|
476
505
|
...rest
|
|
477
506
|
} = response
|
|
@@ -485,26 +514,27 @@ test('behavior: default (webauthn)', async () => {
|
|
|
485
514
|
expect(maxFeePerGas).toBeDefined()
|
|
486
515
|
expect(maxPriorityFeePerGas).toBeDefined()
|
|
487
516
|
expect(signature).toBeDefined()
|
|
517
|
+
expect(transactionIndex).toBeDefined()
|
|
488
518
|
expect(rest).toMatchInlineSnapshot(`
|
|
489
519
|
{
|
|
490
520
|
"aaAuthorizationList": [],
|
|
491
521
|
"accessList": [],
|
|
492
522
|
"calls": [
|
|
493
523
|
{
|
|
494
|
-
"data":
|
|
495
|
-
"input": "0x",
|
|
524
|
+
"data": "0x",
|
|
496
525
|
"to": "0x0000000000000000000000000000000000000000",
|
|
497
|
-
"value":
|
|
526
|
+
"value": 0n,
|
|
498
527
|
},
|
|
499
528
|
],
|
|
529
|
+
"data": undefined,
|
|
500
530
|
"feePayerSignature": null,
|
|
501
|
-
"gas":
|
|
502
|
-
"gasPrice":
|
|
503
|
-
"nonceKey":
|
|
504
|
-
"
|
|
505
|
-
"type": "0x76",
|
|
531
|
+
"gas": 100000n,
|
|
532
|
+
"gasPrice": 20000000000n,
|
|
533
|
+
"nonceKey": 0n,
|
|
534
|
+
"type": "aa",
|
|
506
535
|
"validAfter": null,
|
|
507
536
|
"validBefore": null,
|
|
537
|
+
"value": 0n,
|
|
508
538
|
}
|
|
509
539
|
`)
|
|
510
540
|
}
|
|
@@ -512,30 +542,35 @@ test('behavior: default (webauthn)', async () => {
|
|
|
512
542
|
const {
|
|
513
543
|
blockNumber,
|
|
514
544
|
blockHash,
|
|
515
|
-
|
|
545
|
+
cumulativeGasUsed,
|
|
546
|
+
feePayer,
|
|
516
547
|
feeToken: _,
|
|
517
548
|
from,
|
|
518
549
|
logs,
|
|
519
550
|
logsBloom,
|
|
520
551
|
transactionHash,
|
|
552
|
+
transactionIndex,
|
|
521
553
|
...rest
|
|
522
554
|
} = receipt
|
|
523
555
|
|
|
524
556
|
expect(blockNumber).toBeDefined()
|
|
525
557
|
expect(blockHash).toBeDefined()
|
|
558
|
+
expect(cumulativeGasUsed).toBeDefined()
|
|
559
|
+
expect(feePayer).toBeDefined()
|
|
526
560
|
expect(from).toBe(address)
|
|
527
561
|
expect(logs).toBeDefined()
|
|
528
562
|
expect(logsBloom).toBeDefined()
|
|
529
563
|
expect(transactionHash).toBe(receipt.transactionHash)
|
|
564
|
+
expect(transactionIndex).toBeDefined()
|
|
530
565
|
expect(rest).toMatchInlineSnapshot(`
|
|
531
566
|
{
|
|
567
|
+
"blobGasPrice": undefined,
|
|
568
|
+
"blobGasUsed": undefined,
|
|
532
569
|
"contractAddress": null,
|
|
533
|
-
"
|
|
534
|
-
"
|
|
535
|
-
"
|
|
536
|
-
"status": "0x1",
|
|
570
|
+
"effectiveGasPrice": 20000000000n,
|
|
571
|
+
"gasUsed": 31208n,
|
|
572
|
+
"status": "success",
|
|
537
573
|
"to": "0x0000000000000000000000000000000000000000",
|
|
538
|
-
"transactionIndex": "0x1",
|
|
539
574
|
"type": "0x76",
|
|
540
575
|
}
|
|
541
576
|
`)
|
|
@@ -607,16 +642,18 @@ test('behavior: feePayerSignature (user → feePayer)', async () => {
|
|
|
607
642
|
},
|
|
608
643
|
)
|
|
609
644
|
|
|
610
|
-
const receipt = await client
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
645
|
+
const receipt = (await client
|
|
646
|
+
.request({
|
|
647
|
+
method: 'eth_sendRawTransactionSync',
|
|
648
|
+
params: [serialized_signed],
|
|
649
|
+
})
|
|
650
|
+
.then((tx) => TransactionReceipt.fromRpc(tx as any)))!
|
|
614
651
|
|
|
615
652
|
{
|
|
616
653
|
const {
|
|
617
654
|
blockNumber,
|
|
618
655
|
blockHash,
|
|
619
|
-
|
|
656
|
+
feePayer,
|
|
620
657
|
feeToken: _,
|
|
621
658
|
from,
|
|
622
659
|
logs,
|
|
@@ -628,6 +665,7 @@ test('behavior: feePayerSignature (user → feePayer)', async () => {
|
|
|
628
665
|
|
|
629
666
|
expect(blockNumber).toBeDefined()
|
|
630
667
|
expect(blockHash).toBeDefined()
|
|
668
|
+
expect(feePayer).toBe(feePayerAddress)
|
|
631
669
|
expect(from).toBe(senderAddress)
|
|
632
670
|
expect(logs).toBeDefined()
|
|
633
671
|
expect(logsBloom).toBeDefined()
|
|
@@ -635,25 +673,26 @@ test('behavior: feePayerSignature (user → feePayer)', async () => {
|
|
|
635
673
|
expect(transactionIndex).toBeDefined()
|
|
636
674
|
expect(rest).toMatchInlineSnapshot(`
|
|
637
675
|
{
|
|
676
|
+
"blobGasPrice": undefined,
|
|
677
|
+
"blobGasUsed": undefined,
|
|
638
678
|
"contractAddress": null,
|
|
639
|
-
"cumulativeGasUsed":
|
|
640
|
-
"effectiveGasPrice":
|
|
641
|
-
"gasUsed":
|
|
642
|
-
"status": "
|
|
679
|
+
"cumulativeGasUsed": 23600n,
|
|
680
|
+
"effectiveGasPrice": 20000000000n,
|
|
681
|
+
"gasUsed": 23600n,
|
|
682
|
+
"status": "success",
|
|
643
683
|
"to": "0x0000000000000000000000000000000000000000",
|
|
644
684
|
"type": "0x76",
|
|
645
685
|
}
|
|
646
686
|
`)
|
|
647
687
|
}
|
|
648
688
|
|
|
649
|
-
const {
|
|
689
|
+
const { feeToken, from } = (await client
|
|
650
690
|
.request({
|
|
651
691
|
method: 'eth_getTransactionByHash',
|
|
652
692
|
params: [receipt.transactionHash],
|
|
653
693
|
})
|
|
654
694
|
.then((tx) => Transaction.fromRpc(tx as any))) as any
|
|
655
695
|
|
|
656
|
-
expect(feePayer).toBe(feePayerAddress)
|
|
657
696
|
expect(feeToken).toBe('0x20c0000000000000000000000000000000000001')
|
|
658
697
|
expect(from).toBe(senderAddress)
|
|
659
698
|
})
|
package/src/prool/Instance.ts
CHANGED
|
@@ -33,7 +33,7 @@ export const tempo = defineInstance((parameters: tempo.Parameters = {}) => {
|
|
|
33
33
|
const { deadline = 3, gaslimit = 3000000000, maxTasks = 8 } = builder ?? {}
|
|
34
34
|
const { blockTime = '1sec' } = dev ?? {}
|
|
35
35
|
const {
|
|
36
|
-
|
|
36
|
+
addresses = ['0x20c0000000000000000000000000000000000001'],
|
|
37
37
|
amount = '1000000000000',
|
|
38
38
|
privateKey = '0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80',
|
|
39
39
|
} = faucet ?? {}
|
|
@@ -89,6 +89,7 @@ export const tempo = defineInstance((parameters: tempo.Parameters = {}) => {
|
|
|
89
89
|
--engine.disable-precompile-cache \
|
|
90
90
|
--engine.legacy-state-root \
|
|
91
91
|
--faucet.enabled \
|
|
92
|
+
--faucet.address ${addresses.join(' ')} \
|
|
92
93
|
--http \
|
|
93
94
|
${toArgs({
|
|
94
95
|
...args,
|
|
@@ -103,7 +104,6 @@ export const tempo = defineInstance((parameters: tempo.Parameters = {}) => {
|
|
|
103
104
|
blockTime,
|
|
104
105
|
},
|
|
105
106
|
faucet: {
|
|
106
|
-
address,
|
|
107
107
|
amount,
|
|
108
108
|
privateKey,
|
|
109
109
|
},
|
|
@@ -201,9 +201,9 @@ export declare namespace tempo {
|
|
|
201
201
|
faucet?:
|
|
202
202
|
| {
|
|
203
203
|
/**
|
|
204
|
-
* Target token
|
|
204
|
+
* Target token addresses for the faucet to be funding with
|
|
205
205
|
*/
|
|
206
|
-
|
|
206
|
+
addresses?: string[] | undefined
|
|
207
207
|
/**
|
|
208
208
|
* Amount for each faucet funding transaction
|
|
209
209
|
*/
|
|
@@ -87,6 +87,7 @@ export async function fundSync<chain extends Chain | undefined>(
|
|
|
87
87
|
client: Client<Transport, chain>,
|
|
88
88
|
parameters: fundSync.Parameters,
|
|
89
89
|
): Promise<fundSync.ReturnValue> {
|
|
90
|
+
const { timeout = 10_000 } = parameters
|
|
90
91
|
const account = parseAccount(parameters.account)
|
|
91
92
|
const hashes = await client.request<{
|
|
92
93
|
Method: 'tempo_fundAddress'
|
|
@@ -97,7 +98,13 @@ export async function fundSync<chain extends Chain | undefined>(
|
|
|
97
98
|
params: [account.address],
|
|
98
99
|
})
|
|
99
100
|
const receipts = await Promise.all(
|
|
100
|
-
hashes.map((hash) =>
|
|
101
|
+
hashes.map((hash) =>
|
|
102
|
+
waitForTransactionReceipt(client, {
|
|
103
|
+
hash,
|
|
104
|
+
checkReplacement: false,
|
|
105
|
+
timeout,
|
|
106
|
+
}),
|
|
107
|
+
),
|
|
101
108
|
)
|
|
102
109
|
return receipts
|
|
103
110
|
}
|
|
@@ -106,6 +113,8 @@ export declare namespace fundSync {
|
|
|
106
113
|
export type Parameters = {
|
|
107
114
|
/** Account to fund. */
|
|
108
115
|
account: Account | Address
|
|
116
|
+
/** Timeout. */
|
|
117
|
+
timeout?: number | undefined
|
|
109
118
|
}
|
|
110
119
|
|
|
111
120
|
export type ReturnValue = readonly TransactionReceipt[]
|
package/src/viem/Chain.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
defineTransaction,
|
|
3
|
+
defineTransactionReceipt,
|
|
3
4
|
defineTransactionRequest,
|
|
4
5
|
type SerializeTransactionFn,
|
|
5
6
|
type Chain as viem_Chain,
|
|
@@ -36,6 +37,9 @@ function config<const chain extends Chain>(chain: chain) {
|
|
|
36
37
|
transaction: defineTransaction({
|
|
37
38
|
format: Formatters.formatTransaction,
|
|
38
39
|
}),
|
|
40
|
+
transactionReceipt: defineTransactionReceipt({
|
|
41
|
+
format: Formatters.formatTransactionReceipt,
|
|
42
|
+
}),
|
|
39
43
|
transactionRequest: defineTransactionRequest({
|
|
40
44
|
format: (
|
|
41
45
|
...[request, action]: Parameters<
|
package/src/viem/Formatters.ts
CHANGED
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
type Chain,
|
|
6
6
|
type Account as viem_Account,
|
|
7
7
|
formatTransaction as viem_formatTransaction,
|
|
8
|
+
formatTransactionReceipt as viem_formatTransactionReceipt,
|
|
8
9
|
formatTransactionRequest as viem_formatTransactionRequest,
|
|
9
10
|
} from 'viem'
|
|
10
11
|
import { parseAccount } from 'viem/accounts'
|
|
@@ -15,14 +16,16 @@ import type { GetFeeTokenParameter } from './internal/types.js'
|
|
|
15
16
|
import {
|
|
16
17
|
isTempo,
|
|
17
18
|
type Transaction,
|
|
19
|
+
type TransactionReceipt,
|
|
20
|
+
type TransactionReceiptRpc,
|
|
18
21
|
type TransactionRequest,
|
|
19
22
|
type TransactionRequestRpc,
|
|
20
23
|
type TransactionRpc,
|
|
21
24
|
} from './Transaction.js'
|
|
22
25
|
|
|
23
|
-
export
|
|
26
|
+
export function formatTransaction(
|
|
24
27
|
transaction: TransactionRpc,
|
|
25
|
-
): Transaction<bigint, number, boolean>
|
|
28
|
+
): Transaction<bigint, number, boolean> {
|
|
26
29
|
if (!isTempo(transaction)) return viem_formatTransaction(transaction as never)
|
|
27
30
|
|
|
28
31
|
const {
|
|
@@ -58,15 +61,21 @@ export const formatTransaction = (
|
|
|
58
61
|
}
|
|
59
62
|
}
|
|
60
63
|
|
|
64
|
+
export function formatTransactionReceipt(
|
|
65
|
+
receipt: TransactionReceiptRpc,
|
|
66
|
+
): TransactionReceipt {
|
|
67
|
+
return viem_formatTransactionReceipt(receipt as never)
|
|
68
|
+
}
|
|
69
|
+
|
|
61
70
|
type Request<chain extends Chain | undefined> = UnionOmit<
|
|
62
71
|
TransactionRequest,
|
|
63
72
|
'feeToken'
|
|
64
73
|
> &
|
|
65
74
|
GetFeeTokenParameter<chain> & { account?: viem_Account | undefined }
|
|
66
|
-
export
|
|
75
|
+
export function formatTransactionRequest<chain extends Chain | undefined>(
|
|
67
76
|
r: Request<chain>,
|
|
68
77
|
action?: string | undefined,
|
|
69
|
-
): TransactionRequestRpc
|
|
78
|
+
): TransactionRequestRpc {
|
|
70
79
|
const request = r as Request<chain>
|
|
71
80
|
|
|
72
81
|
// Convert EIP-1559 transactions to AA transactions.
|