@0xsequence/relayer 3.0.5 → 3.0.7

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.
@@ -9,10 +9,7 @@ import {
9
9
  Erc721OwnershipPrecondition,
10
10
  NativeBalancePrecondition,
11
11
  } from '../../src/preconditions/types.js'
12
- import {
13
- LocalRelayer,
14
- type GenericProvider,
15
- } from '../../src/relayer/standard/local.js'
12
+ import { LocalRelayer, type GenericProvider } from '../../src/relayer/standard/local.js'
16
13
  import { Network } from '@0xsequence/wallet-primitives'
17
14
 
18
15
  const CAN_RUN_LIVE = false
@@ -177,8 +174,7 @@ describe('Preconditions', () => {
177
174
  }
178
175
 
179
176
  // getApproved returns 32-byte word: 12 zero bytes + 20-byte address. Codec uses ownerAddress as operator.
180
- const approvedHex =
181
- '0x' + '0'.repeat(24) + testWalletAddress.toString().slice(2).toLowerCase()
177
+ const approvedHex = '0x' + '0'.repeat(24) + testWalletAddress.toString().slice(2).toLowerCase()
182
178
  vi.mocked(provider.call).mockResolvedValue(approvedHex as Hex.Hex)
183
179
 
184
180
  const isValid = await relayer.checkPrecondition(transactionPrecondition)
@@ -68,7 +68,12 @@ describe('Preconditions Selectors', () => {
68
68
  })
69
69
 
70
70
  it('should return undefined when chainID is not present', () => {
71
- const precondition = { type: 'native-balance', ownerAddress: TEST_ADDRESS, tokenAddress: ZERO_ADDRESS, minAmount: 1n } as TransactionPrecondition
71
+ const precondition = {
72
+ type: 'native-balance',
73
+ ownerAddress: TEST_ADDRESS,
74
+ tokenAddress: ZERO_ADDRESS,
75
+ minAmount: 1n,
76
+ } as TransactionPrecondition
72
77
  const chainId = extractChainID(precondition)
73
78
  expect(chainId).toBeUndefined()
74
79
  })
@@ -87,10 +92,7 @@ describe('Preconditions Selectors', () => {
87
92
 
88
93
  describe('extractSupportedPreconditions', () => {
89
94
  it('should extract valid preconditions', () => {
90
- const intents: TransactionPrecondition[] = [
91
- nativePrecondition(),
92
- erc20Precondition(),
93
- ]
95
+ const intents: TransactionPrecondition[] = [nativePrecondition(), erc20Precondition()]
94
96
 
95
97
  const results = extractSupportedPreconditions(intents)
96
98
  expect(results).toHaveLength(2)
@@ -101,7 +103,13 @@ describe('Preconditions Selectors', () => {
101
103
  it('should filter out invalid preconditions', () => {
102
104
  const intents: TransactionPrecondition[] = [
103
105
  nativePrecondition(),
104
- { type: 'unknown-type', chainId: 1, ownerAddress: TEST_ADDRESS, tokenAddress: ZERO_ADDRESS, minAmount: 0n } as TransactionPrecondition,
106
+ {
107
+ type: 'unknown-type',
108
+ chainId: 1,
109
+ ownerAddress: TEST_ADDRESS,
110
+ tokenAddress: ZERO_ADDRESS,
111
+ minAmount: 0n,
112
+ } as TransactionPrecondition,
105
113
  nativePrecondition({ ownerAddress: '' }),
106
114
  ]
107
115
 
@@ -124,7 +132,13 @@ describe('Preconditions Selectors', () => {
124
132
  const intents: TransactionPrecondition[] = [
125
133
  nativePrecondition(),
126
134
  erc721OwnershipPrecondition(),
127
- { type: 'invalid-type', chainId: 1, ownerAddress: TEST_ADDRESS, tokenAddress: ZERO_ADDRESS, minAmount: 0n } as TransactionPrecondition,
135
+ {
136
+ type: 'invalid-type',
137
+ chainId: 1,
138
+ ownerAddress: TEST_ADDRESS,
139
+ tokenAddress: ZERO_ADDRESS,
140
+ minAmount: 0n,
141
+ } as TransactionPrecondition,
128
142
  ]
129
143
 
130
144
  const results = extractSupportedPreconditions(intents)
@@ -151,10 +165,7 @@ describe('Preconditions Selectors', () => {
151
165
  })
152
166
 
153
167
  it('should return empty array when no native balance preconditions exist', () => {
154
- const intents: TransactionPrecondition[] = [
155
- erc20Precondition(),
156
- erc721OwnershipPrecondition(),
157
- ]
168
+ const intents: TransactionPrecondition[] = [erc20Precondition(), erc721OwnershipPrecondition()]
158
169
 
159
170
  const results = extractNativeBalancePreconditions(intents)
160
171
  expect(results).toEqual([])
@@ -202,10 +213,7 @@ describe('Preconditions Selectors', () => {
202
213
  })
203
214
 
204
215
  it('should return empty array when no ERC20 balance preconditions exist', () => {
205
- const intents: TransactionPrecondition[] = [
206
- nativePrecondition(),
207
- erc721OwnershipPrecondition(),
208
- ]
216
+ const intents: TransactionPrecondition[] = [nativePrecondition(), erc721OwnershipPrecondition()]
209
217
 
210
218
  const results = extractERC20BalancePreconditions(intents)
211
219
  expect(results).toEqual([])