@ledgerhq/coin-solana 0.28.0 → 0.29.0-nightly.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/.turbo/turbo-build.log +1 -1
- package/CHANGELOG.md +28 -0
- package/lib/__tests__/fixtures/helpers.fixture.d.ts +36 -1
- package/lib/__tests__/fixtures/helpers.fixture.d.ts.map +1 -1
- package/lib/__tests__/fixtures/helpers.fixture.js +2 -1
- package/lib/__tests__/fixtures/helpers.fixture.js.map +1 -1
- package/lib/__tests__/scan-accounts.test.js +5 -1
- package/lib/__tests__/scan-accounts.test.js.map +1 -1
- package/lib/bridge.integration.test.js +1 -0
- package/lib/bridge.integration.test.js.map +1 -1
- package/lib/buildTransaction.d.ts.map +1 -1
- package/lib/buildTransaction.js +5 -0
- package/lib/buildTransaction.js.map +1 -1
- package/lib/getTransactionStatus.d.ts.map +1 -1
- package/lib/getTransactionStatus.js +2 -0
- package/lib/getTransactionStatus.js.map +1 -1
- package/lib/network/chain/account/token.d.ts +9 -0
- package/lib/network/chain/account/token.d.ts.map +1 -1
- package/lib/network/chain/account/tokenExtensions.d.ts +6 -0
- package/lib/network/chain/account/tokenExtensions.d.ts.map +1 -1
- package/lib/network/chain/account/tokenExtensions.js +1 -0
- package/lib/network/chain/account/tokenExtensions.js.map +1 -1
- package/lib/prepareTransaction.d.ts.map +1 -1
- package/lib/prepareTransaction.js +4 -61
- package/lib/prepareTransaction.js.map +1 -1
- package/lib/prepareTransaction.test.js +37 -52
- package/lib/prepareTransaction.test.js.map +1 -1
- package/lib/rawTransaction.d.ts +5 -0
- package/lib/rawTransaction.d.ts.map +1 -0
- package/lib/rawTransaction.js +52 -0
- package/lib/rawTransaction.js.map +1 -0
- package/lib/signOperation.d.ts.map +1 -1
- package/lib/signOperation.js +16 -0
- package/lib/signOperation.js.map +1 -1
- package/lib/specs.d.ts.map +1 -1
- package/lib/specs.js +1 -0
- package/lib/specs.js.map +1 -1
- package/lib/transaction.d.ts.map +1 -1
- package/lib/transaction.js +14 -20
- package/lib/transaction.js.map +1 -1
- package/lib/tx-fees.js +1 -0
- package/lib/tx-fees.js.map +1 -1
- package/lib/types.d.ts +10 -2
- package/lib/types.d.ts.map +1 -1
- package/lib-es/__tests__/fixtures/helpers.fixture.d.ts +36 -1
- package/lib-es/__tests__/fixtures/helpers.fixture.d.ts.map +1 -1
- package/lib-es/__tests__/fixtures/helpers.fixture.js +2 -1
- package/lib-es/__tests__/fixtures/helpers.fixture.js.map +1 -1
- package/lib-es/__tests__/scan-accounts.test.js +5 -1
- package/lib-es/__tests__/scan-accounts.test.js.map +1 -1
- package/lib-es/bridge.integration.test.js +1 -0
- package/lib-es/bridge.integration.test.js.map +1 -1
- package/lib-es/buildTransaction.d.ts.map +1 -1
- package/lib-es/buildTransaction.js +5 -0
- package/lib-es/buildTransaction.js.map +1 -1
- package/lib-es/getTransactionStatus.d.ts.map +1 -1
- package/lib-es/getTransactionStatus.js +2 -0
- package/lib-es/getTransactionStatus.js.map +1 -1
- package/lib-es/network/chain/account/token.d.ts +9 -0
- package/lib-es/network/chain/account/token.d.ts.map +1 -1
- package/lib-es/network/chain/account/tokenExtensions.d.ts +6 -0
- package/lib-es/network/chain/account/tokenExtensions.d.ts.map +1 -1
- package/lib-es/network/chain/account/tokenExtensions.js +1 -0
- package/lib-es/network/chain/account/tokenExtensions.js.map +1 -1
- package/lib-es/prepareTransaction.d.ts.map +1 -1
- package/lib-es/prepareTransaction.js +3 -60
- package/lib-es/prepareTransaction.js.map +1 -1
- package/lib-es/prepareTransaction.test.js +37 -52
- package/lib-es/prepareTransaction.test.js.map +1 -1
- package/lib-es/rawTransaction.d.ts +5 -0
- package/lib-es/rawTransaction.d.ts.map +1 -0
- package/lib-es/rawTransaction.js +44 -0
- package/lib-es/rawTransaction.js.map +1 -0
- package/lib-es/signOperation.d.ts.map +1 -1
- package/lib-es/signOperation.js +16 -0
- package/lib-es/signOperation.js.map +1 -1
- package/lib-es/specs.d.ts.map +1 -1
- package/lib-es/specs.js +1 -0
- package/lib-es/specs.js.map +1 -1
- package/lib-es/transaction.d.ts.map +1 -1
- package/lib-es/transaction.js +14 -20
- package/lib-es/transaction.js.map +1 -1
- package/lib-es/tx-fees.js +1 -0
- package/lib-es/tx-fees.js.map +1 -1
- package/lib-es/types.d.ts +10 -2
- package/lib-es/types.d.ts.map +1 -1
- package/package.json +7 -7
- package/src/__tests__/fixtures/helpers.fixture.ts +4 -0
- package/src/__tests__/scan-accounts.test.ts +5 -1
- package/src/bridge.integration.test.ts +1 -0
- package/src/buildTransaction.ts +5 -0
- package/src/getTransactionStatus.ts +2 -0
- package/src/network/chain/account/tokenExtensions.ts +1 -0
- package/src/prepareTransaction.test.ts +31 -71
- package/src/prepareTransaction.ts +3 -100
- package/src/rawTransaction.ts +59 -0
- package/src/signOperation.ts +24 -0
- package/src/specs.ts +1 -0
- package/src/transaction.ts +17 -20
- package/src/tx-fees.ts +1 -0
- package/src/types.ts +13 -1
package/src/transaction.ts
CHANGED
|
@@ -88,6 +88,8 @@ function formatCommand(mainAccount: Account, tx: Transaction, command: Command)
|
|
|
88
88
|
return formatStakeWithdraw(mainAccount, tx, command);
|
|
89
89
|
case "stake.split":
|
|
90
90
|
return formatStakeSplit(mainAccount, tx, command);
|
|
91
|
+
case "raw":
|
|
92
|
+
return formatRaw(tx);
|
|
91
93
|
default:
|
|
92
94
|
return assertUnreachable(command);
|
|
93
95
|
}
|
|
@@ -105,9 +107,7 @@ function formatStakeCreateAccount(
|
|
|
105
107
|
` AMOUNT: ${amount}${tx.useAllAmount ? " (ALL)" : ""}`,
|
|
106
108
|
` SEED: ${command.seed}`,
|
|
107
109
|
` VALIDATOR: ${command.delegate.voteAccAddress}`,
|
|
108
|
-
]
|
|
109
|
-
.filter(Boolean)
|
|
110
|
-
.join("\n");
|
|
110
|
+
].join("\n");
|
|
111
111
|
|
|
112
112
|
return "\n" + str;
|
|
113
113
|
}
|
|
@@ -157,7 +157,7 @@ function formatCreateATA(mainAccount: Account, command: TokenCreateATACommand) {
|
|
|
157
157
|
if (!token) {
|
|
158
158
|
throw new Error(`token for mint "${command.mint}" not found`);
|
|
159
159
|
}
|
|
160
|
-
const str = [` OPT IN TOKEN: ${token.ticker}`].
|
|
160
|
+
const str = [` OPT IN TOKEN: ${token.ticker}`].join("\n");
|
|
161
161
|
return "\n" + str;
|
|
162
162
|
}
|
|
163
163
|
|
|
@@ -186,9 +186,7 @@ function formatCreateApprove(
|
|
|
186
186
|
` APPROVE: ${command.account}`,
|
|
187
187
|
` DELEGATE: ${command.recipientDescriptor.walletAddress}`,
|
|
188
188
|
` AMOUNT: ${amount}${tx.useAllAmount ? " (ALL)" : ""}`,
|
|
189
|
-
]
|
|
190
|
-
.filter(Boolean)
|
|
191
|
-
.join("\n");
|
|
189
|
+
].join("\n");
|
|
192
190
|
return "\n" + str;
|
|
193
191
|
}
|
|
194
192
|
|
|
@@ -205,21 +203,17 @@ function formatCreateRevoke(
|
|
|
205
203
|
throw new Error("token subaccount expected");
|
|
206
204
|
}
|
|
207
205
|
|
|
208
|
-
const str = [` OWNER: ${command.owner}`, ` REVOKE: ${command.account}`]
|
|
209
|
-
.filter(Boolean)
|
|
210
|
-
.join("\n");
|
|
206
|
+
const str = [` OWNER: ${command.owner}`, ` REVOKE: ${command.account}`].join("\n");
|
|
211
207
|
return "\n" + str;
|
|
212
208
|
}
|
|
213
209
|
|
|
214
210
|
function formatStakeDelegate(command: StakeDelegateCommand) {
|
|
215
|
-
const str = [` DELEGATE: ${command.stakeAccAddr}`, ` TO: ${command.voteAccAddr}`]
|
|
216
|
-
.filter(Boolean)
|
|
217
|
-
.join("\n");
|
|
211
|
+
const str = [` DELEGATE: ${command.stakeAccAddr}`, ` TO: ${command.voteAccAddr}`].join("\n");
|
|
218
212
|
return "\n" + str;
|
|
219
213
|
}
|
|
220
214
|
|
|
221
215
|
function formatStakeUndelegate(command: StakeUndelegateCommand) {
|
|
222
|
-
const str = [` UNDELEGATE: ${command.stakeAccAddr}`].
|
|
216
|
+
const str = [` UNDELEGATE: ${command.stakeAccAddr}`].join("\n");
|
|
223
217
|
return "\n" + str;
|
|
224
218
|
}
|
|
225
219
|
|
|
@@ -229,9 +223,7 @@ function formatStakeWithdraw(mainAccount: Account, tx: Transaction, command: Sta
|
|
|
229
223
|
` WITHDRAW FROM: ${command.stakeAccAddr}`,
|
|
230
224
|
` AMOUNT: ${amount}${tx.useAllAmount ? " (ALL)" : ""}`,
|
|
231
225
|
` TO: ${command.toAccAddr}`,
|
|
232
|
-
]
|
|
233
|
-
.filter(Boolean)
|
|
234
|
-
.join("\n");
|
|
226
|
+
].join("\n");
|
|
235
227
|
return "\n" + str;
|
|
236
228
|
}
|
|
237
229
|
|
|
@@ -241,9 +233,14 @@ function formatStakeSplit(mainAccount: Account, tx: Transaction, command: StakeS
|
|
|
241
233
|
` SPLIT: ${command.stakeAccAddr}`,
|
|
242
234
|
` AMOUNT: ${amount}${tx.useAllAmount ? " (ALL)" : ""}`,
|
|
243
235
|
` TO: ${command.splitStakeAccAddr}`,
|
|
244
|
-
]
|
|
245
|
-
|
|
246
|
-
|
|
236
|
+
].join("\n");
|
|
237
|
+
return "\n" + str;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
function formatRaw(tx: Transaction) {
|
|
241
|
+
const str = [` SEND RAW: ${tx.useAllAmount ? " (ALL)" : ""}`, ` TO: ${tx.recipient}`].join(
|
|
242
|
+
"\n",
|
|
243
|
+
);
|
|
247
244
|
return "\n" + str;
|
|
248
245
|
}
|
|
249
246
|
|
package/src/tx-fees.ts
CHANGED
|
@@ -58,6 +58,7 @@ const createDummyTx = (address: string, kind: TransactionModel["kind"]) => {
|
|
|
58
58
|
return createDummyTokenRevokeTx(address);
|
|
59
59
|
case "stake.split":
|
|
60
60
|
case "token.createATA":
|
|
61
|
+
case "raw":
|
|
61
62
|
throw new Error(`not implemented for <${kind}>`);
|
|
62
63
|
default:
|
|
63
64
|
return assertUnreachable(kind);
|
package/src/types.ts
CHANGED
|
@@ -121,6 +121,11 @@ export type TokenTransferCommand = {
|
|
|
121
121
|
};
|
|
122
122
|
};
|
|
123
123
|
|
|
124
|
+
export type RawCommand = {
|
|
125
|
+
kind: "raw";
|
|
126
|
+
raw: string;
|
|
127
|
+
};
|
|
128
|
+
|
|
124
129
|
export type Command =
|
|
125
130
|
| TransferCommand
|
|
126
131
|
| TokenTransferCommand
|
|
@@ -131,7 +136,8 @@ export type Command =
|
|
|
131
136
|
| StakeDelegateCommand
|
|
132
137
|
| StakeUndelegateCommand
|
|
133
138
|
| StakeWithdrawCommand
|
|
134
|
-
| StakeSplitCommand
|
|
139
|
+
| StakeSplitCommand
|
|
140
|
+
| RawCommand;
|
|
135
141
|
|
|
136
142
|
export type CommandDescriptor = {
|
|
137
143
|
command: Command;
|
|
@@ -214,6 +220,11 @@ export type StakeSplitTransaction = {
|
|
|
214
220
|
};
|
|
215
221
|
};
|
|
216
222
|
|
|
223
|
+
export type RawTransaction = {
|
|
224
|
+
kind: "raw";
|
|
225
|
+
uiState: object;
|
|
226
|
+
};
|
|
227
|
+
|
|
217
228
|
export type TransactionModel = { commandDescriptor?: CommandDescriptor } & (
|
|
218
229
|
| TransferTransaction
|
|
219
230
|
| TokenTransferTransaction
|
|
@@ -225,6 +236,7 @@ export type TransactionModel = { commandDescriptor?: CommandDescriptor } & (
|
|
|
225
236
|
| StakeUndelegateTransaction
|
|
226
237
|
| StakeWithdrawTransaction
|
|
227
238
|
| StakeSplitTransaction
|
|
239
|
+
| RawTransaction
|
|
228
240
|
);
|
|
229
241
|
|
|
230
242
|
export type Transaction = TransactionCommon & {
|