feat: @demex-sdk/polynetwork#12
Conversation
stevenkhong
left a comment
There was a problem hiding this comment.
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.
| "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.
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.
we're not bring this functionality over as well. can you reference the constructor of DemexWallet for examples of address conversion?
| 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.
we'll be creating a separate package for ledger functionalities.
can we move this to polynetwork package first?
Cherry-pick of #11