@upcoming/multichain-library 0.6.0 → 0.6.1
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/SushiSwap.js +5 -0
- package/package.json +3 -3
package/dist/SushiSwap.js
CHANGED
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getSushiSwapQuote = getSushiSwapQuote;
|
|
4
|
+
const cafe_utility_1 = require("cafe-utility");
|
|
4
5
|
const Constants_1 = require("./Constants");
|
|
5
6
|
async function getSushiSwapQuote(amount, sender, recipient, settings) {
|
|
6
7
|
const tokenIn = '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE'; // xDAI
|
|
7
8
|
const tokenOut = Constants_1.Constants.bzzGnosisAddress;
|
|
8
9
|
const response = await fetch(`https://api.sushi.com/swap/v7/100?tokenIn=${tokenIn}&tokenOut=${tokenOut}&amount=${amount}&maxSlippage=0.005&sender=${sender}&recipient=${recipient}&fee=0.0025&feeBy=output&feeReceiver=0xde7259893af7cdbc9fd806c6ba61d22d581d5667&simulate=true`, { signal: AbortSignal.timeout(settings.fetchTimeoutMillis) });
|
|
9
10
|
const data = await response.json();
|
|
11
|
+
if (response.status >= 400) {
|
|
12
|
+
const reason = data.detail || data.title;
|
|
13
|
+
throw Error(cafe_utility_1.Types.isString(reason) ? reason : `SushiSwap API error: ${response.status}`, { cause: data });
|
|
14
|
+
}
|
|
10
15
|
return data;
|
|
11
16
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@upcoming/multichain-library",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.6.
|
|
4
|
+
"version": "0.6.1",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"exports": {
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
"license": "ISC",
|
|
20
20
|
"description": "",
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"cafe-utility": "^33.
|
|
23
|
-
"viem": "^2.
|
|
22
|
+
"cafe-utility": "^33.4.0",
|
|
23
|
+
"viem": "^2.45.1"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"typescript": "^5.9.3"
|