@riocrypto/common-server 1.0.1615 → 1.0.1617

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.
@@ -5,7 +5,7 @@ declare class FireblocksClient {
5
5
  constructor(privateKey: string, apiKey: string);
6
6
  estimateWithdrawFee(crypto: Crypto, address: string, amountCrypto: number): Promise<string | number | undefined>;
7
7
  withdrawFromExchange(crypto: Crypto, address: string, amountCrypto: number): Promise<void>;
8
- withdrawFromVault(crypto: Crypto, address: string, amountCrypto: number, vaultId?: string): Promise<string>;
8
+ withdrawFromVault(rioId: string, crypto: Crypto, address: string, amountCrypto: number, vaultId?: string): Promise<string>;
9
9
  getVaultCryptoBalance(vaultId: string, crypto: Crypto): Promise<number>;
10
10
  getVaultCryptoAddress(vaultId: string, crypto: Crypto): Promise<string>;
11
11
  getTotalVaultUSDBalance(vaultId: string): Promise<number>;
@@ -17,11 +17,11 @@ declare class FireblocksClient {
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>;
@@ -75,12 +75,13 @@ class FireblocksClient {
75
75
  });
76
76
  });
77
77
  }
78
- withdrawFromVault(crypto, address, amountCrypto, vaultId) {
78
+ withdrawFromVault(rioId, crypto, address, amountCrypto, vaultId) {
79
79
  return __awaiter(this, void 0, void 0, function* () {
80
80
  if ([common_1.RioEnv.Sandbox, common_1.RioEnv.Local].includes(process.env.RIO_ENV)) {
81
81
  throw new Error("Withdrawals are disabled in sandbox mode.");
82
82
  }
83
83
  const response = yield this.fireblocks.createTransaction({
84
+ externalTxId: rioId,
84
85
  assetId: crypto,
85
86
  source: {
86
87
  type: fireblocks_sdk_1.PeerType.VAULT_ACCOUNT,
@@ -263,7 +264,7 @@ class FireblocksClient {
263
264
  return wallet.address;
264
265
  });
265
266
  }
266
- internalTransfer(crypto, sourceVaultId, destinationVaultId, amountCrypto, notes) {
267
+ internalTransfer(rioId, crypto, sourceVaultId, destinationVaultId, amountCrypto, notes) {
267
268
  return __awaiter(this, void 0, void 0, function* () {
268
269
  if ([common_1.RioEnv.Sandbox, common_1.RioEnv.Local].includes(process.env.RIO_ENV)) {
269
270
  throw new Error("Internal transfers are disabled in sandbox mode.");
@@ -280,12 +281,13 @@ class FireblocksClient {
280
281
  },
281
282
  amount: amountCrypto,
282
283
  operation: fireblocks_sdk_1.TransactionOperation.TRANSFER,
284
+ externalTxId: rioId,
283
285
  note: notes,
284
286
  });
285
287
  return response.id;
286
288
  });
287
289
  }
288
- externalTransfer(crypto, sourceVaultId, destinationAddress, amountCrypto, notes) {
290
+ externalTransfer(rioId, crypto, sourceVaultId, destinationAddress, amountCrypto, notes) {
289
291
  return __awaiter(this, void 0, void 0, function* () {
290
292
  if ([common_1.RioEnv.Sandbox, common_1.RioEnv.Local].includes(process.env.RIO_ENV)) {
291
293
  throw new Error("External transfers are disabled in sandbox mode.");
@@ -304,12 +306,13 @@ class FireblocksClient {
304
306
  },
305
307
  amount: amountCrypto,
306
308
  operation: fireblocks_sdk_1.TransactionOperation.TRANSFER,
309
+ externalTxId: rioId,
307
310
  note: notes,
308
311
  });
309
312
  return response.id;
310
313
  });
311
314
  }
312
- transferToExchange(crypto, sourceVaultId, destinationExchangeId, amountCrypto, notes) {
315
+ transferToExchange(rioId, crypto, sourceVaultId, destinationExchangeId, amountCrypto, notes) {
313
316
  return __awaiter(this, void 0, void 0, function* () {
314
317
  if ([common_1.RioEnv.Sandbox, common_1.RioEnv.Local].includes(process.env.RIO_ENV)) {
315
318
  throw new Error("Transfers to exchanges are disabled in sandbox mode.");
@@ -327,11 +330,12 @@ class FireblocksClient {
327
330
  amount: amountCrypto,
328
331
  operation: fireblocks_sdk_1.TransactionOperation.TRANSFER,
329
332
  note: notes,
333
+ externalTxId: rioId,
330
334
  });
331
335
  return response.id;
332
336
  });
333
337
  }
334
- transferFromExchangeToExchange(crypto, sourceExchangeId, destinationExchangeId, amountCrypto, notes) {
338
+ transferFromExchangeToExchange(rioId, crypto, sourceExchangeId, destinationExchangeId, amountCrypto, notes) {
335
339
  return __awaiter(this, void 0, void 0, function* () {
336
340
  if ([common_1.RioEnv.Sandbox, common_1.RioEnv.Local].includes(process.env.RIO_ENV)) {
337
341
  throw new Error("Transfers from exchanges to exchanges are disabled in sandbox mode.");
@@ -348,17 +352,19 @@ class FireblocksClient {
348
352
  },
349
353
  amount: amountCrypto,
350
354
  operation: fireblocks_sdk_1.TransactionOperation.TRANSFER,
355
+ externalTxId: rioId,
351
356
  note: notes,
352
357
  });
353
358
  return response.id;
354
359
  });
355
360
  }
356
- transferFromExchange(crypto, sourceExchangeId, destinationVaultId, amountCrypto, notes) {
361
+ transferFromExchange(rioId, crypto, sourceExchangeId, destinationVaultId, amountCrypto, notes) {
357
362
  return __awaiter(this, void 0, void 0, function* () {
358
363
  if ([common_1.RioEnv.Sandbox, common_1.RioEnv.Local].includes(process.env.RIO_ENV)) {
359
364
  throw new Error("Transfers from exchanges are disabled in sandbox mode.");
360
365
  }
361
366
  const response = yield this.fireblocks.createTransaction({
367
+ externalTxId: rioId,
362
368
  assetId: crypto,
363
369
  source: {
364
370
  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.1615",
3
+ "version": "1.0.1617",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",