@exodus/ethereum-api 8.37.0 → 8.38.1
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 +2 -4
- package/src/create-asset-utils.js +23 -2
- package/src/create-asset.js +11 -3
- package/src/get-balances.js +3 -1
- package/src/tx-send/nonce-utils.js +2 -1
- package/src/tx-send/tx-send.js +22 -4
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.38.1](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-api@8.38.0...@exodus/ethereum-api@8.38.1) (2025-06-19)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
* fix: include l1 in fee (#5895)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
## [8.38.0](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-api@8.37.0...@exodus/ethereum-api@8.38.0) (2025-06-17)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
### Features
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
* feat: clarity basemainnet (#5876)
|
|
23
|
+
|
|
24
|
+
* feat: enable evm transaction privacy (#5869)
|
|
25
|
+
|
|
26
|
+
* feat: remove eth sepolia and goerli (#5885)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
6
30
|
## [8.37.0](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-api@8.36.0...@exodus/ethereum-api@8.37.0) (2025-06-12)
|
|
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.38.1",
|
|
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",
|
|
@@ -52,8 +52,6 @@
|
|
|
52
52
|
"@exodus/assets-testing": "^1.0.0",
|
|
53
53
|
"@exodus/bsc-meta": "^2.1.2",
|
|
54
54
|
"@exodus/ethereumarbone-meta": "^2.0.3",
|
|
55
|
-
"@exodus/ethereumgoerli-meta": "^2.0.1",
|
|
56
|
-
"@exodus/ethereumsepolia-meta": "^2.0.1",
|
|
57
55
|
"@exodus/fantommainnet-meta": "^2.0.2",
|
|
58
56
|
"@exodus/rootstock-meta": "^2.0.3"
|
|
59
57
|
},
|
|
@@ -64,5 +62,5 @@
|
|
|
64
62
|
"type": "git",
|
|
65
63
|
"url": "git+https://github.com/ExodusMovement/assets.git"
|
|
66
64
|
},
|
|
67
|
-
"gitHead": "
|
|
65
|
+
"gitHead": "29460910f5183b5f2c5298f806e837050df0ecdf"
|
|
68
66
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import assert from 'assert'
|
|
1
|
+
import assert from 'minimalistic-assert'
|
|
2
2
|
|
|
3
|
-
import { ValidMonitorTypes } from './exodus-eth-server/index.js'
|
|
3
|
+
import { createEvmServer, ValidMonitorTypes } from './exodus-eth-server/index.js'
|
|
4
4
|
|
|
5
5
|
// Determines the appropriate `monitorType`, `serverUrl` and `monitorInterval`
|
|
6
6
|
// to use for a given config.
|
|
@@ -53,3 +53,24 @@ export const resolveMonitorSettings = (
|
|
|
53
53
|
// Permit the `monitorType` and `serverUrl` to be overrided.
|
|
54
54
|
return { ...defaultResolution, monitorType: overrideMonitorType, serverUrl: overrideServerUrl }
|
|
55
55
|
}
|
|
56
|
+
|
|
57
|
+
export const createBroadcastTxFactory = ({ assetName, server, privacyRpcUrl }) => {
|
|
58
|
+
assert(server, 'expected server')
|
|
59
|
+
|
|
60
|
+
const defaultResult = {
|
|
61
|
+
broadcastTx: (...args) => server.sendRawTransaction(...args),
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if (!privacyRpcUrl) return defaultResult
|
|
65
|
+
|
|
66
|
+
const privacyServer = createEvmServer({
|
|
67
|
+
assetName,
|
|
68
|
+
serverUrl: privacyRpcUrl,
|
|
69
|
+
monitorType: 'no-history',
|
|
70
|
+
})
|
|
71
|
+
|
|
72
|
+
return {
|
|
73
|
+
...defaultResult,
|
|
74
|
+
broadcastPrivateTx: (...args) => privacyServer.sendRawTransaction(...args),
|
|
75
|
+
}
|
|
76
|
+
}
|
package/src/create-asset.js
CHANGED
|
@@ -22,7 +22,7 @@ import assert from 'minimalistic-assert'
|
|
|
22
22
|
import ms from 'ms'
|
|
23
23
|
|
|
24
24
|
import { addressHasHistoryFactory } from './address-has-history.js'
|
|
25
|
-
import { resolveMonitorSettings } from './create-asset-utils.js'
|
|
25
|
+
import { createBroadcastTxFactory, resolveMonitorSettings } from './create-asset-utils.js'
|
|
26
26
|
import { createTokenFactory } from './create-token-factory.js'
|
|
27
27
|
import { createCustomFeesApi } from './custom-fees.js'
|
|
28
28
|
import { createEvmServer } from './exodus-eth-server/index.js'
|
|
@@ -108,6 +108,7 @@ export const createAssetFactory = ({
|
|
|
108
108
|
customTokens,
|
|
109
109
|
supportsCustomFees,
|
|
110
110
|
useAbsoluteBalanceAndNonce: overrideUseAbsoluteBalanceAndNonce,
|
|
111
|
+
privacyRpcUrl,
|
|
111
112
|
} = configWithOverrides
|
|
112
113
|
|
|
113
114
|
const asset = assets[base.name]
|
|
@@ -265,10 +266,15 @@ export const createAssetFactory = ({
|
|
|
265
266
|
? getL1GetFeeFactory({ asset, originalGetFee })
|
|
266
267
|
: originalGetFee
|
|
267
268
|
|
|
269
|
+
const { broadcastTx, broadcastPrivateTx } = createBroadcastTxFactory({
|
|
270
|
+
assetName: asset.name,
|
|
271
|
+
server,
|
|
272
|
+
privacyRpcUrl,
|
|
273
|
+
})
|
|
274
|
+
|
|
268
275
|
const api = {
|
|
269
|
-
getActivityTxs,
|
|
270
276
|
addressHasHistory,
|
|
271
|
-
broadcastTx
|
|
277
|
+
broadcastTx,
|
|
272
278
|
createAccountState: () => accountStateClass,
|
|
273
279
|
createFeeMonitor,
|
|
274
280
|
createHistoryMonitor,
|
|
@@ -277,6 +283,7 @@ export const createAssetFactory = ({
|
|
|
277
283
|
customFees: createCustomFeesApi({ baseAsset: asset }),
|
|
278
284
|
defaultAddressPath,
|
|
279
285
|
features,
|
|
286
|
+
getActivityTxs,
|
|
280
287
|
getBalances,
|
|
281
288
|
getBalanceForAddress: createGetBalanceForAddress({ asset, server }),
|
|
282
289
|
getConfirmationsNumber: () => confirmationsNumber,
|
|
@@ -318,6 +325,7 @@ export const createAssetFactory = ({
|
|
|
318
325
|
chainId,
|
|
319
326
|
monitorType,
|
|
320
327
|
estimateL1DataFee,
|
|
328
|
+
broadcastPrivateTx,
|
|
321
329
|
forceGasLimitEstimation,
|
|
322
330
|
server,
|
|
323
331
|
...(erc20FuelBuffer && { erc20FuelBuffer }),
|
package/src/get-balances.js
CHANGED
|
@@ -18,7 +18,9 @@ export const getAbsoluteBalance = ({ asset, txLog }) => {
|
|
|
18
18
|
let balance = asset.currency.ZERO
|
|
19
19
|
let hasAbsoluteBalance = false
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
const reversedTxLog = txLog.reverse()
|
|
22
|
+
|
|
23
|
+
for (const tx of reversedTxLog) {
|
|
22
24
|
if (tx.data.balanceChange) {
|
|
23
25
|
hasAbsoluteBalance = true
|
|
24
26
|
balance = balance.add(asset.currency.baseUnit(tx.data.balanceChange.to))
|
|
@@ -28,7 +28,8 @@ export const resolveNonce = async ({
|
|
|
28
28
|
export const getNonceFromTxLog = ({ txLog, useAbsoluteNonce }) => {
|
|
29
29
|
let absoluteNonce = 0
|
|
30
30
|
if (useAbsoluteNonce) {
|
|
31
|
-
|
|
31
|
+
const reversedTxLog = txLog.reverse()
|
|
32
|
+
for (const tx of reversedTxLog) {
|
|
32
33
|
if (tx.data.nonceChange) {
|
|
33
34
|
absoluteNonce = parseInt(tx.data.nonceChange.to, 10)
|
|
34
35
|
break
|
package/src/tx-send/tx-send.js
CHANGED
|
@@ -80,7 +80,7 @@ const txSendFactory = ({ assetClientInterface, createUnsignedTx, useAbsoluteBala
|
|
|
80
80
|
isSendAll,
|
|
81
81
|
isHardware,
|
|
82
82
|
} = options
|
|
83
|
-
let { txInput } = options // avoid let!
|
|
83
|
+
let { txInput, feeAmount: providedFeeAmount } = options // avoid let!
|
|
84
84
|
|
|
85
85
|
const feeOpts = {
|
|
86
86
|
gasPrice: options.gasPrice,
|
|
@@ -225,11 +225,10 @@ const txSendFactory = ({ assetClientInterface, createUnsignedTx, useAbsoluteBala
|
|
|
225
225
|
isSendAll,
|
|
226
226
|
createUnsignedTx,
|
|
227
227
|
feeData,
|
|
228
|
+
providedFeeAmount,
|
|
228
229
|
}
|
|
229
230
|
|
|
230
|
-
let { txId, rawTx, nonce, gasLimit, tipGasPrice,
|
|
231
|
-
|
|
232
|
-
const feeAmount = gasPrice.mul(gasLimit)
|
|
231
|
+
let { txId, rawTx, nonce, gasLimit, tipGasPrice, feeAmount } = await createTx(createTxParams)
|
|
233
232
|
|
|
234
233
|
try {
|
|
235
234
|
await baseAsset.api.broadcastTx(rawTx.toString('hex'))
|
|
@@ -378,6 +377,7 @@ const createTx = async ({
|
|
|
378
377
|
feeOpts,
|
|
379
378
|
createUnsignedTx,
|
|
380
379
|
feeData,
|
|
380
|
+
providedFeeAmount,
|
|
381
381
|
}) => {
|
|
382
382
|
assert(
|
|
383
383
|
nonce !== undefined && typeof nonce === 'number',
|
|
@@ -470,6 +470,23 @@ const createTx = async ({
|
|
|
470
470
|
|
|
471
471
|
unsignedTx.txMeta.eip1559Enabled = eip1559Enabled
|
|
472
472
|
|
|
473
|
+
const resolveFee = async () => {
|
|
474
|
+
if (providedFeeAmount) {
|
|
475
|
+
return providedFeeAmount
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
const optimismL1DataFee = asset.baseAsset.estimateL1DataFee
|
|
479
|
+
? await asset.baseAsset.estimateL1DataFee({
|
|
480
|
+
unsignedTx,
|
|
481
|
+
})
|
|
482
|
+
: undefined
|
|
483
|
+
|
|
484
|
+
const l1DataFee = optimismL1DataFee
|
|
485
|
+
? asset.baseAsset.currency.baseUnit(optimismL1DataFee)
|
|
486
|
+
: asset.baseAsset.currency.ZERO
|
|
487
|
+
return gasPrice.mul(gasLimit).add(l1DataFee)
|
|
488
|
+
}
|
|
489
|
+
|
|
473
490
|
const { txId, rawTx } = await assetClientInterface.signTransaction({
|
|
474
491
|
assetName: asset.baseAsset.name,
|
|
475
492
|
unsignedTx,
|
|
@@ -483,6 +500,7 @@ const createTx = async ({
|
|
|
483
500
|
gasLimit,
|
|
484
501
|
gasPrice,
|
|
485
502
|
tipGasPrice,
|
|
503
|
+
feeAmount: await resolveFee(),
|
|
486
504
|
}
|
|
487
505
|
}
|
|
488
506
|
|