feat: add getSlotLeader()/getClusterNodes()

This commit is contained in:
Michael Vines
2019-04-23 09:53:26 -07:00
parent 5f2bcd5200
commit a2cd9180b5
8 changed files with 177 additions and 43 deletions

View File

@ -43,6 +43,13 @@ declare module '@solana/web3.js' {
data: Buffer,
};
declare export type ContactInfo = {
id: string,
gossip: string,
tpu: string | null,
rpc: string | null,
};
declare export type KeyedAccountInfo = {
accountId: PublicKey,
accountInfo: AccountInfo,
@ -62,9 +69,11 @@ declare module '@solana/web3.js' {
declare export class Connection {
constructor(endpoint: string): Connection;
getBalance(publicKey: PublicKey): Promise<number>;
getAccountInfo(publicKey: PublicKey): Promise<AccountInfo>;
getBalance(publicKey: PublicKey): Promise<number>;
getClusterNodes(): Promise<Array<ContactInfo>>;
confirmTransaction(signature: TransactionSignature): Promise<boolean>;
getSlotLeader(): Promise<string>;
getSignatureStatus(
signature: TransactionSignature,
): Promise<SignatureSuccess | TransactionError | null>;
@ -102,7 +111,11 @@ declare module '@solana/web3.js' {
space: number,
programId: PublicKey,
): Transaction;
static transfer(from: PublicKey, to: PublicKey, amount: number): Transaction;
static transfer(
from: PublicKey,
to: PublicKey,
amount: number,
): Transaction;
static assign(from: PublicKey, programId: PublicKey): Transaction;
}