@ledgerhq/coin-internet_computer 1.9.0-nightly.8 → 1.9.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/CHANGELOG.md +20 -73
- package/lib/api/api.d.ts +11 -6
- package/lib/api/api.d.ts.map +1 -1
- package/lib/api/api.js +64 -84
- package/lib/api/api.js.map +1 -1
- package/lib/bridge/bridgeHelpers/account.d.ts.map +1 -1
- package/lib/bridge/bridgeHelpers/account.js +33 -52
- package/lib/bridge/bridgeHelpers/account.js.map +1 -1
- package/lib/bridge/bridgeHelpers/addresses.d.ts +6 -0
- package/lib/bridge/bridgeHelpers/addresses.d.ts.map +1 -1
- package/lib/bridge/bridgeHelpers/addresses.js +29 -1
- package/lib/bridge/bridgeHelpers/addresses.js.map +1 -1
- package/lib/bridge/bridgeHelpers/icpRosetta/index.d.ts +30 -0
- package/lib/bridge/bridgeHelpers/icpRosetta/index.d.ts.map +1 -0
- package/lib/bridge/bridgeHelpers/icpRosetta/index.js +88 -0
- package/lib/bridge/bridgeHelpers/icpRosetta/index.js.map +1 -0
- package/lib/bridge/bridgeHelpers/icpRosetta/types.d.ts +145 -0
- package/lib/bridge/bridgeHelpers/icpRosetta/types.d.ts.map +1 -0
- package/lib/bridge/bridgeHelpers/icpRosetta/types.js +3 -0
- package/lib/bridge/bridgeHelpers/icpRosetta/types.js.map +1 -0
- package/lib/bridge/bridgeHelpers/icpRosetta/utils.d.ts +17 -0
- package/lib/bridge/bridgeHelpers/icpRosetta/utils.d.ts.map +1 -0
- package/lib/bridge/bridgeHelpers/icpRosetta/utils.js +155 -0
- package/lib/bridge/bridgeHelpers/icpRosetta/utils.js.map +1 -0
- package/lib/bridge/broadcast.d.ts.map +1 -1
- package/lib/bridge/broadcast.js +6 -22
- package/lib/bridge/broadcast.js.map +1 -1
- package/lib/bridge/getTransactionStatus.d.ts.map +1 -1
- package/lib/bridge/getTransactionStatus.js +3 -4
- package/lib/bridge/getTransactionStatus.js.map +1 -1
- package/lib/bridge/prepareTransaction.d.ts.map +1 -1
- package/lib/bridge/prepareTransaction.js +1 -2
- package/lib/bridge/prepareTransaction.js.map +1 -1
- package/lib/bridge/signOperation.d.ts +2 -2
- package/lib/bridge/signOperation.d.ts.map +1 -1
- package/lib/bridge/signOperation.js +13 -44
- package/lib/bridge/signOperation.js.map +1 -1
- package/lib/consts.d.ts +0 -2
- package/lib/consts.d.ts.map +1 -1
- package/lib/consts.js +1 -8
- package/lib/consts.js.map +1 -1
- package/lib/hw-signMessage.d.ts.map +1 -1
- package/lib/hw-signMessage.js +2 -1
- package/lib/hw-signMessage.js.map +1 -1
- package/lib/types/signer.d.ts +1 -1
- package/lib/types/signer.d.ts.map +1 -1
- package/lib-es/api/api.d.ts +11 -6
- package/lib-es/api/api.d.ts.map +1 -1
- package/lib-es/api/api.js +60 -81
- package/lib-es/api/api.js.map +1 -1
- package/lib-es/bridge/bridgeHelpers/account.d.ts.map +1 -1
- package/lib-es/bridge/bridgeHelpers/account.js +33 -52
- package/lib-es/bridge/bridgeHelpers/account.js.map +1 -1
- package/lib-es/bridge/bridgeHelpers/addresses.d.ts +6 -0
- package/lib-es/bridge/bridgeHelpers/addresses.d.ts.map +1 -1
- package/lib-es/bridge/bridgeHelpers/addresses.js +23 -0
- package/lib-es/bridge/bridgeHelpers/addresses.js.map +1 -1
- package/lib-es/bridge/bridgeHelpers/icpRosetta/index.d.ts +30 -0
- package/lib-es/bridge/bridgeHelpers/icpRosetta/index.d.ts.map +1 -0
- package/lib-es/bridge/bridgeHelpers/icpRosetta/index.js +76 -0
- package/lib-es/bridge/bridgeHelpers/icpRosetta/index.js.map +1 -0
- package/lib-es/bridge/bridgeHelpers/icpRosetta/types.d.ts +145 -0
- package/lib-es/bridge/bridgeHelpers/icpRosetta/types.d.ts.map +1 -0
- package/lib-es/bridge/bridgeHelpers/icpRosetta/types.js +2 -0
- package/lib-es/bridge/bridgeHelpers/icpRosetta/types.js.map +1 -0
- package/lib-es/bridge/bridgeHelpers/icpRosetta/utils.d.ts +17 -0
- package/lib-es/bridge/bridgeHelpers/icpRosetta/utils.d.ts.map +1 -0
- package/lib-es/bridge/bridgeHelpers/icpRosetta/utils.js +123 -0
- package/lib-es/bridge/bridgeHelpers/icpRosetta/utils.js.map +1 -0
- package/lib-es/bridge/broadcast.d.ts.map +1 -1
- package/lib-es/bridge/broadcast.js +6 -19
- package/lib-es/bridge/broadcast.js.map +1 -1
- package/lib-es/bridge/getTransactionStatus.d.ts.map +1 -1
- package/lib-es/bridge/getTransactionStatus.js +1 -2
- package/lib-es/bridge/getTransactionStatus.js.map +1 -1
- package/lib-es/bridge/prepareTransaction.d.ts.map +1 -1
- package/lib-es/bridge/prepareTransaction.js +1 -2
- package/lib-es/bridge/prepareTransaction.js.map +1 -1
- package/lib-es/bridge/signOperation.d.ts +2 -2
- package/lib-es/bridge/signOperation.d.ts.map +1 -1
- package/lib-es/bridge/signOperation.js +13 -41
- package/lib-es/bridge/signOperation.js.map +1 -1
- package/lib-es/consts.d.ts +0 -2
- package/lib-es/consts.d.ts.map +1 -1
- package/lib-es/consts.js +0 -3
- package/lib-es/consts.js.map +1 -1
- package/lib-es/hw-signMessage.d.ts.map +1 -1
- package/lib-es/hw-signMessage.js +2 -1
- package/lib-es/hw-signMessage.js.map +1 -1
- package/lib-es/types/signer.d.ts +1 -1
- package/lib-es/types/signer.d.ts.map +1 -1
- package/package.json +13 -7
- package/src/api/api.ts +71 -126
- package/src/bridge/bridgeHelpers/account.ts +43 -70
- package/src/bridge/bridgeHelpers/addresses.ts +25 -0
- package/src/bridge/bridgeHelpers/icpRosetta/index.ts +154 -0
- package/src/bridge/bridgeHelpers/icpRosetta/types.ts +166 -0
- package/src/bridge/bridgeHelpers/icpRosetta/utils.ts +151 -0
- package/src/bridge/broadcast.ts +6 -31
- package/src/bridge/getTransactionStatus.ts +1 -2
- package/src/bridge/prepareTransaction.ts +1 -2
- package/src/bridge/signOperation.ts +18 -68
- package/src/consts.ts +0 -10
- package/src/hw-signMessage.ts +6 -1
- package/src/types/signer.ts +1 -1
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
|
|
2
|
-
> @ledgerhq/coin-internet_computer@1.9.0
|
|
2
|
+
> @ledgerhq/coin-internet_computer@1.9.0 build /home/runner/work/ledger-live/ledger-live/libs/coin-modules/coin-internet_computer
|
|
3
3
|
> tsc && tsc -m esnext --moduleResolution bundler --outDir lib-es
|
|
4
4
|
|
package/CHANGELOG.md
CHANGED
|
@@ -1,85 +1,30 @@
|
|
|
1
1
|
# @ledgerhq/coin-internet_computer
|
|
2
2
|
|
|
3
|
-
## 1.9.0
|
|
4
|
-
|
|
5
|
-
### Patch Changes
|
|
6
|
-
|
|
7
|
-
- Updated dependencies [[`c96d73f`](https://github.com/LedgerHQ/ledger-live/commit/c96d73fed0a75a9c208f78d51c34b742703a7dda)]:
|
|
8
|
-
- @ledgerhq/coin-framework@6.7.0-nightly.8
|
|
9
|
-
|
|
10
|
-
## 1.9.0-nightly.7
|
|
3
|
+
## 1.9.0
|
|
11
4
|
|
|
12
5
|
### Minor Changes
|
|
13
6
|
|
|
14
|
-
- [#
|
|
15
|
-
|
|
16
|
-
### Patch Changes
|
|
17
|
-
|
|
18
|
-
- Updated dependencies [[`b4ceaff`](https://github.com/LedgerHQ/ledger-live/commit/b4ceaff2ecf68d8a14e09801c76ab0b014c45286), [`f392f69`](https://github.com/LedgerHQ/ledger-live/commit/f392f6912f445cc2f7cf4dfcfd030fa3da76f736)]:
|
|
19
|
-
- @ledgerhq/cryptoassets@13.31.0-nightly.7
|
|
20
|
-
- @ledgerhq/types-live@6.87.0-nightly.5
|
|
21
|
-
- @ledgerhq/coin-framework@6.7.0-nightly.7
|
|
22
|
-
|
|
23
|
-
## 1.9.0-nightly.6
|
|
24
|
-
|
|
25
|
-
### Patch Changes
|
|
26
|
-
|
|
27
|
-
- Updated dependencies [[`51995e9`](https://github.com/LedgerHQ/ledger-live/commit/51995e96a9e1fafe14c7cbe45ce0b1ec8ebd106b)]:
|
|
28
|
-
- @ledgerhq/types-live@6.87.0-nightly.4
|
|
29
|
-
- @ledgerhq/coin-framework@6.7.0-nightly.6
|
|
30
|
-
- @ledgerhq/cryptoassets@13.31.0-nightly.6
|
|
31
|
-
|
|
32
|
-
## 1.9.0-nightly.5
|
|
33
|
-
|
|
34
|
-
### Patch Changes
|
|
35
|
-
|
|
36
|
-
- Updated dependencies [[`cadf2e1`](https://github.com/LedgerHQ/ledger-live/commit/cadf2e1dfb09248d3f77d96f94ae774425dbca75)]:
|
|
37
|
-
- @ledgerhq/live-env@2.19.0-nightly.1
|
|
38
|
-
- @ledgerhq/coin-framework@6.7.0-nightly.5
|
|
39
|
-
- @ledgerhq/cryptoassets@13.31.0-nightly.5
|
|
40
|
-
- @ledgerhq/live-network@2.0.20-nightly.2
|
|
41
|
-
|
|
42
|
-
## 1.9.0-nightly.4
|
|
43
|
-
|
|
44
|
-
### Patch Changes
|
|
45
|
-
|
|
46
|
-
- Updated dependencies [[`7744980`](https://github.com/LedgerHQ/ledger-live/commit/774498090411f1a6d6c06395dda1fc7cd24adf24), [`759064d`](https://github.com/LedgerHQ/ledger-live/commit/759064d4815c636af2d73ba548a85b4f53e7b491)]:
|
|
47
|
-
- @ledgerhq/types-live@6.87.0-nightly.3
|
|
48
|
-
- @ledgerhq/errors@6.27.0-nightly.0
|
|
49
|
-
- @ledgerhq/coin-framework@6.7.0-nightly.4
|
|
50
|
-
- @ledgerhq/cryptoassets@13.31.0-nightly.4
|
|
51
|
-
- @ledgerhq/devices@8.6.2-nightly.0
|
|
52
|
-
- @ledgerhq/live-network@2.0.20-nightly.1
|
|
53
|
-
|
|
54
|
-
## 1.9.0-nightly.3
|
|
55
|
-
|
|
56
|
-
### Patch Changes
|
|
57
|
-
|
|
58
|
-
- Updated dependencies [[`8645f01`](https://github.com/LedgerHQ/ledger-live/commit/8645f016191d29a55f6b0ca6e4b1d1909fd35445)]:
|
|
59
|
-
- @ledgerhq/types-live@6.87.0-nightly.2
|
|
60
|
-
- @ledgerhq/coin-framework@6.7.0-nightly.3
|
|
61
|
-
- @ledgerhq/cryptoassets@13.31.0-nightly.3
|
|
62
|
-
|
|
63
|
-
## 1.9.0-nightly.2
|
|
7
|
+
- [#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
|
|
64
8
|
|
|
65
9
|
### Patch Changes
|
|
66
10
|
|
|
67
|
-
- Updated dependencies [[`c6a676f`](https://github.com/LedgerHQ/ledger-live/commit/c6a676ff80581ac19b896adf44d54812983b72da), [`565da80`](https://github.com/LedgerHQ/ledger-live/commit/565da807b1ebbfc830fd0e47b3d8856f88d410a6)]:
|
|
68
|
-
- @ledgerhq/
|
|
69
|
-
- @ledgerhq/
|
|
11
|
+
- 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)]:
|
|
12
|
+
- @ledgerhq/cryptoassets@13.31.0
|
|
13
|
+
- @ledgerhq/types-live@6.87.0
|
|
14
|
+
- @ledgerhq/coin-framework@6.7.0
|
|
15
|
+
- @ledgerhq/live-env@2.19.0
|
|
16
|
+
- @ledgerhq/live-network@2.0.20
|
|
70
17
|
|
|
71
|
-
## 1.9.0-
|
|
18
|
+
## 1.9.0-next.1
|
|
72
19
|
|
|
73
20
|
### Patch Changes
|
|
74
21
|
|
|
75
|
-
- Updated dependencies [[`
|
|
76
|
-
- @ledgerhq/
|
|
77
|
-
- @ledgerhq/
|
|
78
|
-
- @ledgerhq/
|
|
79
|
-
- @ledgerhq/coin-framework@6.7.0-nightly.1
|
|
80
|
-
- @ledgerhq/live-network@2.0.20-nightly.0
|
|
22
|
+
- Updated dependencies [[`b88faa1`](https://github.com/LedgerHQ/ledger-live/commit/b88faa18e2f5cd309b54fc3157a44db606846cc5)]:
|
|
23
|
+
- @ledgerhq/types-live@6.87.0-next.1
|
|
24
|
+
- @ledgerhq/coin-framework@6.7.0-next.1
|
|
25
|
+
- @ledgerhq/cryptoassets@13.31.0-next.1
|
|
81
26
|
|
|
82
|
-
## 1.9.0-
|
|
27
|
+
## 1.9.0-next.0
|
|
83
28
|
|
|
84
29
|
### Minor Changes
|
|
85
30
|
|
|
@@ -87,10 +32,12 @@
|
|
|
87
32
|
|
|
88
33
|
### Patch Changes
|
|
89
34
|
|
|
90
|
-
- 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)]:
|
|
91
|
-
- @ledgerhq/cryptoassets@13.31.0-
|
|
92
|
-
- @ledgerhq/types-live@6.87.0-
|
|
93
|
-
- @ledgerhq/coin-framework@6.7.0-
|
|
35
|
+
- 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)]:
|
|
36
|
+
- @ledgerhq/cryptoassets@13.31.0-next.0
|
|
37
|
+
- @ledgerhq/types-live@6.87.0-next.0
|
|
38
|
+
- @ledgerhq/coin-framework@6.7.0-next.0
|
|
39
|
+
- @ledgerhq/live-env@2.19.0-next.0
|
|
40
|
+
- @ledgerhq/live-network@2.0.20-next.0
|
|
94
41
|
|
|
95
42
|
## 1.8.3
|
|
96
43
|
|
package/lib/api/api.d.ts
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { ICPRosettaBlockHeightResponse, ICPRosettaGetBalancesResponse, ICPRosettaGetTxnsHistoryResponse } from "../bridge/bridgeHelpers/icpRosetta/types";
|
|
2
|
+
export declare const getICPRosettaNetworkIdentifier: () => {
|
|
3
|
+
network_identifier: {
|
|
4
|
+
blockchain: string;
|
|
5
|
+
network: string;
|
|
6
|
+
};
|
|
7
|
+
};
|
|
8
|
+
export declare const fetchBlockHeight: () => Promise<ICPRosettaBlockHeightResponse>;
|
|
9
|
+
export declare const fetchBalances: (accountId: string) => Promise<ICPRosettaGetBalancesResponse>;
|
|
10
|
+
export declare const fetchTxns: (accountId: string) => Promise<ICPRosettaGetTxnsHistoryResponse>;
|
|
11
|
+
export declare const constructionInvoke: <TRequest, TResponse>(opts: TRequest, method: string) => Promise<TResponse>;
|
|
7
12
|
//# sourceMappingURL=api.d.ts.map
|
package/lib/api/api.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/api/api.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/api/api.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,6BAA6B,EAC7B,6BAA6B,EAC7B,gCAAgC,EACjC,MAAM,0CAA0C,CAAC;AA8BlD,eAAO,MAAM,8BAA8B;;;;;CAO1C,CAAC;AAEF,eAAO,MAAM,gBAAgB,QAAa,QAAQ,6BAA6B,CAM9E,CAAC;AAEF,eAAO,MAAM,aAAa,cAAqB,MAAM,KAAG,QAAQ,6BAA6B,CAU5F,CAAC;AAEF,eAAO,MAAM,SAAS,cAAqB,MAAM,KAAG,QAAQ,gCAAgC,CAU3F,CAAC;AAEF,eAAO,MAAM,kBAAkB,8BACvB,QAAQ,UACN,MAAM,KACb,QAAQ,SAAS,CAQnB,CAAC"}
|
package/lib/api/api.js
CHANGED
|
@@ -3,98 +3,78 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.constructionInvoke = exports.fetchTxns = exports.fetchBalances = exports.fetchBlockHeight = exports.getICPRosettaNetworkIdentifier = void 0;
|
|
7
7
|
const logs_1 = require("@ledgerhq/logs");
|
|
8
|
+
const live_env_1 = require("@ledgerhq/live-env");
|
|
9
|
+
const network_1 = __importDefault(require("@ledgerhq/live-network/network"));
|
|
8
10
|
const consts_1 = require("../consts");
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
const fetchBlockHeight = async () => {
|
|
15
|
-
const canisterId = ledger_live_icp_1.Principal.fromText(consts_1.MAINNET_LEDGER_CANISTER_ID);
|
|
16
|
-
const queryBlocksRawRequest = {
|
|
17
|
-
start: BigInt(0),
|
|
18
|
-
length: BigInt(1),
|
|
19
|
-
};
|
|
20
|
-
const queryBlocksIdlFunc = (0, ledger_live_icp_1.getCanisterIdlFunc)(ledger_live_icp_1.ledgerIdlFactory, "query_blocks");
|
|
21
|
-
const queryBlocksargs = (0, ledger_live_icp_1.encodeCanisterIdlFunc)(queryBlocksIdlFunc, [queryBlocksRawRequest]);
|
|
22
|
-
const agent = await (0, agent_1.getAgent)(consts_1.ICP_NETWORK_URL);
|
|
23
|
-
const blockHeightRes = await agent.query(canisterId, {
|
|
24
|
-
arg: queryBlocksargs,
|
|
25
|
-
methodName: "query_blocks",
|
|
26
|
-
});
|
|
27
|
-
(0, invariant_1.default)(blockHeightRes.status === "replied", "[ICP](fetchBlockHeight) Query failed");
|
|
28
|
-
const decodedIdl = (0, ledger_live_icp_1.decodeCanisterIdlFunc)(queryBlocksIdlFunc, blockHeightRes.reply.arg);
|
|
29
|
-
const decoded = (0, utils_1.fromNullable)(decodedIdl);
|
|
30
|
-
(0, invariant_1.default)(decoded, "[ICP](fetchBlockHeight) Decoding failed");
|
|
31
|
-
return (0, bignumber_js_1.default)(decoded.chain_length.toString());
|
|
11
|
+
const getICPURL = (path) => {
|
|
12
|
+
const baseUrl = (0, live_env_1.getEnv)("API_ICP_ENDPOINT");
|
|
13
|
+
if (!baseUrl)
|
|
14
|
+
throw new Error("API base URL not available");
|
|
15
|
+
return `${baseUrl}${path ? path : ""}`;
|
|
32
16
|
};
|
|
33
|
-
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
const
|
|
37
|
-
body: payload,
|
|
17
|
+
const ICPFetchWrapper = async (path, body) => {
|
|
18
|
+
const url = getICPURL(path);
|
|
19
|
+
// We force data to this way as network func is not using the correct param type. Changing that func will generate errors in other implementations
|
|
20
|
+
const opts = {
|
|
38
21
|
method: "POST",
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
if (
|
|
44
|
-
|
|
22
|
+
data: body,
|
|
23
|
+
url,
|
|
24
|
+
};
|
|
25
|
+
const rawResponse = await (0, network_1.default)(opts);
|
|
26
|
+
if (rawResponse && rawResponse.data && rawResponse.data.details?.error_message) {
|
|
27
|
+
(0, logs_1.log)("error", rawResponse.data.details?.error_message);
|
|
45
28
|
}
|
|
46
|
-
|
|
29
|
+
// We force data to this way as network func is not using the correct param type. Changing that func will generate errors in other implementations
|
|
30
|
+
const { data } = rawResponse;
|
|
31
|
+
(0, logs_1.log)("http", url);
|
|
32
|
+
return data;
|
|
47
33
|
};
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
arg: getBalanceArgs,
|
|
56
|
-
methodName: "get_account_identifier_balance",
|
|
57
|
-
});
|
|
58
|
-
if (balanceRes.status !== "replied") {
|
|
59
|
-
(0, logs_1.log)("debug", `[ICP](fetchBalance) Query failed: ${balanceRes.status}`);
|
|
60
|
-
return (0, bignumber_js_1.default)(0);
|
|
61
|
-
}
|
|
62
|
-
const decodedBalance = (0, ledger_live_icp_1.decodeCanisterIdlFunc)(getBalanceIdlFunc, balanceRes.reply.arg);
|
|
63
|
-
const balance = (0, utils_1.fromNullable)(decodedBalance);
|
|
64
|
-
if (!balance) {
|
|
65
|
-
return (0, bignumber_js_1.default)(0);
|
|
66
|
-
}
|
|
67
|
-
return (0, bignumber_js_1.default)(balance.toString());
|
|
34
|
+
const getICPRosettaNetworkIdentifier = () => {
|
|
35
|
+
return {
|
|
36
|
+
network_identifier: {
|
|
37
|
+
blockchain: consts_1.ICP_BLK_NAME_ROSETTA,
|
|
38
|
+
network: consts_1.ICP_NET_ID_ROSETTA,
|
|
39
|
+
},
|
|
40
|
+
};
|
|
68
41
|
};
|
|
69
|
-
exports.
|
|
70
|
-
const
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
const
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
42
|
+
exports.getICPRosettaNetworkIdentifier = getICPRosettaNetworkIdentifier;
|
|
43
|
+
const fetchBlockHeight = async () => {
|
|
44
|
+
const data = await ICPFetchWrapper("network/status", (0, exports.getICPRosettaNetworkIdentifier)());
|
|
45
|
+
return data;
|
|
46
|
+
};
|
|
47
|
+
exports.fetchBlockHeight = fetchBlockHeight;
|
|
48
|
+
const fetchBalances = async (accountId) => {
|
|
49
|
+
const body = {
|
|
50
|
+
...(0, exports.getICPRosettaNetworkIdentifier)(),
|
|
51
|
+
account_identifier: {
|
|
52
|
+
address: accountId,
|
|
53
|
+
metadata: {},
|
|
54
|
+
},
|
|
80
55
|
};
|
|
81
|
-
const
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
}
|
|
96
|
-
const nextTxns = await (0, exports.fetchTxns)(address, response.Ok.transactions.at(-1)?.id ?? BigInt(0), stopBlockHeight);
|
|
97
|
-
return [...response.Ok.transactions, ...nextTxns];
|
|
56
|
+
const data = await ICPFetchWrapper("account/balance", body);
|
|
57
|
+
return data;
|
|
58
|
+
};
|
|
59
|
+
exports.fetchBalances = fetchBalances;
|
|
60
|
+
const fetchTxns = async (accountId) => {
|
|
61
|
+
const body = {
|
|
62
|
+
...(0, exports.getICPRosettaNetworkIdentifier)(),
|
|
63
|
+
account_identifier: {
|
|
64
|
+
address: accountId,
|
|
65
|
+
metadata: {},
|
|
66
|
+
},
|
|
67
|
+
};
|
|
68
|
+
const data = await ICPFetchWrapper("search/transactions", body);
|
|
69
|
+
return data;
|
|
98
70
|
};
|
|
99
71
|
exports.fetchTxns = fetchTxns;
|
|
72
|
+
const constructionInvoke = async (opts, method) => {
|
|
73
|
+
const body = {
|
|
74
|
+
...opts,
|
|
75
|
+
};
|
|
76
|
+
const data = await ICPFetchWrapper(`construction/${method}`, body);
|
|
77
|
+
return data;
|
|
78
|
+
};
|
|
79
|
+
exports.constructionInvoke = constructionInvoke;
|
|
100
80
|
//# sourceMappingURL=api.js.map
|
package/lib/api/api.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../src/api/api.ts"],"names":[],"mappings":";;;;;;AAAA,yCAAqC;
|
|
1
|
+
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../src/api/api.ts"],"names":[],"mappings":";;;;;;AAAA,yCAAqC;AAErC,iDAA4C;AAC5C,6EAAqD;AACrD,sCAAqE;AAOrE,MAAM,SAAS,GAAG,CAAC,IAAa,EAAU,EAAE;IAC1C,MAAM,OAAO,GAAG,IAAA,iBAAM,EAAC,kBAAkB,CAAC,CAAC;IAC3C,IAAI,CAAC,OAAO;QAAE,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC;IAE5D,OAAO,GAAG,OAAO,GAAG,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;AACzC,CAAC,CAAC;AAEF,MAAM,eAAe,GAAG,KAAK,EAAK,IAAY,EAAE,IAAS,EAAE,EAAE;IAC3D,MAAM,GAAG,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;I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C;AACd,CAAC,CAAC;AAVW,QAAA,aAAa,iBAUxB;AAEK,MAAM,SAAS,GAAG,KAAK,EAAE,SAAiB,EAA6C,EAAE;IAC9F,MAAM,IAAI,GAAG;QACX,GAAG,IAAA,sCAA8B,GAAE;QACnC,kBAAkB,EAAE;YAClB,OAAO,EAAE,SAAS;YAClB,QAAQ,EAAE,EAAE;SACb;KACF,CAAC;IACF,MAAM,IAAI,GAAG,MAAM,eAAe,CAAmC,qBAAqB,EAAE,IAAI,CAAC,CAAC;IAClG,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAVW,QAAA,SAAS,aAUpB;AAEK,MAAM,kBAAkB,GAAG,KAAK,EACrC,IAAc,EACd,MAAc,EACM,EAAE;IACtB,MAAM,IAAI,GAAa;QACrB,GAAG,IAAI;KACR,CAAC;IAEF,MAAM,IAAI,GAAG,MAAM,eAAe,CAAY,gBAAgB,MAAM,EAAE,EAAE,IAAI,CAAC,CAAC;IAE9E,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAXW,QAAA,kBAAkB,sBAW7B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account.d.ts","sourceRoot":"","sources":["../../../src/bridge/bridgeHelpers/account.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2CAA2C,CAAC;
|
|
1
|
+
{"version":3,"file":"account.d.ts","sourceRoot":"","sources":["../../../src/bridge/bridgeHelpers/account.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2CAA2C,CAAC;AAcjF,eAAO,MAAM,eAAe,EAAE,eAmC7B,CAAC"}
|
|
@@ -12,13 +12,13 @@ const consts_1 = require("../../consts");
|
|
|
12
12
|
const operation_1 = require("@ledgerhq/coin-framework/operation");
|
|
13
13
|
const utils_1 = require("../../common-logic/utils");
|
|
14
14
|
const invariant_1 = __importDefault(require("invariant"));
|
|
15
|
-
const
|
|
15
|
+
const icpRosetta_1 = require("./icpRosetta");
|
|
16
16
|
const getAccountShape = async (info) => {
|
|
17
17
|
const { currency, derivationMode, rest = {}, initialAccount } = info;
|
|
18
18
|
const publicKey = reconciliatePublicKey(rest.publicKey, initialAccount);
|
|
19
19
|
(0, invariant_1.default)(publicKey, "publicKey is required");
|
|
20
20
|
// deriving address from public key
|
|
21
|
-
const address = await (0,
|
|
21
|
+
const address = await (0, icpRosetta_1.deriveAddressFromPubkey)(publicKey);
|
|
22
22
|
(0, invariant_1.default)(address, "address is required");
|
|
23
23
|
const accountId = (0, index_1.encodeAccountId)({
|
|
24
24
|
type: "js",
|
|
@@ -29,15 +29,16 @@ const getAccountShape = async (info) => {
|
|
|
29
29
|
});
|
|
30
30
|
// log("debug", `Generation account shape for ${address}`);
|
|
31
31
|
const blockHeight = await (0, api_1.fetchBlockHeight)();
|
|
32
|
-
const
|
|
33
|
-
const
|
|
32
|
+
const balanceResp = await (0, api_1.fetchBalances)(address);
|
|
33
|
+
const balance = balanceResp.balances[0];
|
|
34
|
+
const txns = await (0, api_1.fetchTxns)(address);
|
|
34
35
|
const result = {
|
|
35
36
|
id: accountId,
|
|
36
|
-
balance,
|
|
37
|
-
spendableBalance: balance,
|
|
38
|
-
operations: (0, flatMap_1.default)(txns, mapTxToOps(accountId, address)),
|
|
39
|
-
blockHeight: blockHeight.
|
|
40
|
-
operationsCount:
|
|
37
|
+
balance: (0, bignumber_js_1.default)(balance.value),
|
|
38
|
+
spendableBalance: (0, bignumber_js_1.default)(balance.value),
|
|
39
|
+
operations: (0, flatMap_1.default)(txns.transactions.reverse(), mapTxToOps(accountId, address)),
|
|
40
|
+
blockHeight: blockHeight.current_block_identifier.index,
|
|
41
|
+
operationsCount: txns.transactions.length,
|
|
41
42
|
xpub: publicKey,
|
|
42
43
|
};
|
|
43
44
|
return result;
|
|
@@ -54,56 +55,36 @@ function reconciliatePublicKey(publicKey, initialAccount) {
|
|
|
54
55
|
}
|
|
55
56
|
const mapTxToOps = (accountId, address, fee = consts_1.ICP_FEES) => {
|
|
56
57
|
return (txInfo) => {
|
|
57
|
-
const { transaction: txn } = txInfo;
|
|
58
58
|
const ops = [];
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
hash = (0, ledger_live_icp_1.hashTransaction)({
|
|
75
|
-
from: fromAccount,
|
|
76
|
-
to: toAccount,
|
|
77
|
-
amount: txn.operation.Transfer.amount.e8s,
|
|
78
|
-
fee: txn.operation.Transfer.fee.e8s,
|
|
79
|
-
memo: txn.memo,
|
|
80
|
-
created_at_time: txn.created_at_time[0]?.timestamp_nanos ?? BigInt(0),
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
const blockHeight = Number(txInfo.id);
|
|
84
|
-
const blockHash = "";
|
|
85
|
-
const memo = txInfo.transaction.memo.toString();
|
|
59
|
+
const ownerOperation = txInfo.transaction.operations.find(cur => cur.account.address === address);
|
|
60
|
+
const counterOperation = txInfo.transaction.operations.find(cur => cur.account.address !== address);
|
|
61
|
+
if (!ownerOperation || !counterOperation)
|
|
62
|
+
return ops;
|
|
63
|
+
const timeStamp = txInfo.transaction.metadata.timestamp;
|
|
64
|
+
const amount = (0, bignumber_js_1.default)(ownerOperation.amount.value);
|
|
65
|
+
const hash = txInfo.transaction.transaction_identifier.hash;
|
|
66
|
+
const fromAccount = amount.isPositive()
|
|
67
|
+
? counterOperation.account.address
|
|
68
|
+
: ownerOperation.account.address;
|
|
69
|
+
const toAccount = amount.isNegative()
|
|
70
|
+
? counterOperation.account.address
|
|
71
|
+
: ownerOperation.account.address;
|
|
72
|
+
const memo = txInfo.transaction.metadata.memo.toString();
|
|
73
|
+
const blockHeight = txInfo.transaction.metadata.block_height;
|
|
86
74
|
const date = new Date((0, utils_1.normalizeEpochTimestamp)(timeStamp.toString()));
|
|
87
75
|
const value = amount.abs();
|
|
88
76
|
const feeToUse = (0, bignumber_js_1.default)(fee);
|
|
89
|
-
const isSending =
|
|
90
|
-
const isReceiving =
|
|
91
|
-
let type;
|
|
92
|
-
if (isSending) {
|
|
93
|
-
type = "OUT";
|
|
94
|
-
}
|
|
95
|
-
else {
|
|
96
|
-
type = "IN";
|
|
97
|
-
}
|
|
77
|
+
const isSending = amount.isNegative();
|
|
78
|
+
const isReceiving = amount.isPositive();
|
|
98
79
|
if (isSending) {
|
|
99
80
|
ops.push({
|
|
100
|
-
id: (0, operation_1.encodeOperationId)(accountId, hash,
|
|
81
|
+
id: (0, operation_1.encodeOperationId)(accountId, hash, "OUT"),
|
|
101
82
|
hash,
|
|
102
|
-
type,
|
|
83
|
+
type: "OUT",
|
|
103
84
|
value: value.plus(feeToUse),
|
|
104
85
|
fee: feeToUse,
|
|
105
86
|
blockHeight,
|
|
106
|
-
blockHash,
|
|
87
|
+
blockHash: null,
|
|
107
88
|
accountId,
|
|
108
89
|
senders: [fromAccount],
|
|
109
90
|
recipients: [toAccount],
|
|
@@ -115,13 +96,13 @@ const mapTxToOps = (accountId, address, fee = consts_1.ICP_FEES) => {
|
|
|
115
96
|
}
|
|
116
97
|
if (isReceiving) {
|
|
117
98
|
ops.push({
|
|
118
|
-
id: (0, operation_1.encodeOperationId)(accountId, hash,
|
|
99
|
+
id: (0, operation_1.encodeOperationId)(accountId, hash, "IN"),
|
|
119
100
|
hash,
|
|
120
|
-
type,
|
|
101
|
+
type: "IN",
|
|
121
102
|
value,
|
|
122
103
|
fee: feeToUse,
|
|
123
104
|
blockHeight,
|
|
124
|
-
blockHash,
|
|
105
|
+
blockHash: null,
|
|
125
106
|
accountId,
|
|
126
107
|
senders: [fromAccount],
|
|
127
108
|
recipients: [toAccount],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account.js","sourceRoot":"","sources":["../../../src/bridge/bridgeHelpers/account.ts"],"names":[],"mappings":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K;gBACX,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC;gBAC3B,GAAG,EAAE,QAAQ;gBACb,WAAW;gBACX,SAAS,EAAE,IAAI;gBACf,SAAS;gBACT,OAAO,EAAE,CAAC,WAAW,CAAC;gBACtB,UAAU,EAAE,CAAC,SAAS,CAAC;gBACvB,IAAI;gBACJ,KAAK,EAAE;oBACL,IAAI;iBACL;aACF,CAAC,CAAC;QACL,CAAC;QAED,IAAI,WAAW,EAAE,CAAC;YAChB,GAAG,CAAC,IAAI,CAAC;gBACP,EAAE,EAAE,IAAA,6BAAiB,EAAC,SAAS,EAAE,IAAI,EAAE,IAAI,CAAC;gBAC5C,IAAI;gBACJ,IAAI,EAAE,IAAI;gBACV,KAAK;gBACL,GAAG,EAAE,QAAQ;gBACb,WAAW;gBACX,SAAS,EAAE,IAAI;gBACf,SAAS;gBACT,OAAO,EAAE,CAAC,WAAW,CAAC;gBACtB,UAAU,EAAE,CAAC,SAAS,CAAC;gBACvB,IAAI;gBACJ,KAAK,EAAE;oBACL,IAAI;iBACL;aACF,CAAC,CAAC;QACL,CAAC;QAED,OAAO,GAAG,CAAC;IACb,CAAC,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -3,4 +3,10 @@ export declare const getAddress: (a: Account) => {
|
|
|
3
3
|
address: string;
|
|
4
4
|
derivationPath: string;
|
|
5
5
|
};
|
|
6
|
+
export declare function validateAddress(address: string): Promise<{
|
|
7
|
+
isValid: boolean;
|
|
8
|
+
}>;
|
|
9
|
+
export declare function validateMemo(memo?: string): {
|
|
10
|
+
isValid: boolean;
|
|
11
|
+
};
|
|
6
12
|
//# sourceMappingURL=addresses.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"addresses.d.ts","sourceRoot":"","sources":["../../../src/bridge/bridgeHelpers/addresses.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"addresses.d.ts","sourceRoot":"","sources":["../../../src/bridge/bridgeHelpers/addresses.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAK/C,eAAO,MAAM,UAAU,MAClB,OAAO,KACT;IACD,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,EAAE,MAAM,CAAC;CAC6C,CAAC;AAEvE,wBAAsB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE,CAAC,CASpF;AAED,wBAAgB,YAAY,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE,CAQhE"}
|
|
@@ -1,6 +1,34 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getAddress = void 0;
|
|
6
|
+
exports.validateMemo = exports.validateAddress = exports.getAddress = void 0;
|
|
7
|
+
const logs_1 = require("@ledgerhq/logs");
|
|
8
|
+
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
|
9
|
+
const consts_1 = require("../../consts");
|
|
10
|
+
const api_1 = require("../../api");
|
|
4
11
|
const getAddress = (a) => ({ address: a.freshAddress, derivationPath: a.freshAddressPath });
|
|
5
12
|
exports.getAddress = getAddress;
|
|
13
|
+
async function validateAddress(address) {
|
|
14
|
+
try {
|
|
15
|
+
const res = await (0, api_1.fetchBalances)(address);
|
|
16
|
+
if (!res.balances)
|
|
17
|
+
throw Error(res.details?.error_message);
|
|
18
|
+
return { isValid: true };
|
|
19
|
+
}
|
|
20
|
+
catch (e) {
|
|
21
|
+
(0, logs_1.log)("error", e.message ?? "Failed to validate address");
|
|
22
|
+
return { isValid: false };
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
exports.validateAddress = validateAddress;
|
|
26
|
+
function validateMemo(memo) {
|
|
27
|
+
const res = (0, bignumber_js_1.default)(memo ?? 0);
|
|
28
|
+
if (res.isNaN() || res.lt(0) || res.gt((0, bignumber_js_1.default)(consts_1.MAX_MEMO_VALUE))) {
|
|
29
|
+
return { isValid: false };
|
|
30
|
+
}
|
|
31
|
+
return { isValid: true };
|
|
32
|
+
}
|
|
33
|
+
exports.validateMemo = validateMemo;
|
|
6
34
|
//# sourceMappingURL=addresses.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"addresses.js","sourceRoot":"","sources":["../../../src/bridge/bridgeHelpers/addresses.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"addresses.js","sourceRoot":"","sources":["../../../src/bridge/bridgeHelpers/addresses.ts"],"names":[],"mappings":";;;;;;AAAA,yCAAqC;AAErC,gEAAqC;AACrC,yCAA8C;AAC9C,mCAA0C;AAEnC,MAAM,UAAU,GAAG,CACxB,CAAU,EAIV,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,YAAY,EAAE,cAAc,EAAE,CAAC,CAAC,gBAAgB,EAAE,CAAC,CAAC;AAL1D,QAAA,UAAU,cAKgD;AAEhE,KAAK,UAAU,eAAe,CAAC,OAAe;IACnD,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,MAAM,IAAA,mBAAa,EAAC,OAAO,CAAC,CAAC;QACzC,IAAI,CAAC,GAAG,CAAC,QAAQ;YAAE,MAAM,KAAK,CAAC,GAAG,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC;QAC3D,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IAC3B,CAAC;IAAC,OAAO,CAAM,EAAE,CAAC;QAChB,IAAA,UAAG,EAAC,OAAO,EAAE,CAAC,CAAC,OAAO,IAAI,4BAA4B,CAAC,CAAC;QACxD,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;IAC5B,CAAC;AACH,CAAC;AATD,0CASC;AAED,SAAgB,YAAY,CAAC,IAAa;IACxC,MAAM,GAAG,GAAG,IAAA,sBAAS,EAAC,IAAI,IAAI,CAAC,CAAC,CAAC;IAEjC,IAAI,GAAG,CAAC,KAAK,EAAE,IAAI,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,EAAE,CAAC,IAAA,sBAAS,EAAC,uBAAc,CAAC,CAAC,EAAE,CAAC;QAClE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;IAC5B,CAAC;IAED,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AAC3B,CAAC;AARD,oCAQC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Account } from "@ledgerhq/types-live";
|
|
2
|
+
import { Transaction } from "../../../types";
|
|
3
|
+
import { ICPRosettaConstructionPayloadsResponse } from "./types";
|
|
4
|
+
import { SignerContext } from "@ledgerhq/coin-framework/signer";
|
|
5
|
+
import { ICPSigner } from "../../../types";
|
|
6
|
+
export declare const getUnsignedTransaction: (transaction: Transaction, account: Account) => Promise<{
|
|
7
|
+
unsignedTxn: string;
|
|
8
|
+
payloads: ICPRosettaConstructionPayloadsResponse["payloads"];
|
|
9
|
+
}>;
|
|
10
|
+
export declare const signICPTransaction: ({ signerContext, deviceId, unsignedTxn, path, payloads, pubkey, }: {
|
|
11
|
+
signerContext: SignerContext<ICPSigner>;
|
|
12
|
+
deviceId: string;
|
|
13
|
+
unsignedTxn: string;
|
|
14
|
+
path: string;
|
|
15
|
+
payloads: ICPRosettaConstructionPayloadsResponse["payloads"];
|
|
16
|
+
pubkey: string;
|
|
17
|
+
}) => Promise<{
|
|
18
|
+
signatures: {
|
|
19
|
+
txnSig: string;
|
|
20
|
+
readSig: string;
|
|
21
|
+
};
|
|
22
|
+
signedTxn: string;
|
|
23
|
+
}>;
|
|
24
|
+
export declare const getTxnMetadata: (signedTxn: string) => Promise<{
|
|
25
|
+
hash: string;
|
|
26
|
+
}>;
|
|
27
|
+
export declare const getTxnExpirationDate: (_unsignedTxn: string) => Date;
|
|
28
|
+
export declare const broadcastTxn: (signedTxn: string) => Promise<void>;
|
|
29
|
+
export declare const deriveAddressFromPubkey: (pubkey: string) => Promise<string>;
|
|
30
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/bridge/bridgeHelpers/icpRosetta/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,OAAO,EAML,sCAAsC,EAKvC,MAAM,SAAS,CAAC;AAMjB,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,eAAO,MAAM,sBAAsB,gBACpB,WAAW,WACf,OAAO;iBAEH,MAAM;cACT,sCAAsC,CAAC,UAAU,CAAC;EAwB7D,CAAC;AAEF,eAAO,MAAM,kBAAkB;mBAQd,cAAc,SAAS,CAAC;cAC7B,MAAM;iBACH,MAAM;UACb,MAAM;cACF,sCAAsC,CAAC,UAAU,CAAC;YACpD,MAAM;;gBAEF;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE;eACpC,MAAM;EA8ClB,CAAC;AAEF,eAAO,MAAM,cAAc,cAAqB,MAAM;UAAmB,MAAM;EAS9E,CAAC;AAEF,eAAO,MAAM,oBAAoB,iBAAkB,MAAM,KAAG,IAE3D,CAAC;AAEF,eAAO,MAAM,YAAY,cAAqB,MAAM,kBAKnD,CAAC;AAEF,eAAO,MAAM,uBAAuB,WAAkB,MAAM,oBAa3D,CAAC"}
|