Skip to content

Commit

Permalink
feat(krc20): update-mint-process (#42)
Browse files Browse the repository at this point in the history
Co-authored-by: Paul Chen <p22626262@gmail.com>
  • Loading branch information
0x7u and dadamu authored Mar 6, 2025
1 parent ca5477a commit 6dab957
Show file tree
Hide file tree
Showing 40 changed files with 1,827 additions and 526 deletions.
4 changes: 2 additions & 2 deletions api/browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import {
} from "@/api/message";
import {
PaymentOutput,
TxSettingOptions,
ScriptOption,
} from "@/lib/wallet/interface";
TxSettingOptions,
} from "@/lib/wallet/wallet-interface.ts";
import { NetworkType } from "@/contexts/SettingsContext.tsx";

export class KastleBrowserAPI {
Expand Down
4 changes: 2 additions & 2 deletions api/message.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Buffer } from "buffer";
import {
PaymentOutput,
TxSettingOptions,
ScriptOption,
} from "@/lib/wallet/interface.ts";
TxSettingOptions,
} from "@/lib/wallet/wallet-interface.ts";
import { NetworkType } from "@/contexts/SettingsContext.tsx";

export enum Action {
Expand Down
1 change: 1 addition & 0 deletions components/recent-addresses/RecentAddressItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { walletAddressEllipsis } from "@/lib/utils.ts";
import React, { useState } from "react";
import { RecentAddress } from "@/contexts/RecentAddressesContext.tsx";
import { Tooltip } from "react-tooltip";
import { useKns } from "@/hooks/useKns";

export default function RecentAddressItem({
recentAddress,
Expand Down
74 changes: 26 additions & 48 deletions components/screens/Dashboard.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React, { useState } from "react";
import { useNavigate } from "react-router-dom";
import { SideMenu } from "@/components/side-menu/SideMenu.tsx";
import { explorerAddressLinks } from "@/components/screens/Settings.tsx";
import kasIcon from "@/assets/images/kas-icon.svg";
import gavelIcon from "@/assets/images/gavel.svg";
import { formatToken, formatTokenPrice, formatUSD } from "@/lib/utils.ts";
Expand Down Expand Up @@ -50,7 +49,6 @@ export default function Dashboard() {
}));

const network = networkId ?? NetworkType.Mainnet;
const explorerAddressLink = explorerAddressLinks[network];
const isMainnet = network === NetworkType.Mainnet;

const totalBalance = balance
Expand Down Expand Up @@ -188,54 +186,34 @@ export default function Dashboard() {
<span className="text-daintree-400">Receive</span>
</div>

{settings?.preview ? (
<>
<div
className="flex cursor-pointer flex-col items-center gap-2"
onClick={() => {
const url = new URL(browser.runtime.getURL("/popup.html"));
url.hash = `/deploy-token`;
<div
className="flex cursor-pointer flex-col items-center gap-2"
onClick={() => {
const url = new URL(browser.runtime.getURL("/popup.html"));
url.hash = `/deploy-token`;

browser.tabs.create({ url: url.toString() });
}}
>
<div className="flex h-[46px] w-[46px] items-center justify-center rounded-full bg-white/10">
<i className="hn hn-pencil text-[20px] text-white"></i>
</div>
<span className="text-daintree-400">Deploy</span>
</div>
<div
className="flex cursor-pointer flex-col items-center gap-2"
onClick={() => {
const url = new URL(browser.runtime.getURL("/popup.html"));
url.hash = `/mint-token`;
browser.tabs.create({ url: url.toString() });
}}
>
<div className="flex h-[46px] w-[46px] items-center justify-center rounded-full bg-white/10">
<i className="hn hn-pencil text-[20px] text-white"></i>
</div>
<span className="text-daintree-400">Deploy</span>
</div>
<div
className="flex cursor-pointer flex-col items-center gap-2"
onClick={() => {
const url = new URL(browser.runtime.getURL("/popup.html"));
url.hash = `/mint-token`;

browser.tabs.create({ url: url.toString() });
}}
>
<div className="flex h-[46px] w-[46px] items-center justify-center rounded-full bg-white/10">
<img
alt="castle"
className="h-[24px] w-[24px]"
src={gavelIcon}
/>
</div>
<span className="text-daintree-400">Mint</span>
</div>
</>
) : (
<a
className="flex cursor-pointer flex-col items-center gap-2"
href={`${explorerAddressLink}${address}`}
target="_blank"
rel="noopener noreferrer"
>
<div className="flex h-[46px] w-[46px] items-center justify-center rounded-full bg-white/10">
<i className="hn hn-external-link text-[20px] text-white"></i>
</div>
<span className="text-daintree-400">Explorer</span>
</a>
)}
browser.tabs.create({ url: url.toString() });
}}
>
<div className="flex h-[46px] w-[46px] items-center justify-center rounded-full bg-white/10">
<img alt="castle" className="h-[24px] w-[24px]" src={gavelIcon} />
</div>
<span className="text-daintree-400">Mint</span>
</div>
</div>

{/* Share Card */}
Expand Down
12 changes: 8 additions & 4 deletions components/screens/DevMode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,26 @@ export default function DevMode() {

return (
<div className="flex h-full flex-col gap-4 p-6">
<Header title="Dev mode" onClose={() => navigate("/dashboard")} />
<Header
title="Experimental features"
onClose={() => navigate("/dashboard")}
/>
<div
className="flex flex-col gap-2 rounded-xl border border-[#7F1D1D] bg-[#381825] p-4 text-base"
role="alert"
>
<div className="flex items-center justify-between">
<span className="font-semibold text-daintree-200">
Dev mode will enable experimental features. Features that may not be
completed nor stable. Only activate if you know what you are doing.
Experimental features will enable experimental features. Features
that may not be completed nor stable. Only activate if you know what
you are doing.
</span>
</div>
</div>

<div className="flex cursor-pointer items-center justify-between rounded-xl border border-gray-700 bg-slate-800 p-5">
<div className="flex items-center justify-start gap-4 text-base font-semibold">
<span className="font-semibold">Dev mode</span>
<span className="font-semibold">Experimental features</span>
</div>
<div className="flex items-center text-base">
<input
Expand Down
4 changes: 2 additions & 2 deletions components/screens/Settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,9 @@ export default function Settings() {
}}
/>

{/* Dev mode */}
{/* Experimental features */}
<SettingItem
title="Dev mode"
title="Experimental features"
showChevron
onClick={() => navigate("/dev-mode")}
/>
Expand Down
5 changes: 5 additions & 0 deletions components/screens/TokenAsset.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,17 @@ import { twMerge } from "tailwind-merge";
import React, { useState } from "react";
import TokenHistory from "@/components/token-asset/TokenHistory.tsx";
import TokenInfo from "@/components/token-asset/TokenInfo.tsx";
import { setPopupPath } from "@/lib/utils.ts";

export default function TokenAsset() {
const navigate = useNavigate();
const { ticker } = useParams();
const [activeTab, setActiveTab] = useState<"history" | "info">("history");

useEffect(() => {
setPopupPath();
}, []);

return (
<div className="no-scrollbar flex h-full flex-col overflow-y-scroll px-4 py-6">
<Header
Expand Down
152 changes: 0 additions & 152 deletions components/screens/TokenOperation.tsx

This file was deleted.

Loading

0 comments on commit 6dab957

Please sign in to comment.