(code, amount, fromAccount, toAccount, params = {})
| 1582 | return transfer; |
| 1583 | } |
| 1584 | async transferBetweenMainAndSubAccount(code, amount, fromAccount, toAccount, params = {}) { |
| 1585 | await this.loadMarkets(); |
| 1586 | const currency = this.currency(code); |
| 1587 | const fromMain = (fromAccount === ''); |
| 1588 | const targetAccount = fromMain ? toAccount : fromAccount; |
| 1589 | const guid = this.safeString(params, 'guid', this.uuid()); |
| 1590 | const request = { |
| 1591 | 'currency': currency['id'], |
| 1592 | 'amount': this.currencyToPrecision(code, amount), |
| 1593 | 'accountId': targetAccount, |
| 1594 | 'clientTxId': guid, |
| 1595 | }; |
| 1596 | let response = undefined; |
| 1597 | if (fromMain) { |
| 1598 | response = await this.privatePostDoDepositFundsFromWallet(this.extend(request, params)); |
| 1599 | } |
| 1600 | else { |
| 1601 | response = await this.privatePostDoWithdrawalFundsToWallet(this.extend(request, params)); |
| 1602 | } |
| 1603 | // both endpoints return the same structure, the only difference is that |
| 1604 | // the "accountId" is filled with the "subAccount" |
| 1605 | // |
| 1606 | // { |
| 1607 | // "ok": "ok", |
| 1608 | // "data": { |
| 1609 | // "accountId": "sub1", |
| 1610 | // "clientTxId": "27ba8284-67cf-4386-9ec7-80b3871abd45", |
| 1611 | // "currency": "USDT", |
| 1612 | // "status": "approved" |
| 1613 | // } |
| 1614 | // } |
| 1615 | // |
| 1616 | const data = this.safeDict(response, 'data', {}); |
| 1617 | return this.parseTransfer(data, currency); |
| 1618 | } |
| 1619 | async transferBetweenSubAccounts(code, amount, fromAccount, toAccount, params = {}) { |
| 1620 | await this.loadMarkets(); |
| 1621 | const currency = this.currency(code); |
no test coverage detected