@pear-protocol/types 0.0.19 → 0.0.20
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/bundle.js +1 -0
- package/dist/rebalance/index.d.ts +2 -0
- package/dist/rebalance/index.js +2 -0
- package/dist/rebalance/payloads.d.ts +11 -0
- package/dist/rebalance/payloads.js +16 -0
- package/dist/rebalance/responses.d.ts +10 -0
- package/dist/rebalance/responses.js +15 -0
- package/dist/trade-accounts/response.d.ts +110 -0
- package/dist/trade-accounts/response.js +5 -0
- package/package.json +1 -1
package/dist/bundle.d.ts
CHANGED
package/dist/bundle.js
CHANGED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const RebalanceManually: z.ZodObject<{
|
|
3
|
+
orderType: z.ZodEnum<{
|
|
4
|
+
MARKET: "MARKET";
|
|
5
|
+
}>;
|
|
6
|
+
weightings: z.ZodArray<z.ZodObject<{
|
|
7
|
+
symbol: z.ZodString;
|
|
8
|
+
weight: z.ZodNumber;
|
|
9
|
+
}, z.core.$strip>>;
|
|
10
|
+
}, z.core.$strip>;
|
|
11
|
+
export type RebalanceManually = z.output<typeof RebalanceManually>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { RefineWeightingSum, RefineUniqueSymbols } from '../common/refinement';
|
|
3
|
+
import { ExecutionOrderType } from '../execution';
|
|
4
|
+
import { InstrumentId } from '../instrument';
|
|
5
|
+
|
|
6
|
+
const RebalanceManually = z.object({
|
|
7
|
+
orderType: ExecutionOrderType,
|
|
8
|
+
weightings: z.array(
|
|
9
|
+
z.object({
|
|
10
|
+
symbol: InstrumentId,
|
|
11
|
+
weight: z.number().positive({ message: "Weight must be greater than 0" }).max(1, { message: "Weight must be less than 1" })
|
|
12
|
+
})
|
|
13
|
+
).superRefine(RefineWeightingSum).superRefine(RefineUniqueSymbols).describe("Array of weightings to rebalance the position")
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
export { RebalanceManually };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const RebalanceManuallyResponse: z.ZodObject<{
|
|
3
|
+
plan: z.ZodUnion<readonly [z.ZodObject<{
|
|
4
|
+
outcome: z.ZodLiteral<"full_rebalance">;
|
|
5
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
6
|
+
outcome: z.ZodUnion<readonly [z.ZodLiteral<"partial_rebalance">, z.ZodLiteral<"no_rebalance">]>;
|
|
7
|
+
messages: z.ZodTuple<[z.ZodString], z.ZodString>;
|
|
8
|
+
}, z.core.$strip>]>;
|
|
9
|
+
}, z.core.$strip>;
|
|
10
|
+
export type RebalanceManuallyResponse = z.output<typeof RebalanceManuallyResponse>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
const RebalanceManuallyResponse = z.object({
|
|
4
|
+
plan: z.union([
|
|
5
|
+
z.object({
|
|
6
|
+
outcome: z.literal("full_rebalance")
|
|
7
|
+
}),
|
|
8
|
+
z.object({
|
|
9
|
+
outcome: z.union([z.literal("partial_rebalance"), z.literal("no_rebalance")]),
|
|
10
|
+
messages: z.tuple([z.string()]).rest(z.string())
|
|
11
|
+
})
|
|
12
|
+
])
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
export { RebalanceManuallyResponse };
|
|
@@ -51,11 +51,55 @@ export declare const TradeAccountListResponse: z.ZodObject<{
|
|
|
51
51
|
export type TradeAccountListResponse = z.infer<typeof TradeAccountListResponse>;
|
|
52
52
|
export declare const ExchangeCredentialsResponse: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
53
53
|
connector: z.ZodLiteral<"hyperliquid">;
|
|
54
|
+
account: z.ZodObject<{
|
|
55
|
+
id: z.ZodUUID;
|
|
56
|
+
alias: z.ZodString;
|
|
57
|
+
connector: z.ZodEnum<{
|
|
58
|
+
hyperliquid: "hyperliquid";
|
|
59
|
+
binance: "binance";
|
|
60
|
+
bybit: "bybit";
|
|
61
|
+
okx: "okx";
|
|
62
|
+
lighter: "lighter";
|
|
63
|
+
}>;
|
|
64
|
+
exchangeIdentifier: z.ZodString;
|
|
65
|
+
metadata: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
66
|
+
agentWalletAddress: z.ZodString;
|
|
67
|
+
isSubaccount: z.ZodBoolean;
|
|
68
|
+
mainAccountAddress: z.ZodString;
|
|
69
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
70
|
+
l1_address: z.ZodString;
|
|
71
|
+
}, z.core.$strip>]>>;
|
|
72
|
+
createdAt: z.ZodString;
|
|
73
|
+
updatedAt: z.ZodString;
|
|
74
|
+
deletedAt: z.ZodOptional<z.ZodString>;
|
|
75
|
+
}, z.core.$strip>;
|
|
54
76
|
credentials: z.ZodObject<{
|
|
55
77
|
signer_key: z.ZodString;
|
|
56
78
|
}, z.core.$strip>;
|
|
57
79
|
}, z.core.$strip>, z.ZodObject<{
|
|
58
80
|
connector: z.ZodLiteral<"binance">;
|
|
81
|
+
account: z.ZodObject<{
|
|
82
|
+
id: z.ZodUUID;
|
|
83
|
+
alias: z.ZodString;
|
|
84
|
+
connector: z.ZodEnum<{
|
|
85
|
+
hyperliquid: "hyperliquid";
|
|
86
|
+
binance: "binance";
|
|
87
|
+
bybit: "bybit";
|
|
88
|
+
okx: "okx";
|
|
89
|
+
lighter: "lighter";
|
|
90
|
+
}>;
|
|
91
|
+
exchangeIdentifier: z.ZodString;
|
|
92
|
+
metadata: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
93
|
+
agentWalletAddress: z.ZodString;
|
|
94
|
+
isSubaccount: z.ZodBoolean;
|
|
95
|
+
mainAccountAddress: z.ZodString;
|
|
96
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
97
|
+
l1_address: z.ZodString;
|
|
98
|
+
}, z.core.$strip>]>>;
|
|
99
|
+
createdAt: z.ZodString;
|
|
100
|
+
updatedAt: z.ZodString;
|
|
101
|
+
deletedAt: z.ZodOptional<z.ZodString>;
|
|
102
|
+
}, z.core.$strip>;
|
|
59
103
|
credentials: z.ZodObject<{
|
|
60
104
|
read: z.ZodObject<{
|
|
61
105
|
api_key: z.ZodString;
|
|
@@ -68,12 +112,56 @@ export declare const ExchangeCredentialsResponse: z.ZodDiscriminatedUnion<[z.Zod
|
|
|
68
112
|
}, z.core.$strip>;
|
|
69
113
|
}, z.core.$strip>, z.ZodObject<{
|
|
70
114
|
connector: z.ZodLiteral<"bybit">;
|
|
115
|
+
account: z.ZodObject<{
|
|
116
|
+
id: z.ZodUUID;
|
|
117
|
+
alias: z.ZodString;
|
|
118
|
+
connector: z.ZodEnum<{
|
|
119
|
+
hyperliquid: "hyperliquid";
|
|
120
|
+
binance: "binance";
|
|
121
|
+
bybit: "bybit";
|
|
122
|
+
okx: "okx";
|
|
123
|
+
lighter: "lighter";
|
|
124
|
+
}>;
|
|
125
|
+
exchangeIdentifier: z.ZodString;
|
|
126
|
+
metadata: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
127
|
+
agentWalletAddress: z.ZodString;
|
|
128
|
+
isSubaccount: z.ZodBoolean;
|
|
129
|
+
mainAccountAddress: z.ZodString;
|
|
130
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
131
|
+
l1_address: z.ZodString;
|
|
132
|
+
}, z.core.$strip>]>>;
|
|
133
|
+
createdAt: z.ZodString;
|
|
134
|
+
updatedAt: z.ZodString;
|
|
135
|
+
deletedAt: z.ZodOptional<z.ZodString>;
|
|
136
|
+
}, z.core.$strip>;
|
|
71
137
|
credentials: z.ZodObject<{
|
|
72
138
|
api_key: z.ZodString;
|
|
73
139
|
api_secret: z.ZodString;
|
|
74
140
|
}, z.core.$strip>;
|
|
75
141
|
}, z.core.$strip>, z.ZodObject<{
|
|
76
142
|
connector: z.ZodLiteral<"okx">;
|
|
143
|
+
account: z.ZodObject<{
|
|
144
|
+
id: z.ZodUUID;
|
|
145
|
+
alias: z.ZodString;
|
|
146
|
+
connector: z.ZodEnum<{
|
|
147
|
+
hyperliquid: "hyperliquid";
|
|
148
|
+
binance: "binance";
|
|
149
|
+
bybit: "bybit";
|
|
150
|
+
okx: "okx";
|
|
151
|
+
lighter: "lighter";
|
|
152
|
+
}>;
|
|
153
|
+
exchangeIdentifier: z.ZodString;
|
|
154
|
+
metadata: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
155
|
+
agentWalletAddress: z.ZodString;
|
|
156
|
+
isSubaccount: z.ZodBoolean;
|
|
157
|
+
mainAccountAddress: z.ZodString;
|
|
158
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
159
|
+
l1_address: z.ZodString;
|
|
160
|
+
}, z.core.$strip>]>>;
|
|
161
|
+
createdAt: z.ZodString;
|
|
162
|
+
updatedAt: z.ZodString;
|
|
163
|
+
deletedAt: z.ZodOptional<z.ZodString>;
|
|
164
|
+
}, z.core.$strip>;
|
|
77
165
|
credentials: z.ZodObject<{
|
|
78
166
|
api_key: z.ZodString;
|
|
79
167
|
api_secret: z.ZodString;
|
|
@@ -81,6 +169,28 @@ export declare const ExchangeCredentialsResponse: z.ZodDiscriminatedUnion<[z.Zod
|
|
|
81
169
|
}, z.core.$strip>;
|
|
82
170
|
}, z.core.$strip>, z.ZodObject<{
|
|
83
171
|
connector: z.ZodLiteral<"lighter">;
|
|
172
|
+
account: z.ZodObject<{
|
|
173
|
+
id: z.ZodUUID;
|
|
174
|
+
alias: z.ZodString;
|
|
175
|
+
connector: z.ZodEnum<{
|
|
176
|
+
hyperliquid: "hyperliquid";
|
|
177
|
+
binance: "binance";
|
|
178
|
+
bybit: "bybit";
|
|
179
|
+
okx: "okx";
|
|
180
|
+
lighter: "lighter";
|
|
181
|
+
}>;
|
|
182
|
+
exchangeIdentifier: z.ZodString;
|
|
183
|
+
metadata: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
184
|
+
agentWalletAddress: z.ZodString;
|
|
185
|
+
isSubaccount: z.ZodBoolean;
|
|
186
|
+
mainAccountAddress: z.ZodString;
|
|
187
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
188
|
+
l1_address: z.ZodString;
|
|
189
|
+
}, z.core.$strip>]>>;
|
|
190
|
+
createdAt: z.ZodString;
|
|
191
|
+
updatedAt: z.ZodString;
|
|
192
|
+
deletedAt: z.ZodOptional<z.ZodString>;
|
|
193
|
+
}, z.core.$strip>;
|
|
84
194
|
credentials: z.ZodObject<{
|
|
85
195
|
api_private_key: z.ZodString;
|
|
86
196
|
api_key_index: z.ZodNumber;
|
|
@@ -5,6 +5,7 @@ const TradeAccountResponse = z.object({ account: TradeAccount });
|
|
|
5
5
|
const TradeAccountListResponse = z.object({ accounts: z.array(TradeAccount) });
|
|
6
6
|
const HyperliquidCredentialsResponse = z.object({
|
|
7
7
|
connector: z.literal("hyperliquid"),
|
|
8
|
+
account: TradeAccount,
|
|
8
9
|
credentials: z.object({
|
|
9
10
|
signer_key: z.string()
|
|
10
11
|
})
|
|
@@ -15,6 +16,7 @@ const BinanceApiKeyPairResponse = z.object({
|
|
|
15
16
|
});
|
|
16
17
|
const BinanceCredentialsResponse = z.object({
|
|
17
18
|
connector: z.literal("binance"),
|
|
19
|
+
account: TradeAccount,
|
|
18
20
|
credentials: z.object({
|
|
19
21
|
read: BinanceApiKeyPairResponse,
|
|
20
22
|
write: BinanceApiKeyPairResponse
|
|
@@ -22,6 +24,7 @@ const BinanceCredentialsResponse = z.object({
|
|
|
22
24
|
});
|
|
23
25
|
const BybitCredentialsResponse = z.object({
|
|
24
26
|
connector: z.literal("bybit"),
|
|
27
|
+
account: TradeAccount,
|
|
25
28
|
credentials: z.object({
|
|
26
29
|
api_key: z.string(),
|
|
27
30
|
api_secret: z.string()
|
|
@@ -29,6 +32,7 @@ const BybitCredentialsResponse = z.object({
|
|
|
29
32
|
});
|
|
30
33
|
const OkxCredentialsResponse = z.object({
|
|
31
34
|
connector: z.literal("okx"),
|
|
35
|
+
account: TradeAccount,
|
|
32
36
|
credentials: z.object({
|
|
33
37
|
api_key: z.string(),
|
|
34
38
|
api_secret: z.string(),
|
|
@@ -37,6 +41,7 @@ const OkxCredentialsResponse = z.object({
|
|
|
37
41
|
});
|
|
38
42
|
const LighterCredentialsResponse = z.object({
|
|
39
43
|
connector: z.literal("lighter"),
|
|
44
|
+
account: TradeAccount,
|
|
40
45
|
credentials: z.object({
|
|
41
46
|
api_private_key: z.string(),
|
|
42
47
|
api_key_index: z.number()
|