Observed since 20 Oct, 19:46 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
3land_sdk
sdk for interacting with 3land's solana program
A Node.js SDK for interacting with 3Land's Solana programs. This SDK provides a simple and intuitive way to integrate with 3Land's smart contracts on the Solana blockchain.
Before using this SDK, ensure you have the following installed:
Clone the repo
git clone https://github.com/biccsdev/3land_sdk.git
# or
npm install 3land_sdk
Run this command to install all the packages needed for the sdk
npm install
# or
yarn add
import { Store, NetworkType } from "@3land/solana-sdk";
// For Devnet (default)
const devnetStore = new Store();
// For Mainnet
const mainnetStore = new Store({
network: NetworkType.MAINNET,
});
// Using custom RPC endpoint
const store = new Store({
network: NetworkType.MAINNET,
customEndpoint: "https://your-custom-rpc.com",
});
// Using custom configuration
const storeWithCustomConfig = new Store({
network: NetworkType.MAINNET,
customConfig: {
programId: "your_custom_program_id",
// other config options...
},
});
import dotenv from "dotenv";
dotenv.config();
const store = new Store({
network: (process.env.SOLANA_NETWORK as NetworkType) || NetworkType.DEVNET,
customEndpoint: process.env.SOLANA_RPC_ENDPOINT,
customConfig: {
programId: process.env.PROGRAM_ID,
},
});
Example .env file:
SOLANA_NETWORK=mainnet-beta
SOLANA_RPC_ENDPOINT=https://your-custom-rpc.com
PROGRAM_ID=your_program_id
solana-keygen new --outfile ~/.config/solana/devnet-wallet.json
solana config set --url https://api.devnet.solana.com
solana config set --keypair ~/.config/solana/devnet-wallet.json
solana airdrop 2
solana-keygen new --outfile ~/.config/solana/mainnet-wallet.json
solana config set --url https://api.mainnet-beta.solana.com
solana config set --keypair ~/.config/solana/mainnet-wallet.json
import { StoreConfig, FeeType } from "@3land/solana-sdk";
import { BN } from "bn.js";
try {
const storeConfig: StoreConfig = {
fee: new BN(1000000), // Fee in lamports
feePercentage: 5, // Must be between 0-100
feeType: new FeeType.AllMints(),
trust: payer.publicKey,
rules: [],
};
// Creator and storeId are optional, will default to payer.publicKey and random number
const createStoreTxId = await store.createStore(
walletKeypair,
"My 3Land Store",
storeConfig
);
console.log("Store created successfully:", createStoreTxId);
} catch (error) {
if (error.name === "ValidationError") {
console.error("Invalid parameters:", error.message);
} else {
console.error("Store creation failed:", error);
}
}
try {
const creator = new Creator({
address: payer.publicKey,
verified: false,
share: 100,
});
const metadata = {
symbol: "LAND", // Max 10 characters
name: "3Land Collection", // Max 32 characters
uri: "",
sellerFeeBasisPoints: new BN(0),
creators: [creator],
collection: null,
uses: null,
};
/ Prepare your image files
const imageBuffer = fs.readFileSync("path/to/image.gif").buffer;
const coverBuffer = fs.readFileSync("path/to/cover.jpeg").buffer;
const collectionOptions = {
symbol: "SDK",
metadata: {
name: metadata.name,
description: "3Land Collection Description",
files: {
file: {
arrayBuffer() {
return imageBuffer;
},
type: "image/png",
},
cover: {
arrayBuffer() {
return coverBuffer;
},
type: "image/png",
},
},
},
creators: metadata.creators,
traits: [{ attribute1: "value1" }, { attribute2: "value2" }],
sellerFeeBasisPoints: metadata.sellerFeeBasisPoints,
};
const collectionTx = await store.createCollection(
walletKeypair,
{ __kind: "V1", size: 0 },
metadata,
{
options: collectionOptions
},
false, // Mutable flag (optional)
0 // Supply (optional)
);
console.log("Collection created successfully:", collectionTx);
} catch (error) {
console.error("Collection creation failed:", error);
}
try {
const metadata = {
name: "My 3Land NFT",
uri: "",
uriType: 1,
sellerFeeBasisPoints: 500,
collection: collectionPublicKey,
creators: [creator],
};
const saleConfig = {
prices: [
{
amount: new BN(1000000),
priceType: new CurrencyType.Native(),
},
],
priceType: new PriceRule.None(),
rules: [],
sendToVault: 0,
saleType: new SaleType.Normal(),
};
const singleEditionTx = await store.createSingleEdition(
walletKeypair,
storeAccount,
100, // Supply
metadata,
saleConfig,
[1, 0, 0], // Category
[1, 0], // Super Category
0, // Event Category
12345, // Hash Traits
collectionPublicKey,
{
options: nftOptions,
}
);
console.log("Single edition created successfully:", singleEditionTx);
} catch (error) {
console.error("Single edition creation failed:", error);
}
try {
// Most parameters are optional and have default values
const buyTx = await store.buySingleEdition(
walletKeypair,
[0, 0, 0, 0, 0, 0], // Distribution bumps
itemAddress // The NFT's item account address
);
console.log("Purchase successful:", buyTx);
} catch (error) {
console.error("Purchase failed:", error);
}
try {
// SDK operations
} catch (error) {
if (error.name === "ValidationError") {
// Handle validation errors
console.error("Invalid parameters:", error.message);
} else if (error instanceof SendTransactionError) {
// Handle Solana transaction errors
console.error("Transaction failed:", error.logs);
} else {
// Handle other errors
console.error("Operation failed:", error);
}
}
git checkout -b feature/amazing-feature)git commit -m 'Add some amazing feature')git push origin feature/amazing-feature)For support, please create an issue in the GitHub repository or contact the 3Land team directly.
This project is licensed under the MIT License - see the LICENSE file for details.
Download counts and popularity will appear here as the collector receives them.
| Package / target | Requirement | Relationship |
|---|---|---|
bnEnvironment{
"local_name": "bn",
"alias": false,
"peer_metadata": null
} | ^1.0.5 | runtime |
fsEnvironment{
"local_name": "fs",
"alias": false,
"peer_metadata": null
} | ^0.0.1-security | runtime |
bs58Environment{
"local_name": "bs58",
"alias": false,
"peer_metadata": null
} | ^6.0.0 | runtime |
irysEnvironment{
"local_name": "irys",
"alias": false,
"peer_metadata": null
} | ^0.0.1 | runtime |
bn.jsEnvironment{
"local_name": "bn.js",
"alias": false,
"peer_metadata": null
} | ^5.2.1 | runtime |
cyrb53Environment{
"local_name": "cyrb53",
"alias": false,
"peer_metadata": null
} | ^1.0.0 | runtime |
ts-nodeEnvironment{
"local_name": "ts-node",
"alias": false,
"peer_metadata": null
} | ^10.9.2 | runtime |
@irys/sdkEnvironment{
"local_name": "@irys/sdk",
"alias": false,
"peer_metadata": null
} | ^0.2.11 | runtime |
tweetnaclEnvironment{
"local_name": "tweetnacl",
"alias": false,
"peer_metadata": null
} | ^1.0.3 | runtime |
node-fetchEnvironment{
"local_name": "node-fetch",
"alias": false,
"peer_metadata": null
} | ^3.3.2 | runtime |
@solana/web3.jsEnvironment{
"local_name": "@solana/web3.js",
"alias": false,
"peer_metadata": null
} | ^1.95.4 | runtime |
@coral-xyz/borshEnvironment{
"local_name": "@coral-xyz/borsh",
"alias": false,
"peer_metadata": null
} | ^0.30.1 | runtime |
@project-serum/anchorEnvironment{
"local_name": "@project-serum/anchor",
"alias": false,
"peer_metadata": null
} | ^0.26.0 | runtime |
@metaplex-foundation/beetEnvironment{
"local_name": "@metaplex-foundation/beet",
"alias": false,
"peer_metadata": null
} | ^0.7.2 | runtime |
@metaplex-foundation/mpl-token-metadataEnvironment{
"local_name": "@metaplex-foundation/mpl-token-metadata",
"alias": false,
"peer_metadata": null
} | ^2.13.0 | runtime |
tsxEnvironment{
"local_name": "tsx",
"alias": false,
"peer_metadata": null
} | ^4.19.1 | development |
typescriptEnvironment{
"local_name": "typescript",
"alias": false,
"peer_metadata": null
} | ^5.6.3 | development |
@types/nodeEnvironment{
"local_name": "@types/node",
"alias": false,
"peer_metadata": null
} | ^22.7.7 | development |
@types/bn.jsEnvironment{
"local_name": "@types/bn.js",
"alias": false,
"peer_metadata": null
} | ^5.1.6 | development |
Source distribution
{
"shasum": "b6a5a0e5b7f2d324356ddf3221642905f13774ae",
"tarball": "https://registry.npmjs.org/3land_sdk/-/3land_sdk-1.0.0.tgz",
"fileCount": 238,
"integrity": "sha512-XP8EBI189Ws+7LKq0yc5uh1OjDXFZgkaMRwysXgfiVTyHTp++WKsh7pwnfYMOTQRKlXEXfJ0xhQ4TYJbZsKxPQ==",
"signatures": [
{
"sig": "MEYCIQDHA5xNdXXsBD/2kVTsykoR/fTMM56p+ELiZp0VKnmrcwIhAKZ3L6IFsZLNqwbgy+cwUuv3IK/Oe37qjAXOxBsrqkDD",
"keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"
}
],
"unpackedSize": 18781238
}Observed since 20 Oct, 19:46 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package_version:2a9dab952fd65979501b2fcd3f1bb27daed4b1df52e782f7ea8e36f2ae3256ff