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