@riocrypto/common-server 1.0.1617 → 1.0.1619
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.
- package/build/clients/fireblocks-client.d.ts +2 -2
- package/build/clients/fireblocks-client.js +4 -2
- package/build/index.d.ts +1 -0
- package/build/index.js +1 -0
- package/build/models/address-verification.d.ts +18 -0
- package/build/models/address-verification.js +37 -0
- package/build/models/crypto-address.d.ts +2 -2
- package/build/models/crypto-address.js +3 -3
- package/package.json +1 -1
|
@@ -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,18 @@
|
|
|
1
|
+
import { AddressVerificationStatus } from "@riocrypto/common";
|
|
2
|
+
import { Mongoose, Model, Document } from "mongoose";
|
|
3
|
+
interface AddressVerificationAttrs {
|
|
4
|
+
addressId: string;
|
|
5
|
+
status: AddressVerificationStatus;
|
|
6
|
+
amount: number;
|
|
7
|
+
}
|
|
8
|
+
interface AddressVerificationModel extends Model<AddressVerificationDoc> {
|
|
9
|
+
build(attrs: AddressVerificationAttrs): AddressVerificationDoc;
|
|
10
|
+
}
|
|
11
|
+
interface AddressVerificationDoc extends Document {
|
|
12
|
+
_id: string;
|
|
13
|
+
addressId: string;
|
|
14
|
+
status: AddressVerificationStatus;
|
|
15
|
+
amount: number;
|
|
16
|
+
}
|
|
17
|
+
declare const buildAddressVerification: (mongoose: Mongoose) => AddressVerificationModel;
|
|
18
|
+
export { buildAddressVerification, AddressVerificationDoc, AddressVerificationAttrs, };
|
|
@@ -0,0 +1,37 @@
|
|
|
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
|
+
amount: {
|
|
19
|
+
type: Number,
|
|
20
|
+
required: true,
|
|
21
|
+
},
|
|
22
|
+
}, {
|
|
23
|
+
toJSON: {
|
|
24
|
+
transform(doc, ret) {
|
|
25
|
+
ret.id = ret._id.valueOf();
|
|
26
|
+
delete ret._id;
|
|
27
|
+
delete ret.__v;
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
AddressVerificationSchema.statics.build = (attrs) => {
|
|
32
|
+
return new AddressVerification(attrs);
|
|
33
|
+
};
|
|
34
|
+
const AddressVerification = mongoose.model("AddressVerification", AddressVerificationSchema);
|
|
35
|
+
return AddressVerification;
|
|
36
|
+
};
|
|
37
|
+
exports.buildAddressVerification = buildAddressVerification;
|
|
@@ -9,8 +9,8 @@ interface CryptoAddressAttrs {
|
|
|
9
9
|
lastChecked: Date;
|
|
10
10
|
label?: string;
|
|
11
11
|
verification?: {
|
|
12
|
+
id: string;
|
|
12
13
|
status?: AddressVerificationStatus;
|
|
13
|
-
amount?: number;
|
|
14
14
|
};
|
|
15
15
|
}
|
|
16
16
|
interface CryptoAddressDoc extends mongoose.Document {
|
|
@@ -22,8 +22,8 @@ interface CryptoAddressDoc extends mongoose.Document {
|
|
|
22
22
|
lastChecked: Date;
|
|
23
23
|
label?: string;
|
|
24
24
|
verification?: {
|
|
25
|
+
id: string;
|
|
25
26
|
status?: AddressVerificationStatus;
|
|
26
|
-
amount?: number;
|
|
27
27
|
};
|
|
28
28
|
}
|
|
29
29
|
interface CryptoAddressModel extends mongoose.Model<CryptoAddressDoc> {
|