@@ -148,6 +148,9 @@ export default class wizardswap extends Exchange {
148148 } ,
149149 } ,
150150 'options' : {
151+ // Route via Tor hidden service; requires a SOCKS proxy at the transport layer.
152+ 'useOnion' : false ,
153+ 'onionUrl' : 'http://wizardswgtu2ovor7r2esg3cxdpt7tv4nrugi32lldv53zmtonbz6sid.onion/api' ,
151154 // Hardcoded fallback when both /currency and /currencies
152155 // endpoints are unreachable (e.g. DDoS-Guard blocks all GET).
153156 'defaultCurrencyIds' : [
@@ -193,25 +196,10 @@ export default class wizardswap extends Exchange {
193196 // GET /api/currencies returns simple array (may be blocked by DDoS-Guard):
194197 // ["btc","xmr","eth",...]
195198 //
196- let richResponse = undefined ;
197- try {
198- richResponse = await this . publicGetCurrency ( params ) ;
199- } catch ( e ) {
200- richResponse = undefined ;
201- }
199+ const richResponse = await this . publicGetCurrency ( params ) ;
202200 if ( Array . isArray ( richResponse ) && richResponse . length > 0 ) {
203201 return this . parseRichCurrencies ( richResponse ) ;
204202 }
205- // Fallback: try the simple /currencies endpoint
206- let simpleResponse = undefined ;
207- try {
208- simpleResponse = await this . publicGetCurrencies ( params ) ;
209- } catch ( e ) {
210- simpleResponse = undefined ;
211- }
212- if ( Array . isArray ( simpleResponse ) && simpleResponse . length > 0 ) {
213- return this . parseSimpleCurrencies ( simpleResponse ) ;
214- }
215203 // Last resort: use hardcoded list
216204 const defaultIds = this . safeList ( this . options , 'defaultCurrencyIds' , [ ] ) ;
217205 return this . parseSimpleCurrencies ( defaultIds ) ;
@@ -233,7 +221,7 @@ export default class wizardswap extends Exchange {
233221 const decimals = this . safeInteger ( entry , 'decimals' ) ;
234222 let precision = undefined ;
235223 if ( decimals !== undefined ) {
236- precision = this . parseNumber ( this . decimalToPrecision ( 1 , 0 , decimals , 4 ) ) ;
224+ precision = this . parseNumber ( this . parsePrecision ( this . safeString ( entry , ' decimals' ) ) ) ;
237225 }
238226 const minAmt = this . safeNumber ( entry , 'minamt' ) ;
239227 result [ code ] = this . safeCurrencyStructure ( {
@@ -288,7 +276,10 @@ export default class wizardswap extends Exchange {
288276 * @returns {Market[] } an array of objects representing market data
289277 */
290278 async fetchMarkets ( params = { } ) : Promise < Market [ ] > {
291- const currencies = await this . fetchCurrencies ( params ) ;
279+ let currencies = this . options [ 'cachedCurrencies' ] ;
280+ if ( ! currencies ) {
281+ currencies = await this . fetchCurrencies ( params ) ;
282+ }
292283 //
293284 // GET /api/pairs returns:
294285 // {
@@ -297,12 +288,7 @@ export default class wizardswap extends Exchange {
297288 // ...
298289 // }
299290 //
300- let pairsData = undefined ;
301- try {
302- pairsData = await this . publicGetPairs ( params ) ;
303- } catch ( e ) {
304- pairsData = undefined ;
305- }
291+ const pairsData = await this . publicGetPairs ( params ) ;
306292 const result = [ ] ;
307293 if ( pairsData !== undefined && typeof pairsData === 'object' ) {
308294 const baseIds = Object . keys ( pairsData ) ;
@@ -630,7 +616,12 @@ export default class wizardswap extends Exchange {
630616 }
631617
632618 sign ( path , api = 'public' , method = 'GET' , params = { } , headers = undefined , body = undefined ) {
633- let url = this . urls [ 'api' ] [ 'rest' ] + '/' + this . implodeParams ( path , params ) ;
619+ const useOnion = this . safeBool ( this . options , 'useOnion' , false ) ;
620+ let baseUrl = this . urls [ 'api' ] [ 'rest' ] ;
621+ if ( useOnion ) {
622+ baseUrl = this . safeString ( this . options , 'onionUrl' , baseUrl ) ;
623+ }
624+ let url = baseUrl + '/' + this . implodeParams ( path , params ) ;
634625 const query = this . omit ( params , this . extractParams ( path ) ) ;
635626 if ( method === 'GET' ) {
636627 if ( Object . keys ( query ) . length ) {
0 commit comments