@ledgerhq/coin-evm 15.0.0 → 16.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 +40 -0
- package/lib/adapters/etherscan.d.ts.map +1 -1
- package/lib/adapters/etherscan.js +14 -0
- package/lib/adapters/etherscan.js.map +1 -1
- package/lib/adapters/ledger.d.ts.map +1 -1
- package/lib/adapters/ledger.js +2 -0
- package/lib/adapters/ledger.js.map +1 -1
- package/lib/api/index.d.ts +1 -1
- package/lib/api/index.d.ts.map +1 -1
- package/lib/api/index.js +14 -15
- package/lib/api/index.js.map +1 -1
- package/lib/chains.d.ts +7 -0
- package/lib/chains.d.ts.map +1 -1
- package/lib/chains.js +17 -1
- package/lib/chains.js.map +1 -1
- package/lib/config.d.ts +1 -1
- package/lib/config.d.ts.map +1 -1
- package/lib/config.js +2 -1
- package/lib/config.js.map +1 -1
- package/lib/errors.d.ts +11 -0
- package/lib/errors.d.ts.map +1 -1
- package/lib/errors.js +17 -1
- package/lib/errors.js.map +1 -1
- package/lib/logic/broadcast.d.ts +1 -1
- package/lib/logic/broadcast.d.ts.map +1 -1
- package/lib/logic/broadcast.js +2 -2
- package/lib/logic/broadcast.js.map +1 -1
- package/lib/logic/craftTransaction.d.ts +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 +1 -1
- package/lib/logic/estimateFees.d.ts.map +1 -1
- package/lib/logic/estimateFees.js +19 -4
- package/lib/logic/estimateFees.js.map +1 -1
- package/lib/logic/getBalance.d.ts +1 -2
- package/lib/logic/getBalance.d.ts.map +1 -1
- package/lib/logic/getBalance.js +5 -6
- package/lib/logic/getBalance.js.map +1 -1
- package/lib/logic/getBlock.d.ts +1 -1
- package/lib/logic/getBlock.d.ts.map +1 -1
- package/lib/logic/getBlock.js +23 -6
- package/lib/logic/getBlock.js.map +1 -1
- package/lib/logic/getBlockInfo.d.ts +1 -1
- package/lib/logic/getBlockInfo.d.ts.map +1 -1
- package/lib/logic/getBlockInfo.js +2 -2
- package/lib/logic/getBlockInfo.js.map +1 -1
- package/lib/logic/getNextSequence.d.ts +1 -1
- package/lib/logic/getNextSequence.d.ts.map +1 -1
- package/lib/logic/getNextSequence.js +2 -2
- package/lib/logic/getNextSequence.js.map +1 -1
- package/lib/logic/getStakes.d.ts +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/lastBlock.d.ts +1 -1
- package/lib/logic/lastBlock.d.ts.map +1 -1
- package/lib/logic/lastBlock.js +2 -2
- package/lib/logic/lastBlock.js.map +1 -1
- package/lib/logic/listOperations.d.ts +1 -1
- package/lib/logic/listOperations.d.ts.map +1 -1
- package/lib/logic/listOperations.js +4 -2
- package/lib/logic/listOperations.js.map +1 -1
- package/lib/logic/validateIntent.d.ts +1 -1
- package/lib/logic/validateIntent.d.ts.map +1 -1
- package/lib/logic/validateIntent.js +3 -3
- package/lib/logic/validateIntent.js.map +1 -1
- package/lib/logic.d.ts.map +1 -1
- package/lib/logic.js +5 -10
- package/lib/logic.js.map +1 -1
- package/lib/network/node/explorerProxy.d.ts.map +1 -1
- package/lib/network/node/explorerProxy.js +2 -0
- package/lib/network/node/explorerProxy.js.map +1 -1
- package/lib/network/node/ledger.d.ts.map +1 -1
- package/lib/network/node/ledger.js +2 -9
- package/lib/network/node/ledger.js.map +1 -1
- package/lib/network/node/rpc.common.d.ts.map +1 -1
- package/lib/network/node/rpc.common.js +18 -9
- package/lib/network/node/rpc.common.js.map +1 -1
- package/lib/network/node/types.d.ts +3 -1
- package/lib/network/node/types.d.ts.map +1 -1
- package/lib/network/node/types.js.map +1 -1
- package/lib/staking/detectOperationType.js +1 -1
- package/lib/staking/validators/index.d.ts +1 -1
- package/lib/staking/validators/index.d.ts.map +1 -1
- package/lib/staking/validators/index.js +2 -2
- package/lib/staking/validators/index.js.map +1 -1
- package/lib/staking/validators/monadResolver.js +1 -1
- package/lib/staking/validators/monadResolver.js.map +1 -1
- package/lib-es/adapters/etherscan.d.ts.map +1 -1
- package/lib-es/adapters/etherscan.js +14 -0
- package/lib-es/adapters/etherscan.js.map +1 -1
- package/lib-es/adapters/ledger.d.ts.map +1 -1
- package/lib-es/adapters/ledger.js +2 -0
- package/lib-es/adapters/ledger.js.map +1 -1
- package/lib-es/api/index.d.ts +1 -1
- package/lib-es/api/index.d.ts.map +1 -1
- package/lib-es/api/index.js +14 -15
- package/lib-es/api/index.js.map +1 -1
- package/lib-es/chains.d.ts +7 -0
- package/lib-es/chains.d.ts.map +1 -1
- package/lib-es/chains.js +16 -0
- package/lib-es/chains.js.map +1 -1
- package/lib-es/config.d.ts +1 -1
- package/lib-es/config.d.ts.map +1 -1
- package/lib-es/config.js +1 -1
- package/lib-es/config.js.map +1 -1
- package/lib-es/errors.d.ts +11 -0
- package/lib-es/errors.d.ts.map +1 -1
- package/lib-es/errors.js +15 -0
- package/lib-es/errors.js.map +1 -1
- package/lib-es/logic/broadcast.d.ts +1 -1
- package/lib-es/logic/broadcast.d.ts.map +1 -1
- package/lib-es/logic/broadcast.js +2 -2
- package/lib-es/logic/broadcast.js.map +1 -1
- package/lib-es/logic/craftTransaction.d.ts +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 +1 -1
- package/lib-es/logic/estimateFees.d.ts.map +1 -1
- package/lib-es/logic/estimateFees.js +19 -4
- package/lib-es/logic/estimateFees.js.map +1 -1
- package/lib-es/logic/getBalance.d.ts +1 -2
- package/lib-es/logic/getBalance.d.ts.map +1 -1
- package/lib-es/logic/getBalance.js +5 -6
- package/lib-es/logic/getBalance.js.map +1 -1
- package/lib-es/logic/getBlock.d.ts +1 -1
- package/lib-es/logic/getBlock.d.ts.map +1 -1
- package/lib-es/logic/getBlock.js +23 -6
- package/lib-es/logic/getBlock.js.map +1 -1
- package/lib-es/logic/getBlockInfo.d.ts +1 -1
- package/lib-es/logic/getBlockInfo.d.ts.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 +1 -1
- package/lib-es/logic/getNextSequence.d.ts.map +1 -1
- package/lib-es/logic/getNextSequence.js +2 -2
- package/lib-es/logic/getNextSequence.js.map +1 -1
- package/lib-es/logic/getStakes.d.ts +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/lastBlock.d.ts +1 -1
- package/lib-es/logic/lastBlock.d.ts.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 +1 -1
- package/lib-es/logic/listOperations.d.ts.map +1 -1
- package/lib-es/logic/listOperations.js +4 -2
- package/lib-es/logic/listOperations.js.map +1 -1
- package/lib-es/logic/validateIntent.d.ts +1 -1
- package/lib-es/logic/validateIntent.d.ts.map +1 -1
- package/lib-es/logic/validateIntent.js +3 -3
- package/lib-es/logic/validateIntent.js.map +1 -1
- package/lib-es/logic.d.ts.map +1 -1
- package/lib-es/logic.js +6 -11
- package/lib-es/logic.js.map +1 -1
- package/lib-es/network/node/explorerProxy.d.ts.map +1 -1
- package/lib-es/network/node/explorerProxy.js +2 -0
- package/lib-es/network/node/explorerProxy.js.map +1 -1
- package/lib-es/network/node/ledger.d.ts.map +1 -1
- package/lib-es/network/node/ledger.js +3 -10
- package/lib-es/network/node/ledger.js.map +1 -1
- package/lib-es/network/node/rpc.common.d.ts.map +1 -1
- package/lib-es/network/node/rpc.common.js +19 -10
- package/lib-es/network/node/rpc.common.js.map +1 -1
- package/lib-es/network/node/types.d.ts +3 -1
- package/lib-es/network/node/types.d.ts.map +1 -1
- package/lib-es/network/node/types.js.map +1 -1
- package/lib-es/staking/detectOperationType.js +1 -1
- package/lib-es/staking/validators/index.d.ts +1 -1
- package/lib-es/staking/validators/index.d.ts.map +1 -1
- package/lib-es/staking/validators/index.js +2 -2
- package/lib-es/staking/validators/index.js.map +1 -1
- package/lib-es/staking/validators/monadResolver.js +1 -1
- package/lib-es/staking/validators/monadResolver.js.map +1 -1
- package/package.json +2 -2
- package/src/adapters/etherscan.test.ts +57 -5
- package/src/adapters/etherscan.ts +15 -0
- package/src/adapters/ledger.test.ts +57 -9
- package/src/adapters/ledger.ts +2 -0
- package/src/api/index.ts +14 -17
- package/src/api/{getBlock.integ.test.ts → tests/getBlock.integ.test.ts} +7 -7
- package/src/api/{index.arbitrum.integ.test.ts → tests/index.arbitrum.integ.test.ts} +4 -4
- package/src/api/{index.arc.integ.test.ts → tests/index.arc.integ.test.ts} +4 -4
- package/src/api/{index.avalanche_c_chain_fuji.integ.test.ts → tests/index.avalanche_c_chain_fuji.integ.test.ts} +4 -4
- package/src/api/{index.cronos.integ.test.ts → tests/index.cronos.integ.test.ts} +4 -4
- package/src/api/{index.flare.integ.test.ts → tests/index.flare.integ.test.ts} +4 -4
- package/src/api/{index.integ.test.ts → tests/index.integ.test.ts} +8 -8
- package/src/api/{index.linea.integ.test.ts → tests/index.linea.integ.test.ts} +4 -4
- package/src/api/{index.monad_testnet.integ.test.ts → tests/index.monad_testnet.integ.test.ts} +5 -5
- package/src/api/{index.optimism.integ.test.ts → tests/index.optimism.integ.test.ts} +4 -4
- package/src/api/{index.rsk.integ.test.ts → tests/index.rsk.integ.test.ts} +4 -4
- package/src/api/{index.shape.integ.test.ts → tests/index.shape.integ.test.ts} +4 -4
- package/src/api/{index.somnia.integ.test.ts → tests/index.somnia.integ.test.ts} +4 -4
- package/src/api/{index.test.ts → tests/index.test.ts} +10 -10
- package/src/api/{index.zksync.integ.test.ts → tests/index.zksync.integ.test.ts} +3 -3
- package/src/chains.ts +17 -0
- package/src/config.ts +1 -1
- package/src/errors.ts +14 -0
- package/src/fixtures/context.fixtures.ts +2 -4
- package/src/logic/broadcast.ts +1 -2
- package/src/logic/craftTransaction.ts +2 -3
- package/src/logic/estimateFees.ts +22 -4
- package/src/logic/getBalance.ts +3 -6
- package/src/logic/getBlock.ts +39 -10
- package/src/logic/getBlockInfo.ts +2 -6
- package/src/logic/getNextSequence.ts +2 -6
- package/src/logic/getStakes.ts +1 -2
- package/src/logic/lastBlock.ts +2 -2
- package/src/logic/listOperations.ts +3 -2
- package/src/logic/tests/broadcast.integ.test.ts +1 -1
- package/src/logic/tests/broadcast.test.ts +5 -5
- package/src/logic/tests/broadcastSource.test.ts +4 -4
- package/src/logic/tests/common.test.ts +1 -1
- package/src/logic/tests/craftTransaction.test.ts +16 -21
- package/src/logic/tests/estimateFees.test.ts +40 -18
- package/src/logic/tests/getBalance.test.ts +20 -23
- package/src/logic/tests/getBlock.test.ts +159 -39
- package/src/logic/tests/getBlockInfo.test.ts +6 -6
- package/src/logic/tests/getNextSequence.test.ts +2 -2
- package/src/logic/tests/getStakes.test.ts +14 -14
- package/src/logic/tests/internalTransactionsFetcher.test.ts +1 -1
- package/src/logic/tests/lastBlock.test.ts +4 -4
- package/src/logic/tests/listOperations.test.ts +51 -55
- package/src/logic/tests/validateIntent.test.ts +39 -61
- package/src/logic/validateIntent.ts +2 -3
- package/src/logic.test.ts +24 -7
- package/src/logic.ts +6 -11
- package/src/network/node/explorerProxy.ts +2 -0
- package/src/network/node/ledger.ts +3 -10
- package/src/network/node/rpc.common.ts +23 -10
- package/src/network/node/types.ts +5 -2
- package/src/network/{explorer → tests/explorer}/etherscan.test.ts +8 -8
- package/src/network/{explorer → tests/explorer}/index.test.ts +11 -11
- package/src/network/{explorer → tests/explorer}/ledger.test.ts +11 -11
- package/src/network/{explorer → tests/explorer}/types.test.ts +1 -1
- package/src/network/{gasTracker → tests/gasTracker}/index.test.ts +3 -3
- package/src/network/{gasTracker → tests/gasTracker}/ledger.test.ts +4 -4
- package/src/network/{gasTracker → tests/gasTracker}/types.test.ts +1 -1
- package/src/network/{node → tests/node}/explorerProxy.test.ts +5 -2
- package/src/network/{node → tests/node}/gethCallTracerToTraceBlockItems.test.ts +4 -4
- package/src/network/{node → tests/node}/index.memoization.test.ts +3 -3
- package/src/network/{node → tests/node}/index.test.ts +3 -3
- package/src/network/{node → tests/node}/ledger.test.ts +9 -6
- package/src/network/{node → tests/node}/node.fixtures.ts +1 -1
- package/src/network/{node → tests/node}/rpc.errors.test.ts +1 -1
- package/src/network/{node → tests/node}/rpc.test.ts +57 -6
- package/src/network/{node → tests/node}/types.test.ts +1 -1
- package/src/network/{node → tests/node}/withNodeSources.test.ts +3 -3
- package/src/network/{withRetries.test.ts → tests/withRetries.test.ts} +2 -2
- package/src/staking/detectOperationType.ts +1 -1
- package/src/staking/redelegations.test.ts +3 -3
- package/src/staking/validators/index.ts +1 -2
- package/src/staking/validators/monadResolver.ts +1 -1
- package/src/staking/validators.integ.test.ts +1 -1
- package/src/staking/validators.test.ts +1 -1
|
@@ -76,7 +76,7 @@ describe('EVM Staking - getStakes', () => {
|
|
|
76
76
|
mockEncodeStakingData.mockReturnValue('0xdeadbeef')
|
|
77
77
|
mockDecodeStakingResult.mockReturnValue(mkResult({ toString: (): string => '1000000' }))
|
|
78
78
|
|
|
79
|
-
const result = await getStakes(context,
|
|
79
|
+
const result = await getStakes(context, address)
|
|
80
80
|
|
|
81
81
|
expect(result).toEqual({
|
|
82
82
|
items: [
|
|
@@ -108,7 +108,7 @@ describe('EVM Staking - getStakes', () => {
|
|
|
108
108
|
mockEncodeStakingData.mockReturnValue('0xdeadbeef')
|
|
109
109
|
mockDecodeStakingResult.mockReturnValue(mkResult({ toString: (): string => '0' }))
|
|
110
110
|
|
|
111
|
-
const result = await getStakes(context,
|
|
111
|
+
const result = await getStakes(context, address)
|
|
112
112
|
|
|
113
113
|
expect(result).toEqual({
|
|
114
114
|
items: [],
|
|
@@ -142,7 +142,7 @@ describe('EVM Staking - getStakes', () => {
|
|
|
142
142
|
})
|
|
143
143
|
)
|
|
144
144
|
|
|
145
|
-
const result = await getStakes(seiContext,
|
|
145
|
+
const result = await getStakes(seiContext, address)
|
|
146
146
|
|
|
147
147
|
expect(result).toEqual({
|
|
148
148
|
items: [
|
|
@@ -161,7 +161,7 @@ describe('EVM Staking - getStakes', () => {
|
|
|
161
161
|
})
|
|
162
162
|
|
|
163
163
|
it('should return empty list for currencies not configured for staking', async () => {
|
|
164
|
-
const result = await getStakes(ethereumContext,
|
|
164
|
+
const result = await getStakes(ethereumContext, address)
|
|
165
165
|
|
|
166
166
|
expect(result).toEqual({
|
|
167
167
|
items: [],
|
|
@@ -176,7 +176,7 @@ describe('EVM Staking - getStakes', () => {
|
|
|
176
176
|
})
|
|
177
177
|
mockEncodeStakingData.mockReturnValue('0xdeadbeef')
|
|
178
178
|
|
|
179
|
-
const result = await getStakes(context,
|
|
179
|
+
const result = await getStakes(context, address)
|
|
180
180
|
|
|
181
181
|
expect(result).toEqual({
|
|
182
182
|
items: [],
|
|
@@ -203,7 +203,7 @@ describe('EVM Staking - getStakes', () => {
|
|
|
203
203
|
})
|
|
204
204
|
mockEncodeStakingData.mockReturnValue('0xdeadbeef')
|
|
205
205
|
|
|
206
|
-
const result = await getStakes(seiContext,
|
|
206
|
+
const result = await getStakes(seiContext, address)
|
|
207
207
|
|
|
208
208
|
expect(result).toEqual({
|
|
209
209
|
items: [],
|
|
@@ -214,7 +214,7 @@ describe('EVM Staking - getStakes', () => {
|
|
|
214
214
|
it('should handle SEI when no validators are available', async () => {
|
|
215
215
|
mockGetValidators.mockResolvedValue({ items: [], next: undefined })
|
|
216
216
|
|
|
217
|
-
const result = await getStakes(seiContext,
|
|
217
|
+
const result = await getStakes(seiContext, address)
|
|
218
218
|
|
|
219
219
|
expect(result).toEqual({
|
|
220
220
|
items: [],
|
|
@@ -224,7 +224,7 @@ describe('EVM Staking - getStakes', () => {
|
|
|
224
224
|
it('should survive network failures during validator fetching', async () => {
|
|
225
225
|
mockGetValidators.mockRejectedValue(new Error('Network unreachable'))
|
|
226
226
|
|
|
227
|
-
const result = await getStakes(seiContext,
|
|
227
|
+
const result = await getStakes(seiContext, address)
|
|
228
228
|
|
|
229
229
|
expect(result).toEqual({
|
|
230
230
|
items: [],
|
|
@@ -232,7 +232,7 @@ describe('EVM Staking - getStakes', () => {
|
|
|
232
232
|
})
|
|
233
233
|
|
|
234
234
|
it('should handle completely unsupported currencies', async () => {
|
|
235
|
-
const result = await getStakes(ethereumContext,
|
|
235
|
+
const result = await getStakes(ethereumContext, address)
|
|
236
236
|
|
|
237
237
|
expect(result).toEqual({
|
|
238
238
|
items: [],
|
|
@@ -244,7 +244,7 @@ describe('EVM Staking - getStakes', () => {
|
|
|
244
244
|
throw new Error('API Error')
|
|
245
245
|
})
|
|
246
246
|
|
|
247
|
-
const result = await getStakes(context,
|
|
247
|
+
const result = await getStakes(context, address)
|
|
248
248
|
|
|
249
249
|
expect(result).toEqual({
|
|
250
250
|
items: [],
|
|
@@ -290,7 +290,7 @@ describe('EVM Staking - getStakes', () => {
|
|
|
290
290
|
mockOneDelegation()
|
|
291
291
|
mockFetchUnbondings.mockResolvedValue([unbondingStake])
|
|
292
292
|
|
|
293
|
-
const result = await getStakes(seiContext,
|
|
293
|
+
const result = await getStakes(seiContext, address)
|
|
294
294
|
|
|
295
295
|
expect(result.items.map((i) => i.state)).toEqual(['active', 'deactivating'])
|
|
296
296
|
})
|
|
@@ -299,7 +299,7 @@ describe('EVM Staking - getStakes', () => {
|
|
|
299
299
|
mockGetValidators.mockResolvedValue({ items: [], next: undefined })
|
|
300
300
|
mockFetchUnbondings.mockResolvedValue([unbondingStake])
|
|
301
301
|
|
|
302
|
-
const result = await getStakes(seiContext,
|
|
302
|
+
const result = await getStakes(seiContext, address)
|
|
303
303
|
|
|
304
304
|
expect(result.items).toEqual([unbondingStake])
|
|
305
305
|
})
|
|
@@ -308,7 +308,7 @@ describe('EVM Staking - getStakes', () => {
|
|
|
308
308
|
mockOneDelegation()
|
|
309
309
|
mockFetchUnbondings.mockRejectedValue(new Error('REST down'))
|
|
310
310
|
|
|
311
|
-
const result = await getStakes(seiContext,
|
|
311
|
+
const result = await getStakes(seiContext, address)
|
|
312
312
|
|
|
313
313
|
expect(result.items.map((i) => i.state)).toEqual(['active'])
|
|
314
314
|
})
|
|
@@ -322,7 +322,7 @@ describe('EVM Staking - getStakes', () => {
|
|
|
322
322
|
mockEncodeStakingData.mockReturnValue('0xdeadbeef')
|
|
323
323
|
mockDecodeStakingResult.mockReturnValue(mkResult({ toString: (): string => '1000000' }))
|
|
324
324
|
|
|
325
|
-
const result = await getStakes(context,
|
|
325
|
+
const result = await getStakes(context, address)
|
|
326
326
|
|
|
327
327
|
expect(result.items.map((i) => i.state)).toEqual(['active'])
|
|
328
328
|
})
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
testLogger,
|
|
14
14
|
} from '../../fixtures/context.fixtures'
|
|
15
15
|
import { getInternalTransactionsByBlock } from '../../network/explorer/etherscan'
|
|
16
|
-
import { mockNodeApi } from '../../network/node/node.fixtures'
|
|
16
|
+
import { mockNodeApi } from '../../network/tests/node/node.fixtures'
|
|
17
17
|
import { composeInternalTxsFetcher, makeSourceFetchers } from '../internalTransactionsFetcher'
|
|
18
18
|
|
|
19
19
|
jest.mock('../../network/explorer/etherscan', () => ({
|
|
@@ -9,7 +9,7 @@ import type {
|
|
|
9
9
|
} from '../../config'
|
|
10
10
|
import { createMockEvmContext, mkExternalNode, mkLedgerNode } from '../../fixtures/context.fixtures'
|
|
11
11
|
import { getNodeApi } from '../../network/node'
|
|
12
|
-
import { mockNodeApi } from '../../network/node/node.fixtures'
|
|
12
|
+
import { mockNodeApi } from '../../network/tests/node/node.fixtures'
|
|
13
13
|
import { lastBlock } from '../lastBlock'
|
|
14
14
|
|
|
15
15
|
jest.mock('../../network/node', () => ({
|
|
@@ -45,7 +45,7 @@ describe('lastBlock', () => {
|
|
|
45
45
|
const context = createMockEvmContext({ node })
|
|
46
46
|
nodeApiMock.getBlockByHeight.mockResolvedValue(blockResult)
|
|
47
47
|
|
|
48
|
-
expect(await lastBlock(context
|
|
48
|
+
expect(await lastBlock(context)).toEqual(expectedInfo)
|
|
49
49
|
})
|
|
50
50
|
|
|
51
51
|
it.each([
|
|
@@ -62,7 +62,7 @@ describe('lastBlock', () => {
|
|
|
62
62
|
const context = createMockEvmContext({ node })
|
|
63
63
|
nodeApiMock.getBlockByHeight.mockResolvedValue(blockResult)
|
|
64
64
|
|
|
65
|
-
await lastBlock(context
|
|
65
|
+
await lastBlock(context)
|
|
66
66
|
|
|
67
67
|
expect(nodeApiMock.getBlockByHeight).toHaveBeenCalledWith('latest')
|
|
68
68
|
})
|
|
@@ -93,7 +93,7 @@ describe('lastBlock', () => {
|
|
|
93
93
|
const context = createMockEvmContext({ node, finalizationLevel })
|
|
94
94
|
nodeApiMock.getBlockByHeight.mockResolvedValue(blockResult)
|
|
95
95
|
|
|
96
|
-
expect(await lastBlock(context
|
|
96
|
+
expect(await lastBlock(context)).toEqual(expectedInfo)
|
|
97
97
|
expect(nodeApiMock.getBlockByHeight).toHaveBeenCalledWith(finalizationLevel)
|
|
98
98
|
}
|
|
99
99
|
)
|
|
@@ -19,7 +19,6 @@ import ledgerExplorer from '../../network/explorer/ledger'
|
|
|
19
19
|
import { listOperations } from '../listOperations'
|
|
20
20
|
|
|
21
21
|
describe('listOperations', () => {
|
|
22
|
-
const currency = ''
|
|
23
22
|
const address = 'address'
|
|
24
23
|
|
|
25
24
|
describe('limit validation', () => {
|
|
@@ -31,15 +30,10 @@ describe('listOperations', () => {
|
|
|
31
30
|
.mockResolvedValue({ data: { data: [], token: '' } })
|
|
32
31
|
|
|
33
32
|
await expect(
|
|
34
|
-
listOperations(
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
{
|
|
39
|
-
minHeight: 0,
|
|
40
|
-
limit,
|
|
41
|
-
}
|
|
42
|
-
)
|
|
33
|
+
listOperations(ctxWithExplorer(mkLedgerExplorer({ explorerId: 'eth' })), address, {
|
|
34
|
+
minHeight: 0,
|
|
35
|
+
limit,
|
|
36
|
+
})
|
|
43
37
|
).rejects.toBeInstanceOf(InvalidParameterError)
|
|
44
38
|
// Nothing reaches the explorer: a zero page size used to make the paged walk double a
|
|
45
39
|
// zero forever, so this has to be caught before the first request.
|
|
@@ -319,7 +313,7 @@ describe('listOperations', () => {
|
|
|
319
313
|
const minHeight = 5
|
|
320
314
|
|
|
321
315
|
// here order is "asc" but that's just the sort order, not how the explorer is queried
|
|
322
|
-
const result = await listOperations(testContext,
|
|
316
|
+
const result = await listOperations(testContext, address, {
|
|
323
317
|
minHeight,
|
|
324
318
|
order: 'asc',
|
|
325
319
|
})
|
|
@@ -646,7 +640,7 @@ describe('listOperations', () => {
|
|
|
646
640
|
})
|
|
647
641
|
|
|
648
642
|
expect(
|
|
649
|
-
await listOperations(testContext,
|
|
643
|
+
await listOperations(testContext, address.toLowerCase(), {
|
|
650
644
|
minHeight: 1,
|
|
651
645
|
order: 'asc',
|
|
652
646
|
})
|
|
@@ -742,7 +736,7 @@ describe('listOperations', () => {
|
|
|
742
736
|
})
|
|
743
737
|
|
|
744
738
|
expect(
|
|
745
|
-
await listOperations(testContext, '
|
|
739
|
+
await listOperations(testContext, 'address1', {
|
|
746
740
|
minHeight: 1,
|
|
747
741
|
order: 'asc',
|
|
748
742
|
})
|
|
@@ -837,7 +831,7 @@ describe('listOperations', () => {
|
|
|
837
831
|
nextPagingToken: '',
|
|
838
832
|
})
|
|
839
833
|
|
|
840
|
-
const { items } = await listOperations(testContext,
|
|
834
|
+
const { items } = await listOperations(testContext, recipient, {
|
|
841
835
|
minHeight: 1,
|
|
842
836
|
order: 'asc',
|
|
843
837
|
})
|
|
@@ -914,7 +908,7 @@ describe('listOperations', () => {
|
|
|
914
908
|
nextPagingToken: '',
|
|
915
909
|
})
|
|
916
910
|
|
|
917
|
-
const { items } = await listOperations(testContext,
|
|
911
|
+
const { items } = await listOperations(testContext, address, {
|
|
918
912
|
minHeight: 0,
|
|
919
913
|
order: 'asc',
|
|
920
914
|
})
|
|
@@ -989,7 +983,7 @@ describe('listOperations', () => {
|
|
|
989
983
|
nextPagingToken: '',
|
|
990
984
|
})
|
|
991
985
|
|
|
992
|
-
const { items } = await listOperations(testContext,
|
|
986
|
+
const { items } = await listOperations(testContext, address, {
|
|
993
987
|
minHeight: 0,
|
|
994
988
|
order: 'asc',
|
|
995
989
|
})
|
|
@@ -998,8 +992,8 @@ describe('listOperations', () => {
|
|
|
998
992
|
expect(tokenOp?.tx.block.hash).toBe(parentBlockHash)
|
|
999
993
|
})
|
|
1000
994
|
|
|
1001
|
-
it('inherits the parent nonce on token ops, whose fees-only native op is dropped', async () => {
|
|
1002
|
-
// LIVE-35844: the Ledger explorer only reports the nonce on the native op
|
|
995
|
+
it('inherits the parent nonce and gas on token ops, whose fees-only native op is dropped', async () => {
|
|
996
|
+
// LIVE-35844: the Ledger explorer only reports the nonce and gas on the native op
|
|
1003
997
|
const testContext = ctxWithExplorer(mkLedgerExplorer())
|
|
1004
998
|
|
|
1005
999
|
const address = '0xb69b37a4fb4a18b3258f974ff6e9f529ad2647b1'
|
|
@@ -1017,7 +1011,7 @@ describe('listOperations', () => {
|
|
|
1017
1011
|
value: 0n,
|
|
1018
1012
|
asset: { type: 'native' as const },
|
|
1019
1013
|
tx: { ...tx, feesPayer: address },
|
|
1020
|
-
details: { sequence: 316 },
|
|
1014
|
+
details: { sequence: 316, gasPrice: '570000000', gasLimit: '73330' },
|
|
1021
1015
|
},
|
|
1022
1016
|
],
|
|
1023
1017
|
lastTokenOperations: [
|
|
@@ -1041,13 +1035,15 @@ describe('listOperations', () => {
|
|
|
1041
1035
|
nextPagingToken: '',
|
|
1042
1036
|
})
|
|
1043
1037
|
|
|
1044
|
-
const { items } = await listOperations(testContext,
|
|
1038
|
+
const { items } = await listOperations(testContext, address, {
|
|
1045
1039
|
minHeight: 0,
|
|
1046
1040
|
order: 'asc',
|
|
1047
1041
|
})
|
|
1048
1042
|
|
|
1049
1043
|
// a cancel is a self transfer of 0, so the explorer reports both sides
|
|
1050
1044
|
expect(items.map((op) => op.details?.sequence)).toEqual([316, 316])
|
|
1045
|
+
expect(items.map((op) => op.details?.gasPrice)).toEqual(['570000000', '570000000'])
|
|
1046
|
+
expect(items.map((op) => op.details?.gasLimit)).toEqual(['73330', '73330'])
|
|
1051
1047
|
})
|
|
1052
1048
|
|
|
1053
1049
|
it('should emit both native and token operations when tx has native value > 0 and token transfers', async () => {
|
|
@@ -1107,7 +1103,7 @@ describe('listOperations', () => {
|
|
|
1107
1103
|
})
|
|
1108
1104
|
|
|
1109
1105
|
expect(
|
|
1110
|
-
await listOperations(testContext, '
|
|
1106
|
+
await listOperations(testContext, 'address1', {
|
|
1111
1107
|
minHeight: 1,
|
|
1112
1108
|
order: 'asc',
|
|
1113
1109
|
})
|
|
@@ -1199,7 +1195,7 @@ describe('listOperations', () => {
|
|
|
1199
1195
|
async ({ limit, order, expectedExplorerOrder, expectedResultOrder }) => {
|
|
1200
1196
|
const testContext = ctxWithExplorer(mkEtherscanExplorer())
|
|
1201
1197
|
const getOperationsSpy = buildOperationsSpy(etherscanExplorer.explorerApi)
|
|
1202
|
-
const { items: result } = await listOperations(testContext,
|
|
1198
|
+
const { items: result } = await listOperations(testContext, address, {
|
|
1203
1199
|
minHeight: 0,
|
|
1204
1200
|
...(limit !== undefined ? { limit } : {}),
|
|
1205
1201
|
...(order !== undefined ? { order } : {}),
|
|
@@ -1281,7 +1277,7 @@ describe('listOperations', () => {
|
|
|
1281
1277
|
return { data: { data: allRecords.slice(0, params.batch_size), token: '' } }
|
|
1282
1278
|
})
|
|
1283
1279
|
|
|
1284
|
-
const { next } = await listOperations(testContext,
|
|
1280
|
+
const { next } = await listOperations(testContext, address, {
|
|
1285
1281
|
minHeight: 0,
|
|
1286
1282
|
limit: 3,
|
|
1287
1283
|
cursor: '11:0xh11',
|
|
@@ -1366,7 +1362,7 @@ describe('listOperations', () => {
|
|
|
1366
1362
|
nextPagingToken: '',
|
|
1367
1363
|
})
|
|
1368
1364
|
|
|
1369
|
-
const { items: result } = await listOperations(testContext,
|
|
1365
|
+
const { items: result } = await listOperations(testContext, address, {
|
|
1370
1366
|
minHeight: 1,
|
|
1371
1367
|
order: 'asc',
|
|
1372
1368
|
})
|
|
@@ -1407,7 +1403,7 @@ describe('listOperations', () => {
|
|
|
1407
1403
|
nextPagingToken: '',
|
|
1408
1404
|
})
|
|
1409
1405
|
|
|
1410
|
-
const { items } = await listOperations(testContext,
|
|
1406
|
+
const { items } = await listOperations(testContext, address, {
|
|
1411
1407
|
minHeight: 0,
|
|
1412
1408
|
order: 'asc',
|
|
1413
1409
|
})
|
|
@@ -1447,7 +1443,7 @@ describe('listOperations', () => {
|
|
|
1447
1443
|
nextPagingToken: '',
|
|
1448
1444
|
})
|
|
1449
1445
|
|
|
1450
|
-
const { items } = await listOperations(testContext,
|
|
1446
|
+
const { items } = await listOperations(testContext, address, {
|
|
1451
1447
|
minHeight: 0,
|
|
1452
1448
|
order: 'asc',
|
|
1453
1449
|
})
|
|
@@ -1490,7 +1486,7 @@ describe('listOperations', () => {
|
|
|
1490
1486
|
nextPagingToken: '',
|
|
1491
1487
|
})
|
|
1492
1488
|
|
|
1493
|
-
const { items } = await listOperations(testContext, '
|
|
1489
|
+
const { items } = await listOperations(testContext, 'address', {
|
|
1494
1490
|
minHeight: 1,
|
|
1495
1491
|
order: 'asc',
|
|
1496
1492
|
})
|
|
@@ -1651,11 +1647,11 @@ describe('listOperations', () => {
|
|
|
1651
1647
|
],
|
|
1652
1648
|
})
|
|
1653
1649
|
|
|
1654
|
-
const address1Result = await listOperations(testContext, '
|
|
1650
|
+
const address1Result = await listOperations(testContext, 'address1', {
|
|
1655
1651
|
minHeight: 0,
|
|
1656
1652
|
order: 'asc',
|
|
1657
1653
|
})
|
|
1658
|
-
const address2Result = await listOperations(testContext, '
|
|
1654
|
+
const address2Result = await listOperations(testContext, 'address2', {
|
|
1659
1655
|
minHeight: 0,
|
|
1660
1656
|
order: 'asc',
|
|
1661
1657
|
})
|
|
@@ -1697,7 +1693,7 @@ describe('listOperations', () => {
|
|
|
1697
1693
|
],
|
|
1698
1694
|
})
|
|
1699
1695
|
|
|
1700
|
-
const result = await listOperations(testContext, '
|
|
1696
|
+
const result = await listOperations(testContext, 'address1', {
|
|
1701
1697
|
minHeight: 0,
|
|
1702
1698
|
order: 'asc',
|
|
1703
1699
|
})
|
|
@@ -1734,7 +1730,7 @@ describe('listOperations', () => {
|
|
|
1734
1730
|
'0xselfsend'
|
|
1735
1731
|
)
|
|
1736
1732
|
|
|
1737
|
-
const result = await listOperations(testContext, '
|
|
1733
|
+
const result = await listOperations(testContext, 'address1', {
|
|
1738
1734
|
minHeight: 0,
|
|
1739
1735
|
order: 'asc',
|
|
1740
1736
|
})
|
|
@@ -1782,11 +1778,11 @@ describe('listOperations', () => {
|
|
|
1782
1778
|
sharedTxHash
|
|
1783
1779
|
)
|
|
1784
1780
|
|
|
1785
|
-
const address1Result = await listOperations(testContext, '
|
|
1781
|
+
const address1Result = await listOperations(testContext, 'address1', {
|
|
1786
1782
|
minHeight: 0,
|
|
1787
1783
|
order: 'asc',
|
|
1788
1784
|
})
|
|
1789
|
-
const address2Result = await listOperations(testContext, '
|
|
1785
|
+
const address2Result = await listOperations(testContext, 'address2', {
|
|
1790
1786
|
minHeight: 0,
|
|
1791
1787
|
order: 'asc',
|
|
1792
1788
|
})
|
|
@@ -1841,7 +1837,7 @@ describe('listOperations', () => {
|
|
|
1841
1837
|
'0xcase4'
|
|
1842
1838
|
)
|
|
1843
1839
|
|
|
1844
|
-
const result = await listOperations(testContext, '
|
|
1840
|
+
const result = await listOperations(testContext, 'address1', {
|
|
1845
1841
|
minHeight: 0,
|
|
1846
1842
|
order: 'asc',
|
|
1847
1843
|
})
|
|
@@ -1893,11 +1889,11 @@ describe('listOperations', () => {
|
|
|
1893
1889
|
sharedTxHash
|
|
1894
1890
|
)
|
|
1895
1891
|
|
|
1896
|
-
const address1Result = await listOperations(testContext, '
|
|
1892
|
+
const address1Result = await listOperations(testContext, 'address1', {
|
|
1897
1893
|
minHeight: 0,
|
|
1898
1894
|
order: 'asc',
|
|
1899
1895
|
})
|
|
1900
|
-
const address2Result = await listOperations(testContext, '
|
|
1896
|
+
const address2Result = await listOperations(testContext, 'address2', {
|
|
1901
1897
|
minHeight: 0,
|
|
1902
1898
|
order: 'asc',
|
|
1903
1899
|
})
|
|
@@ -1953,15 +1949,15 @@ describe('listOperations', () => {
|
|
|
1953
1949
|
sharedTxHash
|
|
1954
1950
|
)
|
|
1955
1951
|
|
|
1956
|
-
const address1Result = await listOperations(testContext, '
|
|
1952
|
+
const address1Result = await listOperations(testContext, 'address1', {
|
|
1957
1953
|
minHeight: 0,
|
|
1958
1954
|
order: 'asc',
|
|
1959
1955
|
})
|
|
1960
|
-
const address2Result = await listOperations(testContext, '
|
|
1956
|
+
const address2Result = await listOperations(testContext, 'address2', {
|
|
1961
1957
|
minHeight: 0,
|
|
1962
1958
|
order: 'asc',
|
|
1963
1959
|
})
|
|
1964
|
-
const address3Result = await listOperations(testContext, '
|
|
1960
|
+
const address3Result = await listOperations(testContext, 'address3', {
|
|
1965
1961
|
minHeight: 0,
|
|
1966
1962
|
order: 'asc',
|
|
1967
1963
|
})
|
|
@@ -2014,7 +2010,7 @@ describe('listOperations', () => {
|
|
|
2014
2010
|
],
|
|
2015
2011
|
})
|
|
2016
2012
|
|
|
2017
|
-
const result = await listOperations(testContext, '
|
|
2013
|
+
const result = await listOperations(testContext, 'address1', {
|
|
2018
2014
|
minHeight: 0,
|
|
2019
2015
|
order: 'asc',
|
|
2020
2016
|
})
|
|
@@ -2058,7 +2054,7 @@ describe('listOperations', () => {
|
|
|
2058
2054
|
'0xcase8'
|
|
2059
2055
|
)
|
|
2060
2056
|
|
|
2061
|
-
const result = await listOperations(testContext, '
|
|
2057
|
+
const result = await listOperations(testContext, 'address1', {
|
|
2062
2058
|
minHeight: 0,
|
|
2063
2059
|
order: 'asc',
|
|
2064
2060
|
})
|
|
@@ -2102,11 +2098,11 @@ describe('listOperations', () => {
|
|
|
2102
2098
|
sharedTxHash
|
|
2103
2099
|
)
|
|
2104
2100
|
|
|
2105
|
-
const address1Result = await listOperations(testContext, '
|
|
2101
|
+
const address1Result = await listOperations(testContext, 'address1', {
|
|
2106
2102
|
minHeight: 0,
|
|
2107
2103
|
order: 'asc',
|
|
2108
2104
|
})
|
|
2109
|
-
const address2Result = await listOperations(testContext, '
|
|
2105
|
+
const address2Result = await listOperations(testContext, 'address2', {
|
|
2110
2106
|
minHeight: 0,
|
|
2111
2107
|
order: 'asc',
|
|
2112
2108
|
})
|
|
@@ -2162,11 +2158,11 @@ describe('listOperations', () => {
|
|
|
2162
2158
|
sharedTxHash
|
|
2163
2159
|
)
|
|
2164
2160
|
|
|
2165
|
-
const address1Result = await listOperations(testContext, '
|
|
2161
|
+
const address1Result = await listOperations(testContext, 'address1', {
|
|
2166
2162
|
minHeight: 0,
|
|
2167
2163
|
order: 'asc',
|
|
2168
2164
|
})
|
|
2169
|
-
const address2Result = await listOperations(testContext, '
|
|
2165
|
+
const address2Result = await listOperations(testContext, 'address2', {
|
|
2170
2166
|
minHeight: 0,
|
|
2171
2167
|
order: 'asc',
|
|
2172
2168
|
})
|
|
@@ -2232,15 +2228,15 @@ describe('listOperations', () => {
|
|
|
2232
2228
|
sharedTxHash
|
|
2233
2229
|
)
|
|
2234
2230
|
|
|
2235
|
-
const address1Result = await listOperations(testContext, '
|
|
2231
|
+
const address1Result = await listOperations(testContext, 'address1', {
|
|
2236
2232
|
minHeight: 0,
|
|
2237
2233
|
order: 'asc',
|
|
2238
2234
|
})
|
|
2239
|
-
const address2Result = await listOperations(testContext, '
|
|
2235
|
+
const address2Result = await listOperations(testContext, 'address2', {
|
|
2240
2236
|
minHeight: 0,
|
|
2241
2237
|
order: 'asc',
|
|
2242
2238
|
})
|
|
2243
|
-
const address3Result = await listOperations(testContext, '
|
|
2239
|
+
const address3Result = await listOperations(testContext, 'address3', {
|
|
2244
2240
|
minHeight: 0,
|
|
2245
2241
|
order: 'asc',
|
|
2246
2242
|
})
|
|
@@ -2314,7 +2310,7 @@ describe('listOperations', () => {
|
|
|
2314
2310
|
sharedTxHash
|
|
2315
2311
|
)
|
|
2316
2312
|
|
|
2317
|
-
const result = await listOperations(testContext, '
|
|
2313
|
+
const result = await listOperations(testContext, 'address1', {
|
|
2318
2314
|
minHeight: 0,
|
|
2319
2315
|
order: 'asc',
|
|
2320
2316
|
})
|
|
@@ -2362,7 +2358,7 @@ describe('listOperations', () => {
|
|
|
2362
2358
|
sharedTxHash
|
|
2363
2359
|
)
|
|
2364
2360
|
|
|
2365
|
-
const result = await listOperations(testContext, '
|
|
2361
|
+
const result = await listOperations(testContext, 'address1', {
|
|
2366
2362
|
minHeight: 0,
|
|
2367
2363
|
order: 'asc',
|
|
2368
2364
|
})
|
|
@@ -2393,7 +2389,7 @@ describe('listOperations', () => {
|
|
|
2393
2389
|
sharedTxHash
|
|
2394
2390
|
)
|
|
2395
2391
|
|
|
2396
|
-
const result = await listOperations(testContext, '
|
|
2392
|
+
const result = await listOperations(testContext, 'user', {
|
|
2397
2393
|
minHeight: 0,
|
|
2398
2394
|
order: 'asc',
|
|
2399
2395
|
})
|
|
@@ -2425,7 +2421,7 @@ describe('listOperations', () => {
|
|
|
2425
2421
|
sharedTxHash
|
|
2426
2422
|
)
|
|
2427
2423
|
|
|
2428
|
-
const result = await listOperations(testContext, '
|
|
2424
|
+
const result = await listOperations(testContext, 'user', {
|
|
2429
2425
|
minHeight: 0,
|
|
2430
2426
|
order: 'asc',
|
|
2431
2427
|
})
|
|
@@ -2459,7 +2455,7 @@ describe('listOperations', () => {
|
|
|
2459
2455
|
sharedTxHash
|
|
2460
2456
|
)
|
|
2461
2457
|
|
|
2462
|
-
const result = await listOperations(testContext, '
|
|
2458
|
+
const result = await listOperations(testContext, 'user', {
|
|
2463
2459
|
minHeight: 0,
|
|
2464
2460
|
order: 'asc',
|
|
2465
2461
|
})
|
|
@@ -2507,7 +2503,7 @@ describe('listOperations', () => {
|
|
|
2507
2503
|
sharedTxHash
|
|
2508
2504
|
)
|
|
2509
2505
|
|
|
2510
|
-
const result = await listOperations(testContext, '
|
|
2506
|
+
const result = await listOperations(testContext, 'address1', {
|
|
2511
2507
|
minHeight: 0,
|
|
2512
2508
|
order: 'asc',
|
|
2513
2509
|
})
|
|
@@ -2552,7 +2548,7 @@ describe('listOperations', () => {
|
|
|
2552
2548
|
sharedTxHash
|
|
2553
2549
|
)
|
|
2554
2550
|
|
|
2555
|
-
const result = await listOperations(testContext, '
|
|
2551
|
+
const result = await listOperations(testContext, 'address1', {
|
|
2556
2552
|
minHeight: 0,
|
|
2557
2553
|
order: 'asc',
|
|
2558
2554
|
})
|