Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
13 changes: 7 additions & 6 deletions scripts/deployNftCollection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import { Address, toNano } from '@ton/core';
import { NftCollection } from '../wrappers/NftCollection';
import { compile, NetworkProvider } from '@ton/blueprint';
import { buildCollectionContentCell, setItemContentCell } from './nftContent/onChain';
import * as dotenv from 'dotenv';
dotenv.config();

const randomSeed= Math.floor(Math.random() * 10000);

Expand All @@ -11,21 +13,20 @@ export async function run(provider: NetworkProvider) {
ownerAddress: provider.sender().address!!,
nextItemIndex: 0,
collectionContent: buildCollectionContentCell({
name: "OnChain collection",
description: "Collection of items with onChain metadata",
image: "https://raw.githubusercontent.com/Cosmodude/Nexton/main/Nexton_Logo.jpg"
name: process.env.COLLECTION_NAME!,
description: process.env.COLLECTION_DESCRIPTION!,
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Why do we need these params from .env?

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Isn't hardcoded data more demonstrative?

image: process.env.COLLECTION_IMAGE!
}),
nftItemCode: await compile("NftItem"),
royaltyParams: {
royaltyFactor: Math.floor(Math.random() * 500),
royaltyBase: 1000,
royaltyFactor: parseInt(process.env.COLLECTION_ROYALTY_PERCENT!),
royaltyBase: 100,
royaltyAddress: provider.sender().address as Address
}
}, await compile('NftCollection')));

console.log(provider.sender().address as Address)
await nftCollection.sendDeploy(provider.sender(), toNano('0.05'));
console.log()
await provider.waitForDeploy(nftCollection.address);

const mint = await nftCollection.sendMintNft(provider.sender(),{
Expand Down
16 changes: 9 additions & 7 deletions tests/NftCollection.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import { buildCollectionContentCell, setItemContentCell } from '../scripts/nftCo
import '@ton/test-utils';
import { compile } from '@ton/blueprint';
import { flattenTransaction } from '@ton/test-utils';
import * as dotenv from 'dotenv';
dotenv.config();

describe('NftCollection', () => {
let collectionCode: Cell;
Expand All @@ -25,9 +27,9 @@ describe('NftCollection', () => {
blockchain = await Blockchain.create();
collectionOwner = await blockchain.treasury("ownerWallet");
collectionContent = buildCollectionContentCell({
name: "OnChain collection",
description: "Collection of items with onChain metadata",
image: "https://raw.githubusercontent.com/Cosmodude/Nexton/main/Nexton_Logo.jpg"
name: process.env.COLLECTION_NAME!,
description: process.env.COLLECTION_DESCRIPTION!,
image: process.env.COLLECTION_IMAGE!
});
nftItemContent = setItemContentCell({
name: "OnChain",
Expand All @@ -41,8 +43,8 @@ describe('NftCollection', () => {
collectionContent: collectionContent,
nftItemCode: item,
royaltyParams: {
royaltyFactor: Math.floor(Math.random() * 500),
royaltyBase: 1000,
royaltyFactor: parseInt(process.env.COLLECTION_ROYALTY_PERCENT!), //Math.floor(Math.random() * 500),
royaltyBase: 100, //1000,
royaltyAddress: collectionOwner.getSender().address as Address
}
},collectionCode));
Expand Down Expand Up @@ -71,8 +73,8 @@ describe('NftCollection', () => {

it('should get roylty params after collection has been deployed', async () => {
const royalty_params = await nftCollection.getRoyaltyParams();
console.log('royalties ', royalty_params);
expect(royalty_params.royaltyBase).toBe(BigInt(1000));
expect(royalty_params.royaltyFactor).toBe(BigInt(parseInt(process.env.COLLECTION_ROYALTY_PERCENT!)));
expect(royalty_params.royaltyBase).toBe(BigInt(100));
expect(royalty_params.royaltyAddress.toString()).toBe(collectionOwner.address.toString());
});

Expand Down