reown-com/react-native-examples

how to send a eth_sendTransaction ?

Closed this issue · 6 comments

KayCm commented

when i use the universalProvider.request(). the deeplink is not work.
but when i use the universalProvider.connect its work well.
my code
`
let reqParams = {
method: 'eth_sendTransaction',
params: [
{
"from": "0x731d12aC09782758C26E4f0e9c66001D103d3F48",
"to": "0x39380B57cc2C612C4AFd1AED450502Ac3c97bb4a",
"data": "",
"gas": "9000000", // 30400
"value": '2441406250'
}
]
}

  universalProvider.request(reqParams).then(res => {
    console.log('broadcastTx success')
    console.log(res)
  }).catch(err => {
    console.log('broadcastTx fail')
    console.log(err)
  })

`

error

ExceptionsManager.js:158 TypeError: Cannot read properties of undefined (reading 'getItem')
at S (index.cjs.js:1:951)
at EventEmitter.t (index.cjs.js:1:847)
at EventEmitter.emit (events.js:153:5)
at ae. (index.cjs.js:1:6931)
at Generator.next ()
at asyncGeneratorStep (asyncToGenerator.js:3:24)
at _next (asyncToGenerator.js:22:9)
at U (web3.min.js:2:468897)
at M (web3.min.js:2:468790)
at MessagePort.y (web3.min.js:2:466768)

As of now deeplinking logic for react native is not implemented, so we'll have to add it as a peerDependency. TL;DR

  1. Check if localStorage is defined and use window.open for redirect
  2. If not defined and we are within react-native env, we need to use it's Linking api
KayCm commented

As of now deeplinking logic for react native is not implemented, so we'll have to add it as a peerDependency. TL;DR

  1. Check if localStorage is defined and use window.open for redirect
  2. If not defined and we are within react-native env, we need to use it's Linking api

thks.
so.. what can i do. for this?

I have same issue when call signer.signMessage(msg). Does it have another ways to signMessage?

Can be resolved by following similar suggested solution here: #14 (comment)

@crypblizz8 your suggested solution not worked, I still received the error: Cannot read property 'getItem' of undefined. After connected to wallet success, then I call this function to sign the message.
const signedMsg = await universalProvider.request({ method: 'personal_sign', params: [msg, currentAccount], });

hey @nhatnguyenbp the issue should be fixed if you install the latest version of @walletconnect/universal-provider

For more context you can check this issue: #26