@ledgerhq/coin-hedera 1.15.0-nightly.20251126023856 → 1.15.0-nightly.20251127023715

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 (280) hide show
  1. package/CHANGELOG.md +10 -8
  2. package/lib/api/index.d.ts.map +1 -1
  3. package/lib/api/index.js +6 -2
  4. package/lib/api/index.js.map +1 -1
  5. package/lib/bridge/broadcast.js +1 -1
  6. package/lib/bridge/broadcast.js.map +1 -1
  7. package/lib/bridge/buildOptimisticOperation.d.ts.map +1 -1
  8. package/lib/bridge/buildOptimisticOperation.js +80 -15
  9. package/lib/bridge/buildOptimisticOperation.js.map +1 -1
  10. package/lib/bridge/estimateMaxSpendable.js +5 -2
  11. package/lib/bridge/estimateMaxSpendable.js.map +1 -1
  12. package/lib/bridge/getTransactionStatus.d.ts.map +1 -1
  13. package/lib/bridge/getTransactionStatus.js +70 -13
  14. package/lib/bridge/getTransactionStatus.js.map +1 -1
  15. package/lib/bridge/index.js +1 -1
  16. package/lib/bridge/index.js.map +1 -1
  17. package/lib/bridge/prepareTransaction.d.ts.map +1 -1
  18. package/lib/bridge/prepareTransaction.js +40 -7
  19. package/lib/bridge/prepareTransaction.js.map +1 -1
  20. package/lib/bridge/signOperation.d.ts.map +1 -1
  21. package/lib/bridge/signOperation.js +19 -2
  22. package/lib/bridge/signOperation.js.map +1 -1
  23. package/lib/bridge/synchronisation.d.ts +2 -0
  24. package/lib/bridge/synchronisation.d.ts.map +1 -1
  25. package/lib/bridge/synchronisation.js +101 -30
  26. package/lib/bridge/synchronisation.js.map +1 -1
  27. package/lib/bridge/utils.d.ts +35 -2
  28. package/lib/bridge/utils.d.ts.map +1 -1
  29. package/lib/bridge/utils.js +215 -16
  30. package/lib/bridge/utils.js.map +1 -1
  31. package/lib/constants.d.ts +22 -2
  32. package/lib/constants.d.ts.map +1 -1
  33. package/lib/constants.js +42 -2
  34. package/lib/constants.js.map +1 -1
  35. package/lib/deviceTransactionConfig.d.ts +1 -1
  36. package/lib/deviceTransactionConfig.d.ts.map +1 -1
  37. package/lib/deviceTransactionConfig.js +8 -0
  38. package/lib/deviceTransactionConfig.js.map +1 -1
  39. package/lib/errors.d.ts +3 -0
  40. package/lib/errors.d.ts.map +1 -1
  41. package/lib/errors.js +2 -1
  42. package/lib/errors.js.map +1 -1
  43. package/lib/logic/craftTransaction.d.ts +4 -4
  44. package/lib/logic/craftTransaction.d.ts.map +1 -1
  45. package/lib/logic/craftTransaction.js +46 -5
  46. package/lib/logic/craftTransaction.js.map +1 -1
  47. package/lib/logic/estimateFees.d.ts +2 -4
  48. package/lib/logic/estimateFees.d.ts.map +1 -1
  49. package/lib/logic/estimateFees.js +45 -5
  50. package/lib/logic/estimateFees.js.map +1 -1
  51. package/lib/logic/listOperations.d.ts.map +1 -1
  52. package/lib/logic/listOperations.js +7 -3
  53. package/lib/logic/listOperations.js.map +1 -1
  54. package/lib/logic/utils.d.ts +24 -2
  55. package/lib/logic/utils.d.ts.map +1 -1
  56. package/lib/logic/utils.js +66 -13
  57. package/lib/logic/utils.js.map +1 -1
  58. package/lib/network/api.d.ts +12 -1
  59. package/lib/network/api.d.ts.map +1 -1
  60. package/lib/network/api.js +91 -19
  61. package/lib/network/api.js.map +1 -1
  62. package/lib/network/rpc.d.ts.map +1 -1
  63. package/lib/network/rpc.js +1 -0
  64. package/lib/network/rpc.js.map +1 -1
  65. package/lib/network/thirdweb.d.ts +21 -0
  66. package/lib/network/thirdweb.d.ts.map +1 -0
  67. package/lib/network/thirdweb.js +72 -0
  68. package/lib/network/thirdweb.js.map +1 -0
  69. package/lib/network/utils.d.ts +4 -1
  70. package/lib/network/utils.d.ts.map +1 -1
  71. package/lib/network/utils.js +53 -1
  72. package/lib/network/utils.js.map +1 -1
  73. package/lib/test/bridgeDatasetTest.d.ts.map +1 -1
  74. package/lib/test/bridgeDatasetTest.js +4 -4
  75. package/lib/test/bridgeDatasetTest.js.map +1 -1
  76. package/lib/test/fixtures/account.fixture.js +1 -1
  77. package/lib/test/fixtures/account.fixture.js.map +1 -1
  78. package/lib/test/fixtures/common.fixture.d.ts +12 -0
  79. package/lib/test/fixtures/common.fixture.d.ts.map +1 -0
  80. package/lib/test/fixtures/common.fixture.js +66 -0
  81. package/lib/test/fixtures/common.fixture.js.map +1 -0
  82. package/lib/test/fixtures/currency.fixture.d.ts +3 -1
  83. package/lib/test/fixtures/currency.fixture.d.ts.map +1 -1
  84. package/lib/test/fixtures/currency.fixture.js +63 -16
  85. package/lib/test/fixtures/currency.fixture.js.map +1 -1
  86. package/lib/test/fixtures/mirror.fixture.d.ts +3 -1
  87. package/lib/test/fixtures/mirror.fixture.d.ts.map +1 -1
  88. package/lib/test/fixtures/mirror.fixture.js +12 -1
  89. package/lib/test/fixtures/mirror.fixture.js.map +1 -1
  90. package/lib/test/fixtures/thirdweb.fixture.d.ts +3 -0
  91. package/lib/test/fixtures/thirdweb.fixture.d.ts.map +1 -0
  92. package/lib/test/fixtures/thirdweb.fixture.js +34 -0
  93. package/lib/test/fixtures/thirdweb.fixture.js.map +1 -0
  94. package/lib/transaction.d.ts.map +1 -1
  95. package/lib/transaction.js +2 -0
  96. package/lib/transaction.js.map +1 -1
  97. package/lib/types/alpaca.d.ts +5 -1
  98. package/lib/types/alpaca.d.ts.map +1 -1
  99. package/lib/types/bridge.d.ts +6 -1
  100. package/lib/types/bridge.d.ts.map +1 -1
  101. package/lib/types/index.d.ts +2 -0
  102. package/lib/types/index.d.ts.map +1 -1
  103. package/lib/types/index.js +2 -0
  104. package/lib/types/index.js.map +1 -1
  105. package/lib/types/logic.d.ts +39 -0
  106. package/lib/types/logic.d.ts.map +1 -0
  107. package/lib/types/logic.js +3 -0
  108. package/lib/types/logic.js.map +1 -0
  109. package/lib/types/mirror.d.ts +29 -0
  110. package/lib/types/mirror.d.ts.map +1 -1
  111. package/lib/types/thirdweb.d.ts +34 -0
  112. package/lib/types/thirdweb.d.ts.map +1 -0
  113. package/lib/types/thirdweb.js +3 -0
  114. package/lib/types/thirdweb.js.map +1 -0
  115. package/lib-es/api/index.d.ts.map +1 -1
  116. package/lib-es/api/index.js +7 -3
  117. package/lib-es/api/index.js.map +1 -1
  118. package/lib-es/bridge/broadcast.js +2 -2
  119. package/lib-es/bridge/broadcast.js.map +1 -1
  120. package/lib-es/bridge/buildOptimisticOperation.d.ts.map +1 -1
  121. package/lib-es/bridge/buildOptimisticOperation.js +83 -18
  122. package/lib-es/bridge/buildOptimisticOperation.js.map +1 -1
  123. package/lib-es/bridge/estimateMaxSpendable.js +5 -2
  124. package/lib-es/bridge/estimateMaxSpendable.js.map +1 -1
  125. package/lib-es/bridge/getTransactionStatus.d.ts.map +1 -1
  126. package/lib-es/bridge/getTransactionStatus.js +73 -16
  127. package/lib-es/bridge/getTransactionStatus.js.map +1 -1
  128. package/lib-es/bridge/index.js +2 -2
  129. package/lib-es/bridge/index.js.map +1 -1
  130. package/lib-es/bridge/prepareTransaction.d.ts.map +1 -1
  131. package/lib-es/bridge/prepareTransaction.js +42 -9
  132. package/lib-es/bridge/prepareTransaction.js.map +1 -1
  133. package/lib-es/bridge/signOperation.d.ts.map +1 -1
  134. package/lib-es/bridge/signOperation.js +21 -4
  135. package/lib-es/bridge/signOperation.js.map +1 -1
  136. package/lib-es/bridge/synchronisation.d.ts +2 -0
  137. package/lib-es/bridge/synchronisation.d.ts.map +1 -1
  138. package/lib-es/bridge/synchronisation.js +97 -27
  139. package/lib-es/bridge/synchronisation.js.map +1 -1
  140. package/lib-es/bridge/utils.d.ts +35 -2
  141. package/lib-es/bridge/utils.d.ts.map +1 -1
  142. package/lib-es/bridge/utils.js +211 -16
  143. package/lib-es/bridge/utils.js.map +1 -1
  144. package/lib-es/constants.d.ts +22 -2
  145. package/lib-es/constants.d.ts.map +1 -1
  146. package/lib-es/constants.js +38 -1
  147. package/lib-es/constants.js.map +1 -1
  148. package/lib-es/deviceTransactionConfig.d.ts +1 -1
  149. package/lib-es/deviceTransactionConfig.d.ts.map +1 -1
  150. package/lib-es/deviceTransactionConfig.js +8 -0
  151. package/lib-es/deviceTransactionConfig.js.map +1 -1
  152. package/lib-es/errors.d.ts +3 -0
  153. package/lib-es/errors.d.ts.map +1 -1
  154. package/lib-es/errors.js +1 -0
  155. package/lib-es/errors.js.map +1 -1
  156. package/lib-es/logic/craftTransaction.d.ts +4 -4
  157. package/lib-es/logic/craftTransaction.d.ts.map +1 -1
  158. package/lib-es/logic/craftTransaction.js +48 -7
  159. package/lib-es/logic/craftTransaction.js.map +1 -1
  160. package/lib-es/logic/estimateFees.d.ts +2 -4
  161. package/lib-es/logic/estimateFees.d.ts.map +1 -1
  162. package/lib-es/logic/estimateFees.js +47 -7
  163. package/lib-es/logic/estimateFees.js.map +1 -1
  164. package/lib-es/logic/listOperations.d.ts.map +1 -1
  165. package/lib-es/logic/listOperations.js +7 -3
  166. package/lib-es/logic/listOperations.js.map +1 -1
  167. package/lib-es/logic/utils.d.ts +24 -2
  168. package/lib-es/logic/utils.d.ts.map +1 -1
  169. package/lib-es/logic/utils.js +63 -13
  170. package/lib-es/logic/utils.js.map +1 -1
  171. package/lib-es/network/api.d.ts +12 -1
  172. package/lib-es/network/api.d.ts.map +1 -1
  173. package/lib-es/network/api.js +91 -19
  174. package/lib-es/network/api.js.map +1 -1
  175. package/lib-es/network/rpc.d.ts.map +1 -1
  176. package/lib-es/network/rpc.js +1 -0
  177. package/lib-es/network/rpc.js.map +1 -1
  178. package/lib-es/network/thirdweb.d.ts +21 -0
  179. package/lib-es/network/thirdweb.d.ts.map +1 -0
  180. package/lib-es/network/thirdweb.js +66 -0
  181. package/lib-es/network/thirdweb.js.map +1 -0
  182. package/lib-es/network/utils.d.ts +4 -1
  183. package/lib-es/network/utils.d.ts.map +1 -1
  184. package/lib-es/network/utils.js +49 -0
  185. package/lib-es/network/utils.js.map +1 -1
  186. package/lib-es/test/bridgeDatasetTest.d.ts.map +1 -1
  187. package/lib-es/test/bridgeDatasetTest.js +4 -4
  188. package/lib-es/test/bridgeDatasetTest.js.map +1 -1
  189. package/lib-es/test/fixtures/account.fixture.js +2 -2
  190. package/lib-es/test/fixtures/account.fixture.js.map +1 -1
  191. package/lib-es/test/fixtures/common.fixture.d.ts +12 -0
  192. package/lib-es/test/fixtures/common.fixture.d.ts.map +1 -0
  193. package/lib-es/test/fixtures/common.fixture.js +57 -0
  194. package/lib-es/test/fixtures/common.fixture.js.map +1 -0
  195. package/lib-es/test/fixtures/currency.fixture.d.ts +3 -1
  196. package/lib-es/test/fixtures/currency.fixture.d.ts.map +1 -1
  197. package/lib-es/test/fixtures/currency.fixture.js +59 -14
  198. package/lib-es/test/fixtures/currency.fixture.js.map +1 -1
  199. package/lib-es/test/fixtures/mirror.fixture.d.ts +3 -1
  200. package/lib-es/test/fixtures/mirror.fixture.d.ts.map +1 -1
  201. package/lib-es/test/fixtures/mirror.fixture.js +9 -0
  202. package/lib-es/test/fixtures/mirror.fixture.js.map +1 -1
  203. package/lib-es/test/fixtures/thirdweb.fixture.d.ts +3 -0
  204. package/lib-es/test/fixtures/thirdweb.fixture.d.ts.map +1 -0
  205. package/lib-es/test/fixtures/thirdweb.fixture.js +30 -0
  206. package/lib-es/test/fixtures/thirdweb.fixture.js.map +1 -0
  207. package/lib-es/transaction.d.ts.map +1 -1
  208. package/lib-es/transaction.js +2 -0
  209. package/lib-es/transaction.js.map +1 -1
  210. package/lib-es/types/alpaca.d.ts +5 -1
  211. package/lib-es/types/alpaca.d.ts.map +1 -1
  212. package/lib-es/types/bridge.d.ts +6 -1
  213. package/lib-es/types/bridge.d.ts.map +1 -1
  214. package/lib-es/types/index.d.ts +2 -0
  215. package/lib-es/types/index.d.ts.map +1 -1
  216. package/lib-es/types/index.js +2 -0
  217. package/lib-es/types/index.js.map +1 -1
  218. package/lib-es/types/logic.d.ts +39 -0
  219. package/lib-es/types/logic.d.ts.map +1 -0
  220. package/lib-es/types/logic.js +2 -0
  221. package/lib-es/types/logic.js.map +1 -0
  222. package/lib-es/types/mirror.d.ts +29 -0
  223. package/lib-es/types/mirror.d.ts.map +1 -1
  224. package/lib-es/types/thirdweb.d.ts +34 -0
  225. package/lib-es/types/thirdweb.d.ts.map +1 -0
  226. package/lib-es/types/thirdweb.js +2 -0
  227. package/lib-es/types/thirdweb.js.map +1 -0
  228. package/package.json +9 -8
  229. package/src/api/index.integ.test.ts +11 -8
  230. package/src/api/index.ts +10 -3
  231. package/src/bridge/broadcast.ts +2 -2
  232. package/src/bridge/buildOptimisticOperation.integration.test.ts +70 -19
  233. package/src/bridge/buildOptimisticOperation.ts +98 -20
  234. package/src/bridge/estimateMaxSpendable.ts +5 -5
  235. package/src/bridge/getTransactionStatus.test.ts +57 -12
  236. package/src/bridge/getTransactionStatus.ts +88 -15
  237. package/src/bridge/index.ts +2 -2
  238. package/src/bridge/js-estimateMaxSpendable.integration.test.ts +12 -9
  239. package/src/bridge/prepareTransaction.test.ts +3 -1
  240. package/src/bridge/prepareTransaction.ts +45 -10
  241. package/src/bridge/signOperation.ts +23 -5
  242. package/src/bridge/synchronisation.test.ts +67 -0
  243. package/src/bridge/synchronisation.ts +114 -34
  244. package/src/bridge/utils.integration.test.ts +486 -180
  245. package/src/bridge/utils.test.ts +404 -0
  246. package/src/bridge/utils.ts +330 -27
  247. package/src/constants.ts +47 -2
  248. package/src/deviceTransactionConfig.ts +10 -1
  249. package/src/errors.ts +3 -0
  250. package/src/logic/craftTransaction.test.ts +49 -9
  251. package/src/logic/craftTransaction.ts +76 -11
  252. package/src/logic/estimateFees.test.ts +180 -31
  253. package/src/logic/estimateFees.ts +68 -7
  254. package/src/logic/getAssetFromToken.test.ts +2 -2
  255. package/src/logic/getBalance.test.ts +18 -57
  256. package/src/logic/getTokenFromAsset.test.ts +2 -2
  257. package/src/logic/listOperations.ts +9 -5
  258. package/src/logic/utils.test.ts +157 -69
  259. package/src/logic/utils.ts +75 -13
  260. package/src/network/api.test.ts +211 -3
  261. package/src/network/api.ts +118 -24
  262. package/src/network/rpc.test.ts +1 -0
  263. package/src/network/rpc.ts +1 -0
  264. package/src/network/thirdweb.test.ts +188 -0
  265. package/src/network/thirdweb.ts +101 -0
  266. package/src/network/utils.test.ts +364 -164
  267. package/src/network/utils.ts +83 -1
  268. package/src/test/bridgeDatasetTest.ts +4 -5
  269. package/src/test/fixtures/account.fixture.ts +2 -2
  270. package/src/test/fixtures/common.fixture.ts +74 -0
  271. package/src/test/fixtures/currency.fixture.ts +66 -14
  272. package/src/test/fixtures/mirror.fixture.ts +23 -1
  273. package/src/test/fixtures/thirdweb.fixture.ts +33 -0
  274. package/src/transaction.ts +2 -0
  275. package/src/types/alpaca.ts +8 -1
  276. package/src/types/bridge.ts +6 -1
  277. package/src/types/index.ts +2 -0
  278. package/src/types/logic.ts +44 -0
  279. package/src/types/mirror.ts +35 -0
  280. package/src/types/thirdweb.ts +36 -0
@@ -2,14 +2,17 @@ import BigNumber from "bignumber.js";
2
2
  import invariant from "invariant";
3
3
  import {
4
4
  AccountId,
5
+ ContractExecuteTransaction,
6
+ ContractFunctionParameters,
7
+ ContractId,
5
8
  Hbar,
6
9
  TokenAssociateTransaction,
7
10
  TransactionId,
8
11
  TransferTransaction,
9
12
  } from "@hashgraph/sdk";
10
13
  import type { FeeEstimation, TransactionIntent } from "@ledgerhq/coin-framework/api/index";
11
- import { HEDERA_TRANSACTION_MODES } from "../constants";
12
- import type { HederaMemo } from "../types";
14
+ import { DEFAULT_GAS_LIMIT, HEDERA_TRANSACTION_MODES } from "../constants";
15
+ import type { HederaMemo, HederaTxData } from "../types";
13
16
  import { serializeTransaction } from "./utils";
14
17
 
15
18
  // avoid "sign" prompt loop by having only one node (one transaction)
@@ -32,13 +35,21 @@ interface BuilderCoinTransferTransaction extends BuilderCommonTransactionFields
32
35
  recipient: string;
33
36
  }
34
37
 
35
- interface BuilderTokenTransferTransaction extends BuilderCommonTransactionFields {
38
+ interface BuilderHTSTokenTransferTransaction extends BuilderCommonTransactionFields {
36
39
  type: HEDERA_TRANSACTION_MODES.Send;
37
- tokenId: string;
40
+ tokenAddress: string;
38
41
  amount: BigNumber;
39
42
  recipient: string;
40
43
  }
41
44
 
45
+ interface BuilderERC20TokenTransferTransaction extends BuilderCommonTransactionFields {
46
+ type: HEDERA_TRANSACTION_MODES.Send;
47
+ tokenAddress: string;
48
+ amount: BigNumber;
49
+ recipient: string;
50
+ gasLimit: BigNumber;
51
+ }
52
+
42
53
  interface BuilderTokenAssociateTransaction extends BuilderCommonTransactionFields {
43
54
  type: HEDERA_TRANSACTION_MODES.TokenAssociate;
44
55
  tokenId: string;
@@ -68,15 +79,15 @@ async function buildUnsignedCoinTransaction({
68
79
  return tx.freeze();
69
80
  }
70
81
 
71
- async function buildUnsignedTokenTransaction({
82
+ async function buildUnsignedHTSTokenTransaction({
72
83
  account,
73
84
  transaction,
74
85
  }: {
75
86
  account: BuilderOperator;
76
- transaction: BuilderTokenTransferTransaction;
87
+ transaction: BuilderHTSTokenTransferTransaction;
77
88
  }): Promise<TransferTransaction> {
78
89
  const accountId = account.accountId;
79
- const tokenId = transaction.tokenId;
90
+ const tokenId = transaction.tokenAddress;
80
91
 
81
92
  const tx = new TransferTransaction()
82
93
  .setNodeAccountIds(nodeAccountIds)
@@ -92,6 +103,39 @@ async function buildUnsignedTokenTransaction({
92
103
  return tx.freeze();
93
104
  }
94
105
 
106
+ async function buildUnsignedERC20TokenTransaction({
107
+ account,
108
+ transaction,
109
+ }: {
110
+ account: BuilderOperator;
111
+ transaction: BuilderERC20TokenTransferTransaction;
112
+ }): Promise<ContractExecuteTransaction> {
113
+ const accountId = AccountId.fromString(account.accountId);
114
+ const contractId = ContractId.fromEvmAddress(0, 0, transaction.tokenAddress);
115
+ const recipientEvmAddress = AccountId.fromString(transaction.recipient).toSolidityAddress();
116
+ const gas = transaction.gasLimit.toNumber();
117
+
118
+ // create function parameters for ERC20 transfer function
119
+ // transfer(address to, uint256 amount) returns (bool)
120
+ const functionParameters = new ContractFunctionParameters()
121
+ .addAddress(recipientEvmAddress)
122
+ .addUint256(transaction.amount.toNumber());
123
+
124
+ const tx = new ContractExecuteTransaction()
125
+ .setNodeAccountIds(nodeAccountIds)
126
+ .setTransactionId(TransactionId.generate(accountId))
127
+ .setTransactionMemo(transaction.memo ?? "")
128
+ .setContractId(contractId)
129
+ .setGas(gas)
130
+ .setFunction("transfer", functionParameters);
131
+
132
+ if (transaction.maxFee) {
133
+ tx.setMaxTransactionFee(Hbar.fromTinybars(transaction.maxFee.toNumber()));
134
+ }
135
+
136
+ return tx.freeze();
137
+ }
138
+
95
139
  async function buildTokenAssociateTransaction({
96
140
  account,
97
141
  transaction,
@@ -116,7 +160,7 @@ async function buildTokenAssociateTransaction({
116
160
  }
117
161
 
118
162
  export async function craftTransaction(
119
- txIntent: TransactionIntent<HederaMemo>,
163
+ txIntent: TransactionIntent<HederaMemo, HederaTxData>,
120
164
  customFees?: FeeEstimation,
121
165
  ) {
122
166
  const account = {
@@ -138,20 +182,41 @@ export async function craftTransaction(
138
182
  maxFee: customFees ? new BigNumber(customFees.value.toString()) : undefined,
139
183
  },
140
184
  });
141
- } else if (txIntent.type === HEDERA_TRANSACTION_MODES.Send && txIntent.asset.type !== "native") {
185
+ } else if (txIntent.type === HEDERA_TRANSACTION_MODES.Send && txIntent.asset.type === "hts") {
142
186
  invariant("assetReference" in txIntent.asset, "hedera: no assetReference in token transfer");
143
187
 
144
188
  const amount = new BigNumber(txIntent.amount.toString());
145
189
 
146
- tx = await buildUnsignedTokenTransaction({
190
+ tx = await buildUnsignedHTSTokenTransaction({
147
191
  account,
148
192
  transaction: {
149
193
  type: txIntent.type,
150
- tokenId: txIntent.asset.assetReference,
194
+ tokenAddress: txIntent.asset.assetReference,
195
+ amount,
196
+ recipient: txIntent.recipient,
197
+ memo: txIntent.memo.value,
198
+ maxFee: customFees ? new BigNumber(customFees.value.toString()) : undefined,
199
+ },
200
+ });
201
+ } else if (txIntent.type === HEDERA_TRANSACTION_MODES.Send && txIntent.asset.type === "erc20") {
202
+ invariant("assetReference" in txIntent.asset, "hedera: no assetReference in token transfer");
203
+
204
+ const amount = new BigNumber(txIntent.amount.toString());
205
+ const gasLimit =
206
+ "data" in txIntent && txIntent.data.gasLimit
207
+ ? new BigNumber(txIntent.data.gasLimit.toString())
208
+ : DEFAULT_GAS_LIMIT;
209
+
210
+ tx = await buildUnsignedERC20TokenTransaction({
211
+ account,
212
+ transaction: {
213
+ type: txIntent.type,
214
+ tokenAddress: txIntent.asset.assetReference,
151
215
  amount,
152
216
  recipient: txIntent.recipient,
153
217
  memo: txIntent.memo.value,
154
218
  maxFee: customFees ? new BigNumber(customFees.value.toString()) : undefined,
219
+ gasLimit,
155
220
  },
156
221
  });
157
222
  } else {
@@ -1,19 +1,29 @@
1
1
  import BigNumber from "bignumber.js";
2
2
  import cvsApi from "@ledgerhq/live-countervalues/api/index";
3
3
  import {
4
+ DEFAULT_GAS_LIMIT,
5
+ DEFAULT_GAS_PRICE_TINYBARS,
4
6
  DEFAULT_TINYBAR_FEE,
5
7
  ESTIMATED_FEE_SAFETY_RATE,
8
+ ESTIMATED_GAS_SAFETY_RATE,
6
9
  HEDERA_OPERATION_TYPES,
10
+ HEDERA_TRANSACTION_MODES,
7
11
  TINYBAR_SCALE,
8
12
  } from "../constants";
9
13
  import { estimateFees } from "./estimateFees";
10
14
  import { getMockedAccount } from "../test/fixtures/account.fixture";
11
- import { getCurrencyToUSDRate } from "./utils";
15
+ import { getCurrencyToUSDRate, toEVMAddress } from "./utils";
16
+ import { apiClient } from "../network/api";
17
+ import { getMockedERC20TokenCurrency } from "../test/fixtures/currency.fixture";
12
18
 
13
19
  jest.mock("@ledgerhq/live-countervalues/api/index");
20
+ jest.mock("../network/api");
14
21
 
15
22
  describe("getEstimatedFees", () => {
16
23
  const mockedAccount = getMockedAccount();
24
+ const mockedTokenCurrencyERC20 = getMockedERC20TokenCurrency();
25
+ const senderAddress = "0.0.12345";
26
+ const recipientAddress = "0.0.67890";
17
27
 
18
28
  beforeEach(() => {
19
29
  jest.clearAllMocks();
@@ -21,79 +31,218 @@ describe("getEstimatedFees", () => {
21
31
  getCurrencyToUSDRate.clear(mockedAccount.currency.ticker);
22
32
  });
23
33
 
24
- test("returns estimated fee based on USD rate for CryptoTransfer", async () => {
34
+ it("returns estimated fee based on USD rate for CryptoTransfer", async () => {
25
35
  const usdRate = 1; // 1 HBAR = 1 USD
26
36
  (cvsApi.fetchLatest as jest.Mock).mockResolvedValueOnce([usdRate]);
27
37
 
28
- const result = await estimateFees(
29
- mockedAccount.currency,
30
- HEDERA_OPERATION_TYPES.CryptoTransfer,
31
- );
38
+ const result = await estimateFees({
39
+ currency: mockedAccount.currency,
40
+ operationType: HEDERA_OPERATION_TYPES.CryptoTransfer,
41
+ });
32
42
 
33
43
  const baseFeeTinybar = 0.0001 * 10 ** TINYBAR_SCALE;
34
- const expectedFee = new BigNumber(baseFeeTinybar)
44
+ const expectedTinybars = new BigNumber(baseFeeTinybar)
35
45
  .div(usdRate)
36
46
  .integerValue(BigNumber.ROUND_CEIL)
37
47
  .multipliedBy(ESTIMATED_FEE_SAFETY_RATE);
38
48
 
39
- expect(result).toEqual(expectedFee);
49
+ expect(result).toMatchObject({
50
+ tinybars: expectedTinybars,
51
+ });
40
52
  });
41
53
 
42
- test("returns estimated fee based on USD rate for TokenTransfer", async () => {
54
+ it("returns estimated fee based on USD rate for TokenTransfer", async () => {
43
55
  const usdRate = 0.5; // 1 HBAR = 0.5 USD
44
56
  (cvsApi.fetchLatest as jest.Mock).mockResolvedValueOnce([usdRate]);
45
57
 
46
- const result = await estimateFees(mockedAccount.currency, HEDERA_OPERATION_TYPES.TokenTransfer);
58
+ const result = await estimateFees({
59
+ currency: mockedAccount.currency,
60
+ operationType: HEDERA_OPERATION_TYPES.TokenTransfer,
61
+ });
47
62
 
48
63
  const baseFeeTinybar = 0.001 * 10 ** TINYBAR_SCALE;
49
- const expectedFee = new BigNumber(baseFeeTinybar)
64
+ const expectedTinybars = new BigNumber(baseFeeTinybar)
50
65
  .div(usdRate)
51
66
  .integerValue(BigNumber.ROUND_CEIL)
52
67
  .multipliedBy(ESTIMATED_FEE_SAFETY_RATE);
53
68
 
54
- expect(result).toEqual(expectedFee);
69
+ expect(result).toMatchObject({
70
+ tinybars: expectedTinybars,
71
+ });
55
72
  });
56
73
 
57
- test("returns estimated fee based on USD rate for TokenAssociate", async () => {
74
+ it("returns estimated fee based on USD rate for TokenAssociate", async () => {
58
75
  const usdRate = 2; // 1 HBAR = 2 USD
59
76
  (cvsApi.fetchLatest as jest.Mock).mockResolvedValueOnce([usdRate]);
60
77
 
61
- const result = await estimateFees(
62
- mockedAccount.currency,
63
- HEDERA_OPERATION_TYPES.TokenAssociate,
64
- );
78
+ const result = await estimateFees({
79
+ currency: mockedAccount.currency,
80
+ operationType: HEDERA_OPERATION_TYPES.TokenAssociate,
81
+ });
65
82
 
66
83
  const baseFeeTinybar = 0.05 * 10 ** TINYBAR_SCALE;
67
- const expectedFee = new BigNumber(baseFeeTinybar)
84
+ const expectedTinybars = new BigNumber(baseFeeTinybar)
68
85
  .div(usdRate)
69
86
  .integerValue(BigNumber.ROUND_CEIL)
70
87
  .multipliedBy(ESTIMATED_FEE_SAFETY_RATE);
71
88
 
72
- expect(result).toEqual(expectedFee);
89
+ expect(result).toMatchObject({
90
+ tinybars: expectedTinybars,
91
+ });
92
+ });
93
+
94
+ it("returns estimated fee based on gas for ContractCall", async () => {
95
+ const estimatedGasLimit = new BigNumber(50000);
96
+ const gasPriceTinybars = new BigNumber(900);
97
+ const transferAmount = BigInt(1000000);
98
+
99
+ (apiClient.getNetworkFees as jest.Mock).mockResolvedValueOnce({
100
+ fees: [
101
+ {
102
+ transaction_type: "ContractCall",
103
+ gas: gasPriceTinybars.toNumber(),
104
+ },
105
+ ],
106
+ });
107
+
108
+ (apiClient.estimateContractCallGas as jest.Mock).mockResolvedValueOnce(estimatedGasLimit);
109
+
110
+ const result = await estimateFees({
111
+ operationType: HEDERA_OPERATION_TYPES.ContractCall,
112
+ txIntent: {
113
+ intentType: "transaction",
114
+ type: HEDERA_TRANSACTION_MODES.Send,
115
+ sender: senderAddress,
116
+ recipient: recipientAddress,
117
+ amount: transferAmount,
118
+ asset: {
119
+ type: "erc20",
120
+ assetReference: mockedTokenCurrencyERC20.contractAddress,
121
+ },
122
+ },
123
+ });
124
+
125
+ const expectedGas = estimatedGasLimit
126
+ .multipliedBy(ESTIMATED_GAS_SAFETY_RATE)
127
+ .integerValue(BigNumber.ROUND_CEIL);
128
+
129
+ const expectedTinybars = expectedGas
130
+ .multipliedBy(gasPriceTinybars)
131
+ .integerValue(BigNumber.ROUND_CEIL);
132
+
133
+ expect(apiClient.getNetworkFees).toHaveBeenCalledTimes(1);
134
+ expect(apiClient.estimateContractCallGas).toHaveBeenCalledTimes(1);
135
+ expect(apiClient.estimateContractCallGas).toHaveBeenCalledWith(
136
+ toEVMAddress(senderAddress),
137
+ toEVMAddress(recipientAddress),
138
+ mockedTokenCurrencyERC20.contractAddress,
139
+ transferAmount,
140
+ );
141
+ expect(result).toMatchObject({
142
+ tinybars: expectedTinybars,
143
+ gas: expectedGas,
144
+ });
145
+ });
146
+
147
+ it("falls back to default gas values when getNetworkFees fail", async () => {
148
+ const transferAmount = BigInt(1000000);
149
+
150
+ (apiClient.getNetworkFees as jest.Mock).mockRejectedValueOnce(new Error("Network error"));
151
+
152
+ const result = await estimateFees({
153
+ operationType: HEDERA_OPERATION_TYPES.ContractCall,
154
+ txIntent: {
155
+ intentType: "transaction",
156
+ type: HEDERA_TRANSACTION_MODES.Send,
157
+ sender: senderAddress,
158
+ recipient: recipientAddress,
159
+ amount: transferAmount,
160
+ asset: {
161
+ type: "erc20",
162
+ assetReference: mockedTokenCurrencyERC20.contractAddress,
163
+ },
164
+ },
165
+ });
166
+
167
+ const expectedGas = DEFAULT_GAS_LIMIT;
168
+ const expectedTinybars = new BigNumber(expectedGas)
169
+ .multipliedBy(DEFAULT_GAS_PRICE_TINYBARS)
170
+ .integerValue(BigNumber.ROUND_CEIL);
171
+
172
+ expect(result).toMatchObject({
173
+ tinybars: expectedTinybars,
174
+ gas: expectedGas,
175
+ });
73
176
  });
74
177
 
75
- test("falls back to default estimate when cvs api returns null", async () => {
178
+ it("falls back to default gas values when estimateContractCallGas fail", async () => {
179
+ const transferAmount = BigInt(1000000);
180
+
181
+ (apiClient.getNetworkFees as jest.Mock).mockResolvedValueOnce({
182
+ fees: [],
183
+ });
184
+ (apiClient.estimateContractCallGas as jest.Mock).mockRejectedValueOnce(
185
+ new Error("Network error"),
186
+ );
187
+
188
+ const result = await estimateFees({
189
+ operationType: HEDERA_OPERATION_TYPES.ContractCall,
190
+ txIntent: {
191
+ intentType: "transaction",
192
+ type: HEDERA_TRANSACTION_MODES.Send,
193
+ sender: senderAddress,
194
+ recipient: recipientAddress,
195
+ amount: transferAmount,
196
+ asset: {
197
+ type: "erc20",
198
+ assetReference: mockedTokenCurrencyERC20.contractAddress,
199
+ },
200
+ },
201
+ });
202
+
203
+ const expectedGas = DEFAULT_GAS_LIMIT;
204
+ const expectedTinybars = new BigNumber(expectedGas)
205
+ .multipliedBy(DEFAULT_GAS_PRICE_TINYBARS)
206
+ .integerValue(BigNumber.ROUND_CEIL);
207
+
208
+ expect(result).toMatchObject({
209
+ tinybars: expectedTinybars,
210
+ gas: expectedGas,
211
+ });
212
+ });
213
+
214
+ it("falls back to default estimate when cvs api returns null", async () => {
76
215
  const usdRate = null;
77
216
  (cvsApi.fetchLatest as jest.Mock).mockResolvedValueOnce([usdRate]);
78
217
 
79
- const result = await estimateFees(
80
- mockedAccount.currency,
81
- HEDERA_OPERATION_TYPES.CryptoTransfer,
218
+ const result = await estimateFees({
219
+ currency: mockedAccount.currency,
220
+ operationType: HEDERA_OPERATION_TYPES.CryptoTransfer,
221
+ });
222
+
223
+ const expectedTinybars = new BigNumber(DEFAULT_TINYBAR_FEE).multipliedBy(
224
+ ESTIMATED_FEE_SAFETY_RATE,
82
225
  );
83
226
 
84
- const expected = new BigNumber(DEFAULT_TINYBAR_FEE).multipliedBy(ESTIMATED_FEE_SAFETY_RATE);
85
- expect(result).toEqual(expected);
227
+ expect(result).toMatchObject({
228
+ tinybars: expectedTinybars,
229
+ });
86
230
  });
87
231
 
88
- test("falls back to default estimate on cvs api failure", async () => {
232
+ it("falls back to default estimate on cvs api failure", async () => {
89
233
  (cvsApi.fetchLatest as jest.Mock).mockRejectedValueOnce(new Error("Network error"));
90
234
 
91
- const result = await estimateFees(
92
- mockedAccount.currency,
93
- HEDERA_OPERATION_TYPES.CryptoTransfer,
235
+ const result = await estimateFees({
236
+ currency: mockedAccount.currency,
237
+ operationType: HEDERA_OPERATION_TYPES.CryptoTransfer,
238
+ });
239
+
240
+ const expectedTinybars = new BigNumber(DEFAULT_TINYBAR_FEE).multipliedBy(
241
+ ESTIMATED_FEE_SAFETY_RATE,
94
242
  );
95
243
 
96
- const expected = new BigNumber(DEFAULT_TINYBAR_FEE).multipliedBy(ESTIMATED_FEE_SAFETY_RATE);
97
- expect(result).toEqual(expected);
244
+ expect(result).toMatchObject({
245
+ tinybars: expectedTinybars,
246
+ });
98
247
  });
99
248
  });
@@ -1,28 +1,89 @@
1
1
  import BigNumber from "bignumber.js";
2
+ import type { TransactionIntent } from "@ledgerhq/coin-framework/api/types";
2
3
  import type { CryptoCurrency } from "@ledgerhq/types-cryptoassets";
3
4
  import {
4
5
  BASE_USD_FEE_BY_OPERATION_TYPE,
6
+ DEFAULT_GAS_LIMIT,
7
+ DEFAULT_GAS_PRICE_TINYBARS,
5
8
  DEFAULT_TINYBAR_FEE,
6
9
  ESTIMATED_FEE_SAFETY_RATE,
10
+ ESTIMATED_GAS_SAFETY_RATE,
7
11
  HEDERA_OPERATION_TYPES,
8
12
  } from "../constants";
9
- import { getCurrencyToUSDRate } from "./utils";
13
+ import { apiClient } from "../network/api";
14
+ import type { EstimateFeesParams, EstimateFeesResult } from "../types";
15
+ import { getCurrencyToUSDRate, toEVMAddress } from "./utils";
10
16
 
11
- export const estimateFees = async (
17
+ const estimateContractCallFees = async (
18
+ txIntent: TransactionIntent,
19
+ ): Promise<EstimateFeesResult> => {
20
+ let tinybars = new BigNumber(0);
21
+ let gas = new BigNumber(0);
22
+
23
+ const tokenEvmAddress = "assetReference" in txIntent.asset ? txIntent.asset.assetReference : null;
24
+ const senderEvmAddress = toEVMAddress(txIntent.sender);
25
+ const recipientEvmAddress = toEVMAddress(txIntent.recipient);
26
+
27
+ if (!tokenEvmAddress || !senderEvmAddress || !recipientEvmAddress) {
28
+ return {
29
+ tinybars,
30
+ };
31
+ }
32
+
33
+ try {
34
+ const [networkFees, gasLimit] = await Promise.all([
35
+ apiClient.getNetworkFees(),
36
+ apiClient.estimateContractCallGas(
37
+ senderEvmAddress,
38
+ recipientEvmAddress,
39
+ tokenEvmAddress,
40
+ txIntent.amount,
41
+ ),
42
+ ]);
43
+
44
+ const contractCallFees = networkFees.fees.find(
45
+ fee => fee.transaction_type === HEDERA_OPERATION_TYPES.ContractCall,
46
+ );
47
+ const gasTinybarRate = new BigNumber(contractCallFees?.gas ?? DEFAULT_GAS_PRICE_TINYBARS);
48
+ gas = gasLimit.multipliedBy(ESTIMATED_GAS_SAFETY_RATE).integerValue(BigNumber.ROUND_CEIL);
49
+ tinybars = gas.multipliedBy(gasTinybarRate).integerValue(BigNumber.ROUND_CEIL);
50
+ } catch {
51
+ const gasTinybarRate = DEFAULT_GAS_PRICE_TINYBARS;
52
+ gas = DEFAULT_GAS_LIMIT;
53
+ tinybars = gas.multipliedBy(gasTinybarRate).integerValue(BigNumber.ROUND_CEIL);
54
+ }
55
+
56
+ return {
57
+ tinybars,
58
+ gas,
59
+ };
60
+ };
61
+
62
+ const estimateStandardFees = async (
12
63
  currency: CryptoCurrency,
13
64
  operationType: HEDERA_OPERATION_TYPES,
14
- ): Promise<BigNumber> => {
15
- let fee: BigNumber | undefined;
65
+ ): Promise<EstimateFeesResult> => {
66
+ let tinybars: BigNumber;
16
67
  const usdRate = await getCurrencyToUSDRate(currency).catch(() => null);
17
68
 
18
69
  if (usdRate) {
19
- fee = new BigNumber(BASE_USD_FEE_BY_OPERATION_TYPE[operationType])
70
+ tinybars = new BigNumber(BASE_USD_FEE_BY_OPERATION_TYPE[operationType])
20
71
  .dividedBy(new BigNumber(usdRate))
21
72
  .integerValue(BigNumber.ROUND_CEIL)
22
73
  .multipliedBy(ESTIMATED_FEE_SAFETY_RATE);
23
74
  } else {
24
- fee = new BigNumber(DEFAULT_TINYBAR_FEE).multipliedBy(ESTIMATED_FEE_SAFETY_RATE);
75
+ tinybars = new BigNumber(DEFAULT_TINYBAR_FEE).multipliedBy(ESTIMATED_FEE_SAFETY_RATE);
76
+ }
77
+
78
+ return {
79
+ tinybars,
80
+ };
81
+ };
82
+
83
+ export const estimateFees = async (params: EstimateFeesParams): Promise<EstimateFeesResult> => {
84
+ if (params.operationType === HEDERA_OPERATION_TYPES.ContractCall) {
85
+ return estimateContractCallFees(params.txIntent);
25
86
  }
26
87
 
27
- return fee;
88
+ return estimateStandardFees(params.currency, params.operationType);
28
89
  };
@@ -1,10 +1,10 @@
1
1
  import { getAssetFromToken } from "./getAssetFromToken";
2
- import { getMockedTokenCurrency } from "../test/fixtures/currency.fixture";
2
+ import { getMockedHTSTokenCurrency } from "../test/fixtures/currency.fixture";
3
3
 
4
4
  describe("getAssetFromToken", () => {
5
5
  it("returns asset from TEST token", () => {
6
6
  const owner = "owner";
7
- const token = getMockedTokenCurrency({
7
+ const token = getMockedHTSTokenCurrency({
8
8
  contractAddress: "0.0.1234567",
9
9
  name: "TEST",
10
10
  units: [
@@ -1,13 +1,11 @@
1
- import { getBalance } from "./getBalance";
2
- import { apiClient } from "../network/api";
3
- import { getMockedCurrency } from "../test/fixtures/currency.fixture";
4
1
  import { setupMockCryptoAssetsStore } from "@ledgerhq/cryptoassets/cal-client/test-helpers";
5
2
  import type { TokenCurrency } from "@ledgerhq/types-cryptoassets";
3
+ import { getBalance } from "./getBalance";
4
+ import { apiClient } from "../network/api";
5
+ import { getMockedCurrency, getMockedHTSTokenCurrency } from "../test/fixtures/currency.fixture";
6
6
 
7
7
  jest.mock("../network/api");
8
8
 
9
- setupMockCryptoAssetsStore();
10
-
11
9
  describe("getBalance", () => {
12
10
  beforeEach(() => {
13
11
  jest.clearAllMocks();
@@ -53,42 +51,16 @@ describe("getBalance", () => {
53
51
  token_id: "0.0.7890",
54
52
  balance: "5000",
55
53
  },
56
- {
57
- token_id: "0.0.9876",
58
- balance: "10000",
59
- },
60
54
  ];
61
- const mockToken1: TokenCurrency = {
62
- type: "TokenCurrency",
63
- id: "token1",
55
+ const mockTokenHTS = getMockedHTSTokenCurrency({
64
56
  contractAddress: "0.0.7890",
65
- tokenType: "hts",
66
- name: "Test Token 1",
67
- ticker: "TT1",
68
- parentCurrency: mockCurrency,
69
- units: [{ name: "TT1", code: "tt1", magnitude: 6 }],
70
- delisted: false,
71
- disableCountervalue: false,
72
- };
73
- const mockToken2: TokenCurrency = {
74
- type: "TokenCurrency",
75
- id: "token2",
76
- contractAddress: "0.0.9876",
77
- tokenType: "hts",
78
- name: "Test Token 2",
79
- ticker: "TT2",
80
- parentCurrency: mockCurrency,
81
- units: [{ name: "TT2", code: "tt2", magnitude: 8 }],
82
- delisted: false,
83
- disableCountervalue: false,
84
- };
57
+ });
85
58
 
86
59
  const findTokenByAddressInCurrencyMock = jest
87
60
  .fn()
88
61
  .mockImplementation(
89
62
  async (tokenId: string, _currencyId: string): Promise<TokenCurrency | undefined> => {
90
- if (tokenId === "0.0.7890") return mockToken1;
91
- if (tokenId === "0.0.9876") return mockToken2;
63
+ if (tokenId === "0.0.7890") return mockTokenHTS;
92
64
  return undefined;
93
65
  },
94
66
  );
@@ -106,10 +78,9 @@ describe("getBalance", () => {
106
78
  expect(apiClient.getAccount).toHaveBeenCalledWith(address);
107
79
  expect(apiClient.getAccountTokens).toHaveBeenCalledTimes(1);
108
80
  expect(apiClient.getAccountTokens).toHaveBeenCalledWith(address);
109
- expect(findTokenByAddressInCurrencyMock).toHaveBeenCalledTimes(2);
81
+ expect(findTokenByAddressInCurrencyMock).toHaveBeenCalledTimes(1);
110
82
  expect(findTokenByAddressInCurrencyMock).toHaveBeenCalledWith("0.0.7890", "hedera");
111
- expect(findTokenByAddressInCurrencyMock).toHaveBeenCalledWith("0.0.9876", "hedera");
112
- expect(result).toHaveLength(3);
83
+ expect(result).toHaveLength(2);
113
84
  expect(result).toEqual(
114
85
  expect.arrayContaining([
115
86
  {
@@ -119,21 +90,11 @@ describe("getBalance", () => {
119
90
  {
120
91
  value: BigInt("5000"),
121
92
  asset: {
122
- type: mockToken1.tokenType,
123
- assetReference: mockToken1.contractAddress,
124
- assetOwner: address,
125
- name: mockToken1.name,
126
- unit: mockToken1.units[0],
127
- },
128
- },
129
- {
130
- value: BigInt("10000"),
131
- asset: {
132
- type: mockToken2.tokenType,
133
- assetReference: mockToken2.contractAddress,
93
+ type: mockTokenHTS.tokenType,
94
+ assetReference: mockTokenHTS.contractAddress,
134
95
  assetOwner: address,
135
- name: mockToken2.name,
136
- unit: mockToken2.units[0],
96
+ name: mockTokenHTS.name,
97
+ unit: mockTokenHTS.units[0],
137
98
  },
138
99
  },
139
100
  ]),
@@ -158,7 +119,7 @@ describe("getBalance", () => {
158
119
  balance: "10000",
159
120
  },
160
121
  ];
161
- const mockToken1: TokenCurrency = {
122
+ const mockTokenHTS: TokenCurrency = {
162
123
  type: "TokenCurrency",
163
124
  id: "token1",
164
125
  contractAddress: "0.0.7890",
@@ -175,7 +136,7 @@ describe("getBalance", () => {
175
136
  .fn()
176
137
  .mockImplementation(
177
138
  async (tokenId: string, _currencyId: string): Promise<TokenCurrency | undefined> => {
178
- if (tokenId === "0.0.7890") return mockToken1;
139
+ if (tokenId === "0.0.7890") return mockTokenHTS;
179
140
  return undefined;
180
141
  },
181
142
  );
@@ -197,11 +158,11 @@ describe("getBalance", () => {
197
158
  expect(result[1]).toEqual({
198
159
  value: BigInt("5000"),
199
160
  asset: {
200
- type: mockToken1.tokenType,
201
- assetReference: mockToken1.contractAddress,
161
+ type: mockTokenHTS.tokenType,
162
+ assetReference: mockTokenHTS.contractAddress,
202
163
  assetOwner: address,
203
- name: mockToken1.name,
204
- unit: mockToken1.units[0],
164
+ name: mockTokenHTS.name,
165
+ unit: mockTokenHTS.units[0],
205
166
  },
206
167
  });
207
168
  });