Create autosigned transaction approval using ethers and metamask

I am asking about the bidding system of nft in opensea. When the user participate in a bidding , the user enter a bid amount but the amount would not transfer at that time. The money will transfer from the bidder when the owner of the NFT accept the bid offer. When the owner accept the bid offer the money in the bidder’s wallet will transfer automatically without any notification. I want to know How is this works ?

because i would like to do this in my project too .

in my project smart contract :

function placeBid(uint256 _tokenId,uint256 _bidPrice) public  {

    require(nftDetails[_tokenId].inAuction, "Auction not in progress");

    require(_bidPrice > nftDetails[_tokenId].basePrice,"Bid price is lower than base price");

    require(msg.value > nftDetails[_tokenId].highestBid, "Bid must be higher than current highest bid");

    if (nftDetails[_tokenId].highestBidder != address(0)) {



    // Update highest bid and bidder

    nftDetails[_tokenId].highestBid = msg.value;

    nftDetails[_tokenId].highestBidder = msg.sender;

    emit placedBid(msg.sender, _tokenId, block.timestamp, _bidPrice);


function endAuction(uint256 _tokenId) public onlyOwner {

    address owner = ownerOf(_tokenId);

    require(nftDetails[_tokenId].inAuction, "Auction not in progress");

    require(block.timestamp >= nftDetails[_tokenId].auctionEndTime, "Auction has not ended yet");

    address seller = ownerOf(_tokenId);

    address highestBidder = nftDetails[_tokenId].highestBidder;

    uint256 winningBid = nftDetails[_tokenId].highestBid;


    _transfer(seller, highestBidder, _tokenId);


    // Reset auction details

    nftDetails[_tokenId].inAuction = false;

    nftDetails[_tokenId].auctionEndTime = 0;

    nftDetails[_tokenId].basePrice = 0;

    emit auctionEnded(seller, highestBidder, _tokenId, block.timestamp, winningBid);


In my frontend :

const placeBid = async(contractAddress:any,price:any)=>{

  try {

    const provider = await new ethers.BrowserProvider((window as any).ethereum);

    await provider.send("eth_requestAccounts", []);

    const signers = await provider.getSigner();

    if (signers) {

      const contractInstance = new ethers.Contract(





      // How to send the request ???


  } catch (error) {




if any one Knows this please help.

1 Like

Hi @SaM1

Answer your question here. I hope this is for the same issue.