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

15
web3.js/module.d.ts vendored
View File

@@ -1039,6 +1039,13 @@ declare module '@solana/web3.js' {
}
// === src/secp256k1-program.js ===
export type CreateSecp256k1InstructionWithEthAddressParams = {
ethAddress: Buffer | Uint8Array | Array<number> | string;
message: Buffer | Uint8Array | Array<number>;
signature: Buffer | Uint8Array | Array<number>;
recoveryId: number;
};
export type CreateSecp256k1InstructionWithPublicKeyParams = {
publicKey: Buffer | Uint8Array | Array<number>;
message: Buffer | Uint8Array | Array<number>;
@@ -1054,6 +1061,14 @@ declare module '@solana/web3.js' {
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;