@@ -37,5 +34,3 @@ export default function Home() {
>
);
}
-
-
diff --git a/simple-token-drop/src/app/serverMint.ts b/simple-token-drop/src/app/serverMint.ts
index 4c989b9..b1e6cfe 100644
--- a/simple-token-drop/src/app/serverMint.ts
+++ b/simple-token-drop/src/app/serverMint.ts
@@ -1,72 +1,90 @@
-'use server'
+"use server";
import { Account, KeyPair, InMemorySigner } from "near-api-js";
import { InMemoryKeyStore } from "near-api-js/lib/key_stores";
-import { FinalExecutionOutcome, JsonRpcProvider } from "near-api-js/lib/providers";
+import {
+ FinalExecutionOutcome,
+ JsonRpcProvider,
+} from "near-api-js/lib/providers";
import BN from "bn.js";
-import { MintArgsResponse, NearContractCall, execute, mint } from "@mintbase-js/sdk"
-import { redirect } from 'next/navigation'
-import { NETWORK, SERVER_WALLET_ID, SERVER_WALLET_PK, WALLET_AUTO_IMPORT_URL, NFT_CONTRACT, MEDIA_URL, REFERENCE_URL } from "./constants";
-
+import { NearContractCall, execute, mint } from "@mintbase-js/sdk";
+import { MintArgsV1Response } from "@mintbase-js/sdk";
+import { redirect } from "next/navigation";
+import {
+ NETWORK,
+ SERVER_WALLET_ID,
+ SERVER_WALLET_PK,
+ WALLET_AUTO_IMPORT_URL,
+ NFT_CONTRACT,
+ MEDIA_URL,
+ REFERENCE_URL,
+} from "./constants";
export const serverMint = async (): Promise
=> {
-
- console.info("Server Action: Server Mint Called")
- //Create a new keypair, instantiate server wallet and create account with generated keypair
- const accountId = [...Array(7)].map(() => Math.random().toString(36)[2]).join('') + `.${SERVER_WALLET_ID}`;
- const newKeyPair = KeyPair.fromRandom('ed25519')
- const serverWallet: Account = await connect();
-
- await serverWallet.createAccount(accountId, newKeyPair.getPublicKey().toString(), new BN("0"))
-
- console.info("Server Action: Wallet created with account id: ", accountId)
- const mintArgs = await serverMintArgs(accountId)
- //Execute mint with server wallet
- await execute({ account: serverWallet }, mintArgs) as FinalExecutionOutcome
-
- console.info("Server Action: Executed mint with", mintArgs)
+ console.info("Server Action: Server Mint Called");
+ //Create a new keypair, instantiate server wallet and create account with generated keypair
+ const accountId =
+ [...Array(7)].map(() => Math.random().toString(36)[2]).join("") +
+ `.${SERVER_WALLET_ID}`;
+ const newKeyPair = KeyPair.fromRandom("ed25519");
+ const serverWallet: Account = await connect();
- //@ts-ignore
- redirect(`${WALLET_AUTO_IMPORT_URL}${accountId}/${newKeyPair.secretKey}`)
+ await serverWallet.createAccount(
+ accountId,
+ newKeyPair.getPublicKey().toString(),
+ new BN("0")
+ );
-}
+ console.info("Server Action: Wallet created with account id: ", accountId);
+ const mintArgs = await serverMintArgs(accountId);
+ //Execute mint with server wallet
+ (await execute({ account: serverWallet }, mintArgs)) as FinalExecutionOutcome;
+ console.info("Server Action: Executed mint with", mintArgs);
-export const connect = async (
-): Promise => {
- if (!SERVER_WALLET_ID || !SERVER_WALLET_PK) {
- throw ("SERVER_WALLET_ID or SERVER_WALLET_PK not defined in envs")
+ //@ts-ignore
+ redirect(`${WALLET_AUTO_IMPORT_URL}${accountId}/${newKeyPair.secretKey}`);
+};
- }
- const keyStore = new InMemoryKeyStore();
- await keyStore.setKey(NETWORK, SERVER_WALLET_ID, KeyPair.fromString(SERVER_WALLET_PK));
+export const connect = async (): Promise => {
+ if (!SERVER_WALLET_ID || !SERVER_WALLET_PK) {
+ throw "SERVER_WALLET_ID or SERVER_WALLET_PK not defined in envs";
+ }
+ const keyStore = new InMemoryKeyStore();
+ await keyStore.setKey(
+ NETWORK,
+ SERVER_WALLET_ID,
+ KeyPair.fromString(SERVER_WALLET_PK)
+ );
- const provider = new JsonRpcProvider({
- url: `https://rpc.${NETWORK}.near.org`,
- });
+ const provider = new JsonRpcProvider({
+ url: `https://rpc.${NETWORK}.near.org`,
+ });
- const signer = new InMemorySigner(keyStore);
+ const signer = new InMemorySigner(keyStore);
- const account = new Account(
- {
- networkId: NETWORK,
- provider,
- signer,
- jsvmAccountId: "",
- },
- SERVER_WALLET_ID
- );
+ const account = new Account(
+ {
+ networkId: NETWORK,
+ provider,
+ signer,
+ jsvmAccountId: "",
+ },
+ SERVER_WALLET_ID
+ );
- return account;
+ return account;
};
-export const serverMintArgs = (accountId: string): NearContractCall => {
- return mint({
- contractAddress: NFT_CONTRACT,
- ownerId: accountId,
- metadata: {
- media: MEDIA_URL,
- reference: REFERENCE_URL
- }
- })
-}
+export const serverMintArgs = (
+ accountId: string
+): NearContractCall => {
+ return mint({
+ contractAddress: NFT_CONTRACT,
+ ownerId: accountId,
+ metadata: {
+ media: MEDIA_URL,
+ reference: REFERENCE_URL,
+ },
+ });
+};
diff --git a/simple-token-drop/src/components/Social.tsx b/simple-token-drop/src/components/Social.tsx
index cc1ca31..de55c48 100644
--- a/simple-token-drop/src/components/Social.tsx
+++ b/simple-token-drop/src/components/Social.tsx
@@ -15,8 +15,8 @@ import {
} from "react-share";
export const SocialMedias = () => {
- const url = 'https://token-drop-template.mintbase.xyz/';
- const title = "Mintbase Templates - Token Drop";
+ const url = "https://token-drop-template.mintbase.xyz/";
+ const title = "Bitte Templates - Token Drop";
return (