@exodus/ethereum-api 8.5.0 → 8.6.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/CHANGELOG.md +15 -0
- package/package.json +2 -2
- package/src/allowance/index.js +3 -0
- package/src/create-asset.js +0 -1
- package/src/exodus-eth-server/api.js +1 -1
- package/src/exodus-eth-server/index.js +6 -0
- package/src/staking/ethereum/service.js +1 -2
- package/src/staking/matic/service.js +2 -6
- package/src/staking/staking-provider-client.js +1 -4
- package/src/tx-log/ethereum-no-history-monitor.js +2 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,21 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [8.6.0](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-api@8.5.0...@exodus/ethereum-api@8.6.0) (2024-06-18)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* add tokenAssetType to base asset ([#2298](https://github.com/ExodusMovement/assets/issues/2298)) ([80c9dc8](https://github.com/ExodusMovement/assets/commit/80c9dc8a4d2a8614f84b66d2c9649cdf19601443))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Bug Fixes
|
|
15
|
+
|
|
16
|
+
* add handling 400 error code for eth like ([#2592](https://github.com/ExodusMovement/assets/issues/2592)) ([ac1121d](https://github.com/ExodusMovement/assets/commit/ac1121dab0cc451cfeeb8001915b11fc0bbe00a0))
|
|
17
|
+
* send fromAddress when approving tokens ([#2600](https://github.com/ExodusMovement/assets/issues/2600)) ([25a08ff](https://github.com/ExodusMovement/assets/commit/25a08ff08ca02405fc39d5590c60b025e98e703a))
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
6
21
|
## [8.5.0](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-api@8.4.2...@exodus/ethereum-api@8.5.0) (2024-06-17)
|
|
7
22
|
|
|
8
23
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exodus/ethereum-api",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.6.0",
|
|
4
4
|
"description": "Ethereum Api",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"files": [
|
|
@@ -66,5 +66,5 @@
|
|
|
66
66
|
"type": "git",
|
|
67
67
|
"url": "git+https://github.com/ExodusMovement/assets.git"
|
|
68
68
|
},
|
|
69
|
-
"gitHead": "
|
|
69
|
+
"gitHead": "1c873218d5be9cebd41509a7d88c4b003c09d353"
|
|
70
70
|
}
|
package/src/allowance/index.js
CHANGED
|
@@ -33,6 +33,7 @@ export const createApprove =
|
|
|
33
33
|
spenderAddress,
|
|
34
34
|
asset,
|
|
35
35
|
feeData,
|
|
36
|
+
fromAddress,
|
|
36
37
|
approveAmount,
|
|
37
38
|
gasLimit,
|
|
38
39
|
txInput: preTxInput,
|
|
@@ -50,6 +51,7 @@ export const createApprove =
|
|
|
50
51
|
txInput,
|
|
51
52
|
feeData,
|
|
52
53
|
isContract: true,
|
|
54
|
+
fromAddress,
|
|
53
55
|
}
|
|
54
56
|
|
|
55
57
|
gasLimit = gasLimit || (await fetchGasLimit(gasLimitOptions))
|
|
@@ -64,6 +66,7 @@ export const createApprove =
|
|
|
64
66
|
gasPrice: feeData.gasPrice,
|
|
65
67
|
gasLimit,
|
|
66
68
|
silent: true,
|
|
69
|
+
fromAddress,
|
|
67
70
|
...rest,
|
|
68
71
|
})
|
|
69
72
|
|
package/src/create-asset.js
CHANGED
|
@@ -29,7 +29,7 @@ export function create(defaultURL, ensAssetName) {
|
|
|
29
29
|
)
|
|
30
30
|
} catch (err) {
|
|
31
31
|
let nerr = err
|
|
32
|
-
if (err.response && err.response.status === 500) {
|
|
32
|
+
if (err.response && (err.response.status === 500 || err.response.status === 400)) {
|
|
33
33
|
try {
|
|
34
34
|
const data = await err.response.json()
|
|
35
35
|
const msg = data.error.replace(/^RPC error \(code: -\d+\): /, '')
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
|
+
// eslint-disable-next-line import/no-deprecated
|
|
2
3
|
DEFAULT_SERVER_URLS,
|
|
4
|
+
// eslint-disable-next-line import/no-deprecated
|
|
3
5
|
ETHEREUM_LIKE_ASSETS,
|
|
6
|
+
// eslint-disable-next-line import/no-deprecated
|
|
4
7
|
ETHEREUM_LIKE_MONITOR_TYPES,
|
|
5
8
|
} from '@exodus/ethereum-lib'
|
|
6
9
|
|
|
@@ -27,8 +30,11 @@ export function createEvmServer({ assetName, serverUrl, monitorType }) {
|
|
|
27
30
|
|
|
28
31
|
// @Deprecated
|
|
29
32
|
const serverMap = Object.fromEntries(
|
|
33
|
+
// eslint-disable-next-line import/no-deprecated
|
|
30
34
|
ETHEREUM_LIKE_ASSETS.map((assetName) => {
|
|
35
|
+
// eslint-disable-next-line import/no-deprecated
|
|
31
36
|
const monitorType = ETHEREUM_LIKE_MONITOR_TYPES[assetName]
|
|
37
|
+
// eslint-disable-next-line import/no-deprecated
|
|
32
38
|
const serverUrl = DEFAULT_SERVER_URLS[assetName]
|
|
33
39
|
return [assetName, createEvmServer({ assetName, serverUrl, monitorType })]
|
|
34
40
|
})
|
|
@@ -11,10 +11,9 @@ export function createEthereumStakingService({
|
|
|
11
11
|
asset,
|
|
12
12
|
assetClientInterface,
|
|
13
13
|
createAndBroadcastTX,
|
|
14
|
-
getTelemetryId,
|
|
15
14
|
}) {
|
|
16
15
|
const staking = new EthereumStaking(asset)
|
|
17
|
-
const stakingProvider = stakingProviderClientFactory(
|
|
16
|
+
const stakingProvider = stakingProviderClientFactory()
|
|
18
17
|
|
|
19
18
|
function amountToCurrency({ asset, amount }) {
|
|
20
19
|
return isNumberUnit(amount) ? amount : asset.currency.parse(amount)
|
|
@@ -5,14 +5,10 @@ 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({
|
|
9
|
-
assetClientInterface,
|
|
10
|
-
createAndBroadcastTX,
|
|
11
|
-
getTelemetryId,
|
|
12
|
-
}) {
|
|
8
|
+
export function createPolygonStakingService({ assetClientInterface, createAndBroadcastTX }) {
|
|
13
9
|
const stakingApi = new MaticStakingApi()
|
|
14
10
|
const assetName = 'ethereum'
|
|
15
|
-
const stakingProvider = stakingProviderClientFactory(
|
|
11
|
+
const stakingProvider = stakingProviderClientFactory()
|
|
16
12
|
|
|
17
13
|
async function getStakeAssets() {
|
|
18
14
|
const { polygon: asset, ethereum: feeAsset } = await assetClientInterface.getAssetsForNetwork({
|
|
@@ -6,7 +6,7 @@ const DEFAULT_STAKING_URL = 'https://staking.a.exodus.io'
|
|
|
6
6
|
const HTTP_POST_TIMEOUT = ms('30s')
|
|
7
7
|
|
|
8
8
|
export const stakingProviderClientFactory = (
|
|
9
|
-
{ defaultStakingUrl = DEFAULT_STAKING_URL
|
|
9
|
+
{ defaultStakingUrl = DEFAULT_STAKING_URL } = Object.create(null)
|
|
10
10
|
) => {
|
|
11
11
|
assert(defaultStakingUrl, '"defaultStakingUrl" must be provided')
|
|
12
12
|
|
|
@@ -22,11 +22,8 @@ export const stakingProviderClientFactory = (
|
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
const stakingRequest = async ({ asset, data }) => {
|
|
25
|
-
const headers = {}
|
|
26
|
-
if (typeof getTelemetryId === 'function') headers.telemetryId = await getTelemetryId()
|
|
27
25
|
return fetchival(stakingUrl, {
|
|
28
26
|
timeout: HTTP_POST_TIMEOUT,
|
|
29
|
-
headers,
|
|
30
27
|
})(asset)('stake').post(data)
|
|
31
28
|
}
|
|
32
29
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { getServer } from '../exodus-eth-server'
|
|
2
|
+
// eslint-disable-next-line import/no-deprecated
|
|
2
3
|
import { DEFAULT_SERVER_URLS } from '@exodus/ethereum-lib'
|
|
3
4
|
import { Tx } from '@exodus/models'
|
|
4
5
|
|
|
@@ -31,6 +32,7 @@ export class EthereumNoHistoryMonitor extends BaseMonitor {
|
|
|
31
32
|
|
|
32
33
|
setServer(config) {
|
|
33
34
|
if (!config?.server) {
|
|
35
|
+
// eslint-disable-next-line import/no-deprecated
|
|
34
36
|
this.server.setURI(DEFAULT_SERVER_URLS[this.asset.name])
|
|
35
37
|
return
|
|
36
38
|
}
|