@riocrypto/common-server 1.0.1547 → 1.0.1550

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",
@@ -29,6 +29,9 @@ class BridgeClient {
29
29
  }
30
30
  createKYCLink(fullName, email, userType) {
31
31
  return __awaiter(this, void 0, void 0, function* () {
32
+ if (process.env.RIO_ENV === common_1.RioEnv.Sandbox) {
33
+ throw new Error("Bridge KYC links are disabled in sandbox mode.");
34
+ }
32
35
  const { data } = yield axios_1.default.post(`${this.baseUrl}/v0/kyc_links`, {
33
36
  full_name: fullName,
34
37
  email,
@@ -54,6 +57,9 @@ class BridgeClient {
54
57
  }
55
58
  createTransfer(bridgeCustomerId, amountInUSD, source, destination, developerFee) {
56
59
  return __awaiter(this, void 0, void 0, function* () {
60
+ if (process.env.RIO_ENV === common_1.RioEnv.Sandbox) {
61
+ throw new Error("Bridge transfers are disabled in sandbox mode.");
62
+ }
57
63
  const { data } = yield axios_1.default.post(`${this.baseUrl}/v0/transfers`, {
58
64
  amount: amountInUSD,
59
65
  on_behalf_of: bridgeCustomerId,
@@ -101,6 +107,9 @@ class BridgeClient {
101
107
  }
102
108
  createLiquidationAddress(bridgeCustomerId, currency, chain, externalAccountId) {
103
109
  return __awaiter(this, void 0, void 0, function* () {
110
+ if (process.env.RIO_ENV === common_1.RioEnv.Sandbox) {
111
+ throw new Error("Bridge liquidation addresses are disabled in sandbox mode.");
112
+ }
104
113
  const { data } = yield axios_1.default.post(`${this.baseUrl}/v0/customers/${bridgeCustomerId}/liquidation_addresses`, {
105
114
  currency,
106
115
  chain,
@@ -148,6 +157,9 @@ class BridgeClient {
148
157
  }
149
158
  createPlaidLinkToken(bridgeCustomerId) {
150
159
  return __awaiter(this, void 0, void 0, function* () {
160
+ if (process.env.RIO_ENV === common_1.RioEnv.Sandbox) {
161
+ throw new Error("Bridge plaid link tokens are disabled in sandbox mode.");
162
+ }
151
163
  const { data } = yield axios_1.default.post(`${this.baseUrl}/v0/customers/${bridgeCustomerId}/plaid_link_requests`, undefined, {
152
164
  headers: {
153
165
  "Api-Key": this.apiKey,
@@ -180,6 +192,9 @@ class BridgeClient {
180
192
  }
181
193
  exchangePlaidPublicToken(linkToken, publicToken) {
182
194
  return __awaiter(this, void 0, void 0, function* () {
195
+ if (process.env.RIO_ENV === common_1.RioEnv.Sandbox) {
196
+ throw new Error("Bridge plaid exchange public token is disabled in sandbox mode.");
197
+ }
183
198
  const { data } = yield axios_1.default.post(`${this.baseUrl}/v0/plaid_exchange_public_token/${linkToken}`, {
184
199
  public_token: publicToken,
185
200
  }, {
@@ -192,6 +207,9 @@ class BridgeClient {
192
207
  }
193
208
  createExternalAccount(bridgeCustomerId, bankName, accountNumber, routingNumber, accountOwnerName, address) {
194
209
  return __awaiter(this, void 0, void 0, function* () {
210
+ if (process.env.RIO_ENV === common_1.RioEnv.Sandbox) {
211
+ throw new Error("Bridge external accounts are disabled in sandbox mode.");
212
+ }
195
213
  const { data } = yield axios_1.default.post(`${this.baseUrl}/v0/customers/${bridgeCustomerId}/external_accounts`, {
196
214
  type: "wire",
197
215
  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.1547",
3
+ "version": "1.0.1550",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",