@ledgerhq/coin-evm 7.0.0 → 9.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 +1 -1
- package/CHANGELOG.md +62 -0
- package/docs/getBlock-internal-txs-schema.md +1 -1
- package/docs/network/node/index.md +3 -1
- package/lib/adapters/blockOperations.d.ts +4 -3
- package/lib/adapters/blockOperations.d.ts.map +1 -1
- package/lib/adapters/blockOperations.js +17 -17
- package/lib/adapters/blockOperations.js.map +1 -1
- package/lib/adapters/etherscan.d.ts +7 -6
- package/lib/adapters/etherscan.d.ts.map +1 -1
- package/lib/adapters/etherscan.js +19 -19
- package/lib/adapters/etherscan.js.map +1 -1
- package/lib/adapters/ledger.d.ts +6 -5
- package/lib/adapters/ledger.d.ts.map +1 -1
- package/lib/adapters/ledger.js +15 -15
- package/lib/adapters/ledger.js.map +1 -1
- package/lib/api/index.d.ts.map +1 -1
- package/lib/api/index.js +1 -2
- package/lib/api/index.js.map +1 -1
- package/lib/config.d.ts +0 -1
- package/lib/config.d.ts.map +1 -1
- package/lib/logic/common.js +1 -1
- package/lib/logic/common.js.map +1 -1
- package/lib/logic/getBalance.d.ts.map +1 -1
- package/lib/logic/getBalance.js +3 -3
- package/lib/logic/getBalance.js.map +1 -1
- package/lib/logic/getBlock.d.ts.map +1 -1
- package/lib/logic/getBlock.js +22 -23
- package/lib/logic/getBlock.js.map +1 -1
- package/lib/logic/getStakes.d.ts.map +1 -1
- package/lib/logic/getStakes.js +2 -2
- package/lib/logic/getStakes.js.map +1 -1
- package/lib/logic/internalTransactionsFetcher.d.ts +3 -2
- package/lib/logic/internalTransactionsFetcher.d.ts.map +1 -1
- package/lib/logic/internalTransactionsFetcher.js +13 -10
- package/lib/logic/internalTransactionsFetcher.js.map +1 -1
- package/lib/logic/listOperations.js +1 -1
- package/lib/logic/listOperations.js.map +1 -1
- package/lib/logic-public/utils.d.ts +3 -2
- package/lib/logic-public/utils.d.ts.map +1 -1
- package/lib/logic-public/utils.js +7 -6
- package/lib/logic-public/utils.js.map +1 -1
- package/lib/network/explorer/etherscan.d.ts +3 -2
- package/lib/network/explorer/etherscan.d.ts.map +1 -1
- package/lib/network/explorer/etherscan.js +13 -12
- 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 +11 -11
- 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 +3 -3
- package/lib/network/node/explorerProxy.js.map +1 -1
- package/lib/network/node/index.d.ts.map +1 -1
- package/lib/network/node/index.js +2 -2
- package/lib/network/node/index.js.map +1 -1
- package/lib/network/node/ledger.d.ts +2 -1
- package/lib/network/node/ledger.d.ts.map +1 -1
- package/lib/network/node/ledger.js +9 -10
- package/lib/network/node/ledger.js.map +1 -1
- package/lib/network/node/rpc.common.d.ts +3 -2
- package/lib/network/node/rpc.common.d.ts.map +1 -1
- package/lib/network/node/rpc.common.js +37 -29
- package/lib/network/node/rpc.common.js.map +1 -1
- package/lib/staking/contracts.js +2 -2
- package/lib/staking/contracts.js.map +1 -1
- package/lib/staking/fetchers.d.ts.map +1 -1
- package/lib/staking/fetchers.js +7 -7
- package/lib/staking/fetchers.js.map +1 -1
- package/lib/staking/prepareIntents.d.ts +2 -1
- package/lib/staking/prepareIntents.d.ts.map +1 -1
- package/lib/staking/prepareIntents.js +4 -4
- package/lib/staking/prepareIntents.js.map +1 -1
- package/lib/staking/redelegations.d.ts +5 -4
- package/lib/staking/redelegations.d.ts.map +1 -1
- package/lib/staking/redelegations.js +13 -14
- package/lib/staking/redelegations.js.map +1 -1
- package/lib/staking/rewards.d.ts +2 -1
- package/lib/staking/rewards.d.ts.map +1 -1
- package/lib/staking/rewards.js +4 -5
- 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 -3
- package/lib/staking/rewardsFromReceipt.js.map +1 -1
- package/lib/staking/unbondings.d.ts +2 -1
- package/lib/staking/unbondings.d.ts.map +1 -1
- package/lib/staking/unbondings.js +4 -5
- package/lib/staking/unbondings.js.map +1 -1
- package/lib/staking/validators/index.d.ts +9 -4
- package/lib/staking/validators/index.d.ts.map +1 -1
- package/lib/staking/validators/index.js +19 -10
- package/lib/staking/validators/index.js.map +1 -1
- package/lib/staking/validators/monad.d.ts +6 -5
- package/lib/staking/validators/monad.d.ts.map +1 -1
- package/lib/staking/validators/monad.js +33 -29
- package/lib/staking/validators/monad.js.map +1 -1
- package/lib/staking/validators/monadResolver.d.ts +2 -1
- package/lib/staking/validators/monadResolver.d.ts.map +1 -1
- package/lib/staking/validators/monadResolver.js +2 -3
- package/lib/staking/validators/monadResolver.js.map +1 -1
- package/lib/staking/validators/somnia.d.ts +3 -2
- package/lib/staking/validators/somnia.d.ts.map +1 -1
- package/lib/staking/validators/somnia.js +16 -15
- package/lib/staking/validators/somnia.js.map +1 -1
- package/lib/staking/validators/types.d.ts +2 -1
- package/lib/staking/validators/types.d.ts.map +1 -1
- package/lib/staking/validators/zero_gravity.d.ts +2 -1
- package/lib/staking/validators/zero_gravity.d.ts.map +1 -1
- package/lib/staking/validators/zero_gravity.js +7 -8
- package/lib/staking/validators/zero_gravity.js.map +1 -1
- package/lib/types/staking.d.ts +4 -3
- package/lib/types/staking.d.ts.map +1 -1
- package/lib-es/adapters/blockOperations.d.ts +4 -3
- package/lib-es/adapters/blockOperations.d.ts.map +1 -1
- package/lib-es/adapters/blockOperations.js +17 -17
- package/lib-es/adapters/blockOperations.js.map +1 -1
- package/lib-es/adapters/etherscan.d.ts +7 -6
- package/lib-es/adapters/etherscan.d.ts.map +1 -1
- package/lib-es/adapters/etherscan.js +19 -19
- package/lib-es/adapters/etherscan.js.map +1 -1
- package/lib-es/adapters/ledger.d.ts +6 -5
- package/lib-es/adapters/ledger.d.ts.map +1 -1
- package/lib-es/adapters/ledger.js +15 -15
- package/lib-es/adapters/ledger.js.map +1 -1
- package/lib-es/api/index.d.ts.map +1 -1
- package/lib-es/api/index.js +1 -2
- package/lib-es/api/index.js.map +1 -1
- package/lib-es/config.d.ts +0 -1
- package/lib-es/config.d.ts.map +1 -1
- package/lib-es/logic/common.js +1 -1
- package/lib-es/logic/common.js.map +1 -1
- package/lib-es/logic/getBalance.d.ts.map +1 -1
- package/lib-es/logic/getBalance.js +3 -3
- 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 +22 -23
- package/lib-es/logic/getBlock.js.map +1 -1
- package/lib-es/logic/getStakes.d.ts.map +1 -1
- package/lib-es/logic/getStakes.js +2 -2
- package/lib-es/logic/getStakes.js.map +1 -1
- package/lib-es/logic/internalTransactionsFetcher.d.ts +3 -2
- package/lib-es/logic/internalTransactionsFetcher.d.ts.map +1 -1
- package/lib-es/logic/internalTransactionsFetcher.js +13 -10
- package/lib-es/logic/internalTransactionsFetcher.js.map +1 -1
- package/lib-es/logic/listOperations.js +1 -1
- package/lib-es/logic/listOperations.js.map +1 -1
- package/lib-es/logic-public/utils.d.ts +3 -2
- package/lib-es/logic-public/utils.d.ts.map +1 -1
- package/lib-es/logic-public/utils.js +7 -6
- package/lib-es/logic-public/utils.js.map +1 -1
- package/lib-es/network/explorer/etherscan.d.ts +3 -2
- package/lib-es/network/explorer/etherscan.d.ts.map +1 -1
- package/lib-es/network/explorer/etherscan.js +13 -12
- 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 +11 -11
- 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 +3 -3
- package/lib-es/network/node/explorerProxy.js.map +1 -1
- package/lib-es/network/node/index.d.ts.map +1 -1
- package/lib-es/network/node/index.js +2 -2
- package/lib-es/network/node/index.js.map +1 -1
- package/lib-es/network/node/ledger.d.ts +2 -1
- package/lib-es/network/node/ledger.d.ts.map +1 -1
- package/lib-es/network/node/ledger.js +9 -10
- package/lib-es/network/node/ledger.js.map +1 -1
- package/lib-es/network/node/rpc.common.d.ts +3 -2
- package/lib-es/network/node/rpc.common.d.ts.map +1 -1
- package/lib-es/network/node/rpc.common.js +37 -29
- package/lib-es/network/node/rpc.common.js.map +1 -1
- package/lib-es/staking/contracts.js +2 -2
- package/lib-es/staking/contracts.js.map +1 -1
- package/lib-es/staking/fetchers.d.ts.map +1 -1
- package/lib-es/staking/fetchers.js +7 -7
- package/lib-es/staking/fetchers.js.map +1 -1
- package/lib-es/staking/prepareIntents.d.ts +2 -1
- package/lib-es/staking/prepareIntents.d.ts.map +1 -1
- package/lib-es/staking/prepareIntents.js +4 -4
- package/lib-es/staking/prepareIntents.js.map +1 -1
- package/lib-es/staking/redelegations.d.ts +5 -4
- package/lib-es/staking/redelegations.d.ts.map +1 -1
- package/lib-es/staking/redelegations.js +13 -14
- package/lib-es/staking/redelegations.js.map +1 -1
- package/lib-es/staking/rewards.d.ts +2 -1
- package/lib-es/staking/rewards.d.ts.map +1 -1
- package/lib-es/staking/rewards.js +4 -5
- 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 -3
- package/lib-es/staking/rewardsFromReceipt.js.map +1 -1
- package/lib-es/staking/unbondings.d.ts +2 -1
- package/lib-es/staking/unbondings.d.ts.map +1 -1
- package/lib-es/staking/unbondings.js +4 -5
- package/lib-es/staking/unbondings.js.map +1 -1
- package/lib-es/staking/validators/index.d.ts +9 -4
- package/lib-es/staking/validators/index.d.ts.map +1 -1
- package/lib-es/staking/validators/index.js +18 -10
- package/lib-es/staking/validators/index.js.map +1 -1
- package/lib-es/staking/validators/monad.d.ts +6 -5
- package/lib-es/staking/validators/monad.d.ts.map +1 -1
- package/lib-es/staking/validators/monad.js +33 -29
- package/lib-es/staking/validators/monad.js.map +1 -1
- package/lib-es/staking/validators/monadResolver.d.ts +2 -1
- package/lib-es/staking/validators/monadResolver.d.ts.map +1 -1
- package/lib-es/staking/validators/monadResolver.js +2 -3
- package/lib-es/staking/validators/monadResolver.js.map +1 -1
- package/lib-es/staking/validators/somnia.d.ts +3 -2
- package/lib-es/staking/validators/somnia.d.ts.map +1 -1
- package/lib-es/staking/validators/somnia.js +16 -15
- package/lib-es/staking/validators/somnia.js.map +1 -1
- package/lib-es/staking/validators/types.d.ts +2 -1
- package/lib-es/staking/validators/types.d.ts.map +1 -1
- package/lib-es/staking/validators/zero_gravity.d.ts +2 -1
- package/lib-es/staking/validators/zero_gravity.d.ts.map +1 -1
- package/lib-es/staking/validators/zero_gravity.js +7 -8
- package/lib-es/staking/validators/zero_gravity.js.map +1 -1
- package/lib-es/types/staking.d.ts +4 -3
- package/lib-es/types/staking.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/adapters/blockOperations.test.ts +86 -67
- package/src/adapters/blockOperations.ts +28 -17
- package/src/adapters/etherscan.test.ts +151 -85
- package/src/adapters/etherscan.ts +27 -18
- package/src/adapters/ledger.test.ts +210 -83
- package/src/adapters/ledger.ts +21 -15
- package/src/api/getBlock.integ.test.ts +10 -4
- package/src/api/index.arbitrum.integ.test.ts +1 -0
- package/src/api/index.arc.integ.test.ts +1 -0
- package/src/api/index.avalanche_c_chain_fuji.integ.test.ts +1 -0
- package/src/api/index.cronos.integ.test.ts +1 -0
- package/src/api/index.flare.integ.test.ts +4 -2
- package/src/api/index.integ.test.ts +7 -6
- package/src/api/index.linea.integ.test.ts +4 -2
- package/src/api/index.optimism.integ.test.ts +1 -0
- package/src/api/index.rsk.integ.test.ts +1 -0
- package/src/api/index.shape.integ.test.ts +4 -2
- package/src/api/index.somnia.integ.test.ts +1 -0
- package/src/api/index.test.ts +2 -2
- package/src/api/index.ts +1 -2
- package/src/config.ts +0 -1
- package/src/fixtures/context.fixtures.ts +5 -5
- package/src/logic/common.ts +1 -1
- package/src/logic/getBalance.ts +4 -3
- package/src/logic/getBlock.ts +43 -27
- package/src/logic/getStakes.ts +2 -1
- package/src/logic/internalTransactionsFetcher.ts +16 -10
- package/src/logic/listOperations.ts +2 -2
- package/src/logic/tests/getBalance.test.ts +5 -3
- package/src/logic/tests/getBlock.test.ts +16 -15
- package/src/logic/tests/internalTransactionsFetcher.test.ts +6 -5
- package/src/logic/tests/listOperations.test.ts +4 -4
- package/src/logic-public/tests/utils.test.ts +6 -5
- package/src/logic-public/utils.ts +8 -5
- package/src/logic.test.ts +5 -5
- package/src/network/explorer/etherscan.test.ts +169 -55
- package/src/network/explorer/etherscan.ts +27 -16
- package/src/network/explorer/index.test.ts +2 -1
- package/src/network/explorer/ledger.test.ts +208 -35
- package/src/network/explorer/ledger.ts +12 -8
- package/src/network/explorer/types.ts +3 -2
- package/src/network/node/explorerProxy.ts +3 -3
- package/src/network/node/index.ts +3 -2
- package/src/network/node/ledger.test.ts +25 -25
- package/src/network/node/ledger.ts +13 -10
- package/src/network/node/node.fixtures.ts +2 -1
- package/src/network/node/rpc.common.ts +84 -28
- package/src/network/node/rpc.test.ts +45 -31
- package/src/staking/contracts.ts +2 -2
- package/src/staking/fetchers.ts +20 -8
- package/src/staking/prepareIntents.test.ts +33 -12
- package/src/staking/prepareIntents.ts +9 -5
- package/src/staking/redelegations.test.ts +98 -35
- package/src/staking/redelegations.ts +20 -12
- package/src/staking/rewards.test.ts +15 -10
- package/src/staking/rewards.ts +8 -5
- package/src/staking/rewardsFromReceipt.test.ts +5 -4
- package/src/staking/rewardsFromReceipt.ts +4 -3
- package/src/staking/unbondings.test.ts +16 -12
- package/src/staking/unbondings.ts +7 -5
- package/src/staking/validators/index.ts +30 -10
- package/src/staking/validators/monad.test.ts +57 -43
- package/src/staking/validators/monad.ts +55 -32
- package/src/staking/validators/monadResolver.ts +4 -3
- package/src/staking/validators/somnia.test.ts +14 -13
- package/src/staking/validators/somnia.ts +35 -19
- package/src/staking/validators/types.ts +2 -0
- package/src/staking/validators/zero_gravity.test.ts +48 -26
- package/src/staking/validators/zero_gravity.ts +14 -8
- package/src/staking/validators.integ.test.ts +2 -2
- package/src/staking/validators.test.ts +31 -26
- package/src/types/staking.ts +9 -2
|
@@ -13,6 +13,7 @@ import type {
|
|
|
13
13
|
TransferBlockOperation,
|
|
14
14
|
} from '@ledgerhq/coin-module-framework/api/index'
|
|
15
15
|
import type { MemoNotSupported, Operation } from '@ledgerhq/coin-module-framework/api/types'
|
|
16
|
+
import type { Logger } from '@ledgerhq/coin-module-framework/config'
|
|
16
17
|
import BigNumber from 'bignumber.js'
|
|
17
18
|
import eip55 from 'eip55'
|
|
18
19
|
import { InvalidExplorerResponse } from '../errors'
|
|
@@ -59,11 +60,13 @@ export const safeDate = (op: { timeStamp?: string; timestamp?: string }): Date =
|
|
|
59
60
|
export const etherscanOperationToOperations = (
|
|
60
61
|
address: string,
|
|
61
62
|
currencyId: string,
|
|
62
|
-
etherscanOp: EtherscanOperation
|
|
63
|
+
etherscanOp: EtherscanOperation,
|
|
64
|
+
logger: Logger
|
|
63
65
|
): Array<Operation<MemoNotSupported>> => {
|
|
64
66
|
const checksummedAddress = eip55.encode(address)
|
|
65
|
-
const from = safeEncodeEIP55(etherscanOp.from)
|
|
66
|
-
const to =
|
|
67
|
+
const from = safeEncodeEIP55(etherscanOp.from, logger)
|
|
68
|
+
const to =
|
|
69
|
+
safeEncodeEIP55(etherscanOp.to, logger) || safeEncodeEIP55(etherscanOp.contractAddress, logger)
|
|
67
70
|
const value = safeBigInt(etherscanOp.value)
|
|
68
71
|
const fees =
|
|
69
72
|
safeBigInt(etherscanOp.gasUsed) * safeBigInt(etherscanOp.gasPrice) +
|
|
@@ -89,6 +92,7 @@ export const etherscanOperationToOperations = (
|
|
|
89
92
|
const contractExtra = buildSmartContractDetails(
|
|
90
93
|
etherscanOp.to,
|
|
91
94
|
etherscanOp.input,
|
|
95
|
+
logger,
|
|
92
96
|
etherscanOp.contractAddress
|
|
93
97
|
)
|
|
94
98
|
|
|
@@ -131,11 +135,12 @@ export const etherscanOperationToOperations = (
|
|
|
131
135
|
export const etherscanERC20EventToOperations = (
|
|
132
136
|
address: string,
|
|
133
137
|
event: EtherscanERC20Event,
|
|
134
|
-
index = 0
|
|
138
|
+
index = 0,
|
|
139
|
+
logger: Logger
|
|
135
140
|
): Array<Operation<MemoNotSupported>> => {
|
|
136
141
|
const checksummedAddress = eip55.encode(address)
|
|
137
|
-
const from = safeEncodeEIP55(event.from)
|
|
138
|
-
const to = safeEncodeEIP55(event.to)
|
|
142
|
+
const from = safeEncodeEIP55(event.from, logger)
|
|
143
|
+
const to = safeEncodeEIP55(event.to, logger)
|
|
139
144
|
const contract = eip55.encode(event.contractAddress)
|
|
140
145
|
const value = safeBigInt(event.value)
|
|
141
146
|
const fees = safeBigInt(event.gasUsed) * safeBigInt(event.gasPrice)
|
|
@@ -186,11 +191,12 @@ export const etherscanERC20EventToOperations = (
|
|
|
186
191
|
export const etherscanERC721EventToOperations = (
|
|
187
192
|
address: string,
|
|
188
193
|
event: EtherscanERC721Event,
|
|
189
|
-
index = 0
|
|
194
|
+
index = 0,
|
|
195
|
+
logger: Logger
|
|
190
196
|
): Array<Operation<MemoNotSupported>> => {
|
|
191
197
|
const checksummedAddress = eip55.encode(address)
|
|
192
|
-
const from = safeEncodeEIP55(event.from)
|
|
193
|
-
const to = safeEncodeEIP55(event.to)
|
|
198
|
+
const from = safeEncodeEIP55(event.from, logger)
|
|
199
|
+
const to = safeEncodeEIP55(event.to, logger)
|
|
194
200
|
const contract = eip55.encode(event.contractAddress)
|
|
195
201
|
const fees = safeBigInt(event.gasUsed) * safeBigInt(event.gasPrice)
|
|
196
202
|
const date = safeDate(event)
|
|
@@ -239,11 +245,12 @@ export const etherscanERC721EventToOperations = (
|
|
|
239
245
|
export const etherscanERC1155EventToOperations = (
|
|
240
246
|
address: string,
|
|
241
247
|
event: EtherscanERC1155Event,
|
|
242
|
-
index = 0
|
|
248
|
+
index = 0,
|
|
249
|
+
logger: Logger
|
|
243
250
|
): Array<Operation<MemoNotSupported>> => {
|
|
244
251
|
const checksummedAddress = eip55.encode(address)
|
|
245
|
-
const from = safeEncodeEIP55(event.from)
|
|
246
|
-
const to = safeEncodeEIP55(event.to)
|
|
252
|
+
const from = safeEncodeEIP55(event.from, logger)
|
|
253
|
+
const to = safeEncodeEIP55(event.to, logger)
|
|
247
254
|
const contract = eip55.encode(event.contractAddress)
|
|
248
255
|
const value = safeBigInt(event.tokenValue) // value is representing the number of NFT transfered.
|
|
249
256
|
const fees = safeBigInt(event.gasUsed) * safeBigInt(event.gasPrice)
|
|
@@ -305,15 +312,16 @@ function isNonValueTransferInternalTx(
|
|
|
305
312
|
export const etherscanInternalTransactionToOperations = (
|
|
306
313
|
address: string,
|
|
307
314
|
internalTx: EtherscanInternalTransaction,
|
|
308
|
-
index = 0
|
|
315
|
+
index = 0,
|
|
316
|
+
logger: Logger
|
|
309
317
|
): Array<Operation<MemoNotSupported>> => {
|
|
310
318
|
// Phantom IN/OUT guard; `isInternalTransactionValid` applies the same filter on the `getBlock` path.
|
|
311
319
|
if (isNonValueTransferInternalTx(internalTx)) return []
|
|
312
320
|
|
|
313
321
|
const { hash, blockNumber, isError } = internalTx
|
|
314
322
|
const checksummedAddress = eip55.encode(address)
|
|
315
|
-
const from = safeEncodeEIP55(internalTx.from)
|
|
316
|
-
const to = safeEncodeEIP55(internalTx.to)
|
|
323
|
+
const from = safeEncodeEIP55(internalTx.from, logger)
|
|
324
|
+
const to = safeEncodeEIP55(internalTx.to, logger)
|
|
317
325
|
const value = safeBigInt(internalTx.value)
|
|
318
326
|
const hasFailed = isError === '1'
|
|
319
327
|
const date = safeDate(internalTx)
|
|
@@ -376,7 +384,8 @@ function isInternalTransactionValid(it: EtherscanInternalTransaction): boolean {
|
|
|
376
384
|
* but cannot move native ETH.
|
|
377
385
|
*/
|
|
378
386
|
export function internalTxsToOperationsByHash(
|
|
379
|
-
internalTxs: EtherscanInternalTransaction[]
|
|
387
|
+
internalTxs: EtherscanInternalTransaction[],
|
|
388
|
+
logger: Logger
|
|
380
389
|
): Map<string, BlockOperation[]> {
|
|
381
390
|
const byHash = new Map<string, BlockOperation[]>()
|
|
382
391
|
|
|
@@ -384,8 +393,8 @@ export function internalTxsToOperationsByHash(
|
|
|
384
393
|
if (!isInternalTransactionValid(it)) continue
|
|
385
394
|
|
|
386
395
|
const { from, to, value, hash } = it
|
|
387
|
-
const encodedFrom = safeEncodeEIP55(from)
|
|
388
|
-
const encodedTo = safeEncodeEIP55(to)
|
|
396
|
+
const encodedFrom = safeEncodeEIP55(from, logger)
|
|
397
|
+
const encodedTo = safeEncodeEIP55(to, logger)
|
|
389
398
|
const amount = BigInt(value)
|
|
390
399
|
|
|
391
400
|
const ops: BlockOperation[] = []
|
|
@@ -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 { testLogger } from '../fixtures/context.fixtures'
|
|
12
13
|
import {
|
|
13
14
|
ledgerERC1155EventToOperations,
|
|
14
15
|
ledgerERC20EventToOperations,
|
|
@@ -109,7 +110,7 @@ describe('EVM Family', () => {
|
|
|
109
110
|
}
|
|
110
111
|
|
|
111
112
|
expect(
|
|
112
|
-
ledgerOperationToOperations(unrelatedAddress, 'ethereum', ledgerExplorerOp)
|
|
113
|
+
ledgerOperationToOperations(unrelatedAddress, 'ethereum', ledgerExplorerOp, testLogger)
|
|
113
114
|
).toEqual([expectedOperation])
|
|
114
115
|
})
|
|
115
116
|
|
|
@@ -173,9 +174,9 @@ describe('EVM Family', () => {
|
|
|
173
174
|
details: { sequence: 75 },
|
|
174
175
|
}
|
|
175
176
|
|
|
176
|
-
expect(
|
|
177
|
-
|
|
178
|
-
])
|
|
177
|
+
expect(
|
|
178
|
+
ledgerOperationToOperations(address, currencyId, ledgerOperation, testLogger)
|
|
179
|
+
).toEqual([expectedOperation])
|
|
179
180
|
})
|
|
180
181
|
|
|
181
182
|
it('should convert ledger explorer coin out operation to an Operation', () => {
|
|
@@ -238,9 +239,9 @@ describe('EVM Family', () => {
|
|
|
238
239
|
details: { sequence: 75 },
|
|
239
240
|
}
|
|
240
241
|
|
|
241
|
-
expect(
|
|
242
|
-
|
|
243
|
-
])
|
|
242
|
+
expect(
|
|
243
|
+
ledgerOperationToOperations(address, currencyId, ledgerOperation, testLogger)
|
|
244
|
+
).toEqual([expectedOperation])
|
|
244
245
|
})
|
|
245
246
|
|
|
246
247
|
it('should convert ledger explorer coin in operation to an Operation', () => {
|
|
@@ -303,9 +304,9 @@ describe('EVM Family', () => {
|
|
|
303
304
|
details: { sequence: 75 },
|
|
304
305
|
}
|
|
305
306
|
|
|
306
|
-
expect(
|
|
307
|
-
|
|
308
|
-
])
|
|
307
|
+
expect(
|
|
308
|
+
ledgerOperationToOperations(address, currencyId, ledgerOperation, testLogger)
|
|
309
|
+
).toEqual([expectedOperation])
|
|
309
310
|
})
|
|
310
311
|
|
|
311
312
|
it('should convert ledger explorer coin none operation to an Operation', () => {
|
|
@@ -368,9 +369,9 @@ describe('EVM Family', () => {
|
|
|
368
369
|
details: { sequence: 75 },
|
|
369
370
|
}
|
|
370
371
|
|
|
371
|
-
expect(
|
|
372
|
-
|
|
373
|
-
])
|
|
372
|
+
expect(
|
|
373
|
+
ledgerOperationToOperations(address, currencyId, ledgerOperation, testLogger)
|
|
374
|
+
).toEqual([expectedOperation])
|
|
374
375
|
})
|
|
375
376
|
|
|
376
377
|
it('should convert ledger explorer legacy coin none operation (smart contract creation) to an Operation', () => {
|
|
@@ -438,9 +439,9 @@ describe('EVM Family', () => {
|
|
|
438
439
|
details: { sequence: 3 },
|
|
439
440
|
}
|
|
440
441
|
|
|
441
|
-
expect(
|
|
442
|
-
|
|
443
|
-
])
|
|
442
|
+
expect(
|
|
443
|
+
ledgerOperationToOperations(address, currencyId, ledgerOperation, testLogger)
|
|
444
|
+
).toEqual([expectedOperation])
|
|
444
445
|
})
|
|
445
446
|
|
|
446
447
|
it('should convert ledger explorer self send coin operation to 2 Operations', () => {
|
|
@@ -515,10 +516,9 @@ describe('EVM Family', () => {
|
|
|
515
516
|
details: { sequence: 75 },
|
|
516
517
|
}
|
|
517
518
|
|
|
518
|
-
expect(
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
])
|
|
519
|
+
expect(
|
|
520
|
+
ledgerOperationToOperations(address, currencyId, ledgerOperation, testLogger)
|
|
521
|
+
).toEqual([expectedOperation1, expectedOperation2])
|
|
522
522
|
})
|
|
523
523
|
|
|
524
524
|
it('should return an operation with the expected amount', () => {
|
|
@@ -564,14 +564,24 @@ describe('EVM Family', () => {
|
|
|
564
564
|
|
|
565
565
|
// Successful Op
|
|
566
566
|
expect(
|
|
567
|
-
ledgerOperationToOperations(
|
|
567
|
+
ledgerOperationToOperations(
|
|
568
|
+
unrelatedAddress,
|
|
569
|
+
'ethereum',
|
|
570
|
+
ledgerExplorerNoneOp,
|
|
571
|
+
testLogger
|
|
572
|
+
)[0].value
|
|
568
573
|
).toEqual(BigInt(ledgerExplorerNoneOp.value))
|
|
569
574
|
// Failing Op
|
|
570
575
|
expect(
|
|
571
|
-
ledgerOperationToOperations(
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
576
|
+
ledgerOperationToOperations(
|
|
577
|
+
unrelatedAddress,
|
|
578
|
+
'ethereum',
|
|
579
|
+
{
|
|
580
|
+
...ledgerExplorerNoneOp,
|
|
581
|
+
status: 0,
|
|
582
|
+
},
|
|
583
|
+
testLogger
|
|
584
|
+
)[0].value
|
|
575
585
|
).toEqual(BigInt(ledgerExplorerNoneOp.value))
|
|
576
586
|
|
|
577
587
|
const ledgerExplorerFeesOp: LedgerExplorerOperation = {
|
|
@@ -614,14 +624,20 @@ describe('EVM Family', () => {
|
|
|
614
624
|
|
|
615
625
|
// Successful Op (value = transferred only; fee is separate; Ledger Wallet adds fee in bridge)
|
|
616
626
|
expect(
|
|
617
|
-
ledgerOperationToOperations(address, currencyId, ledgerExplorerFeesOp)[0]
|
|
627
|
+
ledgerOperationToOperations(address, currencyId, ledgerExplorerFeesOp, testLogger)[0]
|
|
628
|
+
.value
|
|
618
629
|
).toEqual(BigInt(ledgerExplorerFeesOp.value))
|
|
619
630
|
// Failing Op (value = tx value, same as success)
|
|
620
631
|
expect(
|
|
621
|
-
ledgerOperationToOperations(
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
632
|
+
ledgerOperationToOperations(
|
|
633
|
+
address,
|
|
634
|
+
currencyId,
|
|
635
|
+
{
|
|
636
|
+
...ledgerExplorerFeesOp,
|
|
637
|
+
status: 0,
|
|
638
|
+
},
|
|
639
|
+
testLogger
|
|
640
|
+
)[0].value
|
|
625
641
|
).toEqual(BigInt(ledgerExplorerFeesOp.value))
|
|
626
642
|
|
|
627
643
|
const ledgerOperationOut: LedgerExplorerOperation = {
|
|
@@ -663,14 +679,20 @@ describe('EVM Family', () => {
|
|
|
663
679
|
|
|
664
680
|
// Successful Op (value = transferred only; fee is separate; Ledger Wallet adds fee in bridge)
|
|
665
681
|
expect(
|
|
666
|
-
ledgerOperationToOperations(address, currencyId, ledgerOperationOut)[0]
|
|
682
|
+
ledgerOperationToOperations(address, currencyId, ledgerOperationOut, testLogger)[0]
|
|
683
|
+
.value
|
|
667
684
|
).toEqual(BigInt(ledgerOperationOut.value))
|
|
668
685
|
// Failing Op (value = tx value, same as success)
|
|
669
686
|
expect(
|
|
670
|
-
ledgerOperationToOperations(
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
687
|
+
ledgerOperationToOperations(
|
|
688
|
+
address,
|
|
689
|
+
currencyId,
|
|
690
|
+
{
|
|
691
|
+
...ledgerOperationOut,
|
|
692
|
+
status: 0,
|
|
693
|
+
},
|
|
694
|
+
testLogger
|
|
695
|
+
)[0].value
|
|
674
696
|
).toEqual(BigInt(ledgerOperationOut.value))
|
|
675
697
|
|
|
676
698
|
const ledgerOperationIn: LedgerExplorerOperation = {
|
|
@@ -712,12 +734,16 @@ describe('EVM Family', () => {
|
|
|
712
734
|
|
|
713
735
|
// Successful Op
|
|
714
736
|
expect(
|
|
715
|
-
ledgerOperationToOperations(address, currencyId, ledgerOperationIn)[0].value
|
|
737
|
+
ledgerOperationToOperations(address, currencyId, ledgerOperationIn, testLogger)[0].value
|
|
716
738
|
).toEqual(BigInt(ledgerOperationOut.value))
|
|
717
739
|
// Failing Op
|
|
718
740
|
expect(
|
|
719
|
-
ledgerOperationToOperations(
|
|
720
|
-
|
|
741
|
+
ledgerOperationToOperations(
|
|
742
|
+
address,
|
|
743
|
+
currencyId,
|
|
744
|
+
{ ...ledgerOperationIn, status: 0 },
|
|
745
|
+
testLogger
|
|
746
|
+
)[0].value
|
|
721
747
|
).toEqual(BigInt(ledgerOperationOut.value))
|
|
722
748
|
})
|
|
723
749
|
|
|
@@ -752,7 +778,7 @@ describe('EVM Family', () => {
|
|
|
752
778
|
},
|
|
753
779
|
}
|
|
754
780
|
|
|
755
|
-
const result = ledgerOperationToOperations(address, currencyId, ledgerOp)
|
|
781
|
+
const result = ledgerOperationToOperations(address, currencyId, ledgerOp, testLogger)
|
|
756
782
|
|
|
757
783
|
expect(result).toHaveLength(1)
|
|
758
784
|
expect(result[0].recipients).toEqual([])
|
|
@@ -789,7 +815,7 @@ describe('EVM Family', () => {
|
|
|
789
815
|
},
|
|
790
816
|
}
|
|
791
817
|
|
|
792
|
-
const result = ledgerOperationToOperations(address, currencyId, ledgerOp)
|
|
818
|
+
const result = ledgerOperationToOperations(address, currencyId, ledgerOp, testLogger)
|
|
793
819
|
|
|
794
820
|
expect(result).toHaveLength(1)
|
|
795
821
|
expect(result[0].senders).toEqual([])
|
|
@@ -834,7 +860,12 @@ describe('EVM Family', () => {
|
|
|
834
860
|
},
|
|
835
861
|
}
|
|
836
862
|
|
|
837
|
-
const result = ledgerOperationToOperations(
|
|
863
|
+
const result = ledgerOperationToOperations(
|
|
864
|
+
monadAddress,
|
|
865
|
+
monadCurrencyId,
|
|
866
|
+
ledgerOp,
|
|
867
|
+
testLogger
|
|
868
|
+
)
|
|
838
869
|
|
|
839
870
|
expect(result).toHaveLength(1)
|
|
840
871
|
expect(result[0].type).toBe('WITHDRAW_UNBONDED')
|
|
@@ -870,9 +901,9 @@ describe('EVM Family', () => {
|
|
|
870
901
|
},
|
|
871
902
|
}
|
|
872
903
|
|
|
873
|
-
expect(
|
|
874
|
-
|
|
875
|
-
])
|
|
904
|
+
expect(
|
|
905
|
+
ledgerERC20EventToOperations(address, coinOperation, ledgerERC20Event, 0, testLogger)
|
|
906
|
+
).toEqual([expectedOperation])
|
|
876
907
|
})
|
|
877
908
|
|
|
878
909
|
it('should convert a ledger explorer usdc in event to an Operation', () => {
|
|
@@ -903,9 +934,9 @@ describe('EVM Family', () => {
|
|
|
903
934
|
},
|
|
904
935
|
}
|
|
905
936
|
|
|
906
|
-
expect(
|
|
907
|
-
|
|
908
|
-
])
|
|
937
|
+
expect(
|
|
938
|
+
ledgerERC20EventToOperations(address, coinOperation, ledgerERC20Event, 0, testLogger)
|
|
939
|
+
).toEqual([expectedOperation])
|
|
909
940
|
})
|
|
910
941
|
|
|
911
942
|
it('should ignore a ledger explorer usdc none event and return empty array', () => {
|
|
@@ -916,7 +947,9 @@ describe('EVM Family', () => {
|
|
|
916
947
|
count: '100000000000000',
|
|
917
948
|
}
|
|
918
949
|
|
|
919
|
-
expect(
|
|
950
|
+
expect(
|
|
951
|
+
ledgerERC20EventToOperations(address, coinOperation, ledgerERC20Event, 0, testLogger)
|
|
952
|
+
).toEqual([])
|
|
920
953
|
})
|
|
921
954
|
|
|
922
955
|
it('should convert a ledger explorer self usdc event into 2 Operations', () => {
|
|
@@ -966,10 +999,9 @@ describe('EVM Family', () => {
|
|
|
966
999
|
},
|
|
967
1000
|
}
|
|
968
1001
|
|
|
969
|
-
expect(
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
])
|
|
1002
|
+
expect(
|
|
1003
|
+
ledgerERC20EventToOperations(address, coinOperation, ledgerERC20Event, 0, testLogger)
|
|
1004
|
+
).toEqual([expectedOperation1, expectedOperation2])
|
|
973
1005
|
})
|
|
974
1006
|
|
|
975
1007
|
it('should produce empty recipients when to is an empty string', () => {
|
|
@@ -980,7 +1012,13 @@ describe('EVM Family', () => {
|
|
|
980
1012
|
count: '100000000000000',
|
|
981
1013
|
}
|
|
982
1014
|
|
|
983
|
-
const result = ledgerERC20EventToOperations(
|
|
1015
|
+
const result = ledgerERC20EventToOperations(
|
|
1016
|
+
address,
|
|
1017
|
+
coinOperation,
|
|
1018
|
+
ledgerERC20Event,
|
|
1019
|
+
0,
|
|
1020
|
+
testLogger
|
|
1021
|
+
)
|
|
984
1022
|
|
|
985
1023
|
expect(result).toHaveLength(1)
|
|
986
1024
|
expect(result[0].recipients).toEqual([])
|
|
@@ -1019,9 +1057,9 @@ describe('EVM Family', () => {
|
|
|
1019
1057
|
},
|
|
1020
1058
|
}
|
|
1021
1059
|
|
|
1022
|
-
expect(
|
|
1023
|
-
|
|
1024
|
-
])
|
|
1060
|
+
expect(
|
|
1061
|
+
ledgerERC721EventToOperations(address, coinOperation, ledgerERC721Event, 0, testLogger)
|
|
1062
|
+
).toEqual([expectedOperation])
|
|
1025
1063
|
})
|
|
1026
1064
|
|
|
1027
1065
|
it('should convert a ledger explorer erc721 nft in event to an Operation', () => {
|
|
@@ -1055,9 +1093,9 @@ describe('EVM Family', () => {
|
|
|
1055
1093
|
},
|
|
1056
1094
|
}
|
|
1057
1095
|
|
|
1058
|
-
expect(
|
|
1059
|
-
|
|
1060
|
-
])
|
|
1096
|
+
expect(
|
|
1097
|
+
ledgerERC721EventToOperations(address, coinOperation, ledgerERC721Event, 0, testLogger)
|
|
1098
|
+
).toEqual([expectedOperation])
|
|
1061
1099
|
})
|
|
1062
1100
|
|
|
1063
1101
|
it('should ignore a ledger explorer erc721 nft none event and return empty array', () => {
|
|
@@ -1069,9 +1107,9 @@ describe('EVM Family', () => {
|
|
|
1069
1107
|
'49183440411075624253866807957299276245920874859439606792850319902048050479106',
|
|
1070
1108
|
}
|
|
1071
1109
|
|
|
1072
|
-
expect(
|
|
1073
|
-
|
|
1074
|
-
)
|
|
1110
|
+
expect(
|
|
1111
|
+
ledgerERC721EventToOperations(address, coinOperation, ledgerERC721Event, 0, testLogger)
|
|
1112
|
+
).toEqual([])
|
|
1075
1113
|
})
|
|
1076
1114
|
|
|
1077
1115
|
it('should convert a ledger explorer erc721 nft event into 2 Operations', () => {
|
|
@@ -1120,10 +1158,9 @@ describe('EVM Family', () => {
|
|
|
1120
1158
|
},
|
|
1121
1159
|
}
|
|
1122
1160
|
|
|
1123
|
-
expect(
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
])
|
|
1161
|
+
expect(
|
|
1162
|
+
ledgerERC721EventToOperations(address, coinOperation, ledgerERC721Event, 0, testLogger)
|
|
1163
|
+
).toEqual([expectedOperation1, expectedOperation2])
|
|
1127
1164
|
})
|
|
1128
1165
|
|
|
1129
1166
|
it('should produce empty recipients when receiver is an empty string', () => {
|
|
@@ -1135,7 +1172,13 @@ describe('EVM Family', () => {
|
|
|
1135
1172
|
'49183440411075624253866807957299276245920874859439606792850319902048050479106',
|
|
1136
1173
|
}
|
|
1137
1174
|
|
|
1138
|
-
const result = ledgerERC721EventToOperations(
|
|
1175
|
+
const result = ledgerERC721EventToOperations(
|
|
1176
|
+
address,
|
|
1177
|
+
coinOperation,
|
|
1178
|
+
ledgerERC721Event,
|
|
1179
|
+
0,
|
|
1180
|
+
testLogger
|
|
1181
|
+
)
|
|
1139
1182
|
|
|
1140
1183
|
// sender matches account → NFT_OUT is emitted, but recipients must not contain empty string
|
|
1141
1184
|
expect(result).toHaveLength(1)
|
|
@@ -1200,7 +1243,13 @@ describe('EVM Family', () => {
|
|
|
1200
1243
|
}
|
|
1201
1244
|
|
|
1202
1245
|
expect(
|
|
1203
|
-
ledgerERC1155EventToOperations(
|
|
1246
|
+
ledgerERC1155EventToOperations(
|
|
1247
|
+
address,
|
|
1248
|
+
coinOperation,
|
|
1249
|
+
ledgerERC1155Event,
|
|
1250
|
+
0,
|
|
1251
|
+
testLogger
|
|
1252
|
+
)
|
|
1204
1253
|
).toEqual([expectedOperation1, expectedOperation2])
|
|
1205
1254
|
})
|
|
1206
1255
|
|
|
@@ -1260,7 +1309,13 @@ describe('EVM Family', () => {
|
|
|
1260
1309
|
}
|
|
1261
1310
|
|
|
1262
1311
|
expect(
|
|
1263
|
-
ledgerERC1155EventToOperations(
|
|
1312
|
+
ledgerERC1155EventToOperations(
|
|
1313
|
+
address,
|
|
1314
|
+
coinOperation,
|
|
1315
|
+
ledgerERC1155Event,
|
|
1316
|
+
0,
|
|
1317
|
+
testLogger
|
|
1318
|
+
)
|
|
1264
1319
|
).toEqual([expectedOperation1, expectedOperation2])
|
|
1265
1320
|
})
|
|
1266
1321
|
|
|
@@ -1283,7 +1338,13 @@ describe('EVM Family', () => {
|
|
|
1283
1338
|
}
|
|
1284
1339
|
|
|
1285
1340
|
expect(
|
|
1286
|
-
ledgerERC1155EventToOperations(
|
|
1341
|
+
ledgerERC1155EventToOperations(
|
|
1342
|
+
address,
|
|
1343
|
+
coinOperation,
|
|
1344
|
+
ledgerERC1155Event,
|
|
1345
|
+
0,
|
|
1346
|
+
testLogger
|
|
1347
|
+
)
|
|
1287
1348
|
).toEqual([])
|
|
1288
1349
|
})
|
|
1289
1350
|
|
|
@@ -1375,7 +1436,13 @@ describe('EVM Family', () => {
|
|
|
1375
1436
|
}
|
|
1376
1437
|
|
|
1377
1438
|
expect(
|
|
1378
|
-
ledgerERC1155EventToOperations(
|
|
1439
|
+
ledgerERC1155EventToOperations(
|
|
1440
|
+
address,
|
|
1441
|
+
coinOperation,
|
|
1442
|
+
ledgerERC1155Event,
|
|
1443
|
+
0,
|
|
1444
|
+
testLogger
|
|
1445
|
+
)
|
|
1379
1446
|
).toEqual([
|
|
1380
1447
|
expectedOperation1,
|
|
1381
1448
|
expectedOperation2,
|
|
@@ -1393,7 +1460,13 @@ describe('EVM Family', () => {
|
|
|
1393
1460
|
transfers: [{ id: '10371', value: '1' }],
|
|
1394
1461
|
}
|
|
1395
1462
|
|
|
1396
|
-
const result = ledgerERC1155EventToOperations(
|
|
1463
|
+
const result = ledgerERC1155EventToOperations(
|
|
1464
|
+
address,
|
|
1465
|
+
coinOperation,
|
|
1466
|
+
ledgerERC1155Event,
|
|
1467
|
+
0,
|
|
1468
|
+
testLogger
|
|
1469
|
+
)
|
|
1397
1470
|
|
|
1398
1471
|
// sender matches account → NFT_OUT is emitted, but recipients must not contain empty string
|
|
1399
1472
|
expect(result).toHaveLength(1)
|
|
@@ -1417,7 +1490,9 @@ describe('EVM Family', () => {
|
|
|
1417
1490
|
ledgerInternalTransactionToOperations(
|
|
1418
1491
|
address,
|
|
1419
1492
|
{ ...coinOperation, tx: { ...coinOperation.tx, failed: true } },
|
|
1420
|
-
ledgerAction
|
|
1493
|
+
ledgerAction,
|
|
1494
|
+
0,
|
|
1495
|
+
testLogger
|
|
1421
1496
|
)
|
|
1422
1497
|
).toEqual([])
|
|
1423
1498
|
})
|
|
@@ -1445,7 +1520,13 @@ describe('EVM Family', () => {
|
|
|
1445
1520
|
}
|
|
1446
1521
|
|
|
1447
1522
|
expect(
|
|
1448
|
-
ledgerInternalTransactionToOperations(
|
|
1523
|
+
ledgerInternalTransactionToOperations(
|
|
1524
|
+
address,
|
|
1525
|
+
coinOperation,
|
|
1526
|
+
ledgerAction,
|
|
1527
|
+
0,
|
|
1528
|
+
testLogger
|
|
1529
|
+
)
|
|
1449
1530
|
).toEqual([expectedOperation])
|
|
1450
1531
|
})
|
|
1451
1532
|
|
|
@@ -1472,7 +1553,13 @@ describe('EVM Family', () => {
|
|
|
1472
1553
|
}
|
|
1473
1554
|
|
|
1474
1555
|
expect(
|
|
1475
|
-
ledgerInternalTransactionToOperations(
|
|
1556
|
+
ledgerInternalTransactionToOperations(
|
|
1557
|
+
address,
|
|
1558
|
+
coinOperation,
|
|
1559
|
+
ledgerAction,
|
|
1560
|
+
0,
|
|
1561
|
+
testLogger
|
|
1562
|
+
)
|
|
1476
1563
|
).toEqual([expectedOperation])
|
|
1477
1564
|
})
|
|
1478
1565
|
|
|
@@ -1508,14 +1595,32 @@ describe('EVM Family', () => {
|
|
|
1508
1595
|
}
|
|
1509
1596
|
|
|
1510
1597
|
expect(
|
|
1511
|
-
ledgerInternalTransactionToOperations(
|
|
1598
|
+
ledgerInternalTransactionToOperations(
|
|
1599
|
+
address,
|
|
1600
|
+
coinOperationFees,
|
|
1601
|
+
ledgerActionOutOrFees,
|
|
1602
|
+
0,
|
|
1603
|
+
testLogger
|
|
1604
|
+
)
|
|
1512
1605
|
).toEqual([])
|
|
1513
1606
|
expect(
|
|
1514
|
-
ledgerInternalTransactionToOperations(
|
|
1607
|
+
ledgerInternalTransactionToOperations(
|
|
1608
|
+
address,
|
|
1609
|
+
coinOperationOut,
|
|
1610
|
+
ledgerActionOutOrFees,
|
|
1611
|
+
0,
|
|
1612
|
+
testLogger
|
|
1613
|
+
)
|
|
1515
1614
|
).toEqual([])
|
|
1516
1615
|
|
|
1517
1616
|
expect(
|
|
1518
|
-
ledgerInternalTransactionToOperations(
|
|
1617
|
+
ledgerInternalTransactionToOperations(
|
|
1618
|
+
address,
|
|
1619
|
+
coinOperationIn,
|
|
1620
|
+
ledgerActionIn,
|
|
1621
|
+
0,
|
|
1622
|
+
testLogger
|
|
1623
|
+
)
|
|
1519
1624
|
).toEqual([])
|
|
1520
1625
|
})
|
|
1521
1626
|
|
|
@@ -1540,7 +1645,9 @@ describe('EVM Family', () => {
|
|
|
1540
1645
|
ledgerInternalTransactionToOperations(
|
|
1541
1646
|
address,
|
|
1542
1647
|
coinOpOutWithTransfer,
|
|
1543
|
-
actionSameFromToDifferentValue
|
|
1648
|
+
actionSameFromToDifferentValue,
|
|
1649
|
+
0,
|
|
1650
|
+
testLogger
|
|
1544
1651
|
)
|
|
1545
1652
|
).toEqual([])
|
|
1546
1653
|
|
|
@@ -1552,7 +1659,9 @@ describe('EVM Family', () => {
|
|
|
1552
1659
|
const result = ledgerInternalTransactionToOperations(
|
|
1553
1660
|
address,
|
|
1554
1661
|
coinOpOutWithTransfer,
|
|
1555
|
-
actionDifferentValue
|
|
1662
|
+
actionDifferentValue,
|
|
1663
|
+
0,
|
|
1664
|
+
testLogger
|
|
1556
1665
|
)
|
|
1557
1666
|
expect(result).toHaveLength(1)
|
|
1558
1667
|
expect(result[0].value.toString()).toBe('1')
|
|
@@ -1570,7 +1679,13 @@ describe('EVM Family', () => {
|
|
|
1570
1679
|
}
|
|
1571
1680
|
|
|
1572
1681
|
expect(
|
|
1573
|
-
ledgerInternalTransactionToOperations(
|
|
1682
|
+
ledgerInternalTransactionToOperations(
|
|
1683
|
+
address,
|
|
1684
|
+
coinOperation,
|
|
1685
|
+
ledgerAction,
|
|
1686
|
+
0,
|
|
1687
|
+
testLogger
|
|
1688
|
+
)
|
|
1574
1689
|
).toEqual([])
|
|
1575
1690
|
})
|
|
1576
1691
|
|
|
@@ -1611,7 +1726,13 @@ describe('EVM Family', () => {
|
|
|
1611
1726
|
]
|
|
1612
1727
|
|
|
1613
1728
|
expect(
|
|
1614
|
-
ledgerInternalTransactionToOperations(
|
|
1729
|
+
ledgerInternalTransactionToOperations(
|
|
1730
|
+
address,
|
|
1731
|
+
coinOperation,
|
|
1732
|
+
ledgerAction,
|
|
1733
|
+
0,
|
|
1734
|
+
testLogger
|
|
1735
|
+
)
|
|
1615
1736
|
).toEqual(expectedOperations)
|
|
1616
1737
|
})
|
|
1617
1738
|
|
|
@@ -1626,7 +1747,13 @@ describe('EVM Family', () => {
|
|
|
1626
1747
|
error: null,
|
|
1627
1748
|
}
|
|
1628
1749
|
|
|
1629
|
-
const result = ledgerInternalTransactionToOperations(
|
|
1750
|
+
const result = ledgerInternalTransactionToOperations(
|
|
1751
|
+
address,
|
|
1752
|
+
coinOperation,
|
|
1753
|
+
ledgerAction,
|
|
1754
|
+
0,
|
|
1755
|
+
testLogger
|
|
1756
|
+
)
|
|
1630
1757
|
|
|
1631
1758
|
// from matches account → OUT is emitted, but recipients must not contain empty string
|
|
1632
1759
|
expect(result).toHaveLength(1)
|