-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
namespaces for WalletConnect #148
Comments
Some information from nexus methods.In previous nexus design, it have these methods:
|
First, I propose the chains config. With CAIP-2. It have two parts, namespace and references. I provide two Chain types, with and without So the final chains is: type Chains: 'mainnet' | 'testnet' | 'devnet'
// Or just remove all net suffix
type Chains = 'main' | 'test' | 'dev' |
I think we don't need to return locks or cells for DApp in neuron, just return addresses is enough, the Dapp like .bit will get cells using one of the addresses neuron has approved. And neuron can switch address with emitting Here is an assumpsion(maybe a fact):
inspired by poc by homura hers is a initial draft of proposal:
|
On Wallet connect, neuron user can select multiple addresses to add to approved list, but return only one address a time, when neuron user switch to another approved address, dapp will receive a |
is these the chains in namespace? I think the chains is to distinguish which chain current wallet uses instead of different lock. I found in EIP, there are these chain id:
mainnet, Ropsten, Rinkeby are different network. |
You are right, network infomation should also be involved in chain-id, and the reference part of chain-id should be coded to |
Maybe we don't need Because there a |
After connecting the Neuron wallet, the address given to the DApp is derived from the So, how can we support other locks besides Initially, I thought of including lock information in the chainId, such as pros:
cons:
|
It seems meaningless to support any lock, because for an unknown lock, |
I've thought about this question, in signing transacion, the DApp should tell wallet which lock to sign by passing the
the delare const myCodeHash: string;
const approved = await neuron.request({ method: "wallet_isContractApproved", params: [myCodeHash] });
if (!approved) {
await neuron.request({ method: "wallet_approveContract", params: [myCodeHash] });
}
await neuron.request({ method: "wallet_signTransaction", params: { tx } }); |
Maybe we can throw an exception when calling |
FYI, a historical RFC draft: https://talk.nervos.org/t/rfc-wallet-authorization-spec-proposal/4962 |
FYI how keypering handled arbitrary scripts: https://nervosnetwork.github.io/keypering/#/manual?id=lock-plug-ins |
sign(context: SignContext, rawTx: RawTransaction, config: Config): Promise<RawTransaction>;
export enum SignatureAlgorithm {
secp256k1 = "secp256k1",
secp256r1 = "secp256r1",
schnorr = "schnorr",
} Seems the custom lock should provide a method for mapping unsigned transaction to a witness. (The generated witness are in it's output transaction) |
Correct. The plugged-in |
I made a simple proposal, but posting it here may slow down the issue rendering, so I post it on the HackMD for now, and I'll move it here if you think it is necessary to migrate it over for discussion |
|
Hold on to the implementation based on wallet connect because there's a new protocol for these scenarios |
Table of Contents
Namepaces
Here is an example of a session approval message, passing the namespace.
chains
In CAIP-2, ageneral blockchain identification schema is defined. This is the implementation of CAIP-2 for the CKB network.
accounts
For context, see the CAIP-10 specification.
methods
ckb_getAddresses
Get the active address list by specific lock script types
ckb_generateAddresses
Allow a cold wallet to authorize dapps to generate addresses.
For context, see the doc
ckb_signTransaction
Get a transaction over the provided instructions.
ckb_signMessage
Get a signature for the provided message from the requested signer address.
events
accountChanged
Emit the event when the account changed
addressesChanged
Emit the event when addresses changed
chainChanged
Emit the event when the chain changed
The text was updated successfully, but these errors were encountered: