Pay with AIOZ Native
option. A payment address and QR code will be displayed. Take note of the address or scan the QR code using your wallet application. Use your wallet to send the desired amount of AIOZ tokens to the provided address. Wait for a few minutes while the transaction is confirmed.mkdir aioz-w3ipfs
cd aioz-w3ipfs
npm init
aioz-w3ipfs-sdk
client to your project dependencies.npm install aioz-w3ipfs-sdk
pinToIPFS.js
and open it with your code editor. Use the client.pinFileToIPFS
method to pin the file to IPFS, passing in the readable stream for the file and the options objectimport W3IpfsClient from 'aioz-w3ipfs-sdk';
import fs from 'fs';
let client = new W3IpfsClient("key", "secret-key")
const readableStreamForFile = fs.createReadStream('./test.png');
const options = {
w3IpfsMetadata: {
name: "MyCustomName",
keyvalues: {
customKey: 'customValue',
customKey2: 'customValue2'
}
}
};
client.pinFileToIPFS(readableStreamForFile, options).then((result) => {
console.log(result);
}).catch((err) => {
console.log(err);
})
client.pinFolderToIPFS
method, providing the path to the folder as a string. In this example, we're pinning a folder named folder
:client.pinFolderToIPFS('./folder', options).then((result) => {
console.log(result);
}).catch((err) => {
console.log(err);
});
const readableStreamForMetadata = fs.createReadStream('./sample.json');
const readableStreamForFile = fs.createReadStream('./test.png');
client.pinNft(readableStreamForFile, undefined, readableStreamForMetadata, options)
.then((result) => {
console.log(result);
}).catch((err) => {
console.log(err);
});
sample.json
file represents the metadata for the NFT. Here's a breakdown of the fields:{
"name": "My Awesome NFT",
"description": "This is an NFT that represents my creativity as a digital artist!",
"properties": [
{
"trait_type": "Color",
"value": "Red"
},
{
"trait_type": "Rarity",
"value": "Medium"
}
]
}
"name"
: The name of the NFT."description"
: A description that provides information about the NFT."properties"
: An array of properties or traits associated with the NFT.sample.json
file according to your specific NFT metadata requirements. You can add or remove fields and customize the values to accurately represent your NFT.aioz-w3ipfs-sdk
package to interact with the AIOZ W3IPFS service and pin files and folders to IPFS. Customize the code according to your specific requirements, including providing the appropriate API key and secret key, specifying the file/folder paths, and adjusting the options and metadata fields as needed.ON THIS PAGE