tempo.ts 0.0.5 → 0.1.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.
- package/dist/chains.d.ts +244 -541
- package/dist/chains.d.ts.map +1 -1
- package/dist/chains.js +10 -23
- package/dist/chains.js.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/ox/SignatureEnvelope.d.ts +245 -0
- package/dist/ox/SignatureEnvelope.d.ts.map +1 -0
- package/dist/ox/SignatureEnvelope.js +437 -0
- package/dist/ox/SignatureEnvelope.js.map +1 -0
- package/dist/ox/Transaction.d.ts +61 -24
- package/dist/ox/Transaction.d.ts.map +1 -1
- package/dist/ox/Transaction.js +63 -18
- package/dist/ox/Transaction.js.map +1 -1
- package/dist/ox/TransactionEnvelopeAA.d.ts +461 -0
- package/dist/ox/TransactionEnvelopeAA.d.ts.map +1 -0
- package/dist/ox/TransactionEnvelopeAA.js +528 -0
- package/dist/ox/TransactionEnvelopeAA.js.map +1 -0
- package/dist/ox/TransactionRequest.d.ts +7 -5
- package/dist/ox/TransactionRequest.d.ts.map +1 -1
- package/dist/ox/TransactionRequest.js +21 -12
- package/dist/ox/TransactionRequest.js.map +1 -1
- package/dist/ox/index.d.ts +5 -4
- package/dist/ox/index.d.ts.map +1 -1
- package/dist/ox/index.js +5 -4
- package/dist/ox/index.js.map +1 -1
- package/dist/prool/Instance.d.ts +0 -4
- package/dist/prool/Instance.d.ts.map +1 -1
- package/dist/prool/Instance.js +7 -7
- package/dist/prool/Instance.js.map +1 -1
- package/dist/prool/index.d.ts +1 -1
- package/dist/prool/index.d.ts.map +1 -1
- package/dist/prool/index.js +1 -1
- package/dist/prool/index.js.map +1 -1
- package/dist/viem/{abis.d.ts → Abis.d.ts} +523 -9
- package/dist/viem/Abis.d.ts.map +1 -0
- package/dist/viem/{abis.js → Abis.js} +321 -9
- package/dist/viem/Abis.js.map +1 -0
- package/dist/viem/{actions → Actions}/amm.d.ts +21 -21
- package/dist/viem/Actions/amm.d.ts.map +1 -0
- package/dist/viem/{actions → Actions}/amm.js +55 -43
- package/dist/viem/Actions/amm.js.map +1 -0
- package/dist/viem/Actions/dex.d.ts +3263 -0
- package/dist/viem/Actions/dex.d.ts.map +1 -0
- package/dist/viem/Actions/dex.js +1357 -0
- package/dist/viem/Actions/dex.js.map +1 -0
- package/dist/viem/{actions → Actions}/fee.d.ts +8 -8
- package/dist/viem/Actions/fee.d.ts.map +1 -0
- package/dist/viem/{actions → Actions}/fee.js +14 -13
- package/dist/viem/Actions/fee.js.map +1 -0
- package/dist/viem/Actions/index.d.ts +6 -0
- package/dist/viem/Actions/index.d.ts.map +1 -0
- package/dist/viem/Actions/index.js +6 -0
- package/dist/viem/Actions/index.js.map +1 -0
- package/dist/viem/{actions → Actions}/policy.d.ts +19 -19
- package/dist/viem/Actions/policy.d.ts.map +1 -0
- package/dist/viem/{actions → Actions}/policy.js +59 -46
- package/dist/viem/Actions/policy.js.map +1 -0
- package/dist/viem/{actions → Actions}/token.d.ts +3251 -707
- package/dist/viem/Actions/token.d.ts.map +1 -0
- package/dist/viem/{actions → Actions}/token.js +420 -88
- package/dist/viem/Actions/token.js.map +1 -0
- package/dist/viem/Addresses.d.ts +9 -0
- package/dist/viem/Addresses.d.ts.map +1 -0
- package/dist/viem/Addresses.js +9 -0
- package/dist/viem/Addresses.js.map +1 -0
- package/dist/viem/{chain.d.ts → Chain.d.ts} +81 -57
- package/dist/viem/Chain.d.ts.map +1 -0
- package/dist/viem/{chain.js → Chain.js} +7 -7
- package/dist/viem/Chain.js.map +1 -0
- package/dist/viem/{client.d.ts → Client.d.ts} +4 -4
- package/dist/viem/Client.d.ts.map +1 -0
- package/dist/viem/{client.js → Client.js} +3 -3
- package/dist/viem/Client.js.map +1 -0
- package/dist/viem/{decorator.d.ts → Decorator.d.ts} +507 -5
- package/dist/viem/Decorator.d.ts.map +1 -0
- package/dist/viem/{decorator.js → Decorator.js} +31 -5
- package/dist/viem/Decorator.js.map +1 -0
- package/dist/viem/{formatters.d.ts → Formatters.d.ts} +2 -2
- package/dist/viem/Formatters.d.ts.map +1 -0
- package/dist/viem/{formatters.js → Formatters.js} +24 -17
- package/dist/viem/Formatters.js.map +1 -0
- package/dist/viem/Tick.d.ts +111 -0
- package/dist/viem/Tick.d.ts.map +1 -0
- package/dist/viem/Tick.js +127 -0
- package/dist/viem/Tick.js.map +1 -0
- package/dist/viem/TokenIds.d.ts +3 -0
- package/dist/viem/TokenIds.d.ts.map +1 -0
- package/dist/viem/TokenIds.js +3 -0
- package/dist/viem/TokenIds.js.map +1 -0
- package/dist/viem/Transaction.d.ts +57 -0
- package/dist/viem/Transaction.d.ts.map +1 -0
- package/dist/viem/Transaction.js +137 -0
- package/dist/viem/Transaction.js.map +1 -0
- package/dist/viem/{transport.d.ts → Transport.d.ts} +3 -3
- package/dist/viem/Transport.d.ts.map +1 -0
- package/dist/viem/{transport.js → Transport.js} +3 -3
- package/dist/viem/Transport.js.map +1 -0
- package/dist/viem/index.d.ts +13 -9
- package/dist/viem/index.d.ts.map +1 -1
- package/dist/viem/index.js +13 -9
- package/dist/viem/index.js.map +1 -1
- package/dist/viem/{types.d.ts → internal/types.d.ts} +3 -3
- package/dist/viem/internal/types.d.ts.map +1 -0
- package/dist/viem/{types.js.map → internal/types.js.map} +1 -1
- package/dist/viem/internal/utils.d.ts.map +1 -0
- package/dist/viem/internal/utils.js.map +1 -0
- package/package.json +87 -101
- package/src/chains.ts +10 -24
- package/src/ox/SignatureEnvelope.test.ts +1252 -0
- package/src/ox/SignatureEnvelope.ts +709 -0
- package/src/ox/Transaction.test.ts +144 -89
- package/src/ox/Transaction.ts +104 -29
- package/src/ox/TransactionEnvelopeAA.test.ts +1533 -0
- package/src/ox/TransactionEnvelopeAA.ts +858 -0
- package/src/ox/TransactionRequest.ts +25 -17
- package/src/ox/index.ts +2 -1
- package/src/prool/Instance.ts +6 -14
- package/src/prool/internal/chain.json +101 -27
- package/src/viem/{abis.ts → Abis.ts} +322 -8
- package/src/viem/{actions → Actions}/amm.test.ts +65 -68
- package/src/viem/{actions → Actions}/amm.ts +72 -60
- package/src/viem/Actions/dex.test.ts +1608 -0
- package/src/viem/Actions/dex.ts +2026 -0
- package/src/viem/{actions → Actions}/fee.test.ts +34 -36
- package/src/viem/{actions → Actions}/fee.ts +18 -17
- package/src/viem/{actions → Actions}/index.ts +1 -0
- package/src/viem/{actions → Actions}/policy.test.ts +2 -2
- package/src/viem/{actions → Actions}/policy.ts +77 -64
- package/src/viem/{actions → Actions}/token.test.ts +406 -67
- package/src/viem/{actions → Actions}/token.ts +675 -144
- package/src/viem/Addresses.ts +9 -0
- package/src/viem/{chain.ts → Chain.ts} +6 -6
- package/src/viem/{client.bench-d.ts → Client.bench-d.ts} +2 -2
- package/src/viem/{client.test.ts → Client.test.ts} +31 -6
- package/src/viem/{client.ts → Client.ts} +1 -1
- package/src/viem/{decorator.bench-d.ts → Decorator.bench-d.ts} +2 -2
- package/src/viem/{decorator.test.ts → Decorator.test.ts} +1 -0
- package/src/viem/{decorator.ts → Decorator.ts} +586 -4
- package/src/viem/{formatters.ts → Formatters.ts} +31 -20
- package/src/viem/Tick.test.ts +281 -0
- package/src/viem/Tick.ts +176 -0
- package/src/viem/TokenIds.ts +2 -0
- package/src/viem/Transaction.ts +303 -0
- package/src/viem/{transport.ts → Transport.ts} +5 -5
- package/src/viem/e2e.test.ts +153 -78
- package/src/viem/index.ts +13 -9
- package/src/viem/{types.ts → internal/types.ts} +3 -3
- package/dist/ox/TransactionEnvelopeFeeToken.d.ts +0 -393
- package/dist/ox/TransactionEnvelopeFeeToken.d.ts.map +0 -1
- package/dist/ox/TransactionEnvelopeFeeToken.js +0 -452
- package/dist/ox/TransactionEnvelopeFeeToken.js.map +0 -1
- package/dist/viem/abis.d.ts.map +0 -1
- package/dist/viem/abis.js.map +0 -1
- package/dist/viem/actions/amm.d.ts.map +0 -1
- package/dist/viem/actions/amm.js.map +0 -1
- package/dist/viem/actions/fee.d.ts.map +0 -1
- package/dist/viem/actions/fee.js.map +0 -1
- package/dist/viem/actions/index.d.ts +0 -5
- package/dist/viem/actions/index.d.ts.map +0 -1
- package/dist/viem/actions/index.js +0 -5
- package/dist/viem/actions/index.js.map +0 -1
- package/dist/viem/actions/policy.d.ts.map +0 -1
- package/dist/viem/actions/policy.js.map +0 -1
- package/dist/viem/actions/token.d.ts.map +0 -1
- package/dist/viem/actions/token.js.map +0 -1
- package/dist/viem/addresses.d.ts +0 -8
- package/dist/viem/addresses.d.ts.map +0 -1
- package/dist/viem/addresses.js +0 -8
- package/dist/viem/addresses.js.map +0 -1
- package/dist/viem/chain.d.ts.map +0 -1
- package/dist/viem/chain.js.map +0 -1
- package/dist/viem/client.d.ts.map +0 -1
- package/dist/viem/client.js.map +0 -1
- package/dist/viem/decorator.d.ts.map +0 -1
- package/dist/viem/decorator.js.map +0 -1
- package/dist/viem/formatters.d.ts.map +0 -1
- package/dist/viem/formatters.js.map +0 -1
- package/dist/viem/transaction.d.ts +0 -54
- package/dist/viem/transaction.d.ts.map +0 -1
- package/dist/viem/transaction.js +0 -108
- package/dist/viem/transaction.js.map +0 -1
- package/dist/viem/transport.d.ts.map +0 -1
- package/dist/viem/transport.js.map +0 -1
- package/dist/viem/types.d.ts.map +0 -1
- package/dist/viem/utils.d.ts.map +0 -1
- package/dist/viem/utils.js.map +0 -1
- package/src/ox/TransactionEnvelopeFeeToken.test.ts +0 -1119
- package/src/ox/TransactionEnvelopeFeeToken.ts +0 -717
- package/src/prool/internal/consensus.toml +0 -32
- package/src/viem/addresses.ts +0 -10
- package/src/viem/transaction.ts +0 -253
- /package/dist/viem/{types.js → internal/types.js} +0 -0
- /package/dist/viem/{utils.d.ts → internal/utils.d.ts} +0 -0
- /package/dist/viem/{utils.js → internal/utils.js} +0 -0
- /package/src/viem/{utils.ts → internal/utils.ts} +0 -0
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { setTimeout } from 'node:timers/promises'
|
|
2
2
|
import { Hex } from 'ox'
|
|
3
|
-
import
|
|
3
|
+
import { Abis, Addresses, TokenIds } from 'tempo.ts/viem'
|
|
4
4
|
import { parseEther, publicActions } from 'viem'
|
|
5
5
|
import { mnemonicToAccount } from 'viem/accounts'
|
|
6
6
|
import { getCode, writeContractSync } from 'viem/actions'
|
|
7
7
|
import { describe, expect, test } from 'vitest'
|
|
8
8
|
import { tempoTest } from '../../../test/viem/config.js'
|
|
9
|
-
import {
|
|
10
|
-
import
|
|
11
|
-
import { createTempoClient } from '../client.js'
|
|
9
|
+
import { createTempoClient } from '../Client.js'
|
|
10
|
+
import * as actions from './index.js'
|
|
12
11
|
|
|
13
12
|
const account = mnemonicToAccount(
|
|
14
13
|
'test test test test test test test test test test test junk',
|
|
@@ -56,8 +55,8 @@ describe('approve', () => {
|
|
|
56
55
|
|
|
57
56
|
// transfer tokens for gas
|
|
58
57
|
await writeContractSync(client, {
|
|
59
|
-
abi:
|
|
60
|
-
address:
|
|
58
|
+
abi: Abis.tip20,
|
|
59
|
+
address: Addresses.defaultFeeToken,
|
|
61
60
|
functionName: 'transfer',
|
|
62
61
|
args: [account2.address, parseEther('1')],
|
|
63
62
|
})
|
|
@@ -90,7 +89,7 @@ describe('approve', () => {
|
|
|
90
89
|
// approve
|
|
91
90
|
const { receipt, ...result } = await actions.token.approveSync(client, {
|
|
92
91
|
amount: parseEther('100'),
|
|
93
|
-
token:
|
|
92
|
+
token: Addresses.defaultFeeToken,
|
|
94
93
|
spender: account2.address,
|
|
95
94
|
})
|
|
96
95
|
expect(receipt).toBeDefined()
|
|
@@ -106,7 +105,7 @@ describe('approve', () => {
|
|
|
106
105
|
{
|
|
107
106
|
// check allowance
|
|
108
107
|
const allowance = await actions.token.getAllowance(client, {
|
|
109
|
-
token:
|
|
108
|
+
token: Addresses.defaultFeeToken,
|
|
110
109
|
spender: account2.address,
|
|
111
110
|
})
|
|
112
111
|
expect(allowance).toBe(parseEther('100'))
|
|
@@ -114,8 +113,8 @@ describe('approve', () => {
|
|
|
114
113
|
|
|
115
114
|
// transfer tokens for gas
|
|
116
115
|
await writeContractSync(client, {
|
|
117
|
-
abi:
|
|
118
|
-
address:
|
|
116
|
+
abi: Abis.tip20,
|
|
117
|
+
address: Addresses.defaultFeeToken,
|
|
119
118
|
functionName: 'transfer',
|
|
120
119
|
args: [account2.address, parseEther('1')],
|
|
121
120
|
})
|
|
@@ -126,14 +125,14 @@ describe('approve', () => {
|
|
|
126
125
|
account: account2,
|
|
127
126
|
from: account.address,
|
|
128
127
|
to: '0x0000000000000000000000000000000000000001',
|
|
129
|
-
token:
|
|
128
|
+
token: Addresses.defaultFeeToken,
|
|
130
129
|
})
|
|
131
130
|
|
|
132
131
|
{
|
|
133
132
|
// verify updated allowance
|
|
134
133
|
const allowance = await actions.token.getAllowance(client, {
|
|
135
134
|
spender: account2.address,
|
|
136
|
-
token:
|
|
135
|
+
token: Addresses.defaultFeeToken,
|
|
137
136
|
})
|
|
138
137
|
expect(allowance).toBe(parseEther('50'))
|
|
139
138
|
}
|
|
@@ -141,7 +140,7 @@ describe('approve', () => {
|
|
|
141
140
|
// verify balance
|
|
142
141
|
const balance = await actions.token.getBalance(client, {
|
|
143
142
|
account: '0x0000000000000000000000000000000000000001',
|
|
144
|
-
token:
|
|
143
|
+
token: Addresses.defaultFeeToken,
|
|
145
144
|
})
|
|
146
145
|
expect(balance).toBe(parseEther('50'))
|
|
147
146
|
})
|
|
@@ -151,7 +150,7 @@ describe('approve', () => {
|
|
|
151
150
|
// approve
|
|
152
151
|
const { receipt, ...result } = await actions.token.approveSync(client, {
|
|
153
152
|
amount: parseEther('100'),
|
|
154
|
-
token:
|
|
153
|
+
token: TokenIds.defaultFeeToken,
|
|
155
154
|
spender: account2.address,
|
|
156
155
|
})
|
|
157
156
|
expect(receipt).toBeDefined()
|
|
@@ -167,7 +166,7 @@ describe('approve', () => {
|
|
|
167
166
|
{
|
|
168
167
|
// check allowance
|
|
169
168
|
const allowance = await actions.token.getAllowance(client, {
|
|
170
|
-
token:
|
|
169
|
+
token: TokenIds.defaultFeeToken,
|
|
171
170
|
spender: account2.address,
|
|
172
171
|
})
|
|
173
172
|
expect(allowance).toBe(parseEther('100'))
|
|
@@ -175,8 +174,8 @@ describe('approve', () => {
|
|
|
175
174
|
|
|
176
175
|
// transfer tokens for gas
|
|
177
176
|
await writeContractSync(client, {
|
|
178
|
-
abi:
|
|
179
|
-
address:
|
|
177
|
+
abi: Abis.tip20,
|
|
178
|
+
address: Addresses.defaultFeeToken,
|
|
180
179
|
functionName: 'transfer',
|
|
181
180
|
args: [account2.address, parseEther('1')],
|
|
182
181
|
})
|
|
@@ -187,14 +186,14 @@ describe('approve', () => {
|
|
|
187
186
|
account: account2,
|
|
188
187
|
from: account.address,
|
|
189
188
|
to: '0x0000000000000000000000000000000000000001',
|
|
190
|
-
token:
|
|
189
|
+
token: TokenIds.defaultFeeToken,
|
|
191
190
|
})
|
|
192
191
|
|
|
193
192
|
{
|
|
194
193
|
// verify updated allowance
|
|
195
194
|
const allowance = await actions.token.getAllowance(client, {
|
|
196
195
|
spender: account2.address,
|
|
197
|
-
token:
|
|
196
|
+
token: TokenIds.defaultFeeToken,
|
|
198
197
|
})
|
|
199
198
|
expect(allowance).toBe(parseEther('50'))
|
|
200
199
|
}
|
|
@@ -202,7 +201,7 @@ describe('approve', () => {
|
|
|
202
201
|
// verify balance
|
|
203
202
|
const balance = await actions.token.getBalance(client, {
|
|
204
203
|
account: '0x0000000000000000000000000000000000000001',
|
|
205
|
-
token:
|
|
204
|
+
token: TokenIds.defaultFeeToken,
|
|
206
205
|
})
|
|
207
206
|
expect(balance).toBe(parseEther('50'))
|
|
208
207
|
})
|
|
@@ -217,15 +216,15 @@ describe('create', () => {
|
|
|
217
216
|
})
|
|
218
217
|
|
|
219
218
|
expect(result).toMatchInlineSnapshot(`
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
219
|
+
{
|
|
220
|
+
"admin": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
|
|
221
|
+
"currency": "USD",
|
|
222
|
+
"name": "Test USD",
|
|
223
|
+
"symbol": "TUSD",
|
|
224
|
+
"token": "0x20C0000000000000000000000000000000000004",
|
|
225
|
+
"tokenId": 4n,
|
|
226
|
+
}
|
|
227
|
+
`)
|
|
229
228
|
expect(receipt).toBeDefined()
|
|
230
229
|
|
|
231
230
|
const code = await getCode(client, {
|
|
@@ -239,8 +238,8 @@ describe('getAllowance', () => {
|
|
|
239
238
|
test('default', async () => {
|
|
240
239
|
// First, approve some allowance
|
|
241
240
|
await writeContractSync(client, {
|
|
242
|
-
abi:
|
|
243
|
-
address:
|
|
241
|
+
abi: Abis.tip20,
|
|
242
|
+
address: Addresses.defaultFeeToken,
|
|
244
243
|
functionName: 'approve',
|
|
245
244
|
args: [account2.address, parseEther('50')],
|
|
246
245
|
})
|
|
@@ -256,7 +255,7 @@ describe('getAllowance', () => {
|
|
|
256
255
|
{
|
|
257
256
|
// Test with token address
|
|
258
257
|
const allowance = await actions.token.getAllowance(client, {
|
|
259
|
-
token:
|
|
258
|
+
token: Addresses.defaultFeeToken,
|
|
260
259
|
spender: account2.address,
|
|
261
260
|
})
|
|
262
261
|
|
|
@@ -266,7 +265,7 @@ describe('getAllowance', () => {
|
|
|
266
265
|
{
|
|
267
266
|
// Test with token ID
|
|
268
267
|
const allowance = await actions.token.getAllowance(client, {
|
|
269
|
-
token:
|
|
268
|
+
token: TokenIds.defaultFeeToken,
|
|
270
269
|
spender: account2.address,
|
|
271
270
|
})
|
|
272
271
|
|
|
@@ -286,7 +285,7 @@ describe('getBalance', () => {
|
|
|
286
285
|
{
|
|
287
286
|
// Test with token address
|
|
288
287
|
const balance = await actions.token.getBalance(client, {
|
|
289
|
-
token:
|
|
288
|
+
token: Addresses.defaultFeeToken,
|
|
290
289
|
})
|
|
291
290
|
|
|
292
291
|
expect(balance).toBeGreaterThan(0n)
|
|
@@ -295,7 +294,7 @@ describe('getBalance', () => {
|
|
|
295
294
|
{
|
|
296
295
|
// Test with token ID & different account
|
|
297
296
|
const balance = await actions.token.getBalance(client, {
|
|
298
|
-
token:
|
|
297
|
+
token: TokenIds.defaultFeeToken,
|
|
299
298
|
account: Hex.random(20),
|
|
300
299
|
})
|
|
301
300
|
|
|
@@ -312,12 +311,13 @@ describe('getMetadata', () => {
|
|
|
312
311
|
{
|
|
313
312
|
"currency": "USD",
|
|
314
313
|
"decimals": 6,
|
|
315
|
-
"name": "
|
|
314
|
+
"name": "AlphaUSD",
|
|
316
315
|
"paused": false,
|
|
316
|
+
"quoteToken": "0x20C0000000000000000000000000000000000000",
|
|
317
317
|
"supplyCap": 115792089237316195423570985008687907853269984665640564039457584007913129639935n,
|
|
318
|
-
"symbol": "
|
|
319
|
-
"totalSupply":
|
|
320
|
-
"
|
|
318
|
+
"symbol": "AlphaUSD",
|
|
319
|
+
"totalSupply": 340282366920938463481821351505477763070n,
|
|
320
|
+
"transferPolicyId": 1n,
|
|
321
321
|
}
|
|
322
322
|
`)
|
|
323
323
|
})
|
|
@@ -339,10 +339,11 @@ describe('getMetadata', () => {
|
|
|
339
339
|
"decimals": 6,
|
|
340
340
|
"name": "Test USD",
|
|
341
341
|
"paused": false,
|
|
342
|
+
"quoteToken": "0x20C0000000000000000000000000000000000000",
|
|
342
343
|
"supplyCap": 115792089237316195423570985008687907853269984665640564039457584007913129639935n,
|
|
343
344
|
"symbol": "TUSD",
|
|
344
345
|
"totalSupply": 0n,
|
|
345
|
-
"
|
|
346
|
+
"transferPolicyId": 1n,
|
|
346
347
|
}
|
|
347
348
|
`)
|
|
348
349
|
})
|
|
@@ -364,10 +365,11 @@ describe('getMetadata', () => {
|
|
|
364
365
|
"decimals": 6,
|
|
365
366
|
"name": "Test USD",
|
|
366
367
|
"paused": false,
|
|
368
|
+
"quoteToken": "0x20C0000000000000000000000000000000000000",
|
|
367
369
|
"supplyCap": 115792089237316195423570985008687907853269984665640564039457584007913129639935n,
|
|
368
370
|
"symbol": "TUSD",
|
|
369
371
|
"totalSupply": 0n,
|
|
370
|
-
"
|
|
372
|
+
"transferPolicyId": 1n,
|
|
371
373
|
}
|
|
372
374
|
`)
|
|
373
375
|
})
|
|
@@ -573,8 +575,8 @@ describe('transfer', () => {
|
|
|
573
575
|
|
|
574
576
|
// Transfer tokens for gas
|
|
575
577
|
await writeContractSync(client, {
|
|
576
|
-
abi:
|
|
577
|
-
address:
|
|
578
|
+
abi: Abis.tip20,
|
|
579
|
+
address: Addresses.defaultFeeToken,
|
|
578
580
|
functionName: 'transfer',
|
|
579
581
|
args: [account2.address, parseEther('1')],
|
|
580
582
|
})
|
|
@@ -684,8 +686,8 @@ describe('burn', () => {
|
|
|
684
686
|
|
|
685
687
|
// Transfer gas to account2
|
|
686
688
|
await writeContractSync(client, {
|
|
687
|
-
abi:
|
|
688
|
-
address:
|
|
689
|
+
abi: Abis.tip20,
|
|
690
|
+
address: Addresses.defaultFeeToken,
|
|
689
691
|
functionName: 'transfer',
|
|
690
692
|
args: [account2.address, parseEther('1')],
|
|
691
693
|
})
|
|
@@ -748,8 +750,8 @@ describe('pause', () => {
|
|
|
748
750
|
|
|
749
751
|
// Transfer gas
|
|
750
752
|
await writeContractSync(client, {
|
|
751
|
-
abi:
|
|
752
|
-
address:
|
|
753
|
+
abi: Abis.tip20,
|
|
754
|
+
address: Addresses.defaultFeeToken,
|
|
753
755
|
functionName: 'transfer',
|
|
754
756
|
args: [account2.address, parseEther('1')],
|
|
755
757
|
})
|
|
@@ -815,8 +817,8 @@ describe('pause', () => {
|
|
|
815
817
|
|
|
816
818
|
// Transfer gas to account2
|
|
817
819
|
await writeContractSync(client, {
|
|
818
|
-
abi:
|
|
819
|
-
address:
|
|
820
|
+
abi: Abis.tip20,
|
|
821
|
+
address: Addresses.defaultFeeToken,
|
|
820
822
|
functionName: 'transfer',
|
|
821
823
|
args: [account2.address, parseEther('1')],
|
|
822
824
|
})
|
|
@@ -916,8 +918,8 @@ describe('unpause', () => {
|
|
|
916
918
|
|
|
917
919
|
// Transfer gas to account2
|
|
918
920
|
await writeContractSync(client, {
|
|
919
|
-
abi:
|
|
920
|
-
address:
|
|
921
|
+
abi: Abis.tip20,
|
|
922
|
+
address: Addresses.defaultFeeToken,
|
|
921
923
|
functionName: 'transfer',
|
|
922
924
|
args: [account2.address, parseEther('1')],
|
|
923
925
|
})
|
|
@@ -1001,8 +1003,8 @@ describe('unpause', () => {
|
|
|
1001
1003
|
|
|
1002
1004
|
// Transfer gas to account2
|
|
1003
1005
|
await writeContractSync(client, {
|
|
1004
|
-
abi:
|
|
1005
|
-
address:
|
|
1006
|
+
abi: Abis.tip20,
|
|
1007
|
+
address: Addresses.defaultFeeToken,
|
|
1006
1008
|
functionName: 'transfer',
|
|
1007
1009
|
args: [account2.address, parseEther('1')],
|
|
1008
1010
|
})
|
|
@@ -1044,15 +1046,15 @@ describe('unpause', () => {
|
|
|
1044
1046
|
|
|
1045
1047
|
// Transfer gas to both accounts
|
|
1046
1048
|
await writeContractSync(client, {
|
|
1047
|
-
abi:
|
|
1048
|
-
address:
|
|
1049
|
+
abi: Abis.tip20,
|
|
1050
|
+
address: Addresses.defaultFeeToken,
|
|
1049
1051
|
functionName: 'transfer',
|
|
1050
1052
|
args: [account2.address, parseEther('1')],
|
|
1051
1053
|
})
|
|
1052
1054
|
|
|
1053
1055
|
await writeContractSync(client, {
|
|
1054
|
-
abi:
|
|
1055
|
-
address:
|
|
1056
|
+
abi: Abis.tip20,
|
|
1057
|
+
address: Addresses.defaultFeeToken,
|
|
1056
1058
|
functionName: 'transfer',
|
|
1057
1059
|
args: [account3.address, parseEther('1')],
|
|
1058
1060
|
})
|
|
@@ -1085,6 +1087,230 @@ describe('unpause', () => {
|
|
|
1085
1087
|
})
|
|
1086
1088
|
})
|
|
1087
1089
|
|
|
1090
|
+
describe('updateQuoteToken', () => {
|
|
1091
|
+
test('default', async () => {
|
|
1092
|
+
// Create two tokens - one to be the new quote token
|
|
1093
|
+
const { token: quoteTokenAddress } = await actions.token.createSync(
|
|
1094
|
+
client,
|
|
1095
|
+
{
|
|
1096
|
+
currency: 'USD',
|
|
1097
|
+
name: 'Quote Token',
|
|
1098
|
+
symbol: 'LINK',
|
|
1099
|
+
},
|
|
1100
|
+
)
|
|
1101
|
+
|
|
1102
|
+
const { token: address } = await actions.token.createSync(client, {
|
|
1103
|
+
currency: 'USD',
|
|
1104
|
+
name: 'Main Token',
|
|
1105
|
+
symbol: 'MAIN',
|
|
1106
|
+
})
|
|
1107
|
+
|
|
1108
|
+
// Update quote token
|
|
1109
|
+
const { receipt: updateReceipt, ...updateResult } =
|
|
1110
|
+
await actions.token.updateQuoteTokenSync(client, {
|
|
1111
|
+
token: address,
|
|
1112
|
+
quoteToken: quoteTokenAddress,
|
|
1113
|
+
})
|
|
1114
|
+
|
|
1115
|
+
expect(updateReceipt).toBeDefined()
|
|
1116
|
+
expect(updateResult).toMatchInlineSnapshot(`
|
|
1117
|
+
{
|
|
1118
|
+
"newQuoteToken": "0x20C0000000000000000000000000000000000004",
|
|
1119
|
+
"updater": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
|
|
1120
|
+
}
|
|
1121
|
+
`)
|
|
1122
|
+
|
|
1123
|
+
// Verify the event was emitted with correct quote token
|
|
1124
|
+
expect(updateResult.newQuoteToken).toBe(quoteTokenAddress)
|
|
1125
|
+
})
|
|
1126
|
+
|
|
1127
|
+
test('behavior: requires admin role', async () => {
|
|
1128
|
+
// Create quote token
|
|
1129
|
+
const { token: quoteTokenAddress } = await actions.token.createSync(
|
|
1130
|
+
client,
|
|
1131
|
+
{
|
|
1132
|
+
currency: 'USD',
|
|
1133
|
+
name: 'Quote Token 2',
|
|
1134
|
+
symbol: 'LINK2',
|
|
1135
|
+
},
|
|
1136
|
+
)
|
|
1137
|
+
|
|
1138
|
+
// Create main token where client.account is admin
|
|
1139
|
+
const { token: address } = await actions.token.createSync(client, {
|
|
1140
|
+
currency: 'USD',
|
|
1141
|
+
name: 'Restricted Token',
|
|
1142
|
+
symbol: 'RESTR',
|
|
1143
|
+
})
|
|
1144
|
+
|
|
1145
|
+
// Transfer gas to account2
|
|
1146
|
+
await writeContractSync(client, {
|
|
1147
|
+
abi: Abis.tip20,
|
|
1148
|
+
address: Addresses.defaultFeeToken,
|
|
1149
|
+
functionName: 'transfer',
|
|
1150
|
+
args: [account2.address, parseEther('1')],
|
|
1151
|
+
})
|
|
1152
|
+
|
|
1153
|
+
// Try to update quote token from account2 (not admin) - should fail
|
|
1154
|
+
await expect(
|
|
1155
|
+
actions.token.updateQuoteTokenSync(client, {
|
|
1156
|
+
account: account2,
|
|
1157
|
+
token: address,
|
|
1158
|
+
quoteToken: quoteTokenAddress,
|
|
1159
|
+
}),
|
|
1160
|
+
).rejects.toThrow()
|
|
1161
|
+
})
|
|
1162
|
+
|
|
1163
|
+
test('behavior: with token ID', async () => {
|
|
1164
|
+
// Create quote token
|
|
1165
|
+
const { token: quoteTokenAddress } = await actions.token.createSync(
|
|
1166
|
+
client,
|
|
1167
|
+
{
|
|
1168
|
+
currency: 'USD',
|
|
1169
|
+
name: 'Quote Token 3',
|
|
1170
|
+
symbol: 'LINK3',
|
|
1171
|
+
},
|
|
1172
|
+
)
|
|
1173
|
+
|
|
1174
|
+
// Create main token using token ID
|
|
1175
|
+
const { tokenId: mainTokenId } = await actions.token.createSync(client, {
|
|
1176
|
+
currency: 'USD',
|
|
1177
|
+
name: 'Main Token ID',
|
|
1178
|
+
symbol: 'MAINID',
|
|
1179
|
+
})
|
|
1180
|
+
|
|
1181
|
+
// Update quote token using token ID for main token, address for quote token
|
|
1182
|
+
const { receipt: updateReceipt, ...updateResult } =
|
|
1183
|
+
await actions.token.updateQuoteTokenSync(client, {
|
|
1184
|
+
token: mainTokenId,
|
|
1185
|
+
quoteToken: quoteTokenAddress,
|
|
1186
|
+
})
|
|
1187
|
+
|
|
1188
|
+
expect(updateReceipt.status).toBe('success')
|
|
1189
|
+
expect(updateResult.updater).toBe(client.account.address)
|
|
1190
|
+
})
|
|
1191
|
+
})
|
|
1192
|
+
|
|
1193
|
+
describe('finalizeUpdateQuoteToken', () => {
|
|
1194
|
+
test('default', async () => {
|
|
1195
|
+
// Create quote token
|
|
1196
|
+
const { token: quoteTokenAddress } = await actions.token.createSync(
|
|
1197
|
+
client,
|
|
1198
|
+
{
|
|
1199
|
+
currency: 'USD',
|
|
1200
|
+
name: 'Quote Token',
|
|
1201
|
+
symbol: 'LINK',
|
|
1202
|
+
},
|
|
1203
|
+
)
|
|
1204
|
+
|
|
1205
|
+
// Create main token
|
|
1206
|
+
const { token: address } = await actions.token.createSync(client, {
|
|
1207
|
+
currency: 'USD',
|
|
1208
|
+
name: 'Main Token',
|
|
1209
|
+
symbol: 'MAIN',
|
|
1210
|
+
})
|
|
1211
|
+
|
|
1212
|
+
// Update quote token (step 1)
|
|
1213
|
+
await actions.token.updateQuoteTokenSync(client, {
|
|
1214
|
+
token: address,
|
|
1215
|
+
quoteToken: quoteTokenAddress,
|
|
1216
|
+
})
|
|
1217
|
+
|
|
1218
|
+
// Finalize the update (step 2)
|
|
1219
|
+
const { receipt: finalizeReceipt, ...finalizeResult } =
|
|
1220
|
+
await actions.token.finalizeUpdateQuoteTokenSync(client, {
|
|
1221
|
+
token: address,
|
|
1222
|
+
})
|
|
1223
|
+
|
|
1224
|
+
expect(finalizeReceipt).toBeDefined()
|
|
1225
|
+
expect(finalizeResult).toMatchInlineSnapshot(`
|
|
1226
|
+
{
|
|
1227
|
+
"newQuoteToken": "0x20C0000000000000000000000000000000000004",
|
|
1228
|
+
"updater": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
|
|
1229
|
+
}
|
|
1230
|
+
`)
|
|
1231
|
+
|
|
1232
|
+
// Verify the quote token was updated
|
|
1233
|
+
expect(finalizeResult.newQuoteToken).toBe(quoteTokenAddress)
|
|
1234
|
+
|
|
1235
|
+
// Verify it's reflected in metadata
|
|
1236
|
+
const metadata = await actions.token.getMetadata(client, {
|
|
1237
|
+
token: address,
|
|
1238
|
+
})
|
|
1239
|
+
expect(metadata.quoteToken).toBe(quoteTokenAddress)
|
|
1240
|
+
})
|
|
1241
|
+
|
|
1242
|
+
test('behavior: requires admin role', async () => {
|
|
1243
|
+
// Create quote token
|
|
1244
|
+
const { token: quoteTokenAddress } = await actions.token.createSync(
|
|
1245
|
+
client,
|
|
1246
|
+
{
|
|
1247
|
+
currency: 'USD',
|
|
1248
|
+
name: 'Quote Token 2',
|
|
1249
|
+
symbol: 'LINK2',
|
|
1250
|
+
},
|
|
1251
|
+
)
|
|
1252
|
+
|
|
1253
|
+
// Create main token
|
|
1254
|
+
const { token: address } = await actions.token.createSync(client, {
|
|
1255
|
+
currency: 'USD',
|
|
1256
|
+
name: 'Restricted Token',
|
|
1257
|
+
symbol: 'RESTR',
|
|
1258
|
+
})
|
|
1259
|
+
|
|
1260
|
+
// Update quote token as admin
|
|
1261
|
+
await actions.token.updateQuoteTokenSync(client, {
|
|
1262
|
+
token: address,
|
|
1263
|
+
quoteToken: quoteTokenAddress,
|
|
1264
|
+
})
|
|
1265
|
+
|
|
1266
|
+
// Transfer gas to account2
|
|
1267
|
+
await writeContractSync(client, {
|
|
1268
|
+
abi: Abis.tip20,
|
|
1269
|
+
address: Addresses.defaultFeeToken,
|
|
1270
|
+
functionName: 'transfer',
|
|
1271
|
+
args: [account2.address, parseEther('1')],
|
|
1272
|
+
})
|
|
1273
|
+
|
|
1274
|
+
// Try to finalize as non-admin - should fail
|
|
1275
|
+
await expect(
|
|
1276
|
+
actions.token.finalizeUpdateQuoteTokenSync(client, {
|
|
1277
|
+
account: account2,
|
|
1278
|
+
token: address,
|
|
1279
|
+
}),
|
|
1280
|
+
).rejects.toThrow()
|
|
1281
|
+
})
|
|
1282
|
+
|
|
1283
|
+
test('behavior: prevents circular references', async () => {
|
|
1284
|
+
// Create token B
|
|
1285
|
+
const { token: tokenBAddress } = await actions.token.createSync(client, {
|
|
1286
|
+
currency: 'USD',
|
|
1287
|
+
name: 'Token B',
|
|
1288
|
+
symbol: 'TKB',
|
|
1289
|
+
})
|
|
1290
|
+
|
|
1291
|
+
// Create token A that links to token B
|
|
1292
|
+
const { token: tokenAAddress } = await actions.token.createSync(client, {
|
|
1293
|
+
currency: 'USD',
|
|
1294
|
+
name: 'Token A',
|
|
1295
|
+
symbol: 'TKA',
|
|
1296
|
+
quoteToken: tokenBAddress,
|
|
1297
|
+
})
|
|
1298
|
+
|
|
1299
|
+
// Try to make token B link to token A (would create A -> B -> A loop)
|
|
1300
|
+
await actions.token.updateQuoteTokenSync(client, {
|
|
1301
|
+
token: tokenBAddress,
|
|
1302
|
+
quoteToken: tokenAAddress,
|
|
1303
|
+
})
|
|
1304
|
+
|
|
1305
|
+
// Finalize should fail due to circular reference detection
|
|
1306
|
+
await expect(
|
|
1307
|
+
actions.token.finalizeUpdateQuoteTokenSync(client, {
|
|
1308
|
+
token: tokenBAddress,
|
|
1309
|
+
}),
|
|
1310
|
+
).rejects.toThrow()
|
|
1311
|
+
})
|
|
1312
|
+
})
|
|
1313
|
+
|
|
1088
1314
|
describe.todo('setTokenSupplyCap')
|
|
1089
1315
|
|
|
1090
1316
|
describe('hasRole', () => {
|
|
@@ -1422,8 +1648,8 @@ describe('watchCreate', () => {
|
|
|
1422
1648
|
"currency": "USD",
|
|
1423
1649
|
"name": "Watch Test Token 1",
|
|
1424
1650
|
"symbol": "WATCH1",
|
|
1425
|
-
"token": "
|
|
1426
|
-
"tokenId":
|
|
1651
|
+
"token": "0x20C0000000000000000000000000000000000004",
|
|
1652
|
+
"tokenId": 4n,
|
|
1427
1653
|
}
|
|
1428
1654
|
`)
|
|
1429
1655
|
expect(receivedTokens.at(1)!.args).toMatchInlineSnapshot(`
|
|
@@ -1432,8 +1658,8 @@ describe('watchCreate', () => {
|
|
|
1432
1658
|
"currency": "USD",
|
|
1433
1659
|
"name": "Watch Test Token 2",
|
|
1434
1660
|
"symbol": "WATCH2",
|
|
1435
|
-
"token": "
|
|
1436
|
-
"tokenId":
|
|
1661
|
+
"token": "0x20c0000000000000000000000000000000000005",
|
|
1662
|
+
"tokenId": 5n,
|
|
1437
1663
|
}
|
|
1438
1664
|
`)
|
|
1439
1665
|
} finally {
|
|
@@ -1503,8 +1729,8 @@ describe('watchCreate', () => {
|
|
|
1503
1729
|
"currency": "USD",
|
|
1504
1730
|
"name": "Filtered Watch Token 2",
|
|
1505
1731
|
"symbol": "FWATCH2",
|
|
1506
|
-
"token": "
|
|
1507
|
-
"tokenId":
|
|
1732
|
+
"token": "0x20C0000000000000000000000000000000000006",
|
|
1733
|
+
"tokenId": 6n,
|
|
1508
1734
|
}
|
|
1509
1735
|
`)
|
|
1510
1736
|
|
|
@@ -1856,8 +2082,8 @@ describe('watchBurn', () => {
|
|
|
1856
2082
|
|
|
1857
2083
|
// Transfer gas to account2
|
|
1858
2084
|
await writeContractSync(client, {
|
|
1859
|
-
abi:
|
|
1860
|
-
address:
|
|
2085
|
+
abi: Abis.tip20,
|
|
2086
|
+
address: Addresses.defaultFeeToken,
|
|
1861
2087
|
functionName: 'transfer',
|
|
1862
2088
|
args: [account2.address, parseEther('1')],
|
|
1863
2089
|
})
|
|
@@ -1950,8 +2176,8 @@ describe('watchBurn', () => {
|
|
|
1950
2176
|
|
|
1951
2177
|
// Transfer gas to account2
|
|
1952
2178
|
await writeContractSync(client, {
|
|
1953
|
-
abi:
|
|
1954
|
-
address:
|
|
2179
|
+
abi: Abis.tip20,
|
|
2180
|
+
address: Addresses.defaultFeeToken,
|
|
1955
2181
|
functionName: 'transfer',
|
|
1956
2182
|
args: [account2.address, parseEther('1')],
|
|
1957
2183
|
})
|
|
@@ -2360,3 +2586,116 @@ describe('watchTransfer', () => {
|
|
|
2360
2586
|
}
|
|
2361
2587
|
})
|
|
2362
2588
|
})
|
|
2589
|
+
|
|
2590
|
+
describe('watchUpdateQuoteToken', () => {
|
|
2591
|
+
test('default', async () => {
|
|
2592
|
+
// Create quote token
|
|
2593
|
+
const { token: quoteTokenAddress } = await actions.token.createSync(
|
|
2594
|
+
client,
|
|
2595
|
+
{
|
|
2596
|
+
currency: 'USD',
|
|
2597
|
+
name: 'Watch Quote Token',
|
|
2598
|
+
symbol: 'WLINK',
|
|
2599
|
+
},
|
|
2600
|
+
)
|
|
2601
|
+
|
|
2602
|
+
// Create main token
|
|
2603
|
+
const { token: address } = await actions.token.createSync(client, {
|
|
2604
|
+
currency: 'USD',
|
|
2605
|
+
name: 'Watch Main Token',
|
|
2606
|
+
symbol: 'WMAIN',
|
|
2607
|
+
})
|
|
2608
|
+
|
|
2609
|
+
const receivedUpdates: Array<{
|
|
2610
|
+
args: actions.token.watchUpdateQuoteToken.Args
|
|
2611
|
+
log: actions.token.watchUpdateQuoteToken.Log
|
|
2612
|
+
}> = []
|
|
2613
|
+
|
|
2614
|
+
// Start watching for quote token update events
|
|
2615
|
+
const unwatch = actions.token.watchUpdateQuoteToken(client, {
|
|
2616
|
+
token: address,
|
|
2617
|
+
onUpdateQuoteToken: (args, log) => {
|
|
2618
|
+
receivedUpdates.push({ args, log })
|
|
2619
|
+
},
|
|
2620
|
+
})
|
|
2621
|
+
|
|
2622
|
+
try {
|
|
2623
|
+
// Step 1: Update quote token (should emit UpdateQuoteToken)
|
|
2624
|
+
await actions.token.updateQuoteTokenSync(client, {
|
|
2625
|
+
token: address,
|
|
2626
|
+
quoteToken: quoteTokenAddress,
|
|
2627
|
+
})
|
|
2628
|
+
|
|
2629
|
+
// Step 2: Finalize the update (should emit QuoteTokenUpdateFinalized)
|
|
2630
|
+
await actions.token.finalizeUpdateQuoteTokenSync(client, {
|
|
2631
|
+
token: address,
|
|
2632
|
+
})
|
|
2633
|
+
|
|
2634
|
+
await setTimeout(100)
|
|
2635
|
+
|
|
2636
|
+
// Should receive 2 events: one for update, one for finalized
|
|
2637
|
+
expect(receivedUpdates).toHaveLength(2)
|
|
2638
|
+
|
|
2639
|
+
// First event: update proposed (not finalized)
|
|
2640
|
+
expect(receivedUpdates.at(0)!.args.finalized).toBe(false)
|
|
2641
|
+
expect(receivedUpdates.at(0)!.args.newQuoteToken).toBe(quoteTokenAddress)
|
|
2642
|
+
expect(receivedUpdates.at(0)!.args.updater).toBe(client.account.address)
|
|
2643
|
+
|
|
2644
|
+
// Second event: update finalized
|
|
2645
|
+
expect(receivedUpdates.at(1)!.args.finalized).toBe(true)
|
|
2646
|
+
expect(receivedUpdates.at(1)!.args.newQuoteToken).toBe(quoteTokenAddress)
|
|
2647
|
+
expect(receivedUpdates.at(1)!.args.updater).toBe(client.account.address)
|
|
2648
|
+
} finally {
|
|
2649
|
+
if (unwatch) unwatch()
|
|
2650
|
+
}
|
|
2651
|
+
})
|
|
2652
|
+
|
|
2653
|
+
test('behavior: only proposed updates', async () => {
|
|
2654
|
+
// Create quote token
|
|
2655
|
+
const { token: quoteTokenAddress } = await actions.token.createSync(
|
|
2656
|
+
client,
|
|
2657
|
+
{
|
|
2658
|
+
currency: 'USD',
|
|
2659
|
+
name: 'Proposed Quote Token',
|
|
2660
|
+
symbol: 'PLINK',
|
|
2661
|
+
},
|
|
2662
|
+
)
|
|
2663
|
+
|
|
2664
|
+
// Create main token
|
|
2665
|
+
const { token: address } = await actions.token.createSync(client, {
|
|
2666
|
+
currency: 'USD',
|
|
2667
|
+
name: 'Proposed Main Token',
|
|
2668
|
+
symbol: 'PMAIN',
|
|
2669
|
+
})
|
|
2670
|
+
|
|
2671
|
+
const receivedUpdates: Array<{
|
|
2672
|
+
args: actions.token.watchUpdateQuoteToken.Args
|
|
2673
|
+
log: actions.token.watchUpdateQuoteToken.Log
|
|
2674
|
+
}> = []
|
|
2675
|
+
|
|
2676
|
+
// Start watching
|
|
2677
|
+
const unwatch = actions.token.watchUpdateQuoteToken(client, {
|
|
2678
|
+
token: address,
|
|
2679
|
+
onUpdateQuoteToken: (args, log) => {
|
|
2680
|
+
receivedUpdates.push({ args, log })
|
|
2681
|
+
},
|
|
2682
|
+
})
|
|
2683
|
+
|
|
2684
|
+
try {
|
|
2685
|
+
// Only update (don't finalize)
|
|
2686
|
+
await actions.token.updateQuoteTokenSync(client, {
|
|
2687
|
+
token: address,
|
|
2688
|
+
quoteToken: quoteTokenAddress,
|
|
2689
|
+
})
|
|
2690
|
+
|
|
2691
|
+
await setTimeout(100)
|
|
2692
|
+
|
|
2693
|
+
// Should only receive 1 event (not finalized)
|
|
2694
|
+
expect(receivedUpdates).toHaveLength(1)
|
|
2695
|
+
expect(receivedUpdates.at(0)!.args.finalized).toBe(false)
|
|
2696
|
+
expect(receivedUpdates.at(0)!.args.newQuoteToken).toBe(quoteTokenAddress)
|
|
2697
|
+
} finally {
|
|
2698
|
+
if (unwatch) unwatch()
|
|
2699
|
+
}
|
|
2700
|
+
})
|
|
2701
|
+
})
|