@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.
- package/.turbo/turbo-build.log +1 -1
- package/CHANGELOG.md +14 -10
- package/lib/bridge/deviceTransactionConfig.d.ts +1 -1
- package/lib/bridge/deviceTransactionConfig.d.ts.map +1 -1
- package/lib/bridge/deviceTransactionConfig.js +1 -1
- package/lib/bridge/deviceTransactionConfig.js.map +1 -1
- package/lib/bridge/logic.d.ts +1 -1
- package/lib/bridge/logic.d.ts.map +1 -1
- package/lib/bridge/logic.js +14 -10
- package/lib/bridge/logic.js.map +1 -1
- package/lib/bridge/synchronisation.d.ts.map +1 -1
- package/lib/bridge/synchronisation.js +9 -9
- package/lib/bridge/synchronisation.js.map +1 -1
- package/lib/logic/craftTransaction.d.ts.map +1 -1
- package/lib/logic/craftTransaction.js +0 -8
- package/lib/logic/craftTransaction.js.map +1 -1
- package/lib-es/bridge/deviceTransactionConfig.d.ts +1 -1
- package/lib-es/bridge/deviceTransactionConfig.d.ts.map +1 -1
- package/lib-es/bridge/deviceTransactionConfig.js +1 -1
- package/lib-es/bridge/deviceTransactionConfig.js.map +1 -1
- package/lib-es/bridge/logic.d.ts +1 -1
- package/lib-es/bridge/logic.d.ts.map +1 -1
- package/lib-es/bridge/logic.js +15 -11
- package/lib-es/bridge/logic.js.map +1 -1
- package/lib-es/bridge/synchronisation.d.ts.map +1 -1
- package/lib-es/bridge/synchronisation.js +9 -9
- package/lib-es/bridge/synchronisation.js.map +1 -1
- package/lib-es/logic/craftTransaction.d.ts.map +1 -1
- package/lib-es/logic/craftTransaction.js +0 -8
- package/lib-es/logic/craftTransaction.js.map +1 -1
- package/package.json +12 -12
- package/src/__tests__/api/craftTransaction.unit.test.ts +0 -84
- package/src/__tests__/bridge/deviceTransactionConfig.test.ts +8 -8
- package/src/__tests__/bridge/logic.test.ts +90 -83
- package/src/__tests__/bridge/synchronisation.test.ts +8 -8
- package/src/bridge/deviceTransactionConfig.ts +2 -2
- package/src/bridge/logic.ts +19 -13
- package/src/bridge/synchronisation.ts +11 -13
- 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 =
|
|
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
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
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
|
}
|