@riocrypto/common-server 1.0.2924 → 1.0.2925
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.
- package/build/clients/coincover-client.js +1 -0
- package/build/clients/fireblocks-client.js +1 -0
- package/build/helpers/assert-crypto-launched.d.ts +4 -0
- package/build/helpers/assert-crypto-launched.js +33 -0
- package/build/helpers/get-network-fees.js +3 -0
- package/build/index.d.ts +1 -0
- package/build/index.js +1 -0
- package/build/models/rio-settings.d.ts +2 -0
- package/build/models/rio-settings.js +5 -0
- package/package.json +2 -2
|
@@ -48,6 +48,7 @@ class CoincoverClient {
|
|
|
48
48
|
[common_1.Crypto.USDCPolygon]: "usd-coin",
|
|
49
49
|
[common_1.Crypto.USDCStellar]: "usd-coin",
|
|
50
50
|
[common_1.Crypto.USDCBase]: "usd-coin",
|
|
51
|
+
[common_1.Crypto.USDCArc]: "usd-coin",
|
|
51
52
|
[common_1.Crypto.USDCSolana]: "usd-coin",
|
|
52
53
|
[common_1.Crypto.USDCPolygonBridged]: "usd-coin",
|
|
53
54
|
[common_1.Crypto.USDCTempoBridged]: "usd-coin",
|
|
@@ -238,6 +238,7 @@ class FireblocksClient {
|
|
|
238
238
|
common_1.Crypto.USDCBase,
|
|
239
239
|
common_1.Crypto.USDCPolygonBridged,
|
|
240
240
|
common_1.Crypto.USDCTempoBridged,
|
|
241
|
+
common_1.Crypto.USDCArc,
|
|
241
242
|
common_1.Crypto.USDCSolana,
|
|
242
243
|
common_1.Crypto.USDTEthereum,
|
|
243
244
|
common_1.Crypto.USDTPolygon,
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { Crypto } from "@riocrypto/common";
|
|
2
|
+
import { Mongoose } from "mongoose";
|
|
3
|
+
export declare const getLaunchedCryptos: (mongoose: Mongoose) => Promise<Crypto[]>;
|
|
4
|
+
export declare const assertCryptoLaunched: (mongoose: Mongoose, crypto?: Crypto | string | null) => Promise<void>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.assertCryptoLaunched = exports.getLaunchedCryptos = void 0;
|
|
13
|
+
const common_1 = require("@riocrypto/common");
|
|
14
|
+
const rio_settings_1 = require("../models/rio-settings");
|
|
15
|
+
const getLaunchedCryptos = (mongoose) => __awaiter(void 0, void 0, void 0, function* () {
|
|
16
|
+
var _a;
|
|
17
|
+
const RioSettings = (0, rio_settings_1.buildRioSettings)(mongoose);
|
|
18
|
+
const rioSettings = yield RioSettings.findOne().select("launchedCryptos");
|
|
19
|
+
return (_a = rioSettings === null || rioSettings === void 0 ? void 0 : rioSettings.launchedCryptos) !== null && _a !== void 0 ? _a : [];
|
|
20
|
+
});
|
|
21
|
+
exports.getLaunchedCryptos = getLaunchedCryptos;
|
|
22
|
+
// Rejects a customer-facing request for a crypto that is still behind the
|
|
23
|
+
// launch switch. Cryptos outside PRELAUNCH_CRYPTOS never touch the database.
|
|
24
|
+
const assertCryptoLaunched = (mongoose, crypto) => __awaiter(void 0, void 0, void 0, function* () {
|
|
25
|
+
if (!crypto || !(0, common_1.isPrelaunchCrypto)(crypto)) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
const launchedCryptos = yield (0, exports.getLaunchedCryptos)(mongoose);
|
|
29
|
+
if (!(0, common_1.isCryptoLaunched)(crypto, launchedCryptos)) {
|
|
30
|
+
throw new common_1.CryptoNotLaunchedError(crypto);
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
exports.assertCryptoLaunched = assertCryptoLaunched;
|
|
@@ -19,6 +19,9 @@ const getNetworkFees = (crypto, conversionRateToUSD) => {
|
|
|
19
19
|
else if (crypto === common_1.Crypto.USDCTempoBridged) {
|
|
20
20
|
withdrawFeeInUSD = 0.01;
|
|
21
21
|
}
|
|
22
|
+
else if (crypto === common_1.Crypto.USDCArc) {
|
|
23
|
+
withdrawFeeInUSD = 0.01;
|
|
24
|
+
}
|
|
22
25
|
else if (crypto === common_1.Crypto.USDCBase || crypto === common_1.Crypto.EURCBase) {
|
|
23
26
|
withdrawFeeInUSD = 0.01;
|
|
24
27
|
}
|
package/build/index.d.ts
CHANGED
|
@@ -187,6 +187,7 @@ export * from "./helpers/get-exchange-rates-with-markups";
|
|
|
187
187
|
export * from "./helpers/get-order-from-static-reference";
|
|
188
188
|
export * from "./helpers/get-bulk-bank-payment-from-static-reference";
|
|
189
189
|
export * from "./helpers/is-after-hours";
|
|
190
|
+
export * from "./helpers/assert-crypto-launched";
|
|
190
191
|
export * from "./helpers/interpolate-forward-curve-rate";
|
|
191
192
|
export * from "./helpers/find-user-tier-forward-curve-rate";
|
|
192
193
|
export * from "./helpers/resolve-forward-curve-rate";
|
package/build/index.js
CHANGED
|
@@ -203,6 +203,7 @@ __exportStar(require("./helpers/get-exchange-rates-with-markups"), exports);
|
|
|
203
203
|
__exportStar(require("./helpers/get-order-from-static-reference"), exports);
|
|
204
204
|
__exportStar(require("./helpers/get-bulk-bank-payment-from-static-reference"), exports);
|
|
205
205
|
__exportStar(require("./helpers/is-after-hours"), exports);
|
|
206
|
+
__exportStar(require("./helpers/assert-crypto-launched"), exports);
|
|
206
207
|
__exportStar(require("./helpers/interpolate-forward-curve-rate"), exports);
|
|
207
208
|
__exportStar(require("./helpers/find-user-tier-forward-curve-rate"), exports);
|
|
208
209
|
__exportStar(require("./helpers/resolve-forward-curve-rate"), exports);
|
|
@@ -97,6 +97,7 @@ interface RioSettingsAttrs {
|
|
|
97
97
|
};
|
|
98
98
|
};
|
|
99
99
|
};
|
|
100
|
+
launchedCryptos?: Crypto[];
|
|
100
101
|
}
|
|
101
102
|
interface RioSettingsDoc extends mongoose.Document {
|
|
102
103
|
platformFee: number;
|
|
@@ -194,6 +195,7 @@ interface RioSettingsDoc extends mongoose.Document {
|
|
|
194
195
|
};
|
|
195
196
|
};
|
|
196
197
|
};
|
|
198
|
+
launchedCryptos?: Crypto[];
|
|
197
199
|
}
|
|
198
200
|
interface RioSettingsModel extends mongoose.Model<RioSettingsDoc> {
|
|
199
201
|
build(attrs: RioSettingsAttrs): HydratedDocument<RioSettingsDoc>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.buildRioSettings = void 0;
|
|
4
|
+
const common_1 = require("@riocrypto/common");
|
|
4
5
|
const buildRioSettings = (mongoose) => {
|
|
5
6
|
// if model is already defined, return it
|
|
6
7
|
if (mongoose.models.RioSettings) {
|
|
@@ -86,6 +87,10 @@ const buildRioSettings = (mongoose) => {
|
|
|
86
87
|
isMaintenanceModeActive: {
|
|
87
88
|
type: Object,
|
|
88
89
|
},
|
|
90
|
+
launchedCryptos: {
|
|
91
|
+
type: [String],
|
|
92
|
+
enum: Object.values(common_1.Crypto),
|
|
93
|
+
},
|
|
89
94
|
}, {
|
|
90
95
|
toJSON: {
|
|
91
96
|
transform(doc, ret) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@riocrypto/common-server",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2925",
|
|
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.6.0",
|
|
29
29
|
"@google-cloud/storage": "^7.19.0",
|
|
30
30
|
"@hyperdx/node-opentelemetry": "^0.10.3",
|
|
31
|
-
"@riocrypto/common": "1.0.
|
|
31
|
+
"@riocrypto/common": "1.0.2726",
|
|
32
32
|
"@slack/web-api": "^7.15.0",
|
|
33
33
|
"@types/express": "^4.17.25",
|
|
34
34
|
"axios": "1.18.1",
|