-
Notifications
You must be signed in to change notification settings - Fork 91
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
minor xdefi improvements #423
Conversation
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/shapeshift/hdwallet/CdH9Be4HabEE3DEFkeQTEBWs8RVM |
bf8bd55
to
4d21f79
Compare
d4e7c19
to
3054232
Compare
@@ -11,7 +11,7 @@ class XDeFiTransport extends core.Transport { | |||
} | |||
|
|||
export function isXDeFi(wallet: core.HDWallet): wallet is XDeFiHDWallet { | |||
return _.isObject(wallet) && (wallet as any)._isXDeFi; | |||
return isObject(wallet) && (wallet as any)._isXDeFi; |
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.
Nitpick: If we're going to import some lodash util, might as well use _.has()
which will handle the non-object cases
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.
const wallet = createMockWallet(); | ||
if (!wallet) throw new Error("No XDeFi wallet found"); | ||
// mock xdefi | ||
(globalThis as any).xfi = { |
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.
packages/hdwallet-xdefi/src/adapter.ts
has the only occurrence of globalthis as any
in the codebase currently - don't we have any way to avoid these two any
s?
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 can write type definitions for xdefi; explicit anys are prevalent in this repo, though, and I think it would make more sense to address them as a group. My plan is to get eslint in with the no-explicit-any rule turned off (#453) and then handle turning it on as a separate issue/pr.
Requires #418 (not really, but otherwise I have to add a typecast and that would suck)
create()
/info()
functions before anyone can get around to using them