# Types

Every type the SDK exports, with each field's meaning and unit. Declarations are copied from the shipped `.d.ts` files. Types re-exported from `ethers` (`TypedDataDomain`, `TypedDataField`) and `@solana/kit` (`Address`, `Instruction`, `AccountMeta`) are those libraries' own.


Units used below:

| Unit | Meaning |
| --- | --- |
| atoms | Collateral base units. JitoSOL has 9 decimals: 1 JitoSOL = `1_000_000_000` atoms. |
| USDC atoms | 10^-6 USDC. 1 USDC = `1_000_000`. |
| `priceE18` | USDC × 10^18 per one whole collateral token. |
| `strikeE8` | USD × 10^8 per whole collateral token. |
| `quantityE18` | Collateral atoms scaled to 18 decimals (the wire quantity). |
| unix s | Seconds since 1970-01-01 UTC. |
| epoch ms | Milliseconds since 1970-01-01 UTC. |

## Deployment

Which program and deployment an operation targets. Every function that derives or decodes program accounts takes one as an optional last argument, default [`MAINNET`](https://docs.covr.markets/reference/sdk/constants.md#mainnet). See [the convention](https://docs.covr.markets/reference/sdk/overview.md#the-deployment-argument).

```ts
export interface Deployment {
    readonly programAddress: string;
    readonly deploymentId: string;
    readonly genesisHash: string;
}
```

| Field | Type | Meaning |
| --- | --- | --- |
| `programAddress` | `string` | Program id, base58. |
| `deploymentId` | `string` | 32-byte deployment identity, `0x` + 64 hex. Bound into every signing domain. |
| `genesisHash` | `string` | Chain genesis hash, base58. Market decoding still requires mainnet's value. |


## TypedDataSigner

The signer every signing function takes. Full details: [Signing](https://docs.covr.markets/reference/sdk/signing.md#typeddatasigner).

```ts
export interface TypedDataSigner {
    signTypedData(domain: TypedDataDomain, types: Record<string, TypedDataField[]>, value: Record<string, unknown>): Promise<string>;
}
```

| Member | Meaning |
| --- | --- |
| `signTypedData` | Signs EIP-712 typed data. Returns `0x` + 130 hex: `r`, `s`, `v`, with `v` in {27, 28} and low `s`. |


## RegisterMakerV3Input

Input of [`registerMakerV3`](https://docs.covr.markets/reference/sdk/setup.md#registermakerv3).

```ts
export interface RegisterMakerV3Input {
    authority: string;
    makerEthAddress: string;
    signature: string | Uint8Array;
}
```

| Field | Type | Meaning |
| --- | --- | --- |
| `authority` | `string` | Your Solana authority, base58. Signs the transaction, pays rent, owns the Maker forever. |
| `makerEthAddress` | `string` | Your quote key address, `0x` + 40 hex. |
| `signature` | `string \| Uint8Array` | The registration grant signature: `0x` + 130 hex, or 65 bytes. |


## CollateralIdentity

A collateral mint and how to read it.

```ts
export interface CollateralIdentity {
    mint: string;
    program: string;
    decimals: number;
}
```

| Field | Type | Meaning |
| --- | --- | --- |
| `mint` | `string` | Collateral mint, base58. |
| `program` | `string` | Its token program: [`TOKEN_PROGRAM`](https://docs.covr.markets/reference/sdk/constants.md#token_program) or [`TOKEN_2022_PROGRAM`](https://docs.covr.markets/reference/sdk/constants.md#token_2022_program). |
| `decimals` | `number` | Mint decimals, 0 to 255. JitoSOL: 9. |


## MintPolicySettingsV1

The caps and bindings of one mint policy. Build it with [`mintPolicySettingsFor`](https://docs.covr.markets/reference/sdk/setup.md#mintpolicysettingsfor).

```ts
export interface MintPolicySettingsV1 {
    watcher: string;
    enabled: boolean;
    termsId: Uint8Array;
    profileHash: Uint8Array;
    maxOrderAtoms: bigint;
    maxReservedAtoms: bigint;
    maxReservedStrikeUsdc: bigint;
    lifetimePremiumLimitEnabled: boolean;
    lifetimePremiumLimitUsdc: bigint;
}
```

| Field | Type | Meaning |
| --- | --- | --- |
| `watcher` | `string` | A key that may pause the policy and do nothing else. The zero key (`11111111111111111111111111111111`) means none. |
| `enabled` | `boolean` | `false` refuses every fill on this mint. |
| `termsId` | `Uint8Array` | 32 bytes. Only markets with this terms id fill against the policy. |
| `profileHash` | `Uint8Array` | 32 bytes. Only markets with this mint profile fill against the policy. |
| `maxOrderAtoms` | `bigint` | Largest single fill, atoms. |
| `maxReservedAtoms` | `bigint` | Most atoms open at once on this mint, atoms. |
| `maxReservedStrikeUsdc` | `bigint` | Most strike obligation open at once on this mint, USDC atoms. |
| `lifetimePremiumLimitEnabled` | `boolean` | Whether the lifetime premium cap applies. |
| `lifetimePremiumLimitUsdc` | `bigint` | Lifetime gross premium cap on this mint, USDC atoms. Must be `0n` when the cap is disabled. |


## MintPolicyV1

Your decoded mint policy, from [`decodeMintPolicy`](https://docs.covr.markets/reference/sdk/setup.md#decodemintpolicy).

```ts
export interface MintPolicyV1 {
    address: Address;
    version: 1;
    bump: number;
    maker: Address;
    authority: Address;
    collateral: Address;
    collateralProgram: Address;
    collateralDecimals: number;
    payment: Address;
    paymentProgram: Address;
    paymentDecimals: 6;
    generation: bigint;
    settings: MintPolicySettingsV1;
    admission: 'not-evaluated';
}
```

| Field | Type | Meaning |
| --- | --- | --- |
| `address` | `Address` | The policy account. |
| `version` | `1` | Account version. |
| `bump` | `number` | PDA bump. |
| `maker` | `Address` | Your Maker account. |
| `authority` | `Address` | Your Solana authority. |
| `collateral`, `collateralProgram`, `collateralDecimals` | | The collateral mint, its token program and decimals. |
| `payment`, `paymentProgram`, `paymentDecimals` | | USDC mint, SPL Token program, `6`. |
| `generation` | `bigint` | Starts at 1 and goes up by one on every update or pause. Pass it as `expectedGeneration`. |
| `settings` | [`MintPolicySettingsV1`](#mintpolicysettingsv1) | Watcher, enabled flag, terms id, profile hash and caps. |
| `admission` | `'not-evaluated'` | The decoder proves the record's consistency, not that fills are admitted. |


## MintUsageV1

Your decoded mint usage counters, from [`decodeMintUsage`](https://docs.covr.markets/reference/sdk/setup.md#decodemintusage). All amounts cover this one collateral mint.

```ts
export interface MintUsageV1 {
    address: Address;
    version: 1;
    bump: number;
    maker: Address;
    collateral: Address;
    collateralProgram: Address;
    collateralDecimals: number;
    payment: Address;
    paymentProgram: Address;
    paymentDecimals: 6;
    policy: Address;
    bootstrapped: boolean;
    reservedAtoms: bigint;
    reservedStrikeUsdc: bigint;
    cumulativePremiumUsdc: bigint;
    openClaims: bigint;
    pendingClaims: bigint;
    totalFills: bigint;
    totalSettled: bigint;
    admission: 'not-evaluated';
}
```

| Field | Type | Meaning |
| --- | --- | --- |
| `address`, `version`, `bump` | | The usage account, `1`, its PDA bump. |
| `maker`, `collateral`, `collateralProgram`, `collateralDecimals`, `payment`, `paymentProgram`, `paymentDecimals` | | As in [`MintPolicyV1`](#mintpolicyv1). |
| `policy` | `Address` | Your MintPolicyV1 for this mint. |
| `bootstrapped` | `boolean` | `false` until [`bootstrapMintUsageV1`](https://docs.covr.markets/reference/sdk/setup.md#bootstrapmintusagev1) runs. Fills fail while it is `false`. |
| `reservedAtoms` | `bigint` | Collateral atoms in open positions. Compare with `maxReservedAtoms`. |
| `reservedStrikeUsdc` | `bigint` | Strike obligations of open positions, USDC atoms. Compare with `maxReservedStrikeUsdc`. |
| `cumulativePremiumUsdc` | `bigint` | Gross premium paid on this mint since creation, USDC atoms. Never decreases. Compare with `lifetimePremiumLimitUsdc`. |
| `openClaims` | `bigint` | Positions not yet settled. |
| `pendingClaims` | `bigint` | Restricted positions with the strike funded, awaiting delivery. |
| `totalFills` | `bigint` | Fills since creation. |
| `totalSettled` | `bigint` | Positions settled since creation. |
| `admission` | `'not-evaluated'` | As in [`MintPolicyV1`](#mintpolicyv1). |


## SdkInstruction

The instruction type the vault, budget, deposit, withdraw and exposure-limit builders return: a `@solana/kit` instruction whose `accounts` and `data` are always present. Other builders return the same shape under their own names.

```ts
export type SdkInstruction = Instruction & {
    accounts: AccountMeta[];
    data: Uint8Array;
};
```

| Field | Type | Meaning |
| --- | --- | --- |
| `programAddress` | `Address` | The program id. |
| `accounts` | `AccountMeta[]` | `{ address, role }`. Roles: 0 read-only, 1 writable, 2 read-only signer, 3 writable signer. No signer objects are attached. |
| `data` | `Uint8Array` | 8-byte Anchor discriminator (`sha256("global:<name>")[0..8]`) followed by the arguments, little-endian. |


## DecodedMakerAccount

Your Maker account, decoded by [`decodeMaker`](https://docs.covr.markets/reference/sdk/setup.md#decodemaker).

```ts
export type DecodedMakerAccount = {
    authority: Address;
    ethAddress: `0x${string}`;
    bump: number;
    operator: Address;
    minNonce: bigint;
} & ({
    migrationFenced: false;
    startSlot: null;
} | {
    migrationFenced: true;
    startSlot: bigint;
});
```

| Field | Type | Meaning |
| --- | --- | --- |
| `authority` | `Address` | The Solana authority that owns the Maker. |
| `ethAddress` | `` `0x${string}` `` | Your quote key address, lowercase. |
| `bump` | `number` | PDA bump of the Maker account. |
| `operator` | `Address` | Key that may sign exercises for you. The zero key means none. |
| `minNonce` | `bigint` | Nonce floor: a fill of a quote whose nonce is below it fails. Raise it with [`configureMaker`](https://docs.covr.markets/reference/sdk/setup.md#configuremaker). |
| `migrationFenced` | `boolean` | Reserved account-format flag. Always `true` for a Maker created by [`registerMakerV3`](https://docs.covr.markets/reference/sdk/setup.md#registermakerv3). You do not need it. |
| `startSlot` | `bigint \| null` | For a Maker created by [`registerMakerV3`](https://docs.covr.markets/reference/sdk/setup.md#registermakerv3): the slot it was registered at. |


## DecodedMarketV3

A decoded market of either mode. Narrow it on `settlementMode`.

```ts
export type DecodedMarketV3 = MarketV3 | RestrictedMarketV3;
```


## MarketV3

An ordinary market (settlement mode 0), as [`decodeMarketV3`](https://docs.covr.markets/reference/sdk/markets.md#decodemarketv3) returns it.

```ts
export interface MarketV3 {
    address: string;
    programAddress: string;
    version: 3;
    bump: number;
    settlementMode: 0;
    collateralDecimals: number;
    paymentDecimals: 6;
    creator: string;
    collateral: string;
    collateralProgram: string;
    payment: string;
    paymentProgram: string;
    feeOwner: string;
    genesisHash: string;
    deploymentId: Uint8Array;
    termsId: Uint8Array;
    profileHash: Uint8Array;
    salt: bigint;
    expiry: bigint;
    window: bigint;
    strikeE8: bigint;
    maxQuantityAtoms: bigint;
    feeBps: number;
    paused: boolean;
}
```

| Field | Type | Meaning |
| --- | --- | --- |
| `address` | `string` | The market account. |
| `programAddress` | `string` | Program that owns it. |
| `version` | `3` | Account version. |
| `bump` | `number` | PDA bump. |
| `settlementMode` | `0` | Ordinary: atomic exercise. |
| `collateralDecimals` | `number` | Collateral mint decimals. |
| `paymentDecimals` | `6` | USDC decimals. |
| `creator` | `string` | Wallet that created the market (PDA seed). |
| `collateral` | `string` | Collateral mint. |
| `collateralProgram` | `string` | Collateral token program. |
| `payment` | `string` | USDC mint. |
| `paymentProgram` | `string` | SPL Token program. |
| `feeOwner` | `string` | Owner of the USDC account that receives the protocol fee. |
| `genesisHash` | `string` | Mainnet genesis hash. |
| `deploymentId` | `Uint8Array` | 32 bytes, equal to [`DEPLOYMENT_ID`](https://docs.covr.markets/reference/sdk/constants.md#deployment_id). |
| `termsId` | `Uint8Array` | 32 bytes, equal to [`ORDINARY_TERMS_ID`](https://docs.covr.markets/reference/sdk/constants.md#ordinary_terms_id). |
| `profileHash` | `Uint8Array` | 32 bytes: fingerprint of the collateral mint's token profile, taken at creation. |
| `salt` | `bigint` | Creator's salt (PDA seed), u64. |
| `expiry` | `bigint` | Option expiry, unix s. |
| `window` | `bigint` | Exercise window after expiry, seconds, 60 to 3,600. |
| `strikeE8` | `bigint` | Strike, USD × 10^8. |
| `maxQuantityAtoms` | `bigint` | Largest single fill, atoms. |
| `feeBps` | `number` | Protocol fee on the gross premium, basis points, 0 to 1,000. |
| `paused` | `boolean` | A paused market refuses new fills. |


## RestrictedMarketV3

A restricted market (settlement mode 1): every [`MarketV3`](#marketv3) field, with `settlementMode: 1` and a cancellation timeout. Restricted markets are covr-only today.

```ts
export interface RestrictedMarketV3 extends Omit<MarketV3, 'settlementMode'> {
    settlementMode: 1;
    cancellationTimeoutSeconds: bigint;
}
```

| Field | Type | Meaning |
| --- | --- | --- |
| `settlementMode` | `1` | Restricted: fund the strike, then deliver. |
| `cancellationTimeoutSeconds` | `bigint` | Always `604800n` (7 days). `termsId` equals [`RESTRICTED_TERMS_ID`](https://docs.covr.markets/reference/sdk/constants.md#restricted_terms_id). |


## CreateMarketInput

Input of [`createMarketV3`](https://docs.covr.markets/reference/sdk/markets.md#createmarketv3) and [`createRestrictedMarketV3`](https://docs.covr.markets/reference/sdk/markets.md#createrestrictedmarketv3).

```ts
export interface CreateMarketInput {
    creator: string;
    salt: bigint;
    collateral: string;
    feeOwner: string;
    /** Unix seconds. The program requires 60 s <= expiry - now <= 90 days at creation. */
    expiry: bigint;
    window: bigint;
    strikeE8: bigint;
    maxQuantityAtoms: bigint;
    feeBps: number;
    /** Your clock in unix seconds, used to apply the program's expiry bounds. The chain
     * clock decides; leave margin for submission delay. */
    nowUnix: bigint;
}
```

| Field | Type | Meaning |
| --- | --- | --- |
| `creator` | `string` | Wallet that signs and pays rent. PDA seed. |
| `salt` | `bigint` | Any u64. One market per (creator, salt). |
| `collateral` | `string` | Collateral mint. Not native SOL. |
| `feeOwner` | `string` | Owner of the USDC account that receives fees. Not the zero key. |
| `expiry` | `bigint` | Option expiry, unix s. 60 s to 90 days after the chain clock. |
| `window` | `bigint` | Exercise window, seconds, 60 to 3,600. |
| `strikeE8` | `bigint` | Strike, USD × 10^8. Positive. |
| `maxQuantityAtoms` | `bigint` | Largest single fill, atoms. Positive. |
| `feeBps` | `number` | Fee, basis points, integer 0 to 1,000. |
| `nowUnix` | `bigint` | Your clock, unix s. Used only for the local expiry check; it is not sent. |


## BidIntent

A signed sealed bid intent: the exact `bid_intent` params. [`signIntent`](https://docs.covr.markets/reference/sdk/quoting.md#signintent) returns it.

```ts
export interface BidIntentTerms {
    assetAddress: string;
    chainId: number;
    expiry: number;
    isPut: boolean;
    isTakerBuy: boolean;
    quantity: string;
    strike: string;
    usd: string;
    collateralAsset: string;
}
export interface BidIntent extends BidIntentTerms {
    auctionId: string;
    kind: AuctionKind;
    market: string;
    position: string | null;
    wallet: string;
    maker: string;
    price: string;
    validUntil: number;
    signature: string;
}
```

`AuctionKind` is `'open' | 'position_sale' | 'early_close'`. `BidIntentTerms` and `AuctionKind` are not exported by name.

| Field | Type | Meaning |
| --- | --- | --- |
| `auctionId` | `string` | RFQ id, a lowercase UUID v4. |
| `kind` | `'open'` | Opening auction. Desks bid only on these. |
| `market` | `string` | Market account, base58. |
| `position` | `null` | Always `null` for an opening auction. |
| `wallet` | `string` | The writer (customer) wallet, base58. |
| `assetAddress` | `string` | Collateral alias, copied from `request.asset`. |
| `chainId` | `number` | `2000000001`. |
| `expiry` | `number` | Option expiry, unix s. |
| `isPut` | `boolean` | `false`. |
| `isTakerBuy` | `boolean` | `false`. |
| `quantity` | `string` | `quantityE18`, decimal string. |
| `strike` | `string` | `strikeE8`, decimal string. |
| `usd` | `string` | USDC alias. |
| `collateralAsset` | `string` | Collateral alias. |
| `maker` | `string` | Your quote key address. |
| `price` | `string` | `priceE18`, decimal string. |
| `validUntil` | `number` | Intent expiry, unix s. |
| `signature` | `string` | 65-byte EIP-712 signature, lowercase `0x` hex. |


## UnsignedBidIntent

A [`BidIntent`](#bidintent) without `signature`: 17 fields. [`buildBidIntent`](https://docs.covr.markets/reference/sdk/quoting.md#buildbidintent) returns it.

```ts
export type UnsignedBidIntent = Omit<BidIntent, 'signature'>;
```


## QuoteV2

A signed executable quote: the `quote` param of [`sendQuote`](https://docs.covr.markets/reference/sdk/gateway-client.md#clientsendquote). The program verifies the same signature at fill. [`signQuote`](https://docs.covr.markets/reference/sdk/quoting.md#signquote) returns it.

```ts
export interface Quote {
    assetAddress: string;
    chainId: number;
    expiry: number;
    isPut: boolean;
    isTakerBuy: boolean;
    quantity: string;
    strike: string;
    maker: string;
    nonce: string;
    price: string;
    validUntil: number;
    usd: string;
    collateralAsset: string;
    signature: string;
}
export interface QuoteV2 extends Quote {
    auctionId: string;
    writer: string;
}
```

`Quote` is the base interface; it is not exported by name.

| Field | Type | Meaning |
| --- | --- | --- |
| `auctionId` | `string` | RFQ id. Signed as `keccak256(utf8(id))`. |
| `writer` | `string` | The writer wallet, base58. Only this wallet can fill the quote. |
| `assetAddress` | `string` | Collateral alias. |
| `chainId` | `number` | `2000000001`. |
| `isPut` | `boolean` | `false`. |
| `strike` | `string` | `strikeE8`, decimal string. Must equal the market's. |
| `expiry` | `number` | Option expiry, unix s. Must equal the market's. |
| `maker` | `string` | Your quote key address. |
| `nonce` | `string` | u64 decimal string. One fill per nonce; must be at least `min_nonce`. |
| `price` | `string` | `priceE18`, decimal string. Equals the awarded intent's price. |
| `quantity` | `string` | `quantityE18`, decimal string. |
| `isTakerBuy` | `boolean` | `false`. |
| `validUntil` | `number` | Quote expiry, unix s. At most 60 s after gateway admission, at most `expiry`. |
| `usd` | `string` | USDC alias. |
| `collateralAsset` | `string` | Collateral alias. |
| `signature` | `string` | 65-byte EIP-712 signature, lowercase `0x` hex. |


## UnsignedQuoteV2

A [`QuoteV2`](#quotev2) without `signature`: 15 fields. [`buildQuote`](https://docs.covr.markets/reference/sdk/quoting.md#buildquote) returns it.

```ts
export type UnsignedQuoteV2 = Omit<QuoteV2, 'signature'>;
```


## RfqRequest

The instrument of an RFQ, as broadcast on the feed and repeated in the snapshot.

```ts
export type RfqRequest = Request;
export interface Request {
    asset: string;
    assetName: string;
    chainId: number;
    expiry: number;
    isPut: boolean;
    isTakerBuy: boolean;
    quantity: string;
    strike: string;
    taker: string;
    usd: string;
    collateralAsset: string;
}
```

| Field | Type | Meaning |
| --- | --- | --- |
| `asset` | `string` | Collateral alias, lowercase. JitoSOL: [`JITOSOL_ALIAS`](https://docs.covr.markets/reference/sdk/constants.md#jitosol_alias). |
| `assetName` | `string` | Display label. |
| `chainId` | `number` | `2000000001`. |
| `expiry` | `number` | Option expiry, unix s. |
| `isPut` | `boolean` | `false`: covered calls only. |
| `isTakerBuy` | `boolean` | `false`. |
| `quantity` | `string` | `quantityE18`, decimal string. Convert with [`atomsFromWire`](https://docs.covr.markets/reference/sdk/settlement.md#atomsfromwire). |
| `strike` | `string` | `strikeE8`, decimal string. |
| `taker` | `string` | 20-byte zero address placeholder. |
| `usd` | `string` | USDC alias. |
| `collateralAsset` | `string` | Collateral alias. |


## RfqSnapshot

The body of `GET /api/rfqs/<id>` ([`getRfq`](https://docs.covr.markets/reference/sdk/gateway-client.md#clientgetrfq)).

```ts
export interface RfqSnapshot {
    id: string;
    kind: 'open' | 'position_sale' | 'early_close';
    position: string | null;
    status: 'collecting' | 'finalizing' | 'quoted' | 'no_quote' | 'expired' | string;
    market: string;
    preparationFamily?: 'ordinary-v3' | 'restricted-v3' | string;
    /** Epoch ms. */
    closesAt: number;
    /** Epoch ms. */
    hardDeadline: number;
    bidCount?: number;
    wallet: string;
    request: RfqRequest;
    /** Restricted (stock) RFQs only: sign while it is fresh, see the integration guide. */
    stockSelection?: unknown;
    quote?: QuoteV2;
    [extra: string]: unknown;
}
```

| Field | Type | Meaning |
| --- | --- | --- |
| `id` | `string` | RFQ id, lowercase UUID v4. |
| `kind` | `string` | `'open'` for an opening auction, the only kind desks bid on. |
| `position` | `string \| null` | `null` for an opening auction. |
| `status` | `string` | `collecting` until `closesAt`; `finalizing` while awards run; `quoted` once a quote is admitted; `no_quote` when the auction ends without one. |
| `market` | `string` | The market account. Read and decode it yourself. |
| `preparationFamily` | `string` | `'ordinary-v3'` or `'restricted-v3'`. |
| `closesAt` | `number` | End of bid collection, epoch ms: creation + 3,000. |
| `hardDeadline` | `number` | Last moment for an award or a quote, epoch ms: creation + 6,000. |
| `bidCount` | `number` | Intents entered so far. |
| `wallet` | `string` | The writer (customer) wallet. Becomes the quote's `writer`. |
| `request` | [`RfqRequest`](#rfqrequest) | The instrument. |
| `stockSelection` | `unknown` | Restricted RFQs only. Desks are not served those today. |
| `quote` | [`QuoteV2`](#quotev2) | The admitted quote, shown only to the maker that made it. |

The gateway may add other fields (for example `noQuoteReason` on a `no_quote` RFQ). They are untyped.


## Award

An award you hold: the gateway picked your intent. Arrives as an [`award` event](https://docs.covr.markets/reference/sdk/gateway-client.md#gatewayevent).

```ts
export interface Award {
    id: string;
    intent: BidIntent;
    awardUntil: number;
    hardDeadline: number;
}
```

| Field | Type | Meaning |
| --- | --- | --- |
| `id` | `string` | RFQ id. |
| `intent` | [`BidIntent`](#bidintent) | The awarded intent, as the gateway sent it. Compare it with your stored copy. |
| `awardUntil` | `number` | Your quote must be admitted before this, epoch ms. At most 3,000 ms after the award, never after `hardDeadline`. |
| `hardDeadline` | `number` | Auction hard deadline, epoch ms. |


## PositionV3

A decoded position, from [`decodePositionV3`](https://docs.covr.markets/reference/sdk/settlement.md#decodepositionv3). The object is frozen.

```ts
export interface PositionV3 {
    address: Address;
    version: 3;
    bump: number;
    collateralVaultBump: number;
    strikeEscrowBump: number;
    state: 0 | 1 | 2 | 3 | 4 | 5;
    status: 'open' | 'pending_delivery' | 'exercised' | 'released' | 'early_closed' | 'bilaterally_canceled';
    /** Mode 0 has no pending rights. Mode 1 is record evidence, not authorization
     * to open a restricted agreement or a default for its timeout terms. */
    timeoutAnchor: 0 | 1;
    settlementMode: 'ordinary-atomic' | 'restricted-pending';
    collateralDecimals: number;
    paymentDecimals: 6;
    maker: Address;
    makerAuthority: Address;
    makerEthAddress: string;
    writer: Address;
    termsAccount: Address;
    termsId: string;
    profileHash: string;
    genesisHash: Address;
    deploymentId: string;
    collateralMint: Address;
    collateralProgram: Address;
    paymentMint: Address;
    paymentProgram: Address;
    policy: Address;
    usage: Address;
    collateralVault: Address;
    strikeEscrow: Address;
    nonce: bigint;
    admissionGeneration: bigint;
    quantityAtoms: bigint;
    grossPremiumUsdc: bigint;
    strikeUsdc: bigint;
    openedAt: bigint;
    expiry: bigint;
    exerciseWindowSeconds: bigint;
    cancellationTimeoutSeconds: bigint;
    intentGeneration: bigint;
    fundedAt: bigint;
    cancelEligibleAt: bigint;
    fundedStrikeUsdc: bigint;
    exerciseDeadline: bigint;
    makerOperator: Address;
    makerMinNonce: bigint;
    makerFenced: boolean;
    makerFenceSlot: bigint | null;
    slot: bigint;
    commitment: 'finalized';
    admission: 'not-evaluated';
}
```

| Field | Type | Meaning |
| --- | --- | --- |
| `address` | `Address` | The position account. |
| `version` | `3` | Account version. |
| `bump`, `collateralVaultBump`, `strikeEscrowBump` | `number` | PDA bumps. |
| `state` / `status` | | `0 open` (filled, not settled); `1 pending_delivery` (restricted: strike funded, awaiting delivery); `2 exercised`; `3 released` (collateral returned after the window); `4 early_closed`; `5 bilaterally_canceled` (restricted cancellation). |
| `timeoutAnchor` | `0 \| 1` | `0` ordinary, `1` restricted. |
| `settlementMode` | `string` | `'ordinary-atomic'` or `'restricted-pending'`. |
| `collateralDecimals` | `number` | Collateral mint decimals. |
| `paymentDecimals` | `6` | USDC decimals. |
| `maker` | `Address` | Your Maker account. |
| `makerAuthority` | `Address` | Your Solana authority. |
| `makerEthAddress` | `string` | Your quote key, lowercase. |
| `writer` | `Address` | The customer who sold the call. |
| `termsAccount` | `Address` | The market account. |
| `termsId`, `profileHash`, `deploymentId` | `string` | 32-byte values as `0x` hex, copied from the market. |
| `genesisHash` | `Address` | Mainnet genesis hash. |
| `collateralMint`, `collateralProgram` | `Address` | Collateral mint and token program. |
| `paymentMint`, `paymentProgram` | `Address` | USDC mint and SPL Token program. |
| `policy`, `usage` | `Address` | Your mint policy and mint usage accounts. |
| `collateralVault` | `Address` | Holds the writer's collateral until settlement. |
| `strikeEscrow` | `Address` | Restricted only: holds the funded strike. |
| `nonce` | `bigint` | The quote nonce that opened it. |
| `admissionGeneration` | `bigint` | Your mint policy generation when it was filled. |
| `quantityAtoms` | `bigint` | Collateral locked, atoms. |
| `grossPremiumUsdc` | `bigint` | Premium your vault paid, USDC atoms. |
| `strikeUsdc` | `bigint` | Strike payment due on exercise, USDC atoms. |
| `openedAt` | `bigint` | Fill time, unix s. |
| `expiry` | `bigint` | Option expiry, unix s. |
| `exerciseWindowSeconds` | `bigint` | Window after expiry, seconds. |
| `exerciseDeadline` | `bigint` | `expiry + exerciseWindowSeconds`, unix s. Exercise before it; release from it. |
| `cancellationTimeoutSeconds` | `bigint` | `0n` ordinary; `604800n` restricted. |
| `intentGeneration`, `fundedAt`, `cancelEligibleAt`, `fundedStrikeUsdc` | `bigint` | Restricted funding state; all `0n` while unfunded. Times in unix s, amounts in USDC atoms. |
| `makerOperator` | `Address` | Your operator when read. The zero key means none. |
| `makerMinNonce` | `bigint` | Your `min_nonce` when read. |
| `makerFenced`, `makerFenceSlot` | | Reserved: copies of `migrationFenced` and `startSlot` from your Maker account ([`DecodedMakerAccount`](#decodedmakeraccount)). |
| `slot` | `bigint` | The slot you read at. |
| `commitment` | `'finalized'` | The commitment you asserted. |
| `admission` | `'not-evaluated'` | The decoder proves record consistency only, not live state. |


## PositionReadInput

Input of [`decodePositionV3`](https://docs.covr.markets/reference/sdk/settlement.md#decodepositionv3).

```ts
export interface PositionReadInput {
    /** PositionV3 and Maker account data from ONE finalized getMultipleAccounts read at `slot`. */
    position: {
        address: string;
        data: Uint8Array;
    };
    maker: {
        address: string;
        data: Uint8Array;
    };
    slot: bigint;
    makerEthAddress: string;
    /** Your own Solana authority, pinned independently of these bytes. */
    makerAuthority: string;
    nonce: bigint;
    /** The position's market (or its collateral identity). */
    collateral: Pick<DecodedMarketV3, 'collateral' | 'collateralProgram' | 'collateralDecimals'>;
    /** Refuse unless both reads are at or after this slot. Defaults to `slot`. */
    minContextSlot?: bigint;
    writer?: string;
}
```

| Field | Type | Meaning |
| --- | --- | --- |
| `position` | `{ address; data }` | The position account and its 652 bytes. |
| `maker` | `{ address; data }` | Your Maker account and its bytes, from the **same** read. |
| `slot` | `bigint` | The context slot of that read. |
| `makerEthAddress` | `string` | Your quote key address. |
| `makerAuthority` | `string` | Your Solana authority, from your own config, not from the bytes. |
| `nonce` | `bigint` | The position's nonce. |
| `collateral` | `{ collateral; collateralProgram; collateralDecimals }` | Usually the decoded market. |
| `minContextSlot` | `bigint` | Optional. Refuse a read older than this slot. Default: `slot`. |
| `writer` | `string` | Optional. Refuse unless the stored writer equals it. |


## FillInput

Input of [`fillV3`](https://docs.covr.markets/reference/sdk/settlement.md#fillv3).

```ts
export type FillInput = Omit<FillV3Input, 'market'> & {
    market: DecodedMarketV3;
};
export interface FillV3Input {
    market: MarketV3;
    writer: string;
    writerCollateral: string;
    writerPayment: string;
    feeTokens: string;
    quantityAtoms: bigint;
    quote: QuoteV2;
    makerProvenance?: MakerProvenance;
    useMigrationHolds?: boolean;
    jitoStakePool?: string;
}
```

| Field | Type | Meaning |
| --- | --- | --- |
| `market` | [`DecodedMarketV3`](#decodedmarketv3) | The quote's market. Restricted markets dispatch to `fill_restricted_v3`. |
| `writer` | `string` | The writer wallet. Signs the fill. Must equal `quote.writer`. |
| `writerCollateral` | `string` | Writer's collateral token account (source of the collateral). |
| `writerPayment` | `string` | Writer's USDC token account (receives the writer premium). |
| `feeTokens` | `string` | USDC token account owned by the market's `feeOwner` (receives the fee). |
| `quantityAtoms` | `bigint` | Fill size, atoms. `quote.quantity` must equal its wire form. |
| `quote` | [`QuoteV2`](#quotev2) | Your signed quote. |
| `makerProvenance` | `MakerProvenance` | Reserved. Leave unset. |
| `useMigrationHolds` | `boolean` | Reserved. Leave unset. |
| `jitoStakePool` | `string` | Optional. For a JitoSOL market, only [`JITO_STAKE_POOL`](https://docs.covr.markets/reference/sdk/constants.md#jito_stake_pool) is accepted (the default). Must be unset for other mints. |


## FreshWriterAccount

A token account an exit helper creates for the writer, at `createWithSeed(base, seed, tokenProgram)`. Returned by [`exerciseV3Instructions`](https://docs.covr.markets/reference/sdk/settlement.md#exercisev3instructions) and [`releaseV3Instructions`](https://docs.covr.markets/reference/sdk/settlement.md#releasev3instructions).

```ts
export interface FreshWriterAccount {
    address: Address;
    base: Address;
    seed: string;
    mint: Address;
    tokenProgram: Address;
}
```

| Field | Type | Meaning |
| --- | --- | --- |
| `address` | `Address` | The new account. Only `base` can allocate it, so the writer cannot pre-create, freeze, delegate or close it. |
| `base` | `Address` | Your signer: the exercise `authority` or the release `payer`. |
| `seed` | `string` | 32 lowercase hex characters. Random unless you passed one. |
| `mint` | `Address` | USDC for the writer payment account; the collateral mint for the collateral account. |
| `tokenProgram` | `Address` | The mint's token program, which owns the account. The **writer** is its token owner. |


## CancellationRequestV1

A restricted cancellation request, mirroring the program's 288-byte Borsh struct. Restricted markets are covr-only today.

```ts
export interface CancellationRequestV1 {
    genesisHash: string;
    program: string;
    termsId: string;
    position: string;
    maker: string;
    writer: string;
    intentGeneration: bigint;
    refundStrikeUsdc: bigint;
    returnCollateralAtoms: bigint;
    paymentDestination: string;
    collateralDestination: string;
    validUntil: bigint;
}
```

| Field | Type | Meaning |
| --- | --- | --- |
| `genesisHash` | `string` | Genesis hash, base58. |
| `program` | `string` | Program id. |
| `termsId` | `string` | The position's terms id, `0x` + 64 hex. |
| `position` | `string` | The position account. |
| `maker` | `string` | The Maker account. |
| `writer` | `string` | The writer wallet. |
| `intentGeneration` | `bigint` | The position's funding generation. |
| `refundStrikeUsdc` | `bigint` | Strike refunded to the maker, USDC atoms: the full escrow. |
| `returnCollateralAtoms` | `bigint` | Collateral returned to the writer, atoms: the vault's current amount. |
| `paymentDestination` | `string` | Maker's USDC account for the refund. |
| `collateralDestination` | `string` | Writer's collateral account. |
| `validUntil` | `bigint` | Request expiry, unix s. Must be after the position's `cancelEligibleAt`. |


## GatewayEvent

The events [`client.events`](https://docs.covr.markets/reference/sdk/gateway-client.md#clientevents) yields: `rfq`, `award`, `notice` and `closed`. Full description: [GatewayEvent](https://docs.covr.markets/reference/sdk/gateway-client.md#gatewayevent).

```ts
export type GatewayEvent = {
    type: 'rfq';
    asset: string;
    id: string;
    request: RfqRequest;
} | ({
    type: 'award';
} & Award) | {
    type: 'notice';
    socket: 'maker' | 'feed';
    message: unknown;
}
 | {
    type: 'closed';
    socket: 'maker' | 'feed' | 'client';
    asset?: string;
    code: number;
    reason: string;
};
```


## GatewayClientOptions

Options of [`GatewayClient.connect`](https://docs.covr.markets/reference/sdk/gateway-client.md#gatewayclientconnect). Defaults and ranges: [GatewayClientOptions](https://docs.covr.markets/reference/sdk/gateway-client.md#gatewayclientoptions).

```ts
export interface GatewayClientOptions {
    /** Collateral mints or 20-byte aliases to subscribe to. Default: JitoSOL. */
    assets?: readonly string[];
    /** Reply timeout for /maker requests. Default 5000 ms; the award window is 3000 ms. */
    requestTimeoutMs?: number;
    /** HTTP base for /api routes. Default: the WebSocket URL with ws->http, wss->https. */
    httpUrl?: string;
    /** getRfq gives up after this. Default 5000 ms. */
    httpTimeoutMs?: number;
    /** Most events held unread for events(). One more closes the client: the queued events
     * stay readable, then a 'closed' event from 'client'. Default 1000. */
    maxQueuedEvents?: number;
    /** Each socket's upgrade must complete within this. Default 10000 ms. */
    handshakeTimeoutMs?: number;
    /** Every socket is pinged this often... Default 15000 ms (the heartbeat covr's own maker uses). */
    heartbeatIntervalMs?: number;
    /** ...and ended when the matching pong has not arrived within this. Default 30000 ms. */
    heartbeatTimeoutMs?: number;
}
```


## RfqNoteReason

One of the reasons in [`RFQ_NOTE_REASONS`](https://docs.covr.markets/reference/sdk/gateway-client.md#rfq_note_reasons).

```ts
export type RfqNoteReason = typeof RFQ_NOTE_REASONS[number];
// 'warming_up' | 'fully_booked' | 'wallet_limit' | 'too_large' | 'not_priced'
```

---

Source: https://docs.covr.markets/reference/sdk/types · Part of covr Docs, https://docs.covr.markets/llms.txt
