@exodus/ethereum-api 8.2.0 → 8.3.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-api",
3
- "version": "8.2.0",
3
+ "version": "8.3.0",
4
4
  "description": "Ethereum Api",
5
5
  "main": "src/index.js",
6
6
  "files": [
@@ -58,5 +58,5 @@
58
58
  "cross-fetch": "^3.1.5",
59
59
  "delay": "4.0.1"
60
60
  },
61
- "gitHead": "3d6deb1f1d8ba08510be92ed52dfe39ce69e6fb9"
61
+ "gitHead": "7fee55f46b28a0472a166f76e5d06b0f4c99457d"
62
62
  }
@@ -70,7 +70,17 @@ export async function fetchGasLimit({
70
70
 
71
71
  amount = asset.baseAsset.currency.ZERO
72
72
  toAddress = asset.contract.address
73
- } else if (!isContract && !['ethereumarbone', 'ethereumarbnova'].includes(asset.name)) {
73
+ } else if (
74
+ !isContract &&
75
+ // hacky, convert this to a fetchGasLimit forceGasLimitEstimation plugin flag!
76
+ ![
77
+ 'ethereumarbone',
78
+ 'ethereumarbonesepolia',
79
+ 'ethereumarbnova',
80
+ 'mantle',
81
+ 'mantlesepolia',
82
+ ].includes(asset.name)
83
+ ) {
74
84
  return defaultGasLimit()
75
85
  }
76
86
 
@@ -4,7 +4,17 @@ export const createGetBalanceForAddress = ({ asset, server }) => {
4
4
  assert(asset, 'asset is required')
5
5
  assert(server, 'server is required')
6
6
  return async (address) => {
7
- const balances = await server.getBalance(address)
8
- return asset.currency.baseUnit(balances.confirmed.value)
7
+ const balance = await server.getBalance(address)
8
+ if (typeof balance === 'string') {
9
+ // hex-response from eth_getBalance node
10
+ return asset.currency.baseUnit(balance)
11
+ }
12
+
13
+ if (balance && typeof balance === 'object' && typeof balance.confirmed?.value === 'string') {
14
+ // Magnifier/Clarity reponse
15
+ return asset.currency.baseUnit(balance.confirmed.value)
16
+ }
17
+
18
+ throw new Error('unable to parse server response for getBalance')
9
19
  }
10
20
  }
@@ -30,12 +30,16 @@ export const createEthereumHooks = ({
30
30
  for (const stakingAssetName of stakingAssetNames) {
31
31
  const getStakingInfo =
32
32
  stakingAssetName === 'polygon' ? getPolygonStakingInfo : getEthereumStakingInfo
33
- const assetStakingInfo = await getStakingInfo({
34
- address: userAddress.toString(),
35
- asset: assets[stakingAssetName],
36
- server,
37
- })
38
- stakingInfo.staking[stakingAssetName] = assetStakingInfo
33
+ const asset = assets[stakingAssetName]
34
+ if (asset) {
35
+ // asset may not be enabled in the wallet
36
+ const assetStakingInfo = await getStakingInfo({
37
+ address: userAddress.toString(),
38
+ asset,
39
+ server,
40
+ })
41
+ stakingInfo.staking[stakingAssetName] = assetStakingInfo
42
+ }
39
43
  }
40
44
 
41
45
  const batch = assetClientInterface.createOperationsBatch()