Skip to content

Commit

Permalink
added a bunch of secretswap files among other things
Browse files Browse the repository at this point in the history
  • Loading branch information
dredshep committed Jun 3, 2024
1 parent 200e7b4 commit 8aaaefd
Show file tree
Hide file tree
Showing 53 changed files with 18,526 additions and 37 deletions.
Binary file modified bun.lockb
Binary file not shown.
60 changes: 32 additions & 28 deletions components/site/CoolBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,39 +32,43 @@ function CoolBox({
alt,
}: CoolBoxWithText | CoolBoxWithJSX) {
return (
<div
className={cn(
{
"bg-opacity-10": type === "dark",
"bg-opacity-15": type === "light",
},
"bg-white h-[340px] flex-1 rounded-2xl flex flex-col justify-between items-center"
)}
>
<Image
src={icon}
width={75}
height={75}
alt={typeof mainText === "string" ? mainText : alt!}
className="mt-11 max-h-[65px] max-w-[90px] invert opacity-55 p-2"
/>

<h1 className="text-2xl font-bold px-10 text-center leading-10 mt-7">
{mainText}
</h1>
<p className="text-lg flex-grow leading-8 mt-1 mb-10">{secondaryText}</p>
<Link
href={link}
<div className="bg-[#0C0C20] rounded-2xl h-[340px] flex-1">
<div
className={cn(
{
"bg-adamant-box-buttonDark": type === "dark",
"bg-adamant-box-buttonLight": type === "light",
"bg-opacity-10": type === "dark",
"bg-opacity-15": type === "light",
},
"px-4 py-2 rounded-b-2xl text-base font-bold self-stretch text-center leading-8 text-adamant-accentText"
"bg-white rounded-2xl flex flex-col justify-between items-center"
)}
>
{buttonText}
</Link>
<Image
src={icon}
width={75}
height={75}
alt={typeof mainText === "string" ? mainText : alt!}
className="mt-11 max-h-[65px] max-w-[90px] invert opacity-55 p-2 "
/>

<h1 className="text-2xl font-bold px-10 text-center leading-10 mt-7">
{mainText}
</h1>
<p className="text-lg flex-grow leading-8 mt-1 mb-10">
{secondaryText}
</p>
<Link
href={link}
className={cn(
{
"bg-adamant-box-buttonDark": type === "dark",
"bg-adamant-box-buttonLight": type === "light",
},
"px-4 py-2 rounded-b-2xl text-base font-bold self-stretch text-center leading-8 text-adamant-accentText"
)}
>
{buttonText}
</Link>
</div>
</div>
);
}
Expand Down
5 changes: 3 additions & 2 deletions components/site/InfoBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ function InfoBox({
return (
<div
className={cn(
"border-opacity-50 border rounded-2xl flex flex-col justify-between py-8 px-8 flex-1",
"text-white border-adamant-box-border border-2" // adjust your width and border color here
"border-opacity-50 border rounded-2xl flex flex-col justify-between p-6 sm:p-8 flex-1",
"text-white border-adamant-box-border border-2", // adjust your width and border color here
"min-w-80"
)}
>
<h1 className="text-2xl font-bold leading-8">{title}</h1>
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
"@radix-ui/react-slot": "^1.0.2",
"@radix-ui/react-toast": "^1.1.5",
"@radix-ui/themes": "^2.0.3",
"@shadeprotocol/shadejs": "^1.5.2",
"bignumber.js": "^9.1.2",
"class-variance-authority": "^0.7.0",
"classnames": "^2.5.1",
"clsx": "^2.1.0",
Expand Down
14 changes: 7 additions & 7 deletions pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import Link from "next/link";
const jura = Jura({ subsets: ["latin"] });

const coolBoxes = (
<div className="flex gap-8">
<div className="flex flex-wrap gap-8">
<CoolBox
icon="/icons/coolBox/1.svg" // Replace with your actual icon path
mainText="Exchange tokens without trace"
Expand Down Expand Up @@ -43,7 +43,7 @@ const coolBoxes = (
</div>
);
const infoBoxes = (
<div className="flex gap-4 w-full">
<div className="flex flex-wrap gap-4 w-full">
{" "}
{/* Adjust this gap if necessary */}
<InfoBox
Expand Down Expand Up @@ -87,32 +87,32 @@ export default function Home() {
<div className="flex items-center space-x-11 uppercase text-base font-medium">
<Link
href="#"
className="text-white border-b-2 border-[#8A754A] pb-2 px-2"
className="hidden lg:block text-white border-b-2 border-[#8A754A] pb-2 px-2"
>
Products
</Link>
<Link
href="https://github.com/dredshep/AdamantFiSite"
className="text-white brightness-50 pb-2 px-2"
className="hidden lg:block text-white brightness-50 pb-2 px-2"
>
Developers
</Link>
<Link
href="https://forum.scrt.network/"
className="text-white brightness-50 pb-2 px-2"
className="hidden lg:block text-white brightness-50 pb-2 px-2"
>
Governance
</Link>
<Link
href="/app"
className="text-black uppercase bg-white px-4 py-2 rounded-lg text-base font-bold"
>
Launch App
Launch <span className="hidden sm:inline-block">App</span>
</Link>
</div>
</div>
{/* container div simply setting max width and perhaps other settings for content only */}
<div className="max-w-[1176px] mx-auto">
<div className="max-w-[1176px] mx-auto px-10">
<div className="mt-32">
<div className="flex flex-col items-center gap-6">
<div className="text-4xl font-bold tracking-wider">
Expand Down
10 changes: 10 additions & 0 deletions tailwind.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,16 @@ const config = {
},
},
extend: {
screens: {
xs: "375px",
sm: "640px",
md: "768px",
lg: "1024px",
xl: "1280px",
"2xl": "1440px",
"3xl": "1920px",
"4xl": "2560px",
},
backgroundImage: {
"tubeshapes-dark": "url('/images/Adamant-bg-dark.png')",
"tubeshapes-light": "url('/images/Adamant-bg-light.png')",
Expand Down
121 changes: 121 additions & 0 deletions utils/secretjs/SecretSwapSite/Swap/utils.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
import BigNumber from "bignumber.js";
// import { UserStoreEx } from 'stores/UserStore';
// import React from 'react';
// import Style from 'style-it';
import { humanizeBalance } from "@/utils/secretjs/SecretSwapSite/utils";
import { ExecuteResult } from "secretjs";

// export const ERROR_WRONG_VIEWING_KEY = 'Viewing Key Error';

// export async function getNativeBalance(walletAddress: string, secretjs: CosmWasmClient) {
// return secretjs.getAccount(walletAddress).then(account => {
// try {
// const scrt_account = account.balance.find((acc) => acc.denom === 'uscrt');
// return new BigNumber(scrt_account.amount);
// } catch (error) {
// return new BigNumber(0);
// }
// });
// }

// export const unlockJsx = (props: { onClick: any }) =>
// Style.it(
// `.view-token-button {
// cursor: pointer;
// border-radius: 30px;
// padding: 0 0.25rem;
// margin: 0;
// border: none;
// }

// .view-token-button:hover {
// background: #cb9b5150;
// }`,
// <span role="img" aria-label={'view'} className="view-token-button" onClick={props.onClick}>
// 🔍 View Balance
// </span>,
// );

// export const wrongViewingKey = <strong style={{ color: 'red' }}>Wrong Viewing Key</strong>;

// export async function getTokenBalance(
// walletAddress: string,
// tokenAddress: string,
// viewingKey: string,
// userStore: UserStoreEx,
// ): Promise<BigNumber | JSX.Element> {
// if (!viewingKey) {
// return unlockJsx({
// onClick: async e => {
// await userStore.keplrWallet.suggestToken(userStore.chainId, tokenAddress);
// // TODO trigger balance refresh if this was an "advanced set" that didn't
// // result in an on-chain transaction
// await userStore.updateScrtBalance();
// },
// });
// }

// // todo: replace this with the function from blockchain-bridge/scrt/snip20
// const result = await userStore.secretjs.queryContractSmart(tokenAddress, {
// balance: {
// address: walletAddress,
// key: viewingKey,
// },
// });

// if (viewingKey && 'viewing_key_error' in result) {
// // TODO handle this
// return (
// <strong
// style={{
// marginLeft: '0.2em',
// color: 'red',
// }}
// >
// {ERROR_WRONG_VIEWING_KEY}
// </strong>
// );
// }

// try {
// return new BigNumber(result.balance.amount);
// } catch (error) {
// console.log(
// `Got an error while trying to query token ${tokenAddress} balance for address ${walletAddress}:`,
// result,
// error,
// );
// return unlockJsx({
// onClick: async e => {
// await userStore.keplrWallet.suggestToken(userStore.chainId, tokenAddress);
// // TODO trigger balance refresh if this was an "advanced set" that didn't
// // result in an on-chain transaction
// },
// });
// }
// }

export function compareNormalize(
number1: BigNumber.Value,
number2: { amount: BigNumber.Value; decimals: number }
): boolean {
return humanizeBalance(
new BigNumber(number2.amount as any),
number2.decimals
).isLessThan(new BigNumber(number1));
}

export function storeTxResultLocally(txResult: ExecuteResult) {
if (!localStorage || !localStorage.setItem || !txResult.transactionHash) {
return;
}
const result = {
data: new TextDecoder().decode(txResult.data),
logs: txResult.logs,
};
localStorage.setItem(txResult.transactionHash, JSON.stringify(result));
}

export const shareOfPoolNumberFormat = new Intl.NumberFormat("en", {
maximumFractionDigits: 10,
});
Loading

0 comments on commit 8aaaefd

Please sign in to comment.