@ledgerhq/coin-aptos 3.5.0-nightly.1 → 3.5.0-nightly.20251030160608

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 (39) hide show
  1. package/.turbo/turbo-build.log +1 -1
  2. package/CHANGELOG.md +14 -10
  3. package/lib/bridge/deviceTransactionConfig.d.ts +1 -1
  4. package/lib/bridge/deviceTransactionConfig.d.ts.map +1 -1
  5. package/lib/bridge/deviceTransactionConfig.js +1 -1
  6. package/lib/bridge/deviceTransactionConfig.js.map +1 -1
  7. package/lib/bridge/logic.d.ts +1 -1
  8. package/lib/bridge/logic.d.ts.map +1 -1
  9. package/lib/bridge/logic.js +14 -10
  10. package/lib/bridge/logic.js.map +1 -1
  11. package/lib/bridge/synchronisation.d.ts.map +1 -1
  12. package/lib/bridge/synchronisation.js +9 -9
  13. package/lib/bridge/synchronisation.js.map +1 -1
  14. package/lib/logic/craftTransaction.d.ts.map +1 -1
  15. package/lib/logic/craftTransaction.js +0 -8
  16. package/lib/logic/craftTransaction.js.map +1 -1
  17. package/lib-es/bridge/deviceTransactionConfig.d.ts +1 -1
  18. package/lib-es/bridge/deviceTransactionConfig.d.ts.map +1 -1
  19. package/lib-es/bridge/deviceTransactionConfig.js +1 -1
  20. package/lib-es/bridge/deviceTransactionConfig.js.map +1 -1
  21. package/lib-es/bridge/logic.d.ts +1 -1
  22. package/lib-es/bridge/logic.d.ts.map +1 -1
  23. package/lib-es/bridge/logic.js +15 -11
  24. package/lib-es/bridge/logic.js.map +1 -1
  25. package/lib-es/bridge/synchronisation.d.ts.map +1 -1
  26. package/lib-es/bridge/synchronisation.js +9 -9
  27. package/lib-es/bridge/synchronisation.js.map +1 -1
  28. package/lib-es/logic/craftTransaction.d.ts.map +1 -1
  29. package/lib-es/logic/craftTransaction.js +0 -8
  30. package/lib-es/logic/craftTransaction.js.map +1 -1
  31. package/package.json +12 -12
  32. package/src/__tests__/api/craftTransaction.unit.test.ts +0 -84
  33. package/src/__tests__/bridge/deviceTransactionConfig.test.ts +8 -8
  34. package/src/__tests__/bridge/logic.test.ts +90 -83
  35. package/src/__tests__/bridge/synchronisation.test.ts +8 -8
  36. package/src/bridge/deviceTransactionConfig.ts +2 -2
  37. package/src/bridge/logic.ts +19 -13
  38. package/src/bridge/synchronisation.ts +11 -13
  39. package/src/logic/craftTransaction.ts +0 -12
@@ -136,19 +136,17 @@ export const getSubAccounts = async (
136
136
  const { currency } = infos;
137
137
 
138
138
  // Creating a Map of Operations by TokenCurrencies in order to know which TokenAccounts should be synced as well
139
- const operationsByToken = lastTokenOperations.reduce<Map<TokenCurrency, Operation[]>>(
140
- (acc, operation) => {
141
- const { token } = decodeTokenAccountId(operation.accountId);
142
- if (!token) return acc; // TODO: do we need to check blacklistedTokenIds
139
+ const operationsByToken = new Map<TokenCurrency, Operation[]>();
143
140
 
144
- if (!acc.has(token)) {
145
- acc.set(token, []);
146
- }
147
- acc.get(token)?.push(operation);
148
- return acc;
149
- },
150
- new Map<TokenCurrency, Operation[]>(),
151
- );
141
+ for (const operation of lastTokenOperations) {
142
+ const { token } = await decodeTokenAccountId(operation.accountId);
143
+ if (!token) continue; // TODO: do we need to check blacklistedTokenIds
144
+
145
+ if (!operationsByToken.has(token)) {
146
+ operationsByToken.set(token, []);
147
+ }
148
+ operationsByToken.get(token)?.push(operation);
149
+ }
152
150
 
153
151
  // Fetching all TokenAccounts possible and providing already filtered operations
154
152
  const subAccountsPromises: Promise<TokenAccount>[] = [];
@@ -190,7 +188,7 @@ export const getAccountShape: GetAccountShape<AptosAccount> = async (
190
188
  Operation[],
191
189
  Operation[],
192
190
  Operation[],
193
- ] = txsToOps(info, accountId, transactions);
191
+ ] = await txsToOps(info, accountId, transactions);
194
192
  const operations = mergeOps(oldOperations, newOperations);
195
193
 
196
194
  const newSubAccounts = await getSubAccounts(info, address, accountId, tokenOperations);
@@ -15,7 +15,6 @@ export async function craftTransaction(
15
15
  newTx.amount = BigNumber(transactionIntent.amount.toString());
16
16
  newTx.recipient = transactionIntent.recipient;
17
17
  newTx.mode = transactionIntent.type;
18
- newTx.useAllAmount = transactionIntent.amount === BigInt(0);
19
18
 
20
19
  const account = {
21
20
  freshAddress: transactionIntent.sender,
@@ -27,17 +26,6 @@ export async function craftTransaction(
27
26
  const contractAddress = getContractAddress(transactionIntent);
28
27
  let balance: AptosBalance | undefined;
29
28
 
30
- if (newTx.useAllAmount === true) {
31
- const balances = await aptosClient.getBalances(transactionIntent.sender);
32
- balance = balances?.find(
33
- b => b.contractAddress.toLowerCase() === contractAddress?.toLowerCase(),
34
- );
35
-
36
- if (balance !== undefined) {
37
- newTx.amount = BigNumber(balance.amount.toString());
38
- }
39
- }
40
-
41
29
  if (transactionIntent.asset.type !== "native") {
42
30
  tokenType = transactionIntent.asset.type as TOKEN_TYPE;
43
31
  }