televerse-dao-typechain-types 1.0.8-alpha.1 → 1.0.8-alpha.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/package.json +1 -1
- package/televerse-utils/index.d.ts +65 -221
- package/televerse-utils/index.js +51 -137
package/package.json
CHANGED
|
@@ -1,228 +1,28 @@
|
|
|
1
|
-
import { type JWE } from 'did-jwt';
|
|
2
1
|
import { z } from 'zod';
|
|
3
|
-
export declare const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
export declare const
|
|
11
|
-
export declare const credentialStatusReferenceSchema: z.ZodObject<{
|
|
12
|
-
id: z.ZodString;
|
|
13
|
-
type: z.ZodString;
|
|
14
|
-
}, z.core.$strip>;
|
|
15
|
-
export declare const unsignedCredentialSchema: z.ZodObject<{
|
|
16
|
-
issuer: z.ZodUnion<readonly [z.ZodObject<{
|
|
17
|
-
id: z.ZodString;
|
|
18
|
-
}, z.core.$strip>, z.ZodString]>;
|
|
19
|
-
credentialSubject: z.ZodObject<{
|
|
20
|
-
id: z.ZodOptional<z.ZodString>;
|
|
21
|
-
message: z.ZodOptional<z.ZodString>;
|
|
22
|
-
}, z.core.$strip>;
|
|
23
|
-
credentialSchema: z.ZodOptional<z.ZodObject<{
|
|
24
|
-
id: z.ZodOptional<z.ZodString>;
|
|
25
|
-
type: z.ZodOptional<z.ZodString>;
|
|
26
|
-
}, z.core.$strip>>;
|
|
27
|
-
type: z.ZodOptional<z.ZodUnion<readonly [z.ZodArray<z.ZodString>, z.ZodString]>>;
|
|
28
|
-
'@context': z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodAny, z.ZodAny>, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodAny, z.ZodAny>]>>]>;
|
|
29
|
-
issuanceDate: z.ZodString;
|
|
30
|
-
expirationDate: z.ZodOptional<z.ZodString>;
|
|
31
|
-
credentialStatus: z.ZodOptional<z.ZodObject<{
|
|
32
|
-
id: z.ZodString;
|
|
33
|
-
type: z.ZodString;
|
|
34
|
-
}, z.core.$strip>>;
|
|
35
|
-
id: z.ZodOptional<z.ZodString>;
|
|
36
|
-
}, z.core.$strip>;
|
|
37
|
-
export declare const proofTypeSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
38
|
-
type: z.ZodOptional<z.ZodString>;
|
|
39
|
-
jwt: z.ZodOptional<z.ZodString>;
|
|
40
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
2
|
+
export declare const ChargeFrequency: {
|
|
3
|
+
readonly DAILY: "DAILY";
|
|
4
|
+
readonly WEEKLY: "WEEKLY";
|
|
5
|
+
readonly MONTHLY: "MONTHLY";
|
|
6
|
+
readonly SEMIANNUALLY: "SEMIANNUALLY";
|
|
7
|
+
readonly ANNUALLY: "ANNUALLY";
|
|
8
|
+
};
|
|
9
|
+
export declare const postMessageSchema: z.ZodIntersection<z.ZodObject<{
|
|
41
10
|
type: z.ZodOptional<z.ZodString>;
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
eip712: z.ZodOptional<z.ZodObject<{
|
|
47
|
-
domain: z.ZodOptional<z.ZodObject<{
|
|
48
|
-
chainId: z.ZodNumber;
|
|
49
|
-
name: z.ZodString;
|
|
50
|
-
version: z.ZodString;
|
|
51
|
-
}, z.core.$strip>>;
|
|
52
|
-
types: z.ZodOptional<z.ZodRecord<z.ZodAny, z.ZodAny>>;
|
|
53
|
-
primaryType: z.ZodOptional<z.ZodString>;
|
|
54
|
-
}, z.core.$strip>>;
|
|
55
|
-
}, z.core.$strip>]>;
|
|
56
|
-
export declare const VerifiableCredentialSchema: z.ZodIntersection<z.ZodObject<{
|
|
57
|
-
issuer: z.ZodUnion<readonly [z.ZodObject<{
|
|
58
|
-
id: z.ZodString;
|
|
59
|
-
}, z.core.$strip>, z.ZodString]>;
|
|
60
|
-
credentialSubject: z.ZodObject<{
|
|
61
|
-
id: z.ZodOptional<z.ZodString>;
|
|
62
|
-
message: z.ZodOptional<z.ZodString>;
|
|
63
|
-
}, z.core.$strip>;
|
|
64
|
-
credentialSchema: z.ZodOptional<z.ZodObject<{
|
|
65
|
-
id: z.ZodOptional<z.ZodString>;
|
|
66
|
-
type: z.ZodOptional<z.ZodString>;
|
|
67
|
-
}, z.core.$strip>>;
|
|
68
|
-
type: z.ZodOptional<z.ZodUnion<readonly [z.ZodArray<z.ZodString>, z.ZodString]>>;
|
|
69
|
-
'@context': z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodAny, z.ZodAny>, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodAny, z.ZodAny>]>>]>;
|
|
70
|
-
issuanceDate: z.ZodString;
|
|
71
|
-
expirationDate: z.ZodOptional<z.ZodString>;
|
|
72
|
-
credentialStatus: z.ZodOptional<z.ZodObject<{
|
|
73
|
-
id: z.ZodString;
|
|
74
|
-
type: z.ZodString;
|
|
75
|
-
}, z.core.$strip>>;
|
|
76
|
-
id: z.ZodOptional<z.ZodString>;
|
|
77
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
78
|
-
proof: z.ZodUnion<readonly [z.ZodObject<{
|
|
79
|
-
type: z.ZodOptional<z.ZodString>;
|
|
80
|
-
jwt: z.ZodOptional<z.ZodString>;
|
|
81
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
82
|
-
type: z.ZodOptional<z.ZodString>;
|
|
83
|
-
verificationMethod: z.ZodOptional<z.ZodString>;
|
|
84
|
-
created: z.ZodOptional<z.ZodString>;
|
|
85
|
-
proofPurpose: z.ZodOptional<z.ZodString>;
|
|
86
|
-
proofValue: z.ZodOptional<z.ZodString>;
|
|
87
|
-
eip712: z.ZodOptional<z.ZodObject<{
|
|
88
|
-
domain: z.ZodOptional<z.ZodObject<{
|
|
89
|
-
chainId: z.ZodNumber;
|
|
90
|
-
name: z.ZodString;
|
|
91
|
-
version: z.ZodString;
|
|
92
|
-
}, z.core.$strip>>;
|
|
93
|
-
types: z.ZodOptional<z.ZodRecord<z.ZodAny, z.ZodAny>>;
|
|
94
|
-
primaryType: z.ZodOptional<z.ZodString>;
|
|
95
|
-
}, z.core.$strip>>;
|
|
96
|
-
}, z.core.$strip>]>;
|
|
97
|
-
}, z.core.$strip>>;
|
|
98
|
-
export declare const CreateSearchVcSchema: z.ZodTuple<[z.ZodString, z.ZodIntersection<z.ZodObject<{
|
|
99
|
-
issuer: z.ZodUnion<readonly [z.ZodObject<{
|
|
100
|
-
id: z.ZodString;
|
|
101
|
-
}, z.core.$strip>, z.ZodString]>;
|
|
102
|
-
credentialSubject: z.ZodObject<{
|
|
103
|
-
id: z.ZodOptional<z.ZodString>;
|
|
104
|
-
message: z.ZodOptional<z.ZodString>;
|
|
105
|
-
}, z.core.$strip>;
|
|
106
|
-
credentialSchema: z.ZodOptional<z.ZodObject<{
|
|
107
|
-
id: z.ZodOptional<z.ZodString>;
|
|
108
|
-
type: z.ZodOptional<z.ZodString>;
|
|
109
|
-
}, z.core.$strip>>;
|
|
110
|
-
type: z.ZodOptional<z.ZodUnion<readonly [z.ZodArray<z.ZodString>, z.ZodString]>>;
|
|
111
|
-
'@context': z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodAny, z.ZodAny>, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodAny, z.ZodAny>]>>]>;
|
|
112
|
-
issuanceDate: z.ZodString;
|
|
113
|
-
expirationDate: z.ZodOptional<z.ZodString>;
|
|
114
|
-
credentialStatus: z.ZodOptional<z.ZodObject<{
|
|
115
|
-
id: z.ZodString;
|
|
116
|
-
type: z.ZodString;
|
|
117
|
-
}, z.core.$strip>>;
|
|
118
|
-
id: z.ZodOptional<z.ZodString>;
|
|
119
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
120
|
-
proof: z.ZodUnion<readonly [z.ZodObject<{
|
|
121
|
-
type: z.ZodOptional<z.ZodString>;
|
|
122
|
-
jwt: z.ZodOptional<z.ZodString>;
|
|
123
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
124
|
-
type: z.ZodOptional<z.ZodString>;
|
|
125
|
-
verificationMethod: z.ZodOptional<z.ZodString>;
|
|
126
|
-
created: z.ZodOptional<z.ZodString>;
|
|
127
|
-
proofPurpose: z.ZodOptional<z.ZodString>;
|
|
128
|
-
proofValue: z.ZodOptional<z.ZodString>;
|
|
129
|
-
eip712: z.ZodOptional<z.ZodObject<{
|
|
130
|
-
domain: z.ZodOptional<z.ZodObject<{
|
|
131
|
-
chainId: z.ZodNumber;
|
|
132
|
-
name: z.ZodString;
|
|
133
|
-
version: z.ZodString;
|
|
134
|
-
}, z.core.$strip>>;
|
|
135
|
-
types: z.ZodOptional<z.ZodRecord<z.ZodAny, z.ZodAny>>;
|
|
136
|
-
primaryType: z.ZodOptional<z.ZodString>;
|
|
137
|
-
}, z.core.$strip>>;
|
|
138
|
-
}, z.core.$strip>]>;
|
|
139
|
-
}, z.core.$strip>>], null>;
|
|
140
|
-
export declare const IErrorSchema: z.ZodObject<{
|
|
141
|
-
message: z.ZodOptional<z.ZodString>;
|
|
142
|
-
errorCode: z.ZodOptional<z.ZodString>;
|
|
11
|
+
}, z.core.$strip>, z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
12
|
+
export declare const postMessagePayloadSchema: z.ZodObject<{
|
|
13
|
+
type: z.ZodLiteral<"JWT_TOKEN">;
|
|
14
|
+
token: z.ZodString;
|
|
143
15
|
}, z.core.$strip>;
|
|
144
|
-
export
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
errorCode: z.ZodOptional<z.ZodString>;
|
|
149
|
-
}, z.core.$strip>>;
|
|
150
|
-
}, z.core.$strip>>;
|
|
151
|
-
export declare const LoginVcMessageSchema: z.ZodObject<{
|
|
152
|
-
nonce: z.ZodString;
|
|
153
|
-
}, z.core.$strip>;
|
|
154
|
-
export declare const ResultSchema: <T extends z.ZodTypeAny>(dataSchema: T) => z.ZodUnion<readonly [z.ZodTuple<[z.ZodLiteral<true>, T], null>, z.ZodTuple<[z.ZodLiteral<false>, z.ZodString], null>]>;
|
|
155
|
-
export declare const JWESchema: z.ZodObject<{
|
|
156
|
-
protected: z.ZodString;
|
|
157
|
-
iv: z.ZodString;
|
|
158
|
-
ciphertext: z.ZodString;
|
|
159
|
-
tag: z.ZodString;
|
|
160
|
-
add: z.ZodOptional<z.ZodString>;
|
|
161
|
-
recipients: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
162
|
-
header: z.ZodObject<{
|
|
163
|
-
alg: z.ZodOptional<z.ZodString>;
|
|
164
|
-
iv: z.ZodOptional<z.ZodString>;
|
|
165
|
-
tag: z.ZodOptional<z.ZodString>;
|
|
166
|
-
epk: z.ZodOptional<z.ZodObject<{
|
|
167
|
-
kty: z.ZodOptional<z.ZodString>;
|
|
168
|
-
crv: z.ZodOptional<z.ZodString>;
|
|
169
|
-
x: z.ZodOptional<z.ZodString>;
|
|
170
|
-
y: z.ZodOptional<z.ZodString>;
|
|
171
|
-
n: z.ZodOptional<z.ZodString>;
|
|
172
|
-
e: z.ZodOptional<z.ZodString>;
|
|
173
|
-
}, z.core.$strip>>;
|
|
174
|
-
kid: z.ZodOptional<z.ZodString>;
|
|
175
|
-
apv: z.ZodOptional<z.ZodString>;
|
|
176
|
-
apu: z.ZodOptional<z.ZodString>;
|
|
177
|
-
}, z.core.$strip>;
|
|
178
|
-
encrypted_key: z.ZodString;
|
|
179
|
-
}, z.core.$strip>>>;
|
|
180
|
-
}, z.core.$strip>;
|
|
181
|
-
export declare const JwePayloadSchema: z.ZodObject<{
|
|
182
|
-
messageId: z.ZodString;
|
|
183
|
-
jwePayload: z.ZodObject<{
|
|
184
|
-
protected: z.ZodString;
|
|
185
|
-
iv: z.ZodString;
|
|
186
|
-
ciphertext: z.ZodString;
|
|
187
|
-
tag: z.ZodString;
|
|
188
|
-
add: z.ZodOptional<z.ZodString>;
|
|
189
|
-
recipients: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
190
|
-
header: z.ZodObject<{
|
|
191
|
-
alg: z.ZodOptional<z.ZodString>;
|
|
192
|
-
iv: z.ZodOptional<z.ZodString>;
|
|
193
|
-
tag: z.ZodOptional<z.ZodString>;
|
|
194
|
-
epk: z.ZodOptional<z.ZodObject<{
|
|
195
|
-
kty: z.ZodOptional<z.ZodString>;
|
|
196
|
-
crv: z.ZodOptional<z.ZodString>;
|
|
197
|
-
x: z.ZodOptional<z.ZodString>;
|
|
198
|
-
y: z.ZodOptional<z.ZodString>;
|
|
199
|
-
n: z.ZodOptional<z.ZodString>;
|
|
200
|
-
e: z.ZodOptional<z.ZodString>;
|
|
201
|
-
}, z.core.$strip>>;
|
|
202
|
-
kid: z.ZodOptional<z.ZodString>;
|
|
203
|
-
apv: z.ZodOptional<z.ZodString>;
|
|
204
|
-
apu: z.ZodOptional<z.ZodString>;
|
|
205
|
-
}, z.core.$strip>;
|
|
206
|
-
encrypted_key: z.ZodString;
|
|
207
|
-
}, z.core.$strip>>>;
|
|
208
|
-
}, z.core.$strip>;
|
|
209
|
-
}, z.core.$strip>;
|
|
210
|
-
export type JwePayload = {
|
|
211
|
-
messageId: string;
|
|
212
|
-
jwePayload: JWE;
|
|
213
|
-
};
|
|
214
|
-
export declare const DecryptedMessageResultSchema: z.ZodObject<{
|
|
215
|
-
isSuccess: z.ZodBoolean;
|
|
216
|
-
encryptedMessage: z.ZodString;
|
|
217
|
-
message: z.ZodString;
|
|
16
|
+
export type PostMessagePayload = z.infer<typeof postMessagePayloadSchema>;
|
|
17
|
+
export declare const nniPayloadSchema: z.ZodObject<{
|
|
18
|
+
nni_uuid: z.ZodString;
|
|
19
|
+
name: z.ZodString;
|
|
218
20
|
}, z.core.$strip>;
|
|
219
|
-
export
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
export declare const DecryptedDidCommMessageBodySchema: z.ZodObject<{
|
|
225
|
-
quote: z.ZodString;
|
|
21
|
+
export type nniPayload = z.infer<typeof nniPayloadSchema>;
|
|
22
|
+
export type ChargeFrequency = (typeof ChargeFrequency)[keyof typeof ChargeFrequency];
|
|
23
|
+
export declare const GisPointSchema: z.ZodObject<{
|
|
24
|
+
lat: z.ZodNumber;
|
|
25
|
+
lng: z.ZodNumber;
|
|
226
26
|
}, z.core.$strip>;
|
|
227
27
|
export declare const DIDCommQuoteMessageSchema: z.ZodObject<{
|
|
228
28
|
rfq_uuid: z.ZodUUID;
|
|
@@ -301,3 +101,47 @@ export declare const searchRequestSchema: z.ZodObject<{
|
|
|
301
101
|
rfq_uuid: z.ZodUUID;
|
|
302
102
|
created_at: z.ZodString;
|
|
303
103
|
}, z.core.$strip>;
|
|
104
|
+
export declare const jwtSchema: z.ZodString;
|
|
105
|
+
export type JwtToken = z.infer<typeof jwtSchema>;
|
|
106
|
+
export declare const supportedNetworkEnumSchema: z.ZodEnum<{
|
|
107
|
+
readonly holesky: "holesky";
|
|
108
|
+
readonly sepolia: "sepolia";
|
|
109
|
+
readonly lineaSepolia: "linea-sepolia";
|
|
110
|
+
}>;
|
|
111
|
+
export type NetworkId = z.infer<typeof supportedNetworkEnumSchema>;
|
|
112
|
+
declare const networkConfigSchema: z.ZodObject<{
|
|
113
|
+
name: z.ZodEnum<{
|
|
114
|
+
readonly holesky: "holesky";
|
|
115
|
+
readonly sepolia: "sepolia";
|
|
116
|
+
readonly lineaSepolia: "linea-sepolia";
|
|
117
|
+
}>;
|
|
118
|
+
registryAddress: z.ZodString;
|
|
119
|
+
intChainId: z.ZodNumber;
|
|
120
|
+
hexChainId: z.ZodString;
|
|
121
|
+
providers: z.ZodArray<z.ZodObject<{
|
|
122
|
+
name: z.ZodString;
|
|
123
|
+
rpcUrl: z.ZodString;
|
|
124
|
+
apiKeyRequired: z.ZodBoolean;
|
|
125
|
+
}, z.core.$strip>>;
|
|
126
|
+
}, z.core.$strip>;
|
|
127
|
+
export type NetworkConfig = z.infer<typeof networkConfigSchema>;
|
|
128
|
+
export declare const networksSchema: z.ZodRecord<z.ZodEnum<{
|
|
129
|
+
readonly holesky: "holesky";
|
|
130
|
+
readonly sepolia: "sepolia";
|
|
131
|
+
readonly lineaSepolia: "linea-sepolia";
|
|
132
|
+
}>, z.ZodObject<{
|
|
133
|
+
name: z.ZodEnum<{
|
|
134
|
+
readonly holesky: "holesky";
|
|
135
|
+
readonly sepolia: "sepolia";
|
|
136
|
+
readonly lineaSepolia: "linea-sepolia";
|
|
137
|
+
}>;
|
|
138
|
+
registryAddress: z.ZodString;
|
|
139
|
+
intChainId: z.ZodNumber;
|
|
140
|
+
hexChainId: z.ZodString;
|
|
141
|
+
providers: z.ZodArray<z.ZodObject<{
|
|
142
|
+
name: z.ZodString;
|
|
143
|
+
rpcUrl: z.ZodString;
|
|
144
|
+
apiKeyRequired: z.ZodBoolean;
|
|
145
|
+
}, z.core.$strip>>;
|
|
146
|
+
}, z.core.$strip>>;
|
|
147
|
+
export {};
|
package/televerse-utils/index.js
CHANGED
|
@@ -1,136 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.networksSchema = exports.supportedNetworkEnumSchema = exports.jwtSchema = exports.searchRequestSchema = exports.QuoteSchema = exports.DIDCommQuoteMessageSchema = exports.GisPointSchema = exports.nniPayloadSchema = exports.postMessagePayloadSchema = exports.postMessageSchema = exports.ChargeFrequency = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
|
-
exports.
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
message: zod_1.z.string().optional(),
|
|
14
|
-
});
|
|
15
|
-
exports.contextTypeSchema = zod_1.z.union([
|
|
16
|
-
zod_1.z.string(),
|
|
17
|
-
zod_1.z.record(zod_1.z.any(), zod_1.z.any()),
|
|
18
|
-
zod_1.z.array(zod_1.z.union([zod_1.z.string(), zod_1.z.record(zod_1.z.any(), zod_1.z.any())])),
|
|
19
|
-
]);
|
|
20
|
-
exports.credentialStatusReferenceSchema = zod_1.z.object({
|
|
21
|
-
id: zod_1.z.string(),
|
|
22
|
-
type: zod_1.z.string(),
|
|
23
|
-
});
|
|
24
|
-
// Derived from generated VC upon passing to veramo API with the payload
|
|
25
|
-
const credentialSchema = zod_1.z.object({
|
|
26
|
-
id: zod_1.z.string().optional(),
|
|
27
|
-
type: zod_1.z.string().optional(),
|
|
28
|
-
});
|
|
29
|
-
exports.unsignedCredentialSchema = zod_1.z.object({
|
|
30
|
-
issuer: exports.issuerTypeSchema,
|
|
31
|
-
credentialSubject: exports.credentialSubjectSchema,
|
|
32
|
-
credentialSchema: credentialSchema.optional(),
|
|
33
|
-
type: zod_1.z.union([zod_1.z.array(zod_1.z.string()), zod_1.z.string()]).optional(),
|
|
34
|
-
'@context': exports.contextTypeSchema,
|
|
35
|
-
issuanceDate: zod_1.z.string(),
|
|
36
|
-
expirationDate: zod_1.z.string().optional(),
|
|
37
|
-
credentialStatus: exports.credentialStatusReferenceSchema.optional(),
|
|
38
|
-
id: zod_1.z.string().optional(),
|
|
39
|
-
});
|
|
40
|
-
const jwtProofTypeSchema = zod_1.z.object({
|
|
41
|
-
type: zod_1.z.string().optional(),
|
|
42
|
-
jwt: zod_1.z.string().optional(),
|
|
43
|
-
});
|
|
44
|
-
const eip712ProofTypeSchema = zod_1.z.object({
|
|
5
|
+
exports.ChargeFrequency = {
|
|
6
|
+
DAILY: 'DAILY',
|
|
7
|
+
WEEKLY: 'WEEKLY',
|
|
8
|
+
MONTHLY: 'MONTHLY',
|
|
9
|
+
SEMIANNUALLY: 'SEMIANNUALLY',
|
|
10
|
+
ANNUALLY: 'ANNUALLY',
|
|
11
|
+
};
|
|
12
|
+
exports.postMessageSchema = zod_1.z.intersection(zod_1.z.object({
|
|
45
13
|
type: zod_1.z.string().optional(),
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
eip712: zod_1.z
|
|
51
|
-
.object({
|
|
52
|
-
domain: zod_1.z
|
|
53
|
-
.object({
|
|
54
|
-
chainId: zod_1.z.number(),
|
|
55
|
-
name: zod_1.z.string(),
|
|
56
|
-
version: zod_1.z.string(),
|
|
57
|
-
})
|
|
58
|
-
.optional(),
|
|
59
|
-
types: zod_1.z.record(zod_1.z.any(), zod_1.z.any()).optional(),
|
|
60
|
-
primaryType: zod_1.z.string().optional(),
|
|
61
|
-
})
|
|
62
|
-
.optional(),
|
|
63
|
-
});
|
|
64
|
-
exports.proofTypeSchema = zod_1.z.union([
|
|
65
|
-
jwtProofTypeSchema,
|
|
66
|
-
eip712ProofTypeSchema,
|
|
67
|
-
]);
|
|
68
|
-
exports.VerifiableCredentialSchema = exports.unsignedCredentialSchema.and(zod_1.z.object({
|
|
69
|
-
proof: exports.proofTypeSchema,
|
|
70
|
-
}));
|
|
71
|
-
exports.CreateSearchVcSchema = zod_1.z.tuple([
|
|
72
|
-
zod_1.z.string(),
|
|
73
|
-
exports.VerifiableCredentialSchema,
|
|
74
|
-
]);
|
|
75
|
-
exports.IErrorSchema = zod_1.z.object({
|
|
76
|
-
message: zod_1.z.string().optional(),
|
|
77
|
-
errorCode: zod_1.z.string().optional(),
|
|
14
|
+
}), zod_1.z.record(zod_1.z.string(), zod_1.z.any()));
|
|
15
|
+
exports.postMessagePayloadSchema = zod_1.z.object({
|
|
16
|
+
type: zod_1.z.literal('JWT_TOKEN'),
|
|
17
|
+
token: zod_1.z.string().min(1, 'JWT token cannot be empty.'),
|
|
78
18
|
});
|
|
79
|
-
exports.
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
}));
|
|
83
|
-
exports.LoginVcMessageSchema = zod_1.z.object({
|
|
84
|
-
nonce: zod_1.z.string(),
|
|
19
|
+
exports.nniPayloadSchema = zod_1.z.object({
|
|
20
|
+
nni_uuid: zod_1.z.string(),
|
|
21
|
+
name: zod_1.z.string(),
|
|
85
22
|
});
|
|
86
|
-
|
|
87
|
-
zod_1.z.tuple([zod_1.z.literal(true), dataSchema]),
|
|
88
|
-
zod_1.z.tuple([zod_1.z.literal(false), zod_1.z.string()]),
|
|
89
|
-
]);
|
|
90
|
-
exports.ResultSchema = ResultSchema;
|
|
91
|
-
const EphemeralPublicKeySchema = zod_1.z.object({
|
|
92
|
-
kty: zod_1.z.string().optional(),
|
|
93
|
-
crv: zod_1.z.string().optional(),
|
|
94
|
-
x: zod_1.z.string().optional(),
|
|
95
|
-
y: zod_1.z.string().optional(),
|
|
96
|
-
n: zod_1.z.string().optional(),
|
|
97
|
-
e: zod_1.z.string().optional(),
|
|
98
|
-
});
|
|
99
|
-
const RecipientHeaderSchema = zod_1.z.object({
|
|
100
|
-
alg: zod_1.z.string().optional(),
|
|
101
|
-
iv: zod_1.z.string().optional(),
|
|
102
|
-
tag: zod_1.z.string().optional(),
|
|
103
|
-
epk: EphemeralPublicKeySchema.optional(),
|
|
104
|
-
kid: zod_1.z.string().optional(),
|
|
105
|
-
apv: zod_1.z.string().optional(),
|
|
106
|
-
apu: zod_1.z.string().optional(),
|
|
107
|
-
});
|
|
108
|
-
const RecipientSchema = zod_1.z.object({
|
|
109
|
-
header: RecipientHeaderSchema,
|
|
110
|
-
encrypted_key: zod_1.z.string(),
|
|
111
|
-
});
|
|
112
|
-
exports.JWESchema = zod_1.z.object({
|
|
113
|
-
protected: zod_1.z.string(),
|
|
114
|
-
iv: zod_1.z.string(),
|
|
115
|
-
ciphertext: zod_1.z.string(),
|
|
116
|
-
tag: zod_1.z.string(),
|
|
117
|
-
add: zod_1.z.string().optional(),
|
|
118
|
-
recipients: zod_1.z.array(RecipientSchema).optional(),
|
|
119
|
-
});
|
|
120
|
-
exports.JwePayloadSchema = zod_1.z.object({
|
|
121
|
-
messageId: zod_1.z.string(),
|
|
122
|
-
jwePayload: exports.JWESchema,
|
|
123
|
-
});
|
|
124
|
-
exports.DecryptedMessageResultSchema = zod_1.z.object({
|
|
125
|
-
isSuccess: zod_1.z.boolean(),
|
|
126
|
-
encryptedMessage: zod_1.z.string(),
|
|
127
|
-
message: zod_1.z.string(),
|
|
128
|
-
});
|
|
129
|
-
exports.DecryptedMessageListResultSchema = zod_1.z.array(exports.DecryptedMessageResultSchema);
|
|
130
|
-
exports.DecryptedDidCommMessageBodySchema = zod_1.z.object({
|
|
131
|
-
quote: zod_1.z.string(),
|
|
132
|
-
});
|
|
133
|
-
const GisPointSchema = zod_1.z.object({ lat: zod_1.z.number(), lng: zod_1.z.number() });
|
|
23
|
+
exports.GisPointSchema = zod_1.z.object({ lat: zod_1.z.number(), lng: zod_1.z.number() });
|
|
134
24
|
exports.DIDCommQuoteMessageSchema = zod_1.z.object({
|
|
135
25
|
rfq_uuid: zod_1.z.uuid(),
|
|
136
26
|
quote_uuid: zod_1.z.uuid(),
|
|
@@ -146,7 +36,7 @@ exports.DIDCommQuoteMessageSchema = zod_1.z.object({
|
|
|
146
36
|
usage_charge: zod_1.z.number(),
|
|
147
37
|
escrow_dole_schedule: zod_1.z.number(),
|
|
148
38
|
escrow_settlement_schedule: zod_1.z.number(),
|
|
149
|
-
gis_data: zod_1.z.array(GisPointSchema),
|
|
39
|
+
gis_data: zod_1.z.array(exports.GisPointSchema),
|
|
150
40
|
contract_period: zod_1.z.number(),
|
|
151
41
|
});
|
|
152
42
|
exports.QuoteSchema = exports.DIDCommQuoteMessageSchema.and(zod_1.z.object({
|
|
@@ -157,15 +47,8 @@ exports.QuoteSchema = exports.DIDCommQuoteMessageSchema.and(zod_1.z.object({
|
|
|
157
47
|
}));
|
|
158
48
|
const SearchPointSchema = zod_1.z.object({
|
|
159
49
|
uuid: zod_1.z.uuid(),
|
|
160
|
-
coordinate: GisPointSchema,
|
|
50
|
+
coordinate: exports.GisPointSchema,
|
|
161
51
|
});
|
|
162
|
-
const ChargeFrequency = {
|
|
163
|
-
DAILY: 'DAILY',
|
|
164
|
-
WEEKLY: 'WEEKLY',
|
|
165
|
-
MONTHLY: 'MONTHLY',
|
|
166
|
-
SEMIANNUALLY: 'SEMIANNUALLY',
|
|
167
|
-
ANNUALLY: 'ANNUALLY',
|
|
168
|
-
};
|
|
169
52
|
// TODO: This is build on the fly to verify for RFQ table
|
|
170
53
|
exports.searchRequestSchema = zod_1.z.object({
|
|
171
54
|
service_type: zod_1.z.string(),
|
|
@@ -173,7 +56,38 @@ exports.searchRequestSchema = zod_1.z.object({
|
|
|
173
56
|
dest_point: SearchPointSchema,
|
|
174
57
|
speed: zod_1.z.number(),
|
|
175
58
|
contract_period: zod_1.z.number(),
|
|
176
|
-
charge_frequency: zod_1.z.enum(ChargeFrequency),
|
|
59
|
+
charge_frequency: zod_1.z.enum(exports.ChargeFrequency),
|
|
177
60
|
rfq_uuid: zod_1.z.uuid(),
|
|
178
61
|
created_at: zod_1.z.string(),
|
|
179
62
|
});
|
|
63
|
+
exports.jwtSchema = zod_1.z
|
|
64
|
+
.string()
|
|
65
|
+
.regex(/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+$/, 'Invalid JWT format');
|
|
66
|
+
const supportedNetworks = {
|
|
67
|
+
holesky: 'holesky',
|
|
68
|
+
sepolia: 'sepolia',
|
|
69
|
+
lineaSepolia: 'linea-sepolia',
|
|
70
|
+
};
|
|
71
|
+
exports.supportedNetworkEnumSchema = zod_1.z.enum(supportedNetworks);
|
|
72
|
+
const networkProviderSchema = zod_1.z.object({
|
|
73
|
+
name: zod_1.z.string().min(1),
|
|
74
|
+
rpcUrl: zod_1.z.string().min(1),
|
|
75
|
+
apiKeyRequired: zod_1.z.boolean(),
|
|
76
|
+
});
|
|
77
|
+
const networkConfigSchema = zod_1.z
|
|
78
|
+
.object({
|
|
79
|
+
name: exports.supportedNetworkEnumSchema,
|
|
80
|
+
registryAddress: zod_1.z.string().startsWith('0x'),
|
|
81
|
+
intChainId: zod_1.z.number(),
|
|
82
|
+
hexChainId: zod_1.z.string().startsWith('0x'),
|
|
83
|
+
providers: zod_1.z.array(networkProviderSchema),
|
|
84
|
+
})
|
|
85
|
+
.refine((val) => {
|
|
86
|
+
const { intChainId, hexChainId } = val;
|
|
87
|
+
// Convert hex chain id to number
|
|
88
|
+
const hexInInt = parseInt(hexChainId, 16);
|
|
89
|
+
return !isNaN(hexInInt) && hexInInt === intChainId;
|
|
90
|
+
}, {
|
|
91
|
+
message: 'hexChainId does not match intChainId',
|
|
92
|
+
});
|
|
93
|
+
exports.networksSchema = zod_1.z.record(exports.supportedNetworkEnumSchema, networkConfigSchema);
|