diff --git a/constants/wallet.ts b/constants/wallet.ts index 4580b06..63b0b80 100644 --- a/constants/wallet.ts +++ b/constants/wallet.ts @@ -8,6 +8,7 @@ export const WALLET_INSTALL_URL = export const SELECTED_WALLET_KEY = "SELECTED_WALLET_KEY"; export const MINIMUM_VERSION = "0.11.22"; +export const MINIMUM_OSMO_FEE = process.env.MINIMUM_OSMO_FEE ?? "0.5 OSMO"; export type WalletName = "Keplr" | "Cosmostation"; export interface WalletType { diff --git a/pages/complete/index.tsx b/pages/complete/index.tsx index 7bad0d5..14f9224 100644 --- a/pages/complete/index.tsx +++ b/pages/complete/index.tsx @@ -23,9 +23,10 @@ export default function CompletePage() { const [availableAddress, setAvailableAddress] = useState(""); + const [isSuccess, setIsSuccess] = useState(false); + useEffect(() => { const { txHash, twitterUsername } = router.query; - if (txHash && twitterUsername) { initialize(txHash as string, twitterUsername as string); } @@ -37,23 +38,30 @@ export default function CompletePage() { "/websocket", ); - const result: { code?: number } = await txTracer.traceTx( - Buffer.from(txHash, "hex"), - ); + try { + const result: { code?: number } = await txTracer.traceTx( + Buffer.from(txHash, "hex"), + ); - if (result.code || result.code === 0) { - const addresses = await queryAddressesFromTwitterName(twitterUserName); - setRegisteredAddressed(addresses.data.addresses); + if (!result.code || result.code === 0) { + const addresses = await queryAddressesFromTwitterName(twitterUserName); + setRegisteredAddressed(addresses.data.addresses); + setIsSuccess(true); + } + } catch (e) { + console.log("error", e); } }; const onClickShareButton = () => { const { twitterUsername } = router.query; + const shareMessage = `👨‍🚀 To Interchain... And Beyond!%0a%0aHey frens, I just minted my name for the interchain on @icns_xyz: ${twitterUsername}%0a%0aClaim yours now ▶`; + const width = 500; const height = 700; window.open( - `${SHARE_URL}?url=https://www.icns.xyz/&text=${twitterUsername}`, + `${SHARE_URL}?url=https://www.icns.xyz?referral=${twitterUsername}/&text=${shareMessage}`, "Share Twitter", `top=${(window.screen.height - height) / 2}, left=${ (window.screen.width - width) / 2 @@ -67,7 +75,13 @@ export default function CompletePage() { -
Your Name is Active Now!
+ {isSuccess && ( + + )}
diff --git a/pages/index.tsx b/pages/index.tsx index 72b3a8c..469a1b0 100644 --- a/pages/index.tsx +++ b/pages/index.tsx @@ -15,7 +15,7 @@ import MainLogo from "../public/images/svg/main-logo.svg"; import CheckIcon from "../public/images/svg/check-icon.svg"; import { Logo } from "../components/logo"; import { useEffect, useState } from "react"; -import { SELECTED_WALLET_KEY } from "../constants/wallet"; +import { MINIMUM_OSMO_FEE, SELECTED_WALLET_KEY } from "../constants/wallet"; import { replaceToInstallPage } from "../utils/url"; import { REFERRAL_KEY } from "../constants/icns"; @@ -87,8 +87,8 @@ export default function Home() { alt="Check Icon" /> - Osmo  is required for this - transaction + {MINIMUM_OSMO_FEE}  is + required for this transaction