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
@@ -1,10 +1,12 @@
1
- import * as fs from 'node:fs'
1
+ import * as cp from 'node:child_process'
2
2
  import * as path from 'node:path'
3
3
  import { setTimeout } from 'node:timers/promises'
4
4
  import { toArgs } from 'prool'
5
5
  import { defineInstance } from 'prool/instances'
6
6
  import { execa } from 'prool/processes'
7
7
 
8
+ let pulled = false
9
+
8
10
  /**
9
11
  * Defines a Tempo instance.
10
12
  *
@@ -18,12 +20,14 @@ import { execa } from 'prool/processes'
18
20
  */
19
21
  export const tempo = defineInstance((parameters: tempo.Parameters = {}) => {
20
22
  const {
21
- binary = 'tempo',
22
23
  builder,
24
+ containerName = `tempo.${crypto.randomUUID()}`,
23
25
  chain = path.resolve(import.meta.dirname, './internal/chain.json'),
26
+ image = 'ghcr.io/tempoxyz/tempo',
24
27
  dev,
28
+ log: log_,
25
29
  faucet,
26
- log = process.env.RUST_LOG,
30
+ tag = 'latest',
27
31
  ...args
28
32
  } = parameters
29
33
  const { deadline = 3, gaslimit = 3000000000, maxTasks = 8 } = builder ?? {}
@@ -34,11 +38,17 @@ export const tempo = defineInstance((parameters: tempo.Parameters = {}) => {
34
38
  privateKey = '0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80',
35
39
  } = faucet ?? {}
36
40
 
41
+ const log = (() => {
42
+ try {
43
+ return JSON.parse(log_ as string)
44
+ } catch {
45
+ return log_
46
+ }
47
+ })()
48
+
37
49
  const name = 'tempo'
38
50
  const process_ = execa({ name })
39
51
 
40
- const tmp = `./tmp/${crypto.randomUUID()}`
41
-
42
52
  return {
43
53
  _internal: {
44
54
  args,
@@ -50,17 +60,31 @@ export const tempo = defineInstance((parameters: tempo.Parameters = {}) => {
50
60
  name,
51
61
  port: args.port ?? 8545,
52
62
  async start({ port = args.port }, options) {
53
- try {
54
- fs.rmSync(tmp, { recursive: true })
55
- } catch {}
56
- fs.mkdirSync(tmp, { recursive: true })
63
+ if (!pulled) {
64
+ cp.spawnSync('docker', [
65
+ 'pull',
66
+ `${image}:${tag}`,
67
+ '--platform',
68
+ 'linux/x86_64',
69
+ ])
70
+ pulled = true
71
+ }
57
72
 
58
- const env: Record<string, string> = {}
59
- if (log && typeof log !== 'boolean') env.RUST_LOG = log
73
+ const rustLog = log && typeof log !== 'boolean' ? log : ''
60
74
 
61
75
  return await process_.start(
62
76
  ($) =>
63
- $(Object.keys(env).length > 0 ? { env } : {})`${binary} node \
77
+ $`docker run \
78
+ --name ${containerName} \
79
+ --network host \
80
+ --platform linux/x86_64 \
81
+ --add-host host.docker.internal:host-gateway \
82
+ --add-host localhost:host-gateway \
83
+ -v ${chain}:/chain.json \
84
+ -p ${port!}:${port!} \
85
+ -e RUST_LOG=${rustLog} \
86
+ ${image}:${tag} \
87
+ node \
64
88
  --dev \
65
89
  --engine.disable-precompile-cache \
66
90
  --engine.legacy-state-root \
@@ -73,8 +97,8 @@ export const tempo = defineInstance((parameters: tempo.Parameters = {}) => {
73
97
  gaslimit,
74
98
  maxTasks,
75
99
  },
76
- chain,
77
- datadir: `${tmp}/data`,
100
+ chain: '/chain.json',
101
+ datadir: '/data',
78
102
  dev: {
79
103
  blockTime,
80
104
  },
@@ -89,7 +113,6 @@ export const tempo = defineInstance((parameters: tempo.Parameters = {}) => {
89
113
  corsdomain: '*',
90
114
  port: port!,
91
115
  },
92
-
93
116
  port: port! + 10,
94
117
  txpool: {
95
118
  pendingMaxCount: '10000000000000',
@@ -127,20 +150,13 @@ export const tempo = defineInstance((parameters: tempo.Parameters = {}) => {
127
150
  )
128
151
  },
129
152
  async stop() {
130
- try {
131
- fs.rmSync(tmp, { recursive: true })
132
- } catch {}
133
- await process_.stop()
153
+ cp.spawnSync('docker', ['rm', '-f', containerName])
134
154
  },
135
155
  }
136
156
  })
137
157
 
138
158
  export declare namespace tempo {
139
159
  export type Parameters = {
140
- /**
141
- * Path or alias to the Tempo binary.
142
- */
143
- binary?: string | undefined
144
160
  /**
145
161
  * Builder options.
146
162
  */
@@ -164,6 +180,10 @@ export declare namespace tempo {
164
180
  * Chain this node is running.
165
181
  */
166
182
  chain?: string | undefined
183
+ /**
184
+ * Name of the container.
185
+ */
186
+ containerName?: string | undefined
167
187
  /**
168
188
  * Development options.
169
189
  */
@@ -194,6 +214,10 @@ export declare namespace tempo {
194
214
  privateKey?: string | undefined
195
215
  }
196
216
  | undefined
217
+ /**
218
+ * Docker image to use.
219
+ */
220
+ image?: string | undefined
197
221
  /**
198
222
  * Rust log level configuration (sets RUST_LOG environment variable).
199
223
  * Can be a log level or a custom filter string.
@@ -215,5 +239,9 @@ export declare namespace tempo {
215
239
  * Port the server will listen on.
216
240
  */
217
241
  port?: number | undefined
242
+ /**
243
+ * Tag of the image to use.
244
+ */
245
+ tag?: string | undefined
218
246
  }
219
247
  }
package/src/tsconfig.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "extends": "../tsconfig.base.json",
3
+ "exclude": ["./**/*.test.ts"],
3
4
  "compilerOptions": {
4
5
  "customConditions": ["src"],
5
6
  "moduleResolution": "nodenext",
6
- "noEmit": true,
7
- "types": ["@vitest/browser-playwright"]
7
+ "noEmit": true
8
8
  }
9
9
  }
@@ -5,7 +5,7 @@ import { writeContractSync } from 'viem/actions'
5
5
  import { describe, expect, test } from 'vitest'
6
6
  import {
7
7
  accounts,
8
- client,
8
+ clientWithAccount,
9
9
  setupPoolWithLiquidity,
10
10
  } from '../../../test/viem/config.js'
11
11
 
@@ -14,7 +14,7 @@ const account2 = accounts[1]
14
14
 
15
15
  describe('getPool', () => {
16
16
  test('default', async () => {
17
- const pool = await Actions.amm.getPool(client, {
17
+ const pool = await Actions.amm.getPool(clientWithAccount, {
18
18
  userToken: 1n,
19
19
  validatorToken: '0x20c0000000000000000000000000000000000001',
20
20
  })
@@ -30,7 +30,7 @@ describe('getPool', () => {
30
30
 
31
31
  describe('getLiquidityBalance', () => {
32
32
  test('default', async () => {
33
- const balance = await Actions.amm.getLiquidityBalance(client, {
33
+ const balance = await Actions.amm.getLiquidityBalance(clientWithAccount, {
34
34
  address: account.address,
35
35
  userToken: 1n,
36
36
  validatorToken: '0x20c0000000000000000000000000000000000001',
@@ -42,29 +42,29 @@ describe('getLiquidityBalance', () => {
42
42
  describe('mint', () => {
43
43
  test('default', async () => {
44
44
  // Create a new token for testing
45
- const { token } = await Actions.token.createSync(client, {
45
+ const { token } = await Actions.token.createSync(clientWithAccount, {
46
46
  name: 'Test Token',
47
47
  symbol: 'TEST',
48
48
  currency: 'USD',
49
49
  })
50
50
 
51
51
  // Grant issuer role to mint tokens
52
- await Actions.token.grantRolesSync(client, {
52
+ await Actions.token.grantRolesSync(clientWithAccount, {
53
53
  token,
54
54
  roles: ['issuer'],
55
- to: client.account.address,
55
+ to: clientWithAccount.account.address,
56
56
  })
57
57
 
58
58
  // Mint some tokens to account
59
- await Actions.token.mintSync(client, {
60
- to: account.address,
59
+ await Actions.token.mintSync(clientWithAccount, {
60
+ to: clientWithAccount.account.address,
61
61
  amount: parseUnits('1000', 6),
62
62
  token,
63
63
  })
64
64
 
65
65
  // Add liquidity to pool
66
66
  const { receipt: mintReceipt, ...mintResult } = await Actions.amm.mintSync(
67
- client,
67
+ clientWithAccount,
68
68
  {
69
69
  userToken: {
70
70
  address: token,
@@ -77,20 +77,21 @@ describe('mint', () => {
77
77
  to: account.address,
78
78
  },
79
79
  )
80
+ const { sender, userToken, ...rest } = mintResult
80
81
  expect(mintReceipt).toBeDefined()
81
- expect(mintResult).toMatchInlineSnapshot(`
82
+ expect(sender).toBe(clientWithAccount.account.address)
83
+ expect(userToken).toBe(token)
84
+ expect(rest).toMatchInlineSnapshot(`
82
85
  {
83
86
  "amountUserToken": 100000000n,
84
87
  "amountValidatorToken": 100000000n,
85
88
  "liquidity": 4999999999999000n,
86
- "sender": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
87
- "userToken": "0x20C0000000000000000000000000000000000004",
88
89
  "validatorToken": "0x20C0000000000000000000000000000000000001",
89
90
  }
90
91
  `)
91
92
 
92
93
  // Verify pool reserves
93
- const pool = await Actions.amm.getPool(client, {
94
+ const pool = await Actions.amm.getPool(clientWithAccount, {
94
95
  userToken: token,
95
96
  validatorToken: 1n,
96
97
  })
@@ -103,7 +104,7 @@ describe('mint', () => {
103
104
  `)
104
105
 
105
106
  // Verify LP token balance
106
- const lpBalance = await Actions.amm.getLiquidityBalance(client, {
107
+ const lpBalance = await Actions.amm.getLiquidityBalance(clientWithAccount, {
107
108
  address: account.address,
108
109
  userToken: token,
109
110
  validatorToken: 1n,
@@ -113,28 +114,28 @@ describe('mint', () => {
113
114
 
114
115
  test('behavior: single-sided mint (mintWithValidatorToken)', async () => {
115
116
  // Create a new token for testing
116
- const { token } = await Actions.token.createSync(client, {
117
+ const { token } = await Actions.token.createSync(clientWithAccount, {
117
118
  name: 'Test Token 2',
118
119
  symbol: 'TEST2',
119
120
  currency: 'USD',
120
121
  })
121
122
 
122
123
  // Grant issuer role to mint tokens
123
- await Actions.token.grantRolesSync(client, {
124
+ await Actions.token.grantRolesSync(clientWithAccount, {
124
125
  token,
125
126
  roles: ['issuer'],
126
- to: client.account.address,
127
+ to: clientWithAccount.account.address,
127
128
  })
128
129
 
129
130
  // Mint some tokens to account
130
- await Actions.token.mintSync(client, {
131
+ await Actions.token.mintSync(clientWithAccount, {
131
132
  to: account.address,
132
133
  amount: parseUnits('1000', 6),
133
134
  token,
134
135
  })
135
136
 
136
137
  // First, establish initial liquidity with two-sided mint
137
- await Actions.amm.mintSync(client, {
138
+ await Actions.amm.mintSync(clientWithAccount, {
138
139
  userToken: {
139
140
  address: token,
140
141
  amount: parseUnits('100', 6),
@@ -147,14 +148,14 @@ describe('mint', () => {
147
148
  })
148
149
 
149
150
  // Get initial pool state
150
- const poolBefore = await Actions.amm.getPool(client, {
151
+ const poolBefore = await Actions.amm.getPool(clientWithAccount, {
151
152
  userToken: token,
152
153
  validatorToken: 1n,
153
154
  })
154
155
 
155
156
  // Add single-sided liquidity (only validatorToken)
156
157
  const { receipt: mintReceipt, ...mintResult } = await Actions.amm.mintSync(
157
- client,
158
+ clientWithAccount,
158
159
  {
159
160
  userToken: {
160
161
  address: token,
@@ -174,7 +175,7 @@ describe('mint', () => {
174
175
  expect(mintResult.liquidity).toBeGreaterThan(0n)
175
176
 
176
177
  // Verify pool reserves - only validatorToken should increase
177
- const poolAfter = await Actions.amm.getPool(client, {
178
+ const poolAfter = await Actions.amm.getPool(clientWithAccount, {
178
179
  userToken: token,
179
180
  validatorToken: 1n,
180
181
  })
@@ -189,50 +190,58 @@ describe('mint', () => {
189
190
 
190
191
  describe('burn', () => {
191
192
  test('default', async () => {
192
- const { tokenAddress } = await setupPoolWithLiquidity(client)
193
+ const { tokenAddress } = await setupPoolWithLiquidity(clientWithAccount)
193
194
 
194
195
  // Get LP balance before burn
195
- const lpBalanceBefore = await Actions.amm.getLiquidityBalance(client, {
196
- address: account.address,
197
- userToken: tokenAddress,
198
- validatorToken: 1n,
199
- })
196
+ const lpBalanceBefore = await Actions.amm.getLiquidityBalance(
197
+ clientWithAccount,
198
+ {
199
+ address: account.address,
200
+ userToken: tokenAddress,
201
+ validatorToken: 1n,
202
+ },
203
+ )
200
204
 
201
205
  // Burn half of LP tokens
202
206
  const {
203
207
  receipt: burnReceipt,
204
208
  userToken,
205
209
  ...burnResult
206
- } = await Actions.amm.burnSync(client, {
210
+ } = await Actions.amm.burnSync(clientWithAccount, {
207
211
  userToken: tokenAddress,
208
212
  validatorToken: 1n,
209
213
  liquidity: lpBalanceBefore / 2n,
210
- to: account.address,
214
+ to: account2.address,
211
215
  })
216
+ const { sender, to, ...rest } = burnResult
217
+
212
218
  expect(burnReceipt).toBeDefined()
213
219
  expect(userToken).toBe(tokenAddress)
214
- expect(burnResult).toMatchInlineSnapshot(`
220
+ expect(sender).toBe(account.address)
221
+ expect(to).toBe(account2.address)
222
+ expect(rest).toMatchInlineSnapshot(`
215
223
  {
216
224
  "amountUserToken": 49999999n,
217
225
  "amountValidatorToken": 49999999n,
218
226
  "liquidity": 2499999999999500n,
219
- "sender": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
220
- "to": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
221
227
  "validatorToken": "0x20C0000000000000000000000000000000000001",
222
228
  }
223
229
  `)
224
230
 
225
231
  // Verify LP balance decreased
226
- const lpBalanceAfter = await Actions.amm.getLiquidityBalance(client, {
227
- address: account.address,
228
- userToken: tokenAddress,
229
- validatorToken: 1n,
230
- })
232
+ const lpBalanceAfter = await Actions.amm.getLiquidityBalance(
233
+ clientWithAccount,
234
+ {
235
+ address: account.address,
236
+ userToken: tokenAddress,
237
+ validatorToken: 1n,
238
+ },
239
+ )
231
240
  expect(lpBalanceAfter).toBeLessThan(lpBalanceBefore)
232
241
  expect(lpBalanceAfter).toBe(lpBalanceBefore / 2n)
233
242
 
234
243
  // Verify pool reserves decreased
235
- const pool = await Actions.amm.getPool(client, {
244
+ const pool = await Actions.amm.getPool(clientWithAccount, {
236
245
  userToken: tokenAddress,
237
246
  validatorToken: 1n,
238
247
  })
@@ -248,10 +257,10 @@ describe('burn', () => {
248
257
 
249
258
  describe('rebalanceSwap', () => {
250
259
  test('default', async () => {
251
- const { tokenAddress } = await setupPoolWithLiquidity(client)
260
+ const { tokenAddress } = await setupPoolWithLiquidity(clientWithAccount)
252
261
 
253
262
  // Get balance before swap
254
- const balanceBefore = await Actions.token.getBalance(client, {
263
+ const balanceBefore = await Actions.token.getBalance(clientWithAccount, {
255
264
  token: tokenAddress,
256
265
  account: account2.address,
257
266
  })
@@ -259,9 +268,10 @@ describe('rebalanceSwap', () => {
259
268
  // Perform rebalance swap
260
269
  const {
261
270
  receipt: swapReceipt,
271
+ swapper,
262
272
  userToken,
263
273
  ...swapResult
264
- } = await Actions.amm.rebalanceSwapSync(client, {
274
+ } = await Actions.amm.rebalanceSwapSync(clientWithAccount, {
265
275
  userToken: tokenAddress,
266
276
  validatorToken: 1n,
267
277
  amountOut: parseUnits('10', 6),
@@ -270,17 +280,17 @@ describe('rebalanceSwap', () => {
270
280
  })
271
281
  expect(swapReceipt).toBeDefined()
272
282
  expect(userToken).toBe(tokenAddress)
283
+ expect(swapper).toBe(account.address)
273
284
  expect(swapResult).toMatchInlineSnapshot(`
274
285
  {
275
286
  "amountIn": 9985001n,
276
287
  "amountOut": 10000000n,
277
- "swapper": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
278
288
  "validatorToken": "0x20C0000000000000000000000000000000000001",
279
289
  }
280
290
  `)
281
291
 
282
292
  // Verify balance increased
283
- const balanceAfter = await Actions.token.getBalance(client, {
293
+ const balanceAfter = await Actions.token.getBalance(clientWithAccount, {
284
294
  token: tokenAddress,
285
295
  account: account2.address,
286
296
  })
@@ -290,17 +300,17 @@ describe('rebalanceSwap', () => {
290
300
 
291
301
  describe('watchRebalanceSwap', () => {
292
302
  test('default', async () => {
293
- const { tokenAddress } = await setupPoolWithLiquidity(client)
303
+ const { tokenAddress } = await setupPoolWithLiquidity(clientWithAccount)
294
304
 
295
305
  let eventArgs: any = null
296
- const unwatch = Actions.amm.watchRebalanceSwap(client, {
306
+ const unwatch = Actions.amm.watchRebalanceSwap(clientWithAccount, {
297
307
  onRebalanceSwap: (args) => {
298
308
  eventArgs = args
299
309
  },
300
310
  })
301
311
 
302
312
  // Perform rebalance swap
303
- await Actions.amm.rebalanceSwapSync(client, {
313
+ await Actions.amm.rebalanceSwapSync(clientWithAccount, {
304
314
  userToken: tokenAddress,
305
315
  validatorToken: 1n,
306
316
  amountOut: parseUnits('10', 6),
@@ -324,28 +334,28 @@ describe('watchRebalanceSwap', () => {
324
334
  describe('watchMint', () => {
325
335
  test('default', async () => {
326
336
  // Create a new token for testing
327
- const { token } = await Actions.token.createSync(client, {
337
+ const { token } = await Actions.token.createSync(clientWithAccount, {
328
338
  name: 'Test Token 2',
329
339
  symbol: 'TEST2',
330
340
  currency: 'USD',
331
341
  })
332
342
 
333
343
  // Grant issuer role to mint tokens
334
- await Actions.token.grantRolesSync(client, {
344
+ await Actions.token.grantRolesSync(clientWithAccount, {
335
345
  token,
336
346
  roles: ['issuer'],
337
- to: client.account.address,
347
+ to: clientWithAccount.account.address,
338
348
  })
339
349
 
340
350
  // Mint some tokens to account
341
- await Actions.token.mintSync(client, {
351
+ await Actions.token.mintSync(clientWithAccount, {
342
352
  to: account.address,
343
353
  amount: parseUnits('1000', 6),
344
354
  token,
345
355
  })
346
356
 
347
357
  // Mint USD to account
348
- await writeContractSync(client, {
358
+ await writeContractSync(clientWithAccount, {
349
359
  abi: Abis.tip20,
350
360
  address: '0x20c0000000000000000000000000000000000001',
351
361
  functionName: 'transfer',
@@ -353,14 +363,14 @@ describe('watchMint', () => {
353
363
  })
354
364
 
355
365
  let eventArgs: any = null
356
- const unwatch = Actions.amm.watchMint(client, {
366
+ const unwatch = Actions.amm.watchMint(clientWithAccount, {
357
367
  onMint: (args) => {
358
368
  eventArgs = args
359
369
  },
360
370
  })
361
371
 
362
372
  // Add liquidity to pool
363
- await Actions.amm.mintSync(client, {
373
+ await Actions.amm.mintSync(clientWithAccount, {
364
374
  userToken: {
365
375
  address: token,
366
376
  amount: parseUnits('100', 6),
@@ -388,24 +398,24 @@ describe('watchMint', () => {
388
398
 
389
399
  describe('watchBurn', () => {
390
400
  test('default', async () => {
391
- const { tokenAddress } = await setupPoolWithLiquidity(client)
401
+ const { tokenAddress } = await setupPoolWithLiquidity(clientWithAccount)
392
402
 
393
403
  // Get LP balance
394
- const lpBalance = await Actions.amm.getLiquidityBalance(client, {
404
+ const lpBalance = await Actions.amm.getLiquidityBalance(clientWithAccount, {
395
405
  userToken: tokenAddress,
396
406
  validatorToken: 1n,
397
407
  address: account.address,
398
408
  })
399
409
 
400
410
  let eventArgs: any = null
401
- const unwatch = Actions.amm.watchBurn(client, {
411
+ const unwatch = Actions.amm.watchBurn(clientWithAccount, {
402
412
  onBurn: (args) => {
403
413
  eventArgs = args
404
414
  },
405
415
  })
406
416
 
407
417
  // Burn LP tokens
408
- await Actions.amm.burnSync(client, {
418
+ await Actions.amm.burnSync(clientWithAccount, {
409
419
  userToken: tokenAddress,
410
420
  validatorToken: 1n,
411
421
  liquidity: lpBalance / 2n,