CustomPriceProvider<T>
Defined in: atomiq-sdk/src/prices/providers/CustomPriceProvider.ts:10
Price provider using custom pricing function
Extends
IPriceProvider<T>
Type Parameters
| Type Parameter |
|---|
T extends MultiChain |
Constructors
Constructor
new CustomPriceProvider<T>(coinsMap, getUsdPriceFn): CustomPriceProvider<T>;
Defined in: atomiq-sdk/src/prices/providers/CustomPriceProvider.ts:18
Parameters
| Parameter | Type | Description |
|---|---|---|
coinsMap | CtorCoinTypes<T> | Mapping of token tickers to token addresses |
getUsdPriceFn | CustomPriceFunction | Pricing function, used to retrieve USD prices of the tokens |
Returns
CustomPriceProvider<T>
Overrides
IPriceProvider<T>.constructor
Properties
coinsMap
coinsMap: CoinTypes<T> = {};
Defined in: atomiq-sdk/src/prices/abstract/IPriceProvider.ts:42
Inherited from
IPriceProvider.coinsMap
getUsdPriceFn
readonly getUsdPriceFn: CustomPriceFunction;
Defined in: atomiq-sdk/src/prices/providers/CustomPriceProvider.ts:12
Methods
getPrice()
getPrice<C>(
chainIdentifier,
token,
abortSignal?): Promise<bigint>;
Defined in: atomiq-sdk/src/prices/abstract/IPriceProvider.ts:84
Returns coin price in uSat (microSat)
Type Parameters
| Type Parameter |
|---|
C extends string |
Parameters
| Parameter | Type | Description |
|---|---|---|
chainIdentifier | C | |
token | string | |
abortSignal? | AbortSignal |
Returns
Promise<bigint>
Throws
if token is not found
Inherited from
IPriceProvider.getPrice
getUsdPrice()
getUsdPrice(abortSignal?): Promise<number>;
Defined in: atomiq-sdk/src/prices/abstract/IPriceProvider.ts:106
Returns coin price in uSat (microSat)
Parameters
| Parameter | Type | Description |
|---|---|---|
abortSignal? | AbortSignal |
Returns
Promise<number>
Throws
if token is not found
Inherited from
IPriceProvider.getUsdPrice
fetchPrice()
protected fetchPrice(token, abortSignal?): Promise<bigint>;
Defined in: atomiq-sdk/src/prices/providers/CustomPriceProvider.ts:26
Parameters
| Parameter | Type |
|---|---|
token | CoinType |
abortSignal? | AbortSignal |
Returns
Promise<bigint>
Inherit Doc
Overrides
IPriceProvider.fetchPrice
fetchUsdPrice()
protected fetchUsdPrice(abortSignal?): Promise<number>;
Defined in: atomiq-sdk/src/prices/providers/CustomPriceProvider.ts:35
Parameters
| Parameter | Type |
|---|---|
abortSignal? | AbortSignal |
Returns
Promise<number>
Inherit Doc
Overrides
IPriceProvider.fetchUsdPrice
getDecimals()
protected getDecimals<C>(chainIdentifier, token): number;
Defined in: atomiq-sdk/src/prices/abstract/IPriceProvider.ts:119
Returns the decimal places of the specified token, or -1 if token should be ignored, returns null if token is not found
Type Parameters
| Type Parameter |
|---|
C extends string |
Parameters
| Parameter | Type | Description |
|---|---|---|
chainIdentifier | C | |
token | string |
Returns
number
Throws
If token is not found
Inherited from
IPriceProvider.getDecimals