@coinbase-sample/prime-sdk-ts 0.6.3 → 0.7.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.
Files changed (122) hide show
  1. package/dist/constants.js +1 -1
  2. package/dist/financing/index.js +9 -0
  3. package/dist/futures/index.js +18 -0
  4. package/dist/model/CrossMarginOverview.js +21 -0
  5. package/dist/model/EditOrderRequest.js +21 -0
  6. package/dist/model/EditOrderResponse.js +21 -0
  7. package/dist/model/GetCrossMarginOverviewResponse.js +21 -0
  8. package/dist/model/ListTransactionValidatorsRequest.js +21 -0
  9. package/dist/model/ListTransactionValidatorsResponse.js +21 -0
  10. package/dist/model/StakingClaimRewardsRequest.js +21 -0
  11. package/dist/model/StakingClaimRewardsResponse.js +21 -0
  12. package/dist/model/TransactionValidator.js +21 -0
  13. package/dist/model/WalletClaimRewardsInputs.js +21 -0
  14. package/dist/model/XMLoan.js +21 -0
  15. package/dist/model/XMMarginCall.js +21 -0
  16. package/dist/model/XMPosition.js +21 -0
  17. package/dist/model/XMRiskNettingInfo.js +21 -0
  18. package/dist/model/XMSummary.js +21 -0
  19. package/dist/model/enumPrefixes.js +330 -0
  20. package/dist/model/enums/ActivityCategory.js +0 -1
  21. package/dist/model/enums/ActivityLevel.js +3 -3
  22. package/dist/model/enums/AddressBookType.js +3 -3
  23. package/dist/model/enums/AllocationStatus.js +5 -5
  24. package/dist/model/enums/CustodyActivityType.js +29 -29
  25. package/dist/model/enums/DestinationType.js +4 -4
  26. package/dist/model/enums/FcmFuturesSweepStatus.js +5 -5
  27. package/dist/model/enums/FcmMarginCallState.js +5 -5
  28. package/dist/model/enums/FcmMarginCallType.js +3 -3
  29. package/dist/model/enums/HierarchyType.js +3 -3
  30. package/dist/model/enums/InvoiceState.js +5 -5
  31. package/dist/model/enums/InvoiceType.js +6 -6
  32. package/dist/model/enums/LoanType.js +1 -0
  33. package/dist/model/enums/NetworkFamily.js +3 -3
  34. package/dist/model/enums/NetworkType.js +3 -3
  35. package/dist/model/enums/PaymentMethodType.js +3 -3
  36. package/dist/model/enums/ProductPermissions.js +3 -3
  37. package/dist/model/enums/ValidatorStatus.js +31 -0
  38. package/dist/model/enums/WalletVisibility.js +3 -3
  39. package/dist/model/enums/XMCallStatus.js +33 -0
  40. package/dist/model/enums/XMCallType.js +31 -0
  41. package/dist/model/enums/XMControlStatus.js +32 -0
  42. package/dist/model/enums/XMEntityCallStatus.js +33 -0
  43. package/dist/model/enums/XMMarginLevel.js +34 -0
  44. package/dist/model/enums/XMParty.js +31 -0
  45. package/dist/model/enums/index.js +15 -1
  46. package/dist/orders/index.js +12 -0
  47. package/dist/paymentMethods/index.js +2 -1
  48. package/dist/shared/dynamicEnumValidation.js +184 -0
  49. package/dist/shared/dynamicEnumValidation.old.js +746 -0
  50. package/dist/shared/enumHelpers.js +219 -0
  51. package/dist/shared/enumRegistry.js +153 -0
  52. package/dist/shared/enumValidationCore.js +194 -0
  53. package/dist/shared/enumValidators.js +115 -0
  54. package/dist/shared/fieldMapping.js +242 -0
  55. package/dist/shared/serviceContext.js +157 -0
  56. package/dist/staking/index.js +37 -0
  57. package/dist/types/balances/types.d.ts +1 -1
  58. package/dist/types/constants.d.ts +1 -1
  59. package/dist/types/financing/index.d.ts +3 -1
  60. package/dist/types/financing/types.d.ts +5 -1
  61. package/dist/types/futures/index.d.ts +6 -1
  62. package/dist/types/futures/types.d.ts +9 -1
  63. package/dist/types/index.d.ts +3 -3
  64. package/dist/types/model/CrossMarginOverview.d.ts +39 -0
  65. package/dist/types/model/EditOrderRequest.d.ts +61 -0
  66. package/dist/types/model/EditOrderResponse.d.ts +25 -0
  67. package/dist/types/model/GetCrossMarginOverviewResponse.d.ts +23 -0
  68. package/dist/types/model/ListTransactionValidatorsRequest.d.ts +35 -0
  69. package/dist/types/model/ListTransactionValidatorsResponse.d.ts +28 -0
  70. package/dist/types/model/RFQProductDetails.d.ts +21 -0
  71. package/dist/types/model/StakingClaimRewardsRequest.d.ts +27 -0
  72. package/dist/types/model/StakingClaimRewardsResponse.d.ts +33 -0
  73. package/dist/types/model/TransactionValidator.d.ts +31 -0
  74. package/dist/types/model/WalletClaimRewardsInputs.d.ts +28 -0
  75. package/dist/types/model/XMLoan.d.ts +51 -0
  76. package/dist/types/model/XMMarginCall.d.ts +57 -0
  77. package/dist/types/model/XMPosition.d.ts +121 -0
  78. package/dist/types/model/XMRiskNettingInfo.d.ts +76 -0
  79. package/dist/types/model/XMSummary.d.ts +55 -0
  80. package/dist/types/model/enumPrefixes.d.ts +206 -0
  81. package/dist/types/model/enums/ActivityCategory.d.ts +0 -1
  82. package/dist/types/model/enums/ActivityLevel.d.ts +3 -3
  83. package/dist/types/model/enums/AddressBookType.d.ts +3 -3
  84. package/dist/types/model/enums/AllocationStatus.d.ts +5 -5
  85. package/dist/types/model/enums/CustodyActivityType.d.ts +29 -29
  86. package/dist/types/model/enums/DestinationType.d.ts +4 -4
  87. package/dist/types/model/enums/FcmFuturesSweepStatus.d.ts +5 -5
  88. package/dist/types/model/enums/FcmMarginCallState.d.ts +5 -5
  89. package/dist/types/model/enums/FcmMarginCallType.d.ts +3 -3
  90. package/dist/types/model/enums/HierarchyType.d.ts +3 -3
  91. package/dist/types/model/enums/InvoiceState.d.ts +5 -5
  92. package/dist/types/model/enums/InvoiceType.d.ts +6 -6
  93. package/dist/types/model/enums/LoanType.d.ts +2 -1
  94. package/dist/types/model/enums/NetworkFamily.d.ts +3 -3
  95. package/dist/types/model/enums/NetworkType.d.ts +3 -3
  96. package/dist/types/model/enums/PaymentMethodType.d.ts +3 -3
  97. package/dist/types/model/enums/ProductPermissions.d.ts +3 -3
  98. package/dist/types/model/enums/ValidatorStatus.d.ts +27 -0
  99. package/dist/types/model/enums/WalletVisibility.d.ts +3 -3
  100. package/dist/types/model/enums/XMCallStatus.d.ts +29 -0
  101. package/dist/types/model/enums/XMCallType.d.ts +27 -0
  102. package/dist/types/model/enums/XMControlStatus.d.ts +28 -0
  103. package/dist/types/model/enums/XMEntityCallStatus.d.ts +29 -0
  104. package/dist/types/model/enums/XMMarginLevel.d.ts +30 -0
  105. package/dist/types/model/enums/XMParty.d.ts +27 -0
  106. package/dist/types/model/enums/index.d.ts +7 -0
  107. package/dist/types/model/index.d.ts +15 -3
  108. package/dist/types/orders/index.d.ts +3 -1
  109. package/dist/types/orders/types.d.ts +6 -1
  110. package/dist/types/paymentMethods/types.d.ts +1 -0
  111. package/dist/types/shared/dynamicEnumValidation.d.ts +48 -0
  112. package/dist/types/shared/dynamicEnumValidation.old.d.ts +143 -0
  113. package/dist/types/shared/enumHelpers.d.ts +135 -0
  114. package/dist/types/shared/enumRegistry.d.ts +74 -0
  115. package/dist/types/shared/enumValidationCore.d.ts +68 -0
  116. package/dist/types/shared/enumValidators.d.ts +117 -0
  117. package/dist/types/shared/fieldMapping.d.ts +35 -0
  118. package/dist/types/shared/serviceContext.d.ts +46 -0
  119. package/dist/types/staking/index.d.ts +5 -1
  120. package/dist/types/staking/types.d.ts +13 -1
  121. package/dist/types/wallets/types.d.ts +1 -1
  122. package/package.json +5 -4
@@ -0,0 +1,74 @@
1
+ /**
2
+ * Copyright 2025-present Coinbase Global, Inc.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ /**
17
+ * Registry for managing discovered enums and providing lookup capabilities
18
+ */
19
+ export declare class EnumRegistry {
20
+ private enums;
21
+ private enumsByValue;
22
+ private enumsByKey;
23
+ constructor();
24
+ /**
25
+ * Automatically discover and register all enums from the model/enums directory
26
+ */
27
+ private populateEnums;
28
+ /**
29
+ * Check if an object is a valid TypeScript enum
30
+ */
31
+ private isValidEnum;
32
+ /**
33
+ * Index enum values and keys for fast lookup
34
+ */
35
+ private indexEnumValues;
36
+ /**
37
+ * Get a specific enum by name
38
+ */
39
+ getEnum(enumName: string): Record<string, string> | null;
40
+ /**
41
+ * Get all registered enum names
42
+ */
43
+ getAllEnumNames(): string[];
44
+ /**
45
+ * Find enum by value (exact match)
46
+ */
47
+ findEnumByValue(value: string): {
48
+ enum: Record<string, string>;
49
+ name: string;
50
+ } | null;
51
+ /**
52
+ * Find enum by key (exact match)
53
+ */
54
+ findEnumByKey(key: string): {
55
+ enum: Record<string, string>;
56
+ name: string;
57
+ } | null;
58
+ /**
59
+ * Get statistics about discovered enums
60
+ */
61
+ getStats(): {
62
+ totalEnums: number;
63
+ totalValues: number;
64
+ totalKeys: number;
65
+ };
66
+ /**
67
+ * Get detailed information about all enums
68
+ */
69
+ getEnumDetails(): Record<string, {
70
+ values: string[];
71
+ keys: string[];
72
+ }>;
73
+ }
74
+ export declare const enumRegistry: EnumRegistry;
@@ -0,0 +1,68 @@
1
+ /**
2
+ * Copyright 2025-present Coinbase Global, Inc.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ /**
17
+ * Error thrown when a request contains invalid enum values
18
+ */
19
+ export declare class DynamicEnumValidationError extends Error {
20
+ field: string;
21
+ value: string;
22
+ enumName: string;
23
+ validValues: string[];
24
+ validKeys?: string[] | undefined;
25
+ constructor(field: string, value: string, enumName: string, validValues: string[], validKeys?: string[] | undefined);
26
+ }
27
+ /**
28
+ * Configuration for dynamic validation behavior
29
+ */
30
+ export interface DynamicValidationConfig {
31
+ enabled: boolean;
32
+ strict: boolean;
33
+ autoNormalize: boolean;
34
+ logWarnings: boolean;
35
+ serviceName?: string;
36
+ }
37
+ /**
38
+ * Information about a field that contains enum values
39
+ */
40
+ export interface FieldTypeInfo {
41
+ fieldName: string;
42
+ enumName: string;
43
+ isOptional: boolean;
44
+ isArray: boolean;
45
+ }
46
+ /**
47
+ * Check if a value is valid for a specific enum (includes normalization)
48
+ */
49
+ export declare function isValueValidForEnum(value: string, enumObject: Record<string, string>): boolean;
50
+ /**
51
+ * Detects the enum type for a field based on field name patterns and value analysis
52
+ */
53
+ export declare function detectEnumType(fieldName: string, value: string, serviceName?: string): {
54
+ enum: Record<string, string>;
55
+ name: string;
56
+ } | null;
57
+ /**
58
+ * Analyzes a single field to determine if it's an enum
59
+ */
60
+ export declare function analyzeField(fieldName: string, value: any, serviceName?: string): FieldTypeInfo | null;
61
+ /**
62
+ * Validate and normalize a single enum value
63
+ */
64
+ export declare function validateEnumValue(value: string, enumObject: Record<string, string>, enumName: string, fieldName: string, config: DynamicValidationConfig): {
65
+ isValid: boolean;
66
+ normalizedValue?: string;
67
+ error?: string;
68
+ };
@@ -0,0 +1,117 @@
1
+ /**
2
+ * Copyright 2025-present Coinbase Global, Inc.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ /**
17
+ * Convenient enum validators for common Prime API enums.
18
+ * These provide pre-configured validation for frequently used enum types.
19
+ *
20
+ * Note: Most users should use the dynamic validation system instead, which
21
+ * automatically handles all enums. These validators are useful for explicit
22
+ * control or when you need to validate individual enum values.
23
+ */
24
+ import { normalizeEnumValue } from './enumHelpers';
25
+ import { OrderType } from '../model/enums/OrderType';
26
+ import { OrderSide } from '../model/enums/OrderSide';
27
+ import { OrderStatus } from '../model/enums/OrderStatus';
28
+ import { TransactionType } from '../model/enums/TransactionType';
29
+ import { TimeInForceType } from '../model/enums/TimeInForceType';
30
+ /**
31
+ * Order-related enum helpers
32
+ */
33
+ export declare const OrderEnums: {
34
+ /**
35
+ * Validates and normalizes order type values
36
+ * Accepts: 'market', 'limit', 'twap', 'block', 'vwap', 'stopLimit', 'rfq' (case-insensitive)
37
+ */
38
+ getOrderType: (input: string) => OrderType | undefined;
39
+ requireOrderType: (input: string) => OrderType;
40
+ isValidOrderType: (input: string) => boolean;
41
+ /**
42
+ * Validates and normalizes order side values
43
+ * Accepts: 'buy', 'sell' (case-insensitive)
44
+ */
45
+ getOrderSide: (input: string) => OrderSide | undefined;
46
+ requireOrderSide: (input: string) => OrderSide;
47
+ isValidOrderSide: (input: string) => boolean;
48
+ /**
49
+ * Validates and normalizes order status values
50
+ * Accepts: 'open', 'filled', 'cancelled', 'expired', 'failed', 'pending' (case-insensitive)
51
+ */
52
+ getOrderStatus: (input: string) => OrderStatus | undefined;
53
+ requireOrderStatus: (input: string) => OrderStatus;
54
+ isValidOrderStatus: (input: string) => boolean;
55
+ /**
56
+ * Validates and normalizes time in force type values
57
+ * Accepts: 'good_until_cancelled', 'good_until_time', 'immediate_or_cancel', 'fill_or_kill' (case-insensitive)
58
+ */
59
+ getTimeInForceType: (input: string) => TimeInForceType | undefined;
60
+ requireTimeInForceType: (input: string) => TimeInForceType;
61
+ isValidTimeInForceType: (input: string) => boolean;
62
+ };
63
+ /**
64
+ * Transaction-related enum helpers
65
+ */
66
+ export declare const TransactionEnums: {
67
+ /**
68
+ * Validates and normalizes transaction type values
69
+ * Accepts various transaction types like 'deposit', 'withdrawal', 'internalDeposit', etc. (case-insensitive)
70
+ */
71
+ getTransactionType: (input: string) => TransactionType | undefined;
72
+ requireTransactionType: (input: string) => TransactionType;
73
+ isValidTransactionType: (input: string) => boolean;
74
+ };
75
+ /**
76
+ * Utility for creating custom enum validators for any enum type
77
+ *
78
+ * @param enumObject - The enum object to create validators for
79
+ * @param enumName - Name of the enum for error messages
80
+ * @returns Object with validation methods
81
+ *
82
+ * @example
83
+ * import { WalletType } from '../model/enums/WalletType';
84
+ *
85
+ * const WalletValidators = createEnumValidators(WalletType, 'WalletType');
86
+ * WalletValidators.get('trading'); // Gets WalletType value
87
+ * WalletValidators.require('custody'); // Gets WalletType value or throws
88
+ * WalletValidators.isValid('invalid'); // false
89
+ */
90
+ export declare function createEnumValidators<T extends Record<string, string>>(enumObject: T, enumName: string): {
91
+ get: (input: string) => T[keyof T] | undefined;
92
+ require: (input: string) => T[keyof T];
93
+ isValid: (input: string) => boolean;
94
+ values: string[];
95
+ keys: string[];
96
+ };
97
+ /**
98
+ * Convenience function to normalize any string to enum format
99
+ * Useful for debugging or preparing values for API calls
100
+ *
101
+ * @example
102
+ * toEnumFormat('marketOrder') // 'MARKET_ORDER'
103
+ * toEnumFormat('buy') // 'BUY'
104
+ * toEnumFormat('stop-limit') // 'STOP_LIMIT'
105
+ */
106
+ export { normalizeEnumValue as toEnumFormat };
107
+ /**
108
+ * @deprecated Use the dynamic validation system instead.
109
+ *
110
+ * Most users should prefer:
111
+ * ```javascript
112
+ * import { dynamicValidateRequest } from '@coinbase/prime-sdk';
113
+ * const validated = dynamicValidateRequest(request);
114
+ * ```
115
+ *
116
+ * This provides automatic validation for all enum fields without manual configuration.
117
+ */
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Copyright 2025-present Coinbase Global, Inc.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ /**
17
+ * Generate field name variations for plural/singular matching
18
+ */
19
+ export declare function getFieldNameVariations(fieldName: string): string[];
20
+ /**
21
+ * Extract context clues from field names to resolve enum ambiguity
22
+ */
23
+ export declare function extractContextClues(fieldName: string): string[];
24
+ /**
25
+ * Find enum with context awareness to resolve collisions
26
+ */
27
+ export declare function findEnumWithContext(fieldName: string, allEnumNames: string[]): string | null;
28
+ /**
29
+ * Dynamically find enum name based on field name patterns
30
+ */
31
+ export declare function findEnumByFieldName(fieldName: string): string | null;
32
+ /**
33
+ * Get direct field-to-enum mapping with service context and fallback to essential mappings
34
+ */
35
+ export declare function getDirectEnumMapping(fieldName: string, serviceName?: string): string | null;
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Copyright 2025-present Coinbase Global, Inc.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ /**
17
+ * Service context for enhanced enum field detection
18
+ */
19
+ /**
20
+ * Service-specific enum mappings to resolve ambiguous field names
21
+ */
22
+ export interface ServiceEnumContext {
23
+ serviceName: string;
24
+ fieldMappings: Record<string, string>;
25
+ description?: string;
26
+ }
27
+ /**
28
+ * Registry of service contexts for accurate enum detection
29
+ */
30
+ export declare const SERVICE_CONTEXTS: Record<string, ServiceEnumContext>;
31
+ /**
32
+ * Get service context by service name
33
+ */
34
+ export declare function getServiceContext(serviceName: string): ServiceEnumContext | null;
35
+ /**
36
+ * Resolve field to enum using service context
37
+ */
38
+ export declare function resolveFieldWithServiceContext(fieldName: string, serviceName?: string): string | null;
39
+ /**
40
+ * Get all available service contexts
41
+ */
42
+ export declare function getAllServiceContexts(): Record<string, ServiceEnumContext>;
43
+ /**
44
+ * Check if a service has context defined
45
+ */
46
+ export declare function hasServiceContext(serviceName: string): boolean;
@@ -14,12 +14,14 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import { IPrimeApiClient, CoinbaseCallOptions } from '../clients';
17
- import { CreateStakeRequest, CreateStakeResponse, CreateUnstakeRequest, CreateUnstakeResponse, CreatePortfolioStakeRequest, CreatePortfolioStakeResponse, CreatePortfolioUnstakeRequest, CreatePortfolioUnstakeResponse } from './types';
17
+ import { CreateStakeRequest, CreateStakeResponse, CreateUnstakeRequest, CreateUnstakeResponse, CreatePortfolioStakeRequest, CreatePortfolioStakeResponse, CreatePortfolioUnstakeRequest, CreatePortfolioUnstakeResponse, QueryTransactionValidatorsRequest, QueryTransactionValidatorsResponse, ClaimRewardsRequest, ClaimRewardsResponse } from './types';
18
18
  export interface IStakingService {
19
19
  createStake(request: CreateStakeRequest, options?: CoinbaseCallOptions): Promise<CreateStakeResponse>;
20
20
  createUnstake(request: CreateUnstakeRequest, options?: CoinbaseCallOptions): Promise<CreateUnstakeResponse>;
21
21
  createPortfolioStake(request: CreatePortfolioStakeRequest, options?: CoinbaseCallOptions): Promise<CreatePortfolioStakeResponse>;
22
22
  createPortfolioUnstake(request: CreatePortfolioUnstakeRequest, options?: CoinbaseCallOptions): Promise<CreatePortfolioUnstakeResponse>;
23
+ queryTransactionValidators(request: QueryTransactionValidatorsRequest, options?: CoinbaseCallOptions): Promise<QueryTransactionValidatorsResponse>;
24
+ claimRewards(request: ClaimRewardsRequest, options?: CoinbaseCallOptions): Promise<ClaimRewardsResponse>;
23
25
  }
24
26
  export declare class StakingService implements IStakingService {
25
27
  private client;
@@ -28,4 +30,6 @@ export declare class StakingService implements IStakingService {
28
30
  createUnstake(request: CreateUnstakeRequest, options?: CoinbaseCallOptions): Promise<CreateUnstakeResponse>;
29
31
  createPortfolioStake(request: CreatePortfolioStakeRequest, options?: CoinbaseCallOptions): Promise<CreatePortfolioStakeResponse>;
30
32
  createPortfolioUnstake(request: CreatePortfolioUnstakeRequest, options?: CoinbaseCallOptions): Promise<CreatePortfolioUnstakeResponse>;
33
+ queryTransactionValidators(request: QueryTransactionValidatorsRequest, options?: CoinbaseCallOptions): Promise<QueryTransactionValidatorsResponse>;
34
+ claimRewards(request: ClaimRewardsRequest, options?: CoinbaseCallOptions): Promise<ClaimRewardsResponse>;
31
35
  }
@@ -14,7 +14,8 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import { Brand } from '../shared/brand';
17
- import { StakingInitiateResponse, StakingInitiateRequest, StakingUnstakeResponse, PortfolioStakingInitiateRequest, PortfolioStakingInitiateResponse, PortfolioStakingUnstakeRequest, PortfolioStakingUnstakeResponse } from 'src/model/';
17
+ import { BasePaginatedRequest, PaginatedResponseMethods } from '../shared/paginatedResponse';
18
+ import { StakingInitiateResponse, StakingInitiateRequest, StakingUnstakeResponse, PortfolioStakingInitiateRequest, PortfolioStakingInitiateResponse, PortfolioStakingUnstakeRequest, PortfolioStakingUnstakeResponse, ListTransactionValidatorsResponse as internalListTransactionValidatorsResponse, StakingClaimRewardsRequest as internalStakingClaimRewardsRequest, StakingClaimRewardsResponse as internalStakingClaimRewardsResponse } from 'src/model/';
18
19
  export type CreateStakeRequest = StakingInitiateRequest & {
19
20
  portfolioId: string;
20
21
  walletId: string;
@@ -33,3 +34,14 @@ export type CreatePortfolioUnstakeRequest = PortfolioStakingUnstakeRequest & {
33
34
  portfolioId: string;
34
35
  };
35
36
  export type CreatePortfolioUnstakeResponse = Brand<PortfolioStakingUnstakeResponse, 'CreatePortfolioUnstakeResponse'>;
37
+ export type QueryTransactionValidatorsRequest = BasePaginatedRequest & {
38
+ portfolioId: string;
39
+ transactionIds: string[];
40
+ };
41
+ export type BaseQueryTransactionValidatorsResponse = Brand<internalListTransactionValidatorsResponse, 'BaseQueryTransactionValidatorsResponse'>;
42
+ export type QueryTransactionValidatorsResponse = BaseQueryTransactionValidatorsResponse & PaginatedResponseMethods<QueryTransactionValidatorsRequest, BaseQueryTransactionValidatorsResponse, any>;
43
+ export type ClaimRewardsRequest = internalStakingClaimRewardsRequest & {
44
+ portfolioId: string;
45
+ walletId: string;
46
+ };
47
+ export type ClaimRewardsResponse = Brand<internalStakingClaimRewardsResponse, 'ClaimRewardsResponse'>;
@@ -15,7 +15,7 @@
15
15
  */
16
16
  import { Brand } from '../shared/brand';
17
17
  import { WalletType, WalletDepositInstructionType } from '../model/enums/';
18
- import { GetWalletsResponse, GetWalletResponse as internalGet, GetWalletAddressesResponse as internalGetAddresses, GetWalletDepositInstructionsResponse as internalGetInstructs, CreateWalletRequest as internalCreate, CreateWalletResponse as internalCreateResp, BlockchainAddress } from '../model/';
18
+ import { GetWalletsResponse, GetWalletResponse as internalGet, ListWalletAddressesResponse as internalGetAddresses, GetWalletDepositInstructionsResponse as internalGetInstructs, CreateWalletRequest as internalCreate, CreateWalletResponse as internalCreateResp, BlockchainAddress } from '../model/';
19
19
  import { Pagination } from '../shared/pagination';
20
20
  import { BasePaginatedRequest, PaginatedResponseMethods } from '../shared/paginatedResponse';
21
21
  export type ListWalletsRequest = Pagination & {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coinbase-sample/prime-sdk-ts",
3
- "version": "0.6.3",
3
+ "version": "0.7.0",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/types/index.d.ts",
6
6
  "exports": {
@@ -39,9 +39,10 @@
39
39
  "build": "tsc",
40
40
  "lint": "eslint . --ext .js,.ts",
41
41
  "format": "prettier --write \"**/*.{js,ts,tsx,json,css,md}\"",
42
- "gen-types": "openapi-generator-cli generate -i apiSpec/prime-public-api-spec.yaml -g typescript-node --global-property models -o apiSpec/types --additional-properties=supportsES6=true --additional-properties=snapshot=true && cd apiSpec && node generateTypes.js",
42
+ "fetch-spec": "curl -o apiSpec/prime-public-api-spec.yaml https://api.prime.coinbase.com/v1/openapi.yaml",
43
+ "gen-types": "openapi-generator generate -i apiSpec/prime-public-api-spec.yaml -g typescript-node --global-property models -o apiSpec/types --additional-properties=supportsES6=true --additional-properties=snapshot=true && cd apiSpec && node generateTypes.js",
43
44
  "replace-model": "rm -r src/model && cp -r apiSpec/types/processed src/model",
44
- "update-spec": "npm run gen-types && npm run replace-model"
45
+ "update-spec": "npm run fetch-spec && npm run gen-types && npm run replace-model"
45
46
  },
46
47
  "files": [
47
48
  "dist/"
@@ -67,6 +68,6 @@
67
68
  "typescript": "^5.9.2"
68
69
  },
69
70
  "dependencies": {
70
- "@coinbase-sample/core-ts": "^0.2.0"
71
+ "@coinbase-sample/core-ts": "^0.2.1"
71
72
  }
72
73
  }