Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

debug: add logs #259

Merged
merged 1 commit into from
Jan 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions components/swap/parts/ChainSwapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export const ChainSwapper = () => {

const updateQueryParamsAndSwitch = async () => {
setDestChain(srcChain);
console.log(1);
setSrcChain(destChain);

// if switching from a native token should choose the wrapped version
Expand Down
11 changes: 9 additions & 2 deletions components/swap/parts/SourceChainSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,10 @@ export const SourceChainSelector = () => {
const chain = filteredChains.find(
(candidate) => candidate.chainName === srcChainName
);
if (chain) setSrcChain(chain);
if (chain) {
console.log(2);
setSrcChain(chain);
}
}, [router.query]);

useEffect(() => {
Expand Down Expand Up @@ -91,7 +94,10 @@ export const SourceChainSelector = () => {
const selectedChainHasAsset = selectedChain?.assets?.find(
(_asset) => _asset.common_key === asset?.id
);
if (selectedChainHasAsset) return setSrcChain(chain);
if (selectedChainHasAsset) {
console.log(3);
return setSrcChain(chain);
}

// if asset incompatible find fist compatible asset
const compatibleAsset = allAssets.find(
Expand All @@ -101,6 +107,7 @@ export const SourceChainSelector = () => {
);
if (!compatibleAsset) return;
setAsset(compatibleAsset);
console.log(4);
setSrcChain(chain);
}

Expand Down
6 changes: 5 additions & 1 deletion features/src-chain-selector/hooks/useSwitchSrcChain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ export const useSwitchSrcChain = () => {
const selectedChainHasAsset = selectedChain?.assets?.find(
(_asset) => _asset.common_key === asset?.id
);
if (selectedChainHasAsset) return setSrcChain(chain);
if (selectedChainHasAsset) {
console.log(5);
return setSrcChain(chain);
}

// if asset incompatible find fist compatible asset
const compatibleAsset = allAssets.find(
Expand All @@ -31,6 +34,7 @@ export const useSwitchSrcChain = () => {
);
if (!compatibleAsset) return;
setAsset(compatibleAsset);
console.log(6);
setSrcChain(chain);
};
};
2 changes: 2 additions & 0 deletions hooks/init/useInitialChainList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,10 @@ export const useInitialChainList = () => {
) as ChainInfo;
}
if (srcChainFound) {
console.log(8);
setSrcChain(srcChainFound);
} else {
console.log(9);
setSrcChain(
uniqueChains.find(
(chain) => chain.chainName?.toLowerCase() === DEFAULT_SRC_CHAIN
Expand Down
1 change: 1 addition & 0 deletions hooks/usePreventDuplicateChains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export const usePreventDuplicateChains = () => {
const newChain = allChains.find(
(chain) => chain?.chainName !== srcChain?.chainName
) as ChainInfo;
console.log(7);
setSrcChain(newChain);
} else if (sourceChain === "destChain") {
const newChain = allChains.find(
Expand Down