implemented nft creation with LP

This commit is contained in:
biccsdev
2025-01-17 12:14:47 -06:00
parent dc520dff08
commit 6bbb6d489c
8 changed files with 391 additions and 40 deletions

View File

@@ -651,6 +651,7 @@ export class SolanaAgentKit {
collectionAccount: string,
createItemOptions: CreateSingleOptions,
isDevnet: boolean = false,
withPool: boolean = false,
): Promise<string> {
let optionsWithBase58: StoreInitOptions = {
privateKey: this.wallet.secretKey,
@@ -666,6 +667,7 @@ export class SolanaAgentKit {
collectionAccount,
createItemOptions,
!isDevnet,
withPool,
);
return `Transaction: ${tx}`;
}

View File

@@ -10,7 +10,6 @@ export class Solana3LandCreateCollection extends Tool {
description = `Creates an NFT Collection that you can visit on 3.land's website (3.land/collection/{collectionAccount})
Inputs:
privateKey (required): represents the privateKey of the wallet - can be an array of numbers, Uint8Array or base58 string
isMainnet (required): defines is the tx takes places in mainnet
collectionSymbol (required): the symbol of the collection
collectionName (required): the name of the collection
@@ -26,14 +25,8 @@ export class Solana3LandCreateCollection extends Tool {
protected async _call(input: string): Promise<string> {
try {
const inputFormat = JSON.parse(input);
const privateKey = inputFormat.privateKey;
const isMainnet = inputFormat.isMainnet;
const optionsWithBase58: StoreInitOptions = {
...(privateKey && { privateKey }),
...(isMainnet && { isMainnet }),
};
const collectionSymbol = inputFormat?.collectionSymbol;
const collectionName = inputFormat?.collectionName;
const collectionDescription = inputFormat?.collectionDescription;
@@ -49,8 +42,8 @@ export class Solana3LandCreateCollection extends Tool {
};
const tx = await this.solanaKit.create3LandCollection(
optionsWithBase58,
collectionOpts,
!isMainnet,
);
return JSON.stringify({
status: "success",

View File

@@ -10,7 +10,6 @@ export class Solana3LandCreateSingle extends Tool {
description = `Creates an NFT and lists it on 3.land's website
Inputs:
privateKey (required): represents the privateKey of the wallet - can be an array of numbers, Uint8Array or base58 string
collectionAccount (optional): represents the account for the nft collection
itemName (required): the name of the NFT
sellerFee (required): the fee of the seller
@@ -21,7 +20,9 @@ export class Solana3LandCreateSingle extends Tool {
mainImageUrl (required): the main image of the NFT
coverImageUrl (optional): the cover image of the NFT
splHash (optional): the hash of the spl token, if not provided listing will be in $SOL
isMainnet (required): defines is the tx takes places in mainnet
poolName (optional): the name of the pool
isMainnet (required): defines if the tx takes places in mainnet
withPool (optional): defines if minted edition will be tied to a liquidity pool
`;
constructor(private solanaKit: SolanaAgentKit) {
@@ -31,13 +32,9 @@ export class Solana3LandCreateSingle extends Tool {
protected async _call(input: string): Promise<string> {
try {
const inputFormat = JSON.parse(input);
const privateKey = inputFormat.privateKey;
const isMainnet = inputFormat.isMainnet;
const optionsWithBase58: StoreInitOptions = {
...(privateKey && { privateKey }),
...(isMainnet && { isMainnet }),
};
const withPool = inputFormat.withPool;
const poolName = inputFormat.poolName;
const collectionAccount = inputFormat.collectionAccount;
@@ -52,6 +49,15 @@ export class Solana3LandCreateSingle extends Tool {
const coverImageUrl = inputFormat?.coverImageUrl;
const splHash = inputFormat?.splHash;
if (withPool) {
if (!poolName) {
throw new Error("poolName is required when withPool is true");
}
if (!splHash) {
throw new Error("splHash is required when withPool is true");
}
}
const createItemOptions: CreateSingleOptions = {
...(itemName && { itemName }),
...(sellerFee && { sellerFee }),
@@ -63,6 +69,7 @@ export class Solana3LandCreateSingle extends Tool {
...(mainImageUrl && { mainImageUrl }),
...(coverImageUrl && { coverImageUrl }),
...(splHash && { splHash }),
...(poolName && { poolName }),
};
if (!collectionAccount) {
@@ -70,10 +77,10 @@ export class Solana3LandCreateSingle extends Tool {
}
const tx = await this.solanaKit.create3LandNft(
optionsWithBase58,
collectionAccount,
createItemOptions,
isMainnet,
!isMainnet,
withPool,
);
return JSON.stringify({
status: "success",

View File

@@ -37,7 +37,8 @@ export async function createSingle(
optionsWithBase58: StoreInitOptions,
collectionAccount: string,
createItemOptions: CreateSingleOptions,
isMainnet: boolean,
isMainnet: boolean = false,
withPool: boolean = false,
) {
try {
const landStore = isMainnet
@@ -49,6 +50,8 @@ export async function createSingle(
landStore,
collectionAccount,
createItemOptions,
true, //isAI
withPool,
);
return singleEditionTx;
} catch (error: any) {