@avow-finance/spec 0.0.0-stage → 0.2.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 +90 -0
- package/dist/agent-connect.d.ts.map +1 -0
- package/dist/agent-connect.js +102 -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 @@
|
|
|
1
|
+
{"version":3,"file":"mailbox.d.ts","sourceRoot":"","sources":["../src/mailbox.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,MAAM,CAAA;AAC/B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAExC,OAAO,EACL,KAAK,cAAc,EAGnB,KAAK,YAAY,EAElB,MAAM,oBAAoB,CAAA;AAG3B;;;;;;;;;;;;;;;GAeG;AAEH,4FAA4F;AAC5F,eAAO,MAAM,0BAA0B,QAAY,CAAA;AAEnD,mEAAmE;AACnE,eAAO,MAAM,iBAAiB,KAAK,CAAA;AAEnC,gGAAgG;AAChG,MAAM,WAAW,QAAQ;IACvB,UAAU,EAAE,MAAM,CAAA;IAClB,OAAO,EAAE,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,CAAA;AAC7F,eAAO,MAAM,iBAAiB,SATrB,OAAO;YAaJ,YAAY,EAAE;QAEzB,CAAA;AACD,eAAO,MAAM,oBAAoB,SAhBxB,OAAO;;QAgB6C,CAAA;AAC7D,eAAO,MAAM,oBAAoB,SAjBxB,OAAO;;QAiB6C,CAAA;AAE7D;;;GAGG;AACH,wBAAgB,eAAe,CAC7B,IAAI,EAAE;IAAE,MAAM,EAAE,aAAa,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,EAC/C,GAAG,EAAE,MAAM,GACV,aAAa,CAKf"}
|
package/dist/mailbox.js
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { address, bytes32, u64, u256 } from './json-fields.js';
|
|
3
|
+
import { jobRequirementJson, orderIdJson, quoteRequestJson, } from './test-customer.js';
|
|
4
|
+
import { jobTermsJson } from './wire.js';
|
|
5
|
+
/**
|
|
6
|
+
* Avow's sandbox mailbox, which carries a job between two businesses' agents wherever each one
|
|
7
|
+
* runs. Every message is signed by the key that sends it, and Avow keeps each order until it ends,
|
|
8
|
+
* so an agent that reads an order and stops before answering reads it again.
|
|
9
|
+
*
|
|
10
|
+
* 1. The buyer's agent sends an order with an expiry. Nothing is reserved.
|
|
11
|
+
* 2. The supplier's agent reads it from its inbox and sends terms, a quote it signed.
|
|
12
|
+
* 3. The buyer's agent checks the quote, its authority and the bookings the job relies on, funds
|
|
13
|
+
* the commitment, and tells the mailbox, which reads the reserve on chain.
|
|
14
|
+
* 4. The supplier's agent accepts on chain under the commitment's rules, and tells the mailbox,
|
|
15
|
+
* which reads the acceptance on chain.
|
|
16
|
+
*
|
|
17
|
+
* An order nobody funded lapses at its expiry, with nothing reserved. Once funded it's a
|
|
18
|
+
* commitment awaiting acceptance, and the lock's own deadlines decide what happens to the reserve.
|
|
19
|
+
* Each step is answered the same when sent again, so a retry never makes a second commitment.
|
|
20
|
+
*/
|
|
21
|
+
/** The longest an order can wait to be funded, in seconds, from when the buyer sends it. */
|
|
22
|
+
export const MAILBOX_ORDER_LIFETIME_MAX = 60n * 60n;
|
|
23
|
+
/** The most orders an inbox answers with at once, oldest first. */
|
|
24
|
+
export const MAILBOX_INBOX_MAX = 20;
|
|
25
|
+
export const MAILBOX_STATUSES = ['requested', 'quoted', 'expired', 'reserved', 'accepted'];
|
|
26
|
+
const businessIdJson = z.string().min(1).max(100);
|
|
27
|
+
export const jobBuyerJson = z.strictObject({
|
|
28
|
+
businessId: businessIdJson,
|
|
29
|
+
account: address,
|
|
30
|
+
lock: address,
|
|
31
|
+
chainId: z.number().int().positive(),
|
|
32
|
+
mandateHash: bytes32,
|
|
33
|
+
});
|
|
34
|
+
export const mailboxOrderRequestJson = z.strictObject({
|
|
35
|
+
orderId: orderIdJson,
|
|
36
|
+
commitmentId: bytes32,
|
|
37
|
+
supplierBusinessId: businessIdJson,
|
|
38
|
+
terms: jobTermsJson,
|
|
39
|
+
requirement: jobRequirementJson,
|
|
40
|
+
expiry: u64,
|
|
41
|
+
});
|
|
42
|
+
const reserveJson = z.strictObject({ fundedIn: bytes32.nullable(), amount: u256, acceptBy: u64 });
|
|
43
|
+
const base = { ...mailboxOrderRequestJson.shape, buyer: jobBuyerJson, requestedAt: u64 };
|
|
44
|
+
export const mailboxOrderJson = z.discriminatedUnion('status', [
|
|
45
|
+
z.strictObject({ ...base, status: z.literal('requested') }),
|
|
46
|
+
z.strictObject({ ...base, status: z.literal('expired'), quote: quoteRequestJson.nullable() }),
|
|
47
|
+
z.strictObject({ ...base, status: z.literal('quoted'), quote: quoteRequestJson }),
|
|
48
|
+
z.strictObject({
|
|
49
|
+
...base,
|
|
50
|
+
status: z.literal('reserved'),
|
|
51
|
+
quote: quoteRequestJson,
|
|
52
|
+
reserve: reserveJson,
|
|
53
|
+
}),
|
|
54
|
+
z.strictObject({
|
|
55
|
+
...base,
|
|
56
|
+
status: z.literal('accepted'),
|
|
57
|
+
quote: quoteRequestJson,
|
|
58
|
+
reserve: reserveJson,
|
|
59
|
+
acceptedIn: bytes32.nullable(),
|
|
60
|
+
}),
|
|
61
|
+
]);
|
|
62
|
+
/** What the buyer sends once its reserve is on the lock, which Avow then reads for itself. */
|
|
63
|
+
export const mailboxReservedJson = z.strictObject({ fundedIn: bytes32.nullable() });
|
|
64
|
+
/** What the supplier sends once the lock shows its acceptance, which Avow then reads for itself. */
|
|
65
|
+
export const mailboxAcceptedJson = z.strictObject({ acceptedIn: bytes32.nullable() });
|
|
66
|
+
const read = (schema) => (json) => {
|
|
67
|
+
const parsed = schema.safeParse(json);
|
|
68
|
+
return parsed.success ? parsed.data : null;
|
|
69
|
+
};
|
|
70
|
+
export const parseMailboxOrderRequest = read(mailboxOrderRequestJson);
|
|
71
|
+
export const parseMailboxOrder = read(mailboxOrderJson);
|
|
72
|
+
export const parseMailboxInbox = read(z.strictObject({
|
|
73
|
+
orders: z.array(mailboxOrderJson).max(MAILBOX_INBOX_MAX),
|
|
74
|
+
}));
|
|
75
|
+
export const parseMailboxReserved = read(mailboxReservedJson);
|
|
76
|
+
export const parseMailboxAccepted = read(mailboxAcceptedJson);
|
|
77
|
+
/**
|
|
78
|
+
* Where an order stands at `now`, from what the mailbox holds. An order nobody funded is expired
|
|
79
|
+
* from its expiry on, whether or not it was quoted, and a funded one never expires here.
|
|
80
|
+
*/
|
|
81
|
+
export function mailboxStatusAt(held, now) {
|
|
82
|
+
if ((held.status === 'requested' || held.status === 'quoted') && now >= held.expiry) {
|
|
83
|
+
return 'expired';
|
|
84
|
+
}
|
|
85
|
+
return held.status;
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=mailbox.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mailbox.js","sourceRoot":"","sources":["../src/mailbox.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,k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CAAC,CAAA;AAErF,MAAM,IAAI,GACR,CAAI,MAAoB,EAAE,EAAE,CAC5B,CAAC,IAAa,EAAY,EAAE;IAC1B,MAAM,MAAM,GAAG,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,CAAA;IACrC,OAAO,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAA;AAC5C,CAAC,CAAA;AAEH,MAAM,CAAC,MAAM,wBAAwB,GAAG,IAAI,CAC1C,uBAAoE,CACrE,CAAA;AACD,MAAM,CAAC,MAAM,iBAAiB,GAAG,IAAI,CAAC,gBAAsD,CAAC,CAAA;AAC7F,MAAM,CAAC,MAAM,iBAAiB,GAAG,IAAI,CACnC,CAAC,CAAC,YAAY,CAAC;IACb,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC,GAAG,CAAC,iBAAiB,CAAC;CACzD,CAEC,CACH,CAAA;AACD,MAAM,CAAC,MAAM,oBAAoB,GAAG,IAAI,CAAC,mBAAmB,CAAC,CAAA;AAC7D,MAAM,CAAC,MAAM,oBAAoB,GAAG,IAAI,CAAC,mBAAmB,CAAC,CAAA;AAE7D;;;GAGG;AACH,MAAM,UAAU,eAAe,CAC7B,IAA+C,EAC/C,GAAW;IAEX,IAAI,CAAC,IAAI,CAAC,MAAM,KAAK,WAAW,IAAI,IAAI,CAAC,MAAM,KAAK,QAAQ,CAAC,IAAI,GAAG,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;QACpF,OAAO,SAAS,CAAA;IAClB,CAAC;IACD,OAAO,IAAI,CAAC,MAAM,CAAA;AACpB,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { type CheckedChainedTerms } from './dependencies.js';
|
|
2
|
+
import type { TermsProfile } from './profiles.js';
|
|
3
|
+
import { type RailToken } from './rail.js';
|
|
4
|
+
import type { ReasonCode } from './reasons.js';
|
|
5
|
+
import { type AnyTerms, type EnforceableTerms } from './terms.js';
|
|
6
|
+
import type { Mandate, ReserveRequest } from './types.js';
|
|
7
|
+
export interface MandateCheckInput {
|
|
8
|
+
mandate: Mandate;
|
|
9
|
+
/**
|
|
10
|
+
* The reserve request. A verifier checking a commitment made under version 1 terms passes those.
|
|
11
|
+
* Version 3 terms come only as `CheckedChainedTerms`, which short of a deliberate cast only
|
|
12
|
+
* `verifyDependencies` produces, and are checked as the plain booking they make, with their
|
|
13
|
+
* dependencies section checked for form.
|
|
14
|
+
*/
|
|
15
|
+
request: Omit<ReserveRequest, 'terms'> & {
|
|
16
|
+
terms: AnyTerms | CheckedChainedTerms;
|
|
17
|
+
};
|
|
18
|
+
/** The token the buyer's lock holds reserves in. */
|
|
19
|
+
token: RailToken;
|
|
20
|
+
/** Micros already reserved and still open under this mandate, as the lock reports them. */
|
|
21
|
+
openReserves: bigint;
|
|
22
|
+
revoked: boolean;
|
|
23
|
+
now: bigint;
|
|
24
|
+
profile: TermsProfile;
|
|
25
|
+
}
|
|
26
|
+
export type MandateCheck = {
|
|
27
|
+
result: 'approved';
|
|
28
|
+
reason: 'approved';
|
|
29
|
+
} | {
|
|
30
|
+
result: 'needs_human';
|
|
31
|
+
reason: 'approval.human_required';
|
|
32
|
+
} | {
|
|
33
|
+
result: 'denied';
|
|
34
|
+
reason: ReasonCode;
|
|
35
|
+
};
|
|
36
|
+
/** Checks a mandate on its own. Returns null when it's well formed. */
|
|
37
|
+
export declare function validateMandate(m: Mandate): ReasonCode | null;
|
|
38
|
+
/**
|
|
39
|
+
* Whether a mandate expires before the window of a commitment with these terms ends, which leaves
|
|
40
|
+
* the agent unable to act on the commitment for its whole life. The mandate check refuses such a
|
|
41
|
+
* reserve with `mandate.ends_before_window`, and Avow refuses a newly signed mandate that would do
|
|
42
|
+
* this to a commitment the agent already holds.
|
|
43
|
+
*/
|
|
44
|
+
export declare function mandateEndsBeforeWindow(mandate: Pick<Mandate, 'expiry'>, enforced: Pick<EnforceableTerms, 'releaseDate'>): boolean;
|
|
45
|
+
/**
|
|
46
|
+
* The mandate check Avow runs before it signs an approval. It's pure, so the SDK and a supplier
|
|
47
|
+
* can run the same check on the signed mandate. The caller checks the mandate's signature first.
|
|
48
|
+
* It reads version 3 terms as the plain booking they make, and it can't read a lock, so it takes
|
|
49
|
+
* them only as the checked terms the dependency check produces. The types hold a caller to that,
|
|
50
|
+
* short of a deliberate cast, and nothing checks it at run time.
|
|
51
|
+
*/
|
|
52
|
+
export declare function checkMandate(input: MandateCheckInput): MandateCheck;
|
|
53
|
+
//# sourceMappingURL=mandate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mandate.d.ts","sourceRoot":"","sources":["../src/mandate.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,mBAAmB,EAAkB,MAAM,mBAAmB,CAAA;AAC5E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,KAAK,SAAS,EAAgB,MAAM,WAAW,CAAA;AACxD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAC9C,OAAO,EACL,KAAK,QAAQ,EACb,KAAK,gBAAgB,EAMtB,MAAM,YAAY,CAAA;AACnB,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAEzD,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,OAAO,CAAA;IAChB;;;;;OAKG;IACH,OAAO,EAAE,IAAI,CAAC,cAAc,EAAE,OAAO,CAAC,GAAG;QAAE,KAAK,EAAE,QAAQ,GAAG,mBAAmB,CAAA;KAAE,CAAA;IAClF,oDAAoD;IACpD,KAAK,EAAE,SAAS,CAAA;IAChB,2FAA2F;IAC3F,YAAY,EAAE,MAAM,CAAA;IACpB,OAAO,EAAE,OAAO,CAAA;IAChB,GAAG,EAAE,MAAM,CAAA;IACX,OAAO,EAAE,YAAY,CAAA;CACtB;AAED,MAAM,MAAM,YAAY,GACpB;IAAE,MAAM,EAAE,UAAU,CAAC;IAAC,MAAM,EAAE,UAAU,CAAA;CAAE,GAC1C;IAAE,MAAM,EAAE,aAAa,CAAC;IAAC,MAAM,EAAE,yBAAyB,CAAA;CAAE,GAC5D;IAAE,MAAM,EAAE,QAAQ,CAAC;IAAC,MAAM,EAAE,UAAU,CAAA;CAAE,CAAA;AAE5C,uEAAuE;AACvE,wBAAgB,eAAe,CAAC,CAAC,EAAE,OAAO,GAAG,UAAU,GAAG,IAAI,CAS7D;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAC,EAChC,QAAQ,EAAE,IAAI,CAAC,gBAAgB,EAAE,aAAa,CAAC,GAC9C,OAAO,CAET;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,YAAY,CAkDnE"}
|
package/dist/mandate.js
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { isAddressEqual } from 'viem';
|
|
2
|
+
import { isChainedTerms } from './dependencies.js';
|
|
3
|
+
import { toTokenUnits } from './rail.js';
|
|
4
|
+
import { enforceableTerms, plainTermsOf, templateCategoryProblem, validateChainedTerms, validateTerms, } from './terms.js';
|
|
5
|
+
/** Checks a mandate on its own. Returns null when it's well formed. */
|
|
6
|
+
export function validateMandate(m) {
|
|
7
|
+
if (m.suppliers.length === 0 && m.categories.length === 0)
|
|
8
|
+
return 'mandate.invalid';
|
|
9
|
+
if (m.actions.length === 0)
|
|
10
|
+
return 'mandate.invalid';
|
|
11
|
+
if (m.capPerCommitment <= 0n || m.capPerCommitment > m.capOpenReserves)
|
|
12
|
+
return 'mandate.invalid';
|
|
13
|
+
if (m.paymentLimits.length === 0 || m.paymentLimits.some((l) => l.amount <= 0n)) {
|
|
14
|
+
return 'mandate.invalid';
|
|
15
|
+
}
|
|
16
|
+
if (m.approvalRule.kind === 'above' && m.approvalRule.amount < 0n)
|
|
17
|
+
return 'mandate.invalid';
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Whether a mandate expires before the window of a commitment with these terms ends, which leaves
|
|
22
|
+
* the agent unable to act on the commitment for its whole life. The mandate check refuses such a
|
|
23
|
+
* reserve with `mandate.ends_before_window`, and Avow refuses a newly signed mandate that would do
|
|
24
|
+
* this to a commitment the agent already holds.
|
|
25
|
+
*/
|
|
26
|
+
export function mandateEndsBeforeWindow(mandate, enforced) {
|
|
27
|
+
return mandate.expiry < enforced.releaseDate;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* The mandate check Avow runs before it signs an approval. It's pure, so the SDK and a supplier
|
|
31
|
+
* can run the same check on the signed mandate. The caller checks the mandate's signature first.
|
|
32
|
+
* It reads version 3 terms as the plain booking they make, and it can't read a lock, so it takes
|
|
33
|
+
* them only as the checked terms the dependency check produces. The types hold a caller to that,
|
|
34
|
+
* short of a deliberate cast, and nothing checks it at run time.
|
|
35
|
+
*/
|
|
36
|
+
export function checkMandate(input) {
|
|
37
|
+
const { mandate: m, request: r, token } = input;
|
|
38
|
+
const deny = (reason) => ({ result: 'denied', reason });
|
|
39
|
+
const malformed = validateMandate(m);
|
|
40
|
+
if (malformed)
|
|
41
|
+
return deny(malformed);
|
|
42
|
+
if (m.expiry <= input.now)
|
|
43
|
+
return deny('mandate.expired');
|
|
44
|
+
if (input.revoked)
|
|
45
|
+
return deny('mandate.revoked');
|
|
46
|
+
if (!isAddressEqual(r.agentKey, m.agentKey))
|
|
47
|
+
return deny('agent.key_mismatch');
|
|
48
|
+
if (!m.actions.includes('reserve'))
|
|
49
|
+
return deny('mandate.action_not_permitted');
|
|
50
|
+
const termsProblem = isChainedTerms(r.terms)
|
|
51
|
+
? validateChainedTerms(r.terms, input.profile)
|
|
52
|
+
: validateTerms(r.terms, input.profile);
|
|
53
|
+
if (termsProblem)
|
|
54
|
+
return deny(termsProblem);
|
|
55
|
+
// Version 1 terms have no template, so no category of their own.
|
|
56
|
+
const category = 'template' in r.terms ? templateCategoryProblem(r.terms, r.category) : null;
|
|
57
|
+
if (category)
|
|
58
|
+
return deny(category);
|
|
59
|
+
const enforced = enforceableTerms(isChainedTerms(r.terms) ? plainTermsOf(r.terms) : r.terms);
|
|
60
|
+
if (enforced.currency !== m.currency)
|
|
61
|
+
return deny('mandate.currency_not_allowed');
|
|
62
|
+
if (token.currency !== enforced.currency)
|
|
63
|
+
return deny('terms.currency_mismatch');
|
|
64
|
+
if (m.suppliers.length > 0 && !m.suppliers.includes(r.supplier)) {
|
|
65
|
+
return deny('mandate.supplier_not_allowed');
|
|
66
|
+
}
|
|
67
|
+
if (m.categories.length > 0 && !m.categories.includes(r.category)) {
|
|
68
|
+
return deny('mandate.category_not_allowed');
|
|
69
|
+
}
|
|
70
|
+
const amount = enforced.reserve;
|
|
71
|
+
const limit = m.paymentLimits.find((l) => isAddressEqual(l.token, token.token));
|
|
72
|
+
if (!limit)
|
|
73
|
+
return deny('mandate.token_not_allowed');
|
|
74
|
+
let units;
|
|
75
|
+
try {
|
|
76
|
+
units = toTokenUnits(amount, token.decimals);
|
|
77
|
+
}
|
|
78
|
+
catch {
|
|
79
|
+
return deny('mandate.token_not_allowed');
|
|
80
|
+
}
|
|
81
|
+
// The keychain enforces what's left of the limit on-chain. This catches a reserve over the whole
|
|
82
|
+
// limit before anyone signs a transaction that would revert.
|
|
83
|
+
if (units > limit.amount)
|
|
84
|
+
return deny('mandate.over_payment_limit');
|
|
85
|
+
if (amount > m.capPerCommitment)
|
|
86
|
+
return deny('mandate.over_commitment_cap');
|
|
87
|
+
if (input.openReserves + amount > m.capOpenReserves)
|
|
88
|
+
return deny('mandate.over_open_reserves_cap');
|
|
89
|
+
if (mandateEndsBeforeWindow(m, enforced))
|
|
90
|
+
return deny('mandate.ends_before_window');
|
|
91
|
+
const rule = m.approvalRule;
|
|
92
|
+
if (rule.kind === 'always' || (rule.kind === 'above' && amount > rule.amount)) {
|
|
93
|
+
return { result: 'needs_human', reason: 'approval.human_required' };
|
|
94
|
+
}
|
|
95
|
+
return { result: 'approved', reason: 'approved' };
|
|
96
|
+
}
|
|
97
|
+
//# sourceMappingURL=mandate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mandate.js","sourceRoot":"","sources":["../src/mandate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,MAAM,CAAA;AACrC,OAAO,EAA4B,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAE5E,OAAO,EAAkB,YAAY,EAAE,MAAM,WAAW,CAAA;AAExD,OAAO,EAGL,gBAAgB,EAChB,YAAY,EACZ,uBAAuB,EACvB,oBAAoB,EACpB,aAAa,GACd,MAAM,YAAY,CAAA;AA0BnB,uEAAuE;AACvE,MAAM,UAAU,eAAe,CAAC,CAAU;IACxC,IAAI,CAAC,CAAC,SAAS,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,CAAC,UAAU,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,iBAAiB,CAAA;IACnF,IAAI,CAAC,CAAC,OAAO,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,iBAAiB,CAAA;IACpD,IAAI,CAAC,CAAC,gBAAgB,IAAI,EAAE,IAAI,CAAC,CAAC,gBAAgB,GAAG,CAAC,CAAC,eAAe;QAAE,OAAO,iBAAiB,CAAA;IAChG,IAAI,CAAC,CAAC,aAAa,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,IAAI,EAAE,CAAC,EAAE,CAAC;QAChF,OAAO,iBAAiB,CAAA;IAC1B,CAAC;IACD,IAAI,CAAC,CAAC,YAAY,CAAC,IAAI,KAAK,OAAO,IAAI,CAAC,CAAC,YAAY,CAAC,MAAM,GAAG,EAAE;QAAE,OAAO,iBAAiB,CAAA;IAC3F,OAAO,IAAI,CAAA;AACb,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C,CAAA;IAC/E,IAAI,CAAC,KAAK;QAAE,OAAO,IAAI,CAAC,2BAA2B,CAAC,CAAA;IACpD,IAAI,KAAa,CAAA;IACjB,IAAI,CAAC;QACH,KAAK,GAAG,YAAY,CAAC,MAAM,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAA;IAC9C,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC,2BAA2B,CAAC,CAAA;IAC1C,CAAC;IACD,iGAAiG;IACjG,6DAA6D;IAC7D,IAAI,KAAK,GAAG,KAAK,CAAC,MAAM;QAAE,OAAO,IAAI,CAAC,4BAA4B,CAAC,CAAA;IACnE,IAAI,MAAM,GAAG,CAAC,CAAC,gBAAgB;QAAE,OAAO,IAAI,CAAC,6BAA6B,CAAC,CAAA;IAC3E,IAAI,KAAK,CAAC,YAAY,GAAG,MAAM,GAAG,CAAC,CAAC,eAAe;QAAE,OAAO,IAAI,CAAC,gCAAgC,CAAC,CAAA;IAClG,IAAI,uBAAuB,CAAC,CAAC,EAAE,QAAQ,CAAC;QAAE,OAAO,IAAI,CAAC,4BAA4B,CAAC,CAAA;IAEnF,MAAM,IAAI,GAAG,CAAC,CAAC,YAAY,CAAA;IAC3B,IAAI,IAAI,CAAC,IAAI,KAAK,QAAQ,IAAI,CAAC,IAAI,CAAC,IAAI,KAAK,OAAO,IAAI,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;QAC9E,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,yBAAyB,EAAE,CAAA;IACrE,CAAC;IACD,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,CAAA;AACnD,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type TermsProfile } from './profiles.js';
|
|
2
|
+
/** Tempo's Moderato testnet. */
|
|
3
|
+
export declare const TEMPO_MODERATO = 42431;
|
|
4
|
+
/** Chains where test data and the testnet demo profile may run. */
|
|
5
|
+
export declare const TESTNET_CHAIN_IDS: readonly number[];
|
|
6
|
+
export declare function isTestnetChain(chainId: number): boolean;
|
|
7
|
+
/**
|
|
8
|
+
* Throws when a config would accept test data, or a contest window shorter than production's, on
|
|
9
|
+
* a chain that isn't a testnet. It reads the window itself rather than the profile's name, so a
|
|
10
|
+
* profile can't pass by being called production. It's a setup mistake, so it stops the caller
|
|
11
|
+
* before any check runs.
|
|
12
|
+
*/
|
|
13
|
+
export declare function assertTestSettingsOnTestnet(config: {
|
|
14
|
+
chainId: number;
|
|
15
|
+
testData: boolean;
|
|
16
|
+
profile: TermsProfile;
|
|
17
|
+
}): void;
|
|
18
|
+
//# sourceMappingURL=networks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"networks.d.ts","sourceRoot":"","sources":["../src/networks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,KAAK,YAAY,EAAE,MAAM,eAAe,CAAA;AAErE,gCAAgC;AAChC,eAAO,MAAM,cAAc,QAAQ,CAAA;AAEnC,mEAAmE;AACnE,eAAO,MAAM,iBAAiB,EAAE,SAAS,MAAM,EAAqB,CAAA;AAEpE,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAEvD;AAED;;;;;GAKG;AACH,wBAAgB,2BAA2B,CAAC,MAAM,EAAE;IAClD,OAAO,EAAE,MAAM,CAAA;IACf,QAAQ,EAAE,OAAO,CAAA;IACjB,OAAO,EAAE,YAAY,CAAA;CACtB,GAAG,IAAI,CAQP"}
|
package/dist/networks.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { PRODUCTION_PROFILE } from './profiles.js';
|
|
2
|
+
/** Tempo's Moderato testnet. */
|
|
3
|
+
export const TEMPO_MODERATO = 42431;
|
|
4
|
+
/** Chains where test data and the testnet demo profile may run. */
|
|
5
|
+
export const TESTNET_CHAIN_IDS = [TEMPO_MODERATO];
|
|
6
|
+
export function isTestnetChain(chainId) {
|
|
7
|
+
return TESTNET_CHAIN_IDS.includes(chainId);
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Throws when a config would accept test data, or a contest window shorter than production's, on
|
|
11
|
+
* a chain that isn't a testnet. It reads the window itself rather than the profile's name, so a
|
|
12
|
+
* profile can't pass by being called production. It's a setup mistake, so it stops the caller
|
|
13
|
+
* before any check runs.
|
|
14
|
+
*/
|
|
15
|
+
export function assertTestSettingsOnTestnet(config) {
|
|
16
|
+
if (isTestnetChain(config.chainId))
|
|
17
|
+
return;
|
|
18
|
+
if (config.testData)
|
|
19
|
+
throw new Error(`Test data is refused on chain ${config.chainId}`);
|
|
20
|
+
if (config.profile.minContestWindow < PRODUCTION_PROFILE.minContestWindow) {
|
|
21
|
+
throw new Error(`A contest window under ${PRODUCTION_PROFILE.minContestWindow} seconds is refused on chain ${config.chainId}`);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=networks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"networks.js","sourceRoot":"","sources":["../src/networks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAqB,MAAM,eAAe,CAAA;AAErE,gCAAgC;AAChC,MAAM,CAAC,MAAM,cAAc,GAAG,KAAK,CAAA;AAEnC,mEAAmE;AACnE,MAAM,CAAC,MAAM,iBAAiB,GAAsB,CAAC,cAAc,CAAC,CAAA;AAEpE,MAAM,UAAU,cAAc,CAAC,OAAe;IAC5C,OAAO,iBAAiB,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAA;AAC5C,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,2BAA2B,CAAC,MAI3C;IACC,IAAI,cAAc,CAAC,MAAM,CAAC,OAAO,CAAC;QAAE,OAAM;IAC1C,IAAI,MAAM,CAAC,QAAQ;QAAE,MAAM,IAAI,KAAK,CAAC,iCAAiC,MAAM,CAAC,OAAO,EAAE,CAAC,CAAA;IACvF,IAAI,MAAM,CAAC,OAAO,CAAC,gBAAgB,GAAG,kBAAkB,CAAC,gBAAgB,EAAE,CAAC;QAC1E,MAAM,IAAI,KAAK,CACb,0BAA0B,kBAAkB,CAAC,gBAAgB,gCAAgC,MAAM,CAAC,OAAO,EAAE,CAC9G,CAAA;IACH,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/** The timing a factory fixes in every lock it creates, in seconds. */
|
|
2
|
+
export interface LockTiming {
|
|
3
|
+
/** The shortest contest window a commitment can have. */
|
|
4
|
+
minContestWindow: bigint;
|
|
5
|
+
/** How long Avow has to confirm or refer a report. */
|
|
6
|
+
confirmWindow: bigint;
|
|
7
|
+
/** How long a posted ruling waits before it takes effect. */
|
|
8
|
+
rulingDelay: bigint;
|
|
9
|
+
/** When, counted from a pause, Avow's ruling key stops ruling and the arbiter can start. */
|
|
10
|
+
rulingKeyEnd: bigint;
|
|
11
|
+
/** When, counted from a pause, a charge nobody ruled on resolves. */
|
|
12
|
+
day90: bigint;
|
|
13
|
+
}
|
|
14
|
+
/** Limits that differ between the production factory and the testnet demo factory. */
|
|
15
|
+
export interface TermsProfile {
|
|
16
|
+
name: 'production' | 'testnet-demo';
|
|
17
|
+
minContestWindow: bigint;
|
|
18
|
+
/** The timing of the locks this profile's factory creates. A supplier accepts no other. */
|
|
19
|
+
lockTiming: LockTiming;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* The intended production limits and lock timing. They're unaudited, and no deployed factory
|
|
23
|
+
* creates locks with this timing yet, so a supplier that uses this profile refuses today's locks.
|
|
24
|
+
*/
|
|
25
|
+
export declare const PRODUCTION_PROFILE: TermsProfile;
|
|
26
|
+
/**
|
|
27
|
+
* The testnet demo factory's limits, with dispute timing in minutes so a whole commitment runs in
|
|
28
|
+
* one sitting. That factory doesn't enforce every production limit.
|
|
29
|
+
*/
|
|
30
|
+
export declare const TESTNET_DEMO_PROFILE: TermsProfile;
|
|
31
|
+
//# sourceMappingURL=profiles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profiles.d.ts","sourceRoot":"","sources":["../src/profiles.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,MAAM,WAAW,UAAU;IACzB,yDAAyD;IACzD,gBAAgB,EAAE,MAAM,CAAA;IACxB,sDAAsD;IACtD,aAAa,EAAE,MAAM,CAAA;IACrB,6DAA6D;IAC7D,WAAW,EAAE,MAAM,CAAA;IACnB,4FAA4F;IAC5F,YAAY,EAAE,MAAM,CAAA;IACpB,qEAAqE;IACrE,KAAK,EAAE,MAAM,CAAA;CACd;AAED,sFAAsF;AACtF,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,YAAY,GAAG,cAAc,CAAA;IACnC,gBAAgB,EAAE,MAAM,CAAA;IACxB,2FAA2F;IAC3F,UAAU,EAAE,UAAU,CAAA;CACvB;AAKD;;;GAGG;AACH,eAAO,MAAM,kBAAkB,EAAE,YAUhC,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,oBAAoB,EAAE,YAUlC,CAAA"}
|
package/dist/profiles.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
const HOUR = 3600n;
|
|
2
|
+
const DAY = 24n * HOUR;
|
|
3
|
+
/**
|
|
4
|
+
* The intended production limits and lock timing. They're unaudited, and no deployed factory
|
|
5
|
+
* creates locks with this timing yet, so a supplier that uses this profile refuses today's locks.
|
|
6
|
+
*/
|
|
7
|
+
export const PRODUCTION_PROFILE = {
|
|
8
|
+
name: 'production',
|
|
9
|
+
minContestWindow: 72n * HOUR,
|
|
10
|
+
lockTiming: {
|
|
11
|
+
minContestWindow: 72n * HOUR,
|
|
12
|
+
confirmWindow: DAY,
|
|
13
|
+
rulingDelay: DAY,
|
|
14
|
+
rulingKeyEnd: 30n * DAY,
|
|
15
|
+
day90: 90n * DAY,
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* The testnet demo factory's limits, with dispute timing in minutes so a whole commitment runs in
|
|
20
|
+
* one sitting. That factory doesn't enforce every production limit.
|
|
21
|
+
*/
|
|
22
|
+
export const TESTNET_DEMO_PROFILE = {
|
|
23
|
+
name: 'testnet-demo',
|
|
24
|
+
minContestWindow: 600n,
|
|
25
|
+
lockTiming: {
|
|
26
|
+
minContestWindow: 600n,
|
|
27
|
+
confirmWindow: 300n,
|
|
28
|
+
rulingDelay: 300n,
|
|
29
|
+
rulingKeyEnd: 1800n,
|
|
30
|
+
day90: 5400n,
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=profiles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profiles.js","sourceRoot":"","sources":["../src/profiles.ts"],"names":[],"mappings":"AAsBA,MAAM,IAAI,GAAG,KAAK,CAAA;AAClB,MAAM,GAAG,GAAG,GAAG,GAAG,IAAI,CAAA;AAEtB;;;GAGG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAiB;IAC9C,IAAI,EAAE,YAAY;IAClB,gBAAgB,EAAE,GAAG,GAAG,IAAI;IAC5B,UAAU,EAAE;QACV,gBAAgB,EAAE,GAAG,GAAG,IAAI;QAC5B,aAAa,EAAE,GAAG;QAClB,WAAW,EAAE,GAAG;QAChB,YAAY,EAAE,GAAG,GAAG,GAAG;QACvB,KAAK,EAAE,GAAG,GAAG,GAAG;KACjB;CACF,CAAA;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAiB;IAChD,IAAI,EAAE,cAAc;IACpB,gBAAgB,EAAE,IAAI;IACtB,UAAU,EAAE;QACV,gBAAgB,EAAE,IAAI;QACtB,aAAa,EAAE,IAAI;QACnB,WAAW,EAAE,IAAI;QACjB,YAAY,EAAE,KAAK;QACnB,KAAK,EAAE,KAAK;KACb;CACF,CAAA"}
|
package/dist/rail.d.ts
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { Address, Hex } from 'viem';
|
|
2
|
+
import type { Currency, Side } from './types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Everything that depends on the rail sits in this file. A second rail adds a variant here, and the
|
|
5
|
+
* commitment, its terms and its states stay as they are.
|
|
6
|
+
*/
|
|
7
|
+
export type Rail = 'tempo';
|
|
8
|
+
/** A token on a rail and the currency it stands for. */
|
|
9
|
+
export interface RailToken {
|
|
10
|
+
rail: Rail;
|
|
11
|
+
chainId: number;
|
|
12
|
+
token: Address;
|
|
13
|
+
currency: Currency;
|
|
14
|
+
decimals: number;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Converts micros into a token's base units. A token with fewer than 6 decimals can't carry
|
|
18
|
+
* every micro, so an amount it can't represent exactly throws.
|
|
19
|
+
*/
|
|
20
|
+
export declare function toTokenUnits(micros: bigint, decimals: number): bigint;
|
|
21
|
+
/**
|
|
22
|
+
* One side's backing on Tempo. The lock stores these fields, and Avow's approval signs them.
|
|
23
|
+
*/
|
|
24
|
+
export interface BackingRef {
|
|
25
|
+
rail: Rail;
|
|
26
|
+
/** 42431 on Moderato. */
|
|
27
|
+
chainId: number;
|
|
28
|
+
/** The backer's own lock. */
|
|
29
|
+
lock: Address;
|
|
30
|
+
commitmentId: Hex;
|
|
31
|
+
side: Side;
|
|
32
|
+
/** A TIP-20, with 6 decimals. */
|
|
33
|
+
token: Address;
|
|
34
|
+
/** Base units of the token. */
|
|
35
|
+
amount: bigint;
|
|
36
|
+
/** On the lock's approved list. */
|
|
37
|
+
payee: Address;
|
|
38
|
+
acceptBy: bigint;
|
|
39
|
+
chargeDeadline: bigint;
|
|
40
|
+
contestWindow: bigint;
|
|
41
|
+
releaseDate: bigint;
|
|
42
|
+
/** The salted hash of the full terms. */
|
|
43
|
+
termsHash: Hex;
|
|
44
|
+
}
|
|
45
|
+
/** A backing's state in the lock, as the settlement adapter reads it. */
|
|
46
|
+
export declare const RAIL_STATES: readonly ['none', 'reserved', 'accepted', 'charge_pending', 'paused', 'released', 'charged', 'resolved'];
|
|
47
|
+
export type RailState = (typeof RAIL_STATES)[number];
|
|
48
|
+
//# sourceMappingURL=rail.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rail.d.ts","sourceRoot":"","sources":["../src/rail.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,MAAM,CAAA;AACxC,OAAO,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AAEhD;;;GAGG;AACH,MAAM,MAAM,IAAI,GAAG,OAAO,CAAA;AAE1B,wDAAwD;AACxD,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,IAAI,CAAA;IACV,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,EAAE,OAAO,CAAA;IACd,QAAQ,EAAE,QAAQ,CAAA;IAClB,QAAQ,EAAE,MAAM,CAAA;CACjB;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAUrE;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,IAAI,CAAA;IACV,yBAAyB;IACzB,OAAO,EAAE,MAAM,CAAA;IACf,6BAA6B;IAC7B,IAAI,EAAE,OAAO,CAAA;IACb,YAAY,EAAE,GAAG,CAAA;IACjB,IAAI,EAAE,IAAI,CAAA;IACV,iCAAiC;IACjC,KAAK,EAAE,OAAO,CAAA;IACd,+BAA+B;IAC/B,MAAM,EAAE,MAAM,CAAA;IACd,mCAAmC;IACnC,KAAK,EAAE,OAAO,CAAA;IACd,QAAQ,EAAE,MAAM,CAAA;IAChB,cAAc,EAAE,MAAM,CAAA;IACtB,aAAa,EAAE,MAAM,CAAA;IACrB,WAAW,EAAE,MAAM,CAAA;IACnB,yCAAyC;IACzC,SAAS,EAAE,GAAG,CAAA;CACf;AAED,yEAAyE;AACzE,eAAO,MAAM,WAAW,YACtB,MAAM,EACN,UAAU,EACV,UAAU,EACV,gBAAgB,EAChB,QAAQ,EACR,UAAU,EACV,SAAS,EACT,UAAU,CACF,CAAA;AACV,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,CAAC,CAAA"}
|
package/dist/rail.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Converts micros into a token's base units. A token with fewer than 6 decimals can't carry
|
|
3
|
+
* every micro, so an amount it can't represent exactly throws.
|
|
4
|
+
*/
|
|
5
|
+
export function toTokenUnits(micros, decimals) {
|
|
6
|
+
if (!Number.isInteger(decimals) || decimals < 0 || decimals > 36) {
|
|
7
|
+
throw new RangeError(`A token can't have ${decimals} decimals`);
|
|
8
|
+
}
|
|
9
|
+
if (decimals >= 6)
|
|
10
|
+
return micros * 10n ** BigInt(decimals - 6);
|
|
11
|
+
const step = 10n ** BigInt(6 - decimals);
|
|
12
|
+
if (micros % step !== 0n) {
|
|
13
|
+
throw new RangeError(`${micros} micros can't be paid in a token with ${decimals} decimals`);
|
|
14
|
+
}
|
|
15
|
+
return micros / step;
|
|
16
|
+
}
|
|
17
|
+
/** A backing's state in the lock, as the settlement adapter reads it. */
|
|
18
|
+
export const RAIL_STATES = [
|
|
19
|
+
'none',
|
|
20
|
+
'reserved',
|
|
21
|
+
'accepted',
|
|
22
|
+
'charge_pending',
|
|
23
|
+
'paused',
|
|
24
|
+
'released',
|
|
25
|
+
'charged',
|
|
26
|
+
'resolved',
|
|
27
|
+
];
|
|
28
|
+
//# sourceMappingURL=rail.js.map
|
package/dist/rail.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rail.js","sourceRoot":"","sources":["../src/rail.ts"],"names":[],"mappings":"AAkBA;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,MAAc,EAAE,QAAgB;IAC3D,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,QAAQ,GAAG,CAAC,IAAI,QAAQ,GAAG,EAAE,EAAE,CAAC;QACjE,MAAM,IAAI,UAAU,CAAC,sBAAsB,QAAQ,WAAW,CAAC,CAAA;IACjE,CAAC;IACD,IAAI,QAAQ,IAAI,CAAC;QAAE,OAAO,MAAM,GAAG,GAAG,IAAI,MAAM,CAAC,QAAQ,GAAG,CAAC,CAAC,CAAA;IAC9D,MAAM,IAAI,GAAG,GAAG,IAAI,MAAM,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAA;IACxC,IAAI,MAAM,GAAG,IAAI,KAAK,EAAE,EAAE,CAAC;QACzB,MAAM,IAAI,UAAU,CAAC,GAAG,MAAM,yCAAyC,QAAQ,WAAW,CAAC,CAAA;IAC7F,CAAC;IACD,OAAO,MAAM,GAAG,IAAI,CAAA;AACtB,CAAC;AA2BD,yEAAyE;AACzE,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,MAAM;IACN,UAAU;IACV,UAAU;IACV,gBAAgB;IAChB,QAAQ;IACR,UAAU;IACV,SAAS;IACT,UAAU;CACF,CAAA"}
|