feat: add stake program methods; refactor instruction type handling
This commit is contained in:
committed by
Michael Vines
parent
fc77e55920
commit
532b28e96e
@@ -80,8 +80,16 @@ export class PublicKey {
|
||||
/**
|
||||
* Derive a public key from another key, a seed, and a programId.
|
||||
*/
|
||||
static createWithSeed(fromPublicKey: PublicKey, seed: string, programId: PublicKey): PublicKey {
|
||||
const buffer = Buffer.concat([fromPublicKey.toBuffer(), Buffer.from(seed), programId.toBuffer()])
|
||||
static createWithSeed(
|
||||
fromPublicKey: PublicKey,
|
||||
seed: string,
|
||||
programId: PublicKey,
|
||||
): PublicKey {
|
||||
const buffer = Buffer.concat([
|
||||
fromPublicKey.toBuffer(),
|
||||
Buffer.from(seed),
|
||||
programId.toBuffer(),
|
||||
]);
|
||||
const hash = hasha(buffer, {algorithm: 'sha256'});
|
||||
return new PublicKey('0x' + hash);
|
||||
}
|
||||
|
Reference in New Issue
Block a user