feat: add Secp256k1 support to solana-web3.js (#12958)

* feat: add secp256k1 instruction

* feat: use buffer-layout for encoding as well

* style: use consistent naming for types

* style: update typings and make program functions static

* fix: attempt to resolve rollup issue

* fix: expose sysvar in typings

* fix: remove decode instruction functionality (for now)
This commit is contained in:
Josh
2020-10-22 13:15:24 -07:00
committed by GitHub
parent 84d56c62ce
commit 368aeb2cee
11 changed files with 380 additions and 8 deletions

View File

@ -536,6 +536,7 @@ declare module '@solana/web3.js' {
declare export var SYSVAR_RENT_PUBKEY;
declare export var SYSVAR_REWARDS_PUBKEY;
declare export var SYSVAR_STAKE_HISTORY_PUBKEY;
declare export var SYSVAR_INSTRUCTIONS_PUBKEY;
// === src/vote-account.js ===
declare export var VOTE_PROGRAM_ID;
@ -973,6 +974,31 @@ declare module '@solana/web3.js' {
): AuthorizeNonceParams;
}
// === src/secp256k1-program.js ===
declare export type CreateSecp256k1InstructionWithPublicKeyParams = {|
publicKey: Buffer | Uint8Array | Array<number>,
message: Buffer | Uint8Array | Array<number>,
signature: Buffer | Uint8Array | Array<number>,
recoveryId: number,
|};
declare export type CreateSecp256k1InstructionWithPrivateKeyParams = {|
privateKey: Buffer | Uint8Array | Array<number>,
message: Buffer | Uint8Array | Array<number>,
|};
declare export class Secp256k1Program {
static get programId(): PublicKey;
static createInstructionWithPublicKey(
params: CreateSecp256k1InstructionWithPublicKeyParams,
): TransactionInstruction;
static createInstructionWithPrivateKey(
params: CreateSecp256k1InstructionWithPrivateKeyParams,
): TransactionInstruction;
}
// === src/loader.js ===
declare export class Loader {
static getMinNumSignatures(dataLength: number): number;