@ledgerhq/coin-ton 0.15.0-nightly.9 → 0.15.1-nightly.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/.turbo/turbo-build.log +1 -1
- package/.unimportedrc.json +2 -1
- package/CHANGELOG.md +29 -92
- package/lib/test/bridge.dataset.d.ts +14 -0
- package/lib/test/bridge.dataset.d.ts.map +1 -0
- package/lib/test/bridge.dataset.js +213 -0
- package/lib/test/bridge.dataset.js.map +1 -0
- package/lib-es/test/bridge.dataset.d.ts +14 -0
- package/lib-es/test/bridge.dataset.d.ts.map +1 -0
- package/lib-es/test/bridge.dataset.js +207 -0
- package/lib-es/test/bridge.dataset.js.map +1 -0
- package/package.json +7 -7
- package/src/{__tests__/integration/bridge.integration.test.ts → test/bridge.dataset.ts} +4 -4
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
|
|
2
|
-
> @ledgerhq/coin-ton@0.15.0
|
|
2
|
+
> @ledgerhq/coin-ton@0.15.0 build /home/runner/work/ledger-live/ledger-live/libs/coin-modules/coin-ton
|
|
3
3
|
> tsc && tsc -m esnext --moduleResolution bundler --outDir lib-es
|
|
4
4
|
|
package/.unimportedrc.json
CHANGED
|
@@ -13,7 +13,8 @@
|
|
|
13
13
|
"src/deviceTransactionConfig.ts",
|
|
14
14
|
"src/hw-signMessage.ts",
|
|
15
15
|
"src/specs.ts",
|
|
16
|
-
"src/speculos-deviceActions.ts"
|
|
16
|
+
"src/speculos-deviceActions.ts",
|
|
17
|
+
"src/test/bridge.dataset.ts"
|
|
17
18
|
],
|
|
18
19
|
"ignoreUnused": ["msw", "@ledgerhq/types-cryptoassets", "@ledgerhq/live-env"]
|
|
19
20
|
}
|
package/CHANGELOG.md
CHANGED
|
@@ -1,121 +1,58 @@
|
|
|
1
1
|
# @ledgerhq/coin-ton
|
|
2
2
|
|
|
3
|
-
## 0.15.
|
|
3
|
+
## 0.15.1-nightly.0
|
|
4
4
|
|
|
5
5
|
### Patch Changes
|
|
6
6
|
|
|
7
|
-
- Updated dependencies [[`
|
|
8
|
-
- @ledgerhq/types-
|
|
9
|
-
- @ledgerhq/
|
|
10
|
-
- @ledgerhq/
|
|
11
|
-
- @ledgerhq/types-live@6.87.0-nightly.5
|
|
7
|
+
- Updated dependencies [[`2c6a198`](https://github.com/LedgerHQ/ledger-live/commit/2c6a198ba28391695202a0787ce168c53768ff37)]:
|
|
8
|
+
- @ledgerhq/types-live@6.88.0-nightly.0
|
|
9
|
+
- @ledgerhq/coin-framework@6.7.1-nightly.0
|
|
10
|
+
- @ledgerhq/cryptoassets@13.31.1-nightly.0
|
|
12
11
|
|
|
13
|
-
## 0.15.0
|
|
14
|
-
|
|
15
|
-
### Patch Changes
|
|
16
|
-
|
|
17
|
-
- Updated dependencies [[`c96d73f`](https://github.com/LedgerHQ/ledger-live/commit/c96d73fed0a75a9c208f78d51c34b742703a7dda)]:
|
|
18
|
-
- @ledgerhq/coin-framework@6.7.0-nightly.8
|
|
19
|
-
|
|
20
|
-
## 0.15.0-nightly.7
|
|
21
|
-
|
|
22
|
-
### Patch Changes
|
|
23
|
-
|
|
24
|
-
- Updated dependencies [[`b4ceaff`](https://github.com/LedgerHQ/ledger-live/commit/b4ceaff2ecf68d8a14e09801c76ab0b014c45286), [`f392f69`](https://github.com/LedgerHQ/ledger-live/commit/f392f6912f445cc2f7cf4dfcfd030fa3da76f736), [`cbc0648`](https://github.com/LedgerHQ/ledger-live/commit/cbc064885d8e0459e40d327a2e5389204b3ec705)]:
|
|
25
|
-
- @ledgerhq/cryptoassets@13.31.0-nightly.7
|
|
26
|
-
- @ledgerhq/types-live@6.87.0-nightly.5
|
|
27
|
-
- @ledgerhq/live-env@2.19.0-nightly.2
|
|
28
|
-
- @ledgerhq/coin-framework@6.7.0-nightly.7
|
|
29
|
-
- @ledgerhq/live-network@2.0.20-nightly.3
|
|
30
|
-
|
|
31
|
-
## 0.15.0-nightly.6
|
|
12
|
+
## 0.15.0
|
|
32
13
|
|
|
33
14
|
### Minor Changes
|
|
34
15
|
|
|
35
|
-
- [#
|
|
36
|
-
|
|
37
|
-
Adds typed payload variants and serialization/deserialization for:
|
|
38
|
-
|
|
39
|
-
- tonwhales-pool-deposit
|
|
40
|
-
- tonwhales-pool-withdraw
|
|
41
|
-
- vesting-send-msg-comment
|
|
42
|
-
|
|
43
|
-
Updates unit tests to cover new payloads and retains an explicit unsupported payload test case (lint-suppressed locally). Also bumps TON-related and wallet-api dependencies and replaces the @ton/core patch file reference.
|
|
44
|
-
|
|
45
|
-
### Patch Changes
|
|
46
|
-
|
|
47
|
-
- Updated dependencies [[`51995e9`](https://github.com/LedgerHQ/ledger-live/commit/51995e96a9e1fafe14c7cbe45ce0b1ec8ebd106b)]:
|
|
48
|
-
- @ledgerhq/types-live@6.87.0-nightly.4
|
|
49
|
-
- @ledgerhq/coin-framework@6.7.0-nightly.6
|
|
50
|
-
- @ledgerhq/cryptoassets@13.31.0-nightly.6
|
|
51
|
-
|
|
52
|
-
## 0.15.0-nightly.5
|
|
53
|
-
|
|
54
|
-
### Patch Changes
|
|
55
|
-
|
|
56
|
-
- Updated dependencies [[`cadf2e1`](https://github.com/LedgerHQ/ledger-live/commit/cadf2e1dfb09248d3f77d96f94ae774425dbca75)]:
|
|
57
|
-
- @ledgerhq/live-env@2.19.0-nightly.1
|
|
58
|
-
- @ledgerhq/coin-framework@6.7.0-nightly.5
|
|
59
|
-
- @ledgerhq/cryptoassets@13.31.0-nightly.5
|
|
60
|
-
- @ledgerhq/live-network@2.0.20-nightly.2
|
|
61
|
-
|
|
62
|
-
## 0.15.0-nightly.4
|
|
63
|
-
|
|
64
|
-
### Patch Changes
|
|
65
|
-
|
|
66
|
-
- Updated dependencies [[`7744980`](https://github.com/LedgerHQ/ledger-live/commit/774498090411f1a6d6c06395dda1fc7cd24adf24), [`759064d`](https://github.com/LedgerHQ/ledger-live/commit/759064d4815c636af2d73ba548a85b4f53e7b491)]:
|
|
67
|
-
- @ledgerhq/types-live@6.87.0-nightly.3
|
|
68
|
-
- @ledgerhq/errors@6.27.0-nightly.0
|
|
69
|
-
- @ledgerhq/coin-framework@6.7.0-nightly.4
|
|
70
|
-
- @ledgerhq/cryptoassets@13.31.0-nightly.4
|
|
71
|
-
- @ledgerhq/devices@8.6.2-nightly.0
|
|
72
|
-
- @ledgerhq/live-network@2.0.20-nightly.1
|
|
73
|
-
|
|
74
|
-
## 0.15.0-nightly.3
|
|
75
|
-
|
|
76
|
-
### Patch Changes
|
|
77
|
-
|
|
78
|
-
- Updated dependencies [[`8645f01`](https://github.com/LedgerHQ/ledger-live/commit/8645f016191d29a55f6b0ca6e4b1d1909fd35445)]:
|
|
79
|
-
- @ledgerhq/types-live@6.87.0-nightly.2
|
|
80
|
-
- @ledgerhq/coin-framework@6.7.0-nightly.3
|
|
81
|
-
- @ledgerhq/cryptoassets@13.31.0-nightly.3
|
|
82
|
-
|
|
83
|
-
## 0.15.0-nightly.2
|
|
84
|
-
|
|
85
|
-
### Minor Changes
|
|
16
|
+
- [#12015](https://github.com/LedgerHQ/ledger-live/pull/12015) [`03af552`](https://github.com/LedgerHQ/ledger-live/commit/03af552b621e19e31747a65b1870dfe8d3bb005b) Thanks [@Justkant](https://github.com/Justkant)! - feat: new signRawTransaction to support any XRP transaction with wallet-api
|
|
86
17
|
|
|
87
18
|
- [#12196](https://github.com/LedgerHQ/ledger-live/pull/12196) [`565da80`](https://github.com/LedgerHQ/ledger-live/commit/565da807b1ebbfc830fd0e47b3d8856f88d410a6) Thanks [@gre-ledger](https://github.com/gre-ledger)! - Remove deprecated getTokenById and hasTokenId functions
|
|
88
19
|
|
|
89
20
|
### Patch Changes
|
|
90
21
|
|
|
91
|
-
- Updated dependencies [[`c6a676f`](https://github.com/LedgerHQ/ledger-live/commit/c6a676ff80581ac19b896adf44d54812983b72da), [`565da80`](https://github.com/LedgerHQ/ledger-live/commit/565da807b1ebbfc830fd0e47b3d8856f88d410a6)]:
|
|
92
|
-
- @ledgerhq/
|
|
93
|
-
- @ledgerhq/
|
|
22
|
+
- Updated dependencies [[`ea16f59`](https://github.com/LedgerHQ/ledger-live/commit/ea16f592e85019a1b77287a7f2b975c6fcffc74c), [`b88faa1`](https://github.com/LedgerHQ/ledger-live/commit/b88faa18e2f5cd309b54fc3157a44db606846cc5), [`cfe65ca`](https://github.com/LedgerHQ/ledger-live/commit/cfe65cafa268be4e53197ee163ce78f28ed72592), [`a9aacdb`](https://github.com/LedgerHQ/ledger-live/commit/a9aacdb330700f0a294833f7d77de17f179229b2), [`3979c07`](https://github.com/LedgerHQ/ledger-live/commit/3979c0715e4f54165c89d00ebe1441e064e1a110), [`f1f3845`](https://github.com/LedgerHQ/ledger-live/commit/f1f3845942e4cbce9c585dc65f6170ddbc319f19), [`c6a676f`](https://github.com/LedgerHQ/ledger-live/commit/c6a676ff80581ac19b896adf44d54812983b72da), [`b5fc1bd`](https://github.com/LedgerHQ/ledger-live/commit/b5fc1bd28fff091241905fec5ff8dc8af4c99b79), [`03af552`](https://github.com/LedgerHQ/ledger-live/commit/03af552b621e19e31747a65b1870dfe8d3bb005b), [`89ac0ed`](https://github.com/LedgerHQ/ledger-live/commit/89ac0eddc145dcf5c7cf240aa8be4301372c8f33), [`565da80`](https://github.com/LedgerHQ/ledger-live/commit/565da807b1ebbfc830fd0e47b3d8856f88d410a6), [`8645f01`](https://github.com/LedgerHQ/ledger-live/commit/8645f016191d29a55f6b0ca6e4b1d1909fd35445), [`1d9860c`](https://github.com/LedgerHQ/ledger-live/commit/1d9860cd1688131d391579955b40c6710b667db8), [`d2b12e7`](https://github.com/LedgerHQ/ledger-live/commit/d2b12e70bba9e772d078d1fe4d9c537b8d316a87), [`db25e21`](https://github.com/LedgerHQ/ledger-live/commit/db25e212b87dea426b153c6f1d988cead63c8c46), [`c8dbf40`](https://github.com/LedgerHQ/ledger-live/commit/c8dbf402268359e225a94782420111e786f875fa), [`cab7d97`](https://github.com/LedgerHQ/ledger-live/commit/cab7d9794e7babb8220c6d339fb08e618e3d4202)]:
|
|
23
|
+
- @ledgerhq/cryptoassets@13.31.0
|
|
24
|
+
- @ledgerhq/types-live@6.87.0
|
|
25
|
+
- @ledgerhq/coin-framework@6.7.0
|
|
26
|
+
- @ledgerhq/live-env@2.19.0
|
|
27
|
+
- @ledgerhq/types-cryptoassets@7.29.0
|
|
28
|
+
- @ledgerhq/live-network@2.0.20
|
|
94
29
|
|
|
95
|
-
## 0.15.0-
|
|
30
|
+
## 0.15.0-next.1
|
|
96
31
|
|
|
97
32
|
### Patch Changes
|
|
98
33
|
|
|
99
|
-
- Updated dependencies [[`
|
|
100
|
-
- @ledgerhq/
|
|
101
|
-
- @ledgerhq/
|
|
102
|
-
- @ledgerhq/
|
|
103
|
-
- @ledgerhq/coin-framework@6.7.0-nightly.1
|
|
104
|
-
- @ledgerhq/live-network@2.0.20-nightly.0
|
|
34
|
+
- Updated dependencies [[`b88faa1`](https://github.com/LedgerHQ/ledger-live/commit/b88faa18e2f5cd309b54fc3157a44db606846cc5)]:
|
|
35
|
+
- @ledgerhq/types-live@6.87.0-next.1
|
|
36
|
+
- @ledgerhq/coin-framework@6.7.0-next.1
|
|
37
|
+
- @ledgerhq/cryptoassets@13.31.0-next.1
|
|
105
38
|
|
|
106
|
-
## 0.15.0-
|
|
39
|
+
## 0.15.0-next.0
|
|
107
40
|
|
|
108
41
|
### Minor Changes
|
|
109
42
|
|
|
110
43
|
- [#12015](https://github.com/LedgerHQ/ledger-live/pull/12015) [`03af552`](https://github.com/LedgerHQ/ledger-live/commit/03af552b621e19e31747a65b1870dfe8d3bb005b) Thanks [@Justkant](https://github.com/Justkant)! - feat: new signRawTransaction to support any XRP transaction with wallet-api
|
|
111
44
|
|
|
45
|
+
- [#12196](https://github.com/LedgerHQ/ledger-live/pull/12196) [`565da80`](https://github.com/LedgerHQ/ledger-live/commit/565da807b1ebbfc830fd0e47b3d8856f88d410a6) Thanks [@gre-ledger](https://github.com/gre-ledger)! - Remove deprecated getTokenById and hasTokenId functions
|
|
46
|
+
|
|
112
47
|
### Patch Changes
|
|
113
48
|
|
|
114
|
-
- Updated dependencies [[`cfe65ca`](https://github.com/LedgerHQ/ledger-live/commit/cfe65cafa268be4e53197ee163ce78f28ed72592), [`b5fc1bd`](https://github.com/LedgerHQ/ledger-live/commit/b5fc1bd28fff091241905fec5ff8dc8af4c99b79), [`03af552`](https://github.com/LedgerHQ/ledger-live/commit/03af552b621e19e31747a65b1870dfe8d3bb005b), [`d2b12e7`](https://github.com/LedgerHQ/ledger-live/commit/d2b12e70bba9e772d078d1fe4d9c537b8d316a87), [`cab7d97`](https://github.com/LedgerHQ/ledger-live/commit/cab7d9794e7babb8220c6d339fb08e618e3d4202)]:
|
|
115
|
-
- @ledgerhq/cryptoassets@13.31.0-
|
|
116
|
-
- @ledgerhq/types-live@6.87.0-
|
|
117
|
-
- @ledgerhq/coin-framework@6.7.0-
|
|
118
|
-
- @ledgerhq/
|
|
49
|
+
- Updated dependencies [[`ea16f59`](https://github.com/LedgerHQ/ledger-live/commit/ea16f592e85019a1b77287a7f2b975c6fcffc74c), [`cfe65ca`](https://github.com/LedgerHQ/ledger-live/commit/cfe65cafa268be4e53197ee163ce78f28ed72592), [`a9aacdb`](https://github.com/LedgerHQ/ledger-live/commit/a9aacdb330700f0a294833f7d77de17f179229b2), [`3979c07`](https://github.com/LedgerHQ/ledger-live/commit/3979c0715e4f54165c89d00ebe1441e064e1a110), [`f1f3845`](https://github.com/LedgerHQ/ledger-live/commit/f1f3845942e4cbce9c585dc65f6170ddbc319f19), [`c6a676f`](https://github.com/LedgerHQ/ledger-live/commit/c6a676ff80581ac19b896adf44d54812983b72da), [`b5fc1bd`](https://github.com/LedgerHQ/ledger-live/commit/b5fc1bd28fff091241905fec5ff8dc8af4c99b79), [`03af552`](https://github.com/LedgerHQ/ledger-live/commit/03af552b621e19e31747a65b1870dfe8d3bb005b), [`89ac0ed`](https://github.com/LedgerHQ/ledger-live/commit/89ac0eddc145dcf5c7cf240aa8be4301372c8f33), [`565da80`](https://github.com/LedgerHQ/ledger-live/commit/565da807b1ebbfc830fd0e47b3d8856f88d410a6), [`8645f01`](https://github.com/LedgerHQ/ledger-live/commit/8645f016191d29a55f6b0ca6e4b1d1909fd35445), [`1d9860c`](https://github.com/LedgerHQ/ledger-live/commit/1d9860cd1688131d391579955b40c6710b667db8), [`d2b12e7`](https://github.com/LedgerHQ/ledger-live/commit/d2b12e70bba9e772d078d1fe4d9c537b8d316a87), [`db25e21`](https://github.com/LedgerHQ/ledger-live/commit/db25e212b87dea426b153c6f1d988cead63c8c46), [`c8dbf40`](https://github.com/LedgerHQ/ledger-live/commit/c8dbf402268359e225a94782420111e786f875fa), [`cab7d97`](https://github.com/LedgerHQ/ledger-live/commit/cab7d9794e7babb8220c6d339fb08e618e3d4202)]:
|
|
50
|
+
- @ledgerhq/cryptoassets@13.31.0-next.0
|
|
51
|
+
- @ledgerhq/types-live@6.87.0-next.0
|
|
52
|
+
- @ledgerhq/coin-framework@6.7.0-next.0
|
|
53
|
+
- @ledgerhq/live-env@2.19.0-next.0
|
|
54
|
+
- @ledgerhq/types-cryptoassets@7.29.0-next.0
|
|
55
|
+
- @ledgerhq/live-network@2.0.20-next.0
|
|
119
56
|
|
|
120
57
|
## 0.14.3
|
|
121
58
|
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { DatasetTest } from "@ledgerhq/types-live";
|
|
2
|
+
import { Transaction } from "../types";
|
|
3
|
+
export declare const dataset: DatasetTest<Transaction>;
|
|
4
|
+
/**
|
|
5
|
+
* NOTE: if tests are added to this file,
|
|
6
|
+
* like done in libs/coin-polkadot/src/bridge.integration.test.ts for example,
|
|
7
|
+
* this file fill need to be imported in ledger-live-common
|
|
8
|
+
* libs/ledger-live-common/src/families/ton/bridge.integration.test.ts
|
|
9
|
+
* like done for polkadot.
|
|
10
|
+
* cf.
|
|
11
|
+
* - libs/coin-polkadot/src/bridge.integration.test.ts
|
|
12
|
+
* - libs/ledger-live-common/src/families/polkadot/bridge.integration.test.ts
|
|
13
|
+
*/
|
|
14
|
+
//# sourceMappingURL=bridge.dataset.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bridge.dataset.d.ts","sourceRoot":"","sources":["../../src/test/bridge.dataset.ts"],"names":[],"mappings":"AACA,OAAO,EAAkB,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAInE,OAAO,EAAc,WAAW,EAAE,MAAM,UAAU,CAAC;AA+LnD,eAAO,MAAM,OAAO,EAAE,WAAW,CAAC,WAAW,CAK5C,CAAC;AAEF;;;;;;;;;GASG"}
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.dataset = void 0;
|
|
7
|
+
const errors_1 = require("@ledgerhq/errors");
|
|
8
|
+
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
|
9
|
+
const errors_2 = require("../errors");
|
|
10
|
+
const transaction_1 = require("../transaction");
|
|
11
|
+
const utils_1 = require("../utils");
|
|
12
|
+
const PUBKEY = "86196cb40cd25e9e696bc808e3f2c074ce0b39f2a2a9d482a68eafef86e4a060";
|
|
13
|
+
const ADDRESS = "UQCOvQLYvTcbi5tL9MaDNzuVl3-J3vATimNm9yO5XPafLfV4";
|
|
14
|
+
const ADDRESS_2 = "UQAui6M4jOYOezUGfmeONA22Ars9yjd34YIGdAR1Pcpp4sgR";
|
|
15
|
+
const PATH = "44'/607'/0'/0'/0'/0'";
|
|
16
|
+
const SUBACCOUNT = "js:2:ton:86196cb40cd25e9e696bc808e3f2c074ce0b39f2a2a9d482a68eafef86e4a060:ton+ton%2Fjetton%2Feqavlwfdxgf2lxm67y4yzc17wykd9a0guwpkms1gosm~!underscore!~~!underscore!~not";
|
|
17
|
+
const ton = {
|
|
18
|
+
IgnorePrepareTransactionFields: ["fees"],
|
|
19
|
+
scanAccounts: [
|
|
20
|
+
{
|
|
21
|
+
name: "ton seed 1",
|
|
22
|
+
apdus: `
|
|
23
|
+
=> e005000019068000002c8000025f80000000800000008000000080000000
|
|
24
|
+
<= 86196cb40cd25e9e696bc808e3f2c074ce0b39f2a2a9d482a68eafef86e4a0609000
|
|
25
|
+
=> e005000019068000002c8000025f80000000800000008000000180000000
|
|
26
|
+
<= b5177c2b32f9d72fa8c673cc3d61acec6a9f68eb5e4945445fdbb48a45eb48879000
|
|
27
|
+
`,
|
|
28
|
+
test: (expect, accounts) => {
|
|
29
|
+
for (const account of accounts) {
|
|
30
|
+
expect(account.derivationMode).toEqual("ton");
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
],
|
|
35
|
+
accounts: [
|
|
36
|
+
{
|
|
37
|
+
FIXME_tests: [
|
|
38
|
+
"balance is sum of ops",
|
|
39
|
+
"transaction Subaccount Send max", // TypeError: Cannot read properties of undefined (reading 'toString') in ts.amount
|
|
40
|
+
],
|
|
41
|
+
raw: {
|
|
42
|
+
id: `js:2:ton:${PUBKEY}:ton`,
|
|
43
|
+
currencyId: "ton",
|
|
44
|
+
seedIdentifier: PUBKEY,
|
|
45
|
+
name: "TON 1",
|
|
46
|
+
derivationMode: "ton",
|
|
47
|
+
index: 0,
|
|
48
|
+
freshAddress: ADDRESS,
|
|
49
|
+
freshAddressPath: PATH,
|
|
50
|
+
xpub: PUBKEY,
|
|
51
|
+
blockHeight: 0,
|
|
52
|
+
operations: [],
|
|
53
|
+
pendingOperations: [],
|
|
54
|
+
lastSyncDate: "",
|
|
55
|
+
balance: "5000000000",
|
|
56
|
+
subAccounts: [],
|
|
57
|
+
},
|
|
58
|
+
transactions: [
|
|
59
|
+
{
|
|
60
|
+
name: "Not a valid address",
|
|
61
|
+
transaction: (0, transaction_1.fromTransactionRaw)({
|
|
62
|
+
family: "ton",
|
|
63
|
+
recipient: "novalidaddress",
|
|
64
|
+
fees: "10000000",
|
|
65
|
+
amount: "1000",
|
|
66
|
+
comment: { isEncrypted: false, text: "" },
|
|
67
|
+
}),
|
|
68
|
+
expectedStatus: {
|
|
69
|
+
errors: {
|
|
70
|
+
recipient: new errors_1.InvalidAddress(),
|
|
71
|
+
},
|
|
72
|
+
warnings: {},
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
name: "Not enough balance",
|
|
77
|
+
transaction: (0, transaction_1.fromTransactionRaw)({
|
|
78
|
+
family: "ton",
|
|
79
|
+
recipient: ADDRESS_2,
|
|
80
|
+
fees: "10000000",
|
|
81
|
+
amount: (300 * 1e9).toString(),
|
|
82
|
+
comment: { isEncrypted: false, text: "" },
|
|
83
|
+
}),
|
|
84
|
+
expectedStatus: {
|
|
85
|
+
errors: {
|
|
86
|
+
amount: new errors_1.NotEnoughBalance(),
|
|
87
|
+
},
|
|
88
|
+
warnings: {},
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
name: "Invalid transferID/Memo",
|
|
93
|
+
transaction: (0, transaction_1.fromTransactionRaw)({
|
|
94
|
+
family: "ton",
|
|
95
|
+
recipient: ADDRESS_2,
|
|
96
|
+
fees: "1",
|
|
97
|
+
amount: (1 * 1e2).toString(),
|
|
98
|
+
comment: { isEncrypted: false, text: "😀" },
|
|
99
|
+
}),
|
|
100
|
+
expectedStatus: {
|
|
101
|
+
errors: {
|
|
102
|
+
transaction: new errors_2.TonCommentInvalid(),
|
|
103
|
+
},
|
|
104
|
+
warnings: {},
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
name: "New account and sufficient amount",
|
|
109
|
+
transaction: (0, transaction_1.fromTransactionRaw)({
|
|
110
|
+
family: "ton",
|
|
111
|
+
recipient: ADDRESS_2,
|
|
112
|
+
fees: "10000000",
|
|
113
|
+
amount: "10000000",
|
|
114
|
+
comment: { isEncrypted: false, text: "Valid" },
|
|
115
|
+
}),
|
|
116
|
+
expectedStatus: {
|
|
117
|
+
amount: new bignumber_js_1.default("10000000"),
|
|
118
|
+
errors: {},
|
|
119
|
+
warnings: {},
|
|
120
|
+
},
|
|
121
|
+
},
|
|
122
|
+
// sub account tests
|
|
123
|
+
{
|
|
124
|
+
name: "Subaccount Not a valid address",
|
|
125
|
+
transaction: (0, transaction_1.fromTransactionRaw)({
|
|
126
|
+
family: "ton",
|
|
127
|
+
recipient: "novalidaddress",
|
|
128
|
+
fees: "10000000",
|
|
129
|
+
amount: "1000",
|
|
130
|
+
comment: { isEncrypted: false, text: "" },
|
|
131
|
+
subAccountId: SUBACCOUNT,
|
|
132
|
+
}),
|
|
133
|
+
expectedStatus: {
|
|
134
|
+
errors: {
|
|
135
|
+
recipient: new errors_1.InvalidAddress(),
|
|
136
|
+
},
|
|
137
|
+
warnings: {},
|
|
138
|
+
},
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
name: "Subaccount Not enough balance",
|
|
142
|
+
transaction: (0, transaction_1.fromTransactionRaw)({
|
|
143
|
+
family: "ton",
|
|
144
|
+
recipient: ADDRESS_2,
|
|
145
|
+
fees: "10000000",
|
|
146
|
+
amount: (300 * 1e9).toString(),
|
|
147
|
+
comment: { isEncrypted: false, text: "" },
|
|
148
|
+
subAccountId: SUBACCOUNT,
|
|
149
|
+
}),
|
|
150
|
+
expectedStatus: {
|
|
151
|
+
errors: {
|
|
152
|
+
amount: new errors_1.NotEnoughBalance(),
|
|
153
|
+
},
|
|
154
|
+
warnings: {},
|
|
155
|
+
},
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
name: "Subaccount New account and sufficient amount",
|
|
159
|
+
transaction: (0, transaction_1.fromTransactionRaw)({
|
|
160
|
+
family: "ton",
|
|
161
|
+
recipient: ADDRESS,
|
|
162
|
+
fees: "10000000",
|
|
163
|
+
amount: "10000000",
|
|
164
|
+
comment: { isEncrypted: false, text: "Valid" },
|
|
165
|
+
subAccountId: SUBACCOUNT,
|
|
166
|
+
}),
|
|
167
|
+
expectedStatus: {
|
|
168
|
+
amount: new bignumber_js_1.default("10000000"),
|
|
169
|
+
errors: {},
|
|
170
|
+
warnings: {},
|
|
171
|
+
},
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
name: "Subaccount Send max",
|
|
175
|
+
transaction: (0, transaction_1.fromTransactionRaw)({
|
|
176
|
+
family: "ton",
|
|
177
|
+
recipient: ADDRESS,
|
|
178
|
+
fees: "10000000",
|
|
179
|
+
amount: "10000000",
|
|
180
|
+
comment: { isEncrypted: false, text: "Valid" },
|
|
181
|
+
useAllAmount: true,
|
|
182
|
+
subAccountId: SUBACCOUNT,
|
|
183
|
+
}),
|
|
184
|
+
expectedStatus: (account, tx) => {
|
|
185
|
+
const subAccount = (0, utils_1.findSubAccountById)(account, tx.subAccountId ?? "");
|
|
186
|
+
return {
|
|
187
|
+
amount: subAccount?.spendableBalance,
|
|
188
|
+
errors: {},
|
|
189
|
+
warnings: {},
|
|
190
|
+
};
|
|
191
|
+
},
|
|
192
|
+
},
|
|
193
|
+
],
|
|
194
|
+
},
|
|
195
|
+
],
|
|
196
|
+
};
|
|
197
|
+
exports.dataset = {
|
|
198
|
+
implementations: ["js"],
|
|
199
|
+
currencies: {
|
|
200
|
+
ton,
|
|
201
|
+
},
|
|
202
|
+
};
|
|
203
|
+
/**
|
|
204
|
+
* NOTE: if tests are added to this file,
|
|
205
|
+
* like done in libs/coin-polkadot/src/bridge.integration.test.ts for example,
|
|
206
|
+
* this file fill need to be imported in ledger-live-common
|
|
207
|
+
* libs/ledger-live-common/src/families/ton/bridge.integration.test.ts
|
|
208
|
+
* like done for polkadot.
|
|
209
|
+
* cf.
|
|
210
|
+
* - libs/coin-polkadot/src/bridge.integration.test.ts
|
|
211
|
+
* - libs/ledger-live-common/src/families/polkadot/bridge.integration.test.ts
|
|
212
|
+
*/
|
|
213
|
+
//# sourceMappingURL=bridge.dataset.js.map
|
|
@@ -0,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
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { DatasetTest } from "@ledgerhq/types-live";
|
|
2
|
+
import { Transaction } from "../types";
|
|
3
|
+
export declare const dataset: DatasetTest<Transaction>;
|
|
4
|
+
/**
|
|
5
|
+
* NOTE: if tests are added to this file,
|
|
6
|
+
* like done in libs/coin-polkadot/src/bridge.integration.test.ts for example,
|
|
7
|
+
* this file fill need to be imported in ledger-live-common
|
|
8
|
+
* libs/ledger-live-common/src/families/ton/bridge.integration.test.ts
|
|
9
|
+
* like done for polkadot.
|
|
10
|
+
* cf.
|
|
11
|
+
* - libs/coin-polkadot/src/bridge.integration.test.ts
|
|
12
|
+
* - libs/ledger-live-common/src/families/polkadot/bridge.integration.test.ts
|
|
13
|
+
*/
|
|
14
|
+
//# sourceMappingURL=bridge.dataset.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bridge.dataset.d.ts","sourceRoot":"","sources":["../../src/test/bridge.dataset.ts"],"names":[],"mappings":"AACA,OAAO,EAAkB,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAInE,OAAO,EAAc,WAAW,EAAE,MAAM,UAAU,CAAC;AA+LnD,eAAO,MAAM,OAAO,EAAE,WAAW,CAAC,WAAW,CAK5C,CAAC;AAEF;;;;;;;;;GASG"}
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
import { InvalidAddress, NotEnoughBalance } from "@ledgerhq/errors";
|
|
2
|
+
import BigNumber from "bignumber.js";
|
|
3
|
+
import { TonCommentInvalid } from "../errors";
|
|
4
|
+
import { fromTransactionRaw } from "../transaction";
|
|
5
|
+
import { findSubAccountById } from "../utils";
|
|
6
|
+
const PUBKEY = "86196cb40cd25e9e696bc808e3f2c074ce0b39f2a2a9d482a68eafef86e4a060";
|
|
7
|
+
const ADDRESS = "UQCOvQLYvTcbi5tL9MaDNzuVl3-J3vATimNm9yO5XPafLfV4";
|
|
8
|
+
const ADDRESS_2 = "UQAui6M4jOYOezUGfmeONA22Ars9yjd34YIGdAR1Pcpp4sgR";
|
|
9
|
+
const PATH = "44'/607'/0'/0'/0'/0'";
|
|
10
|
+
const SUBACCOUNT = "js:2:ton:86196cb40cd25e9e696bc808e3f2c074ce0b39f2a2a9d482a68eafef86e4a060:ton+ton%2Fjetton%2Feqavlwfdxgf2lxm67y4yzc17wykd9a0guwpkms1gosm~!underscore!~~!underscore!~not";
|
|
11
|
+
const ton = {
|
|
12
|
+
IgnorePrepareTransactionFields: ["fees"],
|
|
13
|
+
scanAccounts: [
|
|
14
|
+
{
|
|
15
|
+
name: "ton seed 1",
|
|
16
|
+
apdus: `
|
|
17
|
+
=> e005000019068000002c8000025f80000000800000008000000080000000
|
|
18
|
+
<= 86196cb40cd25e9e696bc808e3f2c074ce0b39f2a2a9d482a68eafef86e4a0609000
|
|
19
|
+
=> e005000019068000002c8000025f80000000800000008000000180000000
|
|
20
|
+
<= b5177c2b32f9d72fa8c673cc3d61acec6a9f68eb5e4945445fdbb48a45eb48879000
|
|
21
|
+
`,
|
|
22
|
+
test: (expect, accounts) => {
|
|
23
|
+
for (const account of accounts) {
|
|
24
|
+
expect(account.derivationMode).toEqual("ton");
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
],
|
|
29
|
+
accounts: [
|
|
30
|
+
{
|
|
31
|
+
FIXME_tests: [
|
|
32
|
+
"balance is sum of ops",
|
|
33
|
+
"transaction Subaccount Send max", // TypeError: Cannot read properties of undefined (reading 'toString') in ts.amount
|
|
34
|
+
],
|
|
35
|
+
raw: {
|
|
36
|
+
id: `js:2:ton:${PUBKEY}:ton`,
|
|
37
|
+
currencyId: "ton",
|
|
38
|
+
seedIdentifier: PUBKEY,
|
|
39
|
+
name: "TON 1",
|
|
40
|
+
derivationMode: "ton",
|
|
41
|
+
index: 0,
|
|
42
|
+
freshAddress: ADDRESS,
|
|
43
|
+
freshAddressPath: PATH,
|
|
44
|
+
xpub: PUBKEY,
|
|
45
|
+
blockHeight: 0,
|
|
46
|
+
operations: [],
|
|
47
|
+
pendingOperations: [],
|
|
48
|
+
lastSyncDate: "",
|
|
49
|
+
balance: "5000000000",
|
|
50
|
+
subAccounts: [],
|
|
51
|
+
},
|
|
52
|
+
transactions: [
|
|
53
|
+
{
|
|
54
|
+
name: "Not a valid address",
|
|
55
|
+
transaction: fromTransactionRaw({
|
|
56
|
+
family: "ton",
|
|
57
|
+
recipient: "novalidaddress",
|
|
58
|
+
fees: "10000000",
|
|
59
|
+
amount: "1000",
|
|
60
|
+
comment: { isEncrypted: false, text: "" },
|
|
61
|
+
}),
|
|
62
|
+
expectedStatus: {
|
|
63
|
+
errors: {
|
|
64
|
+
recipient: new InvalidAddress(),
|
|
65
|
+
},
|
|
66
|
+
warnings: {},
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
name: "Not enough balance",
|
|
71
|
+
transaction: fromTransactionRaw({
|
|
72
|
+
family: "ton",
|
|
73
|
+
recipient: ADDRESS_2,
|
|
74
|
+
fees: "10000000",
|
|
75
|
+
amount: (300 * 1e9).toString(),
|
|
76
|
+
comment: { isEncrypted: false, text: "" },
|
|
77
|
+
}),
|
|
78
|
+
expectedStatus: {
|
|
79
|
+
errors: {
|
|
80
|
+
amount: new NotEnoughBalance(),
|
|
81
|
+
},
|
|
82
|
+
warnings: {},
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
name: "Invalid transferID/Memo",
|
|
87
|
+
transaction: fromTransactionRaw({
|
|
88
|
+
family: "ton",
|
|
89
|
+
recipient: ADDRESS_2,
|
|
90
|
+
fees: "1",
|
|
91
|
+
amount: (1 * 1e2).toString(),
|
|
92
|
+
comment: { isEncrypted: false, text: "😀" },
|
|
93
|
+
}),
|
|
94
|
+
expectedStatus: {
|
|
95
|
+
errors: {
|
|
96
|
+
transaction: new TonCommentInvalid(),
|
|
97
|
+
},
|
|
98
|
+
warnings: {},
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
name: "New account and sufficient amount",
|
|
103
|
+
transaction: fromTransactionRaw({
|
|
104
|
+
family: "ton",
|
|
105
|
+
recipient: ADDRESS_2,
|
|
106
|
+
fees: "10000000",
|
|
107
|
+
amount: "10000000",
|
|
108
|
+
comment: { isEncrypted: false, text: "Valid" },
|
|
109
|
+
}),
|
|
110
|
+
expectedStatus: {
|
|
111
|
+
amount: new BigNumber("10000000"),
|
|
112
|
+
errors: {},
|
|
113
|
+
warnings: {},
|
|
114
|
+
},
|
|
115
|
+
},
|
|
116
|
+
// sub account tests
|
|
117
|
+
{
|
|
118
|
+
name: "Subaccount Not a valid address",
|
|
119
|
+
transaction: fromTransactionRaw({
|
|
120
|
+
family: "ton",
|
|
121
|
+
recipient: "novalidaddress",
|
|
122
|
+
fees: "10000000",
|
|
123
|
+
amount: "1000",
|
|
124
|
+
comment: { isEncrypted: false, text: "" },
|
|
125
|
+
subAccountId: SUBACCOUNT,
|
|
126
|
+
}),
|
|
127
|
+
expectedStatus: {
|
|
128
|
+
errors: {
|
|
129
|
+
recipient: new InvalidAddress(),
|
|
130
|
+
},
|
|
131
|
+
warnings: {},
|
|
132
|
+
},
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
name: "Subaccount Not enough balance",
|
|
136
|
+
transaction: fromTransactionRaw({
|
|
137
|
+
family: "ton",
|
|
138
|
+
recipient: ADDRESS_2,
|
|
139
|
+
fees: "10000000",
|
|
140
|
+
amount: (300 * 1e9).toString(),
|
|
141
|
+
comment: { isEncrypted: false, text: "" },
|
|
142
|
+
subAccountId: SUBACCOUNT,
|
|
143
|
+
}),
|
|
144
|
+
expectedStatus: {
|
|
145
|
+
errors: {
|
|
146
|
+
amount: new NotEnoughBalance(),
|
|
147
|
+
},
|
|
148
|
+
warnings: {},
|
|
149
|
+
},
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
name: "Subaccount New account and sufficient amount",
|
|
153
|
+
transaction: fromTransactionRaw({
|
|
154
|
+
family: "ton",
|
|
155
|
+
recipient: ADDRESS,
|
|
156
|
+
fees: "10000000",
|
|
157
|
+
amount: "10000000",
|
|
158
|
+
comment: { isEncrypted: false, text: "Valid" },
|
|
159
|
+
subAccountId: SUBACCOUNT,
|
|
160
|
+
}),
|
|
161
|
+
expectedStatus: {
|
|
162
|
+
amount: new BigNumber("10000000"),
|
|
163
|
+
errors: {},
|
|
164
|
+
warnings: {},
|
|
165
|
+
},
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
name: "Subaccount Send max",
|
|
169
|
+
transaction: fromTransactionRaw({
|
|
170
|
+
family: "ton",
|
|
171
|
+
recipient: ADDRESS,
|
|
172
|
+
fees: "10000000",
|
|
173
|
+
amount: "10000000",
|
|
174
|
+
comment: { isEncrypted: false, text: "Valid" },
|
|
175
|
+
useAllAmount: true,
|
|
176
|
+
subAccountId: SUBACCOUNT,
|
|
177
|
+
}),
|
|
178
|
+
expectedStatus: (account, tx) => {
|
|
179
|
+
const subAccount = findSubAccountById(account, tx.subAccountId ?? "");
|
|
180
|
+
return {
|
|
181
|
+
amount: subAccount?.spendableBalance,
|
|
182
|
+
errors: {},
|
|
183
|
+
warnings: {},
|
|
184
|
+
};
|
|
185
|
+
},
|
|
186
|
+
},
|
|
187
|
+
],
|
|
188
|
+
},
|
|
189
|
+
],
|
|
190
|
+
};
|
|
191
|
+
export const dataset = {
|
|
192
|
+
implementations: ["js"],
|
|
193
|
+
currencies: {
|
|
194
|
+
ton,
|
|
195
|
+
},
|
|
196
|
+
};
|
|
197
|
+
/**
|
|
198
|
+
* NOTE: if tests are added to this file,
|
|
199
|
+
* like done in libs/coin-polkadot/src/bridge.integration.test.ts for example,
|
|
200
|
+
* this file fill need to be imported in ledger-live-common
|
|
201
|
+
* libs/ledger-live-common/src/families/ton/bridge.integration.test.ts
|
|
202
|
+
* like done for polkadot.
|
|
203
|
+
* cf.
|
|
204
|
+
* - libs/coin-polkadot/src/bridge.integration.test.ts
|
|
205
|
+
* - libs/ledger-live-common/src/families/polkadot/bridge.integration.test.ts
|
|
206
|
+
*/
|
|
207
|
+
//# sourceMappingURL=bridge.dataset.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bridge.dataset.js","sourceRoot":"","sources":["../../src/test/bridge.dataset.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEpE,OAAO,SAAS,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAEpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAE9C,MAAM,MAAM,GAAG,kEAAkE,CAAC;AAClF,MAAM,OAAO,GAAG,kDAAkD,CAAC;AACnE,MAAM,SAAS,GAAG,kDAAkD,CAAC;AACrE,MAAM,IAAI,GAAG,sBAAsB,CAAC;AACpC,MAAM,UAAU,GACd,yKAAyK,CAAC;AAE5K,MAAM,GAAG,GAAgC;IACvC,8BAA8B,EAAE,CAAC,MAAM,CAAC;IACxC,YAAY,EAAE;QACZ;YACE,IAAI,EAAE,YAAY;YAClB,KAAK,EAAE;;;;;OAKN;YACD,IAAI,EAAE,CAAC,MAAM,EAAE,QAAQ,EAAE,EAAE;gBACzB,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;oBAC/B,MAAM,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;gBAChD,CAAC;YACH,CAAC;SACF;KACF;IACD,QAAQ,EAAE;QACR;YACE,WAAW,EAAE;gBACX,uBAAuB;gBACvB,iCAAiC,EAAE,mFAAmF;aACvH;YACD,GAAG,EAAE;gBACH,EAAE,EAAE,YAAY,MAAM,MAAM;gBAC5B,UAAU,EAAE,KAAK;gBACjB,cAAc,EAAE,MAAM;gBACtB,IAAI,EAAE,OA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AE,EAAE;4BACV,QAAQ,EAAE,EAAE;yBACb,CAAC;oBACJ,CAAC;iBACF;aACF;SACF;KACF;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,OAAO,GAA6B;IAC/C,eAAe,EAAE,CAAC,IAAI,CAAC;IACvB,UAAU,EAAE;QACV,GAAG;KACJ;CACF,CAAC;AAEF;;;;;;;;;GASG"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ledgerhq/coin-ton",
|
|
3
|
-
"version": "0.15.
|
|
3
|
+
"version": "0.15.1-nightly.0",
|
|
4
4
|
"description": "Ton Coin integration",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Ledger",
|
|
@@ -54,15 +54,15 @@
|
|
|
54
54
|
"lodash": "^4.17.21",
|
|
55
55
|
"msw": "^2.0.11",
|
|
56
56
|
"rxjs": "^7.8.1",
|
|
57
|
-
"@ledgerhq/
|
|
57
|
+
"@ledgerhq/coin-framework": "^6.7.1-nightly.0",
|
|
58
|
+
"@ledgerhq/cryptoassets": "^13.31.1-nightly.0",
|
|
58
59
|
"@ledgerhq/devices": "8.6.2-nightly.0",
|
|
59
60
|
"@ledgerhq/errors": "^6.27.0-nightly.0",
|
|
60
|
-
"@ledgerhq/live-env": "^2.19.0
|
|
61
|
-
"@ledgerhq/
|
|
62
|
-
"@ledgerhq/live-network": "^2.0.20-nightly.3",
|
|
61
|
+
"@ledgerhq/live-env": "^2.19.0",
|
|
62
|
+
"@ledgerhq/live-network": "^2.0.20",
|
|
63
63
|
"@ledgerhq/logs": "^6.13.0",
|
|
64
|
-
"@ledgerhq/types-cryptoassets": "^7.29.0
|
|
65
|
-
"@ledgerhq/types-live": "^6.
|
|
64
|
+
"@ledgerhq/types-cryptoassets": "^7.29.0",
|
|
65
|
+
"@ledgerhq/types-live": "^6.88.0-nightly.0"
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
68
|
"@types/imurmurhash": "^0.1.4",
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { InvalidAddress, NotEnoughBalance } from "@ledgerhq/errors";
|
|
2
2
|
import { CurrenciesData, DatasetTest } from "@ledgerhq/types-live";
|
|
3
3
|
import BigNumber from "bignumber.js";
|
|
4
|
-
import { TonCommentInvalid } from "
|
|
5
|
-
import { fromTransactionRaw } from "
|
|
6
|
-
import { TonAccount, Transaction } from "
|
|
7
|
-
import { findSubAccountById } from "
|
|
4
|
+
import { TonCommentInvalid } from "../errors";
|
|
5
|
+
import { fromTransactionRaw } from "../transaction";
|
|
6
|
+
import { TonAccount, Transaction } from "../types";
|
|
7
|
+
import { findSubAccountById } from "../utils";
|
|
8
8
|
|
|
9
9
|
const PUBKEY = "86196cb40cd25e9e696bc808e3f2c074ce0b39f2a2a9d482a68eafef86e4a060";
|
|
10
10
|
const ADDRESS = "UQCOvQLYvTcbi5tL9MaDNzuVl3-J3vATimNm9yO5XPafLfV4";
|