Open devchenyan opened 1 year ago
here is a PoC to show
I've designed a prototype for this integration including establishing a connection and initializing a transaction. The prototype links is below: https://vs0cjf.axshare.com/#id=oodwon&p=walletconnect&g=1
There is a brand-new protocol with a set of contracts created that attempts to create an authentication pattern between dApp and wallets.
The new lock defines a new witness shape that introduces a human-readable object called BuildingPacked
.
{
message: {
actions: [
{
data: {
type: 'Transfer',
value: {
nftID: '/* NFT ID */',
to: {
type: 'Script',
value: {
/* the transfer target script */
},
},
},
},
scriptInfoHash: '0x...',
},
],
},
}
This brings some benefits for wallets, such as
Table of Contents
Currently, Neuron supports signing/sending transaction directly. But it can't give support to dApps on the CKB Network.
Overview of WalletConnect
WalletConnect is an open-source protocol that enables secure and seamless communication between decentralized applications (dApps) and wallets on various blockchains. By establishing a remote connection using end-to-end encryption, WalletConnect allows users to interact with dApps through their preferred wallet without exposing their private keys.
So we consider integrating WalletConnect to achieve collaboration with dapp quickly.
WalletConnect Workflow
User visits a new website that requires a Sign session for submitting transactions and Auth for authentication
Once the connection is established, the Dapp will be able to send any JSON-RPC call requests to be handled by the Wallet either to read data from its node or make signing requests for transactions or messages.![image](https://user-images.githubusercontent.com/11756869/236685801-80b1e901-d9c2-4cb9-b618-0324224546a8.png)
Resources
Github: https://github.com/WalletConnect Docs: https://docs.walletconnect.com/2.0/ Sign Reference API: https://docs.walletconnect.com/2.0/specs/clients/sign/client-api
WalletConnect Cloud
The javascript SDK requires a
projectId
which is supposed to be registered at their WalletConnect cloud.WalletConnect SDK
WalletConnect consists of two SDKs available for both the
dApps
and the Wallets:Web3Modal
andWeb3Wallet
:It's used to display a HTML popup with the QRCode containing the URI for the peering, it uses the core library to generate the necessary attributes.
The
web3wallet
library is used on the Wallets for the pairing and message exchangeWeb3Wallet SDK
It's basically a library that provides a single API for the Sign API and the Auth API
Expected Workflow
User is able to connect to a WalletConnect wallet supporting ckb blockchain from a dapp using the ckb provider.
User should be able:
These are the core user flows that is expected to support through WalletConnect protocol. Any other JSON-RPC methods should be able to be proxied either directly through the wallet or routed directly to a remote node.
https://github.com/Magickbase/neuron-public-issues/assets/11756869/50deb328-171a-4237-985d-daa85238b9d2
UX/UI
https://github.com/Magickbase/neuron-public-issues/assets/11756869/4626f2fb-3fb2-4692-a48c-2f2389180384
UX Design
https://vs0cjf.axshare.com/#id=psrijc&p=walletconnect-general&g=1
UI Design
TBD
Design Decisions
Namepaces
Namespaces for WalletConnect was created and can be read (and reviewed) .
Here is an example of a session approval message, passing the namespace.
Roadmap