@coinbase-sample/prime-sdk-ts 0.7.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/constants.js +1 -1
- package/dist/financing/index.js +18 -0
- package/dist/futures/index.js +20 -0
- package/dist/model/Candle.js +21 -0
- package/dist/model/DateOfBirth.js +21 -0
- package/dist/model/DetailedAddress.js +21 -0
- package/dist/model/GetCandlesResponse.js +21 -0
- package/dist/model/GetFcmSettingsResponse.js +21 -0
- package/dist/model/GetUnstakingStatusResponse.js +21 -0
- package/dist/model/ListFinancingEligibleAssetsResponse.js +21 -0
- package/dist/model/ListTFObligationsResponse.js +21 -0
- package/dist/model/NaturalPersonName.js +21 -0
- package/dist/model/PreviewUnstakeRequest.js +21 -0
- package/dist/model/PreviewUnstakeResponse.js +21 -0
- package/dist/model/ProcessRequirements.js +21 -0
- package/dist/model/RewardMetadata.js +21 -0
- package/dist/model/SetFcmSettingsRequest.js +21 -0
- package/dist/model/SetFcmSettingsResponse.js +21 -0
- package/dist/model/TFAsset.js +21 -0
- package/dist/model/TFObligation.js +21 -0
- package/dist/model/TravelRuleEntry.js +21 -0
- package/dist/model/TravelRuleParty.js +21 -0
- package/dist/model/TravelRuleWalletDetails.js +21 -0
- package/dist/model/UnstakingStatus.js +21 -0
- package/dist/model/VASP.js +21 -0
- package/dist/model/ValidatorUnstakingInfo.js +21 -0
- package/dist/model/enums/CandlesGranularity.js +34 -0
- package/dist/model/enums/EstimateType.js +28 -0
- package/dist/model/enums/OrderType.js +2 -1
- package/dist/model/enums/PegOffsetType.js +31 -0
- package/dist/model/enums/RewardSubtype.js +34 -0
- package/dist/model/enums/TransactionType.js +3 -1
- package/dist/model/enums/TravelRuleStatus.js +28 -0
- package/dist/model/enums/TravelRuleWalletType.js +31 -0
- package/dist/model/enums/UnstakeType.js +28 -0
- package/dist/model/enums/UserRole.js +2 -1
- package/dist/model/enums/XMCallType.js +2 -1
- package/dist/model/enums/XMEntityCallStatus.js +2 -1
- package/dist/model/enums/index.js +16 -1
- package/dist/products/index.js +16 -0
- package/dist/shared/__tests__/validation.test.js +210 -0
- package/dist/shared/validation.js +380 -0
- package/dist/staking/index.js +22 -0
- package/dist/types/activities/types.d.ts +1 -0
- package/dist/types/constants.d.ts +1 -1
- package/dist/types/financing/index.d.ts +5 -1
- package/dist/types/financing/types.d.ts +7 -1
- package/dist/types/futures/index.d.ts +6 -2
- package/dist/types/futures/types.d.ts +10 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/model/Candle.d.ts +42 -0
- package/dist/types/model/CreateOrderRequest.d.ts +8 -1
- package/dist/types/model/CreatePortfolioAddressBookEntryRequest.d.ts +6 -0
- package/dist/types/model/DateOfBirth.d.ts +24 -0
- package/dist/types/model/DetailedAddress.d.ts +28 -0
- package/dist/types/model/GetCandlesResponse.d.ts +23 -0
- package/dist/types/model/GetFcmSettingsResponse.d.ts +25 -0
- package/dist/types/model/GetUnstakingStatusResponse.d.ts +42 -0
- package/dist/types/model/ListFinancingEligibleAssetsResponse.d.ts +26 -0
- package/dist/types/model/ListTFObligationsResponse.d.ts +26 -0
- package/dist/types/model/NaturalPersonName.d.ts +24 -0
- package/dist/types/model/NetworkDetails.d.ts +4 -0
- package/dist/types/model/Order.d.ts +12 -0
- package/dist/types/model/OrderPreviewRequest.d.ts +7 -0
- package/dist/types/model/PreviewUnstakeRequest.d.ts +28 -0
- package/dist/types/model/PreviewUnstakeResponse.d.ts +28 -0
- package/dist/types/model/ProcessRequirements.d.ts +23 -0
- package/dist/types/model/RewardMetadata.d.ts +23 -0
- package/dist/types/model/SetFcmSettingsRequest.d.ts +25 -0
- package/dist/types/model/SetFcmSettingsResponse.d.ts +25 -0
- package/dist/types/model/TFAsset.d.ts +33 -0
- package/dist/types/model/TFObligation.d.ts +41 -0
- package/dist/types/model/Transaction.d.ts +2 -0
- package/dist/types/model/TransactionMetadata.d.ts +2 -0
- package/dist/types/model/TravelRuleEntry.d.ts +38 -0
- package/dist/types/model/TravelRuleParty.d.ts +32 -0
- package/dist/types/model/TravelRuleWalletDetails.d.ts +28 -0
- package/dist/types/model/UnstakingStatus.d.ts +45 -0
- package/dist/types/model/VASP.d.ts +27 -0
- package/dist/types/model/ValidatorUnstakingInfo.d.ts +30 -0
- package/dist/types/model/enums/CandlesGranularity.d.ts +30 -0
- package/dist/types/model/enums/EstimateType.d.ts +24 -0
- package/dist/types/model/enums/OrderType.d.ts +3 -2
- package/dist/types/model/enums/PegOffsetType.d.ts +27 -0
- package/dist/types/model/enums/RewardSubtype.d.ts +30 -0
- package/dist/types/model/enums/TransactionType.d.ts +4 -2
- package/dist/types/model/enums/TravelRuleStatus.d.ts +24 -0
- package/dist/types/model/enums/TravelRuleWalletType.d.ts +27 -0
- package/dist/types/model/enums/UnstakeType.d.ts +24 -0
- package/dist/types/model/enums/UserRole.d.ts +3 -2
- package/dist/types/model/enums/XMCallType.d.ts +3 -2
- package/dist/types/model/enums/XMEntityCallStatus.d.ts +3 -2
- package/dist/types/model/enums/index.d.ts +7 -0
- package/dist/types/model/index.d.ts +23 -0
- package/dist/types/products/index.d.ts +3 -1
- package/dist/types/products/types.d.ts +10 -1
- package/dist/types/shared/__tests__/validation.test.d.ts +1 -0
- package/dist/types/shared/validation.d.ts +176 -0
- package/dist/types/staking/index.d.ts +5 -1
- package/dist/types/staking/types.d.ts +12 -1
- package/dist/types/transactions/types.d.ts +3 -1
- package/dist/types/wallets/types.d.ts +1 -0
- package/package.json +8 -8
|
@@ -0,0 +1,380 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PropertyValidator = exports.ValidationResult = void 0;
|
|
4
|
+
exports.isValidUUID = isValidUUID;
|
|
5
|
+
exports.validateRequiredUUID = validateRequiredUUID;
|
|
6
|
+
exports.validateOptionalUUID = validateOptionalUUID;
|
|
7
|
+
exports.validateRequiredString = validateRequiredString;
|
|
8
|
+
exports.validateOptionalString = validateOptionalString;
|
|
9
|
+
exports.createValidator = createValidator;
|
|
10
|
+
exports.validate = validate;
|
|
11
|
+
/**
|
|
12
|
+
* Copyright 2025-present Coinbase Global, Inc.
|
|
13
|
+
*
|
|
14
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
15
|
+
* you may not use this file except in compliance with the License.
|
|
16
|
+
* You may obtain a copy of the License at
|
|
17
|
+
*
|
|
18
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
19
|
+
*
|
|
20
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
21
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
22
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
23
|
+
* See the License for the specific language governing permissions and
|
|
24
|
+
* limitations under the License.
|
|
25
|
+
*/
|
|
26
|
+
const errors_1 = require("../errors");
|
|
27
|
+
const UUID_REGEX = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
28
|
+
/**
|
|
29
|
+
* Validation result that accumulates errors with fluent/builder pattern support
|
|
30
|
+
*/
|
|
31
|
+
class ValidationResult {
|
|
32
|
+
constructor() {
|
|
33
|
+
this.errors = [];
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Add a validation error
|
|
37
|
+
*/
|
|
38
|
+
addError(paramName, message, value) {
|
|
39
|
+
this.errors.push({ paramName, message, value });
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Check if there are any validation errors
|
|
43
|
+
*/
|
|
44
|
+
hasErrors() {
|
|
45
|
+
return this.errors.length > 0;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Get all validation errors
|
|
49
|
+
*/
|
|
50
|
+
getErrors() {
|
|
51
|
+
return [...this.errors];
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Validates that a required UUID parameter is present and valid.
|
|
55
|
+
* Returns this for method chaining.
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* ```typescript
|
|
59
|
+
* validator
|
|
60
|
+
* .validateRequiredUUID(request.portfolioId, 'portfolioId')
|
|
61
|
+
* .validateRequiredUUID(request.orderId, 'orderId')
|
|
62
|
+
* .check();
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
65
|
+
validateRequiredUUID(value, paramName) {
|
|
66
|
+
if (value === undefined || value === null || value === '') {
|
|
67
|
+
this.addError(paramName, 'is required and cannot be empty', value);
|
|
68
|
+
return this;
|
|
69
|
+
}
|
|
70
|
+
const trimmedValue = typeof value === 'string' ? value.trim() : value;
|
|
71
|
+
if (trimmedValue === '') {
|
|
72
|
+
this.addError(paramName, 'cannot be empty or whitespace only', value);
|
|
73
|
+
return this;
|
|
74
|
+
}
|
|
75
|
+
if (!isValidUUID(trimmedValue)) {
|
|
76
|
+
this.addError(paramName, 'must be a valid UUID', value);
|
|
77
|
+
}
|
|
78
|
+
return this;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Validates that an optional UUID parameter is valid if provided.
|
|
82
|
+
* Returns this for method chaining.
|
|
83
|
+
*/
|
|
84
|
+
validateOptionalUUID(value, paramName) {
|
|
85
|
+
if (value === undefined || value === null || value === '') {
|
|
86
|
+
return this; // Optional, so undefined/null/empty is valid
|
|
87
|
+
}
|
|
88
|
+
const trimmedValue = typeof value === 'string' ? value.trim() : value;
|
|
89
|
+
if (trimmedValue !== '' && !isValidUUID(trimmedValue)) {
|
|
90
|
+
this.addError(paramName, 'must be a valid UUID if provided', value);
|
|
91
|
+
}
|
|
92
|
+
return this;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Validates that a required string parameter is present and not empty.
|
|
96
|
+
* Returns this for method chaining.
|
|
97
|
+
*/
|
|
98
|
+
validateRequiredString(value, paramName) {
|
|
99
|
+
if (value === undefined || value === null || value === '') {
|
|
100
|
+
this.addError(paramName, 'is required and cannot be empty', value);
|
|
101
|
+
return this;
|
|
102
|
+
}
|
|
103
|
+
const trimmedValue = typeof value === 'string' ? value.trim() : value;
|
|
104
|
+
if (trimmedValue === '') {
|
|
105
|
+
this.addError(paramName, 'cannot be empty or whitespace only', value);
|
|
106
|
+
}
|
|
107
|
+
return this;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Validates that an optional string parameter is not empty if provided.
|
|
111
|
+
* Returns this for method chaining.
|
|
112
|
+
*/
|
|
113
|
+
validateOptionalString(value, paramName) {
|
|
114
|
+
if (value === undefined || value === null) {
|
|
115
|
+
return this; // Optional, so undefined/null is valid
|
|
116
|
+
}
|
|
117
|
+
if (typeof value === 'string') {
|
|
118
|
+
const trimmedValue = value.trim();
|
|
119
|
+
if (value !== '' && trimmedValue === '') {
|
|
120
|
+
this.addError(paramName, 'cannot be whitespace only if provided', value);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
return this;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Throw an exception if there are validation errors.
|
|
127
|
+
* Automatically detects the calling method name if no context is provided.
|
|
128
|
+
*
|
|
129
|
+
* @param contextMessage - Optional context message. If not provided, attempts to detect method name.
|
|
130
|
+
* @throws {CoinbasePrimeClientException} if there are validation errors
|
|
131
|
+
*
|
|
132
|
+
* @example
|
|
133
|
+
* ```typescript
|
|
134
|
+
* const validator = createValidator();
|
|
135
|
+
* validateRequiredUUID(validator, request.id, 'id');
|
|
136
|
+
* validator.throwIfInvalid(); // Automatically detects calling method
|
|
137
|
+
* ```
|
|
138
|
+
*/
|
|
139
|
+
throwIfInvalid(contextMessage) {
|
|
140
|
+
if (this.hasErrors()) {
|
|
141
|
+
const errorDetails = this.errors
|
|
142
|
+
.map((err) => {
|
|
143
|
+
const valueInfo = err.value !== undefined ? ` (received: '${err.value}')` : '';
|
|
144
|
+
return ` - ${err.paramName}: ${err.message}${valueInfo}`;
|
|
145
|
+
})
|
|
146
|
+
.join('\n');
|
|
147
|
+
const prefix = contextMessage || this.getCallerContext();
|
|
148
|
+
throw new errors_1.CoinbasePrimeClientException(`${prefix}:\n${errorDetails}`);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Alias for throwIfInvalid() - more natural for fluent/builder pattern.
|
|
153
|
+
* Throw an exception if there are validation errors.
|
|
154
|
+
*
|
|
155
|
+
* @param contextMessage - Optional context message. If not provided, attempts to detect method name.
|
|
156
|
+
* @throws {CoinbasePrimeClientException} if there are validation errors
|
|
157
|
+
*
|
|
158
|
+
* @example
|
|
159
|
+
* ```typescript
|
|
160
|
+
* validator
|
|
161
|
+
* .validateRequiredUUID(request.portfolioId, 'portfolioId')
|
|
162
|
+
* .validateRequiredUUID(request.orderId, 'orderId')
|
|
163
|
+
* .check(); // ✅ Fluent pattern
|
|
164
|
+
* ```
|
|
165
|
+
*/
|
|
166
|
+
check(contextMessage) {
|
|
167
|
+
this.throwIfInvalid(contextMessage);
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Attempts to extract the calling method name from the stack trace.
|
|
171
|
+
* This provides automatic context for validation errors.
|
|
172
|
+
* Falls back to 'Request validation failed' if method name cannot be determined.
|
|
173
|
+
*/
|
|
174
|
+
getCallerContext() {
|
|
175
|
+
try {
|
|
176
|
+
const stack = new Error().stack;
|
|
177
|
+
if (stack) {
|
|
178
|
+
// Parse stack to find the calling method
|
|
179
|
+
const lines = stack.split('\n');
|
|
180
|
+
// Stack trace format:
|
|
181
|
+
// Line 0: Error
|
|
182
|
+
// Line 1: getCallerContext
|
|
183
|
+
// Line 2: throwIfInvalid
|
|
184
|
+
// Line 3: actual calling method (e.g., getOrder, listOnchainAddressBook)
|
|
185
|
+
const callerLine = lines[3];
|
|
186
|
+
// Try to match various stack trace formats
|
|
187
|
+
// Format: "at ClassName.methodName" or "at methodName" or "methodName@file.ts"
|
|
188
|
+
let match = callerLine.match(/at (?:\w+\.)?(\w+)/);
|
|
189
|
+
if (!match) {
|
|
190
|
+
// Try Firefox/Safari format: methodName@file.ts:line:col
|
|
191
|
+
match = callerLine.match(/^(\w+)@/);
|
|
192
|
+
}
|
|
193
|
+
if (match && match[1]) {
|
|
194
|
+
const methodName = match[1];
|
|
195
|
+
// Filter out common internal/utility method names
|
|
196
|
+
if (!['async', 'Function', 'Object'].includes(methodName)) {
|
|
197
|
+
return `${methodName} request validation failed`;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
catch (e) {
|
|
203
|
+
// Silently fail - stack parsing is best-effort
|
|
204
|
+
// This might happen in different JavaScript engines or minified code
|
|
205
|
+
}
|
|
206
|
+
return 'Request validation failed';
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
exports.ValidationResult = ValidationResult;
|
|
210
|
+
/**
|
|
211
|
+
* Validates that a string is a valid UUID v4 format
|
|
212
|
+
*/
|
|
213
|
+
function isValidUUID(value) {
|
|
214
|
+
return UUID_REGEX.test(value);
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Validates that a required UUID parameter is present and valid
|
|
218
|
+
*/
|
|
219
|
+
function validateRequiredUUID(validator, value, paramName) {
|
|
220
|
+
if (value === undefined || value === null || value === '') {
|
|
221
|
+
validator.addError(paramName, 'is required and cannot be empty', value);
|
|
222
|
+
return;
|
|
223
|
+
}
|
|
224
|
+
const trimmedValue = typeof value === 'string' ? value.trim() : value;
|
|
225
|
+
if (trimmedValue === '') {
|
|
226
|
+
validator.addError(paramName, 'cannot be empty or whitespace only', value);
|
|
227
|
+
return;
|
|
228
|
+
}
|
|
229
|
+
if (!isValidUUID(trimmedValue)) {
|
|
230
|
+
validator.addError(paramName, 'must be a valid UUID', value);
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Validates that an optional UUID parameter is valid if provided
|
|
235
|
+
*/
|
|
236
|
+
function validateOptionalUUID(validator, value, paramName) {
|
|
237
|
+
if (value === undefined || value === null || value === '') {
|
|
238
|
+
return; // Optional, so undefined/null/empty is valid
|
|
239
|
+
}
|
|
240
|
+
const trimmedValue = typeof value === 'string' ? value.trim() : value;
|
|
241
|
+
if (trimmedValue !== '' && !isValidUUID(trimmedValue)) {
|
|
242
|
+
validator.addError(paramName, 'must be a valid UUID if provided', value);
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* Validates that a required string parameter is present and not empty
|
|
247
|
+
*/
|
|
248
|
+
function validateRequiredString(validator, value, paramName) {
|
|
249
|
+
if (value === undefined || value === null || value === '') {
|
|
250
|
+
validator.addError(paramName, 'is required and cannot be empty', value);
|
|
251
|
+
return;
|
|
252
|
+
}
|
|
253
|
+
const trimmedValue = typeof value === 'string' ? value.trim() : value;
|
|
254
|
+
if (trimmedValue === '') {
|
|
255
|
+
validator.addError(paramName, 'cannot be empty or whitespace only', value);
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* Validates that an optional string parameter is not empty if provided
|
|
260
|
+
*/
|
|
261
|
+
function validateOptionalString(validator, value, paramName) {
|
|
262
|
+
if (value === undefined || value === null) {
|
|
263
|
+
return; // Optional, so undefined/null is valid
|
|
264
|
+
}
|
|
265
|
+
if (typeof value === 'string') {
|
|
266
|
+
const trimmedValue = value.trim();
|
|
267
|
+
if (value !== '' && trimmedValue === '') {
|
|
268
|
+
validator.addError(paramName, 'cannot be whitespace only if provided', value);
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* Convenience function to create a new ValidationResult
|
|
274
|
+
*/
|
|
275
|
+
function createValidator() {
|
|
276
|
+
return new ValidationResult();
|
|
277
|
+
}
|
|
278
|
+
/**
|
|
279
|
+
* Creates a validator with property accessor support for automatic field name inference.
|
|
280
|
+
*
|
|
281
|
+
* @param source - The source object containing the fields to validate
|
|
282
|
+
*
|
|
283
|
+
* @example
|
|
284
|
+
* ```typescript
|
|
285
|
+
* validate(request)
|
|
286
|
+
* .requiredUUID(r => r.portfolioId)
|
|
287
|
+
* .requiredUUID(r => r.orderId)
|
|
288
|
+
* .check();
|
|
289
|
+
* ```
|
|
290
|
+
*/
|
|
291
|
+
function validate(source) {
|
|
292
|
+
return new PropertyValidator(source);
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* Validator with property accessor support for automatic field name inference.
|
|
296
|
+
* Uses Proxy to track property accesses and extract field names automatically.
|
|
297
|
+
*/
|
|
298
|
+
class PropertyValidator {
|
|
299
|
+
constructor(source) {
|
|
300
|
+
this.validator = new ValidationResult();
|
|
301
|
+
this.source = source;
|
|
302
|
+
}
|
|
303
|
+
/**
|
|
304
|
+
* Validates that a required UUID field is present and valid.
|
|
305
|
+
* Automatically extracts the field name from the property accessor.
|
|
306
|
+
*
|
|
307
|
+
* @example
|
|
308
|
+
* ```typescript
|
|
309
|
+
* validate(request)
|
|
310
|
+
* .requiredUUID(r => r.portfolioId)
|
|
311
|
+
* .check();
|
|
312
|
+
* ```
|
|
313
|
+
*/
|
|
314
|
+
requiredUUID(accessor) {
|
|
315
|
+
const { propertyName, value } = this.extractProperty(accessor);
|
|
316
|
+
this.validator.validateRequiredUUID(value, propertyName);
|
|
317
|
+
return this;
|
|
318
|
+
}
|
|
319
|
+
/**
|
|
320
|
+
* Validates that an optional UUID field is valid if provided.
|
|
321
|
+
*/
|
|
322
|
+
optionalUUID(accessor) {
|
|
323
|
+
const { propertyName, value } = this.extractProperty(accessor);
|
|
324
|
+
this.validator.validateOptionalUUID(value, propertyName);
|
|
325
|
+
return this;
|
|
326
|
+
}
|
|
327
|
+
/**
|
|
328
|
+
* Validates that a required string field is present and not empty.
|
|
329
|
+
*/
|
|
330
|
+
requiredString(accessor) {
|
|
331
|
+
const { propertyName, value } = this.extractProperty(accessor);
|
|
332
|
+
this.validator.validateRequiredString(value, propertyName);
|
|
333
|
+
return this;
|
|
334
|
+
}
|
|
335
|
+
/**
|
|
336
|
+
* Validates that an optional string field is not empty if provided.
|
|
337
|
+
*/
|
|
338
|
+
optionalString(accessor) {
|
|
339
|
+
const { propertyName, value } = this.extractProperty(accessor);
|
|
340
|
+
this.validator.validateOptionalString(value, propertyName);
|
|
341
|
+
return this;
|
|
342
|
+
}
|
|
343
|
+
/**
|
|
344
|
+
* Throws if there are validation errors.
|
|
345
|
+
* Automatically detects the calling method name.
|
|
346
|
+
*/
|
|
347
|
+
check(contextMessage) {
|
|
348
|
+
this.validator.throwIfInvalid(contextMessage);
|
|
349
|
+
}
|
|
350
|
+
/**
|
|
351
|
+
* Alias for check() for backward compatibility.
|
|
352
|
+
*/
|
|
353
|
+
throwIfInvalid(contextMessage) {
|
|
354
|
+
this.validator.throwIfInvalid(contextMessage);
|
|
355
|
+
}
|
|
356
|
+
/**
|
|
357
|
+
* Extracts the property name and value from a property accessor function.
|
|
358
|
+
* Uses a Proxy to track which property was accessed.
|
|
359
|
+
*/
|
|
360
|
+
extractProperty(accessor) {
|
|
361
|
+
let accessedProperty;
|
|
362
|
+
// Create a Proxy that tracks property accesses
|
|
363
|
+
const proxy = new Proxy(this.source, {
|
|
364
|
+
get(target, prop) {
|
|
365
|
+
if (typeof prop === 'string') {
|
|
366
|
+
accessedProperty = prop;
|
|
367
|
+
return target[prop];
|
|
368
|
+
}
|
|
369
|
+
return undefined;
|
|
370
|
+
},
|
|
371
|
+
});
|
|
372
|
+
// Call the accessor to trigger the Proxy
|
|
373
|
+
const value = accessor(proxy);
|
|
374
|
+
if (!accessedProperty) {
|
|
375
|
+
throw new Error('Unable to extract property name. Ensure the accessor accesses a property directly (e.g., r => r.fieldName)');
|
|
376
|
+
}
|
|
377
|
+
return { propertyName: accessedProperty, value };
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
exports.PropertyValidator = PropertyValidator;
|
package/dist/staking/index.js
CHANGED
|
@@ -115,5 +115,27 @@ class StakingService {
|
|
|
115
115
|
return response.data;
|
|
116
116
|
});
|
|
117
117
|
}
|
|
118
|
+
previewUnstake(request, options) {
|
|
119
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
120
|
+
const bodyParams = Object.assign(Object.assign({}, request), { portfolioId: undefined, walletId: undefined });
|
|
121
|
+
const response = yield this.client.request({
|
|
122
|
+
url: `portfolios/${request.portfolioId}/wallets/${request.walletId}/staking/unstake/preview`,
|
|
123
|
+
method: clients_1.Method.POST,
|
|
124
|
+
bodyParams,
|
|
125
|
+
callOptions: options,
|
|
126
|
+
});
|
|
127
|
+
return response.data;
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
getUnstakingStatus(request, options) {
|
|
131
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
132
|
+
const { portfolioId, walletId } = request;
|
|
133
|
+
const response = yield this.client.request({
|
|
134
|
+
url: `portfolios/${portfolioId}/wallets/${walletId}/staking/unstake/status`,
|
|
135
|
+
callOptions: options,
|
|
136
|
+
});
|
|
137
|
+
return response.data;
|
|
138
|
+
});
|
|
139
|
+
}
|
|
118
140
|
}
|
|
119
141
|
exports.StakingService = StakingService;
|
|
@@ -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.7.
|
|
16
|
+
export declare const VERSION = "0.7.1";
|
|
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";
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import { IPrimeApiClient, CoinbaseCallOptions } from '../clients';
|
|
17
|
-
import { ListExistingLocatesRequest, ListExistingLocatesResponse, ListInterestAccrualsRequest, ListInterestAccrualsResponse, ListPortfolioInterestAccrualsRequest, ListPortfolioInterestAccrualsResponse, ListMarginCallSummariesRequest, ListMarginCallSummariesResponse, ListMarginConversionsRequest, ListMarginConversionsResponse, GetEntityLocateAvailabilitiesRequest, GetEntityLocateAvailabilitiesResponse, GetMarginInformationRequest, GetMarginInformationResponse, GetPortfolioBuyingPowerRequest, GetPortfolioBuyingPowerResponse, GetPortfolioCreditInformationRequest, GetPortfolioCreditInformationResponse, GetPortfolioWithdrawalPowerRequest, GetPortfolioWithdrawalPowerResponse, GetTieredPricingFeesRequest, GetTieredPricingFeesResponse, GetFcmMarginCallDetailsRequest, GetFcmMarginCallDetailsResponse, GetFcmRiskLimitsRequest, GetFcmRiskLimitsResponse, CreateNewLocatesRequest, CreateNewLocatesResponse, GetCrossMarginOverviewRequest, GetCrossMarginOverviewResponse } from './types';
|
|
17
|
+
import { ListExistingLocatesRequest, ListExistingLocatesResponse, ListInterestAccrualsRequest, ListInterestAccrualsResponse, ListPortfolioInterestAccrualsRequest, ListPortfolioInterestAccrualsResponse, ListMarginCallSummariesRequest, ListMarginCallSummariesResponse, ListMarginConversionsRequest, ListMarginConversionsResponse, GetEntityLocateAvailabilitiesRequest, GetEntityLocateAvailabilitiesResponse, GetMarginInformationRequest, GetMarginInformationResponse, GetPortfolioBuyingPowerRequest, GetPortfolioBuyingPowerResponse, GetPortfolioCreditInformationRequest, GetPortfolioCreditInformationResponse, GetPortfolioWithdrawalPowerRequest, GetPortfolioWithdrawalPowerResponse, GetTieredPricingFeesRequest, GetTieredPricingFeesResponse, GetFcmMarginCallDetailsRequest, GetFcmMarginCallDetailsResponse, GetFcmRiskLimitsRequest, GetFcmRiskLimitsResponse, CreateNewLocatesRequest, CreateNewLocatesResponse, GetCrossMarginOverviewRequest, GetCrossMarginOverviewResponse, ListTFObligationsRequest, ListTFObligationsResponse, ListFinancingEligibleAssetsRequest, ListFinancingEligibleAssetsResponse } from './types';
|
|
18
18
|
export interface IFinancingService {
|
|
19
19
|
listExistingLocates(request: ListExistingLocatesRequest, options?: CoinbaseCallOptions): Promise<ListExistingLocatesResponse>;
|
|
20
20
|
listInterestAccruals(request: ListInterestAccrualsRequest, options?: CoinbaseCallOptions): Promise<ListInterestAccrualsResponse>;
|
|
@@ -31,6 +31,8 @@ export interface IFinancingService {
|
|
|
31
31
|
getFcmRiskLimits(request: GetFcmRiskLimitsRequest, options?: CoinbaseCallOptions): Promise<GetFcmRiskLimitsResponse>;
|
|
32
32
|
createNewLocates(request: CreateNewLocatesRequest, options?: CoinbaseCallOptions): Promise<CreateNewLocatesResponse>;
|
|
33
33
|
getCrossMarginOverview(request: GetCrossMarginOverviewRequest, options?: CoinbaseCallOptions): Promise<GetCrossMarginOverviewResponse>;
|
|
34
|
+
listTFObligations(request: ListTFObligationsRequest, options?: CoinbaseCallOptions): Promise<ListTFObligationsResponse>;
|
|
35
|
+
listFinancingEligibleAssets(request?: ListFinancingEligibleAssetsRequest, options?: CoinbaseCallOptions): Promise<ListFinancingEligibleAssetsResponse>;
|
|
34
36
|
}
|
|
35
37
|
export declare class FinancingService implements IFinancingService {
|
|
36
38
|
private client;
|
|
@@ -50,4 +52,6 @@ export declare class FinancingService implements IFinancingService {
|
|
|
50
52
|
getFcmRiskLimits(request: GetFcmRiskLimitsRequest, options?: CoinbaseCallOptions): Promise<GetFcmRiskLimitsResponse>;
|
|
51
53
|
createNewLocates(request: CreateNewLocatesRequest, options?: CoinbaseCallOptions): Promise<CreateNewLocatesResponse>;
|
|
52
54
|
getCrossMarginOverview(request: GetCrossMarginOverviewRequest, options?: CoinbaseCallOptions): Promise<GetCrossMarginOverviewResponse>;
|
|
55
|
+
listTFObligations(request: ListTFObligationsRequest, options?: CoinbaseCallOptions): Promise<ListTFObligationsResponse>;
|
|
56
|
+
listFinancingEligibleAssets(request?: ListFinancingEligibleAssetsRequest, options?: CoinbaseCallOptions): Promise<ListFinancingEligibleAssetsResponse>;
|
|
53
57
|
}
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import { Brand } from '../shared/brand';
|
|
17
|
-
import { GetExistingLocatesResponse, GetInterestAccrualsResponse, GetLocateAvailabilitiesResponse, GetMarginConversionsResponse, GetMarginSummariesResponse, GetMarginInformationResponse as internalGetMarginInformationResponse, GetBuyingPowerResponse, GetPostTradeCreditResponse, GetTFTieredPricingFeesResponse, GetWithdrawalPowerResponse, GetFcmMarginCallDetailsResponse as internalGetFcmMarginCallDetailsResponse, GetFcmRiskLimitsResponse as internalGetFcmRiskLimitsResponse, CreateNewLocatesResponse as internalCreateNewLocatesResponse, GetCrossMarginOverviewResponse as internalGetCrossMarginOverviewResponse } from '../model/';
|
|
17
|
+
import { GetExistingLocatesResponse, GetInterestAccrualsResponse, GetLocateAvailabilitiesResponse, GetMarginConversionsResponse, GetMarginSummariesResponse, GetMarginInformationResponse as internalGetMarginInformationResponse, GetBuyingPowerResponse, GetPostTradeCreditResponse, GetTFTieredPricingFeesResponse, GetWithdrawalPowerResponse, GetFcmMarginCallDetailsResponse as internalGetFcmMarginCallDetailsResponse, GetFcmRiskLimitsResponse as internalGetFcmRiskLimitsResponse, CreateNewLocatesResponse as internalCreateNewLocatesResponse, GetCrossMarginOverviewResponse as internalGetCrossMarginOverviewResponse, ListTFObligationsResponse as internalListTFObligationsResponse, ListFinancingEligibleAssetsResponse as internalListFinancingEligibleAssetsResponse } from '../model/';
|
|
18
18
|
export type ListExistingLocatesRequest = {
|
|
19
19
|
portfolioId: string;
|
|
20
20
|
locateIds?: string[];
|
|
@@ -95,3 +95,9 @@ export type GetCrossMarginOverviewRequest = {
|
|
|
95
95
|
entityId: string;
|
|
96
96
|
};
|
|
97
97
|
export type GetCrossMarginOverviewResponse = Brand<internalGetCrossMarginOverviewResponse, 'GetCrossMarginOverviewResponse'>;
|
|
98
|
+
export type ListTFObligationsRequest = {
|
|
99
|
+
entityId: string;
|
|
100
|
+
};
|
|
101
|
+
export type ListTFObligationsResponse = Brand<internalListTFObligationsResponse, 'ListTFObligationsResponse'>;
|
|
102
|
+
export type ListFinancingEligibleAssetsRequest = Record<string, never>;
|
|
103
|
+
export type ListFinancingEligibleAssetsResponse = Brand<internalListFinancingEligibleAssetsResponse, 'ListFinancingEligibleAssetsResponse'>;
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import { CoinbaseCallOptions, IPrimeApiClient } from '../clients';
|
|
17
|
-
import { ListEntityFuturesSweepsRequest, ListEntityFuturesSweepsResponse, GetEntityFuturesBalanceRequest, GetEntityFuturesBalanceResponse, GetEntityFuturesPositionsRequest, GetEntityFuturesPositionsResponse, ScheduleEntityFuturesSweepRequest, ScheduleEntityFuturesSweepResponse, UpdateEntityFuturesAutoSweepRequest, UpdateEntityFuturesAutoSweepResponse, CancelEntitySweepRequest, CancelEntitySweepResponse, GetEntityFuturesRiskLimitsRequest, GetEntityFuturesRiskLimitsResponse, GetEntityFuturesMarginCallDetailsRequest, GetEntityFuturesMarginCallDetailsResponse } from './types';
|
|
17
|
+
import { ListEntityFuturesSweepsRequest, ListEntityFuturesSweepsResponse, GetEntityFuturesBalanceRequest, GetEntityFuturesBalanceResponse, GetEntityFuturesPositionsRequest, GetEntityFuturesPositionsResponse, ScheduleEntityFuturesSweepRequest, ScheduleEntityFuturesSweepResponse, UpdateEntityFuturesAutoSweepRequest, UpdateEntityFuturesAutoSweepResponse, CancelEntitySweepRequest, CancelEntitySweepResponse, GetEntityFuturesRiskLimitsRequest, GetEntityFuturesRiskLimitsResponse, GetEntityFuturesMarginCallDetailsRequest, GetEntityFuturesMarginCallDetailsResponse, GetFcmSettingsRequest, GetFcmSettingsResponse, SetFcmSettingsRequest, SetFcmSettingsResponse } from './types';
|
|
18
18
|
export interface IFuturesService {
|
|
19
19
|
listEntitySweeps(request: ListEntityFuturesSweepsRequest, options?: CoinbaseCallOptions): Promise<ListEntityFuturesSweepsResponse>;
|
|
20
20
|
getEntityBalance(request: GetEntityFuturesBalanceRequest, options?: CoinbaseCallOptions): Promise<GetEntityFuturesBalanceResponse>;
|
|
@@ -24,6 +24,8 @@ export interface IFuturesService {
|
|
|
24
24
|
cancelEntitySweep(request: CancelEntitySweepRequest, options?: CoinbaseCallOptions): Promise<CancelEntitySweepResponse>;
|
|
25
25
|
getRiskLimits(request: GetEntityFuturesRiskLimitsRequest, options?: CoinbaseCallOptions): Promise<GetEntityFuturesRiskLimitsResponse>;
|
|
26
26
|
getMarginCallDetails(request: GetEntityFuturesMarginCallDetailsRequest, options?: CoinbaseCallOptions): Promise<GetEntityFuturesMarginCallDetailsResponse>;
|
|
27
|
+
getFcmSettings(request: GetFcmSettingsRequest, options?: CoinbaseCallOptions): Promise<GetFcmSettingsResponse>;
|
|
28
|
+
setFcmSettings(request: SetFcmSettingsRequest, options?: CoinbaseCallOptions): Promise<SetFcmSettingsResponse>;
|
|
27
29
|
}
|
|
28
30
|
export declare class FuturesService implements IFuturesService {
|
|
29
31
|
private client;
|
|
@@ -36,5 +38,7 @@ export declare class FuturesService implements IFuturesService {
|
|
|
36
38
|
cancelEntitySweep(request: CancelEntitySweepRequest, options?: CoinbaseCallOptions): Promise<CancelEntitySweepResponse>;
|
|
37
39
|
getRiskLimits(request: GetEntityFuturesRiskLimitsRequest, options?: CoinbaseCallOptions): Promise<GetEntityFuturesRiskLimitsResponse>;
|
|
38
40
|
getMarginCallDetails(request: GetEntityFuturesMarginCallDetailsRequest, options?: CoinbaseCallOptions): Promise<GetEntityFuturesMarginCallDetailsResponse>;
|
|
41
|
+
getFcmSettings(request: GetFcmSettingsRequest, options?: CoinbaseCallOptions): Promise<GetFcmSettingsResponse>;
|
|
42
|
+
setFcmSettings(request: SetFcmSettingsRequest, options?: CoinbaseCallOptions): Promise<SetFcmSettingsResponse>;
|
|
39
43
|
}
|
|
40
|
-
export type { ListEntityFuturesSweepsRequest, ListEntityFuturesSweepsResponse, GetEntityFuturesBalanceRequest, GetEntityFuturesBalanceResponse, GetEntityFuturesPositionsRequest, GetEntityFuturesPositionsResponse, ScheduleEntityFuturesSweepRequest, ScheduleEntityFuturesSweepResponse, UpdateEntityFuturesAutoSweepRequest, UpdateEntityFuturesAutoSweepResponse, CancelEntitySweepRequest, CancelEntitySweepResponse, GetEntityFuturesRiskLimitsRequest, GetEntityFuturesRiskLimitsResponse, GetEntityFuturesMarginCallDetailsRequest, GetEntityFuturesMarginCallDetailsResponse, } from './types';
|
|
44
|
+
export type { ListEntityFuturesSweepsRequest, ListEntityFuturesSweepsResponse, GetEntityFuturesBalanceRequest, GetEntityFuturesBalanceResponse, GetEntityFuturesPositionsRequest, GetEntityFuturesPositionsResponse, ScheduleEntityFuturesSweepRequest, ScheduleEntityFuturesSweepResponse, UpdateEntityFuturesAutoSweepRequest, UpdateEntityFuturesAutoSweepResponse, CancelEntitySweepRequest, CancelEntitySweepResponse, GetEntityFuturesRiskLimitsRequest, GetEntityFuturesRiskLimitsResponse, GetEntityFuturesMarginCallDetailsRequest, GetEntityFuturesMarginCallDetailsResponse, GetFcmSettingsRequest, GetFcmSettingsResponse, SetFcmSettingsRequest, SetFcmSettingsResponse, } from './types';
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import { Brand } from '../shared/brand';
|
|
17
|
-
import { GetFcmBalanceResponse, GetFuturesSweepsResponse, GetPositionsResponse, SetAutoSweepResponse, ScheduleFuturesSweepRequest, ScheduleFuturesSweepResponse, CancelFuturesSweepResponse, GetFcmRiskLimitsResponse, GetFcmMarginCallDetailsResponse } from '../model/';
|
|
17
|
+
import { GetFcmBalanceResponse, GetFuturesSweepsResponse, GetPositionsResponse, SetAutoSweepResponse, ScheduleFuturesSweepRequest, ScheduleFuturesSweepResponse, CancelFuturesSweepResponse, GetFcmRiskLimitsResponse, GetFcmMarginCallDetailsResponse, GetFcmSettingsResponse as internalGetFcmSettingsResponse, SetFcmSettingsResponse as internalSetFcmSettingsResponse } from '../model/';
|
|
18
18
|
export type ListEntityFuturesSweepsRequest = {
|
|
19
19
|
entityId: string;
|
|
20
20
|
};
|
|
@@ -49,3 +49,12 @@ export type GetEntityFuturesMarginCallDetailsRequest = {
|
|
|
49
49
|
entityId: string;
|
|
50
50
|
};
|
|
51
51
|
export type GetEntityFuturesMarginCallDetailsResponse = Brand<GetFcmMarginCallDetailsResponse, 'GetEntityFuturesMarginCallDetailsResponse'>;
|
|
52
|
+
export type GetFcmSettingsRequest = {
|
|
53
|
+
entityId: string;
|
|
54
|
+
};
|
|
55
|
+
export type GetFcmSettingsResponse = Brand<internalGetFcmSettingsResponse, 'GetFcmSettingsResponse'>;
|
|
56
|
+
export type SetFcmSettingsRequest = {
|
|
57
|
+
entityId: string;
|
|
58
|
+
targetDerivativesExcess: string;
|
|
59
|
+
};
|
|
60
|
+
export type SetFcmSettingsResponse = Brand<internalSetFcmSettingsResponse, 'SetFcmSettingsResponse'>;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -51,7 +51,7 @@ export type { AcceptQuoteRequest, AcceptQuoteResponse, CancelOrderRequest, Cance
|
|
|
51
51
|
export type { GetPaymentMethodRequest, GetPaymentMethodResponse, ListEntityPaymentMethodsRequest, ListEntityPaymentMethodsResponse, } from './paymentMethods/types';
|
|
52
52
|
export type { ListPortfoliosRequest, ListPortfoliosResponse, GetPortfolioCreditRequest, GetPortfolioCreditResponse, GetPortfolioRequest, GetPortfolioResponse, GetCounterpartyIdRequest, GetCounterpartyIdResponse, } from './portfolios/types';
|
|
53
53
|
export type { ListAggregateEntityPositionsRequest, ListAggregateEntityPositionsResponse, ListEntityPositionsRequest, ListEntityPositionsResponse, } from './positions/types';
|
|
54
|
-
export type { ListProductsRequest, ListProductsResponse, } from './products/types';
|
|
54
|
+
export type { ListProductsRequest, ListProductsResponse, ListProductCandlesRequest, ListProductCandlesResponse, } from './products/types';
|
|
55
55
|
export type { CreateStakeRequest, CreateStakeResponse, CreateUnstakeRequest, CreateUnstakeResponse, CreatePortfolioStakeRequest, CreatePortfolioStakeResponse, CreatePortfolioUnstakeRequest, CreatePortfolioUnstakeResponse, QueryTransactionValidatorsRequest, QueryTransactionValidatorsResponse, BaseQueryTransactionValidatorsResponse, ClaimRewardsRequest, ClaimRewardsResponse, } from './staking/types';
|
|
56
56
|
export type { CreateConversionRequest, CreateConversionResponse, CreateOnchainTransactionRequest, CreateOnchainTransactionResponse, CreateTransferRequest, CreateTransferResponse, CreateWithdrawalRequest, CreateWithdrawalResponse, GetTransactionRequest, GetTransactionResponse, ListPortfolioTransactionsRequest, ListPortfolioTransactionsResponse, ListWalletTransactionsRequest, ListWalletTransactionsResponse, } from './transactions/types';
|
|
57
57
|
export type { ListPortfolioUsersRequest, ListPortfolioUsersResponse, ListUsersRequest, ListUsersResponse, } from './users/types';
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2025-present Coinbase Global, Inc.
|
|
3
|
+
*
|
|
4
|
+
* This file is generated by Openapi Generator https://github.com/openapitools/openapi-generator
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*
|
|
18
|
+
* Do not edit the class manually.
|
|
19
|
+
*/
|
|
20
|
+
export type Candle = {
|
|
21
|
+
timestamp?: Date;
|
|
22
|
+
/**
|
|
23
|
+
* Opening price for the period
|
|
24
|
+
*/
|
|
25
|
+
open?: string;
|
|
26
|
+
/**
|
|
27
|
+
* Highest price during the period
|
|
28
|
+
*/
|
|
29
|
+
high?: string;
|
|
30
|
+
/**
|
|
31
|
+
* Lowest price during the period
|
|
32
|
+
*/
|
|
33
|
+
low?: string;
|
|
34
|
+
/**
|
|
35
|
+
* Closing price for the period
|
|
36
|
+
*/
|
|
37
|
+
close?: string;
|
|
38
|
+
/**
|
|
39
|
+
* Volume traded during the period
|
|
40
|
+
*/
|
|
41
|
+
volume?: string;
|
|
42
|
+
};
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
*/
|
|
20
20
|
import { OrderSide } from './enums/OrderSide';
|
|
21
21
|
import { OrderType } from './enums/OrderType';
|
|
22
|
+
import { PegOffsetType } from './enums/PegOffsetType';
|
|
22
23
|
import { TimeInForceType } from './enums/TimeInForceType';
|
|
23
24
|
export type CreateOrderRequest = {
|
|
24
25
|
productId: string;
|
|
@@ -42,7 +43,13 @@ export type CreateOrderRequest = {
|
|
|
42
43
|
stopPrice?: string;
|
|
43
44
|
settlCurrency?: string;
|
|
44
45
|
/**
|
|
45
|
-
* Post-only flag - when true, the order will only be posted to the order book and not immediately matched. Only applicable to LIMIT orders with GTC or GTD time in force.
|
|
46
|
+
* Post-only flag - when true, the order will only be posted to the order book and not immediately matched. Only applicable to LIMIT orders with GTC or GTD time in force.
|
|
46
47
|
*/
|
|
47
48
|
postOnly?: boolean;
|
|
49
|
+
pegOffsetType?: PegOffsetType;
|
|
50
|
+
offset?: string;
|
|
51
|
+
/**
|
|
52
|
+
* next: 23
|
|
53
|
+
*/
|
|
54
|
+
wigLevel?: string;
|
|
48
55
|
};
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
*
|
|
18
18
|
* Do not edit the class manually.
|
|
19
19
|
*/
|
|
20
|
+
import { TravelRuleEntry } from './TravelRuleEntry';
|
|
20
21
|
export type CreatePortfolioAddressBookEntryRequest = {
|
|
21
22
|
/**
|
|
22
23
|
* Crypto address to add
|
|
@@ -34,4 +35,9 @@ export type CreatePortfolioAddressBookEntryRequest = {
|
|
|
34
35
|
* Account Identifier (memo/destination tag)
|
|
35
36
|
*/
|
|
36
37
|
accountIdentifier?: string;
|
|
38
|
+
/**
|
|
39
|
+
* List of compatible chain IDs for the address, empty for Solana
|
|
40
|
+
*/
|
|
41
|
+
chainIds?: Array<string>;
|
|
42
|
+
travelRuleData?: TravelRuleEntry;
|
|
37
43
|
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2025-present Coinbase Global, Inc.
|
|
3
|
+
*
|
|
4
|
+
* This file is generated by Openapi Generator https://github.com/openapitools/openapi-generator
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*
|
|
18
|
+
* Do not edit the class manually.
|
|
19
|
+
*/
|
|
20
|
+
export type DateOfBirth = {
|
|
21
|
+
year?: number;
|
|
22
|
+
month?: number;
|
|
23
|
+
day?: number;
|
|
24
|
+
};
|