I have tried uploading metadata to arweave from the frontend using the metaplex.nfts().uploadMetadata
and it is working great. I would like to know if it is possible to upload from the backend using metaplex.nfts().uploadMetadata
and privateKey. If possible please share an example code or docs for the same.
Thank You🙏
edit: I tried something like this.
const connection = new Connection(clusterApiUrl('devnet'));
const metaplex = new Metaplex(connection);
const key = Uint8Array.from(
base58.decode('PrivateKey'),
);
const keypair = Keypair.fromSecretKey(key);
console.log(`keypair created: ${keypair.publicKey.toString()}`);
metaplex.use(walletAdapterIdentity(keypair));
metaplex.use(
bundlrStorage({
address: 'https://devnet.bundlr.network',
providerUrl: 'https://api.devnet.solana.com',
timeout: 60000,
}),
);
Which obviously threw an error saying The current wallet adapter does not support the following operation: [signTransaction].
How do I solve this?
edit: I think I solved it Just have to update the bundlrStorage to use the keypair generated from the private key
metaplex.use(
bundlrStorage({
address: 'https://devnet.bundlr.network',
providerUrl: 'https://api.devnet.solana.com',
timeout: 60000,
identity: keypair,
}),
metaplex.nfts().uploadMetadata
. Thanks