@ledgerhq/coin-vechain 2.9.1-nightly.1 → 2.10.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.
Files changed (475) hide show
  1. package/.turbo/turbo-build.log +1 -1
  2. package/.unimportedrc.json +16 -4
  3. package/CHANGELOG.md +14 -0
  4. package/lib/bridge/broadcast.d.ts.map +1 -1
  5. package/lib/bridge/broadcast.js +2 -3
  6. package/lib/bridge/broadcast.js.map +1 -1
  7. package/lib/bridge/broadcast.test.d.ts +2 -0
  8. package/lib/bridge/broadcast.test.d.ts.map +1 -0
  9. package/lib/bridge/broadcast.test.js +188 -0
  10. package/lib/bridge/broadcast.test.js.map +1 -0
  11. package/lib/bridge/buildOptimisticOperatioin.test.d.ts +2 -0
  12. package/lib/bridge/buildOptimisticOperatioin.test.d.ts.map +1 -0
  13. package/lib/bridge/buildOptimisticOperatioin.test.js +286 -0
  14. package/lib/bridge/buildOptimisticOperatioin.test.js.map +1 -0
  15. package/lib/bridge/createTransaction.d.ts.map +1 -1
  16. package/lib/bridge/createTransaction.js +2 -1
  17. package/lib/bridge/createTransaction.js.map +1 -1
  18. package/lib/bridge/createTransaction.test.d.ts +2 -0
  19. package/lib/bridge/createTransaction.test.d.ts.map +1 -0
  20. package/lib/bridge/createTransaction.test.js +167 -0
  21. package/lib/bridge/createTransaction.test.js.map +1 -0
  22. package/lib/bridge/estimateMaxSpendable.test.d.ts +2 -0
  23. package/lib/bridge/estimateMaxSpendable.test.d.ts.map +1 -0
  24. package/lib/bridge/estimateMaxSpendable.test.js +269 -0
  25. package/lib/bridge/estimateMaxSpendable.test.js.map +1 -0
  26. package/lib/bridge/getTransactionStatus.d.ts.map +1 -1
  27. package/lib/bridge/getTransactionStatus.js +3 -1
  28. package/lib/bridge/getTransactionStatus.js.map +1 -1
  29. package/lib/bridge/getTransactionStatus.test.d.ts +2 -0
  30. package/lib/bridge/getTransactionStatus.test.d.ts.map +1 -0
  31. package/lib/bridge/getTransactionStatus.test.js +282 -0
  32. package/lib/bridge/getTransactionStatus.test.js.map +1 -0
  33. package/lib/bridge/helpers.test.d.ts +2 -0
  34. package/lib/bridge/helpers.test.d.ts.map +1 -0
  35. package/lib/bridge/helpers.test.js +298 -0
  36. package/lib/bridge/helpers.test.js.map +1 -0
  37. package/lib/bridge/prepareTransaction.d.ts.map +1 -1
  38. package/lib/bridge/prepareTransaction.js +10 -3
  39. package/lib/bridge/prepareTransaction.js.map +1 -1
  40. package/lib/bridge/prepareTransaction.test.d.ts +2 -0
  41. package/lib/bridge/prepareTransaction.test.d.ts.map +1 -0
  42. package/lib/bridge/prepareTransaction.test.js +277 -0
  43. package/lib/bridge/prepareTransaction.test.js.map +1 -0
  44. package/lib/bridge/signOperation.d.ts.map +1 -1
  45. package/lib/bridge/signOperation.js +3 -3
  46. package/lib/bridge/signOperation.js.map +1 -1
  47. package/lib/bridge/signOperation.test.d.ts +2 -0
  48. package/lib/bridge/signOperation.test.d.ts.map +1 -0
  49. package/lib/bridge/signOperation.test.js +295 -0
  50. package/lib/bridge/signOperation.test.js.map +1 -0
  51. package/lib/bridge/synchronisation.d.ts.map +1 -1
  52. package/lib/bridge/synchronisation.js +2 -2
  53. package/lib/bridge/synchronisation.js.map +1 -1
  54. package/lib/bridge/transaction.test.d.ts +2 -0
  55. package/lib/bridge/transaction.test.d.ts.map +1 -0
  56. package/lib/bridge/transaction.test.js +353 -0
  57. package/lib/bridge/transaction.test.js.map +1 -0
  58. package/lib/common-logic/calculateClauses.d.ts +5 -0
  59. package/lib/common-logic/calculateClauses.d.ts.map +1 -0
  60. package/lib/common-logic/{logic.js → calculateClauses.js} +7 -10
  61. package/lib/common-logic/calculateClauses.js.map +1 -0
  62. package/lib/common-logic/calculateClauses.test.d.ts +2 -0
  63. package/lib/common-logic/calculateClauses.test.d.ts.map +1 -0
  64. package/lib/common-logic/calculateClauses.test.js +156 -0
  65. package/lib/common-logic/calculateClauses.test.js.map +1 -0
  66. package/lib/common-logic/calculateGasFees.d.ts +9 -0
  67. package/lib/common-logic/calculateGasFees.d.ts.map +1 -0
  68. package/lib/common-logic/calculateGasFees.js +39 -0
  69. package/lib/common-logic/calculateGasFees.js.map +1 -0
  70. package/lib/common-logic/calculateGasFees.test.d.ts +2 -0
  71. package/lib/common-logic/calculateGasFees.test.d.ts.map +1 -0
  72. package/lib/common-logic/calculateGasFees.test.js +279 -0
  73. package/lib/common-logic/calculateGasFees.test.js.map +1 -0
  74. package/lib/common-logic/calculateTransactionInfo.d.ts +10 -0
  75. package/lib/common-logic/calculateTransactionInfo.d.ts.map +1 -0
  76. package/lib/common-logic/calculateTransactionInfo.js +81 -0
  77. package/lib/common-logic/calculateTransactionInfo.js.map +1 -0
  78. package/lib/common-logic/calculateTransactionInfo.test.d.ts +2 -0
  79. package/lib/common-logic/calculateTransactionInfo.test.d.ts.map +1 -0
  80. package/lib/common-logic/calculateTransactionInfo.test.js +314 -0
  81. package/lib/common-logic/calculateTransactionInfo.test.js.map +1 -0
  82. package/lib/common-logic/estimateGas.d.ts +10 -0
  83. package/lib/common-logic/estimateGas.d.ts.map +1 -0
  84. package/lib/common-logic/estimateGas.js +17 -0
  85. package/lib/common-logic/estimateGas.js.map +1 -0
  86. package/lib/common-logic/estimateGas.test.d.ts +2 -0
  87. package/lib/common-logic/estimateGas.test.d.ts.map +1 -0
  88. package/lib/common-logic/estimateGas.test.js +129 -0
  89. package/lib/common-logic/estimateGas.test.js.map +1 -0
  90. package/lib/common-logic/fixPrefixCase.d.ts +2 -0
  91. package/lib/common-logic/fixPrefixCase.d.ts.map +1 -0
  92. package/lib/common-logic/fixPrefixCase.js +9 -0
  93. package/lib/common-logic/fixPrefixCase.js.map +1 -0
  94. package/lib/common-logic/fixPrefixCase.test.d.ts +2 -0
  95. package/lib/common-logic/fixPrefixCase.test.d.ts.map +1 -0
  96. package/lib/common-logic/fixPrefixCase.test.js +46 -0
  97. package/lib/common-logic/fixPrefixCase.test.js.map +1 -0
  98. package/lib/common-logic/generateNonce.d.ts +6 -0
  99. package/lib/common-logic/generateNonce.d.ts.map +1 -0
  100. package/lib/common-logic/generateNonce.js +13 -0
  101. package/lib/common-logic/generateNonce.js.map +1 -0
  102. package/lib/common-logic/generateNonce.test.d.ts +2 -0
  103. package/lib/common-logic/generateNonce.test.d.ts.map +1 -0
  104. package/lib/common-logic/generateNonce.test.js +59 -0
  105. package/lib/common-logic/generateNonce.test.js.map +1 -0
  106. package/lib/common-logic/getThorClient.d.ts +7 -0
  107. package/lib/common-logic/getThorClient.d.ts.map +1 -0
  108. package/lib/common-logic/getThorClient.js +14 -0
  109. package/lib/common-logic/getThorClient.js.map +1 -0
  110. package/lib/common-logic/getThorClient.test.d.ts +2 -0
  111. package/lib/common-logic/getThorClient.test.d.ts.map +1 -0
  112. package/lib/common-logic/getThorClient.test.js +53 -0
  113. package/lib/common-logic/getThorClient.test.js.map +1 -0
  114. package/lib/common-logic/index.d.ts +8 -6
  115. package/lib/common-logic/index.d.ts.map +1 -1
  116. package/lib/common-logic/index.js +8 -6
  117. package/lib/common-logic/index.js.map +1 -1
  118. package/lib/common-logic/{mapping-utils.d.ts → mapTransfersToOperations.d.ts} +2 -2
  119. package/lib/common-logic/mapTransfersToOperations.d.ts.map +1 -0
  120. package/lib/common-logic/{mapping-utils.js → mapTransfersToOperations.js} +26 -19
  121. package/lib/common-logic/mapTransfersToOperations.js.map +1 -0
  122. package/lib/common-logic/mapTransfersToOperations.test.d.ts +2 -0
  123. package/lib/common-logic/mapTransfersToOperations.test.d.ts.map +1 -0
  124. package/lib/common-logic/mapTransfersToOperations.test.js +274 -0
  125. package/lib/common-logic/mapTransfersToOperations.test.js.map +1 -0
  126. package/lib/common-logic/{pad-address.d.ts → padAddress.d.ts} +1 -1
  127. package/lib/common-logic/padAddress.d.ts.map +1 -0
  128. package/lib/common-logic/{pad-address.js → padAddress.js} +1 -1
  129. package/lib/common-logic/padAddress.js.map +1 -0
  130. package/lib/common-logic/padAddress.test.d.ts +2 -0
  131. package/lib/common-logic/padAddress.test.d.ts.map +1 -0
  132. package/lib/common-logic/padAddress.test.js +59 -0
  133. package/lib/common-logic/padAddress.test.js.map +1 -0
  134. package/lib/common-logic/parseAddress.d.ts +7 -0
  135. package/lib/common-logic/parseAddress.d.ts.map +1 -0
  136. package/lib/common-logic/parseAddress.js +15 -0
  137. package/lib/common-logic/parseAddress.js.map +1 -0
  138. package/lib/common-logic/parseAddress.test.d.ts +2 -0
  139. package/lib/common-logic/parseAddress.test.d.ts.map +1 -0
  140. package/lib/common-logic/parseAddress.test.js +97 -0
  141. package/lib/common-logic/parseAddress.test.js.map +1 -0
  142. package/lib/constants/env.d.ts +2 -0
  143. package/lib/constants/env.d.ts.map +1 -0
  144. package/lib/constants/env.js +6 -0
  145. package/lib/constants/env.js.map +1 -0
  146. package/lib/constants/index.d.ts +2 -0
  147. package/lib/constants/index.d.ts.map +1 -0
  148. package/lib/constants/index.js +18 -0
  149. package/lib/constants/index.js.map +1 -0
  150. package/lib/network/sdk.d.ts +3 -10
  151. package/lib/network/sdk.d.ts.map +1 -1
  152. package/lib/network/sdk.js +15 -30
  153. package/lib/network/sdk.js.map +1 -1
  154. package/lib/signer/getAddress.test.d.ts +2 -0
  155. package/lib/signer/getAddress.test.d.ts.map +1 -0
  156. package/lib/signer/getAddress.test.js +357 -0
  157. package/lib/signer/getAddress.test.js.map +1 -0
  158. package/lib/signer/signMessage.d.ts.map +1 -1
  159. package/lib/signer/signMessage.js +3 -3
  160. package/lib/signer/signMessage.js.map +1 -1
  161. package/lib/signer/signMessage.test.d.ts +2 -0
  162. package/lib/signer/signMessage.test.d.ts.map +1 -0
  163. package/lib/signer/signMessage.test.js +242 -0
  164. package/lib/signer/signMessage.test.js.map +1 -0
  165. package/lib/test/bridgeDatasetTest.d.ts.map +1 -1
  166. package/lib/test/bridgeDatasetTest.js +79 -53
  167. package/lib/test/bridgeDatasetTest.js.map +1 -1
  168. package/lib/test/cli.d.ts.map +1 -1
  169. package/lib/test/cli.js +5 -4
  170. package/lib/test/cli.js.map +1 -1
  171. package/lib/types/bridge.d.ts +11 -3
  172. package/lib/types/bridge.d.ts.map +1 -1
  173. package/lib/types/bridge.js +3 -0
  174. package/lib/types/bridge.js.map +1 -1
  175. package/lib/types/constants.d.ts +0 -3
  176. package/lib/types/constants.d.ts.map +1 -1
  177. package/lib/types/constants.js +1 -4
  178. package/lib/types/constants.js.map +1 -1
  179. package/lib/types/signer.d.ts +0 -2
  180. package/lib/types/signer.d.ts.map +1 -1
  181. package/lib-es/bridge/broadcast.d.ts.map +1 -1
  182. package/lib-es/bridge/broadcast.js +2 -3
  183. package/lib-es/bridge/broadcast.js.map +1 -1
  184. package/lib-es/bridge/broadcast.test.d.ts +2 -0
  185. package/lib-es/bridge/broadcast.test.d.ts.map +1 -0
  186. package/lib-es/bridge/broadcast.test.js +183 -0
  187. package/lib-es/bridge/broadcast.test.js.map +1 -0
  188. package/lib-es/bridge/buildOptimisticOperatioin.test.d.ts +2 -0
  189. package/lib-es/bridge/buildOptimisticOperatioin.test.d.ts.map +1 -0
  190. package/lib-es/bridge/buildOptimisticOperatioin.test.js +281 -0
  191. package/lib-es/bridge/buildOptimisticOperatioin.test.js.map +1 -0
  192. package/lib-es/bridge/createTransaction.d.ts.map +1 -1
  193. package/lib-es/bridge/createTransaction.js +3 -2
  194. package/lib-es/bridge/createTransaction.js.map +1 -1
  195. package/lib-es/bridge/createTransaction.test.d.ts +2 -0
  196. package/lib-es/bridge/createTransaction.test.d.ts.map +1 -0
  197. package/lib-es/bridge/createTransaction.test.js +162 -0
  198. package/lib-es/bridge/createTransaction.test.js.map +1 -0
  199. package/lib-es/bridge/estimateMaxSpendable.test.d.ts +2 -0
  200. package/lib-es/bridge/estimateMaxSpendable.test.d.ts.map +1 -0
  201. package/lib-es/bridge/estimateMaxSpendable.test.js +264 -0
  202. package/lib-es/bridge/estimateMaxSpendable.test.js.map +1 -0
  203. package/lib-es/bridge/getTransactionStatus.d.ts.map +1 -1
  204. package/lib-es/bridge/getTransactionStatus.js +4 -2
  205. package/lib-es/bridge/getTransactionStatus.js.map +1 -1
  206. package/lib-es/bridge/getTransactionStatus.test.d.ts +2 -0
  207. package/lib-es/bridge/getTransactionStatus.test.d.ts.map +1 -0
  208. package/lib-es/bridge/getTransactionStatus.test.js +277 -0
  209. package/lib-es/bridge/getTransactionStatus.test.js.map +1 -0
  210. package/lib-es/bridge/helpers.test.d.ts +2 -0
  211. package/lib-es/bridge/helpers.test.d.ts.map +1 -0
  212. package/lib-es/bridge/helpers.test.js +293 -0
  213. package/lib-es/bridge/helpers.test.js.map +1 -0
  214. package/lib-es/bridge/prepareTransaction.d.ts.map +1 -1
  215. package/lib-es/bridge/prepareTransaction.js +11 -4
  216. package/lib-es/bridge/prepareTransaction.js.map +1 -1
  217. package/lib-es/bridge/prepareTransaction.test.d.ts +2 -0
  218. package/lib-es/bridge/prepareTransaction.test.d.ts.map +1 -0
  219. package/lib-es/bridge/prepareTransaction.test.js +272 -0
  220. package/lib-es/bridge/prepareTransaction.test.js.map +1 -0
  221. package/lib-es/bridge/signOperation.d.ts.map +1 -1
  222. package/lib-es/bridge/signOperation.js +3 -3
  223. package/lib-es/bridge/signOperation.js.map +1 -1
  224. package/lib-es/bridge/signOperation.test.d.ts +2 -0
  225. package/lib-es/bridge/signOperation.test.d.ts.map +1 -0
  226. package/lib-es/bridge/signOperation.test.js +290 -0
  227. package/lib-es/bridge/signOperation.test.js.map +1 -0
  228. package/lib-es/bridge/synchronisation.d.ts.map +1 -1
  229. package/lib-es/bridge/synchronisation.js +1 -1
  230. package/lib-es/bridge/synchronisation.js.map +1 -1
  231. package/lib-es/bridge/transaction.test.d.ts +2 -0
  232. package/lib-es/bridge/transaction.test.d.ts.map +1 -0
  233. package/lib-es/bridge/transaction.test.js +347 -0
  234. package/lib-es/bridge/transaction.test.js.map +1 -0
  235. package/lib-es/common-logic/calculateClauses.d.ts +5 -0
  236. package/lib-es/common-logic/calculateClauses.d.ts.map +1 -0
  237. package/lib-es/common-logic/{logic.js → calculateClauses.js} +6 -6
  238. package/lib-es/common-logic/calculateClauses.js.map +1 -0
  239. package/lib-es/common-logic/calculateClauses.test.d.ts +2 -0
  240. package/lib-es/common-logic/calculateClauses.test.d.ts.map +1 -0
  241. package/lib-es/common-logic/calculateClauses.test.js +151 -0
  242. package/lib-es/common-logic/calculateClauses.test.js.map +1 -0
  243. package/lib-es/common-logic/calculateGasFees.d.ts +9 -0
  244. package/lib-es/common-logic/calculateGasFees.d.ts.map +1 -0
  245. package/lib-es/common-logic/calculateGasFees.js +32 -0
  246. package/lib-es/common-logic/calculateGasFees.js.map +1 -0
  247. package/lib-es/common-logic/calculateGasFees.test.d.ts +2 -0
  248. package/lib-es/common-logic/calculateGasFees.test.d.ts.map +1 -0
  249. package/lib-es/common-logic/calculateGasFees.test.js +274 -0
  250. package/lib-es/common-logic/calculateGasFees.test.js.map +1 -0
  251. package/lib-es/common-logic/calculateTransactionInfo.d.ts +10 -0
  252. package/lib-es/common-logic/calculateTransactionInfo.d.ts.map +1 -0
  253. package/lib-es/common-logic/calculateTransactionInfo.js +74 -0
  254. package/lib-es/common-logic/calculateTransactionInfo.js.map +1 -0
  255. package/lib-es/common-logic/calculateTransactionInfo.test.d.ts +2 -0
  256. package/lib-es/common-logic/calculateTransactionInfo.test.d.ts.map +1 -0
  257. package/lib-es/common-logic/calculateTransactionInfo.test.js +309 -0
  258. package/lib-es/common-logic/calculateTransactionInfo.test.js.map +1 -0
  259. package/lib-es/common-logic/estimateGas.d.ts +10 -0
  260. package/lib-es/common-logic/estimateGas.d.ts.map +1 -0
  261. package/lib-es/common-logic/estimateGas.js +13 -0
  262. package/lib-es/common-logic/estimateGas.js.map +1 -0
  263. package/lib-es/common-logic/estimateGas.test.d.ts +2 -0
  264. package/lib-es/common-logic/estimateGas.test.d.ts.map +1 -0
  265. package/lib-es/common-logic/estimateGas.test.js +127 -0
  266. package/lib-es/common-logic/estimateGas.test.js.map +1 -0
  267. package/lib-es/common-logic/fixPrefixCase.d.ts +2 -0
  268. package/lib-es/common-logic/fixPrefixCase.d.ts.map +1 -0
  269. package/lib-es/common-logic/fixPrefixCase.js +5 -0
  270. package/lib-es/common-logic/fixPrefixCase.js.map +1 -0
  271. package/lib-es/common-logic/fixPrefixCase.test.d.ts +2 -0
  272. package/lib-es/common-logic/fixPrefixCase.test.d.ts.map +1 -0
  273. package/lib-es/common-logic/fixPrefixCase.test.js +44 -0
  274. package/lib-es/common-logic/fixPrefixCase.test.js.map +1 -0
  275. package/lib-es/common-logic/generateNonce.d.ts +6 -0
  276. package/lib-es/common-logic/generateNonce.d.ts.map +1 -0
  277. package/lib-es/common-logic/generateNonce.js +9 -0
  278. package/lib-es/common-logic/generateNonce.js.map +1 -0
  279. package/lib-es/common-logic/generateNonce.test.d.ts +2 -0
  280. package/lib-es/common-logic/generateNonce.test.d.ts.map +1 -0
  281. package/lib-es/common-logic/generateNonce.test.js +57 -0
  282. package/lib-es/common-logic/generateNonce.test.js.map +1 -0
  283. package/lib-es/common-logic/getThorClient.d.ts +7 -0
  284. package/lib-es/common-logic/getThorClient.d.ts.map +1 -0
  285. package/lib-es/common-logic/getThorClient.js +10 -0
  286. package/lib-es/common-logic/getThorClient.js.map +1 -0
  287. package/lib-es/common-logic/getThorClient.test.d.ts +2 -0
  288. package/lib-es/common-logic/getThorClient.test.d.ts.map +1 -0
  289. package/lib-es/common-logic/getThorClient.test.js +51 -0
  290. package/lib-es/common-logic/getThorClient.test.js.map +1 -0
  291. package/lib-es/common-logic/index.d.ts +8 -6
  292. package/lib-es/common-logic/index.d.ts.map +1 -1
  293. package/lib-es/common-logic/index.js +8 -6
  294. package/lib-es/common-logic/index.js.map +1 -1
  295. package/lib-es/common-logic/{mapping-utils.d.ts → mapTransfersToOperations.d.ts} +2 -2
  296. package/lib-es/common-logic/mapTransfersToOperations.d.ts.map +1 -0
  297. package/lib-es/common-logic/mapTransfersToOperations.js +51 -0
  298. package/lib-es/common-logic/mapTransfersToOperations.js.map +1 -0
  299. package/lib-es/common-logic/mapTransfersToOperations.test.d.ts +2 -0
  300. package/lib-es/common-logic/mapTransfersToOperations.test.d.ts.map +1 -0
  301. package/lib-es/common-logic/mapTransfersToOperations.test.js +269 -0
  302. package/lib-es/common-logic/mapTransfersToOperations.test.js.map +1 -0
  303. package/lib-es/common-logic/{pad-address.d.ts → padAddress.d.ts} +1 -1
  304. package/lib-es/common-logic/padAddress.d.ts.map +1 -0
  305. package/lib-es/common-logic/{pad-address.js → padAddress.js} +1 -1
  306. package/lib-es/common-logic/padAddress.js.map +1 -0
  307. package/lib-es/common-logic/padAddress.test.d.ts +2 -0
  308. package/lib-es/common-logic/padAddress.test.d.ts.map +1 -0
  309. package/lib-es/common-logic/padAddress.test.js +57 -0
  310. package/lib-es/common-logic/padAddress.test.js.map +1 -0
  311. package/lib-es/common-logic/parseAddress.d.ts +7 -0
  312. package/lib-es/common-logic/parseAddress.d.ts.map +1 -0
  313. package/lib-es/common-logic/parseAddress.js +11 -0
  314. package/lib-es/common-logic/parseAddress.js.map +1 -0
  315. package/lib-es/common-logic/parseAddress.test.d.ts +2 -0
  316. package/lib-es/common-logic/parseAddress.test.d.ts.map +1 -0
  317. package/lib-es/common-logic/parseAddress.test.js +95 -0
  318. package/lib-es/common-logic/parseAddress.test.js.map +1 -0
  319. package/lib-es/constants/env.d.ts +2 -0
  320. package/lib-es/constants/env.d.ts.map +1 -0
  321. package/lib-es/constants/env.js +3 -0
  322. package/lib-es/constants/env.js.map +1 -0
  323. package/lib-es/constants/index.d.ts +2 -0
  324. package/lib-es/constants/index.d.ts.map +1 -0
  325. package/lib-es/constants/index.js +2 -0
  326. package/lib-es/constants/index.js.map +1 -0
  327. package/lib-es/network/sdk.d.ts +3 -10
  328. package/lib-es/network/sdk.d.ts.map +1 -1
  329. package/lib-es/network/sdk.js +5 -19
  330. package/lib-es/network/sdk.js.map +1 -1
  331. package/lib-es/signer/getAddress.test.d.ts +2 -0
  332. package/lib-es/signer/getAddress.test.d.ts.map +1 -0
  333. package/lib-es/signer/getAddress.test.js +352 -0
  334. package/lib-es/signer/getAddress.test.js.map +1 -0
  335. package/lib-es/signer/signMessage.d.ts.map +1 -1
  336. package/lib-es/signer/signMessage.js +3 -3
  337. package/lib-es/signer/signMessage.js.map +1 -1
  338. package/lib-es/signer/signMessage.test.d.ts +2 -0
  339. package/lib-es/signer/signMessage.test.d.ts.map +1 -0
  340. package/lib-es/signer/signMessage.test.js +240 -0
  341. package/lib-es/signer/signMessage.test.js.map +1 -0
  342. package/lib-es/test/bridgeDatasetTest.d.ts.map +1 -1
  343. package/lib-es/test/bridgeDatasetTest.js +80 -54
  344. package/lib-es/test/bridgeDatasetTest.js.map +1 -1
  345. package/lib-es/test/cli.d.ts.map +1 -1
  346. package/lib-es/test/cli.js +4 -3
  347. package/lib-es/test/cli.js.map +1 -1
  348. package/lib-es/types/bridge.d.ts +11 -3
  349. package/lib-es/types/bridge.d.ts.map +1 -1
  350. package/lib-es/types/bridge.js +6 -1
  351. package/lib-es/types/bridge.js.map +1 -1
  352. package/lib-es/types/constants.d.ts +0 -3
  353. package/lib-es/types/constants.d.ts.map +1 -1
  354. package/lib-es/types/constants.js +0 -3
  355. package/lib-es/types/constants.js.map +1 -1
  356. package/lib-es/types/signer.d.ts +0 -2
  357. package/lib-es/types/signer.d.ts.map +1 -1
  358. package/package.json +8 -7
  359. package/src/bridge/broadcast.test.ts +236 -0
  360. package/src/bridge/broadcast.ts +4 -5
  361. package/src/bridge/buildOptimisticOperatioin.test.ts +364 -0
  362. package/src/bridge/createTransaction.test.ts +201 -0
  363. package/src/bridge/createTransaction.ts +3 -2
  364. package/src/bridge/estimateMaxSpendable.test.ts +319 -0
  365. package/src/bridge/getTransactionStatus.test.ts +353 -0
  366. package/src/bridge/getTransactionStatus.ts +4 -2
  367. package/src/bridge/helpers.test.ts +356 -0
  368. package/src/bridge/prepareTransaction.test.ts +345 -0
  369. package/src/bridge/prepareTransaction.ts +20 -10
  370. package/src/bridge/signOperation.test.ts +354 -0
  371. package/src/bridge/signOperation.ts +6 -3
  372. package/src/bridge/synchronisation.ts +1 -1
  373. package/src/bridge/transaction.test.ts +440 -0
  374. package/src/common-logic/calculateClauses.test.ts +186 -0
  375. package/src/common-logic/calculateClauses.ts +44 -0
  376. package/src/common-logic/calculateGasFees.test.ts +363 -0
  377. package/src/common-logic/calculateGasFees.ts +45 -0
  378. package/src/common-logic/calculateTransactionInfo.test.ts +396 -0
  379. package/src/common-logic/calculateTransactionInfo.ts +96 -0
  380. package/src/common-logic/estimateGas.test.ts +162 -0
  381. package/src/common-logic/estimateGas.ts +18 -0
  382. package/src/common-logic/fixPrefixCase.test.ts +51 -0
  383. package/src/common-logic/fixPrefixCase.ts +5 -0
  384. package/src/common-logic/generateNonce.test.ts +72 -0
  385. package/src/common-logic/generateNonce.ts +9 -0
  386. package/src/common-logic/getThorClient.test.ts +66 -0
  387. package/src/common-logic/getThorClient.ts +10 -0
  388. package/src/common-logic/index.ts +8 -6
  389. package/src/common-logic/mapTransfersToOperations.test.ts +342 -0
  390. package/src/common-logic/mapTransfersToOperations.ts +77 -0
  391. package/src/common-logic/padAddress.test.ts +65 -0
  392. package/src/common-logic/parseAddress.test.ts +130 -0
  393. package/src/common-logic/parseAddress.ts +11 -0
  394. package/src/constants/env.ts +3 -0
  395. package/src/constants/index.ts +1 -0
  396. package/src/network/sdk.ts +22 -30
  397. package/src/signer/getAddress.test.ts +454 -0
  398. package/src/signer/signMessage.test.ts +329 -0
  399. package/src/signer/signMessage.ts +4 -5
  400. package/src/test/bridgeDatasetTest.ts +86 -58
  401. package/src/test/cli.ts +4 -3
  402. package/src/types/bridge.ts +16 -3
  403. package/src/types/constants.ts +0 -3
  404. package/lib/common-logic/address-utils.d.ts +0 -2
  405. package/lib/common-logic/address-utils.d.ts.map +0 -1
  406. package/lib/common-logic/address-utils.js +0 -19
  407. package/lib/common-logic/address-utils.js.map +0 -1
  408. package/lib/common-logic/hex-utils.d.ts +0 -8
  409. package/lib/common-logic/hex-utils.d.ts.map +0 -1
  410. package/lib/common-logic/hex-utils.js +0 -52
  411. package/lib/common-logic/hex-utils.js.map +0 -1
  412. package/lib/common-logic/logic.d.ts +0 -5
  413. package/lib/common-logic/logic.d.ts.map +0 -1
  414. package/lib/common-logic/logic.js.map +0 -1
  415. package/lib/common-logic/mapping-utils.d.ts.map +0 -1
  416. package/lib/common-logic/mapping-utils.js.map +0 -1
  417. package/lib/common-logic/pad-address.d.ts.map +0 -1
  418. package/lib/common-logic/pad-address.js.map +0 -1
  419. package/lib/common-logic/transaction-utils.d.ts +0 -30
  420. package/lib/common-logic/transaction-utils.d.ts.map +0 -1
  421. package/lib/common-logic/transaction-utils.js +0 -161
  422. package/lib/common-logic/transaction-utils.js.map +0 -1
  423. package/lib/contracts/abis/VIP180.d.ts +0 -17
  424. package/lib/contracts/abis/VIP180.d.ts.map +0 -1
  425. package/lib/contracts/abis/VIP180.js +0 -265
  426. package/lib/contracts/abis/VIP180.js.map +0 -1
  427. package/lib/contracts/abis/params.d.ts +0 -8
  428. package/lib/contracts/abis/params.d.ts.map +0 -1
  429. package/lib/contracts/abis/params.js +0 -69
  430. package/lib/contracts/abis/params.js.map +0 -1
  431. package/lib/contracts/constants.d.ts +0 -6
  432. package/lib/contracts/constants.d.ts.map +0 -1
  433. package/lib/contracts/constants.js +0 -10
  434. package/lib/contracts/constants.js.map +0 -1
  435. package/lib-es/common-logic/address-utils.d.ts +0 -2
  436. package/lib-es/common-logic/address-utils.d.ts.map +0 -1
  437. package/lib-es/common-logic/address-utils.js +0 -12
  438. package/lib-es/common-logic/address-utils.js.map +0 -1
  439. package/lib-es/common-logic/hex-utils.d.ts +0 -8
  440. package/lib-es/common-logic/hex-utils.d.ts.map +0 -1
  441. package/lib-es/common-logic/hex-utils.js +0 -50
  442. package/lib-es/common-logic/hex-utils.js.map +0 -1
  443. package/lib-es/common-logic/logic.d.ts +0 -5
  444. package/lib-es/common-logic/logic.d.ts.map +0 -1
  445. package/lib-es/common-logic/logic.js.map +0 -1
  446. package/lib-es/common-logic/mapping-utils.d.ts.map +0 -1
  447. package/lib-es/common-logic/mapping-utils.js +0 -44
  448. package/lib-es/common-logic/mapping-utils.js.map +0 -1
  449. package/lib-es/common-logic/pad-address.d.ts.map +0 -1
  450. package/lib-es/common-logic/pad-address.js.map +0 -1
  451. package/lib-es/common-logic/transaction-utils.d.ts +0 -30
  452. package/lib-es/common-logic/transaction-utils.d.ts.map +0 -1
  453. package/lib-es/common-logic/transaction-utils.js +0 -150
  454. package/lib-es/common-logic/transaction-utils.js.map +0 -1
  455. package/lib-es/contracts/abis/VIP180.d.ts +0 -17
  456. package/lib-es/contracts/abis/VIP180.d.ts.map +0 -1
  457. package/lib-es/contracts/abis/VIP180.js +0 -263
  458. package/lib-es/contracts/abis/VIP180.js.map +0 -1
  459. package/lib-es/contracts/abis/params.d.ts +0 -8
  460. package/lib-es/contracts/abis/params.d.ts.map +0 -1
  461. package/lib-es/contracts/abis/params.js +0 -67
  462. package/lib-es/contracts/abis/params.js.map +0 -1
  463. package/lib-es/contracts/constants.d.ts +0 -6
  464. package/lib-es/contracts/constants.d.ts.map +0 -1
  465. package/lib-es/contracts/constants.js +0 -7
  466. package/lib-es/contracts/constants.js.map +0 -1
  467. package/src/common-logic/address-utils.ts +0 -11
  468. package/src/common-logic/hex-utils.ts +0 -53
  469. package/src/common-logic/logic.ts +0 -44
  470. package/src/common-logic/mapping-utils.ts +0 -67
  471. package/src/common-logic/transaction-utils.ts +0 -190
  472. package/src/contracts/abis/VIP180.ts +0 -265
  473. package/src/contracts/abis/params.ts +0 -70
  474. package/src/contracts/constants.ts +0 -11
  475. /package/src/common-logic/{pad-address.ts → padAddress.ts} +0 -0
@@ -0,0 +1,454 @@
1
+ import resolver from "./getAddress";
2
+ import { VechainSigner } from "../types";
3
+ import { SignerContext } from "@ledgerhq/coin-framework/signer";
4
+ import { GetAddressOptions } from "@ledgerhq/coin-framework/derivation";
5
+ import eip55 from "eip55";
6
+
7
+ // Mock dependencies
8
+ jest.mock("eip55");
9
+
10
+ const mockedEip55 = jest.mocked(eip55);
11
+
12
+ describe("getAddress resolver", () => {
13
+ const mockDeviceId = "mock-device-id";
14
+ const mockPath = "44'/818'/0'/0/0";
15
+
16
+ const mockSigner: VechainSigner = {
17
+ getAddress: jest.fn(),
18
+ signTransaction: jest.fn(),
19
+ };
20
+
21
+ const mockSignerContext: SignerContext<VechainSigner> = jest.fn();
22
+
23
+ const mockSignerResponse = {
24
+ address: "0x742d35cc6634c0532925a3b8d0b251d8c1743ec4",
25
+ publicKey: Buffer.from(
26
+ "04abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890ab",
27
+ "hex",
28
+ ),
29
+ };
30
+
31
+ beforeEach(() => {
32
+ jest.clearAllMocks();
33
+ (mockSigner.getAddress as jest.Mock).mockResolvedValue(mockSignerResponse);
34
+ (mockSignerContext as jest.Mock).mockImplementation((deviceId, callback) =>
35
+ callback(mockSigner),
36
+ );
37
+ mockedEip55.encode.mockReturnValue("0x742d35Cc6634C0532925a3b8D0B251d8c1743eC4");
38
+ });
39
+
40
+ describe("basic functionality", () => {
41
+ it("should get address with verify false", async () => {
42
+ const getAddressFn = resolver(mockSignerContext);
43
+ const options: GetAddressOptions = {
44
+ path: mockPath,
45
+ verify: false,
46
+ currency: {} as any,
47
+ derivationMode: "" as any,
48
+ };
49
+
50
+ const result = await getAddressFn(mockDeviceId, options);
51
+
52
+ expect(result).toEqual({
53
+ address: "0x742d35Cc6634C0532925a3b8D0B251d8c1743eC4",
54
+ publicKey: mockSignerResponse.publicKey,
55
+ path: mockPath,
56
+ });
57
+
58
+ expect(mockSigner.getAddress).toHaveBeenCalledWith(mockPath, false, false);
59
+ expect(mockedEip55.encode).toHaveBeenCalledWith(mockSignerResponse.address);
60
+ });
61
+
62
+ it("should get address with verify true", async () => {
63
+ const getAddressFn = resolver(mockSignerContext);
64
+ const options: GetAddressOptions = {
65
+ path: mockPath,
66
+ verify: true,
67
+ currency: {} as any,
68
+ derivationMode: "" as any,
69
+ };
70
+
71
+ const result = await getAddressFn(mockDeviceId, options);
72
+
73
+ expect(result).toEqual({
74
+ address: "0x742d35Cc6634C0532925a3b8D0B251d8c1743eC4",
75
+ publicKey: mockSignerResponse.publicKey,
76
+ path: mockPath,
77
+ });
78
+
79
+ expect(mockSigner.getAddress).toHaveBeenCalledWith(mockPath, true, false);
80
+ });
81
+
82
+ it("should always pass false as third parameter (askChainCode)", async () => {
83
+ const getAddressFn = resolver(mockSignerContext);
84
+ const options: GetAddressOptions = {
85
+ path: mockPath,
86
+ verify: true,
87
+ currency: {} as any,
88
+ derivationMode: "" as any,
89
+ };
90
+
91
+ await getAddressFn(mockDeviceId, options);
92
+
93
+ expect(mockSigner.getAddress).toHaveBeenCalledWith(mockPath, true, false);
94
+ });
95
+ });
96
+
97
+ describe("address encoding", () => {
98
+ it("should encode address using eip55", async () => {
99
+ const getAddressFn = resolver(mockSignerContext);
100
+ const options: GetAddressOptions = {
101
+ path: mockPath,
102
+ verify: false,
103
+ currency: {} as any,
104
+ derivationMode: "" as any,
105
+ };
106
+
107
+ await getAddressFn(mockDeviceId, options);
108
+
109
+ expect(mockedEip55.encode).toHaveBeenCalledWith(mockSignerResponse.address);
110
+ });
111
+
112
+ it("should handle different address formats from signer", async () => {
113
+ const addresses = [
114
+ "0x742d35cc6634c0532925a3b8d0b251d8c1743ec4",
115
+ "0X742D35CC6634C0532925A3B8D0B251D8C1743EC4",
116
+ "742d35cc6634c0532925a3b8d0b251d8c1743ec4",
117
+ ];
118
+
119
+ const getAddressFn = resolver(mockSignerContext);
120
+ const options: GetAddressOptions = {
121
+ path: mockPath,
122
+ verify: false,
123
+ currency: {} as any,
124
+ derivationMode: "" as any,
125
+ };
126
+
127
+ for (const address of addresses) {
128
+ const customResponse = { ...mockSignerResponse, address };
129
+ (mockSigner.getAddress as jest.Mock).mockResolvedValueOnce(customResponse);
130
+ mockedEip55.encode.mockReturnValueOnce(`0x${address.replace(/^0x/i, "")}`);
131
+
132
+ await getAddressFn(mockDeviceId, options);
133
+
134
+ expect(mockedEip55.encode).toHaveBeenCalledWith(address);
135
+ }
136
+ });
137
+
138
+ it("should return encoded address from eip55", async () => {
139
+ const encodedAddress = "0x742d35Cc6634C0532925a3b8D0B251d8c1743eC4";
140
+ mockedEip55.encode.mockReturnValue(encodedAddress);
141
+
142
+ const getAddressFn = resolver(mockSignerContext);
143
+ const options: GetAddressOptions = {
144
+ path: mockPath,
145
+ verify: false,
146
+ currency: {} as any,
147
+ derivationMode: "" as any,
148
+ };
149
+
150
+ const result = await getAddressFn(mockDeviceId, options);
151
+
152
+ expect(result.address).toBe(encodedAddress);
153
+ });
154
+ });
155
+
156
+ describe("error handling", () => {
157
+ it("should throw error when address is empty", async () => {
158
+ const invalidResponse = { ...mockSignerResponse, address: "" };
159
+ (mockSigner.getAddress as jest.Mock).mockResolvedValue(invalidResponse);
160
+
161
+ const getAddressFn = resolver(mockSignerContext);
162
+ const options: GetAddressOptions = {
163
+ path: mockPath,
164
+ verify: false,
165
+ currency: {} as any,
166
+ derivationMode: "" as any,
167
+ };
168
+
169
+ await expect(getAddressFn(mockDeviceId, options)).rejects.toThrow(
170
+ "[vechain] Response is empty ",
171
+ );
172
+ });
173
+
174
+ it("should throw error when address is null", async () => {
175
+ const invalidResponse = { ...mockSignerResponse, address: null };
176
+ (mockSigner.getAddress as jest.Mock).mockResolvedValue(invalidResponse);
177
+
178
+ const getAddressFn = resolver(mockSignerContext);
179
+ const options: GetAddressOptions = {
180
+ path: mockPath,
181
+ verify: false,
182
+ currency: {} as any,
183
+ derivationMode: "" as any,
184
+ };
185
+
186
+ await expect(getAddressFn(mockDeviceId, options)).rejects.toThrow(
187
+ "[vechain] Response is empty null ",
188
+ );
189
+ });
190
+
191
+ it("should throw error when address is undefined", async () => {
192
+ const invalidResponse = { ...mockSignerResponse, address: undefined };
193
+ (mockSigner.getAddress as jest.Mock).mockResolvedValue(invalidResponse);
194
+
195
+ const getAddressFn = resolver(mockSignerContext);
196
+ const options: GetAddressOptions = {
197
+ path: mockPath,
198
+ verify: false,
199
+ currency: {} as any,
200
+ derivationMode: "" as any,
201
+ };
202
+
203
+ await expect(getAddressFn(mockDeviceId, options)).rejects.toThrow(
204
+ "[vechain] Response is empty undefined ",
205
+ );
206
+ });
207
+
208
+ it("should throw error when publicKey is empty", async () => {
209
+ const invalidResponse = { ...mockSignerResponse, publicKey: Buffer.alloc(0) };
210
+ (mockSigner.getAddress as jest.Mock).mockResolvedValue(invalidResponse);
211
+
212
+ const getAddressFn = resolver(mockSignerContext);
213
+ const options: GetAddressOptions = {
214
+ path: mockPath,
215
+ verify: false,
216
+ currency: {} as any,
217
+ derivationMode: "" as any,
218
+ };
219
+
220
+ await expect(getAddressFn(mockDeviceId, options)).rejects.toThrow(
221
+ "[vechain] Response is empty",
222
+ );
223
+ });
224
+
225
+ it("should handle signer errors", async () => {
226
+ const signerError = new Error("Hardware wallet error");
227
+ (mockSigner.getAddress as jest.Mock).mockRejectedValue(signerError);
228
+
229
+ const getAddressFn = resolver(mockSignerContext);
230
+ const options: GetAddressOptions = {
231
+ path: mockPath,
232
+ verify: false,
233
+ currency: {} as any,
234
+ derivationMode: "" as any,
235
+ };
236
+
237
+ await expect(getAddressFn(mockDeviceId, options)).rejects.toThrow("Hardware wallet error");
238
+ });
239
+
240
+ it("should handle signerContext errors", async () => {
241
+ const contextError = new Error("Signer context failed");
242
+ (mockSignerContext as jest.Mock).mockRejectedValue(contextError);
243
+
244
+ const getAddressFn = resolver(mockSignerContext);
245
+ const options: GetAddressOptions = {
246
+ path: mockPath,
247
+ verify: false,
248
+ currency: {} as any,
249
+ derivationMode: "" as any,
250
+ };
251
+
252
+ await expect(getAddressFn(mockDeviceId, options)).rejects.toThrow("Signer context failed");
253
+ });
254
+
255
+ it("should handle eip55 encoding errors", async () => {
256
+ // Reset the mock to not throw an error initially
257
+ (mockSigner.getAddress as jest.Mock).mockResolvedValue(mockSignerResponse);
258
+
259
+ const encodingError = new Error("Invalid address format");
260
+ mockedEip55.encode.mockImplementation(() => {
261
+ throw encodingError;
262
+ });
263
+
264
+ const getAddressFn = resolver(mockSignerContext);
265
+ const options: GetAddressOptions = {
266
+ path: mockPath,
267
+ verify: false,
268
+ currency: {} as any,
269
+ derivationMode: "" as any,
270
+ };
271
+
272
+ await expect(getAddressFn(mockDeviceId, options)).rejects.toThrow("Invalid address format");
273
+ });
274
+ });
275
+
276
+ describe("different derivation paths", () => {
277
+ it("should handle different derivation paths", async () => {
278
+ const paths = ["44'/818'/0'/0/0", "44'/818'/1'/0/0", "44'/818'/0'/0/1", "44'/818'/2'/0/5"];
279
+
280
+ const getAddressFn = resolver(mockSignerContext);
281
+
282
+ for (const path of paths) {
283
+ const options: GetAddressOptions = {
284
+ path,
285
+ verify: false,
286
+ currency: {} as any,
287
+ derivationMode: "" as any,
288
+ };
289
+ const result = await getAddressFn(mockDeviceId, options);
290
+
291
+ expect(mockSigner.getAddress).toHaveBeenCalledWith(path, false, false);
292
+ expect(result.path).toBe(path);
293
+ }
294
+ });
295
+
296
+ it("should handle empty path", async () => {
297
+ const getAddressFn = resolver(mockSignerContext);
298
+ const options: GetAddressOptions = {
299
+ path: "",
300
+ verify: false,
301
+ currency: {} as any,
302
+ derivationMode: "" as any,
303
+ };
304
+
305
+ await getAddressFn(mockDeviceId, options);
306
+
307
+ expect(mockSigner.getAddress).toHaveBeenCalledWith("", false, false);
308
+ });
309
+ });
310
+
311
+ describe("different device IDs", () => {
312
+ it("should handle different device IDs", async () => {
313
+ const deviceIds = ["device1", "device2", "device3"];
314
+ const getAddressFn = resolver(mockSignerContext);
315
+ const options: GetAddressOptions = {
316
+ path: mockPath,
317
+ verify: false,
318
+ currency: {} as any,
319
+ derivationMode: "" as any,
320
+ };
321
+
322
+ for (const deviceId of deviceIds) {
323
+ await getAddressFn(deviceId, options);
324
+ expect(mockSignerContext).toHaveBeenCalledWith(deviceId, expect.any(Function));
325
+ }
326
+ });
327
+ });
328
+
329
+ describe("publicKey handling", () => {
330
+ it("should return publicKey from signer response", async () => {
331
+ const customPublicKey = Buffer.from("abcdef1234567890", "hex"); // Valid hex with length > 0
332
+ const customResponse = { ...mockSignerResponse, publicKey: customPublicKey };
333
+ (mockSigner.getAddress as jest.Mock).mockResolvedValue(customResponse);
334
+
335
+ const getAddressFn = resolver(mockSignerContext);
336
+ const options: GetAddressOptions = {
337
+ path: mockPath,
338
+ verify: false,
339
+ currency: {} as any,
340
+ derivationMode: "" as any,
341
+ };
342
+
343
+ const result = await getAddressFn(mockDeviceId, options);
344
+
345
+ expect(result.publicKey).toBe(customPublicKey);
346
+ });
347
+
348
+ it("should handle different publicKey lengths", async () => {
349
+ const publicKeys = [
350
+ Buffer.from("12", "hex"),
351
+ Buffer.from("1234567890abcdef", "hex"),
352
+ Buffer.from("04" + "ab".repeat(32) + "cd".repeat(32), "hex"), // 65 bytes (uncompressed)
353
+ ];
354
+
355
+ const getAddressFn = resolver(mockSignerContext);
356
+ const options: GetAddressOptions = {
357
+ path: mockPath,
358
+ verify: false,
359
+ currency: {} as any,
360
+ derivationMode: "" as any,
361
+ };
362
+
363
+ for (const publicKey of publicKeys) {
364
+ const customResponse = { ...mockSignerResponse, publicKey };
365
+ (mockSigner.getAddress as jest.Mock).mockResolvedValueOnce(customResponse);
366
+
367
+ const result = await getAddressFn(mockDeviceId, options);
368
+
369
+ expect(result.publicKey).toBe(publicKey);
370
+ }
371
+ });
372
+ });
373
+
374
+ describe("verify parameter behavior", () => {
375
+ it("should pass verify parameter correctly to signer", async () => {
376
+ const getAddressFn = resolver(mockSignerContext);
377
+
378
+ // Test verify: true
379
+ await getAddressFn(mockDeviceId, {
380
+ path: mockPath,
381
+ verify: true,
382
+ currency: {} as any,
383
+ derivationMode: "" as any,
384
+ });
385
+ expect(mockSigner.getAddress).toHaveBeenLastCalledWith(mockPath, true, false);
386
+
387
+ // Test verify: false
388
+ await getAddressFn(mockDeviceId, {
389
+ path: mockPath,
390
+ verify: false,
391
+ currency: {} as any,
392
+ derivationMode: "" as any,
393
+ });
394
+ expect(mockSigner.getAddress).toHaveBeenLastCalledWith(mockPath, false, false);
395
+ });
396
+
397
+ it("should handle undefined verify parameter", async () => {
398
+ const getAddressFn = resolver(mockSignerContext);
399
+ const options = { path: mockPath } as GetAddressOptions;
400
+
401
+ await getAddressFn(mockDeviceId, options);
402
+
403
+ expect(mockSigner.getAddress).toHaveBeenCalledWith(mockPath, undefined, false);
404
+ });
405
+ });
406
+
407
+ describe("integration scenarios", () => {
408
+ it("should work with real-like addresses and public keys", async () => {
409
+ const realAddress = "0x742d35cc6634c0532925a3b8d0b251d8c1743ec4";
410
+ const realPublicKey = Buffer.from(
411
+ "04abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890ab",
412
+ "hex",
413
+ );
414
+ const realResponse = { address: realAddress, publicKey: realPublicKey };
415
+ const encodedAddress = "0x742d35Cc6634C0532925a3b8D0B251d8c1743eC4";
416
+
417
+ (mockSigner.getAddress as jest.Mock).mockResolvedValue(realResponse);
418
+ mockedEip55.encode.mockReturnValue(encodedAddress);
419
+
420
+ const getAddressFn = resolver(mockSignerContext);
421
+ const options: GetAddressOptions = {
422
+ path: "44'/818'/0'/0/0",
423
+ verify: true,
424
+ currency: {} as any,
425
+ derivationMode: "" as any,
426
+ };
427
+
428
+ const result = await getAddressFn("real-device", options);
429
+
430
+ expect(result).toEqual({
431
+ address: encodedAddress,
432
+ publicKey: realPublicKey,
433
+ path: "44'/818'/0'/0/0",
434
+ });
435
+ });
436
+
437
+ it("should maintain result structure consistency", async () => {
438
+ const getAddressFn = resolver(mockSignerContext);
439
+ const options: GetAddressOptions = {
440
+ path: mockPath,
441
+ verify: false,
442
+ currency: {} as any,
443
+ derivationMode: "" as any,
444
+ };
445
+
446
+ const result = await getAddressFn(mockDeviceId, options);
447
+
448
+ expect(result).toHaveProperty("address");
449
+ expect(result).toHaveProperty("publicKey");
450
+ expect(result).toHaveProperty("path");
451
+ expect(Object.keys(result)).toHaveLength(3);
452
+ });
453
+ });
454
+ });