@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
|
@@ -9,6 +9,7 @@ import type {
|
|
|
9
9
|
LedgerExplorerOperation,
|
|
10
10
|
} from './../types'
|
|
11
11
|
import type { MemoNotSupported, Operation } from '@ledgerhq/coin-module-framework/api/types'
|
|
12
|
+
import { CHAIN_ID } from '../config'
|
|
12
13
|
import { testLogger } from '../fixtures/context.fixtures'
|
|
13
14
|
import {
|
|
14
15
|
ledgerERC1155EventToOperations,
|
|
@@ -19,7 +20,6 @@ import {
|
|
|
19
20
|
} from './ledger'
|
|
20
21
|
|
|
21
22
|
const address = '0x6cbcd73cd8e8a42844662f0a0e76d7f79afd933d'
|
|
22
|
-
const currencyId = 'ethereum'
|
|
23
23
|
|
|
24
24
|
const coinOperation: Operation<MemoNotSupported> = {
|
|
25
25
|
id: '0x6cbcd73cd8e8a42844662f0a0e76d7f79afd933d-0xf350d4f8e910419e2d5cec294d44e69af8c6185b7089061d33bb4fc246cefb79-FEES',
|
|
@@ -39,7 +39,7 @@ const coinOperation: Operation<MemoNotSupported> = {
|
|
|
39
39
|
date: new Date('2023-01-24T17:11:45Z'),
|
|
40
40
|
failed: false,
|
|
41
41
|
},
|
|
42
|
-
details: { sequence: 75 },
|
|
42
|
+
details: { sequence: 75, gasPrice: '81876963401', gasLimit: '62350' },
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
describe('EVM Family', () => {
|
|
@@ -106,11 +106,16 @@ describe('EVM Family', () => {
|
|
|
106
106
|
failed: false,
|
|
107
107
|
feesPayer: '0x6cBCD73CD8e8a42844662f0A0e76D7F79Afd933d',
|
|
108
108
|
},
|
|
109
|
-
details: { sequence: 75 },
|
|
109
|
+
details: { sequence: 75, gasPrice: '81876963401', gasLimit: '62350' },
|
|
110
110
|
}
|
|
111
111
|
|
|
112
112
|
expect(
|
|
113
|
-
ledgerOperationToOperations(
|
|
113
|
+
ledgerOperationToOperations(
|
|
114
|
+
unrelatedAddress,
|
|
115
|
+
CHAIN_ID.ETHEREUM,
|
|
116
|
+
ledgerExplorerOp,
|
|
117
|
+
testLogger
|
|
118
|
+
)
|
|
114
119
|
).toEqual([expectedOperation])
|
|
115
120
|
})
|
|
116
121
|
|
|
@@ -171,11 +176,11 @@ describe('EVM Family', () => {
|
|
|
171
176
|
failed: false,
|
|
172
177
|
feesPayer: '0x6cBCD73CD8e8a42844662f0A0e76D7F79Afd933d',
|
|
173
178
|
},
|
|
174
|
-
details: { sequence: 75 },
|
|
179
|
+
details: { sequence: 75, gasPrice: '81876963401', gasLimit: '62350' },
|
|
175
180
|
}
|
|
176
181
|
|
|
177
182
|
expect(
|
|
178
|
-
ledgerOperationToOperations(address,
|
|
183
|
+
ledgerOperationToOperations(address, CHAIN_ID.ETHEREUM, ledgerOperation, testLogger)
|
|
179
184
|
).toEqual([expectedOperation])
|
|
180
185
|
})
|
|
181
186
|
|
|
@@ -236,14 +241,62 @@ describe('EVM Family', () => {
|
|
|
236
241
|
failed: false,
|
|
237
242
|
feesPayer: '0x6cBCD73CD8e8a42844662f0A0e76D7F79Afd933d',
|
|
238
243
|
},
|
|
239
|
-
details: { sequence: 75 },
|
|
244
|
+
details: { sequence: 75, gasPrice: '81876963401', gasLimit: '62350' },
|
|
240
245
|
}
|
|
241
246
|
|
|
242
247
|
expect(
|
|
243
|
-
ledgerOperationToOperations(address,
|
|
248
|
+
ledgerOperationToOperations(address, CHAIN_ID.ETHEREUM, ledgerOperation, testLogger)
|
|
244
249
|
).toEqual([expectedOperation])
|
|
245
250
|
})
|
|
246
251
|
|
|
252
|
+
it('should omit empty gas price and gas limit from details', () => {
|
|
253
|
+
const ledgerOperation: LedgerExplorerOperation = {
|
|
254
|
+
hash: '0xf350d4f8e910419e2d5cec294d44e69af8c6185b7089061d33bb4fc246cefb79',
|
|
255
|
+
transaction_type: 2,
|
|
256
|
+
nonce: '0x4b',
|
|
257
|
+
nonce_value: 75,
|
|
258
|
+
value: '1',
|
|
259
|
+
gas: '',
|
|
260
|
+
gas_price: '',
|
|
261
|
+
max_fee_per_gas: '125263305914',
|
|
262
|
+
max_priority_fee_per_gas: '33000000000',
|
|
263
|
+
from: '0x6cbcd73cd8e8a42844662f0a0e76d7f79afd933d',
|
|
264
|
+
to: '0x7ceb23fd6bc0add59e62ac25578270cff1b9f619',
|
|
265
|
+
transfer_events: [
|
|
266
|
+
{
|
|
267
|
+
contract: '0x7ceb23fd6bc0add59e62ac25578270cff1b9f619',
|
|
268
|
+
from: '0x6cbcd73cd8e8a42844662f0a0e76d7f79afd933d',
|
|
269
|
+
to: '0xc2907efcce4011c491bbeda8a0fa63ba7aab596c',
|
|
270
|
+
count: '100000000000000',
|
|
271
|
+
},
|
|
272
|
+
],
|
|
273
|
+
erc721_transfer_events: [],
|
|
274
|
+
erc1155_transfer_events: [],
|
|
275
|
+
approval_events: [],
|
|
276
|
+
actions: [],
|
|
277
|
+
confirmations: 5968364,
|
|
278
|
+
input: null,
|
|
279
|
+
gas_used: '51958',
|
|
280
|
+
cumulative_gas_used: '16087064',
|
|
281
|
+
status: 1,
|
|
282
|
+
received_at: '2023-01-24T17:11:45Z',
|
|
283
|
+
block: {
|
|
284
|
+
hash: '0xcbd52de09904fd89a94b0638a8e39107e247d761e92411fd5b7b7d8b88641ddd',
|
|
285
|
+
height: 38476740,
|
|
286
|
+
time: '2023-01-24T17:11:45Z',
|
|
287
|
+
},
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
const [operation] = ledgerOperationToOperations(
|
|
291
|
+
address,
|
|
292
|
+
CHAIN_ID.ETHEREUM,
|
|
293
|
+
ledgerOperation,
|
|
294
|
+
testLogger
|
|
295
|
+
)
|
|
296
|
+
|
|
297
|
+
expect(operation.details).toEqual({ sequence: 75 })
|
|
298
|
+
})
|
|
299
|
+
|
|
247
300
|
it('should convert ledger explorer coin in operation to an Operation', () => {
|
|
248
301
|
const ledgerOperation: LedgerExplorerOperation = {
|
|
249
302
|
hash: '0xf350d4f8e910419e2d5cec294d44e69af8c6185b7089061d33bb4fc246cefb79',
|
|
@@ -301,11 +354,11 @@ describe('EVM Family', () => {
|
|
|
301
354
|
failed: false,
|
|
302
355
|
feesPayer: '0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619',
|
|
303
356
|
},
|
|
304
|
-
details: { sequence: 75 },
|
|
357
|
+
details: { sequence: 75, gasPrice: '81876963401', gasLimit: '62350' },
|
|
305
358
|
}
|
|
306
359
|
|
|
307
360
|
expect(
|
|
308
|
-
ledgerOperationToOperations(address,
|
|
361
|
+
ledgerOperationToOperations(address, CHAIN_ID.ETHEREUM, ledgerOperation, testLogger)
|
|
309
362
|
).toEqual([expectedOperation])
|
|
310
363
|
})
|
|
311
364
|
|
|
@@ -366,11 +419,11 @@ describe('EVM Family', () => {
|
|
|
366
419
|
failed: false,
|
|
367
420
|
feesPayer: '0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619',
|
|
368
421
|
},
|
|
369
|
-
details: { sequence: 75 },
|
|
422
|
+
details: { sequence: 75, gasPrice: '81876963401', gasLimit: '62350' },
|
|
370
423
|
}
|
|
371
424
|
|
|
372
425
|
expect(
|
|
373
|
-
ledgerOperationToOperations(address,
|
|
426
|
+
ledgerOperationToOperations(address, CHAIN_ID.ETHEREUM, ledgerOperation, testLogger)
|
|
374
427
|
).toEqual([expectedOperation])
|
|
375
428
|
})
|
|
376
429
|
|
|
@@ -436,11 +489,11 @@ describe('EVM Family', () => {
|
|
|
436
489
|
failed: false,
|
|
437
490
|
feesPayer: '0x787aCF62fFC81Bb171d1f46fB8b3Fc6503D503e8',
|
|
438
491
|
},
|
|
439
|
-
details: { sequence: 3 },
|
|
492
|
+
details: { sequence: 3, gasPrice: '42392511388', gasLimit: '21356033' },
|
|
440
493
|
}
|
|
441
494
|
|
|
442
495
|
expect(
|
|
443
|
-
ledgerOperationToOperations(address,
|
|
496
|
+
ledgerOperationToOperations(address, CHAIN_ID.ETHEREUM, ledgerOperation, testLogger)
|
|
444
497
|
).toEqual([expectedOperation])
|
|
445
498
|
})
|
|
446
499
|
|
|
@@ -503,7 +556,7 @@ describe('EVM Family', () => {
|
|
|
503
556
|
value: 1n,
|
|
504
557
|
asset: { type: 'native' },
|
|
505
558
|
tx: selfSendTx,
|
|
506
|
-
details: { sequence: 75 },
|
|
559
|
+
details: { sequence: 75, gasPrice: '81876963401', gasLimit: '62350' },
|
|
507
560
|
}
|
|
508
561
|
const expectedOperation2 = {
|
|
509
562
|
id: '0x6cbcd73cd8e8a42844662f0a0e76d7f79afd933d-0xf350d4f8e910419e2d5cec294d44e69af8c6185b7089061d33bb4fc246cefb79-OUT',
|
|
@@ -513,11 +566,11 @@ describe('EVM Family', () => {
|
|
|
513
566
|
value: 1n,
|
|
514
567
|
asset: { type: 'native' },
|
|
515
568
|
tx: selfSendTx,
|
|
516
|
-
details: { sequence: 75 },
|
|
569
|
+
details: { sequence: 75, gasPrice: '81876963401', gasLimit: '62350' },
|
|
517
570
|
}
|
|
518
571
|
|
|
519
572
|
expect(
|
|
520
|
-
ledgerOperationToOperations(address,
|
|
573
|
+
ledgerOperationToOperations(address, CHAIN_ID.ETHEREUM, ledgerOperation, testLogger)
|
|
521
574
|
).toEqual([expectedOperation1, expectedOperation2])
|
|
522
575
|
})
|
|
523
576
|
|
|
@@ -566,7 +619,7 @@ describe('EVM Family', () => {
|
|
|
566
619
|
expect(
|
|
567
620
|
ledgerOperationToOperations(
|
|
568
621
|
unrelatedAddress,
|
|
569
|
-
|
|
622
|
+
CHAIN_ID.ETHEREUM,
|
|
570
623
|
ledgerExplorerNoneOp,
|
|
571
624
|
testLogger
|
|
572
625
|
)[0].value
|
|
@@ -575,7 +628,7 @@ describe('EVM Family', () => {
|
|
|
575
628
|
expect(
|
|
576
629
|
ledgerOperationToOperations(
|
|
577
630
|
unrelatedAddress,
|
|
578
|
-
|
|
631
|
+
CHAIN_ID.ETHEREUM,
|
|
579
632
|
{
|
|
580
633
|
...ledgerExplorerNoneOp,
|
|
581
634
|
status: 0,
|
|
@@ -624,14 +677,18 @@ describe('EVM Family', () => {
|
|
|
624
677
|
|
|
625
678
|
// Successful Op (value = transferred only; fee is separate; Ledger Wallet adds fee in bridge)
|
|
626
679
|
expect(
|
|
627
|
-
ledgerOperationToOperations(
|
|
628
|
-
|
|
680
|
+
ledgerOperationToOperations(
|
|
681
|
+
address,
|
|
682
|
+
CHAIN_ID.ETHEREUM,
|
|
683
|
+
ledgerExplorerFeesOp,
|
|
684
|
+
testLogger
|
|
685
|
+
)[0].value
|
|
629
686
|
).toEqual(BigInt(ledgerExplorerFeesOp.value))
|
|
630
687
|
// Failing Op (value = tx value, same as success)
|
|
631
688
|
expect(
|
|
632
689
|
ledgerOperationToOperations(
|
|
633
690
|
address,
|
|
634
|
-
|
|
691
|
+
CHAIN_ID.ETHEREUM,
|
|
635
692
|
{
|
|
636
693
|
...ledgerExplorerFeesOp,
|
|
637
694
|
status: 0,
|
|
@@ -679,14 +736,18 @@ describe('EVM Family', () => {
|
|
|
679
736
|
|
|
680
737
|
// Successful Op (value = transferred only; fee is separate; Ledger Wallet adds fee in bridge)
|
|
681
738
|
expect(
|
|
682
|
-
ledgerOperationToOperations(
|
|
683
|
-
|
|
739
|
+
ledgerOperationToOperations(
|
|
740
|
+
address,
|
|
741
|
+
CHAIN_ID.ETHEREUM,
|
|
742
|
+
ledgerOperationOut,
|
|
743
|
+
testLogger
|
|
744
|
+
)[0].value
|
|
684
745
|
).toEqual(BigInt(ledgerOperationOut.value))
|
|
685
746
|
// Failing Op (value = tx value, same as success)
|
|
686
747
|
expect(
|
|
687
748
|
ledgerOperationToOperations(
|
|
688
749
|
address,
|
|
689
|
-
|
|
750
|
+
CHAIN_ID.ETHEREUM,
|
|
690
751
|
{
|
|
691
752
|
...ledgerOperationOut,
|
|
692
753
|
status: 0,
|
|
@@ -734,13 +795,18 @@ describe('EVM Family', () => {
|
|
|
734
795
|
|
|
735
796
|
// Successful Op
|
|
736
797
|
expect(
|
|
737
|
-
ledgerOperationToOperations(
|
|
798
|
+
ledgerOperationToOperations(
|
|
799
|
+
address,
|
|
800
|
+
CHAIN_ID.ETHEREUM,
|
|
801
|
+
ledgerOperationIn,
|
|
802
|
+
testLogger
|
|
803
|
+
)[0].value
|
|
738
804
|
).toEqual(BigInt(ledgerOperationOut.value))
|
|
739
805
|
// Failing Op
|
|
740
806
|
expect(
|
|
741
807
|
ledgerOperationToOperations(
|
|
742
808
|
address,
|
|
743
|
-
|
|
809
|
+
CHAIN_ID.ETHEREUM,
|
|
744
810
|
{ ...ledgerOperationIn, status: 0 },
|
|
745
811
|
testLogger
|
|
746
812
|
)[0].value
|
|
@@ -778,7 +844,12 @@ describe('EVM Family', () => {
|
|
|
778
844
|
},
|
|
779
845
|
}
|
|
780
846
|
|
|
781
|
-
const result = ledgerOperationToOperations(
|
|
847
|
+
const result = ledgerOperationToOperations(
|
|
848
|
+
address,
|
|
849
|
+
CHAIN_ID.ETHEREUM,
|
|
850
|
+
ledgerOp,
|
|
851
|
+
testLogger
|
|
852
|
+
)
|
|
782
853
|
|
|
783
854
|
expect(result).toHaveLength(1)
|
|
784
855
|
expect(result[0].recipients).toEqual([])
|
|
@@ -815,7 +886,12 @@ describe('EVM Family', () => {
|
|
|
815
886
|
},
|
|
816
887
|
}
|
|
817
888
|
|
|
818
|
-
const result = ledgerOperationToOperations(
|
|
889
|
+
const result = ledgerOperationToOperations(
|
|
890
|
+
address,
|
|
891
|
+
CHAIN_ID.ETHEREUM,
|
|
892
|
+
ledgerOp,
|
|
893
|
+
testLogger
|
|
894
|
+
)
|
|
819
895
|
|
|
820
896
|
expect(result).toHaveLength(1)
|
|
821
897
|
expect(result[0].senders).toEqual([])
|
|
@@ -823,7 +899,6 @@ describe('EVM Family', () => {
|
|
|
823
899
|
|
|
824
900
|
it('should detect a Monad staking withdraw (value 0 contract call) as a WITHDRAW_UNBONDED operation instead of FEES', () => {
|
|
825
901
|
const monadAddress = '0x6cbcd73cd8e8a42844662f0a0e76d7f79afd933d'
|
|
826
|
-
const monadCurrencyId = 'monad'
|
|
827
902
|
|
|
828
903
|
const ledgerOp: LedgerExplorerOperation = {
|
|
829
904
|
hash: '0xf350d4f8e910419e2d5cec294d44e69af8c6185b7089061d33bb4fc246cefb79',
|
|
@@ -862,7 +937,7 @@ describe('EVM Family', () => {
|
|
|
862
937
|
|
|
863
938
|
const result = ledgerOperationToOperations(
|
|
864
939
|
monadAddress,
|
|
865
|
-
|
|
940
|
+
CHAIN_ID.MONAD,
|
|
866
941
|
ledgerOp,
|
|
867
942
|
testLogger
|
|
868
943
|
)
|
package/src/adapters/ledger.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: © 2026 LEDGER SAS
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
+
import type { ChainId } from '../config'
|
|
4
5
|
import type {
|
|
5
6
|
LedgerExplorerERC20TransferEvent,
|
|
6
7
|
LedgerExplorerER1155TransferEvent,
|
|
@@ -20,7 +21,7 @@ import { detectEvmStakingOperationType } from '../staking/detectOperationType'
|
|
|
20
21
|
*/
|
|
21
22
|
export const ledgerOperationToOperations = (
|
|
22
23
|
address: string,
|
|
23
|
-
|
|
24
|
+
chainId: ChainId,
|
|
24
25
|
ledgerOp: LedgerExplorerOperation,
|
|
25
26
|
logger: Logger
|
|
26
27
|
): Array<Operation<MemoNotSupported>> => {
|
|
@@ -41,7 +42,7 @@ export const ledgerOperationToOperations = (
|
|
|
41
42
|
if (from === checksummedAddress) {
|
|
42
43
|
// Recognize staking calls (delegate/undelegate/withdraw/reward) so they are not
|
|
43
44
|
// collapsed into a generic FEES/OUT operation, mirroring the etherscan adapter.
|
|
44
|
-
const stakingType = detectEvmStakingOperationType(
|
|
45
|
+
const stakingType = detectEvmStakingOperationType(chainId, to, methodId)
|
|
45
46
|
types.push(stakingType ?? (safeBigInt(ledgerOp.value) === 0n ? 'FEES' : 'OUT'))
|
|
46
47
|
}
|
|
47
48
|
if (!types.length) {
|
|
@@ -72,6 +73,8 @@ export const ledgerOperationToOperations = (
|
|
|
72
73
|
},
|
|
73
74
|
details: {
|
|
74
75
|
sequence: ledgerOp.nonce_value,
|
|
76
|
+
...(ledgerOp.gas_price ? { gasPrice: ledgerOp.gas_price } : {}),
|
|
77
|
+
...(ledgerOp.gas ? { gasLimit: ledgerOp.gas } : {}),
|
|
75
78
|
},
|
|
76
79
|
}))
|
|
77
80
|
}
|
package/src/api/index.ts
CHANGED
|
@@ -45,7 +45,6 @@ import { getValidatorsPage } from '../staking/validators'
|
|
|
45
45
|
|
|
46
46
|
// NOTE Celo still relies on the EVM coin config and injects its own
|
|
47
47
|
// while creating an unused instance of API
|
|
48
|
-
// TODO Change to Record<string, EvmConfig> once Celo bridge is removed
|
|
49
48
|
|
|
50
49
|
// The framework contract passes opaque params (object or array); EVM only accepts the object
|
|
51
50
|
// form { to, data, block? }, and parseCallParams rejects arrays defensively at runtime. `call`
|
|
@@ -77,7 +76,7 @@ export function createApi(currencyId: string) {
|
|
|
77
76
|
call: async (context: EvmContext, params: CallParams): Promise<string> => {
|
|
78
77
|
const config = await context.config(currencyId)
|
|
79
78
|
const callParams = parseCallParams(params)
|
|
80
|
-
return getNodeApi(config,
|
|
79
|
+
return getNodeApi(config, context.logger).call(callParams)
|
|
81
80
|
},
|
|
82
81
|
combine: (
|
|
83
82
|
_context: EvmContext,
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: © 2026 LEDGER SAS
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
-
import type { EvmConfigInfo } from '
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
4
|
+
import type { EvmConfigInfo } from '../../config'
|
|
5
|
+
import { CHAIN_ID } from '../../config'
|
|
6
|
+
import { createMockEvmContext } from '../../fixtures/context.fixtures'
|
|
7
|
+
import { createApi } from '../index'
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* Integration tests for getBlock API method with ERC20 transfers
|
|
@@ -27,7 +28,7 @@ describe('getBlock ERC20 transfers', () => {
|
|
|
27
28
|
|
|
28
29
|
const velasEvmConfig: EvmConfigInfo = {
|
|
29
30
|
status: { type: 'active' },
|
|
30
|
-
chainId:
|
|
31
|
+
chainId: CHAIN_ID.VELAS_EVM,
|
|
31
32
|
name: 'Velas EVM',
|
|
32
33
|
unit: { name: 'VLX', code: 'VLX', magnitude: 18 },
|
|
33
34
|
node: {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: © 2026 LEDGER SAS
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
-
import type { EvmConfigInfo } from '
|
|
5
|
-
import { createMockEvmContext } from '
|
|
6
|
-
import { createApi } from '
|
|
4
|
+
import type { EvmConfigInfo } from '../../config'
|
|
5
|
+
import { createMockEvmContext } from '../../fixtures/context.fixtures'
|
|
6
|
+
import { createApi } from '../index'
|
|
7
7
|
|
|
8
8
|
describe('EVM Arbitrum Network', () => {
|
|
9
9
|
let module: ReturnType<typeof createApi>
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: © 2026 LEDGER SAS
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
-
import type { EvmConfigInfo } from '
|
|
4
|
+
import type { EvmConfigInfo } from '../../config'
|
|
5
5
|
import type { Operation } from '@ledgerhq/coin-module-framework/api/types'
|
|
6
|
-
import { createMockEvmContext } from '
|
|
7
|
-
import { createApi } from '
|
|
6
|
+
import { createMockEvmContext } from '../../fixtures/context.fixtures'
|
|
7
|
+
import { createApi } from '../index'
|
|
8
8
|
|
|
9
9
|
// Arc exposes its native unit (USDC) as an ERC20 at this fixed precompile
|
|
10
10
|
// address. The explorer indexes native transfers as BOTH a native tx AND a synthetic
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: © 2026 LEDGER SAS
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
-
import type { EvmConfigInfo } from '
|
|
5
|
-
import { createMockEvmContext } from '
|
|
6
|
-
import { createApi } from '
|
|
4
|
+
import type { EvmConfigInfo } from '../../config'
|
|
5
|
+
import { createMockEvmContext } from '../../fixtures/context.fixtures'
|
|
6
|
+
import { createApi } from '../index'
|
|
7
7
|
|
|
8
8
|
describe('EVM Avalanche C-Chain Fuji', () => {
|
|
9
9
|
let module: ReturnType<typeof createApi>
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: © 2026 LEDGER SAS
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
-
import type { EvmConfigInfo } from '
|
|
5
|
-
import { createMockEvmContext } from '
|
|
6
|
-
import { createApi } from '
|
|
4
|
+
import type { EvmConfigInfo } from '../../config'
|
|
5
|
+
import { createMockEvmContext } from '../../fixtures/context.fixtures'
|
|
6
|
+
import { createApi } from '../index'
|
|
7
7
|
|
|
8
8
|
describe('EVM Cronos Network (blockscout explorer)', () => {
|
|
9
9
|
let module: ReturnType<typeof createApi>
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: © 2026 LEDGER SAS
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
-
import type { EvmConfigInfo } from '
|
|
5
|
-
import { createMockEvmContext } from '
|
|
6
|
-
import { createApi } from '
|
|
4
|
+
import type { EvmConfigInfo } from '../../config'
|
|
5
|
+
import { createMockEvmContext } from '../../fixtures/context.fixtures'
|
|
6
|
+
import { createApi } from '../index'
|
|
7
7
|
|
|
8
8
|
describe('Flare (external node)', () => {
|
|
9
9
|
describe('getBlock', () => {
|
|
@@ -12,9 +12,9 @@ import {
|
|
|
12
12
|
mkExternalNode,
|
|
13
13
|
mkLedgerExplorer,
|
|
14
14
|
mkLedgerNode,
|
|
15
|
-
} from '
|
|
16
|
-
import { isNative } from '
|
|
17
|
-
import { createApi } from '
|
|
15
|
+
} from '../../fixtures/context.fixtures'
|
|
16
|
+
import { isNative } from '../../types/assets'
|
|
17
|
+
import { createApi } from '../index'
|
|
18
18
|
|
|
19
19
|
describe.each([
|
|
20
20
|
[
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: © 2026 LEDGER SAS
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
-
import type { EvmConfigInfo } from '
|
|
5
|
-
import { createMockEvmContext } from '
|
|
6
|
-
import { createApi } from '
|
|
4
|
+
import type { EvmConfigInfo } from '../../config'
|
|
5
|
+
import { createMockEvmContext } from '../../fixtures/context.fixtures'
|
|
6
|
+
import { createApi } from '../index'
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Integration tests for getBlock with internal transactions (etherscan/blockscout).
|
package/src/api/{index.monad_testnet.integ.test.ts → tests/index.monad_testnet.integ.test.ts}
RENAMED
|
@@ -5,10 +5,10 @@ import {
|
|
|
5
5
|
createMockEvmConfigInfo,
|
|
6
6
|
createMockEvmContext,
|
|
7
7
|
testLogger,
|
|
8
|
-
} from '
|
|
9
|
-
import { getNodeApi } from '
|
|
10
|
-
import { nodeSourcesFromList } from '
|
|
11
|
-
import { createApi } from '
|
|
8
|
+
} from '../../fixtures/context.fixtures'
|
|
9
|
+
import { getNodeApi } from '../../network/node'
|
|
10
|
+
import { nodeSourcesFromList } from '../../nodeSources'
|
|
11
|
+
import { createApi } from '../index'
|
|
12
12
|
|
|
13
13
|
describe('EVM Api (Monad Testnet)', () => {
|
|
14
14
|
let module: ReturnType<typeof createApi>
|
|
@@ -128,8 +128,8 @@ describe('EVM Api (Monad Testnet)', () => {
|
|
|
128
128
|
expect(items.length).toBeGreaterThan(0)
|
|
129
129
|
const txHash = items[0].tx.hash
|
|
130
130
|
|
|
131
|
-
const api = getNodeApi(config,
|
|
132
|
-
const txInfo = await api.getTransaction(
|
|
131
|
+
const api = getNodeApi(config, testLogger)
|
|
132
|
+
const txInfo = await api.getTransaction(txHash)
|
|
133
133
|
|
|
134
134
|
expect(txInfo.hash).toBe(txHash)
|
|
135
135
|
expect(txInfo.from).toMatch(/^0x[A-Fa-f0-9]{40}$/i)
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: © 2026 LEDGER SAS
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
-
import type { EvmConfigInfo } from '
|
|
4
|
+
import type { EvmConfigInfo } from '../../config'
|
|
5
5
|
import type { Operation } from '@ledgerhq/coin-module-framework/api/types'
|
|
6
|
-
import { createMockEvmContext } from '
|
|
7
|
-
import { createApi } from '
|
|
6
|
+
import { createMockEvmContext } from '../../fixtures/context.fixtures'
|
|
7
|
+
import { createApi } from '../index'
|
|
8
8
|
|
|
9
9
|
describe('EVM Optimism Network', () => {
|
|
10
10
|
let module: ReturnType<typeof createApi>
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: © 2026 LEDGER SAS
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
-
import type { EvmConfigInfo } from '
|
|
5
|
-
import { createMockEvmContext } from '
|
|
6
|
-
import { createApi } from '
|
|
4
|
+
import type { EvmConfigInfo } from '../../config'
|
|
5
|
+
import { createMockEvmContext } from '../../fixtures/context.fixtures'
|
|
6
|
+
import { createApi } from '../index'
|
|
7
7
|
|
|
8
8
|
describe('EVM RSK Network', () => {
|
|
9
9
|
let module: ReturnType<typeof createApi>
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: © 2026 LEDGER SAS
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
-
import type { EvmConfigInfo } from '
|
|
4
|
+
import type { EvmConfigInfo } from '../../config'
|
|
5
5
|
import { fail } from 'assert'
|
|
6
|
-
import { createMockEvmContext } from '
|
|
7
|
-
import { createApi } from '
|
|
6
|
+
import { createMockEvmContext } from '../../fixtures/context.fixtures'
|
|
7
|
+
import { createApi } from '../index'
|
|
8
8
|
|
|
9
9
|
describe('Shape (external node)', () => {
|
|
10
10
|
describe('getBlock', () => {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: © 2026 LEDGER SAS
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
-
import type { EvmConfigInfo } from '
|
|
5
|
-
import { createMockEvmContext } from '
|
|
6
|
-
import { createApi } from '
|
|
4
|
+
import type { EvmConfigInfo } from '../../config'
|
|
5
|
+
import { createMockEvmContext } from '../../fixtures/context.fixtures'
|
|
6
|
+
import { createApi } from '../index'
|
|
7
7
|
|
|
8
8
|
describe('EVM Api (Somnia)', () => {
|
|
9
9
|
let module: ReturnType<typeof createApi>
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: © 2026 LEDGER SAS
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
-
import { mockEvmContext } from '
|
|
5
|
-
import { getValidatorsPage } from '
|
|
6
|
-
import { createApi, parseCallParams } from '
|
|
4
|
+
import { mockEvmContext } from '../../fixtures/context.fixtures'
|
|
5
|
+
import { getValidatorsPage } from '../../staking/validators'
|
|
6
|
+
import { createApi, parseCallParams } from '../index'
|
|
7
7
|
|
|
8
|
-
jest.mock('
|
|
8
|
+
jest.mock('../../staking/validators', () => ({
|
|
9
9
|
getValidatorsPage: jest.fn(),
|
|
10
10
|
}))
|
|
11
11
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: © 2026 LEDGER SAS
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
-
import { createMockEvmContext, mkExternalNode } from '
|
|
5
|
-
import { createApi } from '
|
|
4
|
+
import { createMockEvmContext, mkExternalNode } from '../../fixtures/context.fixtures'
|
|
5
|
+
import { createApi } from '../index'
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Non regression for GET /v1/zksync/account/{address}/operations?minHeight=0&order=asc&limit=1,
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: © 2026 LEDGER SAS
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import { CHAIN_ID } from './chains'
|
|
5
|
+
|
|
6
|
+
describe('CHAIN_ID', () => {
|
|
7
|
+
it('has no duplicate chain id', () => {
|
|
8
|
+
const values = Object.values(CHAIN_ID)
|
|
9
|
+
|
|
10
|
+
expect(new Set(values).size).toBe(values.length)
|
|
11
|
+
})
|
|
12
|
+
})
|