@riftresearch/sdk 0.6.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -202,6 +202,12 @@ class RiftSdk {
202
202
  throw new SwapRouterApiError(message, status, value);
203
203
  }
204
204
  async getQuote(params) {
205
+ if (!Number.isFinite(params.slippageBps) || !Number.isInteger(params.slippageBps)) {
206
+ throw new Error("slippageBps must be an integer number of basis points");
207
+ }
208
+ if (params.slippageBps < 0 || params.slippageBps > 1e4) {
209
+ throw new Error("slippageBps must be between 0 and 10000");
210
+ }
205
211
  const route = detectRoute(params.from, params.to);
206
212
  const isMonochain = route.type === "dex_monochain";
207
213
  const quoteRequest = {
@@ -209,6 +215,7 @@ class RiftSdk {
209
215
  from: params.from,
210
216
  to: params.to,
211
217
  amount: params.amount,
218
+ slippageBps: params.slippageBps,
212
219
  quoteQuality: params.quoteQuality
213
220
  };
214
221
  const riftQuote = this.unwrapEdenResult(await this.riftClient.quote.post(quoteRequest));
@@ -234,7 +241,7 @@ class RiftSdk {
234
241
  this.logDebug("resolved refund address", { refundAddress });
235
242
  if (this.preflightCheckBalances) {
236
243
  this.logDebug("running preflight balance check");
237
- await this.assertSufficientBalance(params.from, quote.from.amount, context);
244
+ await this.assertSufficientBalance(params.from, quote.from.expected, context);
238
245
  }
239
246
  this.logDebug("creating swap", { quoteId: riftQuote.id });
240
247
  const swapResponse = this.unwrapEdenResult(await this.riftClient.swap.post({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riftresearch/sdk",
3
- "version": "0.6.0",
3
+ "version": "0.7.0",
4
4
  "description": "SDK for swapping between bitcoin and evm chains",
5
5
  "license": "MIT",
6
6
  "files": [