@avow-finance/spec 0.6.0 → 0.8.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 (102) hide show
  1. package/dist/agent-connect.d.ts +11 -3
  2. package/dist/agent-connect.d.ts.map +1 -1
  3. package/dist/agent-connect.js +4 -4
  4. package/dist/agent-connect.js.map +1 -1
  5. package/dist/agent-session.d.ts +10 -0
  6. package/dist/agent-session.d.ts.map +1 -1
  7. package/dist/api.d.ts +607 -0
  8. package/dist/api.d.ts.map +1 -1
  9. package/dist/api.js +109 -77
  10. package/dist/api.js.map +1 -1
  11. package/dist/dependencies.d.ts.map +1 -1
  12. package/dist/dependencies.js +8 -2
  13. package/dist/dependencies.js.map +1 -1
  14. package/dist/eip712.d.ts +429 -16
  15. package/dist/eip712.d.ts.map +1 -1
  16. package/dist/eip712.js +97 -27
  17. package/dist/eip712.js.map +1 -1
  18. package/dist/gpu-reservation.d.ts.map +1 -1
  19. package/dist/gpu-reservation.js +1 -1
  20. package/dist/gpu-reservation.js.map +1 -1
  21. package/dist/index.d.ts +5 -0
  22. package/dist/index.d.ts.map +1 -1
  23. package/dist/index.js +5 -0
  24. package/dist/index.js.map +1 -1
  25. package/dist/job-session.d.ts +20 -0
  26. package/dist/job-session.d.ts.map +1 -1
  27. package/dist/job.d.ts.map +1 -1
  28. package/dist/job.js +1 -1
  29. package/dist/job.js.map +1 -1
  30. package/dist/json-fields.d.ts +2 -0
  31. package/dist/json-fields.d.ts.map +1 -1
  32. package/dist/json-fields.js +2 -0
  33. package/dist/json-fields.js.map +1 -1
  34. package/dist/mailbox.d.ts +77 -104
  35. package/dist/mailbox.d.ts.map +1 -1
  36. package/dist/mailbox.js +8 -30
  37. package/dist/mailbox.js.map +1 -1
  38. package/dist/mandate-chain.d.ts +58 -0
  39. package/dist/mandate-chain.d.ts.map +1 -0
  40. package/dist/mandate-chain.js +79 -0
  41. package/dist/mandate-chain.js.map +1 -0
  42. package/dist/mandate-proof.d.ts +8 -4
  43. package/dist/mandate-proof.d.ts.map +1 -1
  44. package/dist/mandate-proof.js +16 -3
  45. package/dist/mandate-proof.js.map +1 -1
  46. package/dist/negotiation.d.ts +514 -0
  47. package/dist/negotiation.d.ts.map +1 -0
  48. package/dist/negotiation.js +490 -0
  49. package/dist/negotiation.js.map +1 -0
  50. package/dist/offer-search.d.ts +282 -0
  51. package/dist/offer-search.d.ts.map +1 -0
  52. package/dist/offer-search.js +252 -0
  53. package/dist/offer-search.js.map +1 -0
  54. package/dist/openapi.d.ts +47 -0
  55. package/dist/openapi.d.ts.map +1 -0
  56. package/dist/openapi.js +571 -0
  57. package/dist/openapi.js.map +1 -0
  58. package/dist/order-wire.d.ts +73 -0
  59. package/dist/order-wire.d.ts.map +1 -0
  60. package/dist/order-wire.js +33 -0
  61. package/dist/order-wire.js.map +1 -0
  62. package/dist/reasons.d.ts +12 -2
  63. package/dist/reasons.d.ts.map +1 -1
  64. package/dist/reasons.js +12 -2
  65. package/dist/reasons.js.map +1 -1
  66. package/dist/sandbox.d.ts +104 -0
  67. package/dist/sandbox.d.ts.map +1 -1
  68. package/dist/sandbox.js +25 -0
  69. package/dist/sandbox.js.map +1 -1
  70. package/dist/service-order.d.ts +747 -0
  71. package/dist/service-order.d.ts.map +1 -0
  72. package/dist/service-order.js +182 -0
  73. package/dist/service-order.js.map +1 -0
  74. package/dist/service.d.ts +248 -0
  75. package/dist/service.d.ts.map +1 -0
  76. package/dist/service.js +379 -0
  77. package/dist/service.js.map +1 -0
  78. package/dist/session-fields.d.ts +10 -0
  79. package/dist/session-fields.d.ts.map +1 -1
  80. package/dist/terms.d.ts +7 -4
  81. package/dist/terms.d.ts.map +1 -1
  82. package/dist/terms.js +12 -5
  83. package/dist/terms.js.map +1 -1
  84. package/dist/test-customer.d.ts +20 -0
  85. package/dist/test-customer.d.ts.map +1 -1
  86. package/dist/text.d.ts +5 -0
  87. package/dist/text.d.ts.map +1 -0
  88. package/dist/text.js +5 -0
  89. package/dist/text.js.map +1 -0
  90. package/dist/types.d.ts +24 -5
  91. package/dist/types.d.ts.map +1 -1
  92. package/dist/types.js +6 -3
  93. package/dist/types.js.map +1 -1
  94. package/dist/version.d.ts +7 -0
  95. package/dist/version.d.ts.map +1 -1
  96. package/dist/version.js +9 -1
  97. package/dist/version.js.map +1 -1
  98. package/dist/wire.d.ts +313 -0
  99. package/dist/wire.d.ts.map +1 -1
  100. package/dist/wire.js +29 -1
  101. package/dist/wire.js.map +1 -1
  102. package/package.json +1 -1
package/dist/eip712.d.ts CHANGED
@@ -11,7 +11,9 @@ export interface AvowDomain {
11
11
  /** The buyer's lock, which every message for its commitments names. */
12
12
  verifyingContract: Address;
13
13
  }
14
- export declare function domain(d: AvowDomain, version: string): TypedDataDomain;
14
+ export declare function domain(d: AvowDomain, version: string): TypedDataDomain & {
15
+ version: string;
16
+ };
15
17
  /** Each side of a commitment by the code the lock stores, takes in calls and logs in its events. */
16
18
  export declare const SIDE_CODES: {
17
19
  readonly buyer: 0;
@@ -251,6 +253,66 @@ export interface StartReceipt {
251
253
  nonce: bigint;
252
254
  expiry: bigint;
253
255
  }
256
+ /** Each kind of move in a negotiation thread, by the code its signature covers. */
257
+ export declare const MOVE_KINDS: {
258
+ readonly propose: 0;
259
+ readonly counter: 1;
260
+ readonly accept: 2;
261
+ readonly decline: 3;
262
+ };
263
+ export type MoveKind = keyof typeof MOVE_KINDS;
264
+ /**
265
+ * One move in a negotiation thread, signed by the key that makes it: the buyer's agent key, or
266
+ * the supplier's signing key. A thread is about one prospective commitment in the buyer's lock.
267
+ * The domain names the chain and that lock, and the thread's id with the digest of the move before
268
+ * tie a move to one place in one thread.
269
+ *
270
+ * Moves are numbered from zero, and each names the digest of the move before it, so a copy of a
271
+ * thread can't be reordered. A key can still sign two different moves for one number, and the two
272
+ * signatures together prove it did. A proposing move states the whole of what it proposes: the
273
+ * quantity, the unit price and the lead time, against one base offer that never changes. An
274
+ * accepting move restates the proposal it accepts. A declining move leaves them at zero and gives
275
+ * a reason code, with a time or a quantity when the code calls for one. `negotiation.ts` holds
276
+ * what makes a move valid where it stands.
277
+ */
278
+ export interface NegotiationMove {
279
+ /** The thread, which its first move names and every later move repeats. */
280
+ thread: Hex;
281
+ /** The commitment the thread is about, fixed by the first move. */
282
+ commitmentId: Hex;
283
+ /** The move's place in the thread, from zero. */
284
+ seq: number;
285
+ /** The digest of the move before, or zero for the first. */
286
+ previous: Hex;
287
+ /** Which side makes the move. */
288
+ side: Side;
289
+ kind: MoveKind;
290
+ /** The id of the offer version the thread is about, which no move changes. */
291
+ baseOffer: Hex;
292
+ /** How many units, or zero on a decline. */
293
+ quantity: number;
294
+ /** The price of one unit, in micros. */
295
+ unitPrice: bigint;
296
+ /** How long after `builtAt` delivery is due, in seconds. */
297
+ leadTime: bigint;
298
+ /** The moment the proposal's terms are built from, in unix seconds. */
299
+ builtAt: bigint;
300
+ /**
301
+ * The hash of the proposal's terms under the supplier's salt, on a move where the supplier
302
+ * proposes or accepts and on a buyer's acceptance of one. Zero otherwise.
303
+ */
304
+ termsHash: Hex;
305
+ /** A decline's reason code, or empty. */
306
+ reason: string;
307
+ /** On a decline, when asking again could succeed, in unix seconds, or zero. */
308
+ retryAt: bigint;
309
+ /** On a decline, how many units could be had, or zero when the code gives none. */
310
+ available: number;
311
+ /** On a decline for a replaced offer, the id of the version that replaced it, or zero. */
312
+ currentOffer: Hex;
313
+ /** When the move stops standing, in unix seconds. Zero on a decline, which nothing follows. */
314
+ expiry: bigint;
315
+ }
254
316
  /**
255
317
  * One request to Avow's API, signed by the key that sends it: an agent key the business enrolled,
256
318
  * or a supplier's signing key. The signature names the deployment, the method, the path and the
@@ -352,6 +414,73 @@ export declare const MANDATE_TYPES: {
352
414
  readonly type: 'uint256';
353
415
  }];
354
416
  };
417
+ /** A replacement mandate's types: a first mandate's fields, then the hash of the one it replaces. */
418
+ export declare const MANDATE_REPLACEMENT_TYPES: {
419
+ readonly PaymentLimit: readonly [{
420
+ readonly name: 'token';
421
+ readonly type: 'address';
422
+ }, {
423
+ readonly name: 'amount';
424
+ readonly type: 'uint256';
425
+ }, {
426
+ readonly name: 'period';
427
+ readonly type: 'uint64';
428
+ }];
429
+ readonly Mandate: readonly [{
430
+ readonly name: 'mandateId';
431
+ readonly type: 'bytes32';
432
+ }, {
433
+ readonly name: 'businessId';
434
+ readonly type: 'string';
435
+ }, {
436
+ readonly name: 'agentId';
437
+ readonly type: 'string';
438
+ }, {
439
+ readonly name: 'account';
440
+ readonly type: 'address';
441
+ }, {
442
+ readonly name: 'agentKey';
443
+ readonly type: 'address';
444
+ }, {
445
+ readonly name: 'actions';
446
+ readonly type: 'string[]';
447
+ }, {
448
+ readonly name: 'currency';
449
+ readonly type: 'string';
450
+ }, {
451
+ readonly name: 'capPerCommitment';
452
+ readonly type: 'uint256';
453
+ }, {
454
+ readonly name: 'capOpenReserves';
455
+ readonly type: 'uint256';
456
+ }, {
457
+ readonly name: 'suppliers';
458
+ readonly type: 'string[]';
459
+ }, {
460
+ readonly name: 'categories';
461
+ readonly type: 'string[]';
462
+ }, {
463
+ readonly name: 'paymentLimits';
464
+ readonly type: 'PaymentLimit[]';
465
+ }, {
466
+ readonly name: 'approvalRule';
467
+ readonly type: 'uint8';
468
+ }, {
469
+ readonly name: 'approvalAbove';
470
+ readonly type: 'uint256';
471
+ }, {
472
+ readonly name: 'expiry';
473
+ readonly type: 'uint64';
474
+ }, {
475
+ readonly name: 'nonce';
476
+ readonly type: 'uint256';
477
+ }, {
478
+ readonly name: 'replaces';
479
+ readonly type: 'bytes32';
480
+ }];
481
+ };
482
+ /** The domain version a mandate signs at, which `replaces` decides. */
483
+ export declare const mandateVersion: (m: Pick<Mandate, 'replaces'>) => string;
355
484
  export declare const TERMS_AGREEMENT_TYPES: {
356
485
  readonly TermsAgreement: readonly [{
357
486
  readonly name: 'commitmentId';
@@ -717,6 +846,60 @@ export declare const START_RECEIPT_TYPES: {
717
846
  readonly type: 'uint64';
718
847
  }];
719
848
  };
849
+ export declare const NEGOTIATION_MOVE_TYPES: {
850
+ readonly NegotiationMove: readonly [{
851
+ readonly name: 'thread';
852
+ readonly type: 'bytes32';
853
+ }, {
854
+ readonly name: 'commitmentId';
855
+ readonly type: 'bytes32';
856
+ }, {
857
+ readonly name: 'seq';
858
+ readonly type: 'uint32';
859
+ }, {
860
+ readonly name: 'previous';
861
+ readonly type: 'bytes32';
862
+ }, {
863
+ readonly name: 'side';
864
+ readonly type: 'uint8';
865
+ }, {
866
+ readonly name: 'kind';
867
+ readonly type: 'uint8';
868
+ }, {
869
+ readonly name: 'baseOffer';
870
+ readonly type: 'bytes32';
871
+ }, {
872
+ readonly name: 'quantity';
873
+ readonly type: 'uint32';
874
+ }, {
875
+ readonly name: 'unitPrice';
876
+ readonly type: 'uint256';
877
+ }, {
878
+ readonly name: 'leadTime';
879
+ readonly type: 'uint64';
880
+ }, {
881
+ readonly name: 'builtAt';
882
+ readonly type: 'uint64';
883
+ }, {
884
+ readonly name: 'termsHash';
885
+ readonly type: 'bytes32';
886
+ }, {
887
+ readonly name: 'reason';
888
+ readonly type: 'string';
889
+ }, {
890
+ readonly name: 'retryAt';
891
+ readonly type: 'uint64';
892
+ }, {
893
+ readonly name: 'available';
894
+ readonly type: 'uint32';
895
+ }, {
896
+ readonly name: 'currentOffer';
897
+ readonly type: 'bytes32';
898
+ }, {
899
+ readonly name: 'expiry';
900
+ readonly type: 'uint64';
901
+ }];
902
+ };
720
903
  export declare const API_REQUEST_TYPES: {
721
904
  readonly ApiRequest: readonly [{
722
905
  readonly name: 'audience';
@@ -750,8 +933,14 @@ export declare const TIMESTAMP_TYPES: {
750
933
  readonly type: 'uint64';
751
934
  }];
752
935
  };
936
+ /**
937
+ * A mandate's EIP-712 typed data. A first mandate signs at version 1 under `MANDATE_TYPES`, exactly
938
+ * as before replacements existed, and a replacement at version 2 with `replaces` as its last field.
939
+ */
753
940
  export declare function mandateTypedData(m: Mandate, d: AvowDomain): {
754
- domain: TypedDataDomain;
941
+ domain: TypedDataDomain & {
942
+ version: string;
943
+ };
755
944
  types: {
756
945
  readonly PaymentLimit: readonly [{
757
946
  readonly name: 'token';
@@ -836,9 +1025,103 @@ export declare function mandateTypedData(m: Mandate, d: AvowDomain): {
836
1025
  expiry: bigint;
837
1026
  nonce: bigint;
838
1027
  };
1028
+ } | {
1029
+ domain: TypedDataDomain & {
1030
+ version: string;
1031
+ };
1032
+ types: {
1033
+ readonly PaymentLimit: readonly [{
1034
+ readonly name: 'token';
1035
+ readonly type: 'address';
1036
+ }, {
1037
+ readonly name: 'amount';
1038
+ readonly type: 'uint256';
1039
+ }, {
1040
+ readonly name: 'period';
1041
+ readonly type: 'uint64';
1042
+ }];
1043
+ readonly Mandate: readonly [{
1044
+ readonly name: 'mandateId';
1045
+ readonly type: 'bytes32';
1046
+ }, {
1047
+ readonly name: 'businessId';
1048
+ readonly type: 'string';
1049
+ }, {
1050
+ readonly name: 'agentId';
1051
+ readonly type: 'string';
1052
+ }, {
1053
+ readonly name: 'account';
1054
+ readonly type: 'address';
1055
+ }, {
1056
+ readonly name: 'agentKey';
1057
+ readonly type: 'address';
1058
+ }, {
1059
+ readonly name: 'actions';
1060
+ readonly type: 'string[]';
1061
+ }, {
1062
+ readonly name: 'currency';
1063
+ readonly type: 'string';
1064
+ }, {
1065
+ readonly name: 'capPerCommitment';
1066
+ readonly type: 'uint256';
1067
+ }, {
1068
+ readonly name: 'capOpenReserves';
1069
+ readonly type: 'uint256';
1070
+ }, {
1071
+ readonly name: 'suppliers';
1072
+ readonly type: 'string[]';
1073
+ }, {
1074
+ readonly name: 'categories';
1075
+ readonly type: 'string[]';
1076
+ }, {
1077
+ readonly name: 'paymentLimits';
1078
+ readonly type: 'PaymentLimit[]';
1079
+ }, {
1080
+ readonly name: 'approvalRule';
1081
+ readonly type: 'uint8';
1082
+ }, {
1083
+ readonly name: 'approvalAbove';
1084
+ readonly type: 'uint256';
1085
+ }, {
1086
+ readonly name: 'expiry';
1087
+ readonly type: 'uint64';
1088
+ }, {
1089
+ readonly name: 'nonce';
1090
+ readonly type: 'uint256';
1091
+ }, {
1092
+ readonly name: 'replaces';
1093
+ readonly type: 'bytes32';
1094
+ }];
1095
+ };
1096
+ primaryType: 'Mandate';
1097
+ message: {
1098
+ replaces: `0x${string}`;
1099
+ mandateId: `0x${string}`;
1100
+ businessId: string;
1101
+ agentId: string;
1102
+ account: `0x${string}`;
1103
+ agentKey: `0x${string}`;
1104
+ actions: ("cancel" | "pay" | "reserve" | "start")[];
1105
+ currency: "USD";
1106
+ capPerCommitment: bigint;
1107
+ capOpenReserves: bigint;
1108
+ suppliers: string[];
1109
+ categories: string[];
1110
+ paymentLimits: {
1111
+ token: `0x${string}`;
1112
+ amount: bigint;
1113
+ period: bigint;
1114
+ }[];
1115
+ approvalRule: 0 | 1 | 2;
1116
+ approvalAbove: bigint;
1117
+ expiry: bigint;
1118
+ nonce: bigint;
1119
+ };
839
1120
  };
840
1121
  export declare function termsAgreementTypedData(a: TermsAgreement, d: AvowDomain): {
841
- domain: TypedDataDomain;
1122
+ domain: TypedDataDomain & {
1123
+ version: string;
1124
+ };
842
1125
  types: {
843
1126
  readonly TermsAgreement: readonly [{
844
1127
  readonly name: 'commitmentId';
@@ -880,7 +1163,9 @@ export declare function termsAgreementTypedData(a: TermsAgreement, d: AvowDomain
880
1163
  };
881
1164
  };
882
1165
  export declare function approvalTypedData(a: Approval, d: AvowDomain): {
883
- domain: TypedDataDomain;
1166
+ domain: TypedDataDomain & {
1167
+ version: string;
1168
+ };
884
1169
  types: {
885
1170
  readonly Approval: readonly [{
886
1171
  readonly name: 'commitmentId';
@@ -1011,7 +1296,9 @@ export declare function approvalDigest(a: Approval, d: AvowDomain): Hex;
1011
1296
  * the verifier's `prepareAcceptance`, and signs it with `signAcceptance`.
1012
1297
  */
1013
1298
  export declare function acceptanceTypedData(a: Acceptance, d: AvowDomain): {
1014
- domain: TypedDataDomain;
1299
+ domain: TypedDataDomain & {
1300
+ version: string;
1301
+ };
1015
1302
  types: {
1016
1303
  readonly Acceptance: readonly [{
1017
1304
  readonly name: 'commitmentId';
@@ -1058,7 +1345,9 @@ export declare function acceptanceTypedData(a: Acceptance, d: AvowDomain): {
1058
1345
  };
1059
1346
  };
1060
1347
  export declare function reportTypedData(r: ChargeReport, d: AvowDomain): {
1061
- domain: TypedDataDomain;
1348
+ domain: TypedDataDomain & {
1349
+ version: string;
1350
+ };
1062
1351
  types: {
1063
1352
  readonly Report: readonly [{
1064
1353
  readonly name: 'commitmentId';
@@ -1096,7 +1385,9 @@ export declare function reportTypedData(r: ChargeReport, d: AvowDomain): {
1096
1385
  };
1097
1386
  };
1098
1387
  export declare function releaseConsentTypedData(c: ReleaseConsent, d: AvowDomain): {
1099
- domain: TypedDataDomain;
1388
+ domain: TypedDataDomain & {
1389
+ version: string;
1390
+ };
1100
1391
  types: {
1101
1392
  readonly ReleaseConsent: readonly [{
1102
1393
  readonly name: 'commitmentId';
@@ -1134,7 +1425,9 @@ export declare function releaseConsentTypedData(c: ReleaseConsent, d: AvowDomain
1134
1425
  };
1135
1426
  };
1136
1427
  export declare function evidenceTypedData(e: SupplierEvidence, d: AvowDomain): {
1137
- domain: TypedDataDomain;
1428
+ domain: TypedDataDomain & {
1429
+ version: string;
1430
+ };
1138
1431
  types: {
1139
1432
  readonly Evidence: readonly [{
1140
1433
  readonly name: 'commitmentId';
@@ -1171,7 +1464,9 @@ export declare function evidenceTypedData(e: SupplierEvidence, d: AvowDomain): {
1171
1464
  };
1172
1465
  };
1173
1466
  export declare function businessActionTypedData(a: BusinessAction, d: AvowDomain): {
1174
- domain: TypedDataDomain;
1467
+ domain: TypedDataDomain & {
1468
+ version: string;
1469
+ };
1175
1470
  types: {
1176
1471
  readonly BusinessAction: readonly [{
1177
1472
  readonly name: 'action';
@@ -1225,7 +1520,9 @@ export declare function businessActionTypedData(a: BusinessAction, d: AvowDomain
1225
1520
  };
1226
1521
  };
1227
1522
  export declare function supplierActionTypedData(a: SupplierAction, d: AvowDomain): {
1228
- domain: TypedDataDomain;
1523
+ domain: TypedDataDomain & {
1524
+ version: string;
1525
+ };
1229
1526
  types: {
1230
1527
  readonly SupplierAction: readonly [{
1231
1528
  readonly name: 'supplier';
@@ -1289,7 +1586,9 @@ export declare function supplierListAction(args: {
1289
1586
  expiry: bigint;
1290
1587
  }): BusinessAction;
1291
1588
  export declare function supplierAuthorizationTypedData(a: SupplierAuthorization, d: AvowDomain): {
1292
- domain: TypedDataDomain;
1589
+ domain: TypedDataDomain & {
1590
+ version: string;
1591
+ };
1293
1592
  types: {
1294
1593
  readonly SupplierAuthorization: readonly [{
1295
1594
  readonly name: 'commitmentId';
@@ -1368,7 +1667,9 @@ export declare function supplierAuthorizationTypedData(a: SupplierAuthorization,
1368
1667
  };
1369
1668
  };
1370
1669
  export declare function humanApprovalTypedData(a: HumanApproval, d: AvowDomain): {
1371
- domain: TypedDataDomain;
1670
+ domain: TypedDataDomain & {
1671
+ version: string;
1672
+ };
1372
1673
  types: {
1373
1674
  readonly HumanApproval: readonly [{
1374
1675
  readonly name: 'mandateHash';
@@ -1409,7 +1710,9 @@ export declare function humanApprovalTypedData(a: HumanApproval, d: AvowDomain):
1409
1710
  };
1410
1711
  };
1411
1712
  export declare function startReceiptTypedData(r: StartReceipt, d: AvowDomain): {
1412
- domain: TypedDataDomain;
1713
+ domain: TypedDataDomain & {
1714
+ version: string;
1715
+ };
1413
1716
  types: {
1414
1717
  readonly StartReceipt: readonly [{
1415
1718
  readonly name: 'commitmentId';
@@ -1441,8 +1744,107 @@ export declare function startReceiptTypedData(r: StartReceipt, d: AvowDomain): {
1441
1744
  side: 0 | 1;
1442
1745
  };
1443
1746
  };
1747
+ export declare function negotiationMoveTypedData(m: NegotiationMove, d: AvowDomain): {
1748
+ domain: TypedDataDomain & {
1749
+ version: string;
1750
+ };
1751
+ types: {
1752
+ readonly NegotiationMove: readonly [{
1753
+ readonly name: 'thread';
1754
+ readonly type: 'bytes32';
1755
+ }, {
1756
+ readonly name: 'commitmentId';
1757
+ readonly type: 'bytes32';
1758
+ }, {
1759
+ readonly name: 'seq';
1760
+ readonly type: 'uint32';
1761
+ }, {
1762
+ readonly name: 'previous';
1763
+ readonly type: 'bytes32';
1764
+ }, {
1765
+ readonly name: 'side';
1766
+ readonly type: 'uint8';
1767
+ }, {
1768
+ readonly name: 'kind';
1769
+ readonly type: 'uint8';
1770
+ }, {
1771
+ readonly name: 'baseOffer';
1772
+ readonly type: 'bytes32';
1773
+ }, {
1774
+ readonly name: 'quantity';
1775
+ readonly type: 'uint32';
1776
+ }, {
1777
+ readonly name: 'unitPrice';
1778
+ readonly type: 'uint256';
1779
+ }, {
1780
+ readonly name: 'leadTime';
1781
+ readonly type: 'uint64';
1782
+ }, {
1783
+ readonly name: 'builtAt';
1784
+ readonly type: 'uint64';
1785
+ }, {
1786
+ readonly name: 'termsHash';
1787
+ readonly type: 'bytes32';
1788
+ }, {
1789
+ readonly name: 'reason';
1790
+ readonly type: 'string';
1791
+ }, {
1792
+ readonly name: 'retryAt';
1793
+ readonly type: 'uint64';
1794
+ }, {
1795
+ readonly name: 'available';
1796
+ readonly type: 'uint32';
1797
+ }, {
1798
+ readonly name: 'currentOffer';
1799
+ readonly type: 'bytes32';
1800
+ }, {
1801
+ readonly name: 'expiry';
1802
+ readonly type: 'uint64';
1803
+ }];
1804
+ };
1805
+ primaryType: 'NegotiationMove';
1806
+ message: {
1807
+ /** The thread, which its first move names and every later move repeats. */
1808
+ thread: Hex;
1809
+ /** The commitment the thread is about, fixed by the first move. */
1810
+ commitmentId: Hex;
1811
+ /** The move's place in the thread, from zero. */
1812
+ seq: number;
1813
+ /** The digest of the move before, or zero for the first. */
1814
+ previous: Hex;
1815
+ /** The id of the offer version the thread is about, which no move changes. */
1816
+ baseOffer: Hex;
1817
+ /** How many units, or zero on a decline. */
1818
+ quantity: number;
1819
+ /** The price of one unit, in micros. */
1820
+ unitPrice: bigint;
1821
+ /** How long after `builtAt` delivery is due, in seconds. */
1822
+ leadTime: bigint;
1823
+ /** The moment the proposal's terms are built from, in unix seconds. */
1824
+ builtAt: bigint;
1825
+ /**
1826
+ * The hash of the proposal's terms under the supplier's salt, on a move where the supplier
1827
+ * proposes or accepts and on a buyer's acceptance of one. Zero otherwise.
1828
+ */
1829
+ termsHash: Hex;
1830
+ /** A decline's reason code, or empty. */
1831
+ reason: string;
1832
+ /** On a decline, when asking again could succeed, in unix seconds, or zero. */
1833
+ retryAt: bigint;
1834
+ /** On a decline, how many units could be had, or zero when the code gives none. */
1835
+ available: number;
1836
+ /** On a decline for a replaced offer, the id of the version that replaced it, or zero. */
1837
+ currentOffer: Hex;
1838
+ /** When the move stops standing, in unix seconds. Zero on a decline, which nothing follows. */
1839
+ expiry: bigint;
1840
+ side: 0 | 1;
1841
+ kind: 0 | 1 | 2 | 3;
1842
+ };
1843
+ };
1444
1844
  export declare function apiRequestTypedData(r: ApiRequest, d: AvowDomain): {
1445
- domain: TypedDataDomain;
1845
+ domain: TypedDataDomain & {
1846
+ version: string;
1847
+ };
1446
1848
  types: {
1447
1849
  readonly ApiRequest: readonly [{
1448
1850
  readonly name: 'audience';
@@ -1489,7 +1891,9 @@ export declare function apiRequestTypedData(r: ApiRequest, d: AvowDomain): {
1489
1891
  };
1490
1892
  };
1491
1893
  export declare function timestampTypedData(t: Timestamp, d: AvowDomain): {
1492
- domain: TypedDataDomain;
1894
+ domain: TypedDataDomain & {
1895
+ version: string;
1896
+ };
1493
1897
  types: {
1494
1898
  readonly Timestamp: readonly [{
1495
1899
  readonly name: 'requestHash';
@@ -1512,7 +1916,16 @@ export declare function timestampTypedData(t: Timestamp, d: AvowDomain): {
1512
1916
  * includes the domain, so a mandate for one lock or chain can't stand in for another.
1513
1917
  */
1514
1918
  export declare function mandateHash(m: Mandate, d: AvowDomain): Hex;
1515
- export type AvowTypedData = ReturnType<typeof mandateTypedData> | ReturnType<typeof termsAgreementTypedData> | ReturnType<typeof approvalTypedData> | ReturnType<typeof supplierAuthorizationTypedData> | ReturnType<typeof humanApprovalTypedData> | ReturnType<typeof startReceiptTypedData> | ReturnType<typeof apiRequestTypedData> | ReturnType<typeof timestampTypedData> | ReturnType<typeof acceptanceTypedData> | ReturnType<typeof reportTypedData> | ReturnType<typeof releaseConsentTypedData> | ReturnType<typeof evidenceTypedData> | ReturnType<typeof businessActionTypedData> | ReturnType<typeof supplierActionTypedData>;
1919
+ /** A mandate's typed data, under either table. */
1920
+ export type MandateTypedData = ReturnType<typeof mandateTypedData>;
1921
+ /**
1922
+ * Whether a mandate's typed data is a replacement's. The two tables differ only in `replaces`, so
1923
+ * its presence in the message says which one it is, and a signer narrows on this before signing.
1924
+ */
1925
+ export declare const isReplacementTypedData: (td: MandateTypedData) => td is Extract<MandateTypedData, {
1926
+ types: typeof MANDATE_REPLACEMENT_TYPES;
1927
+ }>;
1928
+ export type AvowTypedData = ReturnType<typeof mandateTypedData> | ReturnType<typeof termsAgreementTypedData> | ReturnType<typeof approvalTypedData> | ReturnType<typeof supplierAuthorizationTypedData> | ReturnType<typeof humanApprovalTypedData> | ReturnType<typeof startReceiptTypedData> | ReturnType<typeof negotiationMoveTypedData> | ReturnType<typeof apiRequestTypedData> | ReturnType<typeof timestampTypedData> | ReturnType<typeof acceptanceTypedData> | ReturnType<typeof reportTypedData> | ReturnType<typeof releaseConsentTypedData> | ReturnType<typeof evidenceTypedData> | ReturnType<typeof businessActionTypedData> | ReturnType<typeof supplierActionTypedData>;
1516
1929
  export type MessageType = AvowTypedData['primaryType'];
1517
1930
  /** The EIP-712 digest a signer signs. */
1518
1931
  export declare function digestOf(td: AvowTypedData): Hex;