Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Data don't work if I use transactionParameters #1014

Open
filipe56 opened this issue Sep 9, 2024 · 3 comments
Open

[Bug]: Data don't work if I use transactionParameters #1014

filipe56 opened this issue Sep 9, 2024 · 3 comments
Assignees
Labels
Bug Triage Issues to be triaged in the next session

Comments

@filipe56
Copy link

filipe56 commented Sep 9, 2024

SDK

React-Native

Provide environment information

I'm using react-native and testing on the iPhone. I'm having trouble getting the transfer result and the updated balance.

MetaMask SDK Version

0.28.2

MetaMask Mobile app Version

7.29.2

What browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

No response

Describe the Bug

There is a currency called RAI, however, when I use the function

web3 = new Web3(provider);
contract = new web3.eth.Contract(contractAbi, contractAddress);
contract.methods.transfer(recipient, amount).send({ from: account })

on the web it works, and if I use it for the MetaMask app, it opens the app and shows the name of the currency. But I don't get a response when I'm waiting for the transaction result.
So for the app I tried to use the code below:

web3 = new Web3(provider);
contract = new web3.eth.Contract(contractAbi, contractAddress);
const transactionParameters = {
to,
from,
data: contract.methods.transfer(to, value).encodeABI(),
};
const txHash = await provider?.request({
method: 'eth_sendTransaction',
params: [transactionParameters],
});

The name of the currency does not appear in the MetaMask app, instead the name ERC20 appears.

I tried to use the same function as on the web, but I don't get any feedback when there is no error and I don't know how to get this feedback.

Expected Behavior

Get feedback from the Metamask app whether the transaction was successful or not. And the current balance value.

Link to reproduction - Issues with a link to complete (but minimal) reproduction code will be addressed faster

No response

To Reproduce

package.json:

"@metamask/sdk": "^0.28.2",
"@metamask/sdk-react": "^0.27.0",
"@react-native-async-storage/async-storage": "^2.0.0",
"ethers": "5.7.2",
"react": "^18.2.0",
"react-native": "0.72.7",

Use the function below:

const sendTransaction = async () => {
    const to = inputAdress;
    const value = (parseFloat(inputValue) * 10 ** 4);
    let from = account
    try {
    web3 = new Web3(provider);
    contract = new web3.eth.Contract(contractAbi, contractAddress);
    const transactionParameters = {
      to,
      from, 
      data: contract.methods.transfer(to, value).encodeABI(), 
    };
    
    const txHash = await provider?.request({
      method: 'eth_sendTransaction',
      params: [transactionParameters],
    });
    console.log("txHash",txHash);


    } catch (e) {
      Alert.alert('Erro na transferência');
      setLoading(false);
    }
  };

@filipe56
Copy link
Author

Which pull request has this fix? @summerly01

@christopherferreira9 christopherferreira9 self-assigned this Sep 25, 2024
@christopherferreira9 christopherferreira9 added the Bug Triage Issues to be triaged in the next session label Sep 25, 2024
@christopherferreira9 christopherferreira9 removed their assignment Sep 25, 2024
@FlaviuWeb3 FlaviuWeb3 self-assigned this Sep 30, 2024
@FlaviuWeb3
Copy link
Collaborator

hi @filipe56 I'm trying to reproduce the issue you have, in the mean time would you please try using our latest release and see if that fixes your issue?
Use:
"@metamask/sdk": "^0.29.2",
"@metamask/sdk-react": "^0.29.2",

@filipe56
Copy link
Author

filipe56 commented Oct 19, 2024

@FlaviuWeb3 When I tried, this message appeared

ERROR Error: You must provide dAppMetadata url

This error is located at:
in jf (created by Ff)
in Ff (created by WithSDKConfig)
in WithSDKConfig (created by SafeApp)
in qf (created by SafeApp)
in SafeApp
in RCTView (created by View)
in View (created by AppContainer)
in RCTView (created by View)
in View (created by AppContainer)
in AppContainer
in reserva(RootComponent), js engine: hermes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Triage Issues to be triaged in the next session
Projects
None yet
Development

No branches or pull requests

4 participants
@filipe56 @FlaviuWeb3 @christopherferreira9 and others