Skip to main content

Class: OvercastAssets

Defined in: packages/overcast-core/src/assets/pinned.ts:33

An AssetRegistry pinned to one domain and one address boundary — the shape a single-chain consumer actually wants.

The registry is keyed by (domain, display address), but a consumer holds Bytes32 slots: core works in slots end to end, so every asset field a caller reads off an option, an offer or a chain read is a slot. Resolving one therefore means format the slot through this chain's boundary, then look the address up on this domain — three collaborators for one question, which is why every consumer so far has hand-rolled it (and why a slot from the wrong chain used to be resolvable at all).

Pinning both halves collapses it to assets.get(slot). An OvercastApp is pinned to one chain, so this is what app.assets() hands back; the multi-domain counterpart is OvercastCurator, which picks the domain per record instead.

Every lookup here is synchronous — the metadata is fetched once, up front — because formatting happens inside render loops and CLI output paths that cannot await.

Nothing here gates anything: an asset with no metadata resolves to its bare address (getOrDefault) and stays perfectly tradeable. See AssetRegistry.

Constructors

Constructor

new OvercastAssets(
domain,
utils,
registry): OvercastAssets;

Defined in: packages/overcast-core/src/assets/pinned.ts:66

Parameters

ParameterTypeDescription
domainnumberThe protocol domain every lookup is scoped to.
utilsOvercastUtilsThis chain's address boundary, used to format slots for lookup.
registryAssetRegistryThe underlying registry. Exposed so a caller can hand it to an OvercastCurator (or register more assets) rather than build a second copy from the same source.

Returns

OvercastAssets

Properties

domain

readonly domain: number;

Defined in: packages/overcast-core/src/assets/pinned.ts:68

The protocol domain every lookup is scoped to.


registry

readonly registry: AssetRegistry;

Defined in: packages/overcast-core/src/assets/pinned.ts:76

The underlying registry. Exposed so a caller can hand it to an OvercastCurator (or register more assets) rather than build a second copy from the same source.

Methods

address()

address(asset): Address;

Defined in: packages/overcast-core/src/assets/pinned.ts:127

This chain's display encoding of an asset's address.

Parameters

ParameterTypeDescription
asset{ address: string; cashLike?: boolean; chain?: string; coinGeckoId?: string; decimals?: number; domain?: number; lastKnownPriceUsd?: number; logoUrl?: string; name?: string; rwa?: boolean; symbol?: string; volatility?: number; }-
asset.addressstringThe on-chain address (mint) identifying the asset, in the layer's own encoding (base58 on Solana, 0x… on an EVM chain) — see Address.
asset.cashLike?booleanWhether or not the asset can be treated similar to cash
asset.chain?stringThe chain the asset lives on, e.g. "base". A display label only — it is a caller-chosen name (see ChainName), carried by no wire payload and never used to key or look up an asset. domain is the identity.
asset.coinGeckoId?stringCoinGecko id for price lookups, e.g. usd-coin.
asset.decimals?numberNumber of decimal places in the asset's native units.
asset.domain?numberThe protocol domain the asset lives on — the same separator OptionDetails.domain carries and every indexed event is tagged with, and the first half of the asset's key in an AssetRegistry. Optional because a single-domain deployment has nothing to disambiguate; such an asset registers as a wildcard, matching any domain that has no asset of its own at that address. Populate it as soon as one backend serves two domains — an address is only unique within a domain.
asset.lastKnownPriceUsd?numberLast known USD price, sourced best-effort from an external feed (CoinGecko). Untrusted — do not use for settlement, signing, valuation, or any value transfer. It is informational only (e.g. showing an approximate notional in a picker), may be stale, missing, or wrong, and is never part of the canonical, content-addressed asset identity. Present only once a price has actually been fetched for the asset.
asset.logoUrl?stringLogo of the coin
asset.name?stringHuman name of the asset.
asset.rwa?booleanWhether the asset is a real-world asset (RWA) — e.g. tokenized private equity — rather than a native crypto asset.
asset.symbol?stringHuman ticker, e.g. USDC.
asset.volatility?numberVolatility of the asset

Returns

Address


byAddress()

byAddress(address):
| {
address: string;
cashLike?: boolean;
chain?: string;
coinGeckoId?: string;
decimals?: number;
domain?: number;
lastKnownPriceUsd?: number;
logoUrl?: string;
name?: string;
rwa?: boolean;
symbol?: string;
volatility?: number;
}
| undefined;

Defined in: packages/overcast-core/src/assets/pinned.ts:107

The asset at a display address on this domain — for input a user typed or a flag carries, as opposed to the slots get takes. The address is parsed through this chain's boundary first, so a malformed one (or one from another chain) throws here rather than silently missing.

Parameters

ParameterType
addressstring

Returns

Type Literal
{
address: string;
cashLike?: boolean;
chain?: string;
coinGeckoId?: string;
decimals?: number;
domain?: number;
lastKnownPriceUsd?: number;
logoUrl?: string;
name?: string;
rwa?: boolean;
symbol?: string;
volatility?: number;
}
address
address: string;

The on-chain address (mint) identifying the asset, in the layer's own encoding (base58 on Solana, 0x… on an EVM chain) — see Address.

cashLike?
optional cashLike?: boolean;

Whether or not the asset can be treated similar to cash

chain?
optional chain?: string;

The chain the asset lives on, e.g. "base". A display label only — it is a caller-chosen name (see ChainName), carried by no wire payload and never used to key or look up an asset. domain is the identity.

coinGeckoId?
optional coinGeckoId?: string;

CoinGecko id for price lookups, e.g. usd-coin.

decimals?
optional decimals?: number;

Number of decimal places in the asset's native units.

domain?
optional domain?: number;

The protocol domain the asset lives on — the same separator OptionDetails.domain carries and every indexed event is tagged with, and the first half of the asset's key in an AssetRegistry.

Optional because a single-domain deployment has nothing to disambiguate; such an asset registers as a wildcard, matching any domain that has no asset of its own at that address. Populate it as soon as one backend serves two domains — an address is only unique within a domain.

lastKnownPriceUsd?
optional lastKnownPriceUsd?: number;

Last known USD price, sourced best-effort from an external feed (CoinGecko). Untrusted — do not use for settlement, signing, valuation, or any value transfer. It is informational only (e.g. showing an approximate notional in a picker), may be stale, missing, or wrong, and is never part of the canonical, content-addressed asset identity. Present only once a price has actually been fetched for the asset.

logoUrl?
optional logoUrl?: string;

Logo of the coin

name?
optional name?: string;

Human name of the asset.

rwa?
optional rwa?: boolean;

Whether the asset is a real-world asset (RWA) — e.g. tokenized private equity — rather than a native crypto asset.

symbol?
optional symbol?: string;

Human ticker, e.g. USDC.

volatility?
optional volatility?: number;

Volatility of the asset


undefined


bySymbol()

bySymbol(symbol):
| {
address: string;
cashLike?: boolean;
chain?: string;
coinGeckoId?: string;
decimals?: number;
domain?: number;
lastKnownPriceUsd?: number;
logoUrl?: string;
name?: string;
rwa?: boolean;
symbol?: string;
volatility?: number;
}
| undefined;

Defined in: packages/overcast-core/src/assets/pinned.ts:112

The asset with this ticker on this domain (case-insensitive).

Parameters

ParameterType
symbolstring

Returns

Type Literal
{
address: string;
cashLike?: boolean;
chain?: string;
coinGeckoId?: string;
decimals?: number;
domain?: number;
lastKnownPriceUsd?: number;
logoUrl?: string;
name?: string;
rwa?: boolean;
symbol?: string;
volatility?: number;
}
address
address: string;

The on-chain address (mint) identifying the asset, in the layer's own encoding (base58 on Solana, 0x… on an EVM chain) — see Address.

cashLike?
optional cashLike?: boolean;

Whether or not the asset can be treated similar to cash

chain?
optional chain?: string;

The chain the asset lives on, e.g. "base". A display label only — it is a caller-chosen name (see ChainName), carried by no wire payload and never used to key or look up an asset. domain is the identity.

coinGeckoId?
optional coinGeckoId?: string;

CoinGecko id for price lookups, e.g. usd-coin.

decimals?
optional decimals?: number;

Number of decimal places in the asset's native units.

domain?
optional domain?: number;

The protocol domain the asset lives on — the same separator OptionDetails.domain carries and every indexed event is tagged with, and the first half of the asset's key in an AssetRegistry.

Optional because a single-domain deployment has nothing to disambiguate; such an asset registers as a wildcard, matching any domain that has no asset of its own at that address. Populate it as soon as one backend serves two domains — an address is only unique within a domain.

lastKnownPriceUsd?
optional lastKnownPriceUsd?: number;

Last known USD price, sourced best-effort from an external feed (CoinGecko). Untrusted — do not use for settlement, signing, valuation, or any value transfer. It is informational only (e.g. showing an approximate notional in a picker), may be stale, missing, or wrong, and is never part of the canonical, content-addressed asset identity. Present only once a price has actually been fetched for the asset.

logoUrl?
optional logoUrl?: string;

Logo of the coin

name?
optional name?: string;

Human name of the asset.

rwa?
optional rwa?: boolean;

Whether the asset is a real-world asset (RWA) — e.g. tokenized private equity — rather than a native crypto asset.

symbol?
optional symbol?: string;

Human ticker, e.g. USDC.

volatility?
optional volatility?: number;

Volatility of the asset


undefined


decimals()

decimals(slot): number;

Defined in: packages/overcast-core/src/assets/pinned.ts:151

The decimals of the asset a slot names, 0 when unknown.

Parameters

ParameterType
slotBytes32

Returns

number


display()

display(nativeAmount, slot): string;

Defined in: packages/overcast-core/src/assets/pinned.ts:137

A native amount as a bare display decimal string, without the symbol.

Parameters

ParameterType
nativeAmountbigint
slotBytes32

Returns

string


format()

format(nativeAmount, slot): string;

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

Format a native amount of the asset a slot names, e.g. 1.5 SOL.

Parameters

ParameterType
nativeAmountbigint
slotBytes32

Returns

string


get()

get(slot):
| {
address: string;
cashLike?: boolean;
chain?: string;
coinGeckoId?: string;
decimals?: number;
domain?: number;
lastKnownPriceUsd?: number;
logoUrl?: string;
name?: string;
rwa?: boolean;
symbol?: string;
volatility?: number;
}
| undefined;

Defined in: packages/overcast-core/src/assets/pinned.ts:80

The asset a slot names on this domain, or undefined if it has no metadata.

Parameters

ParameterType
slotBytes32

Returns

Type Literal
{
address: string;
cashLike?: boolean;
chain?: string;
coinGeckoId?: string;
decimals?: number;
domain?: number;
lastKnownPriceUsd?: number;
logoUrl?: string;
name?: string;
rwa?: boolean;
symbol?: string;
volatility?: number;
}
address
address: string;

The on-chain address (mint) identifying the asset, in the layer's own encoding (base58 on Solana, 0x… on an EVM chain) — see Address.

cashLike?
optional cashLike?: boolean;

Whether or not the asset can be treated similar to cash

chain?
optional chain?: string;

The chain the asset lives on, e.g. "base". A display label only — it is a caller-chosen name (see ChainName), carried by no wire payload and never used to key or look up an asset. domain is the identity.

coinGeckoId?
optional coinGeckoId?: string;

CoinGecko id for price lookups, e.g. usd-coin.

decimals?
optional decimals?: number;

Number of decimal places in the asset's native units.

domain?
optional domain?: number;

The protocol domain the asset lives on — the same separator OptionDetails.domain carries and every indexed event is tagged with, and the first half of the asset's key in an AssetRegistry.

Optional because a single-domain deployment has nothing to disambiguate; such an asset registers as a wildcard, matching any domain that has no asset of its own at that address. Populate it as soon as one backend serves two domains — an address is only unique within a domain.

lastKnownPriceUsd?
optional lastKnownPriceUsd?: number;

Last known USD price, sourced best-effort from an external feed (CoinGecko). Untrusted — do not use for settlement, signing, valuation, or any value transfer. It is informational only (e.g. showing an approximate notional in a picker), may be stale, missing, or wrong, and is never part of the canonical, content-addressed asset identity. Present only once a price has actually been fetched for the asset.

logoUrl?
optional logoUrl?: string;

Logo of the coin

name?
optional name?: string;

Human name of the asset.

rwa?
optional rwa?: boolean;

Whether the asset is a real-world asset (RWA) — e.g. tokenized private equity — rather than a native crypto asset.

symbol?
optional symbol?: string;

Human ticker, e.g. USDC.

volatility?
optional volatility?: number;

Volatility of the asset


undefined


getOrDefault()

getOrDefault(slot): object;

Defined in: packages/overcast-core/src/assets/pinned.ts:94

Like get, but defaults to a bare Asset carrying just the address when there is no metadata — the resolution a display path wants, where an uncurated token should render as its address rather than throw.

Parameters

ParameterType
slotBytes32

Returns

address
address: string;

The on-chain address (mint) identifying the asset, in the layer's own encoding (base58 on Solana, 0x… on an EVM chain) — see Address.

cashLike?
optional cashLike?: boolean;

Whether or not the asset can be treated similar to cash

chain?
optional chain?: string;

The chain the asset lives on, e.g. "base". A display label only — it is a caller-chosen name (see ChainName), carried by no wire payload and never used to key or look up an asset. domain is the identity.

coinGeckoId?
optional coinGeckoId?: string;

CoinGecko id for price lookups, e.g. usd-coin.

decimals?
optional decimals?: number;

Number of decimal places in the asset's native units.

domain?
optional domain?: number;

The protocol domain the asset lives on — the same separator OptionDetails.domain carries and every indexed event is tagged with, and the first half of the asset's key in an AssetRegistry.

Optional because a single-domain deployment has nothing to disambiguate; such an asset registers as a wildcard, matching any domain that has no asset of its own at that address. Populate it as soon as one backend serves two domains — an address is only unique within a domain.

lastKnownPriceUsd?
optional lastKnownPriceUsd?: number;

Last known USD price, sourced best-effort from an external feed (CoinGecko). Untrusted — do not use for settlement, signing, valuation, or any value transfer. It is informational only (e.g. showing an approximate notional in a picker), may be stale, missing, or wrong, and is never part of the canonical, content-addressed asset identity. Present only once a price has actually been fetched for the asset.

logoUrl?
optional logoUrl?: string;

Logo of the coin

name?
optional name?: string;

Human name of the asset.

rwa?
optional rwa?: boolean;

Whether the asset is a real-world asset (RWA) — e.g. tokenized private equity — rather than a native crypto asset.

symbol?
optional symbol?: string;

Human ticker, e.g. USDC.

volatility?
optional volatility?: number;

Volatility of the asset


list()

list(): object[];

Defined in: packages/overcast-core/src/assets/pinned.ts:117

Every asset curated for this domain, in the order the backend returned it.

Returns


parse()

parse(displayAmount, slot): bigint;

Defined in: packages/overcast-core/src/assets/pinned.ts:146

A whole-token amount the user typed, as an exact native bigint, scaled by the decimals of the asset the slot names. Throws on a malformed amount or one with more precision than the asset has (see parseUnits).

Parameters

ParameterType
displayAmountstring
slotBytes32

Returns

bigint


require()

require(slot): object;

Defined in: packages/overcast-core/src/assets/pinned.ts:85

Like get, but throws when the asset has no metadata.

Parameters

ParameterType
slotBytes32

Returns

address
address: string;

The on-chain address (mint) identifying the asset, in the layer's own encoding (base58 on Solana, 0x… on an EVM chain) — see Address.

cashLike?
optional cashLike?: boolean;

Whether or not the asset can be treated similar to cash

chain?
optional chain?: string;

The chain the asset lives on, e.g. "base". A display label only — it is a caller-chosen name (see ChainName), carried by no wire payload and never used to key or look up an asset. domain is the identity.

coinGeckoId?
optional coinGeckoId?: string;

CoinGecko id for price lookups, e.g. usd-coin.

decimals?
optional decimals?: number;

Number of decimal places in the asset's native units.

domain?
optional domain?: number;

The protocol domain the asset lives on — the same separator OptionDetails.domain carries and every indexed event is tagged with, and the first half of the asset's key in an AssetRegistry.

Optional because a single-domain deployment has nothing to disambiguate; such an asset registers as a wildcard, matching any domain that has no asset of its own at that address. Populate it as soon as one backend serves two domains — an address is only unique within a domain.

lastKnownPriceUsd?
optional lastKnownPriceUsd?: number;

Last known USD price, sourced best-effort from an external feed (CoinGecko). Untrusted — do not use for settlement, signing, valuation, or any value transfer. It is informational only (e.g. showing an approximate notional in a picker), may be stale, missing, or wrong, and is never part of the canonical, content-addressed asset identity. Present only once a price has actually been fetched for the asset.

logoUrl?
optional logoUrl?: string;

Logo of the coin

name?
optional name?: string;

Human name of the asset.

rwa?
optional rwa?: boolean;

Whether the asset is a real-world asset (RWA) — e.g. tokenized private equity — rather than a native crypto asset.

symbol?
optional symbol?: string;

Human ticker, e.g. USDC.

volatility?
optional volatility?: number;

Volatility of the asset


slot()

slot(asset): Bytes32;

Defined in: packages/overcast-core/src/assets/pinned.ts:122

The canonical slot for an asset from list / a picker.

Parameters

ParameterTypeDescription
asset{ address: string; cashLike?: boolean; chain?: string; coinGeckoId?: string; decimals?: number; domain?: number; lastKnownPriceUsd?: number; logoUrl?: string; name?: string; rwa?: boolean; symbol?: string; volatility?: number; }-
asset.addressstringThe on-chain address (mint) identifying the asset, in the layer's own encoding (base58 on Solana, 0x… on an EVM chain) — see Address.
asset.cashLike?booleanWhether or not the asset can be treated similar to cash
asset.chain?stringThe chain the asset lives on, e.g. "base". A display label only — it is a caller-chosen name (see ChainName), carried by no wire payload and never used to key or look up an asset. domain is the identity.
asset.coinGeckoId?stringCoinGecko id for price lookups, e.g. usd-coin.
asset.decimals?numberNumber of decimal places in the asset's native units.
asset.domain?numberThe protocol domain the asset lives on — the same separator OptionDetails.domain carries and every indexed event is tagged with, and the first half of the asset's key in an AssetRegistry. Optional because a single-domain deployment has nothing to disambiguate; such an asset registers as a wildcard, matching any domain that has no asset of its own at that address. Populate it as soon as one backend serves two domains — an address is only unique within a domain.
asset.lastKnownPriceUsd?numberLast known USD price, sourced best-effort from an external feed (CoinGecko). Untrusted — do not use for settlement, signing, valuation, or any value transfer. It is informational only (e.g. showing an approximate notional in a picker), may be stale, missing, or wrong, and is never part of the canonical, content-addressed asset identity. Present only once a price has actually been fetched for the asset.
asset.logoUrl?stringLogo of the coin
asset.name?stringHuman name of the asset.
asset.rwa?booleanWhether the asset is a real-world asset (RWA) — e.g. tokenized private equity — rather than a native crypto asset.
asset.symbol?stringHuman ticker, e.g. USDC.
asset.volatility?numberVolatility of the asset

Returns

Bytes32


from()

static from(
domain,
utils,
assets): OvercastAssets;

Defined in: packages/overcast-core/src/assets/pinned.ts:51

Build the view from the metadata as the backend shipped it, canonicalizing every address through the layer's own boundary on the way in.

That step is what makes the lookups below hit. A lookup starts from a slot and formats it (OvercastUtils.formatAddress), which always yields the chain's canonical spelling — EIP-55 checksummed on EVM. A backend that ships the same address in lower case would key the registry under a string no formatted slot can ever equal, and every leg would silently resolve to an unknown asset with no decimals. Running each address through OvercastUtils.parseAddress first — whose job is exactly this re-encoding — puts both sides in the same spelling.

An address this layer rejects is kept verbatim rather than dropped: it cannot be resolved either way, and silently losing an entry is worse than carrying an unresolvable one.

Parameters

ParameterType
domainnumber
utilsOvercastUtils
assetsobject[]

Returns

OvercastAssets