@pear-protocol/types 0.0.1
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/auth/entities.d.ts +9 -0
- package/dist/auth/entities.js +8 -0
- package/dist/auth/index.d.ts +3 -0
- package/dist/auth/index.js +3 -0
- package/dist/auth/payloads.d.ts +50 -0
- package/dist/auth/payloads.js +39 -0
- package/dist/auth/response.d.ts +55 -0
- package/dist/auth/response.js +21 -0
- package/dist/bundle.d.ts +17 -0
- package/dist/bundle.js +17 -0
- package/dist/common/array.d.ts +10 -0
- package/dist/common/array.js +10 -0
- package/dist/common/index.d.ts +3 -0
- package/dist/common/index.js +3 -0
- package/dist/common/refinement.d.ts +20 -0
- package/dist/common/refinement.js +60 -0
- package/dist/common/request.d.ts +11 -0
- package/dist/common/request.js +24 -0
- package/dist/common/response.d.ts +12 -0
- package/dist/common/response.js +28 -0
- package/dist/common/schema.d.ts +8 -0
- package/dist/common/schema.js +10 -0
- package/dist/common/trade-legs.d.ts +34 -0
- package/dist/common/trade-legs.js +30 -0
- package/dist/connector/index.d.ts +8 -0
- package/dist/connector/index.js +5 -0
- package/dist/execution/entities.d.ts +741 -0
- package/dist/execution/entities.js +125 -0
- package/dist/execution/index.d.ts +3 -0
- package/dist/execution/index.js +3 -0
- package/dist/execution/queries.d.ts +20 -0
- package/dist/execution/queries.js +14 -0
- package/dist/execution/responses.d.ts +218 -0
- package/dist/execution/responses.js +9 -0
- package/dist/fill/entities.d.ts +25 -0
- package/dist/fill/entities.js +61 -0
- package/dist/fill/index.d.ts +3 -0
- package/dist/fill/index.js +3 -0
- package/dist/fill/queries.d.ts +13 -0
- package/dist/fill/queries.js +11 -0
- package/dist/fill/responses.d.ts +55 -0
- package/dist/fill/responses.js +12 -0
- package/dist/funding/entities.d.ts +11 -0
- package/dist/funding/entities.js +16 -0
- package/dist/funding/index.d.ts +3 -0
- package/dist/funding/index.js +3 -0
- package/dist/funding/queries.d.ts +10 -0
- package/dist/funding/queries.js +8 -0
- package/dist/funding/responses.d.ts +8 -0
- package/dist/funding/responses.js +11 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +3 -0
- package/dist/instrument/entities.d.ts +43 -0
- package/dist/instrument/entities.js +48 -0
- package/dist/instrument/index.d.ts +3 -0
- package/dist/instrument/index.js +3 -0
- package/dist/instrument/queries.d.ts +10 -0
- package/dist/instrument/queries.js +8 -0
- package/dist/instrument/responses.d.ts +37 -0
- package/dist/instrument/responses.js +11 -0
- package/dist/instrument-precision/index.d.ts +18 -0
- package/dist/instrument-precision/index.js +51 -0
- package/dist/misc/index.d.ts +3 -0
- package/dist/misc/index.js +1 -0
- package/dist/order/entities.d.ts +73 -0
- package/dist/order/entities.js +73 -0
- package/dist/order/index.d.ts +1 -0
- package/dist/order/index.js +1 -0
- package/dist/position/entities.d.ts +53 -0
- package/dist/position/entities.js +55 -0
- package/dist/position/index.d.ts +3 -0
- package/dist/position/index.js +3 -0
- package/dist/position/queries.d.ts +16 -0
- package/dist/position/queries.js +28 -0
- package/dist/position/responses.d.ts +28 -0
- package/dist/position/responses.js +8 -0
- package/dist/price/entities.d.ts +8 -0
- package/dist/price/entities.js +7 -0
- package/dist/price/index.d.ts +3 -0
- package/dist/price/index.js +3 -0
- package/dist/price/queries.d.ts +10 -0
- package/dist/price/queries.js +8 -0
- package/dist/price/responses.d.ts +6 -0
- package/dist/price/responses.js +15 -0
- package/dist/schedule/entities.d.ts +380 -0
- package/dist/schedule/entities.js +159 -0
- package/dist/schedule/index.d.ts +4 -0
- package/dist/schedule/index.js +4 -0
- package/dist/schedule/payloads.d.ts +72 -0
- package/dist/schedule/payloads.js +102 -0
- package/dist/schedule/queries.d.ts +18 -0
- package/dist/schedule/queries.js +12 -0
- package/dist/schedule/responses.d.ts +279 -0
- package/dist/schedule/responses.js +10 -0
- package/dist/trade/index.d.ts +2 -0
- package/dist/trade/index.js +2 -0
- package/dist/trade/payloads.d.ts +217 -0
- package/dist/trade/payloads.js +35 -0
- package/dist/trade/responses.d.ts +861 -0
- package/dist/trade/responses.js +9 -0
- package/dist/trade-accounts/entities.d.ts +50 -0
- package/dist/trade-accounts/entities.js +18 -0
- package/dist/trade-accounts/index.d.ts +3 -0
- package/dist/trade-accounts/index.js +3 -0
- package/dist/trade-accounts/payloads.d.ts +137 -0
- package/dist/trade-accounts/payloads.js +84 -0
- package/dist/trade-accounts/response.d.ts +65 -0
- package/dist/trade-accounts/response.js +41 -0
- package/dist/trigger/entities/conditions.d.ts +407 -0
- package/dist/trigger/entities/conditions.js +239 -0
- package/dist/trigger/entities/index.d.ts +1549 -0
- package/dist/trigger/entities/index.js +123 -0
- package/dist/trigger/index.d.ts +6 -0
- package/dist/trigger/index.js +6 -0
- package/dist/trigger/payloads/conditions.d.ts +340 -0
- package/dist/trigger/payloads/conditions.js +109 -0
- package/dist/trigger/payloads/index.d.ts +470 -0
- package/dist/trigger/payloads/index.js +47 -0
- package/dist/trigger/queries.d.ts +18 -0
- package/dist/trigger/queries.js +12 -0
- package/dist/trigger/responses.d.ts +1001 -0
- package/dist/trigger/responses.js +10 -0
- package/dist/users/entities.d.ts +16 -0
- package/dist/users/entities.js +14 -0
- package/dist/users/index.d.ts +3 -0
- package/dist/users/index.js +3 -0
- package/dist/users/payloads.d.ts +5 -0
- package/dist/users/payloads.js +7 -0
- package/dist/users/response.d.ts +23 -0
- package/dist/users/response.js +12 -0
- package/package.json +35 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { Execution } from '../execution/entities';
|
|
3
|
+
|
|
4
|
+
const CreateTradeOpenResponse = z.object({ execution: Execution });
|
|
5
|
+
const CreateTradeAdjustResponse = z.object({ execution: Execution });
|
|
6
|
+
const CreateTradeCloseResponse = z.object({ execution: Execution });
|
|
7
|
+
const CreateTradeCloseAllResponse = z.object({ executions: z.array(Execution) });
|
|
8
|
+
|
|
9
|
+
export { CreateTradeAdjustResponse, CreateTradeCloseAllResponse, CreateTradeCloseResponse, CreateTradeOpenResponse };
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Hyperliquid connector metadata
|
|
4
|
+
*/
|
|
5
|
+
declare const HyperliquidMetadata: z.ZodObject<{
|
|
6
|
+
address: z.ZodString;
|
|
7
|
+
isSubaccount: z.ZodBoolean;
|
|
8
|
+
}, z.core.$strip>;
|
|
9
|
+
/**
|
|
10
|
+
* Binance USDM connector metadata (empty for now)
|
|
11
|
+
*/
|
|
12
|
+
declare const BinanceUSDMMetadata: z.ZodOptional<z.ZodObject<{}, z.core.$strip>>;
|
|
13
|
+
/**
|
|
14
|
+
* Bybit connector metadata (empty for now)
|
|
15
|
+
*/
|
|
16
|
+
declare const BybitMetadata: z.ZodOptional<z.ZodObject<{}, z.core.$strip>>;
|
|
17
|
+
/**
|
|
18
|
+
* OKX connector metadata (empty for now)
|
|
19
|
+
*/
|
|
20
|
+
declare const OkxMetadata: z.ZodOptional<z.ZodObject<{}, z.core.$strip>>;
|
|
21
|
+
/**
|
|
22
|
+
* Union of all connector metadata schemas
|
|
23
|
+
*/
|
|
24
|
+
declare const ConnectorMetadata: z.ZodNullable<z.ZodUnion<readonly [z.ZodObject<{
|
|
25
|
+
address: z.ZodString;
|
|
26
|
+
isSubaccount: z.ZodBoolean;
|
|
27
|
+
}, z.core.$strip>, z.ZodOptional<z.ZodObject<{}, z.core.$strip>>, z.ZodOptional<z.ZodObject<{}, z.core.$strip>>, z.ZodOptional<z.ZodObject<{}, z.core.$strip>>]>>;
|
|
28
|
+
export declare const TradeAccount: z.ZodObject<{
|
|
29
|
+
id: z.ZodUUID;
|
|
30
|
+
alias: z.ZodString;
|
|
31
|
+
connector: z.ZodEnum<{
|
|
32
|
+
hyperliquid: "hyperliquid";
|
|
33
|
+
binanceusdm: "binanceusdm";
|
|
34
|
+
bybit: "bybit";
|
|
35
|
+
okx: "okx";
|
|
36
|
+
}>;
|
|
37
|
+
metadata: z.ZodNullable<z.ZodUnion<readonly [z.ZodObject<{
|
|
38
|
+
address: z.ZodString;
|
|
39
|
+
isSubaccount: z.ZodBoolean;
|
|
40
|
+
}, z.core.$strip>, z.ZodOptional<z.ZodObject<{}, z.core.$strip>>, z.ZodOptional<z.ZodObject<{}, z.core.$strip>>, z.ZodOptional<z.ZodObject<{}, z.core.$strip>>]>>;
|
|
41
|
+
createdAt: z.ZodString;
|
|
42
|
+
updatedAt: z.ZodString;
|
|
43
|
+
}, z.core.$strip>;
|
|
44
|
+
export type TradeAccount = z.infer<typeof TradeAccount>;
|
|
45
|
+
export type HyperliquidMetadata = z.infer<typeof HyperliquidMetadata>;
|
|
46
|
+
export type BinanceUSDMMetadata = z.infer<typeof BinanceUSDMMetadata>;
|
|
47
|
+
export type BybitMetadata = z.infer<typeof BybitMetadata>;
|
|
48
|
+
export type OkxMetadata = z.infer<typeof OkxMetadata>;
|
|
49
|
+
export type ConnectorMetadata = z.infer<typeof ConnectorMetadata>;
|
|
50
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { Connector } from '../connector';
|
|
3
|
+
|
|
4
|
+
const HyperliquidMetadata = z.object({ address: z.string(), isSubaccount: z.boolean() });
|
|
5
|
+
const BinanceUSDMMetadata = z.object({}).optional();
|
|
6
|
+
const BybitMetadata = z.object({}).optional();
|
|
7
|
+
const OkxMetadata = z.object({}).optional();
|
|
8
|
+
const ConnectorMetadata = z.union([HyperliquidMetadata, BinanceUSDMMetadata, BybitMetadata, OkxMetadata]).nullable();
|
|
9
|
+
const TradeAccount = z.object({
|
|
10
|
+
id: z.uuid().describe("Trade account UUID"),
|
|
11
|
+
alias: z.string().describe("User-defined trade account alias"),
|
|
12
|
+
connector: Connector.describe("Exchange connector type"),
|
|
13
|
+
metadata: ConnectorMetadata.describe("Connector-specific metadata"),
|
|
14
|
+
createdAt: z.string().describe("Creation timestamp (ISO 8601)"),
|
|
15
|
+
updatedAt: z.string().describe("Last update timestamp (ISO 8601)")
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
export { TradeAccount };
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Hyperliquid connector credentials
|
|
4
|
+
*/
|
|
5
|
+
declare const CreateHyperliquidCredentials: z.ZodObject<{
|
|
6
|
+
signer_key: z.ZodString;
|
|
7
|
+
}, z.core.$strip>;
|
|
8
|
+
/**
|
|
9
|
+
* Hyperliquid connector metadata
|
|
10
|
+
*/
|
|
11
|
+
declare const CreateHyperliquidMetadata: z.ZodObject<{
|
|
12
|
+
address: z.ZodString;
|
|
13
|
+
isSubaccount: z.ZodBoolean;
|
|
14
|
+
}, z.core.$strip>;
|
|
15
|
+
/**
|
|
16
|
+
* Binance USDM connector credentials
|
|
17
|
+
*/
|
|
18
|
+
declare const CreateBinanceUSDMCredentials: z.ZodObject<{
|
|
19
|
+
api_key: z.ZodString;
|
|
20
|
+
api_secret: z.ZodString;
|
|
21
|
+
}, z.core.$strip>;
|
|
22
|
+
/**
|
|
23
|
+
* Binance USDM connector metadata (empty for now)
|
|
24
|
+
*/
|
|
25
|
+
declare const CreateBinanceUSDMMetadata: z.ZodOptional<z.ZodObject<{}, z.core.$strip>>;
|
|
26
|
+
/**
|
|
27
|
+
* Bybit connector credentials
|
|
28
|
+
*/
|
|
29
|
+
declare const CreateBybitCredentials: z.ZodObject<{
|
|
30
|
+
api_key: z.ZodString;
|
|
31
|
+
api_secret: z.ZodString;
|
|
32
|
+
}, z.core.$strip>;
|
|
33
|
+
/**
|
|
34
|
+
* Bybit connector metadata (empty for now)
|
|
35
|
+
*/
|
|
36
|
+
declare const CreateBybitMetadata: z.ZodOptional<z.ZodObject<{}, z.core.$strip>>;
|
|
37
|
+
/**
|
|
38
|
+
* OKX connector credentials
|
|
39
|
+
*/
|
|
40
|
+
declare const CreateOkxCredentials: z.ZodObject<{
|
|
41
|
+
api_key: z.ZodString;
|
|
42
|
+
api_secret: z.ZodString;
|
|
43
|
+
api_pass: z.ZodString;
|
|
44
|
+
}, z.core.$strip>;
|
|
45
|
+
/**
|
|
46
|
+
* OKX connector metadata (empty for now)
|
|
47
|
+
*/
|
|
48
|
+
declare const CreateOkxMetadata: z.ZodOptional<z.ZodObject<{}, z.core.$strip>>;
|
|
49
|
+
/**
|
|
50
|
+
* Payload to create a new trade account
|
|
51
|
+
*/
|
|
52
|
+
export declare const CreateTradeAccount: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
53
|
+
connector: z.ZodLiteral<"hyperliquid">;
|
|
54
|
+
alias: z.ZodString;
|
|
55
|
+
credentials: z.ZodObject<{
|
|
56
|
+
signer_key: z.ZodString;
|
|
57
|
+
}, z.core.$strip>;
|
|
58
|
+
metadata: z.ZodObject<{
|
|
59
|
+
address: z.ZodString;
|
|
60
|
+
isSubaccount: z.ZodBoolean;
|
|
61
|
+
}, z.core.$strip>;
|
|
62
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
63
|
+
connector: z.ZodLiteral<"binanceusdm">;
|
|
64
|
+
alias: z.ZodString;
|
|
65
|
+
credentials: z.ZodObject<{
|
|
66
|
+
api_key: z.ZodString;
|
|
67
|
+
api_secret: z.ZodString;
|
|
68
|
+
}, z.core.$strip>;
|
|
69
|
+
metadata: z.ZodOptional<z.ZodObject<{}, z.core.$strip>>;
|
|
70
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
71
|
+
connector: z.ZodLiteral<"bybit">;
|
|
72
|
+
alias: z.ZodString;
|
|
73
|
+
credentials: z.ZodObject<{
|
|
74
|
+
api_key: z.ZodString;
|
|
75
|
+
api_secret: z.ZodString;
|
|
76
|
+
}, z.core.$strip>;
|
|
77
|
+
metadata: z.ZodOptional<z.ZodObject<{}, z.core.$strip>>;
|
|
78
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
79
|
+
connector: z.ZodLiteral<"okx">;
|
|
80
|
+
alias: z.ZodString;
|
|
81
|
+
credentials: z.ZodObject<{
|
|
82
|
+
api_key: z.ZodString;
|
|
83
|
+
api_secret: z.ZodString;
|
|
84
|
+
api_pass: z.ZodString;
|
|
85
|
+
}, z.core.$strip>;
|
|
86
|
+
metadata: z.ZodOptional<z.ZodObject<{}, z.core.$strip>>;
|
|
87
|
+
}, z.core.$strip>], "connector">;
|
|
88
|
+
/**
|
|
89
|
+
* Payload to update a trade account for a specific connector.
|
|
90
|
+
*/
|
|
91
|
+
export declare const UpdateTradeAccount: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
92
|
+
connector: z.ZodLiteral<"hyperliquid">;
|
|
93
|
+
alias: z.ZodOptional<z.ZodString>;
|
|
94
|
+
credentials: z.ZodOptional<z.ZodObject<{
|
|
95
|
+
signer_key: z.ZodString;
|
|
96
|
+
}, z.core.$strip>>;
|
|
97
|
+
metadata: z.ZodOptional<z.ZodObject<{
|
|
98
|
+
address: z.ZodString;
|
|
99
|
+
isSubaccount: z.ZodBoolean;
|
|
100
|
+
}, z.core.$strip>>;
|
|
101
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
102
|
+
connector: z.ZodLiteral<"binanceusdm">;
|
|
103
|
+
alias: z.ZodOptional<z.ZodString>;
|
|
104
|
+
credentials: z.ZodOptional<z.ZodObject<{
|
|
105
|
+
api_key: z.ZodString;
|
|
106
|
+
api_secret: z.ZodString;
|
|
107
|
+
}, z.core.$strip>>;
|
|
108
|
+
metadata: z.ZodOptional<z.ZodOptional<z.ZodObject<{}, z.core.$strip>>>;
|
|
109
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
110
|
+
connector: z.ZodLiteral<"bybit">;
|
|
111
|
+
alias: z.ZodOptional<z.ZodString>;
|
|
112
|
+
credentials: z.ZodOptional<z.ZodObject<{
|
|
113
|
+
api_key: z.ZodString;
|
|
114
|
+
api_secret: z.ZodString;
|
|
115
|
+
}, z.core.$strip>>;
|
|
116
|
+
metadata: z.ZodOptional<z.ZodOptional<z.ZodObject<{}, z.core.$strip>>>;
|
|
117
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
118
|
+
connector: z.ZodLiteral<"okx">;
|
|
119
|
+
alias: z.ZodOptional<z.ZodString>;
|
|
120
|
+
credentials: z.ZodOptional<z.ZodObject<{
|
|
121
|
+
api_key: z.ZodString;
|
|
122
|
+
api_secret: z.ZodString;
|
|
123
|
+
api_pass: z.ZodString;
|
|
124
|
+
}, z.core.$strip>>;
|
|
125
|
+
metadata: z.ZodOptional<z.ZodOptional<z.ZodObject<{}, z.core.$strip>>>;
|
|
126
|
+
}, z.core.$strip>], "connector">;
|
|
127
|
+
export type CreateHyperliquidCredentials = z.infer<typeof CreateHyperliquidCredentials>;
|
|
128
|
+
export type CreateHyperliquidMetadata = z.infer<typeof CreateHyperliquidMetadata>;
|
|
129
|
+
export type CreateBinanceUSDMMetadata = z.infer<typeof CreateBinanceUSDMMetadata>;
|
|
130
|
+
export type CreateBinanceUSDMCredentials = z.infer<typeof CreateBinanceUSDMCredentials>;
|
|
131
|
+
export type CreateBybitCredentials = z.infer<typeof CreateBybitCredentials>;
|
|
132
|
+
export type CreateBybitMetadata = z.infer<typeof CreateBybitMetadata>;
|
|
133
|
+
export type CreateOkxCredentials = z.infer<typeof CreateOkxCredentials>;
|
|
134
|
+
export type CreateOkxMetadata = z.infer<typeof CreateOkxMetadata>;
|
|
135
|
+
export type CreateTradeAccount = z.infer<typeof CreateTradeAccount>;
|
|
136
|
+
export type UpdateTradeAccount = z.infer<typeof UpdateTradeAccount>;
|
|
137
|
+
export {};
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
const CreateHyperliquidCredentials = z.object({
|
|
4
|
+
signer_key: z.string().min(1, "Signer key is required")
|
|
5
|
+
});
|
|
6
|
+
const CreateHyperliquidMetadata = z.object({
|
|
7
|
+
address: z.string().regex(/^0x[a-fA-F0-9]{40}$/, "Invalid Ethereum address"),
|
|
8
|
+
isSubaccount: z.boolean()
|
|
9
|
+
});
|
|
10
|
+
const CreateBinanceUSDMCredentials = z.object({
|
|
11
|
+
api_key: z.string().min(1, "API key is required"),
|
|
12
|
+
api_secret: z.string().min(1, "API secret is required")
|
|
13
|
+
});
|
|
14
|
+
const CreateBinanceUSDMMetadata = z.object({}).optional();
|
|
15
|
+
const CreateBybitCredentials = z.object({
|
|
16
|
+
api_key: z.string().min(1, "API key is required"),
|
|
17
|
+
api_secret: z.string().min(1, "API secret is required")
|
|
18
|
+
});
|
|
19
|
+
const CreateBybitMetadata = z.object({}).optional();
|
|
20
|
+
const CreateOkxCredentials = z.object({
|
|
21
|
+
api_key: z.string().min(1, "API key is required"),
|
|
22
|
+
api_secret: z.string().min(1, "API secret is required"),
|
|
23
|
+
api_pass: z.string().min(1, "API passphrase is required")
|
|
24
|
+
});
|
|
25
|
+
const CreateOkxMetadata = z.object({}).optional();
|
|
26
|
+
const AccountAlias = z.string().min(1, "Alias is required").max(100, "Alias must be 100 characters or less");
|
|
27
|
+
const CreateHyperliquidAccount = z.object({
|
|
28
|
+
connector: z.literal("hyperliquid"),
|
|
29
|
+
alias: AccountAlias,
|
|
30
|
+
credentials: CreateHyperliquidCredentials,
|
|
31
|
+
metadata: CreateHyperliquidMetadata
|
|
32
|
+
});
|
|
33
|
+
const CreateBinanceUSDMAccount = z.object({
|
|
34
|
+
connector: z.literal("binanceusdm"),
|
|
35
|
+
alias: AccountAlias,
|
|
36
|
+
credentials: CreateBinanceUSDMCredentials,
|
|
37
|
+
metadata: CreateBinanceUSDMMetadata
|
|
38
|
+
});
|
|
39
|
+
const CreateBybitAccount = z.object({
|
|
40
|
+
connector: z.literal("bybit"),
|
|
41
|
+
alias: AccountAlias,
|
|
42
|
+
credentials: CreateBybitCredentials,
|
|
43
|
+
metadata: CreateBybitMetadata
|
|
44
|
+
});
|
|
45
|
+
const CreateOkxAccount = z.object({
|
|
46
|
+
connector: z.literal("okx"),
|
|
47
|
+
alias: AccountAlias,
|
|
48
|
+
credentials: CreateOkxCredentials,
|
|
49
|
+
metadata: CreateOkxMetadata
|
|
50
|
+
});
|
|
51
|
+
const CreateTradeAccount = z.discriminatedUnion("connector", [
|
|
52
|
+
CreateHyperliquidAccount,
|
|
53
|
+
CreateBinanceUSDMAccount,
|
|
54
|
+
CreateBybitAccount,
|
|
55
|
+
CreateOkxAccount
|
|
56
|
+
]);
|
|
57
|
+
const UpdateTradeAccount = z.discriminatedUnion("connector", [
|
|
58
|
+
z.object({
|
|
59
|
+
connector: z.literal("hyperliquid"),
|
|
60
|
+
alias: AccountAlias.optional(),
|
|
61
|
+
credentials: CreateHyperliquidCredentials.optional(),
|
|
62
|
+
metadata: CreateHyperliquidMetadata.optional()
|
|
63
|
+
}),
|
|
64
|
+
z.object({
|
|
65
|
+
connector: z.literal("binanceusdm"),
|
|
66
|
+
alias: AccountAlias.optional(),
|
|
67
|
+
credentials: CreateBinanceUSDMCredentials.optional(),
|
|
68
|
+
metadata: CreateBinanceUSDMMetadata.optional()
|
|
69
|
+
}),
|
|
70
|
+
z.object({
|
|
71
|
+
connector: z.literal("bybit"),
|
|
72
|
+
alias: AccountAlias.optional(),
|
|
73
|
+
credentials: CreateBybitCredentials.optional(),
|
|
74
|
+
metadata: CreateBybitMetadata.optional()
|
|
75
|
+
}),
|
|
76
|
+
z.object({
|
|
77
|
+
connector: z.literal("okx"),
|
|
78
|
+
alias: AccountAlias.optional(),
|
|
79
|
+
credentials: CreateOkxCredentials.optional(),
|
|
80
|
+
metadata: CreateOkxMetadata.optional()
|
|
81
|
+
})
|
|
82
|
+
]);
|
|
83
|
+
|
|
84
|
+
export { CreateTradeAccount, UpdateTradeAccount };
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const TradeAccountResponse: z.ZodObject<{
|
|
3
|
+
account: z.ZodObject<{
|
|
4
|
+
id: z.ZodUUID;
|
|
5
|
+
alias: z.ZodString;
|
|
6
|
+
connector: z.ZodEnum<{
|
|
7
|
+
hyperliquid: "hyperliquid";
|
|
8
|
+
binanceusdm: "binanceusdm";
|
|
9
|
+
bybit: "bybit";
|
|
10
|
+
okx: "okx";
|
|
11
|
+
}>;
|
|
12
|
+
metadata: z.ZodNullable<z.ZodUnion<readonly [z.ZodObject<{
|
|
13
|
+
address: z.ZodString;
|
|
14
|
+
isSubaccount: z.ZodBoolean;
|
|
15
|
+
}, z.core.$strip>, z.ZodOptional<z.ZodObject<{}, z.core.$strip>>, z.ZodOptional<z.ZodObject<{}, z.core.$strip>>, z.ZodOptional<z.ZodObject<{}, z.core.$strip>>]>>;
|
|
16
|
+
createdAt: z.ZodString;
|
|
17
|
+
updatedAt: z.ZodString;
|
|
18
|
+
}, z.core.$strip>;
|
|
19
|
+
}, z.core.$strip>;
|
|
20
|
+
export type TradeAccountResponse = z.infer<typeof TradeAccountResponse>;
|
|
21
|
+
export declare const TradeAccountListResponse: z.ZodObject<{
|
|
22
|
+
accounts: z.ZodArray<z.ZodObject<{
|
|
23
|
+
id: z.ZodUUID;
|
|
24
|
+
alias: z.ZodString;
|
|
25
|
+
connector: z.ZodEnum<{
|
|
26
|
+
hyperliquid: "hyperliquid";
|
|
27
|
+
binanceusdm: "binanceusdm";
|
|
28
|
+
bybit: "bybit";
|
|
29
|
+
okx: "okx";
|
|
30
|
+
}>;
|
|
31
|
+
metadata: z.ZodNullable<z.ZodUnion<readonly [z.ZodObject<{
|
|
32
|
+
address: z.ZodString;
|
|
33
|
+
isSubaccount: z.ZodBoolean;
|
|
34
|
+
}, z.core.$strip>, z.ZodOptional<z.ZodObject<{}, z.core.$strip>>, z.ZodOptional<z.ZodObject<{}, z.core.$strip>>, z.ZodOptional<z.ZodObject<{}, z.core.$strip>>]>>;
|
|
35
|
+
createdAt: z.ZodString;
|
|
36
|
+
updatedAt: z.ZodString;
|
|
37
|
+
}, z.core.$strip>>;
|
|
38
|
+
}, z.core.$strip>;
|
|
39
|
+
export type TradeAccountListResponse = z.infer<typeof TradeAccountListResponse>;
|
|
40
|
+
export declare const ExchangeCredentialsResponse: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
41
|
+
connector: z.ZodLiteral<"hyperliquid">;
|
|
42
|
+
credentials: z.ZodObject<{
|
|
43
|
+
signer_key: z.ZodString;
|
|
44
|
+
}, z.core.$strip>;
|
|
45
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
46
|
+
connector: z.ZodLiteral<"binanceusdm">;
|
|
47
|
+
credentials: z.ZodObject<{
|
|
48
|
+
api_key: z.ZodString;
|
|
49
|
+
api_secret: z.ZodString;
|
|
50
|
+
}, z.core.$strip>;
|
|
51
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
52
|
+
connector: z.ZodLiteral<"bybit">;
|
|
53
|
+
credentials: z.ZodObject<{
|
|
54
|
+
api_key: z.ZodString;
|
|
55
|
+
api_secret: z.ZodString;
|
|
56
|
+
}, z.core.$strip>;
|
|
57
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
58
|
+
connector: z.ZodLiteral<"okx">;
|
|
59
|
+
credentials: z.ZodObject<{
|
|
60
|
+
api_key: z.ZodString;
|
|
61
|
+
api_secret: z.ZodString;
|
|
62
|
+
api_pass: z.ZodString;
|
|
63
|
+
}, z.core.$strip>;
|
|
64
|
+
}, z.core.$strip>], "connector">;
|
|
65
|
+
export type ExchangeCredentialsResponse = z.infer<typeof ExchangeCredentialsResponse>;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { TradeAccount } from './entities';
|
|
3
|
+
|
|
4
|
+
const TradeAccountResponse = z.object({ account: TradeAccount });
|
|
5
|
+
const TradeAccountListResponse = z.object({ accounts: z.array(TradeAccount) });
|
|
6
|
+
const HyperliquidCredentialsResponse = z.object({
|
|
7
|
+
connector: z.literal("hyperliquid"),
|
|
8
|
+
credentials: z.object({
|
|
9
|
+
signer_key: z.string()
|
|
10
|
+
})
|
|
11
|
+
});
|
|
12
|
+
const BinanceUSDMCredentialsResponse = z.object({
|
|
13
|
+
connector: z.literal("binanceusdm"),
|
|
14
|
+
credentials: z.object({
|
|
15
|
+
api_key: z.string(),
|
|
16
|
+
api_secret: z.string()
|
|
17
|
+
})
|
|
18
|
+
});
|
|
19
|
+
const BybitCredentialsResponse = z.object({
|
|
20
|
+
connector: z.literal("bybit"),
|
|
21
|
+
credentials: z.object({
|
|
22
|
+
api_key: z.string(),
|
|
23
|
+
api_secret: z.string()
|
|
24
|
+
})
|
|
25
|
+
});
|
|
26
|
+
const OkxCredentialsResponse = z.object({
|
|
27
|
+
connector: z.literal("okx"),
|
|
28
|
+
credentials: z.object({
|
|
29
|
+
api_key: z.string(),
|
|
30
|
+
api_secret: z.string(),
|
|
31
|
+
api_pass: z.string()
|
|
32
|
+
})
|
|
33
|
+
});
|
|
34
|
+
const ExchangeCredentialsResponse = z.discriminatedUnion("connector", [
|
|
35
|
+
HyperliquidCredentialsResponse,
|
|
36
|
+
BinanceUSDMCredentialsResponse,
|
|
37
|
+
BybitCredentialsResponse,
|
|
38
|
+
OkxCredentialsResponse
|
|
39
|
+
]);
|
|
40
|
+
|
|
41
|
+
export { ExchangeCredentialsResponse, TradeAccountListResponse, TradeAccountResponse };
|