@riocrypto/common-server 1.0.1270 → 1.0.1272
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.
|
@@ -64,6 +64,22 @@ class CircleClient {
|
|
|
64
64
|
source: {
|
|
65
65
|
type: "wallet",
|
|
66
66
|
id: originWalletId,
|
|
67
|
+
identities: [
|
|
68
|
+
{
|
|
69
|
+
type: "business",
|
|
70
|
+
name: "Rampa Labs",
|
|
71
|
+
addresses: [
|
|
72
|
+
{
|
|
73
|
+
line1: "Address1",
|
|
74
|
+
line2: "address2",
|
|
75
|
+
city: "City",
|
|
76
|
+
district: "dis",
|
|
77
|
+
postalCode: "06100",
|
|
78
|
+
country: "MX",
|
|
79
|
+
},
|
|
80
|
+
],
|
|
81
|
+
},
|
|
82
|
+
],
|
|
67
83
|
},
|
|
68
84
|
destination: {
|
|
69
85
|
type: "address_book",
|
|
@@ -95,6 +111,24 @@ class CircleClient {
|
|
|
95
111
|
return (_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.data;
|
|
96
112
|
});
|
|
97
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
|
+
}
|
|
98
132
|
}
|
|
99
133
|
const buildCircleClient = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
100
134
|
// Retrieve secrets asynchronously
|