@ledgerhq/coin-evm 5.2.1 → 5.3.2
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/.oxlintrc.json +2 -12
- package/CHANGELOG.md +29 -0
- package/lib/adapters/blockOperations.d.ts +2 -2
- package/lib/adapters/blockOperations.d.ts.map +1 -1
- package/lib/adapters/blockOperations.js.map +1 -1
- package/lib/api/index.d.ts +1 -1
- package/lib/api/index.d.ts.map +1 -1
- package/lib/config.d.ts +1 -1
- package/lib/config.d.ts.map +1 -1
- package/lib/logic/combine.d.ts +2 -1
- package/lib/logic/combine.d.ts.map +1 -1
- package/lib/logic/combine.js.map +1 -1
- package/lib/logic/common.d.ts +2 -1
- package/lib/logic/common.d.ts.map +1 -1
- package/lib/logic/common.js.map +1 -1
- package/lib/logic/craftTransaction.d.ts +1 -1
- package/lib/logic/craftTransaction.d.ts.map +1 -1
- package/lib/logic/craftTransaction.js.map +1 -1
- package/lib/logic/craftTransactionData.d.ts +1 -1
- package/lib/logic/craftTransactionData.d.ts.map +1 -1
- package/lib/logic/estimateFees.d.ts +1 -1
- package/lib/logic/estimateFees.d.ts.map +1 -1
- package/lib/logic/estimateFees.js.map +1 -1
- package/lib/logic/getBalance.d.ts +1 -1
- package/lib/logic/getBalance.d.ts.map +1 -1
- package/lib/logic/getBalance.js +19 -13
- package/lib/logic/getBalance.js.map +1 -1
- package/lib/logic/getBlock.d.ts +1 -1
- package/lib/logic/getBlock.d.ts.map +1 -1
- package/lib/logic/getBlock.js.map +1 -1
- package/lib/logic/getStakes.d.ts +2 -2
- package/lib/logic/getStakes.d.ts.map +1 -1
- package/lib/logic/getStakes.js +6 -3
- package/lib/logic/getStakes.js.map +1 -1
- package/lib/logic/internalTransactionsFetcher.d.ts +1 -1
- package/lib/logic/internalTransactionsFetcher.d.ts.map +1 -1
- package/lib/logic/internalTransactionsFetcher.js.map +1 -1
- package/lib/logic/listOperations.d.ts.map +1 -1
- package/lib/logic/listOperations.js +3 -0
- package/lib/logic/listOperations.js.map +1 -1
- package/lib/logic/validateIntent.d.ts +1 -1
- package/lib/logic/validateIntent.d.ts.map +1 -1
- package/lib/logic/validateIntent.js.map +1 -1
- package/lib/logic.d.ts +1 -1
- package/lib/logic.d.ts.map +1 -1
- package/lib/network/explorer/etherscan.d.ts +4 -4
- package/lib/network/explorer/etherscan.d.ts.map +1 -1
- package/lib/network/explorer/etherscan.js +8 -4
- package/lib/network/explorer/etherscan.js.map +1 -1
- package/lib/network/explorer/index.d.ts +2 -2
- package/lib/network/explorer/index.d.ts.map +1 -1
- package/lib/network/explorer/index.js.map +1 -1
- package/lib/network/explorer/ledger.d.ts +2 -2
- package/lib/network/explorer/ledger.d.ts.map +1 -1
- package/lib/network/explorer/ledger.js.map +1 -1
- package/lib/network/explorer/none.d.ts +1 -1
- package/lib/network/explorer/none.d.ts.map +1 -1
- package/lib/network/explorer/none.js.map +1 -1
- package/lib/network/explorer/types.d.ts +1 -1
- package/lib/network/explorer/types.d.ts.map +1 -1
- package/lib/network/gasTracker/index.d.ts +2 -2
- package/lib/network/gasTracker/index.d.ts.map +1 -1
- package/lib/network/gasTracker/index.js.map +1 -1
- package/lib/network/gasTracker/ledger.d.ts +3 -3
- package/lib/network/gasTracker/ledger.d.ts.map +1 -1
- package/lib/network/gasTracker/ledger.js.map +1 -1
- package/lib/network/gasTracker/types.d.ts +2 -2
- package/lib/network/gasTracker/types.d.ts.map +1 -1
- package/lib/network/node/ledger.d.ts +2 -2
- package/lib/network/node/ledger.d.ts.map +1 -1
- package/lib/network/node/ledger.js.map +1 -1
- package/lib/network/node/rpc.common.d.ts +1 -1
- package/lib/network/node/rpc.common.d.ts.map +1 -1
- package/lib/network/node/rpc.common.js.map +1 -1
- package/lib/network/node/types.d.ts +3 -3
- package/lib/network/node/types.d.ts.map +1 -1
- package/lib/staking/fetchers.d.ts.map +1 -1
- package/lib/staking/fetchers.js +1 -0
- package/lib/staking/fetchers.js.map +1 -1
- package/lib/staking/validators/monad.d.ts +5 -4
- package/lib/staking/validators/monad.d.ts.map +1 -1
- package/lib/staking/validators/monad.js +42 -3
- package/lib/staking/validators/monad.js.map +1 -1
- package/lib/staking/validators/monadResolver.d.ts +2 -1
- package/lib/staking/validators/monadResolver.d.ts.map +1 -1
- package/lib/staking/validators/monadResolver.js.map +1 -1
- package/lib/staking/validators/somnia.d.ts.map +1 -1
- package/lib/staking/validators/somnia.js.map +1 -1
- package/lib/staking/validators/zero_gravity.d.ts.map +1 -1
- package/lib/staking/validators/zero_gravity.js.map +1 -1
- package/lib/types/assets.d.ts +1 -1
- package/lib/types/assets.d.ts.map +1 -1
- package/lib/types/staking.d.ts +3 -2
- package/lib/types/staking.d.ts.map +1 -1
- package/lib/types/transaction.d.ts +1 -1
- package/lib/types/transaction.d.ts.map +1 -1
- package/lib-es/adapters/blockOperations.d.ts +2 -2
- package/lib-es/adapters/blockOperations.d.ts.map +1 -1
- package/lib-es/adapters/blockOperations.js.map +1 -1
- package/lib-es/api/index.d.ts +1 -1
- package/lib-es/api/index.d.ts.map +1 -1
- package/lib-es/config.d.ts +1 -1
- package/lib-es/config.d.ts.map +1 -1
- package/lib-es/logic/combine.d.ts +2 -1
- package/lib-es/logic/combine.d.ts.map +1 -1
- package/lib-es/logic/combine.js.map +1 -1
- package/lib-es/logic/common.d.ts +2 -1
- package/lib-es/logic/common.d.ts.map +1 -1
- package/lib-es/logic/common.js +1 -1
- package/lib-es/logic/common.js.map +1 -1
- package/lib-es/logic/craftTransaction.d.ts +1 -1
- package/lib-es/logic/craftTransaction.d.ts.map +1 -1
- package/lib-es/logic/craftTransaction.js.map +1 -1
- package/lib-es/logic/craftTransactionData.d.ts +1 -1
- package/lib-es/logic/craftTransactionData.d.ts.map +1 -1
- package/lib-es/logic/estimateFees.d.ts +1 -1
- package/lib-es/logic/estimateFees.d.ts.map +1 -1
- package/lib-es/logic/estimateFees.js.map +1 -1
- package/lib-es/logic/getBalance.d.ts +1 -1
- package/lib-es/logic/getBalance.d.ts.map +1 -1
- package/lib-es/logic/getBalance.js +19 -13
- package/lib-es/logic/getBalance.js.map +1 -1
- package/lib-es/logic/getBlock.d.ts +1 -1
- package/lib-es/logic/getBlock.d.ts.map +1 -1
- package/lib-es/logic/getBlock.js.map +1 -1
- package/lib-es/logic/getStakes.d.ts +2 -2
- package/lib-es/logic/getStakes.d.ts.map +1 -1
- package/lib-es/logic/getStakes.js +6 -3
- package/lib-es/logic/getStakes.js.map +1 -1
- package/lib-es/logic/internalTransactionsFetcher.d.ts +1 -1
- package/lib-es/logic/internalTransactionsFetcher.d.ts.map +1 -1
- package/lib-es/logic/internalTransactionsFetcher.js.map +1 -1
- package/lib-es/logic/listOperations.d.ts.map +1 -1
- package/lib-es/logic/listOperations.js +3 -0
- package/lib-es/logic/listOperations.js.map +1 -1
- package/lib-es/logic/validateIntent.d.ts +1 -1
- package/lib-es/logic/validateIntent.d.ts.map +1 -1
- package/lib-es/logic/validateIntent.js.map +1 -1
- package/lib-es/logic.d.ts +1 -1
- package/lib-es/logic.d.ts.map +1 -1
- package/lib-es/network/explorer/etherscan.d.ts +4 -4
- package/lib-es/network/explorer/etherscan.d.ts.map +1 -1
- package/lib-es/network/explorer/etherscan.js +8 -4
- package/lib-es/network/explorer/etherscan.js.map +1 -1
- package/lib-es/network/explorer/index.d.ts +2 -2
- package/lib-es/network/explorer/index.d.ts.map +1 -1
- package/lib-es/network/explorer/index.js.map +1 -1
- package/lib-es/network/explorer/ledger.d.ts +2 -2
- package/lib-es/network/explorer/ledger.d.ts.map +1 -1
- package/lib-es/network/explorer/ledger.js.map +1 -1
- package/lib-es/network/explorer/none.d.ts +1 -1
- package/lib-es/network/explorer/none.d.ts.map +1 -1
- package/lib-es/network/explorer/none.js.map +1 -1
- package/lib-es/network/explorer/types.d.ts +1 -1
- package/lib-es/network/explorer/types.d.ts.map +1 -1
- package/lib-es/network/gasTracker/index.d.ts +2 -2
- package/lib-es/network/gasTracker/index.d.ts.map +1 -1
- package/lib-es/network/gasTracker/index.js.map +1 -1
- package/lib-es/network/gasTracker/ledger.d.ts +3 -3
- package/lib-es/network/gasTracker/ledger.d.ts.map +1 -1
- package/lib-es/network/gasTracker/ledger.js +1 -1
- package/lib-es/network/gasTracker/ledger.js.map +1 -1
- package/lib-es/network/gasTracker/types.d.ts +2 -2
- package/lib-es/network/gasTracker/types.d.ts.map +1 -1
- package/lib-es/network/node/ledger.d.ts +2 -2
- package/lib-es/network/node/ledger.d.ts.map +1 -1
- package/lib-es/network/node/ledger.js.map +1 -1
- package/lib-es/network/node/rpc.common.d.ts +1 -1
- package/lib-es/network/node/rpc.common.d.ts.map +1 -1
- package/lib-es/network/node/rpc.common.js +1 -1
- package/lib-es/network/node/rpc.common.js.map +1 -1
- package/lib-es/network/node/types.d.ts +3 -3
- package/lib-es/network/node/types.d.ts.map +1 -1
- package/lib-es/staking/fetchers.d.ts.map +1 -1
- package/lib-es/staking/fetchers.js +2 -1
- package/lib-es/staking/fetchers.js.map +1 -1
- package/lib-es/staking/validators/monad.d.ts +5 -4
- package/lib-es/staking/validators/monad.d.ts.map +1 -1
- package/lib-es/staking/validators/monad.js +40 -2
- package/lib-es/staking/validators/monad.js.map +1 -1
- package/lib-es/staking/validators/monadResolver.d.ts +2 -1
- package/lib-es/staking/validators/monadResolver.d.ts.map +1 -1
- package/lib-es/staking/validators/monadResolver.js.map +1 -1
- package/lib-es/staking/validators/somnia.d.ts.map +1 -1
- package/lib-es/staking/validators/somnia.js.map +1 -1
- package/lib-es/staking/validators/zero_gravity.d.ts.map +1 -1
- package/lib-es/staking/validators/zero_gravity.js.map +1 -1
- package/lib-es/types/assets.d.ts +1 -1
- package/lib-es/types/assets.d.ts.map +1 -1
- package/lib-es/types/staking.d.ts +3 -2
- package/lib-es/types/staking.d.ts.map +1 -1
- package/lib-es/types/transaction.d.ts +1 -1
- package/lib-es/types/transaction.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/adapters/blockOperations.test.ts +2 -2
- package/src/adapters/blockOperations.ts +3 -2
- package/src/adapters/etherscan.test.ts +7 -7
- package/src/adapters/ledger.test.ts +2 -2
- package/src/api/getBlock.integ.test.ts +1 -1
- package/src/api/index.fantom.integ.test.ts +1 -1
- package/src/api/index.flare.integ.test.ts +1 -1
- package/src/api/index.integ.test.ts +265 -153
- package/src/api/index.linea.integ.test.ts +1 -1
- package/src/api/index.optimism.integ.test.ts +1 -1
- package/src/api/index.shape.integ.test.ts +1 -1
- package/src/api/index.ts +1 -1
- package/src/config.ts +1 -1
- package/src/fixtures/ledger.fixtures.ts +1 -1
- package/src/internalTxSources.test.ts +3 -6
- package/src/logic/combine.test.ts +2 -2
- package/src/logic/combine.ts +2 -1
- package/src/logic/common.test.ts +3 -3
- package/src/logic/common.ts +2 -7
- package/src/logic/craftTransaction.test.ts +4 -3
- package/src/logic/craftTransaction.ts +3 -2
- package/src/logic/craftTransactionData.test.ts +1 -1
- package/src/logic/craftTransactionData.ts +1 -1
- package/src/logic/estimateFees.ts +6 -3
- package/src/logic/getBalance.test.ts +1 -1
- package/src/logic/getBalance.ts +30 -24
- package/src/logic/getBlock.test.ts +8 -7
- package/src/logic/getBlock.ts +3 -2
- package/src/logic/getBlockInfo.test.ts +1 -3
- package/src/logic/getStakes.test.ts +2 -2
- package/src/logic/getStakes.ts +15 -6
- package/src/logic/internalTransactionsFetcher.test.ts +4 -6
- package/src/logic/internalTransactionsFetcher.ts +1 -1
- package/src/logic/lastBlock.test.ts +2 -1
- package/src/logic/listOperations.test.ts +75 -2
- package/src/logic/listOperations.ts +3 -0
- package/src/logic/validateIntent.test.ts +2 -1
- package/src/logic/validateIntent.ts +4 -2
- package/src/logic.ts +1 -1
- package/src/network/explorer/etherscan.test.ts +36 -1
- package/src/network/explorer/etherscan.ts +20 -14
- package/src/network/explorer/index.test.ts +1 -1
- package/src/network/explorer/index.ts +2 -2
- package/src/network/explorer/ledger.test.ts +2 -1
- package/src/network/explorer/ledger.ts +3 -2
- package/src/network/explorer/none.ts +2 -1
- package/src/network/explorer/types.ts +1 -1
- package/src/network/gasTracker/index.test.ts +1 -1
- package/src/network/gasTracker/index.ts +2 -2
- package/src/network/gasTracker/ledger.test.ts +10 -17
- package/src/network/gasTracker/ledger.ts +5 -7
- package/src/network/gasTracker/types.ts +2 -2
- package/src/network/node/index.memoization.test.ts +1 -1
- package/src/network/node/ledger.ts +6 -5
- package/src/network/node/rpc.common.ts +14 -14
- package/src/network/node/rpc.test.ts +4 -10
- package/src/network/node/types.ts +3 -3
- package/src/staking/detectOperationType.test.ts +1 -1
- package/src/staking/encoder.test.ts +1 -1
- package/src/staking/fetchers.ts +2 -1
- package/src/staking/operations/index.test.ts +1 -1
- package/src/staking/redelegations.test.ts +23 -15
- package/src/staking/rewards.test.ts +6 -2
- package/src/staking/rewardsFromReceipt.test.ts +1 -1
- package/src/staking/transactionData.test.ts +2 -2
- package/src/staking/validators/monad.test.ts +102 -1
- package/src/staking/validators/monad.ts +58 -5
- package/src/staking/validators/monadResolver.ts +2 -1
- package/src/staking/validators/somnia.ts +2 -1
- package/src/staking/validators/zero_gravity.ts +2 -1
- package/src/staking/validators.test.ts +7 -2
- package/src/types/assets.ts +1 -1
- package/src/types/staking.ts +4 -2
- package/src/types/transaction.ts +1 -1
|
@@ -1,11 +1,21 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: © 2026 LEDGER SAS
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
+
import type { EvmConfigInfo } from '../../config'
|
|
5
|
+
import type {
|
|
6
|
+
EtherscanERC1155Event,
|
|
7
|
+
EtherscanERC20Event,
|
|
8
|
+
EtherscanERC721Event,
|
|
9
|
+
EtherscanInternalTransaction,
|
|
10
|
+
EtherscanOperation,
|
|
11
|
+
} from '../../types'
|
|
12
|
+
import type { ExplorerApi } from './types'
|
|
4
13
|
import type { MemoNotSupported, Operation } from '@ledgerhq/coin-module-framework/api/types'
|
|
14
|
+
import type { AxiosRequestConfig } from 'axios'
|
|
5
15
|
import { delay } from '@ledgerhq/coin-module-framework/promises'
|
|
6
16
|
import { makeLRUCache } from '@ledgerhq/live-network/cache'
|
|
7
17
|
import { log } from '@ledgerhq/logs'
|
|
8
|
-
import axios
|
|
18
|
+
import axios from 'axios'
|
|
9
19
|
import {
|
|
10
20
|
etherscanOperationToOperations,
|
|
11
21
|
etherscanERC20EventToOperations,
|
|
@@ -15,24 +25,16 @@ import {
|
|
|
15
25
|
deserializePagingToken,
|
|
16
26
|
serializePagingToken,
|
|
17
27
|
} from '../../adapters'
|
|
18
|
-
import { EvmConfigInfo } from '../../config'
|
|
19
28
|
import {
|
|
20
29
|
EtherscanAPIError,
|
|
21
30
|
EtherscanLikeExplorerUsedIncorrectly,
|
|
22
31
|
InvalidExplorerResponse,
|
|
23
32
|
} from '../../errors'
|
|
24
33
|
import { enrichRewardOperationsValue } from '../../staking/rewardsFromReceipt'
|
|
25
|
-
import {
|
|
26
|
-
EtherscanERC1155Event,
|
|
27
|
-
EtherscanERC20Event,
|
|
28
|
-
EtherscanERC721Event,
|
|
29
|
-
EtherscanInternalTransaction,
|
|
30
|
-
EtherscanOperation,
|
|
31
|
-
} from '../../types'
|
|
32
34
|
import { nftDisabled } from '../../utils'
|
|
33
35
|
import { withApi } from '../node/rpc.common'
|
|
34
36
|
import { isExternalNodeConfig } from '../node/types'
|
|
35
|
-
import {
|
|
37
|
+
import { isEtherscanLikeExplorerConfig } from './types'
|
|
36
38
|
|
|
37
39
|
export const ETHERSCAN_TIMEOUT = 5000 // 5 seconds between 2 calls
|
|
38
40
|
export const DEFAULT_RETRIES_API = 8
|
|
@@ -275,11 +277,12 @@ export const getCoinOperations = async (params: FetchOperationsParams): Promise<
|
|
|
275
277
|
? `${explorer.uri}/accounts/list_of_txs_by_address/${params.address}`
|
|
276
278
|
: `${explorer.uri}?module=account&action=txlist&address=${params.address}`
|
|
277
279
|
|
|
278
|
-
const
|
|
280
|
+
const raw = await fetchWithRetries<EtherscanOperation[] | null | string>({
|
|
279
281
|
method: 'GET',
|
|
280
282
|
url,
|
|
281
283
|
params: paginationParams(params),
|
|
282
284
|
})
|
|
285
|
+
const ops = Array.isArray(raw) ? raw : []
|
|
283
286
|
|
|
284
287
|
const operations = ops.flatMap((tx) =>
|
|
285
288
|
etherscanOperationToOperations(params.address, params.currencyId, tx)
|
|
@@ -334,11 +337,12 @@ export const getTokenOperations = async (
|
|
|
334
337
|
? `${explorer.uri}/accounts/list_of_erc20_transfer_events_by_address/${params.address}`
|
|
335
338
|
: `${explorer.uri}?module=account&action=tokentx&address=${params.address}`
|
|
336
339
|
|
|
337
|
-
const
|
|
340
|
+
const raw = await fetchWithRetries<EtherscanERC20Event[] | null | string>({
|
|
338
341
|
method: 'GET',
|
|
339
342
|
url,
|
|
340
343
|
params: paginationParams(params),
|
|
341
344
|
})
|
|
345
|
+
const ops = Array.isArray(raw) ? raw : []
|
|
342
346
|
|
|
343
347
|
// Drop ERC20 Transfer events on contracts that mirror the native asset
|
|
344
348
|
const nativeContractsSet = new Set((config.nativeContracts ?? []).map((c) => c.toLowerCase()))
|
|
@@ -388,11 +392,12 @@ export const getERC721Operations = async (
|
|
|
388
392
|
? `${explorer.uri}/accounts/list_of_erc721_transfer_events_by_address/${params.address}`
|
|
389
393
|
: `${explorer.uri}?module=account&action=tokennfttx&address=${params.address}`
|
|
390
394
|
|
|
391
|
-
const
|
|
395
|
+
const raw = await fetchWithRetries<EtherscanERC721Event[] | null | string>({
|
|
392
396
|
method: 'GET',
|
|
393
397
|
url,
|
|
394
398
|
params: paginationParams(params),
|
|
395
399
|
})
|
|
400
|
+
const ops = Array.isArray(raw) ? raw : []
|
|
396
401
|
|
|
397
402
|
// Why this thing ?
|
|
398
403
|
// Multiple events can be fired by the same transactions and
|
|
@@ -435,11 +440,12 @@ export const getERC1155Operations = async (
|
|
|
435
440
|
return EMPTY_RESULT
|
|
436
441
|
}
|
|
437
442
|
|
|
438
|
-
const
|
|
443
|
+
const raw = await fetchWithRetries<EtherscanERC1155Event[] | null | string>({
|
|
439
444
|
method: 'GET',
|
|
440
445
|
url: `${explorer.uri}?module=account&action=token1155tx&address=${params.address}`,
|
|
441
446
|
params: paginationParams(params),
|
|
442
447
|
})
|
|
448
|
+
const ops = Array.isArray(raw) ? raw : []
|
|
443
449
|
|
|
444
450
|
// Why this thing ?
|
|
445
451
|
// Multiple events can be fired by the same transactions and
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: © 2026 LEDGER SAS
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
+
import type { EvmConfigInfo } from '../../config'
|
|
4
5
|
import { AssertionError, fail } from 'assert'
|
|
5
|
-
import { EvmConfigInfo } from '../../config'
|
|
6
6
|
import { UnknownExplorer } from '../../errors'
|
|
7
7
|
import etherscanLikeApi from './etherscan'
|
|
8
8
|
import ledgerExplorerApi from './ledger'
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: © 2026 LEDGER SAS
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
-
import { EvmConfigInfo } from '../../config'
|
|
4
|
+
import type { EvmConfigInfo } from '../../config'
|
|
5
|
+
import type { ExplorerApi } from './types'
|
|
5
6
|
import { UnknownExplorer } from '../../errors'
|
|
6
7
|
import etherscanLikeApi from './etherscan'
|
|
7
8
|
import ledgerExplorerApi from './ledger'
|
|
8
9
|
import noExplorerAPI from './none'
|
|
9
|
-
import { ExplorerApi } from './types'
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* Switch to select one of the compatible explorer
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: © 2026 LEDGER SAS
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
+
import type { NftStandard } from '../../config'
|
|
4
5
|
import { AssertionError, fail } from 'assert'
|
|
5
6
|
import { delay } from '@ledgerhq/coin-module-framework/promises'
|
|
6
7
|
import axios from 'axios'
|
|
7
8
|
import eip55 from 'eip55'
|
|
8
|
-
import { DEFAULT_LEDGER_EXPLORER_URI, getCoinConfig
|
|
9
|
+
import { DEFAULT_LEDGER_EXPLORER_URI, getCoinConfig } from '../../config'
|
|
9
10
|
import { LedgerExplorerUsedIncorrectly } from '../../errors'
|
|
10
11
|
import {
|
|
11
12
|
coinOperation1,
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: © 2026 LEDGER SAS
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
+
import type { LedgerExplorerOperation } from '../../types'
|
|
5
|
+
import type { ExplorerApi } from './types'
|
|
4
6
|
import type { MemoNotSupported, Operation } from '@ledgerhq/coin-module-framework/api/types'
|
|
5
7
|
import { delay } from '@ledgerhq/coin-module-framework/promises'
|
|
6
8
|
import axios from 'axios'
|
|
@@ -13,9 +15,8 @@ import {
|
|
|
13
15
|
} from '../../adapters/index'
|
|
14
16
|
import { DEFAULT_LEDGER_EXPLORER_URI } from '../../config'
|
|
15
17
|
import { LedgerExplorerUsedIncorrectly } from '../../errors'
|
|
16
|
-
import { LedgerExplorerOperation } from '../../types'
|
|
17
18
|
import { nftEnabled } from '../../utils'
|
|
18
|
-
import {
|
|
19
|
+
import { isLedgerExplorerConfig, NO_TOKEN } from './types'
|
|
19
20
|
|
|
20
21
|
export const DEFAULT_BATCH_SIZE = 10_000
|
|
21
22
|
export const LEDGER_TIMEOUT = 200 // 200ms between 2 calls
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: © 2026 LEDGER SAS
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
-
import { ExplorerApi
|
|
4
|
+
import type { ExplorerApi } from './types'
|
|
5
|
+
import { NO_TOKEN } from './types'
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* Returns all operation types from an address
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: © 2026 LEDGER SAS
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
+
import type { EvmConfigInfo } from '../../config'
|
|
4
5
|
import type { MemoNotSupported, Operation } from '@ledgerhq/coin-module-framework/api/types'
|
|
5
|
-
import { EvmConfigInfo } from '../../config'
|
|
6
6
|
|
|
7
7
|
/** Constant representing no pagination token (end of pagination or first page) */
|
|
8
8
|
export const NO_TOKEN = ''
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: © 2026 LEDGER SAS
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
-
import { EvmConfigInfo } from '../../config'
|
|
4
|
+
import type { EvmConfigInfo } from '../../config'
|
|
5
5
|
import { getGasOptions as ledgerGetGasOptions } from './ledger'
|
|
6
6
|
import { getGasTracker } from './index'
|
|
7
7
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: © 2026 LEDGER SAS
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
-
import { EvmConfigInfo } from '../../config'
|
|
4
|
+
import type { EvmConfigInfo } from '../../config'
|
|
5
|
+
import type { GasTrackerApi } from './types'
|
|
5
6
|
import ledgerGasTracker from './ledger'
|
|
6
|
-
import { GasTrackerApi } from './types'
|
|
7
7
|
|
|
8
8
|
export const getGasTracker = (config: EvmConfigInfo): GasTrackerApi | null => {
|
|
9
9
|
switch (config?.gasTracker?.type) {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: © 2026 LEDGER SAS
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
+
import type { EvmConfigInfo } from '../../config'
|
|
5
|
+
import type { GasOptions } from '../../types'
|
|
4
6
|
import { AssertionError } from 'assert'
|
|
5
7
|
import network from '@ledgerhq/live-network/network'
|
|
6
8
|
import BigNumber from 'bignumber.js'
|
|
7
|
-
import { EvmConfigInfo } from '../../config'
|
|
8
9
|
import { LedgerGasTrackerUsedIncorrectly, NoGasTrackerFound } from '../../errors'
|
|
9
|
-
import { GasOptions } from '../../types'
|
|
10
10
|
import { getGasOptions } from './ledger'
|
|
11
11
|
|
|
12
12
|
jest.mock('@ledgerhq/live-network/network')
|
|
@@ -96,12 +96,10 @@ describe('EVM Family', () => {
|
|
|
96
96
|
},
|
|
97
97
|
})
|
|
98
98
|
|
|
99
|
-
Object.
|
|
99
|
+
Object.values(gasOptions).forEach((value) => {
|
|
100
100
|
const { maxFeePerGas } = value
|
|
101
101
|
|
|
102
|
-
expect(maxFeePerGas?.isInteger()
|
|
103
|
-
true
|
|
104
|
-
)
|
|
102
|
+
expect(maxFeePerGas?.isInteger()).toBe(true)
|
|
105
103
|
})
|
|
106
104
|
})
|
|
107
105
|
|
|
@@ -129,17 +127,12 @@ describe('EVM Family', () => {
|
|
|
129
127
|
},
|
|
130
128
|
})
|
|
131
129
|
|
|
132
|
-
Object.
|
|
130
|
+
Object.values(gasOptions).forEach((value) => {
|
|
133
131
|
const { maxFeePerGas, maxPriorityFeePerGas, nextBaseFee } = value
|
|
134
132
|
|
|
135
|
-
expect(maxFeePerGas?.isInteger()
|
|
136
|
-
|
|
137
|
-
)
|
|
138
|
-
expect(
|
|
139
|
-
maxPriorityFeePerGas?.isInteger(),
|
|
140
|
-
`${key}:maxPriorityFeePerGas - got ${maxPriorityFeePerGas}`
|
|
141
|
-
).toBe(true)
|
|
142
|
-
expect(nextBaseFee?.isInteger(), `${key}:nextBaseFee - got ${nextBaseFee}`).toBe(true)
|
|
133
|
+
expect(maxFeePerGas?.isInteger()).toBe(true)
|
|
134
|
+
expect(maxPriorityFeePerGas?.isInteger()).toBe(true)
|
|
135
|
+
expect(nextBaseFee?.isInteger()).toBe(true)
|
|
143
136
|
})
|
|
144
137
|
})
|
|
145
138
|
|
|
@@ -249,10 +242,10 @@ describe('EVM Family', () => {
|
|
|
249
242
|
},
|
|
250
243
|
})
|
|
251
244
|
|
|
252
|
-
Object.
|
|
245
|
+
Object.values(gasOptions).forEach((value) => {
|
|
253
246
|
const { gasPrice } = value
|
|
254
247
|
|
|
255
|
-
expect(gasPrice?.isInteger()
|
|
248
|
+
expect(gasPrice?.isInteger()).toBe(true)
|
|
256
249
|
})
|
|
257
250
|
})
|
|
258
251
|
|
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: © 2026 LEDGER SAS
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
+
import type { EvmConfigInfo } from '../../config'
|
|
5
|
+
import type { GasOptions } from '../../types'
|
|
6
|
+
import type { GasTrackerApi } from './types'
|
|
4
7
|
import network from '@ledgerhq/live-network/network'
|
|
5
8
|
import { BigNumber } from 'bignumber.js'
|
|
6
|
-
import {
|
|
7
|
-
DEFAULT_EIP1559_BASE_FEE_MULTIPLIER,
|
|
8
|
-
DEFAULT_LEDGER_EXPLORER_URI,
|
|
9
|
-
EvmConfigInfo,
|
|
10
|
-
} from '../../config'
|
|
9
|
+
import { DEFAULT_EIP1559_BASE_FEE_MULTIPLIER, DEFAULT_LEDGER_EXPLORER_URI } from '../../config'
|
|
11
10
|
import { LedgerGasTrackerUsedIncorrectly, NoGasTrackerFound } from '../../errors'
|
|
12
|
-
import {
|
|
13
|
-
import { GasTrackerApi, isLedgerGasTracker } from './types'
|
|
11
|
+
import { isLedgerGasTracker } from './types'
|
|
14
12
|
|
|
15
13
|
type GasTracker = {
|
|
16
14
|
compatibilty: {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: © 2026 LEDGER SAS
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
-
import { EvmConfigInfo } from '../../config'
|
|
5
|
-
import { GasOptions } from '../../types'
|
|
4
|
+
import type { EvmConfigInfo } from '../../config'
|
|
5
|
+
import type { GasOptions } from '../../types'
|
|
6
6
|
|
|
7
7
|
export type GasTrackerApi = {
|
|
8
8
|
getGasOptions: ({
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: © 2026 LEDGER SAS
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
-
import { EvmConfigInfo } from '../../config'
|
|
4
|
+
import type { EvmConfigInfo } from '../../config'
|
|
5
5
|
import { getNodeApi } from './index'
|
|
6
6
|
|
|
7
7
|
const externalNodeConfig = (): EvmConfigInfo =>
|
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: © 2026 LEDGER SAS
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
+
import type { BlockFinalizationTag, LedgerNodeConfig } from '../../config'
|
|
5
|
+
import type { LedgerExplorerOperation } from '../../types'
|
|
6
|
+
import type { BlockByHeightResult, EvmCallParams, NodeApi, TransactionInfo } from './types'
|
|
7
|
+
import type { Batcher } from '@ledgerhq/live-network/batcher/types'
|
|
8
|
+
import type { AxiosRequestConfig } from 'axios'
|
|
4
9
|
import { makeBatcher } from '@ledgerhq/live-network/batcher/index'
|
|
5
|
-
import { Batcher } from '@ledgerhq/live-network/batcher/types'
|
|
6
10
|
import { log } from '@ledgerhq/logs'
|
|
7
|
-
import axios
|
|
11
|
+
import axios from 'axios'
|
|
8
12
|
import BigNumber from 'bignumber.js'
|
|
9
13
|
import { ethers } from 'ethers'
|
|
10
14
|
import ERC20Abi from '../../abis/erc20.abi.json'
|
|
11
15
|
import OptimismGasPriceOracleAbi from '../../abis/optimismGasPriceOracle.abi.json'
|
|
12
|
-
import { BlockFinalizationTag, LedgerNodeConfig } from '../../config'
|
|
13
16
|
import { GasEstimationError } from '../../errors'
|
|
14
|
-
import { LedgerExplorerOperation } from '../../types'
|
|
15
17
|
import { normalizeAddress, padHexString, safeEncodeEIP55 } from '../../utils'
|
|
16
18
|
import { getGasOptions } from '../gasTracker/ledger'
|
|
17
19
|
import { withRetries } from '../withRetries'
|
|
18
|
-
import { BlockByHeightResult, EvmCallParams, NodeApi, TransactionInfo } from './types'
|
|
19
20
|
|
|
20
21
|
const LEDGER_TIMEOUT = 10_000 // 10s for network call timeout
|
|
21
22
|
const LEDGER_TIME_BETWEEN_TRIES = 200 // 200ms between 2 calls
|
|
@@ -2,6 +2,19 @@
|
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
4
|
import type { BlockFinalizationTag, EvmConfigInfo, ExternalNodeConfig } from '../../config'
|
|
5
|
+
import type { FeeHistory, FeeData } from '../../types'
|
|
6
|
+
import type {
|
|
7
|
+
NodeApi,
|
|
8
|
+
ERC20Transfer,
|
|
9
|
+
PrefetchedBlockTransaction,
|
|
10
|
+
LogWithAddress,
|
|
11
|
+
TransactionReceipt,
|
|
12
|
+
TraceBlockItem,
|
|
13
|
+
TransactionInfo,
|
|
14
|
+
BlockByHeightResult,
|
|
15
|
+
BlockReceiptInfo,
|
|
16
|
+
EvmCallParams,
|
|
17
|
+
} from './types'
|
|
5
18
|
/** ⚠️ keep this order of import. @see https://docs.ethers.io/v5/cookbook/react-native/#cookbook-reactnative ⚠️ */
|
|
6
19
|
import { makeLRUCache } from '@ledgerhq/live-network/cache'
|
|
7
20
|
import { log } from '@ledgerhq/logs'
|
|
@@ -11,7 +24,6 @@ import ERC20Abi from '../../abis/erc20.abi.json'
|
|
|
11
24
|
import OptimismGasPriceOracleAbi from '../../abis/optimismGasPriceOracle.abi.json'
|
|
12
25
|
import ScrollGasPriceOracleAbi from '../../abis/scrollGasPriceOracle.abi.json'
|
|
13
26
|
import { GasEstimationError, InsufficientFunds, UnsupportedRpcMethodError } from '../../errors'
|
|
14
|
-
import { FeeHistory, FeeData } from '../../types'
|
|
15
27
|
import { isSmartContractInput, safeEncodeEIP55, normalizeAddress } from '../../utils'
|
|
16
28
|
import { withRetries } from '../withRetries'
|
|
17
29
|
import { gethCallTracerToTraceBlockItems } from './gethCallTracerToTraceBlockItems'
|
|
@@ -21,19 +33,7 @@ import {
|
|
|
21
33
|
isUnsupportedRpcMethodErrorMsg,
|
|
22
34
|
isUnsupportedRpcMethodError,
|
|
23
35
|
} from './rpc.errors'
|
|
24
|
-
import {
|
|
25
|
-
NodeApi,
|
|
26
|
-
ERC20Transfer,
|
|
27
|
-
PrefetchedBlockTransaction,
|
|
28
|
-
LogWithAddress,
|
|
29
|
-
TransactionReceipt,
|
|
30
|
-
TraceBlockItem,
|
|
31
|
-
isTraceBlockItem,
|
|
32
|
-
TransactionInfo,
|
|
33
|
-
BlockByHeightResult,
|
|
34
|
-
BlockReceiptInfo,
|
|
35
|
-
EvmCallParams,
|
|
36
|
-
} from './types'
|
|
36
|
+
import { isTraceBlockItem } from './types'
|
|
37
37
|
|
|
38
38
|
/**
|
|
39
39
|
* ERC20 Transfer event topic: keccak256("Transfer(address,address,uint256)")
|
|
@@ -1,19 +1,13 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: © 2026 LEDGER SAS
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
+
import type { EvmConfigInfo } from '../../config'
|
|
5
|
+
import type { TransactionReceipt, TransactionResponse, ethers } from 'ethers'
|
|
4
6
|
import { AssertionError, fail } from 'assert'
|
|
5
7
|
import { delay } from '@ledgerhq/coin-module-framework/promises'
|
|
6
8
|
import BigNumber from 'bignumber.js'
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
JsonRpcProvider,
|
|
10
|
-
Network,
|
|
11
|
-
Transaction,
|
|
12
|
-
TransactionReceipt,
|
|
13
|
-
TransactionResponse,
|
|
14
|
-
ethers,
|
|
15
|
-
} from 'ethers'
|
|
16
|
-
import { EvmConfigInfo, getCoinConfig } from '../../config'
|
|
9
|
+
import { FetchRequest, JsonRpcProvider, Network, Transaction } from 'ethers'
|
|
10
|
+
import { getCoinConfig } from '../../config'
|
|
17
11
|
import { GasEstimationError, InsufficientFunds, UnsupportedRpcMethodError } from '../../errors'
|
|
18
12
|
import {
|
|
19
13
|
createNodeApi,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: © 2026 LEDGER SAS
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
+
import type { BlockFinalizationTag, EvmConfigInfo } from '../../config'
|
|
5
|
+
import type { FeeData } from '../../types'
|
|
4
6
|
import type { BroadcastConfig } from '@ledgerhq/coin-module-framework/api/types'
|
|
5
|
-
import BigNumber from 'bignumber.js'
|
|
6
|
-
import { BlockFinalizationTag, EvmConfigInfo } from '../../config'
|
|
7
|
-
import { FeeData } from '../../types'
|
|
7
|
+
import type BigNumber from 'bignumber.js'
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Asset information for token transfers
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: © 2026 LEDGER SAS
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
+
import type { StakingOperation } from '../types/staking'
|
|
4
5
|
import { ethers } from 'ethers'
|
|
5
|
-
import { StakingOperation } from '../types/staking'
|
|
6
6
|
import { detectEvmStakingOperationType, isStakingOperation } from './detectOperationType'
|
|
7
7
|
|
|
8
8
|
describe('isStakingOperation', () => {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: © 2026 LEDGER SAS
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
+
import type { StakingOperation } from '../types/staking'
|
|
4
5
|
import { ethers } from 'ethers'
|
|
5
|
-
import { StakingOperation } from '../types/staking'
|
|
6
6
|
import { extractSeiDelegation, getSeiDelegationAmount } from '../utils'
|
|
7
7
|
import { STAKING_CONTRACTS } from './contracts'
|
|
8
8
|
import { encodeStakingData, decodeStakingResult } from './encoder'
|
package/src/staking/fetchers.ts
CHANGED
|
@@ -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,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: © 2026 LEDGER SAS
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
-
import { StakingOperation } from '../../types/staking'
|
|
4
|
+
import type { StakingOperation } from '../../types/staking'
|
|
5
5
|
import { buildTransactionParams } from '.'
|
|
6
6
|
|
|
7
7
|
describe('buildTransactionParams', () => {
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: © 2026 LEDGER SAS
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
+
import type { EvmConfigInfo } from '../config'
|
|
5
|
+
import type { OperationLike } from './redelegations'
|
|
4
6
|
import { BigNumber } from 'bignumber.js'
|
|
5
7
|
import { ethers } from 'ethers'
|
|
6
8
|
import { USEI_TO_EVM_SCALE } from '../utils'
|
|
@@ -11,7 +13,6 @@ import {
|
|
|
11
13
|
resolveRedelegationValidators,
|
|
12
14
|
resolveStakingValidator,
|
|
13
15
|
buildRedelegationsFromOps,
|
|
14
|
-
type OperationLike,
|
|
15
16
|
} from './redelegations'
|
|
16
17
|
|
|
17
18
|
jest.mock('@ledgerhq/live-network', () => jest.fn())
|
|
@@ -22,8 +23,14 @@ const mockNetwork = jest.mocked(require('@ledgerhq/live-network'))
|
|
|
22
23
|
const mockWithApi = jest.mocked(require('../network/node/rpc.common').withApi)
|
|
23
24
|
const mockIsExternalNodeConfig = jest.mocked(require('../network/node/types').isExternalNodeConfig)
|
|
24
25
|
|
|
25
|
-
const mockNode = { type: 'external', uri: 'https://sei-evm.coin.ledger.com' }
|
|
26
|
-
const mockConfig = {
|
|
26
|
+
const mockNode: EvmConfigInfo['node'] = { type: 'external', uri: 'https://sei-evm.coin.ledger.com' }
|
|
27
|
+
const mockConfig: EvmConfigInfo = {
|
|
28
|
+
status: { type: 'active' },
|
|
29
|
+
chainId: 1,
|
|
30
|
+
name: 'Test EVM',
|
|
31
|
+
node: mockNode,
|
|
32
|
+
explorer: { type: 'none' },
|
|
33
|
+
}
|
|
27
34
|
|
|
28
35
|
const SEI_CURRENCY = 'sei_evm'
|
|
29
36
|
|
|
@@ -369,8 +376,14 @@ describe('redelegations', () => {
|
|
|
369
376
|
},
|
|
370
377
|
})
|
|
371
378
|
|
|
372
|
-
const zgNode = { type: 'external', uri: 'https://0g.rpc' }
|
|
373
|
-
const zgConfig = {
|
|
379
|
+
const zgNode: EvmConfigInfo['node'] = { type: 'external', uri: 'https://0g.rpc' }
|
|
380
|
+
const zgConfig: EvmConfigInfo = {
|
|
381
|
+
status: { type: 'active' },
|
|
382
|
+
chainId: 1,
|
|
383
|
+
name: 'Test EVM',
|
|
384
|
+
node: zgNode,
|
|
385
|
+
explorer: { type: 'none' },
|
|
386
|
+
}
|
|
374
387
|
mockIsExternalNodeConfig.mockImplementation((node: unknown) => node === zgNode)
|
|
375
388
|
mockWithApi.mockImplementation(
|
|
376
389
|
(_config: unknown, _currencyId: unknown, fn: (p: unknown) => unknown) =>
|
|
@@ -398,8 +411,7 @@ describe('redelegations', () => {
|
|
|
398
411
|
|
|
399
412
|
const result = await resolveStakingValidator(mockConfig, SEI_CURRENCY, op, 'delegate')
|
|
400
413
|
|
|
401
|
-
expect(result).
|
|
402
|
-
expect(result!.validatorAddress).toBe(VALIDATOR)
|
|
414
|
+
expect(result).toMatchObject({ validatorAddress: VALIDATOR })
|
|
403
415
|
})
|
|
404
416
|
|
|
405
417
|
it('should fall back to RPC when contractPayload is absent', async () => {
|
|
@@ -416,8 +428,7 @@ describe('redelegations', () => {
|
|
|
416
428
|
'delegate'
|
|
417
429
|
)
|
|
418
430
|
|
|
419
|
-
expect(result).
|
|
420
|
-
expect(result!.validatorAddress).toBe(VALIDATOR)
|
|
431
|
+
expect(result).toMatchObject({ validatorAddress: VALIDATOR })
|
|
421
432
|
})
|
|
422
433
|
|
|
423
434
|
it('should return null when no payload is available', async () => {
|
|
@@ -443,10 +454,8 @@ describe('redelegations', () => {
|
|
|
443
454
|
|
|
444
455
|
const result = await resolveStakingValidator(mockConfig, SEI_CURRENCY, op, 'undelegate')
|
|
445
456
|
|
|
446
|
-
expect(result).
|
|
447
|
-
expect(result!.
|
|
448
|
-
expect(result!.amount).not.toBeNull()
|
|
449
|
-
expect(result!.amount!.isEqualTo(EXPECTED_WEI.toString())).toBe(true)
|
|
457
|
+
expect(result).toMatchObject({ validatorAddress: VALIDATOR })
|
|
458
|
+
expect(result!.amount?.isEqualTo(EXPECTED_WEI.toString())).toBe(true)
|
|
450
459
|
})
|
|
451
460
|
|
|
452
461
|
it('should fall back to RPC when contractPayload is absent', async () => {
|
|
@@ -467,8 +476,7 @@ describe('redelegations', () => {
|
|
|
467
476
|
'undelegate'
|
|
468
477
|
)
|
|
469
478
|
|
|
470
|
-
expect(result).
|
|
471
|
-
expect(result!.validatorAddress).toBe(VALIDATOR)
|
|
479
|
+
expect(result).toMatchObject({ validatorAddress: VALIDATOR })
|
|
472
480
|
})
|
|
473
481
|
|
|
474
482
|
it('should return null for malformed calldata', async () => {
|
|
@@ -45,8 +45,12 @@ describe('fetchRewards', () => {
|
|
|
45
45
|
})
|
|
46
46
|
|
|
47
47
|
it.each([
|
|
48
|
-
{ case: 'unknown currencyId', currencyId: 'unknown_chain', setup: () =>
|
|
49
|
-
{
|
|
48
|
+
{ case: 'unknown currencyId', currencyId: 'unknown_chain', setup: () => undefined },
|
|
49
|
+
{
|
|
50
|
+
case: 'chain has no rewardsStrategy (e.g. Celo)',
|
|
51
|
+
currencyId: 'celo',
|
|
52
|
+
setup: () => undefined,
|
|
53
|
+
},
|
|
50
54
|
{
|
|
51
55
|
case: 'REST call fails',
|
|
52
56
|
currencyId: 'sei_evm',
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: © 2026 LEDGER SAS
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
+
import type { LogWithAddress } from '../network/node/types'
|
|
4
5
|
import type { MemoNotSupported, Operation } from '@ledgerhq/coin-module-framework/api/types'
|
|
5
|
-
import { LogWithAddress } from '../network/node/types'
|
|
6
6
|
import { STAKING_CONTRACTS } from './contracts'
|
|
7
7
|
import { enrichRewardOperationsValue, sumRewardFromReceiptLogs } from './rewardsFromReceipt'
|
|
8
8
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: © 2026 LEDGER SAS
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
-
import { MemoNotSupported } from '@ledgerhq/coin-module-framework/api/index'
|
|
5
|
-
import { TransactionIntent, BufferTxData } from '@ledgerhq/coin-module-framework/api/types'
|
|
4
|
+
import type { MemoNotSupported } from '@ledgerhq/coin-module-framework/api/index'
|
|
5
|
+
import type { TransactionIntent, BufferTxData } from '@ledgerhq/coin-module-framework/api/types'
|
|
6
6
|
import { ethers } from 'ethers'
|
|
7
7
|
import { getStakingABI } from './abis'
|
|
8
8
|
import { STAKING_CONTRACTS } from './contracts'
|