Skip to content

Commit

Permalink
Update documentation about key-tree (MetaMask#463)
Browse files Browse the repository at this point in the history
This updates the documentation to match `@metamask/key-tree@^4.0.0`.
  • Loading branch information
Mrtenz authored Jul 6, 2022
1 parent 00d1d0c commit c631a6d
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions docs/guide/snaps-rpc-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -482,9 +482,19 @@ interface BIP44CoinTypeNode {
readonly depth: 2;

/**
* The Base64-encoded string representation of the key material for this node.
* The hexadecimal-encoded string representation of the private key for this node.
*/
readonly key: string;
readonly privateKey: string;

/**
* The hexadecimal-encoded string representation of the public key for this node.
*/
readonly publicKey: string;

/**
* The hexadecimal-encoded string representation of the chain code for this node.
*/
readonly chainCode: string;

/**
* A human-readable representation of the BIP-44 HD tree path of this node.
Expand Down Expand Up @@ -530,16 +540,16 @@ const dogecoinNode = await wallet.request({

// Next, we'll create an address key deriver function for the Dogecoin coin_type node.
// In this case, its path will be: m / 44' / 3' / 0' / 0 / address_index
const deriveDogecoinAddress = getBIP44AddressKeyDeriver(dogecoinNode);
const deriveDogecoinAddress = await getBIP44AddressKeyDeriver(dogecoinNode);

// These are Node.js Buffer representations of the extended private keys for
// the respective addresses.
// These are BIP-44 nodes containing the extended private keys for
// the respective derivation paths.

// m / 44' / 3' / 0' / 0 / 0
const addressKey0 = deriveDogecoinAddress(0);
const addressKey0 = await deriveDogecoinAddress(0);

// m / 44' / 3' / 0' / 0 / 1
const addressKey1 = deriveDogecoinAddress(1);
const addressKey1 = await deriveDogecoinAddress(1);

// Now, you can ask the user to e.g. sign transactions!
```
Expand Down

0 comments on commit c631a6d

Please sign in to comment.