Skip to content

Commit

Permalink
feat: sync staging → main
Browse files Browse the repository at this point in the history
Signed-off-by: Griko Nibras <griko@nibras.co>
  • Loading branch information
grikomsn committed Jan 12, 2024
2 parents c7b4dec + 69d28fd commit 712d0ae
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
4 changes: 3 additions & 1 deletion src/components/SwapWidget/useSwapWidget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -292,8 +292,10 @@ const useFormValuesStore = create(
persist(() => defaultValues, {
name: "SwapWidgetState",
version: 1,
storage: createJSONStorage(() => sessionStorage),
storage: createJSONStorage(() => window.sessionStorage),
partialize: (state): Partial<FormValues> => ({
amountIn: state.amountIn,
amountOut: state.amountOut,
sourceChain: state.sourceChain,
sourceAsset: state.sourceAsset,
destinationChain: state.destinationChain,
Expand Down
8 changes: 6 additions & 2 deletions src/components/TransactionDialog/TransactionDialogContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { useState } from "react";
import { toast } from "react-hot-toast";
import { useAccount as useWagmiAccount } from "wagmi";

import { getTrackAccount } from "@/context/account";
import { getTrackAccount, trackAccount } from "@/context/account";
import { useSettingsStore } from "@/context/settings";
import {
addTxHistory,
Expand Down Expand Up @@ -71,6 +71,9 @@ function TransactionDialogContent({
try {
const userAddresses: Record<string, string> = {};

const [sourceChainID] = route.chainIDs;
const sourceWalletName = getTrackAccount(sourceChainID)!;

for (const chainID of route.chainIDs) {
const chain = chains.find((c) => c.chainID === chainID);
if (!chain) {
Expand All @@ -80,7 +83,7 @@ function TransactionDialogContent({
if (chain.chainType === "cosmos") {
const { wallets } = getWalletRepo(chain.chainName);

const walletName = getTrackAccount(chainID);
const walletName = getTrackAccount(chainID) || sourceWalletName;
const wallet = wallets.find((w) => w.walletName === walletName);
if (!wallet) {
throw new Error(
Expand All @@ -89,6 +92,7 @@ function TransactionDialogContent({
}
if (wallet.isWalletDisconnected) {
await wallet.connect();
trackAccount.track(chainID, walletName);
}

if (!wallet.address) {
Expand Down
2 changes: 1 addition & 1 deletion src/components/TransactionDialog/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ function TransactionDialog({
Preview Route
</button>
{isOpen && (
<div className="absolute inset-0 bg-white rounded-3xl">
<div className="absolute inset-0 bg-white rounded-3xl animate-fade-zoom-in">
{route && (
<TransactionDialogContent
route={route}
Expand Down
3 changes: 2 additions & 1 deletion src/context/account.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { create } from "zustand";
import { persist } from "zustand/middleware";
import { createJSONStorage, persist } from "zustand/middleware";

type TrackAccountStore = Record<string, string>;

Expand All @@ -9,6 +9,7 @@ const store = create(
persist(() => defaultValues, {
name: "TrackAccountState",
version: 1,
storage: createJSONStorage(() => window.sessionStorage),
}),
);

Expand Down

1 comment on commit 712d0ae

@vercel
Copy link

@vercel vercel bot commented on 712d0ae Jan 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

ibc-dot-fun – ./

ibc-dot-fun-git-main-skip-protocol.vercel.app
ibc-dot-fun-skip-protocol.vercel.app

Please sign in to comment.