@riocrypto/common 1.0.442 → 1.0.443

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -91,20 +91,32 @@ class CCXTClient {
91
91
  }
92
92
  getBuyQuote(amount, crypto, fiat) {
93
93
  return __awaiter(this, void 0, void 0, function* () {
94
- const exchange = yield this.getOptimalExchange(crypto);
95
- if (!exchange)
96
- throw new Error("Unable to get optimal exchange");
97
- let ticker = yield exchange.fetchTicker(`${crypto}/${fiat}`);
98
- if (!ticker.vwap)
99
- throw new Error("Unable to get ticker vwap");
100
- return {
101
- price: ticker.vwap,
102
- amountCrypto: amount / ticker.vwap,
103
- amountFiat: amount,
104
- crypto,
105
- fiat,
106
- side: side_1.Side.Buy,
107
- };
94
+ if (this.env === "production") {
95
+ const exchange = yield this.getOptimalExchange(crypto);
96
+ if (!exchange)
97
+ throw new Error("Unable to get optimal exchange");
98
+ let ticker = yield exchange.fetchTicker(`${crypto}/${fiat}`);
99
+ if (!ticker.vwap)
100
+ throw new Error("Unable to get ticker vwap");
101
+ return {
102
+ price: ticker.vwap,
103
+ amountCrypto: amount / ticker.vwap,
104
+ amountFiat: amount,
105
+ crypto,
106
+ fiat,
107
+ side: side_1.Side.Buy,
108
+ };
109
+ }
110
+ else {
111
+ return {
112
+ price: 0.5,
113
+ amountCrypto: amount,
114
+ amountFiat: amount,
115
+ crypto,
116
+ fiat,
117
+ side: side_1.Side.Buy,
118
+ };
119
+ }
108
120
  });
109
121
  }
110
122
  getOptimalExchange(crypto) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riocrypto/common",
3
- "version": "1.0.442",
3
+ "version": "1.0.443",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",