@lifi/widget 3.25.0-beta.4 → 3.25.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.
Files changed (118) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/dist/esm/components/Chains/ChainList.d.ts +2 -3
  3. package/dist/esm/components/Chains/ChainList.js +4 -3
  4. package/dist/esm/components/Chains/ChainList.js.map +1 -1
  5. package/dist/esm/components/Chains/ChainList.style.js +10 -3
  6. package/dist/esm/components/Chains/ChainList.style.js.map +1 -1
  7. package/dist/esm/components/Chains/ChainListItem.d.ts +4 -1
  8. package/dist/esm/components/Chains/ChainListItem.js +14 -2
  9. package/dist/esm/components/Chains/ChainListItem.js.map +1 -1
  10. package/dist/esm/components/Chains/PinChainButton.d.ts +7 -0
  11. package/dist/esm/components/Chains/PinChainButton.js +34 -0
  12. package/dist/esm/components/Chains/PinChainButton.js.map +1 -0
  13. package/dist/esm/components/Chains/SelectChainContent.js +15 -16
  14. package/dist/esm/components/Chains/SelectChainContent.js.map +1 -1
  15. package/dist/esm/components/Chains/VirtualizedChainList.d.ts +2 -1
  16. package/dist/esm/components/Chains/VirtualizedChainList.js +43 -9
  17. package/dist/esm/components/Chains/VirtualizedChainList.js.map +1 -1
  18. package/dist/esm/components/Messages/MinFromAmountUSDMessage.d.ts +6 -0
  19. package/dist/esm/components/Messages/MinFromAmountUSDMessage.js +15 -0
  20. package/dist/esm/components/Messages/MinFromAmountUSDMessage.js.map +1 -0
  21. package/dist/esm/components/Messages/WarningMessages.js +3 -0
  22. package/dist/esm/components/Messages/WarningMessages.js.map +1 -1
  23. package/dist/esm/components/Messages/useMessageQueue.js +15 -4
  24. package/dist/esm/components/Messages/useMessageQueue.js.map +1 -1
  25. package/dist/esm/components/TokenList/TokenDetailsSheet.js +0 -2
  26. package/dist/esm/components/TokenList/TokenDetailsSheet.js.map +1 -1
  27. package/dist/esm/components/TokenList/TokenDetailsSheetContent.js +26 -2
  28. package/dist/esm/components/TokenList/TokenDetailsSheetContent.js.map +1 -1
  29. package/dist/esm/components/TokenList/TokenList.js +10 -1
  30. package/dist/esm/components/TokenList/TokenList.js.map +1 -1
  31. package/dist/esm/components/TokenList/TokenListItem.js +3 -1
  32. package/dist/esm/components/TokenList/TokenListItem.js.map +1 -1
  33. package/dist/esm/config/version.d.ts +1 -1
  34. package/dist/esm/config/version.js +1 -1
  35. package/dist/esm/config/version.js.map +1 -1
  36. package/dist/esm/hooks/useFromAmountThreshold.d.ts +4 -0
  37. package/dist/esm/hooks/useFromAmountThreshold.js +23 -0
  38. package/dist/esm/hooks/useFromAmountThreshold.js.map +1 -0
  39. package/dist/esm/hooks/useLongPress.d.ts +7 -0
  40. package/dist/esm/hooks/useLongPress.js +41 -0
  41. package/dist/esm/hooks/useLongPress.js.map +1 -0
  42. package/dist/esm/hooks/useTokenBalances.d.ts +1 -2
  43. package/dist/esm/hooks/useTokenBalances.js +2 -3
  44. package/dist/esm/hooks/useTokenBalances.js.map +1 -1
  45. package/dist/esm/hooks/useTokenSearch.d.ts +2 -2
  46. package/dist/esm/hooks/useTokenSearch.js.map +1 -1
  47. package/dist/esm/hooks/useTokens.d.ts +1 -2
  48. package/dist/esm/hooks/useTokens.js +1 -10
  49. package/dist/esm/hooks/useTokens.js.map +1 -1
  50. package/dist/esm/i18n/bn.json +4 -1
  51. package/dist/esm/i18n/de.json +4 -1
  52. package/dist/esm/i18n/en.json +4 -1
  53. package/dist/esm/i18n/es.json +4 -1
  54. package/dist/esm/i18n/fr.json +4 -1
  55. package/dist/esm/i18n/hi.json +4 -1
  56. package/dist/esm/i18n/id.json +4 -1
  57. package/dist/esm/i18n/it.json +4 -1
  58. package/dist/esm/i18n/ja.json +4 -1
  59. package/dist/esm/i18n/ko.json +4 -1
  60. package/dist/esm/i18n/pl.json +4 -1
  61. package/dist/esm/i18n/pt.json +4 -1
  62. package/dist/esm/i18n/th.json +4 -1
  63. package/dist/esm/i18n/tr.json +4 -1
  64. package/dist/esm/i18n/uk.json +4 -1
  65. package/dist/esm/i18n/vi.json +4 -1
  66. package/dist/esm/i18n/zh.json +4 -1
  67. package/dist/esm/stores/chains/ChainOrderStore.js +17 -5
  68. package/dist/esm/stores/chains/ChainOrderStore.js.map +1 -1
  69. package/dist/esm/stores/chains/createChainOrderStore.js +19 -1
  70. package/dist/esm/stores/chains/createChainOrderStore.js.map +1 -1
  71. package/dist/esm/stores/chains/types.d.ts +2 -0
  72. package/dist/esm/stores/header/useHeaderStore.js +2 -3
  73. package/dist/esm/stores/header/useHeaderStore.js.map +1 -1
  74. package/dist/esm/types/widget.d.ts +1 -0
  75. package/dist/esm/types/widget.js.map +1 -1
  76. package/package.json +4 -4
  77. package/package.json.tmp +3 -3
  78. package/src/components/Chains/ChainList.style.tsx +10 -2
  79. package/src/components/Chains/ChainList.tsx +6 -5
  80. package/src/components/Chains/ChainListItem.tsx +29 -0
  81. package/src/components/Chains/PinChainButton.tsx +51 -0
  82. package/src/components/Chains/SelectChainContent.tsx +18 -21
  83. package/src/components/Chains/VirtualizedChainList.tsx +68 -20
  84. package/src/components/Messages/MinFromAmountUSDMessage.tsx +35 -0
  85. package/src/components/Messages/WarningMessages.tsx +8 -0
  86. package/src/components/Messages/useMessageQueue.ts +16 -4
  87. package/src/components/TokenList/TokenDetailsSheet.tsx +0 -2
  88. package/src/components/TokenList/TokenDetailsSheetContent.tsx +49 -1
  89. package/src/components/TokenList/TokenList.tsx +24 -1
  90. package/src/components/TokenList/TokenListItem.tsx +6 -0
  91. package/src/config/version.ts +1 -1
  92. package/src/hooks/useFromAmountThreshold.ts +31 -0
  93. package/src/hooks/useLongPress.ts +51 -0
  94. package/src/hooks/useTokenBalances.ts +3 -10
  95. package/src/hooks/useTokenSearch.ts +3 -3
  96. package/src/hooks/useTokens.ts +2 -29
  97. package/src/i18n/bn.json +4 -1
  98. package/src/i18n/de.json +4 -1
  99. package/src/i18n/en.json +4 -1
  100. package/src/i18n/es.json +4 -1
  101. package/src/i18n/fr.json +4 -1
  102. package/src/i18n/hi.json +4 -1
  103. package/src/i18n/id.json +4 -1
  104. package/src/i18n/it.json +4 -1
  105. package/src/i18n/ja.json +4 -1
  106. package/src/i18n/ko.json +4 -1
  107. package/src/i18n/pl.json +4 -1
  108. package/src/i18n/pt.json +4 -1
  109. package/src/i18n/th.json +4 -1
  110. package/src/i18n/tr.json +4 -1
  111. package/src/i18n/uk.json +4 -1
  112. package/src/i18n/vi.json +4 -1
  113. package/src/i18n/zh.json +4 -1
  114. package/src/stores/chains/ChainOrderStore.tsx +23 -5
  115. package/src/stores/chains/createChainOrderStore.ts +19 -1
  116. package/src/stores/chains/types.ts +2 -0
  117. package/src/stores/header/useHeaderStore.tsx +2 -9
  118. package/src/types/widget.ts +1 -0
package/src/i18n/en.json CHANGED
@@ -129,6 +129,7 @@
129
129
  "highValueLoss": "The value of the received tokens is significantly lower than the exchanged tokens and transaction cost.",
130
130
  "insufficientFunds": "You don't have enough funds to complete the transaction.",
131
131
  "insufficientGas": "You don't have enough gas to complete the transaction. You need to add at least:",
132
+ "minFromAmountUSD": "Minimum amount is {{amount, currencyExt(currency: USD)}}. Please enter a higher amount.",
132
133
  "rateChanged": "The exchange rate has changed. By continuing the transaction, you'll accept the new rate.",
133
134
  "resetSettings": "This will reset your route priority, slippage, gas price, enabled bridges and exchanges.",
134
135
  "slippageOutsideRecommendedLimits": "High slippage tolerance may result in unfavorable trade caused by front-running.",
@@ -345,6 +346,8 @@
345
346
  },
346
347
  "tokenMetric": {
347
348
  "currentPrice": "Current price",
348
- "contractAddress": "Contract address"
349
+ "contractAddress": "Contract address",
350
+ "marketCap": "Market cap",
351
+ "volume24h": "Volume 24h"
349
352
  }
350
353
  }
package/src/i18n/es.json CHANGED
@@ -129,6 +129,7 @@
129
129
  "highValueLoss": "El valor de los tokens recibidos es significativamente menor que los tokens intercambiados y el costo de la transacción.",
130
130
  "insufficientFunds": "No tiene fondos suficientes para ejecutar el intercambio.",
131
131
  "insufficientGas": "Debes agregar al menos:",
132
+ "minFromAmountUSD": "",
132
133
  "rateChanged": "La tasa de cambio ha cambiado. Continuar con el swap implica que estas de acuerdo con la nueva tasa.",
133
134
  "resetSettings": "Esto restablecerá su prioridad de ruta, deslizamiento, precio de gas, puentes e intercambios habilitados.",
134
135
  "slippageOutsideRecommendedLimits": "La tolerancia de los deslizamientos altos puede resultar en un comercio desfavorable causado por front-running.",
@@ -345,6 +346,8 @@
345
346
  },
346
347
  "tokenMetric": {
347
348
  "currentPrice": "",
348
- "contractAddress": ""
349
+ "contractAddress": "",
350
+ "marketCap": "",
351
+ "volume24h": ""
349
352
  }
350
353
  }
package/src/i18n/fr.json CHANGED
@@ -129,6 +129,7 @@
129
129
  "highValueLoss": "La valeur des jetons reçus est nettement inférieure à celle des jetons échangés et au coût de la transaction.",
130
130
  "insufficientFunds": "Vous n'avez pas assez de fonds pour finaliser l'échange.",
131
131
  "insufficientGas": "Vous n'avez pas assez de gaz pour finaliser l'échange. Vous devez avoir au moins:",
132
+ "minFromAmountUSD": "",
132
133
  "rateChanged": "Le taux de change a changé. En continuant l'échange, vous devrez accepter le nouveau taux.",
133
134
  "resetSettings": "Cela réinitialisera la priorité de votre itinéraire, l'effet de glissement, le prix du gaz, les ponts et les plateformes d'échanges activés.",
134
135
  "slippageOutsideRecommendedLimits": "Une tolérance élevée au glissement peut entraîner un échange défavorable causé par le front-running.",
@@ -345,6 +346,8 @@
345
346
  },
346
347
  "tokenMetric": {
347
348
  "currentPrice": "",
348
- "contractAddress": ""
349
+ "contractAddress": "",
350
+ "marketCap": "",
351
+ "volume24h": ""
349
352
  }
350
353
  }
package/src/i18n/hi.json CHANGED
@@ -129,6 +129,7 @@
129
129
  "highValueLoss": "",
130
130
  "insufficientFunds": "",
131
131
  "insufficientGas": "",
132
+ "minFromAmountUSD": "",
132
133
  "rateChanged": "",
133
134
  "resetSettings": "",
134
135
  "slippageOutsideRecommendedLimits": "",
@@ -345,6 +346,8 @@
345
346
  },
346
347
  "tokenMetric": {
347
348
  "currentPrice": "",
348
- "contractAddress": ""
349
+ "contractAddress": "",
350
+ "marketCap": "",
351
+ "volume24h": ""
349
352
  }
350
353
  }
package/src/i18n/id.json CHANGED
@@ -129,6 +129,7 @@
129
129
  "highValueLoss": "Nilai token yang diterima jauh lebih rendah daripada token yang ditukar dan biaya transaksi.",
130
130
  "insufficientFunds": "Anda tidak memiliki cukup dana untuk menyelesaikan penukaran.",
131
131
  "insufficientGas": "Anda tidak memiliki cukup gas untuk menyelesaikan penukaran. Anda perlu menambahkan setidaknya:",
132
+ "minFromAmountUSD": "",
132
133
  "rateChanged": "Nilai tukar telah berubah. Dengan melanjutkan penukaran, Anda akan menerima tarif baru.",
133
134
  "resetSettings": "Ini akan mengatur ulang prioritas rute Anda, slippage, harga gas, jembatan yang diaktifkan, dan pertukaran.",
134
135
  "slippageOutsideRecommendedLimits": "Toleransi selip yang tinggi dapat mengakibatkan perdagangan yang tidak menguntungkan yang disebabkan oleh front-running.",
@@ -345,6 +346,8 @@
345
346
  },
346
347
  "tokenMetric": {
347
348
  "currentPrice": "",
348
- "contractAddress": ""
349
+ "contractAddress": "",
350
+ "marketCap": "",
351
+ "volume24h": ""
349
352
  }
350
353
  }
package/src/i18n/it.json CHANGED
@@ -129,6 +129,7 @@
129
129
  "highValueLoss": "Il valore dei token ricevuti è significativamente inferiore ai token scambiati più il costo della transazione.",
130
130
  "insufficientFunds": "Non hai abbastanza fondi per completare lo scambio.",
131
131
  "insufficientGas": "Non hai abbastanza gas per completare lo scambio. Devi aggiungere almeno:",
132
+ "minFromAmountUSD": "",
132
133
  "rateChanged": "Il tasso di scambio è cambiato. Se procedi, confermi di accettare il nuovo tasso.",
133
134
  "resetSettings": "Questo porterà al ripristino della priorità di route, slittamento di prezzo, prezzo del gas, bridge abilitati ed exchanges.",
134
135
  "slippageOutsideRecommendedLimits": "",
@@ -345,6 +346,8 @@
345
346
  },
346
347
  "tokenMetric": {
347
348
  "currentPrice": "",
348
- "contractAddress": ""
349
+ "contractAddress": "",
350
+ "marketCap": "",
351
+ "volume24h": ""
349
352
  }
350
353
  }
package/src/i18n/ja.json CHANGED
@@ -129,6 +129,7 @@
129
129
  "highValueLoss": "受け取るトークンの価値は、交換されたトークンとトランザクションコストよりも大幅に低くなります。",
130
130
  "insufficientFunds": "トランザクションを完了するのに十分な資金がありません。",
131
131
  "insufficientGas": "トランザクションを完了するのに十分なガスがありません。少なくとも以下を追加する必要があります:",
132
+ "minFromAmountUSD": "",
132
133
  "rateChanged": "交換レートが変更されました。取引を続行すると、新しい為替レートを受け入れることになります。",
133
134
  "resetSettings": "これにより、ルートの優先順位、スリッページ、ガス価格、使用可能なブリッジ、取引所がリセットされます。",
134
135
  "slippageOutsideRecommendedLimits": "スリッページ許容度が高すぎると、フロントランニングによる不利なトレードをひき起こす可能性があります。",
@@ -345,6 +346,8 @@
345
346
  },
346
347
  "tokenMetric": {
347
348
  "currentPrice": "",
348
- "contractAddress": ""
349
+ "contractAddress": "",
350
+ "marketCap": "",
351
+ "volume24h": ""
349
352
  }
350
353
  }
package/src/i18n/ko.json CHANGED
@@ -129,6 +129,7 @@
129
129
  "highValueLoss": "받은 토큰의 가치가 스왑된 토큰 및 트랜잭션 비용보다 상당히 낮습니다.",
130
130
  "insufficientFunds": "스왑을 진행할 자금이 부족합니다.",
131
131
  "insufficientGas": "스왑을 진행할 가스가 부족합니다. 최소 다음과 같은 가스가 필요합니다:",
132
+ "minFromAmountUSD": "",
132
133
  "rateChanged": "거래 비율이 변경되었습니다. 스왑을 계속하면 새로운 비율이 적용됩니다.",
133
134
  "resetSettings": "우선 경로, 슬리피지, 가스 비용, 활성화된 브릿지 및 거래소가 재설정됩니다.",
134
135
  "slippageOutsideRecommendedLimits": "",
@@ -345,6 +346,8 @@
345
346
  },
346
347
  "tokenMetric": {
347
348
  "currentPrice": "",
348
- "contractAddress": ""
349
+ "contractAddress": "",
350
+ "marketCap": "",
351
+ "volume24h": ""
349
352
  }
350
353
  }
package/src/i18n/pl.json CHANGED
@@ -129,6 +129,7 @@
129
129
  "highValueLoss": "",
130
130
  "insufficientFunds": "",
131
131
  "insufficientGas": "",
132
+ "minFromAmountUSD": "",
132
133
  "rateChanged": "",
133
134
  "resetSettings": "",
134
135
  "slippageOutsideRecommendedLimits": "",
@@ -345,6 +346,8 @@
345
346
  },
346
347
  "tokenMetric": {
347
348
  "currentPrice": "",
348
- "contractAddress": ""
349
+ "contractAddress": "",
350
+ "marketCap": "",
351
+ "volume24h": ""
349
352
  }
350
353
  }
package/src/i18n/pt.json CHANGED
@@ -129,6 +129,7 @@
129
129
  "highValueLoss": "A quantidade de tokens a serem recebidos é significativamente menor do que os tokens convertidos e os custos da transação.",
130
130
  "insufficientFunds": "Você não possui fundos suficientes para completar a conversão.",
131
131
  "insufficientGas": "Você não tem gás suficiente para completar a conversão. É necessário adicionar pelo menos:",
132
+ "minFromAmountUSD": "Valor mínimo é {{amount, currencyExt(currency: USD)}}. Por favor, insira um valor maior.",
132
133
  "rateChanged": "A taxa de câmbio mudou. Ao continuar a conversão, você aceitará a nova taxa.",
133
134
  "resetSettings": "Isto redefinirá sua prioridade de rota, tolerância a derrapagem, preço de gás, pontes e trocas ativadas.",
134
135
  "slippageOutsideRecommendedLimits": "Alta tolerância na derrapagem pode resultar em negociação desfavorável ​​causada pelo front-running.",
@@ -345,6 +346,8 @@
345
346
  },
346
347
  "tokenMetric": {
347
348
  "currentPrice": "Preço atual",
348
- "contractAddress": "Endereço do Contrato"
349
+ "contractAddress": "Endereço do Contrato",
350
+ "marketCap": "Capitalização de mercado",
351
+ "volume24h": "Volume 24h"
349
352
  }
350
353
  }
package/src/i18n/th.json CHANGED
@@ -129,6 +129,7 @@
129
129
  "highValueLoss": "มูลค่าของโทเค็นที่ได้รับนั้นต่ำกว่าโทเค็นที่แลกเปลี่ยนและต้นทุนการทำธุรกรรมอย่างมาก.",
130
130
  "insufficientFunds": "คุณมีเงินไม่เพียงพอที่จะดำเนินการแลกเปลี่ยน.",
131
131
  "insufficientGas": "คุณมีแก๊สไม่เพียงพอที่จะแลกเปลี่ยนให้เสร็จสมบูรณ์ คุณต้องเพิ่มอย่างน้อย:",
132
+ "minFromAmountUSD": "",
132
133
  "rateChanged": "อัตราแลกเปลี่ยนมีการเปลี่ยนแปลง คุณจะยอมรับอัตราใหม่.",
133
134
  "resetSettings": "การดำเนินการนี้จะรีเซ็ตลำดับความสำคัญของเส้นทาง การคลาดเลื่อน ค่าแก็ส บริดจ์ที่เปิดใช้งานและการแลกเปลี่ยน",
134
135
  "slippageOutsideRecommendedLimits": "การยอมรับความผิดปกติในการสลิปเพจสูงอาจส่งผลให้เกิดการซื้อขายที่ไม่คุ้มค่า ซึ่งเกิดจากการดำเนินการขายก่อน",
@@ -345,6 +346,8 @@
345
346
  },
346
347
  "tokenMetric": {
347
348
  "currentPrice": "",
348
- "contractAddress": ""
349
+ "contractAddress": "",
350
+ "marketCap": "",
351
+ "volume24h": ""
349
352
  }
350
353
  }
package/src/i18n/tr.json CHANGED
@@ -129,6 +129,7 @@
129
129
  "highValueLoss": "Elde edilecek varlıkların değeri, takas edilen varlıklardan ve işlem maliyetinden önemli ölçüde düşüktür.",
130
130
  "insufficientFunds": "Takas işlemini gerçekleştirmek için yeterli bakiyeniz bulunmamaktadır.",
131
131
  "insufficientGas": "En azından şunları eklemelisiniz:",
132
+ "minFromAmountUSD": "",
132
133
  "rateChanged": "Takas oranı değişti. İşleme devam ederek yeni oranı kabul etmiş olursunuz.",
133
134
  "resetSettings": "Bu, rota önceliğinizi, slipajı, gaz fiyatını, etkin köprüleri ve takasları sıfırlayacaktır.",
134
135
  "slippageOutsideRecommendedLimits": "Yüksek slipaj, ani fiyat hareketleri nedeniyle zarara yol açabilir.",
@@ -345,6 +346,8 @@
345
346
  },
346
347
  "tokenMetric": {
347
348
  "currentPrice": "",
348
- "contractAddress": ""
349
+ "contractAddress": "",
350
+ "marketCap": "",
351
+ "volume24h": ""
349
352
  }
350
353
  }
package/src/i18n/uk.json CHANGED
@@ -129,6 +129,7 @@
129
129
  "highValueLoss": "Вартість отриманих токенів значно нижча, ніж обмінені токени та вартість транзакції.",
130
130
  "insufficientFunds": "У вас недостатньо коштів для здійснення свопу.",
131
131
  "insufficientGas": "Для завершення свопа у вас недостатньо газу. Вам необхідно додати хоча б:",
132
+ "minFromAmountUSD": "",
132
133
  "rateChanged": "Курс обміну змінився. Продовжуючи своп, ви приймете новий курс.",
133
134
  "resetSettings": "Це скине пріоритет вашого маршруту, прослизання, ціну газу, увімкнені бриджі та обмінники.",
134
135
  "slippageOutsideRecommendedLimits": "Високий допуск до прослизання може призвести до несприятливої торгівлі через фронт-біг.",
@@ -345,6 +346,8 @@
345
346
  },
346
347
  "tokenMetric": {
347
348
  "currentPrice": "Поточна ціна",
348
- "contractAddress": "Адреса контракту"
349
+ "contractAddress": "Адреса контракту",
350
+ "marketCap": "",
351
+ "volume24h": ""
349
352
  }
350
353
  }
package/src/i18n/vi.json CHANGED
@@ -129,6 +129,7 @@
129
129
  "highValueLoss": "Giá trị của token nhận được đang thấp hơn rất nhiều so với token được swap và chi phí giao dịch.",
130
130
  "insufficientFunds": "Bạn không có đủ tiền để thực hiện tác vụ này.",
131
131
  "insufficientGas": "Bạn không đủ gas để thực hiện swap. Bạn cần thêm ít nhất:",
132
+ "minFromAmountUSD": "",
132
133
  "rateChanged": "Tỉ lệ hoán đổi đã thay đổi. Để tiếp tục Swap, bạn sẽ chấp nhận tỉ lệ mới.",
133
134
  "resetSettings": "Thao tác này sẽ đặt lại mức độ ưu tiên của tuyến đường, độ trượt giá, giá gas, bridge và sàn giao dịch.",
134
135
  "slippageOutsideRecommendedLimits": "Khả năng trượt giá cao có thể dẫn đến giao dịch không thành công do front-running.",
@@ -345,6 +346,8 @@
345
346
  },
346
347
  "tokenMetric": {
347
348
  "currentPrice": "",
348
- "contractAddress": ""
349
+ "contractAddress": "",
350
+ "marketCap": "",
351
+ "volume24h": ""
349
352
  }
350
353
  }
package/src/i18n/zh.json CHANGED
@@ -129,6 +129,7 @@
129
129
  "highValueLoss": "收到的代币的价值明显低于要被兑换的代币和交易成本。",
130
130
  "insufficientFunds": "你没有足够的资金来完成这笔交易。",
131
131
  "insufficientGas": "您没有足够的燃气费来完成此次交易。您至少需要添加:",
132
+ "minFromAmountUSD": "",
132
133
  "rateChanged": "兑换比例已经改变,如果继续兑换,您将接受新的兑换比例。",
133
134
  "resetSettings": "这将重置您的路由优先级,滑点,燃气费,选中的跨链桥和链上交易所。",
134
135
  "slippageOutsideRecommendedLimits": "过高的滑点可能会导致交易被抢跑,造成财产损失",
@@ -345,6 +346,8 @@
345
346
  },
346
347
  "tokenMetric": {
347
348
  "currentPrice": "",
348
- "contractAddress": ""
349
+ "contractAddress": "",
350
+ "marketCap": "",
351
+ "volume24h": ""
349
352
  }
350
353
  }
@@ -27,6 +27,7 @@ export function ChainOrderStoreProvider({
27
27
  const storeRef = useRef<ChainOrderStore>(null)
28
28
  const { chains } = useChains()
29
29
  const { setFieldValue, getFieldValues } = useFieldActions()
30
+ const { variant, subvariantOptions } = useWidgetConfig()
30
31
  const { externalChainTypes, useExternalWalletProvidersOnly } =
31
32
  useExternalWalletProvider()
32
33
 
@@ -58,15 +59,30 @@ export function ChainOrderStoreProvider({
58
59
  : true
59
60
  return passesChainsConfigFilter && passesWalletConfigFilter
60
61
  })
62
+
61
63
  const chainOrder = storeRef.current?.getState().initializeChains(
62
64
  filteredChains.map((chain) => chain.id),
63
65
  key
64
66
  )
65
- if (chainOrder) {
66
- const [chainValue] = getFieldValues(`${key}Chain`)
67
- if (!chainValue) {
68
- setFieldValue(`${key}Chain`, chainOrder[0])
69
- }
67
+
68
+ const [chainValue] = getFieldValues(`${key}Chain`)
69
+ if (chainValue) {
70
+ return
71
+ }
72
+
73
+ const firstAllowedPinnedChain = storeRef.current
74
+ ?.getState()
75
+ .pinnedChains?.find((chainId) =>
76
+ filteredChains.some((chain) => chain.id === chainId)
77
+ )
78
+ if (
79
+ variant === 'wide' &&
80
+ subvariantOptions?.wide?.enableChainSidebar &&
81
+ firstAllowedPinnedChain
82
+ ) {
83
+ setFieldValue(`${key}Chain`, firstAllowedPinnedChain)
84
+ } else if (chainOrder?.length) {
85
+ setFieldValue(`${key}Chain`, chainOrder[0])
70
86
  }
71
87
  })
72
88
  }
@@ -77,6 +93,8 @@ export function ChainOrderStoreProvider({
77
93
  getFieldValues,
78
94
  setFieldValue,
79
95
  useExternalWalletProvidersOnly,
96
+ variant,
97
+ subvariantOptions?.wide?.enableChainSidebar,
80
98
  ])
81
99
 
82
100
  return (
@@ -17,6 +17,7 @@ export const createChainOrderStore = ({ namePrefix }: PersistStoreProps) =>
17
17
  (set, get) => ({
18
18
  chainOrder: defaultChainState,
19
19
  availableChains: defaultChainState,
20
+ pinnedChains: [],
20
21
  initializeChains: (chainIds, type) => {
21
22
  set((state: ChainOrderState) => {
22
23
  const chainOrder = state.chainOrder[type].filter((chainId) =>
@@ -76,11 +77,28 @@ export const createChainOrderStore = ({ namePrefix }: PersistStoreProps) =>
76
77
  }
77
78
  })
78
79
  },
80
+ setPinnedChain: (chainId) => {
81
+ set((state: ChainOrderState) => {
82
+ const pinnedChains = [...state.pinnedChains]
83
+ if (pinnedChains.includes(chainId)) {
84
+ return {
85
+ pinnedChains: pinnedChains.filter((id) => id !== chainId),
86
+ }
87
+ }
88
+ pinnedChains.push(chainId)
89
+ return {
90
+ pinnedChains,
91
+ }
92
+ })
93
+ },
79
94
  }),
80
95
  {
81
96
  name: `${namePrefix || 'li.fi'}-widget-chains-order`,
82
97
  version: 2,
83
- partialize: (state) => ({ chainOrder: state.chainOrder }),
98
+ partialize: (state) => ({
99
+ chainOrder: state.chainOrder,
100
+ pinnedChains: state.pinnedChains,
101
+ }),
84
102
  }
85
103
  ) as StateCreator<ChainOrderState, [], [], ChainOrderState>,
86
104
  Object.is
@@ -9,9 +9,11 @@ export interface ChainOrderProps {
9
9
  from: number[]
10
10
  to: number[]
11
11
  }
12
+ pinnedChains: number[]
12
13
  }
13
14
 
14
15
  export interface ChainOrderState extends ChainOrderProps {
15
16
  initializeChains(chainIds: number[], type: FormType): number[]
16
17
  setChain(chainId: number, type: FormType): void
18
+ setPinnedChain(chainId: number): void
17
19
  }
@@ -1,5 +1,4 @@
1
1
  import { createContext, useContext, useRef } from 'react'
2
- import { shallow } from 'zustand/shallow'
3
2
  import { createWithEqualityFn } from 'zustand/traditional'
4
3
  import type { PersistStoreProviderProps } from '../types.js'
5
4
  import type { HeaderState, HeaderStore } from './types.js'
@@ -42,10 +41,7 @@ export function useHeaderStore<T>(
42
41
  // To prevent the remaining page content from appearing behind the header we need to
43
42
  // pass the headers height so that the position of the page content can be adjusted
44
43
  export function useHeaderHeight() {
45
- const [headerHeight] = useHeaderStore(
46
- (state) => [state.headerHeight],
47
- shallow
48
- )
44
+ const headerHeight = useHeaderStore((state) => state.headerHeight)
49
45
 
50
46
  return {
51
47
  headerHeight,
@@ -53,10 +49,7 @@ export function useHeaderHeight() {
53
49
  }
54
50
 
55
51
  export function useSetHeaderHeight() {
56
- const [setHeaderHeight] = useHeaderStore(
57
- (state) => [state.setHeaderHeight],
58
- shallow
59
- )
52
+ const setHeaderHeight = useHeaderStore((state) => state.setHeaderHeight)
60
53
 
61
54
  return {
62
55
  setHeaderHeight,
@@ -280,6 +280,7 @@ export interface WidgetConfig {
280
280
  toAddress?: ToAddress
281
281
  toAddresses?: ToAddress[]
282
282
  fromAmount?: number | string
283
+ minFromAmountUSD?: number
283
284
  toAmount?: number | string
284
285
  formUpdateKey?: string
285
286