@xyo-network/payment-payload-plugins 3.6.1 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/dist/neutral/index.mjs.map +1 -1
  2. package/dist/types/Amount/Iso4217Currency.d.ts.map +1 -1
  3. package/dist/types/Amount/Payload.d.ts +4 -10
  4. package/dist/types/Amount/Payload.d.ts.map +1 -1
  5. package/dist/types/Billing/Address/Address.d.ts +4 -10
  6. package/dist/types/Billing/Address/Address.d.ts.map +1 -1
  7. package/dist/types/Discount/Params.d.ts +2 -2
  8. package/dist/types/Discount/Params.d.ts.map +1 -1
  9. package/dist/types/Discount/Payload/Coupon/Coupons/FixedAmount.d.ts +4 -10
  10. package/dist/types/Discount/Payload/Coupon/Coupons/FixedAmount.d.ts.map +1 -1
  11. package/dist/types/Discount/Payload/Coupon/Coupons/FixedPercentage.d.ts +4 -10
  12. package/dist/types/Discount/Payload/Coupon/Coupons/FixedPercentage.d.ts.map +1 -1
  13. package/dist/types/Discount/Payload/Coupon/Coupons/FixedPrice.d.ts +4 -10
  14. package/dist/types/Discount/Payload/Coupon/Coupons/FixedPrice.d.ts.map +1 -1
  15. package/dist/types/Discount/Payload/Coupon/Payload.d.ts +2 -8
  16. package/dist/types/Discount/Payload/Coupon/Payload.d.ts.map +1 -1
  17. package/dist/types/Discount/Payload/Coupon/types/Condition.d.ts +2 -8
  18. package/dist/types/Discount/Payload/Coupon/types/Condition.d.ts.map +1 -1
  19. package/dist/types/Discount/Payload/Discount.d.ts +4 -10
  20. package/dist/types/Discount/Payload/Discount.d.ts.map +1 -1
  21. package/dist/types/Escrow/Outcome.d.ts +4 -7
  22. package/dist/types/Escrow/Outcome.d.ts.map +1 -1
  23. package/dist/types/Escrow/Terms/Terms.d.ts +4 -10
  24. package/dist/types/Escrow/Terms/Terms.d.ts.map +1 -1
  25. package/dist/types/Escrow/util/secret/createEscrowIntent.d.ts +1 -1
  26. package/dist/types/Escrow/util/secret/createEscrowIntent.d.ts.map +1 -1
  27. package/dist/types/Escrow/util/secret/updateEscrowTermsWithSecret.d.ts +1 -1
  28. package/dist/types/Escrow/util/secret/updateEscrowTermsWithSecret.d.ts.map +1 -1
  29. package/dist/types/Payment/Instrument/Card/Payload.d.ts +4 -10
  30. package/dist/types/Payment/Instrument/Card/Payload.d.ts.map +1 -1
  31. package/dist/types/Payment/Payload.d.ts +4 -10
  32. package/dist/types/Payment/Payload.d.ts.map +1 -1
  33. package/dist/types/Payment/Status/Payload.d.ts +4 -10
  34. package/dist/types/Payment/Status/Payload.d.ts.map +1 -1
  35. package/dist/types/Purchase/Payload.d.ts +4 -10
  36. package/dist/types/Purchase/Payload.d.ts.map +1 -1
  37. package/dist/types/Receipt/Payload.d.ts +4 -10
  38. package/dist/types/Receipt/Payload.d.ts.map +1 -1
  39. package/dist/types/Subtotal/Diviner/Payload.d.ts +4 -10
  40. package/dist/types/Subtotal/Diviner/Payload.d.ts.map +1 -1
  41. package/dist/types/Total/Diviner/Payload.d.ts +4 -10
  42. package/dist/types/Total/Diviner/Payload.d.ts.map +1 -1
  43. package/package.json +24 -24
  44. package/src/Amount/Iso4217Currency.ts +360 -360
  45. package/src/Discount/Params.ts +3 -3
  46. package/src/Discount/Payload/Coupon/Payload.ts +4 -4
@@ -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/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/Outcome.ts","../../src/Escrow/Schema.ts","../../src/Escrow/Terms/Terms.ts","../../src/Escrow/util/appraisal/getAppraisalsByAsset.ts","../../src/Escrow/util/appraisal/getSignaturesByAppraisal.ts","../../src/Escrow/util/secret/createEscrowIntent.ts","../../src/Escrow/util/secret/findEscrowPartySecretSignatures.ts","../../src/Escrow/util/secret/getEscrowSecret.ts","../../src/Escrow/util/secret/updateEscrowTermsWithSecret.ts","../../src/Escrow/validators/common/ModuleInstanceValidators/moduleInstanceValidators.ts","../../src/Escrow/validators/common/SecretValidators/getPartySecretSignedValidator.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 { AsObjectFactory } from '@xylabs/object'\nimport type { PayloadWithSources, WithSources } from '@xyo-network/payload-model'\nimport {\n isPayloadOfSchemaType,\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)\nexport const asAmount = AsObjectFactory.create<Amount>(isAmount)\nexport const asOptionalAmount = AsObjectFactory.createOptional<Amount>(isAmount)\n\n/**\n * Identity function for determining if an object is an Amount with sources\n */\nexport const isAmountWithSources = isPayloadOfSchemaTypeWithSources<Amount>(AmountSchema)\nexport const asAmountWithSources = AsObjectFactory.create<WithSources<Amount>>(isAmountWithSources)\nexport const asOptionalAmountWithSources = AsObjectFactory.createOptional<WithSources<Amount>>(isAmountWithSources)\n","import { AsObjectFactory } from '@xylabs/object'\nimport type { Payload, WithSources } from '@xyo-network/payload-model'\nimport { isPayloadOfSchemaType, isPayloadOfSchemaTypeWithSources } 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)\nexport const asBillingAddress = AsObjectFactory.create<BillingAddress>(isBillingAddress)\nexport const asOptionalBillingAddress = AsObjectFactory.createOptional<BillingAddress>(isBillingAddress)\n\n/**\n * Identity function for determine if an object is a BillingAddress with sources\n */\nexport const isBillingAddressWithSources = isPayloadOfSchemaTypeWithSources<BillingAddress>(BillingAddressSchema)\nexport const asBillingAddressWithSources = AsObjectFactory.create<WithSources<BillingAddress>>(isBillingAddressWithSources)\nexport const asOptionalBillingAddressWithSources = AsObjectFactory.createOptional<WithSources<BillingAddress>>(isBillingAddressWithSources)\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 { AsObjectFactory } from '@xylabs/object'\nimport type { Payload, WithSources } from '@xyo-network/payload-model'\nimport {\n isPayloadOfSchemaType,\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 = Payload<FixedAmountCouponFields, FixedAmountCouponSchema>\n\n/**\n * Identity function for determining if an object is an FixedAmountCoupon\n */\nexport const isFixedAmountCoupon = isPayloadOfSchemaType<FixedAmountCoupon>(FixedAmountCouponSchema)\nexport const asFixedAmountCoupon = AsObjectFactory.create<FixedAmountCoupon>(isFixedAmountCoupon)\nexport const asOptionalFixedAmountCoupon = AsObjectFactory.createOptional<FixedAmountCoupon>(isFixedAmountCoupon)\n\n/**\n * Identity function for determining if an object is an FixedAmountCoupon with sources\n*/\nexport const isFixedAmountCouponWithSources = isPayloadOfSchemaTypeWithSources<WithSources<FixedAmountCoupon>>(FixedAmountCouponSchema)\nexport const asFixedAmountCouponWithSources = AsObjectFactory.create<WithSources<FixedAmountCoupon>>(isFixedAmountCouponWithSources)\nexport const asOptionalFixedAmountCouponWithSources = AsObjectFactory.createOptional<WithSources<FixedAmountCoupon>>(isFixedAmountCouponWithSources)\n","export const CouponSchema = 'network.xyo.payments.coupon' as const\nexport type CouponSchema = typeof CouponSchema\n","import { AsObjectFactory } from '@xylabs/object'\nimport type { Payload, WithSources } from '@xyo-network/payload-model'\nimport {\n isPayloadOfSchemaType,\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 = Payload<FixedPercentageCouponFields, FixedPercentageCouponSchema>\n\n/**\n * Identity function for determining if an object is an FixedPercentageCoupon\n */\nexport const isFixedPercentageCoupon = isPayloadOfSchemaType<FixedPercentageCoupon>(FixedPercentageCouponSchema)\nexport const asFixedPercentageCoupon = AsObjectFactory.create<FixedPercentageCoupon>(isFixedPercentageCoupon)\nexport const asOptionalFixedPercentageCoupon = AsObjectFactory.createOptional<FixedPercentageCoupon>(isFixedPercentageCoupon)\n\n/**\n * Identity function for determining if an object is an FixedPercentageCoupon with sources\n*/\nexport const isFixedPercentageCouponWithSources = isPayloadOfSchemaTypeWithSources<WithSources<FixedPercentageCoupon>>(FixedPercentageCouponSchema)\nexport const asFixedPercentageCouponWithSources = AsObjectFactory.create<WithSources<FixedPercentageCoupon>>(isFixedPercentageCouponWithSources)\nexport const asOptionalFixedPercentageCouponWithSources = AsObjectFactory.createOptional<WithSources<FixedPercentageCoupon>>(isFixedPercentageCouponWithSources)\n","import { AsObjectFactory } from '@xylabs/object'\nimport type { Payload, WithSources } from '@xyo-network/payload-model'\nimport {\n isPayloadOfSchemaType,\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 = Payload<FixedPriceCouponFields, FixedPriceCouponSchema>\n\n/**\n * Identity function for determining if an object is an FixedPriceCoupon\n */\nexport const isFixedPriceCoupon = isPayloadOfSchemaType<FixedPriceCoupon>(FixedPriceCouponSchema)\nexport const asFixedPriceCoupon = AsObjectFactory.create<FixedPriceCoupon>(isFixedPriceCoupon)\nexport const asOptionalFixedPriceCoupon = AsObjectFactory.createOptional<FixedPriceCoupon>(isFixedPriceCoupon)\n\n/**\n * Identity function for determining if an object is an FixedPriceCoupon with sources\n*/\nexport const isFixedPriceCouponWithSources = isPayloadOfSchemaTypeWithSources<WithSources<FixedPriceCoupon>>(FixedPriceCouponSchema)\nexport const asFixedPriceCouponWithSources = AsObjectFactory.create<WithSources<FixedPriceCoupon>>(isFixedPriceCouponWithSources)\nexport const asOptionalFixedPriceCouponWithSources = AsObjectFactory.createOptional<WithSources<FixedPriceCoupon>>(isFixedPriceCouponWithSources)\n","import { AsObjectFactory } from '@xylabs/object'\n\nimport type {\n FixedAmountCoupon, FixedPercentageCoupon, FixedPriceCoupon,\n} from './Coupons/index.ts'\nimport {\n isFixedAmountCoupon, isFixedAmountCouponWithSources, isFixedPercentageCoupon,\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)\nexport const asCoupon = AsObjectFactory.create(isCoupon)\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)\nexport const asCouponWithSources = AsObjectFactory.create(isCouponWithSources)\n","import { AsObjectFactory } from '@xylabs/object'\nimport { isPayloadOfSchemaType, isPayloadOfSchemaTypeWithSources } from '@xyo-network/payload-model'\nimport type { SchemaPayload } from '@xyo-network/schema-payload-plugin'\nimport { 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\n\n/**\n * Identity function for determining if an object is a Condition payload\n */\nexport const isCondition = isPayloadOfSchemaType<Condition>(SchemaSchema)\nexport const asCondition = AsObjectFactory.create(isCondition)\n\n/**\n * Identity function for determining if an object is a Condition payload with sources\n*/\nexport const isConditionWithSources = isPayloadOfSchemaTypeWithSources<Condition>(SchemaSchema)\nexport const asConditionWithSources = AsObjectFactory.create(isConditionWithSources)\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 { AsObjectFactory } from '@xylabs/object'\nimport type { Payload, WithSources } from '@xyo-network/payload-model'\nimport {\n isPayloadOfSchemaType,\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 = Payload<DiscountFields, DiscountSchema>\n\n/**\n * Identity function for determining if an object is an Discount\n */\nexport const isDiscount = isPayloadOfSchemaType<Discount>(DiscountSchema)\nexport const asDiscount = AsObjectFactory.create<Discount>(isDiscount)\nexport const asOptionalDiscount = AsObjectFactory.createOptional<Discount>(isDiscount)\n\n/**\n * Identity function for determining if an object is an Discount with sources\n */\nexport const isDiscountWithSources = isPayloadOfSchemaTypeWithSources<Discount>(DiscountSchema)\nexport const asDiscountWithSources = AsObjectFactory.create<WithSources<Discount>>(isDiscountWithSources)\nexport const asOptionalDiscountWithSources = AsObjectFactory.createOptional<WithSources<Discount>>(isDiscountWithSources)\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 { Hash } from '@xylabs/hex'\nimport { AsObjectFactory } from '@xylabs/object'\nimport type { PayloadWithSources, WithSources } from '@xyo-network/payload-model'\nimport {\n isPayloadOfSchemaType,\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)\nexport const asEscrowOutcome = AsObjectFactory.create<EscrowOutcome>(isEscrowOutcome)\nexport const asOptionalEscrowOutcome = AsObjectFactory.createOptional<EscrowOutcome>(isEscrowOutcome)\n\n/**\n * Identity function for determining if an object is an EscrowOutcome with sources\n */\nexport const isEscrowOutcomeWithSources = isPayloadOfSchemaTypeWithSources<EscrowOutcome>(EscrowOutcomeSchema)\nexport const asEscrowOutcomeWithSources = AsObjectFactory.createOptional<WithSources<EscrowOutcome>>(isEscrowOutcomeWithSources)\nexport const asOptionalEscrowOutcomeWithSources = AsObjectFactory.createOptional<WithSources<EscrowOutcome>>(isEscrowOutcomeWithSources)\n","export const EscrowSchema = 'network.xyo.escrow'\nexport type EscrowSchema = typeof EscrowSchema\n","import type { Address, Hash } from '@xylabs/hex'\nimport { AsObjectFactory } from '@xylabs/object'\nimport type { Payload } from '@xyo-network/payload-model'\nimport { isPayloadOfSchemaType, isPayloadOfSchemaTypeWithSources } 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)\nexport const asEscrowTerms = AsObjectFactory.create<EscrowTerms>(isEscrowTerms)\nexport const asOptionalEscrowTerms = AsObjectFactory.createOptional<EscrowTerms>(isEscrowTerms)\n\n/**\n * Identity function for determining if an object is an EscrowTerms with sources\n */\nexport const isEscrowTermsWithSources = isPayloadOfSchemaTypeWithSources<EscrowTerms>(EscrowTermsSchema)\nexport const asEscrowTermsWithSources = AsObjectFactory.create<EscrowTerms>(isEscrowTermsWithSources)\nexport const asOptionalEscrowTermsWithSources = AsObjectFactory.createOptional<EscrowTerms>(isEscrowTermsWithSources)\n","import type { Hash } from '@xylabs/hex'\nimport type { HashLeaseEstimate } from '@xyo-network/diviner-hash-lease'\nimport { isHashLeaseEstimateWithSources } from '@xyo-network/diviner-hash-lease'\nimport type { Payload, WithSources } from '@xyo-network/payload-model'\n\nimport type { EscrowTerms } from '../../Terms/index.ts'\n\n/**\n * Returns a dictionary of asset hashes and their associated appraisals\n * @param terms The escrow terms\n * @param dictionary The dictionary of payloads associated with the escrow terms\n * @returns A dictionary of asset hashes and their associated appraisals\n */\nexport const getAppraisalsByAsset = (terms: EscrowTerms, dictionary: Record<Hash, Payload>): Record<Hash, WithSources<HashLeaseEstimate>[]> => {\n const assets = terms.assets\n if (!assets || assets.length === 0) return {}\n const appraisals = Object.values(dictionary).filter(isHashLeaseEstimateWithSources) as unknown as WithSources<HashLeaseEstimate>[]\n const appraisalsByAsset: Record<Hash, WithSources<HashLeaseEstimate>[]> = {}\n for (const estimate of appraisals) {\n const { $sources } = estimate\n if ($sources === undefined || $sources.length === 0) {\n continue\n }\n for (const asset of assets) {\n if ($sources.includes(asset)) {\n if (!appraisalsByAsset[asset]) appraisalsByAsset[asset] = []\n appraisalsByAsset[asset].push(estimate)\n }\n }\n }\n return appraisalsByAsset\n}\n","import type { Hash } from '@xylabs/hex'\nimport type { BoundWitness } from '@xyo-network/boundwitness-model'\nimport { isBoundWitness } from '@xyo-network/boundwitness-model'\nimport type { Payload } from '@xyo-network/payload-model'\n\nimport type { EscrowTerms } from '../../Terms/index.ts'\n\n/**\n * Returns a dictionary of appraisals and their associated bound witnesses which are signed by\n * valid appraisal authorities from the escrow terms\n * @param terms The escrow terms\n * @param dictionary The diction of payloads associated with the escrow terms\n * @returns A dictionary of appraisals and their associated bound witnesses\n */\nexport const getSignaturesByAppraisal = (\n terms: EscrowTerms,\n dictionary: Record<Hash, Payload>,\n): Record<Hash, BoundWitness[]> => {\n // Validate inputs\n const appraisals = terms.appraisals\n if (!appraisals || appraisals.length === 0) return {}\n const appraisalAuthorities = terms.appraisalAuthorities\n if (!appraisalAuthorities || appraisalAuthorities.length === 0) return {}\n\n // Validate the appraisals are signed by valid appraisal authorities. Validation criteria:\n // - The bw includes the appraisal hash from the escrow terms appraisal\n // - The bw is signed by an approved appraisal authority from the escrow terms appraisalAuthorities\n const appraisalBWsValid: Record<Hash, BoundWitness[]> = Object.fromEntries(\n appraisals.map<[Hash, BoundWitness[]]>(hash => [hash, []]),\n )\n for (const bw of Object.values(dictionary).filter(isBoundWitness)) {\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\n return appraisalBWsValid\n}\n","import type { AccountInstance } from '@xyo-network/account-model'\nimport { BoundWitnessBuilder } from '@xyo-network/boundwitness-builder'\nimport type { Id } from '@xyo-network/id-payload-plugin'\n\nimport type { EscrowTerms } from '../../Terms/index.ts'\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: Id, account: AccountInstance) => {\n const result = await new BoundWitnessBuilder().signers([account]).payloads([terms, secret]).build()\n return result\n}\n","import type { Hash } from '@xylabs/hex'\nimport type { BoundWitness } from '@xyo-network/boundwitness-model'\nimport { isBoundWitness } from '@xyo-network/boundwitness-model'\nimport type { Payload } from '@xyo-network/payload-model'\n\nimport type {\n EscrowParty, EscrowPartySecret, EscrowTerms,\n} from '../../Terms/index.ts'\n/**\n * Returns the log prefix for the party\n * @param party The party\n * @returns The log prefix for the party\n */\nconst getLogPrefix = (party: EscrowParty) => {\n const partySecret: EscrowPartySecret = party === 'seller' ? 'sellerSecret' : 'buyerSecret'\n return `EscrowTerms.${partySecret}`\n}\n\n/**\n * Returns an array of BoundWitnesses containing the secret signed by all the parties\n * @param terms The escrow terms\n * @param dictionary A dictionary of all the payloads associated with the escrow\n * @param party The party to get the secret signatures for\n * @returns An array of BoundWitnesses containing the secret signed by all the parties\n */\nexport const findEscrowPartySecretSignatures = (terms: EscrowTerms, dictionary: Record<Hash, Payload>, party: EscrowParty): BoundWitness[] => {\n const partyAddresses = terms[party]\n if (partyAddresses === undefined || partyAddresses.length === 0) {\n console.log(`${getLogPrefix(party)}: No ${party}: ${terms[party]}`)\n return []\n }\n const partySecret: EscrowPartySecret = party === 'seller' ? 'sellerSecret' : 'buyerSecret'\n const secretHash = terms[partySecret]\n if (secretHash === undefined) {\n console.log(`${getLogPrefix(party)}: No ${partySecret}: ${terms[partySecret]}`)\n return []\n }\n // BWs containing the secret signed by all the parties\n const partySignedBWs = Object.values(dictionary)\n // Find all BoundWitnesses\n .filter(isBoundWitness)\n // That contain the seller secret\n .filter(bw => bw.payload_hashes.includes(secretHash))\n // That are signed by all the parties\n .filter(bw => partyAddresses.every(address => bw.addresses.includes(address)))\n return partySignedBWs\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 { AccountInstance } from '@xyo-network/account-model'\nimport { BoundWitnessBuilder } from '@xyo-network/boundwitness-builder'\nimport type { IdPayload } from '@xyo-network/id-payload-plugin'\nimport { PayloadBuilder } from '@xyo-network/payload-builder'\n\nimport type {\n EscrowParty, EscrowPartySecret, EscrowTerms,\n} from '../../Terms/index.ts'\nimport { getEscrowSecret } from './getEscrowSecret.ts'\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 escrowParty The party in the escrow transaction\n * @param account The account(s) to create the escrow intent with\n * @param secret The secret for the escrow principal party to use for the escrow. If\n * not provided, a cryptographically random secret will be generated.\n * @returns The escrow intent\n */\nexport const updateEscrowTermsWithSecret = async (\n terms: EscrowTerms,\n escrowParty: EscrowParty,\n account: AccountInstance | AccountInstance[],\n secret?: IdPayload,\n) => {\n if (!secret) secret = getEscrowSecret()\n const signers = Array.isArray(account) ? account : [account]\n // Add party addresses to escrow terms\n terms[escrowParty] = signers.map(signer => signer.address)\n // Add secret hash to terms\n const secretType: EscrowPartySecret = escrowParty === 'buyer' ? 'buyerSecret' : 'sellerSecret'\n const secretHash = await PayloadBuilder.dataHash(secret)\n terms[secretType] = secretHash\n // Have the parties sign the secret and terms\n const result = await new BoundWitnessBuilder().signers(signers).payloads([terms, secret]).build()\n return result\n}\n","import type { ModuleIdentifier } from '@xyo-network/module-model'\nimport type { PayloadValueExpression } from '@xyo-network/payload-model'\n\nimport type { EscrowTerms } from '../../../Terms/index.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","import type { Hash } from '@xylabs/hex'\nimport { BoundWitnessValidator } from '@xyo-network/boundwitness-validator'\nimport type { AsyncPayloadValidationFunction, Payload } from '@xyo-network/payload-model'\n\nimport type {\n EscrowParty, EscrowPartySecret, EscrowTerms,\n} from '../../../Terms/index.ts'\nimport { findEscrowPartySecretSignatures } from '../../../util/index.ts'\n\n/**\n * Returns the log prefix for the party\n * @param party The party\n * @returns The log prefix for the party\n */\nconst getLogPrefix = (party: EscrowParty) => {\n const partySecret: EscrowPartySecret = party === 'seller' ? 'sellerSecret' : 'buyerSecret'\n return `EscrowTerms.${partySecret}`\n}\n\n/**\n * Returns a function that validates the escrow terms for the existence of the party secret signed by the party\n * @param dictionary Payload dictionary of the escrow terms\n * @returns A function that validates the escrow terms for the existence of the party secret signed by the party\n */\nexport const getPartySecretSignedValidator = (dictionary: Record<Hash, Payload>, party: EscrowParty): AsyncPayloadValidationFunction<EscrowTerms> => {\n const partySecret: EscrowPartySecret = party === 'seller' ? 'sellerSecret' : 'buyerSecret'\n return async (terms: EscrowTerms): Promise<boolean> => {\n // Party-signed party secret BWs\n const buyerSecretBWs = findEscrowPartySecretSignatures(terms, dictionary, party)\n\n // If there are no BWs, return false\n if (buyerSecretBWs.length === 0) {\n console.log(`${getLogPrefix(party)}: No BoundWitnesses supplied for ${partySecret}: ${terms[partySecret]}`)\n return false\n }\n\n // Ensure each BW supplied for the party secret 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(`${getLogPrefix(party)}: Invalid BoundWitnesses supplied for ${partySecret}: ${terms[partySecret]}`)\n return false\n }\n return true\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 return !(value.exp === undefined || value.exp < exp)\n}\n","import type { ModuleIdentifier } from '@xyo-network/module-model'\nimport type { SyncPayloadValidationFunction } from '@xyo-network/payload-model'\n\nimport type { EscrowTerms } from '../../Terms/index.ts'\nimport { moduleIdentifiersContainsOneOf } from '../common/index.ts'\n\nconst name = 'EscrowTerms.escrowAgent'\n\nexport const getEscrowAgentAllowedValidator = (allowedEscrowAgent: ModuleIdentifier): SyncPayloadValidationFunction<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 { isBoundWitness } from '@xyo-network/boundwitness-model'\nimport type { HashLeaseEstimate } from '@xyo-network/diviner-hash-lease'\nimport type {\n Payload, SyncPayloadValidationFunction, WithSources,\n} from '@xyo-network/payload-model'\n\nimport type { EscrowTerms } from '../../Terms/index.ts'\nimport { getAppraisalsByAsset } from '../../util/index.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: SyncPayloadValidationFunction<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, Payload>): SyncPayloadValidationFunction<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, BoundWitness[]> = Object.fromEntries(\n appraisals.map<[Hash, BoundWitness[]]>(hash => [hash, []]),\n )\n for (const bw of Object.values(dictionary).filter(isBoundWitness)) {\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, Payload>,\n minimumExp: number,\n): SyncPayloadValidationFunction<EscrowTerms> => {\n return (terms: EscrowTerms) => {\n // Verify we have an estimate for each of the assets\n const estimatesByAsset = getAppraisalsByAsset(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, Payload>): SyncPayloadValidationFunction<EscrowTerms> => {\n return (terms: EscrowTerms) => {\n // Verify we have an estimate for each of the assets\n const assets = assertEx(terms.assets, () => `${name}: No assets: ${terms.assets}`)\n const estimatesByAsset = getAppraisalsByAsset(terms, dictionary)\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 return (estimate.price >= 0)\n}\n","import { asAddress } from '@xylabs/hex'\nimport type { ModuleIdentifier } from '@xyo-network/module-model'\nimport type { SyncPayloadValidationFunction } from '@xyo-network/payload-model'\n\nimport type { EscrowTerms } from '../../Terms/index.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: SyncPayloadValidationFunction<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[]): SyncPayloadValidationFunction<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 { SyncPayloadValidationFunction } from '@xyo-network/payload-model'\n\nimport type { EscrowTerms } from '../../Terms/index.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: SyncPayloadValidationFunction<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 { SyncPayloadValidationFunction } from '@xyo-network/payload-model'\n\nimport type { EscrowTerms } from '../../Terms/index.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: SyncPayloadValidationFunction<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 type {\n AsyncPayloadValidationFunction, Payload, SyncPayloadValidationFunction,\n} from '@xyo-network/payload-model'\n\nimport type { EscrowTerms } from '../../Terms/index.ts'\nimport { getPartySecretSignedValidator } from '../common/index.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: SyncPayloadValidationFunction<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, Payload>): SyncPayloadValidationFunction<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, Payload>): AsyncPayloadValidationFunction<EscrowTerms> => {\n return getPartySecretSignedValidator(dictionary, 'buyer')\n}\n","import type { SyncPayloadValidationFunction } from '@xyo-network/payload-model'\n\nimport type { EscrowTerms } from '../../Terms/index.ts'\n\nexport const getNbfExpValidator = (now: number, minRequiredDuration: number): SyncPayloadValidationFunction<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 { SyncPayloadValidationFunction } from '@xyo-network/payload-model'\n\nimport type { EscrowTerms } from '../../Terms/index.ts'\nimport { moduleIdentifiersContainsAllOf } from '../common/index.ts'\n\nconst name = 'EscrowTerms.paymentAuthorities'\n\nexport const getPaymentAuthoritiesAllowedValidator = (allowed: ModuleIdentifier[]): SyncPayloadValidationFunction<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 { SyncPayloadValidationFunction } from '@xyo-network/payload-model'\n\nimport type { EscrowTerms } from '../../Terms/index.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: SyncPayloadValidationFunction<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 type {\n AsyncPayloadValidationFunction, Payload, SyncPayloadValidationFunction,\n} from '@xyo-network/payload-model'\n\nimport type { EscrowTerms } from '../../Terms/index.ts'\nimport { getPartySecretSignedValidator } from '../common/index.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: SyncPayloadValidationFunction<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, Payload>): SyncPayloadValidationFunction<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, Payload>): AsyncPayloadValidationFunction<EscrowTerms> => {\n return getPartySecretSignedValidator(dictionary, 'seller')\n}\n","import { AsObjectFactory } from '@xylabs/object'\nimport type { Payload, WithSources } from '@xyo-network/payload-model'\nimport { isPayloadOfSchemaType, isPayloadOfSchemaTypeWithSources } 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)\nexport const asPaymentCard = AsObjectFactory.create<PaymentCard>(isPaymentCard)\nexport const asOptionalPaymentCard = AsObjectFactory.createOptional<PaymentCard>(isPaymentCard)\n\n/**\n * Identity function for determine if an object is a PaymentCard with sources\n */\nexport const isPaymentCardWithSources = isPayloadOfSchemaTypeWithSources<PaymentCard>(PaymentCardSchema)\nexport const asPaymentCardWithSources = AsObjectFactory.create<WithSources<PaymentCard>>(isPaymentCardWithSources)\nexport const asOptionalPaymentCardWithSources = AsObjectFactory.createOptional<WithSources<PaymentCard>>(isPaymentCardWithSources)\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 { AsObjectFactory } from '@xylabs/object'\nimport type { PayloadWithSources, WithSources } from '@xyo-network/payload-model'\nimport {\n isPayloadOfSchemaType,\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)\nexport const asPayment = AsObjectFactory.create<Payment>(isPayment)\nexport const asOptionalPayment = AsObjectFactory.createOptional<Payment>(isPayment)\n\n/**\n * Identity function for determine if an object is a Payment with sources\n */\nexport const isPaymentWithSources = isPayloadOfSchemaTypeWithSources<Payment>(PaymentSchema)\nexport const asPaymentWithSources = AsObjectFactory.create<WithSources<Payment>>(isPaymentWithSources)\nexport const asOptionalPaymentWithSources = AsObjectFactory.createOptional<WithSources<Payment>>(isPaymentWithSources)\n","import { AsObjectFactory } from '@xylabs/object'\nimport type { PayloadWithSources, WithSources } from '@xyo-network/payload-model'\nimport {\n isPayloadOfSchemaType,\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)\nexport const asPaymentStatus = AsObjectFactory.create<PaymentStatus>(isPaymentStatus)\nexport const asOptionalPaymentStatus = AsObjectFactory.createOptional<PaymentStatus>(isPaymentStatus)\n\n/**\n * Identity function for determine if an object is a PaymentStatus with sources\n */\nexport const isPaymentStatusWithSources = isPayloadOfSchemaTypeWithSources<PaymentStatus>(PaymentStatusSchema)\nexport const asPaymentStatusWithSources = AsObjectFactory.create<WithSources<PaymentStatus>>(isPaymentStatusWithSources)\nexport const asOptionalPaymentStatusWithSources = AsObjectFactory.createOptional<WithSources<PaymentStatus>>(isPaymentStatusWithSources)\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 { AsObjectFactory } from '@xylabs/object'\nimport type { PayloadWithSources, WithSources } from '@xyo-network/payload-model'\nimport {\n isPayloadOfSchemaType,\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)\nexport const asPurchase = AsObjectFactory.create<Purchase>(isPurchase)\nexport const asOptionalPurchase = AsObjectFactory.createOptional<Purchase>(isPurchase)\n\n/**\n * Identity function for determine if an object is a Purchase with sources\n */\nexport const isPurchaseWithSources = isPayloadOfSchemaTypeWithSources<Purchase>(PurchaseSchema)\nexport const asPurchaseWithSources = AsObjectFactory.create<WithSources<Purchase>>(isPurchaseWithSources)\nexport const asOptionalPurchaseWithSources = AsObjectFactory.createOptional<WithSources<Purchase>>(isPurchaseWithSources)\n","import { PaymentsSchema } from '../Schema.ts'\n\nexport const PurchaseSchema = `${PaymentsSchema}.purchase`\nexport type PurchaseSchema = typeof PurchaseSchema\n","import { AsObjectFactory } from '@xylabs/object'\nimport type { PayloadWithSources, WithSources } from '@xyo-network/payload-model'\nimport {\n isPayloadOfSchemaType,\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)\nexport const asReceipt = AsObjectFactory.create<Receipt>(isReceipt)\nexport const asOptionalReceipt = AsObjectFactory.createOptional<Receipt>(isReceipt)\n\n/**\n * Identity function for determine if an object is a Receipt with sources\n */\nexport const isReceiptWithSources = isPayloadOfSchemaTypeWithSources<Receipt>(ReceiptSchema)\nexport const asReceiptWithSources = AsObjectFactory.create<WithSources<Receipt>>(isReceiptWithSources)\nexport const asOptionalReceiptWithSources = AsObjectFactory.createOptional<WithSources<Receipt>>(isReceiptWithSources)\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 { AsObjectFactory } from '@xylabs/object'\nimport type { PayloadWithSources, WithSources } from '@xyo-network/payload-model'\nimport {\n isPayloadOfSchemaType,\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)\nexport const asSubtotal = AsObjectFactory.create<Subtotal>(isSubtotal)\nexport const asOptionalSubtotal = AsObjectFactory.createOptional<Subtotal>(isSubtotal)\n\n/**\n * Identity function for determining if an object is an Subtotal with sources\n */\nexport const isSubtotalWithSources = isPayloadOfSchemaTypeWithSources<Subtotal>(SubtotalSchema)\nexport const asSubtotalWithSources = AsObjectFactory.create<WithSources<Subtotal>>(isSubtotalWithSources)\nexport const asOptionalSubtotalWithSources = AsObjectFactory.createOptional<WithSources<Subtotal>>(isSubtotalWithSources)\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 { AsObjectFactory } from '@xylabs/object'\nimport type { PayloadWithSources, WithSources } from '@xyo-network/payload-model'\nimport {\n isPayloadOfSchemaType,\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)\nexport const asTotal = AsObjectFactory.create<Total>(isTotal)\nexport const asOptionalTotal = AsObjectFactory.createOptional<Total>(isTotal)\n\n/**\n * Identity function for determining if an object is an Total with sources\n */\nexport const isTotalWithSources = isPayloadOfSchemaTypeWithSources<Total>(TotalSchema)\nexport const asTotalWithSources = AsObjectFactory.create<WithSources<Total>>(isTotalWithSources)\nexport const asOptionalTotalWithSources = AsObjectFactory.createOptional<WithSources<Total>>(isTotalWithSources)\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,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BjH,IAAM,kCAAkC;;;ACJ/C,SAAS,mBAAAG,yBAAuB;AAEhC;AAAA,EACE,yBAAAC;AAAA,EACA,oCAAAC;AAAA,OACK;AAIA,IAAM,cAAc;AAapB,IAAM,UAAUD,wBAA6B,WAAW;AACxD,IAAM,UAAUD,kBAAgB,OAAc,OAAO;AACrD,IAAM,kBAAkBA,kBAAgB,eAAsB,OAAO;AAKrE,IAAM,qBAAqBE,mCAAwC,WAAW;AAC9E,IAAM,qBAAqBF,kBAAgB,OAA2B,kBAAkB;AACxF,IAAM,6BAA6BA,kBAAgB,eAAmC,kBAAkB;","names":["AsObjectFactory","isPayloadOfSchemaType","isPayloadOfSchemaTypeWithSources","isPayloadOfSchemaType","AsObjectFactory","isPayloadOfSchemaTypeWithSources","SchemaSchema","SchemaSchema","AsObjectFactory","isPayloadOfSchemaType","isPayloadOfSchemaTypeWithSources","isPayloadOfSchemaType","AsObjectFactory","isPayloadOfSchemaTypeWithSources","AsObjectFactory","isPayloadOfSchemaType","isPayloadOfSchemaTypeWithSources","isPayloadOfSchemaType","AsObjectFactory","isPayloadOfSchemaTypeWithSources","AsObjectFactory","isPayloadOfSchemaType","isPayloadOfSchemaTypeWithSources","isPayloadOfSchemaType","AsObjectFactory","isPayloadOfSchemaTypeWithSources","AsObjectFactory","AsObjectFactory","AsObjectFactory","isPayloadOfSchemaType","isPayloadOfSchemaTypeWithSources","SchemaSchema","AsObjectFactory","isPayloadOfSchemaType","isPayloadOfSchemaTypeWithSources","AsObjectFactory","isPayloadOfSchemaType","isPayloadOfSchemaTypeWithSources","isPayloadOfSchemaType","AsObjectFactory","isPayloadOfSchemaTypeWithSources","AsObjectFactory","isPayloadOfSchemaType","isPayloadOfSchemaTypeWithSources","isPayloadOfSchemaType","AsObjectFactory","isPayloadOfSchemaTypeWithSources","isBoundWitness","BoundWitnessBuilder","BoundWitnessBuilder","getLogPrefix","errors","isBoundWitness","name","isBoundWitness","name","name","asAddress","name","assertEx","name","assertEx","name","asAddress","name","assertEx","name","assertEx","AsObjectFactory","isPayloadOfSchemaType","isPayloadOfSchemaTypeWithSources","isPayloadOfSchemaType","AsObjectFactory","isPayloadOfSchemaTypeWithSources","AsObjectFactory","isPayloadOfSchemaType","isPayloadOfSchemaTypeWithSources","isPayloadOfSchemaType","AsObjectFactory","isPayloadOfSchemaTypeWithSources","AsObjectFactory","isPayloadOfSchemaType","isPayloadOfSchemaTypeWithSources","isPayloadOfSchemaType","AsObjectFactory","isPayloadOfSchemaTypeWithSources","AsObjectFactory","isPayloadOfSchemaType","isPayloadOfSchemaTypeWithSources","isPayloadOfSchemaType","AsObjectFactory","isPayloadOfSchemaTypeWithSources","AsObjectFactory","isPayloadOfSchemaType","isPayloadOfSchemaTypeWithSources","isPayloadOfSchemaType","AsObjectFactory","isPayloadOfSchemaTypeWithSources","AsObjectFactory","isPayloadOfSchemaType","isPayloadOfSchemaTypeWithSources","AsObjectFactory","isPayloadOfSchemaType","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/Outcome.ts","../../src/Escrow/Schema.ts","../../src/Escrow/Terms/Terms.ts","../../src/Escrow/util/appraisal/getAppraisalsByAsset.ts","../../src/Escrow/util/appraisal/getSignaturesByAppraisal.ts","../../src/Escrow/util/secret/createEscrowIntent.ts","../../src/Escrow/util/secret/findEscrowPartySecretSignatures.ts","../../src/Escrow/util/secret/getEscrowSecret.ts","../../src/Escrow/util/secret/updateEscrowTermsWithSecret.ts","../../src/Escrow/validators/common/ModuleInstanceValidators/moduleInstanceValidators.ts","../../src/Escrow/validators/common/SecretValidators/getPartySecretSignedValidator.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 { AsObjectFactory } from '@xylabs/object'\nimport type { PayloadWithSources, WithSources } from '@xyo-network/payload-model'\nimport {\n isPayloadOfSchemaType,\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)\nexport const asAmount = AsObjectFactory.create<Amount>(isAmount)\nexport const asOptionalAmount = AsObjectFactory.createOptional<Amount>(isAmount)\n\n/**\n * Identity function for determining if an object is an Amount with sources\n */\nexport const isAmountWithSources = isPayloadOfSchemaTypeWithSources<Amount>(AmountSchema)\nexport const asAmountWithSources = AsObjectFactory.create<WithSources<Amount>>(isAmountWithSources)\nexport const asOptionalAmountWithSources = AsObjectFactory.createOptional<WithSources<Amount>>(isAmountWithSources)\n","import { AsObjectFactory } from '@xylabs/object'\nimport type { Payload, WithSources } from '@xyo-network/payload-model'\nimport { isPayloadOfSchemaType, isPayloadOfSchemaTypeWithSources } 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)\nexport const asBillingAddress = AsObjectFactory.create<BillingAddress>(isBillingAddress)\nexport const asOptionalBillingAddress = AsObjectFactory.createOptional<BillingAddress>(isBillingAddress)\n\n/**\n * Identity function for determine if an object is a BillingAddress with sources\n */\nexport const isBillingAddressWithSources = isPayloadOfSchemaTypeWithSources<BillingAddress>(BillingAddressSchema)\nexport const asBillingAddressWithSources = AsObjectFactory.create<WithSources<BillingAddress>>(isBillingAddressWithSources)\nexport const asOptionalBillingAddressWithSources = AsObjectFactory.createOptional<WithSources<BillingAddress>>(isBillingAddressWithSources)\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 { AsObjectFactory } from '@xylabs/object'\nimport type { Payload, WithSources } from '@xyo-network/payload-model'\nimport {\n isPayloadOfSchemaType,\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 = Payload<FixedAmountCouponFields, FixedAmountCouponSchema>\n\n/**\n * Identity function for determining if an object is an FixedAmountCoupon\n */\nexport const isFixedAmountCoupon = isPayloadOfSchemaType<FixedAmountCoupon>(FixedAmountCouponSchema)\nexport const asFixedAmountCoupon = AsObjectFactory.create<FixedAmountCoupon>(isFixedAmountCoupon)\nexport const asOptionalFixedAmountCoupon = AsObjectFactory.createOptional<FixedAmountCoupon>(isFixedAmountCoupon)\n\n/**\n * Identity function for determining if an object is an FixedAmountCoupon with sources\n*/\nexport const isFixedAmountCouponWithSources = isPayloadOfSchemaTypeWithSources<WithSources<FixedAmountCoupon>>(FixedAmountCouponSchema)\nexport const asFixedAmountCouponWithSources = AsObjectFactory.create<WithSources<FixedAmountCoupon>>(isFixedAmountCouponWithSources)\nexport const asOptionalFixedAmountCouponWithSources = AsObjectFactory.createOptional<WithSources<FixedAmountCoupon>>(isFixedAmountCouponWithSources)\n","export const CouponSchema = 'network.xyo.payments.coupon' as const\nexport type CouponSchema = typeof CouponSchema\n","import { AsObjectFactory } from '@xylabs/object'\nimport type { Payload, WithSources } from '@xyo-network/payload-model'\nimport {\n isPayloadOfSchemaType,\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 = Payload<FixedPercentageCouponFields, FixedPercentageCouponSchema>\n\n/**\n * Identity function for determining if an object is an FixedPercentageCoupon\n */\nexport const isFixedPercentageCoupon = isPayloadOfSchemaType<FixedPercentageCoupon>(FixedPercentageCouponSchema)\nexport const asFixedPercentageCoupon = AsObjectFactory.create<FixedPercentageCoupon>(isFixedPercentageCoupon)\nexport const asOptionalFixedPercentageCoupon = AsObjectFactory.createOptional<FixedPercentageCoupon>(isFixedPercentageCoupon)\n\n/**\n * Identity function for determining if an object is an FixedPercentageCoupon with sources\n*/\nexport const isFixedPercentageCouponWithSources = isPayloadOfSchemaTypeWithSources<WithSources<FixedPercentageCoupon>>(FixedPercentageCouponSchema)\nexport const asFixedPercentageCouponWithSources = AsObjectFactory.create<WithSources<FixedPercentageCoupon>>(isFixedPercentageCouponWithSources)\nexport const asOptionalFixedPercentageCouponWithSources = AsObjectFactory.createOptional<WithSources<FixedPercentageCoupon>>(isFixedPercentageCouponWithSources)\n","import { AsObjectFactory } from '@xylabs/object'\nimport type { Payload, WithSources } from '@xyo-network/payload-model'\nimport {\n isPayloadOfSchemaType,\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 = Payload<FixedPriceCouponFields, FixedPriceCouponSchema>\n\n/**\n * Identity function for determining if an object is an FixedPriceCoupon\n */\nexport const isFixedPriceCoupon = isPayloadOfSchemaType<FixedPriceCoupon>(FixedPriceCouponSchema)\nexport const asFixedPriceCoupon = AsObjectFactory.create<FixedPriceCoupon>(isFixedPriceCoupon)\nexport const asOptionalFixedPriceCoupon = AsObjectFactory.createOptional<FixedPriceCoupon>(isFixedPriceCoupon)\n\n/**\n * Identity function for determining if an object is an FixedPriceCoupon with sources\n*/\nexport const isFixedPriceCouponWithSources = isPayloadOfSchemaTypeWithSources<WithSources<FixedPriceCoupon>>(FixedPriceCouponSchema)\nexport const asFixedPriceCouponWithSources = AsObjectFactory.create<WithSources<FixedPriceCoupon>>(isFixedPriceCouponWithSources)\nexport const asOptionalFixedPriceCouponWithSources = AsObjectFactory.createOptional<WithSources<FixedPriceCoupon>>(isFixedPriceCouponWithSources)\n","import { AsObjectFactory } from '@xylabs/object'\n\nimport type {\n FixedAmountCoupon, FixedPercentageCoupon, FixedPriceCoupon,\n} from './Coupons/index.ts'\nimport {\n isFixedAmountCoupon, isFixedAmountCouponWithSources, isFixedPercentageCoupon,\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)\nexport const asCoupon = AsObjectFactory.create(isCoupon)\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)\nexport const asCouponWithSources = AsObjectFactory.create(isCouponWithSources)\n","import { AsObjectFactory } from '@xylabs/object'\nimport { isPayloadOfSchemaType, isPayloadOfSchemaTypeWithSources } from '@xyo-network/payload-model'\nimport type { SchemaPayload } from '@xyo-network/schema-payload-plugin'\nimport { 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\n\n/**\n * Identity function for determining if an object is a Condition payload\n */\nexport const isCondition = isPayloadOfSchemaType<Condition>(SchemaSchema)\nexport const asCondition = AsObjectFactory.create(isCondition)\n\n/**\n * Identity function for determining if an object is a Condition payload with sources\n*/\nexport const isConditionWithSources = isPayloadOfSchemaTypeWithSources<Condition>(SchemaSchema)\nexport const asConditionWithSources = AsObjectFactory.create(isConditionWithSources)\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 { AsObjectFactory } from '@xylabs/object'\nimport type { Payload, WithSources } from '@xyo-network/payload-model'\nimport {\n isPayloadOfSchemaType,\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 = Payload<DiscountFields, DiscountSchema>\n\n/**\n * Identity function for determining if an object is an Discount\n */\nexport const isDiscount = isPayloadOfSchemaType<Discount>(DiscountSchema)\nexport const asDiscount = AsObjectFactory.create<Discount>(isDiscount)\nexport const asOptionalDiscount = AsObjectFactory.createOptional<Discount>(isDiscount)\n\n/**\n * Identity function for determining if an object is an Discount with sources\n */\nexport const isDiscountWithSources = isPayloadOfSchemaTypeWithSources<Discount>(DiscountSchema)\nexport const asDiscountWithSources = AsObjectFactory.create<WithSources<Discount>>(isDiscountWithSources)\nexport const asOptionalDiscountWithSources = AsObjectFactory.createOptional<WithSources<Discount>>(isDiscountWithSources)\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 { Hash } from '@xylabs/hex'\nimport { AsObjectFactory } from '@xylabs/object'\nimport type { PayloadWithSources, WithSources } from '@xyo-network/payload-model'\nimport {\n isPayloadOfSchemaType,\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)\nexport const asEscrowOutcome = AsObjectFactory.create<EscrowOutcome>(isEscrowOutcome)\nexport const asOptionalEscrowOutcome = AsObjectFactory.createOptional<EscrowOutcome>(isEscrowOutcome)\n\n/**\n * Identity function for determining if an object is an EscrowOutcome with sources\n */\nexport const isEscrowOutcomeWithSources = isPayloadOfSchemaTypeWithSources<EscrowOutcome>(EscrowOutcomeSchema)\nexport const asEscrowOutcomeWithSources = AsObjectFactory.createOptional<WithSources<EscrowOutcome>>(isEscrowOutcomeWithSources)\nexport const asOptionalEscrowOutcomeWithSources = AsObjectFactory.createOptional<WithSources<EscrowOutcome>>(isEscrowOutcomeWithSources)\n","export const EscrowSchema = 'network.xyo.escrow'\nexport type EscrowSchema = typeof EscrowSchema\n","import type { Address, Hash } from '@xylabs/hex'\nimport { AsObjectFactory } from '@xylabs/object'\nimport type { Payload } from '@xyo-network/payload-model'\nimport { isPayloadOfSchemaType, isPayloadOfSchemaTypeWithSources } 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)\nexport const asEscrowTerms = AsObjectFactory.create<EscrowTerms>(isEscrowTerms)\nexport const asOptionalEscrowTerms = AsObjectFactory.createOptional<EscrowTerms>(isEscrowTerms)\n\n/**\n * Identity function for determining if an object is an EscrowTerms with sources\n */\nexport const isEscrowTermsWithSources = isPayloadOfSchemaTypeWithSources<EscrowTerms>(EscrowTermsSchema)\nexport const asEscrowTermsWithSources = AsObjectFactory.create<EscrowTerms>(isEscrowTermsWithSources)\nexport const asOptionalEscrowTermsWithSources = AsObjectFactory.createOptional<EscrowTerms>(isEscrowTermsWithSources)\n","import type { Hash } from '@xylabs/hex'\nimport type { HashLeaseEstimate } from '@xyo-network/diviner-hash-lease'\nimport { isHashLeaseEstimateWithSources } from '@xyo-network/diviner-hash-lease'\nimport type { Payload, WithSources } from '@xyo-network/payload-model'\n\nimport type { EscrowTerms } from '../../Terms/index.ts'\n\n/**\n * Returns a dictionary of asset hashes and their associated appraisals\n * @param terms The escrow terms\n * @param dictionary The dictionary of payloads associated with the escrow terms\n * @returns A dictionary of asset hashes and their associated appraisals\n */\nexport const getAppraisalsByAsset = (terms: EscrowTerms, dictionary: Record<Hash, Payload>): Record<Hash, WithSources<HashLeaseEstimate>[]> => {\n const assets = terms.assets\n if (!assets || assets.length === 0) return {}\n const appraisals = Object.values(dictionary).filter(isHashLeaseEstimateWithSources) as unknown as WithSources<HashLeaseEstimate>[]\n const appraisalsByAsset: Record<Hash, WithSources<HashLeaseEstimate>[]> = {}\n for (const estimate of appraisals) {\n const { $sources } = estimate\n if ($sources === undefined || $sources.length === 0) {\n continue\n }\n for (const asset of assets) {\n if ($sources.includes(asset)) {\n if (!appraisalsByAsset[asset]) appraisalsByAsset[asset] = []\n appraisalsByAsset[asset].push(estimate)\n }\n }\n }\n return appraisalsByAsset\n}\n","import type { Hash } from '@xylabs/hex'\nimport type { BoundWitness } from '@xyo-network/boundwitness-model'\nimport { isBoundWitness } from '@xyo-network/boundwitness-model'\nimport type { Payload } from '@xyo-network/payload-model'\n\nimport type { EscrowTerms } from '../../Terms/index.ts'\n\n/**\n * Returns a dictionary of appraisals and their associated bound witnesses which are signed by\n * valid appraisal authorities from the escrow terms\n * @param terms The escrow terms\n * @param dictionary The diction of payloads associated with the escrow terms\n * @returns A dictionary of appraisals and their associated bound witnesses\n */\nexport const getSignaturesByAppraisal = (\n terms: EscrowTerms,\n dictionary: Record<Hash, Payload>,\n): Record<Hash, BoundWitness[]> => {\n // Validate inputs\n const appraisals = terms.appraisals\n if (!appraisals || appraisals.length === 0) return {}\n const appraisalAuthorities = terms.appraisalAuthorities\n if (!appraisalAuthorities || appraisalAuthorities.length === 0) return {}\n\n // Validate the appraisals are signed by valid appraisal authorities. Validation criteria:\n // - The bw includes the appraisal hash from the escrow terms appraisal\n // - The bw is signed by an approved appraisal authority from the escrow terms appraisalAuthorities\n const appraisalBWsValid: Record<Hash, BoundWitness[]> = Object.fromEntries(\n appraisals.map<[Hash, BoundWitness[]]>(hash => [hash, []]),\n )\n for (const bw of Object.values(dictionary).filter(isBoundWitness)) {\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\n return appraisalBWsValid\n}\n","import type { AccountInstance } from '@xyo-network/account-model'\nimport { BoundWitnessBuilder } from '@xyo-network/boundwitness-builder'\nimport type { Id } from '@xyo-network/id-payload-plugin'\n\nimport type { EscrowTerms } from '../../Terms/index.ts'\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: Id, account: AccountInstance) => {\n const result = await new BoundWitnessBuilder().signers([account]).payloads([terms, secret]).build()\n return result\n}\n","import type { Hash } from '@xylabs/hex'\nimport type { BoundWitness } from '@xyo-network/boundwitness-model'\nimport { isBoundWitness } from '@xyo-network/boundwitness-model'\nimport type { Payload } from '@xyo-network/payload-model'\n\nimport type {\n EscrowParty, EscrowPartySecret, EscrowTerms,\n} from '../../Terms/index.ts'\n/**\n * Returns the log prefix for the party\n * @param party The party\n * @returns The log prefix for the party\n */\nconst getLogPrefix = (party: EscrowParty) => {\n const partySecret: EscrowPartySecret = party === 'seller' ? 'sellerSecret' : 'buyerSecret'\n return `EscrowTerms.${partySecret}`\n}\n\n/**\n * Returns an array of BoundWitnesses containing the secret signed by all the parties\n * @param terms The escrow terms\n * @param dictionary A dictionary of all the payloads associated with the escrow\n * @param party The party to get the secret signatures for\n * @returns An array of BoundWitnesses containing the secret signed by all the parties\n */\nexport const findEscrowPartySecretSignatures = (terms: EscrowTerms, dictionary: Record<Hash, Payload>, party: EscrowParty): BoundWitness[] => {\n const partyAddresses = terms[party]\n if (partyAddresses === undefined || partyAddresses.length === 0) {\n console.log(`${getLogPrefix(party)}: No ${party}: ${terms[party]}`)\n return []\n }\n const partySecret: EscrowPartySecret = party === 'seller' ? 'sellerSecret' : 'buyerSecret'\n const secretHash = terms[partySecret]\n if (secretHash === undefined) {\n console.log(`${getLogPrefix(party)}: No ${partySecret}: ${terms[partySecret]}`)\n return []\n }\n // BWs containing the secret signed by all the parties\n const partySignedBWs = Object.values(dictionary)\n // Find all BoundWitnesses\n .filter(isBoundWitness)\n // That contain the seller secret\n .filter(bw => bw.payload_hashes.includes(secretHash))\n // That are signed by all the parties\n .filter(bw => partyAddresses.every(address => bw.addresses.includes(address)))\n return partySignedBWs\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 { AccountInstance } from '@xyo-network/account-model'\nimport { BoundWitnessBuilder } from '@xyo-network/boundwitness-builder'\nimport type { IdPayload } from '@xyo-network/id-payload-plugin'\nimport { PayloadBuilder } from '@xyo-network/payload-builder'\n\nimport type {\n EscrowParty, EscrowPartySecret, EscrowTerms,\n} from '../../Terms/index.ts'\nimport { getEscrowSecret } from './getEscrowSecret.ts'\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 escrowParty The party in the escrow transaction\n * @param account The account(s) to create the escrow intent with\n * @param secret The secret for the escrow principal party to use for the escrow. If\n * not provided, a cryptographically random secret will be generated.\n * @returns The escrow intent\n */\nexport const updateEscrowTermsWithSecret = async (\n terms: EscrowTerms,\n escrowParty: EscrowParty,\n account: AccountInstance | AccountInstance[],\n secret?: IdPayload,\n) => {\n if (!secret) secret = getEscrowSecret()\n const signers = Array.isArray(account) ? account : [account]\n // Add party addresses to escrow terms\n terms[escrowParty] = signers.map(signer => signer.address)\n // Add secret hash to terms\n const secretType: EscrowPartySecret = escrowParty === 'buyer' ? 'buyerSecret' : 'sellerSecret'\n const secretHash = await PayloadBuilder.dataHash(secret)\n terms[secretType] = secretHash\n // Have the parties sign the secret and terms\n const result = await new BoundWitnessBuilder().signers(signers).payloads([terms, secret]).build()\n return result\n}\n","import type { ModuleIdentifier } from '@xyo-network/module-model'\nimport type { PayloadValueExpression } from '@xyo-network/payload-model'\n\nimport type { EscrowTerms } from '../../../Terms/index.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","import type { Hash } from '@xylabs/hex'\nimport { BoundWitnessValidator } from '@xyo-network/boundwitness-validator'\nimport type { AsyncPayloadValidationFunction, Payload } from '@xyo-network/payload-model'\n\nimport type {\n EscrowParty, EscrowPartySecret, EscrowTerms,\n} from '../../../Terms/index.ts'\nimport { findEscrowPartySecretSignatures } from '../../../util/index.ts'\n\n/**\n * Returns the log prefix for the party\n * @param party The party\n * @returns The log prefix for the party\n */\nconst getLogPrefix = (party: EscrowParty) => {\n const partySecret: EscrowPartySecret = party === 'seller' ? 'sellerSecret' : 'buyerSecret'\n return `EscrowTerms.${partySecret}`\n}\n\n/**\n * Returns a function that validates the escrow terms for the existence of the party secret signed by the party\n * @param dictionary Payload dictionary of the escrow terms\n * @returns A function that validates the escrow terms for the existence of the party secret signed by the party\n */\nexport const getPartySecretSignedValidator = (dictionary: Record<Hash, Payload>, party: EscrowParty): AsyncPayloadValidationFunction<EscrowTerms> => {\n const partySecret: EscrowPartySecret = party === 'seller' ? 'sellerSecret' : 'buyerSecret'\n return async (terms: EscrowTerms): Promise<boolean> => {\n // Party-signed party secret BWs\n const buyerSecretBWs = findEscrowPartySecretSignatures(terms, dictionary, party)\n\n // If there are no BWs, return false\n if (buyerSecretBWs.length === 0) {\n console.log(`${getLogPrefix(party)}: No BoundWitnesses supplied for ${partySecret}: ${terms[partySecret]}`)\n return false\n }\n\n // Ensure each BW supplied for the party secret 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(`${getLogPrefix(party)}: Invalid BoundWitnesses supplied for ${partySecret}: ${terms[partySecret]}`)\n return false\n }\n return true\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 return !(value.exp === undefined || value.exp < exp)\n}\n","import type { ModuleIdentifier } from '@xyo-network/module-model'\nimport type { SyncPayloadValidationFunction } from '@xyo-network/payload-model'\n\nimport type { EscrowTerms } from '../../Terms/index.ts'\nimport { moduleIdentifiersContainsOneOf } from '../common/index.ts'\n\nconst name = 'EscrowTerms.escrowAgent'\n\nexport const getEscrowAgentAllowedValidator = (allowedEscrowAgent: ModuleIdentifier): SyncPayloadValidationFunction<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 { isBoundWitness } from '@xyo-network/boundwitness-model'\nimport type { HashLeaseEstimate } from '@xyo-network/diviner-hash-lease'\nimport type {\n Payload, SyncPayloadValidationFunction, WithSources,\n} from '@xyo-network/payload-model'\n\nimport type { EscrowTerms } from '../../Terms/index.ts'\nimport { getAppraisalsByAsset } from '../../util/index.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: SyncPayloadValidationFunction<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, Payload>): SyncPayloadValidationFunction<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, BoundWitness[]> = Object.fromEntries(\n appraisals.map<[Hash, BoundWitness[]]>(hash => [hash, []]),\n )\n for (const bw of Object.values(dictionary).filter(isBoundWitness)) {\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, Payload>,\n minimumExp: number,\n): SyncPayloadValidationFunction<EscrowTerms> => {\n return (terms: EscrowTerms) => {\n // Verify we have an estimate for each of the assets\n const estimatesByAsset = getAppraisalsByAsset(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, Payload>): SyncPayloadValidationFunction<EscrowTerms> => {\n return (terms: EscrowTerms) => {\n // Verify we have an estimate for each of the assets\n const assets = assertEx(terms.assets, () => `${name}: No assets: ${terms.assets}`)\n const estimatesByAsset = getAppraisalsByAsset(terms, dictionary)\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 return (estimate.price >= 0)\n}\n","import { asAddress } from '@xylabs/hex'\nimport type { ModuleIdentifier } from '@xyo-network/module-model'\nimport type { SyncPayloadValidationFunction } from '@xyo-network/payload-model'\n\nimport type { EscrowTerms } from '../../Terms/index.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: SyncPayloadValidationFunction<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[]): SyncPayloadValidationFunction<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 { SyncPayloadValidationFunction } from '@xyo-network/payload-model'\n\nimport type { EscrowTerms } from '../../Terms/index.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: SyncPayloadValidationFunction<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 { SyncPayloadValidationFunction } from '@xyo-network/payload-model'\n\nimport type { EscrowTerms } from '../../Terms/index.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: SyncPayloadValidationFunction<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 type {\n AsyncPayloadValidationFunction, Payload, SyncPayloadValidationFunction,\n} from '@xyo-network/payload-model'\n\nimport type { EscrowTerms } from '../../Terms/index.ts'\nimport { getPartySecretSignedValidator } from '../common/index.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: SyncPayloadValidationFunction<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, Payload>): SyncPayloadValidationFunction<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, Payload>): AsyncPayloadValidationFunction<EscrowTerms> => {\n return getPartySecretSignedValidator(dictionary, 'buyer')\n}\n","import type { SyncPayloadValidationFunction } from '@xyo-network/payload-model'\n\nimport type { EscrowTerms } from '../../Terms/index.ts'\n\nexport const getNbfExpValidator = (now: number, minRequiredDuration: number): SyncPayloadValidationFunction<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 { SyncPayloadValidationFunction } from '@xyo-network/payload-model'\n\nimport type { EscrowTerms } from '../../Terms/index.ts'\nimport { moduleIdentifiersContainsAllOf } from '../common/index.ts'\n\nconst name = 'EscrowTerms.paymentAuthorities'\n\nexport const getPaymentAuthoritiesAllowedValidator = (allowed: ModuleIdentifier[]): SyncPayloadValidationFunction<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 { SyncPayloadValidationFunction } from '@xyo-network/payload-model'\n\nimport type { EscrowTerms } from '../../Terms/index.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: SyncPayloadValidationFunction<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 type {\n AsyncPayloadValidationFunction, Payload, SyncPayloadValidationFunction,\n} from '@xyo-network/payload-model'\n\nimport type { EscrowTerms } from '../../Terms/index.ts'\nimport { getPartySecretSignedValidator } from '../common/index.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: SyncPayloadValidationFunction<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, Payload>): SyncPayloadValidationFunction<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, Payload>): AsyncPayloadValidationFunction<EscrowTerms> => {\n return getPartySecretSignedValidator(dictionary, 'seller')\n}\n","import { AsObjectFactory } from '@xylabs/object'\nimport type { Payload, WithSources } from '@xyo-network/payload-model'\nimport { isPayloadOfSchemaType, isPayloadOfSchemaTypeWithSources } 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)\nexport const asPaymentCard = AsObjectFactory.create<PaymentCard>(isPaymentCard)\nexport const asOptionalPaymentCard = AsObjectFactory.createOptional<PaymentCard>(isPaymentCard)\n\n/**\n * Identity function for determine if an object is a PaymentCard with sources\n */\nexport const isPaymentCardWithSources = isPayloadOfSchemaTypeWithSources<PaymentCard>(PaymentCardSchema)\nexport const asPaymentCardWithSources = AsObjectFactory.create<WithSources<PaymentCard>>(isPaymentCardWithSources)\nexport const asOptionalPaymentCardWithSources = AsObjectFactory.createOptional<WithSources<PaymentCard>>(isPaymentCardWithSources)\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 { AsObjectFactory } from '@xylabs/object'\nimport type { PayloadWithSources, WithSources } from '@xyo-network/payload-model'\nimport {\n isPayloadOfSchemaType,\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)\nexport const asPayment = AsObjectFactory.create<Payment>(isPayment)\nexport const asOptionalPayment = AsObjectFactory.createOptional<Payment>(isPayment)\n\n/**\n * Identity function for determine if an object is a Payment with sources\n */\nexport const isPaymentWithSources = isPayloadOfSchemaTypeWithSources<Payment>(PaymentSchema)\nexport const asPaymentWithSources = AsObjectFactory.create<WithSources<Payment>>(isPaymentWithSources)\nexport const asOptionalPaymentWithSources = AsObjectFactory.createOptional<WithSources<Payment>>(isPaymentWithSources)\n","import { AsObjectFactory } from '@xylabs/object'\nimport type { PayloadWithSources, WithSources } from '@xyo-network/payload-model'\nimport {\n isPayloadOfSchemaType,\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)\nexport const asPaymentStatus = AsObjectFactory.create<PaymentStatus>(isPaymentStatus)\nexport const asOptionalPaymentStatus = AsObjectFactory.createOptional<PaymentStatus>(isPaymentStatus)\n\n/**\n * Identity function for determine if an object is a PaymentStatus with sources\n */\nexport const isPaymentStatusWithSources = isPayloadOfSchemaTypeWithSources<PaymentStatus>(PaymentStatusSchema)\nexport const asPaymentStatusWithSources = AsObjectFactory.create<WithSources<PaymentStatus>>(isPaymentStatusWithSources)\nexport const asOptionalPaymentStatusWithSources = AsObjectFactory.createOptional<WithSources<PaymentStatus>>(isPaymentStatusWithSources)\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 { AsObjectFactory } from '@xylabs/object'\nimport type { PayloadWithSources, WithSources } from '@xyo-network/payload-model'\nimport {\n isPayloadOfSchemaType,\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)\nexport const asPurchase = AsObjectFactory.create<Purchase>(isPurchase)\nexport const asOptionalPurchase = AsObjectFactory.createOptional<Purchase>(isPurchase)\n\n/**\n * Identity function for determine if an object is a Purchase with sources\n */\nexport const isPurchaseWithSources = isPayloadOfSchemaTypeWithSources<Purchase>(PurchaseSchema)\nexport const asPurchaseWithSources = AsObjectFactory.create<WithSources<Purchase>>(isPurchaseWithSources)\nexport const asOptionalPurchaseWithSources = AsObjectFactory.createOptional<WithSources<Purchase>>(isPurchaseWithSources)\n","import { PaymentsSchema } from '../Schema.ts'\n\nexport const PurchaseSchema = `${PaymentsSchema}.purchase`\nexport type PurchaseSchema = typeof PurchaseSchema\n","import { AsObjectFactory } from '@xylabs/object'\nimport type { PayloadWithSources, WithSources } from '@xyo-network/payload-model'\nimport {\n isPayloadOfSchemaType,\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)\nexport const asReceipt = AsObjectFactory.create<Receipt>(isReceipt)\nexport const asOptionalReceipt = AsObjectFactory.createOptional<Receipt>(isReceipt)\n\n/**\n * Identity function for determine if an object is a Receipt with sources\n */\nexport const isReceiptWithSources = isPayloadOfSchemaTypeWithSources<Receipt>(ReceiptSchema)\nexport const asReceiptWithSources = AsObjectFactory.create<WithSources<Receipt>>(isReceiptWithSources)\nexport const asOptionalReceiptWithSources = AsObjectFactory.createOptional<WithSources<Receipt>>(isReceiptWithSources)\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 { AsObjectFactory } from '@xylabs/object'\nimport type { PayloadWithSources, WithSources } from '@xyo-network/payload-model'\nimport {\n isPayloadOfSchemaType,\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)\nexport const asSubtotal = AsObjectFactory.create<Subtotal>(isSubtotal)\nexport const asOptionalSubtotal = AsObjectFactory.createOptional<Subtotal>(isSubtotal)\n\n/**\n * Identity function for determining if an object is an Subtotal with sources\n */\nexport const isSubtotalWithSources = isPayloadOfSchemaTypeWithSources<Subtotal>(SubtotalSchema)\nexport const asSubtotalWithSources = AsObjectFactory.create<WithSources<Subtotal>>(isSubtotalWithSources)\nexport const asOptionalSubtotalWithSources = AsObjectFactory.createOptional<WithSources<Subtotal>>(isSubtotalWithSources)\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 { AsObjectFactory } from '@xylabs/object'\nimport type { PayloadWithSources, WithSources } from '@xyo-network/payload-model'\nimport {\n isPayloadOfSchemaType,\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)\nexport const asTotal = AsObjectFactory.create<Total>(isTotal)\nexport const asOptionalTotal = AsObjectFactory.createOptional<Total>(isTotal)\n\n/**\n * Identity function for determining if an object is an Total with sources\n */\nexport const isTotalWithSources = isPayloadOfSchemaTypeWithSources<Total>(TotalSchema)\nexport const asTotalWithSources = AsObjectFactory.create<WithSources<Total>>(isTotalWithSources)\nexport const asOptionalTotalWithSources = AsObjectFactory.createOptional<WithSources<Total>>(isTotalWithSources)\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;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;AAAA,EACL,KAAK;AA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PayloadOfSchemaType","AsObjectFactory","isPayloadOfSchemaTypeWithSources","SchemaSchema","SchemaSchema","AsObjectFactory","isPayloadOfSchemaType","isPayloadOfSchemaTypeWithSources","isPayloadOfSchemaType","AsObjectFactory","isPayloadOfSchemaTypeWithSources","AsObjectFactory","isPayloadOfSchemaType","isPayloadOfSchemaTypeWithSources","isPayloadOfSchemaType","AsObjectFactory","isPayloadOfSchemaTypeWithSources","AsObjectFactory","isPayloadOfSchemaType","isPayloadOfSchemaTypeWithSources","isPayloadOfSchemaType","AsObjectFactory","isPayloadOfSchemaTypeWithSources","AsObjectFactory","AsObjectFactory","AsObjectFactory","isPayloadOfSchemaType","isPayloadOfSchemaTypeWithSources","SchemaSchema","AsObjectFactory","isPayloadOfSchemaType","isPayloadOfSchemaTypeWithSources","AsObjectFactory","isPayloadOfSchemaType","isPayloadOfSchemaTypeWithSources","isPayloadOfSchemaType","AsObjectFactory","isPayloadOfSchemaTypeWithSources","AsObjectFactory","isPayloadOfSchemaType","isPayloadOfSchemaTypeWithSources","isPayloadOfSchemaType","AsObjectFactory","isPayloadOfSchemaTypeWithSources","isBoundWitness","BoundWitnessBuilder","BoundWitnessBuilder","getLogPrefix","errors","isBoundWitness","name","isBoundWitness","name","name","asAddress","name","assertEx","name","assertEx","name","asAddress","name","assertEx","name","assertEx","AsObjectFactory","isPayloadOfSchemaType","isPayloadOfSchemaTypeWithSources","isPayloadOfSchemaType","AsObjectFactory","isPayloadOfSchemaTypeWithSources","AsObjectFactory","isPayloadOfSchemaType","isPayloadOfSchemaTypeWithSources","isPayloadOfSchemaType","AsObjectFactory","isPayloadOfSchemaTypeWithSources","AsObjectFactory","isPayloadOfSchemaType","isPayloadOfSchemaTypeWithSources","isPayloadOfSchemaType","AsObjectFactory","isPayloadOfSchemaTypeWithSources","AsObjectFactory","isPayloadOfSchemaType","isPayloadOfSchemaTypeWithSources","isPayloadOfSchemaType","AsObjectFactory","isPayloadOfSchemaTypeWithSources","AsObjectFactory","isPayloadOfSchemaType","isPayloadOfSchemaTypeWithSources","isPayloadOfSchemaType","AsObjectFactory","isPayloadOfSchemaTypeWithSources","AsObjectFactory","isPayloadOfSchemaType","isPayloadOfSchemaTypeWithSources","AsObjectFactory","isPayloadOfSchemaType","isPayloadOfSchemaTypeWithSources"]}
@@ -1 +1 @@
1
- {"version":3,"file":"Iso4217Currency.d.ts","sourceRoot":"","sources":["../../../src/Amount/Iso4217Currency.ts"],"names":[],"mappings":"AACA;;GAEG;AACH,MAAM,MAAM,uBAAuB,GACjC,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,CAAA;AAIP;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAC5B,GAAG,GACH,GAAG,GACH,CAAC,GACD,EAAE,GACF,GAAG,GACH,GAAG,GACH,EAAE,GACF,EAAE,GACF,GAAG,GACH,GAAG,GACH,GAAG,GACH,EAAE,GACF,EAAE,GACF,GAAG,GACH,EAAE,GACF,GAAG,GACH,EAAE,GACF,EAAE,GACF,EAAE,GACF,GAAG,GACH,GAAG,GACH,EAAE,GACF,EAAE,GACF,EAAE,GACF,GAAG,GACH,EAAE,GACF,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,EAAE,GACF,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,EAAE,GACF,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,CAAA;AAEL;;GAEG;AACH,eAAO,MAAM,oBAAoB,EAAE,MAAM,CAAC,uBAAuB,EAAE,kBAAkB,CAoLpF,CAAA;AAED,eAAO,MAAM,qBAAqB,GAAI,MAAM,MAAM,KAAG,IAAI,IAAI,uBAA+F,CAAA"}
1
+ {"version":3,"file":"Iso4217Currency.d.ts","sourceRoot":"","sources":["../../../src/Amount/Iso4217Currency.ts"],"names":[],"mappings":"AACA;;GAEG;AACH,MAAM,MAAM,uBAAuB,GAC/B,KAAK,GACH,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,CAAA;AAIX;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAC1B,GAAG,GACD,GAAG,GACH,CAAC,GACD,EAAE,GACF,GAAG,GACH,GAAG,GACH,EAAE,GACF,EAAE,GACF,GAAG,GACH,GAAG,GACH,GAAG,GACH,EAAE,GACF,EAAE,GACF,GAAG,GACH,EAAE,GACF,GAAG,GACH,EAAE,GACF,EAAE,GACF,EAAE,GACF,GAAG,GACH,GAAG,GACH,EAAE,GACF,EAAE,GACF,EAAE,GACF,GAAG,GACH,EAAE,GACF,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,EAAE,GACF,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,EAAE,GACF,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,CAAA;AAET;;GAEG;AACH,eAAO,MAAM,oBAAoB,EAAE,MAAM,CAAC,uBAAuB,EAAE,kBAAkB,CAoLpF,CAAA;AAED,eAAO,MAAM,qBAAqB,GAAI,MAAM,MAAM,KAAG,IAAI,IAAI,uBAA+F,CAAA"}
@@ -14,18 +14,12 @@ export type Amount = PayloadWithSources<AmountFields, AmountSchema>;
14
14
  * Identity function for determining if an object is an Amount
15
15
  */
16
16
  export declare const isAmount: (x?: unknown | null) => x is Amount;
17
- export declare const asAmount: {
18
- <TType extends Amount>(value: import(".store/@xylabs-promise-npm-4.11.2-66516e0826/package").AnyNonPromise, config?: import("@xylabs/object").TypeCheckConfig): TType | undefined;
19
- <TType extends Amount>(value: import(".store/@xylabs-promise-npm-4.11.2-66516e0826/package").AnyNonPromise, assert: import("@xylabs/object").StringOrAlertFunction<Amount>, config?: import("@xylabs/object").TypeCheckConfig): TType;
20
- };
21
- export declare const asOptionalAmount: <TType extends Amount>(value: import(".store/@xylabs-promise-npm-4.11.2-66516e0826/package").AnyNonPromise) => TType | undefined;
17
+ export declare const asAmount: import("@xylabs/object").AsTypeFunction<Amount>;
18
+ export declare const asOptionalAmount: (value: import(".store/@xylabs-promise-npm-4.12.31-6620a7e715/package").AnyNonPromise) => Amount | undefined;
22
19
  /**
23
20
  * Identity function for determining if an object is an Amount with sources
24
21
  */
25
22
  export declare const isAmountWithSources: (x?: unknown | null) => x is WithSources<Amount>;
26
- export declare const asAmountWithSources: {
27
- <TType extends WithSources<Amount>>(value: import(".store/@xylabs-promise-npm-4.11.2-66516e0826/package").AnyNonPromise, config?: import("@xylabs/object").TypeCheckConfig): TType | undefined;
28
- <TType extends WithSources<Amount>>(value: import(".store/@xylabs-promise-npm-4.11.2-66516e0826/package").AnyNonPromise, assert: import("@xylabs/object").StringOrAlertFunction<WithSources<Amount>>, config?: import("@xylabs/object").TypeCheckConfig): TType;
29
- };
30
- export declare const asOptionalAmountWithSources: <TType extends WithSources<Amount>>(value: import(".store/@xylabs-promise-npm-4.11.2-66516e0826/package").AnyNonPromise) => TType | undefined;
23
+ export declare const asAmountWithSources: import("@xylabs/object").AsTypeFunction<WithSources<Amount>>;
24
+ export declare const asOptionalAmountWithSources: (value: import(".store/@xylabs-promise-npm-4.12.31-6620a7e715/package").AnyNonPromise) => WithSources<Amount> | undefined;
31
25
  //# sourceMappingURL=Payload.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Payload.d.ts","sourceRoot":"","sources":["../../../src/Amount/Payload.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAA;AAMjF,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAA;AAEnE,eAAO,MAAM,YAAY,EAAG,6BAAsC,CAAA;AAClE,MAAM,MAAM,YAAY,GAAG,OAAO,YAAY,CAAA;AAE9C,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,uBAAuB,CAAA;CAClC;AAED;;GAEG;AACH,MAAM,MAAM,MAAM,GAAG,kBAAkB,CAAC,YAAY,EAAE,YAAY,CAAC,CAAA;AAEnE;;GAEG;AACH,eAAO,MAAM,QAAQ,qCAA8C,CAAA;AACnE,eAAO,MAAM,QAAQ;;;CAA2C,CAAA;AAChE,eAAO,MAAM,gBAAgB,kIAAmD,CAAA;AAEhF;;GAEG;AACH,eAAO,MAAM,mBAAmB,kDAAyD,CAAA;AACzF,eAAO,MAAM,mBAAmB;;;CAAmE,CAAA;AACnG,eAAO,MAAM,2BAA2B,+IAA2E,CAAA"}
1
+ {"version":3,"file":"Payload.d.ts","sourceRoot":"","sources":["../../../src/Amount/Payload.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAA;AAMjF,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAA;AAEnE,eAAO,MAAM,YAAY,EAAG,6BAAsC,CAAA;AAClE,MAAM,MAAM,YAAY,GAAG,OAAO,YAAY,CAAA;AAE9C,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,uBAAuB,CAAA;CAClC;AAED;;GAEG;AACH,MAAM,MAAM,MAAM,GAAG,kBAAkB,CAAC,YAAY,EAAE,YAAY,CAAC,CAAA;AAEnE;;GAEG;AACH,eAAO,MAAM,QAAQ,qCAA8C,CAAA;AACnE,eAAO,MAAM,QAAQ,iDAA2C,CAAA;AAChE,eAAO,MAAM,gBAAgB,8GAAmD,CAAA;AAEhF;;GAEG;AACH,eAAO,MAAM,mBAAmB,kDAAyD,CAAA;AACzF,eAAO,MAAM,mBAAmB,8DAAmE,CAAA;AACnG,eAAO,MAAM,2BAA2B,2HAA2E,CAAA"}
@@ -31,18 +31,12 @@ export type BillingAddress = Payload<BillingAddressFields, BillingAddressSchema>
31
31
  * Identity function for determine if an object is a BillingAddress
32
32
  */
33
33
  export declare const isBillingAddress: (x?: unknown | null) => x is BillingAddress;
34
- export declare const asBillingAddress: {
35
- <TType extends BillingAddress>(value: import(".store/@xylabs-promise-npm-4.11.2-66516e0826/package").AnyNonPromise, config?: import("@xylabs/object").TypeCheckConfig): TType | undefined;
36
- <TType extends BillingAddress>(value: import(".store/@xylabs-promise-npm-4.11.2-66516e0826/package").AnyNonPromise, assert: import("@xylabs/object").StringOrAlertFunction<BillingAddress>, config?: import("@xylabs/object").TypeCheckConfig): TType;
37
- };
38
- export declare const asOptionalBillingAddress: <TType extends BillingAddress>(value: import(".store/@xylabs-promise-npm-4.11.2-66516e0826/package").AnyNonPromise) => TType | undefined;
34
+ export declare const asBillingAddress: import("@xylabs/object").AsTypeFunction<BillingAddress>;
35
+ export declare const asOptionalBillingAddress: (value: import(".store/@xylabs-promise-npm-4.12.31-6620a7e715/package").AnyNonPromise) => BillingAddress | undefined;
39
36
  /**
40
37
  * Identity function for determine if an object is a BillingAddress with sources
41
38
  */
42
39
  export declare const isBillingAddressWithSources: (x?: unknown | null) => x is WithSources<BillingAddress>;
43
- export declare const asBillingAddressWithSources: {
44
- <TType extends WithSources<BillingAddress>>(value: import(".store/@xylabs-promise-npm-4.11.2-66516e0826/package").AnyNonPromise, config?: import("@xylabs/object").TypeCheckConfig): TType | undefined;
45
- <TType extends WithSources<BillingAddress>>(value: import(".store/@xylabs-promise-npm-4.11.2-66516e0826/package").AnyNonPromise, assert: import("@xylabs/object").StringOrAlertFunction<WithSources<BillingAddress>>, config?: import("@xylabs/object").TypeCheckConfig): TType;
46
- };
47
- export declare const asOptionalBillingAddressWithSources: <TType extends WithSources<BillingAddress>>(value: import(".store/@xylabs-promise-npm-4.11.2-66516e0826/package").AnyNonPromise) => TType | undefined;
40
+ export declare const asBillingAddressWithSources: import("@xylabs/object").AsTypeFunction<WithSources<BillingAddress>>;
41
+ export declare const asOptionalBillingAddressWithSources: (value: import(".store/@xylabs-promise-npm-4.12.31-6620a7e715/package").AnyNonPromise) => WithSources<BillingAddress> | undefined;
48
42
  //# sourceMappingURL=Address.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Address.d.ts","sourceRoot":"","sources":["../../../../src/Billing/Address/Address.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAA;AAGtE,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AAElD;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,6BAA6B;IAC7B,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,6BAA6B;IAC7B,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,mCAAmC;IACnC,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,oEAAoE;IACpE,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,iBAAiB;IACjB,SAAS,EAAE,MAAM,CAAA;IACjB,gBAAgB;IAChB,QAAQ,EAAE,MAAM,CAAA;IAChB,wEAAwE;IACxE,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC5B,iDAAiD;IACjD,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,8CAA8C;IAC9C,MAAM,CAA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gB,6CAA8D,CAAA;AAC3F,eAAO,MAAM,gBAAgB,yDAA2D,CAAA;AACxF,eAAO,MAAM,wBAAwB,sHAAmE,CAAA;AAExG;;GAEG;AACH,eAAO,MAAM,2BAA2B,0DAAyE,CAAA;AACjH,eAAO,MAAM,2BAA2B,sEAAmF,CAAA;AAC3H,eAAO,MAAM,mCAAmC,mIAA2F,CAAA"}
@@ -2,10 +2,10 @@ import type { Address } from '@xylabs/hex';
2
2
  import type { DivinerParams } from '@xyo-network/diviner-model';
3
3
  import type { AnyConfigSchema } from '@xyo-network/module-model';
4
4
  import type { PaymentDiscountDivinerConfig } from './Config.ts';
5
- export type PaymentDiscountDivinerParams<TConfig extends AnyConfigSchema<PaymentDiscountDivinerConfig> = AnyConfigSchema<PaymentDiscountDivinerConfig>> = DivinerParams<TConfig, {
5
+ export interface PaymentDiscountDivinerParams<TConfig extends AnyConfigSchema<PaymentDiscountDivinerConfig> = AnyConfigSchema<PaymentDiscountDivinerConfig>> extends DivinerParams<TConfig> {
6
6
  /**
7
7
  * The list of coupon authorities that can be used to get a discount
8
8
  */
9
9
  couponAuthorities?: Address[];
10
- }>;
10
+ }
11
11
  //# sourceMappingURL=Params.d.ts.map