@exodus/ethereum-api 8.66.0 → 8.69.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 +32 -4
- package/package.json +2 -2
- package/src/create-asset.js +5 -0
- package/src/exodus-eth-server/clarity-v2.js +7 -4
- package/src/exodus-eth-server/clarity.js +8 -1
- package/src/get-fee.js +4 -3
- package/src/tx-create.js +59 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,21 +3,49 @@
|
|
|
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
|
+
## [8.69.0](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-api@8.67.0...@exodus/ethereum-api@8.69.0) (2026-03-10)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
* fix: pass `baseAsset` to `getExtraFeeForBump` instead of `baseAsset.name` (#7543)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
## [8.68.0](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-api@8.67.0...@exodus/ethereum-api@8.68.0) (2026-03-09)
|
|
7
17
|
|
|
8
18
|
|
|
9
19
|
### Features
|
|
10
20
|
|
|
11
21
|
|
|
12
|
-
* feat: add
|
|
22
|
+
* feat: add assets-gateway enable for clarity-v2, enable bsc (#7480)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
## [8.67.0](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-api@8.66.0...@exodus/ethereum-api@8.67.0) (2026-03-09)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
### Features
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
* feat: add hasLostPermission api method to asset plugins (#7524)
|
|
13
33
|
|
|
14
34
|
|
|
15
35
|
### Bug Fixes
|
|
16
36
|
|
|
17
37
|
|
|
18
|
-
* fix:
|
|
38
|
+
* fix: queued/invalid Ethereum transactions being offered for RBF acceleration (#7463)
|
|
19
39
|
|
|
20
|
-
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
## [8.66.0](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-api@8.65.0...@exodus/ethereum-api@8.66.0) (2026-03-04)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
### Features
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
* feat: add USDT blacklist status APIs for ETH and TRX and expose TRX raw account (#7444)
|
|
21
49
|
|
|
22
50
|
|
|
23
51
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exodus/ethereum-api",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.69.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",
|
|
@@ -69,5 +69,5 @@
|
|
|
69
69
|
"type": "git",
|
|
70
70
|
"url": "git+https://github.com/ExodusMovement/assets.git"
|
|
71
71
|
},
|
|
72
|
-
"gitHead": "
|
|
72
|
+
"gitHead": "7da7b29b3177ad6155d5018c297e795cd4d3bda8"
|
|
73
73
|
}
|
package/src/create-asset.js
CHANGED
|
@@ -272,6 +272,11 @@ export const createAssetFactory = ({
|
|
|
272
272
|
addressHasHistory,
|
|
273
273
|
broadcastTx: (...args) => server.sendRawTransaction(...args),
|
|
274
274
|
createAccountState: () => accountStateClass,
|
|
275
|
+
hasLostPermission: ({ accountState }) => {
|
|
276
|
+
if (!eip7702Supported) return false
|
|
277
|
+
const delegation = accountState?.eip7702Delegation
|
|
278
|
+
return Boolean(delegation?.isDelegated) && !delegation?.isWhitelisted
|
|
279
|
+
},
|
|
275
280
|
createFeeMonitor,
|
|
276
281
|
createHistoryMonitor,
|
|
277
282
|
createToken,
|
|
@@ -4,6 +4,8 @@ import assert from 'minimalistic-assert'
|
|
|
4
4
|
|
|
5
5
|
import ClarityServer, { RPC_REQUEST_TIMEOUT } from './clarity.js'
|
|
6
6
|
|
|
7
|
+
const ASSETS_GATEWAY_URL = 'https://assets-gateway-clarity-api.a.exodus.io/assets'
|
|
8
|
+
|
|
7
9
|
export const encodeCursor = (blockNumberBigInt, isLegacy = false) => {
|
|
8
10
|
if (typeof blockNumberBigInt !== 'bigint') throw new Error('expected bigint')
|
|
9
11
|
|
|
@@ -93,16 +95,17 @@ const fetchHttpRequest = ({ baseApiPath, path, method, body }) => {
|
|
|
93
95
|
export default class ClarityServerV2 extends ClarityServer {
|
|
94
96
|
constructor({ baseAssetName, uri }) {
|
|
95
97
|
super({ baseAssetName, uri })
|
|
96
|
-
this.updateBaseApiPath()
|
|
98
|
+
this.updateBaseApiPath() // default to assets-gateway
|
|
97
99
|
}
|
|
98
100
|
|
|
99
|
-
updateBaseApiPath() {
|
|
100
|
-
|
|
101
|
+
updateBaseApiPath(uri) {
|
|
102
|
+
const base = uri || ASSETS_GATEWAY_URL
|
|
103
|
+
this.baseApiPath = new URL(`${base}/api/v2/${this.baseAssetName}`).toString()
|
|
101
104
|
}
|
|
102
105
|
|
|
103
106
|
setURI(uri) {
|
|
104
107
|
super.setURI(uri)
|
|
105
|
-
this.updateBaseApiPath()
|
|
108
|
+
this.updateBaseApiPath(uri) // pass in the uri from remote config to override assets-gateway
|
|
106
109
|
}
|
|
107
110
|
|
|
108
111
|
getTransactionsAtBlockNumber = async ({ address, blockNumber, withInput = true }) => {
|
|
@@ -16,6 +16,7 @@ export default class ClarityServer extends EventEmitter {
|
|
|
16
16
|
super()
|
|
17
17
|
this.baseAssetName = baseAssetName
|
|
18
18
|
this.uri = uri
|
|
19
|
+
this.wsUri = uri
|
|
19
20
|
this.defaultUri = uri
|
|
20
21
|
this.baseNamespace = `/v1/${this.baseAssetName}`
|
|
21
22
|
this.sockets = Object.create(null)
|
|
@@ -23,6 +24,12 @@ export default class ClarityServer extends EventEmitter {
|
|
|
23
24
|
}
|
|
24
25
|
|
|
25
26
|
setURI(uri) {
|
|
27
|
+
if (!uri.includes('assets-gateway')) {
|
|
28
|
+
// assets-gateway endpoint doesn't support legacy ws
|
|
29
|
+
// guard this against remote config override
|
|
30
|
+
this.wsUri = uri
|
|
31
|
+
}
|
|
32
|
+
|
|
26
33
|
this.dispose()
|
|
27
34
|
this.uri = uri
|
|
28
35
|
}
|
|
@@ -59,7 +66,7 @@ export default class ClarityServer extends EventEmitter {
|
|
|
59
66
|
}
|
|
60
67
|
|
|
61
68
|
createSocket(namespace) {
|
|
62
|
-
return io(`${this.
|
|
69
|
+
return io(`${this.wsUri}${namespace}`, {
|
|
63
70
|
transports: ['websocket', 'polling'],
|
|
64
71
|
extraHeaders: { 'User-Agent': 'exodus' },
|
|
65
72
|
reconnection: true,
|
package/src/get-fee.js
CHANGED
|
@@ -109,13 +109,14 @@ export const getFeeFactory =
|
|
|
109
109
|
return { ...maybeReturnTipGasPrice, fee, gasPrice, extraFeeData }
|
|
110
110
|
}
|
|
111
111
|
|
|
112
|
-
// TODO: sanity check this usage
|
|
113
112
|
// Used in Mobile
|
|
114
|
-
export const getExtraFeeForBump = ({ tx, feeData, balance, unconfirmedBalance }) => {
|
|
113
|
+
export const getExtraFeeForBump = ({ baseAsset, tx, feeData, balance, unconfirmedBalance }) => {
|
|
114
|
+
assert(baseAsset, 'expected baseAsset')
|
|
115
|
+
|
|
115
116
|
if (!balance || !unconfirmedBalance) return null
|
|
116
117
|
const { gasPrice: currentGasPrice, eip1559Enabled, baseFeePerGas: currentBaseFee } = feeData
|
|
117
118
|
const { bumpedGasPrice } = calculateBumpedGasPrice({
|
|
118
|
-
baseAsset
|
|
119
|
+
baseAsset,
|
|
119
120
|
tx,
|
|
120
121
|
currentGasPrice,
|
|
121
122
|
currentBaseFee,
|
package/src/tx-create.js
CHANGED
|
@@ -159,6 +159,63 @@ const resolveTxFactoryGasPrices = async ({
|
|
|
159
159
|
}
|
|
160
160
|
}
|
|
161
161
|
|
|
162
|
+
// Pre-broadcast safety check for RBF replacements.
|
|
163
|
+
//
|
|
164
|
+
// Clarity can lag behind the node: it may still report a tx as pending after
|
|
165
|
+
// the node has evicted it, or show a queued (gapped) tx as acceleratable.
|
|
166
|
+
// Broadcasting an RBF for a gapped tx — one whose predecessor slot is empty in
|
|
167
|
+
// the node's mempool — produces ErrFutureReplacePending.
|
|
168
|
+
//
|
|
169
|
+
// This check is best-effort: if either RPC call fails (network error, unsupported
|
|
170
|
+
// endpoint, etc.) we fall through and let the broadcast surface the error.
|
|
171
|
+
async function verifyBumpTxCanReplace({ baseAsset, bumpTxId, fromAddress, nonce }) {
|
|
172
|
+
let rpcTx, pendingNonceHex
|
|
173
|
+
|
|
174
|
+
try {
|
|
175
|
+
;[rpcTx, pendingNonceHex] = await Promise.all([
|
|
176
|
+
baseAsset.server.getTransactionByHash(bumpTxId),
|
|
177
|
+
baseAsset.server.getTransactionCount(fromAddress, 'pending'),
|
|
178
|
+
])
|
|
179
|
+
} catch (err) {
|
|
180
|
+
console.warn(
|
|
181
|
+
`verifyBumpTxCanReplace: pre-broadcast RPC check failed for ${bumpTxId}, falling through`,
|
|
182
|
+
err.message
|
|
183
|
+
)
|
|
184
|
+
return
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
if (!rpcTx) {
|
|
188
|
+
// The tx was dropped from the node's mempool — Clarity hasn't caught up yet.
|
|
189
|
+
// TODO: eagerly mark this tx as dropped in the tx log so the UI updates
|
|
190
|
+
// immediately instead of waiting for Clarity's next polling cycle.
|
|
191
|
+
throw new Error(
|
|
192
|
+
`ERR_BUMP_TX_DROPPED: Cannot bump transaction ${bumpTxId}: transaction was dropped from the network`
|
|
193
|
+
)
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
// pendingNonce = 4
|
|
197
|
+
// [0][1][2][3]{4}{5}{6}...
|
|
198
|
+
// ^--- next empty slot (pendingNonce)
|
|
199
|
+
//
|
|
200
|
+
// Nonce to replace must be < pendingNonce (i.e. slot is already accounted for).
|
|
201
|
+
// If nonce >= pendingNonce, the slot is empty or gapped — not safe to replace.
|
|
202
|
+
const pendingNonce = parseInt(pendingNonceHex, 16)
|
|
203
|
+
if (pendingNonce <= nonce) {
|
|
204
|
+
// A predecessor tx was dropped by the node, leaving a gap below this tx.
|
|
205
|
+
// The tx itself is still in the node's queued pool but can't execute until
|
|
206
|
+
// the missing nonce slot is filled.
|
|
207
|
+
// TODO: identify the dropped predecessor (scan nonces from pendingNonce to
|
|
208
|
+
// nonce - 1), mark it as dropped in the tx log, and surface a clear message
|
|
209
|
+
// to the user: "a previous transaction was dropped — send a new transaction
|
|
210
|
+
// first, then you'll be able to accelerate this one."
|
|
211
|
+
throw new Error(
|
|
212
|
+
`ERR_BUMP_TX_NONCE_GAP: Cannot bump transaction ${bumpTxId}: nonce gap detected — ` +
|
|
213
|
+
`node's pending nonce (${pendingNonce}) ≤ tx nonce (${nonce}), ` +
|
|
214
|
+
`broadcasting would produce ErrFutureReplacePending`
|
|
215
|
+
)
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
|
|
162
219
|
const createBumpUnsignedTx = async ({
|
|
163
220
|
fromAddress,
|
|
164
221
|
chainId,
|
|
@@ -223,6 +280,8 @@ const createBumpUnsignedTx = async ({
|
|
|
223
280
|
|
|
224
281
|
const nonce = maybeProvidedNonce ?? replacedTxNonce
|
|
225
282
|
|
|
283
|
+
await verifyBumpTxCanReplace({ baseAsset, bumpTxId, fromAddress, nonce })
|
|
284
|
+
|
|
226
285
|
const resolvedTxAttributes = await resolveTxAttributesByTxType({
|
|
227
286
|
asset,
|
|
228
287
|
assetClientInterface,
|