@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,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright 2025-present Coinbase Global, Inc.
|
|
4
|
+
*
|
|
5
|
+
* This file is generated by Openapi Generator https://github.com/openapitools/openapi-generator
|
|
6
|
+
*
|
|
7
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
* you may not use this file except in compliance with the License.
|
|
9
|
+
* You may obtain a copy of the License at
|
|
10
|
+
*
|
|
11
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
*
|
|
13
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
* See the License for the specific language governing permissions and
|
|
17
|
+
* limitations under the License.
|
|
18
|
+
*
|
|
19
|
+
* Do not edit the class manually.
|
|
20
|
+
*/
|
|
21
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
+
exports.XMCallStatus = void 0;
|
|
23
|
+
/**
|
|
24
|
+
* - CALL_STATUS_OPEN: Margin call is open and not expired - CALL_STATUS_AGED: Margin call is open and it is expired - CALL_STATUS_SETTLED: Margin call is fully settled - CALL_STATUS_CANCELED: Margin call was canceled by Credit Risk
|
|
25
|
+
*/
|
|
26
|
+
var XMCallStatus;
|
|
27
|
+
(function (XMCallStatus) {
|
|
28
|
+
XMCallStatus["XmCallStatusUnspecified"] = "XM_CALL_STATUS_UNSPECIFIED";
|
|
29
|
+
XMCallStatus["CallStatusOpen"] = "CALL_STATUS_OPEN";
|
|
30
|
+
XMCallStatus["CallStatusAged"] = "CALL_STATUS_AGED";
|
|
31
|
+
XMCallStatus["CallStatusSettled"] = "CALL_STATUS_SETTLED";
|
|
32
|
+
XMCallStatus["CallStatusCanceled"] = "CALL_STATUS_CANCELED";
|
|
33
|
+
})(XMCallStatus || (exports.XMCallStatus = XMCallStatus = {}));
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright 2025-present Coinbase Global, Inc.
|
|
4
|
+
*
|
|
5
|
+
* This file is generated by Openapi Generator https://github.com/openapitools/openapi-generator
|
|
6
|
+
*
|
|
7
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
* you may not use this file except in compliance with the License.
|
|
9
|
+
* You may obtain a copy of the License at
|
|
10
|
+
*
|
|
11
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
*
|
|
13
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
* See the License for the specific language governing permissions and
|
|
17
|
+
* limitations under the License.
|
|
18
|
+
*
|
|
19
|
+
* Do not edit the class manually.
|
|
20
|
+
*/
|
|
21
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
+
exports.XMCallType = void 0;
|
|
23
|
+
/**
|
|
24
|
+
* - CALL_TYPE_STANDARD: Evaluated at standard margin call evaluation time - CALL_TYPE_URGENT: Evaluated in realtime
|
|
25
|
+
*/
|
|
26
|
+
var XMCallType;
|
|
27
|
+
(function (XMCallType) {
|
|
28
|
+
XMCallType["XmCallTypeUnspecified"] = "XM_CALL_TYPE_UNSPECIFIED";
|
|
29
|
+
XMCallType["CallTypeStandard"] = "CALL_TYPE_STANDARD";
|
|
30
|
+
XMCallType["CallTypeUrgent"] = "CALL_TYPE_URGENT";
|
|
31
|
+
})(XMCallType || (exports.XMCallType = XMCallType = {}));
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright 2025-present Coinbase Global, Inc.
|
|
4
|
+
*
|
|
5
|
+
* This file is generated by Openapi Generator https://github.com/openapitools/openapi-generator
|
|
6
|
+
*
|
|
7
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
* you may not use this file except in compliance with the License.
|
|
9
|
+
* You may obtain a copy of the License at
|
|
10
|
+
*
|
|
11
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
*
|
|
13
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
* See the License for the specific language governing permissions and
|
|
17
|
+
* limitations under the License.
|
|
18
|
+
*
|
|
19
|
+
* Do not edit the class manually.
|
|
20
|
+
*/
|
|
21
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
+
exports.XMControlStatus = void 0;
|
|
23
|
+
/**
|
|
24
|
+
* - 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.
|
|
25
|
+
*/
|
|
26
|
+
var XMControlStatus;
|
|
27
|
+
(function (XMControlStatus) {
|
|
28
|
+
XMControlStatus["XmControlStatusUnspecified"] = "XM_CONTROL_STATUS_UNSPECIFIED";
|
|
29
|
+
XMControlStatus["TradesAndWithdrawals"] = "TRADES_AND_WITHDRAWALS";
|
|
30
|
+
XMControlStatus["TradesOnly"] = "TRADES_ONLY";
|
|
31
|
+
XMControlStatus["SessionLocked"] = "SESSION_LOCKED";
|
|
32
|
+
})(XMControlStatus || (exports.XMControlStatus = XMControlStatus = {}));
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright 2025-present Coinbase Global, Inc.
|
|
4
|
+
*
|
|
5
|
+
* This file is generated by Openapi Generator https://github.com/openapitools/openapi-generator
|
|
6
|
+
*
|
|
7
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
* you may not use this file except in compliance with the License.
|
|
9
|
+
* You may obtain a copy of the License at
|
|
10
|
+
*
|
|
11
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
*
|
|
13
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
* See the License for the specific language governing permissions and
|
|
17
|
+
* limitations under the License.
|
|
18
|
+
*
|
|
19
|
+
* Do not edit the class manually.
|
|
20
|
+
*/
|
|
21
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
+
exports.XMEntityCallStatus = void 0;
|
|
23
|
+
/**
|
|
24
|
+
* - 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.
|
|
25
|
+
*/
|
|
26
|
+
var XMEntityCallStatus;
|
|
27
|
+
(function (XMEntityCallStatus) {
|
|
28
|
+
XMEntityCallStatus["XmEntityCallStatusUnspecified"] = "XM_ENTITY_CALL_STATUS_UNSPECIFIED";
|
|
29
|
+
XMEntityCallStatus["EntityNoCall"] = "ENTITY_NO_CALL";
|
|
30
|
+
XMEntityCallStatus["EntityOpenStandardCall"] = "ENTITY_OPEN_STANDARD_CALL";
|
|
31
|
+
XMEntityCallStatus["EntityOpenUrgentCall"] = "ENTITY_OPEN_URGENT_CALL";
|
|
32
|
+
XMEntityCallStatus["EntityAgedCall"] = "ENTITY_AGED_CALL";
|
|
33
|
+
})(XMEntityCallStatus || (exports.XMEntityCallStatus = XMEntityCallStatus = {}));
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright 2025-present Coinbase Global, Inc.
|
|
4
|
+
*
|
|
5
|
+
* This file is generated by Openapi Generator https://github.com/openapitools/openapi-generator
|
|
6
|
+
*
|
|
7
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
* you may not use this file except in compliance with the License.
|
|
9
|
+
* You may obtain a copy of the License at
|
|
10
|
+
*
|
|
11
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
*
|
|
13
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
* See the License for the specific language governing permissions and
|
|
17
|
+
* limitations under the License.
|
|
18
|
+
*
|
|
19
|
+
* Do not edit the class manually.
|
|
20
|
+
*/
|
|
21
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
+
exports.XMMarginLevel = void 0;
|
|
23
|
+
/**
|
|
24
|
+
* - 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.
|
|
25
|
+
*/
|
|
26
|
+
var XMMarginLevel;
|
|
27
|
+
(function (XMMarginLevel) {
|
|
28
|
+
XMMarginLevel["XmMarginLevelUnspecified"] = "XM_MARGIN_LEVEL_UNSPECIFIED";
|
|
29
|
+
XMMarginLevel["HealthyThreshold"] = "HEALTHY_THRESHOLD";
|
|
30
|
+
XMMarginLevel["DeficitThreshold"] = "DEFICIT_THRESHOLD";
|
|
31
|
+
XMMarginLevel["WarningThreshold"] = "WARNING_THRESHOLD";
|
|
32
|
+
XMMarginLevel["UrgentMarginCallThreshold"] = "URGENT_MARGIN_CALL_THRESHOLD";
|
|
33
|
+
XMMarginLevel["LiquidationThreshold"] = "LIQUIDATION_THRESHOLD";
|
|
34
|
+
})(XMMarginLevel || (exports.XMMarginLevel = XMMarginLevel = {}));
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright 2025-present Coinbase Global, Inc.
|
|
4
|
+
*
|
|
5
|
+
* This file is generated by Openapi Generator https://github.com/openapitools/openapi-generator
|
|
6
|
+
*
|
|
7
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
* you may not use this file except in compliance with the License.
|
|
9
|
+
* You may obtain a copy of the License at
|
|
10
|
+
*
|
|
11
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
*
|
|
13
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
* See the License for the specific language governing permissions and
|
|
17
|
+
* limitations under the License.
|
|
18
|
+
*
|
|
19
|
+
* Do not edit the class manually.
|
|
20
|
+
*/
|
|
21
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
+
exports.XMParty = void 0;
|
|
23
|
+
/**
|
|
24
|
+
* - 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
|
|
25
|
+
*/
|
|
26
|
+
var XMParty;
|
|
27
|
+
(function (XMParty) {
|
|
28
|
+
XMParty["XmPartyUnspecified"] = "XM_PARTY_UNSPECIFIED";
|
|
29
|
+
XMParty["Cbe"] = "CBE";
|
|
30
|
+
XMParty["Fcm"] = "FCM";
|
|
31
|
+
})(XMParty || (exports.XMParty = XMParty = {}));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.WalletVisibility = exports.WalletType = exports.WalletDepositInstructionType = exports.VisibilityStatus = exports.UserRole = exports.TransferLocationType = exports.TransactionType = exports.TransactionStatus = exports.TimeInForceType = exports.SortDirection = exports.SigningStatus = exports.RateType = exports.ProductPermissions = exports.PositionReferenceType = exports.PortfolioBalanceType = exports.PaymentMethodType = exports.OrderType = exports.OrderStatus = exports.OrderSide = exports.NetworkType = exports.NetworkFamily = exports.MarginAddOnType = exports.LoanType = exports.InvoiceType = exports.InvoiceState = exports.HierarchyType = exports.FcmPositionSide = exports.FcmMarginCallType = exports.FcmMarginCallState = exports.FcmFuturesSweepStatus = exports.DestinationType = exports.Benchmark = exports.AssetChangeType = exports.AllocationStatus = exports.AllocationSizeType = exports.PrimeActivityType = exports.ActivityStatus = exports.ActivitySecondaryType = exports.ActivityLevel = exports.ActivityCategory = exports.Action = exports.AddressBookType = exports.CustodyActivityType = void 0;
|
|
3
|
+
exports.XMParty = exports.XMMarginLevel = exports.XMEntityCallStatus = exports.XMControlStatus = exports.XMCallType = exports.XMCallStatus = exports.WalletVisibility = exports.WalletType = exports.WalletDepositInstructionType = exports.VisibilityStatus = exports.ValidatorStatus = exports.UserRole = exports.TransferLocationType = exports.TransactionType = exports.TransactionStatus = exports.TimeInForceType = exports.SortDirection = exports.SigningStatus = exports.RateType = exports.ProductPermissions = exports.PositionReferenceType = exports.PortfolioBalanceType = exports.PaymentMethodType = exports.OrderType = exports.OrderStatus = exports.OrderSide = exports.NetworkType = exports.NetworkFamily = exports.MarginAddOnType = exports.LoanType = exports.InvoiceType = exports.InvoiceState = exports.HierarchyType = exports.FcmPositionSide = exports.FcmMarginCallType = exports.FcmMarginCallState = exports.FcmFuturesSweepStatus = exports.DestinationType = exports.Benchmark = exports.AssetChangeType = exports.AllocationStatus = exports.AllocationSizeType = exports.PrimeActivityType = exports.ActivityStatus = exports.ActivitySecondaryType = exports.ActivityLevel = exports.ActivityCategory = exports.Action = exports.AddressBookType = exports.CustodyActivityType = void 0;
|
|
4
4
|
var CustodyActivityType_1 = require("./CustodyActivityType");
|
|
5
5
|
Object.defineProperty(exports, "CustodyActivityType", { enumerable: true, get: function () { return CustodyActivityType_1.ActivityType; } });
|
|
6
6
|
var AddressBookType_1 = require("./AddressBookType");
|
|
@@ -79,6 +79,8 @@ var TransferLocationType_1 = require("./TransferLocationType");
|
|
|
79
79
|
Object.defineProperty(exports, "TransferLocationType", { enumerable: true, get: function () { return TransferLocationType_1.TransferLocationType; } });
|
|
80
80
|
var UserRole_1 = require("./UserRole");
|
|
81
81
|
Object.defineProperty(exports, "UserRole", { enumerable: true, get: function () { return UserRole_1.UserRole; } });
|
|
82
|
+
var ValidatorStatus_1 = require("./ValidatorStatus");
|
|
83
|
+
Object.defineProperty(exports, "ValidatorStatus", { enumerable: true, get: function () { return ValidatorStatus_1.ValidatorStatus; } });
|
|
82
84
|
var VisibilityStatus_1 = require("./VisibilityStatus");
|
|
83
85
|
Object.defineProperty(exports, "VisibilityStatus", { enumerable: true, get: function () { return VisibilityStatus_1.VisibilityStatus; } });
|
|
84
86
|
var WalletDepositInstructionType_1 = require("./WalletDepositInstructionType");
|
|
@@ -87,3 +89,15 @@ var WalletType_1 = require("./WalletType");
|
|
|
87
89
|
Object.defineProperty(exports, "WalletType", { enumerable: true, get: function () { return WalletType_1.WalletType; } });
|
|
88
90
|
var WalletVisibility_1 = require("./WalletVisibility");
|
|
89
91
|
Object.defineProperty(exports, "WalletVisibility", { enumerable: true, get: function () { return WalletVisibility_1.WalletVisibility; } });
|
|
92
|
+
var XMCallStatus_1 = require("./XMCallStatus");
|
|
93
|
+
Object.defineProperty(exports, "XMCallStatus", { enumerable: true, get: function () { return XMCallStatus_1.XMCallStatus; } });
|
|
94
|
+
var XMCallType_1 = require("./XMCallType");
|
|
95
|
+
Object.defineProperty(exports, "XMCallType", { enumerable: true, get: function () { return XMCallType_1.XMCallType; } });
|
|
96
|
+
var XMControlStatus_1 = require("./XMControlStatus");
|
|
97
|
+
Object.defineProperty(exports, "XMControlStatus", { enumerable: true, get: function () { return XMControlStatus_1.XMControlStatus; } });
|
|
98
|
+
var XMEntityCallStatus_1 = require("./XMEntityCallStatus");
|
|
99
|
+
Object.defineProperty(exports, "XMEntityCallStatus", { enumerable: true, get: function () { return XMEntityCallStatus_1.XMEntityCallStatus; } });
|
|
100
|
+
var XMMarginLevel_1 = require("./XMMarginLevel");
|
|
101
|
+
Object.defineProperty(exports, "XMMarginLevel", { enumerable: true, get: function () { return XMMarginLevel_1.XMMarginLevel; } });
|
|
102
|
+
var XMParty_1 = require("./XMParty");
|
|
103
|
+
Object.defineProperty(exports, "XMParty", { enumerable: true, get: function () { return XMParty_1.XMParty; } });
|
package/dist/orders/index.js
CHANGED
|
@@ -172,5 +172,17 @@ class OrdersService {
|
|
|
172
172
|
return response.data;
|
|
173
173
|
});
|
|
174
174
|
}
|
|
175
|
+
editOrder(request, options) {
|
|
176
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
177
|
+
const { portfolioId, orderId } = request, bodyParams = __rest(request, ["portfolioId", "orderId"]);
|
|
178
|
+
const response = yield this.client.request({
|
|
179
|
+
url: `portfolios/${portfolioId}/orders/${orderId}/edit`,
|
|
180
|
+
method: clients_1.Method.PUT,
|
|
181
|
+
bodyParams,
|
|
182
|
+
callOptions: options,
|
|
183
|
+
});
|
|
184
|
+
return response.data;
|
|
185
|
+
});
|
|
186
|
+
}
|
|
175
187
|
}
|
|
176
188
|
exports.OrdersService = OrdersService;
|
|
@@ -14,6 +14,7 @@ class PaymentMethodsService {
|
|
|
14
14
|
constructor(client) {
|
|
15
15
|
this.client = client;
|
|
16
16
|
}
|
|
17
|
+
// TODO: rename me to remove Entity in a minor version change
|
|
17
18
|
listEntityPaymentMethods(request, options) {
|
|
18
19
|
return __awaiter(this, void 0, void 0, function* () {
|
|
19
20
|
const response = yield this.client.request({
|
|
@@ -26,7 +27,7 @@ class PaymentMethodsService {
|
|
|
26
27
|
getPaymentMethod(request, options) {
|
|
27
28
|
return __awaiter(this, void 0, void 0, function* () {
|
|
28
29
|
const response = yield this.client.request({
|
|
29
|
-
url: `entities/${request.entityId}/payment-methods`,
|
|
30
|
+
url: `entities/${request.entityId}/payment-methods/${request.paymentMethodId}`,
|
|
30
31
|
callOptions: options,
|
|
31
32
|
});
|
|
32
33
|
return response.data;
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright 2025-present Coinbase Global, Inc.
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.enumRegistry = exports.DynamicEnumValidationError = void 0;
|
|
19
|
+
exports.setDynamicValidationConfig = setDynamicValidationConfig;
|
|
20
|
+
exports.getDynamicValidationConfig = getDynamicValidationConfig;
|
|
21
|
+
exports.dynamicValidateRequest = dynamicValidateRequest;
|
|
22
|
+
exports.getEnumInfo = getEnumInfo;
|
|
23
|
+
/**
|
|
24
|
+
* Dynamic enum validation system that automatically discovers and validates
|
|
25
|
+
* enum fields in request objects without manual service-specific configuration.
|
|
26
|
+
*
|
|
27
|
+
* This approach is more scalable and maintainable than manual validation rules.
|
|
28
|
+
*/
|
|
29
|
+
const enumRegistry_1 = require("./enumRegistry");
|
|
30
|
+
Object.defineProperty(exports, "enumRegistry", { enumerable: true, get: function () { return enumRegistry_1.enumRegistry; } });
|
|
31
|
+
const enumValidationCore_1 = require("./enumValidationCore");
|
|
32
|
+
Object.defineProperty(exports, "DynamicEnumValidationError", { enumerable: true, get: function () { return enumValidationCore_1.DynamicEnumValidationError; } });
|
|
33
|
+
// Default configuration
|
|
34
|
+
const defaultConfig = {
|
|
35
|
+
enabled: true,
|
|
36
|
+
strict: true,
|
|
37
|
+
autoNormalize: true,
|
|
38
|
+
logWarnings: true,
|
|
39
|
+
};
|
|
40
|
+
let currentConfig = Object.assign({}, defaultConfig);
|
|
41
|
+
// Cache for request type analysis to improve performance
|
|
42
|
+
const requestTypeCache = new Map();
|
|
43
|
+
/**
|
|
44
|
+
* Set global configuration for dynamic enum validation
|
|
45
|
+
*/
|
|
46
|
+
function setDynamicValidationConfig(config) {
|
|
47
|
+
currentConfig = Object.assign(Object.assign({}, currentConfig), config);
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Get current dynamic validation configuration
|
|
51
|
+
*/
|
|
52
|
+
function getDynamicValidationConfig() {
|
|
53
|
+
return Object.assign({}, currentConfig);
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Analyze request structure to identify enum fields
|
|
57
|
+
*/
|
|
58
|
+
function analyzeRequestType(request, serviceName) {
|
|
59
|
+
// Use object structure and service name as cache key
|
|
60
|
+
const cacheKey = JSON.stringify({
|
|
61
|
+
structure: Object.keys(request || {})
|
|
62
|
+
.sort()
|
|
63
|
+
.reduce((acc, key) => {
|
|
64
|
+
acc[key] = typeof request[key];
|
|
65
|
+
return acc;
|
|
66
|
+
}, {}),
|
|
67
|
+
serviceName: serviceName || 'unknown',
|
|
68
|
+
});
|
|
69
|
+
// Return cached result if available
|
|
70
|
+
const cached = requestTypeCache.get(cacheKey);
|
|
71
|
+
if (cached) {
|
|
72
|
+
return cached;
|
|
73
|
+
}
|
|
74
|
+
const enumFields = [];
|
|
75
|
+
if (!request || typeof request !== 'object') {
|
|
76
|
+
return enumFields;
|
|
77
|
+
}
|
|
78
|
+
Object.entries(request).forEach(([fieldName, value]) => {
|
|
79
|
+
const fieldInfo = (0, enumValidationCore_1.analyzeField)(fieldName, value, serviceName);
|
|
80
|
+
if (fieldInfo) {
|
|
81
|
+
enumFields.push(fieldInfo);
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
// Cache the result
|
|
85
|
+
requestTypeCache.set(cacheKey, enumFields);
|
|
86
|
+
return enumFields;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Validate request object and normalize enum values
|
|
90
|
+
*/
|
|
91
|
+
function validateRequestEnums(request, config = currentConfig) {
|
|
92
|
+
const validatedRequest = Object.assign({}, request);
|
|
93
|
+
const errors = [];
|
|
94
|
+
if (!config.enabled) {
|
|
95
|
+
return { validatedRequest, errors };
|
|
96
|
+
}
|
|
97
|
+
const enumFields = analyzeRequestType(request, config.serviceName);
|
|
98
|
+
enumFields.forEach((fieldInfo) => {
|
|
99
|
+
const { fieldName, enumName, isArray } = fieldInfo;
|
|
100
|
+
const fieldValue = request[fieldName];
|
|
101
|
+
if (fieldValue === undefined || fieldValue === null) {
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
try {
|
|
105
|
+
const enumObject = enumRegistry_1.enumRegistry.getEnum(enumName);
|
|
106
|
+
if (!enumObject) {
|
|
107
|
+
errors.push(`${fieldName}: Enum ${enumName} not found`);
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
if (isArray && Array.isArray(fieldValue)) {
|
|
111
|
+
// Handle array values
|
|
112
|
+
const validatedArray = [];
|
|
113
|
+
for (const item of fieldValue) {
|
|
114
|
+
if (typeof item === 'string') {
|
|
115
|
+
const validation = (0, enumValidationCore_1.validateEnumValue)(item, enumObject, enumName, fieldName, config);
|
|
116
|
+
if (validation.isValid && validation.normalizedValue) {
|
|
117
|
+
validatedArray.push(validation.normalizedValue);
|
|
118
|
+
}
|
|
119
|
+
else if (validation.error) {
|
|
120
|
+
if (config.strict) {
|
|
121
|
+
throw new enumValidationCore_1.DynamicEnumValidationError(fieldName, item, enumName, Object.values(enumObject), Object.keys(enumObject));
|
|
122
|
+
}
|
|
123
|
+
else {
|
|
124
|
+
if (config.logWarnings) {
|
|
125
|
+
console.warn(`[Prime SDK] Dynamic enum validation warning: ${validation.error}`);
|
|
126
|
+
}
|
|
127
|
+
validatedArray.push(item); // Keep original value
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
validatedRequest[fieldName] = validatedArray;
|
|
133
|
+
}
|
|
134
|
+
else if (typeof fieldValue === 'string') {
|
|
135
|
+
// Handle single string values
|
|
136
|
+
const validation = (0, enumValidationCore_1.validateEnumValue)(fieldValue, enumObject, enumName, fieldName, config);
|
|
137
|
+
if (validation.isValid && validation.normalizedValue) {
|
|
138
|
+
validatedRequest[fieldName] = validation.normalizedValue;
|
|
139
|
+
}
|
|
140
|
+
else if (validation.error) {
|
|
141
|
+
if (config.strict) {
|
|
142
|
+
throw new enumValidationCore_1.DynamicEnumValidationError(fieldName, fieldValue, enumName, Object.values(enumObject), Object.keys(enumObject));
|
|
143
|
+
}
|
|
144
|
+
else {
|
|
145
|
+
if (config.logWarnings) {
|
|
146
|
+
console.warn(`[Prime SDK] Dynamic enum validation warning: ${validation.error}`);
|
|
147
|
+
}
|
|
148
|
+
// Keep original value in non-strict mode
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
catch (error) {
|
|
154
|
+
if (error instanceof enumValidationCore_1.DynamicEnumValidationError) {
|
|
155
|
+
throw error; // Re-throw enum validation errors
|
|
156
|
+
}
|
|
157
|
+
errors.push(`${fieldName}: Unexpected validation error: ${error}`);
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
return { validatedRequest, errors };
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Main API: Validate and normalize request with type-safe generics
|
|
164
|
+
*/
|
|
165
|
+
function dynamicValidateRequest(request, config) {
|
|
166
|
+
const validationConfig = config
|
|
167
|
+
? Object.assign(Object.assign({}, currentConfig), config) : currentConfig;
|
|
168
|
+
const result = validateRequestEnums(request, validationConfig);
|
|
169
|
+
if (result.errors.length > 0) {
|
|
170
|
+
throw new enumValidationCore_1.DynamicEnumValidationError('request', 'multiple fields', 'various', [], result.errors);
|
|
171
|
+
}
|
|
172
|
+
return result.validatedRequest;
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Get information about discovered enums
|
|
176
|
+
*/
|
|
177
|
+
function getEnumInfo() {
|
|
178
|
+
const stats = enumRegistry_1.enumRegistry.getStats();
|
|
179
|
+
return {
|
|
180
|
+
totalEnums: stats.totalEnums,
|
|
181
|
+
enumNames: enumRegistry_1.enumRegistry.getAllEnumNames(),
|
|
182
|
+
enumDetails: enumRegistry_1.enumRegistry.getEnumDetails(),
|
|
183
|
+
};
|
|
184
|
+
}
|