@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
|
@@ -351,7 +351,6 @@ type AdaptedLedgerOperations = {
|
|
|
351
351
|
function adaptLedgerRecords(
|
|
352
352
|
config: EvmConfigInfo,
|
|
353
353
|
logger: Logger,
|
|
354
|
-
currencyId: string,
|
|
355
354
|
address: string,
|
|
356
355
|
records: LedgerExplorerOperation[]
|
|
357
356
|
): AdaptedLedgerOperations {
|
|
@@ -366,7 +365,7 @@ function adaptLedgerRecords(
|
|
|
366
365
|
nativeContractsSet.has(contract.toLowerCase())
|
|
367
366
|
|
|
368
367
|
for (const ledgerOp of records) {
|
|
369
|
-
const coinOps = ledgerOperationToOperations(address,
|
|
368
|
+
const coinOps = ledgerOperationToOperations(address, config.chainId, ledgerOp, logger)
|
|
370
369
|
|
|
371
370
|
const erc20TransferEvents =
|
|
372
371
|
nativeContractsSet.size === 0
|
|
@@ -411,7 +410,6 @@ function adaptLedgerRecords(
|
|
|
411
410
|
export const getOperations: ExplorerApi['getOperations'] = async (
|
|
412
411
|
config,
|
|
413
412
|
logger,
|
|
414
|
-
currencyId,
|
|
415
413
|
address,
|
|
416
414
|
fromBlock,
|
|
417
415
|
toBlock,
|
|
@@ -463,7 +461,7 @@ export const getOperations: ExplorerApi['getOperations'] = async (
|
|
|
463
461
|
}
|
|
464
462
|
|
|
465
463
|
return {
|
|
466
|
-
...adaptLedgerRecords(config, logger,
|
|
464
|
+
...adaptLedgerRecords(config, logger, address, records),
|
|
467
465
|
nextPagingToken,
|
|
468
466
|
}
|
|
469
467
|
}
|
|
@@ -481,7 +479,6 @@ export const getOperations: ExplorerApi['getOperations'] = async (
|
|
|
481
479
|
export const discoverTokenAssets: ExplorerApi['discoverTokenAssets'] = async (
|
|
482
480
|
config,
|
|
483
481
|
logger,
|
|
484
|
-
_currencyId,
|
|
485
482
|
address,
|
|
486
483
|
fromBlock
|
|
487
484
|
) => {
|
|
@@ -17,7 +17,6 @@ export type ExplorerApi = {
|
|
|
17
17
|
getOperations: (
|
|
18
18
|
config: EvmConfigInfo,
|
|
19
19
|
logger: Logger,
|
|
20
|
-
currencyId: string,
|
|
21
20
|
address: string,
|
|
22
21
|
fromBlock: number,
|
|
23
22
|
toBlock: number | undefined,
|
|
@@ -46,7 +45,6 @@ export type ExplorerApi = {
|
|
|
46
45
|
discoverTokenAssets: (
|
|
47
46
|
config: EvmConfigInfo,
|
|
48
47
|
logger: Logger,
|
|
49
|
-
currencyId: string,
|
|
50
48
|
address: string,
|
|
51
49
|
fromBlock?: number
|
|
52
50
|
) => Promise<AssetInfo[]>
|
|
@@ -187,6 +187,7 @@ export async function getTransactionFromExplorerProxy(
|
|
|
187
187
|
parseHexBigInt(receipt.gasPrice) ??
|
|
188
188
|
parseHexBigInt(tx.gasPrice) ??
|
|
189
189
|
0n
|
|
190
|
+
const gasLimitBig = parseHexBigInt(tx.gas)
|
|
190
191
|
const statusBig = parseHexBigInt(receipt.status)
|
|
191
192
|
const blockNumberBig = parseHexBigInt(tx.blockNumber)
|
|
192
193
|
const txTypeBig = parseHexBigInt(receipt.type) ?? parseHexBigInt(tx.type)
|
|
@@ -241,6 +242,7 @@ export async function getTransactionFromExplorerProxy(
|
|
|
241
242
|
nonce: Number(nonceBig),
|
|
242
243
|
gasUsed: gasUsedBig.toString(),
|
|
243
244
|
gasPrice: gasPriceBig.toString(),
|
|
245
|
+
...(gasLimitBig !== null ? { gasLimit: gasLimitBig.toString() } : {}),
|
|
244
246
|
status: statusBig !== null ? Number(statusBig) : null,
|
|
245
247
|
value: valueBig.toString(),
|
|
246
248
|
from,
|
|
@@ -276,17 +278,17 @@ export function createExplorerProxyNodeApi(
|
|
|
276
278
|
logger: Logger
|
|
277
279
|
): NodeApi {
|
|
278
280
|
return {
|
|
279
|
-
call: (
|
|
280
|
-
getCoinBalance: (
|
|
281
|
-
getTokenBalance: (
|
|
282
|
-
getTokenAllowance: (
|
|
283
|
-
getTransactionCount: (
|
|
284
|
-
getGasEstimation: (
|
|
285
|
-
getFeeData: (_cfg,
|
|
286
|
-
broadcastTransaction: (
|
|
287
|
-
getOptimismAdditionalFees: (
|
|
288
|
-
getScrollAdditionalFees: (
|
|
289
|
-
getBlockByHeight: async (
|
|
281
|
+
call: (_p) => notSupported('call'),
|
|
282
|
+
getCoinBalance: (_a) => notSupported('getCoinBalance'),
|
|
283
|
+
getTokenBalance: (_a, _ca) => notSupported('getTokenBalance'),
|
|
284
|
+
getTokenAllowance: (_o, _ca, _s) => notSupported('getTokenAllowance'),
|
|
285
|
+
getTransactionCount: (_a) => notSupported('getTransactionCount'),
|
|
286
|
+
getGasEstimation: (_a, _t) => notSupported('getGasEstimation'),
|
|
287
|
+
getFeeData: (_cfg, _t) => notSupported('getFeeData'),
|
|
288
|
+
broadcastTransaction: (_tx) => notSupported('broadcastTransaction'),
|
|
289
|
+
getOptimismAdditionalFees: (_t) => notSupported('getOptimismAdditionalFees'),
|
|
290
|
+
getScrollAdditionalFees: (_t) => notSupported('getScrollAdditionalFees'),
|
|
291
|
+
getBlockByHeight: async (height) => {
|
|
290
292
|
if (typeof height !== 'number')
|
|
291
293
|
throw new Error('EVM getBlockByHeight: explorer proxy only supports numeric heights')
|
|
292
294
|
const result = await getBlockFromExplorerProxy(explorerUri, height, explorerRetries, logger)
|
|
@@ -296,7 +298,7 @@ export function createExplorerProxyNodeApi(
|
|
|
296
298
|
)
|
|
297
299
|
return result
|
|
298
300
|
},
|
|
299
|
-
getTransaction: async (
|
|
301
|
+
getTransaction: async (hash) => {
|
|
300
302
|
const result = await getTransactionFromExplorerProxy(
|
|
301
303
|
explorerUri,
|
|
302
304
|
hash,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: © 2026 LEDGER SAS
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
-
import type { EvmConfigInfo } from '../../config'
|
|
4
|
+
import type { ChainId, EvmConfigInfo } from '../../config'
|
|
5
5
|
import type { NodeApi } from './types'
|
|
6
6
|
import type { Logger } from '@ledgerhq/coin-module-framework/config'
|
|
7
7
|
import { DEFAULT_LEDGER_EXPLORER_URI } from '../../config'
|
|
@@ -13,23 +13,23 @@ import { withNodeSources } from './withNodeSources'
|
|
|
13
13
|
/**
|
|
14
14
|
* Memoized NodeApi instances for both ledger and external nodes.
|
|
15
15
|
* Key includes all config dimensions that affect the API instance's behavior.
|
|
16
|
-
* Unbounded growth is acceptable: the number of entries is at most (
|
|
17
|
-
* node configs). In practice there are few EVM chains and config is static per
|
|
16
|
+
* Unbounded growth is acceptable: the number of entries is at most (chains × distinct
|
|
17
|
+
* node configs). In practice there are few EVM chains and config is static per chain,
|
|
18
18
|
* so the cache stays small.
|
|
19
19
|
*/
|
|
20
20
|
const nodeApiCache = new Map<string, NodeApi>()
|
|
21
21
|
|
|
22
22
|
function cacheKey(
|
|
23
|
-
|
|
23
|
+
chainId: ChainId,
|
|
24
24
|
node: { type: string; [key: string]: unknown },
|
|
25
25
|
explorerUri: string,
|
|
26
26
|
clientVersion: string,
|
|
27
27
|
nodeSources: string
|
|
28
28
|
): string {
|
|
29
|
-
return `${
|
|
29
|
+
return `${chainId}:${JSON.stringify(node)}:${explorerUri}:${clientVersion}:${nodeSources}`
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
export const getNodeApi = (config: EvmConfigInfo,
|
|
32
|
+
export const getNodeApi = (config: EvmConfigInfo, logger: Logger): NodeApi => {
|
|
33
33
|
const node = config?.node
|
|
34
34
|
const type = node?.type
|
|
35
35
|
|
|
@@ -40,13 +40,16 @@ export const getNodeApi = (config: EvmConfigInfo, currencyId: string, logger: Lo
|
|
|
40
40
|
const explorerUri = config.ledgerExplorerUri ?? DEFAULT_LEDGER_EXPLORER_URI
|
|
41
41
|
const clientVersion = config.ledgerClientVersion ?? ''
|
|
42
42
|
const nodeSources = JSON.stringify(config.nodeSources ?? ['node'])
|
|
43
|
-
const key = cacheKey(
|
|
43
|
+
const key = cacheKey(config.chainId, node, explorerUri, clientVersion, nodeSources)
|
|
44
44
|
|
|
45
45
|
let api = nodeApiCache.get(key)
|
|
46
46
|
if (api === undefined) {
|
|
47
47
|
const raw =
|
|
48
48
|
type === 'ledger'
|
|
49
|
-
? createLedgerNodeApi(
|
|
49
|
+
? createLedgerNodeApi(
|
|
50
|
+
{ ...node, explorerUri, clientVersion, chainId: config.chainId },
|
|
51
|
+
logger
|
|
52
|
+
)
|
|
50
53
|
: createNodeApi(config, node, logger)
|
|
51
54
|
api = withNodeSources(raw, config, logger)
|
|
52
55
|
nodeApiCache.set(key, api)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: © 2026 LEDGER SAS
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
-
import type { BlockFinalizationTag, LedgerNodeConfig } from '../../config'
|
|
4
|
+
import type { BlockFinalizationTag, ChainId, LedgerNodeConfig } from '../../config'
|
|
5
5
|
import type { LedgerExplorerOperation } from '../../types'
|
|
6
6
|
import type { BlockByHeightResult, EvmCallParams, NodeApi, TransactionInfo } from './types'
|
|
7
7
|
import type { Logger } from '@ledgerhq/coin-module-framework/config'
|
|
@@ -14,6 +14,7 @@ import { ethers } from 'ethers'
|
|
|
14
14
|
import { toInterfaceAbi } from '../../abis'
|
|
15
15
|
import ERC20Abi from '../../abis/erc20.abi.json'
|
|
16
16
|
import OptimismGasPriceOracleAbi from '../../abis/optimismGasPriceOracle.abi.json'
|
|
17
|
+
import { CHAIN_ID } from '../../config'
|
|
17
18
|
import { GasEstimationError } from '../../errors'
|
|
18
19
|
import { normalizeAddress, padHexString, safeEncodeEIP55 } from '../../logic-public'
|
|
19
20
|
import { getGasOptions } from '../gasTracker/ledger'
|
|
@@ -25,6 +26,8 @@ const DEFAULT_RETRIES_API = 2
|
|
|
25
26
|
|
|
26
27
|
/** The node config, narrowed and defaulted, as the request builders need it. */
|
|
27
28
|
export type LedgerNodeApiConfig = LedgerNodeConfig & {
|
|
29
|
+
/** The chain this node API serves, to key its per-chain caches. */
|
|
30
|
+
chainId: ChainId
|
|
28
31
|
explorerUri: string
|
|
29
32
|
clientVersion?: string
|
|
30
33
|
}
|
|
@@ -52,17 +55,16 @@ function makeFetchWithRetries(config: LedgerNodeApiConfig): LedgerFetch {
|
|
|
52
55
|
}
|
|
53
56
|
|
|
54
57
|
function make<Args extends readonly unknown[], R>(
|
|
55
|
-
f: (fetch: LedgerFetch, config: LedgerNodeApiConfig,
|
|
58
|
+
f: (fetch: LedgerFetch, config: LedgerNodeApiConfig, ...args: Args) => R,
|
|
56
59
|
config: LedgerNodeApiConfig,
|
|
57
60
|
fetch: LedgerFetch
|
|
58
|
-
): (
|
|
59
|
-
return (
|
|
61
|
+
): (...args: Args) => R {
|
|
62
|
+
return (...args) => f(fetch, config, ...args)
|
|
60
63
|
}
|
|
61
64
|
|
|
62
65
|
async function getTransaction(
|
|
63
66
|
fetch: LedgerFetch,
|
|
64
67
|
config: LedgerNodeApiConfig,
|
|
65
|
-
_currencyId: string,
|
|
66
68
|
hash: string,
|
|
67
69
|
logger: Logger
|
|
68
70
|
): Promise<TransactionInfo> {
|
|
@@ -77,6 +79,7 @@ async function getTransaction(
|
|
|
77
79
|
blockHash: ledgerTransaction.block?.hash,
|
|
78
80
|
nonce: ledgerTransaction.nonce_value,
|
|
79
81
|
gasPrice: ledgerTransaction.gas_price,
|
|
82
|
+
...(ledgerTransaction.gas ? { gasLimit: ledgerTransaction.gas } : {}),
|
|
80
83
|
gasUsed: ledgerTransaction.gas_used,
|
|
81
84
|
value: ledgerTransaction.value,
|
|
82
85
|
status: ledgerTransaction.status,
|
|
@@ -98,7 +101,7 @@ function makeGetTokenBalance(
|
|
|
98
101
|
config: LedgerNodeApiConfig,
|
|
99
102
|
fetch: LedgerFetch,
|
|
100
103
|
tokenBalancesBatchersMap: Map<
|
|
101
|
-
|
|
104
|
+
ChainId,
|
|
102
105
|
Batcher<
|
|
103
106
|
{
|
|
104
107
|
address: string
|
|
@@ -108,12 +111,12 @@ function makeGetTokenBalance(
|
|
|
108
111
|
>
|
|
109
112
|
>
|
|
110
113
|
): NodeApi['getTokenBalance'] {
|
|
111
|
-
return async (
|
|
112
|
-
if (!tokenBalancesBatchersMap.has(
|
|
114
|
+
return async (address, contractAddress) => {
|
|
115
|
+
if (!tokenBalancesBatchersMap.has(config.chainId)) {
|
|
113
116
|
const batcher = makeBatcher(makeGetBatchTokenBalances(config, fetch), {})
|
|
114
|
-
tokenBalancesBatchersMap.set(
|
|
117
|
+
tokenBalancesBatchersMap.set(config.chainId, batcher)
|
|
115
118
|
}
|
|
116
|
-
const requestBatcher = tokenBalancesBatchersMap.get(
|
|
119
|
+
const requestBatcher = tokenBalancesBatchersMap.get(config.chainId)!
|
|
117
120
|
return requestBatcher({ address, contract: contractAddress })
|
|
118
121
|
}
|
|
119
122
|
}
|
|
@@ -121,7 +124,6 @@ function makeGetTokenBalance(
|
|
|
121
124
|
async function getCoinBalance(
|
|
122
125
|
fetch: LedgerFetch,
|
|
123
126
|
config: LedgerNodeApiConfig,
|
|
124
|
-
_currencyId: string,
|
|
125
127
|
address: string
|
|
126
128
|
): Promise<BigNumber> {
|
|
127
129
|
const { balance } = await fetch<{ address: string; balance: string }>({
|
|
@@ -157,7 +159,6 @@ function makeGetBatchTokenBalances(
|
|
|
157
159
|
async function getTransactionCount(
|
|
158
160
|
fetch: LedgerFetch,
|
|
159
161
|
config: LedgerNodeApiConfig,
|
|
160
|
-
_currencyId: string,
|
|
161
162
|
address: string
|
|
162
163
|
): Promise<number> {
|
|
163
164
|
const { nonce } = await fetch<{ address: string; nonce: number }>({
|
|
@@ -172,7 +173,7 @@ function makeGetGasEstimation(
|
|
|
172
173
|
fetch: LedgerFetch,
|
|
173
174
|
logger: Logger
|
|
174
175
|
): NodeApi['getGasEstimation'] {
|
|
175
|
-
return async (
|
|
176
|
+
return async (address, transaction) => {
|
|
176
177
|
const { recipient: to, amount: value, data } = transaction
|
|
177
178
|
try {
|
|
178
179
|
const { estimated_gas_limit: gasEstimation } = await fetch<{
|
|
@@ -201,8 +202,7 @@ async function getFeeData(
|
|
|
201
202
|
_fetch: LedgerFetch,
|
|
202
203
|
config: LedgerNodeApiConfig,
|
|
203
204
|
evmConfig: Parameters<NodeApi['getFeeData']>[0],
|
|
204
|
-
|
|
205
|
-
transaction: Parameters<NodeApi['getFeeData']>[2]
|
|
205
|
+
transaction: Parameters<NodeApi['getFeeData']>[1]
|
|
206
206
|
): Promise<Awaited<ReturnType<NodeApi['getFeeData']>>> {
|
|
207
207
|
const options = await getGasOptions({
|
|
208
208
|
config: evmConfig,
|
|
@@ -221,9 +221,8 @@ async function getFeeData(
|
|
|
221
221
|
async function broadcastTransaction(
|
|
222
222
|
fetch: LedgerFetch,
|
|
223
223
|
config: LedgerNodeApiConfig,
|
|
224
|
-
_currencyId: string,
|
|
225
224
|
signedTxHex: string,
|
|
226
|
-
broadcastConfig?: Parameters<NodeApi['broadcastTransaction']>[
|
|
225
|
+
broadcastConfig?: Parameters<NodeApi['broadcastTransaction']>[1]
|
|
227
226
|
): Promise<string> {
|
|
228
227
|
const params: Record<string, boolean> = {
|
|
229
228
|
mevProtected: Boolean(broadcastConfig?.mevProtected),
|
|
@@ -247,7 +246,6 @@ async function broadcastTransaction(
|
|
|
247
246
|
async function getBlockByHeight(
|
|
248
247
|
fetch: LedgerFetch,
|
|
249
248
|
config: LedgerNodeApiConfig,
|
|
250
|
-
_currencyId: string,
|
|
251
249
|
blockHeight: number | BlockFinalizationTag = 'latest',
|
|
252
250
|
_prefetchTxs = false
|
|
253
251
|
): Promise<BlockByHeightResult> {
|
|
@@ -288,14 +286,17 @@ async function getBlockByHeight(
|
|
|
288
286
|
async function getOptimismAdditionalFees(
|
|
289
287
|
fetch: LedgerFetch,
|
|
290
288
|
config: LedgerNodeApiConfig,
|
|
291
|
-
currencyId: string,
|
|
292
289
|
transaction: string
|
|
293
290
|
): Promise<BigNumber> {
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
291
|
+
const optimismFeeChainIds: readonly ChainId[] = [
|
|
292
|
+
CHAIN_ID.OPTIMISM,
|
|
293
|
+
CHAIN_ID.OPTIMISM_SEPOLIA,
|
|
294
|
+
CHAIN_ID.BLAST,
|
|
295
|
+
CHAIN_ID.BLAST_SEPOLIA,
|
|
296
|
+
CHAIN_ID.BASE,
|
|
297
|
+
CHAIN_ID.BASE_SEPOLIA,
|
|
298
|
+
]
|
|
299
|
+
if (!optimismFeeChainIds.includes(config.chainId)) {
|
|
299
300
|
return new BigNumber(0)
|
|
300
301
|
}
|
|
301
302
|
if (!transaction) {
|
|
@@ -338,7 +339,6 @@ type ContractReadResult = {
|
|
|
338
339
|
async function call(
|
|
339
340
|
fetch: LedgerFetch,
|
|
340
341
|
config: LedgerNodeApiConfig,
|
|
341
|
-
_currencyId: string,
|
|
342
342
|
params: EvmCallParams
|
|
343
343
|
): Promise<string> {
|
|
344
344
|
// `contract/read` accepts a decimal block height or a tag ("latest"/"earliest"/"pending"); it
|
|
@@ -374,7 +374,7 @@ function makeGetTokenAllowance(
|
|
|
374
374
|
fetch: LedgerFetch
|
|
375
375
|
): NodeApi['getTokenAllowance'] {
|
|
376
376
|
const iface = new ethers.Interface(toInterfaceAbi(ERC20Abi))
|
|
377
|
-
return async (
|
|
377
|
+
return async (ownerAddress, contractAddress, spenderAddress) => {
|
|
378
378
|
const data = iface.encodeFunctionData('allowance', [
|
|
379
379
|
ethers.getAddress(ownerAddress),
|
|
380
380
|
ethers.getAddress(spenderAddress),
|
|
@@ -396,10 +396,9 @@ function makeGetTokenAllowance(
|
|
|
396
396
|
async function getScrollAdditionalFees(
|
|
397
397
|
fetch: LedgerFetch,
|
|
398
398
|
config: LedgerNodeApiConfig,
|
|
399
|
-
currencyId: string,
|
|
400
399
|
transaction: string
|
|
401
400
|
): Promise<BigNumber> {
|
|
402
|
-
if (
|
|
401
|
+
if (config.chainId !== CHAIN_ID.SCROLL) {
|
|
403
402
|
return new BigNumber(0)
|
|
404
403
|
}
|
|
405
404
|
if (!transaction) {
|
|
@@ -428,7 +427,7 @@ async function getScrollAdditionalFees(
|
|
|
428
427
|
export function createLedgerNodeApi(config: LedgerNodeApiConfig, logger: Logger): NodeApi {
|
|
429
428
|
const fetch = makeFetchWithRetries(config)
|
|
430
429
|
const tokenBalancesBatchersMap = new Map<
|
|
431
|
-
|
|
430
|
+
ChainId,
|
|
432
431
|
Batcher<{ address: string; contract: string }, BigNumber>
|
|
433
432
|
>()
|
|
434
433
|
return {
|
|
@@ -438,12 +437,11 @@ export function createLedgerNodeApi(config: LedgerNodeApiConfig, logger: Logger)
|
|
|
438
437
|
getTokenBalance: makeGetTokenBalance(config, fetch, tokenBalancesBatchersMap),
|
|
439
438
|
getTokenAllowance: makeGetTokenAllowance(config, fetch),
|
|
440
439
|
getTransactionCount: make(getTransactionCount, config, fetch),
|
|
441
|
-
getTransaction: (
|
|
440
|
+
getTransaction: (hash) => getTransaction(fetch, config, hash, logger),
|
|
442
441
|
getGasEstimation: makeGetGasEstimation(config, fetch, logger),
|
|
443
|
-
// getFeeData takes `config` (EvmConfigInfo) first,
|
|
444
|
-
//
|
|
445
|
-
getFeeData: (evmConfig,
|
|
446
|
-
getFeeData(fetch, config, evmConfig, currencyId, transaction),
|
|
442
|
+
// getFeeData takes `config` (EvmConfigInfo) first, so it doesn't fit the `make` wrapper;
|
|
443
|
+
// bind it directly (same fetch/config passthrough as `make`).
|
|
444
|
+
getFeeData: (evmConfig, transaction) => getFeeData(fetch, config, evmConfig, transaction),
|
|
447
445
|
broadcastTransaction: make(broadcastTransaction, config, fetch),
|
|
448
446
|
getOptimismAdditionalFees: make(getOptimismAdditionalFees, config, fetch),
|
|
449
447
|
getScrollAdditionalFees: make(getScrollAdditionalFees, config, fetch),
|