@skip-go/widget 2.3.0 → 2.3.1-alpha.1

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.
@@ -14,7 +14,10 @@ export interface MinimalWallet {
14
14
  getAddress?: (props: {
15
15
  signRequired?: boolean;
16
16
  context?: 'recovery' | 'destination';
17
- penumbraWalletIndex?: number;
17
+ praxWallet?: {
18
+ index?: number;
19
+ sourceChainID?: string;
20
+ };
18
21
  }) => Promise<string | undefined>;
19
22
  }
20
23
  export declare const useMakeWallets: () => {
package/build/index.es.js CHANGED
@@ -2139,6 +2139,12 @@ function useSwapWidget(persistSwapWidgetState = true) {
2139
2139
  ((_b = x.recommendedSymbol) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === 'usdc';
2140
2140
  });
2141
2141
  }
2142
+ if (chain.chainType === 'svm') {
2143
+ asset = assets.find((x) =>
2144
+ // default to usdc
2145
+ x.denom.toLowerCase() ===
2146
+ 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v'.toLowerCase());
2147
+ }
2142
2148
  asset !== null && asset !== void 0 ? asset : (asset = assets[0]);
2143
2149
  }
2144
2150
  useSwapWidgetStore.setState({
@@ -3931,7 +3937,7 @@ const PraxWalletIndex = ({ praxWalletIndex, setPraxWalletIndex, }) => {
3931
3937
  }, children: jsx(MdCheck, { className: "size-4.5" }) }), jsx(StyledCancelButton, { className: cn('flex w-7 items-center justify-center rounded-md border-2'), onClick: (e) => {
3932
3938
  e.stopPropagation();
3933
3939
  setEditing(false);
3934
- }, children: jsx(MdClose, { className: "size-4.5" }) })] })) : (jsxs(StyledThemedButton, { className: cn('flex w-full items-center gap-2 rounded-lg p-1.5 px-2 transition-colors focus:-outline-offset-2'), onClick: (e) => {
3940
+ }, children: jsx(MdClose, { className: "size-4.5" }) })] })) : (jsxs(StyledThemedButton, { className: cn('flex items-center gap-2 rounded-lg p-1.5 px-2 transition-colors focus:-outline-offset-2'), onClick: (e) => {
3935
3941
  e.stopPropagation();
3936
3942
  setEditing(true);
3937
3943
  }, children: [jsxs("p", { children: ["Address Index ", praxWalletIndex] }), jsx(PencilSquareIcon, { className: "h-4 w-4" })] }));
@@ -4011,13 +4017,17 @@ const SetAddressDialog = ({ open, onOpen, chain, index, signRequired, isDestinat
4011
4017
  wallets.map((wallet) => {
4012
4018
  // currently only svm chainType that have isAvailable
4013
4019
  return (jsxs(WalletListItem, { chainType: chainType, walletName: wallet.walletName, className: cn('group relative mb-2 data-[unsupported=true]:opacity-30', 'data-[unsupported=true]:before:absolute data-[unsupported=true]:before:inset-0 data-[unsupported=true]:before:cursor-not-allowed'), children: [jsxs(StyledThemedButton, { className: cn('flex w-full items-center gap-2 rounded-lg p-2 transition-colors focus:-outline-offset-2'), onClick: async () => {
4014
- var _a;
4020
+ var _a, _b;
4015
4021
  const resAddress = await ((_a = wallet.getAddress) === null || _a === void 0 ? void 0 : _a.call(wallet, {
4016
4022
  signRequired,
4017
4023
  context: isDestination ? 'destination' : 'recovery',
4018
- penumbraWalletIndex: wallet.walletName === 'prax'
4019
- ? praxWalletIndex
4020
- : undefined,
4024
+ praxWallet: {
4025
+ index: wallet.walletName === 'prax'
4026
+ ? praxWalletIndex
4027
+ : undefined,
4028
+ // chain id of the previous chain
4029
+ sourceChainID: (_b = chainAddresses[index - 1]) === null || _b === void 0 ? void 0 : _b.chainID,
4030
+ },
4021
4031
  }));
4022
4032
  if (resAddress) {
4023
4033
  setAddress(resAddress);
@@ -5021,7 +5031,7 @@ const SwapWidgetUI = ({ className, style, toasterProps, persistSwapWidgetState,
5021
5031
  return;
5022
5032
  invertButtonRef.current.setAttribute('data-swap', 'true');
5023
5033
  await onInvertDirection();
5024
- }, "data-testid": "swap-button", ref: invertButtonRef, children: jsx(ArrowsUpDownIcon, { className: "h-4 w-4" }) }) }), jsx("p", { className: "text-2xl font-semibold", children: "To" })] }), jsx("div", { "data-testid": "destination", children: jsx(AssetInput, { amount: amountOut, amountUSD: route === null || route === void 0 ? void 0 : route.usdAmountOut, diffPercentage: usdDiffPercent, asset: destinationAsset, chain: destinationChain, chains: destinationChains !== null && destinationChains !== void 0 ? destinationChains : [], onAmountChange: onDestinationAmountChange, onAssetChange: onDestinationAssetChange, onChainChange: onDestinationChainChange, context: "destination", isLoading: direction === 'swap-in' && routeLoading }) }), route && (jsx(SwapDetails, { amountIn: amountIn, amountOut: amountOut, bridges: bridges, destinationAsset: destinationAsset, destinationChain: destinationChain, direction: direction, gasRequired: sourceFeeAmount, onBridgesChange: onBridgeChange, priceImpactPercent: swapPriceImpactPercent !== null && swapPriceImpactPercent !== void 0 ? swapPriceImpactPercent : 0, priceImpactThresholdReached: priceImpactThresholdReached, route: route, sourceAsset: sourceAsset, sourceFeeAsset: sourceFeeAsset, sourceChain: sourceChain })), routeLoading && (jsxs("div", { className: "flex w-full items-center justify-between space-x-2 text-sm font-medium uppercase", children: [jsx("p", { className: "text-neutral-400", children: "Finding best route..." }), jsx(SpinnerIcon, { className: "h-5 w-5 text-neutral-200 animate-spin" })] })), route && !routeLoading && numberOfTransactions > 1 && (jsxs("div", { className: "flex w-full items-center justify-center space-x-2 text-sm font-medium uppercase", children: [jsxs("div", { className: cn('relative rounded-full p-[4px]'), children: [jsx(StyledBrandDiv, { className: cn('absolute h-6 w-6 animate-ping rounded-full') }), jsx(FingerPrintIcon, { className: "relative h-6 w-6 text-white" })] }), jsxs("p", { children: [numberOfTransactions, " Signature Required"] })] })), !!routeError && (jsx("div", { className: "flex w-full items-center rounded-md bg-red-50 p-3 text-left text-xs font-medium uppercase text-red-500", children: jsx("p", { className: "flex-1 text-red-500", children: routeError }) })), (destinationChain === null || destinationChain === void 0 ? void 0 : destinationChain.chainID) === 'dydx-mainnet-1' && (jsx("div", { className: "flex w-full items-center rounded-md bg-red-50 p-3 text-left text-xs font-medium uppercase text-red-500", children: jsxs("p", { className: "flex-1 [&_a]:underline text-red-500", children: ["This transaction will let you transfer and stake tokens on dydx, it will not allow you to trade. Follow the", ' ', jsx(AdaptiveLink, { href: "https://dydx.exchange", children: "dydx frontend" }), ' ', "directions to set up a trading account"] }) })), (destinationChain === null || destinationChain === void 0 ? void 0 : destinationChain.chainID.includes('penumbra')) && (jsx("div", { className: "flex w-full items-center rounded-md bg-red-50 p-3 text-left text-xs font-medium uppercase text-red-500", children: jsxs("p", { className: "flex-1 [&_a]:underline text-red-500", children: ["Notice: Skip Go currently only supports depositing assets into Penumbra. To withdraw assets from Penumbra, please use:", jsx(AdaptiveLink, { href: "https://stake.with.starlingcyber.net/", children: "https://stake.with.starlingcyber.net/" })] }) })), !isWalletConnected && (jsx(StyledBrandDiv, { as: "button", className: cn('w-full rounded-md py-4 font-semibold text-white outline-none transition-[opacity,transform]', 'disabled:cursor-not-allowed disabled:opacity-75', 'enabled:hover:rotate-1 enabled:hover:scale-105'), disabled: !sourceChain, onClick: async () => {
5034
+ }, "data-testid": "swap-button", ref: invertButtonRef, children: jsx(ArrowsUpDownIcon, { className: "h-4 w-4" }) }) }), jsx("p", { className: "text-2xl font-semibold", children: "To" })] }), jsx("div", { "data-testid": "destination", children: jsx(AssetInput, { amount: amountOut, amountUSD: route === null || route === void 0 ? void 0 : route.usdAmountOut, diffPercentage: usdDiffPercent, asset: destinationAsset, chain: destinationChain, chains: destinationChains !== null && destinationChains !== void 0 ? destinationChains : [], onAmountChange: onDestinationAmountChange, onAssetChange: onDestinationAssetChange, onChainChange: onDestinationChainChange, context: "destination", isLoading: direction === 'swap-in' && routeLoading }) }), route && (jsx(SwapDetails, { amountIn: amountIn, amountOut: amountOut, bridges: bridges, destinationAsset: destinationAsset, destinationChain: destinationChain, direction: direction, gasRequired: sourceFeeAmount, onBridgesChange: onBridgeChange, priceImpactPercent: swapPriceImpactPercent !== null && swapPriceImpactPercent !== void 0 ? swapPriceImpactPercent : 0, priceImpactThresholdReached: priceImpactThresholdReached, route: route, sourceAsset: sourceAsset, sourceFeeAsset: sourceFeeAsset, sourceChain: sourceChain })), routeLoading && (jsxs("div", { className: "flex w-full items-center justify-between space-x-2 text-sm font-medium uppercase", children: [jsx("p", { className: "text-neutral-400", children: "Finding best route..." }), jsx(SpinnerIcon, { className: "h-5 w-5 text-neutral-200 animate-spin" })] })), route && !routeLoading && numberOfTransactions > 1 && (jsxs("div", { className: "flex w-full items-center justify-center space-x-2 text-sm font-medium uppercase", children: [jsxs("div", { className: cn('relative rounded-full p-[4px]'), children: [jsx(StyledBrandDiv, { className: cn('absolute h-6 w-6 animate-ping rounded-full') }), jsx(FingerPrintIcon, { className: "relative h-6 w-6 text-white" })] }), jsxs("p", { children: [numberOfTransactions, " Signature Required"] })] })), !!routeError && (jsx("div", { className: "flex w-full items-center rounded-md bg-red-50 p-3 text-left text-xs font-medium uppercase text-red-500", children: jsx("p", { className: "flex-1 text-red-500", children: routeError }) })), (destinationChain === null || destinationChain === void 0 ? void 0 : destinationChain.chainID) === 'dydx-mainnet-1' && (jsx("div", { className: "flex w-full items-center rounded-md bg-red-50 p-3 text-left text-xs font-medium uppercase text-red-500", children: jsxs("p", { className: "flex-1 [&_a]:underline text-red-500", children: ["This transaction will let you transfer and stake tokens on dydx, it will not allow you to trade. Follow the", ' ', jsx(AdaptiveLink, { href: "https://dydx.exchange", children: "dydx frontend" }), ' ', "directions to set up a trading account"] }) })), (destinationChain === null || destinationChain === void 0 ? void 0 : destinationChain.chainID.includes('penumbra')) && (jsx("div", { className: "flex w-full items-center rounded-md bg-red-50 p-3 text-left text-xs font-medium uppercase text-red-500", children: jsxs("p", { className: "flex-1 [&_a]:underline text-red-500", children: ["Notice: Skip Go currently only supports depositing assets into Penumbra. To withdraw assets from Penumbra, please use:", ' ', jsx(AdaptiveLink, { href: "https://stake.with.starlingcyber.net/", children: "https://stake.with.starlingcyber.net/" })] }) })), !isWalletConnected && (jsx(StyledBrandDiv, { as: "button", className: cn('w-full rounded-md py-4 font-semibold text-white outline-none transition-[opacity,transform]', 'disabled:cursor-not-allowed disabled:opacity-75', 'enabled:hover:rotate-1 enabled:hover:scale-105'), disabled: !sourceChain, onClick: async () => {
5025
5035
  if (sourceChain && !(srcAccount === null || srcAccount === void 0 ? void 0 : srcAccount.isWalletConnected)) {
5026
5036
  openWalletModal(sourceChain.chainID);
5027
5037
  return;