Skip to content

Commit 79703d1

Browse files
authored
Merge pull request #616 from NilsonCesar/main
feat: add fiat withdraw endpoint
2 parents b1c7896 + 6829a83 commit 79703d1

File tree

3 files changed

+39
-0
lines changed

3 files changed

+39
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
const { MainClient } = require('binance');
2+
3+
// This example shows how to call this Binance API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "binance" for Binance exchange
4+
// This Binance API SDK is available on npm via "npm install binance"
5+
// ENDPOINT: sapi/v2/fiat/withdraw
6+
// METHOD: POST
7+
// PUBLIC: NO
8+
9+
const client = new MainClient({
10+
api_key: 'insert_api_key_here',
11+
api_secret: 'insert_api_secret_here',
12+
});
13+
14+
client.fiatWithdraw(params)
15+
.then((response) => {
16+
console.log(response);
17+
})
18+
.catch((error) => {
19+
console.error(error);
20+
});

src/main-client.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -616,6 +616,7 @@ import {
616616
WalletBalance,
617617
WithdrawAddress,
618618
WithdrawAssetsFromManagedSubAccountParams,
619+
WithdrawFiatParams,
619620
WithdrawHistory,
620621
WithdrawHistoryParams,
621622
WithdrawParams,
@@ -3747,6 +3748,10 @@ export class MainClient extends BaseRestClient {
37473748
return this.getPrivate('sapi/v1/fiat/payments', params);
37483749
}
37493750

3751+
fiatWithdraw(params: WithdrawFiatParams): Promise<{ id: string }> {
3752+
return this.postPrivate('/sapi/v2/fiat/withdraw', params);
3753+
}
3754+
37503755
/**
37513756
*
37523757
* Rebate Endpoints

src/types/spot.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4490,6 +4490,20 @@ export interface GetFiatPaymentsHistoryResponse {
44904490
success: boolean;
44914491
}
44924492

4493+
export interface WithdrawFiatAccountInfo {
4494+
accountNumber: string;
4495+
agency: string;
4496+
bankCodeForPix: string;
4497+
accountType: string;
4498+
}
4499+
4500+
export interface WithdrawFiatParams {
4501+
currency: string;
4502+
apiPaymentMethod: string;
4503+
amount: number;
4504+
accountInfo?: WithdrawFiatAccountInfo;
4505+
}
4506+
44934507
export interface GetC2CTradeHistoryParams {
44944508
tradeType: string;
44954509
startTimestamp?: number;

0 commit comments

Comments
 (0)