Publish quotes
Commit collateral and compete to fill encrypted orders.
On this page
Connect a maker
npm install @depthhq/maker-sdkimport { create_depth_maker } from "@depthhq/maker-sdk";
const maker = await create_depth_maker({
environment: "devnet",
wallet: makerWallet,
});Fund and allocate USDC with maker.account.deposit() and maker.account.allocate(). Confirm both receipts before quoting. The owner funds collateral; delegated quote operators cannot move it.
Publish a quote
bidE8 and askE8 are prices with eight decimals. Derive both from a fresh market reference and keep them inside the verified deviation limits. maxCapacity is micro-USDC.
const publication = await maker.quote.publish({
marketId: "SOL-USD",
bidE8: bidPriceE8,
askE8: askPriceE8,
maxCapacity: 100_000_000n,
validForSeconds: 60,
});
const { quoteId } = await publication.confirm();Publishing encrypts the quote curve. Confirmation prepares and activates the quote after its margin reservation passes. Tiered quotes can supply up to four size/price tiers within market policy.
Renew, replace, or cancel
const quote = maker.quote.get(quoteId);
await quote.renew({ validForSeconds: 60 });Renewal extends unchanged terms without another pricing computation. To change prices, use maker.quote.replace(quoteId, newTerms). The successor validates before the existing reservation and book entry rotate.
await quote.cancel();Cancellation does not close existing inventory. Reclaim terminal quote rent with quote.close() after attached orders finish settling.
Read fills
const stop = await maker.fills.subscribe({
marketId: "SOL-USD",
onFill: async (fill) => handleFill(fill),
onError: (error) => showFillError(error),
});Call stop() when the subscription ends. The SDK checkpoints receipt cursors in IndexedDB in browsers and private files in Node; it does not persist decrypted fills in those checkpoints.