feat: support creating secp256k1 instructions with eth address (#15626)

This commit is contained in:
Justin Starry
2021-03-03 02:16:36 +08:00
committed by GitHub
parent 43663b1750
commit 7435a7b0ed
4 changed files with 167 additions and 56 deletions

View File

@@ -1045,6 +1045,13 @@ declare module '@solana/web3.js' {
}
// === src/secp256k1-program.js ===
declare export type CreateSecp256k1InstructionWithEthAddressParams = {|
ethAddress: Buffer | Uint8Array | Array<number> | string,
message: Buffer | Uint8Array | Array<number>,
signature: Buffer | Uint8Array | Array<number>,
recoveryId: number,
|};
declare export type CreateSecp256k1InstructionWithPublicKeyParams = {|
publicKey: Buffer | Uint8Array | Array<number>,
message: Buffer | Uint8Array | Array<number>,
@@ -1060,6 +1067,14 @@ declare module '@solana/web3.js' {
declare export class Secp256k1Program {
static get programId(): PublicKey;
static publicKeyToEthAddress(
publicKey: Buffer | Uint8Array | Array<number>,
): Buffer;
static createInstructionWithEthAddress(
params: CreateSecp256k1InstructionWithEthAddressParams,
): TransactionInstruction;
static createInstructionWithPublicKey(
params: CreateSecp256k1InstructionWithPublicKeyParams,
): TransactionInstruction;