Tooling:
Author:
This is a simple contract deployer example built on top of mintbase nextjs starter.
To initiate the contract deployment process, the user is required to connect their wallet. Following the wallet connection, the user can proceed to select the desired contract name and its corresponding symbol. It's important to note that the deployment fee for a contract is 3.7 NEAR.
NOTE: As a standard on Mintbase as we use the latest versions of Next.js we recommend using pnpm, but the package manager is up to your personal choice.
pnpm i
pnpm run dev
Using @mintbase-js/data checkStoreName method we can check if the store already exists.
const { data: checkStore } = await checkStoreName(data.name);
if (checkStore?.nft_contracts.length === 0) {
(...)
}
Step 2: if contract name doesn't exist execute the deploy contract action with the instantiated wallet
Create deploy contract args using mintbase-js/sdk deployContract method.
const deployArgs = deployContract({
name: data.name,
ownerId: activeAccountId,
factoryContractId: MINTBASE_CONTRACTS.testnet,
metadata: {
symbol: data.symbol,
},
});
We can then execute the deploy contract
await execute({ wallet }, deployArgs);
Presently, this template exclusively functions within the testnet environment. To transition to a different network, it is imperative to modify the configuration settings located in the contract-deployer/src/config/setup.ts file and every 'testnet' instance.
- Support: Join the Telegram
- Twitter: @mintbase