Interface: OvercastUtils
Defined in: packages/overcast-core/src/protocol/utils.ts:34
A settlement layer's address boundary: the complete set of conversions between the chain's own address encoding and the canonical Bytes32 slots that core works in.
Core itself never calls these. It holds slots from end to end — hashing,
signing, indexing, storing and filtering all happen in Bytes32, so
getId(offer) and op.digest() take no layer at all. That is the point of
concentrating every conversion here: there is exactly one place a chain
encoding is understood, and it is the layer that owns that chain.
So these four methods are called at the edges, and only there:
- a user types an address → parseAddress then toBytes32;
- a chain read decodes an address → toBytes32;
- a value is shown to a human, or put in a curated display shape → formatAddress;
- a form validates as it is typed → isValidAddress.
toBytes32 and formatAddress must round-trip
(formatAddress(toBytes32(a)) === a for any canonical a) and must agree
byte-for-byte with the chain's own encoding — a layer that widens an address
differently from its contracts derives content-addresses nothing on chain
matches.
A layer provides one implementation (e.g. SolanaUtils) through its
ProtocolFactory. These are stateless — no connection, no key — so
unlike the reader / writer / signer the factory hands them over synchronously.
Exposed to consumers as app.utils.
Methods
formatAddress()
formatAddress(value): Address;
Defined in: packages/overcast-core/src/protocol/utils.ts:74
The inverse of toBytes32: a canonical slot back to this layer's address encoding, for display and for handing to the chain's own SDK.
Throws if the slot cannot be an address on this layer — e.g. an EVM layer given a slot with non-zero high bytes, which is a content-address or a digest rather than an account, and almost certainly a bug at the call site.
Parameters
| Parameter | Type |
|---|---|
value | Bytes32 |
Returns
isValidAddress()
isValidAddress(value): boolean;
Defined in: packages/overcast-core/src/protocol/utils.ts:40
Whether value is a well-formed address on this layer. The non-throwing
counterpart to parseAddress, for validating input as it is typed,
where an exception is the wrong shape of answer.
Parameters
| Parameter | Type |
|---|---|
value | string |
Returns
boolean
parseAddress()
parseAddress(value): Address;
Defined in: packages/overcast-core/src/protocol/utils.ts:53
Parse an untrusted string into this layer's canonical Address form, or throw.
The boundary check for anything the type system cannot vouch for: a CLI
argument, a wire payload, an address minted by another chain. Address is
structurally a string, so the compiler will happily hand a Solana layer an
EVM address; this is the call that catches it. Canonicalizing — trimming,
re-encoding to the chain's preferred casing — is part of the job, so the
result is safe to compare and display.
Parameters
| Parameter | Type |
|---|---|
value | string |
Returns
toBytes32()
toBytes32(value): Bytes32;
Defined in: packages/overcast-core/src/protocol/utils.ts:64
A chain address as the canonical 32-byte slot core hashes and stores.
Throws if value is not a valid address on this layer — it performs the
same parse parseAddress does, so callers holding raw input can go
straight here.
Layers narrower than 32 bytes widen: an EVM address occupies the low 20 bytes of the slot, left-padded with zeros, exactly as its contracts do it.
Parameters
| Parameter | Type |
|---|---|
value | Address |