@ledgerhq/live-common 34.48.0-nightly.0 → 34.48.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/lib/bridge/crypto-assets/index.d.ts.map +1 -1
- package/lib/bridge/crypto-assets/index.js +0 -4
- package/lib/bridge/crypto-assets/index.js.map +1 -1
- package/lib/bridge/crypto-assets/index.test.js +0 -36
- package/lib/bridge/crypto-assets/index.test.js.map +1 -1
- package/lib/bridge/generic-alpaca/alpaca/network/network-alpaca.d.ts +2 -2
- package/lib/bridge/generic-alpaca/alpaca/network/network-alpaca.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/alpaca/network/network-alpaca.js +1 -1
- package/lib/bridge/generic-alpaca/alpaca/network/network-alpaca.js.map +1 -1
- package/lib/bridge/generic-alpaca/signOperation.js +1 -1
- package/lib/bridge/generic-alpaca/signOperation.js.map +1 -1
- package/lib/config/sharedConfig.d.ts.map +1 -1
- package/lib/config/sharedConfig.js +2 -0
- package/lib/config/sharedConfig.js.map +1 -1
- package/lib/e2e/index.d.ts +4 -4
- package/lib/e2e/index.d.ts.map +1 -1
- package/lib/env.react.d.ts +1 -1
- package/lib/env.react.d.ts.map +1 -1
- package/lib/families/canton/bridge/mock-data.d.ts +6 -0
- package/lib/families/canton/bridge/mock-data.d.ts.map +1 -0
- package/lib/families/canton/bridge/mock-data.js +120 -0
- package/lib/families/canton/bridge/mock-data.js.map +1 -0
- package/lib/families/canton/bridge/mock.d.ts +12 -0
- package/lib/families/canton/bridge/mock.d.ts.map +1 -0
- package/lib/families/canton/bridge/mock.js +154 -0
- package/lib/families/canton/bridge/mock.js.map +1 -0
- package/lib/families/canton/config.d.ts.map +1 -1
- package/lib/families/canton/config.js +5 -2
- package/lib/families/canton/config.js.map +1 -1
- package/lib/families/canton/setup.d.ts.map +1 -1
- package/lib/families/canton/setup.js +8 -2
- package/lib/families/canton/setup.js.map +1 -1
- package/lib/featureFlags/defaultFeatures.d.ts.map +1 -1
- package/lib/featureFlags/defaultFeatures.js +0 -1
- package/lib/featureFlags/defaultFeatures.js.map +1 -1
- package/lib/featureFlags/useFeature.d.ts +1 -1
- package/lib/featureFlags/useFeature.d.ts.map +1 -1
- package/lib/generated/bridge/mock.d.ts +8 -0
- package/lib/generated/bridge/mock.d.ts.map +1 -1
- package/lib/generated/bridge/mock.js +26 -24
- package/lib/generated/bridge/mock.js.map +1 -1
- package/lib/modularDrawer/hooks/__test__/useModularDrawerConfiguration.test.d.ts +2 -0
- package/lib/modularDrawer/hooks/__test__/useModularDrawerConfiguration.test.d.ts.map +1 -0
- package/lib/modularDrawer/hooks/__test__/useModularDrawerConfiguration.test.js +206 -0
- package/lib/modularDrawer/hooks/__test__/useModularDrawerConfiguration.test.js.map +1 -0
- package/lib/modularDrawer/hooks/useAssetsData.d.ts +1 -0
- package/lib/modularDrawer/hooks/useAssetsData.d.ts.map +1 -1
- package/lib/modularDrawer/hooks/useAssetsData.js +3 -2
- package/lib/modularDrawer/hooks/useAssetsData.js.map +1 -1
- package/lib/modularDrawer/hooks/useModularDrawerConfiguration.d.ts +13 -0
- package/lib/modularDrawer/hooks/useModularDrawerConfiguration.d.ts.map +1 -0
- package/lib/modularDrawer/hooks/useModularDrawerConfiguration.js +29 -0
- package/lib/modularDrawer/hooks/useModularDrawerConfiguration.js.map +1 -0
- package/lib/modularDrawer/hooks/useSearch.d.ts +16 -0
- package/lib/modularDrawer/hooks/useSearch.d.ts.map +1 -0
- package/lib/modularDrawer/hooks/useSearch.js +24 -0
- package/lib/modularDrawer/hooks/useSearch.js.map +1 -0
- package/lib/notifications/ServiceStatusProvider/index.d.ts +16 -1
- package/lib/notifications/ServiceStatusProvider/index.d.ts.map +1 -1
- package/lib/notifications/ServiceStatusProvider/index.js +31 -7
- package/lib/notifications/ServiceStatusProvider/index.js.map +1 -1
- package/lib/notifications/ServiceStatusProvider/index.test.d.ts +2 -0
- package/lib/notifications/ServiceStatusProvider/index.test.d.ts.map +1 -0
- package/lib/notifications/ServiceStatusProvider/index.test.js +88 -0
- package/lib/notifications/ServiceStatusProvider/index.test.js.map +1 -0
- package/lib/notifications/ServiceStatusProvider/ledger-components.d.ts +2 -0
- package/lib/notifications/ServiceStatusProvider/ledger-components.d.ts.map +1 -0
- package/lib/notifications/ServiceStatusProvider/ledger-components.js +16 -0
- package/lib/notifications/ServiceStatusProvider/ledger-components.js.map +1 -0
- package/lib/wallet-api/ACRE/server.d.ts +13 -6
- package/lib/wallet-api/ACRE/server.d.ts.map +1 -1
- package/lib/wallet-api/ACRE/server.js +142 -1
- package/lib/wallet-api/ACRE/server.js.map +1 -1
- package/lib/wallet-api/ACRE/server.test.d.ts +2 -0
- package/lib/wallet-api/ACRE/server.test.d.ts.map +1 -0
- package/lib/wallet-api/ACRE/server.test.js +393 -0
- package/lib/wallet-api/ACRE/server.test.js.map +1 -0
- package/lib-es/bridge/crypto-assets/index.d.ts.map +1 -1
- package/lib-es/bridge/crypto-assets/index.js +0 -4
- package/lib-es/bridge/crypto-assets/index.js.map +1 -1
- package/lib-es/bridge/crypto-assets/index.test.js +0 -36
- package/lib-es/bridge/crypto-assets/index.test.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/alpaca/network/network-alpaca.d.ts +2 -2
- package/lib-es/bridge/generic-alpaca/alpaca/network/network-alpaca.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/alpaca/network/network-alpaca.js +1 -1
- package/lib-es/bridge/generic-alpaca/alpaca/network/network-alpaca.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/signOperation.js +1 -1
- package/lib-es/bridge/generic-alpaca/signOperation.js.map +1 -1
- package/lib-es/config/sharedConfig.d.ts.map +1 -1
- package/lib-es/config/sharedConfig.js +2 -0
- package/lib-es/config/sharedConfig.js.map +1 -1
- package/lib-es/e2e/index.d.ts +4 -4
- package/lib-es/e2e/index.d.ts.map +1 -1
- package/lib-es/env.react.d.ts +1 -1
- package/lib-es/env.react.d.ts.map +1 -1
- package/lib-es/families/canton/bridge/mock-data.d.ts +6 -0
- package/lib-es/families/canton/bridge/mock-data.d.ts.map +1 -0
- package/lib-es/families/canton/bridge/mock-data.js +116 -0
- package/lib-es/families/canton/bridge/mock-data.js.map +1 -0
- package/lib-es/families/canton/bridge/mock.d.ts +12 -0
- package/lib-es/families/canton/bridge/mock.d.ts.map +1 -0
- package/lib-es/families/canton/bridge/mock.js +152 -0
- package/lib-es/families/canton/bridge/mock.js.map +1 -0
- package/lib-es/families/canton/config.d.ts.map +1 -1
- package/lib-es/families/canton/config.js +5 -2
- package/lib-es/families/canton/config.js.map +1 -1
- package/lib-es/families/canton/setup.d.ts.map +1 -1
- package/lib-es/families/canton/setup.js +8 -2
- package/lib-es/families/canton/setup.js.map +1 -1
- package/lib-es/featureFlags/defaultFeatures.d.ts.map +1 -1
- package/lib-es/featureFlags/defaultFeatures.js +0 -1
- package/lib-es/featureFlags/defaultFeatures.js.map +1 -1
- package/lib-es/featureFlags/useFeature.d.ts +1 -1
- package/lib-es/featureFlags/useFeature.d.ts.map +1 -1
- package/lib-es/generated/bridge/mock.d.ts +8 -0
- package/lib-es/generated/bridge/mock.d.ts.map +1 -1
- package/lib-es/generated/bridge/mock.js +2 -0
- package/lib-es/generated/bridge/mock.js.map +1 -1
- package/lib-es/modularDrawer/hooks/__test__/useModularDrawerConfiguration.test.d.ts +2 -0
- package/lib-es/modularDrawer/hooks/__test__/useModularDrawerConfiguration.test.d.ts.map +1 -0
- package/lib-es/modularDrawer/hooks/__test__/useModularDrawerConfiguration.test.js +204 -0
- package/lib-es/modularDrawer/hooks/__test__/useModularDrawerConfiguration.test.js.map +1 -0
- package/lib-es/modularDrawer/hooks/useAssetsData.d.ts +1 -0
- package/lib-es/modularDrawer/hooks/useAssetsData.d.ts.map +1 -1
- package/lib-es/modularDrawer/hooks/useAssetsData.js +3 -2
- package/lib-es/modularDrawer/hooks/useAssetsData.js.map +1 -1
- package/lib-es/modularDrawer/hooks/useModularDrawerConfiguration.d.ts +13 -0
- package/lib-es/modularDrawer/hooks/useModularDrawerConfiguration.d.ts.map +1 -0
- package/lib-es/modularDrawer/hooks/useModularDrawerConfiguration.js +25 -0
- package/lib-es/modularDrawer/hooks/useModularDrawerConfiguration.js.map +1 -0
- package/lib-es/modularDrawer/hooks/useSearch.d.ts +16 -0
- package/lib-es/modularDrawer/hooks/useSearch.d.ts.map +1 -0
- package/lib-es/modularDrawer/hooks/useSearch.js +20 -0
- package/lib-es/modularDrawer/hooks/useSearch.js.map +1 -0
- package/lib-es/notifications/ServiceStatusProvider/index.d.ts +16 -1
- package/lib-es/notifications/ServiceStatusProvider/index.d.ts.map +1 -1
- package/lib-es/notifications/ServiceStatusProvider/index.js +31 -7
- package/lib-es/notifications/ServiceStatusProvider/index.js.map +1 -1
- package/lib-es/notifications/ServiceStatusProvider/index.test.d.ts +2 -0
- package/lib-es/notifications/ServiceStatusProvider/index.test.d.ts.map +1 -0
- package/lib-es/notifications/ServiceStatusProvider/index.test.js +86 -0
- package/lib-es/notifications/ServiceStatusProvider/index.test.js.map +1 -0
- package/lib-es/notifications/ServiceStatusProvider/ledger-components.d.ts +2 -0
- package/lib-es/notifications/ServiceStatusProvider/ledger-components.d.ts.map +1 -0
- package/lib-es/notifications/ServiceStatusProvider/ledger-components.js +13 -0
- package/lib-es/notifications/ServiceStatusProvider/ledger-components.js.map +1 -0
- package/lib-es/wallet-api/ACRE/server.d.ts +13 -6
- package/lib-es/wallet-api/ACRE/server.d.ts.map +1 -1
- package/lib-es/wallet-api/ACRE/server.js +140 -2
- package/lib-es/wallet-api/ACRE/server.js.map +1 -1
- package/lib-es/wallet-api/ACRE/server.test.d.ts +2 -0
- package/lib-es/wallet-api/ACRE/server.test.d.ts.map +1 -0
- package/lib-es/wallet-api/ACRE/server.test.js +388 -0
- package/lib-es/wallet-api/ACRE/server.test.js.map +1 -0
- package/package.json +48 -48
- package/src/bridge/crypto-assets/index.test.ts +0 -47
- package/src/bridge/crypto-assets/index.ts +0 -5
- package/src/bridge/generic-alpaca/alpaca/network/network-alpaca.ts +4 -3
- package/src/bridge/generic-alpaca/signOperation.ts +1 -1
- package/src/config/sharedConfig.ts +2 -0
- package/src/families/canton/bridge/mock-data.ts +175 -0
- package/src/families/canton/bridge/mock.ts +180 -0
- package/src/families/canton/config.ts +5 -3
- package/src/families/canton/setup.ts +8 -5
- package/src/featureFlags/defaultFeatures.ts +0 -1
- package/src/generated/bridge/mock.ts +2 -0
- package/src/modularDrawer/hooks/__test__/useModularDrawerConfiguration.test.ts +251 -0
- package/src/modularDrawer/hooks/useAssetsData.ts +3 -2
- package/src/modularDrawer/hooks/useModularDrawerConfiguration.ts +33 -0
- package/src/modularDrawer/hooks/useSearch.ts +52 -0
- package/src/notifications/ServiceStatusProvider/index.test.ts +102 -0
- package/src/notifications/ServiceStatusProvider/index.tsx +37 -12
- package/src/notifications/ServiceStatusProvider/ledger-components.ts +12 -0
- package/src/wallet-api/ACRE/server.test.ts +470 -0
- package/src/wallet-api/ACRE/server.ts +202 -14
- package/lib/bridge/crypto-assets/cal-integration.d.ts +0 -4
- package/lib/bridge/crypto-assets/cal-integration.d.ts.map +0 -1
- package/lib/bridge/crypto-assets/cal-integration.js +0 -26
- package/lib/bridge/crypto-assets/cal-integration.js.map +0 -1
- package/lib/bridge/crypto-assets/cal-integration.test.d.ts +0 -2
- package/lib/bridge/crypto-assets/cal-integration.test.d.ts.map +0 -1
- package/lib/bridge/crypto-assets/cal-integration.test.js +0 -45
- package/lib/bridge/crypto-assets/cal-integration.test.js.map +0 -1
- package/lib/bridge/crypto-assets/cal-store.d.ts +0 -14
- package/lib/bridge/crypto-assets/cal-store.d.ts.map +0 -1
- package/lib/bridge/crypto-assets/cal-store.js +0 -58
- package/lib/bridge/crypto-assets/cal-store.js.map +0 -1
- package/lib/bridge/crypto-assets/cal-store.test.d.ts +0 -2
- package/lib/bridge/crypto-assets/cal-store.test.d.ts.map +0 -1
- package/lib/bridge/crypto-assets/cal-store.test.js +0 -70
- package/lib/bridge/crypto-assets/cal-store.test.js.map +0 -1
- package/lib-es/bridge/crypto-assets/cal-integration.d.ts +0 -4
- package/lib-es/bridge/crypto-assets/cal-integration.d.ts.map +0 -1
- package/lib-es/bridge/crypto-assets/cal-integration.js +0 -21
- package/lib-es/bridge/crypto-assets/cal-integration.js.map +0 -1
- package/lib-es/bridge/crypto-assets/cal-integration.test.d.ts +0 -2
- package/lib-es/bridge/crypto-assets/cal-integration.test.d.ts.map +0 -1
- package/lib-es/bridge/crypto-assets/cal-integration.test.js +0 -43
- package/lib-es/bridge/crypto-assets/cal-integration.test.js.map +0 -1
- package/lib-es/bridge/crypto-assets/cal-store.d.ts +0 -14
- package/lib-es/bridge/crypto-assets/cal-store.d.ts.map +0 -1
- package/lib-es/bridge/crypto-assets/cal-store.js +0 -54
- package/lib-es/bridge/crypto-assets/cal-store.js.map +0 -1
- package/lib-es/bridge/crypto-assets/cal-store.test.d.ts +0 -2
- package/lib-es/bridge/crypto-assets/cal-store.test.d.ts.map +0 -1
- package/lib-es/bridge/crypto-assets/cal-store.test.js +0 -68
- package/lib-es/bridge/crypto-assets/cal-store.test.js.map +0 -1
- package/src/bridge/crypto-assets/cal-integration.test.ts +0 -53
- package/src/bridge/crypto-assets/cal-integration.ts +0 -23
- package/src/bridge/crypto-assets/cal-store.test.ts +0 -93
- package/src/bridge/crypto-assets/cal-store.ts +0 -63
@@ -123,7 +123,7 @@ export const genericSignOperation =
|
|
123
123
|
transactionIntent.sequence = sequenceNumber;
|
124
124
|
|
125
125
|
/* Craft unsigned blob via Alpaca */
|
126
|
-
const
|
126
|
+
const { transaction: unsigned } = await getAlpacaApi(network, kind).craftTransaction(
|
127
127
|
transactionIntent,
|
128
128
|
{ value: fees },
|
129
129
|
);
|
@@ -24,6 +24,7 @@ import { tronConfig } from "../families/tron/config";
|
|
24
24
|
import { vechainConfig } from "../families/vechain/config";
|
25
25
|
import { iconConfig } from "../families/icon/config";
|
26
26
|
import { suiConfig } from "../families/sui/config";
|
27
|
+
import { cantonConfig } from "../families/canton/config";
|
27
28
|
|
28
29
|
const countervaluesConfig: ConfigSchema = {
|
29
30
|
config_countervalues_refreshRate: {
|
@@ -67,4 +68,5 @@ export const liveConfig: ConfigSchema = {
|
|
67
68
|
...iconConfig,
|
68
69
|
...tonConfig,
|
69
70
|
...suiConfig,
|
71
|
+
...cantonConfig,
|
70
72
|
};
|
@@ -0,0 +1,175 @@
|
|
1
|
+
type MockTransactionOperation = {
|
2
|
+
meta: {
|
3
|
+
delivered_amount: string;
|
4
|
+
};
|
5
|
+
tx: {
|
6
|
+
Account: string;
|
7
|
+
Amount: string;
|
8
|
+
Destination: string;
|
9
|
+
Fee: string;
|
10
|
+
Memo: string;
|
11
|
+
Sequence: number;
|
12
|
+
SigningPubKey: string;
|
13
|
+
TransactionType: string;
|
14
|
+
TxnSignature: string;
|
15
|
+
date: number;
|
16
|
+
hash: string;
|
17
|
+
inLedger: number;
|
18
|
+
};
|
19
|
+
validated: boolean;
|
20
|
+
};
|
21
|
+
|
22
|
+
const generateMockTransaction = (
|
23
|
+
account: string,
|
24
|
+
destination: string,
|
25
|
+
amount: string,
|
26
|
+
fee: string,
|
27
|
+
hash: string,
|
28
|
+
sequence: number,
|
29
|
+
timestamp: number,
|
30
|
+
inLedger: number,
|
31
|
+
): MockTransactionOperation => ({
|
32
|
+
meta: {
|
33
|
+
delivered_amount: amount,
|
34
|
+
},
|
35
|
+
tx: {
|
36
|
+
Account: account,
|
37
|
+
Amount: amount,
|
38
|
+
Destination: destination,
|
39
|
+
Fee: fee,
|
40
|
+
Memo: "",
|
41
|
+
Sequence: sequence,
|
42
|
+
SigningPubKey: "ED" + account.slice(0, 32),
|
43
|
+
TransactionType: "Payment",
|
44
|
+
TxnSignature: hash.slice(0, 32),
|
45
|
+
date: timestamp,
|
46
|
+
hash,
|
47
|
+
inLedger,
|
48
|
+
},
|
49
|
+
validated: true,
|
50
|
+
});
|
51
|
+
|
52
|
+
export const getMockedMethods = (): {
|
53
|
+
method: string;
|
54
|
+
params: unknown[];
|
55
|
+
answer: unknown;
|
56
|
+
}[] => [
|
57
|
+
// Account balance lookup
|
58
|
+
{
|
59
|
+
method: "getBalance",
|
60
|
+
params: ["rLSn6Z3T5uGRdL5jzKLj2rKqRfQMT5JZRG"],
|
61
|
+
answer: {
|
62
|
+
account_data: {
|
63
|
+
Account: "rLSn6Z3T5uGRdL5jzKLj2rKqRfQMT5JZRG",
|
64
|
+
Balance: "1000000000",
|
65
|
+
},
|
66
|
+
ledger_hash: "4BC50C9B0D8515D3EAAE1E74B29A95804346C491EE1A95BF25E4AAB854A6A652",
|
67
|
+
ledger_index: 32570,
|
68
|
+
validated: true,
|
69
|
+
status: "success",
|
70
|
+
},
|
71
|
+
},
|
72
|
+
|
73
|
+
// Empty account (new account)
|
74
|
+
{
|
75
|
+
method: "getBalance",
|
76
|
+
params: ["rKj2N4jSSB8QMLq3VnvLcZj4QdKhzSkTZW"],
|
77
|
+
answer: {
|
78
|
+
error: "actNotFound",
|
79
|
+
},
|
80
|
+
},
|
81
|
+
|
82
|
+
// Account transactions
|
83
|
+
{
|
84
|
+
method: "getTransactions",
|
85
|
+
params: ["rLSn6Z3T5uGRdL5jzKLj2rKqRfQMT5JZRG", { from: 0, size: 100 }],
|
86
|
+
answer: [
|
87
|
+
generateMockTransaction(
|
88
|
+
"rLSn6Z3T5uGRdL5jzKLj2rKqRfQMT5JZRG",
|
89
|
+
"rKj2N4jSSB8QMLq3VnvLcZj4QdKhzSkTZW",
|
90
|
+
"100000000",
|
91
|
+
"10000",
|
92
|
+
"E3FE6EA3C48F0C2B639448020EA4F03D4F4F8BDCFDC8882B7B20DBD3A3A5B3A6",
|
93
|
+
1,
|
94
|
+
Date.now() - 3600000, // 1 hour ago
|
95
|
+
32569,
|
96
|
+
),
|
97
|
+
generateMockTransaction(
|
98
|
+
"rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
|
99
|
+
"rLSn6Z3T5uGRdL5jzKLj2rKqRfQMT5JZRG",
|
100
|
+
"200000000",
|
101
|
+
"10000",
|
102
|
+
"B7FDE3B1D3C2F4A9638448020EA4F03D4F4F8BDCFDC8882B7B20DBD3A3A5B3C8",
|
103
|
+
5,
|
104
|
+
Date.now() - 7200000, // 2 hours ago
|
105
|
+
32568,
|
106
|
+
),
|
107
|
+
],
|
108
|
+
},
|
109
|
+
|
110
|
+
// Empty transactions for new account
|
111
|
+
{
|
112
|
+
method: "getTransactions",
|
113
|
+
params: ["rKj2N4jSSB8QMLq3VnvLcZj4QdKhzSkTZW", { from: 0, size: 100 }],
|
114
|
+
answer: [],
|
115
|
+
},
|
116
|
+
|
117
|
+
// Fee estimation
|
118
|
+
{
|
119
|
+
method: "estimateFees",
|
120
|
+
params: ["12000400020000000000000000"], // sample serialized transaction
|
121
|
+
answer: "12000",
|
122
|
+
},
|
123
|
+
|
124
|
+
// Transaction submission
|
125
|
+
{
|
126
|
+
method: "submitTransaction",
|
127
|
+
params: ["12000400020000000000000000"], // sample signed transaction
|
128
|
+
answer: {
|
129
|
+
accepted: true,
|
130
|
+
tx_hash: "F4AB442A6D4CBB935D66E1DA7309A5FC71C7143ED4049053EC14E3875B0CF9BF",
|
131
|
+
},
|
132
|
+
},
|
133
|
+
|
134
|
+
// Network info
|
135
|
+
{
|
136
|
+
method: "getServerInfo",
|
137
|
+
params: [],
|
138
|
+
answer: {
|
139
|
+
info: {
|
140
|
+
complete_ledgers: "32570-32570",
|
141
|
+
ledger_index: 32570,
|
142
|
+
validated_ledger: {
|
143
|
+
hash: "4BC50C9B0D8515D3EAAE1E74B29A95804346C491EE1A95BF25E4AAB854A6A652",
|
144
|
+
seq: 32570,
|
145
|
+
},
|
146
|
+
},
|
147
|
+
status: "success",
|
148
|
+
},
|
149
|
+
},
|
150
|
+
|
151
|
+
// Account sequence number
|
152
|
+
{
|
153
|
+
method: "getNextValidSequence",
|
154
|
+
params: ["rLSn6Z3T5uGRdL5jzKLj2rKqRfQMT5JZRG"],
|
155
|
+
answer: 2,
|
156
|
+
},
|
157
|
+
|
158
|
+
// New account sequence
|
159
|
+
{
|
160
|
+
method: "getNextValidSequence",
|
161
|
+
params: ["rKj2N4jSSB8QMLq3VnvLcZj4QdKhzSkTZW"],
|
162
|
+
answer: 1,
|
163
|
+
},
|
164
|
+
|
165
|
+
// Last block
|
166
|
+
{
|
167
|
+
method: "lastBlock",
|
168
|
+
params: [],
|
169
|
+
answer: {
|
170
|
+
height: 32570,
|
171
|
+
hash: "4BC50C9B0D8515D3EAAE1E74B29A95804346C491EE1A95BF25E4AAB854A6A652",
|
172
|
+
time: Date.now(),
|
173
|
+
},
|
174
|
+
},
|
175
|
+
];
|
@@ -0,0 +1,180 @@
|
|
1
|
+
import { makeLRUCache, minutes } from "@ledgerhq/live-network/cache";
|
2
|
+
import { createApi } from "@ledgerhq/coin-canton/api/index";
|
3
|
+
import { Transaction as CantonTransaction } from "@ledgerhq/coin-canton/types";
|
4
|
+
import type { AccountBridge } from "@ledgerhq/types-live";
|
5
|
+
import { BigNumber } from "bignumber.js";
|
6
|
+
|
7
|
+
// The calls data can be copied to mock-data.ts from the file.
|
8
|
+
// This function creates a live API with logging for generating mock data
|
9
|
+
/* eslint-disable-next-line @typescript-eslint/no-unused-vars */
|
10
|
+
function createMockDataForAPI() {
|
11
|
+
const signerContext = {};
|
12
|
+
|
13
|
+
const apiGetter = makeLRUCache(
|
14
|
+
config => Promise.resolve(createApi(config)),
|
15
|
+
config => config.nodeUrl || "",
|
16
|
+
minutes(1000),
|
17
|
+
);
|
18
|
+
|
19
|
+
return {
|
20
|
+
getAPI: apiGetter,
|
21
|
+
getQueuedAPI: apiGetter,
|
22
|
+
getQueuedAndCachedAPI: apiGetter,
|
23
|
+
signerContext,
|
24
|
+
};
|
25
|
+
}
|
26
|
+
|
27
|
+
const createTransaction = (): CantonTransaction => {
|
28
|
+
return {
|
29
|
+
family: "canton",
|
30
|
+
amount: new BigNumber(0),
|
31
|
+
recipient: "",
|
32
|
+
fee: null,
|
33
|
+
};
|
34
|
+
};
|
35
|
+
|
36
|
+
const updateTransaction = (
|
37
|
+
t: CantonTransaction,
|
38
|
+
patch: Partial<CantonTransaction>,
|
39
|
+
): CantonTransaction => {
|
40
|
+
return { ...t, ...patch };
|
41
|
+
};
|
42
|
+
|
43
|
+
const getTransactionStatus = async (): Promise<any> => {
|
44
|
+
return {
|
45
|
+
errors: {},
|
46
|
+
warnings: {},
|
47
|
+
estimatedFees: new BigNumber(0),
|
48
|
+
amount: new BigNumber(0),
|
49
|
+
totalSpent: new BigNumber(0),
|
50
|
+
};
|
51
|
+
};
|
52
|
+
|
53
|
+
const estimateMaxSpendable = ({ account }: { account: any }): Promise<BigNumber> => {
|
54
|
+
return Promise.resolve(account.balance || new BigNumber(0));
|
55
|
+
};
|
56
|
+
|
57
|
+
const prepareTransaction = async (
|
58
|
+
_account: any,
|
59
|
+
transaction: CantonTransaction,
|
60
|
+
): Promise<CantonTransaction> => {
|
61
|
+
return {
|
62
|
+
...transaction,
|
63
|
+
fee: transaction.fee || new BigNumber(100),
|
64
|
+
};
|
65
|
+
};
|
66
|
+
|
67
|
+
const sync = (_initialAccount: any): any => {
|
68
|
+
return {
|
69
|
+
subscribe: (observer: any) => {
|
70
|
+
observer.next((acc: any) => acc);
|
71
|
+
observer.complete();
|
72
|
+
return { unsubscribe: () => {} };
|
73
|
+
},
|
74
|
+
};
|
75
|
+
};
|
76
|
+
|
77
|
+
const receive = (_account: any, _opts: { deviceId: string }): any => {
|
78
|
+
return {
|
79
|
+
subscribe: (observer: any) => {
|
80
|
+
observer.next({
|
81
|
+
address: "mock-address",
|
82
|
+
path: "44'/60'/0'/0/0",
|
83
|
+
publicKey: "mock-public-key",
|
84
|
+
});
|
85
|
+
observer.complete();
|
86
|
+
return { unsubscribe: () => {} };
|
87
|
+
},
|
88
|
+
};
|
89
|
+
};
|
90
|
+
|
91
|
+
const signOperation = (): any => {
|
92
|
+
return {
|
93
|
+
subscribe: (observer: any) => {
|
94
|
+
observer.next({
|
95
|
+
operation: {
|
96
|
+
id: "mock-operation-id",
|
97
|
+
hash: "mock-hash",
|
98
|
+
type: "OUT",
|
99
|
+
value: new BigNumber(0),
|
100
|
+
fee: new BigNumber(100),
|
101
|
+
blockHash: "mock-block-hash",
|
102
|
+
blockHeight: 12345,
|
103
|
+
accountId: "mock-account-id",
|
104
|
+
date: new Date(),
|
105
|
+
extra: {},
|
106
|
+
},
|
107
|
+
signature: "mock-signature",
|
108
|
+
});
|
109
|
+
observer.complete();
|
110
|
+
return { unsubscribe: () => {} };
|
111
|
+
},
|
112
|
+
};
|
113
|
+
};
|
114
|
+
|
115
|
+
const broadcast = async (): Promise<any> => {
|
116
|
+
return {
|
117
|
+
id: "mock-operation-id",
|
118
|
+
hash: "mock-hash",
|
119
|
+
type: "OUT",
|
120
|
+
value: new BigNumber(0),
|
121
|
+
fee: new BigNumber(100),
|
122
|
+
blockHash: "mock-block-hash",
|
123
|
+
blockHeight: 12345,
|
124
|
+
accountId: "mock-account-id",
|
125
|
+
date: new Date(),
|
126
|
+
extra: {},
|
127
|
+
};
|
128
|
+
};
|
129
|
+
|
130
|
+
const scanAccounts = (): any => {
|
131
|
+
return {
|
132
|
+
subscribe: (observer: any) => {
|
133
|
+
observer.next({
|
134
|
+
type: "discovered",
|
135
|
+
account: {
|
136
|
+
id: "mock-account-id",
|
137
|
+
name: "Mock Canton Account",
|
138
|
+
address: "mock-address",
|
139
|
+
currency: { id: "canton_network_devnet" },
|
140
|
+
balance: new BigNumber(0),
|
141
|
+
spendableBalance: new BigNumber(0),
|
142
|
+
blockHeight: 0,
|
143
|
+
lastSyncDate: new Date(),
|
144
|
+
operations: [],
|
145
|
+
pendingOperations: [],
|
146
|
+
},
|
147
|
+
});
|
148
|
+
observer.complete();
|
149
|
+
return { unsubscribe: () => {} };
|
150
|
+
},
|
151
|
+
};
|
152
|
+
};
|
153
|
+
|
154
|
+
const getSerializedAddressParameters = (): Buffer => {
|
155
|
+
return Buffer.from("mock-address-params");
|
156
|
+
};
|
157
|
+
|
158
|
+
const accountBridge: AccountBridge<CantonTransaction> = {
|
159
|
+
createTransaction,
|
160
|
+
updateTransaction,
|
161
|
+
getTransactionStatus,
|
162
|
+
estimateMaxSpendable,
|
163
|
+
prepareTransaction,
|
164
|
+
sync,
|
165
|
+
receive,
|
166
|
+
signOperation,
|
167
|
+
broadcast,
|
168
|
+
getSerializedAddressParameters,
|
169
|
+
};
|
170
|
+
|
171
|
+
const currencyBridge = {
|
172
|
+
preload: () => Promise.resolve({}),
|
173
|
+
hydrate: () => {},
|
174
|
+
scanAccounts,
|
175
|
+
};
|
176
|
+
|
177
|
+
export default {
|
178
|
+
accountBridge,
|
179
|
+
currencyBridge,
|
180
|
+
};
|
@@ -14,6 +14,7 @@ export const cantonConfig: Record<string, ConfigInfo> = {
|
|
14
14
|
gatewayUrl: "https://canton-gateway.api.live.ledger.com",
|
15
15
|
minReserve: 0,
|
16
16
|
useGateway: true,
|
17
|
+
networkType: "mainnet",
|
17
18
|
},
|
18
19
|
},
|
19
20
|
config_currency_canton_network_devnet: {
|
@@ -23,12 +24,12 @@ export const cantonConfig: Record<string, ConfigInfo> = {
|
|
23
24
|
type: "active",
|
24
25
|
},
|
25
26
|
nodeUrl: "https://wallet-validator-devnet-canton.ledger-test.com",
|
26
|
-
nodeId: "ledger-
|
27
|
+
nodeId: "ledger-devnet-stg",
|
27
28
|
gatewayUrl: "https://canton-gateway.api.live.ledger-test.com",
|
28
29
|
minReserve: 0,
|
29
30
|
useGateway: true,
|
30
|
-
|
31
|
-
|
31
|
+
networkType: "devnet",
|
32
|
+
nativeInstrumentId: "Amulet",
|
32
33
|
},
|
33
34
|
},
|
34
35
|
config_currency_canton_network_localnet: {
|
@@ -42,6 +43,7 @@ export const cantonConfig: Record<string, ConfigInfo> = {
|
|
42
43
|
gatewayUrl: undefined,
|
43
44
|
minReserve: 0,
|
44
45
|
useGateway: false,
|
46
|
+
networkType: "localnet",
|
45
47
|
},
|
46
48
|
},
|
47
49
|
};
|
@@ -1,6 +1,7 @@
|
|
1
1
|
// Goal of this file is to inject all necessary device/signer dependency to coin-modules
|
2
2
|
|
3
3
|
import { createBridges } from "@ledgerhq/coin-canton/bridge/index";
|
4
|
+
import { getEnv } from "@ledgerhq/live-env";
|
4
5
|
import Transport from "@ledgerhq/hw-transport";
|
5
6
|
import { CantonSigner } from "@ledgerhq/coin-canton";
|
6
7
|
import cantonResolver from "@ledgerhq/coin-canton/signer";
|
@@ -10,6 +11,7 @@ import { CantonCoinConfig } from "@ledgerhq/coin-canton/config";
|
|
10
11
|
import { TransactionStatus, Transaction } from "@ledgerhq/coin-canton/types";
|
11
12
|
import { LegacySignerCanton } from "@ledgerhq/live-signer-canton";
|
12
13
|
import { CreateSigner, createResolver, executeWithSigner } from "../../bridge/setup";
|
14
|
+
import cantonBridgeMock from "./bridge/mock";
|
13
15
|
import { Resolver } from "../../hw/getAddress/types";
|
14
16
|
import { getCurrencyConfiguration } from "../../config";
|
15
17
|
import { getCryptoCurrencyById } from "../../currencies";
|
@@ -19,13 +21,14 @@ const createSigner: CreateSigner<CantonSigner> = (transport: Transport) => {
|
|
19
21
|
};
|
20
22
|
|
21
23
|
const getCurrencyConfig = () => {
|
22
|
-
|
24
|
+
// Use devnet for development/testing
|
25
|
+
const currencyId = getEnv("MOCK") ? "canton_network_devnet" : "canton_network_devnet";
|
26
|
+
return getCurrencyConfiguration<CantonCoinConfig>(getCryptoCurrencyById(currencyId));
|
23
27
|
};
|
24
28
|
|
25
|
-
const bridge: Bridge<Transaction, Account, TransactionStatus> =
|
26
|
-
|
27
|
-
getCurrencyConfig
|
28
|
-
);
|
29
|
+
const bridge: Bridge<Transaction, Account, TransactionStatus> = getEnv("MOCK")
|
30
|
+
? cantonBridgeMock
|
31
|
+
: createBridges(executeWithSigner(createSigner), getCurrencyConfig);
|
29
32
|
|
30
33
|
const resolver: Resolver = createResolver(createSigner, cantonResolver);
|
31
34
|
|
@@ -108,7 +108,6 @@ export const DEFAULT_FEATURES: Features = {
|
|
108
108
|
postOnboardingAssetsTransfer: DEFAULT_FEATURE,
|
109
109
|
counterValue: DEFAULT_FEATURE,
|
110
110
|
mockFeature: DEFAULT_FEATURE,
|
111
|
-
calLedgerService: DEFAULT_FEATURE,
|
112
111
|
ptxServiceCtaExchangeDrawer: DEFAULT_FEATURE,
|
113
112
|
ptxServiceCtaScreens: DEFAULT_FEATURE,
|
114
113
|
ptxSwapReceiveTRC20WithoutTrx: DEFAULT_FEATURE,
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import algorand from "../../families/algorand/bridge/mock";
|
2
2
|
import bitcoin from "../../families/bitcoin/bridge/mock";
|
3
|
+
import canton from "../../families/canton/bridge/mock";
|
3
4
|
import cardano from "../../families/cardano/bridge/mock";
|
4
5
|
import casper from "../../families/casper/bridge/mock";
|
5
6
|
import cosmos from "../../families/cosmos/bridge/mock";
|
@@ -16,6 +17,7 @@ import xrp from "../../families/xrp/bridge/mock";
|
|
16
17
|
export default {
|
17
18
|
algorand,
|
18
19
|
bitcoin,
|
20
|
+
canton,
|
19
21
|
cardano,
|
20
22
|
casper,
|
21
23
|
cosmos,
|