INNER CODE UNIT · TypeScript

out

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

    out = ALPHABET[Number(n % 58n)] + out;
    n /= 58n;
  }
  return '1'.repeat(zeros) + out;
}

type Slot = { name: string; type: Ty; len: number; offset: number };

/** `unitPrice` is micro-lamports per compute unit; the fee is `5000` per signature plus `ceil(unitPrice * units / 1e6)`. */
function budget(computeUnits: number, loadedBytes: number, signatures: number, unitPrice: number | bigint): Budget {
  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,

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…