Skip to content

Commit

Permalink
Merge pull request #335 from EpicsDAO/swap
Browse files Browse the repository at this point in the history
add dynamicComputeUnitLimit/prioritizationFeeLamports/dynamicSlippage
  • Loading branch information
POPPIN-FUMI authored Nov 6, 2024
2 parents ca440ee + 6438adc commit 6cb926c
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .changeset/smart-toes-reply.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
'@epics-dao/solv': patch
---

update solv swap

Added new default options to the `solv swap` command.

The new options are as follows:

```
dynamicComputeUnitLimit: true,
prioritizationFeeLamports: 'auto'
dynamicSlippage: { 'maxBps': 300 }
```

Jupiter Swap API v6
https://station.jup.ag/docs/apis/swap-api#setting-priority-fee-for-your-transaction
1 change: 1 addition & 0 deletions packages/solv/src/cli/swap/getJupiterQuote.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const getJupiterQuote = async (
method: 'GET',
headers: {
'Content-Type': 'application/json',
'x-api-key': apiKey,
Authorization: `Bearer ${apiKey}`,
},
})
Expand Down
7 changes: 7 additions & 0 deletions packages/solv/src/cli/swap/postJupiterSwap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,19 @@ const postJupiterSwap = async (
quoteResponse,
userPublicKey: fromWalletPubkey,
feeAccount: associationAccount,
dynamicComputeUnitLimit: true,
prioritizationFeeLamports: 'auto',
dynamicSlippage: { maxBps: 300 },
},
}
} else {
swapBody = {
swapRequest: {
quoteResponse,
userPublicKey: fromWalletPubkey,
dynamicComputeUnitLimit: true,
prioritizationFeeLamports: 'auto',
dynamicSlippage: { maxBps: 300 },
},
}
}
Expand All @@ -34,6 +40,7 @@ const postJupiterSwap = async (
method: 'POST',
headers: {
'Content-Type': 'application/json',
'x-api-key': jupiterApiKey,
Authorization: `Bearer ${jupiterApiKey}`,
},
body: JSON.stringify(swapBody.swapRequest),
Expand Down

0 comments on commit 6cb926c

Please sign in to comment.