Skip to main content

Interface: OvercastWriter<T>

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

The Overcast protocol's write operations, parameterised by what each call yields (the read counterpart is OvercastReader).

A transaction-building implementation (e.g. SolanaWriter) yields a built-but-unsubmitted transaction (OvercastWriter<SolanaTx>); a SigningWriter yields the submission receipt instead (OvercastWriter<TxInfo>). The inputs are the same domain objects either way — only the result type T differs.

The delegable calls (createCollateralOffer, createSettlementOffer, closeCollateralOffer, closeSettlementOffer, exerciseOption, redeemOption) take an optional SignedOperation: omitted, the acting party (offer maker / option taker) must sign the transaction itself; present, the transaction may be submitted by anyone (an operator) and the chain verifies the operation's off-chain signature instead. Build one with an OvercastProtocolSigner's sign over the matching operation payload (see the *Operation classes in operation.ts).

Extended by

Type Parameters

Type Parameter
T extends UnsignedTransaction

Methods

acceptOffer()

acceptOffer(settlementOffer, collateralOffer): Promise<T>;

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

matches settlement and collateral offer

Parameters

ParameterTypeDescription
settlementOfferSettlementOffer-
collateralOfferCollateralOffer-

Returns

Promise<T>


addAuthorizedKey()

addAuthorizedKey(key): Promise<T>;

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

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<T>


closeCollateralOffer()

closeCollateralOffer(collateralOffer, operation?): Promise<T>;

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

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<T>


closeSettlementOffer()

closeSettlementOffer(settlementOffer, operation?): Promise<T>;

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

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<T>


createCollateralOffer()

createCollateralOffer(collateralOffer, operation?): Promise<T>;

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

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<T>


createSettlementOffer()

createSettlementOffer(settlementOffer, operation?): Promise<T>;

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

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<T>


deposit()

deposit(deposit): Promise<T>;

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

deposits funds into the depositor's protocol escrow vault

Parameters

ParameterTypeDescription
depositDepositParams-

Returns

Promise<T>


exerciseOption()

exerciseOption(
option,
amount,
metadata?,
operation?): Promise<T>;

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

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<T>


redeemOption()

redeemOption(
option,
amount,
metadata?,
operation?): Promise<T>;

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

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<T>


removeAuthorizedKey()

removeAuthorizedKey(key): Promise<T>;

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

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<T>


withdraw()

withdraw(withdraw): Promise<T>;

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

withdraws funds from the withdrawer's protocol escrow vault

Parameters

ParameterTypeDescription
withdrawWithdrawParams-

Returns

Promise<T>