fix: update TS SystemInstruction API and add missing flow method
This commit is contained in:
committed by
Michael Vines
parent
1578492259
commit
b2d30d6655
49
web3.js/module.d.ts
vendored
49
web3.js/module.d.ts
vendored
@ -544,49 +544,16 @@ declare module '@solana/web3.js' {
|
|||||||
export class SystemProgram {
|
export class SystemProgram {
|
||||||
static programId: PublicKey;
|
static programId: PublicKey;
|
||||||
|
|
||||||
static createAccount(
|
static createAccount(params: CreateAccountParams): Transaction;
|
||||||
from: PublicKey,
|
static transfer(params: TransferParams): Transaction;
|
||||||
newAccount: PublicKey,
|
static assign(params: AssignParams): Transaction;
|
||||||
lamports: number,
|
|
||||||
space: number,
|
|
||||||
programId: PublicKey,
|
|
||||||
): Transaction;
|
|
||||||
static transfer(
|
|
||||||
from: PublicKey,
|
|
||||||
to: PublicKey,
|
|
||||||
amount: number,
|
|
||||||
): Transaction;
|
|
||||||
static assign(from: PublicKey, programId: PublicKey): Transaction;
|
|
||||||
static createAccountWithSeed(
|
static createAccountWithSeed(
|
||||||
from: PublicKey,
|
params: CreateAccountWithSeedParams,
|
||||||
newAccount: PublicKey,
|
|
||||||
base: PublicKey,
|
|
||||||
seed: string,
|
|
||||||
lamports: number,
|
|
||||||
space: number,
|
|
||||||
programId: PublicKey,
|
|
||||||
): Transaction;
|
|
||||||
static createNonceAccount(
|
|
||||||
from: PublicKey,
|
|
||||||
nonceAccount: PublicKey,
|
|
||||||
authorizedPubkey: PublicKey,
|
|
||||||
lamports: number,
|
|
||||||
): Transaction;
|
|
||||||
static nonceAdvance(
|
|
||||||
nonceAccount: PublicKey,
|
|
||||||
authorizedPubkey: PublicKey,
|
|
||||||
): TransactionInstruction;
|
|
||||||
static nonceWithdraw(
|
|
||||||
nonceAccount: PublicKey,
|
|
||||||
authorizedPubkey: PublicKey,
|
|
||||||
to: PublicKey,
|
|
||||||
lamports: number,
|
|
||||||
): Transaction;
|
|
||||||
static nonceAuthorize(
|
|
||||||
nonceAccount: PublicKey,
|
|
||||||
authorizedPubkey: PublicKey,
|
|
||||||
newAuthorized: PublicKey,
|
|
||||||
): Transaction;
|
): Transaction;
|
||||||
|
static createNonceAccount(params: CreateNonceAccountParams): Transaction;
|
||||||
|
static nonceAdvance(params: AdvanceNonceParams): TransactionInstruction;
|
||||||
|
static nonceWithdraw(params: WithdrawNonceParams): Transaction;
|
||||||
|
static nonceAuthorize(params: AuthorizeNonceParams): Transaction;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type SystemInstructionType =
|
export type SystemInstructionType =
|
||||||
|
@ -251,6 +251,126 @@ declare module '@solana/web3.js' {
|
|||||||
feeCalculator: FeeCalculator;
|
feeCalculator: FeeCalculator;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// === src/validator-info.js ===
|
||||||
|
declare export var VALIDATOR_INFO_KEY;
|
||||||
|
declare export type Info = {|
|
||||||
|
name: string,
|
||||||
|
website?: string,
|
||||||
|
details?: string,
|
||||||
|
keybaseUsername?: string,
|
||||||
|
|};
|
||||||
|
|
||||||
|
declare export class ValidatorInfo {
|
||||||
|
key: PublicKey;
|
||||||
|
info: Info;
|
||||||
|
|
||||||
|
constructor(key: PublicKey, info: Info): ValidatorInfo;
|
||||||
|
static fromConfigData(
|
||||||
|
buffer: Buffer | Uint8Array | Array<number>,
|
||||||
|
): ValidatorInfo | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// === src/sysvar.js ===
|
||||||
|
declare export var SYSVAR_CLOCK_PUBKEY;
|
||||||
|
declare export var SYSVAR_RENT_PUBKEY;
|
||||||
|
declare export var SYSVAR_REWARDS_PUBKEY;
|
||||||
|
declare export var SYSVAR_STAKE_HISTORY_PUBKEY;
|
||||||
|
|
||||||
|
// === src/vote-account.js ===
|
||||||
|
declare export var VOTE_PROGRAM_ID;
|
||||||
|
declare export type Lockout = {|
|
||||||
|
slot: number,
|
||||||
|
confirmationCount: number,
|
||||||
|
|};
|
||||||
|
|
||||||
|
declare export type EpochCredits = {|
|
||||||
|
epoch: number,
|
||||||
|
credits: number,
|
||||||
|
prevCredits: number,
|
||||||
|
|};
|
||||||
|
|
||||||
|
declare export class VoteAccount {
|
||||||
|
votes: Array<Lockout>;
|
||||||
|
nodePubkey: PublicKey;
|
||||||
|
authorizedVoterPubkey: PublicKey;
|
||||||
|
commission: number;
|
||||||
|
rootSlot: number | null;
|
||||||
|
epoch: number;
|
||||||
|
credits: number;
|
||||||
|
lastEpochCredits: number;
|
||||||
|
epochCredits: Array<EpochCredits>;
|
||||||
|
static fromAccountData(
|
||||||
|
buffer: Buffer | Uint8Array | Array<number>,
|
||||||
|
): VoteAccount;
|
||||||
|
}
|
||||||
|
|
||||||
|
// === src/instruction.js ===
|
||||||
|
declare export type InstructionType = {|
|
||||||
|
index: number,
|
||||||
|
layout: typeof BufferLayout,
|
||||||
|
|};
|
||||||
|
|
||||||
|
declare export function encodeData(
|
||||||
|
type: InstructionType,
|
||||||
|
fields: Object,
|
||||||
|
): Buffer;
|
||||||
|
|
||||||
|
// === src/transaction.js ===
|
||||||
|
declare export type TransactionSignature = string;
|
||||||
|
|
||||||
|
declare type TransactionInstructionCtorFields = {|
|
||||||
|
keys: ?Array<{pubkey: PublicKey, isSigner: boolean, isWritable: boolean}>,
|
||||||
|
programId?: PublicKey,
|
||||||
|
data?: Buffer,
|
||||||
|
|};
|
||||||
|
|
||||||
|
declare export class TransactionInstruction {
|
||||||
|
keys: Array<{pubkey: PublicKey, isSigner: boolean, isWritable: boolean}>;
|
||||||
|
programId: PublicKey;
|
||||||
|
data: Buffer;
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
opts?: TransactionInstructionCtorFields,
|
||||||
|
): TransactionInstruction;
|
||||||
|
}
|
||||||
|
|
||||||
|
declare type SignaturePubkeyPair = {|
|
||||||
|
signature: Buffer | null,
|
||||||
|
publicKey: PublicKey,
|
||||||
|
|};
|
||||||
|
|
||||||
|
declare type NonceInformation = {|
|
||||||
|
nonce: Blockhash,
|
||||||
|
nonceInstruction: TransactionInstruction,
|
||||||
|
|};
|
||||||
|
|
||||||
|
declare type TransactionCtorFields = {|
|
||||||
|
recentBlockhash?: Blockhash,
|
||||||
|
nonceInfo?: NonceInformation,
|
||||||
|
signatures?: Array<SignaturePubkeyPair>,
|
||||||
|
|};
|
||||||
|
|
||||||
|
declare export class Transaction {
|
||||||
|
signatures: Array<SignaturePubkeyPair>;
|
||||||
|
signature: ?Buffer;
|
||||||
|
instructions: Array<TransactionInstruction>;
|
||||||
|
recentBlockhash: ?Blockhash;
|
||||||
|
nonceInfo: ?NonceInformation;
|
||||||
|
|
||||||
|
constructor(opts?: TransactionCtorFields): Transaction;
|
||||||
|
static from(buffer: Buffer | Uint8Array | Array<number>): Transaction;
|
||||||
|
add(
|
||||||
|
...items: Array<
|
||||||
|
Transaction | TransactionInstruction | TransactionInstructionCtorFields,
|
||||||
|
>
|
||||||
|
): Transaction;
|
||||||
|
sign(...signers: Array<Account>): void;
|
||||||
|
signPartial(...partialSigners: Array<PublicKey | Account>): void;
|
||||||
|
addSigner(signer: Account): void;
|
||||||
|
verifySignatures(): boolean;
|
||||||
|
serialize(): Buffer;
|
||||||
|
}
|
||||||
|
|
||||||
// === src/stake-program.js ===
|
// === src/stake-program.js ===
|
||||||
declare export type StakeAuthorizationType = {|
|
declare export type StakeAuthorizationType = {|
|
||||||
index: number,
|
index: number,
|
||||||
@ -467,6 +587,9 @@ declare module '@solana/web3.js' {
|
|||||||
};
|
};
|
||||||
|
|
||||||
declare export class SystemInstruction {
|
declare export class SystemInstruction {
|
||||||
|
static decodeInstructionType(
|
||||||
|
instruction: TransactionInstruction,
|
||||||
|
): SystemInstructionType;
|
||||||
static decodeCreateAccount(
|
static decodeCreateAccount(
|
||||||
instruction: TransactionInstruction,
|
instruction: TransactionInstruction,
|
||||||
): CreateAccountParams;
|
): CreateAccountParams;
|
||||||
@ -489,126 +612,6 @@ declare module '@solana/web3.js' {
|
|||||||
): AuthorizeNonceParams;
|
): AuthorizeNonceParams;
|
||||||
}
|
}
|
||||||
|
|
||||||
// === src/validator-info.js ===
|
|
||||||
declare export var VALIDATOR_INFO_KEY;
|
|
||||||
declare export type Info = {|
|
|
||||||
name: string,
|
|
||||||
website?: string,
|
|
||||||
details?: string,
|
|
||||||
keybaseUsername?: string,
|
|
||||||
|};
|
|
||||||
|
|
||||||
declare export class ValidatorInfo {
|
|
||||||
key: PublicKey;
|
|
||||||
info: Info;
|
|
||||||
|
|
||||||
constructor(key: PublicKey, info: Info): ValidatorInfo;
|
|
||||||
static fromConfigData(
|
|
||||||
buffer: Buffer | Uint8Array | Array<number>,
|
|
||||||
): ValidatorInfo | null;
|
|
||||||
}
|
|
||||||
|
|
||||||
// === src/sysvar.js ===
|
|
||||||
declare export var SYSVAR_CLOCK_PUBKEY;
|
|
||||||
declare export var SYSVAR_RENT_PUBKEY;
|
|
||||||
declare export var SYSVAR_REWARDS_PUBKEY;
|
|
||||||
declare export var SYSVAR_STAKE_HISTORY_PUBKEY;
|
|
||||||
|
|
||||||
// === src/vote-account.js ===
|
|
||||||
declare export var VOTE_PROGRAM_ID;
|
|
||||||
declare export type Lockout = {|
|
|
||||||
slot: number,
|
|
||||||
confirmationCount: number,
|
|
||||||
|};
|
|
||||||
|
|
||||||
declare export type EpochCredits = {|
|
|
||||||
epoch: number,
|
|
||||||
credits: number,
|
|
||||||
prevCredits: number,
|
|
||||||
|};
|
|
||||||
|
|
||||||
declare export class VoteAccount {
|
|
||||||
votes: Array<Lockout>;
|
|
||||||
nodePubkey: PublicKey;
|
|
||||||
authorizedVoterPubkey: PublicKey;
|
|
||||||
commission: number;
|
|
||||||
rootSlot: number | null;
|
|
||||||
epoch: number;
|
|
||||||
credits: number;
|
|
||||||
lastEpochCredits: number;
|
|
||||||
epochCredits: Array<EpochCredits>;
|
|
||||||
static fromAccountData(
|
|
||||||
buffer: Buffer | Uint8Array | Array<number>,
|
|
||||||
): VoteAccount;
|
|
||||||
}
|
|
||||||
|
|
||||||
// === src/instruction.js ===
|
|
||||||
declare export type InstructionType = {|
|
|
||||||
index: number,
|
|
||||||
layout: typeof BufferLayout,
|
|
||||||
|};
|
|
||||||
|
|
||||||
declare export function encodeData(
|
|
||||||
type: InstructionType,
|
|
||||||
fields: Object,
|
|
||||||
): Buffer;
|
|
||||||
|
|
||||||
// === src/transaction.js ===
|
|
||||||
declare export type TransactionSignature = string;
|
|
||||||
|
|
||||||
declare type TransactionInstructionCtorFields = {|
|
|
||||||
keys: ?Array<{pubkey: PublicKey, isSigner: boolean, isWritable: boolean}>,
|
|
||||||
programId?: PublicKey,
|
|
||||||
data?: Buffer,
|
|
||||||
|};
|
|
||||||
|
|
||||||
declare export class TransactionInstruction {
|
|
||||||
keys: Array<{pubkey: PublicKey, isSigner: boolean, isWritable: boolean}>;
|
|
||||||
programId: PublicKey;
|
|
||||||
data: Buffer;
|
|
||||||
|
|
||||||
constructor(
|
|
||||||
opts?: TransactionInstructionCtorFields,
|
|
||||||
): TransactionInstruction;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare type SignaturePubkeyPair = {|
|
|
||||||
signature: Buffer | null,
|
|
||||||
publicKey: PublicKey,
|
|
||||||
|};
|
|
||||||
|
|
||||||
declare type NonceInformation = {|
|
|
||||||
nonce: Blockhash,
|
|
||||||
nonceInstruction: TransactionInstruction,
|
|
||||||
|};
|
|
||||||
|
|
||||||
declare type TransactionCtorFields = {|
|
|
||||||
recentBlockhash?: Blockhash,
|
|
||||||
nonceInfo?: NonceInformation,
|
|
||||||
signatures?: Array<SignaturePubkeyPair>,
|
|
||||||
|};
|
|
||||||
|
|
||||||
declare export class Transaction {
|
|
||||||
signatures: Array<SignaturePubkeyPair>;
|
|
||||||
signature: ?Buffer;
|
|
||||||
instructions: Array<TransactionInstruction>;
|
|
||||||
recentBlockhash: ?Blockhash;
|
|
||||||
nonceInfo: ?NonceInformation;
|
|
||||||
|
|
||||||
constructor(opts?: TransactionCtorFields): Transaction;
|
|
||||||
static from(buffer: Buffer | Uint8Array | Array<number>): Transaction;
|
|
||||||
add(
|
|
||||||
...items: Array<
|
|
||||||
Transaction | TransactionInstruction | TransactionInstructionCtorFields,
|
|
||||||
>
|
|
||||||
): Transaction;
|
|
||||||
sign(...signers: Array<Account>): void;
|
|
||||||
signPartial(...partialSigners: Array<PublicKey | Account>): void;
|
|
||||||
addSigner(signer: Account): void;
|
|
||||||
verifySignatures(): boolean;
|
|
||||||
serialize(): Buffer;
|
|
||||||
}
|
|
||||||
|
|
||||||
// === src/loader.js ===
|
// === src/loader.js ===
|
||||||
declare export class Loader {
|
declare export class Loader {
|
||||||
static getMinNumSignatures(dataLength: number): number;
|
static getMinNumSignatures(dataLength: number): number;
|
||||||
|
Reference in New Issue
Block a user