@ledgerhq/coin-tron 0.0.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 (351) hide show
  1. package/.eslintrc.js +20 -0
  2. package/.turbo/turbo-build.log +4 -0
  3. package/.unimportedrc.json +25 -0
  4. package/LICENSE.txt +21 -0
  5. package/jest.config.js +8 -0
  6. package/jest.integ.config.js +7 -0
  7. package/lib/bridge/broadcast.d.ts +7 -0
  8. package/lib/bridge/broadcast.d.ts.map +1 -0
  9. package/lib/bridge/broadcast.js +26 -0
  10. package/lib/bridge/broadcast.js.map +1 -0
  11. package/lib/bridge/buildOptimisticOperation.d.ts +5 -0
  12. package/lib/bridge/buildOptimisticOperation.d.ts.map +1 -0
  13. package/lib/bridge/buildOptimisticOperation.js +101 -0
  14. package/lib/bridge/buildOptimisticOperation.js.map +1 -0
  15. package/lib/bridge/createTransaction.d.ts +4 -0
  16. package/lib/bridge/createTransaction.d.ts.map +1 -0
  17. package/lib/bridge/createTransaction.js +19 -0
  18. package/lib/bridge/createTransaction.js.map +1 -0
  19. package/lib/bridge/deviceTransactionConfig.d.ts +20 -0
  20. package/lib/bridge/deviceTransactionConfig.d.ts.map +1 -0
  21. package/lib/bridge/deviceTransactionConfig.js +65 -0
  22. package/lib/bridge/deviceTransactionConfig.js.map +1 -0
  23. package/lib/bridge/estimateMaxSpendable.d.ts +5 -0
  24. package/lib/bridge/estimateMaxSpendable.d.ts.map +1 -0
  25. package/lib/bridge/estimateMaxSpendable.js +30 -0
  26. package/lib/bridge/estimateMaxSpendable.js.map +1 -0
  27. package/lib/bridge/getEstimateFees.d.ts +6 -0
  28. package/lib/bridge/getEstimateFees.d.ts.map +1 -0
  29. package/lib/bridge/getEstimateFees.js +52 -0
  30. package/lib/bridge/getEstimateFees.js.map +1 -0
  31. package/lib/bridge/getTransactionStatus.d.ts +4 -0
  32. package/lib/bridge/getTransactionStatus.d.ts.map +1 -0
  33. package/lib/bridge/getTransactionStatus.js +218 -0
  34. package/lib/bridge/getTransactionStatus.js.map +1 -0
  35. package/lib/bridge/index.d.ts +10 -0
  36. package/lib/bridge/index.d.ts.map +1 -0
  37. package/lib/bridge/index.js +60 -0
  38. package/lib/bridge/index.js.map +1 -0
  39. package/lib/bridge/preload.d.ts +8 -0
  40. package/lib/bridge/preload.d.ts.map +1 -0
  41. package/lib/bridge/preload.js +32 -0
  42. package/lib/bridge/preload.js.map +1 -0
  43. package/lib/bridge/prepareTransaction.d.ts +4 -0
  44. package/lib/bridge/prepareTransaction.d.ts.map +1 -0
  45. package/lib/bridge/prepareTransaction.js +19 -0
  46. package/lib/bridge/prepareTransaction.js.map +1 -0
  47. package/lib/bridge/serialization.d.ts +9 -0
  48. package/lib/bridge/serialization.d.ts.map +1 -0
  49. package/lib/bridge/serialization.js +238 -0
  50. package/lib/bridge/serialization.js.map +1 -0
  51. package/lib/bridge/signOperation.d.ts +5 -0
  52. package/lib/bridge/signOperation.d.ts.map +1 -0
  53. package/lib/bridge/signOperation.js +92 -0
  54. package/lib/bridge/signOperation.js.map +1 -0
  55. package/lib/bridge/synchronization.d.ts +5 -0
  56. package/lib/bridge/synchronization.d.ts.map +1 -0
  57. package/lib/bridge/synchronization.integ.test.d.ts +3 -0
  58. package/lib/bridge/synchronization.integ.test.d.ts.map +1 -0
  59. package/lib/bridge/synchronization.integ.test.js +96 -0
  60. package/lib/bridge/synchronization.integ.test.js.map +1 -0
  61. package/lib/bridge/synchronization.js +216 -0
  62. package/lib/bridge/synchronization.js.map +1 -0
  63. package/lib/bridge/transaction.d.ts +15 -0
  64. package/lib/bridge/transaction.d.ts.map +1 -0
  65. package/lib/bridge/transaction.js +61 -0
  66. package/lib/bridge/transaction.js.map +1 -0
  67. package/lib/config.d.ts +10 -0
  68. package/lib/config.d.ts.map +1 -0
  69. package/lib/config.js +17 -0
  70. package/lib/config.js.map +1 -0
  71. package/lib/index.d.ts +3 -0
  72. package/lib/index.d.ts.map +1 -0
  73. package/lib/index.js +21 -0
  74. package/lib/index.js.map +1 -0
  75. package/lib/logic/constants.d.ts +4 -0
  76. package/lib/logic/constants.d.ts.map +1 -0
  77. package/lib/logic/constants.js +7 -0
  78. package/lib/logic/constants.js.map +1 -0
  79. package/lib/logic/pagination.d.ts +3 -0
  80. package/lib/logic/pagination.d.ts.map +1 -0
  81. package/lib/logic/pagination.js +19 -0
  82. package/lib/logic/pagination.js.map +1 -0
  83. package/lib/logic/utils.d.ts +12 -0
  84. package/lib/logic/utils.d.ts.map +1 -0
  85. package/lib/logic/utils.js +177 -0
  86. package/lib/logic/utils.js.map +1 -0
  87. package/lib/network/format.d.ts +9 -0
  88. package/lib/network/format.d.ts.map +1 -0
  89. package/lib/network/format.js +127 -0
  90. package/lib/network/format.js.map +1 -0
  91. package/lib/network/index.d.ts +30 -0
  92. package/lib/network/index.d.ts.map +1 -0
  93. package/lib/network/index.integ.test.d.ts +2 -0
  94. package/lib/network/index.integ.test.d.ts.map +1 -0
  95. package/lib/network/index.integ.test.js +38 -0
  96. package/lib/network/index.integ.test.js.map +1 -0
  97. package/lib/network/index.js +555 -0
  98. package/lib/network/index.js.map +1 -0
  99. package/lib/network/index.test.d.ts +2 -0
  100. package/lib/network/index.test.d.ts.map +1 -0
  101. package/lib/network/index.test.js +66 -0
  102. package/lib/network/index.test.js.map +1 -0
  103. package/lib/network/superRepresentativesData.mock.d.ts +69 -0
  104. package/lib/network/superRepresentativesData.mock.d.ts.map +1 -0
  105. package/lib/network/superRepresentativesData.mock.js +2208 -0
  106. package/lib/network/superRepresentativesData.mock.js.map +1 -0
  107. package/lib/network/types.d.ts +122 -0
  108. package/lib/network/types.d.ts.map +1 -0
  109. package/lib/network/types.fixture.d.ts +498 -0
  110. package/lib/network/types.fixture.d.ts.map +1 -0
  111. package/lib/network/types.fixture.js +4375 -0
  112. package/lib/network/types.fixture.js.map +1 -0
  113. package/lib/network/types.js +13 -0
  114. package/lib/network/types.js.map +1 -0
  115. package/lib/signer/getAddress.d.ts +6 -0
  116. package/lib/signer/getAddress.d.ts.map +1 -0
  117. package/lib/signer/getAddress.js +19 -0
  118. package/lib/signer/getAddress.js.map +1 -0
  119. package/lib/signer/index.d.ts +6 -0
  120. package/lib/signer/index.d.ts.map +1 -0
  121. package/lib/signer/index.js +11 -0
  122. package/lib/signer/index.js.map +1 -0
  123. package/lib/test/bot-deviceActions.d.ts +4 -0
  124. package/lib/test/bot-deviceActions.d.ts.map +1 -0
  125. package/lib/test/bot-deviceActions.js +103 -0
  126. package/lib/test/bot-deviceActions.js.map +1 -0
  127. package/lib/test/bot-specs.d.ts +7 -0
  128. package/lib/test/bot-specs.d.ts.map +1 -0
  129. package/lib/test/bot-specs.js +433 -0
  130. package/lib/test/bot-specs.js.map +1 -0
  131. package/lib/test/bridgeDatasetTest.d.ts +4 -0
  132. package/lib/test/bridgeDatasetTest.d.ts.map +1 -0
  133. package/lib/test/bridgeDatasetTest.js +1284 -0
  134. package/lib/test/bridgeDatasetTest.js.map +1 -0
  135. package/lib/test/cli.d.ts +52 -0
  136. package/lib/test/cli.d.ts.map +1 -0
  137. package/lib/test/cli.js +155 -0
  138. package/lib/test/cli.js.map +1 -0
  139. package/lib/test/index.d.ts +6 -0
  140. package/lib/test/index.d.ts.map +1 -0
  141. package/lib/test/index.js +26 -0
  142. package/lib/test/index.js.map +1 -0
  143. package/lib/types/bridge.d.ts +245 -0
  144. package/lib/types/bridge.d.ts.map +1 -0
  145. package/lib/types/bridge.js +16 -0
  146. package/lib/types/bridge.js.map +1 -0
  147. package/lib/types/errors.d.ts +49 -0
  148. package/lib/types/errors.d.ts.map +1 -0
  149. package/lib/types/errors.js +21 -0
  150. package/lib/types/errors.js.map +1 -0
  151. package/lib/types/index.d.ts +4 -0
  152. package/lib/types/index.d.ts.map +1 -0
  153. package/lib/types/index.js +21 -0
  154. package/lib/types/index.js.map +1 -0
  155. package/lib/types/signer.d.ts +10 -0
  156. package/lib/types/signer.d.ts.map +1 -0
  157. package/lib/types/signer.js +3 -0
  158. package/lib/types/signer.js.map +1 -0
  159. package/lib-es/bridge/broadcast.d.ts +7 -0
  160. package/lib-es/bridge/broadcast.d.ts.map +1 -0
  161. package/lib-es/bridge/broadcast.js +24 -0
  162. package/lib-es/bridge/broadcast.js.map +1 -0
  163. package/lib-es/bridge/buildOptimisticOperation.d.ts +5 -0
  164. package/lib-es/bridge/buildOptimisticOperation.d.ts.map +1 -0
  165. package/lib-es/bridge/buildOptimisticOperation.js +94 -0
  166. package/lib-es/bridge/buildOptimisticOperation.js.map +1 -0
  167. package/lib-es/bridge/createTransaction.d.ts +4 -0
  168. package/lib-es/bridge/createTransaction.d.ts.map +1 -0
  169. package/lib-es/bridge/createTransaction.js +14 -0
  170. package/lib-es/bridge/createTransaction.js.map +1 -0
  171. package/lib-es/bridge/deviceTransactionConfig.d.ts +20 -0
  172. package/lib-es/bridge/deviceTransactionConfig.d.ts.map +1 -0
  173. package/lib-es/bridge/deviceTransactionConfig.js +63 -0
  174. package/lib-es/bridge/deviceTransactionConfig.js.map +1 -0
  175. package/lib-es/bridge/estimateMaxSpendable.d.ts +5 -0
  176. package/lib-es/bridge/estimateMaxSpendable.d.ts.map +1 -0
  177. package/lib-es/bridge/estimateMaxSpendable.js +25 -0
  178. package/lib-es/bridge/estimateMaxSpendable.js.map +1 -0
  179. package/lib-es/bridge/getEstimateFees.d.ts +6 -0
  180. package/lib-es/bridge/getEstimateFees.d.ts.map +1 -0
  181. package/lib-es/bridge/getEstimateFees.js +47 -0
  182. package/lib-es/bridge/getEstimateFees.js.map +1 -0
  183. package/lib-es/bridge/getTransactionStatus.d.ts +4 -0
  184. package/lib-es/bridge/getTransactionStatus.d.ts.map +1 -0
  185. package/lib-es/bridge/getTransactionStatus.js +213 -0
  186. package/lib-es/bridge/getTransactionStatus.js.map +1 -0
  187. package/lib-es/bridge/index.d.ts +10 -0
  188. package/lib-es/bridge/index.d.ts.map +1 -0
  189. package/lib-es/bridge/index.js +53 -0
  190. package/lib-es/bridge/index.js.map +1 -0
  191. package/lib-es/bridge/preload.d.ts +8 -0
  192. package/lib-es/bridge/preload.d.ts.map +1 -0
  193. package/lib-es/bridge/preload.js +27 -0
  194. package/lib-es/bridge/preload.js.map +1 -0
  195. package/lib-es/bridge/prepareTransaction.d.ts +4 -0
  196. package/lib-es/bridge/prepareTransaction.d.ts.map +1 -0
  197. package/lib-es/bridge/prepareTransaction.js +15 -0
  198. package/lib-es/bridge/prepareTransaction.js.map +1 -0
  199. package/lib-es/bridge/serialization.d.ts +9 -0
  200. package/lib-es/bridge/serialization.d.ts.map +1 -0
  201. package/lib-es/bridge/serialization.js +229 -0
  202. package/lib-es/bridge/serialization.js.map +1 -0
  203. package/lib-es/bridge/signOperation.d.ts +5 -0
  204. package/lib-es/bridge/signOperation.d.ts.map +1 -0
  205. package/lib-es/bridge/signOperation.js +85 -0
  206. package/lib-es/bridge/signOperation.js.map +1 -0
  207. package/lib-es/bridge/synchronization.d.ts +5 -0
  208. package/lib-es/bridge/synchronization.d.ts.map +1 -0
  209. package/lib-es/bridge/synchronization.integ.test.d.ts +3 -0
  210. package/lib-es/bridge/synchronization.integ.test.d.ts.map +1 -0
  211. package/lib-es/bridge/synchronization.integ.test.js +89 -0
  212. package/lib-es/bridge/synchronization.integ.test.js.map +1 -0
  213. package/lib-es/bridge/synchronization.js +209 -0
  214. package/lib-es/bridge/synchronization.js.map +1 -0
  215. package/lib-es/bridge/transaction.d.ts +15 -0
  216. package/lib-es/bridge/transaction.d.ts.map +1 -0
  217. package/lib-es/bridge/transaction.js +55 -0
  218. package/lib-es/bridge/transaction.js.map +1 -0
  219. package/lib-es/config.d.ts +10 -0
  220. package/lib-es/config.d.ts.map +1 -0
  221. package/lib-es/config.js +12 -0
  222. package/lib-es/config.js.map +1 -0
  223. package/lib-es/index.d.ts +3 -0
  224. package/lib-es/index.d.ts.map +1 -0
  225. package/lib-es/index.js +3 -0
  226. package/lib-es/index.js.map +1 -0
  227. package/lib-es/logic/constants.d.ts +4 -0
  228. package/lib-es/logic/constants.d.ts.map +1 -0
  229. package/lib-es/logic/constants.js +4 -0
  230. package/lib-es/logic/constants.js.map +1 -0
  231. package/lib-es/logic/pagination.d.ts +3 -0
  232. package/lib-es/logic/pagination.d.ts.map +1 -0
  233. package/lib-es/logic/pagination.js +15 -0
  234. package/lib-es/logic/pagination.js.map +1 -0
  235. package/lib-es/logic/utils.d.ts +12 -0
  236. package/lib-es/logic/utils.d.ts.map +1 -0
  237. package/lib-es/logic/utils.js +167 -0
  238. package/lib-es/logic/utils.js.map +1 -0
  239. package/lib-es/network/format.d.ts +9 -0
  240. package/lib-es/network/format.d.ts.map +1 -0
  241. package/lib-es/network/format.js +117 -0
  242. package/lib-es/network/format.js.map +1 -0
  243. package/lib-es/network/index.d.ts +30 -0
  244. package/lib-es/network/index.d.ts.map +1 -0
  245. package/lib-es/network/index.integ.test.d.ts +2 -0
  246. package/lib-es/network/index.integ.test.d.ts.map +1 -0
  247. package/lib-es/network/index.integ.test.js +36 -0
  248. package/lib-es/network/index.integ.test.js.map +1 -0
  249. package/lib-es/network/index.js +524 -0
  250. package/lib-es/network/index.js.map +1 -0
  251. package/lib-es/network/index.test.d.ts +2 -0
  252. package/lib-es/network/index.test.d.ts.map +1 -0
  253. package/lib-es/network/index.test.js +63 -0
  254. package/lib-es/network/index.test.js.map +1 -0
  255. package/lib-es/network/superRepresentativesData.mock.d.ts +69 -0
  256. package/lib-es/network/superRepresentativesData.mock.d.ts.map +1 -0
  257. package/lib-es/network/superRepresentativesData.mock.js +2206 -0
  258. package/lib-es/network/superRepresentativesData.mock.js.map +1 -0
  259. package/lib-es/network/types.d.ts +122 -0
  260. package/lib-es/network/types.d.ts.map +1 -0
  261. package/lib-es/network/types.fixture.d.ts +498 -0
  262. package/lib-es/network/types.fixture.d.ts.map +1 -0
  263. package/lib-es/network/types.fixture.js +4371 -0
  264. package/lib-es/network/types.fixture.js.map +1 -0
  265. package/lib-es/network/types.js +8 -0
  266. package/lib-es/network/types.js.map +1 -0
  267. package/lib-es/signer/getAddress.d.ts +6 -0
  268. package/lib-es/signer/getAddress.d.ts.map +1 -0
  269. package/lib-es/signer/getAddress.js +17 -0
  270. package/lib-es/signer/getAddress.js.map +1 -0
  271. package/lib-es/signer/index.d.ts +6 -0
  272. package/lib-es/signer/index.d.ts.map +1 -0
  273. package/lib-es/signer/index.js +6 -0
  274. package/lib-es/signer/index.js.map +1 -0
  275. package/lib-es/test/bot-deviceActions.d.ts +4 -0
  276. package/lib-es/test/bot-deviceActions.d.ts.map +1 -0
  277. package/lib-es/test/bot-deviceActions.js +100 -0
  278. package/lib-es/test/bot-deviceActions.js.map +1 -0
  279. package/lib-es/test/bot-specs.d.ts +7 -0
  280. package/lib-es/test/bot-specs.d.ts.map +1 -0
  281. package/lib-es/test/bot-specs.js +428 -0
  282. package/lib-es/test/bot-specs.js.map +1 -0
  283. package/lib-es/test/bridgeDatasetTest.d.ts +4 -0
  284. package/lib-es/test/bridgeDatasetTest.d.ts.map +1 -0
  285. package/lib-es/test/bridgeDatasetTest.js +1278 -0
  286. package/lib-es/test/bridgeDatasetTest.js.map +1 -0
  287. package/lib-es/test/cli.d.ts +52 -0
  288. package/lib-es/test/cli.d.ts.map +1 -0
  289. package/lib-es/test/cli.js +149 -0
  290. package/lib-es/test/cli.js.map +1 -0
  291. package/lib-es/test/index.d.ts +6 -0
  292. package/lib-es/test/index.d.ts.map +1 -0
  293. package/lib-es/test/index.js +6 -0
  294. package/lib-es/test/index.js.map +1 -0
  295. package/lib-es/types/bridge.d.ts +245 -0
  296. package/lib-es/types/bridge.d.ts.map +1 -0
  297. package/lib-es/types/bridge.js +11 -0
  298. package/lib-es/types/bridge.js.map +1 -0
  299. package/lib-es/types/errors.d.ts +49 -0
  300. package/lib-es/types/errors.d.ts.map +1 -0
  301. package/lib-es/types/errors.js +18 -0
  302. package/lib-es/types/errors.js.map +1 -0
  303. package/lib-es/types/index.d.ts +4 -0
  304. package/lib-es/types/index.d.ts.map +1 -0
  305. package/lib-es/types/index.js +5 -0
  306. package/lib-es/types/index.js.map +1 -0
  307. package/lib-es/types/signer.d.ts +10 -0
  308. package/lib-es/types/signer.d.ts.map +1 -0
  309. package/lib-es/types/signer.js +2 -0
  310. package/lib-es/types/signer.js.map +1 -0
  311. package/package.json +133 -0
  312. package/src/bridge/broadcast.ts +24 -0
  313. package/src/bridge/buildOptimisticOperation.ts +133 -0
  314. package/src/bridge/createTransaction.ts +16 -0
  315. package/src/bridge/deviceTransactionConfig.ts +99 -0
  316. package/src/bridge/estimateMaxSpendable.ts +32 -0
  317. package/src/bridge/getEstimateFees.ts +52 -0
  318. package/src/bridge/getTransactionStatus.ts +263 -0
  319. package/src/bridge/index.ts +78 -0
  320. package/src/bridge/preload.ts +24 -0
  321. package/src/bridge/prepareTransaction.ts +12 -0
  322. package/src/bridge/serialization.ts +288 -0
  323. package/src/bridge/signOperation.ts +123 -0
  324. package/src/bridge/synchronization.integ.test.ts +105 -0
  325. package/src/bridge/synchronization.ts +284 -0
  326. package/src/bridge/transaction.ts +84 -0
  327. package/src/config.ts +24 -0
  328. package/src/index.ts +3 -0
  329. package/src/logic/constants.ts +4 -0
  330. package/src/logic/pagination.ts +21 -0
  331. package/src/logic/utils.ts +231 -0
  332. package/src/network/format.ts +148 -0
  333. package/src/network/index.integ.test.ts +33 -0
  334. package/src/network/index.test.ts +61 -0
  335. package/src/network/index.ts +747 -0
  336. package/src/network/superRepresentativesData.mock.ts +2205 -0
  337. package/src/network/types.fixture.ts +4476 -0
  338. package/src/network/types.ts +147 -0
  339. package/src/signer/getAddress.ts +13 -0
  340. package/src/signer/index.ts +7 -0
  341. package/src/test/bot-deviceActions.ts +121 -0
  342. package/src/test/bot-specs.ts +457 -0
  343. package/src/test/bridgeDatasetTest.ts +1343 -0
  344. package/src/test/cli.ts +219 -0
  345. package/src/test/index.ts +6 -0
  346. package/src/types/bridge.ts +304 -0
  347. package/src/types/errors.ts +22 -0
  348. package/src/types/index.ts +4 -0
  349. package/src/types/signer.ts +9 -0
  350. package/tsconfig.json +14 -0
  351. package/types/tronweb/index.d.ts +5 -0
@@ -0,0 +1,1278 @@
1
+ import { AmountRequired, InvalidAddress, InvalidAddressBecauseDestinationIsAlsoSource, NotEnoughBalance, RecipientRequired, } from "@ledgerhq/errors";
2
+ import { BigNumber } from "bignumber.js";
3
+ import invariant from "invariant";
4
+ import { TronInvalidFreezeAmount, TronInvalidUnDelegateResourceAmount, TronInvalidVoteCount, TronNoFrozenForBandwidth, TronNoFrozenForEnergy, TronNoReward, TronNoUnfrozenResource, TronNotEnoughTronPower, TronSendTrc20ToNewAccountForbidden, TronUnexpectedFees, TronVoteRequired, } from "../types/errors";
5
+ import { ACTIVATION_FEES } from "../logic/constants";
6
+ import { fromTransactionRaw } from "../bridge/transaction";
7
+ const unactivatedAddress = "TXFeV31qgUQYMLog3axKJeEBbXpQFtHsXD";
8
+ const activatedAddress1 = "TRqkRnAj6ceJFYAn2p1eE7aWrgBBwtdhS9";
9
+ const expectedTokenAccount = (a) => {
10
+ invariant(a && a.type === "TokenAccount", "expected token account");
11
+ return a;
12
+ };
13
+ const getTokenAccountId = (account, id) => expectedTokenAccount((account.subAccounts || []).find(a => expectedTokenAccount(a).token.id === id)).id;
14
+ const tron = {
15
+ FIXME_ignoreAccountFields: [
16
+ "tronResources.cacheTransactionInfoById", // this is a cache, don't save it
17
+ "tronResources.unwithdrawnReward", // it changes every vote cycles
18
+ "tronResources.bandwidth", // it changes if a tx is made
19
+ "tronResources.energy", // it keep changing?
20
+ ],
21
+ scanAccounts: [
22
+ {
23
+ name: "tron seed 1",
24
+ apdus: `
25
+ => e00200000d038000002c800000c380000000
26
+ <= 41049fc19cbc6d0f525b1c6947b4a36aec74b48e15f2531c5e7e58d272c9e926786da290eb3505d8fab9c83818c1174d9bc96fd18e0527365cba6b9534d43ad5052b2254546962427833526b4a4d6355394171357348337a376a5733455057676b324252419000
27
+ => e002000015058000002c800000c3800000000000000000000000
28
+ <= 41040897dbec3465fcfa24324d6be690bccab3bdb5bba7f7cbe756d58362336a91a4a8b9bdd0cb25cb97afdde08c85c2081f3a3a4ba96a012c91c835e992783ceca1225452716b526e416a3663654a4659416e3270316545376157726742427774646853399000
29
+ => e002000015058000002c800000c3800000010000000000000000
30
+ <= 4104af6028b35cd69b028df9bd1a8eccc9f7cc46ca916babe1b87500e17a65b8833e0d4a90e6ba7cfd76492378f43868cc48c89451362033cf5982f2fba92306fc95225448416534424e56787032393371677951457158456b484d705063717447373362699000
31
+ => e002000015058000002c800000c3800000020000000000000000
32
+ <= 410461936750537e962cb02353c8906cebfd61f35ee0b704be0a02640e5f2e0bb152c0614008db5753fc728cb4fd1eac47f843229ccb928890f3ac805d8cdb6b8e332254576570556e79427a487832616f45674e476f745a484379625a4a5a6531414864579000
33
+ => e002000015058000002c800000c3800000030000000000000000
34
+ <= 4104fd0fa05cefc7c50894935125c1777bba938043e19ad96fd62d4ee708e5bc5b610f401becc0b4ecb48370e1bbaf4afda6e11b425b424c8ff007205034164399392254544250424b316e386e5831566b5950683766734d35364b4c36473948524d3756639000
35
+ => e002000015058000002c800000c3800000040000000000000000
36
+ <= 41041da2283f752d855d858ea3b86ef44ed78def4878000e2508ed1a4ca5fce6a120a1f3edfbc14173577057b62e156f4a110410d886bb022e398cf607d8eb26f0c12254527a4164386b37386f623577545748657065447051727555754b596666683438789000
37
+ => e002000015058000002c800000c3800000050000000000000000
38
+ <= 4104dfeedfe3ec947d26b9b2be199c4d2a1b59b53ce8938fa37a3ebfccba5cd3432457987972d62f5ff7cebffba1655efe26324e25ae1c33d4c6b39d1ccf1a6c433f2254434b4655664672384555394356664b7a7138764c50786b5a5647347641657754649000
39
+ => e002000015058000002c800000c3800000060000000000000000
40
+ <= 4104f0bc4270d8d593486409062058abeabb87a0f2907b57d0f92a9173164e39b1a12a61ffce4c002f395cab8a790ccd00d41e056a32d285a01b218334d294abbf1f2254526552347a64464537384e614b67555555654869564758534763434434634e796a9000
41
+ => e002000015058000002c800000c3800000070000000000000000
42
+ <= 4104ac3f861b2006b1d950677b0ac77cc660a497d9e3afcb6caeb2bf4a67943535d56c0915fbd7476e93d50317fd13084ff3eb820a60cc448627e2e1be51c6145dc8225458466556333171675551594d4c6f673361784b4a654542625870514674487358449000
43
+ `,
44
+ },
45
+ ],
46
+ accounts: [
47
+ {
48
+ transactions: [
49
+ {
50
+ name: "sendSuccess",
51
+ transaction: fromTransactionRaw({
52
+ family: "tron",
53
+ recipient: activatedAddress1,
54
+ amount: "1000000",
55
+ networkInfo: null,
56
+ mode: "send",
57
+ duration: undefined,
58
+ resource: undefined,
59
+ votes: [],
60
+ }),
61
+ expectedStatus: {
62
+ amount: new BigNumber("1000000"),
63
+ errors: {},
64
+ warnings: {},
65
+ totalSpent: new BigNumber("1000000"),
66
+ estimatedFees: new BigNumber("0"),
67
+ },
68
+ },
69
+ {
70
+ name: "Send max",
71
+ transaction: fromTransactionRaw({
72
+ family: "tron",
73
+ recipient: activatedAddress1,
74
+ amount: "0",
75
+ useAllAmount: true,
76
+ networkInfo: null,
77
+ mode: "send",
78
+ duration: undefined,
79
+ resource: undefined,
80
+ votes: [],
81
+ }),
82
+ expectedStatus: account => ({
83
+ amount: account.spendableBalance,
84
+ errors: {},
85
+ warnings: {},
86
+ totalSpent: account.spendableBalance,
87
+ estimatedFees: new BigNumber("0"),
88
+ }),
89
+ },
90
+ {
91
+ name: "useAllAmountToUnactivatedAddressSuccess",
92
+ transaction: fromTransactionRaw({
93
+ family: "tron",
94
+ recipient: unactivatedAddress,
95
+ amount: "0",
96
+ useAllAmount: true,
97
+ networkInfo: null,
98
+ mode: "send",
99
+ duration: undefined,
100
+ resource: undefined,
101
+ votes: [],
102
+ }),
103
+ expectedStatus: (account, transaction, status) => {
104
+ return {
105
+ amount: account.spendableBalance.minus(status.estimatedFees),
106
+ errors: {},
107
+ warnings: {},
108
+ totalSpent: account.spendableBalance,
109
+ };
110
+ },
111
+ },
112
+ {
113
+ name: "voteSuccess",
114
+ transaction: fromTransactionRaw({
115
+ family: "tron",
116
+ recipient: activatedAddress1,
117
+ amount: "0",
118
+ networkInfo: null,
119
+ mode: "vote",
120
+ duration: undefined,
121
+ resource: undefined,
122
+ votes: [
123
+ {
124
+ address: "TLyqzVGLV1srkB7dToTAEqgDSfPtXRJZYH",
125
+ voteCount: 1,
126
+ },
127
+ {
128
+ address: "TGj1Ej1qRzL9feLTLhjwgxXF4Ct6GTWg2U",
129
+ voteCount: 1,
130
+ },
131
+ ],
132
+ }),
133
+ expectedStatus: {
134
+ amount: new BigNumber("0"),
135
+ errors: {},
136
+ warnings: {},
137
+ totalSpent: new BigNumber("0"),
138
+ estimatedFees: new BigNumber("0"),
139
+ },
140
+ },
141
+ {
142
+ name: "freezeBandwidthSuccess",
143
+ transaction: fromTransactionRaw({
144
+ family: "tron",
145
+ recipient: "",
146
+ amount: "1000000",
147
+ networkInfo: null,
148
+ mode: "freeze",
149
+ duration: undefined,
150
+ resource: "BANDWIDTH",
151
+ votes: [],
152
+ }),
153
+ expectedStatus: {
154
+ amount: new BigNumber("1000000"),
155
+ errors: {},
156
+ warnings: {},
157
+ totalSpent: new BigNumber("1000000"),
158
+ estimatedFees: new BigNumber("0"),
159
+ },
160
+ },
161
+ {
162
+ name: "freezeEnergySuccess",
163
+ transaction: fromTransactionRaw({
164
+ family: "tron",
165
+ recipient: "",
166
+ amount: "1000000",
167
+ networkInfo: null,
168
+ mode: "freeze",
169
+ duration: undefined,
170
+ resource: "ENERGY",
171
+ votes: [],
172
+ }),
173
+ expectedStatus: {
174
+ amount: new BigNumber("1000000"),
175
+ errors: {},
176
+ warnings: {},
177
+ totalSpent: new BigNumber("1000000"),
178
+ estimatedFees: new BigNumber("0"),
179
+ },
180
+ },
181
+ {
182
+ name: "NotEnoughFrozenEnergy",
183
+ transaction: fromTransactionRaw({
184
+ family: "tron",
185
+ recipient: "TBsyKdNsCKNXLgvneeUJ3rbXgWSgk6paTM",
186
+ amount: "1000000",
187
+ networkInfo: null,
188
+ mode: "unfreeze",
189
+ duration: undefined,
190
+ resource: "ENERGY",
191
+ votes: [],
192
+ }),
193
+ expectedStatus: {
194
+ amount: new BigNumber("0"),
195
+ errors: {
196
+ resource: new TronNoFrozenForEnergy(),
197
+ },
198
+ warnings: {},
199
+ totalSpent: new BigNumber("0"),
200
+ estimatedFees: new BigNumber("0"),
201
+ },
202
+ },
203
+ {
204
+ name: "NotEnoughFrozenBandwidth",
205
+ transaction: fromTransactionRaw({
206
+ family: "tron",
207
+ recipient: "TBsyKdNsCKNXLgvneeUJ3rbXgWSgk6paTM",
208
+ amount: "1000000",
209
+ networkInfo: null,
210
+ mode: "unfreeze",
211
+ duration: undefined,
212
+ resource: "BANDWIDTH",
213
+ votes: [],
214
+ }),
215
+ expectedStatus: {
216
+ amount: new BigNumber("0"),
217
+ errors: {
218
+ resource: new TronNoFrozenForBandwidth(),
219
+ },
220
+ warnings: {},
221
+ totalSpent: new BigNumber("0"),
222
+ estimatedFees: new BigNumber("0"),
223
+ },
224
+ },
225
+ {
226
+ name: "NoUnfrozenBalances",
227
+ transaction: fromTransactionRaw({
228
+ family: "tron",
229
+ recipient: "",
230
+ amount: "0",
231
+ networkInfo: null,
232
+ mode: "withdrawExpireUnfreeze",
233
+ duration: undefined,
234
+ votes: [],
235
+ resource: undefined,
236
+ }),
237
+ expectedStatus: {
238
+ amount: new BigNumber("0"),
239
+ errors: {
240
+ resource: new TronNoUnfrozenResource(),
241
+ },
242
+ warnings: {},
243
+ totalSpent: new BigNumber("0"),
244
+ estimatedFees: new BigNumber("0"),
245
+ },
246
+ },
247
+ {
248
+ name: "InvalidUnDelegateResourceAmount",
249
+ transaction: fromTransactionRaw({
250
+ family: "tron",
251
+ recipient: "TBsyKdNsCKNXLgvneeUJ3rbXgWSgk6paTM",
252
+ amount: "100",
253
+ networkInfo: null,
254
+ mode: "unDelegateResource",
255
+ duration: undefined,
256
+ resource: "BANDWIDTH",
257
+ votes: [],
258
+ }),
259
+ expectedStatus: {
260
+ amount: new BigNumber("0"),
261
+ errors: {
262
+ resource: new TronInvalidUnDelegateResourceAmount(),
263
+ },
264
+ warnings: {},
265
+ totalSpent: new BigNumber("0"),
266
+ estimatedFees: new BigNumber("0"),
267
+ },
268
+ },
269
+ {
270
+ name: "recipientRequired",
271
+ transaction: fromTransactionRaw({
272
+ family: "tron",
273
+ recipient: "",
274
+ amount: "1000000",
275
+ networkInfo: null,
276
+ mode: "send",
277
+ duration: undefined,
278
+ resource: undefined,
279
+ votes: [],
280
+ }),
281
+ expectedStatus: {
282
+ amount: new BigNumber("1000000"),
283
+ errors: {
284
+ recipient: new RecipientRequired(),
285
+ },
286
+ warnings: {},
287
+ totalSpent: new BigNumber("1000000"),
288
+ estimatedFees: new BigNumber("0"),
289
+ },
290
+ },
291
+ {
292
+ name: "invalidRecipientIsTheSame",
293
+ transaction: fromTransactionRaw({
294
+ family: "tron",
295
+ recipient: "THAe4BNVxp293qgyQEqXEkHMpPcqtG73bi",
296
+ amount: "1000000",
297
+ networkInfo: null,
298
+ mode: "send",
299
+ duration: undefined,
300
+ resource: undefined,
301
+ votes: [],
302
+ }),
303
+ expectedStatus: {
304
+ amount: new BigNumber("1000000"),
305
+ errors: {
306
+ recipient: new InvalidAddressBecauseDestinationIsAlsoSource(),
307
+ },
308
+ warnings: {},
309
+ totalSpent: new BigNumber("1000000"),
310
+ estimatedFees: new BigNumber("0"),
311
+ },
312
+ },
313
+ {
314
+ name: "invalidRecipientUnknown",
315
+ transaction: fromTransactionRaw({
316
+ family: "tron",
317
+ recipient: "unknown",
318
+ amount: "1000000",
319
+ networkInfo: null,
320
+ mode: "send",
321
+ duration: undefined,
322
+ resource: undefined,
323
+ votes: [],
324
+ }),
325
+ expectedStatus: {
326
+ amount: new BigNumber("1000000"),
327
+ errors: {
328
+ recipient: new InvalidAddress(),
329
+ },
330
+ warnings: {},
331
+ totalSpent: new BigNumber("1000000"),
332
+ estimatedFees: new BigNumber("0"),
333
+ },
334
+ },
335
+ {
336
+ name: "amountRequired",
337
+ transaction: fromTransactionRaw({
338
+ family: "tron",
339
+ recipient: activatedAddress1,
340
+ amount: "0",
341
+ networkInfo: null,
342
+ mode: "send",
343
+ duration: undefined,
344
+ resource: undefined,
345
+ votes: [],
346
+ }),
347
+ expectedStatus: {
348
+ amount: new BigNumber("0"),
349
+ errors: {
350
+ amount: new AmountRequired(),
351
+ },
352
+ warnings: {},
353
+ totalSpent: new BigNumber("0"),
354
+ estimatedFees: new BigNumber("0"),
355
+ },
356
+ },
357
+ {
358
+ name: "notEnoughBalance",
359
+ transaction: fromTransactionRaw({
360
+ family: "tron",
361
+ recipient: activatedAddress1,
362
+ amount: "1000000000",
363
+ networkInfo: null,
364
+ mode: "send",
365
+ duration: undefined,
366
+ resource: undefined,
367
+ votes: [],
368
+ }),
369
+ expectedStatus: {
370
+ amount: new BigNumber("1000000000"),
371
+ errors: {
372
+ amount: new NotEnoughBalance(),
373
+ },
374
+ warnings: {},
375
+ totalSpent: new BigNumber("1000000000"),
376
+ estimatedFees: new BigNumber("0"),
377
+ },
378
+ },
379
+ {
380
+ name: "notEnoughBalance to unactivated",
381
+ transaction: t => (Object.assign(Object.assign({}, t), { amount: new BigNumber(100), recipient: unactivatedAddress })),
382
+ expectedStatus: () => ({
383
+ estimatedFees: ACTIVATION_FEES,
384
+ }),
385
+ },
386
+ {
387
+ name: "enoughBalance near the max",
388
+ transaction: (t, account) => (Object.assign(Object.assign({}, t), { recipient: unactivatedAddress, amount: account.spendableBalance.minus(ACTIVATION_FEES).minus(1) })),
389
+ expectedStatus: () => ({
390
+ errors: {},
391
+ }),
392
+ },
393
+ {
394
+ name: "enoughBalance at exactly the max",
395
+ transaction: (t, account) => (Object.assign(Object.assign({}, t), { recipient: unactivatedAddress, amount: account.spendableBalance.minus(ACTIVATION_FEES) })),
396
+ expectedStatus: () => ({
397
+ errors: {},
398
+ }),
399
+ },
400
+ {
401
+ name: "estimatedFeesWarning",
402
+ // send 1TRX to new account = +0.1TRX of fees
403
+ transaction: fromTransactionRaw({
404
+ family: "tron",
405
+ recipient: unactivatedAddress,
406
+ amount: "1000000",
407
+ networkInfo: null,
408
+ mode: "send",
409
+ duration: undefined,
410
+ resource: undefined,
411
+ votes: [],
412
+ }),
413
+ expectedStatus: {
414
+ amount: new BigNumber("1000000"),
415
+ errors: {},
416
+ warnings: {
417
+ fee: new TronUnexpectedFees("Estimated fees"),
418
+ },
419
+ totalSpent: new BigNumber("2100000"),
420
+ estimatedFees: new BigNumber("1100000"),
421
+ },
422
+ },
423
+ {
424
+ name: "tronSendTrc20ToContractAddressSuccess",
425
+ transaction: (t, account) => (Object.assign(Object.assign({}, t), { recipient: "TYmGYpY3LuHHge9jmTtq2aQmSpUpqKcZtJ",
426
+ // corresponds to a valid deposit contract address
427
+ subAccountId: getTokenAccountId(account, "tron/trc20/tla2f6vpqdgre67v1736s7bj8ray5wyju7"), amount: new BigNumber("1000000") })),
428
+ expectedStatus: {
429
+ amount: new BigNumber("1000000"),
430
+ errors: {},
431
+ warnings: {},
432
+ totalSpent: new BigNumber("1000000"),
433
+ estimatedFees: new BigNumber("0"),
434
+ },
435
+ },
436
+ {
437
+ name: "tronSendTrc20ToNewAccountForbidden",
438
+ transaction: (t, account) => (Object.assign(Object.assign({}, t), { recipient: unactivatedAddress, subAccountId: getTokenAccountId(account, "tron/trc20/tla2f6vpqdgre67v1736s7bj8ray5wyju7"), amount: new BigNumber("1000000") })),
439
+ expectedStatus: {
440
+ amount: new BigNumber("1000000"),
441
+ errors: {
442
+ recipient: new TronSendTrc20ToNewAccountForbidden(),
443
+ },
444
+ warnings: {},
445
+ totalSpent: new BigNumber("1000000"),
446
+ estimatedFees: new BigNumber("0"),
447
+ },
448
+ }, // FIXME account have moved...
449
+ /*
450
+ {
451
+ name: "tronSendTrc20NotEnoughEnergyWarning",
452
+ transaction: fromTransactionRaw({
453
+ family: "tron",
454
+ recipient: activatedAddress1,
455
+ subAccountId:
456
+ "tronjs:2:tron:THAe4BNVxp293qgyQEqXEkHMpPcqtG73bi:+TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t",
457
+ amount: "1000000",
458
+ networkInfo: null,
459
+ mode: "send",
460
+ duration: undefined,
461
+ resource: undefined,
462
+ votes: []
463
+ }),
464
+ expectedStatus: {
465
+ amount: new BigNumber("1000000"),
466
+ errors: {},
467
+ warnings: { amount: new TronNotEnoughEnergy() },
468
+ totalSpent: new BigNumber("1000000"),
469
+ estimatedFees: new BigNumber("0")
470
+ }
471
+ },
472
+ */
473
+ {
474
+ name: "tronSendTrc20Success",
475
+ transaction: (t, account) => (Object.assign(Object.assign({}, t), { recipient: activatedAddress1, subAccountId: getTokenAccountId(account, "tron/trc20/tla2f6vpqdgre67v1736s7bj8ray5wyju7"), amount: new BigNumber("1000000") })),
476
+ expectedStatus: {
477
+ amount: new BigNumber("1000000"),
478
+ errors: {},
479
+ warnings: {},
480
+ totalSpent: new BigNumber("1000000"),
481
+ estimatedFees: new BigNumber("0"),
482
+ },
483
+ },
484
+ {
485
+ name: "tronInvalidFreezeAmount",
486
+ transaction: fromTransactionRaw({
487
+ family: "tron",
488
+ recipient: "",
489
+ amount: "100000",
490
+ networkInfo: null,
491
+ mode: "freeze",
492
+ duration: undefined,
493
+ resource: "BANDWIDTH",
494
+ votes: [],
495
+ }),
496
+ expectedStatus: {
497
+ amount: new BigNumber("100000"),
498
+ errors: {
499
+ amount: new TronInvalidFreezeAmount(),
500
+ },
501
+ warnings: {},
502
+ totalSpent: new BigNumber("100000"),
503
+ estimatedFees: new BigNumber("0"),
504
+ },
505
+ },
506
+ {
507
+ name: "tronLegacyUnFreezeBandwidth",
508
+ transaction: fromTransactionRaw({
509
+ family: "tron",
510
+ recipient: "",
511
+ amount: "1000000",
512
+ networkInfo: null,
513
+ mode: "legacyUnfreeze",
514
+ duration: undefined,
515
+ resource: "BANDWIDTH",
516
+ votes: [],
517
+ }),
518
+ expectedStatus: {
519
+ amount: new BigNumber("0"),
520
+ errors: {},
521
+ warnings: {},
522
+ totalSpent: new BigNumber("0"),
523
+ estimatedFees: new BigNumber("0"),
524
+ },
525
+ },
526
+ // Not so sure how ot make this test work again, frozen energy seems to be expired.
527
+ // {
528
+ // name: "tronNoFrozenForEnergy",
529
+ // transaction: fromTransactionRaw({
530
+ // family: "tron",
531
+ // recipient: "",
532
+ // amount: "0",
533
+ // networkInfo: null,
534
+ // mode: "unfreeze",
535
+ // duration: undefined,
536
+ // resource: "ENERGY",
537
+ // votes: [],
538
+ // }),
539
+ // expectedStatus: {
540
+ // amount: new BigNumber("0"),
541
+ // errors: {
542
+ // resource: new TronNoFrozenForEnergy(),
543
+ // },
544
+ // warnings: {},
545
+ // totalSpent: new BigNumber("0"),
546
+ // estimatedFees: new BigNumber("0"),
547
+ // },
548
+ // },
549
+ {
550
+ name: "tronVoteRequired",
551
+ transaction: fromTransactionRaw({
552
+ family: "tron",
553
+ recipient: "",
554
+ amount: "0",
555
+ networkInfo: null,
556
+ mode: "vote",
557
+ duration: undefined,
558
+ resource: undefined,
559
+ votes: [],
560
+ }),
561
+ expectedStatus: {
562
+ amount: new BigNumber("0"),
563
+ errors: {
564
+ vote: new TronVoteRequired(),
565
+ },
566
+ warnings: {},
567
+ totalSpent: new BigNumber("0"),
568
+ estimatedFees: new BigNumber("0"),
569
+ },
570
+ },
571
+ {
572
+ name: "invalidVoteAddress",
573
+ transaction: fromTransactionRaw({
574
+ family: "tron",
575
+ recipient: activatedAddress1,
576
+ amount: "0",
577
+ networkInfo: null,
578
+ mode: "vote",
579
+ duration: undefined,
580
+ resource: undefined,
581
+ votes: [
582
+ {
583
+ address: "abcde",
584
+ voteCount: 1,
585
+ },
586
+ ],
587
+ }),
588
+ expectedStatus: {
589
+ amount: new BigNumber("0"),
590
+ errors: {
591
+ vote: new InvalidAddress(),
592
+ },
593
+ warnings: {},
594
+ totalSpent: new BigNumber("0"),
595
+ estimatedFees: new BigNumber("0"),
596
+ },
597
+ },
598
+ {
599
+ name: "tronInvalidVoteCount",
600
+ transaction: fromTransactionRaw({
601
+ family: "tron",
602
+ recipient: activatedAddress1,
603
+ amount: "0",
604
+ networkInfo: null,
605
+ mode: "vote",
606
+ duration: undefined,
607
+ resource: undefined,
608
+ votes: [
609
+ {
610
+ address: "TLyqzVGLV1srkB7dToTAEqgDSfPtXRJZYH",
611
+ voteCount: 0,
612
+ },
613
+ ],
614
+ }),
615
+ expectedStatus: {
616
+ amount: new BigNumber("0"),
617
+ errors: {
618
+ vote: new TronInvalidVoteCount(),
619
+ },
620
+ warnings: {},
621
+ totalSpent: new BigNumber("0"),
622
+ estimatedFees: new BigNumber("0"),
623
+ },
624
+ },
625
+ {
626
+ name: "tronNotEnoughTronPower",
627
+ transaction: fromTransactionRaw({
628
+ family: "tron",
629
+ recipient: "",
630
+ amount: "0",
631
+ networkInfo: null,
632
+ mode: "vote",
633
+ duration: undefined,
634
+ resource: undefined,
635
+ votes: [
636
+ {
637
+ address: "TLyqzVGLV1srkB7dToTAEqgDSfPtXRJZYH",
638
+ voteCount: 5,
639
+ },
640
+ {
641
+ address: "TGj1Ej1qRzL9feLTLhjwgxXF4Ct6GTWg2U",
642
+ voteCount: 5,
643
+ },
644
+ ],
645
+ }),
646
+ expectedStatus: {
647
+ amount: new BigNumber("0"),
648
+ errors: {
649
+ vote: new TronNotEnoughTronPower(),
650
+ },
651
+ warnings: {},
652
+ totalSpent: new BigNumber("0"),
653
+ estimatedFees: new BigNumber("0"),
654
+ },
655
+ },
656
+ {
657
+ name: "tronNoReward",
658
+ transaction: fromTransactionRaw({
659
+ family: "tron",
660
+ recipient: "",
661
+ amount: "0",
662
+ networkInfo: null,
663
+ mode: "claimReward",
664
+ duration: undefined,
665
+ resource: undefined,
666
+ votes: [],
667
+ }),
668
+ expectedStatus: {
669
+ amount: new BigNumber("0"),
670
+ errors: {
671
+ reward: new TronNoReward(),
672
+ },
673
+ warnings: {},
674
+ totalSpent: new BigNumber("0"),
675
+ estimatedFees: new BigNumber("0"),
676
+ },
677
+ },
678
+ ],
679
+ raw: {
680
+ id: "js:2:tron:THAe4BNVxp293qgyQEqXEkHMpPcqtG73bi:",
681
+ seedIdentifier: "THAe4BNVxp293qgyQEqXEkHMpPcqtG73bi",
682
+ name: "Tron 2",
683
+ derivationMode: "",
684
+ index: 1,
685
+ freshAddress: "THAe4BNVxp293qgyQEqXEkHMpPcqtG73bi",
686
+ freshAddressPath: "44'/195'/0'/0/0",
687
+ pendingOperations: [],
688
+ currencyId: "tron",
689
+ balance: "10006000",
690
+ spendableBalance: "1606000",
691
+ subAccounts: [],
692
+ operations: [],
693
+ lastSyncDate: "",
694
+ blockHeight: 0,
695
+ tronResources: {
696
+ frozen: { bandwidth: undefined, energy: undefined },
697
+ delegatedFrozen: { bandwidth: undefined, energy: undefined },
698
+ unFrozen: { bandwidth: [], energy: [] },
699
+ legacyFrozen: {
700
+ bandwidth: { amount: "2000000", expiredAt: "2022-05-23T08:20:39.000Z" },
701
+ energy: { amount: "1000000", expiredAt: "2022-05-22T12:51:12.000Z" },
702
+ },
703
+ votes: [],
704
+ tronPower: 3,
705
+ energy: "12",
706
+ bandwidth: {
707
+ freeUsed: "0",
708
+ freeLimit: "600",
709
+ gainedUsed: "0",
710
+ gainedLimit: "2",
711
+ },
712
+ unwithdrawnReward: "0",
713
+ lastWithdrawnRewardDate: undefined,
714
+ lastVotedDate: undefined,
715
+ cacheTransactionInfoById: {},
716
+ },
717
+ },
718
+ },
719
+ {
720
+ transactions: [
721
+ {
722
+ name: "claimRewardSuccess",
723
+ transaction: fromTransactionRaw({
724
+ family: "tron",
725
+ recipient: "",
726
+ amount: "0",
727
+ networkInfo: null,
728
+ mode: "claimReward",
729
+ duration: undefined,
730
+ resource: undefined,
731
+ votes: [],
732
+ }),
733
+ expectedStatus: {
734
+ amount: new BigNumber("0"),
735
+ errors: {},
736
+ warnings: {},
737
+ totalSpent: new BigNumber("0"),
738
+ estimatedFees: new BigNumber("0"),
739
+ },
740
+ },
741
+ {
742
+ name: "tronNoFrozenForBandwidth",
743
+ transaction: fromTransactionRaw({
744
+ family: "tron",
745
+ recipient: "TBsyKdNsCKNXLgvneeUJ3rbXgWSgk6paTM",
746
+ amount: "1000000",
747
+ networkInfo: null,
748
+ mode: "unfreeze",
749
+ duration: undefined,
750
+ resource: "BANDWIDTH",
751
+ votes: [],
752
+ }),
753
+ expectedStatus: {
754
+ amount: new BigNumber("0"),
755
+ errors: {
756
+ resource: new TronNoFrozenForBandwidth(),
757
+ },
758
+ warnings: {},
759
+ totalSpent: new BigNumber("0"),
760
+ estimatedFees: new BigNumber("0"),
761
+ },
762
+ },
763
+ ],
764
+ FIXME_tests: [
765
+ /**
766
+ Error:
767
+ - Expected
768
+ + Received
769
+ - "26003017"
770
+ + "26000197"
771
+ The live-common ignore all unsupported tokens (by the nano app) transactions.
772
+
773
+ Difference of 2820 (0.00282 TRX) is due to an unsupported tr10 transaction which have fee:
774
+ https://tronscan.org/#/transaction/6fe0b288e0cce30396afe40b365ee57642be44146acc847672fe3d328309d2b0
775
+ To re-enable when the support will be done.
776
+ */
777
+ "balance is sum of ops",
778
+ ],
779
+ raw: {
780
+ id: "js:2:tron:TRqkRnAj6ceJFYAn2p1eE7aWrgBBwtdhS9:",
781
+ seedIdentifier: activatedAddress1,
782
+ name: "Tron 1",
783
+ derivationMode: "",
784
+ index: 0,
785
+ freshAddress: activatedAddress1,
786
+ freshAddressPath: "44'/195'/0'/0/0",
787
+ pendingOperations: [],
788
+ currencyId: "tron",
789
+ balance: "26000197",
790
+ spendableBalance: "197",
791
+ subAccounts: [],
792
+ operations: [],
793
+ lastSyncDate: "",
794
+ blockHeight: 0,
795
+ tronResources: {
796
+ frozen: { bandwidth: undefined, energy: undefined },
797
+ delegatedFrozen: { bandwidth: undefined, energy: undefined },
798
+ unFrozen: { bandwidth: [], energy: [] },
799
+ legacyFrozen: {
800
+ bandwidth: undefined,
801
+ energy: { amount: "26000000", expiredAt: "2020-02-01T16:04:51.000Z" },
802
+ },
803
+ votes: [
804
+ { address: "TLyqzVGLV1srkB7dToTAEqgDSfPtXRJZYH", voteCount: 15 },
805
+ { address: "TGj1Ej1qRzL9feLTLhjwgxXF4Ct6GTWg2U", voteCount: 1 },
806
+ { address: "TCZvvbn4SCVyNhCAt1L8Kp1qk5rtMiKdBB", voteCount: 2 },
807
+ ],
808
+ tronPower: 26,
809
+ energy: "326",
810
+ bandwidth: {
811
+ freeUsed: "0",
812
+ freeLimit: "600",
813
+ gainedUsed: "0",
814
+ gainedLimit: "0",
815
+ },
816
+ unwithdrawnReward: "1336847",
817
+ lastWithdrawnRewardDate: "2022-05-19T12:45:36.000Z",
818
+ lastVotedDate: "2022-05-19T12:43:42.000Z",
819
+ cacheTransactionInfoById: {},
820
+ },
821
+ },
822
+ },
823
+ {
824
+ transactions: [
825
+ {
826
+ name: "FreezeEnergySuccess",
827
+ transaction: fromTransactionRaw({
828
+ amount: "1000000",
829
+ recipient: "",
830
+ useAllAmount: false,
831
+ subAccountId: null,
832
+ networkInfo: {
833
+ family: "tron",
834
+ freeNetUsed: "0",
835
+ freeNetLimit: "600",
836
+ netUsed: "271",
837
+ netLimit: "584",
838
+ energyUsed: "0",
839
+ energyLimit: "214",
840
+ },
841
+ family: "tron",
842
+ mode: "freeze",
843
+ resource: "ENERGY",
844
+ duration: 3,
845
+ votes: [],
846
+ }),
847
+ expectedStatus: {
848
+ errors: {},
849
+ warnings: {},
850
+ amount: BigNumber("1000000"),
851
+ estimatedFees: BigNumber("0"),
852
+ totalSpent: BigNumber("1000000"),
853
+ },
854
+ },
855
+ {
856
+ name: "NotEnoughBalanceToFreeze",
857
+ transaction: fromTransactionRaw({
858
+ amount: "100000000000000000",
859
+ recipient: "",
860
+ useAllAmount: false,
861
+ subAccountId: null,
862
+ networkInfo: {
863
+ family: "tron",
864
+ freeNetUsed: "0",
865
+ freeNetLimit: "600",
866
+ netUsed: "271",
867
+ netLimit: "584",
868
+ energyUsed: "0",
869
+ energyLimit: "214",
870
+ },
871
+ family: "tron",
872
+ mode: "freeze",
873
+ resource: "ENERGY",
874
+ duration: 3,
875
+ votes: [],
876
+ }),
877
+ expectedStatus: {
878
+ errors: {
879
+ amount: new NotEnoughBalance(),
880
+ },
881
+ warnings: {},
882
+ amount: BigNumber("100000000000000000"),
883
+ estimatedFees: BigNumber("0"),
884
+ totalSpent: BigNumber("100000000000000000"),
885
+ },
886
+ },
887
+ {
888
+ name: "FreezeBandwidthSuccess",
889
+ transaction: fromTransactionRaw({
890
+ amount: "1000000",
891
+ recipient: "",
892
+ useAllAmount: false,
893
+ subAccountId: null,
894
+ networkInfo: {
895
+ family: "tron",
896
+ freeNetUsed: "0",
897
+ freeNetLimit: "600",
898
+ netUsed: "271",
899
+ netLimit: "584",
900
+ energyUsed: "0",
901
+ energyLimit: "214",
902
+ },
903
+ family: "tron",
904
+ mode: "freeze",
905
+ resource: "BANDWIDTH",
906
+ duration: 3,
907
+ votes: [],
908
+ }),
909
+ expectedStatus: {
910
+ errors: {},
911
+ warnings: {},
912
+ amount: BigNumber("1000000"),
913
+ estimatedFees: BigNumber("0"),
914
+ totalSpent: BigNumber("1000000"),
915
+ },
916
+ },
917
+ {
918
+ name: "UnfreezeEnergySuccess",
919
+ transaction: fromTransactionRaw({
920
+ amount: "1000000",
921
+ recipient: "",
922
+ useAllAmount: false,
923
+ subAccountId: null,
924
+ networkInfo: {
925
+ family: "tron",
926
+ freeNetUsed: "0",
927
+ freeNetLimit: "600",
928
+ netUsed: "271",
929
+ netLimit: "584",
930
+ energyUsed: "0",
931
+ energyLimit: "214",
932
+ },
933
+ family: "tron",
934
+ mode: "unfreeze",
935
+ resource: "ENERGY",
936
+ duration: 3,
937
+ votes: [],
938
+ }),
939
+ expectedStatus: {
940
+ errors: {},
941
+ warnings: {},
942
+ amount: BigNumber("0"),
943
+ estimatedFees: BigNumber("0"),
944
+ totalSpent: BigNumber("0"),
945
+ },
946
+ },
947
+ {
948
+ name: "NotEnoughEnergyUnfreeze",
949
+ transaction: fromTransactionRaw({
950
+ amount: "10000000000",
951
+ recipient: "",
952
+ useAllAmount: false,
953
+ subAccountId: null,
954
+ networkInfo: {
955
+ family: "tron",
956
+ freeNetUsed: "0",
957
+ freeNetLimit: "600",
958
+ netUsed: "271",
959
+ netLimit: "584",
960
+ energyUsed: "0",
961
+ energyLimit: "214",
962
+ },
963
+ family: "tron",
964
+ mode: "unfreeze",
965
+ resource: "ENERGY",
966
+ duration: 3,
967
+ votes: [],
968
+ }),
969
+ expectedStatus: {
970
+ errors: {
971
+ resource: new TronNoFrozenForEnergy(),
972
+ },
973
+ warnings: {},
974
+ amount: BigNumber("0"),
975
+ estimatedFees: BigNumber("0"),
976
+ totalSpent: BigNumber("0"),
977
+ },
978
+ },
979
+ {
980
+ name: "UnfreezeBandwidthSuccess",
981
+ transaction: fromTransactionRaw({
982
+ amount: "1000000",
983
+ recipient: "",
984
+ useAllAmount: false,
985
+ subAccountId: null,
986
+ networkInfo: {
987
+ family: "tron",
988
+ freeNetUsed: "0",
989
+ freeNetLimit: "600",
990
+ netUsed: "272",
991
+ netLimit: "584",
992
+ energyUsed: "0",
993
+ energyLimit: "214",
994
+ },
995
+ family: "tron",
996
+ mode: "unfreeze",
997
+ resource: "BANDWIDTH",
998
+ duration: 3,
999
+ votes: [],
1000
+ }),
1001
+ expectedStatus: {
1002
+ errors: {},
1003
+ warnings: {},
1004
+ amount: BigNumber("0"),
1005
+ estimatedFees: BigNumber("0"),
1006
+ totalSpent: BigNumber("0"),
1007
+ },
1008
+ },
1009
+ {
1010
+ name: "withdrawExpireUnfreezeSuccess",
1011
+ transaction: fromTransactionRaw({
1012
+ amount: "0",
1013
+ recipient: "",
1014
+ useAllAmount: false,
1015
+ subAccountId: null,
1016
+ networkInfo: {
1017
+ family: "tron",
1018
+ freeNetUsed: "0",
1019
+ freeNetLimit: "600",
1020
+ netUsed: "274",
1021
+ netLimit: "584",
1022
+ energyUsed: "0",
1023
+ energyLimit: "214",
1024
+ },
1025
+ family: "tron",
1026
+ mode: "withdrawExpireUnfreeze",
1027
+ resource: null,
1028
+ duration: 3,
1029
+ votes: [],
1030
+ }),
1031
+ expectedStatus: {
1032
+ errors: {},
1033
+ warnings: {},
1034
+ amount: BigNumber("0"),
1035
+ estimatedFees: BigNumber("0"),
1036
+ totalSpent: BigNumber("0"),
1037
+ },
1038
+ },
1039
+ {
1040
+ name: "UndelegateResourceSuccess",
1041
+ transaction: fromTransactionRaw({
1042
+ amount: "1000000",
1043
+ recipient: "TKc4RbfcDf6MrHXENfRAG23ue8YYgaTh8U",
1044
+ useAllAmount: false,
1045
+ subAccountId: null,
1046
+ networkInfo: {
1047
+ family: "tron",
1048
+ freeNetUsed: "0",
1049
+ freeNetLimit: "600",
1050
+ netUsed: "268",
1051
+ netLimit: "584",
1052
+ energyUsed: "0",
1053
+ energyLimit: "214",
1054
+ },
1055
+ family: "tron",
1056
+ mode: "unDelegateResource",
1057
+ resource: "ENERGY",
1058
+ duration: 3,
1059
+ votes: [],
1060
+ }),
1061
+ expectedStatus: {
1062
+ errors: {},
1063
+ warnings: {},
1064
+ amount: BigNumber("0"),
1065
+ estimatedFees: BigNumber("0"),
1066
+ totalSpent: BigNumber("0"),
1067
+ },
1068
+ },
1069
+ {
1070
+ name: "AddressIsAlsoSourceUndelegateResourceError",
1071
+ transaction: fromTransactionRaw({
1072
+ amount: "1000",
1073
+ recipient: "TUxd6v64YTWkfpFpNDdtgc5Ps4SfGxwizT",
1074
+ useAllAmount: false,
1075
+ subAccountId: null,
1076
+ networkInfo: {
1077
+ family: "tron",
1078
+ freeNetUsed: "0",
1079
+ freeNetLimit: "600",
1080
+ netUsed: "268",
1081
+ netLimit: "584",
1082
+ energyUsed: "0",
1083
+ energyLimit: "214",
1084
+ },
1085
+ family: "tron",
1086
+ mode: "unDelegateResource",
1087
+ resource: "ENERGY",
1088
+ duration: 3,
1089
+ votes: [],
1090
+ }),
1091
+ expectedStatus: {
1092
+ errors: {
1093
+ recipient: new InvalidAddressBecauseDestinationIsAlsoSource(),
1094
+ },
1095
+ warnings: {},
1096
+ amount: BigNumber("0"),
1097
+ estimatedFees: BigNumber("0"),
1098
+ totalSpent: BigNumber("0"),
1099
+ },
1100
+ },
1101
+ {
1102
+ name: "UndelegateResourceError",
1103
+ transaction: fromTransactionRaw({
1104
+ amount: "1000000000",
1105
+ recipient: "TKc4RbfcDf6MrHXENfRAG23ue8YYgaTh8U",
1106
+ useAllAmount: false,
1107
+ subAccountId: null,
1108
+ networkInfo: {
1109
+ family: "tron",
1110
+ freeNetUsed: "0",
1111
+ freeNetLimit: "600",
1112
+ netUsed: "268",
1113
+ netLimit: "584",
1114
+ energyUsed: "0",
1115
+ energyLimit: "214",
1116
+ },
1117
+ family: "tron",
1118
+ mode: "unDelegateResource",
1119
+ resource: "ENERGY",
1120
+ duration: 3,
1121
+ votes: [],
1122
+ }),
1123
+ expectedStatus: {
1124
+ errors: {
1125
+ resource: new TronInvalidUnDelegateResourceAmount(),
1126
+ },
1127
+ warnings: {},
1128
+ amount: BigNumber("0"),
1129
+ estimatedFees: BigNumber("0"),
1130
+ totalSpent: BigNumber("0"),
1131
+ },
1132
+ },
1133
+ {
1134
+ name: "unfreezeLegacyNoFrozenForBandwidth",
1135
+ transaction: fromTransactionRaw({
1136
+ family: "tron",
1137
+ recipient: "",
1138
+ amount: "1000000",
1139
+ networkInfo: null,
1140
+ mode: "legacyUnfreeze",
1141
+ duration: undefined,
1142
+ resource: "BANDWIDTH",
1143
+ votes: [],
1144
+ }),
1145
+ expectedStatus: {
1146
+ amount: new BigNumber("0"),
1147
+ errors: {
1148
+ resource: new TronNoFrozenForBandwidth(),
1149
+ },
1150
+ warnings: {},
1151
+ totalSpent: new BigNumber("0"),
1152
+ estimatedFees: new BigNumber("0"),
1153
+ },
1154
+ },
1155
+ ],
1156
+ FIXME_tests: ["balance is sum of ops"],
1157
+ raw: {
1158
+ id: "js:2:tron:TUxd6v64YTWkfpFpNDdtgc5Ps4SfGxwizT:",
1159
+ seedIdentifier: "0416c02ea5e939eed995f75c44667a66b9c8dfddede8c6d54211f64b1dace9e1c40bcbbd5341480f43a5f37c7ab3a0c53f9cccff57d59bb0368d1e744135d7f68a",
1160
+ name: "Tron 1",
1161
+ used: true,
1162
+ derivationMode: "",
1163
+ index: 0,
1164
+ freshAddress: "TUxd6v64YTWkfpFpNDdtgc5Ps4SfGxwizT",
1165
+ freshAddressPath: "44'/195'/0'/0/0",
1166
+ blockHeight: 57509444,
1167
+ creationDate: "2023-10-31T14:27:27.000Z",
1168
+ operationsCount: 96,
1169
+ operations: [],
1170
+ pendingOperations: [],
1171
+ currencyId: "tron",
1172
+ lastSyncDate: "2023-12-21T12:28:03.177Z",
1173
+ balance: "859005207",
1174
+ spendableBalance: "252128207",
1175
+ subAccounts: [],
1176
+ // @ts-expect-error expected
1177
+ tronResources: {
1178
+ frozen: { bandwidth: { amount: "539000000" }, energy: { amount: "14877000" } },
1179
+ delegatedFrozen: { energy: { amount: "38000000" } },
1180
+ unFrozen: {
1181
+ bandwidth: [{ amount: "1000000", expireTime: "2023-12-20T17:22:36.000Z" }],
1182
+ energy: [
1183
+ { amount: "10000000", expireTime: "2023-12-25T19:24:54.000Z" },
1184
+ { amount: "4000000", expireTime: "2023-12-25T19:25:09.000Z" },
1185
+ ],
1186
+ },
1187
+ legacyFrozen: {},
1188
+ votes: [{ address: "TAQpCTFeJvwdWf6MQZtXXkzWrTS9aymshb", voteCount: 100 }],
1189
+ tronPower: 591,
1190
+ energy: "214",
1191
+ bandwidth: { freeUsed: "0", freeLimit: "600", gainedUsed: "274", gainedLimit: "584" },
1192
+ unwithdrawnReward: "321945",
1193
+ lastWithdrawnRewardDate: "2023-11-24T16:58:09.000Z",
1194
+ lastVotedDate: "2023-12-06T17:24:48.000Z",
1195
+ cacheTransactionInfoById: {},
1196
+ },
1197
+ swapHistory: [],
1198
+ },
1199
+ },
1200
+ {
1201
+ name: "Tron account with only frozen bandwidth",
1202
+ FIXME_tests: ["balance is sum of ops", "pendingOperations are cleaned up"],
1203
+ raw: {
1204
+ id: "js:2:tron:TY2ksFgpvb82TgGPwUSa7iseqPW5weYQyh:",
1205
+ seedIdentifier: "0416c02ea5e939eed995f75c44667a66b9c8dfddede8c6d54211f64b1dace9e1c40bcbbd5341480f43a5f37c7ab3a0c53f9cccff57d59bb0368d1e744135d7f68a",
1206
+ name: "Tron 3",
1207
+ used: true,
1208
+ derivationMode: "",
1209
+ index: 2,
1210
+ freshAddress: "TY2ksFgpvb82TgGPwUSa7iseqPW5weYQyh",
1211
+ freshAddressPath: "44'/195'/2'/0/0",
1212
+ blockHeight: 59127355,
1213
+ creationDate: "2024-02-15T16:36:06.000Z",
1214
+ operationsCount: 3,
1215
+ operations: [],
1216
+ pendingOperations: [],
1217
+ currencyId: "tron",
1218
+ lastSyncDate: "2024-02-15T17:11:40.339Z",
1219
+ balance: "15000004",
1220
+ spendableBalance: "10000004",
1221
+ subAccounts: [],
1222
+ // @ts-expect-error expected
1223
+ tronResources: {
1224
+ frozen: { bandwidth: { amount: "5000000" } },
1225
+ delegatedFrozen: {},
1226
+ unFrozen: { bandwidth: [], energy: [] },
1227
+ legacyFrozen: {},
1228
+ votes: [],
1229
+ tronPower: 5,
1230
+ energy: "0",
1231
+ bandwidth: { freeUsed: "250", freeLimit: "600", gainedUsed: "0", gainedLimit: "5" },
1232
+ unwithdrawnReward: "0",
1233
+ cacheTransactionInfoById: {},
1234
+ },
1235
+ swapHistory: [],
1236
+ },
1237
+ transactions: [
1238
+ {
1239
+ name: "Successful bandwidth unfreeze with no frozen energy",
1240
+ transaction: fromTransactionRaw({
1241
+ amount: "1000000",
1242
+ recipient: "",
1243
+ useAllAmount: false,
1244
+ subAccountId: null,
1245
+ networkInfo: {
1246
+ family: "tron",
1247
+ freeNetUsed: "250",
1248
+ freeNetLimit: "600",
1249
+ netUsed: "0",
1250
+ netLimit: "5",
1251
+ energyUsed: "0",
1252
+ energyLimit: "0",
1253
+ },
1254
+ family: "tron",
1255
+ mode: "unfreeze",
1256
+ resource: "BANDWIDTH",
1257
+ duration: 3,
1258
+ votes: [],
1259
+ }),
1260
+ expectedStatus: {
1261
+ errors: {},
1262
+ warnings: {},
1263
+ amount: BigNumber("0"),
1264
+ estimatedFees: BigNumber("0"),
1265
+ totalSpent: BigNumber("0"),
1266
+ },
1267
+ },
1268
+ ],
1269
+ },
1270
+ ],
1271
+ };
1272
+ export const dataset = {
1273
+ implementations: ["tronjs"],
1274
+ currencies: {
1275
+ tron,
1276
+ },
1277
+ };
1278
+ //# sourceMappingURL=bridgeDatasetTest.js.map