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

[FRE-416] Upgrade skip router dependency #115

Merged
merged 5 commits into from
Dec 5, 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,942 changes: 761 additions & 1,181 deletions package-lock.json

Large diffs are not rendered by default.

62 changes: 36 additions & 26 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,25 @@
"test": "jest",
"test:e2e": "playwright test --project=chromium"
},
"overrides": {
"@cosmjs/amino": "^0.32.1",
"@cosmjs/cosmwasm-stargate": "^0.32.1",
"@cosmjs/encoding": "^0.32.1",
"@cosmjs/ledger-amino": "^0.32.1",
"@cosmjs/math": "^0.32.1",
"@cosmjs/proto-signing": "^0.32.1",
"@cosmjs/stargate": "^0.32.1",
"@cosmjs/tendermint-rpc": "^0.32.1"
},
"dependencies": {
"@cosmjs/amino": "^0.31.3",
"@cosmjs/cosmwasm-stargate": "^0.31.3",
"@cosmjs/encoding": "^0.31.3",
"@cosmjs/ledger-amino": "^0.31.3",
"@cosmjs/math": "^0.31.3",
"@cosmjs/proto-signing": "^0.31.3",
"@cosmjs/stargate": "^0.31.3",
"@cosmjs/tendermint-rpc": "^0.31.3",
"@cosmjs/amino": "^0.32.1",
"@cosmjs/cosmwasm-stargate": "^0.32.1",
"@cosmjs/encoding": "^0.32.1",
"@cosmjs/ledger-amino": "^0.32.1",
"@cosmjs/math": "^0.32.1",
"@cosmjs/proto-signing": "^0.32.1",
"@cosmjs/stargate": "^0.32.1",
"@cosmjs/tendermint-rpc": "^0.32.1",
"@cosmos-kit/core": "^2.0.3",
"@cosmos-kit/cosmostation-extension": "^2.0.3",
"@cosmos-kit/keplr-extension": "^2.0.3",
Expand All @@ -39,18 +49,18 @@
"@heroicons/react": "^2.0.18",
"@injectivelabs/sdk-ts": "^1.14.4",
"@injectivelabs/utils": "^1.14.4",
"@keplr-wallet/types": "^0.12.44",
"@keplr-wallet/types": "^0.12.46",
"@radix-ui/react-accordion": "^1.1.2",
"@radix-ui/react-collapsible": "^1.0.3",
"@radix-ui/react-dialog": "^1.0.5",
"@radix-ui/react-toast": "^1.1.5",
"@radix-ui/react-toggle-group": "^1.0.4",
"@radix-ui/react-tooltip": "^1.0.7",
"@sentry/nextjs": "^7.81.1",
"@skip-router/core": "^0.1.0-rc22",
"@tanstack/react-query": "^5.8.4",
"@types/node": "20.9.4",
"@types/react": "18.2.38",
"@sentry/nextjs": "^7.85.0",
"@skip-router/core": "^1.0.5",
"@tanstack/react-query": "^5.12.2",
"@types/node": "20.10.3",
"@types/react": "18.2.42",
"@types/react-dom": "18.2.17",
"@vercel/analytics": "^1.1.1",
"@web3modal/core": "^2.7.0",
Expand All @@ -64,22 +74,22 @@
"download": "^8.0.0",
"eslint-config-next": "14.0.3",
"ethers": "^6.3.0",
"framer-motion": "^10.16.5",
"framer-motion": "^10.16.14",
"next": "14.0.3",
"pino-pretty": "^10.2.3",
"postcss": "8.4.31",
"postcss": "8.4.32",
"react": "18.2.0",
"react-dom": "18.2.0",
"tailwindcss": "3.3.5",
"tailwindcss": "3.3.6",
"usehooks-ts": "^2.9.1",
"viem": "^1.14.0",
"wagmi": "^1.4.3",
"zod": "^3.22.4",
"zustand": "^4.4.6"
"zustand": "^4.4.7"
},
"devDependencies": {
"@playwright/test": "^1.38.0",
"@tanstack/eslint-plugin-query": "^5.8.4",
"@playwright/test": "^1.40.1",
"@tanstack/eslint-plugin-query": "^5.12.1",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^14.0.0",
"@testing-library/user-event": "^14.4.3",
Expand All @@ -88,24 +98,24 @@
"@types/http-proxy": "^1.17.14",
"@types/jest": "^29.5.3",
"@types/testing-library__jest-dom": "^5.14.5",
"@typescript-eslint/eslint-plugin": "^6.12.0",
"@typescript-eslint/parser": "^6.12.0",
"@typescript-eslint/eslint-plugin": "^6.13.2",
"@typescript-eslint/parser": "^6.13.2",
"degit": "npm:tiged@^2.12.5",
"eslint": "^8.54.0",
"eslint-config-prettier": "^9.0.0",
"eslint": "^8.55.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.0.1",
"eslint-plugin-simple-import-sort": "^10.0.0",
"globby": "^14.0.0",
"jest": "^29.5.0",
"jest-environment-jsdom": "^29.5.0",
"msw": "^1.2.3",
"npm-run-all2": "^6.1.1",
"p-map": "^6.0.0",
"p-map": "^7.0.0",
"patch-package": "^8.0.0",
"prettier": "^3.1.0",
"resize-observer-polyfill": "^1.5.1",
"ts-jest": "^29.1.1",
"tsx": "^4.2.1",
"tsx": "^4.6.2",
"typescript": "5.1.x"
}
}
40 changes: 0 additions & 40 deletions patches/@skip-router+core+1.0.3.patch

This file was deleted.

2 changes: 1 addition & 1 deletion src/components/AssetInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ const AssetInput: FC<Props> = ({
error={null}
chainId={asset.originChainID}
denom={asset.originDenom}
coingeckoId={asset.coingeckoId}
coingeckoID={asset.coingeckoID}
value={amount}
context={onAmountChange ? "src" : "dest"}
/>
Expand Down
8 changes: 7 additions & 1 deletion src/components/HistoryDialog/HistoryList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,13 @@ export const Item = forwardRef<HTMLDivElement, ItemProps>(
})}
>
<span className="capitalize">{data.status}</span>
<StatusIcon status={data.status} className="w-4 h-4" />
<StatusIcon
status={data.status}
className={clsx(
"w-4 h-4",
data.status === "pending" && "animate-spin",
)}
/>
</div>
</div>

Expand Down
2 changes: 1 addition & 1 deletion src/components/SwapWidget/SwapDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export const SwapDetails = ({
error={null}
chainId={right.chainID}
denom={right.denom}
coingeckoId={right.coingeckoId}
coingeckoID={right.coingeckoID}
value={conversion.toString()}
/>
</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,11 +177,8 @@ const TransactionDialogContent: FC<Props> = ({
numberOfBroadcastedTransactions + 1,
);
},
onTransactionSuccess: async (txStatus) => {
const explorerLink = getExplorerLinkForTx(
txStatus.chainID,
txStatus.txHash,
);
onTransactionCompleted: async (chainID, txHash) => {
const explorerLink = getExplorerLinkForTx(chainID, txHash);

setTxStatuses((statuses) => {
const newStatuses = [...statuses];
Expand All @@ -193,7 +190,7 @@ const TransactionDialogContent: FC<Props> = ({
newStatuses[pendingIndex] = {
status: "SUCCESS",
explorerLink,
txHash: txStatus.txHash,
txHash,
};

if (pendingIndex < statuses.length - 1) {
Expand Down
12 changes: 6 additions & 6 deletions src/hooks/useUsdValue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { getUsdPrice } from "@/utils/llama";
export type Args = {
chainId: string;
denom: string;
coingeckoId?: string;
coingeckoID?: string;
value: string;
};

Expand Down Expand Up @@ -61,22 +61,22 @@ export function useUsdDiffValue([args1, args2]: [Args, Args]) {
}

async function getUsdValue(args: Args) {
let coingeckoId: string;
let coingeckoID: string;

if (args.coingeckoId) {
coingeckoId = args.coingeckoId;
if (args.coingeckoID) {
coingeckoID = args.coingeckoID;
} else {
const assets = getAssets(args.chainId);
const asset =
assets.find((asset) => asset.base === args.denom) ||
raise(`getUsdValue error: ${args.denom} not found in ${args.chainId}`);
coingeckoId =
coingeckoID =
asset.coingecko_id ||
raise(
`getUsdValue error: ${args.denom} does not have a 'coingecko_id' in ${args.chainId}`,
);
}

const usd = await getUsdPrice({ coingeckoId });
const usd = await getUsdPrice({ coingeckoID });
return parseFloat(args.value) * usd;
}
12 changes: 6 additions & 6 deletions src/utils/llama.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
import { z } from "zod";

interface Args {
coingeckoId: string;
coingeckoID: string;
}

const cache = new Map<string, number>();

export async function getUsdPrice({ coingeckoId }: Args) {
const cached = cache.get(coingeckoId);
export async function getUsdPrice({ coingeckoID }: Args) {
const cached = cache.get(coingeckoID);
if (cached) return cached;

const endpoint = `https://coins.llama.fi/prices/current/coingecko:${coingeckoId}`;
const endpoint = `https://coins.llama.fi/prices/current/coingecko:${coingeckoID}`;

const response = await fetch(endpoint);
const data = await response.json();

const { coins } = await priceResponseSchema.parseAsync(data);
const { price } = coins[`coingecko:${coingeckoId}`];
const { price } = coins[`coingecko:${coingeckoID}`];

cache.set(coingeckoId, price);
cache.set(coingeckoID, price);
return price;
}

Expand Down