@pear-protocol/types 0.0.14 → 0.0.16

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.
@@ -27,7 +27,10 @@ export type OkxCredentialsDTO = {
27
27
  api_secret: string;
28
28
  api_pass: string;
29
29
  };
30
- export type LighterCredentialsDTO = Record<string, never>;
30
+ export type LighterCredentialsDTO = {
31
+ api_private_key: string;
32
+ api_key_index: number;
33
+ };
31
34
  export type ConnectorCredentialsDTO = {
32
35
  hyperliquid: HyperliquidCredentialsDTO;
33
36
  binance: BinanceCredentialsDTO;
@@ -1,3 +1,5 @@
1
+ export * from './payloads';
2
+ export * from './responses';
1
3
  export type UnsignedDecimalString = string;
2
4
  export type SignedDecimalString = string;
3
5
  export type Side = 'BUY' | 'SELL';
@@ -1 +1,2 @@
1
-
1
+ export * from './payloads';
2
+ export * from './responses';
@@ -0,0 +1,33 @@
1
+ import { z } from 'zod';
2
+ export declare const CreateLighterApiKeyParams: z.ZodObject<{
3
+ accountIndex: z.ZodNumber;
4
+ apiKeyIndex: z.ZodNumber;
5
+ }, z.core.$strip>;
6
+ export type CreateLighterApiKeyParams = z.output<typeof CreateLighterApiKeyParams>;
7
+ export declare const SubmitChangePubKeyParams: z.ZodObject<{
8
+ l1Signature: z.ZodString;
9
+ txInfo: z.ZodString;
10
+ accountIndex: z.ZodNumber;
11
+ apiKeyIndex: z.ZodNumber;
12
+ }, z.core.$strip>;
13
+ export type SubmitChangePubKeyParams = z.output<typeof SubmitChangePubKeyParams>;
14
+ export declare const PrepareApproveIntegratorParams: z.ZodObject<{
15
+ accountIndex: z.ZodNumber;
16
+ apiKeyIndex: z.ZodNumber;
17
+ apiPrivateKey: z.ZodString;
18
+ }, z.core.$strip>;
19
+ export type PrepareApproveIntegratorParams = z.output<typeof PrepareApproveIntegratorParams>;
20
+ export declare const SubmitApproveIntegratorParams: z.ZodObject<{
21
+ l1Signature: z.ZodString;
22
+ txInfo: z.ZodString;
23
+ accountIndex: z.ZodNumber;
24
+ apiKeyIndex: z.ZodNumber;
25
+ }, z.core.$strip>;
26
+ export type SubmitApproveIntegratorParams = z.output<typeof SubmitApproveIntegratorParams>;
27
+ export declare const CreateAuthTokenParams: z.ZodObject<{
28
+ accountIndex: z.ZodNumber;
29
+ apiKeyIndex: z.ZodNumber;
30
+ apiPrivateKey: z.ZodString;
31
+ ttlSeconds: z.ZodOptional<z.ZodNumber>;
32
+ }, z.core.$strip>;
33
+ export type CreateAuthTokenParams = z.output<typeof CreateAuthTokenParams>;
@@ -0,0 +1,31 @@
1
+ import { z } from 'zod';
2
+
3
+ const CreateLighterApiKeyParams = z.object({
4
+ accountIndex: z.number(),
5
+ apiKeyIndex: z.number()
6
+ });
7
+ const SubmitChangePubKeyParams = z.object({
8
+ l1Signature: z.string(),
9
+ txInfo: z.string(),
10
+ accountIndex: z.number(),
11
+ apiKeyIndex: z.number()
12
+ });
13
+ const PrepareApproveIntegratorParams = z.object({
14
+ accountIndex: z.number(),
15
+ apiKeyIndex: z.number(),
16
+ apiPrivateKey: z.string()
17
+ });
18
+ const SubmitApproveIntegratorParams = z.object({
19
+ l1Signature: z.string(),
20
+ txInfo: z.string(),
21
+ accountIndex: z.number(),
22
+ apiKeyIndex: z.number()
23
+ });
24
+ const CreateAuthTokenParams = z.object({
25
+ accountIndex: z.number(),
26
+ apiKeyIndex: z.number(),
27
+ apiPrivateKey: z.string(),
28
+ ttlSeconds: z.number().optional()
29
+ });
30
+
31
+ export { CreateAuthTokenParams, CreateLighterApiKeyParams, PrepareApproveIntegratorParams, SubmitApproveIntegratorParams, SubmitChangePubKeyParams };
@@ -0,0 +1,26 @@
1
+ import { z } from 'zod';
2
+ export declare const CreateApiKeyWithMessageResult: z.ZodObject<{
3
+ privateKey: z.ZodString;
4
+ publicKey: z.ZodString;
5
+ apiKeyIndex: z.ZodNumber;
6
+ messageToSign: z.ZodString;
7
+ txInfo: z.ZodString;
8
+ }, z.core.$strip>;
9
+ export type CreateApiKeyWithMessageResult = z.output<typeof CreateApiKeyWithMessageResult>;
10
+ export declare const SubmitChangePubKeyResult: z.ZodObject<{
11
+ txHash: z.ZodString;
12
+ }, z.core.$strip>;
13
+ export type SubmitChangePubKeyResult = z.output<typeof SubmitChangePubKeyResult>;
14
+ export declare const PrepareApproveIntegratorResult: z.ZodObject<{
15
+ messageToSign: z.ZodString;
16
+ txInfo: z.ZodString;
17
+ }, z.core.$strip>;
18
+ export type PrepareApproveIntegratorResult = z.output<typeof PrepareApproveIntegratorResult>;
19
+ export declare const SubmitApproveIntegratorResult: z.ZodObject<{
20
+ txHash: z.ZodString;
21
+ }, z.core.$strip>;
22
+ export type SubmitApproveIntegratorResult = z.output<typeof SubmitApproveIntegratorResult>;
23
+ export declare const CreateAuthTokenResult: z.ZodObject<{
24
+ token: z.ZodString;
25
+ }, z.core.$strip>;
26
+ export type CreateAuthTokenResult = z.output<typeof CreateAuthTokenResult>;
@@ -0,0 +1,24 @@
1
+ import { z } from 'zod';
2
+
3
+ const CreateApiKeyWithMessageResult = z.object({
4
+ privateKey: z.string(),
5
+ publicKey: z.string(),
6
+ apiKeyIndex: z.number(),
7
+ messageToSign: z.string(),
8
+ txInfo: z.string()
9
+ });
10
+ const SubmitChangePubKeyResult = z.object({
11
+ txHash: z.string()
12
+ });
13
+ const PrepareApproveIntegratorResult = z.object({
14
+ messageToSign: z.string(),
15
+ txInfo: z.string()
16
+ });
17
+ const SubmitApproveIntegratorResult = z.object({
18
+ txHash: z.string()
19
+ });
20
+ const CreateAuthTokenResult = z.object({
21
+ token: z.string()
22
+ });
23
+
24
+ export { CreateApiKeyWithMessageResult, CreateAuthTokenResult, PrepareApproveIntegratorResult, SubmitApproveIntegratorResult, SubmitChangePubKeyResult };
@@ -5,6 +5,10 @@ import { z } from 'zod';
5
5
  declare const HyperliquidMetadata: z.ZodObject<{
6
6
  agentWalletAddress: z.ZodString;
7
7
  isSubaccount: z.ZodBoolean;
8
+ mainAccountAddress: z.ZodString;
9
+ }, z.core.$strip>;
10
+ declare const LighterMetadata: z.ZodObject<{
11
+ l1_address: z.ZodString;
8
12
  }, z.core.$strip>;
9
13
  export declare const TradeAccount: z.ZodObject<{
10
14
  id: z.ZodUUID;
@@ -20,6 +24,9 @@ export declare const TradeAccount: z.ZodObject<{
20
24
  metadata: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
21
25
  agentWalletAddress: z.ZodString;
22
26
  isSubaccount: z.ZodBoolean;
27
+ mainAccountAddress: z.ZodString;
28
+ }, z.core.$strip>, z.ZodObject<{
29
+ l1_address: z.ZodString;
23
30
  }, z.core.$strip>]>>;
24
31
  createdAt: z.ZodString;
25
32
  updatedAt: z.ZodString;
@@ -27,4 +34,5 @@ export declare const TradeAccount: z.ZodObject<{
27
34
  }, z.core.$strip>;
28
35
  export type TradeAccount = z.infer<typeof TradeAccount>;
29
36
  export type HyperliquidMetadata = z.infer<typeof HyperliquidMetadata>;
37
+ export type LighterMetadata = z.infer<typeof LighterMetadata>;
30
38
  export {};
@@ -3,9 +3,13 @@ import { Connector } from '../connector';
3
3
 
4
4
  const HyperliquidMetadata = z.object({
5
5
  agentWalletAddress: z.string(),
6
- isSubaccount: z.boolean()
6
+ isSubaccount: z.boolean(),
7
+ mainAccountAddress: z.string()
7
8
  });
8
- const ConnectorMetadata = z.union([HyperliquidMetadata]).optional();
9
+ const LighterMetadata = z.object({
10
+ l1_address: z.string()
11
+ });
12
+ const ConnectorMetadata = z.union([HyperliquidMetadata, LighterMetadata]).optional();
9
13
  const TradeAccount = z.object({
10
14
  id: z.uuid().describe("Trade account UUID"),
11
15
  alias: z.string().describe("User-defined trade account alias"),
@@ -11,6 +11,7 @@ declare const CreateHyperliquidCredentials: z.ZodObject<{
11
11
  declare const CreateHyperliquidMetadata: z.ZodObject<{
12
12
  agentWalletAddress: z.ZodString;
13
13
  isSubaccount: z.ZodBoolean;
14
+ mainAccountAddress: z.ZodString;
14
15
  }, z.core.$strip>;
15
16
  declare const CreateBinanceCredentials: z.ZodObject<{
16
17
  read: z.ZodObject<{
@@ -37,6 +38,19 @@ declare const CreateOkxCredentials: z.ZodObject<{
37
38
  api_secret: z.ZodString;
38
39
  api_pass: z.ZodString;
39
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.ZodString;
53
+ }, z.core.$strip>;
40
54
  /**
41
55
  * Payload to create a new trade account
42
56
  */
@@ -50,6 +64,7 @@ export declare const CreateTradeAccount: z.ZodDiscriminatedUnion<[z.ZodObject<{
50
64
  metadata: z.ZodObject<{
51
65
  agentWalletAddress: z.ZodString;
52
66
  isSubaccount: z.ZodBoolean;
67
+ mainAccountAddress: z.ZodString;
53
68
  }, z.core.$strip>;
54
69
  }, z.core.$strip>, z.ZodObject<{
55
70
  connector: z.ZodLiteral<"binance">;
@@ -82,6 +97,17 @@ export declare const CreateTradeAccount: z.ZodDiscriminatedUnion<[z.ZodObject<{
82
97
  api_pass: z.ZodString;
83
98
  }, z.core.$strip>;
84
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.ZodString;
110
+ }, z.core.$strip>;
85
111
  }, z.core.$strip>], "connector">;
86
112
  /**
87
113
  * Payload to update a trade account
@@ -95,6 +121,7 @@ export declare const UpdateTradeAccount: z.ZodDiscriminatedUnion<[z.ZodObject<{
95
121
  metadata: z.ZodOptional<z.ZodObject<{
96
122
  agentWalletAddress: z.ZodString;
97
123
  isSubaccount: z.ZodBoolean;
124
+ mainAccountAddress: z.ZodString;
98
125
  }, z.core.$strip>>;
99
126
  }, z.core.$strip>, z.ZodObject<{
100
127
  connector: z.ZodLiteral<"binance">;
@@ -127,12 +154,24 @@ export declare const UpdateTradeAccount: z.ZodDiscriminatedUnion<[z.ZodObject<{
127
154
  api_pass: z.ZodString;
128
155
  }, z.core.$strip>>;
129
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.ZodString;
166
+ }, z.core.$strip>>;
130
167
  }, z.core.$strip>], "connector">;
131
168
  export type CreateHyperliquidCredentials = z.infer<typeof CreateHyperliquidCredentials>;
132
169
  export type CreateHyperliquidMetadata = z.infer<typeof CreateHyperliquidMetadata>;
133
170
  export type CreateBinanceCredentials = z.infer<typeof CreateBinanceCredentials>;
134
171
  export type CreateBybitCredentials = z.infer<typeof CreateBybitCredentials>;
135
172
  export type CreateOkxCredentials = z.infer<typeof CreateOkxCredentials>;
173
+ export type CreateLighterCredentials = z.infer<typeof CreateLighterCredentials>;
174
+ export type CreateLighterMetadata = z.infer<typeof CreateLighterMetadata>;
136
175
  export type CreateTradeAccountInput = z.input<typeof CreateTradeAccount>;
137
176
  export type CreateTradeAccount = z.output<typeof CreateTradeAccount>;
138
177
  export type UpdateTradeAccountInput = z.input<typeof UpdateTradeAccount>;
@@ -5,7 +5,8 @@ const CreateHyperliquidCredentials = z.object({
5
5
  });
6
6
  const CreateHyperliquidMetadata = z.object({
7
7
  agentWalletAddress: z.string().regex(/^0x[a-fA-F0-9]{40}$/, "Invalid Ethereum address"),
8
- isSubaccount: z.boolean()
8
+ isSubaccount: z.boolean(),
9
+ mainAccountAddress: z.string().regex(/^0x[a-fA-F0-9]{40}$/, "Invalid Ethereum address")
9
10
  });
10
11
  const BinanceApiKeyPair = z.object({
11
12
  api_key: z.string().min(1, "API key is required"),
@@ -24,6 +25,13 @@ const CreateOkxCredentials = z.object({
24
25
  api_secret: z.string().min(1, "API secret is required"),
25
26
  api_pass: z.string().min(1, "API passphrase is required")
26
27
  });
28
+ const CreateLighterCredentials = z.object({
29
+ api_private_key: z.string().min(1, "API private key is required"),
30
+ 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")
31
+ });
32
+ const CreateLighterMetadata = z.object({
33
+ l1_address: z.string().regex(/^0x[a-fA-F0-9]{40}$/, "Invalid Ethereum address")
34
+ });
27
35
  const AccountAlias = z.string().min(1, "Alias is required").max(100, "Alias must be 100 characters or less");
28
36
  const CreateHyperliquidAccount = z.object({
29
37
  connector: z.literal("hyperliquid"),
@@ -50,6 +58,13 @@ const CreateOkxAccount = z.object({
50
58
  credentials: CreateOkxCredentials,
51
59
  metadata: z.void({}).transform(() => void 0)
52
60
  });
61
+ const CreateLighterAccount = z.object({
62
+ connector: z.literal("lighter"),
63
+ alias: AccountAlias,
64
+ exchangeIdentifier: z.string().regex(/^\d+$/, "Exchange identifier must be the numeric Lighter account index"),
65
+ credentials: CreateLighterCredentials,
66
+ metadata: CreateLighterMetadata
67
+ });
53
68
  const UpdateHyperliquidAccount = z.object({
54
69
  connector: z.literal("hyperliquid"),
55
70
  alias: AccountAlias.optional(),
@@ -74,17 +89,25 @@ const UpdateOkxAccount = z.object({
74
89
  credentials: CreateOkxCredentials.optional(),
75
90
  metadata: z.void({}).transform(() => void 0)
76
91
  });
92
+ const UpdateLighterAccount = z.object({
93
+ connector: z.literal("lighter"),
94
+ alias: AccountAlias.optional(),
95
+ credentials: CreateLighterCredentials.optional(),
96
+ metadata: CreateLighterMetadata.optional()
97
+ });
77
98
  const CreateTradeAccount = z.discriminatedUnion("connector", [
78
99
  CreateHyperliquidAccount,
79
100
  CreateBinanceAccount,
80
101
  CreateBybitAccount,
81
- CreateOkxAccount
102
+ CreateOkxAccount,
103
+ CreateLighterAccount
82
104
  ]);
83
105
  const UpdateTradeAccount = z.discriminatedUnion("connector", [
84
106
  UpdateHyperliquidAccount,
85
107
  UpdateBinanceAccount,
86
108
  UpdateBybitAccount,
87
- UpdateOkxAccount
109
+ UpdateOkxAccount,
110
+ UpdateLighterAccount
88
111
  ]);
89
112
 
90
113
  export { CreateTradeAccount, UpdateTradeAccount };
@@ -14,6 +14,9 @@ export declare const TradeAccountResponse: z.ZodObject<{
14
14
  metadata: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
15
15
  agentWalletAddress: z.ZodString;
16
16
  isSubaccount: z.ZodBoolean;
17
+ mainAccountAddress: z.ZodString;
18
+ }, z.core.$strip>, z.ZodObject<{
19
+ l1_address: z.ZodString;
17
20
  }, z.core.$strip>]>>;
18
21
  createdAt: z.ZodString;
19
22
  updatedAt: z.ZodString;
@@ -36,6 +39,9 @@ export declare const TradeAccountListResponse: z.ZodObject<{
36
39
  metadata: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
37
40
  agentWalletAddress: z.ZodString;
38
41
  isSubaccount: z.ZodBoolean;
42
+ mainAccountAddress: z.ZodString;
43
+ }, z.core.$strip>, z.ZodObject<{
44
+ l1_address: z.ZodString;
39
45
  }, z.core.$strip>]>>;
40
46
  createdAt: z.ZodString;
41
47
  updatedAt: z.ZodString;
@@ -73,5 +79,11 @@ export declare const ExchangeCredentialsResponse: z.ZodDiscriminatedUnion<[z.Zod
73
79
  api_secret: z.ZodString;
74
80
  api_pass: z.ZodString;
75
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>;
76
88
  }, z.core.$strip>], "connector">;
77
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 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pear-protocol/types",
3
- "version": "0.0.14",
3
+ "version": "0.0.16",
4
4
  "description": "Pear Protocol Types definitions",
5
5
  "private": false,
6
6
  "type": "module",