@pear-protocol/types 0.0.15 → 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.
- package/dist/connector/index.d.ts +4 -1
- package/dist/misc/index.d.ts +2 -0
- 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/trade-accounts/entities.d.ts +6 -0
- package/dist/trade-accounts/entities.js +4 -1
- package/dist/trade-accounts/payloads.d.ts +36 -0
- package/dist/trade-accounts/payloads.js +24 -2
- package/dist/trade-accounts/response.d.ts +10 -0
- package/dist/trade-accounts/response.js +9 -1
- package/package.json +1 -1
|
@@ -27,7 +27,10 @@ export type OkxCredentialsDTO = {
|
|
|
27
27
|
api_secret: string;
|
|
28
28
|
api_pass: string;
|
|
29
29
|
};
|
|
30
|
-
export type LighterCredentialsDTO =
|
|
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;
|
package/dist/misc/index.d.ts
CHANGED
package/dist/misc/index.js
CHANGED
|
@@ -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 };
|
|
@@ -7,6 +7,9 @@ declare const HyperliquidMetadata: z.ZodObject<{
|
|
|
7
7
|
isSubaccount: z.ZodBoolean;
|
|
8
8
|
mainAccountAddress: z.ZodString;
|
|
9
9
|
}, z.core.$strip>;
|
|
10
|
+
declare const LighterMetadata: z.ZodObject<{
|
|
11
|
+
l1_address: z.ZodString;
|
|
12
|
+
}, z.core.$strip>;
|
|
10
13
|
export declare const TradeAccount: z.ZodObject<{
|
|
11
14
|
id: z.ZodUUID;
|
|
12
15
|
alias: z.ZodString;
|
|
@@ -22,6 +25,8 @@ export declare const TradeAccount: z.ZodObject<{
|
|
|
22
25
|
agentWalletAddress: z.ZodString;
|
|
23
26
|
isSubaccount: z.ZodBoolean;
|
|
24
27
|
mainAccountAddress: z.ZodString;
|
|
28
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
29
|
+
l1_address: z.ZodString;
|
|
25
30
|
}, z.core.$strip>]>>;
|
|
26
31
|
createdAt: z.ZodString;
|
|
27
32
|
updatedAt: z.ZodString;
|
|
@@ -29,4 +34,5 @@ export declare const TradeAccount: z.ZodObject<{
|
|
|
29
34
|
}, z.core.$strip>;
|
|
30
35
|
export type TradeAccount = z.infer<typeof TradeAccount>;
|
|
31
36
|
export type HyperliquidMetadata = z.infer<typeof HyperliquidMetadata>;
|
|
37
|
+
export type LighterMetadata = z.infer<typeof LighterMetadata>;
|
|
32
38
|
export {};
|
|
@@ -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"),
|
|
@@ -38,6 +38,19 @@ 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.ZodString;
|
|
53
|
+
}, z.core.$strip>;
|
|
41
54
|
/**
|
|
42
55
|
* Payload to create a new trade account
|
|
43
56
|
*/
|
|
@@ -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.ZodString;
|
|
110
|
+
}, z.core.$strip>;
|
|
87
111
|
}, z.core.$strip>], "connector">;
|
|
88
112
|
/**
|
|
89
113
|
* Payload to update a trade account
|
|
@@ -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.ZodString;
|
|
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>;
|
|
@@ -25,6 +25,13 @@ const CreateOkxCredentials = z.object({
|
|
|
25
25
|
api_secret: z.string().min(1, "API secret is required"),
|
|
26
26
|
api_pass: z.string().min(1, "API passphrase is required")
|
|
27
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
|
+
});
|
|
28
35
|
const AccountAlias = z.string().min(1, "Alias is required").max(100, "Alias must be 100 characters or less");
|
|
29
36
|
const CreateHyperliquidAccount = z.object({
|
|
30
37
|
connector: z.literal("hyperliquid"),
|
|
@@ -51,6 +58,13 @@ const CreateOkxAccount = z.object({
|
|
|
51
58
|
credentials: CreateOkxCredentials,
|
|
52
59
|
metadata: z.void({}).transform(() => void 0)
|
|
53
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
|
+
});
|
|
54
68
|
const UpdateHyperliquidAccount = z.object({
|
|
55
69
|
connector: z.literal("hyperliquid"),
|
|
56
70
|
alias: AccountAlias.optional(),
|
|
@@ -75,17 +89,25 @@ const UpdateOkxAccount = z.object({
|
|
|
75
89
|
credentials: CreateOkxCredentials.optional(),
|
|
76
90
|
metadata: z.void({}).transform(() => void 0)
|
|
77
91
|
});
|
|
92
|
+
const UpdateLighterAccount = z.object({
|
|
93
|
+
connector: z.literal("lighter"),
|
|
94
|
+
alias: AccountAlias.optional(),
|
|
95
|
+
credentials: CreateLighterCredentials.optional(),
|
|
96
|
+
metadata: CreateLighterMetadata.optional()
|
|
97
|
+
});
|
|
78
98
|
const CreateTradeAccount = z.discriminatedUnion("connector", [
|
|
79
99
|
CreateHyperliquidAccount,
|
|
80
100
|
CreateBinanceAccount,
|
|
81
101
|
CreateBybitAccount,
|
|
82
|
-
CreateOkxAccount
|
|
102
|
+
CreateOkxAccount,
|
|
103
|
+
CreateLighterAccount
|
|
83
104
|
]);
|
|
84
105
|
const UpdateTradeAccount = z.discriminatedUnion("connector", [
|
|
85
106
|
UpdateHyperliquidAccount,
|
|
86
107
|
UpdateBinanceAccount,
|
|
87
108
|
UpdateBybitAccount,
|
|
88
|
-
UpdateOkxAccount
|
|
109
|
+
UpdateOkxAccount,
|
|
110
|
+
UpdateLighterAccount
|
|
89
111
|
]);
|
|
90
112
|
|
|
91
113
|
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 };
|