The following code to sell a nft working perfectly with nodejs .But when I try to run it in reactjs it is showing error. Code is
` const auctionHousee = await metaplex
.auctionHouse()
.findByAddress({ address: new PublicKey("Gu95mJVHCW4Ltu3HZ...33D64CSxDZ6mYcAu8") });
const bid = await metaplex
.auctionHouse()
.findBidByReceipt({receiptAddress:new PublicKey("77mVr6MBYp9LBBfXnU....3ieuQcPG22DdqvtVvLT"),
auctionHouse:auctionHousee})
console.log('bids',bid);
// let nftnewval = JSON.parse(nftval);
console.log('newval',newval);
console.log('something',JSON.parse(newval).token)
const directBuyResponse = await metaplex
.auctionHouse()
.sell({
auctionHouse:auctionHousee, // The Auction House in which to create a Bid and execute a Sale
seller: metaplex.identity(), // Creator of a bid, should not be the same as seller who creates a Listing
authority: new PublicKey("3BrujtCK9nzFX...e8yR5xrBEKRJbxMAkapco"),
bid:bid
})
;
console.log(directBuyResponse);`
Now when I put it in a function and try to run it reactjs compilation is failed with the following error
ERROR in src/App.tsx:322:16 TS2345: Argument of type '{ auctionHouse: Readonly<{ model: "auctionHouse"; address: Pda; creatorAddress: PublicKey; authorityAddress: PublicKey; treasuryMint: Mint; feeAccountAddress: Pda; ... 7 more ...; scopes: AuthorityScope[]; } & { ...; }> | Readonly<...>; seller: IdentityClient; authority: PublicKey; bid: Readonly<...> | Readonly<...>...' is not assignable to parameter of type 'DirectSellInput'. Type '{ auctionHouse: Readonly<{ model: "auctionHouse"; address: Pda; creatorAddress: PublicKey; authorityAddress: PublicKey; treasuryMint: Mint; feeAccountAddress: Pda; ... 7 more ...; scopes: AuthorityScope[]; } & { ...; }> | Readonly<...>; seller: IdentityClient; authority: PublicKey; bid: Readonly<...> | Readonly<...>...' is not assignable to type '{ auctionHouse: AuctionHouse; authority?: PublicKey | Signer | undefined; seller?: PublicKey | Signer | undefined; auctioneerAuthority?: Signer | undefined; bookkeeper?: Signer | undefined; printReceipt?: boolean | undefined; } & { ...; }'. Type '{ auctionHouse: Readonly<{ model: "auctionHouse"; address: Pda; creatorAddress: PublicKey; authorityAddress: PublicKey; treasuryMint: Mint; feeAccountAddress: Pda; ... 7 more ...; scopes: AuthorityScope[]; } & { ...; }> | Readonly<...>; seller: IdentityClient; authority: PublicKey; bid: Readonly<...> | Readonly<...>...' is not assignable to type '{ sellerToken?: null | undefined; bid: Omit<Readonly<{ model: "bid"; lazy: false; auctionHouse: AuctionHouse; tradeStateAddress: Pda; buyerAddress: PublicKey; bookkeeperAddress: Option<...>; ... 5 more ...; canceledAt: Option<...>; } & { ...; }> & { ...; }, "bookkeeperAddress" | ... 1 more ... | "createdAt">; }'. Types of property 'bid' are incompatible. Type 'Readonly<{ model: "bid"; lazy: false; auctionHouse: AuctionHouse; tradeStateAddress: Pda; buyerAddress: PublicKey; bookkeeperAddress: Option; ... 5 more ...; canceledAt: Option<...>; } & { ...; }> | Readonly<...>' is not assignable to type 'Omit<Readonly<{ model: "bid"; lazy: false; auctionHouse: AuctionHouse; tradeStateAddress: Pda; buyerAddress: PublicKey; bookkeeperAddress: Option; ... 5 more ...; canceledAt: Option<...>; } & { ...; }> & { ...; }, "bookkeeperAddress" | ... 1 more ... | "createdAt">'. Type 'Readonly<{ model: "bid"; lazy: false; auctionHouse: AuctionHouse; tradeStateAddress: Pda; buyerAddress: PublicKey; bookkeeperAddress: Option; ... 5 more ...; canceledAt: Option<...>; } & { ...; }>' is not assignable to type 'Omit<Readonly<{ model: "bid"; lazy: false; auctionHouse: AuctionHouse; tradeStateAddress: Pda; buyerAddress: PublicKey; bookkeeperAddress: Option; ... 5 more ...; canceledAt: Option<...>; } & { ...; }> & { ...; }, "bookkeeperAddress" | ... 1 more ... | "createdAt">'. Types of property 'asset' are incompatible. Type 'Nft | Sft' is not assignable to type 'NftWithToken | SftWithToken'. Type 'Nft' is not assignable to type 'NftWithToken | SftWithToken'. Type 'Nft' is not assignable to type 'NftWithToken'. Property 'token' is missing in type 'Nft' but required in type '{ token: Token; }'. 320 | .auctionHouse() 321 |
322 | .sell({ | ^
I tried to run the above code in nodejs with keypair identity and it worked. I provided the same arguments in nodejs as I am providing in reactjs but reactjs is not compiling and throwing the above error.