@ledgerhq/coin-evm 5.2.0 → 5.3.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.
Files changed (75) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/lib/logic/getBalance.d.ts.map +1 -1
  3. package/lib/logic/getBalance.js +19 -13
  4. package/lib/logic/getBalance.js.map +1 -1
  5. package/lib/logic/getStakes.d.ts +2 -2
  6. package/lib/logic/getStakes.d.ts.map +1 -1
  7. package/lib/logic/getStakes.js +6 -3
  8. package/lib/logic/getStakes.js.map +1 -1
  9. package/lib/logic/listOperations.d.ts.map +1 -1
  10. package/lib/logic/listOperations.js +3 -0
  11. package/lib/logic/listOperations.js.map +1 -1
  12. package/lib/network/explorer/etherscan.d.ts.map +1 -1
  13. package/lib/network/explorer/etherscan.js +8 -4
  14. package/lib/network/explorer/etherscan.js.map +1 -1
  15. package/lib/network/node/rpc.common.d.ts.map +1 -1
  16. package/lib/network/node/rpc.common.js +42 -12
  17. package/lib/network/node/rpc.common.js.map +1 -1
  18. package/lib/network/node/rpc.errors.d.ts +1 -0
  19. package/lib/network/node/rpc.errors.d.ts.map +1 -1
  20. package/lib/network/node/rpc.errors.js +22 -0
  21. package/lib/network/node/rpc.errors.js.map +1 -1
  22. package/lib/staking/fetchers.d.ts.map +1 -1
  23. package/lib/staking/fetchers.js +1 -0
  24. package/lib/staking/fetchers.js.map +1 -1
  25. package/lib/staking/validators/monad.d.ts +3 -3
  26. package/lib/staking/validators/monad.d.ts.map +1 -1
  27. package/lib/staking/validators/monad.js +42 -3
  28. package/lib/staking/validators/monad.js.map +1 -1
  29. package/lib/types/staking.d.ts +3 -2
  30. package/lib/types/staking.d.ts.map +1 -1
  31. package/lib-es/logic/getBalance.d.ts.map +1 -1
  32. package/lib-es/logic/getBalance.js +19 -13
  33. package/lib-es/logic/getBalance.js.map +1 -1
  34. package/lib-es/logic/getStakes.d.ts +2 -2
  35. package/lib-es/logic/getStakes.d.ts.map +1 -1
  36. package/lib-es/logic/getStakes.js +6 -3
  37. package/lib-es/logic/getStakes.js.map +1 -1
  38. package/lib-es/logic/listOperations.d.ts.map +1 -1
  39. package/lib-es/logic/listOperations.js +3 -0
  40. package/lib-es/logic/listOperations.js.map +1 -1
  41. package/lib-es/network/explorer/etherscan.d.ts.map +1 -1
  42. package/lib-es/network/explorer/etherscan.js +8 -4
  43. package/lib-es/network/explorer/etherscan.js.map +1 -1
  44. package/lib-es/network/node/rpc.common.d.ts.map +1 -1
  45. package/lib-es/network/node/rpc.common.js +43 -13
  46. package/lib-es/network/node/rpc.common.js.map +1 -1
  47. package/lib-es/network/node/rpc.errors.d.ts +1 -0
  48. package/lib-es/network/node/rpc.errors.d.ts.map +1 -1
  49. package/lib-es/network/node/rpc.errors.js +21 -0
  50. package/lib-es/network/node/rpc.errors.js.map +1 -1
  51. package/lib-es/staking/fetchers.d.ts.map +1 -1
  52. package/lib-es/staking/fetchers.js +2 -1
  53. package/lib-es/staking/fetchers.js.map +1 -1
  54. package/lib-es/staking/validators/monad.d.ts +3 -3
  55. package/lib-es/staking/validators/monad.d.ts.map +1 -1
  56. package/lib-es/staking/validators/monad.js +40 -2
  57. package/lib-es/staking/validators/monad.js.map +1 -1
  58. package/lib-es/types/staking.d.ts +3 -2
  59. package/lib-es/types/staking.d.ts.map +1 -1
  60. package/package.json +2 -2
  61. package/src/api/index.integ.test.ts +17 -0
  62. package/src/logic/getBalance.ts +26 -21
  63. package/src/logic/getStakes.ts +15 -6
  64. package/src/logic/listOperations.test.ts +72 -0
  65. package/src/logic/listOperations.ts +3 -0
  66. package/src/network/explorer/etherscan.test.ts +35 -0
  67. package/src/network/explorer/etherscan.ts +8 -4
  68. package/src/network/node/rpc.common.ts +42 -15
  69. package/src/network/node/rpc.errors.test.ts +30 -0
  70. package/src/network/node/rpc.errors.ts +26 -0
  71. package/src/network/node/rpc.test.ts +61 -0
  72. package/src/staking/fetchers.ts +2 -1
  73. package/src/staking/validators/monad.test.ts +102 -1
  74. package/src/staking/validators/monad.ts +56 -4
  75. package/src/types/staking.ts +4 -2
@@ -1,5 +1,5 @@
1
1
  import type { EvmConfigInfo } from '../config';
2
- import type { Stake } from '@ledgerhq/coin-module-framework/api/types';
2
+ import type { MemoNotSupported, Operation, Stake } from '@ledgerhq/coin-module-framework/api/types';
3
3
  import type BigNumber from 'bignumber.js';
4
4
  export type EvmStakingOperationType = 'DELEGATE' | 'UNDELEGATE' | 'REDELEGATE' | 'WITHDRAW_UNBONDED' | 'REWARD';
5
5
  export type StakingOperation = 'delegate' | 'undelegate' | 'redelegate' | 'withdraw' | 'getStakedBalance' | 'getUnstakedBalance' | 'claimReward' | 'compoundReward';
@@ -190,12 +190,13 @@ export type SeiDelegation = {
190
190
  balance: SeiDelegationBalance;
191
191
  delegation: SeiDelegationDetails;
192
192
  };
193
- export type StakingFetcher = (evmConfig: EvmConfigInfo, address: string, config: StakingContractConfig, currencyId: string) => Promise<Stake[]>;
193
+ export type StakingFetcher = (evmConfig: EvmConfigInfo, address: string, config: StakingContractConfig, currencyId: string, knownValIds?: string[]) => Promise<Stake[]>;
194
194
  /**
195
195
  * Configuration for a staking strategy
196
196
  */
197
197
  export type StakingStrategy = {
198
198
  fetcher: StakingFetcher;
199
+ extractKnownValIds?: (currencyId: string, ops: Array<Operation<MemoNotSupported>>) => string[];
199
200
  };
200
201
  /**
201
202
  * Function signature for amount extractors
@@ -1 +1 @@
1
- {"version":3,"file":"staking.d.ts","sourceRoot":"","sources":["../../src/types/staking.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAA;AAC9C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,2CAA2C,CAAA;AACtE,OAAO,KAAK,SAAS,MAAM,cAAc,CAAA;AAEzC,MAAM,MAAM,uBAAuB,GAC/B,UAAU,GACV,YAAY,GACZ,YAAY,GACZ,mBAAmB,GACnB,QAAQ,CAAA;AAEZ,MAAM,MAAM,gBAAg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
  "keywords": [
6
6
  "Ledger",
@@ -51,7 +51,7 @@
51
51
  "eip55": "^2.1.1",
52
52
  "ethers": "6.15.0",
53
53
  "react-native-get-random-values": "^1.8.0",
54
- "@ledgerhq/coin-module-framework": "^8.2.0"
54
+ "@ledgerhq/coin-module-framework": "^8.5.0"
55
55
  },
56
56
  "peerDependencies": {
57
57
  "@ledgerhq/live-network": "^3.0.0",
@@ -1137,5 +1137,22 @@ describe('EVM Api (Zero Gravity)', () => {
1137
1137
  expect(blockTime).toBeGreaterThan(cutoff)
1138
1138
  })
1139
1139
  }, 60000)
1140
+
1141
+ it('fills ERC20 tx.block.hash from the parent txlist row when tokentx omits it', async () => {
1142
+ // Regression: chainscan.0g.ai tokentx has no blockHash. Native txlist does, so token
1143
+ // ops must inherit it. Account 0x66c4371a… has ERC20 transfers that used to miss the hash.
1144
+ const address = '0x66c4371ae8ffed2ec1c2ebbbccfb7e494181e1e3'
1145
+ const result = await module.listOperations(context, address, {
1146
+ minHeight: 0,
1147
+ order: 'asc',
1148
+ limit: 256,
1149
+ })
1150
+
1151
+ const erc20Ops = result.items.filter((op) => op.asset.type === 'erc20')
1152
+ expect(erc20Ops.length).toBeGreaterThan(0)
1153
+ result.items.forEach((op) => {
1154
+ expect(op.tx.block.hash).toMatch(/^0x[A-Fa-f0-9]{64}$/)
1155
+ })
1156
+ }, 60000)
1140
1157
  })
1141
1158
  })
@@ -13,6 +13,7 @@ import { getExplorerApi } from '../network/explorer'
13
13
  import { ExplorerApi } from '../network/explorer/types'
14
14
  import { getNodeApi } from '../network/node'
15
15
  import { NodeApi } from '../network/node/types'
16
+ import { STAKING_CONFIG } from '../staking'
16
17
  import { getStakes } from './getStakes'
17
18
 
18
19
  export const TOKEN_BALANCE_BATCH_SIZE = 8
@@ -67,10 +68,27 @@ async function getTokenBalances(
67
68
  ): Promise<Balance[]> {
68
69
  const balances: Balance[] = []
69
70
 
70
- // Execute staking and token operations in parallel for better performance
71
- const [stakingResult, tokenOperationsResult] = await Promise.allSettled([
72
- getStakes(context, currencyId, address),
73
- explorerApi.getOperations(config, currencyId, address, 0),
71
+ const opsResult = await explorerApi
72
+ .getOperations(config, currencyId, address, 0)
73
+ .catch(() => null)
74
+ const lastCoinOperations = opsResult?.lastCoinOperations ?? []
75
+ const lastTokenOperations = opsResult?.lastTokenOperations ?? []
76
+
77
+ const knownValidatorIds = STAKING_CONFIG[currencyId]?.extractKnownValIds?.(
78
+ currencyId,
79
+ lastCoinOperations
80
+ )
81
+
82
+ // Contracts whose ERC20 balance mirrors the native balance — skip them here to avoid
83
+ // counting the same value twice (the native balance is already returned upstream).
84
+ const { nativeContracts = [] } = config
85
+ const nativeContractsSet = new Set(nativeContracts.map((c) => c.toLowerCase()))
86
+
87
+ // Staking and token-asset collection run in parallel; both depend only on the
88
+ // operations result fetched above.
89
+ const [stakingResult, tokenAssetsResult] = await Promise.allSettled([
90
+ getStakes(context, currencyId, address, { knownValidatorIds }),
91
+ collectTokenAssets(lastTokenOperations, address, nativeContractsSet, options),
74
92
  ])
75
93
 
76
94
  // Add staking positions to balances (with error handling)
@@ -84,23 +102,10 @@ async function getTokenBalances(
84
102
  })
85
103
  }
86
104
 
87
- // Process token operations (with error handling)
88
- const lastTokenOperations =
89
- tokenOperationsResult.status === 'fulfilled'
90
- ? tokenOperationsResult.value.lastTokenOperations
91
- : []
92
-
93
- // Contracts whose ERC20 balance mirrors the native balance — skip them here to avoid
94
- // counting the same value twice (the native balance is already returned upstream).
95
- const { nativeContracts = [] } = config
96
- const nativeContractsSet = new Set(nativeContracts.map((c) => c.toLowerCase()))
97
-
98
- const { contracts, assets } = await collectTokenAssets(
99
- lastTokenOperations,
100
- address,
101
- nativeContractsSet,
102
- options
103
- )
105
+ const { contracts, assets } =
106
+ tokenAssetsResult.status === 'fulfilled'
107
+ ? tokenAssetsResult.value
108
+ : { contracts: new Set<string>(), assets: new Map<string, AssetInfo>() }
104
109
 
105
110
  // Fetch balances in parallel (by batches)
106
111
  const contractsArray = Array.from(contracts)
@@ -2,25 +2,34 @@
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
4
  import type { EvmContext } from '../config'
5
- import { Page, Stake } from '@ledgerhq/coin-module-framework/api/types'
5
+ import { Page, Stake, StakesOptions } from '@ledgerhq/coin-module-framework/api/types'
6
6
  import { STAKING_CONTRACTS, STAKING_CONFIG } from '../staking'
7
7
 
8
8
  export const getStakes = async (
9
9
  context: EvmContext,
10
10
  currencyId: string,
11
- address: string
11
+ address: string,
12
+ options?: StakesOptions
12
13
  ): Promise<Page<Stake>> => {
13
14
  const contractConfig = STAKING_CONTRACTS[currencyId]
14
-
15
15
  if (!contractConfig) {
16
16
  return { items: [] }
17
17
  }
18
18
 
19
+ const stakingStrategy = STAKING_CONFIG[currencyId]
20
+ if (!stakingStrategy) {
21
+ return { items: [] }
22
+ }
23
+
19
24
  try {
20
25
  const config = await context.config(currencyId)
21
- const stakingStrategy = STAKING_CONFIG[currencyId]
22
- const stakes =
23
- (await stakingStrategy?.fetcher(config, address, contractConfig, currencyId)) || []
26
+ const stakes = await stakingStrategy.fetcher(
27
+ config,
28
+ address,
29
+ contractConfig,
30
+ currencyId,
31
+ options?.knownValidatorIds
32
+ )
24
33
  return { items: stakes }
25
34
  } catch {
26
35
  return { items: [] }
@@ -892,6 +892,78 @@ describe('listOperations', () => {
892
892
  expect(sameTxFees).toEqual([parentFee, parentFee])
893
893
  })
894
894
 
895
+ /**
896
+ * Some explorers (chainscan.0g.ai tokentx) omit blockHash on ERC20 rows while txlist has it.
897
+ * A token op keeps its own block.hash when present, and only falls back to the parent's.
898
+ */
899
+ it('falls back to the parent block.hash on token ops when the explorer token row omits it', async () => {
900
+ const testContext = ctxWithExplorer({ type: 'etherscan' })
901
+ const txHash = '0x6593efaefa1752c9ba92ba079fc9705daad1f67b3437b07139692e8e5b647021'
902
+ const parentBlockHash = '0x77fd02171913e7af2b4d76aeaca2bd70d36e112a66092790c4c2c8a57566a7e2'
903
+ const date = new Date('2026-02-16T09:25:37.000Z')
904
+
905
+ jest.spyOn(etherscanExplorer.explorerApi, 'getOperations').mockResolvedValue({
906
+ lastCoinOperations: [
907
+ {
908
+ id: 'native-fees',
909
+ type: 'FEES',
910
+ senders: [address],
911
+ recipients: ['0x8B598A7C136215A95ba0282b4d832B9f9801f2e2'],
912
+ value: 0n,
913
+ asset: { type: 'native' as const },
914
+ tx: {
915
+ hash: txHash,
916
+ block: { height: 24886171, hash: parentBlockHash, time: date },
917
+ fees: 997504000000000n,
918
+ feesPayer: address,
919
+ date,
920
+ failed: false,
921
+ },
922
+ details: { sequence: BigNumber(0) },
923
+ },
924
+ ],
925
+ lastTokenOperations: [
926
+ {
927
+ id: `${txHash}-erc20-0-IN`,
928
+ type: 'IN',
929
+ senders: ['0x8B598A7C136215A95ba0282b4d832B9f9801f2e2'],
930
+ recipients: [address],
931
+ value: 1263257n,
932
+ asset: {
933
+ type: 'erc20' as const,
934
+ assetReference: '0x1f3AA82227281cA364bFb3d253B0f1af1Da6473E',
935
+ assetOwner: address,
936
+ },
937
+ tx: {
938
+ hash: txHash,
939
+ block: { height: 24886171, time: date },
940
+ fees: 0n,
941
+ date,
942
+ failed: false,
943
+ },
944
+ details: {
945
+ ledgerOpType: 'IN',
946
+ assetAmount: '1263257',
947
+ assetSenders: ['0x8B598A7C136215A95ba0282b4d832B9f9801f2e2'],
948
+ assetRecipients: [address],
949
+ sequence: BigNumber(0),
950
+ },
951
+ },
952
+ ],
953
+ lastNftOperations: [],
954
+ lastInternalOperations: [],
955
+ nextPagingToken: '',
956
+ })
957
+
958
+ const { items } = await listOperations(testContext, '', address, {
959
+ minHeight: 0,
960
+ order: 'asc',
961
+ })
962
+
963
+ const tokenOp = items.find((op) => op.asset.type === 'erc20')
964
+ expect(tokenOp?.tx.block.hash).toBe(parentBlockHash)
965
+ })
966
+
895
967
  it('inherits the parent nonce on token ops, whose fees-only native op is dropped', async () => {
896
968
  // LIVE-35844: the Ledger explorer only reports the nonce on the native op
897
969
  const testContext = ctxWithExplorer({ type: 'ledger' })
@@ -107,6 +107,8 @@ export async function listOperations(
107
107
  // Gas is paid once per tx. Token/NFT sub-ops carry fees from their own explorer record (etherscan),
108
108
  // or inherit the parent tx (ledger explorer). Override to always use the parent's fees so the fee
109
109
  // is not double-counted and the fee payer is correct.
110
+ // block.hash falls back to the parent only when the token row has none: some explorers
111
+ // (chainscan.0g.ai tokentx) omit it while txlist carries it.
110
112
  const enrichTokenWithParent = (op: Operation<MemoNotSupported>): Operation<MemoNotSupported> => {
111
113
  const parent = parents[op.tx.hash]
112
114
  if (!parent) return op
@@ -124,6 +126,7 @@ export async function listOperations(
124
126
  ...op,
125
127
  tx: {
126
128
  ...op.tx,
129
+ block: { ...op.tx.block, hash: op.tx.block.hash || parent.tx.block.hash },
127
130
  fees: parent.tx.fees,
128
131
  failed: parent.tx.failed,
129
132
  ...(parent.tx.feesPayer ? { feesPayer: parent.tx.feesPayer } : {}),
@@ -147,6 +147,41 @@ describe('EVM Family', () => {
147
147
  })
148
148
  })
149
149
 
150
+ describe.each([
151
+ ['coin', ETHERSCAN_API.getCoinOperations],
152
+ ['ERC20', ETHERSCAN_API.getTokenOperations],
153
+ ['ERC721', ETHERSCAN_API.getERC721Operations],
154
+ ['ERC1155', ETHERSCAN_API.getERC1155Operations],
155
+ ])('%s operations with non-array explorer results', (_, getOperations) => {
156
+ afterEach(() => {
157
+ jest.clearAllMocks()
158
+ })
159
+
160
+ it.each([null, 'No transactions found'])(
161
+ 'returns an empty result when the explorer returns %p',
162
+ async (result) => {
163
+ jest.spyOn(axios, 'request').mockResolvedValueOnce({
164
+ data: { status: '0', message: 'No transactions found', result },
165
+ })
166
+
167
+ const response = await getOperations({
168
+ currencyId,
169
+ config: getCoinConfig(currencyId).info,
170
+ address,
171
+ fromBlock: 0,
172
+ sort: 'asc',
173
+ })
174
+
175
+ expect(response).toEqual({
176
+ operations: [],
177
+ isDone: true,
178
+ boundBlock: 0,
179
+ isPageFull: true,
180
+ })
181
+ }
182
+ )
183
+ })
184
+
150
185
  describe('getCoinOperations', () => {
151
186
  afterEach(() => {
152
187
  jest.clearAllMocks()
@@ -275,11 +275,12 @@ export const getCoinOperations = async (params: FetchOperationsParams): Promise<
275
275
  ? `${explorer.uri}/accounts/list_of_txs_by_address/${params.address}`
276
276
  : `${explorer.uri}?module=account&action=txlist&address=${params.address}`
277
277
 
278
- const ops = await fetchWithRetries<EtherscanOperation[]>({
278
+ const raw = await fetchWithRetries<EtherscanOperation[] | null | string>({
279
279
  method: 'GET',
280
280
  url,
281
281
  params: paginationParams(params),
282
282
  })
283
+ const ops = Array.isArray(raw) ? raw : []
283
284
 
284
285
  const operations = ops.flatMap((tx) =>
285
286
  etherscanOperationToOperations(params.address, params.currencyId, tx)
@@ -334,11 +335,12 @@ export const getTokenOperations = async (
334
335
  ? `${explorer.uri}/accounts/list_of_erc20_transfer_events_by_address/${params.address}`
335
336
  : `${explorer.uri}?module=account&action=tokentx&address=${params.address}`
336
337
 
337
- const ops = await fetchWithRetries<EtherscanERC20Event[]>({
338
+ const raw = await fetchWithRetries<EtherscanERC20Event[] | null | string>({
338
339
  method: 'GET',
339
340
  url,
340
341
  params: paginationParams(params),
341
342
  })
343
+ const ops = Array.isArray(raw) ? raw : []
342
344
 
343
345
  // Drop ERC20 Transfer events on contracts that mirror the native asset
344
346
  const nativeContractsSet = new Set((config.nativeContracts ?? []).map((c) => c.toLowerCase()))
@@ -388,11 +390,12 @@ export const getERC721Operations = async (
388
390
  ? `${explorer.uri}/accounts/list_of_erc721_transfer_events_by_address/${params.address}`
389
391
  : `${explorer.uri}?module=account&action=tokennfttx&address=${params.address}`
390
392
 
391
- const ops = await fetchWithRetries<EtherscanERC721Event[]>({
393
+ const raw = await fetchWithRetries<EtherscanERC721Event[] | null | string>({
392
394
  method: 'GET',
393
395
  url,
394
396
  params: paginationParams(params),
395
397
  })
398
+ const ops = Array.isArray(raw) ? raw : []
396
399
 
397
400
  // Why this thing ?
398
401
  // Multiple events can be fired by the same transactions and
@@ -435,11 +438,12 @@ export const getERC1155Operations = async (
435
438
  return EMPTY_RESULT
436
439
  }
437
440
 
438
- const ops = await fetchWithRetries<EtherscanERC1155Event[]>({
441
+ const raw = await fetchWithRetries<EtherscanERC1155Event[] | null | string>({
439
442
  method: 'GET',
440
443
  url: `${explorer.uri}?module=account&action=token1155tx&address=${params.address}`,
441
444
  params: paginationParams(params),
442
445
  })
446
+ const ops = Array.isArray(raw) ? raw : []
443
447
 
444
448
  // Why this thing ?
445
449
  // Multiple events can be fired by the same transactions and
@@ -17,6 +17,7 @@ import { withRetries } from '../withRetries'
17
17
  import { gethCallTracerToTraceBlockItems } from './gethCallTracerToTraceBlockItems'
18
18
  import {
19
19
  hasErrorCode,
20
+ isRpcMethodNotImplementedError,
20
21
  isUnsupportedRpcMethodErrorMsg,
21
22
  isUnsupportedRpcMethodError,
22
23
  } from './rpc.errors'
@@ -379,17 +380,46 @@ async function getFeeData(
379
380
  }
380
381
  > => {
381
382
  if (currencySupports1559) {
382
- const feeHistory: FeeHistory = await api.send('eth_feeHistory', [
383
- `0x${feeHistoryBlocks.toString(16)}`, // Fetching the history for N blocks (default 5)
384
- 'latest', // from the latest block
385
- [feeHistoryPercentile], // Nth percentile sample (default 50)
386
- ])
387
- // Taking the average priority fee used on the last N blocks
388
- const maxPriorityFeeAverage = feeHistory.reward
389
- ? feeHistory.reward
390
- .reduce((acc, [curr]) => acc.plus(new BigNumber(curr)), new BigNumber(0))
391
- .dividedToIntegerBy(feeHistory.reward.length)
392
- : new BigNumber(0)
383
+ let maxPriorityFeeAverage = new BigNumber(0)
384
+ let nextBaseFee: BigNumber
385
+
386
+ try {
387
+ const feeHistory: FeeHistory = await api.send('eth_feeHistory', [
388
+ `0x${feeHistoryBlocks.toString(16)}`, // Fetching the history for N blocks (default 5)
389
+ 'latest', // from the latest block
390
+ [feeHistoryPercentile], // Nth percentile sample (default 50)
391
+ ])
392
+ // Taking the average priority fee used on the last N blocks
393
+ maxPriorityFeeAverage = feeHistory.reward
394
+ ? feeHistory.reward
395
+ .reduce((acc, [curr]) => acc.plus(new BigNumber(curr)), new BigNumber(0))
396
+ .dividedToIntegerBy(feeHistory.reward.length)
397
+ : new BigNumber(0)
398
+ nextBaseFee = new BigNumber(feeHistory.baseFeePerGas[feeHistory.baseFeePerGas.length - 1])
399
+ } catch (error) {
400
+ if (!isRpcMethodNotImplementedError(error)) {
401
+ throw error
402
+ }
403
+ // Fallback when the node does not implement eth_feeHistory.
404
+ // Do not call ethers getFeeData(): it uses feeHistory internally.
405
+ //
406
+ // feeHistory nextBaseFee = predicted base fee of the *next* block.
407
+ // Here we use latest.baseFeePerGas (one block behind). maxFeePerGas
408
+ // still uses * 2, which covers several 12.5% EIP-1559 bumps.
409
+ //
410
+ // feeHistory tip = average of recent percentile rewards.
411
+ // eth_maxPriorityFeePerGas is the node's own tip heuristic. It can
412
+ // overpay or underpay versus the history median.
413
+ nextBaseFee = new BigNumber(block!.baseFeePerGas!.toString())
414
+ try {
415
+ maxPriorityFeeAverage = new BigNumber(await api.send('eth_maxPriorityFeePerGas', []))
416
+ } catch (priorityFeeError) {
417
+ if (!isRpcMethodNotImplementedError(priorityFeeError)) {
418
+ throw priorityFeeError
419
+ }
420
+ maxPriorityFeeAverage = new BigNumber(0)
421
+ }
422
+ }
393
423
 
394
424
  // A maxPriorityFeePerGas too low might make a transaction stuck forever
395
425
  // As a safety measure, if maxPriorityFeePerGas is zero
@@ -404,12 +434,9 @@ async function getFeeData(
404
434
  maxPriorityFeePerGas = minGasPriceFloor
405
435
  }
406
436
 
407
- const nextBaseFee = new BigNumber(
408
- feeHistory.baseFeePerGas[feeHistory.baseFeePerGas.length - 1]
409
- )
410
-
411
437
  return {
412
438
  maxPriorityFeePerGas,
439
+ // Same formula on both paths: cap = 2 * nextBaseFee + tip.
413
440
  maxFeePerGas: nextBaseFee.multipliedBy(2).plus(maxPriorityFeePerGas),
414
441
  nextBaseFee,
415
442
  }
@@ -0,0 +1,30 @@
1
+ // SPDX-FileCopyrightText: © 2026 LEDGER SAS
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ import { isRpcMethodNotImplementedError } from './rpc.errors'
5
+
6
+ describe('isRpcMethodNotImplementedError', () => {
7
+ it.each([
8
+ [{ code: -32601, message: 'method not found' }],
9
+ [{ code: -32000, message: 'method FeeHistory not support' }],
10
+ [{ code: -32601, message: 'the method eth_feeHistory does not exist/is not available' }],
11
+ [
12
+ {
13
+ code: 'UNKNOWN_ERROR',
14
+ error: { code: -32000, message: 'method FeeHistory not support' },
15
+ },
16
+ ],
17
+ [Object.assign(new Error('method FeeHistory not support'), { code: -32000 })],
18
+ ])('is true for %j', (error) => {
19
+ expect(isRpcMethodNotImplementedError(error)).toBe(true)
20
+ })
21
+
22
+ it.each([
23
+ [{ code: 'TIMEOUT', message: 'timeout' }],
24
+ [{ code: -32029, message: 'public rate limit exceeded' }],
25
+ [{ code: -32000, message: 'execution reverted' }],
26
+ [{ code: -32000, message: 'required historical state unavailable' }],
27
+ ])('is false for %j', (error) => {
28
+ expect(isRpcMethodNotImplementedError(error)).toBe(false)
29
+ })
30
+ })
@@ -26,6 +26,21 @@ export function isUnsupportedRpcMethodError(error: unknown): boolean {
26
26
  return collectRpcErrorFields(error).codes.some((code) => unsupportedCodes.has(code))
27
27
  }
28
28
 
29
+ /**
30
+ * Some nodes (e.g. Bitlayer) advertise a missing method with a generic code such as
31
+ * -32000 and a message like "method FeeHistory not support". Do not treat timeouts,
32
+ * rate limits, or other -32000 failures as "method missing".
33
+ */
34
+ const RPC_METHOD_NOT_IMPLEMENTED_MESSAGE =
35
+ /method.{0,80}(not found|not support(?:ed)?|not available|does not exist|is unsupported|is not implemented)|invalid method/i
36
+
37
+ export function isRpcMethodNotImplementedError(error: unknown): boolean {
38
+ if (isUnsupportedRpcMethodError(error)) return true
39
+ return collectRpcErrorFields(error).messages.some((m) =>
40
+ RPC_METHOD_NOT_IMPLEMENTED_MESSAGE.test(m)
41
+ )
42
+ }
43
+
29
44
  /**
30
45
  * call this function when RPC returns a generic code, like -32000 which can be used for different errors
31
46
  */
@@ -60,6 +75,17 @@ function collectRpcErrorFields(error: unknown): { codes: string[]; messages: str
60
75
  }
61
76
  visited.add(value)
62
77
 
78
+ // Error.message / .code are non-enumerable; Object.entries would skip them.
79
+ if (value instanceof Error) {
80
+ if (value.message) {
81
+ messages.push(value.message)
82
+ }
83
+ const errorCode = normalizeRpcErrorCode(Reflect.get(value, 'code'))
84
+ if (errorCode) {
85
+ codes.add(errorCode)
86
+ }
87
+ }
88
+
63
89
  for (const [key, field] of Object.entries(value)) {
64
90
  const code = extractRpcErrorCode(key, field)
65
91
  if (code) {
@@ -779,6 +779,67 @@ describe('EVM Family', () => {
779
779
  })
780
780
  })
781
781
 
782
+ it('falls back to eth_maxPriorityFeePerGas and the latest base fee when eth_feeHistory is unavailable', async () => {
783
+ jest.spyOn(JsonRpcProvider.prototype, 'send').mockImplementation(async (method) => {
784
+ if (method === 'eth_feeHistory') {
785
+ throw Object.assign(new Error('method FeeHistory not support'), { code: -32000 })
786
+ }
787
+ if (method === 'eth_maxPriorityFeePerGas') {
788
+ return '0x17d7840'
789
+ }
790
+ })
791
+
792
+ expect(
793
+ await nodeApi.getFeeData(getCoinConfig(currencyId).info, currencyId, eip1559Tx)
794
+ ).toEqual({
795
+ maxFeePerGas: new BigNumber('25000246'),
796
+ maxPriorityFeePerGas: new BigNumber('25000000'),
797
+ gasPrice: null,
798
+ nextBaseFee: new BigNumber('123'),
799
+ })
800
+ })
801
+
802
+ it.each([
803
+ ['TIMEOUT', Object.assign(new Error('timeout'), { code: 'TIMEOUT' })],
804
+ ['rate limit', Object.assign(new Error('public rate limit exceeded'), { code: -32029 })],
805
+ ])('does not fall back when eth_feeHistory fails with %s', async (_label, feeHistoryError) => {
806
+ const sendSpy = jest
807
+ .spyOn(JsonRpcProvider.prototype, 'send')
808
+ .mockImplementation(async (method) => {
809
+ if (method === 'eth_feeHistory') {
810
+ throw feeHistoryError
811
+ }
812
+ if (method === 'eth_maxPriorityFeePerGas') {
813
+ return '0x17d7840'
814
+ }
815
+ })
816
+
817
+ await expect(
818
+ nodeApi.getFeeData(getCoinConfig(currencyId).info, currencyId, eip1559Tx)
819
+ ).rejects.toThrow(feeHistoryError.message)
820
+ expect(sendSpy).not.toHaveBeenCalledWith('eth_maxPriorityFeePerGas', expect.anything())
821
+ })
822
+
823
+ it('does not fall back when eth_maxPriorityFeePerGas fails for a reason other than an unsupported method', async () => {
824
+ jest.spyOn(JsonRpcProvider.prototype, 'send').mockImplementation(async (method) => {
825
+ if (method === 'eth_feeHistory') {
826
+ throw Object.assign(
827
+ new Error('the method eth_feeHistory does not exist/is not available'),
828
+ {
829
+ code: -32601,
830
+ }
831
+ )
832
+ }
833
+ if (method === 'eth_maxPriorityFeePerGas') {
834
+ throw Object.assign(new Error('timeout'), { code: 'TIMEOUT' })
835
+ }
836
+ })
837
+
838
+ await expect(
839
+ nodeApi.getFeeData(getCoinConfig(currencyId).info, currencyId, eip1559Tx)
840
+ ).rejects.toThrow('timeout')
841
+ })
842
+
782
843
  it('should return the expected payload for an EIP1559 tx when network returns 0 priority fee', async () => {
783
844
  jest.spyOn(JsonRpcProvider.prototype, 'send').mockImplementationOnce(async (method) => {
784
845
  if (method === 'eth_feeHistory') {
@@ -18,7 +18,7 @@ import { encodeStakingData, decodeStakingResult } from './encoder'
18
18
  import { buildTransactionParams } from './operations'
19
19
  import { fetchRewards } from './rewards'
20
20
  import { getValidators } from './validators'
21
- import { fetchMonadStakes } from './validators/monad'
21
+ import { extractMonadKnownValIds, fetchMonadStakes } from './validators/monad'
22
22
  import { fetchSomniaStakes } from './validators/somnia'
23
23
  import { fetchZeroGravityStakes } from './validators/zero_gravity'
24
24
 
@@ -61,6 +61,7 @@ export const STAKING_CONFIG: Record<string, StakingStrategy> = {
61
61
  },
62
62
  monad: {
63
63
  fetcher: fetchMonadStakes,
64
+ extractKnownValIds: extractMonadKnownValIds,
64
65
  },
65
66
  zero_gravity: {
66
67
  fetcher: fetchZeroGravityStakes,