3

I am trying to use Metaplex JS SDK to list NFT. My code is as per below:

const METAPLEX = Metaplex.make(connection)
    .use(keypairIdentity(wallet))
    .use(bundlrStorage({
        address: 'https://devnet.bundlr.network',
        providerUrl: rpcUrl,
        timeout: 60000,
    }));    

const myAuctionAuthority = Keypair.generate();
    
const auctionHouse = await METAPLEX
     .auctionHouse()
     .create({
         sellerFeeBasisPoints: 500,
         authority: myAuctionAuthority,
     });


const auctionHouseList = await METAPLEX
.auctionHouse()
.list({
    auctionHouse,                              // A model of the Auction House related to this listing
    seller: Keypair.generate(),                // Creator of a listing
    authority: myAuctionAuthority,             // The Auction House authority
    mintAccount: new PublicKey("......"), // The mint account to create a listing for, used to find the metadata
    tokenAccount: new PublicKey("....."), // The token account address that's associated to the asset a listing created is for 
    price: 5000000000,                                  // The listing price
    tokens: 1                                  // The number of tokens to list, for an NFT listing it must be 1 token
});

However it returns below error:

const price = auctionHouse.isNative ? lamports(priceBasisPoint) : amount(priceBasisPoint, auctionHouse.treasuryMint.currency);
                                                                                                                      ^

TypeError: Cannot read properties of undefined (reading 'currency')

I have done several testing. It seems the problem incurs on listing part. Anyone has any idea what went wrong with my code? Thanks a lot!

1
  • Did you find the solution? How can we give price format while listing??
    – Maidi
    Jul 31, 2023 at 8:06

2 Answers 2

0

Please go through the implementation of this GitHub you will be able solve the issue https://github.com/FraNoceti/InvestConservation-Marketplace

The format of price is not correct, it requires some extra info, the above link will help you out

0

When creating the auction house, you will obtain a treasuryMint object, which defines the mint account of the SPL token to be utilized as the currency of exchange. You can subsequently invoke this object within the context of the auction house when listing items, effectively resolving the issue.

This site is temporarily in read-only mode and not accepting new answers.

Not the answer you're looking for? Browse other questions tagged .