@@ -27,7 +27,7 @@ import {
2727import assert from 'assert' ;
2828import BigNumber from 'bignumber.js' ;
2929import { struct , u8 , blob } from '@solana/buffer-layout' ;
30- import { InstructionBuilderTypes , MEMO_PROGRAM_PK } from './constants' ;
30+ import { INSTRUCTIONS_SYSVAR_ADDRESS , InstructionBuilderTypes , MEMO_PROGRAM_PK } from './constants' ;
3131import {
3232 AtaClose ,
3333 AtaInit ,
@@ -850,7 +850,7 @@ function configureConfidentialTransferAccountInstruction(
850850 { pubkey : new PublicKey ( tokenAddress ) , isSigner : false , isWritable : true } ,
851851 { pubkey : new PublicKey ( mintAddress ) , isSigner : false , isWritable : false } ,
852852 {
853- pubkey : new PublicKey ( instructionsSysvarOrContextStateAddress || 'Sysvar1nstructions1111111111111111111111111' ) ,
853+ pubkey : new PublicKey ( instructionsSysvarOrContextStateAddress || INSTRUCTIONS_SYSVAR_ADDRESS ) ,
854854 isSigner : false ,
855855 isWritable : false ,
856856 } ,
@@ -1004,6 +1004,8 @@ function writeRecordDataInstruction(data: WriteRecordData): TransactionInstructi
10041004 assert ( recordData , 'Missing data param' ) ;
10051005
10061006 const dataBuffer = Buffer . from ( recordData , 'hex' ) ;
1007+ const offsetBuffer = Buffer . alloc ( 4 ) ;
1008+ offsetBuffer . writeUInt32LE ( offset , 0 ) ;
10071009 return [
10081010 new TransactionInstruction ( {
10091011 keys : [
@@ -1013,7 +1015,7 @@ function writeRecordDataInstruction(data: WriteRecordData): TransactionInstructi
10131015 : [ ] ) ,
10141016 ] ,
10151017 programId : new PublicKey ( recordAccountOwnerAddress || ZK_ELGAMAL_PROOF_PROGRAM_ID ) ,
1016- data : Buffer . concat ( [ Buffer . from ( [ 1 ] ) , Buffer . from ( new Uint32Array ( [ offset ] ) . buffer ) , dataBuffer ] ) ,
1018+ data : Buffer . concat ( [ Buffer . from ( [ 1 ] ) , offsetBuffer , dataBuffer ] ) ,
10171019 } ) ,
10181020 ] ;
10191021}
0 commit comments