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

Update mint-nftstorage-polygon.md #235

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
21 changes: 21 additions & 0 deletions docs/tutorial/mint-nftstorage-polygon.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,27 @@ Your output should look like the listing below, where `HASH` is the CID to the a
Metadata stored on Filecoin/IPFS at URL: ipfs://HASH/metadata.json
```

I wrote this to store all images from one directory into a folder
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could you write in a style consistent with the original content? (For instance, the pronoun is "we" instead of first-person "I").

My images were numbered 1 - 5000 (.png), so I looped through and loaded them into an array
then upload them all at once, this creates one CID on Filecoin/IPFS and each image can be access by
its owen URL: ipfs://metadata/1.png

async function storeDir() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Code fence :)

let images = [];

for(let i=1; i < 5001; i++){
images.push(new File( [await fs.promises.readFile('assets/images/' + i.toString() + '.png')],
i.toString() + '.png' , { type: 'image/png'}))
}

const client = new NFTStorage({ token: API_KEY })
const metadata = await client.storeDirectory(images);

console.log( metadata)
}



### Creating your NFT on Polygon

#### Create the smart contract for minting
Expand Down