@riocrypto/common-server 1.0.1950 → 1.0.1953

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.
@@ -30,7 +30,7 @@ class BitsoClient {
30
30
  }
31
31
  createClabe() {
32
32
  return __awaiter(this, void 0, void 0, function* () {
33
- if ([common_1.RioEnv.Sandbox, common_1.RioEnv.Local].includes(process.env.RIO_ENV)) {
33
+ if ([common_1.RioEnv.Sandbox, common_1.RioEnv.Local, common_1.RioEnv.Test].includes(process.env.RIO_ENV)) {
34
34
  throw new Error("Bitso create clabe not allowed in sandbox");
35
35
  }
36
36
  const requestConfig = {
@@ -47,7 +47,7 @@ class BitsoClient {
47
47
  }
48
48
  createReceivingAccount(user, bankAccount) {
49
49
  return __awaiter(this, void 0, void 0, function* () {
50
- if ([common_1.RioEnv.Sandbox, common_1.RioEnv.Local].includes(process.env.RIO_ENV)) {
50
+ if ([common_1.RioEnv.Sandbox, common_1.RioEnv.Local, common_1.RioEnv.Test].includes(process.env.RIO_ENV)) {
51
51
  throw new Error("Bitso create receiving account not allowed in sandbox");
52
52
  }
53
53
  const requestConfig = {
@@ -82,7 +82,7 @@ class BitsoClient {
82
82
  }
83
83
  deleteReceivingAccount(bitsoReceivingAccountId) {
84
84
  return __awaiter(this, void 0, void 0, function* () {
85
- if ([common_1.RioEnv.Sandbox, common_1.RioEnv.Local].includes(process.env.RIO_ENV)) {
85
+ if ([common_1.RioEnv.Sandbox, common_1.RioEnv.Local, common_1.RioEnv.Test].includes(process.env.RIO_ENV)) {
86
86
  throw new Error("Bitso delete receiving account not allowed in sandbox");
87
87
  }
88
88
  const requestConfig = {
@@ -99,7 +99,7 @@ class BitsoClient {
99
99
  }
100
100
  createWithdraw(bitsoReceivingAccountId, amount, concept, rfc) {
101
101
  return __awaiter(this, void 0, void 0, function* () {
102
- if ([common_1.RioEnv.Sandbox, common_1.RioEnv.Local].includes(process.env.RIO_ENV)) {
102
+ if ([common_1.RioEnv.Sandbox, common_1.RioEnv.Local, common_1.RioEnv.Test].includes(process.env.RIO_ENV)) {
103
103
  throw new Error("Bitso withdraw not allowed in sandbox");
104
104
  }
105
105
  const requestConfig = {
@@ -146,7 +146,7 @@ class BitsoClient {
146
146
  }
147
147
  createLimitOrder(asset, amount, price, side) {
148
148
  return __awaiter(this, void 0, void 0, function* () {
149
- if ([common_1.RioEnv.Sandbox, common_1.RioEnv.Local].includes(process.env.RIO_ENV)) {
149
+ if ([common_1.RioEnv.Sandbox, common_1.RioEnv.Local, common_1.RioEnv.Test].includes(process.env.RIO_ENV)) {
150
150
  throw new Error("Bitso limit orders not allowed in sandbox");
151
151
  }
152
152
  const major = amount / price;
@@ -243,7 +243,7 @@ class BitsoClient {
243
243
  }
244
244
  cancelOrder(oid) {
245
245
  return __awaiter(this, void 0, void 0, function* () {
246
- if ([common_1.RioEnv.Sandbox, common_1.RioEnv.Local].includes(process.env.RIO_ENV)) {
246
+ if ([common_1.RioEnv.Sandbox, common_1.RioEnv.Local, common_1.RioEnv.Test].includes(process.env.RIO_ENV)) {
247
247
  throw new Error("Bitso cancel order not allowed in sandbox");
248
248
  }
249
249
  const requestConfig = {
@@ -366,7 +366,7 @@ class BitsoClient {
366
366
  }
367
367
  createCryptoWithdrawal(amount, crypto, address) {
368
368
  return __awaiter(this, void 0, void 0, function* () {
369
- if ([common_1.RioEnv.Sandbox, common_1.RioEnv.Local].includes(process.env.RIO_ENV)) {
369
+ if ([common_1.RioEnv.Sandbox, common_1.RioEnv.Local, common_1.RioEnv.Test].includes(process.env.RIO_ENV)) {
370
370
  throw new Error("Bitso withdraw not allowed in sandbox");
371
371
  }
372
372
  let asset;
@@ -442,7 +442,6 @@ const buildBitsoClient = () => __awaiter(void 0, void 0, void 0, function* () {
442
442
  throw new common_1.SecretManagerError();
443
443
  }
444
444
  const env = process.env.RIO_ENV === common_1.RioEnv.Production ||
445
- process.env.RIO_ENV === common_1.RioEnv.Staging ||
446
445
  process.env.RIO_ENV === common_1.RioEnv.Development
447
446
  ? "production"
448
447
  : "sandbox";
@@ -21,7 +21,7 @@ const uuid_1 = require("uuid");
21
21
  class BridgeClient {
22
22
  constructor(apiKey) {
23
23
  this.apiKey = apiKey;
24
- if ([common_1.RioEnv.Production, common_1.RioEnv.Staging, common_1.RioEnv.Development].includes(process.env.RIO_ENV)) {
24
+ if ([common_1.RioEnv.Production, common_1.RioEnv.Development].includes(process.env.RIO_ENV)) {
25
25
  this.baseUrl = "https://api.bridge.xyz";
26
26
  }
27
27
  else {
@@ -55,7 +55,7 @@ class BridgeClient {
55
55
  }
56
56
  createTransfer(bridgeCustomerId, amountInUSD, source, destination, developerFee) {
57
57
  return __awaiter(this, void 0, void 0, function* () {
58
- if ([common_1.RioEnv.Sandbox, common_1.RioEnv.Local].includes(process.env.RIO_ENV)) {
58
+ if ([common_1.RioEnv.Sandbox, common_1.RioEnv.Local, common_1.RioEnv.Test].includes(process.env.RIO_ENV)) {
59
59
  throw new Error("Bridge transfers are disabled in sandbox mode.");
60
60
  }
61
61
  const { data } = yield axios_with_logging_1.default.post(`${this.baseUrl}/v0/transfers`, {
@@ -112,7 +112,7 @@ class BridgeClient {
112
112
  }
113
113
  createLiquidationAddress(bridgeCustomerId, currency, chain, externalAccountId) {
114
114
  return __awaiter(this, void 0, void 0, function* () {
115
- if ([common_1.RioEnv.Sandbox, common_1.RioEnv.Local].includes(process.env.RIO_ENV)) {
115
+ if ([common_1.RioEnv.Sandbox, common_1.RioEnv.Local, common_1.RioEnv.Test].includes(process.env.RIO_ENV)) {
116
116
  throw new Error("Bridge liquidation addresses are disabled in sandbox mode.");
117
117
  }
118
118
  const { data } = yield axios_with_logging_1.default.post(`${this.baseUrl}/v0/customers/${bridgeCustomerId}/liquidation_addresses`, {
@@ -162,7 +162,7 @@ class BridgeClient {
162
162
  }
163
163
  createPlaidLinkToken(bridgeCustomerId) {
164
164
  return __awaiter(this, void 0, void 0, function* () {
165
- if ([common_1.RioEnv.Sandbox, common_1.RioEnv.Local].includes(process.env.RIO_ENV)) {
165
+ if ([common_1.RioEnv.Sandbox, common_1.RioEnv.Local, common_1.RioEnv.Test].includes(process.env.RIO_ENV)) {
166
166
  throw new Error("Bridge plaid link tokens are disabled in sandbox mode.");
167
167
  }
168
168
  const { data } = yield axios_with_logging_1.default.post(`${this.baseUrl}/v0/customers/${bridgeCustomerId}/plaid_link_requests`, undefined, {
@@ -196,7 +196,7 @@ class BridgeClient {
196
196
  }
197
197
  exchangePlaidPublicToken(linkToken, publicToken) {
198
198
  return __awaiter(this, void 0, void 0, function* () {
199
- if ([common_1.RioEnv.Sandbox, common_1.RioEnv.Local].includes(process.env.RIO_ENV)) {
199
+ if ([common_1.RioEnv.Sandbox, common_1.RioEnv.Local, common_1.RioEnv.Test].includes(process.env.RIO_ENV)) {
200
200
  throw new Error("Bridge plaid exchange public token is disabled in sandbox mode.");
201
201
  }
202
202
  const { data } = yield axios_with_logging_1.default.post(`${this.baseUrl}/v0/plaid_exchange_public_token/${linkToken}`, {
@@ -211,7 +211,7 @@ class BridgeClient {
211
211
  }
212
212
  createExternalAccount(bridgeCustomerId, bankName, accountNumber, routingNumber, accountOwnerName, address) {
213
213
  return __awaiter(this, void 0, void 0, function* () {
214
- if ([common_1.RioEnv.Sandbox, common_1.RioEnv.Local].includes(process.env.RIO_ENV)) {
214
+ if ([common_1.RioEnv.Sandbox, common_1.RioEnv.Local, common_1.RioEnv.Test].includes(process.env.RIO_ENV)) {
215
215
  throw new Error("Bridge external accounts are disabled in sandbox mode.");
216
216
  }
217
217
  const { data } = yield axios_with_logging_1.default.post(`${this.baseUrl}/v0/customers/${bridgeCustomerId}/external_accounts`, {
@@ -30,16 +30,19 @@ class ClusterClient {
30
30
  hostHeader = "";
31
31
  break;
32
32
  case common_1.RioEnv.Development:
33
- hostHeader = "dev.riotransfer.co";
33
+ hostHeader = "app.dev.rio.trade";
34
34
  break;
35
35
  case common_1.RioEnv.Production:
36
- hostHeader = "www.riotransfer.co";
36
+ hostHeader = "app.rio.trade";
37
37
  break;
38
38
  case common_1.RioEnv.Sandbox:
39
- hostHeader = "sandbox.riotransfer.co";
39
+ hostHeader = "app.sandbox.rio.trade";
40
+ break;
41
+ case common_1.RioEnv.Test:
42
+ hostHeader = "app.test.rio.trade";
40
43
  break;
41
44
  default:
42
- hostHeader = "sandbox.riotransfer.co";
45
+ hostHeader = "app.sandbox.rio.trade";
43
46
  }
44
47
  this.axios.defaults.headers.common["Host"] = hostHeader;
45
48
  }
@@ -34,7 +34,7 @@ class CoincoverClient {
34
34
  const highestOnboardingCountry = (0, common_1.getHighestOnboardingStatus)(user).country;
35
35
  return (_b = (_a = user.onboarding[highestOnboardingCountry]) === null || _a === void 0 ? void 0 : _a.address) === null || _b === void 0 ? void 0 : _b.country;
36
36
  };
37
- if ([common_1.RioEnv.Development, common_1.RioEnv.Production, common_1.RioEnv.Staging].includes(process.env.RIO_ENV)) {
37
+ if ([common_1.RioEnv.Development, common_1.RioEnv.Production].includes(process.env.RIO_ENV)) {
38
38
  this.baseUrl = "https://api.txm.coincover.com";
39
39
  }
40
40
  else {
@@ -54,7 +54,7 @@ class FireblocksClient {
54
54
  }
55
55
  withdrawFromExchange(rioId, crypto, address, amountCrypto) {
56
56
  return __awaiter(this, void 0, void 0, function* () {
57
- if ([common_1.RioEnv.Sandbox, common_1.RioEnv.Local].includes(process.env.RIO_ENV)) {
57
+ if ([common_1.RioEnv.Sandbox, common_1.RioEnv.Local, common_1.RioEnv.Test].includes(process.env.RIO_ENV)) {
58
58
  throw new Error("Withdrawals are disabled in sandbox mode.");
59
59
  }
60
60
  yield this.fireblocks.createTransaction({
@@ -85,7 +85,7 @@ class FireblocksClient {
85
85
  if (destination.address && destination.fireblocksWalletId) {
86
86
  throw new Error("Either address or fireblocksWalletId must be provided, not both.");
87
87
  }
88
- if ([common_1.RioEnv.Sandbox, common_1.RioEnv.Local].includes(process.env.RIO_ENV)) {
88
+ if ([common_1.RioEnv.Sandbox, common_1.RioEnv.Local, common_1.RioEnv.Test].includes(process.env.RIO_ENV)) {
89
89
  throw new Error("Withdrawals are disabled in sandbox mode.");
90
90
  }
91
91
  const response = yield this.fireblocks.createTransaction({
@@ -279,7 +279,7 @@ class FireblocksClient {
279
279
  }
280
280
  createVault(userId, name, type, number) {
281
281
  return __awaiter(this, void 0, void 0, function* () {
282
- if ([common_1.RioEnv.Sandbox, common_1.RioEnv.Local].includes(process.env.RIO_ENV)) {
282
+ if ([common_1.RioEnv.Sandbox, common_1.RioEnv.Local, common_1.RioEnv.Test].includes(process.env.RIO_ENV)) {
283
283
  throw new Error("Vault creation is disabled in sandbox mode.");
284
284
  }
285
285
  let vaultName = number
@@ -291,7 +291,7 @@ class FireblocksClient {
291
291
  }
292
292
  createWallet(vaultId, crypto) {
293
293
  return __awaiter(this, void 0, void 0, function* () {
294
- if ([common_1.RioEnv.Sandbox, common_1.RioEnv.Local].includes(process.env.RIO_ENV)) {
294
+ if ([common_1.RioEnv.Sandbox, common_1.RioEnv.Local, common_1.RioEnv.Test].includes(process.env.RIO_ENV)) {
295
295
  throw new Error("Wallet creation is disabled in sandbox mode.");
296
296
  }
297
297
  const wallet = yield this.fireblocks.createVaultAsset(vaultId, crypto);
@@ -300,7 +300,7 @@ class FireblocksClient {
300
300
  }
301
301
  internalTransfer(rioId, crypto, sourceVaultId, destinationVaultId, amountCrypto, notes) {
302
302
  return __awaiter(this, void 0, void 0, function* () {
303
- if ([common_1.RioEnv.Sandbox, common_1.RioEnv.Local].includes(process.env.RIO_ENV)) {
303
+ if ([common_1.RioEnv.Sandbox, common_1.RioEnv.Local, common_1.RioEnv.Test].includes(process.env.RIO_ENV)) {
304
304
  throw new Error("Internal transfers are disabled in sandbox mode.");
305
305
  }
306
306
  const response = yield this.fireblocks.createTransaction({
@@ -324,7 +324,7 @@ class FireblocksClient {
324
324
  }
325
325
  externalTransfer(rioId, crypto, sourceVaultId, destinationAddress, amountCrypto, notes) {
326
326
  return __awaiter(this, void 0, void 0, function* () {
327
- if ([common_1.RioEnv.Sandbox, common_1.RioEnv.Local].includes(process.env.RIO_ENV)) {
327
+ if ([common_1.RioEnv.Sandbox, common_1.RioEnv.Local, common_1.RioEnv.Test].includes(process.env.RIO_ENV)) {
328
328
  throw new Error("External transfers are disabled in sandbox mode.");
329
329
  }
330
330
  const response = yield this.fireblocks.createTransaction({
@@ -350,7 +350,7 @@ class FireblocksClient {
350
350
  }
351
351
  transferToExchange(rioId, crypto, sourceVaultId, destinationExchangeId, amountCrypto, notes) {
352
352
  return __awaiter(this, void 0, void 0, function* () {
353
- if ([common_1.RioEnv.Sandbox, common_1.RioEnv.Local].includes(process.env.RIO_ENV)) {
353
+ if ([common_1.RioEnv.Sandbox, common_1.RioEnv.Local, common_1.RioEnv.Test].includes(process.env.RIO_ENV)) {
354
354
  throw new Error("Transfers to exchanges are disabled in sandbox mode.");
355
355
  }
356
356
  const response = yield this.fireblocks.createTransaction({
@@ -374,7 +374,7 @@ class FireblocksClient {
374
374
  }
375
375
  transferFromExchangeToExchange(rioId, crypto, sourceExchangeId, destinationExchangeId, amountCrypto, notes) {
376
376
  return __awaiter(this, void 0, void 0, function* () {
377
- if ([common_1.RioEnv.Sandbox, common_1.RioEnv.Local].includes(process.env.RIO_ENV)) {
377
+ if ([common_1.RioEnv.Sandbox, common_1.RioEnv.Local, common_1.RioEnv.Test].includes(process.env.RIO_ENV)) {
378
378
  throw new Error("Transfers from exchanges to exchanges are disabled in sandbox mode.");
379
379
  }
380
380
  const response = yield this.fireblocks.createTransaction({
@@ -398,7 +398,7 @@ class FireblocksClient {
398
398
  }
399
399
  transferFromExchange(rioId, crypto, sourceExchangeId, destinationVaultId, amountCrypto, notes) {
400
400
  return __awaiter(this, void 0, void 0, function* () {
401
- if ([common_1.RioEnv.Sandbox, common_1.RioEnv.Local].includes(process.env.RIO_ENV)) {
401
+ if ([common_1.RioEnv.Sandbox, common_1.RioEnv.Local, common_1.RioEnv.Test].includes(process.env.RIO_ENV)) {
402
402
  throw new Error("Transfers from exchanges are disabled in sandbox mode.");
403
403
  }
404
404
  const response = yield this.fireblocks.createTransaction({
@@ -422,7 +422,7 @@ class FireblocksClient {
422
422
  }
423
423
  sweep(rioId, vaultId, assetId, amount) {
424
424
  return __awaiter(this, void 0, void 0, function* () {
425
- if ([common_1.RioEnv.Sandbox, common_1.RioEnv.Local].includes(process.env.RIO_ENV)) {
425
+ if ([common_1.RioEnv.Sandbox, common_1.RioEnv.Local, common_1.RioEnv.Test].includes(process.env.RIO_ENV)) {
426
426
  throw new Error("Sweeps are disabled in sandbox mode.");
427
427
  }
428
428
  yield this.fireblocks.createTransaction({
@@ -63,8 +63,8 @@ class SecretManagerClient {
63
63
  else if (this.env === common_1.RioEnv.Sandbox || this.env === common_1.RioEnv.Local) {
64
64
  file = "sandbox-secrets";
65
65
  }
66
- else if (this.env === common_1.RioEnv.Staging) {
67
- file = "staging-secrets";
66
+ else if (this.env === common_1.RioEnv.Test) {
67
+ file = "test-secrets";
68
68
  }
69
69
  else if (this.env === common_1.RioEnv.Production) {
70
70
  file = "production-secrets";
@@ -3,7 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.notSandbox = void 0;
4
4
  const common_1 = require("@riocrypto/common");
5
5
  const notSandbox = (req, res, next) => {
6
- if (process.env.RIO_ENV === common_1.RioEnv.Sandbox) {
6
+ if (process.env.RIO_ENV === common_1.RioEnv.Sandbox ||
7
+ process.env.RIO_ENV === common_1.RioEnv.Test) {
7
8
  throw new common_1.UnavailableInSandboxError();
8
9
  }
9
10
  next();
@@ -16,6 +16,7 @@ interface InternalTradeAttrs {
16
16
  bitsoOrderId?: string;
17
17
  amountFilled?: number;
18
18
  limitPrice?: number;
19
+ coinbaseConversionId?: string;
19
20
  }
20
21
  interface InternalTradeDoc extends mongoose.Document {
21
22
  id: string;
@@ -34,6 +35,7 @@ interface InternalTradeDoc extends mongoose.Document {
34
35
  bitsoOrderId?: string;
35
36
  amountFilled?: number;
36
37
  limitPrice?: number;
38
+ coinbaseConversionId?: string;
37
39
  }
38
40
  interface InternalTradeModel extends mongoose.Model<InternalTradeDoc> {
39
41
  build(attrs: InternalTradeAttrs): InternalTradeDoc;
@@ -59,6 +59,9 @@ const buildInternalTrade = (mongoose) => {
59
59
  limitPrice: {
60
60
  type: Number,
61
61
  },
62
+ coinbaseConversionId: {
63
+ type: String,
64
+ },
62
65
  }, {
63
66
  toJSON: {
64
67
  transform(doc, ret) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riocrypto/common-server",
3
- "version": "1.0.1950",
3
+ "version": "1.0.1953",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",
@@ -28,7 +28,7 @@
28
28
  "@google-cloud/secret-manager": "^5.3.0",
29
29
  "@google-cloud/storage": "^6.9.5",
30
30
  "@hyperdx/node-opentelemetry": "^0.7.0",
31
- "@riocrypto/common": "^1.0.1716",
31
+ "@riocrypto/common": "^1.0.1719",
32
32
  "@types/express": "^4.17.13",
33
33
  "axios": "^1.7.4",
34
34
  "crypto-js": "^4.2.0",