@ledgerhq/coin-tester-bitcoin 1.1.0-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.
Files changed (81) hide show
  1. package/.env.example +7 -0
  2. package/.eslintrc.js +23 -0
  3. package/.turbo/turbo-build.log +4 -0
  4. package/.unimportedrc.json +8 -0
  5. package/CHANGELOG.md +18 -0
  6. package/LICENSE.txt +21 -0
  7. package/README.md +30 -0
  8. package/jest.config.ts +19 -0
  9. package/lib/src/assert.d.ts +6 -0
  10. package/lib/src/assert.d.ts.map +1 -0
  11. package/lib/src/assert.js +29 -0
  12. package/lib/src/assert.js.map +1 -0
  13. package/lib/src/atlas.d.ts +3 -0
  14. package/lib/src/atlas.d.ts.map +1 -0
  15. package/lib/src/atlas.js +84 -0
  16. package/lib/src/atlas.js.map +1 -0
  17. package/lib/src/constants.d.ts +5 -0
  18. package/lib/src/constants.d.ts.map +1 -0
  19. package/lib/src/constants.js +5 -0
  20. package/lib/src/constants.js.map +1 -0
  21. package/lib/src/fixtures.d.ts +5 -0
  22. package/lib/src/fixtures.d.ts.map +1 -0
  23. package/lib/src/fixtures.js +61 -0
  24. package/lib/src/fixtures.js.map +1 -0
  25. package/lib/src/helpers.d.ts +11 -0
  26. package/lib/src/helpers.d.ts.map +1 -0
  27. package/lib/src/helpers.js +339 -0
  28. package/lib/src/helpers.js.map +1 -0
  29. package/lib/src/scenarii/bitcoin.d.ts +4 -0
  30. package/lib/src/scenarii/bitcoin.d.ts.map +1 -0
  31. package/lib/src/scenarii/bitcoin.js +258 -0
  32. package/lib/src/scenarii/bitcoin.js.map +1 -0
  33. package/lib/src/utils.d.ts +5 -0
  34. package/lib/src/utils.d.ts.map +1 -0
  35. package/lib/src/utils.js +48 -0
  36. package/lib/src/utils.js.map +1 -0
  37. package/lib/tsconfig.tsbuildinfo +1 -0
  38. package/lib-es/src/assert.d.ts +6 -0
  39. package/lib-es/src/assert.d.ts.map +1 -0
  40. package/lib-es/src/assert.js +23 -0
  41. package/lib-es/src/assert.js.map +1 -0
  42. package/lib-es/src/atlas.d.ts +3 -0
  43. package/lib-es/src/atlas.d.ts.map +1 -0
  44. package/lib-es/src/atlas.js +43 -0
  45. package/lib-es/src/atlas.js.map +1 -0
  46. package/lib-es/src/constants.d.ts +5 -0
  47. package/lib-es/src/constants.d.ts.map +1 -0
  48. package/lib-es/src/constants.js +2 -0
  49. package/lib-es/src/constants.js.map +1 -0
  50. package/lib-es/src/fixtures.d.ts +5 -0
  51. package/lib-es/src/fixtures.d.ts.map +1 -0
  52. package/lib-es/src/fixtures.js +54 -0
  53. package/lib-es/src/fixtures.js.map +1 -0
  54. package/lib-es/src/helpers.d.ts +11 -0
  55. package/lib-es/src/helpers.d.ts.map +1 -0
  56. package/lib-es/src/helpers.js +323 -0
  57. package/lib-es/src/helpers.js.map +1 -0
  58. package/lib-es/src/scenarii/bitcoin.d.ts +4 -0
  59. package/lib-es/src/scenarii/bitcoin.d.ts.map +1 -0
  60. package/lib-es/src/scenarii/bitcoin.js +252 -0
  61. package/lib-es/src/scenarii/bitcoin.js.map +1 -0
  62. package/lib-es/src/utils.d.ts +5 -0
  63. package/lib-es/src/utils.d.ts.map +1 -0
  64. package/lib-es/src/utils.js +40 -0
  65. package/lib-es/src/utils.js.map +1 -0
  66. package/lib-es/tsconfig.tsbuildinfo +1 -0
  67. package/package.json +83 -0
  68. package/src/assert.ts +34 -0
  69. package/src/atlas.ts +52 -0
  70. package/src/constants.ts +1 -0
  71. package/src/docker/atlas/bitcoin.conf +56 -0
  72. package/src/docker/atlas/pending.conf +36 -0
  73. package/src/docker/docker-compose.yml +76 -0
  74. package/src/docker/nginx/default.conf +31 -0
  75. package/src/docker/postgres/create-db.sh +9 -0
  76. package/src/fixtures.ts +66 -0
  77. package/src/helpers.ts +372 -0
  78. package/src/scenarii/bitcoin.ts +306 -0
  79. package/src/scenarii.test.ts +27 -0
  80. package/src/utils.ts +52 -0
  81. package/tsconfig.json +14 -0
package/.env.example ADDED
@@ -0,0 +1,7 @@
1
+ # development seed. geenrated with https://iancoleman.io/bip39/
2
+ SEED=chronic find success crew board merit elder life achieve scout gravity soul brief pen job
3
+ # has to be a token classic
4
+ GH_TOKEN=gh_token
5
+ SPECULOS_API_PORT=4040
6
+ # Only needed if you are on a apple chip
7
+ SPECULOS_IMAGE=speculos
package/.eslintrc.js ADDED
@@ -0,0 +1,23 @@
1
+ module.exports = {
2
+ env: {
3
+ browser: true,
4
+ es6: true,
5
+ },
6
+ rules: {
7
+ "no-console": ["error", { allow: ["warn", "error"] }],
8
+ "@typescript-eslint/no-empty-function": "off",
9
+ "@typescript-eslint/no-explicit-any": "warn",
10
+ },
11
+ overrides: [
12
+ {
13
+ files: ["src/*.{ts,tsx}"],
14
+ env: {
15
+ "jest/globals": true,
16
+ },
17
+ plugins: ["jest"],
18
+ rules: {
19
+ "no-console": "off",
20
+ },
21
+ },
22
+ ],
23
+ };
@@ -0,0 +1,4 @@
1
+
2
+ > @ledgerhq/coin-tester-bitcoin@1.0.0 build /home/runner/work/ledger-live/ledger-live/libs/coin-tester-modules/coin-tester-bitcoin
3
+ > tsc && tsc -m esnext --moduleResolution bundler --outDir lib-es
4
+
@@ -0,0 +1,8 @@
1
+ {
2
+ "ignoreUnresolved": [
3
+ "ansi-styles",
4
+ "supports-color"
5
+ ],
6
+ "ignoreUnused": [],
7
+ "ignoreUnimported": []
8
+ }
package/CHANGELOG.md ADDED
@@ -0,0 +1,18 @@
1
+ # @ledgerhq/coin-tester-bitcoin
2
+
3
+ ## 1.1.0-nightly.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#12316](https://github.com/LedgerHQ/ledger-live/pull/12316) [`ccf788d`](https://github.com/LedgerHQ/ledger-live/commit/ccf788d7c0239ca95e76c3cc340f9a6bd09ea726) Thanks [@qperrot](https://github.com/qperrot)! - Feature CoinTester Bitcoin and Currency regtest
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies [[`ccf788d`](https://github.com/LedgerHQ/ledger-live/commit/ccf788d7c0239ca95e76c3cc340f9a6bd09ea726), [`34b28dd`](https://github.com/LedgerHQ/ledger-live/commit/34b28dd5e819906daaa79db5fe6064674def5e7d), [`b962966`](https://github.com/LedgerHQ/ledger-live/commit/b962966525517c5cfa7f1f8826f8f2b9162189e4)]:
12
+ - @ledgerhq/cryptoassets@13.32.0-nightly.2
13
+ - @ledgerhq/hw-app-btc@10.12.0-nightly.3
14
+ - @ledgerhq/coin-bitcoin@0.24.0-nightly.4
15
+ - @ledgerhq/coin-framework@6.8.0-nightly.4
16
+ - @ledgerhq/coin-tester@0.11.0-nightly.2
17
+ - @ledgerhq/types-live@6.88.0-nightly.2
18
+ - @ledgerhq/live-network@2.1.0-nightly.1
package/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License
2
+
3
+ Copyright (c) 2017-present Ledger https://www.ledger.com/
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,30 @@
1
+ # @ledgerhq/coin-tester-bitcoin
2
+
3
+ This package contains the deterministic testing infrastructure for Bitcoin in Ledger Live.
4
+
5
+ ## Features
6
+
7
+ - Deterministic testing scenarios for Bitcoin
8
+ - Integration with Speculos for hardware wallet simulation
9
+ - Integration with Atlas for local blockchain simulation
10
+
11
+ ## Usage
12
+
13
+ ```typescript
14
+ import { executeScenario } from "@ledgerhq/coin-tester/main";
15
+ import { scenarioBitcoin } from "@ledgerhq/coin-tester-bitcoin";
16
+
17
+ // Run a test scenario
18
+ await executeScenario(scenarioBitcoin);
19
+ ```
20
+
21
+ ## Development
22
+
23
+ 1. Set up your environment variables in `.env` (see `.env.example`)
24
+ 2. Set Up an OCI client token for `bbs-oci-prod-green` repository on https://jfrog.ledgerlabs.net
25
+ 3. Run the tests with `pnpm start`
26
+
27
+ ## Dependencies
28
+
29
+ - @ledgerhq/coin-tester
30
+ - @ledgerhq/coin-bitcoin
package/jest.config.ts ADDED
@@ -0,0 +1,19 @@
1
+ import type { Config } from "jest";
2
+
3
+ const config: Config = {
4
+ preset: "ts-jest",
5
+ testEnvironment: "node",
6
+ transform: {
7
+ "^.+\\.tsx?$": [
8
+ "ts-jest",
9
+ {
10
+ tsconfig: "tsconfig.json",
11
+ },
12
+ ],
13
+ },
14
+ moduleFileExtensions: ["ts", "tsx", "js", "jsx", "json", "node"],
15
+ testMatch: ["**/__tests__/**/*.[jt]s?(x)", "**/?(*.)+(spec|test).[jt]s?(x)"],
16
+ setupFilesAfterEnv: ["dotenv/config"],
17
+ };
18
+
19
+ export default config;
@@ -0,0 +1,6 @@
1
+ import { BitcoinAccount } from "@ledgerhq/coin-bitcoin/types";
2
+ export declare function assertCommonTxProperties(prev: BitcoinAccount, curr: BitcoinAccount): import("@ledgerhq/types-live").Operation;
3
+ export declare function assertUtxoExcluded(account: BitcoinAccount, hash: string, outputIndex: number): void;
4
+ export declare function assertUtxoSpent(prev: BitcoinAccount, curr: BitcoinAccount, hash: string, outputIndex: number): void;
5
+ export declare function getNewChangeUtxos(prev: BitcoinAccount, curr: BitcoinAccount): import("@ledgerhq/coin-bitcoin/types").BitcoinOutput[];
6
+ //# sourceMappingURL=assert.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assert.d.ts","sourceRoot":"","sources":["../../src/assert.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAG9D,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE,cAAc,4CAMlF;AAED,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,QAI5F;AAED,wBAAgB,eAAe,CAC7B,IAAI,EAAE,cAAc,EACpB,IAAI,EAAE,cAAc,EACpB,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,MAAM,QAMpB;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE,cAAc,0DAI3E"}
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.assertCommonTxProperties = assertCommonTxProperties;
4
+ exports.assertUtxoExcluded = assertUtxoExcluded;
5
+ exports.assertUtxoSpent = assertUtxoSpent;
6
+ exports.getNewChangeUtxos = getNewChangeUtxos;
7
+ const utils_1 = require("./utils");
8
+ function assertCommonTxProperties(prev, curr) {
9
+ const [latestOperation] = curr.operations;
10
+ expect(curr.operations.length - prev.operations.length).toBe(1);
11
+ expect(latestOperation.type).toBe("OUT");
12
+ expect(curr.balance.toFixed()).toBe(prev.balance.minus(latestOperation.value).toFixed());
13
+ return latestOperation;
14
+ }
15
+ function assertUtxoExcluded(account, hash, outputIndex) {
16
+ const utxo = (0, utils_1.findUtxo)(account, hash, outputIndex);
17
+ expect(utxo).toBeDefined();
18
+ expect(utxo.isChange).toBe(false);
19
+ }
20
+ function assertUtxoSpent(prev, curr, hash, outputIndex) {
21
+ const wasThere = (0, utils_1.findUtxo)(prev, hash, outputIndex);
22
+ const stillThere = (0, utils_1.findUtxo)(curr, hash, outputIndex);
23
+ expect(wasThere).toBeDefined();
24
+ expect(stillThere).toBeUndefined();
25
+ }
26
+ function getNewChangeUtxos(prev, curr) {
27
+ return curr.bitcoinResources.utxos.filter(utxo => !(0, utils_1.findUtxo)(prev, utxo.hash, utxo.outputIndex) && utxo.isChange);
28
+ }
29
+ //# sourceMappingURL=assert.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assert.js","sourceRoot":"","sources":["../../src/assert.ts"],"names":[],"mappings":";;AAGA,4DAMC;AAED,gDAIC;AAED,0CAUC;AAED,8CAIC;AAhCD,mCAAmC;AAEnC,SAAgB,wBAAwB,CAAC,IAAoB,EAAE,IAAoB;IACjF,MAAM,CAAC,eAAe,CAAC,GAAG,IAAI,CAAC,UAAU,CAAC;IAC1C,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAChE,MAAM,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACzC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;IACzF,OAAO,eAAe,CAAC;AACzB,CAAC;AAED,SAAgB,kBAAkB,CAAC,OAAuB,EAAE,IAAY,EAAE,WAAmB;IAC3F,MAAM,IAAI,GAAG,IAAA,gBAAQ,EAAC,OAAO,EAAE,IAAI,EAAE,WAAW,CAAC,CAAC;IAClD,MAAM,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,CAAC;IAC3B,MAAM,CAAC,IAAK,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AACrC,CAAC;AAED,SAAgB,eAAe,CAC7B,IAAoB,EACpB,IAAoB,EACpB,IAAY,EACZ,WAAmB;IAEnB,MAAM,QAAQ,GAAG,IAAA,gBAAQ,EAAC,IAAI,EAAE,IAAI,EAAE,WAAW,CAAC,CAAC;IACnD,MAAM,UAAU,GAAG,IAAA,gBAAQ,EAAC,IAAI,EAAE,IAAI,EAAE,WAAW,CAAC,CAAC;IACrD,MAAM,CAAC,QAAQ,CAAC,CAAC,WAAW,EAAE,CAAC;IAC/B,MAAM,CAAC,UAAU,CAAC,CAAC,aAAa,EAAE,CAAC;AACrC,CAAC;AAED,SAAgB,iBAAiB,CAAC,IAAoB,EAAE,IAAoB;IAC1E,OAAO,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,MAAM,CACvC,IAAI,CAAC,EAAE,CAAC,CAAC,IAAA,gBAAQ,EAAC,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,IAAI,CAAC,QAAQ,CACtE,CAAC;AACJ,CAAC"}
@@ -0,0 +1,3 @@
1
+ export declare const spawnAtlas: () => Promise<void>;
2
+ export declare const killAtlas: () => Promise<void>;
3
+ //# sourceMappingURL=atlas.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"atlas.d.ts","sourceRoot":"","sources":["../../src/atlas.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,UAAU,QAAa,OAAO,CAAC,IAAI,CA6B/C,CAAC;AAEF,eAAO,MAAM,SAAS,QAAa,OAAO,CAAC,IAAI,CAQ9C,CAAC"}
@@ -0,0 +1,84 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ var __importDefault = (this && this.__importDefault) || function (mod) {
36
+ return (mod && mod.__esModule) ? mod : { "default": mod };
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.killAtlas = exports.spawnAtlas = void 0;
40
+ const chalk_1 = __importDefault(require("chalk"));
41
+ const compose = __importStar(require("docker-compose"));
42
+ const speculos_1 = require("@ledgerhq/coin-tester/lib/signers/speculos");
43
+ const cwd = `${__dirname}/docker`;
44
+ const spawnAtlas = async () => {
45
+ (0, speculos_1.ensureEnv)();
46
+ console.log("Starting atlas...");
47
+ await compose.upAll({
48
+ cwd,
49
+ log: Boolean(process.env.DEBUG),
50
+ env: {
51
+ ...process.env,
52
+ },
53
+ });
54
+ const checkAtlasLogs = async () => {
55
+ const { out } = await compose.logs("atlas", {
56
+ cwd,
57
+ env: {
58
+ ...process.env,
59
+ },
60
+ });
61
+ if (out.includes("Started Atlas Bitcoin")) {
62
+ console.log(chalk_1.default.bgBlueBright(" - ATLAS READY ✅ - "));
63
+ return;
64
+ }
65
+ await (0, speculos_1.delay)(200);
66
+ return checkAtlasLogs();
67
+ };
68
+ await checkAtlasLogs();
69
+ };
70
+ exports.spawnAtlas = spawnAtlas;
71
+ const killAtlas = async () => {
72
+ console.log("Stopping atlas...");
73
+ await compose.down({
74
+ cwd,
75
+ log: Boolean(process.env.DEBUG),
76
+ env: process.env,
77
+ commandOptions: ["--remove-orphans", "-v"],
78
+ });
79
+ };
80
+ exports.killAtlas = killAtlas;
81
+ ["exit", "SIGINT", "SIGQUIT", "SIGTERM", "SIGUSR1", "SIGUSR2", "uncaughtException"].map(e => process.on(e, async () => {
82
+ await Promise.all([(0, exports.killAtlas)(), (0, speculos_1.killSpeculos)()]);
83
+ }));
84
+ //# sourceMappingURL=atlas.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"atlas.js","sourceRoot":"","sources":["../../src/atlas.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kDAA0B;AAC1B,wDAA0C;AAC1C,yEAA4F;AAE5F,MAAM,GAAG,GAAG,GAAG,SAAS,SAAS,CAAC;AAE3B,MAAM,UAAU,GAAG,KAAK,IAAmB,EAAE;IAClD,IAAA,oBAAS,GAAE,CAAC;IACZ,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;IACjC,MAAM,OAAO,CAAC,KAAK,CAAC;QAClB,GAAG;QACH,GAAG,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC;QAC/B,GAAG,EAAE;YACH,GAAG,OAAO,CAAC,GAAG;SACf;KACF,CAAC,CAAC;IAEH,MAAM,cAAc,GAAG,KAAK,IAAmB,EAAE;QAC/C,MAAM,EAAE,GAAG,EAAE,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE;YAC1C,GAAG;YACH,GAAG,EAAE;gBACH,GAAG,OAAO,CAAC,GAAG;aACf;SACF,CAAC,CAAC;QAEH,IAAI,GAAG,CAAC,QAAQ,CAAC,uBAAuB,CAAC,EAAE,CAAC;YAC1C,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,YAAY,CAAC,uBAAuB,CAAC,CAAC,CAAC;YACzD,OAAO;QACT,CAAC;QAED,MAAM,IAAA,gBAAK,EAAC,GAAG,CAAC,CAAC;QACjB,OAAO,cAAc,EAAE,CAAC;IAC1B,CAAC,CAAC;IAEF,MAAM,cAAc,EAAE,CAAC;AACzB,CAAC,CAAC;AA7BW,QAAA,UAAU,cA6BrB;AAEK,MAAM,SAAS,GAAG,KAAK,IAAmB,EAAE;IACjD,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;IACjC,MAAM,OAAO,CAAC,IAAI,CAAC;QACjB,GAAG;QACH,GAAG,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC;QAC/B,GAAG,EAAE,OAAO,CAAC,GAAG;QAChB,cAAc,EAAE,CAAC,kBAAkB,EAAE,IAAI,CAAC;KAC3C,CAAC,CAAC;AACL,CAAC,CAAC;AARW,QAAA,SAAS,aAQpB;AAEF,CAAC,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,mBAAmB,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAC1F,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,IAAI,EAAE;IACvB,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC,IAAA,iBAAS,GAAE,EAAE,IAAA,uBAAY,GAAE,CAAC,CAAC,CAAC;AACnD,CAAC,CAAC,CACH,CAAC"}
@@ -0,0 +1,5 @@
1
+ export declare const defaultNanoApp: {
2
+ firmware: string;
3
+ version: string;
4
+ };
5
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc;;;CAA0C,CAAC"}
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.defaultNanoApp = void 0;
4
+ exports.defaultNanoApp = { firmware: "2.5.1", version: "2.4.1" };
5
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,cAAc,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { CryptoCurrency } from "@ledgerhq/types-cryptoassets";
2
+ import { DerivationMode } from "@ledgerhq/types-live";
3
+ import { BitcoinAccount } from "@ledgerhq/coin-bitcoin/types";
4
+ export declare const makeAccount: (xpub: string, publicKey: string, address: string, currency: CryptoCurrency, derivationMode: DerivationMode) => BitcoinAccount;
5
+ //# sourceMappingURL=fixtures.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fixtures.d.ts","sourceRoot":"","sources":["../../src/fixtures.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAE9D,eAAO,MAAM,WAAW,GACtB,MAAM,MAAM,EACZ,WAAW,MAAM,EACjB,SAAS,MAAM,EACf,UAAU,cAAc,EACxB,gBAAgB,cAAc,KAC7B,cAmDF,CAAC"}
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+ /* instanbul ignore file: don't test fixtures */
3
+ var __importDefault = (this && this.__importDefault) || function (mod) {
4
+ return (mod && mod.__esModule) ? mod : { "default": mod };
5
+ };
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.makeAccount = void 0;
8
+ const bignumber_js_1 = __importDefault(require("bignumber.js"));
9
+ const derivation_1 = require("@ledgerhq/coin-framework/derivation");
10
+ const makeAccount = (xpub, publicKey, address, currency, derivationMode) => {
11
+ const id = `js:2:${currency.id}:${xpub}:${derivationMode}`;
12
+ const scheme = (0, derivation_1.getDerivationScheme)({
13
+ derivationMode: derivationMode,
14
+ currency,
15
+ });
16
+ const index = 0;
17
+ const freshAddressPath = (0, derivation_1.runDerivationScheme)(scheme, currency, {
18
+ account: index,
19
+ node: 0,
20
+ address: 0,
21
+ });
22
+ return {
23
+ type: "Account",
24
+ id: id,
25
+ seedIdentifier: publicKey,
26
+ derivationMode: derivationMode,
27
+ index: 0,
28
+ freshAddress: address,
29
+ freshAddressPath: freshAddressPath,
30
+ used: true,
31
+ balance: new bignumber_js_1.default(0),
32
+ spendableBalance: new bignumber_js_1.default(0),
33
+ creationDate: new Date(),
34
+ blockHeight: 0,
35
+ currency,
36
+ operationsCount: 0,
37
+ operations: [],
38
+ pendingOperations: [],
39
+ lastSyncDate: new Date(),
40
+ balanceHistoryCache: {
41
+ HOUR: {
42
+ latestDate: null,
43
+ balances: [],
44
+ },
45
+ DAY: {
46
+ latestDate: null,
47
+ balances: [],
48
+ },
49
+ WEEK: {
50
+ latestDate: null,
51
+ balances: [],
52
+ },
53
+ },
54
+ swapHistory: [],
55
+ bitcoinResources: {
56
+ utxos: [],
57
+ },
58
+ };
59
+ };
60
+ exports.makeAccount = makeAccount;
61
+ //# sourceMappingURL=fixtures.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fixtures.js","sourceRoot":"","sources":["../../src/fixtures.ts"],"names":[],"mappings":";AAAA,gDAAgD;;;;;;AAEhD,gEAAqC;AACrC,oEAA+F;AAKxF,MAAM,WAAW,GAAG,CACzB,IAAY,EACZ,SAAiB,EACjB,OAAe,EACf,QAAwB,EACxB,cAA8B,EACd,EAAE;IAClB,MAAM,EAAE,GAAG,QAAQ,QAAQ,CAAC,EAAE,IAAI,IAAI,IAAI,cAAc,EAAE,CAAC;IAC3D,MAAM,MAAM,GAAG,IAAA,gCAAmB,EAAC;QACjC,cAAc,EAAE,cAAgC;QAChD,QAAQ;KACT,CAAC,CAAC;IACH,MAAM,KAAK,GAAG,CAAC,CAAC;IAChB,MAAM,gBAAgB,GAAG,IAAA,gCAAmB,EAAC,MAAM,EAAE,QAAQ,EAAE;QAC7D,OAAO,EAAE,KAAK;QACd,IAAI,EAAE,CAAC;QACP,OAAO,EAAE,CAAC;KACX,CAAC,CAAC;IAEH,OAAO;QACL,IAAI,EAAE,SAAS;QACf,EAAE,EAAE,EAAE;QACN,cAAc,EAAE,SAAS;QACzB,cAAc,EAAE,cAAc;QAC9B,KAAK,EAAE,CAAC;QACR,YAAY,EAAE,OAAO;QACrB,gBAAgB,EAAE,gBAAgB;QAClC,IAAI,EAAE,IAAI;QACV,OAAO,EAAE,IAAI,sBAAS,CAAC,CAAC,CAAC;QACzB,gBAAgB,EAAE,IAAI,sBAAS,CAAC,CAAC,CAAC;QAClC,YAAY,EAAE,IAAI,IAAI,EAAE;QACxB,WAAW,EAAE,CAAC;QACd,QAAQ;QACR,eAAe,EAAE,CAAC;QAClB,UAAU,EAAE,EAAE;QACd,iBAAiB,EAAE,EAAE;QACrB,YAAY,EAAE,IAAI,IAAI,EAAE;QACxB,mBAAmB,EAAE;YACnB,IAAI,EAAE;gBACJ,UAAU,EAAE,IAAI;gBAChB,QAAQ,EAAE,EAAE;aACb;YACD,GAAG,EAAE;gBACH,UAAU,EAAE,IAAI;gBAChB,QAAQ,EAAE,EAAE;aACb;YACD,IAAI,EAAE;gBACJ,UAAU,EAAE,IAAI;gBAChB,QAAQ,EAAE,EAAE;aACb;SACF;QACD,WAAW,EAAE,EAAE;QAEf,gBAAgB,EAAE;YAChB,KAAK,EAAE,EAAE;SACV;KACF,CAAC;AACJ,CAAC,CAAC;AAzDW,QAAA,WAAW,eAyDtB"}
@@ -0,0 +1,11 @@
1
+ export declare function loadWallet(name: string): Promise<void>;
2
+ export declare function mineToWalletAddress(param: string): Promise<void>;
3
+ export declare const mineBlock: (address: string) => Promise<void>;
4
+ export declare const getCurrentBlock: () => Promise<any>;
5
+ export declare const sendTo: (recipientAddress: string, amount: number) => Promise<void>;
6
+ export declare const sendToMany: (recipientAddress: string, amount: number, times: number) => Promise<void>;
7
+ export declare const sendAutomatedRaw: (destinationAddress: string, amount: number) => Promise<void>;
8
+ export declare const sendRaw: (recipientAddress: string, amount: number, sequence?: number) => Promise<void>;
9
+ export declare const sendToReplaceCurrentTx: (recipientAddress: string, amount: number) => Promise<void>;
10
+ export declare const sendReplaceableTransaction: (recipientAddress: string, amount: number) => Promise<void>;
11
+ //# sourceMappingURL=helpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../src/helpers.ts"],"names":[],"mappings":"AAUA,wBAAsB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAoB5D;AAoBD,wBAAsB,mBAAmB,CAAC,KAAK,EAAE,MAAM,iBAQtD;AAGD,eAAO,MAAM,SAAS,GAAU,SAAS,MAAM,kBAK9C,CAAC;AAEF,eAAO,MAAM,eAAe,oBAE3B,CAAC;AAKF,eAAO,MAAM,MAAM,GAAU,kBAAkB,MAAM,EAAE,QAAQ,MAAM,kBAgCpE,CAAC;AACF,eAAO,MAAM,UAAU,GAAU,kBAAkB,MAAM,EAAE,QAAQ,MAAM,EAAE,OAAO,MAAM,kBAKvF,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAAU,oBAAoB,MAAM,EAAE,QAAQ,MAAM,kBA0ChF,CAAC;AAiBF,eAAO,MAAM,OAAO,GAAU,kBAAkB,MAAM,EAAE,QAAQ,MAAM,EAAE,iBAAqB,kBA2E5F,CAAC;AAEF,eAAO,MAAM,sBAAsB,GAAU,kBAAkB,MAAM,EAAE,QAAQ,MAAM,kBAqDpF,CAAC;AAEF,eAAO,MAAM,0BAA0B,GAAU,kBAAkB,MAAM,EAAE,QAAQ,MAAM,kBAoDxF,CAAC"}