SDK

The SDK ships in TypeScript and JavaScript. It is client-side only: it contains no signing key handling and no server component.

What it exports

ExportPurpose
DashIntentsClientContract reads and intent queries
NostrTransportRelay connection, publish and subscribe
PlatformTransportDAPI connection and document reads
buildOfferTagsNIP-33 tags for an offer event
encodeOfferContentDeterministic offer payload serialisation
decodeOfferEventStrict decode; throws rather than half-filling
calculateProtocolFeeTiered basis-point fee
selectBestOfferDeterministic offer selection
verifyMasternodeProTxHash check against protx list valid

Creating an intent

import { DashIntentsClient, calculateProtocolFee } from '@dash-intents/sdk';

const client = new DashIntentsClient({ network: 'testnet' });

const intent = await client.createIntent({
  fromAsset: 'DASH',
  toAsset: 'USDT',
  inputAmount: 100_000_000,   // 1 DASH in duffs
  minOutputAmount: 9_900_000, // the floor the user will accept
  expiresAt: Date.now() + 60_000,
});

const fee = calculateProtocolFee(100_000_000 / 1e8);

Submitting an offer

The SDK builds the unsigned event; it does not sign. Signing is the caller's responsibility, which keeps every secret key outside the SDK's own code paths. The daemon signs with Schnorr and the Signature is BIP-340 verified.

import { buildUnsignedOfferEvent, decodeOfferEvent } from '@dash-intents/sdk';

// Build the event, hand it to your own signer, publish the signed result.
const unsigned = buildUnsignedOfferEvent({
  intentId: intent.intentId,
  solverId: 'your-identity-id',
  proTxHash: 'your-64-hex-protxxhash',
  outputAmount: 9_950_000,
  route: 'DASH-USDT-direct',
  status: 'pending',
  createdAt: Date.now(),
  expiresAt: intent.expiresAt,
});

Reading offers back

decodeOfferEvent validates every field and throws OfferDecodeError rather than returning a partially-populated object, so a malformed offer can never be mistaken for a valid one.decodeOfferEvents decodes a batch and skips events that are not Dash Intents offers, because a relay may hold events from other applications.

Write operations fail loudly

The SDK contains no signing. Write endpoints that require a signature return 501 rather than silently succeeding. This is deliberate: a stub that pretends to write is worse than one that refuses.