@riocrypto/common-server 1.0.1546 → 1.0.1549

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.
@@ -76,6 +76,9 @@ class BitsoClient {
76
76
  }
77
77
  createWithdraw(bitsoReceivingAccountId, amount, concept, rfc) {
78
78
  return __awaiter(this, void 0, void 0, function* () {
79
+ if (process.env.RIO_ENV === common_1.RioEnv.Sandbox) {
80
+ throw new Error("Bitso withdraw not allowed in sandbox");
81
+ }
79
82
  const requestConfig = {
80
83
  method: "POST",
81
84
  url: `${this.baseUrl}/api/v3/withdrawals`,
@@ -120,6 +123,9 @@ class BitsoClient {
120
123
  }
121
124
  createLimitOrder(asset, amount, price, side) {
122
125
  return __awaiter(this, void 0, void 0, function* () {
126
+ if (process.env.RIO_ENV === common_1.RioEnv.Sandbox) {
127
+ throw new Error("Bitso limit orders not allowed in sandbox");
128
+ }
123
129
  const major = amount / price;
124
130
  const requestConfig = {
125
131
  method: "POST",
@@ -54,6 +54,9 @@ class BridgeClient {
54
54
  }
55
55
  createTransfer(bridgeCustomerId, amountInUSD, source, destination, developerFee) {
56
56
  return __awaiter(this, void 0, void 0, function* () {
57
+ if (process.env.RIO_ENV === common_1.RioEnv.Sandbox) {
58
+ throw new Error("Bridge transfers are disabled in sandbox mode.");
59
+ }
57
60
  const { data } = yield axios_1.default.post(`${this.baseUrl}/v0/transfers`, {
58
61
  amount: amountInUSD,
59
62
  on_behalf_of: bridgeCustomerId,
@@ -101,6 +104,9 @@ class BridgeClient {
101
104
  }
102
105
  createLiquidationAddress(bridgeCustomerId, currency, chain, externalAccountId) {
103
106
  return __awaiter(this, void 0, void 0, function* () {
107
+ if (process.env.RIO_ENV === common_1.RioEnv.Sandbox) {
108
+ throw new Error("Bridge liquidation addresses are disabled in sandbox mode.");
109
+ }
104
110
  const { data } = yield axios_1.default.post(`${this.baseUrl}/v0/customers/${bridgeCustomerId}/liquidation_addresses`, {
105
111
  currency,
106
112
  chain,
@@ -148,6 +154,9 @@ class BridgeClient {
148
154
  }
149
155
  createPlaidLinkToken(bridgeCustomerId) {
150
156
  return __awaiter(this, void 0, void 0, function* () {
157
+ if (process.env.RIO_ENV === common_1.RioEnv.Sandbox) {
158
+ throw new Error("Bridge plaid link tokens are disabled in sandbox mode.");
159
+ }
151
160
  const { data } = yield axios_1.default.post(`${this.baseUrl}/v0/customers/${bridgeCustomerId}/plaid_link_requests`, undefined, {
152
161
  headers: {
153
162
  "Api-Key": this.apiKey,
@@ -175,12 +184,14 @@ class BridgeClient {
175
184
  "Api-Key": this.apiKey,
176
185
  },
177
186
  });
178
- console.log("returning data", data);
179
- return data.data;
187
+ return data;
180
188
  });
181
189
  }
182
190
  exchangePlaidPublicToken(linkToken, publicToken) {
183
191
  return __awaiter(this, void 0, void 0, function* () {
192
+ if (process.env.RIO_ENV === common_1.RioEnv.Sandbox) {
193
+ throw new Error("Bridge plaid exchange public token is disabled in sandbox mode.");
194
+ }
184
195
  const { data } = yield axios_1.default.post(`${this.baseUrl}/v0/plaid_exchange_public_token/${linkToken}`, {
185
196
  public_token: publicToken,
186
197
  }, {
@@ -193,6 +204,9 @@ class BridgeClient {
193
204
  }
194
205
  createExternalAccount(bridgeCustomerId, bankName, accountNumber, routingNumber, accountOwnerName, address) {
195
206
  return __awaiter(this, void 0, void 0, function* () {
207
+ if (process.env.RIO_ENV === common_1.RioEnv.Sandbox) {
208
+ throw new Error("Bridge external accounts are disabled in sandbox mode.");
209
+ }
196
210
  const { data } = yield axios_1.default.post(`${this.baseUrl}/v0/customers/${bridgeCustomerId}/external_accounts`, {
197
211
  type: "wire",
198
212
  bank_name: bankName,
@@ -56,6 +56,9 @@ class FireblocksClient {
56
56
  }
57
57
  withdrawFromExchange(crypto, address, amountCrypto) {
58
58
  return __awaiter(this, void 0, void 0, function* () {
59
+ if (process.env.RIO_ENV === common_1.RioEnv.Sandbox) {
60
+ throw new Error("Withdrawals are disabled in sandbox mode.");
61
+ }
59
62
  yield this.fireblocks.createTransaction({
60
63
  assetId: crypto,
61
64
  source: {
@@ -75,6 +78,9 @@ class FireblocksClient {
75
78
  }
76
79
  withdrawFromVault(crypto, address, amountCrypto) {
77
80
  return __awaiter(this, void 0, void 0, function* () {
81
+ if (process.env.RIO_ENV === common_1.RioEnv.Sandbox) {
82
+ throw new Error("Withdrawals are disabled in sandbox mode.");
83
+ }
78
84
  const response = yield this.fireblocks.createTransaction({
79
85
  assetId: crypto,
80
86
  source: {
@@ -212,18 +218,27 @@ class FireblocksClient {
212
218
  }
213
219
  createVault(userId, name, type) {
214
220
  return __awaiter(this, void 0, void 0, function* () {
221
+ if (process.env.RIO_ENV === common_1.RioEnv.Sandbox) {
222
+ throw new Error("Vault creation is disabled in sandbox mode.");
223
+ }
215
224
  const vault = yield this.fireblocks.createVaultAccount(`${name} - ${userId} - ${type}`, false, userId, true);
216
225
  return vault.id;
217
226
  });
218
227
  }
219
228
  createWallet(vaultId, crypto) {
220
229
  return __awaiter(this, void 0, void 0, function* () {
230
+ if (process.env.RIO_ENV === common_1.RioEnv.Sandbox) {
231
+ throw new Error("Wallet creation is disabled in sandbox mode.");
232
+ }
221
233
  const wallet = yield this.fireblocks.createVaultAsset(vaultId, crypto);
222
234
  return wallet.address;
223
235
  });
224
236
  }
225
237
  internalTransfer(crypto, sourceVaultId, destinationVaultId, amountCrypto, notes) {
226
238
  return __awaiter(this, void 0, void 0, function* () {
239
+ if (process.env.RIO_ENV === common_1.RioEnv.Sandbox) {
240
+ throw new Error("Internal transfers are disabled in sandbox mode.");
241
+ }
227
242
  const response = yield this.fireblocks.createTransaction({
228
243
  assetId: crypto,
229
244
  source: {
@@ -243,6 +258,9 @@ class FireblocksClient {
243
258
  }
244
259
  externalTransfer(crypto, sourceVaultId, destinationAddress, amountCrypto, notes) {
245
260
  return __awaiter(this, void 0, void 0, function* () {
261
+ if (process.env.RIO_ENV === common_1.RioEnv.Sandbox) {
262
+ throw new Error("External transfers are disabled in sandbox mode.");
263
+ }
246
264
  const response = yield this.fireblocks.createTransaction({
247
265
  assetId: crypto,
248
266
  source: {
@@ -264,6 +282,9 @@ class FireblocksClient {
264
282
  }
265
283
  transferToExchange(crypto, sourceVaultId, destinationExchangeId, amountCrypto, notes) {
266
284
  return __awaiter(this, void 0, void 0, function* () {
285
+ if (process.env.RIO_ENV === common_1.RioEnv.Sandbox) {
286
+ throw new Error("Transfers to exchanges are disabled in sandbox mode.");
287
+ }
267
288
  const response = yield this.fireblocks.createTransaction({
268
289
  assetId: crypto,
269
290
  source: {
@@ -283,6 +304,9 @@ class FireblocksClient {
283
304
  }
284
305
  transferFromExchange(crypto, sourceExchangeId, destinationVaultId, amountCrypto, notes) {
285
306
  return __awaiter(this, void 0, void 0, function* () {
307
+ if (process.env.RIO_ENV === common_1.RioEnv.Sandbox) {
308
+ throw new Error("Transfers from exchanges are disabled in sandbox mode.");
309
+ }
286
310
  const response = yield this.fireblocks.createTransaction({
287
311
  assetId: crypto,
288
312
  source: {
@@ -302,6 +326,9 @@ class FireblocksClient {
302
326
  }
303
327
  sweep(vaultId, assetId, amount) {
304
328
  return __awaiter(this, void 0, void 0, function* () {
329
+ if (process.env.RIO_ENV === common_1.RioEnv.Sandbox) {
330
+ throw new Error("Sweeps are disabled in sandbox mode.");
331
+ }
305
332
  yield this.fireblocks.createTransaction({
306
333
  assetId: assetId,
307
334
  source: {
@@ -26,6 +26,9 @@ class InvopopClient {
26
26
  createJob(mongoose, order, user) {
27
27
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
28
28
  return __awaiter(this, void 0, void 0, function* () {
29
+ if (process.env.RIO_ENV === common_1.RioEnv.Sandbox) {
30
+ throw new Error("Cannot create invoice in sandbox environment");
31
+ }
29
32
  const uuid = (0, uuid_1.v1)();
30
33
  const operationDate = new Date(order.createdAt);
31
34
  const operationYear = operationDate.getFullYear();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riocrypto/common-server",
3
- "version": "1.0.1546",
3
+ "version": "1.0.1549",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",