import {actions, utils, programs, NodeWallet} from '@metaplex/js';
import {Connection, Keypair, clusterApiUrl} from '@solana/web3.js';
import * as bs58 from "bs58";
async function mintNFT() {
//PROVIDE YOUR JSON URI WITH THE URL OF THE JSON UPLADAED TO ARWEAVE uploadJSON.ts
let uriS = "URL generado del JSON";
console.log("minting")
let connection = new Connection(clusterApiUrl("mainnet-beta"));
//let secretKey: Uint8Array= Uint8Array.from([]);
let keypair: Keypair = Keypair.fromSecretKey(bs58.decode("CLAVE PRIVADA DE SOLANA DEL QUE VA A PAGAR"));
const mintNFTResponse = await actions.mintNFT({
connection,
wallet: new NodeWallet(keypair),
uri: uriS,
maxSupply: 1
});
}
mintNFT();
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