Files
js/packages/solana
github-actions[bot]andgithub-actions[bot] b5bfaefa85 Version Packages (#157)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-09-22 17:11:41 -07:00
..
2022-09-01 04:55:20 -07:00
2022-09-22 21:27:43 +00:00
2022-09-22 11:06:55 -07:00
2022-09-01 11:00:09 +00:00
2022-08-28 01:00:28 -07:00
2022-08-28 01:00:28 -07:00
2022-09-19 22:13:25 -07:00
2022-09-22 17:11:41 -07:00
2022-08-28 01:00:28 -07:00
2022-09-22 17:11:41 -07:00
2022-08-28 01:00:28 -07:00



thirdweb Solana SDK

Join our Discord!

thirdweb's Solana SDK for Browser, Node and React Native


Installation

Install the latest version of the SDK with either npm or yarn:

npm install @thirdweb-dev/solana
yarn add @thirdweb-dev/solana

Quick Start

The first thing to do to get started with Solana using thirdweb is to deploy a program. You can do this via the Dashboard, or via the SDK with the following snippet:

import { ThirdwebSDK } from "@thirdweb-dev/solana";

// First, we instantiate the SDK and connect to Solana devnet
const sdk = ThirdwebSDK.fromNetwork("devnet");

// Next, we pass in a signer to the SDK (you can generate this or use your own)
// If you want to generate this, you can use Kepair.generate() from @solana/web3.js
const signer = {
  publicKey: "...",
  secretKey: "...",
};
sdk.wallet.connect(signer);

// Finally, we can deploy a new NFT Collection program
const address = await sdk.deployer.createNftCollection({
  name: "My Collection",
});

Once we have a deployed program, we can access it using the SDK to read and write data to the program:

// Here, we pass in the address of our deployed program
const program = await sdk.getNFTCollection(address);

// And now we can read data off our program, like getting all the NFTs from our collection
const nfts = await program.getAll();

// Or we can write data/send transactions to our program, like minting a new NFT
const mintAddress = await program.mint({
  name: "New NFT",
});
const nft = await program.get(mintAddress);

Learn More

You can learn more about thirdweb and the Solana SDK with the following resources: