@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.
Files changed (155) 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 +19 -3
  5. package/dist/balances/index.js +17 -5
  6. package/dist/client.js +7 -2
  7. package/dist/constants.js +5 -2
  8. package/dist/financing/index.js +18 -0
  9. package/dist/index.js +3 -1
  10. package/dist/invoices/index.js +16 -3
  11. package/dist/model/Counterparty.js +21 -0
  12. package/dist/model/CounterpartyDestination.js +21 -0
  13. package/dist/model/CreateNetAllocationRequest.js +21 -0
  14. package/dist/model/CreateWalletDepositAddressRequest.js +21 -0
  15. package/dist/model/FCMMarginCall.js +21 -0
  16. package/dist/model/GetFcmMarginCallDetailsResponse.js +21 -0
  17. package/dist/model/GetFcmRiskLimitsResponse.js +21 -0
  18. package/dist/model/GetOrderEditHistoryResponse.js +21 -0
  19. package/dist/model/GetPortfolioCounterpartyIDResponse.js +21 -0
  20. package/dist/model/LimitOrderEdit.js +21 -0
  21. package/dist/model/ListWalletAddressesResponse.js +21 -0
  22. package/dist/model/OrderEdit.js +21 -0
  23. package/dist/model/PortfolioStakingInitiateRequest.js +21 -0
  24. package/dist/model/PortfolioStakingInitiateResponse.js +21 -0
  25. package/dist/model/PortfolioStakingMetadata.js +21 -0
  26. package/dist/model/PortfolioStakingUnstakeRequest.js +21 -0
  27. package/dist/model/PortfolioStakingUnstakeResponse.js +21 -0
  28. package/dist/model/StakingUnstakeRequest.js +21 -0
  29. package/dist/model/WalletStakeInputs.js +21 -0
  30. package/dist/model/WalletUnstakeInputs.js +21 -0
  31. package/dist/model/enums/AllocationSizeType.js +0 -1
  32. package/dist/model/enums/AssetChangeType.js +0 -1
  33. package/dist/model/enums/CustodyActivityType.js +0 -1
  34. package/dist/model/enums/DestinationType.js +4 -4
  35. package/dist/model/enums/FcmMarginCallState.js +30 -0
  36. package/dist/model/enums/FcmMarginCallType.js +28 -0
  37. package/dist/model/enums/OrderSide.js +0 -1
  38. package/dist/model/enums/OrderStatus.js +0 -1
  39. package/dist/model/enums/OrderType.js +0 -1
  40. package/dist/model/enums/PaymentMethodType.js +3 -4
  41. package/dist/model/enums/PortfolioBalanceType.js +0 -1
  42. package/dist/model/enums/ProductPermissions.js +0 -1
  43. package/dist/model/enums/SigningStatus.js +0 -1
  44. package/dist/model/enums/TimeInForceType.js +0 -1
  45. package/dist/model/enums/TransactionStatus.js +1 -2
  46. package/dist/model/enums/TransactionType.js +0 -1
  47. package/dist/model/enums/TransferLocationType.js +0 -1
  48. package/dist/model/enums/UserRole.js +0 -1
  49. package/dist/model/enums/VisibilityStatus.js +0 -1
  50. package/dist/model/enums/WalletDepositInstructionType.js +0 -1
  51. package/dist/model/enums/WalletType.js +0 -1
  52. package/dist/model/enums/index.js +5 -1
  53. package/dist/orders/index.js +63 -8
  54. package/dist/portfolios/index.js +9 -0
  55. package/dist/portfolios/types.js +15 -0
  56. package/dist/positions/index.js +9 -6
  57. package/dist/products/index.js +4 -2
  58. package/dist/shared/brand.js +15 -0
  59. package/dist/shared/paginatedResponse.js +185 -0
  60. package/dist/shared/pagination.js +15 -0
  61. package/dist/shared/toCamelCase.js +15 -0
  62. package/dist/staking/index.js +24 -0
  63. package/dist/transactions/index.js +17 -2
  64. package/dist/types/activities/types.d.ts +6 -3
  65. package/dist/types/addressBooks/types.d.ts +4 -2
  66. package/dist/types/allocations/types.d.ts +4 -2
  67. package/dist/types/assets/types.d.ts +1 -1
  68. package/dist/types/balances/types.d.ts +6 -3
  69. package/dist/types/client.d.ts +2 -2
  70. package/dist/types/commission/types.d.ts +1 -1
  71. package/dist/types/constants.d.ts +4 -1
  72. package/dist/types/financing/index.d.ts +5 -1
  73. package/dist/types/financing/types.d.ts +10 -2
  74. package/dist/types/futures/types.d.ts +1 -1
  75. package/dist/types/index.d.ts +5 -4
  76. package/dist/types/invoices/index.d.ts +2 -2
  77. package/dist/types/invoices/types.d.ts +9 -3
  78. package/dist/types/model/Commission.d.ts +1 -1
  79. package/dist/types/model/Counterparty.d.ts +25 -0
  80. package/dist/types/model/CounterpartyDestination.d.ts +22 -0
  81. package/dist/types/model/CreateAllocationRequest.d.ts +0 -4
  82. package/dist/types/model/CreateNetAllocationRequest.d.ts +48 -0
  83. package/dist/types/model/CreateOnchainTransactionRequestEvmParams.d.ts +1 -1
  84. package/dist/types/model/CreateOrderRequest.d.ts +6 -2
  85. package/dist/types/model/CreateWalletDepositAddressRequest.d.ts +25 -0
  86. package/dist/types/model/CreateWalletWithdrawalRequest.d.ts +2 -0
  87. package/dist/types/model/CreateWalletWithdrawalResponse.d.ts +2 -0
  88. package/dist/types/model/FCMMarginCall.d.ts +41 -0
  89. package/dist/types/model/Fill.d.ts +9 -1
  90. package/dist/types/model/GetFcmBalanceResponse.d.ts +4 -0
  91. package/dist/types/model/GetFcmMarginCallDetailsResponse.d.ts +26 -0
  92. package/dist/types/model/GetFcmRiskLimitsResponse.d.ts +45 -0
  93. package/dist/types/model/GetOrderEditHistoryResponse.d.ts +35 -0
  94. package/dist/types/model/GetPortfolioCounterpartyIDResponse.d.ts +23 -0
  95. package/dist/types/model/LimitOrderEdit.d.ts +29 -0
  96. package/dist/types/model/ListWalletAddressesResponse.d.ts +25 -0
  97. package/dist/types/model/Order.d.ts +31 -1
  98. package/dist/types/model/OrderEdit.d.ts +30 -0
  99. package/dist/types/model/OrderPreviewRequest.d.ts +11 -2
  100. package/dist/types/model/PortfolioStakingInitiateRequest.d.ts +35 -0
  101. package/dist/types/model/PortfolioStakingInitiateResponse.d.ts +29 -0
  102. package/dist/types/model/PortfolioStakingMetadata.d.ts +25 -0
  103. package/dist/types/model/PortfolioStakingUnstakeRequest.d.ts +35 -0
  104. package/dist/types/model/PortfolioStakingUnstakeResponse.d.ts +29 -0
  105. package/dist/types/model/PostOrderPreviewResponse.d.ts +20 -0
  106. package/dist/types/model/RFQProductDetails.d.ts +4 -0
  107. package/dist/types/model/StakingInitiateRequest.d.ts +5 -2
  108. package/dist/types/model/StakingInitiateResponse.d.ts +3 -0
  109. package/dist/types/model/StakingUnstakeRequest.d.ts +30 -0
  110. package/dist/types/model/StakingUnstakeResponse.d.ts +3 -0
  111. package/dist/types/model/TransferLocation.d.ts +8 -0
  112. package/dist/types/model/WalletStakeInputs.d.ts +32 -0
  113. package/dist/types/model/WalletUnstakeInputs.d.ts +28 -0
  114. package/dist/types/model/enums/AllocationSizeType.d.ts +0 -1
  115. package/dist/types/model/enums/AssetChangeType.d.ts +0 -1
  116. package/dist/types/model/enums/CustodyActivityType.d.ts +0 -1
  117. package/dist/types/model/enums/DestinationType.d.ts +4 -4
  118. package/dist/types/model/enums/FcmMarginCallState.d.ts +26 -0
  119. package/dist/types/model/enums/FcmMarginCallType.d.ts +24 -0
  120. package/dist/types/model/enums/OrderSide.d.ts +0 -1
  121. package/dist/types/model/enums/OrderStatus.d.ts +0 -1
  122. package/dist/types/model/enums/OrderType.d.ts +0 -1
  123. package/dist/types/model/enums/PaymentMethodType.d.ts +3 -4
  124. package/dist/types/model/enums/PortfolioBalanceType.d.ts +0 -1
  125. package/dist/types/model/enums/ProductPermissions.d.ts +0 -1
  126. package/dist/types/model/enums/SigningStatus.d.ts +0 -1
  127. package/dist/types/model/enums/TimeInForceType.d.ts +0 -1
  128. package/dist/types/model/enums/TransactionStatus.d.ts +1 -2
  129. package/dist/types/model/enums/TransactionType.d.ts +0 -1
  130. package/dist/types/model/enums/TransferLocationType.d.ts +0 -1
  131. package/dist/types/model/enums/UserRole.d.ts +0 -1
  132. package/dist/types/model/enums/VisibilityStatus.d.ts +0 -1
  133. package/dist/types/model/enums/WalletDepositInstructionType.d.ts +0 -1
  134. package/dist/types/model/enums/WalletType.d.ts +0 -1
  135. package/dist/types/model/enums/index.d.ts +2 -0
  136. package/dist/types/model/index.d.ts +20 -0
  137. package/dist/types/onchainAddressBook/types.d.ts +1 -1
  138. package/dist/types/orders/index.d.ts +3 -1
  139. package/dist/types/orders/types.d.ts +17 -7
  140. package/dist/types/paymentMethods/types.d.ts +1 -1
  141. package/dist/types/portfolios/index.d.ts +3 -1
  142. package/dist/types/portfolios/types.d.ts +6 -2
  143. package/dist/types/positions/types.d.ts +9 -9
  144. package/dist/types/products/types.d.ts +4 -2
  145. package/dist/types/shared/brand.d.ts +15 -0
  146. package/dist/types/shared/paginatedResponse.d.ts +120 -0
  147. package/dist/types/shared/toCamelCase.d.ts +15 -0
  148. package/dist/types/staking/index.d.ts +5 -1
  149. package/dist/types/staking/types.d.ts +10 -2
  150. package/dist/types/transactions/types.d.ts +7 -3
  151. package/dist/types/users/types.d.ts +9 -5
  152. package/dist/types/wallets/types.d.ts +7 -5
  153. package/dist/users/index.js +11 -2
  154. package/dist/wallets/index.js +17 -21
  155. package/package.json +12 -11
package/README.md CHANGED
@@ -12,6 +12,28 @@ The _Prime Typescript SDK_ sample library is free and open source and released u
12
12
 
13
13
  The application and code are only available for demonstration purposes.
14
14
 
15
+ ## Pagination
16
+
17
+ When creating the client, you can now specify a maxItems and maxPages to help manage paginated responses.
18
+
19
+ ```
20
+ const client = new CoinbasePrimeClient(credentials, undefined, { maxPages: 5, maxItems: 1000 });
21
+ ```
22
+
23
+ These values can also be added on a per paginated request, such as:
24
+
25
+ ```
26
+ const client = new CoinbasePrimeClient(credentials);
27
+
28
+ const service = new TransactionsService(client);
29
+
30
+ service
31
+ .listPortfolioTransactions(
32
+ { portfolioId, limit: 100 },
33
+ { maxPages: 20, maxItems: 1000 }
34
+ )
35
+ ```
36
+
15
37
  ## Usage
16
38
 
17
39
  Here are a few examples requests:
@@ -25,6 +25,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
25
25
  };
26
26
  Object.defineProperty(exports, "__esModule", { value: true });
27
27
  exports.ActivitiesService = void 0;
28
+ const paginatedResponse_1 = require("../shared/paginatedResponse");
28
29
  class ActivitiesService {
29
30
  constructor(client) {
30
31
  this.client = client;
@@ -49,24 +50,59 @@ class ActivitiesService {
49
50
  }
50
51
  listEntityActivities(request, options) {
51
52
  return __awaiter(this, void 0, void 0, function* () {
52
- const queryParams = Object.assign(Object.assign({}, request), { entityId: undefined });
53
+ let queryParams = (0, paginatedResponse_1.getQueryParams)(this.client, request);
54
+ if (request.startTime) {
55
+ queryParams.startTime = new Date(request.startTime).toISOString();
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
+ }
53
72
  const response = yield this.client.request({
54
73
  url: `entities/${request.entityId}/activities`,
55
74
  queryParams,
56
75
  callOptions: options,
57
76
  });
58
- return response.data;
77
+ const paginationOptions = (0, paginatedResponse_1.getDefaultPaginationOptions)(this.client, options);
78
+ return (0, paginatedResponse_1.createPaginatedResponse)(response.data, this.listEntityActivities.bind(this), request, paginatedResponse_1.ResponseExtractors.activities, paginationOptions);
59
79
  });
60
80
  }
61
81
  listPortfolioActivities(request, options) {
62
82
  return __awaiter(this, void 0, void 0, function* () {
63
- const queryParams = Object.assign(Object.assign({}, request), { portfolioId: undefined });
83
+ const queryParams = (0, paginatedResponse_1.getQueryParams)(this.client, request);
84
+ if (request.startTime) {
85
+ queryParams.startTime = new Date(request.startTime).toISOString();
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
+ }
64
99
  const response = yield this.client.request({
65
100
  url: `portfolios/${request.portfolioId}/activities`,
66
101
  queryParams,
67
102
  callOptions: options,
68
103
  });
69
- return response.data;
104
+ const paginationOptions = (0, paginatedResponse_1.getDefaultPaginationOptions)(this.client, options);
105
+ return (0, paginatedResponse_1.createPaginatedResponse)(response.data, this.listPortfolioActivities.bind(this), request, paginatedResponse_1.ResponseExtractors.activities, paginationOptions);
70
106
  });
71
107
  }
72
108
  }
@@ -26,19 +26,21 @@ exports.AddressBooksService = 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 AddressBooksService {
30
31
  constructor(client) {
31
32
  this.client = client;
32
33
  }
33
34
  listAddressBooks(request, options) {
34
35
  return __awaiter(this, void 0, void 0, function* () {
35
- const queryParams = Object.assign(Object.assign({}, request), { portfolioId: undefined });
36
+ const queryParams = (0, paginatedResponse_1.getQueryParams)(this.client, request);
36
37
  const response = yield this.client.request({
37
38
  url: `portfolios/${request.portfolioId}/address_book`,
38
39
  queryParams,
39
40
  callOptions: options,
40
41
  });
41
- return response.data;
42
+ const paginationOptions = (0, paginatedResponse_1.getDefaultPaginationOptions)(this.client, options);
43
+ return (0, paginatedResponse_1.createPaginatedResponse)(response.data, this.listAddressBooks.bind(this), request, paginatedResponse_1.ResponseExtractors.addresses, paginationOptions);
42
44
  });
43
45
  }
44
46
  createAddressBook(request, options) {
@@ -26,6 +26,7 @@ exports.AllocationService = 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 AllocationService {
30
31
  constructor(client) {
31
32
  this.client = client;
@@ -54,18 +55,33 @@ class AllocationService {
54
55
  }
55
56
  listPortfolioAllocations(request, options) {
56
57
  return __awaiter(this, void 0, void 0, function* () {
57
- const queryParams = Object.assign(Object.assign({}, request), { portfolioId: undefined });
58
+ let queryParams = (0, paginatedResponse_1.getQueryParams)(this.client, request);
59
+ if (request.startDate) {
60
+ queryParams.startDate = new Date(request.startDate).toISOString();
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
+ }
58
71
  const response = yield this.client.request({
59
72
  url: `portfolios/${request.portfolioId}/allocations`,
60
73
  queryParams,
61
74
  callOptions: options,
62
75
  });
63
- return response.data;
76
+ const paginationOptions = (0, paginatedResponse_1.getDefaultPaginationOptions)(this.client, options);
77
+ return (0, paginatedResponse_1.createPaginatedResponse)(response.data, this.listPortfolioAllocations.bind(this), request, paginatedResponse_1.ResponseExtractors.allocations, paginationOptions);
64
78
  });
65
79
  }
66
80
  listNetAllocations(request, options) {
67
81
  return __awaiter(this, void 0, void 0, function* () {
68
- const queryParams = Object.assign(Object.assign({}, request), { portfolioId: undefined });
82
+ const queryParams = {
83
+ allocationId: request.allocationId,
84
+ };
69
85
  const response = yield this.client.request({
70
86
  url: `portfolios/${request.portfolioId}/allocations/net/${request.nettingId}`,
71
87
  queryParams,
@@ -10,6 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.BalancesService = void 0;
13
+ const paginatedResponse_1 = require("../shared/paginatedResponse");
13
14
  class BalancesService {
14
15
  constructor(client) {
15
16
  this.client = client;
@@ -28,7 +29,7 @@ class BalancesService {
28
29
  getWalletBalance(request, options) {
29
30
  return __awaiter(this, void 0, void 0, function* () {
30
31
  const response = yield this.client.request({
31
- url: `portfolios/${request.portfolioId}/wallets/${request.walletId}balances`,
32
+ url: `portfolios/${request.portfolioId}/wallets/${request.walletId}/balance`,
32
33
  callOptions: options,
33
34
  });
34
35
  return response.data;
@@ -36,24 +37,35 @@ class BalancesService {
36
37
  }
37
38
  listOnchainWalletBalances(request, options) {
38
39
  return __awaiter(this, void 0, void 0, function* () {
39
- const queryParams = Object.assign(Object.assign({}, request), { portfolioId: undefined, walletId: undefined });
40
+ let queryParams = (0, paginatedResponse_1.getQueryParams)(this.client, request);
41
+ if (request.visibilityStatuses) {
42
+ queryParams.visibilityStatuses = request.visibilityStatuses;
43
+ }
40
44
  const response = yield this.client.request({
41
45
  url: `portfolios/${request.portfolioId}/wallets/${request.walletId}/web3_balances`,
42
46
  queryParams,
43
47
  callOptions: options,
44
48
  });
45
- return response.data;
49
+ const paginationOptions = (0, paginatedResponse_1.getDefaultPaginationOptions)(this.client, options);
50
+ return (0, paginatedResponse_1.createPaginatedResponse)(response.data, this.listOnchainWalletBalances.bind(this), request, paginatedResponse_1.ResponseExtractors.balances, paginationOptions);
46
51
  });
47
52
  }
48
53
  listEntityBalances(request, options) {
49
54
  return __awaiter(this, void 0, void 0, function* () {
50
- const queryParams = Object.assign(Object.assign({}, request), { entityId: undefined });
55
+ let queryParams = (0, paginatedResponse_1.getQueryParams)(this.client, request);
56
+ if (request.symbols) {
57
+ queryParams.symbols = request.symbols;
58
+ }
59
+ if (request.aggregationType) {
60
+ queryParams.aggregationType = request.aggregationType;
61
+ }
51
62
  const response = yield this.client.request({
52
63
  url: `entities/${request.entityId}/balances`,
53
64
  queryParams,
54
65
  callOptions: options,
55
66
  });
56
- return response.data;
67
+ const paginationOptions = (0, paginatedResponse_1.getDefaultPaginationOptions)(this.client, options);
68
+ return (0, paginatedResponse_1.createPaginatedResponse)(response.data, this.listEntityBalances.bind(this), request, paginatedResponse_1.ResponseExtractors.balances, paginationOptions);
57
69
  });
58
70
  }
59
71
  }
package/dist/client.js CHANGED
@@ -20,8 +20,13 @@ const core_ts_1 = require("@coinbase-sample/core-ts");
20
20
  const constants_1 = require("./constants");
21
21
  const toCamelCase_1 = require("./shared/toCamelCase");
22
22
  class CoinbasePrimeClient extends core_ts_1.CoinbaseClient {
23
- constructor(credentials, apiBasePath) {
24
- super(apiBasePath !== null && apiBasePath !== void 0 ? apiBasePath : constants_1.API_BASE_PATH, credentials, constants_1.USER_AGENT);
23
+ constructor(credentials, apiBasePath, options) {
24
+ const defaultClientOptions = Object.assign({ defaultLimit: constants_1.DEFAULT_PAGINATION_LIMIT, maxPages: constants_1.DEFAULT_MAX_PAGES, maxItems: constants_1.DEFAULT_MAX_ITEMS }, options);
25
+ let basePath = constants_1.API_BASE_PATH;
26
+ if (apiBasePath && apiBasePath.length > 0) {
27
+ basePath = apiBasePath;
28
+ }
29
+ super(basePath, credentials, constants_1.USER_AGENT, defaultClientOptions);
25
30
  // transform the response data to camelCase
26
31
  this.addTransformResponse((response) => {
27
32
  return Object.assign(Object.assign({}, response), { data: (0, toCamelCase_1.toCamelCase)(response.data) });
package/dist/constants.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CB_ACCESS_TIMESTAMP_HEADER = exports.CB_ACCESS_SIGNATURE_HEADER = exports.CB_ACCESS_PHRASE_HEADER = exports.CB_ACCESS_KEY_HEADER = exports.USER_AGENT = exports.API_BASE_PATH = exports.VERSION = void 0;
3
+ exports.DEFAULT_MAX_ITEMS = exports.DEFAULT_MAX_PAGES = exports.DEFAULT_PAGINATION_LIMIT = exports.CB_ACCESS_TIMESTAMP_HEADER = exports.CB_ACCESS_SIGNATURE_HEADER = exports.CB_ACCESS_PHRASE_HEADER = exports.CB_ACCESS_KEY_HEADER = exports.USER_AGENT = exports.API_BASE_PATH = exports.VERSION = void 0;
4
4
  /**
5
5
  * Copyright 2024-present Coinbase Global, Inc.
6
6
  *
@@ -16,10 +16,13 @@ exports.CB_ACCESS_TIMESTAMP_HEADER = exports.CB_ACCESS_SIGNATURE_HEADER = export
16
16
  * See the License for the specific language governing permissions and
17
17
  * limitations under the License.
18
18
  */
19
- exports.VERSION = '0.1.0';
19
+ exports.VERSION = '0.6.0';
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';
23
23
  exports.CB_ACCESS_PHRASE_HEADER = 'X-CB-ACCESS-PASSPHRASE';
24
24
  exports.CB_ACCESS_SIGNATURE_HEADER = 'X-CB-ACCESS-SIGNATURE';
25
25
  exports.CB_ACCESS_TIMESTAMP_HEADER = 'X-CB-ACCESS-TIMESTAMP';
26
+ exports.DEFAULT_PAGINATION_LIMIT = 25;
27
+ exports.DEFAULT_MAX_PAGES = 100;
28
+ exports.DEFAULT_MAX_ITEMS = 10000;
@@ -129,6 +129,24 @@ class FinancingService {
129
129
  return response.data;
130
130
  });
131
131
  }
132
+ getFcmMarginCallDetails(request, options) {
133
+ return __awaiter(this, void 0, void 0, function* () {
134
+ const response = yield this.client.request({
135
+ url: `entities/${request.entityId}/futures/margin_call_details`,
136
+ callOptions: options,
137
+ });
138
+ return response.data;
139
+ });
140
+ }
141
+ getFcmRiskLimits(request, options) {
142
+ return __awaiter(this, void 0, void 0, function* () {
143
+ const response = yield this.client.request({
144
+ url: `entities/${request.entityId}/futures/risk_limits`,
145
+ callOptions: options,
146
+ });
147
+ return response.data;
148
+ });
149
+ }
132
150
  createNewLocates(request, options) {
133
151
  return __awaiter(this, void 0, void 0, function* () {
134
152
  const bodyParams = Object.assign(Object.assign({}, request), { portfolioId: undefined });
package/dist/index.js CHANGED
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.WalletsService = exports.UsersService = exports.TransactionsService = exports.StakingService = exports.ProductsService = exports.PositionsService = exports.PortfoliosService = exports.PaymentMethodsService = exports.OrdersService = exports.OnchainAddressBookService = exports.InvoicesService = exports.FuturesService = exports.CommissionService = exports.BalancesService = exports.AssetsService = exports.AllocationService = exports.AddressBooksService = exports.ActivitiesService = exports.CoinbasePrimeCredentials = exports.CoinbasePrimeClient = void 0;
17
+ exports.WalletsService = exports.UsersService = exports.TransactionsService = exports.StakingService = exports.ProductsService = exports.PositionsService = exports.PortfoliosService = exports.PaymentMethodsService = exports.OrdersService = exports.OnchainAddressBookService = exports.InvoicesService = exports.FuturesService = exports.FinancingService = exports.CommissionService = exports.BalancesService = exports.AssetsService = exports.AllocationService = exports.AddressBooksService = exports.ActivitiesService = exports.CoinbasePrimeCredentials = exports.CoinbasePrimeClient = void 0;
18
18
  /**
19
19
  * Copyright 2024-present Coinbase Global, Inc.
20
20
  *
@@ -46,6 +46,8 @@ var balances_1 = require("./balances");
46
46
  Object.defineProperty(exports, "BalancesService", { enumerable: true, get: function () { return balances_1.BalancesService; } });
47
47
  var commission_1 = require("./commission");
48
48
  Object.defineProperty(exports, "CommissionService", { enumerable: true, get: function () { return commission_1.CommissionService; } });
49
+ var financing_1 = require("./financing");
50
+ Object.defineProperty(exports, "FinancingService", { enumerable: true, get: function () { return financing_1.FinancingService; } });
49
51
  var futures_1 = require("./futures");
50
52
  Object.defineProperty(exports, "FuturesService", { enumerable: true, get: function () { return futures_1.FuturesService; } });
51
53
  var invoices_1 = require("./invoices");
@@ -10,17 +10,30 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.InvoicesService = void 0;
13
+ const paginatedResponse_1 = require("../shared/paginatedResponse");
13
14
  class InvoicesService {
14
15
  constructor(client) {
15
16
  this.client = client;
16
17
  }
17
- listInvoicess(request, options) {
18
+ listInvoices(request, options) {
18
19
  return __awaiter(this, void 0, void 0, function* () {
20
+ let queryParams = (0, paginatedResponse_1.getQueryParams)(this.client, request);
21
+ if (request.states) {
22
+ queryParams.states = request.states;
23
+ }
24
+ if (request.billingYear) {
25
+ queryParams.billingYear = request.billingYear;
26
+ }
27
+ if (request.billingMonth) {
28
+ queryParams.billingMonth = request.billingMonth;
29
+ }
19
30
  const response = yield this.client.request({
20
- url: `entities/${request.entityId}/Invoicess`,
31
+ url: `entities/${request.entityId}/invoices`,
32
+ queryParams,
21
33
  callOptions: options,
22
34
  });
23
- return response.data;
35
+ const paginationOptions = (0, paginatedResponse_1.getDefaultPaginationOptions)(this.client, options);
36
+ return (0, paginatedResponse_1.createPaginatedResponse)(response.data, this.listInvoices.bind(this), request, paginatedResponse_1.ResponseExtractors.invoices, paginationOptions);
24
37
  });
25
38
  }
26
39
  }
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ /**
3
+ * Copyright 2025-present Coinbase Global, Inc.
4
+ *
5
+ * This file is generated by Openapi Generator https://github.com/openapitools/openapi-generator
6
+ *
7
+ * Licensed under the Apache License, Version 2.0 (the "License");
8
+ * you may not use this file except in compliance with the License.
9
+ * You may obtain a copy of the License at
10
+ *
11
+ * http://www.apache.org/licenses/LICENSE-2.0
12
+ *
13
+ * Unless required by applicable law or agreed to in writing, software
14
+ * distributed under the License is distributed on an "AS IS" BASIS,
15
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ * See the License for the specific language governing permissions and
17
+ * limitations under the License.
18
+ *
19
+ * Do not edit the class manually.
20
+ */
21
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ /**
3
+ * Copyright 2025-present Coinbase Global, Inc.
4
+ *
5
+ * This file is generated by Openapi Generator https://github.com/openapitools/openapi-generator
6
+ *
7
+ * Licensed under the Apache License, Version 2.0 (the "License");
8
+ * you may not use this file except in compliance with the License.
9
+ * You may obtain a copy of the License at
10
+ *
11
+ * http://www.apache.org/licenses/LICENSE-2.0
12
+ *
13
+ * Unless required by applicable law or agreed to in writing, software
14
+ * distributed under the License is distributed on an "AS IS" BASIS,
15
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ * See the License for the specific language governing permissions and
17
+ * limitations under the License.
18
+ *
19
+ * Do not edit the class manually.
20
+ */
21
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ /**
3
+ * Copyright 2025-present Coinbase Global, Inc.
4
+ *
5
+ * This file is generated by Openapi Generator https://github.com/openapitools/openapi-generator
6
+ *
7
+ * Licensed under the Apache License, Version 2.0 (the "License");
8
+ * you may not use this file except in compliance with the License.
9
+ * You may obtain a copy of the License at
10
+ *
11
+ * http://www.apache.org/licenses/LICENSE-2.0
12
+ *
13
+ * Unless required by applicable law or agreed to in writing, software
14
+ * distributed under the License is distributed on an "AS IS" BASIS,
15
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ * See the License for the specific language governing permissions and
17
+ * limitations under the License.
18
+ *
19
+ * Do not edit the class manually.
20
+ */
21
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ /**
3
+ * Copyright 2025-present Coinbase Global, Inc.
4
+ *
5
+ * This file is generated by Openapi Generator https://github.com/openapitools/openapi-generator
6
+ *
7
+ * Licensed under the Apache License, Version 2.0 (the "License");
8
+ * you may not use this file except in compliance with the License.
9
+ * You may obtain a copy of the License at
10
+ *
11
+ * http://www.apache.org/licenses/LICENSE-2.0
12
+ *
13
+ * Unless required by applicable law or agreed to in writing, software
14
+ * distributed under the License is distributed on an "AS IS" BASIS,
15
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ * See the License for the specific language governing permissions and
17
+ * limitations under the License.
18
+ *
19
+ * Do not edit the class manually.
20
+ */
21
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ /**
3
+ * Copyright 2025-present Coinbase Global, Inc.
4
+ *
5
+ * This file is generated by Openapi Generator https://github.com/openapitools/openapi-generator
6
+ *
7
+ * Licensed under the Apache License, Version 2.0 (the "License");
8
+ * you may not use this file except in compliance with the License.
9
+ * You may obtain a copy of the License at
10
+ *
11
+ * http://www.apache.org/licenses/LICENSE-2.0
12
+ *
13
+ * Unless required by applicable law or agreed to in writing, software
14
+ * distributed under the License is distributed on an "AS IS" BASIS,
15
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ * See the License for the specific language governing permissions and
17
+ * limitations under the License.
18
+ *
19
+ * Do not edit the class manually.
20
+ */
21
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ /**
3
+ * Copyright 2025-present Coinbase Global, Inc.
4
+ *
5
+ * This file is generated by Openapi Generator https://github.com/openapitools/openapi-generator
6
+ *
7
+ * Licensed under the Apache License, Version 2.0 (the "License");
8
+ * you may not use this file except in compliance with the License.
9
+ * You may obtain a copy of the License at
10
+ *
11
+ * http://www.apache.org/licenses/LICENSE-2.0
12
+ *
13
+ * Unless required by applicable law or agreed to in writing, software
14
+ * distributed under the License is distributed on an "AS IS" BASIS,
15
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ * See the License for the specific language governing permissions and
17
+ * limitations under the License.
18
+ *
19
+ * Do not edit the class manually.
20
+ */
21
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ /**
3
+ * Copyright 2025-present Coinbase Global, Inc.
4
+ *
5
+ * This file is generated by Openapi Generator https://github.com/openapitools/openapi-generator
6
+ *
7
+ * Licensed under the Apache License, Version 2.0 (the "License");
8
+ * you may not use this file except in compliance with the License.
9
+ * You may obtain a copy of the License at
10
+ *
11
+ * http://www.apache.org/licenses/LICENSE-2.0
12
+ *
13
+ * Unless required by applicable law or agreed to in writing, software
14
+ * distributed under the License is distributed on an "AS IS" BASIS,
15
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ * See the License for the specific language governing permissions and
17
+ * limitations under the License.
18
+ *
19
+ * Do not edit the class manually.
20
+ */
21
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ /**
3
+ * Copyright 2025-present Coinbase Global, Inc.
4
+ *
5
+ * This file is generated by Openapi Generator https://github.com/openapitools/openapi-generator
6
+ *
7
+ * Licensed under the Apache License, Version 2.0 (the "License");
8
+ * you may not use this file except in compliance with the License.
9
+ * You may obtain a copy of the License at
10
+ *
11
+ * http://www.apache.org/licenses/LICENSE-2.0
12
+ *
13
+ * Unless required by applicable law or agreed to in writing, software
14
+ * distributed under the License is distributed on an "AS IS" BASIS,
15
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ * See the License for the specific language governing permissions and
17
+ * limitations under the License.
18
+ *
19
+ * Do not edit the class manually.
20
+ */
21
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ /**
3
+ * Copyright 2025-present Coinbase Global, Inc.
4
+ *
5
+ * This file is generated by Openapi Generator https://github.com/openapitools/openapi-generator
6
+ *
7
+ * Licensed under the Apache License, Version 2.0 (the "License");
8
+ * you may not use this file except in compliance with the License.
9
+ * You may obtain a copy of the License at
10
+ *
11
+ * http://www.apache.org/licenses/LICENSE-2.0
12
+ *
13
+ * Unless required by applicable law or agreed to in writing, software
14
+ * distributed under the License is distributed on an "AS IS" BASIS,
15
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ * See the License for the specific language governing permissions and
17
+ * limitations under the License.
18
+ *
19
+ * Do not edit the class manually.
20
+ */
21
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ /**
3
+ * Copyright 2025-present Coinbase Global, Inc.
4
+ *
5
+ * This file is generated by Openapi Generator https://github.com/openapitools/openapi-generator
6
+ *
7
+ * Licensed under the Apache License, Version 2.0 (the "License");
8
+ * you may not use this file except in compliance with the License.
9
+ * You may obtain a copy of the License at
10
+ *
11
+ * http://www.apache.org/licenses/LICENSE-2.0
12
+ *
13
+ * Unless required by applicable law or agreed to in writing, software
14
+ * distributed under the License is distributed on an "AS IS" BASIS,
15
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ * See the License for the specific language governing permissions and
17
+ * limitations under the License.
18
+ *
19
+ * Do not edit the class manually.
20
+ */
21
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ /**
3
+ * Copyright 2025-present Coinbase Global, Inc.
4
+ *
5
+ * This file is generated by Openapi Generator https://github.com/openapitools/openapi-generator
6
+ *
7
+ * Licensed under the Apache License, Version 2.0 (the "License");
8
+ * you may not use this file except in compliance with the License.
9
+ * You may obtain a copy of the License at
10
+ *
11
+ * http://www.apache.org/licenses/LICENSE-2.0
12
+ *
13
+ * Unless required by applicable law or agreed to in writing, software
14
+ * distributed under the License is distributed on an "AS IS" BASIS,
15
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ * See the License for the specific language governing permissions and
17
+ * limitations under the License.
18
+ *
19
+ * Do not edit the class manually.
20
+ */
21
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ /**
3
+ * Copyright 2025-present Coinbase Global, Inc.
4
+ *
5
+ * This file is generated by Openapi Generator https://github.com/openapitools/openapi-generator
6
+ *
7
+ * Licensed under the Apache License, Version 2.0 (the "License");
8
+ * you may not use this file except in compliance with the License.
9
+ * You may obtain a copy of the License at
10
+ *
11
+ * http://www.apache.org/licenses/LICENSE-2.0
12
+ *
13
+ * Unless required by applicable law or agreed to in writing, software
14
+ * distributed under the License is distributed on an "AS IS" BASIS,
15
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ * See the License for the specific language governing permissions and
17
+ * limitations under the License.
18
+ *
19
+ * Do not edit the class manually.
20
+ */
21
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ /**
3
+ * Copyright 2025-present Coinbase Global, Inc.
4
+ *
5
+ * This file is generated by Openapi Generator https://github.com/openapitools/openapi-generator
6
+ *
7
+ * Licensed under the Apache License, Version 2.0 (the "License");
8
+ * you may not use this file except in compliance with the License.
9
+ * You may obtain a copy of the License at
10
+ *
11
+ * http://www.apache.org/licenses/LICENSE-2.0
12
+ *
13
+ * Unless required by applicable law or agreed to in writing, software
14
+ * distributed under the License is distributed on an "AS IS" BASIS,
15
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ * See the License for the specific language governing permissions and
17
+ * limitations under the License.
18
+ *
19
+ * Do not edit the class manually.
20
+ */
21
+ Object.defineProperty(exports, "__esModule", { value: true });