chore: fix up docs
This commit is contained in:
committed by
Michael Vines
parent
8cf98ec4e2
commit
830c55d07b
@ -1,6 +1,6 @@
|
|||||||
// @flow
|
// @flow
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {string} Blockhhash
|
* @typedef {string} Blockhash
|
||||||
*/
|
*/
|
||||||
export type Blockhash = string;
|
export type Blockhash = string;
|
||||||
|
@ -21,6 +21,13 @@ import type {TransactionSignature} from './transaction';
|
|||||||
|
|
||||||
type RpcRequest = (methodName: string, args: Array<any>) => any;
|
type RpcRequest = (methodName: string, args: Array<any>) => any;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* RPC Response with extra contextual information
|
||||||
|
*
|
||||||
|
* @typedef {Object} RpcResponseAndContext
|
||||||
|
* @property {{slot: number}} context
|
||||||
|
* @property {T} value response
|
||||||
|
*/
|
||||||
type RpcResponseAndContext<T> = {
|
type RpcResponseAndContext<T> = {
|
||||||
context: {
|
context: {
|
||||||
slot: number,
|
slot: number,
|
||||||
@ -658,22 +665,6 @@ export type TransactionError = {|
|
|||||||
Err: Object,
|
Err: Object,
|
||||||
|};
|
|};
|
||||||
|
|
||||||
/**
|
|
||||||
* @ignore
|
|
||||||
*/
|
|
||||||
type BlockhashAndFeeCalculator = {
|
|
||||||
blockhash: Blockhash,
|
|
||||||
feeCalculator: FeeCalculator,
|
|
||||||
}; // This type exists to workaround an esdoc parse error
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ignore
|
|
||||||
*/
|
|
||||||
type PublicKeyAndAccount = {
|
|
||||||
pubkey: PublicKey,
|
|
||||||
account: AccountInfo,
|
|
||||||
}; // This type exists to workaround an esdoc parse error
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A connection to a fullnode JSON RPC endpoint
|
* A connection to a fullnode JSON RPC endpoint
|
||||||
*/
|
*/
|
||||||
@ -834,11 +825,13 @@ export class Connection {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Fetch all the accounts owned by the specified program id
|
* Fetch all the accounts owned by the specified program id
|
||||||
|
*
|
||||||
|
* @return {Promise<Array<{pubkey: PublicKey, account: AccountInfo}>>}
|
||||||
*/
|
*/
|
||||||
async getProgramAccounts(
|
async getProgramAccounts(
|
||||||
programId: PublicKey,
|
programId: PublicKey,
|
||||||
commitment: ?Commitment,
|
commitment: ?Commitment,
|
||||||
): Promise<Array<PublicKeyAndAccount>> {
|
): Promise<Array<{pubkey: PublicKey, account: AccountInfo}>> {
|
||||||
const args = this._argsWithCommitment([programId.toBase58()], commitment);
|
const args = this._argsWithCommitment([programId.toBase58()], commitment);
|
||||||
const unsafeRes = await this._rpcRequest('getProgramAccounts', args);
|
const unsafeRes = await this._rpcRequest('getProgramAccounts', args);
|
||||||
const res = GetProgramAccountsRpcResult(unsafeRes);
|
const res = GetProgramAccountsRpcResult(unsafeRes);
|
||||||
@ -1060,10 +1053,13 @@ export class Connection {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Fetch a recent blockhash from the cluster, return with context
|
* Fetch a recent blockhash from the cluster, return with context
|
||||||
|
* @return {Promise<RpcResponseAndContext<{blockhash: Blockhash, feeCalculator: FeeCalculator}>>}
|
||||||
*/
|
*/
|
||||||
async getRecentBlockhashAndContext(
|
async getRecentBlockhashAndContext(
|
||||||
commitment: ?Commitment,
|
commitment: ?Commitment,
|
||||||
): Promise<RpcResponseAndContext<BlockhashAndFeeCalculator>> {
|
): Promise<
|
||||||
|
RpcResponseAndContext<{blockhash: Blockhash, feeCalculator: FeeCalculator}>,
|
||||||
|
> {
|
||||||
const args = this._argsWithCommitment([], commitment);
|
const args = this._argsWithCommitment([], commitment);
|
||||||
const unsafeRes = await this._rpcRequest('getRecentBlockhash', args);
|
const unsafeRes = await this._rpcRequest('getRecentBlockhash', args);
|
||||||
|
|
||||||
@ -1077,10 +1073,11 @@ export class Connection {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Fetch a recent blockhash from the cluster
|
* Fetch a recent blockhash from the cluster
|
||||||
|
* @return {Promise<{blockhash: Blockhash, feeCalculator: FeeCalculator}>}
|
||||||
*/
|
*/
|
||||||
async getRecentBlockhash(
|
async getRecentBlockhash(
|
||||||
commitment: ?Commitment,
|
commitment: ?Commitment,
|
||||||
): Promise<BlockhashAndFeeCalculator> {
|
): Promise<{blockhash: Blockhash, feeCalculator: FeeCalculator}> {
|
||||||
return await this.getRecentBlockhashAndContext(commitment)
|
return await this.getRecentBlockhashAndContext(commitment)
|
||||||
.then(x => x.value)
|
.then(x => x.value)
|
||||||
.catch(e => {
|
.catch(e => {
|
||||||
|
@ -32,5 +32,7 @@ export {
|
|||||||
export {sendAndConfirmRawTransaction} from './util/send-and-confirm-raw-transaction';
|
export {sendAndConfirmRawTransaction} from './util/send-and-confirm-raw-transaction';
|
||||||
export {testnetChannelEndpoint} from './util/testnet';
|
export {testnetChannelEndpoint} from './util/testnet';
|
||||||
|
|
||||||
// There are 1-billion lamports in one SOL
|
/**
|
||||||
|
* There are 1-billion lamports in one SOL
|
||||||
|
*/
|
||||||
export const LAMPORTS_PER_SOL = 1000000000;
|
export const LAMPORTS_PER_SOL = 1000000000;
|
||||||
|
Reference in New Issue
Block a user