-
Notifications
You must be signed in to change notification settings - Fork 480
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implemented 3Land SDK into solana-agent-kit (#136)
# Pull Request Description ## Changes Made This PR adds the following changes: - Integrated 3land SDK into send-ai-sdk to enable AI agents to create Collections and NFTs - Every NFT creation automatically lists on 3.land marketplace - Added comprehensive test suite for 3land tools integration - Updated documentation with usage examples and implementation details ## Implementation Details - Implemented new 3land tools module in `/test/tools/3land.ts` - Added SDK wrapper functions for NFT and collection creation ## Transaction executed by agent Example collection creation: ```typescript const optionsWithBase58: StoreInitOptions = { privateKey: "", isMainnet: true, // if false, collection will be created on devnet 3.land (dev.3.land) }; const collectionOpts: CreateCollectionOptions = { collectionName: "", collectionSymbol: "", collectionDescription: "", mainImageUrl: "" }; const result = await agent.create3LandCollection( optionsWithBase58, collectionOpts ); ``` example nft creation ```typescript const optionsWithBase58: StoreInitOptions = { privateKey: "", isMainnet: true, // if false, listing will be on devnet 3.land (dev.3.land) }; const collectionAccount = ""; //hash for the collection const createItemOptions: CreateSingleOptions = { itemName: "", sellerFee: 500, //5% itemAmount: 100, //total items to be created itemSymbol: "", itemDescription: "", traits: [ { trait_type: "", value: "" }, ], price: 0, //100000000 == 0.1 sol, can be set to 0 for a free mint mainImageUrl: "", splHash: "", //present if listing is on a specific SPL token, if not present sale will be on $SOL }; const isMainnet = true; const result = await agent.create3LandNft( optionsWithBase58, collectionAccount, createItemOptions, isMainnet ); ``` ## Additional Notes - The integration enables seamless NFT creation and marketplace listing through a single API call - NFT listings can be done in any SPL token - Test collection creation TX: https://solscan.io/tx/4ypfwWedTwvVX5HLP9hZzc86CGbSLbBPStNNuXHw9eq9rmFeHtCZgccCkZhuKrNVWdy2RNEDBnYRY1Tq6t2iYAsj?cluster=devnet ## Checklist - [x] I have tested these changes locally - [x] I have updated the documentation - [x] I have added a transaction link
- Loading branch information
Showing
10 changed files
with
2,483 additions
and
736 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import { createCollectionImp, createSingleImp } from "@3land/listings-sdk"; | ||
import { | ||
StoreInitOptions, | ||
CreateCollectionOptions, | ||
CreateSingleOptions, | ||
} from "@3land/listings-sdk/dist/types/implementation/implementationTypes"; | ||
|
||
/** | ||
* Create a collection on 3Land | ||
* @param optionsWithBase58 represents the privateKey of the wallet - can be an array of numbers, Uint8Array or base58 string | ||
* @param collectionOpts represents the options for the collection creation | ||
* @returns | ||
*/ | ||
export async function createCollection( | ||
optionsWithBase58: StoreInitOptions, | ||
collectionOpts: CreateCollectionOptions, | ||
) { | ||
try { | ||
const collection = await createCollectionImp( | ||
optionsWithBase58, | ||
collectionOpts, | ||
); | ||
return collection; | ||
} catch (error: any) { | ||
throw new Error(`Collection creation failed: ${error.message}`); | ||
} | ||
} | ||
|
||
/** | ||
* Create a single edition on 3Land | ||
* @param optionsWithBase58 represents the privateKey of the wallet - can be an array of numbers, Uint8Array or base58 string | ||
* @param collectionAccount represents the account for the nft collection | ||
* @param createItemOptions the options for the creation of the single NFT listing | ||
* @returns | ||
*/ | ||
export async function createSingle( | ||
optionsWithBase58: StoreInitOptions, | ||
collectionAccount: string, | ||
createItemOptions: CreateSingleOptions, | ||
isMainnet: boolean, | ||
) { | ||
try { | ||
const landStore = isMainnet | ||
? "AmQNs2kgw4LvS9sm6yE9JJ4Hs3JpVu65eyx9pxMG2xA" | ||
: "GyPCu89S63P9NcCQAtuSJesiefhhgpGWrNVJs4bF2cSK"; | ||
|
||
const singleEditionTx = await createSingleImp( | ||
optionsWithBase58, | ||
landStore, | ||
collectionAccount, | ||
createItemOptions, | ||
); | ||
return singleEditionTx; | ||
} catch (error: any) { | ||
throw new Error(`Single edition creation failed: ${error.message}`); | ||
} | ||
} | ||
|
||
/** | ||
* Buy a single edition on 3Land | ||
* @param | ||
* @returns | ||
*/ | ||
// export async function buySingle() { | ||
// try { | ||
// } catch (error: any) { | ||
// throw new Error(`Buying single edition failed: ${error.message}`); | ||
// } | ||
// } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.