@ledgerhq/coin-ton 0.3.12-next.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/.eslintrc.js +20 -0
- package/.turbo/turbo-build.log +4 -0
- package/.unimportedrc.json +19 -0
- package/CHANGELOG.md +15 -0
- package/LICENSE.txt +21 -0
- package/jest.config.js +12 -0
- package/lib/__tests__/fixtures/api.fixtures.d.ts +4 -0
- package/lib/__tests__/fixtures/api.fixtures.d.ts.map +1 -0
- package/lib/__tests__/fixtures/api.fixtures.js +33 -0
- package/lib/__tests__/fixtures/api.fixtures.js.map +1 -0
- package/lib/__tests__/fixtures/common.fixtures.d.ts +29 -0
- package/lib/__tests__/fixtures/common.fixtures.d.ts.map +1 -0
- package/lib/__tests__/fixtures/common.fixtures.js +124 -0
- package/lib/__tests__/fixtures/common.fixtures.js.map +1 -0
- package/lib/__tests__/integration/bridge.integration.test.d.ts +14 -0
- package/lib/__tests__/integration/bridge.integration.test.d.ts.map +1 -0
- package/lib/__tests__/integration/bridge.integration.test.js +136 -0
- package/lib/__tests__/integration/bridge.integration.test.js.map +1 -0
- package/lib/__tests__/unit/api.unit.test.d.ts +2 -0
- package/lib/__tests__/unit/api.unit.test.d.ts.map +1 -0
- package/lib/__tests__/unit/api.unit.test.js +77 -0
- package/lib/__tests__/unit/api.unit.test.js.map +1 -0
- package/lib/__tests__/unit/broadcast.unit.test.d.ts +2 -0
- package/lib/__tests__/unit/broadcast.unit.test.d.ts.map +1 -0
- package/lib/__tests__/unit/broadcast.unit.test.js +40 -0
- package/lib/__tests__/unit/broadcast.unit.test.js.map +1 -0
- package/lib/__tests__/unit/createTransaction.unit.test.d.ts +2 -0
- package/lib/__tests__/unit/createTransaction.unit.test.d.ts.map +1 -0
- package/lib/__tests__/unit/createTransaction.unit.test.js +34 -0
- package/lib/__tests__/unit/createTransaction.unit.test.js.map +1 -0
- package/lib/__tests__/unit/deviceTransactionConfig.unit.test.d.ts +2 -0
- package/lib/__tests__/unit/deviceTransactionConfig.unit.test.d.ts.map +1 -0
- package/lib/__tests__/unit/deviceTransactionConfig.unit.test.js +74 -0
- package/lib/__tests__/unit/deviceTransactionConfig.unit.test.js.map +1 -0
- package/lib/__tests__/unit/estimateMaxSpendable.unit.test.d.ts +2 -0
- package/lib/__tests__/unit/estimateMaxSpendable.unit.test.d.ts.map +1 -0
- package/lib/__tests__/unit/estimateMaxSpendable.unit.test.js +31 -0
- package/lib/__tests__/unit/estimateMaxSpendable.unit.test.js.map +1 -0
- package/lib/__tests__/unit/getTransactionStatus.unit.test.d.ts +2 -0
- package/lib/__tests__/unit/getTransactionStatus.unit.test.d.ts.map +1 -0
- package/lib/__tests__/unit/getTransactionStatus.unit.test.js +96 -0
- package/lib/__tests__/unit/getTransactionStatus.unit.test.js.map +1 -0
- package/lib/__tests__/unit/hw-getAddress.unit.test.d.ts +2 -0
- package/lib/__tests__/unit/hw-getAddress.unit.test.d.ts.map +1 -0
- package/lib/__tests__/unit/hw-getAddress.unit.test.js +67 -0
- package/lib/__tests__/unit/hw-getAddress.unit.test.js.map +1 -0
- package/lib/__tests__/unit/prepareTransaction.unit.test.d.ts +2 -0
- package/lib/__tests__/unit/prepareTransaction.unit.test.d.ts.map +1 -0
- package/lib/__tests__/unit/prepareTransaction.unit.test.js +42 -0
- package/lib/__tests__/unit/prepareTransaction.unit.test.js.map +1 -0
- package/lib/__tests__/unit/signOperation.unit.test.d.ts +2 -0
- package/lib/__tests__/unit/signOperation.unit.test.d.ts.map +1 -0
- package/lib/__tests__/unit/signOperation.unit.test.js +83 -0
- package/lib/__tests__/unit/signOperation.unit.test.js.map +1 -0
- package/lib/__tests__/unit/txn.unit.test.d.ts +2 -0
- package/lib/__tests__/unit/txn.unit.test.d.ts.map +1 -0
- package/lib/__tests__/unit/txn.unit.test.js +116 -0
- package/lib/__tests__/unit/txn.unit.test.js.map +1 -0
- package/lib/__tests__/unit/utils.unit.test.d.ts +2 -0
- package/lib/__tests__/unit/utils.unit.test.d.ts.map +1 -0
- package/lib/__tests__/unit/utils.unit.test.js +97 -0
- package/lib/__tests__/unit/utils.unit.test.js.map +1 -0
- package/lib/bridge/bridgeHelpers/api.d.ts +10 -0
- package/lib/bridge/bridgeHelpers/api.d.ts.map +1 -0
- package/lib/bridge/bridgeHelpers/api.js +104 -0
- package/lib/bridge/bridgeHelpers/api.js.map +1 -0
- package/lib/bridge/bridgeHelpers/api.types.d.ts +164 -0
- package/lib/bridge/bridgeHelpers/api.types.d.ts.map +1 -0
- package/lib/bridge/bridgeHelpers/api.types.js +3 -0
- package/lib/bridge/bridgeHelpers/api.types.js.map +1 -0
- package/lib/bridge/bridgeHelpers/txn.d.ts +5 -0
- package/lib/bridge/bridgeHelpers/txn.d.ts.map +1 -0
- package/lib/bridge/bridgeHelpers/txn.js +166 -0
- package/lib/bridge/bridgeHelpers/txn.js.map +1 -0
- package/lib/bridge/js.d.ts +12 -0
- package/lib/bridge/js.d.ts.map +1 -0
- package/lib/bridge/js.js +65 -0
- package/lib/bridge/js.js.map +1 -0
- package/lib/broadcast.d.ts +5 -0
- package/lib/broadcast.d.ts.map +1 -0
- package/lib/broadcast.js +19 -0
- package/lib/broadcast.js.map +1 -0
- package/lib/cli-transaction.d.ts +12 -0
- package/lib/cli-transaction.d.ts.map +1 -0
- package/lib/cli-transaction.js +21 -0
- package/lib/cli-transaction.js.map +1 -0
- package/lib/config.d.ts +9 -0
- package/lib/config.d.ts.map +1 -0
- package/lib/config.js +16 -0
- package/lib/config.js.map +1 -0
- package/lib/createTransaction.d.ts +5 -0
- package/lib/createTransaction.d.ts.map +1 -0
- package/lib/createTransaction.js +16 -0
- package/lib/createTransaction.js.map +1 -0
- package/lib/deviceTransactionConfig.d.ts +11 -0
- package/lib/deviceTransactionConfig.d.ts.map +1 -0
- package/lib/deviceTransactionConfig.js +37 -0
- package/lib/deviceTransactionConfig.js.map +1 -0
- package/lib/errors.d.ts +4 -0
- package/lib/errors.d.ts.map +1 -0
- package/lib/errors.js +9 -0
- package/lib/errors.js.map +1 -0
- package/lib/estimateMaxSpendable.d.ts +5 -0
- package/lib/estimateMaxSpendable.d.ts.map +1 -0
- package/lib/estimateMaxSpendable.js +32 -0
- package/lib/estimateMaxSpendable.js.map +1 -0
- package/lib/getTransactionStatus.d.ts +5 -0
- package/lib/getTransactionStatus.d.ts.map +1 -0
- package/lib/getTransactionStatus.js +97 -0
- package/lib/getTransactionStatus.js.map +1 -0
- package/lib/hw-getAddress.d.ts +6 -0
- package/lib/hw-getAddress.d.ts.map +1 -0
- package/lib/hw-getAddress.js +31 -0
- package/lib/hw-getAddress.js.map +1 -0
- package/lib/hw-signMessage.d.ts +12 -0
- package/lib/hw-signMessage.d.ts.map +1 -0
- package/lib/hw-signMessage.js +33 -0
- package/lib/hw-signMessage.js.map +1 -0
- package/lib/prepareTransaction.d.ts +5 -0
- package/lib/prepareTransaction.d.ts.map +1 -0
- package/lib/prepareTransaction.js +29 -0
- package/lib/prepareTransaction.js.map +1 -0
- package/lib/signOperation.d.ts +11 -0
- package/lib/signOperation.d.ts.map +1 -0
- package/lib/signOperation.js +96 -0
- package/lib/signOperation.js.map +1 -0
- package/lib/signer.d.ts +27 -0
- package/lib/signer.d.ts.map +1 -0
- package/lib/signer.js +3 -0
- package/lib/signer.js.map +1 -0
- package/lib/specs.d.ts +8 -0
- package/lib/specs.d.ts.map +1 -0
- package/lib/specs.js +106 -0
- package/lib/specs.js.map +1 -0
- package/lib/speculos-deviceActions.d.ts +4 -0
- package/lib/speculos-deviceActions.d.ts.map +1 -0
- package/lib/speculos-deviceActions.js +34 -0
- package/lib/speculos-deviceActions.js.map +1 -0
- package/lib/synchronisation.d.ts +5 -0
- package/lib/synchronisation.d.ts.map +1 -0
- package/lib/synchronisation.js +95 -0
- package/lib/synchronisation.js.map +1 -0
- package/lib/transaction.d.ts +14 -0
- package/lib/transaction.d.ts.map +1 -0
- package/lib/transaction.js +41 -0
- package/lib/transaction.js.map +1 -0
- package/lib/types.d.ts +65 -0
- package/lib/types.d.ts.map +1 -0
- package/lib/types.js +3 -0
- package/lib/types.js.map +1 -0
- package/lib/utils.d.ts +11 -0
- package/lib/utils.d.ts.map +1 -0
- package/lib/utils.js +125 -0
- package/lib/utils.js.map +1 -0
- package/lib-es/__tests__/fixtures/api.fixtures.d.ts +4 -0
- package/lib-es/__tests__/fixtures/api.fixtures.d.ts.map +1 -0
- package/lib-es/__tests__/fixtures/api.fixtures.js +30 -0
- package/lib-es/__tests__/fixtures/api.fixtures.js.map +1 -0
- package/lib-es/__tests__/fixtures/common.fixtures.d.ts +29 -0
- package/lib-es/__tests__/fixtures/common.fixtures.d.ts.map +1 -0
- package/lib-es/__tests__/fixtures/common.fixtures.js +118 -0
- package/lib-es/__tests__/fixtures/common.fixtures.js.map +1 -0
- package/lib-es/__tests__/integration/bridge.integration.test.d.ts +14 -0
- package/lib-es/__tests__/integration/bridge.integration.test.d.ts.map +1 -0
- package/lib-es/__tests__/integration/bridge.integration.test.js +130 -0
- package/lib-es/__tests__/integration/bridge.integration.test.js.map +1 -0
- package/lib-es/__tests__/unit/api.unit.test.d.ts +2 -0
- package/lib-es/__tests__/unit/api.unit.test.d.ts.map +1 -0
- package/lib-es/__tests__/unit/api.unit.test.js +52 -0
- package/lib-es/__tests__/unit/api.unit.test.js.map +1 -0
- package/lib-es/__tests__/unit/broadcast.unit.test.d.ts +2 -0
- package/lib-es/__tests__/unit/broadcast.unit.test.d.ts.map +1 -0
- package/lib-es/__tests__/unit/broadcast.unit.test.js +35 -0
- package/lib-es/__tests__/unit/broadcast.unit.test.js.map +1 -0
- package/lib-es/__tests__/unit/createTransaction.unit.test.d.ts +2 -0
- package/lib-es/__tests__/unit/createTransaction.unit.test.d.ts.map +1 -0
- package/lib-es/__tests__/unit/createTransaction.unit.test.js +29 -0
- package/lib-es/__tests__/unit/createTransaction.unit.test.js.map +1 -0
- package/lib-es/__tests__/unit/deviceTransactionConfig.unit.test.d.ts +2 -0
- package/lib-es/__tests__/unit/deviceTransactionConfig.unit.test.d.ts.map +1 -0
- package/lib-es/__tests__/unit/deviceTransactionConfig.unit.test.js +69 -0
- package/lib-es/__tests__/unit/deviceTransactionConfig.unit.test.js.map +1 -0
- package/lib-es/__tests__/unit/estimateMaxSpendable.unit.test.d.ts +2 -0
- package/lib-es/__tests__/unit/estimateMaxSpendable.unit.test.d.ts.map +1 -0
- package/lib-es/__tests__/unit/estimateMaxSpendable.unit.test.js +26 -0
- package/lib-es/__tests__/unit/estimateMaxSpendable.unit.test.js.map +1 -0
- package/lib-es/__tests__/unit/getTransactionStatus.unit.test.d.ts +2 -0
- package/lib-es/__tests__/unit/getTransactionStatus.unit.test.d.ts.map +1 -0
- package/lib-es/__tests__/unit/getTransactionStatus.unit.test.js +91 -0
- package/lib-es/__tests__/unit/getTransactionStatus.unit.test.js.map +1 -0
- package/lib-es/__tests__/unit/hw-getAddress.unit.test.d.ts +2 -0
- package/lib-es/__tests__/unit/hw-getAddress.unit.test.d.ts.map +1 -0
- package/lib-es/__tests__/unit/hw-getAddress.unit.test.js +62 -0
- package/lib-es/__tests__/unit/hw-getAddress.unit.test.js.map +1 -0
- package/lib-es/__tests__/unit/prepareTransaction.unit.test.d.ts +2 -0
- package/lib-es/__tests__/unit/prepareTransaction.unit.test.d.ts.map +1 -0
- package/lib-es/__tests__/unit/prepareTransaction.unit.test.js +37 -0
- package/lib-es/__tests__/unit/prepareTransaction.unit.test.js.map +1 -0
- package/lib-es/__tests__/unit/signOperation.unit.test.d.ts +2 -0
- package/lib-es/__tests__/unit/signOperation.unit.test.d.ts.map +1 -0
- package/lib-es/__tests__/unit/signOperation.unit.test.js +78 -0
- package/lib-es/__tests__/unit/signOperation.unit.test.js.map +1 -0
- package/lib-es/__tests__/unit/txn.unit.test.d.ts +2 -0
- package/lib-es/__tests__/unit/txn.unit.test.d.ts.map +1 -0
- package/lib-es/__tests__/unit/txn.unit.test.js +111 -0
- package/lib-es/__tests__/unit/txn.unit.test.js.map +1 -0
- package/lib-es/__tests__/unit/utils.unit.test.d.ts +2 -0
- package/lib-es/__tests__/unit/utils.unit.test.d.ts.map +1 -0
- package/lib-es/__tests__/unit/utils.unit.test.js +95 -0
- package/lib-es/__tests__/unit/utils.unit.test.js.map +1 -0
- package/lib-es/bridge/bridgeHelpers/api.d.ts +10 -0
- package/lib-es/bridge/bridgeHelpers/api.d.ts.map +1 -0
- package/lib-es/bridge/bridgeHelpers/api.js +93 -0
- package/lib-es/bridge/bridgeHelpers/api.js.map +1 -0
- package/lib-es/bridge/bridgeHelpers/api.types.d.ts +164 -0
- package/lib-es/bridge/bridgeHelpers/api.types.d.ts.map +1 -0
- package/lib-es/bridge/bridgeHelpers/api.types.js +2 -0
- package/lib-es/bridge/bridgeHelpers/api.types.js.map +1 -0
- package/lib-es/bridge/bridgeHelpers/txn.d.ts +5 -0
- package/lib-es/bridge/bridgeHelpers/txn.d.ts.map +1 -0
- package/lib-es/bridge/bridgeHelpers/txn.js +158 -0
- package/lib-es/bridge/bridgeHelpers/txn.js.map +1 -0
- package/lib-es/bridge/js.d.ts +12 -0
- package/lib-es/bridge/js.d.ts.map +1 -0
- package/lib-es/bridge/js.js +56 -0
- package/lib-es/bridge/js.js.map +1 -0
- package/lib-es/broadcast.d.ts +5 -0
- package/lib-es/broadcast.d.ts.map +1 -0
- package/lib-es/broadcast.js +17 -0
- package/lib-es/broadcast.js.map +1 -0
- package/lib-es/cli-transaction.d.ts +12 -0
- package/lib-es/cli-transaction.d.ts.map +1 -0
- package/lib-es/cli-transaction.js +15 -0
- package/lib-es/cli-transaction.js.map +1 -0
- package/lib-es/config.d.ts +9 -0
- package/lib-es/config.d.ts.map +1 -0
- package/lib-es/config.js +11 -0
- package/lib-es/config.js.map +1 -0
- package/lib-es/createTransaction.d.ts +5 -0
- package/lib-es/createTransaction.d.ts.map +1 -0
- package/lib-es/createTransaction.js +14 -0
- package/lib-es/createTransaction.js.map +1 -0
- package/lib-es/deviceTransactionConfig.d.ts +11 -0
- package/lib-es/deviceTransactionConfig.d.ts.map +1 -0
- package/lib-es/deviceTransactionConfig.js +35 -0
- package/lib-es/deviceTransactionConfig.js.map +1 -0
- package/lib-es/errors.d.ts +4 -0
- package/lib-es/errors.d.ts.map +1 -0
- package/lib-es/errors.js +6 -0
- package/lib-es/errors.js.map +1 -0
- package/lib-es/estimateMaxSpendable.d.ts +5 -0
- package/lib-es/estimateMaxSpendable.d.ts.map +1 -0
- package/lib-es/estimateMaxSpendable.js +30 -0
- package/lib-es/estimateMaxSpendable.js.map +1 -0
- package/lib-es/getTransactionStatus.d.ts +5 -0
- package/lib-es/getTransactionStatus.d.ts.map +1 -0
- package/lib-es/getTransactionStatus.js +93 -0
- package/lib-es/getTransactionStatus.js.map +1 -0
- package/lib-es/hw-getAddress.d.ts +6 -0
- package/lib-es/hw-getAddress.d.ts.map +1 -0
- package/lib-es/hw-getAddress.js +29 -0
- package/lib-es/hw-getAddress.js.map +1 -0
- package/lib-es/hw-signMessage.d.ts +12 -0
- package/lib-es/hw-signMessage.d.ts.map +1 -0
- package/lib-es/hw-signMessage.js +29 -0
- package/lib-es/hw-signMessage.js.map +1 -0
- package/lib-es/prepareTransaction.d.ts +5 -0
- package/lib-es/prepareTransaction.d.ts.map +1 -0
- package/lib-es/prepareTransaction.js +27 -0
- package/lib-es/prepareTransaction.js.map +1 -0
- package/lib-es/signOperation.d.ts +11 -0
- package/lib-es/signOperation.d.ts.map +1 -0
- package/lib-es/signOperation.js +91 -0
- package/lib-es/signOperation.js.map +1 -0
- package/lib-es/signer.d.ts +27 -0
- package/lib-es/signer.d.ts.map +1 -0
- package/lib-es/signer.js +2 -0
- package/lib-es/signer.js.map +1 -0
- package/lib-es/specs.d.ts +8 -0
- package/lib-es/specs.d.ts.map +1 -0
- package/lib-es/specs.js +99 -0
- package/lib-es/specs.js.map +1 -0
- package/lib-es/speculos-deviceActions.d.ts +4 -0
- package/lib-es/speculos-deviceActions.d.ts.map +1 -0
- package/lib-es/speculos-deviceActions.js +31 -0
- package/lib-es/speculos-deviceActions.js.map +1 -0
- package/lib-es/synchronisation.d.ts +5 -0
- package/lib-es/synchronisation.d.ts.map +1 -0
- package/lib-es/synchronisation.js +88 -0
- package/lib-es/synchronisation.js.map +1 -0
- package/lib-es/transaction.d.ts +14 -0
- package/lib-es/transaction.d.ts.map +1 -0
- package/lib-es/transaction.js +33 -0
- package/lib-es/transaction.js.map +1 -0
- package/lib-es/types.d.ts +65 -0
- package/lib-es/types.d.ts.map +1 -0
- package/lib-es/types.js +2 -0
- package/lib-es/types.js.map +1 -0
- package/lib-es/utils.d.ts +11 -0
- package/lib-es/utils.d.ts.map +1 -0
- package/lib-es/utils.js +112 -0
- package/lib-es/utils.js.map +1 -0
- package/package.json +86 -0
- package/src/__tests__/fixtures/api.fixtures.ts +39 -0
- package/src/__tests__/fixtures/common.fixtures.ts +139 -0
- package/src/__tests__/integration/bridge.integration.test.ts +135 -0
- package/src/__tests__/unit/api.unit.test.ts +60 -0
- package/src/__tests__/unit/broadcast.unit.test.ts +36 -0
- package/src/__tests__/unit/createTransaction.unit.test.ts +20 -0
- package/src/__tests__/unit/deviceTransactionConfig.unit.test.ts +69 -0
- package/src/__tests__/unit/estimateMaxSpendable.unit.test.ts +19 -0
- package/src/__tests__/unit/getTransactionStatus.unit.test.ts +119 -0
- package/src/__tests__/unit/hw-getAddress.unit.test.ts +58 -0
- package/src/__tests__/unit/prepareTransaction.unit.test.ts +52 -0
- package/src/__tests__/unit/signOperation.unit.test.ts +90 -0
- package/src/__tests__/unit/txn.unit.test.ts +121 -0
- package/src/__tests__/unit/utils.unit.test.ts +126 -0
- package/src/bridge/bridgeHelpers/api.ts +104 -0
- package/src/bridge/bridgeHelpers/api.types.ts +178 -0
- package/src/bridge/bridgeHelpers/txn.ts +166 -0
- package/src/bridge/js.ts +65 -0
- package/src/broadcast.ts +13 -0
- package/src/cli-transaction.ts +30 -0
- package/src/config.ts +21 -0
- package/src/createTransaction.ts +17 -0
- package/src/deviceTransactionConfig.ts +48 -0
- package/src/errors.ts +6 -0
- package/src/estimateMaxSpendable.ts +40 -0
- package/src/getTransactionStatus.ts +130 -0
- package/src/hw-getAddress.ts +28 -0
- package/src/hw-signMessage.ts +31 -0
- package/src/prepareTransaction.ts +27 -0
- package/src/signOperation.ts +115 -0
- package/src/signer.ts +32 -0
- package/src/specs.ts +122 -0
- package/src/speculos-deviceActions.ts +38 -0
- package/src/synchronisation.ts +91 -0
- package/src/transaction.ts +61 -0
- package/src/types.ts +82 -0
- package/src/utils.ts +120 -0
- package/tsconfig.json +12 -0
package/.eslintrc.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
env: {
|
|
3
|
+
browser: true,
|
|
4
|
+
es6: true,
|
|
5
|
+
},
|
|
6
|
+
overrides: [
|
|
7
|
+
{
|
|
8
|
+
files: ["src/**/*.test.{ts,tsx}"],
|
|
9
|
+
env: {
|
|
10
|
+
"jest/globals": true,
|
|
11
|
+
},
|
|
12
|
+
plugins: ["jest"],
|
|
13
|
+
},
|
|
14
|
+
],
|
|
15
|
+
rules: {
|
|
16
|
+
"no-console": ["error", { allow: ["warn", "error"] }],
|
|
17
|
+
"@typescript-eslint/no-empty-function": "off",
|
|
18
|
+
"@typescript-eslint/no-explicit-any": "warn",
|
|
19
|
+
},
|
|
20
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"entry": [
|
|
3
|
+
"src/bridge/js.ts",
|
|
4
|
+
"src/errors.ts",
|
|
5
|
+
"src/hw-getAddress.ts",
|
|
6
|
+
"src/types.ts",
|
|
7
|
+
"src/cli-transaction.ts",
|
|
8
|
+
"src/synchronisation.ts",
|
|
9
|
+
"src/specs.ts"
|
|
10
|
+
],
|
|
11
|
+
"ignoreUnimported": [
|
|
12
|
+
"src/transaction.ts",
|
|
13
|
+
"src/deviceTransactionConfig.ts",
|
|
14
|
+
"src/hw-signMessage.ts",
|
|
15
|
+
"src/specs.ts",
|
|
16
|
+
"src/speculos-deviceActions.ts"
|
|
17
|
+
],
|
|
18
|
+
"ignoreUnused": ["msw", "@ledgerhq/types-cryptoassets", "@ledgerhq/live-env"]
|
|
19
|
+
}
|
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# @ledgerhq/coin-ton
|
|
2
|
+
|
|
3
|
+
## 0.3.12-next.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#7504](https://github.com/LedgerHQ/ledger-live/pull/7504) [`22ed462`](https://github.com/LedgerHQ/ledger-live/commit/22ed4624837be92a45c8b32ee6a76eedb094e937) Thanks [@lambertkevin](https://github.com/lambertkevin)! - Force version 3.2.0 of @ton/crypto because 3.3.0 is bugged in the RN context
|
|
8
|
+
|
|
9
|
+
- Updated dependencies [[`afa03ae`](https://github.com/LedgerHQ/ledger-live/commit/afa03ae921ad1ca7df83dc0ba717c1cc27cb08cd), [`df9b4b7`](https://github.com/LedgerHQ/ledger-live/commit/df9b4b7b699503bb3aab1dc791b28e11ef0d51b9), [`db9c2d7`](https://github.com/LedgerHQ/ledger-live/commit/db9c2d78fb74df586c3ea1b9fb75ce3b014a0f4b), [`87d6bb2`](https://github.com/LedgerHQ/ledger-live/commit/87d6bb2501eac654dc10f45a0f591b28569b3d9f), [`4bd91de`](https://github.com/LedgerHQ/ledger-live/commit/4bd91de13442d12acce3ee83d5f2fd5f087570cf), [`53ff78c`](https://github.com/LedgerHQ/ledger-live/commit/53ff78c541d3ed69a3e74854d77f58a7e0d93978), [`8553b3e`](https://github.com/LedgerHQ/ledger-live/commit/8553b3eef10132396ec580a2d5f20b616f5b18a0), [`52daa39`](https://github.com/LedgerHQ/ledger-live/commit/52daa3998709ac3538afd447fe771faa3e3441be), [`60f1b5c`](https://github.com/LedgerHQ/ledger-live/commit/60f1b5c6cab125f5281468bb3e36f1abfae2d70c), [`60f1b5c`](https://github.com/LedgerHQ/ledger-live/commit/60f1b5c6cab125f5281468bb3e36f1abfae2d70c)]:
|
|
10
|
+
- @ledgerhq/coin-framework@0.17.0-next.0
|
|
11
|
+
- @ledgerhq/types-live@6.50.0-next.0
|
|
12
|
+
- @ledgerhq/cryptoassets@13.3.0-next.0
|
|
13
|
+
- @ledgerhq/types-cryptoassets@7.15.0-next.0
|
|
14
|
+
- @ledgerhq/live-env@2.2.0-next.0
|
|
15
|
+
- @ledgerhq/live-network@1.4.0-next.0
|
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/jest.config.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
|
|
2
|
+
module.exports = {
|
|
3
|
+
collectCoverageFrom: ["src/**/*.ts"],
|
|
4
|
+
coverageDirectory: "coverage",
|
|
5
|
+
preset: "ts-jest",
|
|
6
|
+
testEnvironment: "node",
|
|
7
|
+
testPathIgnorePatterns: ["lib/", "lib-es/"],
|
|
8
|
+
modulePathIgnorePatterns: [
|
|
9
|
+
"__tests__/fixtures",
|
|
10
|
+
"__tests__/integration/bridge.integration.test.ts", // this file is tested at the live-common level
|
|
11
|
+
],
|
|
12
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.fixtures.d.ts","sourceRoot":"","sources":["../../../src/__tests__/fixtures/api.fixtures.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,gBAAgB,uCAAuC,CAAC;AAyBrE,QAAA,MAAM,UAAU,uCAA2B,CAAC;AAE5C,eAAe,UAAU,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.API_TON_ENDPOINT = void 0;
|
|
4
|
+
const msw_1 = require("msw");
|
|
5
|
+
const node_1 = require("msw/node");
|
|
6
|
+
const common_fixtures_1 = require("./common.fixtures");
|
|
7
|
+
// Define the mock base URL for the TON API
|
|
8
|
+
exports.API_TON_ENDPOINT = "https://ton.coin.ledger.com/api/v3";
|
|
9
|
+
// Create request handlers for the mock server
|
|
10
|
+
const handlers = [
|
|
11
|
+
// Handle GET request for masterchainInfo endpoint
|
|
12
|
+
msw_1.http.get(`${exports.API_TON_ENDPOINT}/masterchainInfo`, () => {
|
|
13
|
+
return msw_1.HttpResponse.json(common_fixtures_1.lastBlockNumber);
|
|
14
|
+
}),
|
|
15
|
+
// Handle GET request for transactions endpoint
|
|
16
|
+
msw_1.http.get(`${exports.API_TON_ENDPOINT}/transactions`, () => {
|
|
17
|
+
return msw_1.HttpResponse.json(common_fixtures_1.tonTransactionResponse);
|
|
18
|
+
}),
|
|
19
|
+
// Handle GET request for account endpoint
|
|
20
|
+
msw_1.http.get(`${exports.API_TON_ENDPOINT}/account`, () => {
|
|
21
|
+
return msw_1.HttpResponse.json(common_fixtures_1.tonAccount);
|
|
22
|
+
}),
|
|
23
|
+
// Handle GET request for wallet endpoint
|
|
24
|
+
msw_1.http.get(`${exports.API_TON_ENDPOINT}/wallet`, () => {
|
|
25
|
+
return msw_1.HttpResponse.json(common_fixtures_1.tonWallet);
|
|
26
|
+
}),
|
|
27
|
+
// Handle POST request for estimate fee endpoint
|
|
28
|
+
msw_1.http.post(`${exports.API_TON_ENDPOINT}/estimateFee`, () => msw_1.HttpResponse.json(common_fixtures_1.tonEstimateFee)),
|
|
29
|
+
];
|
|
30
|
+
// Set up the mock server with the defined handlers
|
|
31
|
+
const mockServer = (0, node_1.setupServer)(...handlers);
|
|
32
|
+
exports.default = mockServer;
|
|
33
|
+
//# sourceMappingURL=api.fixtures.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.fixtures.js","sourceRoot":"","sources":["../../../src/__tests__/fixtures/api.fixtures.ts"],"names":[],"mappings":";;;AAAA,6BAAyC;AACzC,mCAAuC;AACvC,uDAM2B;AAE3B,2CAA2C;AAC9B,QAAA,gBAAgB,GAAG,oCAAoC,CAAC;AAErE,8CAA8C;AAC9C,MAAM,QAAQ,GAAG;IACf,kDAAkD;IAClD,UAAI,CAAC,GAAG,CAAC,GAAG,wBAAgB,kBAAkB,EAAE,GAAG,EAAE;QACnD,OAAO,kBAAY,CAAC,IAAI,CAAC,iCAAe,CAAC,CAAC;IAC5C,CAAC,CAAC;IACF,+CAA+C;IAC/C,UAAI,CAAC,GAAG,CAAC,GAAG,wBAAgB,eAAe,EAAE,GAAG,EAAE;QAChD,OAAO,kBAAY,CAAC,IAAI,CAAC,wCAAsB,CAAC,CAAC;IACnD,CAAC,CAAC;IACF,0CAA0C;IAC1C,UAAI,CAAC,GAAG,CAAC,GAAG,wBAAgB,UAAU,EAAE,GAAG,EAAE;QAC3C,OAAO,kBAAY,CAAC,IAAI,CAAC,4BAAU,CAAC,CAAC;IACvC,CAAC,CAAC;IACF,yCAAyC;IACzC,UAAI,CAAC,GAAG,CAAC,GAAG,wBAAgB,SAAS,EAAE,GAAG,EAAE;QAC1C,OAAO,kBAAY,CAAC,IAAI,CAAC,2BAAS,CAAC,CAAC;IACtC,CAAC,CAAC;IACF,gDAAgD;IAChD,UAAI,CAAC,IAAI,CAAC,GAAG,wBAAgB,cAAc,EAAE,GAAG,EAAE,CAAC,kBAAY,CAAC,IAAI,CAAC,gCAAc,CAAC,CAAC;CACtF,CAAC;AAEF,mDAAmD;AACnD,MAAM,UAAU,GAAG,IAAA,kBAAW,EAAC,GAAG,QAAQ,CAAC,CAAC;AAE5C,kBAAe,UAAU,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Account } from "@ledgerhq/types-live";
|
|
2
|
+
import BigNumber from "bignumber.js";
|
|
3
|
+
import { TonAccountInfo, TonResponseEstimateFee, TonResponseWalletInfo, TonTransactionsList } from "../../bridge/bridgeHelpers/api.types";
|
|
4
|
+
import type { Transaction } from "../../types";
|
|
5
|
+
export declare const mockAddress = "UQDzd8aeBOU-jqYw_ZSuZjceI5p-F4b7HMprAsUJAtRPbMol";
|
|
6
|
+
export declare const mockAccountId = "js:2:ton:b19891a06654f21c64147550b3321bef63acd25b5dd61b688b022c42fac4831d:ton";
|
|
7
|
+
export declare const account: Account;
|
|
8
|
+
export declare const transaction: Transaction;
|
|
9
|
+
export declare const fees: {
|
|
10
|
+
in_fwd_fee: number;
|
|
11
|
+
storage_fee: number;
|
|
12
|
+
gas_fee: number;
|
|
13
|
+
fwd_fee: number;
|
|
14
|
+
};
|
|
15
|
+
export declare const totalFees: BigNumber;
|
|
16
|
+
export declare const lastBlockNumber: {
|
|
17
|
+
last: {
|
|
18
|
+
seqno: number;
|
|
19
|
+
};
|
|
20
|
+
first: {
|
|
21
|
+
seqno: number;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
export declare const tonAccount: TonAccountInfo;
|
|
25
|
+
export declare const tonWallet: TonResponseWalletInfo;
|
|
26
|
+
export declare const tonEstimateFee: TonResponseEstimateFee;
|
|
27
|
+
export declare const tonTransactionResponse: TonTransactionsList;
|
|
28
|
+
export declare const accountInfo: TonAccountInfo;
|
|
29
|
+
//# sourceMappingURL=common.fixtures.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.fixtures.d.ts","sourceRoot":"","sources":["../../../src/__tests__/fixtures/common.fixtures.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,SAAS,MAAM,cAAc,CAAC;AACrC,OAAO,EACL,cAAc,EACd,sBAAsB,EACtB,qBAAqB,EACrB,mBAAmB,EACpB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,eAAO,MAAM,WAAW,qDAAqD,CAAC;AAC9E,eAAO,MAAM,aAAa,kFACuD,CAAC;AAElF,eAAO,MAAM,OAAO,SAUR,CAAC;AAEb,eAAO,MAAM,WAAW,aAQG,CAAC;AAE5B,eAAO,MAAM,IAAI;;;;;CAKhB,CAAC;AAEF,eAAO,MAAM,SAAS,WAErB,CAAC;AAEF,eAAO,MAAM,eAAe;;;;;;;CAO3B,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,cAMxB,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,qBAQvB,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,sBAG5B,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,mBAkDpC,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,cAMzB,CAAC"}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.accountInfo = exports.tonTransactionResponse = exports.tonEstimateFee = exports.tonWallet = exports.tonAccount = exports.lastBlockNumber = exports.totalFees = exports.fees = exports.transaction = exports.account = exports.mockAccountId = exports.mockAddress = void 0;
|
|
7
|
+
const currencies_1 = require("@ledgerhq/cryptoassets/currencies");
|
|
8
|
+
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
|
9
|
+
exports.mockAddress = "UQDzd8aeBOU-jqYw_ZSuZjceI5p-F4b7HMprAsUJAtRPbMol";
|
|
10
|
+
exports.mockAccountId = "js:2:ton:b19891a06654f21c64147550b3321bef63acd25b5dd61b688b022c42fac4831d:ton";
|
|
11
|
+
exports.account = {
|
|
12
|
+
id: exports.mockAccountId,
|
|
13
|
+
freshAddress: exports.mockAddress,
|
|
14
|
+
freshAddressPath: "44'/607'/0'/0'/0'/0'",
|
|
15
|
+
xpub: "",
|
|
16
|
+
type: "Account",
|
|
17
|
+
currency: (0, currencies_1.getCryptoCurrencyById)("ton"),
|
|
18
|
+
spendableBalance: new bignumber_js_1.default("1000000000"),
|
|
19
|
+
balance: new bignumber_js_1.default("1000000000"),
|
|
20
|
+
seedIdentifier: "seedIdentifier",
|
|
21
|
+
};
|
|
22
|
+
exports.transaction = {
|
|
23
|
+
mode: "send",
|
|
24
|
+
recipient: "UQCOvQLYvTcbi5tL9MaDNzuVl3-J3vATimNm9yO5XPafLfV4",
|
|
25
|
+
amount: new bignumber_js_1.default("1000000"),
|
|
26
|
+
useAllAmount: false,
|
|
27
|
+
comment: { isEncrypted: false, text: "" },
|
|
28
|
+
payload: "",
|
|
29
|
+
family: "ton",
|
|
30
|
+
};
|
|
31
|
+
exports.fees = {
|
|
32
|
+
in_fwd_fee: 10000,
|
|
33
|
+
storage_fee: 10000,
|
|
34
|
+
gas_fee: 10000,
|
|
35
|
+
fwd_fee: 10000,
|
|
36
|
+
};
|
|
37
|
+
exports.totalFees = (0, bignumber_js_1.default)(exports.fees.fwd_fee + exports.fees.gas_fee + exports.fees.in_fwd_fee + exports.fees.storage_fee);
|
|
38
|
+
exports.lastBlockNumber = {
|
|
39
|
+
last: {
|
|
40
|
+
seqno: 38574413,
|
|
41
|
+
},
|
|
42
|
+
first: {
|
|
43
|
+
seqno: 3,
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
exports.tonAccount = {
|
|
47
|
+
balance: "1000000000",
|
|
48
|
+
last_transaction_lt: "47055058000008",
|
|
49
|
+
last_transaction_hash: "psVQqt6rf/Lo6xyLzxx0to0jUIx8I2/4znOVf2KhAI0=",
|
|
50
|
+
status: "active",
|
|
51
|
+
seqno: 3,
|
|
52
|
+
};
|
|
53
|
+
exports.tonWallet = {
|
|
54
|
+
balance: "7726736262",
|
|
55
|
+
wallet_type: "wallet v4 r2",
|
|
56
|
+
seqno: 22,
|
|
57
|
+
wallet_id: 698983191,
|
|
58
|
+
last_transaction_lt: "47055058000008",
|
|
59
|
+
last_transaction_hash: "psVQqt6rf/Lo6xyLzxx0to0jUIx8I2/4znOVf2KhAI0=",
|
|
60
|
+
status: "active",
|
|
61
|
+
};
|
|
62
|
+
exports.tonEstimateFee = {
|
|
63
|
+
source_fees: exports.fees,
|
|
64
|
+
destination_fees: [],
|
|
65
|
+
};
|
|
66
|
+
exports.tonTransactionResponse = {
|
|
67
|
+
transactions: [
|
|
68
|
+
{
|
|
69
|
+
account: exports.mockAddress,
|
|
70
|
+
hash: "hash",
|
|
71
|
+
lt: "lt",
|
|
72
|
+
now: 1718241443,
|
|
73
|
+
orig_status: "active",
|
|
74
|
+
end_status: "active",
|
|
75
|
+
total_fees: "0",
|
|
76
|
+
prev_trans_hash: "",
|
|
77
|
+
prev_trans_lt: "",
|
|
78
|
+
description: {
|
|
79
|
+
aborted: true,
|
|
80
|
+
destroyed: false,
|
|
81
|
+
compute_ph: {
|
|
82
|
+
success: false,
|
|
83
|
+
exit_code: -14,
|
|
84
|
+
},
|
|
85
|
+
credit_first: true,
|
|
86
|
+
},
|
|
87
|
+
block_ref: null,
|
|
88
|
+
in_msg: {
|
|
89
|
+
source: "0:959EAA8BD0E3A2662D814278D51A6F997946207D48478008BEBE7F45F3EF781F",
|
|
90
|
+
destination: exports.mockAddress,
|
|
91
|
+
value: "13509565",
|
|
92
|
+
hash: "inMsgHash",
|
|
93
|
+
fwd_fee: "266669",
|
|
94
|
+
ihr_fee: "0",
|
|
95
|
+
created_lt: "47055058000007",
|
|
96
|
+
created_at: "1718241443",
|
|
97
|
+
opcode: "0xd53276db",
|
|
98
|
+
ihr_disabled: true,
|
|
99
|
+
bounce: false,
|
|
100
|
+
bounced: false,
|
|
101
|
+
import_fee: null,
|
|
102
|
+
message_content: {
|
|
103
|
+
hash: "Qa0w2xg42wA9taurO/aCVOqGTzjOeP3EpzD2Sl7tTss=",
|
|
104
|
+
body: "te6cckEBAQEADgAAGNUydtsAAAAAAAAAAfRC8y4=",
|
|
105
|
+
decoded: null,
|
|
106
|
+
},
|
|
107
|
+
init_state: null,
|
|
108
|
+
},
|
|
109
|
+
out_msgs: [],
|
|
110
|
+
account_state_before: null,
|
|
111
|
+
account_state_after: null,
|
|
112
|
+
mc_block_seqno: 3,
|
|
113
|
+
},
|
|
114
|
+
],
|
|
115
|
+
address_book: {},
|
|
116
|
+
};
|
|
117
|
+
exports.accountInfo = {
|
|
118
|
+
balance: "7726736262",
|
|
119
|
+
last_transaction_lt: "47055058000008",
|
|
120
|
+
last_transaction_hash: "lastTransactionHash",
|
|
121
|
+
status: "active",
|
|
122
|
+
seqno: 22,
|
|
123
|
+
};
|
|
124
|
+
//# sourceMappingURL=common.fixtures.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.fixtures.js","sourceRoot":"","sources":["../../../src/__tests__/fixtures/common.fixtures.ts"],"names":[],"mappings":";;;;;;AAAA,kEAA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,IAAI,EAAE,0CAA0C;oBAChD,OAAO,EAAE,IAAI;iBACd;gBACD,UAAU,EAAE,IAAI;aACjB;YACD,QAAQ,EAAE,EAAE;YACZ,oBAAoB,EAAE,IAAI;YAC1B,mBAAmB,EAAE,IAAI;YACzB,cAAc,EAAE,CAAC;SAClB;KACF;IACD,YAAY,EAAE,EAAE;CACjB,CAAC;AAEW,QAAA,WAAW,GAAmB;IACzC,OAAO,EAAE,YAAY;IACrB,mBAAmB,EAAE,gBAAgB;IACrC,qBAAqB,EAAE,qBAAqB;IAC5C,MAAM,EAAE,QAAQ;IAChB,KAAK,EAAE,EAAE;CACV,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { DatasetTest } from "@ledgerhq/types-live";
|
|
2
|
+
import { Transaction } from "../../types";
|
|
3
|
+
export declare const dataset: DatasetTest<Transaction>;
|
|
4
|
+
/**
|
|
5
|
+
* NOTE: if tests are added to this file,
|
|
6
|
+
* like done in libs/coin-polkadot/src/bridge.integration.test.ts for example,
|
|
7
|
+
* this file fill need to be imported in ledger-live-common
|
|
8
|
+
* libs/ledger-live-common/src/families/ton/bridge.integration.test.ts
|
|
9
|
+
* like done for polkadot.
|
|
10
|
+
* cf.
|
|
11
|
+
* - libs/coin-polkadot/src/bridge.integration.test.ts
|
|
12
|
+
* - libs/ledger-live-common/src/families/polkadot/bridge.integration.test.ts
|
|
13
|
+
*/
|
|
14
|
+
//# sourceMappingURL=bridge.integration.test.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bridge.integration.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/integration/bridge.integration.test.ts"],"names":[],"mappings":"AACA,OAAO,EAAkB,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAInE,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAiH1C,eAAO,MAAM,OAAO,EAAE,WAAW,CAAC,WAAW,CAK5C,CAAC;AAEF;;;;;;;;;GASG"}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.dataset = void 0;
|
|
7
|
+
const errors_1 = require("@ledgerhq/errors");
|
|
8
|
+
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
|
9
|
+
const errors_2 = require("../../errors");
|
|
10
|
+
const transaction_1 = require("../../transaction");
|
|
11
|
+
const PUBKEY = "86196cb40cd25e9e696bc808e3f2c074ce0b39f2a2a9d482a68eafef86e4a060";
|
|
12
|
+
const ADDRESS = "UQCOvQLYvTcbi5tL9MaDNzuVl3-J3vATimNm9yO5XPafLfV4";
|
|
13
|
+
const ADDRESS_2 = "UQAui6M4jOYOezUGfmeONA22Ars9yjd34YIGdAR1Pcpp4sgR";
|
|
14
|
+
const PATH = "44'/607'/0'/0'/0'/0'";
|
|
15
|
+
const ton = {
|
|
16
|
+
scanAccounts: [
|
|
17
|
+
{
|
|
18
|
+
name: "ton seed 1",
|
|
19
|
+
apdus: `
|
|
20
|
+
=> e005000019068000002c8000025f80000000800000008000000080000000
|
|
21
|
+
<= 86196cb40cd25e9e696bc808e3f2c074ce0b39f2a2a9d482a68eafef86e4a0609000
|
|
22
|
+
=> e005000019068000002c8000025f80000000800000008000000180000000
|
|
23
|
+
<= b5177c2b32f9d72fa8c673cc3d61acec6a9f68eb5e4945445fdbb48a45eb48879000
|
|
24
|
+
`,
|
|
25
|
+
test: (expect, accounts) => {
|
|
26
|
+
for (const account of accounts) {
|
|
27
|
+
expect(account.derivationMode).toEqual("ton");
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
],
|
|
32
|
+
accounts: [
|
|
33
|
+
{
|
|
34
|
+
FIXME_tests: ["balance is sum of ops"],
|
|
35
|
+
raw: {
|
|
36
|
+
id: `js:2:ton:${PUBKEY}:ton`,
|
|
37
|
+
currencyId: "ton",
|
|
38
|
+
seedIdentifier: PUBKEY,
|
|
39
|
+
name: "TON 1",
|
|
40
|
+
derivationMode: "ton",
|
|
41
|
+
index: 0,
|
|
42
|
+
freshAddress: ADDRESS,
|
|
43
|
+
freshAddressPath: PATH,
|
|
44
|
+
xpub: PUBKEY,
|
|
45
|
+
blockHeight: 0,
|
|
46
|
+
operations: [],
|
|
47
|
+
pendingOperations: [],
|
|
48
|
+
lastSyncDate: "",
|
|
49
|
+
balance: "5000000000",
|
|
50
|
+
subAccounts: [],
|
|
51
|
+
},
|
|
52
|
+
transactions: [
|
|
53
|
+
{
|
|
54
|
+
name: "Not a valid address",
|
|
55
|
+
transaction: (0, transaction_1.fromTransactionRaw)({
|
|
56
|
+
family: "ton",
|
|
57
|
+
recipient: "novalidaddress",
|
|
58
|
+
fees: "10000000",
|
|
59
|
+
amount: "1000",
|
|
60
|
+
comment: { isEncrypted: false, text: "" },
|
|
61
|
+
}),
|
|
62
|
+
expectedStatus: {
|
|
63
|
+
errors: {
|
|
64
|
+
recipient: new errors_1.InvalidAddress(),
|
|
65
|
+
},
|
|
66
|
+
warnings: {},
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
name: "Not enough balance",
|
|
71
|
+
transaction: (0, transaction_1.fromTransactionRaw)({
|
|
72
|
+
family: "ton",
|
|
73
|
+
recipient: ADDRESS_2,
|
|
74
|
+
fees: "10000000",
|
|
75
|
+
amount: (300 * 1e9).toString(),
|
|
76
|
+
comment: { isEncrypted: false, text: "" },
|
|
77
|
+
}),
|
|
78
|
+
expectedStatus: {
|
|
79
|
+
errors: {
|
|
80
|
+
amount: new errors_1.NotEnoughBalance(),
|
|
81
|
+
},
|
|
82
|
+
warnings: {},
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
name: "Invalid transferID/Memo",
|
|
87
|
+
transaction: (0, transaction_1.fromTransactionRaw)({
|
|
88
|
+
family: "ton",
|
|
89
|
+
recipient: ADDRESS_2,
|
|
90
|
+
fees: "10000000",
|
|
91
|
+
amount: (1 * 1e9).toString(),
|
|
92
|
+
comment: { isEncrypted: false, text: "😀" },
|
|
93
|
+
}),
|
|
94
|
+
expectedStatus: {
|
|
95
|
+
errors: {
|
|
96
|
+
comment: new errors_2.TonCommentInvalid(),
|
|
97
|
+
},
|
|
98
|
+
warnings: {},
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
name: "New account and sufficient amount",
|
|
103
|
+
transaction: (0, transaction_1.fromTransactionRaw)({
|
|
104
|
+
family: "ton",
|
|
105
|
+
recipient: ADDRESS_2,
|
|
106
|
+
fees: "10000000",
|
|
107
|
+
amount: "10000000",
|
|
108
|
+
comment: { isEncrypted: false, text: "Valid" },
|
|
109
|
+
}),
|
|
110
|
+
expectedStatus: {
|
|
111
|
+
amount: new bignumber_js_1.default("10000000"),
|
|
112
|
+
errors: {},
|
|
113
|
+
warnings: {},
|
|
114
|
+
},
|
|
115
|
+
},
|
|
116
|
+
],
|
|
117
|
+
},
|
|
118
|
+
],
|
|
119
|
+
};
|
|
120
|
+
exports.dataset = {
|
|
121
|
+
implementations: ["js"],
|
|
122
|
+
currencies: {
|
|
123
|
+
ton,
|
|
124
|
+
},
|
|
125
|
+
};
|
|
126
|
+
/**
|
|
127
|
+
* NOTE: if tests are added to this file,
|
|
128
|
+
* like done in libs/coin-polkadot/src/bridge.integration.test.ts for example,
|
|
129
|
+
* this file fill need to be imported in ledger-live-common
|
|
130
|
+
* libs/ledger-live-common/src/families/ton/bridge.integration.test.ts
|
|
131
|
+
* like done for polkadot.
|
|
132
|
+
* cf.
|
|
133
|
+
* - libs/coin-polkadot/src/bridge.integration.test.ts
|
|
134
|
+
* - libs/ledger-live-common/src/families/polkadot/bridge.integration.test.ts
|
|
135
|
+
*/
|
|
136
|
+
//# sourceMappingURL=bridge.integration.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bridge.integration.test.js","sourceRoot":"","sources":["../../../src/__tests__/integration/bridge.integration.test.ts"],"names":[],"mappings":";;;;;;AAAA,6CAAoE;AAEpE,gEAAqC;AACrC,yCAAiD;AACjD,mDAAuD;AAGvD,MAAM,MAAM,GAAG,kEAAkE,CAAC;AAClF,MAAM,OAAO,GAAG,kDAAkD,CAAC;AACnE,MAAM,SAAS,GAAG,kDAAkD,CAAC;AACrE,MAAM,IAAI,GAAG,sBAAsB,CAAC;AAEpC,MAAM,GAAG,GAAgC;IACvC,YAAY,EAAE;QACZ;YACE,IAAI,EAAE,YAAY;YAClB,KAAK,EAAE;;;;;OAKN;YACD,IAAI,EAAE,CAAC,MAAM,EAAE,QAAQ,EAAE,EAAE;gBACzB,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;oBAC/B,MAAM,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;gBAChD,CAAC;YACH,CAAC;SACF;KACF;IACD,QAAQ,EAAE;QACR;YACE,WAAW,EAAE,CAAC,uBAAuB,CAAC;YACtC,GAAG,EAAE;gBACH,EAAE,EAAE,YAAY,MAAM,MAAM;gBAC5B,UAAU,EAAE,KAAK;gBACjB,cAAc,EAAE,MAAM;gBACtB,IAAI,EAAE,OAAO;gBACb,cAAc,EAAE,KAAK;gBACrB,KAAK,EAAE,CAAC;gBACR,YAAY,EAAE,OAAO;gBACrB,gBAAgB,EAAE,IAAI;gBACtB,IAAI,EAAE,MAAM;gBACZ,WAAW,EAAE,CAAC;gBACd,UAAU,EAAE,EAAE;gBACd,iBAAiB,EAAE,EAAE;gBACrB,YAAY,EAAE,EAAE;gBAChB,OAAO,EAAE,YAAY;gBACrB,WAAW,EAAE,EAAE;aAChB;YACD,YAAY,EAAE;gBACZ;oBACE,IAAI,EAAE,qBAAqB;oBAC3B,WAAW,EAAE,IAAA,gCAAkB,EAAC;wBAC9B,MAAM,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M,EAAE,KAAK;wBACb,SAAS,EAAE,SAAS;wBACpB,IAAI,EAAE,UAAU;wBAChB,MAAM,EAAE,UAAU;wBAClB,OAAO,EAAE,EAAE,WAAW,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE;qBAC/C,CAAC;oBACF,cAAc,EAAE;wBACd,MAAM,EAAE,IAAI,sBAAS,CAAC,UAAU,CAAC;wBACjC,MAAM,EAAE,EAAE;wBACV,QAAQ,EAAE,EAAE;qBACb;iBACF;aACF;SACF;KACF;CACF,CAAC;AAEW,QAAA,OAAO,GAA6B;IAC/C,eAAe,EAAE,CAAC,IAAI,CAAC;IACvB,UAAU,EAAE;QACV,GAAG;KACJ;CACF,CAAC;AAEF;;;;;;;;;GASG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.unit.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/unit/api.unit.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,77 @@
|
|
|
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 (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
+
const api_1 = require("../../bridge/bridgeHelpers/api");
|
|
36
|
+
const config_1 = require("../../config");
|
|
37
|
+
const api_fixtures_1 = __importStar(require("../fixtures/api.fixtures"));
|
|
38
|
+
const common_fixtures_1 = require("../fixtures/common.fixtures");
|
|
39
|
+
describe("getAccount", () => {
|
|
40
|
+
beforeAll(() => {
|
|
41
|
+
(0, config_1.setCoinConfig)(() => ({
|
|
42
|
+
status: {
|
|
43
|
+
type: "active",
|
|
44
|
+
},
|
|
45
|
+
infra: {
|
|
46
|
+
API_TON_ENDPOINT: api_fixtures_1.API_TON_ENDPOINT,
|
|
47
|
+
},
|
|
48
|
+
}));
|
|
49
|
+
api_fixtures_1.default.listen();
|
|
50
|
+
});
|
|
51
|
+
afterAll(() => {
|
|
52
|
+
api_fixtures_1.default.close();
|
|
53
|
+
});
|
|
54
|
+
it("should return last block number", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
55
|
+
const result = yield (0, api_1.fetchLastBlockNumber)();
|
|
56
|
+
expect(result).toEqual(common_fixtures_1.lastBlockNumber.last.seqno);
|
|
57
|
+
}));
|
|
58
|
+
it("should return the transactions of an address", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
59
|
+
const result = yield (0, api_1.fetchTransactions)(common_fixtures_1.mockAddress);
|
|
60
|
+
expect(result).toEqual(common_fixtures_1.tonTransactionResponse);
|
|
61
|
+
}));
|
|
62
|
+
it("should return the ton account info of an address", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
63
|
+
const result = yield (0, api_1.fetchAccountInfo)(common_fixtures_1.mockAddress);
|
|
64
|
+
expect(result).toEqual({
|
|
65
|
+
balance: common_fixtures_1.tonAccount.balance,
|
|
66
|
+
last_transaction_lt: common_fixtures_1.tonAccount.last_transaction_lt,
|
|
67
|
+
last_transaction_hash: common_fixtures_1.tonAccount.last_transaction_hash,
|
|
68
|
+
status: common_fixtures_1.tonAccount.status,
|
|
69
|
+
seqno: common_fixtures_1.tonWallet.seqno,
|
|
70
|
+
});
|
|
71
|
+
}));
|
|
72
|
+
it("should return the estimated fees", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
73
|
+
const result = yield (0, api_1.estimateFee)(common_fixtures_1.mockAddress, "");
|
|
74
|
+
expect(result).toEqual(common_fixtures_1.tonEstimateFee.source_fees);
|
|
75
|
+
}));
|
|
76
|
+
});
|
|
77
|
+
//# sourceMappingURL=api.unit.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.unit.test.js","sourceRoot":"","sources":["../../../src/__tests__/unit/api.unit.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,wDAKwC;AACxC,yCAA6C;AAC7C,yEAAwE;AACxE,iEAOqC;AAErC,QAAQ,CAAC,YAAY,EAAE,GAAG,EAAE;IAC1B,SAAS,CAAC,GAAG,EAAE;QACb,IAAA,sBAAa,EAAC,GAAG,EAAE,C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W,EAAE,EAAE,CAAC,CAAC;QAClD,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,gCAAc,CAAC,WAAW,CAAC,CAAC;IACrD,CAAC,CAAA,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"broadcast.unit.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/unit/broadcast.unit.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
const operation_1 = require("@ledgerhq/coin-framework/lib/operation");
|
|
16
|
+
const api_1 = require("../../bridge/bridgeHelpers/api");
|
|
17
|
+
const broadcast_1 = __importDefault(require("../../broadcast"));
|
|
18
|
+
const signOperation_1 = require("../../signOperation");
|
|
19
|
+
const common_fixtures_1 = require("../fixtures/common.fixtures");
|
|
20
|
+
jest.mock("../../bridge/bridgeHelpers/api");
|
|
21
|
+
const mockedHash = "validHash";
|
|
22
|
+
describe("broadcast", () => {
|
|
23
|
+
beforeAll(() => {
|
|
24
|
+
const broadcastTxMock = jest.mocked(api_1.broadcastTx);
|
|
25
|
+
broadcastTxMock.mockReturnValue(Promise.resolve(mockedHash));
|
|
26
|
+
});
|
|
27
|
+
it("should broadcast the coin transaction and add the hash in the optimistic transaction", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
28
|
+
const optimisticCoinOperation = (0, signOperation_1.buildOptimisticOperation)(common_fixtures_1.account, common_fixtures_1.transaction);
|
|
29
|
+
const finalOperation = yield (0, broadcast_1.default)({
|
|
30
|
+
account: common_fixtures_1.account,
|
|
31
|
+
signedOperation: {
|
|
32
|
+
operation: optimisticCoinOperation,
|
|
33
|
+
signature: "0xS1gn4tUR3",
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
expect(api_1.broadcastTx).toHaveBeenCalled();
|
|
37
|
+
expect(finalOperation).toEqual(Object.assign(Object.assign({}, optimisticCoinOperation), { id: (0, operation_1.encodeOperationId)(common_fixtures_1.account.id, mockedHash, "OUT"), hash: mockedHash, subOperations: [], nftOperations: [] }));
|
|
38
|
+
}));
|
|
39
|
+
});
|
|
40
|
+
//# sourceMappingURL=broadcast.unit.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"broadcast.unit.test.js","sourceRoot":"","sources":["../../../src/__tests__/unit/broadcast.unit.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,sEAA2E;AAC3E,wDAA6D;AAC7D,gEAAwC;AACxC,uDAA+D;AAC/D,iEAAmE;AAEnE,IAAI,CAAC,IAAI,CAAC,gCAAgC,CAAC,CAAC;AAC5C,MAAM,UAAU,GAAG,WAAW,CAAC;AAE/B,QAAQ,CAAC,WAAW,EAAE,GAAG,EAAE;IACzB,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,eAAe,GAAG,IAAI,CAAC,MAAM,CAAC,iBAAW,CAAC,CAAC;QACjD,eAAe,CAAC,eAAe,CAAC,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC;IAC/D,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,sFAAsF,EAAE,GAAS,EAAE;QACpG,MAAM,uBAAuB,GAAG,IAAA,wCAAwB,EAAC,yBAAO,EAAE,6BAAW,CAAC,CAAC;QAE/E,MAAM,cAAc,GAAG,MAAM,IAAA,mBAAS,EAAC;YACrC,OAAO,EAAP,yBAAO;YACP,eAAe,EAAE;gBACf,SAAS,EAAE,uBAAuB;gBAClC,SAAS,EAAE,aAAa;aACzB;SACF,CAAC,CAAC;QAEH,MAAM,CAAC,iBAAW,CAAC,CAAC,gBAAgB,EAAE,CAAC;QACvC,MAAM,CAAC,cAAc,CAAC,CAAC,OAAO,iCACzB,uBAAuB,KAC1B,EAAE,EAAE,IAAA,6BAAiB,EAAC,yBAAO,CAAC,EAAE,EAAE,UAAU,EAAE,KAAK,CAAC,EACpD,IAAI,EAAE,UAAU,EAChB,aAAa,EAAE,EAAE,EACjB,aAAa,EAAE,EAAE,IACjB,CAAC;IACL,CAAC,CAAA,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createTransaction.unit.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/unit/createTransaction.unit.test.ts"],"names":[],"mappings":""}
|