From 79eb2b1bac8a7e903af993ce66f3b17dd53ff475 Mon Sep 17 00:00:00 2001 From: POPPIN-FUMI Date: Mon, 7 Oct 2024 18:23:44 +0200 Subject: [PATCH] add example --- .../sol-swap/src/examples/jupiter/getQuote.ts | 23 +++++++++++-------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/packages/sol-swap/src/examples/jupiter/getQuote.ts b/packages/sol-swap/src/examples/jupiter/getQuote.ts index b5a0d93..a213ae7 100644 --- a/packages/sol-swap/src/examples/jupiter/getQuote.ts +++ b/packages/sol-swap/src/examples/jupiter/getQuote.ts @@ -1,16 +1,19 @@ import getJupiterQuote from '@/lib/jupiter/getJupiterQuote' +import jupiterSwap from '@/lib/jupiter/jupiterSwap' const getQuote = async () => { const inputMint = 'inputMint' const outputMint = 'outputMint' - const inputAmountLamport = 100 - const platformFeeBps = 0 - const swapMode = 'ExactIn' - const quote = await getJupiterQuote( - inputMint, - outputMint, - inputAmountLamport, - platformFeeBps, - swapMode, - ) + const inputAmountLamport = 1000000000 + const quote = await getJupiterQuote(inputMint, outputMint, inputAmountLamport) + if (typeof quote === 'string') { + throw new Error(quote) + } + await jupiterSwap(quote) } + +const run = async () => { + await getQuote() +} + +run()