Skip to content
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

Open
wants to merge 23 commits into
base: staging
Choose a base branch
from
Open

Conversation

sarah-thong
Copy link

@sarah-thong sarah-thong commented Nov 24, 2024

Cherry-pick of #11

@stevenkhong stevenkhong changed the title Feat/bridge helpers feat: @demex-sdk/polynetwork Nov 28, 2024
Base automatically changed from feat/wallet-package to staging November 28, 2024 06:40
Copy link
Contributor

@stevenkhong stevenkhong left a 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.

Comment on lines 22 to 28
"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",
Copy link
Contributor

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> {
Copy link
Contributor

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?

Comment on lines 4 to 22
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;
}
}
Copy link
Contributor

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants