Skip to content

Commit

Permalink
Deploy preview for PR 18 🛫
Browse files Browse the repository at this point in the history
  • Loading branch information
Nazeeh21 committed Nov 22, 2024
1 parent d2882d7 commit 85110e3
Show file tree
Hide file tree
Showing 45 changed files with 74,528 additions and 29,310 deletions.

Large diffs are not rendered by default.

3,481 changes: 3,481 additions & 0 deletions pr-preview/pr-18/airdrop/assets/Text-BUUD0p9X.js

Large diffs are not rendered by default.

116 changes: 0 additions & 116 deletions pr-preview/pr-18/airdrop/assets/Text-DcZ5ZG-Q.js

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { A as or, D as useMutation, F as _t, z as useQuery, a8 as Provider, a9 as NODE_URL, c as createLazyFileRoute, j as jsxRuntimeExports, aa as useParams, r as reactExports, g as getTruncatedAddress, a7 as DateTime } from "./index-OViWMWHH.js";
import { d as TestContract, B as Button, a as createMerkleTree, g as generateProof } from "./button-Bb_5GoL0.js";
import { T as Text } from "./Text-DcZ5ZG-Q.js";
import { X as or, Y as useMutation, Z as _t, i as useQuery, P as Provider, N as NODE_URL, c as createLazyFileRoute, j as jsxRuntimeExports, a4 as useParams, r as reactExports, V as Button, g as getTruncatedAddress, a1 as IconCopy, a2 as copyToClipboard, a3 as DateTime } from "./index-CUJp9d5D.js";
import { a as TestContract, u as useInitializeAirdrop, c as createMerkleTree, g as generateProof } from "./useInitializeAirdrop-CG8cXfI3.js";
import { T as Text } from "./Text-BUUD0p9X.js";
import { c as checkEligibility } from "./airdropEligibility-DNVH7hhj.js";
function formatUnits(value, decimals) {
let display = value.toString();
Expand Down Expand Up @@ -155,28 +155,6 @@ const useGetIsInitialized = ({ contractId }) => {
});
return query;
};
const useInitializeAirdrop = () => {
const { wallet } = or();
const mutation = useMutation({
mutationFn: async ({ contractId }) => {
if (!wallet) {
throw new Error("Wallet not connected!");
}
const contract = new TestContract(contractId, wallet);
const result = await contract.functions.initialize().call();
return result;
},
onSuccess: (data) => {
console.log("onSuccess useInitializeAirdrop", data);
_t.success("Airdrop initialized successfully!");
},
onError: (err) => {
console.error("Error initializing airdrop:", err);
_t.error(err.message);
}
});
return mutation;
};
const Route = createLazyFileRoute("/airdrop/claim/$slug")({
// validateSearch: z.array(z.object({ address: z.string(), amount: z.string() })),
component: () => /* @__PURE__ */ jsxRuntimeExports.jsx(ClaimAirdrop, {})
Expand All @@ -197,7 +175,7 @@ function ClaimAirdrop() {
const { data: merkleRoot } = useGetMerkleRoot({ contractId });
const { data: numLeaves } = useGetNumLeaves({ contractId });
const { mutate: initialize, data: initializeData } = useInitializeAirdrop();
useGetIsInitialized({ contractId });
const { data: isInitialized, isFetching: fetchingIsInitialized } = useGetIsInitialized({ contractId });
reactExports.useEffect(() => {
console.log({ wallet });
if (recipients && wallet) {
Expand Down Expand Up @@ -239,25 +217,55 @@ function ClaimAirdrop() {
};
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "w-full text-center flex flex-col justify-center", children: [
/* @__PURE__ */ jsxRuntimeExports.jsx(Text, { variant: "h4", sx: { paddingBottom: "28px", textAlign: "center" }, children: "Claim Airdrop" }),
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "py-8", children: !wallet ? /* @__PURE__ */ jsxRuntimeExports.jsx(Text, { variant: "h5", children: "Please connect your wallet to check eligibility and to claim the airdrop" }) : !possibleRecipient ? /* @__PURE__ */ jsxRuntimeExports.jsx(Text, { variant: "h5", children: "You are not eligible for the airdrop" }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
/* @__PURE__ */ jsxRuntimeExports.jsxs(Text, { textAlign: "center", children: [
"Your Allocations:",
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "py-8 ", children: [
/* @__PURE__ */ jsxRuntimeExports.jsxs(Text, { className: " py-2", children: [
" ",
"Contract Initialized:",
" ",
Number(formatUnits(possibleRecipient.amount, 9))
fetchingIsInitialized ? "Fetching..." : (isInitialized == null ? void 0 : isInitialized.toString()) ? "Yes" : "No"
] }),
/* @__PURE__ */ jsxRuntimeExports.jsx(
!fetchingIsInitialized && !(isInitialized == null ? void 0 : isInitialized.toString()) && !!wallet && /* @__PURE__ */ jsxRuntimeExports.jsx(
Button,
{
onClick: claimHandler,
className: "my-8 mx-auto text-center",
children: "Claim Airdrop"
onClick: () => {
initialize({ contractId });
},
children: "Initialize Airdrop"
}
)
] }) }),
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-3", children: [
/* @__PURE__ */ jsxRuntimeExports.jsxs(Text, { textAlign: "center", children: [
"Contract Owner: ",
getTruncatedAddress(((_a = owner == null ? void 0 : owner.Address) == null ? void 0 : _a.bits) ?? "")
),
!wallet ? /* @__PURE__ */ jsxRuntimeExports.jsx(Text, { variant: "h5", children: "Please connect your wallet to check eligibility and to claim the airdrop" }) : !possibleRecipient ? /* @__PURE__ */ jsxRuntimeExports.jsx(Text, { variant: "h5", children: "You are not eligible for the airdrop" }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
/* @__PURE__ */ jsxRuntimeExports.jsxs(Text, { textAlign: "center", children: [
"Your Allocations:",
" ",
Number(formatUnits(possibleRecipient.amount, 9))
] }),
/* @__PURE__ */ jsxRuntimeExports.jsx(
Button,
{
onClick: claimHandler,
className: "my-8 mx-auto text-center",
children: "Claim Airdrop"
}
)
] })
] }),
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center flex-col gap-3", children: [
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
/* @__PURE__ */ jsxRuntimeExports.jsxs(Text, { textAlign: "center", children: [
"Contract Owner: ",
getTruncatedAddress(((_a = owner == null ? void 0 : owner.Address) == null ? void 0 : _a.bits) ?? "")
] }),
/* @__PURE__ */ jsxRuntimeExports.jsx(
IconCopy,
{
className: "text-[#dddddd] cursor-pointer h-5 hover:opacity-80 active:scale-[90%]",
onClick: () => {
var _a2;
return copyToClipboard((_a2 = owner == null ? void 0 : owner.Address) == null ? void 0 : _a2.bits);
}
}
)
] }),
/* @__PURE__ */ jsxRuntimeExports.jsxs(Text, { textAlign: "center", children: [
"End time:",
Expand All @@ -268,25 +276,24 @@ function ClaimAirdrop() {
"Paused: ",
isPaused == null ? void 0 : isPaused.toString()
] }),
/* @__PURE__ */ jsxRuntimeExports.jsxs(Text, { textAlign: "center", children: [
"Merkle Root: ",
merkleRoot == null ? void 0 : merkleRoot.toString()
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2 ", children: [
/* @__PURE__ */ jsxRuntimeExports.jsxs(Text, { textAlign: "center", children: [
"Merkle Root: ",
getTruncatedAddress((merkleRoot == null ? void 0 : merkleRoot.toString()) ?? "")
] }),
/* @__PURE__ */ jsxRuntimeExports.jsx(
IconCopy,
{
className: "text-[#dddddd] cursor-pointer h-5 hover:opacity-80 active:scale-[90%]",
onClick: () => copyToClipboard((merkleRoot == null ? void 0 : merkleRoot.toString()) ?? "")
}
)
] }),
/* @__PURE__ */ jsxRuntimeExports.jsxs(Text, { textAlign: "center", children: [
"Number of Leaves: ",
numLeaves == null ? void 0 : numLeaves.toString()
] })
] }),
/* @__PURE__ */ jsxRuntimeExports.jsx(
Button,
{
className: "my-8 mx-auto text-center",
onClick: () => {
initialize({ contractId });
},
children: "Initialize Airdrop"
}
)
] })
] });
}
export {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { bU as isAddress, bV as InvalidAddressError, bW as BaseError, bX as getUrl, bY as stringify, bZ as decodeErrorResult, b_ as call, b$ as concat, c0 as encodeAbiParameters, c1 as HttpRequestError, c2 as isHex } from "./index-OViWMWHH.js";
import { cM as isAddress, cN as InvalidAddressError, cO as BaseError, cP as getUrl, cQ as stringify, cR as decodeErrorResult, cS as call, cT as concat, cU as encodeAbiParameters, cV as HttpRequestError, cW as isHex } from "./index-CUJp9d5D.js";
function isAddressEqual(a, b) {
if (!isAddress(a, { strict: false }))
throw new InvalidAddressError({ address: a });
Expand Down
Loading

0 comments on commit 85110e3

Please sign in to comment.