Giter Club home page Giter Club logo

web-examples's Introduction

WalletConnect v2 Examples

Catalogue of various wallet and dapp examples implementing WalletConnect's SDKs and APIs. Each example contains its own README with further instructions and explanations.

Web3Modal SDK

Web3Wallet SDK

Wallets:

Sign API

Wallets:

dApps:

Auth API

Wallets:

dApps:

Chat API

Wallets:

web-examples's People

Contributors

amirsaran3 avatar arein avatar bacis avatar bkrem avatar cali93 avatar chadyj avatar crypblizz8 avatar devceline avatar finessevanes avatar ganchoradkov avatar githubdoramon avatar glitch-txs avatar hamidra avatar iljadaderko avatar jonathanconn avatar kannusingh avatar kathaypacific avatar kujtimprenkusqa avatar lukaisailovic avatar mrakoczy-fp avatar myzykj avatar pedrouid avatar pyncz avatar quetool avatar radumojic avatar renovate[bot] avatar rtomas avatar tomiir avatar velvet-shark avatar xzilja avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

web-examples's Issues

Why Does Wallet .toLowerCase() the Address?

export function getWalletAddressFromParams(addresses: string[], params: any) {

I'm getting an address from the wallet that has upper case characters, but the eth wallet expects lower case.

Is there a reason for this?
Why doesn't the wallet send me the address with lowercase characters?

I'll admit, I'm not 100% familiar with eth addresses, I feel like they aren't case sensitive, but I might be wrong.
If they are case sensitive, then we DEFINITELY shouldn't be lowercasing them in the example.

React dapp - per-chain genesis hash for Polkadot-like networks

We found out that https://react-app.walletconnect.com dapp uses same genesis hash for both Westend and Polkadot.

Genesis hash is a replay-attack prevention mechanism that is used to specify which network transaction will be submitted in. Currently dapp uses Westend genesis hash for both Polkadot and Westend.

Ideally, different genesis hashes should be used for different networks so wallets will be able to corrently identify network of transaction:

Polkadot: 0x91b171bb158e2d3848fa23a9f1c25182fb8e20313b2c1eb49219da7a70ce90c3
Westend: 0xe143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423e

WebSocket connection failed

Tried react-dapp-v2 react-dapp-v2-with-ethers and wallets/react-wallet-v2
All have the same issue

Screenshot 2023-04-26 at 20 29 23

Node version: 14, 16, 18

I can confirm the project_id is correct by using is in the react-native project, which works.

(Missing or invalid \"message\" param) or (Cannot read properties of undefined (reading 'MISSING_OR_INVALID'))

Describe the bug
https://github.com/WalletConnect/web-examples demo:
{
"code": -32000,
"message": "Missing or invalid "message" param"
}
vue3 demo:
Cannot read properties of undefined (reading 'MISSING_OR_INVALID')

Request sent by localhost:

wss://relay.walletconnect.com/?auth=eyJhbGciOiJFZERTQSIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJkaWQ6a2V5Ono2TWtzSjRmS0o5bjlWejFzS0JFNm9SZTNOQ0VDOVJFN3RjVzh1OG5iQlZuWjlBUyIsInN1YiI6IjRjYzM3ZGM0NDM4MDI1MTkyYjllMThmMDcxNTE5NTVjNzcxNzc4ZjQ0Yzk4ZWY1YTRlMmY3NjY4ZDI5ZWE3NzYifQ.3b1UxCYZEpFA5l6V3iNm3WkpVzIvWTTS8KRAF4-T-IXScd8QAbxYlLpNpG3clhgSUMb_nkbEhWFtifBffKO4CA&env=browser&host=localhost%3A3000&projectId=e5739330c8161e5ce015a7f70491b7af&protocol=wc&version=2

redundant sent parameters:

  1. auth=eyJhb……
  2. env=browser
  3. host=localhost%3A3000
  4. projectId=e5739330c8161e5ce015a7f70491b7af
  5. protocol=wc
  6. version=2

a month ago

Download the 2.0.0-beta.100 code from https://github.com/WalletConnect/web-examples a month ago, and install it with npm install, it runs successfully. Successfully migrated WalletConnect to vue3+ts+vue-cli demo.

2022/7/5

Download the 2.0.0-beta.100 code from https://github.com/WalletConnect/web-examples and install it with npm install, but the QR code generation fails. Use yarn to install and run successfully.
vue3+ts+vue-cli demo After deleting node_modules, re-npm install or yarn, the operation fails to generate QR code.
The reason for the failure is that the request sent carries the auth parameter.

SDK Version (if relevant)

  • Client: @walletconnect/sign-client
  • Version 2.0.0-beta.100

To Reproduce
Steps to reproduce the behavior:

  1. download zip: https://github.com/WalletConnect/web-examples/tree/beta-100
  2. Modify the REACT_APP_PROJECT_ID parameter
  3. npm install
  4. npm run start

Expected behavior
The QR code is displayed successfully and the connection is successful

Screenshots

https://github.com/WalletConnect/web-examples/tree/beta-100 demo

vue3 demo:

Desktop (please complete the following information):

  • OS: MAC M1
  • Browser chrome
  • Version Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36

JavaScript/ Web examples

Hi all!
I noticed that currently there are only React-based examples here as well as the V2 startup pages.

There is a Node.js section but that combined with the examples here allude to WalletConnect may not be compatible with native JS or JS frameworks outside of React.

I'm an Angular-specific dev but native JS and TS can be applied directly within that framework.

Please let me know how I can best help.

Remove eth_sign and eth_signTransaction

It would be reasonable to remove the support for these methods (eth_sign, eth_signTransaction) due to security reasons to not incentivise wallet developers and dApp developers to use these methods out in the wild. We must currently add exceptions to our supported list of methods to be able to test our wallet integration with the dApp.

References:

An alternative would be to make it possible to select what methods you want to send in the sessionProposal from the react-app to the wallet.

IOS : RangeError: Maximum call stack size exceeded.

version:
"@walletconnect/web3wallet": "^1.5.1" @walletconnect/sign-client": "^2.6.2"

source code:
core.pairing.pair({ uri: wcuri })

error message:
ERROR {"context": "core"} {"context": "core/relayer"} [RangeError: Maximum call stack size exceeded.]

EthereumRopsten, Goerli, etc.. Infura API's failing

Hi team, the example.walletconnect.org site has been down for 3 days.

Reason is 429 - Too many requests and some internal server errors (500) as well.

[Error] Failed to load resource: the server responded with a status of 429 () (774b1e4252de48c3997d66ac5f5078d8, line 0) [Error] Failed to load resource: the server responded with a status of 429 () (774b1e4252de48c3997d66ac5f5078d8, line 0) [Error] Failed to load resource: the server responded with a status of 429 () (774b1e4252de48c3997d66ac5f5078d8, line 0) [Error] Failed to load resource: the server responded with a status of 429 () (774b1e4252de48c3997d66ac5f5078d8, line 0) [Error] Failed to load resource: the server responded with a status of 429 () (774b1e4252de48c3997d66ac5f5078d8, line 0) [Error] Failed to load resource: the server responded with a status of 429 () (774b1e4252de48c3997d66ac5f5078d8, line 0) [Error] Failed to load resource: the server responded with a status of 429 () (774b1e4252de48c3997d66ac5f5078d8, line 0)

Message signature function has some error.

in HelperUtils.ts, getSignParamsMessage function returns original message,
but this function returns an error if the message is exactly 20 bytes.

/**
 * Gets message from various signing request methods by filtering out
 * a value that is not an address (thus is a message).
 * If it is a hex string, it gets converted to utf8 string
 */
export function getSignParamsMessage(params: string[]) {
  const message = params.filter(p => !utils.isAddress(p))[0]

  return convertHexToUtf8(message)
}

Because the address in params is filtered, the 20 Bytes message is treated as an address and the message is not returned.

As an example, suppose we sign the message Is this 20 bytes ???,
which is converted to 0x49732074686973203230206279746573203f3f3f,
and the isAddress function cannot distinguish whether this is a message or an address.

  switch (request.method) {
    case EIP155_SIGNING_METHODS.PERSONAL_SIGN:
    case EIP155_SIGNING_METHODS.ETH_SIGN:
      const message = getSignParamsMessage(request.params)
      const signedMessage = await wallet.signMessage(message)
      return formatJsonRpcResult(id, signedMessage)

I know the function is like this because the parameter order of PERSONAL_SIGN and ETH_SIGN are different,
but I think this part should be modified.

thx!

Sunset `rust-relay` Sample Apps

  • https://staging-rust.react-wallet.walletconnect.com/
  • https://staging-rust.react-app.walletconnect.com/

Can be remove as we sunsetted ts relay in favor of rs relay.

[dApp] Problem with smart contract wallet integration

We have an NFT renting product, rntd.io ,This product is still under development. We are still in the alpha version, we used walletConnect V1 to integrate our smart contract wallet with projects.
In V1, we did not face any problems with the integration with other projects, we used to authenticate personal_sign and typed_data to our smart contract with no effort due to verifySignature function that checks if the address is EOA address or smart contract address
https://github.com/WalletConnect/walletconnect-example-dapp/blob/master/src/helpers/utilities.ts#L181

But in V2, the provided dApp examples use verifyEip155MessageSignature, which is only valid for EOA wallets, not for smart contract wallets that rely on the concept of erc1271.
https://github.com/WalletConnect/web-examples/blob/main/dapps/react-dapp-v2-with-ethers/src/pages/index.tsx#L69
When the function recovers the address of the wallet that signed the message, which owns the smart contract wallet, and compare it to the smart contract address, the validation will fail. As a result, we can not verify the personal message.
My question is, what are we missing, or what can we do to overcome this problem

Better error message

When invoking eth_signTransaction on Arbitrum Rinkeby, the console shows HTTP error 500, looks like API doesn't support this method call.

But the message is identical as the client user rejects the request. This may misguide the wallet developers to think about it's a client-side error.
image

eip155 and solana are returned under same eip155 namespace

Selecting eth, polygon and solana creates request with following requiredNamespace

"eip155": {
    "methods": [
        "eth_sendTransaction",
        "eth_signTransaction",
        "eth_sign",
        "personal_sign",
        "eth_signTypedData",
        "solana_signTransaction",
        "solana_signMessage"
    ],
    "chains": [
        "eip155:42",
        "eip155:80001",
        "solana:8E9rvCKLFQia2Y35HXjjpWzj8weVo44K"
    ],
    "events": [
        "chainChanged",
        "accountsChanged"
    ]
}

it should be

"eip155": {
    "methods": [
        "eth_sendTransaction",
        "eth_signTransaction",
        "eth_sign",
        "personal_sign",
        "eth_signTypedData"
    ],
    "chains": [
        "eip155:42",
        "eip155:80001"
    ],
    "events": [
        "chainChanged",
        "accountsChanged"
    ]
},
"solana": {
   "methods": [
        "solana_signTransaction",
        "solana_signMessage"
   ],
   "chains": [ "solana:8E9rvCKLFQia2Y35HXjjpWzj8weVo44K" ],
   "events": [ ]
}

Type error: Cannot read properties of undefined ('reading message')

Hi!

After following the instructions to install WalletConnect (i.e. cloning the WalletConnect repository, running yarn, running yarn start), I get the error as follows:

Type error: Cannot read properties of undefined ('reading message')

This error pops up whether I am trying to run REACT-DAPP-V2 or REACT-DAPP-V2-WITH-WEB-JS.

It appears to be the same error experienced in issue #13, which was closed for some reason. Note that the solution that was proposed in issue #13 does not seem to be appropriate to solving this problem, since I am not trying to run the program from a branch directory or anything like that..

Has anyone else experienced this issue, or can please help me to solve it? Thanks,

Connecting doesn't work in the examples on android

if I go to https://react-app.walletconnect.com/ , choose Ethereum mainnet, scan the QR with TrustWallet or MetaMask app on android, the app recognises the modal, but doesn't show anything, just "Connecting might take a couple of seconds", but nothing happens. Or sometimes it works once, but if I dissmiss the connect modal in the app, and try to connect again, nothing happens.

But if I scan the QR code here https://cloud.walletconnect.com/sign-in it works everytime in TrustWallet. So what's different there? I can't figure it out.

Default examples to mainnet

Several wallets have been testing https://react-app.walletconnect.com/ but have complained that it doesn't work.

After doing some digging it turns out they were trying to connect to a testnet, since the examples default to this.

Screenshot 2022-11-18 at 10 59 17

To fix this, can we simply default to mainnet? It will hopefully help developers.

when i run yarn start,the browser will show this error bellow.

hello,when use the brance feat/modal-v2-integration,under the folder react-dapp-v2-with-web3js , when i run yarn,yarn start,the broswer where show the error bellow:

image

i am not sure what this happen? can you help me to solve it?

thanks you very much

Wallet's `session_event` emit throws with some chain combinations

Describe the bug
Wallet's session_event emit throws with some chain combinations.

SDK Version (if relevant)

To Reproduce
Steps to reproduce the behavior:

  1. Go to https://react-app.walletconnect.com/
  2. Select e.g. Ethereum Kovan and Solana Devnet (this only seems to happen with some chains not with others)
  3. Pair on https://react-wallet.walletconnect.com/
  4. Go to Sessions view on the wallet
  5. Click "Emit" button
  6. Throws the error below:
{
    "code": 1000,
    "message": "Missing or invalid emit chainId"
}

Expected behavior
To emit a session_event regardless of selected chains.

Screenshots

Screenshot 2022-05-31 at 13 41 27

@json-rpc-tools/utils is deprecated

As you can see here, @json-rpc-tools/utils package is deprecated.
Is there an alternative way to construct my response in the wallet, for example, in
web-examples/wallets/react-wallet-v2/src/utils/EIP155RequestHandlerUtil.ts
all the responses are built with the formatJsonRpcResult method from this package.

react-app.walletconnect.com Signature verification - Is it off spec?

I just tried multiple libs with react-app.walletconnect.com and here are my issues.

  1. For eth_sendTransaction and eth_signTransaction, the signature validity comes as true (Again it is just hardcoded as true there anyway)
  2. For eth_personalSign and signing typed data, Is it off the actual spec ?
    For personal Sign I'm using Sign.signPrefixedMessage() and hex encoding the result with Numeric.toHexString. But still the "valid" flag is always set to false. I'm not sure if there are any discrepancies in implementation between web3j and web3js. The personal sign thing is working in the web3j vercel app (valid : true)
  3. For signing typed data, the field EIP712Domain should be present according to the spec. But I don't see it. I'm observing this only recently and before that, the proper json was sent.

为什么用钱包访问Web3modal V2页面显示空白,几乎大部分钱包里面浏览都是显示空白。

为什么用钱包访问Web3Modal V2页面显示空白,几乎大部分钱包里面浏览都是显示空白。
Why is the Web3Modal v2 page displayed blank when accessing the Web3Modal V2 page with the wallet, and almost most of the wallets are displayed blank.

V1的会显示正常。
v1 will display normally.

包括访问以下演示网址,都是显示空白。
Including accessing the following demo URLs, all display blank.

.

https://react-wallet.walletconnect.com/
https://react-web3wallet.vercel.app/
https://react-dapp-v2-with-ethers.vercel.app/

Websocket connection to 'wss://relay.walletconnect.com/?auth=eyJhbGciOiJFZERTQSIsI...' failed

hi all:

I registered an account on the "cloud.walletconnect.com" website and got a projectID, when I test the "react-dapp-v2-with-ethers" project on localhost, after configuring the correct projectID, everything works fine , but when I deployed the project to a linux server, it failed to run. The error message is "Websocket connection to 'wss://relay.walletconnect.com/?auth=eyJhbGciOiJFZERTQSIsI...' failed", the domain name and projectID configuration of the linux server are all correct, what may be the cause of this problem, and how solve?

Missing or invalid "message" param

Describe the bug
Missing or invalid "message" param

After the 2.0.0-beta.100 is reinstalled, the error displayed on the connection is the same as the error displayed in the 2.0.0-beta.101 version

{
"code": -32000,
"message": "Missing or invalid "message" param"
}

SDK Version (if relevant)

  • Client: @walletconnect/sign-client
  • Version 2.0.0-beta.100

To Reproduce
Steps to reproduce the behavior:

  1. 2.0.0-beta.100 version code downloaded a month ago from https://github.com/WalletConnect/web-examples
  2. 2022/06/28 npm uninstall @walletconnect/sign-client @walletconnect/types @walletconnect/utils @walletconnect/legacy-modal
  3. 2022/06/28 npm install @walletconnect/[email protected] @walletconnect/[email protected] @walletconnect/[email protected] @walletconnect/[email protected] --save
  4. npm run start
  5. select chain:Ethereum Kovan
  6. Click the button connect

Expected behavior
Display uri QR code

Screenshots

Desktop (please complete the following information):

  • OS: MAC M1
  • Browser chrome
  • Version [e.g. 22]

Web3Wallet React App Can't Handle 2 Open Requests

This wallet: https://react-web3wallet.vercel.app/
Doesn't handle receiving 2 requests at the same time.

Current Behavior
When sending a session request and an auth request at the same time, it starts showing the session request, then overwrites it with the auth request, and doesn't let me approve the session.

Expected Behavior
Popup modals are queued so that I can approve/reject each one individually. This was I can approve an auth request and a session request at the same time.

I expect that most dApps, if they require auth, will want to setup the session and get authorization at the same time, so I don't expect this will be an uncommon occurrence.

Invalid Pairing URI when using beta100 (0.6.0) iOS release

When attempting to pair the iOS example app from release 0.6.0, a malformed uri error is thrown.

The uri from the example site still contains the publicKey and relay components, while the iOS release is expecting symKey and relay-protocol respectively.

Apologies if this should be an issue for the Swift implementation.

Errors react dapp with ethers

I'm trying to run the react-dapp-v2-with-ethers on localhost, I added the project ID to the env file, I ran yarn to install dependencies, but when I run it on localhost there's no connect button and I get this errors:

Should not import the named export 'version' (imported as 'version') from default-exporting module (only default export is available soon)
printWarnings @ hot-dev-client.js?1600:85
next-dev.js?3515:20 Warning: Prop `className` did not match. Server: "sc-cwSeag kMFonq" Client: "sc-cwSeag dPQxxS"
    at div
    at O (webpack-internal:///./node_modules/styled-components/dist/styled-components.browser.esm.js:31:19750)
    at Toggle (webpack-internal:///./src/components/Toggle.tsx:46:22)
    at div
    at O (webpack-internal:///./node_modules/styled-components/dist/styled-components.browser.esm.js:31:19750)
    at div
    at O (webpack-internal:///./node_modules/styled-components/dist/styled-components.browser.esm.js:31:19750)
    at Column (webpack-internal:///./src/components/Column.tsx:44:26)
    at O (webpack-internal:///./node_modules/styled-components/dist/styled-components.browser.esm.js:31:19750)
    at div
    at O (webpack-internal:///./node_modules/styled-components/dist/styled-components.browser.esm.js:31:19750)
    at Column (webpack-internal:///./src/components/Column.tsx:44:26)
    at O (webpack-internal:///./node_modules/styled-components/dist/styled-components.browser.esm.js:31:19750)
    at div
    at O (webpack-internal:///./node_modules/styled-components/dist/styled-components.browser.esm.js:31:19750)
    at Wrapper (webpack-internal:///./src/components/Wrapper.tsx:47:26)
    at O (webpack-internal:///./node_modules/styled-components/dist/styled-components.browser.esm.js:31:19750)
    at div
    at O (webpack-internal:///./node_modules/styled-components/dist/styled-components.browser.esm.js:31:19750)
    at Column (webpack-internal:///./src/components/Column.tsx:44:26)
    at div
    at O (webpack-internal:///./node_modules/styled-components/dist/styled-components.browser.esm.js:31:19750)
    at Home (webpack-internal:///./src/pages/index.tsx:54:62)
    at ClientContextProvider (webpack-internal:///./src/contexts/ClientContext.tsx:42:26)
    at MyApp (webpack-internal:///./src/pages/_app.tsx:30:27)
    at ErrorBoundary (webpack-internal:///./node_modules/next/dist/compiled/@next/react-dev-overlay/dist/client.js:8:20740)
    at ReactDevOverlay (webpack-internal:///./node_modules/next/dist/compiled/@next/react-dev-overlay/dist/client.js:8:23547)
    at Container (webpack-internal:///./node_modules/next/dist/client/index.js:70:9)
    at AppContainer (webpack-internal:///./node_modules/next/dist/client/index.js:569:26)
    at Root (webpack-internal:///./node_modules/next/dist/client/index.js:691:27) 

See more info here: https://nextjs.org/docs/messages/react-hydration-error
window.console.error @ next-dev.js?3515:20
ws.js?dc4f:93 WebSocket connection to 'wss://relay.walletconnect.com/?auth=eyJhbGciOiJFZERTQSIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJkaWQ6a2V5Ono2TWtrWmVzSmRwUVBjQXVHeGVEZGU4VzZTMkFldmIzUEhYdnpXZWN2NFhYc2dTWSIsInN1YiI6IjFmYjU1OWVlZWExYTEzZTZjZjYwOTU0MzU5NWE3NzY4ZTBjOTEzNTI0MjIxOWZiNmE3NGM0MTc0Mzg1MmYzNjYiLCJhdWQiOiJ3c3M6Ly9yZWxheS53YWxsZXRjb25uZWN0LmNvbSIsImlhdCI6MTY3MjA0MTQ4MywiZXhwIjoxNjcyMTI3ODgzfQ.zlEsFeXNF31S_3xL7ergLWW_x2VZ6xW2vE2fhzwZM-VrgUCEy0ME0r3SFqkZZpNNEGQrCEipfNccRJ_nFB6uAg&ua=wc-2%2Fjs-2.1.3%2Fwindows10-chrome-108.0.0%2Fbrowser%3Alocalhost%3A3000' failed: 
eval @ ws.js?dc4f:93
browser.js?3aea:202 Object 'Core Initilization Failure at epoch 1672041484240' Error: WebSocket connection failed for URL: wss://relay.walletconnect.com?auth=eyJhbGciOiJFZERTQSIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJkaWQ6a2V5Ono2TWtrWmVzSmRwUVBjQXVHeGVEZGU4VzZTMkFldmIzUEhYdnpXZWN2NFhYc2dTWSIsInN1YiI6IjFmYjU1OWVlZWExYTEzZTZjZjYwOTU0MzU5NWE3NzY4ZTBjOTEzNTI0MjIxOWZiNmE3NGM0MTc0Mzg1MmYzNjYiLCJhdWQiOiJ3c3M6Ly9yZWxheS53YWxsZXRjb25uZWN0LmNvbSIsImlhdCI6MTY3MjA0MTQ4MywiZXhwIjoxNjcyMTI3ODgzfQ.zlEsFeXNF31S_3xL7ergLWW_x2VZ6xW2vE2fhzwZM-VrgUCEy0ME0r3SFqkZZpNNEGQrCEipfNccRJ_nFB6uAg&ua=wc-2%2Fjs-2.1.3%2Fwindows10-chrome-108.0.0%2Fbrowser%3Alocalhost%3A3000
    at ft.transportOpen (index.es.js?e35d:1:32288)
    at async Promise.all (:3000/index 1)
    at async ft.init (index.es.js?e35d:1:30881)
    at async V.initialize (index.es.js?e35d:1:52200)
    at async V.start (index.es.js?e35d:1:52102)
    at async C.initialize (index.es.js?eb21:1:25044)
    at async C.init (index.es.js?eb21:1:24873)
    at async a.createClient (index.es.js?380e:1:6082)
    at async a.initialize (index.es.js?380e:1:5952)
    at async a.init (index.es.js?380e:1:4330)
LOG @ browser.js?3aea:202
next-dev.js?3515:20 Object 'WebSocket connection failed for URL: wss://relay.walletconnect.com?auth=eyJhbGciOiJFZERTQSIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJkaWQ6a2V5Ono2TWtrWmVzSmRwUVBjQXVHeGVEZGU4VzZTMkFldmIzUEhYdnpXZWN2NFhYc2dTWSIsInN1YiI6IjFmYjU1OWVlZWExYTEzZTZjZjYwOTU0MzU5NWE3NzY4ZTBjOTEzNTI0MjIxOWZiNmE3NGM0MTc0Mzg1MmYzNjYiLCJhdWQiOiJ3c3M6Ly9yZWxheS53YWxsZXRjb25uZWN0LmNvbSIsImlhdCI6MTY3MjA0MTQ4MywiZXhwIjoxNjcyMTI3ODgzfQ.zlEsFeXNF31S_3xL7ergLWW_x2VZ6xW2vE2fhzwZM-VrgUCEy0ME0r3SFqkZZpNNEGQrCEipfNccRJ_nFB6uAg&ua=wc-2%2Fjs-2.1.3%2Fwindows10-chrome-108.0.0%2Fbrowser%3Alocalhost%3A3000'
window.console.error @ next-dev.js?3515:20
browser.js?3aea:202 Object 'SignClient Initilization Failure'
next-dev.js?3515:20 Object 'WebSocket connection failed for URL: wss://relay.walletconnect.com?auth=eyJhbGciOiJFZERTQSIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJkaWQ6a2V5Ono2TWtrWmVzSmRwUVBjQXVHeGVEZGU4VzZTMkFldmIzUEhYdnpXZWN2NFhYc2dTWSIsInN1YiI6IjFmYjU1OWVlZWExYTEzZTZjZjYwOTU0MzU5NWE3NzY4ZTBjOTEzNTI0MjIxOWZiNmE3NGM0MTc0Mzg1MmYzNjYiLCJhdWQiOiJ3c3M6Ly9yZWxheS53YWxsZXRjb25uZWN0LmNvbSIsImlhdCI6MTY3MjA0MTQ4MywiZXhwIjoxNjcyMTI3ODgzfQ.zlEsFeXNF31S_3xL7ergLWW_x2VZ6xW2vE2fhzwZM-VrgUCEy0ME0r3SFqkZZpNNEGQrCEipfNccRJ_nFB6uAg&ua=wc-2%2Fjs-2.1.3%2Fwindows10-chrome-108.0.0%2Fbrowser%3Alocalhost%3A3000'
window.console.error @ next-dev.js?3515:20
index.es.js?e35d:1 Uncaught (in promise) Error: WebSocket connection failed for URL: wss://relay.walletconnect.com?auth=eyJhbGciOiJFZERTQSIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJkaWQ6a2V5Ono2TWtrWmVzSmRwUVBjQXVHeGVEZGU4VzZTMkFldmIzUEhYdnpXZWN2NFhYc2dTWSIsInN1YiI6IjFmYjU1OWVlZWExYTEzZTZjZjYwOTU0MzU5NWE3NzY4ZTBjOTEzNTI0MjIxOWZiNmE3NGM0MTc0Mzg1MmYzNjYiLCJhdWQiOiJ3c3M6Ly9yZWxheS53YWxsZXRjb25uZWN0LmNvbSIsImlhdCI6MTY3MjA0MTQ4MywiZXhwIjoxNjcyMTI3ODgzfQ.zlEsFeXNF31S_3xL7ergLWW_x2VZ6xW2vE2fhzwZM-VrgUCEy0ME0r3SFqkZZpNNEGQrCEipfNccRJ_nFB6uAg&ua=wc-2%2Fjs-2.1.3%2Fwindows10-chrome-108.0.0%2Fbrowser%3Alocalhost%3A3000
    at ft.transportOpen (index.es.js?e35d:1:32288)
    at async Promise.all (:3000/index 1)
    at async ft.init (index.es.js?e35d:1:30881)
    at async V.initialize (index.es.js?e35d:1:52200)
    at async V.start (index.es.js?e35d:1:52102)
    at async C.initialize (index.es.js?eb21:1:25044)
    at async C.init (index.es.js?eb21:1:24873)
    at async a.createClient (index.es.js?380e:1:6082)
    at async a.initialize (index.es.js?380e:1:5952)
    at async a.init (index.es.js?380e:1:4330)
ClientContext.tsx?3ab3:186 Uncaught (in promise) ReferenceError: WalletConnect Client is not initialized.
    at _callee$ (ClientContext.tsx?3ab3:186:11)
    at tryCatch (runtime.js?ecd4:45:16)
    at Generator.invoke [as _invoke] (runtime.js?ecd4:274:1)
    at prototype.<computed> [as next] (runtime.js?ecd4:97:1)
    at asyncGeneratorStep (_async_to_generator.mjs?b18b:3:1)
    at _next (_async_to_generator.mjs?b18b:25:1)
    at eval (_async_to_generator.mjs?b18b:32:1)
    at new Promise (<anonymous>)
    at eval (_async_to_generator.mjs?b18b:21:1)
    at eval (ClientContext.tsx?3ab3:218:71)
    at onClick (Blockchain.tsx?e42d:133:35)
    at HTMLUnknownElement.callCallback (react-dom.development.js?ac89:3945:1)
    at Object.invokeGuardedCallbackDev (react-dom.development.js?ac89:3994:1)
    at invokeGuardedCallback (react-dom.development.js?ac89:4056:1)
    at invokeGuardedCallbackAndCatchFirstError (react-dom.development.js?ac89:4070:1)
    at executeDispatch (react-dom.development.js?ac89:8243:1)
    at processDispatchQueueItemsInOrder (react-dom.development.js?ac89:8275:1)
    at processDispatchQueue (react-dom.development.js?ac89:8288:1)
    at dispatchEventsForPlugins (react-dom.development.js?ac89:8299:1)
    at eval (react-dom.development.js?ac89:8508:1)
    at batchedEventUpdates$1 (react-dom.development.js?ac89:22396:1)
    at batchedEventUpdates (react-dom.development.js?ac89:3745:1)
    at dispatchEventForPluginEventSystem (react-dom.development.js?ac89:8507:1)
    at attemptToDispatchEvent (react-dom.development.js?ac89:6005:1)
    at dispatchEvent (react-dom.development.js?ac89:5924:1)
    at unstable_runWithPriority (scheduler.development.js?bcd2:468:1)
    at runWithPriority$1 (react-dom.development.js?ac89:11276:1)
    at discreteUpdates$1 (react-dom.development.js?ac89:22413:1)
    at discreteUpdates (react-dom.development.js?ac89:3756:1)
    at dispatchDiscreteEvent (react-dom.development.js?ac89:5889:1)```

[react-dapp-v2] Require unused namespaces while sending session proposal.

Describe the bug
Wallet got error chains don't satisfy required namespaces. while approving session proposal under certain circumstances.

SDK Version

  • sign-client 2.4.9 for wallet.

To Reproduce
Steps to reproduce the behavior:

  1. Connected to DApp demo https://react-app.walletconnect.com/ with namespaces below:
{
      eip155: {
          accounts: ["eip155:5:0x17527f938E471C987bBA3Cc9D8a6218045E52790"],
          chains: ["eip155:5"],
          events: ["chainChanged", "accountsChanged"],
	  methods: ["eth_sendTransaction", "eth_signTransaction", "eth_sign", "personal_sign", "eth_signTypedData"],
      },
}
  1. Disconnect the session and reconnect with Polkadot mainnet from the DApp demo. And it send a session proposal with requiredNamespaces like this:
{
	"eip155": {
		"methods": ["eth_sendTransaction", "eth_signTransaction", "eth_sign", "personal_sign", "eth_signTypedData"],
		"chains": ["eip155:5"],
		"events": ["chainChanged", "accountsChanged"]
	},
	"polkadot": {
		"methods": ["polkadot_signTransaction", "polkadot_signMessage"],
		"chains": ["polkadot:91b171bb158e2d3848fa23a9f1c25182"],
		"events": []
	}
}
  1. User is using Polkadot account and just DELETED the eip155 account in the wallet, so the wallet can only send approve response with namespaces like:
{
	"eip155": {
        	"accounts": [],
		"methods": ["eth_sendTransaction", "eth_signTransaction", "eth_sign", "personal_sign", "eth_signTypedData"],
		"chains": ["eip155:5"],
		"events": ["chainChanged", "accountsChanged"]
	},
	"polkadot": {
        	"accounts": ["polkadot:91b171bb158e2d3848fa23a9f1c25182:72oqryr2N4GQS1L3LCWFZCXhjMx2SE1L18k5kaVq3hvS6jf"],
		"methods": ["polkadot_signTransaction", "polkadot_signMessage"],
		"chains": ["polkadot:91b171bb158e2d3848fa23a9f1c25182"],
		"events": []
	}
}
// or
{
	"polkadot": {
        	"accounts": ["polkadot:91b171bb158e2d3848fa23a9f1c25182:72oqryr2N4GQS1L3LCWFZCXhjMx2SE1L18k5kaVq3hvS6jf"],
		"methods": ["polkadot_signTransaction", "polkadot_signMessage"],
		"chains": ["polkadot:91b171bb158e2d3848fa23a9f1c25182"],
		"events": []
	}
}
  1. See the chains don't satisfy required namespaces. error.

Suggestion
In this case, the wallet has No EIP155 accounts available, but the DApp demo send session proposal with unnecessary requiredNamespaces.
Maybe the DApp should not use the namespaces of history sessions for existing pairings.

[Auth] Expand react-dapp-auth demo to allow for using an existing pairing topic flow to connect

Context

  • There are currently two ways to issue an auth_request to a wallet that also implements the Auth SDK:
    • New: on authClient.request(), a new pairing is created. This is communicated to the wallet out-of-band by scanning the generated QR code or pasting the generated URI into the wallet. Once the pairing is established the wallet can see the pending auth_request on the pairing topic and respond accordingly.
    • Known: if the described pairing steps have already been performed, the dapp can also pass the known pairing topic as an option for authClient.request()

Suggested changes

  • The current Auth demo only covers the New flow described above.
  • We need to create an affordance for a user to select an existing pairing (similarly to how https://react-app.walletconnect.com/ shows a modal to select from known pairings) to cover the Known flow.
  • Tweaks and quick wins around responsiveness of the auth dapp demo would also be a useful improvement.

Additional context

[Bug] Switching relayer region in UI causes JWT error currently

Reproduction

  1. On the sample wallet settings (https://github.com/WalletConnect/web-examples/tree/main/dapps/react-dapp-v2, deployment: https://react-wallet.walletconnect.com/settings) or via the dapp's (https://github.com/WalletConnect/web-examples/tree/main/wallets/react-wallet-v2, deployment: https://react-app.walletconnect.com/) gear icon at the bottom, change the relayer region from Default to any concrete region.
  2. SignClient in the dapp/wallet will attempt to re-initialize from scratch with the new relay URL, causing the error Ucaught Error: WebSocket connection closed abnormally with code: 3000 (Authorization error: JWT validation error: Invalid audience)

Issue

Solution

react-dapp-v2 example does not connect to Metamask Mobile

How to reproduce error:

  1. On a mobile device (android or ios) with metamask installed, go to react-dapp-v2-with-ethers or react-dapp-v2-with-web3js
  2. Click connect, and then open with Metamask
  3. Observe that no connection request prompted in metamask

You can also try the steps above but with Trust wallet, and see that the connection request is prompted once Trust is opened.

Would love to see if anyone has ran into the same issue and has found a fix.

Sample Dapp is not authenticating with `projectId` parameter

Repro steps: visit https://staging-rust.react-app.walletconnect.com/ and notice that the websocket doesn't connect

The connection string lacks a project Id. Example:

wss://staging.rust-relay.walletconnect.com/?auth=eyJhbGciOiJFZERTQSIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJkaWQ6a2V5Ono2TWtuazZ3NlgzQ0dQUFJFNDhyMlBmWldZUzN3NkM2cFh4b3BQa2JmQjkxR0sycSIsInN1YiI6ImQxMmZhOTA3OTZlNzcyMDU1YTA3YmI4ZTk0OTRjNzJjOTQ1ZDcyMTdlNTUwODY2MzdkMzg3YmMwMWY5MWM0YmYiLCJhdWQiOiJ3c3M6Ly9zdGFnaW5nLnJ1c3QtcmVsYXkud2FsbGV0Y29ubmVjdC5jb20iLCJpYXQiOjE2NjE5ODUzMTUsImV4cCI6MTY2MjA3MTcxNX0.jjs7zDn4GnUOb0giw3ymAaO6PrdG5n-ZgA1MvToJkNJgsbmMh7EdZlRYUkv4brH7URhVhuxoWfLemVdpvbANCw&ua=wc-2%2Fjs-2.0.0-rc.1%2Fmacos-chrome-104.0.0%2Fbrowser%3Astaging-rust.react-app.walletconnect.com

This works on the example wallet.

Allow to select the region

We are regionalizing. By default the web-examples should connect to relay.walletconnect.com or staging.relay.walletconnect.com for lower environments.

In order to properly test x-region scenarios we need to select the regionalized endpoint.

So add a way to select between:

  • us-east-1.relay.walletconnect.com
  • eu-central-1.relay.walletconnect.com
  • ap-southeast-east-1.relay.walletconnect.com
    or for staging:
  • us-east-1.staging.relay.walletconnect.com
  • eu-central-1.staging.relay.walletconnect.com
  • ap-southeast-east-1.staging.relay.walletconnect.com

See https://github.com/WalletConnect/rs-relay/issues/302 for more info

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.