Skip to content

Commit

Permalink
bitrue withdraw handleNetworkCodeAndParams
Browse files Browse the repository at this point in the history
  • Loading branch information
kroitor committed Feb 11, 2024
1 parent 209b402 commit 4339708
Showing 1 changed file with 7 additions and 15 deletions.
22 changes: 7 additions & 15 deletions ts/src/bitrue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2760,28 +2760,20 @@ export default class bitrue extends Exchange {
this.checkAddress (address);
await this.loadMarkets ();
const currency = this.currency (code);
let chainName = this.safeString2 (params, 'network', 'chainName');
if (chainName === undefined) {
const networks = this.safeValue (currency, 'networks', {});
const optionsNetworks = this.safeValue (this.options, 'networks', {});
let network = this.safeStringUpper (params, 'network'); // this line allows the user to specify either ERC20 or ETH
network = this.safeString (optionsNetworks, network, network);
const networkEntry = this.safeValue (networks, network, {});
chainName = this.safeString (networkEntry, 'id'); // handle ERC20>ETH alias
if (chainName === undefined) {
throw new ArgumentsRequired (this.id + ' withdraw() requires a network parameter or a chainName parameter');
}
params = this.omit (params, 'network');
}
const request = {
'coin': currency['id'].toUpperCase (),
'coin': currency['id'],
'amount': amount,
'addressTo': address,
'chainName': chainName, // 'ERC20', 'TRC20', 'SOL'
// 'chainName': chainName, // 'ERC20', 'TRC20', 'SOL'
// 'addressMark': '', // mark of address
// 'addrType': '', // type of address
// 'tag': tag,
};
let networkCode = undefined;
[ networkCode, params ] = this.handleNetworkCodeAndParams (params);
if (networkCode !== undefined) {
request['chainName'] = this.networkCodeToId (networkCode);
}
if (tag !== undefined) {
request['tag'] = tag;
}
Expand Down

0 comments on commit 4339708

Please sign in to comment.