@exodus/ethereum-api 7.0.15 → 7.0.16

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": "7.0.15",
3
+ "version": "7.0.16",
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.2.4",
20
+ "@exodus/ethereum-lib": "^4.2.5",
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",
@@ -38,5 +38,5 @@
38
38
  "@exodus/assets-testing": "file:../../../__testing__",
39
39
  "@exodus/models": "^11.0.0"
40
40
  },
41
- "gitHead": "79937b2d5f2fd6268d3fa7b3622fae938dde8aac"
41
+ "gitHead": "6fa73dbdd4ae4ff56f19a7a2854f439deaf99a13"
42
42
  }
@@ -9,9 +9,10 @@ export function createEthereumStakingService({
9
9
  asset,
10
10
  assetClientInterface,
11
11
  createAndBroadcastTX,
12
+ telemetryId,
12
13
  }) {
13
14
  const staking = new EthereumStaking(asset)
14
- const stakingProvider = stakingProviderClientFactory()
15
+ const stakingProvider = stakingProviderClientFactory({ telemetryId })
15
16
 
16
17
  function amountToCurrency({ asset, amount }) {
17
18
  return isNumberUnit(amount) ? amount : asset.currency.parse(amount)
@@ -5,10 +5,14 @@ import { MaticStakingApi } from './api'
5
5
  import { stakingProviderClientFactory } from '../staking-provider-client'
6
6
  import { isNumberUnit } from '@exodus/currency'
7
7
 
8
- export function createPolygonStakingService({ assetClientInterface, createAndBroadcastTX }) {
8
+ export function createPolygonStakingService({
9
+ assetClientInterface,
10
+ createAndBroadcastTX,
11
+ telemetryId,
12
+ }) {
9
13
  const stakingApi = new MaticStakingApi()
10
14
  const assetName = 'ethereum'
11
- const stakingProvider = stakingProviderClientFactory()
15
+ const stakingProvider = stakingProviderClientFactory({ telemetryId })
12
16
 
13
17
  async function getStakeAssets() {
14
18
  const { polygon: asset, ethereum: feeAsset } = await assetClientInterface.getAssetsForNetwork({
@@ -5,7 +5,10 @@ import ms from 'ms'
5
5
  const DEFAULT_STAKING_URL = 'https://staking.a.exodus.io'
6
6
  const HTTP_POST_TIMEOUT = ms('30s')
7
7
 
8
- export const stakingProviderClientFactory = (defaultStakingUrl = DEFAULT_STAKING_URL) => {
8
+ export const stakingProviderClientFactory = ({
9
+ defaultStakingUrl = DEFAULT_STAKING_URL,
10
+ telemetryId,
11
+ } = {}) => {
9
12
  assert(defaultStakingUrl, '"defaultStakingUrl" must be provided')
10
13
 
11
14
  let stakingUrl = new URL(defaultStakingUrl) // always should be an URL instance
@@ -20,8 +23,11 @@ export const stakingProviderClientFactory = (defaultStakingUrl = DEFAULT_STAKING
20
23
  }
21
24
 
22
25
  const stakingRequest = ({ asset, data }) => {
26
+ const headers = {}
27
+ if (telemetryId) headers.telemetryId = telemetryId
23
28
  return fetchival(stakingUrl, {
24
29
  timeout: HTTP_POST_TIMEOUT,
30
+ headers,
25
31
  })(asset)('stake').post(data)
26
32
  }
27
33