Class: TradingQuotesService
Gala Launchpad SDK 9.0.0-rc.5 / index / TradingQuotesService
Class: TradingQuotesService
Defined in: packages/launchpad-sdk/dist/services/TradingQuotesService.d.ts:50
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
Constructors
Constructor
new TradingQuotesService(
http,debugMode?):TradingQuotesService
Defined in: packages/launchpad-sdk/dist/services/TradingQuotesService.d.ts:57
Creates a TradingQuotesService instance
Parameters
http
HttpClient
Configured HttpClient pointing at the launchpad backend (baseUrl)
debugMode?
boolean
Enable debug logging (default: false)
Returns
TradingQuotesService
Overrides
BaseService.constructor
Other
setJwtAuth()
setJwtAuth(
jwtAuth):void
Defined in: packages/launchpad-sdk/dist/services/BaseService.d.ts:50
Set the JWT authentication manager. Allows dynamic configuration of JWT auth after service creation.
Parameters
jwtAuth
JwtAuth
JWT auth manager instance
Returns
void
Inherited from
BaseService.setJwtAuth
Trading Quotes
fetchLaunchpadFee()
fetchLaunchpadFee():
Promise<number>
Defined in: packages/launchpad-sdk/dist/services/TradingQuotesService.d.ts:75
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`);
fetchSaleDetails()
fetchSaleDetails(
tokenName):Promise<SaleDetailsResult>
Defined in: packages/launchpad-sdk/dist/services/TradingQuotesService.d.ts:95
Fetches sale details (supply, status) for a token via backend proxy (cached 10 seconds).
The backend resolves the vaultAddress internally using the tokenName.
Parameters
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}`);
getPremintQuote()
getPremintQuote(
amount):Promise<AmountCalculationResult>
Defined in: packages/launchpad-sdk/dist/services/TradingQuotesService.d.ts:158
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
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`);
getTradeQuote()
getTradeQuote(
params):Promise<AmountCalculationResult>
Defined in: packages/launchpad-sdk/dist/services/TradingQuotesService.d.ts:137
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
params
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`);