Skip to content
docs

TokensTable

Defined in: table.ts:131

The user’s own tokens, over any JSON storage: load once at cold start, then read synchronously. Writes queue behind each other; a failed save leaves memory as stored. Tokens the catalog lists are refused (they are already there), and so are addresses that are not EVM contracts or Solana mints.

new TokensTable(storage, options?): TokensTable

Defined in: table.ts:138

JsonStorage<TokensState>

number

TokensTable

readonly maxTokens: number

Defined in: table.ts:136

add(token): Promise<UserToken>

Defined in: table.ts:168

Add (or refresh) a token — usually inspection.token after the user accepted the warnings.

UserToken

Promise<UserToken>


get(chain, address): UserToken | undefined

Defined in: table.ts:161

The user token at address on chain, if added.

string

string

UserToken | undefined


list(chain?): UserToken[]

Defined in: table.ts:154

The user’s tokens, oldest first; only those on chain when given.

string

UserToken[]


load(): Promise<void>

Defined in: table.ts:143

Read the stored list. Call once before the sync reads; a failed read throws and leaves the table unloaded.

Promise<void>


remove(chain, address): Promise<boolean>

Defined in: table.ts:181

Remove a token. Returns whether it was there.

string

string

Promise<boolean>


subscribe(fn): () => void

Defined in: table.ts:148

Called after every successful write. Returns the unsubscribe function.

() => void

() => void