Skip to content

@lelantos-org/sdk / internal / AssetRegistry

Class: AssetRegistry ​

Defined in: @lelantos-org/sdk/dist/wallet/assets/registry.d.ts:41

Constructors ​

Constructor ​

ts
new AssetRegistry(src): AssetRegistry;

Defined in: @lelantos-org/sdk/dist/wallet/assets/registry.d.ts:50

Parameters ​

ParameterType
srcAssetRegistrySource

Returns ​

AssetRegistry

Methods ​

list() ​

ts
list(): Promise<AssetInfo[]>;

Defined in: @lelantos-org/sdk/dist/wallet/assets/registry.d.ts:58

Everything the registry knows, lowest id first.

Display only. Entries from the relayer's list are not checked against the chain; pass an entry's id to resolveVerified before using its token, scale, fee rates, yield state or ladder to move value.

Returns ​

Promise<AssetInfo[]>


peek() ​

ts
peek(id): AssetInfo | undefined;

Defined in: @lelantos-org/sdk/dist/wallet/assets/registry.d.ts:97

Cached entry for id, without touching the network.

Parameters ​

ParameterType
idAssetId

Returns ​

AssetInfo | undefined


put() ​

ts
put(info): void;

Defined in: @lelantos-org/sdk/dist/wallet/assets/registry.d.ts:95

Seed or replace what the registry knows about id.

Parameters ​

ParameterType
infoAssetInfo

Returns ​

void


refresh() ​

ts
refresh(ref): Promise<AssetInfo>;

Defined in: @lelantos-org/sdk/dist/wallet/assets/registry.d.ts:93

Re-read ref from the chain registry, replacing the cached entry. Verified as resolveVerified is, bypassing its cache.

Parameters ​

ParameterType
refAssetRef

Returns ​

Promise<AssetInfo>


resolve() ​

ts
resolve(ref): Promise<AssetInfo>;

Defined in: @lelantos-org/sdk/dist/wallet/assets/registry.d.ts:70

The asset ref names, as the token list describes it.

An id not in the token list is read from the chain and cached. Symbols and addresses cannot be enumerated from the chain, so an unmatched one fails with the known assets listed.

Name resolution and display only: a listed entry is the relayer's claim, so every field but id, symbol and decimals is advisory. Operations that sign, pull, transfer or size amounts use resolveVerified.

Parameters ​

ParameterType
refAssetRef

Returns ​

Promise<AssetInfo>


resolveVerified() ​

ts
resolveVerified(ref): Promise<AssetInfo>;

Defined in: @lelantos-org/sdk/dist/wallet/assets/registry.d.ts:88

The asset ref names, with every value-bearing field read from the pool.

The token list only maps ref to an id. token, scale, disabled, both fee rates (unless feeBps overrides them), index, rate and yieldEnabled come from chain.fetchAsset; symbol and decimals from the token itself when it reports them, else from the list; ladder is derived from the chain scale and those decimals.

Reused for VERIFIED_ASSET_TTL_MS.

Parameters ​

ParameterType
refAssetRef

Returns ​

Promise<AssetInfo>

Throws ​

when the relayer's list contradicts the chain for this id (token address, scale or decimals), or names by address or symbol an id whose on-chain token is a different one. Neither source is preferred: a relayer that misstates the asset could have a caller sign a pull of the wrong token or amount.