@riocrypto/common-server 1.0.1266 → 1.0.1268
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.
|
@@ -7,6 +7,76 @@ declare class CircleClient {
|
|
|
7
7
|
id: string;
|
|
8
8
|
status: "pending" | "inactive" | "active" | "denied";
|
|
9
9
|
}>;
|
|
10
|
+
getAddressBookRecipient(id: string): Promise<{
|
|
11
|
+
id: string;
|
|
12
|
+
chain: CircleChain;
|
|
13
|
+
address: string;
|
|
14
|
+
addressTag?: string;
|
|
15
|
+
metadata: {
|
|
16
|
+
nickname?: string;
|
|
17
|
+
email?: string;
|
|
18
|
+
bns?: string;
|
|
19
|
+
};
|
|
20
|
+
createDate?: string;
|
|
21
|
+
updateDate?: string;
|
|
22
|
+
status: "pending" | "inactive" | "active" | "denied";
|
|
23
|
+
}>;
|
|
24
|
+
createPayout(originWalletId: string, addressBookRecipientId: string, amount: number, fromCurrency: "USD" | "EUR" | "BTC" | "ETH", toCurrency: "USD" | "EUR" | "BTC" | "ETH"): Promise<{
|
|
25
|
+
id: string;
|
|
26
|
+
sourceWalletId: string;
|
|
27
|
+
destination: {
|
|
28
|
+
type: "address_book";
|
|
29
|
+
id: string;
|
|
30
|
+
};
|
|
31
|
+
amount: {
|
|
32
|
+
amount: string;
|
|
33
|
+
currency: "USD" | "EUR" | "BTC" | "ETH";
|
|
34
|
+
};
|
|
35
|
+
toAmount: {
|
|
36
|
+
amount: string;
|
|
37
|
+
currency: "USD" | "EUR" | "BTC" | "ETH";
|
|
38
|
+
};
|
|
39
|
+
fees: {
|
|
40
|
+
amount: string;
|
|
41
|
+
currency: "USD" | "EUR" | "BTC" | "ETH";
|
|
42
|
+
};
|
|
43
|
+
networkFees: {
|
|
44
|
+
amount: string;
|
|
45
|
+
currency: "USD" | "EUR" | "BTC" | "ETH";
|
|
46
|
+
};
|
|
47
|
+
status: "pending" | "complete" | "failed";
|
|
48
|
+
errorCode?: string;
|
|
49
|
+
createDate: string;
|
|
50
|
+
updateDate: string;
|
|
51
|
+
}>;
|
|
52
|
+
getPayout(id: string): Promise<{
|
|
53
|
+
id: string;
|
|
54
|
+
sourceWalletId: string;
|
|
55
|
+
destination: {
|
|
56
|
+
type: "address_book";
|
|
57
|
+
id: string;
|
|
58
|
+
};
|
|
59
|
+
amount: {
|
|
60
|
+
amount: string;
|
|
61
|
+
currency: "USD" | "EUR" | "BTC" | "ETH";
|
|
62
|
+
};
|
|
63
|
+
toAmount: {
|
|
64
|
+
amount: string;
|
|
65
|
+
currency: "USD" | "EUR" | "BTC" | "ETH";
|
|
66
|
+
};
|
|
67
|
+
fees: {
|
|
68
|
+
amount: string;
|
|
69
|
+
currency: "USD" | "EUR" | "BTC" | "ETH";
|
|
70
|
+
};
|
|
71
|
+
networkFees: {
|
|
72
|
+
amount: string;
|
|
73
|
+
currency: "USD" | "EUR" | "BTC" | "ETH";
|
|
74
|
+
};
|
|
75
|
+
status: "pending" | "complete" | "failed";
|
|
76
|
+
errorCode?: string;
|
|
77
|
+
createDate: string;
|
|
78
|
+
updateDate: string;
|
|
79
|
+
}>;
|
|
10
80
|
}
|
|
11
81
|
export declare const buildCircleClient: () => Promise<CircleClient>;
|
|
12
82
|
export {};
|
|
@@ -26,6 +26,7 @@ class CircleClient {
|
|
|
26
26
|
: "https://api-sandbox.circle.com";
|
|
27
27
|
}
|
|
28
28
|
createAddressBookRecipient(user, address, chain) {
|
|
29
|
+
var _a;
|
|
29
30
|
return __awaiter(this, void 0, void 0, function* () {
|
|
30
31
|
const uuid = (0, uuid_1.v1)();
|
|
31
32
|
const response = yield axios_1.default.post(`${this.baseUrl}/v1/addressBook/recipients`, {
|
|
@@ -40,8 +41,58 @@ class CircleClient {
|
|
|
40
41
|
Authorization: `Bearer ${this.apiKey}`,
|
|
41
42
|
},
|
|
42
43
|
});
|
|
43
|
-
|
|
44
|
-
|
|
44
|
+
return (_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.data;
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
getAddressBookRecipient(id) {
|
|
48
|
+
var _a;
|
|
49
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
50
|
+
const response = yield axios_1.default.get(`${this.baseUrl}/v1/addressBook/recipients/{id}`, {
|
|
51
|
+
headers: {
|
|
52
|
+
Authorization: `Bearer ${this.apiKey}`,
|
|
53
|
+
},
|
|
54
|
+
});
|
|
55
|
+
return (_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.data;
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
createPayout(originWalletId, addressBookRecipientId, amount, fromCurrency, toCurrency) {
|
|
59
|
+
var _a;
|
|
60
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
61
|
+
const uuid = (0, uuid_1.v1)();
|
|
62
|
+
const response = yield axios_1.default.post(`${this.baseUrl}/v1/payouts`, {
|
|
63
|
+
idempotencyKey: uuid,
|
|
64
|
+
source: {
|
|
65
|
+
type: "wallet",
|
|
66
|
+
id: originWalletId,
|
|
67
|
+
},
|
|
68
|
+
destination: {
|
|
69
|
+
type: "address_book",
|
|
70
|
+
id: addressBookRecipientId,
|
|
71
|
+
},
|
|
72
|
+
amount: {
|
|
73
|
+
amount: amount.toFixed(2),
|
|
74
|
+
currency: fromCurrency,
|
|
75
|
+
},
|
|
76
|
+
toAmount: {
|
|
77
|
+
currency: toCurrency,
|
|
78
|
+
},
|
|
79
|
+
}, {
|
|
80
|
+
headers: {
|
|
81
|
+
Authorization: `Bearer ${this.apiKey}`,
|
|
82
|
+
},
|
|
83
|
+
});
|
|
84
|
+
return (_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.data;
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
getPayout(id) {
|
|
88
|
+
var _a;
|
|
89
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
90
|
+
const response = yield axios_1.default.get(`${this.baseUrl}/v1/payouts/{id}}`, {
|
|
91
|
+
headers: {
|
|
92
|
+
Authorization: `Bearer ${this.apiKey}`,
|
|
93
|
+
},
|
|
94
|
+
});
|
|
95
|
+
return (_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.data;
|
|
45
96
|
});
|
|
46
97
|
}
|
|
47
98
|
}
|