@avow-finance/verifier 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.
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,452 @@
1
+ /**
2
+ * The views of the lock that the Tempo reader calls, as the contract declares them. `commitment`
3
+ * returns the lock's stored record for one side of a commitment.
4
+ */
5
+ export const LOCK_ABI = [
6
+ {
7
+ type: 'function',
8
+ name: 'account',
9
+ inputs: [],
10
+ outputs: [
11
+ {
12
+ name: '',
13
+ type: 'address',
14
+ },
15
+ ],
16
+ stateMutability: 'view',
17
+ },
18
+ {
19
+ type: 'function',
20
+ name: 'token',
21
+ inputs: [],
22
+ outputs: [
23
+ {
24
+ name: '',
25
+ type: 'address',
26
+ },
27
+ ],
28
+ stateMutability: 'view',
29
+ },
30
+ {
31
+ type: 'function',
32
+ name: 'factory',
33
+ inputs: [],
34
+ outputs: [
35
+ {
36
+ name: '',
37
+ type: 'address',
38
+ },
39
+ ],
40
+ stateMutability: 'view',
41
+ },
42
+ {
43
+ type: 'function',
44
+ name: 'minContestWindow',
45
+ inputs: [],
46
+ outputs: [
47
+ {
48
+ name: '',
49
+ type: 'uint64',
50
+ },
51
+ ],
52
+ stateMutability: 'view',
53
+ },
54
+ {
55
+ type: 'function',
56
+ name: 'confirmWindow',
57
+ inputs: [],
58
+ outputs: [
59
+ {
60
+ name: '',
61
+ type: 'uint64',
62
+ },
63
+ ],
64
+ stateMutability: 'view',
65
+ },
66
+ {
67
+ type: 'function',
68
+ name: 'rulingDelay',
69
+ inputs: [],
70
+ outputs: [
71
+ {
72
+ name: '',
73
+ type: 'uint64',
74
+ },
75
+ ],
76
+ stateMutability: 'view',
77
+ },
78
+ {
79
+ type: 'function',
80
+ name: 'rulingKeyEnd',
81
+ inputs: [],
82
+ outputs: [
83
+ {
84
+ name: '',
85
+ type: 'uint64',
86
+ },
87
+ ],
88
+ stateMutability: 'view',
89
+ },
90
+ {
91
+ type: 'function',
92
+ name: 'day90',
93
+ inputs: [],
94
+ outputs: [
95
+ {
96
+ name: '',
97
+ type: 'uint64',
98
+ },
99
+ ],
100
+ stateMutability: 'view',
101
+ },
102
+ {
103
+ type: 'function',
104
+ name: 'commitment',
105
+ inputs: [
106
+ {
107
+ name: 'commitmentId',
108
+ type: 'bytes32',
109
+ },
110
+ {
111
+ name: 'side',
112
+ type: 'uint8',
113
+ },
114
+ ],
115
+ outputs: [
116
+ {
117
+ name: '',
118
+ type: 'tuple',
119
+ components: [
120
+ {
121
+ name: 'state',
122
+ type: 'uint8',
123
+ },
124
+ {
125
+ name: 'hasReport',
126
+ type: 'bool',
127
+ },
128
+ {
129
+ name: 'reportFinal',
130
+ type: 'bool',
131
+ },
132
+ {
133
+ name: 'confirmed',
134
+ type: 'bool',
135
+ },
136
+ {
137
+ name: 'contested',
138
+ type: 'bool',
139
+ },
140
+ {
141
+ name: 'hasRuling',
142
+ type: 'bool',
143
+ },
144
+ {
145
+ name: 'kinds',
146
+ type: 'uint8',
147
+ },
148
+ {
149
+ name: 'reportKind',
150
+ type: 'uint8',
151
+ },
152
+ {
153
+ name: 'reportCount',
154
+ type: 'uint8',
155
+ },
156
+ {
157
+ name: 'pausedBy',
158
+ type: 'uint8',
159
+ },
160
+ {
161
+ name: 'day90ShareBps',
162
+ type: 'uint16',
163
+ },
164
+ {
165
+ name: 'businessEvidence',
166
+ type: 'uint16',
167
+ },
168
+ {
169
+ name: 'supplierEvidence',
170
+ type: 'uint16',
171
+ },
172
+ {
173
+ name: 'freeCancelBy',
174
+ type: 'uint64',
175
+ },
176
+ {
177
+ name: 'acceptBy',
178
+ type: 'uint64',
179
+ },
180
+ {
181
+ name: 'chargeDeadline',
182
+ type: 'uint64',
183
+ },
184
+ {
185
+ name: 'releaseDate',
186
+ type: 'uint64',
187
+ },
188
+ {
189
+ name: 'contestWindow',
190
+ type: 'uint64',
191
+ },
192
+ {
193
+ name: 'reportDeadline',
194
+ type: 'uint64',
195
+ },
196
+ {
197
+ name: 'chargeStart',
198
+ type: 'uint64',
199
+ },
200
+ {
201
+ name: 'pausedAt',
202
+ type: 'uint64',
203
+ },
204
+ {
205
+ name: 'rulingPostedAt',
206
+ type: 'uint64',
207
+ },
208
+ {
209
+ name: 'reportedAt',
210
+ type: 'uint64',
211
+ },
212
+ {
213
+ name: 'amount',
214
+ type: 'uint128',
215
+ },
216
+ {
217
+ name: 'held',
218
+ type: 'uint128',
219
+ },
220
+ {
221
+ name: 'reportAmount',
222
+ type: 'uint128',
223
+ },
224
+ {
225
+ name: 'rulingToSupplier',
226
+ type: 'uint128',
227
+ },
228
+ {
229
+ name: 'supplier',
230
+ type: 'address',
231
+ },
232
+ {
233
+ name: 'supplierSigner',
234
+ type: 'address',
235
+ },
236
+ {
237
+ name: 'payout',
238
+ type: 'address',
239
+ },
240
+ {
241
+ name: 'arbiter',
242
+ type: 'address',
243
+ },
244
+ {
245
+ name: 'rulingByArbiter',
246
+ type: 'bool',
247
+ },
248
+ {
249
+ name: 'fundedBy',
250
+ type: 'address',
251
+ },
252
+ {
253
+ name: 'termsHash',
254
+ type: 'bytes32',
255
+ },
256
+ {
257
+ name: 'mandateHash',
258
+ type: 'bytes32',
259
+ },
260
+ {
261
+ name: 'approvalHash',
262
+ type: 'bytes32',
263
+ },
264
+ {
265
+ name: 'reportEvidence',
266
+ type: 'bytes32',
267
+ },
268
+ {
269
+ name: 'most',
270
+ type: 'uint128[4]',
271
+ },
272
+ {
273
+ name: 'earliest',
274
+ type: 'uint64[4]',
275
+ },
276
+ {
277
+ name: 'firstReportAt',
278
+ type: 'uint64[4]',
279
+ },
280
+ ],
281
+ },
282
+ ],
283
+ stateMutability: 'view',
284
+ },
285
+ ];
286
+ /**
287
+ * The lock factory's functions, as the testnet factory declares them, defined once for every
288
+ * package. The Tempo reader calls `isLock` to learn whether the factory created a lock. Anyone can
289
+ * call `createLock` to create an account's lock, at the address `lockAddress` gives before it
290
+ * exists, and an account has one lock.
291
+ */
292
+ export const FACTORY_ABI = [
293
+ {
294
+ type: 'function',
295
+ name: 'isLock',
296
+ inputs: [
297
+ {
298
+ name: 'lock',
299
+ type: 'address',
300
+ },
301
+ ],
302
+ outputs: [
303
+ {
304
+ name: '',
305
+ type: 'bool',
306
+ },
307
+ ],
308
+ stateMutability: 'view',
309
+ },
310
+ {
311
+ type: 'function',
312
+ name: 'createLock',
313
+ inputs: [
314
+ {
315
+ name: 'account',
316
+ type: 'address',
317
+ },
318
+ ],
319
+ outputs: [
320
+ {
321
+ name: 'lock',
322
+ type: 'address',
323
+ },
324
+ ],
325
+ stateMutability: 'nonpayable',
326
+ },
327
+ {
328
+ type: 'function',
329
+ name: 'lockAddress',
330
+ inputs: [
331
+ {
332
+ name: 'account',
333
+ type: 'address',
334
+ },
335
+ ],
336
+ outputs: [
337
+ {
338
+ name: '',
339
+ type: 'address',
340
+ },
341
+ ],
342
+ stateMutability: 'view',
343
+ },
344
+ ];
345
+ /**
346
+ * The event the factory logs for each lock it creates, as the testnet factory declares it. Its
347
+ * logs from the block the factory was created in name every lock the factory made.
348
+ */
349
+ export const FACTORY_EVENTS_ABI = [
350
+ {
351
+ type: 'event',
352
+ name: 'LockCreated',
353
+ inputs: [
354
+ { name: 'account', type: 'address', indexed: true },
355
+ { name: 'lock', type: 'address', indexed: false },
356
+ ],
357
+ anonymous: false,
358
+ },
359
+ ];
360
+ /**
361
+ * The lock's events that open and end one side of a commitment, as the testnet lock declares
362
+ * them. `Reserved` opens a side, and `Released`, `Charged` and `Resolved` each end one. Every other
363
+ * step a side takes, such as an acceptance or a report, comes between the two. Each indexes only
364
+ * the commitment id, so a reader can follow one commitment by its topic.
365
+ */
366
+ export const LOCK_EVENTS_ABI = [
367
+ {
368
+ type: 'event',
369
+ name: 'Reserved',
370
+ inputs: [
371
+ { name: 'commitmentId', type: 'bytes32', indexed: true },
372
+ { name: 'side', type: 'uint8', indexed: false },
373
+ { name: 'termsHash', type: 'bytes32', indexed: false },
374
+ { name: 'mandateHash', type: 'bytes32', indexed: false },
375
+ { name: 'amount', type: 'uint256', indexed: false },
376
+ { name: 'supplier', type: 'address', indexed: false },
377
+ { name: 'payout', type: 'address', indexed: false },
378
+ { name: 'fundedBy', type: 'address', indexed: false },
379
+ { name: 'approvalNonce', type: 'uint256', indexed: false },
380
+ { name: 'approvalHash', type: 'bytes32', indexed: false },
381
+ ],
382
+ anonymous: false,
383
+ },
384
+ {
385
+ type: 'event',
386
+ name: 'Released',
387
+ inputs: [
388
+ { name: 'commitmentId', type: 'bytes32', indexed: true },
389
+ { name: 'side', type: 'uint8', indexed: false },
390
+ { name: 'termsHash', type: 'bytes32', indexed: false },
391
+ { name: 'cause', type: 'uint8', indexed: false },
392
+ { name: 'reason', type: 'uint8', indexed: false },
393
+ { name: 'evidenceHash', type: 'bytes32', indexed: false },
394
+ { name: 'returned', type: 'uint256', indexed: false },
395
+ ],
396
+ anonymous: false,
397
+ },
398
+ {
399
+ type: 'event',
400
+ name: 'Charged',
401
+ inputs: [
402
+ { name: 'commitmentId', type: 'bytes32', indexed: true },
403
+ { name: 'side', type: 'uint8', indexed: false },
404
+ { name: 'termsHash', type: 'bytes32', indexed: false },
405
+ { name: 'amount', type: 'uint256', indexed: false },
406
+ { name: 'evidenceHash', type: 'bytes32', indexed: false },
407
+ ],
408
+ anonymous: false,
409
+ },
410
+ {
411
+ type: 'event',
412
+ name: 'Resolved',
413
+ inputs: [
414
+ { name: 'commitmentId', type: 'bytes32', indexed: true },
415
+ { name: 'side', type: 'uint8', indexed: false },
416
+ { name: 'termsHash', type: 'bytes32', indexed: false },
417
+ { name: 'byRuling', type: 'bool', indexed: false },
418
+ { name: 'toSupplier', type: 'uint256', indexed: false },
419
+ { name: 'toBusiness', type: 'uint256', indexed: false },
420
+ { name: 'evidenceHash', type: 'bytes32', indexed: false },
421
+ ],
422
+ anonymous: false,
423
+ },
424
+ ];
425
+ /**
426
+ * The lock's event for a charge it pauses until someone rules, as the testnet lock declares it. A
427
+ * contest logs it with the business's reason code and its statement hash as `evidenceHash`. A report
428
+ * Avow didn't answer in time and Avow's own pause log it too, each with its own cause.
429
+ */
430
+ export const LOCK_PAUSED_EVENT_ABI = [
431
+ {
432
+ type: 'event',
433
+ name: 'Paused',
434
+ inputs: [
435
+ { name: 'commitmentId', type: 'bytes32', indexed: true },
436
+ { name: 'side', type: 'uint8', indexed: false },
437
+ { name: 'termsHash', type: 'bytes32', indexed: false },
438
+ { name: 'cause', type: 'uint8', indexed: false },
439
+ { name: 'pausedAt', type: 'uint64', indexed: false },
440
+ { name: 'reasonCode', type: 'uint16', indexed: false },
441
+ { name: 'evidenceHash', type: 'bytes32', indexed: false },
442
+ { name: 'returned', type: 'uint256', indexed: false },
443
+ ],
444
+ anonymous: false,
445
+ },
446
+ ];
447
+ /**
448
+ * What paused a charge, by the code the lock stores as a commitment's `pausedBy` and logs as the
449
+ * `Paused` event's `cause`. A referral logs its own event instead.
450
+ */
451
+ export const PAUSE_CAUSES = { referral: 1, timeout: 2, contest: 3, avowPause: 4 };
452
+ //# sourceMappingURL=lock-abi.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lock-abi.js","sourceRoot":"","sources":["../src/lock-abi.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB;QACE,IAAI,EAAE,UAAU;QAChB,IAAI,EAAE,SAAS;QACf,MAAM,EAAE,EAAE;QACV,OAAO,EAAE;YACP;gBACE,IAAI,EAAE,E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,EAAE,KAAK,EAAE;YACtD,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE;YAChD,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE;YACpD,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE;YACtD,EAAE,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE;YACzD,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE;SACtD;QACD,SAAS,EAAE,KAAK;KACjB;CACO,CAAA;AAEV;;;GAGG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,EAAE,QAAQ,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,EAAW,CAAA"}
@@ -0,0 +1,3 @@
1
+ /** A fresh nonce for a message the supplier signs, from 32 random bytes. */
2
+ export declare const randomNonce: () => bigint;
3
+ //# sourceMappingURL=nonce.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nonce.d.ts","sourceRoot":"","sources":["../src/nonce.ts"],"names":[],"mappings":"AAEA,4EAA4E;AAC5E,eAAO,MAAM,WAAW,cAAuE,CAAA"}
package/dist/nonce.js ADDED
@@ -0,0 +1,4 @@
1
+ import { hexToBigInt, toHex } from 'viem';
2
+ /** A fresh nonce for a message the supplier signs, from 32 random bytes. */
3
+ export const randomNonce = () => hexToBigInt(toHex(crypto.getRandomValues(new Uint8Array(32))));
4
+ //# sourceMappingURL=nonce.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nonce.js","sourceRoot":"","sources":["../src/nonce.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,MAAM,CAAA;AAEzC,4EAA4E;AAC5E,MAAM,CAAC,MAAM,WAAW,GAAG,GAAG,EAAE,CAAC,WAAW,CAAC,KAAK,CAAC,MAAM,CAAC,eAAe,CAAC,IAAI,UAAU,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAA"}
@@ -0,0 +1,38 @@
1
+ import { type AnyTerms, type CommitmentReference, type PaymentReference, type PaymentToken, type RailToken, type ReasonCode } from '@avow-finance/spec';
2
+ import { type Hex } from 'viem';
3
+ import type { ChainReader } from './chain.js';
4
+ export type ReferenceCheck = {
5
+ ok: true;
6
+ } | {
7
+ ok: false;
8
+ reason: ReasonCode;
9
+ };
10
+ /**
11
+ * Checks a payment reference against the chain the reader reads. The reference names its own
12
+ * token, so the caller says which tokens it accepts, and a reference to any other token is refused
13
+ * before the chain is read. It passes only when the transaction succeeded and is finalized, and the
14
+ * log at the reference's index is that token's own TIP-20 `TransferWithMemo` event, with exactly
15
+ * the reference's sender, recipient, amount and memo. A payment is evidence that money moved and
16
+ * never backs a commitment.
17
+ */
18
+ export declare function verifyPaymentReference(ref: PaymentReference, chain: ChainReader, accepted: readonly PaymentToken[]): Promise<ReferenceCheck>;
19
+ /**
20
+ * Checks that a commitment reference names a lock Avow's factory created, and that the lock holds
21
+ * that commitment and side under the reference's terms hash.
22
+ */
23
+ export declare function verifyCommitmentReference(ref: CommitmentReference, chain: ChainReader): Promise<ReferenceCheck>;
24
+ /**
25
+ * Checks a commitment on the chain against its terms, for any terms version this code reads. The
26
+ * terms and salt have to give the terms hash the lock holds, the reference has to name the side
27
+ * the terms' backing secures, the lock's token has to be one the caller accepts for the terms'
28
+ * currency, and every field the lock enforces has to be what those terms map to in that token's
29
+ * units, the same mapping Avow's API signs with. It lets anyone holding the terms check a
30
+ * commitment made under version 1 or 2 without asking Avow.
31
+ */
32
+ export declare function verifyCommitmentTerms(input: {
33
+ reference: CommitmentReference;
34
+ terms: AnyTerms;
35
+ salt: Hex;
36
+ acceptedTokens: readonly RailToken[];
37
+ }, chain: ChainReader): Promise<ReferenceCheck>;
38
+ //# sourceMappingURL=references.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"references.d.ts","sourceRoot":"","sources":["../src/references.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,QAAQ,EAEb,KAAK,mBAAmB,EAOxB,KAAK,gBAAgB,EACrB,KAAK,YAAY,EACjB,KAAK,SAAS,EACd,KAAK,UAAU,EAGhB,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EAAE,KAAK,GAAG,EAAkB,MAAM,MAAM,CAAA;AAC/C,OAAO,KAAK,EAAE,WAAW,EAA2B,MAAM,YAAY,CAAA;AAEtE,MAAM,MAAM,cAAc,GAAG;IAAE,EAAE,EAAE,IAAI,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,UAAU,CAAA;CAAE,CAAA;AAK7E;;;;;;;GAOG;AACH,wBAAsB,sBAAsB,CAC1C,GAAG,EAAE,gBAAgB,EACrB,KAAK,EAAE,WAAW,EAClB,QAAQ,EAAE,SAAS,YAAY,EAAE,GAChC,OAAO,CAAC,cAAc,CAAC,CAMzB;AAeD;;;GAGG;AACH,wBAAsB,yBAAyB,CAC7C,GAAG,EAAE,mBAAmB,EACxB,KAAK,EAAE,WAAW,GACjB,OAAO,CAAC,cAAc,CAAC,CAGzB;AAED;;;;;;;GAOG;AACH,wBAAsB,qBAAqB,CACzC,KAAK,EAAE;IACL,SAAS,EAAE,mBAAmB,CAAA;IAC9B,KAAK,EAAE,QAAQ,CAAA;IACf,IAAI,EAAE,GAAG,CAAA;IACT,cAAc,EAAE,SAAS,SAAS,EAAE,CAAA;CACrC,EACD,KAAK,EAAE,WAAW,GACjB,OAAO,CAAC,cAAc,CAAC,CAoCzB"}
@@ -0,0 +1,93 @@
1
+ import { acceptsPaymentToken, checkPaymentReference, enforceableTerms, isTermsV1, lockRecordDifferences, lockTerms, termsHash, termsShapeProblem, } from '@avow-finance/spec';
2
+ import { isAddressEqual } from 'viem';
3
+ const refuse = (reason) => ({ ok: false, reason });
4
+ const same = (a, b) => a.toLowerCase() === b.toLowerCase();
5
+ /**
6
+ * Checks a payment reference against the chain the reader reads. The reference names its own
7
+ * token, so the caller says which tokens it accepts, and a reference to any other token is refused
8
+ * before the chain is read. It passes only when the transaction succeeded and is finalized, and the
9
+ * log at the reference's index is that token's own TIP-20 `TransferWithMemo` event, with exactly
10
+ * the reference's sender, recipient, amount and memo. A payment is evidence that money moved and
11
+ * never backs a commitment.
12
+ */
13
+ export async function verifyPaymentReference(ref, chain, accepted) {
14
+ if (!acceptsPaymentToken(ref, accepted))
15
+ return refuse('payment.token_not_accepted');
16
+ if (ref.chainId !== chain.chainId)
17
+ return refuse('payment.not_found');
18
+ const seen = await chain.transfer(ref.transactionHash, ref.logIndex);
19
+ const problem = checkPaymentReference(ref, seen, accepted);
20
+ return problem ? refuse(problem) : { ok: true };
21
+ }
22
+ /** The lock and the commitment a reference names, or why the chain shows neither. */
23
+ async function findCommitment(ref, chain) {
24
+ const missing = (reason) => ({ ok: false, reason });
25
+ if (ref.chainId !== chain.chainId)
26
+ return missing('message.wrong_chain');
27
+ const info = await chain.lock(ref.lock);
28
+ if (!info?.fromFactory)
29
+ return missing('chain.lock_unknown');
30
+ const held = await chain.backing(ref.lock, ref.commitmentId, ref.side);
31
+ if (!held || !same(held.termsHash, ref.termsHash))
32
+ return missing('reference.commitment_mismatch');
33
+ return { ok: true, info, held };
34
+ }
35
+ /**
36
+ * Checks that a commitment reference names a lock Avow's factory created, and that the lock holds
37
+ * that commitment and side under the reference's terms hash.
38
+ */
39
+ export async function verifyCommitmentReference(ref, chain) {
40
+ const found = await findCommitment(ref, chain);
41
+ return found.ok ? { ok: true } : found;
42
+ }
43
+ /**
44
+ * Checks a commitment on the chain against its terms, for any terms version this code reads. The
45
+ * terms and salt have to give the terms hash the lock holds, the reference has to name the side
46
+ * the terms' backing secures, the lock's token has to be one the caller accepts for the terms'
47
+ * currency, and every field the lock enforces has to be what those terms map to in that token's
48
+ * units, the same mapping Avow's API signs with. It lets anyone holding the terms check a
49
+ * commitment made under version 1 or 2 without asking Avow.
50
+ */
51
+ export async function verifyCommitmentTerms(input, chain) {
52
+ const ref = input.reference;
53
+ const t = input.terms;
54
+ const found = await findCommitment(ref, chain);
55
+ if (!found.ok)
56
+ return found;
57
+ const { info, held } = found;
58
+ const shape = termsShapeProblem(t);
59
+ if (shape)
60
+ return refuse(shape);
61
+ // Version 1 terms written before the dispute block existed can't be checked against a lock.
62
+ if (isTermsV1(t) && !t.dispute)
63
+ return refuse('terms.incomplete');
64
+ let hash;
65
+ try {
66
+ hash = termsHash(t, input.salt);
67
+ }
68
+ catch {
69
+ // A salt the hash refuses, such as a short one or all zeros, can't give the hash the lock holds.
70
+ return refuse('terms.hash_mismatch');
71
+ }
72
+ if (!same(hash, ref.termsHash))
73
+ return refuse('terms.hash_mismatch');
74
+ const enforced = enforceableTerms(t);
75
+ if (ref.side !== enforced.side)
76
+ return refuse('reference.commitment_mismatch');
77
+ const token = input.acceptedTokens.find((a) => a.chainId === ref.chainId &&
78
+ isAddressEqual(a.token, info.token) &&
79
+ isAddressEqual(a.token, held.token) &&
80
+ a.currency === enforced.currency);
81
+ if (!token)
82
+ return refuse('authorization.token_not_accepted');
83
+ let expected;
84
+ try {
85
+ expected = lockTerms(t, token.decimals);
86
+ }
87
+ catch {
88
+ return refuse('authorization.token_not_accepted');
89
+ }
90
+ const differs = lockRecordDifferences(held, expected);
91
+ return differs.length === 0 ? { ok: true } : refuse('chain.reserve_mismatch');
92
+ }
93
+ //# sourceMappingURL=references.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"references.js","sourceRoot":"","sources":["../src/references.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,mBAAmB,EAEnB,qBAAqB,EACrB,gBAAgB,EAChB,SAAS,EAET,qBAAqB,EACrB,SAAS,EAKT,SAAS,EACT,iBAAiB,GAClB,MAAM,oBA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