@coinbase-sample/prime-sdk-ts 0.4.0 → 0.5.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.
Files changed (58) hide show
  1. package/README.md +22 -0
  2. package/dist/activities/index.js +40 -4
  3. package/dist/addressBooks/index.js +4 -2
  4. package/dist/allocations/index.js +21 -1
  5. package/dist/balances/index.js +17 -5
  6. package/dist/client.js +7 -2
  7. package/dist/constants.js +4 -1
  8. package/dist/invoices/index.js +16 -3
  9. package/dist/model/CreateWalletDepositAddressRequest.js +21 -0
  10. package/dist/model/ListWalletAddressesResponse.js +21 -0
  11. package/dist/model/enums/TransactionStatus.js +1 -1
  12. package/dist/orders/index.js +52 -8
  13. package/dist/portfolios/types.js +15 -0
  14. package/dist/positions/index.js +9 -6
  15. package/dist/products/index.js +5 -1
  16. package/dist/shared/brand.js +15 -0
  17. package/dist/shared/paginatedResponse.js +185 -0
  18. package/dist/shared/pagination.js +15 -0
  19. package/dist/shared/toCamelCase.js +15 -0
  20. package/dist/staking/index.js +22 -4
  21. package/dist/transactions/index.js +17 -2
  22. package/dist/types/activities/types.d.ts +6 -3
  23. package/dist/types/addressBooks/types.d.ts +4 -2
  24. package/dist/types/allocations/types.d.ts +4 -2
  25. package/dist/types/assets/types.d.ts +1 -1
  26. package/dist/types/balances/types.d.ts +6 -3
  27. package/dist/types/client.d.ts +2 -2
  28. package/dist/types/commission/types.d.ts +1 -1
  29. package/dist/types/constants.d.ts +3 -0
  30. package/dist/types/financing/types.d.ts +1 -1
  31. package/dist/types/futures/types.d.ts +1 -1
  32. package/dist/types/invoices/index.d.ts +2 -2
  33. package/dist/types/invoices/types.d.ts +9 -3
  34. package/dist/types/model/Commission.d.ts +1 -1
  35. package/dist/types/model/CreateOnchainTransactionRequestEvmParams.d.ts +1 -1
  36. package/dist/types/model/CreateWalletDepositAddressRequest.d.ts +25 -0
  37. package/dist/types/model/Fill.d.ts +1 -1
  38. package/dist/types/model/ListWalletAddressesResponse.d.ts +25 -0
  39. package/dist/types/model/Order.d.ts +1 -1
  40. package/dist/types/model/TransferLocation.d.ts +8 -0
  41. package/dist/types/model/enums/TransactionStatus.d.ts +1 -1
  42. package/dist/types/model/index.d.ts +2 -0
  43. package/dist/types/onchainAddressBook/types.d.ts +1 -1
  44. package/dist/types/orders/types.d.ts +11 -6
  45. package/dist/types/paymentMethods/types.d.ts +1 -1
  46. package/dist/types/portfolios/types.d.ts +1 -1
  47. package/dist/types/positions/types.d.ts +9 -9
  48. package/dist/types/products/types.d.ts +4 -2
  49. package/dist/types/shared/brand.d.ts +15 -0
  50. package/dist/types/shared/paginatedResponse.d.ts +120 -0
  51. package/dist/types/shared/toCamelCase.d.ts +15 -0
  52. package/dist/types/staking/types.d.ts +1 -1
  53. package/dist/types/transactions/types.d.ts +7 -3
  54. package/dist/types/users/types.d.ts +9 -5
  55. package/dist/types/wallets/types.d.ts +7 -5
  56. package/dist/users/index.js +11 -2
  57. package/dist/wallets/index.js +17 -21
  58. package/package.json +2 -2
@@ -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()) {
@@ -10,16 +10,33 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.StakingService = void 0;
13
+ /**
14
+ * Copyright 2025-present Coinbase Global, Inc.
15
+ *
16
+ * Licensed under the Apache License, Version 2.0 (the "License");
17
+ * you may not use this file except in compliance with the License.
18
+ * You may obtain a copy of the License at
19
+ *
20
+ * http://www.apache.org/licenses/LICENSE-2.0
21
+ *
22
+ * Unless required by applicable law or agreed to in writing, software
23
+ * distributed under the License is distributed on an "AS IS" BASIS,
24
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
25
+ * See the License for the specific language governing permissions and
26
+ * limitations under the License.
27
+ */
28
+ const core_ts_1 = require("@coinbase-sample/core-ts");
13
29
  class StakingService {
14
30
  constructor(client) {
15
31
  this.client = client;
16
32
  }
17
33
  createStake(request, options) {
18
34
  return __awaiter(this, void 0, void 0, function* () {
19
- const queryParams = Object.assign(Object.assign({}, request), { portfolioId: undefined, walletId: undefined });
35
+ const bodyParams = Object.assign(Object.assign({}, request), { portfolioId: undefined, walletId: undefined });
20
36
  const response = yield this.client.request({
21
37
  url: `portfolios/${request.portfolioId}/wallets/${request.walletId}/staking/initiate`,
22
- queryParams,
38
+ method: core_ts_1.Method.POST,
39
+ bodyParams,
23
40
  callOptions: options,
24
41
  });
25
42
  return response.data;
@@ -27,10 +44,11 @@ class StakingService {
27
44
  }
28
45
  createUnstake(request, options) {
29
46
  return __awaiter(this, void 0, void 0, function* () {
30
- const queryParams = Object.assign(Object.assign({}, request), { portfolioId: undefined, walletId: undefined });
47
+ const bodyParams = Object.assign(Object.assign({}, request), { portfolioId: undefined, walletId: undefined });
31
48
  const response = yield this.client.request({
32
49
  url: `portfolios/${request.portfolioId}/wallets/${request.walletId}/staking/unstake`,
33
- queryParams,
50
+ method: core_ts_1.Method.POST,
51
+ bodyParams,
34
52
  callOptions: options,
35
53
  });
36
54
  return response.data;
@@ -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
- return response.data;
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
- return response.data;
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 'src/shared/brand';
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 ListEntityActivitiesResponse = GetEntityActivitiesResponse;
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 ListPortfolioActivitiesResponse = Brand<GetPortfolioActivitiesResponse, 'ListPortfolioActivitiesResponse'>;
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 'src/shared/brand';
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 ListAddressBooksResponse = Brand<GetPortfolioAddressBookResponse, 'ListAddressBooksResponse'>;
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 'src/shared/brand';
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 ListPortfolioAllocationsResponse = Brand<GetPortfolioAllocationsResponse, 'ListPortfolioAllocationsResponse'>;
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 'src/shared/brand';
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 'src/shared/brand';
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 ListOnchainWalletBalancesResponse = Brand<ListWeb3WalletBalancesResponse, 'ListOnchainWalletBalancesResponse'>;
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 ListEntityBalancesResponse = Brand<internalListEntityBalances, 'ListEntityBalancesResponse'>;
47
+ export type BaseListEntityBalancesResponse = Brand<internalListEntityBalances, 'ListEntityBalancesResponse'>;
48
+ export type ListEntityBalancesResponse = BaseListEntityBalancesResponse & PaginatedResponseMethods<ListEntityBalancesRequest & BasePaginatedRequest, BaseListEntityBalancesResponse, any>;
@@ -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 'src/shared/brand';
16
+ import { Brand } from '../shared/brand';
17
17
  import { GetPortfolioCommissionResponse as internalGet } from '../model/';
18
18
  export type GetPortfolioCommissionRequest = {
19
19
  portfolioId: string;
@@ -20,3 +20,6 @@ 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;
@@ -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 'src/shared/brand';
16
+ import { Brand } from '../shared/brand';
17
17
  import { GetExistingLocatesResponse, GetInterestAccrualsResponse, GetLocateAvailabilitiesResponse, GetMarginConversionsResponse, GetMarginSummariesResponse, GetMarginInformationResponse as internalGetMarginInformationResponse, GetBuyingPowerResponse, GetPostTradeCreditResponse, GetTFTieredPricingFeesResponse, GetWithdrawalPowerResponse, CreateNewLocatesResponse as internalCreateNewLocatesResponse } from '../model/';
18
18
  export type ListExistingLocatesRequest = {
19
19
  portfolioId: 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 'src/shared/brand';
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;
@@ -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
- listInvoicess(request: ListInvoicesRequest, options?: CoinbaseCallOptions): Promise<ListInvoicesResponse>;
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
- listInvoicess(request: ListInvoicesRequest, options?: CoinbaseCallOptions): Promise<ListInvoicesResponse>;
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 'src/shared/brand';
16
+ import { Brand } from '../shared/brand';
17
17
  import { GetInvoicesResponse } from '../model/';
18
- export type ListInvoicesRequest = {
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 ListInvoicesResponse = Brand<GetInvoicesResponse, 'ListInvoicesResponse'>;
26
+ export type BaseListInvoicesResponse = Brand<GetInvoicesResponse, 'ListInvoicesResponse'>;
27
+ export type ListInvoicesResponse = BaseListInvoicesResponse & PaginatedResponseMethods<ListInvoicesRequest & BasePaginatedRequest, BaseListInvoicesResponse, any>;
@@ -19,7 +19,7 @@
19
19
  */
20
20
  export type Commission = {
21
21
  /**
22
- * Hardcode type to all_in. When we support cost+, we will have cost_plus type
22
+ * Fee model (all_in or cost_plus)
23
23
  */
24
24
  type?: string;
25
25
  /**
@@ -27,7 +27,7 @@ export type CreateOnchainTransactionRequestEvmParams = {
27
27
  */
28
28
  disableDynamicNonce?: boolean;
29
29
  /**
30
- * Transaction ID to replace (for speed-up/cancel operations). Common use cases: 1) Gas Price Adjustments: When a transaction is stuck due to low gas price, a new transaction with the same nonce but higher gas price can be submitted to replace it. 2) Transaction Cancellation: A user might want to cancel a pending transaction by replacing it with a new transaction (often a 0-value transfer to themselves with higher gas price). Note: When using this field, the disable_dynamic_nonce option must be set to false because the nonce will be automatically managed by the system.
30
+ * Transaction ID to replace (for speed-up/cancel operations). Common use cases: 1) Gas Price Adjustments: When a transaction is stuck due to low gas price, a new transaction with the same nonce but higher gas price can be submitted to replace it. 2) Transaction Cancellation: A user might want to cancel a pending transaction by replacing it with a new transaction (often a 0-value transfer to themselves with higher gas price). Note: When using this field, the disable_dynamic_nonce option must be set to false because the nonce would be automatically managed by the system.
31
31
  */
32
32
  replacedTransactionId?: string;
33
33
  /**
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Copyright 2025-present Coinbase Global, Inc.
3
+ *
4
+ * This file is generated by Openapi Generator https://github.com/openapitools/openapi-generator
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ *
18
+ * Do not edit the class manually.
19
+ */
20
+ export type CreateWalletDepositAddressRequest = {
21
+ /**
22
+ * The network name and type
23
+ */
24
+ networkId: string;
25
+ };
@@ -32,7 +32,7 @@ export type Fill = {
32
32
  */
33
33
  productId?: string;
34
34
  /**
35
- * The client product ID of the fill indicating the settlement currency
35
+ * The client product ID of the fill indictating the settlment currency
36
36
  */
37
37
  clientProductId?: string;
38
38
  side?: OrderSide;
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Copyright 2025-present Coinbase Global, Inc.
3
+ *
4
+ * This file is generated by Openapi Generator https://github.com/openapitools/openapi-generator
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ *
18
+ * Do not edit the class manually.
19
+ */
20
+ import { BlockchainAddress } from './BlockchainAddress';
21
+ import { PaginatedResponse } from './PaginatedResponse';
22
+ export type ListWalletAddressesResponse = {
23
+ addresses: Array<BlockchainAddress>;
24
+ pagination: PaginatedResponse;
25
+ };
@@ -107,7 +107,7 @@ export type Order = {
107
107
  */
108
108
  userContext?: string;
109
109
  /**
110
- * The client product ID of the fill indicating the settlement currency
110
+ * The client product ID of the fill indictating the settlment currency
111
111
  */
112
112
  clientProductId?: string;
113
113
  };
@@ -24,4 +24,12 @@ export type TransferLocation = {
24
24
  * The value of the transfer location: payment method ID, wallet ID or crypto address
25
25
  */
26
26
  value?: string;
27
+ /**
28
+ * The crypto address of the transfer location
29
+ */
30
+ address?: string;
31
+ /**
32
+ * The tag/memo of the address, if applicable -- required for certain assets (e.g. XRP, XLM, etc.)
33
+ */
34
+ accountIdentifier?: string;
27
35
  };