@ledgerhq/coin-hedera 1.15.0-nightly.20251205111238 → 1.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (187) hide show
  1. package/.turbo/turbo-build.log +1 -1
  2. package/CHANGELOG.md +26 -10
  3. package/lib/bridge/buildOptimisticOperation.d.ts.map +1 -1
  4. package/lib/bridge/buildOptimisticOperation.js +0 -33
  5. package/lib/bridge/buildOptimisticOperation.js.map +1 -1
  6. package/lib/bridge/getTransactionStatus.d.ts.map +1 -1
  7. package/lib/bridge/getTransactionStatus.js +0 -54
  8. package/lib/bridge/getTransactionStatus.js.map +1 -1
  9. package/lib/bridge/index.d.ts.map +1 -1
  10. package/lib/bridge/index.js +2 -4
  11. package/lib/bridge/index.js.map +1 -1
  12. package/lib/bridge/prepareTransaction.d.ts.map +1 -1
  13. package/lib/bridge/prepareTransaction.js +0 -16
  14. package/lib/bridge/prepareTransaction.js.map +1 -1
  15. package/lib/bridge/serialization.d.ts.map +1 -1
  16. package/lib/bridge/serialization.js +0 -20
  17. package/lib/bridge/serialization.js.map +1 -1
  18. package/lib/bridge/signOperation.d.ts +4 -4
  19. package/lib/bridge/signOperation.d.ts.map +1 -1
  20. package/lib/bridge/signOperation.js +0 -10
  21. package/lib/bridge/signOperation.js.map +1 -1
  22. package/lib/bridge/synchronisation.d.ts.map +1 -1
  23. package/lib/bridge/synchronisation.js +0 -8
  24. package/lib/bridge/synchronisation.js.map +1 -1
  25. package/lib/constants.d.ts +1 -21
  26. package/lib/constants.d.ts.map +1 -1
  27. package/lib/constants.js +1 -22
  28. package/lib/constants.js.map +1 -1
  29. package/lib/deviceTransactionConfig.d.ts.map +1 -1
  30. package/lib/deviceTransactionConfig.js +0 -30
  31. package/lib/deviceTransactionConfig.js.map +1 -1
  32. package/lib/errors.d.ts +0 -9
  33. package/lib/errors.d.ts.map +1 -1
  34. package/lib/errors.js +1 -4
  35. package/lib/errors.js.map +1 -1
  36. package/lib/logic/craftTransaction.d.ts +2 -2
  37. package/lib/logic/craftTransaction.d.ts.map +1 -1
  38. package/lib/logic/craftTransaction.js +8 -42
  39. package/lib/logic/craftTransaction.js.map +1 -1
  40. package/lib/logic/getBlock.d.ts.map +1 -1
  41. package/lib/logic/getBlock.js +0 -1
  42. package/lib/logic/getBlock.js.map +1 -1
  43. package/lib/logic/listOperations.d.ts.map +1 -1
  44. package/lib/logic/listOperations.js +7 -39
  45. package/lib/logic/listOperations.js.map +1 -1
  46. package/lib/logic/utils.d.ts +3 -61
  47. package/lib/logic/utils.d.ts.map +1 -1
  48. package/lib/logic/utils.js +3 -116
  49. package/lib/logic/utils.js.map +1 -1
  50. package/lib/network/api.d.ts +1 -3
  51. package/lib/network/api.d.ts.map +1 -1
  52. package/lib/network/api.js +0 -19
  53. package/lib/network/api.js.map +1 -1
  54. package/lib/test/fixtures/account.fixture.d.ts +1 -1
  55. package/lib/test/fixtures/account.fixture.d.ts.map +1 -1
  56. package/lib/test/fixtures/account.fixture.js +0 -2
  57. package/lib/test/fixtures/account.fixture.js.map +1 -1
  58. package/lib/transaction.d.ts.map +1 -1
  59. package/lib/transaction.js +0 -34
  60. package/lib/transaction.js.map +1 -1
  61. package/lib/types/alpaca.d.ts +0 -3
  62. package/lib/types/alpaca.d.ts.map +1 -1
  63. package/lib/types/bridge.d.ts +3 -87
  64. package/lib/types/bridge.d.ts.map +1 -1
  65. package/lib/types/logic.d.ts +1 -5
  66. package/lib/types/logic.d.ts.map +1 -1
  67. package/lib/types/mirror.d.ts +0 -19
  68. package/lib/types/mirror.d.ts.map +1 -1
  69. package/lib-es/bridge/buildOptimisticOperation.d.ts.map +1 -1
  70. package/lib-es/bridge/buildOptimisticOperation.js +1 -34
  71. package/lib-es/bridge/buildOptimisticOperation.js.map +1 -1
  72. package/lib-es/bridge/getTransactionStatus.d.ts.map +1 -1
  73. package/lib-es/bridge/getTransactionStatus.js +3 -57
  74. package/lib-es/bridge/getTransactionStatus.js.map +1 -1
  75. package/lib-es/bridge/index.d.ts.map +1 -1
  76. package/lib-es/bridge/index.js +2 -4
  77. package/lib-es/bridge/index.js.map +1 -1
  78. package/lib-es/bridge/prepareTransaction.d.ts.map +1 -1
  79. package/lib-es/bridge/prepareTransaction.js +2 -15
  80. package/lib-es/bridge/prepareTransaction.js.map +1 -1
  81. package/lib-es/bridge/serialization.d.ts.map +1 -1
  82. package/lib-es/bridge/serialization.js +0 -17
  83. package/lib-es/bridge/serialization.js.map +1 -1
  84. package/lib-es/bridge/signOperation.d.ts +4 -4
  85. package/lib-es/bridge/signOperation.d.ts.map +1 -1
  86. package/lib-es/bridge/signOperation.js +1 -11
  87. package/lib-es/bridge/signOperation.js.map +1 -1
  88. package/lib-es/bridge/synchronisation.d.ts.map +1 -1
  89. package/lib-es/bridge/synchronisation.js +0 -8
  90. package/lib-es/bridge/synchronisation.js.map +1 -1
  91. package/lib-es/constants.d.ts +1 -21
  92. package/lib-es/constants.d.ts.map +1 -1
  93. package/lib-es/constants.js +0 -21
  94. package/lib-es/constants.js.map +1 -1
  95. package/lib-es/deviceTransactionConfig.d.ts.map +1 -1
  96. package/lib-es/deviceTransactionConfig.js +1 -31
  97. package/lib-es/deviceTransactionConfig.js.map +1 -1
  98. package/lib-es/errors.d.ts +0 -9
  99. package/lib-es/errors.d.ts.map +1 -1
  100. package/lib-es/errors.js +0 -3
  101. package/lib-es/errors.js.map +1 -1
  102. package/lib-es/logic/craftTransaction.d.ts +2 -2
  103. package/lib-es/logic/craftTransaction.d.ts.map +1 -1
  104. package/lib-es/logic/craftTransaction.js +10 -44
  105. package/lib-es/logic/craftTransaction.js.map +1 -1
  106. package/lib-es/logic/getBlock.d.ts.map +1 -1
  107. package/lib-es/logic/getBlock.js +1 -2
  108. package/lib-es/logic/getBlock.js.map +1 -1
  109. package/lib-es/logic/listOperations.d.ts.map +1 -1
  110. package/lib-es/logic/listOperations.js +7 -39
  111. package/lib-es/logic/listOperations.js.map +1 -1
  112. package/lib-es/logic/utils.d.ts +3 -61
  113. package/lib-es/logic/utils.d.ts.map +1 -1
  114. package/lib-es/logic/utils.js +3 -106
  115. package/lib-es/logic/utils.js.map +1 -1
  116. package/lib-es/network/api.d.ts +1 -3
  117. package/lib-es/network/api.d.ts.map +1 -1
  118. package/lib-es/network/api.js +0 -19
  119. package/lib-es/network/api.js.map +1 -1
  120. package/lib-es/test/fixtures/account.fixture.d.ts +1 -1
  121. package/lib-es/test/fixtures/account.fixture.d.ts.map +1 -1
  122. package/lib-es/test/fixtures/account.fixture.js +0 -2
  123. package/lib-es/test/fixtures/account.fixture.js.map +1 -1
  124. package/lib-es/transaction.d.ts.map +1 -1
  125. package/lib-es/transaction.js +0 -34
  126. package/lib-es/transaction.js.map +1 -1
  127. package/lib-es/types/alpaca.d.ts +0 -3
  128. package/lib-es/types/alpaca.d.ts.map +1 -1
  129. package/lib-es/types/bridge.d.ts +3 -87
  130. package/lib-es/types/bridge.d.ts.map +1 -1
  131. package/lib-es/types/logic.d.ts +1 -5
  132. package/lib-es/types/logic.d.ts.map +1 -1
  133. package/lib-es/types/mirror.d.ts +0 -19
  134. package/lib-es/types/mirror.d.ts.map +1 -1
  135. package/package.json +9 -10
  136. package/src/api/index.integ.test.ts +1 -11
  137. package/src/bridge/buildOptimisticOperation.integration.test.ts +4 -159
  138. package/src/bridge/buildOptimisticOperation.ts +2 -50
  139. package/src/bridge/getTransactionStatus.test.ts +21 -191
  140. package/src/bridge/getTransactionStatus.ts +1 -75
  141. package/src/bridge/index.ts +2 -4
  142. package/src/bridge/prepareTransaction.test.ts +8 -112
  143. package/src/bridge/prepareTransaction.ts +2 -20
  144. package/src/bridge/serialization.ts +0 -17
  145. package/src/bridge/signOperation.ts +5 -15
  146. package/src/bridge/synchronisation.ts +0 -9
  147. package/src/bridge/utils.integration.test.ts +10 -3
  148. package/src/constants.ts +0 -22
  149. package/src/deviceTransactionConfig.ts +1 -37
  150. package/src/errors.ts +0 -7
  151. package/src/logic/craftTransaction.ts +13 -70
  152. package/src/logic/getBalance.test.ts +16 -15
  153. package/src/logic/getBlock.ts +1 -2
  154. package/src/logic/listOperations.test.ts +29 -86
  155. package/src/logic/listOperations.ts +6 -46
  156. package/src/logic/utils.test.ts +8 -362
  157. package/src/logic/utils.ts +3 -157
  158. package/src/network/api.test.ts +6 -58
  159. package/src/network/api.ts +0 -25
  160. package/src/network/thirdweb.test.ts +2 -2
  161. package/src/network/utils.test.ts +6 -4
  162. package/src/test/fixtures/account.fixture.ts +1 -3
  163. package/src/transaction.ts +0 -42
  164. package/src/types/alpaca.ts +0 -4
  165. package/src/types/bridge.ts +3 -108
  166. package/src/types/logic.ts +1 -6
  167. package/src/types/mirror.ts +0 -21
  168. package/lib/preload-data.d.ts +0 -7
  169. package/lib/preload-data.d.ts.map +0 -1
  170. package/lib/preload-data.js +0 -37
  171. package/lib/preload-data.js.map +0 -1
  172. package/lib/preload.d.ts +0 -8
  173. package/lib/preload.d.ts.map +0 -1
  174. package/lib/preload.js +0 -76
  175. package/lib/preload.js.map +0 -1
  176. package/lib-es/preload-data.d.ts +0 -7
  177. package/lib-es/preload-data.d.ts.map +0 -1
  178. package/lib-es/preload-data.js +0 -31
  179. package/lib-es/preload-data.js.map +0 -1
  180. package/lib-es/preload.d.ts +0 -8
  181. package/lib-es/preload.d.ts.map +0 -1
  182. package/lib-es/preload.js +0 -67
  183. package/lib-es/preload.js.map +0 -1
  184. package/src/deviceTransactionConfig.test.ts +0 -315
  185. package/src/preload-data.ts +0 -38
  186. package/src/preload.test.ts +0 -64
  187. package/src/preload.ts +0 -80
@@ -1,14 +1,11 @@
1
- import BigNumber from "bignumber.js";
2
- import { setupMockCryptoAssetsStore } from "@ledgerhq/cryptoassets/cal-client/test-helpers";
3
1
  import { encodeTokenAccountId } from "@ledgerhq/coin-framework/account/accountId";
4
2
  import { encodeOperationId } from "@ledgerhq/coin-framework/operation";
5
3
  import type { Pagination } from "@ledgerhq/coin-framework/api/types";
6
- import { getEnv } from "@ledgerhq/live-env";
7
4
  import { listOperations } from "./listOperations";
8
5
  import { apiClient } from "../network/api";
9
6
  import { getMockedCurrency } from "../test/fixtures/currency.fixture";
10
- import type { HederaMirrorTransaction } from "../types";
11
7
  import * as utils from "./utils";
8
+ import { setupMockCryptoAssetsStore } from "@ledgerhq/cryptoassets/cal-client/test-helpers";
12
9
 
13
10
  setupMockCryptoAssetsStore();
14
11
  jest.mock("@ledgerhq/coin-framework/account/accountId");
@@ -76,7 +73,7 @@ describe("listOperations", () => {
76
73
  order: "desc",
77
74
  };
78
75
 
79
- const mockTransactions: Partial<HederaMirrorTransaction>[] = [
76
+ const mockTransactions = [
80
77
  {
81
78
  consensus_timestamp: "1625097600.000000000",
82
79
  transaction_hash: "hash1",
@@ -84,10 +81,9 @@ describe("listOperations", () => {
84
81
  result: "SUCCESS",
85
82
  memo_base64: "test-memo",
86
83
  token_transfers: [],
87
- staking_reward_transfers: [],
88
84
  transfers: [
89
- { account: address, amount: -1000000 },
90
- { account: "0.0.67890", amount: 1000000 },
85
+ { account: address, amount: "-1000000" },
86
+ { account: "0.0.67890", amount: "1000000" },
91
87
  ],
92
88
  name: "CRYPTOTRANSFER",
93
89
  },
@@ -109,8 +105,9 @@ describe("listOperations", () => {
109
105
  useSyntheticBlocks: false,
110
106
  });
111
107
 
112
- expect(result.tokenOperations).toEqual([]);
113
108
  expect(result.coinOperations).toHaveLength(1);
109
+ expect(result.tokenOperations).toEqual([]);
110
+
114
111
  expect(result.coinOperations).toMatchObject([
115
112
  {
116
113
  type: "OUT",
@@ -147,17 +144,16 @@ describe("listOperations", () => {
147
144
  units: [{ name: "TT", code: "tt", magnitude: 6 }],
148
145
  };
149
146
 
150
- const mockTransactions: Partial<HederaMirrorTransaction>[] = [
147
+ const mockTransactions = [
151
148
  {
152
149
  consensus_timestamp: "1625097600.000000000",
153
150
  transaction_hash: "hash1",
154
151
  charged_tx_fee: 500000,
155
152
  result: "SUCCESS",
156
153
  token_transfers: [
157
- { token_id: tokenId, account: address, amount: -1000 },
158
- { token_id: tokenId, account: "0.0.67890", amount: 1000 },
154
+ { token_id: tokenId, account: address, amount: "-1000" },
155
+ { token_id: tokenId, account: "0.0.67890", amount: "1000" },
159
156
  ],
160
- staking_reward_transfers: [],
161
157
  transfers: [],
162
158
  name: "CRYPTOTRANSFER",
163
159
  },
@@ -184,12 +180,16 @@ describe("listOperations", () => {
184
180
  useSyntheticBlocks: false,
185
181
  });
186
182
 
183
+ expect(result.coinOperations).toHaveLength(1);
184
+ expect(result.tokenOperations).toHaveLength(1);
185
+
187
186
  expect(result.coinOperations).toMatchObject([
188
187
  {
189
188
  type: "FEES",
190
189
  fee: expect.any(Object),
191
190
  },
192
191
  ]);
192
+
193
193
  expect(result.tokenOperations).toMatchObject([
194
194
  {
195
195
  type: "OUT",
@@ -216,15 +216,14 @@ describe("listOperations", () => {
216
216
  order: "desc",
217
217
  };
218
218
 
219
- const mockTransactions: Partial<HederaMirrorTransaction>[] = [
219
+ const mockTransactions = [
220
220
  {
221
221
  consensus_timestamp: "1625097600.000000000",
222
222
  transaction_hash: "hash1",
223
223
  charged_tx_fee: 500000,
224
224
  result: "SUCCESS",
225
225
  token_transfers: [],
226
- staking_reward_transfers: [],
227
- transfers: [{ account: address, amount: -500000 }],
226
+ transfers: [{ account: address, amount: "-500000" }],
228
227
  name: "TOKENASSOCIATE",
229
228
  },
230
229
  ];
@@ -245,7 +244,9 @@ describe("listOperations", () => {
245
244
  useSyntheticBlocks: false,
246
245
  });
247
246
 
248
- expect(result.tokenOperations).toEqual([]);
247
+ expect(result.coinOperations).toHaveLength(1);
248
+ expect(result.tokenOperations).toHaveLength(0);
249
+
249
250
  expect(result.coinOperations).toMatchObject([
250
251
  {
251
252
  type: "ASSOCIATE_TOKEN",
@@ -272,17 +273,16 @@ describe("listOperations", () => {
272
273
  order: "desc",
273
274
  };
274
275
 
275
- const mockTransactions: Partial<HederaMirrorTransaction>[] = [
276
+ const mockTransactions = [
276
277
  {
277
278
  consensus_timestamp: "1625097600.000000000",
278
279
  transaction_hash: "hash1",
279
280
  charged_tx_fee: 500000,
280
281
  result: "SUCCESS",
281
282
  token_transfers: [
282
- { token_id: tokenId, account: address, amount: -1000 },
283
- { token_id: tokenId, account: "0.0.67890", amount: 1000 },
283
+ { token_id: tokenId, account: address, amount: "-1000" },
284
+ { token_id: tokenId, account: "0.0.67890", amount: "1000" },
284
285
  ],
285
- staking_reward_transfers: [],
286
286
  transfers: [],
287
287
  name: "CRYPTOTRANSFER",
288
288
  },
@@ -309,8 +309,8 @@ describe("listOperations", () => {
309
309
  useSyntheticBlocks: false,
310
310
  });
311
311
 
312
- expect(result.coinOperations).toEqual([]);
313
- expect(result.tokenOperations).toEqual([]);
312
+ expect(result.coinOperations).toHaveLength(0);
313
+ expect(result.tokenOperations).toHaveLength(0);
314
314
  });
315
315
 
316
316
  it("should use pagination parameters correctly", async () => {
@@ -358,18 +358,17 @@ describe("listOperations", () => {
358
358
  order: "desc",
359
359
  };
360
360
 
361
- const mockTransactions: Partial<HederaMirrorTransaction>[] = [
361
+ const mockTransactions = [
362
362
  {
363
363
  consensus_timestamp: "1625097600.000000000",
364
364
  transaction_hash: "hash1",
365
365
  charged_tx_fee: 500000,
366
366
  result: "INVALID_SIGNATURE",
367
- memo_base64: "",
367
+ memo_base64: null,
368
368
  token_transfers: [],
369
- staking_reward_transfers: [],
370
369
  transfers: [
371
- { account: address, amount: -1000000 },
372
- { account: "0.0.67890", amount: 1000000 },
370
+ { account: address, amount: "-1000000" },
371
+ { account: "0.0.67890", amount: "1000000" },
373
372
  ],
374
373
  name: "CRYPTOTRANSFER",
375
374
  },
@@ -391,63 +390,7 @@ describe("listOperations", () => {
391
390
  useSyntheticBlocks: false,
392
391
  });
393
392
 
394
- expect(result.coinOperations).toMatchObject([{ hasFailed: true }]);
395
- });
396
-
397
- it("should create REWARD operation when staking rewards are present", async () => {
398
- const address = "0.0.1234567";
399
- const mockCurrency = getMockedCurrency();
400
- const pagination: Pagination = {
401
- minHeight: 0,
402
- limit: 10,
403
- order: "desc",
404
- };
405
- const mockTransaction: Partial<HederaMirrorTransaction> = {
406
- consensus_timestamp: "1625097600.000000000",
407
- transaction_hash: "hash1",
408
- charged_tx_fee: 500000,
409
- result: "SUCCESS",
410
- memo_base64: "",
411
- token_transfers: [],
412
- staking_reward_transfers: [{ account: address, amount: 1000000 }],
413
- transfers: [{ account: address, amount: -500000 }],
414
- name: "CRYPTOTRANSFER",
415
- };
416
-
417
- (apiClient.getAccountTransactions as jest.Mock).mockResolvedValue({
418
- transactions: [mockTransaction],
419
- nextCursor: null,
420
- });
421
-
422
- const result = await listOperations({
423
- currency: mockCurrency,
424
- address,
425
- pagination,
426
- mirrorTokens: [],
427
- fetchAllPages: true,
428
- skipFeesForTokenOperations: false,
429
- useEncodedHash: false,
430
- useSyntheticBlocks: false,
431
- });
432
-
433
- const rewardTimestamp = result.coinOperations[0].date.getTime();
434
- const mainTimestamp = result.coinOperations[1].date.getTime();
435
-
436
- expect(result.tokenOperations).toEqual([]);
437
- expect(rewardTimestamp).toBe(mainTimestamp + 1);
438
- expect(result.coinOperations).toMatchObject([
439
- {
440
- type: "REWARD",
441
- hash: `${mockTransaction.transaction_hash}-staking-reward`,
442
- value: new BigNumber(1000000),
443
- fee: new BigNumber(0),
444
- senders: [getEnv("HEDERA_STAKING_REWARD_ACCOUNT_ID")],
445
- recipients: [address],
446
- },
447
- {
448
- type: "OUT",
449
- hash: mockTransaction.transaction_hash,
450
- },
451
- ]);
393
+ expect(result.coinOperations).toHaveLength(1);
394
+ expect(result.coinOperations[0].hasFailed).toBe(true);
452
395
  });
453
396
  });
@@ -1,5 +1,4 @@
1
1
  import BigNumber from "bignumber.js";
2
- import { getEnv } from "@ledgerhq/live-env";
3
2
  import type { Operation, OperationType } from "@ledgerhq/types-live";
4
3
  import type { CryptoCurrency } from "@ledgerhq/types-cryptoassets";
5
4
  import type { Pagination } from "@ledgerhq/coin-framework/api/types";
@@ -14,7 +13,6 @@ import { base64ToUrlSafeBase64, getMemoFromBase64, getSyntheticBlock } from "./u
14
13
  const txNameToCustomOperationType: Record<string, OperationType> = {
15
14
  TOKENASSOCIATE: "ASSOCIATE_TOKEN",
16
15
  CONTRACTCALL: "CONTRACT_CALL",
17
- CRYPTOUPDATEACCOUNT: "UPDATE_ACCOUNT",
18
16
  };
19
17
 
20
18
  function getCommonOperationData(
@@ -135,27 +133,14 @@ function processTransfers({
135
133
  ledgerAccountId: string;
136
134
  commonData: ReturnType<typeof getCommonOperationData>;
137
135
  mirrorTokens: HederaMirrorToken[];
138
- }): Operation<HederaOperationExtra>[] {
139
- const coinOperations: Operation<HederaOperationExtra>[] = [];
136
+ }): Operation<HederaOperationExtra> | null {
140
137
  const transfers = rawTx.transfers ?? [];
141
-
142
- if (transfers.length === 0) {
143
- return [];
144
- }
138
+ if (transfers.length === 0) return null;
145
139
 
146
140
  const { type, value, senders, recipients } = parseTransfers(transfers, address);
147
141
  const { hash, fee, timestamp, blockHeight, blockHash, hasFailed } = commonData;
148
142
  const extra = { ...commonData.extra };
149
143
  const operationType = txNameToCustomOperationType[rawTx.name] ?? type;
150
- const stakingReward = rawTx.staking_reward_transfers.reduce((acc, transfer) => {
151
- const transferAmount = new BigNumber(transfer.amount);
152
-
153
- if (transfer.account === address) {
154
- acc = acc.plus(transferAmount);
155
- }
156
-
157
- return acc;
158
- }, new BigNumber(0));
159
144
 
160
145
  // try to enrich ASSOCIATE_TOKEN operation with extra.associatedTokenId
161
146
  // this value is used by custom OperationDetails components in Hedera family
@@ -170,30 +155,7 @@ function processTransfers({
170
155
  }
171
156
  }
172
157
 
173
- // add REWARD operation representing staking reward transfers
174
- if (stakingReward.gt(0)) {
175
- const stakingRewardHash = `${hash}-staking-reward`;
176
- const stakingRewardType: OperationType = "REWARD";
177
- // offset timestamp by +1ms to ensure it appears just before the operation that triggered it
178
- const stakingRewardTimestamp = new Date(timestamp.getTime() + 1);
179
-
180
- coinOperations.push({
181
- id: encodeOperationId(ledgerAccountId, stakingRewardHash, stakingRewardType),
182
- accountId: ledgerAccountId,
183
- type: stakingRewardType,
184
- value: stakingReward,
185
- recipients: [address],
186
- senders: [getEnv("HEDERA_STAKING_REWARD_ACCOUNT_ID")],
187
- hash: stakingRewardHash,
188
- fee: new BigNumber(0),
189
- date: stakingRewardTimestamp,
190
- blockHeight,
191
- blockHash,
192
- extra,
193
- });
194
- }
195
-
196
- coinOperations.push({
158
+ return {
197
159
  id: encodeOperationId(ledgerAccountId, hash, operationType),
198
160
  accountId: ledgerAccountId,
199
161
  type: operationType,
@@ -207,9 +169,7 @@ function processTransfers({
207
169
  blockHash,
208
170
  hasFailed,
209
171
  extra,
210
- });
211
-
212
- return coinOperations;
172
+ };
213
173
  }
214
174
 
215
175
  export async function listOperations({
@@ -271,7 +231,7 @@ export async function listOperations({
271
231
 
272
232
  // process regular transfers only if there were no token transfers
273
233
  if (!tokenResult) {
274
- const newCoinOperations = processTransfers({
234
+ const coinOperation = processTransfers({
275
235
  rawTx,
276
236
  address,
277
237
  ledgerAccountId,
@@ -279,7 +239,7 @@ export async function listOperations({
279
239
  mirrorTokens,
280
240
  });
281
241
 
282
- coinOperations.push(...newCoinOperations);
242
+ if (coinOperation) coinOperations.push(coinOperation);
283
243
  }
284
244
  }
285
245