fix: add TypeScript buffer type to ed25519-program.ts
This commit is contained in:
parent
3333f37e88
commit
96361295aa
|
@ -30,7 +30,19 @@ export type CreateEd25519InstructionWithPrivateKeyParams = {
|
|||
instructionIndex?: number;
|
||||
};
|
||||
|
||||
const ED25519_INSTRUCTION_LAYOUT = BufferLayout.struct([
|
||||
const ED25519_INSTRUCTION_LAYOUT = BufferLayout.struct<
|
||||
Readonly<{
|
||||
messageDataOffset: number;
|
||||
messageDataSize: number;
|
||||
messageInstructionIndex: number;
|
||||
numSignatures: number;
|
||||
padding: number;
|
||||
publicKeyInstructionIndex: number;
|
||||
publicKeyOffset: number;
|
||||
signatureInstructionIndex: number;
|
||||
signatureOffset: number;
|
||||
}>
|
||||
>([
|
||||
BufferLayout.u8('numSignatures'),
|
||||
BufferLayout.u8('padding'),
|
||||
BufferLayout.u16('signatureOffset'),
|
||||
|
@ -82,17 +94,18 @@ export class Ed25519Program {
|
|||
|
||||
const instructionData = Buffer.alloc(messageDataOffset + message.length);
|
||||
|
||||
const index = instructionIndex != null ? instructionIndex : 0;
|
||||
ED25519_INSTRUCTION_LAYOUT.encode(
|
||||
{
|
||||
numSignatures,
|
||||
padding: 0,
|
||||
signatureOffset,
|
||||
signatureInstructionIndex: instructionIndex,
|
||||
signatureInstructionIndex: index,
|
||||
publicKeyOffset,
|
||||
publicKeyInstructionIndex: instructionIndex,
|
||||
publicKeyInstructionIndex: index,
|
||||
messageDataOffset,
|
||||
messageDataSize: message.length,
|
||||
messageInstructionIndex: instructionIndex,
|
||||
messageInstructionIndex: index,
|
||||
},
|
||||
instructionData,
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue