@coinbase-sample/prime-sdk-ts 0.6.1 → 0.6.3

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 (64) hide show
  1. package/README.md +207 -67
  2. package/dist/activities/index.js +21 -39
  3. package/dist/addressBooks/index.js +18 -5
  4. package/dist/allocations/index.js +19 -18
  5. package/dist/balances/index.js +23 -17
  6. package/dist/client-manual.js +84 -0
  7. package/dist/client-modular.js +57 -0
  8. package/dist/client-only.js +31 -0
  9. package/dist/{client.js → clients/client.js} +12 -2
  10. package/dist/clients/clientWithServices.js +323 -0
  11. package/dist/{types/client.d.ts → clients/clientWithServicesTypes.js} +3 -6
  12. package/dist/clients/index.js +28 -0
  13. package/dist/clients/types.js +2 -0
  14. package/dist/constants.js +1 -1
  15. package/dist/financing/index.js +16 -3
  16. package/dist/futures/index.js +4 -4
  17. package/dist/index.js +27 -18
  18. package/dist/invoices/index.js +16 -12
  19. package/dist/onchainAddressBook/index.js +4 -4
  20. package/dist/orders/index.js +38 -58
  21. package/dist/positions/index.js +21 -6
  22. package/dist/products/index.js +16 -3
  23. package/dist/services.js +75 -0
  24. package/dist/shared/envUtils.js +66 -0
  25. package/dist/shared/paginatedResponse.js +3 -0
  26. package/dist/staking/index.js +5 -5
  27. package/dist/transactions/index.js +26 -17
  28. package/dist/types/activities/index.d.ts +2 -3
  29. package/dist/types/addressBooks/index.d.ts +2 -3
  30. package/dist/types/allocations/index.d.ts +2 -3
  31. package/dist/types/assets/index.d.ts +2 -3
  32. package/dist/types/balances/index.d.ts +2 -3
  33. package/dist/types/client-manual.d.ts +58 -0
  34. package/dist/types/client-modular.d.ts +39 -0
  35. package/dist/types/client-only.d.ts +18 -0
  36. package/dist/types/clients/client.d.ts +27 -0
  37. package/dist/types/clients/clientWithServices.d.ts +229 -0
  38. package/dist/types/clients/clientWithServicesTypes.d.ts +115 -0
  39. package/dist/types/clients/index.d.ts +19 -0
  40. package/dist/types/clients/types.d.ts +48 -0
  41. package/dist/types/commission/index.d.ts +2 -3
  42. package/dist/types/constants.d.ts +1 -1
  43. package/dist/types/financing/index.d.ts +2 -3
  44. package/dist/types/futures/index.d.ts +2 -3
  45. package/dist/types/index.d.ts +2 -1
  46. package/dist/types/invoices/index.d.ts +2 -3
  47. package/dist/types/onchainAddressBook/index.d.ts +2 -3
  48. package/dist/types/orders/index.d.ts +2 -3
  49. package/dist/types/paymentMethods/index.d.ts +2 -3
  50. package/dist/types/portfolios/index.d.ts +2 -3
  51. package/dist/types/positions/index.d.ts +2 -3
  52. package/dist/types/products/index.d.ts +2 -3
  53. package/dist/types/services.d.ts +39 -0
  54. package/dist/types/shared/envUtils.d.ts +36 -0
  55. package/dist/types/shared/paginatedResponse.d.ts +5 -4
  56. package/dist/types/staking/index.d.ts +2 -3
  57. package/dist/types/transactions/index.d.ts +2 -3
  58. package/dist/types/types.d.ts +37 -0
  59. package/dist/types/users/index.d.ts +2 -3
  60. package/dist/types/wallets/index.d.ts +2 -3
  61. package/dist/types.js +39 -0
  62. package/dist/users/index.js +21 -6
  63. package/dist/wallets/index.js +24 -12
  64. package/package.json +32 -1
@@ -8,6 +8,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
9
  });
10
10
  };
11
+ var __rest = (this && this.__rest) || function (s, e) {
12
+ var t = {};
13
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
14
+ t[p] = s[p];
15
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
16
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
17
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
18
+ t[p[i]] = s[p[i]];
19
+ }
20
+ return t;
21
+ };
11
22
  Object.defineProperty(exports, "__esModule", { value: true });
12
23
  exports.TransactionsService = void 0;
13
24
  /**
@@ -25,7 +36,7 @@ exports.TransactionsService = void 0;
25
36
  * See the License for the specific language governing permissions and
26
37
  * limitations under the License.
27
38
  */
28
- const core_ts_1 = require("@coinbase-sample/core-ts");
39
+ const clients_1 = require("../clients");
29
40
  const paginatedResponse_1 = require("../shared/paginatedResponse");
30
41
  class TransactionsService {
31
42
  constructor(client) {
@@ -42,13 +53,12 @@ class TransactionsService {
42
53
  }
43
54
  listPortfolioTransactions(request, options) {
44
55
  return __awaiter(this, void 0, void 0, function* () {
45
- const queryParams = Object.assign(Object.assign({}, request), { portfolioId: undefined });
46
- if (!queryParams.limit) {
47
- queryParams.limit = this.client.getDefaultPaginationLimit();
48
- }
56
+ const paginationParams = (0, paginatedResponse_1.getQueryParams)(this.client, request);
57
+ const { limit, cursor, sortDirection, portfolioId } = request, queryParams = __rest(request, ["limit", "cursor", "sortDirection", "portfolioId"]);
58
+ const finalQueryParams = Object.assign(Object.assign({}, paginationParams), queryParams);
49
59
  const response = yield this.client.request({
50
- url: `portfolios/${request.portfolioId}/transactions`,
51
- queryParams,
60
+ url: `portfolios/${portfolioId}/transactions`,
61
+ queryParams: finalQueryParams,
52
62
  callOptions: options,
53
63
  });
54
64
  const responseData = response.data;
@@ -60,13 +70,12 @@ class TransactionsService {
60
70
  }
61
71
  listWalletTransactions(request, options) {
62
72
  return __awaiter(this, void 0, void 0, function* () {
63
- const queryParams = Object.assign(Object.assign({}, request), { portfolioId: undefined, walletId: undefined });
64
- if (!queryParams.limit) {
65
- queryParams.limit = this.client.getDefaultPaginationLimit();
66
- }
73
+ const paginationParams = (0, paginatedResponse_1.getQueryParams)(this.client, request);
74
+ const { limit, cursor, sortDirection, portfolioId, walletId } = request, queryParams = __rest(request, ["limit", "cursor", "sortDirection", "portfolioId", "walletId"]);
75
+ const finalQueryParams = Object.assign(Object.assign({}, paginationParams), queryParams);
67
76
  const response = yield this.client.request({
68
- url: `portfolios/${request.portfolioId}/wallets/${request.walletId}/transactions`,
69
- queryParams,
77
+ url: `portfolios/${portfolioId}/wallets/${walletId}/transactions`,
78
+ queryParams: finalQueryParams,
70
79
  callOptions: options,
71
80
  });
72
81
  const responseData = response.data;
@@ -82,7 +91,7 @@ class TransactionsService {
82
91
  const response = yield this.client.request({
83
92
  url: `portfolios/${request.portfolioId}/wallets/${request.walletId}/conversion`,
84
93
  bodyParams,
85
- method: core_ts_1.Method.POST,
94
+ method: clients_1.Method.POST,
86
95
  callOptions: options,
87
96
  });
88
97
  return response.data;
@@ -94,7 +103,7 @@ class TransactionsService {
94
103
  const response = yield this.client.request({
95
104
  url: `portfolios/${request.portfolioId}/wallets/${request.walletId}/transfers`,
96
105
  bodyParams,
97
- method: core_ts_1.Method.POST,
106
+ method: clients_1.Method.POST,
98
107
  callOptions: options,
99
108
  });
100
109
  return response.data;
@@ -106,7 +115,7 @@ class TransactionsService {
106
115
  const response = yield this.client.request({
107
116
  url: `portfolios/${request.portfolioId}/wallets/${request.walletId}/withdrawals`,
108
117
  bodyParams,
109
- method: core_ts_1.Method.POST,
118
+ method: clients_1.Method.POST,
110
119
  callOptions: options,
111
120
  });
112
121
  return response.data;
@@ -118,7 +127,7 @@ class TransactionsService {
118
127
  const response = yield this.client.request({
119
128
  url: `portfolios/${request.portfolioId}/wallets/${request.walletId}/onchain_transaction`,
120
129
  bodyParams,
121
- method: core_ts_1.Method.POST,
130
+ method: clients_1.Method.POST,
122
131
  callOptions: options,
123
132
  });
124
133
  return response.data;
@@ -13,8 +13,7 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { CoinbaseCallOptions } from '@coinbase-sample/core-ts';
17
- import { CoinbasePrimeClient } from '../client';
16
+ import { IPrimeApiClient, CoinbaseCallOptions } from '../clients';
18
17
  import { GetActivityRequest, GetActivityResponse, GetPortfolioActivitiesRequest, GetPortfolioActivityResponse, ListPortfolioActivitiesRequest, ListPortfolioActivitiesResponse, ListEntityActivitiesRequest, ListEntityActivitiesResponse } from './types';
19
18
  export interface IActivitiesService {
20
19
  getActivity(request: GetActivityRequest): Promise<GetActivityResponse>;
@@ -24,7 +23,7 @@ export interface IActivitiesService {
24
23
  }
25
24
  export declare class ActivitiesService implements IActivitiesService {
26
25
  private client;
27
- constructor(client: CoinbasePrimeClient);
26
+ constructor(client: IPrimeApiClient);
28
27
  getActivity(request: GetActivityRequest, options?: CoinbaseCallOptions): Promise<GetActivityResponse>;
29
28
  getPortfolioActivity(request: GetPortfolioActivitiesRequest, options?: CoinbaseCallOptions): Promise<GetPortfolioActivityResponse>;
30
29
  listEntityActivities(request: ListEntityActivitiesRequest, options?: CoinbaseCallOptions): Promise<ListEntityActivitiesResponse>;
@@ -13,8 +13,7 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { CoinbaseCallOptions } from '@coinbase-sample/core-ts';
17
- import { CoinbasePrimeClient } from '../client';
16
+ import { CoinbaseCallOptions, IPrimeApiClient } from '../clients';
18
17
  import { ListAddressBooksRequest, ListAddressBooksResponse, CreateAddressBookRequest, CreateAddressBookResponse } from './types';
19
18
  export interface IAddressBooksService {
20
19
  listAddressBooks(request: ListAddressBooksRequest, options?: CoinbaseCallOptions): Promise<ListAddressBooksResponse>;
@@ -22,7 +21,7 @@ export interface IAddressBooksService {
22
21
  }
23
22
  export declare class AddressBooksService implements IAddressBooksService {
24
23
  private client;
25
- constructor(client: CoinbasePrimeClient);
24
+ constructor(client: IPrimeApiClient);
26
25
  listAddressBooks(request: ListAddressBooksRequest, options?: CoinbaseCallOptions): Promise<ListAddressBooksResponse>;
27
26
  createAddressBook(request: CreateAddressBookRequest, options?: CoinbaseCallOptions): Promise<CreateAddressBookResponse>;
28
27
  }
@@ -13,8 +13,7 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { CoinbaseCallOptions } from '@coinbase-sample/core-ts';
17
- import { CoinbasePrimeClient } from '../client';
16
+ import { CoinbaseCallOptions, IPrimeApiClient } from '../clients';
18
17
  import { CreateAllocationRequest, CreateAllocationResponse, CreateNetAllocationRequest, CreateNetAllocationResponse, ListPortfolioAllocationsRequest, ListPortfolioAllocationsResponse, ListNetAllocationsRequest, ListNetAllocationsResponse, GetAllocationRequest, GetAllocationResponse } from './types';
19
18
  export interface IAllocationService {
20
19
  createAllocation(request: CreateAllocationRequest, options?: CoinbaseCallOptions): Promise<CreateAllocationResponse>;
@@ -25,7 +24,7 @@ export interface IAllocationService {
25
24
  }
26
25
  export declare class AllocationService implements IAllocationService {
27
26
  private client;
28
- constructor(client: CoinbasePrimeClient);
27
+ constructor(client: IPrimeApiClient);
29
28
  createAllocation(request: CreateAllocationRequest, options?: CoinbaseCallOptions): Promise<CreateAllocationResponse>;
30
29
  createNetAllocation(request: CreateNetAllocationRequest, options?: CoinbaseCallOptions): Promise<CreateNetAllocationResponse>;
31
30
  listPortfolioAllocations(request: ListPortfolioAllocationsRequest, options?: CoinbaseCallOptions): Promise<ListPortfolioAllocationsResponse>;
@@ -13,14 +13,13 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { CoinbaseCallOptions } from '@coinbase-sample/core-ts';
17
- import { CoinbasePrimeClient } from '../client';
16
+ import { IPrimeApiClient, CoinbaseCallOptions } from '../clients';
18
17
  import { ListAssetsRequest, ListAssetsResponse } from './types';
19
18
  export interface IAssetsService {
20
19
  listAssets(request: ListAssetsRequest, options?: CoinbaseCallOptions): Promise<ListAssetsResponse>;
21
20
  }
22
21
  export declare class AssetsService implements IAssetsService {
23
22
  private client;
24
- constructor(client: CoinbasePrimeClient);
23
+ constructor(client: IPrimeApiClient);
25
24
  listAssets(request: ListAssetsRequest, options?: CoinbaseCallOptions): Promise<ListAssetsResponse>;
26
25
  }
@@ -13,8 +13,7 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { CoinbaseCallOptions } from '@coinbase-sample/core-ts';
17
- import { CoinbasePrimeClient } from '../client';
16
+ import { CoinbaseCallOptions, IPrimeApiClient } from '../clients';
18
17
  import { GetWalletBalanceRequest, GetWalletBalanceResponse, ListOnchainWalletBalancesRequest, ListOnchainWalletBalancesResponse, ListPortfolioBalancesRequest, ListPortfolioBalancesResponse, ListEntityBalancesRequest, ListEntityBalancesResponse } from './types';
19
18
  export interface IBalancesService {
20
19
  listPortfolioBalances(request: ListPortfolioBalancesRequest, options?: CoinbaseCallOptions): Promise<ListPortfolioBalancesResponse>;
@@ -24,7 +23,7 @@ export interface IBalancesService {
24
23
  }
25
24
  export declare class BalancesService implements IBalancesService {
26
25
  private client;
27
- constructor(client: CoinbasePrimeClient);
26
+ constructor(client: IPrimeApiClient);
28
27
  listPortfolioBalances(request: ListPortfolioBalancesRequest, options?: CoinbaseCallOptions): Promise<ListPortfolioBalancesResponse>;
29
28
  getWalletBalance(request: GetWalletBalanceRequest, options?: CoinbaseCallOptions): Promise<GetWalletBalanceResponse>;
30
29
  listOnchainWalletBalances(request: ListOnchainWalletBalancesRequest, options?: CoinbaseCallOptions): Promise<ListOnchainWalletBalancesResponse>;
@@ -0,0 +1,58 @@
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
+ export { IPrimeApiClient, CoinbasePrimeClient, CoinbasePrimeClientConfig, CoinbaseClient, CoinbaseHttpClientRetryOptions, CoinbaseCallOptions, Method, CoinbaseClientException, CoinbaseError, CoinbaseResponse, TransformRequestFn, TransformResponseFn, } from './clients';
17
+ export { CoinbasePrimeCredentials } from './credentials';
18
+ export { createCredentialsFromEnv } from './shared/envUtils';
19
+ export { ActivitiesService, IActivitiesService } from './activities';
20
+ export { AddressBooksService, IAddressBooksService } from './addressBooks';
21
+ export { AllocationService, IAllocationService } from './allocations';
22
+ export { AssetsService, IAssetsService } from './assets';
23
+ export { BalancesService, IBalancesService } from './balances';
24
+ export { CommissionService, ICommissionService } from './commission';
25
+ export { FinancingService, IFinancingService } from './financing';
26
+ export { FuturesService, IFuturesService } from './futures';
27
+ export { InvoicesService, IInvoicesService } from './invoices';
28
+ export { OnchainAddressBookService } from './onchainAddressBook';
29
+ export { OrdersService, IOrdersService } from './orders';
30
+ export { PaymentMethodsService, IPaymentMethodsService, } from './paymentMethods';
31
+ export { PortfoliosService, IPortfoliosService } from './portfolios';
32
+ export { PositionsService, IPositionsService } from './positions';
33
+ export { ProductsService, IProductsService } from './products';
34
+ export { StakingService, IStakingService } from './staking';
35
+ export { TransactionsService, ITransactionsService } from './transactions';
36
+ export { UsersService, IUsersService } from './users';
37
+ export { WalletsService, IWalletsService } from './wallets';
38
+ export type * from './model/';
39
+ export * from './model/enums/';
40
+ export type { GetActivityRequest, GetActivityResponse, GetPortfolioActivitiesRequest, GetPortfolioActivityResponse, ListEntityActivitiesRequest, ListEntityActivitiesResponse, ListPortfolioActivitiesRequest, ListPortfolioActivitiesResponse, } from './activities/types';
41
+ export type { CreateAddressBookRequest, CreateAddressBookResponse, ListAddressBooksRequest, ListAddressBooksResponse, } from './addressBooks/types';
42
+ export type { CreateAllocationRequest, CreateAllocationResponse, CreateNetAllocationRequest, CreateNetAllocationResponse, ListNetAllocationsRequest, ListNetAllocationsResponse, ListPortfolioAllocationsRequest, ListPortfolioAllocationsResponse, GetAllocationRequest, GetAllocationResponse, } from './allocations/types';
43
+ export type { ListAssetsRequest, ListAssetsResponse } from './assets/types';
44
+ export type { GetWalletBalanceRequest, GetWalletBalanceResponse, ListOnchainWalletBalancesRequest, ListOnchainWalletBalancesResponse, ListPortfolioBalancesRequest, ListPortfolioBalancesResponse, ListEntityBalancesRequest, ListEntityBalancesResponse, } from './balances/types';
45
+ export type { GetPortfolioCommissionRequest, GetPortfolioCommissionResponse, } from './commission/types';
46
+ export type { AcceptQuoteRequest, AcceptQuoteResponse, CancelOrderRequest, CancelOrderResponse, CreateOrderPreviewRequest, CreateOrderPreviewResponse, CreateOrderRequest, CreateOrderResponse, CreateQuoteRequest, CreateQuoteResponse, GetOrderRequest, GetOrderResponse, GetOrderEditHistoryRequest, GetOrderEditHistoryResponse, ListOpenOrdersRequest, ListOpenOrdersResponse, ListOrderFillsRequest, ListOrderFillsResponse, ListPortfolioFillsRequest, ListPortfolioFillsResponse, ListPortfolioOrdersRequest, ListPortfolioOrdersResponse, } from './orders/types';
47
+ export type { ListExistingLocatesRequest, ListExistingLocatesResponse, ListInterestAccrualsRequest, ListInterestAccrualsResponse, ListPortfolioInterestAccrualsRequest, ListPortfolioInterestAccrualsResponse, ListMarginCallSummariesRequest, ListMarginCallSummariesResponse, ListMarginConversionsRequest, ListMarginConversionsResponse, GetEntityLocateAvailabilitiesRequest, GetEntityLocateAvailabilitiesResponse, GetMarginInformationRequest, GetMarginInformationResponse, GetPortfolioBuyingPowerRequest, GetPortfolioBuyingPowerResponse, GetPortfolioCreditInformationRequest, GetPortfolioCreditInformationResponse, GetPortfolioWithdrawalPowerRequest, GetPortfolioWithdrawalPowerResponse, GetFcmMarginCallDetailsRequest, GetFcmMarginCallDetailsResponse, GetFcmRiskLimitsRequest, GetFcmRiskLimitsResponse, GetTieredPricingFeesRequest, GetTieredPricingFeesResponse, CreateNewLocatesRequest, CreateNewLocatesResponse, } from './financing/types';
48
+ export type { CancelEntitySweepRequest, CancelEntitySweepResponse, GetEntityFuturesBalanceRequest, GetEntityFuturesBalanceResponse, GetEntityFuturesPositionsRequest, GetEntityFuturesPositionsResponse, ListEntityFuturesSweepsRequest, ListEntityFuturesSweepsResponse, ScheduleEntityFuturesSweepRequest, ScheduleEntityFuturesSweepResponse, UpdateEntityFuturesAutoSweepRequest, UpdateEntityFuturesAutoSweepResponse, } from './futures/types';
49
+ export type { ListInvoicesRequest, ListInvoicesResponse, } from './invoices/types';
50
+ export type { CreateOnchainAddressBookEntryRequest, CreateOnchainAddressBookEntryResponse, DeleteOnchainAddressBookEntryRequest, DeleteOnchainAddressBookEntryResponse, ListOnchainAddressBookRequest, ListOnchainAddressBookResponse, UpdateOnchainAddressBookEntryRequest, UpdateOnchainAddressBookEntryResponse, } from './onchainAddressBook/types';
51
+ export type { GetPaymentMethodRequest, GetPaymentMethodResponse, ListEntityPaymentMethodsRequest, ListEntityPaymentMethodsResponse, } from './paymentMethods/types';
52
+ export type { ListPortfoliosRequest, ListPortfoliosResponse, GetPortfolioCreditRequest, GetPortfolioCreditResponse, GetPortfolioRequest, GetPortfolioResponse, GetCounterpartyIdRequest, GetCounterpartyIdResponse, } from './portfolios/types';
53
+ export type { ListAggregateEntityPositionsRequest, ListAggregateEntityPositionsResponse, ListEntityPositionsRequest, ListEntityPositionsResponse, } from './positions/types';
54
+ export type { ListProductsRequest, ListProductsResponse, } from './products/types';
55
+ export type { CreateStakeRequest, CreateStakeResponse, CreateUnstakeRequest, CreateUnstakeResponse, CreatePortfolioStakeRequest, CreatePortfolioStakeResponse, CreatePortfolioUnstakeRequest, CreatePortfolioUnstakeResponse, } from './staking/types';
56
+ export type { CreateConversionRequest, CreateConversionResponse, CreateOnchainTransactionRequest, CreateOnchainTransactionResponse, CreateTransferRequest, CreateTransferResponse, CreateWithdrawalRequest, CreateWithdrawalResponse, GetTransactionRequest, GetTransactionResponse, ListPortfolioTransactionsRequest, ListPortfolioTransactionsResponse, ListWalletTransactionsRequest, ListWalletTransactionsResponse, } from './transactions/types';
57
+ export type { ListPortfolioUsersRequest, ListPortfolioUsersResponse, ListUsersRequest, ListUsersResponse, } from './users/types';
58
+ export type { CreateWalletRequest, CreateWalletResponse, CreateWalletDepositAddressRequest, CreateWalletDepositAddressResponse, GetWalletDepositInstructionsRequest, GetWalletDepositInstructionsResponse, GetWalletRequest, GetWalletResponse, ListWalletAddressesRequest, ListWalletAddressesResponse, ListWalletsRequest, ListWalletsResponse, } from './wallets/types';
@@ -0,0 +1,39 @@
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
+ export { IPrimeApiClient, CoinbasePrimeClientWithServices, CoinbasePrimeClientConfig, CoinbaseClient, CoinbaseHttpClientRetryOptions, CoinbaseCallOptions, Method, CoinbaseClientException, CoinbaseError, CoinbaseResponse, TransformRequestFn, TransformResponseFn, } from './clients';
17
+ export { CoinbasePrimeCredentials } from './credentials';
18
+ export { createCredentialsFromEnv } from './shared/envUtils';
19
+ export type * from './model/';
20
+ export * from './model/enums/';
21
+ export type { IActivitiesService } from './activities';
22
+ export type { IAddressBooksService } from './addressBooks';
23
+ export type { IAllocationService } from './allocations';
24
+ export type { IAssetsService } from './assets';
25
+ export type { IBalancesService } from './balances';
26
+ export type { ICommissionService } from './commission';
27
+ export type { IFinancingService } from './financing';
28
+ export type { IFuturesService } from './futures';
29
+ export type { IInvoicesService } from './invoices';
30
+ export type { OnchainAddressBookService } from './onchainAddressBook';
31
+ export type { IOrdersService } from './orders';
32
+ export type { IPaymentMethodsService } from './paymentMethods';
33
+ export type { IPortfoliosService } from './portfolios';
34
+ export type { IPositionsService } from './positions';
35
+ export type { IProductsService } from './products';
36
+ export type { IStakingService } from './staking';
37
+ export type { ITransactionsService } from './transactions';
38
+ export type { IUsersService } from './users';
39
+ export type { IWalletsService } from './wallets';
@@ -0,0 +1,18 @@
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
+ export { CoinbasePrimeClient, CoinbasePrimeClientWithServices, CoinbasePrimeClientConfig, IPrimeApiClient, CoinbaseClient, CoinbaseHttpClientRetryOptions, CoinbaseCallOptions, Method, CoinbaseClientException, CoinbaseError, CoinbaseResponse, TransformRequestFn, TransformResponseFn, } from './clients';
17
+ export { CoinbasePrimeCredentials } from './credentials';
18
+ export { createCredentialsFromEnv } from './shared/envUtils';
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Copyright 2024-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 { CoinbaseClient } from '@coinbase-sample/core-ts';
17
+ import { CoinbasePrimeCredentials } from '../credentials';
18
+ import type { CoinbasePrimeClientConfig, IPrimeApiClient } from './types';
19
+ export declare class CoinbasePrimeClient extends CoinbaseClient implements IPrimeApiClient {
20
+ constructor(credentials?: CoinbasePrimeCredentials, apiBasePath?: string, options?: CoinbasePrimeClientConfig);
21
+ /**
22
+ * Create a client from environment variables
23
+ * Requires PRIME_CREDENTIALS environment variable with JSON containing:
24
+ * { "AccessKey": "...", "SecretKey": "...", "Passphrase": "..." }
25
+ */
26
+ static fromEnv(apiBaseUrl?: string, options?: CoinbasePrimeClientConfig): CoinbasePrimeClient;
27
+ }
@@ -0,0 +1,229 @@
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 { CoinbaseClient } from '@coinbase-sample/core-ts';
17
+ import { CoinbasePrimeCredentials } from '../credentials';
18
+ import type { CoinbasePrimeClientConfig, IPrimeApiClient } from './types';
19
+ import { LazyServiceGetters } from './clientWithServicesTypes';
20
+ import type { IActivitiesService } from '../activities';
21
+ import type { IAddressBooksService } from '../addressBooks';
22
+ import type { IAllocationService } from '../allocations';
23
+ import type { IAssetsService } from '../assets';
24
+ import type { IBalancesService } from '../balances';
25
+ import type { ICommissionService } from '../commission';
26
+ import type { IFinancingService } from '../financing';
27
+ import type { IFuturesService } from '../futures';
28
+ import type { IInvoicesService } from '../invoices';
29
+ import type { OnchainAddressBookService } from '../onchainAddressBook';
30
+ import type { IOrdersService } from '../orders';
31
+ import type { IPaymentMethodsService } from '../paymentMethods';
32
+ import type { IPortfoliosService } from '../portfolios';
33
+ import type { IPositionsService } from '../positions';
34
+ import type { IProductsService } from '../products';
35
+ import type { IStakingService } from '../staking';
36
+ import type { ITransactionsService } from '../transactions';
37
+ import type { IUsersService } from '../users';
38
+ import type { IWalletsService } from '../wallets';
39
+ /**
40
+ * Enhanced Coinbase Prime Client with lazy-loaded service getters.
41
+ * Services are only instantiated when first accessed, improving tree-shaking
42
+ * and reducing initial bundle size.
43
+ */
44
+ export declare class CoinbasePrimeClientWithServices extends CoinbaseClient implements LazyServiceGetters, IPrimeApiClient {
45
+ private _activitiesService?;
46
+ private _addressBooksService?;
47
+ private _allocationService?;
48
+ private _assetsService?;
49
+ private _balancesService?;
50
+ private _commissionService?;
51
+ private _financingService?;
52
+ private _futuresService?;
53
+ private _invoicesService?;
54
+ private _onchainAddressBookService?;
55
+ private _ordersService?;
56
+ private _paymentMethodsService?;
57
+ private _portfoliosService?;
58
+ private _positionsService?;
59
+ private _productsService?;
60
+ private _stakingService?;
61
+ private _transactionsService?;
62
+ private _usersService?;
63
+ private _walletsService?;
64
+ constructor(credentials?: CoinbasePrimeCredentials, apiBasePath?: string, options?: CoinbasePrimeClientConfig);
65
+ /**
66
+ * Create a client from environment variables
67
+ * Requires PRIME_CREDENTIALS environment variable with JSON containing:
68
+ * { "AccessKey": "...", "SecretKey": "...", "Passphrase": "..." }
69
+ */
70
+ static fromEnv(baseUrl?: string, options?: CoinbasePrimeClientConfig): CoinbasePrimeClientWithServices;
71
+ /**
72
+ * Lazy getter for ActivitiesService
73
+ * @example
74
+ * ```typescript
75
+ * const activities = await client.activities.listPortfolioActivities({ portfolioId });
76
+ * ```
77
+ */
78
+ get activities(): IActivitiesService;
79
+ /**
80
+ * Lazy getter for AddressBooksService
81
+ * @example
82
+ * ```typescript
83
+ * const addressBooks = await client.addressBooks.listAddressBooks({ portfolioId });
84
+ * ```
85
+ */
86
+ get addressBooks(): IAddressBooksService;
87
+ /**
88
+ * Lazy getter for AllocationService
89
+ * @example
90
+ * ```typescript
91
+ * const allocation = await client.allocations.createAllocation({ portfolioId, ... });
92
+ * ```
93
+ */
94
+ get allocations(): IAllocationService;
95
+ /**
96
+ * Lazy getter for AssetsService
97
+ * @example
98
+ * ```typescript
99
+ * const assets = await client.assets.listAssets({ entityId });
100
+ * ```
101
+ */
102
+ get assets(): IAssetsService;
103
+ /**
104
+ * Lazy getter for BalancesService
105
+ * @example
106
+ * ```typescript
107
+ * const balance = await client.balances.getWalletBalance({ portfolioId, walletId });
108
+ * ```
109
+ */
110
+ get balances(): IBalancesService;
111
+ /**
112
+ * Lazy getter for CommissionService
113
+ * @example
114
+ * ```typescript
115
+ * const commission = await client.commission.getPortfolioCommission({ portfolioId });
116
+ * ```
117
+ */
118
+ get commission(): ICommissionService;
119
+ /**
120
+ * Lazy getter for FinancingService
121
+ * @example
122
+ * ```typescript
123
+ * const buyingPower = await client.financing.getPortfolioBuyingPower({ portfolioId });
124
+ * ```
125
+ */
126
+ get financing(): IFinancingService;
127
+ /**
128
+ * Lazy getter for FuturesService
129
+ * @example
130
+ * ```typescript
131
+ * const positions = await client.futures.getEntityFuturesPositions({ entityId });
132
+ * ```
133
+ */
134
+ get futures(): IFuturesService;
135
+ /**
136
+ * Lazy getter for InvoicesService
137
+ * @example
138
+ * ```typescript
139
+ * const invoices = await client.invoices.listInvoices({ entityId });
140
+ * ```
141
+ */
142
+ get invoices(): IInvoicesService;
143
+ /**
144
+ * Lazy getter for OnchainAddressBookService
145
+ * @example
146
+ * ```typescript
147
+ * const addressBook = await client.onchainAddressBook.listOnchainAddressBook({ portfolioId });
148
+ * ```
149
+ */
150
+ get onchainAddressBook(): OnchainAddressBookService;
151
+ /**
152
+ * Lazy getter for OrdersService
153
+ * @example
154
+ * ```typescript
155
+ * const order = await client.orders.createOrder({
156
+ * portfolioId: "123",
157
+ * side: "BUY",
158
+ * productId: "BTC-USD",
159
+ * type: "MARKET",
160
+ * baseQuantity: "0.001"
161
+ * });
162
+ * ```
163
+ */
164
+ get orders(): IOrdersService;
165
+ /**
166
+ * Lazy getter for PaymentMethodsService
167
+ * @example
168
+ * ```typescript
169
+ * const paymentMethods = await client.paymentMethods.listEntityPaymentMethods({ entityId });
170
+ * ```
171
+ */
172
+ get paymentMethods(): IPaymentMethodsService;
173
+ /**
174
+ * Lazy getter for PortfoliosService
175
+ * @example
176
+ * ```typescript
177
+ * const portfolios = await client.portfolios.listPortfolios();
178
+ * ```
179
+ */
180
+ get portfolios(): IPortfoliosService;
181
+ /**
182
+ * Lazy getter for PositionsService
183
+ * @example
184
+ * ```typescript
185
+ * const positions = await client.positions.listAggregateEntityPositions({ entityId });
186
+ * ```
187
+ */
188
+ get positions(): IPositionsService;
189
+ /**
190
+ * Lazy getter for ProductsService
191
+ * @example
192
+ * ```typescript
193
+ * const products = await client.products.listProducts({ portfolioId });
194
+ * ```
195
+ */
196
+ get products(): IProductsService;
197
+ /**
198
+ * Lazy getter for StakingService
199
+ * @example
200
+ * ```typescript
201
+ * const stake = await client.staking.createStake({ walletId, assetId, amount });
202
+ * ```
203
+ */
204
+ get staking(): IStakingService;
205
+ /**
206
+ * Lazy getter for TransactionsService
207
+ * @example
208
+ * ```typescript
209
+ * const transaction = await client.transactions.getTransaction({ portfolioId, transactionId });
210
+ * ```
211
+ */
212
+ get transactions(): ITransactionsService;
213
+ /**
214
+ * Lazy getter for UsersService
215
+ * @example
216
+ * ```typescript
217
+ * const users = await client.users.listUsers({ entityId });
218
+ * ```
219
+ */
220
+ get users(): IUsersService;
221
+ /**
222
+ * Lazy getter for WalletsService
223
+ * @example
224
+ * ```typescript
225
+ * const wallets = await client.wallets.listWallets({ portfolioId });
226
+ * ```
227
+ */
228
+ get wallets(): IWalletsService;
229
+ }