2020-02-03 05:36:35 -08:00
|
|
|
declare module '@solana/web3.js' {
|
2021-02-01 18:53:24 -08:00
|
|
|
import {Buffer} from 'buffer';
|
2020-02-03 05:36:35 -08:00
|
|
|
import * as BufferLayout from 'buffer-layout';
|
|
|
|
|
|
|
|
// === src/publickey.js ===
|
2020-10-13 13:40:38 -07:00
|
|
|
export const MAX_SEED_LENGTH: number;
|
2020-09-01 11:14:41 -07:00
|
|
|
export type PublicKeyNonce = [PublicKey, number];
|
2020-02-03 05:36:35 -08:00
|
|
|
export class PublicKey {
|
2020-02-12 16:25:22 -08:00
|
|
|
constructor(value: number | string | Buffer | Uint8Array | Array<number>);
|
2020-02-03 05:36:35 -08:00
|
|
|
static isPublicKey(o: object): boolean;
|
2020-03-16 02:44:12 -07:00
|
|
|
static createWithSeed(
|
|
|
|
fromPublicKey: PublicKey,
|
|
|
|
seed: string,
|
|
|
|
programId: PublicKey,
|
|
|
|
): Promise<PublicKey>;
|
2020-09-01 11:14:41 -07:00
|
|
|
static createProgramAddress(
|
|
|
|
seeds: Array<Buffer | Uint8Array>,
|
|
|
|
programId: PublicKey,
|
|
|
|
): Promise<PublicKey>;
|
|
|
|
static findProgramAddress(
|
|
|
|
seeds: Array<Buffer | Uint8Array>,
|
|
|
|
programId: PublicKey,
|
|
|
|
): Promise<PublicKeyNonce>;
|
2020-02-03 05:36:35 -08:00
|
|
|
equals(publickey: PublicKey): boolean;
|
|
|
|
toBase58(): string;
|
|
|
|
toBuffer(): Buffer;
|
|
|
|
toString(): string;
|
|
|
|
}
|
|
|
|
|
|
|
|
// === src/blockhash.js ===
|
|
|
|
export type Blockhash = string;
|
|
|
|
|
|
|
|
// === src/account.js ===
|
|
|
|
export class Account {
|
2020-02-12 16:25:22 -08:00
|
|
|
constructor(secretKey?: Buffer | Uint8Array | Array<number>);
|
2020-02-03 05:36:35 -08:00
|
|
|
publicKey: PublicKey;
|
|
|
|
secretKey: Buffer;
|
|
|
|
}
|
|
|
|
|
|
|
|
// === src/fee-calculator.js ===
|
|
|
|
export type FeeCalculator = {
|
|
|
|
lamportsPerSignature: number;
|
|
|
|
};
|
|
|
|
|
|
|
|
// === src/connection.js ===
|
2020-03-23 07:19:32 -07:00
|
|
|
export type Context = {
|
|
|
|
slot: number;
|
|
|
|
};
|
|
|
|
|
2020-06-03 04:55:42 -07:00
|
|
|
export type SendOptions = {
|
2020-06-15 03:34:58 -07:00
|
|
|
skipPreflight?: boolean;
|
2020-09-24 17:49:34 -07:00
|
|
|
preflightCommitment?: Commitment;
|
2020-06-03 04:55:42 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
export type ConfirmOptions = {
|
2020-09-07 22:12:47 -07:00
|
|
|
commitment?: Commitment;
|
2020-06-15 03:34:58 -07:00
|
|
|
skipPreflight?: boolean;
|
2020-09-24 17:49:34 -07:00
|
|
|
preflightCommitment?: Commitment;
|
2020-06-03 04:55:42 -07:00
|
|
|
};
|
|
|
|
|
2020-07-29 22:40:46 -07:00
|
|
|
export type ConfirmedSignaturesForAddress2Options = {
|
|
|
|
before?: TransactionSignature;
|
|
|
|
limit?: number;
|
|
|
|
};
|
|
|
|
|
2020-07-30 21:33:54 -07:00
|
|
|
export type TokenAccountsFilter =
|
|
|
|
| {
|
|
|
|
mint: PublicKey;
|
|
|
|
}
|
|
|
|
| {
|
|
|
|
programId: PublicKey;
|
|
|
|
};
|
|
|
|
|
2020-02-03 05:36:35 -08:00
|
|
|
export type RpcResponseAndContext<T> = {
|
2020-03-23 07:19:32 -07:00
|
|
|
context: Context;
|
2020-02-03 05:36:35 -08:00
|
|
|
value: T;
|
|
|
|
};
|
|
|
|
|
2020-06-03 04:55:42 -07:00
|
|
|
export type Commitment =
|
|
|
|
| 'max'
|
|
|
|
| 'recent'
|
|
|
|
| 'root'
|
|
|
|
| 'single'
|
|
|
|
| 'singleGossip';
|
2020-02-03 05:36:35 -08:00
|
|
|
|
2020-05-22 10:23:29 -07:00
|
|
|
export type LargestAccountsFilter = 'circulating' | 'nonCirculating';
|
|
|
|
|
|
|
|
export type GetLargestAccountsConfig = {
|
|
|
|
commitment?: Commitment;
|
|
|
|
filter?: LargestAccountsFilter;
|
|
|
|
};
|
|
|
|
|
2020-04-06 02:56:26 -07:00
|
|
|
export type SignatureStatusConfig = {
|
|
|
|
searchTransactionHistory: boolean;
|
|
|
|
};
|
|
|
|
|
2021-01-15 06:40:47 -08:00
|
|
|
export type TransactionConfirmationStatus =
|
|
|
|
| 'processed'
|
|
|
|
| 'confirmed'
|
|
|
|
| 'finalized';
|
|
|
|
|
2020-03-23 08:01:12 -07:00
|
|
|
export type SignatureStatus = {
|
|
|
|
slot: number;
|
2020-04-04 06:35:08 -07:00
|
|
|
err: TransactionError | null;
|
2020-03-26 06:37:45 -07:00
|
|
|
confirmations: number | null;
|
2021-01-15 06:40:47 -08:00
|
|
|
confirmationStatus: TransactionConfirmationStatus | null;
|
2020-03-23 08:01:12 -07:00
|
|
|
};
|
|
|
|
|
2020-07-29 22:40:46 -07:00
|
|
|
export type ConfirmedSignatureInfo = {
|
|
|
|
signature: string;
|
|
|
|
slot: number;
|
|
|
|
err: TransactionError | null;
|
|
|
|
memo: string | null;
|
2021-01-15 20:28:28 -08:00
|
|
|
blockTime?: number | null;
|
2020-07-29 22:40:46 -07:00
|
|
|
};
|
|
|
|
|
2020-02-03 05:36:35 -08:00
|
|
|
export type BlockhashAndFeeCalculator = {
|
|
|
|
blockhash: Blockhash;
|
|
|
|
feeCalculator: FeeCalculator;
|
|
|
|
};
|
|
|
|
|
2020-08-06 08:47:22 -07:00
|
|
|
export type PublicKeyAndAccount<T> = {
|
2020-02-03 05:36:35 -08:00
|
|
|
pubkey: PublicKey;
|
2020-08-06 08:47:22 -07:00
|
|
|
account: AccountInfo<T>;
|
2020-02-03 05:36:35 -08:00
|
|
|
};
|
|
|
|
|
2020-08-06 08:47:22 -07:00
|
|
|
export type AccountInfo<T> = {
|
2020-02-03 05:36:35 -08:00
|
|
|
executable: boolean;
|
|
|
|
owner: PublicKey;
|
|
|
|
lamports: number;
|
2020-08-06 08:47:22 -07:00
|
|
|
data: T;
|
2020-02-03 05:36:35 -08:00
|
|
|
rentEpoch?: number;
|
|
|
|
};
|
|
|
|
|
|
|
|
export type ContactInfo = {
|
2020-02-12 00:20:13 -08:00
|
|
|
pubkey: string;
|
2020-05-13 08:14:03 -07:00
|
|
|
gossip?: string;
|
2020-02-03 05:36:35 -08:00
|
|
|
tpu?: string;
|
|
|
|
rpc?: string;
|
2020-05-13 08:14:03 -07:00
|
|
|
version?: string;
|
2020-02-03 05:36:35 -08:00
|
|
|
};
|
|
|
|
|
2020-08-10 23:35:56 -07:00
|
|
|
export type SimulatedTransactionResponse = {
|
|
|
|
err: TransactionError | string | null;
|
|
|
|
logs: Array<string> | null;
|
|
|
|
};
|
|
|
|
|
2020-10-28 02:13:51 -07:00
|
|
|
export type CompiledInnerInstruction = {
|
|
|
|
index: number;
|
|
|
|
instructions: CompiledInstruction[];
|
|
|
|
};
|
|
|
|
|
2020-12-16 23:15:25 -08:00
|
|
|
export type TokenBalance = {
|
|
|
|
accountIndex: number;
|
|
|
|
mint: string;
|
|
|
|
uiTokenAmount: TokenAmount;
|
|
|
|
};
|
|
|
|
|
2020-04-21 20:12:59 -07:00
|
|
|
export type ConfirmedTransactionMeta = {
|
|
|
|
fee: number;
|
2020-10-28 02:13:51 -07:00
|
|
|
innerInstructions?: CompiledInnerInstruction[];
|
|
|
|
preBalances: Array<number>;
|
|
|
|
postBalances: Array<number>;
|
|
|
|
logMessages?: Array<string>;
|
2020-12-16 23:15:25 -08:00
|
|
|
preTokenBalances?: Array<TokenBalance>;
|
|
|
|
postTokenBalances?: Array<TokenBalance>;
|
2020-10-28 02:13:51 -07:00
|
|
|
err: TransactionError | null;
|
|
|
|
};
|
|
|
|
|
|
|
|
export type ParsedInnerInstruction = {
|
|
|
|
index: number;
|
|
|
|
instructions: (ParsedInstruction | PartiallyDecodedInstruction)[];
|
|
|
|
};
|
|
|
|
|
|
|
|
export type ParsedConfirmedTransactionMeta = {
|
|
|
|
fee: number;
|
|
|
|
innerInstructions?: ParsedInnerInstruction[];
|
2020-04-21 20:12:59 -07:00
|
|
|
preBalances: Array<number>;
|
|
|
|
postBalances: Array<number>;
|
2020-10-05 10:24:38 -07:00
|
|
|
logMessages?: Array<string>;
|
2020-12-16 23:15:25 -08:00
|
|
|
preTokenBalances?: Array<TokenBalance>;
|
|
|
|
postTokenBalances?: Array<TokenBalance>;
|
2020-04-21 20:12:59 -07:00
|
|
|
err: TransactionError | null;
|
|
|
|
};
|
|
|
|
|
2020-02-03 05:36:35 -08:00
|
|
|
export type ConfirmedBlock = {
|
|
|
|
blockhash: Blockhash;
|
|
|
|
previousBlockhash: Blockhash;
|
|
|
|
parentSlot: number;
|
|
|
|
transactions: Array<{
|
|
|
|
transaction: Transaction;
|
2020-04-21 20:12:59 -07:00
|
|
|
meta: ConfirmedTransactionMeta | null;
|
2020-02-03 05:36:35 -08:00
|
|
|
}>;
|
2021-01-15 20:28:28 -08:00
|
|
|
rewards: Array<{
|
|
|
|
pubkey: string;
|
|
|
|
lamports: number;
|
|
|
|
postBalance: number | null;
|
|
|
|
rewardType: string | null;
|
|
|
|
}>;
|
2020-02-03 05:36:35 -08:00
|
|
|
};
|
|
|
|
|
2020-10-08 20:26:58 -07:00
|
|
|
export type PerfSample = {
|
|
|
|
slot: number;
|
|
|
|
numTransactions: number;
|
|
|
|
numSlots: number;
|
|
|
|
samplePeriodSecs: number;
|
|
|
|
};
|
|
|
|
|
2020-04-21 00:40:44 -07:00
|
|
|
export type ConfirmedTransaction = {
|
|
|
|
slot: number;
|
|
|
|
transaction: Transaction;
|
2020-04-21 20:12:59 -07:00
|
|
|
meta: ConfirmedTransactionMeta | null;
|
2021-01-15 20:28:28 -08:00
|
|
|
blockTime?: number | null;
|
2020-04-21 00:40:44 -07:00
|
|
|
};
|
|
|
|
|
2020-08-06 04:16:01 -07:00
|
|
|
export type ParsedMessageAccount = {
|
|
|
|
pubkey: PublicKey;
|
|
|
|
signer: boolean;
|
|
|
|
writable: boolean;
|
|
|
|
};
|
|
|
|
|
|
|
|
export type ParsedInstruction = {
|
|
|
|
programId: PublicKey;
|
|
|
|
program: string;
|
|
|
|
parsed: string;
|
|
|
|
};
|
|
|
|
|
|
|
|
export type PartiallyDecodedInstruction = {
|
|
|
|
programId: PublicKey;
|
|
|
|
accounts: Array<PublicKey>;
|
|
|
|
data: string;
|
|
|
|
};
|
|
|
|
|
|
|
|
export type ParsedTransaction = {
|
|
|
|
signatures: Array<string>;
|
|
|
|
message: {
|
|
|
|
accountKeys: ParsedMessageAccount[];
|
|
|
|
instructions: (ParsedInstruction | PartiallyDecodedInstruction)[];
|
|
|
|
recentBlockhash: string;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
export type ParsedConfirmedTransaction = {
|
|
|
|
slot: number;
|
|
|
|
transaction: ParsedTransaction;
|
2020-10-28 02:13:51 -07:00
|
|
|
meta: ParsedConfirmedTransactionMeta | null;
|
2020-08-06 04:16:01 -07:00
|
|
|
};
|
|
|
|
|
2020-08-06 08:47:22 -07:00
|
|
|
export type ParsedAccountData = {
|
|
|
|
program: string;
|
|
|
|
parsed: any;
|
2020-08-11 20:44:28 -07:00
|
|
|
space: number;
|
2020-08-06 08:47:22 -07:00
|
|
|
};
|
|
|
|
|
2020-09-16 23:50:13 -07:00
|
|
|
export type StakeActivationData = {
|
|
|
|
state: 'active' | 'inactive' | 'activating' | 'deactivating';
|
|
|
|
active: number;
|
|
|
|
inactive: number;
|
|
|
|
};
|
|
|
|
|
2020-02-03 05:36:35 -08:00
|
|
|
export type KeyedAccountInfo = {
|
|
|
|
accountId: PublicKey;
|
2020-08-06 08:47:22 -07:00
|
|
|
accountInfo: AccountInfo<Buffer>;
|
2020-02-03 05:36:35 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
export type Version = {
|
|
|
|
'solana-core': string;
|
2020-09-29 10:55:23 -07:00
|
|
|
'feature-set'?: number;
|
2020-02-03 05:36:35 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
export type VoteAccountInfo = {
|
|
|
|
votePubkey: string;
|
|
|
|
nodePubkey: string;
|
|
|
|
stake: number;
|
|
|
|
commission: number;
|
|
|
|
};
|
|
|
|
|
|
|
|
export type SlotInfo = {
|
2020-07-17 22:22:58 -07:00
|
|
|
parent: number;
|
|
|
|
slot: number;
|
|
|
|
root: number;
|
2020-02-03 05:36:35 -08:00
|
|
|
};
|
|
|
|
|
2020-08-05 21:17:29 -07:00
|
|
|
export type TokenAmount = {
|
|
|
|
uiAmount: number;
|
|
|
|
decimals: number;
|
|
|
|
amount: string;
|
2020-07-30 21:33:54 -07:00
|
|
|
};
|
|
|
|
|
2020-08-11 02:28:07 -07:00
|
|
|
export type TokenAccountBalancePair = {
|
|
|
|
address: PublicKey;
|
|
|
|
amount: string;
|
|
|
|
decimals: number;
|
|
|
|
uiAmount: number;
|
|
|
|
};
|
|
|
|
|
2020-03-23 07:19:32 -07:00
|
|
|
export type AccountChangeCallback = (
|
2020-08-06 08:47:22 -07:00
|
|
|
accountInfo: AccountInfo<Buffer>,
|
2020-03-23 07:19:32 -07:00
|
|
|
context: Context,
|
|
|
|
) => void;
|
2020-02-03 05:36:35 -08:00
|
|
|
export type ProgramAccountChangeCallback = (
|
|
|
|
keyedAccountInfo: KeyedAccountInfo,
|
2020-03-23 07:19:32 -07:00
|
|
|
context: Context,
|
2020-02-03 05:36:35 -08:00
|
|
|
) => void;
|
|
|
|
export type SlotChangeCallback = (slotInfo: SlotInfo) => void;
|
2020-02-03 07:22:11 -08:00
|
|
|
export type SignatureResultCallback = (
|
2020-04-04 06:35:08 -07:00
|
|
|
signatureResult: SignatureResult,
|
2020-03-23 07:19:32 -07:00
|
|
|
context: Context,
|
2020-02-03 07:22:11 -08:00
|
|
|
) => void;
|
2020-03-27 07:22:53 -07:00
|
|
|
export type RootChangeCallback = (root: number) => void;
|
2020-02-03 05:36:35 -08:00
|
|
|
|
2020-04-04 06:35:08 -07:00
|
|
|
export type TransactionError = object;
|
|
|
|
export type SignatureResult = {
|
|
|
|
err: TransactionError | null;
|
2020-02-03 05:36:35 -08:00
|
|
|
};
|
|
|
|
|
2020-06-03 08:38:48 -07:00
|
|
|
export type InflationGovernor = {
|
2020-02-03 05:36:35 -08:00
|
|
|
foundation: number;
|
|
|
|
foundationTerm: number;
|
|
|
|
initial: number;
|
|
|
|
taper: number;
|
|
|
|
terminal: number;
|
|
|
|
};
|
|
|
|
|
2020-05-14 09:26:42 -07:00
|
|
|
export type EpochInfo = {
|
|
|
|
epoch: number;
|
|
|
|
slotIndex: number;
|
|
|
|
slotsInEpoch: number;
|
|
|
|
absoluteSlot: number;
|
2020-07-21 14:43:40 -07:00
|
|
|
blockHeight?: number;
|
2020-05-14 09:26:42 -07:00
|
|
|
};
|
|
|
|
|
2020-02-03 05:36:35 -08:00
|
|
|
export type EpochSchedule = {
|
|
|
|
slotsPerEpoch: number;
|
|
|
|
leaderScheduleSlotOffset: number;
|
|
|
|
warmup: boolean;
|
|
|
|
firstNormalEpoch: number;
|
|
|
|
firstNormalSlot: number;
|
|
|
|
};
|
|
|
|
|
2020-07-17 08:16:44 -07:00
|
|
|
export type LeaderSchedule = {
|
|
|
|
[address: string]: number[];
|
|
|
|
};
|
|
|
|
|
2020-05-22 04:30:22 -07:00
|
|
|
export type Supply = {
|
|
|
|
total: number;
|
|
|
|
circulating: number;
|
|
|
|
nonCirculating: number;
|
|
|
|
nonCirculatingAccounts: Array<PublicKey>;
|
|
|
|
};
|
|
|
|
|
2020-05-22 10:23:29 -07:00
|
|
|
export type AccountBalancePair = {
|
|
|
|
address: PublicKey;
|
|
|
|
lamports: number;
|
|
|
|
};
|
|
|
|
|
2020-02-03 05:36:35 -08:00
|
|
|
export type VoteAccountStatus = {
|
|
|
|
current: Array<VoteAccountInfo>;
|
|
|
|
delinquent: Array<VoteAccountInfo>;
|
|
|
|
};
|
|
|
|
|
|
|
|
export class Connection {
|
|
|
|
constructor(endpoint: string, commitment?: Commitment);
|
2020-04-06 02:56:26 -07:00
|
|
|
commitment?: Commitment;
|
2020-02-03 05:36:35 -08:00
|
|
|
getAccountInfoAndContext(
|
|
|
|
publicKey: PublicKey,
|
|
|
|
commitment?: Commitment,
|
2020-08-06 08:47:22 -07:00
|
|
|
): Promise<RpcResponseAndContext<AccountInfo<Buffer> | null>>;
|
2020-02-03 05:36:35 -08:00
|
|
|
getAccountInfo(
|
|
|
|
publicKey: PublicKey,
|
|
|
|
commitment?: Commitment,
|
2020-08-06 08:47:22 -07:00
|
|
|
): Promise<AccountInfo<Buffer> | null>;
|
|
|
|
getParsedAccountInfo(
|
|
|
|
publicKey: PublicKey,
|
|
|
|
commitment?: Commitment,
|
|
|
|
): Promise<
|
|
|
|
RpcResponseAndContext<AccountInfo<Buffer | ParsedAccountData> | null>
|
|
|
|
>;
|
2020-09-16 23:50:13 -07:00
|
|
|
getStakeActivation(
|
|
|
|
publicKey: PublicKey,
|
|
|
|
commitment?: Commitment,
|
|
|
|
epoch?: number,
|
|
|
|
): Promise<StakeActivationData>;
|
2020-02-03 05:36:35 -08:00
|
|
|
getProgramAccounts(
|
|
|
|
programId: PublicKey,
|
|
|
|
commitment?: Commitment,
|
2020-08-06 08:47:22 -07:00
|
|
|
): Promise<Array<PublicKeyAndAccount<Buffer>>>;
|
|
|
|
getParsedProgramAccounts(
|
|
|
|
programId: PublicKey,
|
|
|
|
commitment?: Commitment,
|
|
|
|
): Promise<Array<PublicKeyAndAccount<Buffer | ParsedAccountData>>>;
|
2020-02-03 05:36:35 -08:00
|
|
|
getBalanceAndContext(
|
|
|
|
publicKey: PublicKey,
|
|
|
|
commitment?: Commitment,
|
|
|
|
): Promise<RpcResponseAndContext<number>>;
|
|
|
|
getBalance(publicKey: PublicKey, commitment?: Commitment): Promise<number>;
|
2020-05-18 20:27:36 -07:00
|
|
|
getBlockTime(slot: number): Promise<number | null>;
|
2020-05-21 01:58:17 -07:00
|
|
|
getMinimumLedgerSlot(): Promise<number>;
|
2020-05-23 02:33:04 -07:00
|
|
|
getFirstAvailableBlock(): Promise<number>;
|
2020-05-22 04:30:22 -07:00
|
|
|
getSupply(commitment?: Commitment): Promise<RpcResponseAndContext<Supply>>;
|
2020-07-30 21:33:54 -07:00
|
|
|
getTokenSupply(
|
|
|
|
tokenMintAddress: PublicKey,
|
|
|
|
commitment?: Commitment,
|
2020-08-05 21:17:29 -07:00
|
|
|
): Promise<RpcResponseAndContext<TokenAmount>>;
|
2020-07-30 21:33:54 -07:00
|
|
|
getTokenAccountBalance(
|
|
|
|
tokenAddress: PublicKey,
|
|
|
|
commitment?: Commitment,
|
2020-08-05 21:17:29 -07:00
|
|
|
): Promise<RpcResponseAndContext<TokenAmount>>;
|
2020-07-30 21:33:54 -07:00
|
|
|
getTokenAccountsByOwner(
|
|
|
|
ownerAddress: PublicKey,
|
|
|
|
filter: TokenAccountsFilter,
|
|
|
|
commitment?: Commitment,
|
|
|
|
): Promise<
|
2020-08-06 08:47:22 -07:00
|
|
|
RpcResponseAndContext<
|
|
|
|
Array<{pubkey: PublicKey; account: AccountInfo<Buffer>}>
|
|
|
|
>
|
|
|
|
>;
|
|
|
|
getParsedTokenAccountsByOwner(
|
|
|
|
ownerAddress: PublicKey,
|
|
|
|
filter: TokenAccountsFilter,
|
|
|
|
commitment?: Commitment,
|
|
|
|
): Promise<
|
|
|
|
RpcResponseAndContext<
|
|
|
|
Array<{pubkey: PublicKey; account: AccountInfo<ParsedAccountData>}>
|
|
|
|
>
|
2020-07-30 21:33:54 -07:00
|
|
|
>;
|
2020-05-22 10:23:29 -07:00
|
|
|
getLargestAccounts(
|
|
|
|
config?: GetLargestAccountsConfig,
|
|
|
|
): Promise<RpcResponseAndContext<Array<AccountBalancePair>>>;
|
2020-08-11 02:28:07 -07:00
|
|
|
getTokenLargestAccounts(
|
|
|
|
mintAddress: PublicKey,
|
|
|
|
commitment?: Commitment,
|
|
|
|
): Promise<RpcResponseAndContext<Array<TokenAccountBalancePair>>>;
|
2020-02-03 05:36:35 -08:00
|
|
|
getClusterNodes(): Promise<Array<ContactInfo>>;
|
2020-03-31 07:47:06 -07:00
|
|
|
getConfirmedBlock(slot: number): Promise<ConfirmedBlock>;
|
2020-04-21 00:40:44 -07:00
|
|
|
getConfirmedTransaction(
|
|
|
|
signature: TransactionSignature,
|
|
|
|
): Promise<ConfirmedTransaction | null>;
|
2020-08-06 04:16:01 -07:00
|
|
|
getParsedConfirmedTransaction(
|
|
|
|
signature: TransactionSignature,
|
|
|
|
): Promise<ParsedConfirmedTransaction | null>;
|
2020-04-21 00:40:44 -07:00
|
|
|
getConfirmedSignaturesForAddress(
|
|
|
|
address: PublicKey,
|
|
|
|
startSlot: number,
|
|
|
|
endSlot: number,
|
|
|
|
): Promise<Array<TransactionSignature>>;
|
2020-08-07 01:41:22 -07:00
|
|
|
getConfirmedSignaturesForAddress2(
|
|
|
|
address: PublicKey,
|
|
|
|
options?: ConfirmedSignaturesForAddress2Options,
|
|
|
|
): Promise<Array<ConfirmedSignatureInfo>>;
|
2020-02-03 05:36:35 -08:00
|
|
|
getVoteAccounts(commitment?: Commitment): Promise<VoteAccountStatus>;
|
|
|
|
confirmTransaction(
|
|
|
|
signature: TransactionSignature,
|
2020-09-07 22:12:47 -07:00
|
|
|
commitment?: Commitment,
|
|
|
|
): Promise<RpcResponseAndContext<SignatureResult>>;
|
2020-02-03 05:36:35 -08:00
|
|
|
getSlot(commitment?: Commitment): Promise<number>;
|
|
|
|
getSlotLeader(commitment?: Commitment): Promise<string>;
|
|
|
|
getSignatureStatus(
|
|
|
|
signature: TransactionSignature,
|
2020-04-06 02:56:26 -07:00
|
|
|
config?: SignatureStatusConfig,
|
2020-03-26 06:37:45 -07:00
|
|
|
): Promise<RpcResponseAndContext<SignatureStatus | null>>;
|
2020-04-01 10:51:30 -07:00
|
|
|
getSignatureStatuses(
|
2020-03-23 08:01:12 -07:00
|
|
|
signatures: Array<TransactionSignature>,
|
2020-04-06 02:56:26 -07:00
|
|
|
config?: SignatureStatusConfig,
|
2020-03-26 06:37:45 -07:00
|
|
|
): Promise<RpcResponseAndContext<Array<SignatureStatus | null>>>;
|
2020-02-03 05:36:35 -08:00
|
|
|
getTransactionCount(commitment?: Commitment): Promise<number>;
|
|
|
|
getTotalSupply(commitment?: Commitment): Promise<number>;
|
|
|
|
getVersion(): Promise<Version>;
|
2020-06-03 08:38:48 -07:00
|
|
|
getInflationGovernor(commitment?: Commitment): Promise<InflationGovernor>;
|
2020-07-17 08:16:44 -07:00
|
|
|
getLeaderSchedule(): Promise<LeaderSchedule>;
|
2020-02-03 05:36:35 -08:00
|
|
|
getEpochSchedule(): Promise<EpochSchedule>;
|
2020-05-21 02:11:32 -07:00
|
|
|
getEpochInfo(commitment?: Commitment): Promise<EpochInfo>;
|
2020-02-03 05:36:35 -08:00
|
|
|
getRecentBlockhashAndContext(
|
|
|
|
commitment?: Commitment,
|
|
|
|
): Promise<RpcResponseAndContext<BlockhashAndFeeCalculator>>;
|
2020-10-08 20:26:58 -07:00
|
|
|
getRecentPerformanceSamples(limit?: number): Promise<Array<PerfSample>>;
|
2020-06-04 03:12:59 -07:00
|
|
|
getFeeCalculatorForBlockhash(
|
|
|
|
blockhash: Blockhash,
|
|
|
|
commitment?: Commitment,
|
|
|
|
): Promise<RpcResponseAndContext<FeeCalculator | null>>;
|
2020-02-03 05:36:35 -08:00
|
|
|
getRecentBlockhash(
|
|
|
|
commitment?: Commitment,
|
|
|
|
): Promise<BlockhashAndFeeCalculator>;
|
|
|
|
requestAirdrop(
|
|
|
|
to: PublicKey,
|
|
|
|
amount: number,
|
|
|
|
): Promise<TransactionSignature>;
|
|
|
|
sendTransaction(
|
|
|
|
transaction: Transaction,
|
2020-05-20 02:13:21 -07:00
|
|
|
signers: Array<Account>,
|
2020-06-03 04:55:42 -07:00
|
|
|
options?: SendOptions,
|
2020-02-03 05:36:35 -08:00
|
|
|
): Promise<TransactionSignature>;
|
|
|
|
sendEncodedTransaction(
|
|
|
|
encodedTransaction: string,
|
2020-06-03 04:55:42 -07:00
|
|
|
options?: SendOptions,
|
2020-02-03 05:36:35 -08:00
|
|
|
): Promise<TransactionSignature>;
|
2020-02-12 16:25:22 -08:00
|
|
|
sendRawTransaction(
|
|
|
|
wireTransaction: Buffer | Uint8Array | Array<number>,
|
2020-06-03 04:55:42 -07:00
|
|
|
options?: SendOptions,
|
2020-02-12 16:25:22 -08:00
|
|
|
): Promise<TransactionSignature>;
|
2020-08-10 23:35:56 -07:00
|
|
|
simulateTransaction(
|
|
|
|
transaction: Transaction,
|
|
|
|
signers?: Array<Account>,
|
|
|
|
): Promise<RpcResponseAndContext<SimulatedTransactionResponse>>;
|
2020-02-03 05:36:35 -08:00
|
|
|
onAccountChange(
|
|
|
|
publickey: PublicKey,
|
|
|
|
callback: AccountChangeCallback,
|
2020-05-20 21:17:38 -07:00
|
|
|
commitment?: Commitment,
|
2020-02-03 05:36:35 -08:00
|
|
|
): number;
|
|
|
|
removeAccountChangeListener(id: number): Promise<void>;
|
|
|
|
onProgramAccountChange(
|
|
|
|
programId: PublicKey,
|
|
|
|
callback: ProgramAccountChangeCallback,
|
2020-05-20 21:17:38 -07:00
|
|
|
commitment?: Commitment,
|
2020-02-03 05:36:35 -08:00
|
|
|
): number;
|
|
|
|
removeProgramAccountChangeListener(id: number): Promise<void>;
|
2020-02-03 07:22:11 -08:00
|
|
|
onSlotChange(callback: SlotChangeCallback): number;
|
|
|
|
removeSlotChangeListener(id: number): Promise<void>;
|
|
|
|
onSignature(
|
|
|
|
signature: TransactionSignature,
|
|
|
|
callback: SignatureResultCallback,
|
2020-05-20 21:17:38 -07:00
|
|
|
commitment?: Commitment,
|
2020-02-03 07:22:11 -08:00
|
|
|
): number;
|
|
|
|
removeSignatureListener(id: number): Promise<void>;
|
2020-03-27 07:22:53 -07:00
|
|
|
onRootChange(callback: RootChangeCallback): number;
|
|
|
|
removeRootChangeListener(id: number): Promise<void>;
|
2020-02-03 05:36:35 -08:00
|
|
|
validatorExit(): Promise<boolean>;
|
|
|
|
getMinimumBalanceForRentExemption(
|
|
|
|
dataLength: number,
|
|
|
|
commitment?: Commitment,
|
|
|
|
): Promise<number>;
|
2020-04-05 07:10:20 -07:00
|
|
|
getNonce(
|
|
|
|
nonceAccount: PublicKey,
|
|
|
|
commitment?: Commitment,
|
|
|
|
): Promise<NonceAccount>;
|
|
|
|
getNonceAndContext(
|
|
|
|
nonceAccount: PublicKey,
|
|
|
|
commitment?: Commitment,
|
|
|
|
): Promise<RpcResponseAndContext<NonceAccount>>;
|
2020-02-03 05:36:35 -08:00
|
|
|
}
|
|
|
|
|
2020-03-05 08:44:56 -08:00
|
|
|
// === src/nonce-account.js ===
|
|
|
|
export class NonceAccount {
|
|
|
|
authorizedPubkey: PublicKey;
|
|
|
|
nonce: Blockhash;
|
|
|
|
feeCalculator: FeeCalculator;
|
2020-05-13 07:44:41 -07:00
|
|
|
static fromAccountData(
|
|
|
|
buffer: Buffer | Uint8Array | Array<number>,
|
|
|
|
): NonceAccount;
|
2020-03-05 08:44:56 -08:00
|
|
|
}
|
|
|
|
|
2020-04-05 07:25:53 -07:00
|
|
|
export const NONCE_ACCOUNT_LENGTH: number;
|
|
|
|
|
2020-02-03 05:36:35 -08:00
|
|
|
// === src/validator-info.js ===
|
|
|
|
export const VALIDATOR_INFO_KEY: PublicKey;
|
|
|
|
export type Info = {
|
|
|
|
name: string;
|
|
|
|
website?: string;
|
|
|
|
details?: string;
|
|
|
|
keybaseUsername?: string;
|
|
|
|
};
|
|
|
|
|
|
|
|
export class ValidatorInfo {
|
|
|
|
key: PublicKey;
|
|
|
|
info: Info;
|
|
|
|
|
|
|
|
constructor(key: PublicKey, info: Info);
|
2020-02-14 06:33:11 -08:00
|
|
|
static fromConfigData(
|
|
|
|
buffer: Buffer | Uint8Array | Array<number>,
|
|
|
|
): ValidatorInfo | null;
|
2020-02-03 05:36:35 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
// === src/sysvar.js ===
|
|
|
|
export const SYSVAR_CLOCK_PUBKEY: PublicKey;
|
|
|
|
export const SYSVAR_RENT_PUBKEY: PublicKey;
|
|
|
|
export const SYSVAR_REWARDS_PUBKEY: PublicKey;
|
|
|
|
export const SYSVAR_STAKE_HISTORY_PUBKEY: PublicKey;
|
2020-10-22 13:15:24 -07:00
|
|
|
export const SYSVAR_INSTRUCTIONS_PUBKEY: PublicKey;
|
2020-02-03 05:36:35 -08:00
|
|
|
|
|
|
|
// === src/vote-account.js ===
|
|
|
|
export const VOTE_PROGRAM_ID: PublicKey;
|
|
|
|
export type Lockout = {
|
|
|
|
slot: number;
|
|
|
|
confirmationCount: number;
|
|
|
|
};
|
|
|
|
|
|
|
|
export type EpochCredits = {
|
|
|
|
epoch: number;
|
|
|
|
credits: number;
|
|
|
|
prevCredits: number;
|
|
|
|
};
|
|
|
|
|
|
|
|
export class VoteAccount {
|
|
|
|
votes: Array<Lockout>;
|
|
|
|
nodePubkey: PublicKey;
|
|
|
|
authorizedVoterPubkey: PublicKey;
|
|
|
|
commission: number;
|
|
|
|
rootSlot?: number;
|
|
|
|
epoch: number;
|
|
|
|
credits: number;
|
|
|
|
lastEpochCredits: number;
|
|
|
|
epochCredits: Array<EpochCredits>;
|
2020-02-14 06:33:11 -08:00
|
|
|
static fromAccountData(
|
|
|
|
buffer: Buffer | Uint8Array | Array<number>,
|
|
|
|
): VoteAccount;
|
2020-02-03 05:36:35 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
// === src/instruction.js ===
|
|
|
|
export type InstructionType = {
|
|
|
|
index: number;
|
|
|
|
layout: typeof BufferLayout;
|
|
|
|
};
|
|
|
|
|
|
|
|
export function encodeData(
|
|
|
|
type: InstructionType,
|
|
|
|
fields: Record<string, object>,
|
|
|
|
): Buffer;
|
|
|
|
|
2020-04-30 09:05:29 -07:00
|
|
|
// === src/message.js ===
|
|
|
|
export type MessageHeader = {
|
|
|
|
numRequiredSignatures: number;
|
|
|
|
numReadonlySignedAccounts: number;
|
|
|
|
numReadonlyUnsignedAccounts: number;
|
|
|
|
};
|
|
|
|
|
|
|
|
export type CompiledInstruction = {
|
|
|
|
programIdIndex: number;
|
|
|
|
accounts: number[];
|
|
|
|
data: string;
|
|
|
|
};
|
|
|
|
|
|
|
|
export type MessageArgs = {
|
|
|
|
header: MessageHeader;
|
2020-06-10 22:15:14 -07:00
|
|
|
accountKeys: string[];
|
2020-04-30 09:05:29 -07:00
|
|
|
recentBlockhash: Blockhash;
|
|
|
|
instructions: CompiledInstruction[];
|
|
|
|
};
|
|
|
|
|
|
|
|
export class Message {
|
|
|
|
header: MessageHeader;
|
|
|
|
accountKeys: PublicKey[];
|
|
|
|
recentBlockhash: Blockhash;
|
|
|
|
instructions: CompiledInstruction[];
|
|
|
|
|
|
|
|
constructor(args: MessageArgs);
|
2020-10-26 17:12:26 -07:00
|
|
|
static from(buffer: Buffer | Uint8Array | Array<number>): Message;
|
2020-05-01 08:35:03 -07:00
|
|
|
isAccountWritable(index: number): boolean;
|
2020-04-30 09:05:29 -07:00
|
|
|
serialize(): Buffer;
|
|
|
|
}
|
|
|
|
|
2020-02-03 05:36:35 -08:00
|
|
|
// === src/transaction.js ===
|
|
|
|
export type TransactionSignature = string;
|
|
|
|
|
2020-04-30 09:05:29 -07:00
|
|
|
export type AccountMeta = {
|
|
|
|
pubkey: PublicKey;
|
|
|
|
isSigner: boolean;
|
|
|
|
isWritable: boolean;
|
|
|
|
};
|
|
|
|
|
2020-02-03 05:36:35 -08:00
|
|
|
export type TransactionInstructionCtorFields = {
|
2020-04-30 09:05:29 -07:00
|
|
|
keys?: Array<AccountMeta>;
|
2020-02-03 05:36:35 -08:00
|
|
|
programId?: PublicKey;
|
|
|
|
data?: Buffer;
|
|
|
|
};
|
|
|
|
|
|
|
|
export class TransactionInstruction {
|
2020-04-30 09:05:29 -07:00
|
|
|
keys: Array<AccountMeta>;
|
2020-02-03 05:36:35 -08:00
|
|
|
programId: PublicKey;
|
|
|
|
data: Buffer;
|
|
|
|
|
|
|
|
constructor(opts?: TransactionInstructionCtorFields);
|
|
|
|
}
|
|
|
|
|
|
|
|
export type SignaturePubkeyPair = {
|
|
|
|
signature?: Buffer;
|
|
|
|
publicKey: PublicKey;
|
|
|
|
};
|
|
|
|
|
2020-02-14 06:27:06 -08:00
|
|
|
export type NonceInformation = {
|
|
|
|
nonce: Blockhash;
|
|
|
|
nonceInstruction: TransactionInstruction;
|
|
|
|
};
|
|
|
|
|
2020-02-03 05:36:35 -08:00
|
|
|
export type TransactionCtorFields = {
|
|
|
|
recentBlockhash?: Blockhash;
|
2020-02-14 06:27:06 -08:00
|
|
|
nonceInfo?: NonceInformation;
|
2020-02-03 05:36:35 -08:00
|
|
|
signatures?: Array<SignaturePubkeyPair>;
|
2020-11-02 05:34:24 -08:00
|
|
|
feePayer?: PublicKey;
|
2020-02-03 05:36:35 -08:00
|
|
|
};
|
|
|
|
|
2020-09-11 15:04:36 -07:00
|
|
|
export type SerializeConfig = {
|
|
|
|
requireAllSignatures?: boolean;
|
|
|
|
verifySignatures?: boolean;
|
|
|
|
};
|
|
|
|
|
2020-02-03 05:36:35 -08:00
|
|
|
export class Transaction {
|
|
|
|
signatures: Array<SignaturePubkeyPair>;
|
|
|
|
signature?: Buffer;
|
|
|
|
instructions: Array<TransactionInstruction>;
|
|
|
|
recentBlockhash?: Blockhash;
|
2020-02-14 06:27:06 -08:00
|
|
|
nonceInfo?: NonceInformation;
|
2020-10-24 18:59:38 -07:00
|
|
|
feePayer?: PublicKey;
|
2020-02-03 05:36:35 -08:00
|
|
|
|
|
|
|
constructor(opts?: TransactionCtorFields);
|
2020-02-12 16:25:22 -08:00
|
|
|
static from(buffer: Buffer | Uint8Array | Array<number>): Transaction;
|
2020-06-10 22:15:14 -07:00
|
|
|
static populate(message: Message, signatures: Array<string>): Transaction;
|
2020-02-03 05:36:35 -08:00
|
|
|
add(
|
|
|
|
...items: Array<
|
|
|
|
Transaction | TransactionInstruction | TransactionInstructionCtorFields
|
|
|
|
>
|
|
|
|
): Transaction;
|
2020-04-30 09:05:29 -07:00
|
|
|
compileMessage(): Message;
|
2020-04-24 09:20:27 -07:00
|
|
|
serializeMessage(): Buffer;
|
2020-02-03 05:36:35 -08:00
|
|
|
sign(...signers: Array<Account>): void;
|
2020-09-09 23:04:09 -07:00
|
|
|
partialSign(...partialSigners: Array<Account>): void;
|
2020-04-23 14:44:19 -07:00
|
|
|
addSignature(pubkey: PublicKey, signature: Buffer): void;
|
2020-09-09 23:04:09 -07:00
|
|
|
setSigners(...signer: Array<PublicKey>): void;
|
2020-03-03 12:42:57 -08:00
|
|
|
verifySignatures(): boolean;
|
2020-09-11 15:04:36 -07:00
|
|
|
serialize(config?: SerializeConfig): Buffer;
|
2020-02-03 05:36:35 -08:00
|
|
|
}
|
|
|
|
|
2020-02-28 02:43:10 -08:00
|
|
|
// === src/stake-program.js ===
|
|
|
|
export type StakeAuthorizationType = {
|
|
|
|
index: number;
|
|
|
|
};
|
|
|
|
|
|
|
|
export class Authorized {
|
|
|
|
staker: PublicKey;
|
|
|
|
withdrawer: PublicKey;
|
|
|
|
constructor(staker: PublicKey, withdrawer: PublicKey);
|
|
|
|
}
|
|
|
|
|
|
|
|
export class Lockup {
|
|
|
|
unixTimestamp: number;
|
|
|
|
epoch: number;
|
|
|
|
custodian: PublicKey;
|
|
|
|
|
|
|
|
constructor(unixTimestamp: number, epoch: number, custodian: PublicKey);
|
|
|
|
}
|
|
|
|
|
2020-03-02 07:58:10 -08:00
|
|
|
export type CreateStakeAccountParams = {
|
|
|
|
fromPubkey: PublicKey;
|
|
|
|
stakePubkey: PublicKey;
|
|
|
|
authorized: Authorized;
|
|
|
|
lockup: Lockup;
|
|
|
|
lamports: number;
|
|
|
|
};
|
|
|
|
|
|
|
|
export type CreateStakeAccountWithSeedParams = {
|
|
|
|
fromPubkey: PublicKey;
|
|
|
|
stakePubkey: PublicKey;
|
|
|
|
basePubkey: PublicKey;
|
|
|
|
seed: string;
|
|
|
|
authorized: Authorized;
|
|
|
|
lockup: Lockup;
|
|
|
|
lamports: number;
|
|
|
|
};
|
|
|
|
|
|
|
|
export type InitializeStakeParams = {
|
|
|
|
stakePubkey: PublicKey;
|
|
|
|
authorized: Authorized;
|
|
|
|
lockup: Lockup;
|
|
|
|
};
|
|
|
|
|
|
|
|
export type DelegateStakeParams = {
|
|
|
|
stakePubkey: PublicKey;
|
|
|
|
authorizedPubkey: PublicKey;
|
|
|
|
votePubkey: PublicKey;
|
|
|
|
};
|
|
|
|
|
|
|
|
export type AuthorizeStakeParams = {
|
|
|
|
stakePubkey: PublicKey;
|
|
|
|
authorizedPubkey: PublicKey;
|
|
|
|
newAuthorizedPubkey: PublicKey;
|
|
|
|
stakeAuthorizationType: StakeAuthorizationType;
|
2021-01-26 09:40:41 -08:00
|
|
|
custodianPubkey?: PublicKey;
|
2020-03-02 07:58:10 -08:00
|
|
|
};
|
|
|
|
|
2020-08-21 11:28:01 -07:00
|
|
|
export type AuthorizeWithSeedStakeParams = {
|
|
|
|
stakePubkey: PublicKey;
|
|
|
|
authorityBase: PublicKey;
|
|
|
|
authoritySeed: string;
|
|
|
|
authorityOwner: PublicKey;
|
|
|
|
newAuthorizedPubkey: PublicKey;
|
|
|
|
stakeAuthorizationType: StakeAuthorizationType;
|
2021-01-26 09:40:41 -08:00
|
|
|
custodianPubkey?: PublicKey;
|
2020-08-21 11:28:01 -07:00
|
|
|
};
|
|
|
|
|
2020-03-02 07:58:10 -08:00
|
|
|
export type SplitStakeParams = {
|
|
|
|
stakePubkey: PublicKey;
|
|
|
|
authorizedPubkey: PublicKey;
|
|
|
|
splitStakePubkey: PublicKey;
|
|
|
|
lamports: number;
|
|
|
|
};
|
|
|
|
|
|
|
|
export type WithdrawStakeParams = {
|
|
|
|
stakePubkey: PublicKey;
|
|
|
|
authorizedPubkey: PublicKey;
|
|
|
|
toPubkey: PublicKey;
|
|
|
|
lamports: number;
|
2021-01-26 09:40:41 -08:00
|
|
|
custodianPubkey?: PublicKey;
|
2020-03-02 07:58:10 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
export type DeactivateStakeParams = {
|
|
|
|
stakePubkey: PublicKey;
|
|
|
|
authorizedPubkey: PublicKey;
|
|
|
|
};
|
|
|
|
|
2020-02-28 02:43:10 -08:00
|
|
|
export class StakeProgram {
|
|
|
|
static programId: PublicKey;
|
|
|
|
static space: number;
|
2020-03-02 07:58:10 -08:00
|
|
|
static createAccount(params: CreateStakeAccountParams): Transaction;
|
2020-02-28 02:43:10 -08:00
|
|
|
static createAccountWithSeed(
|
2020-03-02 07:58:10 -08:00
|
|
|
params: CreateStakeAccountWithSeedParams,
|
2020-02-28 02:43:10 -08:00
|
|
|
): Transaction;
|
2020-03-02 07:58:10 -08:00
|
|
|
static delegate(params: DelegateStakeParams): Transaction;
|
|
|
|
static authorize(params: AuthorizeStakeParams): Transaction;
|
2020-10-22 19:01:39 -07:00
|
|
|
static authorizeWithSeed(params: AuthorizeWithSeedStakeParams): Transaction;
|
2020-03-02 07:58:10 -08:00
|
|
|
static split(params: SplitStakeParams): Transaction;
|
|
|
|
static withdraw(params: WithdrawStakeParams): Transaction;
|
|
|
|
static deactivate(params: DeactivateStakeParams): Transaction;
|
2020-02-28 02:43:10 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
export type StakeInstructionType =
|
|
|
|
| 'Initialize'
|
|
|
|
| 'Authorize'
|
2020-08-21 11:28:01 -07:00
|
|
|
| 'AuthorizeWithSeed'
|
2020-02-28 02:43:10 -08:00
|
|
|
| 'Delegate'
|
|
|
|
| 'Split'
|
|
|
|
| 'Withdraw'
|
|
|
|
| 'Deactivate';
|
|
|
|
|
|
|
|
export const STAKE_INSTRUCTION_LAYOUTS: {
|
2020-03-02 19:16:19 -08:00
|
|
|
[type in StakeInstructionType]: InstructionType;
|
2020-02-28 02:43:10 -08:00
|
|
|
};
|
|
|
|
|
2020-03-02 07:58:10 -08:00
|
|
|
export class StakeInstruction {
|
|
|
|
static decodeInstructionType(
|
|
|
|
instruction: TransactionInstruction,
|
|
|
|
): StakeInstructionType;
|
|
|
|
static decodeInitialize(
|
|
|
|
instruction: TransactionInstruction,
|
|
|
|
): InitializeStakeParams;
|
|
|
|
static decodeDelegate(
|
|
|
|
instruction: TransactionInstruction,
|
|
|
|
): DelegateStakeParams;
|
|
|
|
static decodeAuthorize(
|
|
|
|
instruction: TransactionInstruction,
|
|
|
|
): AuthorizeStakeParams;
|
2020-10-22 19:01:39 -07:00
|
|
|
static decodeAuthorizeWithSeed(
|
|
|
|
instruction: TransactionInstruction,
|
|
|
|
): AuthorizeWithSeedStakeParams;
|
2020-03-02 07:58:10 -08:00
|
|
|
static decodeSplit(instruction: TransactionInstruction): SplitStakeParams;
|
|
|
|
static decodeWithdraw(
|
|
|
|
instruction: TransactionInstruction,
|
|
|
|
): WithdrawStakeParams;
|
|
|
|
static decodeDeactivate(
|
|
|
|
instruction: TransactionInstruction,
|
|
|
|
): DeactivateStakeParams;
|
2020-02-28 02:43:10 -08:00
|
|
|
}
|
|
|
|
|
2020-02-11 18:06:34 -08:00
|
|
|
// === src/system-program.js ===
|
2020-03-03 00:05:50 -08:00
|
|
|
export type CreateAccountParams = {
|
|
|
|
fromPubkey: PublicKey;
|
|
|
|
newAccountPubkey: PublicKey;
|
|
|
|
lamports: number;
|
|
|
|
space: number;
|
|
|
|
programId: PublicKey;
|
|
|
|
};
|
|
|
|
|
2020-05-09 03:33:36 -07:00
|
|
|
export type CreateAccountWithSeedParams = {
|
2020-03-03 00:05:50 -08:00
|
|
|
fromPubkey: PublicKey;
|
2020-05-09 03:33:36 -07:00
|
|
|
newAccountPubkey: PublicKey;
|
|
|
|
basePubkey: PublicKey;
|
|
|
|
seed: string;
|
2020-03-03 00:05:50 -08:00
|
|
|
lamports: number;
|
2020-05-09 03:33:36 -07:00
|
|
|
space: number;
|
|
|
|
programId: PublicKey;
|
|
|
|
};
|
|
|
|
|
|
|
|
export type AllocateParams = {
|
|
|
|
accountPubkey: PublicKey;
|
|
|
|
space: number;
|
|
|
|
};
|
|
|
|
|
|
|
|
export type AllocateWithSeedParams = {
|
|
|
|
accountPubkey: PublicKey;
|
|
|
|
basePubkey: PublicKey;
|
|
|
|
seed: string;
|
|
|
|
space: number;
|
|
|
|
programId: PublicKey;
|
2020-03-03 00:05:50 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
export type AssignParams = {
|
2020-05-09 03:33:36 -07:00
|
|
|
accountPubkey: PublicKey;
|
2020-03-03 00:05:50 -08:00
|
|
|
programId: PublicKey;
|
|
|
|
};
|
|
|
|
|
2020-05-09 03:33:36 -07:00
|
|
|
export type AssignWithSeedParams = {
|
|
|
|
accountPubkey: PublicKey;
|
2020-03-03 00:05:50 -08:00
|
|
|
basePubkey: PublicKey;
|
|
|
|
seed: string;
|
|
|
|
programId: PublicKey;
|
|
|
|
};
|
|
|
|
|
2020-05-09 03:33:36 -07:00
|
|
|
export type TransferParams = {
|
|
|
|
fromPubkey: PublicKey;
|
|
|
|
toPubkey: PublicKey;
|
|
|
|
lamports: number;
|
|
|
|
};
|
|
|
|
|
2021-01-14 08:59:31 -08:00
|
|
|
export type TransferWithSeedParams = {
|
|
|
|
fromPubkey: PublicKey;
|
|
|
|
basePubkey: PublicKey;
|
|
|
|
toPubkey: PublicKey;
|
|
|
|
lamports: number;
|
|
|
|
seed: string;
|
|
|
|
programId: PublicKey;
|
|
|
|
};
|
|
|
|
|
2020-03-03 00:05:50 -08:00
|
|
|
export type CreateNonceAccountParams = {
|
|
|
|
fromPubkey: PublicKey;
|
|
|
|
noncePubkey: PublicKey;
|
|
|
|
authorizedPubkey: PublicKey;
|
|
|
|
lamports: number;
|
|
|
|
};
|
|
|
|
|
2020-05-04 22:30:55 -07:00
|
|
|
export type CreateNonceAccountWithSeedParams = {
|
|
|
|
fromPubkey: PublicKey;
|
|
|
|
noncePubkey: PublicKey;
|
|
|
|
authorizedPubkey: PublicKey;
|
|
|
|
lamports: number;
|
|
|
|
basePubkey: PublicKey;
|
|
|
|
seed: string;
|
|
|
|
};
|
|
|
|
|
2020-03-03 00:05:50 -08:00
|
|
|
export type InitializeNonceParams = {
|
|
|
|
noncePubkey: PublicKey;
|
|
|
|
authorizedPubkey: PublicKey;
|
|
|
|
};
|
|
|
|
|
|
|
|
export type AdvanceNonceParams = {
|
|
|
|
noncePubkey: PublicKey;
|
|
|
|
authorizedPubkey: PublicKey;
|
|
|
|
};
|
|
|
|
|
|
|
|
export type WithdrawNonceParams = {
|
|
|
|
noncePubkey: PublicKey;
|
|
|
|
authorizedPubkey: PublicKey;
|
|
|
|
toPubkey: PublicKey;
|
|
|
|
lamports: number;
|
|
|
|
};
|
|
|
|
|
|
|
|
export type AuthorizeNonceParams = {
|
|
|
|
noncePubkey: PublicKey;
|
|
|
|
authorizedPubkey: PublicKey;
|
|
|
|
newAuthorizedPubkey: PublicKey;
|
|
|
|
};
|
|
|
|
|
2020-02-11 18:06:34 -08:00
|
|
|
export class SystemProgram {
|
|
|
|
static programId: PublicKey;
|
|
|
|
|
2020-09-10 00:43:32 -07:00
|
|
|
static createAccount(params: CreateAccountParams): TransactionInstruction;
|
2020-02-11 18:06:34 -08:00
|
|
|
static createAccountWithSeed(
|
2020-03-08 19:48:50 -07:00
|
|
|
params: CreateAccountWithSeedParams,
|
2020-09-10 00:43:32 -07:00
|
|
|
): TransactionInstruction;
|
2020-05-09 03:33:36 -07:00
|
|
|
static allocate(
|
|
|
|
params: AllocateParams | AllocateWithSeedParams,
|
2020-09-10 00:43:32 -07:00
|
|
|
): TransactionInstruction;
|
|
|
|
static assign(
|
|
|
|
params: AssignParams | AssignWithSeedParams,
|
|
|
|
): TransactionInstruction;
|
2021-01-14 08:59:31 -08:00
|
|
|
static transfer(
|
|
|
|
params: TransferParams | TransferWithSeedParams,
|
|
|
|
): TransactionInstruction;
|
2020-05-04 22:30:55 -07:00
|
|
|
static createNonceAccount(
|
|
|
|
params: CreateNonceAccountParams | CreateNonceAccountWithSeedParams,
|
|
|
|
): Transaction;
|
2020-03-08 19:48:50 -07:00
|
|
|
static nonceAdvance(params: AdvanceNonceParams): TransactionInstruction;
|
2020-09-10 00:43:32 -07:00
|
|
|
static nonceWithdraw(params: WithdrawNonceParams): TransactionInstruction;
|
|
|
|
static nonceAuthorize(params: AuthorizeNonceParams): TransactionInstruction;
|
2020-02-11 18:06:34 -08:00
|
|
|
}
|
|
|
|
|
2020-02-28 02:43:10 -08:00
|
|
|
export type SystemInstructionType =
|
|
|
|
| 'Create'
|
2020-05-09 03:33:36 -07:00
|
|
|
| 'CreateWithSeed'
|
|
|
|
| 'Allocate'
|
|
|
|
| 'AllocateWithSeed'
|
2020-02-28 02:43:10 -08:00
|
|
|
| 'Assign'
|
2020-05-09 03:33:36 -07:00
|
|
|
| 'AssignWithSeed'
|
2020-02-28 02:43:10 -08:00
|
|
|
| 'Transfer'
|
2021-01-14 08:59:31 -08:00
|
|
|
| 'TransferWithSeed'
|
2020-02-28 02:43:10 -08:00
|
|
|
| 'AdvanceNonceAccount'
|
|
|
|
| 'WithdrawNonceAccount'
|
|
|
|
| 'InitializeNonceAccount'
|
|
|
|
| 'AuthorizeNonceAccount';
|
|
|
|
|
|
|
|
export const SYSTEM_INSTRUCTION_LAYOUTS: {
|
2020-03-02 19:16:19 -08:00
|
|
|
[type in SystemInstructionType]: InstructionType;
|
2020-02-28 02:43:10 -08:00
|
|
|
};
|
|
|
|
|
2020-03-03 00:05:50 -08:00
|
|
|
export class SystemInstruction {
|
|
|
|
static decodeInstructionType(
|
|
|
|
instruction: TransactionInstruction,
|
|
|
|
): SystemInstructionType;
|
|
|
|
static decodeCreateAccount(
|
|
|
|
instruction: TransactionInstruction,
|
|
|
|
): CreateAccountParams;
|
|
|
|
static decodeCreateWithSeed(
|
|
|
|
instruction: TransactionInstruction,
|
|
|
|
): CreateAccountWithSeedParams;
|
2020-05-09 03:33:36 -07:00
|
|
|
static decodeAllocate(instruction: TransactionInstruction): AllocateParams;
|
|
|
|
static decodeAllocateWithSeed(
|
|
|
|
instruction: TransactionInstruction,
|
|
|
|
): AllocateWithSeedParams;
|
|
|
|
static decodeAssign(instruction: TransactionInstruction): AssignParams;
|
|
|
|
static decodeAssignWithSeed(
|
|
|
|
instruction: TransactionInstruction,
|
|
|
|
): AssignWithSeedParams;
|
|
|
|
static decodeTransfer(instruction: TransactionInstruction): TransferParams;
|
2021-01-14 08:59:31 -08:00
|
|
|
static decodeTransferWithSeed(
|
|
|
|
instruction: TransactionInstruction,
|
|
|
|
): TransferWithSeedParams;
|
2020-03-03 00:05:50 -08:00
|
|
|
static decodeNonceInitialize(
|
|
|
|
instruction: TransactionInstruction,
|
|
|
|
): InitializeNonceParams;
|
|
|
|
static decodeNonceAdvance(
|
|
|
|
instruction: TransactionInstruction,
|
|
|
|
): AdvanceNonceParams;
|
|
|
|
static decodeNonceWithdraw(
|
|
|
|
instruction: TransactionInstruction,
|
|
|
|
): WithdrawNonceParams;
|
|
|
|
static decodeNonceAuthorize(
|
|
|
|
instruction: TransactionInstruction,
|
|
|
|
): AuthorizeNonceParams;
|
2020-02-11 18:06:34 -08:00
|
|
|
}
|
|
|
|
|
2020-10-22 13:15:24 -07:00
|
|
|
// === src/secp256k1-program.js ===
|
|
|
|
export type CreateSecp256k1InstructionWithPublicKeyParams = {
|
|
|
|
publicKey: Buffer | Uint8Array | Array<number>;
|
|
|
|
message: Buffer | Uint8Array | Array<number>;
|
|
|
|
signature: Buffer | Uint8Array | Array<number>;
|
|
|
|
recoveryId: number;
|
|
|
|
};
|
|
|
|
|
|
|
|
export type CreateSecp256k1InstructionWithPrivateKeyParams = {
|
|
|
|
privateKey: Buffer | Uint8Array | Array<number>;
|
|
|
|
message: Buffer | Uint8Array | Array<number>;
|
|
|
|
};
|
|
|
|
|
|
|
|
export class Secp256k1Program {
|
|
|
|
static get programId(): PublicKey;
|
|
|
|
|
|
|
|
static createInstructionWithPublicKey(
|
|
|
|
params: CreateSecp256k1InstructionWithPublicKeyParams,
|
|
|
|
): TransactionInstruction;
|
|
|
|
|
|
|
|
static createInstructionWithPrivateKey(
|
|
|
|
params: CreateSecp256k1InstructionWithPrivateKeyParams,
|
|
|
|
): TransactionInstruction;
|
|
|
|
}
|
|
|
|
|
2020-02-03 05:36:35 -08:00
|
|
|
// === src/loader.js ===
|
|
|
|
export class Loader {
|
|
|
|
static getMinNumSignatures(dataLength: number): number;
|
|
|
|
static load(
|
|
|
|
connection: Connection,
|
|
|
|
payer: Account,
|
|
|
|
program: Account,
|
|
|
|
programId: PublicKey,
|
2020-02-12 16:25:22 -08:00
|
|
|
data: Buffer | Uint8Array | Array<number>,
|
2020-09-23 07:54:27 -07:00
|
|
|
): Promise<boolean>;
|
2020-02-03 05:36:35 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
// === src/bpf-loader.js ===
|
2020-08-25 09:05:33 -07:00
|
|
|
export const BPF_LOADER_PROGRAM_ID: PublicKey;
|
2020-02-03 05:36:35 -08:00
|
|
|
export class BpfLoader {
|
|
|
|
static getMinNumSignatures(dataLength: number): number;
|
|
|
|
static load(
|
|
|
|
connection: Connection,
|
|
|
|
payer: Account,
|
2020-04-15 06:26:19 -07:00
|
|
|
program: Account,
|
2020-02-12 16:25:22 -08:00
|
|
|
elfBytes: Buffer | Uint8Array | Array<number>,
|
2020-08-25 09:05:33 -07:00
|
|
|
loaderProgramId: PublicKey,
|
2020-09-23 07:54:27 -07:00
|
|
|
): Promise<boolean>;
|
2020-02-03 05:36:35 -08:00
|
|
|
}
|
|
|
|
|
2020-08-25 09:05:33 -07:00
|
|
|
// === src/bpf-loader-deprecated.js ===
|
|
|
|
export const BPF_LOADER_DEPRECATED_PROGRAM_ID: PublicKey;
|
|
|
|
|
2020-02-03 05:36:35 -08:00
|
|
|
// === src/util/send-and-confirm-transaction.js ===
|
|
|
|
export function sendAndConfirmTransaction(
|
|
|
|
connection: Connection,
|
|
|
|
transaction: Transaction,
|
2020-05-20 02:13:21 -07:00
|
|
|
signers: Array<Account>,
|
2020-06-03 04:55:42 -07:00
|
|
|
options?: ConfirmOptions,
|
2020-02-03 05:36:35 -08:00
|
|
|
): Promise<TransactionSignature>;
|
|
|
|
|
|
|
|
// === src/util/send-and-confirm-raw-transaction.js ===
|
|
|
|
export function sendAndConfirmRawTransaction(
|
|
|
|
connection: Connection,
|
|
|
|
wireTransaction: Buffer,
|
2020-06-03 04:55:42 -07:00
|
|
|
options?: ConfirmOptions,
|
2020-02-03 05:36:35 -08:00
|
|
|
): Promise<TransactionSignature>;
|
|
|
|
|
2020-03-30 05:27:09 -07:00
|
|
|
// === src/util/cluster.js ===
|
|
|
|
export type Cluster = 'devnet' | 'testnet' | 'mainnet-beta';
|
2020-02-03 05:36:35 -08:00
|
|
|
|
2020-03-30 05:27:09 -07:00
|
|
|
export function clusterApiUrl(cluster?: Cluster, tls?: boolean): string;
|
|
|
|
|
|
|
|
// === src/index.js ===
|
2020-02-03 05:36:35 -08:00
|
|
|
export const LAMPORTS_PER_SOL: number;
|
|
|
|
}
|