1. Docs
  2. Developers
  3. TypeScript SDK

Developers

TypeScript SDK

Build validated intents, transactions, state reads, and receipt reconciliation.

Revision 62 min read
On this page
  1. Integration pattern
  2. Package exports
  3. Numeric safety
  4. Address safety
  5. Compatibility

@workspace/trust-stack is the domain client for the Move packages. It sits above @workspace/supra-client, which owns canonical addresses, BCS encoding, transaction preparation, RPC reads, and receipt types.

Integration pattern#

TypeScript
const intent = parseTokenCreationIntent(formValues);
const feeConfig = await readFeeConfigProof(client);
const maximumFeeQuants = feeConfig.schedule.tokenCreationFeeQuants;
const request = buildTokenCreationTransaction(intent, creator, maximumFeeQuants);
const prepared = await client.prepareTransactionRequest(request);
const hash = await walletClient.signAndSubmit(prepared);
const receipt = await client.waitForTransactionReceipt({ hash });
const token = parseTokenCreatedEvent(receipt, {
  ...intent,
  creator,
  feeCollector: feeConfig.collector,
  maximumFeeQuants,
});

Keep these phases separate. Do not build BCS directly in page components, treat raw form strings as validated values, or assume a successful submission hash contains the expected event.

Package exports#

Each domain follows the same shape where applicable:

  • a Zod schema and intent parser;
  • transaction builders with typed addresses and integers;
  • state readers and response schemas;
  • entry-function and event constants;
  • exact receipt/event parsers;
  • Merkle or manifest utilities for airdrops.

Numeric safety#

Token amounts are decimal strings at the UI boundary and bigint in exact arithmetic. Conversion must use authoritative metadata decimals and reject extra fractional places or u64 overflow. Never use JavaScript number for base-unit balances or timestamps returned as large integers.

createSupraClient also applies a fail-closed gas-unit-price ceiling. The default is 1_000_000; set maxGasUnitPrice to a separately reviewed positive bigint only when network policy requires a different limit. Both RPC estimates and explicit request prices above the ceiling are rejected before the prepared transaction reaches the wallet.

Address safety#

Use parseSupraAddress to canonicalize and validate an address. Reject the zero address whenever a creator-selected owner, beneficiary, or recipient must be a real account. Do not compare shortened display strings.

Compatibility#

Revision 6 helpers are additive. PROPOSAL_ACCEPTANCE_WINDOW_SECONDS with isProposalExpired, and MINIMUM_PRODUCTION_GOVERNANCE_DELAY_SECONDS with meetsGovernanceDelayFloor, mirror the on-chain rules. readTokenTotalMinted and readAssetPolicyCouncilEpoch read views that exist only in revision 6 and later packages; calling them against an earlier package fails at the RPC.

Package function/event addresses are checked-in release constants. Updating one is a release change: record the finalized transaction, exact bytecode hash, ABI, source commit, and chain ID, then update tests and acceptance evidence in the same review.