@ledgerhq/live-common 21.28.0 → 21.31.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (324) hide show
  1. package/lib/__tests__/families/bitcoin/wallet-btc/xpub.synced.unit.test.js +1 -1
  2. package/lib/__tests__/families/bitcoin/wallet-btc/xpub.synced.unit.test.js.map +1 -1
  3. package/lib/__tests__/test-helpers/bridge.js +1 -1
  4. package/lib/__tests__/test-helpers/bridge.js.map +1 -1
  5. package/lib/__tests__/test-helpers/setup.js +1 -0
  6. package/lib/__tests__/test-helpers/setup.js.map +1 -1
  7. package/lib/account/support.d.ts.map +1 -1
  8. package/lib/account/support.js.map +1 -1
  9. package/lib/apps/hw.d.ts.map +1 -1
  10. package/lib/apps/hw.js +8 -3
  11. package/lib/apps/hw.js.map +1 -1
  12. package/lib/bot/engine.js +1 -1
  13. package/lib/bot/engine.js.map +1 -1
  14. package/lib/bridge/jsHelpers.js +1 -1
  15. package/lib/data/icons/react/celo.d.ts +8 -0
  16. package/lib/data/icons/react/celo.d.ts.map +1 -0
  17. package/lib/data/icons/react/celo.js +32 -0
  18. package/lib/data/icons/react/celo.js.map +1 -0
  19. package/lib/data/icons/react/index.d.ts +1 -0
  20. package/lib/data/icons/react/index.d.ts.map +1 -1
  21. package/lib/data/icons/react/index.js +11 -8
  22. package/lib/data/icons/react/index.js.map +1 -1
  23. package/lib/data/icons/reactNative/celo.d.ts +8 -0
  24. package/lib/data/icons/reactNative/celo.d.ts.map +1 -0
  25. package/lib/data/icons/reactNative/celo.js +33 -0
  26. package/lib/data/icons/reactNative/celo.js.map +1 -0
  27. package/lib/data/icons/reactNative/index.d.ts +1 -0
  28. package/lib/data/icons/reactNative/index.d.ts.map +1 -1
  29. package/lib/data/icons/reactNative/index.js +11 -8
  30. package/lib/data/icons/reactNative/index.js.map +1 -1
  31. package/lib/env.d.ts +20 -5
  32. package/lib/env.d.ts.map +1 -1
  33. package/lib/env.js +15 -0
  34. package/lib/env.js.map +1 -1
  35. package/lib/env.react.d.ts +1 -1
  36. package/lib/env.react.d.ts.map +1 -1
  37. package/lib/exchange/swap/hooks/usePickDefaultAccount.d.ts.map +1 -1
  38. package/lib/exchange/swap/hooks/usePickDefaultAccount.js +4 -9
  39. package/lib/exchange/swap/hooks/usePickDefaultAccount.js.map +1 -1
  40. package/lib/exchange/swap/utils/index.d.ts +6 -1
  41. package/lib/exchange/swap/utils/index.d.ts.map +1 -1
  42. package/lib/exchange/swap/utils/index.js +8 -1
  43. package/lib/exchange/swap/utils/index.js.map +1 -1
  44. package/lib/exchange/swap/utils/index.test.js +27 -0
  45. package/lib/exchange/swap/utils/index.test.js.map +1 -1
  46. package/lib/families/bitcoin/wallet-btc/crypto/base.d.ts.map +1 -1
  47. package/lib/families/bitcoin/wallet-btc/crypto/base.js +19 -20
  48. package/lib/families/bitcoin/wallet-btc/crypto/base.js.map +1 -1
  49. package/lib/families/bitcoin/wallet-btc/crypto/bitcoin.d.ts.map +1 -1
  50. package/lib/families/bitcoin/wallet-btc/crypto/bitcoin.js +4 -5
  51. package/lib/families/bitcoin/wallet-btc/crypto/bitcoin.js.map +1 -1
  52. package/lib/families/bitcoin/wallet-btc/crypto/bitcoincash.d.ts.map +1 -1
  53. package/lib/families/bitcoin/wallet-btc/crypto/bitcoincash.js +3 -4
  54. package/lib/families/bitcoin/wallet-btc/crypto/bitcoincash.js.map +1 -1
  55. package/lib/families/bitcoin/wallet-btc/crypto/decred.d.ts.map +1 -1
  56. package/lib/families/bitcoin/wallet-btc/crypto/decred.js +3 -4
  57. package/lib/families/bitcoin/wallet-btc/crypto/decred.js.map +1 -1
  58. package/lib/families/bitcoin/wallet-btc/crypto/litecoin.d.ts.map +1 -1
  59. package/lib/families/bitcoin/wallet-btc/crypto/litecoin.js +3 -4
  60. package/lib/families/bitcoin/wallet-btc/crypto/litecoin.js.map +1 -1
  61. package/lib/families/bitcoin/wallet-btc/crypto/zec.d.ts.map +1 -1
  62. package/lib/families/bitcoin/wallet-btc/crypto/zec.js +3 -4
  63. package/lib/families/bitcoin/wallet-btc/crypto/zec.js.map +1 -1
  64. package/lib/families/bitcoin/wallet-btc/crypto/zen.d.ts.map +1 -1
  65. package/lib/families/bitcoin/wallet-btc/crypto/zen.js +3 -4
  66. package/lib/families/bitcoin/wallet-btc/crypto/zen.js.map +1 -1
  67. package/lib/families/bitcoin/wallet-btc/xpub.js +1 -1
  68. package/lib/families/bitcoin/wallet-btc/xpub.js.map +1 -1
  69. package/lib/families/celo/api/hubble.d.ts +8 -0
  70. package/lib/families/celo/api/hubble.d.ts.map +1 -0
  71. package/lib/families/celo/api/hubble.js +144 -0
  72. package/lib/families/celo/api/hubble.js.map +1 -0
  73. package/lib/families/celo/api/index.d.ts +2 -0
  74. package/lib/families/celo/api/index.d.ts.map +1 -0
  75. package/lib/families/celo/api/index.js +13 -0
  76. package/lib/families/celo/api/index.js.map +1 -0
  77. package/lib/families/celo/api/sdk.d.ts +3 -0
  78. package/lib/families/celo/api/sdk.d.ts.map +1 -0
  79. package/lib/families/celo/api/sdk.js +13 -0
  80. package/lib/families/celo/api/sdk.js.map +1 -0
  81. package/lib/families/celo/bridge/js.d.ts +8 -0
  82. package/lib/families/celo/bridge/js.d.ts.map +1 -0
  83. package/lib/families/celo/bridge/js.js +87 -0
  84. package/lib/families/celo/bridge/js.js.map +1 -0
  85. package/lib/families/celo/cli-transaction.d.ts +14 -0
  86. package/lib/families/celo/cli-transaction.d.ts.map +1 -0
  87. package/lib/families/celo/cli-transaction.js +37 -0
  88. package/lib/families/celo/cli-transaction.js.map +1 -0
  89. package/lib/families/celo/datasets/celo.scanAccounts.1.d.ts +5 -0
  90. package/lib/families/celo/datasets/celo.scanAccounts.1.d.ts.map +1 -0
  91. package/lib/families/celo/datasets/celo.scanAccounts.1.js +12 -0
  92. package/lib/families/celo/datasets/celo.scanAccounts.1.js.map +1 -0
  93. package/lib/families/celo/deviceTransactionConfig.d.ts +4 -0
  94. package/lib/families/celo/deviceTransactionConfig.d.ts.map +1 -0
  95. package/lib/families/celo/deviceTransactionConfig.js +16 -0
  96. package/lib/families/celo/deviceTransactionConfig.js.map +1 -0
  97. package/lib/families/celo/hw-app-celo.d.ts +19 -0
  98. package/lib/families/celo/hw-app-celo.d.ts.map +1 -0
  99. package/lib/families/celo/hw-app-celo.js +147 -0
  100. package/lib/families/celo/hw-app-celo.js.map +1 -0
  101. package/lib/families/celo/hw-getAddress.d.ts +2 -0
  102. package/lib/families/celo/hw-getAddress.d.ts.map +1 -0
  103. package/lib/families/celo/hw-getAddress.js +13 -0
  104. package/lib/families/celo/hw-getAddress.js.map +1 -0
  105. package/lib/families/celo/js-broadcast.d.ts +8 -0
  106. package/lib/families/celo/js-broadcast.d.ts.map +1 -0
  107. package/lib/families/celo/js-broadcast.js +58 -0
  108. package/lib/families/celo/js-broadcast.js.map +1 -0
  109. package/lib/families/celo/js-buildTransaction.d.ts +6 -0
  110. package/lib/families/celo/js-buildTransaction.d.ts.map +1 -0
  111. package/lib/families/celo/js-buildTransaction.js +89 -0
  112. package/lib/families/celo/js-buildTransaction.js.map +1 -0
  113. package/lib/families/celo/js-createTransaction.d.ts +4 -0
  114. package/lib/families/celo/js-createTransaction.d.ts.map +1 -0
  115. package/lib/families/celo/js-createTransaction.js +12 -0
  116. package/lib/families/celo/js-createTransaction.js.map +1 -0
  117. package/lib/families/celo/js-estimateMaxSpendable.d.ts +10 -0
  118. package/lib/families/celo/js-estimateMaxSpendable.d.ts.map +1 -0
  119. package/lib/families/celo/js-estimateMaxSpendable.js +77 -0
  120. package/lib/families/celo/js-estimateMaxSpendable.js.map +1 -0
  121. package/lib/families/celo/js-getFeesForTransaction.d.ts +8 -0
  122. package/lib/families/celo/js-getFeesForTransaction.d.ts.map +1 -0
  123. package/lib/families/celo/js-getFeesForTransaction.js +76 -0
  124. package/lib/families/celo/js-getFeesForTransaction.js.map +1 -0
  125. package/lib/families/celo/js-getTransactionStatus.d.ts +5 -0
  126. package/lib/families/celo/js-getTransactionStatus.d.ts.map +1 -0
  127. package/lib/families/celo/js-getTransactionStatus.js +86 -0
  128. package/lib/families/celo/js-getTransactionStatus.js.map +1 -0
  129. package/lib/families/celo/js-prepareTransaction.d.ts +5 -0
  130. package/lib/families/celo/js-prepareTransaction.d.ts.map +1 -0
  131. package/lib/families/celo/js-prepareTransaction.js +76 -0
  132. package/lib/families/celo/js-prepareTransaction.js.map +1 -0
  133. package/lib/families/celo/js-signOperation.d.ts +13 -0
  134. package/lib/families/celo/js-signOperation.d.ts.map +1 -0
  135. package/lib/families/celo/js-signOperation.js +150 -0
  136. package/lib/families/celo/js-signOperation.js.map +1 -0
  137. package/lib/families/celo/js-synchronisation.d.ts +10 -0
  138. package/lib/families/celo/js-synchronisation.d.ts.map +1 -0
  139. package/lib/families/celo/js-synchronisation.js +88 -0
  140. package/lib/families/celo/js-synchronisation.js.map +1 -0
  141. package/lib/families/celo/specs.d.ts +7 -0
  142. package/lib/families/celo/specs.d.ts.map +1 -0
  143. package/lib/families/celo/specs.js +56 -0
  144. package/lib/families/celo/specs.js.map +1 -0
  145. package/lib/families/celo/speculos-deviceActions.d.ts +7 -0
  146. package/lib/families/celo/speculos-deviceActions.d.ts.map +1 -0
  147. package/lib/families/celo/speculos-deviceActions.js +53 -0
  148. package/lib/families/celo/speculos-deviceActions.js.map +1 -0
  149. package/lib/families/celo/transaction.d.ts +11 -0
  150. package/lib/families/celo/transaction.d.ts.map +1 -0
  151. package/lib/families/celo/transaction.js +39 -0
  152. package/lib/families/celo/transaction.js.map +1 -0
  153. package/lib/families/celo/types.d.ts +16 -0
  154. package/lib/families/celo/types.d.ts.map +1 -0
  155. package/lib/families/celo/types.js +6 -0
  156. package/lib/families/celo/types.js.map +1 -0
  157. package/lib/families/ethereum/datasets/ethereum.scanAccounts.1.d.ts +1 -0
  158. package/lib/families/ethereum/datasets/ethereum.scanAccounts.1.d.ts.map +1 -1
  159. package/lib/families/ethereum/datasets/ethereum.scanAccounts.1.js +1 -0
  160. package/lib/families/ethereum/datasets/ethereum.scanAccounts.1.js.map +1 -1
  161. package/lib/families/ethereum/modules/erc1155.d.ts.map +1 -1
  162. package/lib/families/ethereum/modules/erc1155.js +8 -2
  163. package/lib/families/ethereum/modules/erc1155.js.map +1 -1
  164. package/lib/families/polkadot/cache.d.ts +1 -1
  165. package/lib/families/polkadot/cache.js +1 -1
  166. package/lib/families/solana/api/chain/index.d.ts +2 -2
  167. package/lib/families/solana/api/chain/index.d.ts.map +1 -1
  168. package/lib/families/solana/api/chain/index.js +4 -4
  169. package/lib/families/solana/api/chain/index.js.map +1 -1
  170. package/lib/families/solana/bridge/bridge.js +5 -5
  171. package/lib/families/solana/bridge/bridge.js.map +1 -1
  172. package/lib/families/solana/bridge/js.js +3 -3
  173. package/lib/families/solana/bridge/js.js.map +1 -1
  174. package/lib/families/solana/bridge/mock.js +1 -1
  175. package/lib/families/solana/bridge/mock.js.map +1 -1
  176. package/lib/families/solana/test-dataset.d.ts.map +1 -1
  177. package/lib/families/solana/test-dataset.js +211 -209
  178. package/lib/families/solana/test-dataset.js.map +1 -1
  179. package/lib/families/solana/utils.d.ts +1 -2
  180. package/lib/families/solana/utils.d.ts.map +1 -1
  181. package/lib/families/solana/utils.js +11 -9
  182. package/lib/families/solana/utils.js.map +1 -1
  183. package/lib/families/tezos/datasets/tezos.scanAccounts.1.js +1 -1
  184. package/lib/families/tezos/datasets/tezos.scanAccounts.1.js.map +1 -1
  185. package/lib/featureFlags/FeatureToggle.d.ts +10 -0
  186. package/lib/featureFlags/FeatureToggle.d.ts.map +1 -0
  187. package/lib/featureFlags/FeatureToggle.js +17 -0
  188. package/lib/featureFlags/FeatureToggle.js.map +1 -0
  189. package/lib/featureFlags/defaultFeatures.d.ts +3 -0
  190. package/lib/featureFlags/defaultFeatures.d.ts.map +1 -0
  191. package/lib/featureFlags/defaultFeatures.js +9 -0
  192. package/lib/featureFlags/defaultFeatures.js.map +1 -0
  193. package/lib/featureFlags/index.d.ts +5 -0
  194. package/lib/featureFlags/index.d.ts.map +1 -0
  195. package/lib/featureFlags/index.js +17 -0
  196. package/lib/featureFlags/index.js.map +1 -0
  197. package/lib/featureFlags/provider.d.ts +13 -0
  198. package/lib/featureFlags/provider.d.ts.map +1 -0
  199. package/lib/featureFlags/provider.js +68 -0
  200. package/lib/featureFlags/provider.js.map +1 -0
  201. package/lib/featureFlags/types.d.ts +8 -0
  202. package/lib/featureFlags/types.d.ts.map +1 -0
  203. package/lib/featureFlags/types.js +3 -0
  204. package/lib/featureFlags/types.js.map +1 -0
  205. package/lib/featureFlags/useFeature.d.ts +3 -0
  206. package/lib/featureFlags/useFeature.d.ts.map +1 -0
  207. package/lib/featureFlags/useFeature.js +9 -0
  208. package/lib/featureFlags/useFeature.js.map +1 -0
  209. package/lib/generated/bridge/js.d.ts +4 -0
  210. package/lib/generated/bridge/js.d.ts.map +1 -1
  211. package/lib/generated/bridge/js.js +24 -22
  212. package/lib/generated/bridge/js.js.map +1 -1
  213. package/lib/generated/cli-transaction.d.ts +9 -0
  214. package/lib/generated/cli-transaction.d.ts.map +1 -1
  215. package/lib/generated/cli-transaction.js +24 -22
  216. package/lib/generated/cli-transaction.js.map +1 -1
  217. package/lib/generated/deviceTransactionConfig.d.ts +2 -0
  218. package/lib/generated/deviceTransactionConfig.d.ts.map +1 -1
  219. package/lib/generated/deviceTransactionConfig.js +22 -20
  220. package/lib/generated/deviceTransactionConfig.js.map +1 -1
  221. package/lib/generated/hw-getAddress.d.ts +1 -0
  222. package/lib/generated/hw-getAddress.d.ts.map +1 -1
  223. package/lib/generated/hw-getAddress.js +26 -24
  224. package/lib/generated/hw-getAddress.js.map +1 -1
  225. package/lib/generated/specs.d.ts +3 -0
  226. package/lib/generated/specs.d.ts.map +1 -1
  227. package/lib/generated/specs.js +24 -22
  228. package/lib/generated/specs.js.map +1 -1
  229. package/lib/generated/speculos-deviceActions.d.ts +3 -0
  230. package/lib/generated/speculos-deviceActions.d.ts.map +1 -1
  231. package/lib/generated/speculos-deviceActions.js +24 -22
  232. package/lib/generated/speculos-deviceActions.js.map +1 -1
  233. package/lib/generated/transaction.d.ts +5 -0
  234. package/lib/generated/transaction.d.ts.map +1 -1
  235. package/lib/generated/transaction.js +26 -24
  236. package/lib/generated/transaction.js.map +1 -1
  237. package/lib/generated/types.d.ts +12 -6
  238. package/lib/generated/types.d.ts.map +1 -1
  239. package/lib/generated/types.js +14 -12
  240. package/lib/generated/types.js.map +1 -1
  241. package/lib/types/index.d.ts +1 -0
  242. package/lib/types/index.d.ts.map +1 -1
  243. package/lib/types/index.js +1 -0
  244. package/lib/types/index.js.map +1 -1
  245. package/lib/types/manager.d.ts +7 -0
  246. package/lib/types/manager.d.ts.map +1 -1
  247. package/lib/types/manager.js +7 -0
  248. package/lib/types/manager.js.map +1 -1
  249. package/package.json +12 -9
  250. package/src/.DS_Store +0 -0
  251. package/src/__tests__/.DS_Store +0 -0
  252. package/src/__tests__/__snapshots__/all.libcore.ts.snap +0 -33226
  253. package/src/__tests__/families/bitcoin/wallet-btc/xpub.synced.unit.test.ts +1 -1
  254. package/src/__tests__/test-helpers/bridge.ts +1 -1
  255. package/src/__tests__/test-helpers/setup.ts +1 -0
  256. package/src/account/support.ts +1 -0
  257. package/src/apps/hw.ts +7 -0
  258. package/src/bot/engine.ts +1 -1
  259. package/src/bridge/jsHelpers.ts +1 -1
  260. package/src/data/icons/react/celo.tsx +12 -0
  261. package/src/data/icons/react/index.tsx +1 -0
  262. package/src/data/icons/reactNative/celo.tsx +13 -0
  263. package/src/data/icons/reactNative/index.tsx +1 -0
  264. package/src/data/icons/svg/CELO.svg +5 -0
  265. package/src/env.ts +15 -0
  266. package/src/exchange/swap/hooks/usePickDefaultAccount.ts +4 -9
  267. package/src/exchange/swap/utils/index.test.ts +44 -1
  268. package/src/exchange/swap/utils/index.ts +12 -1
  269. package/src/families/bitcoin/wallet-btc/crypto/base.ts +41 -20
  270. package/src/families/bitcoin/wallet-btc/crypto/bitcoin.ts +12 -5
  271. package/src/families/bitcoin/wallet-btc/crypto/bitcoincash.ts +11 -4
  272. package/src/families/bitcoin/wallet-btc/crypto/decred.ts +11 -4
  273. package/src/families/bitcoin/wallet-btc/crypto/litecoin.ts +11 -4
  274. package/src/families/bitcoin/wallet-btc/crypto/zec.ts +11 -4
  275. package/src/families/bitcoin/wallet-btc/crypto/zen.ts +11 -4
  276. package/src/families/bitcoin/wallet-btc/xpub.ts +1 -1
  277. package/src/families/celo/api/hubble.ts +93 -0
  278. package/src/families/celo/api/index.ts +1 -0
  279. package/src/families/celo/api/sdk.ts +8 -0
  280. package/src/families/celo/bridge/js.ts +38 -0
  281. package/src/families/celo/cli-transaction.ts +41 -0
  282. package/src/families/celo/datasets/celo.scanAccounts.1.ts +20 -0
  283. package/src/families/celo/deviceTransactionConfig.ts +19 -0
  284. package/src/families/celo/hw-app-celo.ts +108 -0
  285. package/src/families/celo/hw-getAddress.ts +1 -0
  286. package/src/families/celo/js-broadcast.ts +12 -0
  287. package/src/families/celo/js-buildTransaction.ts +32 -0
  288. package/src/families/celo/js-createTransaction.ts +12 -0
  289. package/src/families/celo/js-estimateMaxSpendable.ts +28 -0
  290. package/src/families/celo/js-getFeesForTransaction.ts +38 -0
  291. package/src/families/celo/js-getTransactionStatus.ts +67 -0
  292. package/src/families/celo/js-prepareTransaction.ts +28 -0
  293. package/src/families/celo/js-signOperation.ts +149 -0
  294. package/src/families/celo/js-synchronisation.ts +40 -0
  295. package/src/families/celo/specs.ts +53 -0
  296. package/src/families/celo/speculos-deviceActions.ts +51 -0
  297. package/src/families/celo/transaction.ts +39 -0
  298. package/src/families/celo/types.ts +20 -0
  299. package/src/families/ethereum/datasets/ethereum.scanAccounts.1.ts +1 -0
  300. package/src/families/ethereum/modules/erc1155.ts +9 -0
  301. package/src/families/polkadot/cache.ts +1 -1
  302. package/src/families/solana/api/chain/index.ts +8 -7
  303. package/src/families/solana/bridge/bridge.ts +11 -11
  304. package/src/families/solana/bridge/js.ts +3 -3
  305. package/src/families/solana/bridge/mock.ts +1 -1
  306. package/src/families/solana/test-dataset.ts +340 -337
  307. package/src/families/solana/utils.ts +9 -8
  308. package/src/families/tezos/datasets/tezos.scanAccounts.1.ts +39 -39
  309. package/src/featureFlags/FeatureToggle.tsx +24 -0
  310. package/src/featureFlags/defaultFeatures.ts +7 -0
  311. package/src/featureFlags/index.ts +4 -0
  312. package/src/featureFlags/provider.tsx +48 -0
  313. package/src/featureFlags/types.ts +9 -0
  314. package/src/featureFlags/useFeature.ts +8 -0
  315. package/src/generated/bridge/js.ts +3 -0
  316. package/src/generated/cli-transaction.ts +3 -0
  317. package/src/generated/deviceTransactionConfig.ts +3 -0
  318. package/src/generated/hw-getAddress.ts +3 -0
  319. package/src/generated/specs.ts +3 -0
  320. package/src/generated/speculos-deviceActions.ts +3 -0
  321. package/src/generated/transaction.ts +3 -0
  322. package/src/generated/types.ts +14 -0
  323. package/src/types/index.ts +1 -0
  324. package/src/types/manager.ts +7 -0
@@ -75,367 +75,370 @@ const fees = (signatureCount: number) =>
75
75
 
76
76
  const zero = new BigNumber(0);
77
77
 
78
- const dataset: DatasetTest<Transaction> = {
79
- implementations: [getEnv("MOCK") ? "mock" : "js"],
80
- currencies: {
81
- solana: {
82
- scanAccounts: [scanAccounts1],
83
- accounts: [
78
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
79
+ const solana = {
80
+ scanAccounts: [scanAccounts1],
81
+ accounts: [
82
+ {
83
+ raw: makeAccount(testOnChainData.fundedSenderAddress),
84
+ /*
85
+ Solana integration is written in such a way that requires
86
+ prepareTransaction to be called before any meaningfull status
87
+ can be calculated. The general bridge tests do not run prepareTransaction
88
+ on all tests, so skip them in the general runner, but make alternatives for them.
89
+ */
90
+ FIXME_tests: [
91
+ "balance is sum of ops",
92
+ "Default empty recipient have a recipientError",
93
+ "invalid recipient have a recipientError",
94
+ "can be called on an empty transaction",
95
+ ],
96
+ transactions: [
97
+ ...recipientRequired(),
98
+ ...recipientNotValid(),
99
+ ...recipientIsSameAsSender(),
100
+ ...memoIsTooLong(),
84
101
  {
85
- raw: makeAccount(testOnChainData.fundedSenderAddress),
86
- /*
87
- Solana integration is written in such a way that requires
88
- prepareTransaction to be called before any meaningfull status
89
- can be calculated. The general bridge tests do not run prepareTransaction
90
- on all tests, so skip them in the general runner, but make alternatives for them.
91
- */
92
- FIXME_tests: [
93
- "balance is sum of ops",
94
- "Default empty recipient have a recipientError",
95
- "invalid recipient have a recipientError",
96
- "can be called on an empty transaction",
97
- ],
98
- transactions: [
99
- ...recipientRequired(),
100
- ...recipientNotValid(),
101
- ...recipientIsSameAsSender(),
102
- ...memoIsTooLong(),
103
- {
104
- name: "status is error: called on an empty transaction",
105
- transaction: createTransaction({} as any),
106
- expectedStatus: {
107
- errors: {
108
- recipient: new RecipientRequired(),
109
- },
110
- warnings: {},
111
- estimatedFees: fees(1),
112
- amount: zero,
113
- totalSpent: fees(1),
114
- },
102
+ name: "status is error: called on an empty transaction",
103
+ transaction: createTransaction({} as any),
104
+ expectedStatus: {
105
+ errors: {
106
+ recipient: new RecipientRequired(),
115
107
  },
116
- {
117
- name: "transfer :: status is success: not all amount",
118
- transaction: {
119
- model: {
120
- kind: "transfer",
121
- uiState: {},
122
- },
123
- amount: testOnChainData.fundedSenderBalance.dividedBy(2),
124
- recipient: testOnChainData.fundedAddress,
125
- feeCalculator: testOnChainData.feeCalculator,
126
- family: "solana",
127
- },
128
- expectedStatus: {
129
- errors: {},
130
- warnings: {},
131
- estimatedFees: fees(1),
132
- amount: testOnChainData.fundedSenderBalance.dividedBy(2),
133
- totalSpent: testOnChainData.fundedSenderBalance
134
- .dividedBy(2)
135
- .plus(fees(1)),
136
- },
108
+ warnings: {},
109
+ estimatedFees: fees(1),
110
+ amount: zero,
111
+ totalSpent: fees(1),
112
+ },
113
+ },
114
+ {
115
+ name: "transfer :: status is success: not all amount",
116
+ transaction: {
117
+ model: {
118
+ kind: "transfer",
119
+ uiState: {},
137
120
  },
138
- {
139
- name: "transfer :: status is success: all amount",
140
- transaction: {
141
- model: {
142
- kind: "transfer",
143
- uiState: {},
144
- },
145
- useAllAmount: true,
146
- amount: zero,
147
- recipient: testOnChainData.fundedAddress,
148
- feeCalculator: testOnChainData.feeCalculator,
149
- family: "solana",
150
- },
151
- expectedStatus: {
152
- errors: {},
153
- warnings: {},
154
- estimatedFees: fees(1),
155
- amount: testOnChainData.fundedSenderBalance.minus(fees(1)),
156
- totalSpent: testOnChainData.fundedSenderBalance,
157
- },
121
+ amount: testOnChainData.fundedSenderBalance.dividedBy(2),
122
+ recipient: testOnChainData.fundedAddress,
123
+ feeCalculator: testOnChainData.feeCalculator,
124
+ family: "solana",
125
+ },
126
+ expectedStatus: {
127
+ errors: {},
128
+ warnings: {},
129
+ estimatedFees: fees(1),
130
+ amount: testOnChainData.fundedSenderBalance.dividedBy(2),
131
+ totalSpent: testOnChainData.fundedSenderBalance
132
+ .dividedBy(2)
133
+ .plus(fees(1)),
134
+ },
135
+ },
136
+ {
137
+ name: "transfer :: status is success: all amount",
138
+ transaction: {
139
+ model: {
140
+ kind: "transfer",
141
+ uiState: {},
158
142
  },
159
- {
160
- name: "transfer :: status is error: not enough balance, not all amount",
161
- transaction: {
162
- model: {
163
- kind: "transfer",
164
- uiState: {},
165
- },
166
- amount: testOnChainData.fundedSenderBalance,
167
- recipient: testOnChainData.fundedAddress,
168
- feeCalculator: testOnChainData.feeCalculator,
169
- family: "solana",
170
- },
171
- expectedStatus: {
172
- errors: {
173
- amount: new NotEnoughBalance(),
174
- },
175
- warnings: {},
176
- estimatedFees: fees(1),
177
- amount: testOnChainData.fundedSenderBalance,
178
- totalSpent: testOnChainData.fundedSenderBalance.plus(fees(1)),
179
- },
143
+ useAllAmount: true,
144
+ amount: zero,
145
+ recipient: testOnChainData.fundedAddress,
146
+ feeCalculator: testOnChainData.feeCalculator,
147
+ family: "solana",
148
+ },
149
+ expectedStatus: {
150
+ errors: {},
151
+ warnings: {},
152
+ estimatedFees: fees(1),
153
+ amount: testOnChainData.fundedSenderBalance.minus(fees(1)),
154
+ totalSpent: testOnChainData.fundedSenderBalance,
155
+ },
156
+ },
157
+ {
158
+ name: "transfer :: status is error: not enough balance, not all amount",
159
+ transaction: {
160
+ model: {
161
+ kind: "transfer",
162
+ uiState: {},
180
163
  },
181
- {
182
- name: "transfer :: status is error: not enough balance, all amount",
183
- transaction: {
184
- model: {
185
- kind: "transfer",
186
- uiState: {
187
- memo: "a memo",
188
- },
189
- },
190
- useAllAmount: true,
191
- amount: zero,
192
- recipient: testOnChainData.fundedAddress,
193
- feeCalculator: {
194
- lamportsPerSignature: testOnChainData.fundedSenderBalance
195
- .plus(1)
196
- .toNumber(),
197
- },
198
- family: "solana",
199
- },
200
- expectedStatus: {
201
- errors: {
202
- amount: new NotEnoughBalance(),
203
- },
204
- warnings: {},
205
- estimatedFees: testOnChainData.fundedSenderBalance.plus(1),
206
- amount: zero,
207
- totalSpent: testOnChainData.fundedSenderBalance.plus(1),
208
- },
164
+ amount: testOnChainData.fundedSenderBalance,
165
+ recipient: testOnChainData.fundedAddress,
166
+ feeCalculator: testOnChainData.feeCalculator,
167
+ family: "solana",
168
+ },
169
+ expectedStatus: {
170
+ errors: {
171
+ amount: new NotEnoughBalance(),
209
172
  },
210
- {
211
- name: "transfer :: status is error: amount is 0",
212
- transaction: {
213
- model: {
214
- kind: "transfer",
215
- uiState: {},
216
- },
217
- amount: zero,
218
- recipient: testOnChainData.fundedAddress,
219
- feeCalculator: testOnChainData.feeCalculator,
220
- family: "solana",
221
- },
222
- expectedStatus: {
223
- errors: {
224
- amount: new AmountRequired(),
225
- },
226
- warnings: {},
227
- estimatedFees: fees(1),
228
- amount: zero,
229
- totalSpent: fees(1),
173
+ warnings: {},
174
+ estimatedFees: fees(1),
175
+ amount: testOnChainData.fundedSenderBalance,
176
+ totalSpent: testOnChainData.fundedSenderBalance.plus(fees(1)),
177
+ },
178
+ },
179
+ {
180
+ name: "transfer :: status is error: not enough balance, all amount",
181
+ transaction: {
182
+ model: {
183
+ kind: "transfer",
184
+ uiState: {
185
+ memo: "a memo",
230
186
  },
231
187
  },
232
- {
233
- name: "transfer :: status is error: amount is negative",
234
- transaction: {
235
- model: {
236
- kind: "transfer",
237
- uiState: {},
238
- },
239
- amount: new BigNumber(-1),
240
- recipient: testOnChainData.fundedAddress,
241
- feeCalculator: testOnChainData.feeCalculator,
242
- family: "solana",
243
- },
244
- expectedStatus: {
245
- errors: {
246
- amount: new AmountRequired(),
247
- },
248
- warnings: {},
249
- estimatedFees: fees(1),
250
- amount: new BigNumber(-1),
251
- totalSpent: new BigNumber(-1).plus(fees(1)),
252
- },
188
+ useAllAmount: true,
189
+ amount: zero,
190
+ recipient: testOnChainData.fundedAddress,
191
+ feeCalculator: {
192
+ lamportsPerSignature: testOnChainData.fundedSenderBalance
193
+ .plus(1)
194
+ .toNumber(),
253
195
  },
254
- {
255
- name: "transfer :: status is warning: recipient wallet not funded",
256
- transaction: {
257
- model: {
258
- kind: "transfer",
259
- uiState: {},
260
- },
261
- amount: new BigNumber(1),
262
- recipient: testOnChainData.unfundedAddress,
263
- feeCalculator: testOnChainData.feeCalculator,
264
- family: "solana",
265
- },
266
- expectedStatus: {
267
- errors: {},
268
- warnings: {
269
- recipient: new SolanaAccountNotFunded(),
270
- },
271
- estimatedFees: fees(1),
272
- amount: new BigNumber(1),
273
- totalSpent: fees(1).plus(1),
274
- },
196
+ family: "solana",
197
+ },
198
+ expectedStatus: {
199
+ errors: {
200
+ amount: new NotEnoughBalance(),
275
201
  },
276
- {
277
- name: "transfer :: status is warning: recipient address is off ed25519",
278
- transaction: {
279
- model: {
280
- kind: "transfer",
281
- uiState: {},
282
- },
283
- amount: new BigNumber(1),
284
- recipient: testOnChainData.offEd25519Address,
285
- feeCalculator: testOnChainData.feeCalculator,
286
- family: "solana",
287
- },
288
- expectedStatus: {
289
- errors: {},
290
- warnings: {
291
- recipient: new SolanaAccountNotFunded(),
292
- recipientOffCurve: new SolanaAddressOffEd25519(),
293
- },
294
- estimatedFees: fees(1),
295
- amount: new BigNumber(1),
296
- totalSpent: fees(1).plus(1),
297
- },
202
+ warnings: {},
203
+ estimatedFees: testOnChainData.fundedSenderBalance.plus(1),
204
+ amount: zero,
205
+ totalSpent: testOnChainData.fundedSenderBalance.plus(1),
206
+ },
207
+ },
208
+ {
209
+ name: "transfer :: status is error: amount is 0",
210
+ transaction: {
211
+ model: {
212
+ kind: "transfer",
213
+ uiState: {},
298
214
  },
299
- // no tokens for first release
300
- /*
301
- {
302
- name: "token.transfer :: status is success: recipient is funded wallet, assoc token acc exists",
303
- transaction: {
304
- model: {
305
- kind: "token.transfer",
306
- uiState: {
307
- subAccountId: wSolSubAccId,
308
- },
309
- },
310
- amount:
311
- testOnChainData.wSolSenderAssocTokenAccBalance.dividedBy(2),
312
- recipient: testOnChainData.fundedAddress,
313
- feeCalculator: testOnChainData.feeCalculator,
314
- family: "solana",
315
- },
316
- expectedStatus: {
317
- errors: {},
318
- warnings: {},
319
- estimatedFees: fees(1),
320
- amount:
321
- testOnChainData.wSolSenderAssocTokenAccBalance.dividedBy(2),
322
- totalSpent:
323
- testOnChainData.wSolSenderAssocTokenAccBalance.dividedBy(2),
324
- },
215
+ amount: zero,
216
+ recipient: testOnChainData.fundedAddress,
217
+ feeCalculator: testOnChainData.feeCalculator,
218
+ family: "solana",
219
+ },
220
+ expectedStatus: {
221
+ errors: {
222
+ amount: new AmountRequired(),
325
223
  },
326
- {
327
- name: "token.transfer :: status is success: recipient is correct mint token acc",
328
- transaction: {
329
- model: {
330
- kind: "token.transfer",
331
- uiState: {
332
- subAccountId: wSolSubAccId,
333
- },
334
- },
335
- amount:
336
- testOnChainData.wSolSenderAssocTokenAccBalance.dividedBy(2),
337
- recipient:
338
- testOnChainData.wSolFundedAccountAssocTokenAccAddress,
339
- feeCalculator: testOnChainData.feeCalculator,
340
- family: "solana",
341
- },
342
- expectedStatus: {
343
- errors: {},
344
- warnings: {},
345
- estimatedFees: fees(1),
346
- amount:
347
- testOnChainData.wSolSenderAssocTokenAccBalance.dividedBy(2),
348
- totalSpent:
349
- testOnChainData.wSolSenderAssocTokenAccBalance.dividedBy(2),
350
- },
224
+ warnings: {},
225
+ estimatedFees: fees(1),
226
+ amount: zero,
227
+ totalSpent: fees(1),
228
+ },
229
+ },
230
+ {
231
+ name: "transfer :: status is error: amount is negative",
232
+ transaction: {
233
+ model: {
234
+ kind: "transfer",
235
+ uiState: {},
351
236
  },
352
- {
353
- name: "token.transfer :: status is error: recipient is another mint token acc",
354
- transaction: {
355
- model: {
356
- kind: "token.transfer",
357
- uiState: {
358
- subAccountId: wSolSubAccId,
359
- },
360
- },
361
- amount:
362
- testOnChainData.wSolSenderAssocTokenAccBalance.dividedBy(2),
363
- recipient: testOnChainData.notWSolTokenAccAddress,
364
- feeCalculator: testOnChainData.feeCalculator,
365
- family: "solana",
366
- },
367
- expectedStatus: {
368
- errors: {
369
- recipient: new SolanaTokenAccountHoldsAnotherToken(),
370
- },
371
- warnings: {},
372
- estimatedFees: fees(1),
373
- amount:
374
- testOnChainData.wSolSenderAssocTokenAccBalance.dividedBy(2),
375
- totalSpent: zero,
237
+ amount: new BigNumber(-1),
238
+ recipient: testOnChainData.fundedAddress,
239
+ feeCalculator: testOnChainData.feeCalculator,
240
+ family: "solana",
241
+ },
242
+ expectedStatus: {
243
+ errors: {
244
+ amount: new AmountRequired(),
245
+ },
246
+ warnings: {},
247
+ estimatedFees: fees(1),
248
+ amount: new BigNumber(-1),
249
+ totalSpent: new BigNumber(-1).plus(fees(1)),
250
+ },
251
+ },
252
+ {
253
+ name: "transfer :: status is warning: recipient wallet not funded",
254
+ transaction: {
255
+ model: {
256
+ kind: "transfer",
257
+ uiState: {},
258
+ },
259
+ amount: new BigNumber(1),
260
+ recipient: testOnChainData.unfundedAddress,
261
+ feeCalculator: testOnChainData.feeCalculator,
262
+ family: "solana",
263
+ },
264
+ expectedStatus: {
265
+ errors: {},
266
+ warnings: {
267
+ recipient: new SolanaAccountNotFunded(),
268
+ },
269
+ estimatedFees: fees(1),
270
+ amount: new BigNumber(1),
271
+ totalSpent: fees(1).plus(1),
272
+ },
273
+ },
274
+ {
275
+ name: "transfer :: status is warning: recipient address is off ed25519",
276
+ transaction: {
277
+ model: {
278
+ kind: "transfer",
279
+ uiState: {},
280
+ },
281
+ amount: new BigNumber(1),
282
+ recipient: testOnChainData.offEd25519Address,
283
+ feeCalculator: testOnChainData.feeCalculator,
284
+ family: "solana",
285
+ },
286
+ expectedStatus: {
287
+ errors: {},
288
+ warnings: {
289
+ recipient: new SolanaAccountNotFunded(),
290
+ recipientOffCurve: new SolanaAddressOffEd25519(),
291
+ },
292
+ estimatedFees: fees(1),
293
+ amount: new BigNumber(1),
294
+ totalSpent: fees(1).plus(1),
295
+ },
296
+ },
297
+ // no tokens for first release
298
+ /*
299
+ {
300
+ name: "token.transfer :: status is success: recipient is funded wallet, assoc token acc exists",
301
+ transaction: {
302
+ model: {
303
+ kind: "token.transfer",
304
+ uiState: {
305
+ subAccountId: wSolSubAccId,
376
306
  },
377
307
  },
378
- {
379
- name: "token.transfer :: status is warning: recipient is off curve",
380
- transaction: {
381
- model: {
382
- kind: "token.transfer",
383
- uiState: {
384
- subAccountId: wSolSubAccId,
385
- },
386
- },
387
- amount:
388
- testOnChainData.wSolSenderAssocTokenAccBalance.dividedBy(2),
389
- recipient: testOnChainData.offEd25519Address,
390
- feeCalculator: testOnChainData.feeCalculator,
391
- family: "solana",
308
+ amount:
309
+ testOnChainData.wSolSenderAssocTokenAccBalance.dividedBy(2),
310
+ recipient: testOnChainData.fundedAddress,
311
+ feeCalculator: testOnChainData.feeCalculator,
312
+ family: "solana",
313
+ },
314
+ expectedStatus: {
315
+ errors: {},
316
+ warnings: {},
317
+ estimatedFees: fees(1),
318
+ amount:
319
+ testOnChainData.wSolSenderAssocTokenAccBalance.dividedBy(2),
320
+ totalSpent:
321
+ testOnChainData.wSolSenderAssocTokenAccBalance.dividedBy(2),
322
+ },
323
+ },
324
+ {
325
+ name: "token.transfer :: status is success: recipient is correct mint token acc",
326
+ transaction: {
327
+ model: {
328
+ kind: "token.transfer",
329
+ uiState: {
330
+ subAccountId: wSolSubAccId,
392
331
  },
393
- expectedStatus: {
394
- errors: {
395
- recipient: new SolanaAddressOffEd25519(),
396
- },
397
- warnings: {},
398
- estimatedFees: fees(1),
399
- amount:
400
- testOnChainData.wSolSenderAssocTokenAccBalance.dividedBy(2),
401
- totalSpent: zero,
332
+ },
333
+ amount:
334
+ testOnChainData.wSolSenderAssocTokenAccBalance.dividedBy(2),
335
+ recipient:
336
+ testOnChainData.wSolFundedAccountAssocTokenAccAddress,
337
+ feeCalculator: testOnChainData.feeCalculator,
338
+ family: "solana",
339
+ },
340
+ expectedStatus: {
341
+ errors: {},
342
+ warnings: {},
343
+ estimatedFees: fees(1),
344
+ amount:
345
+ testOnChainData.wSolSenderAssocTokenAccBalance.dividedBy(2),
346
+ totalSpent:
347
+ testOnChainData.wSolSenderAssocTokenAccBalance.dividedBy(2),
348
+ },
349
+ },
350
+ {
351
+ name: "token.transfer :: status is error: recipient is another mint token acc",
352
+ transaction: {
353
+ model: {
354
+ kind: "token.transfer",
355
+ uiState: {
356
+ subAccountId: wSolSubAccId,
402
357
  },
403
358
  },
404
- {
405
- name: "token.transfer :: status is success: recipient is wallet and no assoc token acc exists (will be created)",
406
- transaction: {
407
- model: {
408
- kind: "token.transfer",
409
- uiState: {
410
- subAccountId: wSolSubAccId,
411
- },
412
- },
413
- amount:
414
- testOnChainData.wSolSenderAssocTokenAccBalance.dividedBy(2),
415
- recipient: testOnChainData.unfundedAddress,
416
- feeCalculator: testOnChainData.feeCalculator,
417
- family: "solana",
359
+ amount:
360
+ testOnChainData.wSolSenderAssocTokenAccBalance.dividedBy(2),
361
+ recipient: testOnChainData.notWSolTokenAccAddress,
362
+ feeCalculator: testOnChainData.feeCalculator,
363
+ family: "solana",
364
+ },
365
+ expectedStatus: {
366
+ errors: {
367
+ recipient: new SolanaTokenAccountHoldsAnotherToken(),
368
+ },
369
+ warnings: {},
370
+ estimatedFees: fees(1),
371
+ amount:
372
+ testOnChainData.wSolSenderAssocTokenAccBalance.dividedBy(2),
373
+ totalSpent: zero,
374
+ },
375
+ },
376
+ {
377
+ name: "token.transfer :: status is warning: recipient is off curve",
378
+ transaction: {
379
+ model: {
380
+ kind: "token.transfer",
381
+ uiState: {
382
+ subAccountId: wSolSubAccId,
418
383
  },
419
- expectedStatus: {
420
- errors: {},
421
- warnings: {
422
- recipient: new SolanaAccountNotFunded(),
423
- recipientAssociatedTokenAccount:
424
- new SolanaRecipientAssociatedTokenAccountWillBeFunded(),
425
- },
426
- // this fee is dynamic, skip
427
- //estimatedFees: new BigNumber(2044280),
428
- amount:
429
- testOnChainData.wSolSenderAssocTokenAccBalance.dividedBy(2),
430
- totalSpent:
431
- testOnChainData.wSolSenderAssocTokenAccBalance.dividedBy(2),
384
+ },
385
+ amount:
386
+ testOnChainData.wSolSenderAssocTokenAccBalance.dividedBy(2),
387
+ recipient: testOnChainData.offEd25519Address,
388
+ feeCalculator: testOnChainData.feeCalculator,
389
+ family: "solana",
390
+ },
391
+ expectedStatus: {
392
+ errors: {
393
+ recipient: new SolanaAddressOffEd25519(),
394
+ },
395
+ warnings: {},
396
+ estimatedFees: fees(1),
397
+ amount:
398
+ testOnChainData.wSolSenderAssocTokenAccBalance.dividedBy(2),
399
+ totalSpent: zero,
400
+ },
401
+ },
402
+ {
403
+ name: "token.transfer :: status is success: recipient is wallet and no assoc token acc exists (will be created)",
404
+ transaction: {
405
+ model: {
406
+ kind: "token.transfer",
407
+ uiState: {
408
+ subAccountId: wSolSubAccId,
432
409
  },
433
410
  },
434
- */
435
- ],
411
+ amount:
412
+ testOnChainData.wSolSenderAssocTokenAccBalance.dividedBy(2),
413
+ recipient: testOnChainData.unfundedAddress,
414
+ feeCalculator: testOnChainData.feeCalculator,
415
+ family: "solana",
416
+ },
417
+ expectedStatus: {
418
+ errors: {},
419
+ warnings: {
420
+ recipient: new SolanaAccountNotFunded(),
421
+ recipientAssociatedTokenAccount:
422
+ new SolanaRecipientAssociatedTokenAccountWillBeFunded(),
423
+ },
424
+ // this fee is dynamic, skip
425
+ //estimatedFees: new BigNumber(2044280),
426
+ amount:
427
+ testOnChainData.wSolSenderAssocTokenAccBalance.dividedBy(2),
428
+ totalSpent:
429
+ testOnChainData.wSolSenderAssocTokenAccBalance.dividedBy(2),
430
+ },
436
431
  },
432
+ */
437
433
  ],
438
434
  },
435
+ ],
436
+ };
437
+
438
+ const dataset: DatasetTest<Transaction> = {
439
+ implementations: [getEnv("MOCK") ? "mock" : "js"], // FIXME we should actually put both mock and js like other dataset do
440
+ currencies: {
441
+ // solana, // TODO re enable when it's ready
439
442
  },
440
443
  };
441
444