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
feat(web3): supports signMessage, add login example after connecting #631
base: main
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: 5e61456 The changes in this PR will be included in the next version bump. This PR includes changesets to release 5 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #631 +/- ##
===========================================
- Coverage 100.00% 99.87% -0.13%
===========================================
Files 649 649
Lines 17428 17455 +27
Branches 1053 1053
===========================================
+ Hits 17428 17434 +6
- Misses 0 21 +21 ☔ View full report in Codecov by Sentry. |
我感觉 签名的功能基于 如果真的要内置的话应该是组件内有需求再内置,比如说很多 DApp 登录经常都需要签名来做验证,可能我们支持下: <Connector requireSignMessage={{
message: 'xxxx',
requestCheckResult: async () => {
// 请求后端检查签名,种 cookie
return true;
},
}} /> 我的建议就是先提供一个 Demo,至于要不要内置可能要调研一下现在的 DApp 的具体需求场景,设计上可能也要做支持,比如连接后但是没有签名验证应该怎么显示? |
我倒是觉得连接+登陆是需要作为一个内置功能来提供的,dapp 只要有后端,基本就需要用到 sign message 来登陆,目前见到的很多 dapp 也用到了 siwe,比如 https://mirror.xyz/ |
@@ -86,6 +86,12 @@ Ant Design Web3 内置了对 [TokenPocket](https://www.tokenpocket.pro/) 的支 | |||
|
|||
<code src="./demos/web3modal.tsx"></code> | |||
|
|||
## 登陆 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -86,6 +86,12 @@ Ant Design Web3 内置了对 [TokenPocket](https://www.tokenpocket.pro/) 的支 | |||
|
|||
<code src="./demos/web3modal.tsx"></code> | |||
|
|||
## 登陆 | |||
|
|||
连接钱包后通过 `onConnected` 回调签名用户信息完成登陆。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
同上
那就内置掉,看看 API 怎么设计好。 |
Solana 生态标准也有个 这里有个介绍区别的文章:https://phantom.app/learn/developers/sign-in-with-solana 如果要适配的话,是要用 signMessage 吗? |
这个 signIn 感觉是对标你之前提到的 swie 的? |
看上去是,应该是两个功能。一个是签名,一个是基于 solana 账号登录,不过后者应该也会用到签名。 |
对的,这个 |
几个变化:
signMessage
作为一个比较常用的方法签名,添加到了UniversalWeb3ProviderInterface
类型上,理论上其他链的 Provider 都应该实现这个方法(solana 可以看下 @gin-lsl )onConnected
回调添加了连接钱包后登陆的流程示例,需要考虑下怎么默认集成到组件(或 web3-wagmi)中