@ledgerhq/live-common 34.54.0-nightly.20251203105022 → 34.54.0-nightly.20251204135727
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/e2e/index.d.ts +7 -0
- 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/react.d.ts +2 -0
- package/lib/families/canton/react.d.ts.map +1 -1
- package/lib/families/canton/react.js +40 -1
- package/lib/families/canton/react.js.map +1 -1
- package/lib/families/hedera/react.d.ts +6 -0
- package/lib/families/hedera/react.d.ts.map +1 -0
- package/lib/families/hedera/react.js +50 -0
- package/lib/families/hedera/react.js.map +1 -0
- package/lib/featureFlags/defaultFeatures.d.ts.map +1 -1
- package/lib/featureFlags/defaultFeatures.js +1 -0
- 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/walletSync/getEnvironmentParams.js +6 -6
- package/lib/walletSync/getEnvironmentParams.js.map +1 -1
- package/lib-es/e2e/index.d.ts +7 -0
- 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/react.d.ts +2 -0
- package/lib-es/families/canton/react.d.ts.map +1 -1
- package/lib-es/families/canton/react.js +38 -1
- package/lib-es/families/canton/react.js.map +1 -1
- package/lib-es/families/hedera/react.d.ts +6 -0
- package/lib-es/families/hedera/react.d.ts.map +1 -0
- package/lib-es/families/hedera/react.js +41 -0
- package/lib-es/families/hedera/react.js.map +1 -0
- package/lib-es/featureFlags/defaultFeatures.d.ts.map +1 -1
- package/lib-es/featureFlags/defaultFeatures.js +1 -0
- 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/walletSync/getEnvironmentParams.js +6 -6
- package/lib-es/walletSync/getEnvironmentParams.js.map +1 -1
- package/package.json +60 -60
- package/src/families/canton/react.test.ts +147 -0
- package/src/families/canton/react.ts +45 -1
- package/src/families/hedera/__snapshots__/bridge.integration.test.ts.snap +229 -14
- package/src/families/hedera/react.test.ts +272 -0
- package/src/families/hedera/react.ts +63 -0
- package/src/featureFlags/defaultFeatures.ts +1 -0
- package/src/walletSync/getEnvironmentParams.ts +6 -6
|
@@ -3,24 +3,29 @@
|
|
|
3
3
|
exports[`hedera currency bridge scanAccounts hedera seed 1 1`] = `
|
|
4
4
|
[
|
|
5
5
|
{
|
|
6
|
-
"balance": "
|
|
6
|
+
"balance": "31515040999",
|
|
7
7
|
"currencyId": "hedera",
|
|
8
8
|
"derivationMode": "hederaBip44",
|
|
9
9
|
"freshAddress": "0.0.1040977",
|
|
10
10
|
"freshAddressPath": "44/3030",
|
|
11
11
|
"hederaResources": {
|
|
12
|
+
"delegation": {
|
|
13
|
+
"delegated": "31515040999",
|
|
14
|
+
"nodeId": 0,
|
|
15
|
+
"pendingReward": "0",
|
|
16
|
+
},
|
|
12
17
|
"isAutoTokenAssociationEnabled": false,
|
|
13
18
|
"maxAutomaticTokenAssociations": 0,
|
|
14
19
|
},
|
|
15
20
|
"id": "js:2:hedera:0.0.1040977:hederaBip44",
|
|
16
21
|
"index": 0,
|
|
17
|
-
"operationsCount":
|
|
22
|
+
"operationsCount": 54,
|
|
18
23
|
"pendingOperations": [],
|
|
19
24
|
"seedIdentifier": "9e92a312233d5fd6b5a723875aeea2cea81a8e48ffc00341cff6dffcfd3ab7f2",
|
|
20
|
-
"spendableBalance": "
|
|
25
|
+
"spendableBalance": "31515040999",
|
|
21
26
|
"subAccounts": [],
|
|
22
27
|
"swapHistory": [],
|
|
23
|
-
"syncHash": "
|
|
28
|
+
"syncHash": "0x43decf71",
|
|
24
29
|
"used": true,
|
|
25
30
|
},
|
|
26
31
|
{
|
|
@@ -63,6 +68,11 @@ exports[`hedera currency bridge scanAccounts hedera seed 1 1`] = `
|
|
|
63
68
|
"freshAddress": "0.0.7305122",
|
|
64
69
|
"freshAddressPath": "44/3030",
|
|
65
70
|
"hederaResources": {
|
|
71
|
+
"delegation": {
|
|
72
|
+
"delegated": "226095",
|
|
73
|
+
"nodeId": 0,
|
|
74
|
+
"pendingReward": "0",
|
|
75
|
+
},
|
|
66
76
|
"isAutoTokenAssociationEnabled": false,
|
|
67
77
|
"maxAutomaticTokenAssociations": 0,
|
|
68
78
|
},
|
|
@@ -74,7 +84,7 @@ exports[`hedera currency bridge scanAccounts hedera seed 1 1`] = `
|
|
|
74
84
|
"spendableBalance": "226095",
|
|
75
85
|
"subAccounts": [],
|
|
76
86
|
"swapHistory": [],
|
|
77
|
-
"syncHash": "
|
|
87
|
+
"syncHash": "0x43decf71",
|
|
78
88
|
"used": true,
|
|
79
89
|
},
|
|
80
90
|
{
|
|
@@ -84,6 +94,11 @@ exports[`hedera currency bridge scanAccounts hedera seed 1 1`] = `
|
|
|
84
94
|
"freshAddress": "0.0.7560245",
|
|
85
95
|
"freshAddressPath": "44/3030",
|
|
86
96
|
"hederaResources": {
|
|
97
|
+
"delegation": {
|
|
98
|
+
"delegated": "80189",
|
|
99
|
+
"nodeId": 1,
|
|
100
|
+
"pendingReward": "0",
|
|
101
|
+
},
|
|
87
102
|
"isAutoTokenAssociationEnabled": false,
|
|
88
103
|
"maxAutomaticTokenAssociations": 0,
|
|
89
104
|
},
|
|
@@ -95,7 +110,7 @@ exports[`hedera currency bridge scanAccounts hedera seed 1 1`] = `
|
|
|
95
110
|
"spendableBalance": "80189",
|
|
96
111
|
"subAccounts": [],
|
|
97
112
|
"swapHistory": [],
|
|
98
|
-
"syncHash": "
|
|
113
|
+
"syncHash": "0x43decf71",
|
|
99
114
|
"used": true,
|
|
100
115
|
},
|
|
101
116
|
{
|
|
@@ -105,6 +120,11 @@ exports[`hedera currency bridge scanAccounts hedera seed 1 1`] = `
|
|
|
105
120
|
"freshAddress": "0.0.7578015",
|
|
106
121
|
"freshAddressPath": "44/3030",
|
|
107
122
|
"hederaResources": {
|
|
123
|
+
"delegation": {
|
|
124
|
+
"delegated": "99836954",
|
|
125
|
+
"nodeId": 5,
|
|
126
|
+
"pendingReward": "0",
|
|
127
|
+
},
|
|
108
128
|
"isAutoTokenAssociationEnabled": false,
|
|
109
129
|
"maxAutomaticTokenAssociations": 0,
|
|
110
130
|
},
|
|
@@ -116,7 +136,7 @@ exports[`hedera currency bridge scanAccounts hedera seed 1 1`] = `
|
|
|
116
136
|
"spendableBalance": "99836954",
|
|
117
137
|
"subAccounts": [],
|
|
118
138
|
"swapHistory": [],
|
|
119
|
-
"syncHash": "
|
|
139
|
+
"syncHash": "0x43decf71",
|
|
120
140
|
"used": true,
|
|
121
141
|
},
|
|
122
142
|
{
|
|
@@ -126,6 +146,7 @@ exports[`hedera currency bridge scanAccounts hedera seed 1 1`] = `
|
|
|
126
146
|
"freshAddress": "0.0.8313485",
|
|
127
147
|
"freshAddressPath": "44/3030",
|
|
128
148
|
"hederaResources": {
|
|
149
|
+
"delegation": null,
|
|
129
150
|
"isAutoTokenAssociationEnabled": false,
|
|
130
151
|
"maxAutomaticTokenAssociations": 0,
|
|
131
152
|
},
|
|
@@ -137,7 +158,7 @@ exports[`hedera currency bridge scanAccounts hedera seed 1 1`] = `
|
|
|
137
158
|
"spendableBalance": "671187583",
|
|
138
159
|
"subAccounts": [],
|
|
139
160
|
"swapHistory": [],
|
|
140
|
-
"syncHash": "
|
|
161
|
+
"syncHash": "0x43decf71",
|
|
141
162
|
"used": true,
|
|
142
163
|
},
|
|
143
164
|
{
|
|
@@ -158,6 +179,11 @@ exports[`hedera currency bridge scanAccounts hedera seed 1 1`] = `
|
|
|
158
179
|
"freshAddress": "0.0.10096785",
|
|
159
180
|
"freshAddressPath": "44/3030",
|
|
160
181
|
"hederaResources": {
|
|
182
|
+
"delegation": {
|
|
183
|
+
"delegated": "100000000",
|
|
184
|
+
"nodeId": 7,
|
|
185
|
+
"pendingReward": "130131",
|
|
186
|
+
},
|
|
161
187
|
"isAutoTokenAssociationEnabled": false,
|
|
162
188
|
"maxAutomaticTokenAssociations": 0,
|
|
163
189
|
},
|
|
@@ -169,7 +195,7 @@ exports[`hedera currency bridge scanAccounts hedera seed 1 1`] = `
|
|
|
169
195
|
"spendableBalance": "100000000",
|
|
170
196
|
"subAccounts": [],
|
|
171
197
|
"swapHistory": [],
|
|
172
|
-
"syncHash": "
|
|
198
|
+
"syncHash": "0x43decf71",
|
|
173
199
|
"used": true,
|
|
174
200
|
},
|
|
175
201
|
{
|
|
@@ -179,6 +205,11 @@ exports[`hedera currency bridge scanAccounts hedera seed 1 1`] = `
|
|
|
179
205
|
"freshAddress": "0.0.10096815",
|
|
180
206
|
"freshAddressPath": "44/3030",
|
|
181
207
|
"hederaResources": {
|
|
208
|
+
"delegation": {
|
|
209
|
+
"delegated": "0",
|
|
210
|
+
"nodeId": 9,
|
|
211
|
+
"pendingReward": "0",
|
|
212
|
+
},
|
|
182
213
|
"isAutoTokenAssociationEnabled": false,
|
|
183
214
|
"maxAutomaticTokenAssociations": 0,
|
|
184
215
|
},
|
|
@@ -190,7 +221,7 @@ exports[`hedera currency bridge scanAccounts hedera seed 1 1`] = `
|
|
|
190
221
|
"spendableBalance": "0",
|
|
191
222
|
"subAccounts": [],
|
|
192
223
|
"swapHistory": [],
|
|
193
|
-
"syncHash": "
|
|
224
|
+
"syncHash": "0x43decf71",
|
|
194
225
|
"used": false,
|
|
195
226
|
},
|
|
196
227
|
]
|
|
@@ -245,6 +276,29 @@ exports[`hedera currency bridge scanAccounts hedera seed 1 2`] = `
|
|
|
245
276
|
"type": "IN",
|
|
246
277
|
"value": "9755232",
|
|
247
278
|
},
|
|
279
|
+
{
|
|
280
|
+
"accountId": "js:2:hedera:0.0.1040977:hederaBip44",
|
|
281
|
+
"blockHash": null,
|
|
282
|
+
"blockHeight": 10,
|
|
283
|
+
"extra": {
|
|
284
|
+
"consensusTimestamp": "1764676581.905435000",
|
|
285
|
+
"memo": "Stake",
|
|
286
|
+
"pagingToken": "1764676581.905435000",
|
|
287
|
+
"transactionId": "0.0.1040977-1764676567-725968138",
|
|
288
|
+
},
|
|
289
|
+
"fee": "163226",
|
|
290
|
+
"hasFailed": false,
|
|
291
|
+
"hash": "3NpFiiRWJ79s2ggmEnHm1jTkNbK9zVKKUuxP7DI9h0iis5_r9_59USttxDINMkav",
|
|
292
|
+
"id": "js:2:hedera:0.0.1040977:hederaBip44-3NpFiiRWJ79s2ggmEnHm1jTkNbK9zVKKUuxP7DI9h0iis5_r9_59USttxDINMkav-UPDATE_ACCOUNT",
|
|
293
|
+
"recipients": [
|
|
294
|
+
"0.0.3",
|
|
295
|
+
],
|
|
296
|
+
"senders": [
|
|
297
|
+
"0.0.1040977",
|
|
298
|
+
],
|
|
299
|
+
"type": "UPDATE_ACCOUNT",
|
|
300
|
+
"value": "163226",
|
|
301
|
+
},
|
|
248
302
|
{
|
|
249
303
|
"accountId": "js:2:hedera:0.0.1040977:hederaBip44",
|
|
250
304
|
"blockHash": null,
|
|
@@ -339,6 +393,29 @@ exports[`hedera currency bridge scanAccounts hedera seed 1 2`] = `
|
|
|
339
393
|
"type": "IN",
|
|
340
394
|
"value": "12300000",
|
|
341
395
|
},
|
|
396
|
+
{
|
|
397
|
+
"accountId": "js:2:hedera:0.0.1040977:hederaBip44",
|
|
398
|
+
"blockHash": null,
|
|
399
|
+
"blockHeight": 10,
|
|
400
|
+
"extra": {
|
|
401
|
+
"consensusTimestamp": "1764676088.728437000",
|
|
402
|
+
"memo": "Stake",
|
|
403
|
+
"pagingToken": "1764676088.728437000",
|
|
404
|
+
"transactionId": "0.0.1040977-1764676070-835083192",
|
|
405
|
+
},
|
|
406
|
+
"fee": "163226",
|
|
407
|
+
"hasFailed": false,
|
|
408
|
+
"hash": "BMngqkCurhw4aCSs6_fCjsZwYD-J2qZSWYQWBK9zQlSoS77O_DEi5xSo1y_sqgcX",
|
|
409
|
+
"id": "js:2:hedera:0.0.1040977:hederaBip44-BMngqkCurhw4aCSs6_fCjsZwYD-J2qZSWYQWBK9zQlSoS77O_DEi5xSo1y_sqgcX-UPDATE_ACCOUNT",
|
|
410
|
+
"recipients": [
|
|
411
|
+
"0.0.3",
|
|
412
|
+
],
|
|
413
|
+
"senders": [
|
|
414
|
+
"0.0.1040977",
|
|
415
|
+
],
|
|
416
|
+
"type": "UPDATE_ACCOUNT",
|
|
417
|
+
"value": "163226",
|
|
418
|
+
},
|
|
342
419
|
{
|
|
343
420
|
"accountId": "js:2:hedera:0.0.1040977:hederaBip44",
|
|
344
421
|
"blockHash": null,
|
|
@@ -654,6 +731,29 @@ exports[`hedera currency bridge scanAccounts hedera seed 1 2`] = `
|
|
|
654
731
|
"type": "IN",
|
|
655
732
|
"value": "98000000",
|
|
656
733
|
},
|
|
734
|
+
{
|
|
735
|
+
"accountId": "js:2:hedera:0.0.1040977:hederaBip44",
|
|
736
|
+
"blockHash": null,
|
|
737
|
+
"blockHeight": 10,
|
|
738
|
+
"extra": {
|
|
739
|
+
"consensusTimestamp": "1764676556.594347000",
|
|
740
|
+
"memo": "Unstake",
|
|
741
|
+
"pagingToken": "1764676556.594347000",
|
|
742
|
+
"transactionId": "0.0.1040977-1764676542-962449536",
|
|
743
|
+
},
|
|
744
|
+
"fee": "163309",
|
|
745
|
+
"hasFailed": false,
|
|
746
|
+
"hash": "Hjp3OhUDHHFXeOHCLzm2C13IT7qATHLSUvuLj0I5BOIEdRmxqFdc9A-eiC9mdYTg",
|
|
747
|
+
"id": "js:2:hedera:0.0.1040977:hederaBip44-Hjp3OhUDHHFXeOHCLzm2C13IT7qATHLSUvuLj0I5BOIEdRmxqFdc9A-eiC9mdYTg-UPDATE_ACCOUNT",
|
|
748
|
+
"recipients": [
|
|
749
|
+
"0.0.3",
|
|
750
|
+
],
|
|
751
|
+
"senders": [
|
|
752
|
+
"0.0.1040977",
|
|
753
|
+
],
|
|
754
|
+
"type": "UPDATE_ACCOUNT",
|
|
755
|
+
"value": "163309",
|
|
756
|
+
},
|
|
657
757
|
{
|
|
658
758
|
"accountId": "js:2:hedera:0.0.1040977:hederaBip44",
|
|
659
759
|
"blockHash": null,
|
|
@@ -724,6 +824,52 @@ exports[`hedera currency bridge scanAccounts hedera seed 1 2`] = `
|
|
|
724
824
|
"type": "IN",
|
|
725
825
|
"value": "99870000",
|
|
726
826
|
},
|
|
827
|
+
{
|
|
828
|
+
"accountId": "js:2:hedera:0.0.1040977:hederaBip44",
|
|
829
|
+
"blockHash": null,
|
|
830
|
+
"blockHeight": 10,
|
|
831
|
+
"extra": {
|
|
832
|
+
"consensusTimestamp": "1764676452.498442000",
|
|
833
|
+
"memo": "Stake",
|
|
834
|
+
"pagingToken": "1764676452.498442000",
|
|
835
|
+
"transactionId": "0.0.1040977-1764676435-598710986",
|
|
836
|
+
},
|
|
837
|
+
"fee": "163226",
|
|
838
|
+
"hasFailed": false,
|
|
839
|
+
"hash": "isU2vxS30gIzkizC9qpjv7A7QKuLy_OjXCRCEdVegehf6oavk3770Agu7R0cDnJE",
|
|
840
|
+
"id": "js:2:hedera:0.0.1040977:hederaBip44-isU2vxS30gIzkizC9qpjv7A7QKuLy_OjXCRCEdVegehf6oavk3770Agu7R0cDnJE-UPDATE_ACCOUNT",
|
|
841
|
+
"recipients": [
|
|
842
|
+
"0.0.3",
|
|
843
|
+
],
|
|
844
|
+
"senders": [
|
|
845
|
+
"0.0.1040977",
|
|
846
|
+
],
|
|
847
|
+
"type": "UPDATE_ACCOUNT",
|
|
848
|
+
"value": "163226",
|
|
849
|
+
},
|
|
850
|
+
{
|
|
851
|
+
"accountId": "js:2:hedera:0.0.1040977:hederaBip44",
|
|
852
|
+
"blockHash": null,
|
|
853
|
+
"blockHeight": 10,
|
|
854
|
+
"extra": {
|
|
855
|
+
"consensusTimestamp": "1764676635.614168000",
|
|
856
|
+
"memo": "Restake",
|
|
857
|
+
"pagingToken": "1764676635.614168000",
|
|
858
|
+
"transactionId": "0.0.1040977-1764676618-505767166",
|
|
859
|
+
},
|
|
860
|
+
"fee": "163309",
|
|
861
|
+
"hasFailed": false,
|
|
862
|
+
"hash": "JhrnOAxqfXnZrMe0U7YFB1M_Odko2DvtA113S92D1DHDX4mpTybW9TldrZG6VBeY",
|
|
863
|
+
"id": "js:2:hedera:0.0.1040977:hederaBip44-JhrnOAxqfXnZrMe0U7YFB1M_Odko2DvtA113S92D1DHDX4mpTybW9TldrZG6VBeY-UPDATE_ACCOUNT",
|
|
864
|
+
"recipients": [
|
|
865
|
+
"0.0.3",
|
|
866
|
+
],
|
|
867
|
+
"senders": [
|
|
868
|
+
"0.0.1040977",
|
|
869
|
+
],
|
|
870
|
+
"type": "UPDATE_ACCOUNT",
|
|
871
|
+
"value": "163309",
|
|
872
|
+
},
|
|
727
873
|
{
|
|
728
874
|
"accountId": "",
|
|
729
875
|
"blockHash": null,
|
|
@@ -915,6 +1061,52 @@ exports[`hedera currency bridge scanAccounts hedera seed 1 2`] = `
|
|
|
915
1061
|
"type": "OUT",
|
|
916
1062
|
"value": "1000054816",
|
|
917
1063
|
},
|
|
1064
|
+
{
|
|
1065
|
+
"accountId": "js:2:hedera:0.0.1040977:hederaBip44",
|
|
1066
|
+
"blockHash": null,
|
|
1067
|
+
"blockHeight": 10,
|
|
1068
|
+
"extra": {
|
|
1069
|
+
"consensusTimestamp": "1764676405.364046000",
|
|
1070
|
+
"memo": "Unstake",
|
|
1071
|
+
"pagingToken": "1764676405.364046000",
|
|
1072
|
+
"transactionId": "0.0.1040977-1764676388-012116929",
|
|
1073
|
+
},
|
|
1074
|
+
"fee": "163309",
|
|
1075
|
+
"hasFailed": false,
|
|
1076
|
+
"hash": "o_lyqFg3vhdJa7uyo6xyVQzx-mGWHAsIa_XQ09gLUmUKvamUv5ROiMMTcmrnyLyD",
|
|
1077
|
+
"id": "js:2:hedera:0.0.1040977:hederaBip44-o_lyqFg3vhdJa7uyo6xyVQzx-mGWHAsIa_XQ09gLUmUKvamUv5ROiMMTcmrnyLyD-UPDATE_ACCOUNT",
|
|
1078
|
+
"recipients": [
|
|
1079
|
+
"0.0.3",
|
|
1080
|
+
],
|
|
1081
|
+
"senders": [
|
|
1082
|
+
"0.0.1040977",
|
|
1083
|
+
],
|
|
1084
|
+
"type": "UPDATE_ACCOUNT",
|
|
1085
|
+
"value": "163309",
|
|
1086
|
+
},
|
|
1087
|
+
{
|
|
1088
|
+
"accountId": "js:2:hedera:0.0.1040977:hederaBip44",
|
|
1089
|
+
"blockHash": null,
|
|
1090
|
+
"blockHeight": 10,
|
|
1091
|
+
"extra": {
|
|
1092
|
+
"consensusTimestamp": "1764676526.955756000",
|
|
1093
|
+
"memo": "Restake",
|
|
1094
|
+
"pagingToken": "1764676526.955756000",
|
|
1095
|
+
"transactionId": "0.0.1040977-1764676513-182900536",
|
|
1096
|
+
},
|
|
1097
|
+
"fee": "163309",
|
|
1098
|
+
"hasFailed": false,
|
|
1099
|
+
"hash": "qc2j0ge0X1-KuJ5A8PaqCgvtgGZONWE0AcQ-2ypl80ylTHJnVAqHlfbK6EaEBsXJ",
|
|
1100
|
+
"id": "js:2:hedera:0.0.1040977:hederaBip44-qc2j0ge0X1-KuJ5A8PaqCgvtgGZONWE0AcQ-2ypl80ylTHJnVAqHlfbK6EaEBsXJ-UPDATE_ACCOUNT",
|
|
1101
|
+
"recipients": [
|
|
1102
|
+
"0.0.3",
|
|
1103
|
+
],
|
|
1104
|
+
"senders": [
|
|
1105
|
+
"0.0.1040977",
|
|
1106
|
+
],
|
|
1107
|
+
"type": "UPDATE_ACCOUNT",
|
|
1108
|
+
"value": "163309",
|
|
1109
|
+
},
|
|
918
1110
|
{
|
|
919
1111
|
"accountId": "js:2:hedera:0.0.1040977:hederaBip44",
|
|
920
1112
|
"blockHash": null,
|
|
@@ -962,6 +1154,29 @@ exports[`hedera currency bridge scanAccounts hedera seed 1 2`] = `
|
|
|
962
1154
|
"type": "OUT",
|
|
963
1155
|
"value": "187669298",
|
|
964
1156
|
},
|
|
1157
|
+
{
|
|
1158
|
+
"accountId": "js:2:hedera:0.0.1040977:hederaBip44",
|
|
1159
|
+
"blockHash": null,
|
|
1160
|
+
"blockHeight": 10,
|
|
1161
|
+
"extra": {
|
|
1162
|
+
"consensusTimestamp": "1764676500.998306000",
|
|
1163
|
+
"memo": "Restake",
|
|
1164
|
+
"pagingToken": "1764676500.998306000",
|
|
1165
|
+
"transactionId": "0.0.1040977-1764676479-824016135",
|
|
1166
|
+
},
|
|
1167
|
+
"fee": "163309",
|
|
1168
|
+
"hasFailed": false,
|
|
1169
|
+
"hash": "RErEuVaA6cqxWE-mnc7KK0X_pbNQH4DfYZQtSlTkVjeOKcLtOCOxHhlsbSUX_ytM",
|
|
1170
|
+
"id": "js:2:hedera:0.0.1040977:hederaBip44-RErEuVaA6cqxWE-mnc7KK0X_pbNQH4DfYZQtSlTkVjeOKcLtOCOxHhlsbSUX_ytM-UPDATE_ACCOUNT",
|
|
1171
|
+
"recipients": [
|
|
1172
|
+
"0.0.3",
|
|
1173
|
+
],
|
|
1174
|
+
"senders": [
|
|
1175
|
+
"0.0.1040977",
|
|
1176
|
+
],
|
|
1177
|
+
"type": "UPDATE_ACCOUNT",
|
|
1178
|
+
"value": "163309",
|
|
1179
|
+
},
|
|
965
1180
|
{
|
|
966
1181
|
"accountId": "js:2:hedera:0.0.1040977:hederaBip44",
|
|
967
1182
|
"blockHash": null,
|
|
@@ -1734,14 +1949,14 @@ exports[`hedera currency bridge scanAccounts hedera seed 1 2`] = `
|
|
|
1734
1949
|
"fee": "414180",
|
|
1735
1950
|
"hasFailed": false,
|
|
1736
1951
|
"hash": "SX6QjkXKRGbFG1tWq31I0rv1Aof4r9iRXxLlxd_tO6YNuER_6CCmvW_s47FtPVhl",
|
|
1737
|
-
"id": "js:2:hedera:0.0.7305122:hederaBip44-SX6QjkXKRGbFG1tWq31I0rv1Aof4r9iRXxLlxd_tO6YNuER_6CCmvW_s47FtPVhl-
|
|
1952
|
+
"id": "js:2:hedera:0.0.7305122:hederaBip44-SX6QjkXKRGbFG1tWq31I0rv1Aof4r9iRXxLlxd_tO6YNuER_6CCmvW_s47FtPVhl-UPDATE_ACCOUNT",
|
|
1738
1953
|
"recipients": [
|
|
1739
1954
|
"0.0.25",
|
|
1740
1955
|
],
|
|
1741
1956
|
"senders": [
|
|
1742
1957
|
"0.0.7305122",
|
|
1743
1958
|
],
|
|
1744
|
-
"type": "
|
|
1959
|
+
"type": "UPDATE_ACCOUNT",
|
|
1745
1960
|
"value": "414180",
|
|
1746
1961
|
},
|
|
1747
1962
|
{
|
|
@@ -1803,14 +2018,14 @@ exports[`hedera currency bridge scanAccounts hedera seed 1 2`] = `
|
|
|
1803
2018
|
"fee": "415339",
|
|
1804
2019
|
"hasFailed": false,
|
|
1805
2020
|
"hash": "ZPCrj02WZwh_depYNheXuCLRpq6gDHfxeskEvIr-PCZzoM9WdUUSswRqRf-bZZfS",
|
|
1806
|
-
"id": "js:2:hedera:0.0.7305122:hederaBip44-ZPCrj02WZwh_depYNheXuCLRpq6gDHfxeskEvIr-PCZzoM9WdUUSswRqRf-bZZfS-
|
|
2021
|
+
"id": "js:2:hedera:0.0.7305122:hederaBip44-ZPCrj02WZwh_depYNheXuCLRpq6gDHfxeskEvIr-PCZzoM9WdUUSswRqRf-bZZfS-UPDATE_ACCOUNT",
|
|
1807
2022
|
"recipients": [
|
|
1808
2023
|
"0.0.23",
|
|
1809
2024
|
],
|
|
1810
2025
|
"senders": [
|
|
1811
2026
|
"0.0.7305122",
|
|
1812
2027
|
],
|
|
1813
|
-
"type": "
|
|
2028
|
+
"type": "UPDATE_ACCOUNT",
|
|
1814
2029
|
"value": "415339",
|
|
1815
2030
|
},
|
|
1816
2031
|
{
|
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @jest-environment jsdom
|
|
3
|
+
*/
|
|
4
|
+
import "../../__tests__/test-helpers/dom-polyfill";
|
|
5
|
+
import BigNumber from "bignumber.js";
|
|
6
|
+
import invariant from "invariant";
|
|
7
|
+
import { getCurrentHederaPreloadData } from "@ledgerhq/coin-hedera/preload-data";
|
|
8
|
+
import { apiClient } from "@ledgerhq/coin-hedera/network/api";
|
|
9
|
+
import { LiveConfig } from "@ledgerhq/live-config/LiveConfig";
|
|
10
|
+
import { renderHook } from "@testing-library/react";
|
|
11
|
+
import { makeBridgeCacheSystem } from "../../bridge/cache";
|
|
12
|
+
import { liveConfig } from "../../config/sharedConfig";
|
|
13
|
+
import { getCryptoCurrencyById } from "../../currencies";
|
|
14
|
+
import * as hooks from "./react";
|
|
15
|
+
import type { HederaAccount, HederaDelegation } from "./types";
|
|
16
|
+
|
|
17
|
+
const localCache: Record<string, unknown> = {};
|
|
18
|
+
const cache = makeBridgeCacheSystem({
|
|
19
|
+
saveData(c, d) {
|
|
20
|
+
localCache[c.id] = d;
|
|
21
|
+
return Promise.resolve();
|
|
22
|
+
},
|
|
23
|
+
getData(c) {
|
|
24
|
+
return Promise.resolve(localCache[c.id]);
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
describe("hedera/react", () => {
|
|
29
|
+
const currency = getCryptoCurrencyById("hedera");
|
|
30
|
+
|
|
31
|
+
beforeAll(() => {
|
|
32
|
+
LiveConfig.setConfig(liveConfig);
|
|
33
|
+
jest.spyOn(apiClient, "getNodes").mockResolvedValue([
|
|
34
|
+
{
|
|
35
|
+
description: "Hosted by LG | Seoul, South Korea",
|
|
36
|
+
node_id: 0,
|
|
37
|
+
node_account_id: "0.0.3",
|
|
38
|
+
stake: 45000000000000000,
|
|
39
|
+
stake_rewarded: 86596417100000000,
|
|
40
|
+
min_stake: 0,
|
|
41
|
+
max_stake: 45000000000000000,
|
|
42
|
+
reward_rate_start: 3500,
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
description: "Hosted by Swirlds | Iowa, USA",
|
|
46
|
+
node_id: 1,
|
|
47
|
+
node_account_id: "0.0.4",
|
|
48
|
+
stake: 45000000000000000,
|
|
49
|
+
stake_rewarded: 88990261300000000,
|
|
50
|
+
min_stake: 0,
|
|
51
|
+
max_stake: 45000000000000000,
|
|
52
|
+
reward_rate_start: 4000,
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
description: "Hosted for Wipro | Amsterdam, Netherlands",
|
|
56
|
+
node_id: 3,
|
|
57
|
+
node_account_id: "0.0.6",
|
|
58
|
+
stake: 45000000000000000,
|
|
59
|
+
stake_rewarded: 21477855400000000,
|
|
60
|
+
min_stake: 0,
|
|
61
|
+
max_stake: 45000000000000000,
|
|
62
|
+
reward_rate_start: 5000,
|
|
63
|
+
},
|
|
64
|
+
]);
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
describe("useHederaPreloadData", () => {
|
|
68
|
+
beforeEach(async () => {
|
|
69
|
+
const { prepare } = setup();
|
|
70
|
+
await prepare();
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
it("should return preloaded data", async () => {
|
|
74
|
+
const { result } = renderHook(() => hooks.useHederaPreloadData(currency));
|
|
75
|
+
const data = getCurrentHederaPreloadData(currency);
|
|
76
|
+
|
|
77
|
+
expect(result.current).toStrictEqual(data);
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
describe("useHederaValidators", () => {
|
|
82
|
+
beforeEach(async () => {
|
|
83
|
+
const { prepare } = setup();
|
|
84
|
+
await prepare();
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
it("should return all validators when no search query", () => {
|
|
88
|
+
const { result } = renderHook(() => hooks.useHederaValidators(currency));
|
|
89
|
+
const data = getCurrentHederaPreloadData(currency);
|
|
90
|
+
|
|
91
|
+
expect(result.current).toEqual(data.validators);
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
it("should return all validators when search query is empty string", () => {
|
|
95
|
+
const { result } = renderHook(() => hooks.useHederaValidators(currency, ""));
|
|
96
|
+
const data = getCurrentHederaPreloadData(currency);
|
|
97
|
+
|
|
98
|
+
expect(result.current).toEqual(data.validators);
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
it("should filter validators by name", () => {
|
|
102
|
+
const { result } = renderHook(() => hooks.useHederaValidators(currency, "Swirlds"));
|
|
103
|
+
|
|
104
|
+
expect(result.current.length).toBeGreaterThan(0);
|
|
105
|
+
result.current.forEach(validator => {
|
|
106
|
+
expect(validator.name.toLowerCase()).toContain("swirlds");
|
|
107
|
+
});
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
it("should filter validators by node ID", () => {
|
|
111
|
+
const data = getCurrentHederaPreloadData(currency);
|
|
112
|
+
const firstValidator = data.validators[0];
|
|
113
|
+
|
|
114
|
+
if (firstValidator) {
|
|
115
|
+
const { result } = renderHook(() =>
|
|
116
|
+
hooks.useHederaValidators(currency, firstValidator.nodeId.toString()),
|
|
117
|
+
);
|
|
118
|
+
|
|
119
|
+
expect(result.current.length).toBeGreaterThan(0);
|
|
120
|
+
expect(result.current.some(v => v.nodeId === firstValidator.nodeId)).toBe(true);
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
it("should return empty array when no validators match search", () => {
|
|
125
|
+
const { result } = renderHook(() =>
|
|
126
|
+
hooks.useHederaValidators(currency, "nonexistingvalidator"),
|
|
127
|
+
);
|
|
128
|
+
|
|
129
|
+
expect(result.current).toEqual([]);
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
it("should be case insensitive when filtering", () => {
|
|
133
|
+
const { result: upperResult } = renderHook(() =>
|
|
134
|
+
hooks.useHederaValidators(currency, "SWIRLDS"),
|
|
135
|
+
);
|
|
136
|
+
const { result: lowerResult } = renderHook(() =>
|
|
137
|
+
hooks.useHederaValidators(currency, "swirlds"),
|
|
138
|
+
);
|
|
139
|
+
|
|
140
|
+
expect(upperResult.current.length).toEqual(lowerResult.current.length);
|
|
141
|
+
});
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
describe("useHederaEnrichedDelegation", () => {
|
|
145
|
+
const mockAccount = {
|
|
146
|
+
type: "Account",
|
|
147
|
+
id: "mock-account-id",
|
|
148
|
+
currency,
|
|
149
|
+
balance: new BigNumber(1000000),
|
|
150
|
+
spendableBalance: new BigNumber(1000000),
|
|
151
|
+
hederaResources: {
|
|
152
|
+
delegation: null,
|
|
153
|
+
},
|
|
154
|
+
} as HederaAccount;
|
|
155
|
+
|
|
156
|
+
beforeEach(async () => {
|
|
157
|
+
const { prepare } = setup();
|
|
158
|
+
await prepare();
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
it("should enrich delegation with validator data", () => {
|
|
162
|
+
const data = getCurrentHederaPreloadData(currency);
|
|
163
|
+
const validator = data.validators[0];
|
|
164
|
+
invariant(validator, "No validators available for test");
|
|
165
|
+
|
|
166
|
+
const delegation: HederaDelegation = {
|
|
167
|
+
nodeId: validator.nodeId,
|
|
168
|
+
delegated: new BigNumber(100000),
|
|
169
|
+
pendingReward: new BigNumber(500),
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
const { result } = renderHook(() =>
|
|
173
|
+
hooks.useHederaEnrichedDelegation(mockAccount, delegation),
|
|
174
|
+
);
|
|
175
|
+
|
|
176
|
+
expect(result.current).toEqual({
|
|
177
|
+
nodeId: validator.nodeId,
|
|
178
|
+
delegated: delegation.delegated,
|
|
179
|
+
pendingReward: delegation.pendingReward,
|
|
180
|
+
status: "overstaked",
|
|
181
|
+
validator: {
|
|
182
|
+
name: validator.name,
|
|
183
|
+
address: validator.address,
|
|
184
|
+
addressChecksum: validator.addressChecksum,
|
|
185
|
+
nodeId: validator.nodeId,
|
|
186
|
+
minStake: validator.minStake,
|
|
187
|
+
maxStake: validator.maxStake,
|
|
188
|
+
activeStake: validator.activeStake,
|
|
189
|
+
activeStakePercentage: validator.activeStakePercentage,
|
|
190
|
+
overstaked: validator.overstaked,
|
|
191
|
+
},
|
|
192
|
+
});
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
it("should handle delegation with non-existent validator", () => {
|
|
196
|
+
const delegation: HederaDelegation = {
|
|
197
|
+
nodeId: 999999,
|
|
198
|
+
delegated: new BigNumber(100000),
|
|
199
|
+
pendingReward: new BigNumber(500),
|
|
200
|
+
};
|
|
201
|
+
|
|
202
|
+
const { result } = renderHook(() =>
|
|
203
|
+
hooks.useHederaEnrichedDelegation(mockAccount, delegation),
|
|
204
|
+
);
|
|
205
|
+
|
|
206
|
+
expect(result.current).toEqual({
|
|
207
|
+
nodeId: delegation.nodeId,
|
|
208
|
+
delegated: delegation.delegated,
|
|
209
|
+
pendingReward: delegation.pendingReward,
|
|
210
|
+
status: "inactive",
|
|
211
|
+
validator: {
|
|
212
|
+
name: "",
|
|
213
|
+
address: "",
|
|
214
|
+
addressChecksum: null,
|
|
215
|
+
nodeId: delegation.nodeId,
|
|
216
|
+
minStake: new BigNumber(0),
|
|
217
|
+
maxStake: new BigNumber(0),
|
|
218
|
+
activeStake: new BigNumber(0),
|
|
219
|
+
activeStakePercentage: new BigNumber(0),
|
|
220
|
+
overstaked: false,
|
|
221
|
+
},
|
|
222
|
+
});
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
it("should handle delegation with zero staked amount", () => {
|
|
226
|
+
const data = getCurrentHederaPreloadData(currency);
|
|
227
|
+
const validator = data.validators[0];
|
|
228
|
+
invariant(validator, "No validators available for test");
|
|
229
|
+
|
|
230
|
+
const delegation: HederaDelegation = {
|
|
231
|
+
nodeId: validator.nodeId,
|
|
232
|
+
delegated: new BigNumber(0),
|
|
233
|
+
pendingReward: new BigNumber(0),
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
const { result } = renderHook(() =>
|
|
237
|
+
hooks.useHederaEnrichedDelegation(mockAccount, delegation),
|
|
238
|
+
);
|
|
239
|
+
|
|
240
|
+
expect(result.current.delegated).toEqual(new BigNumber(0));
|
|
241
|
+
expect(result.current.validator.nodeId).toEqual(validator.nodeId);
|
|
242
|
+
});
|
|
243
|
+
|
|
244
|
+
it("should handle delegation with pending rewards", () => {
|
|
245
|
+
const data = getCurrentHederaPreloadData(currency);
|
|
246
|
+
const validator = data.validators[0];
|
|
247
|
+
invariant(validator, "No validators available for test");
|
|
248
|
+
|
|
249
|
+
const delegation: HederaDelegation = {
|
|
250
|
+
nodeId: validator.nodeId,
|
|
251
|
+
delegated: new BigNumber(100000),
|
|
252
|
+
pendingReward: new BigNumber(1500),
|
|
253
|
+
};
|
|
254
|
+
|
|
255
|
+
const { result } = renderHook(() =>
|
|
256
|
+
hooks.useHederaEnrichedDelegation(mockAccount, delegation),
|
|
257
|
+
);
|
|
258
|
+
|
|
259
|
+
expect(result.current.pendingReward).toEqual(new BigNumber(1500));
|
|
260
|
+
});
|
|
261
|
+
});
|
|
262
|
+
});
|
|
263
|
+
|
|
264
|
+
function setup(): {
|
|
265
|
+
prepare: () => Promise<unknown>;
|
|
266
|
+
} {
|
|
267
|
+
const currency = getCryptoCurrencyById("hedera");
|
|
268
|
+
|
|
269
|
+
return {
|
|
270
|
+
prepare: async () => cache.prepareCurrency(currency),
|
|
271
|
+
};
|
|
272
|
+
}
|