Skip to main content

Class: SolanaReader

Defined in: solana-client/src/reader.ts:44

Solana implementation of OvercastReader: the read-only side of the protocol. It needs only an RPC Connection (no wallet), so it serves read-only clients too. PDAs are derived locally via the get*Pda helpers, mirroring the program's seeds = [..].

Vault balances live in per-user, per-mint protocol escrow token accounts; the per-asset SPL token program is resolved by reading each mint's owner so both legacy Token and Token-2022 assets are handled. An option's two claim mints use the permanent-delegate extension and are therefore always Token-2022.

Implements

  • OvercastReader

Constructors

Constructor

new SolanaReader(program): SolanaReader;

Defined in: solana-client/src/reader.ts:55

The Anchor program is used purely for reads: deserializing the content-addressed offer / option accounts via its account coder. Its provider only needs a connection (no wallet), so this still serves read-only clients. Balances and claim supplies go through the raw Connection / SPL-token helpers below.

Parameters

ParameterType
programProgram<OvercastCore>

Returns

SolanaReader

Properties

connection

readonly connection: Connection;

Defined in: solana-client/src/reader.ts:45


programId

readonly programId: PublicKey;

Defined in: solana-client/src/reader.ts:46

Methods

balance()

balance(user, asset): Promise<bigint>;

Defined in: solana-client/src/reader.ts:60

Gets the current balance for an asset in the protocols vault

Parameters

ParameterType
userstring
asset{ address: string; cashLike?: boolean; chain?: string; coinGeckoId?: string; decimals?: number; lastKnownPriceUsd?: number; logoUrl?: string; name?: string; rwa?: boolean; symbol?: string; volatility?: number; }
asset.addressstring
asset.cashLike?boolean
asset.chain?string
asset.coinGeckoId?string
asset.decimals?number
asset.lastKnownPriceUsd?number
asset.logoUrl?string
asset.name?string
asset.rwa?boolean
asset.symbol?string
asset.volatility?number

Returns

Promise<bigint>

Implementation of

OvercastReader.balance

exerciseClaims()

exerciseClaims(option, user): Promise<bigint>;

Defined in: solana-client/src/reader.ts:106

returns the user balance of exercise claims for the given option

Parameters

ParameterTypeDescription
optionMarketOption-
userstring-

Returns

Promise<bigint>

Implementation of

OvercastReader.exerciseClaims

exerciseClaimsSupply()

exerciseClaimsSupply(option): Promise<bigint>;

Defined in: solana-client/src/reader.ts:91

Returns the total supply of exercise claims for the given option

Parameters

ParameterTypeDescription
optionMarketOption-

Returns

Promise<bigint>

Implementation of

OvercastReader.exerciseClaimsSupply

getCollateralOffer()

getCollateralOffer(id): Promise<WithId<CollateralOffer> | null>;

Defined in: solana-client/src/reader.ts:139

Look up a single collateral offer by its content-address Id, or null when no such offer exists on-chain.

Parameters

ParameterType
idstring

Returns

Promise<WithId<CollateralOffer> | null>

Implementation of

OvercastReader.getCollateralOffer

getOption()

getOption(collateralOfferId, settlementOfferId): Promise<WithId<MarketOption> | null>;

Defined in: solana-client/src/reader.ts:111

Look up a single market option by the content-address ids of the two offers it was matched from, or null when no such option exists on-chain.

An option's on-chain account is keyed by its (collateralOffer, settlementOffer) id pair (the seeds of its PDA), not by its own content-address hash — so those two ids, rather than the option id, are how it is fetched directly without scanning. The returned option carries its own content-address Id (the one the RFQ flow / storage use) on id.

TODO: we should make this just a single id

Parameters

ParameterType
collateralOfferIdstring
settlementOfferIdstring

Returns

Promise<WithId<MarketOption> | null>

Implementation of

OvercastReader.getOption

getSettlementOffer()

getSettlementOffer(id): Promise<WithId<SettlementOffer> | null>;

Defined in: solana-client/src/reader.ts:157

Look up a single settlement offer by its content-address Id, or null when no such offer exists on-chain.

Parameters

ParameterType
idstring

Returns

Promise<WithId<SettlementOffer> | null>

Implementation of

OvercastReader.getSettlementOffer

redeemClaims()

redeemClaims(option, user): Promise<bigint>;

Defined in: solana-client/src/reader.ts:101

returns the user balance of redeem claims for the given option

Parameters

ParameterTypeDescription
optionMarketOption-
userstring-

Returns

Promise<bigint>

Implementation of

OvercastReader.redeemClaims

redeemClaimsSupply()

redeemClaimsSupply(option): Promise<bigint>;

Defined in: solana-client/src/reader.ts:96

Returns the total supply of redeem claims for the given option

Parameters

ParameterTypeDescription
optionMarketOption-

Returns

Promise<bigint>

Implementation of

OvercastReader.redeemClaimsSupply