Deep Mind AI
  • Introduction
  • Examples
    • Getting Started with NextJS
    • Telegram Agent
    • Persistent Agent with PostgreSQL
    • AI Guided Market Making Agent
    • Discord Agent Integration
  • Guides
    • Add your own tool
    • Setup locally
    • Test it out
  • Features
    • Transfer Tokens
    • Stake SOL
    • Deploy SPL Token
    • Check Token Balances
    • Token Data Retrieval
    • Deploy NFT Collection
    • Mint NFT
    • Tensor NFT Marketplace
    • Jupiter Exchange Swaps
    • Solana Name Service (SNS)
    • Launch Token on Pump.fun
Powered by GitBook
On this page
  • ​Core Features
  • ​Usage
  • ​Example Prompts
  • ​Implementation Details
  • ​Error Handling
  • ​Best Practices
  • ​Common Issues
  • ​Response Format
  • ​SDK Integration
  • ​Advanced Features
  1. Features

Tensor NFT Marketplace

List and manage NFTs on Tensor Trade

PreviousMint NFTNextJupiter Exchange Swaps

Last updated 3 months ago

Interact with Tensor Trade marketplace to list and manage NFTs. This implementation provides functionality for listing NFTs for sale and canceling existing listings.

Core Features

  1. Listing Management

    • List NFTs for sale

    • Cancel listings

    • Price setting

    • Ownership verification

  2. Token Account

    • Associated token validation

    • Ownership checks

    • Balance verification

    • Account creation

Usage

List NFT for Sale

// List NFT
const signature = await agent.tensorListNFT(
  new PublicKey("nft-mint-address"),
  1.5  // Price in SOL
);
// Cancel listing
const signature = await agent.tensorCancelListing(
  new PublicKey("nft-mint-address")
);
"List my NFT for 2 SOL on Tensor"

"Cancel my NFT listing on Tensor"

"Put NFT up for sale at 1.5 SOL"

"Remove NFT listing from marketplace"
{
  "nftMint": "nft-mint-address",
  "price": 1.5
}
{
  "nftMint": "nft-mint-address"
}
interface ListingParams {
  nftMint: PublicKey;      // NFT mint address
  nftSource: PublicKey;    // Token account
  owner: PublicKey;        // Owner address
  price: BN;              // Price in lamports
  tokenProgram: PublicKey; // Token program ID
  payer: PublicKey;       // Transaction payer
}

// Price conversion
const priceInLamports = new BN(price * 1e9);
// Get Associated Token Account
const ata = await getAssociatedTokenAddress(
  nftMint, 
  ownerAddress
);

// Verify ownership
const tokenAccount = await getAccount(
  connection,
  ata
);

if (!tokenAccount || tokenAccount.amount <= 0) {
  throw new Error("NFT not owned");
}
try {
  const tx = await agent.tensorListNFT(mint, price);
} catch (error) {
  if (error.message.includes("NFT not found")) {
    // Handle missing NFT
  } else if (error.message.includes("Invalid mint")) {
    // Handle invalid address
  }
}
  1. Listing Management

    • Verify ownership first

    • Check token accounts

    • Validate prices

    • Monitor transactions

  2. Token Handling

    • Verify mint addresses

    • Check balances

    • Validate accounts

    • Handle permissions

  3. Transaction Processing

    • Build transactions properly

    • Include all signers

    • Handle timeouts

    • Monitor status

  1. Listing Issues

    • Invalid mint address

    • NFT not owned

    • Price formatting

    • Account mismatch

  2. Cancellation Issues

    • Listing not found

    • Permission denied

    • Network errors

    • Transaction failures

  3. Account Issues

    • Missing ATA

    • Zero balance

    • Wrong owner

    • Program mismatch

{
  status: "success",
  message: "NFT listed successfully",
  transaction: "transaction-signature",
  price: 1.5,
  nftMint: "mint-address"
}
{
  status: "error",
  message: "Error message",
  code: "ERROR_CODE"
}
const provider = new AnchorProvider(
  connection,
  wallet,
  AnchorProvider.defaultOptions()
);

const tensorSwapSdk = new TensorSwapSDK({ provider });
// Build transaction
const { tx } = await tensorSwapSdk.list(params);

// Create and send transaction
const transaction = new Transaction();
transaction.add(...tx.ixs);
return await connection.sendTransaction(
  transaction,
  [wallet, ...tx.extraSigners]
);
  1. Custom Token Programs

    • SPL Token support

    • Program validation

    • Account creation

    • Balance management

  2. Authorization

    • Auth data handling

    • Permission checks

    • Signature validation

    • Access control

  3. Price Management

    • Lamport conversion

    • Price validation

    • Fee calculation

    • Slippage protection

Cancel Listing

Example Prompts

Natural Language Prompts

LangChain Tool Prompts

List NFT

Cancel Listing

Implementation Details

Listing Process

Ownership Verification

Error Handling

Best Practices

Common Issues

Response Format

Success Response

Error Response

SDK Integration

TensorSwap SDK Setup

Transaction Building

Advanced Features

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​