diff --git a/src/request/types/btcMethods.ts b/src/request/types/btcMethods.ts index 5258dad..092cdf0 100644 --- a/src/request/types/btcMethods.ts +++ b/src/request/types/btcMethods.ts @@ -1,8 +1,12 @@ +/** + * Represents the types and interfaces related to BTC methods. + */ + import { Address, AddressPurpose } from '../../addresses'; import { MethodParamsAndResult } from '../../types'; type GetInfoResult = { - version: Number | String; + version: number | string; methods?: Array; supports?: Array; }; @@ -10,55 +14,111 @@ type GetInfoResult = { export type GetInfo = MethodParamsAndResult; type GetAddressesParams = { - purposes: AddressPurpose[]; + /** + * The purposes for which to generate addresses. + * possible values are "payment", "ordinals", ... + */ + purposes: Array; + /** + * a message to be displayed to the user in the request prompt. + */ message?: string; }; +/** + * The addresses generated for the given purposes. + */ type GetAddressesResult = { - addresses: Address[]; + addresses: Array
; }; export type GetAddresses = MethodParamsAndResult; type SignMessageParams = { + /** + * The address used for signing. + **/ address: string; + /** + * The message to sign. + **/ message: string; }; + type SignMessageResult = { + /** + * The signature of the message. + */ signature: string; + /** + * hash of the message. + */ messageHash: string; + /** + * The address used for signing. + */ address: string; }; export type SignMessage = MethodParamsAndResult; type Recipient = { + /** + * The recipient's address. + **/ address: string; - amount: bigint; + /** + * The amount to send to the recipient in satoshis. + */ + amount: number; }; type SendTransferParams = { - recipients: Recipient[]; + /** + * Array of recipients to send to. + * The amount to send to each recipient is in satoshis. + */ + recipients: Array; }; type SendTransferResult = { + /** + * The transaction id as a hex-encoded string. + */ txid: string; }; export type SendTransfer = MethodParamsAndResult; -type SignInputsByAddress = { - [address: string]: number[]; -}; - export type SignPsbtParams = { + /** + * The base64 encoded PSBT to sign. + */ psbt: string; - signInputs: number[] | SignInputsByAddress; + /** + * The inputs to sign. + * The key is the address and the value is an array of indexes of the inputs to sign. + */ + signInputs: Record; + /** + * the sigHash type to use for signing. + * will default to the sighash type of the input if not provided. + **/ allowedSignHash?: number; + /** + * Whether to broadcast the transaction after signing. + **/ broadcast?: boolean; }; export type SignPsbtResult = { + /** + * The base64 encoded PSBT after signing. + */ psbt: string; + /** + * The transaction id as a hex-encoded string. + * This is only returned if the transaction was broadcast. + **/ txid?: string; };