Skip to content

Commit

Permalink
Improvements around SDK functions docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasz-zimnoch committed Oct 16, 2023
1 parent c359fef commit ad51b2e
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
6 changes: 3 additions & 3 deletions typescript/src/lib/bitcoin/address.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import { BitcoinNetwork, toBitcoinJsLibNetwork } from "./network"
/**
* Creates the Bitcoin address from the public key. Supports SegWit (P2WPKH) and
* Legacy (P2PKH) formats.
* @param publicKey - Public key used to derive the Bitcoin address.
* @param bitcoinNetwork - Target Bitcoin network.
* @param witness - Flag to determine address format: true for SegWit (P2WPKH)
* @param publicKey Compressed public key used to derive the Bitcoin address.
* @param bitcoinNetwork Target Bitcoin network.
* @param witness Flag to determine address format: true for SegWit (P2WPKH)
* and false for Legacy (P2PKH). Default is true.
* @returns The derived Bitcoin address.
*/
Expand Down
1 change: 1 addition & 0 deletions typescript/src/lib/bitcoin/ecdsa-key.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export const BitcoinPublicKeyUtils = {
/**
* Creates a Bitcoin key pair based on the given private key.
* @param privateKey Private key that should be used to create the key pair.
* Should be passed in the WIF format.
* @param bitcoinNetwork Bitcoin network the given key pair is relevant for.
* @returns Bitcoin key ring.
*/
Expand Down
10 changes: 5 additions & 5 deletions typescript/src/lib/bitcoin/hash.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { BigNumber, utils } from "ethers"
import { Hex } from "../utils"

/**
* Computes the HASH160 for the given text.
* @param text - Text the HASH160 is computed for.
* Computes the HASH160 (i.e. RIPEMD160(SHA256(text))) for the given text.
* @param text Text the HASH160 is computed for.
* @returns Hash as a 20-byte un-prefixed hex string.
*/
function computeHash160(text: string): string {
Expand All @@ -17,7 +17,7 @@ function computeHash160(text: string): string {

/**
* Computes the double SHA256 for the given text.
* @param text - Text the double SHA256 is computed for.
* @param text Text the double SHA256 is computed for.
* @returns Hash as a 32-byte un-prefixed hex string.
* @dev Do not confuse it with computeSha256 which computes single SHA256.
*/
Expand All @@ -30,7 +30,7 @@ function computeHash256(text: Hex): Hex {

/**
* Converts a hash in hex string in little endian to a BigNumber.
* @param hash - Hash in hex-string format.
* @param hash Hash in hex-string format.
* @returns BigNumber representation of the hash.
*/
function hashLEToBigNumber(hash: Hex): BigNumber {
Expand All @@ -39,7 +39,7 @@ function hashLEToBigNumber(hash: Hex): BigNumber {

/**
* Computes the single SHA256 for the given text.
* @param text - Text the single SHA256 is computed for.
* @param text Text the single SHA256 is computed for.
* @returns Hash as a 32-byte un-prefixed hex string.
* @dev Do not confuse it with computeHash256 which computes double SHA256.
*/
Expand Down
2 changes: 1 addition & 1 deletion typescript/src/lib/bitcoin/tx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ export function extractBitcoinRawTxVectors(

/**
* Converts Bitcoin specific locktime value to a number. The number represents
* either a block height or an Unix timestamp depending on the value.
* either a block height or a Unix timestamp, depending on the value.
*
* If the number is less than 500 000 000 it is a block height.
* If the number is greater or equal 500 000 000 it is a Unix timestamp.
Expand Down

0 comments on commit ad51b2e

Please sign in to comment.