@riocrypto/common-server 1.0.1120 → 1.0.1122
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.
|
@@ -7,6 +7,7 @@ declare class FireblocksClient {
|
|
|
7
7
|
withdrawFromExchange(crypto: Crypto, address: string, amountCrypto: number): Promise<void>;
|
|
8
8
|
withdrawFromVault(crypto: Crypto, address: string, amountCrypto: number): Promise<string>;
|
|
9
9
|
getVaultCryptoBalance(vaultId: string, crypto: Crypto): Promise<number>;
|
|
10
|
+
getTotalVaultUSDBalance(vaultId: string): Promise<number>;
|
|
10
11
|
getExchangeCryptoBalance(crypto: Crypto): Promise<number>;
|
|
11
12
|
getExchangeFiatBalance(): Promise<number>;
|
|
12
13
|
getTransactions(vaultId: string, crypto: Crypto, nextPage?: string): Promise<any>;
|
|
@@ -11,6 +11,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.buildFireblocksClient = void 0;
|
|
13
13
|
const fireblocks_sdk_1 = require("fireblocks-sdk");
|
|
14
|
+
const common_1 = require("@riocrypto/common");
|
|
14
15
|
const secret_manager_client_1 = require("./secret-manager-client");
|
|
15
16
|
class FireblocksClient {
|
|
16
17
|
constructor(privateKey, apiKey) {
|
|
@@ -81,6 +82,27 @@ class FireblocksClient {
|
|
|
81
82
|
return Number(vaultAsset.available) || 0;
|
|
82
83
|
});
|
|
83
84
|
}
|
|
85
|
+
getTotalVaultUSDBalance(vaultId) {
|
|
86
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
87
|
+
const vaultAccount = yield this.fireblocks.getVaultAccountById(vaultId);
|
|
88
|
+
let balance = 0;
|
|
89
|
+
if (vaultAccount.assets) {
|
|
90
|
+
for (const asset of vaultAccount.assets) {
|
|
91
|
+
if ([
|
|
92
|
+
common_1.Crypto.USDC,
|
|
93
|
+
common_1.Crypto.USDCPolygon,
|
|
94
|
+
common_1.Crypto.USDCSolana,
|
|
95
|
+
common_1.Crypto.USDTEthereum,
|
|
96
|
+
common_1.Crypto.USDTPolygon,
|
|
97
|
+
common_1.Crypto.USDTTron,
|
|
98
|
+
].includes(asset.id)) {
|
|
99
|
+
balance += Number(asset.available || 0);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
return balance;
|
|
104
|
+
});
|
|
105
|
+
}
|
|
84
106
|
getExchangeCryptoBalance(crypto) {
|
|
85
107
|
return __awaiter(this, void 0, void 0, function* () {
|
|
86
108
|
let exchanges = yield this.fireblocks.getExchangeAccounts();
|
package/build/models/quote.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ interface QuoteAttrs {
|
|
|
8
8
|
paymentMethod?: PaymentMethod;
|
|
9
9
|
payoutMethod?: PayoutMethod;
|
|
10
10
|
expiresAt?: Date;
|
|
11
|
-
country
|
|
11
|
+
country: Country;
|
|
12
12
|
state?: USState | string;
|
|
13
13
|
amountFiat: number;
|
|
14
14
|
amountCrypto: number;
|
|
@@ -34,7 +34,7 @@ interface QuoteDoc extends Document {
|
|
|
34
34
|
fiat: Fiat;
|
|
35
35
|
paymentMethod?: PaymentMethod;
|
|
36
36
|
payoutMethod?: PayoutMethod;
|
|
37
|
-
expiresAt
|
|
37
|
+
expiresAt?: Date;
|
|
38
38
|
country: Country;
|
|
39
39
|
state?: USState | string;
|
|
40
40
|
amountFiat: number;
|
package/build/models/quote.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@riocrypto/common-server",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1122",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./build/index.js",
|
|
6
6
|
"types": "./build/index.d.ts",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"@aws-sdk/client-s3": "^3.297.0",
|
|
27
27
|
"@everapi/currencyapi-js": "^1.0.6",
|
|
28
28
|
"@google-cloud/storage": "^6.9.5",
|
|
29
|
-
"@riocrypto/common": "^1.0.
|
|
29
|
+
"@riocrypto/common": "^1.0.965",
|
|
30
30
|
"@types/express": "^4.17.13",
|
|
31
31
|
"axios": "^0.27.2",
|
|
32
32
|
"ccxt": "^3.0.30",
|