xmtp / xmtp-quickstart-react-native

1 stars 0 forks source link

Bug: Unable to create xmtp client in production env #6

Closed romiltiwari93 closed 1 year ago

romiltiwari93 commented 1 year ago

Describe the bug

Tried to create an xmtp client connected to the production network. Used the signer associated with 0x25B2100911cCEB45d32aDC4201CFdC8D5d4C26C6 address. I get the below error: OperationError: The operation failed for an operation-specific reason

It does not happen with other signers. I can connect to the dev network using the same signer without any issues.

Expected behavior

I get the client connected to the production network

Steps to reproduce the bug

Updated the connectRandomWallet command https://github.com/xmtp/xmtp-quickstart-react-native/blob/main/html/src/main.ts#:~:text=commands%20%3D%20%7B-,connectRandomWallet,-%3A%20async%20( as:

connectRandomWallet: async (): Promise<string> => {
    const wallet = new Wallet(<private_key_string>);
    client = await Client.create(wallet, { env: "production" });
    return client.address;
  }

This is happening with a specific signer only associated with 0x25B2100911cCEB45d32aDC4201CFdC8D5d4C26C6 wallet address. Other signers work fine.

saulmc commented 1 year ago

@romiltiwari93 had you used 0x25B2100911cCEB45d32aDC4201CFdC8D5d4C26C6 anywhere else prior to calling the modified connectRandomWallet?

romiltiwari93 commented 1 year ago

@saulmc I had connected this wallet to https://xmtp.chat earlier. Also had tried this wallet earlier while integrating xmtp into Obvious via the polyfills route. Haven't been able to get onto the production network with this wallet in that example as well

saulmc commented 1 year ago

Had it worked with xmtp.chat previously, or did it only stop working with xmtp.chat after trying to integrate with polyfills?

romiltiwari93 commented 1 year ago

It had worked with xmtp.chat previously, I remember having sent messages via this wallet. But in between while integrating with either the polyfills way/ webview proxy way, it stopped working

saulmc commented 1 year ago

Reposting the error you shared over Slack from the xmtp.chat console:

image

Did you encounter any other errors along the way?

romiltiwari93 commented 1 year ago

Nope. This is the error I get. Steps to reproduce:

romiltiwari93 commented 1 year ago
Screenshot 2023-04-20 at 10 09 04 PM

This is the state if I try and connect the same wallet via the injected MetaMask wallet extension

saulmc commented 1 year ago

Would you be able to share a full console.log stack trace of the error?

romiltiwari93 commented 1 year ago

This is what I get when running the webview react-native example

Screenshot 2023-04-21 at 11 19 35 AM

This is what I get when connecting xmtp.chat with metamask extension

index-dbf4d8435e89022d.js:1 Uncaught (in promise) Error
await (async)
(anonymous) @ index-dbf4d8435e89022d.js:1
uU @ framework-36098b990598bc0c.js:9
oV @ framework-36098b990598bc0c.js:9
(anonymous) @ framework-36098b990598bc0c.js:9
oU @ framework-36098b990598bc0c.js:9
oP @ framework-36098b990598bc0c.js:9
r8 @ framework-36098b990598bc0c.js:9
(anonymous) @ framework-36098b990598bc0c.js:9
setTimeout (async)
(anonymous) @ _app-fa97dcf4b662e99b.js:184
E @ _app-fa97dcf4b662e99b.js:184
A @ _app-fa97dcf4b662e99b.js:184
s @ _app-fa97dcf4b662e99b.js:184
i @ _app-fa97dcf4b662e99b.js:184
dispatch @ _app-fa97dcf4b662e99b.js:184
setData @ _app-fa97dcf4b662e99b.js:184
onSuccess @ _app-fa97dcf4b662e99b.js:184
f @ _app-fa97dcf4b662e99b.js:184
Promise.then (async)
m @ _app-fa97dcf4b662e99b.js:184
H @ _app-fa97dcf4b662e99b.js:184
fetch @ _app-fa97dcf4b662e99b.js:184
executeFetch @ _app-fa97dcf4b662e99b.js:184
setOptions @ _app-fa97dcf4b662e99b.js:184
(anonymous) @ _app-fa97dcf4b662e99b.js:184
uU @ framework-36098b990598bc0c.js:9
oV @ framework-36098b990598bc0c.js:9
(anonymous) @ framework-36098b990598bc0c.js:9
oU @ framework-36098b990598bc0c.js:9
oP @ framework-36098b990598bc0c.js:9
r8 @ framework-36098b990598bc0c.js:9
(anonymous) @ framework-36098b990598bc0c.js:9
setTimeout (async)
(anonymous) @ inpage.js:17
write @ inpage.js:17
b @ inpage.js:17
(anonymous) @ inpage.js:17
v.write @ inpage.js:17
g @ inpage.js:17
h @ inpage.js:8
o.emit @ inpage.js:8
_ @ inpage.js:17
w @ inpage.js:17
b.push @ inpage.js:17
_write @ inpage.js:1
b @ inpage.js:17
(anonymous) @ inpage.js:17
v.write @ inpage.js:17
g @ inpage.js:1
h @ inpage.js:8
o.emit @ inpage.js:8
_ @ inpage.js:1
w @ inpage.js:1
b.push @ inpage.js:1
_onData @ inpage.js:1
_onMessage @ inpage.js:1
postMessage (async)
_postMessage @ contentscript.js:1
_write @ contentscript.js:1
v @ contentscript.js:1
(anonymous) @ contentscript.js:1
y.write @ contentscript.js:1
g @ contentscript.js:17
h @ contentscript.js:8
o.emit @ contentscript.js:8
_ @ contentscript.js:17
w @ contentscript.js:17
v.push @ contentscript.js:17
_write @ contentscript.js:17
v @ contentscript.js:17
(anonymous) @ contentscript.js:17
y.write @ contentscript.js:17
g @ contentscript.js:17
h @ contentscript.js:8
o.emit @ contentscript.js:8
_ @ contentscript.js:17
w @ contentscript.js:17
v.push @ contentscript.js:17
_write @ contentscript.js:17
v @ contentscript.js:17
(anonymous) @ contentscript.js:17
y.write @ contentscript.js:17
g @ contentscript.js:17
h @ contentscript.js:8
o.emit @ contentscript.js:8
_ @ contentscript.js:17
w @ contentscript.js:17
v.push @ contentscript.js:17
_onMessage @ contentscript.js:8
(anonymous) @ contentscript.js:8

Let me know if you'd like to get on a quick call to figure this out

nplasterer commented 1 year ago

Hey @romiltiwari93 we've migrated the webview implementation to our npm package. There is a more indepth example app over here: https://github.com/xmtp/xmtp-react-native or you can checkout the quickstart updates to this repo. Let us know if you're still blocked.