@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.
Files changed (47) hide show
  1. package/.oxlintrc.json +1 -1
  2. package/CHANGELOG.md +7 -0
  3. package/package.json +2 -2
  4. package/src/adapters/blockOperations.test.ts +27 -29
  5. package/src/api/index.flare.integ.test.ts +1 -13
  6. package/src/api/index.integ.test.ts +86 -97
  7. package/src/fixtures/context.fixtures.ts +79 -1
  8. package/src/fixtures/ethers.fixtures.ts +26 -0
  9. package/src/logic/broadcast.integ.test.ts +6 -18
  10. package/src/logic/broadcast.test.ts +19 -31
  11. package/src/logic/broadcastSource.test.ts +6 -7
  12. package/src/logic/common.test.ts +120 -112
  13. package/src/logic/craftTransaction.test.ts +161 -199
  14. package/src/logic/craftTransactionData.test.ts +6 -6
  15. package/src/logic/estimateFees.test.ts +19 -15
  16. package/src/logic/getBalance.test.ts +15 -14
  17. package/src/logic/getBlock.test.ts +372 -382
  18. package/src/logic/getBlockInfo.test.ts +6 -6
  19. package/src/logic/getNextSequence.test.ts +5 -5
  20. package/src/logic/getStakes.test.ts +34 -34
  21. package/src/logic/internalTransactionsFetcher.test.ts +23 -19
  22. package/src/logic/lastBlock.test.ts +29 -21
  23. package/src/logic/listOperations.test.ts +43 -40
  24. package/src/logic/validateIntent.test.ts +151 -101
  25. package/src/logic.test.ts +13 -18
  26. package/src/network/explorer/etherscan.test.ts +5 -5
  27. package/src/network/explorer/index.test.ts +51 -21
  28. package/src/network/explorer/ledger.test.ts +15 -4
  29. package/src/network/gasTracker/index.test.ts +14 -8
  30. package/src/network/gasTracker/ledger.test.ts +25 -13
  31. package/src/network/node/index.memoization.test.ts +25 -31
  32. package/src/network/node/index.test.ts +14 -25
  33. package/src/network/node/ledger.test.ts +45 -60
  34. package/src/network/node/node.fixtures.ts +0 -2
  35. package/src/network/node/rpc.test.ts +152 -177
  36. package/src/staking/encoder.test.ts +13 -21
  37. package/src/staking/logic.test.ts +20 -14
  38. package/src/staking/operations/index.test.ts +28 -28
  39. package/src/staking/prepareIntents.test.ts +26 -20
  40. package/src/staking/redelegations.test.ts +27 -18
  41. package/src/staking/rewards.test.ts +23 -15
  42. package/src/staking/rewardsFromReceipt.test.ts +19 -20
  43. package/src/staking/transactionData.test.ts +22 -22
  44. package/src/staking/validators/monad.test.ts +65 -24
  45. package/src/staking/validators/somnia.test.ts +21 -13
  46. package/src/staking/validators/zero_gravity.test.ts +118 -48
  47. package/src/staking/validators.integ.test.ts +13 -25
@@ -15,9 +15,6 @@ const mockGetNodeApi = jest.mocked(getNodeApi)
15
15
 
16
16
  describe('broadcastLogic', () => {
17
17
  const nodeApiMock = mockNodeApi()
18
- const mockCurrency = { id: 'ethereum' } as any
19
- const mockSignature = '0xabcdef'
20
- const mockBroadcastConfig = { mevProtection: true } as any
21
18
 
22
19
  beforeEach(() => {
23
20
  jest.clearAllMocks()
@@ -26,55 +23,46 @@ describe('broadcastLogic', () => {
26
23
 
27
24
  it('should call getNodeApi and broadcastTransaction with correct arguments', async () => {
28
25
  nodeApiMock.broadcastTransaction.mockResolvedValue('txid123')
29
- const result = await broadcast(mockEvmContext, mockCurrency, {
30
- signature: mockSignature,
31
- broadcastConfig: mockBroadcastConfig,
26
+ const result = await broadcast(mockEvmContext, 'ethereum', {
27
+ signature: '0xabcdef',
28
+ broadcastConfig: { mevProtected: true },
29
+ })
30
+ expect(mockGetNodeApi).toHaveBeenCalledWith(expect.anything(), 'ethereum')
31
+ expect(nodeApiMock.broadcastTransaction).toHaveBeenCalledWith('ethereum', '0xabcdef', {
32
+ mevProtected: true,
32
33
  })
33
- expect(mockGetNodeApi).toHaveBeenCalledWith(expect.anything(), mockCurrency)
34
- expect(nodeApiMock.broadcastTransaction).toHaveBeenCalledWith(
35
- mockCurrency,
36
- mockSignature,
37
- mockBroadcastConfig
38
- )
39
34
  expect(result).toBe('txid123')
40
35
  })
41
36
 
42
37
  it('should propagate errors from broadcastTransaction', async () => {
43
38
  nodeApiMock.broadcastTransaction.mockRejectedValue(new Error('Broadcast failed'))
44
39
  await expect(
45
- broadcast(mockEvmContext, mockCurrency, {
46
- signature: mockSignature,
47
- broadcastConfig: mockBroadcastConfig,
40
+ broadcast(mockEvmContext, 'ethereum', {
41
+ signature: '0xabcdef',
42
+ broadcastConfig: { mevProtected: true },
48
43
  })
49
44
  ).rejects.toThrow('Broadcast failed')
50
45
  })
51
46
 
52
47
  it('should handle undefined broadcastConfig', async () => {
53
48
  nodeApiMock.broadcastTransaction.mockResolvedValue('txid456')
54
- const result = await broadcast(mockEvmContext, mockCurrency, {
55
- signature: mockSignature,
49
+ const result = await broadcast(mockEvmContext, 'ethereum', {
50
+ signature: '0xabcdef',
56
51
  broadcastConfig: undefined,
57
52
  })
58
- expect(nodeApiMock.broadcastTransaction).toHaveBeenCalledWith(
59
- mockCurrency,
60
- mockSignature,
61
- undefined
62
- )
53
+ expect(nodeApiMock.broadcastTransaction).toHaveBeenCalledWith('ethereum', '0xabcdef', undefined)
63
54
  expect(result).toBe('txid456')
64
55
  })
65
56
 
66
57
  it('should handle different signature values', async () => {
67
58
  nodeApiMock.broadcastTransaction.mockResolvedValue('txid789')
68
- const anotherSignature = '0x123456'
69
- const result = await broadcast(mockEvmContext, mockCurrency, {
70
- signature: anotherSignature,
71
- broadcastConfig: mockBroadcastConfig,
59
+ const result = await broadcast(mockEvmContext, 'ethereum', {
60
+ signature: '0x123456',
61
+ broadcastConfig: { mevProtected: true },
62
+ })
63
+ expect(nodeApiMock.broadcastTransaction).toHaveBeenCalledWith('ethereum', '0x123456', {
64
+ mevProtected: true,
72
65
  })
73
- expect(nodeApiMock.broadcastTransaction).toHaveBeenCalledWith(
74
- mockCurrency,
75
- anotherSignature,
76
- mockBroadcastConfig
77
- )
78
66
  expect(result).toBe('txid789')
79
67
  })
80
68
  })
@@ -15,7 +15,6 @@ const mockGetNodeApi = jest.mocked(getNodeApi)
15
15
 
16
16
  describe('EVM broadcast with source', () => {
17
17
  const nodeApiMock = mockNodeApi()
18
- const mockCurrency = { id: 'ethereum' } as any
19
18
 
20
19
  beforeEach(() => {
21
20
  jest.clearAllMocks()
@@ -24,7 +23,7 @@ describe('EVM broadcast with source', () => {
24
23
  })
25
24
 
26
25
  it('should broadcast with source headers from broadcastConfig', async () => {
27
- const result = await broadcast(mockEvmContext, mockCurrency, {
26
+ const result = await broadcast(mockEvmContext, 'ethereum', {
28
27
  signature: '0xsignature',
29
28
  broadcastConfig: {
30
29
  mevProtected: true,
@@ -36,7 +35,7 @@ describe('EVM broadcast with source', () => {
36
35
  })
37
36
 
38
37
  expect(nodeApiMock.broadcastTransaction).toHaveBeenCalledWith(
39
- mockCurrency,
38
+ 'ethereum',
40
39
  '0xsignature',
41
40
  expect.objectContaining({
42
41
  mevProtected: true,
@@ -50,7 +49,7 @@ describe('EVM broadcast with source', () => {
50
49
  })
51
50
 
52
51
  it('should broadcast swap transaction with swap source', async () => {
53
- const result = await broadcast(mockEvmContext, mockCurrency, {
52
+ const result = await broadcast(mockEvmContext, 'ethereum', {
54
53
  signature: '0xsignature',
55
54
  broadcastConfig: {
56
55
  mevProtected: false,
@@ -63,7 +62,7 @@ describe('EVM broadcast with source', () => {
63
62
  })
64
63
 
65
64
  expect(nodeApiMock.broadcastTransaction).toHaveBeenCalledWith(
66
- mockCurrency,
65
+ 'ethereum',
67
66
  '0xsignature',
68
67
  expect.objectContaining({
69
68
  source: {
@@ -76,7 +75,7 @@ describe('EVM broadcast with source', () => {
76
75
  })
77
76
 
78
77
  it('should broadcast without source when not provided', async () => {
79
- const result = await broadcast(mockEvmContext, mockCurrency, {
78
+ const result = await broadcast(mockEvmContext, 'ethereum', {
80
79
  signature: '0xsignature',
81
80
  broadcastConfig: {
82
81
  mevProtected: false,
@@ -84,7 +83,7 @@ describe('EVM broadcast with source', () => {
84
83
  })
85
84
 
86
85
  expect(nodeApiMock.broadcastTransaction).toHaveBeenCalledWith(
87
- mockCurrency,
86
+ 'ethereum',
88
87
  '0xsignature',
89
88
  expect.objectContaining({
90
89
  mevProtected: false,
@@ -1,10 +1,14 @@
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 { FeeEstimation, MemoNotSupported } from '@ledgerhq/coin-module-framework/api/index'
6
- import type { TransactionIntent, BufferTxData } from '@ledgerhq/coin-module-framework/api/types'
4
+ import type { MemoNotSupported } from '@ledgerhq/coin-module-framework/api/index'
5
+ import type { BufferTxData } from '@ledgerhq/coin-module-framework/api/types'
6
+ import {
7
+ createSendTransactionIntentMockData,
8
+ createStakingTransactionIntentMockData,
9
+ } from '@ledgerhq/coin-module-framework/test-utils'
7
10
  import { BigNumber } from 'bignumber.js'
11
+ import { createMockEvmConfigInfo, mkExternalNode } from '../fixtures/context.fixtures'
8
12
  import { getNodeApi } from '../network/node'
9
13
  import { mockNodeApi } from '../network/node/node.fixtures'
10
14
  import { buildStakingTransactionParams } from '../staking'
@@ -13,7 +17,7 @@ import { getCallData, prepareUnsignedTxParams } from './common'
13
17
  import * as getErc20DataModule from './getErc20Data'
14
18
 
15
19
  jest.mock('./getErc20Data', () => {
16
- const actual = jest.requireActual<typeof getErc20DataModule>('./getErc20Data')
20
+ const actual = jest.requireActual('./getErc20Data')
17
21
  return {
18
22
  getErc20Data: jest.fn((recipient: string, amount: bigint) =>
19
23
  actual.getErc20Data(recipient, amount)
@@ -29,17 +33,18 @@ jest.mock('../network/node', () => ({
29
33
  jest.mock('../staking', () => ({
30
34
  ...jest.requireActual('../staking'),
31
35
  buildStakingTransactionParams: jest.fn(),
36
+ prepareStakingIntent: jest.fn((_config, _currencyId, intent) => Promise.resolve(intent)),
32
37
  }))
33
38
 
34
39
  const mockGetNodeApi = jest.mocked(getNodeApi)
35
40
  const mockBuildStakingTransactionParams = jest.mocked(buildStakingTransactionParams)
36
41
 
37
- const getErc20DataMock = getErc20DataModule.getErc20Data as jest.Mock
42
+ const getErc20DataMock = jest.mocked(getErc20DataModule.getErc20Data)
38
43
 
39
- const testConfig = {
40
- status: { type: 'active' },
41
- node: { type: 'external', uri: 'https://test' },
42
- } as unknown as EvmConfigInfo
44
+ const testConfig = createMockEvmConfigInfo({
45
+ chainId: 1,
46
+ node: mkExternalNode({ uri: 'https://test' }),
47
+ })
43
48
 
44
49
  describe('common', () => {
45
50
  describe('getCallData', () => {
@@ -48,80 +53,78 @@ describe('common', () => {
48
53
  })
49
54
 
50
55
  it('should return data field from intent when available and not compute calldata', () => {
51
- const intent = {
52
- data: {
53
- value: Buffer.from(
54
- 'a9059cbb000000000000000000000000d8ff72a08408b97655ee94381b8fa24ba7d6f5ac0000000000000000000000000000000000000000000000000000000000895440'
55
- ),
56
- },
57
- } as unknown as TransactionIntent<MemoNotSupported, BufferTxData>
58
- const expectedResult = Buffer.from(intent.data.value)
59
-
60
- const result = getCallData(intent)
61
- expect(result).toEqual(expectedResult)
56
+ expect(
57
+ getCallData(
58
+ createSendTransactionIntentMockData<MemoNotSupported, BufferTxData>({
59
+ type: 'send',
60
+ data: {
61
+ type: 'buffer',
62
+ value: Buffer.from(
63
+ 'a9059cbb000000000000000000000000d8ff72a08408b97655ee94381b8fa24ba7d6f5ac0000000000000000000000000000000000000000000000000000000000895440'
64
+ ),
65
+ },
66
+ })
67
+ )
68
+ ).toEqual(
69
+ Buffer.from(
70
+ 'a9059cbb000000000000000000000000d8ff72a08408b97655ee94381b8fa24ba7d6f5ac0000000000000000000000000000000000000000000000000000000000895440'
71
+ )
72
+ )
62
73
  expect(getErc20DataMock).not.toHaveBeenCalled()
63
74
  })
64
75
 
65
76
  it.each([
66
77
  {
67
78
  title: 'intent on native Ethereum with no amount and no recipient',
68
- intent: {
69
- asset: {
70
- type: 'native',
71
- },
72
- } as unknown as TransactionIntent<MemoNotSupported, BufferTxData>,
79
+ intent: createSendTransactionIntentMockData<MemoNotSupported, BufferTxData>({
80
+ type: 'send',
81
+ asset: { type: 'native' },
82
+ }),
73
83
  },
74
84
  {
75
85
  title: 'intent on ERC20 token with no amount and no recipient',
76
- intent: {
77
- asset: {
78
- type: 'erc20',
79
- },
80
- } as unknown as TransactionIntent<MemoNotSupported, BufferTxData>,
86
+ intent: createSendTransactionIntentMockData<MemoNotSupported, BufferTxData>({
87
+ type: 'send',
88
+ asset: { type: 'erc20' },
89
+ }),
81
90
  },
82
91
  {
83
92
  title: 'intent on ERC20 token with no recipient',
84
- intent: {
85
- asset: {
86
- type: 'erc20',
87
- },
93
+ intent: createSendTransactionIntentMockData<MemoNotSupported, BufferTxData>({
94
+ type: 'send',
95
+ asset: { type: 'erc20' },
88
96
  amount: 1n,
89
- } as unknown as TransactionIntent<MemoNotSupported, BufferTxData>,
97
+ }),
90
98
  },
91
99
  {
92
100
  title: 'intent on ERC20 token with a Bitcoin address for recipient',
93
- intent: {
94
- asset: {
95
- type: 'erc20',
96
- },
101
+ intent: createSendTransactionIntentMockData<MemoNotSupported, BufferTxData>({
102
+ type: 'send',
103
+ asset: { type: 'erc20' },
97
104
  amount: 1n,
98
- recipient: 'bc1pxlmrudqyq8qd8pfsc4mpmlaw56x6vtcr9m8nvp8kj3gckefc4kmqhkg4l7', // Bitcoin address
99
- } as unknown as TransactionIntent<MemoNotSupported, BufferTxData>,
105
+ recipient: 'bc1pxlmrudqyq8qd8pfsc4mpmlaw56x6vtcr9m8nvp8kj3gckefc4kmqhkg4l7',
106
+ }),
100
107
  },
101
108
  {
102
109
  title: 'intent on ERC20 token with a Solana address for recipient',
103
- intent: {
104
- asset: {
105
- type: 'erc20',
106
- },
110
+ intent: createSendTransactionIntentMockData<MemoNotSupported, BufferTxData>({
111
+ type: 'send',
112
+ asset: { type: 'erc20' },
107
113
  amount: 1n,
108
- recipient: 'Hj69wRzkrFuf1Nby4yzPEFHdsmQdMoVYjvDKZSLjZFEp', // Solana address
109
- } as unknown as TransactionIntent<MemoNotSupported, BufferTxData>,
114
+ recipient: 'Hj69wRzkrFuf1Nby4yzPEFHdsmQdMoVYjvDKZSLjZFEp',
115
+ }),
110
116
  },
111
117
  {
112
118
  title: 'intent on ERC20 token with a random text for recipient',
113
- intent: {
114
- asset: {
115
- type: 'erc20',
116
- },
119
+ intent: createSendTransactionIntentMockData<MemoNotSupported, BufferTxData>({
120
+ type: 'send',
121
+ asset: { type: 'erc20' },
117
122
  amount: 1n,
118
- recipient: 'some randon value', // Random text
119
- } as unknown as TransactionIntent<MemoNotSupported, BufferTxData>,
123
+ recipient: 'some randon value',
124
+ }),
120
125
  },
121
126
  ])('should return empty buffer for invalid $title', ({ intent }) => {
122
- const expectedResult = Buffer.from([])
123
- const result = getCallData(intent)
124
- expect(result).toEqual(expectedResult)
127
+ expect(getCallData(intent)).toEqual(Buffer.from([]))
125
128
  expect(getErc20DataMock).not.toHaveBeenCalled()
126
129
  })
127
130
 
@@ -129,22 +132,23 @@ describe('common', () => {
129
132
  const recipient = '0x66c4371aE8FFeD2ec1c2EBbbcCfb7E494181E1E3'
130
133
  const amount = 1n
131
134
 
132
- const intent = {
133
- asset: { type: 'erc20' },
134
- recipient,
135
- amount,
136
- } as unknown as TransactionIntent<MemoNotSupported, BufferTxData>
137
-
138
- const expectedResult = Buffer.from(
139
- 'a9059cbb00000000000000000000000066c4371ae8ffed2ec1c2ebbbccfb7e494181e1e30000000000000000000000000000000000000000000000000000000000000001',
140
- 'hex'
135
+ expect(
136
+ getCallData(
137
+ createSendTransactionIntentMockData<MemoNotSupported, BufferTxData>({
138
+ type: 'send',
139
+ asset: { type: 'erc20' },
140
+ recipient,
141
+ amount,
142
+ })
143
+ )
144
+ ).toEqual(
145
+ Buffer.from(
146
+ 'a9059cbb00000000000000000000000066c4371ae8ffed2ec1c2ebbbccfb7e494181e1e30000000000000000000000000000000000000000000000000000000000000001',
147
+ 'hex'
148
+ )
141
149
  )
142
-
143
- const result = getCallData(intent)
144
-
145
150
  expect(getErc20DataMock).toHaveBeenCalledTimes(1)
146
151
  expect(getErc20DataMock).toHaveBeenCalledWith(recipient, amount)
147
- expect(result).toEqual(expectedResult)
148
152
  })
149
153
  })
150
154
 
@@ -156,8 +160,7 @@ describe('common', () => {
156
160
  )
157
161
 
158
162
  const makeStakingIntent = (amount: bigint) =>
159
- ({
160
- intentType: 'staking',
163
+ createStakingTransactionIntentMockData<MemoNotSupported, BufferTxData>({
161
164
  type: 'staking-legacy',
162
165
  mode: 'delegate',
163
166
  amount,
@@ -167,7 +170,7 @@ describe('common', () => {
167
170
  valAddress: 'seivaloper1y82m5y3wevjneamzg0pmx87dzanyxzht0kepvn',
168
171
  feesStrategy: 'medium',
169
172
  data: { type: 'buffer', value: Buffer.from([]) },
170
- }) as unknown as TransactionIntent<MemoNotSupported, BufferTxData>
173
+ })
171
174
 
172
175
  const nodeApiMock = mockNodeApi()
173
176
 
@@ -294,18 +297,21 @@ describe('common', () => {
294
297
  })
295
298
  nodeApiMock.getGasEstimation.mockResolvedValueOnce(new BigNumber(237_279))
296
299
 
297
- const result = await prepareUnsignedTxParams(testConfig, 'zero_gravity', {
298
- intentType: 'staking',
299
- type: 'staking-eip1559',
300
- mode: 'delegate',
301
- amount: 1_000_000_000n,
302
- asset: { type: 'native' },
303
- recipient: '0xVaultAddress',
304
- sender: '0xSender',
305
- valAddress: '0xVaultAddress',
306
- feesStrategy: 'medium',
307
- data: { type: 'buffer', value: Buffer.from([]) },
308
- } as unknown as TransactionIntent<MemoNotSupported, BufferTxData>)
300
+ const result = await prepareUnsignedTxParams(
301
+ testConfig,
302
+ 'zero_gravity',
303
+ createStakingTransactionIntentMockData<MemoNotSupported, BufferTxData>({
304
+ type: 'staking-eip1559',
305
+ mode: 'delegate',
306
+ amount: 1_000_000_000n,
307
+ asset: { type: 'native' },
308
+ recipient: '0xVaultAddress',
309
+ sender: '0xSender',
310
+ valAddress: '0xVaultAddress',
311
+ feesStrategy: 'medium',
312
+ data: { type: 'buffer', value: Buffer.from([]) },
313
+ })
314
+ )
309
315
 
310
316
  // 237279 × 1.2 = 284734.8 → ceil → 284735
311
317
  expect(result.gasLimit).toEqual(new BigNumber(284_735))
@@ -319,19 +325,21 @@ describe('common', () => {
319
325
  })
320
326
  nodeApiMock.getGasEstimation.mockResolvedValueOnce(new BigNumber(237_279))
321
327
 
322
- const result = await prepareUnsignedTxParams(testConfig, 'zero_gravity', {
323
- intentType: 'staking',
324
- type: 'staking-eip1559',
325
- mode: 'undelegate',
326
- amount: 1_000_000_000n,
327
- shares: 1_000_000_000_000n,
328
- asset: { type: 'native' },
329
- recipient: '0xVaultAddress',
330
- sender: '0xSender',
331
- valAddress: '0xVaultAddress',
332
- feesStrategy: 'medium',
333
- data: { type: 'buffer', value: Buffer.from([]) },
334
- } as unknown as TransactionIntent<MemoNotSupported, BufferTxData>)
328
+ const result = await prepareUnsignedTxParams(
329
+ testConfig,
330
+ 'zero_gravity',
331
+ createStakingTransactionIntentMockData<MemoNotSupported, BufferTxData>({
332
+ type: 'staking-eip1559',
333
+ mode: 'undelegate',
334
+ amount: 1_000_000_000n,
335
+ asset: { type: 'native' },
336
+ recipient: '0xVaultAddress',
337
+ sender: '0xSender',
338
+ valAddress: '0xVaultAddress',
339
+ feesStrategy: 'medium',
340
+ data: { type: 'buffer', value: Buffer.from([]) },
341
+ })
342
+ )
335
343
 
336
344
  expect(result.gasLimit).toEqual(new BigNumber(284_735))
337
345
  })
@@ -346,8 +354,7 @@ describe('common', () => {
346
354
  const result = await prepareUnsignedTxParams(
347
355
  testConfig,
348
356
  'zero_gravity',
349
- {
350
- intentType: 'staking',
357
+ createStakingTransactionIntentMockData<MemoNotSupported, BufferTxData>({
351
358
  type: 'staking-eip1559',
352
359
  mode: 'delegate',
353
360
  amount: 1_000_000_000n,
@@ -357,8 +364,8 @@ describe('common', () => {
357
364
  valAddress: '0xVaultAddress',
358
365
  feesStrategy: 'medium',
359
366
  data: { type: 'buffer', value: Buffer.from([]) },
360
- } as unknown as TransactionIntent<MemoNotSupported, BufferTxData>,
361
- { gasLimit: 300_000n } as FeeEstimation['parameters']
367
+ }),
368
+ { gasLimit: 300_000n }
362
369
  )
363
370
 
364
371
  expect(nodeApiMock.getGasEstimation).not.toHaveBeenCalled()
@@ -366,19 +373,20 @@ describe('common', () => {
366
373
  })
367
374
 
368
375
  it('does not retry for send transactions — falls back to gasLimit=0 on first failure without a second call', async () => {
369
- const sendIntent = {
370
- intentType: 'transaction',
371
- type: 'send-legacy',
372
- amount: 1n,
373
- asset: { type: 'native' },
374
- recipient: '0x7b2C7232f9E38F30E2868f0E5Bf311Cd83554b5A',
375
- sender: '0xSender',
376
- data: { type: 'buffer', value: Buffer.from([]) },
377
- } as unknown as TransactionIntent<MemoNotSupported, BufferTxData>
378
-
379
376
  nodeApiMock.getGasEstimation.mockRejectedValueOnce(GAS_ESTIMATION_ERROR)
380
377
 
381
- const result = await prepareUnsignedTxParams(testConfig, 'sei_evm', sendIntent)
378
+ const result = await prepareUnsignedTxParams(
379
+ testConfig,
380
+ 'sei_evm',
381
+ createSendTransactionIntentMockData<MemoNotSupported, BufferTxData>({
382
+ type: 'send-legacy',
383
+ amount: 1n,
384
+ asset: { type: 'native' },
385
+ recipient: '0x7b2C7232f9E38F30E2868f0E5Bf311Cd83554b5A',
386
+ sender: '0xSender',
387
+ data: { type: 'buffer', value: Buffer.from([]) },
388
+ })
389
+ )
382
390
 
383
391
  expect(nodeApiMock.getGasEstimation).toHaveBeenCalledTimes(1)
384
392
  expect(result.gasLimit).toEqual(new BigNumber(0))