Skip to main content

Class: OvercastChainClient<L>

Defined in: packages/overcast-core/src/protocol/chain.ts:39

Concrete OvercastChain: a SigningWriter (signer + transaction writer, build → sign → submit) with the layer's OvercastReader folded in, so on-chain reads and signed writes live behind a single object. Built by OvercastApp from the pieces a ProtocolFactory resolves.

Extends

Type Parameters

Type ParameterDescription
L extends OvercastLayerthe OvercastLayer describing this settlement layer.

Implements

Constructors

Constructor

new OvercastChainClient<L>(
signer,
writer,
reader): OvercastChainClient<L>;

Defined in: packages/overcast-core/src/protocol/chain.ts:43

Parameters

ParameterTypeDescription
signerOvercastChainSigner<L>-
writerOvercastWriter<L["tx"]>-
readerOvercastReaderOn-chain read operations, delegated to by the reader methods below.

Returns

OvercastChainClient<L>

Overrides

SigningWriter.constructor

Properties

reader

readonly reader: OvercastReader;

Defined in: packages/overcast-core/src/protocol/chain.ts:47

On-chain read operations, delegated to by the reader methods below.


signer

readonly signer: OvercastChainSigner<L>;

Defined in: packages/overcast-core/src/protocol/signing-writer.ts:28

Inherited from

SigningWriter.signer


writer

readonly writer: OvercastWriter<L["tx"]>;

Defined in: packages/overcast-core/src/protocol/signing-writer.ts:29

Inherited from

SigningWriter.writer

Methods

acceptOffer()

acceptOffer(settlementOffer, collateralOffer): Promise<L["receipt"]>;

Defined in: packages/overcast-core/src/protocol/signing-writer.ts:68

matches settlement and collateral offer

Parameters

ParameterTypeDescription
settlementOfferSettlementOffer-
collateralOfferCollateralOffer-

Returns

Promise<L["receipt"]>

Implementation of

OvercastChain.acceptOffer

Inherited from

SigningWriter.acceptOffer


addAuthorizedKey()

addAuthorizedKey(key): Promise<L["receipt"]>;

Defined in: packages/overcast-core/src/protocol/signing-writer.ts:107

authorizes key to sign SignedOperations on the calling wallet's behalf. Registers a signing-key record owned by the wallet; thereafter an operator may submit that wallet's delegable calls (createCollateralOffer, createSettlementOffer, exerciseOption) by presenting an operation signed with key. The wallet must sign this transaction itself — you can only authorize keys for yourself.

Parameters

ParameterTypeDescription
keystringthe public key to authorize as a signer for this wallet.

Returns

Promise<L["receipt"]>

Implementation of

OvercastChain.addAuthorizedKey

Inherited from

SigningWriter.addAuthorizedKey


balance()

balance(user, asset): Promise<bigint>;

Defined in: packages/overcast-core/src/protocol/chain.ts:54

Gets the current balance for an asset in the protocols vault

Parameters

ParameterTypeDescription
userstring-
asset{ address: string; cashLike?: boolean; chain?: string; coinGeckoId?: string; decimals?: number; lastKnownPriceUsd?: number; logoUrl?: string; name?: string; rwa?: boolean; symbol?: string; volatility?: number; }-
asset.addressstringThe on-chain address (mint) that uniquely identifies the asset.
asset.cashLike?booleanWhether or not the asset can be treated similar to cash
asset.chain?stringThe chain the asset lives on.
asset.coinGeckoId?stringCoinGecko id for price lookups, e.g. usd-coin.
asset.decimals?numberNumber of decimal places in the asset's native units.
asset.lastKnownPriceUsd?numberLast known USD price, sourced best-effort from an external feed (CoinGecko). Untrusted — do not use for settlement, signing, valuation, or any value transfer. It is informational only (e.g. showing an approximate notional in a picker), may be stale, missing, or wrong, and is never part of the canonical, content-addressed asset identity. Present only once a price has actually been fetched for the asset.
asset.logoUrl?stringLogo of the coin
asset.name?stringHuman name of the asset.
asset.rwa?booleanWhether the asset is a real-world asset (RWA) — e.g. tokenized private equity — rather than a native crypto asset.
asset.symbol?stringHuman ticker, e.g. USDC.
asset.volatility?numberVolatility of the asset

Returns

Promise<bigint>

Implementation of

OvercastChain.balance


closeCollateralOffer()

closeCollateralOffer(collateralOffer, operation?): Promise<L["receipt"]>;

Defined in: packages/overcast-core/src/protocol/signing-writer.ts:50

closes an open collateral offer, refunding its escrowed collateral to the maker's deposit vault

Parameters

ParameterTypeDescription
collateralOfferCollateralOfferthe offer to close (must match the on-chain, content-addressed offer exactly).
operation?SignedOperationdelegated authorization by the offer's maker; the operation must have been signed over this offer's id.

Returns

Promise<L["receipt"]>

Implementation of

OvercastChain.closeCollateralOffer

Inherited from

SigningWriter.closeCollateralOffer


closeSettlementOffer()

closeSettlementOffer(settlementOffer, operation?): Promise<L["receipt"]>;

Defined in: packages/overcast-core/src/protocol/signing-writer.ts:59

closes an open settlement offer, refunding its escrowed premium to the taker's deposit vault

Parameters

ParameterTypeDescription
settlementOfferSettlementOfferthe offer to close (must match the on-chain, content-addressed offer exactly).
operation?SignedOperationdelegated authorization by the offer's taker; the operation must have been signed over this offer's id.

Returns

Promise<L["receipt"]>

Implementation of

OvercastChain.closeSettlementOffer

Inherited from

SigningWriter.closeSettlementOffer


createCollateralOffer()

createCollateralOffer(collateralOffer, operation?): Promise<L["receipt"]>;

Defined in: packages/overcast-core/src/protocol/signing-writer.ts:32

creates a new collateral offer

Parameters

ParameterTypeDescription
collateralOfferCollateralOffer-
operation?SignedOperationdelegated authorization by the offer's maker; the operation must have been signed over this exact offer.

Returns

Promise<L["receipt"]>

Implementation of

OvercastChain.createCollateralOffer

Inherited from

SigningWriter.createCollateralOffer


createSettlementOffer()

createSettlementOffer(settlementOffer, operation?): Promise<L["receipt"]>;

Defined in: packages/overcast-core/src/protocol/signing-writer.ts:41

creates a new settlement offer

Parameters

ParameterTypeDescription
settlementOfferSettlementOffer-
operation?SignedOperationdelegated authorization by the offer's taker; the operation must have been signed over this exact offer.

Returns

Promise<L["receipt"]>

Implementation of

OvercastChain.createSettlementOffer

Inherited from

SigningWriter.createSettlementOffer


deposit()

deposit(deposit): Promise<L["receipt"]>;

Defined in: packages/overcast-core/src/protocol/signing-writer.ts:99

deposits funds into the depositor's protocol escrow vault

Parameters

ParameterTypeDescription
depositDepositParams-

Returns

Promise<L["receipt"]>

Implementation of

OvercastChain.deposit

Inherited from

SigningWriter.deposit


exerciseClaims()

exerciseClaims(option, user): Promise<bigint>;

Defined in: packages/overcast-core/src/protocol/chain.ts:70

returns the user balance of exercise claims for the given option

Parameters

ParameterTypeDescription
optionMarketOption-
userstring-

Returns

Promise<bigint>

Implementation of

OvercastChain.exerciseClaims


exerciseClaimsSupply()

exerciseClaimsSupply(option): Promise<bigint>;

Defined in: packages/overcast-core/src/protocol/chain.ts:58

Returns the total supply of exercise claims for the given option

Parameters

ParameterTypeDescription
optionMarketOption-

Returns

Promise<bigint>

Implementation of

OvercastChain.exerciseClaimsSupply


exerciseOption()

exerciseOption(
option,
amount,
metadata?,
operation?): Promise<L["receipt"]>;

Defined in: packages/overcast-core/src/protocol/signing-writer.ts:77

exercies an option with the given amount

Parameters

ParameterTypeDescription
optionMarketOption-
amountbigint-
metadata?Metadataopaque settlement-layer metadata, forwarded to the layer verbatim (no interpretation). Defaults to empty; a physical layer needs none. Build it yourself or via OvercastSettlementLayer.buildMetadata.
operation?SignedOperationdelegated authorization by the option's taker; the operation must have been signed over the exercise payload (option offer ids, amount and metadata exactly as passed here).

Returns

Promise<L["receipt"]>

Implementation of

OvercastChain.exerciseOption

Inherited from

SigningWriter.exerciseOption


getCollateralOffer()

getCollateralOffer(id): Promise<
| WithId<CollateralOffer>
| null>;

Defined in: packages/overcast-core/src/protocol/chain.ts:81

Look up a single collateral offer by its content-address Id, or null when no such offer exists on-chain.

Parameters

ParameterType
idstring

Returns

Promise< | WithId<CollateralOffer> | null>

Implementation of

OvercastChain.getCollateralOffer


getOption()

getOption(collateralOfferId, settlementOfferId): Promise<
| WithId<MarketOption>
| null>;

Defined in: packages/overcast-core/src/protocol/chain.ts:74

Look up a single market option by the content-address ids of the two offers it was matched from, or null when no such option exists on-chain.

An option's on-chain account is keyed by its (collateralOffer, settlementOffer) id pair (the seeds of its PDA), not by its own content-address hash — so those two ids, rather than the option id, are how it is fetched directly without scanning. The returned option carries its own content-address Id (the one the RFQ flow / storage use) on id.

TODO: we should make this just a single id

Parameters

ParameterType
collateralOfferIdstring
settlementOfferIdstring

Returns

Promise< | WithId<MarketOption> | null>

Implementation of

OvercastChain.getOption


getSettlementOffer()

getSettlementOffer(id): Promise<
| WithId<SettlementOffer>
| null>;

Defined in: packages/overcast-core/src/protocol/chain.ts:85

Look up a single settlement offer by its content-address Id, or null when no such offer exists on-chain.

Parameters

ParameterType
idstring

Returns

Promise< | WithId<SettlementOffer> | null>

Implementation of

OvercastChain.getSettlementOffer


redeemClaims()

redeemClaims(option, user): Promise<bigint>;

Defined in: packages/overcast-core/src/protocol/chain.ts:66

returns the user balance of redeem claims for the given option

Parameters

ParameterTypeDescription
optionMarketOption-
userstring-

Returns

Promise<bigint>

Implementation of

OvercastChain.redeemClaims


redeemClaimsSupply()

redeemClaimsSupply(option): Promise<bigint>;

Defined in: packages/overcast-core/src/protocol/chain.ts:62

Returns the total supply of redeem claims for the given option

Parameters

ParameterTypeDescription
optionMarketOption-

Returns

Promise<bigint>

Implementation of

OvercastChain.redeemClaimsSupply


redeemOption()

redeemOption(
option,
amount,
metadata?,
operation?): Promise<L["receipt"]>;

Defined in: packages/overcast-core/src/protocol/signing-writer.ts:88

redeems an option with the given amount

Parameters

ParameterTypeDescription
optionMarketOption-
amountbigint-
metadata?Metadataopaque settlement-layer metadata, forwarded to the layer verbatim (see exerciseOption).
operation?SignedOperationdelegated authorization by the option's maker; the operation must have been signed over the redeem payload (option offer ids, amount and metadata exactly as passed here).

Returns

Promise<L["receipt"]>

Implementation of

OvercastChain.redeemOption

Inherited from

SigningWriter.redeemOption


removeAuthorizedKey()

removeAuthorizedKey(key): Promise<L["receipt"]>;

Defined in: packages/overcast-core/src/protocol/signing-writer.ts:111

revokes a key previously authorized via addAuthorizedKey, closing its signing-key record (the rent is refunded to the wallet). Operations signed with key are rejected afterwards. The wallet must sign this transaction itself.

Parameters

ParameterTypeDescription
keystringthe public key to deauthorize.

Returns

Promise<L["receipt"]>

Implementation of

OvercastChain.removeAuthorizedKey

Inherited from

SigningWriter.removeAuthorizedKey


withdraw()

withdraw(withdraw): Promise<L["receipt"]>;

Defined in: packages/overcast-core/src/protocol/signing-writer.ts:103

withdraws funds from the withdrawer's protocol escrow vault

Parameters

ParameterTypeDescription
withdrawWithdrawParams-

Returns

Promise<L["receipt"]>

Implementation of

OvercastChain.withdraw

Inherited from

SigningWriter.withdraw