@lavarage/sdk 6.5.0 → 6.6.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.d.mts +13 -9
- package/dist/index.d.ts +13 -9
- package/dist/index.js +38 -19
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +38 -19
- package/dist/index.mjs.map +1 -1
- package/evm.ts +60 -28
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -3399,51 +3399,64 @@ var tokenHolderAbi = [
|
|
|
3399
3399
|
];
|
|
3400
3400
|
|
|
3401
3401
|
// evm.ts
|
|
3402
|
-
var openPositionEvm = (_0, _1, _2) => __async(void 0, [_0, _1, _2], function* (
|
|
3402
|
+
var openPositionEvm = (_0, _1, _2) => __async(void 0, [_0, _1, _2], function* (provider, borrowerOpsContractAddress, {
|
|
3403
3403
|
buyingCode,
|
|
3404
3404
|
tokenCollateral,
|
|
3405
3405
|
borrowAmount,
|
|
3406
3406
|
tokenHolder,
|
|
3407
3407
|
inchRouter,
|
|
3408
3408
|
integratorFeeAddress = ZeroAddress,
|
|
3409
|
-
buyerContribution
|
|
3409
|
+
buyerContribution,
|
|
3410
|
+
gasLimit,
|
|
3411
|
+
gasPrice
|
|
3410
3412
|
}) {
|
|
3411
3413
|
const contract = new Contract(
|
|
3412
3414
|
borrowerOpsContractAddress,
|
|
3413
3415
|
borrowerOperationsAbi,
|
|
3414
|
-
|
|
3416
|
+
provider
|
|
3415
3417
|
);
|
|
3416
|
-
|
|
3418
|
+
const txOptions = {
|
|
3419
|
+
value: buyerContribution
|
|
3420
|
+
};
|
|
3421
|
+
if (gasLimit) txOptions.gasLimit = gasLimit;
|
|
3422
|
+
if (gasPrice) txOptions.gasPrice = gasPrice;
|
|
3423
|
+
return contract.buy.populateTransaction(
|
|
3417
3424
|
buyingCode,
|
|
3418
3425
|
tokenCollateral,
|
|
3419
3426
|
borrowAmount,
|
|
3420
3427
|
tokenHolder,
|
|
3421
3428
|
inchRouter,
|
|
3422
3429
|
integratorFeeAddress,
|
|
3423
|
-
|
|
3430
|
+
txOptions
|
|
3424
3431
|
);
|
|
3425
3432
|
});
|
|
3426
|
-
var closePositionEvm = (_0, _1, _2) => __async(void 0, [_0, _1, _2], function* (
|
|
3433
|
+
var closePositionEvm = (_0, _1, _2) => __async(void 0, [_0, _1, _2], function* (provider, borrowerOpsContractAddress, {
|
|
3427
3434
|
loanId,
|
|
3428
3435
|
sellingCode,
|
|
3429
3436
|
tokenHolder,
|
|
3430
3437
|
inchRouter,
|
|
3431
|
-
integratorFeeAddress = ZeroAddress
|
|
3438
|
+
integratorFeeAddress = ZeroAddress,
|
|
3439
|
+
gasLimit,
|
|
3440
|
+
gasPrice
|
|
3432
3441
|
}) {
|
|
3433
3442
|
const contract = new Contract(
|
|
3434
3443
|
borrowerOpsContractAddress,
|
|
3435
3444
|
borrowerOperationsAbi,
|
|
3436
|
-
|
|
3445
|
+
provider
|
|
3437
3446
|
);
|
|
3438
|
-
|
|
3447
|
+
const txOptions = {};
|
|
3448
|
+
if (gasLimit) txOptions.gasLimit = gasLimit;
|
|
3449
|
+
if (gasPrice) txOptions.gasPrice = gasPrice;
|
|
3450
|
+
return contract.sell.populateTransaction(
|
|
3439
3451
|
loanId,
|
|
3440
3452
|
sellingCode,
|
|
3441
3453
|
tokenHolder,
|
|
3442
3454
|
inchRouter,
|
|
3443
|
-
integratorFeeAddress
|
|
3455
|
+
integratorFeeAddress,
|
|
3456
|
+
Object.keys(txOptions).length > 0 ? txOptions : {}
|
|
3444
3457
|
);
|
|
3445
3458
|
});
|
|
3446
|
-
function getPositionsEvm(provider, borrowerOpsContractAddress, fromBlock =
|
|
3459
|
+
function getPositionsEvm(provider, borrowerOpsContractAddress, fromBlock = 42960845) {
|
|
3447
3460
|
return __async(this, null, function* () {
|
|
3448
3461
|
const contract = new Contract(
|
|
3449
3462
|
borrowerOpsContractAddress,
|
|
@@ -3454,7 +3467,7 @@ function getPositionsEvm(provider, borrowerOpsContractAddress, fromBlock = 0) {
|
|
|
3454
3467
|
const events = yield contract.queryFilter(filter, fromBlock);
|
|
3455
3468
|
return events.map((event) => {
|
|
3456
3469
|
const {
|
|
3457
|
-
|
|
3470
|
+
buyer,
|
|
3458
3471
|
tokenCollateral,
|
|
3459
3472
|
loanId,
|
|
3460
3473
|
openingPositionSize,
|
|
@@ -3462,7 +3475,7 @@ function getPositionsEvm(provider, borrowerOpsContractAddress, fromBlock = 0) {
|
|
|
3462
3475
|
initialMargin
|
|
3463
3476
|
} = event.args;
|
|
3464
3477
|
return {
|
|
3465
|
-
trader,
|
|
3478
|
+
trader: buyer,
|
|
3466
3479
|
tokenCollateral,
|
|
3467
3480
|
loanId,
|
|
3468
3481
|
openingPositionSize,
|
|
@@ -3472,7 +3485,7 @@ function getPositionsEvm(provider, borrowerOpsContractAddress, fromBlock = 0) {
|
|
|
3472
3485
|
});
|
|
3473
3486
|
});
|
|
3474
3487
|
}
|
|
3475
|
-
function getClosedPositionsEvm(provider, borrowerOpsContractAddress, fromBlock =
|
|
3488
|
+
function getClosedPositionsEvm(provider, borrowerOpsContractAddress, fromBlock = 42960845) {
|
|
3476
3489
|
return __async(this, null, function* () {
|
|
3477
3490
|
const contract = new Contract(
|
|
3478
3491
|
borrowerOpsContractAddress,
|
|
@@ -3482,9 +3495,15 @@ function getClosedPositionsEvm(provider, borrowerOpsContractAddress, fromBlock =
|
|
|
3482
3495
|
const filter = contract.filters.Sell();
|
|
3483
3496
|
const events = yield contract.queryFilter(filter, fromBlock);
|
|
3484
3497
|
return events.map((event) => {
|
|
3485
|
-
const {
|
|
3498
|
+
const {
|
|
3499
|
+
buyer,
|
|
3500
|
+
tokenCollateral,
|
|
3501
|
+
loanId,
|
|
3502
|
+
closingPositionSize,
|
|
3503
|
+
profit
|
|
3504
|
+
} = event.args;
|
|
3486
3505
|
return {
|
|
3487
|
-
trader,
|
|
3506
|
+
trader: buyer,
|
|
3488
3507
|
tokenCollateral,
|
|
3489
3508
|
loanId,
|
|
3490
3509
|
closingPositionSize,
|
|
@@ -3493,7 +3512,7 @@ function getClosedPositionsEvm(provider, borrowerOpsContractAddress, fromBlock =
|
|
|
3493
3512
|
});
|
|
3494
3513
|
});
|
|
3495
3514
|
}
|
|
3496
|
-
function getLiquidatedPositionsEvm(provider, borrowerOpsContractAddress, fromBlock =
|
|
3515
|
+
function getLiquidatedPositionsEvm(provider, borrowerOpsContractAddress, fromBlock = 42960845) {
|
|
3497
3516
|
return __async(this, null, function* () {
|
|
3498
3517
|
const contract = new Contract(
|
|
3499
3518
|
borrowerOpsContractAddress,
|
|
@@ -3504,14 +3523,14 @@ function getLiquidatedPositionsEvm(provider, borrowerOpsContractAddress, fromBlo
|
|
|
3504
3523
|
const events = yield contract.queryFilter(filter, fromBlock);
|
|
3505
3524
|
return events.map((event) => {
|
|
3506
3525
|
const {
|
|
3507
|
-
|
|
3526
|
+
borrower,
|
|
3508
3527
|
tokenCollateral,
|
|
3509
3528
|
loanId,
|
|
3510
3529
|
closingPositionSize,
|
|
3511
3530
|
liquidatorRepaidAmount
|
|
3512
3531
|
} = event.args;
|
|
3513
3532
|
return {
|
|
3514
|
-
trader,
|
|
3533
|
+
trader: borrower,
|
|
3515
3534
|
tokenCollateral,
|
|
3516
3535
|
loanId,
|
|
3517
3536
|
closingPositionSize,
|