@accret/bridge-sdk
Version:
31 lines • 1.47 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getQuote = getQuote;
const utils_1 = require("../../utils");
/**
* @description Fetches a quote for a cross-chain transfer using the @Across Protocol.
* @param params - The parameters for the quote request.
* @param params.originChainId - The ID of the origin chain.
* @param params.destinationChainId - The ID of the destination chain.
* @param params.inputToken - The address of the input token.
* @param params.outputToken - The address of the output token.
* @param params.inputAmount - The amount of the input token to be quoted.
* @param params.recipient - The address of the recipient on the destination chain.
* @param params.inputTokenDecimals - The number of decimals for the input token (optional, defaults to 18).
* @returns A promise that resolves to the quote for the specified parameters.
*/
async function getQuote(params) {
const client = (0, utils_1.initializeAcrossClient)();
const quote = await client.getQuote({
route: {
originChainId: params.originChainId,
destinationChainId: params.destinationChainId,
inputToken: params.inputToken,
outputToken: params.outputToken,
},
inputAmount: (0, utils_1.fromReadableAmount)(params.inputAmount, params.inputTokenDecimals ?? 18),
recipient: params.recipient,
});
return quote;
}
//# sourceMappingURL=getQuote.js.map