@riocrypto/common-server 1.0.1271 → 1.0.1273
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/circle-client.d.ts +1 -0
- package/build/clients/circle-client.js +18 -0
- package/build/index.d.ts +1 -0
- package/build/index.js +1 -0
- package/build/models/circle-payout.d.ts +16 -0
- package/build/models/circle-payout.js +37 -0
- package/build/models/fireblocks-transfer.js +0 -3
- package/package.json +2 -2
|
@@ -111,6 +111,24 @@ class CircleClient {
|
|
|
111
111
|
return (_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.data;
|
|
112
112
|
});
|
|
113
113
|
}
|
|
114
|
+
getUSDCBalance(walletId) {
|
|
115
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
116
|
+
const response = yield axios_1.default.get(`${this.baseUrl}/v1/wallets/${walletId}`, {
|
|
117
|
+
headers: {
|
|
118
|
+
Authorization: `Bearer ${this.apiKey}`,
|
|
119
|
+
},
|
|
120
|
+
});
|
|
121
|
+
const data = response.data.data;
|
|
122
|
+
const balances = data.balances;
|
|
123
|
+
const usdBalance = balances.find((balance) => balance.currency === "USD");
|
|
124
|
+
if (usdBalance) {
|
|
125
|
+
return Number(usdBalance.amount);
|
|
126
|
+
}
|
|
127
|
+
else {
|
|
128
|
+
throw new Error("USD balance not found");
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
}
|
|
114
132
|
}
|
|
115
133
|
const buildCircleClient = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
116
134
|
// Retrieve secrets asynchronously
|
package/build/index.d.ts
CHANGED
|
@@ -38,6 +38,7 @@ export * from "./models/bitso-fx-order";
|
|
|
38
38
|
export * from "./models/internal-swap";
|
|
39
39
|
export * from "./models/bitso-mxn-withdrawal";
|
|
40
40
|
export * from "./models/circle-address-book-recipient";
|
|
41
|
+
export * from "./models/circle-payout";
|
|
41
42
|
export * from "./clients/bitstamp-client";
|
|
42
43
|
export * from "./clients/ccxt-client";
|
|
43
44
|
export * from "./clients/kushki-client";
|
package/build/index.js
CHANGED
|
@@ -54,6 +54,7 @@ __exportStar(require("./models/bitso-fx-order"), exports);
|
|
|
54
54
|
__exportStar(require("./models/internal-swap"), exports);
|
|
55
55
|
__exportStar(require("./models/bitso-mxn-withdrawal"), exports);
|
|
56
56
|
__exportStar(require("./models/circle-address-book-recipient"), exports);
|
|
57
|
+
__exportStar(require("./models/circle-payout"), exports);
|
|
57
58
|
__exportStar(require("./clients/bitstamp-client"), exports);
|
|
58
59
|
__exportStar(require("./clients/ccxt-client"), exports);
|
|
59
60
|
__exportStar(require("./clients/kushki-client"), exports);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import mongoose from "mongoose";
|
|
2
|
+
interface CirclePayoutAttrs {
|
|
3
|
+
userId: string;
|
|
4
|
+
orderId: string;
|
|
5
|
+
circlePayoutId: string;
|
|
6
|
+
}
|
|
7
|
+
interface CirclePayoutDoc extends mongoose.Document {
|
|
8
|
+
userId: string;
|
|
9
|
+
orderId: string;
|
|
10
|
+
circlePayoutId: string;
|
|
11
|
+
}
|
|
12
|
+
interface CirclePayoutModel extends mongoose.Model<CirclePayoutDoc> {
|
|
13
|
+
build(attrs: CirclePayoutAttrs): CirclePayoutDoc;
|
|
14
|
+
}
|
|
15
|
+
declare const buildCirclePayout: (mongoose: typeof mongoose) => CirclePayoutModel;
|
|
16
|
+
export { buildCirclePayout, CirclePayoutDoc };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildCirclePayout = void 0;
|
|
4
|
+
const buildCirclePayout = (mongoose) => {
|
|
5
|
+
// if model is already defined, return it
|
|
6
|
+
if (mongoose.models.CirclePayout) {
|
|
7
|
+
return mongoose.model("CirclePayout");
|
|
8
|
+
}
|
|
9
|
+
const CirclePayoutSchema = new mongoose.Schema({
|
|
10
|
+
userId: {
|
|
11
|
+
type: String,
|
|
12
|
+
required: true,
|
|
13
|
+
},
|
|
14
|
+
orderId: {
|
|
15
|
+
type: String,
|
|
16
|
+
required: true,
|
|
17
|
+
},
|
|
18
|
+
circlePayoutId: {
|
|
19
|
+
type: String,
|
|
20
|
+
required: true,
|
|
21
|
+
},
|
|
22
|
+
}, {
|
|
23
|
+
toJSON: {
|
|
24
|
+
transform(doc, ret) {
|
|
25
|
+
ret.id = ret._id;
|
|
26
|
+
delete ret._id;
|
|
27
|
+
delete ret.__v;
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
CirclePayoutSchema.statics.build = (attrs) => {
|
|
32
|
+
return new CirclePayout(attrs);
|
|
33
|
+
};
|
|
34
|
+
const CirclePayout = mongoose.model("CirclePayout", CirclePayoutSchema);
|
|
35
|
+
return CirclePayout;
|
|
36
|
+
};
|
|
37
|
+
exports.buildCirclePayout = buildCirclePayout;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@riocrypto/common-server",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1273",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./build/index.js",
|
|
6
6
|
"types": "./build/index.d.ts",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"@everapi/currencyapi-js": "^1.0.6",
|
|
28
28
|
"@google-cloud/storage": "^6.9.5",
|
|
29
29
|
"@google-cloud/vision": "^4.0.2",
|
|
30
|
-
"@riocrypto/common": "^1.0.
|
|
30
|
+
"@riocrypto/common": "^1.0.1147",
|
|
31
31
|
"@types/express": "^4.17.13",
|
|
32
32
|
"axios": "^0.27.2",
|
|
33
33
|
"ccxt": "^3.0.30",
|