@ledgerhq/coin-evm 15.0.0 → 15.2.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 +16 -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.map +1 -1
- package/lib/api/index.js +0 -1
- package/lib/api/index.js.map +1 -1
- package/lib/chains.d.ts +1 -0
- package/lib/chains.d.ts.map +1 -1
- package/lib/chains.js +1 -0
- package/lib/chains.js.map +1 -1
- package/lib/logic/getBlock.js +21 -4
- package/lib/logic/getBlock.js.map +1 -1
- package/lib/logic/listOperations.d.ts.map +1 -1
- package/lib/logic/listOperations.js +2 -0
- package/lib/logic/listOperations.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 +1 -0
- 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 +17 -0
- 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-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.map +1 -1
- package/lib-es/api/index.js +0 -1
- package/lib-es/api/index.js.map +1 -1
- package/lib-es/chains.d.ts +1 -0
- package/lib-es/chains.d.ts.map +1 -1
- package/lib-es/chains.js +1 -0
- package/lib-es/chains.js.map +1 -1
- package/lib-es/logic/getBlock.js +21 -4
- package/lib-es/logic/getBlock.js.map +1 -1
- package/lib-es/logic/listOperations.d.ts.map +1 -1
- package/lib-es/logic/listOperations.js +2 -0
- package/lib-es/logic/listOperations.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 +1 -0
- 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 +17 -0
- 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/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 +0 -1
- package/src/api/{getBlock.integ.test.ts → tests/getBlock.integ.test.ts} +4 -4
- package/src/api/{index.arbitrum.integ.test.ts → tests/index.arbitrum.integ.test.ts} +3 -3
- package/src/api/{index.arc.integ.test.ts → tests/index.arc.integ.test.ts} +3 -3
- package/src/api/{index.avalanche_c_chain_fuji.integ.test.ts → tests/index.avalanche_c_chain_fuji.integ.test.ts} +3 -3
- package/src/api/{index.cronos.integ.test.ts → tests/index.cronos.integ.test.ts} +3 -3
- package/src/api/{index.flare.integ.test.ts → tests/index.flare.integ.test.ts} +3 -3
- package/src/api/{index.integ.test.ts → tests/index.integ.test.ts} +3 -3
- package/src/api/{index.linea.integ.test.ts → tests/index.linea.integ.test.ts} +3 -3
- package/src/api/{index.monad_testnet.integ.test.ts → tests/index.monad_testnet.integ.test.ts} +4 -4
- package/src/api/{index.optimism.integ.test.ts → tests/index.optimism.integ.test.ts} +3 -3
- package/src/api/{index.rsk.integ.test.ts → tests/index.rsk.integ.test.ts} +3 -3
- package/src/api/{index.shape.integ.test.ts → tests/index.shape.integ.test.ts} +3 -3
- package/src/api/{index.somnia.integ.test.ts → tests/index.somnia.integ.test.ts} +3 -3
- package/src/api/{index.test.ts → tests/index.test.ts} +4 -4
- package/src/api/{index.zksync.integ.test.ts → tests/index.zksync.integ.test.ts} +2 -2
- package/src/chains.ts +1 -0
- package/src/logic/getBlock.ts +37 -4
- package/src/logic/listOperations.ts +2 -0
- package/src/logic/tests/broadcast.test.ts +1 -1
- package/src/logic/tests/broadcastSource.test.ts +1 -1
- package/src/logic/tests/common.test.ts +1 -1
- package/src/logic/tests/craftTransaction.test.ts +1 -1
- package/src/logic/tests/estimateFees.test.ts +1 -1
- package/src/logic/tests/getBalance.test.ts +1 -1
- package/src/logic/tests/getBlock.test.ts +126 -5
- package/src/logic/tests/getBlockInfo.test.ts +1 -1
- package/src/logic/tests/getNextSequence.test.ts +1 -1
- package/src/logic/tests/internalTransactionsFetcher.test.ts +1 -1
- package/src/logic/tests/lastBlock.test.ts +1 -1
- package/src/logic/tests/listOperations.test.ts +5 -3
- package/src/logic/tests/validateIntent.test.ts +37 -1
- package/src/logic.test.ts +1 -1
- package/src/network/node/explorerProxy.ts +2 -0
- package/src/network/node/ledger.ts +1 -0
- package/src/network/node/rpc.common.ts +21 -0
- 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 +7 -7
- 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 +7 -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 +15 -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
|
@@ -77,6 +77,8 @@ describe('EVM Family', () => {
|
|
|
77
77
|
},
|
|
78
78
|
details: {
|
|
79
79
|
sequence: '7',
|
|
80
|
+
gasPrice: '125521409858',
|
|
81
|
+
gasLimit: '6000000',
|
|
80
82
|
contractInteraction: 'SmartContractDeployment',
|
|
81
83
|
contractAddress: '0x4969D9fD2542e71e6b3EA87bE54EA9a736bcC4E9',
|
|
82
84
|
contractPayload:
|
|
@@ -137,6 +139,8 @@ describe('EVM Family', () => {
|
|
|
137
139
|
},
|
|
138
140
|
details: {
|
|
139
141
|
sequence: '7',
|
|
142
|
+
gasPrice: '125521409858',
|
|
143
|
+
gasLimit: '6000000',
|
|
140
144
|
contractInteraction: 'SmartContractInteraction',
|
|
141
145
|
contractAddress: '0xc5102fE9359FD9a28f877a67E36B0F050d81a3CC',
|
|
142
146
|
contractPayload:
|
|
@@ -194,7 +198,7 @@ describe('EVM Family', () => {
|
|
|
194
198
|
failed: false,
|
|
195
199
|
feesPayer: '0x829BD824B016326A401d083B33D092293333A830',
|
|
196
200
|
},
|
|
197
|
-
details: { sequence: '11898499' },
|
|
201
|
+
details: { sequence: '11898499', gasPrice: '68363841693', gasLimit: '210000' },
|
|
198
202
|
}
|
|
199
203
|
|
|
200
204
|
expect(
|
|
@@ -247,7 +251,7 @@ describe('EVM Family', () => {
|
|
|
247
251
|
failed: false,
|
|
248
252
|
feesPayer: '0x26E3fd2dEc89bF645BA7b41c4DdFad8454Ee6245',
|
|
249
253
|
},
|
|
250
|
-
details: { sequence: '11898499' },
|
|
254
|
+
details: { sequence: '11898499', gasPrice: '68363841693', gasLimit: '210000' },
|
|
251
255
|
}
|
|
252
256
|
|
|
253
257
|
expect(
|
|
@@ -300,7 +304,7 @@ describe('EVM Family', () => {
|
|
|
300
304
|
failed: false,
|
|
301
305
|
feesPayer: '0x6bfD74C0996F269Bcece59191EFf667b3dFD73b9',
|
|
302
306
|
},
|
|
303
|
-
details: { sequence: '11898499' },
|
|
307
|
+
details: { sequence: '11898499', gasPrice: '68363841693', gasLimit: '210000' },
|
|
304
308
|
}
|
|
305
309
|
|
|
306
310
|
expect(
|
|
@@ -356,7 +360,7 @@ describe('EVM Family', () => {
|
|
|
356
360
|
value: 1000n,
|
|
357
361
|
asset: { type: 'native' },
|
|
358
362
|
tx: selfSendTx,
|
|
359
|
-
details: { sequence: '7' },
|
|
363
|
+
details: { sequence: '7', gasPrice: '125521409858', gasLimit: '21000' },
|
|
360
364
|
},
|
|
361
365
|
{
|
|
362
366
|
id: '0x9aa99c23f67c81701c772b106b4f83f6e858dd2e-0xaa45b4858ba44230a5fce5a29570a5dec2bf1f0ba95bacdec4fe8f2c4fa99338-OUT',
|
|
@@ -366,7 +370,7 @@ describe('EVM Family', () => {
|
|
|
366
370
|
value: 1000n,
|
|
367
371
|
asset: { type: 'native' },
|
|
368
372
|
tx: selfSendTx,
|
|
369
|
-
details: { sequence: '7' },
|
|
373
|
+
details: { sequence: '7', gasPrice: '125521409858', gasLimit: '21000' },
|
|
370
374
|
},
|
|
371
375
|
]
|
|
372
376
|
|
|
@@ -554,6 +558,8 @@ describe('EVM Family', () => {
|
|
|
554
558
|
'0xea18d674a91c9b7459baad0e138bcca25fa342d8fa692c66489248a3ebb4ca9d'
|
|
555
559
|
)
|
|
556
560
|
expect(result[0].type).toBe('OUT')
|
|
561
|
+
expect(result[0].details).not.toHaveProperty('gasPrice')
|
|
562
|
+
expect(result[0].details).toHaveProperty('gasLimit', '163840')
|
|
557
563
|
})
|
|
558
564
|
|
|
559
565
|
it('should handle failed transaction with empty gasPrice', () => {
|
|
@@ -599,6 +605,20 @@ describe('EVM Family', () => {
|
|
|
599
605
|
expect(result[0].value).toEqual(0n)
|
|
600
606
|
})
|
|
601
607
|
|
|
608
|
+
it('should omit an empty gas limit from details', () => {
|
|
609
|
+
const address = '0xB10770cE9f8532634b6Ba156b8789f19935210F0'
|
|
610
|
+
|
|
611
|
+
const [operation] = etherscanOperationToOperations(
|
|
612
|
+
address,
|
|
613
|
+
CHAIN_ID.OPTIMISM,
|
|
614
|
+
{ ...rawBlockscoutTransaction, gasPrice: '1000', gas: '' },
|
|
615
|
+
testLogger
|
|
616
|
+
)
|
|
617
|
+
|
|
618
|
+
expect(operation.details).toHaveProperty('gasPrice', '1000')
|
|
619
|
+
expect(operation.details).not.toHaveProperty('gasLimit')
|
|
620
|
+
})
|
|
621
|
+
|
|
602
622
|
it('should produce empty recipients when both to and contractAddress are empty strings', () => {
|
|
603
623
|
const etherscanOp: EtherscanOperation = {
|
|
604
624
|
blockNumber: '14923692',
|
|
@@ -795,6 +815,8 @@ describe('EVM Family', () => {
|
|
|
795
815
|
},
|
|
796
816
|
details: {
|
|
797
817
|
sequence: '53',
|
|
818
|
+
gasPrice: '24314367325',
|
|
819
|
+
gasLimit: '79381',
|
|
798
820
|
ledgerOpType: 'OUT',
|
|
799
821
|
assetAmount: '2000000',
|
|
800
822
|
assetSenders: ['0x6cBCD73CD8e8a42844662f0A0e76D7F79Afd933d'],
|
|
@@ -856,6 +878,8 @@ describe('EVM Family', () => {
|
|
|
856
878
|
},
|
|
857
879
|
details: {
|
|
858
880
|
sequence: '53',
|
|
881
|
+
gasPrice: '24314367325',
|
|
882
|
+
gasLimit: '79381',
|
|
859
883
|
ledgerOpType: 'IN',
|
|
860
884
|
assetAmount: '2000000',
|
|
861
885
|
assetSenders: ['0xC2907EFccE4011C491BbedA8A0fA63BA7aab596C'],
|
|
@@ -948,6 +972,8 @@ describe('EVM Family', () => {
|
|
|
948
972
|
tx: sharedErc20Tx,
|
|
949
973
|
details: {
|
|
950
974
|
sequence: '53',
|
|
975
|
+
gasPrice: '24314367325',
|
|
976
|
+
gasLimit: '79381',
|
|
951
977
|
ledgerOpType: 'IN',
|
|
952
978
|
assetAmount: '2000000',
|
|
953
979
|
assetSenders: ['0x6cBCD73CD8e8a42844662f0A0e76D7F79Afd933d'],
|
|
@@ -968,6 +994,8 @@ describe('EVM Family', () => {
|
|
|
968
994
|
tx: sharedErc20Tx,
|
|
969
995
|
details: {
|
|
970
996
|
sequence: '53',
|
|
997
|
+
gasPrice: '24314367325',
|
|
998
|
+
gasLimit: '79381',
|
|
971
999
|
ledgerOpType: 'OUT',
|
|
972
1000
|
assetAmount: '2000000',
|
|
973
1001
|
assetSenders: ['0x6cBCD73CD8e8a42844662f0A0e76D7F79Afd933d'],
|
|
@@ -1011,6 +1039,8 @@ describe('EVM Family', () => {
|
|
|
1011
1039
|
expect(result).toHaveLength(1)
|
|
1012
1040
|
expect(result[0].tx.fees).toEqual(0n)
|
|
1013
1041
|
expect(result[0].value).toEqual(1000000000000000000n)
|
|
1042
|
+
expect(result[0].details).not.toHaveProperty('gasPrice')
|
|
1043
|
+
expect(result[0].details).toHaveProperty('gasLimit', '163840')
|
|
1014
1044
|
})
|
|
1015
1045
|
|
|
1016
1046
|
it('should produce empty recipients when to is an empty string', () => {
|
|
@@ -1094,6 +1124,8 @@ describe('EVM Family', () => {
|
|
|
1094
1124
|
},
|
|
1095
1125
|
details: {
|
|
1096
1126
|
sequence: '0',
|
|
1127
|
+
gasPrice: '40000000000',
|
|
1128
|
+
gasLimit: '158820',
|
|
1097
1129
|
tokenId: '202106',
|
|
1098
1130
|
ledgerOpType: 'NFT_OUT',
|
|
1099
1131
|
assetAmount: '1',
|
|
@@ -1152,6 +1184,8 @@ describe('EVM Family', () => {
|
|
|
1152
1184
|
},
|
|
1153
1185
|
details: {
|
|
1154
1186
|
sequence: '0',
|
|
1187
|
+
gasPrice: '40000000000',
|
|
1188
|
+
gasLimit: '158820',
|
|
1155
1189
|
tokenId: '202106',
|
|
1156
1190
|
ledgerOpType: 'NFT_IN',
|
|
1157
1191
|
assetAmount: '1',
|
|
@@ -1241,6 +1275,8 @@ describe('EVM Family', () => {
|
|
|
1241
1275
|
tx: sharedErc721Tx,
|
|
1242
1276
|
details: {
|
|
1243
1277
|
sequence: '0',
|
|
1278
|
+
gasPrice: '40000000000',
|
|
1279
|
+
gasLimit: '158820',
|
|
1244
1280
|
tokenId: '202106',
|
|
1245
1281
|
ledgerOpType: 'NFT_IN',
|
|
1246
1282
|
assetAmount: '1',
|
|
@@ -1258,6 +1294,8 @@ describe('EVM Family', () => {
|
|
|
1258
1294
|
tx: sharedErc721Tx,
|
|
1259
1295
|
details: {
|
|
1260
1296
|
sequence: '0',
|
|
1297
|
+
gasPrice: '40000000000',
|
|
1298
|
+
gasLimit: '158820',
|
|
1261
1299
|
tokenId: '202106',
|
|
1262
1300
|
ledgerOpType: 'NFT_OUT',
|
|
1263
1301
|
assetAmount: '1',
|
|
@@ -1354,6 +1392,8 @@ describe('EVM Family', () => {
|
|
|
1354
1392
|
},
|
|
1355
1393
|
details: {
|
|
1356
1394
|
sequence: '41',
|
|
1395
|
+
gasPrice: '52898577246',
|
|
1396
|
+
gasLimit: '140000',
|
|
1357
1397
|
tokenId: '10371',
|
|
1358
1398
|
ledgerOpType: 'NFT_OUT',
|
|
1359
1399
|
assetAmount: '1',
|
|
@@ -1412,6 +1452,8 @@ describe('EVM Family', () => {
|
|
|
1412
1452
|
},
|
|
1413
1453
|
details: {
|
|
1414
1454
|
sequence: '41',
|
|
1455
|
+
gasPrice: '52898577246',
|
|
1456
|
+
gasLimit: '140000',
|
|
1415
1457
|
tokenId: '10371',
|
|
1416
1458
|
ledgerOpType: 'NFT_IN',
|
|
1417
1459
|
assetAmount: '1',
|
|
@@ -1501,6 +1543,8 @@ describe('EVM Family', () => {
|
|
|
1501
1543
|
tx: sharedErc1155Tx,
|
|
1502
1544
|
details: {
|
|
1503
1545
|
sequence: '41',
|
|
1546
|
+
gasPrice: '52898577246',
|
|
1547
|
+
gasLimit: '140000',
|
|
1504
1548
|
tokenId: '10371',
|
|
1505
1549
|
ledgerOpType: 'NFT_IN',
|
|
1506
1550
|
assetAmount: '1',
|
|
@@ -1518,6 +1562,8 @@ describe('EVM Family', () => {
|
|
|
1518
1562
|
tx: sharedErc1155Tx,
|
|
1519
1563
|
details: {
|
|
1520
1564
|
sequence: '41',
|
|
1565
|
+
gasPrice: '52898577246',
|
|
1566
|
+
gasLimit: '140000',
|
|
1521
1567
|
tokenId: '10371',
|
|
1522
1568
|
ledgerOpType: 'NFT_OUT',
|
|
1523
1569
|
assetAmount: '1',
|
|
@@ -1870,6 +1916,8 @@ describe('EVM Family', () => {
|
|
|
1870
1916
|
},
|
|
1871
1917
|
details: {
|
|
1872
1918
|
sequence: '7',
|
|
1919
|
+
gasPrice: '125521409858',
|
|
1920
|
+
gasLimit: '6000000',
|
|
1873
1921
|
contractInteraction: 'SmartContractInteraction',
|
|
1874
1922
|
contractAddress: '0x0000000000000000000000000000000000001005',
|
|
1875
1923
|
contractPayload:
|
|
@@ -1926,6 +1974,8 @@ describe('EVM Family', () => {
|
|
|
1926
1974
|
},
|
|
1927
1975
|
details: {
|
|
1928
1976
|
sequence: '7',
|
|
1977
|
+
gasPrice: '125521409858',
|
|
1978
|
+
gasLimit: '6000000',
|
|
1929
1979
|
contractInteraction: 'SmartContractInteraction',
|
|
1930
1980
|
contractAddress: '0x0000000000000000000000000000000000001005',
|
|
1931
1981
|
contractPayload:
|
|
@@ -1981,6 +2031,8 @@ describe('EVM Family', () => {
|
|
|
1981
2031
|
},
|
|
1982
2032
|
details: {
|
|
1983
2033
|
sequence: '7',
|
|
2034
|
+
gasPrice: '125521409858',
|
|
2035
|
+
gasLimit: '6000000',
|
|
1984
2036
|
contractInteraction: 'SmartContractInteraction',
|
|
1985
2037
|
contractAddress: '0x0000000000000000000000000000000000001005',
|
|
1986
2038
|
contractPayload: '0x8dfc88970000000000000000000000',
|
|
@@ -122,6 +122,7 @@ export const etherscanOperationToOperations = (
|
|
|
122
122
|
},
|
|
123
123
|
details: {
|
|
124
124
|
sequence: etherscanOp.nonce,
|
|
125
|
+
...gasDetails(etherscanOp.gasPrice, etherscanOp.gas),
|
|
125
126
|
...(contractExtra ?? {}),
|
|
126
127
|
},
|
|
127
128
|
}))
|
|
@@ -175,6 +176,7 @@ export const etherscanERC20EventToOperations = (
|
|
|
175
176
|
},
|
|
176
177
|
details: {
|
|
177
178
|
sequence: event.nonce,
|
|
179
|
+
...gasDetails(event.gasPrice, event.gas),
|
|
178
180
|
ledgerOpType: type,
|
|
179
181
|
assetAmount: event.value,
|
|
180
182
|
assetSenders: from ? [from] : [],
|
|
@@ -230,6 +232,7 @@ export const etherscanERC721EventToOperations = (
|
|
|
230
232
|
},
|
|
231
233
|
details: {
|
|
232
234
|
sequence: event.nonce,
|
|
235
|
+
...gasDetails(event.gasPrice, event.gas),
|
|
233
236
|
tokenId: event.tokenID,
|
|
234
237
|
ledgerOpType: type,
|
|
235
238
|
assetAmount: '1',
|
|
@@ -285,6 +288,7 @@ export const etherscanERC1155EventToOperations = (
|
|
|
285
288
|
},
|
|
286
289
|
details: {
|
|
287
290
|
sequence: event.nonce,
|
|
291
|
+
...gasDetails(event.gasPrice, event.gas),
|
|
288
292
|
tokenId: event.tokenID,
|
|
289
293
|
ledgerOpType: type,
|
|
290
294
|
assetAmount: event.tokenValue,
|
|
@@ -294,6 +298,17 @@ export const etherscanERC1155EventToOperations = (
|
|
|
294
298
|
}))
|
|
295
299
|
}
|
|
296
300
|
|
|
301
|
+
/**
|
|
302
|
+
* Gas price and gas limit details of a transaction. Some Blockscout explorers (e.g. Optimism)
|
|
303
|
+
* report an empty `gasPrice`, so empty values are omitted rather than emitted as `''`.
|
|
304
|
+
*/
|
|
305
|
+
function gasDetails(gasPrice: string, gasLimit: string): Record<string, string> {
|
|
306
|
+
return {
|
|
307
|
+
...(gasPrice ? { gasPrice } : {}),
|
|
308
|
+
...(gasLimit ? { gasLimit } : {}),
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
|
|
297
312
|
/**
|
|
298
313
|
* `delegatecall`/`staticcall`/`callcode` cannot move native ETH, but both Blockscout and
|
|
299
314
|
* Etherscan still report a non-zero `value` on those entries (it's the `msg.value` inherited
|
|
@@ -39,7 +39,7 @@ const coinOperation: Operation<MemoNotSupported> = {
|
|
|
39
39
|
date: new Date('2023-01-24T17:11:45Z'),
|
|
40
40
|
failed: false,
|
|
41
41
|
},
|
|
42
|
-
details: { sequence: 75 },
|
|
42
|
+
details: { sequence: 75, gasPrice: '81876963401', gasLimit: '62350' },
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
describe('EVM Family', () => {
|
|
@@ -106,7 +106,7 @@ describe('EVM Family', () => {
|
|
|
106
106
|
failed: false,
|
|
107
107
|
feesPayer: '0x6cBCD73CD8e8a42844662f0A0e76D7F79Afd933d',
|
|
108
108
|
},
|
|
109
|
-
details: { sequence: 75 },
|
|
109
|
+
details: { sequence: 75, gasPrice: '81876963401', gasLimit: '62350' },
|
|
110
110
|
}
|
|
111
111
|
|
|
112
112
|
expect(
|
|
@@ -176,7 +176,7 @@ describe('EVM Family', () => {
|
|
|
176
176
|
failed: false,
|
|
177
177
|
feesPayer: '0x6cBCD73CD8e8a42844662f0A0e76D7F79Afd933d',
|
|
178
178
|
},
|
|
179
|
-
details: { sequence: 75 },
|
|
179
|
+
details: { sequence: 75, gasPrice: '81876963401', gasLimit: '62350' },
|
|
180
180
|
}
|
|
181
181
|
|
|
182
182
|
expect(
|
|
@@ -241,7 +241,7 @@ describe('EVM Family', () => {
|
|
|
241
241
|
failed: false,
|
|
242
242
|
feesPayer: '0x6cBCD73CD8e8a42844662f0A0e76D7F79Afd933d',
|
|
243
243
|
},
|
|
244
|
-
details: { sequence: 75 },
|
|
244
|
+
details: { sequence: 75, gasPrice: '81876963401', gasLimit: '62350' },
|
|
245
245
|
}
|
|
246
246
|
|
|
247
247
|
expect(
|
|
@@ -249,6 +249,54 @@ describe('EVM Family', () => {
|
|
|
249
249
|
).toEqual([expectedOperation])
|
|
250
250
|
})
|
|
251
251
|
|
|
252
|
+
it('should omit empty gas price and gas limit from details', () => {
|
|
253
|
+
const ledgerOperation: LedgerExplorerOperation = {
|
|
254
|
+
hash: '0xf350d4f8e910419e2d5cec294d44e69af8c6185b7089061d33bb4fc246cefb79',
|
|
255
|
+
transaction_type: 2,
|
|
256
|
+
nonce: '0x4b',
|
|
257
|
+
nonce_value: 75,
|
|
258
|
+
value: '1',
|
|
259
|
+
gas: '',
|
|
260
|
+
gas_price: '',
|
|
261
|
+
max_fee_per_gas: '125263305914',
|
|
262
|
+
max_priority_fee_per_gas: '33000000000',
|
|
263
|
+
from: '0x6cbcd73cd8e8a42844662f0a0e76d7f79afd933d',
|
|
264
|
+
to: '0x7ceb23fd6bc0add59e62ac25578270cff1b9f619',
|
|
265
|
+
transfer_events: [
|
|
266
|
+
{
|
|
267
|
+
contract: '0x7ceb23fd6bc0add59e62ac25578270cff1b9f619',
|
|
268
|
+
from: '0x6cbcd73cd8e8a42844662f0a0e76d7f79afd933d',
|
|
269
|
+
to: '0xc2907efcce4011c491bbeda8a0fa63ba7aab596c',
|
|
270
|
+
count: '100000000000000',
|
|
271
|
+
},
|
|
272
|
+
],
|
|
273
|
+
erc721_transfer_events: [],
|
|
274
|
+
erc1155_transfer_events: [],
|
|
275
|
+
approval_events: [],
|
|
276
|
+
actions: [],
|
|
277
|
+
confirmations: 5968364,
|
|
278
|
+
input: null,
|
|
279
|
+
gas_used: '51958',
|
|
280
|
+
cumulative_gas_used: '16087064',
|
|
281
|
+
status: 1,
|
|
282
|
+
received_at: '2023-01-24T17:11:45Z',
|
|
283
|
+
block: {
|
|
284
|
+
hash: '0xcbd52de09904fd89a94b0638a8e39107e247d761e92411fd5b7b7d8b88641ddd',
|
|
285
|
+
height: 38476740,
|
|
286
|
+
time: '2023-01-24T17:11:45Z',
|
|
287
|
+
},
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
const [operation] = ledgerOperationToOperations(
|
|
291
|
+
address,
|
|
292
|
+
CHAIN_ID.ETHEREUM,
|
|
293
|
+
ledgerOperation,
|
|
294
|
+
testLogger
|
|
295
|
+
)
|
|
296
|
+
|
|
297
|
+
expect(operation.details).toEqual({ sequence: 75 })
|
|
298
|
+
})
|
|
299
|
+
|
|
252
300
|
it('should convert ledger explorer coin in operation to an Operation', () => {
|
|
253
301
|
const ledgerOperation: LedgerExplorerOperation = {
|
|
254
302
|
hash: '0xf350d4f8e910419e2d5cec294d44e69af8c6185b7089061d33bb4fc246cefb79',
|
|
@@ -306,7 +354,7 @@ describe('EVM Family', () => {
|
|
|
306
354
|
failed: false,
|
|
307
355
|
feesPayer: '0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619',
|
|
308
356
|
},
|
|
309
|
-
details: { sequence: 75 },
|
|
357
|
+
details: { sequence: 75, gasPrice: '81876963401', gasLimit: '62350' },
|
|
310
358
|
}
|
|
311
359
|
|
|
312
360
|
expect(
|
|
@@ -371,7 +419,7 @@ describe('EVM Family', () => {
|
|
|
371
419
|
failed: false,
|
|
372
420
|
feesPayer: '0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619',
|
|
373
421
|
},
|
|
374
|
-
details: { sequence: 75 },
|
|
422
|
+
details: { sequence: 75, gasPrice: '81876963401', gasLimit: '62350' },
|
|
375
423
|
}
|
|
376
424
|
|
|
377
425
|
expect(
|
|
@@ -441,7 +489,7 @@ describe('EVM Family', () => {
|
|
|
441
489
|
failed: false,
|
|
442
490
|
feesPayer: '0x787aCF62fFC81Bb171d1f46fB8b3Fc6503D503e8',
|
|
443
491
|
},
|
|
444
|
-
details: { sequence: 3 },
|
|
492
|
+
details: { sequence: 3, gasPrice: '42392511388', gasLimit: '21356033' },
|
|
445
493
|
}
|
|
446
494
|
|
|
447
495
|
expect(
|
|
@@ -508,7 +556,7 @@ describe('EVM Family', () => {
|
|
|
508
556
|
value: 1n,
|
|
509
557
|
asset: { type: 'native' },
|
|
510
558
|
tx: selfSendTx,
|
|
511
|
-
details: { sequence: 75 },
|
|
559
|
+
details: { sequence: 75, gasPrice: '81876963401', gasLimit: '62350' },
|
|
512
560
|
}
|
|
513
561
|
const expectedOperation2 = {
|
|
514
562
|
id: '0x6cbcd73cd8e8a42844662f0a0e76d7f79afd933d-0xf350d4f8e910419e2d5cec294d44e69af8c6185b7089061d33bb4fc246cefb79-OUT',
|
|
@@ -518,7 +566,7 @@ describe('EVM Family', () => {
|
|
|
518
566
|
value: 1n,
|
|
519
567
|
asset: { type: 'native' },
|
|
520
568
|
tx: selfSendTx,
|
|
521
|
-
details: { sequence: 75 },
|
|
569
|
+
details: { sequence: 75, gasPrice: '81876963401', gasLimit: '62350' },
|
|
522
570
|
}
|
|
523
571
|
|
|
524
572
|
expect(
|
package/src/adapters/ledger.ts
CHANGED
package/src/api/index.ts
CHANGED
|
@@ -45,7 +45,6 @@ import { getValidatorsPage } from '../staking/validators'
|
|
|
45
45
|
|
|
46
46
|
// NOTE Celo still relies on the EVM coin config and injects its own
|
|
47
47
|
// while creating an unused instance of API
|
|
48
|
-
// TODO Change to Record<string, EvmConfig> once Celo bridge is removed
|
|
49
48
|
|
|
50
49
|
// The framework contract passes opaque params (object or array); EVM only accepts the object
|
|
51
50
|
// form { to, data, block? }, and parseCallParams rejects arrays defensively at runtime. `call`
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: © 2026 LEDGER SAS
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
-
import type { EvmConfigInfo } from '
|
|
5
|
-
import { CHAIN_ID } from '
|
|
6
|
-
import { createMockEvmContext } from '
|
|
7
|
-
import { createApi } from '
|
|
4
|
+
import type { EvmConfigInfo } from '../../config'
|
|
5
|
+
import { CHAIN_ID } from '../../config'
|
|
6
|
+
import { createMockEvmContext } from '../../fixtures/context.fixtures'
|
|
7
|
+
import { createApi } from '../index'
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Integration tests for getBlock API method with ERC20 transfers
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: © 2026 LEDGER SAS
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
-
import type { EvmConfigInfo } from '
|
|
5
|
-
import { createMockEvmContext } from '
|
|
6
|
-
import { createApi } from '
|
|
4
|
+
import type { EvmConfigInfo } from '../../config'
|
|
5
|
+
import { createMockEvmContext } from '../../fixtures/context.fixtures'
|
|
6
|
+
import { createApi } from '../index'
|
|
7
7
|
|
|
8
8
|
describe('EVM Arbitrum Network', () => {
|
|
9
9
|
let module: ReturnType<typeof createApi>
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: © 2026 LEDGER SAS
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
-
import type { EvmConfigInfo } from '
|
|
4
|
+
import type { EvmConfigInfo } from '../../config'
|
|
5
5
|
import type { Operation } from '@ledgerhq/coin-module-framework/api/types'
|
|
6
|
-
import { createMockEvmContext } from '
|
|
7
|
-
import { createApi } from '
|
|
6
|
+
import { createMockEvmContext } from '../../fixtures/context.fixtures'
|
|
7
|
+
import { createApi } from '../index'
|
|
8
8
|
|
|
9
9
|
// Arc exposes its native unit (USDC) as an ERC20 at this fixed precompile
|
|
10
10
|
// address. The explorer indexes native transfers as BOTH a native tx AND a synthetic
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: © 2026 LEDGER SAS
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
-
import type { EvmConfigInfo } from '
|
|
5
|
-
import { createMockEvmContext } from '
|
|
6
|
-
import { createApi } from '
|
|
4
|
+
import type { EvmConfigInfo } from '../../config'
|
|
5
|
+
import { createMockEvmContext } from '../../fixtures/context.fixtures'
|
|
6
|
+
import { createApi } from '../index'
|
|
7
7
|
|
|
8
8
|
describe('EVM Avalanche C-Chain Fuji', () => {
|
|
9
9
|
let module: ReturnType<typeof createApi>
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: © 2026 LEDGER SAS
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
-
import type { EvmConfigInfo } from '
|
|
5
|
-
import { createMockEvmContext } from '
|
|
6
|
-
import { createApi } from '
|
|
4
|
+
import type { EvmConfigInfo } from '../../config'
|
|
5
|
+
import { createMockEvmContext } from '../../fixtures/context.fixtures'
|
|
6
|
+
import { createApi } from '../index'
|
|
7
7
|
|
|
8
8
|
describe('EVM Cronos Network (blockscout explorer)', () => {
|
|
9
9
|
let module: ReturnType<typeof createApi>
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: © 2026 LEDGER SAS
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
-
import type { EvmConfigInfo } from '
|
|
5
|
-
import { createMockEvmContext } from '
|
|
6
|
-
import { createApi } from '
|
|
4
|
+
import type { EvmConfigInfo } from '../../config'
|
|
5
|
+
import { createMockEvmContext } from '../../fixtures/context.fixtures'
|
|
6
|
+
import { createApi } from '../index'
|
|
7
7
|
|
|
8
8
|
describe('Flare (external node)', () => {
|
|
9
9
|
describe('getBlock', () => {
|
|
@@ -12,9 +12,9 @@ import {
|
|
|
12
12
|
mkExternalNode,
|
|
13
13
|
mkLedgerExplorer,
|
|
14
14
|
mkLedgerNode,
|
|
15
|
-
} from '
|
|
16
|
-
import { isNative } from '
|
|
17
|
-
import { createApi } from '
|
|
15
|
+
} from '../../fixtures/context.fixtures'
|
|
16
|
+
import { isNative } from '../../types/assets'
|
|
17
|
+
import { createApi } from '../index'
|
|
18
18
|
|
|
19
19
|
describe.each([
|
|
20
20
|
[
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: © 2026 LEDGER SAS
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
-
import type { EvmConfigInfo } from '
|
|
5
|
-
import { createMockEvmContext } from '
|
|
6
|
-
import { createApi } from '
|
|
4
|
+
import type { EvmConfigInfo } from '../../config'
|
|
5
|
+
import { createMockEvmContext } from '../../fixtures/context.fixtures'
|
|
6
|
+
import { createApi } from '../index'
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Integration tests for getBlock with internal transactions (etherscan/blockscout).
|
package/src/api/{index.monad_testnet.integ.test.ts → tests/index.monad_testnet.integ.test.ts}
RENAMED
|
@@ -5,10 +5,10 @@ import {
|
|
|
5
5
|
createMockEvmConfigInfo,
|
|
6
6
|
createMockEvmContext,
|
|
7
7
|
testLogger,
|
|
8
|
-
} from '
|
|
9
|
-
import { getNodeApi } from '
|
|
10
|
-
import { nodeSourcesFromList } from '
|
|
11
|
-
import { createApi } from '
|
|
8
|
+
} from '../../fixtures/context.fixtures'
|
|
9
|
+
import { getNodeApi } from '../../network/node'
|
|
10
|
+
import { nodeSourcesFromList } from '../../nodeSources'
|
|
11
|
+
import { createApi } from '../index'
|
|
12
12
|
|
|
13
13
|
describe('EVM Api (Monad Testnet)', () => {
|
|
14
14
|
let module: ReturnType<typeof createApi>
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: © 2026 LEDGER SAS
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
-
import type { EvmConfigInfo } from '
|
|
4
|
+
import type { EvmConfigInfo } from '../../config'
|
|
5
5
|
import type { Operation } from '@ledgerhq/coin-module-framework/api/types'
|
|
6
|
-
import { createMockEvmContext } from '
|
|
7
|
-
import { createApi } from '
|
|
6
|
+
import { createMockEvmContext } from '../../fixtures/context.fixtures'
|
|
7
|
+
import { createApi } from '../index'
|
|
8
8
|
|
|
9
9
|
describe('EVM Optimism Network', () => {
|
|
10
10
|
let module: ReturnType<typeof createApi>
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: © 2026 LEDGER SAS
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
-
import type { EvmConfigInfo } from '
|
|
5
|
-
import { createMockEvmContext } from '
|
|
6
|
-
import { createApi } from '
|
|
4
|
+
import type { EvmConfigInfo } from '../../config'
|
|
5
|
+
import { createMockEvmContext } from '../../fixtures/context.fixtures'
|
|
6
|
+
import { createApi } from '../index'
|
|
7
7
|
|
|
8
8
|
describe('EVM RSK Network', () => {
|
|
9
9
|
let module: ReturnType<typeof createApi>
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: © 2026 LEDGER SAS
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
-
import type { EvmConfigInfo } from '
|
|
4
|
+
import type { EvmConfigInfo } from '../../config'
|
|
5
5
|
import { fail } from 'assert'
|
|
6
|
-
import { createMockEvmContext } from '
|
|
7
|
-
import { createApi } from '
|
|
6
|
+
import { createMockEvmContext } from '../../fixtures/context.fixtures'
|
|
7
|
+
import { createApi } from '../index'
|
|
8
8
|
|
|
9
9
|
describe('Shape (external node)', () => {
|
|
10
10
|
describe('getBlock', () => {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: © 2026 LEDGER SAS
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
-
import type { EvmConfigInfo } from '
|
|
5
|
-
import { createMockEvmContext } from '
|
|
6
|
-
import { createApi } from '
|
|
4
|
+
import type { EvmConfigInfo } from '../../config'
|
|
5
|
+
import { createMockEvmContext } from '../../fixtures/context.fixtures'
|
|
6
|
+
import { createApi } from '../index'
|
|
7
7
|
|
|
8
8
|
describe('EVM Api (Somnia)', () => {
|
|
9
9
|
let module: ReturnType<typeof createApi>
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: © 2026 LEDGER SAS
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
-
import { mockEvmContext } from '
|
|
5
|
-
import { getValidatorsPage } from '
|
|
6
|
-
import { createApi, parseCallParams } from '
|
|
4
|
+
import { mockEvmContext } from '../../fixtures/context.fixtures'
|
|
5
|
+
import { getValidatorsPage } from '../../staking/validators'
|
|
6
|
+
import { createApi, parseCallParams } from '../index'
|
|
7
7
|
|
|
8
|
-
jest.mock('
|
|
8
|
+
jest.mock('../../staking/validators', () => ({
|
|
9
9
|
getValidatorsPage: jest.fn(),
|
|
10
10
|
}))
|
|
11
11
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: © 2026 LEDGER SAS
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
-
import { createMockEvmContext, mkExternalNode } from '
|
|
5
|
-
import { createApi } from '
|
|
4
|
+
import { createMockEvmContext, mkExternalNode } from '../../fixtures/context.fixtures'
|
|
5
|
+
import { createApi } from '../index'
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Non regression for GET /v1/zksync/account/{address}/operations?minHeight=0&order=asc&limit=1,
|