Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move collection addr and fa addr to env #195

Merged
merged 2 commits into from
Aug 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can't support token minting dapp on devnet because it depends on Irys


# 0.0.23 (2024-08-21)

Expand Down
228 changes: 129 additions & 99 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 7 additions & 2 deletions src/generateDapp.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

import { green, bold, blue } from "kolorist";
import path from "path";
import { fileURLToPath } from "node:url";
Expand Down Expand Up @@ -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(
Expand Down
9 changes: 4 additions & 5 deletions src/workflowOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
5 changes: 0 additions & 5 deletions templates/nft-minting-dapp-template/frontend/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -81,8 +78,6 @@ export const config: Config = {
};

export interface Config {
collection_id: string;

socials?: {
twitter?: string;
discord?: string;
Expand Down
Original file line number Diff line number Diff line change
@@ -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);
Loading
Loading