@ledgerhq/coin-evm 10.1.0 → 15.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +58 -0
- package/docs/getBlock-internal-txs-schema.md +2 -2
- package/docs/network/node/index.md +1 -1
- package/lib/adapters/etherscan.d.ts +2 -1
- package/lib/adapters/etherscan.d.ts.map +1 -1
- package/lib/adapters/etherscan.js +16 -2
- package/lib/adapters/etherscan.js.map +1 -1
- package/lib/adapters/ledger.d.ts +2 -1
- package/lib/adapters/ledger.d.ts.map +1 -1
- package/lib/adapters/ledger.js +4 -2
- package/lib/adapters/ledger.js.map +1 -1
- package/lib/api/index.d.ts.map +1 -1
- package/lib/api/index.js +1 -2
- package/lib/api/index.js.map +1 -1
- package/lib/chains.d.ts +95 -0
- package/lib/chains.d.ts.map +1 -0
- package/lib/chains.js +99 -0
- package/lib/chains.js.map +1 -0
- package/lib/config.d.ts +4 -1
- package/lib/config.d.ts.map +1 -1
- package/lib/config.js +3 -1
- package/lib/config.js.map +1 -1
- package/lib/logic/broadcast.js +2 -2
- package/lib/logic/broadcast.js.map +1 -1
- package/lib/logic/common.d.ts +1 -1
- package/lib/logic/common.d.ts.map +1 -1
- package/lib/logic/common.js +11 -11
- package/lib/logic/common.js.map +1 -1
- package/lib/logic/craftTransaction.d.ts.map +1 -1
- package/lib/logic/craftTransaction.js +3 -3
- package/lib/logic/craftTransaction.js.map +1 -1
- package/lib/logic/estimateFees.d.ts.map +1 -1
- package/lib/logic/estimateFees.js +7 -7
- package/lib/logic/estimateFees.js.map +1 -1
- package/lib/logic/getBalance.d.ts.map +1 -1
- package/lib/logic/getBalance.js +9 -9
- package/lib/logic/getBalance.js.map +1 -1
- package/lib/logic/getBlock.d.ts.map +1 -1
- package/lib/logic/getBlock.js +38 -21
- package/lib/logic/getBlock.js.map +1 -1
- package/lib/logic/getBlockInfo.js +2 -2
- package/lib/logic/getBlockInfo.js.map +1 -1
- package/lib/logic/getNextSequence.d.ts.map +1 -1
- package/lib/logic/getNextSequence.js +1 -1
- package/lib/logic/getNextSequence.js.map +1 -1
- package/lib/logic/getStakes.d.ts.map +1 -1
- package/lib/logic/getStakes.js +10 -10
- package/lib/logic/getStakes.js.map +1 -1
- package/lib/logic/internalTransactionsFetcher.d.ts +2 -2
- package/lib/logic/internalTransactionsFetcher.d.ts.map +1 -1
- package/lib/logic/internalTransactionsFetcher.js +8 -8
- package/lib/logic/internalTransactionsFetcher.js.map +1 -1
- package/lib/logic/lastBlock.js +2 -2
- package/lib/logic/lastBlock.js.map +1 -1
- package/lib/logic/listOperations.d.ts.map +1 -1
- package/lib/logic/listOperations.js +3 -1
- package/lib/logic/listOperations.js.map +1 -1
- package/lib/logic/validateIntent.d.ts.map +1 -1
- package/lib/logic/validateIntent.js +9 -9
- 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/logic.js +14 -13
- package/lib/logic.js.map +1 -1
- package/lib/network/explorer/etherscan.d.ts +2 -3
- package/lib/network/explorer/etherscan.d.ts.map +1 -1
- package/lib/network/explorer/etherscan.js +6 -8
- package/lib/network/explorer/etherscan.js.map +1 -1
- package/lib/network/explorer/ledger.d.ts.map +1 -1
- package/lib/network/explorer/ledger.js +5 -5
- package/lib/network/explorer/ledger.js.map +1 -1
- package/lib/network/explorer/types.d.ts +2 -2
- package/lib/network/explorer/types.d.ts.map +1 -1
- package/lib/network/explorer/types.js.map +1 -1
- package/lib/network/node/explorerProxy.d.ts.map +1 -1
- package/lib/network/node/explorerProxy.js +14 -12
- package/lib/network/node/explorerProxy.js.map +1 -1
- package/lib/network/node/index.d.ts +1 -1
- package/lib/network/node/index.d.ts.map +1 -1
- package/lib/network/node/index.js +7 -7
- package/lib/network/node/index.js.map +1 -1
- package/lib/network/node/ledger.d.ts +3 -1
- package/lib/network/node/ledger.d.ts.map +1 -1
- package/lib/network/node/ledger.js +32 -22
- 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 +67 -39
- package/lib/network/node/rpc.common.js.map +1 -1
- package/lib/network/node/types.d.ts +18 -16
- package/lib/network/node/types.d.ts.map +1 -1
- package/lib/network/node/types.js.map +1 -1
- package/lib/network/node/withNodeSources.d.ts.map +1 -1
- package/lib/network/node/withNodeSources.js +15 -15
- package/lib/network/node/withNodeSources.js.map +1 -1
- package/lib/staking/abis.d.ts +3 -2
- package/lib/staking/abis.d.ts.map +1 -1
- package/lib/staking/abis.js +10 -9
- package/lib/staking/abis.js.map +1 -1
- package/lib/staking/contracts.d.ts +3 -2
- package/lib/staking/contracts.d.ts.map +1 -1
- package/lib/staking/contracts.js +11 -10
- package/lib/staking/contracts.js.map +1 -1
- package/lib/staking/detectOperationType.d.ts +2 -1
- package/lib/staking/detectOperationType.d.ts.map +1 -1
- package/lib/staking/detectOperationType.js +7 -7
- package/lib/staking/detectOperationType.js.map +1 -1
- package/lib/staking/encoder.d.ts +2 -1
- package/lib/staking/encoder.d.ts.map +1 -1
- package/lib/staking/encoder.js +8 -8
- package/lib/staking/encoder.js.map +1 -1
- package/lib/staking/fetchers.d.ts +2 -1
- package/lib/staking/fetchers.d.ts.map +1 -1
- package/lib/staking/fetchers.js +27 -27
- package/lib/staking/fetchers.js.map +1 -1
- package/lib/staking/logic.d.ts +6 -6
- package/lib/staking/logic.d.ts.map +1 -1
- package/lib/staking/logic.js +14 -13
- package/lib/staking/logic.js.map +1 -1
- package/lib/staking/operations/index.d.ts +2 -1
- package/lib/staking/operations/index.d.ts.map +1 -1
- package/lib/staking/operations/index.js +30 -28
- package/lib/staking/operations/index.js.map +1 -1
- package/lib/staking/prepareIntents.d.ts +1 -1
- package/lib/staking/prepareIntents.d.ts.map +1 -1
- package/lib/staking/prepareIntents.js +11 -10
- package/lib/staking/prepareIntents.js.map +1 -1
- package/lib/staking/redelegations.d.ts +4 -4
- package/lib/staking/redelegations.d.ts.map +1 -1
- package/lib/staking/redelegations.js +18 -20
- package/lib/staking/redelegations.js.map +1 -1
- package/lib/staking/rewards.d.ts +1 -1
- package/lib/staking/rewards.d.ts.map +1 -1
- package/lib/staking/rewards.js +2 -2
- package/lib/staking/rewards.js.map +1 -1
- package/lib/staking/rewardsFromReceipt.d.ts +2 -1
- package/lib/staking/rewardsFromReceipt.d.ts.map +1 -1
- package/lib/staking/rewardsFromReceipt.js +2 -2
- package/lib/staking/rewardsFromReceipt.js.map +1 -1
- package/lib/staking/transactionData.d.ts +2 -1
- package/lib/staking/transactionData.d.ts.map +1 -1
- package/lib/staking/transactionData.js +6 -6
- package/lib/staking/transactionData.js.map +1 -1
- package/lib/staking/unbondings.d.ts +1 -1
- package/lib/staking/unbondings.d.ts.map +1 -1
- package/lib/staking/unbondings.js +2 -2
- package/lib/staking/unbondings.js.map +1 -1
- package/lib/staking/validators/index.d.ts +14 -14
- package/lib/staking/validators/index.d.ts.map +1 -1
- package/lib/staking/validators/index.js +39 -38
- package/lib/staking/validators/index.js.map +1 -1
- package/lib/staking/validators/monad.d.ts +5 -5
- package/lib/staking/validators/monad.d.ts.map +1 -1
- package/lib/staking/validators/monad.js +31 -33
- package/lib/staking/validators/monad.js.map +1 -1
- package/lib/staking/validators/monadResolver.d.ts +1 -1
- package/lib/staking/validators/monadResolver.d.ts.map +1 -1
- package/lib/staking/validators/monadResolver.js +4 -4
- package/lib/staking/validators/monadResolver.js.map +1 -1
- package/lib/staking/validators/sei.js +2 -2
- package/lib/staking/validators/sei.js.map +1 -1
- package/lib/staking/validators/somnia.d.ts +4 -4
- package/lib/staking/validators/somnia.d.ts.map +1 -1
- package/lib/staking/validators/somnia.js +22 -22
- package/lib/staking/validators/somnia.js.map +1 -1
- package/lib/staking/validators/types.d.ts +1 -1
- package/lib/staking/validators/types.d.ts.map +1 -1
- package/lib/staking/validators/zero_gravity.d.ts +1 -1
- package/lib/staking/validators/zero_gravity.d.ts.map +1 -1
- package/lib/staking/validators/zero_gravity.js +7 -7
- package/lib/staking/validators/zero_gravity.js.map +1 -1
- package/lib/types/staking.d.ts +5 -6
- package/lib/types/staking.d.ts.map +1 -1
- package/lib-es/adapters/etherscan.d.ts +2 -1
- package/lib-es/adapters/etherscan.d.ts.map +1 -1
- package/lib-es/adapters/etherscan.js +16 -2
- package/lib-es/adapters/etherscan.js.map +1 -1
- package/lib-es/adapters/ledger.d.ts +2 -1
- package/lib-es/adapters/ledger.d.ts.map +1 -1
- package/lib-es/adapters/ledger.js +4 -2
- package/lib-es/adapters/ledger.js.map +1 -1
- package/lib-es/api/index.d.ts.map +1 -1
- package/lib-es/api/index.js +1 -2
- package/lib-es/api/index.js.map +1 -1
- package/lib-es/chains.d.ts +95 -0
- package/lib-es/chains.d.ts.map +1 -0
- package/lib-es/chains.js +96 -0
- package/lib-es/chains.js.map +1 -0
- package/lib-es/config.d.ts +4 -1
- package/lib-es/config.d.ts.map +1 -1
- package/lib-es/config.js +1 -0
- package/lib-es/config.js.map +1 -1
- package/lib-es/logic/broadcast.js +2 -2
- package/lib-es/logic/broadcast.js.map +1 -1
- package/lib-es/logic/common.d.ts +1 -1
- package/lib-es/logic/common.d.ts.map +1 -1
- package/lib-es/logic/common.js +11 -11
- package/lib-es/logic/common.js.map +1 -1
- package/lib-es/logic/craftTransaction.d.ts.map +1 -1
- package/lib-es/logic/craftTransaction.js +3 -3
- package/lib-es/logic/craftTransaction.js.map +1 -1
- package/lib-es/logic/estimateFees.d.ts.map +1 -1
- package/lib-es/logic/estimateFees.js +7 -7
- package/lib-es/logic/estimateFees.js.map +1 -1
- package/lib-es/logic/getBalance.d.ts.map +1 -1
- package/lib-es/logic/getBalance.js +9 -9
- package/lib-es/logic/getBalance.js.map +1 -1
- package/lib-es/logic/getBlock.d.ts.map +1 -1
- package/lib-es/logic/getBlock.js +39 -22
- package/lib-es/logic/getBlock.js.map +1 -1
- package/lib-es/logic/getBlockInfo.js +2 -2
- package/lib-es/logic/getBlockInfo.js.map +1 -1
- package/lib-es/logic/getNextSequence.d.ts.map +1 -1
- package/lib-es/logic/getNextSequence.js +1 -1
- package/lib-es/logic/getNextSequence.js.map +1 -1
- package/lib-es/logic/getStakes.d.ts.map +1 -1
- package/lib-es/logic/getStakes.js +10 -10
- package/lib-es/logic/getStakes.js.map +1 -1
- package/lib-es/logic/internalTransactionsFetcher.d.ts +2 -2
- package/lib-es/logic/internalTransactionsFetcher.d.ts.map +1 -1
- package/lib-es/logic/internalTransactionsFetcher.js +8 -8
- package/lib-es/logic/internalTransactionsFetcher.js.map +1 -1
- package/lib-es/logic/lastBlock.js +2 -2
- package/lib-es/logic/lastBlock.js.map +1 -1
- package/lib-es/logic/listOperations.d.ts.map +1 -1
- package/lib-es/logic/listOperations.js +3 -1
- package/lib-es/logic/listOperations.js.map +1 -1
- package/lib-es/logic/validateIntent.d.ts.map +1 -1
- package/lib-es/logic/validateIntent.js +9 -9
- 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/logic.js +14 -13
- package/lib-es/logic.js.map +1 -1
- package/lib-es/network/explorer/etherscan.d.ts +2 -3
- package/lib-es/network/explorer/etherscan.d.ts.map +1 -1
- package/lib-es/network/explorer/etherscan.js +6 -8
- package/lib-es/network/explorer/etherscan.js.map +1 -1
- package/lib-es/network/explorer/ledger.d.ts.map +1 -1
- package/lib-es/network/explorer/ledger.js +5 -5
- package/lib-es/network/explorer/ledger.js.map +1 -1
- package/lib-es/network/explorer/types.d.ts +2 -2
- package/lib-es/network/explorer/types.d.ts.map +1 -1
- package/lib-es/network/explorer/types.js.map +1 -1
- package/lib-es/network/node/explorerProxy.d.ts.map +1 -1
- package/lib-es/network/node/explorerProxy.js +14 -12
- package/lib-es/network/node/explorerProxy.js.map +1 -1
- package/lib-es/network/node/index.d.ts +1 -1
- package/lib-es/network/node/index.d.ts.map +1 -1
- package/lib-es/network/node/index.js +7 -7
- package/lib-es/network/node/index.js.map +1 -1
- package/lib-es/network/node/ledger.d.ts +3 -1
- package/lib-es/network/node/ledger.d.ts.map +1 -1
- package/lib-es/network/node/ledger.js +32 -22
- 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 +67 -39
- package/lib-es/network/node/rpc.common.js.map +1 -1
- package/lib-es/network/node/types.d.ts +18 -16
- package/lib-es/network/node/types.d.ts.map +1 -1
- package/lib-es/network/node/types.js.map +1 -1
- package/lib-es/network/node/withNodeSources.d.ts.map +1 -1
- package/lib-es/network/node/withNodeSources.js +15 -15
- package/lib-es/network/node/withNodeSources.js.map +1 -1
- package/lib-es/staking/abis.d.ts +3 -2
- package/lib-es/staking/abis.d.ts.map +1 -1
- package/lib-es/staking/abis.js +10 -9
- package/lib-es/staking/abis.js.map +1 -1
- package/lib-es/staking/contracts.d.ts +3 -2
- package/lib-es/staking/contracts.d.ts.map +1 -1
- package/lib-es/staking/contracts.js +11 -10
- package/lib-es/staking/contracts.js.map +1 -1
- package/lib-es/staking/detectOperationType.d.ts +2 -1
- package/lib-es/staking/detectOperationType.d.ts.map +1 -1
- package/lib-es/staking/detectOperationType.js +7 -7
- package/lib-es/staking/detectOperationType.js.map +1 -1
- package/lib-es/staking/encoder.d.ts +2 -1
- package/lib-es/staking/encoder.d.ts.map +1 -1
- package/lib-es/staking/encoder.js +8 -8
- package/lib-es/staking/encoder.js.map +1 -1
- package/lib-es/staking/fetchers.d.ts +2 -1
- package/lib-es/staking/fetchers.d.ts.map +1 -1
- package/lib-es/staking/fetchers.js +27 -27
- package/lib-es/staking/fetchers.js.map +1 -1
- package/lib-es/staking/logic.d.ts +6 -6
- package/lib-es/staking/logic.d.ts.map +1 -1
- package/lib-es/staking/logic.js +14 -13
- package/lib-es/staking/logic.js.map +1 -1
- package/lib-es/staking/operations/index.d.ts +2 -1
- package/lib-es/staking/operations/index.d.ts.map +1 -1
- package/lib-es/staking/operations/index.js +30 -28
- package/lib-es/staking/operations/index.js.map +1 -1
- package/lib-es/staking/prepareIntents.d.ts +1 -1
- package/lib-es/staking/prepareIntents.d.ts.map +1 -1
- package/lib-es/staking/prepareIntents.js +11 -10
- package/lib-es/staking/prepareIntents.js.map +1 -1
- package/lib-es/staking/redelegations.d.ts +4 -4
- package/lib-es/staking/redelegations.d.ts.map +1 -1
- package/lib-es/staking/redelegations.js +18 -20
- package/lib-es/staking/redelegations.js.map +1 -1
- package/lib-es/staking/rewards.d.ts +1 -1
- package/lib-es/staking/rewards.d.ts.map +1 -1
- package/lib-es/staking/rewards.js +2 -2
- package/lib-es/staking/rewards.js.map +1 -1
- package/lib-es/staking/rewardsFromReceipt.d.ts +2 -1
- package/lib-es/staking/rewardsFromReceipt.d.ts.map +1 -1
- package/lib-es/staking/rewardsFromReceipt.js +2 -2
- package/lib-es/staking/rewardsFromReceipt.js.map +1 -1
- package/lib-es/staking/transactionData.d.ts +2 -1
- package/lib-es/staking/transactionData.d.ts.map +1 -1
- package/lib-es/staking/transactionData.js +6 -6
- package/lib-es/staking/transactionData.js.map +1 -1
- package/lib-es/staking/unbondings.d.ts +1 -1
- package/lib-es/staking/unbondings.d.ts.map +1 -1
- package/lib-es/staking/unbondings.js +2 -2
- package/lib-es/staking/unbondings.js.map +1 -1
- package/lib-es/staking/validators/index.d.ts +14 -14
- package/lib-es/staking/validators/index.d.ts.map +1 -1
- package/lib-es/staking/validators/index.js +39 -38
- package/lib-es/staking/validators/index.js.map +1 -1
- package/lib-es/staking/validators/monad.d.ts +5 -5
- package/lib-es/staking/validators/monad.d.ts.map +1 -1
- package/lib-es/staking/validators/monad.js +31 -33
- package/lib-es/staking/validators/monad.js.map +1 -1
- package/lib-es/staking/validators/monadResolver.d.ts +1 -1
- package/lib-es/staking/validators/monadResolver.d.ts.map +1 -1
- package/lib-es/staking/validators/monadResolver.js +4 -4
- package/lib-es/staking/validators/monadResolver.js.map +1 -1
- package/lib-es/staking/validators/sei.js +2 -2
- package/lib-es/staking/validators/sei.js.map +1 -1
- package/lib-es/staking/validators/somnia.d.ts +4 -4
- package/lib-es/staking/validators/somnia.d.ts.map +1 -1
- package/lib-es/staking/validators/somnia.js +22 -22
- package/lib-es/staking/validators/somnia.js.map +1 -1
- package/lib-es/staking/validators/types.d.ts +1 -1
- package/lib-es/staking/validators/types.d.ts.map +1 -1
- package/lib-es/staking/validators/zero_gravity.d.ts +1 -1
- package/lib-es/staking/validators/zero_gravity.d.ts.map +1 -1
- package/lib-es/staking/validators/zero_gravity.js +7 -7
- package/lib-es/staking/validators/zero_gravity.js.map +1 -1
- package/lib-es/types/staking.d.ts +5 -6
- package/lib-es/types/staking.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/adapters/etherscan.test.ts +91 -43
- package/src/adapters/etherscan.ts +18 -2
- package/src/adapters/ledger.test.ts +106 -31
- package/src/adapters/ledger.ts +5 -2
- package/src/api/index.ts +1 -2
- package/src/api/{getBlock.integ.test.ts → tests/getBlock.integ.test.ts} +5 -4
- package/src/api/{index.arbitrum.integ.test.ts → tests/index.arbitrum.integ.test.ts} +3 -3
- package/src/api/{index.arc.integ.test.ts → tests/index.arc.integ.test.ts} +3 -3
- package/src/api/{index.avalanche_c_chain_fuji.integ.test.ts → tests/index.avalanche_c_chain_fuji.integ.test.ts} +3 -3
- package/src/api/{index.cronos.integ.test.ts → tests/index.cronos.integ.test.ts} +3 -3
- package/src/api/{index.flare.integ.test.ts → tests/index.flare.integ.test.ts} +3 -3
- package/src/api/{index.integ.test.ts → tests/index.integ.test.ts} +3 -3
- package/src/api/{index.linea.integ.test.ts → tests/index.linea.integ.test.ts} +3 -3
- package/src/api/{index.monad_testnet.integ.test.ts → tests/index.monad_testnet.integ.test.ts} +6 -6
- package/src/api/{index.optimism.integ.test.ts → tests/index.optimism.integ.test.ts} +3 -3
- package/src/api/{index.rsk.integ.test.ts → tests/index.rsk.integ.test.ts} +3 -3
- package/src/api/{index.shape.integ.test.ts → tests/index.shape.integ.test.ts} +3 -3
- package/src/api/{index.somnia.integ.test.ts → tests/index.somnia.integ.test.ts} +3 -3
- package/src/api/{index.test.ts → tests/index.test.ts} +4 -4
- package/src/api/{index.zksync.integ.test.ts → tests/index.zksync.integ.test.ts} +2 -2
- package/src/chains.test.ts +12 -0
- package/src/chains.ts +98 -0
- package/src/config.ts +5 -1
- package/src/fixtures/staking.fixtures.ts +13 -0
- package/src/logic/broadcast.ts +2 -2
- package/src/logic/common.ts +10 -11
- package/src/logic/craftTransaction.ts +2 -3
- package/src/logic/estimateFees.ts +6 -23
- package/src/logic/getBalance.ts +7 -13
- package/src/logic/getBlock.ts +59 -23
- package/src/logic/getBlockInfo.ts +2 -2
- package/src/logic/getNextSequence.ts +1 -4
- package/src/logic/getStakes.ts +11 -12
- package/src/logic/internalTransactionsFetcher.ts +6 -8
- package/src/logic/lastBlock.ts +2 -2
- package/src/logic/listOperations.ts +2 -1
- package/src/logic/tests/broadcast.test.ts +5 -5
- package/src/logic/tests/broadcastSource.test.ts +1 -4
- package/src/logic/tests/common.test.ts +18 -34
- package/src/logic/tests/craftTransaction.test.ts +14 -7
- package/src/logic/tests/estimateFees.test.ts +17 -8
- package/src/logic/tests/getBalance.test.ts +18 -34
- package/src/logic/tests/getBlock.test.ts +195 -80
- package/src/logic/tests/getBlockInfo.test.ts +2 -2
- package/src/logic/tests/getNextSequence.test.ts +2 -2
- package/src/logic/tests/getStakes.test.ts +28 -16
- package/src/logic/tests/internalTransactionsFetcher.test.ts +6 -6
- package/src/logic/tests/lastBlock.test.ts +4 -7
- package/src/logic/tests/listOperations.test.ts +8 -7
- package/src/logic/tests/validateIntent.test.ts +49 -3
- package/src/logic/validateIntent.ts +8 -10
- package/src/logic.test.ts +13 -5
- package/src/logic.ts +13 -13
- package/src/network/explorer/etherscan.ts +8 -24
- package/src/network/explorer/ledger.ts +2 -5
- package/src/network/explorer/types.ts +0 -2
- package/src/network/node/explorerProxy.ts +14 -12
- package/src/network/node/index.ts +11 -8
- package/src/network/node/ledger.ts +32 -34
- package/src/network/node/rpc.common.ts +79 -86
- package/src/network/node/types.ts +16 -31
- package/src/network/node/withNodeSources.ts +23 -26
- package/src/network/{explorer → tests/explorer}/etherscan.test.ts +16 -65
- package/src/network/{explorer → tests/explorer}/index.test.ts +8 -8
- package/src/network/{explorer → tests/explorer}/ledger.test.ts +34 -142
- package/src/network/{explorer → tests/explorer}/types.test.ts +1 -1
- package/src/network/{gasTracker → tests/gasTracker}/index.test.ts +3 -3
- package/src/network/{gasTracker → tests/gasTracker}/ledger.test.ts +4 -4
- package/src/network/{gasTracker → tests/gasTracker}/types.test.ts +1 -1
- package/src/network/{node → tests/node}/explorerProxy.test.ts +22 -24
- package/src/network/{node → tests/node}/gethCallTracerToTraceBlockItems.test.ts +4 -4
- package/src/network/tests/node/index.memoization.test.ts +70 -0
- package/src/network/{node → tests/node}/index.test.ts +4 -6
- package/src/network/{node → tests/node}/ledger.test.ts +69 -74
- package/src/network/{node → tests/node}/node.fixtures.ts +1 -1
- package/src/network/{node → tests/node}/rpc.errors.test.ts +1 -1
- package/src/network/{node → tests/node}/rpc.test.ts +100 -119
- package/src/network/{node → tests/node}/types.test.ts +1 -1
- package/src/network/{node → tests/node}/withNodeSources.test.ts +10 -12
- package/src/network/{withRetries.test.ts → tests/withRetries.test.ts} +2 -2
- package/src/staking/abis.test.ts +24 -28
- package/src/staking/abis.ts +12 -10
- package/src/staking/contracts.test.ts +20 -8
- package/src/staking/contracts.ts +12 -11
- package/src/staking/detectOperationType.test.ts +16 -13
- package/src/staking/detectOperationType.ts +9 -8
- package/src/staking/encoder.test.ts +38 -27
- package/src/staking/encoder.ts +9 -8
- package/src/staking/fetchers.ts +28 -39
- package/src/staking/logic.test.ts +34 -32
- package/src/staking/logic.ts +14 -14
- package/src/staking/operations/index.test.ts +48 -39
- package/src/staking/operations/index.ts +31 -28
- package/src/staking/prepareIntents.test.ts +14 -34
- package/src/staking/prepareIntents.ts +10 -13
- package/src/staking/redelegations.test.ts +73 -131
- package/src/staking/redelegations.ts +12 -26
- package/src/staking/rewards.test.ts +19 -21
- package/src/staking/rewards.ts +1 -2
- package/src/staking/rewardsFromReceipt.test.ts +9 -8
- package/src/staking/rewardsFromReceipt.ts +3 -2
- package/src/staking/transactionData.test.ts +35 -25
- package/src/staking/transactionData.ts +7 -6
- package/src/staking/unbondings.test.ts +26 -20
- package/src/staking/unbondings.ts +1 -2
- package/src/staking/validators/index.ts +45 -51
- package/src/staking/validators/monad.test.ts +52 -54
- package/src/staking/validators/monad.ts +31 -37
- package/src/staking/validators/monadResolver.ts +2 -4
- package/src/staking/validators/sei.ts +2 -2
- package/src/staking/validators/somnia.test.ts +22 -19
- package/src/staking/validators/somnia.ts +20 -27
- package/src/staking/validators/types.ts +0 -1
- package/src/staking/validators/zero_gravity.test.ts +34 -49
- package/src/staking/validators/zero_gravity.ts +5 -11
- package/src/staking/validators.integ.test.ts +3 -5
- package/src/staking/validators.test.ts +56 -53
- package/src/types/staking.ts +3 -6
- package/src/network/node/index.memoization.test.ts +0 -63
|
@@ -1,33 +1,33 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: © 2026 LEDGER SAS
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
-
import type { EvmConfigInfo, NftStandard } from '
|
|
5
|
-
import type { LedgerExplorerOperation } from '
|
|
4
|
+
import type { EvmConfigInfo, NftStandard } from '../../../config'
|
|
5
|
+
import type { LedgerExplorerOperation } from '../../../types'
|
|
6
6
|
import type { AssetInfo } from '@ledgerhq/coin-module-framework/api/types'
|
|
7
7
|
import type { AxiosRequestConfig } from 'axios'
|
|
8
8
|
import { AssertionError, fail } from 'assert'
|
|
9
9
|
import { delay } from '@ledgerhq/coin-module-framework/promises'
|
|
10
10
|
import axios from 'axios'
|
|
11
11
|
import eip55 from 'eip55'
|
|
12
|
-
import { DEFAULT_LEDGER_EXPLORER_URI } from '
|
|
12
|
+
import { DEFAULT_LEDGER_EXPLORER_URI } from '../../../config'
|
|
13
13
|
import {
|
|
14
14
|
LedgerExplorerUsedIncorrectly,
|
|
15
15
|
RateLimitError,
|
|
16
16
|
UnpageableLedgerExplorerBlock,
|
|
17
|
-
} from '
|
|
17
|
+
} from '../../../errors'
|
|
18
18
|
import {
|
|
19
19
|
createMockEvmConfigInfo,
|
|
20
20
|
mkExternalNode,
|
|
21
21
|
mkLedgerNode,
|
|
22
22
|
testLogger,
|
|
23
|
-
} from '
|
|
23
|
+
} from '../../../fixtures/context.fixtures'
|
|
24
24
|
import {
|
|
25
25
|
coinOperation1,
|
|
26
26
|
coinOperation2,
|
|
27
27
|
coinOperation3,
|
|
28
28
|
coinOperation4,
|
|
29
|
-
} from '
|
|
30
|
-
import * as LEDGER_API from '
|
|
29
|
+
} from '../../../fixtures/ledger.fixtures'
|
|
30
|
+
import * as LEDGER_API from '../../explorer/ledger'
|
|
31
31
|
|
|
32
32
|
jest.mock('axios')
|
|
33
33
|
jest.mock('@ledgerhq/coin-module-framework/promises')
|
|
@@ -256,7 +256,6 @@ describe('EVM Family', () => {
|
|
|
256
256
|
await LEDGER_API.getOperations(
|
|
257
257
|
config,
|
|
258
258
|
testLogger,
|
|
259
|
-
'ethereum',
|
|
260
259
|
'0x6cBCD73CD8e8a42844662f0A0e76D7F79Afd933d',
|
|
261
260
|
0,
|
|
262
261
|
undefined,
|
|
@@ -291,7 +290,6 @@ describe('EVM Family', () => {
|
|
|
291
290
|
await LEDGER_API.getOperations(
|
|
292
291
|
config,
|
|
293
292
|
testLogger,
|
|
294
|
-
'ethereum',
|
|
295
293
|
'0x6cBCD73CD8e8a42844662f0A0e76D7F79Afd933d',
|
|
296
294
|
0,
|
|
297
295
|
undefined,
|
|
@@ -315,7 +313,6 @@ describe('EVM Family', () => {
|
|
|
315
313
|
const response = await LEDGER_API.getOperations(
|
|
316
314
|
config,
|
|
317
315
|
testLogger,
|
|
318
|
-
'ethereum',
|
|
319
316
|
'0x6cBCD73CD8e8a42844662f0A0e76D7F79Afd933d',
|
|
320
317
|
0,
|
|
321
318
|
undefined,
|
|
@@ -388,7 +385,7 @@ describe('EVM Family', () => {
|
|
|
388
385
|
value: 0n,
|
|
389
386
|
asset: { type: 'native' },
|
|
390
387
|
tx: tx1,
|
|
391
|
-
details: { sequence: 75 },
|
|
388
|
+
details: { sequence: 75, gasPrice: '81876963401', gasLimit: '62350' },
|
|
392
389
|
},
|
|
393
390
|
{
|
|
394
391
|
id: `${addr}-${txHash}-OUT`,
|
|
@@ -398,7 +395,7 @@ describe('EVM Family', () => {
|
|
|
398
395
|
value: 10n,
|
|
399
396
|
asset: { type: 'native' },
|
|
400
397
|
tx: tx2,
|
|
401
|
-
details: { sequence: 75 },
|
|
398
|
+
details: { sequence: 75, gasPrice: '81876963401', gasLimit: '62350' },
|
|
402
399
|
},
|
|
403
400
|
{
|
|
404
401
|
id: `${addr}-${txHash}-IN`,
|
|
@@ -408,7 +405,7 @@ describe('EVM Family', () => {
|
|
|
408
405
|
value: 100n,
|
|
409
406
|
asset: { type: 'native' },
|
|
410
407
|
tx: tx3,
|
|
411
|
-
details: { sequence: 75 },
|
|
408
|
+
details: { sequence: 75, gasPrice: '81876963401', gasLimit: '62350' },
|
|
412
409
|
},
|
|
413
410
|
{
|
|
414
411
|
id: `${addr}-${txHash}-IN`,
|
|
@@ -418,7 +415,7 @@ describe('EVM Family', () => {
|
|
|
418
415
|
value: 100n,
|
|
419
416
|
asset: { type: 'native' },
|
|
420
417
|
tx: tx4,
|
|
421
|
-
details: { sequence: 75 },
|
|
418
|
+
details: { sequence: 75, gasPrice: '81876963401', gasLimit: '62350' },
|
|
422
419
|
},
|
|
423
420
|
],
|
|
424
421
|
lastNftOperations: [
|
|
@@ -537,7 +534,6 @@ describe('EVM Family', () => {
|
|
|
537
534
|
const response = await LEDGER_API.getOperations(
|
|
538
535
|
config,
|
|
539
536
|
testLogger,
|
|
540
|
-
'ethereum',
|
|
541
537
|
'0x6cBCD73CD8e8a42844662f0A0e76D7F79Afd933d',
|
|
542
538
|
0,
|
|
543
539
|
undefined,
|
|
@@ -571,7 +567,6 @@ describe('EVM Family', () => {
|
|
|
571
567
|
const response = await LEDGER_API.getOperations(
|
|
572
568
|
config,
|
|
573
569
|
testLogger,
|
|
574
|
-
'ethereum',
|
|
575
570
|
'0x6cBCD73CD8e8a42844662f0A0e76D7F79Afd933d',
|
|
576
571
|
0,
|
|
577
572
|
undefined,
|
|
@@ -629,7 +624,6 @@ describe('EVM Family', () => {
|
|
|
629
624
|
const response = await LEDGER_API.getOperations(
|
|
630
625
|
config,
|
|
631
626
|
testLogger,
|
|
632
|
-
'ethereum',
|
|
633
627
|
'0x6cBCD73CD8e8a42844662f0A0e76D7F79Afd933d',
|
|
634
628
|
0,
|
|
635
629
|
undefined,
|
|
@@ -650,7 +644,6 @@ describe('EVM Family', () => {
|
|
|
650
644
|
const response = await LEDGER_API.getOperations(
|
|
651
645
|
config,
|
|
652
646
|
testLogger,
|
|
653
|
-
'ethereum',
|
|
654
647
|
'0x6cBCD73CD8e8a42844662f0A0e76D7F79Afd933d',
|
|
655
648
|
0,
|
|
656
649
|
undefined,
|
|
@@ -671,7 +664,6 @@ describe('EVM Family', () => {
|
|
|
671
664
|
const response = await LEDGER_API.getOperations(
|
|
672
665
|
config,
|
|
673
666
|
testLogger,
|
|
674
|
-
'ethereum',
|
|
675
667
|
'0x6cBCD73CD8e8a42844662f0A0e76D7F79Afd933d',
|
|
676
668
|
0,
|
|
677
669
|
undefined,
|
|
@@ -692,7 +684,6 @@ describe('EVM Family', () => {
|
|
|
692
684
|
const response = await LEDGER_API.getOperations(
|
|
693
685
|
config,
|
|
694
686
|
testLogger,
|
|
695
|
-
'ethereum',
|
|
696
687
|
'0x6cBCD73CD8e8a42844662f0A0e76D7F79Afd933d',
|
|
697
688
|
0,
|
|
698
689
|
undefined,
|
|
@@ -772,17 +763,7 @@ describe('EVM Family', () => {
|
|
|
772
763
|
const request = mockRateLimitedExplorer()
|
|
773
764
|
|
|
774
765
|
await expect(
|
|
775
|
-
LEDGER_API.getOperations(
|
|
776
|
-
config,
|
|
777
|
-
testLogger,
|
|
778
|
-
'ethereum',
|
|
779
|
-
ADDR,
|
|
780
|
-
0,
|
|
781
|
-
undefined,
|
|
782
|
-
undefined,
|
|
783
|
-
2,
|
|
784
|
-
'desc'
|
|
785
|
-
)
|
|
766
|
+
LEDGER_API.getOperations(config, testLogger, ADDR, 0, undefined, undefined, 2, 'desc')
|
|
786
767
|
).rejects.toBeInstanceOf(RateLimitError)
|
|
787
768
|
// Same rule the exhaustive walk follows: a rate limit is not transient, so it must not
|
|
788
769
|
// consume the retry budget.
|
|
@@ -798,17 +779,7 @@ describe('EVM Family', () => {
|
|
|
798
779
|
})
|
|
799
780
|
|
|
800
781
|
await expect(
|
|
801
|
-
LEDGER_API.getOperations(
|
|
802
|
-
noRetries,
|
|
803
|
-
testLogger,
|
|
804
|
-
'ethereum',
|
|
805
|
-
ADDR,
|
|
806
|
-
0,
|
|
807
|
-
undefined,
|
|
808
|
-
undefined,
|
|
809
|
-
2,
|
|
810
|
-
'desc'
|
|
811
|
-
)
|
|
782
|
+
LEDGER_API.getOperations(noRetries, testLogger, ADDR, 0, undefined, undefined, 2, 'desc')
|
|
812
783
|
).rejects.toThrow('explorer down')
|
|
813
784
|
expect(request).toHaveBeenCalledTimes(1)
|
|
814
785
|
})
|
|
@@ -821,7 +792,6 @@ describe('EVM Family', () => {
|
|
|
821
792
|
const response = await LEDGER_API.getOperations(
|
|
822
793
|
config,
|
|
823
794
|
testLogger,
|
|
824
|
-
'ethereum',
|
|
825
795
|
ADDR,
|
|
826
796
|
0,
|
|
827
797
|
undefined,
|
|
@@ -865,7 +835,6 @@ describe('EVM Family', () => {
|
|
|
865
835
|
const page1 = await LEDGER_API.getOperations(
|
|
866
836
|
config,
|
|
867
837
|
testLogger,
|
|
868
|
-
'ethereum',
|
|
869
838
|
ADDR,
|
|
870
839
|
0,
|
|
871
840
|
undefined,
|
|
@@ -879,7 +848,6 @@ describe('EVM Family', () => {
|
|
|
879
848
|
const page2 = await LEDGER_API.getOperations(
|
|
880
849
|
config,
|
|
881
850
|
testLogger,
|
|
882
|
-
'ethereum',
|
|
883
851
|
ADDR,
|
|
884
852
|
0,
|
|
885
853
|
undefined,
|
|
@@ -902,7 +870,6 @@ describe('EVM Family', () => {
|
|
|
902
870
|
const page3 = await LEDGER_API.getOperations(
|
|
903
871
|
config,
|
|
904
872
|
testLogger,
|
|
905
|
-
'ethereum',
|
|
906
873
|
ADDR,
|
|
907
874
|
0,
|
|
908
875
|
undefined,
|
|
@@ -919,33 +886,13 @@ describe('EVM Family', () => {
|
|
|
919
886
|
.spyOn(axios, 'request')
|
|
920
887
|
.mockResolvedValue({ data: { data: [pagedRecord(50, 'h50')], token: '' } })
|
|
921
888
|
|
|
922
|
-
await LEDGER_API.getOperations(
|
|
923
|
-
config,
|
|
924
|
-
testLogger,
|
|
925
|
-
'ethereum',
|
|
926
|
-
ADDR,
|
|
927
|
-
0,
|
|
928
|
-
undefined,
|
|
929
|
-
'60:h60',
|
|
930
|
-
5,
|
|
931
|
-
'desc'
|
|
932
|
-
)
|
|
889
|
+
await LEDGER_API.getOperations(config, testLogger, ADDR, 0, undefined, '60:h60', 5, 'desc')
|
|
933
890
|
expect(request).toHaveBeenLastCalledWith(
|
|
934
891
|
expect.objectContaining({ params: expect.objectContaining({ to_height: 60 }) })
|
|
935
892
|
)
|
|
936
893
|
|
|
937
894
|
request.mockClear()
|
|
938
|
-
await LEDGER_API.getOperations(
|
|
939
|
-
config,
|
|
940
|
-
testLogger,
|
|
941
|
-
'ethereum',
|
|
942
|
-
ADDR,
|
|
943
|
-
0,
|
|
944
|
-
undefined,
|
|
945
|
-
'60:h60',
|
|
946
|
-
5,
|
|
947
|
-
'asc'
|
|
948
|
-
)
|
|
895
|
+
await LEDGER_API.getOperations(config, testLogger, ADDR, 0, undefined, '60:h60', 5, 'asc')
|
|
949
896
|
expect(request).toHaveBeenLastCalledWith(
|
|
950
897
|
expect.objectContaining({ params: expect.objectContaining({ from_height: 60 }) })
|
|
951
898
|
)
|
|
@@ -957,51 +904,21 @@ describe('EVM Family', () => {
|
|
|
957
904
|
.mockResolvedValue({ data: { data: [], token: '' } })
|
|
958
905
|
|
|
959
906
|
// No cursor: toBlock alone is the ceiling.
|
|
960
|
-
await LEDGER_API.getOperations(
|
|
961
|
-
config,
|
|
962
|
-
testLogger,
|
|
963
|
-
'ethereum',
|
|
964
|
-
ADDR,
|
|
965
|
-
0,
|
|
966
|
-
77,
|
|
967
|
-
undefined,
|
|
968
|
-
5,
|
|
969
|
-
'desc'
|
|
970
|
-
)
|
|
907
|
+
await LEDGER_API.getOperations(config, testLogger, ADDR, 0, 77, undefined, 5, 'desc')
|
|
971
908
|
expect(request).toHaveBeenLastCalledWith(
|
|
972
909
|
expect.objectContaining({ params: expect.objectContaining({ to_height: 77 }) })
|
|
973
910
|
)
|
|
974
911
|
|
|
975
912
|
// Cursor height (40) is more restrictive than toBlock (100).
|
|
976
913
|
request.mockClear()
|
|
977
|
-
await LEDGER_API.getOperations(
|
|
978
|
-
config,
|
|
979
|
-
testLogger,
|
|
980
|
-
'ethereum',
|
|
981
|
-
ADDR,
|
|
982
|
-
0,
|
|
983
|
-
100,
|
|
984
|
-
'40:hx',
|
|
985
|
-
5,
|
|
986
|
-
'desc'
|
|
987
|
-
)
|
|
914
|
+
await LEDGER_API.getOperations(config, testLogger, ADDR, 0, 100, '40:hx', 5, 'desc')
|
|
988
915
|
expect(request).toHaveBeenLastCalledWith(
|
|
989
916
|
expect.objectContaining({ params: expect.objectContaining({ to_height: 40 }) })
|
|
990
917
|
)
|
|
991
918
|
|
|
992
919
|
// toBlock (30) is more restrictive than the cursor height (40).
|
|
993
920
|
request.mockClear()
|
|
994
|
-
await LEDGER_API.getOperations(
|
|
995
|
-
config,
|
|
996
|
-
testLogger,
|
|
997
|
-
'ethereum',
|
|
998
|
-
ADDR,
|
|
999
|
-
0,
|
|
1000
|
-
30,
|
|
1001
|
-
'40:hx',
|
|
1002
|
-
5,
|
|
1003
|
-
'desc'
|
|
1004
|
-
)
|
|
921
|
+
await LEDGER_API.getOperations(config, testLogger, ADDR, 0, 30, '40:hx', 5, 'desc')
|
|
1005
922
|
expect(request).toHaveBeenLastCalledWith(
|
|
1006
923
|
expect.objectContaining({ params: expect.objectContaining({ to_height: 30 }) })
|
|
1007
924
|
)
|
|
@@ -1020,7 +937,6 @@ describe('EVM Family', () => {
|
|
|
1020
937
|
const response = await LEDGER_API.getOperations(
|
|
1021
938
|
config,
|
|
1022
939
|
testLogger,
|
|
1023
|
-
'ethereum',
|
|
1024
940
|
ADDR,
|
|
1025
941
|
0,
|
|
1026
942
|
undefined,
|
|
@@ -1053,7 +969,6 @@ describe('EVM Family', () => {
|
|
|
1053
969
|
const response = await LEDGER_API.getOperations(
|
|
1054
970
|
config,
|
|
1055
971
|
testLogger,
|
|
1056
|
-
'ethereum',
|
|
1057
972
|
ADDR,
|
|
1058
973
|
0,
|
|
1059
974
|
undefined,
|
|
@@ -1101,7 +1016,6 @@ describe('EVM Family', () => {
|
|
|
1101
1016
|
const page1 = await LEDGER_API.getOperations(
|
|
1102
1017
|
config,
|
|
1103
1018
|
testLogger,
|
|
1104
|
-
'ethereum',
|
|
1105
1019
|
ADDR,
|
|
1106
1020
|
0,
|
|
1107
1021
|
undefined,
|
|
@@ -1130,7 +1044,6 @@ describe('EVM Family', () => {
|
|
|
1130
1044
|
const page2 = await LEDGER_API.getOperations(
|
|
1131
1045
|
config,
|
|
1132
1046
|
testLogger,
|
|
1133
|
-
'ethereum',
|
|
1134
1047
|
ADDR,
|
|
1135
1048
|
0,
|
|
1136
1049
|
undefined,
|
|
@@ -1166,7 +1079,6 @@ describe('EVM Family', () => {
|
|
|
1166
1079
|
LEDGER_API.getOperations(
|
|
1167
1080
|
config,
|
|
1168
1081
|
testLogger,
|
|
1169
|
-
'ethereum',
|
|
1170
1082
|
ADDR,
|
|
1171
1083
|
0,
|
|
1172
1084
|
undefined,
|
|
@@ -1186,7 +1098,6 @@ describe('EVM Family', () => {
|
|
|
1186
1098
|
LEDGER_API.getOperations(
|
|
1187
1099
|
config,
|
|
1188
1100
|
testLogger,
|
|
1189
|
-
'ethereum',
|
|
1190
1101
|
ADDR,
|
|
1191
1102
|
0,
|
|
1192
1103
|
undefined,
|
|
@@ -1201,17 +1112,7 @@ describe('EVM Family', () => {
|
|
|
1201
1112
|
const request = jest.spyOn(axios, 'request').mockRejectedValue(new Error('network error'))
|
|
1202
1113
|
|
|
1203
1114
|
await expect(
|
|
1204
|
-
LEDGER_API.getOperations(
|
|
1205
|
-
config,
|
|
1206
|
-
testLogger,
|
|
1207
|
-
'ethereum',
|
|
1208
|
-
ADDR,
|
|
1209
|
-
0,
|
|
1210
|
-
undefined,
|
|
1211
|
-
undefined,
|
|
1212
|
-
5,
|
|
1213
|
-
'desc'
|
|
1214
|
-
)
|
|
1115
|
+
LEDGER_API.getOperations(config, testLogger, ADDR, 0, undefined, undefined, 5, 'desc')
|
|
1215
1116
|
).rejects.toThrow('network error')
|
|
1216
1117
|
|
|
1217
1118
|
expect(request).toHaveBeenCalledTimes(LEDGER_API.DEFAULT_RETRIES_API + 1)
|
|
@@ -1232,7 +1133,6 @@ describe('EVM Family', () => {
|
|
|
1232
1133
|
const response = await LEDGER_API.getOperations(
|
|
1233
1134
|
config,
|
|
1234
1135
|
testLogger,
|
|
1235
|
-
'ethereum',
|
|
1236
1136
|
ADDR,
|
|
1237
1137
|
0,
|
|
1238
1138
|
undefined,
|
|
@@ -1256,7 +1156,6 @@ describe('EVM Family', () => {
|
|
|
1256
1156
|
await LEDGER_API.getOperations(
|
|
1257
1157
|
config,
|
|
1258
1158
|
testLogger,
|
|
1259
|
-
'ethereum',
|
|
1260
1159
|
ADDR,
|
|
1261
1160
|
0,
|
|
1262
1161
|
undefined,
|
|
@@ -1276,7 +1175,6 @@ describe('EVM Family', () => {
|
|
|
1276
1175
|
const response = await LEDGER_API.getOperations(
|
|
1277
1176
|
config,
|
|
1278
1177
|
testLogger,
|
|
1279
|
-
'ethereum',
|
|
1280
1178
|
ADDR,
|
|
1281
1179
|
0,
|
|
1282
1180
|
undefined,
|
|
@@ -1312,7 +1210,7 @@ describe('EVM Family', () => {
|
|
|
1312
1210
|
config = createMockEvmConfigInfo({ chainId: 1, node: mkExternalNode({ uri: 'anything' }) })
|
|
1313
1211
|
|
|
1314
1212
|
await expect(
|
|
1315
|
-
LEDGER_API.discoverTokenAssets(config, testLogger,
|
|
1213
|
+
LEDGER_API.discoverTokenAssets(config, testLogger, ADDR)
|
|
1316
1214
|
).rejects.toBeInstanceOf(LedgerExplorerUsedIncorrectly)
|
|
1317
1215
|
})
|
|
1318
1216
|
|
|
@@ -1320,7 +1218,7 @@ describe('EVM Family', () => {
|
|
|
1320
1218
|
const request = mockRateLimitedExplorer()
|
|
1321
1219
|
|
|
1322
1220
|
await expect(
|
|
1323
|
-
LEDGER_API.discoverTokenAssets(config, testLogger,
|
|
1221
|
+
LEDGER_API.discoverTokenAssets(config, testLogger, ADDR)
|
|
1324
1222
|
).rejects.toBeInstanceOf(RateLimitError)
|
|
1325
1223
|
expect(request).toHaveBeenCalledTimes(1)
|
|
1326
1224
|
})
|
|
@@ -1346,7 +1244,7 @@ describe('EVM Family', () => {
|
|
|
1346
1244
|
throw new Error('should not be called again')
|
|
1347
1245
|
})
|
|
1348
1246
|
|
|
1349
|
-
const assets = await LEDGER_API.discoverTokenAssets(config, testLogger,
|
|
1247
|
+
const assets = await LEDGER_API.discoverTokenAssets(config, testLogger, ADDR)
|
|
1350
1248
|
|
|
1351
1249
|
expect(assets).toEqual([
|
|
1352
1250
|
{ type: 'erc20', assetReference: eip55.encode(CONTRACT_1), assetOwner: ADDR },
|
|
@@ -1364,16 +1262,10 @@ describe('EVM Family', () => {
|
|
|
1364
1262
|
data: { data: pages, token: null },
|
|
1365
1263
|
}))
|
|
1366
1264
|
|
|
1367
|
-
const discovered = await LEDGER_API.discoverTokenAssets(
|
|
1368
|
-
config,
|
|
1369
|
-
testLogger,
|
|
1370
|
-
'ethereum',
|
|
1371
|
-
ADDR
|
|
1372
|
-
)
|
|
1265
|
+
const discovered = await LEDGER_API.discoverTokenAssets(config, testLogger, ADDR)
|
|
1373
1266
|
const opsResult = await LEDGER_API.getOperations(
|
|
1374
1267
|
config,
|
|
1375
1268
|
testLogger,
|
|
1376
|
-
'ethereum',
|
|
1377
1269
|
ADDR,
|
|
1378
1270
|
0,
|
|
1379
1271
|
undefined,
|
|
@@ -1405,7 +1297,7 @@ describe('EVM Family', () => {
|
|
|
1405
1297
|
},
|
|
1406
1298
|
}))
|
|
1407
1299
|
|
|
1408
|
-
const assets = await LEDGER_API.discoverTokenAssets(config, testLogger,
|
|
1300
|
+
const assets = await LEDGER_API.discoverTokenAssets(config, testLogger, ADDR)
|
|
1409
1301
|
|
|
1410
1302
|
expect(assets).toEqual([])
|
|
1411
1303
|
})
|
|
@@ -1427,7 +1319,7 @@ describe('EVM Family', () => {
|
|
|
1427
1319
|
.spyOn(axios, 'request')
|
|
1428
1320
|
.mockResolvedValue({ data: { data: [], token: '' } })
|
|
1429
1321
|
|
|
1430
|
-
await LEDGER_API.discoverTokenAssets(config, testLogger,
|
|
1322
|
+
await LEDGER_API.discoverTokenAssets(config, testLogger, ADDR)
|
|
1431
1323
|
|
|
1432
1324
|
expect(request).toHaveBeenCalledWith(
|
|
1433
1325
|
expect.objectContaining({
|
|
@@ -1441,12 +1333,12 @@ describe('EVM Family', () => {
|
|
|
1441
1333
|
.spyOn(axios, 'request')
|
|
1442
1334
|
.mockResolvedValue({ data: { data: [], token: '' } })
|
|
1443
1335
|
|
|
1444
|
-
await LEDGER_API.discoverTokenAssets(config, testLogger,
|
|
1336
|
+
await LEDGER_API.discoverTokenAssets(config, testLogger, ADDR)
|
|
1445
1337
|
expect(request).toHaveBeenCalledWith(
|
|
1446
1338
|
expect.objectContaining({ params: expect.objectContaining({ from_height: 0 }) })
|
|
1447
1339
|
)
|
|
1448
1340
|
|
|
1449
|
-
await LEDGER_API.discoverTokenAssets(config, testLogger,
|
|
1341
|
+
await LEDGER_API.discoverTokenAssets(config, testLogger, ADDR, 42)
|
|
1450
1342
|
expect(request).toHaveBeenCalledWith(
|
|
1451
1343
|
expect.objectContaining({ params: expect.objectContaining({ from_height: 42 }) })
|
|
1452
1344
|
)
|
|
@@ -1461,7 +1353,7 @@ describe('EVM Family', () => {
|
|
|
1461
1353
|
throw new Error('should not be called again')
|
|
1462
1354
|
})
|
|
1463
1355
|
|
|
1464
|
-
await LEDGER_API.discoverTokenAssets(config, testLogger,
|
|
1356
|
+
await LEDGER_API.discoverTokenAssets(config, testLogger, ADDR)
|
|
1465
1357
|
|
|
1466
1358
|
expect(request).toHaveBeenCalledTimes(2)
|
|
1467
1359
|
})
|
|
@@ -1474,7 +1366,7 @@ describe('EVM Family', () => {
|
|
|
1474
1366
|
throw new Error('should not be called again')
|
|
1475
1367
|
})
|
|
1476
1368
|
|
|
1477
|
-
await LEDGER_API.discoverTokenAssets(config, testLogger,
|
|
1369
|
+
await LEDGER_API.discoverTokenAssets(config, testLogger, ADDR)
|
|
1478
1370
|
|
|
1479
1371
|
expect(request).toHaveBeenCalledTimes(1)
|
|
1480
1372
|
})
|
|
@@ -1488,7 +1380,7 @@ describe('EVM Family', () => {
|
|
|
1488
1380
|
throw new Error('should not be called again')
|
|
1489
1381
|
})
|
|
1490
1382
|
|
|
1491
|
-
await LEDGER_API.discoverTokenAssets(config, testLogger,
|
|
1383
|
+
await LEDGER_API.discoverTokenAssets(config, testLogger, ADDR)
|
|
1492
1384
|
|
|
1493
1385
|
expect(request).toHaveBeenCalledTimes(2)
|
|
1494
1386
|
})
|
|
@@ -1496,9 +1388,9 @@ describe('EVM Family', () => {
|
|
|
1496
1388
|
it('propagates after DEFAULT_RETRIES_API attempts on a page that keeps failing, without returning a partial list', async () => {
|
|
1497
1389
|
const request = jest.spyOn(axios, 'request').mockRejectedValue(new Error('network error'))
|
|
1498
1390
|
|
|
1499
|
-
await expect(
|
|
1500
|
-
|
|
1501
|
-
)
|
|
1391
|
+
await expect(LEDGER_API.discoverTokenAssets(config, testLogger, ADDR)).rejects.toThrow(
|
|
1392
|
+
'network error'
|
|
1393
|
+
)
|
|
1502
1394
|
|
|
1503
1395
|
expect(request).toHaveBeenCalledTimes(LEDGER_API.DEFAULT_RETRIES_API + 1)
|
|
1504
1396
|
})
|
|
@@ -1514,7 +1406,7 @@ describe('EVM Family', () => {
|
|
|
1514
1406
|
call += 1
|
|
1515
1407
|
return { data: { data: [page], token: call < pages.length ? `p${call}` : '' } }
|
|
1516
1408
|
})
|
|
1517
|
-
return LEDGER_API.discoverTokenAssets(config, testLogger,
|
|
1409
|
+
return LEDGER_API.discoverTokenAssets(config, testLogger, ADDR)
|
|
1518
1410
|
}
|
|
1519
1411
|
|
|
1520
1412
|
const smallWalk = await runWith(2)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: © 2026 LEDGER SAS
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
-
import { isEtherscanLikeExplorerConfig, isLedgerExplorerConfig } from '
|
|
4
|
+
import { isEtherscanLikeExplorerConfig, isLedgerExplorerConfig } from '../../explorer/types'
|
|
5
5
|
|
|
6
6
|
describe('EVM Family', () => {
|
|
7
7
|
describe('network/explorer/types.ts', () => {
|
|
@@ -5,9 +5,9 @@ import {
|
|
|
5
5
|
createMockEvmConfigInfo,
|
|
6
6
|
mkLedgerGasTracker,
|
|
7
7
|
mkLedgerNode,
|
|
8
|
-
} from '
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
8
|
+
} from '../../../fixtures/context.fixtures'
|
|
9
|
+
import { getGasTracker } from '../../gasTracker/index'
|
|
10
|
+
import { getGasOptions as ledgerGetGasOptions } from '../../gasTracker/ledger'
|
|
11
11
|
|
|
12
12
|
const configWithGasTracker = createMockEvmConfigInfo({
|
|
13
13
|
chainId: 1,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: © 2026 LEDGER SAS
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
-
import type { GasOptions } from '
|
|
4
|
+
import type { GasOptions } from '../../../types'
|
|
5
5
|
import { AssertionError } from 'assert'
|
|
6
6
|
import network from '@ledgerhq/live-network/network'
|
|
7
7
|
import { AxiosHeaders } from 'axios'
|
|
@@ -11,14 +11,14 @@ function makeNetworkResponse<T>(data: T) {
|
|
|
11
11
|
const headers = new AxiosHeaders()
|
|
12
12
|
return Promise.resolve({ data, status: 200, statusText: 'OK', headers, config: { headers } })
|
|
13
13
|
}
|
|
14
|
-
import { LedgerGasTrackerUsedIncorrectly, NoGasTrackerFound } from '
|
|
14
|
+
import { LedgerGasTrackerUsedIncorrectly, NoGasTrackerFound } from '../../../errors'
|
|
15
15
|
import {
|
|
16
16
|
createMockEvmConfigInfo,
|
|
17
17
|
mkExternalNode,
|
|
18
18
|
mkLedgerGasTracker,
|
|
19
19
|
mkLedgerNode,
|
|
20
|
-
} from '
|
|
21
|
-
import { getGasOptions } from '
|
|
20
|
+
} from '../../../fixtures/context.fixtures'
|
|
21
|
+
import { getGasOptions } from '../../gasTracker/ledger'
|
|
22
22
|
|
|
23
23
|
jest.mock('@ledgerhq/live-network/network')
|
|
24
24
|
const mockedNetwork = jest.mocked(network)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: © 2026 LEDGER SAS
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
-
import { isLedgerGasTracker } from '
|
|
4
|
+
import { isLedgerGasTracker } from '../../gasTracker/types'
|
|
5
5
|
|
|
6
6
|
describe('EVM Family', () => {
|
|
7
7
|
describe('network/gasTracker/types.ts', () => {
|