@gearbox-protocol/sdk 3.0.0-next.56 → 3.0.0-next.57
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.
|
@@ -51,6 +51,7 @@ export declare class CreditManagerData {
|
|
|
51
51
|
encodeRevertIfReceivedLessThanV2(assets: Array<Asset>): MultiCall;
|
|
52
52
|
encodeRevertIfReceivedLessThanV3(assets: Array<Asset>): MultiCall;
|
|
53
53
|
encodeUpdateQuotaV3(token: string, quotaChange: bigint, minQuota: bigint): MultiCall;
|
|
54
|
+
encodeWithdrawCollateralV3(token: string, amount: bigint, to: string): MultiCall;
|
|
54
55
|
static withdrawAllAndUnwrap_Convex(address: string, claim: boolean): MultiCall;
|
|
55
56
|
}
|
|
56
57
|
export declare class ChartsCreditManagerData {
|
|
@@ -200,6 +200,12 @@ class CreditManagerData {
|
|
|
200
200
|
callData: types_1.ICreditFacadeV3Multicall__factory.createInterface().encodeFunctionData("updateQuota", [token, quotaChange, minQuota]),
|
|
201
201
|
};
|
|
202
202
|
}
|
|
203
|
+
encodeWithdrawCollateralV3(token, amount, to) {
|
|
204
|
+
return {
|
|
205
|
+
target: this.creditFacade,
|
|
206
|
+
callData: types_1.ICreditFacadeV3Multicall__factory.createInterface().encodeFunctionData("withdrawCollateral", [token, amount, to]),
|
|
207
|
+
};
|
|
208
|
+
}
|
|
203
209
|
static withdrawAllAndUnwrap_Convex(address, claim) {
|
|
204
210
|
return {
|
|
205
211
|
target: address,
|
|
@@ -2,7 +2,7 @@ import { SupportedContract } from "@gearbox-protocol/sdk-gov";
|
|
|
2
2
|
import { Asset } from "./assets";
|
|
3
3
|
import { EVMTx, EVMTxProps } from "./eventOrTx";
|
|
4
4
|
export interface TxSerialized {
|
|
5
|
-
type: "TxAddLiquidity" | "TxRemoveLiquidity" | "TxSwap" | "TxAddCollateral" | "TxIncreaseBorrowAmount" | "TxDecreaseBorrowAmount" | "TxOpenAccount" | "TxRepayAccount" | "TxCloseAccount" | "TxApprove" | "TxOpenMultitokenAccount" | "TxClaimReward" | "TxClaimNFT" | "TxClaimGearRewards" | "TxEnableTokens" | "TxUpdateQuota" | "TxGaugeStake" | "TxGaugeUnstake" | "TxGaugeClaim" | "TxGaugeVote";
|
|
5
|
+
type: "TxAddLiquidity" | "TxRemoveLiquidity" | "TxSwap" | "TxAddCollateral" | "TxIncreaseBorrowAmount" | "TxDecreaseBorrowAmount" | "TxOpenAccount" | "TxRepayAccount" | "TxCloseAccount" | "TxApprove" | "TxOpenMultitokenAccount" | "TxClaimReward" | "TxClaimNFT" | "TxClaimGearRewards" | "TxEnableTokens" | "TxUpdateQuota" | "TxGaugeStake" | "TxGaugeUnstake" | "TxGaugeClaim" | "TxGaugeVote" | "TxWithdrawCollateral";
|
|
6
6
|
content: string;
|
|
7
7
|
}
|
|
8
8
|
export declare class TxSerializer {
|
|
@@ -237,4 +237,19 @@ export declare class TxGaugeVote extends EVMTx {
|
|
|
237
237
|
toString(): string;
|
|
238
238
|
serialize(): TxSerialized;
|
|
239
239
|
}
|
|
240
|
+
interface WithdrawCollateralProps extends EVMTxProps {
|
|
241
|
+
amount: bigint;
|
|
242
|
+
token: string;
|
|
243
|
+
to: string;
|
|
244
|
+
creditManager: string;
|
|
245
|
+
}
|
|
246
|
+
export declare class TxWithdrawCollateral extends EVMTx {
|
|
247
|
+
readonly amount: bigint;
|
|
248
|
+
readonly token: string;
|
|
249
|
+
readonly to: string;
|
|
250
|
+
readonly creditManager: string;
|
|
251
|
+
constructor(opts: WithdrawCollateralProps);
|
|
252
|
+
toString(): string;
|
|
253
|
+
serialize(): TxSerialized;
|
|
254
|
+
}
|
|
240
255
|
export {};
|
package/lib/core/transactions.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TxGaugeVote = exports.TxGaugeClaim = exports.TxGaugeUnstake = exports.TxGaugeStake = exports.TxUpdateQuota = 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;
|
|
3
|
+
exports.TxWithdrawCollateral = exports.TxGaugeVote = exports.TxGaugeClaim = exports.TxGaugeUnstake = exports.TxGaugeStake = exports.TxUpdateQuota = 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;
|
|
4
4
|
const sdk_gov_1 = require("@gearbox-protocol/sdk-gov");
|
|
5
5
|
const contractsRegister_1 = require("../contracts/contractsRegister");
|
|
6
6
|
const math_1 = require("../utils/math");
|
|
@@ -53,6 +53,8 @@ class TxSerializer {
|
|
|
53
53
|
return new TxGaugeClaim(params);
|
|
54
54
|
case "TxGaugeVote":
|
|
55
55
|
return new TxGaugeVote(params);
|
|
56
|
+
case "TxWithdrawCollateral":
|
|
57
|
+
return new TxWithdrawCollateral(params);
|
|
56
58
|
default:
|
|
57
59
|
throw new Error(`Unknown transaction for parsing: ${e.type}`);
|
|
58
60
|
}
|
|
@@ -501,3 +503,27 @@ class TxGaugeVote extends eventOrTx_1.EVMTx {
|
|
|
501
503
|
}
|
|
502
504
|
}
|
|
503
505
|
exports.TxGaugeVote = TxGaugeVote;
|
|
506
|
+
class TxWithdrawCollateral extends eventOrTx_1.EVMTx {
|
|
507
|
+
amount;
|
|
508
|
+
token;
|
|
509
|
+
to;
|
|
510
|
+
creditManager;
|
|
511
|
+
constructor(opts) {
|
|
512
|
+
super(opts);
|
|
513
|
+
this.amount = opts.amount;
|
|
514
|
+
this.token = opts.token;
|
|
515
|
+
this.to = opts.to;
|
|
516
|
+
this.creditManager = opts.creditManager;
|
|
517
|
+
}
|
|
518
|
+
toString() {
|
|
519
|
+
const [symbol, decimals] = (0, sdk_gov_1.extractTokenData)(this.token);
|
|
520
|
+
return `Credit account ${(0, contractsRegister_1.getContractName)(this.creditManager)}: withdrawn ${(0, sdk_gov_1.formatBN)(this.amount, decimals || 18)} ${symbol}`;
|
|
521
|
+
}
|
|
522
|
+
serialize() {
|
|
523
|
+
return {
|
|
524
|
+
type: "TxWithdrawCollateral",
|
|
525
|
+
content: JSON.stringify(this),
|
|
526
|
+
};
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
exports.TxWithdrawCollateral = TxWithdrawCollateral;
|