diff --git a/CHANGELOG.md b/CHANGELOG.md index 595178b5..a8ca737c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,9 @@ All notable changes to the create-aptos-dapp tool will be captured in this file. # Unreleased - Code cleanup, always use env var from constants +- Rename `collection_id` to `collection_address` in the NFT minting template +- Move `collection_address` and `fa_address` from `config.ts` to the `.env` file in the minting templates +- Support devnet for token minting template, nft minting is not supported on devnet because it depends on token-minter contract which is not deployed on devnet # 0.0.23 (2024-08-21) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 298cf3e6..797cf584 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1,122 +1,178 @@ -lockfileVersion: '6.0' +lockfileVersion: '9.0' settings: autoInstallPeers: true excludeLinksFromLockfile: false -dependencies: - commander: - specifier: ^12.1.0 - version: 12.1.0 - kolorist: - specifier: ^1.8.0 - version: 1.8.0 - ora: - specifier: ^8.0.1 - version: 8.0.1 - prompts: - specifier: ^2.4.2 - version: 2.4.2 - typescript: - specifier: ^4.7.4 - version: 4.9.5 - -devDependencies: - '@types/node': - specifier: ^20.5.0 - version: 20.14.2 +importers: + + .: + dependencies: + commander: + specifier: ^12.1.0 + version: 12.1.0 + kolorist: + specifier: ^1.8.0 + version: 1.8.0 + ora: + specifier: ^8.0.1 + version: 8.0.1 + prompts: + specifier: ^2.4.2 + version: 2.4.2 + typescript: + specifier: ^4.7.4 + version: 4.9.5 + devDependencies: + '@types/node': + specifier: ^20.5.0 + version: 20.14.2 packages: - /@types/node@20.14.2: + '@types/node@20.14.2': resolution: {integrity: sha512-xyu6WAMVwv6AKFLB+e/7ySZVr/0zLCzOa7rSpq6jNwpqOrUbcACDWC+53d4n2QHOnDou0fbIsg8wZu/sxrnI4Q==} - dependencies: - undici-types: 5.26.5 - dev: true - /ansi-regex@6.0.1: + ansi-regex@6.0.1: resolution: {integrity: sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==} engines: {node: '>=12'} - dev: false - /chalk@5.3.0: + chalk@5.3.0: resolution: {integrity: sha512-dLitG79d+GV1Nb/VYcCDFivJeK1hiukt9QjRNVOsUtTy1rR1YJsmpGGTZ3qJos+uw7WmWF4wUwBd9jxjocFC2w==} engines: {node: ^12.17.0 || ^14.13 || >=16.0.0} - dev: false - /cli-cursor@4.0.0: + cli-cursor@4.0.0: resolution: {integrity: sha512-VGtlMu3x/4DOtIUwEkRezxUZ2lBacNJCHash0N0WeZDBS+7Ux1dm3XWAgWYxLJFMMdOeXMHXorshEFhbMSGelg==} engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} - dependencies: - restore-cursor: 4.0.0 - dev: false - /cli-spinners@2.9.2: + cli-spinners@2.9.2: resolution: {integrity: sha512-ywqV+5MmyL4E7ybXgKys4DugZbX0FC6LnwrhjuykIjnK9k8OQacQ7axGKnjDXWNhns0xot3bZI5h55H8yo9cJg==} engines: {node: '>=6'} - dev: false - /commander@12.1.0: + commander@12.1.0: resolution: {integrity: sha512-Vw8qHK3bZM9y/P10u3Vib8o/DdkvA2OtPtZvD871QKjy74Wj1WSKFILMPRPSdUSx5RFK1arlJzEtA4PkFgnbuA==} engines: {node: '>=18'} - dev: false - /emoji-regex@10.3.0: + emoji-regex@10.3.0: resolution: {integrity: sha512-QpLs9D9v9kArv4lfDEgg1X/gN5XLnf/A6l9cs8SPZLRZR3ZkY9+kwIQTxm+fsSej5UMYGE8fdoaZVIBlqG0XTw==} - dev: false - /get-east-asian-width@1.2.0: + get-east-asian-width@1.2.0: resolution: {integrity: sha512-2nk+7SIVb14QrgXFHcm84tD4bKQz0RxPuMT8Ag5KPOq7J5fEmAg0UbXdTOSHqNuHSU28k55qnceesxXRZGzKWA==} engines: {node: '>=18'} - dev: false - /is-interactive@2.0.0: + is-interactive@2.0.0: resolution: {integrity: sha512-qP1vozQRI+BMOPcjFzrjXuQvdak2pHNUMZoeG2eRbiSqyvbEf/wQtEOTOX1guk6E3t36RkaqiSt8A/6YElNxLQ==} engines: {node: '>=12'} - dev: false - /is-unicode-supported@1.3.0: + is-unicode-supported@1.3.0: resolution: {integrity: sha512-43r2mRvz+8JRIKnWJ+3j8JtjRKZ6GmjzfaE/qiBJnikNnYv/6bagRJ1kUhNk8R5EX/GkobD+r+sfxCPJsiKBLQ==} engines: {node: '>=12'} - dev: false - /is-unicode-supported@2.0.0: + is-unicode-supported@2.0.0: resolution: {integrity: sha512-FRdAyx5lusK1iHG0TWpVtk9+1i+GjrzRffhDg4ovQ7mcidMQ6mj+MhKPmvh7Xwyv5gIS06ns49CA7Sqg7lC22Q==} engines: {node: '>=18'} - dev: false - /kleur@3.0.3: + kleur@3.0.3: resolution: {integrity: sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==} engines: {node: '>=6'} - dev: false - /kolorist@1.8.0: + kolorist@1.8.0: resolution: {integrity: sha512-Y+60/zizpJ3HRH8DCss+q95yr6145JXZo46OTpFvDZWLfRCE4qChOyk1b26nMaNpfHHgxagk9dXT5OP0Tfe+dQ==} - dev: false - /log-symbols@6.0.0: + log-symbols@6.0.0: resolution: {integrity: sha512-i24m8rpwhmPIS4zscNzK6MSEhk0DUWa/8iYQWxhffV8jkI4Phvs3F+quL5xvS0gdQR0FyTCMMH33Y78dDTzzIw==} engines: {node: '>=18'} - dependencies: - chalk: 5.3.0 - is-unicode-supported: 1.3.0 - dev: false - /mimic-fn@2.1.0: + mimic-fn@2.1.0: resolution: {integrity: sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==} engines: {node: '>=6'} - dev: false - /onetime@5.1.2: + onetime@5.1.2: resolution: {integrity: sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==} engines: {node: '>=6'} - dependencies: - mimic-fn: 2.1.0 - dev: false - /ora@8.0.1: + ora@8.0.1: resolution: {integrity: sha512-ANIvzobt1rls2BDny5fWZ3ZVKyD6nscLvfFRpQgfWsythlcsVUC9kL0zq6j2Z5z9wwp1kd7wpsD/T9qNPVLCaQ==} engines: {node: '>=18'} + + prompts@2.4.2: + resolution: {integrity: sha512-NxNv/kLguCA7p3jE8oL2aEBsrJWgAakBpgmgK6lpPWV+WuOmY6r2/zbAVnP+T8bQlA0nzHXSJSJW0Hq7ylaD2Q==} + engines: {node: '>= 6'} + + restore-cursor@4.0.0: + resolution: {integrity: sha512-I9fPXU9geO9bHOt9pHHOhOkYerIMsmVaWB0rA2AI9ERh/+x/i7MV5HKBNrg+ljO5eoPVgCcnFuRjJ9uH6I/3eg==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + + signal-exit@3.0.7: + resolution: {integrity: sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==} + + sisteransi@1.0.5: + resolution: {integrity: sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==} + + stdin-discarder@0.2.2: + resolution: {integrity: sha512-UhDfHmA92YAlNnCfhmq0VeNL5bDbiZGg7sZ2IvPsXubGkiNa9EC+tUTsjBRsYUAz87btI6/1wf4XoVvQ3uRnmQ==} + engines: {node: '>=18'} + + string-width@7.1.0: + resolution: {integrity: sha512-SEIJCWiX7Kg4c129n48aDRwLbFb2LJmXXFrWBG4NGaRtMQ3myKPKbwrD1BKqQn74oCoNMBVrfDEr5M9YxCsrkw==} + engines: {node: '>=18'} + + strip-ansi@7.1.0: + resolution: {integrity: sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==} + engines: {node: '>=12'} + + typescript@4.9.5: + resolution: {integrity: sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==} + engines: {node: '>=4.2.0'} + hasBin: true + + undici-types@5.26.5: + resolution: {integrity: sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==} + +snapshots: + + '@types/node@20.14.2': + dependencies: + undici-types: 5.26.5 + + ansi-regex@6.0.1: {} + + chalk@5.3.0: {} + + cli-cursor@4.0.0: + dependencies: + restore-cursor: 4.0.0 + + cli-spinners@2.9.2: {} + + commander@12.1.0: {} + + emoji-regex@10.3.0: {} + + get-east-asian-width@1.2.0: {} + + is-interactive@2.0.0: {} + + is-unicode-supported@1.3.0: {} + + is-unicode-supported@2.0.0: {} + + kleur@3.0.3: {} + + kolorist@1.8.0: {} + + log-symbols@6.0.0: + dependencies: + chalk: 5.3.0 + is-unicode-supported: 1.3.0 + + mimic-fn@2.1.0: {} + + onetime@5.1.2: + dependencies: + mimic-fn: 2.1.0 + + ora@8.0.1: dependencies: chalk: 5.3.0 cli-cursor: 4.0.0 @@ -127,59 +183,33 @@ packages: stdin-discarder: 0.2.2 string-width: 7.1.0 strip-ansi: 7.1.0 - dev: false - /prompts@2.4.2: - resolution: {integrity: sha512-NxNv/kLguCA7p3jE8oL2aEBsrJWgAakBpgmgK6lpPWV+WuOmY6r2/zbAVnP+T8bQlA0nzHXSJSJW0Hq7ylaD2Q==} - engines: {node: '>= 6'} + prompts@2.4.2: dependencies: kleur: 3.0.3 sisteransi: 1.0.5 - dev: false - /restore-cursor@4.0.0: - resolution: {integrity: sha512-I9fPXU9geO9bHOt9pHHOhOkYerIMsmVaWB0rA2AI9ERh/+x/i7MV5HKBNrg+ljO5eoPVgCcnFuRjJ9uH6I/3eg==} - engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + restore-cursor@4.0.0: dependencies: onetime: 5.1.2 signal-exit: 3.0.7 - dev: false - /signal-exit@3.0.7: - resolution: {integrity: sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==} - dev: false + signal-exit@3.0.7: {} - /sisteransi@1.0.5: - resolution: {integrity: sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==} - dev: false + sisteransi@1.0.5: {} - /stdin-discarder@0.2.2: - resolution: {integrity: sha512-UhDfHmA92YAlNnCfhmq0VeNL5bDbiZGg7sZ2IvPsXubGkiNa9EC+tUTsjBRsYUAz87btI6/1wf4XoVvQ3uRnmQ==} - engines: {node: '>=18'} - dev: false + stdin-discarder@0.2.2: {} - /string-width@7.1.0: - resolution: {integrity: sha512-SEIJCWiX7Kg4c129n48aDRwLbFb2LJmXXFrWBG4NGaRtMQ3myKPKbwrD1BKqQn74oCoNMBVrfDEr5M9YxCsrkw==} - engines: {node: '>=18'} + string-width@7.1.0: dependencies: emoji-regex: 10.3.0 get-east-asian-width: 1.2.0 strip-ansi: 7.1.0 - dev: false - /strip-ansi@7.1.0: - resolution: {integrity: sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==} - engines: {node: '>=12'} + strip-ansi@7.1.0: dependencies: ansi-regex: 6.0.1 - dev: false - /typescript@4.9.5: - resolution: {integrity: sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==} - engines: {node: '>=4.2.0'} - hasBin: true - dev: false + typescript@4.9.5: {} - /undici-types@5.26.5: - resolution: {integrity: sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==} - dev: true + undici-types@5.26.5: {} diff --git a/src/generateDapp.ts b/src/generateDapp.ts index 3b0245c0..adab5ecc 100644 --- a/src/generateDapp.ts +++ b/src/generateDapp.ts @@ -1,3 +1,4 @@ + import { green, bold, blue } from "kolorist"; import path from "path"; import { fileURLToPath } from "node:url"; @@ -94,10 +95,14 @@ export async function generateDapp(selection: Selections) { switch (selection.template.path) { case "nft-minting-dapp-template": - await generateEnvFile(`VITE_COLLECTION_CREATOR_ADDRESS=""`); + await generateEnvFile( + `VITE_COLLECTION_CREATOR_ADDRESS=""\n#To fill after you create a collection, will be used for the minting page\nVITE_COLLECTION_ADDRESS=""` + ); break; case "token-minting-dapp-template": - await generateEnvFile(`VITE_FA_CREATOR_ADDRESS=""`); + await generateEnvFile( + `VITE_FA_CREATOR_ADDRESS=""\n#To fill after you create a fungible asset, will be used for the minting page\nVITE_FA_ADDRESS=""` + ); break; case "token-staking-dapp-template": await generateEnvFile( diff --git a/src/workflowOptions.ts b/src/workflowOptions.ts index 83937cc8..a173c8e0 100644 --- a/src/workflowOptions.ts +++ b/src/workflowOptions.ts @@ -63,19 +63,18 @@ export const workflowOptions = { name: "network", message: "Choose your network", choices(prev) { - if ( - prev.path === "boilerplate-template" || - prev.path === "token-staking-dapp-template" - ) { + // We don't support devnet for NFT minting dapp because it depends on token-minter contract + // token-minter contract is not deployed on devnet because devnet is reset frequently + if (prev.path === "nft-minting-dapp-template") { return [ { title: "Mainnet", value: "mainnet" }, { title: "Testnet", value: "testnet" }, - { title: "Devnet", value: "devnet" }, ]; } return [ { title: "Mainnet", value: "mainnet" }, { title: "Testnet", value: "testnet" }, + { title: "Devnet", value: "devnet" }, ]; }, initial: 0, diff --git a/templates/nft-minting-dapp-template/frontend/config.ts b/templates/nft-minting-dapp-template/frontend/config.ts index 57a3d1de..8e5a085c 100644 --- a/templates/nft-minting-dapp-template/frontend/config.ts +++ b/templates/nft-minting-dapp-template/frontend/config.ts @@ -3,9 +3,6 @@ import Placeholder2 from "@/assets/placeholders/bear-2.png"; import Placeholder3 from "@/assets/placeholders/bear-3.png"; export const config: Config = { - // TODO: Fill in your collection id - collection_id: "", - // Removing one or all of these socials will remove them from the page socials: { twitter: "https://twitter.com", @@ -81,8 +78,6 @@ export const config: Config = { }; export interface Config { - collection_id: string; - socials?: { twitter?: string; discord?: string; diff --git a/templates/nft-minting-dapp-template/frontend/constants.ts b/templates/nft-minting-dapp-template/frontend/constants.ts index fbe77ea1..3258bacc 100644 --- a/templates/nft-minting-dapp-template/frontend/constants.ts +++ b/templates/nft-minting-dapp-template/frontend/constants.ts @@ -1,5 +1,6 @@ export const NETWORK = import.meta.env.VITE_APP_NETWORK ?? "testnet"; export const MODULE_ADDRESS = import.meta.env.VITE_MODULE_ADDRESS; export const CREATOR_ADDRESS = import.meta.env.VITE_COLLECTION_CREATOR_ADDRESS; +export const COLLECTION_ADDRESS = import.meta.env.VITE_COLLECTION_ADDRESS; export const IS_DEV = Boolean(import.meta.env.DEV); export const IS_PROD = Boolean(import.meta.env.PROD); diff --git a/templates/nft-minting-dapp-template/frontend/hooks/useGetCollectionData.ts b/templates/nft-minting-dapp-template/frontend/hooks/useGetCollectionData.ts index 2cb852d7..36c12e9c 100644 --- a/templates/nft-minting-dapp-template/frontend/hooks/useGetCollectionData.ts +++ b/templates/nft-minting-dapp-template/frontend/hooks/useGetCollectionData.ts @@ -1,8 +1,7 @@ import { AccountAddress } from "@aptos-labs/ts-sdk"; import { useQuery } from "@tanstack/react-query"; -import { config } from "@/config"; -import { MODULE_ADDRESS } from "@/constants"; +import { COLLECTION_ADDRESS, MODULE_ADDRESS } from "@/constants"; import { aptosClient } from "@/utils/aptosClient"; export interface Token { @@ -53,11 +52,13 @@ interface MintData { isMintInfinite: boolean; } -async function getStartAndEndTime(collection_id: string): Promise<[start: Date, end: Date, isMintInfinite: boolean]> { +async function getStartAndEndTime( + collection_address: string, +): Promise<[start: Date, end: Date, isMintInfinite: boolean]> { const mintStageRes = await aptosClient().view<[{ vec: [string] }]>({ payload: { function: `${AccountAddress.from(MODULE_ADDRESS)}::launchpad::get_active_or_next_mint_stage`, - functionArguments: [collection_id], + functionArguments: [collection_address], }, }); @@ -66,7 +67,7 @@ async function getStartAndEndTime(collection_id: string): Promise<[start: Date, const startAndEndRes = await aptosClient().view<[string, string]>({ payload: { function: `${AccountAddress.from(MODULE_ADDRESS)}::launchpad::get_mint_stage_start_and_end_time`, - functionArguments: [collection_id, mintStage], + functionArguments: [collection_address, mintStage], }, }); @@ -79,20 +80,20 @@ async function getStartAndEndTime(collection_id: string): Promise<[start: Date, ]; } -export function useGetCollectionData(collection_id: string = config.collection_id) { +export function useGetCollectionData(collection_address: string = COLLECTION_ADDRESS) { return useQuery({ - queryKey: ["app-state", collection_id], + queryKey: ["app-state", collection_address], refetchInterval: 1000 * 30, queryFn: async () => { try { - if (!collection_id) return null; + if (!collection_address) return null; - const [startDate, endDate, isMintInfinite] = await getStartAndEndTime(collection_id); + const [startDate, endDate, isMintInfinite] = await getStartAndEndTime(collection_address); const res = await aptosClient().queryIndexer({ query: { variables: { - collection_id, + collection_id: collection_address, }, query: ` query TokenQuery($collection_id: String) { diff --git a/templates/nft-minting-dapp-template/frontend/pages/Mint/components/ConnectWalletAlert.tsx b/templates/nft-minting-dapp-template/frontend/pages/Mint/components/ConnectWalletAlert.tsx index bc972722..a0ccba7d 100644 --- a/templates/nft-minting-dapp-template/frontend/pages/Mint/components/ConnectWalletAlert.tsx +++ b/templates/nft-minting-dapp-template/frontend/pages/Mint/components/ConnectWalletAlert.tsx @@ -2,10 +2,10 @@ import { FC } from "react"; // Internal components import { WarningAlert } from "@/components/ui/warning-alert"; // Internal config -import { config } from "@/config"; +import { COLLECTION_ADDRESS } from "@/constants"; export const ConnectWalletAlert: FC = () => { - if (config.collection_id) return null; + if (COLLECTION_ADDRESS) return null; return (
@@ -19,11 +19,11 @@ export const ConnectWalletAlert: FC = () => {
  • Fill in the{" "} - collection_id + VITE_COLLECTION_ADDRESS {" "} field in - frontend/config.ts + .env
  • diff --git a/templates/token-minting-dapp-template/frontend/config.ts b/templates/token-minting-dapp-template/frontend/config.ts index 4e048fec..7ba69b27 100644 --- a/templates/token-minting-dapp-template/frontend/config.ts +++ b/templates/token-minting-dapp-template/frontend/config.ts @@ -1,9 +1,6 @@ import Placeholder1 from "@/assets/placeholders/asset.png"; export const config: Config = { - // TODO: Fill in your asset id - fa_address: "", - // Removing one or all of these socials will remove them from the page socials: { twitter: "https://twitter.com", @@ -24,8 +21,6 @@ export const config: Config = { }; export interface Config { - fa_address: string; - socials?: { twitter?: string; discord?: string; diff --git a/templates/token-minting-dapp-template/frontend/constants.ts b/templates/token-minting-dapp-template/frontend/constants.ts index 923305df..a61b1f97 100644 --- a/templates/token-minting-dapp-template/frontend/constants.ts +++ b/templates/token-minting-dapp-template/frontend/constants.ts @@ -1,5 +1,6 @@ export const NETWORK = import.meta.env.VITE_APP_NETWORK ?? "testnet"; export const MODULE_ADDRESS = import.meta.env.VITE_MODULE_ADDRESS; export const CREATOR_ADDRESS = import.meta.env.VITE_FA_CREATOR_ADDRESS; +export const FA_ADDRESS = import.meta.env.VITE_FA_ADDRESS; export const IS_DEV = Boolean(import.meta.env.DEV); export const IS_PROD = Boolean(import.meta.env.PROD); diff --git a/templates/token-minting-dapp-template/frontend/hooks/useGetAssetData.ts b/templates/token-minting-dapp-template/frontend/hooks/useGetAssetData.ts index 79e2e373..680c536d 100644 --- a/templates/token-minting-dapp-template/frontend/hooks/useGetAssetData.ts +++ b/templates/token-minting-dapp-template/frontend/hooks/useGetAssetData.ts @@ -1,13 +1,11 @@ import { useWallet } from "@aptos-labs/wallet-adapter-react"; import { AccountAddress } from "@aptos-labs/ts-sdk"; import { useQuery } from "@tanstack/react-query"; -// Internal config -import { config } from "@/config"; // Internal utils import { aptosClient } from "@/utils/aptosClient"; import { convertAmountFromOnChainToHumanReadable } from "@/utils/helpers"; // Internal constants -import { MODULE_ADDRESS } from "@/constants"; +import { FA_ADDRESS, MODULE_ADDRESS } from "@/constants"; export interface FungibleAsset { maximum_v2: number; @@ -55,7 +53,7 @@ async function getMintLimit(fa_address: string): Promise { /** * A react hook to get fungible asset data. */ -export function useGetAssetData(fa_address: string = config.fa_address) { +export function useGetAssetData(fa_address: string = FA_ADDRESS) { const { account } = useWallet(); return useQuery({ diff --git a/templates/token-minting-dapp-template/frontend/pages/Mint/components/ConnectWalletAlert.tsx b/templates/token-minting-dapp-template/frontend/pages/Mint/components/ConnectWalletAlert.tsx index c9c10e4c..469c70cf 100644 --- a/templates/token-minting-dapp-template/frontend/pages/Mint/components/ConnectWalletAlert.tsx +++ b/templates/token-minting-dapp-template/frontend/pages/Mint/components/ConnectWalletAlert.tsx @@ -3,10 +3,10 @@ import { FC } from "react"; // Internal components import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert"; // Internal config -import { config } from "@/config"; +import { FA_ADDRESS } from "@/constants"; export const ConnectWalletAlert: FC = () => { - if (config.fa_address) return null; + if (FA_ADDRESS) return null; return (
    @@ -23,11 +23,11 @@ export const ConnectWalletAlert: FC = () => {
  • Fill in the{" "} - fa_address + VITE_FA_ADDRESS {" "} field in - frontend/config.ts + .env