@ledgerhq/coin-hedera 1.10.1 → 1.11.0-nightly.2
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 +1 -0
- package/.turbo/turbo-build.log +1 -1
- package/CHANGELOG.md +37 -12
- package/lib/api/mirror.d.ts +3 -20
- package/lib/api/mirror.d.ts.map +1 -1
- package/lib/api/mirror.js +32 -90
- package/lib/api/mirror.js.map +1 -1
- package/lib/api/mirror.test.js +59 -4
- package/lib/api/mirror.test.js.map +1 -1
- package/lib/api/network.d.ts +3 -3
- package/lib/api/network.d.ts.map +1 -1
- package/lib/api/network.js +46 -3
- package/lib/api/network.js.map +1 -1
- package/lib/api/types.d.ts +44 -0
- package/lib/api/types.d.ts.map +1 -0
- package/lib/api/types.js +3 -0
- package/lib/api/types.js.map +1 -0
- package/lib/api/utils.d.ts +8 -0
- package/lib/api/utils.d.ts.map +1 -0
- package/lib/api/utils.js +132 -0
- package/lib/api/utils.js.map +1 -0
- package/lib/bridge/broadcast.d.ts.map +1 -1
- package/lib/bridge/broadcast.js +2 -0
- package/lib/bridge/broadcast.js.map +1 -1
- package/lib/bridge/buildOptimisticOperation.d.ts +2 -2
- package/lib/bridge/buildOptimisticOperation.d.ts.map +1 -1
- package/lib/bridge/buildOptimisticOperation.integration.test.d.ts +2 -0
- package/lib/bridge/buildOptimisticOperation.integration.test.d.ts.map +1 -0
- package/lib/bridge/buildOptimisticOperation.integration.test.js +82 -0
- package/lib/bridge/buildOptimisticOperation.integration.test.js.map +1 -0
- package/lib/bridge/buildOptimisticOperation.js +87 -5
- package/lib/bridge/buildOptimisticOperation.js.map +1 -1
- package/lib/bridge/estimateMaxSpendable.d.ts.map +1 -1
- package/lib/bridge/estimateMaxSpendable.js +8 -2
- package/lib/bridge/estimateMaxSpendable.js.map +1 -1
- package/lib/bridge/getTransactionStatus.d.ts +3 -3
- package/lib/bridge/getTransactionStatus.d.ts.map +1 -1
- package/lib/bridge/getTransactionStatus.js +116 -23
- package/lib/bridge/getTransactionStatus.js.map +1 -1
- package/lib/bridge/getTransactionStatus.test.d.ts +2 -0
- package/lib/bridge/getTransactionStatus.test.d.ts.map +1 -0
- package/lib/bridge/getTransactionStatus.test.js +176 -0
- package/lib/bridge/getTransactionStatus.test.js.map +1 -0
- package/lib/bridge/index.d.ts +4 -4
- package/lib/bridge/index.d.ts.map +1 -1
- package/lib/bridge/index.js +9 -6
- package/lib/bridge/index.js.map +1 -1
- package/lib/bridge/js-estimateMaxSpendable.integration.test.js +28 -44
- package/lib/bridge/js-estimateMaxSpendable.integration.test.js.map +1 -1
- package/lib/bridge/js-transaction.test.js +10 -49
- package/lib/bridge/js-transaction.test.js.map +1 -1
- package/lib/bridge/prepareTransaction.d.ts +0 -1
- package/lib/bridge/prepareTransaction.d.ts.map +1 -1
- package/lib/bridge/prepareTransaction.js +0 -1
- package/lib/bridge/prepareTransaction.js.map +1 -1
- package/lib/bridge/serialization.d.ts +7 -0
- package/lib/bridge/serialization.d.ts.map +1 -0
- package/lib/bridge/serialization.js +36 -0
- package/lib/bridge/serialization.js.map +1 -0
- package/lib/bridge/serialization.test.d.ts +2 -0
- package/lib/bridge/serialization.test.d.ts.map +1 -0
- package/lib/bridge/serialization.test.js +27 -0
- package/lib/bridge/serialization.test.js.map +1 -0
- package/lib/bridge/synchronisation.d.ts +3 -3
- package/lib/bridge/synchronisation.d.ts.map +1 -1
- package/lib/bridge/synchronisation.js +37 -15
- package/lib/bridge/synchronisation.js.map +1 -1
- package/lib/bridge/transaction.test.js +18 -59
- package/lib/bridge/transaction.test.js.map +1 -1
- package/lib/bridge/utils.d.ts +22 -8
- package/lib/bridge/utils.d.ts.map +1 -1
- package/lib/bridge/utils.integration.test.js +415 -73
- package/lib/bridge/utils.integration.test.js.map +1 -1
- package/lib/bridge/utils.js +300 -15
- package/lib/bridge/utils.js.map +1 -1
- package/lib/constants.d.ts +32 -0
- package/lib/constants.d.ts.map +1 -0
- package/lib/constants.js +37 -0
- package/lib/constants.js.map +1 -0
- package/lib/deviceTransactionConfig.d.ts.map +1 -1
- package/lib/deviceTransactionConfig.js +17 -15
- package/lib/deviceTransactionConfig.js.map +1 -1
- package/lib/logic.d.ts +9 -3
- package/lib/logic.d.ts.map +1 -1
- package/lib/logic.js +31 -3
- package/lib/logic.js.map +1 -1
- package/lib/logic.test.js +103 -50
- package/lib/logic.test.js.map +1 -1
- package/lib/test/fixtures/account.fixture.d.ts +19 -0
- package/lib/test/fixtures/account.fixture.d.ts.map +1 -0
- package/lib/test/fixtures/account.fixture.js +116 -0
- package/lib/test/fixtures/account.fixture.js.map +1 -0
- package/lib/test/fixtures/currency.fixture.d.ts +5 -0
- package/lib/test/fixtures/currency.fixture.d.ts.map +1 -0
- package/lib/test/fixtures/currency.fixture.js +67 -0
- package/lib/test/fixtures/currency.fixture.js.map +1 -0
- package/lib/test/fixtures/mirror.fixture.d.ts +3 -0
- package/lib/test/fixtures/mirror.fixture.d.ts.map +1 -0
- package/lib/test/fixtures/mirror.fixture.js +17 -0
- package/lib/test/fixtures/mirror.fixture.js.map +1 -0
- package/lib/test/fixtures/operation.fixture.d.ts +3 -0
- package/lib/test/fixtures/operation.fixture.d.ts.map +1 -0
- package/lib/test/fixtures/operation.fixture.js +26 -0
- package/lib/test/fixtures/operation.fixture.js.map +1 -0
- package/lib/test/fixtures/transaction.fixture.d.ts +4 -0
- package/lib/test/fixtures/transaction.fixture.d.ts.map +1 -0
- package/lib/test/fixtures/transaction.fixture.js +28 -0
- package/lib/test/fixtures/transaction.fixture.js.map +1 -0
- package/lib/types/bridge.d.ts +25 -1
- package/lib/types/bridge.d.ts.map +1 -1
- package/lib-es/api/mirror.d.ts +3 -20
- package/lib-es/api/mirror.d.ts.map +1 -1
- package/lib-es/api/mirror.js +29 -88
- package/lib-es/api/mirror.js.map +1 -1
- package/lib-es/api/mirror.test.js +60 -5
- package/lib-es/api/mirror.test.js.map +1 -1
- package/lib-es/api/network.d.ts +3 -3
- package/lib-es/api/network.d.ts.map +1 -1
- package/lib-es/api/network.js +44 -4
- package/lib-es/api/network.js.map +1 -1
- package/lib-es/api/types.d.ts +44 -0
- package/lib-es/api/types.d.ts.map +1 -0
- package/lib-es/api/types.js +2 -0
- package/lib-es/api/types.js.map +1 -0
- package/lib-es/api/utils.d.ts +8 -0
- package/lib-es/api/utils.d.ts.map +1 -0
- package/lib-es/api/utils.js +124 -0
- package/lib-es/api/utils.js.map +1 -0
- package/lib-es/bridge/broadcast.d.ts.map +1 -1
- package/lib-es/bridge/broadcast.js +2 -0
- package/lib-es/bridge/broadcast.js.map +1 -1
- package/lib-es/bridge/buildOptimisticOperation.d.ts +2 -2
- package/lib-es/bridge/buildOptimisticOperation.d.ts.map +1 -1
- package/lib-es/bridge/buildOptimisticOperation.integration.test.d.ts +2 -0
- package/lib-es/bridge/buildOptimisticOperation.integration.test.d.ts.map +1 -0
- package/lib-es/bridge/buildOptimisticOperation.integration.test.js +77 -0
- package/lib-es/bridge/buildOptimisticOperation.integration.test.js.map +1 -0
- package/lib-es/bridge/buildOptimisticOperation.js +84 -5
- package/lib-es/bridge/buildOptimisticOperation.js.map +1 -1
- package/lib-es/bridge/estimateMaxSpendable.d.ts.map +1 -1
- package/lib-es/bridge/estimateMaxSpendable.js +8 -2
- package/lib-es/bridge/estimateMaxSpendable.js.map +1 -1
- package/lib-es/bridge/getTransactionStatus.d.ts +3 -3
- package/lib-es/bridge/getTransactionStatus.d.ts.map +1 -1
- package/lib-es/bridge/getTransactionStatus.js +114 -24
- package/lib-es/bridge/getTransactionStatus.js.map +1 -1
- package/lib-es/bridge/getTransactionStatus.test.d.ts +2 -0
- package/lib-es/bridge/getTransactionStatus.test.d.ts.map +1 -0
- package/lib-es/bridge/getTransactionStatus.test.js +148 -0
- package/lib-es/bridge/getTransactionStatus.test.js.map +1 -0
- package/lib-es/bridge/index.d.ts +4 -4
- package/lib-es/bridge/index.d.ts.map +1 -1
- package/lib-es/bridge/index.js +9 -6
- package/lib-es/bridge/index.js.map +1 -1
- package/lib-es/bridge/js-estimateMaxSpendable.integration.test.js +28 -44
- package/lib-es/bridge/js-estimateMaxSpendable.integration.test.js.map +1 -1
- package/lib-es/bridge/js-transaction.test.js +10 -49
- package/lib-es/bridge/js-transaction.test.js.map +1 -1
- package/lib-es/bridge/prepareTransaction.d.ts +0 -1
- package/lib-es/bridge/prepareTransaction.d.ts.map +1 -1
- package/lib-es/bridge/prepareTransaction.js +0 -1
- package/lib-es/bridge/prepareTransaction.js.map +1 -1
- package/lib-es/bridge/serialization.d.ts +7 -0
- package/lib-es/bridge/serialization.d.ts.map +1 -0
- package/lib-es/bridge/serialization.js +29 -0
- package/lib-es/bridge/serialization.js.map +1 -0
- package/lib-es/bridge/serialization.test.d.ts +2 -0
- package/lib-es/bridge/serialization.test.d.ts.map +1 -0
- package/lib-es/bridge/serialization.test.js +25 -0
- package/lib-es/bridge/serialization.test.js.map +1 -0
- package/lib-es/bridge/synchronisation.d.ts +3 -3
- package/lib-es/bridge/synchronisation.d.ts.map +1 -1
- package/lib-es/bridge/synchronisation.js +39 -17
- package/lib-es/bridge/synchronisation.js.map +1 -1
- package/lib-es/bridge/transaction.test.js +18 -59
- package/lib-es/bridge/transaction.test.js.map +1 -1
- package/lib-es/bridge/utils.d.ts +22 -8
- package/lib-es/bridge/utils.d.ts.map +1 -1
- package/lib-es/bridge/utils.integration.test.js +416 -74
- package/lib-es/bridge/utils.integration.test.js.map +1 -1
- package/lib-es/bridge/utils.js +295 -15
- package/lib-es/bridge/utils.js.map +1 -1
- package/lib-es/constants.d.ts +32 -0
- package/lib-es/constants.d.ts.map +1 -0
- package/lib-es/constants.js +34 -0
- package/lib-es/constants.js.map +1 -0
- package/lib-es/deviceTransactionConfig.d.ts.map +1 -1
- package/lib-es/deviceTransactionConfig.js +17 -15
- package/lib-es/deviceTransactionConfig.js.map +1 -1
- package/lib-es/logic.d.ts +9 -3
- package/lib-es/logic.d.ts.map +1 -1
- package/lib-es/logic.js +26 -3
- package/lib-es/logic.js.map +1 -1
- package/lib-es/logic.test.js +104 -51
- package/lib-es/logic.test.js.map +1 -1
- package/lib-es/test/fixtures/account.fixture.d.ts +19 -0
- package/lib-es/test/fixtures/account.fixture.d.ts.map +1 -0
- package/lib-es/test/fixtures/account.fixture.js +107 -0
- package/lib-es/test/fixtures/account.fixture.js.map +1 -0
- package/lib-es/test/fixtures/currency.fixture.d.ts +5 -0
- package/lib-es/test/fixtures/currency.fixture.d.ts.map +1 -0
- package/lib-es/test/fixtures/currency.fixture.js +58 -0
- package/lib-es/test/fixtures/currency.fixture.js.map +1 -0
- package/lib-es/test/fixtures/mirror.fixture.d.ts +3 -0
- package/lib-es/test/fixtures/mirror.fixture.d.ts.map +1 -0
- package/lib-es/test/fixtures/mirror.fixture.js +13 -0
- package/lib-es/test/fixtures/mirror.fixture.js.map +1 -0
- package/lib-es/test/fixtures/operation.fixture.d.ts +3 -0
- package/lib-es/test/fixtures/operation.fixture.d.ts.map +1 -0
- package/lib-es/test/fixtures/operation.fixture.js +19 -0
- package/lib-es/test/fixtures/operation.fixture.js.map +1 -0
- package/lib-es/test/fixtures/transaction.fixture.d.ts +4 -0
- package/lib-es/test/fixtures/transaction.fixture.d.ts.map +1 -0
- package/lib-es/test/fixtures/transaction.fixture.js +20 -0
- package/lib-es/test/fixtures/transaction.fixture.js.map +1 -0
- package/lib-es/types/bridge.d.ts +25 -1
- package/lib-es/types/bridge.d.ts.map +1 -1
- package/package.json +12 -10
- package/src/api/mirror.test.ts +79 -5
- package/src/api/mirror.ts +30 -111
- package/src/api/network.ts +71 -4
- package/src/api/types.ts +48 -0
- package/src/api/utils.ts +150 -0
- package/src/bridge/broadcast.ts +2 -0
- package/src/bridge/buildOptimisticOperation.integration.test.ts +88 -0
- package/src/bridge/buildOptimisticOperation.ts +118 -7
- package/src/bridge/estimateMaxSpendable.ts +8 -2
- package/src/bridge/getTransactionStatus.test.ts +200 -0
- package/src/bridge/getTransactionStatus.ts +166 -32
- package/src/bridge/index.ts +13 -10
- package/src/bridge/js-estimateMaxSpendable.integration.test.ts +37 -46
- package/src/bridge/js-transaction.test.ts +13 -54
- package/src/bridge/prepareTransaction.ts +1 -2
- package/src/bridge/serialization.test.ts +39 -0
- package/src/bridge/serialization.ts +43 -0
- package/src/bridge/synchronisation.ts +65 -27
- package/src/bridge/transaction.test.ts +22 -64
- package/src/bridge/utils.integration.test.ts +525 -76
- package/src/bridge/utils.ts +423 -24
- package/src/constants.ts +35 -0
- package/src/deviceTransactionConfig.ts +16 -15
- package/src/logic.test.ts +147 -57
- package/src/logic.ts +58 -7
- package/src/test/fixtures/account.fixture.ts +123 -0
- package/src/test/fixtures/currency.fixture.ts +66 -0
- package/src/test/fixtures/mirror.fixture.ts +14 -0
- package/src/test/fixtures/operation.fixture.ts +20 -0
- package/src/test/fixtures/transaction.fixture.ts +22 -0
- package/src/types/bridge.ts +33 -0
package/lib/logic.test.js
CHANGED
|
@@ -1,58 +1,111 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const bignumber_js_1 = require("bignumber.js");
|
|
4
3
|
const cryptoassets_1 = require("@ledgerhq/cryptoassets");
|
|
5
4
|
const logic_1 = require("./logic");
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
5
|
+
const account_fixture_1 = require("./test/fixtures/account.fixture");
|
|
6
|
+
const operation_fixture_1 = require("./test/fixtures/operation.fixture");
|
|
7
|
+
const currency_fixture_1 = require("./test/fixtures/currency.fixture");
|
|
8
|
+
const constants_1 = require("./constants");
|
|
9
|
+
describe("logic", () => {
|
|
10
|
+
describe("getTransactionExplorer", () => {
|
|
11
|
+
test("Tx explorer URL is converted from hash to consensus timestamp", async () => {
|
|
12
|
+
const explorerView = (0, cryptoassets_1.getCryptoCurrencyById)("hedera").explorerViews[0];
|
|
13
|
+
expect(explorerView).toEqual({
|
|
14
|
+
tx: expect.any(String),
|
|
15
|
+
address: expect.any(String),
|
|
16
|
+
});
|
|
17
|
+
const mockedOperation = (0, operation_fixture_1.getMockedOperation)({
|
|
18
|
+
extra: { consensusTimestamp: "1.2.3.4" },
|
|
19
|
+
});
|
|
20
|
+
const newUrl = (0, logic_1.getTransactionExplorer)(explorerView, mockedOperation);
|
|
21
|
+
expect(newUrl).toBe("https://hashscan.io/mainnet/transaction/1.2.3.4");
|
|
22
|
+
});
|
|
23
|
+
test("Tx explorer URL is based on transaction id if consensus timestamp is not available", async () => {
|
|
24
|
+
const explorerView = (0, cryptoassets_1.getCryptoCurrencyById)("hedera").explorerViews[0];
|
|
25
|
+
expect(explorerView).toEqual({
|
|
26
|
+
tx: expect.any(String),
|
|
27
|
+
address: expect.any(String),
|
|
28
|
+
});
|
|
29
|
+
const mockedOperation = (0, operation_fixture_1.getMockedOperation)({
|
|
30
|
+
extra: { transactionId: "0.0.1234567-123-123" },
|
|
31
|
+
});
|
|
32
|
+
const newUrl = (0, logic_1.getTransactionExplorer)(explorerView, mockedOperation);
|
|
33
|
+
expect(newUrl).toBe("https://hashscan.io/mainnet/transaction/0.0.1234567-123-123");
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
describe("isTokenAssociateTransaction", () => {
|
|
37
|
+
test("returns correct value based on tx.properties", () => {
|
|
38
|
+
expect((0, logic_1.isTokenAssociateTransaction)({
|
|
39
|
+
properties: { name: constants_1.HEDERA_TRANSACTION_KINDS.TokenAssociate.name },
|
|
40
|
+
})).toBe(true);
|
|
41
|
+
expect((0, logic_1.isTokenAssociateTransaction)({
|
|
42
|
+
properties: { name: "transfer" },
|
|
43
|
+
})).toBe(false);
|
|
44
|
+
expect((0, logic_1.isTokenAssociateTransaction)({})).toBe(false);
|
|
45
|
+
});
|
|
31
46
|
});
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
47
|
+
describe("isAutoTokenAssociationEnabled", () => {
|
|
48
|
+
test("returns value based on isAutoTokenAssociationEnabled flag", () => {
|
|
49
|
+
expect((0, logic_1.isAutoTokenAssociationEnabled)({
|
|
50
|
+
hederaResources: { isAutoTokenAssociationEnabled: true },
|
|
51
|
+
})).toBe(true);
|
|
52
|
+
expect((0, logic_1.isAutoTokenAssociationEnabled)({
|
|
53
|
+
hederaResources: { isAutoTokenAssociationEnabled: false },
|
|
54
|
+
})).toBe(false);
|
|
55
|
+
expect((0, logic_1.isAutoTokenAssociationEnabled)({})).toBe(false);
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
describe("isTokenAssociationRequired", () => {
|
|
59
|
+
test("should return false if token is already associated (token account exists)", () => {
|
|
60
|
+
const mockedTokenCurrency = (0, currency_fixture_1.getMockedTokenCurrency)();
|
|
61
|
+
const mockedTokenAccount = (0, account_fixture_1.getMockedTokenAccount)(mockedTokenCurrency);
|
|
62
|
+
const mockedAccount = (0, account_fixture_1.getMockedAccount)({ subAccounts: [mockedTokenAccount] });
|
|
63
|
+
expect((0, logic_1.isTokenAssociationRequired)(mockedAccount, mockedTokenCurrency)).toBe(false);
|
|
64
|
+
});
|
|
65
|
+
test("should return false if auto token associations are enabled", () => {
|
|
66
|
+
const mockedTokenCurrency = (0, currency_fixture_1.getMockedTokenCurrency)();
|
|
67
|
+
const mockedAccount = (0, account_fixture_1.getMockedAccount)({
|
|
68
|
+
subAccounts: [],
|
|
69
|
+
hederaResources: {
|
|
70
|
+
maxAutomaticTokenAssociations: -1,
|
|
71
|
+
isAutoTokenAssociationEnabled: true,
|
|
72
|
+
},
|
|
73
|
+
});
|
|
74
|
+
expect((0, logic_1.isTokenAssociationRequired)(mockedAccount, mockedTokenCurrency)).toBe(false);
|
|
75
|
+
});
|
|
76
|
+
test("should return true if token is not associated and auto associations are disabled", () => {
|
|
77
|
+
const mockedTokenCurrency = (0, currency_fixture_1.getMockedTokenCurrency)();
|
|
78
|
+
const mockedAccount = (0, account_fixture_1.getMockedAccount)({ subAccounts: [] });
|
|
79
|
+
expect((0, logic_1.isTokenAssociationRequired)(mockedAccount, mockedTokenCurrency)).toBe(true);
|
|
80
|
+
});
|
|
81
|
+
test("should return false if token is undefined", () => {
|
|
82
|
+
const mockedAccount = (0, account_fixture_1.getMockedAccount)({ subAccounts: [] });
|
|
83
|
+
expect((0, logic_1.isTokenAssociationRequired)(mockedAccount, undefined)).toBe(false);
|
|
84
|
+
});
|
|
85
|
+
test("should return false for legacy accounts without subAccounts or hederaResources", () => {
|
|
86
|
+
const mockedTokenCurrency = (0, currency_fixture_1.getMockedTokenCurrency)();
|
|
87
|
+
const mockedAccount = (0, account_fixture_1.getMockedAccount)();
|
|
88
|
+
delete mockedAccount.subAccounts;
|
|
89
|
+
delete mockedAccount.hederaResources;
|
|
90
|
+
expect((0, logic_1.isTokenAssociationRequired)(mockedAccount, mockedTokenCurrency)).toBe(true);
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
describe("isValidExtra", () => {
|
|
94
|
+
test("returns true for object and false for invalid types", () => {
|
|
95
|
+
expect((0, logic_1.isValidExtra)({ some: "value" })).toBe(true);
|
|
96
|
+
expect((0, logic_1.isValidExtra)(null)).toBe(false);
|
|
97
|
+
expect((0, logic_1.isValidExtra)(undefined)).toBe(false);
|
|
98
|
+
expect((0, logic_1.isValidExtra)("string")).toBe(false);
|
|
99
|
+
expect((0, logic_1.isValidExtra)(123)).toBe(false);
|
|
100
|
+
expect((0, logic_1.isValidExtra)([])).toBe(false);
|
|
101
|
+
});
|
|
102
|
+
});
|
|
103
|
+
describe("sendRecipientCanNext", () => {
|
|
104
|
+
test("handles association warnings", () => {
|
|
105
|
+
expect((0, logic_1.sendRecipientCanNext)({ warnings: {} })).toBe(true);
|
|
106
|
+
expect((0, logic_1.sendRecipientCanNext)({ warnings: { missingAssociation: new Error() } })).toBe(false);
|
|
107
|
+
expect((0, logic_1.sendRecipientCanNext)({ warnings: { unverifiedAssociation: new Error() } })).toBe(false);
|
|
108
|
+
});
|
|
56
109
|
});
|
|
57
110
|
});
|
|
58
111
|
//# sourceMappingURL=logic.test.js.map
|
package/lib/logic.test.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logic.test.js","sourceRoot":"","sources":["../src/logic.test.ts"],"names":[],"mappings":";;AAAA
|
|
1
|
+
{"version":3,"file":"logic.test.js","sourceRoot":"","sources":["../src/logic.test.ts"],"names":[],"mappings":";;AAAA,yDAA+D;AAC/D,mCAOiB;AACjB,qEAA0F;AAC1F,yEAAuE;AACvE,uEAA0E;AAC1E,2CAAuD;AAEvD,QAAQ,CAAC,OAAO,EAAE,GAAG,EAAE;IACrB,QAAQ,CAAC,wBAAwB,EAAE,GAAG,EAAE;QACtC,IAAI,CAAC,+DAA+D,EAAE,KAAK,IAAI,EAAE;YAC/E,MAAM,YAAY,GAAG,IAAA,oCAAqB,EAAC,QAAQ,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;YACtE,MAAM,CAAC,YAAY,CAAC,CAAC,OAAO,CAAC;gBAC3B,EAAE,EAAE,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC;gBACtB,OAAO,EAAE,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC;aAC5B,CAAC,CAAC;YAEH,MAAM,eAAe,GAAG,IAAA,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AS,CAAC,CAClF,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAChB,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { HederaAccount, HederaAccountRaw, HederaResources, HederaResourcesRaw } from "../../types";
|
|
2
|
+
import type { TokenAccount } from "@ledgerhq/types-live";
|
|
3
|
+
import { TokenCurrency } from "@ledgerhq/types-cryptoassets";
|
|
4
|
+
export declare const mockHederaResources: HederaResources;
|
|
5
|
+
export declare const mockHederaResourcesRaw: HederaResourcesRaw;
|
|
6
|
+
/**
|
|
7
|
+
* default settings:
|
|
8
|
+
* - account balance is 1 HBAR
|
|
9
|
+
* - auto token association is disabled
|
|
10
|
+
* - subAccounts array is empty (no tokens account are used)
|
|
11
|
+
*/
|
|
12
|
+
export declare const getMockedAccount: (overrides?: Partial<HederaAccount>) => HederaAccount;
|
|
13
|
+
export declare const getMockedAccountRaw: (overrides?: Partial<HederaAccountRaw>) => HederaAccountRaw;
|
|
14
|
+
/**
|
|
15
|
+
* default settings:
|
|
16
|
+
* - balance is 10
|
|
17
|
+
*/
|
|
18
|
+
export declare const getMockedTokenAccount: (token: TokenCurrency, overrides?: Partial<TokenAccount>) => TokenAccount;
|
|
19
|
+
//# sourceMappingURL=account.fixture.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"account.fixture.d.ts","sourceRoot":"","sources":["../../../src/test/fixtures/account.fixture.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,kBAAkB,EACnB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEzD,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAS7D,eAAO,MAAM,mBAAmB,EAAE,eAGjC,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,kBAGpC,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,eAAgB,QAAQ,aAAa,CAAC,KAAG,aA6BrE,CAAC;AAEF,eAAO,MAAM,mBAAmB,eAAgB,QAAQ,gBAAgB,CAAC,KAAG,gBA4B3E,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,qBAAqB,UACzB,aAAa,cACR,QAAQ,YAAY,CAAC,KAChC,YAoBF,CAAC"}
|
|
@@ -0,0 +1,116 @@
|
|
|
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.getMockedTokenAccount = exports.getMockedAccountRaw = exports.getMockedAccount = exports.mockHederaResourcesRaw = exports.mockHederaResources = void 0;
|
|
7
|
+
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
|
8
|
+
const currency_fixture_1 = require("./currency.fixture");
|
|
9
|
+
const defaultMockedCurrency = (0, currency_fixture_1.getMockedCurrency)();
|
|
10
|
+
const defaultMockedTokenCurrency = (0, currency_fixture_1.getMockedTokenCurrency)();
|
|
11
|
+
const defaultMockAccountId = "js:2:hedera:0.0.1234567:hederaBip44";
|
|
12
|
+
const defaultMockTokenAccountId = `${defaultMockAccountId}+${defaultMockedTokenCurrency.id}`;
|
|
13
|
+
const defaultBalance = new bignumber_js_1.default(100000000);
|
|
14
|
+
const defaultTokenBalance = new bignumber_js_1.default(10);
|
|
15
|
+
exports.mockHederaResources = {
|
|
16
|
+
maxAutomaticTokenAssociations: 0,
|
|
17
|
+
isAutoTokenAssociationEnabled: false,
|
|
18
|
+
};
|
|
19
|
+
exports.mockHederaResourcesRaw = {
|
|
20
|
+
maxAutomaticTokenAssociations: 0,
|
|
21
|
+
isAutoTokenAssociationEnabled: false,
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* default settings:
|
|
25
|
+
* - account balance is 1 HBAR
|
|
26
|
+
* - auto token association is disabled
|
|
27
|
+
* - subAccounts array is empty (no tokens account are used)
|
|
28
|
+
*/
|
|
29
|
+
const getMockedAccount = (overrides) => {
|
|
30
|
+
return {
|
|
31
|
+
type: "Account",
|
|
32
|
+
id: defaultMockAccountId,
|
|
33
|
+
seedIdentifier: "",
|
|
34
|
+
derivationMode: "",
|
|
35
|
+
index: 0,
|
|
36
|
+
freshAddress: "0.0.12345",
|
|
37
|
+
freshAddressPath: "44/3030",
|
|
38
|
+
used: false,
|
|
39
|
+
balance: defaultBalance,
|
|
40
|
+
spendableBalance: defaultBalance,
|
|
41
|
+
creationDate: new Date(),
|
|
42
|
+
blockHeight: 0,
|
|
43
|
+
currency: defaultMockedCurrency,
|
|
44
|
+
operationsCount: 0,
|
|
45
|
+
operations: [],
|
|
46
|
+
pendingOperations: [],
|
|
47
|
+
lastSyncDate: new Date(),
|
|
48
|
+
balanceHistoryCache: {
|
|
49
|
+
HOUR: { latestDate: null, balances: [] },
|
|
50
|
+
DAY: { latestDate: null, balances: [] },
|
|
51
|
+
WEEK: { latestDate: null, balances: [] },
|
|
52
|
+
},
|
|
53
|
+
swapHistory: [],
|
|
54
|
+
subAccounts: [],
|
|
55
|
+
hederaResources: exports.mockHederaResources,
|
|
56
|
+
...overrides,
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
exports.getMockedAccount = getMockedAccount;
|
|
60
|
+
const getMockedAccountRaw = (overrides) => {
|
|
61
|
+
return {
|
|
62
|
+
id: defaultMockAccountId,
|
|
63
|
+
seedIdentifier: "",
|
|
64
|
+
derivationMode: "",
|
|
65
|
+
index: 0,
|
|
66
|
+
freshAddress: "0.0.12345",
|
|
67
|
+
freshAddressPath: "44/3030",
|
|
68
|
+
used: false,
|
|
69
|
+
balance: defaultBalance.toString(),
|
|
70
|
+
spendableBalance: defaultBalance.toString(),
|
|
71
|
+
creationDate: new Date().toISOString(),
|
|
72
|
+
blockHeight: 0,
|
|
73
|
+
currencyId: defaultMockedCurrency.id,
|
|
74
|
+
operationsCount: 0,
|
|
75
|
+
operations: [],
|
|
76
|
+
pendingOperations: [],
|
|
77
|
+
lastSyncDate: new Date().toISOString(),
|
|
78
|
+
balanceHistoryCache: {
|
|
79
|
+
HOUR: { latestDate: null, balances: [] },
|
|
80
|
+
DAY: { latestDate: null, balances: [] },
|
|
81
|
+
WEEK: { latestDate: null, balances: [] },
|
|
82
|
+
},
|
|
83
|
+
swapHistory: [],
|
|
84
|
+
subAccounts: [],
|
|
85
|
+
hederaResources: exports.mockHederaResourcesRaw,
|
|
86
|
+
...overrides,
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
exports.getMockedAccountRaw = getMockedAccountRaw;
|
|
90
|
+
/**
|
|
91
|
+
* default settings:
|
|
92
|
+
* - balance is 10
|
|
93
|
+
*/
|
|
94
|
+
const getMockedTokenAccount = (token, overrides) => {
|
|
95
|
+
return {
|
|
96
|
+
type: "TokenAccount",
|
|
97
|
+
id: defaultMockTokenAccountId,
|
|
98
|
+
parentId: defaultMockAccountId,
|
|
99
|
+
token,
|
|
100
|
+
balance: defaultTokenBalance,
|
|
101
|
+
spendableBalance: defaultTokenBalance,
|
|
102
|
+
creationDate: new Date(),
|
|
103
|
+
operations: [],
|
|
104
|
+
operationsCount: 0,
|
|
105
|
+
pendingOperations: [],
|
|
106
|
+
swapHistory: [],
|
|
107
|
+
balanceHistoryCache: {
|
|
108
|
+
HOUR: { latestDate: null, balances: [] },
|
|
109
|
+
DAY: { latestDate: null, balances: [] },
|
|
110
|
+
WEEK: { latestDate: null, balances: [] },
|
|
111
|
+
},
|
|
112
|
+
...overrides,
|
|
113
|
+
};
|
|
114
|
+
};
|
|
115
|
+
exports.getMockedTokenAccount = getMockedTokenAccount;
|
|
116
|
+
//# sourceMappingURL=account.fixture.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"account.fixture.js","sourceRoot":"","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AAC,CAAC;AA5BW,QAAA,mBAAmB,uBA4B9B;AAEF;;;GAGG;AACI,MAAM,qBAAqB,GAAG,CACnC,KAAoB,EACpB,SAAiC,EACnB,EAAE;IAChB,OAAO;QACL,IAAI,EAAE,cAAc;QACpB,EAAE,EAAE,yBAAyB;QAC7B,QAAQ,EAAE,oBAAoB;QAC9B,KAAK;QACL,OAAO,EAAE,mBAAmB;QAC5B,gBAAgB,EAAE,mBAAmB;QACrC,YAAY,EAAE,IAAI,IAAI,EAAE;QACxB,UAAU,EAAE,EAAE;QACd,eAAe,EAAE,CAAC;QAClB,iBAAiB,EAAE,EAAE;QACrB,WAAW,EAAE,EAAE;QACf,mBAAmB,EAAE;YACnB,IAAI,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE;YACxC,GAAG,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE;YACvC,IAAI,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE;SACzC;QACD,GAAG,SAAS;KACb,CAAC;AACJ,CAAC,CAAC;AAvBW,QAAA,qBAAqB,yBAuBhC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { CryptoCurrency, TokenCurrency } from "@ledgerhq/types-cryptoassets";
|
|
2
|
+
export declare const getMockedCurrency: (overrides?: Partial<CryptoCurrency>) => CryptoCurrency;
|
|
3
|
+
export declare const getTokenCurrencyFromCAL: (index: number, overrides?: Partial<TokenCurrency>) => TokenCurrency;
|
|
4
|
+
export declare const getMockedTokenCurrency: (overrides?: Partial<TokenCurrency>) => TokenCurrency;
|
|
5
|
+
//# sourceMappingURL=currency.fixture.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"currency.fixture.d.ts","sourceRoot":"","sources":["../../../src/test/fixtures/currency.fixture.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAGlF,eAAO,MAAM,iBAAiB,eAAgB,QAAQ,cAAc,CAAC,KAAG,cA0BvE,CAAC;AAEF,eAAO,MAAM,uBAAuB,UAC3B,MAAM,cACD,QAAQ,aAAa,CAAC,KACjC,aAUF,CAAC;AAEF,eAAO,MAAM,sBAAsB,eAAgB,QAAQ,aAAa,CAAC,KAAG,aAkB3E,CAAC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
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.getMockedTokenCurrency = exports.getTokenCurrencyFromCAL = exports.getMockedCurrency = void 0;
|
|
7
|
+
const cryptoassets_1 = require("@ledgerhq/cryptoassets");
|
|
8
|
+
const invariant_1 = __importDefault(require("invariant"));
|
|
9
|
+
const getMockedCurrency = (overrides) => {
|
|
10
|
+
return {
|
|
11
|
+
type: "CryptoCurrency",
|
|
12
|
+
id: "hedera",
|
|
13
|
+
managerAppName: "Hedera",
|
|
14
|
+
coinType: 3030,
|
|
15
|
+
scheme: "hedera",
|
|
16
|
+
color: "#000",
|
|
17
|
+
family: "hedera",
|
|
18
|
+
explorerViews: [
|
|
19
|
+
{
|
|
20
|
+
tx: "https://hashscan.io/mainnet/transaction/$hash",
|
|
21
|
+
address: "https://hashscan.io/mainnet/account/$address",
|
|
22
|
+
},
|
|
23
|
+
],
|
|
24
|
+
name: "Hedera",
|
|
25
|
+
ticker: "HBAR",
|
|
26
|
+
units: [
|
|
27
|
+
{
|
|
28
|
+
name: "HBAR",
|
|
29
|
+
code: "HBAR",
|
|
30
|
+
magnitude: 8,
|
|
31
|
+
},
|
|
32
|
+
],
|
|
33
|
+
...overrides,
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
exports.getMockedCurrency = getMockedCurrency;
|
|
37
|
+
const getTokenCurrencyFromCAL = (index, overrides) => {
|
|
38
|
+
const hedera = (0, cryptoassets_1.getCryptoCurrencyById)("hedera");
|
|
39
|
+
const token = (0, cryptoassets_1.listTokensForCryptoCurrency)(hedera)[index];
|
|
40
|
+
(0, invariant_1.default)(token, `token not found in CAL list on ${index} position`);
|
|
41
|
+
return {
|
|
42
|
+
...token,
|
|
43
|
+
...overrides,
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
exports.getTokenCurrencyFromCAL = getTokenCurrencyFromCAL;
|
|
47
|
+
const getMockedTokenCurrency = (overrides) => {
|
|
48
|
+
return {
|
|
49
|
+
id: "hedera/hts/test_0.0.1234567",
|
|
50
|
+
contractAddress: "0.0.1001",
|
|
51
|
+
parentCurrency: (0, exports.getMockedCurrency)(),
|
|
52
|
+
tokenType: "hts",
|
|
53
|
+
name: "Test token",
|
|
54
|
+
ticker: "TEST",
|
|
55
|
+
type: "TokenCurrency",
|
|
56
|
+
units: [
|
|
57
|
+
{
|
|
58
|
+
name: "Test",
|
|
59
|
+
code: "TEST",
|
|
60
|
+
magnitude: 8,
|
|
61
|
+
},
|
|
62
|
+
],
|
|
63
|
+
...overrides,
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
exports.getMockedTokenCurrency = getMockedTokenCurrency;
|
|
67
|
+
//# sourceMappingURL=currency.fixture.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"currency.fixture.js","sourceRoot":"","sources":["../../../src/test/fixtures/currency.fixture.ts"],"names":[],"mappings":";;;;;;AAAA,yDAA4F;AAE5F,0DAAkC;AAE3B,MAAM,iBAAiB,GAAG,CAAC,SAAmC,EAAkB,EAAE;IACvF,OAAO;QACL,IAAI,EAAE,gBAAgB;QACtB,EAAE,EAAE,QAAQ;QACZ,cAAc,EAAE,QAAQ;QACxB,QAAQ,EAAE,IAAI;QACd,MAAM,EAAE,QAAQ;QAChB,KAAK,EAAE,MAAM;QACb,MAAM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../src/test/fixtures/mirror.fixture.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEpD,eAAO,MAAM,oBAAoB,eAAgB,QAAQ,iBAAiB,CAAC,KAAG,iBAW7E,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getMockedMirrorToken = void 0;
|
|
4
|
+
const getMockedMirrorToken = (overrides) => {
|
|
5
|
+
return {
|
|
6
|
+
token_id: "",
|
|
7
|
+
created_timestamp: "123",
|
|
8
|
+
automatic_association: false,
|
|
9
|
+
balance: 0,
|
|
10
|
+
decimals: 0,
|
|
11
|
+
freeze_status: "NOT_APPLICABLE",
|
|
12
|
+
kyc_status: "NOT_APPLICABLE",
|
|
13
|
+
...overrides,
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
exports.getMockedMirrorToken = getMockedMirrorToken;
|
|
17
|
+
//# sourceMappingURL=mirror.fixture.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mirror.fixture.js","sourceRoot":"","sources":["../../../src/test/fixtures/mirror.fixture.ts"],"names":[],"mappings":";;;AAEO,MAAM,oBAAoB,GAAG,CAAC,SAAsC,EAAqB,EAAE;IAChG,OAAO;QACL,QAAQ,EAAE,EAAE;QACZ,iBAAiB,EAAE,KAAK;QACxB,qBAAqB,EAAE,KAAK;QAC5B,OAAO,EAAE,CAAC;QACV,QAAQ,EAAE,CAAC;QACX,aAAa,EAAE,gBAAgB;QAC/B,UAAU,EAAE,gBAAgB;QAC5B,GAAG,SAAS;KACb,CAAC;AACJ,CAAC,CAAC;AAXW,QAAA,oBAAoB,wBAW/B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operation.fixture.d.ts","sourceRoot":"","sources":["../../../src/test/fixtures/operation.fixture.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD,eAAO,MAAM,kBAAkB,eAAgB,QAAQ,eAAe,CAAC,KAAG,eAgBzE,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
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.getMockedOperation = void 0;
|
|
7
|
+
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
|
8
|
+
const getMockedOperation = (overrides) => {
|
|
9
|
+
return {
|
|
10
|
+
id: "",
|
|
11
|
+
hash: "",
|
|
12
|
+
type: "IN",
|
|
13
|
+
value: new bignumber_js_1.default(0),
|
|
14
|
+
fee: new bignumber_js_1.default(0),
|
|
15
|
+
senders: [],
|
|
16
|
+
recipients: [],
|
|
17
|
+
blockHeight: undefined,
|
|
18
|
+
blockHash: undefined,
|
|
19
|
+
accountId: "",
|
|
20
|
+
date: new Date(),
|
|
21
|
+
extra: {},
|
|
22
|
+
...overrides,
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
exports.getMockedOperation = getMockedOperation;
|
|
26
|
+
//# sourceMappingURL=operation.fixture.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operation.fixture.js","sourceRoot":"","sources":["../../../src/test/fixtures/operation.fixture.ts"],"names":[],"mappings":";;;;;;AAAA,gEAAqC;AAG9B,MAAM,kBAAkB,GAAG,CAAC,SAAoC,EAAmB,EAAE;IAC1F,OAAO;QACL,EAAE,EAAE,EAAE;QACN,IAAI,EAAE,EAAE;QACR,IAAI,EAAE,IAAI;QACV,KAAK,EAAE,IAAI,sBAAS,CAAC,CAAC,CAAC;QACvB,GAAG,EAAE,IAAI,sBAAS,CAAC,CAAC,CAAC;QACrB,OAAO,EAAE,EAAE;QACX,UAAU,EAAE,EAAE;QACd,WAAW,EAAE,SAAS;QACtB,SAAS,EAAE,SAAS;QACpB,SAAS,EAAE,EAAE;QACb,IAAI,EAAE,IAAI,IAAI,EAAE;QAChB,KAAK,EAAE,EAAE;QACT,GAAG,SAAS;KACb,CAAC;AACJ,CAAC,CAAC;AAhBW,QAAA,kBAAkB,sBAgB7B"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { Transaction, TransactionRaw } from "../../types";
|
|
2
|
+
export declare const getMockedTransaction: (overrides?: Partial<Transaction>) => Transaction;
|
|
3
|
+
export declare const getMockedTransactionRaw: (overrides?: Partial<TransactionRaw>) => TransactionRaw;
|
|
4
|
+
//# sourceMappingURL=transaction.fixture.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transaction.fixture.d.ts","sourceRoot":"","sources":["../../../src/test/fixtures/transaction.fixture.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE/D,eAAO,MAAM,oBAAoB,eAAgB,QAAQ,WAAW,CAAC,KAAG,WAQvE,CAAC;AAEF,eAAO,MAAM,uBAAuB,eAAgB,QAAQ,cAAc,CAAC,KAAG,cAQ7E,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
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.getMockedTransactionRaw = exports.getMockedTransaction = void 0;
|
|
7
|
+
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
|
8
|
+
const getMockedTransaction = (overrides) => {
|
|
9
|
+
return {
|
|
10
|
+
family: "hedera",
|
|
11
|
+
amount: new bignumber_js_1.default(0),
|
|
12
|
+
recipient: "",
|
|
13
|
+
useAllAmount: false,
|
|
14
|
+
...overrides,
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
exports.getMockedTransaction = getMockedTransaction;
|
|
18
|
+
const getMockedTransactionRaw = (overrides) => {
|
|
19
|
+
return {
|
|
20
|
+
family: "hedera",
|
|
21
|
+
amount: "0",
|
|
22
|
+
recipient: "",
|
|
23
|
+
useAllAmount: false,
|
|
24
|
+
...overrides,
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
exports.getMockedTransactionRaw = getMockedTransactionRaw;
|
|
28
|
+
//# sourceMappingURL=transaction.fixture.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transaction.fixture.js","sourceRoot":"","sources":["../../../src/test/fixtures/transaction.fixture.ts"],"names":[],"mappings":";;;;;;AAAA,gEAAqC;AAG9B,MAAM,oBAAoB,GAAG,CAAC,SAAgC,EAAe,EAAE;IACpF,OAAO;QACL,MAAM,EAAE,QAAQ;QAChB,MAAM,EAAE,IAAI,sBAAS,CAAC,CAAC,CAAC;QACxB,SAAS,EAAE,EAAE;QACb,YAAY,EAAE,KAAK;QACnB,GAAG,SAAS;KACb,CAAC;AACJ,CAAC,CAAC;AARW,QAAA,oBAAoB,wBAQ/B;AAEK,MAAM,uBAAuB,GAAG,CAAC,SAAmC,EAAkB,EAAE;IAC7F,OAAO;QACL,MAAM,EAAE,QAAQ;QAChB,MAAM,EAAE,GAAG;QACX,SAAS,EAAE,EAAE;QACb,YAAY,EAAE,KAAK;QACnB,GAAG,SAAS;KACb,CAAC;AACJ,CAAC,CAAC;AARW,QAAA,uBAAuB,2BAQlC"}
|
package/lib/types/bridge.d.ts
CHANGED
|
@@ -1,22 +1,46 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { TokenCurrency } from "@ledgerhq/types-cryptoassets";
|
|
2
|
+
import type { Account, AccountRaw, Operation, TransactionCommon, TransactionCommonRaw, TransactionStatusCommon, TransactionStatusCommonRaw } from "@ledgerhq/types-live";
|
|
3
|
+
import { HEDERA_TRANSACTION_KINDS } from "../constants";
|
|
2
4
|
export type NetworkInfo = {
|
|
3
5
|
family: "hedera";
|
|
4
6
|
};
|
|
5
7
|
export type NetworkInfoRaw = {
|
|
6
8
|
family: "hedera";
|
|
7
9
|
};
|
|
10
|
+
export type TokenAssociateProperties = {
|
|
11
|
+
name: typeof HEDERA_TRANSACTION_KINDS.TokenAssociate.name;
|
|
12
|
+
token: TokenCurrency;
|
|
13
|
+
};
|
|
8
14
|
export type Transaction = TransactionCommon & {
|
|
9
15
|
family: "hedera";
|
|
10
16
|
memo?: string | undefined;
|
|
17
|
+
properties?: TokenAssociateProperties;
|
|
11
18
|
};
|
|
12
19
|
export type TransactionRaw = TransactionCommonRaw & {
|
|
13
20
|
family: "hedera";
|
|
14
21
|
memo?: string | undefined;
|
|
22
|
+
properties?: TokenAssociateProperties;
|
|
15
23
|
};
|
|
16
24
|
export type TransactionStatus = TransactionStatusCommon;
|
|
17
25
|
export type TransactionStatusRaw = TransactionStatusCommonRaw;
|
|
26
|
+
export interface HederaResources {
|
|
27
|
+
maxAutomaticTokenAssociations: number;
|
|
28
|
+
isAutoTokenAssociationEnabled: boolean;
|
|
29
|
+
}
|
|
30
|
+
export interface HederaResourcesRaw {
|
|
31
|
+
maxAutomaticTokenAssociations: number;
|
|
32
|
+
isAutoTokenAssociationEnabled: boolean;
|
|
33
|
+
}
|
|
34
|
+
export type HederaAccount = Account & {
|
|
35
|
+
hederaResources?: HederaResources;
|
|
36
|
+
};
|
|
37
|
+
export type HederaAccountRaw = AccountRaw & {
|
|
38
|
+
hederaResources?: HederaResourcesRaw;
|
|
39
|
+
};
|
|
18
40
|
export type HederaOperationExtra = {
|
|
19
41
|
consensusTimestamp?: string;
|
|
20
42
|
transactionId?: string;
|
|
43
|
+
associatedTokenId?: string;
|
|
21
44
|
};
|
|
45
|
+
export type HederaOperation = Operation<HederaOperationExtra>;
|
|
22
46
|
//# sourceMappingURL=bridge.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bridge.d.ts","sourceRoot":"","sources":["../../src/types/bridge.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,EACjB,oBAAoB,EACpB,uBAAuB,EACvB,0BAA0B,EAC3B,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"bridge.d.ts","sourceRoot":"","sources":["../../src/types/bridge.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,KAAK,EACV,OAAO,EACP,UAAU,EACV,SAAS,EACT,iBAAiB,EACjB,oBAAoB,EACpB,uBAAuB,EACvB,0BAA0B,EAC3B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAC;AAExD,MAAM,MAAM,WAAW,GAAG;IACxB,MAAM,EAAE,QAAQ,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,MAAM,EAAE,QAAQ,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG;IACrC,IAAI,EAAE,OAAO,wBAAwB,CAAC,cAAc,CAAC,IAAI,CAAC;IAC1D,KAAK,EAAE,aAAa,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG,iBAAiB,GAAG;IAC5C,MAAM,EAAE,QAAQ,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,UAAU,CAAC,EAAE,wBAAwB,CAAC;CACvC,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,oBAAoB,GAAG;IAClD,MAAM,EAAE,QAAQ,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,UAAU,CAAC,EAAE,wBAAwB,CAAC;CACvC,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG,uBAAuB,CAAC;AAExD,MAAM,MAAM,oBAAoB,GAAG,0BAA0B,CAAC;AAE9D,MAAM,WAAW,eAAe;IAC9B,6BAA6B,EAAE,MAAM,CAAC;IACtC,6BAA6B,EAAE,OAAO,CAAC;CACxC;AAED,MAAM,WAAW,kBAAkB;IACjC,6BAA6B,EAAE,MAAM,CAAC;IACtC,6BAA6B,EAAE,OAAO,CAAC;CACxC;AAED,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG;IACpC,eAAe,CAAC,EAAE,eAAe,CAAC;CACnC,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG,UAAU,GAAG;IAC1C,eAAe,CAAC,EAAE,kBAAkB,CAAC;CACtC,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG,SAAS,CAAC,oBAAoB,CAAC,CAAC"}
|
package/lib-es/api/mirror.d.ts
CHANGED
|
@@ -1,23 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Operation } from "@ledgerhq/types-live";
|
|
3
|
-
import BigNumber from "bignumber.js";
|
|
4
|
-
interface HederaMirrorAccount {
|
|
5
|
-
accountId: AccountId;
|
|
6
|
-
balance: BigNumber;
|
|
7
|
-
}
|
|
1
|
+
import type { HederaMirrorAccount, HederaMirrorToken, HederaMirrorTransaction } from "./types";
|
|
8
2
|
export declare function getAccountsForPublicKey(publicKey: string): Promise<HederaMirrorAccount[]>;
|
|
9
|
-
|
|
10
|
-
account: string;
|
|
11
|
-
amount: number;
|
|
12
|
-
}
|
|
13
|
-
interface HederaMirrorTransaction {
|
|
14
|
-
transfers: HederaMirrorTransfer[];
|
|
15
|
-
charged_tx_fee: string;
|
|
16
|
-
transaction_hash: string;
|
|
17
|
-
consensus_timestamp: string;
|
|
18
|
-
transaction_id: string;
|
|
19
|
-
}
|
|
3
|
+
export declare function getAccount(address: string): Promise<HederaMirrorAccount>;
|
|
20
4
|
export declare function getAccountTransactions(address: string, since: string | null): Promise<HederaMirrorTransaction[]>;
|
|
21
|
-
export declare function
|
|
22
|
-
export {};
|
|
5
|
+
export declare function getAccountTokens(address: string): Promise<HederaMirrorToken[]>;
|
|
23
6
|
//# sourceMappingURL=mirror.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mirror.d.ts","sourceRoot":"","sources":["../../src/api/mirror.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"mirror.d.ts","sourceRoot":"","sources":["../../src/api/mirror.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAa/F,wBAAsB,uBAAuB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,EAAE,CAAC,CAY/F;AAED,wBAAsB,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAa9E;AAED,wBAAsB,sBAAsB,CAC1C,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,MAAM,GAAG,IAAI,GACnB,OAAO,CAAC,uBAAuB,EAAE,CAAC,CAyBpC;AAED,wBAAsB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAgBpF"}
|