@ledgerhq/coin-framework 0.0.2-next.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (471) hide show
  1. package/lib/account/accountId.d.ts +16 -0
  2. package/lib/account/accountId.d.ts.map +1 -0
  3. package/lib/account/accountId.js +85 -0
  4. package/lib/account/accountId.js.map +1 -0
  5. package/lib/account/accountName.d.ts +14 -0
  6. package/lib/account/accountName.d.ts.map +1 -0
  7. package/lib/account/accountName.js +17 -0
  8. package/lib/account/accountName.js.map +1 -0
  9. package/lib/account/addAccounts.d.ts +35 -0
  10. package/lib/account/addAccounts.d.ts.map +1 -0
  11. package/lib/account/addAccounts.js +209 -0
  12. package/lib/account/addAccounts.js.map +1 -0
  13. package/lib/account/balanceHistoryCache.d.ts +25 -0
  14. package/lib/account/balanceHistoryCache.d.ts.map +1 -0
  15. package/lib/account/balanceHistoryCache.js +115 -0
  16. package/lib/account/balanceHistoryCache.js.map +1 -0
  17. package/lib/account/groupOperations.d.ts +17 -0
  18. package/lib/account/groupOperations.d.ts.map +1 -0
  19. package/lib/account/groupOperations.js +127 -0
  20. package/lib/account/groupOperations.js.map +1 -0
  21. package/lib/account/helpers.d.ts +44 -0
  22. package/lib/account/helpers.d.ts.map +1 -0
  23. package/lib/account/helpers.js +333 -0
  24. package/lib/account/helpers.js.map +1 -0
  25. package/lib/account/helpers.test.d.ts +2 -0
  26. package/lib/account/helpers.test.d.ts.map +1 -0
  27. package/lib/account/helpers.test.js +366 -0
  28. package/lib/account/helpers.test.js.map +1 -0
  29. package/lib/account/index.d.ts +11 -0
  30. package/lib/account/index.d.ts.map +1 -0
  31. package/lib/account/index.js +27 -0
  32. package/lib/account/index.js.map +1 -0
  33. package/lib/account/ordering.d.ts +10 -0
  34. package/lib/account/ordering.d.ts.map +1 -0
  35. package/lib/account/ordering.js +110 -0
  36. package/lib/account/ordering.js.map +1 -0
  37. package/lib/account/pending.d.ts +33 -0
  38. package/lib/account/pending.d.ts.map +1 -0
  39. package/lib/account/pending.js +64 -0
  40. package/lib/account/pending.js.map +1 -0
  41. package/lib/account/serialization.d.ts +6 -0
  42. package/lib/account/serialization.d.ts.map +1 -0
  43. package/lib/account/serialization.js +118 -0
  44. package/lib/account/serialization.js.map +1 -0
  45. package/lib/account/support.d.ts +9 -0
  46. package/lib/account/support.d.ts.map +1 -0
  47. package/lib/account/support.js +72 -0
  48. package/lib/account/support.js.map +1 -0
  49. package/lib/account.test.d.ts +2 -0
  50. package/lib/account.test.d.ts.map +1 -0
  51. package/lib/account.test.js +257 -0
  52. package/lib/account.test.js.map +1 -0
  53. package/lib/bot/bot-test-context.d.ts +3 -0
  54. package/lib/bot/bot-test-context.d.ts.map +1 -0
  55. package/lib/bot/bot-test-context.js +26 -0
  56. package/lib/bot/bot-test-context.js.map +1 -0
  57. package/lib/bot/bot-test-context.test.d.ts +2 -0
  58. package/lib/bot/bot-test-context.test.d.ts.map +1 -0
  59. package/lib/bot/bot-test-context.test.js +41 -0
  60. package/lib/bot/bot-test-context.test.js.map +1 -0
  61. package/lib/bot/formatters.d.ts +2 -0
  62. package/lib/bot/formatters.d.ts.map +1 -0
  63. package/lib/bot/formatters.js +31 -0
  64. package/lib/bot/formatters.js.map +1 -0
  65. package/lib/bot/specs.d.ts +50 -0
  66. package/lib/bot/specs.d.ts.map +1 -0
  67. package/lib/bot/specs.js +204 -0
  68. package/lib/bot/specs.js.map +1 -0
  69. package/lib/bot/types.d.ts +178 -0
  70. package/lib/bot/types.d.ts.map +1 -0
  71. package/lib/bot/types.js +3 -0
  72. package/lib/bot/types.js.map +1 -0
  73. package/lib/bridge/getAddressWrapper.d.ts +6 -0
  74. package/lib/bridge/getAddressWrapper.d.ts.map +1 -0
  75. package/lib/bridge/getAddressWrapper.js +27 -0
  76. package/lib/bridge/getAddressWrapper.js.map +1 -0
  77. package/lib/bridge/jsHelpers.d.ts +63 -0
  78. package/lib/bridge/jsHelpers.d.ts.map +1 -0
  79. package/lib/bridge/jsHelpers.js +574 -0
  80. package/lib/bridge/jsHelpers.js.map +1 -0
  81. package/lib/cache.d.ts +10 -0
  82. package/lib/cache.d.ts.map +1 -0
  83. package/lib/cache.js +100 -0
  84. package/lib/cache.js.map +1 -0
  85. package/lib/cross.d.ts +42 -0
  86. package/lib/cross.d.ts.map +1 -0
  87. package/lib/cross.js +254 -0
  88. package/lib/cross.js.map +1 -0
  89. package/lib/cross.test.d.ts +2 -0
  90. package/lib/cross.test.d.ts.map +1 -0
  91. package/lib/cross.test.js +99 -0
  92. package/lib/cross.test.js.map +1 -0
  93. package/lib/currencies/BigNumberToLocaleString.d.ts +8 -0
  94. package/lib/currencies/BigNumberToLocaleString.d.ts.map +1 -0
  95. package/lib/currencies/BigNumberToLocaleString.js +65 -0
  96. package/lib/currencies/BigNumberToLocaleString.js.map +1 -0
  97. package/lib/currencies/BigNumberToLocaleString.test.d.ts +2 -0
  98. package/lib/currencies/BigNumberToLocaleString.test.d.ts.map +1 -0
  99. package/lib/currencies/BigNumberToLocaleString.test.js +108 -0
  100. package/lib/currencies/BigNumberToLocaleString.test.js.map +1 -0
  101. package/lib/currencies/CurrencyURIScheme.d.ts +13 -0
  102. package/lib/currencies/CurrencyURIScheme.d.ts.map +1 -0
  103. package/lib/currencies/CurrencyURIScheme.js +124 -0
  104. package/lib/currencies/CurrencyURIScheme.js.map +1 -0
  105. package/lib/currencies/chopCurrencyUnitDecimals.d.ts +3 -0
  106. package/lib/currencies/chopCurrencyUnitDecimals.d.ts.map +1 -0
  107. package/lib/currencies/chopCurrencyUnitDecimals.js +29 -0
  108. package/lib/currencies/chopCurrencyUnitDecimals.js.map +1 -0
  109. package/lib/currencies/formatCurrencyUnit.d.ts +33 -0
  110. package/lib/currencies/formatCurrencyUnit.d.ts.map +1 -0
  111. package/lib/currencies/formatCurrencyUnit.js +126 -0
  112. package/lib/currencies/formatCurrencyUnit.js.map +1 -0
  113. package/lib/currencies/formatShort.d.ts +8 -0
  114. package/lib/currencies/formatShort.d.ts.map +1 -0
  115. package/lib/currencies/formatShort.js +27 -0
  116. package/lib/currencies/formatShort.js.map +1 -0
  117. package/lib/currencies/index.d.ts +13 -0
  118. package/lib/currencies/index.d.ts.map +1 -0
  119. package/lib/currencies/index.js +65 -0
  120. package/lib/currencies/index.js.map +1 -0
  121. package/lib/currencies/localeUtility.d.ts +8 -0
  122. package/lib/currencies/localeUtility.d.ts.map +1 -0
  123. package/lib/currencies/localeUtility.js +49 -0
  124. package/lib/currencies/localeUtility.js.map +1 -0
  125. package/lib/currencies/parseCurrencyUnit.d.ts +4 -0
  126. package/lib/currencies/parseCurrencyUnit.d.ts.map +1 -0
  127. package/lib/currencies/parseCurrencyUnit.js +18 -0
  128. package/lib/currencies/parseCurrencyUnit.js.map +1 -0
  129. package/lib/currencies/sanitizeValueString.d.ts +6 -0
  130. package/lib/currencies/sanitizeValueString.d.ts.map +1 -0
  131. package/lib/currencies/sanitizeValueString.js +56 -0
  132. package/lib/currencies/sanitizeValueString.js.map +1 -0
  133. package/lib/currencies/support.d.ts +8 -0
  134. package/lib/currencies/support.d.ts.map +1 -0
  135. package/lib/currencies/support.js +101 -0
  136. package/lib/currencies/support.js.map +1 -0
  137. package/lib/currencies/valueFromUnit.d.ts +9 -0
  138. package/lib/currencies/valueFromUnit.d.ts.map +1 -0
  139. package/lib/currencies/valueFromUnit.js +14 -0
  140. package/lib/currencies/valueFromUnit.js.map +1 -0
  141. package/lib/derivation.d.ts +232 -0
  142. package/lib/derivation.d.ts.map +1 -0
  143. package/lib/derivation.js +501 -0
  144. package/lib/derivation.js.map +1 -0
  145. package/lib/env.d.ts +30 -0
  146. package/lib/env.d.ts.map +1 -0
  147. package/lib/env.js +783 -0
  148. package/lib/env.js.map +1 -0
  149. package/lib/errors.d.ts +7 -0
  150. package/lib/errors.d.ts.map +1 -0
  151. package/lib/errors.js +7 -0
  152. package/lib/errors.js.map +1 -0
  153. package/lib/errors.test.d.ts +2 -0
  154. package/lib/errors.test.d.ts.map +1 -0
  155. package/lib/errors.test.js +20 -0
  156. package/lib/errors.test.js.map +1 -0
  157. package/lib/mocks/account.d.ts +25 -0
  158. package/lib/mocks/account.d.ts.map +1 -0
  159. package/lib/mocks/account.js +368 -0
  160. package/lib/mocks/account.js.map +1 -0
  161. package/lib/mocks/fixtures/nfts.d.ts +27 -0
  162. package/lib/mocks/fixtures/nfts.d.ts.map +1 -0
  163. package/lib/mocks/fixtures/nfts.js +398 -0
  164. package/lib/mocks/fixtures/nfts.js.map +1 -0
  165. package/lib/mocks/fixtures/nfts.test.d.ts +2 -0
  166. package/lib/mocks/fixtures/nfts.test.d.ts.map +1 -0
  167. package/lib/mocks/fixtures/nfts.test.js +20 -0
  168. package/lib/mocks/fixtures/nfts.test.js.map +1 -0
  169. package/lib/mocks/helpers.d.ts +15 -0
  170. package/lib/mocks/helpers.d.ts.map +1 -0
  171. package/lib/mocks/helpers.js +32 -0
  172. package/lib/mocks/helpers.js.map +1 -0
  173. package/lib/network.d.ts +5 -0
  174. package/lib/network.d.ts.map +1 -0
  175. package/lib/network.js +125 -0
  176. package/lib/network.js.map +1 -0
  177. package/lib/nft/nftId.d.ts +8 -0
  178. package/lib/nft/nftId.d.ts.map +1 -0
  179. package/lib/nft/nftId.js +34 -0
  180. package/lib/nft/nftId.js.map +1 -0
  181. package/lib/operation.d.ts +24 -0
  182. package/lib/operation.d.ts.map +1 -0
  183. package/lib/operation.js +183 -0
  184. package/lib/operation.js.map +1 -0
  185. package/lib/promise.d.ts +21 -0
  186. package/lib/promise.d.ts.map +1 -0
  187. package/lib/promise.js +187 -0
  188. package/lib/promise.js.map +1 -0
  189. package/lib/promise.test.d.ts +2 -0
  190. package/lib/promise.test.d.ts.map +1 -0
  191. package/lib/promise.test.js +72 -0
  192. package/lib/promise.test.js.map +1 -0
  193. package/lib/rangeDates.d.ts +29 -0
  194. package/lib/rangeDates.d.ts.map +1 -0
  195. package/lib/rangeDates.js +94 -0
  196. package/lib/rangeDates.js.map +1 -0
  197. package/lib/rangeDates.test.d.ts +2 -0
  198. package/lib/rangeDates.test.d.ts.map +1 -0
  199. package/lib/rangeDates.test.js +51 -0
  200. package/lib/rangeDates.test.js.map +1 -0
  201. package/lib/test-helpers/staticTime.d.ts +2 -0
  202. package/lib/test-helpers/staticTime.d.ts.map +1 -0
  203. package/lib/test-helpers/staticTime.js +10 -0
  204. package/lib/test-helpers/staticTime.js.map +1 -0
  205. package/lib/transaction/common.d.ts +26 -0
  206. package/lib/transaction/common.d.ts.map +1 -0
  207. package/lib/transaction/common.js +123 -0
  208. package/lib/transaction/common.js.map +1 -0
  209. package/lib-es/account/accountId.d.ts +16 -0
  210. package/lib-es/account/accountId.d.ts.map +1 -0
  211. package/lib-es/account/accountId.js +74 -0
  212. package/lib-es/account/accountId.js.map +1 -0
  213. package/lib-es/account/accountName.d.ts +14 -0
  214. package/lib-es/account/accountName.d.ts.map +1 -0
  215. package/lib-es/account/accountName.js +12 -0
  216. package/lib-es/account/accountName.js.map +1 -0
  217. package/lib-es/account/addAccounts.d.ts +35 -0
  218. package/lib-es/account/addAccounts.d.ts.map +1 -0
  219. package/lib-es/account/addAccounts.js +200 -0
  220. package/lib-es/account/addAccounts.js.map +1 -0
  221. package/lib-es/account/balanceHistoryCache.d.ts +25 -0
  222. package/lib-es/account/balanceHistoryCache.d.ts.map +1 -0
  223. package/lib-es/account/balanceHistoryCache.js +109 -0
  224. package/lib-es/account/balanceHistoryCache.js.map +1 -0
  225. package/lib-es/account/groupOperations.d.ts +17 -0
  226. package/lib-es/account/groupOperations.d.ts.map +1 -0
  227. package/lib-es/account/groupOperations.js +122 -0
  228. package/lib-es/account/groupOperations.js.map +1 -0
  229. package/lib-es/account/helpers.d.ts +44 -0
  230. package/lib-es/account/helpers.d.ts.map +1 -0
  231. package/lib-es/account/helpers.js +303 -0
  232. package/lib-es/account/helpers.js.map +1 -0
  233. package/lib-es/account/helpers.test.d.ts +2 -0
  234. package/lib-es/account/helpers.test.d.ts.map +1 -0
  235. package/lib-es/account/helpers.test.js +361 -0
  236. package/lib-es/account/helpers.test.js.map +1 -0
  237. package/lib-es/account/index.d.ts +11 -0
  238. package/lib-es/account/index.d.ts.map +1 -0
  239. package/lib-es/account/index.js +11 -0
  240. package/lib-es/account/index.js.map +1 -0
  241. package/lib-es/account/ordering.d.ts +10 -0
  242. package/lib-es/account/ordering.d.ts.map +1 -0
  243. package/lib-es/account/ordering.js +103 -0
  244. package/lib-es/account/ordering.js.map +1 -0
  245. package/lib-es/account/pending.d.ts +33 -0
  246. package/lib-es/account/pending.d.ts.map +1 -0
  247. package/lib-es/account/pending.js +59 -0
  248. package/lib-es/account/pending.js.map +1 -0
  249. package/lib-es/account/serialization.d.ts +6 -0
  250. package/lib-es/account/serialization.d.ts.map +1 -0
  251. package/lib-es/account/serialization.js +112 -0
  252. package/lib-es/account/serialization.js.map +1 -0
  253. package/lib-es/account/support.d.ts +9 -0
  254. package/lib-es/account/support.d.ts.map +1 -0
  255. package/lib-es/account/support.js +64 -0
  256. package/lib-es/account/support.js.map +1 -0
  257. package/lib-es/account.test.d.ts +2 -0
  258. package/lib-es/account.test.d.ts.map +1 -0
  259. package/lib-es/account.test.js +252 -0
  260. package/lib-es/account.test.js.map +1 -0
  261. package/lib-es/bot/bot-test-context.d.ts +3 -0
  262. package/lib-es/bot/bot-test-context.d.ts.map +1 -0
  263. package/lib-es/bot/bot-test-context.js +21 -0
  264. package/lib-es/bot/bot-test-context.js.map +1 -0
  265. package/lib-es/bot/bot-test-context.test.d.ts +2 -0
  266. package/lib-es/bot/bot-test-context.test.d.ts.map +1 -0
  267. package/lib-es/bot/bot-test-context.test.js +39 -0
  268. package/lib-es/bot/bot-test-context.test.js.map +1 -0
  269. package/lib-es/bot/formatters.d.ts +2 -0
  270. package/lib-es/bot/formatters.d.ts.map +1 -0
  271. package/lib-es/bot/formatters.js +27 -0
  272. package/lib-es/bot/formatters.js.map +1 -0
  273. package/lib-es/bot/specs.d.ts +50 -0
  274. package/lib-es/bot/specs.d.ts.map +1 -0
  275. package/lib-es/bot/specs.js +193 -0
  276. package/lib-es/bot/specs.js.map +1 -0
  277. package/lib-es/bot/types.d.ts +178 -0
  278. package/lib-es/bot/types.d.ts.map +1 -0
  279. package/lib-es/bot/types.js +2 -0
  280. package/lib-es/bot/types.js.map +1 -0
  281. package/lib-es/bridge/getAddressWrapper.d.ts +6 -0
  282. package/lib-es/bridge/getAddressWrapper.d.ts.map +1 -0
  283. package/lib-es/bridge/getAddressWrapper.js +25 -0
  284. package/lib-es/bridge/getAddressWrapper.js.map +1 -0
  285. package/lib-es/bridge/jsHelpers.d.ts +63 -0
  286. package/lib-es/bridge/jsHelpers.d.ts.map +1 -0
  287. package/lib-es/bridge/jsHelpers.js +562 -0
  288. package/lib-es/bridge/jsHelpers.js.map +1 -0
  289. package/lib-es/cache.d.ts +10 -0
  290. package/lib-es/cache.d.ts.map +1 -0
  291. package/lib-es/cache.js +93 -0
  292. package/lib-es/cache.js.map +1 -0
  293. package/lib-es/cross.d.ts +42 -0
  294. package/lib-es/cross.d.ts.map +1 -0
  295. package/lib-es/cross.js +244 -0
  296. package/lib-es/cross.js.map +1 -0
  297. package/lib-es/cross.test.d.ts +2 -0
  298. package/lib-es/cross.test.d.ts.map +1 -0
  299. package/lib-es/cross.test.js +97 -0
  300. package/lib-es/cross.test.js.map +1 -0
  301. package/lib-es/currencies/BigNumberToLocaleString.d.ts +8 -0
  302. package/lib-es/currencies/BigNumberToLocaleString.d.ts.map +1 -0
  303. package/lib-es/currencies/BigNumberToLocaleString.js +61 -0
  304. package/lib-es/currencies/BigNumberToLocaleString.js.map +1 -0
  305. package/lib-es/currencies/BigNumberToLocaleString.test.d.ts +2 -0
  306. package/lib-es/currencies/BigNumberToLocaleString.test.d.ts.map +1 -0
  307. package/lib-es/currencies/BigNumberToLocaleString.test.js +106 -0
  308. package/lib-es/currencies/BigNumberToLocaleString.test.js.map +1 -0
  309. package/lib-es/currencies/CurrencyURIScheme.d.ts +13 -0
  310. package/lib-es/currencies/CurrencyURIScheme.d.ts.map +1 -0
  311. package/lib-es/currencies/CurrencyURIScheme.js +116 -0
  312. package/lib-es/currencies/CurrencyURIScheme.js.map +1 -0
  313. package/lib-es/currencies/chopCurrencyUnitDecimals.d.ts +3 -0
  314. package/lib-es/currencies/chopCurrencyUnitDecimals.d.ts.map +1 -0
  315. package/lib-es/currencies/chopCurrencyUnitDecimals.js +25 -0
  316. package/lib-es/currencies/chopCurrencyUnitDecimals.js.map +1 -0
  317. package/lib-es/currencies/formatCurrencyUnit.d.ts +33 -0
  318. package/lib-es/currencies/formatCurrencyUnit.d.ts.map +1 -0
  319. package/lib-es/currencies/formatCurrencyUnit.js +121 -0
  320. package/lib-es/currencies/formatCurrencyUnit.js.map +1 -0
  321. package/lib-es/currencies/formatShort.d.ts +8 -0
  322. package/lib-es/currencies/formatShort.d.ts.map +1 -0
  323. package/lib-es/currencies/formatShort.js +20 -0
  324. package/lib-es/currencies/formatShort.js.map +1 -0
  325. package/lib-es/currencies/index.d.ts +13 -0
  326. package/lib-es/currencies/index.d.ts.map +1 -0
  327. package/lib-es/currencies/index.js +16 -0
  328. package/lib-es/currencies/index.js.map +1 -0
  329. package/lib-es/currencies/localeUtility.d.ts +8 -0
  330. package/lib-es/currencies/localeUtility.d.ts.map +1 -0
  331. package/lib-es/currencies/localeUtility.js +43 -0
  332. package/lib-es/currencies/localeUtility.js.map +1 -0
  333. package/lib-es/currencies/parseCurrencyUnit.d.ts +4 -0
  334. package/lib-es/currencies/parseCurrencyUnit.d.ts.map +1 -0
  335. package/lib-es/currencies/parseCurrencyUnit.js +14 -0
  336. package/lib-es/currencies/parseCurrencyUnit.js.map +1 -0
  337. package/lib-es/currencies/sanitizeValueString.d.ts +6 -0
  338. package/lib-es/currencies/sanitizeValueString.d.ts.map +1 -0
  339. package/lib-es/currencies/sanitizeValueString.js +52 -0
  340. package/lib-es/currencies/sanitizeValueString.js.map +1 -0
  341. package/lib-es/currencies/support.d.ts +8 -0
  342. package/lib-es/currencies/support.d.ts.map +1 -0
  343. package/lib-es/currencies/support.js +92 -0
  344. package/lib-es/currencies/support.js.map +1 -0
  345. package/lib-es/currencies/valueFromUnit.d.ts +9 -0
  346. package/lib-es/currencies/valueFromUnit.d.ts.map +1 -0
  347. package/lib-es/currencies/valueFromUnit.js +10 -0
  348. package/lib-es/currencies/valueFromUnit.js.map +1 -0
  349. package/lib-es/derivation.d.ts +232 -0
  350. package/lib-es/derivation.d.ts.map +1 -0
  351. package/lib-es/derivation.js +473 -0
  352. package/lib-es/derivation.js.map +1 -0
  353. package/lib-es/env.d.ts +30 -0
  354. package/lib-es/env.d.ts.map +1 -0
  355. package/lib-es/env.js +768 -0
  356. package/lib-es/env.js.map +1 -0
  357. package/lib-es/errors.d.ts +7 -0
  358. package/lib-es/errors.d.ts.map +1 -0
  359. package/lib-es/errors.js +4 -0
  360. package/lib-es/errors.js.map +1 -0
  361. package/lib-es/errors.test.d.ts +2 -0
  362. package/lib-es/errors.test.d.ts.map +1 -0
  363. package/lib-es/errors.test.js +18 -0
  364. package/lib-es/errors.test.js.map +1 -0
  365. package/lib-es/mocks/account.d.ts +25 -0
  366. package/lib-es/mocks/account.d.ts.map +1 -0
  367. package/lib-es/mocks/account.js +358 -0
  368. package/lib-es/mocks/account.js.map +1 -0
  369. package/lib-es/mocks/fixtures/nfts.d.ts +27 -0
  370. package/lib-es/mocks/fixtures/nfts.d.ts.map +1 -0
  371. package/lib-es/mocks/fixtures/nfts.js +390 -0
  372. package/lib-es/mocks/fixtures/nfts.js.map +1 -0
  373. package/lib-es/mocks/fixtures/nfts.test.d.ts +2 -0
  374. package/lib-es/mocks/fixtures/nfts.test.d.ts.map +1 -0
  375. package/lib-es/mocks/fixtures/nfts.test.js +18 -0
  376. package/lib-es/mocks/fixtures/nfts.test.js.map +1 -0
  377. package/lib-es/mocks/helpers.d.ts +15 -0
  378. package/lib-es/mocks/helpers.d.ts.map +1 -0
  379. package/lib-es/mocks/helpers.js +26 -0
  380. package/lib-es/mocks/helpers.js.map +1 -0
  381. package/lib-es/network.d.ts +5 -0
  382. package/lib-es/network.d.ts.map +1 -0
  383. package/lib-es/network.js +118 -0
  384. package/lib-es/network.js.map +1 -0
  385. package/lib-es/nft/nftId.d.ts +8 -0
  386. package/lib-es/nft/nftId.d.ts.map +1 -0
  387. package/lib-es/nft/nftId.js +29 -0
  388. package/lib-es/nft/nftId.js.map +1 -0
  389. package/lib-es/operation.d.ts +24 -0
  390. package/lib-es/operation.d.ts.map +1 -0
  391. package/lib-es/operation.js +168 -0
  392. package/lib-es/operation.js.map +1 -0
  393. package/lib-es/promise.d.ts +21 -0
  394. package/lib-es/promise.d.ts.map +1 -0
  395. package/lib-es/promise.js +179 -0
  396. package/lib-es/promise.js.map +1 -0
  397. package/lib-es/promise.test.d.ts +2 -0
  398. package/lib-es/promise.test.d.ts.map +1 -0
  399. package/lib-es/promise.test.js +70 -0
  400. package/lib-es/promise.test.js.map +1 -0
  401. package/lib-es/rangeDates.d.ts +29 -0
  402. package/lib-es/rangeDates.d.ts.map +1 -0
  403. package/lib-es/rangeDates.js +84 -0
  404. package/lib-es/rangeDates.js.map +1 -0
  405. package/lib-es/rangeDates.test.d.ts +2 -0
  406. package/lib-es/rangeDates.test.d.ts.map +1 -0
  407. package/lib-es/rangeDates.test.js +49 -0
  408. package/lib-es/rangeDates.test.js.map +1 -0
  409. package/lib-es/test-helpers/staticTime.d.ts +2 -0
  410. package/lib-es/test-helpers/staticTime.d.ts.map +1 -0
  411. package/lib-es/test-helpers/staticTime.js +5 -0
  412. package/lib-es/test-helpers/staticTime.js.map +1 -0
  413. package/lib-es/transaction/common.d.ts +26 -0
  414. package/lib-es/transaction/common.d.ts.map +1 -0
  415. package/lib-es/transaction/common.js +115 -0
  416. package/lib-es/transaction/common.js.map +1 -0
  417. package/package.json +113 -0
  418. package/src/__snapshots__/account.test.ts.snap +2065 -0
  419. package/src/__snapshots__/cross.test.ts.snap +57 -0
  420. package/src/account/accountId.ts +93 -0
  421. package/src/account/accountName.ts +25 -0
  422. package/src/account/addAccounts.ts +236 -0
  423. package/src/account/balanceHistoryCache.ts +146 -0
  424. package/src/account/groupOperations.ts +164 -0
  425. package/src/account/helpers.test.ts +441 -0
  426. package/src/account/helpers.ts +380 -0
  427. package/src/account/index.ts +10 -0
  428. package/src/account/ordering.ts +109 -0
  429. package/src/account/pending.ts +66 -0
  430. package/src/account/serialization.ts +189 -0
  431. package/src/account/support.ts +96 -0
  432. package/src/account.test.ts +237 -0
  433. package/src/bot/bot-test-context.test.ts +37 -0
  434. package/src/bot/bot-test-context.ts +24 -0
  435. package/src/bot/formatters.ts +22 -0
  436. package/src/bot/specs.ts +275 -0
  437. package/src/bot/types.ts +224 -0
  438. package/src/bridge/getAddressWrapper.ts +40 -0
  439. package/src/bridge/jsHelpers.ts +645 -0
  440. package/src/cache.ts +65 -0
  441. package/src/cross.test.ts +112 -0
  442. package/src/cross.ts +366 -0
  443. package/src/currencies/BigNumberToLocaleString.test.ts +155 -0
  444. package/src/currencies/BigNumberToLocaleString.ts +80 -0
  445. package/src/currencies/CurrencyURIScheme.ts +114 -0
  446. package/src/currencies/chopCurrencyUnitDecimals.ts +34 -0
  447. package/src/currencies/formatCurrencyUnit.ts +167 -0
  448. package/src/currencies/formatShort.ts +24 -0
  449. package/src/currencies/index.ts +78 -0
  450. package/src/currencies/localeUtility.ts +50 -0
  451. package/src/currencies/parseCurrencyUnit.ts +16 -0
  452. package/src/currencies/sanitizeValueString.ts +58 -0
  453. package/src/currencies/support.ts +107 -0
  454. package/src/currencies/valueFromUnit.ts +10 -0
  455. package/src/derivation.ts +595 -0
  456. package/src/env.ts +790 -0
  457. package/src/errors.test.ts +21 -0
  458. package/src/errors.ts +9 -0
  459. package/src/mocks/account.ts +476 -0
  460. package/src/mocks/fixtures/nfts.test.ts +25 -0
  461. package/src/mocks/fixtures/nfts.ts +432 -0
  462. package/src/mocks/helpers.ts +38 -0
  463. package/src/network.ts +135 -0
  464. package/src/nft/nftId.ts +26 -0
  465. package/src/operation.ts +212 -0
  466. package/src/promise.test.ts +20 -0
  467. package/src/promise.ts +101 -0
  468. package/src/rangeDates.test.ts +66 -0
  469. package/src/rangeDates.ts +96 -0
  470. package/src/test-helpers/staticTime.ts +4 -0
  471. package/src/transaction/common.ts +157 -0
@@ -0,0 +1,21 @@
1
+ import { UnsupportedDerivation } from "./errors";
2
+
3
+ function functionA() {
4
+ throw new UnsupportedDerivation();
5
+ }
6
+
7
+ describe("custom errors", () => {
8
+ test("error instanceof", () => {
9
+ try {
10
+ functionA();
11
+ } catch (e: any) {
12
+ expect(e).toBeInstanceOf(UnsupportedDerivation);
13
+ }
14
+ });
15
+
16
+ test("promise error instanceof", () => {
17
+ expect(Promise.reject(new UnsupportedDerivation())).rejects.toBeInstanceOf(
18
+ UnsupportedDerivation
19
+ );
20
+ });
21
+ });
package/src/errors.ts ADDED
@@ -0,0 +1,9 @@
1
+ import { createCustomErrorClass } from "@ledgerhq/errors";
2
+
3
+ export const FreshAddressIndexInvalid = createCustomErrorClass(
4
+ "FreshAddressIndexInvalid"
5
+ );
6
+
7
+ export const UnsupportedDerivation = createCustomErrorClass(
8
+ "UnsupportedDerivation"
9
+ );
@@ -0,0 +1,476 @@
1
+ import Prando from "prando";
2
+ import { BigNumber } from "bignumber.js";
3
+ import {
4
+ listCryptoCurrencies,
5
+ listTokensForCryptoCurrency,
6
+ findCompoundToken,
7
+ } from "../currencies";
8
+ import { getOperationAmountNumber } from "../operation";
9
+ import {
10
+ inferSubOperations,
11
+ isAccountEmpty,
12
+ emptyHistoryCache,
13
+ generateHistoryFromOperations,
14
+ } from "../account";
15
+ import { getDerivationScheme, runDerivationScheme } from "../derivation";
16
+ import { genHex, genAddress } from "./helpers";
17
+ import type {
18
+ Account,
19
+ AccountLike,
20
+ Operation,
21
+ TokenAccount,
22
+ } from "@ledgerhq/types-live";
23
+ import type {
24
+ CryptoCurrency,
25
+ TokenCurrency,
26
+ } from "@ledgerhq/types-cryptoassets";
27
+ import { createFixtureNFT, genNFTOperation } from "./fixtures/nfts";
28
+
29
+ export function ensureNoNegative(operations: Operation[]) {
30
+ let total = new BigNumber(0);
31
+
32
+ for (let i = operations.length - 1; i >= 0; i--) {
33
+ const op = operations[i];
34
+ const amount = getOperationAmountNumber(op);
35
+
36
+ if (total.plus(amount).isNegative()) {
37
+ if (op.type === "IN") {
38
+ op.type = "OUT";
39
+ } else if (op.type === "OUT") {
40
+ op.type = "IN";
41
+ }
42
+ }
43
+
44
+ total = total.plus(getOperationAmountNumber(op));
45
+ }
46
+
47
+ return total;
48
+ }
49
+
50
+ const hardcodedMarketcap = [
51
+ "bitcoin",
52
+ "ethereum",
53
+ "ripple",
54
+ "bitcoin_cash",
55
+ "litecoin",
56
+ "ethereum/erc20/usd_tether__erc20_",
57
+ "bsc",
58
+ "eos",
59
+ "stellar",
60
+ "monero",
61
+ "cardano",
62
+ "ethereum/erc20/leo_token",
63
+ "tron",
64
+ "dash",
65
+ "ethereum_classic",
66
+ "tezos",
67
+ "iota",
68
+ "ethereum/erc20/link_chainlink",
69
+ "neo",
70
+ "ethereum/erc20/makerdao",
71
+ "ethereum/erc20/usd__coin",
72
+ "ontology",
73
+ "ethereum/erc20/cro",
74
+ "zcash",
75
+ "dogecoin",
76
+ "decred",
77
+ "vechain",
78
+ "ethereum/erc20/bat",
79
+ "qtum",
80
+ "ethereum/erc20/huobitoken",
81
+ "bitcoin_gold",
82
+ "ethereum/erc20/paxos_standard__pax_",
83
+ "ethereum/erc20/trueusd",
84
+ "ethereum/erc20/omg",
85
+ "lisk",
86
+ "nano",
87
+ "waves",
88
+ "ethereum/erc20/holotoken",
89
+ "ethereum/erc20/icon",
90
+ "digibyte",
91
+ "ethereum/erc20/0x_project",
92
+ "ethereum/erc20/iostoken",
93
+ "ethereum/erc20/pundi_x_token",
94
+ "ethereum/erc20/augur",
95
+ "ethereum/erc20/aurora",
96
+ "komodo",
97
+ "ethereum/erc20/quant",
98
+ "ethereum/erc20/bytom",
99
+ "ethereum/erc20/dai_stablecoin_v1_0",
100
+ "ethereum/erc20/dai_stablecoin_v2_0",
101
+ "ethereum/erc20/egretia_token",
102
+ "aeternity",
103
+ "ethereum/erc20/golem",
104
+ "ethereum/erc20/republic_protocol",
105
+ "ethereum/erc20/status_network_token",
106
+ "ethereum/erc20/crypto_com",
107
+ "ethereum/erc20/enjin",
108
+ "ethereum/erc20/walton",
109
+ "ethereum/erc20/gxc",
110
+ "zcoin",
111
+ "ethereum/erc20/synthetix_network_token",
112
+ "stratis",
113
+ "ethereum/erc20/wax",
114
+ "ethereum/erc20/nexo",
115
+ "ethereum/erc20/elf_token",
116
+ "factom",
117
+ "wanchain",
118
+ "ethereum/erc20/pchain",
119
+ "zencash",
120
+ "ethereum/erc20/stasis_eurs_token",
121
+ "ethereum/erc20/revian",
122
+ "ethereum/erc20/odem_token",
123
+ "ethereum/erc20/nuls",
124
+ "ethereum/erc20/decentraland_mana",
125
+ "ethereum/erc20/nebula",
126
+ "ethereum/erc20/qash",
127
+ "ethereum/erc20/dent",
128
+ "ethereum/erc20/digix_dao",
129
+ "tomo",
130
+ "ethereum/erc20/lrc",
131
+ "ethereum/erc20/crypteriumtoken",
132
+ "ethereum/erc20/santiment",
133
+ "ethereum/erc20/matic",
134
+ "ethereum/erc20/kyber_network",
135
+ "ethereum/erc20/loom",
136
+ "ethereum/erc20/digitexfutures",
137
+ "ethereum/erc20/populous",
138
+ "ethereum/erc20/fusion",
139
+ "ethereum/erc20/enigma",
140
+ "ethereum/erc20/orbs",
141
+ "ethereum/erc20/quarkchain_token",
142
+ "ethereum/erc20/fetch",
143
+ "aion",
144
+ "ethereum/erc20/bix_token",
145
+ "ark",
146
+ "ethereum/erc20/menlo_one",
147
+ "ethereum/erc20/xmax",
148
+ "ethereum/erc20/bancor",
149
+ "ethereum/erc20/bread",
150
+ "ethereum/erc20/powerledger",
151
+ "ethereum/erc20/telcoin",
152
+ "tron/trc10/1002000",
153
+ "tron/trc10/1002398",
154
+ "tron/trc10/1000226",
155
+ "tron/trc10/1002517",
156
+ "tron/trc10/1002544",
157
+ "tron/trc10/1002573",
158
+ "tron/trc10/1002597",
159
+ "tron/trc10/1002672",
160
+ "tron/trc10/1002736",
161
+ "tron/trc10/1002798",
162
+ "tron/trc10/1002578",
163
+ "tron/trc10/1002845",
164
+ "tron/trc10/1002775",
165
+ "tron/trc10/1002858",
166
+ "tron/trc10/1002876",
167
+ "tron/trc20/TLa2f6VPqDgRE67v1736s7bJ8Ray5wYjU7",
168
+ "algorand/asa/438840",
169
+ "algorand/asa/438839",
170
+ "algorand/asa/438838",
171
+ "algorand/asa/438837",
172
+ "algorand/asa/438836",
173
+ "algorand/asa/438833",
174
+ "algorand/asa/438832",
175
+ "algorand/asa/438831",
176
+ "algorand/asa/438828",
177
+ "algorand/asa/312769",
178
+ "algorand/asa/163650",
179
+ ];
180
+ // for the mock generation we need to adjust to the actual market price of things, we want to avoid having things < 0.01 EUR
181
+ const currencyIdApproxMarketPrice: Record<string, number> = {
182
+ bitcoin: 0.0073059,
183
+ ethereum: 5.7033e-14,
184
+ ethereum_classic: 1.4857e-15,
185
+ bitcoin_cash: 0.0011739,
186
+ bitcoin_gold: 0.00005004,
187
+ litecoin: 0.00011728,
188
+ ripple: 0.000057633,
189
+ dogecoin: 4.9e-9,
190
+ dash: 0.0003367,
191
+ peercoin: 0.000226,
192
+ zcash: 0.000205798,
193
+ };
194
+ // mock only use subset of cryptocurrencies to not affect tests when adding coins
195
+ const currencies = listCryptoCurrencies().filter(
196
+ (c) => currencyIdApproxMarketPrice[c.id]
197
+ );
198
+ // TODO fix the mock to never generate negative balance...
199
+
200
+ /**
201
+ * @memberof mock/account
202
+ */
203
+ export function genOperation(
204
+ superAccount: Account,
205
+ account: AccountLike,
206
+ ops: any,
207
+ rng: Prando
208
+ ): Operation {
209
+ const ticker =
210
+ account.type === "TokenAccount"
211
+ ? account.token.ticker
212
+ : account.currency.ticker;
213
+ const lastOp = ops[ops.length - 1];
214
+ const date = new Date(
215
+ (lastOp ? lastOp.date : Date.now()) -
216
+ rng.nextInt(0, 100000000 * rng.next() * rng.next())
217
+ );
218
+ const address = genAddress(superAccount.currency, rng);
219
+ const type = rng.next() < 0.3 ? "OUT" : "IN";
220
+ const divider =
221
+ (account.type === "Account" &&
222
+ currencyIdApproxMarketPrice[account.currency.id]) ||
223
+ currencyIdApproxMarketPrice.bitcoin;
224
+ const value = new BigNumber(
225
+ Math.floor(rng.nextInt(0, 100000 * rng.next() * rng.next()) / divider)
226
+ );
227
+
228
+ if (Number.isNaN(value)) {
229
+ throw new Error("invalid amount generated for " + ticker);
230
+ }
231
+
232
+ const hash = genHex(64, rng);
233
+ const op: Operation = {
234
+ id: String(`mock_op_${ops.length}_${account.id}`),
235
+ hash,
236
+ type,
237
+ value,
238
+ fee: new BigNumber(Math.round(value.toNumber() * 0.01)),
239
+ senders: [type !== "IN" ? genAddress(superAccount.currency, rng) : address],
240
+ recipients: [
241
+ type === "IN" ? genAddress(superAccount.currency, rng) : address,
242
+ ],
243
+ blockHash: genHex(64, rng),
244
+ blockHeight:
245
+ superAccount.blockHeight -
246
+ Math.floor((Date.now() - (date as any)) / 900000),
247
+ accountId: account.id,
248
+ date,
249
+ extra: {},
250
+ };
251
+
252
+ if (account.type === "Account") {
253
+ const { subAccounts } = account;
254
+
255
+ if (subAccounts) {
256
+ // TODO make sure tokenAccounts sometimes reuse an existing op hash from main account
257
+ op.subOperations = inferSubOperations(hash, subAccounts);
258
+ }
259
+ }
260
+
261
+ return op;
262
+ }
263
+
264
+ /**
265
+ * @param id is a number or a string, used as an account identifier and as a seed for the generation.
266
+ * @memberof mock/account
267
+ */
268
+ export type GenAccountOptions = {
269
+ operationsSize?: number;
270
+ currency?: CryptoCurrency;
271
+ subAccountsCount?: number;
272
+ swapHistorySize?: number;
273
+ withNft?: boolean;
274
+ };
275
+
276
+ export function genTokenAccount(
277
+ index: number,
278
+ account: Account,
279
+ token: TokenCurrency
280
+ ): TokenAccount {
281
+ const rng = new Prando(account.id + "|" + index);
282
+ const tokenAccount: TokenAccount = {
283
+ type: "TokenAccount",
284
+ starred: false,
285
+ id: account.id + "|" + index,
286
+ parentId: account.id,
287
+ token,
288
+ operationsCount: 0,
289
+ operations: [],
290
+ pendingOperations: [],
291
+ balance: new BigNumber(0),
292
+ spendableBalance: new BigNumber(0),
293
+ creationDate: new Date(),
294
+ swapHistory: [],
295
+ balanceHistoryCache: emptyHistoryCache,
296
+ };
297
+ const operationsSize = rng.nextInt(1, 200);
298
+ tokenAccount.operations = Array(operationsSize)
299
+ .fill(null)
300
+ .reduce((ops: Operation[]) => {
301
+ const op = genOperation(account, tokenAccount, ops, rng);
302
+ return ops.concat(op);
303
+ }, []);
304
+ tokenAccount.operationsCount = tokenAccount.operations.length;
305
+ tokenAccount.spendableBalance = tokenAccount.balance = ensureNoNegative(
306
+ tokenAccount.operations
307
+ );
308
+ tokenAccount.creationDate =
309
+ tokenAccount.operations.length > 0
310
+ ? tokenAccount.operations[tokenAccount.operations.length - 1].date
311
+ : new Date();
312
+ tokenAccount.balanceHistoryCache =
313
+ generateHistoryFromOperations(tokenAccount);
314
+ return tokenAccount;
315
+ }
316
+
317
+ type GenAccountEnhanceOperations = (
318
+ account: Account,
319
+ currency: CryptoCurrency,
320
+ rng: Prando
321
+ ) => void;
322
+
323
+ export function genAccount(
324
+ id: number | string,
325
+ opts: GenAccountOptions = {},
326
+ completeResources?: (
327
+ account: Account,
328
+ currency: CryptoCurrency,
329
+ address: string
330
+ ) => void,
331
+ genAccountEnhanceOperations?: GenAccountEnhanceOperations
332
+ ): Account {
333
+ const rng = new Prando(id);
334
+ const currency = opts.currency || rng.nextArrayItem(currencies);
335
+ const operationsSize = opts.operationsSize ?? rng.nextInt(1, 200);
336
+ const swapHistorySize = opts.swapHistorySize || 0;
337
+ const withNft = opts.withNft ?? false;
338
+ const address = genAddress(currency, rng);
339
+ const derivationPath = runDerivationScheme(
340
+ getDerivationScheme({
341
+ currency,
342
+ derivationMode: "",
343
+ }),
344
+ currency
345
+ );
346
+ const freshAddress = {
347
+ address,
348
+ derivationPath,
349
+ };
350
+ // nb Make the third (ethereum_classic, dogecoin) account originally migratable
351
+ const outdated =
352
+ ["ethereum_classic", "dogecoin"].includes(currency.id) &&
353
+ `${id}`.endsWith("_2");
354
+ const accountId = `mock:${outdated ? 0 : 1}:${currency.id}:${id}:`;
355
+ const account: Account = {
356
+ type: "Account",
357
+ id: accountId,
358
+ seedIdentifier: "mock",
359
+ derivationMode: "",
360
+ xpub: genHex(64, rng),
361
+ index: 1,
362
+ freshAddress: address,
363
+ freshAddressPath: derivationPath,
364
+ freshAddresses: [freshAddress],
365
+ name: rng.nextString(rng.nextInt(4, 34)),
366
+ starred: false,
367
+ used: false,
368
+ balance: new BigNumber(0),
369
+ spendableBalance: new BigNumber(0),
370
+ blockHeight: rng.nextInt(100000, 200000),
371
+ currency,
372
+ unit: rng.nextArrayItem(currency.units),
373
+ operationsCount: 0,
374
+ operations: [],
375
+ pendingOperations: [],
376
+ lastSyncDate: new Date(),
377
+ creationDate: new Date(),
378
+ swapHistory: Array(swapHistorySize)
379
+ .fill(null)
380
+ .map((_, i) => ({
381
+ provider: "changelly",
382
+ swapId: `swap-id-${i}`,
383
+ status: "finished",
384
+ receiverAccountId: "receiver-id",
385
+ operationId: "operation-id",
386
+ tokenId: "token-id",
387
+ fromAmount: new BigNumber("1000"),
388
+ toAmount: new BigNumber("2000"),
389
+ })),
390
+ balanceHistoryCache: emptyHistoryCache,
391
+ ...(withNft && {
392
+ nfts: Array(10)
393
+ .fill(null)
394
+ .map(() => createFixtureNFT(accountId, currency)),
395
+ }),
396
+ };
397
+
398
+ if (
399
+ [
400
+ "ethereum",
401
+ "ethereum_ropsten",
402
+ "ethereum_goerli",
403
+ "tron",
404
+ "algorand",
405
+ ].includes(currency.id)
406
+ ) {
407
+ const tokenCount =
408
+ typeof opts.subAccountsCount === "number"
409
+ ? opts.subAccountsCount
410
+ : rng.nextInt(0, 8);
411
+ const all = listTokensForCryptoCurrency(account.currency).filter((t) =>
412
+ hardcodedMarketcap.includes(t.id)
413
+ );
414
+ const compoundReadyTokens = all.filter(findCompoundToken);
415
+ const notCompoundReadyTokens = all.filter((a) => !findCompoundToken(a));
416
+ // favorize the generation of compound tokens
417
+ const tokens = compoundReadyTokens
418
+ .concat(
419
+ // from random index
420
+ notCompoundReadyTokens.slice(
421
+ rng.nextInt(Math.floor(notCompoundReadyTokens.length / 2))
422
+ )
423
+ )
424
+ .slice(0, tokenCount);
425
+ account.subAccounts = tokens.map((token, i) =>
426
+ genTokenAccount(i, account, token)
427
+ );
428
+ }
429
+
430
+ completeResources?.(account, currency, address);
431
+
432
+ account.operations = Array(operationsSize)
433
+ .fill(null)
434
+ .reduce((ops: Operation[]) => {
435
+ const op = genOperation(account, account, ops, rng);
436
+ return ops.concat(op);
437
+ }, []);
438
+
439
+ if (withNft) {
440
+ const nftOperations = Array(5)
441
+ .fill(null)
442
+ .reduce((ops: Operation[]) => {
443
+ const index = Math.floor(Math.random() * (5 - 0 + 1) + 0);
444
+
445
+ if (account.nfts && account.nfts[index]) {
446
+ const { tokenId, contract, standard } = account.nfts[index];
447
+ const op = genNFTOperation(
448
+ account,
449
+ account,
450
+ ops,
451
+ rng,
452
+ contract,
453
+ standard,
454
+ tokenId
455
+ );
456
+ return ops.concat(op);
457
+ }
458
+ }, []);
459
+
460
+ account.operations = account.operations.concat(nftOperations);
461
+ }
462
+
463
+ account.creationDate =
464
+ account.operations.length > 0
465
+ ? account.operations[account.operations.length - 1].date
466
+ : new Date();
467
+ account.operationsCount = account.operations.length;
468
+ account.spendableBalance = account.balance = ensureNoNegative(
469
+ account.operations
470
+ );
471
+ account.used = !isAccountEmpty(account);
472
+ if (genAccountEnhanceOperations)
473
+ genAccountEnhanceOperations(account, currency, rng);
474
+ account.balanceHistoryCache = generateHistoryFromOperations(account);
475
+ return account;
476
+ }
@@ -0,0 +1,25 @@
1
+ import { getCryptoCurrencyById } from "../../currencies";
2
+ import { createFixtureNFT, NFTs, NFTs_POLYGON } from "./nfts";
3
+
4
+ const POL = getCryptoCurrencyById("polygon");
5
+ describe("nfts fixtures", () => {
6
+ it("createFixtureNFT", () => {
7
+ const FIXTURE = createFixtureNFT("account-mock");
8
+ expect(FIXTURE.currencyId).toEqual("ethereum");
9
+ expect(FIXTURE.amount).not.toBeUndefined();
10
+ expect(FIXTURE.contract).not.toBeUndefined();
11
+ expect(FIXTURE.tokenId).not.toBeUndefined();
12
+ expect(FIXTURE.id).toContain("account-mock");
13
+
14
+ expect(
15
+ NFTs.map((nft) => nft.tokenId).includes(FIXTURE.tokenId)
16
+ ).toBeTruthy();
17
+
18
+ const FIXTURE_POL = createFixtureNFT("account-mock-pol", POL);
19
+ expect(FIXTURE_POL.currencyId).toEqual("polygon");
20
+
21
+ expect(
22
+ NFTs_POLYGON.map((nft) => nft.tokenId).includes(FIXTURE_POL.tokenId)
23
+ ).toBeTruthy();
24
+ });
25
+ });