API reference
The full TypeScript API reference is generated from the source with TypeDoc. Generate it locally:
cd docs
npm run docs:api
This reads docs/typedoc.json (which points at
../packages/ts/src/index.ts) and writes the HTML reference into
docs/docs/api. The generated output is not committed; run the command to
produce it.
Main exports
@qorechain/rdk exposes a deliberate, supported surface. The highlights:
Client
createRdkClient(options?)— build anRdkClientfor a network with optional endpoint overrides. Defaults to testnet.RdkClient— the facade. Key members:rest— REST read client (getRollup,getBlob, batches, …).listBatches(id, { startIndex })follows every page of the chain's pagedBatchesquery;listBatchesPagereads one page;getLatestBatchuses the chain'sLatestBatchroute.RollupViewcarriesescrowBalanceand, from chain v3.2.4, the rollup's ownchallengeWindowSec,challengeBondandproofSystem;BatchViewcarriessubmittedTimefrom v3.2.4.params()— read the liverdkmodule parameters.getChainTip()— latest height and block time, from the RPC/status.suggestProfile(useCase, opts?)— QCAI-assisted profile suggestion.connectTx(signer, opts?)— connect a signingRdkTxClient.opts.restdefaults to the network preset's REST endpoint (used by hybridsignBytesVersion: "auto").
Configuration
presets/PRESET_DEFAULTS— the five preset profiles (defi,gaming,nft,enterprise,custom).RollupConfigBuilder— fluent builder (set,validate,validationResult,build,toCreateMsg).- Enums and types —
SettlementParadigm,SequencerMode,ProofSystem,DABackend,GasModel,VmType,RollupStatus,BatchStatus,ProfileName, plus the runtime value arrays. - Compatibility matrix and validation helpers.
RollupConfigError— thrown on invalid configurations.
Transactions
RdkTxClient— signing client:createRollup,submitBatch,challengeBatch,resolveChallenge,pauseRollup,resumeRollup,stopRollup,executeWithdrawal. Connect options:gasPrice, plus the hybrid (post-quantum) set —pqcKeypair(present ⇒ sign hybrid),rest,signBytesVersion("auto" | "v1" | "v2"),includePqcPublicKey.isHybridreports which path is in use.submitBatch(input, { anchor })— signs the batch's v2 anchor when this client is the rollup's creator and signs hybrid, so the batch is anchored and a receipt can exist for it.anchor: "require"refuses instead of submitting unanchored;"off"never signs.anchorSignBytesForBatchbuilds the bytes for a creator signing out of band.resolveSignBytesVersion/isHybridSignBytesRejection— re-exported from@qorechain/sdkfor inspecting or handling the hybrid sign-bytes form.resolvePqcKeypair(client, address, mnemonic)/pqcKeypairFromEnv— the operator's ML-DSA-87 key, checked against the chain: derives both the canonical and the legacy key and returns the one the account has registered.- Message builders —
createRollupMsg,submitBatchMsg, and the rest of therdkmessage set. RDK_TYPES/createRdkRegistry— the rdk type registry.
Data availability
buildDaBlob(opts)— assemble a blob and compute the chain's SHAKE-256 commitment to it, enforcing the maximum blob size. No transaction posts a blob to the chain today, so do not put this hash in a batch on anativeorbothrollup (see Data availability).assertDaBackendAvailable(backend)— guard against not-yet-active backends (Celestia / both).
Withdrawals
withdrawalsTree(withdrawals, { rollupId, version, chainId })— a batch's withdrawals root and every proof, built exactly as the chain does (tested against the chain's own verifier).versionis the batch's binding (transitionRootVersionForBatch).withdrawalLeafV1/withdrawalLeafV2— the chain's leaves (v2, from chain v3.2.5, names the chain id).assembleWithdrawalProof(leaves, index)— a proof from leaves you hold; the chain's tree by default (before 0.7.0 it re-hashed with SHA-256).buildExecuteWithdrawalInput— theexecuteWithdrawalinput.binaryMerkleRoot/binaryMerkleProof/verifyBinaryMerkleProof— generic helpers, SHAKE-256 by default.qorehash(...parts)— SHAKE-256, 32 bytes: the chain's default hash.
Lifecycle
canPerformRollupAction,assertRollupAction— rollup transitions.batchChallengeWindow(batch, windowSecs, tip)— a batch's challenge window computed with the chain's own rules: seconds of block time for a batch with a recorded submission time (v3.2.4+),windowSecs / 6blocks from the submission height otherwise. Returns{ mode, open, finalizable, … }.isBatchFinal,challengeWindowDeadline,isChallengeWindowClosed— generic helpers. NotechallengeWindowDeadlineadds seconds to whatever you pass; a batch'ssubmittedAtis a height, so usebatchChallengeWindow.
Settlement receipts
buildSettlementReceipt/verifySettlementReceipt— portable receipts, verified against live chain state. Schema version 2 recordschainId; the result reportssignBytesVersionand achainBindingcheck. Every receipt field is compared with the chain; the result carries the chain'sanchorand, when valid, theverifiedReceiptrebuilt from chain state.receiptSchemaError/SUPPORTED_RECEIPT_VERSIONS— the version, algorithm and required-field check run before any chain read.anchorSignBytesV1/anchorSignBytesV2/anchorSignBytesVersionFor— the two canonical anchor messages and the height-based choice between them.
Errors
decodeRdkTxError(result)/RDK_ERRORS—@qorechain/sdk'sdecodeTxErrorplus therdkmodule's own codes (2 to 36), with what to do about the ones an operator meets.
Watchtower helpers
transitionRootValidator(client, rollupId)— avalidatepredicate forwatchBatchesthat applies the chain's fraud rule.fraudProofForBatch(client, rollupId, batch)— the proof that wins a challenge against a batch, orundefinedfor an honest one.
Transition roots
batchTransitionRoot(input, version)/batchTransitionRootV1/batchTransitionRootV2— the canonical state root the chain judges an optimistic batch by. Tested against vectors from the chain's own implementation.transitionRootVersionFor(rest)— the binding a batch submitted now is judged by (v2once the chain reportsrdk-withdrawals-binding).transitionRootVersionForBatch(rest, batch)— the binding an existing batch is judged by, from its own flag or the height v3.2.5 was applied at.fraudProof(prevStateRoot, correctRoot)— the 64-byte proof the chain's optimistic verifier reads.RestClient.getProtocolFeatures/isProtocolFeatureEnabled/getAppliedPlanHeight— the chain reads these rest on.
Chain rules (checked before a fee is paid)
rollupIdError/isValidRollupId— the v3.2.2 id grammar.withdrawalErrors— the v3.2.3 withdrawal checks (denom, amount, proof depth and sibling length, addresses).withdrawalsRootError— from chain v3.2.5 a batch's withdrawals root is empty or 32 bytes;submitBatchchecks it.stopRollupError/MAX_PENDING_OPTIMISTIC_BATCHES— v3.2.5's stop guard (stopRollupchecks it when it can read the chain) and the 4,096 pending-batch limit.dataHashError— a batch on anativeorbothDA rollup must leavedataHashempty.RdkTxClient.submitBatchapplies it when it can read the rollup.
Multi-VM
encodeCrossVmCalldata,CROSS_VM_PRECOMPILE,CROSS_VM_TARGET,CROSS_VM_DEFAULT_SIGNATURE—executeCrossVMCall(uint8,string,bytes).isCrossVmPrecompileActive(rest)— whether the precompile is live on a network (it is not yet active on mainnet or testnet).getCrossVmParams(rest)/crossVmTargetReady(rest, contract)— the allowlist (/qorechain/crossvm/v1/params, chain v3.2.5) and whether a call tocontractwould reach it, with the blocking reason.decodeCrossVmResult(ret)/decodeRevertReason(data)— the precompile'sabi.encode(bytes)result and itsError(string)refusals.
Utilities
- Denom —
qorToUqor,uqorToQor(QOR ↔ baseuqor, 10^6). - Economics —
estimateCreationCostand theCreationCostshape. - Encoding — bech32 and byte helpers.
Profile suggestion
suggestProfile(useCase, qor, opts?)/ProfileSuggestion— the standalone QCAI-assisted advisory used byRdkClient.suggestProfile.
For exact signatures, parameters, and return types, generate and browse the TypeDoc output.