@coinbase-sample/prime-sdk-ts 0.6.1 → 0.6.2
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/dist/activities/index.js +21 -39
- package/dist/addressBooks/index.js +16 -3
- package/dist/allocations/index.js +16 -15
- package/dist/balances/index.js +23 -17
- package/dist/constants.js +1 -1
- package/dist/financing/index.js +16 -3
- package/dist/invoices/index.js +16 -12
- package/dist/orders/index.js +32 -52
- package/dist/positions/index.js +21 -6
- package/dist/products/index.js +16 -3
- package/dist/shared/paginatedResponse.js +3 -0
- package/dist/transactions/index.js +21 -12
- package/dist/types/constants.d.ts +1 -1
- package/dist/types/shared/paginatedResponse.d.ts +2 -0
- package/dist/users/index.js +21 -6
- package/dist/wallets/index.js +21 -9
- package/package.json +1 -1
package/dist/activities/index.js
CHANGED
|
@@ -23,6 +23,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
23
23
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
24
24
|
});
|
|
25
25
|
};
|
|
26
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
27
|
+
var t = {};
|
|
28
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
29
|
+
t[p] = s[p];
|
|
30
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
31
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
32
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
33
|
+
t[p[i]] = s[p[i]];
|
|
34
|
+
}
|
|
35
|
+
return t;
|
|
36
|
+
};
|
|
26
37
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
38
|
exports.ActivitiesService = void 0;
|
|
28
39
|
const paginatedResponse_1 = require("../shared/paginatedResponse");
|
|
@@ -50,28 +61,12 @@ class ActivitiesService {
|
|
|
50
61
|
}
|
|
51
62
|
listEntityActivities(request, options) {
|
|
52
63
|
return __awaiter(this, void 0, void 0, function* () {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}
|
|
57
|
-
if (request.endTime) {
|
|
58
|
-
queryParams.endTime = new Date(request.endTime).toISOString();
|
|
59
|
-
}
|
|
60
|
-
if (request.statuses) {
|
|
61
|
-
queryParams.statuses = request.statuses;
|
|
62
|
-
}
|
|
63
|
-
if (request.categories) {
|
|
64
|
-
queryParams.categories = request.categories;
|
|
65
|
-
}
|
|
66
|
-
if (request.symbols) {
|
|
67
|
-
queryParams.symbols = request.symbols;
|
|
68
|
-
}
|
|
69
|
-
if (request.activityLevel) {
|
|
70
|
-
queryParams.activityLevel = request.activityLevel;
|
|
71
|
-
}
|
|
64
|
+
const paginationParams = (0, paginatedResponse_1.getQueryParams)(this.client, request);
|
|
65
|
+
const { limit, cursor, sortDirection, entityId } = request, queryParams = __rest(request, ["limit", "cursor", "sortDirection", "entityId"]);
|
|
66
|
+
const finalQueryParams = Object.assign(Object.assign({}, paginationParams), queryParams);
|
|
72
67
|
const response = yield this.client.request({
|
|
73
|
-
url: `entities/${
|
|
74
|
-
queryParams,
|
|
68
|
+
url: `entities/${entityId}/activities`,
|
|
69
|
+
queryParams: finalQueryParams,
|
|
75
70
|
callOptions: options,
|
|
76
71
|
});
|
|
77
72
|
const paginationOptions = (0, paginatedResponse_1.getDefaultPaginationOptions)(this.client, options);
|
|
@@ -80,25 +75,12 @@ class ActivitiesService {
|
|
|
80
75
|
}
|
|
81
76
|
listPortfolioActivities(request, options) {
|
|
82
77
|
return __awaiter(this, void 0, void 0, function* () {
|
|
83
|
-
const
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
}
|
|
87
|
-
if (request.endTime) {
|
|
88
|
-
queryParams.endTime = new Date(request.endTime).toISOString();
|
|
89
|
-
}
|
|
90
|
-
if (request.statuses) {
|
|
91
|
-
queryParams.statuses = request.statuses;
|
|
92
|
-
}
|
|
93
|
-
if (request.categories) {
|
|
94
|
-
queryParams.categories = request.categories;
|
|
95
|
-
}
|
|
96
|
-
if (request.symbols) {
|
|
97
|
-
queryParams.symbols = request.symbols;
|
|
98
|
-
}
|
|
78
|
+
const paginationParams = (0, paginatedResponse_1.getQueryParams)(this.client, request);
|
|
79
|
+
const { limit, cursor, sortDirection, portfolioId } = request, queryParams = __rest(request, ["limit", "cursor", "sortDirection", "portfolioId"]);
|
|
80
|
+
const finalQueryParams = Object.assign(Object.assign({}, paginationParams), queryParams);
|
|
99
81
|
const response = yield this.client.request({
|
|
100
|
-
url: `portfolios/${
|
|
101
|
-
queryParams,
|
|
82
|
+
url: `portfolios/${portfolioId}/activities`,
|
|
83
|
+
queryParams: finalQueryParams,
|
|
102
84
|
callOptions: options,
|
|
103
85
|
});
|
|
104
86
|
const paginationOptions = (0, paginatedResponse_1.getDefaultPaginationOptions)(this.client, options);
|
|
@@ -8,6 +8,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
12
|
+
var t = {};
|
|
13
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
14
|
+
t[p] = s[p];
|
|
15
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
16
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
17
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
18
|
+
t[p[i]] = s[p[i]];
|
|
19
|
+
}
|
|
20
|
+
return t;
|
|
21
|
+
};
|
|
11
22
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
23
|
exports.AddressBooksService = void 0;
|
|
13
24
|
/**
|
|
@@ -33,10 +44,12 @@ class AddressBooksService {
|
|
|
33
44
|
}
|
|
34
45
|
listAddressBooks(request, options) {
|
|
35
46
|
return __awaiter(this, void 0, void 0, function* () {
|
|
36
|
-
const
|
|
47
|
+
const paginationParams = (0, paginatedResponse_1.getQueryParams)(this.client, request);
|
|
48
|
+
const { limit, cursor, sortDirection, portfolioId } = request, queryParams = __rest(request, ["limit", "cursor", "sortDirection", "portfolioId"]);
|
|
49
|
+
const finalQueryParams = Object.assign(Object.assign({}, paginationParams), queryParams);
|
|
37
50
|
const response = yield this.client.request({
|
|
38
|
-
url: `portfolios/${
|
|
39
|
-
queryParams,
|
|
51
|
+
url: `portfolios/${portfolioId}/address_book`,
|
|
52
|
+
queryParams: finalQueryParams,
|
|
40
53
|
callOptions: options,
|
|
41
54
|
});
|
|
42
55
|
const paginationOptions = (0, paginatedResponse_1.getDefaultPaginationOptions)(this.client, options);
|
|
@@ -8,6 +8,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
12
|
+
var t = {};
|
|
13
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
14
|
+
t[p] = s[p];
|
|
15
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
16
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
17
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
18
|
+
t[p[i]] = s[p[i]];
|
|
19
|
+
}
|
|
20
|
+
return t;
|
|
21
|
+
};
|
|
11
22
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
23
|
exports.AllocationService = void 0;
|
|
13
24
|
/**
|
|
@@ -55,22 +66,12 @@ class AllocationService {
|
|
|
55
66
|
}
|
|
56
67
|
listPortfolioAllocations(request, options) {
|
|
57
68
|
return __awaiter(this, void 0, void 0, function* () {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
}
|
|
62
|
-
if (request.endDate) {
|
|
63
|
-
queryParams.endDate = new Date(request.endDate).toISOString();
|
|
64
|
-
}
|
|
65
|
-
if (request.productIds) {
|
|
66
|
-
queryParams.productIds = request.productIds;
|
|
67
|
-
}
|
|
68
|
-
if (request.orderSide) {
|
|
69
|
-
queryParams.orderSide = request.orderSide;
|
|
70
|
-
}
|
|
69
|
+
const paginationParams = (0, paginatedResponse_1.getQueryParams)(this.client, request);
|
|
70
|
+
const { limit, cursor, sortDirection, portfolioId } = request, queryParams = __rest(request, ["limit", "cursor", "sortDirection", "portfolioId"]);
|
|
71
|
+
const finalQueryParams = Object.assign(Object.assign({}, paginationParams), queryParams);
|
|
71
72
|
const response = yield this.client.request({
|
|
72
|
-
url: `portfolios/${
|
|
73
|
-
queryParams,
|
|
73
|
+
url: `portfolios/${portfolioId}/allocations`,
|
|
74
|
+
queryParams: finalQueryParams,
|
|
74
75
|
callOptions: options,
|
|
75
76
|
});
|
|
76
77
|
const paginationOptions = (0, paginatedResponse_1.getDefaultPaginationOptions)(this.client, options);
|
package/dist/balances/index.js
CHANGED
|
@@ -8,6 +8,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
12
|
+
var t = {};
|
|
13
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
14
|
+
t[p] = s[p];
|
|
15
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
16
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
17
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
18
|
+
t[p[i]] = s[p[i]];
|
|
19
|
+
}
|
|
20
|
+
return t;
|
|
21
|
+
};
|
|
11
22
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
23
|
exports.BalancesService = void 0;
|
|
13
24
|
const paginatedResponse_1 = require("../shared/paginatedResponse");
|
|
@@ -17,9 +28,9 @@ class BalancesService {
|
|
|
17
28
|
}
|
|
18
29
|
listPortfolioBalances(request, options) {
|
|
19
30
|
return __awaiter(this, void 0, void 0, function* () {
|
|
20
|
-
const
|
|
31
|
+
const { portfolioId } = request, queryParams = __rest(request, ["portfolioId"]);
|
|
21
32
|
const response = yield this.client.request({
|
|
22
|
-
url: `portfolios/${
|
|
33
|
+
url: `portfolios/${portfolioId}/balances`,
|
|
23
34
|
queryParams,
|
|
24
35
|
callOptions: options,
|
|
25
36
|
});
|
|
@@ -37,13 +48,12 @@ class BalancesService {
|
|
|
37
48
|
}
|
|
38
49
|
listOnchainWalletBalances(request, options) {
|
|
39
50
|
return __awaiter(this, void 0, void 0, function* () {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}
|
|
51
|
+
const paginationParams = (0, paginatedResponse_1.getQueryParams)(this.client, request);
|
|
52
|
+
const { limit, cursor, portfolioId, walletId } = request, queryParams = __rest(request, ["limit", "cursor", "portfolioId", "walletId"]);
|
|
53
|
+
const finalQueryParams = Object.assign(Object.assign({}, paginationParams), queryParams);
|
|
44
54
|
const response = yield this.client.request({
|
|
45
|
-
url: `portfolios/${
|
|
46
|
-
queryParams,
|
|
55
|
+
url: `portfolios/${portfolioId}/wallets/${walletId}/web3_balances`,
|
|
56
|
+
queryParams: finalQueryParams,
|
|
47
57
|
callOptions: options,
|
|
48
58
|
});
|
|
49
59
|
const paginationOptions = (0, paginatedResponse_1.getDefaultPaginationOptions)(this.client, options);
|
|
@@ -52,16 +62,12 @@ class BalancesService {
|
|
|
52
62
|
}
|
|
53
63
|
listEntityBalances(request, options) {
|
|
54
64
|
return __awaiter(this, void 0, void 0, function* () {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}
|
|
59
|
-
if (request.aggregationType) {
|
|
60
|
-
queryParams.aggregationType = request.aggregationType;
|
|
61
|
-
}
|
|
65
|
+
const paginationParams = (0, paginatedResponse_1.getQueryParams)(this.client, request);
|
|
66
|
+
const { limit, cursor, entityId } = request, queryParams = __rest(request, ["limit", "cursor", "entityId"]);
|
|
67
|
+
const finalQueryParams = Object.assign(Object.assign({}, paginationParams), queryParams);
|
|
62
68
|
const response = yield this.client.request({
|
|
63
|
-
url: `entities/${
|
|
64
|
-
queryParams,
|
|
69
|
+
url: `entities/${entityId}/balances`,
|
|
70
|
+
queryParams: finalQueryParams,
|
|
65
71
|
callOptions: options,
|
|
66
72
|
});
|
|
67
73
|
const paginationOptions = (0, paginatedResponse_1.getDefaultPaginationOptions)(this.client, options);
|
package/dist/constants.js
CHANGED
|
@@ -16,7 +16,7 @@ exports.DEFAULT_MAX_ITEMS = exports.DEFAULT_MAX_PAGES = exports.DEFAULT_PAGINATI
|
|
|
16
16
|
* See the License for the specific language governing permissions and
|
|
17
17
|
* limitations under the License.
|
|
18
18
|
*/
|
|
19
|
-
exports.VERSION = '0.6.
|
|
19
|
+
exports.VERSION = '0.6.2';
|
|
20
20
|
exports.API_BASE_PATH = 'https://api.prime.coinbase.com/v1/';
|
|
21
21
|
exports.USER_AGENT = 'coinbase-prime-ts/' + exports.VERSION;
|
|
22
22
|
exports.CB_ACCESS_KEY_HEADER = 'X-CB-ACCESS-KEY';
|
package/dist/financing/index.js
CHANGED
|
@@ -8,6 +8,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
12
|
+
var t = {};
|
|
13
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
14
|
+
t[p] = s[p];
|
|
15
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
16
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
17
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
18
|
+
t[p[i]] = s[p[i]];
|
|
19
|
+
}
|
|
20
|
+
return t;
|
|
21
|
+
};
|
|
11
22
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
23
|
exports.FinancingService = void 0;
|
|
13
24
|
class FinancingService {
|
|
@@ -16,8 +27,10 @@ class FinancingService {
|
|
|
16
27
|
}
|
|
17
28
|
listExistingLocates(request, options) {
|
|
18
29
|
return __awaiter(this, void 0, void 0, function* () {
|
|
30
|
+
const { portfolioId } = request, queryParams = __rest(request, ["portfolioId"]);
|
|
19
31
|
const response = yield this.client.request({
|
|
20
|
-
url: `portfolios/${
|
|
32
|
+
url: `portfolios/${portfolioId}/locates`,
|
|
33
|
+
queryParams,
|
|
21
34
|
callOptions: options,
|
|
22
35
|
});
|
|
23
36
|
return response.data;
|
|
@@ -25,9 +38,9 @@ class FinancingService {
|
|
|
25
38
|
}
|
|
26
39
|
listInterestAccruals(request, options) {
|
|
27
40
|
return __awaiter(this, void 0, void 0, function* () {
|
|
28
|
-
const
|
|
41
|
+
const { entityId } = request, queryParams = __rest(request, ["entityId"]);
|
|
29
42
|
const response = yield this.client.request({
|
|
30
|
-
url: `entities/${
|
|
43
|
+
url: `entities/${entityId}/accruals`,
|
|
31
44
|
callOptions: options,
|
|
32
45
|
queryParams,
|
|
33
46
|
});
|
package/dist/invoices/index.js
CHANGED
|
@@ -8,6 +8,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
12
|
+
var t = {};
|
|
13
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
14
|
+
t[p] = s[p];
|
|
15
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
16
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
17
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
18
|
+
t[p[i]] = s[p[i]];
|
|
19
|
+
}
|
|
20
|
+
return t;
|
|
21
|
+
};
|
|
11
22
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
23
|
exports.InvoicesService = void 0;
|
|
13
24
|
const paginatedResponse_1 = require("../shared/paginatedResponse");
|
|
@@ -17,19 +28,12 @@ class InvoicesService {
|
|
|
17
28
|
}
|
|
18
29
|
listInvoices(request, options) {
|
|
19
30
|
return __awaiter(this, void 0, void 0, function* () {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
if (request.billingYear) {
|
|
25
|
-
queryParams.billingYear = request.billingYear;
|
|
26
|
-
}
|
|
27
|
-
if (request.billingMonth) {
|
|
28
|
-
queryParams.billingMonth = request.billingMonth;
|
|
29
|
-
}
|
|
31
|
+
const paginationParams = (0, paginatedResponse_1.getQueryParams)(this.client, request);
|
|
32
|
+
const { limit, cursor, sortDirection, entityId } = request, queryParams = __rest(request, ["limit", "cursor", "sortDirection", "entityId"]);
|
|
33
|
+
const finalQueryParams = Object.assign(Object.assign({}, paginationParams), queryParams);
|
|
30
34
|
const response = yield this.client.request({
|
|
31
|
-
url: `entities/${
|
|
32
|
-
queryParams,
|
|
35
|
+
url: `entities/${entityId}/invoices`,
|
|
36
|
+
queryParams: finalQueryParams,
|
|
33
37
|
callOptions: options,
|
|
34
38
|
});
|
|
35
39
|
const paginationOptions = (0, paginatedResponse_1.getDefaultPaginationOptions)(this.client, options);
|
package/dist/orders/index.js
CHANGED
|
@@ -8,6 +8,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
12
|
+
var t = {};
|
|
13
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
14
|
+
t[p] = s[p];
|
|
15
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
16
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
17
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
18
|
+
t[p[i]] = s[p[i]];
|
|
19
|
+
}
|
|
20
|
+
return t;
|
|
21
|
+
};
|
|
11
22
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
23
|
exports.OrdersService = void 0;
|
|
13
24
|
/**
|
|
@@ -53,16 +64,12 @@ class OrdersService {
|
|
|
53
64
|
}
|
|
54
65
|
listPortfolioFills(request, options) {
|
|
55
66
|
return __awaiter(this, void 0, void 0, function* () {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
}
|
|
60
|
-
if (request.endDate) {
|
|
61
|
-
queryParams.endDate = new Date(request.endDate).toISOString();
|
|
62
|
-
}
|
|
67
|
+
const paginationParams = (0, paginatedResponse_1.getQueryParams)(this.client, request);
|
|
68
|
+
const { limit, cursor, sortDirection, portfolioId } = request, queryParams = __rest(request, ["limit", "cursor", "sortDirection", "portfolioId"]);
|
|
69
|
+
const finalQueryParams = Object.assign(Object.assign({}, paginationParams), queryParams);
|
|
63
70
|
const response = yield this.client.request({
|
|
64
|
-
url: `portfolios/${
|
|
65
|
-
queryParams,
|
|
71
|
+
url: `portfolios/${portfolioId}/fills`,
|
|
72
|
+
queryParams: finalQueryParams,
|
|
66
73
|
callOptions: options,
|
|
67
74
|
});
|
|
68
75
|
const paginationOptions = (0, paginatedResponse_1.getDefaultPaginationOptions)(this.client, options);
|
|
@@ -71,28 +78,12 @@ class OrdersService {
|
|
|
71
78
|
}
|
|
72
79
|
listPortfolioOrders(request, options) {
|
|
73
80
|
return __awaiter(this, void 0, void 0, function* () {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
}
|
|
78
|
-
if (request.productIds) {
|
|
79
|
-
queryParams.productIds = request.productIds;
|
|
80
|
-
}
|
|
81
|
-
if (request.orderType) {
|
|
82
|
-
queryParams.orderType = request.orderType;
|
|
83
|
-
}
|
|
84
|
-
if (request.orderSide) {
|
|
85
|
-
queryParams.orderSide = request.orderSide;
|
|
86
|
-
}
|
|
87
|
-
if (request.startDate) {
|
|
88
|
-
queryParams.startDate = new Date(request.startDate).toISOString();
|
|
89
|
-
}
|
|
90
|
-
if (request.endDate) {
|
|
91
|
-
queryParams.endDate = new Date(request.endDate).toISOString();
|
|
92
|
-
}
|
|
81
|
+
const paginationParams = (0, paginatedResponse_1.getQueryParams)(this.client, request);
|
|
82
|
+
const { limit, cursor, sortDirection, portfolioId } = request, queryParams = __rest(request, ["limit", "cursor", "sortDirection", "portfolioId"]);
|
|
83
|
+
const finalQueryParams = Object.assign(Object.assign({}, paginationParams), queryParams);
|
|
93
84
|
const response = yield this.client.request({
|
|
94
|
-
url: `portfolios/${
|
|
95
|
-
queryParams,
|
|
85
|
+
url: `portfolios/${portfolioId}/orders`,
|
|
86
|
+
queryParams: finalQueryParams,
|
|
96
87
|
callOptions: options,
|
|
97
88
|
});
|
|
98
89
|
const paginationOptions = (0, paginatedResponse_1.getDefaultPaginationOptions)(this.client, options);
|
|
@@ -101,10 +92,12 @@ class OrdersService {
|
|
|
101
92
|
}
|
|
102
93
|
listOrderFills(request, options) {
|
|
103
94
|
return __awaiter(this, void 0, void 0, function* () {
|
|
104
|
-
const
|
|
95
|
+
const paginationParams = (0, paginatedResponse_1.getQueryParams)(this.client, request);
|
|
96
|
+
const { limit, cursor, sortDirection, portfolioId, orderId } = request, queryParams = __rest(request, ["limit", "cursor", "sortDirection", "portfolioId", "orderId"]);
|
|
97
|
+
const finalQueryParams = Object.assign(Object.assign({}, paginationParams), queryParams);
|
|
105
98
|
const response = yield this.client.request({
|
|
106
|
-
url: `portfolios/${
|
|
107
|
-
queryParams,
|
|
99
|
+
url: `portfolios/${portfolioId}/orders/${orderId}/fills`,
|
|
100
|
+
queryParams: finalQueryParams,
|
|
108
101
|
callOptions: options,
|
|
109
102
|
});
|
|
110
103
|
const paginationOptions = (0, paginatedResponse_1.getDefaultPaginationOptions)(this.client, options);
|
|
@@ -113,25 +106,12 @@ class OrdersService {
|
|
|
113
106
|
}
|
|
114
107
|
listOpenOrders(request, options) {
|
|
115
108
|
return __awaiter(this, void 0, void 0, function* () {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
}
|
|
120
|
-
if (request.orderType) {
|
|
121
|
-
queryParams.orderType = request.orderType;
|
|
122
|
-
}
|
|
123
|
-
if (request.orderSide) {
|
|
124
|
-
queryParams.orderSide = request.orderSide;
|
|
125
|
-
}
|
|
126
|
-
if (request.startDate) {
|
|
127
|
-
queryParams.startDate = new Date(request.startDate).toISOString();
|
|
128
|
-
}
|
|
129
|
-
if (request.endDate) {
|
|
130
|
-
queryParams.endDate = new Date(request.endDate).toISOString();
|
|
131
|
-
}
|
|
109
|
+
const paginationParams = (0, paginatedResponse_1.getQueryParams)(this.client, request);
|
|
110
|
+
const { limit, cursor, sortDirection, portfolioId } = request, queryParams = __rest(request, ["limit", "cursor", "sortDirection", "portfolioId"]);
|
|
111
|
+
const finalQueryParams = Object.assign(Object.assign({}, paginationParams), queryParams);
|
|
132
112
|
const response = yield this.client.request({
|
|
133
|
-
url: `portfolios/${
|
|
134
|
-
queryParams,
|
|
113
|
+
url: `portfolios/${portfolioId}/open_orders`,
|
|
114
|
+
queryParams: finalQueryParams,
|
|
135
115
|
callOptions: options,
|
|
136
116
|
});
|
|
137
117
|
const paginationOptions = (0, paginatedResponse_1.getDefaultPaginationOptions)(this.client, options);
|
|
@@ -141,7 +121,7 @@ class OrdersService {
|
|
|
141
121
|
createOrderPreview(request, options) {
|
|
142
122
|
return __awaiter(this, void 0, void 0, function* () {
|
|
143
123
|
const response = yield this.client.request({
|
|
144
|
-
url: `portfolios/${request.portfolioId}/
|
|
124
|
+
url: `portfolios/${request.portfolioId}/order_preview`,
|
|
145
125
|
method: core_ts_1.Method.POST,
|
|
146
126
|
bodyParams: request,
|
|
147
127
|
callOptions: options,
|
package/dist/positions/index.js
CHANGED
|
@@ -8,6 +8,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
12
|
+
var t = {};
|
|
13
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
14
|
+
t[p] = s[p];
|
|
15
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
16
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
17
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
18
|
+
t[p[i]] = s[p[i]];
|
|
19
|
+
}
|
|
20
|
+
return t;
|
|
21
|
+
};
|
|
11
22
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
23
|
exports.PositionsService = void 0;
|
|
13
24
|
const paginatedResponse_1 = require("../shared/paginatedResponse");
|
|
@@ -17,11 +28,13 @@ class PositionsService {
|
|
|
17
28
|
}
|
|
18
29
|
listAggregateEntityPositions(request, options) {
|
|
19
30
|
return __awaiter(this, void 0, void 0, function* () {
|
|
20
|
-
const
|
|
31
|
+
const paginationParams = (0, paginatedResponse_1.getQueryParams)(this.client, request);
|
|
32
|
+
const { limit, cursor, sortDirection, entityId } = request, queryParams = __rest(request, ["limit", "cursor", "sortDirection", "entityId"]);
|
|
33
|
+
const finalQueryParams = Object.assign(Object.assign({}, paginationParams), queryParams);
|
|
21
34
|
const response = yield this.client.request({
|
|
22
|
-
url: `entities/${
|
|
35
|
+
url: `entities/${entityId}/aggregate_positions`,
|
|
23
36
|
callOptions: options,
|
|
24
|
-
queryParams,
|
|
37
|
+
queryParams: finalQueryParams,
|
|
25
38
|
});
|
|
26
39
|
const paginationOptions = (0, paginatedResponse_1.getDefaultPaginationOptions)(this.client, options);
|
|
27
40
|
return (0, paginatedResponse_1.createPaginatedResponse)(response.data, this.listAggregateEntityPositions.bind(this), request, paginatedResponse_1.ResponseExtractors.positions, paginationOptions);
|
|
@@ -29,11 +42,13 @@ class PositionsService {
|
|
|
29
42
|
}
|
|
30
43
|
listEntityPositions(request, options) {
|
|
31
44
|
return __awaiter(this, void 0, void 0, function* () {
|
|
32
|
-
const
|
|
45
|
+
const paginationParams = (0, paginatedResponse_1.getQueryParams)(this.client, request);
|
|
46
|
+
const { limit, cursor, sortDirection, entityId } = request, queryParams = __rest(request, ["limit", "cursor", "sortDirection", "entityId"]);
|
|
47
|
+
const finalQueryParams = Object.assign(Object.assign({}, paginationParams), queryParams);
|
|
33
48
|
const response = yield this.client.request({
|
|
34
|
-
url: `entities/${
|
|
49
|
+
url: `entities/${entityId}/positions`,
|
|
35
50
|
callOptions: options,
|
|
36
|
-
queryParams,
|
|
51
|
+
queryParams: finalQueryParams,
|
|
37
52
|
});
|
|
38
53
|
const paginationOptions = (0, paginatedResponse_1.getDefaultPaginationOptions)(this.client, options);
|
|
39
54
|
return (0, paginatedResponse_1.createPaginatedResponse)(response.data, this.listEntityPositions.bind(this), request, paginatedResponse_1.ResponseExtractors.positions, paginationOptions);
|
package/dist/products/index.js
CHANGED
|
@@ -8,6 +8,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
12
|
+
var t = {};
|
|
13
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
14
|
+
t[p] = s[p];
|
|
15
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
16
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
17
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
18
|
+
t[p[i]] = s[p[i]];
|
|
19
|
+
}
|
|
20
|
+
return t;
|
|
21
|
+
};
|
|
11
22
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
23
|
exports.ProductsService = void 0;
|
|
13
24
|
const paginatedResponse_1 = require("../shared/paginatedResponse");
|
|
@@ -17,10 +28,12 @@ class ProductsService {
|
|
|
17
28
|
}
|
|
18
29
|
listProducts(request, options) {
|
|
19
30
|
return __awaiter(this, void 0, void 0, function* () {
|
|
20
|
-
const
|
|
31
|
+
const paginationParams = (0, paginatedResponse_1.getQueryParams)(this.client, request);
|
|
32
|
+
const { limit, cursor, sortDirection, portfolioId } = request, queryParams = __rest(request, ["limit", "cursor", "sortDirection", "portfolioId"]);
|
|
33
|
+
const finalQueryParams = Object.assign(Object.assign({}, paginationParams), queryParams);
|
|
21
34
|
const response = yield this.client.request({
|
|
22
|
-
url: `portfolios/${
|
|
23
|
-
queryParams,
|
|
35
|
+
url: `portfolios/${portfolioId}/products`,
|
|
36
|
+
queryParams: finalQueryParams,
|
|
24
37
|
callOptions: options,
|
|
25
38
|
});
|
|
26
39
|
const paginationOptions = (0, paginatedResponse_1.getDefaultPaginationOptions)(this.client, options);
|
|
@@ -178,6 +178,9 @@ function getQueryParams(client, request) {
|
|
|
178
178
|
if (request.cursor) {
|
|
179
179
|
queryParams.cursor = request.cursor;
|
|
180
180
|
}
|
|
181
|
+
if (request.sortDirection) {
|
|
182
|
+
queryParams.sortDirection = request.sortDirection;
|
|
183
|
+
}
|
|
181
184
|
if (!queryParams.limit) {
|
|
182
185
|
queryParams.limit = client.getDefaultPaginationLimit();
|
|
183
186
|
}
|
|
@@ -8,6 +8,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
12
|
+
var t = {};
|
|
13
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
14
|
+
t[p] = s[p];
|
|
15
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
16
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
17
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
18
|
+
t[p[i]] = s[p[i]];
|
|
19
|
+
}
|
|
20
|
+
return t;
|
|
21
|
+
};
|
|
11
22
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
23
|
exports.TransactionsService = void 0;
|
|
13
24
|
/**
|
|
@@ -42,13 +53,12 @@ class TransactionsService {
|
|
|
42
53
|
}
|
|
43
54
|
listPortfolioTransactions(request, options) {
|
|
44
55
|
return __awaiter(this, void 0, void 0, function* () {
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}
|
|
56
|
+
const paginationParams = (0, paginatedResponse_1.getQueryParams)(this.client, request);
|
|
57
|
+
const { limit, cursor, sortDirection, portfolioId } = request, queryParams = __rest(request, ["limit", "cursor", "sortDirection", "portfolioId"]);
|
|
58
|
+
const finalQueryParams = Object.assign(Object.assign({}, paginationParams), queryParams);
|
|
49
59
|
const response = yield this.client.request({
|
|
50
|
-
url: `portfolios/${
|
|
51
|
-
queryParams,
|
|
60
|
+
url: `portfolios/${portfolioId}/transactions`,
|
|
61
|
+
queryParams: finalQueryParams,
|
|
52
62
|
callOptions: options,
|
|
53
63
|
});
|
|
54
64
|
const responseData = response.data;
|
|
@@ -60,13 +70,12 @@ class TransactionsService {
|
|
|
60
70
|
}
|
|
61
71
|
listWalletTransactions(request, options) {
|
|
62
72
|
return __awaiter(this, void 0, void 0, function* () {
|
|
63
|
-
const
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
}
|
|
73
|
+
const paginationParams = (0, paginatedResponse_1.getQueryParams)(this.client, request);
|
|
74
|
+
const { limit, cursor, sortDirection, portfolioId, walletId } = request, queryParams = __rest(request, ["limit", "cursor", "sortDirection", "portfolioId", "walletId"]);
|
|
75
|
+
const finalQueryParams = Object.assign(Object.assign({}, paginationParams), queryParams);
|
|
67
76
|
const response = yield this.client.request({
|
|
68
|
-
url: `portfolios/${
|
|
69
|
-
queryParams,
|
|
77
|
+
url: `portfolios/${portfolioId}/wallets/${walletId}/transactions`,
|
|
78
|
+
queryParams: finalQueryParams,
|
|
70
79
|
callOptions: options,
|
|
71
80
|
});
|
|
72
81
|
const responseData = response.data;
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
export declare const VERSION = "0.6.
|
|
16
|
+
export declare const VERSION = "0.6.2";
|
|
17
17
|
export declare const API_BASE_PATH = "https://api.prime.coinbase.com/v1/";
|
|
18
18
|
export declare const USER_AGENT: string;
|
|
19
19
|
export declare const CB_ACCESS_KEY_HEADER = "X-CB-ACCESS-KEY";
|
|
@@ -15,12 +15,14 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import { CoinbaseCallOptions } from '@coinbase-sample/core-ts';
|
|
17
17
|
import { CoinbasePrimeClient } from 'src/client';
|
|
18
|
+
import { SortDirection } from '../model/enums/SortDirection';
|
|
18
19
|
/**
|
|
19
20
|
* Base type for paginated requests
|
|
20
21
|
*/
|
|
21
22
|
export type BasePaginatedRequest = {
|
|
22
23
|
cursor?: string;
|
|
23
24
|
limit?: number;
|
|
25
|
+
sortDirection?: SortDirection.Asc | SortDirection.Desc | undefined;
|
|
24
26
|
};
|
|
25
27
|
/**
|
|
26
28
|
* API call signature for paginated endpoints
|
package/dist/users/index.js
CHANGED
|
@@ -8,6 +8,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
12
|
+
var t = {};
|
|
13
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
14
|
+
t[p] = s[p];
|
|
15
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
16
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
17
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
18
|
+
t[p[i]] = s[p[i]];
|
|
19
|
+
}
|
|
20
|
+
return t;
|
|
21
|
+
};
|
|
11
22
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
23
|
exports.UsersService = void 0;
|
|
13
24
|
const paginatedResponse_1 = require("../shared/paginatedResponse");
|
|
@@ -17,10 +28,12 @@ class UsersService {
|
|
|
17
28
|
}
|
|
18
29
|
listUsers(request, options) {
|
|
19
30
|
return __awaiter(this, void 0, void 0, function* () {
|
|
20
|
-
const
|
|
31
|
+
const paginationParams = (0, paginatedResponse_1.getQueryParams)(this.client, request);
|
|
32
|
+
const { limit, cursor, sortDirection, entityId } = request, queryParams = __rest(request, ["limit", "cursor", "sortDirection", "entityId"]);
|
|
33
|
+
const finalQueryParams = Object.assign(Object.assign({}, paginationParams), queryParams);
|
|
21
34
|
const response = yield this.client.request({
|
|
22
|
-
url: `entities/${
|
|
23
|
-
queryParams,
|
|
35
|
+
url: `entities/${entityId}/users`,
|
|
36
|
+
queryParams: finalQueryParams,
|
|
24
37
|
callOptions: options,
|
|
25
38
|
});
|
|
26
39
|
const responseData = response.data;
|
|
@@ -30,10 +43,12 @@ class UsersService {
|
|
|
30
43
|
}
|
|
31
44
|
listPortfolioUsers(request, options) {
|
|
32
45
|
return __awaiter(this, void 0, void 0, function* () {
|
|
33
|
-
const
|
|
46
|
+
const paginationParams = (0, paginatedResponse_1.getQueryParams)(this.client, request);
|
|
47
|
+
const { limit, cursor, sortDirection, portfolioId } = request, queryParams = __rest(request, ["limit", "cursor", "sortDirection", "portfolioId"]);
|
|
48
|
+
const finalQueryParams = Object.assign(Object.assign({}, paginationParams), queryParams);
|
|
34
49
|
const response = yield this.client.request({
|
|
35
|
-
url: `portfolios/${
|
|
36
|
-
queryParams,
|
|
50
|
+
url: `portfolios/${portfolioId}/users`,
|
|
51
|
+
queryParams: finalQueryParams,
|
|
37
52
|
callOptions: options,
|
|
38
53
|
});
|
|
39
54
|
const responseData = response.data;
|
package/dist/wallets/index.js
CHANGED
|
@@ -8,6 +8,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
12
|
+
var t = {};
|
|
13
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
14
|
+
t[p] = s[p];
|
|
15
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
16
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
17
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
18
|
+
t[p[i]] = s[p[i]];
|
|
19
|
+
}
|
|
20
|
+
return t;
|
|
21
|
+
};
|
|
11
22
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
23
|
exports.WalletsService = void 0;
|
|
13
24
|
/**
|
|
@@ -33,10 +44,12 @@ class WalletsService {
|
|
|
33
44
|
}
|
|
34
45
|
listWallets(request, options) {
|
|
35
46
|
return __awaiter(this, void 0, void 0, function* () {
|
|
36
|
-
const
|
|
47
|
+
const paginationParams = (0, paginatedResponse_1.getQueryParams)(this.client, request);
|
|
48
|
+
const { limit, cursor, portfolioId } = request, queryParams = __rest(request, ["limit", "cursor", "portfolioId"]);
|
|
49
|
+
const finalQueryParams = Object.assign(Object.assign({}, paginationParams), queryParams);
|
|
37
50
|
const response = yield this.client.request({
|
|
38
|
-
url: `portfolios/${
|
|
39
|
-
queryParams,
|
|
51
|
+
url: `portfolios/${portfolioId}/wallets`,
|
|
52
|
+
queryParams: finalQueryParams,
|
|
40
53
|
callOptions: options,
|
|
41
54
|
});
|
|
42
55
|
const responseData = response.data;
|
|
@@ -75,13 +88,12 @@ class WalletsService {
|
|
|
75
88
|
}
|
|
76
89
|
listWalletAddresses(request, options) {
|
|
77
90
|
return __awaiter(this, void 0, void 0, function* () {
|
|
78
|
-
const
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
}
|
|
91
|
+
const paginationParams = (0, paginatedResponse_1.getQueryParams)(this.client, request);
|
|
92
|
+
const { limit, cursor, portfolioId, walletId } = request, queryParams = __rest(request, ["limit", "cursor", "portfolioId", "walletId"]);
|
|
93
|
+
const finalQueryParams = Object.assign(Object.assign({}, paginationParams), queryParams);
|
|
82
94
|
const response = yield this.client.request({
|
|
83
|
-
url: `portfolios/${
|
|
84
|
-
queryParams,
|
|
95
|
+
url: `portfolios/${portfolioId}/wallets/${walletId}/addresses`,
|
|
96
|
+
queryParams: finalQueryParams,
|
|
85
97
|
callOptions: options,
|
|
86
98
|
});
|
|
87
99
|
const responseData = response.data;
|