@ledgerhq/live-common 21.8.2 → 21.10.0-btcjs.2

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 (291) hide show
  1. package/lib/__tests__/currencies.js +1 -0
  2. package/lib/__tests__/currencies.js.map +1 -1
  3. package/lib/__tests__/families/bitcoin/logic.js +7 -7
  4. package/lib/__tests__/families/bitcoin/logic.js.map +1 -1
  5. package/lib/__tests__/families/bitcoin/wallet-btc/wallet.estimateMaxSpendable.test.js +1 -2
  6. package/lib/__tests__/families/bitcoin/wallet-btc/wallet.estimateMaxSpendable.test.js.map +1 -1
  7. package/lib/__tests__/families/bitcoin/wallet-btc/wallet.integration.test.js +5 -3
  8. package/lib/__tests__/families/bitcoin/wallet-btc/wallet.integration.test.js.map +1 -1
  9. package/lib/__tests__/families/bitcoin/wallet-btc/xpub.syncing.integration.test.js +9 -7
  10. package/lib/__tests__/families/bitcoin/wallet-btc/xpub.syncing.integration.test.js.map +1 -1
  11. package/lib/__tests__/families/bitcoin/wallet-btc/xpub.txs.NP2WPKH.integration.test.js +2 -1
  12. package/lib/__tests__/families/bitcoin/wallet-btc/xpub.txs.NP2WPKH.integration.test.js.map +1 -1
  13. package/lib/__tests__/families/bitcoin/wallet-btc/xpub.txs.P2WPKH.integration.test.js +2 -1
  14. package/lib/__tests__/families/bitcoin/wallet-btc/xpub.txs.P2WPKH.integration.test.js.map +1 -1
  15. package/lib/__tests__/families/bitcoin/wallet-btc/xpub.txs.integration.test.js +4 -2
  16. package/lib/__tests__/families/bitcoin/wallet-btc/xpub.txs.integration.test.js.map +1 -1
  17. package/lib/__tests__/families/bitcoin/wallet-btc/xpub.txs.litecoin.test.js +2 -1
  18. package/lib/__tests__/families/bitcoin/wallet-btc/xpub.txs.litecoin.test.js.map +1 -1
  19. package/lib/account/helpers.d.ts.map +1 -1
  20. package/lib/account/helpers.js +8 -1
  21. package/lib/account/helpers.js.map +1 -1
  22. package/lib/account/pending.d.ts +1 -1
  23. package/lib/account/support.d.ts.map +1 -1
  24. package/lib/account/support.js +2 -1
  25. package/lib/account/support.js.map +1 -1
  26. package/lib/api/explorerConfig/index.d.ts.map +1 -1
  27. package/lib/api/explorerConfig/index.js +0 -36
  28. package/lib/api/explorerConfig/index.js.map +1 -1
  29. package/lib/bridge/jsHelpers.d.ts +2 -1
  30. package/lib/bridge/jsHelpers.d.ts.map +1 -1
  31. package/lib/bridge/jsHelpers.js +56 -43
  32. package/lib/bridge/jsHelpers.js.map +1 -1
  33. package/lib/derivation.d.ts +12 -0
  34. package/lib/derivation.d.ts.map +1 -1
  35. package/lib/derivation.js +32 -4
  36. package/lib/derivation.js.map +1 -1
  37. package/lib/env.d.ts +5 -10
  38. package/lib/env.d.ts.map +1 -1
  39. package/lib/env.js +2 -7
  40. package/lib/env.js.map +1 -1
  41. package/lib/env.react.d.ts +1 -1
  42. package/lib/env.react.d.ts.map +1 -1
  43. package/lib/errors.d.ts +3 -0
  44. package/lib/errors.d.ts.map +1 -1
  45. package/lib/errors.js +2 -1
  46. package/lib/errors.js.map +1 -1
  47. package/lib/exchange/swap/hooks/usePickDefaultAccount.d.ts.map +1 -1
  48. package/lib/exchange/swap/hooks/usePickDefaultAccount.js +48 -26
  49. package/lib/exchange/swap/hooks/usePickDefaultAccount.js.map +1 -1
  50. package/lib/exchange/swap/hooks/usePickDefaultAccount.test.js +20 -37
  51. package/lib/exchange/swap/hooks/usePickDefaultAccount.test.js.map +1 -1
  52. package/lib/families/bitcoin/bridge/libcore.d.ts.map +1 -1
  53. package/lib/families/bitcoin/bridge/libcore.js +8 -1
  54. package/lib/families/bitcoin/bridge/libcore.js.map +1 -1
  55. package/lib/families/bitcoin/bridge/mock.d.ts.map +1 -1
  56. package/lib/families/bitcoin/bridge/mock.js +3 -1
  57. package/lib/families/bitcoin/bridge/mock.js.map +1 -1
  58. package/lib/families/bitcoin/datasets/bitcoin.scanAccounts.1.d.ts.map +1 -1
  59. package/lib/families/bitcoin/datasets/bitcoin.scanAccounts.1.js +1 -1
  60. package/lib/families/bitcoin/datasets/bitcoin.scanAccounts.1.js.map +1 -1
  61. package/lib/families/bitcoin/datasets/bitcoin_cash.d.ts.map +1 -1
  62. package/lib/families/bitcoin/datasets/bitcoin_cash.js +1 -1
  63. package/lib/families/bitcoin/datasets/bitcoin_cash.js.map +1 -1
  64. package/lib/families/bitcoin/datasets/bitcoin_gold.d.ts.map +1 -1
  65. package/lib/families/bitcoin/datasets/bitcoin_gold.js +1 -1
  66. package/lib/families/bitcoin/datasets/bitcoin_gold.js.map +1 -1
  67. package/lib/families/bitcoin/datasets/dash.d.ts.map +1 -1
  68. package/lib/families/bitcoin/datasets/dash.js +1 -1
  69. package/lib/families/bitcoin/datasets/dash.js.map +1 -1
  70. package/lib/families/bitcoin/datasets/decred.d.ts.map +1 -1
  71. package/lib/families/bitcoin/datasets/decred.js +1 -1
  72. package/lib/families/bitcoin/datasets/decred.js.map +1 -1
  73. package/lib/families/bitcoin/datasets/digibyte.scanAccounts.1.d.ts.map +1 -1
  74. package/lib/families/bitcoin/datasets/digibyte.scanAccounts.1.js +1 -1
  75. package/lib/families/bitcoin/datasets/digibyte.scanAccounts.1.js.map +1 -1
  76. package/lib/families/bitcoin/datasets/dogecoin.d.ts.map +1 -1
  77. package/lib/families/bitcoin/datasets/dogecoin.js +1 -1
  78. package/lib/families/bitcoin/datasets/dogecoin.js.map +1 -1
  79. package/lib/families/bitcoin/datasets/komodo.d.ts.map +1 -1
  80. package/lib/families/bitcoin/datasets/komodo.js +1 -1
  81. package/lib/families/bitcoin/datasets/komodo.js.map +1 -1
  82. package/lib/families/bitcoin/datasets/litecoin.scanAccounts.1.d.ts.map +1 -1
  83. package/lib/families/bitcoin/datasets/litecoin.scanAccounts.1.js +1 -1
  84. package/lib/families/bitcoin/datasets/litecoin.scanAccounts.1.js.map +1 -1
  85. package/lib/families/bitcoin/datasets/peercoin.d.ts.map +1 -1
  86. package/lib/families/bitcoin/datasets/peercoin.js +1 -1
  87. package/lib/families/bitcoin/datasets/peercoin.js.map +1 -1
  88. package/lib/families/bitcoin/datasets/pivx.d.ts.map +1 -1
  89. package/lib/families/bitcoin/datasets/pivx.js +1 -1
  90. package/lib/families/bitcoin/datasets/pivx.js.map +1 -1
  91. package/lib/families/bitcoin/datasets/qtum.d.ts.map +1 -1
  92. package/lib/families/bitcoin/datasets/qtum.js +1 -1
  93. package/lib/families/bitcoin/datasets/qtum.js.map +1 -1
  94. package/lib/families/bitcoin/datasets/stakenet.d.ts.map +1 -1
  95. package/lib/families/bitcoin/datasets/stakenet.js +1 -1
  96. package/lib/families/bitcoin/datasets/stakenet.js.map +1 -1
  97. package/lib/families/bitcoin/datasets/vertcoin.d.ts.map +1 -1
  98. package/lib/families/bitcoin/datasets/vertcoin.js +1 -1
  99. package/lib/families/bitcoin/datasets/vertcoin.js.map +1 -1
  100. package/lib/families/bitcoin/datasets/viacoin.d.ts.map +1 -1
  101. package/lib/families/bitcoin/datasets/viacoin.js +1 -1
  102. package/lib/families/bitcoin/datasets/viacoin.js.map +1 -1
  103. package/lib/families/bitcoin/datasets/zcash.d.ts.map +1 -1
  104. package/lib/families/bitcoin/datasets/zcash.js +1 -1
  105. package/lib/families/bitcoin/datasets/zcash.js.map +1 -1
  106. package/lib/families/bitcoin/datasets/zencash.d.ts.map +1 -1
  107. package/lib/families/bitcoin/datasets/zencash.js +1 -1
  108. package/lib/families/bitcoin/datasets/zencash.js.map +1 -1
  109. package/lib/families/bitcoin/exchange.d.ts +1 -1
  110. package/lib/families/bitcoin/exchange.d.ts.map +1 -1
  111. package/lib/families/bitcoin/exchange.js +2 -1
  112. package/lib/families/bitcoin/exchange.js.map +1 -1
  113. package/lib/families/bitcoin/hw-getAddress.d.ts +5 -1
  114. package/lib/families/bitcoin/hw-getAddress.d.ts.map +1 -1
  115. package/lib/families/bitcoin/hw-getAddress.js +34 -18
  116. package/lib/families/bitcoin/hw-getAddress.js.map +1 -1
  117. package/lib/families/bitcoin/js-signOperation.d.ts.map +1 -1
  118. package/lib/families/bitcoin/js-signOperation.js +3 -0
  119. package/lib/families/bitcoin/js-signOperation.js.map +1 -1
  120. package/lib/families/bitcoin/js-synchronisation.d.ts +2 -2
  121. package/lib/families/bitcoin/js-synchronisation.d.ts.map +1 -1
  122. package/lib/families/bitcoin/js-synchronisation.js +24 -16
  123. package/lib/families/bitcoin/js-synchronisation.js.map +1 -1
  124. package/lib/families/bitcoin/logic.d.ts.map +1 -1
  125. package/lib/families/bitcoin/logic.js +4 -2
  126. package/lib/families/bitcoin/logic.js.map +1 -1
  127. package/lib/families/bitcoin/specs.d.ts.map +1 -1
  128. package/lib/families/bitcoin/specs.js +1 -1
  129. package/lib/families/bitcoin/specs.js.map +1 -1
  130. package/lib/families/bitcoin/types.d.ts +3 -0
  131. package/lib/families/bitcoin/types.d.ts.map +1 -1
  132. package/lib/families/bitcoin/types.js +4 -1
  133. package/lib/families/bitcoin/types.js.map +1 -1
  134. package/lib/families/bitcoin/wallet-btc/crypto/base.d.ts +1 -2
  135. package/lib/families/bitcoin/wallet-btc/crypto/base.d.ts.map +1 -1
  136. package/lib/families/bitcoin/wallet-btc/crypto/base.js +6 -11
  137. package/lib/families/bitcoin/wallet-btc/crypto/base.js.map +1 -1
  138. package/lib/families/bitcoin/wallet-btc/crypto/bitcoin.d.ts.map +1 -1
  139. package/lib/families/bitcoin/wallet-btc/crypto/bitcoin.js.map +1 -1
  140. package/lib/families/bitcoin/wallet-btc/crypto/bitcoincash.d.ts +1 -2
  141. package/lib/families/bitcoin/wallet-btc/crypto/bitcoincash.d.ts.map +1 -1
  142. package/lib/families/bitcoin/wallet-btc/crypto/bitcoincash.js +1 -4
  143. package/lib/families/bitcoin/wallet-btc/crypto/bitcoincash.js.map +1 -1
  144. package/lib/families/bitcoin/wallet-btc/crypto/litecoin.d.ts +2 -3
  145. package/lib/families/bitcoin/wallet-btc/crypto/litecoin.d.ts.map +1 -1
  146. package/lib/families/bitcoin/wallet-btc/crypto/litecoin.js +6 -11
  147. package/lib/families/bitcoin/wallet-btc/crypto/litecoin.js.map +1 -1
  148. package/lib/families/bitcoin/wallet-btc/crypto/types.d.ts +0 -5
  149. package/lib/families/bitcoin/wallet-btc/crypto/types.d.ts.map +1 -1
  150. package/lib/families/bitcoin/wallet-btc/crypto/zec.d.ts +1 -2
  151. package/lib/families/bitcoin/wallet-btc/crypto/zec.d.ts.map +1 -1
  152. package/lib/families/bitcoin/wallet-btc/crypto/zec.js +1 -4
  153. package/lib/families/bitcoin/wallet-btc/crypto/zec.js.map +1 -1
  154. package/lib/families/bitcoin/wallet-btc/crypto/zen.d.ts +1 -2
  155. package/lib/families/bitcoin/wallet-btc/crypto/zen.d.ts.map +1 -1
  156. package/lib/families/bitcoin/wallet-btc/crypto/zen.js +1 -4
  157. package/lib/families/bitcoin/wallet-btc/crypto/zen.js.map +1 -1
  158. package/lib/families/bitcoin/wallet-btc/explorer/index.d.ts.map +1 -1
  159. package/lib/families/bitcoin/wallet-btc/explorer/index.js.map +1 -1
  160. package/lib/families/bitcoin/wallet-btc/pickingstrategies/CoinSelect.d.ts.map +1 -1
  161. package/lib/families/bitcoin/wallet-btc/pickingstrategies/CoinSelect.js +3 -0
  162. package/lib/families/bitcoin/wallet-btc/pickingstrategies/CoinSelect.js.map +1 -1
  163. package/lib/families/bitcoin/wallet-btc/pickingstrategies/DeepFirst.d.ts.map +1 -1
  164. package/lib/families/bitcoin/wallet-btc/pickingstrategies/DeepFirst.js +2 -0
  165. package/lib/families/bitcoin/wallet-btc/pickingstrategies/DeepFirst.js.map +1 -1
  166. package/lib/families/bitcoin/wallet-btc/pickingstrategies/Merge.d.ts.map +1 -1
  167. package/lib/families/bitcoin/wallet-btc/pickingstrategies/Merge.js +2 -0
  168. package/lib/families/bitcoin/wallet-btc/pickingstrategies/Merge.js.map +1 -1
  169. package/lib/families/bitcoin/wallet-btc/storage/types.d.ts +1 -1
  170. package/lib/families/bitcoin/wallet-btc/storage/types.d.ts.map +1 -1
  171. package/lib/families/bitcoin/wallet-btc/utils.d.ts.map +1 -1
  172. package/lib/families/bitcoin/wallet-btc/utils.js +6 -0
  173. package/lib/families/bitcoin/wallet-btc/utils.js.map +1 -1
  174. package/lib/families/bitcoin/wallet-btc/wallet.d.ts +2 -4
  175. package/lib/families/bitcoin/wallet-btc/wallet.d.ts.map +1 -1
  176. package/lib/families/bitcoin/wallet-btc/wallet.js +24 -75
  177. package/lib/families/bitcoin/wallet-btc/wallet.js.map +1 -1
  178. package/lib/families/bitcoin/wallet-btc/xpub.d.ts +1 -1
  179. package/lib/families/bitcoin/wallet-btc/xpub.d.ts.map +1 -1
  180. package/lib/families/bitcoin/wallet-btc/xpub.js +1 -3
  181. package/lib/families/bitcoin/wallet-btc/xpub.js.map +1 -1
  182. package/lib/families/crypto_org/js-synchronisation.d.ts +2 -2
  183. package/lib/families/elrond/js-synchronisation.d.ts +2 -2
  184. package/lib/families/elrond/js-synchronisation.d.ts.map +1 -1
  185. package/lib/families/elrond/js-synchronisation.js +1 -3
  186. package/lib/families/elrond/js-synchronisation.js.map +1 -1
  187. package/lib/families/elrond/test-dataset.js +4 -4
  188. package/lib/families/elrond/test-dataset.js.map +1 -1
  189. package/lib/families/polkadot/js-synchronisation.d.ts +2 -2
  190. package/lib/families/polkadot/test-dataset.d.ts.map +1 -1
  191. package/lib/families/polkadot/test-dataset.js +606 -604
  192. package/lib/families/polkadot/test-dataset.js.map +1 -1
  193. package/lib/families/stellar/js-synchronization.d.ts +2 -2
  194. package/lib/families/tezos/bakers.whitelist-default.d.ts.map +1 -1
  195. package/lib/families/tezos/bakers.whitelist-default.js +1 -1
  196. package/lib/families/tezos/bakers.whitelist-default.js.map +1 -1
  197. package/lib/families/tron/bridge/js.d.ts.map +1 -1
  198. package/lib/families/tron/bridge/js.js +14 -5
  199. package/lib/families/tron/bridge/js.js.map +1 -1
  200. package/lib/generated/exchange.d.ts +1 -1
  201. package/lib/hw/getAddress/types.d.ts +2 -10
  202. package/lib/hw/getAddress/types.d.ts.map +1 -1
  203. package/lib/libcore/createAccountFromDevice.d.ts +2 -2
  204. package/lib/libcore/createAccountFromDevice.d.ts.map +1 -1
  205. package/lib/libcore/createAccountFromDevice.js +2 -6
  206. package/lib/libcore/createAccountFromDevice.js.map +1 -1
  207. package/lib/libcore/scanAccounts.d.ts +4 -1
  208. package/lib/libcore/scanAccounts.d.ts.map +1 -1
  209. package/lib/libcore/scanAccounts.js +35 -32
  210. package/lib/libcore/scanAccounts.js.map +1 -1
  211. package/lib/network.d.ts.map +1 -1
  212. package/lib/network.js +7 -7
  213. package/lib/network.js.map +1 -1
  214. package/package.json +31 -31
  215. package/src/__tests__/__snapshots__/all.libcore.ts.snap +352 -527
  216. package/src/__tests__/__snapshots__/csvExport.ts.snap +237 -237
  217. package/src/__tests__/__snapshots__/portfolio.ts.snap +12 -12
  218. package/src/__tests__/currencies.ts +1 -0
  219. package/src/__tests__/families/bitcoin/logic.ts +14 -21
  220. package/src/__tests__/families/bitcoin/wallet-btc/wallet.estimateMaxSpendable.test.ts +1 -2
  221. package/src/__tests__/families/bitcoin/wallet-btc/wallet.integration.test.ts +3 -1
  222. package/src/__tests__/families/bitcoin/wallet-btc/xpub.syncing.integration.test.ts +2 -0
  223. package/src/__tests__/families/bitcoin/wallet-btc/xpub.txs.NP2WPKH.integration.test.ts +1 -0
  224. package/src/__tests__/families/bitcoin/wallet-btc/xpub.txs.P2WPKH.integration.test.ts +1 -0
  225. package/src/__tests__/families/bitcoin/wallet-btc/xpub.txs.integration.test.ts +2 -0
  226. package/src/__tests__/families/bitcoin/wallet-btc/xpub.txs.litecoin.test.ts +1 -0
  227. package/src/account/helpers.ts +13 -6
  228. package/src/account/support.ts +2 -1
  229. package/src/api/explorerConfig/index.ts +0 -36
  230. package/src/bridge/jsHelpers.ts +28 -8
  231. package/src/currencies/__snapshots__/sortByMarketcap.test.ts.snap +2897 -68
  232. package/src/derivation.ts +33 -2
  233. package/src/env.ts +2 -7
  234. package/src/errors.ts +5 -0
  235. package/src/exchange/swap/hooks/usePickDefaultAccount.test.ts +20 -45
  236. package/src/exchange/swap/hooks/usePickDefaultAccount.ts +23 -35
  237. package/src/families/bitcoin/bridge/libcore.ts +11 -1
  238. package/src/families/bitcoin/bridge/mock.ts +3 -1
  239. package/src/families/bitcoin/datasets/bitcoin.scanAccounts.1.ts +100 -20
  240. package/src/families/bitcoin/datasets/bitcoin_cash.ts +22 -8
  241. package/src/families/bitcoin/datasets/bitcoin_gold.ts +92 -18
  242. package/src/families/bitcoin/datasets/dash.ts +32 -2
  243. package/src/families/bitcoin/datasets/decred.ts +12 -2
  244. package/src/families/bitcoin/datasets/digibyte.scanAccounts.1.ts +84 -18
  245. package/src/families/bitcoin/datasets/dogecoin.ts +32 -2
  246. package/src/families/bitcoin/datasets/komodo.ts +42 -2
  247. package/src/families/bitcoin/datasets/litecoin.scanAccounts.1.ts +83 -19
  248. package/src/families/bitcoin/datasets/peercoin.ts +32 -2
  249. package/src/families/bitcoin/datasets/pivx.ts +33 -3
  250. package/src/families/bitcoin/datasets/qtum.ts +70 -12
  251. package/src/families/bitcoin/datasets/stakenet.ts +20 -4
  252. package/src/families/bitcoin/datasets/vertcoin.ts +86 -20
  253. package/src/families/bitcoin/datasets/viacoin.ts +48 -10
  254. package/src/families/bitcoin/datasets/zcash.ts +12 -2
  255. package/src/families/bitcoin/datasets/zencash.ts +10 -2
  256. package/src/families/bitcoin/exchange.ts +1 -0
  257. package/src/families/bitcoin/hw-getAddress.ts +41 -19
  258. package/src/families/bitcoin/js-signOperation.ts +4 -0
  259. package/src/families/bitcoin/js-synchronisation.ts +32 -22
  260. package/src/families/bitcoin/logic.ts +4 -2
  261. package/src/families/bitcoin/specs.ts +2 -1
  262. package/src/families/bitcoin/types.ts +4 -0
  263. package/src/families/bitcoin/wallet-btc/crypto/base.ts +7 -13
  264. package/src/families/bitcoin/wallet-btc/crypto/bitcoin.ts +1 -5
  265. package/src/families/bitcoin/wallet-btc/crypto/bitcoincash.ts +2 -6
  266. package/src/families/bitcoin/wallet-btc/crypto/litecoin.ts +7 -13
  267. package/src/families/bitcoin/wallet-btc/crypto/types.ts +0 -8
  268. package/src/families/bitcoin/wallet-btc/crypto/zec.ts +3 -6
  269. package/src/families/bitcoin/wallet-btc/crypto/zen.ts +2 -6
  270. package/src/families/bitcoin/wallet-btc/explorer/index.ts +2 -2
  271. package/src/families/bitcoin/wallet-btc/pickingstrategies/CoinSelect.ts +3 -1
  272. package/src/families/bitcoin/wallet-btc/pickingstrategies/DeepFirst.ts +2 -0
  273. package/src/families/bitcoin/wallet-btc/pickingstrategies/Merge.ts +2 -0
  274. package/src/families/bitcoin/wallet-btc/storage/types.ts +1 -1
  275. package/src/families/bitcoin/wallet-btc/utils.ts +6 -1
  276. package/src/families/bitcoin/wallet-btc/wallet.ts +14 -82
  277. package/src/families/bitcoin/wallet-btc/xpub.ts +2 -5
  278. package/src/families/elrond/js-synchronisation.ts +2 -4
  279. package/src/families/elrond/test-dataset.ts +3 -3
  280. package/src/families/polkadot/test-dataset.ts +627 -623
  281. package/src/families/tezos/bakers.whitelist-default.ts +0 -1
  282. package/src/families/tron/bridge/js.ts +18 -6
  283. package/src/hw/getAddress/types.ts +3 -11
  284. package/src/libcore/createAccountFromDevice.ts +4 -5
  285. package/src/libcore/scanAccounts.ts +20 -9
  286. package/src/network.ts +13 -11
  287. package/lib/families/bitcoin/datasets/stratis.d.ts +0 -5
  288. package/lib/families/bitcoin/datasets/stratis.d.ts.map +0 -1
  289. package/lib/families/bitcoin/datasets/stratis.js +0 -12
  290. package/lib/families/bitcoin/datasets/stratis.js.map +0 -1
  291. package/src/families/bitcoin/datasets/stratis.ts +0 -24
@@ -25,663 +25,667 @@ const ACCOUNT_CONTROLLER = "15oodc5d8DWJodZhTD6qsxxSQRYWhdkWCrwqNHajDirXRrAD";
25
25
  const ACCOUNT_EMPTY = "111111111111111111111111111111111HC1";
26
26
  const ACCOUNT_WITH_NO_OPERATION =
27
27
  "12EsPA79dvhtjp1bYvCiEWPsQmmdKGss44GzE3CT9tTo9g4Q";
28
- const dataset: DatasetTest<Transaction> = {
29
- implementations: ["js"],
30
- currencies: {
31
- polkadot: {
32
- FIXME_ignoreAccountFields: [
33
- "polkadotResources.unlockings", // Due to completion date that change everyday (estimated time)
34
- "polkadotResources.nominations", // TODO: try to only ignore status
35
- "polkadotResources.unlockedBalance", // It moved when an unbond is finished
36
- ],
37
- scanAccounts: [
28
+
29
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
30
+ const polkadot = {
31
+ FIXME_ignoreAccountFields: [
32
+ "polkadotResources.unlockings", // Due to completion date that change everyday (estimated time)
33
+ "polkadotResources.nominations", // TODO: try to only ignore status
34
+ "polkadotResources.unlockedBalance", // It moved when an unbond is finished
35
+ ],
36
+ scanAccounts: [
37
+ {
38
+ name: "polkadot seed 1",
39
+ apdus: `
40
+ => 90010000142c00008062010080000000000000000000000000
41
+ <= e283d1b141c1048635420b7138132acbe0ff47b71fc9f6a9089f78ab29a6b8143136377a7973345778677954514e6743744e6f597852463463784867385766516a4248414c7666615a585070776331549000
42
+ => 90010000142c00008062010080000000800000008000000080
43
+ <= 43ff8cc36e9804eb1f5d45cd834ebbae1d490c22b8f8a61af20b48e566dc53dc31325941383674525168486777553353536a3536616573554b4237474b76646e5a54545458526f7034766433596744569000
44
+ => 90010000142c00008062010080010000800000008000000080
45
+ <= 78a0189312a3f2817d89c71cec7e63bfbfbfa7145c384b3870ff1167a74c76d831336a414a666870466b525a6a3154535364466f70616946654b6e6f663271376734474e6463786367384c767836514e9000
46
+ => 90010000142c00008062010080020000800000008000000080
47
+ <= d4a3325e08977a29f19270b96a192eb73ce768e4bdf79565ba9cdbe3f0be6e9531356f6f646335643844574a6f645a6854443671737878535152595768646b57437277714e48616a44697258527241449000
48
+ => 90010000142c00008062010080030000800000008000000080
49
+ <= ffcc00cd09cbe8fd741a91269bd5f50445f4b0c3ad9f8b134341ba5e65bc24e131366e507037435537596d5a6a445248524437644d35434579505a6256615a3637435575356b4d77353957527a6f346a9000
50
+ `,
51
+ },
52
+ ],
53
+ accounts: [
54
+ {
55
+ // Account which is stash and controller
56
+ raw: {
57
+ id: `js:2:polkadot:${ACCOUNT_SAME_STASHCONTROLLER}:polkadotbip44`,
58
+ seedIdentifier: ACCOUNT_SAME_STASHCONTROLLER,
59
+ name: "Polkadot 1",
60
+ derivationMode: "polkadotbip44",
61
+ index: 0,
62
+ freshAddress: ACCOUNT_SAME_STASHCONTROLLER,
63
+ freshAddressPath: "44'/354'/0'/0'/0'",
64
+ freshAddresses: [],
65
+ blockHeight: 0,
66
+ operations: [],
67
+ pendingOperations: [],
68
+ currencyId: "polkadot",
69
+ unitMagnitude: 10,
70
+ lastSyncDate: "",
71
+ balance: "21000310",
72
+ },
73
+ transactions: [
38
74
  {
39
- name: "polkadot seed 1",
40
- apdus: `
41
- => 90010000142c00008062010080000000000000000000000000
42
- <= e283d1b141c1048635420b7138132acbe0ff47b71fc9f6a9089f78ab29a6b8143136377a7973345778677954514e6743744e6f597852463463784867385766516a4248414c7666615a585070776331549000
43
- => 90010000142c00008062010080000000800000008000000080
44
- <= 43ff8cc36e9804eb1f5d45cd834ebbae1d490c22b8f8a61af20b48e566dc53dc31325941383674525168486777553353536a3536616573554b4237474b76646e5a54545458526f7034766433596744569000
45
- => 90010000142c00008062010080010000800000008000000080
46
- <= 78a0189312a3f2817d89c71cec7e63bfbfbfa7145c384b3870ff1167a74c76d831336a414a666870466b525a6a3154535364466f70616946654b6e6f663271376734474e6463786367384c767836514e9000
47
- => 90010000142c00008062010080020000800000008000000080
48
- <= d4a3325e08977a29f19270b96a192eb73ce768e4bdf79565ba9cdbe3f0be6e9531356f6f646335643844574a6f645a6854443671737878535152595768646b57437277714e48616a44697258527241449000
49
- => 90010000142c00008062010080030000800000008000000080
50
- <= ffcc00cd09cbe8fd741a91269bd5f50445f4b0c3ad9f8b134341ba5e65bc24e131366e507037435537596d5a6a445248524437644d35434579505a6256615a3637435575356b4d77353957527a6f346a9000
51
- `,
75
+ name: "recipient and sender must not be the same",
76
+ transaction: fromTransactionRaw({
77
+ family: "polkadot",
78
+ recipient: ACCOUNT_SAME_STASHCONTROLLER,
79
+ amount: "100000000",
80
+ mode: "send",
81
+ era: null,
82
+ validators: [],
83
+ fees: null,
84
+ rewardDestination: null,
85
+ numSlashingSpans: 0,
86
+ }),
87
+ expectedStatus: {
88
+ amount: new BigNumber("100000000"),
89
+ errors: {
90
+ recipient: new InvalidAddressBecauseDestinationIsAlsoSource(),
91
+ },
92
+ warnings: {},
93
+ },
52
94
  },
53
- ],
54
- accounts: [
55
95
  {
56
- // Account which is stash and controller
57
- raw: {
58
- id: `js:2:polkadot:${ACCOUNT_SAME_STASHCONTROLLER}:polkadotbip44`,
59
- seedIdentifier: ACCOUNT_SAME_STASHCONTROLLER,
60
- name: "Polkadot 1",
61
- derivationMode: "polkadotbip44",
62
- index: 0,
63
- freshAddress: ACCOUNT_SAME_STASHCONTROLLER,
64
- freshAddressPath: "44'/354'/0'/0'/0'",
65
- freshAddresses: [],
66
- blockHeight: 0,
67
- operations: [],
68
- pendingOperations: [],
69
- currencyId: "polkadot",
70
- unitMagnitude: 10,
71
- lastSyncDate: "",
72
- balance: "21000310",
96
+ name: "Not a valid address",
97
+ transaction: fromTransactionRaw({
98
+ family: "polkadot",
99
+ recipient: "ewrererewrew",
100
+ amount: "100000000",
101
+ mode: "send",
102
+ era: null,
103
+ validators: [],
104
+ fees: null,
105
+ rewardDestination: null,
106
+ numSlashingSpans: 0,
107
+ }),
108
+ expectedStatus: {
109
+ errors: {
110
+ recipient: new InvalidAddress(),
111
+ },
112
+ warnings: {},
73
113
  },
74
- transactions: [
75
- {
76
- name: "recipient and sender must not be the same",
77
- transaction: fromTransactionRaw({
78
- family: "polkadot",
79
- recipient: ACCOUNT_SAME_STASHCONTROLLER,
80
- amount: "100000000",
81
- mode: "send",
82
- era: null,
83
- validators: [],
84
- fees: null,
85
- rewardDestination: null,
86
- numSlashingSpans: 0,
87
- }),
88
- expectedStatus: {
89
- amount: new BigNumber("100000000"),
90
- errors: {
91
- recipient: new InvalidAddressBecauseDestinationIsAlsoSource(),
92
- },
93
- warnings: {},
94
- },
114
+ },
115
+ {
116
+ name: "Amount Required",
117
+ transaction: fromTransactionRaw({
118
+ family: "polkadot",
119
+ recipient: ACCOUNT_CONTROLLER,
120
+ amount: "0",
121
+ mode: "send",
122
+ era: null,
123
+ validators: [],
124
+ fees: null,
125
+ rewardDestination: null,
126
+ numSlashingSpans: 0,
127
+ }),
128
+ expectedStatus: {
129
+ errors: {
130
+ amount: new AmountRequired(),
95
131
  },
96
- {
97
- name: "Not a valid address",
98
- transaction: fromTransactionRaw({
99
- family: "polkadot",
100
- recipient: "ewrererewrew",
101
- amount: "100000000",
102
- mode: "send",
103
- era: null,
104
- validators: [],
105
- fees: null,
106
- rewardDestination: null,
107
- numSlashingSpans: 0,
108
- }),
109
- expectedStatus: {
110
- errors: {
111
- recipient: new InvalidAddress(),
112
- },
113
- warnings: {},
114
- },
132
+ warnings: {},
133
+ },
134
+ },
135
+ {
136
+ name: "Not enough balance",
137
+ transaction: fromTransactionRaw({
138
+ family: "polkadot",
139
+ recipient: ACCOUNT_CONTROLLER,
140
+ amount: "1000000000000000",
141
+ mode: "send",
142
+ era: null,
143
+ validators: [],
144
+ fees: null,
145
+ rewardDestination: null,
146
+ numSlashingSpans: 0,
147
+ }),
148
+ expectedStatus: {
149
+ errors: {
150
+ amount: new NotEnoughBalance(),
115
151
  },
116
- {
117
- name: "Amount Required",
118
- transaction: fromTransactionRaw({
119
- family: "polkadot",
120
- recipient: ACCOUNT_CONTROLLER,
121
- amount: "0",
122
- mode: "send",
123
- era: null,
124
- validators: [],
125
- fees: null,
126
- rewardDestination: null,
127
- numSlashingSpans: 0,
128
- }),
129
- expectedStatus: {
130
- errors: {
131
- amount: new AmountRequired(),
132
- },
133
- warnings: {},
134
- },
152
+ warnings: {},
153
+ },
154
+ },
155
+ {
156
+ name: "Not created account and deposit not existing",
157
+ transaction: fromTransactionRaw({
158
+ family: "polkadot",
159
+ recipient: ACCOUNT_WITH_NO_OPERATION,
160
+ amount: "1000000",
161
+ mode: "send",
162
+ era: null,
163
+ validators: [],
164
+ fees: null,
165
+ rewardDestination: null,
166
+ numSlashingSpans: 0,
167
+ }),
168
+ expectedStatus: {
169
+ errors: {
170
+ amount: new NotEnoughBalanceBecauseDestinationNotCreated(),
135
171
  },
136
- {
137
- name: "Not enough balance",
138
- transaction: fromTransactionRaw({
139
- family: "polkadot",
140
- recipient: ACCOUNT_CONTROLLER,
141
- amount: "1000000000000000",
142
- mode: "send",
143
- era: null,
144
- validators: [],
145
- fees: null,
146
- rewardDestination: null,
147
- numSlashingSpans: 0,
148
- }),
149
- expectedStatus: {
150
- errors: {
151
- amount: new NotEnoughBalance(),
152
- },
153
- warnings: {},
154
- },
172
+ warnings: {},
173
+ },
174
+ },
175
+ {
176
+ name: "New account and suffisent deposit",
177
+ transaction: fromTransactionRaw({
178
+ family: "polkadot",
179
+ recipient: ACCOUNT_WITH_NO_OPERATION,
180
+ amount: "10000000000",
181
+ mode: "send",
182
+ era: null,
183
+ validators: [],
184
+ fees: null,
185
+ rewardDestination: null,
186
+ numSlashingSpans: 0,
187
+ }),
188
+ expectedStatus: {
189
+ amount: new BigNumber("10000000000"),
190
+ errors: {},
191
+ warnings: {},
192
+ },
193
+ },
194
+ {
195
+ name: "[send] use all amount - should warn all funds",
196
+ transaction: (t) => ({
197
+ ...t,
198
+ useAllAmount: true,
199
+ mode: "send",
200
+ recipient: ACCOUNT_EMPTY,
201
+ }),
202
+ expectedStatus: (account) => ({
203
+ errors: {},
204
+ warnings: {
205
+ amount: new PolkadotAllFundsWarning(),
155
206
  },
156
- {
157
- name: "Not created account and deposit not existing",
158
- transaction: fromTransactionRaw({
159
- family: "polkadot",
160
- recipient: ACCOUNT_WITH_NO_OPERATION,
161
- amount: "1000000",
162
- mode: "send",
163
- era: null,
164
- validators: [],
165
- fees: null,
166
- rewardDestination: null,
167
- numSlashingSpans: 0,
168
- }),
169
- expectedStatus: {
170
- errors: {
171
- amount: new NotEnoughBalanceBecauseDestinationNotCreated(),
172
- },
173
- warnings: {},
174
- },
207
+ totalSpent: account.spendableBalance,
208
+ }),
209
+ },
210
+ {
211
+ name: "nominate without true validator",
212
+ transaction: fromTransactionRaw({
213
+ family: "polkadot",
214
+ recipient: ACCOUNT_SAME_STASHCONTROLLER,
215
+ amount: "0",
216
+ mode: "nominate",
217
+ era: null,
218
+ validators: [ACCOUNT_SAME_STASHCONTROLLER],
219
+ fees: null,
220
+ rewardDestination: null,
221
+ numSlashingSpans: 0,
222
+ }),
223
+ expectedStatus: {
224
+ errors: {
225
+ staking: new PolkadotNotValidator(),
175
226
  },
176
- {
177
- name: "New account and suffisent deposit",
178
- transaction: fromTransactionRaw({
179
- family: "polkadot",
180
- recipient: ACCOUNT_WITH_NO_OPERATION,
181
- amount: "10000000000",
182
- mode: "send",
183
- era: null,
184
- validators: [],
185
- fees: null,
186
- rewardDestination: null,
187
- numSlashingSpans: 0,
188
- }),
189
- expectedStatus: {
190
- amount: new BigNumber("10000000000"),
191
- errors: {},
192
- warnings: {},
193
- },
227
+ warnings: {},
228
+ },
229
+ },
230
+ {
231
+ name: "nominate is empty",
232
+ transaction: fromTransactionRaw({
233
+ family: "polkadot",
234
+ recipient: ACCOUNT_SAME_STASHCONTROLLER,
235
+ amount: "0",
236
+ mode: "nominate",
237
+ era: null,
238
+ validators: [],
239
+ fees: null,
240
+ rewardDestination: null,
241
+ numSlashingSpans: 0,
242
+ }),
243
+ expectedStatus: {
244
+ errors: {
245
+ staking: new PolkadotValidatorsRequired(),
194
246
  },
195
- {
196
- name: "[send] use all amount - should warn all funds",
197
- transaction: (t) => ({
198
- ...t,
199
- useAllAmount: true,
200
- mode: "send",
201
- recipient: ACCOUNT_EMPTY,
202
- }),
203
- expectedStatus: (account) => ({
204
- errors: {},
205
- warnings: {
206
- amount: new PolkadotAllFundsWarning(),
207
- },
208
- totalSpent: account.spendableBalance,
209
- }),
247
+ warnings: {},
248
+ },
249
+ },
250
+ {
251
+ name: "bond extra - not enough spendable",
252
+ transaction: fromTransactionRaw({
253
+ family: "polkadot",
254
+ recipient: ACCOUNT_SAME_STASHCONTROLLER,
255
+ amount: "2000000000000000000",
256
+ mode: "bond",
257
+ era: null,
258
+ validators: null,
259
+ fees: null,
260
+ rewardDestination: null,
261
+ numSlashingSpans: 0,
262
+ }),
263
+ expectedStatus: {
264
+ errors: {
265
+ amount: new NotEnoughBalance(),
210
266
  },
211
- {
212
- name: "nominate without true validator",
213
- transaction: fromTransactionRaw({
214
- family: "polkadot",
215
- recipient: ACCOUNT_SAME_STASHCONTROLLER,
216
- amount: "0",
217
- mode: "nominate",
218
- era: null,
219
- validators: [ACCOUNT_SAME_STASHCONTROLLER],
220
- fees: null,
221
- rewardDestination: null,
222
- numSlashingSpans: 0,
223
- }),
224
- expectedStatus: {
225
- errors: {
226
- staking: new PolkadotNotValidator(),
227
- },
228
- warnings: {},
229
- },
267
+ warnings: {},
268
+ },
269
+ },
270
+ {
271
+ name: "[Bond] New controller and suffisent deposit",
272
+ transaction: fromTransactionRaw({
273
+ family: "polkadot",
274
+ recipient: ACCOUNT_EMPTY,
275
+ amount: "10000000000",
276
+ mode: "bond",
277
+ era: null,
278
+ validators: [],
279
+ fees: null,
280
+ rewardDestination: null,
281
+ numSlashingSpans: 0,
282
+ }),
283
+ expectedStatus: {
284
+ amount: new BigNumber("10000000000"),
285
+ errors: {},
286
+ warnings: {},
287
+ },
288
+ },
289
+ {
290
+ name: "[unbond] no amount",
291
+ transaction: fromTransactionRaw({
292
+ family: "polkadot",
293
+ recipient: "",
294
+ amount: "0",
295
+ mode: "unbond",
296
+ era: null,
297
+ validators: [],
298
+ fees: null,
299
+ rewardDestination: null,
300
+ numSlashingSpans: 0,
301
+ }),
302
+ expectedStatus: {
303
+ errors: {
304
+ amount: new AmountRequired(),
230
305
  },
231
- {
232
- name: "nominate is empty",
233
- transaction: fromTransactionRaw({
234
- family: "polkadot",
235
- recipient: ACCOUNT_SAME_STASHCONTROLLER,
236
- amount: "0",
237
- mode: "nominate",
238
- era: null,
239
- validators: [],
240
- fees: null,
241
- rewardDestination: null,
242
- numSlashingSpans: 0,
243
- }),
244
- expectedStatus: {
245
- errors: {
246
- staking: new PolkadotValidatorsRequired(),
247
- },
248
- warnings: {},
249
- },
306
+ warnings: {},
307
+ },
308
+ },
309
+ {
310
+ name: "[unbond] not enough locked balance",
311
+ transaction: fromTransactionRaw({
312
+ family: "polkadot",
313
+ recipient: "",
314
+ amount: "2000000000000000",
315
+ mode: "unbond",
316
+ era: null,
317
+ validators: [],
318
+ fees: null,
319
+ rewardDestination: null,
320
+ numSlashingSpans: 0,
321
+ }),
322
+ expectedStatus: {
323
+ errors: {
324
+ amount: new NotEnoughBalance(),
250
325
  },
251
- {
252
- name: "bond extra - not enough spendable",
253
- transaction: fromTransactionRaw({
254
- family: "polkadot",
255
- recipient: ACCOUNT_SAME_STASHCONTROLLER,
256
- amount: "2000000000000000000",
257
- mode: "bond",
258
- era: null,
259
- validators: null,
260
- fees: null,
261
- rewardDestination: null,
262
- numSlashingSpans: 0,
263
- }),
264
- expectedStatus: {
265
- errors: {
266
- amount: new NotEnoughBalance(),
267
- },
268
- warnings: {},
269
- },
326
+ warnings: {},
327
+ },
328
+ },
329
+ {
330
+ name: "[rebond] no amount",
331
+ transaction: fromTransactionRaw({
332
+ family: "polkadot",
333
+ recipient: "",
334
+ amount: "0",
335
+ mode: "rebond",
336
+ era: null,
337
+ validators: [],
338
+ fees: null,
339
+ rewardDestination: null,
340
+ numSlashingSpans: 0,
341
+ }),
342
+ expectedStatus: {
343
+ errors: {
344
+ amount: new AmountRequired(),
270
345
  },
271
- {
272
- name: "[Bond] New controller and suffisent deposit",
273
- transaction: fromTransactionRaw({
274
- family: "polkadot",
275
- recipient: ACCOUNT_EMPTY,
276
- amount: "10000000000",
277
- mode: "bond",
278
- era: null,
279
- validators: [],
280
- fees: null,
281
- rewardDestination: null,
282
- numSlashingSpans: 0,
283
- }),
284
- expectedStatus: {
285
- amount: new BigNumber("10000000000"),
286
- errors: {},
287
- warnings: {},
288
- },
346
+ warnings: {},
347
+ },
348
+ },
349
+ {
350
+ name: "[unbond] use all amount",
351
+ transaction: (t) => ({
352
+ ...t,
353
+ useAllAmount: true,
354
+ mode: "unbond",
355
+ }),
356
+ expectedStatus: (a) => ({
357
+ errors: {},
358
+ warnings: {},
359
+ amount: a.polkadotResources?.lockedBalance.minus(
360
+ a.polkadotResources.unlockingBalance
361
+ ),
362
+ }),
363
+ },
364
+ {
365
+ name: "[rebond] use all amount",
366
+ transaction: (t) => ({
367
+ ...t,
368
+ useAllAmount: true,
369
+ mode: "rebond",
370
+ }),
371
+ expectedStatus: (a) => ({
372
+ errors: {},
373
+ warnings: {},
374
+ amount: a.polkadotResources?.unlockingBalance,
375
+ }),
376
+ },
377
+ ],
378
+ },
379
+ {
380
+ raw: {
381
+ id: `js:2:polkadot:${ACCOUNT_STASH}:polkadotbip44`,
382
+ seedIdentifier: ACCOUNT_STASH,
383
+ name: "Polkadot 2",
384
+ derivationMode: "polkadotbip44",
385
+ index: 0,
386
+ freshAddress: ACCOUNT_STASH,
387
+ freshAddressPath: "44'/354'/2'/0'/0'",
388
+ freshAddresses: [],
389
+ blockHeight: 0,
390
+ operations: [],
391
+ pendingOperations: [],
392
+ currencyId: "polkadot",
393
+ unitMagnitude: 10,
394
+ lastSyncDate: "",
395
+ balance: "11000000000",
396
+ },
397
+ transactions: [
398
+ {
399
+ name: "stash can't nominate",
400
+ transaction: fromTransactionRaw({
401
+ family: "polkadot",
402
+ recipient: ACCOUNT_SAME_STASHCONTROLLER,
403
+ amount: "0",
404
+ mode: "nominate",
405
+ era: null,
406
+ validators: [ACCOUNT_SAME_STASHCONTROLLER],
407
+ fees: null,
408
+ rewardDestination: null,
409
+ numSlashingSpans: 0,
410
+ }),
411
+ expectedStatus: {
412
+ errors: {
413
+ staking: new PolkadotUnauthorizedOperation(),
289
414
  },
290
- {
291
- name: "[unbond] no amount",
292
- transaction: fromTransactionRaw({
293
- family: "polkadot",
294
- recipient: "",
295
- amount: "0",
296
- mode: "unbond",
297
- era: null,
298
- validators: [],
299
- fees: null,
300
- rewardDestination: null,
301
- numSlashingSpans: 0,
302
- }),
303
- expectedStatus: {
304
- errors: {
305
- amount: new AmountRequired(),
306
- },
307
- warnings: {},
308
- },
415
+ warnings: {},
416
+ },
417
+ },
418
+ {
419
+ name: "[chill] unauthorized",
420
+ transaction: fromTransactionRaw({
421
+ family: "polkadot",
422
+ recipient: "",
423
+ amount: "1000",
424
+ mode: "chill",
425
+ era: null,
426
+ validators: [],
427
+ fees: null,
428
+ rewardDestination: null,
429
+ numSlashingSpans: 0,
430
+ }),
431
+ expectedStatus: {
432
+ errors: {
433
+ staking: new PolkadotUnauthorizedOperation(),
309
434
  },
310
- {
311
- name: "[unbond] not enough locked balance",
312
- transaction: fromTransactionRaw({
313
- family: "polkadot",
314
- recipient: "",
315
- amount: "2000000000000000",
316
- mode: "unbond",
317
- era: null,
318
- validators: [],
319
- fees: null,
320
- rewardDestination: null,
321
- numSlashingSpans: 0,
322
- }),
323
- expectedStatus: {
324
- errors: {
325
- amount: new NotEnoughBalance(),
326
- },
327
- warnings: {},
328
- },
435
+ warnings: {},
436
+ },
437
+ },
438
+ {
439
+ name: "[rebond] unauthorized",
440
+ transaction: fromTransactionRaw({
441
+ family: "polkadot",
442
+ recipient: "",
443
+ amount: "1000",
444
+ mode: "rebond",
445
+ era: null,
446
+ validators: [],
447
+ fees: null,
448
+ rewardDestination: null,
449
+ numSlashingSpans: 0,
450
+ }),
451
+ expectedStatus: {
452
+ errors: {
453
+ staking: new PolkadotUnauthorizedOperation(),
329
454
  },
330
- {
331
- name: "[rebond] no amount",
332
- transaction: fromTransactionRaw({
333
- family: "polkadot",
334
- recipient: "",
335
- amount: "0",
336
- mode: "rebond",
337
- era: null,
338
- validators: [],
339
- fees: null,
340
- rewardDestination: null,
341
- numSlashingSpans: 0,
342
- }),
343
- expectedStatus: {
344
- errors: {
345
- amount: new AmountRequired(),
346
- },
347
- warnings: {},
348
- },
455
+ warnings: {},
456
+ },
457
+ },
458
+ {
459
+ name: "[withdrawUnbonded] unauthorized",
460
+ transaction: fromTransactionRaw({
461
+ family: "polkadot",
462
+ recipient: "",
463
+ amount: "1000",
464
+ mode: "withdrawUnbonded",
465
+ era: null,
466
+ validators: [],
467
+ fees: null,
468
+ rewardDestination: null,
469
+ numSlashingSpans: 0,
470
+ }),
471
+ expectedStatus: {
472
+ errors: {
473
+ staking: new PolkadotUnauthorizedOperation(),
349
474
  },
350
- {
351
- name: "[unbond] use all amount",
352
- transaction: (t) => ({
353
- ...t,
354
- useAllAmount: true,
355
- mode: "unbond",
356
- }),
357
- expectedStatus: (a) => ({
358
- errors: {},
359
- warnings: {},
360
- amount: a.polkadotResources?.lockedBalance.minus(
361
- a.polkadotResources.unlockingBalance
362
- ),
363
- }),
475
+ warnings: {},
476
+ },
477
+ },
478
+ ],
479
+ },
480
+ // TODO: Write a setController test
481
+ {
482
+ raw: {
483
+ id: `js:2:polkadot:${ACCOUNT_CONTROLLER}:polkadotbip44`,
484
+ seedIdentifier: ACCOUNT_CONTROLLER,
485
+ name: "Polkadot 3",
486
+ derivationMode: "polkadotbip44",
487
+ index: 0,
488
+ freshAddress: ACCOUNT_CONTROLLER,
489
+ freshAddressPath: "44'/354'/3'/0'/0'",
490
+ freshAddresses: [],
491
+ blockHeight: 0,
492
+ operations: [],
493
+ pendingOperations: [],
494
+ currencyId: "polkadot",
495
+ unitMagnitude: 10,
496
+ lastSyncDate: "",
497
+ balance: "11000000000",
498
+ },
499
+ transactions: [
500
+ {
501
+ name: "[send] Not enough balance",
502
+ transaction: fromTransactionRaw({
503
+ family: "polkadot",
504
+ recipient: ACCOUNT_SAME_STASHCONTROLLER,
505
+ amount: "12000000000",
506
+ mode: "send",
507
+ era: null,
508
+ validators: [],
509
+ fees: null,
510
+ rewardDestination: null,
511
+ numSlashingSpans: 0,
512
+ }),
513
+ expectedStatus: {
514
+ errors: {
515
+ amount: new NotEnoughBalance(),
364
516
  },
365
- {
366
- name: "[rebond] use all amount",
367
- transaction: (t) => ({
368
- ...t,
369
- useAllAmount: true,
370
- mode: "rebond",
371
- }),
372
- expectedStatus: (a) => ({
373
- errors: {},
374
- warnings: {},
375
- amount: a.polkadotResources?.unlockingBalance,
376
- }),
517
+ warnings: {},
518
+ },
519
+ },
520
+ {
521
+ name: "[send] Do Max Send Instead error",
522
+ transaction: fromTransactionRaw({
523
+ family: "polkadot",
524
+ recipient: ACCOUNT_SAME_STASHCONTROLLER,
525
+ amount: "5000000000",
526
+ mode: "send",
527
+ era: null,
528
+ validators: [],
529
+ fees: null,
530
+ rewardDestination: null,
531
+ numSlashingSpans: 0,
532
+ }),
533
+ expectedStatus: {
534
+ errors: {
535
+ amount: new PolkadotDoMaxSendInstead(),
377
536
  },
378
- ],
537
+ warnings: {},
538
+ },
379
539
  },
380
540
  {
381
- raw: {
382
- id: `js:2:polkadot:${ACCOUNT_STASH}:polkadotbip44`,
383
- seedIdentifier: ACCOUNT_STASH,
384
- name: "Polkadot 2",
385
- derivationMode: "polkadotbip44",
386
- index: 0,
387
- freshAddress: ACCOUNT_STASH,
388
- freshAddressPath: "44'/354'/2'/0'/0'",
389
- freshAddresses: [],
390
- blockHeight: 0,
391
- operations: [],
392
- pendingOperations: [],
393
- currencyId: "polkadot",
394
- unitMagnitude: 10,
395
- lastSyncDate: "",
396
- balance: "11000000000",
541
+ name: "[send] use all amount no warn",
542
+ transaction: fromTransactionRaw({
543
+ family: "polkadot",
544
+ recipient: ACCOUNT_SAME_STASHCONTROLLER,
545
+ amount: "0",
546
+ useAllAmount: true,
547
+ mode: "send",
548
+ era: null,
549
+ validators: [],
550
+ fees: null,
551
+ rewardDestination: null,
552
+ numSlashingSpans: 0,
553
+ }),
554
+ expectedStatus: {
555
+ errors: {},
556
+ warnings: {},
397
557
  },
398
- transactions: [
399
- {
400
- name: "stash can't nominate",
401
- transaction: fromTransactionRaw({
402
- family: "polkadot",
403
- recipient: ACCOUNT_SAME_STASHCONTROLLER,
404
- amount: "0",
405
- mode: "nominate",
406
- era: null,
407
- validators: [ACCOUNT_SAME_STASHCONTROLLER],
408
- fees: null,
409
- rewardDestination: null,
410
- numSlashingSpans: 0,
411
- }),
412
- expectedStatus: {
413
- errors: {
414
- staking: new PolkadotUnauthorizedOperation(),
415
- },
416
- warnings: {},
417
- },
558
+ },
559
+ {
560
+ name: "[bond] no recipient",
561
+ transaction: fromTransactionRaw({
562
+ family: "polkadot",
563
+ recipient: "",
564
+ amount: "0",
565
+ mode: "bond",
566
+ era: null,
567
+ validators: [],
568
+ fees: null,
569
+ rewardDestination: null,
570
+ numSlashingSpans: 0,
571
+ }),
572
+ expectedStatus: {
573
+ errors: {
574
+ recipient: new RecipientRequired(),
418
575
  },
419
- {
420
- name: "[chill] unauthorized",
421
- transaction: fromTransactionRaw({
422
- family: "polkadot",
423
- recipient: "",
424
- amount: "1000",
425
- mode: "chill",
426
- era: null,
427
- validators: [],
428
- fees: null,
429
- rewardDestination: null,
430
- numSlashingSpans: 0,
431
- }),
432
- expectedStatus: {
433
- errors: {
434
- staking: new PolkadotUnauthorizedOperation(),
435
- },
436
- warnings: {},
437
- },
576
+ warnings: {},
577
+ },
578
+ },
579
+ {
580
+ name: "[bond] recipient with invalid address",
581
+ transaction: fromTransactionRaw({
582
+ family: "polkadot",
583
+ recipient: "not a valid address",
584
+ amount: "0",
585
+ mode: "bond",
586
+ era: null,
587
+ validators: [],
588
+ fees: null,
589
+ rewardDestination: null,
590
+ numSlashingSpans: 0,
591
+ }),
592
+ expectedStatus: {
593
+ errors: {
594
+ recipient: new InvalidAddress(),
438
595
  },
439
- {
440
- name: "[rebond] unauthorized",
441
- transaction: fromTransactionRaw({
442
- family: "polkadot",
443
- recipient: "",
444
- amount: "1000",
445
- mode: "rebond",
446
- era: null,
447
- validators: [],
448
- fees: null,
449
- rewardDestination: null,
450
- numSlashingSpans: 0,
451
- }),
452
- expectedStatus: {
453
- errors: {
454
- staking: new PolkadotUnauthorizedOperation(),
455
- },
456
- warnings: {},
457
- },
596
+ warnings: {},
597
+ },
598
+ },
599
+ {
600
+ name: "[bond] is already controller",
601
+ transaction: fromTransactionRaw({
602
+ family: "polkadot",
603
+ recipient: ACCOUNT_CONTROLLER,
604
+ amount: "100000000",
605
+ mode: "bond",
606
+ era: null,
607
+ validators: [],
608
+ fees: null,
609
+ rewardDestination: null,
610
+ numSlashingSpans: 0,
611
+ }),
612
+ expectedStatus: {
613
+ errors: {
614
+ recipient: new PolkadotUnauthorizedOperation(
615
+ "Recipient is already a controller"
616
+ ),
458
617
  },
459
- {
460
- name: "[withdrawUnbonded] unauthorized",
461
- transaction: fromTransactionRaw({
462
- family: "polkadot",
463
- recipient: "",
464
- amount: "1000",
465
- mode: "withdrawUnbonded",
466
- era: null,
467
- validators: [],
468
- fees: null,
469
- rewardDestination: null,
470
- numSlashingSpans: 0,
471
- }),
472
- expectedStatus: {
473
- errors: {
474
- staking: new PolkadotUnauthorizedOperation(),
475
- },
476
- warnings: {},
477
- },
618
+ warnings: {},
619
+ },
620
+ },
621
+ {
622
+ name: "[bond] not minimum amount",
623
+ transaction: fromTransactionRaw({
624
+ family: "polkadot",
625
+ recipient: ACCOUNT_CONTROLLER,
626
+ amount: "1000000",
627
+ mode: "bond",
628
+ era: null,
629
+ validators: [],
630
+ fees: null,
631
+ rewardDestination: null,
632
+ numSlashingSpans: 0,
633
+ }),
634
+ expectedStatus: {
635
+ errors: {
636
+ amount: new PolkadotBondMinimumAmount(),
478
637
  },
479
- ],
638
+ warnings: {},
639
+ },
480
640
  },
481
- // TODO: Write a setController test
482
641
  {
483
- raw: {
484
- id: `js:2:polkadot:${ACCOUNT_CONTROLLER}:polkadotbip44`,
485
- seedIdentifier: ACCOUNT_CONTROLLER,
486
- name: "Polkadot 3",
487
- derivationMode: "polkadotbip44",
488
- index: 0,
489
- freshAddress: ACCOUNT_CONTROLLER,
490
- freshAddressPath: "44'/354'/3'/0'/0'",
491
- freshAddresses: [],
492
- blockHeight: 0,
493
- operations: [],
494
- pendingOperations: [],
495
- currencyId: "polkadot",
496
- unitMagnitude: 10,
497
- lastSyncDate: "",
498
- balance: "11000000000",
642
+ name: "[bond] success",
643
+ transaction: fromTransactionRaw({
644
+ family: "polkadot",
645
+ recipient: ACCOUNT_CONTROLLER,
646
+ amount: "10000000000",
647
+ mode: "bond",
648
+ era: null,
649
+ validators: [],
650
+ fees: null,
651
+ rewardDestination: null,
652
+ numSlashingSpans: 0,
653
+ }),
654
+ expectedStatus: {
655
+ errors: {},
656
+ warnings: {},
499
657
  },
500
- transactions: [
501
- {
502
- name: "[send] Not enough balance",
503
- transaction: fromTransactionRaw({
504
- family: "polkadot",
505
- recipient: ACCOUNT_SAME_STASHCONTROLLER,
506
- amount: "12000000000",
507
- mode: "send",
508
- era: null,
509
- validators: [],
510
- fees: null,
511
- rewardDestination: null,
512
- numSlashingSpans: 0,
513
- }),
514
- expectedStatus: {
515
- errors: {
516
- amount: new NotEnoughBalance(),
517
- },
518
- warnings: {},
519
- },
520
- },
521
- {
522
- name: "[send] Do Max Send Instead error",
523
- transaction: fromTransactionRaw({
524
- family: "polkadot",
525
- recipient: ACCOUNT_SAME_STASHCONTROLLER,
526
- amount: "5000000000",
527
- mode: "send",
528
- era: null,
529
- validators: [],
530
- fees: null,
531
- rewardDestination: null,
532
- numSlashingSpans: 0,
533
- }),
534
- expectedStatus: {
535
- errors: {
536
- amount: new PolkadotDoMaxSendInstead(),
537
- },
538
- warnings: {},
539
- },
540
- },
541
- {
542
- name: "[send] use all amount no warn",
543
- transaction: fromTransactionRaw({
544
- family: "polkadot",
545
- recipient: ACCOUNT_SAME_STASHCONTROLLER,
546
- amount: "0",
547
- useAllAmount: true,
548
- mode: "send",
549
- era: null,
550
- validators: [],
551
- fees: null,
552
- rewardDestination: null,
553
- numSlashingSpans: 0,
554
- }),
555
- expectedStatus: {
556
- errors: {},
557
- warnings: {},
558
- },
559
- },
560
- {
561
- name: "[bond] no recipient",
562
- transaction: fromTransactionRaw({
563
- family: "polkadot",
564
- recipient: "",
565
- amount: "0",
566
- mode: "bond",
567
- era: null,
568
- validators: [],
569
- fees: null,
570
- rewardDestination: null,
571
- numSlashingSpans: 0,
572
- }),
573
- expectedStatus: {
574
- errors: {
575
- recipient: new RecipientRequired(),
576
- },
577
- warnings: {},
578
- },
579
- },
580
- {
581
- name: "[bond] recipient with invalid address",
582
- transaction: fromTransactionRaw({
583
- family: "polkadot",
584
- recipient: "not a valid address",
585
- amount: "0",
586
- mode: "bond",
587
- era: null,
588
- validators: [],
589
- fees: null,
590
- rewardDestination: null,
591
- numSlashingSpans: 0,
592
- }),
593
- expectedStatus: {
594
- errors: {
595
- recipient: new InvalidAddress(),
596
- },
597
- warnings: {},
598
- },
599
- },
600
- {
601
- name: "[bond] is already controller",
602
- transaction: fromTransactionRaw({
603
- family: "polkadot",
604
- recipient: ACCOUNT_CONTROLLER,
605
- amount: "100000000",
606
- mode: "bond",
607
- era: null,
608
- validators: [],
609
- fees: null,
610
- rewardDestination: null,
611
- numSlashingSpans: 0,
612
- }),
613
- expectedStatus: {
614
- errors: {
615
- recipient: new PolkadotUnauthorizedOperation(
616
- "Recipient is already a controller"
617
- ),
618
- },
619
- warnings: {},
620
- },
621
- },
622
- {
623
- name: "[bond] not minimum amount",
624
- transaction: fromTransactionRaw({
625
- family: "polkadot",
626
- recipient: ACCOUNT_CONTROLLER,
627
- amount: "1000000",
628
- mode: "bond",
629
- era: null,
630
- validators: [],
631
- fees: null,
632
- rewardDestination: null,
633
- numSlashingSpans: 0,
634
- }),
635
- expectedStatus: {
636
- errors: {
637
- amount: new PolkadotBondMinimumAmount(),
638
- },
639
- warnings: {},
640
- },
641
- },
642
- {
643
- name: "[bond] success",
644
- transaction: fromTransactionRaw({
645
- family: "polkadot",
646
- recipient: ACCOUNT_CONTROLLER,
647
- amount: "10000000000",
648
- mode: "bond",
649
- era: null,
650
- validators: [],
651
- fees: null,
652
- rewardDestination: null,
653
- numSlashingSpans: 0,
654
- }),
655
- expectedStatus: {
656
- errors: {},
657
- warnings: {},
658
- },
659
- },
660
- {
661
- name: "[unbond] haveEnoughLockedBalance",
662
- transaction: fromTransactionRaw({
663
- family: "polkadot",
664
- recipient: "",
665
- amount: "100000",
666
- mode: "unbond",
667
- era: null,
668
- validators: [],
669
- fees: null,
670
- rewardDestination: null,
671
- numSlashingSpans: 0,
672
- }),
673
- expectedStatus: {
674
- errors: {
675
- amount: new NotEnoughBalance(),
676
- staking: new PolkadotUnauthorizedOperation(),
677
- },
678
- warnings: {},
679
- },
658
+ },
659
+ {
660
+ name: "[unbond] haveEnoughLockedBalance",
661
+ transaction: fromTransactionRaw({
662
+ family: "polkadot",
663
+ recipient: "",
664
+ amount: "100000",
665
+ mode: "unbond",
666
+ era: null,
667
+ validators: [],
668
+ fees: null,
669
+ rewardDestination: null,
670
+ numSlashingSpans: 0,
671
+ }),
672
+ expectedStatus: {
673
+ errors: {
674
+ amount: new NotEnoughBalance(),
675
+ staking: new PolkadotUnauthorizedOperation(),
680
676
  },
681
- ],
677
+ warnings: {},
678
+ },
682
679
  },
683
680
  ],
684
681
  },
682
+ ],
683
+ };
684
+
685
+ const dataset: DatasetTest<Transaction> = {
686
+ implementations: ["js"],
687
+ currencies: {
688
+ // polkadot, // LL-7806
685
689
  },
686
690
  };
687
691
  export default dataset;