@ledgerhq/coin-sui 0.16.0 → 0.17.0-nightly.1

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 (329) hide show
  1. package/.turbo/turbo-build.log +1 -1
  2. package/.unimportedrc.json +2 -1
  3. package/CHANGELOG.md +22 -0
  4. package/lib/api/index.d.ts.map +1 -1
  5. package/lib/api/index.js +1 -0
  6. package/lib/api/index.js.map +1 -1
  7. package/lib/logic/estimateFees.d.ts +4 -1
  8. package/lib/logic/estimateFees.d.ts.map +1 -1
  9. package/lib/logic/estimateFees.js +2 -1
  10. package/lib/logic/estimateFees.js.map +1 -1
  11. package/lib/logic/getValidators.d.ts +3 -0
  12. package/lib/logic/getValidators.d.ts.map +1 -0
  13. package/lib/logic/getValidators.js +24 -0
  14. package/lib/logic/getValidators.js.map +1 -0
  15. package/lib/logic/index.d.ts +1 -0
  16. package/lib/logic/index.d.ts.map +1 -1
  17. package/lib/logic/index.js +3 -1
  18. package/lib/logic/index.js.map +1 -1
  19. package/lib/network/index.d.ts +3 -2
  20. package/lib/network/index.d.ts.map +1 -1
  21. package/lib/network/index.js +3 -1
  22. package/lib/network/index.js.map +1 -1
  23. package/lib/network/sdk.d.ts +4 -1
  24. package/lib/network/sdk.d.ts.map +1 -1
  25. package/lib/network/sdk.js +54 -23
  26. package/lib/network/sdk.js.map +1 -1
  27. package/lib/{bridge/bridge.integration.test.d.ts → test/bridge.dataset.d.ts} +1 -1
  28. package/lib/test/bridge.dataset.d.ts.map +1 -0
  29. package/lib/{bridge/bridge.integration.test.js → test/bridge.dataset.js} +2 -2
  30. package/lib/test/bridge.dataset.js.map +1 -0
  31. package/lib-es/api/index.d.ts.map +1 -1
  32. package/lib-es/api/index.js +2 -1
  33. package/lib-es/api/index.js.map +1 -1
  34. package/lib-es/logic/estimateFees.d.ts +4 -1
  35. package/lib-es/logic/estimateFees.d.ts.map +1 -1
  36. package/lib-es/logic/estimateFees.js +2 -1
  37. package/lib-es/logic/estimateFees.js.map +1 -1
  38. package/lib-es/logic/getValidators.d.ts +3 -0
  39. package/lib-es/logic/getValidators.d.ts.map +1 -0
  40. package/lib-es/logic/getValidators.js +20 -0
  41. package/lib-es/logic/getValidators.js.map +1 -0
  42. package/lib-es/logic/index.d.ts +1 -0
  43. package/lib-es/logic/index.d.ts.map +1 -1
  44. package/lib-es/logic/index.js +1 -0
  45. package/lib-es/logic/index.js.map +1 -1
  46. package/lib-es/network/index.d.ts +3 -2
  47. package/lib-es/network/index.d.ts.map +1 -1
  48. package/lib-es/network/index.js +3 -2
  49. package/lib-es/network/index.js.map +1 -1
  50. package/lib-es/network/sdk.d.ts +4 -1
  51. package/lib-es/network/sdk.d.ts.map +1 -1
  52. package/lib-es/network/sdk.js +52 -22
  53. package/lib-es/network/sdk.js.map +1 -1
  54. package/lib-es/{bridge/bridge.integration.test.d.ts → test/bridge.dataset.d.ts} +1 -1
  55. package/lib-es/test/bridge.dataset.d.ts.map +1 -0
  56. package/lib-es/{bridge/bridge.integration.test.js → test/bridge.dataset.js} +2 -2
  57. package/lib-es/test/bridge.dataset.js.map +1 -0
  58. package/package.json +5 -9
  59. package/src/api/index.integration.test.ts +80 -7
  60. package/src/api/index.ts +2 -0
  61. package/src/logic/estimateFees.test.ts +22 -16
  62. package/src/logic/estimateFees.ts +6 -1
  63. package/src/logic/getValidators.test.ts +92 -0
  64. package/src/logic/getValidators.ts +23 -0
  65. package/src/logic/index.ts +1 -0
  66. package/src/network/index.ts +3 -0
  67. package/src/network/sdk.test.ts +134 -60
  68. package/src/network/sdk.ts +58 -23
  69. package/src/{bridge/bridge.integration.test.ts → test/bridge.dataset.ts} +1 -1
  70. package/lib/api/index.integration.test.d.ts +0 -2
  71. package/lib/api/index.integration.test.d.ts.map +0 -1
  72. package/lib/api/index.integration.test.js +0 -173
  73. package/lib/api/index.integration.test.js.map +0 -1
  74. package/lib/api/index.test.d.ts +0 -2
  75. package/lib/api/index.test.d.ts.map +0 -1
  76. package/lib/api/index.test.js +0 -173
  77. package/lib/api/index.test.js.map +0 -1
  78. package/lib/bridge/bridge.integration.test.d.ts.map +0 -1
  79. package/lib/bridge/bridge.integration.test.js.map +0 -1
  80. package/lib/bridge/broadcast.test.d.ts +0 -2
  81. package/lib/bridge/broadcast.test.d.ts.map +0 -1
  82. package/lib/bridge/broadcast.test.js +0 -48
  83. package/lib/bridge/broadcast.test.js.map +0 -1
  84. package/lib/bridge/buildOptimisticOperation.test.d.ts +0 -2
  85. package/lib/bridge/buildOptimisticOperation.test.d.ts.map +0 -1
  86. package/lib/bridge/buildOptimisticOperation.test.js +0 -52
  87. package/lib/bridge/buildOptimisticOperation.test.js.map +0 -1
  88. package/lib/bridge/buildTransaction.integration.test.d.ts +0 -2
  89. package/lib/bridge/buildTransaction.integration.test.d.ts.map +0 -1
  90. package/lib/bridge/buildTransaction.integration.test.js +0 -72
  91. package/lib/bridge/buildTransaction.integration.test.js.map +0 -1
  92. package/lib/bridge/buildTransaction.test.d.ts +0 -2
  93. package/lib/bridge/buildTransaction.test.d.ts.map +0 -1
  94. package/lib/bridge/buildTransaction.test.js +0 -231
  95. package/lib/bridge/buildTransaction.test.js.map +0 -1
  96. package/lib/bridge/estimateMaxSpendable.test.d.ts +0 -2
  97. package/lib/bridge/estimateMaxSpendable.test.d.ts.map +0 -1
  98. package/lib/bridge/estimateMaxSpendable.test.js +0 -52
  99. package/lib/bridge/estimateMaxSpendable.test.js.map +0 -1
  100. package/lib/bridge/formatters.test.d.ts +0 -2
  101. package/lib/bridge/formatters.test.d.ts.map +0 -1
  102. package/lib/bridge/formatters.test.js +0 -18
  103. package/lib/bridge/formatters.test.js.map +0 -1
  104. package/lib/bridge/getFeesForTransaction.test.d.ts +0 -2
  105. package/lib/bridge/getFeesForTransaction.test.d.ts.map +0 -1
  106. package/lib/bridge/getFeesForTransaction.test.js +0 -35
  107. package/lib/bridge/getFeesForTransaction.test.js.map +0 -1
  108. package/lib/bridge/getTransactionStatus.test.d.ts +0 -2
  109. package/lib/bridge/getTransactionStatus.test.d.ts.map +0 -1
  110. package/lib/bridge/getTransactionStatus.test.js +0 -69
  111. package/lib/bridge/getTransactionStatus.test.js.map +0 -1
  112. package/lib/bridge/index.test.d.ts +0 -2
  113. package/lib/bridge/index.test.d.ts.map +0 -1
  114. package/lib/bridge/index.test.js +0 -265
  115. package/lib/bridge/index.test.js.map +0 -1
  116. package/lib/bridge/preload.test.d.ts +0 -2
  117. package/lib/bridge/preload.test.d.ts.map +0 -1
  118. package/lib/bridge/preload.test.js +0 -52
  119. package/lib/bridge/preload.test.js.map +0 -1
  120. package/lib/bridge/prepareTransaction.test.d.ts +0 -2
  121. package/lib/bridge/prepareTransaction.test.d.ts.map +0 -1
  122. package/lib/bridge/prepareTransaction.test.js +0 -97
  123. package/lib/bridge/prepareTransaction.test.js.map +0 -1
  124. package/lib/bridge/serialization.test.d.ts +0 -2
  125. package/lib/bridge/serialization.test.d.ts.map +0 -1
  126. package/lib/bridge/serialization.test.js +0 -131
  127. package/lib/bridge/serialization.test.js.map +0 -1
  128. package/lib/bridge/signOperation.integration.test.d.ts +0 -2
  129. package/lib/bridge/signOperation.integration.test.d.ts.map +0 -1
  130. package/lib/bridge/signOperation.integration.test.js +0 -80
  131. package/lib/bridge/signOperation.integration.test.js.map +0 -1
  132. package/lib/bridge/signOperation.test.d.ts +0 -2
  133. package/lib/bridge/signOperation.test.d.ts.map +0 -1
  134. package/lib/bridge/signOperation.test.js +0 -445
  135. package/lib/bridge/signOperation.test.js.map +0 -1
  136. package/lib/bridge/synchronisation.test.d.ts +0 -2
  137. package/lib/bridge/synchronisation.test.d.ts.map +0 -1
  138. package/lib/bridge/synchronisation.test.js +0 -505
  139. package/lib/bridge/synchronisation.test.js.map +0 -1
  140. package/lib/bridge/transaction.test.d.ts +0 -2
  141. package/lib/bridge/transaction.test.d.ts.map +0 -1
  142. package/lib/bridge/transaction.test.js +0 -68
  143. package/lib/bridge/transaction.test.js.map +0 -1
  144. package/lib/logic/broadcast.test.d.ts +0 -2
  145. package/lib/logic/broadcast.test.d.ts.map +0 -1
  146. package/lib/logic/broadcast.test.js +0 -62
  147. package/lib/logic/broadcast.test.js.map +0 -1
  148. package/lib/logic/combine.test.d.ts +0 -2
  149. package/lib/logic/combine.test.d.ts.map +0 -1
  150. package/lib/logic/combine.test.js +0 -37
  151. package/lib/logic/combine.test.js.map +0 -1
  152. package/lib/logic/craftTransaction.integration.test.d.ts +0 -2
  153. package/lib/logic/craftTransaction.integration.test.d.ts.map +0 -1
  154. package/lib/logic/craftTransaction.integration.test.js +0 -98
  155. package/lib/logic/craftTransaction.integration.test.js.map +0 -1
  156. package/lib/logic/craftTransaction.test.d.ts +0 -2
  157. package/lib/logic/craftTransaction.test.d.ts.map +0 -1
  158. package/lib/logic/craftTransaction.test.js +0 -127
  159. package/lib/logic/craftTransaction.test.js.map +0 -1
  160. package/lib/logic/estimateFees.integration.test.d.ts +0 -2
  161. package/lib/logic/estimateFees.integration.test.d.ts.map +0 -1
  162. package/lib/logic/estimateFees.integration.test.js +0 -82
  163. package/lib/logic/estimateFees.integration.test.js.map +0 -1
  164. package/lib/logic/estimateFees.test.d.ts +0 -2
  165. package/lib/logic/estimateFees.test.d.ts.map +0 -1
  166. package/lib/logic/estimateFees.test.js +0 -70
  167. package/lib/logic/estimateFees.test.js.map +0 -1
  168. package/lib/logic/getBalance.integration.test.d.ts +0 -2
  169. package/lib/logic/getBalance.integration.test.d.ts.map +0 -1
  170. package/lib/logic/getBalance.integration.test.js +0 -56
  171. package/lib/logic/getBalance.integration.test.js.map +0 -1
  172. package/lib/logic/getBalance.test.d.ts +0 -2
  173. package/lib/logic/getBalance.test.d.ts.map +0 -1
  174. package/lib/logic/getBalance.test.js +0 -64
  175. package/lib/logic/getBalance.test.js.map +0 -1
  176. package/lib/logic/lastBlock.test.d.ts +0 -2
  177. package/lib/logic/lastBlock.test.d.ts.map +0 -1
  178. package/lib/logic/lastBlock.test.js +0 -27
  179. package/lib/logic/lastBlock.test.js.map +0 -1
  180. package/lib/logic/listOperations.test.d.ts +0 -2
  181. package/lib/logic/listOperations.test.d.ts.map +0 -1
  182. package/lib/logic/listOperations.test.js +0 -79
  183. package/lib/logic/listOperations.test.js.map +0 -1
  184. package/lib/network/sdk.integration.test.d.ts +0 -2
  185. package/lib/network/sdk.integration.test.d.ts.map +0 -1
  186. package/lib/network/sdk.integration.test.js +0 -215
  187. package/lib/network/sdk.integration.test.js.map +0 -1
  188. package/lib/network/sdk.test.d.ts +0 -2
  189. package/lib/network/sdk.test.d.ts.map +0 -1
  190. package/lib/network/sdk.test.js +0 -1784
  191. package/lib/network/sdk.test.js.map +0 -1
  192. package/lib/signer/getAddress.test.d.ts +0 -2
  193. package/lib/signer/getAddress.test.d.ts.map +0 -1
  194. package/lib/signer/getAddress.test.js +0 -106
  195. package/lib/signer/getAddress.test.js.map +0 -1
  196. package/lib/test/config.test.d.ts +0 -2
  197. package/lib/test/config.test.d.ts.map +0 -1
  198. package/lib/test/config.test.js +0 -44
  199. package/lib/test/config.test.js.map +0 -1
  200. package/lib-es/api/index.integration.test.d.ts +0 -2
  201. package/lib-es/api/index.integration.test.d.ts.map +0 -1
  202. package/lib-es/api/index.integration.test.js +0 -171
  203. package/lib-es/api/index.integration.test.js.map +0 -1
  204. package/lib-es/api/index.test.d.ts +0 -2
  205. package/lib-es/api/index.test.d.ts.map +0 -1
  206. package/lib-es/api/index.test.js +0 -148
  207. package/lib-es/api/index.test.js.map +0 -1
  208. package/lib-es/bridge/bridge.integration.test.d.ts.map +0 -1
  209. package/lib-es/bridge/bridge.integration.test.js.map +0 -1
  210. package/lib-es/bridge/broadcast.test.d.ts +0 -2
  211. package/lib-es/bridge/broadcast.test.d.ts.map +0 -1
  212. package/lib-es/bridge/broadcast.test.js +0 -46
  213. package/lib-es/bridge/broadcast.test.js.map +0 -1
  214. package/lib-es/bridge/buildOptimisticOperation.test.d.ts +0 -2
  215. package/lib-es/bridge/buildOptimisticOperation.test.d.ts.map +0 -1
  216. package/lib-es/bridge/buildOptimisticOperation.test.js +0 -47
  217. package/lib-es/bridge/buildOptimisticOperation.test.js.map +0 -1
  218. package/lib-es/bridge/buildTransaction.integration.test.d.ts +0 -2
  219. package/lib-es/bridge/buildTransaction.integration.test.d.ts.map +0 -1
  220. package/lib-es/bridge/buildTransaction.integration.test.js +0 -67
  221. package/lib-es/bridge/buildTransaction.integration.test.js.map +0 -1
  222. package/lib-es/bridge/buildTransaction.test.d.ts +0 -2
  223. package/lib-es/bridge/buildTransaction.test.d.ts.map +0 -1
  224. package/lib-es/bridge/buildTransaction.test.js +0 -229
  225. package/lib-es/bridge/buildTransaction.test.js.map +0 -1
  226. package/lib-es/bridge/estimateMaxSpendable.test.d.ts +0 -2
  227. package/lib-es/bridge/estimateMaxSpendable.test.d.ts.map +0 -1
  228. package/lib-es/bridge/estimateMaxSpendable.test.js +0 -50
  229. package/lib-es/bridge/estimateMaxSpendable.test.js.map +0 -1
  230. package/lib-es/bridge/formatters.test.d.ts +0 -2
  231. package/lib-es/bridge/formatters.test.d.ts.map +0 -1
  232. package/lib-es/bridge/formatters.test.js +0 -16
  233. package/lib-es/bridge/formatters.test.js.map +0 -1
  234. package/lib-es/bridge/getFeesForTransaction.test.d.ts +0 -2
  235. package/lib-es/bridge/getFeesForTransaction.test.d.ts.map +0 -1
  236. package/lib-es/bridge/getFeesForTransaction.test.js +0 -30
  237. package/lib-es/bridge/getFeesForTransaction.test.js.map +0 -1
  238. package/lib-es/bridge/getTransactionStatus.test.d.ts +0 -2
  239. package/lib-es/bridge/getTransactionStatus.test.d.ts.map +0 -1
  240. package/lib-es/bridge/getTransactionStatus.test.js +0 -64
  241. package/lib-es/bridge/getTransactionStatus.test.js.map +0 -1
  242. package/lib-es/bridge/index.test.d.ts +0 -2
  243. package/lib-es/bridge/index.test.d.ts.map +0 -1
  244. package/lib-es/bridge/index.test.js +0 -260
  245. package/lib-es/bridge/index.test.js.map +0 -1
  246. package/lib-es/bridge/preload.test.d.ts +0 -2
  247. package/lib-es/bridge/preload.test.d.ts.map +0 -1
  248. package/lib-es/bridge/preload.test.js +0 -50
  249. package/lib-es/bridge/preload.test.js.map +0 -1
  250. package/lib-es/bridge/prepareTransaction.test.d.ts +0 -2
  251. package/lib-es/bridge/prepareTransaction.test.d.ts.map +0 -1
  252. package/lib-es/bridge/prepareTransaction.test.js +0 -92
  253. package/lib-es/bridge/prepareTransaction.test.js.map +0 -1
  254. package/lib-es/bridge/serialization.test.d.ts +0 -2
  255. package/lib-es/bridge/serialization.test.d.ts.map +0 -1
  256. package/lib-es/bridge/serialization.test.js +0 -126
  257. package/lib-es/bridge/serialization.test.js.map +0 -1
  258. package/lib-es/bridge/signOperation.integration.test.d.ts +0 -2
  259. package/lib-es/bridge/signOperation.integration.test.d.ts.map +0 -1
  260. package/lib-es/bridge/signOperation.integration.test.js +0 -75
  261. package/lib-es/bridge/signOperation.integration.test.js.map +0 -1
  262. package/lib-es/bridge/signOperation.test.d.ts +0 -2
  263. package/lib-es/bridge/signOperation.test.d.ts.map +0 -1
  264. package/lib-es/bridge/signOperation.test.js +0 -440
  265. package/lib-es/bridge/signOperation.test.js.map +0 -1
  266. package/lib-es/bridge/synchronisation.test.d.ts +0 -2
  267. package/lib-es/bridge/synchronisation.test.d.ts.map +0 -1
  268. package/lib-es/bridge/synchronisation.test.js +0 -477
  269. package/lib-es/bridge/synchronisation.test.js.map +0 -1
  270. package/lib-es/bridge/transaction.test.d.ts +0 -2
  271. package/lib-es/bridge/transaction.test.d.ts.map +0 -1
  272. package/lib-es/bridge/transaction.test.js +0 -66
  273. package/lib-es/bridge/transaction.test.js.map +0 -1
  274. package/lib-es/logic/broadcast.test.d.ts +0 -2
  275. package/lib-es/logic/broadcast.test.d.ts.map +0 -1
  276. package/lib-es/logic/broadcast.test.js +0 -57
  277. package/lib-es/logic/broadcast.test.js.map +0 -1
  278. package/lib-es/logic/combine.test.d.ts +0 -2
  279. package/lib-es/logic/combine.test.d.ts.map +0 -1
  280. package/lib-es/logic/combine.test.js +0 -35
  281. package/lib-es/logic/combine.test.js.map +0 -1
  282. package/lib-es/logic/craftTransaction.integration.test.d.ts +0 -2
  283. package/lib-es/logic/craftTransaction.integration.test.d.ts.map +0 -1
  284. package/lib-es/logic/craftTransaction.integration.test.js +0 -93
  285. package/lib-es/logic/craftTransaction.integration.test.js.map +0 -1
  286. package/lib-es/logic/craftTransaction.test.d.ts +0 -2
  287. package/lib-es/logic/craftTransaction.test.d.ts.map +0 -1
  288. package/lib-es/logic/craftTransaction.test.js +0 -122
  289. package/lib-es/logic/craftTransaction.test.js.map +0 -1
  290. package/lib-es/logic/estimateFees.integration.test.d.ts +0 -2
  291. package/lib-es/logic/estimateFees.integration.test.d.ts.map +0 -1
  292. package/lib-es/logic/estimateFees.integration.test.js +0 -77
  293. package/lib-es/logic/estimateFees.integration.test.js.map +0 -1
  294. package/lib-es/logic/estimateFees.test.d.ts +0 -2
  295. package/lib-es/logic/estimateFees.test.d.ts.map +0 -1
  296. package/lib-es/logic/estimateFees.test.js +0 -65
  297. package/lib-es/logic/estimateFees.test.js.map +0 -1
  298. package/lib-es/logic/getBalance.integration.test.d.ts +0 -2
  299. package/lib-es/logic/getBalance.integration.test.d.ts.map +0 -1
  300. package/lib-es/logic/getBalance.integration.test.js +0 -51
  301. package/lib-es/logic/getBalance.integration.test.js.map +0 -1
  302. package/lib-es/logic/getBalance.test.d.ts +0 -2
  303. package/lib-es/logic/getBalance.test.d.ts.map +0 -1
  304. package/lib-es/logic/getBalance.test.js +0 -62
  305. package/lib-es/logic/getBalance.test.js.map +0 -1
  306. package/lib-es/logic/lastBlock.test.d.ts +0 -2
  307. package/lib-es/logic/lastBlock.test.d.ts.map +0 -1
  308. package/lib-es/logic/lastBlock.test.js +0 -25
  309. package/lib-es/logic/lastBlock.test.js.map +0 -1
  310. package/lib-es/logic/listOperations.test.d.ts +0 -2
  311. package/lib-es/logic/listOperations.test.d.ts.map +0 -1
  312. package/lib-es/logic/listOperations.test.js +0 -77
  313. package/lib-es/logic/listOperations.test.js.map +0 -1
  314. package/lib-es/network/sdk.integration.test.d.ts +0 -2
  315. package/lib-es/network/sdk.integration.test.d.ts.map +0 -1
  316. package/lib-es/network/sdk.integration.test.js +0 -210
  317. package/lib-es/network/sdk.integration.test.js.map +0 -1
  318. package/lib-es/network/sdk.test.d.ts +0 -2
  319. package/lib-es/network/sdk.test.d.ts.map +0 -1
  320. package/lib-es/network/sdk.test.js +0 -1756
  321. package/lib-es/network/sdk.test.js.map +0 -1
  322. package/lib-es/signer/getAddress.test.d.ts +0 -2
  323. package/lib-es/signer/getAddress.test.d.ts.map +0 -1
  324. package/lib-es/signer/getAddress.test.js +0 -101
  325. package/lib-es/signer/getAddress.test.js.map +0 -1
  326. package/lib-es/test/config.test.d.ts +0 -2
  327. package/lib-es/test/config.test.d.ts.map +0 -1
  328. package/lib-es/test/config.test.js +0 -39
  329. package/lib-es/test/config.test.js.map +0 -1
@@ -1,265 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const bignumber_js_1 = require("bignumber.js");
7
- const index_1 = require("./index");
8
- const config_1 = __importDefault(require("../config"));
9
- const signer_1 = __importDefault(require("../signer"));
10
- const signOperation_1 = require("./signOperation");
11
- const synchronisation_1 = require("./synchronisation");
12
- const broadcast_1 = require("./broadcast");
13
- const createTransaction_1 = require("./createTransaction");
14
- const estimateMaxSpendable_1 = require("./estimateMaxSpendable");
15
- const getTransactionStatus_1 = require("./getTransactionStatus");
16
- const preload_1 = require("./preload");
17
- const prepareTransaction_1 = require("./prepareTransaction");
18
- const serialization_1 = require("./serialization");
19
- const formatters_1 = require("./formatters");
20
- // Mock all dependencies
21
- jest.mock("../config");
22
- jest.mock("../signer");
23
- jest.mock("./signOperation");
24
- jest.mock("./synchronisation");
25
- jest.mock("./broadcast");
26
- jest.mock("./createTransaction");
27
- jest.mock("./estimateMaxSpendable");
28
- jest.mock("./getTransactionStatus");
29
- jest.mock("./preload");
30
- jest.mock("./prepareTransaction");
31
- jest.mock("./serialization");
32
- jest.mock("./formatters");
33
- const mockSuiConfig = config_1.default;
34
- const mockSignerGetAddress = signer_1.default;
35
- const mockBuildSignOperation = signOperation_1.buildSignOperation;
36
- const mockGetAccountShape = synchronisation_1.getAccountShape;
37
- const mockSync = synchronisation_1.sync;
38
- const mockBroadcast = broadcast_1.broadcast;
39
- const mockCreateTransaction = createTransaction_1.createTransaction;
40
- const mockEstimateMaxSpendable = estimateMaxSpendable_1.estimateMaxSpendable;
41
- const mockGetTransactionStatus = getTransactionStatus_1.getTransactionStatus;
42
- const mockGetPreloadStrategy = preload_1.getPreloadStrategy;
43
- const mockHydrate = preload_1.hydrate;
44
- const mockPreload = preload_1.preload;
45
- const mockPrepareTransaction = prepareTransaction_1.prepareTransaction;
46
- const mockAssignFromAccountRaw = serialization_1.assignFromAccountRaw;
47
- const mockAssignToAccountRaw = serialization_1.assignToAccountRaw;
48
- const mockFromOperationExtraRaw = formatters_1.fromOperationExtraRaw;
49
- const mockToOperationExtraRaw = formatters_1.toOperationExtraRaw;
50
- describe("bridge/index", () => {
51
- let mockSignerContext;
52
- let mockCoinConfig;
53
- let mockCurrency;
54
- beforeEach(() => {
55
- jest.clearAllMocks();
56
- // Setup mock signer context
57
- mockSignerContext = jest.fn();
58
- // Setup mock coin config as a function
59
- mockCoinConfig = jest.fn(() => ({
60
- node: { url: "http://localhost:1234" },
61
- status: { type: "active" },
62
- }));
63
- // Setup mock currency
64
- mockCurrency = {
65
- id: "sui",
66
- name: "Sui",
67
- family: "sui",
68
- units: [],
69
- type: "CryptoCurrency",
70
- ticker: "SUI",
71
- managerAppName: "Sui",
72
- coinType: 784,
73
- scheme: "sui",
74
- color: "#000000",
75
- explorerViews: [],
76
- };
77
- // Setup mock functions
78
- mockSignerGetAddress.mockReturnValue(jest.fn());
79
- mockBuildSignOperation.mockReturnValue(jest.fn());
80
- mockGetAccountShape.mockResolvedValue({});
81
- mockSync.mockReturnValue({});
82
- mockBroadcast.mockResolvedValue({});
83
- mockCreateTransaction.mockReturnValue({});
84
- mockEstimateMaxSpendable.mockResolvedValue(new bignumber_js_1.BigNumber("1000000"));
85
- mockGetTransactionStatus.mockReturnValue({});
86
- mockGetPreloadStrategy.mockReturnValue({});
87
- mockHydrate.mockReturnValue(undefined);
88
- mockPreload.mockResolvedValue({});
89
- mockPrepareTransaction.mockResolvedValue({});
90
- mockAssignFromAccountRaw.mockReturnValue(undefined);
91
- mockAssignToAccountRaw.mockReturnValue(undefined);
92
- mockFromOperationExtraRaw.mockReturnValue({});
93
- mockToOperationExtraRaw.mockReturnValue({});
94
- });
95
- describe("createBridges", () => {
96
- it("should set coin config and return bridges", () => {
97
- const result = (0, index_1.createBridges)(mockSignerContext, mockCoinConfig);
98
- expect(mockSuiConfig.setCoinConfig).toHaveBeenCalledWith(mockCoinConfig);
99
- expect(result).toHaveProperty("currencyBridge");
100
- expect(result).toHaveProperty("accountBridge");
101
- expect(typeof result.currencyBridge).toBe("object");
102
- expect(typeof result.accountBridge).toBe("object");
103
- });
104
- it("should call signerGetAddress with signer context", () => {
105
- (0, index_1.createBridges)(mockSignerContext, mockCoinConfig);
106
- expect(mockSignerGetAddress).toHaveBeenCalledWith(mockSignerContext);
107
- });
108
- it("should call buildSignOperation with signer context", () => {
109
- (0, index_1.createBridges)(mockSignerContext, mockCoinConfig);
110
- expect(mockBuildSignOperation).toHaveBeenCalledWith(mockSignerContext);
111
- });
112
- });
113
- describe("currencyBridge", () => {
114
- let currencyBridge;
115
- beforeEach(() => {
116
- const bridges = (0, index_1.createBridges)(mockSignerContext, mockCoinConfig);
117
- currencyBridge = bridges.currencyBridge;
118
- });
119
- it("should have all required currency bridge methods", () => {
120
- expect(currencyBridge).toHaveProperty("getPreloadStrategy");
121
- expect(currencyBridge).toHaveProperty("preload");
122
- expect(currencyBridge).toHaveProperty("hydrate");
123
- expect(currencyBridge).toHaveProperty("scanAccounts");
124
- });
125
- it("should return getPreloadStrategy from preload module", () => {
126
- const strategy = currencyBridge.getPreloadStrategy?.(mockCurrency);
127
- expect(mockGetPreloadStrategy).toHaveBeenCalled();
128
- expect(strategy).toBeDefined();
129
- });
130
- it("should return preload from preload module", async () => {
131
- const result = await currencyBridge.preload(mockCurrency);
132
- expect(mockPreload).toHaveBeenCalled();
133
- expect(result).toBeDefined();
134
- });
135
- it("should return hydrate from preload module", () => {
136
- const data = { some: "data" };
137
- currencyBridge.hydrate(data, mockCurrency);
138
- expect(mockHydrate).toHaveBeenCalledWith(data, mockCurrency);
139
- });
140
- it("should have scanAccounts function", () => {
141
- expect(typeof currencyBridge.scanAccounts).toBe("function");
142
- });
143
- });
144
- describe("accountBridge", () => {
145
- let accountBridge;
146
- beforeEach(() => {
147
- const bridges = (0, index_1.createBridges)(mockSignerContext, mockCoinConfig);
148
- accountBridge = bridges.accountBridge;
149
- });
150
- it("should have all required account bridge methods", () => {
151
- const expectedMethods = [
152
- "estimateMaxSpendable",
153
- "createTransaction",
154
- "updateTransaction",
155
- "getTransactionStatus",
156
- "prepareTransaction",
157
- "sync",
158
- "receive",
159
- "signOperation",
160
- "broadcast",
161
- "assignFromAccountRaw",
162
- "assignToAccountRaw",
163
- "fromOperationExtraRaw",
164
- "toOperationExtraRaw",
165
- "getSerializedAddressParameters",
166
- ];
167
- expectedMethods.forEach(method => {
168
- expect(accountBridge).toHaveProperty(method);
169
- });
170
- });
171
- it("should call estimateMaxSpendable from estimateMaxSpendable module", async () => {
172
- const account = {};
173
- const transaction = {};
174
- const result = await accountBridge.estimateMaxSpendable({ account, transaction });
175
- expect(mockEstimateMaxSpendable).toHaveBeenCalledWith({ account, transaction });
176
- expect(result).toBeDefined();
177
- });
178
- it("should call createTransaction from createTransaction module", () => {
179
- const account = {};
180
- const result = accountBridge.createTransaction(account);
181
- expect(mockCreateTransaction).toHaveBeenCalledWith(account);
182
- expect(result).toBeDefined();
183
- });
184
- it("should call getTransactionStatus from getTransactionStatus module", () => {
185
- const transaction = {};
186
- const result = accountBridge.getTransactionStatus({}, transaction);
187
- expect(mockGetTransactionStatus).toHaveBeenCalledWith({}, transaction);
188
- expect(result).toBeDefined();
189
- });
190
- it("should call prepareTransaction from prepareTransaction module", async () => {
191
- const account = {};
192
- const transaction = {};
193
- const result = await accountBridge.prepareTransaction(account, transaction);
194
- expect(mockPrepareTransaction).toHaveBeenCalledWith(account, transaction);
195
- expect(result).toBeDefined();
196
- });
197
- it("should call sync from synchronisation module", () => {
198
- const account = {};
199
- const result = accountBridge.sync(account, { paginationConfig: {} });
200
- expect(mockSync).toHaveBeenCalledWith(account, { paginationConfig: {} });
201
- expect(result).toBeDefined();
202
- });
203
- it("should call broadcast from broadcast module", async () => {
204
- const account = {};
205
- const signedOperation = {};
206
- const result = await accountBridge.broadcast({ account, signedOperation });
207
- expect(mockBroadcast).toHaveBeenCalledWith({ account, signedOperation });
208
- expect(result).toBeDefined();
209
- });
210
- it("should call assignFromAccountRaw from serialization module", () => {
211
- const accountRaw = {};
212
- const account = {};
213
- accountBridge.assignFromAccountRaw?.(accountRaw, account);
214
- expect(mockAssignFromAccountRaw).toHaveBeenCalledWith(accountRaw, account);
215
- });
216
- it("should call assignToAccountRaw from serialization module", () => {
217
- const account = {};
218
- const accountRaw = {};
219
- accountBridge.assignToAccountRaw?.(account, accountRaw);
220
- expect(mockAssignToAccountRaw).toHaveBeenCalledWith(account, accountRaw);
221
- });
222
- it("should call fromOperationExtraRaw from formatters module", () => {
223
- const operationExtraRaw = {};
224
- const result = accountBridge.fromOperationExtraRaw?.(operationExtraRaw);
225
- expect(mockFromOperationExtraRaw).toHaveBeenCalledWith(operationExtraRaw);
226
- expect(result).toBeDefined();
227
- });
228
- it("should call toOperationExtraRaw from formatters module", () => {
229
- const operationExtra = {};
230
- const result = accountBridge.toOperationExtraRaw?.(operationExtra);
231
- expect(mockToOperationExtraRaw).toHaveBeenCalledWith(operationExtra);
232
- expect(result).toBeDefined();
233
- });
234
- it("should have receive function", () => {
235
- expect(typeof accountBridge.receive).toBe("function");
236
- });
237
- it("should have signOperation function", () => {
238
- expect(typeof accountBridge.signOperation).toBe("function");
239
- });
240
- it("should have updateTransaction function", () => {
241
- expect(typeof accountBridge.updateTransaction).toBe("function");
242
- });
243
- it("should have getSerializedAddressParameters function", () => {
244
- expect(typeof accountBridge.getSerializedAddressParameters).toBe("function");
245
- });
246
- });
247
- describe("error handling", () => {
248
- it("should handle errors in createBridges gracefully", () => {
249
- mockSuiConfig.setCoinConfig.mockImplementation(() => {
250
- throw new Error("Config error");
251
- });
252
- expect(() => (0, index_1.createBridges)(mockSignerContext, mockCoinConfig)).toThrow("Config error");
253
- });
254
- it("should handle errors in signerGetAddress gracefully", () => {
255
- // Reset the mock to clear previous error
256
- mockSuiConfig.setCoinConfig.mockReset();
257
- mockSuiConfig.setCoinConfig.mockImplementation(() => { });
258
- mockSignerGetAddress.mockImplementation(() => {
259
- throw new Error("Signer error");
260
- });
261
- expect(() => (0, index_1.createBridges)(mockSignerContext, mockCoinConfig)).toThrow("Signer error");
262
- });
263
- });
264
- });
265
- //# sourceMappingURL=index.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.test.js","sourceRoot":"","sources":["../../src/bridge/index.test.ts"],"names":[],"mappings":";;;;;AAAA,+CAAyC;AACzC,mCAAwC;AACxC,uDAAkC;AAClC,uDAAyC;AACzC,mDAAqD;AACrD,uDAA0D;AAC1D,2CAAwC;AACxC,2DAAwD;AACxD,iEAA8D;AAC9D,iEAA8D;AAC9D,uCAAiE;AACjE,6DAA0D;AAC1D,mDAA2E;AAC3E,6CAA0E;AAQ1E,wBAAwB;AACxB,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;AACvB,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;AACvB,IAAI,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;AAC7B,IAAI,CAAC,IAAI,CAAC,mBAAmB,CAAC,C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C,CAAC,CAAC;QAEH,EAAE,CAAC,qDAAqD,EAAE,GAAG,EAAE;YAC7D,MAAM,CAAC,OAAO,aAAa,CAAC,8BAA8B,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC/E,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,gBAAgB,EAAE,GAAG,EAAE;QAC9B,EAAE,CAAC,kDAAkD,EAAE,GAAG,EAAE;YAC1D,aAAa,CAAC,aAAa,CAAC,kBAAkB,CAAC,GAAG,EAAE;gBAClD,MAAM,IAAI,KAAK,CAAC,cAAc,CAAC,CAAC;YAClC,CAAC,CAAC,CAAC;YAEH,MAAM,CAAC,GAAG,EAAE,CAAC,IAAA,qBAAa,EAAC,iBAAiB,EAAE,cAAc,CAAC,CAAC,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;QACzF,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,qDAAqD,EAAE,GAAG,EAAE;YAC7D,yCAAyC;YACzC,aAAa,CAAC,aAAa,CAAC,SAAS,EAAE,CAAC;YACxC,aAAa,CAAC,aAAa,CAAC,kBAAkB,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;YAEzD,oBAAoB,CAAC,kBAAkB,CAAC,GAAG,EAAE;gBAC3C,MAAM,IAAI,KAAK,CAAC,cAAc,CAAC,CAAC;YAClC,CAAC,CAAC,CAAC;YAEH,MAAM,CAAC,GAAG,EAAE,CAAC,IAAA,qBAAa,EAAC,iBAAiB,EAAE,cAAc,CAAC,CAAC,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;QACzF,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=preload.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"preload.test.d.ts","sourceRoot":"","sources":["../../src/bridge/preload.test.ts"],"names":[],"mappings":""}
@@ -1,52 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const rxjs_1 = require("rxjs");
4
- const operators_1 = require("rxjs/operators");
5
- const preload_1 = require("./preload");
6
- // Mock the log function
7
- jest.mock("@ledgerhq/logs", () => ({
8
- log: jest.fn(),
9
- }));
10
- describe("Sui Preload Functions", () => {
11
- beforeEach(() => {
12
- // Reset the preload data before each test
13
- (0, preload_1.setSuiPreloadData)({ validators: [], tokens: [] });
14
- });
15
- describe("getCurrentSuiPreloadData", () => {
16
- it("should return the current preloaded data", () => {
17
- const testData = { validators: [], tokens: [] };
18
- (0, preload_1.setSuiPreloadData)(testData);
19
- const data = (0, preload_1.getCurrentSuiPreloadData)();
20
- expect(data).toEqual(testData);
21
- });
22
- });
23
- describe("getSuiPreloadDataUpdates", () => {
24
- it("should return an Observable", () => {
25
- const updates = (0, preload_1.getSuiPreloadDataUpdates)();
26
- expect(updates).toBeInstanceOf(rxjs_1.Observable);
27
- });
28
- it("should emit updates when data is set", done => {
29
- const testData = { validators: [], tokens: [] };
30
- const updates = (0, preload_1.getSuiPreloadDataUpdates)();
31
- updates.pipe((0, operators_1.take)(1)).subscribe(data => {
32
- expect(data).toEqual(testData);
33
- done();
34
- });
35
- (0, preload_1.setSuiPreloadData)(testData);
36
- });
37
- describe("getPreloadStrategy", () => {
38
- it("should return preload strategy with correct max age", () => {
39
- const strategy = (0, preload_1.getPreloadStrategy)();
40
- expect(strategy).toHaveProperty("preloadMaxAge");
41
- expect(strategy.preloadMaxAge).toBe(30 * 60 * 1000); // 30 minutes in milliseconds
42
- });
43
- it("should return consistent strategy object", () => {
44
- const strategy1 = (0, preload_1.getPreloadStrategy)();
45
- const strategy2 = (0, preload_1.getPreloadStrategy)();
46
- expect(strategy1).toEqual(strategy2);
47
- expect(strategy1.preloadMaxAge).toBe(30 * 60 * 1000);
48
- });
49
- });
50
- });
51
- });
52
- //# sourceMappingURL=preload.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,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":"","sources":["../../src/bridge/prepareTransaction.test.ts"],"names":[],"mappings":""}
@@ -1,97 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const bignumber_js_1 = __importDefault(require("bignumber.js"));
7
- const bridge_fixture_1 = require("../types/bridge.fixture");
8
- const prepareTransaction_1 = __importDefault(require("./prepareTransaction"));
9
- const faker_1 = require("@faker-js/faker");
10
- const sdk_1 = require("../network/sdk");
11
- const mockGetFeesForTransaction = jest.fn();
12
- jest.mock("./getFeesForTransaction", () => ({
13
- __esModule: true,
14
- default: () => mockGetFeesForTransaction(),
15
- }));
16
- const TEST_TOKEN_COIN_TYPE = "0x0::sui::TEST_TOKEN";
17
- // Mock findSubAccountById for testing token transactions
18
- jest.mock("@ledgerhq/coin-framework/account/index", () => ({
19
- findSubAccountById: jest.fn().mockImplementation((account, subAccountId) => {
20
- if (subAccountId === "tokenSubAccountId") {
21
- return {
22
- token: {
23
- id: "tokenSubAccountId",
24
- contractAddress: TEST_TOKEN_COIN_TYPE,
25
- },
26
- };
27
- }
28
- return null;
29
- }),
30
- }));
31
- // Mock calculateAmount
32
- const mockCalculateAmount = jest.fn();
33
- jest.mock("./utils", () => ({
34
- calculateAmount: () => mockCalculateAmount(),
35
- }));
36
- describe("prepareTransaction", () => {
37
- afterEach(() => {
38
- mockGetFeesForTransaction.mockClear();
39
- mockCalculateAmount.mockClear();
40
- });
41
- it("returns a new Transaction with new fees", async () => {
42
- // GIVEN
43
- const fees = new bignumber_js_1.default(faker_1.faker.number.int({ min: 1, max: 50 }));
44
- mockGetFeesForTransaction.mockResolvedValue(fees);
45
- const tx = (0, bridge_fixture_1.createFixtureTransaction)();
46
- // WHEN
47
- const newTx = await (0, prepareTransaction_1.default)((0, bridge_fixture_1.createFixtureAccount)(), tx);
48
- // THEN
49
- expect(newTx.fees).toEqual(fees);
50
- expect(newTx).not.toBe(tx);
51
- expect(newTx).toMatchObject({
52
- amount: tx.amount,
53
- recipient: tx.recipient,
54
- mode: "send",
55
- coinType: sdk_1.DEFAULT_COIN_TYPE,
56
- });
57
- });
58
- it("calculates amount when useAllAmount is true", async () => {
59
- // GIVEN
60
- const fees = new bignumber_js_1.default(faker_1.faker.number.int({ min: 1, max: 50 }));
61
- const calculatedAmount = new bignumber_js_1.default(faker_1.faker.number.int({ min: 1000, max: 5000 }));
62
- mockGetFeesForTransaction.mockResolvedValue(fees);
63
- mockCalculateAmount.mockReturnValue(calculatedAmount);
64
- const tx = (0, bridge_fixture_1.createFixtureTransaction)({ useAllAmount: true });
65
- // WHEN
66
- const newTx = await (0, prepareTransaction_1.default)((0, bridge_fixture_1.createFixtureAccount)(), tx);
67
- // THEN
68
- expect(mockCalculateAmount).toHaveBeenCalledTimes(1);
69
- expect(newTx.amount).toEqual(calculatedAmount);
70
- expect(newTx.fees).toEqual(fees);
71
- });
72
- it("sets mode to token.send and updates coinType for token transactions", async () => {
73
- // GIVEN
74
- const fees = new bignumber_js_1.default(faker_1.faker.number.int({ min: 1, max: 50 }));
75
- mockGetFeesForTransaction.mockResolvedValue(fees);
76
- const tx = (0, bridge_fixture_1.createFixtureTransaction)({
77
- subAccountId: "tokenSubAccountId",
78
- coinType: TEST_TOKEN_COIN_TYPE,
79
- });
80
- // WHEN
81
- const newTx = await (0, prepareTransaction_1.default)((0, bridge_fixture_1.createFixtureAccount)(), tx);
82
- // THEN
83
- expect(newTx.mode).toEqual("token.send");
84
- expect(newTx.coinType).toEqual(TEST_TOKEN_COIN_TYPE);
85
- expect(newTx.fees).toEqual(fees);
86
- });
87
- it("uses default fee of 0 when fee estimation fails", async () => {
88
- // GIVEN
89
- mockGetFeesForTransaction.mockRejectedValue(new Error("Fee estimation failed"));
90
- const tx = (0, bridge_fixture_1.createFixtureTransaction)();
91
- // WHEN
92
- const newTx = await (0, prepareTransaction_1.default)((0, bridge_fixture_1.createFixtureAccount)(), tx);
93
- // THEN
94
- expect(newTx.fees).toEqual(new bignumber_js_1.default(0));
95
- });
96
- });
97
- //# sourceMappingURL=prepareTransaction.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"prepareTransaction.test.js","sourceRoot":"","sources":["../../src/bridge/prepareTransaction.test.ts"],"names":[],"mappings":";;;;;AAAA,gEAAqC;AACrC,4DAAyF;AACzF,8EAAsD;AACtD,2CAAwC;AACxC,wCAAmD;AAEnD,MAAM,yBAAyB,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;AAC5C,IAAI,CAAC,IAAI,CAAC,yBAAyB,EAAE,GAAG,EAAE,CAAC,CAAC;IAC1C,UAAU,EAAE,IAAI;IAChB,OAAO,EAAE,GAAG,EAAE,CAAC,yBAAyB,EAAE;CAC3C,CAAC,CAAC,CAAC;AAEJ,MAAM,oBAAoB,GAAG,sBAAsB,CAAC;AAEpD,yDAAyD;AACzD,IAAI,CAAC,IAAI,CAAC,wCAAwC,EAAE,GAAG,EAAE,CAAC,CAAC;IACzD,kBAAkB,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,kBAAkB,CAAC,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE;QACzE,IAAI,YAAY,KAAK,mBAAmB,EAAE,CAAC;YACzC,OAAO;gBACL,KAAK,EAAE;oBACL,EAAE,EAAE,mBAAmB;oBACvB,eAAe,EAAE,oBAAoB;iBACtC;aACF,CAAC;QACJ,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC,CAAC;CACH,CAAC,CAAC,CAAC;AAEJ,uBAAuB;AACvB,MAAM,mBAAmB,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;AACtC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,GAAG,EAAE,CAAC,CAAC;IAC1B,eAAe,EAAE,GAAG,EAAE,CAAC,mBAAmB,EAAE;CAC7C,CAAC,CAAC,CAAC;AAEJ,QAAQ,CAAC,oBAAoB,EAAE,GAAG,EAAE;IAClC,SAAS,C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AK,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,oBAAoB,CAAC,CAAC;QACrD,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACnC,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,iDAAiD,EAAE,KAAK,IAAI,EAAE;QAC/D,QAAQ;QACR,yBAAyB,CAAC,iBAAiB,CAAC,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC,CAAC;QAChF,MAAM,EAAE,GAAG,IAAA,yCAAwB,GAAE,CAAC;QAEtC,OAAO;QACP,MAAM,KAAK,GAAG,MAAM,IAAA,4BAAkB,EAAC,IAAA,qCAAoB,GAAE,EAAE,EAAE,CAAC,CAAC;QAEnE,OAAO;QACP,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,IAAI,sBAAS,CAAC,CAAC,CAAC,CAAC,CAAC;IAC/C,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=serialization.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"serialization.test.d.ts","sourceRoot":"","sources":["../../src/bridge/serialization.test.ts"],"names":[],"mappings":""}
@@ -1,131 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const bignumber_js_1 = __importDefault(require("bignumber.js"));
7
- const serialization_1 = require("./serialization");
8
- const account = {
9
- type: "Account",
10
- id: "js:2:sui:0x6e143fe0a8ca010a86580dafac44298e5b1b7d73efc345356a59a15f0d7824f0:sui",
11
- used: true,
12
- seedIdentifier: "99807c4b6e1b8b25120f633f5f7816a393e4d3e7f84bdf24bd8afe725911be91",
13
- derivationMode: "sui",
14
- index: 0,
15
- freshAddress: "0x6e143fe0a8ca010a86580dafac44298e5b1b7d73efc345356a59a15f0d7824f0",
16
- freshAddressPath: "44'/784'/0'/0'/0'",
17
- blockHeight: 10,
18
- creationDate: new Date(),
19
- balance: (0, bignumber_js_1.default)(9998990120),
20
- spendableBalance: (0, bignumber_js_1.default)(9998990120),
21
- operations: [
22
- {
23
- id: "js:2:sui:0x6e143fe0a8ca010a86580dafac44298e5b1b7d73efc345356a59a15f0d7824f0:sui-DhKLpX5kwuKuyRa71RGqpX5EY2M8Efw535ZVXYXsRiDt-IN",
24
- hash: "DhKLpX5kwuKuyRa71RGqpX5EY2M8Efw535ZVXYXsRiDt",
25
- type: "IN",
26
- senders: ["0x65449f57946938c84c512732f1d69405d1fce417d9c9894696ddf4522f479e24"],
27
- recipients: ["0x6e143fe0a8ca010a86580dafac44298e5b1b7d73efc345356a59a15f0d7824f0"],
28
- accountId: "js:2:sui:0x6e143fe0a8ca010a86580dafac44298e5b1b7d73efc345356a59a15f0d7824f0:sui",
29
- blockHash: "DhKLpX5kwuKuyRa71RGqpX5EY2M8Efw535ZVXYXsRiDt",
30
- blockHeight: 5,
31
- date: new Date(),
32
- value: (0, bignumber_js_1.default)(9998990120),
33
- fee: (0, bignumber_js_1.default)(1009880),
34
- extra: {},
35
- hasFailed: false,
36
- },
37
- ],
38
- operationsCount: 1,
39
- pendingOperations: [],
40
- currency: {
41
- type: "CryptoCurrency",
42
- id: "sui",
43
- coinType: 784,
44
- name: "Sui",
45
- managerAppName: "Sui",
46
- ticker: "SUI",
47
- scheme: "sui",
48
- color: "#000",
49
- family: "sui",
50
- units: [{ name: "Sui", code: "SUI", magnitude: 9 }],
51
- explorerViews: [
52
- {
53
- tx: "https://suiscan.xyz/mainnet/tx/$hash",
54
- address: "https://suiscan.xyz/mainnet/account/$address",
55
- },
56
- {
57
- tx: "https://suivision.xyz/txblock/$hash",
58
- address: "https://suivision.xyz/account/$address",
59
- },
60
- ],
61
- },
62
- lastSyncDate: new Date(),
63
- swapHistory: [],
64
- balanceHistoryCache: {
65
- HOUR: { balances: [0, 9998990120, 9998990120, 9998990120], latestDate: 1742302800000 },
66
- DAY: { balances: [0], latestDate: 1742245200000 },
67
- WEEK: { balances: [0], latestDate: 1742072400000 },
68
- },
69
- suiResources: {},
70
- };
71
- const accountRaw = {
72
- id: "js:2:sui:0x6e143fe0a8ca010a86580dafac44298e5b1b7d73efc345356a59a15f0d7824f0:sui",
73
- seedIdentifier: "99807c4b6e1b8b25120f633f5f7816a393e4d3e7f84bdf24bd8afe725911be91",
74
- used: true,
75
- derivationMode: "sui",
76
- index: 0,
77
- freshAddress: "0x6e143fe0a8ca010a86580dafac44298e5b1b7d73efc345356a59a15f0d7824f0",
78
- freshAddressPath: "44'/784'/0'/0'/0'",
79
- blockHeight: 10,
80
- creationDate: "2025-03-18T10:40:54.878Z",
81
- operationsCount: 1,
82
- operations: [
83
- {
84
- id: "js:2:sui:0x6e143fe0a8ca010a86580dafac44298e5b1b7d73efc345356a59a15f0d7824f0:sui-DhKLpX5kwuKuyRa71RGqpX5EY2M8Efw535ZVXYXsRiDt-IN",
85
- hash: "DhKLpX5kwuKuyRa71RGqpX5EY2M8Efw535ZVXYXsRiDt",
86
- type: "IN",
87
- senders: ["0x65449f57946938c84c512732f1d69405d1fce417d9c9894696ddf4522f479e24"],
88
- recipients: ["0x6e143fe0a8ca010a86580dafac44298e5b1b7d73efc345356a59a15f0d7824f0"],
89
- accountId: "js:2:sui:0x6e143fe0a8ca010a86580dafac44298e5b1b7d73efc345356a59a15f0d7824f0:sui",
90
- blockHash: "DhKLpX5kwuKuyRa71RGqpX5EY2M8Efw535ZVXYXsRiDt",
91
- blockHeight: 5,
92
- extra: {},
93
- date: "2025-03-18T10:40:54.878Z",
94
- value: "9998990120",
95
- fee: "1009880",
96
- hasFailed: false,
97
- },
98
- ],
99
- pendingOperations: [],
100
- currencyId: "sui",
101
- lastSyncDate: "2025-03-18T10:40:54.878Z",
102
- balance: "9998990120",
103
- spendableBalance: "9998990120",
104
- balanceHistoryCache: {
105
- HOUR: { balances: [0, 9998990120, 9998990120, 9998990120], latestDate: 1742302800000 },
106
- DAY: { balances: [0], latestDate: 1742245200000 },
107
- WEEK: { balances: [0], latestDate: 1742072400000 },
108
- },
109
- suiResources: {},
110
- };
111
- describe("serialization", () => {
112
- test("toSuiResourcesRaw should convert SuiResources to SuiResourcesRaw", () => {
113
- const resources = {};
114
- const result = (0, serialization_1.toSuiResourcesRaw)(resources);
115
- expect(result).toEqual({});
116
- });
117
- test("fromSuiResourcesRaw should convert SuiResourcesRaw to SuiResources", () => {
118
- const resourcesRaw = {};
119
- const result = (0, serialization_1.fromSuiResourcesRaw)(resourcesRaw);
120
- expect(result).toEqual({});
121
- });
122
- test("assignToAccountRaw should assign SuiResources to AccountRaw", () => {
123
- (0, serialization_1.assignToAccountRaw)(account, accountRaw);
124
- expect(accountRaw.suiResources).toBeDefined();
125
- });
126
- test("assignFromAccountRaw should assign SuiResourcesRaw to Account", () => {
127
- (0, serialization_1.assignFromAccountRaw)(accountRaw, account);
128
- expect(account.suiResources).toBeDefined();
129
- });
130
- });
131
- //# sourceMappingURL=serialization.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"serialization.test.js","sourceRoot":"","sources":["../../src/bridge/serialization.test.ts"],"names":[],"mappings":";;;;;AAAA,gEAAqC;AACrC,mDAKyB;AAEzB,MAAM,OAAO,GAAG;IACd,IAAI,EAAE,SAAkB;IACxB,EAAE,EAAE,iFAAiF;IACrF,IAAI,EAAE,IAAI;IACV,cAAc,EAAE,kEAAkE;IAClF,cAAc,EAAE,KAAc;IAC9B,KAAK,EAAE,CAAC;IACR,YAAY,EAAE,oEAAoE;IAClF,gBAAgB,EAAE,mBAAmB;IACrC,WAAW,EAAE,EAAE;IACf,YAAY,EAAE,IAAI,IAAI,EAAE;IACxB,OAAO,EAAE,IAAA,sBAAS,EAAC,UAAU,CAAC;IAC9B,gBAAgB,EAAE,IAAA,sBAAS,EAAC,UAAU,CAAC;IACvC,UAAU,EAAE;QACV;YACE,EAAE,EAAE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EAAE;KACnD;IACD,YAAY,EAAE,EAAE;CACjB,CAAC;AAEF,QAAQ,CAAC,eAAe,EAAE,GAAG,EAAE;IAC7B,IAAI,CAAC,kEAAkE,EAAE,GAAG,EAAE;QAC5E,MAAM,SAAS,GAAG,EAAE,CAAC;QACrB,MAAM,MAAM,GAAG,IAAA,iCAAiB,EAAC,SAAS,CAAC,CAAC;QAC5C,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IAC7B,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,oEAAoE,EAAE,GAAG,EAAE;QAC9E,MAAM,YAAY,GAAG,EAAE,CAAC;QACxB,MAAM,MAAM,GAAG,IAAA,mCAAmB,EAAC,YAAY,CAAC,CAAC;QACjD,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IAC7B,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,6DAA6D,EAAE,GAAG,EAAE;QACvE,IAAA,kCAAkB,EAAC,OAAO,EAAE,UAAU,CAAC,CAAC;QACxC,MAAM,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC,WAAW,EAAE,CAAC;IAChD,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,+DAA+D,EAAE,GAAG,EAAE;QACzE,IAAA,oCAAoB,EAAC,UAAU,EAAE,OAAO,CAAC,CAAC;QAC1C,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,WAAW,EAAE,CAAC;IAC7C,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=signOperation.integration.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"signOperation.integration.test.d.ts","sourceRoot":"","sources":["../../src/bridge/signOperation.integration.test.ts"],"names":[],"mappings":""}