@upshiftfinance/config 0.0.0-stage → 0.1.2
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/LICENSE +21 -0
- package/README.md +52 -2
- package/lib/config.d.ts +44 -0
- package/lib/config.js +80 -0
- package/lib/env.d.ts +3 -0
- package/lib/env.js +34 -0
- package/lib/errors.d.ts +6 -0
- package/lib/errors.js +15 -0
- package/lib/index.d.ts +11 -0
- package/lib/index.js +51 -0
- package/lib/keystore.d.ts +37 -0
- package/lib/keystore.js +179 -0
- package/lib/paths.d.ts +6 -0
- package/lib/paths.js +34 -0
- package/lib/precedence.d.ts +11 -0
- package/lib/precedence.js +70 -0
- package/lib/profile.d.ts +26 -0
- package/lib/profile.js +65 -0
- package/lib/schemas/activity.d.ts +569 -0
- package/lib/schemas/activity.js +67 -0
- package/lib/schemas/curator.d.ts +29 -0
- package/lib/schemas/curator.js +19 -0
- package/lib/schemas/dashboard.d.ts +12 -0
- package/lib/schemas/dashboard.js +11 -0
- package/lib/schemas/data.d.ts +629 -0
- package/lib/schemas/data.js +116 -0
- package/lib/schemas/envelope.d.ts +155 -0
- package/lib/schemas/envelope.js +34 -0
- package/lib/schemas/governance.d.ts +58 -0
- package/lib/schemas/governance.js +31 -0
- package/lib/schemas/index.d.ts +15 -0
- package/lib/schemas/index.js +32 -0
- package/lib/schemas/layerzero.d.ts +26 -0
- package/lib/schemas/layerzero.js +19 -0
- package/lib/schemas/meta.d.ts +115 -0
- package/lib/schemas/meta.js +34 -0
- package/lib/schemas/otc.d.ts +23 -0
- package/lib/schemas/otc.js +17 -0
- package/lib/schemas/reads.d.ts +79 -0
- package/lib/schemas/reads.js +46 -0
- package/lib/schemas/risk.d.ts +46 -0
- package/lib/schemas/risk.js +27 -0
- package/lib/schemas/subaccounts.d.ts +112 -0
- package/lib/schemas/subaccounts.js +64 -0
- package/lib/schemas/triage.d.ts +21 -0
- package/lib/schemas/triage.js +14 -0
- package/lib/schemas/user.d.ts +133 -0
- package/lib/schemas/user.js +48 -0
- package/lib/schemas/vault.d.ts +274 -0
- package/lib/schemas/vault.js +112 -0
- package/lib/sdk.d.ts +14 -0
- package/lib/sdk.js +114 -0
- package/lib/session.d.ts +8 -0
- package/lib/session.js +76 -0
- package/lib/vaults.d.ts +8 -0
- package/lib/vaults.js +44 -0
- package/package.json +52 -3
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const VaultGetSchema: z.ZodObject<{
|
|
3
|
+
address: z.ZodString;
|
|
4
|
+
chainId: z.ZodNumber;
|
|
5
|
+
name: z.ZodOptional<z.ZodString>;
|
|
6
|
+
symbol: z.ZodOptional<z.ZodString>;
|
|
7
|
+
decimals: z.ZodOptional<z.ZodNumber>;
|
|
8
|
+
underlying: z.ZodOptional<z.ZodObject<{
|
|
9
|
+
address: z.ZodOptional<z.ZodString>;
|
|
10
|
+
symbol: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
11
|
+
decimals: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
|
|
12
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
13
|
+
address: z.ZodOptional<z.ZodString>;
|
|
14
|
+
symbol: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
15
|
+
decimals: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
|
|
16
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
17
|
+
address: z.ZodOptional<z.ZodString>;
|
|
18
|
+
symbol: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
19
|
+
decimals: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
|
|
20
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
21
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
22
|
+
address: z.ZodString;
|
|
23
|
+
chainId: z.ZodNumber;
|
|
24
|
+
name: z.ZodOptional<z.ZodString>;
|
|
25
|
+
symbol: z.ZodOptional<z.ZodString>;
|
|
26
|
+
decimals: z.ZodOptional<z.ZodNumber>;
|
|
27
|
+
underlying: z.ZodOptional<z.ZodObject<{
|
|
28
|
+
address: z.ZodOptional<z.ZodString>;
|
|
29
|
+
symbol: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
30
|
+
decimals: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
|
|
31
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
32
|
+
address: z.ZodOptional<z.ZodString>;
|
|
33
|
+
symbol: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
34
|
+
decimals: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
|
|
35
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
36
|
+
address: z.ZodOptional<z.ZodString>;
|
|
37
|
+
symbol: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
38
|
+
decimals: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
|
|
39
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
40
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
41
|
+
address: z.ZodString;
|
|
42
|
+
chainId: z.ZodNumber;
|
|
43
|
+
name: z.ZodOptional<z.ZodString>;
|
|
44
|
+
symbol: z.ZodOptional<z.ZodString>;
|
|
45
|
+
decimals: z.ZodOptional<z.ZodNumber>;
|
|
46
|
+
underlying: z.ZodOptional<z.ZodObject<{
|
|
47
|
+
address: z.ZodOptional<z.ZodString>;
|
|
48
|
+
symbol: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
49
|
+
decimals: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
|
|
50
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
51
|
+
address: z.ZodOptional<z.ZodString>;
|
|
52
|
+
symbol: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
53
|
+
decimals: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
|
|
54
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
55
|
+
address: z.ZodOptional<z.ZodString>;
|
|
56
|
+
symbol: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
57
|
+
decimals: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
|
|
58
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
59
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
60
|
+
export type VaultGet = z.infer<typeof VaultGetSchema>;
|
|
61
|
+
export declare const VaultApySchema: z.ZodObject<{
|
|
62
|
+
address: z.ZodString;
|
|
63
|
+
chainId: z.ZodNumber;
|
|
64
|
+
currentApy: z.ZodOptional<z.ZodNumber>;
|
|
65
|
+
annualizedApy: z.ZodOptional<z.ZodNumber>;
|
|
66
|
+
asOf: z.ZodOptional<z.ZodString>;
|
|
67
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
68
|
+
address: z.ZodString;
|
|
69
|
+
chainId: z.ZodNumber;
|
|
70
|
+
currentApy: z.ZodOptional<z.ZodNumber>;
|
|
71
|
+
annualizedApy: z.ZodOptional<z.ZodNumber>;
|
|
72
|
+
asOf: z.ZodOptional<z.ZodString>;
|
|
73
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
74
|
+
address: z.ZodString;
|
|
75
|
+
chainId: z.ZodNumber;
|
|
76
|
+
currentApy: z.ZodOptional<z.ZodNumber>;
|
|
77
|
+
annualizedApy: z.ZodOptional<z.ZodNumber>;
|
|
78
|
+
asOf: z.ZodOptional<z.ZodString>;
|
|
79
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
80
|
+
export type VaultApy = z.infer<typeof VaultApySchema>;
|
|
81
|
+
export declare const VaultTvlSchema: z.ZodObject<{
|
|
82
|
+
address: z.ZodString;
|
|
83
|
+
chainId: z.ZodNumber;
|
|
84
|
+
tvl: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
|
|
85
|
+
underlyingSymbol: z.ZodOptional<z.ZodString>;
|
|
86
|
+
asOf: z.ZodOptional<z.ZodString>;
|
|
87
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
88
|
+
address: z.ZodString;
|
|
89
|
+
chainId: z.ZodNumber;
|
|
90
|
+
tvl: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
|
|
91
|
+
underlyingSymbol: z.ZodOptional<z.ZodString>;
|
|
92
|
+
asOf: z.ZodOptional<z.ZodString>;
|
|
93
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
94
|
+
address: z.ZodString;
|
|
95
|
+
chainId: z.ZodNumber;
|
|
96
|
+
tvl: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
|
|
97
|
+
underlyingSymbol: z.ZodOptional<z.ZodString>;
|
|
98
|
+
asOf: z.ZodOptional<z.ZodString>;
|
|
99
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
100
|
+
export type VaultTvl = z.infer<typeof VaultTvlSchema>;
|
|
101
|
+
export declare const VaultPositionsSchema: z.ZodObject<{
|
|
102
|
+
address: z.ZodString;
|
|
103
|
+
chainId: z.ZodNumber;
|
|
104
|
+
user: z.ZodOptional<z.ZodString>;
|
|
105
|
+
positions: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
106
|
+
user: z.ZodString;
|
|
107
|
+
shares: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
|
|
108
|
+
assets: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
|
|
109
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
110
|
+
user: z.ZodString;
|
|
111
|
+
shares: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
|
|
112
|
+
assets: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
|
|
113
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
114
|
+
user: z.ZodString;
|
|
115
|
+
shares: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
|
|
116
|
+
assets: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
|
|
117
|
+
}, z.ZodTypeAny, "passthrough">>, "many">>;
|
|
118
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
119
|
+
address: z.ZodString;
|
|
120
|
+
chainId: z.ZodNumber;
|
|
121
|
+
user: z.ZodOptional<z.ZodString>;
|
|
122
|
+
positions: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
123
|
+
user: z.ZodString;
|
|
124
|
+
shares: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
|
|
125
|
+
assets: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
|
|
126
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
127
|
+
user: z.ZodString;
|
|
128
|
+
shares: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
|
|
129
|
+
assets: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
|
|
130
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
131
|
+
user: z.ZodString;
|
|
132
|
+
shares: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
|
|
133
|
+
assets: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
|
|
134
|
+
}, z.ZodTypeAny, "passthrough">>, "many">>;
|
|
135
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
136
|
+
address: z.ZodString;
|
|
137
|
+
chainId: z.ZodNumber;
|
|
138
|
+
user: z.ZodOptional<z.ZodString>;
|
|
139
|
+
positions: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
140
|
+
user: z.ZodString;
|
|
141
|
+
shares: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
|
|
142
|
+
assets: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
|
|
143
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
144
|
+
user: z.ZodString;
|
|
145
|
+
shares: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
|
|
146
|
+
assets: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
|
|
147
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
148
|
+
user: z.ZodString;
|
|
149
|
+
shares: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
|
|
150
|
+
assets: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
|
|
151
|
+
}, z.ZodTypeAny, "passthrough">>, "many">>;
|
|
152
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
153
|
+
export type VaultPositions = z.infer<typeof VaultPositionsSchema>;
|
|
154
|
+
export declare const VaultLoansSchema: z.ZodObject<{
|
|
155
|
+
address: z.ZodString;
|
|
156
|
+
chainId: z.ZodNumber;
|
|
157
|
+
loans: z.ZodDefault<z.ZodArray<z.ZodUnknown, "many">>;
|
|
158
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
159
|
+
address: z.ZodString;
|
|
160
|
+
chainId: z.ZodNumber;
|
|
161
|
+
loans: z.ZodDefault<z.ZodArray<z.ZodUnknown, "many">>;
|
|
162
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
163
|
+
address: z.ZodString;
|
|
164
|
+
chainId: z.ZodNumber;
|
|
165
|
+
loans: z.ZodDefault<z.ZodArray<z.ZodUnknown, "many">>;
|
|
166
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
167
|
+
export type VaultLoans = z.infer<typeof VaultLoansSchema>;
|
|
168
|
+
export declare const VaultAllocationsSchema: z.ZodObject<{
|
|
169
|
+
address: z.ZodString;
|
|
170
|
+
chainId: z.ZodNumber;
|
|
171
|
+
allocations: z.ZodDefault<z.ZodArray<z.ZodUnknown, "many">>;
|
|
172
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
173
|
+
address: z.ZodString;
|
|
174
|
+
chainId: z.ZodNumber;
|
|
175
|
+
allocations: z.ZodDefault<z.ZodArray<z.ZodUnknown, "many">>;
|
|
176
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
177
|
+
address: z.ZodString;
|
|
178
|
+
chainId: z.ZodNumber;
|
|
179
|
+
allocations: z.ZodDefault<z.ZodArray<z.ZodUnknown, "many">>;
|
|
180
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
181
|
+
export type VaultAllocations = z.infer<typeof VaultAllocationsSchema>;
|
|
182
|
+
export declare const VaultRedemptionsSchema: z.ZodObject<{
|
|
183
|
+
address: z.ZodString;
|
|
184
|
+
chainId: z.ZodNumber;
|
|
185
|
+
user: z.ZodOptional<z.ZodString>;
|
|
186
|
+
available: z.ZodDefault<z.ZodArray<z.ZodUnknown, "many">>;
|
|
187
|
+
history: z.ZodDefault<z.ZodArray<z.ZodUnknown, "many">>;
|
|
188
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
189
|
+
address: z.ZodString;
|
|
190
|
+
chainId: z.ZodNumber;
|
|
191
|
+
user: z.ZodOptional<z.ZodString>;
|
|
192
|
+
available: z.ZodDefault<z.ZodArray<z.ZodUnknown, "many">>;
|
|
193
|
+
history: z.ZodDefault<z.ZodArray<z.ZodUnknown, "many">>;
|
|
194
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
195
|
+
address: z.ZodString;
|
|
196
|
+
chainId: z.ZodNumber;
|
|
197
|
+
user: z.ZodOptional<z.ZodString>;
|
|
198
|
+
available: z.ZodDefault<z.ZodArray<z.ZodUnknown, "many">>;
|
|
199
|
+
history: z.ZodDefault<z.ZodArray<z.ZodUnknown, "many">>;
|
|
200
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
201
|
+
export type VaultRedemptions = z.infer<typeof VaultRedemptionsSchema>;
|
|
202
|
+
export declare const VaultHistorySchema: z.ZodObject<{
|
|
203
|
+
address: z.ZodString;
|
|
204
|
+
chainId: z.ZodNumber;
|
|
205
|
+
from: z.ZodOptional<z.ZodString>;
|
|
206
|
+
to: z.ZodOptional<z.ZodString>;
|
|
207
|
+
series: z.ZodDefault<z.ZodArray<z.ZodUnknown, "many">>;
|
|
208
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
209
|
+
address: z.ZodString;
|
|
210
|
+
chainId: z.ZodNumber;
|
|
211
|
+
from: z.ZodOptional<z.ZodString>;
|
|
212
|
+
to: z.ZodOptional<z.ZodString>;
|
|
213
|
+
series: z.ZodDefault<z.ZodArray<z.ZodUnknown, "many">>;
|
|
214
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
215
|
+
address: z.ZodString;
|
|
216
|
+
chainId: z.ZodNumber;
|
|
217
|
+
from: z.ZodOptional<z.ZodString>;
|
|
218
|
+
to: z.ZodOptional<z.ZodString>;
|
|
219
|
+
series: z.ZodDefault<z.ZodArray<z.ZodUnknown, "many">>;
|
|
220
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
221
|
+
export type VaultHistory = z.infer<typeof VaultHistorySchema>;
|
|
222
|
+
export declare const VaultSummarySchema: z.ZodObject<{
|
|
223
|
+
address: z.ZodString;
|
|
224
|
+
chainId: z.ZodNumber;
|
|
225
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
226
|
+
address: z.ZodString;
|
|
227
|
+
chainId: z.ZodNumber;
|
|
228
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
229
|
+
address: z.ZodString;
|
|
230
|
+
chainId: z.ZodNumber;
|
|
231
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
232
|
+
export type VaultSummary = z.infer<typeof VaultSummarySchema>;
|
|
233
|
+
export declare const VaultListSchema: z.ZodObject<{
|
|
234
|
+
vaults: z.ZodArray<z.ZodObject<{
|
|
235
|
+
name: z.ZodString;
|
|
236
|
+
symbol: z.ZodString;
|
|
237
|
+
address: z.ZodString;
|
|
238
|
+
chainId: z.ZodOptional<z.ZodNumber>;
|
|
239
|
+
}, "strip", z.ZodTypeAny, {
|
|
240
|
+
symbol?: string;
|
|
241
|
+
name?: string;
|
|
242
|
+
address?: string;
|
|
243
|
+
chainId?: number;
|
|
244
|
+
}, {
|
|
245
|
+
symbol?: string;
|
|
246
|
+
name?: string;
|
|
247
|
+
address?: string;
|
|
248
|
+
chainId?: number;
|
|
249
|
+
}>, "many">;
|
|
250
|
+
total: z.ZodOptional<z.ZodNumber>;
|
|
251
|
+
nextCursor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
252
|
+
query: z.ZodOptional<z.ZodString>;
|
|
253
|
+
}, "strip", z.ZodTypeAny, {
|
|
254
|
+
vaults?: {
|
|
255
|
+
symbol?: string;
|
|
256
|
+
name?: string;
|
|
257
|
+
address?: string;
|
|
258
|
+
chainId?: number;
|
|
259
|
+
}[];
|
|
260
|
+
total?: number;
|
|
261
|
+
nextCursor?: string;
|
|
262
|
+
query?: string;
|
|
263
|
+
}, {
|
|
264
|
+
vaults?: {
|
|
265
|
+
symbol?: string;
|
|
266
|
+
name?: string;
|
|
267
|
+
address?: string;
|
|
268
|
+
chainId?: number;
|
|
269
|
+
}[];
|
|
270
|
+
total?: number;
|
|
271
|
+
nextCursor?: string;
|
|
272
|
+
query?: string;
|
|
273
|
+
}>;
|
|
274
|
+
export type VaultList = z.infer<typeof VaultListSchema>;
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.VaultListSchema = exports.VaultSummarySchema = exports.VaultHistorySchema = exports.VaultRedemptionsSchema = exports.VaultAllocationsSchema = exports.VaultLoansSchema = exports.VaultPositionsSchema = exports.VaultTvlSchema = exports.VaultApySchema = exports.VaultGetSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const Address = zod_1.z
|
|
6
|
+
.string()
|
|
7
|
+
.regex(/^(0x[0-9a-fA-F]{40}|0x[0-9a-fA-F]{64}|[1-9A-HJ-NP-Za-km-z]{32,44})$/, {
|
|
8
|
+
message: 'Expected an EVM (0x…), Sui (0x… 64 hex chars), or Solana address.',
|
|
9
|
+
});
|
|
10
|
+
const BigNumeric = zod_1.z.union([zod_1.z.string(), zod_1.z.number()]);
|
|
11
|
+
exports.VaultGetSchema = zod_1.z
|
|
12
|
+
.object({
|
|
13
|
+
address: Address,
|
|
14
|
+
chainId: zod_1.z.number().int(),
|
|
15
|
+
name: zod_1.z.string().optional(),
|
|
16
|
+
symbol: zod_1.z.string().optional(),
|
|
17
|
+
decimals: zod_1.z.number().int().nonnegative().optional(),
|
|
18
|
+
underlying: zod_1.z
|
|
19
|
+
.object({
|
|
20
|
+
address: Address,
|
|
21
|
+
symbol: zod_1.z.string().optional(),
|
|
22
|
+
decimals: zod_1.z.number().int().nonnegative().optional(),
|
|
23
|
+
})
|
|
24
|
+
.partial()
|
|
25
|
+
.passthrough()
|
|
26
|
+
.optional(),
|
|
27
|
+
})
|
|
28
|
+
.passthrough();
|
|
29
|
+
exports.VaultApySchema = zod_1.z
|
|
30
|
+
.object({
|
|
31
|
+
address: Address,
|
|
32
|
+
chainId: zod_1.z.number().int(),
|
|
33
|
+
currentApy: zod_1.z.number().optional(),
|
|
34
|
+
annualizedApy: zod_1.z.number().optional(),
|
|
35
|
+
asOf: zod_1.z.string().datetime().optional(),
|
|
36
|
+
})
|
|
37
|
+
.passthrough();
|
|
38
|
+
exports.VaultTvlSchema = zod_1.z
|
|
39
|
+
.object({
|
|
40
|
+
address: Address,
|
|
41
|
+
chainId: zod_1.z.number().int(),
|
|
42
|
+
tvl: BigNumeric,
|
|
43
|
+
underlyingSymbol: zod_1.z.string().optional(),
|
|
44
|
+
asOf: zod_1.z.string().datetime().optional(),
|
|
45
|
+
})
|
|
46
|
+
.passthrough();
|
|
47
|
+
exports.VaultPositionsSchema = zod_1.z
|
|
48
|
+
.object({
|
|
49
|
+
address: Address,
|
|
50
|
+
chainId: zod_1.z.number().int(),
|
|
51
|
+
user: Address.optional(),
|
|
52
|
+
positions: zod_1.z
|
|
53
|
+
.array(zod_1.z
|
|
54
|
+
.object({
|
|
55
|
+
user: Address,
|
|
56
|
+
shares: BigNumeric,
|
|
57
|
+
assets: BigNumeric.optional(),
|
|
58
|
+
})
|
|
59
|
+
.passthrough())
|
|
60
|
+
.default([]),
|
|
61
|
+
})
|
|
62
|
+
.passthrough();
|
|
63
|
+
exports.VaultLoansSchema = zod_1.z
|
|
64
|
+
.object({
|
|
65
|
+
address: Address,
|
|
66
|
+
chainId: zod_1.z.number().int(),
|
|
67
|
+
loans: zod_1.z.array(zod_1.z.unknown()).default([]),
|
|
68
|
+
})
|
|
69
|
+
.passthrough();
|
|
70
|
+
exports.VaultAllocationsSchema = zod_1.z
|
|
71
|
+
.object({
|
|
72
|
+
address: Address,
|
|
73
|
+
chainId: zod_1.z.number().int(),
|
|
74
|
+
allocations: zod_1.z.array(zod_1.z.unknown()).default([]),
|
|
75
|
+
})
|
|
76
|
+
.passthrough();
|
|
77
|
+
exports.VaultRedemptionsSchema = zod_1.z
|
|
78
|
+
.object({
|
|
79
|
+
address: Address,
|
|
80
|
+
chainId: zod_1.z.number().int(),
|
|
81
|
+
user: Address.optional(),
|
|
82
|
+
available: zod_1.z.array(zod_1.z.unknown()).default([]),
|
|
83
|
+
history: zod_1.z.array(zod_1.z.unknown()).default([]),
|
|
84
|
+
})
|
|
85
|
+
.passthrough();
|
|
86
|
+
exports.VaultHistorySchema = zod_1.z
|
|
87
|
+
.object({
|
|
88
|
+
address: Address,
|
|
89
|
+
chainId: zod_1.z.number().int(),
|
|
90
|
+
from: zod_1.z.string().datetime().optional(),
|
|
91
|
+
to: zod_1.z.string().datetime().optional(),
|
|
92
|
+
series: zod_1.z.array(zod_1.z.unknown()).default([]),
|
|
93
|
+
})
|
|
94
|
+
.passthrough();
|
|
95
|
+
exports.VaultSummarySchema = zod_1.z
|
|
96
|
+
.object({
|
|
97
|
+
address: Address,
|
|
98
|
+
chainId: zod_1.z.number().int(),
|
|
99
|
+
})
|
|
100
|
+
.passthrough();
|
|
101
|
+
exports.VaultListSchema = zod_1.z.object({
|
|
102
|
+
vaults: zod_1.z.array(zod_1.z.object({
|
|
103
|
+
name: zod_1.z.string(),
|
|
104
|
+
symbol: zod_1.z.string(),
|
|
105
|
+
address: Address,
|
|
106
|
+
chainId: zod_1.z.number().int().optional(),
|
|
107
|
+
})),
|
|
108
|
+
total: zod_1.z.number().int().optional(),
|
|
109
|
+
nextCursor: zod_1.z.string().nullable().optional(),
|
|
110
|
+
query: zod_1.z.string().optional(),
|
|
111
|
+
});
|
|
112
|
+
//# sourceMappingURL=vault.js.map
|
package/lib/sdk.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import UpshiftSDK from '@upshiftfinance/sdk';
|
|
2
|
+
import { type Config } from './config';
|
|
3
|
+
export interface CreateSdkOptions {
|
|
4
|
+
config?: Config;
|
|
5
|
+
profileName?: string;
|
|
6
|
+
appName?: string;
|
|
7
|
+
withoutApiKey?: boolean;
|
|
8
|
+
cliApiKey?: string;
|
|
9
|
+
chainId?: number;
|
|
10
|
+
cliRpcUrl?: string;
|
|
11
|
+
disableAnalytics?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export declare function createSDK(opts?: CreateSdkOptions): Promise<UpshiftSDK>;
|
|
14
|
+
export declare function resolvedRpcUrl(chainId: number): string;
|
package/lib/sdk.js
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.createSDK = createSDK;
|
|
37
|
+
exports.resolvedRpcUrl = resolvedRpcUrl;
|
|
38
|
+
const sdk_1 = __importStar(require("@upshiftfinance/sdk"));
|
|
39
|
+
const config_1 = require("./config");
|
|
40
|
+
const env_1 = require("./env");
|
|
41
|
+
const profile_1 = require("./profile");
|
|
42
|
+
const precedence_1 = require("./precedence");
|
|
43
|
+
function buildProviders(config, profileRpcs, chainId, cliRpcUrl) {
|
|
44
|
+
const merged = {
|
|
45
|
+
...config.rpcs,
|
|
46
|
+
...(profileRpcs ?? {}),
|
|
47
|
+
};
|
|
48
|
+
for (const [tail, url] of Object.entries((0, env_1.readRpcEnvEntries)())) {
|
|
49
|
+
merged[tail] = url;
|
|
50
|
+
}
|
|
51
|
+
if (chainId !== undefined && cliRpcUrl) {
|
|
52
|
+
merged[String(chainId)] = cliRpcUrl;
|
|
53
|
+
}
|
|
54
|
+
const out = {};
|
|
55
|
+
for (const [k, v] of Object.entries(merged)) {
|
|
56
|
+
const n = Number(k);
|
|
57
|
+
if (Number.isFinite(n))
|
|
58
|
+
out[n] = v;
|
|
59
|
+
}
|
|
60
|
+
if (chainId !== undefined && out[chainId] === undefined) {
|
|
61
|
+
const [publicFallback] = (0, sdk_1.getFallbackRpcUrls)(chainId);
|
|
62
|
+
if (publicFallback)
|
|
63
|
+
out[chainId] = publicFallback;
|
|
64
|
+
}
|
|
65
|
+
return out;
|
|
66
|
+
}
|
|
67
|
+
async function createSDK(opts = {}) {
|
|
68
|
+
const config = opts.config ?? (0, config_1.loadConfig)();
|
|
69
|
+
const profileName = opts.profileName ?? (0, env_1.readEnv)('PROFILE') ?? config.defaultProfile;
|
|
70
|
+
let profileRpcs;
|
|
71
|
+
try {
|
|
72
|
+
profileRpcs = (0, profile_1.loadProfile)(profileName).rpcs;
|
|
73
|
+
}
|
|
74
|
+
catch {
|
|
75
|
+
profileRpcs = undefined;
|
|
76
|
+
}
|
|
77
|
+
const providers = buildProviders(config, profileRpcs, opts.chainId, opts.cliRpcUrl);
|
|
78
|
+
const apiKey = opts.withoutApiKey
|
|
79
|
+
? undefined
|
|
80
|
+
: tryGetApiKey({ cliApiKey: opts.cliApiKey, profileName });
|
|
81
|
+
const appName = opts.appName ?? config.appName ?? 'upshift-cli';
|
|
82
|
+
const disableAnalytics = opts.disableAnalytics !== undefined
|
|
83
|
+
? opts.disableAnalytics
|
|
84
|
+
: !config.telemetry;
|
|
85
|
+
if (opts.chainId !== undefined && opts.cliRpcUrl) {
|
|
86
|
+
return new sdk_1.default({
|
|
87
|
+
appName,
|
|
88
|
+
providers: { [opts.chainId]: opts.cliRpcUrl, ...providers },
|
|
89
|
+
keys: apiKey ? { upshift: apiKey } : {},
|
|
90
|
+
analytics: { enabled: !disableAnalytics },
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
return new sdk_1.default({
|
|
94
|
+
appName,
|
|
95
|
+
providers,
|
|
96
|
+
keys: apiKey ? { upshift: apiKey } : {},
|
|
97
|
+
analytics: { enabled: !disableAnalytics },
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
function tryGetApiKey(opts) {
|
|
101
|
+
try {
|
|
102
|
+
return (0, precedence_1.getApiKey)({
|
|
103
|
+
cliApiKey: opts.cliApiKey,
|
|
104
|
+
profileName: opts.profileName,
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
catch {
|
|
108
|
+
return undefined;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
function resolvedRpcUrl(chainId) {
|
|
112
|
+
return (0, precedence_1.getRpcUrl)(chainId);
|
|
113
|
+
}
|
|
114
|
+
//# sourceMappingURL=sdk.js.map
|
package/lib/session.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export interface SessionPayload {
|
|
2
|
+
apiKey?: string;
|
|
3
|
+
expiresAt: number;
|
|
4
|
+
}
|
|
5
|
+
export declare function readSession(path?: string): SessionPayload | null;
|
|
6
|
+
export declare function writeSession(payload: Omit<SessionPayload, 'expiresAt'>, ttlSec: number, path?: string): SessionPayload;
|
|
7
|
+
export declare function clearSession(path?: string): void;
|
|
8
|
+
export declare function sessionActive(path?: string): boolean;
|
package/lib/session.js
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.readSession = readSession;
|
|
4
|
+
exports.writeSession = writeSession;
|
|
5
|
+
exports.clearSession = clearSession;
|
|
6
|
+
exports.sessionActive = sessionActive;
|
|
7
|
+
const node_fs_1 = require("node:fs");
|
|
8
|
+
const node_path_1 = require("node:path");
|
|
9
|
+
const zod_1 = require("zod");
|
|
10
|
+
const errors_1 = require("./errors");
|
|
11
|
+
const paths_1 = require("./paths");
|
|
12
|
+
const SessionFileSchema = zod_1.z.object({
|
|
13
|
+
schemaVersion: zod_1.z.literal(1),
|
|
14
|
+
apiKey: zod_1.z.string().min(1).optional(),
|
|
15
|
+
expiresAt: zod_1.z.number().int().positive(),
|
|
16
|
+
});
|
|
17
|
+
function ensureFileMode(path, mode) {
|
|
18
|
+
try {
|
|
19
|
+
(0, node_fs_1.chmodSync)(path, mode);
|
|
20
|
+
}
|
|
21
|
+
catch {
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
function readSession(path = (0, paths_1.sessionFile)()) {
|
|
25
|
+
if (!(0, node_fs_1.existsSync)(path))
|
|
26
|
+
return null;
|
|
27
|
+
let raw;
|
|
28
|
+
try {
|
|
29
|
+
raw = JSON.parse((0, node_fs_1.readFileSync)(path, 'utf8'));
|
|
30
|
+
}
|
|
31
|
+
catch {
|
|
32
|
+
throw new errors_1.UpshiftConfigError('SESSION_INVALID', `Session file at ${path} is not valid JSON.`, 'Run `upshift logout` and then `upshift login` again.');
|
|
33
|
+
}
|
|
34
|
+
const parsed = SessionFileSchema.safeParse(raw);
|
|
35
|
+
if (!parsed.success) {
|
|
36
|
+
throw new errors_1.UpshiftConfigError('SESSION_INVALID', `Session file at ${path} failed validation.`, 'Run `upshift logout` and then `upshift login` again.');
|
|
37
|
+
}
|
|
38
|
+
if (parsed.data.expiresAt <= Date.now()) {
|
|
39
|
+
throw new errors_1.UpshiftConfigError('SESSION_EXPIRED', 'Session has expired.', 'Run `upshift login` to start a new session.');
|
|
40
|
+
}
|
|
41
|
+
return {
|
|
42
|
+
apiKey: parsed.data.apiKey,
|
|
43
|
+
expiresAt: parsed.data.expiresAt,
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
function writeSession(payload, ttlSec, path = (0, paths_1.sessionFile)()) {
|
|
47
|
+
if (!Number.isFinite(ttlSec) || ttlSec <= 0) {
|
|
48
|
+
throw new errors_1.UpshiftConfigError('SESSION_INVALID', `Session TTL must be a positive number of seconds (got ${ttlSec}).`);
|
|
49
|
+
}
|
|
50
|
+
const expiresAt = Date.now() + ttlSec * 1000;
|
|
51
|
+
const file = { schemaVersion: 1, ...payload, expiresAt };
|
|
52
|
+
const dir = (0, node_path_1.dirname)(path);
|
|
53
|
+
if (!(0, node_fs_1.existsSync)(dir)) {
|
|
54
|
+
(0, node_fs_1.mkdirSync)(dir, { recursive: true, mode: 0o700 });
|
|
55
|
+
}
|
|
56
|
+
(0, node_fs_1.writeFileSync)(path, JSON.stringify(file, null, 2), {
|
|
57
|
+
encoding: 'utf8',
|
|
58
|
+
mode: 0o600,
|
|
59
|
+
});
|
|
60
|
+
ensureFileMode(path, 0o600);
|
|
61
|
+
ensureFileMode(dir, 0o700);
|
|
62
|
+
return { apiKey: payload.apiKey, expiresAt };
|
|
63
|
+
}
|
|
64
|
+
function clearSession(path = (0, paths_1.sessionFile)()) {
|
|
65
|
+
if ((0, node_fs_1.existsSync)(path))
|
|
66
|
+
(0, node_fs_1.unlinkSync)(path);
|
|
67
|
+
}
|
|
68
|
+
function sessionActive(path = (0, paths_1.sessionFile)()) {
|
|
69
|
+
try {
|
|
70
|
+
return readSession(path) !== null;
|
|
71
|
+
}
|
|
72
|
+
catch {
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=session.js.map
|
package/lib/vaults.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare function chainIdFromSubgraphSlug(subgraph: string | undefined): number | undefined;
|
|
2
|
+
export interface KnownVault {
|
|
3
|
+
name: string;
|
|
4
|
+
symbol: string;
|
|
5
|
+
address: string;
|
|
6
|
+
chainId?: number;
|
|
7
|
+
}
|
|
8
|
+
export declare function listKnownVaults(chainId?: number): Promise<KnownVault[]>;
|
package/lib/vaults.js
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.chainIdFromSubgraphSlug = chainIdFromSubgraphSlug;
|
|
4
|
+
exports.listKnownVaults = listKnownVaults;
|
|
5
|
+
const sdk_1 = require("@upshiftfinance/sdk");
|
|
6
|
+
const SUBGRAPH_SLUG_TO_CHAIN_ID = {
|
|
7
|
+
eth: 1,
|
|
8
|
+
mainnet: 1,
|
|
9
|
+
avax: 43114,
|
|
10
|
+
avalanche: 43114,
|
|
11
|
+
bsc: 56,
|
|
12
|
+
hyperevm: 999,
|
|
13
|
+
monad: 143,
|
|
14
|
+
mezo: 31612,
|
|
15
|
+
plasma: 9745,
|
|
16
|
+
ink: 57073,
|
|
17
|
+
flare: 14,
|
|
18
|
+
tempo: 4217,
|
|
19
|
+
};
|
|
20
|
+
function chainIdFromSubgraphSlug(subgraph) {
|
|
21
|
+
if (!subgraph)
|
|
22
|
+
return undefined;
|
|
23
|
+
const m = subgraph.match(/august-([a-z]+)-/i);
|
|
24
|
+
if (!m)
|
|
25
|
+
return undefined;
|
|
26
|
+
return SUBGRAPH_SLUG_TO_CHAIN_ID[m[1].toLowerCase()];
|
|
27
|
+
}
|
|
28
|
+
async function listKnownVaults(chainId) {
|
|
29
|
+
const metadata = await (0, sdk_1.fetchVaultMetadata)();
|
|
30
|
+
const items = Object.entries(metadata).map(([key, item]) => ({
|
|
31
|
+
name: key,
|
|
32
|
+
symbol: item.symbol,
|
|
33
|
+
address: item.address,
|
|
34
|
+
chainId: chainIdFromSubgraphSlug(item.subgraph),
|
|
35
|
+
}));
|
|
36
|
+
const filtered = chainId === undefined ? items : items.filter((v) => v.chainId === chainId);
|
|
37
|
+
return filtered.sort((a, b) => {
|
|
38
|
+
if ((a.chainId ?? 0) !== (b.chainId ?? 0)) {
|
|
39
|
+
return (a.chainId ?? 0) - (b.chainId ?? 0);
|
|
40
|
+
}
|
|
41
|
+
return a.name.localeCompare(b.name);
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=vaults.js.map
|