@ledgerhq/live-common 21.21.0 → 21.21.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/apps/support.js +1 -1
- package/lib/bot/engine.d.ts.map +1 -1
- package/lib/bot/engine.js +2 -1
- package/lib/bot/engine.js.map +1 -1
- package/lib/bot/formatters.d.ts +1 -0
- package/lib/bot/formatters.d.ts.map +1 -1
- package/lib/bot/formatters.js +13 -2
- package/lib/bot/formatters.js.map +1 -1
- package/lib/bot/index.js +4 -4
- package/lib/bot/index.js.map +1 -1
- package/lib/families/solana/errors.d.ts +0 -3
- package/lib/families/solana/errors.d.ts.map +1 -1
- package/lib/families/solana/errors.js +1 -2
- package/lib/families/solana/errors.js.map +1 -1
- package/lib/families/solana/js-getTransactionStatus.d.ts +1 -1
- package/lib/families/solana/js-getTransactionStatus.d.ts.map +1 -1
- package/lib/families/solana/js-getTransactionStatus.js +51 -12
- package/lib/families/solana/js-getTransactionStatus.js.map +1 -1
- package/lib/families/solana/js-prepareTransaction.d.ts.map +1 -1
- package/lib/families/solana/js-prepareTransaction.js +8 -4
- package/lib/families/solana/js-prepareTransaction.js.map +1 -1
- package/lib/families/solana/js-signOperation.d.ts.map +1 -1
- package/lib/families/solana/js-signOperation.js +19 -9
- package/lib/families/solana/js-signOperation.js.map +1 -1
- package/lib/families/solana/js-synchronization.js +9 -6
- package/lib/families/solana/js-synchronization.js.map +1 -1
- package/lib/families/solana/test-dataset.js +6 -6
- package/lib/families/solana/test-dataset.js.map +1 -1
- package/package.json +16 -16
- package/src/__tests__/__snapshots__/all.libcore.ts.snap +9 -13
- package/src/apps/support.ts +1 -1
- package/src/bot/engine.ts +3 -1
- package/src/bot/formatters.ts +11 -1
- package/src/bot/index.ts +5 -5
- package/src/families/solana/errors.ts +0 -4
- package/src/families/solana/js-getTransactionStatus.ts +65 -12
- package/src/families/solana/js-prepareTransaction.ts +7 -4
- package/src/families/solana/js-signOperation.ts +21 -9
- package/src/families/solana/js-synchronization.ts +11 -6
- package/src/families/solana/test-dataset.ts +6 -6
|
@@ -7,6 +7,7 @@ import type {
|
|
|
7
7
|
} from "../../types";
|
|
8
8
|
import { open, close } from "../../hw";
|
|
9
9
|
import type {
|
|
10
|
+
Command,
|
|
10
11
|
TokenCreateATACommand,
|
|
11
12
|
TokenTransferCommand,
|
|
12
13
|
Transaction,
|
|
@@ -147,9 +148,7 @@ function optimisticOpForTransfer(
|
|
|
147
148
|
senders: [account.freshAddress],
|
|
148
149
|
recipients: [transaction.recipient],
|
|
149
150
|
value: new BigNumber(command.amount).plus(commons.fee),
|
|
150
|
-
extra:
|
|
151
|
-
memo: command.memo,
|
|
152
|
-
},
|
|
151
|
+
extra: getOpExtras(command),
|
|
153
152
|
};
|
|
154
153
|
}
|
|
155
154
|
|
|
@@ -170,9 +169,7 @@ function optimisticOpForTokenTransfer(
|
|
|
170
169
|
senders: [account.freshAddress],
|
|
171
170
|
recipients: [transaction.recipient],
|
|
172
171
|
value: new BigNumber(command.amount),
|
|
173
|
-
extra:
|
|
174
|
-
memo: command.memo,
|
|
175
|
-
},
|
|
172
|
+
extra: getOpExtras(command),
|
|
176
173
|
subOperations: [
|
|
177
174
|
{
|
|
178
175
|
...optimisticOpcommons(transaction, commandDescriptor),
|
|
@@ -182,9 +179,7 @@ function optimisticOpForTokenTransfer(
|
|
|
182
179
|
senders: [account.freshAddress],
|
|
183
180
|
recipients: [transaction.recipient],
|
|
184
181
|
value: new BigNumber(command.amount),
|
|
185
|
-
extra:
|
|
186
|
-
memo: command.memo,
|
|
187
|
-
},
|
|
182
|
+
extra: getOpExtras(command),
|
|
188
183
|
},
|
|
189
184
|
],
|
|
190
185
|
};
|
|
@@ -228,3 +223,20 @@ function optimisticOpcommons(
|
|
|
228
223
|
extra: {},
|
|
229
224
|
};
|
|
230
225
|
}
|
|
226
|
+
|
|
227
|
+
function getOpExtras(command: Command): Record<string, any> {
|
|
228
|
+
const extra: Record<string, any> = {};
|
|
229
|
+
switch (command.kind) {
|
|
230
|
+
case "transfer":
|
|
231
|
+
case "token.transfer":
|
|
232
|
+
if (command.memo !== undefined) {
|
|
233
|
+
extra.memo = command.memo;
|
|
234
|
+
}
|
|
235
|
+
break;
|
|
236
|
+
case "token.createATA":
|
|
237
|
+
break;
|
|
238
|
+
default:
|
|
239
|
+
return assertUnreachable(command);
|
|
240
|
+
}
|
|
241
|
+
return extra;
|
|
242
|
+
}
|
|
@@ -299,9 +299,7 @@ function txToMainAccOperation(
|
|
|
299
299
|
hasFailed: !!tx.info.err,
|
|
300
300
|
blockHeight: tx.info.slot,
|
|
301
301
|
blockHash: message.recentBlockhash,
|
|
302
|
-
extra:
|
|
303
|
-
memo: tx.info.memo ? dropMemoLengthPrefixIfAny(tx.info.memo) : undefined,
|
|
304
|
-
},
|
|
302
|
+
extra: getOpExtra(tx),
|
|
305
303
|
type: opType,
|
|
306
304
|
senders,
|
|
307
305
|
recipients,
|
|
@@ -311,6 +309,15 @@ function txToMainAccOperation(
|
|
|
311
309
|
};
|
|
312
310
|
}
|
|
313
311
|
|
|
312
|
+
function getOpExtra(tx: TransactionDescriptor): Record<string, any> {
|
|
313
|
+
const extra: Record<string, any> = {};
|
|
314
|
+
if (tx.info.memo !== null) {
|
|
315
|
+
extra.memo = dropMemoLengthPrefixIfAny(tx.info.memo);
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
return extra;
|
|
319
|
+
}
|
|
320
|
+
|
|
314
321
|
function txToTokenAccOperation(
|
|
315
322
|
tx: TransactionDescriptor,
|
|
316
323
|
assocTokenAcc: OnChainTokenAccount,
|
|
@@ -364,9 +371,7 @@ function txToTokenAccOperation(
|
|
|
364
371
|
senders,
|
|
365
372
|
value: delta.abs(),
|
|
366
373
|
hasFailed: !!tx.info.err,
|
|
367
|
-
extra:
|
|
368
|
-
memo: tx.info.memo ? dropMemoLengthPrefixIfAny(tx.info.memo) : undefined,
|
|
369
|
-
},
|
|
374
|
+
extra: getOpExtra(tx),
|
|
370
375
|
blockHash: tx.parsed.transaction.message.recentBlockhash,
|
|
371
376
|
};
|
|
372
377
|
}
|
|
@@ -110,7 +110,7 @@ const dataset: DatasetTest<Transaction> = {
|
|
|
110
110
|
warnings: {},
|
|
111
111
|
estimatedFees: fees(1),
|
|
112
112
|
amount: zero,
|
|
113
|
-
totalSpent:
|
|
113
|
+
totalSpent: fees(1),
|
|
114
114
|
},
|
|
115
115
|
},
|
|
116
116
|
{
|
|
@@ -175,7 +175,7 @@ const dataset: DatasetTest<Transaction> = {
|
|
|
175
175
|
warnings: {},
|
|
176
176
|
estimatedFees: fees(1),
|
|
177
177
|
amount: testOnChainData.fundedSenderBalance,
|
|
178
|
-
totalSpent:
|
|
178
|
+
totalSpent: testOnChainData.fundedSenderBalance.plus(fees(1)),
|
|
179
179
|
},
|
|
180
180
|
},
|
|
181
181
|
{
|
|
@@ -204,7 +204,7 @@ const dataset: DatasetTest<Transaction> = {
|
|
|
204
204
|
warnings: {},
|
|
205
205
|
estimatedFees: testOnChainData.fundedSenderBalance.plus(1),
|
|
206
206
|
amount: zero,
|
|
207
|
-
totalSpent:
|
|
207
|
+
totalSpent: testOnChainData.fundedSenderBalance.plus(1),
|
|
208
208
|
},
|
|
209
209
|
},
|
|
210
210
|
{
|
|
@@ -226,7 +226,7 @@ const dataset: DatasetTest<Transaction> = {
|
|
|
226
226
|
warnings: {},
|
|
227
227
|
estimatedFees: fees(1),
|
|
228
228
|
amount: zero,
|
|
229
|
-
totalSpent:
|
|
229
|
+
totalSpent: fees(1),
|
|
230
230
|
},
|
|
231
231
|
},
|
|
232
232
|
{
|
|
@@ -248,7 +248,7 @@ const dataset: DatasetTest<Transaction> = {
|
|
|
248
248
|
warnings: {},
|
|
249
249
|
estimatedFees: fees(1),
|
|
250
250
|
amount: new BigNumber(-1),
|
|
251
|
-
totalSpent:
|
|
251
|
+
totalSpent: new BigNumber(-1).plus(fees(1)),
|
|
252
252
|
},
|
|
253
253
|
},
|
|
254
254
|
{
|
|
@@ -497,7 +497,7 @@ function recipientRequired(): TransactionTestSpec[] {
|
|
|
497
497
|
warnings: {},
|
|
498
498
|
estimatedFees: fees(1),
|
|
499
499
|
amount: zero,
|
|
500
|
-
totalSpent: zero,
|
|
500
|
+
totalSpent: model.kind === "transfer" ? fees(1) : zero,
|
|
501
501
|
},
|
|
502
502
|
};
|
|
503
503
|
});
|