@coinbase-sample/prime-sdk-ts 0.2.0 → 0.3.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 (128) hide show
  1. package/dist/balances/index.d.ts +3 -1
  2. package/dist/balances/index.js +12 -1
  3. package/dist/balances/types.d.ts +9 -0
  4. package/dist/financing/index.d.ts +49 -0
  5. package/dist/financing/index.js +144 -0
  6. package/dist/financing/types.d.ts +94 -0
  7. package/dist/financing/types.js +2 -0
  8. package/dist/futures/index.d.ts +5 -5
  9. package/dist/futures/types.d.ts +2 -2
  10. package/dist/index.d.ts +19 -0
  11. package/dist/index.js +3 -1
  12. package/dist/model/AcceptQuoteRequest.d.ts +33 -0
  13. package/dist/model/AcceptQuoteRequest.js +21 -0
  14. package/dist/model/AcceptQuoteResponse.d.ts +22 -0
  15. package/dist/model/AcceptQuoteResponse.js +21 -0
  16. package/dist/model/Accrual.d.ts +83 -0
  17. package/dist/model/Accrual.js +21 -0
  18. package/dist/model/AssetBalance.d.ts +41 -0
  19. package/dist/model/AssetBalance.js +21 -0
  20. package/dist/model/Balance.d.ts +4 -0
  21. package/dist/model/BuyingPower.d.ts +41 -0
  22. package/dist/model/BuyingPower.js +21 -0
  23. package/dist/model/Conversion.d.ts +36 -0
  24. package/dist/model/Conversion.js +21 -0
  25. package/dist/model/ConversionDetail.d.ts +49 -0
  26. package/dist/model/ConversionDetail.js +21 -0
  27. package/dist/model/CreateAddressGroup.d.ts +26 -0
  28. package/dist/model/CreateAddressGroup.js +21 -0
  29. package/dist/model/CreateNewLocatesRequest.d.ts +37 -0
  30. package/dist/model/CreateNewLocatesRequest.js +21 -0
  31. package/dist/model/CreateNewLocatesResponse.d.ts +22 -0
  32. package/dist/model/CreateNewLocatesResponse.js +21 -0
  33. package/dist/model/CreateOrderRequest.d.ts +4 -0
  34. package/dist/model/EntityBalance.d.ts +41 -0
  35. package/dist/model/EntityBalance.js +21 -0
  36. package/dist/model/ExistingLocate.d.ts +65 -0
  37. package/dist/model/ExistingLocate.js +21 -0
  38. package/dist/model/Fill.d.ts +4 -0
  39. package/dist/model/GetBuyingPowerResponse.d.ts +23 -0
  40. package/dist/model/GetBuyingPowerResponse.js +21 -0
  41. package/dist/model/GetExistingLocatesResponse.d.ts +23 -0
  42. package/dist/model/GetExistingLocatesResponse.js +21 -0
  43. package/dist/model/GetInterestAccrualsResponse.d.ts +24 -0
  44. package/dist/model/GetInterestAccrualsResponse.js +21 -0
  45. package/dist/model/GetLocateAvailabilitiesResponse.d.ts +23 -0
  46. package/dist/model/GetLocateAvailabilitiesResponse.js +21 -0
  47. package/dist/model/GetMarginConversionsResponse.d.ts +23 -0
  48. package/dist/model/GetMarginConversionsResponse.js +21 -0
  49. package/dist/model/GetMarginInformationResponse.d.ts +23 -0
  50. package/dist/model/GetMarginInformationResponse.js +21 -0
  51. package/dist/model/GetMarginSummariesResponse.d.ts +23 -0
  52. package/dist/model/GetMarginSummariesResponse.js +21 -0
  53. package/dist/model/GetPortfolioInterestAccrualsResponse.d.ts +24 -0
  54. package/dist/model/GetPortfolioInterestAccrualsResponse.js +21 -0
  55. package/dist/model/GetTFTieredPricingFeesResponse.d.ts +23 -0
  56. package/dist/model/GetTFTieredPricingFeesResponse.js +21 -0
  57. package/dist/model/GetWithdrawalPowerResponse.d.ts +23 -0
  58. package/dist/model/GetWithdrawalPowerResponse.js +21 -0
  59. package/dist/model/ListAggregateEntityPositionsResponse.d.ts +25 -0
  60. package/dist/model/ListAggregateEntityPositionsResponse.js +21 -0
  61. package/dist/model/ListEntityBalancesResponse.d.ts +25 -0
  62. package/dist/model/ListEntityBalancesResponse.js +21 -0
  63. package/dist/model/ListEntityPositionsResponse.d.ts +25 -0
  64. package/dist/model/ListEntityPositionsResponse.js +21 -0
  65. package/dist/model/LoanInfo.d.ts +41 -0
  66. package/dist/model/LoanInfo.js +21 -0
  67. package/dist/model/Locate.d.ts +33 -0
  68. package/dist/model/Locate.js +21 -0
  69. package/dist/model/MarginAddOn.d.ts +27 -0
  70. package/dist/model/MarginAddOn.js +21 -0
  71. package/dist/model/MarginCallRecord.d.ts +41 -0
  72. package/dist/model/MarginCallRecord.js +21 -0
  73. package/dist/model/MarginInformation.d.ts +28 -0
  74. package/dist/model/MarginInformation.js +21 -0
  75. package/dist/model/MarginSummary.d.ts +151 -0
  76. package/dist/model/MarginSummary.js +21 -0
  77. package/dist/model/MarginSummaryHistorical.d.ts +31 -0
  78. package/dist/model/MarginSummaryHistorical.js +21 -0
  79. package/dist/model/MarketRate.d.ts +29 -0
  80. package/dist/model/MarketRate.js +21 -0
  81. package/dist/model/Order.d.ts +4 -0
  82. package/dist/model/OrderPreviewRequest.d.ts +4 -0
  83. package/dist/model/PMAssetInfo.d.ts +89 -0
  84. package/dist/model/PMAssetInfo.js +21 -0
  85. package/dist/model/Position.d.ts +35 -0
  86. package/dist/model/Position.js +21 -0
  87. package/dist/model/PositionReference.d.ts +27 -0
  88. package/dist/model/PositionReference.js +21 -0
  89. package/dist/model/Product.d.ts +2 -0
  90. package/dist/model/QuoteResponse.d.ts +26 -0
  91. package/dist/model/QuoteResponse.js +21 -0
  92. package/dist/model/RFQ.d.ts +35 -0
  93. package/dist/model/RFQ.js +21 -0
  94. package/dist/model/RFQProductDetails.d.ts +24 -0
  95. package/dist/model/RFQProductDetails.js +21 -0
  96. package/dist/model/RpcConfig.d.ts +1 -1
  97. package/dist/model/ShortCollateral.d.ts +37 -0
  98. package/dist/model/ShortCollateral.js +21 -0
  99. package/dist/model/TieredPricingFee.d.ts +29 -0
  100. package/dist/model/TieredPricingFee.js +21 -0
  101. package/dist/model/WithdrawalPower.d.ts +29 -0
  102. package/dist/model/WithdrawalPower.js +21 -0
  103. package/dist/model/enums/Benchmark.d.ts +26 -0
  104. package/dist/model/enums/Benchmark.js +30 -0
  105. package/dist/model/enums/LoanType.d.ts +27 -0
  106. package/dist/model/enums/LoanType.js +31 -0
  107. package/dist/model/enums/MarginAddOnType.d.ts +26 -0
  108. package/dist/model/enums/MarginAddOnType.js +30 -0
  109. package/dist/model/enums/PortfolioBalanceType.d.ts +2 -1
  110. package/dist/model/enums/PortfolioBalanceType.js +1 -0
  111. package/dist/model/enums/PositionReferenceType.d.ts +24 -0
  112. package/dist/model/enums/PositionReferenceType.js +28 -0
  113. package/dist/model/enums/RateType.d.ts +26 -0
  114. package/dist/model/enums/RateType.js +30 -0
  115. package/dist/orders/index.d.ts +5 -1
  116. package/dist/orders/index.js +22 -0
  117. package/dist/orders/types.d.ts +11 -0
  118. package/dist/portfolios/index.d.ts +3 -3
  119. package/dist/portfolios/index.js +1 -1
  120. package/dist/portfolios/types.d.ts +1 -0
  121. package/dist/positions/index.d.ts +29 -0
  122. package/dist/positions/index.js +40 -0
  123. package/dist/positions/types.d.ts +14 -0
  124. package/dist/positions/types.js +2 -0
  125. package/dist/wallets/index.d.ts +5 -1
  126. package/dist/wallets/index.js +51 -0
  127. package/dist/wallets/types.d.ts +22 -0
  128. package/package.json +12 -11
@@ -0,0 +1,28 @@
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 });
22
+ exports.PositionReferenceType = void 0;
23
+ var PositionReferenceType;
24
+ (function (PositionReferenceType) {
25
+ PositionReferenceType["PositionReferenceTypeUnspecified"] = "POSITION_REFERENCE_TYPE_UNSPECIFIED";
26
+ PositionReferenceType["Entity"] = "ENTITY";
27
+ PositionReferenceType["Portfolio"] = "PORTFOLIO";
28
+ })(PositionReferenceType || (exports.PositionReferenceType = PositionReferenceType = {}));
@@ -0,0 +1,26 @@
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 declare enum RateType {
21
+ RateTypeUnset = "RATE_TYPE_UNSET",
22
+ Bps = "BPS",
23
+ Apr360 = "APR_360",
24
+ Apr365 = "APR_365",
25
+ Apr = "APR"
26
+ }
@@ -0,0 +1,30 @@
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 });
22
+ exports.RateType = void 0;
23
+ var RateType;
24
+ (function (RateType) {
25
+ RateType["RateTypeUnset"] = "RATE_TYPE_UNSET";
26
+ RateType["Bps"] = "BPS";
27
+ RateType["Apr360"] = "APR_360";
28
+ RateType["Apr365"] = "APR_365";
29
+ RateType["Apr"] = "APR";
30
+ })(RateType || (exports.RateType = RateType = {}));
@@ -16,7 +16,7 @@
16
16
  import { CoinbaseCallOptions } from '@coinbase-sample/core-ts';
17
17
  import { CoinbasePrimeClient } from '../client';
18
18
  import { CoinbasePrimeClientException, CoinbasePrimeException } from '../errors';
19
- import { ListOpenOrdersResponse, ListOpenOrdersRequest, ListOrderFillsRequest, ListOrderFillsResponse, ListPortfolioOrdersResponse, ListPortfolioOrdersRequest, GetOrderResponse, GetOrderRequest, ListPortfolioFillsRequest, ListPortfolioFillsResponse, CreateOrderPreviewRequest, CreateOrderPreviewResponse, CancelOrderRequest, CancelOrderResponse, CreateOrderRequest, CreateOrderResponse } from './types';
19
+ import { ListOpenOrdersResponse, ListOpenOrdersRequest, ListOrderFillsRequest, ListOrderFillsResponse, ListPortfolioOrdersResponse, ListPortfolioOrdersRequest, GetOrderResponse, GetOrderRequest, ListPortfolioFillsRequest, ListPortfolioFillsResponse, CreateOrderPreviewRequest, CreateOrderPreviewResponse, CancelOrderRequest, CancelOrderResponse, CreateOrderRequest, CreateOrderResponse, CreateQuoteRequest, CreateQuoteResponse, AcceptQuoteRequest, AcceptQuoteResponse } from './types';
20
20
  export interface IOrdersService {
21
21
  getOrder(request: GetOrderRequest, options?: CoinbaseCallOptions): Promise<GetOrderResponse | CoinbasePrimeClientException | CoinbasePrimeException>;
22
22
  listPortfolioFills(request: ListPortfolioFillsRequest, options?: CoinbaseCallOptions): Promise<ListPortfolioFillsResponse | CoinbasePrimeClientException | CoinbasePrimeException>;
@@ -26,6 +26,8 @@ export interface IOrdersService {
26
26
  createOrderPreview(request: CreateOrderPreviewRequest, options?: CoinbaseCallOptions): Promise<CreateOrderPreviewResponse | CoinbasePrimeClientException | CoinbasePrimeException>;
27
27
  cancelOrder(request: CancelOrderRequest, options?: CoinbaseCallOptions): Promise<CancelOrderResponse | CoinbasePrimeClientException | CoinbasePrimeException>;
28
28
  createOrder(request: CreateOrderRequest, options?: CoinbaseCallOptions): Promise<CreateOrderResponse | CoinbasePrimeClientException | CoinbasePrimeException>;
29
+ createQuote(request: CreateQuoteRequest, options?: CoinbaseCallOptions): Promise<CreateQuoteResponse | CoinbasePrimeClientException | CoinbasePrimeException>;
30
+ acceptQuote(request: AcceptQuoteRequest, options?: CoinbaseCallOptions): Promise<AcceptQuoteResponse | CoinbasePrimeClientException | CoinbasePrimeException>;
29
31
  }
30
32
  export declare class OrdersService implements IOrdersService {
31
33
  private client;
@@ -38,4 +40,6 @@ export declare class OrdersService implements IOrdersService {
38
40
  createOrderPreview(request: CreateOrderPreviewRequest, options?: CoinbaseCallOptions): Promise<CreateOrderPreviewResponse | CoinbasePrimeClientException | CoinbasePrimeException>;
39
41
  cancelOrder(request: CancelOrderRequest, options?: CoinbaseCallOptions): Promise<CancelOrderResponse | CoinbasePrimeClientException | CoinbasePrimeException>;
40
42
  createOrder(request: CreateOrderRequest, options?: CoinbaseCallOptions): Promise<CreateOrderResponse | CoinbasePrimeClientException | CoinbasePrimeException>;
43
+ createQuote(request: CreateQuoteRequest, options?: CoinbaseCallOptions): Promise<CreateQuoteResponse | CoinbasePrimeClientException | CoinbasePrimeException>;
44
+ acceptQuote(request: AcceptQuoteRequest, options?: CoinbaseCallOptions): Promise<AcceptQuoteResponse | CoinbasePrimeClientException | CoinbasePrimeException>;
41
45
  }
@@ -115,5 +115,27 @@ class OrdersService {
115
115
  return response.data;
116
116
  });
117
117
  }
118
+ createQuote(request, options) {
119
+ return __awaiter(this, void 0, void 0, function* () {
120
+ const response = yield this.client.request({
121
+ url: `portfolios/${request.portfolioId}/rfq`,
122
+ method: core_ts_1.Method.POST,
123
+ bodyParams: request,
124
+ callOptions: options,
125
+ });
126
+ return response.data;
127
+ });
128
+ }
129
+ acceptQuote(request, options) {
130
+ return __awaiter(this, void 0, void 0, function* () {
131
+ const response = yield this.client.request({
132
+ url: `portfolios/${request.portfolioId}/accept_quote`,
133
+ method: core_ts_1.Method.POST,
134
+ bodyParams: request,
135
+ callOptions: options,
136
+ });
137
+ return response.data;
138
+ });
139
+ }
118
140
  }
119
141
  exports.OrdersService = OrdersService;
@@ -27,6 +27,9 @@ import { CancelOrderResponse as internalCancel } from '../model/CancelOrderRespo
27
27
  import { CreateOrderResponse as internalCreateResp } from '../model/CreateOrderResponse';
28
28
  import { CreateOrderRequest as internalCreate } from '../model/CreateOrderRequest';
29
29
  import { Pagination } from '../shared/pagination';
30
+ import { QuoteResponse } from '../model/QuoteResponse';
31
+ import { AcceptQuoteRequest as internalAcceptQuoteReq } from '../model/AcceptQuoteRequest';
32
+ import { AcceptQuoteResponse as internalAcceptQuoteResp } from '../model/AcceptQuoteResponse';
30
33
  export type GetOrderRequest = {
31
34
  portfolioId: string;
32
35
  orderId: string;
@@ -75,3 +78,11 @@ export type CreateOrderRequest = internalCreate & {
75
78
  portfolioId: string;
76
79
  };
77
80
  export type CreateOrderResponse = internalCreateResp;
81
+ export type CreateQuoteRequest = internalCreate & {
82
+ portfolioId: string;
83
+ };
84
+ export type CreateQuoteResponse = QuoteResponse;
85
+ export type AcceptQuoteRequest = internalAcceptQuoteReq & {
86
+ portfolioId: string;
87
+ };
88
+ export type AcceptQuoteResponse = internalAcceptQuoteResp;
@@ -16,16 +16,16 @@
16
16
  import { CoinbaseCallOptions } from '@coinbase-sample/core-ts';
17
17
  import { CoinbasePrimeClient } from '../client';
18
18
  import { CoinbasePrimeClientException, CoinbasePrimeException } from '../errors';
19
- import { GetPortfolioRequest, GetPortfolioResponse, GetPortfolioCreditRequest, GetPortfolioCreditResponse, ListPortfoliosResponse } from './types';
19
+ import { GetPortfolioRequest, GetPortfolioResponse, GetPortfolioCreditRequest, GetPortfolioCreditResponse, ListPortfoliosResponse, ListPortfoliosRequest } from './types';
20
20
  export interface IPortfoliosService {
21
21
  getPortfolio(request: GetPortfolioRequest, options?: CoinbaseCallOptions): Promise<GetPortfolioResponse | CoinbasePrimeClientException | CoinbasePrimeException>;
22
22
  getPortfolioCredit(request: GetPortfolioCreditRequest, options?: CoinbaseCallOptions): Promise<GetPortfolioCreditResponse | CoinbasePrimeClientException | CoinbasePrimeException>;
23
- listPortfolios(options?: CoinbaseCallOptions): Promise<ListPortfoliosResponse | CoinbasePrimeClientException | CoinbasePrimeException>;
23
+ listPortfolios(request: ListPortfoliosRequest, options?: CoinbaseCallOptions): Promise<ListPortfoliosResponse | CoinbasePrimeClientException | CoinbasePrimeException>;
24
24
  }
25
25
  export declare class PortfoliosService implements IPortfoliosService {
26
26
  private client;
27
27
  constructor(client: CoinbasePrimeClient);
28
28
  getPortfolio(request: GetPortfolioRequest, options?: CoinbaseCallOptions): Promise<GetPortfolioResponse>;
29
29
  getPortfolioCredit(request: GetPortfolioCreditRequest, options?: CoinbaseCallOptions): Promise<GetPortfolioCreditResponse>;
30
- listPortfolios(options?: CoinbaseCallOptions): Promise<ListPortfoliosResponse>;
30
+ listPortfolios(request?: ListPortfoliosRequest, options?: CoinbaseCallOptions): Promise<ListPortfoliosResponse>;
31
31
  }
@@ -32,7 +32,7 @@ class PortfoliosService {
32
32
  return response.data;
33
33
  });
34
34
  }
35
- listPortfolios(options) {
35
+ listPortfolios(request, options) {
36
36
  return __awaiter(this, void 0, void 0, function* () {
37
37
  const response = yield this.client.request({
38
38
  url: `portfolios`,
@@ -23,6 +23,7 @@ export type GetPortfolioRequest = {
23
23
  portfolioId: string;
24
24
  };
25
25
  export type GetPortfolioResponse = internalGet;
26
+ export type ListPortfoliosRequest = Record<string, never>;
26
27
  export type ListPortfoliosResponse = GetPortfoliosResponse;
27
28
  export type GetPortfolioCreditRequest = {
28
29
  portfolioId: string;
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Copyright 2025-present Coinbase Global, Inc.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import { CoinbaseCallOptions } from '@coinbase-sample/core-ts';
17
+ import { CoinbasePrimeClient } from '../client';
18
+ import { CoinbasePrimeClientException, CoinbasePrimeException } from '../errors';
19
+ import { ListAggregateEntityPositionsRequest, ListAggregateEntityPositionsResponse, ListEntityPositionsRequest, ListEntityPositionsResponse } from './types';
20
+ export interface IPositionsService {
21
+ listAggregateEntityPositions(request: ListAggregateEntityPositionsRequest, options?: CoinbaseCallOptions): Promise<ListAggregateEntityPositionsResponse | CoinbasePrimeClientException | CoinbasePrimeException>;
22
+ listEntityPositions(request: ListEntityPositionsRequest, options?: CoinbaseCallOptions): Promise<ListEntityPositionsResponse | CoinbasePrimeClientException | CoinbasePrimeException>;
23
+ }
24
+ export declare class PositionsService implements IPositionsService {
25
+ private client;
26
+ constructor(client: CoinbasePrimeClient);
27
+ listAggregateEntityPositions(request: ListAggregateEntityPositionsRequest, options?: CoinbaseCallOptions): Promise<ListAggregateEntityPositionsResponse | CoinbasePrimeClientException | CoinbasePrimeException>;
28
+ listEntityPositions(request: ListEntityPositionsRequest, options?: CoinbaseCallOptions): Promise<ListEntityPositionsResponse | CoinbasePrimeClientException | CoinbasePrimeException>;
29
+ }
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.PositionsService = void 0;
13
+ class PositionsService {
14
+ constructor(client) {
15
+ this.client = client;
16
+ }
17
+ listAggregateEntityPositions(request, options) {
18
+ return __awaiter(this, void 0, void 0, function* () {
19
+ const queryParams = Object.assign(Object.assign({}, request), { entityId: undefined });
20
+ const response = yield this.client.request({
21
+ url: `portfolios/${request.entityId}/aggregate_positions`,
22
+ callOptions: options,
23
+ queryParams,
24
+ });
25
+ return response.data;
26
+ });
27
+ }
28
+ listEntityPositions(request, options) {
29
+ return __awaiter(this, void 0, void 0, function* () {
30
+ const queryParams = Object.assign(Object.assign({}, request), { entityId: undefined });
31
+ const response = yield this.client.request({
32
+ url: `portfolios/${request.entityId}/positions`,
33
+ callOptions: options,
34
+ queryParams,
35
+ });
36
+ return response.data;
37
+ });
38
+ }
39
+ }
40
+ exports.PositionsService = PositionsService;
@@ -0,0 +1,14 @@
1
+ import { ListAggregateEntityPositionsResponse as ListAggregateEntityPositionsInt } from '../model/ListAggregateEntityPositionsResponse';
2
+ import { ListEntityPositionsResponse as ListEntityPositionsInt } from '../model/ListEntityPositionsResponse';
3
+ export type ListAggregateEntityPositionsRequest = {
4
+ entityId: string;
5
+ cursor?: string;
6
+ limit?: number;
7
+ };
8
+ export type ListAggregateEntityPositionsResponse = ListAggregateEntityPositionsInt;
9
+ export type ListEntityPositionsRequest = {
10
+ entityId: string;
11
+ cursor?: string;
12
+ limit?: number;
13
+ };
14
+ export type ListEntityPositionsResponse = ListEntityPositionsInt;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -16,12 +16,14 @@
16
16
  import { CoinbaseCallOptions } from '@coinbase-sample/core-ts';
17
17
  import { CoinbasePrimeClient } from '../client';
18
18
  import { CoinbasePrimeClientException, CoinbasePrimeException } from '../errors';
19
- import { ListWalletsRequest, ListWalletsResponse, GetWalletRequest, GetWalletResponse, GetWalletDepositInstructionsRequest, GetWalletDepositInstructionsResponse, CreateWalletRequest, CreateWalletResponse } from './types';
19
+ import { ListWalletsRequest, ListWalletsResponse, GetWalletRequest, GetWalletResponse, GetWalletDepositInstructionsRequest, GetWalletDepositInstructionsResponse, ListWalletAddressesRequest, ListWalletAddressesResponse, CreateWalletRequest, CreateWalletResponse, CreateWalletDepositAddressRequest, CreateWalletDepositAddressResponse } from './types';
20
20
  export interface IWalletsService {
21
21
  listWallets(request: ListWalletsRequest, options?: CoinbaseCallOptions): Promise<ListWalletsResponse | CoinbasePrimeClientException | CoinbasePrimeException>;
22
22
  getWallet(request: GetWalletRequest, options?: CoinbaseCallOptions): Promise<GetWalletResponse | CoinbasePrimeClientException | CoinbasePrimeException>;
23
23
  getWalletDepositInstructions(request: GetWalletDepositInstructionsRequest, options?: CoinbaseCallOptions): Promise<GetWalletDepositInstructionsResponse | CoinbasePrimeClientException | CoinbasePrimeException>;
24
+ listWalletAddresses(request: ListWalletAddressesRequest, options?: CoinbaseCallOptions): Promise<ListWalletAddressesResponse | CoinbasePrimeClientException | CoinbasePrimeException>;
24
25
  createWallet(request: CreateWalletRequest, options?: CoinbaseCallOptions): Promise<CreateWalletResponse | CoinbasePrimeClientException | CoinbasePrimeException>;
26
+ createWalletDepositAddress(request: CreateWalletDepositAddressRequest, options?: CoinbaseCallOptions): Promise<CreateWalletDepositAddressResponse | CoinbasePrimeClientException | CoinbasePrimeException>;
25
27
  }
26
28
  export declare class WalletsService implements IWalletsService {
27
29
  private client;
@@ -29,5 +31,7 @@ export declare class WalletsService implements IWalletsService {
29
31
  listWallets(request: ListWalletsRequest, options?: CoinbaseCallOptions): Promise<ListWalletsResponse | CoinbasePrimeClientException | CoinbasePrimeException>;
30
32
  getWallet(request: GetWalletRequest, options?: CoinbaseCallOptions): Promise<GetWalletResponse | CoinbasePrimeClientException | CoinbasePrimeException>;
31
33
  getWalletDepositInstructions(request: GetWalletDepositInstructionsRequest, options?: CoinbaseCallOptions): Promise<GetWalletDepositInstructionsResponse | CoinbasePrimeClientException | CoinbasePrimeException>;
34
+ listWalletAddresses(request: ListWalletAddressesRequest, options?: CoinbaseCallOptions): Promise<ListWalletAddressesResponse | CoinbasePrimeClientException | CoinbasePrimeException>;
32
35
  createWallet(request: CreateWalletRequest, options?: CoinbaseCallOptions): Promise<CreateWalletResponse | CoinbasePrimeClientException | CoinbasePrimeException>;
36
+ createWalletDepositAddress(request: CreateWalletDepositAddressRequest, options?: CoinbaseCallOptions): Promise<CreateWalletDepositAddressResponse | CoinbasePrimeClientException | CoinbasePrimeException>;
33
37
  }
@@ -50,9 +50,42 @@ class WalletsService {
50
50
  }
51
51
  getWalletDepositInstructions(request, options) {
52
52
  return __awaiter(this, void 0, void 0, function* () {
53
+ let queryParams = {
54
+ depositType: request.depositType,
55
+ };
56
+ if (request.networkType) {
57
+ queryParams['network.type'] = request.networkType;
58
+ }
59
+ if (request.networkId) {
60
+ queryParams['network.id'] = request.networkId;
61
+ }
53
62
  const response = yield this.client.request({
54
63
  url: `portfolios/${request.portfolioId}/wallets/${request.walletId}/deposit_instructions`,
55
64
  callOptions: options,
65
+ queryParams,
66
+ });
67
+ return response.data;
68
+ });
69
+ }
70
+ listWalletAddresses(request, options) {
71
+ return __awaiter(this, void 0, void 0, function* () {
72
+ let queryParams = {};
73
+ if (request.networkId) {
74
+ queryParams['network.id'] = request.networkId;
75
+ }
76
+ if (request.networkType) {
77
+ queryParams['network.type'] = request.networkType;
78
+ }
79
+ if (request.cursor) {
80
+ queryParams.cursor = request.cursor;
81
+ }
82
+ if (request.limit) {
83
+ queryParams.limit = request.limit;
84
+ }
85
+ const response = yield this.client.request({
86
+ url: `portfolios/${request.portfolioId}/wallets/${request.walletId}/addresses`,
87
+ queryParams,
88
+ callOptions: options,
56
89
  });
57
90
  return response.data;
58
91
  });
@@ -69,5 +102,23 @@ class WalletsService {
69
102
  return response.data;
70
103
  });
71
104
  }
105
+ createWalletDepositAddress(request, options) {
106
+ return __awaiter(this, void 0, void 0, function* () {
107
+ let queryParams = {};
108
+ if (request.networkId) {
109
+ queryParams['network.id'] = request.networkId;
110
+ }
111
+ if (request.networkType) {
112
+ queryParams['network.type'] = request.networkType;
113
+ }
114
+ const response = yield this.client.request({
115
+ url: `portfolios/${request.portfolioId}/wallets/${request.walletId}/addresses`,
116
+ queryParams,
117
+ method: core_ts_1.Method.POST,
118
+ callOptions: options,
119
+ });
120
+ return response.data;
121
+ });
122
+ }
72
123
  }
73
124
  exports.WalletsService = WalletsService;
@@ -17,9 +17,12 @@ import { WalletType } from '../model/enums/WalletType';
17
17
  import { Pagination } from '../shared/pagination';
18
18
  import { GetWalletsResponse } from '../model/GetWalletsResponse';
19
19
  import { GetWalletResponse as internalGet } from '../model/GetWalletResponse';
20
+ import { GetWalletAddressesResponse as internalGetAddresses } from '../model/GetWalletAddressesResponse';
20
21
  import { GetWalletDepositInstructionsResponse as internalGetInstructs } from '../model/GetWalletDepositInstructionsResponse';
21
22
  import { CreateWalletRequest as internalCreate } from '../model/CreateWalletRequest';
22
23
  import { CreateWalletResponse as internalCreateResp } from '../model/CreateWalletResponse';
24
+ import { BlockchainAddress } from '../model/BlockchainAddress';
25
+ import { WalletDepositInstructionType } from '../model/enums/WalletDepositInstructionType';
23
26
  export type ListWalletsRequest = Pagination & {
24
27
  portfolioId: string;
25
28
  type: WalletType;
@@ -34,9 +37,28 @@ export type GetWalletResponse = internalGet;
34
37
  export type GetWalletDepositInstructionsRequest = {
35
38
  portfolioId: string;
36
39
  walletId: string;
40
+ depositType: WalletDepositInstructionType;
41
+ networkId?: string;
42
+ networkType?: string;
37
43
  };
38
44
  export type GetWalletDepositInstructionsResponse = internalGetInstructs;
45
+ export type ListWalletAddressesRequest = {
46
+ portfolioId: string;
47
+ walletId: string;
48
+ networkId?: string;
49
+ networkType?: string;
50
+ cursor?: string;
51
+ limit?: number;
52
+ };
53
+ export type ListWalletAddressesResponse = internalGetAddresses;
39
54
  export type CreateWalletRequest = internalCreate & {
40
55
  portfolioId: string;
41
56
  };
42
57
  export type CreateWalletResponse = internalCreateResp;
58
+ export type CreateWalletDepositAddressRequest = {
59
+ portfolioId: string;
60
+ walletId: string;
61
+ networkId?: string;
62
+ networkType?: string;
63
+ };
64
+ export type CreateWalletDepositAddressResponse = BlockchainAddress;
package/package.json CHANGED
@@ -1,14 +1,15 @@
1
1
  {
2
2
  "name": "@coinbase-sample/prime-sdk-ts",
3
- "version": "0.2.0",
4
- "main": "dist/main.js",
3
+ "version": "0.3.0",
4
+ "main": "dist/index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",
7
7
  "build": "tsc",
8
8
  "lint": "eslint . --ext .js,.ts",
9
9
  "format": "prettier --write \"**/*.{js,ts,tsx,json,css,md}\"",
10
10
  "gen-types": "openapi-generator-cli generate -i apiSpec/prime-public-api-spec.json -g typescript-node --global-property models -o apiSpec/types --additional-properties=supportsES6=true --additional-properties=snapshot=true && cd apiSpec && node generateTypes.js",
11
- "replace-model": "rm -r src/model && cp -r apiSpec/types/processed src/model"
11
+ "replace-model": "rm -r src/model && cp -r apiSpec/types/processed src/model",
12
+ "update-spec": "npm run gen-types && npm run replace-model"
12
13
  },
13
14
  "files": [
14
15
  "dist/"
@@ -22,15 +23,15 @@
22
23
  "license": "ISC",
23
24
  "description": "",
24
25
  "devDependencies": {
25
- "@types/node": "^20",
26
- "@typescript-eslint/eslint-plugin": "^8.18.0",
27
- "@typescript-eslint/parser": "^8.18.0",
26
+ "@types/node": "^22.14.0",
27
+ "@typescript-eslint/eslint-plugin": "^8.29.1",
28
+ "@typescript-eslint/parser": "^8.29.1",
28
29
  "dotenv": "^16.4.5",
29
- "eslint": "^9.17.0",
30
- "eslint-config-prettier": "^9.1.0",
31
- "eslint-plugin-prettier": "^5.2.1",
32
- "prettier": "^3.4.2",
33
- "typescript": "^5.5.4"
30
+ "eslint": "^9.24.0",
31
+ "eslint-config-prettier": "^10.1.1",
32
+ "eslint-plugin-prettier": "^5.2.6",
33
+ "prettier": "^3.5.3",
34
+ "typescript": "^5.8.3"
34
35
  },
35
36
  "dependencies": {
36
37
  "@coinbase-sample/core-ts": "^0.1.0"