Skip to content
Termbook
Borrower SDK

Completion & retries

Keep operation identifiers and resume the same operation after interruption.

On this page

Completion boundaries

OperationCompleted when
intent.acceptReservation, verified collateral and Credit Account readiness are bound.
credit.app.executeConfirmed action outcomes are known; pending, partial, cancelled and failed remain distinct.
credit.repayActual House accounting allocation or partial/refund outcome is confirmed.
credit.closeUnwind or retention, repayment, release and source return are reconciled.
house.depositA share mint or refund is confirmed; inbox funds alone mint no shares.

Resume execution

Continue a submitted action
import { ExecutionPendingError } from "@termbook/sdk";

try {
  await credit.app.execute(action, undefined, undefined, {
    timeoutMs: 60_000,
    onProgress: async (checkpoint, outcomes) => {
      await save_progress(checkpoint, outcomes);
    },
  });
} catch (error) {
  if (!(error instanceof ExecutionPendingError)) throw error;
  await save_progress(error.checkpoint, error.outcomes);
}

const result = await credit.app.resumeExecution();

save_progress is your application persistence callback. The SDK also preserves local checkpoints where available. Pending actions keep their transaction and operation identity. A new trade requires a fresh authorization and nonce.

Resume closure

Continue an interrupted close
import { ClosurePendingError } from "@termbook/sdk";

try {
  await credit.close({
    onProgress: async (checkpoint) => save_closure(checkpoint),
  });
} catch (error) {
  if (!(error instanceof ClosurePendingError)) throw error;
  await save_closure(error.checkpoint);
}

await credit.close({ checkpoint: saved_checkpoint });

A funding-required closure carries its shortfall. A blocked venue exit stays blocked or pending until the actual obligation clears. Do not create a replacement operation to hide an earlier submitted transaction.

Documentation
8 results

Let’s talk

Tell us what you have in mind.

Supply liquidity