chore: update doc comments (#16267)

This commit is contained in:
Justin Starry
2021-03-31 18:48:41 +08:00
committed by GitHub
parent d0e3aae39f
commit b0f4e2b738
8 changed files with 194 additions and 323 deletions

View File

@@ -12,7 +12,7 @@ import type {Blockhash} from './blockhash';
import {toBuffer} from './util/to-buffer';
/**
* @typedef {string} TransactionSignature
* Transaction signature as base-58 encoded string
*/
export type TransactionSignature = string;
@@ -36,25 +36,18 @@ const SIGNATURE_LENGTH = 64;
/**
* Account metadata used to define instructions
*
* @typedef {Object} AccountMeta
* @property {PublicKey} pubkey An account's public key
* @property {boolean} isSigner True if an instruction requires a transaction signature matching `pubkey`
* @property {boolean} isWritable True if the `pubkey` can be loaded as a read-write account.
*/
export type AccountMeta = {
/** An account's public key */
pubkey: PublicKey;
/** True if an instruction requires a transaction signature matching `pubkey` */
isSigner: boolean;
/** True if the `pubkey` can be loaded as a read-write account. */
isWritable: boolean;
};
/**
* List of TransactionInstruction object fields that may be initialized at construction
*
* @typedef {Object} TransactionInstructionCtorFields
* @property {Array<PublicKey>} keys
* @property {PublicKey} programId
* @property {?Buffer} data
*/
export type TransactionInstructionCtorFields = {
keys: Array<AccountMeta>;
@@ -64,13 +57,11 @@ export type TransactionInstructionCtorFields = {
/**
* Configuration object for Transaction.serialize()
*
* @typedef {Object} SerializeConfig
* @property {boolean|undefined} requireAllSignatures Require all transaction signatures be present (default: true)
* @property {boolean|undefined} verifySignatures Verify provided signatures (default: true)
*/
export type SerializeConfig = {
/** Require all transaction signatures be present (default: true) */
requireAllSignatures?: boolean;
/** Verify provided signatures (default: true) */
verifySignatures?: boolean;
};
@@ -114,28 +105,25 @@ export type SignaturePubkeyPair = {
/**
* List of Transaction object fields that may be initialized at construction
*
* @typedef {Object} TransactionCtorFields
* @property {?Blockhash} recentBlockhash A recent blockhash
* @property {?PublicKey} feePayer The transaction fee payer
* @property {?Array<SignaturePubkeyPair>} signatures One or more signatures
*
*/
type TransactionCtorFields = {
/** A recent blockhash */
recentBlockhash?: Blockhash | null;
/** Optional nonce information used for offline nonce'd transactions */
nonceInfo?: NonceInformation | null;
/** The transaction fee payer */
feePayer?: PublicKey | null;
/** One or more signatures */
signatures?: Array<SignaturePubkeyPair>;
};
/**
* NonceInformation to be used to build a Transaction.
*
* @typedef {Object} NonceInformation
* @property {Blockhash} nonce The current Nonce blockhash
* @property {TransactionInstruction} nonceInstruction AdvanceNonceAccount Instruction
* Nonce information to be used to build an offline Transaction.
*/
type NonceInformation = {
/** The current blockhash stored in the nonce */
nonce: Blockhash;
/** AdvanceNonceAccount Instruction */
nonceInstruction: TransactionInstruction;
};