v3.8.2: feat(#310) add set collateral coin endpoints

This commit is contained in:
tiagosiebler
2024-01-25 10:44:24 +00:00
parent d86db861e5
commit 9ba44d9477
5 changed files with 49 additions and 3 deletions

View File

@@ -109,8 +109,11 @@ import {
PurchaseSpotLeveragedTokenResultV5,
RedeemSpotLeveragedTokenParamsV5,
RedeemSpotLeveragedTokenResultV5,
RepayLiabilityParamsV5,
RepayLiabilityResultV5,
RiskLimitV5,
SetAutoAddMarginParamsV5,
SetCollateralCoinParamsV5,
SetLeverageParamsV5,
SetRiskLimitParamsV5,
SetRiskLimitResultV5,
@@ -766,6 +769,35 @@ export class RestClientV5 extends BaseRestClient {
return this.getPrivate('/v5/account/borrow-history', params);
}
/**
* You can manually repay the liabilities of Unified account
* Applicable: Unified Account
* Permission: USDC Contracts
*
* - Input the specific coin: repay the liability of this coin in particular
* - No coin specified: repay the liability of all coins
*/
repayLiability(
params?: RepayLiabilityParamsV5,
): Promise<APIResponseV3WithTime<CursorListV5<RepayLiabilityResultV5[]>>> {
return this.postPrivate('/v5/account/quick-repayment', params);
}
/**
* You can decide whether the assets in the Unified account needs to be collateral coins.
*/
setCollateralCoin(
params: SetCollateralCoinParamsV5,
): Promise<APIResponseV3WithTime<{}>> {
return this.postPrivate('/v5/account/set-collateral-switch', params);
}
batchSetCollateralCoin(params: {
request: SetCollateralCoinParamsV5[];
}): Promise<APIResponseV3WithTime<{ list: SetCollateralCoinParamsV5[] }>> {
return this.postPrivate('/v5/account/set-collateral-switch-batch', params);
}
/**
* Get the collateral information of the current unified margin account, including loan interest rate,
* loanable amount, collateral conversion rate, whether it can be mortgaged as margin, etc.

View File

@@ -38,3 +38,12 @@ export interface MMPModifyParamsV5 {
qtyLimit: string;
deltaLimit: string;
}
export interface RepayLiabilityParamsV5 {
coin?: string;
}
export interface SetCollateralCoinParamsV5 {
coin: string;
collateralSwitch: 'ON' | 'OFF';
}

View File

@@ -120,3 +120,8 @@ export interface MMPStateV5 {
mmpFrozenUntil: string;
mmpFrozen: boolean;
}
export interface RepayLiabilityResultV5 {
coin: string;
repaymentQty: string;
}