@exodus/ethereum-api 8.54.0 → 8.55.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 +24 -0
- package/package.json +4 -4
- package/src/staking/matic/api.js +26 -0
- package/src/staking/matic/service.js +6 -5
- package/src/tx-send/tx-send.js +6 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,30 @@
|
|
|
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.55.0](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-api@8.54.1...@exodus/ethereum-api@8.55.0) (2025-11-03)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
* feat: bump @exodus/safe-string@1.2.1 (#6775)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
* fix: enable `update-nonce` to work for `unsignedTx`s that lack a `transactionBuffer` (#6832)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
## [8.54.1](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-api@8.54.0...@exodus/ethereum-api@8.54.1) (2025-10-24)
|
|
23
|
+
|
|
24
|
+
**Note:** Version bump only for package @exodus/ethereum-api
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
6
30
|
## [8.54.0](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-api@8.53.6...@exodus/ethereum-api@8.54.0) (2025-10-23)
|
|
7
31
|
|
|
8
32
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exodus/ethereum-api",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.55.0",
|
|
4
4
|
"description": "Transaction monitors, fee monitors, RPC with the blockchain node, and other networking code for Ethereum and EVM-based blockchains",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.js",
|
|
@@ -29,13 +29,13 @@
|
|
|
29
29
|
"@exodus/bip44-constants": "^195.0.0",
|
|
30
30
|
"@exodus/crypto": "^1.0.0-rc.26",
|
|
31
31
|
"@exodus/currency": "^6.0.1",
|
|
32
|
-
"@exodus/ethereum-lib": "^5.18.
|
|
32
|
+
"@exodus/ethereum-lib": "^5.18.5",
|
|
33
33
|
"@exodus/ethereum-meta": "^2.9.1",
|
|
34
34
|
"@exodus/ethereumholesky-meta": "^2.0.5",
|
|
35
35
|
"@exodus/ethereumjs": "^1.8.0",
|
|
36
36
|
"@exodus/fetch": "^1.3.0",
|
|
37
37
|
"@exodus/models": "^12.13.0",
|
|
38
|
-
"@exodus/safe-string": "^1.2.
|
|
38
|
+
"@exodus/safe-string": "^1.2.1",
|
|
39
39
|
"@exodus/simple-retry": "^0.0.6",
|
|
40
40
|
"@exodus/solidity-contract": "^1.3.0",
|
|
41
41
|
"@exodus/web3-ethereum-utils": "^4.5.1",
|
|
@@ -67,5 +67,5 @@
|
|
|
67
67
|
"type": "git",
|
|
68
68
|
"url": "git+https://github.com/ExodusMovement/assets.git"
|
|
69
69
|
},
|
|
70
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "5cccc79593748fc6e266e912fcac69498be93c57"
|
|
71
71
|
}
|
package/src/staking/matic/api.js
CHANGED
|
@@ -7,6 +7,8 @@ import BN from 'bn.js'
|
|
|
7
7
|
import { getServerByName } from '../../exodus-eth-server/index.js'
|
|
8
8
|
import { fromHexToBN, fromHexToString, splitIn32BytesArray } from '../../number-utils.js'
|
|
9
9
|
|
|
10
|
+
const EVERSTAKE_API_URL = 'https://polygon-clarity.a.exodus.io/everstake-rewards'
|
|
11
|
+
|
|
10
12
|
const polygonEthToken = ethAssets.find(({ name: tokenName }) => tokenName === 'polygon')
|
|
11
13
|
|
|
12
14
|
const RETRY_DELAYS = ['10s']
|
|
@@ -109,6 +111,7 @@ export class MaticStakingApi {
|
|
|
109
111
|
}
|
|
110
112
|
|
|
111
113
|
getLiquidRewards = async (address) => {
|
|
114
|
+
// latest accrued rewards
|
|
112
115
|
const liquidRewards = await this.#callReadFunctionContract(
|
|
113
116
|
this.validatorShareContract,
|
|
114
117
|
'getLiquidRewards',
|
|
@@ -117,6 +120,29 @@ export class MaticStakingApi {
|
|
|
117
120
|
return polygonEthToken.currency.baseUnit(liquidRewards)
|
|
118
121
|
}
|
|
119
122
|
|
|
123
|
+
getTotalRewards = async (address) => {
|
|
124
|
+
// use external everstake API to get total rewards
|
|
125
|
+
const url = new URL(EVERSTAKE_API_URL)
|
|
126
|
+
|
|
127
|
+
const options = {
|
|
128
|
+
method: 'POST',
|
|
129
|
+
headers: { 'Content-Type': 'application/json' },
|
|
130
|
+
body: JSON.stringify({
|
|
131
|
+
address,
|
|
132
|
+
}),
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
try {
|
|
136
|
+
const response = await fetch(url.toString(), options)
|
|
137
|
+
const res = await response.json()
|
|
138
|
+
if (res === 'address' || !res?.rewards) return polygonEthToken.currency.ZERO // address not found
|
|
139
|
+
return polygonEthToken.currency.baseUnit(res.rewards)
|
|
140
|
+
} catch (error) {
|
|
141
|
+
console.warn('Error fetching Polygon total rewards:', error)
|
|
142
|
+
return polygonEthToken.currency.ZERO
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
120
146
|
getTotalStake = async (address) => {
|
|
121
147
|
const stakeInfo = await this.#callReadFunctionContract(
|
|
122
148
|
this.validatorShareContract,
|
|
@@ -482,18 +482,19 @@ async function getUnstakedUnclaimedInfo({
|
|
|
482
482
|
}
|
|
483
483
|
|
|
484
484
|
async function fetchRewardsInfo({ stakingApi, delegator, currency }) {
|
|
485
|
-
const [minRewardsToWithdraw, rewardsBalance] = await Promise.all([
|
|
485
|
+
const [minRewardsToWithdraw, lastRewards, rewardsBalance] = await Promise.all([
|
|
486
486
|
stakingApi.getMinRewardsToWithdraw(),
|
|
487
487
|
stakingApi.getLiquidRewards(delegator),
|
|
488
|
+
stakingApi.getTotalRewards(delegator),
|
|
488
489
|
])
|
|
489
|
-
const withdrawable =
|
|
490
|
-
?
|
|
490
|
+
const withdrawable = lastRewards.sub(minRewardsToWithdraw).gte(currency.ZERO)
|
|
491
|
+
? lastRewards
|
|
491
492
|
: currency.ZERO
|
|
492
493
|
|
|
493
494
|
return {
|
|
494
|
-
rewardsBalance,
|
|
495
|
+
rewardsBalance: rewardsBalance.add(lastRewards), // all time accrued rewards
|
|
495
496
|
minRewardsToWithdraw,
|
|
496
|
-
withdrawable,
|
|
497
|
+
withdrawable, // unclaimed rewards
|
|
497
498
|
}
|
|
498
499
|
}
|
|
499
500
|
|
package/src/tx-send/tx-send.js
CHANGED
|
@@ -37,6 +37,10 @@ const txSendFactory = ({ assetClientInterface, createTx }) => {
|
|
|
37
37
|
})
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
+
// NOTE: An `unsignedTx.txData.transactionBuffer` may be optional
|
|
41
|
+
// in `unsignedTx`, since a `providedUnsignedTx` may be
|
|
42
|
+
// truthy but composed only of `legacyParams`:
|
|
43
|
+
// https://github.com/ExodusMovement/assets/blob/4e3e873e3f5bfa8fce36f60be7d95a3dba9546e4/ethereum/ethereum-lib/src/unsigned-tx/parse-unsigned-tx.js#L104C5-L104C6
|
|
40
44
|
const { unsignedTx } = await resolveUnsignedTx()
|
|
41
45
|
|
|
42
46
|
const parsedTx = parseUnsignedTx({ asset, unsignedTx })
|
|
@@ -96,10 +100,11 @@ const txSendFactory = ({ assetClientInterface, createTx }) => {
|
|
|
96
100
|
forceFromNode: true,
|
|
97
101
|
})
|
|
98
102
|
|
|
103
|
+
// TODO: should return an unsignedTx -> i.e. completely replicate the transaction
|
|
99
104
|
unsignedTx.txData.transactionBuffer = updateNonce({
|
|
100
105
|
chainId: baseAsset.chainId,
|
|
101
|
-
transactionBuffer: unsignedTx.txData.transactionBuffer,
|
|
102
106
|
newNonce,
|
|
107
|
+
unsignedTx,
|
|
103
108
|
})
|
|
104
109
|
;({ txId, rawTx } = await signTx({ asset, unsignedTx, walletAccount }))
|
|
105
110
|
|