@riocrypto/common-server 1.0.944 → 1.0.946

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.
@@ -10,7 +10,8 @@ declare class FireblocksClient {
10
10
  getExchangeCryptoBalance(crypto: Crypto): Promise<number>;
11
11
  getExchangeFiatBalance(): Promise<number>;
12
12
  getTransactions(crypto: Crypto, nextPage?: string): Promise<any>;
13
- getDepositAddress(crypto: Crypto): Promise<string>;
13
+ getDepositAddress(vaultId: string, crypto: Crypto): Promise<string>;
14
+ createVault(userId: string): Promise<string>;
14
15
  }
15
16
  export declare const buildFireblocksClient: () => Promise<FireblocksClient>;
16
17
  export {};
@@ -118,12 +118,18 @@ class FireblocksClient {
118
118
  return transactionData;
119
119
  });
120
120
  }
121
- getDepositAddress(crypto) {
121
+ getDepositAddress(vaultId, crypto) {
122
122
  return __awaiter(this, void 0, void 0, function* () {
123
- let addresses = yield this.fireblocks.getDepositAddresses("2", crypto);
123
+ let addresses = yield this.fireblocks.getDepositAddresses(vaultId, crypto);
124
124
  return addresses[0].address;
125
125
  });
126
126
  }
127
+ createVault(userId) {
128
+ return __awaiter(this, void 0, void 0, function* () {
129
+ const vault = yield this.fireblocks.createVaultAccount(`Rio user ${userId}`);
130
+ return vault.id;
131
+ });
132
+ }
127
133
  }
128
134
  const buildFireblocksClient = () => __awaiter(void 0, void 0, void 0, function* () {
129
135
  const FIREBLOCKS_PRIVATE_KEY = yield secret_manager_client_1.secretManagerClient.getSecretValue("FIREBLOCKS_PRIVATE_KEY");
@@ -2,16 +2,10 @@ import mongoose from "mongoose";
2
2
  interface FireblocksVaultAttrs {
3
3
  userId: string;
4
4
  fireblocksVaultId: string;
5
- depositAddresses: {
6
- [key: string]: string;
7
- };
8
5
  }
9
6
  interface FireblocksVaultDoc extends mongoose.Document {
10
7
  userId: string;
11
8
  fireblocksVaultId: string;
12
- depositAddresses: {
13
- [key: string]: string;
14
- };
15
9
  }
16
10
  interface FireblocksVaultModel extends mongoose.Model<FireblocksVaultDoc> {
17
11
  build(attrs: FireblocksVaultAttrs): FireblocksVaultDoc;
@@ -15,10 +15,6 @@ const buildFireblocksVault = (mongoose) => {
15
15
  type: String,
16
16
  required: true,
17
17
  },
18
- depositAddresses: {
19
- type: Object,
20
- required: true,
21
- },
22
18
  }, {
23
19
  toJSON: {
24
20
  transform(doc, ret) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riocrypto/common-server",
3
- "version": "1.0.944",
3
+ "version": "1.0.946",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",
@@ -24,7 +24,7 @@
24
24
  "@aws-sdk/client-s3": "^3.297.0",
25
25
  "@everapi/currencyapi-js": "^1.0.6",
26
26
  "@google-cloud/storage": "^6.9.5",
27
- "@riocrypto/common": "^1.0.812",
27
+ "@riocrypto/common": "^1.0.814",
28
28
  "@types/express": "^4.17.13",
29
29
  "axios": "^0.27.2",
30
30
  "ccxt": "^3.0.30",