@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.
- package/dist/constants.js +1 -1
- package/dist/financing/index.js +9 -0
- package/dist/futures/index.js +18 -0
- package/dist/model/CrossMarginOverview.js +21 -0
- package/dist/model/EditOrderRequest.js +21 -0
- package/dist/model/EditOrderResponse.js +21 -0
- package/dist/model/GetCrossMarginOverviewResponse.js +21 -0
- package/dist/model/ListTransactionValidatorsRequest.js +21 -0
- package/dist/model/ListTransactionValidatorsResponse.js +21 -0
- package/dist/model/StakingClaimRewardsRequest.js +21 -0
- package/dist/model/StakingClaimRewardsResponse.js +21 -0
- package/dist/model/TransactionValidator.js +21 -0
- package/dist/model/WalletClaimRewardsInputs.js +21 -0
- package/dist/model/XMLoan.js +21 -0
- package/dist/model/XMMarginCall.js +21 -0
- package/dist/model/XMPosition.js +21 -0
- package/dist/model/XMRiskNettingInfo.js +21 -0
- package/dist/model/XMSummary.js +21 -0
- package/dist/model/enumPrefixes.js +330 -0
- package/dist/model/enums/ActivityCategory.js +0 -1
- package/dist/model/enums/ActivityLevel.js +3 -3
- package/dist/model/enums/AddressBookType.js +3 -3
- package/dist/model/enums/AllocationStatus.js +5 -5
- package/dist/model/enums/CustodyActivityType.js +29 -29
- package/dist/model/enums/DestinationType.js +4 -4
- package/dist/model/enums/FcmFuturesSweepStatus.js +5 -5
- package/dist/model/enums/FcmMarginCallState.js +5 -5
- package/dist/model/enums/FcmMarginCallType.js +3 -3
- package/dist/model/enums/HierarchyType.js +3 -3
- package/dist/model/enums/InvoiceState.js +5 -5
- package/dist/model/enums/InvoiceType.js +6 -6
- package/dist/model/enums/LoanType.js +1 -0
- package/dist/model/enums/NetworkFamily.js +3 -3
- package/dist/model/enums/NetworkType.js +3 -3
- package/dist/model/enums/PaymentMethodType.js +3 -3
- package/dist/model/enums/ProductPermissions.js +3 -3
- package/dist/model/enums/ValidatorStatus.js +31 -0
- package/dist/model/enums/WalletVisibility.js +3 -3
- package/dist/model/enums/XMCallStatus.js +33 -0
- package/dist/model/enums/XMCallType.js +31 -0
- package/dist/model/enums/XMControlStatus.js +32 -0
- package/dist/model/enums/XMEntityCallStatus.js +33 -0
- package/dist/model/enums/XMMarginLevel.js +34 -0
- package/dist/model/enums/XMParty.js +31 -0
- package/dist/model/enums/index.js +15 -1
- package/dist/orders/index.js +12 -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/staking/index.js +37 -0
- package/dist/types/balances/types.d.ts +1 -1
- package/dist/types/constants.d.ts +1 -1
- package/dist/types/financing/index.d.ts +3 -1
- package/dist/types/financing/types.d.ts +5 -1
- package/dist/types/futures/index.d.ts +6 -1
- package/dist/types/futures/types.d.ts +9 -1
- package/dist/types/index.d.ts +3 -3
- package/dist/types/model/CrossMarginOverview.d.ts +39 -0
- package/dist/types/model/EditOrderRequest.d.ts +61 -0
- package/dist/types/model/EditOrderResponse.d.ts +25 -0
- package/dist/types/model/GetCrossMarginOverviewResponse.d.ts +23 -0
- package/dist/types/model/ListTransactionValidatorsRequest.d.ts +35 -0
- package/dist/types/model/ListTransactionValidatorsResponse.d.ts +28 -0
- package/dist/types/model/RFQProductDetails.d.ts +21 -0
- package/dist/types/model/StakingClaimRewardsRequest.d.ts +27 -0
- package/dist/types/model/StakingClaimRewardsResponse.d.ts +33 -0
- package/dist/types/model/TransactionValidator.d.ts +31 -0
- package/dist/types/model/WalletClaimRewardsInputs.d.ts +28 -0
- package/dist/types/model/XMLoan.d.ts +51 -0
- package/dist/types/model/XMMarginCall.d.ts +57 -0
- package/dist/types/model/XMPosition.d.ts +121 -0
- package/dist/types/model/XMRiskNettingInfo.d.ts +76 -0
- package/dist/types/model/XMSummary.d.ts +55 -0
- package/dist/types/model/enumPrefixes.d.ts +206 -0
- package/dist/types/model/enums/ActivityCategory.d.ts +0 -1
- package/dist/types/model/enums/ActivityLevel.d.ts +3 -3
- package/dist/types/model/enums/AddressBookType.d.ts +3 -3
- package/dist/types/model/enums/AllocationStatus.d.ts +5 -5
- package/dist/types/model/enums/CustodyActivityType.d.ts +29 -29
- package/dist/types/model/enums/DestinationType.d.ts +4 -4
- package/dist/types/model/enums/FcmFuturesSweepStatus.d.ts +5 -5
- package/dist/types/model/enums/FcmMarginCallState.d.ts +5 -5
- package/dist/types/model/enums/FcmMarginCallType.d.ts +3 -3
- package/dist/types/model/enums/HierarchyType.d.ts +3 -3
- package/dist/types/model/enums/InvoiceState.d.ts +5 -5
- package/dist/types/model/enums/InvoiceType.d.ts +6 -6
- package/dist/types/model/enums/LoanType.d.ts +2 -1
- package/dist/types/model/enums/NetworkFamily.d.ts +3 -3
- package/dist/types/model/enums/NetworkType.d.ts +3 -3
- package/dist/types/model/enums/PaymentMethodType.d.ts +3 -3
- package/dist/types/model/enums/ProductPermissions.d.ts +3 -3
- package/dist/types/model/enums/ValidatorStatus.d.ts +27 -0
- package/dist/types/model/enums/WalletVisibility.d.ts +3 -3
- package/dist/types/model/enums/XMCallStatus.d.ts +29 -0
- package/dist/types/model/enums/XMCallType.d.ts +27 -0
- package/dist/types/model/enums/XMControlStatus.d.ts +28 -0
- package/dist/types/model/enums/XMEntityCallStatus.d.ts +29 -0
- package/dist/types/model/enums/XMMarginLevel.d.ts +30 -0
- package/dist/types/model/enums/XMParty.d.ts +27 -0
- package/dist/types/model/enums/index.d.ts +7 -0
- package/dist/types/model/index.d.ts +15 -3
- package/dist/types/orders/index.d.ts +3 -1
- package/dist/types/orders/types.d.ts +6 -1
- 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/dist/types/staking/index.d.ts +5 -1
- package/dist/types/staking/types.d.ts +13 -1
- package/dist/types/wallets/types.d.ts +1 -1
- package/package.json +5 -4
|
@@ -0,0 +1,28 @@
|
|
|
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
|
+
/**
|
|
21
|
+
* - TRADES_AND_WITHDRAWALS: Allowed to trade and withdraw. See XM Margin Methodology for full description of when trading and withdrawals are enabled or disabled. - TRADES_ONLY: Allowed to trade but not withdraw. See XM Margin Methodology for full description of when trading and withdrawals are enabled or disabled. - SESSION_LOCKED: Not allowed to trade or withdraw. See XM Margin Methodology for full description of when trading and withdrawals are enabled or disabled.
|
|
22
|
+
*/
|
|
23
|
+
export declare enum XMControlStatus {
|
|
24
|
+
XmControlStatusUnspecified = "XM_CONTROL_STATUS_UNSPECIFIED",
|
|
25
|
+
TradesAndWithdrawals = "TRADES_AND_WITHDRAWALS",
|
|
26
|
+
TradesOnly = "TRADES_ONLY",
|
|
27
|
+
SessionLocked = "SESSION_LOCKED"
|
|
28
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
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
|
+
/**
|
|
21
|
+
* - ENTITY_NO_CALL: There are no margin calls - ENTITY_OPEN_STANDARD_CALL: There is a standard margin call. There are no urgent margin calls, and no expired margin calls. - ENTITY_OPEN_URGENT_CALL: There is an urgent margin call. It is possible that there could also be a standard margin call, but there are no expired margin calls. - ENTITY_AGED_CALL: At least one open margin call is aged (standard or urgent). This may trigger the SESSION_LOCKED control status.
|
|
22
|
+
*/
|
|
23
|
+
export declare enum XMEntityCallStatus {
|
|
24
|
+
XmEntityCallStatusUnspecified = "XM_ENTITY_CALL_STATUS_UNSPECIFIED",
|
|
25
|
+
EntityNoCall = "ENTITY_NO_CALL",
|
|
26
|
+
EntityOpenStandardCall = "ENTITY_OPEN_STANDARD_CALL",
|
|
27
|
+
EntityOpenUrgentCall = "ENTITY_OPEN_URGENT_CALL",
|
|
28
|
+
EntityAgedCall = "ENTITY_AGED_CALL"
|
|
29
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
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
|
+
/**
|
|
21
|
+
* - HEALTHY_THRESHOLD: Margin level is healthy - DEFICIT_THRESHOLD: Margin level is breaching the deficit threshold (DT) which will result in the issuance of a Margin Call if this is still the case by the scheduled next Margin Call time (as defined in the margin methodology) - WARNING_THRESHOLD: Margin level is breaching the warning threshold (WT) which will result in the issuance of a Margin Call if this is still the case by the scheduled next Margin Call (as defined in the margin methodology). WT is differentiated from DT in that it means margin health is approaching the UMCT - URGENT_MARGIN_CALL_THRESHOLD: Margin level is breaching the UMCT and, as defined in the margin methodology, this will trigger an urgent margin call - LIQUIDATION_THRESHOLD: Margin level is breaching the liquidation threshold (LT) and, as defined in the margin methodology, this will trigger the SESSION_LOCKED control status and liquidation may commence.
|
|
22
|
+
*/
|
|
23
|
+
export declare enum XMMarginLevel {
|
|
24
|
+
XmMarginLevelUnspecified = "XM_MARGIN_LEVEL_UNSPECIFIED",
|
|
25
|
+
HealthyThreshold = "HEALTHY_THRESHOLD",
|
|
26
|
+
DeficitThreshold = "DEFICIT_THRESHOLD",
|
|
27
|
+
WarningThreshold = "WARNING_THRESHOLD",
|
|
28
|
+
UrgentMarginCallThreshold = "URGENT_MARGIN_CALL_THRESHOLD",
|
|
29
|
+
LiquidationThreshold = "LIQUIDATION_THRESHOLD"
|
|
30
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
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
|
+
/**
|
|
21
|
+
* - CBE: Coinbase Exchange, trading venue that can receive the XM loan - FCM: Coinbase’s Futures Commission Merchant, trading venue that can receive the XM loan
|
|
22
|
+
*/
|
|
23
|
+
export declare enum XMParty {
|
|
24
|
+
XmPartyUnspecified = "XM_PARTY_UNSPECIFIED",
|
|
25
|
+
Cbe = "CBE",
|
|
26
|
+
Fcm = "FCM"
|
|
27
|
+
}
|
|
@@ -37,7 +37,14 @@ export { TransactionStatus } from './TransactionStatus';
|
|
|
37
37
|
export { TransactionType } from './TransactionType';
|
|
38
38
|
export { TransferLocationType } from './TransferLocationType';
|
|
39
39
|
export { UserRole } from './UserRole';
|
|
40
|
+
export { ValidatorStatus } from './ValidatorStatus';
|
|
40
41
|
export { VisibilityStatus } from './VisibilityStatus';
|
|
41
42
|
export { WalletDepositInstructionType } from './WalletDepositInstructionType';
|
|
42
43
|
export { WalletType } from './WalletType';
|
|
43
44
|
export { WalletVisibility } from './WalletVisibility';
|
|
45
|
+
export { XMCallStatus } from './XMCallStatus';
|
|
46
|
+
export { XMCallType } from './XMCallType';
|
|
47
|
+
export { XMControlStatus } from './XMControlStatus';
|
|
48
|
+
export { XMEntityCallStatus } from './XMEntityCallStatus';
|
|
49
|
+
export { XMMarginLevel } from './XMMarginLevel';
|
|
50
|
+
export { XMParty } from './XMParty';
|
|
@@ -27,7 +27,6 @@ export type { Conversion } from './Conversion';
|
|
|
27
27
|
export type { ConversionDetail } from './ConversionDetail';
|
|
28
28
|
export type { Counterparty } from './Counterparty';
|
|
29
29
|
export type { CounterpartyDestination } from './CounterpartyDestination';
|
|
30
|
-
export type { CreateAddressGroup } from './CreateAddressGroup';
|
|
31
30
|
export type { CreateAllocationRequest } from './CreateAllocationRequest';
|
|
32
31
|
export type { CreateAllocationResponse } from './CreateAllocationResponse';
|
|
33
32
|
export type { CreateAllocationResponseBody } from './CreateAllocationResponseBody';
|
|
@@ -42,8 +41,10 @@ export type { CreatePortfolioAddressBookEntryResponse } from './CreatePortfolioA
|
|
|
42
41
|
export type { CreateWalletResponse } from './CreateWalletResponse';
|
|
43
42
|
export type { CreateWalletTransferResponse } from './CreateWalletTransferResponse';
|
|
44
43
|
export type { CreateWalletWithdrawalResponse } from './CreateWalletWithdrawalResponse';
|
|
44
|
+
export type { CrossMarginOverview } from './CrossMarginOverview';
|
|
45
45
|
export type { DefiBalance } from './DefiBalance';
|
|
46
46
|
export type { DestinationAlloc } from './DestinationAlloc';
|
|
47
|
+
export type { EditOrderResponse } from './EditOrderResponse';
|
|
47
48
|
export type { EntityBalance } from './EntityBalance';
|
|
48
49
|
export type { EntityUser } from './EntityUser';
|
|
49
50
|
export type { EstimatedNetworkFees } from './EstimatedNetworkFees';
|
|
@@ -57,6 +58,7 @@ export type { GetActivityResponse } from './GetActivityResponse';
|
|
|
57
58
|
export type { GetAllocationResponse } from './GetAllocationResponse';
|
|
58
59
|
export type { GetAllocationsByClientNettingIdResponse } from './GetAllocationsByClientNettingIdResponse';
|
|
59
60
|
export type { GetBuyingPowerResponse } from './GetBuyingPowerResponse';
|
|
61
|
+
export type { GetCrossMarginOverviewResponse } from './GetCrossMarginOverviewResponse';
|
|
60
62
|
export type { GetEntityActivitiesResponse } from './GetEntityActivitiesResponse';
|
|
61
63
|
export type { GetEntityAssetsResponse } from './GetEntityAssetsResponse';
|
|
62
64
|
export type { GetEntityPaymentMethodDetailsResponse } from './GetEntityPaymentMethodDetailsResponse';
|
|
@@ -96,7 +98,6 @@ export type { GetPositionsResponse } from './GetPositionsResponse';
|
|
|
96
98
|
export type { GetPostTradeCreditResponse } from './GetPostTradeCreditResponse';
|
|
97
99
|
export type { GetTFTieredPricingFeesResponse } from './GetTFTieredPricingFeesResponse';
|
|
98
100
|
export type { GetTransactionResponse } from './GetTransactionResponse';
|
|
99
|
-
export type { GetWalletAddressesResponse } from './GetWalletAddressesResponse';
|
|
100
101
|
export type { GetWalletBalanceResponse } from './GetWalletBalanceResponse';
|
|
101
102
|
export type { GetWalletDepositInstructionsResponse } from './GetWalletDepositInstructionsResponse';
|
|
102
103
|
export type { GetWalletResponse } from './GetWalletResponse';
|
|
@@ -109,6 +110,7 @@ export type { ListAggregateEntityPositionsResponse } from './ListAggregateEntity
|
|
|
109
110
|
export type { ListEntityBalancesResponse } from './ListEntityBalancesResponse';
|
|
110
111
|
export type { ListEntityPositionsResponse } from './ListEntityPositionsResponse';
|
|
111
112
|
export type { ListOnchainAddressGroupsResponse } from './ListOnchainAddressGroupsResponse';
|
|
113
|
+
export type { ListTransactionValidatorsResponse } from './ListTransactionValidatorsResponse';
|
|
112
114
|
export type { ListWalletAddressesResponse } from './ListWalletAddressesResponse';
|
|
113
115
|
export type { ListWeb3WalletBalancesResponse } from './ListWeb3WalletBalancesResponse';
|
|
114
116
|
export type { LoanInfo } from './LoanInfo';
|
|
@@ -149,15 +151,17 @@ export type { RpcConfig } from './RpcConfig';
|
|
|
149
151
|
export type { ScheduleFuturesSweepResponse } from './ScheduleFuturesSweepResponse';
|
|
150
152
|
export type { SetAutoSweepResponse } from './SetAutoSweepResponse';
|
|
151
153
|
export type { ShortCollateral } from './ShortCollateral';
|
|
154
|
+
export type { StakingClaimRewardsResponse } from './StakingClaimRewardsResponse';
|
|
152
155
|
export type { StakingInitiateResponse } from './StakingInitiateResponse';
|
|
153
|
-
export type { StakingInputs } from './StakingInputs';
|
|
154
156
|
export type { StakingUnstakeResponse } from './StakingUnstakeResponse';
|
|
155
157
|
export type { TieredPricingFee } from './TieredPricingFee';
|
|
156
158
|
export type { Transaction } from './Transaction';
|
|
157
159
|
export type { TransactionMetadata } from './TransactionMetadata';
|
|
160
|
+
export type { TransactionValidator } from './TransactionValidator';
|
|
158
161
|
export type { TransferLocation } from './TransferLocation';
|
|
159
162
|
export type { UserAction } from './UserAction';
|
|
160
163
|
export type { Wallet } from './Wallet';
|
|
164
|
+
export type { WalletClaimRewardsInputs } from './WalletClaimRewardsInputs';
|
|
161
165
|
export type { WalletCryptoDepositInstructions } from './WalletCryptoDepositInstructions';
|
|
162
166
|
export type { WalletFiatDepositInstructions } from './WalletFiatDepositInstructions';
|
|
163
167
|
export type { WalletStakeInputs } from './WalletStakeInputs';
|
|
@@ -166,6 +170,11 @@ export type { Web3Asset } from './Web3Asset';
|
|
|
166
170
|
export type { Web3Balance } from './Web3Balance';
|
|
167
171
|
export type { Web3TransactionMetadata } from './Web3TransactionMetadata';
|
|
168
172
|
export type { WithdrawalPower } from './WithdrawalPower';
|
|
173
|
+
export type { XMLoan } from './XMLoan';
|
|
174
|
+
export type { XMMarginCall } from './XMMarginCall';
|
|
175
|
+
export type { XMPosition } from './XMPosition';
|
|
176
|
+
export type { XMRiskNettingInfo } from './XMRiskNettingInfo';
|
|
177
|
+
export type { XMSummary } from './XMSummary';
|
|
169
178
|
export type { CreateATransferBetweenTwoWallets } from './createATransferBetweenTwoWallets';
|
|
170
179
|
export type { AcceptQuoteRequest } from './AcceptQuoteRequest';
|
|
171
180
|
export type { CreateConversionRequest } from './CreateConversionRequest';
|
|
@@ -176,11 +185,14 @@ export type { CreatePortfolioAddressBookEntryRequest } from './CreatePortfolioAd
|
|
|
176
185
|
export type { CreateWalletDepositAddressRequest } from './CreateWalletDepositAddressRequest';
|
|
177
186
|
export type { CreateWalletRequest } from './CreateWalletRequest';
|
|
178
187
|
export type { CreateWalletWithdrawalRequest } from './CreateWalletWithdrawalRequest';
|
|
188
|
+
export type { EditOrderRequest } from './EditOrderRequest';
|
|
189
|
+
export type { ListTransactionValidatorsRequest } from './ListTransactionValidatorsRequest';
|
|
179
190
|
export type { OrderPreviewRequest } from './OrderPreviewRequest';
|
|
180
191
|
export type { PortfolioStakingInitiateRequest } from './PortfolioStakingInitiateRequest';
|
|
181
192
|
export type { PortfolioStakingUnstakeRequest } from './PortfolioStakingUnstakeRequest';
|
|
182
193
|
export type { ScheduleFuturesSweepRequest } from './ScheduleFuturesSweepRequest';
|
|
183
194
|
export type { SetAutoSweepRequest } from './SetAutoSweepRequest';
|
|
195
|
+
export type { StakingClaimRewardsRequest } from './StakingClaimRewardsRequest';
|
|
184
196
|
export type { StakingInitiateRequest } from './StakingInitiateRequest';
|
|
185
197
|
export type { StakingUnstakeRequest } from './StakingUnstakeRequest';
|
|
186
198
|
export type { CreateNetAllocationRequest } from './CreateNetAllocationRequest';
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import { CoinbaseCallOptions, IPrimeApiClient } from '../clients';
|
|
17
|
-
import { ListOpenOrdersResponse, ListOpenOrdersRequest, ListOrderFillsRequest, ListOrderFillsResponse, ListPortfolioOrdersResponse, ListPortfolioOrdersRequest, GetOrderResponse, GetOrderRequest, GetOrderEditHistoryRequest, GetOrderEditHistoryResponse, ListPortfolioFillsRequest, ListPortfolioFillsResponse, CreateOrderPreviewRequest, CreateOrderPreviewResponse, CancelOrderRequest, CancelOrderResponse, CreateOrderRequest, CreateOrderResponse, CreateQuoteRequest, CreateQuoteResponse, AcceptQuoteRequest, AcceptQuoteResponse } from './types';
|
|
17
|
+
import { ListOpenOrdersResponse, ListOpenOrdersRequest, ListOrderFillsRequest, ListOrderFillsResponse, ListPortfolioOrdersResponse, ListPortfolioOrdersRequest, GetOrderResponse, GetOrderRequest, GetOrderEditHistoryRequest, GetOrderEditHistoryResponse, ListPortfolioFillsRequest, ListPortfolioFillsResponse, CreateOrderPreviewRequest, CreateOrderPreviewResponse, CancelOrderRequest, CancelOrderResponse, CreateOrderRequest, CreateOrderResponse, CreateQuoteRequest, CreateQuoteResponse, AcceptQuoteRequest, AcceptQuoteResponse, EditOrderRequest, EditOrderResponse } from './types';
|
|
18
18
|
export interface IOrdersService {
|
|
19
19
|
getOrder(request: GetOrderRequest, options?: CoinbaseCallOptions): Promise<GetOrderResponse>;
|
|
20
20
|
getOrderEditHistory(request: GetOrderEditHistoryRequest, options?: CoinbaseCallOptions): Promise<GetOrderEditHistoryResponse>;
|
|
@@ -27,6 +27,7 @@ export interface IOrdersService {
|
|
|
27
27
|
createOrder(request: CreateOrderRequest, options?: CoinbaseCallOptions): Promise<CreateOrderResponse>;
|
|
28
28
|
createQuote(request: CreateQuoteRequest, options?: CoinbaseCallOptions): Promise<CreateQuoteResponse>;
|
|
29
29
|
acceptQuote(request: AcceptQuoteRequest, options?: CoinbaseCallOptions): Promise<AcceptQuoteResponse>;
|
|
30
|
+
editOrder(request: EditOrderRequest, options?: CoinbaseCallOptions): Promise<EditOrderResponse>;
|
|
30
31
|
}
|
|
31
32
|
export declare class OrdersService implements IOrdersService {
|
|
32
33
|
private client;
|
|
@@ -42,4 +43,5 @@ export declare class OrdersService implements IOrdersService {
|
|
|
42
43
|
createOrder(request: CreateOrderRequest, options?: CoinbaseCallOptions): Promise<CreateOrderResponse>;
|
|
43
44
|
createQuote(request: CreateQuoteRequest, options?: CoinbaseCallOptions): Promise<CreateQuoteResponse>;
|
|
44
45
|
acceptQuote(request: AcceptQuoteRequest, options?: CoinbaseCallOptions): Promise<AcceptQuoteResponse>;
|
|
46
|
+
editOrder(request: EditOrderRequest, options?: CoinbaseCallOptions): Promise<EditOrderResponse>;
|
|
45
47
|
}
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import { Brand } from '../shared/brand';
|
|
17
17
|
import { OrderSide, OrderStatus, OrderType } from '../model/enums/';
|
|
18
|
-
import { GetOpenOrdersResponse, GetOrderFillsResponse, GetOrderResponse as internalGet, GetOrdersResponse, GetPortfolioFillsResponse, GetOrderEditHistoryResponse as internalEditHistory, OrderPreviewRequest, PostOrderPreviewResponse, CancelOrderResponse as internalCancel, CreateOrderResponse as internalCreateResp, CreateOrderRequest as internalCreate, QuoteResponse, AcceptQuoteRequest as internalAcceptQuoteReq, AcceptQuoteResponse as internalAcceptQuoteResp } from '../model/';
|
|
18
|
+
import { GetOpenOrdersResponse, GetOrderFillsResponse, GetOrderResponse as internalGet, GetOrdersResponse, GetPortfolioFillsResponse, GetOrderEditHistoryResponse as internalEditHistory, OrderPreviewRequest, PostOrderPreviewResponse, CancelOrderResponse as internalCancel, CreateOrderResponse as internalCreateResp, CreateOrderRequest as internalCreate, QuoteResponse, AcceptQuoteRequest as internalAcceptQuoteReq, AcceptQuoteResponse as internalAcceptQuoteResp, EditOrderRequest as internalEditOrderRequest, EditOrderResponse as internalEditOrderResponse } from '../model/';
|
|
19
19
|
import { Pagination } from '../shared/pagination';
|
|
20
20
|
import { BasePaginatedRequest, PaginatedResponseMethods } from '../shared/paginatedResponse';
|
|
21
21
|
export type GetOrderRequest = {
|
|
@@ -83,3 +83,8 @@ export type GetOrderEditHistoryRequest = {
|
|
|
83
83
|
orderId: string;
|
|
84
84
|
};
|
|
85
85
|
export type GetOrderEditHistoryResponse = Brand<Omit<internalEditHistory, 'orderEditHistory'>, 'GetOrderEditHistoryResponse'>;
|
|
86
|
+
export type EditOrderRequest = internalEditOrderRequest & {
|
|
87
|
+
portfolioId: string;
|
|
88
|
+
orderId: string;
|
|
89
|
+
};
|
|
90
|
+
export type EditOrderResponse = Brand<internalEditOrderResponse, 'EditOrderResponse'>;
|
|
@@ -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'>;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2025-present Coinbase Global, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* Dynamic enum validation system that automatically discovers and validates
|
|
18
|
+
* enum fields in request objects without manual service-specific configuration.
|
|
19
|
+
*
|
|
20
|
+
* This approach is more scalable and maintainable than manual validation rules.
|
|
21
|
+
*/
|
|
22
|
+
import { enumRegistry } from './enumRegistry';
|
|
23
|
+
import { DynamicEnumValidationError, DynamicValidationConfig, FieldTypeInfo } from './enumValidationCore';
|
|
24
|
+
/**
|
|
25
|
+
* Set global configuration for dynamic enum validation
|
|
26
|
+
*/
|
|
27
|
+
export declare function setDynamicValidationConfig(config: Partial<DynamicValidationConfig>): void;
|
|
28
|
+
/**
|
|
29
|
+
* Get current dynamic validation configuration
|
|
30
|
+
*/
|
|
31
|
+
export declare function getDynamicValidationConfig(): DynamicValidationConfig;
|
|
32
|
+
/**
|
|
33
|
+
* Main API: Validate and normalize request with type-safe generics
|
|
34
|
+
*/
|
|
35
|
+
export declare function dynamicValidateRequest<T>(request: T, config?: Partial<DynamicValidationConfig>): T;
|
|
36
|
+
/**
|
|
37
|
+
* Get information about discovered enums
|
|
38
|
+
*/
|
|
39
|
+
export declare function getEnumInfo(): {
|
|
40
|
+
totalEnums: number;
|
|
41
|
+
enumNames: string[];
|
|
42
|
+
enumDetails: Record<string, {
|
|
43
|
+
values: string[];
|
|
44
|
+
keys: string[];
|
|
45
|
+
}>;
|
|
46
|
+
};
|
|
47
|
+
export { DynamicEnumValidationError, DynamicValidationConfig, FieldTypeInfo };
|
|
48
|
+
export { enumRegistry };
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2025-present Coinbase Global, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* Error thrown when a request contains invalid enum values
|
|
18
|
+
*/
|
|
19
|
+
export declare class DynamicEnumValidationError extends Error {
|
|
20
|
+
field: string;
|
|
21
|
+
value: string;
|
|
22
|
+
enumName: string;
|
|
23
|
+
validValues: string[];
|
|
24
|
+
validKeys?: string[] | undefined;
|
|
25
|
+
constructor(field: string, value: string, enumName: string, validValues: string[], validKeys?: string[] | undefined);
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Registry of all available enums for dynamic lookup
|
|
29
|
+
*/
|
|
30
|
+
declare class EnumRegistry {
|
|
31
|
+
private enumMap;
|
|
32
|
+
private enumNameMap;
|
|
33
|
+
constructor();
|
|
34
|
+
/**
|
|
35
|
+
* Automatically register all enums from the model/enums directory
|
|
36
|
+
*/
|
|
37
|
+
private registerAllEnums;
|
|
38
|
+
/**
|
|
39
|
+
* Check if an object is a valid enum
|
|
40
|
+
*/
|
|
41
|
+
private isValidEnum;
|
|
42
|
+
/**
|
|
43
|
+
* Get enum by name
|
|
44
|
+
*/
|
|
45
|
+
getEnum(enumName: string): Record<string, string> | undefined;
|
|
46
|
+
/**
|
|
47
|
+
* Get enum name for a given enum object
|
|
48
|
+
*/
|
|
49
|
+
getEnumName(enumObject: Record<string, string>): string | undefined;
|
|
50
|
+
/**
|
|
51
|
+
* Find enum that contains a specific value
|
|
52
|
+
*/
|
|
53
|
+
findEnumByValue(value: string): {
|
|
54
|
+
enum: Record<string, string>;
|
|
55
|
+
name: string;
|
|
56
|
+
} | undefined;
|
|
57
|
+
/**
|
|
58
|
+
* Find enum that contains a specific key
|
|
59
|
+
*/
|
|
60
|
+
findEnumByKey(key: string): {
|
|
61
|
+
enum: Record<string, string>;
|
|
62
|
+
name: string;
|
|
63
|
+
} | undefined;
|
|
64
|
+
/**
|
|
65
|
+
* Get all registered enum names
|
|
66
|
+
*/
|
|
67
|
+
getAllEnumNames(): string[];
|
|
68
|
+
/**
|
|
69
|
+
* Validate a value against a specific enum with prefix handling
|
|
70
|
+
*/
|
|
71
|
+
validateEnumValue(enumName: string, value: string): {
|
|
72
|
+
valid: boolean;
|
|
73
|
+
normalizedValue?: string;
|
|
74
|
+
error?: string;
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
declare const enumRegistry: EnumRegistry;
|
|
78
|
+
/**
|
|
79
|
+
* Validates and normalizes enum fields in a request object
|
|
80
|
+
*/
|
|
81
|
+
export declare function validateRequestEnums(request: any, options?: {
|
|
82
|
+
strict?: boolean;
|
|
83
|
+
autoNormalize?: boolean;
|
|
84
|
+
}): {
|
|
85
|
+
validatedRequest: any;
|
|
86
|
+
errors: string[];
|
|
87
|
+
};
|
|
88
|
+
/**
|
|
89
|
+
* Simplified validation function that throws on first error
|
|
90
|
+
*/
|
|
91
|
+
export declare function validateAndNormalizeRequest(request: any): any;
|
|
92
|
+
/**
|
|
93
|
+
* Configuration for dynamic validation
|
|
94
|
+
*/
|
|
95
|
+
export interface DynamicValidationConfig {
|
|
96
|
+
enabled?: boolean;
|
|
97
|
+
strict?: boolean;
|
|
98
|
+
autoNormalize?: boolean;
|
|
99
|
+
logWarnings?: boolean;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Set global dynamic validation configuration
|
|
103
|
+
*/
|
|
104
|
+
export declare function setDynamicValidationConfig(config: Partial<DynamicValidationConfig>): void;
|
|
105
|
+
/**
|
|
106
|
+
* Get current dynamic validation configuration
|
|
107
|
+
*/
|
|
108
|
+
export declare function getDynamicValidationConfig(): DynamicValidationConfig;
|
|
109
|
+
/**
|
|
110
|
+
* Type-safe dynamic enum validation function
|
|
111
|
+
*
|
|
112
|
+
* Automatically validates and normalizes enum values in request objects
|
|
113
|
+
* using the auto-generated prefix patterns from the OpenAPI specification.
|
|
114
|
+
*
|
|
115
|
+
* @param request - The request object to validate and normalize
|
|
116
|
+
* @param config - Optional validation configuration
|
|
117
|
+
* @returns The validated request with normalized enum values
|
|
118
|
+
*
|
|
119
|
+
* @example
|
|
120
|
+
* ```typescript
|
|
121
|
+
* const validated = dynamicValidateRequest<CreateOrderRequest>({
|
|
122
|
+
* portfolioId: 'portfolio-123',
|
|
123
|
+
* side: 'buy', // → 'BUY'
|
|
124
|
+
* type: 'market' // → 'MARKET'
|
|
125
|
+
* });
|
|
126
|
+
* ```
|
|
127
|
+
*/
|
|
128
|
+
export declare function dynamicValidateRequest<T>(request: T, config?: Partial<DynamicValidationConfig>): T;
|
|
129
|
+
/**
|
|
130
|
+
* Export the enum registry for advanced usage
|
|
131
|
+
*/
|
|
132
|
+
export { enumRegistry };
|
|
133
|
+
/**
|
|
134
|
+
* Utility function to get information about available enums
|
|
135
|
+
*/
|
|
136
|
+
export declare function getEnumInfo(): {
|
|
137
|
+
enumNames: string[];
|
|
138
|
+
totalEnums: number;
|
|
139
|
+
enumDetails: Record<string, {
|
|
140
|
+
values: string[];
|
|
141
|
+
keys: string[];
|
|
142
|
+
}>;
|
|
143
|
+
};
|
|
@@ -0,0 +1,135 @@
|
|
|
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
|
+
* Enum transformation utilities for JavaScript developers.
|
|
18
|
+
* These helpers make it easier to work with enums by providing:
|
|
19
|
+
* - Case-insensitive enum lookups
|
|
20
|
+
* - CamelCase to SNAKE_CASE conversion
|
|
21
|
+
* - Enum validation with helpful error messages
|
|
22
|
+
* - Support for prefix-aware transformations
|
|
23
|
+
*/
|
|
24
|
+
/**
|
|
25
|
+
* Converts a string from various formats to the expected enum value format (SCREAMING_SNAKE_CASE)
|
|
26
|
+
*
|
|
27
|
+
* @param input - The input string in any case format
|
|
28
|
+
* @returns The normalized SCREAMING_SNAKE_CASE string
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* normalizeEnumValue('buy') // 'BUY'
|
|
32
|
+
* normalizeEnumValue('marketOrder') // 'MARKET_ORDER'
|
|
33
|
+
* normalizeEnumValue('STOP_LIMIT') // 'STOP_LIMIT'
|
|
34
|
+
* normalizeEnumValue('Order_Type_Market') // 'ORDER_TYPE_MARKET'
|
|
35
|
+
*/
|
|
36
|
+
export declare function normalizeEnumValue(input: string): string;
|
|
37
|
+
/**
|
|
38
|
+
* Safely gets an enum value by normalizing the input and checking if it exists
|
|
39
|
+
*
|
|
40
|
+
* @param enumObject - The enum object to search in
|
|
41
|
+
* @param input - The input value to normalize and find
|
|
42
|
+
* @param enumName - Optional enum name for better error messages
|
|
43
|
+
* @returns The matching enum value or undefined if not found
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* import { OrderSide } from '../model/enums/OrderSide';
|
|
47
|
+
*
|
|
48
|
+
* getEnumValue(OrderSide, 'buy') // OrderSide.Buy
|
|
49
|
+
* getEnumValue(OrderSide, 'BUY') // OrderSide.Buy
|
|
50
|
+
* getEnumValue(OrderSide, 'invalid') // undefined
|
|
51
|
+
*/
|
|
52
|
+
export declare function getEnumValue<T extends Record<string, string>>(enumObject: T, input: string, enumName?: string): T[keyof T] | undefined;
|
|
53
|
+
/**
|
|
54
|
+
* Gets an enum value with strict validation, throwing an error if not found
|
|
55
|
+
*
|
|
56
|
+
* @param enumObject - The enum object to search in
|
|
57
|
+
* @param input - The input value to normalize and find
|
|
58
|
+
* @param enumName - Optional enum name for better error messages
|
|
59
|
+
* @returns The matching enum value
|
|
60
|
+
* @throws Error if the enum value is not found
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* import { OrderSide } from '../model/enums/OrderSide';
|
|
64
|
+
*
|
|
65
|
+
* requireEnumValue(OrderSide, 'buy') // OrderSide.Buy
|
|
66
|
+
* requireEnumValue(OrderSide, 'invalid') // throws Error
|
|
67
|
+
*/
|
|
68
|
+
export declare function requireEnumValue<T extends Record<string, string>>(enumObject: T, input: string, enumName?: string): T[keyof T];
|
|
69
|
+
/**
|
|
70
|
+
* Checks if a string is a valid enum value (case-insensitive)
|
|
71
|
+
*
|
|
72
|
+
* @param enumObject - The enum object to check against
|
|
73
|
+
* @param input - The input value to validate
|
|
74
|
+
* @returns True if the input is a valid enum value
|
|
75
|
+
*
|
|
76
|
+
* @example
|
|
77
|
+
* import { OrderSide } from '../model/enums/OrderSide';
|
|
78
|
+
*
|
|
79
|
+
* isValidEnumValue(OrderSide, 'buy') // true
|
|
80
|
+
* isValidEnumValue(OrderSide, 'BUY') // true
|
|
81
|
+
* isValidEnumValue(OrderSide, 'invalid') // false
|
|
82
|
+
*/
|
|
83
|
+
export declare function isValidEnumValue<T extends Record<string, string>>(enumObject: T, input: string): boolean;
|
|
84
|
+
/**
|
|
85
|
+
* Gets all possible enum values as an array
|
|
86
|
+
*
|
|
87
|
+
* @param enumObject - The enum object
|
|
88
|
+
* @returns Array of all enum values
|
|
89
|
+
*
|
|
90
|
+
* @example
|
|
91
|
+
* import { OrderSide } from '../model/enums/OrderSide';
|
|
92
|
+
*
|
|
93
|
+
* getEnumValues(OrderSide) // ['BUY', 'SELL']
|
|
94
|
+
*/
|
|
95
|
+
export declare function getEnumValues<T extends Record<string, string>>(enumObject: T): T[keyof T][];
|
|
96
|
+
/**
|
|
97
|
+
* Gets all possible enum keys as an array
|
|
98
|
+
*
|
|
99
|
+
* @param enumObject - The enum object
|
|
100
|
+
* @returns Array of all enum keys
|
|
101
|
+
*
|
|
102
|
+
* @example
|
|
103
|
+
* import { OrderSide } from '../model/enums/OrderSide';
|
|
104
|
+
*
|
|
105
|
+
* getEnumKeys(OrderSide) // ['Buy', 'Sell']
|
|
106
|
+
*/
|
|
107
|
+
export declare function getEnumKeys<T extends Record<string, string>>(enumObject: T): (keyof T)[];
|
|
108
|
+
/**
|
|
109
|
+
* Validates that a string has the correct prefix for enum values
|
|
110
|
+
* Useful for ensuring enum values follow expected patterns
|
|
111
|
+
*
|
|
112
|
+
* @param input - The enum value to check
|
|
113
|
+
* @param expectedPrefix - The expected prefix (e.g., 'ORDER_TYPE_', 'ACTIVITY_TYPE_')
|
|
114
|
+
* @param strict - If true, requires exact prefix match. If false, allows values without prefix
|
|
115
|
+
* @returns True if the prefix is correct
|
|
116
|
+
*
|
|
117
|
+
* @example
|
|
118
|
+
* validateEnumPrefix('ORDER_TYPE_MARKET', 'ORDER_TYPE_') // true
|
|
119
|
+
* validateEnumPrefix('MARKET', 'ORDER_TYPE_', false) // true (non-strict)
|
|
120
|
+
* validateEnumPrefix('MARKET', 'ORDER_TYPE_', true) // false (strict)
|
|
121
|
+
*/
|
|
122
|
+
export declare function validateEnumPrefix(input: string, expectedPrefix: string, strict?: boolean): boolean;
|
|
123
|
+
/**
|
|
124
|
+
* Transforms enum input to the correct format, optionally adding a prefix
|
|
125
|
+
*
|
|
126
|
+
* @param input - The input string
|
|
127
|
+
* @param prefix - Optional prefix to add if not present
|
|
128
|
+
* @returns The transformed enum value
|
|
129
|
+
*
|
|
130
|
+
* @example
|
|
131
|
+
* transformEnumValue('market', 'ORDER_TYPE_') // 'ORDER_TYPE_MARKET'
|
|
132
|
+
* transformEnumValue('ORDER_TYPE_MARKET', 'ORDER_TYPE_') // 'ORDER_TYPE_MARKET'
|
|
133
|
+
* transformEnumValue('marketOrder') // 'MARKET_ORDER'
|
|
134
|
+
*/
|
|
135
|
+
export declare function transformEnumValue(input: string, prefix?: string): string;
|