Fix: remove buyNFT not working with sdk

This commit is contained in:
Lautaro
2024-12-30 14:00:55 -03:00
parent 35781f4dc1
commit 9fba6484b5
3 changed files with 0 additions and 81 deletions

View File

@@ -72,44 +72,6 @@ export async function listNFTForSale(
}
}
export async function buyNFT(
agent: SolanaAgentKit,
nftMint: PublicKey,
maxPrice: number,
): Promise<string> {
const provider = new AnchorProvider(
agent.connection,
new Wallet(agent.wallet),
AnchorProvider.defaultOptions(),
);
const tensorSwapSdk = new TensorSwapSDK({ provider });
const maxPriceInLamports = new BN(maxPrice * 1e9);
const nftBuyerAcc = await getAssociatedTokenAddress(
nftMint,
agent.wallet_address,
);
const { tx } = await tensorSwapSdk.buySingleListingT22({
nftMint,
nftBuyerAcc,
owner: agent.wallet_address,
buyer: agent.wallet_address,
maxPrice: maxPriceInLamports,
takerBroker: null,
compute: null,
priorityMicroLamports: null,
transferHook: null,
});
const transaction = new Transaction();
transaction.add(...tx.ixs);
return await agent.connection.sendTransaction(transaction, [
agent.wallet,
...tx.extraSigners,
]);
}
export async function cancelListing(
agent: SolanaAgentKit,
nftMint: PublicKey,