@riocrypto/common-server 1.0.1688 → 1.0.1690
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.
|
@@ -15,7 +15,7 @@ declare class FireblocksClient {
|
|
|
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
|
-
createVault(userId: string, name: string, type: "transactional" | "managed"): Promise<string>;
|
|
18
|
+
createVault(userId: string, name: string, type: "transactional" | "managed", number?: number): Promise<string>;
|
|
19
19
|
createWallet(vaultId: string, crypto: Crypto): Promise<string>;
|
|
20
20
|
internalTransfer(rioId: string, crypto: Crypto, sourceVaultId: string, destinationVaultId: string, amountCrypto: number, notes?: string): Promise<string>;
|
|
21
21
|
externalTransfer(rioId: string, crypto: Crypto, sourceVaultId: string, destinationAddress: string, amountCrypto: number, notes?: string): Promise<string>;
|
|
@@ -246,12 +246,15 @@ class FireblocksClient {
|
|
|
246
246
|
return addresses[0].address;
|
|
247
247
|
});
|
|
248
248
|
}
|
|
249
|
-
createVault(userId, name, type) {
|
|
249
|
+
createVault(userId, name, type, number) {
|
|
250
250
|
return __awaiter(this, void 0, void 0, function* () {
|
|
251
251
|
if ([common_1.RioEnv.Sandbox, common_1.RioEnv.Local].includes(process.env.RIO_ENV)) {
|
|
252
252
|
throw new Error("Vault creation is disabled in sandbox mode.");
|
|
253
253
|
}
|
|
254
|
-
|
|
254
|
+
let vaultName = number
|
|
255
|
+
? `${name} - ${userId} - ${type} - ${number}`
|
|
256
|
+
: `${name} - ${userId} - ${type}`;
|
|
257
|
+
const vault = yield this.fireblocks.createVaultAccount(vaultName, false, userId, true);
|
|
255
258
|
return vault.id;
|
|
256
259
|
});
|
|
257
260
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Crypto } from "@riocrypto/common";
|
|
1
2
|
import mongoose from "mongoose";
|
|
2
3
|
interface FireblocksVaultAttrs {
|
|
3
4
|
userId: string;
|
|
@@ -6,7 +7,10 @@ interface FireblocksVaultAttrs {
|
|
|
6
7
|
depositAddresses?: {
|
|
7
8
|
[key: string]: string;
|
|
8
9
|
};
|
|
9
|
-
|
|
10
|
+
activeOrders?: {
|
|
11
|
+
orderId: string;
|
|
12
|
+
crypto: Crypto;
|
|
13
|
+
}[];
|
|
10
14
|
}
|
|
11
15
|
interface FireblocksVaultDoc extends mongoose.Document {
|
|
12
16
|
userId: string;
|
|
@@ -15,7 +19,10 @@ interface FireblocksVaultDoc extends mongoose.Document {
|
|
|
15
19
|
depositAddresses?: {
|
|
16
20
|
[key: string]: string;
|
|
17
21
|
};
|
|
18
|
-
|
|
22
|
+
activeOrders?: {
|
|
23
|
+
orderId: string;
|
|
24
|
+
crypto: Crypto;
|
|
25
|
+
}[];
|
|
19
26
|
}
|
|
20
27
|
interface FireblocksVaultModel extends mongoose.Model<FireblocksVaultDoc> {
|
|
21
28
|
build(attrs: FireblocksVaultAttrs): FireblocksVaultDoc;
|