@ledgerhq/coin-evm 10.0.0 → 15.0.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/.oxlintrc.json +2 -6
- package/CHANGELOG.md +54 -0
- package/docs/getBlock-internal-txs-schema.md +2 -2
- package/docs/network/node/index.md +1 -1
- package/lib/abis/index.d.ts +8 -0
- package/lib/abis/index.d.ts.map +1 -1
- package/lib/abis/index.js +30 -0
- package/lib/abis/index.js.map +1 -1
- package/lib/adapters/blockOperations.js +2 -2
- package/lib/adapters/blockOperations.js.map +1 -1
- package/lib/adapters/etherscan.d.ts +2 -1
- package/lib/adapters/etherscan.d.ts.map +1 -1
- package/lib/adapters/etherscan.js +2 -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 +2 -2
- package/lib/adapters/ledger.js.map +1 -1
- package/lib/api/index.d.ts.map +1 -1
- package/lib/api/index.js +3 -2
- package/lib/api/index.js.map +1 -1
- package/lib/chains.d.ts +94 -0
- package/lib/chains.d.ts.map +1 -0
- package/lib/chains.js +98 -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/internalTxSources.d.ts.map +1 -1
- package/lib/internalTxSources.js +21 -3
- package/lib/internalTxSources.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 +22 -14
- package/lib/logic/common.js.map +1 -1
- package/lib/logic/craftTransaction.d.ts.map +1 -1
- package/lib/logic/craftTransaction.js +7 -4
- package/lib/logic/craftTransaction.js.map +1 -1
- package/lib/logic/estimateFees.d.ts.map +1 -1
- package/lib/logic/estimateFees.js +11 -8
- 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 +17 -17
- 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 +9 -9
- 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 +1 -1
- package/lib/logic/listOperations.js.map +1 -1
- package/lib/logic/predicates.d.ts +17 -0
- package/lib/logic/predicates.d.ts.map +1 -0
- package/lib/logic/predicates.js +126 -0
- package/lib/logic/predicates.js.map +1 -0
- 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 +11 -1
- package/lib/network/explorer/types.js.map +1 -1
- package/lib/network/gasTracker/ledger.d.ts.map +1 -1
- package/lib/network/gasTracker/ledger.js +1 -3
- package/lib/network/gasTracker/ledger.js.map +1 -1
- package/lib/network/node/explorerProxy.d.ts.map +1 -1
- package/lib/network/node/explorerProxy.js +22 -17
- package/lib/network/node/explorerProxy.js.map +1 -1
- package/lib/network/node/gethCallTracerToTraceBlockItems.d.ts.map +1 -1
- package/lib/network/node/gethCallTracerToTraceBlockItems.js +10 -12
- package/lib/network/node/gethCallTracerToTraceBlockItems.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 +38 -24
- 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 +104 -103
- package/lib/network/node/rpc.common.js.map +1 -1
- package/lib/network/node/types.d.ts +21 -22
- package/lib/network/node/types.d.ts.map +1 -1
- package/lib/network/node/types.js +0 -27
- 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/nodeSources.d.ts.map +1 -1
- package/lib/nodeSources.js +11 -3
- package/lib/nodeSources.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 +12 -13
- package/lib/staking/contracts.js.map +1 -1
- package/lib/staking/detectOperationType.d.ts +2 -4
- package/lib/staking/detectOperationType.d.ts.map +1 -1
- package/lib/staking/detectOperationType.js +22 -21
- 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 +39 -20
- 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 +14 -12
- 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 +22 -27
- 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/utils.d.ts.map +1 -1
- package/lib/staking/utils.js +22 -27
- package/lib/staking/utils.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 +44 -37
- 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 +7 -6
- 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 +25 -24
- 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 +10 -9
- 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/abis/index.d.ts +8 -0
- package/lib-es/abis/index.d.ts.map +1 -1
- package/lib-es/abis/index.js +29 -0
- package/lib-es/abis/index.js.map +1 -1
- package/lib-es/adapters/blockOperations.js +1 -1
- package/lib-es/adapters/blockOperations.js.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 +2 -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 +2 -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 +3 -2
- package/lib-es/api/index.js.map +1 -1
- package/lib-es/chains.d.ts +94 -0
- package/lib-es/chains.d.ts.map +1 -0
- package/lib-es/chains.js +95 -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/internalTxSources.d.ts.map +1 -1
- package/lib-es/internalTxSources.js +21 -3
- package/lib-es/internalTxSources.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 +22 -14
- 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 +7 -4
- 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 +11 -8
- 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 +18 -18
- 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 +9 -9
- 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 +1 -1
- package/lib-es/logic/listOperations.js.map +1 -1
- package/lib-es/logic/predicates.d.ts +17 -0
- package/lib-es/logic/predicates.d.ts.map +1 -0
- package/lib-es/logic/predicates.js +114 -0
- package/lib-es/logic/predicates.js.map +1 -0
- 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 +11 -1
- package/lib-es/network/explorer/types.js.map +1 -1
- package/lib-es/network/gasTracker/ledger.d.ts.map +1 -1
- package/lib-es/network/gasTracker/ledger.js +1 -3
- package/lib-es/network/gasTracker/ledger.js.map +1 -1
- package/lib-es/network/node/explorerProxy.d.ts.map +1 -1
- package/lib-es/network/node/explorerProxy.js +22 -17
- package/lib-es/network/node/explorerProxy.js.map +1 -1
- package/lib-es/network/node/gethCallTracerToTraceBlockItems.d.ts.map +1 -1
- package/lib-es/network/node/gethCallTracerToTraceBlockItems.js +4 -6
- package/lib-es/network/node/gethCallTracerToTraceBlockItems.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 +38 -24
- 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 +102 -101
- package/lib-es/network/node/rpc.common.js.map +1 -1
- package/lib-es/network/node/types.d.ts +21 -22
- package/lib-es/network/node/types.d.ts.map +1 -1
- package/lib-es/network/node/types.js +0 -25
- 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/nodeSources.d.ts.map +1 -1
- package/lib-es/nodeSources.js +11 -3
- package/lib-es/nodeSources.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 +12 -13
- package/lib-es/staking/contracts.js.map +1 -1
- package/lib-es/staking/detectOperationType.d.ts +2 -4
- package/lib-es/staking/detectOperationType.d.ts.map +1 -1
- package/lib-es/staking/detectOperationType.js +22 -21
- 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 +39 -20
- 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 +13 -11
- 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 +19 -24
- 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/utils.d.ts.map +1 -1
- package/lib-es/staking/utils.js +20 -25
- package/lib-es/staking/utils.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 +43 -36
- 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 +6 -5
- 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 +24 -23
- 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 +9 -8
- 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/abis/index.test.ts +36 -0
- package/src/abis/index.ts +30 -0
- package/src/adapters/blockOperations.ts +1 -1
- package/src/adapters/etherscan.test.ts +34 -38
- package/src/adapters/etherscan.ts +3 -2
- package/src/adapters/ledger.test.ts +49 -22
- package/src/adapters/ledger.ts +3 -2
- package/src/api/getBlock.integ.test.ts +2 -1
- package/src/api/index.monad_testnet.integ.test.ts +2 -2
- package/src/api/index.ts +4 -3
- package/src/chains.test.ts +12 -0
- package/src/chains.ts +97 -0
- package/src/config.ts +5 -1
- package/src/fixtures/staking.fixtures.ts +13 -0
- package/src/internalTxSources.ts +20 -3
- package/src/logic/broadcast.ts +2 -2
- package/src/logic/common.ts +23 -14
- package/src/logic/craftTransaction.ts +6 -5
- package/src/logic/estimateFees.ts +10 -25
- package/src/logic/getBalance.ts +7 -13
- package/src/logic/getBlock.ts +22 -19
- 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 +7 -9
- package/src/logic/lastBlock.ts +2 -2
- package/src/logic/listOperations.ts +0 -1
- package/src/logic/predicates.ts +124 -0
- package/src/logic/tests/broadcast.test.ts +4 -4
- package/src/logic/tests/broadcastSource.test.ts +0 -3
- package/src/logic/tests/common.test.ts +17 -33
- package/src/logic/tests/craftTransaction.test.ts +13 -6
- package/src/logic/tests/estimateFees.test.ts +16 -7
- package/src/logic/tests/getBalance.test.ts +17 -33
- package/src/logic/tests/getBlock.test.ts +69 -75
- package/src/logic/tests/getBlockInfo.test.ts +1 -1
- package/src/logic/tests/getNextSequence.test.ts +1 -1
- package/src/logic/tests/getStakes.test.ts +28 -16
- package/src/logic/tests/internalTransactionsFetcher.test.ts +5 -5
- package/src/logic/tests/lastBlock.test.ts +3 -6
- package/src/logic/tests/listOperations.test.ts +3 -4
- package/src/logic/tests/validateIntent.test.ts +16 -3
- package/src/logic/validateIntent.ts +8 -10
- package/src/logic.test.ts +12 -4
- package/src/logic.ts +13 -13
- package/src/network/explorer/etherscan.test.ts +9 -58
- package/src/network/explorer/etherscan.ts +8 -24
- package/src/network/explorer/index.test.ts +1 -1
- package/src/network/explorer/ledger.test.ts +44 -146
- package/src/network/explorer/ledger.ts +2 -5
- package/src/network/explorer/types.ts +12 -5
- package/src/network/gasTracker/ledger.ts +1 -4
- package/src/network/node/explorerProxy.test.ts +17 -22
- package/src/network/node/explorerProxy.ts +23 -20
- package/src/network/node/gethCallTracerToTraceBlockItems.test.ts +1 -1
- package/src/network/node/gethCallTracerToTraceBlockItems.ts +6 -9
- package/src/network/node/index.memoization.test.ts +29 -22
- package/src/network/node/index.test.ts +1 -3
- package/src/network/node/index.ts +11 -8
- package/src/network/node/ledger.test.ts +63 -69
- package/src/network/node/ledger.ts +39 -38
- package/src/network/node/rpc.common.ts +134 -158
- package/src/network/node/rpc.test.ts +201 -110
- package/src/network/node/types.ts +17 -64
- package/src/network/node/withNodeSources.test.ts +7 -9
- package/src/network/node/withNodeSources.ts +23 -26
- package/src/nodeSources.ts +11 -3
- 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 +13 -14
- package/src/staking/detectOperationType.test.ts +16 -13
- package/src/staking/detectOperationType.ts +24 -22
- 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 +43 -21
- package/src/staking/prepareIntents.test.ts +14 -34
- package/src/staking/prepareIntents.ts +12 -14
- package/src/staking/redelegations.test.ts +73 -131
- package/src/staking/redelegations.ts +13 -31
- 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/utils.ts +19 -26
- package/src/staking/validators/index.ts +45 -51
- package/src/staking/validators/monad.test.ts +52 -54
- package/src/staking/validators/monad.ts +42 -40
- package/src/staking/validators/monadResolver.ts +4 -5
- package/src/staking/validators/sei.ts +2 -2
- package/src/staking/validators/somnia.test.ts +22 -19
- package/src/staking/validators/somnia.ts +23 -29
- 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 +7 -12
- package/src/staking/validators.integ.test.ts +3 -5
- package/src/staking/validators.test.ts +56 -53
- package/src/types/staking.ts +3 -6
|
@@ -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'
|
|
@@ -11,8 +11,10 @@ import { makeBatcher } from '@ledgerhq/live-network/batcher/index'
|
|
|
11
11
|
import axios from 'axios'
|
|
12
12
|
import BigNumber from 'bignumber.js'
|
|
13
13
|
import { ethers } from 'ethers'
|
|
14
|
+
import { toInterfaceAbi } from '../../abis'
|
|
14
15
|
import ERC20Abi from '../../abis/erc20.abi.json'
|
|
15
16
|
import OptimismGasPriceOracleAbi from '../../abis/optimismGasPriceOracle.abi.json'
|
|
17
|
+
import { CHAIN_ID } from '../../config'
|
|
16
18
|
import { GasEstimationError } from '../../errors'
|
|
17
19
|
import { normalizeAddress, padHexString, safeEncodeEIP55 } from '../../logic-public'
|
|
18
20
|
import { getGasOptions } from '../gasTracker/ledger'
|
|
@@ -24,6 +26,8 @@ const DEFAULT_RETRIES_API = 2
|
|
|
24
26
|
|
|
25
27
|
/** The node config, narrowed and defaulted, as the request builders need it. */
|
|
26
28
|
export type LedgerNodeApiConfig = LedgerNodeConfig & {
|
|
29
|
+
/** The chain this node API serves, to key its per-chain caches. */
|
|
30
|
+
chainId: ChainId
|
|
27
31
|
explorerUri: string
|
|
28
32
|
clientVersion?: string
|
|
29
33
|
}
|
|
@@ -50,18 +54,17 @@ function makeFetchWithRetries(config: LedgerNodeApiConfig): LedgerFetch {
|
|
|
50
54
|
}
|
|
51
55
|
}
|
|
52
56
|
|
|
53
|
-
function make<
|
|
54
|
-
f: (fetch: LedgerFetch, config: LedgerNodeApiConfig, ...args:
|
|
57
|
+
function make<Args extends readonly unknown[], R>(
|
|
58
|
+
f: (fetch: LedgerFetch, config: LedgerNodeApiConfig, ...args: Args) => R,
|
|
55
59
|
config: LedgerNodeApiConfig,
|
|
56
60
|
fetch: LedgerFetch
|
|
57
|
-
):
|
|
58
|
-
return (
|
|
61
|
+
): (...args: Args) => R {
|
|
62
|
+
return (...args) => f(fetch, config, ...args)
|
|
59
63
|
}
|
|
60
64
|
|
|
61
65
|
async function getTransaction(
|
|
62
66
|
fetch: LedgerFetch,
|
|
63
67
|
config: LedgerNodeApiConfig,
|
|
64
|
-
_currencyId: string,
|
|
65
68
|
hash: string,
|
|
66
69
|
logger: Logger
|
|
67
70
|
): Promise<TransactionInfo> {
|
|
@@ -97,7 +100,7 @@ function makeGetTokenBalance(
|
|
|
97
100
|
config: LedgerNodeApiConfig,
|
|
98
101
|
fetch: LedgerFetch,
|
|
99
102
|
tokenBalancesBatchersMap: Map<
|
|
100
|
-
|
|
103
|
+
ChainId,
|
|
101
104
|
Batcher<
|
|
102
105
|
{
|
|
103
106
|
address: string
|
|
@@ -107,12 +110,12 @@ function makeGetTokenBalance(
|
|
|
107
110
|
>
|
|
108
111
|
>
|
|
109
112
|
): NodeApi['getTokenBalance'] {
|
|
110
|
-
return async (
|
|
111
|
-
if (!tokenBalancesBatchersMap.has(
|
|
113
|
+
return async (address, contractAddress) => {
|
|
114
|
+
if (!tokenBalancesBatchersMap.has(config.chainId)) {
|
|
112
115
|
const batcher = makeBatcher(makeGetBatchTokenBalances(config, fetch), {})
|
|
113
|
-
tokenBalancesBatchersMap.set(
|
|
116
|
+
tokenBalancesBatchersMap.set(config.chainId, batcher)
|
|
114
117
|
}
|
|
115
|
-
const requestBatcher = tokenBalancesBatchersMap.get(
|
|
118
|
+
const requestBatcher = tokenBalancesBatchersMap.get(config.chainId)!
|
|
116
119
|
return requestBatcher({ address, contract: contractAddress })
|
|
117
120
|
}
|
|
118
121
|
}
|
|
@@ -120,7 +123,6 @@ function makeGetTokenBalance(
|
|
|
120
123
|
async function getCoinBalance(
|
|
121
124
|
fetch: LedgerFetch,
|
|
122
125
|
config: LedgerNodeApiConfig,
|
|
123
|
-
_currencyId: string,
|
|
124
126
|
address: string
|
|
125
127
|
): Promise<BigNumber> {
|
|
126
128
|
const { balance } = await fetch<{ address: string; balance: string }>({
|
|
@@ -156,7 +158,6 @@ function makeGetBatchTokenBalances(
|
|
|
156
158
|
async function getTransactionCount(
|
|
157
159
|
fetch: LedgerFetch,
|
|
158
160
|
config: LedgerNodeApiConfig,
|
|
159
|
-
_currencyId: string,
|
|
160
161
|
address: string
|
|
161
162
|
): Promise<number> {
|
|
162
163
|
const { nonce } = await fetch<{ address: string; nonce: number }>({
|
|
@@ -171,7 +172,7 @@ function makeGetGasEstimation(
|
|
|
171
172
|
fetch: LedgerFetch,
|
|
172
173
|
logger: Logger
|
|
173
174
|
): NodeApi['getGasEstimation'] {
|
|
174
|
-
return async (
|
|
175
|
+
return async (address, transaction) => {
|
|
175
176
|
const { recipient: to, amount: value, data } = transaction
|
|
176
177
|
try {
|
|
177
178
|
const { estimated_gas_limit: gasEstimation } = await fetch<{
|
|
@@ -200,8 +201,7 @@ async function getFeeData(
|
|
|
200
201
|
_fetch: LedgerFetch,
|
|
201
202
|
config: LedgerNodeApiConfig,
|
|
202
203
|
evmConfig: Parameters<NodeApi['getFeeData']>[0],
|
|
203
|
-
|
|
204
|
-
transaction: Parameters<NodeApi['getFeeData']>[2]
|
|
204
|
+
transaction: Parameters<NodeApi['getFeeData']>[1]
|
|
205
205
|
): Promise<Awaited<ReturnType<NodeApi['getFeeData']>>> {
|
|
206
206
|
const options = await getGasOptions({
|
|
207
207
|
config: evmConfig,
|
|
@@ -210,15 +210,18 @@ async function getFeeData(
|
|
|
210
210
|
overrideGasTracker: { type: 'ledger', explorerId: config.explorerId },
|
|
211
211
|
},
|
|
212
212
|
})
|
|
213
|
-
|
|
213
|
+
const strategy = transaction.feesStrategy
|
|
214
|
+
if (strategy === 'slow' || strategy === 'medium' || strategy === 'fast') {
|
|
215
|
+
return options[strategy]
|
|
216
|
+
}
|
|
217
|
+
return options.medium
|
|
214
218
|
}
|
|
215
219
|
|
|
216
220
|
async function broadcastTransaction(
|
|
217
221
|
fetch: LedgerFetch,
|
|
218
222
|
config: LedgerNodeApiConfig,
|
|
219
|
-
_currencyId: string,
|
|
220
223
|
signedTxHex: string,
|
|
221
|
-
broadcastConfig?: Parameters<NodeApi['broadcastTransaction']>[
|
|
224
|
+
broadcastConfig?: Parameters<NodeApi['broadcastTransaction']>[1]
|
|
222
225
|
): Promise<string> {
|
|
223
226
|
const params: Record<string, boolean> = {
|
|
224
227
|
mevProtected: Boolean(broadcastConfig?.mevProtected),
|
|
@@ -242,7 +245,6 @@ async function broadcastTransaction(
|
|
|
242
245
|
async function getBlockByHeight(
|
|
243
246
|
fetch: LedgerFetch,
|
|
244
247
|
config: LedgerNodeApiConfig,
|
|
245
|
-
_currencyId: string,
|
|
246
248
|
blockHeight: number | BlockFinalizationTag = 'latest',
|
|
247
249
|
_prefetchTxs = false
|
|
248
250
|
): Promise<BlockByHeightResult> {
|
|
@@ -283,14 +285,17 @@ async function getBlockByHeight(
|
|
|
283
285
|
async function getOptimismAdditionalFees(
|
|
284
286
|
fetch: LedgerFetch,
|
|
285
287
|
config: LedgerNodeApiConfig,
|
|
286
|
-
currencyId: string,
|
|
287
288
|
transaction: string
|
|
288
289
|
): Promise<BigNumber> {
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
290
|
+
const optimismFeeChainIds: readonly ChainId[] = [
|
|
291
|
+
CHAIN_ID.OPTIMISM,
|
|
292
|
+
CHAIN_ID.OPTIMISM_SEPOLIA,
|
|
293
|
+
CHAIN_ID.BLAST,
|
|
294
|
+
CHAIN_ID.BLAST_SEPOLIA,
|
|
295
|
+
CHAIN_ID.BASE,
|
|
296
|
+
CHAIN_ID.BASE_SEPOLIA,
|
|
297
|
+
]
|
|
298
|
+
if (!optimismFeeChainIds.includes(config.chainId)) {
|
|
294
299
|
return new BigNumber(0)
|
|
295
300
|
}
|
|
296
301
|
if (!transaction) {
|
|
@@ -333,7 +338,6 @@ type ContractReadResult = {
|
|
|
333
338
|
async function call(
|
|
334
339
|
fetch: LedgerFetch,
|
|
335
340
|
config: LedgerNodeApiConfig,
|
|
336
|
-
_currencyId: string,
|
|
337
341
|
params: EvmCallParams
|
|
338
342
|
): Promise<string> {
|
|
339
343
|
// `contract/read` accepts a decimal block height or a tag ("latest"/"earliest"/"pending"); it
|
|
@@ -368,8 +372,8 @@ function makeGetTokenAllowance(
|
|
|
368
372
|
config: LedgerNodeApiConfig,
|
|
369
373
|
fetch: LedgerFetch
|
|
370
374
|
): NodeApi['getTokenAllowance'] {
|
|
371
|
-
const iface = new ethers.Interface(ERC20Abi
|
|
372
|
-
return async (
|
|
375
|
+
const iface = new ethers.Interface(toInterfaceAbi(ERC20Abi))
|
|
376
|
+
return async (ownerAddress, contractAddress, spenderAddress) => {
|
|
373
377
|
const data = iface.encodeFunctionData('allowance', [
|
|
374
378
|
ethers.getAddress(ownerAddress),
|
|
375
379
|
ethers.getAddress(spenderAddress),
|
|
@@ -391,10 +395,9 @@ function makeGetTokenAllowance(
|
|
|
391
395
|
async function getScrollAdditionalFees(
|
|
392
396
|
fetch: LedgerFetch,
|
|
393
397
|
config: LedgerNodeApiConfig,
|
|
394
|
-
currencyId: string,
|
|
395
398
|
transaction: string
|
|
396
399
|
): Promise<BigNumber> {
|
|
397
|
-
if (
|
|
400
|
+
if (config.chainId !== CHAIN_ID.SCROLL) {
|
|
398
401
|
return new BigNumber(0)
|
|
399
402
|
}
|
|
400
403
|
if (!transaction) {
|
|
@@ -423,7 +426,7 @@ async function getScrollAdditionalFees(
|
|
|
423
426
|
export function createLedgerNodeApi(config: LedgerNodeApiConfig, logger: Logger): NodeApi {
|
|
424
427
|
const fetch = makeFetchWithRetries(config)
|
|
425
428
|
const tokenBalancesBatchersMap = new Map<
|
|
426
|
-
|
|
429
|
+
ChainId,
|
|
427
430
|
Batcher<{ address: string; contract: string }, BigNumber>
|
|
428
431
|
>()
|
|
429
432
|
return {
|
|
@@ -433,13 +436,11 @@ export function createLedgerNodeApi(config: LedgerNodeApiConfig, logger: Logger)
|
|
|
433
436
|
getTokenBalance: makeGetTokenBalance(config, fetch, tokenBalancesBatchersMap),
|
|
434
437
|
getTokenAllowance: makeGetTokenAllowance(config, fetch),
|
|
435
438
|
getTransactionCount: make(getTransactionCount, config, fetch),
|
|
436
|
-
getTransaction: ((
|
|
437
|
-
getTransaction(fetch, config, currencyId, hash, logger)) as NodeApi['getTransaction'],
|
|
439
|
+
getTransaction: (hash) => getTransaction(fetch, config, hash, logger),
|
|
438
440
|
getGasEstimation: makeGetGasEstimation(config, fetch, logger),
|
|
439
|
-
// getFeeData takes `config` (EvmConfigInfo) first,
|
|
440
|
-
//
|
|
441
|
-
getFeeData: (
|
|
442
|
-
getFeeData(fetch, config, ...args)) as NodeApi['getFeeData'],
|
|
441
|
+
// getFeeData takes `config` (EvmConfigInfo) first, so it doesn't fit the `make` wrapper;
|
|
442
|
+
// bind it directly (same fetch/config passthrough as `make`).
|
|
443
|
+
getFeeData: (evmConfig, transaction) => getFeeData(fetch, config, evmConfig, transaction),
|
|
443
444
|
broadcastTransaction: make(broadcastTransaction, config, fetch),
|
|
444
445
|
getOptimismAdditionalFees: make(getOptimismAdditionalFees, config, fetch),
|
|
445
446
|
getScrollAdditionalFees: make(getScrollAdditionalFees, config, fetch),
|