@ledgerhq/coin-evm 15.2.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 +24 -0
- package/lib/api/index.d.ts +1 -1
- package/lib/api/index.d.ts.map +1 -1
- package/lib/api/index.js +14 -14
- package/lib/api/index.js.map +1 -1
- package/lib/chains.d.ts +6 -0
- package/lib/chains.d.ts.map +1 -1
- package/lib/chains.js +16 -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 +2 -2
- 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 +2 -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/ledger.d.ts.map +1 -1
- package/lib/network/node/ledger.js +1 -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 +1 -9
- package/lib/network/node/rpc.common.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/api/index.d.ts +1 -1
- package/lib-es/api/index.d.ts.map +1 -1
- package/lib-es/api/index.js +14 -14
- package/lib-es/api/index.js.map +1 -1
- package/lib-es/chains.d.ts +6 -0
- package/lib-es/chains.d.ts.map +1 -1
- package/lib-es/chains.js +15 -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 +2 -2
- 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 +2 -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/ledger.d.ts.map +1 -1
- package/lib-es/network/node/ledger.js +2 -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 +2 -10
- package/lib-es/network/node/rpc.common.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 +1 -1
- package/src/api/index.ts +14 -16
- package/src/api/tests/getBlock.integ.test.ts +3 -3
- package/src/api/tests/index.arbitrum.integ.test.ts +1 -1
- package/src/api/tests/index.arc.integ.test.ts +1 -1
- package/src/api/tests/index.avalanche_c_chain_fuji.integ.test.ts +1 -1
- package/src/api/tests/index.cronos.integ.test.ts +1 -1
- package/src/api/tests/index.flare.integ.test.ts +1 -1
- package/src/api/tests/index.integ.test.ts +5 -5
- package/src/api/tests/index.linea.integ.test.ts +1 -1
- package/src/api/tests/index.monad_testnet.integ.test.ts +1 -1
- package/src/api/tests/index.optimism.integ.test.ts +1 -1
- package/src/api/tests/index.rsk.integ.test.ts +1 -1
- package/src/api/tests/index.shape.integ.test.ts +1 -1
- package/src/api/tests/index.somnia.integ.test.ts +1 -1
- package/src/api/tests/index.test.ts +6 -6
- package/src/api/tests/index.zksync.integ.test.ts +1 -1
- package/src/chains.ts +16 -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 +2 -6
- 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 +1 -2
- package/src/logic/tests/broadcast.integ.test.ts +1 -1
- package/src/logic/tests/broadcast.test.ts +4 -4
- package/src/logic/tests/broadcastSource.test.ts +3 -3
- package/src/logic/tests/craftTransaction.test.ts +15 -20
- package/src/logic/tests/estimateFees.test.ts +39 -17
- package/src/logic/tests/getBalance.test.ts +19 -22
- package/src/logic/tests/getBlock.test.ts +37 -38
- package/src/logic/tests/getBlockInfo.test.ts +5 -5
- package/src/logic/tests/getNextSequence.test.ts +1 -1
- package/src/logic/tests/getStakes.test.ts +14 -14
- package/src/logic/tests/lastBlock.test.ts +3 -3
- package/src/logic/tests/listOperations.test.ts +46 -52
- package/src/logic/tests/validateIntent.test.ts +3 -61
- package/src/logic/validateIntent.ts +2 -3
- package/src/logic.test.ts +23 -6
- package/src/logic.ts +6 -11
- package/src/network/node/ledger.ts +2 -10
- package/src/network/node/rpc.common.ts +2 -10
- package/src/network/tests/explorer/index.test.ts +4 -4
- package/src/network/tests/node/ledger.test.ts +2 -0
- package/src/network/tests/node/rpc.test.ts +42 -0
- 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
|
@@ -11,7 +11,7 @@ import type {
|
|
|
11
11
|
import { createSendTransactionIntentMockData } from '@ledgerhq/coin-module-framework/test-utils'
|
|
12
12
|
import BigNumber from 'bignumber.js'
|
|
13
13
|
import { CHAIN_ID } from '../../config'
|
|
14
|
-
import { GasEstimationError } from '../../errors'
|
|
14
|
+
import { GasEstimationError, L1DataFeeUnavailableError } from '../../errors'
|
|
15
15
|
import { createMockEvmContext } from '../../fixtures/context.fixtures'
|
|
16
16
|
import { getGasTracker } from '../../network/gasTracker'
|
|
17
17
|
import { getNodeApi } from '../../network/node'
|
|
@@ -55,6 +55,7 @@ describe('estimateFees', () => {
|
|
|
55
55
|
})
|
|
56
56
|
const optimismContext: EvmContext = createMockEvmContext({
|
|
57
57
|
chainId: CHAIN_ID.OPTIMISM,
|
|
58
|
+
name: 'OP Mainnet',
|
|
58
59
|
gasTracker: { type: 'ledger', explorerId: 'eth' },
|
|
59
60
|
})
|
|
60
61
|
const seiContext: EvmContext = createMockEvmContext({
|
|
@@ -72,7 +73,6 @@ describe('estimateFees', () => {
|
|
|
72
73
|
expect(
|
|
73
74
|
await estimateFees(
|
|
74
75
|
context,
|
|
75
|
-
'ethereum',
|
|
76
76
|
createSendTransactionIntentMockData<MemoNotSupported, BufferTxData>({
|
|
77
77
|
type: 'send-legacy',
|
|
78
78
|
recipient: 'not-an-address',
|
|
@@ -88,7 +88,6 @@ describe('estimateFees', () => {
|
|
|
88
88
|
|
|
89
89
|
const result = await estimateFees(
|
|
90
90
|
context,
|
|
91
|
-
'ethereum',
|
|
92
91
|
{
|
|
93
92
|
intentType: 'transaction',
|
|
94
93
|
type: 'send-legacy',
|
|
@@ -185,7 +184,6 @@ describe('estimateFees', () => {
|
|
|
185
184
|
|
|
186
185
|
const result = await estimateFees(
|
|
187
186
|
context,
|
|
188
|
-
'ethereum',
|
|
189
187
|
{
|
|
190
188
|
intentType: 'transaction',
|
|
191
189
|
type: 'send-legacy',
|
|
@@ -248,7 +246,6 @@ describe('estimateFees', () => {
|
|
|
248
246
|
|
|
249
247
|
const result = await estimateFees(
|
|
250
248
|
context,
|
|
251
|
-
'ethereum',
|
|
252
249
|
{
|
|
253
250
|
intentType: 'transaction',
|
|
254
251
|
type: 'send-eip1559',
|
|
@@ -279,7 +276,6 @@ describe('estimateFees', () => {
|
|
|
279
276
|
nodeApiMock.getTransactionCount.mockResolvedValue(42)
|
|
280
277
|
const result = await estimateFees(
|
|
281
278
|
context,
|
|
282
|
-
'ethereum',
|
|
283
279
|
{
|
|
284
280
|
intentType: 'transaction',
|
|
285
281
|
type: 'send-legacy',
|
|
@@ -321,7 +317,6 @@ describe('estimateFees', () => {
|
|
|
321
317
|
|
|
322
318
|
const result = await estimateFees(
|
|
323
319
|
context,
|
|
324
|
-
'ethereum',
|
|
325
320
|
{
|
|
326
321
|
intentType: 'transaction',
|
|
327
322
|
type: 'send-legacy',
|
|
@@ -360,7 +355,6 @@ describe('estimateFees', () => {
|
|
|
360
355
|
|
|
361
356
|
const result = await estimateFees(
|
|
362
357
|
context,
|
|
363
|
-
'ethereum',
|
|
364
358
|
{
|
|
365
359
|
intentType: 'transaction',
|
|
366
360
|
type: 'send-legacy',
|
|
@@ -398,7 +392,7 @@ describe('estimateFees', () => {
|
|
|
398
392
|
mockGetGasTracker.mockReturnValue(null)
|
|
399
393
|
nodeApiMock.getOptimismAdditionalFees.mockResolvedValue(new BigNumber(8000))
|
|
400
394
|
|
|
401
|
-
const result = await estimateFees(optimismContext,
|
|
395
|
+
const result = await estimateFees(optimismContext, {
|
|
402
396
|
intentType: 'transaction',
|
|
403
397
|
type: 'send-legacy',
|
|
404
398
|
amount: BigInt('1000000000000000000'),
|
|
@@ -433,7 +427,7 @@ describe('estimateFees', () => {
|
|
|
433
427
|
mockGetGasTracker.mockReturnValue(null)
|
|
434
428
|
nodeApiMock.getOptimismAdditionalFees.mockResolvedValue(new BigNumber(8000))
|
|
435
429
|
|
|
436
|
-
const result = await estimateFees(optimismContext,
|
|
430
|
+
const result = await estimateFees(optimismContext, {
|
|
437
431
|
intentType: 'transaction',
|
|
438
432
|
type: 'send-legacy',
|
|
439
433
|
amount: BigInt('1000000000000000000'),
|
|
@@ -447,6 +441,36 @@ describe('estimateFees', () => {
|
|
|
447
441
|
expect(result.parameters?.additionalFees).toBe(16000n)
|
|
448
442
|
})
|
|
449
443
|
|
|
444
|
+
it('fails with an explicit error when the L1 data fee oracle cannot be read', async () => {
|
|
445
|
+
nodeApiMock.getGasEstimation.mockResolvedValue(new BigNumber('21000'))
|
|
446
|
+
nodeApiMock.getTransactionCount.mockResolvedValue(42)
|
|
447
|
+
nodeApiMock.getFeeData.mockResolvedValue({
|
|
448
|
+
gasPrice: new BigNumber('20000000000'),
|
|
449
|
+
maxFeePerGas: null,
|
|
450
|
+
maxPriorityFeePerGas: null,
|
|
451
|
+
nextBaseFee: null,
|
|
452
|
+
})
|
|
453
|
+
mockGetGasTracker.mockReturnValue(null)
|
|
454
|
+
nodeApiMock.getOptimismAdditionalFees.mockRejectedValue(new Error('node unreachable'))
|
|
455
|
+
|
|
456
|
+
const estimation = estimateFees(optimismContext, 'optimism', {
|
|
457
|
+
intentType: 'transaction',
|
|
458
|
+
type: 'send-legacy',
|
|
459
|
+
amount: BigInt('1000000000000000000'),
|
|
460
|
+
asset: { type: 'native' },
|
|
461
|
+
recipient: '0x7b2C7232f9E38F30E2868f0E5Bf311Cd83554b5A',
|
|
462
|
+
sender: '0xsender',
|
|
463
|
+
data: { type: 'buffer', value: Buffer.from([]) },
|
|
464
|
+
})
|
|
465
|
+
|
|
466
|
+
await expect(estimation).rejects.toThrow(L1DataFeeUnavailableError)
|
|
467
|
+
await expect(estimation).rejects.toMatchObject({
|
|
468
|
+
statusCode: 503,
|
|
469
|
+
chainId: CHAIN_ID.OPTIMISM,
|
|
470
|
+
message: 'Could not get the L1 data fee for chain OP Mainnet: node unreachable',
|
|
471
|
+
})
|
|
472
|
+
})
|
|
473
|
+
|
|
450
474
|
it('gives 0 additional fees if the transaction is not serializable', async () => {
|
|
451
475
|
nodeApiMock.getGasEstimation.mockResolvedValue(new BigNumber('21000'))
|
|
452
476
|
nodeApiMock.getTransactionCount.mockResolvedValue(42)
|
|
@@ -459,7 +483,7 @@ describe('estimateFees', () => {
|
|
|
459
483
|
mockGetGasTracker.mockReturnValue(null)
|
|
460
484
|
nodeApiMock.getOptimismAdditionalFees.mockResolvedValue(new BigNumber(8000))
|
|
461
485
|
|
|
462
|
-
const result = await estimateFees(optimismContext,
|
|
486
|
+
const result = await estimateFees(optimismContext, {
|
|
463
487
|
intentType: 'transaction',
|
|
464
488
|
type: 'send-legacy',
|
|
465
489
|
amount: BigInt('1000000000000000000'),
|
|
@@ -503,7 +527,7 @@ describe('estimateFees', () => {
|
|
|
503
527
|
valAddress: 'seivaloper1y82m5y3wevjneamzg0pmx87dzanyxzht0kepvn',
|
|
504
528
|
amount: 1000000n,
|
|
505
529
|
}
|
|
506
|
-
const result = await estimateFees(seiContext,
|
|
530
|
+
const result = await estimateFees(seiContext, tokenIntent)
|
|
507
531
|
expect(result).toEqual({
|
|
508
532
|
value: 420000000000000n,
|
|
509
533
|
parameters: {
|
|
@@ -537,7 +561,7 @@ describe('estimateFees', () => {
|
|
|
537
561
|
amount: 1000000n,
|
|
538
562
|
useAllAmount: true,
|
|
539
563
|
}
|
|
540
|
-
const result = await estimateFees(seiContext,
|
|
564
|
+
const result = await estimateFees(seiContext, delegateMaxIntent)
|
|
541
565
|
expect(result.parameters).toMatchObject({
|
|
542
566
|
reserve: 10n ** 17n, // 0.1 SEI reserve
|
|
543
567
|
amountScale: 10n ** 12n, // usei -> wei scale
|
|
@@ -555,7 +579,7 @@ describe('estimateFees', () => {
|
|
|
555
579
|
amount: 1000000n,
|
|
556
580
|
}
|
|
557
581
|
|
|
558
|
-
const result = await estimateFees(seiContext,
|
|
582
|
+
const result = await estimateFees(seiContext, redelegateNoDst)
|
|
559
583
|
|
|
560
584
|
expect(result).toEqual({ value: 0n })
|
|
561
585
|
expect(mockGetNodeApi).not.toHaveBeenCalled()
|
|
@@ -582,7 +606,7 @@ describe('estimateFees', () => {
|
|
|
582
606
|
dstValAddress: 'selfvaloper1uvdqeduxvtchfphueyxraag9qkf8zfznzxs30y',
|
|
583
607
|
amount: 1000000n,
|
|
584
608
|
}
|
|
585
|
-
const result = await estimateFees(seiContext,
|
|
609
|
+
const result = await estimateFees(seiContext, tokenIntent)
|
|
586
610
|
expect(result).toEqual({
|
|
587
611
|
value: 420000000000000n,
|
|
588
612
|
parameters: {
|
|
@@ -605,7 +629,6 @@ describe('estimateFees', () => {
|
|
|
605
629
|
|
|
606
630
|
const result = await estimateFees(
|
|
607
631
|
context,
|
|
608
|
-
'ethereum',
|
|
609
632
|
{
|
|
610
633
|
intentType: 'transaction',
|
|
611
634
|
type: 'send-legacy',
|
|
@@ -646,7 +669,6 @@ describe('estimateFees', () => {
|
|
|
646
669
|
|
|
647
670
|
const result = await estimateFees(
|
|
648
671
|
context,
|
|
649
|
-
'ethereum',
|
|
650
672
|
{
|
|
651
673
|
intentType: 'transaction',
|
|
652
674
|
type: 'send-legacy',
|
|
@@ -136,7 +136,7 @@ describe('getBalance', () => {
|
|
|
136
136
|
],
|
|
137
137
|
})
|
|
138
138
|
|
|
139
|
-
expect(await getBalance(context, '
|
|
139
|
+
expect(await getBalance(context, 'address')).toEqual(expected)
|
|
140
140
|
}
|
|
141
141
|
)
|
|
142
142
|
|
|
@@ -190,10 +190,9 @@ describe('getBalance', () => {
|
|
|
190
190
|
|
|
191
191
|
mockGetExplorerApi.mockReturnValue(explorerWithDiscovery(discoveredAssets))
|
|
192
192
|
|
|
193
|
-
const currency = ''
|
|
194
193
|
const userAddress = '0x000'
|
|
195
194
|
|
|
196
|
-
await getBalance(context,
|
|
195
|
+
await getBalance(context, userAddress, { includeAssets })
|
|
197
196
|
|
|
198
197
|
expect(nodeApiMock.getTokenBalance).toHaveBeenCalledTimes(expected.length)
|
|
199
198
|
for (const balance of expected) {
|
|
@@ -237,7 +236,7 @@ describe('getBalance', () => {
|
|
|
237
236
|
items: [],
|
|
238
237
|
})
|
|
239
238
|
|
|
240
|
-
const result = await getBalance(context, '
|
|
239
|
+
const result = await getBalance(context, 'address')
|
|
241
240
|
|
|
242
241
|
expect(result).toEqual([
|
|
243
242
|
{ asset: { type: 'native' }, value: 10n },
|
|
@@ -268,7 +267,7 @@ describe('getBalance', () => {
|
|
|
268
267
|
])
|
|
269
268
|
)
|
|
270
269
|
|
|
271
|
-
const result = await getBalance(context, '
|
|
270
|
+
const result = await getBalance(context, 'address')
|
|
272
271
|
|
|
273
272
|
expect(nodeApiMock.getTokenBalance).toHaveBeenCalledTimes(1)
|
|
274
273
|
expect(nodeApiMock.getTokenBalance).toHaveBeenCalledWith('address', REGULAR_CONTRACT)
|
|
@@ -293,7 +292,7 @@ describe('getBalance', () => {
|
|
|
293
292
|
explorerWithDiscovery([{ type: 'erc20', assetReference: NATIVE_CONTRACT.toLowerCase() }])
|
|
294
293
|
)
|
|
295
294
|
|
|
296
|
-
await getBalance(context, '
|
|
295
|
+
await getBalance(context, 'address')
|
|
297
296
|
|
|
298
297
|
expect(nodeApiMock.getTokenBalance).not.toHaveBeenCalled()
|
|
299
298
|
})
|
|
@@ -310,7 +309,7 @@ describe('getBalance', () => {
|
|
|
310
309
|
])
|
|
311
310
|
)
|
|
312
311
|
|
|
313
|
-
await getBalance(context, '
|
|
312
|
+
await getBalance(context, 'address')
|
|
314
313
|
|
|
315
314
|
expect(nodeApiMock.getTokenBalance).toHaveBeenCalledTimes(2)
|
|
316
315
|
})
|
|
@@ -325,7 +324,7 @@ describe('getBalance', () => {
|
|
|
325
324
|
items: [],
|
|
326
325
|
})
|
|
327
326
|
|
|
328
|
-
const result = await getBalance(context, '
|
|
327
|
+
const result = await getBalance(context, 'address')
|
|
329
328
|
expect(result[0]).toEqual({
|
|
330
329
|
value: BigInt('0'),
|
|
331
330
|
asset: { type: 'native' },
|
|
@@ -342,7 +341,7 @@ describe('getBalance', () => {
|
|
|
342
341
|
discoverTokenAssets: jest.fn().mockRejectedValue(explorerError),
|
|
343
342
|
})
|
|
344
343
|
|
|
345
|
-
await expect(getBalance(context, '
|
|
344
|
+
await expect(getBalance(context, 'address')).rejects.toThrow('explorer unavailable')
|
|
346
345
|
})
|
|
347
346
|
|
|
348
347
|
it('stays tolerant of a failed getStakes call while discovery succeeds', async () => {
|
|
@@ -350,7 +349,7 @@ describe('getBalance', () => {
|
|
|
350
349
|
mockGetStakes.mockRejectedValue(new Error('staking unavailable'))
|
|
351
350
|
mockGetExplorerApi.mockReturnValue(explorerWithDiscovery([]))
|
|
352
351
|
|
|
353
|
-
const result = await getBalance(context, '
|
|
352
|
+
const result = await getBalance(context, 'address')
|
|
354
353
|
|
|
355
354
|
expect(result).toEqual([{ asset: { type: 'native' }, value: 5n }])
|
|
356
355
|
})
|
|
@@ -365,7 +364,7 @@ describe('getBalance', () => {
|
|
|
365
364
|
|
|
366
365
|
const knownAssets: AssetInfo[] = [{ type: 'erc20', assetReference: '0xknown' }]
|
|
367
366
|
|
|
368
|
-
const result = await getBalance(context, '
|
|
367
|
+
const result = await getBalance(context, 'address', { knownAssets })
|
|
369
368
|
|
|
370
369
|
expect(nodeApiMock.getTokenBalance).toHaveBeenCalledWith('address', '0xknown')
|
|
371
370
|
expect(result).toEqual([
|
|
@@ -386,7 +385,7 @@ describe('getBalance', () => {
|
|
|
386
385
|
explorerWithDiscovery([{ type: 'erc20', assetReference: CHECKSUMMED }])
|
|
387
386
|
)
|
|
388
387
|
|
|
389
|
-
const result = await getBalance(context, '
|
|
388
|
+
const result = await getBalance(context, 'address', {
|
|
390
389
|
knownAssets: [{ type: 'erc20', assetReference: CHECKSUMMED.toLowerCase() }],
|
|
391
390
|
})
|
|
392
391
|
|
|
@@ -408,7 +407,7 @@ describe('getBalance', () => {
|
|
|
408
407
|
const discoverTokenAssets = jest.fn().mockResolvedValue([])
|
|
409
408
|
mockGetExplorerApi.mockReturnValue({ getOperations: jest.fn(), discoverTokenAssets })
|
|
410
409
|
|
|
411
|
-
await getBalance(context, '
|
|
410
|
+
await getBalance(context, 'address', {
|
|
412
411
|
scanAssetsMinHeight: 12345,
|
|
413
412
|
knownAssets: [{ type: 'erc20', assetReference: '0xknown' }],
|
|
414
413
|
})
|
|
@@ -427,7 +426,7 @@ describe('getBalance', () => {
|
|
|
427
426
|
const discoverTokenAssets = jest.fn().mockResolvedValue([])
|
|
428
427
|
mockGetExplorerApi.mockReturnValue({ getOperations: jest.fn(), discoverTokenAssets })
|
|
429
428
|
|
|
430
|
-
await getBalance(context, '
|
|
429
|
+
await getBalance(context, 'address', { scanAssetsMinHeight: 12345 })
|
|
431
430
|
|
|
432
431
|
// A resume without the known set drops every asset whose last transfer predates that
|
|
433
432
|
// height, and the framework reads a missing asset as a zero balance on a held token.
|
|
@@ -447,7 +446,7 @@ describe('getBalance', () => {
|
|
|
447
446
|
explorerWithDiscovery([{ type: 'erc20', assetReference: '0xdiscovered' }])
|
|
448
447
|
)
|
|
449
448
|
|
|
450
|
-
const result = await getBalance(context, '
|
|
449
|
+
const result = await getBalance(context, 'address', {
|
|
451
450
|
includeAssets: (asset: AssetInfo) =>
|
|
452
451
|
Promise.resolve('assetReference' in asset && asset.assetReference === '0xkept'),
|
|
453
452
|
knownAssets: [
|
|
@@ -472,7 +471,7 @@ describe('getBalance', () => {
|
|
|
472
471
|
explorerWithDiscovery([{ type: 'erc20', assetReference: '0xdup' }])
|
|
473
472
|
)
|
|
474
473
|
|
|
475
|
-
const result = await getBalance(context, '
|
|
474
|
+
const result = await getBalance(context, 'address', {
|
|
476
475
|
knownAssets: [{ type: 'erc20', assetReference: '0xdup' }],
|
|
477
476
|
})
|
|
478
477
|
|
|
@@ -491,7 +490,7 @@ describe('getBalance', () => {
|
|
|
491
490
|
explorerWithDiscovery([{ type: 'native' }, { type: 'erc20', assetReference: '0x123' }])
|
|
492
491
|
)
|
|
493
492
|
|
|
494
|
-
const result = await getBalance(context, '
|
|
493
|
+
const result = await getBalance(context, 'address', {
|
|
495
494
|
knownAssets: [{ type: 'native' }],
|
|
496
495
|
})
|
|
497
496
|
|
|
@@ -533,7 +532,7 @@ describe('getBalance', () => {
|
|
|
533
532
|
const discoverTokenAssets = jest.fn()
|
|
534
533
|
mockGetExplorerApi.mockReturnValue({ getOperations, discoverTokenAssets })
|
|
535
534
|
|
|
536
|
-
const result = await getBalance(monadContext, '
|
|
535
|
+
const result = await getBalance(monadContext, 'address')
|
|
537
536
|
|
|
538
537
|
// The explorer's `getOperations` takes the logger as its second argument; the walk this
|
|
539
538
|
// branch reuses passes it like every other caller.
|
|
@@ -566,7 +565,7 @@ describe('getBalance', () => {
|
|
|
566
565
|
discoverTokenAssets: jest.fn().mockResolvedValue([]),
|
|
567
566
|
})
|
|
568
567
|
|
|
569
|
-
await getBalance(context, '
|
|
568
|
+
await getBalance(context, 'address')
|
|
570
569
|
|
|
571
570
|
expect(getOperations).not.toHaveBeenCalled()
|
|
572
571
|
})
|
|
@@ -580,9 +579,7 @@ describe('getBalance', () => {
|
|
|
580
579
|
discoverTokenAssets: jest.fn(),
|
|
581
580
|
})
|
|
582
581
|
|
|
583
|
-
await expect(getBalance(monadContext, '
|
|
584
|
-
'explorer unavailable'
|
|
585
|
-
)
|
|
582
|
+
await expect(getBalance(monadContext, 'address')).rejects.toThrow('explorer unavailable')
|
|
586
583
|
})
|
|
587
584
|
})
|
|
588
585
|
})
|
|
@@ -163,7 +163,7 @@ describe('getBlock', () => {
|
|
|
163
163
|
})
|
|
164
164
|
)
|
|
165
165
|
|
|
166
|
-
const result = await getBlock(context,
|
|
166
|
+
const result = await getBlock(context, 12345)
|
|
167
167
|
|
|
168
168
|
expect(result.transactions).toEqual([])
|
|
169
169
|
expect(jest.mocked(getInternalTransactionsByBlock)).not.toHaveBeenCalled()
|
|
@@ -191,7 +191,7 @@ describe('getBlock', () => {
|
|
|
191
191
|
})
|
|
192
192
|
)
|
|
193
193
|
|
|
194
|
-
await getBlock(context,
|
|
194
|
+
await getBlock(context, 12345)
|
|
195
195
|
|
|
196
196
|
expect(jest.mocked(getInternalTransactionsByBlock)).toHaveBeenCalledWith(
|
|
197
197
|
expect.anything(),
|
|
@@ -232,7 +232,7 @@ describe('getBlock', () => {
|
|
|
232
232
|
})
|
|
233
233
|
)
|
|
234
234
|
|
|
235
|
-
const result = await getBlock(context,
|
|
235
|
+
const result = await getBlock(context, 12345)
|
|
236
236
|
|
|
237
237
|
expect(result).toMatchObject({
|
|
238
238
|
info: {
|
|
@@ -318,7 +318,7 @@ describe('getBlock', () => {
|
|
|
318
318
|
})
|
|
319
319
|
)
|
|
320
320
|
|
|
321
|
-
const result = await getBlock(context,
|
|
321
|
+
const result = await getBlock(context, 12345)
|
|
322
322
|
|
|
323
323
|
expect(result.transactions[0]).toMatchObject({
|
|
324
324
|
hash: '0xtx1',
|
|
@@ -363,7 +363,7 @@ describe('getBlock', () => {
|
|
|
363
363
|
})
|
|
364
364
|
)
|
|
365
365
|
|
|
366
|
-
const result = await getBlock(context,
|
|
366
|
+
const result = await getBlock(context, 12345)
|
|
367
367
|
|
|
368
368
|
expect(result.transactions[0]).toMatchObject({
|
|
369
369
|
hash: '0xdeploy',
|
|
@@ -399,7 +399,7 @@ describe('getBlock', () => {
|
|
|
399
399
|
})
|
|
400
400
|
)
|
|
401
401
|
|
|
402
|
-
const result = await getBlock(context,
|
|
402
|
+
const result = await getBlock(context, 12345)
|
|
403
403
|
|
|
404
404
|
expect(result.transactions[0].details).not.toHaveProperty('contractInteraction')
|
|
405
405
|
})
|
|
@@ -430,7 +430,7 @@ describe('getBlock', () => {
|
|
|
430
430
|
})
|
|
431
431
|
)
|
|
432
432
|
|
|
433
|
-
const result = await getBlock(context,
|
|
433
|
+
const result = await getBlock(context, 12345)
|
|
434
434
|
|
|
435
435
|
expect(result.transactions[0].details).toEqual({
|
|
436
436
|
gasPrice: '1000000000',
|
|
@@ -460,7 +460,7 @@ describe('getBlock', () => {
|
|
|
460
460
|
})
|
|
461
461
|
)
|
|
462
462
|
|
|
463
|
-
const result = await getBlock(context,
|
|
463
|
+
const result = await getBlock(context, 12345)
|
|
464
464
|
|
|
465
465
|
expect(result.transactions[0].details).toEqual({
|
|
466
466
|
gasPrice: '1000000000',
|
|
@@ -487,7 +487,7 @@ describe('getBlock', () => {
|
|
|
487
487
|
})
|
|
488
488
|
)
|
|
489
489
|
|
|
490
|
-
const result = await getBlock(context,
|
|
490
|
+
const result = await getBlock(context, 12345)
|
|
491
491
|
|
|
492
492
|
expect(result.transactions[0].details).toEqual({ gasPrice: '20000000000' })
|
|
493
493
|
})
|
|
@@ -519,7 +519,7 @@ describe('getBlock', () => {
|
|
|
519
519
|
})
|
|
520
520
|
)
|
|
521
521
|
|
|
522
|
-
const result = await getBlock(context,
|
|
522
|
+
const result = await getBlock(context, 12345)
|
|
523
523
|
|
|
524
524
|
expect(result.transactions[0].details).toEqual({
|
|
525
525
|
gasPrice: '1000000000',
|
|
@@ -563,7 +563,7 @@ describe('getBlock', () => {
|
|
|
563
563
|
})
|
|
564
564
|
)
|
|
565
565
|
|
|
566
|
-
const result = await getBlock(context,
|
|
566
|
+
const result = await getBlock(context, 12345)
|
|
567
567
|
|
|
568
568
|
expect(result.transactions[0]).toMatchObject({
|
|
569
569
|
hash: '0xtx1',
|
|
@@ -604,7 +604,7 @@ describe('getBlock', () => {
|
|
|
604
604
|
})
|
|
605
605
|
)
|
|
606
606
|
|
|
607
|
-
const result = await getBlock(context,
|
|
607
|
+
const result = await getBlock(context, 12345)
|
|
608
608
|
|
|
609
609
|
expect(result).toMatchObject({
|
|
610
610
|
info: {
|
|
@@ -639,7 +639,7 @@ describe('getBlock', () => {
|
|
|
639
639
|
})
|
|
640
640
|
)
|
|
641
641
|
|
|
642
|
-
const result = await getBlock(context,
|
|
642
|
+
const result = await getBlock(context, 12345)
|
|
643
643
|
|
|
644
644
|
expect(result).toMatchObject({
|
|
645
645
|
info: {
|
|
@@ -679,7 +679,7 @@ describe('getBlock', () => {
|
|
|
679
679
|
})
|
|
680
680
|
)
|
|
681
681
|
|
|
682
|
-
await expect(getBlock(context,
|
|
682
|
+
await expect(getBlock(context, 12345)).rejects.toThrow('timeout')
|
|
683
683
|
expect(mockGetTransaction).not.toHaveBeenCalled()
|
|
684
684
|
})
|
|
685
685
|
|
|
@@ -742,7 +742,7 @@ describe('getBlock', () => {
|
|
|
742
742
|
}),
|
|
743
743
|
])
|
|
744
744
|
|
|
745
|
-
const result = await getBlock(context,
|
|
745
|
+
const result = await getBlock(context, 12345)
|
|
746
746
|
|
|
747
747
|
const encodedFrom = safeEncodeEIP55(address1, testLogger)
|
|
748
748
|
const encodedTo = safeEncodeEIP55(address2, testLogger)
|
|
@@ -814,7 +814,7 @@ describe('getBlock', () => {
|
|
|
814
814
|
}),
|
|
815
815
|
])
|
|
816
816
|
|
|
817
|
-
const result = await getBlock(context,
|
|
817
|
+
const result = await getBlock(context, 12345)
|
|
818
818
|
|
|
819
819
|
// Only the two ops from the coin tx itself (sender + recipient side), no duplicates.
|
|
820
820
|
const nativeOps = result.transactions[0].operations.filter(
|
|
@@ -872,7 +872,7 @@ describe('getBlock', () => {
|
|
|
872
872
|
}),
|
|
873
873
|
])
|
|
874
874
|
|
|
875
|
-
const result = await getBlock(context,
|
|
875
|
+
const result = await getBlock(context, 12345)
|
|
876
876
|
|
|
877
877
|
const nativeOps = result.transactions[0].operations.filter(
|
|
878
878
|
(op) => op.type === 'transfer' && op.asset.type === 'native'
|
|
@@ -924,7 +924,7 @@ describe('getBlock', () => {
|
|
|
924
924
|
|
|
925
925
|
const mockGetInternalTransactionsByBlock = jest.mocked(getInternalTransactionsByBlock)
|
|
926
926
|
|
|
927
|
-
const result = await getBlock(context,
|
|
927
|
+
const result = await getBlock(context, 12345)
|
|
928
928
|
|
|
929
929
|
expect(mockGetInternalTransactionsByBlock).not.toHaveBeenCalled()
|
|
930
930
|
expect(mockTraceBlock).toHaveBeenCalledWith(12345)
|
|
@@ -985,7 +985,7 @@ describe('getBlock', () => {
|
|
|
985
985
|
)
|
|
986
986
|
const mockGetInternalTransactionsByBlock = jest.mocked(getInternalTransactionsByBlock)
|
|
987
987
|
|
|
988
|
-
await expect(getBlock(context,
|
|
988
|
+
await expect(getBlock(context, 12345)).rejects.toThrow(error)
|
|
989
989
|
|
|
990
990
|
expect(mockGetInternalTransactionsByBlock).not.toHaveBeenCalled()
|
|
991
991
|
expect(mockTraceBlock).toHaveBeenCalledWith(12345)
|
|
@@ -1017,7 +1017,7 @@ describe('getBlock', () => {
|
|
|
1017
1017
|
const mockGetInternalTransactionsByBlock = jest.mocked(getInternalTransactionsByBlock)
|
|
1018
1018
|
mockGetInternalTransactionsByBlock.mockRejectedValueOnce(new Error('explorer error'))
|
|
1019
1019
|
|
|
1020
|
-
const result = await getBlock(context,
|
|
1020
|
+
const result = await getBlock(context, 12345)
|
|
1021
1021
|
|
|
1022
1022
|
expect(result).toMatchObject({
|
|
1023
1023
|
info: {
|
|
@@ -1066,7 +1066,7 @@ describe('getBlock', () => {
|
|
|
1066
1066
|
const mockGetInternalTransactionsByBlock = jest.mocked(getInternalTransactionsByBlock)
|
|
1067
1067
|
mockGetInternalTransactionsByBlock.mockRejectedValueOnce(new Error('explorer error'))
|
|
1068
1068
|
|
|
1069
|
-
const result = await getBlock(context,
|
|
1069
|
+
const result = await getBlock(context, 12345)
|
|
1070
1070
|
|
|
1071
1071
|
expect(mockTraceBlock).toHaveBeenCalledWith(12345)
|
|
1072
1072
|
const encodedFrom = safeEncodeEIP55(address1, testLogger)
|
|
@@ -1136,7 +1136,7 @@ describe('getBlock', () => {
|
|
|
1136
1136
|
const mockGetInternalTransactionsByBlock = jest.mocked(getInternalTransactionsByBlock)
|
|
1137
1137
|
mockGetInternalTransactionsByBlock.mockRejectedValueOnce(new Error('explorer error'))
|
|
1138
1138
|
|
|
1139
|
-
await expect(getBlock(context,
|
|
1139
|
+
await expect(getBlock(context, 12345)).rejects.toThrow(error)
|
|
1140
1140
|
|
|
1141
1141
|
expect(mockGetInternalTransactionsByBlock).toHaveBeenCalledWith(expect.anything(), 12345)
|
|
1142
1142
|
expect(mockTraceBlock).toHaveBeenCalledWith(12345)
|
|
@@ -1181,7 +1181,7 @@ describe('getBlock', () => {
|
|
|
1181
1181
|
const mockGetInternalTransactionsByBlock = jest.mocked(getInternalTransactionsByBlock)
|
|
1182
1182
|
mockGetInternalTransactionsByBlock.mockRejectedValueOnce(new Error('explorer error'))
|
|
1183
1183
|
|
|
1184
|
-
await expect(getBlock(context,
|
|
1184
|
+
await expect(getBlock(context, 12345)).rejects.toMatchObject({
|
|
1185
1185
|
errors: [erigonError, gethError],
|
|
1186
1186
|
})
|
|
1187
1187
|
expect(mockTraceBlockErigon).toHaveBeenCalledWith(12345)
|
|
@@ -1223,7 +1223,7 @@ describe('getBlock', () => {
|
|
|
1223
1223
|
const mockGetInternalTransactionsByBlock = jest.mocked(getInternalTransactionsByBlock)
|
|
1224
1224
|
mockGetInternalTransactionsByBlock.mockRejectedValueOnce(new Error('explorer error'))
|
|
1225
1225
|
|
|
1226
|
-
const result = await getBlock(context,
|
|
1226
|
+
const result = await getBlock(context, 12345)
|
|
1227
1227
|
|
|
1228
1228
|
expect(mockTraceBlockErigon).toHaveBeenCalledWith(12345)
|
|
1229
1229
|
expect(mockTraceBlockGeth).toHaveBeenCalledWith(12345)
|
|
@@ -1282,7 +1282,7 @@ describe('getBlock', () => {
|
|
|
1282
1282
|
const mockGetInternalTransactionsByBlock = jest.mocked(getInternalTransactionsByBlock)
|
|
1283
1283
|
mockGetInternalTransactionsByBlock.mockRejectedValueOnce(new Error('explorer error'))
|
|
1284
1284
|
|
|
1285
|
-
await expect(getBlock(context,
|
|
1285
|
+
await expect(getBlock(context, 12345)).rejects.toThrow(erigonError)
|
|
1286
1286
|
expect(mockTraceBlockErigon).toHaveBeenCalledWith(12345)
|
|
1287
1287
|
})
|
|
1288
1288
|
|
|
@@ -1311,7 +1311,7 @@ describe('getBlock', () => {
|
|
|
1311
1311
|
getTransaction: jest.fn(),
|
|
1312
1312
|
})
|
|
1313
1313
|
)
|
|
1314
|
-
const result = await getBlock(context,
|
|
1314
|
+
const result = await getBlock(context, 12345)
|
|
1315
1315
|
expect(result.transactions[0].fees).toEqual(21000n * 568125000000n)
|
|
1316
1316
|
})
|
|
1317
1317
|
|
|
@@ -1341,7 +1341,7 @@ describe('getBlock', () => {
|
|
|
1341
1341
|
getTransaction: jest.fn(),
|
|
1342
1342
|
})
|
|
1343
1343
|
)
|
|
1344
|
-
const result = await getBlock(context,
|
|
1344
|
+
const result = await getBlock(context, 12345)
|
|
1345
1345
|
expect(result.transactions[0].fees).toEqual(21000n * 1000000000n)
|
|
1346
1346
|
})
|
|
1347
1347
|
|
|
@@ -1372,7 +1372,7 @@ describe('getBlock', () => {
|
|
|
1372
1372
|
getTransaction: jest.fn(),
|
|
1373
1373
|
})
|
|
1374
1374
|
)
|
|
1375
|
-
const result = await getBlock(context,
|
|
1375
|
+
const result = await getBlock(context, 12345)
|
|
1376
1376
|
expect(result.transactions[0].fees).toEqual(gasUsed * BigInt(gasPrice) + BigInt(l1Fee))
|
|
1377
1377
|
})
|
|
1378
1378
|
|
|
@@ -1394,7 +1394,7 @@ describe('getBlock', () => {
|
|
|
1394
1394
|
.mockResolvedValueOnce(makeNodeTxInfo({ hash: '0xtx1', gasUsed, gasPrice, l1Fee })),
|
|
1395
1395
|
})
|
|
1396
1396
|
)
|
|
1397
|
-
const result = await getBlock(context,
|
|
1397
|
+
const result = await getBlock(context, 12345)
|
|
1398
1398
|
expect(result.transactions[0].fees).toEqual(BigInt(gasUsed) * BigInt(gasPrice) + BigInt(l1Fee))
|
|
1399
1399
|
})
|
|
1400
1400
|
|
|
@@ -1402,7 +1402,6 @@ describe('getBlock', () => {
|
|
|
1402
1402
|
const USER = '0xbEB30f27e61eFFF46Aa27dcE18E23ee8D5A7c6a4'
|
|
1403
1403
|
const L2_BASE_TOKEN = '0x000000000000000000000000000000000000800A'
|
|
1404
1404
|
const MINT_PEER = '0x0000000000000000000000000000000000000000'
|
|
1405
|
-
const ZKSYNC = 'zksync'
|
|
1406
1405
|
|
|
1407
1406
|
function buildZksyncMocks(
|
|
1408
1407
|
txOverrides: Partial<PrefetchedBlockTransaction>,
|
|
@@ -1443,7 +1442,7 @@ describe('getBlock', () => {
|
|
|
1443
1442
|
],
|
|
1444
1443
|
}
|
|
1445
1444
|
)
|
|
1446
|
-
const result = await getBlock(context,
|
|
1445
|
+
const result = await getBlock(context, 12345)
|
|
1447
1446
|
expect(result.transactions[0].operations).toEqual([
|
|
1448
1447
|
{
|
|
1449
1448
|
type: 'transfer',
|
|
@@ -1481,7 +1480,7 @@ describe('getBlock', () => {
|
|
|
1481
1480
|
{ from: USER, to: USER, value: '270000000000000000' },
|
|
1482
1481
|
{ type: 2, erc20Transfers: [] }
|
|
1483
1482
|
)
|
|
1484
|
-
const result = await getBlock(context,
|
|
1483
|
+
const result = await getBlock(context, 12345)
|
|
1485
1484
|
expect(result.transactions[0].operations).toEqual([
|
|
1486
1485
|
{
|
|
1487
1486
|
type: 'transfer',
|
|
@@ -1523,7 +1522,7 @@ describe('getBlock', () => {
|
|
|
1523
1522
|
],
|
|
1524
1523
|
}
|
|
1525
1524
|
)
|
|
1526
|
-
const result = await getBlock(context,
|
|
1525
|
+
const result = await getBlock(context, 12345)
|
|
1527
1526
|
expect(result.transactions[0].operations).toEqual([
|
|
1528
1527
|
// native credit (synthesized, replaces the native self pair)
|
|
1529
1528
|
{
|
|
@@ -1564,7 +1563,7 @@ describe('getBlock', () => {
|
|
|
1564
1563
|
{ from: USER, to: USER, value: '270000000000000000' },
|
|
1565
1564
|
{ type: 0xff, erc20Transfers: [] }
|
|
1566
1565
|
)
|
|
1567
|
-
const result = await getBlock(context,
|
|
1566
|
+
const result = await getBlock(context, 12345)
|
|
1568
1567
|
expect(result.transactions[0].operations).toEqual([
|
|
1569
1568
|
{
|
|
1570
1569
|
type: 'transfer',
|
|
@@ -1592,7 +1591,7 @@ describe('getBlock', () => {
|
|
|
1592
1591
|
],
|
|
1593
1592
|
}
|
|
1594
1593
|
)
|
|
1595
|
-
const result = await getBlock(context,
|
|
1594
|
+
const result = await getBlock(context, 12345)
|
|
1596
1595
|
// Only the to-side (on user) remains; the from-side (on 0x0) is filtered out.
|
|
1597
1596
|
expect(result.transactions[0].operations).toEqual([
|
|
1598
1597
|
{
|
|
@@ -1621,7 +1620,7 @@ describe('getBlock', () => {
|
|
|
1621
1620
|
],
|
|
1622
1621
|
}
|
|
1623
1622
|
)
|
|
1624
|
-
const result = await getBlock(context,
|
|
1623
|
+
const result = await getBlock(context, 12345)
|
|
1625
1624
|
expect(result.transactions[0].operations).toEqual([
|
|
1626
1625
|
{
|
|
1627
1626
|
type: 'transfer',
|
|
@@ -1656,7 +1655,7 @@ describe('getBlock', () => {
|
|
|
1656
1655
|
],
|
|
1657
1656
|
}
|
|
1658
1657
|
)
|
|
1659
|
-
const result = await getBlock(context,
|
|
1658
|
+
const result = await getBlock(context, 12345)
|
|
1660
1659
|
expect(result.transactions[0].operations).toEqual([
|
|
1661
1660
|
{
|
|
1662
1661
|
type: 'transfer',
|
|
@@ -1691,7 +1690,7 @@ describe('getBlock', () => {
|
|
|
1691
1690
|
},
|
|
1692
1691
|
CHAIN_ID.ETHEREUM
|
|
1693
1692
|
)
|
|
1694
|
-
const result = await getBlock(context,
|
|
1693
|
+
const result = await getBlock(context, 12345)
|
|
1695
1694
|
expect(result.transactions[0].operations).toEqual([
|
|
1696
1695
|
{
|
|
1697
1696
|
type: 'transfer',
|