Skip to content

Commit

Permalink
Merge pull request #432 from karimsan/master
Browse files Browse the repository at this point in the history
Add v2 method "Add IP Restriction for Sub-Account API key"
  • Loading branch information
tiagosiebler authored Jun 24, 2024
2 parents 4d95c17 + 7ab263b commit 302a1ea
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 10 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "binance",
"version": "2.11.4",
"version": "2.11.5",
"description": "Node.js & JavaScript SDK for Binance REST APIs & WebSockets, with TypeScript & end-to-end tests.",
"main": "lib/index.js",
"types": "lib/index.d.ts",
Expand Down
22 changes: 16 additions & 6 deletions src/main-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import {
import {
AccountInformation,
AddBSwapLiquidityParams,
AddIpRestriction,
AggregateTrade,
AllCoinsInformationResponse,
ApiKeyBrokerSubAccount,
Expand Down Expand Up @@ -138,7 +139,7 @@ import {
SubAccountListParams,
SubAccountListResponse,
SubAccountMarginAccountDetail,
SubAccountnableOrDisableIPRestriction,
SubAccountEnableOrDisableIPRestriction,
SubAccountsMarginAccountSummary,
SubAccountSpotAssetsSummary,
SubAccountSpotAssetsSummaryParams,
Expand Down Expand Up @@ -538,34 +539,43 @@ export class MainClient extends BaseRestClient {

subAccountEnableOrDisableIPRestriction(
params: EnableOrDisableIPRestrictionForSubAccountParams,
): Promise<SubAccountnableOrDisableIPRestriction> {
): Promise<SubAccountEnableOrDisableIPRestriction> {
return this.postPrivate(
'sapi/v1/sub-account/subAccountApi/ipRestriction',
params,
);
}

subAccountAddIPList(
params: SubAccountnableOrDisableIPRestriction,
params: SubAccountEnableOrDisableIPRestriction,
): Promise<SubAccountAddOrDeleteIPList> {
return this.postPrivate(
'sapi/v1/sub-account/subAccountApi/ipRestriction/ipList',
params,
);
}

subAccountAddIPRestriction(
params: AddIpRestriction,
): Promise<SubAccountEnableOrDisableIPRestriction> {
return this.postPrivate(
'sapi/v2/sub-account/subAccountApi/ipRestriction',
params,
);
}

getSubAccountIPRestriction(
params: BasicSubAccount,
): Promise<SubAccountnableOrDisableIPRestriction> {
): Promise<SubAccountEnableOrDisableIPRestriction> {
return this.getPrivate(
'sapi/v1/sub-account/subAccountApi/ipRestriction',
params,
);
}

subAccountDeleteIPList(
params: SubAccountnableOrDisableIPRestriction,
): Promise<SubAccountnableOrDisableIPRestriction> {
params: SubAccountEnableOrDisableIPRestriction,
): Promise<SubAccountEnableOrDisableIPRestriction> {
return this.deletePrivate(
'sapi/v1/sub-account/subAccountApi/ipRestriction/ipList',
params,
Expand Down
1 change: 1 addition & 0 deletions src/types/futures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -595,6 +595,7 @@ export interface FuturesAccountInformation {
canDeposit: boolean;
canWithdraw: boolean;
updateTime: numberInString;
multiAssetsMargin: boolean;
totalInitialMargin: numberInString;
totalMaintMargin: numberInString;
totalWalletBalance: numberInString;
Expand Down
8 changes: 7 additions & 1 deletion src/types/spot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1557,7 +1557,13 @@ export interface EnableOrDisableIPRestrictionForSubAccountParams
ipRestrict: boolean;
}

export interface SubAccountnableOrDisableIPRestriction {
export interface AddIpRestriction
extends BasicSubAccount {
status: string;
ipAddress: string;
}

export interface SubAccountEnableOrDisableIPRestriction {
ipRestrict: boolean;
ipList: string[];
updateTime: number;
Expand Down

0 comments on commit 302a1ea

Please sign in to comment.