Skip to content

How to upload to arweave at backend using solana metaplex js sdk? #293

Answered by JohnVersus
JohnVersus asked this question in Q&A
Discussion options

You must be logged in to vote

I figured this out. Here is the solution in case if some have the same question

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,
      identity: keypair,
    }),
  );

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by JohnVersus
Comment options

You must be logged in to vote
1 reply
@JohnVersus
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants