TypeScript SDK installation

The package name is @cleared/sdk. It is distributed through the private Cleared repository, not currently through the public npm registry. Repository access is required; contact the team for access. Do not assume npm install @cleared/sdk or @cleared/sdk-ts is a supported public installation path.

For backend invoicing without repository access, use the REST API. The SDK is not a REST/HMAC client and does not provide the dashboard's complete Safe/session workflow.

Repository workspace setup#

From an authorized checkout, install dependencies with Bun:

bash
bun install

Use the workspace dependency in a package within that checkout:

json
{
  "dependencies": {
    "@cleared/sdk": "workspace:*"
  }
}

The SDK's package exports point to compiled dist output. Build its workspace dependencies and the SDK using the repository's supported build workflow before importing the package from Node.js. An authorized source checkout alone does not make an unbuilt package entry point runnable. Distribution outside the workspace must include the internal address package and respect the supplied license/access terms.

Safe offline smoke test#

Once package output is available, save this as sdk-smoke.mjs in a package that depends on @cleared/sdk, then run node sdk-smoke.mjs or bun sdk-smoke.mjs. It does not access RPC, create invoices, or move funds.

javascript
import { calcFee, computeMetaHash, verifyMetaHash } from '@cleared/sdk';

const amount = 500_000_000n; // 500 USDC, exactly six decimal places
const retailFee = calcFee(amount);
if (retailFee !== 2_500_000n) throw new Error('Unexpected retail fee'); // 0.5% of 500 USDC
const metadata = { description: 'Offline example', amountRaw: amount.toString() };
const hash = computeMetaHash(metadata);
if (!verifyMetaHash(metadata, hash)) throw new Error('Hash verification failed');
console.log({ amount: amount.toString(), fee: retailFee.toString(), hash });

This small object demonstrates hashing, not a complete invoice metadata payload. Production issuance has additional billing metadata requirements.

Compatibility before contract calls#

The repository SDK exports legacy transaction/read methods alongside current utilities. getInvoice, settleWithAuth, buildSettleTypedData, settleFromVault, and allowance methods are not a verified current-contract integration surface. Some embedded ABIs do not match current contracts. There is no SDK cancellation, session-management, customer REST, or webhook-verification API.

Read the SDK reference and compatibility table before choosing an integration path. Use contract addresses and the address package for network configuration rather than copying addresses between environments.