@ledgerhq/coin-ton 0.3.12-next.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (341) hide show
  1. package/.eslintrc.js +20 -0
  2. package/.turbo/turbo-build.log +4 -0
  3. package/.unimportedrc.json +19 -0
  4. package/CHANGELOG.md +15 -0
  5. package/LICENSE.txt +21 -0
  6. package/jest.config.js +12 -0
  7. package/lib/__tests__/fixtures/api.fixtures.d.ts +4 -0
  8. package/lib/__tests__/fixtures/api.fixtures.d.ts.map +1 -0
  9. package/lib/__tests__/fixtures/api.fixtures.js +33 -0
  10. package/lib/__tests__/fixtures/api.fixtures.js.map +1 -0
  11. package/lib/__tests__/fixtures/common.fixtures.d.ts +29 -0
  12. package/lib/__tests__/fixtures/common.fixtures.d.ts.map +1 -0
  13. package/lib/__tests__/fixtures/common.fixtures.js +124 -0
  14. package/lib/__tests__/fixtures/common.fixtures.js.map +1 -0
  15. package/lib/__tests__/integration/bridge.integration.test.d.ts +14 -0
  16. package/lib/__tests__/integration/bridge.integration.test.d.ts.map +1 -0
  17. package/lib/__tests__/integration/bridge.integration.test.js +136 -0
  18. package/lib/__tests__/integration/bridge.integration.test.js.map +1 -0
  19. package/lib/__tests__/unit/api.unit.test.d.ts +2 -0
  20. package/lib/__tests__/unit/api.unit.test.d.ts.map +1 -0
  21. package/lib/__tests__/unit/api.unit.test.js +77 -0
  22. package/lib/__tests__/unit/api.unit.test.js.map +1 -0
  23. package/lib/__tests__/unit/broadcast.unit.test.d.ts +2 -0
  24. package/lib/__tests__/unit/broadcast.unit.test.d.ts.map +1 -0
  25. package/lib/__tests__/unit/broadcast.unit.test.js +40 -0
  26. package/lib/__tests__/unit/broadcast.unit.test.js.map +1 -0
  27. package/lib/__tests__/unit/createTransaction.unit.test.d.ts +2 -0
  28. package/lib/__tests__/unit/createTransaction.unit.test.d.ts.map +1 -0
  29. package/lib/__tests__/unit/createTransaction.unit.test.js +34 -0
  30. package/lib/__tests__/unit/createTransaction.unit.test.js.map +1 -0
  31. package/lib/__tests__/unit/deviceTransactionConfig.unit.test.d.ts +2 -0
  32. package/lib/__tests__/unit/deviceTransactionConfig.unit.test.d.ts.map +1 -0
  33. package/lib/__tests__/unit/deviceTransactionConfig.unit.test.js +74 -0
  34. package/lib/__tests__/unit/deviceTransactionConfig.unit.test.js.map +1 -0
  35. package/lib/__tests__/unit/estimateMaxSpendable.unit.test.d.ts +2 -0
  36. package/lib/__tests__/unit/estimateMaxSpendable.unit.test.d.ts.map +1 -0
  37. package/lib/__tests__/unit/estimateMaxSpendable.unit.test.js +31 -0
  38. package/lib/__tests__/unit/estimateMaxSpendable.unit.test.js.map +1 -0
  39. package/lib/__tests__/unit/getTransactionStatus.unit.test.d.ts +2 -0
  40. package/lib/__tests__/unit/getTransactionStatus.unit.test.d.ts.map +1 -0
  41. package/lib/__tests__/unit/getTransactionStatus.unit.test.js +96 -0
  42. package/lib/__tests__/unit/getTransactionStatus.unit.test.js.map +1 -0
  43. package/lib/__tests__/unit/hw-getAddress.unit.test.d.ts +2 -0
  44. package/lib/__tests__/unit/hw-getAddress.unit.test.d.ts.map +1 -0
  45. package/lib/__tests__/unit/hw-getAddress.unit.test.js +67 -0
  46. package/lib/__tests__/unit/hw-getAddress.unit.test.js.map +1 -0
  47. package/lib/__tests__/unit/prepareTransaction.unit.test.d.ts +2 -0
  48. package/lib/__tests__/unit/prepareTransaction.unit.test.d.ts.map +1 -0
  49. package/lib/__tests__/unit/prepareTransaction.unit.test.js +42 -0
  50. package/lib/__tests__/unit/prepareTransaction.unit.test.js.map +1 -0
  51. package/lib/__tests__/unit/signOperation.unit.test.d.ts +2 -0
  52. package/lib/__tests__/unit/signOperation.unit.test.d.ts.map +1 -0
  53. package/lib/__tests__/unit/signOperation.unit.test.js +83 -0
  54. package/lib/__tests__/unit/signOperation.unit.test.js.map +1 -0
  55. package/lib/__tests__/unit/txn.unit.test.d.ts +2 -0
  56. package/lib/__tests__/unit/txn.unit.test.d.ts.map +1 -0
  57. package/lib/__tests__/unit/txn.unit.test.js +116 -0
  58. package/lib/__tests__/unit/txn.unit.test.js.map +1 -0
  59. package/lib/__tests__/unit/utils.unit.test.d.ts +2 -0
  60. package/lib/__tests__/unit/utils.unit.test.d.ts.map +1 -0
  61. package/lib/__tests__/unit/utils.unit.test.js +97 -0
  62. package/lib/__tests__/unit/utils.unit.test.js.map +1 -0
  63. package/lib/bridge/bridgeHelpers/api.d.ts +10 -0
  64. package/lib/bridge/bridgeHelpers/api.d.ts.map +1 -0
  65. package/lib/bridge/bridgeHelpers/api.js +104 -0
  66. package/lib/bridge/bridgeHelpers/api.js.map +1 -0
  67. package/lib/bridge/bridgeHelpers/api.types.d.ts +164 -0
  68. package/lib/bridge/bridgeHelpers/api.types.d.ts.map +1 -0
  69. package/lib/bridge/bridgeHelpers/api.types.js +3 -0
  70. package/lib/bridge/bridgeHelpers/api.types.js.map +1 -0
  71. package/lib/bridge/bridgeHelpers/txn.d.ts +5 -0
  72. package/lib/bridge/bridgeHelpers/txn.d.ts.map +1 -0
  73. package/lib/bridge/bridgeHelpers/txn.js +166 -0
  74. package/lib/bridge/bridgeHelpers/txn.js.map +1 -0
  75. package/lib/bridge/js.d.ts +12 -0
  76. package/lib/bridge/js.d.ts.map +1 -0
  77. package/lib/bridge/js.js +65 -0
  78. package/lib/bridge/js.js.map +1 -0
  79. package/lib/broadcast.d.ts +5 -0
  80. package/lib/broadcast.d.ts.map +1 -0
  81. package/lib/broadcast.js +19 -0
  82. package/lib/broadcast.js.map +1 -0
  83. package/lib/cli-transaction.d.ts +12 -0
  84. package/lib/cli-transaction.d.ts.map +1 -0
  85. package/lib/cli-transaction.js +21 -0
  86. package/lib/cli-transaction.js.map +1 -0
  87. package/lib/config.d.ts +9 -0
  88. package/lib/config.d.ts.map +1 -0
  89. package/lib/config.js +16 -0
  90. package/lib/config.js.map +1 -0
  91. package/lib/createTransaction.d.ts +5 -0
  92. package/lib/createTransaction.d.ts.map +1 -0
  93. package/lib/createTransaction.js +16 -0
  94. package/lib/createTransaction.js.map +1 -0
  95. package/lib/deviceTransactionConfig.d.ts +11 -0
  96. package/lib/deviceTransactionConfig.d.ts.map +1 -0
  97. package/lib/deviceTransactionConfig.js +37 -0
  98. package/lib/deviceTransactionConfig.js.map +1 -0
  99. package/lib/errors.d.ts +4 -0
  100. package/lib/errors.d.ts.map +1 -0
  101. package/lib/errors.js +9 -0
  102. package/lib/errors.js.map +1 -0
  103. package/lib/estimateMaxSpendable.d.ts +5 -0
  104. package/lib/estimateMaxSpendable.d.ts.map +1 -0
  105. package/lib/estimateMaxSpendable.js +32 -0
  106. package/lib/estimateMaxSpendable.js.map +1 -0
  107. package/lib/getTransactionStatus.d.ts +5 -0
  108. package/lib/getTransactionStatus.d.ts.map +1 -0
  109. package/lib/getTransactionStatus.js +97 -0
  110. package/lib/getTransactionStatus.js.map +1 -0
  111. package/lib/hw-getAddress.d.ts +6 -0
  112. package/lib/hw-getAddress.d.ts.map +1 -0
  113. package/lib/hw-getAddress.js +31 -0
  114. package/lib/hw-getAddress.js.map +1 -0
  115. package/lib/hw-signMessage.d.ts +12 -0
  116. package/lib/hw-signMessage.d.ts.map +1 -0
  117. package/lib/hw-signMessage.js +33 -0
  118. package/lib/hw-signMessage.js.map +1 -0
  119. package/lib/prepareTransaction.d.ts +5 -0
  120. package/lib/prepareTransaction.d.ts.map +1 -0
  121. package/lib/prepareTransaction.js +29 -0
  122. package/lib/prepareTransaction.js.map +1 -0
  123. package/lib/signOperation.d.ts +11 -0
  124. package/lib/signOperation.d.ts.map +1 -0
  125. package/lib/signOperation.js +96 -0
  126. package/lib/signOperation.js.map +1 -0
  127. package/lib/signer.d.ts +27 -0
  128. package/lib/signer.d.ts.map +1 -0
  129. package/lib/signer.js +3 -0
  130. package/lib/signer.js.map +1 -0
  131. package/lib/specs.d.ts +8 -0
  132. package/lib/specs.d.ts.map +1 -0
  133. package/lib/specs.js +106 -0
  134. package/lib/specs.js.map +1 -0
  135. package/lib/speculos-deviceActions.d.ts +4 -0
  136. package/lib/speculos-deviceActions.d.ts.map +1 -0
  137. package/lib/speculos-deviceActions.js +34 -0
  138. package/lib/speculos-deviceActions.js.map +1 -0
  139. package/lib/synchronisation.d.ts +5 -0
  140. package/lib/synchronisation.d.ts.map +1 -0
  141. package/lib/synchronisation.js +95 -0
  142. package/lib/synchronisation.js.map +1 -0
  143. package/lib/transaction.d.ts +14 -0
  144. package/lib/transaction.d.ts.map +1 -0
  145. package/lib/transaction.js +41 -0
  146. package/lib/transaction.js.map +1 -0
  147. package/lib/types.d.ts +65 -0
  148. package/lib/types.d.ts.map +1 -0
  149. package/lib/types.js +3 -0
  150. package/lib/types.js.map +1 -0
  151. package/lib/utils.d.ts +11 -0
  152. package/lib/utils.d.ts.map +1 -0
  153. package/lib/utils.js +125 -0
  154. package/lib/utils.js.map +1 -0
  155. package/lib-es/__tests__/fixtures/api.fixtures.d.ts +4 -0
  156. package/lib-es/__tests__/fixtures/api.fixtures.d.ts.map +1 -0
  157. package/lib-es/__tests__/fixtures/api.fixtures.js +30 -0
  158. package/lib-es/__tests__/fixtures/api.fixtures.js.map +1 -0
  159. package/lib-es/__tests__/fixtures/common.fixtures.d.ts +29 -0
  160. package/lib-es/__tests__/fixtures/common.fixtures.d.ts.map +1 -0
  161. package/lib-es/__tests__/fixtures/common.fixtures.js +118 -0
  162. package/lib-es/__tests__/fixtures/common.fixtures.js.map +1 -0
  163. package/lib-es/__tests__/integration/bridge.integration.test.d.ts +14 -0
  164. package/lib-es/__tests__/integration/bridge.integration.test.d.ts.map +1 -0
  165. package/lib-es/__tests__/integration/bridge.integration.test.js +130 -0
  166. package/lib-es/__tests__/integration/bridge.integration.test.js.map +1 -0
  167. package/lib-es/__tests__/unit/api.unit.test.d.ts +2 -0
  168. package/lib-es/__tests__/unit/api.unit.test.d.ts.map +1 -0
  169. package/lib-es/__tests__/unit/api.unit.test.js +52 -0
  170. package/lib-es/__tests__/unit/api.unit.test.js.map +1 -0
  171. package/lib-es/__tests__/unit/broadcast.unit.test.d.ts +2 -0
  172. package/lib-es/__tests__/unit/broadcast.unit.test.d.ts.map +1 -0
  173. package/lib-es/__tests__/unit/broadcast.unit.test.js +35 -0
  174. package/lib-es/__tests__/unit/broadcast.unit.test.js.map +1 -0
  175. package/lib-es/__tests__/unit/createTransaction.unit.test.d.ts +2 -0
  176. package/lib-es/__tests__/unit/createTransaction.unit.test.d.ts.map +1 -0
  177. package/lib-es/__tests__/unit/createTransaction.unit.test.js +29 -0
  178. package/lib-es/__tests__/unit/createTransaction.unit.test.js.map +1 -0
  179. package/lib-es/__tests__/unit/deviceTransactionConfig.unit.test.d.ts +2 -0
  180. package/lib-es/__tests__/unit/deviceTransactionConfig.unit.test.d.ts.map +1 -0
  181. package/lib-es/__tests__/unit/deviceTransactionConfig.unit.test.js +69 -0
  182. package/lib-es/__tests__/unit/deviceTransactionConfig.unit.test.js.map +1 -0
  183. package/lib-es/__tests__/unit/estimateMaxSpendable.unit.test.d.ts +2 -0
  184. package/lib-es/__tests__/unit/estimateMaxSpendable.unit.test.d.ts.map +1 -0
  185. package/lib-es/__tests__/unit/estimateMaxSpendable.unit.test.js +26 -0
  186. package/lib-es/__tests__/unit/estimateMaxSpendable.unit.test.js.map +1 -0
  187. package/lib-es/__tests__/unit/getTransactionStatus.unit.test.d.ts +2 -0
  188. package/lib-es/__tests__/unit/getTransactionStatus.unit.test.d.ts.map +1 -0
  189. package/lib-es/__tests__/unit/getTransactionStatus.unit.test.js +91 -0
  190. package/lib-es/__tests__/unit/getTransactionStatus.unit.test.js.map +1 -0
  191. package/lib-es/__tests__/unit/hw-getAddress.unit.test.d.ts +2 -0
  192. package/lib-es/__tests__/unit/hw-getAddress.unit.test.d.ts.map +1 -0
  193. package/lib-es/__tests__/unit/hw-getAddress.unit.test.js +62 -0
  194. package/lib-es/__tests__/unit/hw-getAddress.unit.test.js.map +1 -0
  195. package/lib-es/__tests__/unit/prepareTransaction.unit.test.d.ts +2 -0
  196. package/lib-es/__tests__/unit/prepareTransaction.unit.test.d.ts.map +1 -0
  197. package/lib-es/__tests__/unit/prepareTransaction.unit.test.js +37 -0
  198. package/lib-es/__tests__/unit/prepareTransaction.unit.test.js.map +1 -0
  199. package/lib-es/__tests__/unit/signOperation.unit.test.d.ts +2 -0
  200. package/lib-es/__tests__/unit/signOperation.unit.test.d.ts.map +1 -0
  201. package/lib-es/__tests__/unit/signOperation.unit.test.js +78 -0
  202. package/lib-es/__tests__/unit/signOperation.unit.test.js.map +1 -0
  203. package/lib-es/__tests__/unit/txn.unit.test.d.ts +2 -0
  204. package/lib-es/__tests__/unit/txn.unit.test.d.ts.map +1 -0
  205. package/lib-es/__tests__/unit/txn.unit.test.js +111 -0
  206. package/lib-es/__tests__/unit/txn.unit.test.js.map +1 -0
  207. package/lib-es/__tests__/unit/utils.unit.test.d.ts +2 -0
  208. package/lib-es/__tests__/unit/utils.unit.test.d.ts.map +1 -0
  209. package/lib-es/__tests__/unit/utils.unit.test.js +95 -0
  210. package/lib-es/__tests__/unit/utils.unit.test.js.map +1 -0
  211. package/lib-es/bridge/bridgeHelpers/api.d.ts +10 -0
  212. package/lib-es/bridge/bridgeHelpers/api.d.ts.map +1 -0
  213. package/lib-es/bridge/bridgeHelpers/api.js +93 -0
  214. package/lib-es/bridge/bridgeHelpers/api.js.map +1 -0
  215. package/lib-es/bridge/bridgeHelpers/api.types.d.ts +164 -0
  216. package/lib-es/bridge/bridgeHelpers/api.types.d.ts.map +1 -0
  217. package/lib-es/bridge/bridgeHelpers/api.types.js +2 -0
  218. package/lib-es/bridge/bridgeHelpers/api.types.js.map +1 -0
  219. package/lib-es/bridge/bridgeHelpers/txn.d.ts +5 -0
  220. package/lib-es/bridge/bridgeHelpers/txn.d.ts.map +1 -0
  221. package/lib-es/bridge/bridgeHelpers/txn.js +158 -0
  222. package/lib-es/bridge/bridgeHelpers/txn.js.map +1 -0
  223. package/lib-es/bridge/js.d.ts +12 -0
  224. package/lib-es/bridge/js.d.ts.map +1 -0
  225. package/lib-es/bridge/js.js +56 -0
  226. package/lib-es/bridge/js.js.map +1 -0
  227. package/lib-es/broadcast.d.ts +5 -0
  228. package/lib-es/broadcast.d.ts.map +1 -0
  229. package/lib-es/broadcast.js +17 -0
  230. package/lib-es/broadcast.js.map +1 -0
  231. package/lib-es/cli-transaction.d.ts +12 -0
  232. package/lib-es/cli-transaction.d.ts.map +1 -0
  233. package/lib-es/cli-transaction.js +15 -0
  234. package/lib-es/cli-transaction.js.map +1 -0
  235. package/lib-es/config.d.ts +9 -0
  236. package/lib-es/config.d.ts.map +1 -0
  237. package/lib-es/config.js +11 -0
  238. package/lib-es/config.js.map +1 -0
  239. package/lib-es/createTransaction.d.ts +5 -0
  240. package/lib-es/createTransaction.d.ts.map +1 -0
  241. package/lib-es/createTransaction.js +14 -0
  242. package/lib-es/createTransaction.js.map +1 -0
  243. package/lib-es/deviceTransactionConfig.d.ts +11 -0
  244. package/lib-es/deviceTransactionConfig.d.ts.map +1 -0
  245. package/lib-es/deviceTransactionConfig.js +35 -0
  246. package/lib-es/deviceTransactionConfig.js.map +1 -0
  247. package/lib-es/errors.d.ts +4 -0
  248. package/lib-es/errors.d.ts.map +1 -0
  249. package/lib-es/errors.js +6 -0
  250. package/lib-es/errors.js.map +1 -0
  251. package/lib-es/estimateMaxSpendable.d.ts +5 -0
  252. package/lib-es/estimateMaxSpendable.d.ts.map +1 -0
  253. package/lib-es/estimateMaxSpendable.js +30 -0
  254. package/lib-es/estimateMaxSpendable.js.map +1 -0
  255. package/lib-es/getTransactionStatus.d.ts +5 -0
  256. package/lib-es/getTransactionStatus.d.ts.map +1 -0
  257. package/lib-es/getTransactionStatus.js +93 -0
  258. package/lib-es/getTransactionStatus.js.map +1 -0
  259. package/lib-es/hw-getAddress.d.ts +6 -0
  260. package/lib-es/hw-getAddress.d.ts.map +1 -0
  261. package/lib-es/hw-getAddress.js +29 -0
  262. package/lib-es/hw-getAddress.js.map +1 -0
  263. package/lib-es/hw-signMessage.d.ts +12 -0
  264. package/lib-es/hw-signMessage.d.ts.map +1 -0
  265. package/lib-es/hw-signMessage.js +29 -0
  266. package/lib-es/hw-signMessage.js.map +1 -0
  267. package/lib-es/prepareTransaction.d.ts +5 -0
  268. package/lib-es/prepareTransaction.d.ts.map +1 -0
  269. package/lib-es/prepareTransaction.js +27 -0
  270. package/lib-es/prepareTransaction.js.map +1 -0
  271. package/lib-es/signOperation.d.ts +11 -0
  272. package/lib-es/signOperation.d.ts.map +1 -0
  273. package/lib-es/signOperation.js +91 -0
  274. package/lib-es/signOperation.js.map +1 -0
  275. package/lib-es/signer.d.ts +27 -0
  276. package/lib-es/signer.d.ts.map +1 -0
  277. package/lib-es/signer.js +2 -0
  278. package/lib-es/signer.js.map +1 -0
  279. package/lib-es/specs.d.ts +8 -0
  280. package/lib-es/specs.d.ts.map +1 -0
  281. package/lib-es/specs.js +99 -0
  282. package/lib-es/specs.js.map +1 -0
  283. package/lib-es/speculos-deviceActions.d.ts +4 -0
  284. package/lib-es/speculos-deviceActions.d.ts.map +1 -0
  285. package/lib-es/speculos-deviceActions.js +31 -0
  286. package/lib-es/speculos-deviceActions.js.map +1 -0
  287. package/lib-es/synchronisation.d.ts +5 -0
  288. package/lib-es/synchronisation.d.ts.map +1 -0
  289. package/lib-es/synchronisation.js +88 -0
  290. package/lib-es/synchronisation.js.map +1 -0
  291. package/lib-es/transaction.d.ts +14 -0
  292. package/lib-es/transaction.d.ts.map +1 -0
  293. package/lib-es/transaction.js +33 -0
  294. package/lib-es/transaction.js.map +1 -0
  295. package/lib-es/types.d.ts +65 -0
  296. package/lib-es/types.d.ts.map +1 -0
  297. package/lib-es/types.js +2 -0
  298. package/lib-es/types.js.map +1 -0
  299. package/lib-es/utils.d.ts +11 -0
  300. package/lib-es/utils.d.ts.map +1 -0
  301. package/lib-es/utils.js +112 -0
  302. package/lib-es/utils.js.map +1 -0
  303. package/package.json +86 -0
  304. package/src/__tests__/fixtures/api.fixtures.ts +39 -0
  305. package/src/__tests__/fixtures/common.fixtures.ts +139 -0
  306. package/src/__tests__/integration/bridge.integration.test.ts +135 -0
  307. package/src/__tests__/unit/api.unit.test.ts +60 -0
  308. package/src/__tests__/unit/broadcast.unit.test.ts +36 -0
  309. package/src/__tests__/unit/createTransaction.unit.test.ts +20 -0
  310. package/src/__tests__/unit/deviceTransactionConfig.unit.test.ts +69 -0
  311. package/src/__tests__/unit/estimateMaxSpendable.unit.test.ts +19 -0
  312. package/src/__tests__/unit/getTransactionStatus.unit.test.ts +119 -0
  313. package/src/__tests__/unit/hw-getAddress.unit.test.ts +58 -0
  314. package/src/__tests__/unit/prepareTransaction.unit.test.ts +52 -0
  315. package/src/__tests__/unit/signOperation.unit.test.ts +90 -0
  316. package/src/__tests__/unit/txn.unit.test.ts +121 -0
  317. package/src/__tests__/unit/utils.unit.test.ts +126 -0
  318. package/src/bridge/bridgeHelpers/api.ts +104 -0
  319. package/src/bridge/bridgeHelpers/api.types.ts +178 -0
  320. package/src/bridge/bridgeHelpers/txn.ts +166 -0
  321. package/src/bridge/js.ts +65 -0
  322. package/src/broadcast.ts +13 -0
  323. package/src/cli-transaction.ts +30 -0
  324. package/src/config.ts +21 -0
  325. package/src/createTransaction.ts +17 -0
  326. package/src/deviceTransactionConfig.ts +48 -0
  327. package/src/errors.ts +6 -0
  328. package/src/estimateMaxSpendable.ts +40 -0
  329. package/src/getTransactionStatus.ts +130 -0
  330. package/src/hw-getAddress.ts +28 -0
  331. package/src/hw-signMessage.ts +31 -0
  332. package/src/prepareTransaction.ts +27 -0
  333. package/src/signOperation.ts +115 -0
  334. package/src/signer.ts +32 -0
  335. package/src/specs.ts +122 -0
  336. package/src/speculos-deviceActions.ts +38 -0
  337. package/src/synchronisation.ts +91 -0
  338. package/src/transaction.ts +61 -0
  339. package/src/types.ts +82 -0
  340. package/src/utils.ts +120 -0
  341. package/tsconfig.json +12 -0
@@ -0,0 +1,52 @@
1
+ import { estimateFee, fetchAccountInfo } from "../../bridge/bridgeHelpers/api";
2
+ import prepareTransaction from "../../prepareTransaction";
3
+ import {
4
+ account,
5
+ accountInfo,
6
+ transaction as baseTransaction,
7
+ fees,
8
+ totalFees,
9
+ } from "../fixtures/common.fixtures";
10
+
11
+ jest.mock("../../bridge/bridgeHelpers/api");
12
+
13
+ describe("prepareTransaction", () => {
14
+ beforeAll(() => {
15
+ const fetchAccountInfoMock = jest.mocked(fetchAccountInfo);
16
+ fetchAccountInfoMock.mockReturnValue(Promise.resolve(accountInfo));
17
+ const fetchEstimateFeeMock = jest.mocked(estimateFee);
18
+ fetchEstimateFeeMock.mockReturnValue(Promise.resolve(fees));
19
+ });
20
+
21
+ describe("Ton Transaction", () => {
22
+ it("should return the transaction with the updated amount and fees", async () => {
23
+ const transaction = await prepareTransaction(account, baseTransaction);
24
+
25
+ expect(transaction).toEqual({
26
+ ...baseTransaction,
27
+ fees: totalFees,
28
+ });
29
+ });
30
+
31
+ it("should preserve the reference when no change is detected on the transaction", async () => {
32
+ const transaction = await prepareTransaction(account, { ...baseTransaction });
33
+ const transaction2 = await prepareTransaction(account, transaction);
34
+
35
+ expect(transaction).toBe(transaction2);
36
+ });
37
+
38
+ it("should create a coin transaction using the spendableBalance in the account", async () => {
39
+ const transaction = await prepareTransaction(account, {
40
+ ...baseTransaction,
41
+ useAllAmount: true,
42
+ });
43
+
44
+ expect(transaction).toEqual({
45
+ ...baseTransaction,
46
+ useAllAmount: true,
47
+ fees: totalFees,
48
+ amount: account.spendableBalance.minus(totalFees),
49
+ });
50
+ });
51
+ });
52
+ });
@@ -0,0 +1,90 @@
1
+ import { SignerContext } from "@ledgerhq/coin-framework/signer";
2
+ import { Address, Cell, beginCell, storeMessage } from "@ton/core";
3
+ import BigNumber from "bignumber.js";
4
+ import { fetchAccountInfo } from "../../bridge/bridgeHelpers/api";
5
+ import { buildSignOperation } from "../../signOperation";
6
+ import { TonSigner } from "../../signer";
7
+ import { account, accountInfo, totalFees, transaction } from "../fixtures/common.fixtures";
8
+
9
+ jest.mock("../../bridge/bridgeHelpers/api");
10
+
11
+ const spySignTransaction = jest.fn().mockImplementation(async () =>
12
+ Promise.resolve(
13
+ beginCell()
14
+ .store(
15
+ storeMessage({
16
+ info: {
17
+ type: "external-in",
18
+ dest: Address.parse("EQDzd8aeBOU-jqYw_ZSuZjceI5p-F4b7HMprAsUJAtRPbJfg"),
19
+ importFee: BigInt(0),
20
+ },
21
+ body: new Cell(),
22
+ }),
23
+ )
24
+ .endCell(),
25
+ ),
26
+ );
27
+
28
+ const mockSignerContext: SignerContext<TonSigner> = <T>(
29
+ _: string,
30
+ fn: (signer: TonSigner) => Promise<T>,
31
+ ) => {
32
+ return fn({
33
+ signTransaction: spySignTransaction,
34
+ getAddress: jest.fn(),
35
+ validateAddress: jest.fn(),
36
+ });
37
+ };
38
+
39
+ describe("signOperation", () => {
40
+ beforeAll(() => {
41
+ const fetchAccountInfoMock = jest.mocked(fetchAccountInfo);
42
+ fetchAccountInfoMock.mockReturnValue(Promise.resolve(accountInfo));
43
+ });
44
+
45
+ it("should return an optimistic operation and a signed hash returned by the app bindings", done => {
46
+ const signOperation = buildSignOperation(mockSignerContext);
47
+
48
+ const signOpObservable = signOperation({
49
+ account,
50
+ transaction: { ...transaction, fees: totalFees },
51
+ deviceId: "",
52
+ });
53
+
54
+ signOpObservable.subscribe(obs => {
55
+ if (obs.type === "signed") {
56
+ const {
57
+ signedOperation: { signature, operation },
58
+ } = obs;
59
+
60
+ const { amount } = transaction;
61
+
62
+ expect(operation).toEqual({
63
+ id: "",
64
+ hash: "",
65
+ type: "OUT",
66
+ value: new BigNumber(amount).plus(totalFees),
67
+ fee: totalFees,
68
+ blockHash: null,
69
+ blockHeight: null,
70
+ senders: [account.freshAddress],
71
+ recipients: [transaction.recipient],
72
+ accountId: account.id,
73
+ date: expect.any(Date),
74
+ extra: {
75
+ comment: {
76
+ isEncrypted: false,
77
+ text: "",
78
+ },
79
+ explorerHash: "",
80
+ lt: "",
81
+ },
82
+ });
83
+ expect(signature).toBe(
84
+ "te6cckEBAQEASAAAi4gB5u+NPAnKfR1MYfspXMxuPEc0/C8N9jmU1gWKEgWontgEQA83fGngTlPo6mMP2UrmY3HiOafheG+xzKawLFCQLUT2wCDSMh+F",
85
+ );
86
+ done();
87
+ }
88
+ });
89
+ });
90
+ });
@@ -0,0 +1,121 @@
1
+ import { encodeOperationId } from "@ledgerhq/coin-framework/lib/operation";
2
+ import BigNumber from "bignumber.js";
3
+ // eslint-disable-next-line no-restricted-imports
4
+ import { flatMap } from "lodash";
5
+ import { TonTransaction } from "../../bridge/bridgeHelpers/api.types";
6
+ import { mapTxToOps } from "../../bridge/bridgeHelpers/txn";
7
+ import { mockAccountId, mockAddress, tonTransactionResponse } from "../fixtures/common.fixtures";
8
+
9
+ describe("Transaction functions", () => {
10
+ describe("mapTxToOps", () => {
11
+ it.skip("should map an IN ton transaction without total_fees to a ledger operation", async () => {
12
+ const { now, lt, hash, in_msg, total_fees, mc_block_seqno } =
13
+ tonTransactionResponse.transactions[0];
14
+
15
+ const finalOperation = flatMap(
16
+ tonTransactionResponse.transactions,
17
+ mapTxToOps(mockAccountId, mockAddress, tonTransactionResponse.address_book),
18
+ );
19
+
20
+ expect(finalOperation).toEqual([
21
+ {
22
+ accountId: mockAccountId,
23
+ blockHash: null,
24
+ blockHeight: mc_block_seqno,
25
+ date: new Date(now * 1000), // now is defined in seconds
26
+ extra: { comment: { isEncrypted: false, text: "" }, explorerHash: hash, lt },
27
+ fee: BigNumber(total_fees),
28
+ hasFailed: false,
29
+ hash: in_msg?.hash,
30
+ id: encodeOperationId(mockAccountId, in_msg?.hash ?? "", "IN"),
31
+ recipients: [in_msg?.destination],
32
+ senders: ["EQCVnqqL0OOiZi2BQnjVGm-ZeUYgfUhHgAi-vn9F8-94HwrH"],
33
+ type: "IN",
34
+ value: BigNumber(in_msg?.value ?? 0),
35
+ },
36
+ ]);
37
+ });
38
+
39
+ it.skip("should map an IN ton transaction with total_fees to a ledger operation", async () => {
40
+ const transactions = [{ ...tonTransactionResponse.transactions[0], total_fees: "15" }];
41
+ const { now, lt, hash, in_msg, total_fees, mc_block_seqno, account } = transactions[0];
42
+
43
+ const finalOperation = flatMap(
44
+ transactions,
45
+ mapTxToOps(mockAccountId, mockAddress, tonTransactionResponse.address_book),
46
+ );
47
+
48
+ expect(finalOperation).toEqual([
49
+ {
50
+ id: encodeOperationId(mockAccountId, in_msg?.hash ?? "", "NONE"),
51
+ hash: in_msg?.hash,
52
+ type: "NONE",
53
+ value: BigNumber(total_fees),
54
+ fee: BigNumber(0),
55
+ blockHash: null,
56
+ blockHeight: mc_block_seqno,
57
+ hasFailed: false,
58
+ accountId: mockAccountId,
59
+ senders: [account],
60
+ recipients: [],
61
+ date: new Date(now * 1000), // now is defined in seconds
62
+ extra: { comment: { isEncrypted: false, text: "" }, explorerHash: hash, lt },
63
+ },
64
+ {
65
+ accountId: mockAccountId,
66
+ blockHash: null,
67
+ blockHeight: mc_block_seqno,
68
+ date: new Date(now * 1000), // now is defined in seconds
69
+ extra: { comment: { isEncrypted: false, text: "" }, explorerHash: hash, lt },
70
+ fee: BigNumber(total_fees),
71
+ hasFailed: false,
72
+ hash: in_msg?.hash,
73
+ id: encodeOperationId(mockAccountId, in_msg?.hash ?? "", "IN"),
74
+ recipients: [in_msg?.destination],
75
+ senders: ["EQCVnqqL0OOiZi2BQnjVGm-ZeUYgfUhHgAi-vn9F8-94HwrH"],
76
+ type: "IN",
77
+ value: BigNumber(in_msg?.value ?? 0),
78
+ },
79
+ ]);
80
+ });
81
+
82
+ it.skip("should map an OUT ton transaction to a ledger operation", async () => {
83
+ // The IN transaction will be used as OUT transaction and it will be adjusted
84
+ const transactions: TonTransaction[] = [
85
+ {
86
+ ...tonTransactionResponse.transactions[0],
87
+ in_msg: null,
88
+ },
89
+ ];
90
+ if (tonTransactionResponse.transactions[0].in_msg) {
91
+ transactions[0].out_msgs = [
92
+ { ...tonTransactionResponse.transactions[0].in_msg, source: transactions[0].account },
93
+ ];
94
+ }
95
+ const { now, lt, hash, out_msgs, total_fees, mc_block_seqno, account } = transactions[0];
96
+
97
+ const finalOperation = flatMap(
98
+ transactions,
99
+ mapTxToOps(mockAccountId, mockAddress, tonTransactionResponse.address_book),
100
+ );
101
+
102
+ expect(finalOperation).toEqual([
103
+ {
104
+ id: encodeOperationId(mockAccountId, hash ?? "", "OUT"),
105
+ hash: out_msgs?.[0].hash,
106
+ type: "OUT",
107
+ value: BigNumber(out_msgs[0].value ?? 0).plus(BigNumber(total_fees)),
108
+ fee: BigNumber(total_fees),
109
+ blockHeight: mc_block_seqno,
110
+ blockHash: null,
111
+ hasFailed: false,
112
+ accountId: mockAccountId,
113
+ senders: [account],
114
+ recipients: ["EQDzd8aeBOU-jqYw_ZSuZjceI5p-F4b7HMprAsUJAtRPbJfg"],
115
+ date: new Date(now * 1000), // now is defined in seconds
116
+ extra: { comment: { isEncrypted: false, text: "" }, explorerHash: hash, lt },
117
+ },
118
+ ]);
119
+ });
120
+ });
121
+ });
@@ -0,0 +1,126 @@
1
+ import { Address } from "@ton/core";
2
+ import { TonComment } from "../../types";
3
+ import {
4
+ addressesAreEqual,
5
+ buildTonTransaction,
6
+ commentIsValid,
7
+ getLedgerTonPath,
8
+ getTransferExpirationTime,
9
+ isAddressValid,
10
+ } from "../../utils";
11
+ import { transaction as baseTransaction } from "../fixtures/common.fixtures";
12
+
13
+ describe("TON addresses", () => {
14
+ const addr = {
15
+ raw: "0:074c7194d64e8218f2cfaab8e79b34201adbed0f8fa7f2773e604dd39969b5ff",
16
+ rawWrong: "0:074c7194d64e8218f2cfaab8e79b34201adbed0f8fa7f2773e604dd39969b5f",
17
+ bounceUrl: "EQAHTHGU1k6CGPLPqrjnmzQgGtvtD4-n8nc-YE3TmWm1_1JZ",
18
+ bounceNoUrl: "EQAHTHGU1k6CGPLPqrjnmzQgGtvtD4+n8nc+YE3TmWm1/1JZ",
19
+ bounceWrong: "EQAHTHGU1k6CGPLPqrjnmzQgGtvtD4+n8nc+YE3TmWm1/1J",
20
+ noBounceUrl: "UQAHTHGU1k6CGPLPqrjnmzQgGtvtD4-n8nc-YE3TmWm1_w-c",
21
+ noBounceNoUrl: "UQAHTHGU1k6CGPLPqrjnmzQgGtvtD4+n8nc+YE3TmWm1/w+c",
22
+ noBounceWrong: "UQAHTHGU1k6CGPLPqrjnmzQgGtvtD4+n8nc+YE3TmWm1/w+",
23
+ diff: "UQBjrXgZbYDCpxLKpgMnBe985kYDfUeriuYUafbuKgdBpWuJ",
24
+ };
25
+ test("Check if addresses are valid", () => {
26
+ expect(isAddressValid(addr.raw)).toBe(true);
27
+ expect(isAddressValid(addr.bounceUrl)).toBe(true);
28
+ expect(isAddressValid(addr.bounceNoUrl)).toBe(true);
29
+ expect(isAddressValid(addr.noBounceUrl)).toBe(true);
30
+ expect(isAddressValid(addr.noBounceNoUrl)).toBe(true);
31
+ expect(isAddressValid(addr.rawWrong)).toBe(false);
32
+ expect(isAddressValid(addr.bounceWrong)).toBe(false);
33
+ expect(isAddressValid(addr.noBounceWrong)).toBe(false);
34
+ expect(isAddressValid(addr.diff)).toBe(true);
35
+ });
36
+ test("Compare addresses", () => {
37
+ expect(addressesAreEqual(addr.raw, addr.bounceUrl)).toBe(true);
38
+ expect(addressesAreEqual(addr.raw, addr.noBounceUrl)).toBe(true);
39
+ expect(addressesAreEqual(addr.bounceUrl, addr.noBounceUrl)).toBe(true);
40
+ expect(addressesAreEqual(addr.rawWrong, addr.noBounceUrl)).toBe(false);
41
+ expect(addressesAreEqual(addr.noBounceNoUrl, addr.diff)).toBe(false);
42
+ });
43
+ });
44
+
45
+ test("TON Comments are valid", () => {
46
+ const msg = (e: boolean, m: string): TonComment => ({ isEncrypted: e, text: m });
47
+ expect(commentIsValid(msg(false, ""))).toBe(true);
48
+ expect(commentIsValid(msg(false, "Hello world!"))).toBe(true);
49
+ expect(
50
+ commentIsValid(
51
+ msg(
52
+ false,
53
+ " 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789", // 120 chars
54
+ ),
55
+ ),
56
+ ).toBe(true);
57
+ expect(
58
+ commentIsValid(
59
+ msg(
60
+ false,
61
+ " 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 ", // 121 chars
62
+ ),
63
+ ),
64
+ ).toBe(false);
65
+ expect(commentIsValid(msg(false, "😀"))).toBe(false);
66
+ expect(commentIsValid(msg(true, ""))).toBe(false);
67
+ });
68
+
69
+ describe("Get TON paths", () => {
70
+ const correctPath = ["44'/607'/0'/0'/0'/0'", "m/44'/607'/0'/0'/0'/0'"];
71
+ const wrongPaths = [
72
+ "44'/607'/0'/0'/0'",
73
+ "44'/607'/0'/0/'/0'",
74
+ "44'/607'/0'/0'/x'/0'",
75
+ "44'/607'/0'/-3'/0'/0'",
76
+ "44'/607'/0'/2147483650'/0'/0'",
77
+ ];
78
+
79
+ test("Correct paths return a correct response", () => {
80
+ correctPath.map((path: string) => {
81
+ expect(getLedgerTonPath(path)).toStrictEqual([44, 607, 0, 0, 0, 0]);
82
+ });
83
+ });
84
+
85
+ test("Wrong paths fail", () => {
86
+ wrongPaths.map((path: string) => {
87
+ expect(() => getLedgerTonPath(path)).toThrow(/^(\[ton\] Path)/);
88
+ });
89
+ });
90
+ });
91
+
92
+ describe("Build TON transaction", () => {
93
+ const seqno = 22;
94
+
95
+ test("Build TON transaction with an specific amount", () => {
96
+ const tonTransaction = buildTonTransaction(baseTransaction, seqno);
97
+
98
+ // Convert the Address to string to compare
99
+ expect({ ...tonTransaction, to: tonTransaction.to.toString() }).toEqual({
100
+ to: Address.parse(baseTransaction.recipient).toString(),
101
+ seqno,
102
+ amount: BigInt(baseTransaction.amount.toString()),
103
+ bounce: false,
104
+ timeout: getTransferExpirationTime(),
105
+ sendMode: 3,
106
+ });
107
+ });
108
+
109
+ test("Build TON transaction when useAllAmount is true and there is a comment", () => {
110
+ const transaction = { ...baseTransaction };
111
+ transaction.useAllAmount = true;
112
+ transaction.comment.text = "valid coment";
113
+ const tonTransaction = buildTonTransaction(transaction, seqno);
114
+
115
+ // Convert the Address to string to compare
116
+ expect({ ...tonTransaction, to: tonTransaction.to.toString() }).toEqual({
117
+ to: Address.parse(transaction.recipient).toString(),
118
+ seqno,
119
+ amount: BigInt(0),
120
+ bounce: false,
121
+ timeout: getTransferExpirationTime(),
122
+ sendMode: 128,
123
+ payload: { type: "comment", text: transaction.comment.text },
124
+ });
125
+ });
126
+ });
@@ -0,0 +1,104 @@
1
+ import network from "@ledgerhq/live-network";
2
+ import { Address } from "@ton/ton";
3
+ import { getCoinConfig } from "../../config";
4
+ import {
5
+ TonAccountInfo,
6
+ TonFee,
7
+ TonResponseAccountInfo,
8
+ TonResponseEstimateFee,
9
+ TonResponseMasterchainInfo,
10
+ TonResponseMessage,
11
+ TonResponseWalletInfo,
12
+ TonTransactionsList,
13
+ } from "./api.types";
14
+
15
+ const getTonUrl = (path?: string): string => {
16
+ const currencyConfig = getCoinConfig();
17
+
18
+ return `${currencyConfig.infra.API_TON_ENDPOINT}${path ?? ""}`;
19
+ };
20
+
21
+ const fetch = async <T>(path: string): Promise<T> => {
22
+ const url = getTonUrl(path);
23
+
24
+ const { data } = await network<T>({
25
+ method: "GET",
26
+ url,
27
+ });
28
+
29
+ return data;
30
+ };
31
+
32
+ const send = async <T>(path: string, data: Record<string, unknown>) => {
33
+ const url = getTonUrl(path);
34
+
35
+ const { data: dataResponse } = await network<T>({
36
+ method: "POST",
37
+ url,
38
+ data: JSON.stringify(data),
39
+ headers: { "Content-Type": "application/json" },
40
+ });
41
+
42
+ return dataResponse;
43
+ };
44
+
45
+ export async function fetchLastBlockNumber(): Promise<number> {
46
+ const data = await fetch<TonResponseMasterchainInfo>("/masterchainInfo");
47
+ return data.last.seqno;
48
+ }
49
+
50
+ export async function fetchTransactions(
51
+ addr: string,
52
+ opts?: { startLt?: string; endLt?: string },
53
+ ): Promise<TonTransactionsList> {
54
+ const address = Address.parse(addr);
55
+ const urlAddr = address.toString({ bounceable: false, urlSafe: true });
56
+ let url = `/transactions?account=${urlAddr}&limit=256`;
57
+ if (opts?.startLt != null) url += `&start_lt=${opts.startLt}`;
58
+ if (opts?.endLt != null) url += `&end_lt=${opts.endLt}`;
59
+ return await fetch<TonTransactionsList>(url);
60
+ }
61
+
62
+ export async function fetchAccountInfo(addr: string): Promise<TonAccountInfo> {
63
+ const address = Address.parse(addr);
64
+ const urlAddr = address.toString({ bounceable: false, urlSafe: true });
65
+ const data = await fetch<TonResponseAccountInfo>(`/account?address=${urlAddr}`);
66
+ if (data.status === "uninit" || data.status === "nonexist") {
67
+ return {
68
+ balance: data.balance,
69
+ last_transaction_lt: data.last_transaction_lt,
70
+ last_transaction_hash: data.last_transaction_hash,
71
+ status: data.status,
72
+ seqno: 0,
73
+ };
74
+ }
75
+ const { seqno } = await fetch<TonResponseWalletInfo>(`/wallet?address=${urlAddr}`);
76
+ return {
77
+ balance: data.balance,
78
+ last_transaction_lt: data.last_transaction_lt,
79
+ last_transaction_hash: data.last_transaction_hash,
80
+ status: data.status,
81
+ seqno: seqno || 0,
82
+ };
83
+ }
84
+
85
+ export async function estimateFee(
86
+ address: string,
87
+ body: string,
88
+ initCode?: string,
89
+ initData?: string,
90
+ ): Promise<TonFee> {
91
+ return (
92
+ await send<TonResponseEstimateFee>("/estimateFee", {
93
+ address,
94
+ body,
95
+ init_code: initCode,
96
+ init_data: initData,
97
+ ignore_chksig: true,
98
+ })
99
+ ).source_fees;
100
+ }
101
+
102
+ export async function broadcastTx(bocBase64: string): Promise<string> {
103
+ return (await send<TonResponseMessage>("/message", { boc: bocBase64 })).message_hash;
104
+ }
@@ -0,0 +1,178 @@
1
+ type TonAccountStatus = "uninit" | "frozen" | "active" | "nonexist";
2
+
3
+ interface TonAccountState {
4
+ hash: string;
5
+ balance: string | null;
6
+ account_status: TonAccountStatus | null;
7
+ frozen_hash: string | null;
8
+ code_hash: string | null;
9
+ data_hash: string | null;
10
+ }
11
+
12
+ interface TonMessage {
13
+ hash: string;
14
+ source: string | null;
15
+ destination: string | null;
16
+ value: string | null;
17
+ fwd_fee: string | null;
18
+ ihr_fee: string | null;
19
+ created_lt: string | null;
20
+ created_at: string | null;
21
+ opcode: string | null;
22
+ ihr_disabled: boolean | null;
23
+ bounce: boolean | null;
24
+ bounced: boolean | null;
25
+ import_fee: string | null;
26
+ message_content: {
27
+ hash: string;
28
+ body: string;
29
+ decoded:
30
+ | {
31
+ type: "text_comment";
32
+ comment: string;
33
+ }
34
+ | {
35
+ type: "binary_comment";
36
+ hex_comment: string;
37
+ }
38
+ | null;
39
+ } | null;
40
+ init_state: { hash: string; body: string } | null;
41
+ }
42
+
43
+ interface BlockReference {
44
+ workchain: number;
45
+ shard: string;
46
+ seqno: number;
47
+ }
48
+
49
+ interface TonBlock {
50
+ workchain: number;
51
+ shard: string;
52
+ seqno: number;
53
+ root_hash: string;
54
+ file_hash: string;
55
+ global_id: number;
56
+ version: number;
57
+ after_merge: boolean;
58
+ before_split: boolean;
59
+ after_split: boolean;
60
+ want_merge: boolean;
61
+ want_split: boolean;
62
+ key_block: boolean;
63
+ vert_seqno_incr: boolean;
64
+ flags: number;
65
+ gen_utime: string;
66
+ start_lt: string;
67
+ end_lt: string;
68
+ validator_list_hash_short: number;
69
+ gen_catchain_seqno: number;
70
+ min_ref_mc_seqno: number;
71
+ prev_key_block_seqno: number;
72
+ vert_seqno: number;
73
+ master_ref_seqno: number | null;
74
+ rand_seed: string;
75
+ created_by: string;
76
+ tx_count: number | null;
77
+ masterchain_block_ref: BlockReference | null;
78
+ prev_blocks: BlockReference[];
79
+ }
80
+
81
+ interface TrComputePhase {
82
+ exit_code: number;
83
+ success: boolean;
84
+ }
85
+
86
+ interface TonDescription {
87
+ aborted: boolean;
88
+ compute_ph: TrComputePhase;
89
+ credit_first: boolean;
90
+ storage_ph?: unknown;
91
+ credit_ph?: unknown;
92
+ action?: unknown;
93
+ bounce?: unknown;
94
+ destroyed: boolean;
95
+ }
96
+
97
+ export interface TonTransaction {
98
+ account: string;
99
+ hash: string;
100
+ lt: string;
101
+ now: number;
102
+ orig_status: TonAccountStatus;
103
+ end_status: TonAccountStatus;
104
+ total_fees: string;
105
+ prev_trans_hash: string;
106
+ prev_trans_lt: string;
107
+ description: TonDescription;
108
+ block_ref: {
109
+ workchain: number;
110
+ shard: string;
111
+ seqno: number;
112
+ } | null;
113
+ in_msg: TonMessage | null;
114
+ out_msgs: TonMessage[];
115
+ account_state_before: TonAccountState | null;
116
+ account_state_after: TonAccountState | null;
117
+ mc_block_seqno: number | null;
118
+ }
119
+
120
+ export interface TonAddressBook {
121
+ [key: string]: {
122
+ user_friendly: string;
123
+ };
124
+ }
125
+
126
+ export interface TonAccountInfo {
127
+ balance: string;
128
+ last_transaction_lt: string | null;
129
+ last_transaction_hash: string | null;
130
+ status: TonAccountStatus;
131
+ seqno: number;
132
+ }
133
+
134
+ export interface TonFee {
135
+ in_fwd_fee: number;
136
+ storage_fee: number;
137
+ gas_fee: number;
138
+ fwd_fee: number;
139
+ }
140
+
141
+ export interface TonResponseMasterchainInfo {
142
+ first: TonBlock;
143
+ last: TonBlock;
144
+ }
145
+
146
+ export interface TonTransactionsList {
147
+ transactions: TonTransaction[];
148
+ address_book: TonAddressBook;
149
+ }
150
+
151
+ export interface TonResponseAccountInfo {
152
+ balance: string;
153
+ code: string | null;
154
+ data: string | null;
155
+ last_transaction_lt: string | null;
156
+ last_transaction_hash: string | null;
157
+ frozen_hash: string | null;
158
+ status: TonAccountStatus;
159
+ }
160
+
161
+ export interface TonResponseWalletInfo {
162
+ balance: string;
163
+ wallet_type: string | null;
164
+ seqno: number | null;
165
+ wallet_id: number | null;
166
+ last_transaction_lt: string | null;
167
+ last_transaction_hash: string | null;
168
+ status: TonAccountStatus;
169
+ }
170
+
171
+ export interface TonResponseEstimateFee {
172
+ source_fees: TonFee;
173
+ destination_fees: TonFee[];
174
+ }
175
+
176
+ export interface TonResponseMessage {
177
+ message_hash: string;
178
+ }