@ledgerhq/live-common 21.30.0 → 21.30.1
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/lib/families/solana/test-dataset.d.ts.map +1 -1
- package/lib/families/solana/test-dataset.js +211 -209
- package/lib/families/solana/test-dataset.js.map +1 -1
- package/package.json +1 -1
- package/src/__tests__/__snapshots__/all.libcore.ts.snap +3 -200
- package/src/families/solana/test-dataset.ts +340 -337
|
@@ -75,367 +75,370 @@ const fees = (signatureCount: number) =>
|
|
|
75
75
|
|
|
76
76
|
const zero = new BigNumber(0);
|
|
77
77
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
78
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
79
|
+
const solana = {
|
|
80
|
+
scanAccounts: [scanAccounts1],
|
|
81
|
+
accounts: [
|
|
82
|
+
{
|
|
83
|
+
raw: makeAccount(testOnChainData.fundedSenderAddress),
|
|
84
|
+
/*
|
|
85
|
+
Solana integration is written in such a way that requires
|
|
86
|
+
prepareTransaction to be called before any meaningfull status
|
|
87
|
+
can be calculated. The general bridge tests do not run prepareTransaction
|
|
88
|
+
on all tests, so skip them in the general runner, but make alternatives for them.
|
|
89
|
+
*/
|
|
90
|
+
FIXME_tests: [
|
|
91
|
+
"balance is sum of ops",
|
|
92
|
+
"Default empty recipient have a recipientError",
|
|
93
|
+
"invalid recipient have a recipientError",
|
|
94
|
+
"can be called on an empty transaction",
|
|
95
|
+
],
|
|
96
|
+
transactions: [
|
|
97
|
+
...recipientRequired(),
|
|
98
|
+
...recipientNotValid(),
|
|
99
|
+
...recipientIsSameAsSender(),
|
|
100
|
+
...memoIsTooLong(),
|
|
84
101
|
{
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
on all tests, so skip them in the general runner, but make alternatives for them.
|
|
91
|
-
*/
|
|
92
|
-
FIXME_tests: [
|
|
93
|
-
"balance is sum of ops",
|
|
94
|
-
"Default empty recipient have a recipientError",
|
|
95
|
-
"invalid recipient have a recipientError",
|
|
96
|
-
"can be called on an empty transaction",
|
|
97
|
-
],
|
|
98
|
-
transactions: [
|
|
99
|
-
...recipientRequired(),
|
|
100
|
-
...recipientNotValid(),
|
|
101
|
-
...recipientIsSameAsSender(),
|
|
102
|
-
...memoIsTooLong(),
|
|
103
|
-
{
|
|
104
|
-
name: "status is error: called on an empty transaction",
|
|
105
|
-
transaction: createTransaction({} as any),
|
|
106
|
-
expectedStatus: {
|
|
107
|
-
errors: {
|
|
108
|
-
recipient: new RecipientRequired(),
|
|
109
|
-
},
|
|
110
|
-
warnings: {},
|
|
111
|
-
estimatedFees: fees(1),
|
|
112
|
-
amount: zero,
|
|
113
|
-
totalSpent: fees(1),
|
|
114
|
-
},
|
|
102
|
+
name: "status is error: called on an empty transaction",
|
|
103
|
+
transaction: createTransaction({} as any),
|
|
104
|
+
expectedStatus: {
|
|
105
|
+
errors: {
|
|
106
|
+
recipient: new RecipientRequired(),
|
|
115
107
|
},
|
|
116
|
-
{
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
},
|
|
128
|
-
expectedStatus: {
|
|
129
|
-
errors: {},
|
|
130
|
-
warnings: {},
|
|
131
|
-
estimatedFees: fees(1),
|
|
132
|
-
amount: testOnChainData.fundedSenderBalance.dividedBy(2),
|
|
133
|
-
totalSpent: testOnChainData.fundedSenderBalance
|
|
134
|
-
.dividedBy(2)
|
|
135
|
-
.plus(fees(1)),
|
|
136
|
-
},
|
|
108
|
+
warnings: {},
|
|
109
|
+
estimatedFees: fees(1),
|
|
110
|
+
amount: zero,
|
|
111
|
+
totalSpent: fees(1),
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
name: "transfer :: status is success: not all amount",
|
|
116
|
+
transaction: {
|
|
117
|
+
model: {
|
|
118
|
+
kind: "transfer",
|
|
119
|
+
uiState: {},
|
|
137
120
|
},
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
121
|
+
amount: testOnChainData.fundedSenderBalance.dividedBy(2),
|
|
122
|
+
recipient: testOnChainData.fundedAddress,
|
|
123
|
+
feeCalculator: testOnChainData.feeCalculator,
|
|
124
|
+
family: "solana",
|
|
125
|
+
},
|
|
126
|
+
expectedStatus: {
|
|
127
|
+
errors: {},
|
|
128
|
+
warnings: {},
|
|
129
|
+
estimatedFees: fees(1),
|
|
130
|
+
amount: testOnChainData.fundedSenderBalance.dividedBy(2),
|
|
131
|
+
totalSpent: testOnChainData.fundedSenderBalance
|
|
132
|
+
.dividedBy(2)
|
|
133
|
+
.plus(fees(1)),
|
|
134
|
+
},
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
name: "transfer :: status is success: all amount",
|
|
138
|
+
transaction: {
|
|
139
|
+
model: {
|
|
140
|
+
kind: "transfer",
|
|
141
|
+
uiState: {},
|
|
158
142
|
},
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
},
|
|
143
|
+
useAllAmount: true,
|
|
144
|
+
amount: zero,
|
|
145
|
+
recipient: testOnChainData.fundedAddress,
|
|
146
|
+
feeCalculator: testOnChainData.feeCalculator,
|
|
147
|
+
family: "solana",
|
|
148
|
+
},
|
|
149
|
+
expectedStatus: {
|
|
150
|
+
errors: {},
|
|
151
|
+
warnings: {},
|
|
152
|
+
estimatedFees: fees(1),
|
|
153
|
+
amount: testOnChainData.fundedSenderBalance.minus(fees(1)),
|
|
154
|
+
totalSpent: testOnChainData.fundedSenderBalance,
|
|
155
|
+
},
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
name: "transfer :: status is error: not enough balance, not all amount",
|
|
159
|
+
transaction: {
|
|
160
|
+
model: {
|
|
161
|
+
kind: "transfer",
|
|
162
|
+
uiState: {},
|
|
180
163
|
},
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
},
|
|
190
|
-
useAllAmount: true,
|
|
191
|
-
amount: zero,
|
|
192
|
-
recipient: testOnChainData.fundedAddress,
|
|
193
|
-
feeCalculator: {
|
|
194
|
-
lamportsPerSignature: testOnChainData.fundedSenderBalance
|
|
195
|
-
.plus(1)
|
|
196
|
-
.toNumber(),
|
|
197
|
-
},
|
|
198
|
-
family: "solana",
|
|
199
|
-
},
|
|
200
|
-
expectedStatus: {
|
|
201
|
-
errors: {
|
|
202
|
-
amount: new NotEnoughBalance(),
|
|
203
|
-
},
|
|
204
|
-
warnings: {},
|
|
205
|
-
estimatedFees: testOnChainData.fundedSenderBalance.plus(1),
|
|
206
|
-
amount: zero,
|
|
207
|
-
totalSpent: testOnChainData.fundedSenderBalance.plus(1),
|
|
208
|
-
},
|
|
164
|
+
amount: testOnChainData.fundedSenderBalance,
|
|
165
|
+
recipient: testOnChainData.fundedAddress,
|
|
166
|
+
feeCalculator: testOnChainData.feeCalculator,
|
|
167
|
+
family: "solana",
|
|
168
|
+
},
|
|
169
|
+
expectedStatus: {
|
|
170
|
+
errors: {
|
|
171
|
+
amount: new NotEnoughBalance(),
|
|
209
172
|
},
|
|
210
|
-
{
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
errors: {
|
|
224
|
-
amount: new AmountRequired(),
|
|
225
|
-
},
|
|
226
|
-
warnings: {},
|
|
227
|
-
estimatedFees: fees(1),
|
|
228
|
-
amount: zero,
|
|
229
|
-
totalSpent: fees(1),
|
|
173
|
+
warnings: {},
|
|
174
|
+
estimatedFees: fees(1),
|
|
175
|
+
amount: testOnChainData.fundedSenderBalance,
|
|
176
|
+
totalSpent: testOnChainData.fundedSenderBalance.plus(fees(1)),
|
|
177
|
+
},
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
name: "transfer :: status is error: not enough balance, all amount",
|
|
181
|
+
transaction: {
|
|
182
|
+
model: {
|
|
183
|
+
kind: "transfer",
|
|
184
|
+
uiState: {
|
|
185
|
+
memo: "a memo",
|
|
230
186
|
},
|
|
231
187
|
},
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
amount: new BigNumber(-1),
|
|
240
|
-
recipient: testOnChainData.fundedAddress,
|
|
241
|
-
feeCalculator: testOnChainData.feeCalculator,
|
|
242
|
-
family: "solana",
|
|
243
|
-
},
|
|
244
|
-
expectedStatus: {
|
|
245
|
-
errors: {
|
|
246
|
-
amount: new AmountRequired(),
|
|
247
|
-
},
|
|
248
|
-
warnings: {},
|
|
249
|
-
estimatedFees: fees(1),
|
|
250
|
-
amount: new BigNumber(-1),
|
|
251
|
-
totalSpent: new BigNumber(-1).plus(fees(1)),
|
|
252
|
-
},
|
|
188
|
+
useAllAmount: true,
|
|
189
|
+
amount: zero,
|
|
190
|
+
recipient: testOnChainData.fundedAddress,
|
|
191
|
+
feeCalculator: {
|
|
192
|
+
lamportsPerSignature: testOnChainData.fundedSenderBalance
|
|
193
|
+
.plus(1)
|
|
194
|
+
.toNumber(),
|
|
253
195
|
},
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
uiState: {},
|
|
260
|
-
},
|
|
261
|
-
amount: new BigNumber(1),
|
|
262
|
-
recipient: testOnChainData.unfundedAddress,
|
|
263
|
-
feeCalculator: testOnChainData.feeCalculator,
|
|
264
|
-
family: "solana",
|
|
265
|
-
},
|
|
266
|
-
expectedStatus: {
|
|
267
|
-
errors: {},
|
|
268
|
-
warnings: {
|
|
269
|
-
recipient: new SolanaAccountNotFunded(),
|
|
270
|
-
},
|
|
271
|
-
estimatedFees: fees(1),
|
|
272
|
-
amount: new BigNumber(1),
|
|
273
|
-
totalSpent: fees(1).plus(1),
|
|
274
|
-
},
|
|
196
|
+
family: "solana",
|
|
197
|
+
},
|
|
198
|
+
expectedStatus: {
|
|
199
|
+
errors: {
|
|
200
|
+
amount: new NotEnoughBalance(),
|
|
275
201
|
},
|
|
276
|
-
{
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
},
|
|
288
|
-
expectedStatus: {
|
|
289
|
-
errors: {},
|
|
290
|
-
warnings: {
|
|
291
|
-
recipient: new SolanaAccountNotFunded(),
|
|
292
|
-
recipientOffCurve: new SolanaAddressOffEd25519(),
|
|
293
|
-
},
|
|
294
|
-
estimatedFees: fees(1),
|
|
295
|
-
amount: new BigNumber(1),
|
|
296
|
-
totalSpent: fees(1).plus(1),
|
|
297
|
-
},
|
|
202
|
+
warnings: {},
|
|
203
|
+
estimatedFees: testOnChainData.fundedSenderBalance.plus(1),
|
|
204
|
+
amount: zero,
|
|
205
|
+
totalSpent: testOnChainData.fundedSenderBalance.plus(1),
|
|
206
|
+
},
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
name: "transfer :: status is error: amount is 0",
|
|
210
|
+
transaction: {
|
|
211
|
+
model: {
|
|
212
|
+
kind: "transfer",
|
|
213
|
+
uiState: {},
|
|
298
214
|
},
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
subAccountId: wSolSubAccId,
|
|
308
|
-
},
|
|
309
|
-
},
|
|
310
|
-
amount:
|
|
311
|
-
testOnChainData.wSolSenderAssocTokenAccBalance.dividedBy(2),
|
|
312
|
-
recipient: testOnChainData.fundedAddress,
|
|
313
|
-
feeCalculator: testOnChainData.feeCalculator,
|
|
314
|
-
family: "solana",
|
|
315
|
-
},
|
|
316
|
-
expectedStatus: {
|
|
317
|
-
errors: {},
|
|
318
|
-
warnings: {},
|
|
319
|
-
estimatedFees: fees(1),
|
|
320
|
-
amount:
|
|
321
|
-
testOnChainData.wSolSenderAssocTokenAccBalance.dividedBy(2),
|
|
322
|
-
totalSpent:
|
|
323
|
-
testOnChainData.wSolSenderAssocTokenAccBalance.dividedBy(2),
|
|
324
|
-
},
|
|
215
|
+
amount: zero,
|
|
216
|
+
recipient: testOnChainData.fundedAddress,
|
|
217
|
+
feeCalculator: testOnChainData.feeCalculator,
|
|
218
|
+
family: "solana",
|
|
219
|
+
},
|
|
220
|
+
expectedStatus: {
|
|
221
|
+
errors: {
|
|
222
|
+
amount: new AmountRequired(),
|
|
325
223
|
},
|
|
326
|
-
{
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
testOnChainData.wSolFundedAccountAssocTokenAccAddress,
|
|
339
|
-
feeCalculator: testOnChainData.feeCalculator,
|
|
340
|
-
family: "solana",
|
|
341
|
-
},
|
|
342
|
-
expectedStatus: {
|
|
343
|
-
errors: {},
|
|
344
|
-
warnings: {},
|
|
345
|
-
estimatedFees: fees(1),
|
|
346
|
-
amount:
|
|
347
|
-
testOnChainData.wSolSenderAssocTokenAccBalance.dividedBy(2),
|
|
348
|
-
totalSpent:
|
|
349
|
-
testOnChainData.wSolSenderAssocTokenAccBalance.dividedBy(2),
|
|
350
|
-
},
|
|
224
|
+
warnings: {},
|
|
225
|
+
estimatedFees: fees(1),
|
|
226
|
+
amount: zero,
|
|
227
|
+
totalSpent: fees(1),
|
|
228
|
+
},
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
name: "transfer :: status is error: amount is negative",
|
|
232
|
+
transaction: {
|
|
233
|
+
model: {
|
|
234
|
+
kind: "transfer",
|
|
235
|
+
uiState: {},
|
|
351
236
|
},
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
237
|
+
amount: new BigNumber(-1),
|
|
238
|
+
recipient: testOnChainData.fundedAddress,
|
|
239
|
+
feeCalculator: testOnChainData.feeCalculator,
|
|
240
|
+
family: "solana",
|
|
241
|
+
},
|
|
242
|
+
expectedStatus: {
|
|
243
|
+
errors: {
|
|
244
|
+
amount: new AmountRequired(),
|
|
245
|
+
},
|
|
246
|
+
warnings: {},
|
|
247
|
+
estimatedFees: fees(1),
|
|
248
|
+
amount: new BigNumber(-1),
|
|
249
|
+
totalSpent: new BigNumber(-1).plus(fees(1)),
|
|
250
|
+
},
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
name: "transfer :: status is warning: recipient wallet not funded",
|
|
254
|
+
transaction: {
|
|
255
|
+
model: {
|
|
256
|
+
kind: "transfer",
|
|
257
|
+
uiState: {},
|
|
258
|
+
},
|
|
259
|
+
amount: new BigNumber(1),
|
|
260
|
+
recipient: testOnChainData.unfundedAddress,
|
|
261
|
+
feeCalculator: testOnChainData.feeCalculator,
|
|
262
|
+
family: "solana",
|
|
263
|
+
},
|
|
264
|
+
expectedStatus: {
|
|
265
|
+
errors: {},
|
|
266
|
+
warnings: {
|
|
267
|
+
recipient: new SolanaAccountNotFunded(),
|
|
268
|
+
},
|
|
269
|
+
estimatedFees: fees(1),
|
|
270
|
+
amount: new BigNumber(1),
|
|
271
|
+
totalSpent: fees(1).plus(1),
|
|
272
|
+
},
|
|
273
|
+
},
|
|
274
|
+
{
|
|
275
|
+
name: "transfer :: status is warning: recipient address is off ed25519",
|
|
276
|
+
transaction: {
|
|
277
|
+
model: {
|
|
278
|
+
kind: "transfer",
|
|
279
|
+
uiState: {},
|
|
280
|
+
},
|
|
281
|
+
amount: new BigNumber(1),
|
|
282
|
+
recipient: testOnChainData.offEd25519Address,
|
|
283
|
+
feeCalculator: testOnChainData.feeCalculator,
|
|
284
|
+
family: "solana",
|
|
285
|
+
},
|
|
286
|
+
expectedStatus: {
|
|
287
|
+
errors: {},
|
|
288
|
+
warnings: {
|
|
289
|
+
recipient: new SolanaAccountNotFunded(),
|
|
290
|
+
recipientOffCurve: new SolanaAddressOffEd25519(),
|
|
291
|
+
},
|
|
292
|
+
estimatedFees: fees(1),
|
|
293
|
+
amount: new BigNumber(1),
|
|
294
|
+
totalSpent: fees(1).plus(1),
|
|
295
|
+
},
|
|
296
|
+
},
|
|
297
|
+
// no tokens for first release
|
|
298
|
+
/*
|
|
299
|
+
{
|
|
300
|
+
name: "token.transfer :: status is success: recipient is funded wallet, assoc token acc exists",
|
|
301
|
+
transaction: {
|
|
302
|
+
model: {
|
|
303
|
+
kind: "token.transfer",
|
|
304
|
+
uiState: {
|
|
305
|
+
subAccountId: wSolSubAccId,
|
|
376
306
|
},
|
|
377
307
|
},
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
308
|
+
amount:
|
|
309
|
+
testOnChainData.wSolSenderAssocTokenAccBalance.dividedBy(2),
|
|
310
|
+
recipient: testOnChainData.fundedAddress,
|
|
311
|
+
feeCalculator: testOnChainData.feeCalculator,
|
|
312
|
+
family: "solana",
|
|
313
|
+
},
|
|
314
|
+
expectedStatus: {
|
|
315
|
+
errors: {},
|
|
316
|
+
warnings: {},
|
|
317
|
+
estimatedFees: fees(1),
|
|
318
|
+
amount:
|
|
319
|
+
testOnChainData.wSolSenderAssocTokenAccBalance.dividedBy(2),
|
|
320
|
+
totalSpent:
|
|
321
|
+
testOnChainData.wSolSenderAssocTokenAccBalance.dividedBy(2),
|
|
322
|
+
},
|
|
323
|
+
},
|
|
324
|
+
{
|
|
325
|
+
name: "token.transfer :: status is success: recipient is correct mint token acc",
|
|
326
|
+
transaction: {
|
|
327
|
+
model: {
|
|
328
|
+
kind: "token.transfer",
|
|
329
|
+
uiState: {
|
|
330
|
+
subAccountId: wSolSubAccId,
|
|
392
331
|
},
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
332
|
+
},
|
|
333
|
+
amount:
|
|
334
|
+
testOnChainData.wSolSenderAssocTokenAccBalance.dividedBy(2),
|
|
335
|
+
recipient:
|
|
336
|
+
testOnChainData.wSolFundedAccountAssocTokenAccAddress,
|
|
337
|
+
feeCalculator: testOnChainData.feeCalculator,
|
|
338
|
+
family: "solana",
|
|
339
|
+
},
|
|
340
|
+
expectedStatus: {
|
|
341
|
+
errors: {},
|
|
342
|
+
warnings: {},
|
|
343
|
+
estimatedFees: fees(1),
|
|
344
|
+
amount:
|
|
345
|
+
testOnChainData.wSolSenderAssocTokenAccBalance.dividedBy(2),
|
|
346
|
+
totalSpent:
|
|
347
|
+
testOnChainData.wSolSenderAssocTokenAccBalance.dividedBy(2),
|
|
348
|
+
},
|
|
349
|
+
},
|
|
350
|
+
{
|
|
351
|
+
name: "token.transfer :: status is error: recipient is another mint token acc",
|
|
352
|
+
transaction: {
|
|
353
|
+
model: {
|
|
354
|
+
kind: "token.transfer",
|
|
355
|
+
uiState: {
|
|
356
|
+
subAccountId: wSolSubAccId,
|
|
402
357
|
},
|
|
403
358
|
},
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
359
|
+
amount:
|
|
360
|
+
testOnChainData.wSolSenderAssocTokenAccBalance.dividedBy(2),
|
|
361
|
+
recipient: testOnChainData.notWSolTokenAccAddress,
|
|
362
|
+
feeCalculator: testOnChainData.feeCalculator,
|
|
363
|
+
family: "solana",
|
|
364
|
+
},
|
|
365
|
+
expectedStatus: {
|
|
366
|
+
errors: {
|
|
367
|
+
recipient: new SolanaTokenAccountHoldsAnotherToken(),
|
|
368
|
+
},
|
|
369
|
+
warnings: {},
|
|
370
|
+
estimatedFees: fees(1),
|
|
371
|
+
amount:
|
|
372
|
+
testOnChainData.wSolSenderAssocTokenAccBalance.dividedBy(2),
|
|
373
|
+
totalSpent: zero,
|
|
374
|
+
},
|
|
375
|
+
},
|
|
376
|
+
{
|
|
377
|
+
name: "token.transfer :: status is warning: recipient is off curve",
|
|
378
|
+
transaction: {
|
|
379
|
+
model: {
|
|
380
|
+
kind: "token.transfer",
|
|
381
|
+
uiState: {
|
|
382
|
+
subAccountId: wSolSubAccId,
|
|
418
383
|
},
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
384
|
+
},
|
|
385
|
+
amount:
|
|
386
|
+
testOnChainData.wSolSenderAssocTokenAccBalance.dividedBy(2),
|
|
387
|
+
recipient: testOnChainData.offEd25519Address,
|
|
388
|
+
feeCalculator: testOnChainData.feeCalculator,
|
|
389
|
+
family: "solana",
|
|
390
|
+
},
|
|
391
|
+
expectedStatus: {
|
|
392
|
+
errors: {
|
|
393
|
+
recipient: new SolanaAddressOffEd25519(),
|
|
394
|
+
},
|
|
395
|
+
warnings: {},
|
|
396
|
+
estimatedFees: fees(1),
|
|
397
|
+
amount:
|
|
398
|
+
testOnChainData.wSolSenderAssocTokenAccBalance.dividedBy(2),
|
|
399
|
+
totalSpent: zero,
|
|
400
|
+
},
|
|
401
|
+
},
|
|
402
|
+
{
|
|
403
|
+
name: "token.transfer :: status is success: recipient is wallet and no assoc token acc exists (will be created)",
|
|
404
|
+
transaction: {
|
|
405
|
+
model: {
|
|
406
|
+
kind: "token.transfer",
|
|
407
|
+
uiState: {
|
|
408
|
+
subAccountId: wSolSubAccId,
|
|
432
409
|
},
|
|
433
410
|
},
|
|
434
|
-
|
|
435
|
-
|
|
411
|
+
amount:
|
|
412
|
+
testOnChainData.wSolSenderAssocTokenAccBalance.dividedBy(2),
|
|
413
|
+
recipient: testOnChainData.unfundedAddress,
|
|
414
|
+
feeCalculator: testOnChainData.feeCalculator,
|
|
415
|
+
family: "solana",
|
|
416
|
+
},
|
|
417
|
+
expectedStatus: {
|
|
418
|
+
errors: {},
|
|
419
|
+
warnings: {
|
|
420
|
+
recipient: new SolanaAccountNotFunded(),
|
|
421
|
+
recipientAssociatedTokenAccount:
|
|
422
|
+
new SolanaRecipientAssociatedTokenAccountWillBeFunded(),
|
|
423
|
+
},
|
|
424
|
+
// this fee is dynamic, skip
|
|
425
|
+
//estimatedFees: new BigNumber(2044280),
|
|
426
|
+
amount:
|
|
427
|
+
testOnChainData.wSolSenderAssocTokenAccBalance.dividedBy(2),
|
|
428
|
+
totalSpent:
|
|
429
|
+
testOnChainData.wSolSenderAssocTokenAccBalance.dividedBy(2),
|
|
430
|
+
},
|
|
436
431
|
},
|
|
432
|
+
*/
|
|
437
433
|
],
|
|
438
434
|
},
|
|
435
|
+
],
|
|
436
|
+
};
|
|
437
|
+
|
|
438
|
+
const dataset: DatasetTest<Transaction> = {
|
|
439
|
+
implementations: [getEnv("MOCK") ? "mock" : "js"], // FIXME we should actually put both mock and js like other dataset do
|
|
440
|
+
currencies: {
|
|
441
|
+
// solana, // TODO re enable when it's ready
|
|
439
442
|
},
|
|
440
443
|
};
|
|
441
444
|
|