Skip to main content

Class: SigningWriter<L>

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

Composes a transaction-building OvercastWriter with an OvercastChainSigner: each operation builds the layer's transaction (tx) via writer, then signs + submits it via signer, yielding the signer's receipt. The result is itself an OvercastWriter<receipt>, so callers no longer juggle the build-then-submit two-step.

Extended by

Type Parameters

Type ParameterDescription
L extends OvercastLayerthe OvercastLayer describing this settlement layer.

Implements

Constructors

Constructor

new SigningWriter<L>(signer, writer): SigningWriter<L>;

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

Parameters

ParameterType
signerOvercastChainSigner<L>
writerOvercastWriter<L["tx"]>

Returns

SigningWriter<L>

Properties

signer

readonly signer: OvercastChainSigner<L>;

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


writer

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

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

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

OvercastWriter.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

OvercastWriter.addAuthorizedKey


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

OvercastWriter.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

OvercastWriter.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

OvercastWriter.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

OvercastWriter.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

OvercastWriter.deposit


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

OvercastWriter.exerciseOption


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

OvercastWriter.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

OvercastWriter.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

OvercastWriter.withdraw