@avow-finance/spec 0.7.0 → 0.9.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/dist/agent-session.d.ts +8 -0
- package/dist/agent-session.d.ts.map +1 -1
- package/dist/api.d.ts +24 -0
- package/dist/api.d.ts.map +1 -1
- package/dist/dependencies.d.ts.map +1 -1
- package/dist/dependencies.js +8 -2
- package/dist/dependencies.js.map +1 -1
- package/dist/eip712.d.ts +212 -1
- package/dist/eip712.d.ts.map +1 -1
- package/dist/eip712.js +34 -0
- package/dist/eip712.js.map +1 -1
- package/dist/gpu-reservation.d.ts.map +1 -1
- package/dist/gpu-reservation.js +1 -1
- package/dist/gpu-reservation.js.map +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/job-session.d.ts +16 -0
- package/dist/job-session.d.ts.map +1 -1
- package/dist/job.d.ts.map +1 -1
- package/dist/job.js +1 -1
- package/dist/job.js.map +1 -1
- package/dist/json-fields.d.ts +2 -0
- package/dist/json-fields.d.ts.map +1 -1
- package/dist/json-fields.js +2 -0
- package/dist/json-fields.js.map +1 -1
- package/dist/mailbox.d.ts +77 -104
- package/dist/mailbox.d.ts.map +1 -1
- package/dist/mailbox.js +8 -30
- package/dist/mailbox.js.map +1 -1
- package/dist/negotiation.d.ts +514 -0
- package/dist/negotiation.d.ts.map +1 -0
- package/dist/negotiation.js +490 -0
- package/dist/negotiation.js.map +1 -0
- package/dist/offer-search.d.ts +282 -0
- package/dist/offer-search.d.ts.map +1 -0
- package/dist/offer-search.js +252 -0
- package/dist/offer-search.js.map +1 -0
- package/dist/openapi.d.ts.map +1 -1
- package/dist/openapi.js +2 -1
- package/dist/openapi.js.map +1 -1
- package/dist/order-wire.d.ts +73 -0
- package/dist/order-wire.d.ts.map +1 -0
- package/dist/order-wire.js +33 -0
- package/dist/order-wire.js.map +1 -0
- package/dist/reasons.d.ts +10 -2
- package/dist/reasons.d.ts.map +1 -1
- package/dist/reasons.js +10 -2
- package/dist/reasons.js.map +1 -1
- package/dist/sandbox.d.ts +81 -0
- package/dist/sandbox.d.ts.map +1 -1
- package/dist/sandbox.js +18 -0
- package/dist/sandbox.js.map +1 -1
- package/dist/service-order.d.ts +747 -0
- package/dist/service-order.d.ts.map +1 -0
- package/dist/service-order.js +182 -0
- package/dist/service-order.js.map +1 -0
- package/dist/service.d.ts +248 -0
- package/dist/service.d.ts.map +1 -0
- package/dist/service.js +379 -0
- package/dist/service.js.map +1 -0
- package/dist/session-fields.d.ts +8 -0
- package/dist/session-fields.d.ts.map +1 -1
- package/dist/terms.d.ts.map +1 -1
- package/dist/terms.js +4 -0
- package/dist/terms.js.map +1 -1
- package/dist/test-customer.d.ts +16 -0
- package/dist/test-customer.d.ts.map +1 -1
- package/dist/text.d.ts +5 -0
- package/dist/text.d.ts.map +1 -0
- package/dist/text.js +5 -0
- package/dist/text.js.map +1 -0
- package/dist/types.d.ts +7 -4
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +6 -3
- package/dist/types.js.map +1 -1
- package/dist/version.d.ts +1 -0
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +2 -0
- package/dist/version.js.map +1 -1
- package/dist/wire.d.ts +312 -0
- package/dist/wire.d.ts.map +1 -1
- package/dist/wire.js +28 -1
- package/dist/wire.js.map +1 -1
- package/package.json +1 -1
package/dist/mailbox.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Hex } from 'viem';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import type { JobTerms } from './job.js';
|
|
4
|
+
import { type MailboxReserve, type OrderStage } from './order-wire.js';
|
|
4
5
|
import { type JobRequirement, type QuoteRequest } from './test-customer.js';
|
|
5
6
|
/**
|
|
6
7
|
* Avow's sandbox mailbox, which carries a job between two businesses' agents wherever each one
|
|
@@ -46,40 +47,12 @@ export interface MailboxOrderRequest {
|
|
|
46
47
|
}
|
|
47
48
|
export declare const MAILBOX_STATUSES: readonly ['requested', 'quoted', 'expired', 'reserved', 'accepted'];
|
|
48
49
|
export type MailboxStatus = (typeof MAILBOX_STATUSES)[number];
|
|
49
|
-
/**
|
|
50
|
-
* The reserve the buyer funded, as Avow read it from the buyer's lock. Avow reads the lock itself,
|
|
51
|
-
* so the transaction is there only when the agent saw it land, and null after a restart.
|
|
52
|
-
*/
|
|
53
|
-
export interface MailboxReserve {
|
|
54
|
-
fundedIn: Hex | null;
|
|
55
|
-
amount: bigint;
|
|
56
|
-
/** The lock's deadline for the supplier to accept, after which the reserve goes back. */
|
|
57
|
-
acceptBy: bigint;
|
|
58
|
-
}
|
|
59
50
|
interface MailboxOrderBase extends MailboxOrderRequest {
|
|
60
51
|
buyer: JobBuyer;
|
|
61
52
|
requestedAt: bigint;
|
|
62
53
|
}
|
|
63
54
|
/** An order as the mailbox answers it, to either side or to either business's console. */
|
|
64
|
-
export type MailboxOrder =
|
|
65
|
-
status: 'requested';
|
|
66
|
-
}) | (MailboxOrderBase & {
|
|
67
|
-
status: 'expired';
|
|
68
|
-
quote: QuoteRequest | null;
|
|
69
|
-
}) | (MailboxOrderBase & {
|
|
70
|
-
status: 'quoted';
|
|
71
|
-
quote: QuoteRequest;
|
|
72
|
-
}) | (MailboxOrderBase & {
|
|
73
|
-
status: 'reserved';
|
|
74
|
-
quote: QuoteRequest;
|
|
75
|
-
reserve: MailboxReserve;
|
|
76
|
-
}) | (MailboxOrderBase & {
|
|
77
|
-
status: 'accepted';
|
|
78
|
-
quote: QuoteRequest;
|
|
79
|
-
reserve: MailboxReserve;
|
|
80
|
-
/** The acceptance's transaction when the supplier's agent saw it land, or null. */
|
|
81
|
-
acceptedIn: Hex | null;
|
|
82
|
-
});
|
|
55
|
+
export type MailboxOrder = MailboxOrderBase & OrderStage<QuoteRequest>;
|
|
83
56
|
export declare const jobBuyerJson: z.ZodObject<{
|
|
84
57
|
businessId: z.ZodString;
|
|
85
58
|
account: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
|
|
@@ -152,78 +125,7 @@ export declare const mailboxOrderRequestJson: z.ZodObject<{
|
|
|
152
125
|
expiry: z.ZodPipe<z.ZodString, z.ZodTransform<bigint, string>>;
|
|
153
126
|
}, z.core.$strict>;
|
|
154
127
|
export declare const mailboxOrderJson: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
155
|
-
orderId: z.ZodString;
|
|
156
|
-
commitmentId: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
|
|
157
|
-
supplierBusinessId: z.ZodString;
|
|
158
|
-
terms: z.ZodObject<{
|
|
159
|
-
version: z.ZodLiteral<2>;
|
|
160
|
-
currency: z.ZodEnum<{
|
|
161
|
-
USD: "USD";
|
|
162
|
-
}>;
|
|
163
|
-
amountDecimals: z.ZodLiteral<6>;
|
|
164
|
-
template: z.ZodLiteral<"job/1">;
|
|
165
|
-
subject: z.ZodObject<{
|
|
166
|
-
work: z.ZodObject<{
|
|
167
|
-
kind: z.ZodString;
|
|
168
|
-
summary: z.ZodString;
|
|
169
|
-
}, z.core.$strict>;
|
|
170
|
-
compute: z.ZodObject<{
|
|
171
|
-
gpu: z.ZodString;
|
|
172
|
-
count: z.ZodNumber;
|
|
173
|
-
region: z.ZodString;
|
|
174
|
-
}, z.core.$strict>;
|
|
175
|
-
startsAt: z.ZodPipe<z.ZodString, z.ZodTransform<bigint, string>>;
|
|
176
|
-
deliverBy: z.ZodPipe<z.ZodString, z.ZodTransform<bigint, string>>;
|
|
177
|
-
}, z.core.$strict>;
|
|
178
|
-
consideration: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
179
|
-
kind: z.ZodLiteral<"rate">;
|
|
180
|
-
amount: z.ZodPipe<z.ZodString, z.ZodTransform<bigint, string>>;
|
|
181
|
-
unit: z.ZodString;
|
|
182
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
183
|
-
kind: z.ZodLiteral<"fixed">;
|
|
184
|
-
amount: z.ZodPipe<z.ZodString, z.ZodTransform<bigint, string>>;
|
|
185
|
-
}, z.core.$strict>], "kind">;
|
|
186
|
-
remedies: z.ZodObject<{
|
|
187
|
-
acceptBy: z.ZodPipe<z.ZodString, z.ZodTransform<bigint, string>>;
|
|
188
|
-
freeCancelBy: z.ZodPipe<z.ZodString, z.ZodTransform<bigint, string>>;
|
|
189
|
-
charges: z.ZodArray<z.ZodObject<{
|
|
190
|
-
kind: z.ZodEnum<{
|
|
191
|
-
lateCancellation: "lateCancellation";
|
|
192
|
-
noShow: "noShow";
|
|
193
|
-
}>;
|
|
194
|
-
amount: z.ZodPipe<z.ZodString, z.ZodTransform<bigint, string>>;
|
|
195
|
-
earliest: z.ZodPipe<z.ZodString, z.ZodTransform<bigint, string>>;
|
|
196
|
-
}, z.core.$strict>>;
|
|
197
|
-
chargeDeadline: z.ZodPipe<z.ZodString, z.ZodTransform<bigint, string>>;
|
|
198
|
-
}, z.core.$strict>;
|
|
199
|
-
resolution: z.ZodObject<{
|
|
200
|
-
contestWindow: z.ZodPipe<z.ZodString, z.ZodTransform<bigint, string>>;
|
|
201
|
-
arbiter: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
|
|
202
|
-
day90SupplierShareBps: z.ZodNumber;
|
|
203
|
-
}, z.core.$strict>;
|
|
204
|
-
backing: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
205
|
-
kind: z.ZodLiteral<"reserve">;
|
|
206
|
-
side: z.ZodLiteral<"buyer">;
|
|
207
|
-
amount: z.ZodPipe<z.ZodString, z.ZodTransform<bigint, string>>;
|
|
208
|
-
releaseDate: z.ZodPipe<z.ZodString, z.ZodTransform<bigint, string>>;
|
|
209
|
-
}, z.core.$strict>], "kind">;
|
|
210
|
-
}, z.core.$strict>;
|
|
211
|
-
requirement: z.ZodObject<{
|
|
212
|
-
template: z.ZodLiteral<"gpu-reservation/1">;
|
|
213
|
-
condition: z.ZodLiteral<"accepted">;
|
|
214
|
-
disclosed: z.ZodLiteral<"subject">;
|
|
215
|
-
}, z.core.$strict>;
|
|
216
|
-
expiry: z.ZodPipe<z.ZodString, z.ZodTransform<bigint, string>>;
|
|
217
|
-
buyer: z.ZodObject<{
|
|
218
|
-
businessId: z.ZodString;
|
|
219
|
-
account: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
|
|
220
|
-
lock: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
|
|
221
|
-
chainId: z.ZodNumber;
|
|
222
|
-
mandateHash: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
|
|
223
|
-
}, z.core.$strict>;
|
|
224
|
-
requestedAt: z.ZodPipe<z.ZodString, z.ZodTransform<bigint, string>>;
|
|
225
128
|
status: z.ZodLiteral<"requested">;
|
|
226
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
227
129
|
orderId: z.ZodString;
|
|
228
130
|
commitmentId: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
|
|
229
131
|
supplierBusinessId: z.ZodString;
|
|
@@ -294,6 +196,7 @@ export declare const mailboxOrderJson: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
294
196
|
mandateHash: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
|
|
295
197
|
}, z.core.$strict>;
|
|
296
198
|
requestedAt: z.ZodPipe<z.ZodString, z.ZodTransform<bigint, string>>;
|
|
199
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
297
200
|
status: z.ZodLiteral<"expired">;
|
|
298
201
|
quote: z.ZodNullable<z.ZodObject<{
|
|
299
202
|
terms: z.ZodUnion<readonly [z.ZodObject<{
|
|
@@ -569,7 +472,6 @@ export declare const mailboxOrderJson: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
569
472
|
supplierSignature: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
|
|
570
473
|
disclosed: z.ZodArray<z.ZodUnknown>;
|
|
571
474
|
}, z.core.$strict>>;
|
|
572
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
573
475
|
orderId: z.ZodString;
|
|
574
476
|
commitmentId: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
|
|
575
477
|
supplierBusinessId: z.ZodString;
|
|
@@ -640,6 +542,7 @@ export declare const mailboxOrderJson: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
640
542
|
mandateHash: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
|
|
641
543
|
}, z.core.$strict>;
|
|
642
544
|
requestedAt: z.ZodPipe<z.ZodString, z.ZodTransform<bigint, string>>;
|
|
545
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
643
546
|
status: z.ZodLiteral<"quoted">;
|
|
644
547
|
quote: z.ZodObject<{
|
|
645
548
|
terms: z.ZodUnion<readonly [z.ZodObject<{
|
|
@@ -915,7 +818,6 @@ export declare const mailboxOrderJson: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
915
818
|
supplierSignature: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
|
|
916
819
|
disclosed: z.ZodArray<z.ZodUnknown>;
|
|
917
820
|
}, z.core.$strict>;
|
|
918
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
919
821
|
orderId: z.ZodString;
|
|
920
822
|
commitmentId: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
|
|
921
823
|
supplierBusinessId: z.ZodString;
|
|
@@ -986,6 +888,7 @@ export declare const mailboxOrderJson: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
986
888
|
mandateHash: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
|
|
987
889
|
}, z.core.$strict>;
|
|
988
890
|
requestedAt: z.ZodPipe<z.ZodString, z.ZodTransform<bigint, string>>;
|
|
891
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
989
892
|
status: z.ZodLiteral<"reserved">;
|
|
990
893
|
quote: z.ZodObject<{
|
|
991
894
|
terms: z.ZodUnion<readonly [z.ZodObject<{
|
|
@@ -1266,7 +1169,6 @@ export declare const mailboxOrderJson: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
1266
1169
|
amount: z.ZodPipe<z.ZodString, z.ZodTransform<bigint, string>>;
|
|
1267
1170
|
acceptBy: z.ZodPipe<z.ZodString, z.ZodTransform<bigint, string>>;
|
|
1268
1171
|
}, z.core.$strict>;
|
|
1269
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
1270
1172
|
orderId: z.ZodString;
|
|
1271
1173
|
commitmentId: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
|
|
1272
1174
|
supplierBusinessId: z.ZodString;
|
|
@@ -1337,6 +1239,7 @@ export declare const mailboxOrderJson: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
1337
1239
|
mandateHash: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
|
|
1338
1240
|
}, z.core.$strict>;
|
|
1339
1241
|
requestedAt: z.ZodPipe<z.ZodString, z.ZodTransform<bigint, string>>;
|
|
1242
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
1340
1243
|
status: z.ZodLiteral<"accepted">;
|
|
1341
1244
|
quote: z.ZodObject<{
|
|
1342
1245
|
terms: z.ZodUnion<readonly [z.ZodObject<{
|
|
@@ -1618,6 +1521,76 @@ export declare const mailboxOrderJson: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
1618
1521
|
acceptBy: z.ZodPipe<z.ZodString, z.ZodTransform<bigint, string>>;
|
|
1619
1522
|
}, z.core.$strict>;
|
|
1620
1523
|
acceptedIn: z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>>;
|
|
1524
|
+
orderId: z.ZodString;
|
|
1525
|
+
commitmentId: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
|
|
1526
|
+
supplierBusinessId: z.ZodString;
|
|
1527
|
+
terms: z.ZodObject<{
|
|
1528
|
+
version: z.ZodLiteral<2>;
|
|
1529
|
+
currency: z.ZodEnum<{
|
|
1530
|
+
USD: "USD";
|
|
1531
|
+
}>;
|
|
1532
|
+
amountDecimals: z.ZodLiteral<6>;
|
|
1533
|
+
template: z.ZodLiteral<"job/1">;
|
|
1534
|
+
subject: z.ZodObject<{
|
|
1535
|
+
work: z.ZodObject<{
|
|
1536
|
+
kind: z.ZodString;
|
|
1537
|
+
summary: z.ZodString;
|
|
1538
|
+
}, z.core.$strict>;
|
|
1539
|
+
compute: z.ZodObject<{
|
|
1540
|
+
gpu: z.ZodString;
|
|
1541
|
+
count: z.ZodNumber;
|
|
1542
|
+
region: z.ZodString;
|
|
1543
|
+
}, z.core.$strict>;
|
|
1544
|
+
startsAt: z.ZodPipe<z.ZodString, z.ZodTransform<bigint, string>>;
|
|
1545
|
+
deliverBy: z.ZodPipe<z.ZodString, z.ZodTransform<bigint, string>>;
|
|
1546
|
+
}, z.core.$strict>;
|
|
1547
|
+
consideration: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
1548
|
+
kind: z.ZodLiteral<"rate">;
|
|
1549
|
+
amount: z.ZodPipe<z.ZodString, z.ZodTransform<bigint, string>>;
|
|
1550
|
+
unit: z.ZodString;
|
|
1551
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
1552
|
+
kind: z.ZodLiteral<"fixed">;
|
|
1553
|
+
amount: z.ZodPipe<z.ZodString, z.ZodTransform<bigint, string>>;
|
|
1554
|
+
}, z.core.$strict>], "kind">;
|
|
1555
|
+
remedies: z.ZodObject<{
|
|
1556
|
+
acceptBy: z.ZodPipe<z.ZodString, z.ZodTransform<bigint, string>>;
|
|
1557
|
+
freeCancelBy: z.ZodPipe<z.ZodString, z.ZodTransform<bigint, string>>;
|
|
1558
|
+
charges: z.ZodArray<z.ZodObject<{
|
|
1559
|
+
kind: z.ZodEnum<{
|
|
1560
|
+
lateCancellation: "lateCancellation";
|
|
1561
|
+
noShow: "noShow";
|
|
1562
|
+
}>;
|
|
1563
|
+
amount: z.ZodPipe<z.ZodString, z.ZodTransform<bigint, string>>;
|
|
1564
|
+
earliest: z.ZodPipe<z.ZodString, z.ZodTransform<bigint, string>>;
|
|
1565
|
+
}, z.core.$strict>>;
|
|
1566
|
+
chargeDeadline: z.ZodPipe<z.ZodString, z.ZodTransform<bigint, string>>;
|
|
1567
|
+
}, z.core.$strict>;
|
|
1568
|
+
resolution: z.ZodObject<{
|
|
1569
|
+
contestWindow: z.ZodPipe<z.ZodString, z.ZodTransform<bigint, string>>;
|
|
1570
|
+
arbiter: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
|
|
1571
|
+
day90SupplierShareBps: z.ZodNumber;
|
|
1572
|
+
}, z.core.$strict>;
|
|
1573
|
+
backing: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
1574
|
+
kind: z.ZodLiteral<"reserve">;
|
|
1575
|
+
side: z.ZodLiteral<"buyer">;
|
|
1576
|
+
amount: z.ZodPipe<z.ZodString, z.ZodTransform<bigint, string>>;
|
|
1577
|
+
releaseDate: z.ZodPipe<z.ZodString, z.ZodTransform<bigint, string>>;
|
|
1578
|
+
}, z.core.$strict>], "kind">;
|
|
1579
|
+
}, z.core.$strict>;
|
|
1580
|
+
requirement: z.ZodObject<{
|
|
1581
|
+
template: z.ZodLiteral<"gpu-reservation/1">;
|
|
1582
|
+
condition: z.ZodLiteral<"accepted">;
|
|
1583
|
+
disclosed: z.ZodLiteral<"subject">;
|
|
1584
|
+
}, z.core.$strict>;
|
|
1585
|
+
expiry: z.ZodPipe<z.ZodString, z.ZodTransform<bigint, string>>;
|
|
1586
|
+
buyer: z.ZodObject<{
|
|
1587
|
+
businessId: z.ZodString;
|
|
1588
|
+
account: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
|
|
1589
|
+
lock: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
|
|
1590
|
+
chainId: z.ZodNumber;
|
|
1591
|
+
mandateHash: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
|
|
1592
|
+
}, z.core.$strict>;
|
|
1593
|
+
requestedAt: z.ZodPipe<z.ZodString, z.ZodTransform<bigint, string>>;
|
|
1621
1594
|
}, z.core.$strict>], "status">;
|
|
1622
1595
|
/** What the buyer sends once its reserve is on the lock, which Avow then reads for itself. */
|
|
1623
1596
|
export declare const mailboxReservedJson: z.ZodObject<{
|
|
@@ -1646,5 +1619,5 @@ export declare function mailboxStatusAt(held: {
|
|
|
1646
1619
|
status: MailboxStatus;
|
|
1647
1620
|
expiry: bigint;
|
|
1648
1621
|
}, now: bigint): MailboxStatus;
|
|
1649
|
-
export {};
|
|
1622
|
+
export type { MailboxReserve };
|
|
1650
1623
|
//# sourceMappingURL=mailbox.d.ts.map
|
package/dist/mailbox.d.ts.map
CHANGED
|
@@ -1 +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,KAAK,MAAM,EAAE,CAAA;IACtB,IAAI,EAAE,KAAK,MAAM,EAAE,CAAA;IACnB,OAAO,EAAE,MAAM,CAAA;IACf,yFAAyF;IACzF,WAAW,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8BAA0C,CAAA;AAEvE,8FAA8F;AAC9F,eAAO,MAAM,mBAAmB;;kBAAmD,CAAA;AACnF,oGAAoG;AACpG,eAAO,MAAM,mBAAmB;;kBAAqD,CAAA;AAErF,eAAO,MAAM,wBAAwB,+CAEpC,CAAA;AACD,eAAO,MAAM,iBAAiB,wCAAqE,CAAA;AACnG,eAAO,MAAM,iBAAiB;YAIlB,YAAY,EAAE;QAEzB,CAAA;AACD,eAAO,MAAM,oBAAoB;;QAAkC,CAAA;AACnE,eAAO,MAAM,oBAAoB;;QAAkC,CAAA;AAEnE;;;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;AAED,YAAY,EAAE,cAAc,EAAE,CAAA"}
|
package/dist/mailbox.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { address, bytes32, u64
|
|
2
|
+
import { address, bytes32, u64 } from './json-fields.js';
|
|
3
|
+
import { businessIdJson, orderStagesJson, readOrNull, } from './order-wire.js';
|
|
3
4
|
import { jobRequirementJson, orderIdJson, quoteRequestJson, } from './test-customer.js';
|
|
4
5
|
import { jobTermsJson } from './wire.js';
|
|
5
6
|
/**
|
|
@@ -23,7 +24,6 @@ export const MAILBOX_ORDER_LIFETIME_MAX = 60n * 60n;
|
|
|
23
24
|
/** The most orders an inbox answers with at once, oldest first. */
|
|
24
25
|
export const MAILBOX_INBOX_MAX = 20;
|
|
25
26
|
export const MAILBOX_STATUSES = ['requested', 'quoted', 'expired', 'reserved', 'accepted'];
|
|
26
|
-
const businessIdJson = z.string().min(1).max(100);
|
|
27
27
|
export const jobBuyerJson = z.strictObject({
|
|
28
28
|
businessId: businessIdJson,
|
|
29
29
|
account: address,
|
|
@@ -39,41 +39,19 @@ export const mailboxOrderRequestJson = z.strictObject({
|
|
|
39
39
|
requirement: jobRequirementJson,
|
|
40
40
|
expiry: u64,
|
|
41
41
|
});
|
|
42
|
-
const reserveJson = z.strictObject({ fundedIn: bytes32.nullable(), amount: u256, acceptBy: u64 });
|
|
43
42
|
const base = { ...mailboxOrderRequestJson.shape, buyer: jobBuyerJson, requestedAt: u64 };
|
|
44
|
-
export const mailboxOrderJson =
|
|
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
|
-
]);
|
|
43
|
+
export const mailboxOrderJson = orderStagesJson(base, quoteRequestJson);
|
|
62
44
|
/** What the buyer sends once its reserve is on the lock, which Avow then reads for itself. */
|
|
63
45
|
export const mailboxReservedJson = z.strictObject({ fundedIn: bytes32.nullable() });
|
|
64
46
|
/** What the supplier sends once the lock shows its acceptance, which Avow then reads for itself. */
|
|
65
47
|
export const mailboxAcceptedJson = z.strictObject({ acceptedIn: bytes32.nullable() });
|
|
66
|
-
const
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
};
|
|
70
|
-
export const parseMailboxOrderRequest = read(mailboxOrderRequestJson);
|
|
71
|
-
export const parseMailboxOrder = read(mailboxOrderJson);
|
|
72
|
-
export const parseMailboxInbox = read(z.strictObject({
|
|
48
|
+
export const parseMailboxOrderRequest = readOrNull(mailboxOrderRequestJson);
|
|
49
|
+
export const parseMailboxOrder = readOrNull(mailboxOrderJson);
|
|
50
|
+
export const parseMailboxInbox = readOrNull(z.strictObject({
|
|
73
51
|
orders: z.array(mailboxOrderJson).max(MAILBOX_INBOX_MAX),
|
|
74
52
|
}));
|
|
75
|
-
export const parseMailboxReserved =
|
|
76
|
-
export const parseMailboxAccepted =
|
|
53
|
+
export const parseMailboxReserved = readOrNull(mailboxReservedJson);
|
|
54
|
+
export const parseMailboxAccepted = readOrNull(mailboxAcceptedJson);
|
|
77
55
|
/**
|
|
78
56
|
* Where an order stands at `now`, from what the mailbox holds. An order nobody funded is expired
|
|
79
57
|
* from its expiry on, whether or not it was quoted, and a funded one never expires here.
|
package/dist/mailbox.js.map
CHANGED
|
@@ -1 +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,
|
|
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,MAAM,kBAAkB,CAAA;AACxD,OAAO,EACL,cAAc,EAGd,eAAe,EACf,UAAU,GACX,MAAM,iBAAiB,CAAA;AACxB,OAAO,EAEL,kBAAkB,EAClB,WAAW,EAEX,gBAAgB,GACjB,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAExC;;;;;;;;;;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