ckb-js / nexus Goto Github PK
View Code? Open in Web Editor NEWA UTxO friendly wallet extension for CKB
License: MIT License
A UTxO friendly wallet extension for CKB
License: MIT License
As a Nexus wallet user, the first thing I want to do is to create/import an account, so that I can get access to other wallet functionalities.
If I was a new ckb user, I would like to create a new account, so I need a "Create Account" button, and the wallet should prompt a list of randomly generated mnemonics.
After the user had created an account, the root address should be generated by the key derivation rule.
Or if the user had imported an account, the root address should be generated, and the used addresses should be discovered by a similar rule in bip-44.
The mnemonics should be encrypted and stored with web3 secret storage.
//tbd
connect url:https://playwright.dev/
nexus wallet ico link:"https://playwright.dev/favicon.ico"
playwright ico link:https://playwright.dev/img/playwright-logo.svg
ccommit:abadb89
const ckb = await window.ckb.enable()
ckb.fullOwnership.signData({data:"0x1212"})
Nexus supports switching networks, but there is no particular way to get a network in a dApp.
We discussed using the chain
in get_blockchain_info
as a way to get the network, but we need to check if this is a reliable way to do it, or if there is a more reliable way
Resolve #154
Password field should validate on blur
Confirm password field should validate on change
To reduce the risk of null pointer exceptions in runtime
avoid any.someProperty
nexus version : f9f18a7
url: http://192.168.31.66:3000/
url: http://info.cern.ch/
Is your feature request related to a problem? Please describe.
The injected CKB Provider will communicate with the Nexus, so a message bridge (wrapper) is required for Nexus. This bridge should
chrome.window
created window, popup.For the CKB Provider, it may act as an RPC client, so we also need to make the bridge simply adaptable to server-client mode
// perhaps the CKB provider will be like this
await window.ckb.nexus.getUnusedLocks()
await window.ckb.nexus.getCells()
// or act as RPC client
await window.ckb.nexus.request({
method: 'wallet_getUnusedLocks',
params: []
})
await window.ckb.nexus.request({
method: 'wallet_getCells',
params: []
})
Additional context
webext-bridge looks good, but webext-bridge seems not supported for injected script, maybe we can enhance it
chomex offers server-client functionality, we can also have a look to check if we can implement it based on
Validators for wallet_*
methods
- addMethod('wallet_enable', (params, context) => {
+ addMethod('wallet_enable', pipe(
+ validateWalletEnable,
+ (params, context) => {
+ ))
Review the features of https://github.com/zhangyouxin/demo-nexus
https://github.com/gpBlockchain/nexus-e2e/blob/main/packages/e2e/README.md
window.ckb
sepc256k1.transfer
method to createTransactionSkeleton
via LumossignTransaction
For better development and testing, we need to split the Nexusinto several services, such as WalletService
, OwnershipService
, ConfigServices
, etc. which will be described in TypeScript interface.
Services need to call each other, so we need a good practice to organize these services, maybe a dependency injection is required
https://github.com/zhb666/Nervos-DAO
wallet_*
RPC scaffoldingwallet_enable
RPCwhitelist
& network
pagessignData
& signTransaction
RPC for e2esignData
signTransaction
signData
notification servicesignData
notification pagesignTransaction
notification servicesignTransaction
notification pagechange
can be classified as internal
or external
, but the test results are consistent.To demonstrate how Nexus works with a dApp, we had plans to create a Nervos DAO dApp demo, however, we found this demo may still be a bit complicated for newcomers, as it requires some knowledge about Nervos DAO, so we're planning to make another demo for CKB wallet.
This demo should have the following features
Create a new wallet
and Import a wallet
KeystoreService.initKeystore
for New wallet
wallet_enable
to work with New wallet
and initKeystore
test-data-id
in UI for e2e testingSince not all cells can be fully controlled by a single party, a case in point is the name service, which generally has an expiration date and the owner only has control over it for a given duration, we need a document that describes how Nexus works with this scenario
Is your feature request related to a problem? Please describe.
Nexus will be a browser extension, we need to setup a development environment for Nexus
Describe the solution you'd like
ckb
provider API into pageckb.enable()
to show the popupSince the cell model is not bound to a specific address, but to make the UX better, the dApp or Nexus still needs to have an identifier to indicate the user's identity. Therefore, Nexus can provide a way for users to customize their nickname to present user information in a more friendly way
- [code] implement whitelist & network pages - wait for merge
- [e2e] signTransaction
- [code] implement signTransaction notification service - wait for merge
- [code] implement signTransaction notification page - wait for merge
- [code] continue and finish #89, exposed as RPC methods - wait for merge
- [code] make the #83 works with testnet
- [code] make the Nervos DAO dApp works with testnet - wait for review
- show deposited/withdrawed cells
- deposit/withdraw/unlock
- works with Nexus,
wallet_enable
,getOffChainLocks
,getLiveCells
,signTransaction
- [UI/UX] make network edtiable
- [code] ckb-js/lumos#487
- [UI/UX] design system for Nexus
FullOwnershipService
This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.
These updates are currently rate-limited. Click on a checkbox below to force their creation now.
@typescript-eslint/eslint-plugin
, @typescript-eslint/parser
)These updates have all been created already. Click a checkbox below to force a retry/rebase of any.
@babel/preset-env
, @babel/preset-typescript
)@chakra-ui/icons
, @chakra-ui/react
)@types/react
, @types/react-dom
)These are blocked by an existing closed PR and will not be recreated unless you click a checkbox below.
.github/actions/install-deps/action.yaml
actions/setup-node v3
actions/cache v3
.github/workflows/main.yaml
actions/checkout v3
codecov/codecov-action v3
actions/checkout v3
actions/checkout v3
e2e/package.json
@types/env-paths 2.1.0
@types/fs-extra 11.0.1
detect-port 1.5.1
download 8.0.0
fs-extra 11.1.1
hpagent 1.2.0
lockfile 1.0.4
lodash.random 3.2.0
nanoid 3.3.6
playwright 1.33.0
@ckb-lumos/base 0.20.0-alpha.2
@ckb-lumos/ckb-indexer 0.20.0-alpha.2
@ckb-lumos/config-manager 0.20.0-alpha.2
@ckb-lumos/hd 0.20.0-alpha.2
@ckb-lumos/helpers 0.20.0-alpha.2
@ckb-lumos/rpc 0.20.0-alpha.2
@ltd/j-toml 1.38.0
@types/detect-port 1.3.2
@types/download 8.0.2
@types/lockfile 1.0.2
@types/lodash.random 3.2.7
package.json
@auto-it/core 10.44.0
@auto-it/magic-zero 10.43.0
@auto-it/npm 10.44.0
@auto-it/protected-branch 10.44.0
@auto-it/released 10.44.0
@auto-it/upload-assets 10.45.0
@babel/preset-env 7.20.2
@babel/preset-react 7.18.6
@babel/preset-typescript 7.18.6
@types/jest 29.5.1
@types/lodash.times 4.3.7
@typescript-eslint/eslint-plugin 5.58.0
@typescript-eslint/parser 5.58.0
concat-md 0.5.1
cross-env 7.0.3
eslint 8.38.0
eslint-config-react-app 7.0.1
eslint-plugin-import 2.27.5
husky 8.0.3
jest 29.5.0
jest-environment-jsdom 29.5.0
lerna 6.6.1
lint-staged 13.2.1
npm-run-all 4.1.5
prettier 2.8.8
rimraf 4.4.1
semver 7.4.0
ts-jest 29.0.5
ts-node 10.9.1
typedoc 0.23.26
typedoc-plugin-markdown 3.14.0
typescript 4.9.5
node >=18.14
npm >=9.4
packages/detect-ckb/package.json
packages/extension-chrome/package.json
@chakra-ui/anatomy 2.1.2
@chakra-ui/icons 2.0.17
@chakra-ui/react 2.4.9
@chakra-ui/theme-tools 2.0.17
@ckb-lumos/base 0.20.0-alpha.2
@ckb-lumos/bi 0.20.0-alpha.2
@ckb-lumos/codec 0.20.0-alpha.2
@ckb-lumos/common-scripts 0.20.0-alpha.2
@ckb-lumos/config-manager 0.20.0-alpha.2
@ckb-lumos/hd 0.20.0-alpha.2
@ckb-lumos/helpers 0.20.0-alpha.2
@ckb-lumos/lumos 0.20.0-alpha.2
@ckb-lumos/rpc 0.20.0-alpha.2
@tanstack/react-query 4.29.1
awilix 8.0.1
eventemitter3 5.0.0
immer 9.0.21
is-utf8 0.2.1
joi 17.7.1
json-rpc-2.0 1.4.2
lodash.chunk 4.2.0
lodash.isequal 4.5.0
lodash.maxby 4.6.0
lodash.omit 4.5.0
lodash.range 3.2.0
lodash.shuffle 4.2.0
lodash.times 4.3.2
lodash.zip 4.2.0
nanoid 3.3.6
numeral 2.0.6
rc-steps 6.0.0
react 18.2.0
react-dom 18.2.0
react-hook-form 7.43.1
react-router-dom 6.10.0
react-use 17.4.0
retry 0.13.1
sanitize.css 13.0.0
webext-bridge 6.0.1
webextension-polyfill 0.10.0
zod 3.21.4
zod-validation-error 1.0.1
zustand 4.3.7
@babel/preset-env 7.21.4
@babel/preset-react 7.18.6
@babel/preset-typescript 7.21.4
@pmmmwh/react-refresh-webpack-plugin 0.5.10
@svgr/webpack 6.5.1
@types/chrome 0.0.233
@types/is-utf8 0.2.1
@types/lodash.chunk 4.2.7
@types/lodash.isequal 4.5.6
@types/lodash.maxby 4.6.7
@types/lodash.omit 4.5.7
@types/lodash.range 3.2.7
@types/lodash.shuffle 4.2.7
@types/lodash.zip 4.2.7
@types/numeral 2.0.2
@types/react 18.0.35
@types/react-dom 18.0.11
@types/rimraf 3.0.2
@types/webextension-polyfill 0.10.0
babel-loader 9.1.2
bestzip 2.2.1
buffer 6.0.3
clean-webpack-plugin 4.0.0
copy-webpack-plugin 11.0.0
crypto-browserify 3.12.0
css-loader 6.7.3
file-loader 6.2.0
fork-ts-checker-webpack-plugin 7.3.0
html-loader 4.2.0
html-webpack-plugin 5.5.1
jest-fetch-mock 3.0.3
path-browserify 1.0.1
rimraf 4.4.1
source-map-loader 4.0.1
stream-browserify 3.0.0
style-loader 3.3.2
terser-webpack-plugin 5.3.7
ts-loader 9.4.2
ts-node 10.9.1
webpack 5.78.0
webpack-cli 5.0.1
webpack-dev-server 4.11.1
webpack-inject-plugin 1.5.5
webpack-merge 5.8.0
ws 8.13.0
packages/ownership-providers/package.json
lodash.range 3.2.0
@ckb-lumos/base 0.20.0-alpha.2
@ckb-lumos/bi 0.20.0-alpha.2
@ckb-lumos/codec 0.20.0-alpha.2
@ckb-lumos/common-scripts 0.20.0-alpha.2
@ckb-lumos/config-manager 0.20.0-alpha.2
@ckb-lumos/helpers 0.20.0-alpha.2
@types/lodash.range 3.2.7
@ckb-lumos/base 0.20.0-alpha.2
@ckb-lumos/bi 0.20.0-alpha.2
@ckb-lumos/codec 0.20.0-alpha.2
@ckb-lumos/common-scripts 0.20.0-alpha.2
@ckb-lumos/config-manager 0.20.0-alpha.2
@ckb-lumos/helpers 0.20.0-alpha.2
packages/protocol/package.json
@ckb-lumos/base 0.20.0-alpha.2
@ckb-lumos/base 0.20.0-alpha.2
packages/testkit/package.json
@ckb-lumos/base 0.20.0-alpha.2
@ckb-lumos/bi 0.20.0-alpha.2
@ckb-lumos/codec 0.20.0-alpha.2
@ckb-lumos/helpers 0.20.0-alpha.2
eventemitter3 5.0.0
packages/types/package.json
@ckb-lumos/codec 0.20.0-alpha.2
@ckb-lumos/helpers 0.20.0-alpha.2
@ckb-lumos/codec 0.20.0-alpha.2
@ckb-lumos/helpers 0.20.0-alpha.2
packages/utils/package.json
Nexus needs a continuous release system. Since Nexus has just developed an MVP, it is foreseeable that we will be collecting feedback from various parties and making modifications.
This continuous release system should be able to meet the following requirements
InjectedCkb
chrome.windows.create
WalletService
- for ckb.enable
KeyingService
- managing encrypted mnemonicConfigService
- managing Nexus configurationOwnershipService
- support for CkbProvider
OwnershipRecoverService
- recovering imported exists mnemonicckb.enable
ownership.signData
ownership.signTx
chrome.storage.local.get(null, console.log)
to fetch all stored dataIs your feature request related to a problem? Please describe.
As a CKB layer 1 wallet, Nexus needs to be UTxO-friendly, while allowing the dApp to interact with it. This design may require some thought
Nexus needs a design or description for this
Additional context
networkChanged
wallet_enable
, getOffChainLocks
, getLiveCells
, signTransaction
I find the release is failed in release, but it is as expected. To avoid PR check failed, we should skip the canary release from a forked repo
Originally posted by @homura in #142 (comment)
No, although Nexus in its MVP stage is only acting as a signer, Nexus's positioning is as a wallet, and we will make Nexus a user-friendly wallet, with signer just being its current state
internal_X
internal methods for extension pages
internal_getRequesterAppInfo
internal_approvedEnableWallet
internal_approvedSignData
internal_approvedSignTransaction
ckb.request({method: "wallet_enable"})
await ckb.request({method:'wallet_fullOwnership_signData', params: { data:'0x68656c6c6f20e4bda0e5a5bd20e38193e38293e381abe381a1e381af20f09f918b' }})
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.