@strkfarm/sdk 1.1.48 → 1.1.49
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.browser.global.js +13 -4
- package/dist/index.browser.mjs +13 -4
- package/dist/index.d.ts +1 -1
- package/dist/index.js +13 -4
- package/dist/index.mjs +13 -4
- package/package.json +1 -1
- package/src/modules/ekubo-quoter.ts +13 -4
|
@@ -53816,12 +53816,21 @@ ${JSON.stringify(data, null, 2)}`;
|
|
|
53816
53816
|
* @param amount Can be negative too, which would mean to get exact amount out
|
|
53817
53817
|
* @returns
|
|
53818
53818
|
*/
|
|
53819
|
-
async getQuote(fromToken, toToken, amount) {
|
|
53819
|
+
async getQuote(fromToken, toToken, amount, retry = 0) {
|
|
53820
53820
|
let _fromToken = amount.gt(0) ? fromToken : toToken;
|
|
53821
53821
|
let _toToken = amount.gt(0) ? toToken : fromToken;
|
|
53822
|
-
|
|
53823
|
-
|
|
53824
|
-
|
|
53822
|
+
try {
|
|
53823
|
+
const quote = await axios_default.get(this.ENDPOINT.replace("{{AMOUNT}}", amount.toWei()).replace("{{TOKEN_FROM_ADDRESS}}", _fromToken).replace("{{TOKEN_TO_ADDRESS}}", _toToken));
|
|
53824
|
+
console.log(`Ekubo quote from ${_fromToken} to ${_toToken} for ${amount.toString()}: ${JSON.stringify(quote.data)}`);
|
|
53825
|
+
return quote.data;
|
|
53826
|
+
} catch (error2) {
|
|
53827
|
+
console.error(error2.message, "dassf", error2.data);
|
|
53828
|
+
if (retry < 10) {
|
|
53829
|
+
await new Promise((resolve) => setTimeout(resolve, (retry + 1) * 5e3));
|
|
53830
|
+
return await this.getQuote(fromToken, toToken, amount, retry + 1);
|
|
53831
|
+
}
|
|
53832
|
+
throw error2;
|
|
53833
|
+
}
|
|
53825
53834
|
}
|
|
53826
53835
|
/**
|
|
53827
53836
|
* Formats Ekubo response for Vesu multiple use
|
package/dist/index.browser.mjs
CHANGED
|
@@ -2208,12 +2208,21 @@ var EkuboQuoter = class {
|
|
|
2208
2208
|
* @param amount Can be negative too, which would mean to get exact amount out
|
|
2209
2209
|
* @returns
|
|
2210
2210
|
*/
|
|
2211
|
-
async getQuote(fromToken, toToken, amount) {
|
|
2211
|
+
async getQuote(fromToken, toToken, amount, retry = 0) {
|
|
2212
2212
|
let _fromToken = amount.gt(0) ? fromToken : toToken;
|
|
2213
2213
|
let _toToken = amount.gt(0) ? toToken : fromToken;
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2214
|
+
try {
|
|
2215
|
+
const quote = await axios5.get(this.ENDPOINT.replace("{{AMOUNT}}", amount.toWei()).replace("{{TOKEN_FROM_ADDRESS}}", _fromToken).replace("{{TOKEN_TO_ADDRESS}}", _toToken));
|
|
2216
|
+
console.log(`Ekubo quote from ${_fromToken} to ${_toToken} for ${amount.toString()}: ${JSON.stringify(quote.data)}`);
|
|
2217
|
+
return quote.data;
|
|
2218
|
+
} catch (error) {
|
|
2219
|
+
console.error(error.message, "dassf", error.data);
|
|
2220
|
+
if (retry < 10) {
|
|
2221
|
+
await new Promise((resolve) => setTimeout(resolve, (retry + 1) * 5e3));
|
|
2222
|
+
return await this.getQuote(fromToken, toToken, amount, retry + 1);
|
|
2223
|
+
}
|
|
2224
|
+
throw error;
|
|
2225
|
+
}
|
|
2217
2226
|
}
|
|
2218
2227
|
/**
|
|
2219
2228
|
* Formats Ekubo response for Vesu multiple use
|
package/dist/index.d.ts
CHANGED
|
@@ -1544,7 +1544,7 @@ declare class EkuboQuoter {
|
|
|
1544
1544
|
* @param amount Can be negative too, which would mean to get exact amount out
|
|
1545
1545
|
* @returns
|
|
1546
1546
|
*/
|
|
1547
|
-
getQuote(fromToken: string, toToken: string, amount: Web3Number): Promise<EkuboQuote>;
|
|
1547
|
+
getQuote(fromToken: string, toToken: string, amount: Web3Number, retry?: number): Promise<EkuboQuote>;
|
|
1548
1548
|
/**
|
|
1549
1549
|
* Formats Ekubo response for Vesu multiple use
|
|
1550
1550
|
* @param quote
|
package/dist/index.js
CHANGED
|
@@ -2363,12 +2363,21 @@ var EkuboQuoter = class {
|
|
|
2363
2363
|
* @param amount Can be negative too, which would mean to get exact amount out
|
|
2364
2364
|
* @returns
|
|
2365
2365
|
*/
|
|
2366
|
-
async getQuote(fromToken, toToken, amount) {
|
|
2366
|
+
async getQuote(fromToken, toToken, amount, retry = 0) {
|
|
2367
2367
|
let _fromToken = amount.gt(0) ? fromToken : toToken;
|
|
2368
2368
|
let _toToken = amount.gt(0) ? toToken : fromToken;
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2369
|
+
try {
|
|
2370
|
+
const quote = await import_axios5.default.get(this.ENDPOINT.replace("{{AMOUNT}}", amount.toWei()).replace("{{TOKEN_FROM_ADDRESS}}", _fromToken).replace("{{TOKEN_TO_ADDRESS}}", _toToken));
|
|
2371
|
+
console.log(`Ekubo quote from ${_fromToken} to ${_toToken} for ${amount.toString()}: ${JSON.stringify(quote.data)}`);
|
|
2372
|
+
return quote.data;
|
|
2373
|
+
} catch (error) {
|
|
2374
|
+
console.error(error.message, "dassf", error.data);
|
|
2375
|
+
if (retry < 10) {
|
|
2376
|
+
await new Promise((resolve) => setTimeout(resolve, (retry + 1) * 5e3));
|
|
2377
|
+
return await this.getQuote(fromToken, toToken, amount, retry + 1);
|
|
2378
|
+
}
|
|
2379
|
+
throw error;
|
|
2380
|
+
}
|
|
2372
2381
|
}
|
|
2373
2382
|
/**
|
|
2374
2383
|
* Formats Ekubo response for Vesu multiple use
|
package/dist/index.mjs
CHANGED
|
@@ -2257,12 +2257,21 @@ var EkuboQuoter = class {
|
|
|
2257
2257
|
* @param amount Can be negative too, which would mean to get exact amount out
|
|
2258
2258
|
* @returns
|
|
2259
2259
|
*/
|
|
2260
|
-
async getQuote(fromToken, toToken, amount) {
|
|
2260
|
+
async getQuote(fromToken, toToken, amount, retry = 0) {
|
|
2261
2261
|
let _fromToken = amount.gt(0) ? fromToken : toToken;
|
|
2262
2262
|
let _toToken = amount.gt(0) ? toToken : fromToken;
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2263
|
+
try {
|
|
2264
|
+
const quote = await axios5.get(this.ENDPOINT.replace("{{AMOUNT}}", amount.toWei()).replace("{{TOKEN_FROM_ADDRESS}}", _fromToken).replace("{{TOKEN_TO_ADDRESS}}", _toToken));
|
|
2265
|
+
console.log(`Ekubo quote from ${_fromToken} to ${_toToken} for ${amount.toString()}: ${JSON.stringify(quote.data)}`);
|
|
2266
|
+
return quote.data;
|
|
2267
|
+
} catch (error) {
|
|
2268
|
+
console.error(error.message, "dassf", error.data);
|
|
2269
|
+
if (retry < 10) {
|
|
2270
|
+
await new Promise((resolve) => setTimeout(resolve, (retry + 1) * 5e3));
|
|
2271
|
+
return await this.getQuote(fromToken, toToken, amount, retry + 1);
|
|
2272
|
+
}
|
|
2273
|
+
throw error;
|
|
2274
|
+
}
|
|
2266
2275
|
}
|
|
2267
2276
|
/**
|
|
2268
2277
|
* Formats Ekubo response for Vesu multiple use
|
package/package.json
CHANGED
|
@@ -39,13 +39,22 @@ export class EkuboQuoter {
|
|
|
39
39
|
* @param amount Can be negative too, which would mean to get exact amount out
|
|
40
40
|
* @returns
|
|
41
41
|
*/
|
|
42
|
-
async getQuote(fromToken: string, toToken: string, amount: Web3Number): Promise<EkuboQuote> {
|
|
42
|
+
async getQuote(fromToken: string, toToken: string, amount: Web3Number, retry = 0): Promise<EkuboQuote> {
|
|
43
43
|
let _fromToken = amount.gt(0) ? fromToken : toToken;
|
|
44
44
|
let _toToken = amount.gt(0) ? toToken : fromToken;
|
|
45
45
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
try {
|
|
47
|
+
const quote = await axios.get(this.ENDPOINT.replace("{{AMOUNT}}", amount.toWei()).replace("{{TOKEN_FROM_ADDRESS}}", _fromToken).replace("{{TOKEN_TO_ADDRESS}}", _toToken));
|
|
48
|
+
console.log(`Ekubo quote from ${_fromToken} to ${_toToken} for ${amount.toString()}: ${JSON.stringify(quote.data)}`);
|
|
49
|
+
return quote.data as EkuboQuote;
|
|
50
|
+
} catch (error: any) {
|
|
51
|
+
console.error(error.message, 'dassf', error.data);
|
|
52
|
+
if (retry < 10) {
|
|
53
|
+
await new Promise((resolve) => setTimeout(resolve, (retry + 1) * 5000));
|
|
54
|
+
return await this.getQuote(fromToken, toToken, amount, retry + 1);
|
|
55
|
+
}
|
|
56
|
+
throw error;
|
|
57
|
+
}
|
|
49
58
|
}
|
|
50
59
|
|
|
51
60
|
/**
|