@ledgerhq/coin-evm 0.2.1 → 0.2.2-nightly.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 (462) hide show
  1. package/.eslintrc.js +11 -46
  2. package/.turbo/turbo-build.log +1 -1
  3. package/CHANGELOG.md +29 -1
  4. package/lib/__tests__/adapters.unit.test.d.ts +2 -0
  5. package/lib/__tests__/adapters.unit.test.d.ts.map +1 -0
  6. package/lib/__tests__/adapters.unit.test.js +455 -0
  7. package/lib/__tests__/adapters.unit.test.js.map +1 -0
  8. package/lib/__tests__/broadcast.unit.test.d.ts +2 -0
  9. package/lib/__tests__/broadcast.unit.test.d.ts.map +1 -0
  10. package/lib/__tests__/broadcast.unit.test.js +181 -0
  11. package/lib/__tests__/broadcast.unit.test.js.map +1 -0
  12. package/lib/__tests__/buildOptimisticOperation.unit.test.d.ts +2 -0
  13. package/lib/__tests__/buildOptimisticOperation.unit.test.d.ts.map +1 -0
  14. package/lib/__tests__/buildOptimisticOperation.unit.test.js +166 -0
  15. package/lib/__tests__/buildOptimisticOperation.unit.test.js.map +1 -0
  16. package/lib/__tests__/createTransaction.unit.test.d.ts +2 -0
  17. package/lib/__tests__/createTransaction.unit.test.d.ts.map +1 -0
  18. package/lib/__tests__/createTransaction.unit.test.js +50 -0
  19. package/lib/__tests__/createTransaction.unit.test.js.map +1 -0
  20. package/lib/__tests__/deviceTransactionConfig.unit.test.d.ts +2 -0
  21. package/lib/__tests__/deviceTransactionConfig.unit.test.d.ts.map +1 -0
  22. package/lib/__tests__/deviceTransactionConfig.unit.test.js +231 -0
  23. package/lib/__tests__/deviceTransactionConfig.unit.test.js.map +1 -0
  24. package/lib/__tests__/estimateMaxSpendable.unit.test.d.ts +2 -0
  25. package/lib/__tests__/estimateMaxSpendable.unit.test.d.ts.map +1 -0
  26. package/lib/__tests__/estimateMaxSpendable.unit.test.js +145 -0
  27. package/lib/__tests__/estimateMaxSpendable.unit.test.js.map +1 -0
  28. package/lib/__tests__/gasTracker/index.unit.test.d.ts +2 -0
  29. package/lib/__tests__/gasTracker/index.unit.test.d.ts.map +1 -0
  30. package/lib/__tests__/gasTracker/index.unit.test.js +35 -0
  31. package/lib/__tests__/gasTracker/index.unit.test.js.map +1 -0
  32. package/lib/__tests__/gasTracker/ledger.unit.test.d.ts +2 -0
  33. package/lib/__tests__/gasTracker/ledger.unit.test.d.ts.map +1 -0
  34. package/lib/__tests__/gasTracker/ledger.unit.test.js +110 -0
  35. package/lib/__tests__/gasTracker/ledger.unit.test.js.map +1 -0
  36. package/lib/__tests__/getTransactionStatus.unit.test.d.ts +2 -0
  37. package/lib/__tests__/getTransactionStatus.unit.test.d.ts.map +1 -0
  38. package/lib/__tests__/getTransactionStatus.unit.test.js +216 -0
  39. package/lib/__tests__/getTransactionStatus.unit.test.js.map +1 -0
  40. package/lib/__tests__/hw-getAddress.unit.test.d.ts +2 -0
  41. package/lib/__tests__/hw-getAddress.unit.test.d.ts.map +1 -0
  42. package/lib/__tests__/hw-getAddress.unit.test.js +47 -0
  43. package/lib/__tests__/hw-getAddress.unit.test.js.map +1 -0
  44. package/lib/__tests__/logic.unit.test.d.ts +2 -0
  45. package/lib/__tests__/logic.unit.test.d.ts.map +1 -0
  46. package/lib/__tests__/logic.unit.test.js +296 -0
  47. package/lib/__tests__/logic.unit.test.js.map +1 -0
  48. package/lib/__tests__/preload.unit.test.d.ts +2 -0
  49. package/lib/__tests__/preload.unit.test.d.ts.map +1 -0
  50. package/lib/__tests__/preload.unit.test.js +149 -0
  51. package/lib/__tests__/preload.unit.test.js.map +1 -0
  52. package/lib/__tests__/prepareTransaction.unit.test.d.ts +2 -0
  53. package/lib/__tests__/prepareTransaction.unit.test.d.ts.map +1 -0
  54. package/lib/__tests__/prepareTransaction.unit.test.js +248 -0
  55. package/lib/__tests__/prepareTransaction.unit.test.js.map +1 -0
  56. package/lib/__tests__/rpc.unit.test.d.ts +2 -0
  57. package/lib/__tests__/rpc.unit.test.d.ts.map +1 -0
  58. package/lib/__tests__/rpc.unit.test.js +444 -0
  59. package/lib/__tests__/rpc.unit.test.js.map +1 -0
  60. package/lib/__tests__/signOperation.unit.test.d.ts +2 -0
  61. package/lib/__tests__/signOperation.unit.test.d.ts.map +1 -0
  62. package/lib/__tests__/signOperation.unit.test.js +160 -0
  63. package/lib/__tests__/signOperation.unit.test.js.map +1 -0
  64. package/lib/__tests__/synchronization.unit.test.d.ts +2 -0
  65. package/lib/__tests__/synchronization.unit.test.d.ts.map +1 -0
  66. package/lib/__tests__/synchronization.unit.test.js +499 -0
  67. package/lib/__tests__/synchronization.unit.test.js.map +1 -0
  68. package/lib/__tests__/transaction.unit.test.d.ts +2 -0
  69. package/lib/__tests__/transaction.unit.test.d.ts.map +1 -0
  70. package/lib/__tests__/transaction.unit.test.js +201 -0
  71. package/lib/__tests__/transaction.unit.test.js.map +1 -0
  72. package/lib/abis/erc20.abi.json +222 -0
  73. package/lib/abis/optimismGasPriceOracle.abi.json +252 -0
  74. package/lib/adapters.d.ts +21 -0
  75. package/lib/adapters.d.ts.map +1 -0
  76. package/lib/adapters.js +118 -0
  77. package/lib/adapters.js.map +1 -0
  78. package/lib/api/explorer/etherscan.d.ts +24 -0
  79. package/lib/api/explorer/etherscan.d.ts.map +1 -0
  80. package/lib/api/explorer/etherscan.js +90 -0
  81. package/lib/api/explorer/etherscan.js.map +1 -0
  82. package/lib/api/explorer/index.d.ts +26 -0
  83. package/lib/api/explorer/index.d.ts.map +1 -0
  84. package/lib/api/explorer/index.js +23 -0
  85. package/lib/api/explorer/index.js.map +1 -0
  86. package/lib/api/gasTracker/index.d.ts +13 -0
  87. package/lib/api/gasTracker/index.d.ts.map +1 -0
  88. package/lib/api/gasTracker/index.js +21 -0
  89. package/lib/api/gasTracker/index.js.map +1 -0
  90. package/lib/api/gasTracker/ledger.d.ts +9 -0
  91. package/lib/api/gasTracker/ledger.d.ts.map +1 -0
  92. package/lib/api/gasTracker/ledger.js +90 -0
  93. package/lib/api/gasTracker/ledger.js.map +1 -0
  94. package/lib/api/rpc/index.d.ts +3 -0
  95. package/lib/api/rpc/index.d.ts.map +1 -0
  96. package/lib/api/rpc/index.js +32 -0
  97. package/lib/api/rpc/index.js.map +1 -0
  98. package/lib/api/rpc/rpc.common.d.ts +93 -0
  99. package/lib/api/rpc/rpc.common.d.ts.map +1 -0
  100. package/lib/api/rpc/rpc.common.js +284 -0
  101. package/lib/api/rpc/rpc.common.js.map +1 -0
  102. package/lib/api/rpc/rpc.native.d.ts +6 -0
  103. package/lib/api/rpc/rpc.native.d.ts.map +1 -0
  104. package/lib/api/rpc/rpc.native.js +35 -0
  105. package/lib/api/rpc/rpc.native.js.map +1 -0
  106. package/lib/bridge/js.d.ts +11 -0
  107. package/lib/bridge/js.d.ts.map +1 -0
  108. package/lib/bridge/js.js +58 -0
  109. package/lib/bridge/js.js.map +1 -0
  110. package/lib/bridge.integration.test.d.ts +14 -0
  111. package/lib/bridge.integration.test.d.ts.map +1 -0
  112. package/lib/bridge.integration.test.js +85 -0
  113. package/lib/bridge.integration.test.js.map +1 -0
  114. package/lib/broadcast.d.ts +8 -0
  115. package/lib/broadcast.d.ts.map +1 -0
  116. package/lib/broadcast.js +25 -0
  117. package/lib/broadcast.js.map +1 -0
  118. package/lib/buildOptimisticOperation.d.ts +16 -0
  119. package/lib/buildOptimisticOperation.d.ts.map +1 -0
  120. package/lib/buildOptimisticOperation.js +80 -0
  121. package/lib/buildOptimisticOperation.js.map +1 -0
  122. package/lib/cli-transaction.d.ts +2 -0
  123. package/lib/cli-transaction.d.ts.map +1 -0
  124. package/lib/cli-transaction.js +9 -0
  125. package/lib/cli-transaction.js.map +1 -0
  126. package/lib/createTransaction.d.ts +9 -0
  127. package/lib/createTransaction.d.ts.map +1 -0
  128. package/lib/createTransaction.js +32 -0
  129. package/lib/createTransaction.js.map +1 -0
  130. package/lib/datasets/ethereum.scanAccounts.1.d.ts +7 -0
  131. package/lib/datasets/ethereum.scanAccounts.1.d.ts.map +1 -0
  132. package/lib/datasets/ethereum.scanAccounts.1.js +51 -0
  133. package/lib/datasets/ethereum.scanAccounts.1.js.map +1 -0
  134. package/lib/datasets/ethereum1.d.ts +3 -0
  135. package/lib/datasets/ethereum1.d.ts.map +1 -0
  136. package/lib/datasets/ethereum1.js +22 -0
  137. package/lib/datasets/ethereum1.js.map +1 -0
  138. package/lib/datasets/ethereum2.d.ts +3 -0
  139. package/lib/datasets/ethereum2.d.ts.map +1 -0
  140. package/lib/datasets/ethereum2.js +22 -0
  141. package/lib/datasets/ethereum2.js.map +1 -0
  142. package/lib/datasets/ethereum_classic.d.ts +5 -0
  143. package/lib/datasets/ethereum_classic.d.ts.map +1 -0
  144. package/lib/datasets/ethereum_classic.js +69 -0
  145. package/lib/datasets/ethereum_classic.js.map +1 -0
  146. package/lib/deviceTransactionConfig.d.ts +15 -0
  147. package/lib/deviceTransactionConfig.d.ts.map +1 -0
  148. package/lib/deviceTransactionConfig.js +44 -0
  149. package/lib/deviceTransactionConfig.js.map +1 -0
  150. package/lib/errors.d.ts +16 -0
  151. package/lib/errors.d.ts.map +1 -0
  152. package/lib/errors.js +11 -0
  153. package/lib/errors.js.map +1 -0
  154. package/lib/estimateMaxSpendable.d.ts +4 -0
  155. package/lib/estimateMaxSpendable.d.ts.map +1 -0
  156. package/lib/estimateMaxSpendable.js +23 -0
  157. package/lib/estimateMaxSpendable.js.map +1 -0
  158. package/lib/getTransactionStatus.d.ts +23 -0
  159. package/lib/getTransactionStatus.d.ts.map +1 -0
  160. package/lib/getTransactionStatus.js +132 -0
  161. package/lib/getTransactionStatus.js.map +1 -0
  162. package/lib/hw-getAddress.d.ts +6 -0
  163. package/lib/hw-getAddress.d.ts.map +1 -0
  164. package/lib/hw-getAddress.js +28 -0
  165. package/lib/hw-getAddress.js.map +1 -0
  166. package/lib/logic.d.ts +31 -0
  167. package/lib/logic.d.ts.map +1 -0
  168. package/lib/logic.js +131 -0
  169. package/lib/logic.js.map +1 -0
  170. package/lib/preload.d.ts +6 -0
  171. package/lib/preload.d.ts.map +1 -0
  172. package/lib/preload.js +58 -0
  173. package/lib/preload.js.map +1 -0
  174. package/lib/prepareTransaction.d.ts +26 -0
  175. package/lib/prepareTransaction.d.ts.map +1 -0
  176. package/lib/prepareTransaction.js +128 -0
  177. package/lib/prepareTransaction.js.map +1 -0
  178. package/lib/signOperation.d.ts +18 -0
  179. package/lib/signOperation.d.ts.map +1 -0
  180. package/lib/signOperation.js +88 -0
  181. package/lib/signOperation.js.map +1 -0
  182. package/lib/signer.d.ts +27 -0
  183. package/lib/signer.d.ts.map +1 -0
  184. package/lib/signer.js +3 -0
  185. package/lib/signer.js.map +1 -0
  186. package/lib/specs.d.ts +3 -0
  187. package/lib/specs.d.ts.map +1 -0
  188. package/lib/specs.js +238 -0
  189. package/lib/specs.js.map +1 -0
  190. package/lib/speculos-deviceActions.d.ts +8 -0
  191. package/lib/speculos-deviceActions.d.ts.map +1 -0
  192. package/lib/speculos-deviceActions.js +66 -0
  193. package/lib/speculos-deviceActions.js.map +1 -0
  194. package/lib/synchronization.d.ts +27 -0
  195. package/lib/synchronization.d.ts.map +1 -0
  196. package/lib/synchronization.js +220 -0
  197. package/lib/synchronization.js.map +1 -0
  198. package/lib/testUtils.d.ts +6 -0
  199. package/lib/testUtils.d.ts.map +1 -0
  200. package/lib/testUtils.js +111 -0
  201. package/lib/testUtils.js.map +1 -0
  202. package/lib/transaction.d.ts +43 -0
  203. package/lib/transaction.d.ts.map +1 -0
  204. package/lib/transaction.js +124 -0
  205. package/lib/transaction.js.map +1 -0
  206. package/lib/types.d.ts +111 -0
  207. package/lib/types.d.ts.map +1 -0
  208. package/lib/types.js +3 -0
  209. package/lib/types.js.map +1 -0
  210. package/lib-es/__tests__/adapters.unit.test.d.ts +2 -0
  211. package/lib-es/__tests__/adapters.unit.test.d.ts.map +1 -0
  212. package/lib-es/__tests__/adapters.unit.test.js +450 -0
  213. package/lib-es/__tests__/adapters.unit.test.js.map +1 -0
  214. package/lib-es/__tests__/broadcast.unit.test.d.ts +2 -0
  215. package/lib-es/__tests__/broadcast.unit.test.d.ts.map +1 -0
  216. package/lib-es/__tests__/broadcast.unit.test.js +153 -0
  217. package/lib-es/__tests__/broadcast.unit.test.js.map +1 -0
  218. package/lib-es/__tests__/buildOptimisticOperation.unit.test.d.ts +2 -0
  219. package/lib-es/__tests__/buildOptimisticOperation.unit.test.d.ts.map +1 -0
  220. package/lib-es/__tests__/buildOptimisticOperation.unit.test.js +161 -0
  221. package/lib-es/__tests__/buildOptimisticOperation.unit.test.js.map +1 -0
  222. package/lib-es/__tests__/createTransaction.unit.test.d.ts +2 -0
  223. package/lib-es/__tests__/createTransaction.unit.test.d.ts.map +1 -0
  224. package/lib-es/__tests__/createTransaction.unit.test.js +45 -0
  225. package/lib-es/__tests__/createTransaction.unit.test.js.map +1 -0
  226. package/lib-es/__tests__/deviceTransactionConfig.unit.test.d.ts +2 -0
  227. package/lib-es/__tests__/deviceTransactionConfig.unit.test.d.ts.map +1 -0
  228. package/lib-es/__tests__/deviceTransactionConfig.unit.test.js +226 -0
  229. package/lib-es/__tests__/deviceTransactionConfig.unit.test.js.map +1 -0
  230. package/lib-es/__tests__/estimateMaxSpendable.unit.test.d.ts +2 -0
  231. package/lib-es/__tests__/estimateMaxSpendable.unit.test.d.ts.map +1 -0
  232. package/lib-es/__tests__/estimateMaxSpendable.unit.test.js +117 -0
  233. package/lib-es/__tests__/estimateMaxSpendable.unit.test.js.map +1 -0
  234. package/lib-es/__tests__/gasTracker/index.unit.test.d.ts +2 -0
  235. package/lib-es/__tests__/gasTracker/index.unit.test.d.ts.map +1 -0
  236. package/lib-es/__tests__/gasTracker/index.unit.test.js +33 -0
  237. package/lib-es/__tests__/gasTracker/index.unit.test.js.map +1 -0
  238. package/lib-es/__tests__/gasTracker/ledger.unit.test.d.ts +2 -0
  239. package/lib-es/__tests__/gasTracker/ledger.unit.test.d.ts.map +1 -0
  240. package/lib-es/__tests__/gasTracker/ledger.unit.test.js +105 -0
  241. package/lib-es/__tests__/gasTracker/ledger.unit.test.js.map +1 -0
  242. package/lib-es/__tests__/getTransactionStatus.unit.test.d.ts +2 -0
  243. package/lib-es/__tests__/getTransactionStatus.unit.test.d.ts.map +1 -0
  244. package/lib-es/__tests__/getTransactionStatus.unit.test.js +211 -0
  245. package/lib-es/__tests__/getTransactionStatus.unit.test.js.map +1 -0
  246. package/lib-es/__tests__/hw-getAddress.unit.test.d.ts +2 -0
  247. package/lib-es/__tests__/hw-getAddress.unit.test.d.ts.map +1 -0
  248. package/lib-es/__tests__/hw-getAddress.unit.test.js +42 -0
  249. package/lib-es/__tests__/hw-getAddress.unit.test.js.map +1 -0
  250. package/lib-es/__tests__/logic.unit.test.d.ts +2 -0
  251. package/lib-es/__tests__/logic.unit.test.d.ts.map +1 -0
  252. package/lib-es/__tests__/logic.unit.test.js +268 -0
  253. package/lib-es/__tests__/logic.unit.test.js.map +1 -0
  254. package/lib-es/__tests__/preload.unit.test.d.ts +2 -0
  255. package/lib-es/__tests__/preload.unit.test.d.ts.map +1 -0
  256. package/lib-es/__tests__/preload.unit.test.js +121 -0
  257. package/lib-es/__tests__/preload.unit.test.js.map +1 -0
  258. package/lib-es/__tests__/prepareTransaction.unit.test.d.ts +2 -0
  259. package/lib-es/__tests__/prepareTransaction.unit.test.d.ts.map +1 -0
  260. package/lib-es/__tests__/prepareTransaction.unit.test.js +220 -0
  261. package/lib-es/__tests__/prepareTransaction.unit.test.js.map +1 -0
  262. package/lib-es/__tests__/rpc.unit.test.d.ts +2 -0
  263. package/lib-es/__tests__/rpc.unit.test.d.ts.map +1 -0
  264. package/lib-es/__tests__/rpc.unit.test.js +416 -0
  265. package/lib-es/__tests__/rpc.unit.test.js.map +1 -0
  266. package/lib-es/__tests__/signOperation.unit.test.d.ts +2 -0
  267. package/lib-es/__tests__/signOperation.unit.test.d.ts.map +1 -0
  268. package/lib-es/__tests__/signOperation.unit.test.js +132 -0
  269. package/lib-es/__tests__/signOperation.unit.test.js.map +1 -0
  270. package/lib-es/__tests__/synchronization.unit.test.d.ts +2 -0
  271. package/lib-es/__tests__/synchronization.unit.test.d.ts.map +1 -0
  272. package/lib-es/__tests__/synchronization.unit.test.js +471 -0
  273. package/lib-es/__tests__/synchronization.unit.test.js.map +1 -0
  274. package/lib-es/__tests__/transaction.unit.test.d.ts +2 -0
  275. package/lib-es/__tests__/transaction.unit.test.d.ts.map +1 -0
  276. package/lib-es/__tests__/transaction.unit.test.js +173 -0
  277. package/lib-es/__tests__/transaction.unit.test.js.map +1 -0
  278. package/lib-es/abis/erc20.abi.json +222 -0
  279. package/lib-es/abis/optimismGasPriceOracle.abi.json +252 -0
  280. package/lib-es/adapters.d.ts +21 -0
  281. package/lib-es/adapters.d.ts.map +1 -0
  282. package/lib-es/adapters.js +109 -0
  283. package/lib-es/adapters.js.map +1 -0
  284. package/lib-es/api/explorer/etherscan.d.ts +24 -0
  285. package/lib-es/api/explorer/etherscan.d.ts.map +1 -0
  286. package/lib-es/api/explorer/etherscan.js +84 -0
  287. package/lib-es/api/explorer/etherscan.js.map +1 -0
  288. package/lib-es/api/explorer/index.d.ts +26 -0
  289. package/lib-es/api/explorer/index.d.ts.map +1 -0
  290. package/lib-es/api/explorer/index.js +16 -0
  291. package/lib-es/api/explorer/index.js.map +1 -0
  292. package/lib-es/api/gasTracker/index.d.ts +13 -0
  293. package/lib-es/api/gasTracker/index.d.ts.map +1 -0
  294. package/lib-es/api/gasTracker/index.js +17 -0
  295. package/lib-es/api/gasTracker/index.js.map +1 -0
  296. package/lib-es/api/gasTracker/ledger.d.ts +9 -0
  297. package/lib-es/api/gasTracker/ledger.d.ts.map +1 -0
  298. package/lib-es/api/gasTracker/ledger.js +83 -0
  299. package/lib-es/api/gasTracker/ledger.js.map +1 -0
  300. package/lib-es/api/rpc/index.d.ts +3 -0
  301. package/lib-es/api/rpc/index.d.ts.map +1 -0
  302. package/lib-es/api/rpc/index.js +4 -0
  303. package/lib-es/api/rpc/index.js.map +1 -0
  304. package/lib-es/api/rpc/rpc.common.d.ts +93 -0
  305. package/lib-es/api/rpc/rpc.common.d.ts.map +1 -0
  306. package/lib-es/api/rpc/rpc.common.js +267 -0
  307. package/lib-es/api/rpc/rpc.common.js.map +1 -0
  308. package/lib-es/api/rpc/rpc.native.d.ts +6 -0
  309. package/lib-es/api/rpc/rpc.native.d.ts.map +1 -0
  310. package/lib-es/api/rpc/rpc.native.js +7 -0
  311. package/lib-es/api/rpc/rpc.native.js.map +1 -0
  312. package/lib-es/bridge/js.d.ts +11 -0
  313. package/lib-es/bridge/js.d.ts.map +1 -0
  314. package/lib-es/bridge/js.js +49 -0
  315. package/lib-es/bridge/js.js.map +1 -0
  316. package/lib-es/bridge.integration.test.d.ts +14 -0
  317. package/lib-es/bridge.integration.test.d.ts.map +1 -0
  318. package/lib-es/bridge.integration.test.js +79 -0
  319. package/lib-es/bridge.integration.test.js.map +1 -0
  320. package/lib-es/broadcast.d.ts +8 -0
  321. package/lib-es/broadcast.d.ts.map +1 -0
  322. package/lib-es/broadcast.js +21 -0
  323. package/lib-es/broadcast.js.map +1 -0
  324. package/lib-es/buildOptimisticOperation.d.ts +16 -0
  325. package/lib-es/buildOptimisticOperation.d.ts.map +1 -0
  326. package/lib-es/buildOptimisticOperation.js +71 -0
  327. package/lib-es/buildOptimisticOperation.js.map +1 -0
  328. package/lib-es/cli-transaction.d.ts +2 -0
  329. package/lib-es/cli-transaction.d.ts.map +1 -0
  330. package/lib-es/cli-transaction.js +6 -0
  331. package/lib-es/cli-transaction.js.map +1 -0
  332. package/lib-es/createTransaction.d.ts +9 -0
  333. package/lib-es/createTransaction.d.ts.map +1 -0
  334. package/lib-es/createTransaction.js +25 -0
  335. package/lib-es/createTransaction.js.map +1 -0
  336. package/lib-es/datasets/ethereum.scanAccounts.1.d.ts +7 -0
  337. package/lib-es/datasets/ethereum.scanAccounts.1.d.ts.map +1 -0
  338. package/lib-es/datasets/ethereum.scanAccounts.1.js +49 -0
  339. package/lib-es/datasets/ethereum.scanAccounts.1.js.map +1 -0
  340. package/lib-es/datasets/ethereum1.d.ts +3 -0
  341. package/lib-es/datasets/ethereum1.d.ts.map +1 -0
  342. package/lib-es/datasets/ethereum1.js +19 -0
  343. package/lib-es/datasets/ethereum1.js.map +1 -0
  344. package/lib-es/datasets/ethereum2.d.ts +3 -0
  345. package/lib-es/datasets/ethereum2.d.ts.map +1 -0
  346. package/lib-es/datasets/ethereum2.js +19 -0
  347. package/lib-es/datasets/ethereum2.js.map +1 -0
  348. package/lib-es/datasets/ethereum_classic.d.ts +5 -0
  349. package/lib-es/datasets/ethereum_classic.d.ts.map +1 -0
  350. package/lib-es/datasets/ethereum_classic.js +67 -0
  351. package/lib-es/datasets/ethereum_classic.js.map +1 -0
  352. package/lib-es/deviceTransactionConfig.d.ts +15 -0
  353. package/lib-es/deviceTransactionConfig.d.ts.map +1 -0
  354. package/lib-es/deviceTransactionConfig.js +42 -0
  355. package/lib-es/deviceTransactionConfig.js.map +1 -0
  356. package/lib-es/errors.d.ts +16 -0
  357. package/lib-es/errors.d.ts.map +1 -0
  358. package/lib-es/errors.js +8 -0
  359. package/lib-es/errors.js.map +1 -0
  360. package/lib-es/estimateMaxSpendable.d.ts +4 -0
  361. package/lib-es/estimateMaxSpendable.d.ts.map +1 -0
  362. package/lib-es/estimateMaxSpendable.js +19 -0
  363. package/lib-es/estimateMaxSpendable.js.map +1 -0
  364. package/lib-es/getTransactionStatus.d.ts +23 -0
  365. package/lib-es/getTransactionStatus.d.ts.map +1 -0
  366. package/lib-es/getTransactionStatus.js +125 -0
  367. package/lib-es/getTransactionStatus.js.map +1 -0
  368. package/lib-es/hw-getAddress.d.ts +6 -0
  369. package/lib-es/hw-getAddress.d.ts.map +1 -0
  370. package/lib-es/hw-getAddress.js +23 -0
  371. package/lib-es/hw-getAddress.js.map +1 -0
  372. package/lib-es/logic.d.ts +31 -0
  373. package/lib-es/logic.d.ts.map +1 -0
  374. package/lib-es/logic.js +119 -0
  375. package/lib-es/logic.js.map +1 -0
  376. package/lib-es/preload.d.ts +6 -0
  377. package/lib-es/preload.d.ts.map +1 -0
  378. package/lib-es/preload.js +49 -0
  379. package/lib-es/preload.js.map +1 -0
  380. package/lib-es/prepareTransaction.d.ts +26 -0
  381. package/lib-es/prepareTransaction.d.ts.map +1 -0
  382. package/lib-es/prepareTransaction.js +118 -0
  383. package/lib-es/prepareTransaction.js.map +1 -0
  384. package/lib-es/signOperation.d.ts +18 -0
  385. package/lib-es/signOperation.d.ts.map +1 -0
  386. package/lib-es/signOperation.js +83 -0
  387. package/lib-es/signOperation.js.map +1 -0
  388. package/lib-es/signer.d.ts +27 -0
  389. package/lib-es/signer.d.ts.map +1 -0
  390. package/lib-es/signer.js +2 -0
  391. package/lib-es/signer.js.map +1 -0
  392. package/lib-es/specs.d.ts +3 -0
  393. package/lib-es/specs.d.ts.map +1 -0
  394. package/lib-es/specs.js +233 -0
  395. package/lib-es/specs.js.map +1 -0
  396. package/lib-es/speculos-deviceActions.d.ts +8 -0
  397. package/lib-es/speculos-deviceActions.d.ts.map +1 -0
  398. package/lib-es/speculos-deviceActions.js +63 -0
  399. package/lib-es/speculos-deviceActions.js.map +1 -0
  400. package/lib-es/synchronization.d.ts +27 -0
  401. package/lib-es/synchronization.d.ts.map +1 -0
  402. package/lib-es/synchronization.js +212 -0
  403. package/lib-es/synchronization.js.map +1 -0
  404. package/lib-es/testUtils.d.ts +6 -0
  405. package/lib-es/testUtils.d.ts.map +1 -0
  406. package/lib-es/testUtils.js +102 -0
  407. package/lib-es/testUtils.js.map +1 -0
  408. package/lib-es/transaction.d.ts +43 -0
  409. package/lib-es/transaction.d.ts.map +1 -0
  410. package/lib-es/transaction.js +112 -0
  411. package/lib-es/transaction.js.map +1 -0
  412. package/lib-es/types.d.ts +111 -0
  413. package/lib-es/types.d.ts.map +1 -0
  414. package/lib-es/types.js +2 -0
  415. package/lib-es/types.js.map +1 -0
  416. package/package.json +8 -23
  417. package/src/__tests__/adapters.unit.test.ts +22 -52
  418. package/src/__tests__/broadcast.unit.test.ts +9 -27
  419. package/src/__tests__/buildOptimisticOperation.unit.test.ts +4 -4
  420. package/src/__tests__/deviceTransactionConfig.unit.test.ts +7 -7
  421. package/src/__tests__/estimateMaxSpendable.unit.test.ts +2 -4
  422. package/src/__tests__/gasTracker/index.unit.test.ts +36 -0
  423. package/src/__tests__/gasTracker/ledger.unit.test.ts +108 -0
  424. package/src/__tests__/getTransactionStatus.unit.test.ts +35 -40
  425. package/src/__tests__/hw-getAddress.unit.test.ts +15 -2
  426. package/src/__tests__/logic.unit.test.ts +25 -72
  427. package/src/__tests__/preload.unit.test.ts +3 -9
  428. package/src/__tests__/prepareTransaction.unit.test.ts +131 -76
  429. package/src/__tests__/rpc.unit.test.ts +46 -80
  430. package/src/__tests__/signOperation.unit.test.ts +27 -25
  431. package/src/__tests__/synchronization.unit.test.ts +101 -153
  432. package/src/__tests__/transaction.unit.test.ts +6 -14
  433. package/src/adapters.ts +8 -18
  434. package/src/api/{etherscan.ts → explorer/etherscan.ts} +14 -29
  435. package/src/api/explorer/index.ts +34 -0
  436. package/src/api/gasTracker/index.ts +31 -0
  437. package/src/api/gasTracker/ledger.ts +103 -0
  438. package/src/api/{rpc.common.ts → rpc/rpc.common.ts} +41 -64
  439. package/src/bridge/js.ts +15 -22
  440. package/src/bridge.integration.test.ts +3 -10
  441. package/src/broadcast.ts +3 -7
  442. package/src/buildOptimisticOperation.ts +7 -17
  443. package/src/cli-transaction.ts +1 -7
  444. package/src/createTransaction.ts +14 -15
  445. package/src/deviceTransactionConfig.ts +1 -1
  446. package/src/errors.ts +6 -0
  447. package/src/estimateMaxSpendable.ts +14 -11
  448. package/src/getTransactionStatus.ts +41 -52
  449. package/src/hw-getAddress.ts +18 -19
  450. package/src/logic.ts +5 -15
  451. package/src/preload.ts +6 -16
  452. package/src/prepareTransaction.ts +30 -31
  453. package/src/signOperation.ts +57 -69
  454. package/src/signer.ts +35 -0
  455. package/src/specs.ts +27 -52
  456. package/src/speculos-deviceActions.ts +56 -65
  457. package/src/synchronization.ts +21 -60
  458. package/src/testUtils.ts +5 -19
  459. package/src/transaction.ts +6 -10
  460. package/src/types.ts +6 -0
  461. /package/src/api/{rpc.ts → rpc/index.ts} +0 -0
  462. /package/src/api/{rpc.native.ts → rpc/rpc.native.ts} +0 -0
@@ -18,13 +18,8 @@ import { EvmTransactionEIP1559, EvmTransactionLegacy } from "../types";
18
18
 
19
19
  const recipient = "0xe2ca7390e76c5A992749bB622087310d2e63ca29"; // rambo.eth
20
20
  const testData = Buffer.from("testBufferString").toString("hex");
21
- const tokenAccount = makeTokenAccount(
22
- "0xkvn",
23
- getTokenById("ethereum/erc20/usd__coin")
24
- );
25
- const account = makeAccount("0xkvn", getCryptoCurrencyById("ethereum"), [
26
- tokenAccount,
27
- ]);
21
+ const tokenAccount = makeTokenAccount("0xkvn", getTokenById("ethereum/erc20/usd__coin"));
22
+ const account = makeAccount("0xkvn", getCryptoCurrencyById("ethereum"), [tokenAccount]);
28
23
  const legacyTx: EvmTransactionLegacy = {
29
24
  amount: new BigNumber(100),
30
25
  useAllAmount: false,
@@ -66,7 +61,7 @@ describe("EVM Family", () => {
66
61
  expect(res.errors).toEqual(
67
62
  expect.objectContaining({
68
63
  recipient: new RecipientRequired(),
69
- })
64
+ }),
70
65
  );
71
66
  });
72
67
 
@@ -78,7 +73,7 @@ describe("EVM Family", () => {
78
73
  recipient: new InvalidAddress("", {
79
74
  currency: account.currency,
80
75
  }),
81
- })
76
+ }),
82
77
  );
83
78
  });
84
79
 
@@ -93,7 +88,7 @@ describe("EVM Family", () => {
93
88
  recipient: new InvalidAddress("", {
94
89
  currency: account.currency,
95
90
  }),
96
- })
91
+ }),
97
92
  );
98
93
  });
99
94
 
@@ -103,7 +98,7 @@ describe("EVM Family", () => {
103
98
  expect(res.warnings).toEqual(
104
99
  expect.objectContaining({
105
100
  recipient: new ETHAddressNonEIP(),
106
- })
101
+ }),
107
102
  );
108
103
  });
109
104
  });
@@ -120,7 +115,7 @@ describe("EVM Family", () => {
120
115
  expect(res.errors).toEqual(
121
116
  expect.objectContaining({
122
117
  amount: new AmountRequired(),
123
- })
118
+ }),
124
119
  );
125
120
  });
126
121
 
@@ -131,7 +126,7 @@ describe("EVM Family", () => {
131
126
  };
132
127
  const res = await getTransactionStatus(
133
128
  { ...account, balance: new BigNumber(10000000) },
134
- tx
129
+ tx,
135
130
  );
136
131
 
137
132
  expect(res.errors).toEqual({});
@@ -155,7 +150,7 @@ describe("EVM Family", () => {
155
150
  },
156
151
  ],
157
152
  },
158
- tx
153
+ tx,
159
154
  );
160
155
 
161
156
  expect(res.errors).toEqual({});
@@ -164,13 +159,13 @@ describe("EVM Family", () => {
164
159
  it("should detect account not having enough balance for a tx and have an error", async () => {
165
160
  const res = await getTransactionStatus(
166
161
  { ...account, balance: new BigNumber(0) },
167
- eip1559Tx
162
+ eip1559Tx,
168
163
  );
169
164
 
170
165
  expect(res.errors).toEqual(
171
166
  expect.objectContaining({
172
167
  amount: new NotEnoughBalance(),
173
- })
168
+ }),
174
169
  );
175
170
  });
176
171
  });
@@ -183,7 +178,7 @@ describe("EVM Family", () => {
183
178
  expect(res.errors).toEqual(
184
179
  expect.objectContaining({
185
180
  gasPrice: new FeeNotLoaded(),
186
- })
181
+ }),
187
182
  );
188
183
  });
189
184
 
@@ -194,7 +189,7 @@ describe("EVM Family", () => {
194
189
  expect(res.errors).toEqual(
195
190
  expect.objectContaining({
196
191
  gasPrice: new FeeNotLoaded(),
197
- })
192
+ }),
198
193
  );
199
194
  });
200
195
 
@@ -205,7 +200,7 @@ describe("EVM Family", () => {
205
200
  expect(res.errors).toEqual(
206
201
  expect.objectContaining({
207
202
  gasLimit: new FeeNotLoaded(),
208
- })
203
+ }),
209
204
  );
210
205
  });
211
206
 
@@ -216,7 +211,7 @@ describe("EVM Family", () => {
216
211
  expect(res.errors).toEqual(
217
212
  expect.objectContaining({
218
213
  gasLimit: new FeeNotLoaded(),
219
- })
214
+ }),
220
215
  );
221
216
  });
222
217
 
@@ -227,29 +222,29 @@ describe("EVM Family", () => {
227
222
  expect(res.errors).toEqual(
228
223
  expect.objectContaining({
229
224
  gasLimit: new GasLessThanEstimate(),
230
- })
225
+ }),
231
226
  );
232
227
  });
233
228
 
234
229
  it("should detect gas being too high in a 1559 tx for the account balance and have an error", async () => {
235
230
  const notEnoughBalanceResponse = await getTransactionStatus(
236
231
  { ...account, balance: new BigNumber(2099999) },
237
- eip1559Tx
232
+ eip1559Tx,
238
233
  );
239
234
  const enoughhBalanceResponse = await getTransactionStatus(
240
235
  { ...account, balance: new BigNumber(2100000) },
241
- eip1559Tx
236
+ eip1559Tx,
242
237
  );
243
238
 
244
239
  expect(notEnoughBalanceResponse.errors).toEqual(
245
240
  expect.objectContaining({
246
241
  gasPrice: new NotEnoughGas(),
247
- })
242
+ }),
248
243
  );
249
244
  expect(enoughhBalanceResponse.errors).not.toEqual(
250
245
  expect.objectContaining({
251
246
  gasPrice: new NotEnoughGas(),
252
- })
247
+ }),
253
248
  );
254
249
  });
255
250
 
@@ -259,79 +254,79 @@ describe("EVM Family", () => {
259
254
  {
260
255
  ...eip1559Tx,
261
256
  maxPriorityFeePerGas: new BigNumber(0),
262
- }
257
+ },
263
258
  );
264
259
 
265
260
  expect(res.errors).toEqual(
266
261
  expect.objectContaining({
267
262
  maxPriorityFee: new PriorityFeeTooLow(),
268
- })
263
+ }),
269
264
  );
270
265
  });
271
266
 
272
267
  it("should detect gas being too high in a legacy tx for the account balance and have an error", async () => {
273
268
  const notEnoughBalanceResponse = await getTransactionStatus(
274
269
  { ...account, balance: new BigNumber(2099999) },
275
- legacyTx
270
+ legacyTx,
276
271
  );
277
272
  const enoughhBalanceResponse = await getTransactionStatus(
278
273
  { ...account, balance: new BigNumber(2100001) },
279
- legacyTx
274
+ legacyTx,
280
275
  );
281
276
 
282
277
  expect(notEnoughBalanceResponse.errors).toEqual(
283
278
  expect.objectContaining({
284
279
  gasPrice: new NotEnoughGas(),
285
- })
280
+ }),
286
281
  );
287
282
  expect(enoughhBalanceResponse.errors).not.toEqual(
288
283
  expect.objectContaining({
289
284
  gasPrice: new NotEnoughGas(),
290
- })
285
+ }),
291
286
  );
292
287
  });
293
288
 
294
289
  it("should not detect gas being too high in a 1559 tx when there is no recipient and have an error", async () => {
295
290
  const notEnoughBalanceResponse = await getTransactionStatus(
296
291
  { ...account, balance: new BigNumber(2099999) },
297
- { ...eip1559Tx, recipient: "" }
292
+ { ...eip1559Tx, recipient: "" },
298
293
  );
299
294
  const enoughhBalanceResponse = await getTransactionStatus(
300
295
  { ...account, balance: new BigNumber(2100000) },
301
- { ...eip1559Tx, recipient: "" }
296
+ { ...eip1559Tx, recipient: "" },
302
297
  );
303
298
 
304
299
  expect(notEnoughBalanceResponse.errors).not.toEqual(
305
300
  expect.objectContaining({
306
301
  gasPrice: new NotEnoughGas(),
307
- })
302
+ }),
308
303
  );
309
304
  expect(enoughhBalanceResponse.errors).not.toEqual(
310
305
  expect.objectContaining({
311
306
  gasPrice: new NotEnoughGas(),
312
- })
307
+ }),
313
308
  );
314
309
  });
315
310
 
316
311
  it("should not detect gas being too high in a legacy tx when there is no recipient and have an error", async () => {
317
312
  const notEnoughBalanceResponse = await getTransactionStatus(
318
313
  { ...account, balance: new BigNumber(2099999) },
319
- { ...legacyTx, recipient: "" }
314
+ { ...legacyTx, recipient: "" },
320
315
  );
321
316
  const enoughhBalanceResponse = await getTransactionStatus(
322
317
  { ...account, balance: new BigNumber(2100001) },
323
- { ...legacyTx, recipient: "" }
318
+ { ...legacyTx, recipient: "" },
324
319
  );
325
320
 
326
321
  expect(notEnoughBalanceResponse.errors).not.toEqual(
327
322
  expect.objectContaining({
328
323
  gasPrice: new NotEnoughGas(),
329
- })
324
+ }),
330
325
  );
331
326
  expect(enoughhBalanceResponse.errors).not.toEqual(
332
327
  expect.objectContaining({
333
328
  gasPrice: new NotEnoughGas(),
334
- })
329
+ }),
335
330
  );
336
331
  });
337
332
  });
@@ -347,7 +342,7 @@ describe("EVM Family", () => {
347
342
  estimatedFees: new BigNumber(2100000),
348
343
  amount: legacyTx.amount,
349
344
  totalSpent: new BigNumber(2100000).plus(legacyTx.amount),
350
- })
345
+ }),
351
346
  );
352
347
  });
353
348
  });
@@ -1,5 +1,6 @@
1
1
  import eip55 from "eip55";
2
- import getAddress from "../hw-getAddress";
2
+ import resolver from "../hw-getAddress";
3
+ import { EvmAddress, EvmSignature, EvmSigner } from "../signer";
3
4
 
4
5
  const address = "0xc3f95102D5c8F2c83e49Ce3Acfb905eDfb7f37dE";
5
6
  jest.mock(
@@ -10,12 +11,24 @@ jest.mock(
10
11
  publicKey: "",
11
12
  address: address.toLowerCase(),
12
13
  });
13
- }
14
+ },
14
15
  );
16
+ const mockSignerFactory = (
17
+ _: string,
18
+ fn: (signer: EvmSigner) => Promise<EvmAddress | EvmSignature>,
19
+ ) =>
20
+ fn({
21
+ getAddress: async () => ({
22
+ publicKey: "",
23
+ address: address.toLowerCase(),
24
+ }),
25
+ signTransaction: jest.fn(),
26
+ });
15
27
 
16
28
  describe("EVM Family", () => {
17
29
  describe("hw-getAddress.ts", () => {
18
30
  it("should return an eip 55 encoded address", async () => {
31
+ const getAddress = resolver(mockSignerFactory);
19
32
  const response = await getAddress({} as any, {} as any);
20
33
  expect(response.address).toBe(address);
21
34
  expect(eip55.verify(response.address)).toBe(true);
@@ -2,7 +2,7 @@ import { getCryptoCurrencyById, getTokenById } from "@ledgerhq/cryptoassets";
2
2
  import * as cryptoAssetsTokens from "@ledgerhq/cryptoassets/tokens";
3
3
  import { TokenCurrency } from "@ledgerhq/types-cryptoassets";
4
4
  import BigNumber from "bignumber.js";
5
- import * as RPC_API from "../api/rpc.common";
5
+ import * as RPC_API from "../api/rpc/rpc.common";
6
6
  import {
7
7
  eip1559TransactionHasFees,
8
8
  getAdditionalLayer2Fees,
@@ -147,18 +147,14 @@ describe("EVM Family", () => {
147
147
  });
148
148
 
149
149
  it("should try to get additionalFees for a valid layer 2", async () => {
150
- const spy = jest
151
- .spyOn(RPC_API, "getOptimismAdditionalFees")
152
- .mockImplementation(jest.fn());
150
+ const spy = jest.spyOn(RPC_API, "getOptimismAdditionalFees").mockImplementation(jest.fn());
153
151
 
154
152
  await getAdditionalLayer2Fees(optimism, {} as any);
155
153
  expect(spy).toBeCalled();
156
154
  });
157
155
 
158
156
  it("should not try to get additionalFees for an invalid layer 2", async () => {
159
- const spy = jest
160
- .spyOn(RPC_API, "getOptimismAdditionalFees")
161
- .mockImplementation(jest.fn());
157
+ const spy = jest.spyOn(RPC_API, "getOptimismAdditionalFees").mockImplementation(jest.fn());
162
158
 
163
159
  await getAdditionalLayer2Fees(ethereum, {} as any);
164
160
  expect(spy).not.toBeCalled();
@@ -168,10 +164,7 @@ describe("EVM Family", () => {
168
164
  describe("mergeSubAccounts", () => {
169
165
  it("should merge 2 different sub accounts", () => {
170
166
  const tokenAccount1 = {
171
- ...makeTokenAccount(
172
- "0xkvn",
173
- getTokenById("ethereum/erc20/usd__coin")
174
- ),
167
+ ...makeTokenAccount("0xkvn", getTokenById("ethereum/erc20/usd__coin")),
175
168
  balance: new BigNumber(1),
176
169
  operations: [],
177
170
  };
@@ -180,11 +173,7 @@ describe("EVM Family", () => {
180
173
  balance: new BigNumber(2),
181
174
  operations: [],
182
175
  };
183
- const account = makeAccount(
184
- "0xkvn",
185
- getCryptoCurrencyById("ethereum"),
186
- [tokenAccount1]
187
- );
176
+ const account = makeAccount("0xkvn", getCryptoCurrencyById("ethereum"), [tokenAccount1]);
188
177
 
189
178
  const newSubAccounts = mergeSubAccounts(account, [tokenAccount2]);
190
179
  expect(newSubAccounts).toEqual([tokenAccount1, tokenAccount2]);
@@ -195,10 +184,7 @@ describe("EVM Family", () => {
195
184
 
196
185
  it("should merge 2 different sub accounts and update the first one", () => {
197
186
  const tokenAccount1 = {
198
- ...makeTokenAccount(
199
- "0xkvn",
200
- getTokenById("ethereum/erc20/usd__coin")
201
- ),
187
+ ...makeTokenAccount("0xkvn", getTokenById("ethereum/erc20/usd__coin")),
202
188
  balance: new BigNumber(1),
203
189
  operations: [],
204
190
  };
@@ -228,16 +214,9 @@ describe("EVM Family", () => {
228
214
  balance: new BigNumber(2),
229
215
  operations: [],
230
216
  };
231
- const account = makeAccount(
232
- "0xkvn",
233
- getCryptoCurrencyById("ethereum"),
234
- [tokenAccount1]
235
- );
217
+ const account = makeAccount("0xkvn", getCryptoCurrencyById("ethereum"), [tokenAccount1]);
236
218
 
237
- const newSubAccounts = mergeSubAccounts(account, [
238
- tokenAccount1Bis,
239
- tokenAccount2,
240
- ]);
219
+ const newSubAccounts = mergeSubAccounts(account, [tokenAccount1Bis, tokenAccount2]);
241
220
  expect(newSubAccounts).toEqual([tokenAccount1Bis, tokenAccount2]);
242
221
  expect(newSubAccounts).not.toBe(account.subAccounts); // shouldn't mutate original account
243
222
  expect(account.subAccounts).toEqual([tokenAccount1]); // shouldn't mutate original account
@@ -253,10 +232,7 @@ describe("EVM Family", () => {
253
232
  hash: "0xAgAinAnotHeRH4sh",
254
233
  });
255
234
  const tokenAccount1 = {
256
- ...makeTokenAccount(
257
- "0xkvn",
258
- getTokenById("ethereum/erc20/usd__coin")
259
- ),
235
+ ...makeTokenAccount("0xkvn", getTokenById("ethereum/erc20/usd__coin")),
260
236
  balance: new BigNumber(1),
261
237
  operations: [op1, op2],
262
238
  operationsCount: 2,
@@ -266,31 +242,20 @@ describe("EVM Family", () => {
266
242
  operations: [op3, op1, op2],
267
243
  operationsCount: 3,
268
244
  };
269
- const account = makeAccount(
270
- "0xkvn",
271
- getCryptoCurrencyById("ethereum"),
272
- [tokenAccount1]
273
- );
245
+ const account = makeAccount("0xkvn", getCryptoCurrencyById("ethereum"), [tokenAccount1]);
274
246
 
275
247
  const newSubAccounts = mergeSubAccounts(account, [tokenAccount1Bis]);
276
248
  expect(newSubAccounts).not.toBe(account.subAccounts); // shouldn't mutate original account
277
249
  expect(account.subAccounts).toEqual([tokenAccount1]); // shouldn't mutate original account
278
250
  expect(newSubAccounts[0]).not.toBe(account.subAccounts?.[0]); // changing the ref as change happened
279
- expect(newSubAccounts[0]?.operations?.[1]).toBe(
280
- account.subAccounts?.[0]?.operations?.[0]
281
- ); // keeping the reference for the ops though
282
- expect(newSubAccounts[0]?.operations?.[2]).toBe(
283
- account.subAccounts?.[0]?.operations?.[1]
284
- ); // keeping the reference for the ops though
251
+ expect(newSubAccounts[0]?.operations?.[1]).toBe(account.subAccounts?.[0]?.operations?.[0]); // keeping the reference for the ops though
252
+ expect(newSubAccounts[0]?.operations?.[2]).toBe(account.subAccounts?.[0]?.operations?.[1]); // keeping the reference for the ops though
285
253
  expect(newSubAccounts).toEqual([tokenAccount1Bis]);
286
254
  });
287
255
 
288
256
  it("should return only new sub accounts", () => {
289
257
  const tokenAccount = {
290
- ...makeTokenAccount(
291
- "0xkvn",
292
- getTokenById("ethereum/erc20/usd__coin")
293
- ),
258
+ ...makeTokenAccount("0xkvn", getTokenById("ethereum/erc20/usd__coin")),
294
259
  balance: new BigNumber(1),
295
260
  };
296
261
  const account = makeAccount("0xkvn", getCryptoCurrencyById("ethereum"));
@@ -303,17 +268,10 @@ describe("EVM Family", () => {
303
268
 
304
269
  it("should dedup sub accounts", () => {
305
270
  const tokenAccount = {
306
- ...makeTokenAccount(
307
- "0xkvn",
308
- getTokenById("ethereum/erc20/usd__coin")
309
- ),
271
+ ...makeTokenAccount("0xkvn", getTokenById("ethereum/erc20/usd__coin")),
310
272
  balance: new BigNumber(1),
311
273
  };
312
- const account = makeAccount(
313
- "0xkvn",
314
- getCryptoCurrencyById("ethereum"),
315
- [tokenAccount]
316
- );
274
+ const account = makeAccount("0xkvn", getCryptoCurrencyById("ethereum"), [tokenAccount]);
317
275
 
318
276
  const newSubAccounts = mergeSubAccounts(account, [
319
277
  tokenAccount,
@@ -332,9 +290,7 @@ describe("EVM Family", () => {
332
290
  });
333
291
 
334
292
  it("should provide a valid sha256 hash", () => {
335
- expect(getSyncHash(currency)).toStrictEqual(
336
- expect.stringMatching(/^0x[A-Fa-f0-9]{64}$/)
337
- );
293
+ expect(getSyncHash(currency)).toStrictEqual(expect.stringMatching(/^0x[A-Fa-f0-9]{64}$/));
338
294
  });
339
295
 
340
296
  it("should provide a hash not dependent on reference", () => {
@@ -342,11 +298,9 @@ describe("EVM Family", () => {
342
298
  .spyOn(cryptoAssetsTokens, "listTokensForCryptoCurrency")
343
299
  .mockImplementationOnce((currency): TokenCurrency[] => {
344
300
  const { listTokensForCryptoCurrency } = jest.requireActual(
345
- "@ledgerhq/cryptoassets/tokens"
346
- );
347
- return listTokensForCryptoCurrency(currency).map(
348
- (t: TokenCurrency) => ({ ...t })
301
+ "@ledgerhq/cryptoassets/tokens",
349
302
  );
303
+ return listTokensForCryptoCurrency(currency).map((t: TokenCurrency) => ({ ...t }));
350
304
  });
351
305
  expect(getSyncHash(currency)).toEqual(getSyncHash(currency));
352
306
  });
@@ -354,9 +308,9 @@ describe("EVM Family", () => {
354
308
  it("should provide a new hash if a token is removed", () => {
355
309
  jest
356
310
  .spyOn(cryptoAssetsTokens, "listTokensForCryptoCurrency")
357
- .mockImplementationOnce((currency) => {
311
+ .mockImplementationOnce(currency => {
358
312
  const { listTokensForCryptoCurrency } = jest.requireActual(
359
- "@ledgerhq/cryptoassets/tokens"
313
+ "@ledgerhq/cryptoassets/tokens",
360
314
  );
361
315
  const list: TokenCurrency[] = listTokensForCryptoCurrency(currency);
362
316
  return list.slice(0, list.length - 2);
@@ -367,12 +321,11 @@ describe("EVM Family", () => {
367
321
  it("should provide a new hash if a token is modified", () => {
368
322
  jest
369
323
  .spyOn(cryptoAssetsTokens, "listTokensForCryptoCurrency")
370
- .mockImplementationOnce((currency) => {
324
+ .mockImplementationOnce(currency => {
371
325
  const { listTokensForCryptoCurrency } = jest.requireActual(
372
- "@ledgerhq/cryptoassets/tokens"
326
+ "@ledgerhq/cryptoassets/tokens",
373
327
  );
374
- const [first, ...rest]: TokenCurrency[] =
375
- listTokensForCryptoCurrency(currency);
328
+ const [first, ...rest]: TokenCurrency[] = listTokensForCryptoCurrency(currency);
376
329
  const modifedFirst = { ...first, delisted: !first.delisted };
377
330
  return [modifedFirst, ...rest];
378
331
  });
@@ -383,9 +336,9 @@ describe("EVM Family", () => {
383
336
  it("should provide a new hash if a token is added", () => {
384
337
  jest
385
338
  .spyOn(cryptoAssetsTokens, "listTokensForCryptoCurrency")
386
- .mockImplementationOnce((currency) => {
339
+ .mockImplementationOnce(currency => {
387
340
  const { listTokensForCryptoCurrency } = jest.requireActual(
388
- "@ledgerhq/cryptoassets/tokens"
341
+ "@ledgerhq/cryptoassets/tokens",
389
342
  );
390
343
  return [
391
344
  ...listTokensForCryptoCurrency(currency),
@@ -90,9 +90,7 @@ describe("EVM Family", () => {
90
90
  });
91
91
 
92
92
  it("should return empty [] if dynamic CAL fails and local CAL fails", async () => {
93
- jest
94
- .spyOn(evms, "tokens", "get")
95
- .mockImplementationOnce(() => ({} as any));
93
+ jest.spyOn(evms, "tokens", "get").mockImplementationOnce(() => ({} as any));
96
94
 
97
95
  const tokens = await fetchERC20Tokens(currency1);
98
96
  expect(tokens).toEqual([]);
@@ -101,9 +99,7 @@ describe("EVM Family", () => {
101
99
 
102
100
  describe("preload", () => {
103
101
  it("should register tokens", async () => {
104
- jest
105
- .spyOn(CALTokensAPI, "addTokens")
106
- .mockImplementationOnce(() => null);
102
+ jest.spyOn(CALTokensAPI, "addTokens").mockImplementationOnce(() => null);
107
103
 
108
104
  const tokens = await preload(currency1);
109
105
 
@@ -124,9 +120,7 @@ describe("EVM Family", () => {
124
120
  });
125
121
 
126
122
  it("should register tokens", async () => {
127
- jest
128
- .spyOn(CALTokensAPI, "addTokens")
129
- .mockImplementationOnce(() => null);
123
+ jest.spyOn(CALTokensAPI, "addTokens").mockImplementationOnce(() => null);
130
124
 
131
125
  await hydrate([usdcDefinition]);
132
126