@0xsequence/relayer 3.0.0-beta.17 → 3.0.0-beta.19

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 (38) hide show
  1. package/.turbo/turbo-build.log +1 -1
  2. package/.turbo/turbo-lint.log +4 -0
  3. package/.turbo/turbo-typecheck.log +4 -0
  4. package/CHANGELOG.md +16 -0
  5. package/dist/preconditions/codec.d.ts.map +1 -1
  6. package/dist/preconditions/codec.js +55 -45
  7. package/dist/relayer/relayer.d.ts +1 -1
  8. package/dist/relayer/relayer.d.ts.map +1 -1
  9. package/dist/relayer/relayer.js +3 -1
  10. package/dist/relayer/rpc-relayer/index.d.ts +2 -2
  11. package/dist/relayer/rpc-relayer/index.d.ts.map +1 -1
  12. package/dist/relayer/rpc-relayer/index.js +15 -19
  13. package/dist/relayer/standard/eip6963.d.ts +1 -1
  14. package/dist/relayer/standard/eip6963.d.ts.map +1 -1
  15. package/dist/relayer/standard/eip6963.js +1 -1
  16. package/dist/relayer/standard/local.d.ts +1 -1
  17. package/dist/relayer/standard/local.d.ts.map +1 -1
  18. package/dist/relayer/standard/local.js +12 -15
  19. package/dist/relayer/standard/pk-relayer.d.ts +2 -2
  20. package/dist/relayer/standard/pk-relayer.d.ts.map +1 -1
  21. package/dist/relayer/standard/pk-relayer.js +1 -1
  22. package/dist/relayer/standard/sequence.d.ts +2 -2
  23. package/dist/relayer/standard/sequence.d.ts.map +1 -1
  24. package/dist/relayer/standard/sequence.js +1 -1
  25. package/eslint.config.js +4 -0
  26. package/package.json +8 -6
  27. package/src/preconditions/codec.ts +63 -39
  28. package/src/relayer/relayer.ts +3 -1
  29. package/src/relayer/rpc-relayer/index.ts +38 -28
  30. package/src/relayer/standard/eip6963.ts +2 -2
  31. package/src/relayer/standard/local.ts +33 -27
  32. package/src/relayer/standard/pk-relayer.ts +2 -2
  33. package/src/relayer/standard/sequence.ts +2 -2
  34. package/test/preconditions/codec.test.ts +11 -11
  35. package/test/preconditions/preconditions.test.ts +97 -138
  36. package/test/preconditions/selectors.test.ts +76 -254
  37. package/test/preconditions/types.test.ts +6 -6
  38. package/test/relayer/relayer.test.ts +3 -3
@@ -36,6 +36,11 @@ export function decodePrecondition(p: TransactionPrecondition): Precondition | u
36
36
  return undefined
37
37
  }
38
38
 
39
+ if (typeof p.minAmount !== 'bigint') {
40
+ console.warn(`Failed to decode precondition: minAmount must be a bigint`)
41
+ return undefined
42
+ }
43
+
39
44
  let precondition: Precondition | undefined
40
45
 
41
46
  try {
@@ -118,73 +123,92 @@ export function decodePrecondition(p: TransactionPrecondition): Precondition | u
118
123
  }
119
124
 
120
125
  export function encodePrecondition(p: Precondition): string {
121
- const data: any = {}
122
-
123
126
  switch (p.type()) {
124
127
  case 'native-balance': {
125
128
  const native = p as NativeBalancePrecondition
126
- data.address = native.address.toString()
127
- if (native.min !== undefined) data.min = native.min.toString()
128
- if (native.max !== undefined) data.max = native.max.toString()
129
- break
129
+ const data = {
130
+ address: native.address.toString(),
131
+ ...(native.min !== undefined && { min: native.min.toString() }),
132
+ ...(native.max !== undefined && { max: native.max.toString() }),
133
+ }
134
+
135
+ return JSON.stringify(data)
130
136
  }
131
137
 
132
138
  case 'erc20-balance': {
133
139
  const erc20 = p as Erc20BalancePrecondition
134
- data.address = erc20.address.toString()
135
- data.token = erc20.token.toString()
136
- if (erc20.min !== undefined) data.min = erc20.min.toString()
137
- if (erc20.max !== undefined) data.max = erc20.max.toString()
138
- break
140
+ const data = {
141
+ address: erc20.address.toString(),
142
+ token: erc20.token.toString(),
143
+ ...(erc20.min !== undefined && { min: erc20.min.toString() }),
144
+ ...(erc20.max !== undefined && { max: erc20.max.toString() }),
145
+ }
146
+
147
+ return JSON.stringify(data)
139
148
  }
140
149
 
141
150
  case 'erc20-approval': {
142
151
  const erc20 = p as Erc20ApprovalPrecondition
143
- data.address = erc20.address.toString()
144
- data.token = erc20.token.toString()
145
- data.operator = erc20.operator.toString()
146
- data.min = erc20.min.toString()
147
- break
152
+ const data = {
153
+ address: erc20.address.toString(),
154
+ token: erc20.token.toString(),
155
+ operator: erc20.operator.toString(),
156
+ min: erc20.min.toString(),
157
+ }
158
+
159
+ return JSON.stringify(data)
148
160
  }
149
161
 
150
162
  case 'erc721-ownership': {
151
163
  const erc721 = p as Erc721OwnershipPrecondition
152
- data.address = erc721.address.toString()
153
- data.token = erc721.token.toString()
154
- data.tokenId = erc721.tokenId.toString()
155
- if (erc721.owned !== undefined) data.owned = erc721.owned
156
- break
164
+ const data = {
165
+ address: erc721.address.toString(),
166
+ token: erc721.token.toString(),
167
+ tokenId: erc721.tokenId.toString(),
168
+ ...(erc721.owned !== undefined && { owned: erc721.owned }),
169
+ }
170
+
171
+ return JSON.stringify(data)
157
172
  }
158
173
 
159
174
  case 'erc721-approval': {
160
175
  const erc721 = p as Erc721ApprovalPrecondition
161
- data.address = erc721.address.toString()
162
- data.token = erc721.token.toString()
163
- data.tokenId = erc721.tokenId.toString()
164
- data.operator = erc721.operator.toString()
165
- break
176
+ const data = {
177
+ address: erc721.address.toString(),
178
+ token: erc721.token.toString(),
179
+ tokenId: erc721.tokenId.toString(),
180
+ operator: erc721.operator.toString(),
181
+ }
182
+
183
+ return JSON.stringify(data)
166
184
  }
167
185
 
168
186
  case 'erc1155-balance': {
169
187
  const erc1155 = p as Erc1155BalancePrecondition
170
- data.address = erc1155.address.toString()
171
- data.token = erc1155.token.toString()
172
- data.tokenId = erc1155.tokenId.toString()
173
- if (erc1155.min !== undefined) data.min = erc1155.min.toString()
174
- if (erc1155.max !== undefined) data.max = erc1155.max.toString()
175
- break
188
+ const data = {
189
+ address: erc1155.address.toString(),
190
+ token: erc1155.token.toString(),
191
+ tokenId: erc1155.tokenId.toString(),
192
+ ...(erc1155.min !== undefined && { min: erc1155.min.toString() }),
193
+ ...(erc1155.max !== undefined && { max: erc1155.max.toString() }),
194
+ }
195
+
196
+ return JSON.stringify(data)
176
197
  }
177
198
 
178
199
  case 'erc1155-approval': {
179
200
  const erc1155 = p as Erc1155ApprovalPrecondition
180
- data.address = erc1155.address.toString()
181
- data.token = erc1155.token.toString()
182
- data.tokenId = erc1155.tokenId.toString()
183
- data.operator = erc1155.operator.toString()
184
- data.min = erc1155.min.toString()
185
- break
201
+ const data = {
202
+ address: erc1155.address.toString(),
203
+ token: erc1155.token.toString(),
204
+ tokenId: erc1155.tokenId.toString(),
205
+ operator: erc1155.operator.toString(),
206
+ min: erc1155.min.toString(),
207
+ }
208
+
209
+ return JSON.stringify(data)
186
210
  }
187
211
  }
188
212
 
189
- return JSON.stringify(data)
213
+ return JSON.stringify({})
190
214
  }
@@ -27,8 +27,10 @@ export interface Relayer {
27
27
  checkPrecondition(precondition: Precondition.Precondition): Promise<boolean>
28
28
  }
29
29
 
30
- export function isRelayer(relayer: any): relayer is Relayer {
30
+ export function isRelayer(relayer: unknown): relayer is Relayer {
31
31
  return (
32
+ typeof relayer === 'object' &&
33
+ relayer !== null &&
32
34
  'isAvailable' in relayer &&
33
35
  'feeOptions' in relayer &&
34
36
  'relay' in relayer &&
@@ -10,7 +10,16 @@ import {
10
10
  import { Address, Hex, AbiFunction } from 'ox'
11
11
  import { Constants, Payload, Network } from '@0xsequence/wallet-primitives'
12
12
  import { FeeOption, FeeQuote, OperationStatus, Relayer } from '../index.js'
13
- import { decodePrecondition } from '../../preconditions/index.js'
13
+ import {
14
+ decodePrecondition,
15
+ Erc1155ApprovalPrecondition,
16
+ Erc1155BalancePrecondition,
17
+ Erc20ApprovalPrecondition,
18
+ Erc20BalancePrecondition,
19
+ Erc721ApprovalPrecondition,
20
+ Erc721OwnershipPrecondition,
21
+ NativeBalancePrecondition,
22
+ } from '../../preconditions/index.js'
14
23
  import {
15
24
  erc20BalanceOf,
16
25
  erc20Allowance,
@@ -49,12 +58,14 @@ const networkToChain = (network: Network.Network): Chain => {
49
58
  },
50
59
  }
51
60
  : undefined,
52
- contracts: network.ensAddress
53
- ? {
54
- ensUniversalResolver: {
55
- address: network.ensAddress as `0x${string}`,
61
+ contracts: network.contracts
62
+ ? Object.entries(network.contracts).reduce(
63
+ (acc, [name, address]) => {
64
+ acc[name] = { address }
65
+ return acc
56
66
  },
57
- }
67
+ {} as Record<string, { address: Address.Address }>,
68
+ )
58
69
  : undefined,
59
70
  } as Chain
60
71
  }
@@ -67,7 +78,9 @@ export const getChain = (chainId: number): Chain => {
67
78
  }
68
79
 
69
80
  // Fall back to viem's built-in chains
70
- const viemChain = Object.values(chains).find((c: any) => typeof c === 'object' && 'id' in c && c.id === chainId)
81
+ const viemChain = Object.values(chains).find(
82
+ (c: unknown) => typeof c === 'object' && c !== null && 'id' in c && c.id === chainId,
83
+ )
71
84
  if (viemChain) {
72
85
  return viemChain as Chain
73
86
  }
@@ -76,7 +89,7 @@ export const getChain = (chainId: number): Chain => {
76
89
  }
77
90
 
78
91
  export class RpcRelayer implements Relayer {
79
- public readonly kind: 'relayer' = 'relayer'
92
+ public readonly kind = 'relayer'
80
93
  public readonly type = 'rpc'
81
94
  public readonly id: string
82
95
  public readonly chainId: number
@@ -237,7 +250,7 @@ export class RpcRelayer implements Relayer {
237
250
  return { opHash: `0x${result.txnHash}` }
238
251
  }
239
252
 
240
- async status(opHash: Hex.Hex, chainId: number): Promise<OperationStatus> {
253
+ async status(opHash: Hex.Hex, _chainId: number): Promise<OperationStatus> {
241
254
  try {
242
255
  const cleanedOpHash = opHash.startsWith('0x') ? opHash.substring(2) : opHash
243
256
  const result = await this.client.getMetaTxnReceipt({ metaTxID: cleanedOpHash })
@@ -289,9 +302,9 @@ export class RpcRelayer implements Relayer {
289
302
 
290
303
  switch (decoded.type()) {
291
304
  case 'native-balance': {
292
- const native = decoded as any
305
+ const native = decoded as NativeBalancePrecondition
293
306
  try {
294
- const balance = await this.provider.getBalance({ address: native.address.toString() as `0x${string}` })
307
+ const balance = await this.provider.getBalance({ address: native.address })
295
308
  const minWei = native.min !== undefined ? BigInt(native.min) : undefined
296
309
  const maxWei = native.max !== undefined ? BigInt(native.max) : undefined
297
310
 
@@ -314,9 +327,9 @@ export class RpcRelayer implements Relayer {
314
327
  }
315
328
 
316
329
  case 'erc20-balance': {
317
- const erc20 = decoded as any
330
+ const erc20 = decoded as Erc20BalancePrecondition
318
331
  try {
319
- const data = AbiFunction.encodeData(erc20BalanceOf, [erc20.address.toString()])
332
+ const data = AbiFunction.encodeData(erc20BalanceOf, [erc20.address])
320
333
  const result = await this.provider.call({
321
334
  to: erc20.token.toString() as `0x${string}`,
322
335
  data: data as `0x${string}`,
@@ -343,9 +356,9 @@ export class RpcRelayer implements Relayer {
343
356
  }
344
357
 
345
358
  case 'erc20-approval': {
346
- const erc20 = decoded as any
359
+ const erc20 = decoded as Erc20ApprovalPrecondition
347
360
  try {
348
- const data = AbiFunction.encodeData(erc20Allowance, [erc20.address.toString(), erc20.operator.toString()])
361
+ const data = AbiFunction.encodeData(erc20Allowance, [erc20.address, erc20.operator])
349
362
  const result = await this.provider.call({
350
363
  to: erc20.token.toString() as `0x${string}`,
351
364
  data: data as `0x${string}`,
@@ -360,12 +373,12 @@ export class RpcRelayer implements Relayer {
360
373
  }
361
374
 
362
375
  case 'erc721-ownership': {
363
- const erc721 = decoded as any
376
+ const erc721 = decoded as Erc721OwnershipPrecondition
364
377
  try {
365
378
  const data = AbiFunction.encodeData(erc721OwnerOf, [erc721.tokenId])
366
379
  const result = await this.provider.call({
367
- to: erc721.token.toString() as `0x${string}`,
368
- data: data as `0x${string}`,
380
+ to: erc721.token,
381
+ data: data,
369
382
  })
370
383
  const resultHex = result.toString() as `0x${string}`
371
384
  const owner = resultHex.slice(-40)
@@ -379,7 +392,7 @@ export class RpcRelayer implements Relayer {
379
392
  }
380
393
 
381
394
  case 'erc721-approval': {
382
- const erc721 = decoded as any
395
+ const erc721 = decoded as Erc721ApprovalPrecondition
383
396
  try {
384
397
  const data = AbiFunction.encodeData(erc721GetApproved, [erc721.tokenId])
385
398
  const result = await this.provider.call({
@@ -396,9 +409,9 @@ export class RpcRelayer implements Relayer {
396
409
  }
397
410
 
398
411
  case 'erc1155-balance': {
399
- const erc1155 = decoded as any
412
+ const erc1155 = decoded as Erc1155BalancePrecondition
400
413
  try {
401
- const data = AbiFunction.encodeData(erc1155BalanceOf, [erc1155.address.toString(), erc1155.tokenId])
414
+ const data = AbiFunction.encodeData(erc1155BalanceOf, [erc1155.address, erc1155.tokenId])
402
415
  const result = await this.provider.call({
403
416
  to: erc1155.token.toString() as `0x${string}`,
404
417
  data: data as `0x${string}`,
@@ -425,15 +438,12 @@ export class RpcRelayer implements Relayer {
425
438
  }
426
439
 
427
440
  case 'erc1155-approval': {
428
- const erc1155 = decoded as any
441
+ const erc1155 = decoded as Erc1155ApprovalPrecondition
429
442
  try {
430
- const data = AbiFunction.encodeData(erc1155IsApprovedForAll, [
431
- erc1155.address.toString(),
432
- erc1155.operator.toString(),
433
- ])
443
+ const data = AbiFunction.encodeData(erc1155IsApprovedForAll, [erc1155.address, erc1155.operator])
434
444
  const result = await this.provider.call({
435
- to: erc1155.token.toString() as `0x${string}`,
436
- data: data as `0x${string}`,
445
+ to: erc1155.token,
446
+ data: data,
437
447
  })
438
448
  return BigInt(result.toString()) === 1n
439
449
  } catch (error) {
@@ -6,7 +6,7 @@ import { Payload } from '@0xsequence/wallet-primitives'
6
6
  import { FeeToken, TransactionPrecondition } from '../rpc-relayer/relayer.gen.js'
7
7
 
8
8
  export class EIP6963Relayer implements Relayer {
9
- public readonly kind: 'relayer' = 'relayer'
9
+ public readonly kind = 'relayer'
10
10
  public readonly type = 'eip6963'
11
11
  public readonly id: string
12
12
  public readonly info: EIP6963ProviderInfo
@@ -59,7 +59,7 @@ export function getEIP6963Store() {
59
59
  return store
60
60
  }
61
61
 
62
- let relayers: Map<string, EIP6963Relayer> = new Map()
62
+ const relayers: Map<string, EIP6963Relayer> = new Map()
63
63
 
64
64
  export function getRelayers(): EIP6963Relayer[] {
65
65
  const store = getEIP6963Store()
@@ -1,9 +1,18 @@
1
- import { Constants, Payload } from '@0xsequence/wallet-primitives'
1
+ import { Payload } from '@0xsequence/wallet-primitives'
2
2
  import { EIP1193Provider } from 'mipd'
3
- import { AbiFunction, Address, Bytes, Hex, TransactionReceipt } from 'ox'
3
+ import { AbiFunction, Address, Hex, TransactionReceipt } from 'ox'
4
4
  import { FeeOption, FeeQuote, OperationStatus, Relayer } from '../index.js'
5
5
  import { FeeToken, TransactionPrecondition } from '../rpc-relayer/relayer.gen.js'
6
- import { decodePrecondition } from '../../preconditions/index.js'
6
+ import {
7
+ decodePrecondition,
8
+ Erc1155ApprovalPrecondition,
9
+ Erc1155BalancePrecondition,
10
+ Erc20ApprovalPrecondition,
11
+ Erc20BalancePrecondition,
12
+ Erc721ApprovalPrecondition,
13
+ Erc721OwnershipPrecondition,
14
+ NativeBalancePrecondition,
15
+ } from '../../preconditions/index.js'
7
16
  import {
8
17
  erc20BalanceOf,
9
18
  erc20Allowance,
@@ -23,7 +32,7 @@ export interface GenericProvider {
23
32
  }
24
33
 
25
34
  export class LocalRelayer implements Relayer {
26
- public readonly kind: 'relayer' = 'relayer'
35
+ public readonly kind = 'relayer'
27
36
  public readonly type = 'local'
28
37
  public readonly id = 'local'
29
38
 
@@ -34,7 +43,7 @@ export class LocalRelayer implements Relayer {
34
43
  }
35
44
 
36
45
  static createFromWindow(window: Window): LocalRelayer | undefined {
37
- const eth = (window as any).ethereum
46
+ const eth = (window as { ethereum?: EIP1193Provider }).ethereum
38
47
  if (!eth) {
39
48
  console.warn('Window.ethereum not found, skipping local relayer')
40
49
  return undefined
@@ -164,8 +173,8 @@ export class LocalRelayer implements Relayer {
164
173
 
165
174
  switch (decoded.type()) {
166
175
  case 'native-balance': {
167
- const native = decoded as any
168
- const balance = await this.provider.getBalance(native.address.toString())
176
+ const native = decoded as NativeBalancePrecondition
177
+ const balance = await this.provider.getBalance(native.address)
169
178
  if (native.min !== undefined && balance < native.min) {
170
179
  return false
171
180
  }
@@ -176,10 +185,10 @@ export class LocalRelayer implements Relayer {
176
185
  }
177
186
 
178
187
  case 'erc20-balance': {
179
- const erc20 = decoded as any
180
- const data = AbiFunction.encodeData(erc20BalanceOf, [erc20.address.toString()])
188
+ const erc20 = decoded as Erc20BalancePrecondition
189
+ const data = AbiFunction.encodeData(erc20BalanceOf, [erc20.address])
181
190
  const result = await this.provider.call({
182
- to: erc20.token.toString(),
191
+ to: erc20.token,
183
192
  data,
184
193
  })
185
194
  const balance = BigInt(result)
@@ -193,10 +202,10 @@ export class LocalRelayer implements Relayer {
193
202
  }
194
203
 
195
204
  case 'erc20-approval': {
196
- const erc20 = decoded as any
197
- const data = AbiFunction.encodeData(erc20Allowance, [erc20.address.toString(), erc20.operator.toString()])
205
+ const erc20 = decoded as Erc20ApprovalPrecondition
206
+ const data = AbiFunction.encodeData(erc20Allowance, [erc20.address, erc20.operator])
198
207
  const result = await this.provider.call({
199
- to: erc20.token.toString(),
208
+ to: erc20.token,
200
209
  data,
201
210
  })
202
211
  const allowance = BigInt(result)
@@ -204,10 +213,10 @@ export class LocalRelayer implements Relayer {
204
213
  }
205
214
 
206
215
  case 'erc721-ownership': {
207
- const erc721 = decoded as any
216
+ const erc721 = decoded as Erc721OwnershipPrecondition
208
217
  const data = AbiFunction.encodeData(erc721OwnerOf, [erc721.tokenId])
209
218
  const result = await this.provider.call({
210
- to: erc721.token.toString(),
219
+ to: erc721.token,
211
220
  data,
212
221
  })
213
222
  const owner = '0x' + result.slice(26)
@@ -216,10 +225,10 @@ export class LocalRelayer implements Relayer {
216
225
  }
217
226
 
218
227
  case 'erc721-approval': {
219
- const erc721 = decoded as any
228
+ const erc721 = decoded as Erc721ApprovalPrecondition
220
229
  const data = AbiFunction.encodeData(erc721GetApproved, [erc721.tokenId])
221
230
  const result = await this.provider.call({
222
- to: erc721.token.toString(),
231
+ to: erc721.token,
223
232
  data,
224
233
  })
225
234
  const approved = '0x' + result.slice(26)
@@ -227,10 +236,10 @@ export class LocalRelayer implements Relayer {
227
236
  }
228
237
 
229
238
  case 'erc1155-balance': {
230
- const erc1155 = decoded as any
231
- const data = AbiFunction.encodeData(erc1155BalanceOf, [erc1155.address.toString(), erc1155.tokenId])
239
+ const erc1155 = decoded as Erc1155BalancePrecondition
240
+ const data = AbiFunction.encodeData(erc1155BalanceOf, [erc1155.address, erc1155.tokenId])
232
241
  const result = await this.provider.call({
233
- to: erc1155.token.toString(),
242
+ to: erc1155.token,
234
243
  data,
235
244
  })
236
245
  const balance = BigInt(result)
@@ -244,13 +253,10 @@ export class LocalRelayer implements Relayer {
244
253
  }
245
254
 
246
255
  case 'erc1155-approval': {
247
- const erc1155 = decoded as any
248
- const data = AbiFunction.encodeData(erc1155IsApprovedForAll, [
249
- erc1155.address.toString(),
250
- erc1155.operator.toString(),
251
- ])
256
+ const erc1155 = decoded as Erc1155ApprovalPrecondition
257
+ const data = AbiFunction.encodeData(erc1155IsApprovedForAll, [erc1155.address, erc1155.operator])
252
258
  const result = await this.provider.call({
253
- to: erc1155.token.toString(),
259
+ to: erc1155.token,
254
260
  data,
255
261
  })
256
262
  return BigInt(result) === 1n
@@ -327,7 +333,7 @@ export class EIP1193ProviderAdapter implements GenericProvider {
327
333
  const rpcReceipt = await this.provider.request({ method: 'eth_getTransactionReceipt', params: [txHash] })
328
334
 
329
335
  if (rpcReceipt) {
330
- const receipt = TransactionReceipt.fromRpc(rpcReceipt as any)
336
+ const receipt = TransactionReceipt.fromRpc(rpcReceipt as Parameters<typeof TransactionReceipt.fromRpc>[0])
331
337
  if (receipt?.status === 'success') {
332
338
  return 'success'
333
339
  } else if (receipt?.status === 'reverted') {
@@ -5,7 +5,7 @@ import { FeeOption, FeeQuote, OperationStatus, Relayer } from '../index.js'
5
5
  import { FeeToken } from '../rpc-relayer/relayer.gen.js'
6
6
 
7
7
  export class PkRelayer implements Relayer {
8
- public readonly kind: 'relayer' = 'relayer'
8
+ public readonly kind = 'relayer'
9
9
  public readonly type = 'pk'
10
10
  public readonly id = 'pk'
11
11
  private readonly relayer: LocalRelayer
@@ -132,7 +132,7 @@ export class PkRelayer implements Relayer {
132
132
  return this.relayer.status(opHash, chainId)
133
133
  }
134
134
 
135
- async checkPrecondition(precondition: Precondition.Precondition): Promise<boolean> {
135
+ async checkPrecondition(_precondition: Precondition.Precondition): Promise<boolean> {
136
136
  // TODO: Implement precondition check
137
137
  return true
138
138
  }
@@ -3,7 +3,7 @@ import { Payload } from '@0xsequence/wallet-primitives'
3
3
  import { AbiFunction, Address, Bytes, Hex } from 'ox'
4
4
  import { FeeOption, FeeQuote, OperationStatus, Relayer } from '../index.js'
5
5
  export class SequenceRelayer implements Relayer {
6
- public readonly kind: 'relayer' = 'relayer'
6
+ public readonly kind = 'relayer'
7
7
  public readonly type = 'sequence'
8
8
  readonly id = 'sequence'
9
9
 
@@ -52,7 +52,7 @@ export class SequenceRelayer implements Relayer {
52
52
  }
53
53
  }
54
54
 
55
- async checkPrecondition(precondition: TransactionPrecondition): Promise<boolean> {
55
+ async checkPrecondition(_precondition: TransactionPrecondition): Promise<boolean> {
56
56
  // TODO: implement
57
57
  return false
58
58
  }
@@ -36,8 +36,8 @@ describe('Preconditions Codec', () => {
36
36
 
37
37
  describe('decodePrecondition', () => {
38
38
  it('should return undefined for null/undefined input', () => {
39
- expect(decodePrecondition(null as any)).toBeUndefined()
40
- expect(decodePrecondition(undefined as any)).toBeUndefined()
39
+ expect(decodePrecondition(null as unknown as TransactionPrecondition)).toBeUndefined()
40
+ expect(decodePrecondition(undefined as unknown as TransactionPrecondition)).toBeUndefined()
41
41
  })
42
42
 
43
43
  it('should decode native balance precondition with only min', () => {
@@ -231,8 +231,8 @@ describe('Preconditions Codec', () => {
231
231
  it('should handle malformed addresses gracefully', () => {
232
232
  const intent: TransactionPrecondition = {
233
233
  type: 'native-balance',
234
- ownerAddress: 'invalid-address' as any,
235
- tokenAddress: NATIVE_TOKEN_ADDRESS,
234
+ ownerAddress: 'invalid-address',
235
+ tokenAddress: NATIVE_TOKEN_ADDRESS.toString(),
236
236
  chainId: ARBITRUM_CHAIN_ID,
237
237
  minAmount: BigInt('1000000000000000000'),
238
238
  }
@@ -243,13 +243,13 @@ describe('Preconditions Codec', () => {
243
243
  })
244
244
 
245
245
  it('should handle malformed BigInt values gracefully', () => {
246
- const intent: TransactionPrecondition = {
246
+ const intent = {
247
247
  type: 'native-balance',
248
- ownerAddress: TEST_ADDRESS,
249
- tokenAddress: NATIVE_TOKEN_ADDRESS,
248
+ ownerAddress: TEST_ADDRESS.toString(),
249
+ tokenAddress: NATIVE_TOKEN_ADDRESS.toString(),
250
250
  chainId: ARBITRUM_CHAIN_ID,
251
- minAmount: 'not-a-number' as any,
252
- }
251
+ minAmount: 'not-a-number',
252
+ } as unknown as TransactionPrecondition
253
253
 
254
254
  const result = decodePrecondition(intent)
255
255
  expect(result).toBeUndefined()
@@ -316,8 +316,8 @@ describe('Preconditions Codec', () => {
316
316
  },
317
317
  {
318
318
  type: 'native-balance',
319
- ownerAddress: 'invalid-address' as any,
320
- tokenAddress: NATIVE_TOKEN_ADDRESS,
319
+ ownerAddress: 'invalid-address',
320
+ tokenAddress: NATIVE_TOKEN_ADDRESS.toString(),
321
321
  chainId: ARBITRUM_CHAIN_ID,
322
322
  minAmount: BigInt('1000000000000000000'),
323
323
  },