-
Notifications
You must be signed in to change notification settings - Fork 172
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
#54 Public account type #65
Conversation
@MisterVants that is pr into main, change for develop |
done |
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.
LGTM, left some comments
@@ -150,8 +150,8 @@ extension ResponderViewController: SessionViewControllerDelegate { | |||
print("[RESPONDER] Approving session...") | |||
let proposal = currentProposal! | |||
currentProposal = nil | |||
let accounts = proposal.permissions.blockchains.map {$0+":\(account)"} | |||
client.approve(proposal: proposal, accounts: Set(accounts)) | |||
let accounts = Set(proposal.permissions.blockchains.compactMap { Account($0+":\(account)") }) |
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.
can we add another convenience init
to avoid passing the :
, It looks easy to forget
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 added two more init
to make the type more flexible.
Sources/WalletConnect/Account.swift
Outdated
public struct Account: Equatable, Hashable { | ||
|
||
/// A blockchain namespace. Usually describes an ecosystem or standard. | ||
public var namespace: String |
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.
Let's use let
for stored properties? immutable is better
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.
Just changed to let
This initializer returns nil if the string doesn't represent a valid account id in conformance with | ||
[CAIP-10](https://github.com/ChainAgnostic/CAIPs/blob/master/CAIPs/caip-10.md). | ||
*/ | ||
public init?(_ string: String) { |
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.
maybe it would make sense to create a Chain
and add init from a chain and an address.
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.
Makes sense, but IMHO only if we use the Chain
type in more places in the engine. Sounds like an overkill if we add it just to use in an Account
closes #54
Adds a public
Account
type to handle CAIP-10 account ids when making SDK calls.