@exodus/ethereum-api 6.3.7 → 6.3.8
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": "6.3.
|
|
3
|
+
"version": "6.3.8",
|
|
4
4
|
"description": "Ethereum Api",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"files": [
|
|
@@ -16,9 +16,9 @@
|
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@exodus/asset-lib": "^3.7.1",
|
|
18
18
|
"@exodus/crypto": "^1.0.0-rc.0",
|
|
19
|
-
"@exodus/ethereum-lib": "^3.3.
|
|
19
|
+
"@exodus/ethereum-lib": "^3.3.27",
|
|
20
20
|
"@exodus/ethereumjs-util": "^7.1.0-exodus.6",
|
|
21
|
-
"@exodus/fetch": "^1.3.0-beta.
|
|
21
|
+
"@exodus/fetch": "^1.3.0-beta.4",
|
|
22
22
|
"@exodus/simple-retry": "^0.0.6",
|
|
23
23
|
"@exodus/solidity-contract": "^1.1.3",
|
|
24
24
|
"bn.js": "^5.2.1",
|
|
@@ -34,5 +34,5 @@
|
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@exodus/models": "^8.10.4"
|
|
36
36
|
},
|
|
37
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "954b8bbebc920fcb88c87a949f7496b59e0379f7"
|
|
38
38
|
}
|
package/src/etherscan/request.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import ms from 'ms'
|
|
2
2
|
import makeConcurrent from 'make-concurrent'
|
|
3
|
-
import
|
|
3
|
+
import fetchival from '@exodus/fetch/experimental/fetchival'
|
|
4
4
|
|
|
5
5
|
const ETHERSCAN_API_URL = 'https://api.etherscan.io/api'
|
|
6
6
|
const DEFAULT_ETHERSCAN_API_KEY = 'XM3VGRSNW1TMSIR14I9MVFP15X74GNHTRI'
|
|
@@ -13,8 +13,12 @@ export function setEtherscanApiKey(apiKey) {
|
|
|
13
13
|
|
|
14
14
|
export default makeConcurrent(
|
|
15
15
|
async function(isValidResponseCheck, module, action, params = {}) {
|
|
16
|
-
const
|
|
17
|
-
|
|
16
|
+
const data = await fetchival(new URL(ETHERSCAN_API_URL), { timeout: ms('15s') }).get({
|
|
17
|
+
...params,
|
|
18
|
+
module,
|
|
19
|
+
action,
|
|
20
|
+
apiKey: etherscanApiKey,
|
|
21
|
+
})
|
|
18
22
|
if (!isValidResponseCheck(data)) throw new Error(`Invalid response: ${JSON.stringify(data)}`)
|
|
19
23
|
return data.result
|
|
20
24
|
},
|
|
@@ -23,7 +23,10 @@ export function create(defaultURL, ensAssetName) {
|
|
|
23
23
|
|
|
24
24
|
async function request(module, params = {}, { version = 'v1', method = 'get' } = {}) {
|
|
25
25
|
try {
|
|
26
|
-
return await fetchival(baseUrl(version), { timeout: ms('15s') })(module)
|
|
26
|
+
return await fetchival(baseUrl(version), { timeout: ms('15s') })(module).method(
|
|
27
|
+
method,
|
|
28
|
+
params
|
|
29
|
+
)
|
|
27
30
|
} catch (err) {
|
|
28
31
|
let nerr = err
|
|
29
32
|
if (err.response && err.response.status === 500) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import assert from 'minimalistic-assert'
|
|
2
|
-
import
|
|
2
|
+
import fetchival from '@exodus/fetch/experimental/fetchival'
|
|
3
3
|
import ms from 'ms'
|
|
4
4
|
|
|
5
5
|
const DEFAULT_STAKING_URL = 'https://staking.a.exodus.io'
|
|
@@ -8,20 +8,20 @@ const HTTP_POST_TIMEOUT = ms('30s')
|
|
|
8
8
|
export const stakingProviderClientFactory = (defaultStakingUrl = DEFAULT_STAKING_URL) => {
|
|
9
9
|
assert(defaultStakingUrl, '"defaultStakingUrl" must be provided')
|
|
10
10
|
|
|
11
|
-
let stakingUrl = defaultStakingUrl
|
|
11
|
+
let stakingUrl = new URL(defaultStakingUrl) // always should be an URL instance
|
|
12
12
|
|
|
13
13
|
const assetValidators = {
|
|
14
14
|
polygon: '0x3f4ce357b9d61d3b904492b8b5abc69c6c693720',
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
const setStakingUrl = (newStakingUrl) => {
|
|
18
|
-
stakingUrl = newStakingUrl || defaultStakingUrl
|
|
18
|
+
stakingUrl = new URL(newStakingUrl || defaultStakingUrl)
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
const stakingRequest = ({ asset, data }) => {
|
|
22
|
-
return fetchival(
|
|
22
|
+
return fetchival(stakingUrl, {
|
|
23
23
|
timeout: HTTP_POST_TIMEOUT,
|
|
24
|
-
}).post(data)
|
|
24
|
+
})(asset)('stake').post(data)
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
const notifyActionFactory = ({ type }) => {
|