(rawCurrency: Dict)
| 3400 | } |
| 3401 | |
| 3402 | parseCurrency (rawCurrency: Dict): Currency { |
| 3403 | if (!('networkNamesByChainIds' in this.options)) { |
| 3404 | this.options['networkNamesByChainIds'] = {}; |
| 3405 | } |
| 3406 | if (!('networkChainIdsByNames' in this.options)) { |
| 3407 | this.options['networkChainIdsByNames'] = {}; |
| 3408 | } |
| 3409 | const currencyId = this.safeString (rawCurrency, 'currency'); |
| 3410 | const code = this.safeCurrencyCode (currencyId); |
| 3411 | const assetType = this.safeString (rawCurrency, 'assetType'); |
| 3412 | const type = (assetType === '1') ? 'crypto' : 'fiat'; |
| 3413 | this.options['networkChainIdsByNames'][code] = {}; |
| 3414 | const chains = this.safeList (rawCurrency, 'chains', []); |
| 3415 | const networks: Dict = {}; |
| 3416 | for (let j = 0; j < chains.length; j++) { |
| 3417 | const chainEntry = chains[j]; |
| 3418 | const uniqueChainId = this.safeString (chainEntry, 'chain'); // i.e. usdterc20, trc20usdt ... |
| 3419 | const title = this.safeString2 (chainEntry, 'baseChain', 'displayName'); // baseChain and baseChainProtocol are together existent or inexistent in entries, but baseChain is preferred. when they are both inexistent, then we use generic displayName |
| 3420 | this.options['networkChainIdsByNames'][code][title] = uniqueChainId; |
| 3421 | this.options['networkNamesByChainIds'][uniqueChainId] = title; |
| 3422 | const networkCode = this.networkIdToCode (uniqueChainId, code); |
| 3423 | networks[networkCode] = { |
| 3424 | 'info': chainEntry, |
| 3425 | 'id': uniqueChainId, |
| 3426 | 'network': networkCode, |
| 3427 | 'limits': { |
| 3428 | 'deposit': { |
| 3429 | 'min': this.safeNumber (chainEntry, 'minDepositAmt'), |
| 3430 | 'max': undefined, |
| 3431 | }, |
| 3432 | 'withdraw': { |
| 3433 | 'min': this.safeNumber (chainEntry, 'minWithdrawAmt'), |
| 3434 | 'max': this.safeNumber (chainEntry, 'maxWithdrawAmt'), |
| 3435 | }, |
| 3436 | }, |
| 3437 | 'active': undefined, |
| 3438 | 'deposit': this.safeString (chainEntry, 'depositStatus') === 'allowed', |
| 3439 | 'withdraw': this.safeString (chainEntry, 'withdrawStatus') === 'allowed', |
| 3440 | 'fee': this.safeNumber (chainEntry, 'transactFeeWithdraw'), |
| 3441 | 'precision': this.parseNumber (this.parsePrecision (this.safeString (chainEntry, 'withdrawPrecision'))), |
| 3442 | }; |
| 3443 | } |
| 3444 | return this.safeCurrencyStructure ({ |
| 3445 | 'info': rawCurrency, |
| 3446 | 'code': code, |
| 3447 | 'id': currencyId, |
| 3448 | 'active': this.safeString (rawCurrency, 'instStatus') === 'normal', |
| 3449 | 'deposit': undefined, |
| 3450 | 'withdraw': undefined, |
| 3451 | 'fee': undefined, |
| 3452 | 'name': undefined, |
| 3453 | 'type': type, |
| 3454 | 'limits': { |
| 3455 | 'amount': { |
| 3456 | 'min': undefined, |
| 3457 | 'max': undefined, |
| 3458 | }, |
| 3459 | 'withdraw': { |
nothing calls this directly
no test coverage detected