node_modules/@velas/solana-web3/lib/index.browser.esm.js
/**
   * Derive a program address from seeds and a program ID.
   */
Derive a program address from seeds and a program ID.
Derive a program address from seeds and a program ID .
static async createProgramAddress(seeds, programId) {
    let buffer$1 = buffer.Buffer.alloc(0);
    seeds.forEach(function (seed) {
      if (seed.length > MAX_SEED_LENGTH) {
        throw new Error("Max seed length exceeded");
      }
      buffer$1 = buffer.Buffer.concat([buffer$1, buffer.Buffer.from(seed)]);
    });
    buffer$1 = buffer.Buffer.concat([buffer$1, programId.toBuffer(), buffer.Buffer.from('ProgramDerivedAddress')]);
    let hash = await sha256(new Uint8Array(buffer$1));
    let publicKeyBytes = new BN(hash, 16).toArray(undefined, 32);
    if (is_on_curve(publicKeyBytes)) {
      throw new Error("Invalid seeds, address must fall off the curve");
    }
    return new PublicKey(publicKeyBytes);
  }
static async createProgramAddress ( seeds , programId ) { let buffer$1 = buffer . Buffer . alloc ( 0 ) ; seeds . forEach ( function ( seed ) { if ( seed . length > MAX_SEED_LENGTH ) { throw new Error ( "Max seed length exceeded" ) ; } buffer$1 = buffer . Buffer . concat ( [ buffer$1 , buffer . Buffer . from ( seed ) ] ) ; } ) ; buffer$1 = buffer . Buffer . concat ( [ buffer$1 , programId . toBuffer ( ) , buffer . Buffer . from ( 'ProgramDerivedAddress' ) ] ) ; let hash = await sha256 ( new Uint8Array ( buffer$1 ) ) ; let publicKeyBytes = new BN ( hash , 16 ) . toArray ( undefined , 32 ) ; if ( is_on_curve ( publicKeyBytes ) ) { throw new Error ( "Invalid seeds, address must fall off the curve" ) ; } return new PublicKey ( publicKeyBytes ) ; }
Derive a program address from seeds and a program ID.
Derive a program address from seeds and a program ID .