Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

174
Views
change `msg.sender` in solidity and ether.js

I have Smartcontract with solidity . in this smart contract i have function with name makeMarketItem .

  function makeMarketItem(
        address nftContract,
        uint256 tokenId,
        uint256 price
    ) public payable nonReentrant {
        IERC721(nftContract).transferFrom(msg.sender, address(this), tokenId);
}

I call this function with ethers library in nodejs .

Inital this smart contract with ethers by this way :

static async Initial(): Promise<any> {

    let provider = new ethers.providers.JsonRpcProvider(config.contractConfig.url);
    const signer = provider.getSigner();

    this.tokenContract = new ethers.Contract(NFT.networks['5777'].address, NFT.abi, signer);
    this.dNFT = new ethers.Contract(DNFT.networks['5777'].address, DNFT.abi, signer);

}

i want to called that function by this way :

 transaction = this.dNFT.makeMarketItem(
                this.tokenContract.address,
                tokenId,
                price,
                {
                    value: listPricing.result
                }
            );

Problem: I need to change value of msg.sender .

How can I change msg.sender address ?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

I think the .connect() method is what you're looking for, you can use it to call a contract method from a particular address/signer:

const [owner, addr1] = await ethers.getSigners();
this.dNFT.connect(addr1).makeMarketItem(...);
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!