TYPESCRIPT REFERENCE
↓

Small API. Complete control.

The complete public surface of @floor1/sdk.

createFloor1Client

TypeScript
const floor1 = createFloor1Client({
  baseUrl: 'https://www.floor1.fun',
  wallet,
  fetch: globalThis.fetch,
});

All options are optional. baseUrl must be an HTTPS origin; loopback HTTP origins are accepted for local development. The SDK sends no cookies. Supply fetch when your runtime needs a custom HTTP implementation.

MethodReturnsBehavior
quote(params, { signal }?)Promise<Quote>Request and validate an exact-input quote.
buy(params, { wallet, account, signal }?)Promise<TradeResult>Fresh quote, local buy calldata, wallet submission.
sell(params, { wallet, account, signal }?)Promise<TradeResult>Fresh quote, local sell calldata, wallet submission.
mint(params, { wallet, account, signal }?)Promise<Hex>Local mint calldata and wallet submission.

Transaction builders

ExportReturns
prepareBuy(quote)PreparedTransaction for buyWithEth.
prepareSell(quote)PreparedTransaction for sellToEth.
prepareSellApproval(token, amount)Exact-amount approve transaction for the market.
prepareMint(params)Factory launch transaction.
TypeScript
type PreparedTransaction = {
  chainId: number;
  to: Address;
  data: Hex;
  value: bigint;
};

type TradeResult = { hash: Hex; quote: Quote };

Utilities and constants

ExportPurpose
parseMintReceipt(logs)Read a Launched event from the configured factory.
decodeFloor1Revert(data)Decode a known market or factory error; unknown data returns null.
Floor1ErrorTyped SDK/API error with code, status, and retryAfterSeconds.
giwaSepoliaChain ID, market, factory, WETH, and explorer URL.
tradingAbi / mintingAbi / approvalAbiMinimal ABIs for the supported calls and events.

Exported types

TypeScript
TradeSide, QuoteParams, TradeParams, Quote, PreparedTransaction,
MintParams, Floor1ClientOptions, RequestOptions, SendOptions, TradeResult

Cancellation

Pass an AbortSignal to cancel an in-flight quote request. The signal is checked before wallet submission. It cannot cancel a wallet confirmation already opened or a transaction already broadcast. Wallet errors retain their original type.