@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
|
@@ -17,6 +17,7 @@ import {
|
|
|
17
17
|
deserializePagingToken,
|
|
18
18
|
serializePagingToken,
|
|
19
19
|
} from '../../adapters'
|
|
20
|
+
import { CHAIN_ID } from '../../config'
|
|
20
21
|
import {
|
|
21
22
|
EtherscanAPIError,
|
|
22
23
|
EtherscanLikeExplorerUsedIncorrectly,
|
|
@@ -42,7 +43,6 @@ jest.mocked(delay).mockImplementation(
|
|
|
42
43
|
() => new Promise((resolve) => setTimeout(resolve, 1)) // mocking the delay supposed to happen after each try
|
|
43
44
|
)
|
|
44
45
|
|
|
45
|
-
const currencyId = 'ethereum'
|
|
46
46
|
const address = '0x6cBCD73CD8e8a42844662f0A0e76D7F79Afd933d'
|
|
47
47
|
let config: EvmConfigInfo
|
|
48
48
|
|
|
@@ -56,7 +56,6 @@ const createFetchWithLimit =
|
|
|
56
56
|
data: { result: ops },
|
|
57
57
|
})
|
|
58
58
|
return apiFn({
|
|
59
|
-
currencyId: currencyId,
|
|
60
59
|
config,
|
|
61
60
|
address: address,
|
|
62
61
|
fromBlock: 0,
|
|
@@ -192,7 +191,6 @@ describe('EVM Family', () => {
|
|
|
192
191
|
})
|
|
193
192
|
|
|
194
193
|
const response = await getOperations({
|
|
195
|
-
currencyId,
|
|
196
194
|
config,
|
|
197
195
|
address,
|
|
198
196
|
fromBlock: 0,
|
|
@@ -226,7 +224,6 @@ describe('EVM Family', () => {
|
|
|
226
224
|
|
|
227
225
|
try {
|
|
228
226
|
await ETHERSCAN_API.getCoinOperations({
|
|
229
|
-
currencyId: currencyId,
|
|
230
227
|
config,
|
|
231
228
|
address: address,
|
|
232
229
|
fromBlock: 0,
|
|
@@ -250,7 +247,6 @@ describe('EVM Family', () => {
|
|
|
250
247
|
}))
|
|
251
248
|
|
|
252
249
|
const response = await ETHERSCAN_API.getCoinOperations({
|
|
253
|
-
currencyId: currencyId,
|
|
254
250
|
config,
|
|
255
251
|
address: address,
|
|
256
252
|
fromBlock: 0,
|
|
@@ -261,7 +257,7 @@ describe('EVM Family', () => {
|
|
|
261
257
|
expect(response.operations.length).toBe(4)
|
|
262
258
|
expect(response).toEqual({
|
|
263
259
|
operations: etherscanCoinOperations
|
|
264
|
-
.map((op) => etherscanOperationToOperations(address,
|
|
260
|
+
.map((op) => etherscanOperationToOperations(address, CHAIN_ID.ETHEREUM, op, testLogger))
|
|
265
261
|
.flat(),
|
|
266
262
|
isDone: true,
|
|
267
263
|
boundBlock: 14923692,
|
|
@@ -288,7 +284,6 @@ describe('EVM Family', () => {
|
|
|
288
284
|
}))
|
|
289
285
|
|
|
290
286
|
const response = await ETHERSCAN_API.getCoinOperations({
|
|
291
|
-
currencyId: currencyId,
|
|
292
287
|
config,
|
|
293
288
|
address: address,
|
|
294
289
|
fromBlock: 50,
|
|
@@ -299,7 +294,7 @@ describe('EVM Family', () => {
|
|
|
299
294
|
expect(response.operations.length).toBe(4)
|
|
300
295
|
expect(response).toEqual({
|
|
301
296
|
operations: etherscanCoinOperations
|
|
302
|
-
.map((op) => etherscanOperationToOperations(address,
|
|
297
|
+
.map((op) => etherscanOperationToOperations(address, CHAIN_ID.ETHEREUM, op, testLogger))
|
|
303
298
|
.flat(),
|
|
304
299
|
isDone: true,
|
|
305
300
|
boundBlock: 14923692,
|
|
@@ -326,7 +321,6 @@ describe('EVM Family', () => {
|
|
|
326
321
|
}))
|
|
327
322
|
|
|
328
323
|
const response = await ETHERSCAN_API.getCoinOperations({
|
|
329
|
-
currencyId: currencyId,
|
|
330
324
|
config,
|
|
331
325
|
address: address,
|
|
332
326
|
fromBlock: 50,
|
|
@@ -338,7 +332,7 @@ describe('EVM Family', () => {
|
|
|
338
332
|
expect(response.operations.length).toBe(4)
|
|
339
333
|
expect(response).toEqual({
|
|
340
334
|
operations: etherscanCoinOperations
|
|
341
|
-
.map((op) => etherscanOperationToOperations(address,
|
|
335
|
+
.map((op) => etherscanOperationToOperations(address, CHAIN_ID.ETHEREUM, op, testLogger))
|
|
342
336
|
.flat(),
|
|
343
337
|
isDone: true,
|
|
344
338
|
boundBlock: 14923692,
|
|
@@ -445,7 +439,6 @@ describe('EVM Family', () => {
|
|
|
445
439
|
|
|
446
440
|
try {
|
|
447
441
|
await ETHERSCAN_API.getTokenOperations({
|
|
448
|
-
currencyId: currencyId,
|
|
449
442
|
config,
|
|
450
443
|
address: address,
|
|
451
444
|
fromBlock: 0,
|
|
@@ -469,7 +462,6 @@ describe('EVM Family', () => {
|
|
|
469
462
|
}))
|
|
470
463
|
|
|
471
464
|
const response = await ETHERSCAN_API.getTokenOperations({
|
|
472
|
-
currencyId: currencyId,
|
|
473
465
|
config,
|
|
474
466
|
address: address,
|
|
475
467
|
fromBlock: 0,
|
|
@@ -509,7 +501,6 @@ describe('EVM Family', () => {
|
|
|
509
501
|
}))
|
|
510
502
|
|
|
511
503
|
const response = await ETHERSCAN_API.getTokenOperations({
|
|
512
|
-
currencyId: currencyId,
|
|
513
504
|
config,
|
|
514
505
|
address: address,
|
|
515
506
|
fromBlock: 50,
|
|
@@ -549,7 +540,6 @@ describe('EVM Family', () => {
|
|
|
549
540
|
}))
|
|
550
541
|
|
|
551
542
|
const response = await ETHERSCAN_API.getTokenOperations({
|
|
552
|
-
currencyId: currencyId,
|
|
553
543
|
config,
|
|
554
544
|
address: address,
|
|
555
545
|
fromBlock: 50,
|
|
@@ -677,7 +667,6 @@ describe('EVM Family', () => {
|
|
|
677
667
|
}))
|
|
678
668
|
|
|
679
669
|
const response = await ETHERSCAN_API.getTokenOperations({
|
|
680
|
-
currencyId: currencyId,
|
|
681
670
|
config,
|
|
682
671
|
address: address,
|
|
683
672
|
fromBlock: 0,
|
|
@@ -695,7 +684,6 @@ describe('EVM Family', () => {
|
|
|
695
684
|
}))
|
|
696
685
|
|
|
697
686
|
const response = await ETHERSCAN_API.getTokenOperations({
|
|
698
|
-
currencyId: currencyId,
|
|
699
687
|
config,
|
|
700
688
|
address: address,
|
|
701
689
|
fromBlock: 0,
|
|
@@ -713,7 +701,6 @@ describe('EVM Family', () => {
|
|
|
713
701
|
}))
|
|
714
702
|
|
|
715
703
|
const response = await ETHERSCAN_API.getTokenOperations({
|
|
716
|
-
currencyId: currencyId,
|
|
717
704
|
config,
|
|
718
705
|
address: address,
|
|
719
706
|
fromBlock: 0,
|
|
@@ -732,7 +719,6 @@ describe('EVM Family', () => {
|
|
|
732
719
|
}))
|
|
733
720
|
|
|
734
721
|
const response = await ETHERSCAN_API.getTokenOperations({
|
|
735
|
-
currencyId: currencyId,
|
|
736
722
|
config,
|
|
737
723
|
address: address,
|
|
738
724
|
fromBlock: 0,
|
|
@@ -761,7 +747,6 @@ describe('EVM Family', () => {
|
|
|
761
747
|
|
|
762
748
|
try {
|
|
763
749
|
await ETHERSCAN_API.getERC721Operations({
|
|
764
|
-
currencyId: currencyId,
|
|
765
750
|
config,
|
|
766
751
|
address: address,
|
|
767
752
|
fromBlock: 0,
|
|
@@ -785,7 +770,6 @@ describe('EVM Family', () => {
|
|
|
785
770
|
}))
|
|
786
771
|
|
|
787
772
|
const response = await ETHERSCAN_API.getERC721Operations({
|
|
788
|
-
currencyId: currencyId,
|
|
789
773
|
config,
|
|
790
774
|
address: address,
|
|
791
775
|
fromBlock: 0,
|
|
@@ -824,7 +808,6 @@ describe('EVM Family', () => {
|
|
|
824
808
|
}))
|
|
825
809
|
|
|
826
810
|
const response = await ETHERSCAN_API.getERC721Operations({
|
|
827
|
-
currencyId: currencyId,
|
|
828
811
|
config,
|
|
829
812
|
address: address,
|
|
830
813
|
fromBlock: 50,
|
|
@@ -863,7 +846,6 @@ describe('EVM Family', () => {
|
|
|
863
846
|
}))
|
|
864
847
|
|
|
865
848
|
const response = await ETHERSCAN_API.getERC721Operations({
|
|
866
|
-
currencyId: currencyId,
|
|
867
849
|
config,
|
|
868
850
|
address: address,
|
|
869
851
|
fromBlock: 50,
|
|
@@ -987,7 +969,6 @@ describe('EVM Family', () => {
|
|
|
987
969
|
|
|
988
970
|
try {
|
|
989
971
|
await ETHERSCAN_API.getERC1155Operations({
|
|
990
|
-
currencyId: currencyId,
|
|
991
972
|
config,
|
|
992
973
|
address: address,
|
|
993
974
|
fromBlock: 0,
|
|
@@ -1011,7 +992,6 @@ describe('EVM Family', () => {
|
|
|
1011
992
|
}))
|
|
1012
993
|
|
|
1013
994
|
const response = await ETHERSCAN_API.getERC1155Operations({
|
|
1014
|
-
currencyId: currencyId,
|
|
1015
995
|
config,
|
|
1016
996
|
address: address,
|
|
1017
997
|
fromBlock: 0,
|
|
@@ -1050,7 +1030,6 @@ describe('EVM Family', () => {
|
|
|
1050
1030
|
}))
|
|
1051
1031
|
|
|
1052
1032
|
const response = await ETHERSCAN_API.getERC1155Operations({
|
|
1053
|
-
currencyId: currencyId,
|
|
1054
1033
|
config,
|
|
1055
1034
|
address: address,
|
|
1056
1035
|
fromBlock: 50,
|
|
@@ -1089,7 +1068,6 @@ describe('EVM Family', () => {
|
|
|
1089
1068
|
}))
|
|
1090
1069
|
|
|
1091
1070
|
const response = await ETHERSCAN_API.getERC1155Operations({
|
|
1092
|
-
currencyId: currencyId,
|
|
1093
1071
|
config,
|
|
1094
1072
|
address: address,
|
|
1095
1073
|
fromBlock: 50,
|
|
@@ -1208,7 +1186,6 @@ describe('EVM Family', () => {
|
|
|
1208
1186
|
}))
|
|
1209
1187
|
|
|
1210
1188
|
const response = await ETHERSCAN_API.getNftOperations({
|
|
1211
|
-
currencyId: currencyId,
|
|
1212
1189
|
config,
|
|
1213
1190
|
address: address,
|
|
1214
1191
|
fromBlock: 0,
|
|
@@ -1242,7 +1219,6 @@ describe('EVM Family', () => {
|
|
|
1242
1219
|
},
|
|
1243
1220
|
}))
|
|
1244
1221
|
return ETHERSCAN_API.getNftOperations({
|
|
1245
|
-
currencyId: currencyId,
|
|
1246
1222
|
config,
|
|
1247
1223
|
address: address,
|
|
1248
1224
|
fromBlock: 0,
|
|
@@ -1314,7 +1290,6 @@ describe('EVM Family', () => {
|
|
|
1314
1290
|
},
|
|
1315
1291
|
}))
|
|
1316
1292
|
return ETHERSCAN_API.getNftOperations({
|
|
1317
|
-
currencyId: currencyId,
|
|
1318
1293
|
config,
|
|
1319
1294
|
address: address,
|
|
1320
1295
|
fromBlock: 0,
|
|
@@ -1349,7 +1324,6 @@ describe('EVM Family', () => {
|
|
|
1349
1324
|
|
|
1350
1325
|
try {
|
|
1351
1326
|
await ETHERSCAN_API.getInternalOperations({
|
|
1352
|
-
currencyId: currencyId,
|
|
1353
1327
|
config,
|
|
1354
1328
|
address: address,
|
|
1355
1329
|
fromBlock: 0,
|
|
@@ -1373,7 +1347,6 @@ describe('EVM Family', () => {
|
|
|
1373
1347
|
}))
|
|
1374
1348
|
|
|
1375
1349
|
const response = await ETHERSCAN_API.getInternalOperations({
|
|
1376
|
-
currencyId: currencyId,
|
|
1377
1350
|
config,
|
|
1378
1351
|
address: address,
|
|
1379
1352
|
fromBlock: 0,
|
|
@@ -1428,7 +1401,6 @@ describe('EVM Family', () => {
|
|
|
1428
1401
|
}))
|
|
1429
1402
|
|
|
1430
1403
|
const response = await ETHERSCAN_API.getInternalOperations({
|
|
1431
|
-
currencyId: currencyId,
|
|
1432
1404
|
config,
|
|
1433
1405
|
address: address,
|
|
1434
1406
|
fromBlock: 50,
|
|
@@ -1483,7 +1455,6 @@ describe('EVM Family', () => {
|
|
|
1483
1455
|
}))
|
|
1484
1456
|
|
|
1485
1457
|
const response = await ETHERSCAN_API.getInternalOperations({
|
|
1486
|
-
currencyId: currencyId,
|
|
1487
1458
|
config,
|
|
1488
1459
|
address: address,
|
|
1489
1460
|
fromBlock: 50,
|
|
@@ -1545,7 +1516,6 @@ describe('EVM Family', () => {
|
|
|
1545
1516
|
}))
|
|
1546
1517
|
|
|
1547
1518
|
const response = await ETHERSCAN_API.getInternalOperations({
|
|
1548
|
-
currencyId: currencyId,
|
|
1549
1519
|
config,
|
|
1550
1520
|
address: address,
|
|
1551
1521
|
fromBlock: 0,
|
|
@@ -1585,7 +1555,6 @@ describe('EVM Family', () => {
|
|
|
1585
1555
|
})
|
|
1586
1556
|
|
|
1587
1557
|
const response = await ETHERSCAN_API.getInternalOperations({
|
|
1588
|
-
currencyId: currencyId,
|
|
1589
1558
|
config,
|
|
1590
1559
|
address: address,
|
|
1591
1560
|
fromBlock: 0,
|
|
@@ -1879,7 +1848,6 @@ describe('EVM Family', () => {
|
|
|
1879
1848
|
|
|
1880
1849
|
it('should not return NFT operation', async () => {
|
|
1881
1850
|
const response = await ETHERSCAN_API.getNftOperations({
|
|
1882
|
-
currencyId: currencyId,
|
|
1883
1851
|
config,
|
|
1884
1852
|
address: address,
|
|
1885
1853
|
fromBlock: 0,
|
|
@@ -1917,7 +1885,6 @@ describe('EVM Family', () => {
|
|
|
1917
1885
|
// Drop call history from previous tests so `requestedUrls` reflects only this invocation.
|
|
1918
1886
|
requestSpy.mockClear()
|
|
1919
1887
|
const response = await ETHERSCAN_API.getNftOperations({
|
|
1920
|
-
currencyId,
|
|
1921
1888
|
config,
|
|
1922
1889
|
address: '0x6cBCD73CD8e8a42844662f0A0e76D7F79Afd933d',
|
|
1923
1890
|
fromBlock: 0,
|
|
@@ -2006,7 +1973,6 @@ describe('EVM Family', () => {
|
|
|
2006
1973
|
ETHERSCAN_API.getOperations.force(
|
|
2007
1974
|
config,
|
|
2008
1975
|
testLogger,
|
|
2009
|
-
currencyId,
|
|
2010
1976
|
address,
|
|
2011
1977
|
0,
|
|
2012
1978
|
undefined,
|
|
@@ -2185,7 +2151,6 @@ describe('EVM Family', () => {
|
|
|
2185
2151
|
return ETHERSCAN_API.getOperations.force(
|
|
2186
2152
|
config,
|
|
2187
2153
|
testLogger,
|
|
2188
|
-
currencyId,
|
|
2189
2154
|
address,
|
|
2190
2155
|
fromBlock,
|
|
2191
2156
|
toBlock,
|
|
@@ -3060,7 +3025,6 @@ describe('EVM Family', () => {
|
|
|
3060
3025
|
const result = await ETHERSCAN_API.exhaustEndpoint(
|
|
3061
3026
|
mockFetch,
|
|
3062
3027
|
{
|
|
3063
|
-
currencyId,
|
|
3064
3028
|
config,
|
|
3065
3029
|
address,
|
|
3066
3030
|
fromBlock: 0,
|
|
@@ -3095,7 +3059,6 @@ describe('EVM Family', () => {
|
|
|
3095
3059
|
const result = await ETHERSCAN_API.exhaustEndpoint(
|
|
3096
3060
|
mockFetch,
|
|
3097
3061
|
{
|
|
3098
|
-
currencyId,
|
|
3099
3062
|
config,
|
|
3100
3063
|
address,
|
|
3101
3064
|
fromBlock: 0,
|
|
@@ -3119,7 +3082,6 @@ describe('EVM Family', () => {
|
|
|
3119
3082
|
const result = await ETHERSCAN_API.exhaustEndpoint(
|
|
3120
3083
|
mockFetch,
|
|
3121
3084
|
{
|
|
3122
|
-
currencyId,
|
|
3123
3085
|
config,
|
|
3124
3086
|
address,
|
|
3125
3087
|
fromBlock: 0,
|
|
@@ -3142,7 +3104,6 @@ describe('EVM Family', () => {
|
|
|
3142
3104
|
await ETHERSCAN_API.exhaustEndpoint(
|
|
3143
3105
|
mockFetch,
|
|
3144
3106
|
{
|
|
3145
|
-
currencyId,
|
|
3146
3107
|
config,
|
|
3147
3108
|
address,
|
|
3148
3109
|
fromBlock: 0,
|
|
@@ -3164,7 +3125,6 @@ describe('EVM Family', () => {
|
|
|
3164
3125
|
await ETHERSCAN_API.exhaustEndpoint(
|
|
3165
3126
|
mockFetch,
|
|
3166
3127
|
{
|
|
3167
|
-
currencyId,
|
|
3168
3128
|
config: createMockEvmConfigInfo({
|
|
3169
3129
|
chainId: 1,
|
|
3170
3130
|
node: mkExternalNode(),
|
|
@@ -3190,7 +3150,6 @@ describe('EVM Family', () => {
|
|
|
3190
3150
|
await ETHERSCAN_API.exhaustEndpoint(
|
|
3191
3151
|
mockFetch,
|
|
3192
3152
|
{
|
|
3193
|
-
currencyId,
|
|
3194
3153
|
config,
|
|
3195
3154
|
address,
|
|
3196
3155
|
fromBlock: 0,
|
|
@@ -3222,7 +3181,6 @@ describe('EVM Family', () => {
|
|
|
3222
3181
|
await ETHERSCAN_API.exhaustEndpoint(
|
|
3223
3182
|
mockFetch,
|
|
3224
3183
|
{
|
|
3225
|
-
currencyId: currencyId,
|
|
3226
3184
|
config,
|
|
3227
3185
|
address: address,
|
|
3228
3186
|
fromBlock: 0,
|
|
@@ -3302,7 +3260,6 @@ describe('EVM Family', () => {
|
|
|
3302
3260
|
const result = await ETHERSCAN_API.exhaustEndpoint(
|
|
3303
3261
|
mockFetch,
|
|
3304
3262
|
{
|
|
3305
|
-
currencyId: currencyId,
|
|
3306
3263
|
config,
|
|
3307
3264
|
address: address,
|
|
3308
3265
|
fromBlock: 0,
|
|
@@ -3332,13 +3289,7 @@ describe('EVM Family', () => {
|
|
|
3332
3289
|
data: { result: etherscanTokenOperations },
|
|
3333
3290
|
}))
|
|
3334
3291
|
|
|
3335
|
-
const assets = await ETHERSCAN_API.discoverTokenAssets.force(
|
|
3336
|
-
config,
|
|
3337
|
-
testLogger,
|
|
3338
|
-
currencyId,
|
|
3339
|
-
address,
|
|
3340
|
-
0
|
|
3341
|
-
)
|
|
3292
|
+
const assets = await ETHERSCAN_API.discoverTokenAssets.force(config, testLogger, address, 0)
|
|
3342
3293
|
|
|
3343
3294
|
const expectedOperations = [
|
|
3344
3295
|
etherscanERC20EventToOperations(address, etherscanTokenOperations[0], 0, testLogger),
|
|
@@ -3371,7 +3322,7 @@ describe('EVM Family', () => {
|
|
|
3371
3322
|
data: { result: etherscanTokenOperations },
|
|
3372
3323
|
}))
|
|
3373
3324
|
|
|
3374
|
-
await ETHERSCAN_API.discoverTokenAssets.force(config, testLogger,
|
|
3325
|
+
await ETHERSCAN_API.discoverTokenAssets.force(config, testLogger, address, 0)
|
|
3375
3326
|
|
|
3376
3327
|
expect(requestSpy).toHaveBeenCalledTimes(1)
|
|
3377
3328
|
expect(requestSpy).toHaveBeenCalledWith(
|
|
@@ -3384,12 +3335,12 @@ describe('EVM Family', () => {
|
|
|
3384
3335
|
data: { result: etherscanTokenOperations },
|
|
3385
3336
|
}))
|
|
3386
3337
|
|
|
3387
|
-
await ETHERSCAN_API.discoverTokenAssets(config, testLogger,
|
|
3388
|
-
await ETHERSCAN_API.discoverTokenAssets(config, testLogger,
|
|
3338
|
+
await ETHERSCAN_API.discoverTokenAssets(config, testLogger, address, 999)
|
|
3339
|
+
await ETHERSCAN_API.discoverTokenAssets(config, testLogger, address, 999)
|
|
3389
3340
|
|
|
3390
3341
|
expect(requestSpy).toHaveBeenCalledTimes(1)
|
|
3391
3342
|
|
|
3392
|
-
await ETHERSCAN_API.discoverTokenAssets.force(config, testLogger,
|
|
3343
|
+
await ETHERSCAN_API.discoverTokenAssets.force(config, testLogger, address, 999)
|
|
3393
3344
|
|
|
3394
3345
|
expect(requestSpy).toHaveBeenCalledTimes(2)
|
|
3395
3346
|
})
|
|
@@ -71,7 +71,6 @@ function getMaxBoundaryExhaustionPages(config: EvmConfigInfo): number {
|
|
|
71
71
|
* Common parameters for fetching operations from an endpoint
|
|
72
72
|
*/
|
|
73
73
|
export type FetchOperationsParams = {
|
|
74
|
-
currencyId: string
|
|
75
74
|
config: EvmConfigInfo
|
|
76
75
|
// Instance-scoped logger threaded from the caller's context (set by `getOperations`).
|
|
77
76
|
logger: Logger
|
|
@@ -308,7 +307,7 @@ export const getCoinOperations = async (params: FetchOperationsParams): Promise<
|
|
|
308
307
|
const ops = Array.isArray(raw) ? raw : []
|
|
309
308
|
|
|
310
309
|
const operations = ops.flatMap((tx) =>
|
|
311
|
-
etherscanOperationToOperations(params.address, params.
|
|
310
|
+
etherscanOperationToOperations(params.address, params.config.chainId, tx, params.logger)
|
|
312
311
|
)
|
|
313
312
|
|
|
314
313
|
// Recover REWARD op amounts (claim/compound) from receipt logs — these txs send 0 native
|
|
@@ -321,10 +320,9 @@ export const getCoinOperations = async (params: FetchOperationsParams): Promise<
|
|
|
321
320
|
try {
|
|
322
321
|
await withApi(
|
|
323
322
|
params.config,
|
|
324
|
-
params.currencyId,
|
|
325
323
|
(api) =>
|
|
326
324
|
enrichRewardOperationsValue(
|
|
327
|
-
params.
|
|
325
|
+
params.config.chainId,
|
|
328
326
|
operations,
|
|
329
327
|
(hash) => api.getTransactionReceipt(hash),
|
|
330
328
|
params.logger
|
|
@@ -783,7 +781,6 @@ export const getOperations = makeLRUCache<
|
|
|
783
781
|
[
|
|
784
782
|
config: EvmConfigInfo,
|
|
785
783
|
logger: Logger,
|
|
786
|
-
currencyId: string,
|
|
787
784
|
address: string,
|
|
788
785
|
fromBlock: number,
|
|
789
786
|
toBlock: number | undefined,
|
|
@@ -799,17 +796,7 @@ export const getOperations = makeLRUCache<
|
|
|
799
796
|
nextPagingToken: string
|
|
800
797
|
}
|
|
801
798
|
>(
|
|
802
|
-
async (
|
|
803
|
-
config,
|
|
804
|
-
logger,
|
|
805
|
-
currencyId,
|
|
806
|
-
address,
|
|
807
|
-
fromBlock,
|
|
808
|
-
toBlock,
|
|
809
|
-
pagingToken,
|
|
810
|
-
limit,
|
|
811
|
-
order = 'desc'
|
|
812
|
-
) => {
|
|
799
|
+
async (config, logger, address, fromBlock, toBlock, pagingToken, limit, order = 'desc') => {
|
|
813
800
|
try {
|
|
814
801
|
const configuredMaxLimit = getConfiguredMaxLimit(config)
|
|
815
802
|
const effectiveLimit =
|
|
@@ -823,7 +810,6 @@ export const getOperations = makeLRUCache<
|
|
|
823
810
|
const cmp = createBlockComparator(order)
|
|
824
811
|
|
|
825
812
|
const baseParams: FetchOperationsParams = {
|
|
826
|
-
currencyId,
|
|
827
813
|
config,
|
|
828
814
|
address,
|
|
829
815
|
fromBlock,
|
|
@@ -967,8 +953,8 @@ export const getOperations = makeLRUCache<
|
|
|
967
953
|
)
|
|
968
954
|
}
|
|
969
955
|
},
|
|
970
|
-
(
|
|
971
|
-
`${
|
|
956
|
+
(config, _logger, address, fromBlock, toBlock, pagingToken, limit, order) =>
|
|
957
|
+
`${config.chainId}:${address}:${fromBlock}:${toBlock ?? ''}:${pagingToken ?? ''}:${limit ?? ''}:${order ?? 'desc'}`,
|
|
972
958
|
{ ttl: ETHERSCAN_TIMEOUT }
|
|
973
959
|
)
|
|
974
960
|
|
|
@@ -983,12 +969,11 @@ export const getOperations = makeLRUCache<
|
|
|
983
969
|
* and NFT endpoints, which this arm never needed to discover tokens.
|
|
984
970
|
*/
|
|
985
971
|
export const discoverTokenAssets = makeLRUCache<
|
|
986
|
-
[config: EvmConfigInfo, logger: Logger,
|
|
972
|
+
[config: EvmConfigInfo, logger: Logger, address: string, fromBlock?: number],
|
|
987
973
|
AssetInfo[]
|
|
988
974
|
>(
|
|
989
|
-
async (config, logger,
|
|
975
|
+
async (config, logger, address, fromBlock = 0) => {
|
|
990
976
|
const { operations } = await getTokenOperations({
|
|
991
|
-
currencyId,
|
|
992
977
|
config,
|
|
993
978
|
address,
|
|
994
979
|
fromBlock,
|
|
@@ -1004,8 +989,7 @@ export const discoverTokenAssets = makeLRUCache<
|
|
|
1004
989
|
|
|
1005
990
|
return Array.from(assets.values())
|
|
1006
991
|
},
|
|
1007
|
-
(
|
|
1008
|
-
`${currencyId}:${address}:${fromBlock ?? 0}`,
|
|
992
|
+
(config, _logger, address, fromBlock) => `${config.chainId}:${address}:${fromBlock ?? 0}`,
|
|
1009
993
|
{ ttl: ETHERSCAN_TIMEOUT }
|
|
1010
994
|
)
|
|
1011
995
|
|
|
@@ -119,7 +119,7 @@ describe('EVM Family', () => {
|
|
|
119
119
|
const explorer = getExplorerApi(configFor('none-coin'))
|
|
120
120
|
|
|
121
121
|
await expect(
|
|
122
|
-
explorer.discoverTokenAssets(configFor('none-coin'), testLogger, '
|
|
122
|
+
explorer.discoverTokenAssets(configFor('none-coin'), testLogger, '0xaddress')
|
|
123
123
|
).resolves.toEqual([])
|
|
124
124
|
})
|
|
125
125
|
})
|