Fee<ChainIdentifier, TSrc, TDst>
type Fee<ChainIdentifier, TSrc, TDst> = object;
Defined in: atomiq-sdk/src/types/fees/Fee.ts:11
Fee represented in both, source and destination tokens, as well as providing USD valuation helpers and fee composition
Type Parameters
| Type Parameter | Default type |
|---|---|
ChainIdentifier extends string | string |
TSrc extends Token<ChainIdentifier> | Token<ChainIdentifier> |
TDst extends Token<ChainIdentifier> | Token<ChainIdentifier> |
Properties
amountInDstToken
amountInDstToken: TokenAmount<ChainIdentifier, TDst, true>;
Defined in: atomiq-sdk/src/types/fees/Fee.ts:23
Fee value equivalent in destination token
amountInSrcToken
amountInSrcToken: TokenAmount<ChainIdentifier, TSrc, true>;
Defined in: atomiq-sdk/src/types/fees/Fee.ts:19
Fee value equivalent in source token
composition?
optional composition: object;
Defined in: atomiq-sdk/src/types/fees/Fee.ts:51
Returns the composition of the fee (base fee + percentage fee) if known, the total fee is calculated as: base_fee + amount * percentage_fee
base
base: TokenAmount<ChainIdentifier>;
percentage
percentage: PercentagePPM;
currentUsdValue()
currentUsdValue: (abortSignal?, preFetchedUsdPrice?) => Promise<number>;
Defined in: atomiq-sdk/src/types/fees/Fee.ts:31
Fetches the current USD value of the fee
Parameters
| Parameter | Type | Description |
|---|---|---|
abortSignal? | AbortSignal | |
preFetchedUsdPrice? | number | You can supply a pre-fetched usd price to the pricing function |
Returns
Promise<number>
A promise resolving to the current USD value of the token amount
pastUsdValue?
optional pastUsdValue: number;
Defined in: atomiq-sdk/src/types/fees/Fee.ts:46
USD value of the fee when swap was created - only present for newer swaps where the USD value at create time is known. Left for convenience only, use usdValue() instead, which automatically recognizes which pricing to use (either past value if available or fetches it on-demand)
usdValue()
usdValue: (abortSignal?, preFetchedUsdPrice?) => Promise<number>;
Defined in: atomiq-sdk/src/types/fees/Fee.ts:40
Gets USD value of the fee, if the USD value when the swap was created is known (newer swaps) it returns this value, otherwise fetches the usd value on-demand
Parameters
| Parameter | Type | Description |
|---|---|---|
abortSignal? | AbortSignal | |
preFetchedUsdPrice? | number | You can supply a pre-fetched usd price to the pricing function |
Returns
Promise<number>
A promise resolving to the current USD value of the fee