@coinbase-sample/prime-sdk-ts 0.6.2 → 0.6.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +207 -67
- package/dist/addressBooks/index.js +2 -2
- package/dist/allocations/index.js +3 -3
- package/dist/client-manual.js +84 -0
- package/dist/client-modular.js +57 -0
- package/dist/client-only.js +31 -0
- package/dist/{client.js → clients/client.js} +12 -2
- package/dist/clients/clientWithServices.js +323 -0
- package/dist/{types/client.d.ts → clients/clientWithServicesTypes.js} +3 -6
- package/dist/clients/index.js +28 -0
- package/dist/clients/types.js +2 -0
- package/dist/constants.js +1 -1
- package/dist/futures/index.js +4 -4
- package/dist/index.js +27 -18
- package/dist/model/enumPrefixes.js +330 -0
- package/dist/onchainAddressBook/index.js +4 -4
- package/dist/orders/index.js +6 -6
- package/dist/paymentMethods/index.js +2 -1
- package/dist/services.js +75 -0
- package/dist/shared/dynamicEnumValidation.js +184 -0
- package/dist/shared/dynamicEnumValidation.old.js +746 -0
- package/dist/shared/enumHelpers.js +219 -0
- package/dist/shared/enumRegistry.js +153 -0
- package/dist/shared/enumValidationCore.js +194 -0
- package/dist/shared/enumValidators.js +115 -0
- package/dist/shared/envUtils.js +66 -0
- package/dist/shared/fieldMapping.js +242 -0
- package/dist/shared/serviceContext.js +157 -0
- package/dist/staking/index.js +5 -5
- package/dist/transactions/index.js +5 -5
- package/dist/types/activities/index.d.ts +2 -3
- package/dist/types/addressBooks/index.d.ts +2 -3
- package/dist/types/allocations/index.d.ts +2 -3
- package/dist/types/assets/index.d.ts +2 -3
- package/dist/types/balances/index.d.ts +2 -3
- package/dist/types/balances/types.d.ts +1 -1
- package/dist/types/client-manual.d.ts +58 -0
- package/dist/types/client-modular.d.ts +39 -0
- package/dist/types/client-only.d.ts +18 -0
- package/dist/types/clients/client.d.ts +27 -0
- package/dist/types/clients/clientWithServices.d.ts +229 -0
- package/dist/types/clients/clientWithServicesTypes.d.ts +115 -0
- package/dist/types/clients/index.d.ts +19 -0
- package/dist/types/clients/types.d.ts +48 -0
- package/dist/types/commission/index.d.ts +2 -3
- package/dist/types/constants.d.ts +1 -1
- package/dist/types/financing/index.d.ts +2 -3
- package/dist/types/futures/index.d.ts +2 -3
- package/dist/types/index.d.ts +2 -1
- package/dist/types/invoices/index.d.ts +2 -3
- package/dist/types/model/enumPrefixes.d.ts +206 -0
- package/dist/types/onchainAddressBook/index.d.ts +2 -3
- package/dist/types/orders/index.d.ts +2 -3
- package/dist/types/paymentMethods/index.d.ts +2 -3
- package/dist/types/paymentMethods/types.d.ts +1 -0
- package/dist/types/portfolios/index.d.ts +2 -3
- package/dist/types/positions/index.d.ts +2 -3
- package/dist/types/products/index.d.ts +2 -3
- package/dist/types/services.d.ts +39 -0
- package/dist/types/shared/dynamicEnumValidation.d.ts +48 -0
- package/dist/types/shared/dynamicEnumValidation.old.d.ts +143 -0
- package/dist/types/shared/enumHelpers.d.ts +135 -0
- package/dist/types/shared/enumRegistry.d.ts +74 -0
- package/dist/types/shared/enumValidationCore.d.ts +68 -0
- package/dist/types/shared/enumValidators.d.ts +117 -0
- package/dist/types/shared/envUtils.d.ts +36 -0
- package/dist/types/shared/fieldMapping.d.ts +35 -0
- package/dist/types/shared/paginatedResponse.d.ts +3 -4
- package/dist/types/shared/serviceContext.d.ts +46 -0
- package/dist/types/staking/index.d.ts +2 -3
- package/dist/types/transactions/index.d.ts +2 -3
- package/dist/types/types.d.ts +37 -0
- package/dist/types/users/index.d.ts +2 -3
- package/dist/types/wallets/index.d.ts +2 -3
- package/dist/types.js +39 -0
- package/dist/wallets/index.js +3 -3
- package/package.json +33 -2
|
@@ -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 '
|
|
17
|
-
import { CoinbasePrimeClient } from '../client';
|
|
16
|
+
import { IPrimeApiClient, CoinbaseCallOptions } from '../clients';
|
|
18
17
|
import { ListInvoicesRequest, ListInvoicesResponse } from './types';
|
|
19
18
|
export interface IInvoicesService {
|
|
20
19
|
listInvoices(request: ListInvoicesRequest, options?: CoinbaseCallOptions): Promise<ListInvoicesResponse>;
|
|
21
20
|
}
|
|
22
21
|
export declare class InvoicesService implements IInvoicesService {
|
|
23
22
|
private client;
|
|
24
|
-
constructor(client:
|
|
23
|
+
constructor(client: IPrimeApiClient);
|
|
25
24
|
listInvoices(request: ListInvoicesRequest, options?: CoinbaseCallOptions): Promise<ListInvoicesResponse>;
|
|
26
25
|
}
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2025-present Coinbase Global, Inc.
|
|
3
|
+
*
|
|
4
|
+
* This file is auto-generated during the type generation process.
|
|
5
|
+
* Do not edit manually - regenerate by running: npm run generate-types
|
|
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
|
+
/**
|
|
20
|
+
* Auto-generated enum prefix patterns extracted from OpenAPI specification
|
|
21
|
+
* Total enums analyzed: 43
|
|
22
|
+
* Prefix patterns discovered: 77
|
|
23
|
+
*/
|
|
24
|
+
export declare const GENERATED_ENUM_PREFIXES: readonly ["ACTION_", "ACTIVITY_CATEGORY_", "ACTIVITY_LEVEL_", "ACTIVITY_SECONDARY_", "ACTIVITY_STATUS_", "ACTIVITY_TYPE_", "ADDRESS_BOOK_", "ALLOCATION_STATUS_", "BALANCE_", "BENCHMARK_", "BILATERAL_", "BILLING_", "CHANGE_", "CLAIM_", "COINBASE_", "COMPLETE_", "CONCENTRATION_", "COUNTERPARTY_", "CRYPTO_", "DEPOSIT_", "DESTINATION_", "DESTINATION_PAYMENT_", "FCM_FUTURES_", "FCM_MARGIN_", "FCM_POSITION_", "FILL_OR_", "FULL_", "GOOD_UNTIL_", "HIERARCHY_TYPE_", "IMMEDIATE_OR_", "INTERNAL_", "INVOICE_STATE_", "INVOICE_TYPE_", "ITEM_", "ITEM_APPROVAL_", "LOAN_TYPE_", "MACRO_", "MARGIN_ADD_", "METHOD_", "MULTIPLE_", "NETWORK_FAMILY_", "NETWORK_TYPE_", "NO_SECONDARY_", "ONCHAIN_", "OTHER_", "OTHER_ACTIVITY_", "OTHER_TRANSACTION_", "PAYMENT_", "PORTFOLIO_", "POSITION_REFERENCE_", "PRIME_CUSTODY_", "PRODUCT_PERMISSION_", "PROXY_", "RATE_TYPE_", "REMOVE_AUTHORIZED_", "SHORT_", "SHORT_BIASED_", "SHORT_COLLATERAL_", "SINGLE_COIN_", "STAKE_ACCOUNT_", "STAKE_AUTHORIZE_", "STOP_", "SWEEP_", "TEAM_", "TOTAL_", "TRADE_", "TRADING_", "TRANSACTION_", "TRANSACTION_IMPORT_", "TRANSACTION_TYPE_", "UNIFIED_TOTAL_", "VAULT_", "VOTE_", "WALLET_TYPE_", "WALLET_VISIBILITY_", "WITHDRAWAL_", "WITHDRAW_"];
|
|
25
|
+
/**
|
|
26
|
+
* Detailed enum analysis for debugging and insights
|
|
27
|
+
*/
|
|
28
|
+
export declare const ENUM_ANALYSIS: {
|
|
29
|
+
readonly totalEnums: 43;
|
|
30
|
+
readonly discoveredPrefixes: 77;
|
|
31
|
+
readonly prefixPatterns: readonly ["ACTION_", "ACTIVITY_CATEGORY_", "ACTIVITY_LEVEL_", "ACTIVITY_SECONDARY_", "ACTIVITY_STATUS_", "ACTIVITY_TYPE_", "ADDRESS_BOOK_", "ALLOCATION_STATUS_", "BALANCE_", "BENCHMARK_", "BILATERAL_", "BILLING_", "CHANGE_", "CLAIM_", "COINBASE_", "COMPLETE_", "CONCENTRATION_", "COUNTERPARTY_", "CRYPTO_", "DEPOSIT_", "DESTINATION_", "DESTINATION_PAYMENT_", "FCM_FUTURES_", "FCM_MARGIN_", "FCM_POSITION_", "FILL_OR_", "FULL_", "GOOD_UNTIL_", "HIERARCHY_TYPE_", "IMMEDIATE_OR_", "INTERNAL_", "INVOICE_STATE_", "INVOICE_TYPE_", "ITEM_", "ITEM_APPROVAL_", "LOAN_TYPE_", "MACRO_", "MARGIN_ADD_", "METHOD_", "MULTIPLE_", "NETWORK_FAMILY_", "NETWORK_TYPE_", "NO_SECONDARY_", "ONCHAIN_", "OTHER_", "OTHER_ACTIVITY_", "OTHER_TRANSACTION_", "PAYMENT_", "PORTFOLIO_", "POSITION_REFERENCE_", "PRIME_CUSTODY_", "PRODUCT_PERMISSION_", "PROXY_", "RATE_TYPE_", "REMOVE_AUTHORIZED_", "SHORT_", "SHORT_BIASED_", "SHORT_COLLATERAL_", "SINGLE_COIN_", "STAKE_ACCOUNT_", "STAKE_AUTHORIZE_", "STOP_", "SWEEP_", "TEAM_", "TOTAL_", "TRADE_", "TRADING_", "TRANSACTION_", "TRANSACTION_IMPORT_", "TRANSACTION_TYPE_", "UNIFIED_TOTAL_", "VAULT_", "VOTE_", "WALLET_TYPE_", "WALLET_VISIBILITY_", "WITHDRAWAL_", "WITHDRAW_"];
|
|
32
|
+
readonly enumDetails: readonly [{
|
|
33
|
+
readonly name: "CoinbaseCustodyApiActivityType";
|
|
34
|
+
readonly valueCount: 29;
|
|
35
|
+
readonly file: "coinbaseCustodyApiActivityType.ts";
|
|
36
|
+
}, {
|
|
37
|
+
readonly name: "CoinbaseCustodyApiAddressBookType";
|
|
38
|
+
readonly valueCount: 3;
|
|
39
|
+
readonly file: "coinbaseCustodyApiAddressBookType.ts";
|
|
40
|
+
}, {
|
|
41
|
+
readonly name: "CoinbasePublicRestApiAction";
|
|
42
|
+
readonly valueCount: 5;
|
|
43
|
+
readonly file: "coinbasePublicRestApiAction.ts";
|
|
44
|
+
}, {
|
|
45
|
+
readonly name: "CoinbasePublicRestApiActivityCategory";
|
|
46
|
+
readonly valueCount: 7;
|
|
47
|
+
readonly file: "coinbasePublicRestApiActivityCategory.ts";
|
|
48
|
+
}, {
|
|
49
|
+
readonly name: "CoinbasePublicRestApiActivityLevel";
|
|
50
|
+
readonly valueCount: 3;
|
|
51
|
+
readonly file: "coinbasePublicRestApiActivityLevel.ts";
|
|
52
|
+
}, {
|
|
53
|
+
readonly name: "CoinbasePublicRestApiActivitySecondaryType";
|
|
54
|
+
readonly valueCount: 7;
|
|
55
|
+
readonly file: "coinbasePublicRestApiActivitySecondaryType.ts";
|
|
56
|
+
}, {
|
|
57
|
+
readonly name: "CoinbasePublicRestApiActivityStatus";
|
|
58
|
+
readonly valueCount: 7;
|
|
59
|
+
readonly file: "coinbasePublicRestApiActivityStatus.ts";
|
|
60
|
+
}, {
|
|
61
|
+
readonly name: "CoinbasePublicRestApiActivityType";
|
|
62
|
+
readonly valueCount: 42;
|
|
63
|
+
readonly file: "coinbasePublicRestApiActivityType.ts";
|
|
64
|
+
}, {
|
|
65
|
+
readonly name: "CoinbasePublicRestApiAllocationSizeType";
|
|
66
|
+
readonly valueCount: 3;
|
|
67
|
+
readonly file: "coinbasePublicRestApiAllocationSizeType.ts";
|
|
68
|
+
}, {
|
|
69
|
+
readonly name: "CoinbasePublicRestApiAllocationStatus";
|
|
70
|
+
readonly valueCount: 5;
|
|
71
|
+
readonly file: "coinbasePublicRestApiAllocationStatus.ts";
|
|
72
|
+
}, {
|
|
73
|
+
readonly name: "CoinbasePublicRestApiAssetChangeType";
|
|
74
|
+
readonly valueCount: 5;
|
|
75
|
+
readonly file: "coinbasePublicRestApiAssetChangeType.ts";
|
|
76
|
+
}, {
|
|
77
|
+
readonly name: "CoinbasePublicRestApiBenchmark";
|
|
78
|
+
readonly valueCount: 5;
|
|
79
|
+
readonly file: "coinbasePublicRestApiBenchmark.ts";
|
|
80
|
+
}, {
|
|
81
|
+
readonly name: "CoinbasePublicRestApiDestinationType";
|
|
82
|
+
readonly valueCount: 4;
|
|
83
|
+
readonly file: "coinbasePublicRestApiDestinationType.ts";
|
|
84
|
+
}, {
|
|
85
|
+
readonly name: "CoinbasePublicRestApiFcmFuturesSweepStatus";
|
|
86
|
+
readonly valueCount: 5;
|
|
87
|
+
readonly file: "coinbasePublicRestApiFcmFuturesSweepStatus.ts";
|
|
88
|
+
}, {
|
|
89
|
+
readonly name: "CoinbasePublicRestApiFcmMarginCallState";
|
|
90
|
+
readonly valueCount: 5;
|
|
91
|
+
readonly file: "coinbasePublicRestApiFcmMarginCallState.ts";
|
|
92
|
+
}, {
|
|
93
|
+
readonly name: "CoinbasePublicRestApiFcmMarginCallType";
|
|
94
|
+
readonly valueCount: 3;
|
|
95
|
+
readonly file: "coinbasePublicRestApiFcmMarginCallType.ts";
|
|
96
|
+
}, {
|
|
97
|
+
readonly name: "CoinbasePublicRestApiFcmPositionSide";
|
|
98
|
+
readonly valueCount: 3;
|
|
99
|
+
readonly file: "coinbasePublicRestApiFcmPositionSide.ts";
|
|
100
|
+
}, {
|
|
101
|
+
readonly name: "CoinbasePublicRestApiHierarchyType";
|
|
102
|
+
readonly valueCount: 3;
|
|
103
|
+
readonly file: "coinbasePublicRestApiHierarchyType.ts";
|
|
104
|
+
}, {
|
|
105
|
+
readonly name: "CoinbasePublicRestApiInvoiceState";
|
|
106
|
+
readonly valueCount: 5;
|
|
107
|
+
readonly file: "coinbasePublicRestApiInvoiceState.ts";
|
|
108
|
+
}, {
|
|
109
|
+
readonly name: "CoinbasePublicRestApiInvoiceType";
|
|
110
|
+
readonly valueCount: 6;
|
|
111
|
+
readonly file: "coinbasePublicRestApiInvoiceType.ts";
|
|
112
|
+
}, {
|
|
113
|
+
readonly name: "CoinbasePublicRestApiLoanType";
|
|
114
|
+
readonly valueCount: 6;
|
|
115
|
+
readonly file: "coinbasePublicRestApiLoanType.ts";
|
|
116
|
+
}, {
|
|
117
|
+
readonly name: "CoinbasePublicRestApiMarginAddOnType";
|
|
118
|
+
readonly valueCount: 5;
|
|
119
|
+
readonly file: "coinbasePublicRestApiMarginAddOnType.ts";
|
|
120
|
+
}, {
|
|
121
|
+
readonly name: "CoinbasePublicRestApiNetworkFamily";
|
|
122
|
+
readonly valueCount: 3;
|
|
123
|
+
readonly file: "coinbasePublicRestApiNetworkFamily.ts";
|
|
124
|
+
}, {
|
|
125
|
+
readonly name: "CoinbasePublicRestApiNetworkType";
|
|
126
|
+
readonly valueCount: 3;
|
|
127
|
+
readonly file: "coinbasePublicRestApiNetworkType.ts";
|
|
128
|
+
}, {
|
|
129
|
+
readonly name: "CoinbasePublicRestApiOrderSide";
|
|
130
|
+
readonly valueCount: 2;
|
|
131
|
+
readonly file: "coinbasePublicRestApiOrderSide.ts";
|
|
132
|
+
}, {
|
|
133
|
+
readonly name: "CoinbasePublicRestApiOrderStatus";
|
|
134
|
+
readonly valueCount: 6;
|
|
135
|
+
readonly file: "coinbasePublicRestApiOrderStatus.ts";
|
|
136
|
+
}, {
|
|
137
|
+
readonly name: "CoinbasePublicRestApiOrderType";
|
|
138
|
+
readonly valueCount: 7;
|
|
139
|
+
readonly file: "coinbasePublicRestApiOrderType.ts";
|
|
140
|
+
}, {
|
|
141
|
+
readonly name: "CoinbasePublicRestApiPaymentMethodType";
|
|
142
|
+
readonly valueCount: 3;
|
|
143
|
+
readonly file: "coinbasePublicRestApiPaymentMethodType.ts";
|
|
144
|
+
}, {
|
|
145
|
+
readonly name: "CoinbasePublicRestApiPortfolioBalanceType";
|
|
146
|
+
readonly valueCount: 5;
|
|
147
|
+
readonly file: "coinbasePublicRestApiPortfolioBalanceType.ts";
|
|
148
|
+
}, {
|
|
149
|
+
readonly name: "CoinbasePublicRestApiPositionReferenceType";
|
|
150
|
+
readonly valueCount: 3;
|
|
151
|
+
readonly file: "coinbasePublicRestApiPositionReferenceType.ts";
|
|
152
|
+
}, {
|
|
153
|
+
readonly name: "CoinbasePublicRestApiProductPermissions";
|
|
154
|
+
readonly valueCount: 3;
|
|
155
|
+
readonly file: "coinbasePublicRestApiProductPermissions.ts";
|
|
156
|
+
}, {
|
|
157
|
+
readonly name: "CoinbasePublicRestApiRateType";
|
|
158
|
+
readonly valueCount: 5;
|
|
159
|
+
readonly file: "coinbasePublicRestApiRateType.ts";
|
|
160
|
+
}, {
|
|
161
|
+
readonly name: "CoinbasePublicRestApiSigningStatus";
|
|
162
|
+
readonly valueCount: 2;
|
|
163
|
+
readonly file: "coinbasePublicRestApiSigningStatus.ts";
|
|
164
|
+
}, {
|
|
165
|
+
readonly name: "CoinbasePublicRestApiSortDirection";
|
|
166
|
+
readonly valueCount: 2;
|
|
167
|
+
readonly file: "coinbasePublicRestApiSortDirection.ts";
|
|
168
|
+
}, {
|
|
169
|
+
readonly name: "CoinbasePublicRestApiTimeInForceType";
|
|
170
|
+
readonly valueCount: 4;
|
|
171
|
+
readonly file: "coinbasePublicRestApiTimeInForceType.ts";
|
|
172
|
+
}, {
|
|
173
|
+
readonly name: "CoinbasePublicRestApiTransactionStatus";
|
|
174
|
+
readonly valueCount: 21;
|
|
175
|
+
readonly file: "coinbasePublicRestApiTransactionStatus.ts";
|
|
176
|
+
}, {
|
|
177
|
+
readonly name: "CoinbasePublicRestApiTransactionType";
|
|
178
|
+
readonly valueCount: 33;
|
|
179
|
+
readonly file: "coinbasePublicRestApiTransactionType.ts";
|
|
180
|
+
}, {
|
|
181
|
+
readonly name: "CoinbasePublicRestApiTransferLocationType";
|
|
182
|
+
readonly valueCount: 6;
|
|
183
|
+
readonly file: "coinbasePublicRestApiTransferLocationType.ts";
|
|
184
|
+
}, {
|
|
185
|
+
readonly name: "CoinbasePublicRestApiUserRole";
|
|
186
|
+
readonly valueCount: 9;
|
|
187
|
+
readonly file: "coinbasePublicRestApiUserRole.ts";
|
|
188
|
+
}, {
|
|
189
|
+
readonly name: "CoinbasePublicRestApiVisibilityStatus";
|
|
190
|
+
readonly valueCount: 3;
|
|
191
|
+
readonly file: "coinbasePublicRestApiVisibilityStatus.ts";
|
|
192
|
+
}, {
|
|
193
|
+
readonly name: "CoinbasePublicRestApiWalletDepositInstructionType";
|
|
194
|
+
readonly valueCount: 5;
|
|
195
|
+
readonly file: "coinbasePublicRestApiWalletDepositInstructionType.ts";
|
|
196
|
+
}, {
|
|
197
|
+
readonly name: "CoinbasePublicRestApiWalletType";
|
|
198
|
+
readonly valueCount: 5;
|
|
199
|
+
readonly file: "coinbasePublicRestApiWalletType.ts";
|
|
200
|
+
}, {
|
|
201
|
+
readonly name: "CoinbasePublicRestApiWalletVisibility";
|
|
202
|
+
readonly valueCount: 3;
|
|
203
|
+
readonly file: "coinbasePublicRestApiWalletVisibility.ts";
|
|
204
|
+
}];
|
|
205
|
+
};
|
|
206
|
+
export type EnumPrefix = (typeof GENERATED_ENUM_PREFIXES)[number];
|
|
@@ -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 '
|
|
17
|
-
import { CoinbasePrimeClient } from '../client';
|
|
16
|
+
import { CoinbaseCallOptions, IPrimeApiClient } from '../clients';
|
|
18
17
|
import { ListOnchainAddressBookRequest, ListOnchainAddressBookResponse, CreateOnchainAddressBookEntryRequest, CreateOnchainAddressBookEntryResponse, UpdateOnchainAddressBookEntryRequest, UpdateOnchainAddressBookEntryResponse, DeleteOnchainAddressBookEntryRequest, DeleteOnchainAddressBookEntryResponse } from './types';
|
|
19
18
|
export interface IOnchainAddressBookService {
|
|
20
19
|
listOnchainAddressBook(request: ListOnchainAddressBookRequest, options?: CoinbaseCallOptions): Promise<ListOnchainAddressBookResponse>;
|
|
@@ -24,7 +23,7 @@ export interface IOnchainAddressBookService {
|
|
|
24
23
|
}
|
|
25
24
|
export declare class OnchainAddressBookService implements IOnchainAddressBookService {
|
|
26
25
|
private client;
|
|
27
|
-
constructor(client:
|
|
26
|
+
constructor(client: IPrimeApiClient);
|
|
28
27
|
listOnchainAddressBook(request: ListOnchainAddressBookRequest, options?: CoinbaseCallOptions): Promise<ListOnchainAddressBookResponse>;
|
|
29
28
|
createOnchainAddressBookEntry(request: CreateOnchainAddressBookEntryRequest, options?: CoinbaseCallOptions): Promise<CreateOnchainAddressBookEntryResponse>;
|
|
30
29
|
updateOnchainAddressBookEntry(request: UpdateOnchainAddressBookEntryRequest, options?: CoinbaseCallOptions): Promise<UpdateOnchainAddressBookEntryResponse>;
|
|
@@ -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 '
|
|
17
|
-
import { CoinbasePrimeClient } from '../client';
|
|
16
|
+
import { CoinbaseCallOptions, IPrimeApiClient } from '../clients';
|
|
18
17
|
import { ListOpenOrdersResponse, ListOpenOrdersRequest, ListOrderFillsRequest, ListOrderFillsResponse, ListPortfolioOrdersResponse, ListPortfolioOrdersRequest, GetOrderResponse, GetOrderRequest, GetOrderEditHistoryRequest, GetOrderEditHistoryResponse, ListPortfolioFillsRequest, ListPortfolioFillsResponse, CreateOrderPreviewRequest, CreateOrderPreviewResponse, CancelOrderRequest, CancelOrderResponse, CreateOrderRequest, CreateOrderResponse, CreateQuoteRequest, CreateQuoteResponse, AcceptQuoteRequest, AcceptQuoteResponse } from './types';
|
|
19
18
|
export interface IOrdersService {
|
|
20
19
|
getOrder(request: GetOrderRequest, options?: CoinbaseCallOptions): Promise<GetOrderResponse>;
|
|
@@ -31,7 +30,7 @@ export interface IOrdersService {
|
|
|
31
30
|
}
|
|
32
31
|
export declare class OrdersService implements IOrdersService {
|
|
33
32
|
private client;
|
|
34
|
-
constructor(client:
|
|
33
|
+
constructor(client: IPrimeApiClient);
|
|
35
34
|
getOrder(request: GetOrderRequest, options?: CoinbaseCallOptions): Promise<GetOrderResponse>;
|
|
36
35
|
getOrderEditHistory(request: GetOrderEditHistoryRequest, options?: CoinbaseCallOptions): Promise<GetOrderEditHistoryResponse>;
|
|
37
36
|
listPortfolioFills(request: ListPortfolioFillsRequest, options?: CoinbaseCallOptions): Promise<ListPortfolioFillsResponse>;
|
|
@@ -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 '
|
|
17
|
-
import { CoinbasePrimeClient } from '../client';
|
|
16
|
+
import { CoinbaseCallOptions, IPrimeApiClient } from '../clients';
|
|
18
17
|
import { ListEntityPaymentMethodsRequest, ListEntityPaymentMethodsResponse, GetPaymentMethodRequest, GetPaymentMethodResponse } from './types';
|
|
19
18
|
export interface IPaymentMethodsService {
|
|
20
19
|
listEntityPaymentMethods(request: ListEntityPaymentMethodsRequest, options?: CoinbaseCallOptions): Promise<ListEntityPaymentMethodsResponse>;
|
|
@@ -22,7 +21,7 @@ export interface IPaymentMethodsService {
|
|
|
22
21
|
}
|
|
23
22
|
export declare class PaymentMethodsService implements IPaymentMethodsService {
|
|
24
23
|
private client;
|
|
25
|
-
constructor(client:
|
|
24
|
+
constructor(client: IPrimeApiClient);
|
|
26
25
|
listEntityPaymentMethods(request: ListEntityPaymentMethodsRequest, options?: CoinbaseCallOptions): Promise<ListEntityPaymentMethodsResponse>;
|
|
27
26
|
getPaymentMethod(request: GetPaymentMethodRequest, options?: CoinbaseCallOptions): Promise<GetPaymentMethodResponse>;
|
|
28
27
|
}
|
|
@@ -21,5 +21,6 @@ export type ListEntityPaymentMethodsRequest = {
|
|
|
21
21
|
export type ListEntityPaymentMethodsResponse = Brand<GetEntityPaymentMethodsResponse, 'ListEntityPaymentMethodsResponse'>;
|
|
22
22
|
export type GetPaymentMethodRequest = {
|
|
23
23
|
entityId: string;
|
|
24
|
+
paymentMethodId: string;
|
|
24
25
|
};
|
|
25
26
|
export type GetPaymentMethodResponse = Brand<GetEntityPaymentMethodDetailsResponse, 'GetPaymentMethodResponse'>;
|
|
@@ -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 '
|
|
17
|
-
import { CoinbasePrimeClient } from '../client';
|
|
16
|
+
import { CoinbaseCallOptions, IPrimeApiClient } from '../clients';
|
|
18
17
|
import { GetPortfolioRequest, GetPortfolioResponse, GetPortfolioCreditRequest, GetPortfolioCreditResponse, GetCounterpartyIdRequest, GetCounterpartyIdResponse, ListPortfoliosResponse, ListPortfoliosRequest } from './types';
|
|
19
18
|
export interface IPortfoliosService {
|
|
20
19
|
getPortfolio(request: GetPortfolioRequest, options?: CoinbaseCallOptions): Promise<GetPortfolioResponse>;
|
|
@@ -24,7 +23,7 @@ export interface IPortfoliosService {
|
|
|
24
23
|
}
|
|
25
24
|
export declare class PortfoliosService implements IPortfoliosService {
|
|
26
25
|
private client;
|
|
27
|
-
constructor(client:
|
|
26
|
+
constructor(client: IPrimeApiClient);
|
|
28
27
|
getPortfolio(request: GetPortfolioRequest, options?: CoinbaseCallOptions): Promise<GetPortfolioResponse>;
|
|
29
28
|
getPortfolioCredit(request: GetPortfolioCreditRequest, options?: CoinbaseCallOptions): Promise<GetPortfolioCreditResponse>;
|
|
30
29
|
getCounterpartyId(request: GetCounterpartyIdRequest, options?: CoinbaseCallOptions): Promise<GetCounterpartyIdResponse>;
|
|
@@ -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 '
|
|
17
|
-
import { CoinbasePrimeClient } from '../client';
|
|
16
|
+
import { IPrimeApiClient, CoinbaseCallOptions } from '../clients';
|
|
18
17
|
import { ListAggregateEntityPositionsRequest, ListAggregateEntityPositionsResponse, ListEntityPositionsRequest, ListEntityPositionsResponse } from './types';
|
|
19
18
|
export interface IPositionsService {
|
|
20
19
|
listAggregateEntityPositions(request: ListAggregateEntityPositionsRequest, options?: CoinbaseCallOptions): Promise<ListAggregateEntityPositionsResponse>;
|
|
@@ -22,7 +21,7 @@ export interface IPositionsService {
|
|
|
22
21
|
}
|
|
23
22
|
export declare class PositionsService implements IPositionsService {
|
|
24
23
|
private client;
|
|
25
|
-
constructor(client:
|
|
24
|
+
constructor(client: IPrimeApiClient);
|
|
26
25
|
listAggregateEntityPositions(request: ListAggregateEntityPositionsRequest, options?: CoinbaseCallOptions): Promise<ListAggregateEntityPositionsResponse>;
|
|
27
26
|
listEntityPositions(request: ListEntityPositionsRequest, options?: CoinbaseCallOptions): Promise<ListEntityPositionsResponse>;
|
|
28
27
|
}
|
|
@@ -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 '
|
|
17
|
-
import { CoinbasePrimeClient } from '../client';
|
|
16
|
+
import { IPrimeApiClient, CoinbaseCallOptions } from '../clients';
|
|
18
17
|
import { ListProductsRequest, ListProductsResponse } from './types';
|
|
19
18
|
export interface IProductsService {
|
|
20
19
|
listProducts(request: ListProductsRequest, options?: CoinbaseCallOptions): Promise<ListProductsResponse>;
|
|
21
20
|
}
|
|
22
21
|
export declare class ProductsService implements IProductsService {
|
|
23
22
|
private client;
|
|
24
|
-
constructor(client:
|
|
23
|
+
constructor(client: IPrimeApiClient);
|
|
25
24
|
listProducts(request: ListProductsRequest, options?: CoinbaseCallOptions): Promise<ListProductsResponse>;
|
|
26
25
|
}
|
|
@@ -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 { ActivitiesService, IActivitiesService } from './activities';
|
|
17
|
+
export { AddressBooksService, IAddressBooksService } from './addressBooks';
|
|
18
|
+
export { AllocationService, IAllocationService } from './allocations';
|
|
19
|
+
export { AssetsService, IAssetsService } from './assets';
|
|
20
|
+
export { BalancesService, IBalancesService } from './balances';
|
|
21
|
+
export { CommissionService, ICommissionService } from './commission';
|
|
22
|
+
export { FinancingService, IFinancingService } from './financing';
|
|
23
|
+
export { FuturesService, IFuturesService } from './futures';
|
|
24
|
+
export { InvoicesService, IInvoicesService } from './invoices';
|
|
25
|
+
export { OnchainAddressBookService } from './onchainAddressBook';
|
|
26
|
+
export { OrdersService, IOrdersService } from './orders';
|
|
27
|
+
export { PaymentMethodsService, IPaymentMethodsService, } from './paymentMethods';
|
|
28
|
+
export { PortfoliosService, IPortfoliosService } from './portfolios';
|
|
29
|
+
export { PositionsService, IPositionsService } from './positions';
|
|
30
|
+
export { ProductsService, IProductsService } from './products';
|
|
31
|
+
export { StakingService, IStakingService } from './staking';
|
|
32
|
+
export { TransactionsService, ITransactionsService } from './transactions';
|
|
33
|
+
export { UsersService, IUsersService } from './users';
|
|
34
|
+
export { WalletsService, IWalletsService } from './wallets';
|
|
35
|
+
export type * from './model/';
|
|
36
|
+
export * from './model/enums/';
|
|
37
|
+
export type { IPrimeApiClient, // Interface for client dependency injection
|
|
38
|
+
CoinbaseCallOptions, // Optional parameters for service methods
|
|
39
|
+
Method, } from './clients';
|
|
@@ -0,0 +1,48 @@
|
|
|
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
|
+
/**
|
|
17
|
+
* Dynamic enum validation system that automatically discovers and validates
|
|
18
|
+
* enum fields in request objects without manual service-specific configuration.
|
|
19
|
+
*
|
|
20
|
+
* This approach is more scalable and maintainable than manual validation rules.
|
|
21
|
+
*/
|
|
22
|
+
import { enumRegistry } from './enumRegistry';
|
|
23
|
+
import { DynamicEnumValidationError, DynamicValidationConfig, FieldTypeInfo } from './enumValidationCore';
|
|
24
|
+
/**
|
|
25
|
+
* Set global configuration for dynamic enum validation
|
|
26
|
+
*/
|
|
27
|
+
export declare function setDynamicValidationConfig(config: Partial<DynamicValidationConfig>): void;
|
|
28
|
+
/**
|
|
29
|
+
* Get current dynamic validation configuration
|
|
30
|
+
*/
|
|
31
|
+
export declare function getDynamicValidationConfig(): DynamicValidationConfig;
|
|
32
|
+
/**
|
|
33
|
+
* Main API: Validate and normalize request with type-safe generics
|
|
34
|
+
*/
|
|
35
|
+
export declare function dynamicValidateRequest<T>(request: T, config?: Partial<DynamicValidationConfig>): T;
|
|
36
|
+
/**
|
|
37
|
+
* Get information about discovered enums
|
|
38
|
+
*/
|
|
39
|
+
export declare function getEnumInfo(): {
|
|
40
|
+
totalEnums: number;
|
|
41
|
+
enumNames: string[];
|
|
42
|
+
enumDetails: Record<string, {
|
|
43
|
+
values: string[];
|
|
44
|
+
keys: string[];
|
|
45
|
+
}>;
|
|
46
|
+
};
|
|
47
|
+
export { DynamicEnumValidationError, DynamicValidationConfig, FieldTypeInfo };
|
|
48
|
+
export { enumRegistry };
|
|
@@ -0,0 +1,143 @@
|
|
|
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
|
+
/**
|
|
17
|
+
* Error thrown when a request contains invalid enum values
|
|
18
|
+
*/
|
|
19
|
+
export declare class DynamicEnumValidationError extends Error {
|
|
20
|
+
field: string;
|
|
21
|
+
value: string;
|
|
22
|
+
enumName: string;
|
|
23
|
+
validValues: string[];
|
|
24
|
+
validKeys?: string[] | undefined;
|
|
25
|
+
constructor(field: string, value: string, enumName: string, validValues: string[], validKeys?: string[] | undefined);
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Registry of all available enums for dynamic lookup
|
|
29
|
+
*/
|
|
30
|
+
declare class EnumRegistry {
|
|
31
|
+
private enumMap;
|
|
32
|
+
private enumNameMap;
|
|
33
|
+
constructor();
|
|
34
|
+
/**
|
|
35
|
+
* Automatically register all enums from the model/enums directory
|
|
36
|
+
*/
|
|
37
|
+
private registerAllEnums;
|
|
38
|
+
/**
|
|
39
|
+
* Check if an object is a valid enum
|
|
40
|
+
*/
|
|
41
|
+
private isValidEnum;
|
|
42
|
+
/**
|
|
43
|
+
* Get enum by name
|
|
44
|
+
*/
|
|
45
|
+
getEnum(enumName: string): Record<string, string> | undefined;
|
|
46
|
+
/**
|
|
47
|
+
* Get enum name for a given enum object
|
|
48
|
+
*/
|
|
49
|
+
getEnumName(enumObject: Record<string, string>): string | undefined;
|
|
50
|
+
/**
|
|
51
|
+
* Find enum that contains a specific value
|
|
52
|
+
*/
|
|
53
|
+
findEnumByValue(value: string): {
|
|
54
|
+
enum: Record<string, string>;
|
|
55
|
+
name: string;
|
|
56
|
+
} | undefined;
|
|
57
|
+
/**
|
|
58
|
+
* Find enum that contains a specific key
|
|
59
|
+
*/
|
|
60
|
+
findEnumByKey(key: string): {
|
|
61
|
+
enum: Record<string, string>;
|
|
62
|
+
name: string;
|
|
63
|
+
} | undefined;
|
|
64
|
+
/**
|
|
65
|
+
* Get all registered enum names
|
|
66
|
+
*/
|
|
67
|
+
getAllEnumNames(): string[];
|
|
68
|
+
/**
|
|
69
|
+
* Validate a value against a specific enum with prefix handling
|
|
70
|
+
*/
|
|
71
|
+
validateEnumValue(enumName: string, value: string): {
|
|
72
|
+
valid: boolean;
|
|
73
|
+
normalizedValue?: string;
|
|
74
|
+
error?: string;
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
declare const enumRegistry: EnumRegistry;
|
|
78
|
+
/**
|
|
79
|
+
* Validates and normalizes enum fields in a request object
|
|
80
|
+
*/
|
|
81
|
+
export declare function validateRequestEnums(request: any, options?: {
|
|
82
|
+
strict?: boolean;
|
|
83
|
+
autoNormalize?: boolean;
|
|
84
|
+
}): {
|
|
85
|
+
validatedRequest: any;
|
|
86
|
+
errors: string[];
|
|
87
|
+
};
|
|
88
|
+
/**
|
|
89
|
+
* Simplified validation function that throws on first error
|
|
90
|
+
*/
|
|
91
|
+
export declare function validateAndNormalizeRequest(request: any): any;
|
|
92
|
+
/**
|
|
93
|
+
* Configuration for dynamic validation
|
|
94
|
+
*/
|
|
95
|
+
export interface DynamicValidationConfig {
|
|
96
|
+
enabled?: boolean;
|
|
97
|
+
strict?: boolean;
|
|
98
|
+
autoNormalize?: boolean;
|
|
99
|
+
logWarnings?: boolean;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Set global dynamic validation configuration
|
|
103
|
+
*/
|
|
104
|
+
export declare function setDynamicValidationConfig(config: Partial<DynamicValidationConfig>): void;
|
|
105
|
+
/**
|
|
106
|
+
* Get current dynamic validation configuration
|
|
107
|
+
*/
|
|
108
|
+
export declare function getDynamicValidationConfig(): DynamicValidationConfig;
|
|
109
|
+
/**
|
|
110
|
+
* Type-safe dynamic enum validation function
|
|
111
|
+
*
|
|
112
|
+
* Automatically validates and normalizes enum values in request objects
|
|
113
|
+
* using the auto-generated prefix patterns from the OpenAPI specification.
|
|
114
|
+
*
|
|
115
|
+
* @param request - The request object to validate and normalize
|
|
116
|
+
* @param config - Optional validation configuration
|
|
117
|
+
* @returns The validated request with normalized enum values
|
|
118
|
+
*
|
|
119
|
+
* @example
|
|
120
|
+
* ```typescript
|
|
121
|
+
* const validated = dynamicValidateRequest<CreateOrderRequest>({
|
|
122
|
+
* portfolioId: 'portfolio-123',
|
|
123
|
+
* side: 'buy', // → 'BUY'
|
|
124
|
+
* type: 'market' // → 'MARKET'
|
|
125
|
+
* });
|
|
126
|
+
* ```
|
|
127
|
+
*/
|
|
128
|
+
export declare function dynamicValidateRequest<T>(request: T, config?: Partial<DynamicValidationConfig>): T;
|
|
129
|
+
/**
|
|
130
|
+
* Export the enum registry for advanced usage
|
|
131
|
+
*/
|
|
132
|
+
export { enumRegistry };
|
|
133
|
+
/**
|
|
134
|
+
* Utility function to get information about available enums
|
|
135
|
+
*/
|
|
136
|
+
export declare function getEnumInfo(): {
|
|
137
|
+
enumNames: string[];
|
|
138
|
+
totalEnums: number;
|
|
139
|
+
enumDetails: Record<string, {
|
|
140
|
+
values: string[];
|
|
141
|
+
keys: string[];
|
|
142
|
+
}>;
|
|
143
|
+
};
|