@ledgerhq/coin-evm 10.1.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/CHANGELOG.md +42 -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 +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.js +1 -1
- 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/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 +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 +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 +1 -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.js +12 -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 +31 -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 +50 -39
- package/lib/network/node/rpc.common.js.map +1 -1
- package/lib/network/node/types.d.ts +15 -15
- 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 +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.js +1 -1
- 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/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 +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 +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 +1 -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.js +12 -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 +31 -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 +50 -39
- package/lib-es/network/node/rpc.common.js.map +1 -1
- package/lib-es/network/node/types.d.ts +15 -15
- 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 +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 +1 -1
- 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/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 +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 +6 -8
- package/src/logic/lastBlock.ts +2 -2
- package/src/logic/listOperations.ts +0 -1
- 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 +12 -2
- 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 +23 -131
- package/src/network/explorer/ledger.ts +2 -5
- package/src/network/explorer/types.ts +0 -2
- package/src/network/node/explorerProxy.test.ts +17 -22
- package/src/network/node/explorerProxy.ts +12 -12
- 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 +31 -34
- package/src/network/node/rpc.common.ts +58 -86
- package/src/network/node/rpc.test.ts +86 -114
- package/src/network/node/types.ts +11 -29
- package/src/network/node/withNodeSources.test.ts +7 -9
- package/src/network/node/withNodeSources.ts +23 -26
- 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
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: © 2026 LEDGER SAS
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
+
import { CHAIN_ID } from '../../config'
|
|
4
5
|
import {
|
|
5
6
|
createMockEvmConfigInfo,
|
|
6
7
|
mkExternalNode,
|
|
@@ -9,30 +10,38 @@ import {
|
|
|
9
10
|
import { getNodeApi } from './index'
|
|
10
11
|
|
|
11
12
|
describe('getNodeApi memoization', () => {
|
|
12
|
-
it('should return the same NodeApi instance for same
|
|
13
|
-
const config = createMockEvmConfigInfo({
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
)
|
|
13
|
+
it('should return the same NodeApi instance for same chain and retries (memoization)', () => {
|
|
14
|
+
const config = createMockEvmConfigInfo({
|
|
15
|
+
chainId: CHAIN_ID.ETHEREUM,
|
|
16
|
+
node: mkExternalNode(),
|
|
17
|
+
})
|
|
18
|
+
expect(getNodeApi(config, testLogger)).toBe(getNodeApi(config, testLogger))
|
|
17
19
|
})
|
|
18
20
|
|
|
19
21
|
it('should return cached NodeApi on subsequent calls (createNodeApi called once)', () => {
|
|
20
|
-
const config = createMockEvmConfigInfo({
|
|
21
|
-
|
|
22
|
+
const config = createMockEvmConfigInfo({
|
|
23
|
+
chainId: CHAIN_ID.ETHEREUM,
|
|
24
|
+
node: mkExternalNode(),
|
|
25
|
+
})
|
|
26
|
+
const cachedInstance = getNodeApi(config, testLogger)
|
|
22
27
|
|
|
23
|
-
expect(getNodeApi(config,
|
|
24
|
-
expect(getNodeApi(config,
|
|
28
|
+
expect(getNodeApi(config, testLogger)).toBe(cachedInstance)
|
|
29
|
+
expect(getNodeApi(config, testLogger)).toBe(cachedInstance)
|
|
25
30
|
})
|
|
26
31
|
|
|
27
32
|
it('should return different NodeApi instances for different retries', () => {
|
|
28
33
|
const node1 = getNodeApi(
|
|
29
|
-
createMockEvmConfigInfo({
|
|
30
|
-
|
|
34
|
+
createMockEvmConfigInfo({
|
|
35
|
+
chainId: CHAIN_ID.ETHEREUM,
|
|
36
|
+
node: mkExternalNode({ uri: 'u', retries: 2 }),
|
|
37
|
+
}),
|
|
31
38
|
testLogger
|
|
32
39
|
)
|
|
33
40
|
const node2 = getNodeApi(
|
|
34
|
-
createMockEvmConfigInfo({
|
|
35
|
-
|
|
41
|
+
createMockEvmConfigInfo({
|
|
42
|
+
chainId: CHAIN_ID.ETHEREUM,
|
|
43
|
+
node: mkExternalNode({ uri: 'u', retries: 5 }),
|
|
44
|
+
}),
|
|
36
45
|
testLogger
|
|
37
46
|
)
|
|
38
47
|
expect(node1).not.toBe(node2)
|
|
@@ -40,24 +49,22 @@ describe('getNodeApi memoization', () => {
|
|
|
40
49
|
|
|
41
50
|
it('should return different NodeApi instances for different uris', () => {
|
|
42
51
|
const node1 = getNodeApi(
|
|
43
|
-
createMockEvmConfigInfo({ chainId:
|
|
44
|
-
'ethereum',
|
|
52
|
+
createMockEvmConfigInfo({ chainId: CHAIN_ID.ETHEREUM, node: mkExternalNode({ uri: 'u1' }) }),
|
|
45
53
|
testLogger
|
|
46
54
|
)
|
|
47
55
|
const node2 = getNodeApi(
|
|
48
|
-
createMockEvmConfigInfo({ chainId:
|
|
49
|
-
'ethereum',
|
|
56
|
+
createMockEvmConfigInfo({ chainId: CHAIN_ID.ETHEREUM, node: mkExternalNode({ uri: 'u2' }) }),
|
|
50
57
|
testLogger
|
|
51
58
|
)
|
|
52
59
|
|
|
53
60
|
expect(node1).not.toBe(node2)
|
|
54
61
|
})
|
|
55
62
|
|
|
56
|
-
it('should return different NodeApi instances for different
|
|
57
|
-
const
|
|
63
|
+
it('should return different NodeApi instances for different chains sharing a node', () => {
|
|
64
|
+
const node = mkExternalNode({ uri: 'u1' })
|
|
65
|
+
const ethereum = createMockEvmConfigInfo({ chainId: CHAIN_ID.ETHEREUM, node })
|
|
66
|
+
const bsc = createMockEvmConfigInfo({ chainId: CHAIN_ID.BSC, node })
|
|
58
67
|
|
|
59
|
-
expect(getNodeApi(
|
|
60
|
-
getNodeApi(conf, 'ethereum2', testLogger)
|
|
61
|
-
)
|
|
68
|
+
expect(getNodeApi(ethereum, testLogger)).not.toBe(getNodeApi(bsc, testLogger))
|
|
62
69
|
})
|
|
63
70
|
})
|
|
@@ -16,13 +16,12 @@ describe('EVM Family', () => {
|
|
|
16
16
|
it('should throw when requesting a non existing node type', () => {
|
|
17
17
|
const config = createMockEvmConfigInfo({ chainId: 1, node: mkExternalNode() })
|
|
18
18
|
Object.assign(config, { node: { type: 'anything', uri: 'notworking' } })
|
|
19
|
-
expect(() => getNodeApi(config,
|
|
19
|
+
expect(() => getNodeApi(config, testLogger)).toThrow(UnknownNode)
|
|
20
20
|
})
|
|
21
21
|
|
|
22
22
|
it('should return the rpc api', () => {
|
|
23
23
|
const node = getNodeApi(
|
|
24
24
|
createMockEvmConfigInfo({ chainId: 1, node: mkExternalNode({ uri: 'working' }) }),
|
|
25
|
-
'external',
|
|
26
25
|
testLogger
|
|
27
26
|
)
|
|
28
27
|
|
|
@@ -44,7 +43,6 @@ describe('EVM Family', () => {
|
|
|
44
43
|
it('should return the ledger api', () => {
|
|
45
44
|
const node = getNodeApi(
|
|
46
45
|
createMockEvmConfigInfo({ chainId: 1, node: mkLedgerNode({ explorerId: 'eth' }) }),
|
|
47
|
-
'ledger-supported',
|
|
48
46
|
testLogger
|
|
49
47
|
)
|
|
50
48
|
|
|
@@ -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)
|
|
@@ -5,7 +5,7 @@ import { delay } from '@ledgerhq/coin-module-framework/promises'
|
|
|
5
5
|
import axios from 'axios'
|
|
6
6
|
import BigNumber from 'bignumber.js'
|
|
7
7
|
import { Transaction } from 'ethers'
|
|
8
|
-
import { DEFAULT_LEDGER_EXPLORER_URI } from '../../config'
|
|
8
|
+
import { CHAIN_ID, DEFAULT_LEDGER_EXPLORER_URI } from '../../config'
|
|
9
9
|
import { GasEstimationError } from '../../errors'
|
|
10
10
|
import { createMockEvmConfigInfo, testLogger } from '../../fixtures/context.fixtures'
|
|
11
11
|
import { getGasOptions } from '../gasTracker/ledger'
|
|
@@ -25,10 +25,10 @@ jest.mocked(delay).mockImplementation(
|
|
|
25
25
|
() => new Promise((resolve) => setTimeout(resolve, 1)) // mocking the delay supposed to happen after each try
|
|
26
26
|
)
|
|
27
27
|
|
|
28
|
-
const currencyId = 'ethereum'
|
|
29
28
|
const address = '0x6cBCD73CD8e8a42844662f0A0e76D7F79Afd933d'
|
|
30
29
|
|
|
31
30
|
const ledgerConfig = {
|
|
31
|
+
chainId: CHAIN_ID.ETHEREUM,
|
|
32
32
|
type: 'ledger' as const,
|
|
33
33
|
explorerId: 'eth' as const,
|
|
34
34
|
retries: 2,
|
|
@@ -60,7 +60,7 @@ describe('EVM Family', () => {
|
|
|
60
60
|
],
|
|
61
61
|
}))
|
|
62
62
|
|
|
63
|
-
const result = await api.call(
|
|
63
|
+
const result = await api.call({ to: USDC, data: DECIMALS_SELECTOR })
|
|
64
64
|
|
|
65
65
|
expect(result).toEqual(DECIMALS_RESPONSE)
|
|
66
66
|
expect(spy).toHaveBeenCalledWith(
|
|
@@ -83,7 +83,7 @@ describe('EVM Family', () => {
|
|
|
83
83
|
],
|
|
84
84
|
}))
|
|
85
85
|
|
|
86
|
-
await api.call(
|
|
86
|
+
await api.call({ to: USDC, data: DECIMALS_SELECTOR, block: 123 })
|
|
87
87
|
|
|
88
88
|
expect(spy).toHaveBeenCalledWith(
|
|
89
89
|
expect.objectContaining({
|
|
@@ -103,7 +103,7 @@ describe('EVM Family', () => {
|
|
|
103
103
|
],
|
|
104
104
|
}))
|
|
105
105
|
|
|
106
|
-
await expect(api.call(
|
|
106
|
+
await expect(api.call({ to: USDC, data: DECIMALS_SELECTOR })).rejects.toThrow(
|
|
107
107
|
'EVM call failed'
|
|
108
108
|
)
|
|
109
109
|
})
|
|
@@ -133,7 +133,7 @@ describe('EVM Family', () => {
|
|
|
133
133
|
},
|
|
134
134
|
}
|
|
135
135
|
})
|
|
136
|
-
const response = await api.getTransaction(
|
|
136
|
+
const response = await api.getTransaction('0xHash')
|
|
137
137
|
expect(response.hash).toEqual('0xabc')
|
|
138
138
|
expect(spy).toHaveBeenCalledTimes(3)
|
|
139
139
|
})
|
|
@@ -149,7 +149,7 @@ describe('EVM Family', () => {
|
|
|
149
149
|
}
|
|
150
150
|
return { data: {} }
|
|
151
151
|
})
|
|
152
|
-
await expect(api.getTransaction(
|
|
152
|
+
await expect(api.getTransaction('0xHash')).rejects.toBeInstanceOf(SpyError)
|
|
153
153
|
})
|
|
154
154
|
})
|
|
155
155
|
|
|
@@ -201,7 +201,7 @@ describe('EVM Family', () => {
|
|
|
201
201
|
},
|
|
202
202
|
}))
|
|
203
203
|
|
|
204
|
-
const response = await api.getTransaction(
|
|
204
|
+
const response = await api.getTransaction('0xHash')
|
|
205
205
|
expect(response).toEqual({
|
|
206
206
|
gasPrice: '83953611012',
|
|
207
207
|
gasUsed: '21000',
|
|
@@ -244,7 +244,7 @@ describe('EVM Family', () => {
|
|
|
244
244
|
data: { balance: '6969' },
|
|
245
245
|
}))
|
|
246
246
|
|
|
247
|
-
expect(await api.getCoinBalance(
|
|
247
|
+
expect(await api.getCoinBalance('0xkvn')).toEqual(new BigNumber('6969'))
|
|
248
248
|
})
|
|
249
249
|
})
|
|
250
250
|
|
|
@@ -258,9 +258,7 @@ describe('EVM Family', () => {
|
|
|
258
258
|
],
|
|
259
259
|
}))
|
|
260
260
|
|
|
261
|
-
expect(await api.getTokenBalance(
|
|
262
|
-
new BigNumber('6969')
|
|
263
|
-
)
|
|
261
|
+
expect(await api.getTokenBalance('0xusdc', '0xkvn')).toEqual(new BigNumber('6969'))
|
|
264
262
|
})
|
|
265
263
|
})
|
|
266
264
|
|
|
@@ -271,7 +269,7 @@ describe('EVM Family', () => {
|
|
|
271
269
|
data: { address: '0xkvn', nonce: 123 },
|
|
272
270
|
}))
|
|
273
271
|
|
|
274
|
-
expect(await api.getTransactionCount(
|
|
272
|
+
expect(await api.getTransactionCount('0xkvn')).toEqual(123)
|
|
275
273
|
})
|
|
276
274
|
})
|
|
277
275
|
|
|
@@ -283,7 +281,7 @@ describe('EVM Family', () => {
|
|
|
283
281
|
})
|
|
284
282
|
|
|
285
283
|
await expect(
|
|
286
|
-
api.getGasEstimation(
|
|
284
|
+
api.getGasEstimation(address, { amount: new BigNumber(0), recipient: '0x0' })
|
|
287
285
|
).rejects.toBeInstanceOf(GasEstimationError)
|
|
288
286
|
})
|
|
289
287
|
|
|
@@ -294,7 +292,7 @@ describe('EVM Family', () => {
|
|
|
294
292
|
.mockImplementation(() => Promise.reject({ code: 'ECONNABORTED' }))
|
|
295
293
|
|
|
296
294
|
await expect(
|
|
297
|
-
api.getGasEstimation(
|
|
295
|
+
api.getGasEstimation(address, { amount: new BigNumber(0), recipient: '0x0' })
|
|
298
296
|
).rejects.toBeInstanceOf(GasEstimationError)
|
|
299
297
|
})
|
|
300
298
|
|
|
@@ -321,10 +319,8 @@ describe('EVM Family', () => {
|
|
|
321
319
|
data: Buffer.from('ffff', 'hex'),
|
|
322
320
|
}
|
|
323
321
|
|
|
324
|
-
expect(await api.getGasEstimation(
|
|
325
|
-
|
|
326
|
-
)
|
|
327
|
-
expect(await api.getGasEstimation(currencyId, address, transactionWithData)).toEqual(
|
|
322
|
+
expect(await api.getGasEstimation(address, transaction)).toEqual(new BigNumber(789))
|
|
323
|
+
expect(await api.getGasEstimation(address, transactionWithData)).toEqual(
|
|
328
324
|
new BigNumber(1_000_000)
|
|
329
325
|
)
|
|
330
326
|
})
|
|
@@ -356,7 +352,6 @@ describe('EVM Family', () => {
|
|
|
356
352
|
|
|
357
353
|
const slowFeeData = await api.getFeeData(
|
|
358
354
|
createMockEvmConfigInfo({ chainId: 1, node: ledgerConfig }),
|
|
359
|
-
currencyId,
|
|
360
355
|
{
|
|
361
356
|
type: 2,
|
|
362
357
|
feesStrategy: 'slow',
|
|
@@ -364,7 +359,6 @@ describe('EVM Family', () => {
|
|
|
364
359
|
)
|
|
365
360
|
const mediumFeeData = await api.getFeeData(
|
|
366
361
|
createMockEvmConfigInfo({ chainId: 1, node: ledgerConfig }),
|
|
367
|
-
currencyId,
|
|
368
362
|
{
|
|
369
363
|
type: 2,
|
|
370
364
|
feesStrategy: 'medium',
|
|
@@ -372,7 +366,6 @@ describe('EVM Family', () => {
|
|
|
372
366
|
)
|
|
373
367
|
const fastFeeData = await api.getFeeData(
|
|
374
368
|
createMockEvmConfigInfo({ chainId: 1, node: ledgerConfig }),
|
|
375
|
-
currencyId,
|
|
376
369
|
{
|
|
377
370
|
type: 2,
|
|
378
371
|
feesStrategy: 'fast',
|
|
@@ -424,7 +417,6 @@ describe('EVM Family', () => {
|
|
|
424
417
|
|
|
425
418
|
const feeData = await api.getFeeData(
|
|
426
419
|
createMockEvmConfigInfo({ chainId: 1, node: ledgerConfig }),
|
|
427
|
-
currencyId,
|
|
428
420
|
{ type: 2 }
|
|
429
421
|
)
|
|
430
422
|
|
|
@@ -446,7 +438,7 @@ describe('EVM Family', () => {
|
|
|
446
438
|
},
|
|
447
439
|
}))
|
|
448
440
|
|
|
449
|
-
expect(await api.broadcastTransaction(
|
|
441
|
+
expect(await api.broadcastTransaction('0xSigneTx')).toEqual('0xHash')
|
|
450
442
|
})
|
|
451
443
|
|
|
452
444
|
it('should include mevProtected=true in the request parameters when specified', async () => {
|
|
@@ -457,7 +449,7 @@ describe('EVM Family', () => {
|
|
|
457
449
|
},
|
|
458
450
|
}))
|
|
459
451
|
|
|
460
|
-
await api.broadcastTransaction(
|
|
452
|
+
await api.broadcastTransaction('0xSignedTx', { mevProtected: true })
|
|
461
453
|
|
|
462
454
|
expect(mockRequest).toHaveBeenCalledWith(
|
|
463
455
|
expect.objectContaining({
|
|
@@ -478,7 +470,7 @@ describe('EVM Family', () => {
|
|
|
478
470
|
},
|
|
479
471
|
}))
|
|
480
472
|
|
|
481
|
-
await api.broadcastTransaction(
|
|
473
|
+
await api.broadcastTransaction('0xSignedTx', {
|
|
482
474
|
mevProtected: false,
|
|
483
475
|
source: { type: 'live-app', name: 'test-manifest-id' },
|
|
484
476
|
})
|
|
@@ -503,7 +495,7 @@ describe('EVM Family', () => {
|
|
|
503
495
|
},
|
|
504
496
|
}))
|
|
505
497
|
|
|
506
|
-
await api.broadcastTransaction(
|
|
498
|
+
await api.broadcastTransaction('0xSignedTx', { mevProtected: false })
|
|
507
499
|
|
|
508
500
|
// ledgerConfig sets no clientVersion, so `{}` proves no source header was added.
|
|
509
501
|
expect(mockRequest).toHaveBeenCalledWith(
|
|
@@ -544,14 +536,14 @@ describe('EVM Family', () => {
|
|
|
544
536
|
}
|
|
545
537
|
})
|
|
546
538
|
|
|
547
|
-
expect(await api.getBlockByHeight(
|
|
539
|
+
expect(await api.getBlockByHeight(12)).toEqual({
|
|
548
540
|
hash: '0xhash',
|
|
549
541
|
height: 123,
|
|
550
542
|
timestamp: Date.now(),
|
|
551
543
|
parentHash: '0xparentHash',
|
|
552
544
|
transactionHashes: ['0xTx1', '0xTx2'],
|
|
553
545
|
})
|
|
554
|
-
expect(await api.getBlockByHeight(
|
|
546
|
+
expect(await api.getBlockByHeight('latest')).toEqual({
|
|
555
547
|
hash: '0xhashLatest',
|
|
556
548
|
height: 456,
|
|
557
549
|
timestamp: Date.now(),
|
|
@@ -564,11 +556,11 @@ describe('EVM Family', () => {
|
|
|
564
556
|
describe('getOptimismAdditionalFees', () => {
|
|
565
557
|
it('should return 0 for an incompatible currency', async () => {
|
|
566
558
|
const api = createLedgerNodeApi(ledgerConfig, testLogger)
|
|
567
|
-
expect(await api.getOptimismAdditionalFees(
|
|
559
|
+
expect(await api.getOptimismAdditionalFees('')).toEqual(new BigNumber(0))
|
|
568
560
|
})
|
|
569
561
|
|
|
570
562
|
it('should return the expected payload', async () => {
|
|
571
|
-
const api = createLedgerNodeApi(ledgerConfig, testLogger)
|
|
563
|
+
const api = createLedgerNodeApi({ ...ledgerConfig, chainId: CHAIN_ID.OPTIMISM }, testLogger)
|
|
572
564
|
jest.spyOn(axios, 'request').mockImplementationOnce(async () => ({
|
|
573
565
|
data: [
|
|
574
566
|
{
|
|
@@ -597,58 +589,60 @@ describe('EVM Family', () => {
|
|
|
597
589
|
},
|
|
598
590
|
})
|
|
599
591
|
|
|
600
|
-
expect(await api.getOptimismAdditionalFees(
|
|
592
|
+
expect(await api.getOptimismAdditionalFees(transaction.serialized)).toEqual(
|
|
601
593
|
new BigNumber('100000000')
|
|
602
594
|
)
|
|
603
595
|
})
|
|
604
596
|
|
|
605
|
-
it.each([
|
|
606
|
-
'
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
597
|
+
it.each([
|
|
598
|
+
['blast', CHAIN_ID.BLAST],
|
|
599
|
+
['blast_sepolia', CHAIN_ID.BLAST_SEPOLIA],
|
|
600
|
+
['base', CHAIN_ID.BASE],
|
|
601
|
+
['base_sepolia', CHAIN_ID.BASE_SEPOLIA],
|
|
602
|
+
])('should query the OP-stack gas oracle for %s (not return 0)', async (_name, chainId) => {
|
|
603
|
+
const api = createLedgerNodeApi({ ...ledgerConfig, chainId }, testLogger)
|
|
604
|
+
jest.spyOn(axios, 'request').mockImplementationOnce(async () => ({
|
|
605
|
+
data: [
|
|
606
|
+
{
|
|
607
|
+
info: {
|
|
608
|
+
contract: '0x420000000000000000000000000000000000000F',
|
|
609
|
+
data: '0xSerializedTransaction',
|
|
610
|
+
blockNumber: 123,
|
|
618
611
|
},
|
|
619
|
-
|
|
620
|
-
}))
|
|
621
|
-
|
|
622
|
-
const transaction = Transaction.from({
|
|
623
|
-
to: '0x6cBCD73CD8e8a42844662f0A0e76D7F79Afd933d',
|
|
624
|
-
value: 1n,
|
|
625
|
-
gasLimit: 2n,
|
|
626
|
-
chainId: 1,
|
|
627
|
-
nonce: 0,
|
|
628
|
-
gasPrice: 3n,
|
|
629
|
-
type: 0,
|
|
630
|
-
signature: {
|
|
631
|
-
r: '0xffffffffffffffffffffffffffffffffffffffff',
|
|
632
|
-
s: '0xffffffffffffffffffffffffffffffffffffffff',
|
|
633
|
-
v: 27,
|
|
612
|
+
response: '100000000',
|
|
634
613
|
},
|
|
635
|
-
|
|
614
|
+
],
|
|
615
|
+
}))
|
|
636
616
|
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
617
|
+
const transaction = Transaction.from({
|
|
618
|
+
to: '0x6cBCD73CD8e8a42844662f0A0e76D7F79Afd933d',
|
|
619
|
+
value: 1n,
|
|
620
|
+
gasLimit: 2n,
|
|
621
|
+
chainId: 1,
|
|
622
|
+
nonce: 0,
|
|
623
|
+
gasPrice: 3n,
|
|
624
|
+
type: 0,
|
|
625
|
+
signature: {
|
|
626
|
+
r: '0xffffffffffffffffffffffffffffffffffffffff',
|
|
627
|
+
s: '0xffffffffffffffffffffffffffffffffffffffff',
|
|
628
|
+
v: 27,
|
|
629
|
+
},
|
|
630
|
+
})
|
|
631
|
+
|
|
632
|
+
expect(await api.getOptimismAdditionalFees(transaction.serialized)).toEqual(
|
|
633
|
+
new BigNumber('100000000')
|
|
634
|
+
)
|
|
635
|
+
})
|
|
642
636
|
})
|
|
643
637
|
|
|
644
638
|
describe('getScrollAdditionalFees', () => {
|
|
645
639
|
it('should return 0 for an incompatible currency', async () => {
|
|
646
640
|
const api = createLedgerNodeApi(ledgerConfig, testLogger)
|
|
647
|
-
expect(await api.getScrollAdditionalFees(
|
|
641
|
+
expect(await api.getScrollAdditionalFees('')).toEqual(new BigNumber(0))
|
|
648
642
|
})
|
|
649
643
|
|
|
650
644
|
it('should return the expected payload', async () => {
|
|
651
|
-
const api = createLedgerNodeApi(ledgerConfig, testLogger)
|
|
645
|
+
const api = createLedgerNodeApi({ ...ledgerConfig, chainId: CHAIN_ID.SCROLL }, testLogger)
|
|
652
646
|
jest.spyOn(axios, 'request').mockImplementationOnce(async () => ({
|
|
653
647
|
data: [
|
|
654
648
|
{
|
|
@@ -677,7 +671,7 @@ describe('EVM Family', () => {
|
|
|
677
671
|
},
|
|
678
672
|
})
|
|
679
673
|
|
|
680
|
-
expect(await api.getScrollAdditionalFees(
|
|
674
|
+
expect(await api.getScrollAdditionalFees(transaction.serialized)).toEqual(
|
|
681
675
|
new BigNumber('100000000')
|
|
682
676
|
)
|
|
683
677
|
})
|