@coinbase-sample/prime-sdk-ts 0.4.1 → 0.6.0
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/README.md +22 -0
- package/dist/activities/index.js +40 -4
- package/dist/addressBooks/index.js +4 -2
- package/dist/allocations/index.js +19 -3
- package/dist/balances/index.js +17 -5
- package/dist/client.js +7 -2
- package/dist/constants.js +5 -2
- package/dist/financing/index.js +18 -0
- package/dist/index.js +3 -1
- package/dist/invoices/index.js +16 -3
- package/dist/model/Counterparty.js +21 -0
- package/dist/model/CounterpartyDestination.js +21 -0
- package/dist/model/CreateNetAllocationRequest.js +21 -0
- package/dist/model/CreateWalletDepositAddressRequest.js +21 -0
- package/dist/model/FCMMarginCall.js +21 -0
- package/dist/model/GetFcmMarginCallDetailsResponse.js +21 -0
- package/dist/model/GetFcmRiskLimitsResponse.js +21 -0
- package/dist/model/GetOrderEditHistoryResponse.js +21 -0
- package/dist/model/GetPortfolioCounterpartyIDResponse.js +21 -0
- package/dist/model/LimitOrderEdit.js +21 -0
- package/dist/model/ListWalletAddressesResponse.js +21 -0
- package/dist/model/OrderEdit.js +21 -0
- package/dist/model/PortfolioStakingInitiateRequest.js +21 -0
- package/dist/model/PortfolioStakingInitiateResponse.js +21 -0
- package/dist/model/PortfolioStakingMetadata.js +21 -0
- package/dist/model/PortfolioStakingUnstakeRequest.js +21 -0
- package/dist/model/PortfolioStakingUnstakeResponse.js +21 -0
- package/dist/model/StakingUnstakeRequest.js +21 -0
- package/dist/model/WalletStakeInputs.js +21 -0
- package/dist/model/WalletUnstakeInputs.js +21 -0
- package/dist/model/enums/AllocationSizeType.js +0 -1
- package/dist/model/enums/AssetChangeType.js +0 -1
- package/dist/model/enums/CustodyActivityType.js +0 -1
- package/dist/model/enums/DestinationType.js +4 -4
- package/dist/model/enums/FcmMarginCallState.js +30 -0
- package/dist/model/enums/FcmMarginCallType.js +28 -0
- package/dist/model/enums/OrderSide.js +0 -1
- package/dist/model/enums/OrderStatus.js +0 -1
- package/dist/model/enums/OrderType.js +0 -1
- package/dist/model/enums/PaymentMethodType.js +3 -4
- package/dist/model/enums/PortfolioBalanceType.js +0 -1
- package/dist/model/enums/ProductPermissions.js +0 -1
- package/dist/model/enums/SigningStatus.js +0 -1
- package/dist/model/enums/TimeInForceType.js +0 -1
- package/dist/model/enums/TransactionStatus.js +1 -2
- package/dist/model/enums/TransactionType.js +0 -1
- package/dist/model/enums/TransferLocationType.js +0 -1
- package/dist/model/enums/UserRole.js +0 -1
- package/dist/model/enums/VisibilityStatus.js +0 -1
- package/dist/model/enums/WalletDepositInstructionType.js +0 -1
- package/dist/model/enums/WalletType.js +0 -1
- package/dist/model/enums/index.js +5 -1
- package/dist/orders/index.js +63 -8
- package/dist/portfolios/index.js +9 -0
- package/dist/portfolios/types.js +15 -0
- package/dist/positions/index.js +9 -6
- package/dist/products/index.js +4 -2
- package/dist/shared/brand.js +15 -0
- package/dist/shared/paginatedResponse.js +185 -0
- package/dist/shared/pagination.js +15 -0
- package/dist/shared/toCamelCase.js +15 -0
- package/dist/staking/index.js +24 -0
- package/dist/transactions/index.js +17 -2
- package/dist/types/activities/types.d.ts +6 -3
- package/dist/types/addressBooks/types.d.ts +4 -2
- package/dist/types/allocations/types.d.ts +4 -2
- package/dist/types/assets/types.d.ts +1 -1
- package/dist/types/balances/types.d.ts +6 -3
- package/dist/types/client.d.ts +2 -2
- package/dist/types/commission/types.d.ts +1 -1
- package/dist/types/constants.d.ts +4 -1
- package/dist/types/financing/index.d.ts +5 -1
- package/dist/types/financing/types.d.ts +10 -2
- package/dist/types/futures/types.d.ts +1 -1
- package/dist/types/index.d.ts +5 -4
- package/dist/types/invoices/index.d.ts +2 -2
- package/dist/types/invoices/types.d.ts +9 -3
- package/dist/types/model/Commission.d.ts +1 -1
- package/dist/types/model/Counterparty.d.ts +25 -0
- package/dist/types/model/CounterpartyDestination.d.ts +22 -0
- package/dist/types/model/CreateAllocationRequest.d.ts +0 -4
- package/dist/types/model/CreateNetAllocationRequest.d.ts +48 -0
- package/dist/types/model/CreateOnchainTransactionRequestEvmParams.d.ts +1 -1
- package/dist/types/model/CreateOrderRequest.d.ts +6 -2
- package/dist/types/model/CreateWalletDepositAddressRequest.d.ts +25 -0
- package/dist/types/model/CreateWalletWithdrawalRequest.d.ts +2 -0
- package/dist/types/model/CreateWalletWithdrawalResponse.d.ts +2 -0
- package/dist/types/model/FCMMarginCall.d.ts +41 -0
- package/dist/types/model/Fill.d.ts +9 -1
- package/dist/types/model/GetFcmBalanceResponse.d.ts +4 -0
- package/dist/types/model/GetFcmMarginCallDetailsResponse.d.ts +26 -0
- package/dist/types/model/GetFcmRiskLimitsResponse.d.ts +45 -0
- package/dist/types/model/GetOrderEditHistoryResponse.d.ts +35 -0
- package/dist/types/model/GetPortfolioCounterpartyIDResponse.d.ts +23 -0
- package/dist/types/model/LimitOrderEdit.d.ts +29 -0
- package/dist/types/model/ListWalletAddressesResponse.d.ts +25 -0
- package/dist/types/model/Order.d.ts +31 -1
- package/dist/types/model/OrderEdit.d.ts +30 -0
- package/dist/types/model/OrderPreviewRequest.d.ts +11 -2
- package/dist/types/model/PortfolioStakingInitiateRequest.d.ts +35 -0
- package/dist/types/model/PortfolioStakingInitiateResponse.d.ts +29 -0
- package/dist/types/model/PortfolioStakingMetadata.d.ts +25 -0
- package/dist/types/model/PortfolioStakingUnstakeRequest.d.ts +35 -0
- package/dist/types/model/PortfolioStakingUnstakeResponse.d.ts +29 -0
- package/dist/types/model/PostOrderPreviewResponse.d.ts +20 -0
- package/dist/types/model/RFQProductDetails.d.ts +4 -0
- package/dist/types/model/StakingInitiateRequest.d.ts +5 -2
- package/dist/types/model/StakingInitiateResponse.d.ts +3 -0
- package/dist/types/model/StakingUnstakeRequest.d.ts +30 -0
- package/dist/types/model/StakingUnstakeResponse.d.ts +3 -0
- package/dist/types/model/TransferLocation.d.ts +8 -0
- package/dist/types/model/WalletStakeInputs.d.ts +32 -0
- package/dist/types/model/WalletUnstakeInputs.d.ts +28 -0
- package/dist/types/model/enums/AllocationSizeType.d.ts +0 -1
- package/dist/types/model/enums/AssetChangeType.d.ts +0 -1
- package/dist/types/model/enums/CustodyActivityType.d.ts +0 -1
- package/dist/types/model/enums/DestinationType.d.ts +4 -4
- package/dist/types/model/enums/FcmMarginCallState.d.ts +26 -0
- package/dist/types/model/enums/FcmMarginCallType.d.ts +24 -0
- package/dist/types/model/enums/OrderSide.d.ts +0 -1
- package/dist/types/model/enums/OrderStatus.d.ts +0 -1
- package/dist/types/model/enums/OrderType.d.ts +0 -1
- package/dist/types/model/enums/PaymentMethodType.d.ts +3 -4
- package/dist/types/model/enums/PortfolioBalanceType.d.ts +0 -1
- package/dist/types/model/enums/ProductPermissions.d.ts +0 -1
- package/dist/types/model/enums/SigningStatus.d.ts +0 -1
- package/dist/types/model/enums/TimeInForceType.d.ts +0 -1
- package/dist/types/model/enums/TransactionStatus.d.ts +1 -2
- package/dist/types/model/enums/TransactionType.d.ts +0 -1
- package/dist/types/model/enums/TransferLocationType.d.ts +0 -1
- package/dist/types/model/enums/UserRole.d.ts +0 -1
- package/dist/types/model/enums/VisibilityStatus.d.ts +0 -1
- package/dist/types/model/enums/WalletDepositInstructionType.d.ts +0 -1
- package/dist/types/model/enums/WalletType.d.ts +0 -1
- package/dist/types/model/enums/index.d.ts +2 -0
- package/dist/types/model/index.d.ts +20 -0
- package/dist/types/onchainAddressBook/types.d.ts +1 -1
- package/dist/types/orders/index.d.ts +3 -1
- package/dist/types/orders/types.d.ts +17 -7
- package/dist/types/paymentMethods/types.d.ts +1 -1
- package/dist/types/portfolios/index.d.ts +3 -1
- package/dist/types/portfolios/types.d.ts +6 -2
- package/dist/types/positions/types.d.ts +9 -9
- package/dist/types/products/types.d.ts +4 -2
- package/dist/types/shared/brand.d.ts +15 -0
- package/dist/types/shared/paginatedResponse.d.ts +120 -0
- package/dist/types/shared/toCamelCase.d.ts +15 -0
- package/dist/types/staking/index.d.ts +5 -1
- package/dist/types/staking/types.d.ts +10 -2
- package/dist/types/transactions/types.d.ts +7 -3
- package/dist/types/users/types.d.ts +9 -5
- package/dist/types/wallets/types.d.ts +7 -5
- package/dist/users/index.js +11 -2
- package/dist/wallets/index.js +17 -21
- package/package.json +12 -11
package/dist/products/index.js
CHANGED
|
@@ -10,19 +10,21 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.ProductsService = void 0;
|
|
13
|
+
const paginatedResponse_1 = require("../shared/paginatedResponse");
|
|
13
14
|
class ProductsService {
|
|
14
15
|
constructor(client) {
|
|
15
16
|
this.client = client;
|
|
16
17
|
}
|
|
17
18
|
listProducts(request, options) {
|
|
18
19
|
return __awaiter(this, void 0, void 0, function* () {
|
|
19
|
-
const queryParams =
|
|
20
|
+
const queryParams = (0, paginatedResponse_1.getQueryParams)(this.client, request);
|
|
20
21
|
const response = yield this.client.request({
|
|
21
22
|
url: `portfolios/${request.portfolioId}/products`,
|
|
22
23
|
queryParams,
|
|
23
24
|
callOptions: options,
|
|
24
25
|
});
|
|
25
|
-
|
|
26
|
+
const paginationOptions = (0, paginatedResponse_1.getDefaultPaginationOptions)(this.client, options);
|
|
27
|
+
return (0, paginatedResponse_1.createPaginatedResponse)(response.data, this.listProducts.bind(this), request, paginatedResponse_1.ResponseExtractors.products, paginationOptions);
|
|
26
28
|
});
|
|
27
29
|
}
|
|
28
30
|
}
|
package/dist/shared/brand.js
CHANGED
|
@@ -1,2 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright 2025-present Coinbase Global, Inc.
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
2
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright 2025-present Coinbase Global, Inc.
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
18
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
19
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
20
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
21
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
22
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
23
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
+
exports.ResponseExtractors = void 0;
|
|
28
|
+
exports.createPaginatedResponse = createPaginatedResponse;
|
|
29
|
+
exports.getDefaultPaginationOptions = getDefaultPaginationOptions;
|
|
30
|
+
exports.getQueryParams = getQueryParams;
|
|
31
|
+
const constants_1 = require("../constants");
|
|
32
|
+
/**
|
|
33
|
+
* Validates that a number is a positive integer
|
|
34
|
+
*/
|
|
35
|
+
function validatePositiveInteger(value, defaultValue) {
|
|
36
|
+
if (value === undefined || value === null)
|
|
37
|
+
return defaultValue;
|
|
38
|
+
const num = Number(value);
|
|
39
|
+
if (!Number.isInteger(num) || num <= 0) {
|
|
40
|
+
throw new Error(`Value must be a positive integer, got: ${value}`);
|
|
41
|
+
}
|
|
42
|
+
return num;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Factory function to create enhanced response objects with pagination methods
|
|
46
|
+
*/
|
|
47
|
+
function createPaginatedResponse(responseData, apiCall, baseRequest, dataExtractor, options) {
|
|
48
|
+
var _a, _b;
|
|
49
|
+
const paginationMethods = {
|
|
50
|
+
__apiCall: apiCall,
|
|
51
|
+
__baseRequest: baseRequest,
|
|
52
|
+
__dataExtractor: dataExtractor,
|
|
53
|
+
__config: {
|
|
54
|
+
defaultLimit: 25,
|
|
55
|
+
maxPages: (_a = options === null || options === void 0 ? void 0 : options.maxPages) !== null && _a !== void 0 ? _a : constants_1.DEFAULT_MAX_PAGES,
|
|
56
|
+
maxItems: (_b = options === null || options === void 0 ? void 0 : options.maxItems) !== null && _b !== void 0 ? _b : constants_1.DEFAULT_MAX_ITEMS,
|
|
57
|
+
},
|
|
58
|
+
__currentPage: 1,
|
|
59
|
+
__totalItemsFetched: 0,
|
|
60
|
+
hasNext() {
|
|
61
|
+
var _a, _b, _c, _d;
|
|
62
|
+
const pagination = this.pagination;
|
|
63
|
+
const hasApiNext = (_b = (_a = pagination === null || pagination === void 0 ? void 0 : pagination.has_next) !== null && _a !== void 0 ? _a : pagination === null || pagination === void 0 ? void 0 : pagination.hasNext) !== null && _b !== void 0 ? _b : false;
|
|
64
|
+
// Check if API has more pages
|
|
65
|
+
if (!hasApiNext) {
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
// Check if we've reached the max pages limit
|
|
69
|
+
if (this.__currentPage >= ((_c = this.__config.maxPages) !== null && _c !== void 0 ? _c : constants_1.DEFAULT_MAX_PAGES)) {
|
|
70
|
+
return false;
|
|
71
|
+
}
|
|
72
|
+
// Check if we've reached the max items limit
|
|
73
|
+
if (this.__totalItemsFetched >=
|
|
74
|
+
((_d = this.__config.maxItems) !== null && _d !== void 0 ? _d : constants_1.DEFAULT_MAX_ITEMS)) {
|
|
75
|
+
return false;
|
|
76
|
+
}
|
|
77
|
+
return true;
|
|
78
|
+
},
|
|
79
|
+
getNextCursor() {
|
|
80
|
+
const pagination = this.pagination;
|
|
81
|
+
return pagination === null || pagination === void 0 ? void 0 : pagination.nextCursor;
|
|
82
|
+
},
|
|
83
|
+
next(options) {
|
|
84
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
85
|
+
var _a, _b;
|
|
86
|
+
if (options === null || options === void 0 ? void 0 : options.maxPages) {
|
|
87
|
+
this.__config.maxPages = validatePositiveInteger(options.maxPages, constants_1.DEFAULT_MAX_PAGES);
|
|
88
|
+
}
|
|
89
|
+
if (options === null || options === void 0 ? void 0 : options.maxItems) {
|
|
90
|
+
this.__config.maxItems = validatePositiveInteger(options.maxItems, constants_1.DEFAULT_MAX_ITEMS);
|
|
91
|
+
}
|
|
92
|
+
if (!this.hasNext()) {
|
|
93
|
+
return null;
|
|
94
|
+
}
|
|
95
|
+
const request = Object.assign(Object.assign({}, this.__baseRequest), { cursor: this.getNextCursor(), limit: (_b = (_a = this.__baseRequest) === null || _a === void 0 ? void 0 : _a.limit) !== null && _b !== void 0 ? _b : this.__config.defaultLimit });
|
|
96
|
+
const nextResponse = yield this.__apiCall(request, options);
|
|
97
|
+
if (nextResponse) {
|
|
98
|
+
// Update pagination tracking
|
|
99
|
+
nextResponse.__currentPage = this.__currentPage + 1;
|
|
100
|
+
const nextData = this.__dataExtractor(nextResponse);
|
|
101
|
+
nextResponse.__totalItemsFetched =
|
|
102
|
+
this.__totalItemsFetched + nextData.length;
|
|
103
|
+
}
|
|
104
|
+
return nextResponse;
|
|
105
|
+
});
|
|
106
|
+
},
|
|
107
|
+
fetchAll(options, progressCallback) {
|
|
108
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
109
|
+
var _a, _b;
|
|
110
|
+
const allData = [];
|
|
111
|
+
let currentResponse = this;
|
|
112
|
+
let pageCount = 1;
|
|
113
|
+
let totalItems = 0;
|
|
114
|
+
if (options === null || options === void 0 ? void 0 : options.maxPages) {
|
|
115
|
+
this.__config.maxPages = validatePositiveInteger(options.maxPages, constants_1.DEFAULT_MAX_PAGES);
|
|
116
|
+
}
|
|
117
|
+
if (options === null || options === void 0 ? void 0 : options.maxItems) {
|
|
118
|
+
this.__config.maxItems = validatePositiveInteger(options.maxItems, constants_1.DEFAULT_MAX_ITEMS);
|
|
119
|
+
}
|
|
120
|
+
// Add current page data
|
|
121
|
+
const currentData = this.__dataExtractor(currentResponse);
|
|
122
|
+
allData.push(...currentData);
|
|
123
|
+
totalItems += currentData.length;
|
|
124
|
+
progressCallback === null || progressCallback === void 0 ? void 0 : progressCallback(pageCount, totalItems);
|
|
125
|
+
// Fetch remaining pages
|
|
126
|
+
while (currentResponse.hasNext() &&
|
|
127
|
+
pageCount < ((_a = this.__config.maxPages) !== null && _a !== void 0 ? _a : constants_1.DEFAULT_MAX_PAGES) &&
|
|
128
|
+
totalItems < ((_b = this.__config.maxItems) !== null && _b !== void 0 ? _b : constants_1.DEFAULT_MAX_ITEMS)) {
|
|
129
|
+
const nextResponse = yield currentResponse.next(this.__config);
|
|
130
|
+
if (!nextResponse)
|
|
131
|
+
break;
|
|
132
|
+
pageCount++;
|
|
133
|
+
const nextData = this.__dataExtractor(nextResponse);
|
|
134
|
+
allData.push(...nextData);
|
|
135
|
+
totalItems += nextData.length;
|
|
136
|
+
progressCallback === null || progressCallback === void 0 ? void 0 : progressCallback(pageCount, totalItems);
|
|
137
|
+
currentResponse = nextResponse;
|
|
138
|
+
}
|
|
139
|
+
return allData;
|
|
140
|
+
});
|
|
141
|
+
},
|
|
142
|
+
};
|
|
143
|
+
// Initialize tracking for the first page
|
|
144
|
+
const currentPageData = dataExtractor(responseData);
|
|
145
|
+
paginationMethods.__totalItemsFetched = currentPageData.length;
|
|
146
|
+
return Object.assign(responseData, paginationMethods);
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Common data extractors for typical API responses
|
|
150
|
+
*/
|
|
151
|
+
exports.ResponseExtractors = {
|
|
152
|
+
activities: (response) => response.activities || [],
|
|
153
|
+
addresses: (response) => response.addresses || [],
|
|
154
|
+
allocations: (response) => response.allocations || [],
|
|
155
|
+
balances: (response) => response.balances || [],
|
|
156
|
+
fills: (response) => response.fills || [],
|
|
157
|
+
invoices: (response) => response.invoices || [],
|
|
158
|
+
orders: (response) => response.orders || [],
|
|
159
|
+
positions: (response) => response.positions || [],
|
|
160
|
+
products: (response) => response.products || [],
|
|
161
|
+
portfolios: (response) => response.portfolios || [],
|
|
162
|
+
transactions: (response) => response.transactions || [],
|
|
163
|
+
users: (response) => response.users || [],
|
|
164
|
+
wallets: (response) => response.wallets || [],
|
|
165
|
+
};
|
|
166
|
+
/**
|
|
167
|
+
* Get the default pagination options for a client
|
|
168
|
+
*/
|
|
169
|
+
function getDefaultPaginationOptions(client, options) {
|
|
170
|
+
var _a, _b;
|
|
171
|
+
return Object.assign(Object.assign({}, options), { maxPages: (_a = options === null || options === void 0 ? void 0 : options.maxPages) !== null && _a !== void 0 ? _a : client.getMaxPages(), maxItems: (_b = options === null || options === void 0 ? void 0 : options.maxItems) !== null && _b !== void 0 ? _b : client.getMaxItems() });
|
|
172
|
+
}
|
|
173
|
+
function getQueryParams(client, request) {
|
|
174
|
+
let queryParams = {};
|
|
175
|
+
if (request.limit) {
|
|
176
|
+
queryParams.limit = request.limit;
|
|
177
|
+
}
|
|
178
|
+
if (request.cursor) {
|
|
179
|
+
queryParams.cursor = request.cursor;
|
|
180
|
+
}
|
|
181
|
+
if (!queryParams.limit) {
|
|
182
|
+
queryParams.limit = client.getDefaultPaginationLimit();
|
|
183
|
+
}
|
|
184
|
+
return queryParams;
|
|
185
|
+
}
|
|
@@ -1,2 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright 2024-present Coinbase Global, Inc.
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
2
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -1,4 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright 2025-present Coinbase Global, Inc.
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
2
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
18
|
exports.toCamelCase = toCamelCase;
|
|
4
19
|
function toCamelCase(obj, seen = new WeakSet()) {
|
package/dist/staking/index.js
CHANGED
|
@@ -54,5 +54,29 @@ class StakingService {
|
|
|
54
54
|
return response.data;
|
|
55
55
|
});
|
|
56
56
|
}
|
|
57
|
+
createPortfolioStake(request, options) {
|
|
58
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
59
|
+
const bodyParams = Object.assign(Object.assign({}, request), { portfolioId: undefined });
|
|
60
|
+
const response = yield this.client.request({
|
|
61
|
+
url: `portfolios/${request.portfolioId}/staking/initiate`,
|
|
62
|
+
method: core_ts_1.Method.POST,
|
|
63
|
+
bodyParams,
|
|
64
|
+
callOptions: options,
|
|
65
|
+
});
|
|
66
|
+
return response.data;
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
createPortfolioUnstake(request, options) {
|
|
70
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
71
|
+
const bodyParams = Object.assign(Object.assign({}, request), { portfolioId: undefined });
|
|
72
|
+
const response = yield this.client.request({
|
|
73
|
+
url: `portfolios/${request.portfolioId}/staking/unstake`,
|
|
74
|
+
method: core_ts_1.Method.POST,
|
|
75
|
+
bodyParams,
|
|
76
|
+
callOptions: options,
|
|
77
|
+
});
|
|
78
|
+
return response.data;
|
|
79
|
+
});
|
|
80
|
+
}
|
|
57
81
|
}
|
|
58
82
|
exports.StakingService = StakingService;
|
|
@@ -26,6 +26,7 @@ exports.TransactionsService = void 0;
|
|
|
26
26
|
* limitations under the License.
|
|
27
27
|
*/
|
|
28
28
|
const core_ts_1 = require("@coinbase-sample/core-ts");
|
|
29
|
+
const paginatedResponse_1 = require("../shared/paginatedResponse");
|
|
29
30
|
class TransactionsService {
|
|
30
31
|
constructor(client) {
|
|
31
32
|
this.client = client;
|
|
@@ -42,23 +43,37 @@ class TransactionsService {
|
|
|
42
43
|
listPortfolioTransactions(request, options) {
|
|
43
44
|
return __awaiter(this, void 0, void 0, function* () {
|
|
44
45
|
const queryParams = Object.assign(Object.assign({}, request), { portfolioId: undefined });
|
|
46
|
+
if (!queryParams.limit) {
|
|
47
|
+
queryParams.limit = this.client.getDefaultPaginationLimit();
|
|
48
|
+
}
|
|
45
49
|
const response = yield this.client.request({
|
|
46
50
|
url: `portfolios/${request.portfolioId}/transactions`,
|
|
47
51
|
queryParams,
|
|
48
52
|
callOptions: options,
|
|
49
53
|
});
|
|
50
|
-
|
|
54
|
+
const responseData = response.data;
|
|
55
|
+
// Merge client defaults with call options
|
|
56
|
+
const paginationOptions = (0, paginatedResponse_1.getDefaultPaginationOptions)(this.client, options);
|
|
57
|
+
// Enhance the response with pagination methods
|
|
58
|
+
return (0, paginatedResponse_1.createPaginatedResponse)(responseData, this.listPortfolioTransactions.bind(this), request, paginatedResponse_1.ResponseExtractors.transactions, paginationOptions);
|
|
51
59
|
});
|
|
52
60
|
}
|
|
53
61
|
listWalletTransactions(request, options) {
|
|
54
62
|
return __awaiter(this, void 0, void 0, function* () {
|
|
55
63
|
const queryParams = Object.assign(Object.assign({}, request), { portfolioId: undefined, walletId: undefined });
|
|
64
|
+
if (!queryParams.limit) {
|
|
65
|
+
queryParams.limit = this.client.getDefaultPaginationLimit();
|
|
66
|
+
}
|
|
56
67
|
const response = yield this.client.request({
|
|
57
68
|
url: `portfolios/${request.portfolioId}/wallets/${request.walletId}/transactions`,
|
|
58
69
|
queryParams,
|
|
59
70
|
callOptions: options,
|
|
60
71
|
});
|
|
61
|
-
|
|
72
|
+
const responseData = response.data;
|
|
73
|
+
// Merge client defaults with call options
|
|
74
|
+
const paginationOptions = (0, paginatedResponse_1.getDefaultPaginationOptions)(this.client, options);
|
|
75
|
+
// Enhance the response with pagination methods
|
|
76
|
+
return (0, paginatedResponse_1.createPaginatedResponse)(responseData, this.listWalletTransactions.bind(this), request, paginatedResponse_1.ResponseExtractors.transactions, paginationOptions);
|
|
62
77
|
});
|
|
63
78
|
}
|
|
64
79
|
createConversion(request, options) {
|
|
@@ -13,10 +13,11 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { Brand } from '
|
|
16
|
+
import { Brand } from '../shared/brand';
|
|
17
17
|
import { ActivityCategory, ActivityStatus } from '../model/enums/';
|
|
18
18
|
import { GetActivityResponse as internalGet, GetEntityActivitiesResponse, GetPortfolioActivitiesResponse, GetPortfolioActivityResponse as internalGetPortAct } from '../model/';
|
|
19
19
|
import { Pagination } from '../shared/pagination';
|
|
20
|
+
import { BasePaginatedRequest, PaginatedResponseMethods } from '../shared/paginatedResponse';
|
|
20
21
|
export type ActivityFilters = Pagination & {
|
|
21
22
|
symbols?: string[];
|
|
22
23
|
categories?: ActivityCategory[];
|
|
@@ -32,11 +33,13 @@ export type ListEntityActivitiesRequest = Pagination & ActivityFilters & {
|
|
|
32
33
|
entityId: string;
|
|
33
34
|
activityLevel?: string;
|
|
34
35
|
};
|
|
35
|
-
export type
|
|
36
|
+
export type BaseListEntityActivitiesResponse = GetEntityActivitiesResponse;
|
|
37
|
+
export type ListEntityActivitiesResponse = BaseListEntityActivitiesResponse & PaginatedResponseMethods<ListEntityActivitiesRequest & BasePaginatedRequest, BaseListEntityActivitiesResponse, any>;
|
|
36
38
|
export type ListPortfolioActivitiesRequest = Pagination & ActivityFilters & {
|
|
37
39
|
portfolioId: string;
|
|
38
40
|
};
|
|
39
|
-
export type
|
|
41
|
+
export type BaseListPortfolioActivitiesResponse = Brand<GetPortfolioActivitiesResponse, 'ListPortfolioActivitiesResponse'>;
|
|
42
|
+
export type ListPortfolioActivitiesResponse = BaseListPortfolioActivitiesResponse & PaginatedResponseMethods<ListPortfolioActivitiesRequest & BasePaginatedRequest, BaseListPortfolioActivitiesResponse, any>;
|
|
40
43
|
export type GetPortfolioActivitiesRequest = {
|
|
41
44
|
portfolioId: string;
|
|
42
45
|
activityId: string;
|
|
@@ -13,15 +13,17 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { Brand } from '
|
|
16
|
+
import { Brand } from '../shared/brand';
|
|
17
17
|
import { GetPortfolioAddressBookResponse, CreatePortfolioAddressBookEntryRequest, CreatePortfolioAddressBookEntryResponse } from '../model/';
|
|
18
18
|
import { Pagination } from '../shared/pagination';
|
|
19
|
+
import { BasePaginatedRequest, PaginatedResponseMethods } from '../shared/paginatedResponse';
|
|
19
20
|
export type ListAddressBooksRequest = Pagination & {
|
|
20
21
|
portfolioId: string;
|
|
21
22
|
currencySymbol?: string;
|
|
22
23
|
search?: string;
|
|
23
24
|
};
|
|
24
|
-
export type
|
|
25
|
+
export type BaseListAddressBooksResponse = Brand<GetPortfolioAddressBookResponse, 'ListAddressBooksResponse'>;
|
|
26
|
+
export type ListAddressBooksResponse = BaseListAddressBooksResponse & PaginatedResponseMethods<ListAddressBooksRequest & BasePaginatedRequest, BaseListAddressBooksResponse, any>;
|
|
25
27
|
export type CreateAddressBookRequest = CreatePortfolioAddressBookEntryRequest & {
|
|
26
28
|
portfolioId: string;
|
|
27
29
|
};
|
|
@@ -13,10 +13,11 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { Brand } from '
|
|
16
|
+
import { Brand } from '../shared/brand';
|
|
17
17
|
import { CreateAllocationRequest as internalCreate, CreateAllocationResponse as internalResponse, CreateNetAllocationResponse as internalNetCreate, GetPortfolioAllocationsResponse, GetAllocationResponse as internalGet, GetAllocationsByClientNettingIdResponse } from '../model/';
|
|
18
18
|
import { OrderSide } from '../model/enums/';
|
|
19
19
|
import { Pagination } from '../shared/pagination';
|
|
20
|
+
import { BasePaginatedRequest, PaginatedResponseMethods } from '../shared/paginatedResponse';
|
|
20
21
|
export type CreateAllocationRequest = Brand<internalCreate, 'CreateAllocationRequest'>;
|
|
21
22
|
export type CreateAllocationResponse = Brand<internalResponse, 'CreateAllocationResponse'>;
|
|
22
23
|
export type CreateNetAllocationRequest = Brand<internalCreate, 'CreateNetAllocationRequest'>;
|
|
@@ -28,7 +29,8 @@ export type ListPortfolioAllocationsRequest = Pagination & {
|
|
|
28
29
|
startDate?: string;
|
|
29
30
|
endDate?: string;
|
|
30
31
|
};
|
|
31
|
-
export type
|
|
32
|
+
export type BaseListPortfolioAllocationsResponse = Brand<GetPortfolioAllocationsResponse, 'ListPortfolioAllocationsResponse'>;
|
|
33
|
+
export type ListPortfolioAllocationsResponse = BaseListPortfolioAllocationsResponse & PaginatedResponseMethods<ListPortfolioAllocationsRequest & BasePaginatedRequest, BaseListPortfolioAllocationsResponse, any>;
|
|
32
34
|
export type ListNetAllocationsRequest = {
|
|
33
35
|
portfolioId: string;
|
|
34
36
|
nettingId: string;
|
|
@@ -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
|
-
import { Brand } from '
|
|
16
|
+
import { Brand } from '../shared/brand';
|
|
17
17
|
import { GetEntityAssetsResponse } from '../model/';
|
|
18
18
|
export type ListAssetsRequest = {
|
|
19
19
|
entityId: string;
|
|
@@ -13,9 +13,10 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { Brand } from '
|
|
16
|
+
import { Brand } from '../shared/brand';
|
|
17
17
|
import { PortfolioBalanceType, VisibilityStatus } from '../model/enums/';
|
|
18
18
|
import { GetPortfolioBalancesResponse, GetWalletBalanceResponse as internalGetResp, ListWeb3WalletBalancesResponse, ListEntityBalancesResponse as internalListEntityBalances } from '../model/';
|
|
19
|
+
import { BasePaginatedRequest, PaginatedResponseMethods } from '../shared/paginatedResponse';
|
|
19
20
|
export type ListPortfolioBalancesRequest = {
|
|
20
21
|
portfolioId: string;
|
|
21
22
|
symbol: string;
|
|
@@ -34,7 +35,8 @@ export type ListOnchainWalletBalancesRequest = {
|
|
|
34
35
|
cursor?: string;
|
|
35
36
|
limit?: number;
|
|
36
37
|
};
|
|
37
|
-
export type
|
|
38
|
+
export type BaseListOnchainWalletBalancesResponse = Brand<ListWeb3WalletBalancesResponse, 'ListOnchainWalletBalancesResponse'>;
|
|
39
|
+
export type ListOnchainWalletBalancesResponse = BaseListOnchainWalletBalancesResponse & PaginatedResponseMethods<ListOnchainWalletBalancesRequest & BasePaginatedRequest, BaseListOnchainWalletBalancesResponse, any>;
|
|
38
40
|
export type ListEntityBalancesRequest = {
|
|
39
41
|
entityId: string;
|
|
40
42
|
symbols?: string;
|
|
@@ -42,4 +44,5 @@ export type ListEntityBalancesRequest = {
|
|
|
42
44
|
limit?: number;
|
|
43
45
|
aggregationType?: PortfolioBalanceType;
|
|
44
46
|
};
|
|
45
|
-
export type
|
|
47
|
+
export type BaseListEntityBalancesResponse = Brand<internalListEntityBalances, 'ListEntityBalancesResponse'>;
|
|
48
|
+
export type ListEntityBalancesResponse = BaseListEntityBalancesResponse & PaginatedResponseMethods<ListEntityBalancesRequest & BasePaginatedRequest, BaseListEntityBalancesResponse, any>;
|
package/dist/types/client.d.ts
CHANGED
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { CoinbaseClient } from '@coinbase-sample/core-ts';
|
|
16
|
+
import { CoinbaseClient, CoinbaseHttpClientRetryOptions } from '@coinbase-sample/core-ts';
|
|
17
17
|
import { CoinbasePrimeCredentials } from './credentials';
|
|
18
18
|
export declare class CoinbasePrimeClient extends CoinbaseClient {
|
|
19
|
-
constructor(credentials?: CoinbasePrimeCredentials, apiBasePath?: string);
|
|
19
|
+
constructor(credentials?: CoinbasePrimeCredentials, apiBasePath?: string, options?: CoinbaseHttpClientRetryOptions);
|
|
20
20
|
}
|
|
@@ -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
|
-
import { Brand } from '
|
|
16
|
+
import { Brand } from '../shared/brand';
|
|
17
17
|
import { GetPortfolioCommissionResponse as internalGet } from '../model/';
|
|
18
18
|
export type GetPortfolioCommissionRequest = {
|
|
19
19
|
portfolioId: string;
|
|
@@ -13,10 +13,13 @@
|
|
|
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.
|
|
16
|
+
export declare const VERSION = "0.6.0";
|
|
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";
|
|
20
20
|
export declare const CB_ACCESS_PHRASE_HEADER = "X-CB-ACCESS-PASSPHRASE";
|
|
21
21
|
export declare const CB_ACCESS_SIGNATURE_HEADER = "X-CB-ACCESS-SIGNATURE";
|
|
22
22
|
export declare const CB_ACCESS_TIMESTAMP_HEADER = "X-CB-ACCESS-TIMESTAMP";
|
|
23
|
+
export declare const DEFAULT_PAGINATION_LIMIT = 25;
|
|
24
|
+
export declare const DEFAULT_MAX_PAGES = 100;
|
|
25
|
+
export declare const DEFAULT_MAX_ITEMS = 10000;
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import { CoinbaseCallOptions } from '@coinbase-sample/core-ts';
|
|
17
17
|
import { CoinbasePrimeClient } from '../client';
|
|
18
|
-
import { ListExistingLocatesRequest, ListExistingLocatesResponse, ListInterestAccrualsRequest, ListInterestAccrualsResponse, ListPortfolioInterestAccrualsRequest, ListPortfolioInterestAccrualsResponse, ListMarginCallSummariesRequest, ListMarginCallSummariesResponse, ListMarginConversionsRequest, ListMarginConversionsResponse, GetEntityLocateAvailabilitiesRequest, GetEntityLocateAvailabilitiesResponse, GetMarginInformationRequest, GetMarginInformationResponse, GetPortfolioBuyingPowerRequest, GetPortfolioBuyingPowerResponse, GetPortfolioCreditInformationRequest, GetPortfolioCreditInformationResponse, GetPortfolioWithdrawalPowerRequest, GetPortfolioWithdrawalPowerResponse, GetTieredPricingFeesRequest, GetTieredPricingFeesResponse, CreateNewLocatesRequest, CreateNewLocatesResponse } from './types';
|
|
18
|
+
import { ListExistingLocatesRequest, ListExistingLocatesResponse, ListInterestAccrualsRequest, ListInterestAccrualsResponse, ListPortfolioInterestAccrualsRequest, ListPortfolioInterestAccrualsResponse, ListMarginCallSummariesRequest, ListMarginCallSummariesResponse, ListMarginConversionsRequest, ListMarginConversionsResponse, GetEntityLocateAvailabilitiesRequest, GetEntityLocateAvailabilitiesResponse, GetMarginInformationRequest, GetMarginInformationResponse, GetPortfolioBuyingPowerRequest, GetPortfolioBuyingPowerResponse, GetPortfolioCreditInformationRequest, GetPortfolioCreditInformationResponse, GetPortfolioWithdrawalPowerRequest, GetPortfolioWithdrawalPowerResponse, GetTieredPricingFeesRequest, GetTieredPricingFeesResponse, GetFcmMarginCallDetailsRequest, GetFcmMarginCallDetailsResponse, GetFcmRiskLimitsRequest, GetFcmRiskLimitsResponse, CreateNewLocatesRequest, CreateNewLocatesResponse } from './types';
|
|
19
19
|
export interface IFinancingService {
|
|
20
20
|
listExistingLocates(request: ListExistingLocatesRequest, options?: CoinbaseCallOptions): Promise<ListExistingLocatesResponse>;
|
|
21
21
|
listInterestAccruals(request: ListInterestAccrualsRequest, options?: CoinbaseCallOptions): Promise<ListInterestAccrualsResponse>;
|
|
@@ -28,6 +28,8 @@ export interface IFinancingService {
|
|
|
28
28
|
getPortfolioCreditInformation(request: GetPortfolioCreditInformationRequest, options?: CoinbaseCallOptions): Promise<GetPortfolioCreditInformationResponse>;
|
|
29
29
|
getPortfolioWithdrawalPower(request: GetPortfolioWithdrawalPowerRequest, options?: CoinbaseCallOptions): Promise<GetPortfolioWithdrawalPowerResponse>;
|
|
30
30
|
getTieredPricingFees(request: GetTieredPricingFeesRequest, options?: CoinbaseCallOptions): Promise<GetTieredPricingFeesResponse>;
|
|
31
|
+
getFcmMarginCallDetails(request: GetFcmMarginCallDetailsRequest, options?: CoinbaseCallOptions): Promise<GetFcmMarginCallDetailsResponse>;
|
|
32
|
+
getFcmRiskLimits(request: GetFcmRiskLimitsRequest, options?: CoinbaseCallOptions): Promise<GetFcmRiskLimitsResponse>;
|
|
31
33
|
createNewLocates(request: CreateNewLocatesRequest, options?: CoinbaseCallOptions): Promise<CreateNewLocatesResponse>;
|
|
32
34
|
}
|
|
33
35
|
export declare class FinancingService implements IFinancingService {
|
|
@@ -44,5 +46,7 @@ export declare class FinancingService implements IFinancingService {
|
|
|
44
46
|
getPortfolioCreditInformation(request: GetPortfolioCreditInformationRequest, options?: CoinbaseCallOptions): Promise<GetPortfolioCreditInformationResponse>;
|
|
45
47
|
getPortfolioWithdrawalPower(request: GetPortfolioWithdrawalPowerRequest, options?: CoinbaseCallOptions): Promise<GetPortfolioWithdrawalPowerResponse>;
|
|
46
48
|
getTieredPricingFees(request: GetTieredPricingFeesRequest, options?: CoinbaseCallOptions): Promise<GetTieredPricingFeesResponse>;
|
|
49
|
+
getFcmMarginCallDetails(request: GetFcmMarginCallDetailsRequest, options?: CoinbaseCallOptions): Promise<GetFcmMarginCallDetailsResponse>;
|
|
50
|
+
getFcmRiskLimits(request: GetFcmRiskLimitsRequest, options?: CoinbaseCallOptions): Promise<GetFcmRiskLimitsResponse>;
|
|
47
51
|
createNewLocates(request: CreateNewLocatesRequest, options?: CoinbaseCallOptions): Promise<CreateNewLocatesResponse>;
|
|
48
52
|
}
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { Brand } from '
|
|
17
|
-
import { GetExistingLocatesResponse, GetInterestAccrualsResponse, GetLocateAvailabilitiesResponse, GetMarginConversionsResponse, GetMarginSummariesResponse, GetMarginInformationResponse as internalGetMarginInformationResponse, GetBuyingPowerResponse, GetPostTradeCreditResponse, GetTFTieredPricingFeesResponse, GetWithdrawalPowerResponse, CreateNewLocatesResponse as internalCreateNewLocatesResponse } from '../model/';
|
|
16
|
+
import { Brand } from '../shared/brand';
|
|
17
|
+
import { GetExistingLocatesResponse, GetInterestAccrualsResponse, GetLocateAvailabilitiesResponse, GetMarginConversionsResponse, GetMarginSummariesResponse, GetMarginInformationResponse as internalGetMarginInformationResponse, GetBuyingPowerResponse, GetPostTradeCreditResponse, GetTFTieredPricingFeesResponse, GetWithdrawalPowerResponse, GetFcmMarginCallDetailsResponse as internalGetFcmMarginCallDetailsResponse, GetFcmRiskLimitsResponse as internalGetFcmRiskLimitsResponse, CreateNewLocatesResponse as internalCreateNewLocatesResponse } from '../model/';
|
|
18
18
|
export type ListExistingLocatesRequest = {
|
|
19
19
|
portfolioId: string;
|
|
20
20
|
locateIds?: string[];
|
|
@@ -83,3 +83,11 @@ export type CreateNewLocatesRequest = {
|
|
|
83
83
|
locateDate?: string;
|
|
84
84
|
};
|
|
85
85
|
export type CreateNewLocatesResponse = Brand<internalCreateNewLocatesResponse, 'CreateNewLocatesResponse'>;
|
|
86
|
+
export type GetFcmMarginCallDetailsRequest = {
|
|
87
|
+
entityId: string;
|
|
88
|
+
};
|
|
89
|
+
export type GetFcmMarginCallDetailsResponse = Brand<internalGetFcmMarginCallDetailsResponse, 'GetFcmMarginCallDetailsResponse'>;
|
|
90
|
+
export type GetFcmRiskLimitsRequest = {
|
|
91
|
+
entityId: string;
|
|
92
|
+
};
|
|
93
|
+
export type GetFcmRiskLimitsResponse = Brand<internalGetFcmRiskLimitsResponse, 'GetFcmRiskLimitsResponse'>;
|
|
@@ -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
|
-
import { Brand } from '
|
|
16
|
+
import { Brand } from '../shared/brand';
|
|
17
17
|
import { GetFcmBalanceResponse, GetFuturesSweepsResponse, GetPositionsResponse, SetAutoSweepResponse, ScheduleFuturesSweepRequest, ScheduleFuturesSweepResponse, CancelFuturesSweepResponse } from '../model/';
|
|
18
18
|
export type ListEntityFuturesSweepsRequest = {
|
|
19
19
|
entityId: string;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -21,6 +21,7 @@ export { AllocationService, IAllocationService } from './allocations';
|
|
|
21
21
|
export { AssetsService, IAssetsService } from './assets';
|
|
22
22
|
export { BalancesService, IBalancesService } from './balances';
|
|
23
23
|
export { CommissionService, ICommissionService } from './commission';
|
|
24
|
+
export { FinancingService, IFinancingService } from './financing';
|
|
24
25
|
export { FuturesService, IFuturesService } from './futures';
|
|
25
26
|
export { InvoicesService, IInvoicesService } from './invoices';
|
|
26
27
|
export { OnchainAddressBookService } from './onchainAddressBook';
|
|
@@ -41,16 +42,16 @@ export type { CreateAllocationRequest, CreateAllocationResponse, CreateNetAlloca
|
|
|
41
42
|
export type { ListAssetsRequest, ListAssetsResponse } from './assets/types';
|
|
42
43
|
export type { GetWalletBalanceRequest, GetWalletBalanceResponse, ListOnchainWalletBalancesRequest, ListOnchainWalletBalancesResponse, ListPortfolioBalancesRequest, ListPortfolioBalancesResponse, ListEntityBalancesRequest, ListEntityBalancesResponse, } from './balances/types';
|
|
43
44
|
export type { GetPortfolioCommissionRequest, GetPortfolioCommissionResponse, } from './commission/types';
|
|
44
|
-
export type { ListExistingLocatesRequest, ListExistingLocatesResponse, ListInterestAccrualsRequest, ListInterestAccrualsResponse, ListPortfolioInterestAccrualsRequest, ListPortfolioInterestAccrualsResponse, ListMarginCallSummariesRequest, ListMarginCallSummariesResponse, ListMarginConversionsRequest, ListMarginConversionsResponse, GetEntityLocateAvailabilitiesRequest, GetEntityLocateAvailabilitiesResponse, GetMarginInformationRequest, GetMarginInformationResponse, GetPortfolioBuyingPowerRequest, GetPortfolioBuyingPowerResponse, GetPortfolioCreditInformationRequest, GetPortfolioCreditInformationResponse, GetPortfolioWithdrawalPowerRequest, GetPortfolioWithdrawalPowerResponse, GetTieredPricingFeesRequest, GetTieredPricingFeesResponse, CreateNewLocatesRequest, CreateNewLocatesResponse, } from './financing/types';
|
|
45
|
+
export type { ListExistingLocatesRequest, ListExistingLocatesResponse, ListInterestAccrualsRequest, ListInterestAccrualsResponse, ListPortfolioInterestAccrualsRequest, ListPortfolioInterestAccrualsResponse, ListMarginCallSummariesRequest, ListMarginCallSummariesResponse, ListMarginConversionsRequest, ListMarginConversionsResponse, GetEntityLocateAvailabilitiesRequest, GetEntityLocateAvailabilitiesResponse, GetMarginInformationRequest, GetMarginInformationResponse, GetPortfolioBuyingPowerRequest, GetPortfolioBuyingPowerResponse, GetPortfolioCreditInformationRequest, GetPortfolioCreditInformationResponse, GetPortfolioWithdrawalPowerRequest, GetPortfolioWithdrawalPowerResponse, GetFcmMarginCallDetailsRequest, GetFcmMarginCallDetailsResponse, GetFcmRiskLimitsRequest, GetFcmRiskLimitsResponse, GetTieredPricingFeesRequest, GetTieredPricingFeesResponse, CreateNewLocatesRequest, CreateNewLocatesResponse, } from './financing/types';
|
|
45
46
|
export type { CancelEntitySweepRequest, CancelEntitySweepResponse, GetEntityFuturesBalanceRequest, GetEntityFuturesBalanceResponse, GetEntityFuturesPositionsRequest, GetEntityFuturesPositionsResponse, ListEntityFuturesSweepsRequest, ListEntityFuturesSweepsResponse, ScheduleEntityFuturesSweepRequest, ScheduleEntityFuturesSweepResponse, UpdateEntityFuturesAutoSweepRequest, UpdateEntityFuturesAutoSweepResponse, } from './futures/types';
|
|
46
47
|
export type { ListInvoicesRequest, ListInvoicesResponse, } from './invoices/types';
|
|
47
48
|
export type { CreateOnchainAddressBookEntryRequest, CreateOnchainAddressBookEntryResponse, DeleteOnchainAddressBookEntryRequest, DeleteOnchainAddressBookEntryResponse, ListOnchainAddressBookRequest, ListOnchainAddressBookResponse, UpdateOnchainAddressBookEntryRequest, UpdateOnchainAddressBookEntryResponse, } from './onchainAddressBook/types';
|
|
48
|
-
export type { AcceptQuoteRequest, AcceptQuoteResponse, CancelOrderRequest, CancelOrderResponse, CreateOrderPreviewRequest, CreateOrderPreviewResponse, CreateOrderRequest, CreateOrderResponse, CreateQuoteRequest, CreateQuoteResponse, GetOrderRequest, GetOrderResponse, ListOpenOrdersRequest, ListOpenOrdersResponse, ListOrderFillsRequest, ListOrderFillsResponse, ListPortfolioFillsRequest, ListPortfolioFillsResponse, ListPortfolioOrdersRequest, ListPortfolioOrdersResponse, } from './orders/types';
|
|
49
|
+
export type { AcceptQuoteRequest, AcceptQuoteResponse, CancelOrderRequest, CancelOrderResponse, CreateOrderPreviewRequest, CreateOrderPreviewResponse, CreateOrderRequest, CreateOrderResponse, CreateQuoteRequest, CreateQuoteResponse, GetOrderRequest, GetOrderResponse, GetOrderEditHistoryRequest, GetOrderEditHistoryResponse, ListOpenOrdersRequest, ListOpenOrdersResponse, ListOrderFillsRequest, ListOrderFillsResponse, ListPortfolioFillsRequest, ListPortfolioFillsResponse, ListPortfolioOrdersRequest, ListPortfolioOrdersResponse, } from './orders/types';
|
|
49
50
|
export type { GetPaymentMethodRequest, GetPaymentMethodResponse, ListEntityPaymentMethodsRequest, ListEntityPaymentMethodsResponse, } from './paymentMethods/types';
|
|
50
|
-
export type { ListPortfoliosRequest, ListPortfoliosResponse, GetPortfolioCreditRequest, GetPortfolioCreditResponse, GetPortfolioRequest, GetPortfolioResponse, } from './portfolios/types';
|
|
51
|
+
export type { ListPortfoliosRequest, ListPortfoliosResponse, GetPortfolioCreditRequest, GetPortfolioCreditResponse, GetPortfolioRequest, GetPortfolioResponse, GetCounterpartyIdRequest, GetCounterpartyIdResponse, } from './portfolios/types';
|
|
51
52
|
export type { ListAggregateEntityPositionsRequest, ListAggregateEntityPositionsResponse, ListEntityPositionsRequest, ListEntityPositionsResponse, } from './positions/types';
|
|
52
53
|
export type { ListProductsRequest, ListProductsResponse, } from './products/types';
|
|
53
|
-
export type { CreateStakeRequest, CreateStakeResponse, CreateUnstakeRequest, CreateUnstakeResponse, } from './staking/types';
|
|
54
|
+
export type { CreateStakeRequest, CreateStakeResponse, CreateUnstakeRequest, CreateUnstakeResponse, CreatePortfolioStakeRequest, CreatePortfolioStakeResponse, CreatePortfolioUnstakeRequest, CreatePortfolioUnstakeResponse, } from './staking/types';
|
|
54
55
|
export type { CreateConversionRequest, CreateConversionResponse, CreateOnchainTransactionRequest, CreateOnchainTransactionResponse, CreateTransferRequest, CreateTransferResponse, CreateWithdrawalRequest, CreateWithdrawalResponse, GetTransactionRequest, GetTransactionResponse, ListPortfolioTransactionsRequest, ListPortfolioTransactionsResponse, ListWalletTransactionsRequest, ListWalletTransactionsResponse, } from './transactions/types';
|
|
55
56
|
export type { ListPortfolioUsersRequest, ListPortfolioUsersResponse, ListUsersRequest, ListUsersResponse, } from './users/types';
|
|
56
57
|
export type { CreateWalletRequest, CreateWalletResponse, CreateWalletDepositAddressRequest, CreateWalletDepositAddressResponse, GetWalletDepositInstructionsRequest, GetWalletDepositInstructionsResponse, GetWalletRequest, GetWalletResponse, ListWalletAddressesRequest, ListWalletAddressesResponse, ListWalletsRequest, ListWalletsResponse, } from './wallets/types';
|
|
@@ -17,10 +17,10 @@ import { CoinbaseCallOptions } from '@coinbase-sample/core-ts';
|
|
|
17
17
|
import { CoinbasePrimeClient } from '../client';
|
|
18
18
|
import { ListInvoicesRequest, ListInvoicesResponse } from './types';
|
|
19
19
|
export interface IInvoicesService {
|
|
20
|
-
|
|
20
|
+
listInvoices(request: ListInvoicesRequest, options?: CoinbaseCallOptions): Promise<ListInvoicesResponse>;
|
|
21
21
|
}
|
|
22
22
|
export declare class InvoicesService implements IInvoicesService {
|
|
23
23
|
private client;
|
|
24
24
|
constructor(client: CoinbasePrimeClient);
|
|
25
|
-
|
|
25
|
+
listInvoices(request: ListInvoicesRequest, options?: CoinbaseCallOptions): Promise<ListInvoicesResponse>;
|
|
26
26
|
}
|
|
@@ -13,9 +13,15 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { Brand } from '
|
|
16
|
+
import { Brand } from '../shared/brand';
|
|
17
17
|
import { GetInvoicesResponse } from '../model/';
|
|
18
|
-
|
|
18
|
+
import { BasePaginatedRequest, PaginatedResponseMethods } from '../shared/paginatedResponse';
|
|
19
|
+
import { Pagination } from '../shared/pagination';
|
|
20
|
+
export type ListInvoicesRequest = Pagination & {
|
|
19
21
|
entityId: string;
|
|
22
|
+
states?: string[];
|
|
23
|
+
billingYear?: string;
|
|
24
|
+
billingMonth?: string;
|
|
20
25
|
};
|
|
21
|
-
export type
|
|
26
|
+
export type BaseListInvoicesResponse = Brand<GetInvoicesResponse, 'ListInvoicesResponse'>;
|
|
27
|
+
export type ListInvoicesResponse = BaseListInvoicesResponse & PaginatedResponseMethods<ListInvoicesRequest & BasePaginatedRequest, BaseListInvoicesResponse, any>;
|