@ton-community/ton-ledger 4.1.0 → 6.0.0
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 +12 -0
- package/README.md +24 -10
- package/dist/TonTransport.d.ts +0 -5
- package/dist/TonTransport.js +0 -4
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,18 @@ All notable changes to this project will be documented in this file.
|
|
|
4
4
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
5
5
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
6
|
|
|
7
|
+
## [6.0.0] - 2023-07-11
|
|
8
|
+
|
|
9
|
+
### Removed
|
|
10
|
+
|
|
11
|
+
- Removed `unsafe` payload format
|
|
12
|
+
|
|
13
|
+
## [5.0.0] - 2023-06-29
|
|
14
|
+
|
|
15
|
+
### Removed
|
|
16
|
+
|
|
17
|
+
- Removed `decimals` and `ticker` from `jetton-transfer` request
|
|
18
|
+
|
|
7
19
|
## [4.1.0] - 2023-06-16
|
|
8
20
|
|
|
9
21
|
### Added
|
package/README.md
CHANGED
|
@@ -118,28 +118,42 @@ await c.sendExternalMessage(contract, signed);
|
|
|
118
118
|
|
|
119
119
|
## Payload formats
|
|
120
120
|
|
|
121
|
-
Usually you want to perform transactions with some payload. Ledger's NanoApp currently supports 2 stable commands, all other are outdated or unstable:
|
|
122
|
-
|
|
123
121
|
### Transaction with a comment
|
|
124
122
|
Comments are limited to ASCII-only symbols and 127 letters. Anything above would be automatically downgraded to Blind Signing Mode that you want to avoid at all cost.
|
|
125
123
|
|
|
126
124
|
```typescript
|
|
127
|
-
|
|
125
|
+
const payload: TonPayloadFormat = {
|
|
128
126
|
type: 'comment',
|
|
129
127
|
text: 'Deposit'
|
|
130
128
|
};
|
|
131
129
|
```
|
|
132
130
|
|
|
133
|
-
###
|
|
131
|
+
### Jetton transfer
|
|
132
|
+
|
|
133
|
+
```typescript
|
|
134
|
+
const payload: TonPayloadFormat = {
|
|
135
|
+
type: 'jetton-transfer',
|
|
136
|
+
queryId: null, // null will be replaced with 0; you can pass any value of the BigInt type
|
|
137
|
+
amount: 1n,
|
|
138
|
+
destination: Address.parse('EQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAM9c'),
|
|
139
|
+
responseDestination: Address.parse('EQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAM9c'),
|
|
140
|
+
customPayload: null, // you can pass any value of the Cell type
|
|
141
|
+
forwardAmount: 0n,
|
|
142
|
+
forwardPayload: null // you can pass any value of the Cell type
|
|
143
|
+
};
|
|
144
|
+
```
|
|
134
145
|
|
|
135
|
-
|
|
146
|
+
### NFT transfer
|
|
136
147
|
|
|
137
148
|
```typescript
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
149
|
+
const payload: TonPayloadFormat = {
|
|
150
|
+
type: 'nft-transfer',
|
|
151
|
+
queryId: null, // null will be replaced with 0; you can pass any value of the BigInt type
|
|
152
|
+
newOwner: Address.parse('EQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAM9c'),
|
|
153
|
+
responseDestination: Address.parse('EQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAM9c'),
|
|
154
|
+
customPayload: null, // you can pass any value of the Cell type
|
|
155
|
+
forwardAmount: 0n,
|
|
156
|
+
forwardPayload: null // you can pass any value of the Cell type
|
|
143
157
|
};
|
|
144
158
|
```
|
|
145
159
|
|
package/dist/TonTransport.d.ts
CHANGED
|
@@ -2,17 +2,12 @@
|
|
|
2
2
|
import Transport from "@ledgerhq/hw-transport";
|
|
3
3
|
import { Address, Cell, SendMode, StateInit } from "ton-core";
|
|
4
4
|
export type TonPayloadFormat = {
|
|
5
|
-
type: 'unsafe';
|
|
6
|
-
message: Cell;
|
|
7
|
-
} | {
|
|
8
5
|
type: 'comment';
|
|
9
6
|
text: string;
|
|
10
7
|
} | {
|
|
11
8
|
type: 'jetton-transfer';
|
|
12
9
|
queryId: bigint | null;
|
|
13
10
|
amount: bigint;
|
|
14
|
-
decimals: number;
|
|
15
|
-
ticker: string;
|
|
16
11
|
destination: Address;
|
|
17
12
|
responseDestination: Address;
|
|
18
13
|
customPayload: Cell | null;
|
package/dist/TonTransport.js
CHANGED
|
@@ -271,9 +271,6 @@ class TonTransport {
|
|
|
271
271
|
.storeBuffer(Buffer.from(transaction.payload.text))
|
|
272
272
|
.endCell();
|
|
273
273
|
}
|
|
274
|
-
else if (transaction.payload.type === 'unsafe') {
|
|
275
|
-
payload = transaction.payload.message;
|
|
276
|
-
}
|
|
277
274
|
else if (transaction.payload.type === 'jetton-transfer' || transaction.payload.type === 'nft-transfer') {
|
|
278
275
|
hints = Buffer.concat([
|
|
279
276
|
(0, ledgerWriter_1.writeUint8)(1),
|
|
@@ -293,7 +290,6 @@ class TonTransport {
|
|
|
293
290
|
if (transaction.payload.type === 'jetton-transfer') {
|
|
294
291
|
d = Buffer.concat([d, (0, ledgerWriter_1.writeVarUInt)(transaction.payload.amount)]);
|
|
295
292
|
b = b.storeCoins(transaction.payload.amount);
|
|
296
|
-
d = Buffer.concat([d, (0, ledgerWriter_1.writeUint8)(transaction.payload.decimals), (0, ledgerWriter_1.writeUint8)(transaction.payload.ticker.length), Buffer.from(transaction.payload.ticker, 'ascii')]);
|
|
297
293
|
d = Buffer.concat([d, (0, ledgerWriter_1.writeAddress)(transaction.payload.destination)]);
|
|
298
294
|
b = b.storeAddress(transaction.payload.destination);
|
|
299
295
|
}
|