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.
| Method | Returns | Behavior |
|---|---|---|
| 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
| Export | Returns |
|---|---|
| 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
| Export | Purpose |
|---|---|
| parseMintReceipt(logs) | Read a Launched event from the configured factory. |
| decodeFloor1Revert(data) | Decode a known market or factory error; unknown data returns null. |
| Floor1Error | Typed SDK/API error with code, status, and retryAfterSeconds. |
| giwaSepolia | Chain ID, market, factory, WETH, and explorer URL. |
| tradingAbi / mintingAbi / approvalAbi | Minimal ABIs for the supported calls and events. |
Exported types
TypeScript
TradeSide, QuoteParams, TradeParams, Quote, PreparedTransaction,
MintParams, Floor1ClientOptions, RequestOptions, SendOptions, TradeResultCancellation
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.