-
Notifications
You must be signed in to change notification settings - Fork 3
feat(broswer-api): sign message #76
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
Conversation
4dfac53 to
c3060f8
Compare
| !rpcClient || !wallet || !walletInfo || !account || !rpcNetworkId; | ||
|
|
||
| useEffect(() => { | ||
| if (!rpcClient || !walletInfo || !rpcNetworkId || !account) return; |
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.
Why is account missing here? can do !loading?
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.
I think you are mentioning wallet.
It is for setting IWallet, so unluckily, so we can't check wallet here, or the wallet would never be initialized.
| } | ||
|
|
||
| getWalletSecret({ walletId: walletInfo.id }).then(({ walletSecret }) => { | ||
| const factory = new AccountFactory(rpcClient, rpcNetworkId); |
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.
I really think we should try to bubble up this wallet instantiation in the WalletManagerContext. Despite the complexity, it will remove code outside and inside the context.
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.
Due to compatibility issues between Ledger and EVM-compatible features, we've decided to postpone this improvement for now.
ghost
left a comment
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.
We need to start shaping wallet API like so kaspanet/kips#21
I also tested zod instead of arktype. Let's define our DTOs very tightly.
api/message.ts
Outdated
|
|
||
| // ================================================================================================ | ||
|
|
||
| export const SignMessagePayloadSchema = z.object({ |
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.
This file is growing with schema. Maybe we can put them in the handlers directly.
You can also have schema directly inside a function (scope).
Pull Request Checklist
Before Submission
Description
Additional Notes
By submitting this pull request, I confirm that:
project's
license terms