@ledgerhq/coin-solana 0.36.0 → 0.37.0-nightly.20251108023448
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/CHANGELOG.md +15 -0
- package/lib/cli-transaction.d.ts +1 -1
- package/lib/cli-transaction.d.ts.map +1 -1
- package/lib/cli-transaction.js +3 -3
- package/lib/cli-transaction.js.map +1 -1
- package/lib/helpers/token.d.ts +1 -1
- package/lib/helpers/token.d.ts.map +1 -1
- package/lib/helpers/token.js +3 -2
- package/lib/helpers/token.js.map +1 -1
- package/lib/preload.js +5 -5
- package/lib/preload.js.map +1 -1
- package/lib/prepareTransaction.js +3 -3
- package/lib/prepareTransaction.js.map +1 -1
- package/lib/signOperation.js +2 -2
- package/lib/signOperation.js.map +1 -1
- package/lib/synchronization.d.ts.map +1 -1
- package/lib/synchronization.js +13 -10
- package/lib/synchronization.js.map +1 -1
- package/lib/test/bridge.dataset.d.ts.map +1 -1
- package/lib/test/bridge.dataset.js +11 -2
- package/lib/test/bridge.dataset.js.map +1 -1
- package/lib/transaction.d.ts +2 -2
- package/lib/transaction.d.ts.map +1 -1
- package/lib/transaction.js +6 -6
- package/lib/transaction.js.map +1 -1
- package/lib-es/cli-transaction.d.ts +1 -1
- package/lib-es/cli-transaction.d.ts.map +1 -1
- package/lib-es/cli-transaction.js +3 -3
- package/lib-es/cli-transaction.js.map +1 -1
- package/lib-es/helpers/token.d.ts +1 -1
- package/lib-es/helpers/token.d.ts.map +1 -1
- package/lib-es/helpers/token.js +3 -2
- package/lib-es/helpers/token.js.map +1 -1
- package/lib-es/preload.js +1 -1
- package/lib-es/preload.js.map +1 -1
- package/lib-es/prepareTransaction.js +3 -3
- package/lib-es/prepareTransaction.js.map +1 -1
- package/lib-es/signOperation.js +2 -2
- package/lib-es/signOperation.js.map +1 -1
- package/lib-es/synchronization.d.ts.map +1 -1
- package/lib-es/synchronization.js +13 -10
- package/lib-es/synchronization.js.map +1 -1
- package/lib-es/test/bridge.dataset.d.ts.map +1 -1
- package/lib-es/test/bridge.dataset.js +11 -2
- package/lib-es/test/bridge.dataset.js.map +1 -1
- package/lib-es/transaction.d.ts +2 -2
- package/lib-es/transaction.d.ts.map +1 -1
- package/lib-es/transaction.js +6 -6
- package/lib-es/transaction.js.map +1 -1
- package/package.json +4 -4
- package/src/cli-transaction.ts +106 -104
- package/src/helpers/token.ts +3 -4
- package/src/preload.ts +1 -1
- package/src/prepareTransaction.ts +3 -3
- package/src/signOperation.ts +2 -2
- package/src/synchronization.ts +16 -13
- package/src/test/bridge.dataset.ts +11 -5
- package/src/tests/preload.unit.test.ts +27 -29
- package/src/tests/tokens-bridge.unit.test.ts +14 -6
- package/src/transaction.ts +13 -6
package/src/transaction.ts
CHANGED
|
@@ -54,7 +54,7 @@ const lamportsToSOL = (account: Account, amount: number) => {
|
|
|
54
54
|
});
|
|
55
55
|
};
|
|
56
56
|
|
|
57
|
-
export const formatTransaction = (tx: Transaction, mainAccount: Account): string => {
|
|
57
|
+
export const formatTransaction = async (tx: Transaction, mainAccount: Account): Promise<string> => {
|
|
58
58
|
if (tx.model.commandDescriptor === undefined) {
|
|
59
59
|
throw new Error("can not format unprepared transaction");
|
|
60
60
|
}
|
|
@@ -63,17 +63,21 @@ export const formatTransaction = (tx: Transaction, mainAccount: Account): string
|
|
|
63
63
|
if (Object.keys(commandDescriptor.errors).length > 0) {
|
|
64
64
|
throw new Error("can not format invalid transaction");
|
|
65
65
|
}
|
|
66
|
-
return formatCommand(mainAccount, tx, commandDescriptor.command);
|
|
66
|
+
return await formatCommand(mainAccount, tx, commandDescriptor.command);
|
|
67
67
|
};
|
|
68
68
|
|
|
69
|
-
function formatCommand(
|
|
69
|
+
async function formatCommand(
|
|
70
|
+
mainAccount: Account,
|
|
71
|
+
tx: Transaction,
|
|
72
|
+
command: Command,
|
|
73
|
+
): Promise<string> {
|
|
70
74
|
switch (command.kind) {
|
|
71
75
|
case "transfer":
|
|
72
76
|
return formatTransfer(mainAccount, tx, command);
|
|
73
77
|
case "token.transfer":
|
|
74
78
|
return formatTokenTransfer(mainAccount, tx, command);
|
|
75
79
|
case "token.createATA":
|
|
76
|
-
return formatCreateATA(mainAccount, command);
|
|
80
|
+
return await formatCreateATA(mainAccount, command);
|
|
77
81
|
case "token.approve":
|
|
78
82
|
return formatCreateApprove(mainAccount, tx, command);
|
|
79
83
|
case "token.revoke":
|
|
@@ -152,8 +156,11 @@ function formatTokenTransfer(mainAccount: Account, tx: Transaction, command: Tok
|
|
|
152
156
|
return "\n" + str;
|
|
153
157
|
}
|
|
154
158
|
|
|
155
|
-
function formatCreateATA(
|
|
156
|
-
|
|
159
|
+
async function formatCreateATA(
|
|
160
|
+
mainAccount: Account,
|
|
161
|
+
command: TokenCreateATACommand,
|
|
162
|
+
): Promise<string> {
|
|
163
|
+
const token = await getCryptoAssetsStore().findTokenByAddressInCurrency(
|
|
157
164
|
command.mint,
|
|
158
165
|
mainAccount.currency.id,
|
|
159
166
|
);
|