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

Support for mainnet/testnet address on any derivation #55

Merged
merged 9 commits into from Mar 4, 2021
Merged

Conversation

neithanmo
Copy link
Collaborator

The device is able to process requests for setting the network version to use when calculating the address from the device's pk.

I added a new method to the BlockstackApp object:

setNetworkVersion(path: string, version: number)

Although path is not used, It may be required later.
version is a number that must be either:

  • Mainnet: 22

or

  • Testnet: 26
    the default value is Mainnet.

I noticed that the package stacks.js is not part of the dependencies for the js lib, I am not sure if it is intentional. We may include that package in order to use this enum instead of plain number( the internal implementation checks that the version value is correct if not it returns an invalid data error).

@neithanmo neithanmo changed the title Support for mainnet/testnet address on any derivation WIP Support for mainnet/testnet address on any derivation Feb 25, 2021
@neithanmo
Copy link
Collaborator Author

Tests fail because of snapshoots, although values are equal.

tests_zemu/tests/test.js Outdated Show resolved Hide resolved
@kyranjamie
Copy link
Contributor

I noticed that the package stacks.js is not part of the dependencies for the js lib, I am not sure if it is intentional. We may include that package in order to use this enum instead of plain number( the internal implementation checks that the version value is correct if not it returns an invalid data error).

To this point, if you're only using the types exposed, I believe you can use TypeScript's import type { AddressVersion } from '@stacks/transactions';. So you get the types but not the bundled js.

@jleni jleni self-requested a review March 3, 2021 23:07
@neithanmo
Copy link
Collaborator Author

It is ready. now the getAddress/showAddress takes in a new AddressVersion parameter.

@jleni jleni merged commit fff1c0f into dev Mar 4, 2021
@jleni jleni deleted the address branch March 4, 2021 22:41
@jleni jleni linked an issue Mar 5, 2021 that may be closed by this pull request
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.

Support mainnet or testnet addresses on any derivation path
3 participants