@gearbox-protocol/sdk 1.22.2 → 1.22.3
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/lib/core/trade.d.ts +3 -3
- package/lib/core/transactions.d.ts +14 -1
- package/lib/core/transactions.js +30 -1
- package/package.json +1 -1
package/lib/core/trade.d.ts
CHANGED
|
@@ -19,9 +19,9 @@ export interface TradeProps extends BaseTradeInterface {
|
|
|
19
19
|
}
|
|
20
20
|
export type TradeOperations = "farmWithdraw" | "farmDeposit" | "swap" | "unknownOperation";
|
|
21
21
|
export declare class Trade implements BaseTradeInterface {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
readonly helper: BaseAdapter;
|
|
23
|
+
readonly tradePath: PathFinderResult;
|
|
24
|
+
readonly creditFacade: string;
|
|
25
25
|
readonly swapType: SwapOperation;
|
|
26
26
|
readonly sourceAmount: BigNumber;
|
|
27
27
|
readonly expectedAmount: BigNumber;
|
|
@@ -2,7 +2,7 @@ import { BigNumber } from "ethers";
|
|
|
2
2
|
import { SupportedContract } from "../contracts/contracts";
|
|
3
3
|
import { EVMTx, EVMTxProps } from "./eventOrTx";
|
|
4
4
|
export interface TxSerialized {
|
|
5
|
-
type: "TxAddLiquidity" | "TxRemoveLiquidity" | "TxSwap" | "TxAddCollateral" | "TxIncreaseBorrowAmount" | "TxOpenAccount" | "TxRepayAccount" | "TxCloseAccount" | "TxApprove" | "TxOpenMultitokenAccount" | "TxClaimReward" | "TxClaimNFT" | "TxClaimGearRewards" | "TxEnableTokens";
|
|
5
|
+
type: "TxAddLiquidity" | "TxRemoveLiquidity" | "TxSwap" | "TxAddCollateral" | "TxIncreaseBorrowAmount" | "TxDecreaseBorrowAmount" | "TxOpenAccount" | "TxRepayAccount" | "TxCloseAccount" | "TxApprove" | "TxOpenMultitokenAccount" | "TxClaimReward" | "TxClaimNFT" | "TxClaimGearRewards" | "TxEnableTokens";
|
|
6
6
|
content: string;
|
|
7
7
|
}
|
|
8
8
|
export declare class TxSerializer {
|
|
@@ -82,6 +82,19 @@ export declare class TxIncreaseBorrowAmount extends EVMTx {
|
|
|
82
82
|
toString(): string;
|
|
83
83
|
serialize(): TxSerialized;
|
|
84
84
|
}
|
|
85
|
+
interface DecreaseBorrowAmountProps extends EVMTxProps {
|
|
86
|
+
amount: BigNumber;
|
|
87
|
+
underlyingToken: string;
|
|
88
|
+
creditManager: string;
|
|
89
|
+
}
|
|
90
|
+
export declare class TxDecreaseBorrowAmount extends EVMTx {
|
|
91
|
+
readonly amount: BigNumber;
|
|
92
|
+
readonly underlyingToken: string;
|
|
93
|
+
readonly creditManager: string;
|
|
94
|
+
constructor(opts: DecreaseBorrowAmountProps);
|
|
95
|
+
toString(): string;
|
|
96
|
+
serialize(): TxSerialized;
|
|
97
|
+
}
|
|
85
98
|
interface OpenAccountProps extends EVMTxProps {
|
|
86
99
|
amount: BigNumber;
|
|
87
100
|
underlyingToken: string;
|
package/lib/core/transactions.js
CHANGED
|
@@ -15,7 +15,7 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
15
15
|
};
|
|
16
16
|
})();
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.TxEnableTokens = exports.TxApprove = exports.TxCloseAccount = exports.TxRepayAccount = exports.TxClaimGearRewards = exports.TxClaimNFT = exports.TxClaimReward = exports.TxOpenMultitokenAccount = exports.TxOpenAccount = exports.TxIncreaseBorrowAmount = exports.TxAddCollateral = exports.TXSwap = exports.TxRemoveLiquidity = exports.TxAddLiquidity = exports.TxSerializer = void 0;
|
|
18
|
+
exports.TxEnableTokens = exports.TxApprove = exports.TxCloseAccount = exports.TxRepayAccount = exports.TxClaimGearRewards = exports.TxClaimNFT = exports.TxClaimReward = exports.TxOpenMultitokenAccount = exports.TxOpenAccount = exports.TxDecreaseBorrowAmount = exports.TxIncreaseBorrowAmount = exports.TxAddCollateral = exports.TXSwap = exports.TxRemoveLiquidity = exports.TxAddLiquidity = exports.TxSerializer = void 0;
|
|
19
19
|
var ethers_1 = require("ethers");
|
|
20
20
|
var contracts_1 = require("../contracts/contracts");
|
|
21
21
|
var contractsRegister_1 = require("../contracts/contractsRegister");
|
|
@@ -43,6 +43,8 @@ var TxSerializer = /** @class */ (function () {
|
|
|
43
43
|
return new TxAddCollateral(params);
|
|
44
44
|
case "TxIncreaseBorrowAmount":
|
|
45
45
|
return new TxIncreaseBorrowAmount(params);
|
|
46
|
+
case "TxDecreaseBorrowAmount":
|
|
47
|
+
return new TxDecreaseBorrowAmount(params);
|
|
46
48
|
case "TxOpenAccount":
|
|
47
49
|
return new TxOpenAccount(params);
|
|
48
50
|
case "TxRepayAccount":
|
|
@@ -213,6 +215,33 @@ var TxIncreaseBorrowAmount = /** @class */ (function (_super) {
|
|
|
213
215
|
return TxIncreaseBorrowAmount;
|
|
214
216
|
}(eventOrTx_1.EVMTx));
|
|
215
217
|
exports.TxIncreaseBorrowAmount = TxIncreaseBorrowAmount;
|
|
218
|
+
var TxDecreaseBorrowAmount = /** @class */ (function (_super) {
|
|
219
|
+
__extends(TxDecreaseBorrowAmount, _super);
|
|
220
|
+
function TxDecreaseBorrowAmount(opts) {
|
|
221
|
+
var _this = _super.call(this, {
|
|
222
|
+
block: opts.block,
|
|
223
|
+
txHash: opts.txHash,
|
|
224
|
+
txStatus: opts.txStatus,
|
|
225
|
+
timestamp: opts.timestamp,
|
|
226
|
+
}) || this;
|
|
227
|
+
_this.amount = opts.amount;
|
|
228
|
+
_this.underlyingToken = opts.underlyingToken;
|
|
229
|
+
_this.creditManager = opts.creditManager;
|
|
230
|
+
return _this;
|
|
231
|
+
}
|
|
232
|
+
TxDecreaseBorrowAmount.prototype.toString = function () {
|
|
233
|
+
var _a = (0, token_1.extractTokenData)(this.underlyingToken), tokenSymbol = _a[0], tokenDecimals = _a[1];
|
|
234
|
+
return "Credit account ".concat((0, contractsRegister_1.getContractName)(this.creditManager), ": Borrowed amount was decreased for ").concat((0, formatter_1.formatBN)(this.amount, tokenDecimals || 18), " ").concat(tokenSymbol);
|
|
235
|
+
};
|
|
236
|
+
TxDecreaseBorrowAmount.prototype.serialize = function () {
|
|
237
|
+
return {
|
|
238
|
+
type: "TxIncreaseBorrowAmount",
|
|
239
|
+
content: JSON.stringify(this),
|
|
240
|
+
};
|
|
241
|
+
};
|
|
242
|
+
return TxDecreaseBorrowAmount;
|
|
243
|
+
}(eventOrTx_1.EVMTx));
|
|
244
|
+
exports.TxDecreaseBorrowAmount = TxDecreaseBorrowAmount;
|
|
216
245
|
var TxOpenAccount = /** @class */ (function (_super) {
|
|
217
246
|
__extends(TxOpenAccount, _super);
|
|
218
247
|
function TxOpenAccount(opts) {
|