@augustdigital/config 0.1.0
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 +53 -0
- package/lib/config.d.ts +44 -0
- package/lib/config.js +80 -0
- package/lib/errors.d.ts +6 -0
- package/lib/errors.js +13 -0
- package/lib/index.d.ts +9 -0
- package/lib/index.js +49 -0
- package/lib/keystore.d.ts +37 -0
- package/lib/keystore.js +176 -0
- package/lib/paths.d.ts +6 -0
- package/lib/paths.js +33 -0
- package/lib/precedence.d.ts +11 -0
- package/lib/precedence.js +69 -0
- package/lib/profile.d.ts +26 -0
- package/lib/profile.js +65 -0
- package/lib/schemas/envelope.d.ts +155 -0
- package/lib/schemas/envelope.js +34 -0
- package/lib/schemas/index.d.ts +4 -0
- package/lib/schemas/index.js +21 -0
- package/lib/schemas/meta.d.ts +115 -0
- package/lib/schemas/meta.js +34 -0
- package/lib/schemas/user.d.ts +133 -0
- package/lib/schemas/user.js +48 -0
- package/lib/schemas/vault.d.ts +265 -0
- package/lib/schemas/vault.js +109 -0
- package/lib/sdk.d.ts +14 -0
- package/lib/sdk.js +120 -0
- package/lib/session.d.ts +8 -0
- package/lib/session.js +76 -0
- package/package.json +51 -0
package/lib/profile.js
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.saveProfile = saveProfile;
|
|
4
|
+
exports.loadProfile = loadProfile;
|
|
5
|
+
exports.listProfiles = listProfiles;
|
|
6
|
+
exports.deleteProfile = deleteProfile;
|
|
7
|
+
const node_fs_1 = require("node:fs");
|
|
8
|
+
const zod_1 = require("zod");
|
|
9
|
+
const errors_1 = require("./errors");
|
|
10
|
+
const paths_1 = require("./paths");
|
|
11
|
+
const ProfileSchema = zod_1.z.object({
|
|
12
|
+
schemaVersion: zod_1.z.literal(1).default(1),
|
|
13
|
+
name: zod_1.z.string().min(1),
|
|
14
|
+
defaultChainId: zod_1.z.number().int().optional(),
|
|
15
|
+
rpcs: zod_1.z.record(zod_1.z.string().min(1), zod_1.z.string().url()).default({}),
|
|
16
|
+
notes: zod_1.z.string().optional(),
|
|
17
|
+
});
|
|
18
|
+
function saveProfile(profile) {
|
|
19
|
+
const validated = ProfileSchema.parse(profile);
|
|
20
|
+
if (validated.name.includes('/') || validated.name.includes('\\')) {
|
|
21
|
+
throw new errors_1.AugustConfigError('PROFILE_INVALID', `Profile name "${validated.name}" may not contain path separators.`);
|
|
22
|
+
}
|
|
23
|
+
const dir = (0, paths_1.profilesDir)();
|
|
24
|
+
if (!(0, node_fs_1.existsSync)(dir)) {
|
|
25
|
+
(0, node_fs_1.mkdirSync)(dir, { recursive: true, mode: 0o700 });
|
|
26
|
+
}
|
|
27
|
+
(0, node_fs_1.writeFileSync)((0, paths_1.profileFile)(validated.name), JSON.stringify(validated, null, 2), {
|
|
28
|
+
encoding: 'utf8',
|
|
29
|
+
mode: 0o644,
|
|
30
|
+
});
|
|
31
|
+
return validated;
|
|
32
|
+
}
|
|
33
|
+
function loadProfile(name) {
|
|
34
|
+
const path = (0, paths_1.profileFile)(name);
|
|
35
|
+
if (!(0, node_fs_1.existsSync)(path)) {
|
|
36
|
+
throw new errors_1.AugustConfigError('PROFILE_NOT_FOUND', `No profile named "${name}" (looked at ${path}).`, 'Run `august profile list` to see available profiles.');
|
|
37
|
+
}
|
|
38
|
+
let raw;
|
|
39
|
+
try {
|
|
40
|
+
raw = JSON.parse((0, node_fs_1.readFileSync)(path, 'utf8'));
|
|
41
|
+
}
|
|
42
|
+
catch (err) {
|
|
43
|
+
throw new errors_1.AugustConfigError('PROFILE_INVALID', `Profile "${name}" is not valid JSON: ${err.message}`);
|
|
44
|
+
}
|
|
45
|
+
const result = ProfileSchema.safeParse(raw);
|
|
46
|
+
if (!result.success) {
|
|
47
|
+
throw new errors_1.AugustConfigError('PROFILE_INVALID', `Profile "${name}" failed validation: ${result.error.message}`);
|
|
48
|
+
}
|
|
49
|
+
return result.data;
|
|
50
|
+
}
|
|
51
|
+
function listProfiles() {
|
|
52
|
+
const dir = (0, paths_1.profilesDir)();
|
|
53
|
+
if (!(0, node_fs_1.existsSync)(dir))
|
|
54
|
+
return [];
|
|
55
|
+
return (0, node_fs_1.readdirSync)(dir)
|
|
56
|
+
.filter((f) => f.endsWith('.json'))
|
|
57
|
+
.map((f) => f.replace(/\.json$/, ''))
|
|
58
|
+
.sort();
|
|
59
|
+
}
|
|
60
|
+
function deleteProfile(name) {
|
|
61
|
+
const path = (0, paths_1.profileFile)(name);
|
|
62
|
+
if ((0, node_fs_1.existsSync)(path))
|
|
63
|
+
(0, node_fs_1.unlinkSync)(path);
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=profile.js.map
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const ResultMetaSchema: z.ZodObject<{
|
|
3
|
+
chainId: z.ZodOptional<z.ZodNumber>;
|
|
4
|
+
durationMs: z.ZodOptional<z.ZodNumber>;
|
|
5
|
+
generatedAt: z.ZodString;
|
|
6
|
+
}, "strip", z.ZodTypeAny, {
|
|
7
|
+
chainId?: number;
|
|
8
|
+
durationMs?: number;
|
|
9
|
+
generatedAt?: string;
|
|
10
|
+
}, {
|
|
11
|
+
chainId?: number;
|
|
12
|
+
durationMs?: number;
|
|
13
|
+
generatedAt?: string;
|
|
14
|
+
}>;
|
|
15
|
+
export type ResultMeta = z.infer<typeof ResultMetaSchema>;
|
|
16
|
+
export declare const ResultErrorSchema: z.ZodObject<{
|
|
17
|
+
code: z.ZodString;
|
|
18
|
+
message: z.ZodString;
|
|
19
|
+
remediation: z.ZodOptional<z.ZodString>;
|
|
20
|
+
}, "strip", z.ZodTypeAny, {
|
|
21
|
+
code?: string;
|
|
22
|
+
message?: string;
|
|
23
|
+
remediation?: string;
|
|
24
|
+
}, {
|
|
25
|
+
code?: string;
|
|
26
|
+
message?: string;
|
|
27
|
+
remediation?: string;
|
|
28
|
+
}>;
|
|
29
|
+
export type ResultError = z.infer<typeof ResultErrorSchema>;
|
|
30
|
+
export declare function envelope<T extends z.ZodTypeAny>(data: T): z.ZodDiscriminatedUnion<"ok", [z.ZodObject<{
|
|
31
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
32
|
+
command: z.ZodString;
|
|
33
|
+
ok: z.ZodLiteral<true>;
|
|
34
|
+
data: T;
|
|
35
|
+
meta: z.ZodObject<{
|
|
36
|
+
chainId: z.ZodOptional<z.ZodNumber>;
|
|
37
|
+
durationMs: z.ZodOptional<z.ZodNumber>;
|
|
38
|
+
generatedAt: z.ZodString;
|
|
39
|
+
}, "strip", z.ZodTypeAny, {
|
|
40
|
+
chainId?: number;
|
|
41
|
+
durationMs?: number;
|
|
42
|
+
generatedAt?: string;
|
|
43
|
+
}, {
|
|
44
|
+
chainId?: number;
|
|
45
|
+
durationMs?: number;
|
|
46
|
+
generatedAt?: string;
|
|
47
|
+
}>;
|
|
48
|
+
}, "strip", z.ZodTypeAny, z.objectUtil.addQuestionMarks<z.baseObjectOutputType<{
|
|
49
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
50
|
+
command: z.ZodString;
|
|
51
|
+
ok: z.ZodLiteral<true>;
|
|
52
|
+
data: T;
|
|
53
|
+
meta: z.ZodObject<{
|
|
54
|
+
chainId: z.ZodOptional<z.ZodNumber>;
|
|
55
|
+
durationMs: z.ZodOptional<z.ZodNumber>;
|
|
56
|
+
generatedAt: z.ZodString;
|
|
57
|
+
}, "strip", z.ZodTypeAny, {
|
|
58
|
+
chainId?: number;
|
|
59
|
+
durationMs?: number;
|
|
60
|
+
generatedAt?: string;
|
|
61
|
+
}, {
|
|
62
|
+
chainId?: number;
|
|
63
|
+
durationMs?: number;
|
|
64
|
+
generatedAt?: string;
|
|
65
|
+
}>;
|
|
66
|
+
}>, any> extends infer T_1 ? { [k in keyof T_1]: T_1[k]; } : never, z.baseObjectInputType<{
|
|
67
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
68
|
+
command: z.ZodString;
|
|
69
|
+
ok: z.ZodLiteral<true>;
|
|
70
|
+
data: T;
|
|
71
|
+
meta: z.ZodObject<{
|
|
72
|
+
chainId: z.ZodOptional<z.ZodNumber>;
|
|
73
|
+
durationMs: z.ZodOptional<z.ZodNumber>;
|
|
74
|
+
generatedAt: z.ZodString;
|
|
75
|
+
}, "strip", z.ZodTypeAny, {
|
|
76
|
+
chainId?: number;
|
|
77
|
+
durationMs?: number;
|
|
78
|
+
generatedAt?: string;
|
|
79
|
+
}, {
|
|
80
|
+
chainId?: number;
|
|
81
|
+
durationMs?: number;
|
|
82
|
+
generatedAt?: string;
|
|
83
|
+
}>;
|
|
84
|
+
}> extends infer T_2 ? { [k_1 in keyof T_2]: T_2[k_1]; } : never>, z.ZodObject<{
|
|
85
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
86
|
+
command: z.ZodString;
|
|
87
|
+
ok: z.ZodLiteral<false>;
|
|
88
|
+
error: z.ZodObject<{
|
|
89
|
+
code: z.ZodString;
|
|
90
|
+
message: z.ZodString;
|
|
91
|
+
remediation: z.ZodOptional<z.ZodString>;
|
|
92
|
+
}, "strip", z.ZodTypeAny, {
|
|
93
|
+
code?: string;
|
|
94
|
+
message?: string;
|
|
95
|
+
remediation?: string;
|
|
96
|
+
}, {
|
|
97
|
+
code?: string;
|
|
98
|
+
message?: string;
|
|
99
|
+
remediation?: string;
|
|
100
|
+
}>;
|
|
101
|
+
meta: z.ZodObject<{
|
|
102
|
+
chainId: z.ZodOptional<z.ZodNumber>;
|
|
103
|
+
durationMs: z.ZodOptional<z.ZodNumber>;
|
|
104
|
+
generatedAt: z.ZodString;
|
|
105
|
+
}, "strip", z.ZodTypeAny, {
|
|
106
|
+
chainId?: number;
|
|
107
|
+
durationMs?: number;
|
|
108
|
+
generatedAt?: string;
|
|
109
|
+
}, {
|
|
110
|
+
chainId?: number;
|
|
111
|
+
durationMs?: number;
|
|
112
|
+
generatedAt?: string;
|
|
113
|
+
}>;
|
|
114
|
+
}, "strip", z.ZodTypeAny, {
|
|
115
|
+
schemaVersion?: 1;
|
|
116
|
+
ok?: false;
|
|
117
|
+
command?: string;
|
|
118
|
+
meta?: {
|
|
119
|
+
chainId?: number;
|
|
120
|
+
durationMs?: number;
|
|
121
|
+
generatedAt?: string;
|
|
122
|
+
};
|
|
123
|
+
error?: {
|
|
124
|
+
code?: string;
|
|
125
|
+
message?: string;
|
|
126
|
+
remediation?: string;
|
|
127
|
+
};
|
|
128
|
+
}, {
|
|
129
|
+
schemaVersion?: 1;
|
|
130
|
+
ok?: false;
|
|
131
|
+
command?: string;
|
|
132
|
+
meta?: {
|
|
133
|
+
chainId?: number;
|
|
134
|
+
durationMs?: number;
|
|
135
|
+
generatedAt?: string;
|
|
136
|
+
};
|
|
137
|
+
error?: {
|
|
138
|
+
code?: string;
|
|
139
|
+
message?: string;
|
|
140
|
+
remediation?: string;
|
|
141
|
+
};
|
|
142
|
+
}>]>;
|
|
143
|
+
export type Envelope<TData> = {
|
|
144
|
+
schemaVersion: 1;
|
|
145
|
+
command: string;
|
|
146
|
+
ok: true;
|
|
147
|
+
data: TData;
|
|
148
|
+
meta: ResultMeta;
|
|
149
|
+
} | {
|
|
150
|
+
schemaVersion: 1;
|
|
151
|
+
command: string;
|
|
152
|
+
ok: false;
|
|
153
|
+
error: ResultError;
|
|
154
|
+
meta: ResultMeta;
|
|
155
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ResultErrorSchema = exports.ResultMetaSchema = void 0;
|
|
4
|
+
exports.envelope = envelope;
|
|
5
|
+
const zod_1 = require("zod");
|
|
6
|
+
exports.ResultMetaSchema = zod_1.z.object({
|
|
7
|
+
chainId: zod_1.z.number().int().optional(),
|
|
8
|
+
durationMs: zod_1.z.number().nonnegative().optional(),
|
|
9
|
+
generatedAt: zod_1.z.string().datetime(),
|
|
10
|
+
});
|
|
11
|
+
exports.ResultErrorSchema = zod_1.z.object({
|
|
12
|
+
code: zod_1.z.string(),
|
|
13
|
+
message: zod_1.z.string(),
|
|
14
|
+
remediation: zod_1.z.string().optional(),
|
|
15
|
+
});
|
|
16
|
+
function envelope(data) {
|
|
17
|
+
return zod_1.z.discriminatedUnion('ok', [
|
|
18
|
+
zod_1.z.object({
|
|
19
|
+
schemaVersion: zod_1.z.literal(1),
|
|
20
|
+
command: zod_1.z.string(),
|
|
21
|
+
ok: zod_1.z.literal(true),
|
|
22
|
+
data,
|
|
23
|
+
meta: exports.ResultMetaSchema,
|
|
24
|
+
}),
|
|
25
|
+
zod_1.z.object({
|
|
26
|
+
schemaVersion: zod_1.z.literal(1),
|
|
27
|
+
command: zod_1.z.string(),
|
|
28
|
+
ok: zod_1.z.literal(false),
|
|
29
|
+
error: exports.ResultErrorSchema,
|
|
30
|
+
meta: exports.ResultMetaSchema,
|
|
31
|
+
}),
|
|
32
|
+
]);
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=envelope.js.map
|
|
@@ -0,0 +1,21 @@
|
|
|
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./envelope"), exports);
|
|
18
|
+
__exportStar(require("./vault"), exports);
|
|
19
|
+
__exportStar(require("./user"), exports);
|
|
20
|
+
__exportStar(require("./meta"), exports);
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const ChainListSchema: z.ZodObject<{
|
|
3
|
+
chains: z.ZodArray<z.ZodObject<{
|
|
4
|
+
chainId: z.ZodNumber;
|
|
5
|
+
name: z.ZodString;
|
|
6
|
+
explorer: z.ZodOptional<z.ZodString>;
|
|
7
|
+
hasRpc: z.ZodBoolean;
|
|
8
|
+
}, "strip", z.ZodTypeAny, {
|
|
9
|
+
name?: string;
|
|
10
|
+
chainId?: number;
|
|
11
|
+
explorer?: string;
|
|
12
|
+
hasRpc?: boolean;
|
|
13
|
+
}, {
|
|
14
|
+
name?: string;
|
|
15
|
+
chainId?: number;
|
|
16
|
+
explorer?: string;
|
|
17
|
+
hasRpc?: boolean;
|
|
18
|
+
}>, "many">;
|
|
19
|
+
}, "strip", z.ZodTypeAny, {
|
|
20
|
+
chains?: {
|
|
21
|
+
name?: string;
|
|
22
|
+
chainId?: number;
|
|
23
|
+
explorer?: string;
|
|
24
|
+
hasRpc?: boolean;
|
|
25
|
+
}[];
|
|
26
|
+
}, {
|
|
27
|
+
chains?: {
|
|
28
|
+
name?: string;
|
|
29
|
+
chainId?: number;
|
|
30
|
+
explorer?: string;
|
|
31
|
+
hasRpc?: boolean;
|
|
32
|
+
}[];
|
|
33
|
+
}>;
|
|
34
|
+
export type ChainList = z.infer<typeof ChainListSchema>;
|
|
35
|
+
export declare const RpcTestSchema: z.ZodObject<{
|
|
36
|
+
results: z.ZodArray<z.ZodObject<{
|
|
37
|
+
chainId: z.ZodNumber;
|
|
38
|
+
url: z.ZodOptional<z.ZodString>;
|
|
39
|
+
ok: z.ZodBoolean;
|
|
40
|
+
latencyMs: z.ZodOptional<z.ZodNumber>;
|
|
41
|
+
error: z.ZodOptional<z.ZodString>;
|
|
42
|
+
}, "strip", z.ZodTypeAny, {
|
|
43
|
+
url?: string;
|
|
44
|
+
chainId?: number;
|
|
45
|
+
ok?: boolean;
|
|
46
|
+
error?: string;
|
|
47
|
+
latencyMs?: number;
|
|
48
|
+
}, {
|
|
49
|
+
url?: string;
|
|
50
|
+
chainId?: number;
|
|
51
|
+
ok?: boolean;
|
|
52
|
+
error?: string;
|
|
53
|
+
latencyMs?: number;
|
|
54
|
+
}>, "many">;
|
|
55
|
+
}, "strip", z.ZodTypeAny, {
|
|
56
|
+
results?: {
|
|
57
|
+
url?: string;
|
|
58
|
+
chainId?: number;
|
|
59
|
+
ok?: boolean;
|
|
60
|
+
error?: string;
|
|
61
|
+
latencyMs?: number;
|
|
62
|
+
}[];
|
|
63
|
+
}, {
|
|
64
|
+
results?: {
|
|
65
|
+
url?: string;
|
|
66
|
+
chainId?: number;
|
|
67
|
+
ok?: boolean;
|
|
68
|
+
error?: string;
|
|
69
|
+
latencyMs?: number;
|
|
70
|
+
}[];
|
|
71
|
+
}>;
|
|
72
|
+
export type RpcTest = z.infer<typeof RpcTestSchema>;
|
|
73
|
+
export declare const WhoamiSchema: z.ZodObject<{
|
|
74
|
+
profile: z.ZodString;
|
|
75
|
+
defaultChainId: z.ZodNumber;
|
|
76
|
+
configDir: z.ZodString;
|
|
77
|
+
cliVersion: z.ZodOptional<z.ZodString>;
|
|
78
|
+
sdkVersion: z.ZodOptional<z.ZodString>;
|
|
79
|
+
apiKey: z.ZodObject<{
|
|
80
|
+
present: z.ZodBoolean;
|
|
81
|
+
source: z.ZodEnum<["env", "session", "flag", "none"]>;
|
|
82
|
+
sessionExpiresAt: z.ZodOptional<z.ZodString>;
|
|
83
|
+
}, "strip", z.ZodTypeAny, {
|
|
84
|
+
present?: boolean;
|
|
85
|
+
source?: "flag" | "env" | "session" | "none";
|
|
86
|
+
sessionExpiresAt?: string;
|
|
87
|
+
}, {
|
|
88
|
+
present?: boolean;
|
|
89
|
+
source?: "flag" | "env" | "session" | "none";
|
|
90
|
+
sessionExpiresAt?: string;
|
|
91
|
+
}>;
|
|
92
|
+
}, "strip", z.ZodTypeAny, {
|
|
93
|
+
defaultChainId?: number;
|
|
94
|
+
apiKey?: {
|
|
95
|
+
present?: boolean;
|
|
96
|
+
source?: "flag" | "env" | "session" | "none";
|
|
97
|
+
sessionExpiresAt?: string;
|
|
98
|
+
};
|
|
99
|
+
profile?: string;
|
|
100
|
+
configDir?: string;
|
|
101
|
+
cliVersion?: string;
|
|
102
|
+
sdkVersion?: string;
|
|
103
|
+
}, {
|
|
104
|
+
defaultChainId?: number;
|
|
105
|
+
apiKey?: {
|
|
106
|
+
present?: boolean;
|
|
107
|
+
source?: "flag" | "env" | "session" | "none";
|
|
108
|
+
sessionExpiresAt?: string;
|
|
109
|
+
};
|
|
110
|
+
profile?: string;
|
|
111
|
+
configDir?: string;
|
|
112
|
+
cliVersion?: string;
|
|
113
|
+
sdkVersion?: string;
|
|
114
|
+
}>;
|
|
115
|
+
export type Whoami = z.infer<typeof WhoamiSchema>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WhoamiSchema = exports.RpcTestSchema = exports.ChainListSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
exports.ChainListSchema = zod_1.z.object({
|
|
6
|
+
chains: zod_1.z.array(zod_1.z.object({
|
|
7
|
+
chainId: zod_1.z.number().int(),
|
|
8
|
+
name: zod_1.z.string(),
|
|
9
|
+
explorer: zod_1.z.string().url().optional(),
|
|
10
|
+
hasRpc: zod_1.z.boolean(),
|
|
11
|
+
})),
|
|
12
|
+
});
|
|
13
|
+
exports.RpcTestSchema = zod_1.z.object({
|
|
14
|
+
results: zod_1.z.array(zod_1.z.object({
|
|
15
|
+
chainId: zod_1.z.number().int(),
|
|
16
|
+
url: zod_1.z.string().url().optional(),
|
|
17
|
+
ok: zod_1.z.boolean(),
|
|
18
|
+
latencyMs: zod_1.z.number().nonnegative().optional(),
|
|
19
|
+
error: zod_1.z.string().optional(),
|
|
20
|
+
})),
|
|
21
|
+
});
|
|
22
|
+
exports.WhoamiSchema = zod_1.z.object({
|
|
23
|
+
profile: zod_1.z.string(),
|
|
24
|
+
defaultChainId: zod_1.z.number().int(),
|
|
25
|
+
configDir: zod_1.z.string(),
|
|
26
|
+
cliVersion: zod_1.z.string().optional(),
|
|
27
|
+
sdkVersion: zod_1.z.string().optional(),
|
|
28
|
+
apiKey: zod_1.z.object({
|
|
29
|
+
present: zod_1.z.boolean(),
|
|
30
|
+
source: zod_1.z.enum(['env', 'session', 'flag', 'none']),
|
|
31
|
+
sessionExpiresAt: zod_1.z.string().datetime().optional(),
|
|
32
|
+
}),
|
|
33
|
+
});
|
|
34
|
+
//# sourceMappingURL=meta.js.map
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const UserPointsSchema: z.ZodObject<{
|
|
3
|
+
user: z.ZodString;
|
|
4
|
+
total: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
|
|
5
|
+
rank: z.ZodOptional<z.ZodNumber>;
|
|
6
|
+
breakdown: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodNumber]>>>;
|
|
7
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
8
|
+
user: z.ZodString;
|
|
9
|
+
total: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
|
|
10
|
+
rank: z.ZodOptional<z.ZodNumber>;
|
|
11
|
+
breakdown: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodNumber]>>>;
|
|
12
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
13
|
+
user: z.ZodString;
|
|
14
|
+
total: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
|
|
15
|
+
rank: z.ZodOptional<z.ZodNumber>;
|
|
16
|
+
breakdown: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodNumber]>>>;
|
|
17
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
18
|
+
export type UserPoints = z.infer<typeof UserPointsSchema>;
|
|
19
|
+
export declare const UserPositionsSchema: z.ZodObject<{
|
|
20
|
+
user: z.ZodString;
|
|
21
|
+
positions: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
22
|
+
vault: z.ZodString;
|
|
23
|
+
chainId: z.ZodNumber;
|
|
24
|
+
shares: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
|
|
25
|
+
assets: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
|
|
26
|
+
apy: z.ZodOptional<z.ZodNumber>;
|
|
27
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
28
|
+
vault: z.ZodString;
|
|
29
|
+
chainId: z.ZodNumber;
|
|
30
|
+
shares: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
|
|
31
|
+
assets: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
|
|
32
|
+
apy: z.ZodOptional<z.ZodNumber>;
|
|
33
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
34
|
+
vault: z.ZodString;
|
|
35
|
+
chainId: z.ZodNumber;
|
|
36
|
+
shares: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
|
|
37
|
+
assets: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
|
|
38
|
+
apy: z.ZodOptional<z.ZodNumber>;
|
|
39
|
+
}, z.ZodTypeAny, "passthrough">>, "many">>;
|
|
40
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
41
|
+
user: z.ZodString;
|
|
42
|
+
positions: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
43
|
+
vault: z.ZodString;
|
|
44
|
+
chainId: z.ZodNumber;
|
|
45
|
+
shares: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
|
|
46
|
+
assets: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
|
|
47
|
+
apy: z.ZodOptional<z.ZodNumber>;
|
|
48
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
49
|
+
vault: z.ZodString;
|
|
50
|
+
chainId: z.ZodNumber;
|
|
51
|
+
shares: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
|
|
52
|
+
assets: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
|
|
53
|
+
apy: z.ZodOptional<z.ZodNumber>;
|
|
54
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
55
|
+
vault: z.ZodString;
|
|
56
|
+
chainId: z.ZodNumber;
|
|
57
|
+
shares: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
|
|
58
|
+
assets: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
|
|
59
|
+
apy: z.ZodOptional<z.ZodNumber>;
|
|
60
|
+
}, z.ZodTypeAny, "passthrough">>, "many">>;
|
|
61
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
62
|
+
user: z.ZodString;
|
|
63
|
+
positions: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
64
|
+
vault: z.ZodString;
|
|
65
|
+
chainId: z.ZodNumber;
|
|
66
|
+
shares: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
|
|
67
|
+
assets: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
|
|
68
|
+
apy: z.ZodOptional<z.ZodNumber>;
|
|
69
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
70
|
+
vault: z.ZodString;
|
|
71
|
+
chainId: z.ZodNumber;
|
|
72
|
+
shares: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
|
|
73
|
+
assets: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
|
|
74
|
+
apy: z.ZodOptional<z.ZodNumber>;
|
|
75
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
76
|
+
vault: z.ZodString;
|
|
77
|
+
chainId: z.ZodNumber;
|
|
78
|
+
shares: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
|
|
79
|
+
assets: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
|
|
80
|
+
apy: z.ZodOptional<z.ZodNumber>;
|
|
81
|
+
}, z.ZodTypeAny, "passthrough">>, "many">>;
|
|
82
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
83
|
+
export type UserPositions = z.infer<typeof UserPositionsSchema>;
|
|
84
|
+
export declare const UserPnlSchema: z.ZodObject<{
|
|
85
|
+
user: z.ZodString;
|
|
86
|
+
lifetime: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
|
|
87
|
+
perVault: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
88
|
+
vault: z.ZodString;
|
|
89
|
+
chainId: z.ZodNumber;
|
|
90
|
+
pnl: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
|
|
91
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
92
|
+
vault: z.ZodString;
|
|
93
|
+
chainId: z.ZodNumber;
|
|
94
|
+
pnl: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
|
|
95
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
96
|
+
vault: z.ZodString;
|
|
97
|
+
chainId: z.ZodNumber;
|
|
98
|
+
pnl: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
|
|
99
|
+
}, z.ZodTypeAny, "passthrough">>, "many">>;
|
|
100
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
101
|
+
user: z.ZodString;
|
|
102
|
+
lifetime: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
|
|
103
|
+
perVault: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
104
|
+
vault: z.ZodString;
|
|
105
|
+
chainId: z.ZodNumber;
|
|
106
|
+
pnl: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
|
|
107
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
108
|
+
vault: z.ZodString;
|
|
109
|
+
chainId: z.ZodNumber;
|
|
110
|
+
pnl: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
|
|
111
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
112
|
+
vault: z.ZodString;
|
|
113
|
+
chainId: z.ZodNumber;
|
|
114
|
+
pnl: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
|
|
115
|
+
}, z.ZodTypeAny, "passthrough">>, "many">>;
|
|
116
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
117
|
+
user: z.ZodString;
|
|
118
|
+
lifetime: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
|
|
119
|
+
perVault: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
120
|
+
vault: z.ZodString;
|
|
121
|
+
chainId: z.ZodNumber;
|
|
122
|
+
pnl: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
|
|
123
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
124
|
+
vault: z.ZodString;
|
|
125
|
+
chainId: z.ZodNumber;
|
|
126
|
+
pnl: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
|
|
127
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
128
|
+
vault: z.ZodString;
|
|
129
|
+
chainId: z.ZodNumber;
|
|
130
|
+
pnl: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
|
|
131
|
+
}, z.ZodTypeAny, "passthrough">>, "many">>;
|
|
132
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
133
|
+
export type UserPnl = z.infer<typeof UserPnlSchema>;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UserPnlSchema = exports.UserPositionsSchema = exports.UserPointsSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const Address = zod_1.z
|
|
6
|
+
.string()
|
|
7
|
+
.regex(/^(0x[0-9a-fA-F]{40}|[1-9A-HJ-NP-Za-km-z]{32,44})$/);
|
|
8
|
+
const BigNumeric = zod_1.z.union([zod_1.z.string(), zod_1.z.number()]);
|
|
9
|
+
exports.UserPointsSchema = zod_1.z
|
|
10
|
+
.object({
|
|
11
|
+
user: Address,
|
|
12
|
+
total: BigNumeric.optional(),
|
|
13
|
+
rank: zod_1.z.number().int().optional(),
|
|
14
|
+
breakdown: zod_1.z.record(zod_1.z.string(), BigNumeric).optional(),
|
|
15
|
+
})
|
|
16
|
+
.passthrough();
|
|
17
|
+
exports.UserPositionsSchema = zod_1.z
|
|
18
|
+
.object({
|
|
19
|
+
user: Address,
|
|
20
|
+
positions: zod_1.z
|
|
21
|
+
.array(zod_1.z
|
|
22
|
+
.object({
|
|
23
|
+
vault: Address,
|
|
24
|
+
chainId: zod_1.z.number().int(),
|
|
25
|
+
shares: BigNumeric,
|
|
26
|
+
assets: BigNumeric.optional(),
|
|
27
|
+
apy: zod_1.z.number().optional(),
|
|
28
|
+
})
|
|
29
|
+
.passthrough())
|
|
30
|
+
.default([]),
|
|
31
|
+
})
|
|
32
|
+
.passthrough();
|
|
33
|
+
exports.UserPnlSchema = zod_1.z
|
|
34
|
+
.object({
|
|
35
|
+
user: Address,
|
|
36
|
+
lifetime: BigNumeric.optional(),
|
|
37
|
+
perVault: zod_1.z
|
|
38
|
+
.array(zod_1.z
|
|
39
|
+
.object({
|
|
40
|
+
vault: Address,
|
|
41
|
+
chainId: zod_1.z.number().int(),
|
|
42
|
+
pnl: BigNumeric.optional(),
|
|
43
|
+
})
|
|
44
|
+
.passthrough())
|
|
45
|
+
.default([]),
|
|
46
|
+
})
|
|
47
|
+
.passthrough();
|
|
48
|
+
//# sourceMappingURL=user.js.map
|