@ledgerhq/coin-evm 5.3.2 → 5.3.3
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 +7 -0
- package/package.json +2 -2
- package/src/adapters/blockOperations.test.ts +27 -29
- package/src/api/index.flare.integ.test.ts +1 -13
- package/src/api/index.integ.test.ts +86 -97
- package/src/fixtures/context.fixtures.ts +79 -1
- package/src/fixtures/ethers.fixtures.ts +26 -0
- package/src/logic/broadcast.integ.test.ts +6 -18
- package/src/logic/broadcast.test.ts +19 -31
- package/src/logic/broadcastSource.test.ts +6 -7
- package/src/logic/common.test.ts +120 -112
- package/src/logic/craftTransaction.test.ts +161 -199
- package/src/logic/craftTransactionData.test.ts +6 -6
- package/src/logic/estimateFees.test.ts +19 -15
- package/src/logic/getBalance.test.ts +15 -14
- package/src/logic/getBlock.test.ts +372 -382
- package/src/logic/getBlockInfo.test.ts +6 -6
- package/src/logic/getNextSequence.test.ts +5 -5
- package/src/logic/getStakes.test.ts +34 -34
- package/src/logic/internalTransactionsFetcher.test.ts +23 -19
- package/src/logic/lastBlock.test.ts +29 -21
- package/src/logic/listOperations.test.ts +43 -40
- package/src/logic/validateIntent.test.ts +151 -101
- package/src/logic.test.ts +13 -18
- package/src/network/explorer/etherscan.test.ts +5 -5
- package/src/network/explorer/index.test.ts +51 -21
- package/src/network/explorer/ledger.test.ts +15 -4
- package/src/network/gasTracker/index.test.ts +14 -8
- package/src/network/gasTracker/ledger.test.ts +25 -13
- package/src/network/node/index.memoization.test.ts +25 -31
- package/src/network/node/index.test.ts +14 -25
- package/src/network/node/ledger.test.ts +45 -60
- package/src/network/node/node.fixtures.ts +0 -2
- package/src/network/node/rpc.test.ts +152 -177
- package/src/staking/encoder.test.ts +13 -21
- package/src/staking/logic.test.ts +20 -14
- package/src/staking/operations/index.test.ts +28 -28
- package/src/staking/prepareIntents.test.ts +26 -20
- package/src/staking/redelegations.test.ts +27 -18
- package/src/staking/rewards.test.ts +23 -15
- package/src/staking/rewardsFromReceipt.test.ts +19 -20
- package/src/staking/transactionData.test.ts +22 -22
- package/src/staking/validators/monad.test.ts +65 -24
- package/src/staking/validators/somnia.test.ts +21 -13
- package/src/staking/validators/zero_gravity.test.ts +118 -48
- package/src/staking/validators.integ.test.ts +13 -25
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: © 2026 LEDGER SAS
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
-
import type { EvmConfigInfo
|
|
5
|
-
import { createMockEvmContext } from '../fixtures/context.fixtures'
|
|
4
|
+
import type { EvmConfigInfo } from '../config'
|
|
5
|
+
import { createMockEvmContext, mkExternalNode, mkLedgerNode } from '../fixtures/context.fixtures'
|
|
6
6
|
import { getNodeApi } from '../network/node'
|
|
7
7
|
import { mockNodeApi } from '../network/node/node.fixtures'
|
|
8
8
|
import { getBlockInfo } from './getBlockInfo'
|
|
@@ -26,10 +26,10 @@ describe('getBlockInfo', () => {
|
|
|
26
26
|
})
|
|
27
27
|
|
|
28
28
|
describe.each([
|
|
29
|
-
['an external node',
|
|
30
|
-
['a ledger node',
|
|
31
|
-
])('using %s', (_,
|
|
32
|
-
const context
|
|
29
|
+
['an external node', mkExternalNode(), externalMocks],
|
|
30
|
+
['a ledger node', mkLedgerNode(), ledgerMocks],
|
|
31
|
+
])('using %s', (_, node, nodeApiMock) => {
|
|
32
|
+
const context = createMockEvmContext({ node })
|
|
33
33
|
|
|
34
34
|
it('returns block info', async () => {
|
|
35
35
|
nodeApiMock.getBlockByHeight.mockResolvedValueOnce({
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
4
|
import type { EvmConfigInfo } from '../config'
|
|
5
|
-
import { createMockEvmContext } from '../fixtures/context.fixtures'
|
|
5
|
+
import { createMockEvmContext, mkExternalNode, mkLedgerNode } from '../fixtures/context.fixtures'
|
|
6
6
|
import { getNodeApi } from '../network/node'
|
|
7
7
|
import { mockNodeApi } from '../network/node/node.fixtures'
|
|
8
8
|
import { getNextSequence } from './getNextSequence'
|
|
@@ -26,10 +26,10 @@ describe('getNextSequence', () => {
|
|
|
26
26
|
})
|
|
27
27
|
|
|
28
28
|
it.each([
|
|
29
|
-
['an external node',
|
|
30
|
-
['a ledger node',
|
|
31
|
-
])('returns next sequence for an address using %s', async (_,
|
|
32
|
-
const context = createMockEvmContext({ node
|
|
29
|
+
['an external node', mkExternalNode(), externalMocks],
|
|
30
|
+
['a ledger node', mkLedgerNode(), ledgerMocks],
|
|
31
|
+
])('returns next sequence for an address using %s', async (_, node, nodeApiMock) => {
|
|
32
|
+
const context = createMockEvmContext({ node })
|
|
33
33
|
nodeApiMock.getTransactionCount.mockResolvedValue(42)
|
|
34
34
|
|
|
35
35
|
expect(await getNextSequence(context, '', '')).toEqual(42n)
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: © 2026 LEDGER SAS
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
-
import type { EvmConfigInfo } from '../config'
|
|
5
|
-
import type { JsonRpcProvider } from 'ethers'
|
|
6
4
|
import { createMockEvmContext } from '../fixtures/context.fixtures'
|
|
5
|
+
import { mkJsonRpcProvider, mkResult } from '../fixtures/ethers.fixtures'
|
|
7
6
|
import { withApi } from '../network/node/rpc.common'
|
|
8
7
|
import { encodeStakingData, decodeStakingResult } from '../staking/encoder'
|
|
9
8
|
import { getValidators } from '../staking/validators'
|
|
@@ -23,16 +22,16 @@ jest.mock('../staking/validators', () => ({
|
|
|
23
22
|
getValidators: jest.fn(),
|
|
24
23
|
}))
|
|
25
24
|
|
|
26
|
-
const mockWithApi =
|
|
27
|
-
const mockEncodeStakingData =
|
|
28
|
-
const mockDecodeStakingResult =
|
|
29
|
-
const mockGetValidators =
|
|
25
|
+
const mockWithApi = jest.mocked(withApi)
|
|
26
|
+
const mockEncodeStakingData = jest.mocked(encodeStakingData)
|
|
27
|
+
const mockDecodeStakingResult = jest.mocked(decodeStakingResult)
|
|
28
|
+
const mockGetValidators = jest.mocked(getValidators)
|
|
30
29
|
|
|
31
30
|
const externalNodeConfig = { type: 'external' as const, uri: 'https://test' }
|
|
32
31
|
const context = createMockEvmContext({
|
|
33
32
|
node: externalNodeConfig,
|
|
34
33
|
name: 'Celo',
|
|
35
|
-
}
|
|
34
|
+
})
|
|
36
35
|
const makeValidator = (validatorAddress: string) => ({
|
|
37
36
|
id: validatorAddress,
|
|
38
37
|
address: validatorAddress,
|
|
@@ -49,12 +48,13 @@ describe('EVM Staking - getStakes', () => {
|
|
|
49
48
|
|
|
50
49
|
it('should return stake objects with positive amounts for supported currencies', async () => {
|
|
51
50
|
mockWithApi.mockImplementation(async (_cur, _currencyId, fn) => {
|
|
52
|
-
const api =
|
|
51
|
+
const api = mkJsonRpcProvider()
|
|
52
|
+
jest.spyOn(api, 'call').mockResolvedValue('0x')
|
|
53
53
|
return fn(api)
|
|
54
54
|
})
|
|
55
55
|
|
|
56
56
|
mockEncodeStakingData.mockReturnValue('0xdeadbeef')
|
|
57
|
-
mockDecodeStakingResult.mockReturnValue(
|
|
57
|
+
mockDecodeStakingResult.mockReturnValue(mkResult({ toString: (): string => '1000000' }))
|
|
58
58
|
|
|
59
59
|
const result = await getStakes(context, 'celo', address)
|
|
60
60
|
|
|
@@ -81,11 +81,12 @@ describe('EVM Staking - getStakes', () => {
|
|
|
81
81
|
|
|
82
82
|
it('should filter out stakes with zero amounts', async () => {
|
|
83
83
|
mockWithApi.mockImplementation(async (_cur, _currencyId, fn) => {
|
|
84
|
-
const api =
|
|
84
|
+
const api = mkJsonRpcProvider()
|
|
85
|
+
jest.spyOn(api, 'call').mockResolvedValue('0x')
|
|
85
86
|
return fn(api)
|
|
86
87
|
})
|
|
87
88
|
mockEncodeStakingData.mockReturnValue('0xdeadbeef')
|
|
88
|
-
mockDecodeStakingResult.mockReturnValue(
|
|
89
|
+
mockDecodeStakingResult.mockReturnValue(mkResult({ toString: (): string => '0' }))
|
|
89
90
|
|
|
90
91
|
const result = await getStakes(context, 'celo', address)
|
|
91
92
|
|
|
@@ -101,24 +102,25 @@ describe('EVM Staking - getStakes', () => {
|
|
|
101
102
|
})
|
|
102
103
|
|
|
103
104
|
mockWithApi.mockImplementation(async (_cur, _currencyId, fn) => {
|
|
104
|
-
const api =
|
|
105
|
+
const api = mkJsonRpcProvider()
|
|
106
|
+
jest.spyOn(api, 'call').mockResolvedValue('0x')
|
|
105
107
|
return fn(api)
|
|
106
108
|
})
|
|
107
109
|
|
|
108
110
|
mockEncodeStakingData.mockReturnValue('0xdeadbeef')
|
|
109
111
|
|
|
110
|
-
mockDecodeStakingResult.mockReturnValueOnce(
|
|
111
|
-
{
|
|
112
|
+
mockDecodeStakingResult.mockReturnValueOnce(
|
|
113
|
+
mkResult({
|
|
112
114
|
balance: { amount: '0', denom: 'usei' },
|
|
113
115
|
delegation: { delegator_address: address, validator_address: 'seivaloper1abc' },
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
mockDecodeStakingResult.mockReturnValueOnce(
|
|
117
|
-
{
|
|
116
|
+
})
|
|
117
|
+
)
|
|
118
|
+
mockDecodeStakingResult.mockReturnValueOnce(
|
|
119
|
+
mkResult({
|
|
118
120
|
balance: { amount: '42', denom: 'usei' },
|
|
119
121
|
delegation: { delegator_address: address, validator_address: 'seivaloper1def' },
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
+
})
|
|
123
|
+
)
|
|
122
124
|
|
|
123
125
|
const result = await getStakes(context, 'sei_evm', address)
|
|
124
126
|
|
|
@@ -148,9 +150,8 @@ describe('EVM Staking - getStakes', () => {
|
|
|
148
150
|
|
|
149
151
|
it('should handle RPC call failures gracefully without crashing', async () => {
|
|
150
152
|
mockWithApi.mockImplementation(async (_cur, _currencyId, fn) => {
|
|
151
|
-
const api =
|
|
152
|
-
|
|
153
|
-
} as unknown as JsonRpcProvider
|
|
153
|
+
const api = mkJsonRpcProvider()
|
|
154
|
+
jest.spyOn(api, 'call').mockRejectedValue(new Error('rpc error'))
|
|
154
155
|
return fn(api)
|
|
155
156
|
})
|
|
156
157
|
mockEncodeStakingData.mockReturnValue('0xdeadbeef')
|
|
@@ -168,17 +169,16 @@ describe('EVM Staking - getStakes', () => {
|
|
|
168
169
|
next: undefined,
|
|
169
170
|
})
|
|
170
171
|
mockWithApi.mockImplementation(async (_cur, _currencyId, fn) => {
|
|
171
|
-
const api =
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
}
|
|
172
|
+
const api = mkJsonRpcProvider()
|
|
173
|
+
jest.spyOn(api, 'call').mockRejectedValue(
|
|
174
|
+
Object.assign(new Error('missing revert data'), {
|
|
175
|
+
code: 'CALL_EXCEPTION',
|
|
176
|
+
data: null,
|
|
177
|
+
reason: null,
|
|
178
|
+
revert: null,
|
|
179
|
+
shortMessage: 'missing revert data',
|
|
180
|
+
})
|
|
181
|
+
)
|
|
182
182
|
return fn(api)
|
|
183
183
|
})
|
|
184
184
|
mockEncodeStakingData.mockReturnValue('0xdeadbeef')
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: © 2026 LEDGER SAS
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
-
import type { EvmConfigInfo } from '../config'
|
|
5
4
|
import type { SourceFetcher } from './internalTransactionsFetcher'
|
|
6
5
|
import type { BlockOperation } from '@ledgerhq/coin-module-framework/api/index'
|
|
7
6
|
import { internalTxSourcesFromList } from '../config'
|
|
8
7
|
import { SourceUnavailableError } from '../errors'
|
|
8
|
+
import {
|
|
9
|
+
createMockEvmConfigInfo,
|
|
10
|
+
mkEtherscanExplorer,
|
|
11
|
+
mkExternalNode,
|
|
12
|
+
mkLedgerExplorer,
|
|
13
|
+
} from '../fixtures/context.fixtures'
|
|
9
14
|
import { getInternalTransactionsByBlock } from '../network/explorer/etherscan'
|
|
10
15
|
import { mockNodeApi } from '../network/node/node.fixtures'
|
|
11
16
|
import { composeInternalTxsFetcher, makeSourceFetchers } from './internalTransactionsFetcher'
|
|
@@ -164,19 +169,18 @@ describe('makeSourceFetchers', () => {
|
|
|
164
169
|
})
|
|
165
170
|
|
|
166
171
|
it('rejects explorer when explorer config is not etherscan-like', async () => {
|
|
167
|
-
const config = {
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
172
|
+
const config = createMockEvmConfigInfo({
|
|
173
|
+
chainId: 1,
|
|
174
|
+
node: mkExternalNode(),
|
|
175
|
+
explorer: mkLedgerExplorer(),
|
|
176
|
+
})
|
|
171
177
|
|
|
172
178
|
const fetchers = makeSourceFetchers(config, mockNodeApi(), '')
|
|
173
179
|
await expect(fetchers.explorer(1)).rejects.toBeInstanceOf(SourceUnavailableError)
|
|
174
180
|
})
|
|
175
181
|
|
|
176
182
|
it('rejects trace_block when traceBlockErigon is undefined', async () => {
|
|
177
|
-
const config = {
|
|
178
|
-
node: { type: 'external' as const, retries: 0 },
|
|
179
|
-
} as unknown as EvmConfigInfo
|
|
183
|
+
const config = createMockEvmConfigInfo({ chainId: 1, node: mkExternalNode() })
|
|
180
184
|
|
|
181
185
|
const { traceBlockErigon: _traceBlockErigon, ...nodeApiWithoutErigon } = mockNodeApi()
|
|
182
186
|
const fetchers = makeSourceFetchers(config, nodeApiWithoutErigon, '')
|
|
@@ -184,10 +188,11 @@ describe('makeSourceFetchers', () => {
|
|
|
184
188
|
})
|
|
185
189
|
|
|
186
190
|
it('wraps explorer runtime failures as SourceUnavailableError', async () => {
|
|
187
|
-
const config = {
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
+
const config = createMockEvmConfigInfo({
|
|
192
|
+
chainId: 1,
|
|
193
|
+
node: mkExternalNode(),
|
|
194
|
+
explorer: mkEtherscanExplorer({ uri: 'https://api.etherscan.io' }),
|
|
195
|
+
})
|
|
191
196
|
|
|
192
197
|
const mockGetInternalTransactionsByBlock = jest.mocked(getInternalTransactionsByBlock)
|
|
193
198
|
mockGetInternalTransactionsByBlock.mockRejectedValueOnce(new Error('explorer error'))
|
|
@@ -197,10 +202,11 @@ describe('makeSourceFetchers', () => {
|
|
|
197
202
|
})
|
|
198
203
|
|
|
199
204
|
it('calls getInternalTransactionsByBlock for explorer when configured', async () => {
|
|
200
|
-
const config = {
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
205
|
+
const config = createMockEvmConfigInfo({
|
|
206
|
+
chainId: 1,
|
|
207
|
+
node: mkExternalNode(),
|
|
208
|
+
explorer: mkEtherscanExplorer({ uri: 'https://api.etherscan.io' }),
|
|
209
|
+
})
|
|
204
210
|
|
|
205
211
|
const mockGetInternalTransactionsByBlock = jest.mocked(getInternalTransactionsByBlock)
|
|
206
212
|
mockGetInternalTransactionsByBlock.mockResolvedValueOnce([])
|
|
@@ -212,9 +218,7 @@ describe('makeSourceFetchers', () => {
|
|
|
212
218
|
})
|
|
213
219
|
|
|
214
220
|
it('empty always resolves to an empty map', async () => {
|
|
215
|
-
const config = {
|
|
216
|
-
node: { type: 'external' as const, retries: 0 },
|
|
217
|
-
} as unknown as EvmConfigInfo
|
|
221
|
+
const config = createMockEvmConfigInfo({ chainId: 1, node: mkExternalNode() })
|
|
218
222
|
|
|
219
223
|
const fetchers = makeSourceFetchers(config, mockNodeApi(), '')
|
|
220
224
|
await expect(fetchers.empty(1)).resolves.toEqual(new Map<string, BlockOperation[]>())
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: © 2026 LEDGER SAS
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
-
import type {
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
import type {
|
|
5
|
+
BlockFinalizationTag,
|
|
6
|
+
EvmConfigInfo,
|
|
7
|
+
ExternalNodeConfig,
|
|
8
|
+
LedgerNodeConfig,
|
|
9
|
+
} from '../config'
|
|
10
|
+
import { createMockEvmContext, mkExternalNode, mkLedgerNode } from '../fixtures/context.fixtures'
|
|
7
11
|
import { getNodeApi } from '../network/node'
|
|
8
12
|
import { mockNodeApi } from '../network/node/node.fixtures'
|
|
9
13
|
import { lastBlock } from './lastBlock'
|
|
@@ -27,9 +31,9 @@ describe('lastBlock', () => {
|
|
|
27
31
|
})
|
|
28
32
|
|
|
29
33
|
it.each([
|
|
30
|
-
['an external node',
|
|
31
|
-
['a ledger node',
|
|
32
|
-
])('returns last block info using %s', async (_,
|
|
34
|
+
['an external node', mkExternalNode(), externalMocks],
|
|
35
|
+
['a ledger node', mkLedgerNode(), ledgerMocks],
|
|
36
|
+
])('returns last block info using %s', async (_, node, nodeApiMock) => {
|
|
33
37
|
const blockResult = {
|
|
34
38
|
hash: 'hash',
|
|
35
39
|
parentHash: 'parentHash',
|
|
@@ -38,16 +42,16 @@ describe('lastBlock', () => {
|
|
|
38
42
|
}
|
|
39
43
|
const expectedInfo = { hash: 'hash', height: 33, time: new Date('2025-12-31') }
|
|
40
44
|
|
|
41
|
-
const context = createMockEvmContext({ node
|
|
45
|
+
const context = createMockEvmContext({ node })
|
|
42
46
|
nodeApiMock.getBlockByHeight.mockResolvedValue(blockResult)
|
|
43
47
|
|
|
44
48
|
expect(await lastBlock(context, '')).toEqual(expectedInfo)
|
|
45
49
|
})
|
|
46
50
|
|
|
47
51
|
it.each([
|
|
48
|
-
['an external node',
|
|
49
|
-
['a ledger node',
|
|
50
|
-
])("passes 'latest' by default to getBlockByHeight using %s", async (_,
|
|
52
|
+
['an external node', mkExternalNode(), externalMocks],
|
|
53
|
+
['a ledger node', mkLedgerNode(), ledgerMocks],
|
|
54
|
+
])("passes 'latest' by default to getBlockByHeight using %s", async (_, node, nodeApiMock) => {
|
|
51
55
|
const blockResult = {
|
|
52
56
|
hash: 'hash',
|
|
53
57
|
parentHash: 'parentHash',
|
|
@@ -55,7 +59,7 @@ describe('lastBlock', () => {
|
|
|
55
59
|
timestamp: new Date('2025-12-31').getTime(),
|
|
56
60
|
}
|
|
57
61
|
|
|
58
|
-
const context = createMockEvmContext({ node
|
|
62
|
+
const context = createMockEvmContext({ node })
|
|
59
63
|
nodeApiMock.getBlockByHeight.mockResolvedValue(blockResult)
|
|
60
64
|
|
|
61
65
|
await lastBlock(context, '')
|
|
@@ -63,14 +67,21 @@ describe('lastBlock', () => {
|
|
|
63
67
|
expect(nodeApiMock.getBlockByHeight).toHaveBeenCalledWith(expect.anything(), 'latest')
|
|
64
68
|
})
|
|
65
69
|
|
|
66
|
-
it.each<
|
|
67
|
-
[
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
70
|
+
it.each<
|
|
71
|
+
[
|
|
72
|
+
BlockFinalizationTag,
|
|
73
|
+
string,
|
|
74
|
+
ExternalNodeConfig | LedgerNodeConfig,
|
|
75
|
+
jest.Mocked<ReturnType<typeof mockNodeApi>>,
|
|
76
|
+
]
|
|
77
|
+
>([
|
|
78
|
+
['finalized', 'an external node', mkExternalNode(), externalMocks],
|
|
79
|
+
['finalized', 'a ledger node', mkLedgerNode(), ledgerMocks],
|
|
80
|
+
['safe', 'an external node', mkExternalNode(), externalMocks],
|
|
81
|
+
['safe', 'a ledger node', mkLedgerNode(), ledgerMocks],
|
|
71
82
|
])(
|
|
72
83
|
"forwards finalizationLevel '%s' to getBlockByHeight using %s",
|
|
73
|
-
async (finalizationLevel, _,
|
|
84
|
+
async (finalizationLevel, _, node, nodeApiMock) => {
|
|
74
85
|
const blockResult = {
|
|
75
86
|
hash: 'hash',
|
|
76
87
|
parentHash: 'parentHash',
|
|
@@ -79,10 +90,7 @@ describe('lastBlock', () => {
|
|
|
79
90
|
}
|
|
80
91
|
const expectedInfo = { hash: 'hash', height: 33, time: new Date('2025-12-31') }
|
|
81
92
|
|
|
82
|
-
const context = createMockEvmContext({
|
|
83
|
-
node: { type },
|
|
84
|
-
finalizationLevel,
|
|
85
|
-
} as Partial<EvmConfigInfo>)
|
|
93
|
+
const context = createMockEvmContext({ node, finalizationLevel })
|
|
86
94
|
nodeApiMock.getBlockByHeight.mockResolvedValue(blockResult)
|
|
87
95
|
|
|
88
96
|
expect(await lastBlock(context, '')).toEqual(expectedInfo)
|