@halot/sdk 1.0.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/README.md +243 -0
- package/dist/auth/actor.d.ts +17 -0
- package/dist/auth/actor.js +33 -0
- package/dist/auth/attestation.d.ts +24 -0
- package/dist/auth/attestation.js +47 -0
- package/dist/client/halot-client.d.ts +37 -0
- package/dist/client/halot-client.js +89 -0
- package/dist/client/index.d.ts +2 -0
- package/dist/client/index.js +5 -0
- package/dist/config.d.ts +2 -0
- package/dist/config.js +11 -0
- package/dist/index.d.ts +26 -0
- package/dist/index.js +43 -0
- package/dist/middleware/aggregator-client.d.ts +8 -0
- package/dist/middleware/aggregator-client.js +49 -0
- package/dist/middleware/halot.d.ts +4 -0
- package/dist/middleware/halot.js +142 -0
- package/dist/middleware/index.d.ts +2 -0
- package/dist/middleware/index.js +5 -0
- package/dist/middleware/types.d.ts +45 -0
- package/dist/middleware/types.js +2 -0
- package/dist/types/common.d.ts +90 -0
- package/dist/types/common.js +66 -0
- package/dist/types/job.d.ts +232 -0
- package/dist/types/job.js +125 -0
- package/dist/types/provider.d.ts +160 -0
- package/dist/types/provider.js +45 -0
- package/dist/types/quote.d.ts +43 -0
- package/dist/types/quote.js +31 -0
- package/dist/types/requester.d.ts +15 -0
- package/dist/types/requester.js +15 -0
- package/dist/types/service.d.ts +140 -0
- package/dist/types/service.js +48 -0
- package/dist/types/verifier.d.ts +144 -0
- package/dist/types/verifier.js +78 -0
- package/dist/types/x402.d.ts +31 -0
- package/dist/types/x402.js +27 -0
- package/dist/utils/amount.d.ts +2 -0
- package/dist/utils/amount.js +11 -0
- package/dist/utils/artifacts.d.ts +42 -0
- package/dist/utils/artifacts.js +378 -0
- package/dist/utils/category.d.ts +4 -0
- package/dist/utils/category.js +25 -0
- package/dist/utils/date.d.ts +2 -0
- package/dist/utils/date.js +10 -0
- package/dist/utils/hash.d.ts +4 -0
- package/dist/utils/hash.js +27 -0
- package/dist/utils/id.d.ts +1 -0
- package/dist/utils/id.js +7 -0
- package/dist/utils/json-file.d.ts +3 -0
- package/dist/utils/json-file.js +20 -0
- package/dist/utils/schema.d.ts +5 -0
- package/dist/utils/schema.js +66 -0
- package/dist/x402/payment.d.ts +11 -0
- package/dist/x402/payment.js +68 -0
- package/dist/zero-g/compute.d.ts +53 -0
- package/dist/zero-g/compute.js +249 -0
- package/dist/zero-g/storage.d.ts +28 -0
- package/dist/zero-g/storage.js +93 -0
- package/package.json +66 -0
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.JobSchema = exports.SettlementSchema = exports.SettlementStateSchema = exports.AttestationSchema = exports.JobResultSchema = exports.PreparedJobSchema = exports.PreparedVerifierSchema = exports.TeeProofSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const common_1 = require("./common");
|
|
6
|
+
const quote_1 = require("./quote");
|
|
7
|
+
exports.TeeProofSchema = zod_1.z.object({
|
|
8
|
+
chatId: zod_1.z.string(),
|
|
9
|
+
digest: zod_1.z.string(),
|
|
10
|
+
signature: zod_1.z.string(),
|
|
11
|
+
signerAddress: zod_1.z.string(),
|
|
12
|
+
signatureUrl: zod_1.z.string().optional(),
|
|
13
|
+
providerAddress: zod_1.z.string().optional(),
|
|
14
|
+
});
|
|
15
|
+
exports.PreparedVerifierSchema = zod_1.z.object({
|
|
16
|
+
verifierId: zod_1.z.string(),
|
|
17
|
+
ownerAddress: zod_1.z.string(),
|
|
18
|
+
signingPublicKey: zod_1.z.string(),
|
|
19
|
+
payoutAddress: zod_1.z.string(),
|
|
20
|
+
});
|
|
21
|
+
exports.PreparedJobSchema = zod_1.z.object({
|
|
22
|
+
prepareId: zod_1.z.string(),
|
|
23
|
+
quoteId: zod_1.z.string(),
|
|
24
|
+
assignmentSeed: zod_1.z.string(),
|
|
25
|
+
trustLevel: zod_1.z.string().optional().default('standard'),
|
|
26
|
+
jobHash: zod_1.z.string(),
|
|
27
|
+
serviceId: zod_1.z.string(),
|
|
28
|
+
providerId: zod_1.z.string(),
|
|
29
|
+
requesterAddress: zod_1.z.string(),
|
|
30
|
+
paymentNetwork: zod_1.z.string(),
|
|
31
|
+
paymentToken: zod_1.z.string(),
|
|
32
|
+
settlementContractAddress: zod_1.z.string(),
|
|
33
|
+
settlementTokenAddress: zod_1.z.string(),
|
|
34
|
+
settlementTokenDecimals: zod_1.z.number().int().positive(),
|
|
35
|
+
providerPayoutAddress: zod_1.z.string(),
|
|
36
|
+
providerAmount: zod_1.z.string(),
|
|
37
|
+
providerAmountUnits: zod_1.z.string(),
|
|
38
|
+
verifierFee: zod_1.z.string(),
|
|
39
|
+
verifierFeeUnits: zod_1.z.string(),
|
|
40
|
+
computeFee: zod_1.z.string(),
|
|
41
|
+
computeFeeUnits: zod_1.z.string(),
|
|
42
|
+
verifierPool: zod_1.z.string(),
|
|
43
|
+
verifierPoolUnits: zod_1.z.string(),
|
|
44
|
+
platformFee: zod_1.z.string(),
|
|
45
|
+
platformFeeUnits: zod_1.z.string(),
|
|
46
|
+
totalAmount: zod_1.z.string(),
|
|
47
|
+
totalAmountUnits: zod_1.z.string(),
|
|
48
|
+
threshold: zod_1.z.number().int().positive(),
|
|
49
|
+
selectedVerifierIds: zod_1.z.array(zod_1.z.string()).min(1),
|
|
50
|
+
assignedVerifiers: zod_1.z.array(exports.PreparedVerifierSchema).min(1),
|
|
51
|
+
input: zod_1.z.any(),
|
|
52
|
+
createdAt: zod_1.z.string(),
|
|
53
|
+
});
|
|
54
|
+
exports.JobResultSchema = zod_1.z.object({
|
|
55
|
+
resultHash: zod_1.z.string(),
|
|
56
|
+
output: zod_1.z.any(),
|
|
57
|
+
submittedAt: zod_1.z.string(),
|
|
58
|
+
});
|
|
59
|
+
exports.AttestationSchema = zod_1.z.object({
|
|
60
|
+
attestationId: zod_1.z.string(),
|
|
61
|
+
attestationHash: zod_1.z.string(),
|
|
62
|
+
jobHash: zod_1.z.string(),
|
|
63
|
+
resultHash: zod_1.z.string(),
|
|
64
|
+
verifierId: zod_1.z.string(),
|
|
65
|
+
verifierAddress: zod_1.z.string(),
|
|
66
|
+
decision: common_1.DecisionSchema,
|
|
67
|
+
confidence: zod_1.z.number().min(0).max(1),
|
|
68
|
+
reason: zod_1.z.string(),
|
|
69
|
+
failedCriteria: zod_1.z.array(zod_1.z.string()),
|
|
70
|
+
teeVerified: zod_1.z.boolean(),
|
|
71
|
+
teeProof: exports.TeeProofSchema,
|
|
72
|
+
verifierSignature: zod_1.z.string(),
|
|
73
|
+
createdAt: zod_1.z.string(),
|
|
74
|
+
});
|
|
75
|
+
exports.SettlementStateSchema = zod_1.z.enum(['pending', 'submitted', 'confirmed', 'failed']);
|
|
76
|
+
exports.SettlementSchema = zod_1.z.object({
|
|
77
|
+
network: zod_1.z.string(),
|
|
78
|
+
contractAddress: zod_1.z.string(),
|
|
79
|
+
decision: common_1.DecisionSchema,
|
|
80
|
+
threshold: zod_1.z.number().int().positive(),
|
|
81
|
+
approvals: zod_1.z.number().int().nonnegative(),
|
|
82
|
+
rejections: zod_1.z.number().int().nonnegative(),
|
|
83
|
+
providerPayout: zod_1.z.string(),
|
|
84
|
+
verifierPayout: zod_1.z.string(),
|
|
85
|
+
requesterRefund: zod_1.z.string(),
|
|
86
|
+
platformFee: zod_1.z.string(),
|
|
87
|
+
state: exports.SettlementStateSchema,
|
|
88
|
+
transactionHash: zod_1.z.string().optional(),
|
|
89
|
+
submittedAt: zod_1.z.string().optional(),
|
|
90
|
+
settledAt: zod_1.z.string().optional(),
|
|
91
|
+
confirmedAt: zod_1.z.string().optional(),
|
|
92
|
+
blockNumber: zod_1.z.number().int().nonnegative().optional(),
|
|
93
|
+
ledger: zod_1.z.string().optional(),
|
|
94
|
+
error: zod_1.z.string().optional(),
|
|
95
|
+
});
|
|
96
|
+
exports.JobSchema = zod_1.z.object({
|
|
97
|
+
jobId: zod_1.z.string(),
|
|
98
|
+
quoteId: zod_1.z.string(),
|
|
99
|
+
assignmentSeed: zod_1.z.string(),
|
|
100
|
+
trustLevel: zod_1.z.string().optional().default('standard'),
|
|
101
|
+
jobHash: zod_1.z.string(),
|
|
102
|
+
serviceId: zod_1.z.string(),
|
|
103
|
+
providerId: zod_1.z.string(),
|
|
104
|
+
requesterAddress: zod_1.z.string(),
|
|
105
|
+
paymentNetwork: zod_1.z.string(),
|
|
106
|
+
paymentToken: zod_1.z.string(),
|
|
107
|
+
settlementContractAddress: zod_1.z.string(),
|
|
108
|
+
settlementTokenAddress: zod_1.z.string(),
|
|
109
|
+
settlementTokenDecimals: zod_1.z.number().int().positive(),
|
|
110
|
+
totalAmount: zod_1.z.string(),
|
|
111
|
+
breakdown: quote_1.QuoteBreakdownSchema,
|
|
112
|
+
currency: zod_1.z.string(),
|
|
113
|
+
input: zod_1.z.any(),
|
|
114
|
+
status: common_1.JobStatusSchema,
|
|
115
|
+
selectedVerifierIds: zod_1.z.array(zod_1.z.string()),
|
|
116
|
+
createdAt: zod_1.z.string(),
|
|
117
|
+
updatedAt: zod_1.z.string(),
|
|
118
|
+
fundedAt: zod_1.z.string(),
|
|
119
|
+
fundingTransactionHash: zod_1.z.string(),
|
|
120
|
+
fundingBlockNumber: zod_1.z.number().int().nonnegative().optional(),
|
|
121
|
+
fundingLedger: zod_1.z.string().optional(),
|
|
122
|
+
result: exports.JobResultSchema.optional(),
|
|
123
|
+
attestations: zod_1.z.array(exports.AttestationSchema).default([]),
|
|
124
|
+
settlement: exports.SettlementSchema.optional(),
|
|
125
|
+
});
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const ProviderIdentitySchema: z.ZodObject<{
|
|
3
|
+
erc8004TokenId: z.ZodDefault<z.ZodString>;
|
|
4
|
+
agentRegistry: z.ZodDefault<z.ZodString>;
|
|
5
|
+
agentUri: z.ZodDefault<z.ZodString>;
|
|
6
|
+
ownerAddress: z.ZodDefault<z.ZodString>;
|
|
7
|
+
domain: z.ZodString;
|
|
8
|
+
domainType: z.ZodDefault<z.ZodString>;
|
|
9
|
+
}, z.core.$strip>;
|
|
10
|
+
export declare const ProviderConfigSchema: z.ZodObject<{
|
|
11
|
+
providerId: z.ZodDefault<z.ZodString>;
|
|
12
|
+
displayName: z.ZodString;
|
|
13
|
+
description: z.ZodString;
|
|
14
|
+
version: z.ZodString;
|
|
15
|
+
identity: z.ZodObject<{
|
|
16
|
+
erc8004TokenId: z.ZodDefault<z.ZodString>;
|
|
17
|
+
agentRegistry: z.ZodDefault<z.ZodString>;
|
|
18
|
+
agentUri: z.ZodDefault<z.ZodString>;
|
|
19
|
+
ownerAddress: z.ZodDefault<z.ZodString>;
|
|
20
|
+
domain: z.ZodString;
|
|
21
|
+
domainType: z.ZodDefault<z.ZodString>;
|
|
22
|
+
}, z.core.$strip>;
|
|
23
|
+
authority: z.ZodObject<{
|
|
24
|
+
path: z.ZodDefault<z.ZodString>;
|
|
25
|
+
actor: z.ZodEnum<{
|
|
26
|
+
"0g:testnet": "0g:testnet";
|
|
27
|
+
"0g:mainnet": "0g:mainnet";
|
|
28
|
+
"stellar:testnet": "stellar:testnet";
|
|
29
|
+
"stellar:mainnet": "stellar:mainnet";
|
|
30
|
+
}>;
|
|
31
|
+
}, z.core.$strip>;
|
|
32
|
+
settlementWallets: z.ZodObject<{
|
|
33
|
+
'0g:testnet': z.ZodDefault<z.ZodString>;
|
|
34
|
+
'0g:mainnet': z.ZodDefault<z.ZodString>;
|
|
35
|
+
'stellar:testnet': z.ZodDefault<z.ZodString>;
|
|
36
|
+
'stellar:mainnet': z.ZodDefault<z.ZodString>;
|
|
37
|
+
}, z.core.$strip>;
|
|
38
|
+
}, z.core.$strip>;
|
|
39
|
+
export declare const RegisteredProviderSchema: z.ZodObject<{
|
|
40
|
+
displayName: z.ZodString;
|
|
41
|
+
description: z.ZodString;
|
|
42
|
+
version: z.ZodString;
|
|
43
|
+
identity: z.ZodObject<{
|
|
44
|
+
erc8004TokenId: z.ZodDefault<z.ZodString>;
|
|
45
|
+
agentRegistry: z.ZodDefault<z.ZodString>;
|
|
46
|
+
agentUri: z.ZodDefault<z.ZodString>;
|
|
47
|
+
ownerAddress: z.ZodDefault<z.ZodString>;
|
|
48
|
+
domain: z.ZodString;
|
|
49
|
+
domainType: z.ZodDefault<z.ZodString>;
|
|
50
|
+
}, z.core.$strip>;
|
|
51
|
+
authority: z.ZodObject<{
|
|
52
|
+
path: z.ZodDefault<z.ZodString>;
|
|
53
|
+
actor: z.ZodEnum<{
|
|
54
|
+
"0g:testnet": "0g:testnet";
|
|
55
|
+
"0g:mainnet": "0g:mainnet";
|
|
56
|
+
"stellar:testnet": "stellar:testnet";
|
|
57
|
+
"stellar:mainnet": "stellar:mainnet";
|
|
58
|
+
}>;
|
|
59
|
+
}, z.core.$strip>;
|
|
60
|
+
settlementWallets: z.ZodObject<{
|
|
61
|
+
'0g:testnet': z.ZodDefault<z.ZodString>;
|
|
62
|
+
'0g:mainnet': z.ZodDefault<z.ZodString>;
|
|
63
|
+
'stellar:testnet': z.ZodDefault<z.ZodString>;
|
|
64
|
+
'stellar:mainnet': z.ZodDefault<z.ZodString>;
|
|
65
|
+
}, z.core.$strip>;
|
|
66
|
+
providerId: z.ZodString;
|
|
67
|
+
ownerAddress: z.ZodString;
|
|
68
|
+
rootHash: z.ZodString;
|
|
69
|
+
anchor: z.ZodObject<{
|
|
70
|
+
network: z.ZodEnum<{
|
|
71
|
+
"0g:testnet": "0g:testnet";
|
|
72
|
+
"0g:mainnet": "0g:mainnet";
|
|
73
|
+
"stellar:testnet": "stellar:testnet";
|
|
74
|
+
"stellar:mainnet": "stellar:mainnet";
|
|
75
|
+
}>;
|
|
76
|
+
registryAddress: z.ZodString;
|
|
77
|
+
transactionHash: z.ZodString;
|
|
78
|
+
anchoredAt: z.ZodString;
|
|
79
|
+
}, z.core.$strip>;
|
|
80
|
+
serviceCount: z.ZodNumber;
|
|
81
|
+
services: z.ZodArray<z.ZodObject<{
|
|
82
|
+
name: z.ZodString;
|
|
83
|
+
description: z.ZodString;
|
|
84
|
+
version: z.ZodString;
|
|
85
|
+
category: z.ZodEnum<{
|
|
86
|
+
text: "text";
|
|
87
|
+
code: "code";
|
|
88
|
+
image: "image";
|
|
89
|
+
audio: "audio";
|
|
90
|
+
video: "video";
|
|
91
|
+
document: "document";
|
|
92
|
+
tool: "tool";
|
|
93
|
+
workflow: "workflow";
|
|
94
|
+
}>;
|
|
95
|
+
trustLevel: z.ZodDefault<z.ZodEnum<{
|
|
96
|
+
standard: "standard";
|
|
97
|
+
thorough: "thorough";
|
|
98
|
+
critical: "critical";
|
|
99
|
+
auto: "auto";
|
|
100
|
+
}>>;
|
|
101
|
+
endpoint: z.ZodObject<{
|
|
102
|
+
health: z.ZodString;
|
|
103
|
+
execution: z.ZodOptional<z.ZodString>;
|
|
104
|
+
}, z.core.$strip>;
|
|
105
|
+
pricing: z.ZodObject<{
|
|
106
|
+
baseFee: z.ZodString;
|
|
107
|
+
currency: z.ZodDefault<z.ZodString>;
|
|
108
|
+
model: z.ZodDefault<z.ZodString>;
|
|
109
|
+
}, z.core.$strip>;
|
|
110
|
+
settlement: z.ZodObject<{
|
|
111
|
+
accepts: z.ZodArray<z.ZodObject<{
|
|
112
|
+
network: z.ZodEnum<{
|
|
113
|
+
"0g:testnet": "0g:testnet";
|
|
114
|
+
"0g:mainnet": "0g:mainnet";
|
|
115
|
+
"stellar:testnet": "stellar:testnet";
|
|
116
|
+
"stellar:mainnet": "stellar:mainnet";
|
|
117
|
+
}>;
|
|
118
|
+
token: z.ZodString;
|
|
119
|
+
}, z.core.$strip>>;
|
|
120
|
+
}, z.core.$strip>;
|
|
121
|
+
input: z.ZodObject<{
|
|
122
|
+
schema: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
123
|
+
maxSize: z.ZodString;
|
|
124
|
+
}, z.core.$strip>;
|
|
125
|
+
output: z.ZodObject<{
|
|
126
|
+
schema: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
127
|
+
format: z.ZodString;
|
|
128
|
+
}, z.core.$strip>;
|
|
129
|
+
acceptanceCriteria: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
130
|
+
sla: z.ZodObject<{
|
|
131
|
+
maxExecutionTime: z.ZodNumber;
|
|
132
|
+
retryPolicy: z.ZodString;
|
|
133
|
+
}, z.core.$strip>;
|
|
134
|
+
serviceId: z.ZodString;
|
|
135
|
+
rootHash: z.ZodString;
|
|
136
|
+
anchor: z.ZodObject<{
|
|
137
|
+
network: z.ZodEnum<{
|
|
138
|
+
"0g:testnet": "0g:testnet";
|
|
139
|
+
"0g:mainnet": "0g:mainnet";
|
|
140
|
+
"stellar:testnet": "stellar:testnet";
|
|
141
|
+
"stellar:mainnet": "stellar:mainnet";
|
|
142
|
+
}>;
|
|
143
|
+
registryAddress: z.ZodString;
|
|
144
|
+
transactionHash: z.ZodString;
|
|
145
|
+
anchoredAt: z.ZodString;
|
|
146
|
+
}, z.core.$strip>;
|
|
147
|
+
}, z.core.$strip>>;
|
|
148
|
+
createdAt: z.ZodString;
|
|
149
|
+
updatedAt: z.ZodString;
|
|
150
|
+
}, z.core.$strip>;
|
|
151
|
+
export declare const ProviderStatsSchema: z.ZodObject<{
|
|
152
|
+
providerId: z.ZodString;
|
|
153
|
+
totalJobs: z.ZodNumber;
|
|
154
|
+
approvedJobs: z.ZodNumber;
|
|
155
|
+
rejectedJobs: z.ZodNumber;
|
|
156
|
+
totalEarned: z.ZodString;
|
|
157
|
+
}, z.core.$strip>;
|
|
158
|
+
export type ProviderConfig = z.infer<typeof ProviderConfigSchema>;
|
|
159
|
+
export type RegisteredProvider = z.infer<typeof RegisteredProviderSchema>;
|
|
160
|
+
export type ProviderStats = z.infer<typeof ProviderStatsSchema>;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ProviderStatsSchema = exports.RegisteredProviderSchema = exports.ProviderConfigSchema = exports.ProviderIdentitySchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const service_1 = require("./service");
|
|
6
|
+
const common_1 = require("./common");
|
|
7
|
+
exports.ProviderIdentitySchema = zod_1.z.object({
|
|
8
|
+
erc8004TokenId: zod_1.z.string().default(''),
|
|
9
|
+
agentRegistry: zod_1.z.string().default(''),
|
|
10
|
+
agentUri: zod_1.z.string().default(''),
|
|
11
|
+
ownerAddress: zod_1.z.string().default(''),
|
|
12
|
+
domain: zod_1.z.string(),
|
|
13
|
+
domainType: zod_1.z.string().default('space-id'),
|
|
14
|
+
});
|
|
15
|
+
exports.ProviderConfigSchema = zod_1.z.object({
|
|
16
|
+
providerId: zod_1.z.string().default(''),
|
|
17
|
+
displayName: zod_1.z.string().min(1),
|
|
18
|
+
description: zod_1.z.string().min(1),
|
|
19
|
+
version: zod_1.z.string().min(1),
|
|
20
|
+
identity: exports.ProviderIdentitySchema,
|
|
21
|
+
authority: zod_1.z.object({
|
|
22
|
+
path: zod_1.z.string().default('./wallets.json'),
|
|
23
|
+
actor: common_1.SettlementNetworkSchema.refine((value) => value.startsWith('0g:'), {
|
|
24
|
+
message: 'Provider actor authority must use a 0G authority',
|
|
25
|
+
}),
|
|
26
|
+
}),
|
|
27
|
+
settlementWallets: common_1.SettlementWalletsSchema,
|
|
28
|
+
});
|
|
29
|
+
exports.RegisteredProviderSchema = exports.ProviderConfigSchema.extend({
|
|
30
|
+
providerId: zod_1.z.string(),
|
|
31
|
+
ownerAddress: zod_1.z.string(),
|
|
32
|
+
rootHash: zod_1.z.string(),
|
|
33
|
+
anchor: common_1.OnchainAnchorSchema,
|
|
34
|
+
serviceCount: zod_1.z.number().int().nonnegative(),
|
|
35
|
+
services: zod_1.z.array(service_1.RegisteredServiceSchema),
|
|
36
|
+
createdAt: zod_1.z.string(),
|
|
37
|
+
updatedAt: zod_1.z.string(),
|
|
38
|
+
});
|
|
39
|
+
exports.ProviderStatsSchema = zod_1.z.object({
|
|
40
|
+
providerId: zod_1.z.string(),
|
|
41
|
+
totalJobs: zod_1.z.number().int().nonnegative(),
|
|
42
|
+
approvedJobs: zod_1.z.number().int().nonnegative(),
|
|
43
|
+
rejectedJobs: zod_1.z.number().int().nonnegative(),
|
|
44
|
+
totalEarned: zod_1.z.string(),
|
|
45
|
+
});
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const QuoteBreakdownSchema: z.ZodObject<{
|
|
3
|
+
providerFee: z.ZodString;
|
|
4
|
+
verifierFee: z.ZodString;
|
|
5
|
+
computeFee: z.ZodString;
|
|
6
|
+
platformFee: z.ZodString;
|
|
7
|
+
verifierCount: z.ZodNumber;
|
|
8
|
+
}, z.core.$strip>;
|
|
9
|
+
export declare const QuoteAcceptOptionSchema: z.ZodObject<{
|
|
10
|
+
network: z.ZodString;
|
|
11
|
+
token: z.ZodString;
|
|
12
|
+
amount: z.ZodString;
|
|
13
|
+
payTo: z.ZodString;
|
|
14
|
+
memo: z.ZodString;
|
|
15
|
+
}, z.core.$strip>;
|
|
16
|
+
export declare const QuoteSchema: z.ZodObject<{
|
|
17
|
+
quoteId: z.ZodString;
|
|
18
|
+
providerId: z.ZodString;
|
|
19
|
+
serviceId: z.ZodString;
|
|
20
|
+
requesterAddress: z.ZodOptional<z.ZodString>;
|
|
21
|
+
breakdown: z.ZodObject<{
|
|
22
|
+
providerFee: z.ZodString;
|
|
23
|
+
verifierFee: z.ZodString;
|
|
24
|
+
computeFee: z.ZodString;
|
|
25
|
+
platformFee: z.ZodString;
|
|
26
|
+
verifierCount: z.ZodNumber;
|
|
27
|
+
}, z.core.$strip>;
|
|
28
|
+
total: z.ZodString;
|
|
29
|
+
currency: z.ZodString;
|
|
30
|
+
accepts: z.ZodArray<z.ZodObject<{
|
|
31
|
+
network: z.ZodString;
|
|
32
|
+
token: z.ZodString;
|
|
33
|
+
amount: z.ZodString;
|
|
34
|
+
payTo: z.ZodString;
|
|
35
|
+
memo: z.ZodString;
|
|
36
|
+
}, z.core.$strip>>;
|
|
37
|
+
expiresAt: z.ZodString;
|
|
38
|
+
input: z.ZodAny;
|
|
39
|
+
createdAt: z.ZodString;
|
|
40
|
+
}, z.core.$strip>;
|
|
41
|
+
export type Quote = z.infer<typeof QuoteSchema>;
|
|
42
|
+
export type QuoteBreakdown = z.infer<typeof QuoteBreakdownSchema>;
|
|
43
|
+
export type QuoteAcceptOption = z.infer<typeof QuoteAcceptOptionSchema>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.QuoteSchema = exports.QuoteAcceptOptionSchema = exports.QuoteBreakdownSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
exports.QuoteBreakdownSchema = zod_1.z.object({
|
|
6
|
+
providerFee: zod_1.z.string(),
|
|
7
|
+
verifierFee: zod_1.z.string(),
|
|
8
|
+
computeFee: zod_1.z.string(),
|
|
9
|
+
platformFee: zod_1.z.string(),
|
|
10
|
+
verifierCount: zod_1.z.number().int().positive(),
|
|
11
|
+
});
|
|
12
|
+
exports.QuoteAcceptOptionSchema = zod_1.z.object({
|
|
13
|
+
network: zod_1.z.string(),
|
|
14
|
+
token: zod_1.z.string(),
|
|
15
|
+
amount: zod_1.z.string(),
|
|
16
|
+
payTo: zod_1.z.string(),
|
|
17
|
+
memo: zod_1.z.string(),
|
|
18
|
+
});
|
|
19
|
+
exports.QuoteSchema = zod_1.z.object({
|
|
20
|
+
quoteId: zod_1.z.string(),
|
|
21
|
+
providerId: zod_1.z.string(),
|
|
22
|
+
serviceId: zod_1.z.string(),
|
|
23
|
+
requesterAddress: zod_1.z.string().optional(),
|
|
24
|
+
breakdown: exports.QuoteBreakdownSchema,
|
|
25
|
+
total: zod_1.z.string(),
|
|
26
|
+
currency: zod_1.z.string(),
|
|
27
|
+
accepts: zod_1.z.array(exports.QuoteAcceptOptionSchema).min(1),
|
|
28
|
+
expiresAt: zod_1.z.string(),
|
|
29
|
+
input: zod_1.z.any(),
|
|
30
|
+
createdAt: zod_1.z.string(),
|
|
31
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const RequesterConfigSchema: z.ZodObject<{
|
|
3
|
+
requesterId: z.ZodDefault<z.ZodString>;
|
|
4
|
+
displayName: z.ZodString;
|
|
5
|
+
authority: z.ZodObject<{
|
|
6
|
+
path: z.ZodDefault<z.ZodString>;
|
|
7
|
+
actor: z.ZodEnum<{
|
|
8
|
+
"0g:testnet": "0g:testnet";
|
|
9
|
+
"0g:mainnet": "0g:mainnet";
|
|
10
|
+
"stellar:testnet": "stellar:testnet";
|
|
11
|
+
"stellar:mainnet": "stellar:mainnet";
|
|
12
|
+
}>;
|
|
13
|
+
}, z.core.$strip>;
|
|
14
|
+
}, z.core.$strip>;
|
|
15
|
+
export type RequesterConfig = z.infer<typeof RequesterConfigSchema>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RequesterConfigSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const common_1 = require("./common");
|
|
6
|
+
exports.RequesterConfigSchema = zod_1.z.object({
|
|
7
|
+
requesterId: zod_1.z.string().default(''),
|
|
8
|
+
displayName: zod_1.z.string().min(1),
|
|
9
|
+
authority: zod_1.z.object({
|
|
10
|
+
path: zod_1.z.string().default('./wallets.json'),
|
|
11
|
+
actor: common_1.SettlementNetworkSchema.refine((value) => value.startsWith('0g:'), {
|
|
12
|
+
message: 'Requester actor authority must use a 0G authority',
|
|
13
|
+
}),
|
|
14
|
+
}),
|
|
15
|
+
});
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const ServiceSettlementOptionSchema: z.ZodObject<{
|
|
3
|
+
network: z.ZodEnum<{
|
|
4
|
+
"0g:testnet": "0g:testnet";
|
|
5
|
+
"0g:mainnet": "0g:mainnet";
|
|
6
|
+
"stellar:testnet": "stellar:testnet";
|
|
7
|
+
"stellar:mainnet": "stellar:mainnet";
|
|
8
|
+
}>;
|
|
9
|
+
token: z.ZodString;
|
|
10
|
+
}, z.core.$strip>;
|
|
11
|
+
export declare const ServiceEndpointSchema: z.ZodObject<{
|
|
12
|
+
health: z.ZodString;
|
|
13
|
+
execution: z.ZodOptional<z.ZodString>;
|
|
14
|
+
}, z.core.$strip>;
|
|
15
|
+
export declare const ServiceSchema: z.ZodObject<{
|
|
16
|
+
serviceId: z.ZodDefault<z.ZodString>;
|
|
17
|
+
name: z.ZodString;
|
|
18
|
+
description: z.ZodString;
|
|
19
|
+
version: z.ZodString;
|
|
20
|
+
category: z.ZodEnum<{
|
|
21
|
+
text: "text";
|
|
22
|
+
code: "code";
|
|
23
|
+
image: "image";
|
|
24
|
+
audio: "audio";
|
|
25
|
+
video: "video";
|
|
26
|
+
document: "document";
|
|
27
|
+
tool: "tool";
|
|
28
|
+
workflow: "workflow";
|
|
29
|
+
}>;
|
|
30
|
+
trustLevel: z.ZodDefault<z.ZodEnum<{
|
|
31
|
+
standard: "standard";
|
|
32
|
+
thorough: "thorough";
|
|
33
|
+
critical: "critical";
|
|
34
|
+
auto: "auto";
|
|
35
|
+
}>>;
|
|
36
|
+
endpoint: z.ZodObject<{
|
|
37
|
+
health: z.ZodString;
|
|
38
|
+
execution: z.ZodOptional<z.ZodString>;
|
|
39
|
+
}, z.core.$strip>;
|
|
40
|
+
pricing: z.ZodObject<{
|
|
41
|
+
baseFee: z.ZodString;
|
|
42
|
+
currency: z.ZodDefault<z.ZodString>;
|
|
43
|
+
model: z.ZodDefault<z.ZodString>;
|
|
44
|
+
}, z.core.$strip>;
|
|
45
|
+
settlement: z.ZodObject<{
|
|
46
|
+
accepts: z.ZodArray<z.ZodObject<{
|
|
47
|
+
network: z.ZodEnum<{
|
|
48
|
+
"0g:testnet": "0g:testnet";
|
|
49
|
+
"0g:mainnet": "0g:mainnet";
|
|
50
|
+
"stellar:testnet": "stellar:testnet";
|
|
51
|
+
"stellar:mainnet": "stellar:mainnet";
|
|
52
|
+
}>;
|
|
53
|
+
token: z.ZodString;
|
|
54
|
+
}, z.core.$strip>>;
|
|
55
|
+
}, z.core.$strip>;
|
|
56
|
+
input: z.ZodObject<{
|
|
57
|
+
schema: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
58
|
+
maxSize: z.ZodString;
|
|
59
|
+
}, z.core.$strip>;
|
|
60
|
+
output: z.ZodObject<{
|
|
61
|
+
schema: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
62
|
+
format: z.ZodString;
|
|
63
|
+
}, z.core.$strip>;
|
|
64
|
+
acceptanceCriteria: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
65
|
+
sla: z.ZodObject<{
|
|
66
|
+
maxExecutionTime: z.ZodNumber;
|
|
67
|
+
retryPolicy: z.ZodString;
|
|
68
|
+
}, z.core.$strip>;
|
|
69
|
+
}, z.core.$strip>;
|
|
70
|
+
export declare const RegisteredServiceSchema: z.ZodObject<{
|
|
71
|
+
name: z.ZodString;
|
|
72
|
+
description: z.ZodString;
|
|
73
|
+
version: z.ZodString;
|
|
74
|
+
category: z.ZodEnum<{
|
|
75
|
+
text: "text";
|
|
76
|
+
code: "code";
|
|
77
|
+
image: "image";
|
|
78
|
+
audio: "audio";
|
|
79
|
+
video: "video";
|
|
80
|
+
document: "document";
|
|
81
|
+
tool: "tool";
|
|
82
|
+
workflow: "workflow";
|
|
83
|
+
}>;
|
|
84
|
+
trustLevel: z.ZodDefault<z.ZodEnum<{
|
|
85
|
+
standard: "standard";
|
|
86
|
+
thorough: "thorough";
|
|
87
|
+
critical: "critical";
|
|
88
|
+
auto: "auto";
|
|
89
|
+
}>>;
|
|
90
|
+
endpoint: z.ZodObject<{
|
|
91
|
+
health: z.ZodString;
|
|
92
|
+
execution: z.ZodOptional<z.ZodString>;
|
|
93
|
+
}, z.core.$strip>;
|
|
94
|
+
pricing: z.ZodObject<{
|
|
95
|
+
baseFee: z.ZodString;
|
|
96
|
+
currency: z.ZodDefault<z.ZodString>;
|
|
97
|
+
model: z.ZodDefault<z.ZodString>;
|
|
98
|
+
}, z.core.$strip>;
|
|
99
|
+
settlement: z.ZodObject<{
|
|
100
|
+
accepts: z.ZodArray<z.ZodObject<{
|
|
101
|
+
network: z.ZodEnum<{
|
|
102
|
+
"0g:testnet": "0g:testnet";
|
|
103
|
+
"0g:mainnet": "0g:mainnet";
|
|
104
|
+
"stellar:testnet": "stellar:testnet";
|
|
105
|
+
"stellar:mainnet": "stellar:mainnet";
|
|
106
|
+
}>;
|
|
107
|
+
token: z.ZodString;
|
|
108
|
+
}, z.core.$strip>>;
|
|
109
|
+
}, z.core.$strip>;
|
|
110
|
+
input: z.ZodObject<{
|
|
111
|
+
schema: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
112
|
+
maxSize: z.ZodString;
|
|
113
|
+
}, z.core.$strip>;
|
|
114
|
+
output: z.ZodObject<{
|
|
115
|
+
schema: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
116
|
+
format: z.ZodString;
|
|
117
|
+
}, z.core.$strip>;
|
|
118
|
+
acceptanceCriteria: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
119
|
+
sla: z.ZodObject<{
|
|
120
|
+
maxExecutionTime: z.ZodNumber;
|
|
121
|
+
retryPolicy: z.ZodString;
|
|
122
|
+
}, z.core.$strip>;
|
|
123
|
+
serviceId: z.ZodString;
|
|
124
|
+
rootHash: z.ZodString;
|
|
125
|
+
anchor: z.ZodObject<{
|
|
126
|
+
network: z.ZodEnum<{
|
|
127
|
+
"0g:testnet": "0g:testnet";
|
|
128
|
+
"0g:mainnet": "0g:mainnet";
|
|
129
|
+
"stellar:testnet": "stellar:testnet";
|
|
130
|
+
"stellar:mainnet": "stellar:mainnet";
|
|
131
|
+
}>;
|
|
132
|
+
registryAddress: z.ZodString;
|
|
133
|
+
transactionHash: z.ZodString;
|
|
134
|
+
anchoredAt: z.ZodString;
|
|
135
|
+
}, z.core.$strip>;
|
|
136
|
+
}, z.core.$strip>;
|
|
137
|
+
export type Service = z.infer<typeof ServiceSchema>;
|
|
138
|
+
export type RegisteredService = z.infer<typeof RegisteredServiceSchema>;
|
|
139
|
+
export type ServiceSettlementOption = z.infer<typeof ServiceSettlementOptionSchema>;
|
|
140
|
+
export type ServiceEndpoint = z.infer<typeof ServiceEndpointSchema>;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RegisteredServiceSchema = exports.ServiceSchema = exports.ServiceEndpointSchema = exports.ServiceSettlementOptionSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const common_1 = require("./common");
|
|
6
|
+
exports.ServiceSettlementOptionSchema = zod_1.z.object({
|
|
7
|
+
network: common_1.SettlementNetworkSchema,
|
|
8
|
+
token: zod_1.z.string(),
|
|
9
|
+
});
|
|
10
|
+
exports.ServiceEndpointSchema = zod_1.z.object({
|
|
11
|
+
health: zod_1.z.string().url(),
|
|
12
|
+
execution: zod_1.z.string().url().optional(),
|
|
13
|
+
});
|
|
14
|
+
exports.ServiceSchema = zod_1.z.object({
|
|
15
|
+
serviceId: zod_1.z.string().trim().default(''),
|
|
16
|
+
name: zod_1.z.string().min(1),
|
|
17
|
+
description: zod_1.z.string().min(1),
|
|
18
|
+
version: zod_1.z.string().min(1),
|
|
19
|
+
category: common_1.ServiceCategorySchema,
|
|
20
|
+
trustLevel: common_1.TrustLevelSchema.default('standard'),
|
|
21
|
+
endpoint: exports.ServiceEndpointSchema,
|
|
22
|
+
pricing: zod_1.z.object({
|
|
23
|
+
baseFee: zod_1.z.string(),
|
|
24
|
+
currency: zod_1.z.string().default('USDC'),
|
|
25
|
+
model: zod_1.z.string().default('per-job'),
|
|
26
|
+
}),
|
|
27
|
+
settlement: zod_1.z.object({
|
|
28
|
+
accepts: zod_1.z.array(exports.ServiceSettlementOptionSchema).min(1),
|
|
29
|
+
}),
|
|
30
|
+
input: zod_1.z.object({
|
|
31
|
+
schema: zod_1.z.record(zod_1.z.string(), zod_1.z.any()),
|
|
32
|
+
maxSize: zod_1.z.string(),
|
|
33
|
+
}),
|
|
34
|
+
output: zod_1.z.object({
|
|
35
|
+
schema: zod_1.z.record(zod_1.z.string(), zod_1.z.any()),
|
|
36
|
+
format: zod_1.z.string(),
|
|
37
|
+
}),
|
|
38
|
+
acceptanceCriteria: zod_1.z.record(zod_1.z.string(), zod_1.z.any()),
|
|
39
|
+
sla: zod_1.z.object({
|
|
40
|
+
maxExecutionTime: zod_1.z.number().int().positive(),
|
|
41
|
+
retryPolicy: zod_1.z.string(),
|
|
42
|
+
}),
|
|
43
|
+
});
|
|
44
|
+
exports.RegisteredServiceSchema = exports.ServiceSchema.extend({
|
|
45
|
+
serviceId: zod_1.z.string().trim().min(1),
|
|
46
|
+
rootHash: zod_1.z.string(),
|
|
47
|
+
anchor: common_1.OnchainAnchorSchema,
|
|
48
|
+
});
|