Skip to content

SDK API Reference

InterestSwapClient

ts
new InterestSwapClient(config?: Partial<ClientConfig>)

ClientConfig

FieldTypeDefault
orderbookUrlstringhttp://localhost:3005
chainIdnumber8453
factoryAddressAddressInterestRatePool (compatibility alias)
quoteMarketAddressAddressgenerated Base QuoteMarket
interestRatePoolAddressAddressgenerated Base InterestRatePool

Signing and WebSocket

MethodResult
setPrivateKey(key)Configure the internal server-side signer
getAddress()Configured maker address or null
getSigner()BackerSigner instance
signQuoteMarketQuote(quote)Serialized quote plus EIP-712 signature
connectWebSocket(events)Connect and authenticate RFQWebSocketClient
getWebSocketClient()Current client or null
disconnectWebSocket()Close and disable reconnect

HTTP

MethodEndpoint
submitQuoteMarketQuote(signed)POST /api/v1/quotes
requestQuotes(request)POST /api/v1/rfq/quote
getQuoteMarketQuotes(filters)GET /api/v1/quotes
getPoolRates()GET /api/v1/pools/rates
getMarkets()GET /api/v1/rates/current
getHealth()GET /api/v1/health
getConfig()Copy of the resolved local client configuration

Quote Models

ts
interface QuoteMarketQuote {
  maker: Address
  taker: Address
  poolId: Hex
  seriesKey: Hex
  notional: bigint
  vrtAmount: bigint
  nonce: bigint
  deadline: bigint
  salt: Hex
}

serializeQuoteMarketQuote converts integer fields to JSON strings; deserializeQuoteMarketQuote restores bigint values. RFQRequest accepts a seriesKey or expiry, exact raw-unit notional, and optional maxVrtAmount.

BackerSigner

ts
new BackerSigner({
  chainId,
  factoryAddress,
  quoteMarketAddress,
  interestRatePoolAddress,
})
  • setPrivateKey(key) creates an internal viem wallet client.
  • setAccount(account, walletClient) uses an existing wallet client.
  • signQuoteMarketQuote(quote) signs the QuoteMarket EIP-712 domain and checks that quote.maker equals the signer.
  • signAuthChallenge(challenge, timestamp) signs WebSocket authentication.

RFQWebSocketClient

Important methods are connect, disconnect, isConnected, isAuth, submitQuote, submitSerializedQuote, and ping. Event callbacks include onOpen, onClose, onError, onAuthenticated, onAuthFailed, onRFQ, onQuoteAck, and onAuctionResult.

Address Constants

The root package exports generated production constants including:

ts
INTEREST_RATE_POOL_ADDRESS
BUNDLER3_ADDRESS
QUOTE_MARKET_ADDRESS
KEEPER_BUNDLER_ADDRESS
INTEREST_RATE_POOL_DEPLOY_BLOCK
PRODUCTION_DEPLOYMENT

Adapter address constants remain available from @interestswap/sdk/addresses. The generated module is sourced from deployments/8453-interest-swap.json and must not be edited manually.

Utilities

Rate helpers convert APY/APR percentages to WAD-scaled per-second rates and back: apyToRatePerSec, ratePerSecToApy, aprToRatePerSec, ratePerSecToApr, apyToApr, and aprToApy.

Formatting helpers include formatPrincipal, parsePrincipal, formatTvl, formatRate, formatAddress, formatPoolId, formatDuration, formatTimestamp, and getChainName.

RfqDaemonClient is a Node-only JSON-RPC client for the local Unix socket (/tmp/interestswap.sock by default). It is intended for daemon integration, not browser use.

Interest Exchange Protocol