@strkfarm/sdk 2.0.0-dev.10 → 2.0.0-dev.11
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 +25 -8
- package/dist/index.browser.mjs +25 -8
- package/dist/index.d.ts +5 -3
- package/dist/index.js +25 -8
- package/dist/index.mjs +25 -8
- 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 +1 -1
- package/src/strategies/vesu-extended-strategy/vesu-extended-strategy.tsx +6 -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" });
|
|
@@ -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());
|
|
@@ -99373,11 +99390,11 @@ spurious results.`);
|
|
|
99373
99390
|
] });
|
|
99374
99391
|
}
|
|
99375
99392
|
var re7UsdcPrimeDevansh = {
|
|
99376
|
-
vaultAddress: ContractAddr.from("
|
|
99377
|
-
manager: ContractAddr.from("
|
|
99378
|
-
vaultAllocator: ContractAddr.from("
|
|
99379
|
-
redeemRequestNFT: ContractAddr.from("
|
|
99380
|
-
aumOracle: ContractAddr.from("
|
|
99393
|
+
vaultAddress: ContractAddr.from("0x7efaff77601813ca674c1ffe0479fc0361c0f5099f64a67d4793b80382750c2"),
|
|
99394
|
+
manager: ContractAddr.from("0x2579342f53fbf2f775b0c71d24f162aaf1d3e466edea09a6c51e77a95bd986d"),
|
|
99395
|
+
vaultAllocator: ContractAddr.from("0x46ee6073484a669631e8f88b9f357b0b073cee1bc47752fc32453dd6c1efd7b"),
|
|
99396
|
+
redeemRequestNFT: ContractAddr.from("0x1d66120b0a76068454ea36276d9f404b0a980083dcaebbf6d9f4ad154a79dbe"),
|
|
99397
|
+
aumOracle: ContractAddr.from("0x419a5e8b5a1fe5b2586e64409d5cfdb1712791aaa9361264730227563d4e140"),
|
|
99381
99398
|
leafAdapters: [],
|
|
99382
99399
|
adapters: [],
|
|
99383
99400
|
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" });
|
|
@@ -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());
|
|
@@ -35350,11 +35367,11 @@ function VaultDescription2(lstSymbol, underlyingSymbol) {
|
|
|
35350
35367
|
] });
|
|
35351
35368
|
}
|
|
35352
35369
|
var re7UsdcPrimeDevansh = {
|
|
35353
|
-
vaultAddress: ContractAddr.from("
|
|
35354
|
-
manager: ContractAddr.from("
|
|
35355
|
-
vaultAllocator: ContractAddr.from("
|
|
35356
|
-
redeemRequestNFT: ContractAddr.from("
|
|
35357
|
-
aumOracle: ContractAddr.from("
|
|
35370
|
+
vaultAddress: ContractAddr.from("0x7efaff77601813ca674c1ffe0479fc0361c0f5099f64a67d4793b80382750c2"),
|
|
35371
|
+
manager: ContractAddr.from("0x2579342f53fbf2f775b0c71d24f162aaf1d3e466edea09a6c51e77a95bd986d"),
|
|
35372
|
+
vaultAllocator: ContractAddr.from("0x46ee6073484a669631e8f88b9f357b0b073cee1bc47752fc32453dd6c1efd7b"),
|
|
35373
|
+
redeemRequestNFT: ContractAddr.from("0x1d66120b0a76068454ea36276d9f404b0a980083dcaebbf6d9f4ad154a79dbe"),
|
|
35374
|
+
aumOracle: ContractAddr.from("0x419a5e8b5a1fe5b2586e64409d5cfdb1712791aaa9361264730227563d4e140"),
|
|
35358
35375
|
leafAdapters: [],
|
|
35359
35376
|
adapters: [],
|
|
35360
35377
|
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" });
|
|
@@ -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());
|
|
@@ -35504,11 +35521,11 @@ function VaultDescription2(lstSymbol, underlyingSymbol) {
|
|
|
35504
35521
|
] });
|
|
35505
35522
|
}
|
|
35506
35523
|
var re7UsdcPrimeDevansh = {
|
|
35507
|
-
vaultAddress: ContractAddr.from("
|
|
35508
|
-
manager: ContractAddr.from("
|
|
35509
|
-
vaultAllocator: ContractAddr.from("
|
|
35510
|
-
redeemRequestNFT: ContractAddr.from("
|
|
35511
|
-
aumOracle: ContractAddr.from("
|
|
35524
|
+
vaultAddress: ContractAddr.from("0x7efaff77601813ca674c1ffe0479fc0361c0f5099f64a67d4793b80382750c2"),
|
|
35525
|
+
manager: ContractAddr.from("0x2579342f53fbf2f775b0c71d24f162aaf1d3e466edea09a6c51e77a95bd986d"),
|
|
35526
|
+
vaultAllocator: ContractAddr.from("0x46ee6073484a669631e8f88b9f357b0b073cee1bc47752fc32453dd6c1efd7b"),
|
|
35527
|
+
redeemRequestNFT: ContractAddr.from("0x1d66120b0a76068454ea36276d9f404b0a980083dcaebbf6d9f4ad154a79dbe"),
|
|
35528
|
+
aumOracle: ContractAddr.from("0x419a5e8b5a1fe5b2586e64409d5cfdb1712791aaa9361264730227563d4e140"),
|
|
35512
35529
|
leafAdapters: [],
|
|
35513
35530
|
adapters: [],
|
|
35514
35531
|
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" });
|
|
@@ -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());
|
|
@@ -35361,11 +35378,11 @@ function VaultDescription2(lstSymbol, underlyingSymbol) {
|
|
|
35361
35378
|
] });
|
|
35362
35379
|
}
|
|
35363
35380
|
var re7UsdcPrimeDevansh = {
|
|
35364
|
-
vaultAddress: ContractAddr.from("
|
|
35365
|
-
manager: ContractAddr.from("
|
|
35366
|
-
vaultAllocator: ContractAddr.from("
|
|
35367
|
-
redeemRequestNFT: ContractAddr.from("
|
|
35368
|
-
aumOracle: ContractAddr.from("
|
|
35381
|
+
vaultAddress: ContractAddr.from("0x7efaff77601813ca674c1ffe0479fc0361c0f5099f64a67d4793b80382750c2"),
|
|
35382
|
+
manager: ContractAddr.from("0x2579342f53fbf2f775b0c71d24f162aaf1d3e466edea09a6c51e77a95bd986d"),
|
|
35383
|
+
vaultAllocator: ContractAddr.from("0x46ee6073484a669631e8f88b9f357b0b073cee1bc47752fc32453dd6c1efd7b"),
|
|
35384
|
+
redeemRequestNFT: ContractAddr.from("0x1d66120b0a76068454ea36276d9f404b0a980083dcaebbf6d9f4ad154a79dbe"),
|
|
35385
|
+
aumOracle: ContractAddr.from("0x419a5e8b5a1fe5b2586e64409d5cfdb1712791aaa9361264730227563d4e140"),
|
|
35369
35386
|
leafAdapters: [],
|
|
35370
35387
|
adapters: [],
|
|
35371
35388
|
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
|
|
|
@@ -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());
|
|
@@ -1283,7 +1283,6 @@ function getLooperSettings(
|
|
|
1283
1283
|
vaultSettings.leafAdapters.push(() => extendedAdapter.getSwapFromLegacyLeaf());
|
|
1284
1284
|
vaultSettings.leafAdapters.push(() => avnuAdapter.getDepositLeaf());
|
|
1285
1285
|
vaultSettings.leafAdapters.push(() => avnuAdapter.getWithdrawLeaf());
|
|
1286
|
-
// Doubt here, should this be usdcToken.address, or wbtcToken.address?
|
|
1287
1286
|
vaultSettings.leafAdapters.push(
|
|
1288
1287
|
commonAdapter
|
|
1289
1288
|
.getApproveAdapter(
|
|
@@ -1354,11 +1353,11 @@ export default function VaultDescription(
|
|
|
1354
1353
|
}
|
|
1355
1354
|
|
|
1356
1355
|
const re7UsdcPrimeDevansh: VesuExtendedStrategySettings = {
|
|
1357
|
-
vaultAddress: ContractAddr.from("
|
|
1358
|
-
manager: ContractAddr.from("
|
|
1359
|
-
vaultAllocator: ContractAddr.from("
|
|
1360
|
-
redeemRequestNFT: ContractAddr.from("
|
|
1361
|
-
aumOracle: ContractAddr.from("
|
|
1356
|
+
vaultAddress: ContractAddr.from("0x7efaff77601813ca674c1ffe0479fc0361c0f5099f64a67d4793b80382750c2"),
|
|
1357
|
+
manager: ContractAddr.from("0x2579342f53fbf2f775b0c71d24f162aaf1d3e466edea09a6c51e77a95bd986d"),
|
|
1358
|
+
vaultAllocator: ContractAddr.from("0x46ee6073484a669631e8f88b9f357b0b073cee1bc47752fc32453dd6c1efd7b"),
|
|
1359
|
+
redeemRequestNFT: ContractAddr.from("0x1d66120b0a76068454ea36276d9f404b0a980083dcaebbf6d9f4ad154a79dbe"),
|
|
1360
|
+
aumOracle: ContractAddr.from("0x419a5e8b5a1fe5b2586e64409d5cfdb1712791aaa9361264730227563d4e140"),
|
|
1362
1361
|
leafAdapters: [],
|
|
1363
1362
|
adapters: [],
|
|
1364
1363
|
targetHealthFactor: 1.4,
|