@pear-protocol/types 2.21.0 → 2.22.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/bundle.d.ts +1 -0
- package/dist/fee/entities.d.ts +1 -0
- package/dist/fee/responses.d.ts +26 -0
- package/dist/index.js +7355 -3
- package/dist/rewards/entities.d.ts +28 -0
- package/dist/rewards/payloads.d.ts +7 -0
- package/dist/rewards/responses.d.ts +73 -0
- package/dist/users/entities.d.ts +4 -0
- package/dist/users/response.d.ts +2 -0
- package/package.json +3 -2
- package/dist/auth/api-keys.js +0 -44
- package/dist/auth/entities.js +0 -25
- package/dist/auth/index.js +0 -4
- package/dist/auth/payloads.js +0 -84
- package/dist/auth/response.js +0 -82
- package/dist/baskets/recommended/entities.js +0 -22
- package/dist/baskets/recommended/index.js +0 -2
- package/dist/baskets/recommended/responses.js +0 -8
- package/dist/baskets/saved/entities.js +0 -23
- package/dist/baskets/saved/payloads.js +0 -18
- package/dist/baskets/saved/responses.js +0 -14
- package/dist/bundle.js +0 -36
- package/dist/common/address.js +0 -5
- package/dist/common/array.js +0 -17
- package/dist/common/client-id.js +0 -5
- package/dist/common/hex-string.js +0 -5
- package/dist/common/index.js +0 -4
- package/dist/common/refinement.js +0 -64
- package/dist/common/request.js +0 -24
- package/dist/common/response.js +0 -28
- package/dist/common/schema.js +0 -18
- package/dist/common/trade-legs.js +0 -50
- package/dist/connector/index.js +0 -12
- package/dist/copy/entities.js +0 -151
- package/dist/copy/index.js +0 -5
- package/dist/copy/payloads.js +0 -8
- package/dist/copy/performance.js +0 -63
- package/dist/copy/queries.js +0 -20
- package/dist/copy/responses.js +0 -89
- package/dist/execution/entities.js +0 -196
- package/dist/execution/index.js +0 -3
- package/dist/execution/queries.js +0 -18
- package/dist/execution/responses.js +0 -12
- package/dist/fee/entities.js +0 -34
- package/dist/fee/index.js +0 -3
- package/dist/fee/queries.js +0 -12
- package/dist/fee/responses.js +0 -29
- package/dist/fill/entities.js +0 -82
- package/dist/fill/index.js +0 -3
- package/dist/fill/queries.js +0 -14
- package/dist/fill/responses.js +0 -23
- package/dist/funding/entities.js +0 -16
- package/dist/funding/index.js +0 -3
- package/dist/funding/queries.js +0 -8
- package/dist/funding/responses.js +0 -11
- package/dist/instrument/entities.js +0 -102
- package/dist/instrument/index.js +0 -3
- package/dist/instrument/queries.js +0 -15
- package/dist/instrument/responses.js +0 -20
- package/dist/instrument-precision/index.js +0 -56
- package/dist/ladder/entities.js +0 -24
- package/dist/ladder/index.js +0 -4
- package/dist/ladder/payloads.js +0 -96
- package/dist/ladder/queries.js +0 -12
- package/dist/ladder/responses.js +0 -18
- package/dist/leverage/index.js +0 -2
- package/dist/leverage/payloads.js +0 -14
- package/dist/leverage/response.js +0 -5
- package/dist/margin/index.js +0 -2
- package/dist/margin/payloads.js +0 -20
- package/dist/margin/response.js +0 -11
- package/dist/market/entities.js +0 -52
- package/dist/market/index.js +0 -4
- package/dist/market/payloads.js +0 -11
- package/dist/market/queries.js +0 -19
- package/dist/market/responses.js +0 -18
- package/dist/misc/index.js +0 -2
- package/dist/misc/payloads.js +0 -99
- package/dist/misc/responses.js +0 -85
- package/dist/notification/entities.js +0 -274
- package/dist/notification/index.js +0 -4
- package/dist/notification/payloads.js +0 -15
- package/dist/notification/queries.js +0 -29
- package/dist/notification/responses.js +0 -20
- package/dist/order/entities.js +0 -81
- package/dist/order/index.js +0 -1
- package/dist/portfolio/entities.js +0 -77
- package/dist/portfolio/index.js +0 -3
- package/dist/portfolio/queries.js +0 -34
- package/dist/portfolio/responses.js +0 -33
- package/dist/position/entities.js +0 -433
- package/dist/position/index.js +0 -3
- package/dist/position/queries.js +0 -109
- package/dist/position/responses.js +0 -41
- package/dist/price/entities.js +0 -10
- package/dist/price/index.js +0 -3
- package/dist/price/queries.js +0 -8
- package/dist/price/responses.js +0 -15
- package/dist/realtime/channels.js +0 -16
- package/dist/realtime/frames.js +0 -140
- package/dist/realtime/index.js +0 -6
- package/dist/realtime/messages.js +0 -118
- package/dist/realtime/public-events.js +0 -92
- package/dist/realtime/user-events.js +0 -32
- package/dist/realtime/vault-events.js +0 -42
- package/dist/rebalance/entities.js +0 -86
- package/dist/rebalance/index.js +0 -4
- package/dist/rebalance/payloads.js +0 -56
- package/dist/rebalance/queries.js +0 -14
- package/dist/rebalance/responses.js +0 -41
- package/dist/schedule/entities.js +0 -239
- package/dist/schedule/index.js +0 -5
- package/dist/schedule/payloads.js +0 -85
- package/dist/schedule/queries.js +0 -30
- package/dist/schedule/randomization.js +0 -15
- package/dist/schedule/responses.js +0 -22
- package/dist/schedule/twap-config.js +0 -29
- package/dist/statistics/entities.js +0 -105
- package/dist/statistics/index.js +0 -3
- package/dist/statistics/queries.js +0 -111
- package/dist/statistics/responses.js +0 -67
- package/dist/sync/index.js +0 -2
- package/dist/sync/payloads.js +0 -136
- package/dist/sync/responses.js +0 -28
- package/dist/tca/entities.js +0 -9
- package/dist/tca/index.js +0 -3
- package/dist/tca/queries.js +0 -14
- package/dist/tca/responses.js +0 -126
- package/dist/trade/entities.js +0 -101
- package/dist/trade/index.js +0 -4
- package/dist/trade/payloads.js +0 -84
- package/dist/trade/queries.js +0 -9
- package/dist/trade/responses.js +0 -25
- package/dist/trade-accounts/entities.js +0 -61
- package/dist/trade-accounts/index.js +0 -4
- package/dist/trade-accounts/payloads.js +0 -132
- package/dist/trade-accounts/queries.js +0 -7
- package/dist/trade-accounts/response.js +0 -79
- package/dist/traders/index.js +0 -2
- package/dist/traders/performance.js +0 -21
- package/dist/traders/public.js +0 -192
- package/dist/trigger/common/index.js +0 -39
- package/dist/trigger/entities/conditions.js +0 -174
- package/dist/trigger/entities/index.js +0 -257
- package/dist/trigger/index.js +0 -9
- package/dist/trigger/oracle.js +0 -22
- package/dist/trigger/payloads/conditions.js +0 -213
- package/dist/trigger/payloads/config.js +0 -3
- package/dist/trigger/payloads/index.js +0 -173
- package/dist/trigger/queries.js +0 -16
- package/dist/trigger/refinement/index.js +0 -2
- package/dist/trigger/refinement/static.refinement.js +0 -50
- package/dist/trigger/refinement/trailing.refinement.js +0 -83
- package/dist/trigger/responses.js +0 -18
- package/dist/triggers/entities.js +0 -27
- package/dist/triggers/index.js +0 -3
- package/dist/triggers/queries.js +0 -10
- package/dist/triggers/responses.js +0 -9
- package/dist/users/entities.js +0 -45
- package/dist/users/index.js +0 -4
- package/dist/users/payloads.js +0 -33
- package/dist/users/queries.js +0 -8
- package/dist/users/response.js +0 -28
- package/dist/vaults/entities.js +0 -96
- package/dist/vaults/index.js +0 -4
- package/dist/vaults/payloads.js +0 -65
- package/dist/vaults/queries.js +0 -66
- package/dist/vaults/responses.js +0 -368
- /package/dist/{baskets/saved/index.js → rewards/index.d.ts} +0 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const RewardAccrual: z.ZodObject<{
|
|
3
|
+
earned: z.ZodString;
|
|
4
|
+
pendingMaturity: z.ZodString;
|
|
5
|
+
pendingFunding: z.ZodString;
|
|
6
|
+
claimable: z.ZodString;
|
|
7
|
+
paid: z.ZodString;
|
|
8
|
+
}, z.core.$strip>;
|
|
9
|
+
export type RewardAccrual = z.output<typeof RewardAccrual>;
|
|
10
|
+
export declare const RewardClaimStatus: z.ZodEnum<{
|
|
11
|
+
TRANSFER_INTENT_READY: "TRANSFER_INTENT_READY";
|
|
12
|
+
PAYOUT_PENDING: "PAYOUT_PENDING";
|
|
13
|
+
PAID: "PAID";
|
|
14
|
+
RELEASED: "RELEASED";
|
|
15
|
+
NO_CLAIMABLE_BALANCE: "NO_CLAIMABLE_BALANCE";
|
|
16
|
+
CLAIMABILITY_DISABLED: "CLAIMABILITY_DISABLED";
|
|
17
|
+
NO_CAPACITY: "NO_CAPACITY";
|
|
18
|
+
MISSING_BALANCE: "MISSING_BALANCE";
|
|
19
|
+
STALE_BALANCE: "STALE_BALANCE";
|
|
20
|
+
PAYOUT_DISABLED: "PAYOUT_DISABLED";
|
|
21
|
+
}>;
|
|
22
|
+
export type RewardClaimStatus = z.output<typeof RewardClaimStatus>;
|
|
23
|
+
export declare const RewardPayoutAvailability: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
24
|
+
status: z.ZodLiteral<"DISABLED">;
|
|
25
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
26
|
+
status: z.ZodLiteral<"AVAILABLE">;
|
|
27
|
+
}, z.core.$strip>], "status">;
|
|
28
|
+
export type RewardPayoutAvailability = z.output<typeof RewardPayoutAvailability>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const RewardClaimId: z.ZodUUID;
|
|
3
|
+
export type RewardClaimId = z.output<typeof RewardClaimId>;
|
|
4
|
+
export declare const CreateRewardClaim: z.ZodObject<{
|
|
5
|
+
destination: z.ZodString;
|
|
6
|
+
}, z.core.$strip>;
|
|
7
|
+
export type CreateRewardClaim = z.output<typeof CreateRewardClaim>;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const RewardAccrualResponse: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
3
|
+
status: z.ZodLiteral<"DISABLED">;
|
|
4
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
5
|
+
status: z.ZodLiteral<"AVAILABLE">;
|
|
6
|
+
accrual: z.ZodObject<{
|
|
7
|
+
earned: z.ZodString;
|
|
8
|
+
pendingMaturity: z.ZodString;
|
|
9
|
+
pendingFunding: z.ZodString;
|
|
10
|
+
claimable: z.ZodString;
|
|
11
|
+
paid: z.ZodString;
|
|
12
|
+
}, z.core.$strip>;
|
|
13
|
+
}, z.core.$strip>], "status">;
|
|
14
|
+
export type RewardAccrualResponse = z.output<typeof RewardAccrualResponse>;
|
|
15
|
+
export declare const RewardSummaryResponse: z.ZodObject<{
|
|
16
|
+
accrual: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
17
|
+
status: z.ZodLiteral<"DISABLED">;
|
|
18
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
19
|
+
status: z.ZodLiteral<"AVAILABLE">;
|
|
20
|
+
accrual: z.ZodObject<{
|
|
21
|
+
earned: z.ZodString;
|
|
22
|
+
pendingMaturity: z.ZodString;
|
|
23
|
+
pendingFunding: z.ZodString;
|
|
24
|
+
claimable: z.ZodString;
|
|
25
|
+
paid: z.ZodString;
|
|
26
|
+
}, z.core.$strip>;
|
|
27
|
+
}, z.core.$strip>], "status">;
|
|
28
|
+
payout: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
29
|
+
status: z.ZodLiteral<"DISABLED">;
|
|
30
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
31
|
+
status: z.ZodLiteral<"AVAILABLE">;
|
|
32
|
+
}, z.core.$strip>], "status">;
|
|
33
|
+
}, z.core.$strip>;
|
|
34
|
+
export type RewardSummaryResponse = z.output<typeof RewardSummaryResponse>;
|
|
35
|
+
export declare const RewardClaimStatusResponse: z.ZodObject<{
|
|
36
|
+
claimId: z.ZodUUID;
|
|
37
|
+
status: z.ZodEnum<{
|
|
38
|
+
TRANSFER_INTENT_READY: "TRANSFER_INTENT_READY";
|
|
39
|
+
PAYOUT_PENDING: "PAYOUT_PENDING";
|
|
40
|
+
PAID: "PAID";
|
|
41
|
+
RELEASED: "RELEASED";
|
|
42
|
+
NO_CLAIMABLE_BALANCE: "NO_CLAIMABLE_BALANCE";
|
|
43
|
+
CLAIMABILITY_DISABLED: "CLAIMABILITY_DISABLED";
|
|
44
|
+
NO_CAPACITY: "NO_CAPACITY";
|
|
45
|
+
MISSING_BALANCE: "MISSING_BALANCE";
|
|
46
|
+
STALE_BALANCE: "STALE_BALANCE";
|
|
47
|
+
PAYOUT_DISABLED: "PAYOUT_DISABLED";
|
|
48
|
+
}>;
|
|
49
|
+
payoutDestination: z.ZodString;
|
|
50
|
+
entitledAmount: z.ZodString;
|
|
51
|
+
reservedAmount: z.ZodOptional<z.ZodString>;
|
|
52
|
+
transferIntentCreatedAt: z.ZodOptional<z.ZodISODateTime>;
|
|
53
|
+
verifiedAt: z.ZodOptional<z.ZodISODateTime>;
|
|
54
|
+
createdAt: z.ZodISODateTime;
|
|
55
|
+
updatedAt: z.ZodISODateTime;
|
|
56
|
+
}, z.core.$strip>;
|
|
57
|
+
export type RewardClaimStatusResponse = z.output<typeof RewardClaimStatusResponse>;
|
|
58
|
+
export declare const RewardClaimResponse: z.ZodObject<{
|
|
59
|
+
claimId: z.ZodOptional<z.ZodUUID>;
|
|
60
|
+
status: z.ZodEnum<{
|
|
61
|
+
TRANSFER_INTENT_READY: "TRANSFER_INTENT_READY";
|
|
62
|
+
PAYOUT_PENDING: "PAYOUT_PENDING";
|
|
63
|
+
PAID: "PAID";
|
|
64
|
+
RELEASED: "RELEASED";
|
|
65
|
+
NO_CLAIMABLE_BALANCE: "NO_CLAIMABLE_BALANCE";
|
|
66
|
+
CLAIMABILITY_DISABLED: "CLAIMABILITY_DISABLED";
|
|
67
|
+
NO_CAPACITY: "NO_CAPACITY";
|
|
68
|
+
MISSING_BALANCE: "MISSING_BALANCE";
|
|
69
|
+
STALE_BALANCE: "STALE_BALANCE";
|
|
70
|
+
PAYOUT_DISABLED: "PAYOUT_DISABLED";
|
|
71
|
+
}>;
|
|
72
|
+
}, z.core.$strip>;
|
|
73
|
+
export type RewardClaimResponse = z.output<typeof RewardClaimResponse>;
|
package/dist/users/entities.d.ts
CHANGED
|
@@ -27,6 +27,8 @@ export declare const BoundReferralReferee: z.ZodObject<{
|
|
|
27
27
|
referredAt: z.ZodOptional<z.ZodNumber>;
|
|
28
28
|
tradeCount: z.ZodNumber;
|
|
29
29
|
volumeUsd: z.ZodString;
|
|
30
|
+
feesPaid: z.ZodString;
|
|
31
|
+
earned: z.ZodString;
|
|
30
32
|
}, z.core.$strip>;
|
|
31
33
|
export declare const PendingReferralReferee: z.ZodObject<{
|
|
32
34
|
status: z.ZodLiteral<"PENDING">;
|
|
@@ -38,6 +40,8 @@ export declare const ReferralReferee: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
38
40
|
referredAt: z.ZodOptional<z.ZodNumber>;
|
|
39
41
|
tradeCount: z.ZodNumber;
|
|
40
42
|
volumeUsd: z.ZodString;
|
|
43
|
+
feesPaid: z.ZodString;
|
|
44
|
+
earned: z.ZodString;
|
|
41
45
|
}, z.core.$strip>, z.ZodObject<{
|
|
42
46
|
status: z.ZodLiteral<"PENDING">;
|
|
43
47
|
address: z.ZodPipe<z.ZodString, z.ZodTransform<EthereumAddress, string>>;
|
package/dist/users/response.d.ts
CHANGED
|
@@ -49,6 +49,8 @@ export declare const ReferralRefereeListResponse: z.ZodObject<{
|
|
|
49
49
|
referredAt: z.ZodOptional<z.ZodNumber>;
|
|
50
50
|
tradeCount: z.ZodNumber;
|
|
51
51
|
volumeUsd: z.ZodString;
|
|
52
|
+
feesPaid: z.ZodString;
|
|
53
|
+
earned: z.ZodString;
|
|
52
54
|
}, z.core.$strip>, z.ZodObject<{
|
|
53
55
|
status: z.ZodLiteral<"PENDING">;
|
|
54
56
|
address: z.ZodPipe<z.ZodString, z.ZodTransform<import("..").EthereumAddress, string>>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pear-protocol/types",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.22.0",
|
|
4
4
|
"description": "Pear Protocol Types definitions",
|
|
5
5
|
"private": false,
|
|
6
6
|
"type": "module",
|
|
@@ -21,7 +21,8 @@
|
|
|
21
21
|
"sideEffects": false,
|
|
22
22
|
"scripts": {
|
|
23
23
|
"test": "vitest run --typecheck",
|
|
24
|
-
"build": "tsup && tsc -p tsconfig.build.json",
|
|
24
|
+
"build": "tsup && tsc -p tsconfig.build.json && bun run check:dist",
|
|
25
|
+
"check:dist": "node -e \"import('./dist/index.js')\"",
|
|
25
26
|
"clean": "rm -rf dist .turbo",
|
|
26
27
|
"typecheck": "bunx --package bun@1.4.3 bun --check --threads=2"
|
|
27
28
|
},
|
package/dist/auth/api-keys.js
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
|
|
3
|
-
const ApiKeyScope = z.enum([
|
|
4
|
-
"read",
|
|
5
|
-
"read_write"
|
|
6
|
-
]).describe("API key access scope");
|
|
7
|
-
const CreateApiKeyInput = z.object({
|
|
8
|
-
label: z.string().trim().min(1, "Label is required").max(100).describe("Human label for the key"),
|
|
9
|
-
scope: ApiKeyScope.default("read"),
|
|
10
|
-
/** ISO-8601 datetime; omit for a key that never expires. */
|
|
11
|
-
expiresAt: z.iso.datetime({
|
|
12
|
-
offset: true
|
|
13
|
-
}).optional().describe("Optional expiry (ISO-8601)")
|
|
14
|
-
}).describe("Create a new API key");
|
|
15
|
-
const CreateApiKeyOutput = z.object({
|
|
16
|
-
id: z.uuid(),
|
|
17
|
-
label: z.string(),
|
|
18
|
-
scope: ApiKeyScope,
|
|
19
|
-
/** Raw secret — returned only once, at creation. */
|
|
20
|
-
key: z.string()
|
|
21
|
-
}).describe("Newly created API key (raw secret shown once)");
|
|
22
|
-
const ApiKeySummary = z.object({
|
|
23
|
-
id: z.uuid(),
|
|
24
|
-
label: z.string(),
|
|
25
|
-
scope: ApiKeyScope,
|
|
26
|
-
keyPrefix: z.string(),
|
|
27
|
-
lastUsedAt: z.string().nullable(),
|
|
28
|
-
expiresAt: z.string().nullable(),
|
|
29
|
-
revokedAt: z.string().nullable(),
|
|
30
|
-
createdAt: z.string()
|
|
31
|
-
});
|
|
32
|
-
const ListApiKeysOutput = z.array(ApiKeySummary).describe("All API keys for the user");
|
|
33
|
-
const ApiKeyMeResponse = z.object({
|
|
34
|
-
id: z.uuid().describe("User UUID that owns the API key"),
|
|
35
|
-
role: z.enum([
|
|
36
|
-
"basic",
|
|
37
|
-
"pro",
|
|
38
|
-
"vault"
|
|
39
|
-
]).describe("User role"),
|
|
40
|
-
scope: ApiKeyScope,
|
|
41
|
-
authMethod: z.literal("api_key")
|
|
42
|
-
}).describe("Identity of the caller authenticated via an API key");
|
|
43
|
-
|
|
44
|
-
export { ApiKeyMeResponse, ApiKeyScope, ApiKeySummary, CreateApiKeyInput, CreateApiKeyOutput, ListApiKeysOutput };
|
package/dist/auth/entities.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
|
|
3
|
-
const LoginMethod = z.enum([
|
|
4
|
-
"email",
|
|
5
|
-
"evm_wallet",
|
|
6
|
-
"oauth",
|
|
7
|
-
"x"
|
|
8
|
-
]).describe("Authentication provider used for the current session");
|
|
9
|
-
const AuthenticatedUser = z.object({
|
|
10
|
-
id: z.uuid().describe("User UUID"),
|
|
11
|
-
role: z.enum([
|
|
12
|
-
"basic",
|
|
13
|
-
"pro",
|
|
14
|
-
"vault"
|
|
15
|
-
]).describe("User role"),
|
|
16
|
-
providerId: z.string().nullable().describe("Provider identifier (wallet address or email)"),
|
|
17
|
-
loginMethod: LoginMethod.describe("Authentication provider used for the current session")
|
|
18
|
-
}).describe("Current authenticated user info");
|
|
19
|
-
const ConnectedIdentity = z.object({
|
|
20
|
-
provider: LoginMethod.describe("Provider that owns this identity"),
|
|
21
|
-
externalId: z.string().describe("Immutable id the provider knows the account by: wallet address, email, or X numeric id"),
|
|
22
|
-
connectedAt: z.string().describe("ISO-8601 timestamp of when the identity was connected")
|
|
23
|
-
}).describe("One provider identity connected to the account");
|
|
24
|
-
|
|
25
|
-
export { AuthenticatedUser, ConnectedIdentity, LoginMethod };
|
package/dist/auth/index.js
DELETED
package/dist/auth/payloads.js
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
|
|
3
|
-
const EthereumAddress = z.string().regex(/^0x[a-fA-F0-9]{40}$/, "Invalid Ethereum address").transform((val) => val.toLowerCase()).describe("Ethereum wallet address (0x-prefixed, 40 hex chars, lowercase)");
|
|
4
|
-
const Email = z.email("Invalid email address").transform((val) => val.toLowerCase()).describe("Email address (lowercase)");
|
|
5
|
-
const Password = z.string().min(8, "Password must be at least 8 characters").max(128, "Password must be at most 128 characters").describe("Password for authentication");
|
|
6
|
-
const AccessCode = z.string().trim().max(64).optional().describe("Optional beta access code");
|
|
7
|
-
const SignedNonce = z.string().min(1).max(128).describe("Nonce of the signed challenge, as returned by the nonce endpoint");
|
|
8
|
-
const RequestNonceRequest = z.object({
|
|
9
|
-
address: EthereumAddress
|
|
10
|
-
}).describe("Request a nonce for wallet authentication");
|
|
11
|
-
const EmailRegisterRequest = z.object({
|
|
12
|
-
email: Email,
|
|
13
|
-
password: Password,
|
|
14
|
-
accessCode: AccessCode
|
|
15
|
-
}).describe("Email registration request");
|
|
16
|
-
const LinkEmailRequest = z.object({
|
|
17
|
-
email: Email
|
|
18
|
-
}).describe("Link email credentials to the authenticated account");
|
|
19
|
-
const LinkWalletRequest = z.object({
|
|
20
|
-
address: EthereumAddress,
|
|
21
|
-
signature: z.string().min(1, "Signature is required").describe("Signature of the nonce message"),
|
|
22
|
-
nonce: SignedNonce
|
|
23
|
-
}).describe("Link wallet credentials to the authenticated account");
|
|
24
|
-
const StartXLinkRequest = z.object({
|
|
25
|
-
returnTo: z.string().optional().describe("Page to send the browser back to once the link finishes, normally the page the user is on. Must be on the calling origin; defaults to that origin.")
|
|
26
|
-
}).describe("Start of the X account link flow");
|
|
27
|
-
const SetXVisibilityRequest = z.object({
|
|
28
|
-
xHidden: z.boolean().describe("True to withhold the linked X account from the leaderboard and public trader profiles, false to publish it. The wanted state rather than a flip, so a retry lands on the same result and two tabs cannot disagree. Named to match `xHidden` on the user profile - one name for one value.")
|
|
29
|
-
}).describe("Visibility of the X account on the leaderboard and public trader profiles");
|
|
30
|
-
const PkceValue = z.string().regex(/^[A-Za-z0-9_-]{43}$/, "Must be 43 base64url characters");
|
|
31
|
-
const StartXLoginRequest = z.object({
|
|
32
|
-
returnTo: z.string().optional().describe("Page to send the browser back to once the sign-in finishes, normally the page the user is on. Must be on the calling origin; defaults to that origin. Any fragment is dropped - the flow returns its ticket there."),
|
|
33
|
-
handoffId: z.string().regex(/^[A-Za-z0-9_-]{1,64}$/, "Must be 1-64 URL-safe characters").describe("Names this sign-in attempt. Echoed back on the return URL so a browser that started more than one knows which secret this outcome belongs to."),
|
|
34
|
-
handoffChallenge: PkceValue.describe("Base64url SHA-256 of a random verifier this browser keeps. The finished sign-in is redeemed by presenting that verifier, so only the browser that started the flow can collect it.")
|
|
35
|
-
}).describe("Start of the X sign-in flow");
|
|
36
|
-
const ExchangeXLoginRequest = z.object({
|
|
37
|
-
ticket: z.string().min(1, "Ticket is required").describe("Single-use ticket from the return URL fragment"),
|
|
38
|
-
handoffVerifier: PkceValue.describe("The verifier whose challenge started this sign-in")
|
|
39
|
-
}).describe("Redemption of a finished X sign-in for a session");
|
|
40
|
-
const WalletLoginRequest = z.object({
|
|
41
|
-
method: z.literal("wallet").describe('Must be "wallet" for wallet authentication'),
|
|
42
|
-
address: EthereumAddress,
|
|
43
|
-
signature: z.string().min(1, "Signature is required").describe("Signature of the nonce message"),
|
|
44
|
-
nonce: SignedNonce,
|
|
45
|
-
accessCode: AccessCode
|
|
46
|
-
}).describe("Wallet-based authentication using nonce signature");
|
|
47
|
-
const EmailLoginRequest = z.object({
|
|
48
|
-
method: z.literal("email").describe('Must be "email" for email authentication'),
|
|
49
|
-
email: Email,
|
|
50
|
-
password: Password
|
|
51
|
-
}).describe("Email-based authentication using email and password");
|
|
52
|
-
const VerifyEmailRequest = z.object({
|
|
53
|
-
token: z.string().min(1, "Token is required").describe("Verification token"),
|
|
54
|
-
password: Password.optional().describe("Password for the email claim if using link-flow")
|
|
55
|
-
}).describe("Verify email claim using the token from the verification email");
|
|
56
|
-
const ChangePasswordRequest = z.object({
|
|
57
|
-
currentPassword: Password.describe("Current password for the authenticated user"),
|
|
58
|
-
newPassword: Password.describe("New password to set")
|
|
59
|
-
}).describe("Change password for an authenticated user");
|
|
60
|
-
const ForgotPasswordRequest = z.object({
|
|
61
|
-
email: Email
|
|
62
|
-
}).describe("Request a password reset link by email");
|
|
63
|
-
const ResetPasswordRequest = z.object({
|
|
64
|
-
token: z.string().min(1, "Token is required").describe("Password reset token"),
|
|
65
|
-
password: Password.describe("New password to set")
|
|
66
|
-
}).describe("Reset password using a password reset token");
|
|
67
|
-
const LoginRequest = z.discriminatedUnion("method", [
|
|
68
|
-
WalletLoginRequest,
|
|
69
|
-
EmailLoginRequest
|
|
70
|
-
]);
|
|
71
|
-
const RefreshTokenRequest = z.object({
|
|
72
|
-
refreshToken: z.string().min(1, "Refresh token is required").describe("Refresh token")
|
|
73
|
-
}).describe("Refresh token request");
|
|
74
|
-
const ResendVerificationForRegisterRequest = z.object({
|
|
75
|
-
email: Email
|
|
76
|
-
}).describe("Resend verification email by email address (unauthenticated)");
|
|
77
|
-
const LogoutRequest = z.object({
|
|
78
|
-
refreshToken: z.string().min(1, "Refresh token is required").describe("Refresh token to revoke")
|
|
79
|
-
}).describe("Logout and revoke refresh token");
|
|
80
|
-
const OauthInteractionConfirmRequest = z.object({
|
|
81
|
-
scopes: z.array(z.string()).default([]).describe("The scope set the user granted at consent (opaque to the AS; empty resolves to the read-only fail-safe)")
|
|
82
|
-
}).describe("Consent confirmation body \u2014 the granted scope set");
|
|
83
|
-
|
|
84
|
-
export { ChangePasswordRequest, EmailLoginRequest, EmailRegisterRequest, ExchangeXLoginRequest, ForgotPasswordRequest, LinkEmailRequest, LinkWalletRequest, LoginRequest, LogoutRequest, OauthInteractionConfirmRequest, RefreshTokenRequest, RequestNonceRequest, ResendVerificationForRegisterRequest, ResetPasswordRequest, SetXVisibilityRequest, StartXLinkRequest, StartXLoginRequest, VerifyEmailRequest, WalletLoginRequest };
|
package/dist/auth/response.js
DELETED
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { AuthenticatedUser, ConnectedIdentity } from './entities';
|
|
3
|
-
|
|
4
|
-
const LoginResponse = z.object({
|
|
5
|
-
accessToken: z.string().describe("New JWT access token"),
|
|
6
|
-
refreshToken: z.string().describe("New JWT refresh token"),
|
|
7
|
-
user: AuthenticatedUser
|
|
8
|
-
}).describe("Successful login response");
|
|
9
|
-
const RefreshTokenResponse = z.object({
|
|
10
|
-
accessToken: z.string().describe("New JWT access token"),
|
|
11
|
-
refreshToken: z.string().describe("New JWT refresh token"),
|
|
12
|
-
tokenType: z.literal("Bearer").describe('Token type (always "Bearer")'),
|
|
13
|
-
expiresIn: z.number().int().positive().describe("Access token expiry time in seconds")
|
|
14
|
-
}).describe("Successful token refresh response");
|
|
15
|
-
const RefreshSessionResponse = z.object({
|
|
16
|
-
accessToken: z.string().describe("New JWT access token"),
|
|
17
|
-
tokenType: z.literal("Bearer").describe('Token type (always "Bearer")'),
|
|
18
|
-
expiresIn: z.number().int().positive().describe("Access token expiry time in seconds")
|
|
19
|
-
}).describe("Successful session refresh response");
|
|
20
|
-
const LogoutResponse = z.void().describe("Successful logout response");
|
|
21
|
-
const RegisterEmailResponse = z.void().describe("Successful email registration response");
|
|
22
|
-
const ResendVerificationResponse = z.void().describe("Successful resend verification email response");
|
|
23
|
-
const ChangePasswordResponse = z.void().describe("Successful password change response");
|
|
24
|
-
const ForgotPasswordResponse = z.void().describe("Successful password reset request response");
|
|
25
|
-
const ResetPasswordResponse = z.void().describe("Successful password reset response");
|
|
26
|
-
const VerifyEmailResponse = z.object({
|
|
27
|
-
verified: z.literal(true).describe("Always true; the claim behind the token is now verified"),
|
|
28
|
-
email: z.string().describe("Email address the verified claim belongs to"),
|
|
29
|
-
flow: z.enum([
|
|
30
|
-
"register",
|
|
31
|
-
"link"
|
|
32
|
-
]).describe("Claim flow the token was issued for"),
|
|
33
|
-
verifiedAt: z.string().describe("ISO-8601 timestamp of when the claim was verified")
|
|
34
|
-
}).describe("Successful email verification response");
|
|
35
|
-
const LinkEmailResponse = z.void().describe("Successful email verification response");
|
|
36
|
-
const LinkWalletResponse = z.void().describe("Successful wallet link response");
|
|
37
|
-
const StartXLinkResponse = z.object({
|
|
38
|
-
authorizeUrl: z.string().describe("X authorization URL to send the browser to. Expires with the flow's state.")
|
|
39
|
-
}).describe("Start of the X account link flow");
|
|
40
|
-
const SetXVisibilityResponse = z.object({
|
|
41
|
-
xHidden: z.boolean().describe("The stored state, read back from the write: true when the leaderboard and public trader profiles withhold the X account. A confirmation of what was asked for, not a value the caller could not otherwise know.")
|
|
42
|
-
}).describe("Visibility of the X account on the leaderboard and public trader profiles after the write");
|
|
43
|
-
const DisconnectXResponse = z.void().describe("Successful X account disconnect response");
|
|
44
|
-
const StartXLoginResponse = z.object({
|
|
45
|
-
authorizeUrl: z.string().describe("X authorization URL to send the browser to. Expires with the flow's state.")
|
|
46
|
-
}).describe("Start of the X sign-in flow");
|
|
47
|
-
const RequestNonceResponse = z.object({
|
|
48
|
-
nonce: z.string().describe("Nonce to sign with wallet"),
|
|
49
|
-
message: z.string().describe("Domain-bound wallet sign-in message"),
|
|
50
|
-
expiresAt: z.number().int().positive().describe("Unix timestamp when nonce expires")
|
|
51
|
-
}).describe("Nonce response for wallet authentication");
|
|
52
|
-
const MeResponse = AuthenticatedUser.extend({
|
|
53
|
-
identities: z.array(ConnectedIdentity).describe("Every provider identity connected to this account, oldest first")
|
|
54
|
-
}).describe("Current authenticated user info");
|
|
55
|
-
const OauthGrant = z.object({
|
|
56
|
-
id: z.string().describe("OAuth grant id \u2014 used to revoke this grant"),
|
|
57
|
-
name: z.string().describe("Human-readable client name, falling back to the client id when unnamed"),
|
|
58
|
-
scopes: z.array(z.string()).describe("The granted scope set (opaque; the client interprets it)"),
|
|
59
|
-
connectedAt: z.string().describe("ISO timestamp when the grant was created")
|
|
60
|
-
}).describe("One active OAuth grant the user has authorized");
|
|
61
|
-
const OauthGrantsResponse = z.object({
|
|
62
|
-
grants: z.array(OauthGrant).describe("The user active OAuth grants, newest first")
|
|
63
|
-
}).describe("List of the user active OAuth grants");
|
|
64
|
-
const OauthInteractionClient = z.object({
|
|
65
|
-
clientId: z.string().describe("OAuth client identifier"),
|
|
66
|
-
clientName: z.string().optional().describe("Human-readable client name"),
|
|
67
|
-
redirectUris: z.array(z.string()).describe("Registered redirect URIs for the client")
|
|
68
|
-
}).describe("OAuth client info for an interaction");
|
|
69
|
-
const OauthInteractionDetailsResponse = z.object({
|
|
70
|
-
uid: z.string().describe("Interaction session identifier"),
|
|
71
|
-
prompt: z.object({
|
|
72
|
-
name: z.string().describe('Prompt name the interaction is currently awaiting, e.g. "login" or "consent"'),
|
|
73
|
-
details: z.record(z.string(), z.unknown()).describe("Prompt-specific details from the AS")
|
|
74
|
-
}).describe("Prompt the interaction is currently awaiting"),
|
|
75
|
-
params: z.record(z.string(), z.unknown()).describe("Original authorization request params"),
|
|
76
|
-
client: OauthInteractionClient
|
|
77
|
-
}).describe("OAuth interaction details for the current prompt");
|
|
78
|
-
const OauthInteractionRedirectResponse = z.object({
|
|
79
|
-
returnTo: z.string().describe("Provider URL to redirect the browser back to")
|
|
80
|
-
}).describe("OAuth interaction redirect target after login/confirm/abort");
|
|
81
|
-
|
|
82
|
-
export { ChangePasswordResponse, DisconnectXResponse, ForgotPasswordResponse, LinkEmailResponse, LinkWalletResponse, LoginResponse, LogoutResponse, MeResponse, OauthGrant, OauthGrantsResponse, OauthInteractionClient, OauthInteractionDetailsResponse, OauthInteractionRedirectResponse, RefreshSessionResponse, RefreshTokenResponse, RegisterEmailResponse, RequestNonceResponse, ResendVerificationResponse, ResetPasswordResponse, SetXVisibilityResponse, StartXLinkResponse, StartXLoginResponse, VerifyEmailResponse };
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { Side, AssetWeight } from '../../common/schema';
|
|
3
|
-
import { InstrumentId } from '../../instrument';
|
|
4
|
-
|
|
5
|
-
const RecommendedBasketLeg = z.object({
|
|
6
|
-
id: InstrumentId.describe("Venue instrument id the leg trades"),
|
|
7
|
-
symbol: z.string().min(1).describe("Base asset shown to traders"),
|
|
8
|
-
side: Side,
|
|
9
|
-
weight: AssetWeight.describe("Share of total gross notional as a fraction (legs sum to 1)")
|
|
10
|
-
});
|
|
11
|
-
const RecommendedBasket = z.object({
|
|
12
|
-
id: z.uuid(),
|
|
13
|
-
name: z.string(),
|
|
14
|
-
description: z.string().optional(),
|
|
15
|
-
legs: z.tuple([
|
|
16
|
-
RecommendedBasketLeg
|
|
17
|
-
]).rest(RecommendedBasketLeg),
|
|
18
|
-
createdAt: z.string(),
|
|
19
|
-
updatedAt: z.string()
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
export { RecommendedBasket, RecommendedBasketLeg };
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { RefineLegIdMatchesSymbol } from '../../common/refinement';
|
|
3
|
-
import { Side, AssetWeight } from '../../common/schema';
|
|
4
|
-
import { InstrumentId } from '../../instrument';
|
|
5
|
-
|
|
6
|
-
const SavedBasketLeg = z.object({
|
|
7
|
-
// SYMBOL-MIGRATION switch-to-id: mirrors `symbol` today; becomes required once requests always carry `id`.
|
|
8
|
-
id: InstrumentId.optional().describe("Connector-native instrument id"),
|
|
9
|
-
symbol: InstrumentId,
|
|
10
|
-
side: Side,
|
|
11
|
-
weight: AssetWeight.describe("Share of total gross notional as a fraction (legs sum to 1)")
|
|
12
|
-
}).superRefine(RefineLegIdMatchesSymbol);
|
|
13
|
-
const SavedBasket = z.object({
|
|
14
|
-
id: z.uuid(),
|
|
15
|
-
name: z.string(),
|
|
16
|
-
legs: z.tuple([
|
|
17
|
-
SavedBasketLeg
|
|
18
|
-
]).rest(SavedBasketLeg),
|
|
19
|
-
createdAt: z.string(),
|
|
20
|
-
updatedAt: z.string()
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
export { SavedBasket, SavedBasketLeg };
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { RefineUniqueSymbols, RefineWeightingSum } from '../../common/refinement';
|
|
3
|
-
import { SavedBasketLeg } from './entities';
|
|
4
|
-
|
|
5
|
-
const SavedBasketName = z.string().trim().min(1, "Name is required").max(48).describe("Display name, unique per trade account (case-insensitive)");
|
|
6
|
-
const SavedBasketLegs = z.tuple([
|
|
7
|
-
SavedBasketLeg
|
|
8
|
-
]).rest(SavedBasketLeg).superRefine(RefineUniqueSymbols).superRefine(RefineWeightingSum).refine((value) => value.length <= 20, "Basket must have at most 20 legs").describe("At least one leg, up to 20");
|
|
9
|
-
const CreateSavedBasketPayload = z.object({
|
|
10
|
-
name: SavedBasketName,
|
|
11
|
-
legs: SavedBasketLegs
|
|
12
|
-
}).describe("Save the current basket under a name");
|
|
13
|
-
const UpdateSavedBasketPayload = z.object({
|
|
14
|
-
name: SavedBasketName.optional(),
|
|
15
|
-
legs: SavedBasketLegs.optional()
|
|
16
|
-
}).refine((value) => value.name !== void 0 || value.legs !== void 0, "Provide a name or legs to update").describe("Rename a saved basket and/or replace its legs");
|
|
17
|
-
|
|
18
|
-
export { CreateSavedBasketPayload, UpdateSavedBasketPayload };
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { SavedBasket } from './entities';
|
|
3
|
-
|
|
4
|
-
const SavedBasketListResponse = z.object({
|
|
5
|
-
baskets: z.array(SavedBasket)
|
|
6
|
-
});
|
|
7
|
-
const CreateSavedBasketResponse = z.object({
|
|
8
|
-
basket: SavedBasket
|
|
9
|
-
});
|
|
10
|
-
const UpdateSavedBasketResponse = z.object({
|
|
11
|
-
basket: SavedBasket
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
export { CreateSavedBasketResponse, SavedBasketListResponse, UpdateSavedBasketResponse };
|
package/dist/bundle.js
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
export * from './auth';
|
|
2
|
-
export * from './baskets/recommended';
|
|
3
|
-
export * from './baskets/saved';
|
|
4
|
-
export * from './common/address';
|
|
5
|
-
export * from './common/trade-legs';
|
|
6
|
-
export * from './connector';
|
|
7
|
-
export * from './copy';
|
|
8
|
-
export * from './execution';
|
|
9
|
-
export * from './fee';
|
|
10
|
-
export * from './fill';
|
|
11
|
-
export * from './funding';
|
|
12
|
-
export * from './instrument';
|
|
13
|
-
export * from './instrument-precision';
|
|
14
|
-
export * from './ladder';
|
|
15
|
-
export * from './leverage';
|
|
16
|
-
export * from './margin';
|
|
17
|
-
export * from './market';
|
|
18
|
-
export * from './misc';
|
|
19
|
-
export * from './notification';
|
|
20
|
-
export * from './order';
|
|
21
|
-
export * from './portfolio';
|
|
22
|
-
export * from './position';
|
|
23
|
-
export * from './price';
|
|
24
|
-
export * from './realtime';
|
|
25
|
-
export * from './rebalance';
|
|
26
|
-
export * from './schedule';
|
|
27
|
-
export * from './statistics';
|
|
28
|
-
export * from './sync';
|
|
29
|
-
export * from './tca';
|
|
30
|
-
export * from './trade';
|
|
31
|
-
export * from './trade-accounts';
|
|
32
|
-
export * from './traders';
|
|
33
|
-
export * from './trigger';
|
|
34
|
-
export * from './triggers';
|
|
35
|
-
export * from './users';
|
|
36
|
-
export * from './vaults';
|
package/dist/common/address.js
DELETED
package/dist/common/array.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
-
function normalizeArray(val) {
|
|
4
|
-
if (!val) return void 0;
|
|
5
|
-
if (Array.isArray(val)) return val;
|
|
6
|
-
if (typeof val === "string") {
|
|
7
|
-
return val.includes(",") ? val.split(",").map((s) => s.trim()) : [
|
|
8
|
-
val
|
|
9
|
-
];
|
|
10
|
-
}
|
|
11
|
-
return [
|
|
12
|
-
String(val)
|
|
13
|
-
];
|
|
14
|
-
}
|
|
15
|
-
__name(normalizeArray, "normalizeArray");
|
|
16
|
-
|
|
17
|
-
export { normalizeArray };
|
package/dist/common/client-id.js
DELETED
package/dist/common/index.js
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
-
const RefineMinimumOneSymbol = /* @__PURE__ */ __name((basket, ctx) => {
|
|
4
|
-
if (basket.length < 1) {
|
|
5
|
-
ctx.addIssue({
|
|
6
|
-
code: "custom",
|
|
7
|
-
message: "At least one symbol is required."
|
|
8
|
-
});
|
|
9
|
-
}
|
|
10
|
-
}, "RefineMinimumOneSymbol");
|
|
11
|
-
const RefineMinimumTwoSymbols = /* @__PURE__ */ __name((basket, ctx) => {
|
|
12
|
-
if (basket.length < 2) {
|
|
13
|
-
ctx.addIssue({
|
|
14
|
-
code: "custom",
|
|
15
|
-
message: "At least two symbols are required."
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
}, "RefineMinimumTwoSymbols");
|
|
19
|
-
const RefineTwoUniqueSymbols = /* @__PURE__ */ __name((pair, ctx) => {
|
|
20
|
-
if (pair.symbol_a === pair.symbol_b) {
|
|
21
|
-
ctx.addIssue({
|
|
22
|
-
code: "custom",
|
|
23
|
-
message: "Symbols cannot be the same."
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
}, "RefineTwoUniqueSymbols");
|
|
27
|
-
const RefineUniqueSymbols = /* @__PURE__ */ __name((basket, ctx) => {
|
|
28
|
-
const symbols = basket.map((item) => item.symbol);
|
|
29
|
-
const uniqueSymbols = new Set(symbols);
|
|
30
|
-
if (symbols.length !== uniqueSymbols.size) {
|
|
31
|
-
const duplicates = symbols.filter((symbol, index) => symbols.indexOf(symbol) !== index);
|
|
32
|
-
ctx.addIssue({
|
|
33
|
-
code: "custom",
|
|
34
|
-
message: `Duplicate symbols found: ${[
|
|
35
|
-
...new Set(duplicates)
|
|
36
|
-
].join(", ")}`,
|
|
37
|
-
path: [
|
|
38
|
-
"basket"
|
|
39
|
-
]
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
}, "RefineUniqueSymbols");
|
|
43
|
-
const RefineLegIdMatchesSymbol = /* @__PURE__ */ __name((leg, ctx) => {
|
|
44
|
-
if (leg.id !== void 0 && leg.id !== leg.symbol) {
|
|
45
|
-
ctx.addIssue({
|
|
46
|
-
code: "custom",
|
|
47
|
-
message: `Leg id and symbol must name the same instrument, got id "${leg.id}" and symbol "${leg.symbol}".`
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
}, "RefineLegIdMatchesSymbol");
|
|
51
|
-
const RefineWeightingSum = /* @__PURE__ */ __name((basket, ctx) => {
|
|
52
|
-
const totalWeight = basket.reduce((acc, curr) => acc + curr.weight, 0);
|
|
53
|
-
if (Math.abs(totalWeight - 1) > 1e-9) {
|
|
54
|
-
ctx.addIssue({
|
|
55
|
-
code: "custom",
|
|
56
|
-
message: `The sum of weights must be exactly 1, but got ${totalWeight}`,
|
|
57
|
-
path: [
|
|
58
|
-
"basket"
|
|
59
|
-
]
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
}, "RefineWeightingSum");
|
|
63
|
-
|
|
64
|
-
export { RefineLegIdMatchesSymbol, RefineMinimumOneSymbol, RefineMinimumTwoSymbols, RefineTwoUniqueSymbols, RefineUniqueSymbols, RefineWeightingSum };
|