@xyo-network/payment-payload-plugins 3.0.21 → 3.0.22

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 (24) hide show
  1. package/dist/neutral/Discount/Payload/Coupon/Conditions/AppraisalAmountCondition.d.ts +3 -0
  2. package/dist/neutral/Discount/Payload/Coupon/Conditions/AppraisalAmountCondition.d.ts.map +1 -0
  3. package/dist/neutral/Discount/Payload/Coupon/Conditions/AssetQuantityCondition.d.ts +3 -0
  4. package/dist/neutral/Discount/Payload/Coupon/Conditions/AssetQuantityCondition.d.ts.map +1 -0
  5. package/dist/neutral/Discount/Payload/Coupon/Conditions/BuyerCondition.d.ts +29 -0
  6. package/dist/neutral/Discount/Payload/Coupon/Conditions/BuyerCondition.d.ts.map +1 -0
  7. package/dist/neutral/Discount/Payload/Coupon/Conditions/index.d.ts +4 -0
  8. package/dist/neutral/Discount/Payload/Coupon/Conditions/index.d.ts.map +1 -0
  9. package/dist/neutral/Discount/Payload/Coupon/index.d.ts +1 -0
  10. package/dist/neutral/Discount/Payload/Coupon/index.d.ts.map +1 -1
  11. package/dist/neutral/Discount/Payload/Coupon/types/Condition.d.ts +7 -0
  12. package/dist/neutral/Discount/Payload/Coupon/types/Condition.d.ts.map +1 -0
  13. package/dist/neutral/Discount/Payload/Coupon/types/index.d.ts +1 -0
  14. package/dist/neutral/Discount/Payload/Coupon/types/index.d.ts.map +1 -1
  15. package/dist/neutral/index.mjs +155 -60
  16. package/dist/neutral/index.mjs.map +1 -1
  17. package/package.json +3 -2
  18. package/src/Discount/Payload/Coupon/Conditions/AppraisalAmountCondition.ts +43 -0
  19. package/src/Discount/Payload/Coupon/Conditions/AssetQuantityCondition.ts +25 -0
  20. package/src/Discount/Payload/Coupon/Conditions/BuyerCondition.ts +50 -0
  21. package/src/Discount/Payload/Coupon/Conditions/index.ts +3 -0
  22. package/src/Discount/Payload/Coupon/index.ts +1 -0
  23. package/src/Discount/Payload/Coupon/types/Condition.ts +24 -0
  24. package/src/Discount/Payload/Coupon/types/index.ts +1 -0
@@ -0,0 +1,3 @@
1
+ import type { Condition } from '../types/index.ts';
2
+ export declare const createConditionForMaximumAppraisalAmount: (maximumAppraisalAmount: number) => Condition;
3
+ //# sourceMappingURL=AppraisalAmountCondition.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AppraisalAmountCondition.d.ts","sourceRoot":"","sources":["../../../../../../src/Discount/Payload/Coupon/Conditions/AppraisalAmountCondition.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAOlD,eAAO,MAAM,wCAAwC,2BAA4B,MAAM,KAAG,SAgCzF,CAAA"}
@@ -0,0 +1,3 @@
1
+ import type { Condition } from '../types/index.ts';
2
+ export declare const createConditionForMinimumAssetQuantity: (minimumAssetQuantity: number) => Condition;
3
+ //# sourceMappingURL=AssetQuantityCondition.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AssetQuantityCondition.d.ts","sourceRoot":"","sources":["../../../../../../src/Discount/Payload/Coupon/Conditions/AssetQuantityCondition.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAOlD,eAAO,MAAM,sCAAsC,yBAA0B,MAAM,KAAG,SAerF,CAAA"}
@@ -0,0 +1,29 @@
1
+ import type { Address } from '@xylabs/hex';
2
+ import { SchemaSchema } from '@xyo-network/schema-payload-plugin';
3
+ import type { Condition } from '../types/index.ts';
4
+ export type BuyerCondition = Condition & {
5
+ definition: {
6
+ contains: {
7
+ properties: {
8
+ buyer: {
9
+ items: {
10
+ const: Address;
11
+ type: 'string';
12
+ };
13
+ minItems: 1;
14
+ type: 'array';
15
+ };
16
+ schema: {
17
+ const: 'network.xyo.escrow.terms';
18
+ type: 'string';
19
+ };
20
+ };
21
+ required: ['schema', 'buyer'];
22
+ type: 'object';
23
+ };
24
+ type: 'array';
25
+ };
26
+ schema: SchemaSchema;
27
+ };
28
+ export declare const createConditionForRequiredBuyer: (buyer: Address) => BuyerCondition;
29
+ //# sourceMappingURL=BuyerCondition.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BuyerCondition.d.ts","sourceRoot":"","sources":["../../../../../../src/Discount/Payload/Coupon/Conditions/BuyerCondition.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAA;AAEjE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAElD,MAAM,MAAM,cAAc,GAAG,SAAS,GAAG;IACvC,UAAU,EAAE;QACV,QAAQ,EAAE;YACR,UAAU,EAAE;gBACV,KAAK,EAAE;oBACL,KAAK,EAAE;wBACL,KAAK,EAAE,OAAO,CAAA;wBACd,IAAI,EAAE,QAAQ,CAAA;qBACf,CAAA;oBACD,QAAQ,EAAE,CAAC,CAAA;oBACX,IAAI,EAAE,OAAO,CAAA;iBACd,CAAA;gBACD,MAAM,EAAE;oBAAE,KAAK,EAAE,0BAA0B,CAAC;oBAAC,IAAI,EAAE,QAAQ,CAAA;iBAAE,CAAA;aAC9D,CAAA;YACD,QAAQ,EAAE,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAA;YAC7B,IAAI,EAAE,QAAQ,CAAA;SACf,CAAA;QACD,IAAI,EAAE,OAAO,CAAA;KACd,CAAA;IACD,MAAM,EAAE,YAAY,CAAA;CACrB,CAAA;AAOD,eAAO,MAAM,+BAA+B,UAAW,OAAO,KAAG,cAiBhE,CAAA"}
@@ -0,0 +1,4 @@
1
+ export * from './AppraisalAmountCondition.ts';
2
+ export * from './AssetQuantityCondition.ts';
3
+ export * from './BuyerCondition.ts';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/Discount/Payload/Coupon/Conditions/index.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAA;AAC7C,cAAc,6BAA6B,CAAA;AAC3C,cAAc,qBAAqB,CAAA"}
@@ -1,3 +1,4 @@
1
+ export * from './Conditions/index.ts';
1
2
  export * from './Coupons/index.ts';
2
3
  export * from './Payload.ts';
3
4
  export * from './Schema.ts';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/Discount/Payload/Coupon/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAA;AAClC,cAAc,cAAc,CAAA;AAC5B,cAAc,aAAa,CAAA;AAC3B,cAAc,kBAAkB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/Discount/Payload/Coupon/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAA;AACrC,cAAc,oBAAoB,CAAA;AAClC,cAAc,cAAc,CAAA;AAC5B,cAAc,aAAa,CAAA;AAC3B,cAAc,kBAAkB,CAAA"}
@@ -0,0 +1,7 @@
1
+ import { type WithMeta, type WithOptionalMeta } from '@xyo-network/payload-model';
2
+ import { type SchemaPayload } from '@xyo-network/schema-payload-plugin';
3
+ export type Condition = SchemaPayload | WithOptionalMeta<SchemaPayload> | WithMeta<SchemaPayload>;
4
+ export declare const isCondition: (x?: unknown | null) => x is Condition;
5
+ export declare const isConditionWithSources: (x?: unknown | null) => x is import("@xyo-network/payload-model").WithSources<Condition>;
6
+ export declare const isConditionWithMeta: (x?: unknown | null) => x is WithMeta<Condition>;
7
+ //# sourceMappingURL=Condition.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Condition.d.ts","sourceRoot":"","sources":["../../../../../../src/Discount/Payload/Coupon/types/Condition.ts"],"names":[],"mappings":"AAAA,OAAO,EACmF,KAAK,QAAQ,EAAE,KAAK,gBAAgB,EAC7H,MAAM,4BAA4B,CAAA;AACnC,OAAO,EAAE,KAAK,aAAa,EAAgB,MAAM,oCAAoC,CAAA;AAKrF,MAAM,MAAM,SAAS,GAAG,aAAa,GAAG,gBAAgB,CAAC,aAAa,CAAC,GAAG,QAAQ,CAAC,aAAa,CAAC,CAAA;AAKjG,eAAO,MAAM,WAAW,wCAAiD,CAAA;AAKzE,eAAO,MAAM,sBAAsB,0FAA4D,CAAA;AAK/F,eAAO,MAAM,mBAAmB,kDAAyD,CAAA"}
@@ -1,3 +1,4 @@
1
+ export * from './Condition.ts';
1
2
  export * from './CouponFields.ts';
2
3
  export * from './isStackable.ts';
3
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/Discount/Payload/Coupon/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAA;AACjC,cAAc,kBAAkB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/Discount/Payload/Coupon/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA;AAC9B,cAAc,mBAAmB,CAAA;AACjC,cAAc,kBAAkB,CAAA"}
@@ -217,6 +217,84 @@ var isBillingAddressWithMeta = isPayloadOfSchemaTypeWithMeta2(BillingAddressSche
217
217
  // src/Discount/Config.ts
218
218
  var PaymentDiscountDivinerConfigSchema = "network.xyo.diviner.payments.discount.config";
219
219
 
220
+ // src/Discount/Payload/Coupon/Conditions/AppraisalAmountCondition.ts
221
+ import { SchemaSchema } from "@xyo-network/schema-payload-plugin";
222
+ var createConditionForMaximumAppraisalAmount = (maximumAppraisalAmount) => {
223
+ return {
224
+ schema: SchemaSchema,
225
+ definition: {
226
+ allOf: [
227
+ {
228
+ type: "array",
229
+ contains: {
230
+ type: "object",
231
+ properties: {
232
+ schema: { type: "string", const: "network.xyo.escrow.terms" },
233
+ appraisals: { type: "array", minItems: 1 }
234
+ },
235
+ required: ["schema", "appraisals"]
236
+ }
237
+ },
238
+ {
239
+ type: "array",
240
+ contains: {
241
+ type: "object",
242
+ properties: { schema: { type: "string", const: "network.xyo.hash.lease.estimate" } },
243
+ required: ["schema"]
244
+ },
245
+ items: {
246
+ type: "object",
247
+ if: { properties: { schema: { type: "string", const: "network.xyo.hash.lease.estimate" } } },
248
+ then: { properties: { price: { type: "number", maximum: maximumAppraisalAmount } }, required: ["price"] }
249
+ }
250
+ }
251
+ ]
252
+ }
253
+ };
254
+ };
255
+
256
+ // src/Discount/Payload/Coupon/Conditions/AssetQuantityCondition.ts
257
+ import { SchemaSchema as SchemaSchema2 } from "@xyo-network/schema-payload-plugin";
258
+ var createConditionForMinimumAssetQuantity = (minimumAssetQuantity) => {
259
+ return {
260
+ schema: SchemaSchema2,
261
+ definition: {
262
+ type: "array",
263
+ contains: {
264
+ type: "object",
265
+ properties: {
266
+ schema: { type: "string", const: "network.xyo.escrow.terms" },
267
+ assets: { type: "array", minItems: minimumAssetQuantity }
268
+ },
269
+ required: ["schema", "assets"]
270
+ }
271
+ }
272
+ };
273
+ };
274
+
275
+ // src/Discount/Payload/Coupon/Conditions/BuyerCondition.ts
276
+ import { SchemaSchema as SchemaSchema3 } from "@xyo-network/schema-payload-plugin";
277
+ var createConditionForRequiredBuyer = (buyer) => {
278
+ return {
279
+ schema: SchemaSchema3,
280
+ definition: {
281
+ type: "array",
282
+ contains: {
283
+ type: "object",
284
+ properties: {
285
+ schema: { type: "string", const: "network.xyo.escrow.terms" },
286
+ buyer: {
287
+ type: "array",
288
+ items: { type: "string", const: buyer },
289
+ minItems: 1
290
+ }
291
+ },
292
+ required: ["schema", "buyer"]
293
+ }
294
+ }
295
+ };
296
+ };
297
+
220
298
  // src/Discount/Payload/Coupon/Coupons/FixedAmount.ts
221
299
  import {
222
300
  isPayloadOfSchemaType as isPayloadOfSchemaType3,
@@ -260,19 +338,30 @@ var isCoupon = (x) => isFixedAmountCoupon(x) || isFixedPercentageCoupon(x) || is
260
338
  var isCouponWithSources = (x) => isFixedAmountCouponWithSources(x) || isFixedPercentageCouponWithSources(x) || isFixedPriceCouponWithSources(x);
261
339
  var isCouponWithMeta = (x) => isFixedAmountCouponWithMeta(x) || isFixedPercentageCouponWithMeta(x);
262
340
 
341
+ // src/Discount/Payload/Coupon/types/Condition.ts
342
+ import {
343
+ isPayloadOfSchemaType as isPayloadOfSchemaType6,
344
+ isPayloadOfSchemaTypeWithMeta as isPayloadOfSchemaTypeWithMeta6,
345
+ isPayloadOfSchemaTypeWithSources as isPayloadOfSchemaTypeWithSources6
346
+ } from "@xyo-network/payload-model";
347
+ import { SchemaSchema as SchemaSchema4 } from "@xyo-network/schema-payload-plugin";
348
+ var isCondition = isPayloadOfSchemaType6(SchemaSchema4);
349
+ var isConditionWithSources = isPayloadOfSchemaTypeWithSources6(SchemaSchema4);
350
+ var isConditionWithMeta = isPayloadOfSchemaTypeWithMeta6(SchemaSchema4);
351
+
263
352
  // src/Discount/Payload/Coupon/types/isStackable.ts
264
353
  var isStackable = (x) => (x ?? { stackable: false })?.stackable;
265
354
 
266
355
  // src/Discount/Payload/Discount.ts
267
356
  import {
268
- isPayloadOfSchemaType as isPayloadOfSchemaType6,
269
- isPayloadOfSchemaTypeWithMeta as isPayloadOfSchemaTypeWithMeta6,
270
- isPayloadOfSchemaTypeWithSources as isPayloadOfSchemaTypeWithSources6
357
+ isPayloadOfSchemaType as isPayloadOfSchemaType7,
358
+ isPayloadOfSchemaTypeWithMeta as isPayloadOfSchemaTypeWithMeta7,
359
+ isPayloadOfSchemaTypeWithSources as isPayloadOfSchemaTypeWithSources7
271
360
  } from "@xyo-network/payload-model";
272
361
  var DiscountSchema = "network.xyo.payments.discount";
273
- var isDiscount = isPayloadOfSchemaType6(DiscountSchema);
274
- var isDiscountWithSources = isPayloadOfSchemaTypeWithSources6(DiscountSchema);
275
- var isDiscountWithMeta = isPayloadOfSchemaTypeWithMeta6(DiscountSchema);
362
+ var isDiscount = isPayloadOfSchemaType7(DiscountSchema);
363
+ var isDiscountWithSources = isPayloadOfSchemaTypeWithSources7(DiscountSchema);
364
+ var isDiscountWithMeta = isPayloadOfSchemaTypeWithMeta7(DiscountSchema);
276
365
 
277
366
  // src/Discount/Payload/NoDiscount.ts
278
367
  var NO_DISCOUNT = {
@@ -301,9 +390,9 @@ var getEscrowSecret = () => {
301
390
 
302
391
  // src/Escrow/Outcome.ts
303
392
  import {
304
- isPayloadOfSchemaType as isPayloadOfSchemaType7,
305
- isPayloadOfSchemaTypeWithMeta as isPayloadOfSchemaTypeWithMeta7,
306
- isPayloadOfSchemaTypeWithSources as isPayloadOfSchemaTypeWithSources7
393
+ isPayloadOfSchemaType as isPayloadOfSchemaType8,
394
+ isPayloadOfSchemaTypeWithMeta as isPayloadOfSchemaTypeWithMeta8,
395
+ isPayloadOfSchemaTypeWithSources as isPayloadOfSchemaTypeWithSources8
307
396
  } from "@xyo-network/payload-model";
308
397
 
309
398
  // src/Escrow/Schema.ts
@@ -311,20 +400,20 @@ var EscrowSchema = "network.xyo.escrow";
311
400
 
312
401
  // src/Escrow/Outcome.ts
313
402
  var EscrowOutcomeSchema = `${EscrowSchema}.outcome`;
314
- var isEscrowOutcome = isPayloadOfSchemaType7(EscrowOutcomeSchema);
315
- var isEscrowOutcomeWithSources = isPayloadOfSchemaTypeWithSources7(EscrowOutcomeSchema);
316
- var isEscrowOutcomeWithMeta = isPayloadOfSchemaTypeWithMeta7(EscrowOutcomeSchema);
403
+ var isEscrowOutcome = isPayloadOfSchemaType8(EscrowOutcomeSchema);
404
+ var isEscrowOutcomeWithSources = isPayloadOfSchemaTypeWithSources8(EscrowOutcomeSchema);
405
+ var isEscrowOutcomeWithMeta = isPayloadOfSchemaTypeWithMeta8(EscrowOutcomeSchema);
317
406
 
318
407
  // src/Escrow/Terms.ts
319
408
  import {
320
- isPayloadOfSchemaType as isPayloadOfSchemaType8,
321
- isPayloadOfSchemaTypeWithMeta as isPayloadOfSchemaTypeWithMeta8,
322
- isPayloadOfSchemaTypeWithSources as isPayloadOfSchemaTypeWithSources8
409
+ isPayloadOfSchemaType as isPayloadOfSchemaType9,
410
+ isPayloadOfSchemaTypeWithMeta as isPayloadOfSchemaTypeWithMeta9,
411
+ isPayloadOfSchemaTypeWithSources as isPayloadOfSchemaTypeWithSources9
323
412
  } from "@xyo-network/payload-model";
324
413
  var EscrowTermsSchema = `${EscrowSchema}.terms`;
325
- var isEscrowTerms = isPayloadOfSchemaType8(EscrowTermsSchema);
326
- var isEscrowTermsWithSources = isPayloadOfSchemaTypeWithSources8(EscrowTermsSchema);
327
- var isEscrowTermsWithMeta = isPayloadOfSchemaTypeWithMeta8(EscrowTermsSchema);
414
+ var isEscrowTerms = isPayloadOfSchemaType9(EscrowTermsSchema);
415
+ var isEscrowTermsWithSources = isPayloadOfSchemaTypeWithSources9(EscrowTermsSchema);
416
+ var isEscrowTermsWithMeta = isPayloadOfSchemaTypeWithMeta9(EscrowTermsSchema);
328
417
 
329
418
  // src/Escrow/validators/common/ModuleInstanceValidators/moduleInstanceValidators.ts
330
419
  var moduleIdentifiersContainsOneOf = (escrowTerms, propertyExpression, moduleIdentifiers, required = true) => {
@@ -635,9 +724,9 @@ var getSellerSecretSignedValidator = (dictionary) => {
635
724
 
636
725
  // src/Payment/Instrument/Card/Payload.ts
637
726
  import {
638
- isPayloadOfSchemaType as isPayloadOfSchemaType9,
639
- isPayloadOfSchemaTypeWithMeta as isPayloadOfSchemaTypeWithMeta9,
640
- isPayloadOfSchemaTypeWithSources as isPayloadOfSchemaTypeWithSources9
727
+ isPayloadOfSchemaType as isPayloadOfSchemaType10,
728
+ isPayloadOfSchemaTypeWithMeta as isPayloadOfSchemaTypeWithMeta10,
729
+ isPayloadOfSchemaTypeWithSources as isPayloadOfSchemaTypeWithSources10
641
730
  } from "@xyo-network/payload-model";
642
731
 
643
732
  // src/Payment/Schema.ts
@@ -650,92 +739,92 @@ var PaymentInstrumentSchema = `${PaymentSchema}.instrument`;
650
739
  var PaymentCardSchema = `${PaymentInstrumentSchema}.card`;
651
740
 
652
741
  // src/Payment/Instrument/Card/Payload.ts
653
- var isPaymentCard = isPayloadOfSchemaType9(PaymentCardSchema);
654
- var isPaymentCardWithSources = isPayloadOfSchemaTypeWithSources9(PaymentCardSchema);
655
- var isPaymentCardWithMeta = isPayloadOfSchemaTypeWithMeta9(PaymentCardSchema);
742
+ var isPaymentCard = isPayloadOfSchemaType10(PaymentCardSchema);
743
+ var isPaymentCardWithSources = isPayloadOfSchemaTypeWithSources10(PaymentCardSchema);
744
+ var isPaymentCardWithMeta = isPayloadOfSchemaTypeWithMeta10(PaymentCardSchema);
656
745
 
657
746
  // src/Payment/Payload.ts
658
747
  import {
659
- isPayloadOfSchemaType as isPayloadOfSchemaType10,
660
- isPayloadOfSchemaTypeWithMeta as isPayloadOfSchemaTypeWithMeta10,
661
- isPayloadOfSchemaTypeWithSources as isPayloadOfSchemaTypeWithSources10
748
+ isPayloadOfSchemaType as isPayloadOfSchemaType11,
749
+ isPayloadOfSchemaTypeWithMeta as isPayloadOfSchemaTypeWithMeta11,
750
+ isPayloadOfSchemaTypeWithSources as isPayloadOfSchemaTypeWithSources11
662
751
  } from "@xyo-network/payload-model";
663
- var isPayment = isPayloadOfSchemaType10(PaymentSchema);
664
- var isPaymentWithSources = isPayloadOfSchemaTypeWithSources10(PaymentSchema);
665
- var isPaymentWithMeta = isPayloadOfSchemaTypeWithMeta10(PaymentSchema);
752
+ var isPayment = isPayloadOfSchemaType11(PaymentSchema);
753
+ var isPaymentWithSources = isPayloadOfSchemaTypeWithSources11(PaymentSchema);
754
+ var isPaymentWithMeta = isPayloadOfSchemaTypeWithMeta11(PaymentSchema);
666
755
 
667
756
  // src/Payment/Status/Payload.ts
668
757
  import {
669
- isPayloadOfSchemaType as isPayloadOfSchemaType11,
670
- isPayloadOfSchemaTypeWithMeta as isPayloadOfSchemaTypeWithMeta11,
671
- isPayloadOfSchemaTypeWithSources as isPayloadOfSchemaTypeWithSources11
758
+ isPayloadOfSchemaType as isPayloadOfSchemaType12,
759
+ isPayloadOfSchemaTypeWithMeta as isPayloadOfSchemaTypeWithMeta12,
760
+ isPayloadOfSchemaTypeWithSources as isPayloadOfSchemaTypeWithSources12
672
761
  } from "@xyo-network/payload-model";
673
762
 
674
763
  // src/Payment/Status/Schema.ts
675
764
  var PaymentStatusSchema = `${PaymentSchema}.status`;
676
765
 
677
766
  // src/Payment/Status/Payload.ts
678
- var isPaymentStatus = isPayloadOfSchemaType11(PaymentStatusSchema);
679
- var isPaymentStatusWithSources = isPayloadOfSchemaTypeWithSources11(PaymentStatusSchema);
680
- var isPaymentStatusWithMeta = isPayloadOfSchemaTypeWithMeta11(PaymentStatusSchema);
767
+ var isPaymentStatus = isPayloadOfSchemaType12(PaymentStatusSchema);
768
+ var isPaymentStatusWithSources = isPayloadOfSchemaTypeWithSources12(PaymentStatusSchema);
769
+ var isPaymentStatusWithMeta = isPayloadOfSchemaTypeWithMeta12(PaymentStatusSchema);
681
770
 
682
771
  // src/Purchase/Payload.ts
683
772
  import {
684
- isPayloadOfSchemaType as isPayloadOfSchemaType12,
685
- isPayloadOfSchemaTypeWithMeta as isPayloadOfSchemaTypeWithMeta12,
686
- isPayloadOfSchemaTypeWithSources as isPayloadOfSchemaTypeWithSources12
773
+ isPayloadOfSchemaType as isPayloadOfSchemaType13,
774
+ isPayloadOfSchemaTypeWithMeta as isPayloadOfSchemaTypeWithMeta13,
775
+ isPayloadOfSchemaTypeWithSources as isPayloadOfSchemaTypeWithSources13
687
776
  } from "@xyo-network/payload-model";
688
777
 
689
778
  // src/Purchase/Schema.ts
690
779
  var PurchaseSchema = `${PaymentsSchema}.purchase`;
691
780
 
692
781
  // src/Purchase/Payload.ts
693
- var isPurchase = isPayloadOfSchemaType12(PurchaseSchema);
694
- var isPurchaseWithSources = isPayloadOfSchemaTypeWithSources12(PurchaseSchema);
695
- var isPurchaseWithMeta = isPayloadOfSchemaTypeWithMeta12(PurchaseSchema);
782
+ var isPurchase = isPayloadOfSchemaType13(PurchaseSchema);
783
+ var isPurchaseWithSources = isPayloadOfSchemaTypeWithSources13(PurchaseSchema);
784
+ var isPurchaseWithMeta = isPayloadOfSchemaTypeWithMeta13(PurchaseSchema);
696
785
 
697
786
  // src/Receipt/Payload.ts
698
787
  import {
699
- isPayloadOfSchemaType as isPayloadOfSchemaType13,
700
- isPayloadOfSchemaTypeWithMeta as isPayloadOfSchemaTypeWithMeta13,
701
- isPayloadOfSchemaTypeWithSources as isPayloadOfSchemaTypeWithSources13
788
+ isPayloadOfSchemaType as isPayloadOfSchemaType14,
789
+ isPayloadOfSchemaTypeWithMeta as isPayloadOfSchemaTypeWithMeta14,
790
+ isPayloadOfSchemaTypeWithSources as isPayloadOfSchemaTypeWithSources14
702
791
  } from "@xyo-network/payload-model";
703
792
 
704
793
  // src/Receipt/Schema.ts
705
794
  var ReceiptSchema = `${PaymentsSchema}.receipt`;
706
795
 
707
796
  // src/Receipt/Payload.ts
708
- var isReceipt = isPayloadOfSchemaType13(ReceiptSchema);
709
- var isReceiptWithSources = isPayloadOfSchemaTypeWithSources13(ReceiptSchema);
710
- var isReceiptWithMeta = isPayloadOfSchemaTypeWithMeta13(ReceiptSchema);
797
+ var isReceipt = isPayloadOfSchemaType14(ReceiptSchema);
798
+ var isReceiptWithSources = isPayloadOfSchemaTypeWithSources14(ReceiptSchema);
799
+ var isReceiptWithMeta = isPayloadOfSchemaTypeWithMeta14(ReceiptSchema);
711
800
 
712
801
  // src/Subtotal/Diviner/Config.ts
713
802
  var PaymentSubtotalDivinerConfigSchema = "network.xyo.diviner.payments.subtotal.config";
714
803
 
715
804
  // src/Subtotal/Diviner/Payload.ts
716
805
  import {
717
- isPayloadOfSchemaType as isPayloadOfSchemaType14,
718
- isPayloadOfSchemaTypeWithMeta as isPayloadOfSchemaTypeWithMeta14,
719
- isPayloadOfSchemaTypeWithSources as isPayloadOfSchemaTypeWithSources14
806
+ isPayloadOfSchemaType as isPayloadOfSchemaType15,
807
+ isPayloadOfSchemaTypeWithMeta as isPayloadOfSchemaTypeWithMeta15,
808
+ isPayloadOfSchemaTypeWithSources as isPayloadOfSchemaTypeWithSources15
720
809
  } from "@xyo-network/payload-model";
721
810
  var SubtotalSchema = "network.xyo.payments.subtotal";
722
- var isSubtotal = isPayloadOfSchemaType14(SubtotalSchema);
723
- var isSubtotalWithSources = isPayloadOfSchemaTypeWithSources14(SubtotalSchema);
724
- var isSubtotalWithMeta = isPayloadOfSchemaTypeWithMeta14(SubtotalSchema);
811
+ var isSubtotal = isPayloadOfSchemaType15(SubtotalSchema);
812
+ var isSubtotalWithSources = isPayloadOfSchemaTypeWithSources15(SubtotalSchema);
813
+ var isSubtotalWithMeta = isPayloadOfSchemaTypeWithMeta15(SubtotalSchema);
725
814
 
726
815
  // src/Total/Diviner/Config.ts
727
816
  var PaymentTotalDivinerConfigSchema = "network.xyo.diviner.payments.total.config";
728
817
 
729
818
  // src/Total/Diviner/Payload.ts
730
819
  import {
731
- isPayloadOfSchemaType as isPayloadOfSchemaType15,
732
- isPayloadOfSchemaTypeWithMeta as isPayloadOfSchemaTypeWithMeta15,
733
- isPayloadOfSchemaTypeWithSources as isPayloadOfSchemaTypeWithSources15
820
+ isPayloadOfSchemaType as isPayloadOfSchemaType16,
821
+ isPayloadOfSchemaTypeWithMeta as isPayloadOfSchemaTypeWithMeta16,
822
+ isPayloadOfSchemaTypeWithSources as isPayloadOfSchemaTypeWithSources16
734
823
  } from "@xyo-network/payload-model";
735
824
  var TotalSchema = "network.xyo.payments.total";
736
- var isTotal = isPayloadOfSchemaType15(TotalSchema);
737
- var isTotalWithSources = isPayloadOfSchemaTypeWithSources15(TotalSchema);
738
- var isTotalWithMeta = isPayloadOfSchemaTypeWithMeta15(TotalSchema);
825
+ var isTotal = isPayloadOfSchemaType16(TotalSchema);
826
+ var isTotalWithSources = isPayloadOfSchemaTypeWithSources16(TotalSchema);
827
+ var isTotalWithMeta = isPayloadOfSchemaTypeWithMeta16(TotalSchema);
739
828
  export {
740
829
  AmountSchema,
741
830
  BillingAddressSchema,
@@ -766,6 +855,9 @@ export {
766
855
  assetsExistValidator,
767
856
  buyerExistsValidator,
768
857
  buyerSecretExistsValidator,
858
+ createConditionForMaximumAppraisalAmount,
859
+ createConditionForMinimumAssetQuantity,
860
+ createConditionForRequiredBuyer,
769
861
  createEscrowIntent,
770
862
  createEscrowIntentWithSecret,
771
863
  getAppraisalAuthoritiesAllowedValidator,
@@ -786,6 +878,9 @@ export {
786
878
  isBillingAddress,
787
879
  isBillingAddressWithMeta,
788
880
  isBillingAddressWithSources,
881
+ isCondition,
882
+ isConditionWithMeta,
883
+ isConditionWithSources,
789
884
  isCoupon,
790
885
  isCouponWithMeta,
791
886
  isCouponWithSources,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/Amount/Iso4217Currency.ts","../../src/Amount/Payload.ts","../../src/Billing/Address/Address.ts","../../src/Schema.ts","../../src/Billing/Schema.ts","../../src/Billing/Address/Schema.ts","../../src/Discount/Config.ts","../../src/Discount/Payload/Coupon/Coupons/FixedAmount.ts","../../src/Discount/Payload/Coupon/Schema.ts","../../src/Discount/Payload/Coupon/Coupons/FixedPercentage.ts","../../src/Discount/Payload/Coupon/Coupons/FixedPrice.ts","../../src/Discount/Payload/Coupon/Payload.ts","../../src/Discount/Payload/Coupon/types/isStackable.ts","../../src/Discount/Payload/Discount.ts","../../src/Discount/Payload/NoDiscount.ts","../../src/Escrow/createEscrowIntent.ts","../../src/Escrow/getEscrowSecret.ts","../../src/Escrow/Outcome.ts","../../src/Escrow/Schema.ts","../../src/Escrow/Terms.ts","../../src/Escrow/validators/common/ModuleInstanceValidators/moduleInstanceValidators.ts","../../src/Escrow/validators/common/TemporalValidators/validateWithinWindow.ts","../../src/Escrow/validators/escrow/agent.ts","../../src/Escrow/validators/escrow/appraisal.ts","../../src/Escrow/validators/escrow/appraisalAuthorities.ts","../../src/Escrow/validators/escrow/assets.ts","../../src/Escrow/validators/escrow/buyer.ts","../../src/Escrow/validators/escrow/buyerSecret.ts","../../src/Escrow/validators/escrow/nbfExp.ts","../../src/Escrow/validators/escrow/paymentAuthorities.ts","../../src/Escrow/validators/escrow/seller.ts","../../src/Escrow/validators/escrow/sellerSecret.ts","../../src/Payment/Instrument/Card/Payload.ts","../../src/Payment/Schema.ts","../../src/Payment/Instrument/Schema.ts","../../src/Payment/Instrument/Card/Schema.ts","../../src/Payment/Payload.ts","../../src/Payment/Status/Payload.ts","../../src/Payment/Status/Schema.ts","../../src/Purchase/Payload.ts","../../src/Purchase/Schema.ts","../../src/Receipt/Payload.ts","../../src/Receipt/Schema.ts","../../src/Subtotal/Diviner/Config.ts","../../src/Subtotal/Diviner/Payload.ts","../../src/Total/Diviner/Config.ts","../../src/Total/Diviner/Payload.ts"],"sourcesContent":["/* eslint-disable max-lines */\n/**\n * ISO 4217 currency codes\n */\nexport type Iso4217AlphabeticalCode =\n 'AED' |\n 'AFN' |\n 'ALL' |\n 'AMD' |\n 'ANG' |\n 'AOA' |\n 'ARS' |\n 'AUD' |\n 'AWG' |\n 'AZN' |\n 'BAM' |\n 'BBD' |\n 'BDT' |\n 'BGN' |\n 'BHD' |\n 'BIF' |\n 'BMD' |\n 'BND' |\n 'BOB' |\n 'BOV' |\n 'BRL' |\n 'BSD' |\n 'BTN' |\n 'BWP' |\n 'BYN' |\n 'BZD' |\n 'CAD' |\n 'CDF' |\n 'CHE' |\n 'CHF' |\n 'CHW' |\n 'CLF' |\n 'CLP' |\n 'CNY' |\n 'COP' |\n 'COU' |\n 'CRC' |\n 'CUP' |\n 'CVE' |\n 'CZK' |\n 'DJF' |\n 'DKK' |\n 'DOP' |\n 'DZD' |\n 'EGP' |\n 'ERN' |\n 'ETB' |\n 'EUR' |\n 'FJD' |\n 'FKP' |\n 'GBP' |\n 'GEL' |\n 'GHS' |\n 'GIP' |\n 'GMD' |\n 'GNF' |\n 'GTQ' |\n 'GYD' |\n 'HKD' |\n 'HNL' |\n 'HTG' |\n 'HUF' |\n 'IDR' |\n 'ILS' |\n 'INR' |\n 'IQD' |\n 'IRR' |\n 'ISK' |\n 'JMD' |\n 'JOD' |\n 'JPY' |\n 'KES' |\n 'KGS' |\n 'KHR' |\n 'KMF' |\n 'KPW' |\n 'KRW' |\n 'KWD' |\n 'KYD' |\n 'KZT' |\n 'LAK' |\n 'LBP' |\n 'LKR' |\n 'LRD' |\n 'LSL' |\n 'LYD' |\n 'MAD' |\n 'MDL' |\n 'MGA' |\n 'MKD' |\n 'MMK' |\n 'MNT' |\n 'MOP' |\n 'MRU' |\n 'MUR' |\n 'MVR' |\n 'MWK' |\n 'MXN' |\n 'MXV' |\n 'MYR' |\n 'MZN' |\n 'NAD' |\n 'NGN' |\n 'NIO' |\n 'NOK' |\n 'NPR' |\n 'NZD' |\n 'OMR' |\n 'PAB' |\n 'PEN' |\n 'PGK' |\n 'PHP' |\n 'PKR' |\n 'PLN' |\n 'PYG' |\n 'QAR' |\n 'RON' |\n 'RSD' |\n 'RUB' |\n 'RWF' |\n 'SAR' |\n 'SBD' |\n 'SCR' |\n 'SDG' |\n 'SEK' |\n 'SGD' |\n 'SHP' |\n 'SLE' |\n 'SOS' |\n 'SRD' |\n 'SSP' |\n 'STN' |\n 'SVC' |\n 'SYP' |\n 'SZL' |\n 'THB' |\n 'TJS' |\n 'TMT' |\n 'TND' |\n 'TOP' |\n 'TRY' |\n 'TTD' |\n 'TWD' |\n 'TZS' |\n 'UAH' |\n 'UGX' |\n 'USD' |\n 'USN' |\n 'UYI' |\n 'UYU' |\n 'UYW' |\n 'UZS' |\n 'VED' |\n 'VES' |\n 'VND' |\n 'VUV' |\n 'WST' |\n 'XAF' |\n 'XAG' |\n 'XAU' |\n 'XBA' |\n 'XBB' |\n 'XBC' |\n 'XBD' |\n 'XCD' |\n 'XDR' |\n 'XOF' |\n 'XPD' |\n 'XPF' |\n 'XPT' |\n 'XSU' |\n 'XTS' |\n 'XUA' |\n 'XXX' |\n 'YER' |\n 'ZAR' |\n 'ZMW' |\n 'ZWG' |\n 'ZWL'\n\n// TODO: Technically, the values should be 3 digit numbers with leading\n// zeros, so we can padStart if we need to be strict\n/**\n * ISO 4217 numeric currency number codes\n */\nexport type Iso4217NumericCode =\n 784 |\n 971 |\n 8 |\n 51 |\n 532 |\n 973 |\n 32 |\n 36 |\n 533 |\n 944 |\n 977 |\n 52 |\n 50 |\n 975 |\n 48 |\n 108 |\n 60 |\n 96 |\n 68 |\n 984 |\n 986 |\n 44 |\n 64 |\n 72 |\n 933 |\n 84 |\n 124 |\n 976 |\n 947 |\n 756 |\n 948 |\n 990 |\n 152 |\n 156 |\n 170 |\n 970 |\n 188 |\n 192 |\n 132 |\n 203 |\n 262 |\n 208 |\n 214 |\n 12 |\n 818 |\n 232 |\n 230 |\n 978 |\n 242 |\n 238 |\n 826 |\n 981 |\n 936 |\n 292 |\n 270 |\n 324 |\n 320 |\n 328 |\n 344 |\n 340 |\n 332 |\n 348 |\n 360 |\n 376 |\n 356 |\n 368 |\n 364 |\n 352 |\n 388 |\n 400 |\n 392 |\n 404 |\n 417 |\n 116 |\n 174 |\n 408 |\n 410 |\n 414 |\n 136 |\n 398 |\n 418 |\n 422 |\n 144 |\n 430 |\n 426 |\n 434 |\n 504 |\n 498 |\n 969 |\n 807 |\n 104 |\n 496 |\n 446 |\n 929 |\n 480 |\n 462 |\n 454 |\n 484 |\n 979 |\n 458 |\n 943 |\n 516 |\n 566 |\n 558 |\n 578 |\n 524 |\n 554 |\n 512 |\n 590 |\n 604 |\n 598 |\n 608 |\n 586 |\n 985 |\n 600 |\n 634 |\n 946 |\n 941 |\n 643 |\n 646 |\n 682 |\n 90 |\n 690 |\n 938 |\n 752 |\n 702 |\n 654 |\n 925 |\n 706 |\n 968 |\n 728 |\n 930 |\n 222 |\n 760 |\n 748 |\n 764 |\n 972 |\n 934 |\n 788 |\n 776 |\n 949 |\n 780 |\n 901 |\n 834 |\n 980 |\n 800 |\n 840 |\n 997 |\n 940 |\n 858 |\n 927 |\n 860 |\n 926 |\n 928 |\n 704 |\n 548 |\n 882 |\n 950 |\n 961 |\n 959 |\n 955 |\n 956 |\n 957 |\n 958 |\n 951 |\n 960 |\n 952 |\n 964 |\n 953 |\n 962 |\n 994 |\n 963 |\n 965 |\n 999 |\n 886 |\n 710 |\n 967 |\n 924 |\n 932\n\n/**\n * Dictionary of ISO 4217 alphabetical currency codes to numeric currency number codes\n */\nexport const Iso4217CurrencyCodes: Record<Iso4217AlphabeticalCode, Iso4217NumericCode> = {\n AED: 784,\n AFN: 971,\n ALL: 8,\n AMD: 51,\n ANG: 532,\n AOA: 973,\n ARS: 32,\n AUD: 36,\n AWG: 533,\n AZN: 944,\n BAM: 977,\n BBD: 52,\n BDT: 50,\n BGN: 975,\n BHD: 48,\n BIF: 108,\n BMD: 60,\n BND: 96,\n BOB: 68,\n BOV: 984,\n BRL: 986,\n BSD: 44,\n BTN: 64,\n BWP: 72,\n BYN: 933,\n BZD: 84,\n CAD: 124,\n CDF: 976,\n CHE: 947,\n CHF: 756,\n CHW: 948,\n CLF: 990,\n CLP: 152,\n CNY: 156,\n COP: 170,\n COU: 970,\n CRC: 188,\n CUP: 192,\n CVE: 132,\n CZK: 203,\n DJF: 262,\n DKK: 208,\n DOP: 214,\n DZD: 12,\n EGP: 818,\n ERN: 232,\n ETB: 230,\n EUR: 978,\n FJD: 242,\n FKP: 238,\n GBP: 826,\n GEL: 981,\n GHS: 936,\n GIP: 292,\n GMD: 270,\n GNF: 324,\n GTQ: 320,\n GYD: 328,\n HKD: 344,\n HNL: 340,\n HTG: 332,\n HUF: 348,\n IDR: 360,\n ILS: 376,\n INR: 356,\n IQD: 368,\n IRR: 364,\n ISK: 352,\n JMD: 388,\n JOD: 400,\n JPY: 392,\n KES: 404,\n KGS: 417,\n KHR: 116,\n KMF: 174,\n KPW: 408,\n KRW: 410,\n KWD: 414,\n KYD: 136,\n KZT: 398,\n LAK: 418,\n LBP: 422,\n LKR: 144,\n LRD: 430,\n LSL: 426,\n LYD: 434,\n MAD: 504,\n MDL: 498,\n MGA: 969,\n MKD: 807,\n MMK: 104,\n MNT: 496,\n MOP: 446,\n MRU: 929,\n MUR: 480,\n MVR: 462,\n MWK: 454,\n MXN: 484,\n MXV: 979,\n MYR: 458,\n MZN: 943,\n NAD: 516,\n NGN: 566,\n NIO: 558,\n NOK: 578,\n NPR: 524,\n NZD: 554,\n OMR: 512,\n PAB: 590,\n PEN: 604,\n PGK: 598,\n PHP: 608,\n PKR: 586,\n PLN: 985,\n PYG: 600,\n QAR: 634,\n RON: 946,\n RSD: 941,\n RUB: 643,\n RWF: 646,\n SAR: 682,\n SBD: 90,\n SCR: 690,\n SDG: 938,\n SEK: 752,\n SGD: 702,\n SHP: 654,\n SLE: 925,\n SOS: 706,\n SRD: 968,\n SSP: 728,\n STN: 930,\n SVC: 222,\n SYP: 760,\n SZL: 748,\n THB: 764,\n TJS: 972,\n TMT: 934,\n TND: 788,\n TOP: 776,\n TRY: 949,\n TTD: 780,\n TWD: 901,\n TZS: 834,\n UAH: 980,\n UGX: 800,\n USD: 840,\n USN: 997,\n UYI: 940,\n UYU: 858,\n UYW: 927,\n UZS: 860,\n VED: 926,\n VES: 928,\n VND: 704,\n VUV: 548,\n WST: 882,\n XAF: 950,\n XAG: 961,\n XAU: 959,\n XBA: 955,\n XBB: 956,\n XBC: 957,\n XBD: 958,\n XCD: 951,\n XDR: 960,\n XOF: 952,\n XPD: 964,\n XPF: 953,\n XPT: 962,\n XSU: 994,\n XTS: 963,\n XUA: 965,\n XXX: 999,\n YER: 886,\n ZAR: 710,\n ZMW: 967,\n ZWG: 924,\n ZWL: 932,\n}\n\nexport const isIso4217CurrencyCode = (code: string): code is Iso4217AlphabeticalCode => Iso4217CurrencyCodes[code as Iso4217AlphabeticalCode] ? true : false\n","import type { PayloadWithSources } from '@xyo-network/payload-model'\nimport {\n isPayloadOfSchemaType,\n isPayloadOfSchemaTypeWithMeta,\n isPayloadOfSchemaTypeWithSources,\n} from '@xyo-network/payload-model'\n\nimport type { Iso4217AlphabeticalCode } from './Iso4217Currency.ts'\n\nexport const AmountSchema = 'network.xyo.payments.amount' as const\nexport type AmountSchema = typeof AmountSchema\n\nexport interface AmountFields {\n amount: number\n currency: Iso4217AlphabeticalCode\n}\n\n/**\n * The result of a amount\n */\nexport type Amount = PayloadWithSources<AmountFields, AmountSchema>\n\n/**\n * Identity function for determining if an object is an Amount\n */\nexport const isAmount = isPayloadOfSchemaType<Amount>(AmountSchema)\n\n/**\n * Identity function for determining if an object is an Amount with sources\n */\nexport const isAmountWithSources = isPayloadOfSchemaTypeWithSources<Amount>(AmountSchema)\n\n/**\n * Identity function for determining if an object is an Amount with meta\n */\nexport const isAmountWithMeta = isPayloadOfSchemaTypeWithMeta<Amount>(AmountSchema)\n","import type { Payload } from '@xyo-network/payload-model'\nimport {\n isPayloadOfSchemaType, isPayloadOfSchemaTypeWithMeta, isPayloadOfSchemaTypeWithSources,\n} from '@xyo-network/payload-model'\n\nimport { BillingAddressSchema } from './Schema.ts'\n\n/**\n * The fields describing a billing address.\n */\nexport interface BillingAddressFields {\n /** Street address line 1. */\n address?: string\n /** Street address line 2. */\n address2?: string | null\n /** City of the billing address. */\n city?: string\n /** Country code of the billing address, ISO 3166-1 alpha-2 code. */\n country?: string\n /** First name */\n firstName: string\n /** Last name */\n lastName: string\n /** Organization or company name associated with the billing address. */\n organization?: string | null\n /** Postal or ZIP code of the billing address. */\n postalCode?: string\n /** State or region of the billing address. */\n region?: string\n}\n\n/**\n * A BillingAddress Payload\n */\nexport type BillingAddress = Payload<BillingAddressFields, BillingAddressSchema>\n\n/**\n * Identity function for determine if an object is a BillingAddress\n */\nexport const isBillingAddress = isPayloadOfSchemaType<BillingAddress>(BillingAddressSchema)\n\n/**\n * Identity function for determine if an object is a BillingAddress with sources\n */\nexport const isBillingAddressWithSources = isPayloadOfSchemaTypeWithSources<BillingAddress>(BillingAddressSchema)\n\n/**\n * Identity function for determine if an object is a BillingAddress with meta\n */\nexport const isBillingAddressWithMeta = isPayloadOfSchemaTypeWithMeta<BillingAddress>(BillingAddressSchema)\n","export const PaymentsSchema = 'network.xyo.payments'\nexport type PaymentsSchema = typeof PaymentsSchema\n","import { PaymentsSchema } from '../Schema.ts'\n\nexport const BillingSchema = `${PaymentsSchema}.billing`\nexport type BillingSchema = typeof BillingSchema\n","import { BillingSchema } from '../Schema.ts'\n\nexport const BillingAddressSchema = `${BillingSchema}.address`\nexport type BillingAddressSchema = typeof BillingAddressSchema\n","// import type { Hash } from '@xylabs/hex'\nimport type { Address } from '@xylabs/hex'\nimport type { DivinerConfig } from '@xyo-network/diviner-model'\nimport type { ModuleIdentifier } from '@xyo-network/module-model'\n\nexport const PaymentDiscountDivinerConfigSchema = 'network.xyo.diviner.payments.discount.config'\nexport type PaymentDiscountDivinerConfigSchema = typeof PaymentDiscountDivinerConfigSchema\n\n/**\n * The configuration for the Payment Discount Diviner\n */\nexport type PaymentDiscountDivinerConfig = DivinerConfig<\n {\n /**\n * The boundwitness diviner used to query for payloads\n */\n boundWitnessDiviner?: ModuleIdentifier\n /**\n * The list of coupon authorities that can be used to get a discount\n */\n couponAuthorities?: Address[]\n\n // /**\n // * The list of coupons that are supported by this diviner\n // */\n // supportedCoupons?: Hash[]\n\n /**\n * The Diviner that can be used to determine the subtotal to apply discounts to\n */\n paymentSubtotalDiviner?: ModuleIdentifier\n },\n PaymentDiscountDivinerConfigSchema\n>\n","import type { PayloadWithSources } from '@xyo-network/payload-model'\nimport {\n isPayloadOfSchemaType,\n isPayloadOfSchemaTypeWithMeta,\n isPayloadOfSchemaTypeWithSources,\n} from '@xyo-network/payload-model'\n\nimport type { AmountFields } from '../../../../Amount/index.ts'\nimport { CouponSchema } from '../Schema.ts'\nimport type { CouponFields } from '../types/index.ts'\n\nexport const FixedAmountCouponSchema = `${CouponSchema}.fixed.amount` as const\nexport type FixedAmountCouponSchema = typeof FixedAmountCouponSchema\n\nexport interface FixedAmountCouponFields extends CouponFields, AmountFields {}\n\n/**\n * A coupon that provides a fixed discount amount\n */\nexport type FixedAmountCoupon = PayloadWithSources<FixedAmountCouponFields, FixedAmountCouponSchema>\n\n/**\n * Identity function for determining if an object is an FixedAmountCoupon\n */\nexport const isFixedAmountCoupon = isPayloadOfSchemaType<FixedAmountCoupon>(FixedAmountCouponSchema)\n\n/**\n * Identity function for determining if an object is an FixedAmountCoupon with sources\n */\nexport const isFixedAmountCouponWithSources = isPayloadOfSchemaTypeWithSources<FixedAmountCoupon>(FixedAmountCouponSchema)\n\n/**\n * Identity function for determining if an object is an FixedAmountCoupon with meta\n */\nexport const isFixedAmountCouponWithMeta = isPayloadOfSchemaTypeWithMeta<FixedAmountCoupon>(FixedAmountCouponSchema)\n","export const CouponSchema = 'network.xyo.payments.coupon' as const\nexport type CouponSchema = typeof CouponSchema\n","import type { PayloadWithSources } from '@xyo-network/payload-model'\nimport {\n isPayloadOfSchemaType,\n isPayloadOfSchemaTypeWithMeta,\n isPayloadOfSchemaTypeWithSources,\n} from '@xyo-network/payload-model'\n\nimport { CouponSchema } from '../Schema.ts'\nimport type { CouponFields } from '../types/index.ts'\n\nexport const FixedPercentageCouponSchema = `${CouponSchema}.fixed.percentage` as const\nexport type FixedPercentageCouponSchema = typeof FixedPercentageCouponSchema\n\nexport interface FixedPercentageCouponFields extends CouponFields {\n percentage: number\n}\n\n/**\n * A coupon that provides a fixed discount amount\n */\nexport type FixedPercentageCoupon = PayloadWithSources<FixedPercentageCouponFields, FixedPercentageCouponSchema>\n\n/**\n * Identity function for determining if an object is an FixedPercentageCoupon\n */\nexport const isFixedPercentageCoupon = isPayloadOfSchemaType<FixedPercentageCoupon>(FixedPercentageCouponSchema)\n\n/**\n * Identity function for determining if an object is an FixedPercentageCoupon with sources\n */\nexport const isFixedPercentageCouponWithSources = isPayloadOfSchemaTypeWithSources<FixedPercentageCoupon>(FixedPercentageCouponSchema)\n\n/**\n * Identity function for determining if an object is an FixedPercentageCoupon with meta\n */\nexport const isFixedPercentageCouponWithMeta = isPayloadOfSchemaTypeWithMeta<FixedPercentageCoupon>(FixedPercentageCouponSchema)\n","import type { PayloadWithSources } from '@xyo-network/payload-model'\nimport {\n isPayloadOfSchemaType,\n isPayloadOfSchemaTypeWithMeta,\n isPayloadOfSchemaTypeWithSources,\n} from '@xyo-network/payload-model'\n\nimport type { AmountFields } from '../../../../Amount/index.ts'\nimport { CouponSchema } from '../Schema.ts'\nimport type { CouponFields } from '../types/index.ts'\n\nexport const FixedPriceCouponSchema = `${CouponSchema}.fixed.price` as const\nexport type FixedPriceCouponSchema = typeof FixedPriceCouponSchema\n\nexport interface FixedPriceCouponFields extends CouponFields, AmountFields { }\n\n/**\n * A coupon that provides a fixed total price\n */\nexport type FixedPriceCoupon = PayloadWithSources<FixedPriceCouponFields, FixedPriceCouponSchema>\n\n/**\n * Identity function for determining if an object is an FixedPriceCoupon\n */\nexport const isFixedPriceCoupon = isPayloadOfSchemaType<FixedPriceCoupon>(FixedPriceCouponSchema)\n\n/**\n * Identity function for determining if an object is an FixedPriceCoupon with sources\n */\nexport const isFixedPriceCouponWithSources = isPayloadOfSchemaTypeWithSources<FixedPriceCoupon>(FixedPriceCouponSchema)\n\n/**\n * Identity function for determining if an object is an FixedPriceCoupon with meta\n */\nexport const isFixedPriceCouponWithMeta = isPayloadOfSchemaTypeWithMeta<FixedPriceCoupon>(FixedPriceCouponSchema)\n","import {\n type FixedAmountCoupon, type FixedPercentageCoupon, type FixedPriceCoupon,\n isFixedAmountCoupon, isFixedAmountCouponWithMeta, isFixedAmountCouponWithSources, isFixedPercentageCoupon,\n isFixedPercentageCouponWithMeta,\n isFixedPercentageCouponWithSources,\n isFixedPriceCoupon,\n isFixedPriceCouponWithSources,\n} from './Coupons/index.ts'\n\n/**\n * The type of coupons\n */\nexport type Coupon =\n FixedAmountCoupon\n | FixedPercentageCoupon\n | FixedPriceCoupon\n\n/**\n * Identity function for determining if an object is an Coupon\n */\nexport const isCoupon = (x?: unknown | null) =>\n isFixedAmountCoupon(x)\n || isFixedPercentageCoupon(x)\n || isFixedPriceCoupon(x)\n\n/**\n * Identity function for determining if an object is an Coupon with sources\n */\nexport const isCouponWithSources = (x?: unknown | null) =>\n isFixedAmountCouponWithSources(x)\n || isFixedPercentageCouponWithSources(x)\n || isFixedPriceCouponWithSources(x)\n\n/**\n * Identity function for determining if an object is an Coupon with meta\n */\nexport const isCouponWithMeta = (x?: unknown | null) =>\n isFixedAmountCouponWithMeta(x)\n || isFixedPercentageCouponWithMeta(x)\n","import type { CouponFields } from './CouponFields.ts'\n\n/**\n * Identity function for determining if coupon is stackable\n */\nexport const isStackable = (x?: unknown | null) => (x as CouponFields ?? { stackable: false })?.stackable\n","import type { PayloadWithSources } from '@xyo-network/payload-model'\nimport {\n isPayloadOfSchemaType,\n isPayloadOfSchemaTypeWithMeta,\n isPayloadOfSchemaTypeWithSources,\n} from '@xyo-network/payload-model'\n\nimport type { AmountFields } from '../../Amount/index.ts'\n\nexport const DiscountSchema = 'network.xyo.payments.discount' as const\nexport type DiscountSchema = typeof DiscountSchema\n\nexport interface DiscountFields extends AmountFields { }\n\n/**\n * The result of a discount\n */\nexport type Discount = PayloadWithSources<DiscountFields, DiscountSchema>\n\n/**\n * Identity function for determining if an object is an Discount\n */\nexport const isDiscount = isPayloadOfSchemaType<Discount>(DiscountSchema)\n\n/**\n * Identity function for determining if an object is an Discount with sources\n */\nexport const isDiscountWithSources = isPayloadOfSchemaTypeWithSources<Discount>(DiscountSchema)\n\n/**\n * Identity function for determining if an object is an Discount with meta\n */\nexport const isDiscountWithMeta = isPayloadOfSchemaTypeWithMeta<Discount>(DiscountSchema)\n","import type { Discount } from './Discount.ts'\nimport { DiscountSchema } from './Discount.ts'\n\nexport const NO_DISCOUNT: Discount = {\n schema: DiscountSchema,\n amount: 0,\n currency: 'USD',\n}\n","import type { AccountInstance } from '@xyo-network/account-model'\nimport { BoundWitnessBuilder } from '@xyo-network/boundwitness-builder'\nimport type { IdPayload } from '@xyo-network/id-payload-plugin'\n\nimport type { EscrowTerms } from './Terms.ts'\n\n/**\n * Creates an escrow intent\n * @deprecated Use createEscrowIntentWithSecret instead\n * @param terms The payloads describing the terms for the escrow\n * @param account The account to create the escrow intent with\n * @returns The escrow intent\n */\nexport const createEscrowIntent = async (terms: EscrowTerms[], account: AccountInstance) => {\n const result = await new BoundWitnessBuilder({ accounts: [account] }).payloads([...terms]).build()\n return result\n}\n\n/**\n * Creates an escrow intent (for a buyer or seller) using the supplied secret\n * @param terms The payload describing the terms for the escrow\n * @param secret The secret for the escrow principal party to use for the escrow\n * @param account The account to create the escrow intent with\n * @returns The escrow intent\n */\nexport const createEscrowIntentWithSecret = async (terms: EscrowTerms, secret: IdPayload, account: AccountInstance) => {\n const result = await new BoundWitnessBuilder({ accounts: [account] }).payloads([terms, secret]).build()\n return result\n}\n","import { Crypto } from '@xylabs/crypto'\nimport type { IdPayload } from '@xyo-network/id-payload-plugin'\nimport { IdSchema } from '@xyo-network/id-payload-plugin'\n\n/**\n * Returns a cryptographically random secret to use for escrow\n * @returns The escrow secret\n */\nexport const getEscrowSecret = (): IdPayload => {\n return { salt: Crypto.randomUUID(), schema: IdSchema }\n}\n","import type { Hash } from '@xylabs/hex'\nimport type { PayloadWithSources } from '@xyo-network/payload-model'\nimport {\n isPayloadOfSchemaType,\n isPayloadOfSchemaTypeWithMeta,\n isPayloadOfSchemaTypeWithSources,\n} from '@xyo-network/payload-model'\n\nimport { EscrowSchema } from './Schema.ts'\n\nexport const EscrowOutcomeSchema = `${EscrowSchema}.outcome` as const\nexport type EscrowOutcomeSchema = typeof EscrowOutcomeSchema\n\n/**\n * The possible outcomes for an escrow\n */\nexport type EscrowOutcomes = 'fulfilled' | 'expired' // TODO: More outcomes\n\nexport interface EscrowOutcomeFields {\n outcome: EscrowOutcomes\n terms: Hash\n}\n\n/**\n * The terms of an escrow\n */\nexport type EscrowOutcome = PayloadWithSources<EscrowOutcomeFields, EscrowOutcomeSchema>\n\n/**\n * Identity function for determining if an object is an EscrowOutcome\n */\nexport const isEscrowOutcome = isPayloadOfSchemaType<EscrowOutcome>(EscrowOutcomeSchema)\n\n/**\n * Identity function for determining if an object is an EscrowOutcome with sources\n */\nexport const isEscrowOutcomeWithSources = isPayloadOfSchemaTypeWithSources<EscrowOutcome>(EscrowOutcomeSchema)\n\n/**\n * Identity function for determining if an object is an EscrowOutcome with meta\n */\nexport const isEscrowOutcomeWithMeta = isPayloadOfSchemaTypeWithMeta<EscrowOutcome>(EscrowOutcomeSchema)\n","export const EscrowSchema = 'network.xyo.escrow'\nexport type EscrowSchema = typeof EscrowSchema\n","import type { Address, Hash } from '@xylabs/hex'\nimport type { Payload } from '@xyo-network/payload-model'\nimport {\n isPayloadOfSchemaType, isPayloadOfSchemaTypeWithMeta, isPayloadOfSchemaTypeWithSources,\n} from '@xyo-network/payload-model'\n\nimport { EscrowSchema } from './Schema.ts'\n\nexport const EscrowTermsSchema = `${EscrowSchema}.terms` as const\nexport type EscrowTermsSchema = typeof EscrowTermsSchema\n\n// TODO: Include escrow agent in escrow terms\nexport interface EscrowTermsFields {\n /**\n * The trusted estimators for the worth of the things being sold\n */\n appraisalAuthorities: Address[]\n /**\n * The estimated worths of the things being sold\n */\n appraisals: Hash[]\n /**\n * The things being sold\n */\n assets: Hash[]\n /**\n * The buyer\n */\n buyer: Address[]\n /**\n * The buyer\n */\n buyerSecret: Hash\n /**\n * Any discounts (coupons, vouchers, credits, etc.) to be applied to the escrow\n */\n discounts: Hash[]\n /**\n * The escrow agent responsible for the escrow\n */\n escrowAgent: Address\n /**\n * The time the escrow expires\n */\n exp: number\n /**\n * The time the escrow starts\n */\n nbf: number\n /**\n * The trusted payment authorities\n */\n paymentAuthorities: Address[]\n /**\n * The seller\n */\n seller: Address[]\n /**\n * The seller\n */\n sellerSecret: Hash\n}\n\n/**\n * The terms of an escrow\n */\nexport type EscrowTerms = Payload<Partial<EscrowTermsFields>, EscrowTermsSchema>\n\n/**\n * Identity function for determining if an object is an EscrowTerms\n */\nexport const isEscrowTerms = isPayloadOfSchemaType<EscrowTerms>(EscrowTermsSchema)\n\n/**\n * Identity function for determining if an object is an EscrowTerms with sources\n */\nexport const isEscrowTermsWithSources = isPayloadOfSchemaTypeWithSources<EscrowTerms>(EscrowTermsSchema)\n\n/**\n * Identity function for determining if an object is an EscrowTerms with meta\n */\nexport const isEscrowTermsWithMeta = isPayloadOfSchemaTypeWithMeta<EscrowTerms>(EscrowTermsSchema)\n","import type { ModuleIdentifier } from '@xyo-network/module-model'\nimport type { PayloadValueExpression } from '@xyo-network/payload-model'\n\nimport type { EscrowTerms } from '../../../Terms.ts'\n\n/**\n * Checks if property value of the escrow terms contains one of the valid moduleIdentifiers\n * @param escrowTerms The escrow terms to validate\n * @param propertyExpression The selector to get the property containing the moduleIdentifier(s) from the escrow terms\n * @param moduleIdentifiers The list of allowed moduleIdentifiers\n * @param required Is the property required to be present\n * @returns True if the property value contains one of the valid moduleIdentifiers\n */\nexport const moduleIdentifiersContainsOneOf = (\n escrowTerms: EscrowTerms,\n propertyExpression: PayloadValueExpression<EscrowTerms, 'appraisalAuthorities' | 'buyer' | 'escrowAgent' | 'paymentAuthorities' | 'seller'>,\n moduleIdentifiers: ModuleIdentifier[],\n required: boolean = true,\n) => {\n const termsValue: string | string[] | undefined = propertyExpression(escrowTerms)\n if (termsValue === undefined) {\n return required ? false : true\n } else {\n return Array.isArray(termsValue) ? termsValue.some(address => moduleIdentifiers.includes(address)) : moduleIdentifiers.includes(termsValue)\n }\n}\n\n/**\n * Checks if property value of the escrow terms contains all of the valid moduleIdentifiers\n * @param escrowTerms The escrow terms to validate\n * @param selector The selector to get the property containing the moduleIdentifier(s) from the escrow terms\n * @param moduleIdentifiers The list of allowed moduleIdentifiers\n * @param required Is the property required to be present\n * @returns True if the property value contains all of the valid moduleIdentifiers\n */\nexport const moduleIdentifiersContainsAllOf = (\n escrowTerms: EscrowTerms,\n selector: PayloadValueExpression<EscrowTerms, 'appraisalAuthorities' | 'buyer' | 'escrowAgent' | 'paymentAuthorities' | 'seller'>,\n moduleIdentifiers: ModuleIdentifier[],\n required: boolean = true,\n) => {\n const termsValue: string | string[] | undefined = selector(escrowTerms)\n if (termsValue === undefined) {\n return required ? false : true\n } else {\n return Array.isArray(termsValue) ? termsValue.every(address => moduleIdentifiers.includes(address)) : moduleIdentifiers.includes(termsValue)\n }\n}\n","export type Windowed = { exp?: number; nbf?: number }\n\nexport const validateWithinWindow = (value: Windowed, exp: number, nbf: number = Date.now()): boolean => {\n if (value.nbf === undefined || value.nbf > nbf) return false\n if (value.exp === undefined || value.exp < exp) return false\n return true\n}\n","import type { ModuleIdentifier } from '@xyo-network/module-model'\nimport type { PayloadValidationFunction } from '@xyo-network/payload-model'\n\nimport type { EscrowTerms } from '../../Terms.ts'\nimport { moduleIdentifiersContainsOneOf } from '../common/index.ts'\n\nconst name = 'EscrowTerms.escrowAgent'\n\nexport const getEscrowAgentAllowedValidator = (allowedEscrowAgent: ModuleIdentifier): PayloadValidationFunction<EscrowTerms> => {\n return (terms: EscrowTerms) => {\n const result = moduleIdentifiersContainsOneOf(terms, t => t.escrowAgent, [allowedEscrowAgent], true)\n if (!result) {\n console.log(`${name}: Escrow agent not allowed: ${terms.escrowAgent}`)\n }\n return result\n }\n}\n","import { assertEx } from '@xylabs/assert'\nimport type { Hash } from '@xylabs/hex'\nimport type { BoundWitness } from '@xyo-network/boundwitness-model'\nimport { isBoundWitnessWithMeta } from '@xyo-network/boundwitness-model'\nimport type { HashLeaseEstimate } from '@xyo-network/diviner-hash-lease'\nimport { isHashLeaseEstimateWithSources } from '@xyo-network/diviner-hash-lease'\nimport type {\n Payload, PayloadValidationFunction, WithMeta, WithSources,\n} from '@xyo-network/payload-model'\n\nimport type { EscrowTerms } from '../../Terms.ts'\nimport { validateWithinWindow } from '../common/index.ts'\n\nconst name = 'EscrowTerms.appraisal'\n\n/**\n * A function that validates the escrow terms for tbe existence of appraisals\n * @returns True if the escrow terms contain appraisals, false otherwise\n */\nexport const appraisalsExistValidator: PayloadValidationFunction<EscrowTerms> = (terms: EscrowTerms) => {\n // Validate we have appraisals\n const appraisals = terms.appraisals\n if (!appraisals || appraisals.length === 0) {\n console.log(`${name}: No appraisals: ${terms.appraisals}`)\n return false\n }\n return true\n}\n\n/**\n * Returns a function that validates the escrow terms for appraisals which are from valid authorities\n * @param dictionary Payload dictionary of the escrow terms\n * @returns A function that validates the escrow terms for appraisals which are from valid authorities\n */\nexport const getAppraisalsFromValidAuthoritiesValidator = (dictionary: Record<Hash, WithMeta<Payload>>): PayloadValidationFunction<EscrowTerms> => {\n return (terms: EscrowTerms) => {\n const appraisals = assertEx(terms.appraisals, () => `${name}: No appraisals: ${terms.appraisals}`)\n const appraisalAuthorities = assertEx(terms.appraisalAuthorities, () => `${name}: No appraisalAuthorities: ${terms.appraisalAuthorities}`)\n\n // Validate the appraisals are signed by valid appraisal authorities. Validation criteria:\n // - We have a bw for each of the appraisal\n // - The bw is signed by an approved appraisal authority\n const appraisalBWsValid: Record<Hash, WithMeta<BoundWitness>[]> = Object.fromEntries(\n appraisals.map<[Hash, WithMeta<BoundWitness>[]]>(hash => [hash, []]),\n )\n for (const bw of Object.values(dictionary).filter(isBoundWitnessWithMeta)) {\n for (const appraisal of appraisals) {\n if (bw.payload_hashes.includes(appraisal) && bw.addresses.some(address => appraisalAuthorities.includes(address))) {\n appraisalBWsValid[appraisal].push(bw)\n }\n }\n }\n for (const [appraisal, bws] of Object.entries(appraisalBWsValid)) {\n if (bws.length === 0) {\n console.log(`${name}: No valid appraisals for ${appraisal}`)\n return false\n }\n }\n return true\n }\n}\n\n/**\n * Returns a function that validates the escrow terms for appraisals which are valid\n * @param dictionary Payload dictionary of the escrow terms\n * @param minimumExp The minium amount of time an estimate needs to be valid\n * for in the future (so as not to expire before the escrow is complete)\n * @returns A function that validates the escrow terms for appraisals which are valid\n */\nexport const getAppraisalsValidValidator = (\n dictionary: Record<Hash, WithMeta<Payload>>,\n minimumExp: number,\n): PayloadValidationFunction<EscrowTerms> => {\n return (terms: EscrowTerms) => {\n // Verify we have an estimate for each of the assets\n const estimatesByAsset = getEstimatesByAsset(terms, dictionary)\n // Validate each of the estimates are valid (time, price, etc)\n const now = Date.now()\n const exp = now + minimumExp\n for (const [asset, estimates] of Object.entries(estimatesByAsset)) {\n for (const estimate of estimates) {\n if (!validateEstimate(estimate, exp)) {\n console.log(`${name}: Invalid estimate for asset ${asset}: ${estimate}`)\n return false\n }\n }\n }\n return true\n }\n}\n\n/**\n * Returns a function that validates the escrow terms to ensure that they contain an appraisal for each asset\n * @param dictionary Payload dictionary of the escrow terms\n * @returns A function that validates the escrow terms for appraisals\n */\nexport const getAppraisalsForAllAssetsValidator = (dictionary: Record<Hash, WithMeta<Payload>>): PayloadValidationFunction<EscrowTerms> => {\n return (terms: EscrowTerms) => {\n // Verify we have an estimate for each of the assets\n const estimatesByAsset = getEstimatesByAsset(terms, dictionary)\n const assets = assertEx(terms.assets, () => `${name}: No assets: ${terms.assets}`)\n if (Object.keys(estimatesByAsset).length !== assets.length) {\n console.log(`${name}: Missing appraisals for all assets: ${assets}`)\n return false\n }\n return true\n }\n}\n\nconst validateEstimate = (estimate: WithSources<HashLeaseEstimate>, exp: number): boolean => {\n if (!validateWithinWindow(estimate, exp)) return false\n if (estimate.currency !== 'USD') return false\n if (estimate.price <= 0) return false\n return true\n}\n\nconst getEstimatesByAsset = (terms: EscrowTerms, dictionary: Record<Hash, WithMeta<Payload>>): Record<Hash, WithSources<HashLeaseEstimate>[]> => {\n const assets = assertEx(terms.assets, () => `${name}: No assets: ${terms.assets}`)\n const estimates = Object.values(dictionary).filter(isHashLeaseEstimateWithSources) as unknown as WithSources<HashLeaseEstimate>[]\n const estimatesByAsset: Record<Hash, WithSources<HashLeaseEstimate>[]> = {}\n for (const estimate of estimates) {\n const { sources } = estimate\n if (sources === undefined || sources.length === 0) {\n console.log(`${name}: No sources: ${estimate}`)\n continue\n }\n for (const asset of assets) {\n if (sources.includes(asset)) {\n if (!estimatesByAsset[asset]) estimatesByAsset[asset] = []\n estimatesByAsset[asset].push(estimate)\n }\n }\n }\n return estimatesByAsset\n}\n","import { asAddress } from '@xylabs/hex'\nimport type { ModuleIdentifier } from '@xyo-network/module-model'\nimport type { PayloadValidationFunction } from '@xyo-network/payload-model'\n\nimport type { EscrowTerms } from '../../Terms.ts'\nimport { moduleIdentifiersContainsAllOf } from '../common/index.ts'\n\nconst name = 'EscrowTerms.appraisalAuthorities'\n\n/**\n * A function that validates the escrow terms for appraisalAuthorities\n * @returns True if the escrow terms contain appraisalAuthorities, false otherwise\n */\nexport const appraisalAuthoritiesExistValidator: PayloadValidationFunction<EscrowTerms> = (terms: EscrowTerms) => {\n // Validate we have appraisalAuthorities\n const appraisalAuthorities = terms.appraisalAuthorities\n if (!appraisalAuthorities || appraisalAuthorities.length === 0) {\n console.log(`${name}: No appraisalAuthorities: ${terms.appraisalAuthorities}`)\n return false\n }\n // Validate the authorities are addresses\n if (appraisalAuthorities.map(x => asAddress(x)).length !== appraisalAuthorities.length) {\n console.log(`${name}: Invalid address: ${terms.appraisalAuthorities}`)\n return false\n }\n return true\n}\n\nexport const getAppraisalAuthoritiesAllowedValidator = (allowed: ModuleIdentifier[]): PayloadValidationFunction<EscrowTerms> => {\n return (terms: EscrowTerms) => {\n const result = moduleIdentifiersContainsAllOf(terms, t => t.appraisalAuthorities, allowed, true)\n if (!result) {\n console.log(`${name}: Appraisal authority not allowed: ${terms.appraisalAuthorities}`)\n }\n return result\n }\n}\n","import type { PayloadValidationFunction } from '@xyo-network/payload-model'\n\nimport type { EscrowTerms } from '../../Terms.ts'\n\nconst name = 'EscrowTerms.assets'\n\n/**\n * Returns a function that validates the escrow terms for assets\n * @returns A function that validates the escrow terms for assets\n */\nexport const assetsExistValidator: PayloadValidationFunction<EscrowTerms> = (terms: EscrowTerms) => {\n // Validate we have assets\n const assets = terms.assets\n if (!assets || assets.length === 0) {\n console.log(`${name}: No assets: ${terms.assets}`)\n return false\n }\n return true\n}\n","import { asAddress } from '@xylabs/hex'\nimport type { PayloadValidationFunction } from '@xyo-network/payload-model'\n\nimport type { EscrowTerms } from '../../Terms.ts'\n\nconst name = 'EscrowTerms.buyer'\n\n/**\n * A function that validates the escrow terms for buyer\n * @returns True if the escrow terms contain buyer, false otherwise\n */\nexport const buyerExistsValidator: PayloadValidationFunction<EscrowTerms> = (terms: EscrowTerms) => {\n // Validate we have buyer\n const buyer = terms.buyer\n if (!buyer || buyer.length === 0) {\n console.log(`${name}: No buyer: ${terms.buyer}`)\n return false\n }\n // Validate the authorities are addresses\n if (buyer.map(x => asAddress(x)).length !== buyer.length) {\n console.log(`${name}: Invalid address: ${terms.buyer}`)\n return false\n }\n return true\n}\n","import { assertEx } from '@xylabs/assert'\nimport type { Hash } from '@xylabs/hex'\nimport { isBoundWitnessWithMeta } from '@xyo-network/boundwitness-model'\nimport { BoundWitnessValidator } from '@xyo-network/boundwitness-validator'\nimport type {\n Payload, PayloadValidationFunction, WithMeta,\n} from '@xyo-network/payload-model'\n\nimport type { EscrowTerms } from '../../Terms.ts'\n\nconst name = 'EscrowTerms.buyerSecret'\n\n/**\n * Returns a function that validates the escrow terms for buyerSecret\n * @returns A function that validates the escrow terms for buyerSecret\n */\nexport const buyerSecretExistsValidator: PayloadValidationFunction<EscrowTerms> = (terms: EscrowTerms) => {\n // Validate we have buyerSecret\n const buyerSecret = terms.buyerSecret\n if (!buyerSecret || buyerSecret.length === 0) {\n console.log(`${name}: No buyerSecret: ${terms.buyerSecret}`)\n return false\n }\n return true\n}\n\n/**\n * Returns a function that validates the escrow terms for the existence of the buyerSecret in the dictionary\n * @param dictionary Payload dictionary of the escrow terms\n * @returns A function that validates the escrow terms for the existence of the buyerSecret in the dictionary\n */\nexport const getBuyerSecretSuppliedValidator = (dictionary: Record<Hash, WithMeta<Payload>>): PayloadValidationFunction<EscrowTerms> => {\n return (terms: EscrowTerms) => {\n const buyerSecret = assertEx(terms.buyerSecret, () => `${name}: No buyerSecret: ${terms.buyerSecret}`)\n if (!dictionary[buyerSecret]) {\n console.log(`${name}: Payload not supplied for buyerSecret: ${buyerSecret}`)\n return false\n }\n return true\n }\n}\n\n/**\n * Returns a function that validates the escrow terms for the existence of the buyerSecret signed by the buyer\n * @param dictionary Payload dictionary of the escrow terms\n * @returns A function that validates the escrow terms for the existence of the buyerSecret signed by the buyer\n */\nexport const getBuyerSecretSignedValidator = (dictionary: Record<Hash, WithMeta<Payload>>): PayloadValidationFunction<EscrowTerms> => {\n return async (terms: EscrowTerms) => {\n const buyer = assertEx(terms.buyer, () => `${name}: No buyer: ${terms.buyer}`)\n const buyerSecret = assertEx(terms.buyerSecret, () => `${name}: No buyerSecret: ${terms.buyerSecret}`)\n // Buyer-signed buyer secrets\n const buyerSecretBWs = Object.values(dictionary)\n // Find all BoundWitnesses\n .filter(isBoundWitnessWithMeta)\n // That contain the buyer secret\n .filter(bw => bw.payload_hashes.includes(buyerSecret))\n // That are signed by all the buyers\n .filter(bw => buyer.every(buyerAddress => bw.addresses.includes(buyerAddress)))\n\n // If there are no buyerSecret BWs, return false\n if (buyerSecretBWs.length === 0) {\n console.log(`${name}: No BoundWitnesses supplied for buyerSecret: ${buyerSecret}`)\n return false\n }\n\n // Ensure each BW supplied for the buyerSecret is valid\n const errors = await Promise.all(buyerSecretBWs.map(bw => new BoundWitnessValidator(bw).validate()))\n const validBoundWitnesses = errors.every(errors => errors.length === 0)\n if (!validBoundWitnesses) {\n console.log(`${name}: Invalid BoundWitnesses supplied for buyerSecret: ${buyerSecret}`)\n return false\n }\n return true\n }\n}\n","import type { PayloadValidationFunction } from '@xyo-network/payload-model'\n\nimport type { EscrowTerms } from '../../Terms.ts'\n\nexport const getNbfExpValidator = (now: number, minRequiredDuration: number): PayloadValidationFunction<EscrowTerms> => {\n const minExp = now + minRequiredDuration\n return (terms: EscrowTerms) => {\n const { exp, nbf } = terms\n if (nbf === undefined || nbf < now) {\n console.log(`EscrowTerms.nbf: invalid nbf ${terms.nbf}`)\n return false\n }\n if (exp === undefined || exp < minExp || nbf > exp) {\n console.log(`EscrowTerms.exp: invalid exp ${terms.exp}`)\n return false\n }\n return true\n }\n}\n","import type { ModuleIdentifier } from '@xyo-network/module-model'\nimport type { PayloadValidationFunction } from '@xyo-network/payload-model'\n\nimport type { EscrowTerms } from '../../Terms.ts'\nimport { moduleIdentifiersContainsAllOf } from '../common/index.ts'\n\nconst name = 'EscrowTerms.paymentAuthorities'\n\nexport const getPaymentAuthoritiesAllowedValidator = (allowed: ModuleIdentifier[]): PayloadValidationFunction<EscrowTerms> => {\n return (terms: EscrowTerms) => {\n const result = moduleIdentifiersContainsAllOf(terms, t => t.paymentAuthorities, allowed, true)\n if (!result) {\n console.log(`${name}: Payment authority not allowed: ${terms.paymentAuthorities}`)\n }\n return result\n }\n}\n","import { asAddress } from '@xylabs/hex'\nimport type { PayloadValidationFunction } from '@xyo-network/payload-model'\n\nimport type { EscrowTerms } from '../../Terms.ts'\n\nconst name = 'EscrowTerms.seller'\n\n/**\n * A function that validates the escrow terms for seller\n * @returns True if the escrow terms contain seller, false otherwise\n */\nexport const sellerExistsValidator: PayloadValidationFunction<EscrowTerms> = (terms: EscrowTerms) => {\n // Validate we have seller\n const seller = terms.seller\n if (!seller || seller.length === 0) {\n console.log(`${name}: No seller: ${terms.seller}`)\n return false\n }\n // Validate the authorities are addresses\n if (seller.map(x => asAddress(x)).length !== seller.length) {\n console.log(`${name}: Invalid address: ${terms.seller}`)\n return false\n }\n return true\n}\n","import { assertEx } from '@xylabs/assert'\nimport type { Hash } from '@xylabs/hex'\nimport { isBoundWitnessWithMeta } from '@xyo-network/boundwitness-model'\nimport { BoundWitnessValidator } from '@xyo-network/boundwitness-validator'\nimport type {\n Payload, PayloadValidationFunction, WithMeta,\n} from '@xyo-network/payload-model'\n\nimport type { EscrowTerms } from '../../Terms.ts'\n\nconst name = 'EscrowTerms.sellerSecret'\n\n/**\n * Returns a function that validates the escrow terms for sellerSecret\n * @returns A function that validates the escrow terms for sellerSecret\n */\nexport const sellerSecretExistsValidator: PayloadValidationFunction<EscrowTerms> = (terms: EscrowTerms) => {\n // Validate we have sellerSecret\n const sellerSecret = terms.sellerSecret\n if (!sellerSecret || sellerSecret.length === 0) {\n console.log(`${name}: No sellerSecret: ${terms.sellerSecret}`)\n return false\n }\n return true\n}\n\n/**\n * Returns a function that validates the escrow terms for the existence of the sellerSecret in the dictionary\n * @param dictionary Payload dictionary of the escrow terms\n * @returns A function that validates the escrow terms for the existence of the sellerSecret in the dictionary\n */\nexport const getSellerSecretSuppliedValidator = (dictionary: Record<Hash, WithMeta<Payload>>): PayloadValidationFunction<EscrowTerms> => {\n return (terms: EscrowTerms) => {\n const sellerSecret = assertEx(terms.sellerSecret, () => `${name}: No sellerSecret: ${terms.sellerSecret}`)\n if (!dictionary[sellerSecret]) {\n console.log(`${name}: Payload not supplied for sellerSecret: ${sellerSecret}`)\n return false\n }\n return true\n }\n}\n\n/**\n * Returns a function that validates the escrow terms for the existence of the sellerSecret signed by the seller\n * @param dictionary Payload dictionary of the escrow terms\n * @returns A function that validates the escrow terms for the existence of the sellerSecret signed by the seller\n */\nexport const getSellerSecretSignedValidator = (dictionary: Record<Hash, WithMeta<Payload>>): PayloadValidationFunction<EscrowTerms> => {\n return async (terms: EscrowTerms) => {\n const seller = assertEx(terms.seller, () => `${name}: No seller: ${terms.seller}`)\n const sellerSecret = assertEx(terms.sellerSecret, () => `${name}: No sellerSecret: ${terms.sellerSecret}`)\n // Seller-signed seller secrets\n const sellerSecretBWs = Object.values(dictionary)\n // Find all BoundWitnesses\n .filter(isBoundWitnessWithMeta)\n // That contain the seller secret\n .filter(bw => bw.payload_hashes.includes(sellerSecret))\n // That are signed by all the sellers\n .filter(bw => seller.every(sellerAddress => bw.addresses.includes(sellerAddress)))\n\n // If there are no sellerSecret BWs, return false\n if (sellerSecretBWs.length === 0) {\n console.log(`${name}: No BoundWitnesses supplied for sellerSecret: ${sellerSecret}`)\n return false\n }\n\n // Ensure each BW supplied for the sellerSecret is valid\n const errors = await Promise.all(sellerSecretBWs.map(bw => new BoundWitnessValidator(bw).validate()))\n const validBoundWitnesses = errors.every(errors => errors.length === 0)\n if (!validBoundWitnesses) {\n console.log(`${name}: Invalid BoundWitnesses supplied for sellerSecret: ${sellerSecret}`)\n return false\n }\n return true\n }\n}\n","import type { Payload } from '@xyo-network/payload-model'\nimport {\n isPayloadOfSchemaType, isPayloadOfSchemaTypeWithMeta, isPayloadOfSchemaTypeWithSources,\n} from '@xyo-network/payload-model'\n\nimport { PaymentCardSchema } from './Schema.ts'\n\n/**\n * The fields describing a payment card.\n */\nexport interface PaymentCardFields {\n /**\n * Card Number (PAN) of the payment card. This value is required to perform a payment.\n */\n cardNumber: string\n /**\n * The name as it appears on the payment card.\n */\n cardholderName?: string\n /**\n * Card Verification Value (CVV/CVC) of the payment card.\n */\n cvv: string\n /**\n * Expiration month of the payment card.\n */\n expMonth: number\n /**\n * Expiration year of the payment card.\n */\n expYear: number\n}\n\n/**\n * A PaymentCard Payload\n */\nexport type PaymentCard = Payload<PaymentCardFields, PaymentCardSchema>\n\n/**\n * Identity function for determine if an object is a PaymentCard\n */\nexport const isPaymentCard = isPayloadOfSchemaType<PaymentCard>(PaymentCardSchema)\n\n/**\n * Identity function for determine if an object is a PaymentCard with sources\n */\nexport const isPaymentCardWithSources = isPayloadOfSchemaTypeWithSources<PaymentCard>(PaymentCardSchema)\n\n/**\n * Identity function for determine if an object is a PaymentCard with meta\n */\nexport const isPaymentCardWithMeta = isPayloadOfSchemaTypeWithMeta<PaymentCard>(PaymentCardSchema)\n","import { PaymentsSchema } from '../Schema.ts'\n\nexport const PaymentSchema = `${PaymentsSchema}.payment`\nexport type PaymentSchema = typeof PaymentSchema\n","import { PaymentSchema } from '../Schema.ts'\n\nexport const PaymentInstrumentSchema = `${PaymentSchema}.instrument`\nexport type PaymentInstrumentSchema = typeof PaymentInstrumentSchema\n","import { PaymentInstrumentSchema } from '../Schema.ts'\n\nexport const PaymentCardSchema = `${PaymentInstrumentSchema}.card`\nexport type PaymentCardSchema = typeof PaymentCardSchema\n","import type { PayloadWithSources } from '@xyo-network/payload-model'\nimport {\n isPayloadOfSchemaType,\n isPayloadOfSchemaTypeWithMeta,\n isPayloadOfSchemaTypeWithSources,\n} from '@xyo-network/payload-model'\n\nimport type { SupportedCurrency } from '../Currency.ts'\nimport { PaymentSchema } from './Schema.ts'\n\nexport interface PaymentFields {\n /**\n * The amount paid\n */\n amount: number\n /**\n * The currency of the amount paid\n */\n currency: SupportedCurrency\n}\n\n/**\n * A payment is a record of an amount to be paid\n */\nexport type Payment = PayloadWithSources<PaymentFields, PaymentSchema>\n\n/**\n * Identity function for determine if an object is a Payment\n */\nexport const isPayment = isPayloadOfSchemaType<Payment>(PaymentSchema)\n\n/**\n * Identity function for determine if an object is a Payment with sources\n */\nexport const isPaymentWithSources = isPayloadOfSchemaTypeWithSources<Payment>(PaymentSchema)\n\n/**\n * Identity function for determine if an object is a Payment with meta\n */\nexport const isPaymentWithMeta = isPayloadOfSchemaTypeWithMeta<Payment>(PaymentSchema)\n","import type { PayloadWithSources } from '@xyo-network/payload-model'\nimport {\n isPayloadOfSchemaType,\n isPayloadOfSchemaTypeWithMeta,\n isPayloadOfSchemaTypeWithSources,\n} from '@xyo-network/payload-model'\n\nimport { PaymentStatusSchema } from './Schema.ts'\n\nexport interface PaymentStatusFields {\n /**\n * The result of the payment (i.e. declined)\n */\n result?: string\n\n /**\n * The status of the payment (i.e. completed)\n */\n status: string\n}\n\n/**\n * A payment status is the outcome of a payment attempt\n */\nexport type PaymentStatus = PayloadWithSources<PaymentStatusFields, PaymentStatusSchema>\n\n/**\n * Identity function for determine if an object is a PaymentStatus\n */\nexport const isPaymentStatus = isPayloadOfSchemaType<PaymentStatus>(PaymentStatusSchema)\n\n/**\n * Identity function for determine if an object is a PaymentStatus with sources\n */\nexport const isPaymentStatusWithSources = isPayloadOfSchemaTypeWithSources<PaymentStatus>(PaymentStatusSchema)\n\n/**\n * Identity function for determine if an object is a PaymentStatus with meta\n */\nexport const isPaymentStatusWithMeta = isPayloadOfSchemaTypeWithMeta<PaymentStatus>(PaymentStatusSchema)\n","import { PaymentSchema } from '../Schema.ts'\n\nexport const PaymentStatusSchema = `${PaymentSchema}.status`\nexport type PaymentStatusSchema = typeof PaymentStatusSchema\n","import type { Hash } from '@xylabs/hex'\nimport type { PayloadWithSources } from '@xyo-network/payload-model'\nimport {\n isPayloadOfSchemaType,\n isPayloadOfSchemaTypeWithMeta,\n isPayloadOfSchemaTypeWithSources,\n} from '@xyo-network/payload-model'\n\nimport { PurchaseSchema } from './Schema.ts'\n\nexport interface PurchaseFields {\n /**\n * The things that were purchased\n */\n assets: Hash[]\n /**\n * The receipts for payments for this purchase. Array to allow for multiple payments\n * for a single quote.\n */\n receipts: Hash[]\n}\n\n/**\n * A purchase ties a payment made to a quote\n */\nexport type Purchase = PayloadWithSources<PurchaseFields, PurchaseSchema>\n\n/**\n * Identity function for determine if an object is a Purchase\n */\nexport const isPurchase = isPayloadOfSchemaType<Purchase>(PurchaseSchema)\n\n/**\n * Identity function for determine if an object is a Purchase with sources\n */\nexport const isPurchaseWithSources = isPayloadOfSchemaTypeWithSources<Purchase>(PurchaseSchema)\n\n/**\n * Identity function for determine if an object is a Purchase with meta\n */\nexport const isPurchaseWithMeta = isPayloadOfSchemaTypeWithMeta<Purchase>(PurchaseSchema)\n","import { PaymentsSchema } from '../Schema.ts'\n\nexport const PurchaseSchema = `${PaymentsSchema}.purchase`\nexport type PurchaseSchema = typeof PurchaseSchema\n","import type { PayloadWithSources } from '@xyo-network/payload-model'\nimport {\n isPayloadOfSchemaType,\n isPayloadOfSchemaTypeWithMeta,\n isPayloadOfSchemaTypeWithSources,\n} from '@xyo-network/payload-model'\n\nimport type { SupportedCurrency } from '../Currency.ts'\nimport { ReceiptSchema } from './Schema.ts'\n\nexport interface ReceiptFields {\n /**\n * The amount paid\n */\n amount: number\n /**\n * The currency of the amount paid\n */\n currency: SupportedCurrency\n}\n\n/**\n * A receipt is a record of a payment made\n */\nexport type Receipt = PayloadWithSources<ReceiptFields, ReceiptSchema>\n\n/**\n * Identity function for determine if an object is a Receipt\n */\nexport const isReceipt = isPayloadOfSchemaType<Receipt>(ReceiptSchema)\n\n/**\n * Identity function for determine if an object is a Receipt with sources\n */\nexport const isReceiptWithSources = isPayloadOfSchemaTypeWithSources<Receipt>(ReceiptSchema)\n\n/**\n * Identity function for determine if an object is a Receipt with meta\n */\nexport const isReceiptWithMeta = isPayloadOfSchemaTypeWithMeta<Receipt>(ReceiptSchema)\n","import { PaymentsSchema } from '../Schema.ts'\n\nexport const ReceiptSchema = `${PaymentsSchema}.receipt`\nexport type ReceiptSchema = typeof ReceiptSchema\n","// import type { Hash } from '@xylabs/hex'\nimport type { DivinerConfig } from '@xyo-network/diviner-model'\n\nexport const PaymentSubtotalDivinerConfigSchema = 'network.xyo.diviner.payments.subtotal.config'\nexport type PaymentSubtotalDivinerConfigSchema = typeof PaymentSubtotalDivinerConfigSchema\n\n/**\n * The configuration for the Coupon Subtotal Diviner\n */\nexport type PaymentSubtotalDivinerConfig = DivinerConfig<\n {},\n PaymentSubtotalDivinerConfigSchema\n>\n","import type { PayloadWithSources } from '@xyo-network/payload-model'\nimport {\n isPayloadOfSchemaType,\n isPayloadOfSchemaTypeWithMeta,\n isPayloadOfSchemaTypeWithSources,\n} from '@xyo-network/payload-model'\n\nimport type { AmountFields } from '../../Amount/index.ts'\n\nexport const SubtotalSchema = 'network.xyo.payments.subtotal' as const\nexport type SubtotalSchema = typeof SubtotalSchema\n\nexport interface SubtotalFields extends AmountFields {}\n\n/**\n * The result of a subtotal\n */\nexport type Subtotal = PayloadWithSources<SubtotalFields, SubtotalSchema>\n\n/**\n * Identity function for determining if an object is an Subtotal\n */\nexport const isSubtotal = isPayloadOfSchemaType<Subtotal>(SubtotalSchema)\n\n/**\n * Identity function for determining if an object is an Subtotal with sources\n */\nexport const isSubtotalWithSources = isPayloadOfSchemaTypeWithSources<Subtotal>(SubtotalSchema)\n\n/**\n * Identity function for determining if an object is an Subtotal with meta\n */\nexport const isSubtotalWithMeta = isPayloadOfSchemaTypeWithMeta<Subtotal>(SubtotalSchema)\n","// import type { Hash } from '@xylabs/hex'\nimport type { DivinerConfig } from '@xyo-network/diviner-model'\nimport type { ModuleIdentifier } from '@xyo-network/module-model'\n\nexport const PaymentTotalDivinerConfigSchema = 'network.xyo.diviner.payments.total.config'\nexport type PaymentTotalDivinerConfigSchema = typeof PaymentTotalDivinerConfigSchema\n\n/**\n * The configuration for the Total Diviner\n */\nexport type PaymentTotalDivinerConfig = DivinerConfig<\n {\n /**\n * The Diviner that will be used to determine the discount\n */\n paymentDiscountDiviner?: ModuleIdentifier\n\n /**\n * The Diviner that will be used to determine the subtotal\n */\n paymentSubtotalDiviner?: ModuleIdentifier\n },\n PaymentTotalDivinerConfigSchema\n>\n","import type { PayloadWithSources } from '@xyo-network/payload-model'\nimport {\n isPayloadOfSchemaType,\n isPayloadOfSchemaTypeWithMeta,\n isPayloadOfSchemaTypeWithSources,\n} from '@xyo-network/payload-model'\n\nimport type { AmountFields } from '../../Amount/index.ts'\n\nexport const TotalSchema = 'network.xyo.payments.total' as const\nexport type TotalSchema = typeof TotalSchema\n\nexport interface TotalFields extends AmountFields {}\n\n/**\n * The result of a total\n */\nexport type Total = PayloadWithSources<TotalFields, TotalSchema>\n\n/**\n * Identity function for determining if an object is an Total\n */\nexport const isTotal = isPayloadOfSchemaType<Total>(TotalSchema)\n\n/**\n * Identity function for determining if an object is an Total with sources\n */\nexport const isTotalWithSources = isPayloadOfSchemaTypeWithSources<Total>(TotalSchema)\n\n/**\n * Identity function for determining if an object is an Total with meta\n */\nexport const isTotalWithMeta = isPayloadOfSchemaTypeWithMeta<Total>(TotalSchema)\n"],"mappings":";AAsXO,IAAM,uBAA4E;AAAA,EACvF,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AAA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AC;AAAA,EACA,oCAAAC;AAAA,OACK;AAIA,IAAM,cAAc;AAapB,IAAM,UAAUF,wBAA6B,WAAW;AAKxD,IAAM,qBAAqBE,mCAAwC,WAAW;AAK9E,IAAM,kBAAkBD,gCAAqC,WAAW;","names":["isPayloadOfSchemaType","isPayloadOfSchemaTypeWithMeta","isPayloadOfSchemaTypeWithSources","isPayloadOfSchemaType","isPayloadOfSchemaTypeWithSources","isPayloadOfSchemaTypeWithMeta","isPayloadOfSchemaType","isPayloadOfSchemaTypeWithMeta","isPayloadOfSchemaTypeWithSources","isPayloadOfSchemaType","isPayloadOfSchemaTypeWithSources","isPayloadOfSchemaTypeWithMeta","isPayloadOfSchemaType","isPayloadOfSchemaTypeWithMeta","isPayloadOfSchemaTypeWithSources","isPayloadOfSchemaType","isPayloadOfSchemaTypeWithSources","isPayloadOfSchemaTypeWithMeta","isPayloadOfSchemaType","isPayloadOfSchemaTypeWithMeta","isPayloadOfSchemaTypeWithSources","isPayloadOfSchemaType","isPayloadOfSchemaTypeWithSources","isPayloadOfSchemaTypeWithMeta","isPayloadOfSchemaType","isPayloadOfSchemaTypeWithMeta","isPayloadOfSchemaTypeWithSources","isPayloadOfSchemaType","isPayloadOfSchemaTypeWithMeta","isPayloadOfSchemaTypeWithSources","isPayloadOfSchemaType","isPayloadOfSchemaTypeWithSources","isPayloadOfSchemaTypeWithMeta","isPayloadOfSchemaType","isPayloadOfSchemaTypeWithMeta","isPayloadOfSchemaTypeWithSources","isPayloadOfSchemaType","isPayloadOfSchemaTypeWithSources","isPayloadOfSchemaTypeWithMeta","name","name","name","asAddress","name","assertEx","isBoundWitnessWithMeta","name","errors","name","asAddress","name","assertEx","isBoundWitnessWithMeta","BoundWitnessValidator","name","errors","isPayloadOfSchemaType","isPayloadOfSchemaTypeWithMeta","isPayloadOfSchemaTypeWithSources","isPayloadOfSchemaType","isPayloadOfSchemaTypeWithSources","isPayloadOfSchemaTypeWithMeta","isPayloadOfSchemaType","isPayloadOfSchemaTypeWithMeta","isPayloadOfSchemaTypeWithSources","isPayloadOfSchemaType","isPayloadOfSchemaTypeWithSources","isPayloadOfSchemaTypeWithMeta","isPayloadOfSchemaType","isPayloadOfSchemaTypeWithMeta","isPayloadOfSchemaTypeWithSources","isPayloadOfSchemaType","isPayloadOfSchemaTypeWithSources","isPayloadOfSchemaTypeWithMeta","isPayloadOfSchemaType","isPayloadOfSchemaTypeWithMeta","isPayloadOfSchemaTypeWithSources","isPayloadOfSchemaType","isPayloadOfSchemaTypeWithSources","isPayloadOfSchemaTypeWithMeta","isPayloadOfSchemaType","isPayloadOfSchemaTypeWithMeta","isPayloadOfSchemaTypeWithSources","isPayloadOfSchemaType","isPayloadOfSchemaTypeWithSources","isPayloadOfSchemaTypeWithMeta","isPayloadOfSchemaType","isPayloadOfSchemaTypeWithMeta","isPayloadOfSchemaTypeWithSources","isPayloadOfSchemaType","isPayloadOfSchemaTypeWithMeta","isPayloadOfSchemaTypeWithSources"]}
1
+ {"version":3,"sources":["../../src/Amount/Iso4217Currency.ts","../../src/Amount/Payload.ts","../../src/Billing/Address/Address.ts","../../src/Schema.ts","../../src/Billing/Schema.ts","../../src/Billing/Address/Schema.ts","../../src/Discount/Config.ts","../../src/Discount/Payload/Coupon/Conditions/AppraisalAmountCondition.ts","../../src/Discount/Payload/Coupon/Conditions/AssetQuantityCondition.ts","../../src/Discount/Payload/Coupon/Conditions/BuyerCondition.ts","../../src/Discount/Payload/Coupon/Coupons/FixedAmount.ts","../../src/Discount/Payload/Coupon/Schema.ts","../../src/Discount/Payload/Coupon/Coupons/FixedPercentage.ts","../../src/Discount/Payload/Coupon/Coupons/FixedPrice.ts","../../src/Discount/Payload/Coupon/Payload.ts","../../src/Discount/Payload/Coupon/types/Condition.ts","../../src/Discount/Payload/Coupon/types/isStackable.ts","../../src/Discount/Payload/Discount.ts","../../src/Discount/Payload/NoDiscount.ts","../../src/Escrow/createEscrowIntent.ts","../../src/Escrow/getEscrowSecret.ts","../../src/Escrow/Outcome.ts","../../src/Escrow/Schema.ts","../../src/Escrow/Terms.ts","../../src/Escrow/validators/common/ModuleInstanceValidators/moduleInstanceValidators.ts","../../src/Escrow/validators/common/TemporalValidators/validateWithinWindow.ts","../../src/Escrow/validators/escrow/agent.ts","../../src/Escrow/validators/escrow/appraisal.ts","../../src/Escrow/validators/escrow/appraisalAuthorities.ts","../../src/Escrow/validators/escrow/assets.ts","../../src/Escrow/validators/escrow/buyer.ts","../../src/Escrow/validators/escrow/buyerSecret.ts","../../src/Escrow/validators/escrow/nbfExp.ts","../../src/Escrow/validators/escrow/paymentAuthorities.ts","../../src/Escrow/validators/escrow/seller.ts","../../src/Escrow/validators/escrow/sellerSecret.ts","../../src/Payment/Instrument/Card/Payload.ts","../../src/Payment/Schema.ts","../../src/Payment/Instrument/Schema.ts","../../src/Payment/Instrument/Card/Schema.ts","../../src/Payment/Payload.ts","../../src/Payment/Status/Payload.ts","../../src/Payment/Status/Schema.ts","../../src/Purchase/Payload.ts","../../src/Purchase/Schema.ts","../../src/Receipt/Payload.ts","../../src/Receipt/Schema.ts","../../src/Subtotal/Diviner/Config.ts","../../src/Subtotal/Diviner/Payload.ts","../../src/Total/Diviner/Config.ts","../../src/Total/Diviner/Payload.ts"],"sourcesContent":["/* eslint-disable max-lines */\n/**\n * ISO 4217 currency codes\n */\nexport type Iso4217AlphabeticalCode =\n 'AED' |\n 'AFN' |\n 'ALL' |\n 'AMD' |\n 'ANG' |\n 'AOA' |\n 'ARS' |\n 'AUD' |\n 'AWG' |\n 'AZN' |\n 'BAM' |\n 'BBD' |\n 'BDT' |\n 'BGN' |\n 'BHD' |\n 'BIF' |\n 'BMD' |\n 'BND' |\n 'BOB' |\n 'BOV' |\n 'BRL' |\n 'BSD' |\n 'BTN' |\n 'BWP' |\n 'BYN' |\n 'BZD' |\n 'CAD' |\n 'CDF' |\n 'CHE' |\n 'CHF' |\n 'CHW' |\n 'CLF' |\n 'CLP' |\n 'CNY' |\n 'COP' |\n 'COU' |\n 'CRC' |\n 'CUP' |\n 'CVE' |\n 'CZK' |\n 'DJF' |\n 'DKK' |\n 'DOP' |\n 'DZD' |\n 'EGP' |\n 'ERN' |\n 'ETB' |\n 'EUR' |\n 'FJD' |\n 'FKP' |\n 'GBP' |\n 'GEL' |\n 'GHS' |\n 'GIP' |\n 'GMD' |\n 'GNF' |\n 'GTQ' |\n 'GYD' |\n 'HKD' |\n 'HNL' |\n 'HTG' |\n 'HUF' |\n 'IDR' |\n 'ILS' |\n 'INR' |\n 'IQD' |\n 'IRR' |\n 'ISK' |\n 'JMD' |\n 'JOD' |\n 'JPY' |\n 'KES' |\n 'KGS' |\n 'KHR' |\n 'KMF' |\n 'KPW' |\n 'KRW' |\n 'KWD' |\n 'KYD' |\n 'KZT' |\n 'LAK' |\n 'LBP' |\n 'LKR' |\n 'LRD' |\n 'LSL' |\n 'LYD' |\n 'MAD' |\n 'MDL' |\n 'MGA' |\n 'MKD' |\n 'MMK' |\n 'MNT' |\n 'MOP' |\n 'MRU' |\n 'MUR' |\n 'MVR' |\n 'MWK' |\n 'MXN' |\n 'MXV' |\n 'MYR' |\n 'MZN' |\n 'NAD' |\n 'NGN' |\n 'NIO' |\n 'NOK' |\n 'NPR' |\n 'NZD' |\n 'OMR' |\n 'PAB' |\n 'PEN' |\n 'PGK' |\n 'PHP' |\n 'PKR' |\n 'PLN' |\n 'PYG' |\n 'QAR' |\n 'RON' |\n 'RSD' |\n 'RUB' |\n 'RWF' |\n 'SAR' |\n 'SBD' |\n 'SCR' |\n 'SDG' |\n 'SEK' |\n 'SGD' |\n 'SHP' |\n 'SLE' |\n 'SOS' |\n 'SRD' |\n 'SSP' |\n 'STN' |\n 'SVC' |\n 'SYP' |\n 'SZL' |\n 'THB' |\n 'TJS' |\n 'TMT' |\n 'TND' |\n 'TOP' |\n 'TRY' |\n 'TTD' |\n 'TWD' |\n 'TZS' |\n 'UAH' |\n 'UGX' |\n 'USD' |\n 'USN' |\n 'UYI' |\n 'UYU' |\n 'UYW' |\n 'UZS' |\n 'VED' |\n 'VES' |\n 'VND' |\n 'VUV' |\n 'WST' |\n 'XAF' |\n 'XAG' |\n 'XAU' |\n 'XBA' |\n 'XBB' |\n 'XBC' |\n 'XBD' |\n 'XCD' |\n 'XDR' |\n 'XOF' |\n 'XPD' |\n 'XPF' |\n 'XPT' |\n 'XSU' |\n 'XTS' |\n 'XUA' |\n 'XXX' |\n 'YER' |\n 'ZAR' |\n 'ZMW' |\n 'ZWG' |\n 'ZWL'\n\n// TODO: Technically, the values should be 3 digit numbers with leading\n// zeros, so we can padStart if we need to be strict\n/**\n * ISO 4217 numeric currency number codes\n */\nexport type Iso4217NumericCode =\n 784 |\n 971 |\n 8 |\n 51 |\n 532 |\n 973 |\n 32 |\n 36 |\n 533 |\n 944 |\n 977 |\n 52 |\n 50 |\n 975 |\n 48 |\n 108 |\n 60 |\n 96 |\n 68 |\n 984 |\n 986 |\n 44 |\n 64 |\n 72 |\n 933 |\n 84 |\n 124 |\n 976 |\n 947 |\n 756 |\n 948 |\n 990 |\n 152 |\n 156 |\n 170 |\n 970 |\n 188 |\n 192 |\n 132 |\n 203 |\n 262 |\n 208 |\n 214 |\n 12 |\n 818 |\n 232 |\n 230 |\n 978 |\n 242 |\n 238 |\n 826 |\n 981 |\n 936 |\n 292 |\n 270 |\n 324 |\n 320 |\n 328 |\n 344 |\n 340 |\n 332 |\n 348 |\n 360 |\n 376 |\n 356 |\n 368 |\n 364 |\n 352 |\n 388 |\n 400 |\n 392 |\n 404 |\n 417 |\n 116 |\n 174 |\n 408 |\n 410 |\n 414 |\n 136 |\n 398 |\n 418 |\n 422 |\n 144 |\n 430 |\n 426 |\n 434 |\n 504 |\n 498 |\n 969 |\n 807 |\n 104 |\n 496 |\n 446 |\n 929 |\n 480 |\n 462 |\n 454 |\n 484 |\n 979 |\n 458 |\n 943 |\n 516 |\n 566 |\n 558 |\n 578 |\n 524 |\n 554 |\n 512 |\n 590 |\n 604 |\n 598 |\n 608 |\n 586 |\n 985 |\n 600 |\n 634 |\n 946 |\n 941 |\n 643 |\n 646 |\n 682 |\n 90 |\n 690 |\n 938 |\n 752 |\n 702 |\n 654 |\n 925 |\n 706 |\n 968 |\n 728 |\n 930 |\n 222 |\n 760 |\n 748 |\n 764 |\n 972 |\n 934 |\n 788 |\n 776 |\n 949 |\n 780 |\n 901 |\n 834 |\n 980 |\n 800 |\n 840 |\n 997 |\n 940 |\n 858 |\n 927 |\n 860 |\n 926 |\n 928 |\n 704 |\n 548 |\n 882 |\n 950 |\n 961 |\n 959 |\n 955 |\n 956 |\n 957 |\n 958 |\n 951 |\n 960 |\n 952 |\n 964 |\n 953 |\n 962 |\n 994 |\n 963 |\n 965 |\n 999 |\n 886 |\n 710 |\n 967 |\n 924 |\n 932\n\n/**\n * Dictionary of ISO 4217 alphabetical currency codes to numeric currency number codes\n */\nexport const Iso4217CurrencyCodes: Record<Iso4217AlphabeticalCode, Iso4217NumericCode> = {\n AED: 784,\n AFN: 971,\n ALL: 8,\n AMD: 51,\n ANG: 532,\n AOA: 973,\n ARS: 32,\n AUD: 36,\n AWG: 533,\n AZN: 944,\n BAM: 977,\n BBD: 52,\n BDT: 50,\n BGN: 975,\n BHD: 48,\n BIF: 108,\n BMD: 60,\n BND: 96,\n BOB: 68,\n BOV: 984,\n BRL: 986,\n BSD: 44,\n BTN: 64,\n BWP: 72,\n BYN: 933,\n BZD: 84,\n CAD: 124,\n CDF: 976,\n CHE: 947,\n CHF: 756,\n CHW: 948,\n CLF: 990,\n CLP: 152,\n CNY: 156,\n COP: 170,\n COU: 970,\n CRC: 188,\n CUP: 192,\n CVE: 132,\n CZK: 203,\n DJF: 262,\n DKK: 208,\n DOP: 214,\n DZD: 12,\n EGP: 818,\n ERN: 232,\n ETB: 230,\n EUR: 978,\n FJD: 242,\n FKP: 238,\n GBP: 826,\n GEL: 981,\n GHS: 936,\n GIP: 292,\n GMD: 270,\n GNF: 324,\n GTQ: 320,\n GYD: 328,\n HKD: 344,\n HNL: 340,\n HTG: 332,\n HUF: 348,\n IDR: 360,\n ILS: 376,\n INR: 356,\n IQD: 368,\n IRR: 364,\n ISK: 352,\n JMD: 388,\n JOD: 400,\n JPY: 392,\n KES: 404,\n KGS: 417,\n KHR: 116,\n KMF: 174,\n KPW: 408,\n KRW: 410,\n KWD: 414,\n KYD: 136,\n KZT: 398,\n LAK: 418,\n LBP: 422,\n LKR: 144,\n LRD: 430,\n LSL: 426,\n LYD: 434,\n MAD: 504,\n MDL: 498,\n MGA: 969,\n MKD: 807,\n MMK: 104,\n MNT: 496,\n MOP: 446,\n MRU: 929,\n MUR: 480,\n MVR: 462,\n MWK: 454,\n MXN: 484,\n MXV: 979,\n MYR: 458,\n MZN: 943,\n NAD: 516,\n NGN: 566,\n NIO: 558,\n NOK: 578,\n NPR: 524,\n NZD: 554,\n OMR: 512,\n PAB: 590,\n PEN: 604,\n PGK: 598,\n PHP: 608,\n PKR: 586,\n PLN: 985,\n PYG: 600,\n QAR: 634,\n RON: 946,\n RSD: 941,\n RUB: 643,\n RWF: 646,\n SAR: 682,\n SBD: 90,\n SCR: 690,\n SDG: 938,\n SEK: 752,\n SGD: 702,\n SHP: 654,\n SLE: 925,\n SOS: 706,\n SRD: 968,\n SSP: 728,\n STN: 930,\n SVC: 222,\n SYP: 760,\n SZL: 748,\n THB: 764,\n TJS: 972,\n TMT: 934,\n TND: 788,\n TOP: 776,\n TRY: 949,\n TTD: 780,\n TWD: 901,\n TZS: 834,\n UAH: 980,\n UGX: 800,\n USD: 840,\n USN: 997,\n UYI: 940,\n UYU: 858,\n UYW: 927,\n UZS: 860,\n VED: 926,\n VES: 928,\n VND: 704,\n VUV: 548,\n WST: 882,\n XAF: 950,\n XAG: 961,\n XAU: 959,\n XBA: 955,\n XBB: 956,\n XBC: 957,\n XBD: 958,\n XCD: 951,\n XDR: 960,\n XOF: 952,\n XPD: 964,\n XPF: 953,\n XPT: 962,\n XSU: 994,\n XTS: 963,\n XUA: 965,\n XXX: 999,\n YER: 886,\n ZAR: 710,\n ZMW: 967,\n ZWG: 924,\n ZWL: 932,\n}\n\nexport const isIso4217CurrencyCode = (code: string): code is Iso4217AlphabeticalCode => Iso4217CurrencyCodes[code as Iso4217AlphabeticalCode] ? true : false\n","import type { PayloadWithSources } from '@xyo-network/payload-model'\nimport {\n isPayloadOfSchemaType,\n isPayloadOfSchemaTypeWithMeta,\n isPayloadOfSchemaTypeWithSources,\n} from '@xyo-network/payload-model'\n\nimport type { Iso4217AlphabeticalCode } from './Iso4217Currency.ts'\n\nexport const AmountSchema = 'network.xyo.payments.amount' as const\nexport type AmountSchema = typeof AmountSchema\n\nexport interface AmountFields {\n amount: number\n currency: Iso4217AlphabeticalCode\n}\n\n/**\n * The result of a amount\n */\nexport type Amount = PayloadWithSources<AmountFields, AmountSchema>\n\n/**\n * Identity function for determining if an object is an Amount\n */\nexport const isAmount = isPayloadOfSchemaType<Amount>(AmountSchema)\n\n/**\n * Identity function for determining if an object is an Amount with sources\n */\nexport const isAmountWithSources = isPayloadOfSchemaTypeWithSources<Amount>(AmountSchema)\n\n/**\n * Identity function for determining if an object is an Amount with meta\n */\nexport const isAmountWithMeta = isPayloadOfSchemaTypeWithMeta<Amount>(AmountSchema)\n","import type { Payload } from '@xyo-network/payload-model'\nimport {\n isPayloadOfSchemaType, isPayloadOfSchemaTypeWithMeta, isPayloadOfSchemaTypeWithSources,\n} from '@xyo-network/payload-model'\n\nimport { BillingAddressSchema } from './Schema.ts'\n\n/**\n * The fields describing a billing address.\n */\nexport interface BillingAddressFields {\n /** Street address line 1. */\n address?: string\n /** Street address line 2. */\n address2?: string | null\n /** City of the billing address. */\n city?: string\n /** Country code of the billing address, ISO 3166-1 alpha-2 code. */\n country?: string\n /** First name */\n firstName: string\n /** Last name */\n lastName: string\n /** Organization or company name associated with the billing address. */\n organization?: string | null\n /** Postal or ZIP code of the billing address. */\n postalCode?: string\n /** State or region of the billing address. */\n region?: string\n}\n\n/**\n * A BillingAddress Payload\n */\nexport type BillingAddress = Payload<BillingAddressFields, BillingAddressSchema>\n\n/**\n * Identity function for determine if an object is a BillingAddress\n */\nexport const isBillingAddress = isPayloadOfSchemaType<BillingAddress>(BillingAddressSchema)\n\n/**\n * Identity function for determine if an object is a BillingAddress with sources\n */\nexport const isBillingAddressWithSources = isPayloadOfSchemaTypeWithSources<BillingAddress>(BillingAddressSchema)\n\n/**\n * Identity function for determine if an object is a BillingAddress with meta\n */\nexport const isBillingAddressWithMeta = isPayloadOfSchemaTypeWithMeta<BillingAddress>(BillingAddressSchema)\n","export const PaymentsSchema = 'network.xyo.payments'\nexport type PaymentsSchema = typeof PaymentsSchema\n","import { PaymentsSchema } from '../Schema.ts'\n\nexport const BillingSchema = `${PaymentsSchema}.billing`\nexport type BillingSchema = typeof BillingSchema\n","import { BillingSchema } from '../Schema.ts'\n\nexport const BillingAddressSchema = `${BillingSchema}.address`\nexport type BillingAddressSchema = typeof BillingAddressSchema\n","// import type { Hash } from '@xylabs/hex'\nimport type { Address } from '@xylabs/hex'\nimport type { DivinerConfig } from '@xyo-network/diviner-model'\nimport type { ModuleIdentifier } from '@xyo-network/module-model'\n\nexport const PaymentDiscountDivinerConfigSchema = 'network.xyo.diviner.payments.discount.config'\nexport type PaymentDiscountDivinerConfigSchema = typeof PaymentDiscountDivinerConfigSchema\n\n/**\n * The configuration for the Payment Discount Diviner\n */\nexport type PaymentDiscountDivinerConfig = DivinerConfig<\n {\n /**\n * The boundwitness diviner used to query for payloads\n */\n boundWitnessDiviner?: ModuleIdentifier\n /**\n * The list of coupon authorities that can be used to get a discount\n */\n couponAuthorities?: Address[]\n\n // /**\n // * The list of coupons that are supported by this diviner\n // */\n // supportedCoupons?: Hash[]\n\n /**\n * The Diviner that can be used to determine the subtotal to apply discounts to\n */\n paymentSubtotalDiviner?: ModuleIdentifier\n },\n PaymentDiscountDivinerConfigSchema\n>\n","/* eslint-disable unicorn/no-thenable */\nimport { SchemaSchema } from '@xyo-network/schema-payload-plugin'\n\nimport type { Condition } from '../types/index.ts'\n\n/**\n * Creates a coupon condition that requires an appraisal amount below a certain value\n * @param maximumAppraisalAmount The maximum appraisal amount\n * @returns A condition that requires an appraisal amount below a certain value\n */\nexport const createConditionForMaximumAppraisalAmount = (maximumAppraisalAmount: number): Condition => {\n return {\n schema: SchemaSchema,\n definition: {\n allOf: [\n {\n type: 'array',\n contains: {\n type: 'object',\n properties: {\n schema: { type: 'string', const: 'network.xyo.escrow.terms' },\n appraisals: { type: 'array', minItems: 1 },\n },\n required: ['schema', 'appraisals'],\n },\n },\n {\n type: 'array',\n contains: {\n type: 'object',\n properties: { schema: { type: 'string', const: 'network.xyo.hash.lease.estimate' } },\n required: ['schema'],\n },\n items: {\n type: 'object',\n if: { properties: { schema: { type: 'string', const: 'network.xyo.hash.lease.estimate' } } },\n then: { properties: { price: { type: 'number', maximum: maximumAppraisalAmount } }, required: ['price'] },\n },\n },\n ],\n },\n }\n}\n","import { SchemaSchema } from '@xyo-network/schema-payload-plugin'\n\nimport type { Condition } from '../types/index.ts'\n\n/**\n * Returns a coupon condition that requires a minimum quantity of assets\n * @param minimumAssetQuantity The minimum quantity of assets required\n * @returns A condition that requires a minimum quantity of assets\n */\nexport const createConditionForMinimumAssetQuantity = (minimumAssetQuantity: number): Condition => {\n return {\n schema: SchemaSchema,\n definition: {\n type: 'array',\n contains: {\n type: 'object',\n properties: {\n schema: { type: 'string', const: 'network.xyo.escrow.terms' },\n assets: { type: 'array', minItems: minimumAssetQuantity },\n },\n required: ['schema', 'assets'],\n },\n },\n }\n}\n","import type { Address } from '@xylabs/hex'\nimport { SchemaSchema } from '@xyo-network/schema-payload-plugin'\n\nimport type { Condition } from '../types/index.ts'\n\nexport type BuyerCondition = Condition & {\n definition: {\n contains: {\n properties: {\n buyer: {\n items: {\n const: Address\n type: 'string'\n }\n minItems: 1\n type: 'array'\n }\n schema: { const: 'network.xyo.escrow.terms'; type: 'string' }\n }\n required: ['schema', 'buyer']\n type: 'object'\n }\n type: 'array'\n }\n schema: SchemaSchema\n}\n\n/**\n * Creates a coupon condition that requires a specific buyer\n * @param buyer The buyer's address\n * @returns A coupon condition that requires a specific buyer\n */\nexport const createConditionForRequiredBuyer = (buyer: Address): BuyerCondition => {\n return {\n schema: SchemaSchema,\n definition: {\n type: 'array',\n contains: {\n type: 'object',\n properties: {\n schema: { type: 'string', const: 'network.xyo.escrow.terms' },\n buyer: {\n type: 'array', items: { type: 'string', const: buyer }, minItems: 1,\n },\n },\n required: ['schema', 'buyer'],\n },\n },\n }\n}\n","import type { PayloadWithSources } from '@xyo-network/payload-model'\nimport {\n isPayloadOfSchemaType,\n isPayloadOfSchemaTypeWithMeta,\n isPayloadOfSchemaTypeWithSources,\n} from '@xyo-network/payload-model'\n\nimport type { AmountFields } from '../../../../Amount/index.ts'\nimport { CouponSchema } from '../Schema.ts'\nimport type { CouponFields } from '../types/index.ts'\n\nexport const FixedAmountCouponSchema = `${CouponSchema}.fixed.amount` as const\nexport type FixedAmountCouponSchema = typeof FixedAmountCouponSchema\n\nexport interface FixedAmountCouponFields extends CouponFields, AmountFields {}\n\n/**\n * A coupon that provides a fixed discount amount\n */\nexport type FixedAmountCoupon = PayloadWithSources<FixedAmountCouponFields, FixedAmountCouponSchema>\n\n/**\n * Identity function for determining if an object is an FixedAmountCoupon\n */\nexport const isFixedAmountCoupon = isPayloadOfSchemaType<FixedAmountCoupon>(FixedAmountCouponSchema)\n\n/**\n * Identity function for determining if an object is an FixedAmountCoupon with sources\n */\nexport const isFixedAmountCouponWithSources = isPayloadOfSchemaTypeWithSources<FixedAmountCoupon>(FixedAmountCouponSchema)\n\n/**\n * Identity function for determining if an object is an FixedAmountCoupon with meta\n */\nexport const isFixedAmountCouponWithMeta = isPayloadOfSchemaTypeWithMeta<FixedAmountCoupon>(FixedAmountCouponSchema)\n","export const CouponSchema = 'network.xyo.payments.coupon' as const\nexport type CouponSchema = typeof CouponSchema\n","import type { PayloadWithSources } from '@xyo-network/payload-model'\nimport {\n isPayloadOfSchemaType,\n isPayloadOfSchemaTypeWithMeta,\n isPayloadOfSchemaTypeWithSources,\n} from '@xyo-network/payload-model'\n\nimport { CouponSchema } from '../Schema.ts'\nimport type { CouponFields } from '../types/index.ts'\n\nexport const FixedPercentageCouponSchema = `${CouponSchema}.fixed.percentage` as const\nexport type FixedPercentageCouponSchema = typeof FixedPercentageCouponSchema\n\nexport interface FixedPercentageCouponFields extends CouponFields {\n percentage: number\n}\n\n/**\n * A coupon that provides a fixed discount amount\n */\nexport type FixedPercentageCoupon = PayloadWithSources<FixedPercentageCouponFields, FixedPercentageCouponSchema>\n\n/**\n * Identity function for determining if an object is an FixedPercentageCoupon\n */\nexport const isFixedPercentageCoupon = isPayloadOfSchemaType<FixedPercentageCoupon>(FixedPercentageCouponSchema)\n\n/**\n * Identity function for determining if an object is an FixedPercentageCoupon with sources\n */\nexport const isFixedPercentageCouponWithSources = isPayloadOfSchemaTypeWithSources<FixedPercentageCoupon>(FixedPercentageCouponSchema)\n\n/**\n * Identity function for determining if an object is an FixedPercentageCoupon with meta\n */\nexport const isFixedPercentageCouponWithMeta = isPayloadOfSchemaTypeWithMeta<FixedPercentageCoupon>(FixedPercentageCouponSchema)\n","import type { PayloadWithSources } from '@xyo-network/payload-model'\nimport {\n isPayloadOfSchemaType,\n isPayloadOfSchemaTypeWithMeta,\n isPayloadOfSchemaTypeWithSources,\n} from '@xyo-network/payload-model'\n\nimport type { AmountFields } from '../../../../Amount/index.ts'\nimport { CouponSchema } from '../Schema.ts'\nimport type { CouponFields } from '../types/index.ts'\n\nexport const FixedPriceCouponSchema = `${CouponSchema}.fixed.price` as const\nexport type FixedPriceCouponSchema = typeof FixedPriceCouponSchema\n\nexport interface FixedPriceCouponFields extends CouponFields, AmountFields { }\n\n/**\n * A coupon that provides a fixed total price\n */\nexport type FixedPriceCoupon = PayloadWithSources<FixedPriceCouponFields, FixedPriceCouponSchema>\n\n/**\n * Identity function for determining if an object is an FixedPriceCoupon\n */\nexport const isFixedPriceCoupon = isPayloadOfSchemaType<FixedPriceCoupon>(FixedPriceCouponSchema)\n\n/**\n * Identity function for determining if an object is an FixedPriceCoupon with sources\n */\nexport const isFixedPriceCouponWithSources = isPayloadOfSchemaTypeWithSources<FixedPriceCoupon>(FixedPriceCouponSchema)\n\n/**\n * Identity function for determining if an object is an FixedPriceCoupon with meta\n */\nexport const isFixedPriceCouponWithMeta = isPayloadOfSchemaTypeWithMeta<FixedPriceCoupon>(FixedPriceCouponSchema)\n","import {\n type FixedAmountCoupon, type FixedPercentageCoupon, type FixedPriceCoupon,\n isFixedAmountCoupon, isFixedAmountCouponWithMeta, isFixedAmountCouponWithSources, isFixedPercentageCoupon,\n isFixedPercentageCouponWithMeta,\n isFixedPercentageCouponWithSources,\n isFixedPriceCoupon,\n isFixedPriceCouponWithSources,\n} from './Coupons/index.ts'\n\n/**\n * The type of coupons\n */\nexport type Coupon =\n FixedAmountCoupon\n | FixedPercentageCoupon\n | FixedPriceCoupon\n\n/**\n * Identity function for determining if an object is an Coupon\n */\nexport const isCoupon = (x?: unknown | null) =>\n isFixedAmountCoupon(x)\n || isFixedPercentageCoupon(x)\n || isFixedPriceCoupon(x)\n\n/**\n * Identity function for determining if an object is an Coupon with sources\n */\nexport const isCouponWithSources = (x?: unknown | null) =>\n isFixedAmountCouponWithSources(x)\n || isFixedPercentageCouponWithSources(x)\n || isFixedPriceCouponWithSources(x)\n\n/**\n * Identity function for determining if an object is an Coupon with meta\n */\nexport const isCouponWithMeta = (x?: unknown | null) =>\n isFixedAmountCouponWithMeta(x)\n || isFixedPercentageCouponWithMeta(x)\n","import {\n isPayloadOfSchemaType, isPayloadOfSchemaTypeWithMeta, isPayloadOfSchemaTypeWithSources, type WithMeta, type WithOptionalMeta,\n} from '@xyo-network/payload-model'\nimport { type SchemaPayload, SchemaSchema } from '@xyo-network/schema-payload-plugin'\n\n/**\n * The payloads that can be used as conditions for a coupon\n */\nexport type Condition = SchemaPayload | WithOptionalMeta<SchemaPayload> | WithMeta<SchemaPayload>\n\n/**\n * Identity function for determining if an object is a Condition payload\n */\nexport const isCondition = isPayloadOfSchemaType<Condition>(SchemaSchema)\n\n/**\n * Identity function for determining if an object is a Condition payload with sources\n */\nexport const isConditionWithSources = isPayloadOfSchemaTypeWithSources<Condition>(SchemaSchema)\n\n/**\n * Identity function for determining if an object is a Condition payload with meta\n */\nexport const isConditionWithMeta = isPayloadOfSchemaTypeWithMeta<Condition>(SchemaSchema)\n","import type { CouponFields } from './CouponFields.ts'\n\n/**\n * Identity function for determining if coupon is stackable\n */\nexport const isStackable = (x?: unknown | null) => (x as CouponFields ?? { stackable: false })?.stackable\n","import type { PayloadWithSources } from '@xyo-network/payload-model'\nimport {\n isPayloadOfSchemaType,\n isPayloadOfSchemaTypeWithMeta,\n isPayloadOfSchemaTypeWithSources,\n} from '@xyo-network/payload-model'\n\nimport type { AmountFields } from '../../Amount/index.ts'\n\nexport const DiscountSchema = 'network.xyo.payments.discount' as const\nexport type DiscountSchema = typeof DiscountSchema\n\nexport interface DiscountFields extends AmountFields { }\n\n/**\n * The result of a discount\n */\nexport type Discount = PayloadWithSources<DiscountFields, DiscountSchema>\n\n/**\n * Identity function for determining if an object is an Discount\n */\nexport const isDiscount = isPayloadOfSchemaType<Discount>(DiscountSchema)\n\n/**\n * Identity function for determining if an object is an Discount with sources\n */\nexport const isDiscountWithSources = isPayloadOfSchemaTypeWithSources<Discount>(DiscountSchema)\n\n/**\n * Identity function for determining if an object is an Discount with meta\n */\nexport const isDiscountWithMeta = isPayloadOfSchemaTypeWithMeta<Discount>(DiscountSchema)\n","import type { Discount } from './Discount.ts'\nimport { DiscountSchema } from './Discount.ts'\n\nexport const NO_DISCOUNT: Discount = {\n schema: DiscountSchema,\n amount: 0,\n currency: 'USD',\n}\n","import type { AccountInstance } from '@xyo-network/account-model'\nimport { BoundWitnessBuilder } from '@xyo-network/boundwitness-builder'\nimport type { IdPayload } from '@xyo-network/id-payload-plugin'\n\nimport type { EscrowTerms } from './Terms.ts'\n\n/**\n * Creates an escrow intent\n * @deprecated Use createEscrowIntentWithSecret instead\n * @param terms The payloads describing the terms for the escrow\n * @param account The account to create the escrow intent with\n * @returns The escrow intent\n */\nexport const createEscrowIntent = async (terms: EscrowTerms[], account: AccountInstance) => {\n const result = await new BoundWitnessBuilder({ accounts: [account] }).payloads([...terms]).build()\n return result\n}\n\n/**\n * Creates an escrow intent (for a buyer or seller) using the supplied secret\n * @param terms The payload describing the terms for the escrow\n * @param secret The secret for the escrow principal party to use for the escrow\n * @param account The account to create the escrow intent with\n * @returns The escrow intent\n */\nexport const createEscrowIntentWithSecret = async (terms: EscrowTerms, secret: IdPayload, account: AccountInstance) => {\n const result = await new BoundWitnessBuilder({ accounts: [account] }).payloads([terms, secret]).build()\n return result\n}\n","import { Crypto } from '@xylabs/crypto'\nimport type { IdPayload } from '@xyo-network/id-payload-plugin'\nimport { IdSchema } from '@xyo-network/id-payload-plugin'\n\n/**\n * Returns a cryptographically random secret to use for escrow\n * @returns The escrow secret\n */\nexport const getEscrowSecret = (): IdPayload => {\n return { salt: Crypto.randomUUID(), schema: IdSchema }\n}\n","import type { Hash } from '@xylabs/hex'\nimport type { PayloadWithSources } from '@xyo-network/payload-model'\nimport {\n isPayloadOfSchemaType,\n isPayloadOfSchemaTypeWithMeta,\n isPayloadOfSchemaTypeWithSources,\n} from '@xyo-network/payload-model'\n\nimport { EscrowSchema } from './Schema.ts'\n\nexport const EscrowOutcomeSchema = `${EscrowSchema}.outcome` as const\nexport type EscrowOutcomeSchema = typeof EscrowOutcomeSchema\n\n/**\n * The possible outcomes for an escrow\n */\nexport type EscrowOutcomes = 'fulfilled' | 'expired' // TODO: More outcomes\n\nexport interface EscrowOutcomeFields {\n outcome: EscrowOutcomes\n terms: Hash\n}\n\n/**\n * The terms of an escrow\n */\nexport type EscrowOutcome = PayloadWithSources<EscrowOutcomeFields, EscrowOutcomeSchema>\n\n/**\n * Identity function for determining if an object is an EscrowOutcome\n */\nexport const isEscrowOutcome = isPayloadOfSchemaType<EscrowOutcome>(EscrowOutcomeSchema)\n\n/**\n * Identity function for determining if an object is an EscrowOutcome with sources\n */\nexport const isEscrowOutcomeWithSources = isPayloadOfSchemaTypeWithSources<EscrowOutcome>(EscrowOutcomeSchema)\n\n/**\n * Identity function for determining if an object is an EscrowOutcome with meta\n */\nexport const isEscrowOutcomeWithMeta = isPayloadOfSchemaTypeWithMeta<EscrowOutcome>(EscrowOutcomeSchema)\n","export const EscrowSchema = 'network.xyo.escrow'\nexport type EscrowSchema = typeof EscrowSchema\n","import type { Address, Hash } from '@xylabs/hex'\nimport type { Payload } from '@xyo-network/payload-model'\nimport {\n isPayloadOfSchemaType, isPayloadOfSchemaTypeWithMeta, isPayloadOfSchemaTypeWithSources,\n} from '@xyo-network/payload-model'\n\nimport { EscrowSchema } from './Schema.ts'\n\nexport const EscrowTermsSchema = `${EscrowSchema}.terms` as const\nexport type EscrowTermsSchema = typeof EscrowTermsSchema\n\n// TODO: Include escrow agent in escrow terms\nexport interface EscrowTermsFields {\n /**\n * The trusted estimators for the worth of the things being sold\n */\n appraisalAuthorities: Address[]\n /**\n * The estimated worths of the things being sold\n */\n appraisals: Hash[]\n /**\n * The things being sold\n */\n assets: Hash[]\n /**\n * The buyer\n */\n buyer: Address[]\n /**\n * The buyer\n */\n buyerSecret: Hash\n /**\n * Any discounts (coupons, vouchers, credits, etc.) to be applied to the escrow\n */\n discounts: Hash[]\n /**\n * The escrow agent responsible for the escrow\n */\n escrowAgent: Address\n /**\n * The time the escrow expires\n */\n exp: number\n /**\n * The time the escrow starts\n */\n nbf: number\n /**\n * The trusted payment authorities\n */\n paymentAuthorities: Address[]\n /**\n * The seller\n */\n seller: Address[]\n /**\n * The seller\n */\n sellerSecret: Hash\n}\n\n/**\n * The terms of an escrow\n */\nexport type EscrowTerms = Payload<Partial<EscrowTermsFields>, EscrowTermsSchema>\n\n/**\n * Identity function for determining if an object is an EscrowTerms\n */\nexport const isEscrowTerms = isPayloadOfSchemaType<EscrowTerms>(EscrowTermsSchema)\n\n/**\n * Identity function for determining if an object is an EscrowTerms with sources\n */\nexport const isEscrowTermsWithSources = isPayloadOfSchemaTypeWithSources<EscrowTerms>(EscrowTermsSchema)\n\n/**\n * Identity function for determining if an object is an EscrowTerms with meta\n */\nexport const isEscrowTermsWithMeta = isPayloadOfSchemaTypeWithMeta<EscrowTerms>(EscrowTermsSchema)\n","import type { ModuleIdentifier } from '@xyo-network/module-model'\nimport type { PayloadValueExpression } from '@xyo-network/payload-model'\n\nimport type { EscrowTerms } from '../../../Terms.ts'\n\n/**\n * Checks if property value of the escrow terms contains one of the valid moduleIdentifiers\n * @param escrowTerms The escrow terms to validate\n * @param propertyExpression The selector to get the property containing the moduleIdentifier(s) from the escrow terms\n * @param moduleIdentifiers The list of allowed moduleIdentifiers\n * @param required Is the property required to be present\n * @returns True if the property value contains one of the valid moduleIdentifiers\n */\nexport const moduleIdentifiersContainsOneOf = (\n escrowTerms: EscrowTerms,\n propertyExpression: PayloadValueExpression<EscrowTerms, 'appraisalAuthorities' | 'buyer' | 'escrowAgent' | 'paymentAuthorities' | 'seller'>,\n moduleIdentifiers: ModuleIdentifier[],\n required: boolean = true,\n) => {\n const termsValue: string | string[] | undefined = propertyExpression(escrowTerms)\n if (termsValue === undefined) {\n return required ? false : true\n } else {\n return Array.isArray(termsValue) ? termsValue.some(address => moduleIdentifiers.includes(address)) : moduleIdentifiers.includes(termsValue)\n }\n}\n\n/**\n * Checks if property value of the escrow terms contains all of the valid moduleIdentifiers\n * @param escrowTerms The escrow terms to validate\n * @param selector The selector to get the property containing the moduleIdentifier(s) from the escrow terms\n * @param moduleIdentifiers The list of allowed moduleIdentifiers\n * @param required Is the property required to be present\n * @returns True if the property value contains all of the valid moduleIdentifiers\n */\nexport const moduleIdentifiersContainsAllOf = (\n escrowTerms: EscrowTerms,\n selector: PayloadValueExpression<EscrowTerms, 'appraisalAuthorities' | 'buyer' | 'escrowAgent' | 'paymentAuthorities' | 'seller'>,\n moduleIdentifiers: ModuleIdentifier[],\n required: boolean = true,\n) => {\n const termsValue: string | string[] | undefined = selector(escrowTerms)\n if (termsValue === undefined) {\n return required ? false : true\n } else {\n return Array.isArray(termsValue) ? termsValue.every(address => moduleIdentifiers.includes(address)) : moduleIdentifiers.includes(termsValue)\n }\n}\n","export type Windowed = { exp?: number; nbf?: number }\n\nexport const validateWithinWindow = (value: Windowed, exp: number, nbf: number = Date.now()): boolean => {\n if (value.nbf === undefined || value.nbf > nbf) return false\n if (value.exp === undefined || value.exp < exp) return false\n return true\n}\n","import type { ModuleIdentifier } from '@xyo-network/module-model'\nimport type { PayloadValidationFunction } from '@xyo-network/payload-model'\n\nimport type { EscrowTerms } from '../../Terms.ts'\nimport { moduleIdentifiersContainsOneOf } from '../common/index.ts'\n\nconst name = 'EscrowTerms.escrowAgent'\n\nexport const getEscrowAgentAllowedValidator = (allowedEscrowAgent: ModuleIdentifier): PayloadValidationFunction<EscrowTerms> => {\n return (terms: EscrowTerms) => {\n const result = moduleIdentifiersContainsOneOf(terms, t => t.escrowAgent, [allowedEscrowAgent], true)\n if (!result) {\n console.log(`${name}: Escrow agent not allowed: ${terms.escrowAgent}`)\n }\n return result\n }\n}\n","import { assertEx } from '@xylabs/assert'\nimport type { Hash } from '@xylabs/hex'\nimport type { BoundWitness } from '@xyo-network/boundwitness-model'\nimport { isBoundWitnessWithMeta } from '@xyo-network/boundwitness-model'\nimport type { HashLeaseEstimate } from '@xyo-network/diviner-hash-lease'\nimport { isHashLeaseEstimateWithSources } from '@xyo-network/diviner-hash-lease'\nimport type {\n Payload, PayloadValidationFunction, WithMeta, WithSources,\n} from '@xyo-network/payload-model'\n\nimport type { EscrowTerms } from '../../Terms.ts'\nimport { validateWithinWindow } from '../common/index.ts'\n\nconst name = 'EscrowTerms.appraisal'\n\n/**\n * A function that validates the escrow terms for tbe existence of appraisals\n * @returns True if the escrow terms contain appraisals, false otherwise\n */\nexport const appraisalsExistValidator: PayloadValidationFunction<EscrowTerms> = (terms: EscrowTerms) => {\n // Validate we have appraisals\n const appraisals = terms.appraisals\n if (!appraisals || appraisals.length === 0) {\n console.log(`${name}: No appraisals: ${terms.appraisals}`)\n return false\n }\n return true\n}\n\n/**\n * Returns a function that validates the escrow terms for appraisals which are from valid authorities\n * @param dictionary Payload dictionary of the escrow terms\n * @returns A function that validates the escrow terms for appraisals which are from valid authorities\n */\nexport const getAppraisalsFromValidAuthoritiesValidator = (dictionary: Record<Hash, WithMeta<Payload>>): PayloadValidationFunction<EscrowTerms> => {\n return (terms: EscrowTerms) => {\n const appraisals = assertEx(terms.appraisals, () => `${name}: No appraisals: ${terms.appraisals}`)\n const appraisalAuthorities = assertEx(terms.appraisalAuthorities, () => `${name}: No appraisalAuthorities: ${terms.appraisalAuthorities}`)\n\n // Validate the appraisals are signed by valid appraisal authorities. Validation criteria:\n // - We have a bw for each of the appraisal\n // - The bw is signed by an approved appraisal authority\n const appraisalBWsValid: Record<Hash, WithMeta<BoundWitness>[]> = Object.fromEntries(\n appraisals.map<[Hash, WithMeta<BoundWitness>[]]>(hash => [hash, []]),\n )\n for (const bw of Object.values(dictionary).filter(isBoundWitnessWithMeta)) {\n for (const appraisal of appraisals) {\n if (bw.payload_hashes.includes(appraisal) && bw.addresses.some(address => appraisalAuthorities.includes(address))) {\n appraisalBWsValid[appraisal].push(bw)\n }\n }\n }\n for (const [appraisal, bws] of Object.entries(appraisalBWsValid)) {\n if (bws.length === 0) {\n console.log(`${name}: No valid appraisals for ${appraisal}`)\n return false\n }\n }\n return true\n }\n}\n\n/**\n * Returns a function that validates the escrow terms for appraisals which are valid\n * @param dictionary Payload dictionary of the escrow terms\n * @param minimumExp The minium amount of time an estimate needs to be valid\n * for in the future (so as not to expire before the escrow is complete)\n * @returns A function that validates the escrow terms for appraisals which are valid\n */\nexport const getAppraisalsValidValidator = (\n dictionary: Record<Hash, WithMeta<Payload>>,\n minimumExp: number,\n): PayloadValidationFunction<EscrowTerms> => {\n return (terms: EscrowTerms) => {\n // Verify we have an estimate for each of the assets\n const estimatesByAsset = getEstimatesByAsset(terms, dictionary)\n // Validate each of the estimates are valid (time, price, etc)\n const now = Date.now()\n const exp = now + minimumExp\n for (const [asset, estimates] of Object.entries(estimatesByAsset)) {\n for (const estimate of estimates) {\n if (!validateEstimate(estimate, exp)) {\n console.log(`${name}: Invalid estimate for asset ${asset}: ${estimate}`)\n return false\n }\n }\n }\n return true\n }\n}\n\n/**\n * Returns a function that validates the escrow terms to ensure that they contain an appraisal for each asset\n * @param dictionary Payload dictionary of the escrow terms\n * @returns A function that validates the escrow terms for appraisals\n */\nexport const getAppraisalsForAllAssetsValidator = (dictionary: Record<Hash, WithMeta<Payload>>): PayloadValidationFunction<EscrowTerms> => {\n return (terms: EscrowTerms) => {\n // Verify we have an estimate for each of the assets\n const estimatesByAsset = getEstimatesByAsset(terms, dictionary)\n const assets = assertEx(terms.assets, () => `${name}: No assets: ${terms.assets}`)\n if (Object.keys(estimatesByAsset).length !== assets.length) {\n console.log(`${name}: Missing appraisals for all assets: ${assets}`)\n return false\n }\n return true\n }\n}\n\nconst validateEstimate = (estimate: WithSources<HashLeaseEstimate>, exp: number): boolean => {\n if (!validateWithinWindow(estimate, exp)) return false\n if (estimate.currency !== 'USD') return false\n if (estimate.price <= 0) return false\n return true\n}\n\nconst getEstimatesByAsset = (terms: EscrowTerms, dictionary: Record<Hash, WithMeta<Payload>>): Record<Hash, WithSources<HashLeaseEstimate>[]> => {\n const assets = assertEx(terms.assets, () => `${name}: No assets: ${terms.assets}`)\n const estimates = Object.values(dictionary).filter(isHashLeaseEstimateWithSources) as unknown as WithSources<HashLeaseEstimate>[]\n const estimatesByAsset: Record<Hash, WithSources<HashLeaseEstimate>[]> = {}\n for (const estimate of estimates) {\n const { sources } = estimate\n if (sources === undefined || sources.length === 0) {\n console.log(`${name}: No sources: ${estimate}`)\n continue\n }\n for (const asset of assets) {\n if (sources.includes(asset)) {\n if (!estimatesByAsset[asset]) estimatesByAsset[asset] = []\n estimatesByAsset[asset].push(estimate)\n }\n }\n }\n return estimatesByAsset\n}\n","import { asAddress } from '@xylabs/hex'\nimport type { ModuleIdentifier } from '@xyo-network/module-model'\nimport type { PayloadValidationFunction } from '@xyo-network/payload-model'\n\nimport type { EscrowTerms } from '../../Terms.ts'\nimport { moduleIdentifiersContainsAllOf } from '../common/index.ts'\n\nconst name = 'EscrowTerms.appraisalAuthorities'\n\n/**\n * A function that validates the escrow terms for appraisalAuthorities\n * @returns True if the escrow terms contain appraisalAuthorities, false otherwise\n */\nexport const appraisalAuthoritiesExistValidator: PayloadValidationFunction<EscrowTerms> = (terms: EscrowTerms) => {\n // Validate we have appraisalAuthorities\n const appraisalAuthorities = terms.appraisalAuthorities\n if (!appraisalAuthorities || appraisalAuthorities.length === 0) {\n console.log(`${name}: No appraisalAuthorities: ${terms.appraisalAuthorities}`)\n return false\n }\n // Validate the authorities are addresses\n if (appraisalAuthorities.map(x => asAddress(x)).length !== appraisalAuthorities.length) {\n console.log(`${name}: Invalid address: ${terms.appraisalAuthorities}`)\n return false\n }\n return true\n}\n\nexport const getAppraisalAuthoritiesAllowedValidator = (allowed: ModuleIdentifier[]): PayloadValidationFunction<EscrowTerms> => {\n return (terms: EscrowTerms) => {\n const result = moduleIdentifiersContainsAllOf(terms, t => t.appraisalAuthorities, allowed, true)\n if (!result) {\n console.log(`${name}: Appraisal authority not allowed: ${terms.appraisalAuthorities}`)\n }\n return result\n }\n}\n","import type { PayloadValidationFunction } from '@xyo-network/payload-model'\n\nimport type { EscrowTerms } from '../../Terms.ts'\n\nconst name = 'EscrowTerms.assets'\n\n/**\n * Returns a function that validates the escrow terms for assets\n * @returns A function that validates the escrow terms for assets\n */\nexport const assetsExistValidator: PayloadValidationFunction<EscrowTerms> = (terms: EscrowTerms) => {\n // Validate we have assets\n const assets = terms.assets\n if (!assets || assets.length === 0) {\n console.log(`${name}: No assets: ${terms.assets}`)\n return false\n }\n return true\n}\n","import { asAddress } from '@xylabs/hex'\nimport type { PayloadValidationFunction } from '@xyo-network/payload-model'\n\nimport type { EscrowTerms } from '../../Terms.ts'\n\nconst name = 'EscrowTerms.buyer'\n\n/**\n * A function that validates the escrow terms for buyer\n * @returns True if the escrow terms contain buyer, false otherwise\n */\nexport const buyerExistsValidator: PayloadValidationFunction<EscrowTerms> = (terms: EscrowTerms) => {\n // Validate we have buyer\n const buyer = terms.buyer\n if (!buyer || buyer.length === 0) {\n console.log(`${name}: No buyer: ${terms.buyer}`)\n return false\n }\n // Validate the authorities are addresses\n if (buyer.map(x => asAddress(x)).length !== buyer.length) {\n console.log(`${name}: Invalid address: ${terms.buyer}`)\n return false\n }\n return true\n}\n","import { assertEx } from '@xylabs/assert'\nimport type { Hash } from '@xylabs/hex'\nimport { isBoundWitnessWithMeta } from '@xyo-network/boundwitness-model'\nimport { BoundWitnessValidator } from '@xyo-network/boundwitness-validator'\nimport type {\n Payload, PayloadValidationFunction, WithMeta,\n} from '@xyo-network/payload-model'\n\nimport type { EscrowTerms } from '../../Terms.ts'\n\nconst name = 'EscrowTerms.buyerSecret'\n\n/**\n * Returns a function that validates the escrow terms for buyerSecret\n * @returns A function that validates the escrow terms for buyerSecret\n */\nexport const buyerSecretExistsValidator: PayloadValidationFunction<EscrowTerms> = (terms: EscrowTerms) => {\n // Validate we have buyerSecret\n const buyerSecret = terms.buyerSecret\n if (!buyerSecret || buyerSecret.length === 0) {\n console.log(`${name}: No buyerSecret: ${terms.buyerSecret}`)\n return false\n }\n return true\n}\n\n/**\n * Returns a function that validates the escrow terms for the existence of the buyerSecret in the dictionary\n * @param dictionary Payload dictionary of the escrow terms\n * @returns A function that validates the escrow terms for the existence of the buyerSecret in the dictionary\n */\nexport const getBuyerSecretSuppliedValidator = (dictionary: Record<Hash, WithMeta<Payload>>): PayloadValidationFunction<EscrowTerms> => {\n return (terms: EscrowTerms) => {\n const buyerSecret = assertEx(terms.buyerSecret, () => `${name}: No buyerSecret: ${terms.buyerSecret}`)\n if (!dictionary[buyerSecret]) {\n console.log(`${name}: Payload not supplied for buyerSecret: ${buyerSecret}`)\n return false\n }\n return true\n }\n}\n\n/**\n * Returns a function that validates the escrow terms for the existence of the buyerSecret signed by the buyer\n * @param dictionary Payload dictionary of the escrow terms\n * @returns A function that validates the escrow terms for the existence of the buyerSecret signed by the buyer\n */\nexport const getBuyerSecretSignedValidator = (dictionary: Record<Hash, WithMeta<Payload>>): PayloadValidationFunction<EscrowTerms> => {\n return async (terms: EscrowTerms) => {\n const buyer = assertEx(terms.buyer, () => `${name}: No buyer: ${terms.buyer}`)\n const buyerSecret = assertEx(terms.buyerSecret, () => `${name}: No buyerSecret: ${terms.buyerSecret}`)\n // Buyer-signed buyer secrets\n const buyerSecretBWs = Object.values(dictionary)\n // Find all BoundWitnesses\n .filter(isBoundWitnessWithMeta)\n // That contain the buyer secret\n .filter(bw => bw.payload_hashes.includes(buyerSecret))\n // That are signed by all the buyers\n .filter(bw => buyer.every(buyerAddress => bw.addresses.includes(buyerAddress)))\n\n // If there are no buyerSecret BWs, return false\n if (buyerSecretBWs.length === 0) {\n console.log(`${name}: No BoundWitnesses supplied for buyerSecret: ${buyerSecret}`)\n return false\n }\n\n // Ensure each BW supplied for the buyerSecret is valid\n const errors = await Promise.all(buyerSecretBWs.map(bw => new BoundWitnessValidator(bw).validate()))\n const validBoundWitnesses = errors.every(errors => errors.length === 0)\n if (!validBoundWitnesses) {\n console.log(`${name}: Invalid BoundWitnesses supplied for buyerSecret: ${buyerSecret}`)\n return false\n }\n return true\n }\n}\n","import type { PayloadValidationFunction } from '@xyo-network/payload-model'\n\nimport type { EscrowTerms } from '../../Terms.ts'\n\nexport const getNbfExpValidator = (now: number, minRequiredDuration: number): PayloadValidationFunction<EscrowTerms> => {\n const minExp = now + minRequiredDuration\n return (terms: EscrowTerms) => {\n const { exp, nbf } = terms\n if (nbf === undefined || nbf < now) {\n console.log(`EscrowTerms.nbf: invalid nbf ${terms.nbf}`)\n return false\n }\n if (exp === undefined || exp < minExp || nbf > exp) {\n console.log(`EscrowTerms.exp: invalid exp ${terms.exp}`)\n return false\n }\n return true\n }\n}\n","import type { ModuleIdentifier } from '@xyo-network/module-model'\nimport type { PayloadValidationFunction } from '@xyo-network/payload-model'\n\nimport type { EscrowTerms } from '../../Terms.ts'\nimport { moduleIdentifiersContainsAllOf } from '../common/index.ts'\n\nconst name = 'EscrowTerms.paymentAuthorities'\n\nexport const getPaymentAuthoritiesAllowedValidator = (allowed: ModuleIdentifier[]): PayloadValidationFunction<EscrowTerms> => {\n return (terms: EscrowTerms) => {\n const result = moduleIdentifiersContainsAllOf(terms, t => t.paymentAuthorities, allowed, true)\n if (!result) {\n console.log(`${name}: Payment authority not allowed: ${terms.paymentAuthorities}`)\n }\n return result\n }\n}\n","import { asAddress } from '@xylabs/hex'\nimport type { PayloadValidationFunction } from '@xyo-network/payload-model'\n\nimport type { EscrowTerms } from '../../Terms.ts'\n\nconst name = 'EscrowTerms.seller'\n\n/**\n * A function that validates the escrow terms for seller\n * @returns True if the escrow terms contain seller, false otherwise\n */\nexport const sellerExistsValidator: PayloadValidationFunction<EscrowTerms> = (terms: EscrowTerms) => {\n // Validate we have seller\n const seller = terms.seller\n if (!seller || seller.length === 0) {\n console.log(`${name}: No seller: ${terms.seller}`)\n return false\n }\n // Validate the authorities are addresses\n if (seller.map(x => asAddress(x)).length !== seller.length) {\n console.log(`${name}: Invalid address: ${terms.seller}`)\n return false\n }\n return true\n}\n","import { assertEx } from '@xylabs/assert'\nimport type { Hash } from '@xylabs/hex'\nimport { isBoundWitnessWithMeta } from '@xyo-network/boundwitness-model'\nimport { BoundWitnessValidator } from '@xyo-network/boundwitness-validator'\nimport type {\n Payload, PayloadValidationFunction, WithMeta,\n} from '@xyo-network/payload-model'\n\nimport type { EscrowTerms } from '../../Terms.ts'\n\nconst name = 'EscrowTerms.sellerSecret'\n\n/**\n * Returns a function that validates the escrow terms for sellerSecret\n * @returns A function that validates the escrow terms for sellerSecret\n */\nexport const sellerSecretExistsValidator: PayloadValidationFunction<EscrowTerms> = (terms: EscrowTerms) => {\n // Validate we have sellerSecret\n const sellerSecret = terms.sellerSecret\n if (!sellerSecret || sellerSecret.length === 0) {\n console.log(`${name}: No sellerSecret: ${terms.sellerSecret}`)\n return false\n }\n return true\n}\n\n/**\n * Returns a function that validates the escrow terms for the existence of the sellerSecret in the dictionary\n * @param dictionary Payload dictionary of the escrow terms\n * @returns A function that validates the escrow terms for the existence of the sellerSecret in the dictionary\n */\nexport const getSellerSecretSuppliedValidator = (dictionary: Record<Hash, WithMeta<Payload>>): PayloadValidationFunction<EscrowTerms> => {\n return (terms: EscrowTerms) => {\n const sellerSecret = assertEx(terms.sellerSecret, () => `${name}: No sellerSecret: ${terms.sellerSecret}`)\n if (!dictionary[sellerSecret]) {\n console.log(`${name}: Payload not supplied for sellerSecret: ${sellerSecret}`)\n return false\n }\n return true\n }\n}\n\n/**\n * Returns a function that validates the escrow terms for the existence of the sellerSecret signed by the seller\n * @param dictionary Payload dictionary of the escrow terms\n * @returns A function that validates the escrow terms for the existence of the sellerSecret signed by the seller\n */\nexport const getSellerSecretSignedValidator = (dictionary: Record<Hash, WithMeta<Payload>>): PayloadValidationFunction<EscrowTerms> => {\n return async (terms: EscrowTerms) => {\n const seller = assertEx(terms.seller, () => `${name}: No seller: ${terms.seller}`)\n const sellerSecret = assertEx(terms.sellerSecret, () => `${name}: No sellerSecret: ${terms.sellerSecret}`)\n // Seller-signed seller secrets\n const sellerSecretBWs = Object.values(dictionary)\n // Find all BoundWitnesses\n .filter(isBoundWitnessWithMeta)\n // That contain the seller secret\n .filter(bw => bw.payload_hashes.includes(sellerSecret))\n // That are signed by all the sellers\n .filter(bw => seller.every(sellerAddress => bw.addresses.includes(sellerAddress)))\n\n // If there are no sellerSecret BWs, return false\n if (sellerSecretBWs.length === 0) {\n console.log(`${name}: No BoundWitnesses supplied for sellerSecret: ${sellerSecret}`)\n return false\n }\n\n // Ensure each BW supplied for the sellerSecret is valid\n const errors = await Promise.all(sellerSecretBWs.map(bw => new BoundWitnessValidator(bw).validate()))\n const validBoundWitnesses = errors.every(errors => errors.length === 0)\n if (!validBoundWitnesses) {\n console.log(`${name}: Invalid BoundWitnesses supplied for sellerSecret: ${sellerSecret}`)\n return false\n }\n return true\n }\n}\n","import type { Payload } from '@xyo-network/payload-model'\nimport {\n isPayloadOfSchemaType, isPayloadOfSchemaTypeWithMeta, isPayloadOfSchemaTypeWithSources,\n} from '@xyo-network/payload-model'\n\nimport { PaymentCardSchema } from './Schema.ts'\n\n/**\n * The fields describing a payment card.\n */\nexport interface PaymentCardFields {\n /**\n * Card Number (PAN) of the payment card. This value is required to perform a payment.\n */\n cardNumber: string\n /**\n * The name as it appears on the payment card.\n */\n cardholderName?: string\n /**\n * Card Verification Value (CVV/CVC) of the payment card.\n */\n cvv: string\n /**\n * Expiration month of the payment card.\n */\n expMonth: number\n /**\n * Expiration year of the payment card.\n */\n expYear: number\n}\n\n/**\n * A PaymentCard Payload\n */\nexport type PaymentCard = Payload<PaymentCardFields, PaymentCardSchema>\n\n/**\n * Identity function for determine if an object is a PaymentCard\n */\nexport const isPaymentCard = isPayloadOfSchemaType<PaymentCard>(PaymentCardSchema)\n\n/**\n * Identity function for determine if an object is a PaymentCard with sources\n */\nexport const isPaymentCardWithSources = isPayloadOfSchemaTypeWithSources<PaymentCard>(PaymentCardSchema)\n\n/**\n * Identity function for determine if an object is a PaymentCard with meta\n */\nexport const isPaymentCardWithMeta = isPayloadOfSchemaTypeWithMeta<PaymentCard>(PaymentCardSchema)\n","import { PaymentsSchema } from '../Schema.ts'\n\nexport const PaymentSchema = `${PaymentsSchema}.payment`\nexport type PaymentSchema = typeof PaymentSchema\n","import { PaymentSchema } from '../Schema.ts'\n\nexport const PaymentInstrumentSchema = `${PaymentSchema}.instrument`\nexport type PaymentInstrumentSchema = typeof PaymentInstrumentSchema\n","import { PaymentInstrumentSchema } from '../Schema.ts'\n\nexport const PaymentCardSchema = `${PaymentInstrumentSchema}.card`\nexport type PaymentCardSchema = typeof PaymentCardSchema\n","import type { PayloadWithSources } from '@xyo-network/payload-model'\nimport {\n isPayloadOfSchemaType,\n isPayloadOfSchemaTypeWithMeta,\n isPayloadOfSchemaTypeWithSources,\n} from '@xyo-network/payload-model'\n\nimport type { SupportedCurrency } from '../Currency.ts'\nimport { PaymentSchema } from './Schema.ts'\n\nexport interface PaymentFields {\n /**\n * The amount paid\n */\n amount: number\n /**\n * The currency of the amount paid\n */\n currency: SupportedCurrency\n}\n\n/**\n * A payment is a record of an amount to be paid\n */\nexport type Payment = PayloadWithSources<PaymentFields, PaymentSchema>\n\n/**\n * Identity function for determine if an object is a Payment\n */\nexport const isPayment = isPayloadOfSchemaType<Payment>(PaymentSchema)\n\n/**\n * Identity function for determine if an object is a Payment with sources\n */\nexport const isPaymentWithSources = isPayloadOfSchemaTypeWithSources<Payment>(PaymentSchema)\n\n/**\n * Identity function for determine if an object is a Payment with meta\n */\nexport const isPaymentWithMeta = isPayloadOfSchemaTypeWithMeta<Payment>(PaymentSchema)\n","import type { PayloadWithSources } from '@xyo-network/payload-model'\nimport {\n isPayloadOfSchemaType,\n isPayloadOfSchemaTypeWithMeta,\n isPayloadOfSchemaTypeWithSources,\n} from '@xyo-network/payload-model'\n\nimport { PaymentStatusSchema } from './Schema.ts'\n\nexport interface PaymentStatusFields {\n /**\n * The result of the payment (i.e. declined)\n */\n result?: string\n\n /**\n * The status of the payment (i.e. completed)\n */\n status: string\n}\n\n/**\n * A payment status is the outcome of a payment attempt\n */\nexport type PaymentStatus = PayloadWithSources<PaymentStatusFields, PaymentStatusSchema>\n\n/**\n * Identity function for determine if an object is a PaymentStatus\n */\nexport const isPaymentStatus = isPayloadOfSchemaType<PaymentStatus>(PaymentStatusSchema)\n\n/**\n * Identity function for determine if an object is a PaymentStatus with sources\n */\nexport const isPaymentStatusWithSources = isPayloadOfSchemaTypeWithSources<PaymentStatus>(PaymentStatusSchema)\n\n/**\n * Identity function for determine if an object is a PaymentStatus with meta\n */\nexport const isPaymentStatusWithMeta = isPayloadOfSchemaTypeWithMeta<PaymentStatus>(PaymentStatusSchema)\n","import { PaymentSchema } from '../Schema.ts'\n\nexport const PaymentStatusSchema = `${PaymentSchema}.status`\nexport type PaymentStatusSchema = typeof PaymentStatusSchema\n","import type { Hash } from '@xylabs/hex'\nimport type { PayloadWithSources } from '@xyo-network/payload-model'\nimport {\n isPayloadOfSchemaType,\n isPayloadOfSchemaTypeWithMeta,\n isPayloadOfSchemaTypeWithSources,\n} from '@xyo-network/payload-model'\n\nimport { PurchaseSchema } from './Schema.ts'\n\nexport interface PurchaseFields {\n /**\n * The things that were purchased\n */\n assets: Hash[]\n /**\n * The receipts for payments for this purchase. Array to allow for multiple payments\n * for a single quote.\n */\n receipts: Hash[]\n}\n\n/**\n * A purchase ties a payment made to a quote\n */\nexport type Purchase = PayloadWithSources<PurchaseFields, PurchaseSchema>\n\n/**\n * Identity function for determine if an object is a Purchase\n */\nexport const isPurchase = isPayloadOfSchemaType<Purchase>(PurchaseSchema)\n\n/**\n * Identity function for determine if an object is a Purchase with sources\n */\nexport const isPurchaseWithSources = isPayloadOfSchemaTypeWithSources<Purchase>(PurchaseSchema)\n\n/**\n * Identity function for determine if an object is a Purchase with meta\n */\nexport const isPurchaseWithMeta = isPayloadOfSchemaTypeWithMeta<Purchase>(PurchaseSchema)\n","import { PaymentsSchema } from '../Schema.ts'\n\nexport const PurchaseSchema = `${PaymentsSchema}.purchase`\nexport type PurchaseSchema = typeof PurchaseSchema\n","import type { PayloadWithSources } from '@xyo-network/payload-model'\nimport {\n isPayloadOfSchemaType,\n isPayloadOfSchemaTypeWithMeta,\n isPayloadOfSchemaTypeWithSources,\n} from '@xyo-network/payload-model'\n\nimport type { SupportedCurrency } from '../Currency.ts'\nimport { ReceiptSchema } from './Schema.ts'\n\nexport interface ReceiptFields {\n /**\n * The amount paid\n */\n amount: number\n /**\n * The currency of the amount paid\n */\n currency: SupportedCurrency\n}\n\n/**\n * A receipt is a record of a payment made\n */\nexport type Receipt = PayloadWithSources<ReceiptFields, ReceiptSchema>\n\n/**\n * Identity function for determine if an object is a Receipt\n */\nexport const isReceipt = isPayloadOfSchemaType<Receipt>(ReceiptSchema)\n\n/**\n * Identity function for determine if an object is a Receipt with sources\n */\nexport const isReceiptWithSources = isPayloadOfSchemaTypeWithSources<Receipt>(ReceiptSchema)\n\n/**\n * Identity function for determine if an object is a Receipt with meta\n */\nexport const isReceiptWithMeta = isPayloadOfSchemaTypeWithMeta<Receipt>(ReceiptSchema)\n","import { PaymentsSchema } from '../Schema.ts'\n\nexport const ReceiptSchema = `${PaymentsSchema}.receipt`\nexport type ReceiptSchema = typeof ReceiptSchema\n","// import type { Hash } from '@xylabs/hex'\nimport type { DivinerConfig } from '@xyo-network/diviner-model'\n\nexport const PaymentSubtotalDivinerConfigSchema = 'network.xyo.diviner.payments.subtotal.config'\nexport type PaymentSubtotalDivinerConfigSchema = typeof PaymentSubtotalDivinerConfigSchema\n\n/**\n * The configuration for the Coupon Subtotal Diviner\n */\nexport type PaymentSubtotalDivinerConfig = DivinerConfig<\n {},\n PaymentSubtotalDivinerConfigSchema\n>\n","import type { PayloadWithSources } from '@xyo-network/payload-model'\nimport {\n isPayloadOfSchemaType,\n isPayloadOfSchemaTypeWithMeta,\n isPayloadOfSchemaTypeWithSources,\n} from '@xyo-network/payload-model'\n\nimport type { AmountFields } from '../../Amount/index.ts'\n\nexport const SubtotalSchema = 'network.xyo.payments.subtotal' as const\nexport type SubtotalSchema = typeof SubtotalSchema\n\nexport interface SubtotalFields extends AmountFields {}\n\n/**\n * The result of a subtotal\n */\nexport type Subtotal = PayloadWithSources<SubtotalFields, SubtotalSchema>\n\n/**\n * Identity function for determining if an object is an Subtotal\n */\nexport const isSubtotal = isPayloadOfSchemaType<Subtotal>(SubtotalSchema)\n\n/**\n * Identity function for determining if an object is an Subtotal with sources\n */\nexport const isSubtotalWithSources = isPayloadOfSchemaTypeWithSources<Subtotal>(SubtotalSchema)\n\n/**\n * Identity function for determining if an object is an Subtotal with meta\n */\nexport const isSubtotalWithMeta = isPayloadOfSchemaTypeWithMeta<Subtotal>(SubtotalSchema)\n","// import type { Hash } from '@xylabs/hex'\nimport type { DivinerConfig } from '@xyo-network/diviner-model'\nimport type { ModuleIdentifier } from '@xyo-network/module-model'\n\nexport const PaymentTotalDivinerConfigSchema = 'network.xyo.diviner.payments.total.config'\nexport type PaymentTotalDivinerConfigSchema = typeof PaymentTotalDivinerConfigSchema\n\n/**\n * The configuration for the Total Diviner\n */\nexport type PaymentTotalDivinerConfig = DivinerConfig<\n {\n /**\n * The Diviner that will be used to determine the discount\n */\n paymentDiscountDiviner?: ModuleIdentifier\n\n /**\n * The Diviner that will be used to determine the subtotal\n */\n paymentSubtotalDiviner?: ModuleIdentifier\n },\n PaymentTotalDivinerConfigSchema\n>\n","import type { PayloadWithSources } from '@xyo-network/payload-model'\nimport {\n isPayloadOfSchemaType,\n isPayloadOfSchemaTypeWithMeta,\n isPayloadOfSchemaTypeWithSources,\n} from '@xyo-network/payload-model'\n\nimport type { AmountFields } from '../../Amount/index.ts'\n\nexport const TotalSchema = 'network.xyo.payments.total' as const\nexport type TotalSchema = typeof TotalSchema\n\nexport interface TotalFields extends AmountFields {}\n\n/**\n * The result of a total\n */\nexport type Total = PayloadWithSources<TotalFields, TotalSchema>\n\n/**\n * Identity function for determining if an object is an Total\n */\nexport const isTotal = isPayloadOfSchemaType<Total>(TotalSchema)\n\n/**\n * Identity function for determining if an object is an Total with sources\n */\nexport const isTotalWithSources = isPayloadOfSchemaTypeWithSources<Total>(TotalSchema)\n\n/**\n * Identity function for determining if an object is an Total with meta\n */\nexport const isTotalWithMeta = isPayloadOfSchemaTypeWithMeta<Total>(TotalSchema)\n"],"mappings":";AAsXO,IAAM,uBAA4E;AAAA,EACvF,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAA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CAAAC;AAAA,OACK;;;ACJA,IAAM,iBAAiB,GAAG,cAAc;;;AD4BxC,IAAM,aAAaC,wBAAgC,cAAc;AAKjE,IAAM,wBAAwBC,mCAA2C,cAAc;AAKvF,IAAM,qBAAqBC,gCAAwC,cAAc;;;AEvCxF;AAAA,EACE,yBAAAC;AAAA,EACA,iCAAAC;AAAA,EACA,oCAAAC;AAAA,OACK;;;ACHA,IAAM,gBAAgB,GAAG,cAAc;;;AD2BvC,IAAM,YAAYC,wBAA+B,aAAa;AAK9D,IAAM,uBAAuBC,mCAA0C,aAAa;AAKpF,IAAM,oBAAoBC,gCAAuC,aAAa;;;AEpC9E,IAAM,qCAAqC;;;ACFlD;AAAA,EACE,yBAAAC;AAAA,EACA,iCAAAC;AAAA,EACA,oCAAAC;AAAA,OACK;AAIA,IAAM,iBAAiB;AAavB,IAAM,aAAaF,wBAAgC,cAAc;AAKjE,IAAM,wBAAwBE,mCAA2C,cAAc;AAKvF,IAAM,qBAAqBD,gCAAwC,cAAc;;;AC5BjF,IAAM,kCAAkC;;;ACH/C;AAAA,EACE,yBAAAE;AAAA,EACA,iCAAAC;AAAA,EACA,oCAAAC;AAAA,OACK;AAIA,IAAM,cAAc;AAapB,IAAM,UAAUF,wBAA6B,WAAW;AAKxD,IAAM,qBAAqBE,mCAAwC,WAAW;AAK9E,IAAM,kBAAkBD,gCAAqC,WAAW;","names":["isPayloadOfSchemaType","isPayloadOfSchemaTypeWithMeta","isPayloadOfSchemaTypeWithSources","isPayloadOfSchemaType","isPayloadOfSchemaTypeWithSources","isPayloadOfSchemaTypeWithMeta","SchemaSchema","SchemaSchema","isPayloadOfSchemaType","isPayloadOfSchemaTypeWithMeta","isPayloadOfSchemaTypeWithSources","isPayloadOfSchemaType","isPayloadOfSchemaTypeWithSources","isPayloadOfSchemaTypeWithMeta","isPayloadOfSchemaType","isPayloadOfSchemaTypeWithMeta","isPayloadOfSchemaTypeWithSources","isPayloadOfSchemaType","isPayloadOfSchemaTypeWithSources","isPayloadOfSchemaTypeWithMeta","isPayloadOfSchemaType","isPayloadOfSchemaTypeWithMeta","isPayloadOfSchemaTypeWithSources","isPayloadOfSchemaType","isPayloadOfSchemaTypeWithSources","isPayloadOfSchemaTypeWithMeta","isPayloadOfSchemaType","isPayloadOfSchemaTypeWithMeta","isPayloadOfSchemaTypeWithSources","SchemaSchema","isPayloadOfSchemaType","isPayloadOfSchemaTypeWithMeta","isPayloadOfSchemaTypeWithSources","isPayloadOfSchemaType","isPayloadOfSchemaTypeWithMeta","isPayloadOfSchemaTypeWithSources","isPayloadOfSchemaType","isPayloadOfSchemaTypeWithSources","isPayloadOfSchemaTypeWithMeta","isPayloadOfSchemaType","isPayloadOfSchemaTypeWithMeta","isPayloadOfSchemaTypeWithSources","isPayloadOfSchemaType","isPayloadOfSchemaTypeWithSources","isPayloadOfSchemaTypeWithMeta","name","name","name","asAddress","name","assertEx","isBoundWitnessWithMeta","name","errors","name","asAddress","name","assertEx","isBoundWitnessWithMeta","BoundWitnessValidator","name","errors","isPayloadOfSchemaType","isPayloadOfSchemaTypeWithMeta","isPayloadOfSchemaTypeWithSources","isPayloadOfSchemaType","isPayloadOfSchemaTypeWithSources","isPayloadOfSchemaTypeWithMeta","isPayloadOfSchemaType","isPayloadOfSchemaTypeWithMeta","isPayloadOfSchemaTypeWithSources","isPayloadOfSchemaType","isPayloadOfSchemaTypeWithSources","isPayloadOfSchemaTypeWithMeta","isPayloadOfSchemaType","isPayloadOfSchemaTypeWithMeta","isPayloadOfSchemaTypeWithSources","isPayloadOfSchemaType","isPayloadOfSchemaTypeWithSources","isPayloadOfSchemaTypeWithMeta","isPayloadOfSchemaType","isPayloadOfSchemaTypeWithMeta","isPayloadOfSchemaTypeWithSources","isPayloadOfSchemaType","isPayloadOfSchemaTypeWithSources","isPayloadOfSchemaTypeWithMeta","isPayloadOfSchemaType","isPayloadOfSchemaTypeWithMeta","isPayloadOfSchemaTypeWithSources","isPayloadOfSchemaType","isPayloadOfSchemaTypeWithSources","isPayloadOfSchemaTypeWithMeta","isPayloadOfSchemaType","isPayloadOfSchemaTypeWithMeta","isPayloadOfSchemaTypeWithSources","isPayloadOfSchemaType","isPayloadOfSchemaTypeWithMeta","isPayloadOfSchemaTypeWithSources"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xyo-network/payment-payload-plugins",
3
- "version": "3.0.21",
3
+ "version": "3.0.22",
4
4
  "description": "Typescript/Javascript Plugins for XYO Platform",
5
5
  "homepage": "https://xyo.network",
6
6
  "bugs": {
@@ -41,7 +41,8 @@
41
41
  "@xyo-network/id-payload-plugin": "^3.1.11",
42
42
  "@xyo-network/module-model": "^3.1.11",
43
43
  "@xyo-network/payload-model": "^3.1.11",
44
- "@xyo-network/xns-record-payload-plugins": "^3.0.21"
44
+ "@xyo-network/schema-payload-plugin": "^3.1.11",
45
+ "@xyo-network/xns-record-payload-plugins": "^3.0.22"
45
46
  },
46
47
  "devDependencies": {
47
48
  "@xylabs/ts-scripts-yarn3": "^4.0.7",
@@ -0,0 +1,43 @@
1
+ /* eslint-disable unicorn/no-thenable */
2
+ import { SchemaSchema } from '@xyo-network/schema-payload-plugin'
3
+
4
+ import type { Condition } from '../types/index.ts'
5
+
6
+ /**
7
+ * Creates a coupon condition that requires an appraisal amount below a certain value
8
+ * @param maximumAppraisalAmount The maximum appraisal amount
9
+ * @returns A condition that requires an appraisal amount below a certain value
10
+ */
11
+ export const createConditionForMaximumAppraisalAmount = (maximumAppraisalAmount: number): Condition => {
12
+ return {
13
+ schema: SchemaSchema,
14
+ definition: {
15
+ allOf: [
16
+ {
17
+ type: 'array',
18
+ contains: {
19
+ type: 'object',
20
+ properties: {
21
+ schema: { type: 'string', const: 'network.xyo.escrow.terms' },
22
+ appraisals: { type: 'array', minItems: 1 },
23
+ },
24
+ required: ['schema', 'appraisals'],
25
+ },
26
+ },
27
+ {
28
+ type: 'array',
29
+ contains: {
30
+ type: 'object',
31
+ properties: { schema: { type: 'string', const: 'network.xyo.hash.lease.estimate' } },
32
+ required: ['schema'],
33
+ },
34
+ items: {
35
+ type: 'object',
36
+ if: { properties: { schema: { type: 'string', const: 'network.xyo.hash.lease.estimate' } } },
37
+ then: { properties: { price: { type: 'number', maximum: maximumAppraisalAmount } }, required: ['price'] },
38
+ },
39
+ },
40
+ ],
41
+ },
42
+ }
43
+ }
@@ -0,0 +1,25 @@
1
+ import { SchemaSchema } from '@xyo-network/schema-payload-plugin'
2
+
3
+ import type { Condition } from '../types/index.ts'
4
+
5
+ /**
6
+ * Returns a coupon condition that requires a minimum quantity of assets
7
+ * @param minimumAssetQuantity The minimum quantity of assets required
8
+ * @returns A condition that requires a minimum quantity of assets
9
+ */
10
+ export const createConditionForMinimumAssetQuantity = (minimumAssetQuantity: number): Condition => {
11
+ return {
12
+ schema: SchemaSchema,
13
+ definition: {
14
+ type: 'array',
15
+ contains: {
16
+ type: 'object',
17
+ properties: {
18
+ schema: { type: 'string', const: 'network.xyo.escrow.terms' },
19
+ assets: { type: 'array', minItems: minimumAssetQuantity },
20
+ },
21
+ required: ['schema', 'assets'],
22
+ },
23
+ },
24
+ }
25
+ }
@@ -0,0 +1,50 @@
1
+ import type { Address } from '@xylabs/hex'
2
+ import { SchemaSchema } from '@xyo-network/schema-payload-plugin'
3
+
4
+ import type { Condition } from '../types/index.ts'
5
+
6
+ export type BuyerCondition = Condition & {
7
+ definition: {
8
+ contains: {
9
+ properties: {
10
+ buyer: {
11
+ items: {
12
+ const: Address
13
+ type: 'string'
14
+ }
15
+ minItems: 1
16
+ type: 'array'
17
+ }
18
+ schema: { const: 'network.xyo.escrow.terms'; type: 'string' }
19
+ }
20
+ required: ['schema', 'buyer']
21
+ type: 'object'
22
+ }
23
+ type: 'array'
24
+ }
25
+ schema: SchemaSchema
26
+ }
27
+
28
+ /**
29
+ * Creates a coupon condition that requires a specific buyer
30
+ * @param buyer The buyer's address
31
+ * @returns A coupon condition that requires a specific buyer
32
+ */
33
+ export const createConditionForRequiredBuyer = (buyer: Address): BuyerCondition => {
34
+ return {
35
+ schema: SchemaSchema,
36
+ definition: {
37
+ type: 'array',
38
+ contains: {
39
+ type: 'object',
40
+ properties: {
41
+ schema: { type: 'string', const: 'network.xyo.escrow.terms' },
42
+ buyer: {
43
+ type: 'array', items: { type: 'string', const: buyer }, minItems: 1,
44
+ },
45
+ },
46
+ required: ['schema', 'buyer'],
47
+ },
48
+ },
49
+ }
50
+ }
@@ -0,0 +1,3 @@
1
+ export * from './AppraisalAmountCondition.ts'
2
+ export * from './AssetQuantityCondition.ts'
3
+ export * from './BuyerCondition.ts'
@@ -1,3 +1,4 @@
1
+ export * from './Conditions/index.ts'
1
2
  export * from './Coupons/index.ts'
2
3
  export * from './Payload.ts'
3
4
  export * from './Schema.ts'
@@ -0,0 +1,24 @@
1
+ import {
2
+ isPayloadOfSchemaType, isPayloadOfSchemaTypeWithMeta, isPayloadOfSchemaTypeWithSources, type WithMeta, type WithOptionalMeta,
3
+ } from '@xyo-network/payload-model'
4
+ import { type SchemaPayload, SchemaSchema } from '@xyo-network/schema-payload-plugin'
5
+
6
+ /**
7
+ * The payloads that can be used as conditions for a coupon
8
+ */
9
+ export type Condition = SchemaPayload | WithOptionalMeta<SchemaPayload> | WithMeta<SchemaPayload>
10
+
11
+ /**
12
+ * Identity function for determining if an object is a Condition payload
13
+ */
14
+ export const isCondition = isPayloadOfSchemaType<Condition>(SchemaSchema)
15
+
16
+ /**
17
+ * Identity function for determining if an object is a Condition payload with sources
18
+ */
19
+ export const isConditionWithSources = isPayloadOfSchemaTypeWithSources<Condition>(SchemaSchema)
20
+
21
+ /**
22
+ * Identity function for determining if an object is a Condition payload with meta
23
+ */
24
+ export const isConditionWithMeta = isPayloadOfSchemaTypeWithMeta<Condition>(SchemaSchema)
@@ -1,2 +1,3 @@
1
+ export * from './Condition.ts'
1
2
  export * from './CouponFields.ts'
2
3
  export * from './isStackable.ts'