@exodus/ethereum-api 7.0.1 → 7.0.3

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/LICENSE.md ADDED
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exodus/ethereum-api",
3
- "version": "7.0.1",
3
+ "version": "7.0.3",
4
4
  "description": "Ethereum Api",
5
5
  "main": "src/index.js",
6
6
  "files": [
@@ -17,7 +17,7 @@
17
17
  "@exodus/asset-lib": "^3.7.1",
18
18
  "@exodus/crypto": "^1.0.0-rc.0",
19
19
  "@exodus/currency": "^2.1.3",
20
- "@exodus/ethereum-lib": "^4.0.3",
20
+ "@exodus/ethereum-lib": "^4.0.4",
21
21
  "@exodus/ethereumjs-util": "^7.1.0-exodus.6",
22
22
  "@exodus/fetch": "^1.3.0-beta.4",
23
23
  "@exodus/simple-retry": "^0.0.6",
@@ -37,5 +37,6 @@
37
37
  "@exodus/assets-base": "^8.1.14",
38
38
  "@exodus/assets-testing": "file:../../../__testing__",
39
39
  "@exodus/models": "^11.0.0"
40
- }
40
+ },
41
+ "gitHead": "c882019d6e25cc3dd574e3477df6c1ec2a22deb5"
41
42
  }
@@ -1,6 +1,7 @@
1
1
  import { estimateGasLimit, EthereumStaking, getServer } from '@exodus/ethereum-api'
2
2
  import { isNumberUnit } from '@exodus/currency'
3
3
  import BN from 'bn.js'
4
+ import { stakingProviderClientFactory } from '../staking-provider-client'
4
5
 
5
6
  const extraGasLimit = 20000 // extra gas Limit to prevent tx failing if something change on pool state (till tx is in mempool)
6
7
 
@@ -10,6 +11,7 @@ export function createEthereumStakingService({
10
11
  createAndBroadcastTX,
11
12
  }) {
12
13
  const staking = new EthereumStaking(asset)
14
+ const stakingProvider = stakingProviderClientFactory()
13
15
 
14
16
  function amountToCurrency({ asset, amount }) {
15
17
  return isNumberUnit(amount) ? amount : asset.currency.parse(amount)
@@ -46,6 +48,15 @@ export function createEthereumStakingService({
46
48
  fee,
47
49
  })
48
50
 
51
+ // Goerli is not supported
52
+ if (asset.name === 'ethereum')
53
+ await stakingProvider.notifyStaking({
54
+ txId,
55
+ asset: asset.name,
56
+ delegator: delegatorAddress,
57
+ amount: amount.toBaseString(),
58
+ })
59
+
49
60
  return txId
50
61
  }
51
62
 
@@ -125,6 +136,15 @@ export function createEthereumStakingService({
125
136
  })
126
137
  }
127
138
 
139
+ // Goerli is not supported
140
+ if (asset.name === 'ethereum')
141
+ await stakingProvider.notifyUnstaking({
142
+ txId,
143
+ asset: asset.name,
144
+ delegator: delegatorAddress,
145
+ amount: amount.toBaseString(),
146
+ })
147
+
128
148
  return txId
129
149
  }
130
150
 
@@ -175,6 +195,8 @@ export function createEthereumStakingService({
175
195
  return
176
196
  }
177
197
 
198
+ if (args.amount) args.amount = amountToCurrency({ asset, amount: args.amount })
199
+
178
200
  let amount, data, fee
179
201
  try {
180
202
  ;({ amount, data } = await delegateOperation(args))