@exodus/ethereum-lib 3.3.42 → 4.0.1-alpha.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exodus/ethereum-lib",
3
- "version": "3.3.42",
3
+ "version": "4.0.1-alpha.0",
4
4
  "description": "Ethereum Library",
5
5
  "main": "src/index.js",
6
6
  "files": [
@@ -42,6 +42,5 @@
42
42
  "lodash": "^4.17.15",
43
43
  "ms": "^2.1.1",
44
44
  "reselect": "~3.0.1"
45
- },
46
- "gitHead": "3fc086590556bba9bfb369986d8e6c550af790df"
45
+ }
47
46
  }
@@ -1,9 +1,10 @@
1
1
  import { AccountState } from '@exodus/models'
2
2
 
3
3
  import { parseLegacyBalances } from './parse-legacy-balances'
4
+ import getAssetStakingData from './staking-data'
4
5
 
5
- // `assets` are only needed for chains that may need legacy parsing support
6
- export default function createEthereumLikeAccountState(asset, assets = {}) {
6
+ // `assets` are only needed for chains that may need legacy parsing and staking support
7
+ export default function createEthereumLikeAccountState({ asset, assets = {} }) {
7
8
  return class EthereumLikeAccountState extends AccountState {
8
9
  static defaults = {
9
10
  startblock: 0, // deprecated. It seems not used anymore. Remove when it's safe
@@ -11,6 +12,7 @@ export default function createEthereumLikeAccountState(asset, assets = {}) {
11
12
  balance: asset.currency.ZERO,
12
13
  tokenBalances: {},
13
14
  index: 0,
15
+ ...getAssetStakingData({ assetName: asset.name, assets }),
14
16
  }
15
17
 
16
18
  // legacy -- this should have no effect on Ethereum-like assets that do not have legacy account state
@@ -0,0 +1,54 @@
1
+ const ethStakeAccountState = ({ currency }) => ({
2
+ enabled: true,
3
+ isDelegating: false,
4
+ isUndelegateInProgress: false,
5
+ canClaimUndelegatedBalance: false,
6
+ minDelegateAmount: currency.defaultUnit(0.1),
7
+ delegatedBalance: currency.ZERO,
8
+ rewardsBalance: currency.ZERO,
9
+ unclaimedUndelegatedBalance: currency.ZERO,
10
+ })
11
+
12
+ const assetStakingData = {
13
+ polygon: ({ currency }) => ({
14
+ enabled: true,
15
+ isDelegating: false,
16
+ // Unstaking takes ~3-4 days, after that, user needs to
17
+ // claim the unstaked amount (initial staked amount)
18
+ isUndelegateInProgress: false,
19
+ canClaimUndelegatedBalance: false,
20
+ minRewardsToWithdraw: currency.defaultUnit(1),
21
+ minDelegateAmount: currency.defaultUnit(1),
22
+ unclaimedUndelegatedBalance: currency.ZERO,
23
+ delegatedBalance: currency.ZERO,
24
+ rewardsBalance: currency.ZERO,
25
+ withdrawable: currency.ZERO,
26
+ unbondNonce: '0',
27
+ }),
28
+ ethereum: ethStakeAccountState,
29
+ ethereumgoerli: ethStakeAccountState,
30
+ }
31
+
32
+ const getAssetStakingData = ({ assetName, assets }) => {
33
+ const stakingAssetsForAsset = {
34
+ ethereum: ['ethereum', 'polygon'],
35
+ ethereumgoerli: ['ethereumgoerli'],
36
+ }
37
+
38
+ const stakingAssetsNames = stakingAssetsForAsset[assetName]
39
+
40
+ if (!stakingAssetsNames) return {}
41
+
42
+ const stakingData = stakingAssetsNames.reduce((allStakingData, stakeAssetName) => {
43
+ const { currency } = assets[stakeAssetName]
44
+ const assetStakeData = assetStakingData[stakeAssetName]({
45
+ currency,
46
+ })
47
+ allStakingData[stakeAssetName] = assetStakeData
48
+ return allStakingData
49
+ }, {})
50
+
51
+ return { staking: stakingData }
52
+ }
53
+
54
+ export default getAssetStakingData
package/src/constants.js CHANGED
@@ -21,8 +21,9 @@ const CHAIN_DATA = {
21
21
  },
22
22
  bsc: {
23
23
  chainId: 56,
24
- serverUrl: 'https://bsc.a.exodus.io/wallet/v1/',
24
+ serverUrl: 'https://bsc-clarity-d.a.exodus.io/',
25
25
  confirmationsNumber: 15,
26
+ monitorType: 'clarity',
26
27
  tokenType: 'BSC_BEP20',
27
28
  },
28
29
  matic: {
package/LICENSE.md DELETED
File without changes