index/classes/TradingQuotesService.md
Trading Quotes Service Class
Provides methods for:
- Fetching launchpad fee (backend-cached, 1 hour TTL)
- Fetching sale details by tokenName (backend-cached, 10 second TTL)
- Getting trade quotes via local bonding curve math (instant, no chain call)
- Getting pre-mint quotes (supply = 0 assumed, no chain call)
All methods call @Public() backend endpoints — no authentication required.
Since
9.1.0
Examples
Fetch launchpad fee
const fee = await tradingQuotesService.fetchLaunchpadFee();
console.log(`Launchpad fee: ${fee} GALA`);
Get a trade quote
const quote = await tradingQuotesService.getTradeQuote({
tokenName: 'anime',
amount: '100',
type: 'NATIVE',
method: 'IN',
});
console.log(`You will receive: ${quote.amount} tokens`);
Extends
BaseService
base service
Constructors
Constructor
new TradingQuotesService(
http,debugMode?):TradingQuotesService
Creates a TradingQuotesService instance
Parameters
| Parameter | Type | Description |
|---|---|---|
http | HttpClient | Configured HttpClient pointing at the launchpad backend (baseUrl) |
debugMode? | boolean | Enable debug logging (default: false) |
Returns
TradingQuotesService
Overrides
BaseService.constructor
debug mode trading quotes service http client base url
Other
setJwtAuth()
setJwtAuth(
jwtAuth):void
Set the JWT authentication manager. Allows dynamic configuration of JWT auth after service creation.
Parameters
| Parameter | Type | Description |
|---|---|---|
jwtAuth | JwtAuth | JWT auth manager instance |
Returns
void
Inherited from
BaseService.setJwtAuth
set jwt auth base service
Trading Quotes
fetchLaunchpadFee()
fetchLaunchpadFee():
Promise<number>
Fetches the current launchpad fee via the backend proxy (cached 1 hour).
Backs sdk.fetchLaunchTokenFee(); cached by the backend.
Returns
Promise<number>
Promise resolving to the fee amount in GALA (number)
Throws
If the backend returns an error response
Since
9.1.0
Example
const fee = await sdk.fetchLaunchpadFee();
console.log(`Current launchpad fee: ${fee} GALA`);
fetch launchpad fee launch token
fetchSaleDetails()
fetchSaleDetails(
tokenName):Promise<SaleDetailsResult>
Fetches sale details (supply, status) for a token via backend proxy (cached 10 seconds).
The backend resolves the vaultAddress internally using the tokenName.
Parameters
| Parameter | Type | Description |
|---|---|---|
tokenName | string | Token name to fetch sale details for (e.g. 'anime') |
Returns
Promise<SaleDetailsResult>
Promise resolving to sale details including supply, quantities, and status
Throws
If the backend returns an error response
Since
9.1.0
Example
const details = await sdk.fetchSaleDetails('anime');
console.log(`Supply: ${details.sellingTokenQuantity} / ${details.maxSupply}`);
console.log(`Status: ${details.saleStatus}`);
fetch sale details token name result
getPremintQuote()
getPremintQuote(
amount):Promise<AmountCalculationResult>
Calculates a pre-mint token output for a given GALA amount (supply = 0 assumed).
Used during the token creation flow to show buyers what they will receive for their initial GALA investment before the token launches. No chain call required.
Parameters
| Parameter | Type | Description |
|---|---|---|
amount | string | GALA amount to spend (as a decimal string, e.g. '100') |
Returns
Promise<AmountCalculationResult>
Promise resolving to amount calculation result with fees
Throws
If the backend returns an error response
Since
9.1.0
Example
const premintQuote = await sdk.getPremintQuote('500');
console.log(`Initial purchase will yield: ${premintQuote.amount} tokens`);
console.log(`Transaction fee: ${premintQuote.transactionFee} GALA`);
get premint quote amount calculation result
getTradeQuote()
getTradeQuote(
params):Promise<AmountCalculationResult>
Calculates a trade quote via the backend using local bonding curve math.
No chain call is made — the backend computes this instantly using its local
bonding curve calculations. Faster than calculateBuyAmountExternal() or
calculateSellAmountExternal() which hit GalaChain directly.
Parameters
| Parameter | Type | Description |
|---|---|---|
params | TradeQuoteParams | Quote parameters |
Returns
Promise<AmountCalculationResult>
Promise resolving to amount calculation result with fees
Throws
If the backend returns an error response
Since
9.1.0
Examples
Buy: how many tokens for 100 GALA?
const quote = await sdk.getTradeQuote({
tokenName: 'anime',
amount: '100',
type: 'NATIVE',
method: 'IN',
});
console.log(`You will receive: ${quote.amount} tokens`);
console.log(`Fee: ${quote.reverseBondingCurveFee} GALA`);
Sell: how much GALA for 500 tokens?
const quote = await sdk.getTradeQuote({
tokenName: 'anime',
amount: '500',
type: 'MEME',
method: 'IN',
});
console.log(`You will receive: ${quote.amount} GALA`);
get trade quote amount calculation result calculate buy external sell params