import * as fs from 'fs';
import Arweave from 'arweave';
(async () => {
const arweave = Arweave.init({
host: 'arweave.net',
port: 443,
protocol: 'https',
timeout: 20000,
logging: false,
});
// Upload JSON to Arweave
// provide arweave.net image url uploaded with uploadImageArweave.ts
var imageUrl = "URL GENERADO";
let metadata = `{
"image": "${imageUrl}",
"attributes": [
{
"trait_type": "Photo",
"value": "Common"
},
{
"trait_type": "Mountain",
"value": "Unknown"
}
],
"category": "image",
"collection": {
"family": "FAMILY",
"name": "Org"
},
"description": "DESCRIPCION",
"external_url": "https://www.example.org/",
"name": "NOMBRE DE LA FOTO",
"properties": {
"category": "image",
"creators": [
{
"address": "CLAVE PÚBLICA DE SOLANA A ASOCIARLE EL NFT",
"share": 100
}
]
},
"seller_fee_basis_points": 500,
"symbol": ""
}`;
metadata = metadata.trim();
console.log(metadata);
const metadataRequest = JSON.parse(JSON.stringify(metadata));
const metadataTransaction = await arweave.createTransaction({
data: metadataRequest
});
metadataTransaction.addTag('Content-Type', 'application/json');
//SETUP YOUR ARWEAVE WALLET
await arweave.transactions.sign(metadataTransaction, CLAVE PRIVADA DE ARWEAVE WALLET JSON sin EL ext:true);
console.log("https://arweave.net/"+metadataTransaction.id);
let response = await arweave.transactions.post(metadataTransaction);
console.log(response);
})();
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter