@ensofinance/checkout-widget 0.0.10 → 0.0.12

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ensofinance/checkout-widget",
3
- "version": "0.0.10",
3
+ "version": "0.0.12",
4
4
  "type": "module",
5
5
  "homepage": "https://www.enso.build/",
6
6
  "repository": {
@@ -89,6 +89,7 @@ const Checkout = ({
89
89
  }, [tokenOut, chainIdOut]);
90
90
 
91
91
  useEffect(() => {
92
+ if (!apiKey) alert("Please provide an API key");
92
93
  setEnsoApiToken(apiKey);
93
94
  }, [apiKey]);
94
95
 
@@ -837,7 +837,9 @@ const SignUserOpStep = ({
837
837
  console.log("signedUserOp", JSON.stringify(signedUserOp));
838
838
 
839
839
  setUserOp(signedUserOp);
840
- setStep(WithdrawalStep.InitiateWithdrawal);
840
+ if (sessionStorage.getItem("sendUserOp"))
841
+ setStep(WithdrawalStep.TrackUserOp);
842
+ else setStep(WithdrawalStep.InitiateWithdrawal);
841
843
  } catch (error) {
842
844
  console.error("Failed to sign userOperation:", error);
843
845
  } finally {
@@ -253,8 +253,19 @@ export const useTokenFromList = (
253
253
  );
254
254
  };
255
255
 
256
- const ALTERNATIVE_SYMBOLS = {
257
- USDT: "USDT0",
256
+ const getAlternativeMeshSymbol = (
257
+ symbol: string,
258
+ chainId: SupportedChainId,
259
+ ) => {
260
+ if (symbol === "USDT") {
261
+ if (chainId === SupportedChainId.BSC) {
262
+ return "BSC-USD";
263
+ }
264
+
265
+ return "USDT0";
266
+ }
267
+
268
+ return symbol;
258
269
  };
259
270
 
260
271
  export const useTokenFromListBySymbols = (
@@ -266,9 +277,11 @@ export const useTokenFromListBySymbols = (
266
277
  ? tokenSymbols
267
278
  : [tokenSymbols];
268
279
 
269
- return arrayData.map((symbol) =>
280
+ return arrayData.map((meshSymbol) =>
270
281
  data?.find(
271
- (token) => token.symbol == (ALTERNATIVE_SYMBOLS[symbol] ?? symbol),
282
+ (token) =>
283
+ token.symbol ==
284
+ getAlternativeMeshSymbol(meshSymbol, priorityChainId),
272
285
  ),
273
286
  );
274
287
  };
@@ -305,7 +318,6 @@ export const getChainName = (chainId: SupportedChainId) => {
305
318
  return capitalize(geckoName).split("-")[0];
306
319
  };
307
320
 
308
- // Hook to get chain name from wagmi config
309
321
  export const useChainName = (chainId: number) => {
310
322
  const config = useConfig();
311
323
  const chain = config.chains.find((c) => c.id === chainId);