@ledgerhq/coin-evm 5.3.2 → 5.3.4

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 (48) hide show
  1. package/.oxlintrc.json +2 -2
  2. package/CHANGELOG.md +13 -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 +59 -79
  26. package/src/network/explorer/etherscan.test.ts +95 -136
  27. package/src/network/explorer/index.test.ts +51 -21
  28. package/src/network/explorer/ledger.test.ts +51 -44
  29. package/src/network/gasTracker/index.test.ts +14 -8
  30. package/src/network/gasTracker/ledger.test.ts +43 -61
  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 +204 -219
  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
  48. package/src/api/index.fantom.integ.test.ts +0 -103
@@ -2,7 +2,9 @@
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
4
  import type { PagingState } from '../../adapters'
5
+ import type { NftStandard } from '../../config'
5
6
  import type { MemoNotSupported, Operation } from '@ledgerhq/coin-module-framework/api/types'
7
+ import type { AxiosRequestConfig } from 'axios'
6
8
  import { AssertionError, fail } from 'assert'
7
9
  import { delay } from '@ledgerhq/coin-module-framework/promises'
8
10
  import axios from 'axios'
@@ -17,6 +19,7 @@ import {
17
19
  } from '../../adapters'
18
20
  import { getCoinConfig } from '../../config'
19
21
  import { EtherscanAPIError, EtherscanLikeExplorerUsedIncorrectly } from '../../errors'
22
+ import { createMockEvmCoinConfig, mkExternalNode } from '../../fixtures/context.fixtures'
20
23
  import {
21
24
  etherscanCoinOperations,
22
25
  etherscanERC1155Operations,
@@ -28,7 +31,7 @@ import * as ETHERSCAN_API from './etherscan'
28
31
 
29
32
  jest.mock('axios')
30
33
  jest.mock('@ledgerhq/coin-module-framework/promises')
31
- ;(delay as jest.Mock).mockImplementation(
34
+ jest.mocked(delay).mockImplementation(
32
35
  () => new Promise((resolve) => setTimeout(resolve, 1)) // mocking the delay supposed to happen after each try
33
36
  )
34
37
 
@@ -66,21 +69,14 @@ const paginationState = (result: ETHERSCAN_API.EndpointResult) => ({
66
69
 
67
70
  describe('EVM Family', () => {
68
71
  beforeEach(() => {
69
- mockGetConfig.mockImplementation((): any => {
70
- return {
71
- info: {
72
- explorer: {
73
- type: 'etherscan',
74
- uri: 'mock',
75
- },
76
- node: {
77
- type: 'external',
78
- uri: 'mock',
79
- },
80
- supportedTokens: ['erc721', 'erc1155'],
81
- },
82
- }
83
- })
72
+ mockGetConfig.mockImplementation(() =>
73
+ createMockEvmCoinConfig({
74
+ chainId: 1,
75
+ node: mkExternalNode({ uri: 'mock' }),
76
+ explorer: { type: 'etherscan', uri: 'mock' },
77
+ supportedTokens: ['erc721', 'erc1155'],
78
+ })
79
+ )
84
80
  })
85
81
 
86
82
  afterAll(() => {
@@ -188,17 +184,9 @@ describe('EVM Family', () => {
188
184
  })
189
185
 
190
186
  it('should throw an error if the currency is misconfigured', async () => {
191
- mockGetConfig.mockImplementationOnce((): any => {
192
- // no explorer
193
- return {
194
- info: {
195
- node: {
196
- type: 'external',
197
- uri: 'mock',
198
- },
199
- },
200
- }
201
- })
187
+ mockGetConfig.mockImplementationOnce(() =>
188
+ createMockEvmCoinConfig({ chainId: 1, node: mkExternalNode({ uri: 'mock' }) })
189
+ )
202
190
 
203
191
  jest.spyOn(axios, 'request').mockImplementation(async () => ({
204
192
  data: {
@@ -413,17 +401,9 @@ describe('EVM Family', () => {
413
401
  })
414
402
 
415
403
  it('should throw if the currency is misconfigured', async () => {
416
- mockGetConfig.mockImplementationOnce((): any => {
417
- // no explorer
418
- return {
419
- info: {
420
- node: {
421
- type: 'external',
422
- uri: 'mock',
423
- },
424
- },
425
- }
426
- })
404
+ mockGetConfig.mockImplementationOnce(() =>
405
+ createMockEvmCoinConfig({ chainId: 1, node: mkExternalNode({ uri: 'mock' }) })
406
+ )
427
407
 
428
408
  jest.spyOn(axios, 'request').mockImplementation(async () => ({
429
409
  data: {
@@ -644,15 +624,16 @@ describe('EVM Family', () => {
644
624
  // The contract used by all entries in etherscanTokenOperations.
645
625
  const FIXTURE_CONTRACT = '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48'
646
626
 
647
- const withConfig = (info: Record<string, unknown>) =>
648
- mockGetConfig.mockImplementation((): any => ({
649
- info: {
627
+ const withConfig = (info: { nativeContracts?: string[] }) =>
628
+ mockGetConfig.mockImplementation(() =>
629
+ createMockEvmCoinConfig({
630
+ chainId: 1,
631
+ node: mkExternalNode({ uri: 'mock' }),
650
632
  explorer: { type: 'etherscan', uri: 'mock' },
651
- node: { type: 'external', uri: 'mock' },
652
633
  supportedTokens: ['erc721', 'erc1155'],
653
634
  ...info,
654
- },
655
- }))
635
+ })
636
+ )
656
637
 
657
638
  it('drops ERC20 ops whose contract is listed in nativeContracts', async () => {
658
639
  withConfig({ nativeContracts: [FIXTURE_CONTRACT] })
@@ -731,17 +712,9 @@ describe('EVM Family', () => {
731
712
  })
732
713
 
733
714
  it('should return an empty array if the currency is misconfigured', async () => {
734
- mockGetConfig.mockImplementationOnce((): any => {
735
- // no explorer
736
- return {
737
- info: {
738
- node: {
739
- type: 'external',
740
- uri: 'mock',
741
- },
742
- },
743
- }
744
- })
715
+ mockGetConfig.mockImplementationOnce(() =>
716
+ createMockEvmCoinConfig({ chainId: 1, node: mkExternalNode({ uri: 'mock' }) })
717
+ )
745
718
 
746
719
  jest.spyOn(axios, 'request').mockImplementation(async () => ({
747
720
  data: {
@@ -963,17 +936,9 @@ describe('EVM Family', () => {
963
936
  })
964
937
 
965
938
  it('should return an empty array if the currency is misconfigured', async () => {
966
- mockGetConfig.mockImplementationOnce((): any => {
967
- // no explorer
968
- return {
969
- info: {
970
- node: {
971
- type: 'external',
972
- uri: 'mock',
973
- },
974
- },
975
- }
976
- })
939
+ mockGetConfig.mockImplementationOnce(() =>
940
+ createMockEvmCoinConfig({ chainId: 1, node: mkExternalNode({ uri: 'mock' }) })
941
+ )
977
942
 
978
943
  jest.spyOn(axios, 'request').mockImplementation(async () => ({
979
944
  data: {
@@ -1328,17 +1293,9 @@ describe('EVM Family', () => {
1328
1293
  })
1329
1294
 
1330
1295
  it('should throw if the currency is misconfigured', async () => {
1331
- mockGetConfig.mockImplementationOnce((): any => {
1332
- // no explorer
1333
- return {
1334
- info: {
1335
- node: {
1336
- type: 'external',
1337
- uri: 'mock',
1338
- },
1339
- },
1340
- }
1341
- })
1296
+ mockGetConfig.mockImplementationOnce(() =>
1297
+ createMockEvmCoinConfig({ chainId: 1, node: mkExternalNode({ uri: 'mock' }) })
1298
+ )
1342
1299
 
1343
1300
  jest.spyOn(axios, 'request').mockImplementation(async () => ({
1344
1301
  data: {
@@ -1625,13 +1582,14 @@ describe('EVM Family', () => {
1625
1582
  ]
1626
1583
 
1627
1584
  it('calls etherscan API with correct URL and params for etherscan explorer type', async () => {
1628
- mockGetConfig.mockImplementation((): any => ({
1629
- info: {
1585
+ mockGetConfig.mockImplementation(() =>
1586
+ createMockEvmCoinConfig({
1587
+ chainId: 1,
1588
+ node: mkExternalNode({ uri: 'mock' }),
1630
1589
  explorer: { type: 'etherscan', uri: 'https://api.etherscan.io' },
1631
- node: { type: 'external', uri: 'mock' },
1632
1590
  supportedTokens: ['erc721', 'erc1155'],
1633
- },
1634
- }))
1591
+ })
1592
+ )
1635
1593
  const axiosSpy = jest.spyOn(axios, 'request').mockResolvedValueOnce({
1636
1594
  data: { status: '1', message: 'OK', result: internalTxResult },
1637
1595
  })
@@ -1659,13 +1617,14 @@ describe('EVM Family', () => {
1659
1617
  })
1660
1618
 
1661
1619
  it('calls API with correct params for blockscout explorer type', async () => {
1662
- mockGetConfig.mockImplementation((): any => ({
1663
- info: {
1620
+ mockGetConfig.mockImplementation(() =>
1621
+ createMockEvmCoinConfig({
1622
+ chainId: 1,
1623
+ node: mkExternalNode({ uri: 'mock' }),
1664
1624
  explorer: { type: 'blockscout', uri: 'https://blockscout.com/api' },
1665
- node: { type: 'external', uri: 'mock' },
1666
1625
  supportedTokens: ['erc721', 'erc1155'],
1667
- },
1668
- }))
1626
+ })
1627
+ )
1669
1628
  const axiosSpy = jest.spyOn(axios, 'request').mockResolvedValueOnce({
1670
1629
  data: { status: '1', message: 'OK', result: internalTxResult },
1671
1630
  })
@@ -1693,13 +1652,14 @@ describe('EVM Family', () => {
1693
1652
  ['ledger', { type: 'ledger', explorerId: 'eth' }],
1694
1653
  ['none', { type: 'none' }],
1695
1654
  ] as const)('returns empty array for %s explorer type', async (_, explorer) => {
1696
- mockGetConfig.mockImplementation((): any => ({
1697
- info: {
1655
+ mockGetConfig.mockImplementation(() =>
1656
+ createMockEvmCoinConfig({
1657
+ chainId: 1,
1658
+ node: mkExternalNode({ uri: 'mock' }),
1698
1659
  explorer,
1699
- node: { type: 'external', uri: 'mock' },
1700
1660
  supportedTokens: ['erc721', 'erc1155'],
1701
- },
1702
- }))
1661
+ })
1662
+ )
1703
1663
 
1704
1664
  const result = await ETHERSCAN_API.getInternalTransactionsByBlock(
1705
1665
  getCoinConfig(currencyId).info,
@@ -1711,13 +1671,14 @@ describe('EVM Family', () => {
1711
1671
  })
1712
1672
 
1713
1673
  it('returns empty array when API returns non-array result', async () => {
1714
- mockGetConfig.mockImplementation((): any => ({
1715
- info: {
1674
+ mockGetConfig.mockImplementation(() =>
1675
+ createMockEvmCoinConfig({
1676
+ chainId: 1,
1677
+ node: mkExternalNode({ uri: 'mock' }),
1716
1678
  explorer: { type: 'etherscan', uri: 'https://api.etherscan.io' },
1717
- node: { type: 'external', uri: 'mock' },
1718
1679
  supportedTokens: ['erc721', 'erc1155'],
1719
- },
1720
- }))
1680
+ })
1681
+ )
1721
1682
  jest.spyOn(axios, 'request').mockResolvedValueOnce({
1722
1683
  data: { status: '1', message: 'OK', result: 'No transactions found' },
1723
1684
  })
@@ -1731,13 +1692,14 @@ describe('EVM Family', () => {
1731
1692
  })
1732
1693
 
1733
1694
  it('throws when API returns blockscout-style no internal transactions response', async () => {
1734
- mockGetConfig.mockImplementation((): any => ({
1735
- info: {
1695
+ mockGetConfig.mockImplementation(() =>
1696
+ createMockEvmCoinConfig({
1697
+ chainId: 1,
1698
+ node: mkExternalNode({ uri: 'mock' }),
1736
1699
  explorer: { type: 'blockscout', uri: 'https://blockscout.com/api' },
1737
- node: { type: 'external', uri: 'mock' },
1738
1700
  supportedTokens: ['erc721', 'erc1155'],
1739
- },
1740
- }))
1701
+ })
1702
+ )
1741
1703
  jest.spyOn(axios, 'request').mockResolvedValueOnce({
1742
1704
  data: {
1743
1705
  status: '0',
@@ -1752,13 +1714,14 @@ describe('EVM Family', () => {
1752
1714
  })
1753
1715
 
1754
1716
  it('loops over pagination until all internal txs are drained', async () => {
1755
- mockGetConfig.mockImplementation((): any => ({
1756
- info: {
1717
+ mockGetConfig.mockImplementation(() =>
1718
+ createMockEvmCoinConfig({
1719
+ chainId: 1,
1720
+ node: mkExternalNode({ uri: 'mock' }),
1757
1721
  explorer: { type: 'etherscan', uri: 'https://api.etherscan.io' },
1758
- node: { type: 'external', uri: 'mock' },
1759
1722
  supportedTokens: ['erc721', 'erc1155'],
1760
- },
1761
- }))
1723
+ })
1724
+ )
1762
1725
 
1763
1726
  const PAGE_SIZE = 10000
1764
1727
  const fullPage = Array.from({ length: PAGE_SIZE }, (_, i) => ({
@@ -1807,13 +1770,14 @@ describe('EVM Family', () => {
1807
1770
  })
1808
1771
 
1809
1772
  it('propagates errors from explorer API call', async () => {
1810
- mockGetConfig.mockImplementation((): any => ({
1811
- info: {
1773
+ mockGetConfig.mockImplementation(() =>
1774
+ createMockEvmCoinConfig({
1775
+ chainId: 1,
1776
+ node: mkExternalNode({ uri: 'mock' }),
1812
1777
  explorer: { type: 'etherscan', uri: 'https://api.etherscan.io' },
1813
- node: { type: 'external', uri: 'mock' },
1814
1778
  supportedTokens: ['erc721', 'erc1155'],
1815
- },
1816
- }))
1779
+ })
1780
+ )
1817
1781
  jest.mocked(axios.request).mockReset()
1818
1782
  jest.mocked(axios.request).mockRejectedValue(new Error('network error'))
1819
1783
 
@@ -1825,20 +1789,13 @@ describe('EVM Family', () => {
1825
1789
 
1826
1790
  describe('getNftOperations without nft', () => {
1827
1791
  beforeEach(() => {
1828
- mockGetConfig.mockImplementation((): any => {
1829
- return {
1830
- info: {
1831
- explorer: {
1832
- type: 'etherscan',
1833
- uri: 'mock',
1834
- },
1835
- node: {
1836
- type: 'external',
1837
- uri: 'mock',
1838
- },
1839
- },
1840
- }
1841
- })
1792
+ mockGetConfig.mockImplementation(() =>
1793
+ createMockEvmCoinConfig({
1794
+ chainId: 1,
1795
+ node: mkExternalNode({ uri: 'mock' }),
1796
+ explorer: { type: 'etherscan', uri: 'mock' },
1797
+ })
1798
+ )
1842
1799
  })
1843
1800
 
1844
1801
  it('should not return NFT operation', async () => {
@@ -1859,14 +1816,15 @@ describe('EVM Family', () => {
1859
1816
  })
1860
1817
 
1861
1818
  describe('getNftOperations supportedTokens atomicity', () => {
1862
- const withSupportedTokens = (supportedTokens: ('erc721' | 'erc1155')[]) => {
1863
- mockGetConfig.mockImplementation((): any => ({
1864
- info: {
1819
+ const withSupportedTokens = (supportedTokens: NftStandard[]) => {
1820
+ mockGetConfig.mockImplementation(() =>
1821
+ createMockEvmCoinConfig({
1822
+ chainId: 1,
1823
+ node: mkExternalNode({ uri: 'mock' }),
1865
1824
  explorer: { type: 'etherscan', uri: 'mock' },
1866
- node: { type: 'external', uri: 'mock' },
1867
1825
  supportedTokens,
1868
- },
1869
- }))
1826
+ })
1827
+ )
1870
1828
  }
1871
1829
 
1872
1830
  // ERC721 ops are fetched from the `tokennfttx` endpoint, ERC1155 ops from `token1155tx`.
@@ -1931,7 +1889,8 @@ describe('EVM Family', () => {
1931
1889
  // only non-NFT standards (e.g. a future "erc20") must NOT activate NFT fetching. Activation is
1932
1890
  // driven by explicit NFT-standard membership, not by the array being non-empty.
1933
1891
  it('does not activate NFTs for a non-NFT standard such as erc20', async () => {
1934
- withSupportedTokens(['erc20'] as unknown as ('erc721' | 'erc1155')[])
1892
+ // @ts-expect-error intentionally testing runtime behavior with an unsupported token standard
1893
+ withSupportedTokens(['erc20'])
1935
1894
  const { assetTypes, fetchedErc721, fetchedErc1155 } = await fetchNfts()
1936
1895
  expect(assetTypes).toEqual(new Set())
1937
1896
  expect(fetchedErc721).toBe(false)
@@ -2004,8 +1963,8 @@ describe('EVM Family', () => {
2004
1963
  const createBlockchainMock = (allOps: BlockchainOp[], limit: number, order: 'asc' | 'desc') => {
2005
1964
  const pageCounts: Record<string, number> = {}
2006
1965
 
2007
- return async (config: any) => {
2008
- const url = config.url as string
1966
+ return async (config: AxiosRequestConfig) => {
1967
+ const url: string = config.url ?? ''
2009
1968
  const params = config.params
2010
1969
  const startBlock = params.startblock ?? 0
2011
1970
  const endBlock = params.endblock ?? Infinity
@@ -2088,7 +2047,7 @@ describe('EVM Family', () => {
2088
2047
  ...result.lastTokenOperations.map((op) => ({ type: 'T', block: op.tx.block.height })),
2089
2048
  ]
2090
2049
  // Secondary sort order: C < I < T (coin first at same block)
2091
- const typeOrder = { C: 0, I: 1, T: 2 } as Record<string, number>
2050
+ const typeOrder: Record<string, number> = { C: 0, I: 1, T: 2 }
2092
2051
  const ops = tagged
2093
2052
  .filter((op): op is { type: string; block: number } => op.block !== undefined)
2094
2053
  .sort((a, b) => b.block - a.block || typeOrder[a.type] - typeOrder[b.type])
@@ -4,26 +4,58 @@
4
4
  import type { EvmConfigInfo } from '../../config'
5
5
  import { AssertionError, fail } from 'assert'
6
6
  import { UnknownExplorer } from '../../errors'
7
+ import {
8
+ createMockEvmConfigInfo,
9
+ mkEtherscanExplorer,
10
+ mkExternalNode,
11
+ mkLedgerExplorer,
12
+ } from '../../fixtures/context.fixtures'
7
13
  import etherscanLikeApi from './etherscan'
8
14
  import ledgerExplorerApi from './ledger'
9
15
  import { getExplorerApi } from './index'
10
16
 
11
17
  const configFor = (currencyId: string): EvmConfigInfo => {
18
+ const node = mkExternalNode()
12
19
  switch (currencyId) {
13
20
  case 'anything-coin':
14
- return { explorer: { type: 'anything', uri: 'notworking' } } as any
21
+ return createMockEvmConfigInfo({
22
+ chainId: 1,
23
+ node,
24
+ // @ts-expect-error — intentional invalid explorer type to test UnknownExplorer error path
25
+ explorer: { type: 'anything', uri: 'notworking' },
26
+ })
15
27
  case 'etherscan-coin':
16
- return { explorer: { type: 'etherscan', uri: 'working' } } as any
28
+ return createMockEvmConfigInfo({
29
+ chainId: 1,
30
+ node,
31
+ explorer: mkEtherscanExplorer({ uri: 'working' }),
32
+ })
17
33
  case 'blockscout-coin':
18
- return { explorer: { type: 'blockscout', uri: 'working' } } as any
34
+ return createMockEvmConfigInfo({
35
+ chainId: 1,
36
+ node,
37
+ explorer: { type: 'blockscout', uri: 'working' },
38
+ })
19
39
  case 'etherscan-coin-no-cache':
20
- return { explorer: { type: 'etherscan', uri: 'working', noCache: true } } as any
40
+ return createMockEvmConfigInfo({
41
+ chainId: 1,
42
+ node,
43
+ explorer: mkEtherscanExplorer({ uri: 'working', noCache: true }),
44
+ })
21
45
  case 'blockscout-coin-no-cache':
22
- return { explorer: { type: 'blockscout', uri: 'working', noCache: true } } as any
46
+ return createMockEvmConfigInfo({
47
+ chainId: 1,
48
+ node,
49
+ explorer: { type: 'blockscout', uri: 'working', noCache: true },
50
+ })
23
51
  case 'ledger-coin':
24
- return { explorer: { type: 'ledger', explorerId: 'eth' } } as any
52
+ return createMockEvmConfigInfo({
53
+ chainId: 1,
54
+ node,
55
+ explorer: mkLedgerExplorer({ explorerId: 'eth' }),
56
+ })
25
57
  default:
26
- return {} as any
58
+ return createMockEvmConfigInfo({ chainId: 1, node })
27
59
  }
28
60
  }
29
61
 
@@ -32,7 +64,7 @@ describe('EVM Family', () => {
32
64
  describe('getExplorerApi', () => {
33
65
  it('should throw when requesting a non existing explorer', () => {
34
66
  try {
35
- getExplorerApi(configFor('anything-coin'), { id: 'anything-coin' } as any)
67
+ getExplorerApi(configFor('anything-coin'), 'anything-coin')
36
68
  fail('Promise should have been rejected')
37
69
  } catch (e) {
38
70
  if (e instanceof AssertionError) {
@@ -43,31 +75,29 @@ describe('EVM Family', () => {
43
75
  })
44
76
 
45
77
  it('should return the etherscan api', () => {
46
- const explorerA = getExplorerApi(configFor('etherscan-coin'), {
47
- id: 'etherscan-coin',
48
- } as any)
49
- const explorerB = getExplorerApi(configFor('blockscout-coin'), {
50
- id: 'blockscout-coin',
51
- } as any)
78
+ const explorerA = getExplorerApi(configFor('etherscan-coin'), 'etherscan-coin')
79
+ const explorerB = getExplorerApi(configFor('blockscout-coin'), 'blockscout-coin')
52
80
 
53
81
  expect(explorerA).toBe(etherscanLikeApi.explorerApi)
54
82
  expect(explorerB).toBe(etherscanLikeApi.explorerApi)
55
83
  })
56
84
 
57
85
  it('should return the no cache etherscan api', () => {
58
- const explorerA = getExplorerApi(configFor('etherscan-coin-no-cache'), {
59
- id: 'etherscan-coin-no-cache',
60
- } as any)
61
- const explorerB = getExplorerApi(configFor('blockscout-coin-no-cache'), {
62
- id: 'blockscout-coin-no-cache',
63
- } as any)
86
+ const explorerA = getExplorerApi(
87
+ configFor('etherscan-coin-no-cache'),
88
+ 'etherscan-coin-no-cache'
89
+ )
90
+ const explorerB = getExplorerApi(
91
+ configFor('blockscout-coin-no-cache'),
92
+ 'blockscout-coin-no-cache'
93
+ )
64
94
 
65
95
  expect(explorerA).toBe(etherscanLikeApi.explorerApiNoCache)
66
96
  expect(explorerB).toBe(etherscanLikeApi.explorerApiNoCache)
67
97
  })
68
98
 
69
99
  it('should return the ledger api', () => {
70
- const explorerA = getExplorerApi(configFor('ledger-coin'), { id: 'ledger-coin' } as any)
100
+ const explorerA = getExplorerApi(configFor('ledger-coin'), 'ledger-coin')
71
101
 
72
102
  expect(explorerA).toBe(ledgerExplorerApi)
73
103
  })