Skip to content

Commit 4986a10

Browse files
committed
Fix swap action demo page
1 parent 34e542b commit 4986a10

File tree

1 file changed

+22
-8
lines changed

1 file changed

+22
-8
lines changed

demo/pages/sdk/actions/swap.tsx

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -201,20 +201,17 @@ const SwapActionPage: NextPage = () => {
201201
throw 'Missing JSON payload'
202202
}
203203

204-
quoteParams.chainId = quoteParams.originChainId
205-
quoteParams.toChainId = quoteParams.destinationChainId
206-
quoteParams.currency = quoteParams.originCurrency
207-
quoteParams.toCurrency = quoteParams.destinationCurrency
204+
console.log(quoteParams, 'PARAMS')
208205

209-
if (!quoteParams.chainId) {
206+
if (!quoteParams.originChainId) {
210207
setError('Missing chainId')
211208
throw 'Missing chainId'
212209
}
213210

214211
let executionWallet
215212

216213
if (
217-
quoteParams.chainId === 792703809 &&
214+
quoteParams.originChainId === 792703809 &&
218215
isSolanaWallet(primaryWallet)
219216
) {
220217
const connection = await primaryWallet.getConnection()
@@ -259,7 +256,7 @@ const SwapActionPage: NextPage = () => {
259256

260257
executionWallet = adaptSuiWallet(
261258
primaryWallet?.address,
262-
quoteParams.chainId,
259+
quoteParams.originChainId,
263260
walletClient,
264261
async (tx) => {
265262
const signedTransaction =
@@ -279,12 +276,29 @@ const SwapActionPage: NextPage = () => {
279276
throw 'Unable to configure wallet'
280277
}
281278

279+
const {
280+
destinationCurrency,
281+
destinationChainId,
282+
originCurrency,
283+
originChainId,
284+
amount,
285+
tradeType,
286+
referrer,
287+
...options
288+
} = quoteParams
289+
282290
const quote = await client?.actions.getQuote(
283291
{
284292
wallet: executionWallet,
285293
user: primaryWallet.address,
286294
recipient: primaryWallet.address,
287-
...quoteParams
295+
toCurrency: destinationCurrency,
296+
toChainId: destinationChainId,
297+
currency: originCurrency,
298+
chainId: originChainId,
299+
amount,
300+
tradeType,
301+
options
288302
},
289303
true
290304
)

0 commit comments

Comments
 (0)