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

290
Views
NFT transfer with web3 signTransaction()

I want to transfer an nft from a 'AdminWallet' to a user with js. I have a AdminWallet that has all the nft's in it. Now I want users to be able to claim them with a press of a button.

I am using js code to accomplish this.

I have the following code:

    const tx = {
        from: PUBLIC_KEY,
        to: user_address,
        nonce: nonce,
        gas: 500000,
        data: contract.methods.safeTransferFrom(PUBLIC_KEY, user_address, "1").encodeABI(),
        chain: "rinkeby",
        hardfork: "petersburg"
    }

    const signPromise = web3.eth.accounts.signTransaction(tx, PRIVATE_KEY)
    signPromise
        .then((signedTx) => {
            web3.eth.sendSignedTransaction(
                signedTx.rawTransaction,
                function(err, hash) {
                    if (!err) {
                        console.log(
                            "The hash of your transaction is: ",
                            hash,
                        )
                    } else {
                        console.log(
                            "Something went wrong when submitting your transaction:",
                            err
                        )
                    }
                }
            )
        })
        .catch((err) => {
            console.log(" Promise failed:", err)
        }) 

So what I am trying to do here is send an nft with tokenid '1' from the 'AdminWallet' on the address of PUBLIC_KEY to the user_address.

If I would do it without the signtransaction(), I would call the following: contract.methods.safeTransferFrom(PUBLIC_KEY, user_address, "1").send({ from: PUBLIC_KEY})

From what I could find the signTransaction() calls the .Call() of the tx data. If I want to transfer the nft with my original way I have to call the .send() function.

Is there anyway to call the .send() function to sign the automatically sign the transaction?

about 4 years ago · Juan Pablo Isaza
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!