From b3aa9fda87d8a8ba5dd908c53c13138723bd6d68 Mon Sep 17 00:00:00 2001 From: Justin Starry Date: Wed, 12 Feb 2020 10:06:34 +0800 Subject: [PATCH] fix: add missing apis to flow and ts definitions --- web3.js/module.d.ts | 70 +++++++++++++++++++++++++----------------- web3.js/module.flow.js | 14 +++++++++ 2 files changed, 56 insertions(+), 28 deletions(-) diff --git a/web3.js/module.d.ts b/web3.js/module.d.ts index d4cc2e453f..0cf723d957 100644 --- a/web3.js/module.d.ts +++ b/web3.js/module.d.ts @@ -298,34 +298,6 @@ declare module '@solana/web3.js' { ): Transaction; } - // === src/system-program.js === - export class SystemProgram { - static programId: PublicKey; - - static createAccount( - from: PublicKey, - newAccount: PublicKey, - 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( - from: PublicKey, - newAccount: PublicKey, - base: PublicKey, - seed: string, - lamports: number, - space: number, - programId: PublicKey, - ): Transaction; - } - // === src/validator-info.js === export const VALIDATOR_INFO_KEY: PublicKey; export type Info = { @@ -424,6 +396,7 @@ declare module '@solana/web3.js' { recentBlockhash?: Blockhash; constructor(opts?: TransactionCtorFields); + static from(buffer: Buffer): Transaction; add( ...items: Array< Transaction | TransactionInstruction | TransactionInstructionCtorFields @@ -435,6 +408,47 @@ declare module '@solana/web3.js' { serialize(): Buffer; } + // === src/system-program.js === + export class SystemProgram { + static programId: PublicKey; + + static createAccount( + from: PublicKey, + newAccount: PublicKey, + 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( + from: PublicKey, + newAccount: PublicKey, + base: PublicKey, + seed: string, + lamports: number, + space: number, + programId: PublicKey, + ): Transaction; + } + + export class SystemInstruction extends TransactionInstruction { + type: InstructionType; + fromPublicKey: PublicKey | null; + toPublicKey: PublicKey | null; + amount: number | null; + + constructor( + opts?: TransactionInstructionCtorFields, + type?: InstructionType, + ); + static from(instruction: TransactionInstruction): SystemInstruction; + } + // === src/loader.js === export class Loader { static getMinNumSignatures(dataLength: number): number; diff --git a/web3.js/module.flow.js b/web3.js/module.flow.js index f366e4d2d2..5802efb869 100644 --- a/web3.js/module.flow.js +++ b/web3.js/module.flow.js @@ -342,6 +342,19 @@ declare module '@solana/web3.js' { ): Transaction; } + declare export class SystemInstruction extends TransactionInstruction { + type: InstructionType; + fromPublicKey: PublicKey | null; + toPublicKey: PublicKey | null; + amount: number | null; + + constructor( + opts?: TransactionInstructionCtorFields, + type?: InstructionType, + ): SystemInstruction; + static from(instruction: TransactionInstruction): SystemInstruction; + } + // === src/validator-info.js === declare export var VALIDATOR_INFO_KEY; declare export type Info = {| @@ -438,6 +451,7 @@ declare module '@solana/web3.js' { recentBlockhash: ?Blockhash; constructor(opts?: TransactionCtorFields): Transaction; + static from(buffer: Buffer): Transaction; add( ...items: Array< Transaction | TransactionInstruction | TransactionInstructionCtorFields,