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

88
Views
issue when interacting with Trust Wallet

I'm developing a dApp using web3 library. In some case the user has to decide how they want to connect, either MetaMask or WalletConnect.

So, when the user decides to connect with WalletConnect there is no problem with the connection itself but I have an issue when I want to interact with Smart Contract. Suppose I want to approve to user amount for stake or check the balance.

export const schooseProvider = provider => {
// debugger
console.log("schooseProvider: ", provider );
    if(provider === "MetaMask"){ 
        console.log("Selected Provider: ", window.ethereum)
        W3 = new Web3(window.ethereum) 
    }
    else if(provider === "WalletConnect"){
       const provider = new WalletConnectProvider({
        infuraId: '20c6beb49cd1402db84120a858bc74af',
        bridge: 'https://bridge.walletconnect.org',
        supportedChainIds,
        rpc: {
            3: 'https://ropsten.infura.io/v3/20c6beb49cd1402db84120a858bc74af'
            }
        })
        console.log("Selected Provider: ", provider)
        W3 = new Web3(provider)
    }
}

export const approve = async (account) => {
    try{
        store.dispatch(updateAproveButtonsLoader(true))
        await contract.methods.approve(stakeAddress,'10000000000000000000000000000000000000000000000000').send({from: account})
        .once('receipt', function(receipt){
            store.dispatch(updateApproveButtonsLoader(false))
            store.dispatch(updateApproved(true))
            checkAllowence(account)
        })
        .on('error', () => {
            store.dispatch(updateApproveButtonsLoader(false))
        })
    }
    catch(error){
        store.dispatch(updateApproveButtonsLoader(false))
        console.log(error)
    }
}

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!