-
Notifications
You must be signed in to change notification settings - Fork 0
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
feat: @demex-sdk/polynetwork #12
base: staging
Are you sure you want to change the base?
Conversation
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.
as we're trying to make a lean package, please move most of the necessary logic to the package you're working on, unless they are truly useful to the core package.
also, please rebase your pull request as there seems to be many diffs that is already in staging.
i will review again after that is done.
packages/core/package.json
Outdated
"base58check": "^2.0.0", | ||
"bignumber.js": "^9.1.2", | ||
"bip32": "^2.0.6", | ||
"bip39": "^3.0.4", | ||
"ethers": "^6.13.4", | ||
"secp256k1": "^4.0.2", | ||
"secp256r1": "^0.0.3", |
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 many of the functionalities from these packages can be replaced with existing packages like @cosmjs/tendermint-rpc
. we should avoid adding packages carelessly to guard against bloating our package.
|
||
export interface AddressOptions {} | ||
|
||
export interface AddressBuilder<T extends AddressOptions = AddressOptions> { |
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're not bring this functionality over as well. can you reference the constructor of DemexWallet
for examples of address conversion?
packages/core/src/util/ledger.ts
Outdated
async function getDevicePaths(ledgerLibrary: typeof TransportWebHID): Promise<ReadonlyArray<HIDDevice>> { | ||
const supported = await ledgerLibrary.isSupported(); | ||
if (!supported) { | ||
throw new Error("Your computer does not support the ledger!"); | ||
} | ||
return await ledgerLibrary.list(); | ||
} | ||
|
||
async function getWebHIDTransport(): Promise<Transport> { | ||
try { | ||
return await TransportWebHID.create(); | ||
} catch (error) { | ||
if ((error as Error).message !== "The device is already open.") throw error; | ||
|
||
const devices = await getDevicePaths(TransportWebHID); | ||
const transport = new TransportWebHID(devices[0]); | ||
return transport as Transport; | ||
} | ||
} |
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'll be creating a separate package for ledger functionalities.
can we move this to polynetwork
package first?
Cherry-pick of #11