@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
|
@@ -21,6 +21,7 @@ import {
|
|
|
21
21
|
deserializePagingToken,
|
|
22
22
|
serializePagingToken,
|
|
23
23
|
} from '../adapters'
|
|
24
|
+
import { CHAIN_ID } from '../config'
|
|
24
25
|
import { testLogger } from '../fixtures/context.fixtures'
|
|
25
26
|
import { NO_TOKEN } from '../network/explorer/types'
|
|
26
27
|
|
|
@@ -54,7 +55,6 @@ describe('EVM Family', () => {
|
|
|
54
55
|
}
|
|
55
56
|
|
|
56
57
|
const address = '0x9aa99c23f67c81701c772b106b4f83f6e858dd2e'
|
|
57
|
-
const currencyId = 'ethereum'
|
|
58
58
|
|
|
59
59
|
const expectedOperation = {
|
|
60
60
|
id: '0x9aa99c23f67c81701c772b106b4f83f6e858dd2e-0xaa45b4858ba44230a5fce5a29570a5dec2bf1f0ba95bacdec4fe8f2c4fa99338-FEES',
|
|
@@ -85,7 +85,7 @@ describe('EVM Family', () => {
|
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
expect(
|
|
88
|
-
etherscanOperationToOperations(address,
|
|
88
|
+
etherscanOperationToOperations(address, CHAIN_ID.ETHEREUM, etherscanOp, testLogger)
|
|
89
89
|
).toEqual([expectedOperation])
|
|
90
90
|
})
|
|
91
91
|
|
|
@@ -115,7 +115,6 @@ describe('EVM Family', () => {
|
|
|
115
115
|
}
|
|
116
116
|
|
|
117
117
|
const address = '0x9aa99c23f67c81701c772b106b4f83f6e858dd2e'
|
|
118
|
-
const currencyId = 'ethereum'
|
|
119
118
|
|
|
120
119
|
const expectedOperation = {
|
|
121
120
|
id: '0x9aa99c23f67c81701c772b106b4f83f6e858dd2e-0xaa45b4858ba44230a5fce5a29570a5dec2bf1f0ba95bacdec4fe8f2c4fa99338-FEES',
|
|
@@ -146,7 +145,7 @@ describe('EVM Family', () => {
|
|
|
146
145
|
}
|
|
147
146
|
|
|
148
147
|
expect(
|
|
149
|
-
etherscanOperationToOperations(address,
|
|
148
|
+
etherscanOperationToOperations(address, CHAIN_ID.ETHEREUM, etherscanOp, testLogger)
|
|
150
149
|
).toEqual([expectedOperation])
|
|
151
150
|
})
|
|
152
151
|
|
|
@@ -175,7 +174,6 @@ describe('EVM Family', () => {
|
|
|
175
174
|
}
|
|
176
175
|
|
|
177
176
|
const address = '0x829BD824B016326A401d083B33D092293333A830'
|
|
178
|
-
const currencyId = 'ethereum'
|
|
179
177
|
|
|
180
178
|
const expectedOperation = {
|
|
181
179
|
id: '0x829BD824B016326A401d083B33D092293333A830-0x8d3e871469ce549c5a80b8c8beaae0d502ecea85bb43eb84703cebeea7d25944-OUT',
|
|
@@ -200,7 +198,7 @@ describe('EVM Family', () => {
|
|
|
200
198
|
}
|
|
201
199
|
|
|
202
200
|
expect(
|
|
203
|
-
etherscanOperationToOperations(address,
|
|
201
|
+
etherscanOperationToOperations(address, CHAIN_ID.ETHEREUM, etherscanOp, testLogger)
|
|
204
202
|
).toEqual([expectedOperation])
|
|
205
203
|
})
|
|
206
204
|
|
|
@@ -229,7 +227,6 @@ describe('EVM Family', () => {
|
|
|
229
227
|
}
|
|
230
228
|
|
|
231
229
|
const address = '0x829BD824B016326A401d083B33D092293333A830'
|
|
232
|
-
const currencyId = 'ethereum'
|
|
233
230
|
|
|
234
231
|
const expectedOperation = {
|
|
235
232
|
id: '0x829BD824B016326A401d083B33D092293333A830-0x8d3e871469ce549c5a80b8c8beaae0d502ecea85bb43eb84703cebeea7d25944-IN',
|
|
@@ -254,7 +251,7 @@ describe('EVM Family', () => {
|
|
|
254
251
|
}
|
|
255
252
|
|
|
256
253
|
expect(
|
|
257
|
-
etherscanOperationToOperations(address,
|
|
254
|
+
etherscanOperationToOperations(address, CHAIN_ID.ETHEREUM, etherscanOp, testLogger)
|
|
258
255
|
).toEqual([expectedOperation])
|
|
259
256
|
})
|
|
260
257
|
|
|
@@ -283,7 +280,6 @@ describe('EVM Family', () => {
|
|
|
283
280
|
}
|
|
284
281
|
|
|
285
282
|
const address = '0x829BD824B016326A401d083B33D092293333A830'
|
|
286
|
-
const currencyId = 'ethereum'
|
|
287
283
|
|
|
288
284
|
const expectedOperation = {
|
|
289
285
|
id: '0x829BD824B016326A401d083B33D092293333A830-0x8d3e871469ce549c5a80b8c8beaae0d502ecea85bb43eb84703cebeea7d25944-NONE',
|
|
@@ -308,7 +304,7 @@ describe('EVM Family', () => {
|
|
|
308
304
|
}
|
|
309
305
|
|
|
310
306
|
expect(
|
|
311
|
-
etherscanOperationToOperations(address,
|
|
307
|
+
etherscanOperationToOperations(address, CHAIN_ID.ETHEREUM, etherscanOp, testLogger)
|
|
312
308
|
).toEqual([expectedOperation])
|
|
313
309
|
})
|
|
314
310
|
|
|
@@ -337,7 +333,6 @@ describe('EVM Family', () => {
|
|
|
337
333
|
}
|
|
338
334
|
|
|
339
335
|
const address = '0x9aa99c23f67c81701c772b106b4f83f6e858dd2e'
|
|
340
|
-
const currencyId = 'ethereum'
|
|
341
336
|
|
|
342
337
|
const selfSendTx = {
|
|
343
338
|
hash: '0xaa45b4858ba44230a5fce5a29570a5dec2bf1f0ba95bacdec4fe8f2c4fa99338',
|
|
@@ -376,13 +371,12 @@ describe('EVM Family', () => {
|
|
|
376
371
|
]
|
|
377
372
|
|
|
378
373
|
expect(
|
|
379
|
-
etherscanOperationToOperations(address,
|
|
374
|
+
etherscanOperationToOperations(address, CHAIN_ID.ETHEREUM, etherscanOp, testLogger)
|
|
380
375
|
).toEqual(expectedOperations)
|
|
381
376
|
})
|
|
382
377
|
|
|
383
378
|
it('should return an operation with the expected amount', () => {
|
|
384
379
|
const address = '0x9aa99c23f67c81701c772b106b4f83f6e858dd2e'
|
|
385
|
-
const currencyId = 'ethereum'
|
|
386
380
|
|
|
387
381
|
const etherscanOpFees: EtherscanOperation = {
|
|
388
382
|
blockNumber: '14923692',
|
|
@@ -410,14 +404,18 @@ describe('EVM Family', () => {
|
|
|
410
404
|
|
|
411
405
|
// Successful Op (value = transferred only; fee is separate; Ledger Wallet adds fee in bridge)
|
|
412
406
|
expect(
|
|
413
|
-
etherscanOperationToOperations(
|
|
414
|
-
|
|
407
|
+
etherscanOperationToOperations(
|
|
408
|
+
address,
|
|
409
|
+
CHAIN_ID.ETHEREUM,
|
|
410
|
+
etherscanOpFees,
|
|
411
|
+
testLogger
|
|
412
|
+
)[0].value
|
|
415
413
|
).toEqual(BigInt(etherscanOpFees.value))
|
|
416
414
|
// Failing Op (value = tx value, same as success)
|
|
417
415
|
expect(
|
|
418
416
|
etherscanOperationToOperations(
|
|
419
417
|
address,
|
|
420
|
-
|
|
418
|
+
CHAIN_ID.ETHEREUM,
|
|
421
419
|
{
|
|
422
420
|
...etherscanOpFees,
|
|
423
421
|
isError: '1',
|
|
@@ -451,13 +449,18 @@ describe('EVM Family', () => {
|
|
|
451
449
|
|
|
452
450
|
// Successful Op (value = transferred only; fee is separate; Ledger Wallet adds fee in bridge)
|
|
453
451
|
expect(
|
|
454
|
-
etherscanOperationToOperations(
|
|
452
|
+
etherscanOperationToOperations(
|
|
453
|
+
address,
|
|
454
|
+
CHAIN_ID.ETHEREUM,
|
|
455
|
+
etherscanOpOut,
|
|
456
|
+
testLogger
|
|
457
|
+
)[0].value
|
|
455
458
|
).toEqual(BigInt(etherscanOpOut.value))
|
|
456
459
|
// Failing Op (value = tx value, same as success)
|
|
457
460
|
expect(
|
|
458
461
|
etherscanOperationToOperations(
|
|
459
462
|
address,
|
|
460
|
-
|
|
463
|
+
CHAIN_ID.ETHEREUM,
|
|
461
464
|
{
|
|
462
465
|
...etherscanOpOut,
|
|
463
466
|
isError: '1',
|
|
@@ -491,13 +494,14 @@ describe('EVM Family', () => {
|
|
|
491
494
|
|
|
492
495
|
// Successful Op
|
|
493
496
|
expect(
|
|
494
|
-
etherscanOperationToOperations(address,
|
|
497
|
+
etherscanOperationToOperations(address, CHAIN_ID.ETHEREUM, etherscanOpIn, testLogger)[0]
|
|
498
|
+
.value
|
|
495
499
|
).toEqual(BigInt(etherscanOpIn.value))
|
|
496
500
|
// Failing Op
|
|
497
501
|
expect(
|
|
498
502
|
etherscanOperationToOperations(
|
|
499
503
|
address,
|
|
500
|
-
|
|
504
|
+
CHAIN_ID.ETHEREUM,
|
|
501
505
|
{
|
|
502
506
|
...etherscanOpIn,
|
|
503
507
|
isError: '1',
|
|
@@ -535,11 +539,10 @@ describe('EVM Family', () => {
|
|
|
535
539
|
|
|
536
540
|
it('should handle transaction with empty gasPrice without throwing (Blockscout Optimism)', () => {
|
|
537
541
|
const address = '0xB10770cE9f8532634b6Ba156b8789f19935210F0'
|
|
538
|
-
const currencyId = 'optimism'
|
|
539
542
|
|
|
540
543
|
const result = etherscanOperationToOperations(
|
|
541
544
|
address,
|
|
542
|
-
|
|
545
|
+
CHAIN_ID.OPTIMISM,
|
|
543
546
|
rawBlockscoutTransaction,
|
|
544
547
|
testLogger
|
|
545
548
|
)
|
|
@@ -555,7 +558,6 @@ describe('EVM Family', () => {
|
|
|
555
558
|
|
|
556
559
|
it('should handle failed transaction with empty gasPrice', () => {
|
|
557
560
|
const address = '0xB10770cE9f8532634b6Ba156b8789f19935210F0'
|
|
558
|
-
const currencyId = 'optimism'
|
|
559
561
|
|
|
560
562
|
const failedTransaction: EtherscanOperation = {
|
|
561
563
|
...rawBlockscoutTransaction,
|
|
@@ -566,7 +568,7 @@ describe('EVM Family', () => {
|
|
|
566
568
|
|
|
567
569
|
const result = etherscanOperationToOperations(
|
|
568
570
|
address,
|
|
569
|
-
|
|
571
|
+
CHAIN_ID.OPTIMISM,
|
|
570
572
|
failedTransaction,
|
|
571
573
|
testLogger
|
|
572
574
|
)
|
|
@@ -579,7 +581,6 @@ describe('EVM Family', () => {
|
|
|
579
581
|
|
|
580
582
|
it('should handle transaction with both empty gasPrice and empty value', () => {
|
|
581
583
|
const address = '0xB10770cE9f8532634b6Ba156b8789f19935210F0'
|
|
582
|
-
const currencyId = 'optimism'
|
|
583
584
|
|
|
584
585
|
const txWithEmptyValue: EtherscanOperation = {
|
|
585
586
|
...rawBlockscoutTransaction,
|
|
@@ -588,7 +589,7 @@ describe('EVM Family', () => {
|
|
|
588
589
|
|
|
589
590
|
const result = etherscanOperationToOperations(
|
|
590
591
|
address,
|
|
591
|
-
|
|
592
|
+
CHAIN_ID.OPTIMISM,
|
|
592
593
|
txWithEmptyValue,
|
|
593
594
|
testLogger
|
|
594
595
|
)
|
|
@@ -622,11 +623,10 @@ describe('EVM Family', () => {
|
|
|
622
623
|
}
|
|
623
624
|
|
|
624
625
|
const address = '0x9aa99c23f67c81701c772b106b4f83f6e858dd2e'
|
|
625
|
-
const currencyId = 'ethereum'
|
|
626
626
|
|
|
627
627
|
const result = etherscanOperationToOperations(
|
|
628
628
|
address,
|
|
629
|
-
|
|
629
|
+
CHAIN_ID.ETHEREUM,
|
|
630
630
|
etherscanOp,
|
|
631
631
|
testLogger
|
|
632
632
|
)
|
|
@@ -659,11 +659,10 @@ describe('EVM Family', () => {
|
|
|
659
659
|
}
|
|
660
660
|
|
|
661
661
|
const address = '0x9aa99c23f67c81701c772b106b4f83f6e858dd2e'
|
|
662
|
-
const currencyId = 'ethereum'
|
|
663
662
|
|
|
664
663
|
const result = etherscanOperationToOperations(
|
|
665
664
|
address,
|
|
666
|
-
|
|
665
|
+
CHAIN_ID.ETHEREUM,
|
|
667
666
|
etherscanOp,
|
|
668
667
|
testLogger
|
|
669
668
|
)
|
|
@@ -701,7 +700,7 @@ describe('EVM Family', () => {
|
|
|
701
700
|
const address = '0x83802741df938c6cd94c46481cadba5b1b0c2f70'
|
|
702
701
|
const result = etherscanOperationToOperations(
|
|
703
702
|
address,
|
|
704
|
-
|
|
703
|
+
CHAIN_ID.OPTIMISM,
|
|
705
704
|
etherscanOp,
|
|
706
705
|
testLogger
|
|
707
706
|
)
|
|
@@ -737,7 +736,7 @@ describe('EVM Family', () => {
|
|
|
737
736
|
|
|
738
737
|
const result = etherscanOperationToOperations(
|
|
739
738
|
'0x9aa99c23f67c81701c772b106b4f83f6e858dd2e',
|
|
740
|
-
|
|
739
|
+
CHAIN_ID.ETHEREUM,
|
|
741
740
|
etherscanOp,
|
|
742
741
|
testLogger
|
|
743
742
|
)
|
|
@@ -1853,7 +1852,6 @@ describe('EVM Family', () => {
|
|
|
1853
1852
|
}
|
|
1854
1853
|
|
|
1855
1854
|
const address = '0x9aa99c23f67c81701c772b106b4f83f6e858dd2e'
|
|
1856
|
-
const currencyId = 'sei_evm'
|
|
1857
1855
|
|
|
1858
1856
|
const expectedOperation = {
|
|
1859
1857
|
id: `${address}-${stakingHash}-DELEGATE`,
|
|
@@ -1880,7 +1878,7 @@ describe('EVM Family', () => {
|
|
|
1880
1878
|
}
|
|
1881
1879
|
|
|
1882
1880
|
expect(
|
|
1883
|
-
etherscanOperationToOperations(address,
|
|
1881
|
+
etherscanOperationToOperations(address, CHAIN_ID.SEI_EVM, etherscanOp, testLogger)
|
|
1884
1882
|
).toEqual([expectedOperation])
|
|
1885
1883
|
})
|
|
1886
1884
|
|
|
@@ -1910,7 +1908,6 @@ describe('EVM Family', () => {
|
|
|
1910
1908
|
}
|
|
1911
1909
|
|
|
1912
1910
|
const address = '0x9aa99c23f67c81701c772b106b4f83f6e858dd2e'
|
|
1913
|
-
const currencyId = 'sei_evm'
|
|
1914
1911
|
|
|
1915
1912
|
const expectedOperation = {
|
|
1916
1913
|
id: `${address}-${stakingHash}-REDELEGATE`,
|
|
@@ -1937,7 +1934,7 @@ describe('EVM Family', () => {
|
|
|
1937
1934
|
}
|
|
1938
1935
|
|
|
1939
1936
|
expect(
|
|
1940
|
-
etherscanOperationToOperations(address,
|
|
1937
|
+
etherscanOperationToOperations(address, CHAIN_ID.SEI_EVM, etherscanOp, testLogger)
|
|
1941
1938
|
).toEqual([expectedOperation])
|
|
1942
1939
|
})
|
|
1943
1940
|
|
|
@@ -1966,7 +1963,6 @@ describe('EVM Family', () => {
|
|
|
1966
1963
|
}
|
|
1967
1964
|
|
|
1968
1965
|
const address = '0x9aa99c23f67c81701c772b106b4f83f6e858dd2e'
|
|
1969
|
-
const currencyId = 'sei_evm'
|
|
1970
1966
|
|
|
1971
1967
|
const expectedOperation = {
|
|
1972
1968
|
id: `${address}-${stakingHash}-UNDELEGATE`,
|
|
@@ -1992,7 +1988,7 @@ describe('EVM Family', () => {
|
|
|
1992
1988
|
}
|
|
1993
1989
|
|
|
1994
1990
|
expect(
|
|
1995
|
-
etherscanOperationToOperations(address,
|
|
1991
|
+
etherscanOperationToOperations(address, CHAIN_ID.SEI_EVM, etherscanOp, testLogger)
|
|
1996
1992
|
).toEqual([expectedOperation])
|
|
1997
1993
|
})
|
|
1998
1994
|
})
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: © 2026 LEDGER SAS
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
+
import type { ChainId } from '../config'
|
|
4
5
|
import type {
|
|
5
6
|
EtherscanERC1155Event,
|
|
6
7
|
EtherscanERC20Event,
|
|
@@ -59,7 +60,7 @@ export const safeDate = (op: { timeStamp?: string; timestamp?: string }): Date =
|
|
|
59
60
|
*/
|
|
60
61
|
export const etherscanOperationToOperations = (
|
|
61
62
|
address: string,
|
|
62
|
-
|
|
63
|
+
chainId: ChainId,
|
|
63
64
|
etherscanOp: EtherscanOperation,
|
|
64
65
|
logger: Logger
|
|
65
66
|
): Array<Operation<MemoNotSupported>> => {
|
|
@@ -82,7 +83,7 @@ export const etherscanOperationToOperations = (
|
|
|
82
83
|
if (from === checksummedAddress) {
|
|
83
84
|
const methodId = etherscanOp.methodId || etherscanOp.input?.slice(0, 10) || ''
|
|
84
85
|
const isContractInteraction = new RegExp(/0[xX][0-9a-fA-F]{8}/).test(methodId) // 0x + 4 bytes selector
|
|
85
|
-
const stakingType = detectEvmStakingOperationType(
|
|
86
|
+
const stakingType = detectEvmStakingOperationType(chainId, to, methodId)
|
|
86
87
|
types.push(stakingType ?? (isContractInteraction ? 'FEES' : 'OUT'))
|
|
87
88
|
}
|
|
88
89
|
if (!types.length) {
|
|
@@ -9,6 +9,7 @@ import type {
|
|
|
9
9
|
LedgerExplorerOperation,
|
|
10
10
|
} from './../types'
|
|
11
11
|
import type { MemoNotSupported, Operation } from '@ledgerhq/coin-module-framework/api/types'
|
|
12
|
+
import { CHAIN_ID } from '../config'
|
|
12
13
|
import { testLogger } from '../fixtures/context.fixtures'
|
|
13
14
|
import {
|
|
14
15
|
ledgerERC1155EventToOperations,
|
|
@@ -19,7 +20,6 @@ import {
|
|
|
19
20
|
} from './ledger'
|
|
20
21
|
|
|
21
22
|
const address = '0x6cbcd73cd8e8a42844662f0a0e76d7f79afd933d'
|
|
22
|
-
const currencyId = 'ethereum'
|
|
23
23
|
|
|
24
24
|
const coinOperation: Operation<MemoNotSupported> = {
|
|
25
25
|
id: '0x6cbcd73cd8e8a42844662f0a0e76d7f79afd933d-0xf350d4f8e910419e2d5cec294d44e69af8c6185b7089061d33bb4fc246cefb79-FEES',
|
|
@@ -110,7 +110,12 @@ describe('EVM Family', () => {
|
|
|
110
110
|
}
|
|
111
111
|
|
|
112
112
|
expect(
|
|
113
|
-
ledgerOperationToOperations(
|
|
113
|
+
ledgerOperationToOperations(
|
|
114
|
+
unrelatedAddress,
|
|
115
|
+
CHAIN_ID.ETHEREUM,
|
|
116
|
+
ledgerExplorerOp,
|
|
117
|
+
testLogger
|
|
118
|
+
)
|
|
114
119
|
).toEqual([expectedOperation])
|
|
115
120
|
})
|
|
116
121
|
|
|
@@ -175,7 +180,7 @@ describe('EVM Family', () => {
|
|
|
175
180
|
}
|
|
176
181
|
|
|
177
182
|
expect(
|
|
178
|
-
ledgerOperationToOperations(address,
|
|
183
|
+
ledgerOperationToOperations(address, CHAIN_ID.ETHEREUM, ledgerOperation, testLogger)
|
|
179
184
|
).toEqual([expectedOperation])
|
|
180
185
|
})
|
|
181
186
|
|
|
@@ -240,7 +245,7 @@ describe('EVM Family', () => {
|
|
|
240
245
|
}
|
|
241
246
|
|
|
242
247
|
expect(
|
|
243
|
-
ledgerOperationToOperations(address,
|
|
248
|
+
ledgerOperationToOperations(address, CHAIN_ID.ETHEREUM, ledgerOperation, testLogger)
|
|
244
249
|
).toEqual([expectedOperation])
|
|
245
250
|
})
|
|
246
251
|
|
|
@@ -305,7 +310,7 @@ describe('EVM Family', () => {
|
|
|
305
310
|
}
|
|
306
311
|
|
|
307
312
|
expect(
|
|
308
|
-
ledgerOperationToOperations(address,
|
|
313
|
+
ledgerOperationToOperations(address, CHAIN_ID.ETHEREUM, ledgerOperation, testLogger)
|
|
309
314
|
).toEqual([expectedOperation])
|
|
310
315
|
})
|
|
311
316
|
|
|
@@ -370,7 +375,7 @@ describe('EVM Family', () => {
|
|
|
370
375
|
}
|
|
371
376
|
|
|
372
377
|
expect(
|
|
373
|
-
ledgerOperationToOperations(address,
|
|
378
|
+
ledgerOperationToOperations(address, CHAIN_ID.ETHEREUM, ledgerOperation, testLogger)
|
|
374
379
|
).toEqual([expectedOperation])
|
|
375
380
|
})
|
|
376
381
|
|
|
@@ -440,7 +445,7 @@ describe('EVM Family', () => {
|
|
|
440
445
|
}
|
|
441
446
|
|
|
442
447
|
expect(
|
|
443
|
-
ledgerOperationToOperations(address,
|
|
448
|
+
ledgerOperationToOperations(address, CHAIN_ID.ETHEREUM, ledgerOperation, testLogger)
|
|
444
449
|
).toEqual([expectedOperation])
|
|
445
450
|
})
|
|
446
451
|
|
|
@@ -517,7 +522,7 @@ describe('EVM Family', () => {
|
|
|
517
522
|
}
|
|
518
523
|
|
|
519
524
|
expect(
|
|
520
|
-
ledgerOperationToOperations(address,
|
|
525
|
+
ledgerOperationToOperations(address, CHAIN_ID.ETHEREUM, ledgerOperation, testLogger)
|
|
521
526
|
).toEqual([expectedOperation1, expectedOperation2])
|
|
522
527
|
})
|
|
523
528
|
|
|
@@ -566,7 +571,7 @@ describe('EVM Family', () => {
|
|
|
566
571
|
expect(
|
|
567
572
|
ledgerOperationToOperations(
|
|
568
573
|
unrelatedAddress,
|
|
569
|
-
|
|
574
|
+
CHAIN_ID.ETHEREUM,
|
|
570
575
|
ledgerExplorerNoneOp,
|
|
571
576
|
testLogger
|
|
572
577
|
)[0].value
|
|
@@ -575,7 +580,7 @@ describe('EVM Family', () => {
|
|
|
575
580
|
expect(
|
|
576
581
|
ledgerOperationToOperations(
|
|
577
582
|
unrelatedAddress,
|
|
578
|
-
|
|
583
|
+
CHAIN_ID.ETHEREUM,
|
|
579
584
|
{
|
|
580
585
|
...ledgerExplorerNoneOp,
|
|
581
586
|
status: 0,
|
|
@@ -624,14 +629,18 @@ describe('EVM Family', () => {
|
|
|
624
629
|
|
|
625
630
|
// Successful Op (value = transferred only; fee is separate; Ledger Wallet adds fee in bridge)
|
|
626
631
|
expect(
|
|
627
|
-
ledgerOperationToOperations(
|
|
628
|
-
|
|
632
|
+
ledgerOperationToOperations(
|
|
633
|
+
address,
|
|
634
|
+
CHAIN_ID.ETHEREUM,
|
|
635
|
+
ledgerExplorerFeesOp,
|
|
636
|
+
testLogger
|
|
637
|
+
)[0].value
|
|
629
638
|
).toEqual(BigInt(ledgerExplorerFeesOp.value))
|
|
630
639
|
// Failing Op (value = tx value, same as success)
|
|
631
640
|
expect(
|
|
632
641
|
ledgerOperationToOperations(
|
|
633
642
|
address,
|
|
634
|
-
|
|
643
|
+
CHAIN_ID.ETHEREUM,
|
|
635
644
|
{
|
|
636
645
|
...ledgerExplorerFeesOp,
|
|
637
646
|
status: 0,
|
|
@@ -679,14 +688,18 @@ describe('EVM Family', () => {
|
|
|
679
688
|
|
|
680
689
|
// Successful Op (value = transferred only; fee is separate; Ledger Wallet adds fee in bridge)
|
|
681
690
|
expect(
|
|
682
|
-
ledgerOperationToOperations(
|
|
683
|
-
|
|
691
|
+
ledgerOperationToOperations(
|
|
692
|
+
address,
|
|
693
|
+
CHAIN_ID.ETHEREUM,
|
|
694
|
+
ledgerOperationOut,
|
|
695
|
+
testLogger
|
|
696
|
+
)[0].value
|
|
684
697
|
).toEqual(BigInt(ledgerOperationOut.value))
|
|
685
698
|
// Failing Op (value = tx value, same as success)
|
|
686
699
|
expect(
|
|
687
700
|
ledgerOperationToOperations(
|
|
688
701
|
address,
|
|
689
|
-
|
|
702
|
+
CHAIN_ID.ETHEREUM,
|
|
690
703
|
{
|
|
691
704
|
...ledgerOperationOut,
|
|
692
705
|
status: 0,
|
|
@@ -734,13 +747,18 @@ describe('EVM Family', () => {
|
|
|
734
747
|
|
|
735
748
|
// Successful Op
|
|
736
749
|
expect(
|
|
737
|
-
ledgerOperationToOperations(
|
|
750
|
+
ledgerOperationToOperations(
|
|
751
|
+
address,
|
|
752
|
+
CHAIN_ID.ETHEREUM,
|
|
753
|
+
ledgerOperationIn,
|
|
754
|
+
testLogger
|
|
755
|
+
)[0].value
|
|
738
756
|
).toEqual(BigInt(ledgerOperationOut.value))
|
|
739
757
|
// Failing Op
|
|
740
758
|
expect(
|
|
741
759
|
ledgerOperationToOperations(
|
|
742
760
|
address,
|
|
743
|
-
|
|
761
|
+
CHAIN_ID.ETHEREUM,
|
|
744
762
|
{ ...ledgerOperationIn, status: 0 },
|
|
745
763
|
testLogger
|
|
746
764
|
)[0].value
|
|
@@ -778,7 +796,12 @@ describe('EVM Family', () => {
|
|
|
778
796
|
},
|
|
779
797
|
}
|
|
780
798
|
|
|
781
|
-
const result = ledgerOperationToOperations(
|
|
799
|
+
const result = ledgerOperationToOperations(
|
|
800
|
+
address,
|
|
801
|
+
CHAIN_ID.ETHEREUM,
|
|
802
|
+
ledgerOp,
|
|
803
|
+
testLogger
|
|
804
|
+
)
|
|
782
805
|
|
|
783
806
|
expect(result).toHaveLength(1)
|
|
784
807
|
expect(result[0].recipients).toEqual([])
|
|
@@ -815,7 +838,12 @@ describe('EVM Family', () => {
|
|
|
815
838
|
},
|
|
816
839
|
}
|
|
817
840
|
|
|
818
|
-
const result = ledgerOperationToOperations(
|
|
841
|
+
const result = ledgerOperationToOperations(
|
|
842
|
+
address,
|
|
843
|
+
CHAIN_ID.ETHEREUM,
|
|
844
|
+
ledgerOp,
|
|
845
|
+
testLogger
|
|
846
|
+
)
|
|
819
847
|
|
|
820
848
|
expect(result).toHaveLength(1)
|
|
821
849
|
expect(result[0].senders).toEqual([])
|
|
@@ -823,7 +851,6 @@ describe('EVM Family', () => {
|
|
|
823
851
|
|
|
824
852
|
it('should detect a Monad staking withdraw (value 0 contract call) as a WITHDRAW_UNBONDED operation instead of FEES', () => {
|
|
825
853
|
const monadAddress = '0x6cbcd73cd8e8a42844662f0a0e76d7f79afd933d'
|
|
826
|
-
const monadCurrencyId = 'monad'
|
|
827
854
|
|
|
828
855
|
const ledgerOp: LedgerExplorerOperation = {
|
|
829
856
|
hash: '0xf350d4f8e910419e2d5cec294d44e69af8c6185b7089061d33bb4fc246cefb79',
|
|
@@ -862,7 +889,7 @@ describe('EVM Family', () => {
|
|
|
862
889
|
|
|
863
890
|
const result = ledgerOperationToOperations(
|
|
864
891
|
monadAddress,
|
|
865
|
-
|
|
892
|
+
CHAIN_ID.MONAD,
|
|
866
893
|
ledgerOp,
|
|
867
894
|
testLogger
|
|
868
895
|
)
|
package/src/adapters/ledger.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: © 2026 LEDGER SAS
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
+
import type { ChainId } from '../config'
|
|
4
5
|
import type {
|
|
5
6
|
LedgerExplorerERC20TransferEvent,
|
|
6
7
|
LedgerExplorerER1155TransferEvent,
|
|
@@ -20,7 +21,7 @@ import { detectEvmStakingOperationType } from '../staking/detectOperationType'
|
|
|
20
21
|
*/
|
|
21
22
|
export const ledgerOperationToOperations = (
|
|
22
23
|
address: string,
|
|
23
|
-
|
|
24
|
+
chainId: ChainId,
|
|
24
25
|
ledgerOp: LedgerExplorerOperation,
|
|
25
26
|
logger: Logger
|
|
26
27
|
): Array<Operation<MemoNotSupported>> => {
|
|
@@ -41,7 +42,7 @@ export const ledgerOperationToOperations = (
|
|
|
41
42
|
if (from === checksummedAddress) {
|
|
42
43
|
// Recognize staking calls (delegate/undelegate/withdraw/reward) so they are not
|
|
43
44
|
// collapsed into a generic FEES/OUT operation, mirroring the etherscan adapter.
|
|
44
|
-
const stakingType = detectEvmStakingOperationType(
|
|
45
|
+
const stakingType = detectEvmStakingOperationType(chainId, to, methodId)
|
|
45
46
|
types.push(stakingType ?? (safeBigInt(ledgerOp.value) === 0n ? 'FEES' : 'OUT'))
|
|
46
47
|
}
|
|
47
48
|
if (!types.length) {
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
4
|
import type { EvmConfigInfo } from '../config'
|
|
5
|
+
import { CHAIN_ID } from '../config'
|
|
5
6
|
import { createMockEvmContext } from '../fixtures/context.fixtures'
|
|
6
7
|
import { createApi } from './index'
|
|
7
8
|
|
|
@@ -27,7 +28,7 @@ describe('getBlock ERC20 transfers', () => {
|
|
|
27
28
|
|
|
28
29
|
const velasEvmConfig: EvmConfigInfo = {
|
|
29
30
|
status: { type: 'active' },
|
|
30
|
-
chainId:
|
|
31
|
+
chainId: CHAIN_ID.VELAS_EVM,
|
|
31
32
|
name: 'Velas EVM',
|
|
32
33
|
unit: { name: 'VLX', code: 'VLX', magnitude: 18 },
|
|
33
34
|
node: {
|
|
@@ -128,8 +128,8 @@ describe('EVM Api (Monad Testnet)', () => {
|
|
|
128
128
|
expect(items.length).toBeGreaterThan(0)
|
|
129
129
|
const txHash = items[0].tx.hash
|
|
130
130
|
|
|
131
|
-
const api = getNodeApi(config,
|
|
132
|
-
const txInfo = await api.getTransaction(
|
|
131
|
+
const api = getNodeApi(config, testLogger)
|
|
132
|
+
const txInfo = await api.getTransaction(txHash)
|
|
133
133
|
|
|
134
134
|
expect(txInfo.hash).toBe(txHash)
|
|
135
135
|
expect(txInfo.from).toMatch(/^0x[A-Fa-f0-9]{40}$/i)
|
package/src/api/index.ts
CHANGED
|
@@ -77,7 +77,7 @@ export function createApi(currencyId: string) {
|
|
|
77
77
|
call: async (context: EvmContext, params: CallParams): Promise<string> => {
|
|
78
78
|
const config = await context.config(currencyId)
|
|
79
79
|
const callParams = parseCallParams(params)
|
|
80
|
-
return getNodeApi(config,
|
|
80
|
+
return getNodeApi(config, context.logger).call(callParams)
|
|
81
81
|
},
|
|
82
82
|
combine: (
|
|
83
83
|
_context: EvmContext,
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: © 2026 LEDGER SAS
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import { CHAIN_ID } from './chains'
|
|
5
|
+
|
|
6
|
+
describe('CHAIN_ID', () => {
|
|
7
|
+
it('has no duplicate chain id', () => {
|
|
8
|
+
const values = Object.values(CHAIN_ID)
|
|
9
|
+
|
|
10
|
+
expect(new Set(values).size).toBe(values.length)
|
|
11
|
+
})
|
|
12
|
+
})
|