UNPKG

@accret/bridge-sdk

Version:
40 lines 1.67 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getJupiterQuote = getJupiterQuote; exports.getJupiterTokenList = getJupiterTokenList; exports.executeJupiterTransaction = executeJupiterTransaction; const getQuote_1 = require("./getQuote"); const getTokenList_1 = require("./getTokenList"); const buildTransaction_1 = require("./buildTransaction"); /** * @description Get a quote for a token swap with Jupiter * @param inputMint {String} The mint address of the input token. * @param outputMint {String} The mint address of the output token. * @param amount {Number} The amount of input tokens to swap. * @returns A promise that resolves to the quote response. */ async function getJupiterQuote(inputMint, outputMint, amount) { const quote = await (0, getQuote_1.getQuote)({ inputMint, outputMint, amount }); return quote; } /** * @description Fetches the token list from the Jupiter aggregator. * @returns A promise that resolves to the token list response. */ async function getJupiterTokenList() { const tokenList = await (0, getTokenList_1.getTokenList)(); return tokenList; } /** * @description Builds a transaction for a token swap on the Jupiter aggregator. * @param param0 {Object: {userPublicKey: String, quoteResponse: QuoteResponse}} The parameters for the transaction. * @returns A promise that resolves to the swap response. */ async function executeJupiterTransaction({ userPublicKey, quoteResponse, }) { const txHash = await (0, buildTransaction_1.executeSwap)({ quote: quoteResponse, privateKey: userPublicKey, }); return txHash; } //# sourceMappingURL=index.js.map