-
Notifications
You must be signed in to change notification settings - Fork 21
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
Feature/wallet connect 2.0 #236
Conversation
@@ -196,6 +203,10 @@ export class Sdk { | |||
constructor(walletProvider: WalletProviderLike, optionsLike?: EnvNames | SdkOptions) { | |||
let options: SdkOptions = {}; | |||
|
|||
if (isWalletConnectProvider(walletProvider)) { |
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 lets to avoid any additional mappings before passing Wallet Connect provider to Etherspot SDK constructor
@@ -17,7 +17,8 @@ | |||
"ES5", | |||
"es2015.collection", | |||
"es2015.iterable" | |||
] | |||
], | |||
"skipLibCheck": true |
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.
skips types check on node_modules
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 some minor questions but other than that - looks good!
try { | ||
const { | ||
accounts: [address], | ||
chainId, | ||
} = provider; | ||
|
||
this.setAddress(address); | ||
this.setNetworkName(chainId); | ||
} catch (err) { | ||
// | ||
} |
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 out of curiosity is there a reason we're using try / catch here as if accounts
/ chainId
are not found in provider it would just return undefined
for the destrucutred vartiables?
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 is copy paste implementation of previous Wallet Connect provider
const response = await this.provider.signer.request({ | ||
method: 'personal_sign', | ||
params: [toHex(message), this.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.
Just wondering if htis could return an error from the await
?
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 is copy paste implementation of previous Wallet Connect provider, it can return error, but it wasn't handled in previous Wallet Connect provider so didn't feel to add anything extra that is beyond previous structure
({ | ||
accounts: [address], | ||
chainId, | ||
} = payload.params[0]); |
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 is definitely valid due to the [0]
@vignesha22 @marie-fourier Pls review this |
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
Description
Motivation and Context
How Has This Been Tested?
Screenshots (if appropriate):
Types of changes