Class: SigningWriter<L>
Defined in: packages/overcast-core/src/protocol/signing-writer.ts:29
Composes a transaction-building OvercastWriter with an
OvercastChainSigner: each operation builds the layer's transaction(s)
via writer, then signs + submits them via signer, yielding the signer's
receipts. The result is itself an OvercastWriter<receipt>, so callers no
longer juggle the build-then-submit two-step.
signer is optional: a read-only app (no key material in its
OvercastConfig) has none, and every method here then throws a
MissingSignerError instead of silently submitting with a wallet that
cannot sign. The writer is always present, so such an app can still build
transactions and submit them by its own means.
Extended by
Type Parameters
| Type Parameter | Description |
|---|---|
L extends OvercastLayer | the OvercastLayer describing this settlement layer. |
Implements
OvercastWriter<L,L["receipt"]>
Constructors
Constructor
new SigningWriter<L>(signer, writer): SigningWriter<L>;
Defined in: packages/overcast-core/src/protocol/signing-writer.ts:32
Parameters
| Parameter | Type |
|---|---|
signer | OvercastChainSigner<L> | undefined |
writer | OvercastWriter<L> |
Returns
SigningWriter<L>
Properties
signer
readonly signer: OvercastChainSigner<L> | undefined;
Defined in: packages/overcast-core/src/protocol/signing-writer.ts:33
writer
readonly writer: OvercastWriter<L>;
Defined in: packages/overcast-core/src/protocol/signing-writer.ts:34
Accessors
chainSigner
Get Signature
get chainSigner(): OvercastChainSigner<L>;
Defined in: packages/overcast-core/src/protocol/signing-writer.ts:44
The signer every write below submits through, narrowed to non-undefined:
the single place a read-only app is turned away, so no method can reach a
submit without one.
Throws
when the app was built without a chain signer.
Returns
Methods
borrowCollateral()
borrowCollateral(
option,
amount,
metadata?): Promise<L["receipt"][]>;
Defined in: packages/overcast-core/src/protocol/signing-writer.ts:96
borrows collateral out of the option's escrow into the taker's own
collateral token account, tracking an outstanding-borrow debt on the
option. Only permitted while option.details.borrowAllowed is set and
before the option's exercise window starts
(option.details.startTimestamp); the settlement layer additionally
decides whether the borrow is allowed. Repayment is trusted, not
enforced on chain — only take a borrow-enabled option from a taker you
trust to honor it. The option is neither exercisable nor redeemable
until all borrowed collateral is repaid. The taker must sign this
transaction themselves (not delegable).
Parameters
| Parameter | Type | Description |
|---|---|---|
option | MarketOption | - |
amount | bigint | native (smallest-unit) amount of option.details.collateralAsset to borrow. |
metadata? | Metadata | opaque settlement-layer metadata, forwarded to the layer's borrow check verbatim (see exerciseOption). Defaults to empty. |
Returns
Promise<L["receipt"][]>
Implementation of
OvercastWriter.borrowCollateral
cancelOffer()
cancelOffer(collateralOffer, operation?): Promise<L["receipt"][]>;
Defined in: packages/overcast-core/src/protocol/signing-writer.ts:58
cancels an open offer, refunding its escrowed collateral/premium to the creator's deposit vault
Parameters
| Parameter | Type | Description |
|---|---|---|
collateralOffer | Offer | - |
operation? | SignedOperation | delegated authorization by the offer's maker; the operation must have been signed over this offer's id. |
Returns
Promise<L["receipt"][]>
Implementation of
createOffer()
createOffer(offer, operation?): Promise<L["receipt"][]>;
Defined in: packages/overcast-core/src/protocol/signing-writer.ts:49
creates a new offer
Parameters
| Parameter | Type | Description |
|---|---|---|
offer | Offer | - |
operation? | SignedOperation | delegated authorization by the offer's creator; the operation must have been signed over this exact offer. |
Returns
Promise<L["receipt"][]>
Implementation of
deposit()
deposit(deposit): Promise<L["receipt"][]>;
Defined in: packages/overcast-core/src/protocol/signing-writer.ts:115
deposits funds into the depositor's protocol escrow vault
The one operation that is routinely more than one transaction: where the
chain gates the pull on a standing allowance (ERC-20 on EVM), the returned
list is [approve, deposit] — the approval for exactly deposit.amount,
omitted when the existing allowance already covers it. See TxStep.
Parameters
| Parameter | Type | Description |
|---|---|---|
deposit | DepositParams | - |
Returns
Promise<L["receipt"][]>
Implementation of
exerciseOption()
exerciseOption(
option,
amount,
params?): Promise<L["receipt"][]>;
Defined in: packages/overcast-core/src/protocol/signing-writer.ts:76
exercises an option with the given amount
Parameters
| Parameter | Type | Description |
|---|---|---|
option | MarketOption | - |
amount | bigint | - |
params? | SettlementParams<L> | SettlementParams: the layer metadata, an optional delegating operation by the option's taker (signed over the exercise payload — option offer ids, amount and metadata exactly as passed here), and the layer's chain-specific settlement context. |
Returns
Promise<L["receipt"][]>
Implementation of
matchOffer()
matchOffer(settlementOffer, collateralOffer): Promise<L["receipt"][]>;
Defined in: packages/overcast-core/src/protocol/signing-writer.ts:67
matches settlement and collateral offer
Parameters
| Parameter | Type | Description |
|---|---|---|
settlementOffer | Offer | - |
collateralOffer | Offer | - |
Returns
Promise<L["receipt"][]>
Implementation of
redeemOption()
redeemOption(
option,
amount,
params?): Promise<L["receipt"][]>;
Defined in: packages/overcast-core/src/protocol/signing-writer.ts:86
redeems an option with the given amount
Parameters
| Parameter | Type | Description |
|---|---|---|
option | MarketOption | - |
amount | bigint | - |
params? | SettlementParams<L> | SettlementParams, as for exerciseOption, except the delegating operation is the option's maker's and is signed over the redeem payload. |
Returns
Promise<L["receipt"][]>
Implementation of
removeAuthorizedKey()
removeAuthorizedKey(key): Promise<L["receipt"][]>;
Defined in: packages/overcast-core/src/protocol/signing-writer.ts:137
revokes a key previously authorized via setAuthorizedKey, 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
| Parameter | Type | Description |
|---|---|---|
key | Bytes32 | the public key to deauthorize. |
Returns
Promise<L["receipt"][]>
Implementation of
OvercastWriter.removeAuthorizedKey
repayCollateral()
repayCollateral(option, amount): Promise<L["receipt"][]>;
Defined in: packages/overcast-core/src/protocol/signing-writer.ts:106
repays previously borrowed collateral back into the option's escrow, reducing the outstanding-borrow debt tracked on the option. Permissionless — any signer holding the collateral asset may repay on the taker's behalf; the repaying wallet must sign this transaction itself.
Parameters
| Parameter | Type | Description |
|---|---|---|
option | MarketOption | - |
amount | bigint | native (smallest-unit) amount of option.details.collateralAsset to repay; must not exceed the option's current outstanding borrow. |
Returns
Promise<L["receipt"][]>
Implementation of
OvercastWriter.repayCollateral
setAuthorizedKey()
setAuthorizedKey(key, permissions?): Promise<L["receipt"][]>;
Defined in: packages/overcast-core/src/protocol/signing-writer.ts:128
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
| Parameter | Type | Default value | Description |
|---|---|---|---|
key | Bytes32 | undefined | the public key to authorize as a signer for this wallet. |
permissions | number | 0xffff | the permissions bitmap - defaults to 0xFFFF granting all permissions. Build the bitmap with buildPermissionsBitmap |
Returns
Promise<L["receipt"][]>
Implementation of
OvercastWriter.setAuthorizedKey
withdraw()
withdraw(withdraw, signedOperation?): Promise<L["receipt"][]>;
Defined in: packages/overcast-core/src/protocol/signing-writer.ts:119
withdraws funds from the withdrawer's protocol escrow vault
Parameters
| Parameter | Type | Description |
|---|---|---|
withdraw | WithdrawParams | - |
signedOperation? | SignedOperation | - |
Returns
Promise<L["receipt"][]>