@riocrypto/common-server 1.0.1614 → 1.0.1616
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.
|
@@ -11,17 +11,17 @@ declare class FireblocksClient {
|
|
|
11
11
|
getTotalVaultUSDBalance(vaultId: string): Promise<number>;
|
|
12
12
|
getTotalExchangesUSDBalance(): Promise<number>;
|
|
13
13
|
getExchangeCryptoBalance(crypto: Crypto): Promise<number>;
|
|
14
|
-
getSingularExchangeCryptoBalance(id: string,
|
|
14
|
+
getSingularExchangeCryptoBalance(id: string, usdType: "usdc" | "usdt"): Promise<number>;
|
|
15
15
|
getExchangeFiatBalance(): Promise<number>;
|
|
16
16
|
getTransactions(vaultId: string, crypto: Crypto, nextPage?: string): Promise<any>;
|
|
17
17
|
getDepositAddress(vaultId: string, crypto: Crypto): Promise<string>;
|
|
18
18
|
createVault(userId: string, name: string, type: "transactional" | "managed"): Promise<string>;
|
|
19
19
|
createWallet(vaultId: string, crypto: Crypto): Promise<string>;
|
|
20
|
-
internalTransfer(crypto: Crypto, sourceVaultId: string, destinationVaultId: string, amountCrypto: number, notes?: string): Promise<string>;
|
|
21
|
-
externalTransfer(crypto: Crypto, sourceVaultId: string, destinationAddress: string, amountCrypto: number, notes?: string): Promise<string>;
|
|
22
|
-
transferToExchange(crypto: Crypto, sourceVaultId: string, destinationExchangeId: string, amountCrypto: number, notes?: string): Promise<string>;
|
|
23
|
-
transferFromExchangeToExchange(crypto: Crypto, sourceExchangeId: string, destinationExchangeId: string, amountCrypto: number, notes?: string): Promise<string>;
|
|
24
|
-
transferFromExchange(crypto: Crypto, sourceExchangeId: string, destinationVaultId: string, amountCrypto: number, notes?: string): Promise<string>;
|
|
20
|
+
internalTransfer(rioId: string, crypto: Crypto, sourceVaultId: string, destinationVaultId: string, amountCrypto: number, notes?: string): Promise<string>;
|
|
21
|
+
externalTransfer(rioId: string, crypto: Crypto, sourceVaultId: string, destinationAddress: string, amountCrypto: number, notes?: string): Promise<string>;
|
|
22
|
+
transferToExchange(rioId: string, crypto: Crypto, sourceVaultId: string, destinationExchangeId: string, amountCrypto: number, notes?: string): Promise<string>;
|
|
23
|
+
transferFromExchangeToExchange(rioId: string, crypto: Crypto, sourceExchangeId: string, destinationExchangeId: string, amountCrypto: number, notes?: string): Promise<string>;
|
|
24
|
+
transferFromExchange(rioId: string, crypto: Crypto, sourceExchangeId: string, destinationVaultId: string, amountCrypto: number, notes?: string): Promise<string>;
|
|
25
25
|
sweep(vaultId: string, assetId: string, amount: number): Promise<void>;
|
|
26
26
|
}
|
|
27
27
|
export declare const buildFireblocksClient: () => Promise<FireblocksClient>;
|
|
@@ -184,14 +184,28 @@ class FireblocksClient {
|
|
|
184
184
|
return balance;
|
|
185
185
|
});
|
|
186
186
|
}
|
|
187
|
-
getSingularExchangeCryptoBalance(id,
|
|
187
|
+
getSingularExchangeCryptoBalance(id, usdType) {
|
|
188
188
|
return __awaiter(this, void 0, void 0, function* () {
|
|
189
189
|
let exchanges = yield this.fireblocks.getExchangeAccounts();
|
|
190
190
|
let balance = 0;
|
|
191
191
|
exchanges.forEach((exchange) => {
|
|
192
192
|
if (exchange.id === id) {
|
|
193
193
|
exchange.assets.forEach((asset) => {
|
|
194
|
-
|
|
194
|
+
let filterList = usdType === "usdc"
|
|
195
|
+
? [
|
|
196
|
+
common_1.Crypto.USDC,
|
|
197
|
+
common_1.Crypto.USDCPolygon,
|
|
198
|
+
common_1.Crypto.USDCPolygonBridged,
|
|
199
|
+
common_1.Crypto.USDCSolana,
|
|
200
|
+
"USD",
|
|
201
|
+
]
|
|
202
|
+
: [
|
|
203
|
+
common_1.Crypto.USDTEthereum,
|
|
204
|
+
"USDT",
|
|
205
|
+
common_1.Crypto.USDTPolygon,
|
|
206
|
+
common_1.Crypto.USDTTron,
|
|
207
|
+
];
|
|
208
|
+
if (filterList.includes(asset.id)) {
|
|
195
209
|
balance += Number(asset.available);
|
|
196
210
|
}
|
|
197
211
|
});
|
|
@@ -249,7 +263,7 @@ class FireblocksClient {
|
|
|
249
263
|
return wallet.address;
|
|
250
264
|
});
|
|
251
265
|
}
|
|
252
|
-
internalTransfer(crypto, sourceVaultId, destinationVaultId, amountCrypto, notes) {
|
|
266
|
+
internalTransfer(rioId, crypto, sourceVaultId, destinationVaultId, amountCrypto, notes) {
|
|
253
267
|
return __awaiter(this, void 0, void 0, function* () {
|
|
254
268
|
if ([common_1.RioEnv.Sandbox, common_1.RioEnv.Local].includes(process.env.RIO_ENV)) {
|
|
255
269
|
throw new Error("Internal transfers are disabled in sandbox mode.");
|
|
@@ -266,12 +280,13 @@ class FireblocksClient {
|
|
|
266
280
|
},
|
|
267
281
|
amount: amountCrypto,
|
|
268
282
|
operation: fireblocks_sdk_1.TransactionOperation.TRANSFER,
|
|
283
|
+
externalTxId: rioId,
|
|
269
284
|
note: notes,
|
|
270
285
|
});
|
|
271
286
|
return response.id;
|
|
272
287
|
});
|
|
273
288
|
}
|
|
274
|
-
externalTransfer(crypto, sourceVaultId, destinationAddress, amountCrypto, notes) {
|
|
289
|
+
externalTransfer(rioId, crypto, sourceVaultId, destinationAddress, amountCrypto, notes) {
|
|
275
290
|
return __awaiter(this, void 0, void 0, function* () {
|
|
276
291
|
if ([common_1.RioEnv.Sandbox, common_1.RioEnv.Local].includes(process.env.RIO_ENV)) {
|
|
277
292
|
throw new Error("External transfers are disabled in sandbox mode.");
|
|
@@ -290,12 +305,13 @@ class FireblocksClient {
|
|
|
290
305
|
},
|
|
291
306
|
amount: amountCrypto,
|
|
292
307
|
operation: fireblocks_sdk_1.TransactionOperation.TRANSFER,
|
|
308
|
+
externalTxId: rioId,
|
|
293
309
|
note: notes,
|
|
294
310
|
});
|
|
295
311
|
return response.id;
|
|
296
312
|
});
|
|
297
313
|
}
|
|
298
|
-
transferToExchange(crypto, sourceVaultId, destinationExchangeId, amountCrypto, notes) {
|
|
314
|
+
transferToExchange(rioId, crypto, sourceVaultId, destinationExchangeId, amountCrypto, notes) {
|
|
299
315
|
return __awaiter(this, void 0, void 0, function* () {
|
|
300
316
|
if ([common_1.RioEnv.Sandbox, common_1.RioEnv.Local].includes(process.env.RIO_ENV)) {
|
|
301
317
|
throw new Error("Transfers to exchanges are disabled in sandbox mode.");
|
|
@@ -313,11 +329,12 @@ class FireblocksClient {
|
|
|
313
329
|
amount: amountCrypto,
|
|
314
330
|
operation: fireblocks_sdk_1.TransactionOperation.TRANSFER,
|
|
315
331
|
note: notes,
|
|
332
|
+
externalTxId: rioId,
|
|
316
333
|
});
|
|
317
334
|
return response.id;
|
|
318
335
|
});
|
|
319
336
|
}
|
|
320
|
-
transferFromExchangeToExchange(crypto, sourceExchangeId, destinationExchangeId, amountCrypto, notes) {
|
|
337
|
+
transferFromExchangeToExchange(rioId, crypto, sourceExchangeId, destinationExchangeId, amountCrypto, notes) {
|
|
321
338
|
return __awaiter(this, void 0, void 0, function* () {
|
|
322
339
|
if ([common_1.RioEnv.Sandbox, common_1.RioEnv.Local].includes(process.env.RIO_ENV)) {
|
|
323
340
|
throw new Error("Transfers from exchanges to exchanges are disabled in sandbox mode.");
|
|
@@ -334,17 +351,19 @@ class FireblocksClient {
|
|
|
334
351
|
},
|
|
335
352
|
amount: amountCrypto,
|
|
336
353
|
operation: fireblocks_sdk_1.TransactionOperation.TRANSFER,
|
|
354
|
+
externalTxId: rioId,
|
|
337
355
|
note: notes,
|
|
338
356
|
});
|
|
339
357
|
return response.id;
|
|
340
358
|
});
|
|
341
359
|
}
|
|
342
|
-
transferFromExchange(crypto, sourceExchangeId, destinationVaultId, amountCrypto, notes) {
|
|
360
|
+
transferFromExchange(rioId, crypto, sourceExchangeId, destinationVaultId, amountCrypto, notes) {
|
|
343
361
|
return __awaiter(this, void 0, void 0, function* () {
|
|
344
362
|
if ([common_1.RioEnv.Sandbox, common_1.RioEnv.Local].includes(process.env.RIO_ENV)) {
|
|
345
363
|
throw new Error("Transfers from exchanges are disabled in sandbox mode.");
|
|
346
364
|
}
|
|
347
365
|
const response = yield this.fireblocks.createTransaction({
|
|
366
|
+
externalTxId: rioId,
|
|
348
367
|
assetId: crypto,
|
|
349
368
|
source: {
|
|
350
369
|
type: fireblocks_sdk_1.PeerType.EXCHANGE_ACCOUNT,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@riocrypto/common-server",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1616",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./build/index.js",
|
|
6
6
|
"types": "./build/index.d.ts",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"@google-cloud/storage": "^6.9.5",
|
|
29
29
|
"@google-cloud/vision": "^4.0.2",
|
|
30
30
|
"@hyperdx/node-opentelemetry": "^0.4.2",
|
|
31
|
-
"@riocrypto/common": "^1.0.
|
|
31
|
+
"@riocrypto/common": "^1.0.1453",
|
|
32
32
|
"@types/express": "^4.17.13",
|
|
33
33
|
"axios": "^1.6.0",
|
|
34
34
|
"ccxt": "^3.0.30",
|