@pear-protocol/types 0.0.15 → 0.0.17
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 +10 -1
- package/dist/auth/entities.js +4 -2
- package/dist/auth/response.d.ts +13 -12
- package/dist/auth/response.js +6 -2
- package/dist/bundle.d.ts +1 -0
- package/dist/bundle.js +1 -0
- package/dist/common/address.d.ts +3 -0
- package/dist/common/address.js +5 -0
- package/dist/common/hex-string.d.ts +3 -0
- package/dist/common/hex-string.js +5 -0
- package/dist/common/refinement.d.ts +1 -0
- package/dist/common/refinement.js +9 -1
- package/dist/common/request.js +1 -1
- package/dist/common/schema.d.ts +1 -1
- package/dist/common/schema.js +1 -1
- package/dist/connector/index.d.ts +4 -1
- package/dist/execution/entities.d.ts +6 -6
- package/dist/execution/responses.d.ts +2 -2
- package/dist/fill/entities.d.ts +20 -2
- package/dist/fill/entities.js +30 -5
- package/dist/fill/queries.d.ts +1 -0
- package/dist/fill/queries.js +3 -3
- package/dist/fill/responses.d.ts +44 -4
- package/dist/fill/responses.js +10 -1
- package/dist/instrument/responses.d.ts +4 -0
- package/dist/instrument/responses.js +5 -2
- package/dist/misc/index.d.ts +3 -1
- package/dist/misc/index.js +2 -1
- package/dist/misc/payloads.d.ts +33 -0
- package/dist/misc/payloads.js +31 -0
- package/dist/misc/responses.d.ts +26 -0
- package/dist/misc/responses.js +24 -0
- package/dist/position/entities.d.ts +5 -5
- package/dist/position/responses.d.ts +32 -2
- package/dist/position/responses.js +13 -1
- package/dist/schedule/entities.d.ts +82 -16
- package/dist/schedule/entities.js +5 -5
- package/dist/schedule/payloads.d.ts +4 -4
- package/dist/schedule/payloads.js +7 -7
- package/dist/schedule/responses.d.ts +66 -14
- package/dist/statistics/entities.d.ts +10 -3
- package/dist/statistics/entities.js +9 -3
- package/dist/statistics/queries.d.ts +26 -3
- package/dist/statistics/queries.js +11 -2
- package/dist/statistics/responses.d.ts +12 -3
- package/dist/statistics/responses.js +7 -4
- package/dist/sync/index.d.ts +2 -0
- package/dist/sync/index.js +2 -0
- package/dist/sync/payloads.d.ts +279 -0
- package/dist/sync/payloads.js +78 -0
- package/dist/sync/responses.d.ts +10 -0
- package/dist/sync/responses.js +11 -0
- package/dist/trade/payloads.d.ts +14 -4
- package/dist/trade/responses.d.ts +8 -8
- package/dist/trade-accounts/entities.d.ts +6 -0
- package/dist/trade-accounts/entities.js +4 -1
- package/dist/trade-accounts/payloads.d.ts +46 -10
- package/dist/trade-accounts/payloads.js +30 -6
- package/dist/trade-accounts/response.d.ts +10 -0
- package/dist/trade-accounts/response.js +9 -1
- package/dist/trigger/entities/index.d.ts +216 -46
- package/dist/trigger/entities/index.js +35 -9
- package/dist/trigger/payloads/index.d.ts +21 -6
- package/dist/trigger/payloads/index.js +24 -7
- package/dist/trigger/responses.d.ts +128 -28
- package/package.json +2 -2
|
@@ -6,7 +6,10 @@ const HyperliquidMetadata = z.object({
|
|
|
6
6
|
isSubaccount: z.boolean(),
|
|
7
7
|
mainAccountAddress: z.string()
|
|
8
8
|
});
|
|
9
|
-
const
|
|
9
|
+
const LighterMetadata = z.object({
|
|
10
|
+
l1_address: z.string()
|
|
11
|
+
});
|
|
12
|
+
const ConnectorMetadata = z.union([HyperliquidMetadata, LighterMetadata]).optional();
|
|
10
13
|
const TradeAccount = z.object({
|
|
11
14
|
id: z.uuid().describe("Trade account UUID"),
|
|
12
15
|
alias: z.string().describe("User-defined trade account alias"),
|
|
@@ -3,15 +3,15 @@ import { z } from 'zod';
|
|
|
3
3
|
* Hyperliquid connector credentials
|
|
4
4
|
*/
|
|
5
5
|
declare const CreateHyperliquidCredentials: z.ZodObject<{
|
|
6
|
-
signer_key: z.ZodString
|
|
6
|
+
signer_key: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
|
|
7
7
|
}, z.core.$strip>;
|
|
8
8
|
/**
|
|
9
9
|
* Hyperliquid connector metadata
|
|
10
10
|
*/
|
|
11
11
|
declare const CreateHyperliquidMetadata: z.ZodObject<{
|
|
12
|
-
agentWalletAddress: z.ZodString
|
|
12
|
+
agentWalletAddress: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
|
|
13
13
|
isSubaccount: z.ZodBoolean;
|
|
14
|
-
mainAccountAddress: z.ZodString
|
|
14
|
+
mainAccountAddress: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
|
|
15
15
|
}, z.core.$strip>;
|
|
16
16
|
declare const CreateBinanceCredentials: z.ZodObject<{
|
|
17
17
|
read: z.ZodObject<{
|
|
@@ -38,20 +38,33 @@ declare const CreateOkxCredentials: z.ZodObject<{
|
|
|
38
38
|
api_secret: z.ZodString;
|
|
39
39
|
api_pass: z.ZodString;
|
|
40
40
|
}, z.core.$strip>;
|
|
41
|
+
/**
|
|
42
|
+
* Lighter connector credentials
|
|
43
|
+
*/
|
|
44
|
+
declare const CreateLighterCredentials: z.ZodObject<{
|
|
45
|
+
api_private_key: z.ZodString;
|
|
46
|
+
api_key_index: z.ZodNumber;
|
|
47
|
+
}, z.core.$strip>;
|
|
48
|
+
/**
|
|
49
|
+
* Lighter connector metadata
|
|
50
|
+
*/
|
|
51
|
+
declare const CreateLighterMetadata: z.ZodObject<{
|
|
52
|
+
l1_address: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
|
|
53
|
+
}, z.core.$strip>;
|
|
41
54
|
/**
|
|
42
55
|
* Payload to create a new trade account
|
|
43
56
|
*/
|
|
44
57
|
export declare const CreateTradeAccount: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
45
58
|
connector: z.ZodLiteral<"hyperliquid">;
|
|
46
59
|
alias: z.ZodString;
|
|
47
|
-
exchangeIdentifier: z.ZodString
|
|
60
|
+
exchangeIdentifier: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
|
|
48
61
|
credentials: z.ZodObject<{
|
|
49
|
-
signer_key: z.ZodString
|
|
62
|
+
signer_key: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
|
|
50
63
|
}, z.core.$strip>;
|
|
51
64
|
metadata: z.ZodObject<{
|
|
52
|
-
agentWalletAddress: z.ZodString
|
|
65
|
+
agentWalletAddress: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
|
|
53
66
|
isSubaccount: z.ZodBoolean;
|
|
54
|
-
mainAccountAddress: z.ZodString
|
|
67
|
+
mainAccountAddress: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
|
|
55
68
|
}, z.core.$strip>;
|
|
56
69
|
}, z.core.$strip>, z.ZodObject<{
|
|
57
70
|
connector: z.ZodLiteral<"binance">;
|
|
@@ -84,6 +97,17 @@ export declare const CreateTradeAccount: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
84
97
|
api_pass: z.ZodString;
|
|
85
98
|
}, z.core.$strip>;
|
|
86
99
|
metadata: z.ZodPipe<z.ZodVoid, z.ZodTransform<undefined, void>>;
|
|
100
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
101
|
+
connector: z.ZodLiteral<"lighter">;
|
|
102
|
+
alias: z.ZodString;
|
|
103
|
+
exchangeIdentifier: z.ZodString;
|
|
104
|
+
credentials: z.ZodObject<{
|
|
105
|
+
api_private_key: z.ZodString;
|
|
106
|
+
api_key_index: z.ZodNumber;
|
|
107
|
+
}, z.core.$strip>;
|
|
108
|
+
metadata: z.ZodObject<{
|
|
109
|
+
l1_address: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
|
|
110
|
+
}, z.core.$strip>;
|
|
87
111
|
}, z.core.$strip>], "connector">;
|
|
88
112
|
/**
|
|
89
113
|
* Payload to update a trade account
|
|
@@ -92,12 +116,12 @@ export declare const UpdateTradeAccount: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
92
116
|
connector: z.ZodLiteral<"hyperliquid">;
|
|
93
117
|
alias: z.ZodOptional<z.ZodString>;
|
|
94
118
|
credentials: z.ZodOptional<z.ZodObject<{
|
|
95
|
-
signer_key: z.ZodString
|
|
119
|
+
signer_key: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
|
|
96
120
|
}, z.core.$strip>>;
|
|
97
121
|
metadata: z.ZodOptional<z.ZodObject<{
|
|
98
|
-
agentWalletAddress: z.ZodString
|
|
122
|
+
agentWalletAddress: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
|
|
99
123
|
isSubaccount: z.ZodBoolean;
|
|
100
|
-
mainAccountAddress: z.ZodString
|
|
124
|
+
mainAccountAddress: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
|
|
101
125
|
}, z.core.$strip>>;
|
|
102
126
|
}, z.core.$strip>, z.ZodObject<{
|
|
103
127
|
connector: z.ZodLiteral<"binance">;
|
|
@@ -130,12 +154,24 @@ export declare const UpdateTradeAccount: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
130
154
|
api_pass: z.ZodString;
|
|
131
155
|
}, z.core.$strip>>;
|
|
132
156
|
metadata: z.ZodPipe<z.ZodVoid, z.ZodTransform<undefined, void>>;
|
|
157
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
158
|
+
connector: z.ZodLiteral<"lighter">;
|
|
159
|
+
alias: z.ZodOptional<z.ZodString>;
|
|
160
|
+
credentials: z.ZodOptional<z.ZodObject<{
|
|
161
|
+
api_private_key: z.ZodString;
|
|
162
|
+
api_key_index: z.ZodNumber;
|
|
163
|
+
}, z.core.$strip>>;
|
|
164
|
+
metadata: z.ZodOptional<z.ZodObject<{
|
|
165
|
+
l1_address: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
|
|
166
|
+
}, z.core.$strip>>;
|
|
133
167
|
}, z.core.$strip>], "connector">;
|
|
134
168
|
export type CreateHyperliquidCredentials = z.infer<typeof CreateHyperliquidCredentials>;
|
|
135
169
|
export type CreateHyperliquidMetadata = z.infer<typeof CreateHyperliquidMetadata>;
|
|
136
170
|
export type CreateBinanceCredentials = z.infer<typeof CreateBinanceCredentials>;
|
|
137
171
|
export type CreateBybitCredentials = z.infer<typeof CreateBybitCredentials>;
|
|
138
172
|
export type CreateOkxCredentials = z.infer<typeof CreateOkxCredentials>;
|
|
173
|
+
export type CreateLighterCredentials = z.infer<typeof CreateLighterCredentials>;
|
|
174
|
+
export type CreateLighterMetadata = z.infer<typeof CreateLighterMetadata>;
|
|
139
175
|
export type CreateTradeAccountInput = z.input<typeof CreateTradeAccount>;
|
|
140
176
|
export type CreateTradeAccount = z.output<typeof CreateTradeAccount>;
|
|
141
177
|
export type UpdateTradeAccountInput = z.input<typeof UpdateTradeAccount>;
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { EthereumAddress } from '../common/address';
|
|
3
|
+
import { HexString } from '../common/hex-string';
|
|
2
4
|
|
|
3
5
|
const CreateHyperliquidCredentials = z.object({
|
|
4
|
-
signer_key:
|
|
6
|
+
signer_key: HexString
|
|
5
7
|
});
|
|
6
8
|
const CreateHyperliquidMetadata = z.object({
|
|
7
|
-
agentWalletAddress:
|
|
9
|
+
agentWalletAddress: EthereumAddress,
|
|
8
10
|
isSubaccount: z.boolean(),
|
|
9
|
-
mainAccountAddress:
|
|
11
|
+
mainAccountAddress: EthereumAddress
|
|
10
12
|
});
|
|
11
13
|
const BinanceApiKeyPair = z.object({
|
|
12
14
|
api_key: z.string().min(1, "API key is required"),
|
|
@@ -25,11 +27,18 @@ const CreateOkxCredentials = z.object({
|
|
|
25
27
|
api_secret: z.string().min(1, "API secret is required"),
|
|
26
28
|
api_pass: z.string().min(1, "API passphrase is required")
|
|
27
29
|
});
|
|
30
|
+
const CreateLighterCredentials = z.object({
|
|
31
|
+
api_private_key: z.string().min(1, "API private key is required"),
|
|
32
|
+
api_key_index: z.number().int().min(4, "API key slots 0-3 are reserved; use 4-254").max(254, "API key index must be <= 254")
|
|
33
|
+
});
|
|
34
|
+
const CreateLighterMetadata = z.object({
|
|
35
|
+
l1_address: EthereumAddress
|
|
36
|
+
});
|
|
28
37
|
const AccountAlias = z.string().min(1, "Alias is required").max(100, "Alias must be 100 characters or less");
|
|
29
38
|
const CreateHyperliquidAccount = z.object({
|
|
30
39
|
connector: z.literal("hyperliquid"),
|
|
31
40
|
alias: AccountAlias,
|
|
32
|
-
exchangeIdentifier:
|
|
41
|
+
exchangeIdentifier: EthereumAddress,
|
|
33
42
|
credentials: CreateHyperliquidCredentials,
|
|
34
43
|
metadata: CreateHyperliquidMetadata
|
|
35
44
|
});
|
|
@@ -51,6 +60,13 @@ const CreateOkxAccount = z.object({
|
|
|
51
60
|
credentials: CreateOkxCredentials,
|
|
52
61
|
metadata: z.void({}).transform(() => void 0)
|
|
53
62
|
});
|
|
63
|
+
const CreateLighterAccount = z.object({
|
|
64
|
+
connector: z.literal("lighter"),
|
|
65
|
+
alias: AccountAlias,
|
|
66
|
+
exchangeIdentifier: z.string().regex(/^\d+$/, "Exchange identifier must be the numeric Lighter account index"),
|
|
67
|
+
credentials: CreateLighterCredentials,
|
|
68
|
+
metadata: CreateLighterMetadata
|
|
69
|
+
});
|
|
54
70
|
const UpdateHyperliquidAccount = z.object({
|
|
55
71
|
connector: z.literal("hyperliquid"),
|
|
56
72
|
alias: AccountAlias.optional(),
|
|
@@ -75,17 +91,25 @@ const UpdateOkxAccount = z.object({
|
|
|
75
91
|
credentials: CreateOkxCredentials.optional(),
|
|
76
92
|
metadata: z.void({}).transform(() => void 0)
|
|
77
93
|
});
|
|
94
|
+
const UpdateLighterAccount = z.object({
|
|
95
|
+
connector: z.literal("lighter"),
|
|
96
|
+
alias: AccountAlias.optional(),
|
|
97
|
+
credentials: CreateLighterCredentials.optional(),
|
|
98
|
+
metadata: CreateLighterMetadata.optional()
|
|
99
|
+
});
|
|
78
100
|
const CreateTradeAccount = z.discriminatedUnion("connector", [
|
|
79
101
|
CreateHyperliquidAccount,
|
|
80
102
|
CreateBinanceAccount,
|
|
81
103
|
CreateBybitAccount,
|
|
82
|
-
CreateOkxAccount
|
|
104
|
+
CreateOkxAccount,
|
|
105
|
+
CreateLighterAccount
|
|
83
106
|
]);
|
|
84
107
|
const UpdateTradeAccount = z.discriminatedUnion("connector", [
|
|
85
108
|
UpdateHyperliquidAccount,
|
|
86
109
|
UpdateBinanceAccount,
|
|
87
110
|
UpdateBybitAccount,
|
|
88
|
-
UpdateOkxAccount
|
|
111
|
+
UpdateOkxAccount,
|
|
112
|
+
UpdateLighterAccount
|
|
89
113
|
]);
|
|
90
114
|
|
|
91
115
|
export { CreateTradeAccount, UpdateTradeAccount };
|
|
@@ -15,6 +15,8 @@ export declare const TradeAccountResponse: z.ZodObject<{
|
|
|
15
15
|
agentWalletAddress: z.ZodString;
|
|
16
16
|
isSubaccount: z.ZodBoolean;
|
|
17
17
|
mainAccountAddress: z.ZodString;
|
|
18
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
19
|
+
l1_address: z.ZodString;
|
|
18
20
|
}, z.core.$strip>]>>;
|
|
19
21
|
createdAt: z.ZodString;
|
|
20
22
|
updatedAt: z.ZodString;
|
|
@@ -38,6 +40,8 @@ export declare const TradeAccountListResponse: z.ZodObject<{
|
|
|
38
40
|
agentWalletAddress: z.ZodString;
|
|
39
41
|
isSubaccount: z.ZodBoolean;
|
|
40
42
|
mainAccountAddress: z.ZodString;
|
|
43
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
44
|
+
l1_address: z.ZodString;
|
|
41
45
|
}, z.core.$strip>]>>;
|
|
42
46
|
createdAt: z.ZodString;
|
|
43
47
|
updatedAt: z.ZodString;
|
|
@@ -75,5 +79,11 @@ export declare const ExchangeCredentialsResponse: z.ZodDiscriminatedUnion<[z.Zod
|
|
|
75
79
|
api_secret: z.ZodString;
|
|
76
80
|
api_pass: z.ZodString;
|
|
77
81
|
}, z.core.$strip>;
|
|
82
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
83
|
+
connector: z.ZodLiteral<"lighter">;
|
|
84
|
+
credentials: z.ZodObject<{
|
|
85
|
+
api_private_key: z.ZodString;
|
|
86
|
+
api_key_index: z.ZodNumber;
|
|
87
|
+
}, z.core.$strip>;
|
|
78
88
|
}, z.core.$strip>], "connector">;
|
|
79
89
|
export type ExchangeCredentialsResponse = z.infer<typeof ExchangeCredentialsResponse>;
|
|
@@ -35,11 +35,19 @@ const OkxCredentialsResponse = z.object({
|
|
|
35
35
|
api_pass: z.string()
|
|
36
36
|
})
|
|
37
37
|
});
|
|
38
|
+
const LighterCredentialsResponse = z.object({
|
|
39
|
+
connector: z.literal("lighter"),
|
|
40
|
+
credentials: z.object({
|
|
41
|
+
api_private_key: z.string(),
|
|
42
|
+
api_key_index: z.number()
|
|
43
|
+
})
|
|
44
|
+
});
|
|
38
45
|
const ExchangeCredentialsResponse = z.discriminatedUnion("connector", [
|
|
39
46
|
HyperliquidCredentialsResponse,
|
|
40
47
|
BinanceCredentialsResponse,
|
|
41
48
|
BybitCredentialsResponse,
|
|
42
|
-
OkxCredentialsResponse
|
|
49
|
+
OkxCredentialsResponse,
|
|
50
|
+
LighterCredentialsResponse
|
|
43
51
|
]);
|
|
44
52
|
|
|
45
53
|
export { ExchangeCredentialsResponse, TradeAccountListResponse, TradeAccountResponse };
|