@riocrypto/common-server 1.0.1617 → 1.0.1618

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.
@@ -4,7 +4,7 @@ declare class FireblocksClient {
4
4
  fireblocks: FireblocksSDK;
5
5
  constructor(privateKey: string, apiKey: string);
6
6
  estimateWithdrawFee(crypto: Crypto, address: string, amountCrypto: number): Promise<string | number | undefined>;
7
- withdrawFromExchange(crypto: Crypto, address: string, amountCrypto: number): Promise<void>;
7
+ withdrawFromExchange(rioId: string, crypto: Crypto, address: string, amountCrypto: number): Promise<void>;
8
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>;
@@ -22,7 +22,7 @@ declare class FireblocksClient {
22
22
  transferToExchange(rioId: string, crypto: Crypto, sourceVaultId: string, destinationExchangeId: string, amountCrypto: number, notes?: string): Promise<string>;
23
23
  transferFromExchangeToExchange(rioId: string, crypto: Crypto, sourceExchangeId: string, destinationExchangeId: string, amountCrypto: number, notes?: string): Promise<string>;
24
24
  transferFromExchange(rioId: string, crypto: Crypto, sourceExchangeId: string, destinationVaultId: string, amountCrypto: number, notes?: string): Promise<string>;
25
- sweep(vaultId: string, assetId: string, amount: number): Promise<void>;
25
+ sweep(rioId: string, vaultId: string, assetId: string, amount: number): Promise<void>;
26
26
  }
27
27
  export declare const buildFireblocksClient: () => Promise<FireblocksClient>;
28
28
  export {};
@@ -53,7 +53,7 @@ class FireblocksClient {
53
53
  return fee;
54
54
  });
55
55
  }
56
- withdrawFromExchange(crypto, address, amountCrypto) {
56
+ withdrawFromExchange(rioId, crypto, address, amountCrypto) {
57
57
  return __awaiter(this, void 0, void 0, function* () {
58
58
  if ([common_1.RioEnv.Sandbox, common_1.RioEnv.Local].includes(process.env.RIO_ENV)) {
59
59
  throw new Error("Withdrawals are disabled in sandbox mode.");
@@ -72,6 +72,7 @@ class FireblocksClient {
72
72
  },
73
73
  amount: amountCrypto,
74
74
  operation: fireblocks_sdk_1.TransactionOperation.TRANSFER,
75
+ externalTxId: rioId,
75
76
  });
76
77
  });
77
78
  }
@@ -381,7 +382,7 @@ class FireblocksClient {
381
382
  return response.id;
382
383
  });
383
384
  }
384
- sweep(vaultId, assetId, amount) {
385
+ sweep(rioId, vaultId, assetId, amount) {
385
386
  return __awaiter(this, void 0, void 0, function* () {
386
387
  if ([common_1.RioEnv.Sandbox, common_1.RioEnv.Local].includes(process.env.RIO_ENV)) {
387
388
  throw new Error("Sweeps are disabled in sandbox mode.");
@@ -397,6 +398,7 @@ class FireblocksClient {
397
398
  id: String(2),
398
399
  },
399
400
  amount: amount.toFixed(4),
401
+ externalTxId: rioId,
400
402
  });
401
403
  });
402
404
  }
package/build/index.d.ts CHANGED
@@ -54,6 +54,7 @@ export * from "./models/UBO";
54
54
  export * from "./models/temporary-verification";
55
55
  export * from "./models/bid";
56
56
  export * from "./models/rio-bank-account";
57
+ export * from "./models/address-verification";
57
58
  export * from "./clients/bitstamp-client";
58
59
  export * from "./clients/ccxt-client";
59
60
  export * from "./clients/slack-client";
package/build/index.js CHANGED
@@ -70,6 +70,7 @@ __exportStar(require("./models/UBO"), exports);
70
70
  __exportStar(require("./models/temporary-verification"), exports);
71
71
  __exportStar(require("./models/bid"), exports);
72
72
  __exportStar(require("./models/rio-bank-account"), exports);
73
+ __exportStar(require("./models/address-verification"), exports);
73
74
  __exportStar(require("./clients/bitstamp-client"), exports);
74
75
  __exportStar(require("./clients/ccxt-client"), exports);
75
76
  __exportStar(require("./clients/slack-client"), exports);
@@ -0,0 +1,16 @@
1
+ import { AddressVerificationStatus } from "@riocrypto/common";
2
+ import { Mongoose, Model, Document } from "mongoose";
3
+ interface AddressVerificationAttrs {
4
+ addressId: string;
5
+ status: AddressVerificationStatus;
6
+ }
7
+ interface AddressVerificationModel extends Model<AddressVerificationDoc> {
8
+ build(attrs: AddressVerificationAttrs): AddressVerificationDoc;
9
+ }
10
+ interface AddressVerificationDoc extends Document {
11
+ _id: string;
12
+ addressId: string;
13
+ status: AddressVerificationStatus;
14
+ }
15
+ declare const buildAddressVerification: (mongoose: Mongoose) => AddressVerificationModel;
16
+ export { buildAddressVerification, AddressVerificationDoc, AddressVerificationAttrs, };
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.buildAddressVerification = void 0;
4
+ const buildAddressVerification = (mongoose) => {
5
+ // if model is already defined, return it
6
+ if (mongoose.models.AddressVerification) {
7
+ return mongoose.model("AddressVerification");
8
+ }
9
+ const AddressVerificationSchema = new mongoose.Schema({
10
+ addressId: {
11
+ type: String,
12
+ required: true,
13
+ },
14
+ status: {
15
+ type: String,
16
+ required: true,
17
+ },
18
+ }, {
19
+ toJSON: {
20
+ transform(doc, ret) {
21
+ ret.id = ret._id.valueOf();
22
+ delete ret._id;
23
+ delete ret.__v;
24
+ },
25
+ },
26
+ });
27
+ AddressVerificationSchema.statics.build = (attrs) => {
28
+ return new AddressVerification(attrs);
29
+ };
30
+ const AddressVerification = mongoose.model("AddressVerification", AddressVerificationSchema);
31
+ return AddressVerification;
32
+ };
33
+ exports.buildAddressVerification = buildAddressVerification;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riocrypto/common-server",
3
- "version": "1.0.1617",
3
+ "version": "1.0.1618",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",