Skip to main content

Abstract Class: Operation

Defined in: packages/overcast-core/src/operation.ts:132

The signed body of an off-chain operation. Each subclass binds an action discriminant (actionByte) to a payload byte layout (payloadBytes), and digest folds both — with the shared metadata — into the canonical 32-byte message the signer commits to.

The byte layout mirrors Operation/OperationPayload in the on-chain operation.rs; the primitives come from serialization.ts, so both files stay byte-for-byte in sync with the Rust ToBytes serialization.

Extended by

Constructors

Constructor

new Operation(domain, params?): Operation;

Defined in: packages/overcast-core/src/operation.ts:143

Parameters

ParameterType
domainnumber
params?OperationParams

Returns

Operation

Properties

actionByte

abstract readonly actionByte: number;

Defined in: packages/overcast-core/src/operation.ts:136

The action's distinct discriminant byte (see ACTIONS).


domain

readonly domain: number;

Defined in: packages/overcast-core/src/operation.ts:140

The domain that this operation is intended for


params

readonly params: OperationParams;

Defined in: packages/overcast-core/src/operation.ts:141

Methods

digest()

digest(): Bytes32;

Defined in: packages/overcast-core/src/operation.ts:161

Build the canonical 32-byte message the signer commits to — the same encoding getId uses for content-addresses, and for the same reason: the preimage is cross-chain, so the digest is identical on every layer and belongs to none of them.

Preimage layout (SHA-256 hashed), mirroring Operation::digest: "overcast_intent" (15B) | version=1 (1B) | domain (4B LE) | curve (1B) | action (1B) | expiry LE (8B, i64) | nonce (32B) | payload_bytes (variable)

Returns

Bytes32


payloadBytes()

abstract payloadBytes(): Uint8Array;

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

Serializes the action payload into its explicit ToBytes byte layout.

Returns

Uint8Array


sign()

sign(signer): Promise<SignedOperation>;

Defined in: packages/overcast-core/src/operation.ts:175

Parameters

ParameterType
signerOvercastProtocolSigner

Returns

Promise<SignedOperation>