Skip to main content

Class: ChromaticLens

A class representing Chromatic Lens, which provides access to liquidity-related functions.

Constructors

constructor

new ChromaticLens(_client)

Creates a new instance of ChromaticLens.

Parameters

NameTypeDescription
_clientClientThe Chromatic Client instance.

Defined in

packages/sdk-viem/src/entities/ChromaticLens.ts:100

Methods

claimableLiquidities

claimableLiquidities(marketAddress, params): Promise<{ [tradingFeeRate: string | number]: { [oracleVersion: string | number]: ClaimableLiquidityResult; }; }>

Retrieves the claimable liquidities for a given market and parameters.

Parameters

NameTypeDescription
marketAddress`0x${string}`The address of the Chromatic Market contract.
params{ oracleVersion: bigint ; tradingFeeRate: number }[]An array of objects containing tradingFeeRate and oracleVersion.

Returns

Promise<{ [tradingFeeRate: string | number]: { [oracleVersion: string | number]: ClaimableLiquidityResult; }; }>

A promise that resolves to an object with mappings between tradingFee and oracleVersion.

Defined in

packages/sdk-viem/src/entities/ChromaticLens.ts:287


contracts

contracts(): Object

Retrieves the ChromaticLens contract.

Returns

Object

The ChromaticLens contract.

NameType
lensContractChromaticLens

Defined in

packages/sdk-viem/src/entities/ChromaticLens.ts:118


findFromCLBTotalSupplies

findFromCLBTotalSupplies(clbTokenSupplies): (tokenId: bigint) => bigint

Parameters

NameType
clbTokenSuppliesRecord<string, Partial<ClbTokenTotalSupply>[]>

Returns

fn

▸ (tokenId): bigint

Parameters
NameType
tokenIdbigint
Returns

bigint

Defined in

packages/sdk-viem/src/entities/ChromaticLens.ts:123


getCLBTokenTotalSupplies

getCLBTokenTotalSupplies(clbTokenAddress): Promise<Record<string, ClbTokenTotalSupply[]>>

Parameters

NameType
clbTokenAddressstring

Returns

Promise<Record<string, ClbTokenTotalSupply[]>>

Defined in

packages/sdk-viem/src/entities/ChromaticLens.ts:171


liquidityBins

liquidityBins(marketAddress): Promise<{ clbTokenTotalSupply: bigint = clbTotalSupply; clbValue: bigint ; freeLiquidity: bigint ; liquidity: bigint ; tradingFeeRate: number = binStatus.tradingFeeRate }[]>

Retrieves the liquidity bins for a given market.

Parameters

NameTypeDescription
marketAddress`0x${string}`The address of the Chromatic Market contract.

Returns

Promise<{ clbTokenTotalSupply: bigint = clbTotalSupply; clbValue: bigint ; freeLiquidity: bigint ; liquidity: bigint ; tradingFeeRate: number = binStatus.tradingFeeRate }[]>

A promise that resolves to an array of LiquidityBinResult.

Defined in

packages/sdk-viem/src/entities/ChromaticLens.ts:139


lpReceipts

lpReceipts(marketAddress, owner?): Promise<readonly { action: number ; amount: bigint ; id: bigint ; oracleVersion: bigint ; recipient: `0x${string}` ; tradingFeeRate: number }[]>

Retrieves the LP receipts for a given market and owner.

Parameters

NameTypeDescription
marketAddress`0x${string}`The address of the Chromatic Market contract.
owner?`0x${string}`The address of the LP owner.

Returns

Promise<readonly { action: number ; amount: bigint ; id: bigint ; oracleVersion: bigint ; recipient: `0x${string}` ; tradingFeeRate: number }[]>

A promise that resolves to the LP receipts.

Defined in

packages/sdk-viem/src/entities/ChromaticLens.ts:363


ownedLiquidityBins

ownedLiquidityBins(marketAddress, ownerAddress?): Promise<{ binValue: bigint ; clbBalance: bigint = ownedLiquidity.balance; clbTotalSupply: bigint ; clbValue: bigint ; freeLiquidity: bigint ; liquidity: bigint ; tradingFeeRate: number = tradingFeeRate }[]>

Retrieves the owned liquidity bins for a given market and owner.

Parameters

NameTypeDescription
marketAddress`0x${string}`The address of the Chromatic Market contract.
ownerAddress?`0x${string}`The address of the liquidity owner.

Returns

Promise<{ binValue: bigint ; clbBalance: bigint = ownedLiquidity.balance; clbTotalSupply: bigint ; clbValue: bigint ; freeLiquidity: bigint ; liquidity: bigint ; tradingFeeRate: number = tradingFeeRate }[]>

A promise that resolves to an array of OwnedLiquidityBinResult.

Defined in

packages/sdk-viem/src/entities/ChromaticLens.ts:231


pendingLiquidityBatch

pendingLiquidityBatch(marketAddress, tradingFeeRates): Promise<PendingLiquidityResult[]>

Retrieves the pending liquidities for a given market and trading fee rates.

Parameters

NameTypeDescription
marketAddress`0x${string}`The address of the Chromatic Market contract.
tradingFeeRatesnumber[]An array of tradingFeeRate.

Returns

Promise<PendingLiquidityResult[]>

A promise that resolves to an array of PendingLiquidity.

Defined in

packages/sdk-viem/src/entities/ChromaticLens.ts:339