{"_id":"@alephium/walletconnect-universal-provider","name":"@alephium/walletconnect-universal-provider","dist-tags":{"latest":"0.2.0"},"versions":{"0.2.0":{"name":"@alephium/walletconnect-universal-provider","description":"Universal Provider for WalletConnect Protocol","version":"0.2.0","author":{"name":"WalletConnect, Inc.","email":"walletconnect.com"},"homepage":"https://github.com/walletconnect/walletconnect-monorepo/","repository":{"type":"git","url":"git+https://github.com/WalletConnect/walletconnect-monorepo.git","directory":"providers/universal-provider"},"type":"module","license":"SEE LICENSE IN LICENSE.md","main":"dist/index.cjs","module":"dist/index.js","unpkg":"dist/index.umd.js","types":"dist/types/index.d.ts","exports":{".":{"types":"./dist/types/index.d.ts","module":"./dist/index.js","default":"./dist/index.cjs"}},"keywords":["wallet","walletconnect"],"scripts":{"clean":"rm -rf dist","build:pre":"npm run clean","build:types":"tsc","build:source":"rollup --config rollup.config.js","build":"npm run build:pre; npm run build:source; npm run build:types","test:pre":"rm -rf ./test/tmp && mkdir ./test/tmp","test":"npm run test:pre; vitest run --dir test","lint":"eslint -c '../../.eslintrc' --fix './src/**/*.ts'","prettier":"prettier --check '{src,test}/**/*.{js,ts,jsx,tsx}'"},"dependencies":{"@walletconnect/events":"1.0.1","@walletconnect/jsonrpc-http-connection":"1.0.8","@walletconnect/jsonrpc-provider":"1.0.14","@walletconnect/jsonrpc-types":"1.0.4","@walletconnect/jsonrpc-utils":"1.0.8","@walletconnect/keyvaluestorage":"1.1.1","@walletconnect/logger":"3.0.0","@walletconnect/sign-client":"2.22.4","@walletconnect/types":"2.22.4","@walletconnect/utils":"2.22.4","es-toolkit":"1.39.3","events":"3.3.0"},"devDependencies":{"ethers":"6.15.0","hardhat":"^3.0.6","uint8arrays":"3.0.0","wait-on":"9.0.1","web3":"4.16.0"},"_id":"@alephium/walletconnect-universal-provider@0.2.0","gitHead":"b1e0d0061ffcf89ede7ffa939a05f0eef17d0dc7","bugs":{"url":"https://github.com/WalletConnect/walletconnect-monorepo/issues"},"_nodeVersion":"20.19.5","_npmVersion":"10.8.2","dist":{"integrity":"sha512-KaTcyIrtAwjy91Hl7fC9PKuC4krIRwgvb100Py2lZSfLLFo+ZsUGVZtq19uL97jS3aIpjUQXGDBOdjUoLD7MSA==","shasum":"c28306c0f973da359f18d54b090bc42f0c158778","tarball":"https://registry.npmjs.org/@alephium/walletconnect-universal-provider/-/walletconnect-universal-provider-0.2.0.tgz","fileCount":44,"unpackedSize":3695456,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQD9ddKMZmOPAHPFh76Euue/QFWfsxrOGQxzGbXsGJP1swIgIlm8I4fMOA9keBjt32YBqY9bYl28Ispk+5gxgFumwgc="}]},"_npmUser":{"name":"alephium-personal","email":"dev@alephium.org"},"directories":{},"maintainers":[{"name":"alephium-personal","email":"dev@alephium.org"},{"name":"eyettea","email":"hlias.nop@gmail.com"},{"name":"mikapote","email":"m.vaivre@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/walletconnect-universal-provider_0.2.0_1761811767756_0.41325844149558155"},"_hasShrinkwrap":false}},"time":{"created":"2025-10-30T08:09:27.683Z","0.2.0":"2025-10-30T08:09:28.010Z","modified":"2025-10-30T08:09:28.335Z"},"maintainers":[{"name":"alephium-personal","email":"dev@alephium.org"},{"name":"eyettea","email":"hlias.nop@gmail.com"},{"name":"mikapote","email":"m.vaivre@gmail.com"}],"description":"Universal Provider for WalletConnect Protocol","homepage":"https://github.com/walletconnect/walletconnect-monorepo/","keywords":["wallet","walletconnect"],"repository":{"type":"git","url":"git+https://github.com/WalletConnect/walletconnect-monorepo.git","directory":"providers/universal-provider"},"author":{"name":"WalletConnect, Inc.","email":"walletconnect.com"},"bugs":{"url":"https://github.com/WalletConnect/walletconnect-monorepo/issues"},"license":"SEE LICENSE IN LICENSE.md","readme":"# @walletconnect/universal-provider\n\nUniversal Provider for WalletConnect Protocol\n\n## Usage\n\n```typescript\nimport { ethers } from \"ethers\";\nimport UniversalProvider from \"@walletconnect/universal-provider\";\n\n//  Initialize the provider\nconst provider = await UniversalProvider.init({\n  logger: \"info\",\n  relayUrl: \"ws://<relay-url>\",\n  projectId: \"12345678\",\n  metadata: {\n    name: \"React App\",\n    description: \"React App for WalletConnect\",\n    url: \"https://walletconnect.com/\",\n    icons: [\"https://avatars.githubusercontent.com/u/37784886\"],\n  },\n  client: undefined, // optional instance of @walletconnect/sign-client\n});\n\n//  create sub providers for each namespace/chain\nawait provider.connect({\n  namespaces: {\n    eip155: {\n      methods: [\n        \"eth_sendTransaction\",\n        \"eth_signTransaction\",\n        \"eth_sign\",\n        \"personal_sign\",\n        \"eth_signTypedData\",\n      ],\n      chains: [\"eip155:80001\"],\n      events: [\"chainChanged\", \"accountsChanged\"],\n      rpcMap: {\n        80001:\n          \"https://rpc.walletconnect.org?chainId=eip155:80001&projectId=<your walletconnect project id>\",\n      },\n    },\n    pairingTopic: \"<123...topic>\", // optional topic to connect to\n    skipPairing: false, // optional to skip pairing ( later it can be resumed by invoking .pair())\n  },\n});\n\n//  Create Web3 Provider\nconst web3Provider = new ethers.providers.Web3Provider(provider);\n```\n\n## Events\n\n```typescript\n// Subscribe for pairing URI\nprovider.on(\"display_uri\", (uri) => {\n  console.log(uri);\n});\n\n// Subscribe to session ping\nprovider.on(\"session_ping\", ({ id, topic }) => {\n  console.log(id, topic);\n});\n\n// Subscribe to session event\nprovider.on(\"session_event\", ({ event, chainId }) => {\n  console.log(event, chainId);\n});\n\n// Subscribe to session update\nprovider.on(\"session_update\", ({ topic, params }) => {\n  console.log(topic, params);\n});\n\n// Subscribe to session delete\nprovider.on(\"session_delete\", ({ id, topic }) => {\n  console.log(id, topic);\n});\n```\n\n## Provider Methods\n\n```typescript\ninterface RequestArguments {\n  method: string;\n  params?: any[] | undefined;\n}\n\n// Send JSON RPC requests\n\n/**\n * @param payload\n * @param chain - optionally specify which chain should handle this request\n * in the format `<namespace>:<chainId>` e.g. `eip155:1`\n */\nconst result = await provider.request(payload: RequestArguments, chain: string | undefined);\n```\n\n## Multi-chain\n\n```typescript\nconst web3 = new Web3(provider);\n\n// default chainId is the FIRST chain during setup\nconst chainId = await web3.eth.getChainId();\n\n// set the default chain to 56\nprovider.setDefaultChain(`eip155:56`, rpcUrl?: string | undefined);\n\n// get the updated default chainId\nconst updatedDefaultChainId = await web3.eth.getChainId();\n\n```\n\n## Creating a provider file\n\n- Create a file under `providers/universal-provider/src/providers/<NAMESPACE>.ts`\n- Implement the `IProvider` interface\n- In the `IProvider.request` method, there should be a check for whether or not\n  to run the request against the wallet or the blockchain.\n  `this.namespace.methods` should only contain the methods supported by the\n  wallet.\n- The rest of the methods of the class are very similar, mainly centering around\n  httpProvider and for the most part will be 90% similar to other providers\n  given similar structure of chainId. For example `eip155:1` or\n  `solana:mainnetBeta`.\n- Export provider under `providers/universal-provider/src/providers/index.ts`\n","readmeFilename":"README.md","_rev":"1-414e5677c0df4817f54cf89b60a0e616"}