@xyo-network/payment-payload-plugins 3.0.3 → 3.0.4

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 (111) hide show
  1. package/dist/neutral/Billing/Address/Address.d.ts +24 -0
  2. package/dist/neutral/Billing/Address/Address.d.ts.map +1 -0
  3. package/dist/neutral/Billing/Address/Schema.d.ts +3 -0
  4. package/dist/neutral/Billing/Address/Schema.d.ts.map +1 -0
  5. package/dist/neutral/Billing/Address/index.d.ts +3 -0
  6. package/dist/neutral/Billing/Address/index.d.ts.map +1 -0
  7. package/dist/neutral/Billing/Schema.d.ts +3 -0
  8. package/dist/neutral/Billing/Schema.d.ts.map +1 -0
  9. package/dist/neutral/Billing/index.d.ts +3 -0
  10. package/dist/neutral/Billing/index.d.ts.map +1 -0
  11. package/dist/neutral/Currency.d.ts +2 -0
  12. package/dist/neutral/Currency.d.ts.map +1 -0
  13. package/dist/neutral/Escrow/Outcome.d.ts +14 -0
  14. package/dist/neutral/Escrow/Outcome.d.ts.map +1 -0
  15. package/dist/neutral/Escrow/Schema.d.ts +3 -0
  16. package/dist/neutral/Escrow/Schema.d.ts.map +1 -0
  17. package/dist/neutral/Escrow/Terms.d.ts +28 -0
  18. package/dist/neutral/Escrow/Terms.d.ts.map +1 -0
  19. package/dist/neutral/Escrow/createEscrowIntent.d.ts +28 -0
  20. package/dist/neutral/Escrow/createEscrowIntent.d.ts.map +1 -0
  21. package/dist/neutral/Escrow/getEscrowSecret.d.ts +3 -0
  22. package/dist/neutral/Escrow/getEscrowSecret.d.ts.map +1 -0
  23. package/dist/neutral/Escrow/index.d.ts +7 -0
  24. package/dist/neutral/Escrow/index.d.ts.map +1 -0
  25. package/dist/neutral/Escrow/validators/common/ModuleInstanceValidators/index.d.ts +2 -0
  26. package/dist/neutral/Escrow/validators/common/ModuleInstanceValidators/index.d.ts.map +1 -0
  27. package/dist/neutral/Escrow/validators/common/ModuleInstanceValidators/moduleInstanceValidators.d.ts +6 -0
  28. package/dist/neutral/Escrow/validators/common/ModuleInstanceValidators/moduleInstanceValidators.d.ts.map +1 -0
  29. package/dist/neutral/Escrow/validators/common/TemporalValidators/index.d.ts +2 -0
  30. package/dist/neutral/Escrow/validators/common/TemporalValidators/index.d.ts.map +1 -0
  31. package/dist/neutral/Escrow/validators/common/TemporalValidators/validateWithinWindow.d.ts +6 -0
  32. package/dist/neutral/Escrow/validators/common/TemporalValidators/validateWithinWindow.d.ts.map +1 -0
  33. package/dist/neutral/Escrow/validators/common/index.d.ts +3 -0
  34. package/dist/neutral/Escrow/validators/common/index.d.ts.map +1 -0
  35. package/dist/neutral/Escrow/validators/escrow/agent.d.ts +5 -0
  36. package/dist/neutral/Escrow/validators/escrow/agent.d.ts.map +1 -0
  37. package/dist/neutral/Escrow/validators/escrow/appraisal.d.ts +8 -0
  38. package/dist/neutral/Escrow/validators/escrow/appraisal.d.ts.map +1 -0
  39. package/dist/neutral/Escrow/validators/escrow/appraisalAuthorities.d.ts +6 -0
  40. package/dist/neutral/Escrow/validators/escrow/appraisalAuthorities.d.ts.map +1 -0
  41. package/dist/neutral/Escrow/validators/escrow/assets.d.ts +4 -0
  42. package/dist/neutral/Escrow/validators/escrow/assets.d.ts.map +1 -0
  43. package/dist/neutral/Escrow/validators/escrow/buyer.d.ts +4 -0
  44. package/dist/neutral/Escrow/validators/escrow/buyer.d.ts.map +1 -0
  45. package/dist/neutral/Escrow/validators/escrow/buyerSecret.d.ts +7 -0
  46. package/dist/neutral/Escrow/validators/escrow/buyerSecret.d.ts.map +1 -0
  47. package/dist/neutral/Escrow/validators/escrow/index.d.ts +11 -0
  48. package/dist/neutral/Escrow/validators/escrow/index.d.ts.map +1 -0
  49. package/dist/neutral/Escrow/validators/escrow/nbfExp.d.ts +4 -0
  50. package/dist/neutral/Escrow/validators/escrow/nbfExp.d.ts.map +1 -0
  51. package/dist/neutral/Escrow/validators/escrow/paymentAuthorities.d.ts +5 -0
  52. package/dist/neutral/Escrow/validators/escrow/paymentAuthorities.d.ts.map +1 -0
  53. package/dist/neutral/Escrow/validators/escrow/seller.d.ts +4 -0
  54. package/dist/neutral/Escrow/validators/escrow/seller.d.ts.map +1 -0
  55. package/dist/neutral/Escrow/validators/escrow/sellerSecret.d.ts +7 -0
  56. package/dist/neutral/Escrow/validators/escrow/sellerSecret.d.ts.map +1 -0
  57. package/dist/neutral/Escrow/validators/index.d.ts +3 -0
  58. package/dist/neutral/Escrow/validators/index.d.ts.map +1 -0
  59. package/dist/neutral/Payment/Instrument/Card/Payload.d.ts +20 -0
  60. package/dist/neutral/Payment/Instrument/Card/Payload.d.ts.map +1 -0
  61. package/dist/neutral/Payment/Instrument/Card/Schema.d.ts +3 -0
  62. package/dist/neutral/Payment/Instrument/Card/Schema.d.ts.map +1 -0
  63. package/dist/neutral/Payment/Instrument/Card/index.d.ts +3 -0
  64. package/dist/neutral/Payment/Instrument/Card/index.d.ts.map +1 -0
  65. package/dist/neutral/Payment/Instrument/Schema.d.ts +3 -0
  66. package/dist/neutral/Payment/Instrument/Schema.d.ts.map +1 -0
  67. package/dist/neutral/Payment/Instrument/index.d.ts +3 -0
  68. package/dist/neutral/Payment/Instrument/index.d.ts.map +1 -0
  69. package/dist/neutral/Payment/Payload.d.ts +12 -0
  70. package/dist/neutral/Payment/Payload.d.ts.map +1 -0
  71. package/dist/neutral/Payment/Schema.d.ts +3 -0
  72. package/dist/neutral/Payment/Schema.d.ts.map +1 -0
  73. package/dist/neutral/Payment/Status/Payload.d.ts +11 -0
  74. package/dist/neutral/Payment/Status/Payload.d.ts.map +1 -0
  75. package/dist/neutral/Payment/Status/Schema.d.ts +3 -0
  76. package/dist/neutral/Payment/Status/Schema.d.ts.map +1 -0
  77. package/dist/neutral/Payment/Status/index.d.ts +3 -0
  78. package/dist/neutral/Payment/Status/index.d.ts.map +1 -0
  79. package/dist/neutral/Payment/index.d.ts +5 -0
  80. package/dist/neutral/Payment/index.d.ts.map +1 -0
  81. package/dist/neutral/Purchase/Payload.d.ts +12 -0
  82. package/dist/neutral/Purchase/Payload.d.ts.map +1 -0
  83. package/dist/neutral/Purchase/Schema.d.ts +3 -0
  84. package/dist/neutral/Purchase/Schema.d.ts.map +1 -0
  85. package/dist/neutral/Purchase/index.d.ts +3 -0
  86. package/dist/neutral/Purchase/index.d.ts.map +1 -0
  87. package/dist/neutral/Receipt/Payload.d.ts +12 -0
  88. package/dist/neutral/Receipt/Payload.d.ts.map +1 -0
  89. package/dist/neutral/Receipt/Schema.d.ts +3 -0
  90. package/dist/neutral/Receipt/Schema.d.ts.map +1 -0
  91. package/dist/neutral/Receipt/index.d.ts +3 -0
  92. package/dist/neutral/Receipt/index.d.ts.map +1 -0
  93. package/dist/neutral/Schema.d.ts +3 -0
  94. package/dist/neutral/Schema.d.ts.map +1 -0
  95. package/dist/neutral/index.d.ts +7 -218
  96. package/dist/neutral/index.d.ts.map +1 -0
  97. package/dist/neutral/index.mjs +15 -3
  98. package/dist/neutral/index.mjs.map +1 -1
  99. package/package.json +34 -34
  100. package/src/Billing/Address/Address.ts +3 -1
  101. package/src/Escrow/Outcome.ts +1 -2
  102. package/src/Escrow/Terms.ts +3 -1
  103. package/src/Escrow/validators/escrow/appraisal.ts +3 -1
  104. package/src/Escrow/validators/escrow/buyerSecret.ts +3 -1
  105. package/src/Escrow/validators/escrow/sellerSecret.ts +3 -1
  106. package/src/Payment/Instrument/Card/Payload.ts +3 -1
  107. package/src/Payment/Payload.ts +1 -2
  108. package/src/Payment/Status/Payload.ts +1 -2
  109. package/src/Purchase/Payload.ts +1 -2
  110. package/src/Receipt/Payload.ts +1 -2
  111. package/xy.config.ts +1 -3
@@ -0,0 +1,3 @@
1
+ export declare const ReceiptSchema = "network.xyo.payments.receipt";
2
+ export type ReceiptSchema = typeof ReceiptSchema;
3
+ //# sourceMappingURL=Schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Schema.d.ts","sourceRoot":"","sources":["../../../src/Receipt/Schema.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,aAAa,iCAA8B,CAAA;AACxD,MAAM,MAAM,aAAa,GAAG,OAAO,aAAa,CAAA"}
@@ -0,0 +1,3 @@
1
+ export * from './Payload.ts';
2
+ export * from './Schema.ts';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/Receipt/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,aAAa,CAAA"}
@@ -0,0 +1,3 @@
1
+ export declare const PaymentsSchema = "network.xyo.payments";
2
+ export type PaymentsSchema = typeof PaymentsSchema;
3
+ //# sourceMappingURL=Schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Schema.d.ts","sourceRoot":"","sources":["../../src/Schema.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc,yBAAyB,CAAA;AACpD,MAAM,MAAM,cAAc,GAAG,OAAO,cAAc,CAAA"}
@@ -1,218 +1,7 @@
1
- import * as _xyo_network_payload_model from '@xyo-network/payload-model';
2
- import { Payload, PayloadWithSources, PayloadValueExpression, PayloadValidationFunction, WithMeta } from '@xyo-network/payload-model';
3
- import * as _xylabs_hex from '@xylabs/hex';
4
- import { Address, Hash } from '@xylabs/hex';
5
- import * as _store__xylabs_object_npm_4_0_2_c4743812cc_package from '.store/@xylabs-object-npm-4.0.2-c4743812cc/package';
6
- import * as _xyo_network_boundwitness_model from '@xyo-network/boundwitness-model';
7
- import { AccountInstance } from '@xyo-network/account-model';
8
- import { IdPayload } from '@xyo-network/id-payload-plugin';
9
- import { ModuleIdentifier } from '@xyo-network/module-model';
10
-
11
- declare const BillingAddressSchema = "network.xyo.payments.billing.address";
12
- type BillingAddressSchema = typeof BillingAddressSchema;
13
-
14
- interface BillingAddressFields {
15
- address?: string;
16
- address2?: string | null;
17
- city?: string;
18
- country?: string;
19
- firstName: string;
20
- lastName: string;
21
- organization?: string | null;
22
- postalCode?: string;
23
- region?: string;
24
- }
25
- type BillingAddress = Payload<BillingAddressFields, BillingAddressSchema>;
26
- declare const isBillingAddress: (x?: unknown | null) => x is _xyo_network_payload_model.SchemaFields & _xyo_network_payload_model.PayloadFields & BillingAddressFields & {
27
- schema: "network.xyo.payments.billing.address";
28
- };
29
- declare const isBillingAddressWithSources: (x?: unknown | null) => x is _xyo_network_payload_model.WithSources<_xyo_network_payload_model.SchemaFields & _xyo_network_payload_model.PayloadFields & BillingAddressFields & {
30
- schema: "network.xyo.payments.billing.address";
31
- }>;
32
- declare const isBillingAddressWithMeta: (x?: unknown | null) => x is _xyo_network_payload_model.WithMeta<_xyo_network_payload_model.SchemaFields & _xyo_network_payload_model.PayloadFields & BillingAddressFields & {
33
- schema: "network.xyo.payments.billing.address";
34
- }, void>;
35
-
36
- declare const BillingSchema = "network.xyo.payments.billing";
37
- type BillingSchema = typeof BillingSchema;
38
-
39
- type SupportedCurrency = 'USD';
40
-
41
- declare const EscrowTermsSchema: "network.xyo.escrow.terms";
42
- type EscrowTermsSchema = typeof EscrowTermsSchema;
43
- interface EscrowTermsFields {
44
- appraisalAuthorities: Address[];
45
- appraisals: Hash[];
46
- assets: Hash[];
47
- buyer: Address[];
48
- buyerSecret: Hash;
49
- escrowAgent: Address;
50
- exp: number;
51
- nbf: number;
52
- paymentAuthorities: Address[];
53
- seller: Address[];
54
- sellerSecret: Hash;
55
- }
56
- type EscrowTerms = Payload<Partial<EscrowTermsFields>, EscrowTermsSchema>;
57
- declare const isEscrowTerms: (x?: unknown | null) => x is _xyo_network_payload_model.SchemaFields & _xyo_network_payload_model.PayloadFields & Partial<EscrowTermsFields> & {
58
- schema: "network.xyo.escrow.terms";
59
- };
60
- declare const isEscrowTermsWithSources: (x?: unknown | null) => x is _xyo_network_payload_model.WithSources<_xyo_network_payload_model.SchemaFields & _xyo_network_payload_model.PayloadFields & Partial<EscrowTermsFields> & {
61
- schema: "network.xyo.escrow.terms";
62
- }>;
63
- declare const isEscrowTermsWithMeta: (x?: unknown | null) => x is _xyo_network_payload_model.WithMeta<_xyo_network_payload_model.SchemaFields & _xyo_network_payload_model.PayloadFields & Partial<EscrowTermsFields> & {
64
- schema: "network.xyo.escrow.terms";
65
- }>;
66
-
67
- declare const createEscrowIntent: (terms: EscrowTerms[], account: AccountInstance) => Promise<[_xyo_network_payload_model.WithMeta<_xyo_network_payload_model.SchemaFields & _xyo_network_payload_model.PayloadFields & _xyo_network_boundwitness_model.BoundWitnessFields & {
68
- schema: "network.xyo.boundwitness";
69
- }>, _xyo_network_payload_model.WithMeta<{
70
- schema: string;
71
- } & _xyo_network_payload_model.PayloadFields>[], _xyo_network_payload_model.WithMeta<_xyo_network_payload_model.SchemaFields & _xyo_network_payload_model.PayloadFields & {
72
- details?: _store__xylabs_object_npm_4_0_2_c4743812cc_package.JsonValue;
73
- message?: string;
74
- name?: string;
75
- query?: _xylabs_hex.Hash;
76
- schema: _xyo_network_payload_model.ModuleErrorSchema;
77
- sources?: _xylabs_hex.Hash[];
78
- }>[]]>;
79
- declare const createEscrowIntentWithSecret: (terms: EscrowTerms, secret: IdPayload, account: AccountInstance) => Promise<[_xyo_network_payload_model.WithMeta<_xyo_network_payload_model.SchemaFields & _xyo_network_payload_model.PayloadFields & _xyo_network_boundwitness_model.BoundWitnessFields & {
80
- schema: "network.xyo.boundwitness";
81
- }>, _xyo_network_payload_model.WithMeta<{
82
- schema: string;
83
- } & _xyo_network_payload_model.PayloadFields>[], _xyo_network_payload_model.WithMeta<_xyo_network_payload_model.SchemaFields & _xyo_network_payload_model.PayloadFields & {
84
- details?: _store__xylabs_object_npm_4_0_2_c4743812cc_package.JsonValue;
85
- message?: string;
86
- name?: string;
87
- query?: _xylabs_hex.Hash;
88
- schema: _xyo_network_payload_model.ModuleErrorSchema;
89
- sources?: _xylabs_hex.Hash[];
90
- }>[]]>;
91
-
92
- declare const getEscrowSecret: () => IdPayload;
93
-
94
- declare const EscrowOutcomeSchema: "network.xyo.escrow.outcome";
95
- type EscrowOutcomeSchema = typeof EscrowOutcomeSchema;
96
- type EscrowOutcomes = 'fulfilled' | 'expired';
97
- interface EscrowOutcomeFields {
98
- outcome: EscrowOutcomes;
99
- terms: Hash;
100
- }
101
- type EscrowOutcome = PayloadWithSources<EscrowOutcomeFields, EscrowOutcomeSchema>;
102
- declare const isEscrowOutcome: (x?: unknown | null) => x is EscrowOutcome;
103
- declare const isEscrowOutcomeWithSources: (x?: unknown | null) => x is _xyo_network_payload_model.WithSources<EscrowOutcome>;
104
- declare const isEscrowOutcomeWithMeta: (x?: unknown | null) => x is _xyo_network_payload_model.WithMeta<EscrowOutcome>;
105
-
106
- declare const EscrowSchema = "network.xyo.escrow";
107
- type EscrowSchema = typeof EscrowSchema;
108
-
109
- declare const moduleIdentifiersContainsOneOf: (escrowTerms: EscrowTerms, propertyExpression: PayloadValueExpression<EscrowTerms, "appraisalAuthorities" | "buyer" | "escrowAgent" | "paymentAuthorities" | "seller">, moduleIdentifiers: ModuleIdentifier[], required?: boolean) => boolean;
110
- declare const moduleIdentifiersContainsAllOf: (escrowTerms: EscrowTerms, selector: PayloadValueExpression<EscrowTerms, "appraisalAuthorities" | "buyer" | "escrowAgent" | "paymentAuthorities" | "seller">, moduleIdentifiers: ModuleIdentifier[], required?: boolean) => boolean;
111
-
112
- type Windowed = {
113
- exp?: number;
114
- nbf?: number;
115
- };
116
- declare const validateWithinWindow: (value: Windowed, exp: number, nbf?: number) => boolean;
117
-
118
- declare const getEscrowAgentAllowedValidator: (allowedEscrowAgent: ModuleIdentifier) => PayloadValidationFunction<EscrowTerms>;
119
-
120
- declare const appraisalsExistValidator: PayloadValidationFunction<EscrowTerms>;
121
- declare const getAppraisalsFromValidAuthoritiesValidator: (dictionary: Record<Hash, WithMeta<Payload>>) => PayloadValidationFunction<EscrowTerms>;
122
- declare const getAppraisalsValidValidator: (dictionary: Record<Hash, WithMeta<Payload>>, minimumExp: number) => PayloadValidationFunction<EscrowTerms>;
123
- declare const getAppraisalsForAllAssetsValidator: (dictionary: Record<Hash, WithMeta<Payload>>) => PayloadValidationFunction<EscrowTerms>;
124
-
125
- declare const appraisalAuthoritiesExistValidator: PayloadValidationFunction<EscrowTerms>;
126
- declare const getAppraisalAuthoritiesAllowedValidator: (allowed: ModuleIdentifier[]) => PayloadValidationFunction<EscrowTerms>;
127
-
128
- declare const assetsExistValidator: PayloadValidationFunction<EscrowTerms>;
129
-
130
- declare const buyerExistsValidator: PayloadValidationFunction<EscrowTerms>;
131
-
132
- declare const buyerSecretExistsValidator: PayloadValidationFunction<EscrowTerms>;
133
- declare const getBuyerSecretSuppliedValidator: (dictionary: Record<Hash, WithMeta<Payload>>) => PayloadValidationFunction<EscrowTerms>;
134
- declare const getBuyerSecretSignedValidator: (dictionary: Record<Hash, WithMeta<Payload>>) => PayloadValidationFunction<EscrowTerms>;
135
-
136
- declare const getNbfExpValidator: (now: number, minRequiredDuration: number) => PayloadValidationFunction<EscrowTerms>;
137
-
138
- declare const getPaymentAuthoritiesAllowedValidator: (allowed: ModuleIdentifier[]) => PayloadValidationFunction<EscrowTerms>;
139
-
140
- declare const sellerExistsValidator: PayloadValidationFunction<EscrowTerms>;
141
-
142
- declare const sellerSecretExistsValidator: PayloadValidationFunction<EscrowTerms>;
143
- declare const getSellerSecretSuppliedValidator: (dictionary: Record<Hash, WithMeta<Payload>>) => PayloadValidationFunction<EscrowTerms>;
144
- declare const getSellerSecretSignedValidator: (dictionary: Record<Hash, WithMeta<Payload>>) => PayloadValidationFunction<EscrowTerms>;
145
-
146
- declare const PaymentCardSchema = "network.xyo.payments.payment.instrument.card";
147
- type PaymentCardSchema = typeof PaymentCardSchema;
148
-
149
- interface PaymentCardFields {
150
- cardNumber: string;
151
- cardholderName?: string;
152
- cvv: string;
153
- expMonth: number;
154
- expYear: number;
155
- }
156
- type PaymentCard = Payload<PaymentCardFields, PaymentCardSchema>;
157
- declare const isPaymentCard: (x?: unknown | null) => x is _xyo_network_payload_model.SchemaFields & _xyo_network_payload_model.PayloadFields & PaymentCardFields & {
158
- schema: "network.xyo.payments.payment.instrument.card";
159
- };
160
- declare const isPaymentCardWithSources: (x?: unknown | null) => x is _xyo_network_payload_model.WithSources<_xyo_network_payload_model.SchemaFields & _xyo_network_payload_model.PayloadFields & PaymentCardFields & {
161
- schema: "network.xyo.payments.payment.instrument.card";
162
- }>;
163
- declare const isPaymentCardWithMeta: (x?: unknown | null) => x is _xyo_network_payload_model.WithMeta<_xyo_network_payload_model.SchemaFields & _xyo_network_payload_model.PayloadFields & PaymentCardFields & {
164
- schema: "network.xyo.payments.payment.instrument.card";
165
- }>;
166
-
167
- declare const PaymentInstrumentSchema = "network.xyo.payments.payment.instrument";
168
- type PaymentInstrumentSchema = typeof PaymentInstrumentSchema;
169
-
170
- declare const PaymentSchema = "network.xyo.payments.payment";
171
- type PaymentSchema = typeof PaymentSchema;
172
-
173
- interface PaymentFields {
174
- amount: number;
175
- currency: SupportedCurrency;
176
- }
177
- type Payment = PayloadWithSources<PaymentFields, PaymentSchema>;
178
- declare const isPayment: (x?: unknown | null) => x is Payment;
179
- declare const isPaymentWithSources: (x?: unknown | null) => x is _xyo_network_payload_model.WithSources<Payment>;
180
- declare const isPaymentWithMeta: (x?: unknown | null) => x is _xyo_network_payload_model.WithMeta<Payment>;
181
-
182
- declare const PaymentStatusSchema = "network.xyo.payments.payment.status";
183
- type PaymentStatusSchema = typeof PaymentStatusSchema;
184
-
185
- interface PaymentStatusFields {
186
- result?: string;
187
- status: string;
188
- }
189
- type PaymentStatus = PayloadWithSources<PaymentStatusFields, PaymentStatusSchema>;
190
- declare const isPaymentStatus: (x?: unknown | null) => x is PaymentStatus;
191
- declare const isPaymentStatusWithSources: (x?: unknown | null) => x is _xyo_network_payload_model.WithSources<PaymentStatus>;
192
- declare const isPaymentStatusWithMeta: (x?: unknown | null) => x is _xyo_network_payload_model.WithMeta<PaymentStatus>;
193
-
194
- declare const PurchaseSchema = "network.xyo.payments.purchase";
195
- type PurchaseSchema = typeof PurchaseSchema;
196
-
197
- interface PurchaseFields {
198
- assets: Hash[];
199
- receipts: Hash[];
200
- }
201
- type Purchase = PayloadWithSources<PurchaseFields, PurchaseSchema>;
202
- declare const isPurchase: (x?: unknown | null) => x is Purchase;
203
- declare const isPurchaseWithSources: (x?: unknown | null) => x is _xyo_network_payload_model.WithSources<Purchase>;
204
- declare const isPurchaseWithMeta: (x?: unknown | null) => x is _xyo_network_payload_model.WithMeta<Purchase>;
205
-
206
- declare const ReceiptSchema = "network.xyo.payments.receipt";
207
- type ReceiptSchema = typeof ReceiptSchema;
208
-
209
- interface ReceiptFields {
210
- amount: number;
211
- currency: SupportedCurrency;
212
- }
213
- type Receipt = PayloadWithSources<ReceiptFields, ReceiptSchema>;
214
- declare const isReceipt: (x?: unknown | null) => x is Receipt;
215
- declare const isReceiptWithSources: (x?: unknown | null) => x is _xyo_network_payload_model.WithSources<Receipt>;
216
- declare const isReceiptWithMeta: (x?: unknown | null) => x is _xyo_network_payload_model.WithMeta<Receipt>;
217
-
218
- export { type BillingAddress, type BillingAddressFields, BillingAddressSchema, BillingSchema, type EscrowOutcome, type EscrowOutcomeFields, EscrowOutcomeSchema, type EscrowOutcomes, EscrowSchema, type EscrowTerms, type EscrowTermsFields, EscrowTermsSchema, type Payment, type PaymentCard, type PaymentCardFields, PaymentCardSchema, type PaymentFields, PaymentInstrumentSchema, PaymentSchema, type PaymentStatus, type PaymentStatusFields, PaymentStatusSchema, type Purchase, type PurchaseFields, PurchaseSchema, type Receipt, type ReceiptFields, ReceiptSchema, type SupportedCurrency, type Windowed, appraisalAuthoritiesExistValidator, appraisalsExistValidator, assetsExistValidator, buyerExistsValidator, buyerSecretExistsValidator, createEscrowIntent, createEscrowIntentWithSecret, getAppraisalAuthoritiesAllowedValidator, getAppraisalsForAllAssetsValidator, getAppraisalsFromValidAuthoritiesValidator, getAppraisalsValidValidator, getBuyerSecretSignedValidator, getBuyerSecretSuppliedValidator, getEscrowAgentAllowedValidator, getEscrowSecret, getNbfExpValidator, getPaymentAuthoritiesAllowedValidator, getSellerSecretSignedValidator, getSellerSecretSuppliedValidator, isBillingAddress, isBillingAddressWithMeta, isBillingAddressWithSources, isEscrowOutcome, isEscrowOutcomeWithMeta, isEscrowOutcomeWithSources, isEscrowTerms, isEscrowTermsWithMeta, isEscrowTermsWithSources, isPayment, isPaymentCard, isPaymentCardWithMeta, isPaymentCardWithSources, isPaymentStatus, isPaymentStatusWithMeta, isPaymentStatusWithSources, isPaymentWithMeta, isPaymentWithSources, isPurchase, isPurchaseWithMeta, isPurchaseWithSources, isReceipt, isReceiptWithMeta, isReceiptWithSources, moduleIdentifiersContainsAllOf, moduleIdentifiersContainsOneOf, sellerExistsValidator, sellerSecretExistsValidator, validateWithinWindow };
1
+ export * from './Billing/index.ts';
2
+ export * from './Currency.ts';
3
+ export * from './Escrow/index.ts';
4
+ export * from './Payment/index.ts';
5
+ export * from './Purchase/index.ts';
6
+ export * from './Receipt/index.ts';
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAA;AAClC,cAAc,eAAe,CAAA;AAC7B,cAAc,mBAAmB,CAAA;AACjC,cAAc,oBAAoB,CAAA;AAClC,cAAc,qBAAqB,CAAA;AACnC,cAAc,oBAAoB,CAAA"}
@@ -1,5 +1,9 @@
1
1
  // src/Billing/Address/Address.ts
2
- import { isPayloadOfSchemaType, isPayloadOfSchemaTypeWithMeta, isPayloadOfSchemaTypeWithSources } from "@xyo-network/payload-model";
2
+ import {
3
+ isPayloadOfSchemaType,
4
+ isPayloadOfSchemaTypeWithMeta,
5
+ isPayloadOfSchemaTypeWithSources
6
+ } from "@xyo-network/payload-model";
3
7
 
4
8
  // src/Schema.ts
5
9
  var PaymentsSchema = "network.xyo.payments";
@@ -50,7 +54,11 @@ var isEscrowOutcomeWithSources = isPayloadOfSchemaTypeWithSources2(EscrowOutcome
50
54
  var isEscrowOutcomeWithMeta = isPayloadOfSchemaTypeWithMeta2(EscrowOutcomeSchema);
51
55
 
52
56
  // src/Escrow/Terms.ts
53
- import { isPayloadOfSchemaType as isPayloadOfSchemaType3, isPayloadOfSchemaTypeWithMeta as isPayloadOfSchemaTypeWithMeta3, isPayloadOfSchemaTypeWithSources as isPayloadOfSchemaTypeWithSources3 } from "@xyo-network/payload-model";
57
+ import {
58
+ isPayloadOfSchemaType as isPayloadOfSchemaType3,
59
+ isPayloadOfSchemaTypeWithMeta as isPayloadOfSchemaTypeWithMeta3,
60
+ isPayloadOfSchemaTypeWithSources as isPayloadOfSchemaTypeWithSources3
61
+ } from "@xyo-network/payload-model";
54
62
  var EscrowTermsSchema = `${EscrowSchema}.terms`;
55
63
  var isEscrowTerms = isPayloadOfSchemaType3(EscrowTermsSchema);
56
64
  var isEscrowTermsWithSources = isPayloadOfSchemaTypeWithSources3(EscrowTermsSchema);
@@ -364,7 +372,11 @@ var getSellerSecretSignedValidator = (dictionary) => {
364
372
  };
365
373
 
366
374
  // src/Payment/Instrument/Card/Payload.ts
367
- import { isPayloadOfSchemaType as isPayloadOfSchemaType4, isPayloadOfSchemaTypeWithMeta as isPayloadOfSchemaTypeWithMeta4, isPayloadOfSchemaTypeWithSources as isPayloadOfSchemaTypeWithSources4 } from "@xyo-network/payload-model";
375
+ import {
376
+ isPayloadOfSchemaType as isPayloadOfSchemaType4,
377
+ isPayloadOfSchemaTypeWithMeta as isPayloadOfSchemaTypeWithMeta4,
378
+ isPayloadOfSchemaTypeWithSources as isPayloadOfSchemaTypeWithSources4
379
+ } from "@xyo-network/payload-model";
368
380
 
369
381
  // src/Payment/Schema.ts
370
382
  var PaymentSchema = `${PaymentsSchema}.payment`;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/Billing/Address/Address.ts","../../src/Schema.ts","../../src/Billing/Schema.ts","../../src/Billing/Address/Schema.ts","../../src/Escrow/createEscrowIntent.ts","../../src/Escrow/getEscrowSecret.ts","../../src/Escrow/Outcome.ts","../../src/Escrow/Schema.ts","../../src/Escrow/Terms.ts","../../src/Escrow/validators/common/ModuleInstanceValidators/moduleInstanceValidators.ts","../../src/Escrow/validators/common/TemporalValidators/validateWithinWindow.ts","../../src/Escrow/validators/escrow/agent.ts","../../src/Escrow/validators/escrow/appraisal.ts","../../src/Escrow/validators/escrow/appraisalAuthorities.ts","../../src/Escrow/validators/escrow/assets.ts","../../src/Escrow/validators/escrow/buyer.ts","../../src/Escrow/validators/escrow/buyerSecret.ts","../../src/Escrow/validators/escrow/nbfExp.ts","../../src/Escrow/validators/escrow/paymentAuthorities.ts","../../src/Escrow/validators/escrow/seller.ts","../../src/Escrow/validators/escrow/sellerSecret.ts","../../src/Payment/Instrument/Card/Payload.ts","../../src/Payment/Schema.ts","../../src/Payment/Instrument/Schema.ts","../../src/Payment/Instrument/Card/Schema.ts","../../src/Payment/Payload.ts","../../src/Payment/Status/Payload.ts","../../src/Payment/Status/Schema.ts","../../src/Purchase/Payload.ts","../../src/Purchase/Schema.ts","../../src/Receipt/Payload.ts","../../src/Receipt/Schema.ts"],"sourcesContent":["import type { Payload } from '@xyo-network/payload-model'\nimport { isPayloadOfSchemaType, isPayloadOfSchemaTypeWithMeta, 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)\n\n/**\n * Identity function for determine if an object is a BillingAddress with sources\n */\nexport const isBillingAddressWithSources = isPayloadOfSchemaTypeWithSources<BillingAddress>(BillingAddressSchema)\n\n/**\n * Identity function for determine if an object is a BillingAddress with meta\n */\nexport const isBillingAddressWithMeta = isPayloadOfSchemaTypeWithMeta<BillingAddress>(BillingAddressSchema)\n","export const PaymentsSchema = 'network.xyo.payments'\nexport type PaymentsSchema = typeof PaymentsSchema\n","import { PaymentsSchema } from '../Schema.ts'\n\nexport const BillingSchema = `${PaymentsSchema}.billing`\nexport type BillingSchema = typeof BillingSchema\n","import { BillingSchema } from '../Schema.ts'\n\nexport const BillingAddressSchema = `${BillingSchema}.address`\nexport type BillingAddressSchema = typeof BillingAddressSchema\n","import type { AccountInstance } from '@xyo-network/account-model'\nimport { BoundWitnessBuilder } from '@xyo-network/boundwitness-builder'\nimport type { IdPayload } from '@xyo-network/id-payload-plugin'\n\nimport type { EscrowTerms } from './Terms.ts'\n\n/**\n * Creates an escrow intent\n * @deprecated Use createEscrowIntentWithSecret instead\n * @param terms The payloads describing the terms for the escrow\n * @param account The account to create the escrow intent with\n * @returns The escrow intent\n */\nexport const createEscrowIntent = async (terms: EscrowTerms[], account: AccountInstance) => {\n const result = await new BoundWitnessBuilder({ accounts: [account] }).payloads([...terms]).build()\n return result\n}\n\n/**\n * Creates an escrow intent (for a buyer or seller) using the supplied secret\n * @param terms The payload describing the terms for the escrow\n * @param secret The secret for the escrow principal party to use for the escrow\n * @param account The account to create the escrow intent with\n * @returns The escrow intent\n */\nexport const createEscrowIntentWithSecret = async (terms: EscrowTerms, secret: IdPayload, account: AccountInstance) => {\n const result = await new BoundWitnessBuilder({ accounts: [account] }).payloads([terms, secret]).build()\n return result\n}\n","import { Crypto } from '@xylabs/crypto'\nimport type { IdPayload } from '@xyo-network/id-payload-plugin'\nimport { IdSchema } from '@xyo-network/id-payload-plugin'\n\n/**\n * Returns a cryptographically random secret to use for escrow\n * @returns The escrow secret\n */\nexport const getEscrowSecret = (): IdPayload => {\n return { salt: Crypto.randomUUID(), schema: IdSchema }\n}\n","import type { Hash } from '@xylabs/hex'\nimport type {\n PayloadWithSources } from '@xyo-network/payload-model'\nimport {\n isPayloadOfSchemaType,\n isPayloadOfSchemaTypeWithMeta,\n isPayloadOfSchemaTypeWithSources,\n} from '@xyo-network/payload-model'\n\nimport { EscrowSchema } from './Schema.ts'\n\nexport const EscrowOutcomeSchema = `${EscrowSchema}.outcome` as const\nexport type EscrowOutcomeSchema = typeof EscrowOutcomeSchema\n\n/**\n * The possible outcomes for an escrow\n */\nexport type EscrowOutcomes = 'fulfilled' | 'expired' // TODO: More outcomes\n\nexport interface EscrowOutcomeFields {\n outcome: EscrowOutcomes\n terms: Hash\n}\n\n/**\n * The terms of an escrow\n */\nexport type EscrowOutcome = PayloadWithSources<EscrowOutcomeFields, EscrowOutcomeSchema>\n\n/**\n * Identity function for determining if an object is an EscrowOutcome\n */\nexport const isEscrowOutcome = isPayloadOfSchemaType<EscrowOutcome>(EscrowOutcomeSchema)\n\n/**\n * Identity function for determining if an object is an EscrowOutcome with sources\n */\nexport const isEscrowOutcomeWithSources = isPayloadOfSchemaTypeWithSources<EscrowOutcome>(EscrowOutcomeSchema)\n\n/**\n * Identity function for determining if an object is an EscrowOutcome with meta\n */\nexport const isEscrowOutcomeWithMeta = isPayloadOfSchemaTypeWithMeta<EscrowOutcome>(EscrowOutcomeSchema)\n","export const EscrowSchema = 'network.xyo.escrow'\nexport type EscrowSchema = typeof EscrowSchema\n","import type { Address, Hash } from '@xylabs/hex'\nimport type { Payload } from '@xyo-network/payload-model'\nimport { isPayloadOfSchemaType, isPayloadOfSchemaTypeWithMeta, 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 * The escrow agent responsible for the escrow\n */\n escrowAgent: Address\n /**\n * The time the escrow expires\n */\n exp: number\n /**\n * The time the escrow starts\n */\n nbf: number\n /**\n * The trusted payment authorities\n */\n paymentAuthorities: Address[]\n /**\n * The seller\n */\n seller: Address[]\n /**\n * The seller\n */\n sellerSecret: Hash\n}\n\n/**\n * The terms of an escrow\n */\nexport type EscrowTerms = Payload<Partial<EscrowTermsFields>, EscrowTermsSchema>\n\n/**\n * Identity function for determining if an object is an EscrowTerms\n */\nexport const isEscrowTerms = isPayloadOfSchemaType<EscrowTerms>(EscrowTermsSchema)\n\n/**\n * Identity function for determining if an object is an EscrowTerms with sources\n */\nexport const isEscrowTermsWithSources = isPayloadOfSchemaTypeWithSources<EscrowTerms>(EscrowTermsSchema)\n\n/**\n * Identity function for determining if an object is an EscrowTerms with meta\n */\nexport const isEscrowTermsWithMeta = isPayloadOfSchemaTypeWithMeta<EscrowTerms>(EscrowTermsSchema)\n","import type { ModuleIdentifier } from '@xyo-network/module-model'\nimport type { PayloadValueExpression } from '@xyo-network/payload-model'\n\nimport type { EscrowTerms } from '../../../Terms.ts'\n\n/**\n * Checks if property value of the escrow terms contains one of the valid moduleIdentifiers\n * @param escrowTerms The escrow terms to validate\n * @param propertyExpression The selector to get the property containing the moduleIdentifier(s) from the escrow terms\n * @param moduleIdentifiers The list of allowed moduleIdentifiers\n * @param required Is the property required to be present\n * @returns True if the property value contains one of the valid moduleIdentifiers\n */\nexport const moduleIdentifiersContainsOneOf = (\n escrowTerms: EscrowTerms,\n propertyExpression: PayloadValueExpression<EscrowTerms, 'appraisalAuthorities' | 'buyer' | 'escrowAgent' | 'paymentAuthorities' | 'seller'>,\n moduleIdentifiers: ModuleIdentifier[],\n required: boolean = true,\n) => {\n const termsValue: string | string[] | undefined = propertyExpression(escrowTerms)\n if (termsValue === undefined) {\n return required ? false : true\n } else {\n return Array.isArray(termsValue) ? termsValue.some(address => moduleIdentifiers.includes(address)) : moduleIdentifiers.includes(termsValue)\n }\n}\n\n/**\n * Checks if property value of the escrow terms contains all of the valid moduleIdentifiers\n * @param escrowTerms The escrow terms to validate\n * @param selector The selector to get the property containing the moduleIdentifier(s) from the escrow terms\n * @param moduleIdentifiers The list of allowed moduleIdentifiers\n * @param required Is the property required to be present\n * @returns True if the property value contains all of the valid moduleIdentifiers\n */\nexport const moduleIdentifiersContainsAllOf = (\n escrowTerms: EscrowTerms,\n selector: PayloadValueExpression<EscrowTerms, 'appraisalAuthorities' | 'buyer' | 'escrowAgent' | 'paymentAuthorities' | 'seller'>,\n moduleIdentifiers: ModuleIdentifier[],\n required: boolean = true,\n) => {\n const termsValue: string | string[] | undefined = selector(escrowTerms)\n if (termsValue === undefined) {\n return required ? false : true\n } else {\n return Array.isArray(termsValue) ? termsValue.every(address => moduleIdentifiers.includes(address)) : moduleIdentifiers.includes(termsValue)\n }\n}\n","export type Windowed = { exp?: number; nbf?: number }\n\nexport const validateWithinWindow = (value: Windowed, exp: number, nbf: number = Date.now()): boolean => {\n if (value.nbf === undefined || value.nbf > nbf) return false\n if (value.exp === undefined || value.exp < exp) return false\n return true\n}\n","import type { ModuleIdentifier } from '@xyo-network/module-model'\nimport type { PayloadValidationFunction } from '@xyo-network/payload-model'\n\nimport type { EscrowTerms } from '../../Terms.ts'\nimport { moduleIdentifiersContainsOneOf } from '../common/index.ts'\n\nconst name = 'EscrowTerms.escrowAgent'\n\nexport const getEscrowAgentAllowedValidator = (allowedEscrowAgent: ModuleIdentifier): PayloadValidationFunction<EscrowTerms> => {\n return (terms: EscrowTerms) => {\n const result = moduleIdentifiersContainsOneOf(terms, t => t.escrowAgent, [allowedEscrowAgent], true)\n if (!result) {\n console.log(`${name}: Escrow agent not allowed: ${terms.escrowAgent}`)\n }\n return result\n }\n}\n","import { assertEx } from '@xylabs/assert'\nimport type { Hash } from '@xylabs/hex'\nimport type { BoundWitness } from '@xyo-network/boundwitness-model'\nimport { isBoundWitnessWithMeta } from '@xyo-network/boundwitness-model'\nimport type { HashLeaseEstimate } from '@xyo-network/diviner-hash-lease'\nimport { isHashLeaseEstimateWithSources } from '@xyo-network/diviner-hash-lease'\nimport type { Payload, PayloadValidationFunction, WithMeta, WithSources } from '@xyo-network/payload-model'\n\nimport type { EscrowTerms } from '../../Terms.ts'\nimport { validateWithinWindow } from '../common/index.ts'\n\nconst name = 'EscrowTerms.appraisal'\n\n/**\n * A function that validates the escrow terms for tbe existence of appraisals\n * @returns True if the escrow terms contain appraisals, false otherwise\n */\nexport const appraisalsExistValidator: PayloadValidationFunction<EscrowTerms> = (terms: EscrowTerms) => {\n // Validate we have appraisals\n const appraisals = terms.appraisals\n if (!appraisals || appraisals.length === 0) {\n console.log(`${name}: No appraisals: ${terms.appraisals}`)\n return false\n }\n return true\n}\n\n/**\n * Returns a function that validates the escrow terms for appraisals which are from valid authorities\n * @param dictionary Payload dictionary of the escrow terms\n * @returns A function that validates the escrow terms for appraisals which are from valid authorities\n */\nexport const getAppraisalsFromValidAuthoritiesValidator = (dictionary: Record<Hash, WithMeta<Payload>>): PayloadValidationFunction<EscrowTerms> => {\n return (terms: EscrowTerms) => {\n const appraisals = assertEx(terms.appraisals, () => `${name}: No appraisals: ${terms.appraisals}`)\n const appraisalAuthorities = assertEx(terms.appraisalAuthorities, () => `${name}: No appraisalAuthorities: ${terms.appraisalAuthorities}`)\n\n // Validate the appraisals are signed by valid appraisal authorities. Validation criteria:\n // - We have a bw for each of the appraisal\n // - The bw is signed by an approved appraisal authority\n const appraisalBWsValid: Record<Hash, WithMeta<BoundWitness>[]> = Object.fromEntries(\n appraisals.map<[Hash, WithMeta<BoundWitness>[]]>(hash => [hash, []]),\n )\n for (const bw of Object.values(dictionary).filter(isBoundWitnessWithMeta)) {\n for (const appraisal of appraisals) {\n if (bw.payload_hashes.includes(appraisal) && bw.addresses.some(address => appraisalAuthorities.includes(address))) {\n appraisalBWsValid[appraisal].push(bw)\n }\n }\n }\n for (const [appraisal, bws] of Object.entries(appraisalBWsValid)) {\n if (bws.length === 0) {\n console.log(`${name}: No valid appraisals for ${appraisal}`)\n return false\n }\n }\n return true\n }\n}\n\n/**\n * Returns a function that validates the escrow terms for appraisals which are valid\n * @param dictionary Payload dictionary of the escrow terms\n * @param minimumExp The minium amount of time an estimate needs to be valid\n * for in the future (so as not to expire before the escrow is complete)\n * @returns A function that validates the escrow terms for appraisals which are valid\n */\nexport const getAppraisalsValidValidator = (\n dictionary: Record<Hash, WithMeta<Payload>>,\n minimumExp: number,\n): PayloadValidationFunction<EscrowTerms> => {\n return (terms: EscrowTerms) => {\n // Verify we have an estimate for each of the assets\n const estimatesByAsset = getEstimatesByAsset(terms, dictionary)\n // Validate each of the estimates are valid (time, price, etc)\n const now = Date.now()\n const exp = now + minimumExp\n for (const [asset, estimates] of Object.entries(estimatesByAsset)) {\n for (const estimate of estimates) {\n if (!validateEstimate(estimate, exp)) {\n console.log(`${name}: Invalid estimate for asset ${asset}: ${estimate}`)\n return false\n }\n }\n }\n return true\n }\n}\n\n/**\n * Returns a function that validates the escrow terms to ensure that they contain an appraisal for each asset\n * @param dictionary Payload dictionary of the escrow terms\n * @returns A function that validates the escrow terms for appraisals\n */\nexport const getAppraisalsForAllAssetsValidator = (dictionary: Record<Hash, WithMeta<Payload>>): PayloadValidationFunction<EscrowTerms> => {\n return (terms: EscrowTerms) => {\n // Verify we have an estimate for each of the assets\n const estimatesByAsset = getEstimatesByAsset(terms, dictionary)\n const assets = assertEx(terms.assets, () => `${name}: No assets: ${terms.assets}`)\n if (Object.keys(estimatesByAsset).length !== assets.length) {\n console.log(`${name}: Missing appraisals for all assets: ${assets}`)\n return false\n }\n return true\n }\n}\n\nconst validateEstimate = (estimate: WithSources<HashLeaseEstimate>, exp: number): boolean => {\n if (!validateWithinWindow(estimate, exp)) return false\n if (estimate.currency !== 'USD') return false\n if (estimate.price <= 0) return false\n return true\n}\n\nconst getEstimatesByAsset = (terms: EscrowTerms, dictionary: Record<Hash, WithMeta<Payload>>): Record<Hash, WithSources<HashLeaseEstimate>[]> => {\n const assets = assertEx(terms.assets, () => `${name}: No assets: ${terms.assets}`)\n const estimates = Object.values(dictionary).filter(isHashLeaseEstimateWithSources) as unknown as WithSources<HashLeaseEstimate>[]\n const estimatesByAsset: Record<Hash, WithSources<HashLeaseEstimate>[]> = {}\n for (const estimate of estimates) {\n const { sources } = estimate\n if (sources === undefined || sources.length === 0) {\n console.log(`${name}: No sources: ${estimate}`)\n continue\n }\n for (const asset of assets) {\n if (sources.includes(asset)) {\n if (!estimatesByAsset[asset]) estimatesByAsset[asset] = []\n estimatesByAsset[asset].push(estimate)\n }\n }\n }\n return estimatesByAsset\n}\n","import { asAddress } from '@xylabs/hex'\nimport type { ModuleIdentifier } from '@xyo-network/module-model'\nimport type { PayloadValidationFunction } from '@xyo-network/payload-model'\n\nimport type { EscrowTerms } from '../../Terms.ts'\nimport { moduleIdentifiersContainsAllOf } from '../common/index.ts'\n\nconst name = 'EscrowTerms.appraisalAuthorities'\n\n/**\n * A function that validates the escrow terms for appraisalAuthorities\n * @returns True if the escrow terms contain appraisalAuthorities, false otherwise\n */\nexport const appraisalAuthoritiesExistValidator: PayloadValidationFunction<EscrowTerms> = (terms: EscrowTerms) => {\n // Validate we have appraisalAuthorities\n const appraisalAuthorities = terms.appraisalAuthorities\n if (!appraisalAuthorities || appraisalAuthorities.length === 0) {\n console.log(`${name}: No appraisalAuthorities: ${terms.appraisalAuthorities}`)\n return false\n }\n // Validate the authorities are addresses\n if (appraisalAuthorities.map(x => asAddress(x)).length !== appraisalAuthorities.length) {\n console.log(`${name}: Invalid address: ${terms.appraisalAuthorities}`)\n return false\n }\n return true\n}\n\nexport const getAppraisalAuthoritiesAllowedValidator = (allowed: ModuleIdentifier[]): PayloadValidationFunction<EscrowTerms> => {\n return (terms: EscrowTerms) => {\n const result = moduleIdentifiersContainsAllOf(terms, t => t.appraisalAuthorities, allowed, true)\n if (!result) {\n console.log(`${name}: Appraisal authority not allowed: ${terms.appraisalAuthorities}`)\n }\n return result\n }\n}\n","import type { PayloadValidationFunction } from '@xyo-network/payload-model'\n\nimport type { EscrowTerms } from '../../Terms.ts'\n\nconst name = 'EscrowTerms.assets'\n\n/**\n * Returns a function that validates the escrow terms for assets\n * @returns A function that validates the escrow terms for assets\n */\nexport const assetsExistValidator: PayloadValidationFunction<EscrowTerms> = (terms: EscrowTerms) => {\n // Validate we have assets\n const assets = terms.assets\n if (!assets || assets.length === 0) {\n console.log(`${name}: No assets: ${terms.assets}`)\n return false\n }\n return true\n}\n","import { asAddress } from '@xylabs/hex'\nimport type { PayloadValidationFunction } from '@xyo-network/payload-model'\n\nimport type { EscrowTerms } from '../../Terms.ts'\n\nconst name = 'EscrowTerms.buyer'\n\n/**\n * A function that validates the escrow terms for buyer\n * @returns True if the escrow terms contain buyer, false otherwise\n */\nexport const buyerExistsValidator: PayloadValidationFunction<EscrowTerms> = (terms: EscrowTerms) => {\n // Validate we have buyer\n const buyer = terms.buyer\n if (!buyer || buyer.length === 0) {\n console.log(`${name}: No buyer: ${terms.buyer}`)\n return false\n }\n // Validate the authorities are addresses\n if (buyer.map(x => asAddress(x)).length !== buyer.length) {\n console.log(`${name}: Invalid address: ${terms.buyer}`)\n return false\n }\n return true\n}\n","import { assertEx } from '@xylabs/assert'\nimport type { Hash } from '@xylabs/hex'\nimport { isBoundWitnessWithMeta } from '@xyo-network/boundwitness-model'\nimport { BoundWitnessValidator } from '@xyo-network/boundwitness-validator'\nimport type { Payload, PayloadValidationFunction, WithMeta } from '@xyo-network/payload-model'\n\nimport type { EscrowTerms } from '../../Terms.ts'\n\nconst name = 'EscrowTerms.buyerSecret'\n\n/**\n * Returns a function that validates the escrow terms for buyerSecret\n * @returns A function that validates the escrow terms for buyerSecret\n */\nexport const buyerSecretExistsValidator: PayloadValidationFunction<EscrowTerms> = (terms: EscrowTerms) => {\n // Validate we have buyerSecret\n const buyerSecret = terms.buyerSecret\n if (!buyerSecret || buyerSecret.length === 0) {\n console.log(`${name}: No buyerSecret: ${terms.buyerSecret}`)\n return false\n }\n return true\n}\n\n/**\n * Returns a function that validates the escrow terms for the existence of the buyerSecret in the dictionary\n * @param dictionary Payload dictionary of the escrow terms\n * @returns A function that validates the escrow terms for the existence of the buyerSecret in the dictionary\n */\nexport const getBuyerSecretSuppliedValidator = (dictionary: Record<Hash, WithMeta<Payload>>): PayloadValidationFunction<EscrowTerms> => {\n return (terms: EscrowTerms) => {\n const buyerSecret = assertEx(terms.buyerSecret, () => `${name}: No buyerSecret: ${terms.buyerSecret}`)\n if (!dictionary[buyerSecret]) {\n console.log(`${name}: Payload not supplied for buyerSecret: ${buyerSecret}`)\n return false\n }\n return true\n }\n}\n\n/**\n * Returns a function that validates the escrow terms for the existence of the buyerSecret signed by the buyer\n * @param dictionary Payload dictionary of the escrow terms\n * @returns A function that validates the escrow terms for the existence of the buyerSecret signed by the buyer\n */\nexport const getBuyerSecretSignedValidator = (dictionary: Record<Hash, WithMeta<Payload>>): PayloadValidationFunction<EscrowTerms> => {\n return async (terms: EscrowTerms) => {\n const buyer = assertEx(terms.buyer, () => `${name}: No buyer: ${terms.buyer}`)\n const buyerSecret = assertEx(terms.buyerSecret, () => `${name}: No buyerSecret: ${terms.buyerSecret}`)\n // Buyer-signed buyer secrets\n const buyerSecretBWs = Object.values(dictionary)\n // Find all BoundWitnesses\n .filter(isBoundWitnessWithMeta)\n // That contain the buyer secret\n .filter(bw => bw.payload_hashes.includes(buyerSecret))\n // That are signed by all the buyers\n .filter(bw => buyer.every(buyerAddress => bw.addresses.includes(buyerAddress)))\n\n // If there are no buyerSecret BWs, return false\n if (buyerSecretBWs.length === 0) {\n console.log(`${name}: No BoundWitnesses supplied for buyerSecret: ${buyerSecret}`)\n return false\n }\n\n // Ensure each BW supplied for the buyerSecret is valid\n const errors = await Promise.all(buyerSecretBWs.map(bw => new BoundWitnessValidator(bw).validate()))\n const validBoundWitnesses = errors.every(errors => errors.length === 0)\n if (!validBoundWitnesses) {\n console.log(`${name}: Invalid BoundWitnesses supplied for buyerSecret: ${buyerSecret}`)\n return false\n }\n return true\n }\n}\n","import type { PayloadValidationFunction } from '@xyo-network/payload-model'\n\nimport type { EscrowTerms } from '../../Terms.ts'\n\nexport const getNbfExpValidator = (now: number, minRequiredDuration: number): PayloadValidationFunction<EscrowTerms> => {\n const minExp = now + minRequiredDuration\n return (terms: EscrowTerms) => {\n const { exp, nbf } = terms\n if (nbf === undefined || nbf < now) {\n console.log(`EscrowTerms.nbf: invalid nbf ${terms.nbf}`)\n return false\n }\n if (exp === undefined || exp < minExp || nbf > exp) {\n console.log(`EscrowTerms.exp: invalid exp ${terms.exp}`)\n return false\n }\n return true\n }\n}\n","import type { ModuleIdentifier } from '@xyo-network/module-model'\nimport type { PayloadValidationFunction } from '@xyo-network/payload-model'\n\nimport type { EscrowTerms } from '../../Terms.ts'\nimport { moduleIdentifiersContainsAllOf } from '../common/index.ts'\n\nconst name = 'EscrowTerms.paymentAuthorities'\n\nexport const getPaymentAuthoritiesAllowedValidator = (allowed: ModuleIdentifier[]): PayloadValidationFunction<EscrowTerms> => {\n return (terms: EscrowTerms) => {\n const result = moduleIdentifiersContainsAllOf(terms, t => t.paymentAuthorities, allowed, true)\n if (!result) {\n console.log(`${name}: Payment authority not allowed: ${terms.paymentAuthorities}`)\n }\n return result\n }\n}\n","import { asAddress } from '@xylabs/hex'\nimport type { PayloadValidationFunction } from '@xyo-network/payload-model'\n\nimport type { EscrowTerms } from '../../Terms.ts'\n\nconst name = 'EscrowTerms.seller'\n\n/**\n * A function that validates the escrow terms for seller\n * @returns True if the escrow terms contain seller, false otherwise\n */\nexport const sellerExistsValidator: PayloadValidationFunction<EscrowTerms> = (terms: EscrowTerms) => {\n // Validate we have seller\n const seller = terms.seller\n if (!seller || seller.length === 0) {\n console.log(`${name}: No seller: ${terms.seller}`)\n return false\n }\n // Validate the authorities are addresses\n if (seller.map(x => asAddress(x)).length !== seller.length) {\n console.log(`${name}: Invalid address: ${terms.seller}`)\n return false\n }\n return true\n}\n","import { assertEx } from '@xylabs/assert'\nimport type { Hash } from '@xylabs/hex'\nimport { isBoundWitnessWithMeta } from '@xyo-network/boundwitness-model'\nimport { BoundWitnessValidator } from '@xyo-network/boundwitness-validator'\nimport type { Payload, PayloadValidationFunction, WithMeta } from '@xyo-network/payload-model'\n\nimport type { EscrowTerms } from '../../Terms.ts'\n\nconst name = 'EscrowTerms.sellerSecret'\n\n/**\n * Returns a function that validates the escrow terms for sellerSecret\n * @returns A function that validates the escrow terms for sellerSecret\n */\nexport const sellerSecretExistsValidator: PayloadValidationFunction<EscrowTerms> = (terms: EscrowTerms) => {\n // Validate we have sellerSecret\n const sellerSecret = terms.sellerSecret\n if (!sellerSecret || sellerSecret.length === 0) {\n console.log(`${name}: No sellerSecret: ${terms.sellerSecret}`)\n return false\n }\n return true\n}\n\n/**\n * Returns a function that validates the escrow terms for the existence of the sellerSecret in the dictionary\n * @param dictionary Payload dictionary of the escrow terms\n * @returns A function that validates the escrow terms for the existence of the sellerSecret in the dictionary\n */\nexport const getSellerSecretSuppliedValidator = (dictionary: Record<Hash, WithMeta<Payload>>): PayloadValidationFunction<EscrowTerms> => {\n return (terms: EscrowTerms) => {\n const sellerSecret = assertEx(terms.sellerSecret, () => `${name}: No sellerSecret: ${terms.sellerSecret}`)\n if (!dictionary[sellerSecret]) {\n console.log(`${name}: Payload not supplied for sellerSecret: ${sellerSecret}`)\n return false\n }\n return true\n }\n}\n\n/**\n * Returns a function that validates the escrow terms for the existence of the sellerSecret signed by the seller\n * @param dictionary Payload dictionary of the escrow terms\n * @returns A function that validates the escrow terms for the existence of the sellerSecret signed by the seller\n */\nexport const getSellerSecretSignedValidator = (dictionary: Record<Hash, WithMeta<Payload>>): PayloadValidationFunction<EscrowTerms> => {\n return async (terms: EscrowTerms) => {\n const seller = assertEx(terms.seller, () => `${name}: No seller: ${terms.seller}`)\n const sellerSecret = assertEx(terms.sellerSecret, () => `${name}: No sellerSecret: ${terms.sellerSecret}`)\n // Seller-signed seller secrets\n const sellerSecretBWs = Object.values(dictionary)\n // Find all BoundWitnesses\n .filter(isBoundWitnessWithMeta)\n // That contain the seller secret\n .filter(bw => bw.payload_hashes.includes(sellerSecret))\n // That are signed by all the sellers\n .filter(bw => seller.every(sellerAddress => bw.addresses.includes(sellerAddress)))\n\n // If there are no sellerSecret BWs, return false\n if (sellerSecretBWs.length === 0) {\n console.log(`${name}: No BoundWitnesses supplied for sellerSecret: ${sellerSecret}`)\n return false\n }\n\n // Ensure each BW supplied for the sellerSecret is valid\n const errors = await Promise.all(sellerSecretBWs.map(bw => new BoundWitnessValidator(bw).validate()))\n const validBoundWitnesses = errors.every(errors => errors.length === 0)\n if (!validBoundWitnesses) {\n console.log(`${name}: Invalid BoundWitnesses supplied for sellerSecret: ${sellerSecret}`)\n return false\n }\n return true\n }\n}\n","import type { Payload } from '@xyo-network/payload-model'\nimport { isPayloadOfSchemaType, isPayloadOfSchemaTypeWithMeta, 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)\n\n/**\n * Identity function for determine if an object is a PaymentCard with sources\n */\nexport const isPaymentCardWithSources = isPayloadOfSchemaTypeWithSources<PaymentCard>(PaymentCardSchema)\n\n/**\n * Identity function for determine if an object is a PaymentCard with meta\n */\nexport const isPaymentCardWithMeta = isPayloadOfSchemaTypeWithMeta<PaymentCard>(PaymentCardSchema)\n","import { PaymentsSchema } from '../Schema.ts'\n\nexport const PaymentSchema = `${PaymentsSchema}.payment`\nexport type PaymentSchema = typeof PaymentSchema\n","import { PaymentSchema } from '../Schema.ts'\n\nexport const PaymentInstrumentSchema = `${PaymentSchema}.instrument`\nexport type PaymentInstrumentSchema = typeof PaymentInstrumentSchema\n","import { PaymentInstrumentSchema } from '../Schema.ts'\n\nexport const PaymentCardSchema = `${PaymentInstrumentSchema}.card`\nexport type PaymentCardSchema = typeof PaymentCardSchema\n","import type {\n PayloadWithSources } from '@xyo-network/payload-model'\nimport {\n isPayloadOfSchemaType,\n isPayloadOfSchemaTypeWithMeta,\n isPayloadOfSchemaTypeWithSources,\n} from '@xyo-network/payload-model'\n\nimport type { SupportedCurrency } from '../Currency.ts'\nimport { PaymentSchema } from './Schema.ts'\n\nexport interface PaymentFields {\n /**\n * The amount paid\n */\n amount: number\n /**\n * The currency of the amount paid\n */\n currency: SupportedCurrency\n}\n\n/**\n * A payment is a record of an amount to be paid\n */\nexport type Payment = PayloadWithSources<PaymentFields, PaymentSchema>\n\n/**\n * Identity function for determine if an object is a Payment\n */\nexport const isPayment = isPayloadOfSchemaType<Payment>(PaymentSchema)\n\n/**\n * Identity function for determine if an object is a Payment with sources\n */\nexport const isPaymentWithSources = isPayloadOfSchemaTypeWithSources<Payment>(PaymentSchema)\n\n/**\n * Identity function for determine if an object is a Payment with meta\n */\nexport const isPaymentWithMeta = isPayloadOfSchemaTypeWithMeta<Payment>(PaymentSchema)\n","import type {\n PayloadWithSources } from '@xyo-network/payload-model'\nimport {\n isPayloadOfSchemaType,\n isPayloadOfSchemaTypeWithMeta,\n isPayloadOfSchemaTypeWithSources,\n} from '@xyo-network/payload-model'\n\nimport { PaymentStatusSchema } from './Schema.ts'\n\nexport interface PaymentStatusFields {\n /**\n * The result of the payment (i.e. declined)\n */\n result?: string\n\n /**\n * The status of the payment (i.e. completed)\n */\n status: string\n}\n\n/**\n * A payment status is the outcome of a payment attempt\n */\nexport type PaymentStatus = PayloadWithSources<PaymentStatusFields, PaymentStatusSchema>\n\n/**\n * Identity function for determine if an object is a PaymentStatus\n */\nexport const isPaymentStatus = isPayloadOfSchemaType<PaymentStatus>(PaymentStatusSchema)\n\n/**\n * Identity function for determine if an object is a PaymentStatus with sources\n */\nexport const isPaymentStatusWithSources = isPayloadOfSchemaTypeWithSources<PaymentStatus>(PaymentStatusSchema)\n\n/**\n * Identity function for determine if an object is a PaymentStatus with meta\n */\nexport const isPaymentStatusWithMeta = isPayloadOfSchemaTypeWithMeta<PaymentStatus>(PaymentStatusSchema)\n","import { PaymentSchema } from '../Schema.ts'\n\nexport const PaymentStatusSchema = `${PaymentSchema}.status`\nexport type PaymentStatusSchema = typeof PaymentStatusSchema\n","import type { Hash } from '@xylabs/hex'\nimport type {\n PayloadWithSources } from '@xyo-network/payload-model'\nimport {\n isPayloadOfSchemaType,\n isPayloadOfSchemaTypeWithMeta,\n isPayloadOfSchemaTypeWithSources,\n} from '@xyo-network/payload-model'\n\nimport { PurchaseSchema } from './Schema.ts'\n\nexport interface PurchaseFields {\n /**\n * The things that were purchased\n */\n assets: Hash[]\n /**\n * The receipts for payments for this purchase. Array to allow for multiple payments\n * for a single quote.\n */\n receipts: Hash[]\n}\n\n/**\n * A purchase ties a payment made to a quote\n */\nexport type Purchase = PayloadWithSources<PurchaseFields, PurchaseSchema>\n\n/**\n * Identity function for determine if an object is a Purchase\n */\nexport const isPurchase = isPayloadOfSchemaType<Purchase>(PurchaseSchema)\n\n/**\n * Identity function for determine if an object is a Purchase with sources\n */\nexport const isPurchaseWithSources = isPayloadOfSchemaTypeWithSources<Purchase>(PurchaseSchema)\n\n/**\n * Identity function for determine if an object is a Purchase with meta\n */\nexport const isPurchaseWithMeta = isPayloadOfSchemaTypeWithMeta<Purchase>(PurchaseSchema)\n","import { PaymentsSchema } from '../Schema.ts'\n\nexport const PurchaseSchema = `${PaymentsSchema}.purchase`\nexport type PurchaseSchema = typeof PurchaseSchema\n","import type {\n PayloadWithSources } from '@xyo-network/payload-model'\nimport {\n isPayloadOfSchemaType,\n isPayloadOfSchemaTypeWithMeta,\n isPayloadOfSchemaTypeWithSources,\n} from '@xyo-network/payload-model'\n\nimport type { SupportedCurrency } from '../Currency.ts'\nimport { ReceiptSchema } from './Schema.ts'\n\nexport interface ReceiptFields {\n /**\n * The amount paid\n */\n amount: number\n /**\n * The currency of the amount paid\n */\n currency: SupportedCurrency\n}\n\n/**\n * A receipt is a record of a payment made\n */\nexport type Receipt = PayloadWithSources<ReceiptFields, ReceiptSchema>\n\n/**\n * Identity function for determine if an object is a Receipt\n */\nexport const isReceipt = isPayloadOfSchemaType<Receipt>(ReceiptSchema)\n\n/**\n * Identity function for determine if an object is a Receipt with sources\n */\nexport const isReceiptWithSources = isPayloadOfSchemaTypeWithSources<Receipt>(ReceiptSchema)\n\n/**\n * Identity function for determine if an object is a Receipt with meta\n */\nexport const isReceiptWithMeta = isPayloadOfSchemaTypeWithMeta<Receipt>(ReceiptSchema)\n","import { PaymentsSchema } from '../Schema.ts'\n\nexport const ReceiptSchema = `${PaymentsSchema}.receipt`\nexport type ReceiptSchema = typeof ReceiptSchema\n"],"mappings":";AACA,SAAS,uBAAuB,+BAA+B,wCAAwC;;;ACDhG,IAAM,iBAAiB;;;ACEvB,IAAM,gBAAgB,GAAG,cAAc;;;ACAvC,IAAM,uBAAuB,GAAG,aAAa;;;AHmC7C,IAAM,mBAAmB,sBAAsC,oBAAoB;AAKnF,IAAM,8BAA8B,iCAAiD,oBAAoB;AAKzG,IAAM,2BAA2B,8BAA8C,oBAAoB;;;AI9C1G,SAAS,2BAA2B;AAY7B,IAAM,qBAAqB,O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aTypeWithSources","isPayloadOfSchemaTypeWithMeta","isPayloadOfSchemaType","isPayloadOfSchemaTypeWithMeta","isPayloadOfSchemaTypeWithSources","isPayloadOfSchemaType","isPayloadOfSchemaTypeWithSources","isPayloadOfSchemaTypeWithMeta","name","name","name","asAddress","name","assertEx","isBoundWitnessWithMeta","name","errors","name","asAddress","name","assertEx","isBoundWitnessWithMeta","BoundWitnessValidator","name","errors","isPayloadOfSchemaType","isPayloadOfSchemaTypeWithMeta","isPayloadOfSchemaTypeWithSources","isPayloadOfSchemaType","isPayloadOfSchemaTypeWithSources","isPayloadOfSchemaTypeWithMeta","isPayloadOfSchemaType","isPayloadOfSchemaTypeWithMeta","isPayloadOfSchemaTypeWithSources","isPayloadOfSchemaType","isPayloadOfSchemaTypeWithSources","isPayloadOfSchemaTypeWithMeta","isPayloadOfSchemaType","isPayloadOfSchemaTypeWithMeta","isPayloadOfSchemaTypeWithSources","isPayloadOfSchemaType","isPayloadOfSchemaTypeWithSources","isPayloadOfSchemaTypeWithMeta","isPayloadOfSchemaType","isPayloadOfSchemaTypeWithMeta","isPayloadOfSchemaTypeWithSources","isPayloadOfSchemaType","isPayloadOfSchemaTypeWithSources","isPayloadOfSchemaTypeWithMeta","isPayloadOfSchemaType","isPayloadOfSchemaTypeWithMeta","isPayloadOfSchemaTypeWithSources","isPayloadOfSchemaType","isPayloadOfSchemaTypeWithSources","isPayloadOfSchemaTypeWithMeta"]}
1
+ {"version":3,"sources":["../../src/Billing/Address/Address.ts","../../src/Schema.ts","../../src/Billing/Schema.ts","../../src/Billing/Address/Schema.ts","../../src/Escrow/createEscrowIntent.ts","../../src/Escrow/getEscrowSecret.ts","../../src/Escrow/Outcome.ts","../../src/Escrow/Schema.ts","../../src/Escrow/Terms.ts","../../src/Escrow/validators/common/ModuleInstanceValidators/moduleInstanceValidators.ts","../../src/Escrow/validators/common/TemporalValidators/validateWithinWindow.ts","../../src/Escrow/validators/escrow/agent.ts","../../src/Escrow/validators/escrow/appraisal.ts","../../src/Escrow/validators/escrow/appraisalAuthorities.ts","../../src/Escrow/validators/escrow/assets.ts","../../src/Escrow/validators/escrow/buyer.ts","../../src/Escrow/validators/escrow/buyerSecret.ts","../../src/Escrow/validators/escrow/nbfExp.ts","../../src/Escrow/validators/escrow/paymentAuthorities.ts","../../src/Escrow/validators/escrow/seller.ts","../../src/Escrow/validators/escrow/sellerSecret.ts","../../src/Payment/Instrument/Card/Payload.ts","../../src/Payment/Schema.ts","../../src/Payment/Instrument/Schema.ts","../../src/Payment/Instrument/Card/Schema.ts","../../src/Payment/Payload.ts","../../src/Payment/Status/Payload.ts","../../src/Payment/Status/Schema.ts","../../src/Purchase/Payload.ts","../../src/Purchase/Schema.ts","../../src/Receipt/Payload.ts","../../src/Receipt/Schema.ts"],"sourcesContent":["import type { Payload } from '@xyo-network/payload-model'\nimport {\n isPayloadOfSchemaType, isPayloadOfSchemaTypeWithMeta, isPayloadOfSchemaTypeWithSources,\n} from '@xyo-network/payload-model'\n\nimport { BillingAddressSchema } from './Schema.ts'\n\n/**\n * The fields describing a billing address.\n */\nexport interface BillingAddressFields {\n /** Street address line 1. */\n address?: string\n /** Street address line 2. */\n address2?: string | null\n /** City of the billing address. */\n city?: string\n /** Country code of the billing address, ISO 3166-1 alpha-2 code. */\n country?: string\n /** First name */\n firstName: string\n /** Last name */\n lastName: string\n /** Organization or company name associated with the billing address. */\n organization?: string | null\n /** Postal or ZIP code of the billing address. */\n postalCode?: string\n /** State or region of the billing address. */\n region?: string\n}\n\n/**\n * A BillingAddress Payload\n */\nexport type BillingAddress = Payload<BillingAddressFields, BillingAddressSchema>\n\n/**\n * Identity function for determine if an object is a BillingAddress\n */\nexport const isBillingAddress = isPayloadOfSchemaType<BillingAddress>(BillingAddressSchema)\n\n/**\n * Identity function for determine if an object is a BillingAddress with sources\n */\nexport const isBillingAddressWithSources = isPayloadOfSchemaTypeWithSources<BillingAddress>(BillingAddressSchema)\n\n/**\n * Identity function for determine if an object is a BillingAddress with meta\n */\nexport const isBillingAddressWithMeta = isPayloadOfSchemaTypeWithMeta<BillingAddress>(BillingAddressSchema)\n","export const PaymentsSchema = 'network.xyo.payments'\nexport type PaymentsSchema = typeof PaymentsSchema\n","import { PaymentsSchema } from '../Schema.ts'\n\nexport const BillingSchema = `${PaymentsSchema}.billing`\nexport type BillingSchema = typeof BillingSchema\n","import { BillingSchema } from '../Schema.ts'\n\nexport const BillingAddressSchema = `${BillingSchema}.address`\nexport type BillingAddressSchema = typeof BillingAddressSchema\n","import type { AccountInstance } from '@xyo-network/account-model'\nimport { BoundWitnessBuilder } from '@xyo-network/boundwitness-builder'\nimport type { IdPayload } from '@xyo-network/id-payload-plugin'\n\nimport type { EscrowTerms } from './Terms.ts'\n\n/**\n * Creates an escrow intent\n * @deprecated Use createEscrowIntentWithSecret instead\n * @param terms The payloads describing the terms for the escrow\n * @param account The account to create the escrow intent with\n * @returns The escrow intent\n */\nexport const createEscrowIntent = async (terms: EscrowTerms[], account: AccountInstance) => {\n const result = await new BoundWitnessBuilder({ accounts: [account] }).payloads([...terms]).build()\n return result\n}\n\n/**\n * Creates an escrow intent (for a buyer or seller) using the supplied secret\n * @param terms The payload describing the terms for the escrow\n * @param secret The secret for the escrow principal party to use for the escrow\n * @param account The account to create the escrow intent with\n * @returns The escrow intent\n */\nexport const createEscrowIntentWithSecret = async (terms: EscrowTerms, secret: IdPayload, account: AccountInstance) => {\n const result = await new BoundWitnessBuilder({ accounts: [account] }).payloads([terms, secret]).build()\n return result\n}\n","import { Crypto } from '@xylabs/crypto'\nimport type { IdPayload } from '@xyo-network/id-payload-plugin'\nimport { IdSchema } from '@xyo-network/id-payload-plugin'\n\n/**\n * Returns a cryptographically random secret to use for escrow\n * @returns The escrow secret\n */\nexport const getEscrowSecret = (): IdPayload => {\n return { salt: Crypto.randomUUID(), schema: IdSchema }\n}\n","import type { Hash } from '@xylabs/hex'\nimport type { PayloadWithSources } from '@xyo-network/payload-model'\nimport {\n isPayloadOfSchemaType,\n isPayloadOfSchemaTypeWithMeta,\n isPayloadOfSchemaTypeWithSources,\n} from '@xyo-network/payload-model'\n\nimport { EscrowSchema } from './Schema.ts'\n\nexport const EscrowOutcomeSchema = `${EscrowSchema}.outcome` as const\nexport type EscrowOutcomeSchema = typeof EscrowOutcomeSchema\n\n/**\n * The possible outcomes for an escrow\n */\nexport type EscrowOutcomes = 'fulfilled' | 'expired' // TODO: More outcomes\n\nexport interface EscrowOutcomeFields {\n outcome: EscrowOutcomes\n terms: Hash\n}\n\n/**\n * The terms of an escrow\n */\nexport type EscrowOutcome = PayloadWithSources<EscrowOutcomeFields, EscrowOutcomeSchema>\n\n/**\n * Identity function for determining if an object is an EscrowOutcome\n */\nexport const isEscrowOutcome = isPayloadOfSchemaType<EscrowOutcome>(EscrowOutcomeSchema)\n\n/**\n * Identity function for determining if an object is an EscrowOutcome with sources\n */\nexport const isEscrowOutcomeWithSources = isPayloadOfSchemaTypeWithSources<EscrowOutcome>(EscrowOutcomeSchema)\n\n/**\n * Identity function for determining if an object is an EscrowOutcome with meta\n */\nexport const isEscrowOutcomeWithMeta = isPayloadOfSchemaTypeWithMeta<EscrowOutcome>(EscrowOutcomeSchema)\n","export const EscrowSchema = 'network.xyo.escrow'\nexport type EscrowSchema = typeof EscrowSchema\n","import type { Address, Hash } from '@xylabs/hex'\nimport type { Payload } from '@xyo-network/payload-model'\nimport {\n isPayloadOfSchemaType, isPayloadOfSchemaTypeWithMeta, isPayloadOfSchemaTypeWithSources,\n} from '@xyo-network/payload-model'\n\nimport { EscrowSchema } from './Schema.ts'\n\nexport const EscrowTermsSchema = `${EscrowSchema}.terms` as const\nexport type EscrowTermsSchema = typeof EscrowTermsSchema\n\n// TODO: Include escrow agent in escrow terms\nexport interface EscrowTermsFields {\n /**\n * The trusted estimators for the worth of the things being sold\n */\n appraisalAuthorities: Address[]\n /**\n * The estimated worths of the things being sold\n */\n appraisals: Hash[]\n /**\n * The things being sold\n */\n assets: Hash[]\n /**\n * The buyer\n */\n buyer: Address[]\n /**\n * The buyer\n */\n buyerSecret: Hash\n /**\n * The escrow agent responsible for the escrow\n */\n escrowAgent: Address\n /**\n * The time the escrow expires\n */\n exp: number\n /**\n * The time the escrow starts\n */\n nbf: number\n /**\n * The trusted payment authorities\n */\n paymentAuthorities: Address[]\n /**\n * The seller\n */\n seller: Address[]\n /**\n * The seller\n */\n sellerSecret: Hash\n}\n\n/**\n * The terms of an escrow\n */\nexport type EscrowTerms = Payload<Partial<EscrowTermsFields>, EscrowTermsSchema>\n\n/**\n * Identity function for determining if an object is an EscrowTerms\n */\nexport const isEscrowTerms = isPayloadOfSchemaType<EscrowTerms>(EscrowTermsSchema)\n\n/**\n * Identity function for determining if an object is an EscrowTerms with sources\n */\nexport const isEscrowTermsWithSources = isPayloadOfSchemaTypeWithSources<EscrowTerms>(EscrowTermsSchema)\n\n/**\n * Identity function for determining if an object is an EscrowTerms with meta\n */\nexport const isEscrowTermsWithMeta = isPayloadOfSchemaTypeWithMeta<EscrowTerms>(EscrowTermsSchema)\n","import type { ModuleIdentifier } from '@xyo-network/module-model'\nimport type { PayloadValueExpression } from '@xyo-network/payload-model'\n\nimport type { EscrowTerms } from '../../../Terms.ts'\n\n/**\n * Checks if property value of the escrow terms contains one of the valid moduleIdentifiers\n * @param escrowTerms The escrow terms to validate\n * @param propertyExpression The selector to get the property containing the moduleIdentifier(s) from the escrow terms\n * @param moduleIdentifiers The list of allowed moduleIdentifiers\n * @param required Is the property required to be present\n * @returns True if the property value contains one of the valid moduleIdentifiers\n */\nexport const moduleIdentifiersContainsOneOf = (\n escrowTerms: EscrowTerms,\n propertyExpression: PayloadValueExpression<EscrowTerms, 'appraisalAuthorities' | 'buyer' | 'escrowAgent' | 'paymentAuthorities' | 'seller'>,\n moduleIdentifiers: ModuleIdentifier[],\n required: boolean = true,\n) => {\n const termsValue: string | string[] | undefined = propertyExpression(escrowTerms)\n if (termsValue === undefined) {\n return required ? false : true\n } else {\n return Array.isArray(termsValue) ? termsValue.some(address => moduleIdentifiers.includes(address)) : moduleIdentifiers.includes(termsValue)\n }\n}\n\n/**\n * Checks if property value of the escrow terms contains all of the valid moduleIdentifiers\n * @param escrowTerms The escrow terms to validate\n * @param selector The selector to get the property containing the moduleIdentifier(s) from the escrow terms\n * @param moduleIdentifiers The list of allowed moduleIdentifiers\n * @param required Is the property required to be present\n * @returns True if the property value contains all of the valid moduleIdentifiers\n */\nexport const moduleIdentifiersContainsAllOf = (\n escrowTerms: EscrowTerms,\n selector: PayloadValueExpression<EscrowTerms, 'appraisalAuthorities' | 'buyer' | 'escrowAgent' | 'paymentAuthorities' | 'seller'>,\n moduleIdentifiers: ModuleIdentifier[],\n required: boolean = true,\n) => {\n const termsValue: string | string[] | undefined = selector(escrowTerms)\n if (termsValue === undefined) {\n return required ? false : true\n } else {\n return Array.isArray(termsValue) ? termsValue.every(address => moduleIdentifiers.includes(address)) : moduleIdentifiers.includes(termsValue)\n }\n}\n","export type Windowed = { exp?: number; nbf?: number }\n\nexport const validateWithinWindow = (value: Windowed, exp: number, nbf: number = Date.now()): boolean => {\n if (value.nbf === undefined || value.nbf > nbf) return false\n if (value.exp === undefined || value.exp < exp) return false\n return true\n}\n","import type { ModuleIdentifier } from '@xyo-network/module-model'\nimport type { PayloadValidationFunction } from '@xyo-network/payload-model'\n\nimport type { EscrowTerms } from '../../Terms.ts'\nimport { moduleIdentifiersContainsOneOf } from '../common/index.ts'\n\nconst name = 'EscrowTerms.escrowAgent'\n\nexport const getEscrowAgentAllowedValidator = (allowedEscrowAgent: ModuleIdentifier): PayloadValidationFunction<EscrowTerms> => {\n return (terms: EscrowTerms) => {\n const result = moduleIdentifiersContainsOneOf(terms, t => t.escrowAgent, [allowedEscrowAgent], true)\n if (!result) {\n console.log(`${name}: Escrow agent not allowed: ${terms.escrowAgent}`)\n }\n return result\n }\n}\n","import { assertEx } from '@xylabs/assert'\nimport type { Hash } from '@xylabs/hex'\nimport type { BoundWitness } from '@xyo-network/boundwitness-model'\nimport { isBoundWitnessWithMeta } from '@xyo-network/boundwitness-model'\nimport type { HashLeaseEstimate } from '@xyo-network/diviner-hash-lease'\nimport { isHashLeaseEstimateWithSources } from '@xyo-network/diviner-hash-lease'\nimport type {\n Payload, PayloadValidationFunction, WithMeta, WithSources,\n} from '@xyo-network/payload-model'\n\nimport type { EscrowTerms } from '../../Terms.ts'\nimport { validateWithinWindow } from '../common/index.ts'\n\nconst name = 'EscrowTerms.appraisal'\n\n/**\n * A function that validates the escrow terms for tbe existence of appraisals\n * @returns True if the escrow terms contain appraisals, false otherwise\n */\nexport const appraisalsExistValidator: PayloadValidationFunction<EscrowTerms> = (terms: EscrowTerms) => {\n // Validate we have appraisals\n const appraisals = terms.appraisals\n if (!appraisals || appraisals.length === 0) {\n console.log(`${name}: No appraisals: ${terms.appraisals}`)\n return false\n }\n return true\n}\n\n/**\n * Returns a function that validates the escrow terms for appraisals which are from valid authorities\n * @param dictionary Payload dictionary of the escrow terms\n * @returns A function that validates the escrow terms for appraisals which are from valid authorities\n */\nexport const getAppraisalsFromValidAuthoritiesValidator = (dictionary: Record<Hash, WithMeta<Payload>>): PayloadValidationFunction<EscrowTerms> => {\n return (terms: EscrowTerms) => {\n const appraisals = assertEx(terms.appraisals, () => `${name}: No appraisals: ${terms.appraisals}`)\n const appraisalAuthorities = assertEx(terms.appraisalAuthorities, () => `${name}: No appraisalAuthorities: ${terms.appraisalAuthorities}`)\n\n // Validate the appraisals are signed by valid appraisal authorities. Validation criteria:\n // - We have a bw for each of the appraisal\n // - The bw is signed by an approved appraisal authority\n const appraisalBWsValid: Record<Hash, WithMeta<BoundWitness>[]> = Object.fromEntries(\n appraisals.map<[Hash, WithMeta<BoundWitness>[]]>(hash => [hash, []]),\n )\n for (const bw of Object.values(dictionary).filter(isBoundWitnessWithMeta)) {\n for (const appraisal of appraisals) {\n if (bw.payload_hashes.includes(appraisal) && bw.addresses.some(address => appraisalAuthorities.includes(address))) {\n appraisalBWsValid[appraisal].push(bw)\n }\n }\n }\n for (const [appraisal, bws] of Object.entries(appraisalBWsValid)) {\n if (bws.length === 0) {\n console.log(`${name}: No valid appraisals for ${appraisal}`)\n return false\n }\n }\n return true\n }\n}\n\n/**\n * Returns a function that validates the escrow terms for appraisals which are valid\n * @param dictionary Payload dictionary of the escrow terms\n * @param minimumExp The minium amount of time an estimate needs to be valid\n * for in the future (so as not to expire before the escrow is complete)\n * @returns A function that validates the escrow terms for appraisals which are valid\n */\nexport const getAppraisalsValidValidator = (\n dictionary: Record<Hash, WithMeta<Payload>>,\n minimumExp: number,\n): PayloadValidationFunction<EscrowTerms> => {\n return (terms: EscrowTerms) => {\n // Verify we have an estimate for each of the assets\n const estimatesByAsset = getEstimatesByAsset(terms, dictionary)\n // Validate each of the estimates are valid (time, price, etc)\n const now = Date.now()\n const exp = now + minimumExp\n for (const [asset, estimates] of Object.entries(estimatesByAsset)) {\n for (const estimate of estimates) {\n if (!validateEstimate(estimate, exp)) {\n console.log(`${name}: Invalid estimate for asset ${asset}: ${estimate}`)\n return false\n }\n }\n }\n return true\n }\n}\n\n/**\n * Returns a function that validates the escrow terms to ensure that they contain an appraisal for each asset\n * @param dictionary Payload dictionary of the escrow terms\n * @returns A function that validates the escrow terms for appraisals\n */\nexport const getAppraisalsForAllAssetsValidator = (dictionary: Record<Hash, WithMeta<Payload>>): PayloadValidationFunction<EscrowTerms> => {\n return (terms: EscrowTerms) => {\n // Verify we have an estimate for each of the assets\n const estimatesByAsset = getEstimatesByAsset(terms, dictionary)\n const assets = assertEx(terms.assets, () => `${name}: No assets: ${terms.assets}`)\n if (Object.keys(estimatesByAsset).length !== assets.length) {\n console.log(`${name}: Missing appraisals for all assets: ${assets}`)\n return false\n }\n return true\n }\n}\n\nconst validateEstimate = (estimate: WithSources<HashLeaseEstimate>, exp: number): boolean => {\n if (!validateWithinWindow(estimate, exp)) return false\n if (estimate.currency !== 'USD') return false\n if (estimate.price <= 0) return false\n return true\n}\n\nconst getEstimatesByAsset = (terms: EscrowTerms, dictionary: Record<Hash, WithMeta<Payload>>): Record<Hash, WithSources<HashLeaseEstimate>[]> => {\n const assets = assertEx(terms.assets, () => `${name}: No assets: ${terms.assets}`)\n const estimates = Object.values(dictionary).filter(isHashLeaseEstimateWithSources) as unknown as WithSources<HashLeaseEstimate>[]\n const estimatesByAsset: Record<Hash, WithSources<HashLeaseEstimate>[]> = {}\n for (const estimate of estimates) {\n const { sources } = estimate\n if (sources === undefined || sources.length === 0) {\n console.log(`${name}: No sources: ${estimate}`)\n continue\n }\n for (const asset of assets) {\n if (sources.includes(asset)) {\n if (!estimatesByAsset[asset]) estimatesByAsset[asset] = []\n estimatesByAsset[asset].push(estimate)\n }\n }\n }\n return estimatesByAsset\n}\n","import { asAddress } from '@xylabs/hex'\nimport type { ModuleIdentifier } from '@xyo-network/module-model'\nimport type { PayloadValidationFunction } from '@xyo-network/payload-model'\n\nimport type { EscrowTerms } from '../../Terms.ts'\nimport { moduleIdentifiersContainsAllOf } from '../common/index.ts'\n\nconst name = 'EscrowTerms.appraisalAuthorities'\n\n/**\n * A function that validates the escrow terms for appraisalAuthorities\n * @returns True if the escrow terms contain appraisalAuthorities, false otherwise\n */\nexport const appraisalAuthoritiesExistValidator: PayloadValidationFunction<EscrowTerms> = (terms: EscrowTerms) => {\n // Validate we have appraisalAuthorities\n const appraisalAuthorities = terms.appraisalAuthorities\n if (!appraisalAuthorities || appraisalAuthorities.length === 0) {\n console.log(`${name}: No appraisalAuthorities: ${terms.appraisalAuthorities}`)\n return false\n }\n // Validate the authorities are addresses\n if (appraisalAuthorities.map(x => asAddress(x)).length !== appraisalAuthorities.length) {\n console.log(`${name}: Invalid address: ${terms.appraisalAuthorities}`)\n return false\n }\n return true\n}\n\nexport const getAppraisalAuthoritiesAllowedValidator = (allowed: ModuleIdentifier[]): PayloadValidationFunction<EscrowTerms> => {\n return (terms: EscrowTerms) => {\n const result = moduleIdentifiersContainsAllOf(terms, t => t.appraisalAuthorities, allowed, true)\n if (!result) {\n console.log(`${name}: Appraisal authority not allowed: ${terms.appraisalAuthorities}`)\n }\n return result\n }\n}\n","import type { PayloadValidationFunction } from '@xyo-network/payload-model'\n\nimport type { EscrowTerms } from '../../Terms.ts'\n\nconst name = 'EscrowTerms.assets'\n\n/**\n * Returns a function that validates the escrow terms for assets\n * @returns A function that validates the escrow terms for assets\n */\nexport const assetsExistValidator: PayloadValidationFunction<EscrowTerms> = (terms: EscrowTerms) => {\n // Validate we have assets\n const assets = terms.assets\n if (!assets || assets.length === 0) {\n console.log(`${name}: No assets: ${terms.assets}`)\n return false\n }\n return true\n}\n","import { asAddress } from '@xylabs/hex'\nimport type { PayloadValidationFunction } from '@xyo-network/payload-model'\n\nimport type { EscrowTerms } from '../../Terms.ts'\n\nconst name = 'EscrowTerms.buyer'\n\n/**\n * A function that validates the escrow terms for buyer\n * @returns True if the escrow terms contain buyer, false otherwise\n */\nexport const buyerExistsValidator: PayloadValidationFunction<EscrowTerms> = (terms: EscrowTerms) => {\n // Validate we have buyer\n const buyer = terms.buyer\n if (!buyer || buyer.length === 0) {\n console.log(`${name}: No buyer: ${terms.buyer}`)\n return false\n }\n // Validate the authorities are addresses\n if (buyer.map(x => asAddress(x)).length !== buyer.length) {\n console.log(`${name}: Invalid address: ${terms.buyer}`)\n return false\n }\n return true\n}\n","import { assertEx } from '@xylabs/assert'\nimport type { Hash } from '@xylabs/hex'\nimport { isBoundWitnessWithMeta } from '@xyo-network/boundwitness-model'\nimport { BoundWitnessValidator } from '@xyo-network/boundwitness-validator'\nimport type {\n Payload, PayloadValidationFunction, WithMeta,\n} from '@xyo-network/payload-model'\n\nimport type { EscrowTerms } from '../../Terms.ts'\n\nconst name = 'EscrowTerms.buyerSecret'\n\n/**\n * Returns a function that validates the escrow terms for buyerSecret\n * @returns A function that validates the escrow terms for buyerSecret\n */\nexport const buyerSecretExistsValidator: PayloadValidationFunction<EscrowTerms> = (terms: EscrowTerms) => {\n // Validate we have buyerSecret\n const buyerSecret = terms.buyerSecret\n if (!buyerSecret || buyerSecret.length === 0) {\n console.log(`${name}: No buyerSecret: ${terms.buyerSecret}`)\n return false\n }\n return true\n}\n\n/**\n * Returns a function that validates the escrow terms for the existence of the buyerSecret in the dictionary\n * @param dictionary Payload dictionary of the escrow terms\n * @returns A function that validates the escrow terms for the existence of the buyerSecret in the dictionary\n */\nexport const getBuyerSecretSuppliedValidator = (dictionary: Record<Hash, WithMeta<Payload>>): PayloadValidationFunction<EscrowTerms> => {\n return (terms: EscrowTerms) => {\n const buyerSecret = assertEx(terms.buyerSecret, () => `${name}: No buyerSecret: ${terms.buyerSecret}`)\n if (!dictionary[buyerSecret]) {\n console.log(`${name}: Payload not supplied for buyerSecret: ${buyerSecret}`)\n return false\n }\n return true\n }\n}\n\n/**\n * Returns a function that validates the escrow terms for the existence of the buyerSecret signed by the buyer\n * @param dictionary Payload dictionary of the escrow terms\n * @returns A function that validates the escrow terms for the existence of the buyerSecret signed by the buyer\n */\nexport const getBuyerSecretSignedValidator = (dictionary: Record<Hash, WithMeta<Payload>>): PayloadValidationFunction<EscrowTerms> => {\n return async (terms: EscrowTerms) => {\n const buyer = assertEx(terms.buyer, () => `${name}: No buyer: ${terms.buyer}`)\n const buyerSecret = assertEx(terms.buyerSecret, () => `${name}: No buyerSecret: ${terms.buyerSecret}`)\n // Buyer-signed buyer secrets\n const buyerSecretBWs = Object.values(dictionary)\n // Find all BoundWitnesses\n .filter(isBoundWitnessWithMeta)\n // That contain the buyer secret\n .filter(bw => bw.payload_hashes.includes(buyerSecret))\n // That are signed by all the buyers\n .filter(bw => buyer.every(buyerAddress => bw.addresses.includes(buyerAddress)))\n\n // If there are no buyerSecret BWs, return false\n if (buyerSecretBWs.length === 0) {\n console.log(`${name}: No BoundWitnesses supplied for buyerSecret: ${buyerSecret}`)\n return false\n }\n\n // Ensure each BW supplied for the buyerSecret is valid\n const errors = await Promise.all(buyerSecretBWs.map(bw => new BoundWitnessValidator(bw).validate()))\n const validBoundWitnesses = errors.every(errors => errors.length === 0)\n if (!validBoundWitnesses) {\n console.log(`${name}: Invalid BoundWitnesses supplied for buyerSecret: ${buyerSecret}`)\n return false\n }\n return true\n }\n}\n","import type { PayloadValidationFunction } from '@xyo-network/payload-model'\n\nimport type { EscrowTerms } from '../../Terms.ts'\n\nexport const getNbfExpValidator = (now: number, minRequiredDuration: number): PayloadValidationFunction<EscrowTerms> => {\n const minExp = now + minRequiredDuration\n return (terms: EscrowTerms) => {\n const { exp, nbf } = terms\n if (nbf === undefined || nbf < now) {\n console.log(`EscrowTerms.nbf: invalid nbf ${terms.nbf}`)\n return false\n }\n if (exp === undefined || exp < minExp || nbf > exp) {\n console.log(`EscrowTerms.exp: invalid exp ${terms.exp}`)\n return false\n }\n return true\n }\n}\n","import type { ModuleIdentifier } from '@xyo-network/module-model'\nimport type { PayloadValidationFunction } from '@xyo-network/payload-model'\n\nimport type { EscrowTerms } from '../../Terms.ts'\nimport { moduleIdentifiersContainsAllOf } from '../common/index.ts'\n\nconst name = 'EscrowTerms.paymentAuthorities'\n\nexport const getPaymentAuthoritiesAllowedValidator = (allowed: ModuleIdentifier[]): PayloadValidationFunction<EscrowTerms> => {\n return (terms: EscrowTerms) => {\n const result = moduleIdentifiersContainsAllOf(terms, t => t.paymentAuthorities, allowed, true)\n if (!result) {\n console.log(`${name}: Payment authority not allowed: ${terms.paymentAuthorities}`)\n }\n return result\n }\n}\n","import { asAddress } from '@xylabs/hex'\nimport type { PayloadValidationFunction } from '@xyo-network/payload-model'\n\nimport type { EscrowTerms } from '../../Terms.ts'\n\nconst name = 'EscrowTerms.seller'\n\n/**\n * A function that validates the escrow terms for seller\n * @returns True if the escrow terms contain seller, false otherwise\n */\nexport const sellerExistsValidator: PayloadValidationFunction<EscrowTerms> = (terms: EscrowTerms) => {\n // Validate we have seller\n const seller = terms.seller\n if (!seller || seller.length === 0) {\n console.log(`${name}: No seller: ${terms.seller}`)\n return false\n }\n // Validate the authorities are addresses\n if (seller.map(x => asAddress(x)).length !== seller.length) {\n console.log(`${name}: Invalid address: ${terms.seller}`)\n return false\n }\n return true\n}\n","import { assertEx } from '@xylabs/assert'\nimport type { Hash } from '@xylabs/hex'\nimport { isBoundWitnessWithMeta } from '@xyo-network/boundwitness-model'\nimport { BoundWitnessValidator } from '@xyo-network/boundwitness-validator'\nimport type {\n Payload, PayloadValidationFunction, WithMeta,\n} from '@xyo-network/payload-model'\n\nimport type { EscrowTerms } from '../../Terms.ts'\n\nconst name = 'EscrowTerms.sellerSecret'\n\n/**\n * Returns a function that validates the escrow terms for sellerSecret\n * @returns A function that validates the escrow terms for sellerSecret\n */\nexport const sellerSecretExistsValidator: PayloadValidationFunction<EscrowTerms> = (terms: EscrowTerms) => {\n // Validate we have sellerSecret\n const sellerSecret = terms.sellerSecret\n if (!sellerSecret || sellerSecret.length === 0) {\n console.log(`${name}: No sellerSecret: ${terms.sellerSecret}`)\n return false\n }\n return true\n}\n\n/**\n * Returns a function that validates the escrow terms for the existence of the sellerSecret in the dictionary\n * @param dictionary Payload dictionary of the escrow terms\n * @returns A function that validates the escrow terms for the existence of the sellerSecret in the dictionary\n */\nexport const getSellerSecretSuppliedValidator = (dictionary: Record<Hash, WithMeta<Payload>>): PayloadValidationFunction<EscrowTerms> => {\n return (terms: EscrowTerms) => {\n const sellerSecret = assertEx(terms.sellerSecret, () => `${name}: No sellerSecret: ${terms.sellerSecret}`)\n if (!dictionary[sellerSecret]) {\n console.log(`${name}: Payload not supplied for sellerSecret: ${sellerSecret}`)\n return false\n }\n return true\n }\n}\n\n/**\n * Returns a function that validates the escrow terms for the existence of the sellerSecret signed by the seller\n * @param dictionary Payload dictionary of the escrow terms\n * @returns A function that validates the escrow terms for the existence of the sellerSecret signed by the seller\n */\nexport const getSellerSecretSignedValidator = (dictionary: Record<Hash, WithMeta<Payload>>): PayloadValidationFunction<EscrowTerms> => {\n return async (terms: EscrowTerms) => {\n const seller = assertEx(terms.seller, () => `${name}: No seller: ${terms.seller}`)\n const sellerSecret = assertEx(terms.sellerSecret, () => `${name}: No sellerSecret: ${terms.sellerSecret}`)\n // Seller-signed seller secrets\n const sellerSecretBWs = Object.values(dictionary)\n // Find all BoundWitnesses\n .filter(isBoundWitnessWithMeta)\n // That contain the seller secret\n .filter(bw => bw.payload_hashes.includes(sellerSecret))\n // That are signed by all the sellers\n .filter(bw => seller.every(sellerAddress => bw.addresses.includes(sellerAddress)))\n\n // If there are no sellerSecret BWs, return false\n if (sellerSecretBWs.length === 0) {\n console.log(`${name}: No BoundWitnesses supplied for sellerSecret: ${sellerSecret}`)\n return false\n }\n\n // Ensure each BW supplied for the sellerSecret is valid\n const errors = await Promise.all(sellerSecretBWs.map(bw => new BoundWitnessValidator(bw).validate()))\n const validBoundWitnesses = errors.every(errors => errors.length === 0)\n if (!validBoundWitnesses) {\n console.log(`${name}: Invalid BoundWitnesses supplied for sellerSecret: ${sellerSecret}`)\n return false\n }\n return true\n }\n}\n","import type { Payload } from '@xyo-network/payload-model'\nimport {\n isPayloadOfSchemaType, isPayloadOfSchemaTypeWithMeta, isPayloadOfSchemaTypeWithSources,\n} from '@xyo-network/payload-model'\n\nimport { PaymentCardSchema } from './Schema.ts'\n\n/**\n * The fields describing a payment card.\n */\nexport interface PaymentCardFields {\n /**\n * Card Number (PAN) of the payment card. This value is required to perform a payment.\n */\n cardNumber: string\n /**\n * The name as it appears on the payment card.\n */\n cardholderName?: string\n /**\n * Card Verification Value (CVV/CVC) of the payment card.\n */\n cvv: string\n /**\n * Expiration month of the payment card.\n */\n expMonth: number\n /**\n * Expiration year of the payment card.\n */\n expYear: number\n}\n\n/**\n * A PaymentCard Payload\n */\nexport type PaymentCard = Payload<PaymentCardFields, PaymentCardSchema>\n\n/**\n * Identity function for determine if an object is a PaymentCard\n */\nexport const isPaymentCard = isPayloadOfSchemaType<PaymentCard>(PaymentCardSchema)\n\n/**\n * Identity function for determine if an object is a PaymentCard with sources\n */\nexport const isPaymentCardWithSources = isPayloadOfSchemaTypeWithSources<PaymentCard>(PaymentCardSchema)\n\n/**\n * Identity function for determine if an object is a PaymentCard with meta\n */\nexport const isPaymentCardWithMeta = isPayloadOfSchemaTypeWithMeta<PaymentCard>(PaymentCardSchema)\n","import { PaymentsSchema } from '../Schema.ts'\n\nexport const PaymentSchema = `${PaymentsSchema}.payment`\nexport type PaymentSchema = typeof PaymentSchema\n","import { PaymentSchema } from '../Schema.ts'\n\nexport const PaymentInstrumentSchema = `${PaymentSchema}.instrument`\nexport type PaymentInstrumentSchema = typeof PaymentInstrumentSchema\n","import { PaymentInstrumentSchema } from '../Schema.ts'\n\nexport const PaymentCardSchema = `${PaymentInstrumentSchema}.card`\nexport type PaymentCardSchema = typeof PaymentCardSchema\n","import type { PayloadWithSources } from '@xyo-network/payload-model'\nimport {\n isPayloadOfSchemaType,\n isPayloadOfSchemaTypeWithMeta,\n isPayloadOfSchemaTypeWithSources,\n} from '@xyo-network/payload-model'\n\nimport type { SupportedCurrency } from '../Currency.ts'\nimport { PaymentSchema } from './Schema.ts'\n\nexport interface PaymentFields {\n /**\n * The amount paid\n */\n amount: number\n /**\n * The currency of the amount paid\n */\n currency: SupportedCurrency\n}\n\n/**\n * A payment is a record of an amount to be paid\n */\nexport type Payment = PayloadWithSources<PaymentFields, PaymentSchema>\n\n/**\n * Identity function for determine if an object is a Payment\n */\nexport const isPayment = isPayloadOfSchemaType<Payment>(PaymentSchema)\n\n/**\n * Identity function for determine if an object is a Payment with sources\n */\nexport const isPaymentWithSources = isPayloadOfSchemaTypeWithSources<Payment>(PaymentSchema)\n\n/**\n * Identity function for determine if an object is a Payment with meta\n */\nexport const isPaymentWithMeta = isPayloadOfSchemaTypeWithMeta<Payment>(PaymentSchema)\n","import type { PayloadWithSources } from '@xyo-network/payload-model'\nimport {\n isPayloadOfSchemaType,\n isPayloadOfSchemaTypeWithMeta,\n isPayloadOfSchemaTypeWithSources,\n} from '@xyo-network/payload-model'\n\nimport { PaymentStatusSchema } from './Schema.ts'\n\nexport interface PaymentStatusFields {\n /**\n * The result of the payment (i.e. declined)\n */\n result?: string\n\n /**\n * The status of the payment (i.e. completed)\n */\n status: string\n}\n\n/**\n * A payment status is the outcome of a payment attempt\n */\nexport type PaymentStatus = PayloadWithSources<PaymentStatusFields, PaymentStatusSchema>\n\n/**\n * Identity function for determine if an object is a PaymentStatus\n */\nexport const isPaymentStatus = isPayloadOfSchemaType<PaymentStatus>(PaymentStatusSchema)\n\n/**\n * Identity function for determine if an object is a PaymentStatus with sources\n */\nexport const isPaymentStatusWithSources = isPayloadOfSchemaTypeWithSources<PaymentStatus>(PaymentStatusSchema)\n\n/**\n * Identity function for determine if an object is a PaymentStatus with meta\n */\nexport const isPaymentStatusWithMeta = isPayloadOfSchemaTypeWithMeta<PaymentStatus>(PaymentStatusSchema)\n","import { PaymentSchema } from '../Schema.ts'\n\nexport const PaymentStatusSchema = `${PaymentSchema}.status`\nexport type PaymentStatusSchema = typeof PaymentStatusSchema\n","import type { Hash } from '@xylabs/hex'\nimport type { PayloadWithSources } from '@xyo-network/payload-model'\nimport {\n isPayloadOfSchemaType,\n isPayloadOfSchemaTypeWithMeta,\n isPayloadOfSchemaTypeWithSources,\n} from '@xyo-network/payload-model'\n\nimport { PurchaseSchema } from './Schema.ts'\n\nexport interface PurchaseFields {\n /**\n * The things that were purchased\n */\n assets: Hash[]\n /**\n * The receipts for payments for this purchase. Array to allow for multiple payments\n * for a single quote.\n */\n receipts: Hash[]\n}\n\n/**\n * A purchase ties a payment made to a quote\n */\nexport type Purchase = PayloadWithSources<PurchaseFields, PurchaseSchema>\n\n/**\n * Identity function for determine if an object is a Purchase\n */\nexport const isPurchase = isPayloadOfSchemaType<Purchase>(PurchaseSchema)\n\n/**\n * Identity function for determine if an object is a Purchase with sources\n */\nexport const isPurchaseWithSources = isPayloadOfSchemaTypeWithSources<Purchase>(PurchaseSchema)\n\n/**\n * Identity function for determine if an object is a Purchase with meta\n */\nexport const isPurchaseWithMeta = isPayloadOfSchemaTypeWithMeta<Purchase>(PurchaseSchema)\n","import { PaymentsSchema } from '../Schema.ts'\n\nexport const PurchaseSchema = `${PaymentsSchema}.purchase`\nexport type PurchaseSchema = typeof PurchaseSchema\n","import type { PayloadWithSources } from '@xyo-network/payload-model'\nimport {\n isPayloadOfSchemaType,\n isPayloadOfSchemaTypeWithMeta,\n isPayloadOfSchemaTypeWithSources,\n} from '@xyo-network/payload-model'\n\nimport type { SupportedCurrency } from '../Currency.ts'\nimport { ReceiptSchema } from './Schema.ts'\n\nexport interface ReceiptFields {\n /**\n * The amount paid\n */\n amount: number\n /**\n * The currency of the amount paid\n */\n currency: SupportedCurrency\n}\n\n/**\n * A receipt is a record of a payment made\n */\nexport type Receipt = PayloadWithSources<ReceiptFields, ReceiptSchema>\n\n/**\n * Identity function for determine if an object is a Receipt\n */\nexport const isReceipt = isPayloadOfSchemaType<Receipt>(ReceiptSchema)\n\n/**\n * Identity function for determine if an object is a Receipt with sources\n */\nexport const isReceiptWithSources = isPayloadOfSchemaTypeWithSources<Receipt>(ReceiptSchema)\n\n/**\n * Identity function for determine if an object is a Receipt with meta\n */\nexport const isReceiptWithMeta = isPayloadOfSchemaTypeWithMeta<Receipt>(ReceiptSchema)\n","import { PaymentsSchema } from '../Schema.ts'\n\nexport const ReceiptSchema = `${PaymentsSchema}.receipt`\nexport type ReceiptSchema = typeof ReceiptSchema\n"],"mappings":";AACA;AAAA,EACE;AAAA,EAAuB;AAAA,EAA+B;AAAA,OACjD;;;ACHA,IAAM,iBAAiB;;;ACEvB,IAAM,gBAAgB,GAAG,cAAc;;;ACAvC,IAAM,uBAAuB,GAAG,aAAa;;;AHqC7C,IAAM,mBAAmB,sBAAsC,oBAAoB;AAKnF,IAAM,8BAA8B,iCAAiD,oBAAoB;AAKzG,IAAM,2BAA2B,8BAA8C,oBAAoB;;;AIhD1G,SAAS,2BAA2B;AAY7B,IAAM,qBAAqB,OAAO,OAAsB,YAA6B;AAC1F,QAAM,SAAS,MAAM,IAAI,oBAAoB,EAAE,UAAU,CAAC,OAAO,EAAE,CAAC,EAAE,SAAS,CAAC,GAAG,KAAK,CAAC,EAAE,MAAM;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AAM,oBAAoB,GAAG,uBAAuB;;;AHuCpD,IAAM,gBAAgBC,uBAAmC,iBAAiB;AAK1E,IAAM,2BAA2BC,kCAA8C,iBAAiB;AAKhG,IAAM,wBAAwBC,+BAA2C,iBAAiB;;;AIlDjG;AAAA,EACE,yBAAAC;AAAA,EACA,iCAAAC;AAAA,EACA,oCAAAC;AAAA,OACK;AAwBA,IAAM,YAAYC,uBAA+B,aAAa;AAK9D,IAAM,uBAAuBC,kCAA0C,aAAa;AAKpF,IAAM,oBAAoBC,+BAAuC,aAAa;;;ACtCrF;AAAA,EACE,yBAAAC;AAAA,EACA,iCAAAC;AAAA,EACA,oCAAAC;AAAA,OACK;;;ACHA,IAAM,sBAAsB,GAAG,aAAa;;;AD2B5C,IAAM,kBAAkBC,uBAAqC,mBAAmB;AAKhF,IAAM,6BAA6BC,kCAAgD,mBAAmB;AAKtG,IAAM,0BAA0BC,+BAA6C,mBAAmB;;;AErCvG;AAAA,EACE,yBAAAC;AAAA,EACA,iCAAAC;AAAA,EACA,oCAAAC;AAAA,OACK;;;ACJA,IAAM,iBAAiB,GAAG,cAAc;;;AD4BxC,IAAM,aAAaC,uBAAgC,cAAc;AAKjE,IAAM,wBAAwBC,kCAA2C,cAAc;AAKvF,IAAM,qBAAqBC,+BAAwC,cAAc;;;AEvCxF;AAAA,EACE,yBAAAC;AAAA,EACA,iCAAAC;AAAA,EACA,oCAAAC;AAAA,OACK;;;ACHA,IAAM,gBAAgB,GAAG,cAAc;;;AD2BvC,IAAM,YAAYC,uBAA+B,aAAa;AAK9D,IAAM,uBAAuBC,kCAA0C,aAAa;AAKpF,IAAM,oBAAoBC,+BAAuC,aAAa;","names":["isPayloadOfSchemaType","isPayloadOfSchemaTypeWithMeta","isPayloadOfSchemaTypeWithSources","isPayloadOfSchemaType","isPayloadOfSchemaTypeWithSources","isPayloadOfSchemaTypeWithMeta","isPayloadOfSchemaType","isPayloadOfSchemaTypeWithMeta","isPayloadOfSchemaTypeWithSources","isPayloadOfSchemaType","isPayloadOfSchemaTypeWithSources","isPayloadOfSchemaTypeWithMeta","name","name","name","asAddress","name","assertEx","isBoundWitnessWithMeta","name","errors","name","asAddress","name","assertEx","isBoundWitnessWithMeta","BoundWitnessValidator","name","errors","isPayloadOfSchemaType","isPayloadOfSchemaTypeWithMeta","isPayloadOfSchemaTypeWithSources","isPayloadOfSchemaType","isPayloadOfSchemaTypeWithSources","isPayloadOfSchemaTypeWithMeta","isPayloadOfSchemaType","isPayloadOfSchemaTypeWithMeta","isPayloadOfSchemaTypeWithSources","isPayloadOfSchemaType","isPayloadOfSchemaTypeWithSources","isPayloadOfSchemaTypeWithMeta","isPayloadOfSchemaType","isPayloadOfSchemaTypeWithMeta","isPayloadOfSchemaTypeWithSources","isPayloadOfSchemaType","isPayloadOfSchemaTypeWithSources","isPayloadOfSchemaTypeWithMeta","isPayloadOfSchemaType","isPayloadOfSchemaTypeWithMeta","isPayloadOfSchemaTypeWithSources","isPayloadOfSchemaType","isPayloadOfSchemaTypeWithSources","isPayloadOfSchemaTypeWithMeta","isPayloadOfSchemaType","isPayloadOfSchemaTypeWithMeta","isPayloadOfSchemaTypeWithSources","isPayloadOfSchemaType","isPayloadOfSchemaTypeWithSources","isPayloadOfSchemaTypeWithMeta"]}