@strkfarm/sdk 2.0.0-dev.10 → 2.0.0-dev.12
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 +29 -9
- package/dist/index.browser.mjs +29 -9
- package/dist/index.d.ts +5 -3
- package/dist/index.js +29 -9
- package/dist/index.mjs +29 -9
- package/package.json +1 -1
- package/src/modules/ExtendedWrapperSDk/types.ts +1 -1
- package/src/modules/ExtendedWrapperSDk/wrapper.ts +32 -5
- package/src/strategies/universal-adapters/extended-adapter.ts +2 -2
- package/src/strategies/vesu-extended-strategy/vesu-extended-strategy.tsx +10 -7
|
@@ -56248,7 +56248,22 @@ ${JSON.stringify(data, null, 2)}`;
|
|
|
56248
56248
|
`HTTP ${response.status}: ${errorData.detail || response.statusText}`
|
|
56249
56249
|
);
|
|
56250
56250
|
}
|
|
56251
|
-
const
|
|
56251
|
+
const text = await response.text();
|
|
56252
|
+
const MAX_SAFE_INTEGER_STR = "9007199254740991";
|
|
56253
|
+
const largeIntegerRegex = /"data"\s*:\s*(\d{16,})/g;
|
|
56254
|
+
const modifiedText = text.replace(largeIntegerRegex, (match, largeInt) => {
|
|
56255
|
+
if (largeInt.length > MAX_SAFE_INTEGER_STR.length || largeInt.length === MAX_SAFE_INTEGER_STR.length && largeInt > MAX_SAFE_INTEGER_STR) {
|
|
56256
|
+
return `"data":"${largeInt}"`;
|
|
56257
|
+
}
|
|
56258
|
+
return match;
|
|
56259
|
+
});
|
|
56260
|
+
const data = JSON.parse(modifiedText);
|
|
56261
|
+
if (data && typeof data.data === "string" && /^\d+$/.test(data.data)) {
|
|
56262
|
+
const numValue = Number(data.data);
|
|
56263
|
+
if (Number.isSafeInteger(numValue)) {
|
|
56264
|
+
data.data = numValue;
|
|
56265
|
+
}
|
|
56266
|
+
}
|
|
56252
56267
|
return data;
|
|
56253
56268
|
} catch (error2) {
|
|
56254
56269
|
lastError = error2;
|
|
@@ -56308,6 +56323,7 @@ ${JSON.stringify(data, null, 2)}`;
|
|
|
56308
56323
|
}
|
|
56309
56324
|
/**
|
|
56310
56325
|
* Initiate a withdrawal from Extended Exchange
|
|
56326
|
+
* Returns data as number | string to preserve precision for large integers
|
|
56311
56327
|
*/
|
|
56312
56328
|
async withdraw(request) {
|
|
56313
56329
|
return this.makeRequest("/api/v1/withdraw", {
|
|
@@ -56446,6 +56462,7 @@ ${JSON.stringify(data, null, 2)}`;
|
|
|
56446
56462
|
}
|
|
56447
56463
|
/**
|
|
56448
56464
|
* Withdraw USDC (convenience method)
|
|
56465
|
+
* Returns data as number | string to preserve precision for large integers
|
|
56449
56466
|
*/
|
|
56450
56467
|
async withdrawUSDC(amount) {
|
|
56451
56468
|
return this.withdraw({ amount, asset: "USDC" });
|
|
@@ -94325,7 +94342,7 @@ spurious results.`);
|
|
|
94325
94342
|
});
|
|
94326
94343
|
if (operationsType === "DEPOSIT" /* DEPOSIT */) {
|
|
94327
94344
|
const myTransferStatus = transferHistory.data.find(
|
|
94328
|
-
(operation) => operation.transactionHash === orderId
|
|
94345
|
+
(operation) => operation.transactionHash?.toLowerCase() === orderId.toString().toLowerCase()
|
|
94329
94346
|
);
|
|
94330
94347
|
if (!myTransferStatus) {
|
|
94331
94348
|
if (attempt < maxAttempts) {
|
|
@@ -94360,7 +94377,7 @@ spurious results.`);
|
|
|
94360
94377
|
}
|
|
94361
94378
|
} else {
|
|
94362
94379
|
const myTransferStatus = transferHistory.data.find(
|
|
94363
|
-
(operation) => operation.id
|
|
94380
|
+
(operation) => operation.id === orderId.toString()
|
|
94364
94381
|
);
|
|
94365
94382
|
if (!myTransferStatus) {
|
|
94366
94383
|
if (attempt < maxAttempts) {
|
|
@@ -98850,7 +98867,7 @@ spurious results.`);
|
|
|
98850
98867
|
};
|
|
98851
98868
|
}
|
|
98852
98869
|
const vesuAmountInBTC = new Web3Number(
|
|
98853
|
-
params.amount.dividedBy(collateralPrice.price).
|
|
98870
|
+
params.amount.dividedBy(collateralPrice.price).toFixed(WBTC_TOKEN_DECIMALS),
|
|
98854
98871
|
collateralToken.decimals
|
|
98855
98872
|
);
|
|
98856
98873
|
const proofsInfo = vesuAdapter.getProofs(false, this.getMerkleTree());
|
|
@@ -99045,7 +99062,10 @@ spurious results.`);
|
|
|
99045
99062
|
logger2.error(`error getting btc price avnu: ${btcPriceAvnu}`);
|
|
99046
99063
|
return false;
|
|
99047
99064
|
}
|
|
99065
|
+
logger2.info(`price: ${price}`);
|
|
99066
|
+
logger2.info(`btcPriceAvnu: ${btcPriceAvnu}`);
|
|
99048
99067
|
const priceDifference = new Web3Number(price.minus(btcPriceAvnu).toFixed(2), 0);
|
|
99068
|
+
logger2.info(`priceDifference: ${priceDifference}`);
|
|
99049
99069
|
if (priceDifference.isNegative()) {
|
|
99050
99070
|
return false;
|
|
99051
99071
|
}
|
|
@@ -99373,11 +99393,11 @@ spurious results.`);
|
|
|
99373
99393
|
] });
|
|
99374
99394
|
}
|
|
99375
99395
|
var re7UsdcPrimeDevansh = {
|
|
99376
|
-
vaultAddress: ContractAddr.from("
|
|
99377
|
-
manager: ContractAddr.from("
|
|
99378
|
-
vaultAllocator: ContractAddr.from("
|
|
99379
|
-
redeemRequestNFT: ContractAddr.from("
|
|
99380
|
-
aumOracle: ContractAddr.from("
|
|
99396
|
+
vaultAddress: ContractAddr.from("0x7efaff77601813ca674c1ffe0479fc0361c0f5099f64a67d4793b80382750c2"),
|
|
99397
|
+
manager: ContractAddr.from("0x2579342f53fbf2f775b0c71d24f162aaf1d3e466edea09a6c51e77a95bd986d"),
|
|
99398
|
+
vaultAllocator: ContractAddr.from("0x46ee6073484a669631e8f88b9f357b0b073cee1bc47752fc32453dd6c1efd7b"),
|
|
99399
|
+
redeemRequestNFT: ContractAddr.from("0x1d66120b0a76068454ea36276d9f404b0a980083dcaebbf6d9f4ad154a79dbe"),
|
|
99400
|
+
aumOracle: ContractAddr.from("0x419a5e8b5a1fe5b2586e64409d5cfdb1712791aaa9361264730227563d4e140"),
|
|
99381
99401
|
leafAdapters: [],
|
|
99382
99402
|
adapters: [],
|
|
99383
99403
|
targetHealthFactor: 1.4,
|
package/dist/index.browser.mjs
CHANGED
|
@@ -4520,7 +4520,22 @@ var ExtendedWrapper = class {
|
|
|
4520
4520
|
`HTTP ${response.status}: ${errorData.detail || response.statusText}`
|
|
4521
4521
|
);
|
|
4522
4522
|
}
|
|
4523
|
-
const
|
|
4523
|
+
const text = await response.text();
|
|
4524
|
+
const MAX_SAFE_INTEGER_STR = "9007199254740991";
|
|
4525
|
+
const largeIntegerRegex = /"data"\s*:\s*(\d{16,})/g;
|
|
4526
|
+
const modifiedText = text.replace(largeIntegerRegex, (match, largeInt) => {
|
|
4527
|
+
if (largeInt.length > MAX_SAFE_INTEGER_STR.length || largeInt.length === MAX_SAFE_INTEGER_STR.length && largeInt > MAX_SAFE_INTEGER_STR) {
|
|
4528
|
+
return `"data":"${largeInt}"`;
|
|
4529
|
+
}
|
|
4530
|
+
return match;
|
|
4531
|
+
});
|
|
4532
|
+
const data = JSON.parse(modifiedText);
|
|
4533
|
+
if (data && typeof data.data === "string" && /^\d+$/.test(data.data)) {
|
|
4534
|
+
const numValue = Number(data.data);
|
|
4535
|
+
if (Number.isSafeInteger(numValue)) {
|
|
4536
|
+
data.data = numValue;
|
|
4537
|
+
}
|
|
4538
|
+
}
|
|
4524
4539
|
return data;
|
|
4525
4540
|
} catch (error) {
|
|
4526
4541
|
lastError = error;
|
|
@@ -4580,6 +4595,7 @@ var ExtendedWrapper = class {
|
|
|
4580
4595
|
}
|
|
4581
4596
|
/**
|
|
4582
4597
|
* Initiate a withdrawal from Extended Exchange
|
|
4598
|
+
* Returns data as number | string to preserve precision for large integers
|
|
4583
4599
|
*/
|
|
4584
4600
|
async withdraw(request) {
|
|
4585
4601
|
return this.makeRequest("/api/v1/withdraw", {
|
|
@@ -4718,6 +4734,7 @@ var ExtendedWrapper = class {
|
|
|
4718
4734
|
}
|
|
4719
4735
|
/**
|
|
4720
4736
|
* Withdraw USDC (convenience method)
|
|
4737
|
+
* Returns data as number | string to preserve precision for large integers
|
|
4721
4738
|
*/
|
|
4722
4739
|
async withdrawUSDC(amount) {
|
|
4723
4740
|
return this.withdraw({ amount, asset: "USDC" });
|
|
@@ -30297,7 +30314,7 @@ var ExtendedAdapter = class _ExtendedAdapter extends BaseAdapter {
|
|
|
30297
30314
|
});
|
|
30298
30315
|
if (operationsType === "DEPOSIT" /* DEPOSIT */) {
|
|
30299
30316
|
const myTransferStatus = transferHistory.data.find(
|
|
30300
|
-
(operation) => operation.transactionHash === orderId
|
|
30317
|
+
(operation) => operation.transactionHash?.toLowerCase() === orderId.toString().toLowerCase()
|
|
30301
30318
|
);
|
|
30302
30319
|
if (!myTransferStatus) {
|
|
30303
30320
|
if (attempt < maxAttempts) {
|
|
@@ -30332,7 +30349,7 @@ var ExtendedAdapter = class _ExtendedAdapter extends BaseAdapter {
|
|
|
30332
30349
|
}
|
|
30333
30350
|
} else {
|
|
30334
30351
|
const myTransferStatus = transferHistory.data.find(
|
|
30335
|
-
(operation) => operation.id
|
|
30352
|
+
(operation) => operation.id === orderId.toString()
|
|
30336
30353
|
);
|
|
30337
30354
|
if (!myTransferStatus) {
|
|
30338
30355
|
if (attempt < maxAttempts) {
|
|
@@ -34827,7 +34844,7 @@ var VesuExtendedMultiplierStrategy = class _VesuExtendedMultiplierStrategy exten
|
|
|
34827
34844
|
};
|
|
34828
34845
|
}
|
|
34829
34846
|
const vesuAmountInBTC = new Web3Number(
|
|
34830
|
-
params.amount.dividedBy(collateralPrice.price).
|
|
34847
|
+
params.amount.dividedBy(collateralPrice.price).toFixed(WBTC_TOKEN_DECIMALS),
|
|
34831
34848
|
collateralToken.decimals
|
|
34832
34849
|
);
|
|
34833
34850
|
const proofsInfo = vesuAdapter.getProofs(false, this.getMerkleTree());
|
|
@@ -35022,7 +35039,10 @@ var VesuExtendedMultiplierStrategy = class _VesuExtendedMultiplierStrategy exten
|
|
|
35022
35039
|
logger.error(`error getting btc price avnu: ${btcPriceAvnu}`);
|
|
35023
35040
|
return false;
|
|
35024
35041
|
}
|
|
35042
|
+
logger.info(`price: ${price}`);
|
|
35043
|
+
logger.info(`btcPriceAvnu: ${btcPriceAvnu}`);
|
|
35025
35044
|
const priceDifference = new Web3Number(price.minus(btcPriceAvnu).toFixed(2), 0);
|
|
35045
|
+
logger.info(`priceDifference: ${priceDifference}`);
|
|
35026
35046
|
if (priceDifference.isNegative()) {
|
|
35027
35047
|
return false;
|
|
35028
35048
|
}
|
|
@@ -35350,11 +35370,11 @@ function VaultDescription2(lstSymbol, underlyingSymbol) {
|
|
|
35350
35370
|
] });
|
|
35351
35371
|
}
|
|
35352
35372
|
var re7UsdcPrimeDevansh = {
|
|
35353
|
-
vaultAddress: ContractAddr.from("
|
|
35354
|
-
manager: ContractAddr.from("
|
|
35355
|
-
vaultAllocator: ContractAddr.from("
|
|
35356
|
-
redeemRequestNFT: ContractAddr.from("
|
|
35357
|
-
aumOracle: ContractAddr.from("
|
|
35373
|
+
vaultAddress: ContractAddr.from("0x7efaff77601813ca674c1ffe0479fc0361c0f5099f64a67d4793b80382750c2"),
|
|
35374
|
+
manager: ContractAddr.from("0x2579342f53fbf2f775b0c71d24f162aaf1d3e466edea09a6c51e77a95bd986d"),
|
|
35375
|
+
vaultAllocator: ContractAddr.from("0x46ee6073484a669631e8f88b9f357b0b073cee1bc47752fc32453dd6c1efd7b"),
|
|
35376
|
+
redeemRequestNFT: ContractAddr.from("0x1d66120b0a76068454ea36276d9f404b0a980083dcaebbf6d9f4ad154a79dbe"),
|
|
35377
|
+
aumOracle: ContractAddr.from("0x419a5e8b5a1fe5b2586e64409d5cfdb1712791aaa9361264730227563d4e140"),
|
|
35358
35378
|
leafAdapters: [],
|
|
35359
35379
|
adapters: [],
|
|
35360
35380
|
targetHealthFactor: 1.4,
|
package/dist/index.d.ts
CHANGED
|
@@ -1195,7 +1195,7 @@ interface Market {
|
|
|
1195
1195
|
l2_config: L2Config;
|
|
1196
1196
|
}
|
|
1197
1197
|
interface AssetOperation {
|
|
1198
|
-
id:
|
|
1198
|
+
id: string;
|
|
1199
1199
|
type: AssetOperationType;
|
|
1200
1200
|
status: AssetOperationStatus;
|
|
1201
1201
|
amount: string;
|
|
@@ -1298,8 +1298,9 @@ declare class ExtendedWrapper {
|
|
|
1298
1298
|
getHoldings(): Promise<ExtendedApiResponse<Balance>>;
|
|
1299
1299
|
/**
|
|
1300
1300
|
* Initiate a withdrawal from Extended Exchange
|
|
1301
|
+
* Returns data as number | string to preserve precision for large integers
|
|
1301
1302
|
*/
|
|
1302
|
-
withdraw(request: WithdrawRequest): Promise<ExtendedApiResponse<number>>;
|
|
1303
|
+
withdraw(request: WithdrawRequest): Promise<ExtendedApiResponse<number | string>>;
|
|
1303
1304
|
/**
|
|
1304
1305
|
* Create and sign a withdrawal request hash
|
|
1305
1306
|
*/
|
|
@@ -1384,8 +1385,9 @@ declare class ExtendedWrapper {
|
|
|
1384
1385
|
getOrderHistory(marketName: string): Promise<ExtendedApiResponse<OpenOrder[]>>;
|
|
1385
1386
|
/**
|
|
1386
1387
|
* Withdraw USDC (convenience method)
|
|
1388
|
+
* Returns data as number | string to preserve precision for large integers
|
|
1387
1389
|
*/
|
|
1388
|
-
withdrawUSDC(amount: string): Promise<ExtendedApiResponse<number>>;
|
|
1390
|
+
withdrawUSDC(amount: string): Promise<ExtendedApiResponse<number | string>>;
|
|
1389
1391
|
/**
|
|
1390
1392
|
* Get funding rates for a specific market
|
|
1391
1393
|
* @param marketName - The name of the market to get funding rates for
|
package/dist/index.js
CHANGED
|
@@ -29543,7 +29543,22 @@ var ExtendedWrapper = class {
|
|
|
29543
29543
|
`HTTP ${response.status}: ${errorData.detail || response.statusText}`
|
|
29544
29544
|
);
|
|
29545
29545
|
}
|
|
29546
|
-
const
|
|
29546
|
+
const text = await response.text();
|
|
29547
|
+
const MAX_SAFE_INTEGER_STR = "9007199254740991";
|
|
29548
|
+
const largeIntegerRegex = /"data"\s*:\s*(\d{16,})/g;
|
|
29549
|
+
const modifiedText = text.replace(largeIntegerRegex, (match, largeInt) => {
|
|
29550
|
+
if (largeInt.length > MAX_SAFE_INTEGER_STR.length || largeInt.length === MAX_SAFE_INTEGER_STR.length && largeInt > MAX_SAFE_INTEGER_STR) {
|
|
29551
|
+
return `"data":"${largeInt}"`;
|
|
29552
|
+
}
|
|
29553
|
+
return match;
|
|
29554
|
+
});
|
|
29555
|
+
const data = JSON.parse(modifiedText);
|
|
29556
|
+
if (data && typeof data.data === "string" && /^\d+$/.test(data.data)) {
|
|
29557
|
+
const numValue = Number(data.data);
|
|
29558
|
+
if (Number.isSafeInteger(numValue)) {
|
|
29559
|
+
data.data = numValue;
|
|
29560
|
+
}
|
|
29561
|
+
}
|
|
29547
29562
|
return data;
|
|
29548
29563
|
} catch (error) {
|
|
29549
29564
|
lastError = error;
|
|
@@ -29603,6 +29618,7 @@ var ExtendedWrapper = class {
|
|
|
29603
29618
|
}
|
|
29604
29619
|
/**
|
|
29605
29620
|
* Initiate a withdrawal from Extended Exchange
|
|
29621
|
+
* Returns data as number | string to preserve precision for large integers
|
|
29606
29622
|
*/
|
|
29607
29623
|
async withdraw(request) {
|
|
29608
29624
|
return this.makeRequest("/api/v1/withdraw", {
|
|
@@ -29741,6 +29757,7 @@ var ExtendedWrapper = class {
|
|
|
29741
29757
|
}
|
|
29742
29758
|
/**
|
|
29743
29759
|
* Withdraw USDC (convenience method)
|
|
29760
|
+
* Returns data as number | string to preserve precision for large integers
|
|
29744
29761
|
*/
|
|
29745
29762
|
async withdrawUSDC(amount) {
|
|
29746
29763
|
return this.withdraw({ amount, asset: "USDC" });
|
|
@@ -30451,7 +30468,7 @@ var ExtendedAdapter = class _ExtendedAdapter extends BaseAdapter {
|
|
|
30451
30468
|
});
|
|
30452
30469
|
if (operationsType === "DEPOSIT" /* DEPOSIT */) {
|
|
30453
30470
|
const myTransferStatus = transferHistory.data.find(
|
|
30454
|
-
(operation) => operation.transactionHash === orderId
|
|
30471
|
+
(operation) => operation.transactionHash?.toLowerCase() === orderId.toString().toLowerCase()
|
|
30455
30472
|
);
|
|
30456
30473
|
if (!myTransferStatus) {
|
|
30457
30474
|
if (attempt < maxAttempts) {
|
|
@@ -30486,7 +30503,7 @@ var ExtendedAdapter = class _ExtendedAdapter extends BaseAdapter {
|
|
|
30486
30503
|
}
|
|
30487
30504
|
} else {
|
|
30488
30505
|
const myTransferStatus = transferHistory.data.find(
|
|
30489
|
-
(operation) => operation.id
|
|
30506
|
+
(operation) => operation.id === orderId.toString()
|
|
30490
30507
|
);
|
|
30491
30508
|
if (!myTransferStatus) {
|
|
30492
30509
|
if (attempt < maxAttempts) {
|
|
@@ -34981,7 +34998,7 @@ var VesuExtendedMultiplierStrategy = class _VesuExtendedMultiplierStrategy exten
|
|
|
34981
34998
|
};
|
|
34982
34999
|
}
|
|
34983
35000
|
const vesuAmountInBTC = new Web3Number(
|
|
34984
|
-
params.amount.dividedBy(collateralPrice.price).
|
|
35001
|
+
params.amount.dividedBy(collateralPrice.price).toFixed(WBTC_TOKEN_DECIMALS),
|
|
34985
35002
|
collateralToken.decimals
|
|
34986
35003
|
);
|
|
34987
35004
|
const proofsInfo = vesuAdapter.getProofs(false, this.getMerkleTree());
|
|
@@ -35176,7 +35193,10 @@ var VesuExtendedMultiplierStrategy = class _VesuExtendedMultiplierStrategy exten
|
|
|
35176
35193
|
logger.error(`error getting btc price avnu: ${btcPriceAvnu}`);
|
|
35177
35194
|
return false;
|
|
35178
35195
|
}
|
|
35196
|
+
logger.info(`price: ${price}`);
|
|
35197
|
+
logger.info(`btcPriceAvnu: ${btcPriceAvnu}`);
|
|
35179
35198
|
const priceDifference = new Web3Number(price.minus(btcPriceAvnu).toFixed(2), 0);
|
|
35199
|
+
logger.info(`priceDifference: ${priceDifference}`);
|
|
35180
35200
|
if (priceDifference.isNegative()) {
|
|
35181
35201
|
return false;
|
|
35182
35202
|
}
|
|
@@ -35504,11 +35524,11 @@ function VaultDescription2(lstSymbol, underlyingSymbol) {
|
|
|
35504
35524
|
] });
|
|
35505
35525
|
}
|
|
35506
35526
|
var re7UsdcPrimeDevansh = {
|
|
35507
|
-
vaultAddress: ContractAddr.from("
|
|
35508
|
-
manager: ContractAddr.from("
|
|
35509
|
-
vaultAllocator: ContractAddr.from("
|
|
35510
|
-
redeemRequestNFT: ContractAddr.from("
|
|
35511
|
-
aumOracle: ContractAddr.from("
|
|
35527
|
+
vaultAddress: ContractAddr.from("0x7efaff77601813ca674c1ffe0479fc0361c0f5099f64a67d4793b80382750c2"),
|
|
35528
|
+
manager: ContractAddr.from("0x2579342f53fbf2f775b0c71d24f162aaf1d3e466edea09a6c51e77a95bd986d"),
|
|
35529
|
+
vaultAllocator: ContractAddr.from("0x46ee6073484a669631e8f88b9f357b0b073cee1bc47752fc32453dd6c1efd7b"),
|
|
35530
|
+
redeemRequestNFT: ContractAddr.from("0x1d66120b0a76068454ea36276d9f404b0a980083dcaebbf6d9f4ad154a79dbe"),
|
|
35531
|
+
aumOracle: ContractAddr.from("0x419a5e8b5a1fe5b2586e64409d5cfdb1712791aaa9361264730227563d4e140"),
|
|
35512
35532
|
leafAdapters: [],
|
|
35513
35533
|
adapters: [],
|
|
35514
35534
|
targetHealthFactor: 1.4,
|
package/dist/index.mjs
CHANGED
|
@@ -29400,7 +29400,22 @@ var ExtendedWrapper = class {
|
|
|
29400
29400
|
`HTTP ${response.status}: ${errorData.detail || response.statusText}`
|
|
29401
29401
|
);
|
|
29402
29402
|
}
|
|
29403
|
-
const
|
|
29403
|
+
const text = await response.text();
|
|
29404
|
+
const MAX_SAFE_INTEGER_STR = "9007199254740991";
|
|
29405
|
+
const largeIntegerRegex = /"data"\s*:\s*(\d{16,})/g;
|
|
29406
|
+
const modifiedText = text.replace(largeIntegerRegex, (match, largeInt) => {
|
|
29407
|
+
if (largeInt.length > MAX_SAFE_INTEGER_STR.length || largeInt.length === MAX_SAFE_INTEGER_STR.length && largeInt > MAX_SAFE_INTEGER_STR) {
|
|
29408
|
+
return `"data":"${largeInt}"`;
|
|
29409
|
+
}
|
|
29410
|
+
return match;
|
|
29411
|
+
});
|
|
29412
|
+
const data = JSON.parse(modifiedText);
|
|
29413
|
+
if (data && typeof data.data === "string" && /^\d+$/.test(data.data)) {
|
|
29414
|
+
const numValue = Number(data.data);
|
|
29415
|
+
if (Number.isSafeInteger(numValue)) {
|
|
29416
|
+
data.data = numValue;
|
|
29417
|
+
}
|
|
29418
|
+
}
|
|
29404
29419
|
return data;
|
|
29405
29420
|
} catch (error) {
|
|
29406
29421
|
lastError = error;
|
|
@@ -29460,6 +29475,7 @@ var ExtendedWrapper = class {
|
|
|
29460
29475
|
}
|
|
29461
29476
|
/**
|
|
29462
29477
|
* Initiate a withdrawal from Extended Exchange
|
|
29478
|
+
* Returns data as number | string to preserve precision for large integers
|
|
29463
29479
|
*/
|
|
29464
29480
|
async withdraw(request) {
|
|
29465
29481
|
return this.makeRequest("/api/v1/withdraw", {
|
|
@@ -29598,6 +29614,7 @@ var ExtendedWrapper = class {
|
|
|
29598
29614
|
}
|
|
29599
29615
|
/**
|
|
29600
29616
|
* Withdraw USDC (convenience method)
|
|
29617
|
+
* Returns data as number | string to preserve precision for large integers
|
|
29601
29618
|
*/
|
|
29602
29619
|
async withdrawUSDC(amount) {
|
|
29603
29620
|
return this.withdraw({ amount, asset: "USDC" });
|
|
@@ -30308,7 +30325,7 @@ var ExtendedAdapter = class _ExtendedAdapter extends BaseAdapter {
|
|
|
30308
30325
|
});
|
|
30309
30326
|
if (operationsType === "DEPOSIT" /* DEPOSIT */) {
|
|
30310
30327
|
const myTransferStatus = transferHistory.data.find(
|
|
30311
|
-
(operation) => operation.transactionHash === orderId
|
|
30328
|
+
(operation) => operation.transactionHash?.toLowerCase() === orderId.toString().toLowerCase()
|
|
30312
30329
|
);
|
|
30313
30330
|
if (!myTransferStatus) {
|
|
30314
30331
|
if (attempt < maxAttempts) {
|
|
@@ -30343,7 +30360,7 @@ var ExtendedAdapter = class _ExtendedAdapter extends BaseAdapter {
|
|
|
30343
30360
|
}
|
|
30344
30361
|
} else {
|
|
30345
30362
|
const myTransferStatus = transferHistory.data.find(
|
|
30346
|
-
(operation) => operation.id
|
|
30363
|
+
(operation) => operation.id === orderId.toString()
|
|
30347
30364
|
);
|
|
30348
30365
|
if (!myTransferStatus) {
|
|
30349
30366
|
if (attempt < maxAttempts) {
|
|
@@ -34838,7 +34855,7 @@ var VesuExtendedMultiplierStrategy = class _VesuExtendedMultiplierStrategy exten
|
|
|
34838
34855
|
};
|
|
34839
34856
|
}
|
|
34840
34857
|
const vesuAmountInBTC = new Web3Number(
|
|
34841
|
-
params.amount.dividedBy(collateralPrice.price).
|
|
34858
|
+
params.amount.dividedBy(collateralPrice.price).toFixed(WBTC_TOKEN_DECIMALS),
|
|
34842
34859
|
collateralToken.decimals
|
|
34843
34860
|
);
|
|
34844
34861
|
const proofsInfo = vesuAdapter.getProofs(false, this.getMerkleTree());
|
|
@@ -35033,7 +35050,10 @@ var VesuExtendedMultiplierStrategy = class _VesuExtendedMultiplierStrategy exten
|
|
|
35033
35050
|
logger.error(`error getting btc price avnu: ${btcPriceAvnu}`);
|
|
35034
35051
|
return false;
|
|
35035
35052
|
}
|
|
35053
|
+
logger.info(`price: ${price}`);
|
|
35054
|
+
logger.info(`btcPriceAvnu: ${btcPriceAvnu}`);
|
|
35036
35055
|
const priceDifference = new Web3Number(price.minus(btcPriceAvnu).toFixed(2), 0);
|
|
35056
|
+
logger.info(`priceDifference: ${priceDifference}`);
|
|
35037
35057
|
if (priceDifference.isNegative()) {
|
|
35038
35058
|
return false;
|
|
35039
35059
|
}
|
|
@@ -35361,11 +35381,11 @@ function VaultDescription2(lstSymbol, underlyingSymbol) {
|
|
|
35361
35381
|
] });
|
|
35362
35382
|
}
|
|
35363
35383
|
var re7UsdcPrimeDevansh = {
|
|
35364
|
-
vaultAddress: ContractAddr.from("
|
|
35365
|
-
manager: ContractAddr.from("
|
|
35366
|
-
vaultAllocator: ContractAddr.from("
|
|
35367
|
-
redeemRequestNFT: ContractAddr.from("
|
|
35368
|
-
aumOracle: ContractAddr.from("
|
|
35384
|
+
vaultAddress: ContractAddr.from("0x7efaff77601813ca674c1ffe0479fc0361c0f5099f64a67d4793b80382750c2"),
|
|
35385
|
+
manager: ContractAddr.from("0x2579342f53fbf2f775b0c71d24f162aaf1d3e466edea09a6c51e77a95bd986d"),
|
|
35386
|
+
vaultAllocator: ContractAddr.from("0x46ee6073484a669631e8f88b9f357b0b073cee1bc47752fc32453dd6c1efd7b"),
|
|
35387
|
+
redeemRequestNFT: ContractAddr.from("0x1d66120b0a76068454ea36276d9f404b0a980083dcaebbf6d9f4ad154a79dbe"),
|
|
35388
|
+
aumOracle: ContractAddr.from("0x419a5e8b5a1fe5b2586e64409d5cfdb1712791aaa9361264730227563d4e140"),
|
|
35369
35389
|
leafAdapters: [],
|
|
35370
35390
|
adapters: [],
|
|
35371
35391
|
targetHealthFactor: 1.4,
|
package/package.json
CHANGED
|
@@ -76,8 +76,33 @@ export class ExtendedWrapper {
|
|
|
76
76
|
}`
|
|
77
77
|
);
|
|
78
78
|
}
|
|
79
|
-
|
|
80
|
-
const
|
|
79
|
+
|
|
80
|
+
const text = await response.text();
|
|
81
|
+
|
|
82
|
+
// Replace large integers (greater than MAX_SAFE_INTEGER) with quoted strings
|
|
83
|
+
// This regex finds numbers that are likely to be large integers in the "data" field
|
|
84
|
+
const MAX_SAFE_INTEGER_STR = '9007199254740991';
|
|
85
|
+
const largeIntegerRegex = /"data"\s*:\s*(\d{16,})/g;
|
|
86
|
+
|
|
87
|
+
const modifiedText = text.replace(largeIntegerRegex, (match, largeInt) => {
|
|
88
|
+
// Compare as strings to avoid precision loss
|
|
89
|
+
if (largeInt.length > MAX_SAFE_INTEGER_STR.length ||
|
|
90
|
+
(largeInt.length === MAX_SAFE_INTEGER_STR.length && largeInt > MAX_SAFE_INTEGER_STR)) {
|
|
91
|
+
// Replace the number with a quoted string to preserve precision
|
|
92
|
+
return `"data":"${largeInt}"`;
|
|
93
|
+
}
|
|
94
|
+
return match; // Keep original if it's a safe integer
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
const data = JSON.parse(modifiedText);
|
|
98
|
+
|
|
99
|
+
if (data && typeof data.data === 'string' && /^\d+$/.test(data.data)) {
|
|
100
|
+
const numValue = Number(data.data);
|
|
101
|
+
if (Number.isSafeInteger(numValue)) {
|
|
102
|
+
data.data = numValue;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
81
106
|
return data;
|
|
82
107
|
} catch (error) {
|
|
83
108
|
lastError = error as Error;
|
|
@@ -159,11 +184,12 @@ export class ExtendedWrapper {
|
|
|
159
184
|
|
|
160
185
|
/**
|
|
161
186
|
* Initiate a withdrawal from Extended Exchange
|
|
187
|
+
* Returns data as number | string to preserve precision for large integers
|
|
162
188
|
*/
|
|
163
189
|
async withdraw(
|
|
164
190
|
request: WithdrawRequest
|
|
165
|
-
): Promise<ExtendedApiResponse<number>> {
|
|
166
|
-
return this.makeRequest<number>("/api/v1/withdraw", {
|
|
191
|
+
): Promise<ExtendedApiResponse<number | string>> {
|
|
192
|
+
return this.makeRequest<number | string>("/api/v1/withdraw", {
|
|
167
193
|
method: "POST",
|
|
168
194
|
body: JSON.stringify(request),
|
|
169
195
|
});
|
|
@@ -369,8 +395,9 @@ export class ExtendedWrapper {
|
|
|
369
395
|
|
|
370
396
|
/**
|
|
371
397
|
* Withdraw USDC (convenience method)
|
|
398
|
+
* Returns data as number | string to preserve precision for large integers
|
|
372
399
|
*/
|
|
373
|
-
async withdrawUSDC(amount: string): Promise<ExtendedApiResponse<number>> {
|
|
400
|
+
async withdrawUSDC(amount: string): Promise<ExtendedApiResponse<number | string>> {
|
|
374
401
|
return this.withdraw({ amount, asset: "USDC" });
|
|
375
402
|
}
|
|
376
403
|
|
|
@@ -880,7 +880,7 @@ export class ExtendedAdapter extends BaseAdapter<
|
|
|
880
880
|
});
|
|
881
881
|
if (operationsType === AssetOperationType.DEPOSIT) {
|
|
882
882
|
const myTransferStatus = transferHistory.data.find(
|
|
883
|
-
(operation) => operation.transactionHash === orderId
|
|
883
|
+
(operation) => operation.transactionHash?.toLowerCase() === orderId.toString().toLowerCase()
|
|
884
884
|
);
|
|
885
885
|
if (!myTransferStatus) {
|
|
886
886
|
if (attempt < maxAttempts) {
|
|
@@ -916,7 +916,7 @@ export class ExtendedAdapter extends BaseAdapter<
|
|
|
916
916
|
}
|
|
917
917
|
} else {
|
|
918
918
|
const myTransferStatus = transferHistory.data.find(
|
|
919
|
-
(operation) => operation.id
|
|
919
|
+
(operation) => operation.id === orderId.toString()
|
|
920
920
|
);
|
|
921
921
|
if (!myTransferStatus) {
|
|
922
922
|
if (attempt < maxAttempts) {
|
|
@@ -779,7 +779,7 @@ export class VesuExtendedMultiplierStrategy<
|
|
|
779
779
|
}
|
|
780
780
|
//withdraw from vesu
|
|
781
781
|
const vesuAmountInBTC = new Web3Number(
|
|
782
|
-
params.amount.dividedBy(collateralPrice.price).
|
|
782
|
+
params.amount.dividedBy(collateralPrice.price).toFixed(WBTC_TOKEN_DECIMALS),
|
|
783
783
|
collateralToken.decimals
|
|
784
784
|
);
|
|
785
785
|
const proofsInfo = vesuAdapter.getProofs(false, this.getMerkleTree());
|
|
@@ -981,11 +981,15 @@ export class VesuExtendedMultiplierStrategy<
|
|
|
981
981
|
const price = ask.plus(bid).dividedBy(2);
|
|
982
982
|
const btcToken = vesuAdapter.config.supportedPositions[0].asset;
|
|
983
983
|
const btcPriceAvnu = await avnuAdapter.getPriceOfToken(btcToken.address.toString());
|
|
984
|
+
|
|
984
985
|
if (!btcPriceAvnu) {
|
|
985
986
|
logger.error(`error getting btc price avnu: ${btcPriceAvnu}`);
|
|
986
987
|
return false;
|
|
987
988
|
}
|
|
989
|
+
logger.info(`price: ${price}`);
|
|
990
|
+
logger.info(`btcPriceAvnu: ${btcPriceAvnu}`);
|
|
988
991
|
const priceDifference = new Web3Number(price.minus(btcPriceAvnu).toFixed(2), 0);
|
|
992
|
+
logger.info(`priceDifference: ${priceDifference}`);
|
|
989
993
|
if(priceDifference.isNegative()){
|
|
990
994
|
return false;
|
|
991
995
|
}
|
|
@@ -1283,7 +1287,6 @@ function getLooperSettings(
|
|
|
1283
1287
|
vaultSettings.leafAdapters.push(() => extendedAdapter.getSwapFromLegacyLeaf());
|
|
1284
1288
|
vaultSettings.leafAdapters.push(() => avnuAdapter.getDepositLeaf());
|
|
1285
1289
|
vaultSettings.leafAdapters.push(() => avnuAdapter.getWithdrawLeaf());
|
|
1286
|
-
// Doubt here, should this be usdcToken.address, or wbtcToken.address?
|
|
1287
1290
|
vaultSettings.leafAdapters.push(
|
|
1288
1291
|
commonAdapter
|
|
1289
1292
|
.getApproveAdapter(
|
|
@@ -1354,11 +1357,11 @@ export default function VaultDescription(
|
|
|
1354
1357
|
}
|
|
1355
1358
|
|
|
1356
1359
|
const re7UsdcPrimeDevansh: VesuExtendedStrategySettings = {
|
|
1357
|
-
vaultAddress: ContractAddr.from("
|
|
1358
|
-
manager: ContractAddr.from("
|
|
1359
|
-
vaultAllocator: ContractAddr.from("
|
|
1360
|
-
redeemRequestNFT: ContractAddr.from("
|
|
1361
|
-
aumOracle: ContractAddr.from("
|
|
1360
|
+
vaultAddress: ContractAddr.from("0x7efaff77601813ca674c1ffe0479fc0361c0f5099f64a67d4793b80382750c2"),
|
|
1361
|
+
manager: ContractAddr.from("0x2579342f53fbf2f775b0c71d24f162aaf1d3e466edea09a6c51e77a95bd986d"),
|
|
1362
|
+
vaultAllocator: ContractAddr.from("0x46ee6073484a669631e8f88b9f357b0b073cee1bc47752fc32453dd6c1efd7b"),
|
|
1363
|
+
redeemRequestNFT: ContractAddr.from("0x1d66120b0a76068454ea36276d9f404b0a980083dcaebbf6d9f4ad154a79dbe"),
|
|
1364
|
+
aumOracle: ContractAddr.from("0x419a5e8b5a1fe5b2586e64409d5cfdb1712791aaa9361264730227563d4e140"),
|
|
1362
1365
|
leafAdapters: [],
|
|
1363
1366
|
adapters: [],
|
|
1364
1367
|
targetHealthFactor: 1.4,
|