@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.
Files changed (77) hide show
  1. package/README.md +207 -67
  2. package/dist/addressBooks/index.js +2 -2
  3. package/dist/allocations/index.js +3 -3
  4. package/dist/client-manual.js +84 -0
  5. package/dist/client-modular.js +57 -0
  6. package/dist/client-only.js +31 -0
  7. package/dist/{client.js → clients/client.js} +12 -2
  8. package/dist/clients/clientWithServices.js +323 -0
  9. package/dist/{types/client.d.ts → clients/clientWithServicesTypes.js} +3 -6
  10. package/dist/clients/index.js +28 -0
  11. package/dist/clients/types.js +2 -0
  12. package/dist/constants.js +1 -1
  13. package/dist/futures/index.js +4 -4
  14. package/dist/index.js +27 -18
  15. package/dist/model/enumPrefixes.js +330 -0
  16. package/dist/onchainAddressBook/index.js +4 -4
  17. package/dist/orders/index.js +6 -6
  18. package/dist/paymentMethods/index.js +2 -1
  19. package/dist/services.js +75 -0
  20. package/dist/shared/dynamicEnumValidation.js +184 -0
  21. package/dist/shared/dynamicEnumValidation.old.js +746 -0
  22. package/dist/shared/enumHelpers.js +219 -0
  23. package/dist/shared/enumRegistry.js +153 -0
  24. package/dist/shared/enumValidationCore.js +194 -0
  25. package/dist/shared/enumValidators.js +115 -0
  26. package/dist/shared/envUtils.js +66 -0
  27. package/dist/shared/fieldMapping.js +242 -0
  28. package/dist/shared/serviceContext.js +157 -0
  29. package/dist/staking/index.js +5 -5
  30. package/dist/transactions/index.js +5 -5
  31. package/dist/types/activities/index.d.ts +2 -3
  32. package/dist/types/addressBooks/index.d.ts +2 -3
  33. package/dist/types/allocations/index.d.ts +2 -3
  34. package/dist/types/assets/index.d.ts +2 -3
  35. package/dist/types/balances/index.d.ts +2 -3
  36. package/dist/types/balances/types.d.ts +1 -1
  37. package/dist/types/client-manual.d.ts +58 -0
  38. package/dist/types/client-modular.d.ts +39 -0
  39. package/dist/types/client-only.d.ts +18 -0
  40. package/dist/types/clients/client.d.ts +27 -0
  41. package/dist/types/clients/clientWithServices.d.ts +229 -0
  42. package/dist/types/clients/clientWithServicesTypes.d.ts +115 -0
  43. package/dist/types/clients/index.d.ts +19 -0
  44. package/dist/types/clients/types.d.ts +48 -0
  45. package/dist/types/commission/index.d.ts +2 -3
  46. package/dist/types/constants.d.ts +1 -1
  47. package/dist/types/financing/index.d.ts +2 -3
  48. package/dist/types/futures/index.d.ts +2 -3
  49. package/dist/types/index.d.ts +2 -1
  50. package/dist/types/invoices/index.d.ts +2 -3
  51. package/dist/types/model/enumPrefixes.d.ts +206 -0
  52. package/dist/types/onchainAddressBook/index.d.ts +2 -3
  53. package/dist/types/orders/index.d.ts +2 -3
  54. package/dist/types/paymentMethods/index.d.ts +2 -3
  55. package/dist/types/paymentMethods/types.d.ts +1 -0
  56. package/dist/types/portfolios/index.d.ts +2 -3
  57. package/dist/types/positions/index.d.ts +2 -3
  58. package/dist/types/products/index.d.ts +2 -3
  59. package/dist/types/services.d.ts +39 -0
  60. package/dist/types/shared/dynamicEnumValidation.d.ts +48 -0
  61. package/dist/types/shared/dynamicEnumValidation.old.d.ts +143 -0
  62. package/dist/types/shared/enumHelpers.d.ts +135 -0
  63. package/dist/types/shared/enumRegistry.d.ts +74 -0
  64. package/dist/types/shared/enumValidationCore.d.ts +68 -0
  65. package/dist/types/shared/enumValidators.d.ts +117 -0
  66. package/dist/types/shared/envUtils.d.ts +36 -0
  67. package/dist/types/shared/fieldMapping.d.ts +35 -0
  68. package/dist/types/shared/paginatedResponse.d.ts +3 -4
  69. package/dist/types/shared/serviceContext.d.ts +46 -0
  70. package/dist/types/staking/index.d.ts +2 -3
  71. package/dist/types/transactions/index.d.ts +2 -3
  72. package/dist/types/types.d.ts +37 -0
  73. package/dist/types/users/index.d.ts +2 -3
  74. package/dist/types/wallets/index.d.ts +2 -3
  75. package/dist/types.js +39 -0
  76. package/dist/wallets/index.js +3 -3
  77. package/package.json +33 -2
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createCredentialsFromEnv = createCredentialsFromEnv;
4
+ /**
5
+ * Copyright 2025-present Coinbase Global, Inc.
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
+ const credentials_1 = require("../credentials");
20
+ /**
21
+ * Shared utility function to create credentials from environment variables
22
+ * Used by both CoinbasePrimeClient and CoinbasePrimeClientWithServices
23
+ *
24
+ * Automatically attempts to load .env file if dotenv is available.
25
+ * If dotenv is not installed or .env file doesn't exist, falls back to
26
+ * using environment variables set directly.
27
+ *
28
+ * @advanced For custom scenarios. Most users should use Client.fromEnv() instead.
29
+ * @example
30
+ * ```typescript
31
+ * // Basic usage (recommended)
32
+ * const client = CoinbasePrimeClient.fromEnv();
33
+ *
34
+ * // Advanced usage (custom scenarios)
35
+ * const credentials = createCredentialsFromEnv();
36
+ * const client = new CoinbasePrimeClient(credentials, 'custom-url');
37
+ * ```
38
+ */
39
+ function createCredentialsFromEnv() {
40
+ // Try to load .env file if dotenv is available (optional)
41
+ try {
42
+ require('dotenv').config();
43
+ }
44
+ catch (error) {
45
+ // dotenv not installed or .env file doesn't exist - that's fine
46
+ // Environment variables might be set directly via shell, Docker, CI/CD, etc.
47
+ }
48
+ const credsJson = process.env.PRIME_CREDENTIALS;
49
+ if (!credsJson) {
50
+ throw new Error('PRIME_CREDENTIALS environment variable is required. ' +
51
+ 'Set it to a JSON string with AccessKey, SecretKey, and Passphrase. ' +
52
+ 'You can set it directly (export PRIME_CREDENTIALS=\'{"AccessKey":"...","SecretKey":"...","Passphrase":"..."}\') ' +
53
+ 'or create a .env file with PRIME_CREDENTIALS={"AccessKey":"...","SecretKey":"...","Passphrase":"..."}.');
54
+ }
55
+ let creds;
56
+ try {
57
+ creds = JSON.parse(credsJson);
58
+ }
59
+ catch (error) {
60
+ throw new Error('PRIME_CREDENTIALS must be valid JSON with AccessKey, SecretKey, and Passphrase fields.');
61
+ }
62
+ if (!creds.AccessKey || !creds.SecretKey || !creds.Passphrase) {
63
+ throw new Error('PRIME_CREDENTIALS must contain AccessKey, SecretKey, and Passphrase fields.');
64
+ }
65
+ return new credentials_1.CoinbasePrimeCredentials(creds.AccessKey, creds.SecretKey, creds.Passphrase);
66
+ }
@@ -0,0 +1,242 @@
1
+ "use strict";
2
+ /**
3
+ * Copyright 2025-present Coinbase Global, Inc.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.getFieldNameVariations = getFieldNameVariations;
19
+ exports.extractContextClues = extractContextClues;
20
+ exports.findEnumWithContext = findEnumWithContext;
21
+ exports.findEnumByFieldName = findEnumByFieldName;
22
+ exports.getDirectEnumMapping = getDirectEnumMapping;
23
+ /**
24
+ * Field-to-enum mapping logic for dynamic enum detection
25
+ */
26
+ const enumRegistry_1 = require("./enumRegistry");
27
+ const serviceContext_1 = require("./serviceContext");
28
+ /**
29
+ * Generate field name variations for plural/singular matching
30
+ */
31
+ function getFieldNameVariations(fieldName) {
32
+ const variations = [fieldName];
33
+ // Handle irregular plurals and common patterns
34
+ const irregularPlurals = {
35
+ categories: 'category',
36
+ statuses: 'status',
37
+ activities: 'activity',
38
+ entities: 'entity',
39
+ currencies: 'currency',
40
+ portfolios: 'portfolio',
41
+ };
42
+ const irregularSingulars = {
43
+ category: 'categories',
44
+ status: 'statuses',
45
+ activity: 'activities',
46
+ entity: 'entities',
47
+ currency: 'currencies',
48
+ portfolio: 'portfolios',
49
+ };
50
+ // Check irregular mappings first
51
+ if (irregularPlurals[fieldName]) {
52
+ variations.push(irregularPlurals[fieldName]);
53
+ }
54
+ if (irregularSingulars[fieldName]) {
55
+ variations.push(irregularSingulars[fieldName]);
56
+ }
57
+ // Handle regular -s plurals only if not already handled by irregular rules
58
+ if (!irregularPlurals[fieldName] && !irregularSingulars[fieldName]) {
59
+ if (fieldName.endsWith('s') && fieldName.length > 3) {
60
+ // Remove 's' for potential singular
61
+ const singular = fieldName.slice(0, -1);
62
+ // Avoid cases like "address" -> "addres"
63
+ if (!singular.endsWith('s')) {
64
+ variations.push(singular);
65
+ }
66
+ }
67
+ else {
68
+ // Add regular plural
69
+ variations.push(fieldName + 's');
70
+ }
71
+ }
72
+ return variations;
73
+ }
74
+ /**
75
+ * Extract context clues from field names to resolve enum ambiguity
76
+ */
77
+ function extractContextClues(fieldName) {
78
+ const clues = [];
79
+ const fieldLower = fieldName.toLowerCase();
80
+ // Extract prefix context (e.g., "activitystatus" → ["activity"])
81
+ const prefixMatch = fieldLower.match(/^([a-z]+?)(?:status|type|category)$/);
82
+ if (prefixMatch) {
83
+ clues.push(prefixMatch[1]);
84
+ }
85
+ // Extract camelCase components (e.g., "activityStatus" → ["activity"])
86
+ const camelComponents = fieldName
87
+ .replace(/([A-Z])/g, '_$1')
88
+ .toLowerCase()
89
+ .split('_')
90
+ .filter(Boolean);
91
+ clues.push(...camelComponents.slice(0, -1)); // Exclude the last component (status/type/category)
92
+ // Extract underscore/dash separated components
93
+ const separatedComponents = fieldName.toLowerCase().split(/[_-]+/);
94
+ clues.push(...separatedComponents.slice(0, -1));
95
+ return [...new Set(clues)]; // Remove duplicates
96
+ }
97
+ /**
98
+ * Find enum with context awareness to resolve collisions
99
+ */
100
+ function findEnumWithContext(fieldName, allEnumNames) {
101
+ // Handle ambiguous suffixes that appear in multiple enums
102
+ const ambiguousSuffixes = ['status', 'type', 'category'];
103
+ const fieldLower = fieldName.toLowerCase();
104
+ // Check if this is an ambiguous field name
105
+ const isAmbiguous = ambiguousSuffixes.some((suffix) => fieldLower.endsWith(suffix) || fieldLower === suffix);
106
+ if (isAmbiguous) {
107
+ // For ambiguous cases, look for context clues in the field name
108
+ const contextClues = extractContextClues(fieldName);
109
+ // Find enum that best matches the context
110
+ const matches = allEnumNames.filter((enumName) => {
111
+ const enumLower = enumName.toLowerCase();
112
+ // Exact compound match (e.g., "activitystatus" → "ActivityStatus")
113
+ if (enumLower === fieldLower)
114
+ return true;
115
+ // Context-based matching
116
+ for (const clue of contextClues) {
117
+ if (enumLower.includes(clue) &&
118
+ enumLower.endsWith(fieldLower.split(/(?=[a-z])/).pop() || '')) {
119
+ return true;
120
+ }
121
+ }
122
+ return false;
123
+ });
124
+ // Return the most specific match
125
+ if (matches.length === 1) {
126
+ return matches[0];
127
+ }
128
+ // If multiple matches, prefer the longest/most specific one
129
+ if (matches.length > 1) {
130
+ return matches.reduce((longest, current) => current.length > longest.length ? current : longest);
131
+ }
132
+ }
133
+ // Non-ambiguous cases: use careful substring matching
134
+ // Sort enums by name length (shortest first) to prefer simpler matches
135
+ const sortedEnumNames = allEnumNames
136
+ .slice()
137
+ .sort((a, b) => a.length - b.length);
138
+ for (const enumName of sortedEnumNames) {
139
+ const enumNameLower = enumName.toLowerCase();
140
+ // Only match if field name is a meaningful part of the enum name
141
+ // Avoid greedy matches like "side" matching "FcmPositionSide"
142
+ if (enumNameLower === fieldLower) {
143
+ return enumName; // Exact match
144
+ }
145
+ // Check if field name appears as a word boundary in enum name
146
+ // e.g., "side" should match "OrderSide" but not "FcmPositionSide"
147
+ const wordBoundaryRegex = new RegExp(`\\b${fieldLower}\\b`, 'i');
148
+ if (wordBoundaryRegex.test(enumName)) {
149
+ return enumName;
150
+ }
151
+ // Check for field name at the end of enum name (most common pattern)
152
+ if (enumNameLower.endsWith(fieldLower) && enumNameLower !== fieldLower) {
153
+ // Ensure it's not a substring within a word
154
+ const beforeField = enumNameLower.slice(0, -fieldLower.length);
155
+ if (beforeField.length > 0 && /[a-z]$/.test(beforeField)) {
156
+ continue; // Skip if it's part of a word
157
+ }
158
+ return enumName;
159
+ }
160
+ }
161
+ return null;
162
+ }
163
+ /**
164
+ * Dynamically find enum name based on field name patterns
165
+ */
166
+ function findEnumByFieldName(fieldName) {
167
+ const allEnumNames = enumRegistry_1.enumRegistry.getAllEnumNames();
168
+ // Strategy 1: Direct name match (e.g., "ActivityCategory" field → "ActivityCategory" enum)
169
+ const exactMatch = allEnumNames.find((enumName) => enumName.toLowerCase() === fieldName.toLowerCase());
170
+ if (exactMatch)
171
+ return exactMatch;
172
+ // Strategy 2: Smart plural/singular variations
173
+ const variations = getFieldNameVariations(fieldName);
174
+ for (const enumName of allEnumNames) {
175
+ const enumNameLower = enumName.toLowerCase();
176
+ if (variations.includes(enumNameLower)) {
177
+ return enumName;
178
+ }
179
+ }
180
+ // Strategy 3: Context-aware enum matching (handles collisions)
181
+ const contextMatch = findEnumWithContext(fieldName, allEnumNames);
182
+ if (contextMatch) {
183
+ return contextMatch;
184
+ }
185
+ // Strategy 4: Smart pattern matching for compound field names
186
+ // Handle cases like "activitycategory" → "ActivityCategory"
187
+ for (const enumName of allEnumNames) {
188
+ const enumWords = enumName
189
+ .toLowerCase()
190
+ .replace(/([A-Z])/g, ' $1')
191
+ .trim()
192
+ .split(' ');
193
+ const fieldWords = fieldName
194
+ .replace(/([A-Z])/g, ' $1')
195
+ .trim()
196
+ .split(/[\s_-]+/);
197
+ // Check if all field words are contained in enum words
198
+ const allWordsMatch = fieldWords.every((word) => enumWords.some((enumWord) => enumWord.includes(word) || word.includes(enumWord)));
199
+ if (allWordsMatch && fieldWords.length > 1) {
200
+ return enumName;
201
+ }
202
+ }
203
+ return null;
204
+ }
205
+ /**
206
+ * Get direct field-to-enum mapping with service context and fallback to essential mappings
207
+ */
208
+ function getDirectEnumMapping(fieldName, serviceName) {
209
+ const fieldNameLower = fieldName.toLowerCase();
210
+ // First priority: Service context-specific mapping
211
+ if (serviceName) {
212
+ const serviceMapping = (0, serviceContext_1.resolveFieldWithServiceContext)(fieldName, serviceName);
213
+ if (serviceMapping) {
214
+ return serviceMapping;
215
+ }
216
+ }
217
+ // Second priority: Dynamic enum name matching
218
+ const dynamicMatch = findEnumByFieldName(fieldNameLower);
219
+ if (dynamicMatch) {
220
+ return dynamicMatch;
221
+ }
222
+ // Fall back to essential manual mappings for common patterns that don't follow naming conventions
223
+ // These should be conservative and only include non-ambiguous cases
224
+ const essentialMappings = {
225
+ // Common trading/order fields (most frequent use case)
226
+ side: 'OrderSide',
227
+ status: 'OrderStatus', // Default to OrderStatus, validation will catch mismatches
228
+ role: 'UserRole',
229
+ action: 'Action',
230
+ direction: 'SortDirection',
231
+ // Specific compound fields to prevent wrong mappings
232
+ orderside: 'OrderSide',
233
+ ordertype: 'OrderType',
234
+ orderstatus: 'OrderStatus',
235
+ wallettype: 'WalletType',
236
+ transactiontype: 'TransactionType',
237
+ activitytype: 'CustodyActivityType',
238
+ activitystatus: 'ActivityStatus',
239
+ // Note: 'type' still removed (too ambiguous - let value-based detection handle it)
240
+ };
241
+ return essentialMappings[fieldNameLower] || null;
242
+ }
@@ -0,0 +1,157 @@
1
+ "use strict";
2
+ /**
3
+ * Copyright 2025-present Coinbase Global, Inc.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.SERVICE_CONTEXTS = void 0;
19
+ exports.getServiceContext = getServiceContext;
20
+ exports.resolveFieldWithServiceContext = resolveFieldWithServiceContext;
21
+ exports.getAllServiceContexts = getAllServiceContexts;
22
+ exports.hasServiceContext = hasServiceContext;
23
+ /**
24
+ * Registry of service contexts for accurate enum detection
25
+ */
26
+ exports.SERVICE_CONTEXTS = {
27
+ // Activities Service
28
+ activities: {
29
+ serviceName: 'ActivitiesService',
30
+ fieldMappings: {
31
+ status: 'ActivityStatus',
32
+ type: 'CustodyActivityType',
33
+ category: 'ActivityCategory',
34
+ categories: 'ActivityCategory',
35
+ secondaryType: 'ActivitySecondaryType',
36
+ },
37
+ description: 'Portfolio and entity activity operations',
38
+ },
39
+ // Orders Service
40
+ orders: {
41
+ serviceName: 'OrdersService',
42
+ fieldMappings: {
43
+ status: 'OrderStatus',
44
+ type: 'OrderType',
45
+ side: 'OrderSide',
46
+ timeInForce: 'TimeInForceType',
47
+ },
48
+ description: 'Trading order operations',
49
+ },
50
+ // Transactions Service
51
+ transactions: {
52
+ serviceName: 'TransactionsService',
53
+ fieldMappings: {
54
+ status: 'TransactionStatus',
55
+ type: 'TransactionType',
56
+ destinationType: 'DestinationType',
57
+ },
58
+ description: 'Transaction and transfer operations',
59
+ },
60
+ // Wallets Service
61
+ wallets: {
62
+ serviceName: 'WalletsService',
63
+ fieldMappings: {
64
+ type: 'WalletType',
65
+ status: 'WalletStatus',
66
+ },
67
+ description: 'Wallet management operations',
68
+ },
69
+ // Allocations Service
70
+ allocations: {
71
+ serviceName: 'AllocationsService',
72
+ fieldMappings: {
73
+ status: 'AllocationStatus',
74
+ type: 'AllocationType',
75
+ },
76
+ description: 'Portfolio allocation operations',
77
+ },
78
+ // Users Service
79
+ users: {
80
+ serviceName: 'UsersService',
81
+ fieldMappings: {
82
+ role: 'UserRole',
83
+ status: 'UserStatus',
84
+ },
85
+ description: 'User management operations',
86
+ },
87
+ // Balances Service
88
+ balances: {
89
+ serviceName: 'BalancesService',
90
+ fieldMappings: {
91
+ type: 'PortfolioBalanceType',
92
+ },
93
+ description: 'Balance and portfolio operations',
94
+ },
95
+ // Portfolios Service
96
+ portfolios: {
97
+ serviceName: 'PortfoliosService',
98
+ fieldMappings: {
99
+ type: 'PortfolioType',
100
+ status: 'PortfolioStatus',
101
+ },
102
+ description: 'Portfolio management operations',
103
+ },
104
+ // Products Service
105
+ products: {
106
+ serviceName: 'ProductsService',
107
+ fieldMappings: {
108
+ type: 'ProductType',
109
+ permissions: 'ProductPermissions',
110
+ category: 'ProductCategory',
111
+ },
112
+ description: 'Product and market data operations',
113
+ },
114
+ // Assets Service
115
+ assets: {
116
+ serviceName: 'AssetsService',
117
+ fieldMappings: {
118
+ type: 'AssetType',
119
+ status: 'AssetStatus',
120
+ },
121
+ description: 'Asset management operations',
122
+ },
123
+ };
124
+ /**
125
+ * Get service context by service name
126
+ */
127
+ function getServiceContext(serviceName) {
128
+ // Normalize service name (remove "Service" suffix if present)
129
+ const normalizedName = serviceName.toLowerCase().replace(/service$/, '');
130
+ return exports.SERVICE_CONTEXTS[normalizedName] || null;
131
+ }
132
+ /**
133
+ * Resolve field to enum using service context
134
+ */
135
+ function resolveFieldWithServiceContext(fieldName, serviceName) {
136
+ if (!serviceName) {
137
+ return null;
138
+ }
139
+ const context = getServiceContext(serviceName);
140
+ if (!context) {
141
+ return null;
142
+ }
143
+ const fieldLower = fieldName.toLowerCase();
144
+ return context.fieldMappings[fieldLower] || null;
145
+ }
146
+ /**
147
+ * Get all available service contexts
148
+ */
149
+ function getAllServiceContexts() {
150
+ return Object.assign({}, exports.SERVICE_CONTEXTS);
151
+ }
152
+ /**
153
+ * Check if a service has context defined
154
+ */
155
+ function hasServiceContext(serviceName) {
156
+ return getServiceContext(serviceName) !== null;
157
+ }
@@ -25,7 +25,7 @@ exports.StakingService = void 0;
25
25
  * See the License for the specific language governing permissions and
26
26
  * limitations under the License.
27
27
  */
28
- const core_ts_1 = require("@coinbase-sample/core-ts");
28
+ const clients_1 = require("../clients");
29
29
  class StakingService {
30
30
  constructor(client) {
31
31
  this.client = client;
@@ -35,7 +35,7 @@ class StakingService {
35
35
  const bodyParams = Object.assign(Object.assign({}, request), { portfolioId: undefined, walletId: undefined });
36
36
  const response = yield this.client.request({
37
37
  url: `portfolios/${request.portfolioId}/wallets/${request.walletId}/staking/initiate`,
38
- method: core_ts_1.Method.POST,
38
+ method: clients_1.Method.POST,
39
39
  bodyParams,
40
40
  callOptions: options,
41
41
  });
@@ -47,7 +47,7 @@ class StakingService {
47
47
  const bodyParams = Object.assign(Object.assign({}, request), { portfolioId: undefined, walletId: undefined });
48
48
  const response = yield this.client.request({
49
49
  url: `portfolios/${request.portfolioId}/wallets/${request.walletId}/staking/unstake`,
50
- method: core_ts_1.Method.POST,
50
+ method: clients_1.Method.POST,
51
51
  bodyParams,
52
52
  callOptions: options,
53
53
  });
@@ -59,7 +59,7 @@ class StakingService {
59
59
  const bodyParams = Object.assign(Object.assign({}, request), { portfolioId: undefined });
60
60
  const response = yield this.client.request({
61
61
  url: `portfolios/${request.portfolioId}/staking/initiate`,
62
- method: core_ts_1.Method.POST,
62
+ method: clients_1.Method.POST,
63
63
  bodyParams,
64
64
  callOptions: options,
65
65
  });
@@ -71,7 +71,7 @@ class StakingService {
71
71
  const bodyParams = Object.assign(Object.assign({}, request), { portfolioId: undefined });
72
72
  const response = yield this.client.request({
73
73
  url: `portfolios/${request.portfolioId}/staking/unstake`,
74
- method: core_ts_1.Method.POST,
74
+ method: clients_1.Method.POST,
75
75
  bodyParams,
76
76
  callOptions: options,
77
77
  });
@@ -36,7 +36,7 @@ exports.TransactionsService = void 0;
36
36
  * See the License for the specific language governing permissions and
37
37
  * limitations under the License.
38
38
  */
39
- const core_ts_1 = require("@coinbase-sample/core-ts");
39
+ const clients_1 = require("../clients");
40
40
  const paginatedResponse_1 = require("../shared/paginatedResponse");
41
41
  class TransactionsService {
42
42
  constructor(client) {
@@ -91,7 +91,7 @@ class TransactionsService {
91
91
  const response = yield this.client.request({
92
92
  url: `portfolios/${request.portfolioId}/wallets/${request.walletId}/conversion`,
93
93
  bodyParams,
94
- method: core_ts_1.Method.POST,
94
+ method: clients_1.Method.POST,
95
95
  callOptions: options,
96
96
  });
97
97
  return response.data;
@@ -103,7 +103,7 @@ class TransactionsService {
103
103
  const response = yield this.client.request({
104
104
  url: `portfolios/${request.portfolioId}/wallets/${request.walletId}/transfers`,
105
105
  bodyParams,
106
- method: core_ts_1.Method.POST,
106
+ method: clients_1.Method.POST,
107
107
  callOptions: options,
108
108
  });
109
109
  return response.data;
@@ -115,7 +115,7 @@ class TransactionsService {
115
115
  const response = yield this.client.request({
116
116
  url: `portfolios/${request.portfolioId}/wallets/${request.walletId}/withdrawals`,
117
117
  bodyParams,
118
- method: core_ts_1.Method.POST,
118
+ method: clients_1.Method.POST,
119
119
  callOptions: options,
120
120
  });
121
121
  return response.data;
@@ -127,7 +127,7 @@ class TransactionsService {
127
127
  const response = yield this.client.request({
128
128
  url: `portfolios/${request.portfolioId}/wallets/${request.walletId}/onchain_transaction`,
129
129
  bodyParams,
130
- method: core_ts_1.Method.POST,
130
+ method: clients_1.Method.POST,
131
131
  callOptions: options,
132
132
  });
133
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>;
@@ -19,7 +19,7 @@ import { GetPortfolioBalancesResponse, GetWalletBalanceResponse as internalGetRe
19
19
  import { BasePaginatedRequest, PaginatedResponseMethods } from '../shared/paginatedResponse';
20
20
  export type ListPortfolioBalancesRequest = {
21
21
  portfolioId: string;
22
- symbol: string;
22
+ symbols?: string[];
23
23
  balanceType?: PortfolioBalanceType;
24
24
  };
25
25
  export type ListPortfolioBalancesResponse = Brand<GetPortfolioBalancesResponse, 'ListPortfolioBalancesResponse'>;