fix: revert usage of toBytes to fix compatibility (#16253)
This commit is contained in:
@ -506,13 +506,13 @@ export class StakeProgram {
|
|||||||
const type = STAKE_INSTRUCTION_LAYOUTS.Initialize;
|
const type = STAKE_INSTRUCTION_LAYOUTS.Initialize;
|
||||||
const data = encodeData(type, {
|
const data = encodeData(type, {
|
||||||
authorized: {
|
authorized: {
|
||||||
staker: toBuffer(authorized.staker.toBytes()),
|
staker: toBuffer(authorized.staker.toBuffer()),
|
||||||
withdrawer: toBuffer(authorized.withdrawer.toBytes()),
|
withdrawer: toBuffer(authorized.withdrawer.toBuffer()),
|
||||||
},
|
},
|
||||||
lockup: {
|
lockup: {
|
||||||
unixTimestamp: lockup.unixTimestamp,
|
unixTimestamp: lockup.unixTimestamp,
|
||||||
epoch: lockup.epoch,
|
epoch: lockup.epoch,
|
||||||
custodian: toBuffer(lockup.custodian.toBytes()),
|
custodian: toBuffer(lockup.custodian.toBuffer()),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
const instructionData = {
|
const instructionData = {
|
||||||
@ -613,7 +613,7 @@ export class StakeProgram {
|
|||||||
|
|
||||||
const type = STAKE_INSTRUCTION_LAYOUTS.Authorize;
|
const type = STAKE_INSTRUCTION_LAYOUTS.Authorize;
|
||||||
const data = encodeData(type, {
|
const data = encodeData(type, {
|
||||||
newAuthorized: toBuffer(newAuthorizedPubkey.toBytes()),
|
newAuthorized: toBuffer(newAuthorizedPubkey.toBuffer()),
|
||||||
stakeAuthorizationType: stakeAuthorizationType.index,
|
stakeAuthorizationType: stakeAuthorizationType.index,
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -649,10 +649,10 @@ export class StakeProgram {
|
|||||||
|
|
||||||
const type = STAKE_INSTRUCTION_LAYOUTS.AuthorizeWithSeed;
|
const type = STAKE_INSTRUCTION_LAYOUTS.AuthorizeWithSeed;
|
||||||
const data = encodeData(type, {
|
const data = encodeData(type, {
|
||||||
newAuthorized: toBuffer(newAuthorizedPubkey.toBytes()),
|
newAuthorized: toBuffer(newAuthorizedPubkey.toBuffer()),
|
||||||
stakeAuthorizationType: stakeAuthorizationType.index,
|
stakeAuthorizationType: stakeAuthorizationType.index,
|
||||||
authoritySeed: authoritySeed,
|
authoritySeed: authoritySeed,
|
||||||
authorityOwner: toBuffer(authorityOwner.toBytes()),
|
authorityOwner: toBuffer(authorityOwner.toBuffer()),
|
||||||
});
|
});
|
||||||
|
|
||||||
const keys = [
|
const keys = [
|
||||||
|
@ -671,7 +671,7 @@ export class SystemProgram {
|
|||||||
const data = encodeData(type, {
|
const data = encodeData(type, {
|
||||||
lamports: params.lamports,
|
lamports: params.lamports,
|
||||||
space: params.space,
|
space: params.space,
|
||||||
programId: toBuffer(params.programId.toBytes()),
|
programId: toBuffer(params.programId.toBuffer()),
|
||||||
});
|
});
|
||||||
|
|
||||||
return new TransactionInstruction({
|
return new TransactionInstruction({
|
||||||
@ -697,7 +697,7 @@ export class SystemProgram {
|
|||||||
data = encodeData(type, {
|
data = encodeData(type, {
|
||||||
lamports: params.lamports,
|
lamports: params.lamports,
|
||||||
seed: params.seed,
|
seed: params.seed,
|
||||||
programId: toBuffer(params.programId.toBytes()),
|
programId: toBuffer(params.programId.toBuffer()),
|
||||||
});
|
});
|
||||||
keys = [
|
keys = [
|
||||||
{pubkey: params.fromPubkey, isSigner: false, isWritable: true},
|
{pubkey: params.fromPubkey, isSigner: false, isWritable: true},
|
||||||
@ -731,9 +731,9 @@ export class SystemProgram {
|
|||||||
if ('basePubkey' in params) {
|
if ('basePubkey' in params) {
|
||||||
const type = SYSTEM_INSTRUCTION_LAYOUTS.AssignWithSeed;
|
const type = SYSTEM_INSTRUCTION_LAYOUTS.AssignWithSeed;
|
||||||
data = encodeData(type, {
|
data = encodeData(type, {
|
||||||
base: toBuffer(params.basePubkey.toBytes()),
|
base: toBuffer(params.basePubkey.toBuffer()),
|
||||||
seed: params.seed,
|
seed: params.seed,
|
||||||
programId: toBuffer(params.programId.toBytes()),
|
programId: toBuffer(params.programId.toBuffer()),
|
||||||
});
|
});
|
||||||
keys = [
|
keys = [
|
||||||
{pubkey: params.accountPubkey, isSigner: false, isWritable: true},
|
{pubkey: params.accountPubkey, isSigner: false, isWritable: true},
|
||||||
@ -742,7 +742,7 @@ export class SystemProgram {
|
|||||||
} else {
|
} else {
|
||||||
const type = SYSTEM_INSTRUCTION_LAYOUTS.Assign;
|
const type = SYSTEM_INSTRUCTION_LAYOUTS.Assign;
|
||||||
data = encodeData(type, {
|
data = encodeData(type, {
|
||||||
programId: toBuffer(params.programId.toBytes()),
|
programId: toBuffer(params.programId.toBuffer()),
|
||||||
});
|
});
|
||||||
keys = [{pubkey: params.accountPubkey, isSigner: true, isWritable: true}];
|
keys = [{pubkey: params.accountPubkey, isSigner: true, isWritable: true}];
|
||||||
}
|
}
|
||||||
@ -763,11 +763,11 @@ export class SystemProgram {
|
|||||||
): TransactionInstruction {
|
): TransactionInstruction {
|
||||||
const type = SYSTEM_INSTRUCTION_LAYOUTS.CreateWithSeed;
|
const type = SYSTEM_INSTRUCTION_LAYOUTS.CreateWithSeed;
|
||||||
const data = encodeData(type, {
|
const data = encodeData(type, {
|
||||||
base: toBuffer(params.basePubkey.toBytes()),
|
base: toBuffer(params.basePubkey.toBuffer()),
|
||||||
seed: params.seed,
|
seed: params.seed,
|
||||||
lamports: params.lamports,
|
lamports: params.lamports,
|
||||||
space: params.space,
|
space: params.space,
|
||||||
programId: toBuffer(params.programId.toBytes()),
|
programId: toBuffer(params.programId.toBuffer()),
|
||||||
});
|
});
|
||||||
let keys = [
|
let keys = [
|
||||||
{pubkey: params.fromPubkey, isSigner: true, isWritable: true},
|
{pubkey: params.fromPubkey, isSigner: true, isWritable: true},
|
||||||
@ -832,7 +832,7 @@ export class SystemProgram {
|
|||||||
): TransactionInstruction {
|
): TransactionInstruction {
|
||||||
const type = SYSTEM_INSTRUCTION_LAYOUTS.InitializeNonceAccount;
|
const type = SYSTEM_INSTRUCTION_LAYOUTS.InitializeNonceAccount;
|
||||||
const data = encodeData(type, {
|
const data = encodeData(type, {
|
||||||
authorized: toBuffer(params.authorizedPubkey.toBytes()),
|
authorized: toBuffer(params.authorizedPubkey.toBuffer()),
|
||||||
});
|
});
|
||||||
const instructionData = {
|
const instructionData = {
|
||||||
keys: [
|
keys: [
|
||||||
@ -907,7 +907,7 @@ export class SystemProgram {
|
|||||||
static nonceAuthorize(params: AuthorizeNonceParams): TransactionInstruction {
|
static nonceAuthorize(params: AuthorizeNonceParams): TransactionInstruction {
|
||||||
const type = SYSTEM_INSTRUCTION_LAYOUTS.AuthorizeNonceAccount;
|
const type = SYSTEM_INSTRUCTION_LAYOUTS.AuthorizeNonceAccount;
|
||||||
const data = encodeData(type, {
|
const data = encodeData(type, {
|
||||||
authorized: toBuffer(params.newAuthorizedPubkey.toBytes()),
|
authorized: toBuffer(params.newAuthorizedPubkey.toBuffer()),
|
||||||
});
|
});
|
||||||
|
|
||||||
return new TransactionInstruction({
|
return new TransactionInstruction({
|
||||||
@ -931,10 +931,10 @@ export class SystemProgram {
|
|||||||
if ('basePubkey' in params) {
|
if ('basePubkey' in params) {
|
||||||
const type = SYSTEM_INSTRUCTION_LAYOUTS.AllocateWithSeed;
|
const type = SYSTEM_INSTRUCTION_LAYOUTS.AllocateWithSeed;
|
||||||
data = encodeData(type, {
|
data = encodeData(type, {
|
||||||
base: toBuffer(params.basePubkey.toBytes()),
|
base: toBuffer(params.basePubkey.toBuffer()),
|
||||||
seed: params.seed,
|
seed: params.seed,
|
||||||
space: params.space,
|
space: params.space,
|
||||||
programId: toBuffer(params.programId.toBytes()),
|
programId: toBuffer(params.programId.toBuffer()),
|
||||||
});
|
});
|
||||||
keys = [
|
keys = [
|
||||||
{pubkey: params.accountPubkey, isSigner: false, isWritable: true},
|
{pubkey: params.accountPubkey, isSigner: false, isWritable: true},
|
||||||
|
@ -569,7 +569,7 @@ export class Transaction {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (
|
if (
|
||||||
!nacl.sign.detached.verify(signData, signature, publicKey.toBytes())
|
!nacl.sign.detached.verify(signData, signature, publicKey.toBuffer())
|
||||||
) {
|
) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user