-
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
Changes from all commits
5ce70aa
e7d256a
0807995
3054232
cad67f9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
import * as core from "@shapeshiftoss/hdwallet-core"; | ||
import * as eth from "./ethereum"; | ||
import _ from "lodash"; | ||
import isObject from "lodash/isObject"; | ||
|
||
class XDeFiTransport extends core.Transport { | ||
public async getDeviceID() { | ||
|
@@ -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 commentThe 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 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
} | ||
|
||
export class XDeFiHDWallet implements core.HDWallet, core.ETHWallet { | ||
|
@@ -24,8 +24,9 @@ export class XDeFiHDWallet implements core.HDWallet, core.ETHWallet { | |
ethAddress?: string | null; | ||
provider: any; | ||
|
||
constructor() { | ||
constructor(provider: unknown) { | ||
this.info = new XDeFiHDWalletInfo(); | ||
this.provider = provider | ||
} | ||
|
||
async getFeatures(): Promise<Record<string, any>> { | ||
|
@@ -48,11 +49,8 @@ export class XDeFiHDWallet implements core.HDWallet, core.ETHWallet { | |
return "XDeFi"; | ||
} | ||
|
||
public initialize(): never; | ||
public initialize(provider: unknown): Promise<any>; | ||
public async initialize(provider?: unknown): Promise<any> { | ||
if (!provider) throw new Error("provider is required"); | ||
this.provider = provider; | ||
public async initialize(): Promise<void> { | ||
// nothing to initialize | ||
} | ||
|
||
public hasOnDevicePinEntry(): boolean { | ||
|
@@ -274,11 +272,3 @@ export class XDeFiHDWalletInfo implements core.HDWalletInfo, core.ETHWalletInfo | |
return eth.ethGetAccountPaths(msg); | ||
} | ||
} | ||
|
||
export function info() { | ||
return new XDeFiHDWalletInfo(); | ||
} | ||
|
||
export function create(): XDeFiHDWallet { | ||
return new XDeFiHDWallet(); | ||
} |
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 ofglobalthis as any
in the codebase currently - don't we have any way to avoid these twoany
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.