@@ -284,25 +284,21 @@ export class Message {
284284 const accountCount = shortvec . decodeLength ( byteArray ) ;
285285 let accountKeys = [ ] ;
286286 for ( let i = 0 ; i < accountCount ; i ++ ) {
287- const account = byteArray . slice ( 0 , PUBLIC_KEY_LENGTH ) ;
288- byteArray = byteArray . slice ( PUBLIC_KEY_LENGTH ) ;
287+ const account = byteArray . splice ( 0 , PUBLIC_KEY_LENGTH ) ;
289288 accountKeys . push ( new PublicKey ( Buffer . from ( account ) ) ) ;
290289 }
291290
292- const recentBlockhash = byteArray . slice ( 0 , PUBLIC_KEY_LENGTH ) ;
293- byteArray = byteArray . slice ( PUBLIC_KEY_LENGTH ) ;
291+ const recentBlockhash = byteArray . splice ( 0 , PUBLIC_KEY_LENGTH ) ;
294292
295293 const instructionCount = shortvec . decodeLength ( byteArray ) ;
296294 let instructions : CompiledInstruction [ ] = [ ] ;
297295 for ( let i = 0 ; i < instructionCount ; i ++ ) {
298296 const programIdIndex = byteArray . shift ( ) ! ;
299297 const accountCount = shortvec . decodeLength ( byteArray ) ;
300- const accounts = byteArray . slice ( 0 , accountCount ) ;
301- byteArray = byteArray . slice ( accountCount ) ;
298+ const accounts = byteArray . splice ( 0 , accountCount ) ;
302299 const dataLength = shortvec . decodeLength ( byteArray ) ;
303- const dataSlice = byteArray . slice ( 0 , dataLength ) ;
300+ const dataSlice = byteArray . splice ( 0 , dataLength ) ;
304301 const data = bs58 . encode ( Buffer . from ( dataSlice ) ) ;
305- byteArray = byteArray . slice ( dataLength ) ;
306302 instructions . push ( {
307303 programIdIndex,
308304 accounts,
0 commit comments