@ledgerhq/live-common 25.2.0-nightly.2 → 26.0.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 (360) hide show
  1. package/README.md +1 -1
  2. package/lib/__tests__/test-helpers/setup.js +2 -0
  3. package/lib/__tests__/test-helpers/setup.js.map +1 -1
  4. package/lib/account/helpers.d.ts.map +1 -1
  5. package/lib/account/helpers.js +1 -0
  6. package/lib/account/helpers.js.map +1 -1
  7. package/lib/account/serialization.d.ts.map +1 -1
  8. package/lib/account/serialization.js +4 -0
  9. package/lib/account/serialization.js.map +1 -1
  10. package/lib/data/icons/react/index.d.ts +1 -0
  11. package/lib/data/icons/react/index.d.ts.map +1 -1
  12. package/lib/data/icons/react/index.js +7 -5
  13. package/lib/data/icons/react/index.js.map +1 -1
  14. package/lib/data/icons/react/osmo.d.ts +8 -0
  15. package/lib/data/icons/react/osmo.d.ts.map +1 -0
  16. package/lib/data/icons/react/osmo.js +39 -0
  17. package/lib/data/icons/react/osmo.js.map +1 -0
  18. package/lib/data/icons/reactNative/index.d.ts +1 -0
  19. package/lib/data/icons/reactNative/index.d.ts.map +1 -1
  20. package/lib/data/icons/reactNative/index.js +7 -5
  21. package/lib/data/icons/reactNative/index.js.map +1 -1
  22. package/lib/data/icons/reactNative/osmo.d.ts +8 -0
  23. package/lib/data/icons/reactNative/osmo.d.ts.map +1 -0
  24. package/lib/data/icons/reactNative/osmo.js +40 -0
  25. package/lib/data/icons/reactNative/osmo.js.map +1 -0
  26. package/lib/env.d.ts +15 -5
  27. package/lib/env.d.ts.map +1 -1
  28. package/lib/env.js +10 -0
  29. package/lib/env.js.map +1 -1
  30. package/lib/env.react.d.ts +1 -1
  31. package/lib/env.react.d.ts.map +1 -1
  32. package/lib/families/cosmos/CosmosValidatorsManager.d.ts +26 -0
  33. package/lib/families/cosmos/CosmosValidatorsManager.d.ts.map +1 -0
  34. package/lib/families/cosmos/CosmosValidatorsManager.js +365 -0
  35. package/lib/families/cosmos/CosmosValidatorsManager.js.map +1 -0
  36. package/lib/families/cosmos/account.d.ts +2 -2
  37. package/lib/families/cosmos/account.d.ts.map +1 -1
  38. package/lib/families/cosmos/account.js +19 -6
  39. package/lib/families/cosmos/account.js.map +1 -1
  40. package/lib/families/cosmos/api/Cosmos.d.ts +27 -15
  41. package/lib/families/cosmos/api/Cosmos.d.ts.map +1 -1
  42. package/lib/families/cosmos/api/Cosmos.js +418 -410
  43. package/lib/families/cosmos/api/Cosmos.js.map +1 -1
  44. package/lib/families/cosmos/bridge/js.d.ts.map +1 -1
  45. package/lib/families/cosmos/bridge/js.js +5 -5
  46. package/lib/families/cosmos/bridge/js.js.map +1 -1
  47. package/lib/families/cosmos/bridge/mock.js +1 -1
  48. package/lib/families/cosmos/bridge/mock.js.map +1 -1
  49. package/lib/families/cosmos/bridge.integration.test.js +5 -5
  50. package/lib/families/cosmos/bridge.integration.test.js.map +1 -1
  51. package/lib/families/cosmos/cli-transaction.d.ts +3 -3
  52. package/lib/families/cosmos/cli-transaction.d.ts.map +1 -1
  53. package/lib/families/cosmos/cli-transaction.js +4 -5
  54. package/lib/families/cosmos/cli-transaction.js.map +1 -1
  55. package/lib/families/cosmos/js-buildTransaction.js +3 -3
  56. package/lib/families/cosmos/js-buildTransaction.js.map +1 -1
  57. package/lib/families/cosmos/js-createTransaction.js +1 -1
  58. package/lib/families/cosmos/js-createTransaction.js.map +1 -1
  59. package/lib/families/cosmos/js-getTransactionStatus.d.ts +17 -3
  60. package/lib/families/cosmos/js-getTransactionStatus.d.ts.map +1 -1
  61. package/lib/families/cosmos/js-getTransactionStatus.js +224 -176
  62. package/lib/families/cosmos/js-getTransactionStatus.js.map +1 -1
  63. package/lib/families/cosmos/js-prepareTransaction.js +2 -2
  64. package/lib/families/cosmos/js-prepareTransaction.js.map +1 -1
  65. package/lib/families/cosmos/js-signOperation.js +3 -3
  66. package/lib/families/cosmos/js-signOperation.js.map +1 -1
  67. package/lib/families/cosmos/js-synchronisation.js +2 -2
  68. package/lib/families/cosmos/js-synchronisation.js.map +1 -1
  69. package/lib/families/cosmos/logic.js +1 -1
  70. package/lib/families/cosmos/logic.js.map +1 -1
  71. package/lib/families/cosmos/mock.js +1 -1
  72. package/lib/families/cosmos/mock.js.map +1 -1
  73. package/lib/families/cosmos/react.d.ts +4 -4
  74. package/lib/families/cosmos/react.d.ts.map +1 -1
  75. package/lib/families/cosmos/react.js +59 -26
  76. package/lib/families/cosmos/react.js.map +1 -1
  77. package/lib/families/cosmos/react.test.js +17 -15
  78. package/lib/families/cosmos/react.test.js.map +1 -1
  79. package/lib/families/cosmos/specs.js +4 -4
  80. package/lib/families/cosmos/specs.js.map +1 -1
  81. package/lib/families/cosmos/speculos-deviceActions.d.ts.map +1 -1
  82. package/lib/families/cosmos/speculos-deviceActions.js +1 -1
  83. package/lib/families/cosmos/speculos-deviceActions.js.map +1 -1
  84. package/lib/families/cosmos/transaction.d.ts +2 -2
  85. package/lib/families/cosmos/transaction.d.ts.map +1 -1
  86. package/lib/families/cosmos/transaction.js +4 -4
  87. package/lib/families/cosmos/transaction.js.map +1 -1
  88. package/lib/families/cosmos/types.d.ts +31 -13
  89. package/lib/families/cosmos/types.d.ts.map +1 -1
  90. package/lib/families/cosmos/utils.d.ts +1 -0
  91. package/lib/families/cosmos/utils.d.ts.map +1 -1
  92. package/lib/families/cosmos/utils.js +7 -1
  93. package/lib/families/cosmos/utils.js.map +1 -1
  94. package/lib/families/cosmos/validators.d.ts +3 -5
  95. package/lib/families/cosmos/validators.d.ts.map +1 -1
  96. package/lib/families/cosmos/validators.js +4 -317
  97. package/lib/families/cosmos/validators.js.map +1 -1
  98. package/lib/families/elrond/specs.js +1 -1
  99. package/lib/families/elrond/specs.js.map +1 -1
  100. package/lib/families/filecoin/bridge/account.d.ts.map +1 -1
  101. package/lib/families/filecoin/bridge/account.js +11 -5
  102. package/lib/families/filecoin/bridge/account.js.map +1 -1
  103. package/lib/families/osmosis/OsmosisSupplyTypes.d.ts +48 -0
  104. package/lib/families/osmosis/OsmosisSupplyTypes.d.ts.map +1 -0
  105. package/lib/families/osmosis/OsmosisSupplyTypes.js +3 -0
  106. package/lib/families/osmosis/OsmosisSupplyTypes.js.map +1 -0
  107. package/lib/families/osmosis/account.d.ts +14 -0
  108. package/lib/families/osmosis/account.d.ts.map +1 -0
  109. package/lib/families/osmosis/account.js +60 -0
  110. package/lib/families/osmosis/account.js.map +1 -0
  111. package/lib/families/osmosis/api/sdk.d.ts +35 -0
  112. package/lib/families/osmosis/api/sdk.d.ts.map +1 -0
  113. package/lib/families/osmosis/api/sdk.js +478 -0
  114. package/lib/families/osmosis/api/sdk.js.map +1 -0
  115. package/lib/families/osmosis/api/sdk.types.d.ts +57 -0
  116. package/lib/families/osmosis/api/sdk.types.d.ts.map +1 -0
  117. package/lib/families/osmosis/api/sdk.types.js +15 -0
  118. package/lib/families/osmosis/api/sdk.types.js.map +1 -0
  119. package/lib/families/osmosis/api/sdk.unit.test.d.ts +2 -0
  120. package/lib/families/osmosis/api/sdk.unit.test.d.ts.map +1 -0
  121. package/lib/families/osmosis/api/sdk.unit.test.js +50 -0
  122. package/lib/families/osmosis/api/sdk.unit.test.js.map +1 -0
  123. package/lib/families/osmosis/bridge/js.d.ts +8 -0
  124. package/lib/families/osmosis/bridge/js.d.ts.map +1 -0
  125. package/lib/families/osmosis/bridge/js.js +98 -0
  126. package/lib/families/osmosis/bridge/js.js.map +1 -0
  127. package/lib/families/osmosis/bridge.integration.test.d.ts +2 -0
  128. package/lib/families/osmosis/bridge.integration.test.d.ts.map +1 -0
  129. package/lib/families/osmosis/bridge.integration.test.js +383 -0
  130. package/lib/families/osmosis/bridge.integration.test.js.map +1 -0
  131. package/lib/families/osmosis/cli-transaction.d.ts +38 -0
  132. package/lib/families/osmosis/cli-transaction.d.ts.map +1 -0
  133. package/lib/families/osmosis/cli-transaction.js +119 -0
  134. package/lib/families/osmosis/cli-transaction.js.map +1 -0
  135. package/lib/families/osmosis/deviceTransactionConfig.d.ts +25 -0
  136. package/lib/families/osmosis/deviceTransactionConfig.d.ts.map +1 -0
  137. package/lib/families/osmosis/deviceTransactionConfig.js +132 -0
  138. package/lib/families/osmosis/deviceTransactionConfig.js.map +1 -0
  139. package/lib/families/osmosis/errors.d.ts +4 -0
  140. package/lib/families/osmosis/errors.d.ts.map +1 -0
  141. package/lib/families/osmosis/errors.js +8 -0
  142. package/lib/families/osmosis/errors.js.map +1 -0
  143. package/lib/families/osmosis/hw-getAddress.d.ts +4 -0
  144. package/lib/families/osmosis/hw-getAddress.d.ts.map +1 -0
  145. package/lib/families/osmosis/hw-getAddress.js +64 -0
  146. package/lib/families/osmosis/hw-getAddress.js.map +1 -0
  147. package/lib/families/osmosis/js-buildTransaction.d.ts +14 -0
  148. package/lib/families/osmosis/js-buildTransaction.d.ts.map +1 -0
  149. package/lib/families/osmosis/js-buildTransaction.js +303 -0
  150. package/lib/families/osmosis/js-buildTransaction.js.map +1 -0
  151. package/lib/families/osmosis/js-estimateMaxSpendable.d.ts +15 -0
  152. package/lib/families/osmosis/js-estimateMaxSpendable.d.ts.map +1 -0
  153. package/lib/families/osmosis/js-estimateMaxSpendable.js +67 -0
  154. package/lib/families/osmosis/js-estimateMaxSpendable.js.map +1 -0
  155. package/lib/families/osmosis/js-getFeesForTransaction.d.ts +15 -0
  156. package/lib/families/osmosis/js-getFeesForTransaction.d.ts.map +1 -0
  157. package/lib/families/osmosis/js-getFeesForTransaction.js +85 -0
  158. package/lib/families/osmosis/js-getFeesForTransaction.js.map +1 -0
  159. package/lib/families/osmosis/js-getTransactionStatus.d.ts +3 -0
  160. package/lib/families/osmosis/js-getTransactionStatus.d.ts.map +1 -0
  161. package/lib/families/osmosis/js-getTransactionStatus.js +10 -0
  162. package/lib/families/osmosis/js-getTransactionStatus.js.map +1 -0
  163. package/lib/families/osmosis/js-signOperation.d.ts +10 -0
  164. package/lib/families/osmosis/js-signOperation.d.ts.map +1 -0
  165. package/lib/families/osmosis/js-signOperation.js +211 -0
  166. package/lib/families/osmosis/js-signOperation.js.map +1 -0
  167. package/lib/families/osmosis/js-synchronization.d.ts +9 -0
  168. package/lib/families/osmosis/js-synchronization.d.ts.map +1 -0
  169. package/lib/families/osmosis/js-synchronization.js +176 -0
  170. package/lib/families/osmosis/js-synchronization.js.map +1 -0
  171. package/lib/families/osmosis/js-transaction.d.ts +23 -0
  172. package/lib/families/osmosis/js-transaction.d.ts.map +1 -0
  173. package/lib/families/osmosis/js-transaction.js +177 -0
  174. package/lib/families/osmosis/js-transaction.js.map +1 -0
  175. package/lib/families/osmosis/logic.d.ts +5 -0
  176. package/lib/families/osmosis/logic.d.ts.map +1 -0
  177. package/lib/families/osmosis/logic.js +22 -0
  178. package/lib/families/osmosis/logic.js.map +1 -0
  179. package/lib/families/osmosis/preloadedData.d.ts +9 -0
  180. package/lib/families/osmosis/preloadedData.d.ts.map +1 -0
  181. package/lib/families/osmosis/preloadedData.js +32 -0
  182. package/lib/families/osmosis/preloadedData.js.map +1 -0
  183. package/lib/families/osmosis/serialization.d.ts +7 -0
  184. package/lib/families/osmosis/serialization.d.ts.map +1 -0
  185. package/lib/families/osmosis/serialization.js +5 -0
  186. package/lib/families/osmosis/serialization.js.map +1 -0
  187. package/lib/families/osmosis/specs.d.ts +7 -0
  188. package/lib/families/osmosis/specs.d.ts.map +1 -0
  189. package/lib/families/osmosis/specs.js +402 -0
  190. package/lib/families/osmosis/specs.js.map +1 -0
  191. package/lib/families/osmosis/speculos-deviceActions.d.ts +7 -0
  192. package/lib/families/osmosis/speculos-deviceActions.d.ts.map +1 -0
  193. package/lib/families/osmosis/speculos-deviceActions.js +120 -0
  194. package/lib/families/osmosis/speculos-deviceActions.js.map +1 -0
  195. package/lib/families/osmosis/transaction.d.ts +10 -0
  196. package/lib/families/osmosis/transaction.d.ts.map +1 -0
  197. package/lib/families/osmosis/transaction.js +13 -0
  198. package/lib/families/osmosis/transaction.js.map +1 -0
  199. package/lib/families/osmosis/types.d.ts +38 -0
  200. package/lib/families/osmosis/types.d.ts.map +1 -0
  201. package/lib/families/osmosis/types.js +3 -0
  202. package/lib/families/osmosis/types.js.map +1 -0
  203. package/lib/families/osmosis/utils.d.ts +8 -0
  204. package/lib/families/osmosis/utils.d.ts.map +1 -0
  205. package/lib/families/osmosis/utils.js +28 -0
  206. package/lib/families/osmosis/utils.js.map +1 -0
  207. package/lib/families/osmosis/validators.d.ts +4 -0
  208. package/lib/families/osmosis/validators.d.ts.map +1 -0
  209. package/lib/families/osmosis/validators.js +131 -0
  210. package/lib/families/osmosis/validators.js.map +1 -0
  211. package/lib/families/polkadot/specs.d.ts.map +1 -1
  212. package/lib/families/polkadot/specs.js +3 -4
  213. package/lib/families/polkadot/specs.js.map +1 -1
  214. package/lib/featureFlags/defaultFeatures.d.ts.map +1 -1
  215. package/lib/featureFlags/defaultFeatures.js +3 -0
  216. package/lib/featureFlags/defaultFeatures.js.map +1 -1
  217. package/lib/featureFlags/provider.d.ts +1 -5
  218. package/lib/featureFlags/provider.d.ts.map +1 -1
  219. package/lib/featureFlags/provider.js +4 -6
  220. package/lib/featureFlags/provider.js.map +1 -1
  221. package/lib/featureFlags/useFeature.d.ts.map +1 -1
  222. package/lib/featureFlags/useFeature.js +1 -3
  223. package/lib/featureFlags/useFeature.js.map +1 -1
  224. package/lib/generated/account.d.ts +7 -1
  225. package/lib/generated/account.d.ts.map +1 -1
  226. package/lib/generated/account.js +4 -2
  227. package/lib/generated/account.js.map +1 -1
  228. package/lib/generated/bridge/js.d.ts +4 -0
  229. package/lib/generated/bridge/js.d.ts.map +1 -1
  230. package/lib/generated/bridge/js.js +14 -12
  231. package/lib/generated/bridge/js.js.map +1 -1
  232. package/lib/generated/bridge/mock.d.ts.map +1 -1
  233. package/lib/generated/bridge/mock.js.map +1 -1
  234. package/lib/generated/cli-transaction.d.ts +33 -2
  235. package/lib/generated/cli-transaction.d.ts.map +1 -1
  236. package/lib/generated/cli-transaction.js +14 -12
  237. package/lib/generated/cli-transaction.js.map +1 -1
  238. package/lib/generated/deviceTransactionConfig.d.ts +4 -1
  239. package/lib/generated/deviceTransactionConfig.d.ts.map +1 -1
  240. package/lib/generated/deviceTransactionConfig.js +14 -12
  241. package/lib/generated/deviceTransactionConfig.js.map +1 -1
  242. package/lib/generated/exchange.d.ts.map +1 -1
  243. package/lib/generated/exchange.js.map +1 -1
  244. package/lib/generated/hw-getAddress.d.ts +1 -0
  245. package/lib/generated/hw-getAddress.d.ts.map +1 -1
  246. package/lib/generated/hw-getAddress.js +14 -12
  247. package/lib/generated/hw-getAddress.js.map +1 -1
  248. package/lib/generated/hw-signMessage.d.ts.map +1 -1
  249. package/lib/generated/hw-signMessage.js.map +1 -1
  250. package/lib/generated/mock.d.ts.map +1 -1
  251. package/lib/generated/mock.js.map +1 -1
  252. package/lib/generated/platformAdapter.d.ts.map +1 -1
  253. package/lib/generated/platformAdapter.js.map +1 -1
  254. package/lib/generated/presync.d.ts.map +1 -1
  255. package/lib/generated/presync.js.map +1 -1
  256. package/lib/generated/specs.d.ts +3 -0
  257. package/lib/generated/specs.d.ts.map +1 -1
  258. package/lib/generated/specs.js +14 -12
  259. package/lib/generated/specs.js.map +1 -1
  260. package/lib/generated/speculos-deviceActions.d.ts +3 -0
  261. package/lib/generated/speculos-deviceActions.d.ts.map +1 -1
  262. package/lib/generated/speculos-deviceActions.js +14 -12
  263. package/lib/generated/speculos-deviceActions.js.map +1 -1
  264. package/lib/generated/transaction.d.ts +9 -1
  265. package/lib/generated/transaction.d.ts.map +1 -1
  266. package/lib/generated/transaction.js +14 -12
  267. package/lib/generated/transaction.js.map +1 -1
  268. package/lib/generated/types.d.ts +8 -4
  269. package/lib/generated/types.d.ts.map +1 -1
  270. package/lib/platform/react.d.ts.map +1 -1
  271. package/lib/platform/react.js +3 -6
  272. package/lib/platform/react.js.map +1 -1
  273. package/lib/reconciliation.d.ts.map +1 -1
  274. package/lib/reconciliation.js +9 -0
  275. package/lib/reconciliation.js.map +1 -1
  276. package/package.json +14 -9
  277. package/src/__tests__/test-helpers/setup.ts +2 -0
  278. package/src/account/helpers.ts +1 -0
  279. package/src/account/serialization.ts +6 -0
  280. package/src/currencies/__snapshots__/sortByMarketcap.test.ts.snap +36 -1
  281. package/src/data/icons/react/index.tsx +1 -0
  282. package/src/data/icons/react/osmo.tsx +14 -0
  283. package/src/data/icons/reactNative/index.tsx +1 -0
  284. package/src/data/icons/reactNative/osmo.tsx +15 -0
  285. package/src/data/icons/svg/OSMO.svg +7 -0
  286. package/src/env.ts +10 -0
  287. package/src/families/cosmos/CosmosValidatorsManager.ts +420 -0
  288. package/src/families/cosmos/account.ts +29 -10
  289. package/src/families/cosmos/api/Cosmos.ts +267 -257
  290. package/src/families/cosmos/bridge/js.ts +6 -7
  291. package/src/families/cosmos/bridge/mock.ts +1 -1
  292. package/src/families/cosmos/bridge.integration.test.ts +5 -5
  293. package/src/families/cosmos/cli-transaction.ts +7 -8
  294. package/src/families/cosmos/js-buildTransaction.ts +4 -4
  295. package/src/families/cosmos/js-createTransaction.ts +1 -1
  296. package/src/families/cosmos/js-getTransactionStatus.ts +276 -226
  297. package/src/families/cosmos/js-prepareTransaction.ts +3 -3
  298. package/src/families/cosmos/js-signOperation.ts +4 -4
  299. package/src/families/cosmos/js-synchronisation.ts +3 -3
  300. package/src/families/cosmos/logic.ts +1 -1
  301. package/src/families/cosmos/mock.ts +1 -1
  302. package/src/families/cosmos/react.test.ts +25 -14
  303. package/src/families/cosmos/react.ts +73 -21
  304. package/src/families/cosmos/specs.ts +4 -4
  305. package/src/families/cosmos/speculos-deviceActions.ts +1 -2
  306. package/src/families/cosmos/transaction.ts +4 -6
  307. package/src/families/cosmos/types.ts +41 -13
  308. package/src/families/cosmos/utils.ts +8 -0
  309. package/src/families/cosmos/validators.ts +5 -363
  310. package/src/families/elrond/specs.ts +1 -1
  311. package/src/families/filecoin/bridge/account.ts +12 -5
  312. package/src/families/osmosis/OsmosisSupplyTypes.ts +53 -0
  313. package/src/families/osmosis/__snapshots__/bridge.integration.test.ts.snap +852 -0
  314. package/src/families/osmosis/account.ts +65 -0
  315. package/src/families/osmosis/api/sdk.ts +530 -0
  316. package/src/families/osmosis/api/sdk.types.ts +65 -0
  317. package/src/families/osmosis/api/sdk.unit.test.ts +70 -0
  318. package/src/families/osmosis/bridge/js.ts +64 -0
  319. package/src/families/osmosis/bridge.integration.test.ts +467 -0
  320. package/src/families/osmosis/cli-transaction.ts +145 -0
  321. package/src/families/osmosis/deviceTransactionConfig.ts +174 -0
  322. package/src/families/osmosis/errors.ts +13 -0
  323. package/src/families/osmosis/hw-getAddress.ts +14 -0
  324. package/src/families/osmosis/js-buildTransaction.ts +306 -0
  325. package/src/families/osmosis/js-estimateMaxSpendable.ts +26 -0
  326. package/src/families/osmosis/js-getFeesForTransaction.ts +44 -0
  327. package/src/families/osmosis/js-getTransactionStatus.ts +9 -0
  328. package/src/families/osmosis/js-signOperation.ts +172 -0
  329. package/src/families/osmosis/js-synchronization.ts +122 -0
  330. package/src/families/osmosis/js-transaction.ts +96 -0
  331. package/src/families/osmosis/logic.ts +26 -0
  332. package/src/families/osmosis/preloadedData.ts +32 -0
  333. package/src/families/osmosis/serialization.ts +6 -0
  334. package/src/families/osmosis/specs.ts +393 -0
  335. package/src/families/osmosis/speculos-deviceActions.ts +94 -0
  336. package/src/families/osmosis/transaction.ts +20 -0
  337. package/src/families/osmosis/types.ts +48 -0
  338. package/src/families/osmosis/utils.ts +31 -0
  339. package/src/families/osmosis/validators.ts +79 -0
  340. package/src/families/polkadot/specs.ts +3 -4
  341. package/src/featureFlags/defaultFeatures.ts +3 -0
  342. package/src/featureFlags/provider.tsx +1 -11
  343. package/src/featureFlags/useFeature.ts +2 -6
  344. package/src/generated/account.ts +10 -0
  345. package/src/generated/bridge/js.ts +20 -0
  346. package/src/generated/bridge/mock.ts +8 -0
  347. package/src/generated/cli-transaction.ts +19 -0
  348. package/src/generated/deviceTransactionConfig.ts +33 -13
  349. package/src/generated/exchange.ts +5 -0
  350. package/src/generated/hw-getAddress.ts +20 -0
  351. package/src/generated/hw-signMessage.ts +3 -0
  352. package/src/generated/mock.ts +3 -0
  353. package/src/generated/platformAdapter.ts +4 -0
  354. package/src/generated/presync.ts +1 -0
  355. package/src/generated/specs.ts +19 -0
  356. package/src/generated/speculos-deviceActions.ts +19 -0
  357. package/src/generated/transaction.ts +20 -0
  358. package/src/generated/types.ts +12 -7
  359. package/src/platform/react.ts +3 -7
  360. package/src/reconciliation.ts +16 -0
@@ -4,12 +4,11 @@ import invariant from "invariant";
4
4
  import flatMap from "lodash/flatMap";
5
5
  import zipWith from "lodash/zipWith";
6
6
  import { BigNumber } from "bignumber.js";
7
- import { getValidators } from "./validators";
8
- import type { Transaction } from "../../generated/types";
9
7
  import { Transaction as CosmosTransaction } from "./types";
10
8
  import type { CosmosDelegationInfo } from "./types";
11
- import { getCryptoCurrencyById } from "../../currencies";
9
+ import cosmosValidatorsManager from "./validators";
12
10
  import { AccountLike } from "@ledgerhq/types-live";
11
+
13
12
  const options = [
14
13
  {
15
14
  name: "mode",
@@ -32,7 +31,7 @@ const options = [
32
31
  desc: "add a memo to a transaction",
33
32
  },
34
33
  {
35
- name: "cosmosSourceValidator",
34
+ name: "sourceValidator",
36
35
  type: String,
37
36
  desc: "for redelegate, add a source validator",
38
37
  },
@@ -53,11 +52,11 @@ const options = [
53
52
  function inferTransactions(
54
53
  transactions: Array<{
55
54
  account: AccountLike;
56
- transaction: Transaction;
55
+ transaction: CosmosTransaction;
57
56
  }>,
58
57
  opts: Record<string, any>,
59
58
  { inferAmount }: any
60
- ): Transaction[] {
59
+ ): CosmosTransaction[] {
61
60
  return flatMap(transactions, ({ transaction, account }) => {
62
61
  invariant(transaction.family === "cosmos", "cosmos family");
63
62
  const validatorsAddresses: string[] = opts["cosmosValidator"] || [];
@@ -82,7 +81,7 @@ function inferTransactions(
82
81
  fees: opts.fees ? inferAmount(account, opts.fees) : null,
83
82
  gas: opts.gasLimit ? new BigNumber(opts.gasLimit) : null,
84
83
  validators: validators,
85
- cosmosSourceValidator: opts.cosmosSourceValidator,
84
+ sourceValidator: opts.sourceValidator,
86
85
  } as CosmosTransaction;
87
86
  });
88
87
  }
@@ -110,7 +109,7 @@ const cosmosValidators = {
110
109
  }: Partial<{
111
110
  format: string;
112
111
  }>): Observable<string> =>
113
- from(getValidators(getCryptoCurrencyById("cosmos"))).pipe(
112
+ from(cosmosValidatorsManager.getValidators()).pipe(
114
113
  map((validators) => {
115
114
  const f =
116
115
  (format && cosmosValidatorsFormatters[format]) ||
@@ -12,7 +12,7 @@ import {
12
12
  import { MsgWithdrawDelegatorReward } from "cosmjs-types/cosmos/distribution/v1beta1/tx";
13
13
  import { SignMode } from "cosmjs-types/cosmos/tx/signing/v1beta1/signing";
14
14
  import { TxRaw } from "cosmjs-types/cosmos/tx/v1beta1/tx";
15
- import { getAccount } from "./api/Cosmos";
15
+ import { defaultCosmosAPI } from "./api/Cosmos";
16
16
  import BigNumber from "bignumber.js";
17
17
 
18
18
  export const buildTransaction = async (
@@ -99,7 +99,7 @@ export const buildTransaction = async (
99
99
 
100
100
  case "redelegate":
101
101
  if (
102
- !transaction.cosmosSourceValidator ||
102
+ !transaction.sourceValidator ||
103
103
  !transaction.validators ||
104
104
  transaction.validators.length < 1 ||
105
105
  !transaction.validators[0].address ||
@@ -110,7 +110,7 @@ export const buildTransaction = async (
110
110
  msg.push({
111
111
  typeUrl: "/cosmos.staking.v1beta1.MsgBeginRedelegate",
112
112
  value: {
113
- validatorSrcAddress: transaction.cosmosSourceValidator,
113
+ validatorSrcAddress: transaction.sourceValidator,
114
114
  delegatorAddress: account.freshAddress,
115
115
  validatorDstAddress: transaction.validators[0].address,
116
116
  amount: {
@@ -205,7 +205,7 @@ export const postBuildTransaction = async (
205
205
  ],
206
206
  ]);
207
207
 
208
- const { sequence } = await getAccount(account.freshAddress);
208
+ const { sequence } = await defaultCosmosAPI.getAccount(account.freshAddress);
209
209
 
210
210
  const txBodyBytes = registry.encode(txBodyFields);
211
211
 
@@ -16,7 +16,7 @@ const createTransaction = (): Transaction => ({
16
16
  useAllAmount: false,
17
17
  networkInfo: null,
18
18
  memo: null,
19
- cosmosSourceValidator: null,
19
+ sourceValidator: null,
20
20
  validators: [] as CosmosDelegationInfo[],
21
21
  });
22
22
 
@@ -15,9 +15,9 @@ import {
15
15
  NotEnoughDelegationBalance,
16
16
  } from "../../errors";
17
17
  import {
18
- CosmosAccount,
18
+ CosmosLikeTransaction,
19
19
  StatusErrorMap,
20
- Transaction,
20
+ CosmosAccount,
21
21
  TransactionStatus,
22
22
  } from "./types";
23
23
  import { BigNumber } from "bignumber.js";
@@ -28,265 +28,315 @@ import {
28
28
  getMaxEstimatedBalance,
29
29
  } from "./logic";
30
30
  import invariant from "invariant";
31
- import { isValidRecipent } from "./api/Cosmos";
32
-
33
- export const getTransactionStatus = async (
34
- a: CosmosAccount,
35
- t: Transaction
36
- ): Promise<TransactionStatus> => {
37
- if (t.mode === "send") {
38
- // We isolate the send transaction that it's a little bit different from the rest
39
- return await getSendTransactionStatus(a, t);
40
- } else if (t.mode === "delegate") {
41
- return await getDelegateTransactionStatus(a, t);
31
+ import { CosmosAPI, defaultCosmosAPI } from "./api/Cosmos";
32
+ import { OsmosisAPI } from "../osmosis/api/sdk";
33
+
34
+ export class CosmosTransactionStatusManager {
35
+ protected _api: CosmosAPI = defaultCosmosAPI;
36
+ protected _validatorOperatorAddressPrefix = "cosmosvaloper";
37
+
38
+ constructor(options?: {
39
+ api?: CosmosAPI;
40
+ validatorOperatorAddressPrefix?: string;
41
+ }) {
42
+ if (options?.validatorOperatorAddressPrefix) {
43
+ this._validatorOperatorAddressPrefix =
44
+ options.validatorOperatorAddressPrefix;
45
+ }
46
+ if (options?.api) {
47
+ this._api = options.api;
48
+ }
42
49
  }
43
50
 
44
- const errors: StatusErrorMap = {};
45
- const warnings: StatusErrorMap = {};
46
- // here we only treat about all other mode than delegate and send
47
- if (
48
- t.validators.some(
49
- (v) => !v.address || !v.address.includes("cosmosvaloper")
50
- ) ||
51
- t.validators.length === 0
52
- )
53
- errors.recipient = new InvalidAddress(undefined, {
54
- currencyName: a.currency.name,
55
- });
56
-
57
- if (t.mode === "redelegate") {
58
- const redelegationError = redelegationStatusError(a, t);
59
-
60
- if (redelegationError) {
61
- // Note : note sure if I have to put this error on this field
62
- errors.redelegation = redelegationError;
51
+ getTransactionStatus = async (
52
+ a: CosmosAccount,
53
+ t: CosmosLikeTransaction
54
+ ): Promise<TransactionStatus> => {
55
+ if (t.mode === "send") {
56
+ // We isolate the send transaction that it's a little bit different from the rest
57
+ return await this.getSendTransactionStatus(a, t);
58
+ } else if (t.mode === "delegate") {
59
+ return await this.getDelegateTransactionStatus(a, t);
63
60
  }
64
- } else if (t.mode === "undelegate") {
65
- invariant(
66
- a.cosmosResources &&
67
- a.cosmosResources.unbondings.length < COSMOS_MAX_UNBONDINGS,
68
- "unbondings should not have more than 6 entries"
69
- );
70
- if (t.validators.length === 0)
61
+
62
+ const errors: StatusErrorMap = {};
63
+ const warnings: StatusErrorMap = {};
64
+ // here we only treat about all other mode than delegate and send
65
+ if (
66
+ t.validators.some(
67
+ (v) =>
68
+ !v.address ||
69
+ !v.address.includes(this._validatorOperatorAddressPrefix)
70
+ ) ||
71
+ t.validators.length === 0
72
+ )
71
73
  errors.recipient = new InvalidAddress(undefined, {
72
74
  currencyName: a.currency.name,
73
75
  });
74
- const [first] = t.validators;
75
- const unbondingError = first && isDelegable(a, first.address, first.amount);
76
76
 
77
- if (unbondingError) {
78
- errors.unbonding = unbondingError;
77
+ if (t.mode === "redelegate") {
78
+ const redelegationError = this.redelegationStatusError(a, t);
79
+
80
+ if (redelegationError) {
81
+ // Note : note sure if I have to put this error on this field
82
+ errors.redelegation = redelegationError;
83
+ }
84
+ } else if (t.mode === "undelegate") {
85
+ invariant(
86
+ a.cosmosResources &&
87
+ a.cosmosResources.unbondings.length < COSMOS_MAX_UNBONDINGS,
88
+ "unbondings should not have more than 6 entries"
89
+ );
90
+ if (t.validators.length === 0)
91
+ errors.recipient = new InvalidAddress(undefined, {
92
+ currencyName: a.currency.name,
93
+ });
94
+ const [first] = t.validators;
95
+ const unbondingError =
96
+ first && this.isDelegable(a, first.address, first.amount);
97
+
98
+ if (unbondingError) {
99
+ errors.unbonding = unbondingError;
100
+ }
79
101
  }
80
- }
81
-
82
- const validatorAmount = t.validators.reduce(
83
- (old, current) => old.plus(current.amount),
84
- new BigNumber(0)
85
- );
86
102
 
87
- if (t.mode !== "claimReward" && validatorAmount.lte(0)) {
88
- errors.amount = new AmountRequired();
89
- }
103
+ const validatorAmount = t.validators.reduce(
104
+ (old, current) => old.plus(current.amount),
105
+ new BigNumber(0)
106
+ );
90
107
 
91
- const estimatedFees = t.fees || new BigNumber(0);
108
+ if (t.mode !== "claimReward" && validatorAmount.lte(0)) {
109
+ errors.amount = new AmountRequired();
110
+ }
92
111
 
93
- if (!t.fees) {
94
- errors.fees = new FeeNotLoaded();
95
- }
112
+ const estimatedFees = t.fees || new BigNumber(0);
96
113
 
97
- let totalSpent = estimatedFees;
114
+ if (!t.fees) {
115
+ errors.fees = new FeeNotLoaded();
116
+ }
98
117
 
99
- if (["claimReward", "claimRewardCompound"].includes(t.mode)) {
100
- const { cosmosResources } = a;
101
- invariant(cosmosResources, "cosmosResources should exist");
102
- const claimReward =
103
- t.validators.length && cosmosResources
104
- ? cosmosResources.delegations.find(
105
- (delegation) =>
106
- delegation.validatorAddress === t.validators[0].address
107
- )
108
- : null;
109
-
110
- if (claimReward && estimatedFees.gt(claimReward.pendingRewards)) {
111
- warnings.claimReward = new ClaimRewardsFeesWarning();
118
+ let totalSpent = estimatedFees;
119
+
120
+ if (["claimReward", "claimRewardCompound"].includes(t.mode)) {
121
+ const { cosmosResources } = a;
122
+ invariant(cosmosResources, "cosmosResources should exist");
123
+ const claimReward =
124
+ t.validators.length && cosmosResources
125
+ ? cosmosResources.delegations.find(
126
+ (delegation) =>
127
+ delegation.validatorAddress === t.validators[0].address
128
+ )
129
+ : null;
130
+
131
+ if (claimReward && estimatedFees.gt(claimReward.pendingRewards)) {
132
+ warnings.claimReward = new ClaimRewardsFeesWarning();
133
+ }
112
134
  }
113
- }
114
135
 
115
- if (
116
- !errors.recipient &&
117
- !errors.amount &&
118
- (validatorAmount.lt(0) || totalSpent.gt(a.spendableBalance))
119
- ) {
120
- errors.amount = new NotEnoughBalance();
121
- totalSpent = new BigNumber(0);
122
- }
136
+ if (
137
+ !errors.recipient &&
138
+ !errors.amount &&
139
+ (validatorAmount.lt(0) || totalSpent.gt(a.spendableBalance))
140
+ ) {
141
+ errors.amount = new NotEnoughBalance();
142
+ totalSpent = new BigNumber(0);
143
+ }
123
144
 
124
- return Promise.resolve({
125
- errors,
126
- warnings,
127
- estimatedFees,
128
- amount: new BigNumber(0),
129
- totalSpent,
130
- });
131
- };
132
-
133
- const getDelegateTransactionStatus = async (
134
- a: CosmosAccount,
135
- t: Transaction
136
- ): Promise<TransactionStatus> => {
137
- const errors: StatusErrorMap = {};
138
- const warnings: StatusErrorMap = {};
139
- if (
140
- t.validators.some(
141
- (v) => !v.address || !v.address.includes("cosmosvaloper")
142
- ) ||
143
- t.validators.length === 0
144
- )
145
- errors.recipient = new InvalidAddress(undefined, {
146
- currencyName: a.currency.name,
145
+ return Promise.resolve({
146
+ errors,
147
+ warnings,
148
+ estimatedFees,
149
+ amount: new BigNumber(0),
150
+ totalSpent,
147
151
  });
152
+ };
153
+
154
+ private getDelegateTransactionStatus = async (
155
+ a: CosmosAccount,
156
+ t: CosmosLikeTransaction
157
+ ): Promise<TransactionStatus> => {
158
+ const errors: StatusErrorMap = {};
159
+ const warnings: StatusErrorMap = {};
160
+ if (
161
+ t.validators.some(
162
+ (v) =>
163
+ !v.address ||
164
+ !v.address.includes(this._validatorOperatorAddressPrefix)
165
+ ) ||
166
+ t.validators.length === 0
167
+ )
168
+ errors.recipient = new InvalidAddress(undefined, {
169
+ currencyName: a.currency.name,
170
+ });
148
171
 
149
- if (t.validators.length > COSMOS_MAX_DELEGATIONS) {
150
- errors.validators = new CosmosTooManyValidators();
151
- }
172
+ if (t.validators.length > COSMOS_MAX_DELEGATIONS) {
173
+ errors.validators = new CosmosTooManyValidators();
174
+ }
152
175
 
153
- const estimatedFees = t.fees || new BigNumber(0);
176
+ const estimatedFees = t.fees || new BigNumber(0);
154
177
 
155
- if (!t.fees || !t.fees.gt(0)) {
156
- errors.fees = new FeeNotLoaded();
157
- }
178
+ if (this._api instanceof OsmosisAPI) {
179
+ if (!t.fees) {
180
+ errors.fees = new FeeNotLoaded();
181
+ }
182
+ } else {
183
+ if (!t.fees || !t.fees.gt(0)) {
184
+ errors.fees = new FeeNotLoaded();
185
+ }
186
+ }
187
+ let amount;
188
+
189
+ // TODO, refactor this block. We should use cosmosResources for Osmosis
190
+ if (this._api instanceof OsmosisAPI) {
191
+ amount = t.useAllAmount
192
+ ? a.spendableBalance.minus(estimatedFees)
193
+ : new BigNumber(t.amount);
194
+ } else {
195
+ amount = t.useAllAmount
196
+ ? getMaxEstimatedBalance(a, estimatedFees)
197
+ : t.amount;
198
+ }
199
+ const totalSpent = amount.plus(estimatedFees);
158
200
 
159
- const amount = t.useAllAmount
160
- ? getMaxEstimatedBalance(a, estimatedFees)
161
- : t.amount;
162
- const totalSpent = amount.plus(estimatedFees);
201
+ if (amount.eq(0)) {
202
+ errors.amount = new AmountRequired();
203
+ }
163
204
 
164
- if (amount.eq(0)) {
165
- errors.amount = new AmountRequired();
166
- }
205
+ if (
206
+ !errors.recipient &&
207
+ !errors.amount &&
208
+ (amount.lt(0) || totalSpent.gt(a.spendableBalance))
209
+ ) {
210
+ errors.amount = new NotEnoughBalance();
211
+ }
167
212
 
168
- if (
169
- !errors.recipient &&
170
- !errors.amount &&
171
- (amount.lt(0) || totalSpent.gt(a.spendableBalance))
172
- ) {
173
- errors.amount = new NotEnoughBalance();
174
- }
213
+ if (!errors.amount && t.useAllAmount) {
214
+ warnings.amount = new CosmosDelegateAllFundsWarning();
215
+ }
175
216
 
176
- if (!errors.amount && t.useAllAmount) {
177
- warnings.amount = new CosmosDelegateAllFundsWarning();
178
- }
217
+ return Promise.resolve({
218
+ errors,
219
+ warnings,
220
+ estimatedFees,
221
+ amount,
222
+ totalSpent,
223
+ });
224
+ };
225
+
226
+ private getSendTransactionStatus = async (
227
+ a: CosmosAccount,
228
+ t: CosmosLikeTransaction
229
+ ): Promise<TransactionStatus> => {
230
+ const errors: StatusErrorMap = {};
231
+ const warnings: StatusErrorMap = {};
232
+
233
+ if (!t.recipient) {
234
+ errors.recipient = new RecipientRequired("");
235
+ } else if (a.freshAddress === t.recipient) {
236
+ errors.recipient = new InvalidAddressBecauseDestinationIsAlsoSource();
237
+ } else {
238
+ if (!(await this._api.isValidRecipent(t.recipient))) {
239
+ errors.recipient = new InvalidAddress(undefined, {
240
+ currencyName: a.currency.name,
241
+ });
242
+ }
243
+ }
179
244
 
180
- return Promise.resolve({
181
- errors,
182
- warnings,
183
- estimatedFees,
184
- amount,
185
- totalSpent,
186
- });
187
- };
188
-
189
- const getSendTransactionStatus = async (
190
- a: CosmosAccount,
191
- t: Transaction
192
- ): Promise<TransactionStatus> => {
193
- const errors: StatusErrorMap = {};
194
- const warnings: StatusErrorMap = {};
195
-
196
- if (!t.recipient) {
197
- errors.recipient = new RecipientRequired("");
198
- } else if (a.freshAddress === t.recipient) {
199
- errors.recipient = new InvalidAddressBecauseDestinationIsAlsoSource();
200
- } else {
201
- if (!(await isValidRecipent(t.recipient))) {
202
- errors.recipient = new InvalidAddress(undefined, {
203
- currencyName: a.currency.name,
204
- });
245
+ let amount = t.amount;
246
+
247
+ if (amount.lte(0) && !t.useAllAmount) {
248
+ errors.amount = new AmountRequired();
205
249
  }
206
- }
207
250
 
208
- let amount = t.amount;
251
+ const estimatedFees = t.fees || new BigNumber(0);
209
252
 
210
- if (amount.lte(0) && !t.useAllAmount) {
211
- errors.amount = new AmountRequired();
212
- }
253
+ if (this._api instanceof OsmosisAPI) {
254
+ if (!t.fees) {
255
+ errors.fees = new FeeNotLoaded();
256
+ }
257
+ } else {
258
+ if (!t.fees || !t.fees.gt(0)) {
259
+ errors.fees = new FeeNotLoaded();
260
+ }
261
+ }
213
262
 
214
- const estimatedFees = t.fees || new BigNumber(0);
263
+ amount = t.useAllAmount ? getMaxEstimatedBalance(a, estimatedFees) : amount;
264
+ const totalSpent = amount.plus(estimatedFees);
215
265
 
216
- if (!t.fees || !t.fees.gt(0)) {
217
- errors.fees = new FeeNotLoaded();
218
- }
266
+ if (
267
+ (amount.lte(0) && t.useAllAmount) || // if use all Amount sets an amount at 0
268
+ (!errors.recipient && !errors.amount && totalSpent.gt(a.spendableBalance)) // if spendable balance lower than total
269
+ ) {
270
+ errors.amount = new NotEnoughBalance();
271
+ }
219
272
 
220
- amount = t.useAllAmount ? getMaxEstimatedBalance(a, estimatedFees) : amount;
221
- const totalSpent = amount.plus(estimatedFees);
273
+ if (
274
+ a.cosmosResources &&
275
+ a.cosmosResources.delegations.length > 0 &&
276
+ t.useAllAmount
277
+ ) {
278
+ warnings.amount = new RecommendUndelegation();
279
+ }
222
280
 
223
- if (
224
- (amount.lte(0) && t.useAllAmount) || // if use all Amount sets an amount at 0
225
- (!errors.recipient && !errors.amount && totalSpent.gt(a.spendableBalance)) // if spendable balance lower than total
226
- ) {
227
- errors.amount = new NotEnoughBalance();
228
- }
281
+ return Promise.resolve({
282
+ errors,
283
+ warnings,
284
+ estimatedFees,
285
+ amount,
286
+ totalSpent,
287
+ });
288
+ };
289
+
290
+ private redelegationStatusError = (
291
+ a: CosmosAccount,
292
+ t: CosmosLikeTransaction
293
+ ) => {
294
+ if (a.cosmosResources) {
295
+ const redelegations = a.cosmosResources.redelegations;
296
+ invariant(
297
+ redelegations.length < COSMOS_MAX_REDELEGATIONS,
298
+ "redelegation should not have more than 6 entries"
299
+ );
300
+ if (
301
+ redelegations.some((redelegation) => {
302
+ const dstValidator = redelegation.validatorDstAddress;
303
+ return (
304
+ dstValidator === t.sourceValidator &&
305
+ redelegation.completionDate > new Date()
306
+ );
307
+ })
308
+ )
309
+ return new CosmosRedelegationInProgress();
310
+ if (t.sourceValidator === t.validators[0].address)
311
+ return new InvalidAddressBecauseDestinationIsAlsoSource();
312
+ }
229
313
 
230
- if (
231
- a.cosmosResources &&
232
- a.cosmosResources.delegations.length > 0 &&
233
- t.useAllAmount
234
- ) {
235
- warnings.amount = new RecommendUndelegation();
236
- }
314
+ return this.isDelegable(a, t.sourceValidator, t.validators[0].amount);
315
+ };
316
+
317
+ private isDelegable = (
318
+ a: CosmosAccount,
319
+ address: string | undefined | null,
320
+ amount: BigNumber
321
+ ) => {
322
+ const { cosmosResources } = a;
323
+ invariant(cosmosResources, "cosmosResources should exist");
237
324
 
238
- return Promise.resolve({
239
- errors,
240
- warnings,
241
- estimatedFees,
242
- amount,
243
- totalSpent,
244
- });
245
- };
246
-
247
- const redelegationStatusError = (a: CosmosAccount, t: Transaction) => {
248
- if (a.cosmosResources) {
249
- const redelegations = a.cosmosResources.redelegations;
250
- invariant(
251
- redelegations.length < COSMOS_MAX_REDELEGATIONS,
252
- "redelegation should not have more than 6 entries"
253
- );
254
325
  if (
255
- redelegations.some((redelegation) => {
256
- const dstValidator = redelegation.validatorDstAddress;
257
- return (
258
- dstValidator === t.cosmosSourceValidator &&
259
- redelegation.completionDate > new Date()
260
- );
261
- })
262
- )
263
- return new CosmosRedelegationInProgress();
264
- if (t.cosmosSourceValidator === t.validators[0].address)
265
- return new InvalidAddressBecauseDestinationIsAlsoSource();
266
- }
326
+ cosmosResources &&
327
+ cosmosResources.delegations.some(
328
+ (delegation) =>
329
+ delegation.validatorAddress === address &&
330
+ delegation.amount.lt(amount)
331
+ )
332
+ ) {
333
+ return new NotEnoughDelegationBalance();
334
+ }
267
335
 
268
- return isDelegable(a, t.cosmosSourceValidator, t.validators[0].amount);
269
- };
270
-
271
- const isDelegable = (
272
- a: CosmosAccount,
273
- address: string | undefined | null,
274
- amount: BigNumber
275
- ) => {
276
- const { cosmosResources } = a;
277
- invariant(cosmosResources, "cosmosResources should exist");
278
-
279
- if (
280
- cosmosResources &&
281
- cosmosResources.delegations.some(
282
- (delegation) =>
283
- delegation.validatorAddress === address && delegation.amount.lt(amount)
284
- )
285
- ) {
286
- return new NotEnoughDelegationBalance();
287
- }
336
+ return null;
337
+ };
338
+ }
288
339
 
289
- return null;
290
- };
340
+ const cosmosTransactionStatusManager = new CosmosTransactionStatusManager();
291
341
 
292
- export default getTransactionStatus;
342
+ export default cosmosTransactionStatusManager.getTransactionStatus;
@@ -1,6 +1,6 @@
1
1
  import { CosmosAccount, Transaction } from "./types";
2
2
  import BigNumber from "bignumber.js";
3
- import { simulate } from "./api/Cosmos";
3
+ import { defaultCosmosAPI } from "./api/Cosmos";
4
4
  import { getEnv } from "../../env";
5
5
  import { buildTransaction, postBuildTransaction } from "./js-buildTransaction";
6
6
  import { getMaxEstimatedBalance } from "./logic";
@@ -34,7 +34,7 @@ export const calculateFees: CacheRes<
34
34
  ? transaction.validators.map((v) => v.address).join("-")
35
35
  : ""
36
36
  }_${transaction.memo ? transaction.memo.toString() : ""}_${
37
- transaction.cosmosSourceValidator ? transaction.cosmosSourceValidator : ""
37
+ transaction.sourceValidator ? transaction.sourceValidator : ""
38
38
  }`
39
39
  );
40
40
 
@@ -65,7 +65,7 @@ const getEstimatedFees = async (
65
65
  new Uint8Array(Buffer.from(account.seedIdentifier, "hex"))
66
66
  );
67
67
 
68
- const gasUsed = await simulate(tx_bytes);
68
+ const gasUsed = await defaultCosmosAPI.simulate(tx_bytes);
69
69
 
70
70
  if (gasUsed.gt(0)) {
71
71
  gasQty = gasUsed