INNER CODE UNIT · TypeScript

requestedComputeUnits

blueshift-gg/doppler · packages/core/index.ts:140

  const requestedComputeUnits = computeUnits + 3 * BUILTIN_IX_CU;
  const priority = (BigInt(unitPrice) * BigInt(requestedComputeUnits) + 999_999n) / 1_000_000n;
  return {
    computeUnits,
    loadedBytes,
    requestedComputeUnits,
    requestedLoadedBytes: loadedBytes + 2 * ACCOUNT_OVERHEAD + COMPUTE_BUDGET_PROGRAM_LEN,
    lamports: BigInt(signatures) * LAMPORTS_PER_SIGNATURE + priority,
  };
}

function layout(fields: unknown): { slots: Slot[]; size: number } {
  if (!Array.isArray(fields) || fields.length === 0) throw new TypeError('a payload needs at least one field');
  const slots: Slot[] = [];
  let size = 0;
  for (const field of fields as FieldLike[]) {
    const { name, type, len = 1 } = field;
    if (typeof name !== 'string' || !/^[A-Za-z_][A-Za-z0-9_]*$/.test(name)) throw new TypeError('a field name must be an identifier');

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…