@riocrypto/common 1.0.442 → 1.0.444

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,35 @@ 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
+ console.log("getBuyQuote", amount, crypto, fiat);
95
+ if (this.env === "production") {
96
+ console.log("its prod");
97
+ const exchange = yield this.getOptimalExchange(crypto);
98
+ if (!exchange)
99
+ throw new Error("Unable to get optimal exchange");
100
+ let ticker = yield exchange.fetchTicker(`${crypto}/${fiat}`);
101
+ if (!ticker.vwap)
102
+ throw new Error("Unable to get ticker vwap");
103
+ return {
104
+ price: ticker.vwap,
105
+ amountCrypto: amount / ticker.vwap,
106
+ amountFiat: amount,
107
+ crypto,
108
+ fiat,
109
+ side: side_1.Side.Buy,
110
+ };
111
+ }
112
+ else {
113
+ console.log("its dev");
114
+ return {
115
+ price: 0.5,
116
+ amountCrypto: amount,
117
+ amountFiat: amount,
118
+ crypto,
119
+ fiat,
120
+ side: side_1.Side.Buy,
121
+ };
122
+ }
108
123
  });
109
124
  }
110
125
  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.444",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",