-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c9533bf
commit 1f00a4b
Showing
5 changed files
with
156 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import { Button } from "@/components/ui/button"; | ||
import { | ||
Card, | ||
CardContent, | ||
CardDescription, | ||
CardFooter, | ||
CardHeader, | ||
} from "@/components/ui/card"; | ||
import Link from "next/link"; | ||
|
||
interface SuccessPageData { | ||
contractName: string; | ||
contractPage: string; | ||
txnHashUrl: string; | ||
} | ||
|
||
export function SuccessPage({ data }: { data: SuccessPageData }): JSX.Element { | ||
const { contractPage, contractName, txnHashUrl } = data; | ||
|
||
return ( | ||
<Card className="w-[350px]"> | ||
<CardHeader> | ||
<CardDescription> | ||
Success you just deployed a smart contract! | ||
</CardDescription> | ||
</CardHeader> | ||
|
||
<CardContent className="text-center"> | ||
<p className="font-bold">{contractName}</p> | ||
<Link href="/"> | ||
<Button variant={"link"}>Deploy New Contract</Button> | ||
</Link> | ||
</CardContent> | ||
|
||
<CardFooter className="flex gap-4"> | ||
<Link target="_blank" href={txnHashUrl}> | ||
<Button variant={"secondary"} className="text-xs"> | ||
View Transaction | ||
</Button> | ||
</Link> | ||
<Link target="_blank" href={contractPage}> | ||
<Button className="text-xs">View Store on Mintbase</Button> | ||
</Link> | ||
</CardFooter> | ||
</Card> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,21 @@ | ||
import { Network } from "@mintbase-js/sdk"; | ||
|
||
export const MintbaseWalletSetup = { | ||
contractAddress: "test122212.mintspace2.testnet", | ||
network: "testnet", | ||
}; | ||
}; | ||
|
||
export const network = MintbaseWalletSetup.network as Network; | ||
|
||
const isTestnet = MintbaseWalletSetup.network === "testnet"; | ||
|
||
export const nearblocksApi = !isTestnet | ||
? "https://api.nearblocks.io" | ||
: "https://api-testnet.nearblocks.io"; | ||
|
||
export const mbUrl = !isTestnet | ||
? "https://www.mintbase.xyz" | ||
: "https://testnet.mintbase.xyz"; | ||
export const nearblocksUrl = !isTestnet | ||
? "https://nearblocks.io" | ||
: "https://testnet.nearblocks.io"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,26 @@ | ||
"use client"; | ||
|
||
import { type ClassValue, clsx } from "clsx" | ||
import { twMerge } from "tailwind-merge" | ||
|
||
import { nearblocksApi } from "@/config/setup"; | ||
import { CallBackArgs } from "@mintbase-js/sdk"; | ||
import { clsx, type ClassValue } from "clsx"; | ||
import { twMerge } from "tailwind-merge"; | ||
|
||
export function cn(...inputs: ClassValue[]) { | ||
return twMerge(clsx(inputs)) | ||
return twMerge(clsx(inputs)); | ||
} | ||
|
||
export const getTxnHash = async (hash: string) => { | ||
const res = await fetch(`${nearblocksApi}/v1/search/?keyword=${hash}`); | ||
|
||
const txn = await res.json(); | ||
|
||
return txn?.receipts[0].originated_from_transaction_hash; | ||
}; | ||
|
||
export const callbackUrl = (cbArgs: CallBackArgs) => | ||
`${window.location.origin}/?signMeta=${encodeURIComponent( | ||
JSON.stringify({ | ||
type: cbArgs.type, | ||
args: cbArgs.args, | ||
}) | ||
)}`; |