Skip to content

Commit 0682e75

Browse files
committed
added support for Universal Transfers
Allows internal wallet transfer including c2c wallet transfers.
1 parent 28e1162 commit 0682e75

2 files changed

Lines changed: 55 additions & 0 deletions

File tree

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1836,6 +1836,13 @@ binance.withdraw("XMR", address, amount, addressTag);
18361836
binance.withdraw("BTC", "1C5gqLRs96Xq4V2ZZAR1347yUCpHie7sa", 0.2);
18371837
```
18381838
1839+
### Univeral Transfer / Internal Wallet Transfer
1840+
Example Spot account transfer to USDⓈ-M Futures account , use ENUM -> "MAIN_UMFUTURE"
1841+
```js
1842+
console.info( await binance.universalTransfer("MAIN_UMFUTURE","USDT",10) );
1843+
```
1844+
for more account transfers (ENUMs) see [docs](https://binance-docs.github.io/apidocs/spot/en/#user-universal-transfer)
1845+
18391846
# Binance Margin API
18401847
18411848
#### Transfer from Main account to Margin account

node-binance-api.js

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2136,6 +2136,44 @@ let api = function Binance( options = {} ) {
21362136
Binance.options.log( "Unexpected userDeliveryData: " + type );
21372137
}
21382138
};
2139+
2140+
/**
2141+
* Universal Transfer requires API permissions enabled
2142+
* @param {string} type - ENUM , example MAIN_UMFUTURE for SPOT to USDT futures, see https://binance-docs.github.io/apidocs/spot/en/#user-universal-transfer
2143+
* @param {string} asset - the asset - example :USDT *
2144+
* @param {number} amount - the callback function
2145+
* @param {function} callback - the callback function
2146+
* @return {promise}
2147+
*/
2148+
const universalTransfer = (type, asset, amount, callback = false) => {
2149+
let parameters = Object.assign({
2150+
asset,
2151+
amount,
2152+
type,
2153+
});
2154+
if (!callback) {
2155+
return new Promise((resolve, reject) => {
2156+
signedRequest(
2157+
sapi + "v1/asset/transfer",
2158+
parameters,
2159+
function (error, data) {
2160+
if (error) return reject(error);
2161+
return resolve(data);
2162+
},
2163+
"POST"
2164+
);
2165+
});
2166+
}
2167+
signedRequest(
2168+
sapi + "v1/asset/transfer",
2169+
parameters,
2170+
function (error, data) {
2171+
if (callback) return callback(error, data);
2172+
},
2173+
"POST"
2174+
);
2175+
2176+
}
21392177

21402178
/**
21412179
* Transfer between main account and futures/delivery accounts
@@ -4580,6 +4618,16 @@ let api = function Binance( options = {} ) {
45804618
if ( callback ) return callback( error, data );
45814619
}, 'POST' );
45824620
},
4621+
/**
4622+
* Universal Transfer requires API permissions enabled
4623+
* @param {string} type - ENUM , example MAIN_UMFUTURE for SPOT to USDT futures, see https://binance-docs.github.io/apidocs/spot/en/#user-universal-transfer
4624+
* @param {string} asset - the asset - example :USDT
4625+
* @param {number} amount - the callback function
4626+
* @param {function} callback - the callback function (optionnal)
4627+
* @return {promise}
4628+
*/
4629+
universalTransfer: (type, asset, amount, callback) =>
4630+
universalTransfer(type, asset, amount, callback),
45834631

45844632
/**
45854633
* Transfer from main account to delivery account

0 commit comments

Comments
 (0)