File tree Expand file tree Collapse file tree 1 file changed +20
-48
lines changed Expand file tree Collapse file tree 1 file changed +20
-48
lines changed Original file line number Diff line number Diff line change 11import  {  CurrencyManager  }  from  "@requestnetwork/currency" ; 
22import  {  CurrencyTypes  }  from  "@requestnetwork/types" ; 
3+ import  {  formattedCurrencyConversionPairs  }  from  "./currencyConversionPairs" ; 
34
45const  defaultCurrencyIds  =  [ 
56  "USD" , 
67  "EUR" , 
8+   "CNY" , 
79  "GBP" , 
8-   "CHF" , 
9-   "SGD" , 
10-   "AUD" , 
11-   "BRL" , 
12-   "CAD" , 
13-   "INR" , 
1410  "JPY" , 
15-   "KRW" , 
16-   "IDR" , 
17-   "NZD" , 
18-   "TRY" , 
19-   "CNY" , 
20-   "FAU-sepolia" , 
21-   "USDC-mainnet" , 
22-   "USDT-mainnet" , 
23-   "DAI-mainnet" , 
24-   "USDC-matic" , 
25-   "USDT-matic" , 
26-   "DAI-matic" , 
27-   "USDC-matic" , 
28-   "AXS-mainnet" , 
29-   "AUDIO-mainnet" , 
30-   "RAI-mainnet" , 
31-   "SYLO-mainnet" , 
32-   "LDO-mainnet" , 
33-   "UST-mainnet" , 
34-   "MNT-mainnet" , 
35-   "MIR-mainnet" , 
36-   "INJ-mainnet" , 
37-   "OCEAN-mainnet" , 
38-   "ANKR-mainnet" , 
39-   "RLY-mainnet" , 
4011  "DAI-bsc" , 
4112  "BUSD-bsc" , 
42-   "USDC-xdai" , 
43-   "USDC-avalanche" , 
44-   "USDT-avalanche" , 
45-   "USDC-optimism" , 
46-   "USDT-optimism" , 
47-   "DAI-optimism" , 
48-   "USDC-multichain-moonbeam" , 
49-   "USDC-wormhole-moonbeam" , 
13+   "ETH-base-base" , 
14+   "DAI-mainnet" , 
5015  "ETH-mainnet" , 
5116  "REQ-mainnet" , 
17+   "USDC-mainnet" , 
18+   "USDT-mainnet" , 
19+   "DAI-matic" , 
5220  "MATIC-matic" , 
53-   "FTM-fantom" , 
54-   "AVAX-avalanche" , 
21+   "USDC-matic" , 
22+   "USDT-matic" , 
23+   "DAI-optimism" , 
5524  "ETH-optimism-optimism" , 
56-   "MNT-mantle" , 
25+   "USDC-optimism" , 
26+   "USDT-optimism" , 
27+   "FAU-sepolia" , 
5728  "ETH-sepolia-sepolia" , 
58-   "ETH-zksync-zksyncera" , 
59-   "ETH-base-base" , 
60-   "fUSDT-sepolia" , 
6129  "fUSDC-sepolia" , 
30+   "fUSDT-sepolia" , 
31+   "USDC-xdai" , 
32+   "USDC-base" , 
6233] ; 
6334
64- import  {  formattedCurrencyConversionPairs  }  from  "./currencyConversionPairs" ; 
65- 
6635const  TOKEN_LIST_URL  = 
6736  "https://requestnetwork.github.io/request-token-list/latest.json" ; 
6837
@@ -106,11 +75,14 @@ export function initializeCurrencyManagerWithCurrencyIDS(
10675export  async  function  initializeCreateInvoiceCurrencyManager ( 
10776  customCurrencyIds : string [ ] 
10877) : Promise < CurrencyManager < any > >  { 
78+   const  currenciesToUse  = 
79+     customCurrencyIds . length  >  0  ? customCurrencyIds  : defaultCurrencyIds ; 
80+ 
10981  const  tokens  =  await  fetchTokenList ( ) ; 
11082
11183  const  tokenMap  =  new  Map ( tokens . map ( ( token : any )  =>  [ token . id ,  token ] ) ) ; 
11284
113-   const  currencies  =  customCurrencyIds 
85+   const  currencies  =  currenciesToUse 
11486    . map ( ( id )  =>  tokenMap . get ( id ) ) 
11587    . filter ( ( token ) : token  is CurrencyTypes . CurrencyInput  =>  token  !=  null ) ; 
11688
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments