@ledgerhq/coin-evm 5.3.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.
Files changed (238) hide show
  1. package/.oxlintrc.json +2 -12
  2. package/CHANGELOG.md +6 -0
  3. package/lib/adapters/blockOperations.d.ts +2 -2
  4. package/lib/adapters/blockOperations.d.ts.map +1 -1
  5. package/lib/adapters/blockOperations.js.map +1 -1
  6. package/lib/api/index.d.ts +1 -1
  7. package/lib/api/index.d.ts.map +1 -1
  8. package/lib/config.d.ts +1 -1
  9. package/lib/config.d.ts.map +1 -1
  10. package/lib/logic/combine.d.ts +2 -1
  11. package/lib/logic/combine.d.ts.map +1 -1
  12. package/lib/logic/combine.js.map +1 -1
  13. package/lib/logic/common.d.ts +2 -1
  14. package/lib/logic/common.d.ts.map +1 -1
  15. package/lib/logic/common.js.map +1 -1
  16. package/lib/logic/craftTransaction.d.ts +1 -1
  17. package/lib/logic/craftTransaction.d.ts.map +1 -1
  18. package/lib/logic/craftTransaction.js.map +1 -1
  19. package/lib/logic/craftTransactionData.d.ts +1 -1
  20. package/lib/logic/craftTransactionData.d.ts.map +1 -1
  21. package/lib/logic/estimateFees.d.ts +1 -1
  22. package/lib/logic/estimateFees.d.ts.map +1 -1
  23. package/lib/logic/estimateFees.js.map +1 -1
  24. package/lib/logic/getBalance.d.ts +1 -1
  25. package/lib/logic/getBalance.d.ts.map +1 -1
  26. package/lib/logic/getBalance.js.map +1 -1
  27. package/lib/logic/getBlock.d.ts +1 -1
  28. package/lib/logic/getBlock.d.ts.map +1 -1
  29. package/lib/logic/getBlock.js.map +1 -1
  30. package/lib/logic/getStakes.d.ts +1 -1
  31. package/lib/logic/getStakes.d.ts.map +1 -1
  32. package/lib/logic/internalTransactionsFetcher.d.ts +1 -1
  33. package/lib/logic/internalTransactionsFetcher.d.ts.map +1 -1
  34. package/lib/logic/internalTransactionsFetcher.js.map +1 -1
  35. package/lib/logic/validateIntent.d.ts +1 -1
  36. package/lib/logic/validateIntent.d.ts.map +1 -1
  37. package/lib/logic/validateIntent.js.map +1 -1
  38. package/lib/logic.d.ts +1 -1
  39. package/lib/logic.d.ts.map +1 -1
  40. package/lib/network/explorer/etherscan.d.ts +4 -4
  41. package/lib/network/explorer/etherscan.d.ts.map +1 -1
  42. package/lib/network/explorer/etherscan.js.map +1 -1
  43. package/lib/network/explorer/index.d.ts +2 -2
  44. package/lib/network/explorer/index.d.ts.map +1 -1
  45. package/lib/network/explorer/index.js.map +1 -1
  46. package/lib/network/explorer/ledger.d.ts +2 -2
  47. package/lib/network/explorer/ledger.d.ts.map +1 -1
  48. package/lib/network/explorer/ledger.js.map +1 -1
  49. package/lib/network/explorer/none.d.ts +1 -1
  50. package/lib/network/explorer/none.d.ts.map +1 -1
  51. package/lib/network/explorer/none.js.map +1 -1
  52. package/lib/network/explorer/types.d.ts +1 -1
  53. package/lib/network/explorer/types.d.ts.map +1 -1
  54. package/lib/network/gasTracker/index.d.ts +2 -2
  55. package/lib/network/gasTracker/index.d.ts.map +1 -1
  56. package/lib/network/gasTracker/index.js.map +1 -1
  57. package/lib/network/gasTracker/ledger.d.ts +3 -3
  58. package/lib/network/gasTracker/ledger.d.ts.map +1 -1
  59. package/lib/network/gasTracker/ledger.js.map +1 -1
  60. package/lib/network/gasTracker/types.d.ts +2 -2
  61. package/lib/network/gasTracker/types.d.ts.map +1 -1
  62. package/lib/network/node/ledger.d.ts +2 -2
  63. package/lib/network/node/ledger.d.ts.map +1 -1
  64. package/lib/network/node/ledger.js.map +1 -1
  65. package/lib/network/node/rpc.common.d.ts +1 -1
  66. package/lib/network/node/rpc.common.d.ts.map +1 -1
  67. package/lib/network/node/rpc.common.js.map +1 -1
  68. package/lib/network/node/types.d.ts +3 -3
  69. package/lib/network/node/types.d.ts.map +1 -1
  70. package/lib/staking/validators/monad.d.ts +2 -1
  71. package/lib/staking/validators/monad.d.ts.map +1 -1
  72. package/lib/staking/validators/monad.js.map +1 -1
  73. package/lib/staking/validators/monadResolver.d.ts +2 -1
  74. package/lib/staking/validators/monadResolver.d.ts.map +1 -1
  75. package/lib/staking/validators/monadResolver.js.map +1 -1
  76. package/lib/staking/validators/somnia.d.ts.map +1 -1
  77. package/lib/staking/validators/somnia.js.map +1 -1
  78. package/lib/staking/validators/zero_gravity.d.ts.map +1 -1
  79. package/lib/staking/validators/zero_gravity.js.map +1 -1
  80. package/lib/types/assets.d.ts +1 -1
  81. package/lib/types/assets.d.ts.map +1 -1
  82. package/lib/types/transaction.d.ts +1 -1
  83. package/lib/types/transaction.d.ts.map +1 -1
  84. package/lib-es/adapters/blockOperations.d.ts +2 -2
  85. package/lib-es/adapters/blockOperations.d.ts.map +1 -1
  86. package/lib-es/adapters/blockOperations.js.map +1 -1
  87. package/lib-es/api/index.d.ts +1 -1
  88. package/lib-es/api/index.d.ts.map +1 -1
  89. package/lib-es/config.d.ts +1 -1
  90. package/lib-es/config.d.ts.map +1 -1
  91. package/lib-es/logic/combine.d.ts +2 -1
  92. package/lib-es/logic/combine.d.ts.map +1 -1
  93. package/lib-es/logic/combine.js.map +1 -1
  94. package/lib-es/logic/common.d.ts +2 -1
  95. package/lib-es/logic/common.d.ts.map +1 -1
  96. package/lib-es/logic/common.js +1 -1
  97. package/lib-es/logic/common.js.map +1 -1
  98. package/lib-es/logic/craftTransaction.d.ts +1 -1
  99. package/lib-es/logic/craftTransaction.d.ts.map +1 -1
  100. package/lib-es/logic/craftTransaction.js.map +1 -1
  101. package/lib-es/logic/craftTransactionData.d.ts +1 -1
  102. package/lib-es/logic/craftTransactionData.d.ts.map +1 -1
  103. package/lib-es/logic/estimateFees.d.ts +1 -1
  104. package/lib-es/logic/estimateFees.d.ts.map +1 -1
  105. package/lib-es/logic/estimateFees.js.map +1 -1
  106. package/lib-es/logic/getBalance.d.ts +1 -1
  107. package/lib-es/logic/getBalance.d.ts.map +1 -1
  108. package/lib-es/logic/getBalance.js.map +1 -1
  109. package/lib-es/logic/getBlock.d.ts +1 -1
  110. package/lib-es/logic/getBlock.d.ts.map +1 -1
  111. package/lib-es/logic/getBlock.js.map +1 -1
  112. package/lib-es/logic/getStakes.d.ts +1 -1
  113. package/lib-es/logic/getStakes.d.ts.map +1 -1
  114. package/lib-es/logic/internalTransactionsFetcher.d.ts +1 -1
  115. package/lib-es/logic/internalTransactionsFetcher.d.ts.map +1 -1
  116. package/lib-es/logic/internalTransactionsFetcher.js.map +1 -1
  117. package/lib-es/logic/validateIntent.d.ts +1 -1
  118. package/lib-es/logic/validateIntent.d.ts.map +1 -1
  119. package/lib-es/logic/validateIntent.js.map +1 -1
  120. package/lib-es/logic.d.ts +1 -1
  121. package/lib-es/logic.d.ts.map +1 -1
  122. package/lib-es/network/explorer/etherscan.d.ts +4 -4
  123. package/lib-es/network/explorer/etherscan.d.ts.map +1 -1
  124. package/lib-es/network/explorer/etherscan.js.map +1 -1
  125. package/lib-es/network/explorer/index.d.ts +2 -2
  126. package/lib-es/network/explorer/index.d.ts.map +1 -1
  127. package/lib-es/network/explorer/index.js.map +1 -1
  128. package/lib-es/network/explorer/ledger.d.ts +2 -2
  129. package/lib-es/network/explorer/ledger.d.ts.map +1 -1
  130. package/lib-es/network/explorer/ledger.js.map +1 -1
  131. package/lib-es/network/explorer/none.d.ts +1 -1
  132. package/lib-es/network/explorer/none.d.ts.map +1 -1
  133. package/lib-es/network/explorer/none.js.map +1 -1
  134. package/lib-es/network/explorer/types.d.ts +1 -1
  135. package/lib-es/network/explorer/types.d.ts.map +1 -1
  136. package/lib-es/network/gasTracker/index.d.ts +2 -2
  137. package/lib-es/network/gasTracker/index.d.ts.map +1 -1
  138. package/lib-es/network/gasTracker/index.js.map +1 -1
  139. package/lib-es/network/gasTracker/ledger.d.ts +3 -3
  140. package/lib-es/network/gasTracker/ledger.d.ts.map +1 -1
  141. package/lib-es/network/gasTracker/ledger.js +1 -1
  142. package/lib-es/network/gasTracker/ledger.js.map +1 -1
  143. package/lib-es/network/gasTracker/types.d.ts +2 -2
  144. package/lib-es/network/gasTracker/types.d.ts.map +1 -1
  145. package/lib-es/network/node/ledger.d.ts +2 -2
  146. package/lib-es/network/node/ledger.d.ts.map +1 -1
  147. package/lib-es/network/node/ledger.js.map +1 -1
  148. package/lib-es/network/node/rpc.common.d.ts +1 -1
  149. package/lib-es/network/node/rpc.common.d.ts.map +1 -1
  150. package/lib-es/network/node/rpc.common.js +1 -1
  151. package/lib-es/network/node/rpc.common.js.map +1 -1
  152. package/lib-es/network/node/types.d.ts +3 -3
  153. package/lib-es/network/node/types.d.ts.map +1 -1
  154. package/lib-es/staking/validators/monad.d.ts +2 -1
  155. package/lib-es/staking/validators/monad.d.ts.map +1 -1
  156. package/lib-es/staking/validators/monad.js.map +1 -1
  157. package/lib-es/staking/validators/monadResolver.d.ts +2 -1
  158. package/lib-es/staking/validators/monadResolver.d.ts.map +1 -1
  159. package/lib-es/staking/validators/monadResolver.js.map +1 -1
  160. package/lib-es/staking/validators/somnia.d.ts.map +1 -1
  161. package/lib-es/staking/validators/somnia.js.map +1 -1
  162. package/lib-es/staking/validators/zero_gravity.d.ts.map +1 -1
  163. package/lib-es/staking/validators/zero_gravity.js.map +1 -1
  164. package/lib-es/types/assets.d.ts +1 -1
  165. package/lib-es/types/assets.d.ts.map +1 -1
  166. package/lib-es/types/transaction.d.ts +1 -1
  167. package/lib-es/types/transaction.d.ts.map +1 -1
  168. package/package.json +1 -1
  169. package/src/adapters/blockOperations.test.ts +2 -2
  170. package/src/adapters/blockOperations.ts +3 -2
  171. package/src/adapters/etherscan.test.ts +7 -7
  172. package/src/adapters/ledger.test.ts +2 -2
  173. package/src/api/getBlock.integ.test.ts +1 -1
  174. package/src/api/index.fantom.integ.test.ts +1 -1
  175. package/src/api/index.flare.integ.test.ts +1 -1
  176. package/src/api/index.integ.test.ts +248 -153
  177. package/src/api/index.linea.integ.test.ts +1 -1
  178. package/src/api/index.optimism.integ.test.ts +1 -1
  179. package/src/api/index.shape.integ.test.ts +1 -1
  180. package/src/api/index.ts +1 -1
  181. package/src/config.ts +1 -1
  182. package/src/fixtures/ledger.fixtures.ts +1 -1
  183. package/src/internalTxSources.test.ts +3 -6
  184. package/src/logic/combine.test.ts +2 -2
  185. package/src/logic/combine.ts +2 -1
  186. package/src/logic/common.test.ts +3 -3
  187. package/src/logic/common.ts +2 -7
  188. package/src/logic/craftTransaction.test.ts +4 -3
  189. package/src/logic/craftTransaction.ts +3 -2
  190. package/src/logic/craftTransactionData.test.ts +1 -1
  191. package/src/logic/craftTransactionData.ts +1 -1
  192. package/src/logic/estimateFees.ts +6 -3
  193. package/src/logic/getBalance.test.ts +1 -1
  194. package/src/logic/getBalance.ts +4 -3
  195. package/src/logic/getBlock.test.ts +8 -7
  196. package/src/logic/getBlock.ts +3 -2
  197. package/src/logic/getBlockInfo.test.ts +1 -3
  198. package/src/logic/getStakes.test.ts +2 -2
  199. package/src/logic/getStakes.ts +1 -1
  200. package/src/logic/internalTransactionsFetcher.test.ts +4 -6
  201. package/src/logic/internalTransactionsFetcher.ts +1 -1
  202. package/src/logic/lastBlock.test.ts +2 -1
  203. package/src/logic/listOperations.test.ts +3 -2
  204. package/src/logic/validateIntent.test.ts +2 -1
  205. package/src/logic/validateIntent.ts +4 -2
  206. package/src/logic.ts +1 -1
  207. package/src/network/explorer/etherscan.test.ts +1 -1
  208. package/src/network/explorer/etherscan.ts +12 -10
  209. package/src/network/explorer/index.test.ts +1 -1
  210. package/src/network/explorer/index.ts +2 -2
  211. package/src/network/explorer/ledger.test.ts +2 -1
  212. package/src/network/explorer/ledger.ts +3 -2
  213. package/src/network/explorer/none.ts +2 -1
  214. package/src/network/explorer/types.ts +1 -1
  215. package/src/network/gasTracker/index.test.ts +1 -1
  216. package/src/network/gasTracker/index.ts +2 -2
  217. package/src/network/gasTracker/ledger.test.ts +10 -17
  218. package/src/network/gasTracker/ledger.ts +5 -7
  219. package/src/network/gasTracker/types.ts +2 -2
  220. package/src/network/node/index.memoization.test.ts +1 -1
  221. package/src/network/node/ledger.ts +6 -5
  222. package/src/network/node/rpc.common.ts +14 -14
  223. package/src/network/node/rpc.test.ts +4 -10
  224. package/src/network/node/types.ts +3 -3
  225. package/src/staking/detectOperationType.test.ts +1 -1
  226. package/src/staking/encoder.test.ts +1 -1
  227. package/src/staking/operations/index.test.ts +1 -1
  228. package/src/staking/redelegations.test.ts +23 -15
  229. package/src/staking/rewards.test.ts +6 -2
  230. package/src/staking/rewardsFromReceipt.test.ts +1 -1
  231. package/src/staking/transactionData.test.ts +2 -2
  232. package/src/staking/validators/monad.ts +2 -1
  233. package/src/staking/validators/monadResolver.ts +2 -1
  234. package/src/staking/validators/somnia.ts +2 -1
  235. package/src/staking/validators/zero_gravity.ts +2 -1
  236. package/src/staking/validators.test.ts +7 -2
  237. package/src/types/assets.ts +1 -1
  238. package/src/types/transaction.ts +1 -1
@@ -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, { AxiosRequestConfig } from '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
- FetchRequest,
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'
@@ -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 = { node: mockNode } as unknown as import('../config').EvmConfigInfo
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 = { node: zgNode } as unknown as import('../config').EvmConfigInfo
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).not.toBeNull()
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).not.toBeNull()
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).not.toBeNull()
447
- expect(result!.validatorAddress).toBe(VALIDATOR)
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).not.toBeNull()
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
- { case: 'chain has no rewardsStrategy (e.g. Celo)', currencyId: 'celo', setup: () => {} },
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'
@@ -13,10 +13,11 @@ import type {
13
13
  StakeState,
14
14
  Validator,
15
15
  } from '@ledgerhq/coin-module-framework/api/types'
16
+ import type { JsonRpcProvider } from 'ethers'
16
17
  import network from '@ledgerhq/live-network'
17
18
  import { makeLRUCache } from '@ledgerhq/live-network/cache'
18
19
  import { log } from '@ledgerhq/logs'
19
- import { ethers, type JsonRpcProvider } from 'ethers'
20
+ import { ethers } from 'ethers'
20
21
  import { evmUnit } from '../../logic/evmUnit'
21
22
  import { withApi } from '../../network/node/rpc.common'
22
23
  import { isExternalNodeConfig } from '../../network/node/types'
@@ -2,8 +2,9 @@
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
4
  import type { EvmConfigInfo } from '../../config'
5
+ import type { JsonRpcProvider } from 'ethers'
5
6
  import { log } from '@ledgerhq/logs'
6
- import { ethers, type JsonRpcProvider } from 'ethers'
7
+ import { ethers } from 'ethers'
7
8
  import { withApi } from '../../network/node/rpc.common'
8
9
  import { isExternalNodeConfig } from '../../network/node/types'
9
10
  import { getStakingABI } from '../abis'
@@ -6,10 +6,11 @@ import type { StakingContractConfig } from '../../types/staking'
6
6
  import type { ValidatorApi } from './types'
7
7
  import type { Page } from '@ledgerhq/coin-module-framework/api/index'
8
8
  import type { AssetInfo, Stake, Validator } from '@ledgerhq/coin-module-framework/api/types'
9
+ import type { JsonRpcProvider } from 'ethers'
9
10
  import network from '@ledgerhq/live-network'
10
11
  import { makeLRUCache } from '@ledgerhq/live-network/cache'
11
12
  import { log } from '@ledgerhq/logs'
12
- import { ethers, type JsonRpcProvider } from 'ethers'
13
+ import { ethers } from 'ethers'
13
14
  import { evmUnit } from '../../logic/evmUnit'
14
15
  import { withApi } from '../../network/node/rpc.common'
15
16
  import { isExternalNodeConfig } from '../../network/node/types'
@@ -6,9 +6,10 @@ import type { StakingContractConfig } from '../../types/staking'
6
6
  import type { ValidatorApi } from './types'
7
7
  import type { Page } from '@ledgerhq/coin-module-framework/api/index'
8
8
  import type { AssetInfo, Stake, Validator } from '@ledgerhq/coin-module-framework/api/types'
9
+ import type { JsonRpcProvider } from 'ethers'
9
10
  import network from '@ledgerhq/live-network'
10
11
  import { log } from '@ledgerhq/logs'
11
- import { ethers, type JsonRpcProvider } from 'ethers'
12
+ import { ethers } from 'ethers'
12
13
  import { evmUnit } from '../../logic/evmUnit'
13
14
  import { withApi } from '../../network/node/rpc.common'
14
15
  import { isExternalNodeConfig } from '../../network/node/types'
@@ -1,6 +1,7 @@
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 network from '@ledgerhq/live-network'
5
6
  import {
6
7
  clearValidatorsCache,
@@ -22,9 +23,13 @@ jest.mock('@ledgerhq/live-network', () => ({
22
23
 
23
24
  const mockedNetwork = jest.mocked(network)
24
25
 
25
- const mockConfig = {
26
+ const mockConfig: EvmConfigInfo = {
27
+ status: { type: 'active' },
28
+ chainId: 1,
29
+ name: 'Test EVM',
26
30
  node: { type: 'external', uri: 'https://sei-evm.coin.ledger.com' },
27
- } as unknown as import('../config').EvmConfigInfo
31
+ explorer: { type: 'none' },
32
+ }
28
33
 
29
34
  const cosmosValidatorsPayload = {
30
35
  status: 200,
@@ -1,7 +1,7 @@
1
1
  // SPDX-FileCopyrightText: © 2026 LEDGER SAS
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
- import { AssetInfo } from '@ledgerhq/coin-module-framework/api/types'
4
+ import type { AssetInfo } from '@ledgerhq/coin-module-framework/api/types'
5
5
 
6
6
  export function isNative(asset: AssetInfo): asset is { type: 'native' } {
7
7
  return asset.type === 'native'
@@ -1,7 +1,7 @@
1
1
  // SPDX-FileCopyrightText: © 2026 LEDGER SAS
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
- import BigNumber from 'bignumber.js'
4
+ import type BigNumber from 'bignumber.js'
5
5
 
6
6
  export type FeeHistory = {
7
7
  baseFeePerGas: string[]