@coinbase-sample/prime-sdk-ts 0.6.3 → 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/dist/constants.js +1 -1
- package/dist/model/enumPrefixes.js +330 -0
- package/dist/paymentMethods/index.js +2 -1
- 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/fieldMapping.js +242 -0
- package/dist/shared/serviceContext.js +157 -0
- package/dist/types/balances/types.d.ts +1 -1
- package/dist/types/constants.d.ts +1 -1
- package/dist/types/model/enumPrefixes.d.ts +206 -0
- package/dist/types/paymentMethods/types.d.ts +1 -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/fieldMapping.d.ts +35 -0
- package/dist/types/shared/serviceContext.d.ts +46 -0
- package/package.json +2 -2
|
@@ -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
|
+
}
|
|
@@ -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
|
-
|
|
22
|
+
symbols?: string[];
|
|
23
23
|
balanceType?: PortfolioBalanceType;
|
|
24
24
|
};
|
|
25
25
|
export type ListPortfolioBalancesResponse = Brand<GetPortfolioBalancesResponse, 'ListPortfolioBalancesResponse'>;
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
export declare const VERSION = "0.6.
|
|
16
|
+
export declare const VERSION = "0.6.4";
|
|
17
17
|
export declare const API_BASE_PATH = "https://api.prime.coinbase.com/v1/";
|
|
18
18
|
export declare const USER_AGENT: string;
|
|
19
19
|
export declare const CB_ACCESS_KEY_HEADER = "X-CB-ACCESS-KEY";
|
|
@@ -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];
|
|
@@ -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'>;
|