tempo.ts 0.4.3 → 0.5.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.
Files changed (55) hide show
  1. package/README.md +2 -3
  2. package/dist/chains.d.ts +15 -1
  3. package/dist/chains.d.ts.map +1 -1
  4. package/dist/chains.js +2 -1
  5. package/dist/chains.js.map +1 -1
  6. package/dist/prool/Instance.d.ts +12 -4
  7. package/dist/prool/Instance.d.ts.map +1 -1
  8. package/dist/prool/Instance.js +34 -18
  9. package/dist/prool/Instance.js.map +1 -1
  10. package/dist/viem/Actions/faucet.d.ts +34 -1
  11. package/dist/viem/Actions/faucet.d.ts.map +1 -1
  12. package/dist/viem/Actions/faucet.js +35 -0
  13. package/dist/viem/Actions/faucet.js.map +1 -1
  14. package/dist/viem/Actions/token.d.ts +12 -12
  15. package/dist/viem/Actions/token.js +12 -12
  16. package/dist/viem/Chain.d.ts +6 -0
  17. package/dist/viem/Chain.d.ts.map +1 -1
  18. package/dist/viem/Decorator.d.ts +9 -9
  19. package/dist/viem/Transaction.d.ts +4 -1
  20. package/dist/viem/Transaction.d.ts.map +1 -1
  21. package/dist/viem/Transaction.js.map +1 -1
  22. package/dist/wagmi/Actions/token.d.ts +1 -1
  23. package/dist/wagmi/Actions/token.js +1 -1
  24. package/dist/wagmi/Connector.d.ts +4 -3
  25. package/dist/wagmi/Connector.d.ts.map +1 -1
  26. package/dist/wagmi/Connector.js +91 -5
  27. package/dist/wagmi/Connector.js.map +1 -1
  28. package/dist/wagmi/Hooks/token.d.ts +1 -1
  29. package/dist/wagmi/Hooks/token.js +1 -1
  30. package/package.json +1 -1
  31. package/src/chains.ts +2 -1
  32. package/src/ox/TransactionEnvelopeAA.test.ts +2 -663
  33. package/src/ox/e2e.test.ts +659 -0
  34. package/src/prool/Instance.ts +51 -23
  35. package/src/tsconfig.json +2 -2
  36. package/src/viem/Actions/amm.test.ts +68 -58
  37. package/src/viem/Actions/dex.test.ts +339 -283
  38. package/src/viem/Actions/faucet.ts +63 -1
  39. package/src/viem/Actions/fee.test.ts +34 -43
  40. package/src/viem/Actions/policy.test.ts +115 -81
  41. package/src/viem/Actions/reward.test.ts +92 -74
  42. package/src/viem/Actions/token.test.ts +691 -529
  43. package/src/viem/Actions/token.ts +12 -12
  44. package/src/viem/Decorator.ts +9 -9
  45. package/src/viem/Transaction.ts +4 -1
  46. package/src/viem/e2e.test.ts +451 -472
  47. package/src/wagmi/Actions/amm.test.ts +2 -5
  48. package/src/wagmi/Actions/dex.test.ts +2 -1
  49. package/src/wagmi/Actions/token.test.ts +2 -1
  50. package/src/wagmi/Actions/token.ts +1 -1
  51. package/src/wagmi/Connector.ts +125 -10
  52. package/src/wagmi/Hooks/amm.test.ts +2 -5
  53. package/src/wagmi/Hooks/dex.test.ts +2 -1
  54. package/src/wagmi/Hooks/token.test.ts +2 -1
  55. package/src/wagmi/Hooks/token.ts +1 -1
@@ -2,29 +2,21 @@ import * as Http from 'node:http'
2
2
  import { createRequestListener } from '@remix-run/node-fetch-server'
3
3
  import { RpcRequest, RpcResponse, WebCryptoP256 } from 'ox'
4
4
  import { Account, Transaction } from 'tempo.ts/viem'
5
- import {
6
- createClient,
7
- http,
8
- parseUnits,
9
- publicActions,
10
- walletActions,
11
- } from 'viem'
5
+ import { http, parseGwei, publicActions, walletActions } from 'viem'
12
6
  import { privateKeyToAccount } from 'viem/accounts'
13
7
  import { afterAll, afterEach, beforeAll, describe, expect, test } from 'vitest'
8
+ import { fetchOptions, rpcUrl } from '../../test/config.js'
14
9
  import {
15
10
  accounts,
16
- addresses,
17
- rpcUrl,
18
- tempoTest,
11
+ client as client_,
12
+ fundAddress,
13
+ getClient,
19
14
  } from '../../test/viem/config.js'
20
15
  import * as actions from './Actions/index.js'
21
16
  import { tempoActions } from './index.js'
22
17
  import { withFeePayer } from './Transport.js'
23
18
 
24
- const client = createClient({
25
- chain: tempoTest({ feeToken: 1n }),
26
- transport: http(),
27
- })
19
+ const client = client_
28
20
  .extend(publicActions)
29
21
  .extend(walletActions)
30
22
  .extend(tempoActions())
@@ -37,17 +29,36 @@ describe('sendTransaction', () => {
37
29
  const hash = await client.sendTransaction({
38
30
  account,
39
31
  data: '0xdeadbeef',
40
- feeToken: '0x20c0000000000000000000000000000000000001',
41
32
  to: '0x0000000000000000000000000000000000000000',
42
33
  })
43
34
  await client.waitForTransactionReceipt({ hash })
44
35
 
45
36
  const {
46
- blockHash: _,
47
- blockNumber: __,
37
+ blockHash,
38
+ blockNumber,
39
+ chainId,
40
+ from,
41
+ gas,
42
+ gasPrice,
43
+ hash: hash_,
44
+ maxFeePerGas,
45
+ maxPriorityFeePerGas,
46
+ nonce,
47
+ signature,
48
48
  ...transaction
49
49
  } = await client.getTransaction({ hash })
50
50
 
51
+ expect(blockHash).toBeDefined()
52
+ expect(blockNumber).toBeDefined()
53
+ expect(chainId).toBeDefined()
54
+ expect(from).toBe(account.address.toLowerCase())
55
+ expect(gas).toBeDefined()
56
+ expect(gasPrice).toBeDefined()
57
+ expect(hash_).toBe(hash)
58
+ expect(maxFeePerGas).toBeDefined()
59
+ expect(maxPriorityFeePerGas).toBeDefined()
60
+ expect(nonce).toBeDefined()
61
+ expect(signature).toBeDefined()
51
62
  expect(transaction).toMatchInlineSnapshot(`
52
63
  {
53
64
  "aaAuthorizationList": [],
@@ -60,27 +71,11 @@ describe('sendTransaction', () => {
60
71
  "value": 0n,
61
72
  },
62
73
  ],
63
- "chainId": 1337,
64
74
  "data": undefined,
65
75
  "feePayerSignature": undefined,
66
76
  "feeToken": "0x20c0000000000000000000000000000000000001",
67
- "from": "0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266",
68
- "gas": 24002n,
69
- "gasPrice": 10000000000n,
70
- "hash": "0x19ffdd8817d0180edc18be1ab5001445eaf267713e8d5f9e87e9b481413aca46",
71
77
  "maxFeePerBlobGas": undefined,
72
- "maxFeePerGas": 12000000000n,
73
- "maxPriorityFeePerGas": 0n,
74
- "nonce": 0,
75
78
  "nonceKey": 0n,
76
- "signature": {
77
- "signature": {
78
- "r": 18480044007397695090640579354047056183881606998783899463314972543335313635471n,
79
- "s": 7944214793912353709460484452936700808754473617494909879093391150696529863949n,
80
- "yParity": 1,
81
- },
82
- "type": "secp256k1",
83
- },
84
79
  "to": null,
85
80
  "transactionIndex": 1,
86
81
  "type": "aa",
@@ -95,8 +90,10 @@ describe('sendTransaction', () => {
95
90
  })
96
91
 
97
92
  test('with calls', async () => {
93
+ const account = accounts[0]
94
+
98
95
  const hash = await client.sendTransaction({
99
- account: accounts[0],
96
+ account,
100
97
  calls: [
101
98
  actions.token.create.call({
102
99
  admin: accounts[0].address,
@@ -108,46 +105,44 @@ describe('sendTransaction', () => {
108
105
  })
109
106
  await client.waitForTransactionReceipt({ hash })
110
107
 
111
- const transaction = await client.getTransaction({ hash })
112
- expect({
113
- ...transaction,
114
- blockHash: undefined,
115
- blockNumber: undefined,
116
- }).toMatchInlineSnapshot(`
108
+ const {
109
+ blockHash,
110
+ blockNumber,
111
+ calls,
112
+ chainId,
113
+ from,
114
+ gas,
115
+ gasPrice,
116
+ hash: hash_,
117
+ maxFeePerGas,
118
+ maxPriorityFeePerGas,
119
+ nonce,
120
+ signature,
121
+ ...transaction
122
+ } = await client.getTransaction({ hash })
123
+
124
+ expect(blockHash).toBeDefined()
125
+ expect(blockNumber).toBeDefined()
126
+ expect(calls?.length).toBe(1)
127
+ expect(chainId).toBeDefined()
128
+ expect(from).toBe(account.address.toLowerCase())
129
+ expect(gas).toBeDefined()
130
+ expect(gasPrice).toBeDefined()
131
+ expect(hash_).toBe(hash)
132
+ expect(maxFeePerGas).toBeDefined()
133
+ expect(maxPriorityFeePerGas).toBeDefined()
134
+ expect(nonce).toBeDefined()
135
+ expect(signature).toBeDefined()
136
+ expect(transaction).toMatchInlineSnapshot(`
117
137
  {
118
138
  "aaAuthorizationList": [],
119
139
  "accessList": [],
120
140
  "authorizationList": undefined,
121
- "blockHash": undefined,
122
- "blockNumber": undefined,
123
- "calls": [
124
- {
125
- "data": "0xb395b9ac00000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000012000000000000000000000000020c0000000000000000000000000000000000000000000000000000000000000f39fd6e51aad88f6f4ce6ab8827279cfffb92266000000000000000000000000000000000000000000000000000000000000000c5465737420546f6b656e203300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005544553543300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000035553440000000000000000000000000000000000000000000000000000000000",
126
- "to": "0x20fc000000000000000000000000000000000000",
127
- "value": 0n,
128
- },
129
- ],
130
- "chainId": 1337,
131
141
  "data": undefined,
132
142
  "feePayerSignature": undefined,
133
143
  "feeToken": "0x20c0000000000000000000000000000000000001",
134
- "from": "0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266",
135
- "gas": 217317n,
136
- "gasPrice": 10000000000n,
137
- "hash": "0x5644cb4aca7b42c7f4d28c324b9cbc4d0ba4ff3aeddbe41fa418a5966923ab36",
138
144
  "maxFeePerBlobGas": undefined,
139
- "maxFeePerGas": 12000000000n,
140
- "maxPriorityFeePerGas": 0n,
141
- "nonce": 1,
142
145
  "nonceKey": 0n,
143
- "signature": {
144
- "signature": {
145
- "r": 1770799250379385769866461071353582741695856909786638355195145760341199788761n,
146
- "s": 52417275998342468381261131517961079083566057345688940928298921493890348732163n,
147
- "yParity": 1,
148
- },
149
- "type": "secp256k1",
150
- },
151
146
  "to": null,
152
147
  "transactionIndex": 1,
153
148
  "type": "aa",
@@ -176,11 +171,35 @@ describe('sendTransaction', () => {
176
171
  await client.waitForTransactionReceipt({ hash })
177
172
 
178
173
  const {
179
- blockHash: _,
180
- blockNumber: __,
174
+ blockHash,
175
+ blockNumber,
176
+ chainId,
177
+ feePayer: feePayer_,
178
+ feePayerSignature,
179
+ from,
180
+ gas,
181
+ gasPrice,
182
+ hash: hash_,
183
+ maxFeePerGas,
184
+ maxPriorityFeePerGas,
185
+ nonce,
186
+ signature,
181
187
  ...transaction
182
188
  } = await client.getTransaction({ hash })
183
189
 
190
+ expect(blockHash).toBeDefined()
191
+ expect(blockNumber).toBeDefined()
192
+ expect(chainId).toBeDefined()
193
+ expect(feePayer_).toBe(feePayer.address.toLowerCase())
194
+ expect(feePayerSignature).toBeDefined()
195
+ expect(from).toBe(account.address.toLowerCase())
196
+ expect(gas).toBeDefined()
197
+ expect(gasPrice).toBeDefined()
198
+ expect(hash_).toBe(hash)
199
+ expect(maxFeePerGas).toBeDefined()
200
+ expect(maxPriorityFeePerGas).toBeDefined()
201
+ expect(nonce).toBeDefined()
202
+ expect(signature).toBeDefined()
184
203
  expect(transaction).toMatchInlineSnapshot(`
185
204
  {
186
205
  "aaAuthorizationList": [],
@@ -193,33 +212,10 @@ describe('sendTransaction', () => {
193
212
  "value": 0n,
194
213
  },
195
214
  ],
196
- "chainId": 1337,
197
215
  "data": undefined,
198
- "feePayer": "0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266",
199
- "feePayerSignature": {
200
- "r": "0x8f719d9463938d85897ee74b518c4121995791c59873199e2bbc1d9d69a458b6",
201
- "s": "0x45c622bec0e381c5a06cfe7c5397cace1f7972137cefd1eba87174d7936a689c",
202
- "v": 27n,
203
- "yParity": 0,
204
- },
205
216
  "feeToken": null,
206
- "from": "0x740474977e01d056f04a314b5537e4dd88f35952",
207
- "gas": 23938n,
208
- "gasPrice": 10000000000n,
209
- "hash": "0x5aae48907ceccf3331f634bf9a76fe51f52576000e4becac929ed04d953fb0bb",
210
217
  "maxFeePerBlobGas": undefined,
211
- "maxFeePerGas": 12000000000n,
212
- "maxPriorityFeePerGas": 0n,
213
- "nonce": 0,
214
218
  "nonceKey": 0n,
215
- "signature": {
216
- "signature": {
217
- "r": 65079212976636076484448674374308068589367423744201870901549594095730781246312n,
218
- "s": 36138663572355181246084885182221172668063229180861599797673217267233822764445n,
219
- "yParity": 1,
220
- },
221
- "type": "secp256k1",
222
- },
223
219
  "to": null,
224
220
  "transactionIndex": 1,
225
221
  "type": "aa",
@@ -241,12 +237,7 @@ describe('sendTransaction', () => {
241
237
  )
242
238
 
243
239
  // fund account
244
- await client.token.transferSync({
245
- account: accounts[0],
246
- token: addresses.alphaUsd,
247
- to: account.address,
248
- amount: parseUnits('10000', 6),
249
- })
240
+ await fundAddress(client, { address: account.address })
250
241
 
251
242
  const receipt = await client.sendTransactionSync({
252
243
  account,
@@ -254,20 +245,39 @@ describe('sendTransaction', () => {
254
245
  to: '0x0000000000000000000000000000000000000000',
255
246
  })
256
247
 
257
- const transaction = await client.getTransaction({
248
+ const {
249
+ blockHash,
250
+ blockNumber,
251
+ chainId,
252
+ from,
253
+ gas,
254
+ gasPrice,
255
+ hash,
256
+ maxFeePerGas,
257
+ maxPriorityFeePerGas,
258
+ nonce,
259
+ signature,
260
+ ...transaction
261
+ } = await client.getTransaction({
258
262
  hash: receipt.transactionHash,
259
263
  })
260
- expect({
261
- ...transaction,
262
- blockHash: undefined,
263
- blockNumber: undefined,
264
- }).toMatchInlineSnapshot(`
264
+
265
+ expect(blockHash).toBeDefined()
266
+ expect(blockNumber).toBeDefined()
267
+ expect(chainId).toBeDefined()
268
+ expect(from).toBe(account.address.toLowerCase())
269
+ expect(gas).toBeDefined()
270
+ expect(gasPrice).toBeDefined()
271
+ expect(hash).toBe(receipt.transactionHash)
272
+ expect(maxFeePerGas).toBeDefined()
273
+ expect(maxPriorityFeePerGas).toBeDefined()
274
+ expect(nonce).toBeDefined()
275
+ expect(signature).toBeDefined()
276
+ expect(transaction).toMatchInlineSnapshot(`
265
277
  {
266
278
  "aaAuthorizationList": [],
267
279
  "accessList": [],
268
280
  "authorizationList": undefined,
269
- "blockHash": undefined,
270
- "blockNumber": undefined,
271
281
  "calls": [
272
282
  {
273
283
  "data": "0xdeadbeef",
@@ -275,32 +285,11 @@ describe('sendTransaction', () => {
275
285
  "value": 0n,
276
286
  },
277
287
  ],
278
- "chainId": 1337,
279
288
  "data": undefined,
280
289
  "feePayerSignature": undefined,
281
290
  "feeToken": "0x20c0000000000000000000000000000000000001",
282
- "from": "0xfc39755d501fa7b79164f74efb906e87ecde342c",
283
- "gas": 29012n,
284
- "gasPrice": 10000000000n,
285
- "hash": "0x92497c48650181f386b4daeb3f784620b29af6dea6c8caeb995156f3f75af161",
286
291
  "maxFeePerBlobGas": undefined,
287
- "maxFeePerGas": 12000000000n,
288
- "maxPriorityFeePerGas": 0n,
289
- "nonce": 0,
290
292
  "nonceKey": 0n,
291
- "signature": {
292
- "prehash": undefined,
293
- "publicKey": {
294
- "prefix": 4,
295
- "x": 76851314197341596384765982852901663495246887984601955818013524729577854391357n,
296
- "y": 28479403900638612718017087999484027026245572142646745985103165612268853186552n,
297
- },
298
- "signature": {
299
- "r": 73166565759729379192178736994258501393133045207516873483983141310238393892339n,
300
- "s": 9678569667446118283593635726095491566145915132050642248430996816820250471583n,
301
- },
302
- "type": "p256",
303
- },
304
293
  "to": null,
305
294
  "transactionIndex": 1,
306
295
  "type": "aa",
@@ -320,12 +309,7 @@ describe('sendTransaction', () => {
320
309
  )
321
310
 
322
311
  // fund account
323
- await client.token.transferSync({
324
- account: accounts[0],
325
- token: addresses.alphaUsd,
326
- to: account.address,
327
- amount: parseUnits('10000', 6),
328
- })
312
+ await fundAddress(client, { address: account.address })
329
313
 
330
314
  const receipt = await client.sendTransactionSync({
331
315
  account,
@@ -341,53 +325,46 @@ describe('sendTransaction', () => {
341
325
  gas: 100_000n,
342
326
  })
343
327
 
344
- const transaction = await client.getTransaction({
328
+ const {
329
+ blockHash,
330
+ blockNumber,
331
+ calls,
332
+ chainId,
333
+ from,
334
+ gas,
335
+ gasPrice,
336
+ hash,
337
+ maxFeePerGas,
338
+ maxPriorityFeePerGas,
339
+ nonce,
340
+ signature,
341
+ ...transaction
342
+ } = await client.getTransaction({
345
343
  hash: receipt.transactionHash,
346
344
  })
347
- expect({
348
- ...transaction,
349
- blockHash: undefined,
350
- blockNumber: undefined,
351
- }).toMatchInlineSnapshot(`
345
+
346
+ expect(blockHash).toBeDefined()
347
+ expect(blockNumber).toBeDefined()
348
+ expect(calls?.length).toBe(1)
349
+ expect(chainId).toBeDefined()
350
+ expect(from).toBe(account.address.toLowerCase())
351
+ expect(gas).toBeDefined()
352
+ expect(gasPrice).toBeDefined()
353
+ expect(hash).toBe(receipt.transactionHash)
354
+ expect(maxFeePerGas).toBeDefined()
355
+ expect(maxPriorityFeePerGas).toBeDefined()
356
+ expect(nonce).toBeDefined()
357
+ expect(signature).toBeDefined()
358
+ expect(transaction).toMatchInlineSnapshot(`
352
359
  {
353
360
  "aaAuthorizationList": [],
354
361
  "accessList": [],
355
362
  "authorizationList": undefined,
356
- "blockHash": undefined,
357
- "blockNumber": undefined,
358
- "calls": [
359
- {
360
- "data": "0xb395b9ac00000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000012000000000000000000000000020c0000000000000000000000000000000000000000000000000000000000000fc39755d501fa7b79164f74efb906e87ecde342c000000000000000000000000000000000000000000000000000000000000000c5465737420546f6b656e203400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005544553543400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000035553440000000000000000000000000000000000000000000000000000000000",
361
- "to": "0x20fc000000000000000000000000000000000000",
362
- "value": 0n,
363
- },
364
- ],
365
- "chainId": 1337,
366
363
  "data": undefined,
367
364
  "feePayerSignature": undefined,
368
365
  "feeToken": "0x20c0000000000000000000000000000000000001",
369
- "from": "0xfc39755d501fa7b79164f74efb906e87ecde342c",
370
- "gas": 100000n,
371
- "gasPrice": 10000000000n,
372
- "hash": "0x42d24b367d36fe86a48a5d3e569a4a7f528eba99c44e17304c6e88ba29e50666",
373
366
  "maxFeePerBlobGas": undefined,
374
- "maxFeePerGas": 12000000000n,
375
- "maxPriorityFeePerGas": 0n,
376
- "nonce": 1,
377
367
  "nonceKey": 0n,
378
- "signature": {
379
- "prehash": undefined,
380
- "publicKey": {
381
- "prefix": 4,
382
- "x": 76851314197341596384765982852901663495246887984601955818013524729577854391357n,
383
- "y": 28479403900638612718017087999484027026245572142646745985103165612268853186552n,
384
- },
385
- "signature": {
386
- "r": 106143051119266858928184523090857221408816991676370960197147810502258413383473n,
387
- "s": 49844357009853267306291709813432165511067109946085107128095783518674413076631n,
388
- },
389
- "type": "p256",
390
- },
391
368
  "to": null,
392
369
  "transactionIndex": 1,
393
370
  "type": "aa",
@@ -416,11 +393,35 @@ describe('sendTransaction', () => {
416
393
  await client.waitForTransactionReceipt({ hash })
417
394
 
418
395
  const {
419
- blockHash: _,
420
- blockNumber: __,
396
+ blockHash,
397
+ blockNumber,
398
+ chainId,
399
+ feePayer: feePayer_,
400
+ feePayerSignature,
401
+ from,
402
+ gas,
403
+ gasPrice,
404
+ hash: hash_,
405
+ maxFeePerGas,
406
+ maxPriorityFeePerGas,
407
+ nonce,
408
+ signature,
421
409
  ...transaction
422
410
  } = await client.getTransaction({ hash })
423
411
 
412
+ expect(blockHash).toBeDefined()
413
+ expect(blockNumber).toBeDefined()
414
+ expect(chainId).toBeDefined()
415
+ expect(feePayer_).toBe(feePayer.address.toLowerCase())
416
+ expect(feePayerSignature).toBeDefined()
417
+ expect(from).toBe(account.address.toLowerCase())
418
+ expect(gas).toBeDefined()
419
+ expect(gasPrice).toBeDefined()
420
+ expect(hash_).toBe(hash)
421
+ expect(maxFeePerGas).toBeDefined()
422
+ expect(maxPriorityFeePerGas).toBeDefined()
423
+ expect(nonce).toBeDefined()
424
+ expect(signature).toBeDefined()
424
425
  expect(transaction).toMatchInlineSnapshot(`
425
426
  {
426
427
  "aaAuthorizationList": [],
@@ -433,38 +434,10 @@ describe('sendTransaction', () => {
433
434
  "value": 0n,
434
435
  },
435
436
  ],
436
- "chainId": 1337,
437
437
  "data": undefined,
438
- "feePayer": "0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266",
439
- "feePayerSignature": {
440
- "r": "0x9d9e74278c306658fff5cca2a736f07c475d3dbe4b931ba73be8543d522b5430",
441
- "s": "0x2224242aaf6fa17b8f2266bea1ad501837c2c2ad13e0d96b9ed29ecb60ba1ac4",
442
- "v": 27n,
443
- "yParity": 0,
444
- },
445
438
  "feeToken": null,
446
- "from": "0x5f704c6c7075acd14ee36527f03b5b5dcb4a966f",
447
- "gas": 28947n,
448
- "gasPrice": 10000000000n,
449
- "hash": "0x77ce7f3b60540465d681b360293aaafca496c0a2ff2a4f5f146f144206a487dd",
450
439
  "maxFeePerBlobGas": undefined,
451
- "maxFeePerGas": 12000000000n,
452
- "maxPriorityFeePerGas": 0n,
453
- "nonce": 0,
454
440
  "nonceKey": 0n,
455
- "signature": {
456
- "prehash": undefined,
457
- "publicKey": {
458
- "prefix": 4,
459
- "x": 89768657165983002447270155621964907577955735922001002175265262336201091268103n,
460
- "y": 21692506528696391747937034302216251793515398807520467579078748804389014172835n,
461
- },
462
- "signature": {
463
- "r": 6861653902973636215987311933940928353425544366774814432483697786223275705586n,
464
- "s": 7277254520198161524871116736077233939785567558470334763663181456500888822079n,
465
- },
466
- "type": "p256",
467
- },
468
441
  "to": null,
469
442
  "transactionIndex": 1,
470
443
  "type": "aa",
@@ -485,12 +458,7 @@ describe('sendTransaction', () => {
485
458
  const account = Account.fromWebCryptoP256(keyPair)
486
459
 
487
460
  // fund account
488
- await client.token.transferSync({
489
- account: accounts[0],
490
- token: addresses.alphaUsd,
491
- to: account.address,
492
- amount: parseUnits('10000', 6),
493
- })
461
+ await fundAddress(client, { address: account.address })
494
462
 
495
463
  const receipt = await client.sendTransactionSync({
496
464
  account,
@@ -498,23 +466,37 @@ describe('sendTransaction', () => {
498
466
  to: '0x0000000000000000000000000000000000000000',
499
467
  })
500
468
 
501
- const transaction = await client.getTransaction({
469
+ const {
470
+ blockHash,
471
+ blockNumber,
472
+ chainId,
473
+ from,
474
+ gasPrice,
475
+ hash,
476
+ maxFeePerGas,
477
+ maxPriorityFeePerGas,
478
+ nonce,
479
+ signature,
480
+ ...transaction
481
+ } = await client.getTransaction({
502
482
  hash: receipt.transactionHash,
503
483
  })
504
- expect({
505
- ...transaction,
506
- blockHash: undefined,
507
- blockNumber: undefined,
508
- from: undefined,
509
- hash: undefined,
510
- signature: undefined,
511
- }).toMatchInlineSnapshot(`
484
+
485
+ expect(blockHash).toBeDefined()
486
+ expect(blockNumber).toBeDefined()
487
+ expect(chainId).toBeDefined()
488
+ expect(from).toBeDefined()
489
+ expect(gasPrice).toBeDefined()
490
+ expect(hash).toBe(receipt.transactionHash)
491
+ expect(maxFeePerGas).toBeDefined()
492
+ expect(maxPriorityFeePerGas).toBeDefined()
493
+ expect(nonce).toBeDefined()
494
+ expect(signature).toBeDefined()
495
+ expect(transaction).toMatchInlineSnapshot(`
512
496
  {
513
497
  "aaAuthorizationList": [],
514
498
  "accessList": [],
515
499
  "authorizationList": undefined,
516
- "blockHash": undefined,
517
- "blockNumber": undefined,
518
500
  "calls": [
519
501
  {
520
502
  "data": "0xdeadbeef",
@@ -522,20 +504,12 @@ describe('sendTransaction', () => {
522
504
  "value": 0n,
523
505
  },
524
506
  ],
525
- "chainId": 1337,
526
507
  "data": undefined,
527
508
  "feePayerSignature": undefined,
528
509
  "feeToken": "0x20c0000000000000000000000000000000000001",
529
- "from": undefined,
530
510
  "gas": 29012n,
531
- "gasPrice": 10000000000n,
532
- "hash": undefined,
533
511
  "maxFeePerBlobGas": undefined,
534
- "maxFeePerGas": 12000000000n,
535
- "maxPriorityFeePerGas": 0n,
536
- "nonce": 0,
537
512
  "nonceKey": 0n,
538
- "signature": undefined,
539
513
  "to": null,
540
514
  "transactionIndex": 1,
541
515
  "type": "aa",
@@ -554,12 +528,7 @@ describe('sendTransaction', () => {
554
528
  const account = Account.fromWebCryptoP256(keyPair)
555
529
 
556
530
  // fund account
557
- await client.token.transferSync({
558
- account: accounts[0],
559
- token: addresses.alphaUsd,
560
- to: account.address,
561
- amount: parseUnits('10000', 6),
562
- })
531
+ await fundAddress(client, { address: account.address })
563
532
 
564
533
  const receipt = await client.sendTransactionSync({
565
534
  account,
@@ -575,9 +544,36 @@ describe('sendTransaction', () => {
575
544
  gas: 100_000n,
576
545
  })
577
546
 
578
- const transaction = await client.getTransaction({
547
+ const {
548
+ blockHash,
549
+ blockNumber,
550
+ calls,
551
+ chainId,
552
+ from,
553
+ gas,
554
+ gasPrice,
555
+ hash,
556
+ maxFeePerGas,
557
+ maxPriorityFeePerGas,
558
+ nonce,
559
+ signature,
560
+ ...transaction
561
+ } = await client.getTransaction({
579
562
  hash: receipt.transactionHash,
580
563
  })
564
+
565
+ expect(blockHash).toBeDefined()
566
+ expect(blockNumber).toBeDefined()
567
+ expect(calls?.length).toBe(1)
568
+ expect(chainId).toBeDefined()
569
+ expect(from).toBeDefined()
570
+ expect(gas).toBeDefined()
571
+ expect(gasPrice).toBeDefined()
572
+ expect(hash).toBe(receipt.transactionHash)
573
+ expect(maxFeePerGas).toBeDefined()
574
+ expect(maxPriorityFeePerGas).toBeDefined()
575
+ expect(nonce).toBeDefined()
576
+ expect(signature).toBeDefined()
581
577
  expect(transaction).toBeDefined()
582
578
  })
583
579
 
@@ -593,7 +589,30 @@ describe('sendTransaction', () => {
593
589
  })
594
590
  await client.waitForTransactionReceipt({ hash })
595
591
 
596
- const transaction = await client.getTransaction({ hash })
592
+ const {
593
+ blockHash,
594
+ blockNumber,
595
+ chainId,
596
+ from,
597
+ gasPrice,
598
+ hash: hash_,
599
+ maxFeePerGas,
600
+ maxPriorityFeePerGas,
601
+ nonce,
602
+ signature,
603
+ ...transaction
604
+ } = await client.getTransaction({ hash })
605
+
606
+ expect(blockHash).toBeDefined()
607
+ expect(blockNumber).toBeDefined()
608
+ expect(chainId).toBeDefined()
609
+ expect(from).toBeDefined()
610
+ expect(gasPrice).toBeDefined()
611
+ expect(hash_).toBe(hash)
612
+ expect(maxFeePerGas).toBeDefined()
613
+ expect(maxPriorityFeePerGas).toBeDefined()
614
+ expect(nonce).toBeDefined()
615
+ expect(signature).toBeDefined()
597
616
  expect(transaction).toBeDefined()
598
617
  })
599
618
  })
@@ -609,12 +628,7 @@ describe('sendTransaction', () => {
609
628
  )
610
629
 
611
630
  // fund account
612
- await client.token.transferSync({
613
- account: accounts[0],
614
- token: addresses.alphaUsd,
615
- to: account.address,
616
- amount: parseUnits('10000', 6),
617
- })
631
+ await fundAddress(client, { address: account.address })
618
632
 
619
633
  const receipt = await client.sendTransactionSync({
620
634
  account,
@@ -622,20 +636,39 @@ describe('sendTransaction', () => {
622
636
  to: '0x0000000000000000000000000000000000000000',
623
637
  })
624
638
 
625
- const transaction = await client.getTransaction({
639
+ const {
640
+ blockHash,
641
+ blockNumber,
642
+ chainId,
643
+ from,
644
+ gas,
645
+ gasPrice,
646
+ hash,
647
+ maxFeePerGas,
648
+ maxPriorityFeePerGas,
649
+ nonce,
650
+ signature,
651
+ ...transaction
652
+ } = await client.getTransaction({
626
653
  hash: receipt.transactionHash,
627
654
  })
628
- expect({
629
- ...transaction,
630
- blockHash: undefined,
631
- blockNumber: undefined,
632
- }).toMatchInlineSnapshot(`
655
+
656
+ expect(blockHash).toBeDefined()
657
+ expect(blockNumber).toBeDefined()
658
+ expect(chainId).toBeDefined()
659
+ expect(from).toBe(account.address.toLowerCase())
660
+ expect(gas).toBeDefined()
661
+ expect(gasPrice).toBeDefined()
662
+ expect(hash).toBe(receipt.transactionHash)
663
+ expect(maxFeePerGas).toBeDefined()
664
+ expect(maxPriorityFeePerGas).toBeDefined()
665
+ expect(nonce).toBeDefined()
666
+ expect(signature).toBeDefined()
667
+ expect(transaction).toMatchInlineSnapshot(`
633
668
  {
634
669
  "aaAuthorizationList": [],
635
670
  "accessList": [],
636
671
  "authorizationList": undefined,
637
- "blockHash": undefined,
638
- "blockNumber": undefined,
639
672
  "calls": [
640
673
  {
641
674
  "data": "0xdeadbeef",
@@ -643,35 +676,11 @@ describe('sendTransaction', () => {
643
676
  "value": 0n,
644
677
  },
645
678
  ],
646
- "chainId": 1337,
647
679
  "data": undefined,
648
680
  "feePayerSignature": undefined,
649
681
  "feeToken": "0x20c0000000000000000000000000000000000001",
650
- "from": "0xfc39755d501fa7b79164f74efb906e87ecde342c",
651
- "gas": 41404n,
652
- "gasPrice": 10000000000n,
653
- "hash": "0x0f9754978f1533d5e8a94c8f6e564150b8ca560a145d7adbafa95537cdd661e0",
654
682
  "maxFeePerBlobGas": undefined,
655
- "maxFeePerGas": 12000000000n,
656
- "maxPriorityFeePerGas": 0n,
657
- "nonce": 2,
658
683
  "nonceKey": 0n,
659
- "signature": {
660
- "metadata": {
661
- "authenticatorData": "0x49960de5880e8c687434170f6476605b8fe4aeb9a28632c7995cf3ba831d97630500000000",
662
- "clientDataJSON": "{"type":"webauthn.get","challenge":"pGxfglkRHnxAvl1iNopy9f3dCpA0yOtMWD52o4QjFIM","origin":"http://localhost","crossOrigin":false}",
663
- },
664
- "publicKey": {
665
- "prefix": 4,
666
- "x": 76851314197341596384765982852901663495246887984601955818013524729577854391357n,
667
- "y": 28479403900638612718017087999484027026245572142646745985103165612268853186552n,
668
- },
669
- "signature": {
670
- "r": 46181083089071531854644596388726939003590007726502882093676118825353436035851n,
671
- "s": 40251117141811933316754610200955094367484007878478703779665518197624832232922n,
672
- },
673
- "type": "webAuthn",
674
- },
675
684
  "to": null,
676
685
  "transactionIndex": 1,
677
686
  "type": "aa",
@@ -695,12 +704,7 @@ describe('sendTransaction', () => {
695
704
  )
696
705
 
697
706
  // fund account
698
- await client.token.transferSync({
699
- account: accounts[0],
700
- token: addresses.alphaUsd,
701
- to: account.address,
702
- amount: parseUnits('10000', 6),
703
- })
707
+ await fundAddress(client, { address: account.address })
704
708
 
705
709
  const receipt = await client.sendTransactionSync({
706
710
  account,
@@ -716,56 +720,46 @@ describe('sendTransaction', () => {
716
720
  gas: 100_000n,
717
721
  })
718
722
 
719
- const transaction = await client.getTransaction({
723
+ const {
724
+ blockHash,
725
+ blockNumber,
726
+ calls,
727
+ chainId,
728
+ from,
729
+ gas,
730
+ gasPrice,
731
+ hash,
732
+ maxFeePerGas,
733
+ maxPriorityFeePerGas,
734
+ nonce,
735
+ signature,
736
+ ...transaction
737
+ } = await client.getTransaction({
720
738
  hash: receipt.transactionHash,
721
739
  })
722
- expect({
723
- ...transaction,
724
- blockHash: undefined,
725
- blockNumber: undefined,
726
- }).toMatchInlineSnapshot(`
740
+
741
+ expect(blockHash).toBeDefined()
742
+ expect(blockNumber).toBeDefined()
743
+ expect(calls?.length).toBe(1)
744
+ expect(chainId).toBeDefined()
745
+ expect(from).toBe(account.address.toLowerCase())
746
+ expect(gas).toBeDefined()
747
+ expect(gasPrice).toBeDefined()
748
+ expect(hash).toBe(receipt.transactionHash)
749
+ expect(maxFeePerGas).toBeDefined()
750
+ expect(maxPriorityFeePerGas).toBeDefined()
751
+ expect(nonce).toBeDefined()
752
+ expect(signature).toBeDefined()
753
+ expect(transaction).toMatchInlineSnapshot(`
727
754
  {
728
755
  "aaAuthorizationList": [],
729
756
  "accessList": [],
730
757
  "authorizationList": undefined,
731
- "blockHash": undefined,
732
- "blockNumber": undefined,
733
- "calls": [
734
- {
735
- "data": "0xb395b9ac00000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000012000000000000000000000000020c0000000000000000000000000000000000000000000000000000000000000fc39755d501fa7b79164f74efb906e87ecde342c000000000000000000000000000000000000000000000000000000000000000c5465737420546f6b656e203600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005544553543600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000035553440000000000000000000000000000000000000000000000000000000000",
736
- "to": "0x20fc000000000000000000000000000000000000",
737
- "value": 0n,
738
- },
739
- ],
740
- "chainId": 1337,
741
758
  "data": undefined,
742
759
  "feePayerSignature": undefined,
743
760
  "feeToken": "0x20c0000000000000000000000000000000000001",
744
- "from": "0xfc39755d501fa7b79164f74efb906e87ecde342c",
745
- "gas": 100000n,
746
- "gasPrice": 10000000000n,
747
- "hash": "0x9e431e3d0b4a04c5779d0918b1d3140429530c19cada91e5da2eb66edcd77efa",
748
761
  "maxFeePerBlobGas": undefined,
749
- "maxFeePerGas": 12000000000n,
750
- "maxPriorityFeePerGas": 0n,
751
- "nonce": 3,
752
762
  "nonceKey": 0n,
753
- "signature": {
754
- "metadata": {
755
- "authenticatorData": "0x49960de5880e8c687434170f6476605b8fe4aeb9a28632c7995cf3ba831d97630500000000",
756
- "clientDataJSON": "{"type":"webauthn.get","challenge":"DAabvi2LJ45ESyCwmmyBACb6VS9MdItb_FksnNfg2ZI","origin":"http://localhost","crossOrigin":false}",
757
- },
758
- "publicKey": {
759
- "prefix": 4,
760
- "x": 76851314197341596384765982852901663495246887984601955818013524729577854391357n,
761
- "y": 28479403900638612718017087999484027026245572142646745985103165612268853186552n,
762
- },
763
- "signature": {
764
- "r": 89695469468583132282454887497226949335068684032456007061013932756262487728086n,
765
- "s": 30364371922186410926529917972734911437767801874356315397917029751067680712123n,
766
- },
767
- "type": "webAuthn",
768
- },
769
763
  "to": null,
770
764
  "transactionIndex": 1,
771
765
  "type": "aa",
@@ -798,11 +792,35 @@ describe('sendTransaction', () => {
798
792
  await client.waitForTransactionReceipt({ hash })
799
793
 
800
794
  const {
801
- blockHash: _,
802
- blockNumber: __,
795
+ blockHash,
796
+ blockNumber,
797
+ chainId,
798
+ feePayer: feePayer_,
799
+ feePayerSignature,
800
+ from,
801
+ gas,
802
+ gasPrice,
803
+ hash: hash_,
804
+ maxFeePerGas,
805
+ maxPriorityFeePerGas,
806
+ nonce,
807
+ signature,
803
808
  ...transaction
804
809
  } = await client.getTransaction({ hash })
805
810
 
811
+ expect(blockHash).toBeDefined()
812
+ expect(blockNumber).toBeDefined()
813
+ expect(chainId).toBeDefined()
814
+ expect(feePayer_).toBe(feePayer.address.toLowerCase())
815
+ expect(feePayerSignature).toBeDefined()
816
+ expect(from).toBe(account.address.toLowerCase())
817
+ expect(gas).toBeDefined()
818
+ expect(gasPrice).toBeDefined()
819
+ expect(hash_).toBe(hash)
820
+ expect(maxFeePerGas).toBeDefined()
821
+ expect(maxPriorityFeePerGas).toBeDefined()
822
+ expect(nonce).toBeDefined()
823
+ expect(signature).toBeDefined()
806
824
  expect(transaction).toMatchInlineSnapshot(`
807
825
  {
808
826
  "aaAuthorizationList": [],
@@ -815,41 +833,10 @@ describe('sendTransaction', () => {
815
833
  "value": 0n,
816
834
  },
817
835
  ],
818
- "chainId": 1337,
819
836
  "data": undefined,
820
- "feePayer": "0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266",
821
- "feePayerSignature": {
822
- "r": "0x90b71f46a775d5ca06725fcef4fe4763b4dce34bb72cde30a527ec26407baa84",
823
- "s": "0x398d0192f02d503b5463b1f886790eee882f2329e7af44b8106f27930735041d",
824
- "v": 28n,
825
- "yParity": 1,
826
- },
827
837
  "feeToken": null,
828
- "from": "0x5f704c6c7075acd14ee36527f03b5b5dcb4a966f",
829
- "gas": 41340n,
830
- "gasPrice": 10000000000n,
831
- "hash": "0x6f6801526c00fba8e107e5064758bd20a978f3952b144f6c52bab1abfc913143",
832
838
  "maxFeePerBlobGas": undefined,
833
- "maxFeePerGas": 12000000000n,
834
- "maxPriorityFeePerGas": 0n,
835
- "nonce": 1,
836
839
  "nonceKey": 0n,
837
- "signature": {
838
- "metadata": {
839
- "authenticatorData": "0x49960de5880e8c687434170f6476605b8fe4aeb9a28632c7995cf3ba831d97630500000000",
840
- "clientDataJSON": "{"type":"webauthn.get","challenge":"dVrVJFewcT_ifvpphKoheG6VSAQJ_74h6g3O32Rri2Q","origin":"http://localhost","crossOrigin":false}",
841
- },
842
- "publicKey": {
843
- "prefix": 4,
844
- "x": 89768657165983002447270155621964907577955735922001002175265262336201091268103n,
845
- "y": 21692506528696391747937034302216251793515398807520467579078748804389014172835n,
846
- },
847
- "signature": {
848
- "r": 72341690970159629319932745028286754044171557161564831284038819357806396549916n,
849
- "s": 47900412910547062549030763809045404303050255516583713899170528571925897239021n,
850
- },
851
- "type": "webAuthn",
852
- },
853
840
  "to": null,
854
841
  "transactionIndex": 1,
855
842
  "type": "aa",
@@ -879,13 +866,13 @@ describe('signTransaction', () => {
879
866
  feePayer: true,
880
867
  to: '0xcafebabecafebabecafebabecafebabecafebabe',
881
868
  })
882
- let transaction = await client.signTransaction(request)
869
+ let transaction = await client.signTransaction(request as never)
883
870
 
884
871
  transaction = await client.signTransaction({
885
872
  ...Transaction.deserialize(transaction),
886
873
  account,
887
874
  feePayer,
888
- })
875
+ } as never)
889
876
  const hash = await client.sendRawTransaction({
890
877
  serializedTransaction: transaction,
891
878
  })
@@ -893,11 +880,33 @@ describe('signTransaction', () => {
893
880
  await client.waitForTransactionReceipt({ hash })
894
881
 
895
882
  const {
896
- blockHash: _,
897
- blockNumber: __,
883
+ blockHash,
884
+ blockNumber,
885
+ chainId,
886
+ feePayer: feePayer_,
887
+ feePayerSignature,
888
+ from,
889
+ gasPrice,
890
+ hash: hash_,
891
+ maxFeePerGas,
892
+ maxPriorityFeePerGas,
893
+ nonce,
894
+ signature,
898
895
  ...transaction2
899
896
  } = await client.getTransaction({ hash })
900
897
 
898
+ expect(blockHash).toBeDefined()
899
+ expect(blockNumber).toBeDefined()
900
+ expect(chainId).toBeDefined()
901
+ expect(feePayer_).toBe(feePayer.address.toLowerCase())
902
+ expect(feePayerSignature).toBeDefined()
903
+ expect(from).toBe(account.address.toLowerCase())
904
+ expect(gasPrice).toBeDefined()
905
+ expect(hash_).toBe(hash)
906
+ expect(maxFeePerGas).toBeDefined()
907
+ expect(maxPriorityFeePerGas).toBeDefined()
908
+ expect(nonce).toBeDefined()
909
+ expect(signature).toBeDefined()
901
910
  expect(transaction2).toMatchInlineSnapshot(`
902
911
  {
903
912
  "aaAuthorizationList": [],
@@ -910,33 +919,11 @@ describe('signTransaction', () => {
910
919
  "value": 0n,
911
920
  },
912
921
  ],
913
- "chainId": 1337,
914
922
  "data": undefined,
915
- "feePayer": "0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266",
916
- "feePayerSignature": {
917
- "r": "0x669793cc2483931ffe3141aab062c7f69d3d16d15003c1192ca944b019ef445a",
918
- "s": "0x037cce00c3e94063ef98c4a55e9b11cdfc826ddae125d42cf679a6fcd1c8fef9",
919
- "v": 28n,
920
- "yParity": 1,
921
- },
922
923
  "feeToken": null,
923
- "from": "0x740474977e01d056f04a314b5537e4dd88f35952",
924
924
  "gas": 24002n,
925
- "gasPrice": 10000000000n,
926
- "hash": "0xb0abd89951c7d053af43c7684859a604b381680dc8521e41e57a2412cef13211",
927
925
  "maxFeePerBlobGas": undefined,
928
- "maxFeePerGas": 12000000000n,
929
- "maxPriorityFeePerGas": 0n,
930
- "nonce": 1,
931
926
  "nonceKey": 0n,
932
- "signature": {
933
- "signature": {
934
- "r": 67093125285953111322286487053649634901104592648978739500209237696329559594663n,
935
- "s": 23307791115004510736003345595881666676393686556128238040992902553893261582309n,
936
- "yParity": 0,
937
- },
938
- "type": "secp256k1",
939
- },
940
927
  "to": null,
941
928
  "transactionIndex": 1,
942
929
  "type": "aa",
@@ -952,9 +939,11 @@ describe('signTransaction', () => {
952
939
  })
953
940
 
954
941
  describe('relay', () => {
955
- const client = createClient({
956
- chain: tempoTest({ feeToken: 1n }),
957
- transport: withFeePayer(http(), http('http://localhost:3000')),
942
+ const client = getClient({
943
+ transport: withFeePayer(
944
+ http(undefined, { fetchOptions }),
945
+ http('http://localhost:3050'),
946
+ ),
958
947
  })
959
948
  .extend(tempoActions())
960
949
  .extend(walletActions)
@@ -968,10 +957,8 @@ describe('relay', () => {
968
957
  beforeAll(async () => {
969
958
  server = Http.createServer(
970
959
  createRequestListener(async (r) => {
971
- const client = createClient({
960
+ const client = getClient({
972
961
  account: accounts[0],
973
- chain: tempoTest({ feeToken: 1n }),
974
- transport: http(),
975
962
  }).extend(walletActions)
976
963
 
977
964
  const request = RpcRequest.from(await r.json())
@@ -1017,7 +1004,7 @@ describe('relay', () => {
1017
1004
 
1018
1005
  return Response.json(RpcResponse.from({ result }, { request }))
1019
1006
  }),
1020
- ).listen(3000)
1007
+ ).listen(3050)
1021
1008
  })
1022
1009
 
1023
1010
  afterAll(() => {
@@ -1041,6 +1028,7 @@ describe('relay', () => {
1041
1028
 
1042
1029
  const { receipt } = await client.fee.setUserTokenSync({
1043
1030
  account,
1031
+ maxFeePerGas: parseGwei('20'),
1044
1032
  feePayer: true,
1045
1033
  token: 1n,
1046
1034
  })
@@ -1054,11 +1042,35 @@ describe('relay', () => {
1054
1042
  `)
1055
1043
 
1056
1044
  const {
1057
- blockHash: _,
1058
- blockNumber: __,
1045
+ blockHash,
1046
+ blockNumber,
1047
+ chainId,
1048
+ feePayer,
1049
+ feePayerSignature,
1050
+ from,
1051
+ gas,
1052
+ gasPrice,
1053
+ hash,
1054
+ maxFeePerGas,
1055
+ maxPriorityFeePerGas,
1056
+ nonce,
1057
+ signature,
1059
1058
  ...transaction
1060
1059
  } = await client.getTransaction({ hash: receipt.transactionHash })
1061
1060
 
1061
+ expect(blockHash).toBeDefined()
1062
+ expect(blockNumber).toBeDefined()
1063
+ expect(chainId).toBeDefined()
1064
+ expect(feePayer).toBe(accounts[0].address.toLowerCase())
1065
+ expect(feePayerSignature).toBeDefined()
1066
+ expect(from).toBe(account.address.toLowerCase())
1067
+ expect(gas).toBeDefined()
1068
+ expect(gasPrice).toBeDefined()
1069
+ expect(hash).toBe(receipt.transactionHash)
1070
+ expect(maxFeePerGas).toBeDefined()
1071
+ expect(maxPriorityFeePerGas).toBeDefined()
1072
+ expect(nonce).toBeDefined()
1073
+ expect(signature).toBeDefined()
1062
1074
  expect(transaction).toMatchInlineSnapshot(`
1063
1075
  {
1064
1076
  "aaAuthorizationList": [],
@@ -1071,33 +1083,10 @@ describe('relay', () => {
1071
1083
  "value": 0n,
1072
1084
  },
1073
1085
  ],
1074
- "chainId": 1337,
1075
1086
  "data": undefined,
1076
- "feePayer": "0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266",
1077
- "feePayerSignature": {
1078
- "r": "0x57f6f6777f1689f87c333d1fa37207cf668b2c2d7321dcd5c63a2e6a7108077e",
1079
- "s": "0x3c4270f67d8add0b5e7a9de6fee2b915cd754e1c0495ee88a1b78fd7568e6619",
1080
- "v": 28n,
1081
- "yParity": 1,
1082
- },
1083
1087
  "feeToken": null,
1084
- "from": "0x740474977e01d056f04a314b5537e4dd88f35952",
1085
- "gas": 47825n,
1086
- "gasPrice": 10000000000n,
1087
- "hash": "0xd8429515914095d1093e6cd0cace8a06890ed5a2e4e3c775f3196ec78b4fa75d",
1088
1088
  "maxFeePerBlobGas": undefined,
1089
- "maxFeePerGas": 12000000000n,
1090
- "maxPriorityFeePerGas": 0n,
1091
- "nonce": 2,
1092
1089
  "nonceKey": 0n,
1093
- "signature": {
1094
- "signature": {
1095
- "r": 3978685029830144709654747044848526179202245954092725489802520292215589805538n,
1096
- "s": 13481864494883849326291583961518021266257348574613329487348338733748737047938n,
1097
- "yParity": 1,
1098
- },
1099
- "type": "secp256k1",
1100
- },
1101
1090
  "to": null,
1102
1091
  "transactionIndex": 1,
1103
1092
  "type": "aa",
@@ -1133,11 +1122,35 @@ describe('relay', () => {
1133
1122
  `)
1134
1123
 
1135
1124
  const {
1136
- blockHash: _,
1137
- blockNumber: __,
1125
+ blockHash,
1126
+ blockNumber,
1127
+ chainId,
1128
+ feePayer,
1129
+ feePayerSignature,
1130
+ from,
1131
+ gas,
1132
+ gasPrice,
1133
+ hash,
1134
+ maxFeePerGas,
1135
+ maxPriorityFeePerGas,
1136
+ nonce,
1137
+ signature,
1138
1138
  ...transaction
1139
1139
  } = await client.getTransaction({ hash: receipt.transactionHash })
1140
1140
 
1141
+ expect(blockHash).toBeDefined()
1142
+ expect(blockNumber).toBeDefined()
1143
+ expect(chainId).toBeDefined()
1144
+ expect(feePayer).toBe(accounts[0].address.toLowerCase())
1145
+ expect(feePayerSignature).toBeDefined()
1146
+ expect(from).toBe(account.address.toLowerCase())
1147
+ expect(gas).toBeDefined()
1148
+ expect(gasPrice).toBeDefined()
1149
+ expect(hash).toBe(receipt.transactionHash)
1150
+ expect(maxFeePerGas).toBeDefined()
1151
+ expect(maxPriorityFeePerGas).toBeDefined()
1152
+ expect(nonce).toBeDefined()
1153
+ expect(signature).toBeDefined()
1141
1154
  expect(transaction).toMatchInlineSnapshot(`
1142
1155
  {
1143
1156
  "aaAuthorizationList": [],
@@ -1150,38 +1163,10 @@ describe('relay', () => {
1150
1163
  "value": 0n,
1151
1164
  },
1152
1165
  ],
1153
- "chainId": 1337,
1154
1166
  "data": undefined,
1155
- "feePayer": "0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266",
1156
- "feePayerSignature": {
1157
- "r": "0x44507c3e9e4df1dff5f54ca012c69b2556e5395d9166b3b4594181e4e656a1cc",
1158
- "s": "0x5ba80c21e194089173ffaed7c12a627f611d5fba846c84e2f6f83d55353f01d2",
1159
- "v": 28n,
1160
- "yParity": 1,
1161
- },
1162
1167
  "feeToken": null,
1163
- "from": "0x5f704c6c7075acd14ee36527f03b5b5dcb4a966f",
1164
- "gas": 53231n,
1165
- "gasPrice": 10000000000n,
1166
- "hash": "0xb6848050598c30b26855673a029127a5532885dd44719894f0ac1c6ce380cffe",
1167
1168
  "maxFeePerBlobGas": undefined,
1168
- "maxFeePerGas": 12000000000n,
1169
- "maxPriorityFeePerGas": 0n,
1170
- "nonce": 0,
1171
1169
  "nonceKey": 0n,
1172
- "signature": {
1173
- "prehash": undefined,
1174
- "publicKey": {
1175
- "prefix": 4,
1176
- "x": 89768657165983002447270155621964907577955735922001002175265262336201091268103n,
1177
- "y": 21692506528696391747937034302216251793515398807520467579078748804389014172835n,
1178
- },
1179
- "signature": {
1180
- "r": 50668837405839025212455471714452555085562104168132337639876146018573466159747n,
1181
- "s": 27497318506208669156329628613746311078142570431871623594260715714766657455474n,
1182
- },
1183
- "type": "p256",
1184
- },
1185
1170
  "to": null,
1186
1171
  "transactionIndex": 1,
1187
1172
  "type": "aa",
@@ -1218,6 +1203,7 @@ describe('relay', () => {
1218
1203
  const transaction = await client.getTransaction({
1219
1204
  hash: receipt.transactionHash,
1220
1205
  })
1206
+
1221
1207
  expect(transaction).toBeDefined()
1222
1208
  })
1223
1209
  })
@@ -1240,18 +1226,42 @@ describe('relay', () => {
1240
1226
 
1241
1227
  const userToken = await client.fee.getUserToken({ account })
1242
1228
  expect(userToken).toMatchInlineSnapshot(`
1243
- {
1244
- "address": "0x20C0000000000000000000000000000000000001",
1245
- "id": 1n,
1246
- }
1247
- `)
1229
+ {
1230
+ "address": "0x20C0000000000000000000000000000000000001",
1231
+ "id": 1n,
1232
+ }
1233
+ `)
1248
1234
 
1249
1235
  const {
1250
- blockHash: _,
1251
- blockNumber: __,
1236
+ blockHash,
1237
+ blockNumber,
1238
+ chainId,
1239
+ feePayer,
1240
+ feePayerSignature,
1241
+ from,
1242
+ gas,
1243
+ gasPrice,
1244
+ hash,
1245
+ maxFeePerGas,
1246
+ maxPriorityFeePerGas,
1247
+ nonce,
1248
+ signature,
1252
1249
  ...transaction
1253
1250
  } = await client.getTransaction({ hash: receipt.transactionHash })
1254
1251
 
1252
+ expect(blockHash).toBeDefined()
1253
+ expect(blockNumber).toBeDefined()
1254
+ expect(chainId).toBeDefined()
1255
+ expect(feePayer).toBe(accounts[0].address.toLowerCase())
1256
+ expect(feePayerSignature).toBeDefined()
1257
+ expect(from).toBe(account.address.toLowerCase())
1258
+ expect(gas).toBeDefined()
1259
+ expect(gasPrice).toBeDefined()
1260
+ expect(hash).toBe(receipt.transactionHash)
1261
+ expect(maxFeePerGas).toBeDefined()
1262
+ expect(maxPriorityFeePerGas).toBeDefined()
1263
+ expect(nonce).toBeDefined()
1264
+ expect(signature).toBeDefined()
1255
1265
  expect(transaction).toMatchInlineSnapshot(`
1256
1266
  {
1257
1267
  "aaAuthorizationList": [],
@@ -1264,41 +1274,10 @@ describe('relay', () => {
1264
1274
  "value": 0n,
1265
1275
  },
1266
1276
  ],
1267
- "chainId": 1337,
1268
1277
  "data": undefined,
1269
- "feePayer": "0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266",
1270
- "feePayerSignature": {
1271
- "r": "0xc4446d8fe8fa3341d1f004cf5d54fd30ce3079909d26d8a2878ba95b7b9eec2d",
1272
- "s": "0x3dbe6bcd56aafcff58b0faad331ac8339389cad60b42e82cdccd23f67e1f82c8",
1273
- "v": 27n,
1274
- "yParity": 0,
1275
- },
1276
1278
  "feeToken": null,
1277
- "from": "0x5f704c6c7075acd14ee36527f03b5b5dcb4a966f",
1278
- "gas": 65648n,
1279
- "gasPrice": 10000000000n,
1280
- "hash": "0x279ae834209d6df5bded3c96bf5c74671cb34ef7b041b262cab97085d471f6f4",
1281
1279
  "maxFeePerBlobGas": undefined,
1282
- "maxFeePerGas": 12000000000n,
1283
- "maxPriorityFeePerGas": 0n,
1284
- "nonce": 0,
1285
1280
  "nonceKey": 0n,
1286
- "signature": {
1287
- "metadata": {
1288
- "authenticatorData": "0x49960de5880e8c687434170f6476605b8fe4aeb9a28632c7995cf3ba831d97630500000000",
1289
- "clientDataJSON": "{"type":"webauthn.get","challenge":"v8tl8bzz9Csc1GJFeUfNTnjOLM03xPTSseTVmPjPgGU","origin":"http://localhost","crossOrigin":false}",
1290
- },
1291
- "publicKey": {
1292
- "prefix": 4,
1293
- "x": 89768657165983002447270155621964907577955735922001002175265262336201091268103n,
1294
- "y": 21692506528696391747937034302216251793515398807520467579078748804389014172835n,
1295
- },
1296
- "signature": {
1297
- "r": 58941397289082666235265603710597281523077712128054003324346038713355012809744n,
1298
- "s": 40774536608463041714947524596466110685374802167796811824221384869265764799570n,
1299
- },
1300
- "type": "webAuthn",
1301
- },
1302
1281
  "to": null,
1303
1282
  "transactionIndex": 1,
1304
1283
  "type": "aa",