@ledgerhq/coin-canton 0.4.0-nightly.3 → 0.4.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 +21 -34
- package/jest.config.js +0 -1
- package/lib/api/lastBlock.integ.test.js +1 -3
- package/lib/api/lastBlock.integ.test.js.map +1 -1
- package/lib/bridge/signOperation.js +1 -1
- package/lib/bridge/signOperation.js.map +1 -1
- package/lib/common-logic/account/getBalance.d.ts +1 -1
- package/lib/common-logic/account/getBalance.d.ts.map +1 -1
- package/lib/common-logic/account/getBalance.js +5 -21
- package/lib/common-logic/account/getBalance.js.map +1 -1
- package/lib/common-logic/history/lastBlock.d.ts.map +1 -1
- package/lib/common-logic/history/lastBlock.js +1 -7
- package/lib/common-logic/history/lastBlock.js.map +1 -1
- package/lib/common-logic/history/listOperations.d.ts +4 -3
- package/lib/common-logic/history/listOperations.d.ts.map +1 -1
- package/lib/common-logic/history/listOperations.js +41 -43
- package/lib/common-logic/history/listOperations.js.map +1 -1
- package/lib/common-logic/transaction/broadcast.d.ts.map +1 -1
- package/lib/common-logic/transaction/broadcast.js +3 -11
- package/lib/common-logic/transaction/broadcast.js.map +1 -1
- package/lib/common-logic/transaction/combine.d.ts +1 -1
- package/lib/common-logic/transaction/combine.d.ts.map +1 -1
- package/lib/common-logic/transaction/combine.js +3 -6
- package/lib/common-logic/transaction/combine.js.map +1 -1
- package/lib/common-logic/transaction/estimateFees.d.ts.map +1 -1
- package/lib/common-logic/transaction/estimateFees.js +15 -2
- package/lib/common-logic/transaction/estimateFees.js.map +1 -1
- package/lib/common-logic/utils.d.ts +1 -0
- package/lib/common-logic/utils.d.ts.map +1 -1
- package/lib/common-logic/utils.js +6 -1
- package/lib/common-logic/utils.js.map +1 -1
- package/lib/config.d.ts +3 -6
- package/lib/config.d.ts.map +1 -1
- package/lib/config.js.map +1 -1
- package/lib/network/gateway.d.ts +21 -31
- package/lib/network/gateway.d.ts.map +1 -1
- package/lib/network/gateway.integ.test.js +2 -29
- package/lib/network/gateway.integ.test.js.map +1 -1
- package/lib/network/gateway.js +9 -33
- package/lib/network/gateway.js.map +1 -1
- package/lib/network/node.integ.test.js +2 -4
- package/lib/network/node.integ.test.js.map +1 -1
- package/lib/types/bridge.d.ts.map +1 -1
- package/lib-es/api/lastBlock.integ.test.js +1 -3
- package/lib-es/api/lastBlock.integ.test.js.map +1 -1
- package/lib-es/bridge/signOperation.js +1 -1
- package/lib-es/bridge/signOperation.js.map +1 -1
- package/lib-es/common-logic/account/getBalance.d.ts +1 -1
- package/lib-es/common-logic/account/getBalance.d.ts.map +1 -1
- package/lib-es/common-logic/account/getBalance.js +5 -18
- package/lib-es/common-logic/account/getBalance.js.map +1 -1
- package/lib-es/common-logic/history/lastBlock.d.ts.map +1 -1
- package/lib-es/common-logic/history/lastBlock.js +2 -5
- package/lib-es/common-logic/history/lastBlock.js.map +1 -1
- package/lib-es/common-logic/history/listOperations.d.ts +4 -3
- package/lib-es/common-logic/history/listOperations.d.ts.map +1 -1
- package/lib-es/common-logic/history/listOperations.js +41 -40
- package/lib-es/common-logic/history/listOperations.js.map +1 -1
- package/lib-es/common-logic/transaction/broadcast.d.ts.map +1 -1
- package/lib-es/common-logic/transaction/broadcast.js +3 -8
- package/lib-es/common-logic/transaction/broadcast.js.map +1 -1
- package/lib-es/common-logic/transaction/combine.d.ts +1 -1
- package/lib-es/common-logic/transaction/combine.d.ts.map +1 -1
- package/lib-es/common-logic/transaction/combine.js +3 -6
- package/lib-es/common-logic/transaction/combine.js.map +1 -1
- package/lib-es/common-logic/transaction/estimateFees.d.ts.map +1 -1
- package/lib-es/common-logic/transaction/estimateFees.js +15 -2
- package/lib-es/common-logic/transaction/estimateFees.js.map +1 -1
- package/lib-es/common-logic/utils.d.ts +1 -0
- package/lib-es/common-logic/utils.d.ts.map +1 -1
- package/lib-es/common-logic/utils.js +4 -0
- package/lib-es/common-logic/utils.js.map +1 -1
- package/lib-es/config.d.ts +3 -6
- package/lib-es/config.d.ts.map +1 -1
- package/lib-es/config.js.map +1 -1
- package/lib-es/network/gateway.d.ts +21 -31
- package/lib-es/network/gateway.d.ts.map +1 -1
- package/lib-es/network/gateway.integ.test.js +3 -30
- package/lib-es/network/gateway.integ.test.js.map +1 -1
- package/lib-es/network/gateway.js +8 -30
- package/lib-es/network/gateway.js.map +1 -1
- package/lib-es/network/node.integ.test.js +2 -4
- package/lib-es/network/node.integ.test.js.map +1 -1
- package/lib-es/types/bridge.d.ts.map +1 -1
- package/package.json +9 -9
- package/src/api/lastBlock.integ.test.ts +1 -3
- package/src/bridge/signOperation.ts +1 -1
- package/src/common-logic/account/getBalance.ts +5 -20
- package/src/common-logic/history/lastBlock.ts +2 -6
- package/src/common-logic/history/listOperations.ts +52 -43
- package/src/common-logic/transaction/broadcast.ts +3 -7
- package/src/common-logic/transaction/combine.ts +4 -7
- package/src/common-logic/transaction/estimateFees.ts +14 -2
- package/src/common-logic/utils.ts +5 -0
- package/src/config.ts +2 -8
- package/src/network/gateway.integ.test.ts +3 -49
- package/src/network/gateway.ts +27 -67
- package/src/network/node.integ.test.ts +2 -4
- package/src/types/bridge.ts +1 -0
- package/lib/api/getBalance.integ.test.d.ts +0 -2
- package/lib/api/getBalance.integ.test.d.ts.map +0 -1
- package/lib/api/getBalance.integ.test.js +0 -24
- package/lib/api/getBalance.integ.test.js.map +0 -1
- package/lib/api/listOperations.integ.test.d.ts +0 -2
- package/lib/api/listOperations.integ.test.d.ts.map +0 -1
- package/lib/api/listOperations.integ.test.js +0 -23
- package/lib/api/listOperations.integ.test.js.map +0 -1
- package/lib/common-logic/account/getBalance.unit.test.d.ts +0 -2
- package/lib/common-logic/account/getBalance.unit.test.d.ts.map +0 -1
- package/lib/common-logic/account/getBalance.unit.test.js +0 -88
- package/lib/common-logic/account/getBalance.unit.test.js.map +0 -1
- package/lib/common-logic/history/lastBlock.test.d.ts +0 -2
- package/lib/common-logic/history/lastBlock.test.d.ts.map +0 -1
- package/lib/common-logic/history/lastBlock.test.js +0 -43
- package/lib/common-logic/history/lastBlock.test.js.map +0 -1
- package/lib/common-logic/transaction/broadcast.test.d.ts +0 -2
- package/lib/common-logic/transaction/broadcast.test.d.ts.map +0 -1
- package/lib/common-logic/transaction/broadcast.test.js +0 -68
- package/lib/common-logic/transaction/broadcast.test.js.map +0 -1
- package/lib/common-logic/transaction/combine.test.d.ts +0 -2
- package/lib/common-logic/transaction/combine.test.d.ts.map +0 -1
- package/lib/common-logic/transaction/combine.test.js +0 -28
- package/lib/common-logic/transaction/combine.test.js.map +0 -1
- package/lib-es/api/getBalance.integ.test.d.ts +0 -2
- package/lib-es/api/getBalance.integ.test.d.ts.map +0 -1
- package/lib-es/api/getBalance.integ.test.js +0 -22
- package/lib-es/api/getBalance.integ.test.js.map +0 -1
- package/lib-es/api/listOperations.integ.test.d.ts +0 -2
- package/lib-es/api/listOperations.integ.test.d.ts.map +0 -1
- package/lib-es/api/listOperations.integ.test.js +0 -21
- package/lib-es/api/listOperations.integ.test.js.map +0 -1
- package/lib-es/common-logic/account/getBalance.unit.test.d.ts +0 -2
- package/lib-es/common-logic/account/getBalance.unit.test.d.ts.map +0 -1
- package/lib-es/common-logic/account/getBalance.unit.test.js +0 -53
- package/lib-es/common-logic/account/getBalance.unit.test.js.map +0 -1
- package/lib-es/common-logic/history/lastBlock.test.d.ts +0 -2
- package/lib-es/common-logic/history/lastBlock.test.d.ts.map +0 -1
- package/lib-es/common-logic/history/lastBlock.test.js +0 -38
- package/lib-es/common-logic/history/lastBlock.test.js.map +0 -1
- package/lib-es/common-logic/transaction/broadcast.test.d.ts +0 -2
- package/lib-es/common-logic/transaction/broadcast.test.d.ts.map +0 -1
- package/lib-es/common-logic/transaction/broadcast.test.js +0 -33
- package/lib-es/common-logic/transaction/broadcast.test.js.map +0 -1
- package/lib-es/common-logic/transaction/combine.test.d.ts +0 -2
- package/lib-es/common-logic/transaction/combine.test.d.ts.map +0 -1
- package/lib-es/common-logic/transaction/combine.test.js +0 -26
- package/lib-es/common-logic/transaction/combine.test.js.map +0 -1
- package/src/api/getBalance.integ.test.ts +0 -28
- package/src/api/listOperations.integ.test.ts +0 -27
- package/src/common-logic/account/getBalance.unit.test.ts +0 -63
- package/src/common-logic/history/lastBlock.test.ts +0 -47
- package/src/common-logic/transaction/broadcast.test.ts +0 -42
- package/src/common-logic/transaction/combine.test.ts +0 -28
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
|
|
2
|
-
> @ledgerhq/coin-canton@0.4.0
|
|
2
|
+
> @ledgerhq/coin-canton@0.4.0 build /home/runner/work/ledger-live/ledger-live/libs/coin-modules/coin-canton
|
|
3
3
|
> tsc && tsc -m esnext --moduleResolution bundler --outDir lib-es
|
|
4
4
|
|
package/CHANGELOG.md
CHANGED
|
@@ -1,55 +1,42 @@
|
|
|
1
1
|
# @ledgerhq/coin-canton
|
|
2
2
|
|
|
3
|
-
## 0.4.0
|
|
4
|
-
|
|
5
|
-
### Patch Changes
|
|
6
|
-
|
|
7
|
-
- Updated dependencies [[`80a109a`](https://github.com/LedgerHQ/ledger-live/commit/80a109a5f8ecdbb22cf6fb3ec084398a7e54dcfb), [`3489203`](https://github.com/LedgerHQ/ledger-live/commit/34892030dcfbd1a19a0eb0a8fcae9f8f01d3d2a9)]:
|
|
8
|
-
- @ledgerhq/types-live@6.83.0-nightly.1
|
|
9
|
-
- @ledgerhq/coin-framework@6.3.0-nightly.2
|
|
10
|
-
|
|
11
|
-
## 0.4.0-nightly.2
|
|
3
|
+
## 0.4.0
|
|
12
4
|
|
|
13
5
|
### Minor Changes
|
|
14
6
|
|
|
15
|
-
- [#
|
|
16
|
-
|
|
17
|
-
- [#11574](https://github.com/LedgerHQ/ledger-live/pull/11574) [`485bf49`](https://github.com/LedgerHQ/ledger-live/commit/485bf494470d96313fd89c92b8e9a74270acd419) Thanks [@sprohaszka-ledger](https://github.com/sprohaszka-ledger)! - Add Canton combine function
|
|
18
|
-
|
|
19
|
-
### Patch Changes
|
|
20
|
-
|
|
21
|
-
- [#11610](https://github.com/LedgerHQ/ledger-live/pull/11610) [`0dfba50`](https://github.com/LedgerHQ/ledger-live/commit/0dfba503a0e3c4d8ae8e32489499e3174b1741b8) Thanks [@hedi-edelbloute](https://github.com/hedi-edelbloute)! - coin-canton adapt getbalance
|
|
22
|
-
|
|
23
|
-
## 0.4.0-nightly.1
|
|
24
|
-
|
|
25
|
-
### Minor Changes
|
|
26
|
-
|
|
27
|
-
- [#11273](https://github.com/LedgerHQ/ledger-live/pull/11273) [`2482195`](https://github.com/LedgerHQ/ledger-live/commit/24821957c838a304be60ff6e16798ef3cac987cd) Thanks [@estrauser-ledger](https://github.com/estrauser-ledger)! - add cursor to pagintion api
|
|
7
|
+
- [#11509](https://github.com/LedgerHQ/ledger-live/pull/11509) [`12277dc`](https://github.com/LedgerHQ/ledger-live/commit/12277dcb478f24152060e3e11e2eb37d650b5b60) Thanks [@hedi-edelbloute](https://github.com/hedi-edelbloute)! - Canton lastblock + onboarding init
|
|
28
8
|
|
|
29
|
-
- [#
|
|
9
|
+
- [#11454](https://github.com/LedgerHQ/ledger-live/pull/11454) [`212f772`](https://github.com/LedgerHQ/ledger-live/commit/212f772b17dc3db97009ebe62912f8f183c1ef2e) Thanks [@francois-guerin-ledger](https://github.com/francois-guerin-ledger)! - chore(coin-modules): add `eqeqeq` ESLint rule
|
|
30
10
|
|
|
31
11
|
### Patch Changes
|
|
32
12
|
|
|
33
|
-
- Updated dependencies [[`
|
|
34
|
-
- @ledgerhq/
|
|
35
|
-
- @ledgerhq/
|
|
13
|
+
- Updated dependencies [[`12277dc`](https://github.com/LedgerHQ/ledger-live/commit/12277dcb478f24152060e3e11e2eb37d650b5b60), [`acdc089`](https://github.com/LedgerHQ/ledger-live/commit/acdc089f934461dd2fdfdfd61aa907f1520a5d7b), [`87617a9`](https://github.com/LedgerHQ/ledger-live/commit/87617a9930be43a6cdbc5cc5711cc24b00309184), [`9fcc4eb`](https://github.com/LedgerHQ/ledger-live/commit/9fcc4eb5cd6e96e772daa154bd87ae374f925ddc), [`e9fa7aa`](https://github.com/LedgerHQ/ledger-live/commit/e9fa7aa8c8d0414416ec7c12acf30b7623b2eda3), [`d6a6a94`](https://github.com/LedgerHQ/ledger-live/commit/d6a6a949d45fdd2f97f15842c808bf6d1058403f), [`8936f39`](https://github.com/LedgerHQ/ledger-live/commit/8936f390edbe9cbc36ac6590b01562daf5c580e1), [`0356d19`](https://github.com/LedgerHQ/ledger-live/commit/0356d1904dbb5e856970fa7e7ebb206eed7b4c5d), [`516176d`](https://github.com/LedgerHQ/ledger-live/commit/516176d18c7f53961799e92e8804c4a756684266)]:
|
|
14
|
+
- @ledgerhq/cryptoassets@13.27.0
|
|
15
|
+
- @ledgerhq/coin-framework@6.3.0
|
|
16
|
+
- @ledgerhq/live-env@2.15.0
|
|
17
|
+
- @ledgerhq/types-live@6.83.0
|
|
18
|
+
- @ledgerhq/errors@6.25.0
|
|
19
|
+
- @ledgerhq/live-network@2.0.16
|
|
20
|
+
- @ledgerhq/devices@8.5.1
|
|
36
21
|
|
|
37
|
-
## 0.4.0-
|
|
22
|
+
## 0.4.0-next.0
|
|
38
23
|
|
|
39
24
|
### Minor Changes
|
|
40
25
|
|
|
41
26
|
- [#11509](https://github.com/LedgerHQ/ledger-live/pull/11509) [`12277dc`](https://github.com/LedgerHQ/ledger-live/commit/12277dcb478f24152060e3e11e2eb37d650b5b60) Thanks [@hedi-edelbloute](https://github.com/hedi-edelbloute)! - Canton lastblock + onboarding init
|
|
42
27
|
|
|
43
|
-
- [#
|
|
28
|
+
- [#11454](https://github.com/LedgerHQ/ledger-live/pull/11454) [`212f772`](https://github.com/LedgerHQ/ledger-live/commit/212f772b17dc3db97009ebe62912f8f183c1ef2e) Thanks [@francois-guerin-ledger](https://github.com/francois-guerin-ledger)! - chore(coin-modules): add `eqeqeq` ESLint rule
|
|
44
29
|
|
|
45
30
|
### Patch Changes
|
|
46
31
|
|
|
47
|
-
- [
|
|
48
|
-
|
|
49
|
-
-
|
|
50
|
-
- @ledgerhq/
|
|
51
|
-
- @ledgerhq/
|
|
52
|
-
- @ledgerhq/
|
|
32
|
+
- Updated dependencies [[`12277dc`](https://github.com/LedgerHQ/ledger-live/commit/12277dcb478f24152060e3e11e2eb37d650b5b60), [`acdc089`](https://github.com/LedgerHQ/ledger-live/commit/acdc089f934461dd2fdfdfd61aa907f1520a5d7b), [`87617a9`](https://github.com/LedgerHQ/ledger-live/commit/87617a9930be43a6cdbc5cc5711cc24b00309184), [`9fcc4eb`](https://github.com/LedgerHQ/ledger-live/commit/9fcc4eb5cd6e96e772daa154bd87ae374f925ddc), [`e9fa7aa`](https://github.com/LedgerHQ/ledger-live/commit/e9fa7aa8c8d0414416ec7c12acf30b7623b2eda3), [`d6a6a94`](https://github.com/LedgerHQ/ledger-live/commit/d6a6a949d45fdd2f97f15842c808bf6d1058403f), [`8936f39`](https://github.com/LedgerHQ/ledger-live/commit/8936f390edbe9cbc36ac6590b01562daf5c580e1), [`0356d19`](https://github.com/LedgerHQ/ledger-live/commit/0356d1904dbb5e856970fa7e7ebb206eed7b4c5d), [`516176d`](https://github.com/LedgerHQ/ledger-live/commit/516176d18c7f53961799e92e8804c4a756684266)]:
|
|
33
|
+
- @ledgerhq/cryptoassets@13.27.0-next.0
|
|
34
|
+
- @ledgerhq/coin-framework@6.3.0-next.0
|
|
35
|
+
- @ledgerhq/live-env@2.15.0-next.0
|
|
36
|
+
- @ledgerhq/types-live@6.83.0-next.0
|
|
37
|
+
- @ledgerhq/errors@6.25.0-next.0
|
|
38
|
+
- @ledgerhq/live-network@2.0.16-next.0
|
|
39
|
+
- @ledgerhq/devices@8.5.1-next.0
|
|
53
40
|
|
|
54
41
|
## 0.3.0
|
|
55
42
|
|
package/jest.config.js
CHANGED
|
@@ -11,7 +11,6 @@ module.exports = {
|
|
|
11
11
|
"!src/**/*.spec.ts",
|
|
12
12
|
"!src/test/**/*.ts",
|
|
13
13
|
],
|
|
14
|
-
coveragePathIgnorePatterns: ["/types/"],
|
|
15
14
|
coverageReporters: ["json", ["lcov", { file: "lcov.info", projectRoot: "../../../" }], "text"],
|
|
16
15
|
testPathIgnorePatterns: ["lib/", "lib-es/", ".*\\.integ\\.test\\.[tj]s"],
|
|
17
16
|
workerThreads: true,
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const _1 = require(".");
|
|
4
4
|
let api;
|
|
5
|
-
describe
|
|
5
|
+
describe("localnet", () => {
|
|
6
6
|
beforeAll(() => {
|
|
7
7
|
api = (0, _1.createApi)({
|
|
8
8
|
nodeUrl: "http://localhost:2975/v2",
|
|
@@ -21,8 +21,6 @@ describe("devnet", () => {
|
|
|
21
21
|
api = (0, _1.createApi)({
|
|
22
22
|
nodeUrl: "https://wallet-validator-devnet-canton.ledger-test.com/v2",
|
|
23
23
|
networkType: "devnet",
|
|
24
|
-
gatewayUrl: "https://canton-gateway.api.live.ledger-test.com",
|
|
25
|
-
useGateway: true,
|
|
26
24
|
});
|
|
27
25
|
});
|
|
28
26
|
describe("lastBlock", () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lastBlock.integ.test.js","sourceRoot":"","sources":["../../src/api/lastBlock.integ.test.ts"],"names":[],"mappings":";;AACA,wBAA8B;AAG9B,IAAI,GAAc,CAAC;AAEnB,QAAQ,CAAC,
|
|
1
|
+
{"version":3,"file":"lastBlock.integ.test.js","sourceRoot":"","sources":["../../src/api/lastBlock.integ.test.ts"],"names":[],"mappings":";;AACA,wBAA8B;AAG9B,IAAI,GAAc,CAAC;AAEnB,QAAQ,CAAC,UAAU,EAAE,GAAG,EAAE;IACxB,SAAS,CAAC,GAAG,EAAE;QACb,GAAG,GAAG,IAAA,YAAS,EAAC;YACd,OAAO,EAAE,0BAA0B;YACnC,WAAW,EAAE,UAAU;SACY,CAAC,CAAC;IACzC,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,WAAW,EAAE,GAAG,EAAE;QACzB,EAAE,CAAC,0BAA0B,EAAE,KAAK,IAAI,EAAE;YACxC,MAAM,SAAS,GAAG,MAAM,GAAG,CAAC,SAAS,EAAE,CAAC;YACxC,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;QAC9C,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,QAAQ,CAAC,QAAQ,EAAE,GAAG,EAAE;IACtB,SAAS,CAAC,GAAG,EAAE;QACb,GAAG,GAAG,IAAA,YAAS,EAAC;YACd,OAAO,EAAE,2DAA2D;YACpE,WAAW,EAAE,QAAQ;SACtB,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,WAAW,EAAE,GAAG,EAAE;QACzB,EAAE,CAAC,0BAA0B,EAAE,KAAK,IAAI,EAAE;YACxC,MAAM,SAAS,GAAG,MAAM,GAAG,CAAC,SAAS,EAAE,CAAC;YACxC,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;QAC9C,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -28,7 +28,7 @@ const buildSignOperation = (signerContext) => ({ account, deviceId, transaction
|
|
|
28
28
|
fee: fee,
|
|
29
29
|
});
|
|
30
30
|
const transactionSignature = await signer.signTransaction(derivationPath, serializedTransaction);
|
|
31
|
-
return (0, common_logic_1.combine)(serializedTransaction, transactionSignature);
|
|
31
|
+
return (0, common_logic_1.combine)(serializedTransaction, transactionSignature, publicKey);
|
|
32
32
|
});
|
|
33
33
|
o.next({
|
|
34
34
|
type: "device-signature-granted",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signOperation.js","sourceRoot":"","sources":["../../src/bridge/signOperation.ts"],"names":[],"mappings":";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}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getBalance.d.ts","sourceRoot":"","sources":["../../../src/common-logic/account/getBalance.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,oCAAoC,CAAC;
|
|
1
|
+
{"version":3,"file":"getBalance.d.ts","sourceRoot":"","sources":["../../../src/common-logic/account/getBalance.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,oCAAoC,CAAC;AAI7D,wBAAsB,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC,CAGpE"}
|
|
@@ -1,26 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.getBalance = getBalance;
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
return {
|
|
13
|
-
value: BigInt(instrument.amount),
|
|
14
|
-
locked: instrument.locked === true ? BigInt(instrument.amount) : BigInt(0),
|
|
15
|
-
asset: getNativeId() === instrument.instrument_id
|
|
16
|
-
? { type: "native" }
|
|
17
|
-
: { type: "token", assetReference: instrument.instrument_id },
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
async function getBalance(partyId) {
|
|
21
|
-
if (useGateway())
|
|
22
|
-
return (await (0, gateway_1.getBalance)(partyId)).map(instrument => adaptInstrument(instrument));
|
|
23
|
-
else
|
|
24
|
-
throw new Error("Not implemented");
|
|
4
|
+
const node_1 = require("../../network/node");
|
|
5
|
+
// Could be getAccountInfo so it is used in both bridge and api
|
|
6
|
+
async function getBalance(address) {
|
|
7
|
+
const accountInfo = await (0, node_1.getAccountInfo)(address);
|
|
8
|
+
return [{ asset: { type: "native" }, value: BigInt(accountInfo.account_data.Balance) }]; // TODO: add more info like spendableBalance, etc.
|
|
25
9
|
}
|
|
26
10
|
//# sourceMappingURL=getBalance.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getBalance.js","sourceRoot":"","sources":["../../../src/common-logic/account/getBalance.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getBalance.js","sourceRoot":"","sources":["../../../src/common-logic/account/getBalance.ts"],"names":[],"mappings":";;AAIA,gCAGC;AAND,6CAAoD;AAEpD,+DAA+D;AACxD,KAAK,UAAU,UAAU,CAAC,OAAe;IAC9C,MAAM,WAAW,GAAG,MAAM,IAAA,qBAAc,EAAC,OAAO,CAAC,CAAC;IAClD,OAAO,CAAC,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,KAAK,EAAE,MAAM,CAAC,WAAW,CAAC,YAAY,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,kDAAkD;AAC7I,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lastBlock.d.ts","sourceRoot":"","sources":["../../../src/common-logic/history/lastBlock.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oCAAoC,CAAC;
|
|
1
|
+
{"version":3,"file":"lastBlock.d.ts","sourceRoot":"","sources":["../../../src/common-logic/history/lastBlock.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oCAAoC,CAAC;AAGpE,wBAAsB,SAAS,IAAI,OAAO,CAAC,SAAS,CAAC,CAIpD"}
|
|
@@ -1,16 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.lastBlock = lastBlock;
|
|
7
4
|
const node_1 = require("../../network/node");
|
|
8
|
-
const gateway_1 = require("../../network/gateway");
|
|
9
|
-
const config_1 = __importDefault(require("../../config"));
|
|
10
|
-
const useGateway = () => config_1.default.getCoinConfig().useGateway === true;
|
|
11
5
|
async function lastBlock() {
|
|
12
6
|
return {
|
|
13
|
-
height:
|
|
7
|
+
height: await (0, node_1.getLedgerEnd)(),
|
|
14
8
|
};
|
|
15
9
|
}
|
|
16
10
|
//# sourceMappingURL=lastBlock.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lastBlock.js","sourceRoot":"","sources":["../../../src/common-logic/history/lastBlock.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"lastBlock.js","sourceRoot":"","sources":["../../../src/common-logic/history/lastBlock.ts"],"names":[],"mappings":";;AAGA,8BAIC;AAND,6CAAkD;AAE3C,KAAK,UAAU,SAAS;IAC7B,OAAO;QACL,MAAM,EAAE,MAAM,IAAA,mBAAY,GAAE;KAC7B,CAAC;AACJ,CAAC"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import type { Operation, Pagination } from "@ledgerhq/coin-framework/api/index";
|
|
2
2
|
/**
|
|
3
3
|
* Returns list of operations associated to an account.
|
|
4
|
-
* @param
|
|
4
|
+
* @param address Account address
|
|
5
5
|
* @param pagination Pagination options
|
|
6
6
|
* @returns Operations found and the next "id" or "index" to use for pagination (i.e. `start` property).\
|
|
7
|
-
*
|
|
7
|
+
* If `0` is returns, no pagination needed.
|
|
8
|
+
* This "id" or "index" value, thus it has functional meaning, is different for each blockchain.
|
|
8
9
|
*/
|
|
9
|
-
export declare function listOperations(
|
|
10
|
+
export declare function listOperations(address: string, page: Pagination): Promise<[Operation[], string]>;
|
|
10
11
|
//# sourceMappingURL=listOperations.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"listOperations.d.ts","sourceRoot":"","sources":["../../../src/common-logic/history/listOperations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,oCAAoC,CAAC;
|
|
1
|
+
{"version":3,"file":"listOperations.d.ts","sourceRoot":"","sources":["../../../src/common-logic/history/listOperations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,oCAAoC,CAAC;AAIhF;;;;;;;GAOG;AACH,wBAAsB,cAAc,CAClC,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,UAAU,GACf,OAAO,CAAC,CAAC,SAAS,EAAE,EAAE,MAAM,CAAC,CAAC,CAGhC"}
|
|
@@ -1,54 +1,52 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.listOperations = listOperations;
|
|
7
|
-
const
|
|
8
|
-
const config_1 = __importDefault(require("../../config"));
|
|
9
|
-
const getNativeContractId = () => config_1.default.getCoinConfig().nativeInstrumentId !== undefined
|
|
10
|
-
? config_1.default.getCoinConfig().nativeInstrumentId?.split(".")[0]
|
|
11
|
-
: "";
|
|
4
|
+
const indexer_1 = require("../../network/indexer");
|
|
12
5
|
/**
|
|
13
6
|
* Returns list of operations associated to an account.
|
|
14
|
-
* @param
|
|
7
|
+
* @param address Account address
|
|
15
8
|
* @param pagination Pagination options
|
|
16
9
|
* @returns Operations found and the next "id" or "index" to use for pagination (i.e. `start` property).\
|
|
17
|
-
*
|
|
10
|
+
* If `0` is returns, no pagination needed.
|
|
11
|
+
* This "id" or "index" value, thus it has functional meaning, is different for each blockchain.
|
|
18
12
|
*/
|
|
19
|
-
async function listOperations(
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
value: BigInt(0), // to be finalized when details are available on backend
|
|
34
|
-
senders: event.signatories.includes(partyId) ? [partyId] : [],
|
|
35
|
-
recipients: event.signatories.includes(partyId) ? [] : [partyId],
|
|
36
|
-
asset: event.contract_id === getNativeContractId()
|
|
37
|
-
? { type: "native" }
|
|
38
|
-
: { type: "token", assetReference: event.contract_id },
|
|
39
|
-
tx: {
|
|
40
|
-
hash: tx.update_id,
|
|
41
|
-
fees: BigInt(0), // to be finalized when details are available on backend
|
|
42
|
-
date: new Date(tx.record_time.seconds),
|
|
43
|
-
block: {
|
|
44
|
-
height: tx.offset,
|
|
45
|
-
time: new Date(tx.effective_at.seconds),
|
|
46
|
-
},
|
|
47
|
-
},
|
|
48
|
-
});
|
|
49
|
-
}
|
|
13
|
+
async function listOperations(address, page) {
|
|
14
|
+
const transactions = await (0, indexer_1.getTransactions)(address, { from: page.minHeight });
|
|
15
|
+
return [transactions.map(convertToCoreOperation(address)), ""];
|
|
16
|
+
}
|
|
17
|
+
const convertToCoreOperation = (address) => (operation) => {
|
|
18
|
+
const { meta: { delivered_amount }, tx: { Fee, hash, inLedger, date, Account, Destination }, } = operation;
|
|
19
|
+
const type = Account === address ? "OUT" : "IN";
|
|
20
|
+
let value = delivered_amount && typeof delivered_amount === "string"
|
|
21
|
+
? BigInt(delivered_amount)
|
|
22
|
+
: BigInt(0);
|
|
23
|
+
const feeValue = BigInt(Fee);
|
|
24
|
+
if (type === "OUT") {
|
|
25
|
+
if (!Number.isNaN(feeValue)) {
|
|
26
|
+
value = value + feeValue;
|
|
50
27
|
}
|
|
51
28
|
}
|
|
52
|
-
return
|
|
53
|
-
|
|
29
|
+
return {
|
|
30
|
+
/**
|
|
31
|
+
* Note: The operation ID must be concatenated with another
|
|
32
|
+
* value if the transaction hash is not enough to identify it
|
|
33
|
+
*/
|
|
34
|
+
id: hash,
|
|
35
|
+
asset: { type: "native" },
|
|
36
|
+
tx: {
|
|
37
|
+
hash,
|
|
38
|
+
fees: feeValue,
|
|
39
|
+
date: new Date(date),
|
|
40
|
+
block: {
|
|
41
|
+
height: inLedger,
|
|
42
|
+
hash,
|
|
43
|
+
time: new Date(date),
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
type,
|
|
47
|
+
value,
|
|
48
|
+
senders: [Account],
|
|
49
|
+
recipients: [Destination],
|
|
50
|
+
};
|
|
51
|
+
};
|
|
54
52
|
//# sourceMappingURL=listOperations.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"listOperations.js","sourceRoot":"","sources":["../../../src/common-logic/history/listOperations.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"listOperations.js","sourceRoot":"","sources":["../../../src/common-logic/history/listOperations.ts"],"names":[],"mappings":";;AAYA,wCAMC;AAjBD,mDAAwD;AAGxD;;;;;;;GAOG;AACI,KAAK,UAAU,cAAc,CAClC,OAAe,EACf,IAAgB;IAEhB,MAAM,YAAY,GAAG,MAAM,IAAA,yBAAe,EAAC,OAAO,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC;IAC9E,OAAO,CAAC,YAAY,CAAC,GAAG,CAAC,sBAAsB,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;AACjE,CAAC;AAED,MAAM,sBAAsB,GAC1B,CAAC,OAAe,EAAE,EAAE,CACpB,CAAC,SAA+B,EAAa,EAAE;IAC7C,MAAM,EACJ,IAAI,EAAE,EAAE,gBAAgB,EAAE,EAC1B,EAAE,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,GACxD,GAAG,SAAS,CAAC;IAEd,MAAM,IAAI,GAAG,OAAO,KAAK,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;IAChD,IAAI,KAAK,GACP,gBAAgB,IAAI,OAAO,gBAAgB,KAAK,QAAQ;QACtD,CAAC,CAAC,MAAM,CAAC,gBAAgB,CAAC;QAC1B,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IAEhB,MAAM,QAAQ,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;IAC7B,IAAI,IAAI,KAAK,KAAK,EAAE,CAAC;QACnB,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC5B,KAAK,GAAG,KAAK,GAAG,QAAQ,CAAC;QAC3B,CAAC;IACH,CAAC;IAED,OAAO;QACL;;;WAGG;QACH,EAAE,EAAE,IAAI;QACR,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;QACzB,EAAE,EAAE;YACF,IAAI;YACJ,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,IAAI,IAAI,CAAC,IAAI,CAAC;YACpB,KAAK,EAAE;gBACL,MAAM,EAAE,QAAQ;gBAChB,IAAI;gBACJ,IAAI,EAAE,IAAI,IAAI,CAAC,IAAI,CAAC;aACrB;SACF;QACD,IAAI;QACJ,KAAK;QACL,OAAO,EAAE,CAAC,OAAO,CAAC;QAClB,UAAU,EAAE,CAAC,WAAW,CAAC;KAC1B,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"broadcast.d.ts","sourceRoot":"","sources":["../../../src/common-logic/transaction/broadcast.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"broadcast.d.ts","sourceRoot":"","sources":["../../../src/common-logic/transaction/broadcast.ts"],"names":[],"mappings":"AAEA,wBAAsB,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAGjE"}
|
|
@@ -1,17 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.broadcast = broadcast;
|
|
7
|
-
const
|
|
8
|
-
const gateway_1 = require("../../network/gateway");
|
|
9
|
-
const useGateway = () => config_1.default.getCoinConfig().useGateway === true;
|
|
4
|
+
const node_1 = require("../../network/node");
|
|
10
5
|
async function broadcast(signedTx) {
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
return (await (0, gateway_1.submit)(parsed.serialized, parsed.signature)).updateId;
|
|
14
|
-
else
|
|
15
|
-
throw new Error("Not implemented");
|
|
6
|
+
const submittedPayment = await (0, node_1.submit)(signedTx);
|
|
7
|
+
return submittedPayment.tx_hash;
|
|
16
8
|
}
|
|
17
9
|
//# sourceMappingURL=broadcast.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"broadcast.js","sourceRoot":"","sources":["../../../src/common-logic/transaction/broadcast.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"broadcast.js","sourceRoot":"","sources":["../../../src/common-logic/transaction/broadcast.ts"],"names":[],"mappings":";;AAEA,8BAGC;AALD,6CAA4C;AAErC,KAAK,UAAU,SAAS,CAAC,QAAgB;IAC9C,MAAM,gBAAgB,GAAG,MAAM,IAAA,aAAM,EAAC,QAAQ,CAAC,CAAC;IAChD,OAAO,gBAAgB,CAAC,OAAO,CAAC;AAClC,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare function combine(transaction: string, signature: string): string;
|
|
1
|
+
export declare function combine(transaction: string, signature: string, publicKey?: string): string;
|
|
2
2
|
//# sourceMappingURL=combine.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"combine.d.ts","sourceRoot":"","sources":["../../../src/common-logic/transaction/combine.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"combine.d.ts","sourceRoot":"","sources":["../../../src/common-logic/transaction/combine.ts"],"names":[],"mappings":"AAGA,wBAAgB,OAAO,CAAC,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAE1F"}
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.combine = combine;
|
|
4
|
+
const utils_1 = require("../utils");
|
|
4
5
|
// Combines signature with raw transaction
|
|
5
|
-
function combine(transaction, signature) {
|
|
6
|
-
|
|
7
|
-
return JSON.stringify({
|
|
8
|
-
...tx,
|
|
9
|
-
signature,
|
|
10
|
-
});
|
|
6
|
+
function combine(transaction, signature, publicKey) {
|
|
7
|
+
return (0, utils_1.encode)(transaction, signature, publicKey || "");
|
|
11
8
|
}
|
|
12
9
|
//# sourceMappingURL=combine.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"combine.js","sourceRoot":"","sources":["../../../src/common-logic/transaction/combine.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"combine.js","sourceRoot":"","sources":["../../../src/common-logic/transaction/combine.ts"],"names":[],"mappings":";;AAGA,0BAEC;AALD,oCAAkC;AAElC,0CAA0C;AAC1C,SAAgB,OAAO,CAAC,WAAmB,EAAE,SAAiB,EAAE,SAAkB;IAChF,OAAO,IAAA,cAAM,EAAC,WAAW,EAAE,SAAS,EAAE,SAAS,IAAI,EAAE,CAAC,CAAC;AACzD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"estimateFees.d.ts","sourceRoot":"","sources":["../../../src/common-logic/transaction/estimateFees.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"estimateFees.d.ts","sourceRoot":"","sources":["../../../src/common-logic/transaction/estimateFees.ts"],"names":[],"mappings":"AAGA,wBAAsB,YAAY,CAAC,qBAAqB,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAYjF"}
|
|
@@ -1,8 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.estimateFees = estimateFees;
|
|
4
|
-
|
|
4
|
+
const node_1 = require("../../network/node");
|
|
5
|
+
const errors_1 = require("../../types/errors");
|
|
5
6
|
async function estimateFees(serializedTransaction) {
|
|
6
|
-
|
|
7
|
+
try {
|
|
8
|
+
// We call the node to do a dry run and estimate fees
|
|
9
|
+
return BigInt(await (0, node_1.simulate)(serializedTransaction));
|
|
10
|
+
}
|
|
11
|
+
catch (e) {
|
|
12
|
+
// default value is required in case of simulation error, else user will encounter an error in the flow
|
|
13
|
+
if (e instanceof errors_1.SimulationError) {
|
|
14
|
+
return BigInt(1000);
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
throw new Error("Unexpected error while estimating fees.");
|
|
18
|
+
}
|
|
19
|
+
}
|
|
7
20
|
}
|
|
8
21
|
//# sourceMappingURL=estimateFees.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"estimateFees.js","sourceRoot":"","sources":["../../../src/common-logic/transaction/estimateFees.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"estimateFees.js","sourceRoot":"","sources":["../../../src/common-logic/transaction/estimateFees.ts"],"names":[],"mappings":";;AAGA,oCAYC;AAfD,6CAA8C;AAC9C,+CAAqD;AAE9C,KAAK,UAAU,YAAY,CAAC,qBAA6B;IAC9D,IAAI,CAAC;QACH,qDAAqD;QACrD,OAAO,MAAM,CAAC,MAAM,IAAA,eAAQ,EAAC,qBAAqB,CAAC,CAAC,CAAC;IACvD,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,uGAAuG;QACvG,IAAI,CAAC,YAAY,wBAAe,EAAE,CAAC;YACjC,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC;QACtB,CAAC;aAAM,CAAC;YACN,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAC;QAC7D,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -2,4 +2,5 @@ import BigNumber from "bignumber.js";
|
|
|
2
2
|
export declare const UINT32_MAX: BigNumber;
|
|
3
3
|
export declare const validateTag: (tag: BigNumber) => boolean;
|
|
4
4
|
export declare function isRecipientValid(recipient: string): boolean;
|
|
5
|
+
export declare const encode: (transaction: string, signature: string, publicKey?: string) => string;
|
|
5
6
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/common-logic/utils.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,cAAc,CAAC;AAErC,eAAO,MAAM,UAAU,WAAoC,CAAC;AAE5D,eAAO,MAAM,WAAW,GAAI,KAAK,SAAS,YAIzC,CAAC;AAEF,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAE3D"}
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/common-logic/utils.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,cAAc,CAAC;AAErC,eAAO,MAAM,UAAU,WAAoC,CAAC;AAE5D,eAAO,MAAM,WAAW,GAAI,KAAK,SAAS,YAIzC,CAAC;AAEF,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAE3D;AAED,eAAO,MAAM,MAAM,GAAI,aAAa,MAAM,EAAE,WAAW,MAAM,EAAE,YAAY,MAAM,WAGhF,CAAC"}
|
|
@@ -3,7 +3,7 @@ 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.validateTag = exports.UINT32_MAX = void 0;
|
|
6
|
+
exports.encode = exports.validateTag = exports.UINT32_MAX = void 0;
|
|
7
7
|
exports.isRecipientValid = isRecipientValid;
|
|
8
8
|
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
|
9
9
|
exports.UINT32_MAX = new bignumber_js_1.default(2).pow(32).minus(1);
|
|
@@ -14,4 +14,9 @@ exports.validateTag = validateTag;
|
|
|
14
14
|
function isRecipientValid(recipient) {
|
|
15
15
|
return recipient.length > 0;
|
|
16
16
|
}
|
|
17
|
+
const encode = (transaction, signature, publicKey) => {
|
|
18
|
+
// sample encoding
|
|
19
|
+
return `${transaction}${publicKey}${signature}encodedTx`;
|
|
20
|
+
};
|
|
21
|
+
exports.encode = encode;
|
|
17
22
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/common-logic/utils.ts"],"names":[],"mappings":";;;;;;AAUA,4CAEC;AAZD,gEAAqC;AAExB,QAAA,UAAU,GAAG,IAAI,sBAAS,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AAErD,MAAM,WAAW,GAAG,CAAC,GAAc,EAAE,EAAE;IAC5C,OAAO,CACL,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,GAAG,CAAC,QAAQ,EAAE,IAAI,GAAG,CAAC,SAAS,EAAE,IAAI,GAAG,CAAC,UAAU,EAAE,IAAI,GAAG,CAAC,GAAG,CAAC,kBAAU,CAAC,CAC7F,CAAC;AACJ,CAAC,CAAC;AAJW,QAAA,WAAW,eAItB;AAEF,SAAgB,gBAAgB,CAAC,SAAiB;IAChD,OAAO,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC;AAC9B,CAAC"}
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/common-logic/utils.ts"],"names":[],"mappings":";;;;;;AAUA,4CAEC;AAZD,gEAAqC;AAExB,QAAA,UAAU,GAAG,IAAI,sBAAS,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AAErD,MAAM,WAAW,GAAG,CAAC,GAAc,EAAE,EAAE;IAC5C,OAAO,CACL,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,GAAG,CAAC,QAAQ,EAAE,IAAI,GAAG,CAAC,SAAS,EAAE,IAAI,GAAG,CAAC,UAAU,EAAE,IAAI,GAAG,CAAC,GAAG,CAAC,kBAAU,CAAC,CAC7F,CAAC;AACJ,CAAC,CAAC;AAJW,QAAA,WAAW,eAItB;AAEF,SAAgB,gBAAgB,CAAC,SAAiB;IAChD,OAAO,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC;AAC9B,CAAC;AAEM,MAAM,MAAM,GAAG,CAAC,WAAmB,EAAE,SAAiB,EAAE,SAAkB,EAAE,EAAE;IACnF,kBAAkB;IAClB,OAAO,GAAG,WAAW,GAAG,SAAS,GAAG,SAAS,WAAW,CAAC;AAC3D,CAAC,CAAC;AAHW,QAAA,MAAM,UAGjB"}
|
package/lib/config.d.ts
CHANGED
|
@@ -1,18 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { CryptoCurrency } from "@ledgerhq/types-cryptoassets";
|
|
1
|
+
import { type CurrencyConfig } from "@ledgerhq/coin-framework/config";
|
|
3
2
|
export type CantonConfig = {
|
|
4
3
|
nodeUrl?: string;
|
|
5
|
-
nodeId?: string;
|
|
6
4
|
gatewayUrl?: string;
|
|
7
5
|
minReserve?: number;
|
|
8
6
|
networkType: "mainnet" | "devnet" | "localnet";
|
|
9
7
|
useGateway?: boolean;
|
|
10
|
-
nativeInstrumentId?: string;
|
|
11
8
|
};
|
|
12
9
|
export type CantonCoinConfig = CurrencyConfig & CantonConfig;
|
|
13
10
|
declare const coinConfig: {
|
|
14
|
-
setCoinConfig: (config: CoinConfig<CantonCoinConfig>) => void;
|
|
15
|
-
getCoinConfig: (currency?: CryptoCurrency) => CantonCoinConfig;
|
|
11
|
+
setCoinConfig: (config: import("@ledgerhq/coin-framework/config").CoinConfig<CantonCoinConfig>) => void;
|
|
12
|
+
getCoinConfig: (currency?: import("@ledgerhq/types-cryptoassets").CryptoCurrency) => CantonCoinConfig;
|
|
16
13
|
};
|
|
17
14
|
export default coinConfig;
|
|
18
15
|
//# sourceMappingURL=config.d.ts.map
|
package/lib/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAwB,EAAE,
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAwB,EAAE,KAAK,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAEvF,MAAM,MAAM,YAAY,GAAG;IACzB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,SAAS,GAAG,QAAQ,GAAG,UAAU,CAAC;IAC/C,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG,cAAc,GAAG,YAAY,CAAC;AAE7D,QAAA,MAAM,UAAU;;;CAAsC,CAAC;AAEvD,eAAe,UAAU,CAAC"}
|
package/lib/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":";;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":";;;;;AAAA,6EAAuF;AAavF,MAAM,UAAU,GAAG,IAAA,gBAAe,GAAoB,CAAC;AAEvD,kBAAe,UAAU,CAAC"}
|