@0xsequence/relayer 2.3.35 → 3.0.0-beta.2

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 (84) hide show
  1. package/.turbo/turbo-build.log +5 -0
  2. package/CHANGELOG.md +3862 -0
  3. package/LICENSE +0 -17
  4. package/README.md +1 -2
  5. package/dist/index.d.ts +4 -0
  6. package/dist/index.d.ts.map +1 -0
  7. package/dist/index.js +3 -0
  8. package/dist/preconditions/codec.d.ts +12 -0
  9. package/dist/preconditions/codec.d.ts.map +1 -0
  10. package/dist/preconditions/codec.js +125 -0
  11. package/dist/preconditions/index.d.ts +4 -0
  12. package/dist/preconditions/index.d.ts.map +1 -0
  13. package/dist/preconditions/index.js +3 -0
  14. package/dist/preconditions/selectors.d.ts +7 -0
  15. package/dist/preconditions/selectors.d.ts.map +1 -0
  16. package/dist/preconditions/selectors.js +27 -0
  17. package/dist/preconditions/types.d.ts +70 -0
  18. package/dist/preconditions/types.d.ts.map +1 -0
  19. package/dist/preconditions/types.js +203 -0
  20. package/dist/relayer/index.d.ts +45 -0
  21. package/dist/relayer/index.d.ts.map +1 -0
  22. package/dist/relayer/index.js +3 -0
  23. package/dist/relayer/relayer.d.ts +26 -0
  24. package/dist/relayer/relayer.d.ts.map +1 -0
  25. package/dist/relayer/relayer.js +7 -0
  26. package/dist/relayer/rpc-relayer/index.d.ts +38 -0
  27. package/dist/relayer/rpc-relayer/index.d.ts.map +1 -0
  28. package/dist/relayer/rpc-relayer/index.js +375 -0
  29. package/dist/{declarations/src → relayer}/rpc-relayer/relayer.gen.d.ts +218 -178
  30. package/dist/relayer/rpc-relayer/relayer.gen.d.ts.map +1 -0
  31. package/dist/relayer/rpc-relayer/relayer.gen.js +1246 -0
  32. package/dist/relayer/standard/abi.d.ts +73 -0
  33. package/dist/relayer/standard/abi.d.ts.map +1 -0
  34. package/dist/relayer/standard/abi.js +10 -0
  35. package/dist/relayer/standard/eip6963.d.ts +31 -0
  36. package/dist/relayer/standard/eip6963.d.ts.map +1 -0
  37. package/dist/relayer/standard/eip6963.js +51 -0
  38. package/dist/relayer/standard/index.d.ts +5 -0
  39. package/dist/relayer/standard/index.d.ts.map +1 -0
  40. package/dist/relayer/standard/index.js +4 -0
  41. package/dist/relayer/standard/local.d.ts +60 -0
  42. package/dist/relayer/standard/local.d.ts.map +1 -0
  43. package/dist/relayer/standard/local.js +285 -0
  44. package/dist/relayer/standard/pk-relayer.d.ts +28 -0
  45. package/dist/relayer/standard/pk-relayer.d.ts.map +1 -0
  46. package/dist/relayer/standard/pk-relayer.js +112 -0
  47. package/dist/relayer/standard/sequence.d.ts +27 -0
  48. package/dist/relayer/standard/sequence.d.ts.map +1 -0
  49. package/dist/relayer/standard/sequence.js +84 -0
  50. package/package.json +28 -25
  51. package/src/index.ts +3 -111
  52. package/src/preconditions/codec.ts +190 -0
  53. package/src/preconditions/index.ts +3 -0
  54. package/src/preconditions/selectors.ts +38 -0
  55. package/src/preconditions/types.ts +201 -0
  56. package/src/relayer/index.ts +60 -0
  57. package/src/relayer/relayer.ts +37 -0
  58. package/src/relayer/rpc-relayer/index.ts +449 -0
  59. package/src/relayer/rpc-relayer/relayer.gen.ts +2268 -0
  60. package/src/relayer/standard/abi.ts +13 -0
  61. package/src/relayer/standard/eip6963.ts +74 -0
  62. package/src/relayer/standard/index.ts +4 -0
  63. package/src/relayer/standard/local.ts +353 -0
  64. package/src/relayer/standard/pk-relayer.ts +138 -0
  65. package/src/relayer/standard/sequence.ts +110 -0
  66. package/test/preconditions/codec.test.ts +531 -0
  67. package/test/preconditions/preconditions.test.ts +283 -0
  68. package/test/preconditions/selectors.test.ts +415 -0
  69. package/test/preconditions/types.test.ts +443 -0
  70. package/test/relayer/relayer.test.ts +355 -0
  71. package/tsconfig.json +10 -0
  72. package/dist/0xsequence-relayer.cjs.d.ts +0 -2
  73. package/dist/0xsequence-relayer.cjs.dev.js +0 -1626
  74. package/dist/0xsequence-relayer.cjs.js +0 -7
  75. package/dist/0xsequence-relayer.cjs.prod.js +0 -1626
  76. package/dist/0xsequence-relayer.esm.js +0 -1613
  77. package/dist/declarations/src/index.d.ts +0 -42
  78. package/dist/declarations/src/local-relayer.d.ts +0 -35
  79. package/dist/declarations/src/provider-relayer.d.ts +0 -47
  80. package/dist/declarations/src/rpc-relayer/index.d.ts +0 -72
  81. package/src/local-relayer.ts +0 -125
  82. package/src/provider-relayer.ts +0 -284
  83. package/src/rpc-relayer/index.ts +0 -380
  84. package/src/rpc-relayer/relayer.gen.ts +0 -1900
@@ -0,0 +1,443 @@
1
+ import { Address } from 'ox'
2
+ import { describe, expect, it } from 'vitest'
3
+
4
+ import {
5
+ NativeBalancePrecondition,
6
+ Erc20BalancePrecondition,
7
+ Erc20ApprovalPrecondition,
8
+ Erc721OwnershipPrecondition,
9
+ Erc721ApprovalPrecondition,
10
+ Erc1155BalancePrecondition,
11
+ Erc1155ApprovalPrecondition,
12
+ } from '../../src/preconditions/types.js'
13
+
14
+ // Test addresses
15
+ const TEST_ADDRESS = Address.from('0x1234567890123456789012345678901234567890')
16
+ const TOKEN_ADDRESS = Address.from('0xabcdefabcdefabcdefabcdefabcdefabcdefabcd')
17
+ const OPERATOR_ADDRESS = Address.from('0x9876543210987654321098765432109876543210')
18
+
19
+ describe('Preconditions Types', () => {
20
+ describe('NativeBalancePrecondition', () => {
21
+ it('should create a valid native balance precondition', () => {
22
+ const precondition = new NativeBalancePrecondition(TEST_ADDRESS, 1000000000000000000n, 2000000000000000000n)
23
+
24
+ expect(precondition.address).toBe(TEST_ADDRESS)
25
+ expect(precondition.min).toBe(1000000000000000000n)
26
+ expect(precondition.max).toBe(2000000000000000000n)
27
+ expect(precondition.type()).toBe('native-balance')
28
+ expect(precondition.isValid()).toBeUndefined()
29
+ })
30
+
31
+ it('should create a precondition with only min value', () => {
32
+ const precondition = new NativeBalancePrecondition(TEST_ADDRESS, 1000000000000000000n)
33
+
34
+ expect(precondition.min).toBe(1000000000000000000n)
35
+ expect(precondition.max).toBeUndefined()
36
+ expect(precondition.isValid()).toBeUndefined()
37
+ })
38
+
39
+ it('should create a precondition with only max value', () => {
40
+ const precondition = new NativeBalancePrecondition(TEST_ADDRESS, undefined, 2000000000000000000n)
41
+
42
+ expect(precondition.min).toBeUndefined()
43
+ expect(precondition.max).toBe(2000000000000000000n)
44
+ expect(precondition.isValid()).toBeUndefined()
45
+ })
46
+
47
+ it('should create a precondition with no min/max values', () => {
48
+ const precondition = new NativeBalancePrecondition(TEST_ADDRESS)
49
+
50
+ expect(precondition.min).toBeUndefined()
51
+ expect(precondition.max).toBeUndefined()
52
+ expect(precondition.isValid()).toBeUndefined()
53
+ })
54
+
55
+ it('should validate address is required', () => {
56
+ const precondition = new NativeBalancePrecondition('' as Address.Address)
57
+
58
+ const error = precondition.isValid()
59
+ expect(error).toBeInstanceOf(Error)
60
+ expect(error?.message).toBe('address is required')
61
+ })
62
+
63
+ it('should validate min cannot be greater than max', () => {
64
+ const precondition = new NativeBalancePrecondition(TEST_ADDRESS, 2000000000000000000n, 1000000000000000000n)
65
+
66
+ const error = precondition.isValid()
67
+ expect(error).toBeInstanceOf(Error)
68
+ expect(error?.message).toBe('min balance cannot be greater than max balance')
69
+ })
70
+
71
+ it('should allow min equal to max', () => {
72
+ const precondition = new NativeBalancePrecondition(TEST_ADDRESS, 1000000000000000000n, 1000000000000000000n)
73
+
74
+ expect(precondition.isValid()).toBeUndefined()
75
+ })
76
+ })
77
+
78
+ describe('Erc20BalancePrecondition', () => {
79
+ it('should create a valid ERC20 balance precondition', () => {
80
+ const precondition = new Erc20BalancePrecondition(TEST_ADDRESS, TOKEN_ADDRESS, 1000000n, 2000000n)
81
+
82
+ expect(precondition.address).toBe(TEST_ADDRESS)
83
+ expect(precondition.token).toBe(TOKEN_ADDRESS)
84
+ expect(precondition.min).toBe(1000000n)
85
+ expect(precondition.max).toBe(2000000n)
86
+ expect(precondition.type()).toBe('erc20-balance')
87
+ expect(precondition.isValid()).toBeUndefined()
88
+ })
89
+
90
+ it('should validate address is required', () => {
91
+ const precondition = new Erc20BalancePrecondition('' as Address.Address, TOKEN_ADDRESS)
92
+
93
+ const error = precondition.isValid()
94
+ expect(error).toBeInstanceOf(Error)
95
+ expect(error?.message).toBe('address is required')
96
+ })
97
+
98
+ it('should validate token address is required', () => {
99
+ const precondition = new Erc20BalancePrecondition(TEST_ADDRESS, '' as Address.Address)
100
+
101
+ const error = precondition.isValid()
102
+ expect(error).toBeInstanceOf(Error)
103
+ expect(error?.message).toBe('token address is required')
104
+ })
105
+
106
+ it('should validate min cannot be greater than max', () => {
107
+ const precondition = new Erc20BalancePrecondition(TEST_ADDRESS, TOKEN_ADDRESS, 2000000n, 1000000n)
108
+
109
+ const error = precondition.isValid()
110
+ expect(error).toBeInstanceOf(Error)
111
+ expect(error?.message).toBe('min balance cannot be greater than max balance')
112
+ })
113
+
114
+ it('should create precondition with only min value', () => {
115
+ const precondition = new Erc20BalancePrecondition(TEST_ADDRESS, TOKEN_ADDRESS, 1000000n)
116
+
117
+ expect(precondition.min).toBe(1000000n)
118
+ expect(precondition.max).toBeUndefined()
119
+ expect(precondition.isValid()).toBeUndefined()
120
+ })
121
+
122
+ it('should create precondition with only max value', () => {
123
+ const precondition = new Erc20BalancePrecondition(TEST_ADDRESS, TOKEN_ADDRESS, undefined, 2000000n)
124
+
125
+ expect(precondition.min).toBeUndefined()
126
+ expect(precondition.max).toBe(2000000n)
127
+ expect(precondition.isValid()).toBeUndefined()
128
+ })
129
+ })
130
+
131
+ describe('Erc20ApprovalPrecondition', () => {
132
+ it('should create a valid ERC20 approval precondition', () => {
133
+ const precondition = new Erc20ApprovalPrecondition(TEST_ADDRESS, TOKEN_ADDRESS, OPERATOR_ADDRESS, 1000000n)
134
+
135
+ expect(precondition.address).toBe(TEST_ADDRESS)
136
+ expect(precondition.token).toBe(TOKEN_ADDRESS)
137
+ expect(precondition.operator).toBe(OPERATOR_ADDRESS)
138
+ expect(precondition.min).toBe(1000000n)
139
+ expect(precondition.type()).toBe('erc20-approval')
140
+ expect(precondition.isValid()).toBeUndefined()
141
+ })
142
+
143
+ it('should validate address is required', () => {
144
+ const precondition = new Erc20ApprovalPrecondition(
145
+ '' as Address.Address,
146
+ TOKEN_ADDRESS,
147
+ OPERATOR_ADDRESS,
148
+ 1000000n,
149
+ )
150
+
151
+ const error = precondition.isValid()
152
+ expect(error).toBeInstanceOf(Error)
153
+ expect(error?.message).toBe('address is required')
154
+ })
155
+
156
+ it('should validate token address is required', () => {
157
+ const precondition = new Erc20ApprovalPrecondition(
158
+ TEST_ADDRESS,
159
+ '' as Address.Address,
160
+ OPERATOR_ADDRESS,
161
+ 1000000n,
162
+ )
163
+
164
+ const error = precondition.isValid()
165
+ expect(error).toBeInstanceOf(Error)
166
+ expect(error?.message).toBe('token address is required')
167
+ })
168
+
169
+ it('should validate operator address is required', () => {
170
+ const precondition = new Erc20ApprovalPrecondition(TEST_ADDRESS, TOKEN_ADDRESS, '' as Address.Address, 1000000n)
171
+
172
+ const error = precondition.isValid()
173
+ expect(error).toBeInstanceOf(Error)
174
+ expect(error?.message).toBe('operator address is required')
175
+ })
176
+
177
+ it('should validate min approval amount is required', () => {
178
+ const precondition = new Erc20ApprovalPrecondition(
179
+ TEST_ADDRESS,
180
+ TOKEN_ADDRESS,
181
+ OPERATOR_ADDRESS,
182
+ undefined as any,
183
+ )
184
+
185
+ const error = precondition.isValid()
186
+ expect(error).toBeInstanceOf(Error)
187
+ expect(error?.message).toBe('min approval amount is required')
188
+ })
189
+ })
190
+
191
+ describe('Erc721OwnershipPrecondition', () => {
192
+ it('should create a valid ERC721 ownership precondition', () => {
193
+ const precondition = new Erc721OwnershipPrecondition(TEST_ADDRESS, TOKEN_ADDRESS, 123n, true)
194
+
195
+ expect(precondition.address).toBe(TEST_ADDRESS)
196
+ expect(precondition.token).toBe(TOKEN_ADDRESS)
197
+ expect(precondition.tokenId).toBe(123n)
198
+ expect(precondition.owned).toBe(true)
199
+ expect(precondition.type()).toBe('erc721-ownership')
200
+ expect(precondition.isValid()).toBeUndefined()
201
+ })
202
+
203
+ it('should create precondition with default owned value', () => {
204
+ const precondition = new Erc721OwnershipPrecondition(TEST_ADDRESS, TOKEN_ADDRESS, 123n)
205
+
206
+ expect(precondition.owned).toBeUndefined()
207
+ expect(precondition.isValid()).toBeUndefined()
208
+ })
209
+
210
+ it('should validate address is required', () => {
211
+ const precondition = new Erc721OwnershipPrecondition('' as Address.Address, TOKEN_ADDRESS, 123n)
212
+
213
+ const error = precondition.isValid()
214
+ expect(error).toBeInstanceOf(Error)
215
+ expect(error?.message).toBe('address is required')
216
+ })
217
+
218
+ it('should validate token address is required', () => {
219
+ const precondition = new Erc721OwnershipPrecondition(TEST_ADDRESS, '' as Address.Address, 123n)
220
+
221
+ const error = precondition.isValid()
222
+ expect(error).toBeInstanceOf(Error)
223
+ expect(error?.message).toBe('token address is required')
224
+ })
225
+
226
+ it('should validate tokenId is required', () => {
227
+ const precondition = new Erc721OwnershipPrecondition(TEST_ADDRESS, TOKEN_ADDRESS, undefined as any)
228
+
229
+ const error = precondition.isValid()
230
+ expect(error).toBeInstanceOf(Error)
231
+ expect(error?.message).toBe('tokenId is required')
232
+ })
233
+
234
+ it('should handle tokenId of 0', () => {
235
+ const precondition = new Erc721OwnershipPrecondition(TEST_ADDRESS, TOKEN_ADDRESS, 0n)
236
+
237
+ expect(precondition.tokenId).toBe(0n)
238
+ expect(precondition.isValid()).toBeUndefined()
239
+ })
240
+ })
241
+
242
+ describe('Erc721ApprovalPrecondition', () => {
243
+ it('should create a valid ERC721 approval precondition', () => {
244
+ const precondition = new Erc721ApprovalPrecondition(TEST_ADDRESS, TOKEN_ADDRESS, 123n, OPERATOR_ADDRESS)
245
+
246
+ expect(precondition.address).toBe(TEST_ADDRESS)
247
+ expect(precondition.token).toBe(TOKEN_ADDRESS)
248
+ expect(precondition.tokenId).toBe(123n)
249
+ expect(precondition.operator).toBe(OPERATOR_ADDRESS)
250
+ expect(precondition.type()).toBe('erc721-approval')
251
+ expect(precondition.isValid()).toBeUndefined()
252
+ })
253
+
254
+ it('should validate address is required', () => {
255
+ const precondition = new Erc721ApprovalPrecondition('' as Address.Address, TOKEN_ADDRESS, 123n, OPERATOR_ADDRESS)
256
+
257
+ const error = precondition.isValid()
258
+ expect(error).toBeInstanceOf(Error)
259
+ expect(error?.message).toBe('address is required')
260
+ })
261
+
262
+ it('should validate token address is required', () => {
263
+ const precondition = new Erc721ApprovalPrecondition(TEST_ADDRESS, '' as Address.Address, 123n, OPERATOR_ADDRESS)
264
+
265
+ const error = precondition.isValid()
266
+ expect(error).toBeInstanceOf(Error)
267
+ expect(error?.message).toBe('token address is required')
268
+ })
269
+
270
+ it('should validate tokenId is required', () => {
271
+ const precondition = new Erc721ApprovalPrecondition(
272
+ TEST_ADDRESS,
273
+ TOKEN_ADDRESS,
274
+ undefined as any,
275
+ OPERATOR_ADDRESS,
276
+ )
277
+
278
+ const error = precondition.isValid()
279
+ expect(error).toBeInstanceOf(Error)
280
+ expect(error?.message).toBe('tokenId is required')
281
+ })
282
+
283
+ it('should validate operator address is required', () => {
284
+ const precondition = new Erc721ApprovalPrecondition(TEST_ADDRESS, TOKEN_ADDRESS, 123n, '' as Address.Address)
285
+
286
+ const error = precondition.isValid()
287
+ expect(error).toBeInstanceOf(Error)
288
+ expect(error?.message).toBe('operator address is required')
289
+ })
290
+ })
291
+
292
+ describe('Erc1155BalancePrecondition', () => {
293
+ it('should create a valid ERC1155 balance precondition', () => {
294
+ const precondition = new Erc1155BalancePrecondition(TEST_ADDRESS, TOKEN_ADDRESS, 123n, 1000000n, 2000000n)
295
+
296
+ expect(precondition.address).toBe(TEST_ADDRESS)
297
+ expect(precondition.token).toBe(TOKEN_ADDRESS)
298
+ expect(precondition.tokenId).toBe(123n)
299
+ expect(precondition.min).toBe(1000000n)
300
+ expect(precondition.max).toBe(2000000n)
301
+ expect(precondition.type()).toBe('erc1155-balance')
302
+ expect(precondition.isValid()).toBeUndefined()
303
+ })
304
+
305
+ it('should validate address is required', () => {
306
+ const precondition = new Erc1155BalancePrecondition('' as Address.Address, TOKEN_ADDRESS, 123n)
307
+
308
+ const error = precondition.isValid()
309
+ expect(error).toBeInstanceOf(Error)
310
+ expect(error?.message).toBe('address is required')
311
+ })
312
+
313
+ it('should validate token address is required', () => {
314
+ const precondition = new Erc1155BalancePrecondition(TEST_ADDRESS, '' as Address.Address, 123n)
315
+
316
+ const error = precondition.isValid()
317
+ expect(error).toBeInstanceOf(Error)
318
+ expect(error?.message).toBe('token address is required')
319
+ })
320
+
321
+ it('should validate tokenId is required', () => {
322
+ const precondition = new Erc1155BalancePrecondition(TEST_ADDRESS, TOKEN_ADDRESS, undefined as any)
323
+
324
+ const error = precondition.isValid()
325
+ expect(error).toBeInstanceOf(Error)
326
+ expect(error?.message).toBe('tokenId is required')
327
+ })
328
+
329
+ it('should validate min cannot be greater than max', () => {
330
+ const precondition = new Erc1155BalancePrecondition(TEST_ADDRESS, TOKEN_ADDRESS, 123n, 2000000n, 1000000n)
331
+
332
+ const error = precondition.isValid()
333
+ expect(error).toBeInstanceOf(Error)
334
+ expect(error?.message).toBe('min balance cannot be greater than max balance')
335
+ })
336
+
337
+ it('should create precondition with only min value', () => {
338
+ const precondition = new Erc1155BalancePrecondition(TEST_ADDRESS, TOKEN_ADDRESS, 123n, 1000000n)
339
+
340
+ expect(precondition.min).toBe(1000000n)
341
+ expect(precondition.max).toBeUndefined()
342
+ expect(precondition.isValid()).toBeUndefined()
343
+ })
344
+
345
+ it('should create precondition with only max value', () => {
346
+ const precondition = new Erc1155BalancePrecondition(TEST_ADDRESS, TOKEN_ADDRESS, 123n, undefined, 2000000n)
347
+
348
+ expect(precondition.min).toBeUndefined()
349
+ expect(precondition.max).toBe(2000000n)
350
+ expect(precondition.isValid()).toBeUndefined()
351
+ })
352
+ })
353
+
354
+ describe('Erc1155ApprovalPrecondition', () => {
355
+ it('should create a valid ERC1155 approval precondition', () => {
356
+ const precondition = new Erc1155ApprovalPrecondition(
357
+ TEST_ADDRESS,
358
+ TOKEN_ADDRESS,
359
+ 123n,
360
+ OPERATOR_ADDRESS,
361
+ 1000000n,
362
+ )
363
+
364
+ expect(precondition.address).toBe(TEST_ADDRESS)
365
+ expect(precondition.token).toBe(TOKEN_ADDRESS)
366
+ expect(precondition.tokenId).toBe(123n)
367
+ expect(precondition.operator).toBe(OPERATOR_ADDRESS)
368
+ expect(precondition.min).toBe(1000000n)
369
+ expect(precondition.type()).toBe('erc1155-approval')
370
+ expect(precondition.isValid()).toBeUndefined()
371
+ })
372
+
373
+ it('should validate address is required', () => {
374
+ const precondition = new Erc1155ApprovalPrecondition(
375
+ '' as Address.Address,
376
+ TOKEN_ADDRESS,
377
+ 123n,
378
+ OPERATOR_ADDRESS,
379
+ 1000000n,
380
+ )
381
+
382
+ const error = precondition.isValid()
383
+ expect(error).toBeInstanceOf(Error)
384
+ expect(error?.message).toBe('address is required')
385
+ })
386
+
387
+ it('should validate token address is required', () => {
388
+ const precondition = new Erc1155ApprovalPrecondition(
389
+ TEST_ADDRESS,
390
+ '' as Address.Address,
391
+ 123n,
392
+ OPERATOR_ADDRESS,
393
+ 1000000n,
394
+ )
395
+
396
+ const error = precondition.isValid()
397
+ expect(error).toBeInstanceOf(Error)
398
+ expect(error?.message).toBe('token address is required')
399
+ })
400
+
401
+ it('should validate tokenId is required', () => {
402
+ const precondition = new Erc1155ApprovalPrecondition(
403
+ TEST_ADDRESS,
404
+ TOKEN_ADDRESS,
405
+ undefined as any,
406
+ OPERATOR_ADDRESS,
407
+ 1000000n,
408
+ )
409
+
410
+ const error = precondition.isValid()
411
+ expect(error).toBeInstanceOf(Error)
412
+ expect(error?.message).toBe('tokenId is required')
413
+ })
414
+
415
+ it('should validate operator address is required', () => {
416
+ const precondition = new Erc1155ApprovalPrecondition(
417
+ TEST_ADDRESS,
418
+ TOKEN_ADDRESS,
419
+ 123n,
420
+ '' as Address.Address,
421
+ 1000000n,
422
+ )
423
+
424
+ const error = precondition.isValid()
425
+ expect(error).toBeInstanceOf(Error)
426
+ expect(error?.message).toBe('operator address is required')
427
+ })
428
+
429
+ it('should validate min approval amount is required', () => {
430
+ const precondition = new Erc1155ApprovalPrecondition(
431
+ TEST_ADDRESS,
432
+ TOKEN_ADDRESS,
433
+ 123n,
434
+ OPERATOR_ADDRESS,
435
+ undefined as any,
436
+ )
437
+
438
+ const error = precondition.isValid()
439
+ expect(error).toBeInstanceOf(Error)
440
+ expect(error?.message).toBe('min approval amount is required')
441
+ })
442
+ })
443
+ })