televerse-dao-typechain-types 1.0.8-alpha.0 → 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 +2 -2
- package/televerse-utils/index.d.ts +147 -0
- package/televerse-utils/index.js +93 -0
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "televerse-dao-typechain-types",
|
|
3
3
|
"sourceType": "commonjs",
|
|
4
|
-
"version": "1.0.8-alpha.
|
|
4
|
+
"version": "1.0.8-alpha.2",
|
|
5
5
|
"description": "The typechain types for the Televerse DAO smart contracts.",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"files": [
|
|
8
8
|
"typechain-types",
|
|
9
|
-
"utils"
|
|
9
|
+
"televerse-utils"
|
|
10
10
|
],
|
|
11
11
|
"main": "typechain-types/index.js",
|
|
12
12
|
"types": "typechain-types/index.d.ts",
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
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<{
|
|
10
|
+
type: 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;
|
|
15
|
+
}, z.core.$strip>;
|
|
16
|
+
export type PostMessagePayload = z.infer<typeof postMessagePayloadSchema>;
|
|
17
|
+
export declare const nniPayloadSchema: z.ZodObject<{
|
|
18
|
+
nni_uuid: z.ZodString;
|
|
19
|
+
name: z.ZodString;
|
|
20
|
+
}, z.core.$strip>;
|
|
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;
|
|
26
|
+
}, z.core.$strip>;
|
|
27
|
+
export declare const DIDCommQuoteMessageSchema: z.ZodObject<{
|
|
28
|
+
rfq_uuid: z.ZodUUID;
|
|
29
|
+
quote_uuid: z.ZodUUID;
|
|
30
|
+
start_point_uuid: z.ZodString;
|
|
31
|
+
start_point_other_uuid: z.ZodOptional<z.ZodString>;
|
|
32
|
+
end_point_uuid: z.ZodString;
|
|
33
|
+
end_point_other_uuid: z.ZodOptional<z.ZodString>;
|
|
34
|
+
validity_time: z.ZodNumber;
|
|
35
|
+
created_at: z.ZodString;
|
|
36
|
+
lead_time: z.ZodNumber;
|
|
37
|
+
initial_charge: z.ZodNumber;
|
|
38
|
+
recurring_charge: z.ZodNumber;
|
|
39
|
+
usage_charge: z.ZodNumber;
|
|
40
|
+
escrow_dole_schedule: z.ZodNumber;
|
|
41
|
+
escrow_settlement_schedule: z.ZodNumber;
|
|
42
|
+
gis_data: z.ZodArray<z.ZodObject<{
|
|
43
|
+
lat: z.ZodNumber;
|
|
44
|
+
lng: z.ZodNumber;
|
|
45
|
+
}, z.core.$strip>>;
|
|
46
|
+
contract_period: z.ZodNumber;
|
|
47
|
+
}, z.core.$strip>;
|
|
48
|
+
export type DIDCommQuotePayload = z.infer<typeof DIDCommQuoteMessageSchema>;
|
|
49
|
+
export declare const QuoteSchema: z.ZodIntersection<z.ZodObject<{
|
|
50
|
+
rfq_uuid: z.ZodUUID;
|
|
51
|
+
quote_uuid: z.ZodUUID;
|
|
52
|
+
start_point_uuid: z.ZodString;
|
|
53
|
+
start_point_other_uuid: z.ZodOptional<z.ZodString>;
|
|
54
|
+
end_point_uuid: z.ZodString;
|
|
55
|
+
end_point_other_uuid: z.ZodOptional<z.ZodString>;
|
|
56
|
+
validity_time: z.ZodNumber;
|
|
57
|
+
created_at: z.ZodString;
|
|
58
|
+
lead_time: z.ZodNumber;
|
|
59
|
+
initial_charge: z.ZodNumber;
|
|
60
|
+
recurring_charge: z.ZodNumber;
|
|
61
|
+
usage_charge: z.ZodNumber;
|
|
62
|
+
escrow_dole_schedule: z.ZodNumber;
|
|
63
|
+
escrow_settlement_schedule: z.ZodNumber;
|
|
64
|
+
gis_data: z.ZodArray<z.ZodObject<{
|
|
65
|
+
lat: z.ZodNumber;
|
|
66
|
+
lng: z.ZodNumber;
|
|
67
|
+
}, z.core.$strip>>;
|
|
68
|
+
contract_period: z.ZodNumber;
|
|
69
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
70
|
+
date: z.ZodString;
|
|
71
|
+
solutionProvider: z.ZodString;
|
|
72
|
+
hashHex: z.ZodString;
|
|
73
|
+
encryptedMessage: z.ZodString;
|
|
74
|
+
}, z.core.$strip>>;
|
|
75
|
+
export type Rfq = z.infer<typeof searchRequestSchema>;
|
|
76
|
+
export declare const searchRequestSchema: z.ZodObject<{
|
|
77
|
+
service_type: z.ZodString;
|
|
78
|
+
src_point: z.ZodObject<{
|
|
79
|
+
uuid: z.ZodUUID;
|
|
80
|
+
coordinate: z.ZodObject<{
|
|
81
|
+
lat: z.ZodNumber;
|
|
82
|
+
lng: z.ZodNumber;
|
|
83
|
+
}, z.core.$strip>;
|
|
84
|
+
}, z.core.$strip>;
|
|
85
|
+
dest_point: z.ZodObject<{
|
|
86
|
+
uuid: z.ZodUUID;
|
|
87
|
+
coordinate: z.ZodObject<{
|
|
88
|
+
lat: z.ZodNumber;
|
|
89
|
+
lng: z.ZodNumber;
|
|
90
|
+
}, z.core.$strip>;
|
|
91
|
+
}, z.core.$strip>;
|
|
92
|
+
speed: z.ZodNumber;
|
|
93
|
+
contract_period: z.ZodNumber;
|
|
94
|
+
charge_frequency: z.ZodEnum<{
|
|
95
|
+
readonly DAILY: "DAILY";
|
|
96
|
+
readonly WEEKLY: "WEEKLY";
|
|
97
|
+
readonly MONTHLY: "MONTHLY";
|
|
98
|
+
readonly SEMIANNUALLY: "SEMIANNUALLY";
|
|
99
|
+
readonly ANNUALLY: "ANNUALLY";
|
|
100
|
+
}>;
|
|
101
|
+
rfq_uuid: z.ZodUUID;
|
|
102
|
+
created_at: z.ZodString;
|
|
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 {};
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
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
|
+
const zod_1 = require("zod");
|
|
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({
|
|
13
|
+
type: 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.'),
|
|
18
|
+
});
|
|
19
|
+
exports.nniPayloadSchema = zod_1.z.object({
|
|
20
|
+
nni_uuid: zod_1.z.string(),
|
|
21
|
+
name: zod_1.z.string(),
|
|
22
|
+
});
|
|
23
|
+
exports.GisPointSchema = zod_1.z.object({ lat: zod_1.z.number(), lng: zod_1.z.number() });
|
|
24
|
+
exports.DIDCommQuoteMessageSchema = zod_1.z.object({
|
|
25
|
+
rfq_uuid: zod_1.z.uuid(),
|
|
26
|
+
quote_uuid: zod_1.z.uuid(),
|
|
27
|
+
start_point_uuid: zod_1.z.string(),
|
|
28
|
+
start_point_other_uuid: zod_1.z.string().optional(),
|
|
29
|
+
end_point_uuid: zod_1.z.string(),
|
|
30
|
+
end_point_other_uuid: zod_1.z.string().optional(),
|
|
31
|
+
validity_time: zod_1.z.number(),
|
|
32
|
+
created_at: zod_1.z.string(),
|
|
33
|
+
lead_time: zod_1.z.number(),
|
|
34
|
+
initial_charge: zod_1.z.number(),
|
|
35
|
+
recurring_charge: zod_1.z.number(),
|
|
36
|
+
usage_charge: zod_1.z.number(),
|
|
37
|
+
escrow_dole_schedule: zod_1.z.number(),
|
|
38
|
+
escrow_settlement_schedule: zod_1.z.number(),
|
|
39
|
+
gis_data: zod_1.z.array(exports.GisPointSchema),
|
|
40
|
+
contract_period: zod_1.z.number(),
|
|
41
|
+
});
|
|
42
|
+
exports.QuoteSchema = exports.DIDCommQuoteMessageSchema.and(zod_1.z.object({
|
|
43
|
+
date: zod_1.z.string(),
|
|
44
|
+
solutionProvider: zod_1.z.string(),
|
|
45
|
+
hashHex: zod_1.z.string(),
|
|
46
|
+
encryptedMessage: zod_1.z.string(),
|
|
47
|
+
}));
|
|
48
|
+
const SearchPointSchema = zod_1.z.object({
|
|
49
|
+
uuid: zod_1.z.uuid(),
|
|
50
|
+
coordinate: exports.GisPointSchema,
|
|
51
|
+
});
|
|
52
|
+
// TODO: This is build on the fly to verify for RFQ table
|
|
53
|
+
exports.searchRequestSchema = zod_1.z.object({
|
|
54
|
+
service_type: zod_1.z.string(),
|
|
55
|
+
src_point: SearchPointSchema,
|
|
56
|
+
dest_point: SearchPointSchema,
|
|
57
|
+
speed: zod_1.z.number(),
|
|
58
|
+
contract_period: zod_1.z.number(),
|
|
59
|
+
charge_frequency: zod_1.z.enum(exports.ChargeFrequency),
|
|
60
|
+
rfq_uuid: zod_1.z.uuid(),
|
|
61
|
+
created_at: zod_1.z.string(),
|
|
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);
|