node_modules/@velas/solana-web3/lib/index.browser.esm.js
/**
   * Decode a compiled message into a Message object.
   */
Decode a compiled message into a Message object.
Decode a compiled message into a Message object .
static from(buffer$1) {
    let byteArray = [...buffer$1];
    const numRequiredSignatures = byteArray.shift();
    const numReadonlySignedAccounts = byteArray.shift();
    const numReadonlyUnsignedAccounts = byteArray.shift();
    const accountCount = decodeLength(byteArray);
    let accountKeys = [];
    for (let i = 0; i < accountCount; i++) {
      const account = byteArray.slice(0, PUBKEY_LENGTH);
      byteArray = byteArray.slice(PUBKEY_LENGTH);
      accountKeys.push(bs58.encode(buffer.Buffer.from(account)));
    }
    const recentBlockhash = byteArray.slice(0, PUBKEY_LENGTH);
    byteArray = byteArray.slice(PUBKEY_LENGTH);
    const instructionCount = decodeLength(byteArray);
    let instructions = [];
    for (let i = 0; i < instructionCount; i++) {
      const programIdIndex = byteArray.shift();
      const accountCount = decodeLength(byteArray);
      const accounts = byteArray.slice(0, accountCount);
      byteArray = byteArray.slice(accountCount);
      const dataLength = decodeLength(byteArray);
      const dataSlice = byteArray.slice(0, dataLength);
      const data = bs58.encode(buffer.Buffer.from(dataSlice));
      byteArray = byteArray.slice(dataLength);
      instructions.push({
        programIdIndex,
        accounts,
        data
      });
    }
    const messageArgs = {
      header: {
        numRequiredSignatures,
        numReadonlySignedAccounts,
        numReadonlyUnsignedAccounts
      },
      recentBlockhash: bs58.encode(buffer.Buffer.from(recentBlockhash)),
      accountKeys,
      instructions
    };
    return new Message(messageArgs);
  }
static from ( buffer$1 ) { let byteArray = [ ... buffer$1 ] ; const numRequiredSignatures = byteArray . shift ( ) ; const numReadonlySignedAccounts = byteArray . shift ( ) ; const numReadonlyUnsignedAccounts = byteArray . shift ( ) ; const accountCount = decodeLength ( byteArray ) ; let accountKeys = [ ] ; for ( let i = 0 ; i < accountCount ; i ++ ) { const account = byteArray . slice ( 0 , PUBKEY_LENGTH ) ; byteArray = byteArray . slice ( PUBKEY_LENGTH ) ; accountKeys . push ( bs58 . encode ( buffer . Buffer . from ( account ) ) ) ; } const recentBlockhash = byteArray . slice ( 0 , PUBKEY_LENGTH ) ; byteArray = byteArray . slice ( PUBKEY_LENGTH ) ; const instructionCount = decodeLength ( byteArray ) ; let instructions = [ ] ; for ( let i = 0 ; i < instructionCount ; i ++ ) { const programIdIndex = byteArray . shift ( ) ; const accountCount = decodeLength ( byteArray ) ; const accounts = byteArray . slice ( 0 , accountCount ) ; byteArray = byteArray . slice ( accountCount ) ; const dataLength = decodeLength ( byteArray ) ; const dataSlice = byteArray . slice ( 0 , dataLength ) ; const data = bs58 . encode ( buffer . Buffer . from ( dataSlice ) ) ; byteArray = byteArray . slice ( dataLength ) ; instructions . push ( { programIdIndex , accounts , data } ) ; } const messageArgs = { header : { numRequiredSignatures , numReadonlySignedAccounts , numReadonlyUnsignedAccounts } , recentBlockhash : bs58 . encode ( buffer . Buffer . from ( recentBlockhash ) ) , accountKeys , instructions } ; return new Message ( messageArgs ) ; }
Decode a compiled message into a Message object.
Decode a compiled message into a Message object .
// Slice up wire data