@avow-finance/spec 0.0.0-stage → 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 +201 -0
- package/README.md +119 -2
- package/dist/agent-connect.d.ts +82 -0
- package/dist/agent-connect.d.ts.map +1 -0
- package/dist/agent-connect.js +91 -0
- package/dist/agent-connect.js.map +1 -0
- package/dist/agent-session.d.ts +791 -0
- package/dist/agent-session.d.ts.map +1 -0
- package/dist/agent-session.js +176 -0
- package/dist/agent-session.js.map +1 -0
- package/dist/ap2.d.ts +79 -0
- package/dist/ap2.d.ts.map +1 -0
- package/dist/ap2.js +151 -0
- package/dist/ap2.js.map +1 -0
- package/dist/api-request.d.ts +144 -0
- package/dist/api-request.d.ts.map +1 -0
- package/dist/api-request.js +246 -0
- package/dist/api-request.js.map +1 -0
- package/dist/api.d.ts +288 -0
- package/dist/api.d.ts.map +1 -0
- package/dist/api.js +332 -0
- package/dist/api.js.map +1 -0
- package/dist/canonical.d.ts +22 -0
- package/dist/canonical.d.ts.map +1 -0
- package/dist/canonical.js +66 -0
- package/dist/canonical.js.map +1 -0
- package/dist/commitment-card.d.ts +78 -0
- package/dist/commitment-card.d.ts.map +1 -0
- package/dist/commitment-card.js +224 -0
- package/dist/commitment-card.js.map +1 -0
- package/dist/commitment.d.ts +185 -0
- package/dist/commitment.d.ts.map +1 -0
- package/dist/commitment.js +148 -0
- package/dist/commitment.js.map +1 -0
- package/dist/compute-offers.d.ts +128 -0
- package/dist/compute-offers.d.ts.map +1 -0
- package/dist/compute-offers.js +111 -0
- package/dist/compute-offers.js.map +1 -0
- package/dist/contest.d.ts +88 -0
- package/dist/contest.d.ts.map +1 -0
- package/dist/contest.js +131 -0
- package/dist/contest.js.map +1 -0
- package/dist/demo.d.ts +69 -0
- package/dist/demo.d.ts.map +1 -0
- package/dist/demo.js +152 -0
- package/dist/demo.js.map +1 -0
- package/dist/dependencies.d.ts +308 -0
- package/dist/dependencies.d.ts.map +1 -0
- package/dist/dependencies.js +133 -0
- package/dist/dependencies.js.map +1 -0
- package/dist/eip712.d.ts +1569 -0
- package/dist/eip712.d.ts.map +1 -0
- package/dist/eip712.js +550 -0
- package/dist/eip712.js.map +1 -0
- package/dist/elided-terms.d.ts +37 -0
- package/dist/elided-terms.d.ts.map +1 -0
- package/dist/elided-terms.js +48 -0
- package/dist/elided-terms.js.map +1 -0
- package/dist/erc8183.d.ts +78 -0
- package/dist/erc8183.d.ts.map +1 -0
- package/dist/erc8183.js +88 -0
- package/dist/erc8183.js.map +1 -0
- package/dist/facts.d.ts +70 -0
- package/dist/facts.d.ts.map +1 -0
- package/dist/facts.js +33 -0
- package/dist/facts.js.map +1 -0
- package/dist/gpu-reservation.d.ts +79 -0
- package/dist/gpu-reservation.d.ts.map +1 -0
- package/dist/gpu-reservation.js +135 -0
- package/dist/gpu-reservation.js.map +1 -0
- package/dist/index.d.ts +49 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +49 -0
- package/dist/index.js.map +1 -0
- package/dist/job-session.d.ts +981 -0
- package/dist/job-session.d.ts.map +1 -0
- package/dist/job-session.js +170 -0
- package/dist/job-session.js.map +1 -0
- package/dist/job-verification.d.ts +244 -0
- package/dist/job-verification.d.ts.map +1 -0
- package/dist/job-verification.js +89 -0
- package/dist/job-verification.js.map +1 -0
- package/dist/job-wording.d.ts +48 -0
- package/dist/job-wording.d.ts.map +1 -0
- package/dist/job-wording.js +134 -0
- package/dist/job-wording.js.map +1 -0
- package/dist/job.d.ts +117 -0
- package/dist/job.d.ts.map +1 -0
- package/dist/job.js +166 -0
- package/dist/job.js.map +1 -0
- package/dist/json-fields.d.ts +13 -0
- package/dist/json-fields.d.ts.map +1 -0
- package/dist/json-fields.js +30 -0
- package/dist/json-fields.js.map +1 -0
- package/dist/keychain.d.ts +51 -0
- package/dist/keychain.d.ts.map +1 -0
- package/dist/keychain.js +133 -0
- package/dist/keychain.js.map +1 -0
- package/dist/mailbox.d.ts +1650 -0
- package/dist/mailbox.d.ts.map +1 -0
- package/dist/mailbox.js +87 -0
- package/dist/mailbox.js.map +1 -0
- package/dist/mandate.d.ts +53 -0
- package/dist/mandate.d.ts.map +1 -0
- package/dist/mandate.js +97 -0
- package/dist/mandate.js.map +1 -0
- package/dist/networks.d.ts +18 -0
- package/dist/networks.d.ts.map +1 -0
- package/dist/networks.js +24 -0
- package/dist/networks.js.map +1 -0
- package/dist/profiles.d.ts +31 -0
- package/dist/profiles.d.ts.map +1 -0
- package/dist/profiles.js +33 -0
- package/dist/profiles.js.map +1 -0
- package/dist/rail.d.ts +48 -0
- package/dist/rail.d.ts.map +1 -0
- package/dist/rail.js +28 -0
- package/dist/rail.js.map +1 -0
- package/dist/reasons.d.ts +173 -0
- package/dist/reasons.d.ts.map +1 -0
- package/dist/reasons.js +174 -0
- package/dist/reasons.js.map +1 -0
- package/dist/reference-link.d.ts +23 -0
- package/dist/reference-link.d.ts.map +1 -0
- package/dist/reference-link.js +56 -0
- package/dist/reference-link.js.map +1 -0
- package/dist/references.d.ts +125 -0
- package/dist/references.d.ts.map +1 -0
- package/dist/references.js +108 -0
- package/dist/references.js.map +1 -0
- package/dist/replay.d.ts +30 -0
- package/dist/replay.d.ts.map +1 -0
- package/dist/replay.js +27 -0
- package/dist/replay.js.map +1 -0
- package/dist/sandbox-registration.d.ts +200 -0
- package/dist/sandbox-registration.d.ts.map +1 -0
- package/dist/sandbox-registration.js +172 -0
- package/dist/sandbox-registration.js.map +1 -0
- package/dist/sandbox.d.ts +3478 -0
- package/dist/sandbox.d.ts.map +1 -0
- package/dist/sandbox.js +316 -0
- package/dist/sandbox.js.map +1 -0
- package/dist/session-fields.d.ts +203 -0
- package/dist/session-fields.d.ts.map +1 -0
- package/dist/session-fields.js +43 -0
- package/dist/session-fields.js.map +1 -0
- package/dist/supplier-adapter.d.ts +65 -0
- package/dist/supplier-adapter.d.ts.map +1 -0
- package/dist/supplier-adapter.js +91 -0
- package/dist/supplier-adapter.js.map +1 -0
- package/dist/terms-v1.d.ts +74 -0
- package/dist/terms-v1.d.ts.map +1 -0
- package/dist/terms-v1.js +156 -0
- package/dist/terms-v1.js.map +1 -0
- package/dist/terms.d.ts +341 -0
- package/dist/terms.d.ts.map +1 -0
- package/dist/terms.js +715 -0
- package/dist/terms.js.map +1 -0
- package/dist/test-customer.d.ts +1525 -0
- package/dist/test-customer.d.ts.map +1 -0
- package/dist/test-customer.js +260 -0
- package/dist/test-customer.js.map +1 -0
- package/dist/types.d.ts +272 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +32 -0
- package/dist/types.js.map +1 -0
- package/dist/version.d.ts +51 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +66 -0
- package/dist/version.js.map +1 -0
- package/dist/wire.d.ts +2698 -0
- package/dist/wire.d.ts.map +1 -0
- package/dist/wire.js +678 -0
- package/dist/wire.js.map +1 -0
- package/package.json +37 -3
- package/vectors/api-request-v1.json +53 -0
- package/vectors/contest-statement-v1.json +42 -0
- package/vectors/terms-v2.json +398 -0
- package/vectors/terms-v3.json +2103 -0
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { Hex } from 'viem';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import type { AvowDomain, TermsAgreement } from './eip712.js';
|
|
4
|
+
import type { SupplierProfile, Terms } from './types.js';
|
|
5
|
+
import { type Parsed } from './wire.js';
|
|
6
|
+
/**
|
|
7
|
+
* The routes a supplier's adapter serves to agents, under the base URL the supplier gives them. A
|
|
8
|
+
* `GET` of `profile` answers with the supplier's `SupplierProfile`. A `POST` of an `AgreementOffer`
|
|
9
|
+
* to `agreements` answers with status 200 and an `AgreementSignature`, or with a status of 400 or
|
|
10
|
+
* more and a `SupplierRefusal`. A supplier that lists compute for jobs answers an unsigned `GET`
|
|
11
|
+
* of `offers`, with the job's window as `startsAt` and `deliverBy` in the query, with its
|
|
12
|
+
* `ComputeOffers`, as `computeOffersPath` builds the path. Every body is JSON, with amounts and
|
|
13
|
+
* times as decimal strings, as `toWire` writes them.
|
|
14
|
+
*/
|
|
15
|
+
export declare const SUPPLIER_ADAPTER_PATHS: {
|
|
16
|
+
readonly profile: '/profile';
|
|
17
|
+
readonly agreements: '/agreements';
|
|
18
|
+
readonly offers: '/offers';
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* An agent's request that a supplier sign a terms agreement: the agreement, the terms and salt
|
|
22
|
+
* that give its terms hash, and the domain of the buyer's lock it's signed under. The supplier
|
|
23
|
+
* checks the terms are ones it offers and give the agreement's terms hash before it signs.
|
|
24
|
+
*/
|
|
25
|
+
export interface AgreementOffer {
|
|
26
|
+
agreement: TermsAgreement;
|
|
27
|
+
terms: Terms;
|
|
28
|
+
salt: Hex;
|
|
29
|
+
domain: AvowDomain;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* A supplier's answer to an offer it signs: its signing key's signature over the agreement's
|
|
33
|
+
* EIP-712 digest. The agent checks it with `isKeySignature` before relying on it.
|
|
34
|
+
*/
|
|
35
|
+
export interface AgreementSignature {
|
|
36
|
+
signature: Hex;
|
|
37
|
+
}
|
|
38
|
+
/** A supplier's answer to an offer it won't sign, saying why in a sentence. */
|
|
39
|
+
export interface SupplierRefusal {
|
|
40
|
+
error: string;
|
|
41
|
+
}
|
|
42
|
+
/** A supplier's profile as JSON, as Avow registered the supplier. */
|
|
43
|
+
export declare const supplierProfileJson: z.ZodObject<{
|
|
44
|
+
businessId: z.ZodString;
|
|
45
|
+
account: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
|
|
46
|
+
payee: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
|
|
47
|
+
signingKey: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
|
|
48
|
+
}, z.core.$strip>;
|
|
49
|
+
/** Reads a supplier's profile. Other fields are ignored, so an adapter can serve more. */
|
|
50
|
+
export declare function parseSupplierProfile(json: unknown): Parsed<SupplierProfile>;
|
|
51
|
+
/**
|
|
52
|
+
* Reads an agent's offer. The agreement and the terms parse as their own schemas, so terms of
|
|
53
|
+
* another version or under a template this code doesn't know are refused with the reason
|
|
54
|
+
* `parseTerms` gives.
|
|
55
|
+
*/
|
|
56
|
+
export declare function parseAgreementOffer(json: unknown): Parsed<AgreementOffer>;
|
|
57
|
+
/**
|
|
58
|
+
* Reads a supplier's signature on an offer. It takes every kind of signature `isKeySignature`
|
|
59
|
+
* checks, so a supplier whose signing key is a passkey can answer. Whether the supplier's signing
|
|
60
|
+
* key signed this agreement is for the agent to check, as the SDK's `book` does.
|
|
61
|
+
*/
|
|
62
|
+
export declare function parseAgreementSignature(json: unknown): Parsed<AgreementSignature>;
|
|
63
|
+
/** Reads why a supplier refused an offer, or returns null when the body doesn't say. */
|
|
64
|
+
export declare function parseSupplierRefusal(json: unknown): SupplierRefusal | null;
|
|
65
|
+
//# sourceMappingURL=supplier-adapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"supplier-adapter.d.ts","sourceRoot":"","sources":["../src/supplier-adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAW,GAAG,EAAE,MAAM,MAAM,CAAA;AACxC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAE7D,OAAO,KAAK,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AACxD,OAAO,EAAE,KAAK,MAAM,EAAkC,MAAM,WAAW,CAAA;AAEvE;;;;;;;;GAQG;AACH,eAAO,MAAM,sBAAsB;aACjC,OAAO,EAAE,UAAU;aACnB,UAAU,EAAE,aAAa;aACzB,MAAM,EAAE,SAAS;CACT,CAAA;AAEV;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,cAAc,CAAA;IACzB,KAAK,EAAE,KAAK,CAAA;IACZ,IAAI,EAAE,GAAG,CAAA;IACT,MAAM,EAAE,UAAU,CAAA;CACnB;AAED;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC,SAAS,EAAE,GAAG,CAAA;CACf;AAED,+EAA+E;AAC/E,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAA;CACd;AAYD,qEAAqE;AACrE,eAAO,MAAM,mBAAmB;;;;;iBAK9B,CAAA;AASF,0FAA0F;AAC1F,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,CAAC,eAAe,CAAC,CAK3E;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,CAAC,cAAc,CAAC,CAgBzE;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,CAAC,kBAAkB,CAAC,CAMjF;AAED,wFAAwF;AACxF,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,OAAO,GAAG,eAAe,GAAG,IAAI,CAG1E"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { isKeySignatureForm } from './keychain.js';
|
|
3
|
+
import { parseTerms, termsAgreementJson } from './wire.js';
|
|
4
|
+
/**
|
|
5
|
+
* The routes a supplier's adapter serves to agents, under the base URL the supplier gives them. A
|
|
6
|
+
* `GET` of `profile` answers with the supplier's `SupplierProfile`. A `POST` of an `AgreementOffer`
|
|
7
|
+
* to `agreements` answers with status 200 and an `AgreementSignature`, or with a status of 400 or
|
|
8
|
+
* more and a `SupplierRefusal`. A supplier that lists compute for jobs answers an unsigned `GET`
|
|
9
|
+
* of `offers`, with the job's window as `startsAt` and `deliverBy` in the query, with its
|
|
10
|
+
* `ComputeOffers`, as `computeOffersPath` builds the path. Every body is JSON, with amounts and
|
|
11
|
+
* times as decimal strings, as `toWire` writes them.
|
|
12
|
+
*/
|
|
13
|
+
export const SUPPLIER_ADAPTER_PATHS = {
|
|
14
|
+
profile: '/profile',
|
|
15
|
+
agreements: '/agreements',
|
|
16
|
+
offers: '/offers',
|
|
17
|
+
};
|
|
18
|
+
const address = z
|
|
19
|
+
.string()
|
|
20
|
+
.regex(/^0x[0-9a-fA-F]{40}$/)
|
|
21
|
+
.transform((s) => s.toLowerCase());
|
|
22
|
+
const bytes32 = z
|
|
23
|
+
.string()
|
|
24
|
+
.regex(/^0x[0-9a-fA-F]{64}$/)
|
|
25
|
+
.transform((s) => s.toLowerCase());
|
|
26
|
+
const objectJson = z.record(z.string(), z.unknown());
|
|
27
|
+
/** A supplier's profile as JSON, as Avow registered the supplier. */
|
|
28
|
+
export const supplierProfileJson = z.object({
|
|
29
|
+
businessId: z.string().min(1),
|
|
30
|
+
account: address,
|
|
31
|
+
payee: address,
|
|
32
|
+
signingKey: address,
|
|
33
|
+
});
|
|
34
|
+
const offerJson = z.strictObject({
|
|
35
|
+
agreement: objectJson,
|
|
36
|
+
terms: objectJson,
|
|
37
|
+
salt: bytes32,
|
|
38
|
+
domain: z.strictObject({ chainId: z.number().int().positive(), verifyingContract: address }),
|
|
39
|
+
});
|
|
40
|
+
/** Reads a supplier's profile. Other fields are ignored, so an adapter can serve more. */
|
|
41
|
+
export function parseSupplierProfile(json) {
|
|
42
|
+
const parsed = supplierProfileJson.safeParse(json);
|
|
43
|
+
return parsed.success
|
|
44
|
+
? { ok: true, value: parsed.data }
|
|
45
|
+
: { ok: false, reason: 'message.invalid' };
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Reads an agent's offer. The agreement and the terms parse as their own schemas, so terms of
|
|
49
|
+
* another version or under a template this code doesn't know are refused with the reason
|
|
50
|
+
* `parseTerms` gives.
|
|
51
|
+
*/
|
|
52
|
+
export function parseAgreementOffer(json) {
|
|
53
|
+
const outer = offerJson.safeParse(json);
|
|
54
|
+
if (!outer.success)
|
|
55
|
+
return { ok: false, reason: 'message.invalid' };
|
|
56
|
+
const agreement = termsAgreementJson.safeParse(outer.data.agreement);
|
|
57
|
+
if (!agreement.success)
|
|
58
|
+
return { ok: false, reason: 'message.invalid' };
|
|
59
|
+
const terms = parseTerms(outer.data.terms);
|
|
60
|
+
if (!terms.ok)
|
|
61
|
+
return terms;
|
|
62
|
+
return {
|
|
63
|
+
ok: true,
|
|
64
|
+
value: {
|
|
65
|
+
agreement: agreement.data,
|
|
66
|
+
terms: terms.value,
|
|
67
|
+
salt: outer.data.salt,
|
|
68
|
+
domain: outer.data.domain,
|
|
69
|
+
},
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Reads a supplier's signature on an offer. It takes every kind of signature `isKeySignature`
|
|
74
|
+
* checks, so a supplier whose signing key is a passkey can answer. Whether the supplier's signing
|
|
75
|
+
* key signed this agreement is for the agent to check, as the SDK's `book` does.
|
|
76
|
+
*/
|
|
77
|
+
export function parseAgreementSignature(json) {
|
|
78
|
+
const parsed = z.object({ signature: z.string().regex(/^0x([0-9a-fA-F]{2})+$/) }).safeParse(json);
|
|
79
|
+
if (!parsed.success)
|
|
80
|
+
return { ok: false, reason: 'message.invalid' };
|
|
81
|
+
const signature = parsed.data.signature.toLowerCase();
|
|
82
|
+
if (!isKeySignatureForm(signature))
|
|
83
|
+
return { ok: false, reason: 'message.signature_invalid' };
|
|
84
|
+
return { ok: true, value: { signature } };
|
|
85
|
+
}
|
|
86
|
+
/** Reads why a supplier refused an offer, or returns null when the body doesn't say. */
|
|
87
|
+
export function parseSupplierRefusal(json) {
|
|
88
|
+
const parsed = z.object({ error: z.string().min(1) }).safeParse(json);
|
|
89
|
+
return parsed.success ? { error: parsed.data.error } : null;
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=supplier-adapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"supplier-adapter.js","sourceRoot":"","sources":["../src/supplier-adapter.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO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,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,uBAAuB,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,CAAA;IACjG,IAAI,CAAC,MAAM,CAAC,OAAO;QAAE,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,iBAAiB,EAAE,CAAA;IACpE,MAAM,SAAS,GAAG,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,WAAW,EAAS,CAAA;IAC5D,IAAI,CAAC,kBAAkB,CAAC,SAAS,CAAC;QAAE,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,2BAA2B,EAAE,CAAA;IAC7F,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,SAAS,EAAE,EAAE,CAAA;AAC3C,CAAC;AAED,wFAAwF;AACxF,MAAM,UAAU,oBAAoB,CAAC,IAAa;IAChD,MAAM,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,CAAA;IACrE,OAAO,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,CAAA;AAC7D,CAAC"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { type Address, type Hex } from 'viem';
|
|
2
|
+
import type { Charge } from './eip712.js';
|
|
3
|
+
import type { TermsProfile } from './profiles.js';
|
|
4
|
+
import type { ReasonCode } from './reasons.js';
|
|
5
|
+
import type { Currency, DisputeTerms } from './types.js';
|
|
6
|
+
/**
|
|
7
|
+
* Version 1 of the terms, the flat GPU reservation format published before the terms had a
|
|
8
|
+
* version field. Commitments made under it stay verifiable, so everything in this file is frozen.
|
|
9
|
+
* It hashes, checks and maps version 1 terms exactly as it did when they were signed, and the
|
|
10
|
+
* tests pin its outputs. New commitments use version 2, in `terms.ts`.
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* The terms of a GPU reservation, version 1. Nothing here names a rail, and the arbiter is an EVM
|
|
14
|
+
* address, so the same terms and terms hash work on any EVM rail that backs them.
|
|
15
|
+
*/
|
|
16
|
+
export interface ComputeTermsV1 {
|
|
17
|
+
kind: 'compute';
|
|
18
|
+
resource: {
|
|
19
|
+
gpu: string;
|
|
20
|
+
count: number;
|
|
21
|
+
region: string;
|
|
22
|
+
sku: string;
|
|
23
|
+
};
|
|
24
|
+
currency: Currency;
|
|
25
|
+
windowStart: bigint;
|
|
26
|
+
windowDuration: bigint;
|
|
27
|
+
/** The last moment the supplier can accept, the window's start by default. */
|
|
28
|
+
acceptBy: bigint;
|
|
29
|
+
/** Usage, paid like any other purchase and never from the reserve. */
|
|
30
|
+
price: {
|
|
31
|
+
perGpuHour: bigint;
|
|
32
|
+
};
|
|
33
|
+
/** The most the supplier can charge, which equals the largest charge below. */
|
|
34
|
+
reserve: bigint;
|
|
35
|
+
freeCancelBy: bigint;
|
|
36
|
+
lateCancellation: bigint;
|
|
37
|
+
noShow: bigint;
|
|
38
|
+
gracePeriod: bigint;
|
|
39
|
+
chargeDeadline: bigint;
|
|
40
|
+
contestWindow: bigint;
|
|
41
|
+
releaseDate: bigint;
|
|
42
|
+
dispute: DisputeTerms;
|
|
43
|
+
}
|
|
44
|
+
/** Version 1 terms carry no version field, and every later version does. */
|
|
45
|
+
export declare function isTermsV1(terms: object): terms is ComputeTermsV1;
|
|
46
|
+
/**
|
|
47
|
+
* The salted hash of version 1 terms. The arbiter's address is hashed in lower case, so two copies
|
|
48
|
+
* of the same terms that write it in different letter case give the same hash.
|
|
49
|
+
*/
|
|
50
|
+
export declare function termsHashV1(terms: ComputeTermsV1, salt: Hex): Hex;
|
|
51
|
+
/** Checks version 1 terms on their own, before any mandate. Returns null when they're sound. */
|
|
52
|
+
export declare function validateTermsV1(terms: ComputeTermsV1, profile: TermsProfile): ReasonCode | null;
|
|
53
|
+
/**
|
|
54
|
+
* The charges a commitment under version 1 terms carries, as Avow's approval names them and the
|
|
55
|
+
* lock stores them. A late cancellation can be reported from the free-cancellation deadline and a
|
|
56
|
+
* no-show from the window's start plus the grace period, each up to its amount in the token's
|
|
57
|
+
* base units. A kind the terms set to zero is left out, since the lock refuses a charge with no
|
|
58
|
+
* amount.
|
|
59
|
+
*/
|
|
60
|
+
export declare function termsChargesV1(terms: ComputeTermsV1, decimals: number): Charge[];
|
|
61
|
+
/**
|
|
62
|
+
* Version 1 demo terms for 8 H100s: a $500 reserve, free cancellation until 24 hours before the
|
|
63
|
+
* start, $250 for a late cancellation, $500 for a no-show, 30 minutes' grace and a 72-hour contest
|
|
64
|
+
* window. Usage is $3 per GPU-hour, paid separately. A dispute nobody rules on by day 90 splits a
|
|
65
|
+
* confirmed charge evenly, and the caller names the arbiter.
|
|
66
|
+
*/
|
|
67
|
+
export declare function demoTermsV1(windowStart: bigint, arbiter: Address): ComputeTermsV1;
|
|
68
|
+
/**
|
|
69
|
+
* The same version 1 terms run in minutes for testnet: a 30-minute window, free cancellation
|
|
70
|
+
* until 10 minutes before, 2 minutes' grace and a 10-minute contest window, which only the
|
|
71
|
+
* testnet demo profile accepts.
|
|
72
|
+
*/
|
|
73
|
+
export declare function testnetDemoTermsV1(windowStart: bigint, arbiter: Address): ComputeTermsV1;
|
|
74
|
+
//# sourceMappingURL=terms-v1.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"terms-v1.d.ts","sourceRoot":"","sources":["../src/terms-v1.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,OAAO,EAEZ,KAAK,GAAG,EAKT,MAAM,MAAM,CAAA;AACb,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACzC,OAAO,KAAK,EAAE,YAAY,EAAE,MA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KAAK,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,CAiBhF;AAKD;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,cAAc,CAoBjF;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,cAAc,CAWxF"}
|
package/dist/terms-v1.js
ADDED
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { concat, isAddress, keccak256, stringToHex, zeroAddress, } from 'viem';
|
|
2
|
+
import { toTokenUnits } from './rail.js';
|
|
3
|
+
/** Version 1 terms carry no version field, and every later version does. */
|
|
4
|
+
export function isTermsV1(terms) {
|
|
5
|
+
return !('version' in terms);
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* The canonical JSON version 1 hashed: object keys sorted, no whitespace, bigints as decimal
|
|
9
|
+
* strings and undefined fields left out. Kept apart from `canonicalJson` so version 1 hashes
|
|
10
|
+
* never move.
|
|
11
|
+
*/
|
|
12
|
+
function canonicalJsonV1(value) {
|
|
13
|
+
if (value === null)
|
|
14
|
+
return 'null';
|
|
15
|
+
switch (typeof value) {
|
|
16
|
+
case 'bigint':
|
|
17
|
+
return JSON.stringify(value.toString());
|
|
18
|
+
case 'number':
|
|
19
|
+
if (!Number.isFinite(value))
|
|
20
|
+
throw new TypeError('Numbers in terms must be finite');
|
|
21
|
+
return JSON.stringify(value);
|
|
22
|
+
case 'string':
|
|
23
|
+
case 'boolean':
|
|
24
|
+
return JSON.stringify(value);
|
|
25
|
+
case 'object': {
|
|
26
|
+
if (Array.isArray(value))
|
|
27
|
+
return `[${value.map(canonicalJsonV1).join(',')}]`;
|
|
28
|
+
const entries = Object.entries(value)
|
|
29
|
+
.filter(([, v]) => v !== undefined)
|
|
30
|
+
.sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0));
|
|
31
|
+
return `{${entries.map(([k, v]) => `${JSON.stringify(k)}:${canonicalJsonV1(v)}`).join(',')}}`;
|
|
32
|
+
}
|
|
33
|
+
default:
|
|
34
|
+
throw new TypeError(`Terms can't hold a ${typeof value}`);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* The salted hash of version 1 terms. The arbiter's address is hashed in lower case, so two copies
|
|
39
|
+
* of the same terms that write it in different letter case give the same hash.
|
|
40
|
+
*/
|
|
41
|
+
export function termsHashV1(terms, salt) {
|
|
42
|
+
if (salt.length !== 66)
|
|
43
|
+
throw new TypeError('The salt must be 32 bytes');
|
|
44
|
+
const canonical = terms.dispute
|
|
45
|
+
? { ...terms, dispute: { ...terms.dispute, arbiter: terms.dispute.arbiter.toLowerCase() } }
|
|
46
|
+
: terms;
|
|
47
|
+
return keccak256(concat([salt, stringToHex(canonicalJsonV1(canonical))]));
|
|
48
|
+
}
|
|
49
|
+
/** Checks version 1 terms on their own, before any mandate. Returns null when they're sound. */
|
|
50
|
+
export function validateTermsV1(terms, profile) {
|
|
51
|
+
const largestCharge = terms.lateCancellation > terms.noShow ? terms.lateCancellation : terms.noShow;
|
|
52
|
+
if (terms.reserve !== largestCharge || terms.reserve <= 0n)
|
|
53
|
+
return 'terms.reserve_mismatch';
|
|
54
|
+
const windowEnd = terms.windowStart + terms.windowDuration;
|
|
55
|
+
// Every charge needs a moment it can be reported in, so a no-show must be reportable after the
|
|
56
|
+
// grace period and before the charge deadline.
|
|
57
|
+
const inOrder = terms.windowDuration > 0n &&
|
|
58
|
+
terms.gracePeriod >= 0n &&
|
|
59
|
+
terms.freeCancelBy <= terms.windowStart &&
|
|
60
|
+
terms.acceptBy <= terms.windowStart &&
|
|
61
|
+
terms.acceptBy < terms.chargeDeadline &&
|
|
62
|
+
terms.freeCancelBy < terms.chargeDeadline &&
|
|
63
|
+
terms.windowStart + terms.gracePeriod < terms.chargeDeadline &&
|
|
64
|
+
windowEnd <= terms.chargeDeadline &&
|
|
65
|
+
terms.chargeDeadline <= terms.releaseDate;
|
|
66
|
+
if (!inOrder)
|
|
67
|
+
return 'terms.deadlines_out_of_order';
|
|
68
|
+
if (terms.contestWindow < profile.minContestWindow)
|
|
69
|
+
return 'terms.contest_window_short';
|
|
70
|
+
// Terms written before the dispute block existed can't be checked against an approval.
|
|
71
|
+
const dispute = terms.dispute;
|
|
72
|
+
if (!dispute)
|
|
73
|
+
return 'terms.incomplete';
|
|
74
|
+
const share = dispute.day90SupplierShareBps;
|
|
75
|
+
if (typeof dispute.arbiter !== 'string' ||
|
|
76
|
+
!isAddress(dispute.arbiter, { strict: false }) ||
|
|
77
|
+
dispute.arbiter.toLowerCase() === zeroAddress ||
|
|
78
|
+
!Number.isInteger(share) ||
|
|
79
|
+
share < 0 ||
|
|
80
|
+
share > 10_000) {
|
|
81
|
+
return 'terms.dispute_invalid';
|
|
82
|
+
}
|
|
83
|
+
return null;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* The charges a commitment under version 1 terms carries, as Avow's approval names them and the
|
|
87
|
+
* lock stores them. A late cancellation can be reported from the free-cancellation deadline and a
|
|
88
|
+
* no-show from the window's start plus the grace period, each up to its amount in the token's
|
|
89
|
+
* base units. A kind the terms set to zero is left out, since the lock refuses a charge with no
|
|
90
|
+
* amount.
|
|
91
|
+
*/
|
|
92
|
+
export function termsChargesV1(terms, decimals) {
|
|
93
|
+
const charges = [];
|
|
94
|
+
if (terms.lateCancellation > 0n) {
|
|
95
|
+
charges.push({
|
|
96
|
+
kind: 'lateCancellation',
|
|
97
|
+
most: toTokenUnits(terms.lateCancellation, decimals),
|
|
98
|
+
earliest: terms.freeCancelBy,
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
if (terms.noShow > 0n) {
|
|
102
|
+
charges.push({
|
|
103
|
+
kind: 'noShow',
|
|
104
|
+
most: toTokenUnits(terms.noShow, decimals),
|
|
105
|
+
earliest: terms.windowStart + terms.gracePeriod,
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
return charges;
|
|
109
|
+
}
|
|
110
|
+
const MINUTE = 60n;
|
|
111
|
+
const HOUR = 60n * MINUTE;
|
|
112
|
+
/**
|
|
113
|
+
* Version 1 demo terms for 8 H100s: a $500 reserve, free cancellation until 24 hours before the
|
|
114
|
+
* start, $250 for a late cancellation, $500 for a no-show, 30 minutes' grace and a 72-hour contest
|
|
115
|
+
* window. Usage is $3 per GPU-hour, paid separately. A dispute nobody rules on by day 90 splits a
|
|
116
|
+
* confirmed charge evenly, and the caller names the arbiter.
|
|
117
|
+
*/
|
|
118
|
+
export function demoTermsV1(windowStart, arbiter) {
|
|
119
|
+
const windowEnd = windowStart + 24n * HOUR;
|
|
120
|
+
return {
|
|
121
|
+
kind: 'compute',
|
|
122
|
+
resource: { gpu: 'H100', count: 8, region: 'demo', sku: 'demo-h100x8' },
|
|
123
|
+
currency: 'USD',
|
|
124
|
+
windowStart,
|
|
125
|
+
windowDuration: 24n * HOUR,
|
|
126
|
+
acceptBy: windowStart,
|
|
127
|
+
price: { perGpuHour: 3000000n },
|
|
128
|
+
reserve: 500000000n,
|
|
129
|
+
freeCancelBy: windowStart - 24n * HOUR,
|
|
130
|
+
lateCancellation: 250000000n,
|
|
131
|
+
noShow: 500000000n,
|
|
132
|
+
gracePeriod: 30n * MINUTE,
|
|
133
|
+
chargeDeadline: windowEnd,
|
|
134
|
+
contestWindow: 72n * HOUR,
|
|
135
|
+
releaseDate: windowEnd,
|
|
136
|
+
dispute: { arbiter, day90SupplierShareBps: 5000 },
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* The same version 1 terms run in minutes for testnet: a 30-minute window, free cancellation
|
|
141
|
+
* until 10 minutes before, 2 minutes' grace and a 10-minute contest window, which only the
|
|
142
|
+
* testnet demo profile accepts.
|
|
143
|
+
*/
|
|
144
|
+
export function testnetDemoTermsV1(windowStart, arbiter) {
|
|
145
|
+
const windowEnd = windowStart + 30n * MINUTE;
|
|
146
|
+
return {
|
|
147
|
+
...demoTermsV1(windowStart, arbiter),
|
|
148
|
+
windowDuration: 30n * MINUTE,
|
|
149
|
+
freeCancelBy: windowStart - 10n * MINUTE,
|
|
150
|
+
gracePeriod: 2n * MINUTE,
|
|
151
|
+
chargeDeadline: windowEnd,
|
|
152
|
+
contestWindow: 10n * MINUTE,
|
|
153
|
+
releaseDate: windowEnd,
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
//# sourceMappingURL=terms-v1.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"terms-v1.js","sourceRoot":"","sources":["../src/terms-v1.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,MAAM,EAEN,SAAS,EACT,SAAS,EACT,WAAW,EACX,WAAW,GACZ,MAAM,MAAM,CAAA;AAGb,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAqCxC,4EAA4E;AAC5E,MAAM,UAAU,SAAS,CAAC,KAAa;IACrC,OAAO,CAAC,CAAC,SAAS,IAAI,KAAK,CAAC,CAAA;AAC9B,CAAC;AAED;;;;GAIG;AACH,SAAS,eAAe,CAAC,KAAc;IACrC,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,MAAM,CAAA;IACjC,QAAQ,OAAO,KAAK,EAAE,CAAC;QACrB,KAAK,QAAQ;YACX,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAA;QACzC,KAAK,QAAQ;YACX,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC;gBAAE,MAAM,IAAI,SAAS,CAAC,iCAAiC,CAAC,CAAA;YACnF,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAA;QAC9B,KAAK,QAAQ,CAAC;QACd,KAAK,SAAS;YACZ,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAA;QAC9B,KAAK,QAAQ,EAAE,CAAC;YACd,IAAI,KAAK,CAAC,OA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