Skip to content

Commit

Permalink
Merge branch 'main' into feature/evm
Browse files Browse the repository at this point in the history
  • Loading branch information
Pierre Gee authored Sep 11, 2023
2 parents c4d0795 + 1df73f1 commit 3083236
Show file tree
Hide file tree
Showing 9 changed files with 71 additions and 8 deletions.
18 changes: 18 additions & 0 deletions src/components/icons/assets/tokens/XCHF.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { SVGProps } from "react";

export function XCHF(props: SVGProps<SVGSVGElement>): JSX.Element {
return (
<svg width="36" height="36" viewBox="0 0 36 36" fill="none" {...props}>
<path
fillRule="evenodd"
clipRule="evenodd"
d="M0 18C0 8.05891 8.05891 0 18 0C27.9411 0 36 8.05891 36 18C36 27.9411 27.9411 36 18 36C8.05891 36 0 27.9411 0 18Z"
fill="#CE0E2D"
/>
<path
d="M13.023 24.1571H5.65027L13.1825 12.0313L15.1859 15.0667L13.911 17.1915L13.1825 16.1898L9.60073 22.0229H11.7862L20.8809 7.57166C24.98 14.0487 27.2782 17.6801 31.3773 24.1571L18.1969 24.1571L15.998 20.6809L17.3077 18.6113L19.5066 22.0229H27.5584L20.8809 11.4002L13.023 24.1571Z"
fill="white"
/>
</svg>
);
}
18 changes: 18 additions & 0 deletions src/components/icons/assets/tokens/dXCHF.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { SVGProps } from "react";

export function dXCHF(props: SVGProps<SVGSVGElement>): JSX.Element {
return (
<svg width="36" height="36" viewBox="0 0 36 36" fill="none" {...props}>
<path
fillRule="evenodd"
clipRule="evenodd"
d="M0 18C0 8.05891 8.05891 0 18 0C27.9411 0 36 8.05891 36 18C36 27.9411 27.9411 36 18 36C8.05891 36 0 27.9411 0 18Z"
fill="#FFE8EB"
/>
<path
d="M13.023 24.1571H5.65027L13.1825 12.0313L15.1859 15.0667L13.911 17.1915L13.1825 16.1898L9.60073 22.0229H11.7862L20.8809 7.57166C24.98 14.0487 27.2782 17.6801 31.3773 24.1571L18.1969 24.1571L15.998 20.6809L17.3077 18.6113L19.5066 22.0229H27.5584L20.8809 11.4002L13.023 24.1571Z"
fill="#CE0E2D"
/>
</svg>
);
}
4 changes: 4 additions & 0 deletions src/components/icons/assets/tokens/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ import { dDOT } from "./dDOT";
import { dSOL } from "./dSOL";
import { dMATIC } from "./dMATIC";
import { dSUI } from "./dSUI";
import { dXCHF } from "./dXCHF";
import { XCHF } from "./XCHF";

const mapping: Record<string, (props: SVGProps<SVGSVGElement>) => JSX.Element> =
{
Expand Down Expand Up @@ -59,6 +61,8 @@ const mapping: Record<string, (props: SVGProps<SVGSVGElement>) => JSX.Element> =
dDOT: dDOT,
dSOL: dSOL,
dSUI: dSUI,
dXCHF: dXCHF,
XCHF: XCHF,
};

// TODO(@defich): move assets into it's own repo where anyone can create pull request into.
Expand Down
11 changes: 11 additions & 0 deletions src/constants/TokenBackedAddress.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,13 @@ export const TOKEN_BACKED_ADDRESS: BackedAddress = {
address: "12YfgqECReN4fQppa9BDoyGce43F54ZHYotE77mb5SmCBsUk",
},
},
SUI: {
cake: {
link: "https://suiexplorer.com/address/0x072e6de3fc10b1eacbe130127f6baf3111034fc0204f0edd7a1899d8c40a11a5",
address:
"0x072e6de3fc10b1eacbe130127f6baf3111034fc0204f0edd7a1899d8c40a11a5",
},
},
};

interface TokenBacked {
Expand Down Expand Up @@ -150,4 +157,8 @@ export const TOKEN_BACKED: TokenBacked[] = [
name: "dDOT",
symbol: "DOT",
},
{
name: "dSUI",
symbol: "SUI",
},
];
5 changes: 3 additions & 2 deletions src/pages/dex/_components/PoolPairsCards.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export function PoolPairsCards({
sortKey,
reverse: sortOrder === "desc",
}),
[poolPairsPrices, sortKey, sortOrder]
[poolPairsPrices, sortKey, sortOrder],
);

function changeSort(sortType: {
Expand Down Expand Up @@ -131,7 +131,8 @@ export function PoolPairsCard({
poolPair.displaySymbol.includes("dUSDC") ||
poolPair.displaySymbol.includes("dBTC") ||
poolPair.displaySymbol.includes("dETH") ||
poolPair.displaySymbol.includes("dEUROC")
poolPair.displaySymbol.includes("dEUROC") ||
poolPair.displaySymbol.includes("dXCHF")
? poolPair.displaySymbol
: poolPair.tokenA.displaySymbol
}`}
Expand Down
5 changes: 3 additions & 2 deletions src/pages/dex/_components/PoolPairsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export function PoolPairsTable({
sortKey,
reverse: sortOrder === "desc",
}),
[poolPairsPrices, sortKey, sortOrder]
[poolPairsPrices, sortKey, sortOrder],
);

function changeSort(key: SortKeys): void {
Expand Down Expand Up @@ -94,7 +94,8 @@ export function PoolPairsTable({
data.poolPair.displaySymbol.includes("dUSDC") ||
data.poolPair.displaySymbol.includes("dBTC") ||
data.poolPair.displaySymbol.includes("dETH") ||
data.poolPair.displaySymbol.includes("dEUROC")
data.poolPair.displaySymbol.includes("dEUROC") ||
data.poolPair.displaySymbol.includes("dXCHF")
? data.poolPair.displaySymbol
: data.poolPair.tokenA.displaySymbol
}`,
Expand Down
8 changes: 5 additions & 3 deletions src/pages/dex/index.page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,14 +109,16 @@ export default function DexPage({
}

export async function getServerSideProps(
context: GetServerSidePropsContext
context: GetServerSidePropsContext,
): Promise<GetServerSidePropsResult<DexPageProps>> {
const api = getWhaleApiClient(context);

const next = CursorPagination.getNext(context);
const items = await api.poolpairs.list(100, next);
const sorted = items.filter(
(poolpair) => !poolpair.displaySymbol.includes("/")
(poolpair) =>
!poolpair.displaySymbol.includes("/") &&
!poolpair.symbol.includes("BURN"),
);

return {
Expand All @@ -141,7 +143,7 @@ export async function getServerSideProps(
while (poolpairsResponse.hasNext) {
poolpairsResponse = await api.poolpairs.list(
200,
poolpairsResponse.nextToken
poolpairsResponse.nextToken,
);
poolpairs.push(...poolpairsResponse);
}
Expand Down
8 changes: 8 additions & 0 deletions src/pages/tokens/[id].page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,14 @@ function BackingAddress({ tokenSymbol }: { tokenSymbol: string }): JSX.Element {
testId="BackingAddress.DOT"
/>
);
case "SUI":
return (
<AddressLinkExternal
url={TOKEN_BACKED_ADDRESS.SUI.cake.link}
text={TOKEN_BACKED_ADDRESS.SUI.cake.address}
testId="BackingAddress.SUI"
/>
);
case "ETH":
case "USDC":
case "USDT":
Expand Down
2 changes: 1 addition & 1 deletion src/pages/tokens/index.page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export default function TokensPage({
}

export async function getServerSideProps(
context: GetServerSidePropsContext
context: GetServerSidePropsContext,
): Promise<GetServerSidePropsResult<TokensPageData>> {
const next = CursorPagination.getNext(context);
const items = await getWhaleApiClient(context).tokens.list(20, next);
Expand Down

0 comments on commit 3083236

Please sign in to comment.