@avow-finance/verifier 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.
Files changed (63) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +112 -2
  3. package/dist/accept.d.ts +170 -0
  4. package/dist/accept.d.ts.map +1 -0
  5. package/dist/accept.js +268 -0
  6. package/dist/accept.js.map +1 -0
  7. package/dist/authorization.d.ts +65 -0
  8. package/dist/authorization.d.ts.map +1 -0
  9. package/dist/authorization.js +192 -0
  10. package/dist/authorization.js.map +1 -0
  11. package/dist/chain.d.ts +160 -0
  12. package/dist/chain.d.ts.map +1 -0
  13. package/dist/chain.js +72 -0
  14. package/dist/chain.js.map +1 -0
  15. package/dist/consent.d.ts +69 -0
  16. package/dist/consent.d.ts.map +1 -0
  17. package/dist/consent.js +98 -0
  18. package/dist/consent.js.map +1 -0
  19. package/dist/dependency.d.ts +252 -0
  20. package/dist/dependency.d.ts.map +1 -0
  21. package/dist/dependency.js +353 -0
  22. package/dist/dependency.js.map +1 -0
  23. package/dist/disclosure.d.ts +88 -0
  24. package/dist/disclosure.d.ts.map +1 -0
  25. package/dist/disclosure.js +210 -0
  26. package/dist/disclosure.js.map +1 -0
  27. package/dist/index.d.ts +17 -0
  28. package/dist/index.d.ts.map +1 -0
  29. package/dist/index.js +17 -0
  30. package/dist/index.js.map +1 -0
  31. package/dist/issued.d.ts +5 -0
  32. package/dist/issued.d.ts.map +1 -0
  33. package/dist/issued.js +24 -0
  34. package/dist/issued.js.map +1 -0
  35. package/dist/lock-abi.d.ts +471 -0
  36. package/dist/lock-abi.d.ts.map +1 -0
  37. package/dist/lock-abi.js +452 -0
  38. package/dist/lock-abi.js.map +1 -0
  39. package/dist/nonce.d.ts +3 -0
  40. package/dist/nonce.d.ts.map +1 -0
  41. package/dist/nonce.js +4 -0
  42. package/dist/nonce.js.map +1 -0
  43. package/dist/references.d.ts +38 -0
  44. package/dist/references.d.ts.map +1 -0
  45. package/dist/references.js +93 -0
  46. package/dist/references.js.map +1 -0
  47. package/dist/report.d.ts +128 -0
  48. package/dist/report.d.ts.map +1 -0
  49. package/dist/report.js +155 -0
  50. package/dist/report.js.map +1 -0
  51. package/dist/signing.d.ts +47 -0
  52. package/dist/signing.d.ts.map +1 -0
  53. package/dist/signing.js +51 -0
  54. package/dist/signing.js.map +1 -0
  55. package/dist/tempo.d.ts +70 -0
  56. package/dist/tempo.d.ts.map +1 -0
  57. package/dist/tempo.js +341 -0
  58. package/dist/tempo.js.map +1 -0
  59. package/dist/verify.d.ts +65 -0
  60. package/dist/verify.d.ts.map +1 -0
  61. package/dist/verify.js +36 -0
  62. package/dist/verify.js.map +1 -0
  63. package/package.json +34 -3
@@ -0,0 +1,88 @@
1
+ import { type Approval, type ChargeKind, type ChargeReport, type LockTiming, type RailToken, type ReleaseConsent } from '@avow-finance/spec';
2
+ import { type Address, type Hex } from 'viem';
3
+ export interface DisclosureSection {
4
+ heading: string;
5
+ lines: readonly string[];
6
+ }
7
+ /**
8
+ * What a person sees before the supplier signs. The signing call takes `id` back, so the
9
+ * integration has to fetch this disclosure and confirm it before anything is signed. It can't
10
+ * make a person read it, so an integration shows every section in full.
11
+ */
12
+ export interface Disclosure {
13
+ title: string;
14
+ /** The EIP-712 digest the signature covers. */
15
+ digest: Hex;
16
+ sections: readonly DisclosureSection[];
17
+ /** Set when a release consent names a later report count than the commitment has. */
18
+ preauthorization: {
19
+ currentCount: number;
20
+ consentCount: number;
21
+ } | null;
22
+ /** The keccak256 of the canonical JSON of everything above. */
23
+ id: Hex;
24
+ }
25
+ /** The id of a disclosure, from everything it shows. */
26
+ export declare function disclosureId(d: Omit<Disclosure, 'id'>): Hex;
27
+ /** A unix time as an ISO 8601 time in UTC, to the second. */
28
+ export declare function formatTime(t: bigint): string;
29
+ /** A duration in the largest whole unit it fits. */
30
+ export declare function formatDuration(seconds: bigint): string;
31
+ /** A length of time in days, hours, minutes and seconds, leaving out the parts that are zero. */
32
+ export declare function formatLength(seconds: bigint): string;
33
+ /** Base units of a token as an amount of its currency, with the base units beside it. */
34
+ export declare function formatAmount(units: bigint, token: RailToken): string;
35
+ /** The token a supplier lists that a lock on its chain holds reserves in, or null when it lists none. */
36
+ export declare function listedToken(tokens: readonly RailToken[], chainId: number, token: Address): RailToken | null;
37
+ /** Base units of a lock's token as an amount of its currency, or as base units when it isn't listed. */
38
+ export declare function formatLockAmount(units: bigint, token: RailToken | null): string;
39
+ /** Basis points as a percentage. */
40
+ export declare function formatShare(bps: number): string;
41
+ /** How each kind of charge reads to a person, at the start of a sentence. */
42
+ export declare const CHARGE_NAMES: Record<ChargeKind, string>;
43
+ /** The disclosure for an acceptance, built from the approval the lock holds and the lock's timing. */
44
+ export declare function acceptanceDisclosure(args: {
45
+ digest: Hex;
46
+ /** When the acceptance itself stops working. */
47
+ expiry: bigint;
48
+ approval: Approval;
49
+ approvalDigest: Hex;
50
+ lock: Address;
51
+ chainId: number;
52
+ account: Address;
53
+ token: RailToken;
54
+ timing: LockTiming;
55
+ }): Disclosure;
56
+ /** The disclosure for a report of a charge, built from what the lock holds for the commitment. */
57
+ export declare function reportDisclosure(args: {
58
+ digest: Hex;
59
+ report: ChargeReport;
60
+ lock: Address;
61
+ chainId: number;
62
+ /** The business account the lock holds the reserve for. */
63
+ account: Address;
64
+ /** Where a charge pays, as the lock stores it. */
65
+ payee: Address;
66
+ /** The lock's token, or null when the supplier doesn't list it. */
67
+ token: RailToken | null;
68
+ chargeDeadline: bigint;
69
+ contestWindow: bigint;
70
+ day90SupplierShareBps: number;
71
+ timing: LockTiming;
72
+ /** The reports filed on the commitment before this one. */
73
+ reportCount: number;
74
+ }): Disclosure;
75
+ /** The disclosure for a release consent. */
76
+ export declare function releaseConsentDisclosure(args: {
77
+ digest: Hex;
78
+ consent: ReleaseConsent;
79
+ lock: Address;
80
+ chainId: number;
81
+ account: Address;
82
+ held: bigint;
83
+ token: RailToken | null;
84
+ currentCount: number;
85
+ /** When the consent was prepared. */
86
+ now: bigint;
87
+ }): Disclosure;
88
+ //# sourceMappingURL=disclosure.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"disclosure.d.ts","sourceRoot":"","sources":["../src/disclosure.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,QAAQ,EAEb,KAAK,UAAU,EACf,KAAK,YAAY,EAEjB,KAAK,UAAU,EACf,KAAK,SAAS,EACd,KAAK,cAAc,EAEpB,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EACL,KAAK,OAAO,EAGZ,KAAK,GAAG,EAIT,MAAM,MAAM,CAAA;AAEb,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,EAAE,SAAS,MAAM,EAAE,CAAA;CACzB;AAED;;;;GAIG;AACH,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,MAAM,CAAA;IACb,+CAA+C;IAC/C,MAAM,EAAE,GAAG,CAAA;IACX,QAAQ,EAAE,SAAS,iBAAiB,EAAE,CAAA;IACtC,qFAAqF;IACrF,gBAAgB,EAAE;QAAE,YAAY,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAA;IACvE,+DAA+D;IAC/D,EAAE,EAAE,GAAG,CAAA;CACR;AAED,wDAAwD;AACxD,wBAAgB,YAAY,CAAC,CAAC,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,GAAG,GAAG,CAW3D;AAMD,6DAA6D;AAC7D,wBAAgB,UAAU,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAE5C;AAED,oDAAoD;AACpD,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAatD;AAED,iGAAiG;AACjG,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAiBpD;AAED,yFAAyF;AACzF,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,GAAG,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UAAU,CAAA;IAClB,2DAA2D;IAC3D,WAAW,EAAE,MAAM,CAAA;CACpB,GAAG,UAAU,CAwCb;AAED,4CAA4C;AAC5C,wBAAgB,wBAAwB,CAAC,IAAI,EAAE;IAC7C,MAAM,EAAE,GAAG,CAAA;IACX,OAAO,EAAE,cAAc,CAAA;IACvB,IAAI,EAAE,OAAO,CAAA;IACb,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,OAAO,CAAA;IAChB,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,SAAS,GAAG,IAAI,CAAA;IACvB,YAAY,EAAE,MAAM,CAAA;IACpB,qCAAqC;IACrC,GAAG,EAAE,MAAM,CAAA;CACZ,GAAG,UAAU,CAuCb"}
@@ -0,0 +1,210 @@
1
+ import { CHARGE_KINDS, canonicalJson, } from '@avow-finance/spec';
2
+ import { formatUnits, getAddress, isAddressEqual, keccak256, stringToHex, } from 'viem';
3
+ /** The id of a disclosure, from everything it shows. */
4
+ export function disclosureId(d) {
5
+ return keccak256(stringToHex(canonicalJson({
6
+ title: d.title,
7
+ digest: d.digest,
8
+ sections: d.sections.map((s) => ({ heading: s.heading, lines: [...s.lines] })),
9
+ preauthorization: d.preauthorization,
10
+ })));
11
+ }
12
+ function seal(d) {
13
+ return { ...d, id: disclosureId(d) };
14
+ }
15
+ /** A unix time as an ISO 8601 time in UTC, to the second. */
16
+ export function formatTime(t) {
17
+ return new Date(Number(t) * 1000).toISOString().replace('.000Z', 'Z');
18
+ }
19
+ /** A duration in the largest whole unit it fits. */
20
+ export function formatDuration(seconds) {
21
+ const units = [
22
+ [86400n, 'day'],
23
+ [3600n, 'hour'],
24
+ [60n, 'minute'],
25
+ ];
26
+ for (const [size, name] of units) {
27
+ if (seconds >= size && seconds % size === 0n) {
28
+ const n = seconds / size;
29
+ return `${n} ${name}${n === 1n ? '' : 's'}`;
30
+ }
31
+ }
32
+ return `${seconds} second${seconds === 1n ? '' : 's'}`;
33
+ }
34
+ /** A length of time in days, hours, minutes and seconds, leaving out the parts that are zero. */
35
+ export function formatLength(seconds) {
36
+ const units = [
37
+ [86400n, 'day'],
38
+ [3600n, 'hour'],
39
+ [60n, 'minute'],
40
+ [1n, 'second'],
41
+ ];
42
+ const parts = [];
43
+ let rest = seconds;
44
+ for (const [size, name] of units) {
45
+ const n = rest / size;
46
+ rest %= size;
47
+ if (n > 0n)
48
+ parts.push(`${n} ${name}${n === 1n ? '' : 's'}`);
49
+ }
50
+ const last = parts.pop();
51
+ if (last === undefined)
52
+ return '0 seconds';
53
+ return parts.length === 0 ? last : `${parts.join(', ')} and ${last}`;
54
+ }
55
+ /** Base units of a token as an amount of its currency, with the base units beside it. */
56
+ export function formatAmount(units, token) {
57
+ return `${token.currency} ${formatUnits(units, token.decimals)} (${units} base units of ${getAddress(token.token)})`;
58
+ }
59
+ /** The token a supplier lists that a lock on its chain holds reserves in, or null when it lists none. */
60
+ export function listedToken(tokens, chainId, token) {
61
+ return tokens.find((t) => t.chainId === chainId && isAddressEqual(t.token, token)) ?? null;
62
+ }
63
+ /** Base units of a lock's token as an amount of its currency, or as base units when it isn't listed. */
64
+ export function formatLockAmount(units, token) {
65
+ return token ? formatAmount(units, token) : `${units} base units of the lock's token`;
66
+ }
67
+ /** Basis points as a percentage. */
68
+ export function formatShare(bps) {
69
+ return `${Number((bps / 100).toFixed(2))}%`;
70
+ }
71
+ /** How each kind of charge reads to a person, at the start of a sentence. */
72
+ export const CHARGE_NAMES = {
73
+ lateCancellation: 'A late cancellation',
74
+ noShow: 'A no-show',
75
+ };
76
+ const REASON_NAMES = {
77
+ kept: 'the commitment was kept',
78
+ supplierFailed: 'the supplier failed to provide the capacity',
79
+ };
80
+ /** The disclosure for an acceptance, built from the approval the lock holds and the lock's timing. */
81
+ export function acceptanceDisclosure(args) {
82
+ const { approval: a, token, timing } = args;
83
+ const amount = (units) => formatAmount(units, token);
84
+ const charges = [...a.charges].sort((x, y) => CHARGE_KINDS[x.kind] - CHARGE_KINDS[y.kind]);
85
+ return seal({
86
+ title: 'Accept a reserve',
87
+ digest: args.digest,
88
+ preauthorization: null,
89
+ sections: [
90
+ {
91
+ heading: "What you're accepting",
92
+ lines: [
93
+ `You accept the reserve for commitment ${a.commitmentId} on lock ${getAddress(args.lock)}, chain ${args.chainId}, held for business account ${getAddress(args.account)}.`,
94
+ `Your acceptance binds you to every term of Avow's approval with digest ${args.approvalDigest}, which the lock stores.`,
95
+ ],
96
+ },
97
+ {
98
+ heading: 'Your exposure',
99
+ lines: [
100
+ `The business reserved ${amount(a.amount)}. None of it reaches you unless a charge you report is confirmed and its contest window closes, or a ruling or the day-90 split pays it.`,
101
+ ...charges.map((c) => `${CHARGE_NAMES[c.kind]} can charge up to ${amount(c.most)}, reported from ${formatTime(c.earliest)} and before ${formatTime(a.chargeDeadline)}.`),
102
+ `Charges pay to ${getAddress(a.payee)}.`,
103
+ ],
104
+ },
105
+ {
106
+ heading: 'Deadlines',
107
+ lines: [
108
+ `Free cancellation ends at ${formatTime(a.freeCancelBy)}. Until then the business can take the whole reserve back without your consent.`,
109
+ `This acceptance stops working at ${formatTime(args.expiry)}, and the lock takes no acceptance from ${formatTime(a.acceptBy)}.`,
110
+ `Report any charge before ${formatTime(a.chargeDeadline)}.`,
111
+ `With no report, the reserve goes back to the business at ${formatTime(a.releaseDate)}.`,
112
+ ],
113
+ },
114
+ {
115
+ heading: 'Disputes',
116
+ lines: [
117
+ `Avow confirms or refers each report within ${formatDuration(timing.confirmWindow)}, and a report it doesn't answer in time goes to a ruling.`,
118
+ `The business can contest a confirmed charge for ${formatDuration(a.contestWindow)}, and a report Avow hasn't confirmed at any time. Avow can also pause a confirmed charge before its contest window closes. Each of these sends the charge to a ruling.`,
119
+ 'The commitment takes at most two reports, one at a time.',
120
+ `A contested or referred charge is paused. Avow's ruling key can rule for ${formatDuration(timing.rulingKeyEnd)} after the pause, then the arbiter ${getAddress(a.arbiter)} can rule until ${formatDuration(timing.day90)} after it, and a ruling takes effect ${formatDuration(timing.rulingDelay)} after it's posted.`,
121
+ `A confirmed charge still unruled ${formatDuration(timing.day90)} after the pause pays you ${formatShare(a.day90SupplierShareBps)} of it, and the rest goes back to the business. A charge Avow never confirmed goes back to the business in full.`,
122
+ ],
123
+ },
124
+ ],
125
+ });
126
+ }
127
+ /** The disclosure for a report of a charge, built from what the lock holds for the commitment. */
128
+ export function reportDisclosure(args) {
129
+ const { report: r, timing } = args;
130
+ const amount = formatLockAmount(r.amount, args.token);
131
+ return seal({
132
+ title: 'Report a charge',
133
+ digest: args.digest,
134
+ preauthorization: null,
135
+ sections: [
136
+ {
137
+ heading: "What you're reporting",
138
+ lines: [
139
+ `You report ${CHARGE_NAMES[r.kind].toLowerCase()} on commitment ${r.commitmentId} on lock ${getAddress(args.lock)}, chain ${args.chainId}, held for business account ${getAddress(args.account)}.`,
140
+ `It charges ${amount}, paid to ${getAddress(args.payee)}.`,
141
+ `It names the evidence with hash ${r.evidenceHash}, so keep what that hash covers for a ruling.`,
142
+ ],
143
+ },
144
+ {
145
+ heading: 'What happens next',
146
+ lines: [
147
+ `Avow confirms or refers the report within ${formatDuration(timing.confirmWindow)} of the first report of its kind on this commitment, and a report it doesn't answer by then goes to a ruling.`,
148
+ 'Once Avow answers the report, or it goes to a ruling unanswered, the lock keeps only the charge and gives the rest of the reserve back to the business.',
149
+ `A confirmed charge pays once its contest window of ${formatDuration(args.contestWindow)} closes, unless the business contests it or Avow pauses it first.`,
150
+ `The business can contest a report Avow hasn't confirmed at any time. A contested, paused or referred charge waits for a ruling, and one still unruled ${formatDuration(timing.day90)} after its pause pays you ${formatShare(args.day90SupplierShareBps)} of it if Avow confirmed it and nothing if Avow didn't.`,
151
+ ],
152
+ },
153
+ {
154
+ heading: 'Reports',
155
+ lines: [
156
+ `This is report ${args.reportCount + 1} of the two the commitment takes, and the lock takes no other report while it stands.`,
157
+ "Your supplier account's root key can withdraw it before Avow answers it and before its deadline.",
158
+ ],
159
+ },
160
+ {
161
+ heading: 'Expiry',
162
+ lines: [
163
+ `It stops working at ${formatTime(r.expiry)}, and the lock takes no report from ${formatTime(args.chargeDeadline)}.`,
164
+ ],
165
+ },
166
+ ],
167
+ });
168
+ }
169
+ /** The disclosure for a release consent. */
170
+ export function releaseConsentDisclosure(args) {
171
+ const { consent: c } = args;
172
+ const held = formatLockAmount(args.held, args.token);
173
+ const later = c.reportCount > args.currentCount;
174
+ const until = formatTime(c.expiry);
175
+ return seal({
176
+ title: 'Consent to release a reserve',
177
+ digest: args.digest,
178
+ preauthorization: later
179
+ ? { currentCount: args.currentCount, consentCount: c.reportCount }
180
+ : null,
181
+ sections: [
182
+ {
183
+ heading: "What you're consenting to",
184
+ lines: [
185
+ `This consent releases everything lock ${getAddress(args.lock)}, chain ${args.chainId}, holds for commitment ${c.commitmentId} back to the business account ${getAddress(args.account)}, ${held} now.`,
186
+ 'You give up any charge on the commitment, reported or not, including one Avow has confirmed.',
187
+ `It records that ${REASON_NAMES[c.reason]}.`,
188
+ ],
189
+ },
190
+ {
191
+ heading: 'Report count',
192
+ lines: later
193
+ ? [
194
+ `It names report count ${c.reportCount}, and the commitment has ${args.currentCount}, so the lock refuses it now.`,
195
+ `Once the commitment has ${c.reportCount} reports, anyone holding this consent can send it until ${until} and release the reserve, which gives up the charge in that report. That's preauthorization, so sign it only if you mean to give that charge up in advance.`,
196
+ ]
197
+ : [
198
+ `It names report count ${c.reportCount}, the count the commitment has now. Anyone holding it can send it until ${until} and release the reserve, and it stops working if another report is filed first.`,
199
+ ],
200
+ },
201
+ {
202
+ heading: 'Expiry',
203
+ lines: [
204
+ `It stops working at ${until}, ${formatLength(c.expiry - args.now)} after it was prepared, or sooner once a ruling is posted or the commitment ends.`,
205
+ ],
206
+ },
207
+ ],
208
+ });
209
+ }
210
+ //# sourceMappingURL=disclosure.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"disclosure.js","sourceRoot":"","sources":["../src/disclosure.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,YAAY,EAGZ,aAAa,GAKd,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,OAAO,IAAI,CAAC;QACV,KAAK,EAAE,8BAA8B;QACrC,MAAM,EAAE,IAAI,CAAC,MAAM;QACnB,gBAAgB,EAAE,KAAK;YACrB,CAAC,CAAC,EAAE,YAAY,EAAE,IAAI,CAAC,YAAY,EAAE,YAAY,EAAE,CAAC,CAAC,WAAW,EAAE;YAClE,CAAC,CAAC,IAAI;QACR,QAAQ,EAAE;YACR;gBACE,OAAO,EAAE,2BAA2B;gBACpC,KAAK,EAAE;oBACL,yCAAyC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,IAAI,CAAC,OAAO,0BAA0B,CAAC,CAAC,YAAY,iCAAiC,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,IAAI,OAAO;oBACtM,8FAA8F;oBAC9F,mBAAmB,YAAY,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG;iBAC7C;aACF;YACD;gBACE,OAAO,EAAE,cAAc;gBACvB,KAAK,EAAE,KAAK;oBACV,CAAC,CAAC;wBACE,yBAAyB,CAAC,CAAC,WAAW,4BAA4B,IAAI,CAAC,YAAY,+BAA+B;wBAClH,2BAA2B,CAAC,CAAC,WAAW,2DAA2D,KAAK,6JAA6J;qBACtQ;oBACH,CAAC,CAAC;wBACE,yBAAyB,CAAC,CAAC,WAAW,2EAA2E,KAAK,kFAAkF;qBACzM;aACN;YACD;gBACE,OAAO,EAAE,QAAQ;gBACjB,KAAK,EAAE;oBACL,uBAAuB,KAAK,KAAK,YAAY,CAAC,CAAC,CAAC,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,mFAAmF;iBACtJ;aACF;SACF;KACF,CAAC,CAAA;AACJ,CAAC"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Avow verifier. A supplier checks a commitment's authorization, its terms and the reserve on
3
+ * the chain without calling Avow.
4
+ *
5
+ * Pre-release. Every interface may change before 1.0.
6
+ */
7
+ export * from './accept.js';
8
+ export * from './chain.js';
9
+ export * from './consent.js';
10
+ export * from './dependency.js';
11
+ export * from './disclosure.js';
12
+ export * from './lock-abi.js';
13
+ export * from './references.js';
14
+ export * from './report.js';
15
+ export * from './tempo.js';
16
+ export * from './verify.js';
17
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA;AAC1B,cAAc,cAAc,CAAA;AAC5B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,eAAe,CAAA;AAC7B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA;AAC1B,cAAc,aAAa,CAAA"}
package/dist/index.js ADDED
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Avow verifier. A supplier checks a commitment's authorization, its terms and the reserve on
3
+ * the chain without calling Avow.
4
+ *
5
+ * Pre-release. Every interface may change before 1.0.
6
+ */
7
+ export * from './accept.js';
8
+ export * from './chain.js';
9
+ export * from './consent.js';
10
+ export * from './dependency.js';
11
+ export * from './disclosure.js';
12
+ export * from './lock-abi.js';
13
+ export * from './references.js';
14
+ export * from './report.js';
15
+ export * from './tempo.js';
16
+ export * from './verify.js';
17
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA;AAC1B,cAAc,cAAc,CAAA;AAC5B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,eAAe,CAAA;AAC7B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA;AAC1B,cAAc,aAAa,CAAA"}
@@ -0,0 +1,5 @@
1
+ /** Freezes a prepared result all the way down and records it as one this library built. */
2
+ export declare function issue<T extends object>(value: T): T;
3
+ /** Whether this library built the value and nothing has replaced it. */
4
+ export declare function wasIssued(value: unknown): boolean;
5
+ //# sourceMappingURL=issued.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"issued.d.ts","sourceRoot":"","sources":["../src/issued.ts"],"names":[],"mappings":"AAaA,2FAA2F;AAC3F,wBAAgB,KAAK,CAAC,CAAC,SAAS,MAAM,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,CAInD;AAED,wEAAwE;AACxE,wBAAgB,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAEjD"}
package/dist/issued.js ADDED
@@ -0,0 +1,24 @@
1
+ /**
2
+ * The prepared messages this library built. A signing call signs only one of these, as it was
3
+ * built, so a copy or an edit can't carry a message past the checks or past the disclosure the
4
+ * person confirmed.
5
+ */
6
+ const issued = new WeakSet();
7
+ function freeze(value) {
8
+ if (typeof value !== 'object' || value === null || Object.isFrozen(value))
9
+ return;
10
+ for (const inner of Object.values(value))
11
+ freeze(inner);
12
+ Object.freeze(value);
13
+ }
14
+ /** Freezes a prepared result all the way down and records it as one this library built. */
15
+ export function issue(value) {
16
+ freeze(value);
17
+ issued.add(value);
18
+ return value;
19
+ }
20
+ /** Whether this library built the value and nothing has replaced it. */
21
+ export function wasIssued(value) {
22
+ return typeof value === 'object' && value !== null && issued.has(value);
23
+ }
24
+ //# sourceMappingURL=issued.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"issued.js","sourceRoot":"","sources":["../src/issued.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,MAAM,GAAG,IAAI,OAAO,EAAU,CAAA;AAEpC,SAAS,MAAM,CAAC,KAAc;IAC5B,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC;QAAE,OAAM;IACjF,KAAK,MAAM,KAAK,IAAI,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC;QAAE,MAAM,CAAC,KAAK,CAAC,CAAA;IACvD,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;AACtB,CAAC;AAED,2FAA2F;AAC3F,MAAM,UAAU,KAAK,CAAmB,KAAQ;IAC9C,MAAM,CAAC,KAAK,CAAC,CAAA;IACb,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;IACjB,OAAO,KAAK,CAAA;AACd,CAAC;AAED,wEAAwE;AACxE,MAAM,UAAU,SAAS,CAAC,KAAc;IACtC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;AACzE,CAAC"}