@xyo-network/payment-payload-plugins 2.99.5 → 2.99.6

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.
@@ -3,7 +3,6 @@ var __defProp = Object.defineProperty;
3
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
7
6
  var __export = (target, all) => {
8
7
  for (var name10 in all)
9
8
  __defProp(target, name10, { get: all[name10], enumerable: true });
@@ -102,37 +101,21 @@ var isBillingAddressWithMeta = (0, import_payload_model.isPayloadOfSchemaTypeWit
102
101
 
103
102
  // src/Escrow/createEscrowIntent.ts
104
103
  var import_boundwitness_builder = require("@xyo-network/boundwitness-builder");
105
- var createEscrowIntent = /* @__PURE__ */ __name(async (terms, account) => {
106
- const result = await new import_boundwitness_builder.BoundWitnessBuilder({
107
- accounts: [
108
- account
109
- ]
110
- }).payloads([
111
- ...terms
112
- ]).build();
104
+ var createEscrowIntent = async (terms, account) => {
105
+ const result = await new import_boundwitness_builder.BoundWitnessBuilder({ accounts: [account] }).payloads([...terms]).build();
113
106
  return result;
114
- }, "createEscrowIntent");
115
- var createEscrowIntentWithSecret = /* @__PURE__ */ __name(async (terms, secret, account) => {
116
- const result = await new import_boundwitness_builder.BoundWitnessBuilder({
117
- accounts: [
118
- account
119
- ]
120
- }).payloads([
121
- terms,
122
- secret
123
- ]).build();
107
+ };
108
+ var createEscrowIntentWithSecret = async (terms, secret, account) => {
109
+ const result = await new import_boundwitness_builder.BoundWitnessBuilder({ accounts: [account] }).payloads([terms, secret]).build();
124
110
  return result;
125
- }, "createEscrowIntentWithSecret");
111
+ };
126
112
 
127
113
  // src/Escrow/getEscrowSecret.ts
128
114
  var import_crypto = require("@xylabs/crypto");
129
115
  var import_id_payload_plugin = require("@xyo-network/id-payload-plugin");
130
- var getEscrowSecret = /* @__PURE__ */ __name(() => {
131
- return {
132
- salt: import_crypto.Crypto.randomUUID(),
133
- schema: import_id_payload_plugin.IdSchema
134
- };
135
- }, "getEscrowSecret");
116
+ var getEscrowSecret = () => {
117
+ return { salt: import_crypto.Crypto.randomUUID(), schema: import_id_payload_plugin.IdSchema };
118
+ };
136
119
 
137
120
  // src/Escrow/Outcome.ts
138
121
  var import_payload_model2 = require("@xyo-network/payload-model");
@@ -154,65 +137,62 @@ var isEscrowTermsWithSources = (0, import_payload_model3.isPayloadOfSchemaTypeWi
154
137
  var isEscrowTermsWithMeta = (0, import_payload_model3.isPayloadOfSchemaTypeWithMeta)(EscrowTermsSchema);
155
138
 
156
139
  // src/Escrow/validators/common/ModuleInstanceValidators/moduleInstanceValidators.ts
157
- var moduleIdentifiersContainsOneOf = /* @__PURE__ */ __name((escrowTerms, propertyExpression, moduleIdentifiers, required = true) => {
140
+ var moduleIdentifiersContainsOneOf = (escrowTerms, propertyExpression, moduleIdentifiers, required = true) => {
158
141
  const termsValue = propertyExpression(escrowTerms);
159
142
  if (termsValue === void 0) {
160
143
  return required ? false : true;
161
144
  } else {
162
145
  return Array.isArray(termsValue) ? termsValue.some((address) => moduleIdentifiers.includes(address)) : moduleIdentifiers.includes(termsValue);
163
146
  }
164
- }, "moduleIdentifiersContainsOneOf");
165
- var moduleIdentifiersContainsAllOf = /* @__PURE__ */ __name((escrowTerms, selector, moduleIdentifiers, required = true) => {
147
+ };
148
+ var moduleIdentifiersContainsAllOf = (escrowTerms, selector, moduleIdentifiers, required = true) => {
166
149
  const termsValue = selector(escrowTerms);
167
150
  if (termsValue === void 0) {
168
151
  return required ? false : true;
169
152
  } else {
170
153
  return Array.isArray(termsValue) ? termsValue.every((address) => moduleIdentifiers.includes(address)) : moduleIdentifiers.includes(termsValue);
171
154
  }
172
- }, "moduleIdentifiersContainsAllOf");
155
+ };
173
156
 
174
157
  // src/Escrow/validators/common/TemporalValidators/validateWithinWindow.ts
175
- var validateWithinWindow = /* @__PURE__ */ __name((value, exp, nbf = Date.now()) => {
158
+ var validateWithinWindow = (value, exp, nbf = Date.now()) => {
176
159
  if (value.nbf === void 0 || value.nbf > nbf) return false;
177
160
  if (value.exp === void 0 || value.exp < exp) return false;
178
161
  return true;
179
- }, "validateWithinWindow");
162
+ };
180
163
 
181
164
  // src/Escrow/validators/escrow/agent.ts
182
165
  var name = "EscrowTerms.escrowAgent";
183
- var getEscrowAgentAllowedValidator = /* @__PURE__ */ __name((allowedEscrowAgent) => {
166
+ var getEscrowAgentAllowedValidator = (allowedEscrowAgent) => {
184
167
  return (terms) => {
185
- const result = moduleIdentifiersContainsOneOf(terms, (t) => t.escrowAgent, [
186
- allowedEscrowAgent
187
- ], true);
168
+ const result = moduleIdentifiersContainsOneOf(terms, (t) => t.escrowAgent, [allowedEscrowAgent], true);
188
169
  if (!result) {
189
170
  console.log(`${name}: Escrow agent not allowed: ${terms.escrowAgent}`);
190
171
  }
191
172
  return result;
192
173
  };
193
- }, "getEscrowAgentAllowedValidator");
174
+ };
194
175
 
195
176
  // src/Escrow/validators/escrow/appraisal.ts
196
177
  var import_assert = require("@xylabs/assert");
197
178
  var import_boundwitness_model = require("@xyo-network/boundwitness-model");
198
179
  var import_diviner_hash_lease = require("@xyo-network/diviner-hash-lease");
199
180
  var name2 = "EscrowTerms.appraisal";
200
- var appraisalsExistValidator = /* @__PURE__ */ __name((terms) => {
181
+ var appraisalsExistValidator = (terms) => {
201
182
  const appraisals = terms.appraisals;
202
183
  if (!appraisals || appraisals.length === 0) {
203
184
  console.log(`${name2}: No appraisals: ${terms.appraisals}`);
204
185
  return false;
205
186
  }
206
187
  return true;
207
- }, "appraisalsExistValidator");
208
- var getAppraisalsFromValidAuthoritiesValidator = /* @__PURE__ */ __name((dictionary) => {
188
+ };
189
+ var getAppraisalsFromValidAuthoritiesValidator = (dictionary) => {
209
190
  return (terms) => {
210
191
  const appraisals = (0, import_assert.assertEx)(terms.appraisals, () => `${name2}: No appraisals: ${terms.appraisals}`);
211
192
  const appraisalAuthorities = (0, import_assert.assertEx)(terms.appraisalAuthorities, () => `${name2}: No appraisalAuthorities: ${terms.appraisalAuthorities}`);
212
- const appraisalBWsValid = Object.fromEntries(appraisals.map((hash) => [
213
- hash,
214
- []
215
- ]));
193
+ const appraisalBWsValid = Object.fromEntries(
194
+ appraisals.map((hash) => [hash, []])
195
+ );
216
196
  for (const bw of Object.values(dictionary).filter(import_boundwitness_model.isBoundWitnessWithMeta)) {
217
197
  for (const appraisal of appraisals) {
218
198
  if (bw.payload_hashes.includes(appraisal) && bw.addresses.some((address) => appraisalAuthorities.includes(address))) {
@@ -228,8 +208,8 @@ var getAppraisalsFromValidAuthoritiesValidator = /* @__PURE__ */ __name((diction
228
208
  }
229
209
  return true;
230
210
  };
231
- }, "getAppraisalsFromValidAuthoritiesValidator");
232
- var getAppraisalsValidValidator = /* @__PURE__ */ __name((dictionary, minimumExp) => {
211
+ };
212
+ var getAppraisalsValidValidator = (dictionary, minimumExp) => {
233
213
  return (terms) => {
234
214
  const estimatesByAsset = getEstimatesByAsset(terms, dictionary);
235
215
  const now = Date.now();
@@ -244,8 +224,8 @@ var getAppraisalsValidValidator = /* @__PURE__ */ __name((dictionary, minimumExp
244
224
  }
245
225
  return true;
246
226
  };
247
- }, "getAppraisalsValidValidator");
248
- var getAppraisalsForAllAssetsValidator = /* @__PURE__ */ __name((dictionary) => {
227
+ };
228
+ var getAppraisalsForAllAssetsValidator = (dictionary) => {
249
229
  return (terms) => {
250
230
  const estimatesByAsset = getEstimatesByAsset(terms, dictionary);
251
231
  const assets = (0, import_assert.assertEx)(terms.assets, () => `${name2}: No assets: ${terms.assets}`);
@@ -255,14 +235,14 @@ var getAppraisalsForAllAssetsValidator = /* @__PURE__ */ __name((dictionary) =>
255
235
  }
256
236
  return true;
257
237
  };
258
- }, "getAppraisalsForAllAssetsValidator");
259
- var validateEstimate = /* @__PURE__ */ __name((estimate, exp) => {
238
+ };
239
+ var validateEstimate = (estimate, exp) => {
260
240
  if (!validateWithinWindow(estimate, exp)) return false;
261
241
  if (estimate.currency !== "USD") return false;
262
242
  if (estimate.price <= 0) return false;
263
243
  return true;
264
- }, "validateEstimate");
265
- var getEstimatesByAsset = /* @__PURE__ */ __name((terms, dictionary) => {
244
+ };
245
+ var getEstimatesByAsset = (terms, dictionary) => {
266
246
  const assets = (0, import_assert.assertEx)(terms.assets, () => `${name2}: No assets: ${terms.assets}`);
267
247
  const estimates = Object.values(dictionary).filter(import_diviner_hash_lease.isHashLeaseEstimateWithSources);
268
248
  const estimatesByAsset = {};
@@ -280,12 +260,12 @@ var getEstimatesByAsset = /* @__PURE__ */ __name((terms, dictionary) => {
280
260
  }
281
261
  }
282
262
  return estimatesByAsset;
283
- }, "getEstimatesByAsset");
263
+ };
284
264
 
285
265
  // src/Escrow/validators/escrow/appraisalAuthorities.ts
286
266
  var import_hex = require("@xylabs/hex");
287
267
  var name3 = "EscrowTerms.appraisalAuthorities";
288
- var appraisalAuthoritiesExistValidator = /* @__PURE__ */ __name((terms) => {
268
+ var appraisalAuthoritiesExistValidator = (terms) => {
289
269
  const appraisalAuthorities = terms.appraisalAuthorities;
290
270
  if (!appraisalAuthorities || appraisalAuthorities.length === 0) {
291
271
  console.log(`${name3}: No appraisalAuthorities: ${terms.appraisalAuthorities}`);
@@ -296,8 +276,8 @@ var appraisalAuthoritiesExistValidator = /* @__PURE__ */ __name((terms) => {
296
276
  return false;
297
277
  }
298
278
  return true;
299
- }, "appraisalAuthoritiesExistValidator");
300
- var getAppraisalAuthoritiesAllowedValidator = /* @__PURE__ */ __name((allowed) => {
279
+ };
280
+ var getAppraisalAuthoritiesAllowedValidator = (allowed) => {
301
281
  return (terms) => {
302
282
  const result = moduleIdentifiersContainsAllOf(terms, (t) => t.appraisalAuthorities, allowed, true);
303
283
  if (!result) {
@@ -305,23 +285,23 @@ var getAppraisalAuthoritiesAllowedValidator = /* @__PURE__ */ __name((allowed) =
305
285
  }
306
286
  return result;
307
287
  };
308
- }, "getAppraisalAuthoritiesAllowedValidator");
288
+ };
309
289
 
310
290
  // src/Escrow/validators/escrow/assets.ts
311
291
  var name4 = "EscrowTerms.assets";
312
- var assetsExistValidator = /* @__PURE__ */ __name((terms) => {
292
+ var assetsExistValidator = (terms) => {
313
293
  const assets = terms.assets;
314
294
  if (!assets || assets.length === 0) {
315
295
  console.log(`${name4}: No assets: ${terms.assets}`);
316
296
  return false;
317
297
  }
318
298
  return true;
319
- }, "assetsExistValidator");
299
+ };
320
300
 
321
301
  // src/Escrow/validators/escrow/buyer.ts
322
302
  var import_hex2 = require("@xylabs/hex");
323
303
  var name5 = "EscrowTerms.buyer";
324
- var buyerExistsValidator = /* @__PURE__ */ __name((terms) => {
304
+ var buyerExistsValidator = (terms) => {
325
305
  const buyer = terms.buyer;
326
306
  if (!buyer || buyer.length === 0) {
327
307
  console.log(`${name5}: No buyer: ${terms.buyer}`);
@@ -332,22 +312,22 @@ var buyerExistsValidator = /* @__PURE__ */ __name((terms) => {
332
312
  return false;
333
313
  }
334
314
  return true;
335
- }, "buyerExistsValidator");
315
+ };
336
316
 
337
317
  // src/Escrow/validators/escrow/buyerSecret.ts
338
318
  var import_assert2 = require("@xylabs/assert");
339
319
  var import_boundwitness_model2 = require("@xyo-network/boundwitness-model");
340
320
  var import_boundwitness_validator = require("@xyo-network/boundwitness-validator");
341
321
  var name6 = "EscrowTerms.buyerSecret";
342
- var buyerSecretExistsValidator = /* @__PURE__ */ __name((terms) => {
322
+ var buyerSecretExistsValidator = (terms) => {
343
323
  const buyerSecret = terms.buyerSecret;
344
324
  if (!buyerSecret || buyerSecret.length === 0) {
345
325
  console.log(`${name6}: No buyerSecret: ${terms.buyerSecret}`);
346
326
  return false;
347
327
  }
348
328
  return true;
349
- }, "buyerSecretExistsValidator");
350
- var getBuyerSecretSuppliedValidator = /* @__PURE__ */ __name((dictionary) => {
329
+ };
330
+ var getBuyerSecretSuppliedValidator = (dictionary) => {
351
331
  return (terms) => {
352
332
  const buyerSecret = (0, import_assert2.assertEx)(terms.buyerSecret, () => `${name6}: No buyerSecret: ${terms.buyerSecret}`);
353
333
  if (!dictionary[buyerSecret]) {
@@ -356,8 +336,8 @@ var getBuyerSecretSuppliedValidator = /* @__PURE__ */ __name((dictionary) => {
356
336
  }
357
337
  return true;
358
338
  };
359
- }, "getBuyerSecretSuppliedValidator");
360
- var getBuyerSecretSignedValidator = /* @__PURE__ */ __name((dictionary) => {
339
+ };
340
+ var getBuyerSecretSignedValidator = (dictionary) => {
361
341
  return async (terms) => {
362
342
  const buyer = (0, import_assert2.assertEx)(terms.buyer, () => `${name6}: No buyer: ${terms.buyer}`);
363
343
  const buyerSecret = (0, import_assert2.assertEx)(terms.buyerSecret, () => `${name6}: No buyerSecret: ${terms.buyerSecret}`);
@@ -374,10 +354,10 @@ var getBuyerSecretSignedValidator = /* @__PURE__ */ __name((dictionary) => {
374
354
  }
375
355
  return true;
376
356
  };
377
- }, "getBuyerSecretSignedValidator");
357
+ };
378
358
 
379
359
  // src/Escrow/validators/escrow/nbfExp.ts
380
- var getNbfExpValidator = /* @__PURE__ */ __name((now, minRequiredDuration) => {
360
+ var getNbfExpValidator = (now, minRequiredDuration) => {
381
361
  const minExp = now + minRequiredDuration;
382
362
  return (terms) => {
383
363
  const { exp, nbf } = terms;
@@ -391,11 +371,11 @@ var getNbfExpValidator = /* @__PURE__ */ __name((now, minRequiredDuration) => {
391
371
  }
392
372
  return true;
393
373
  };
394
- }, "getNbfExpValidator");
374
+ };
395
375
 
396
376
  // src/Escrow/validators/escrow/paymentAuthorities.ts
397
377
  var name7 = "EscrowTerms.paymentAuthorities";
398
- var getPaymentAuthoritiesAllowedValidator = /* @__PURE__ */ __name((allowed) => {
378
+ var getPaymentAuthoritiesAllowedValidator = (allowed) => {
399
379
  return (terms) => {
400
380
  const result = moduleIdentifiersContainsAllOf(terms, (t) => t.paymentAuthorities, allowed, true);
401
381
  if (!result) {
@@ -403,12 +383,12 @@ var getPaymentAuthoritiesAllowedValidator = /* @__PURE__ */ __name((allowed) =>
403
383
  }
404
384
  return result;
405
385
  };
406
- }, "getPaymentAuthoritiesAllowedValidator");
386
+ };
407
387
 
408
388
  // src/Escrow/validators/escrow/seller.ts
409
389
  var import_hex3 = require("@xylabs/hex");
410
390
  var name8 = "EscrowTerms.seller";
411
- var sellerExistsValidator = /* @__PURE__ */ __name((terms) => {
391
+ var sellerExistsValidator = (terms) => {
412
392
  const seller = terms.seller;
413
393
  if (!seller || seller.length === 0) {
414
394
  console.log(`${name8}: No seller: ${terms.seller}`);
@@ -419,22 +399,22 @@ var sellerExistsValidator = /* @__PURE__ */ __name((terms) => {
419
399
  return false;
420
400
  }
421
401
  return true;
422
- }, "sellerExistsValidator");
402
+ };
423
403
 
424
404
  // src/Escrow/validators/escrow/sellerSecret.ts
425
405
  var import_assert3 = require("@xylabs/assert");
426
406
  var import_boundwitness_model3 = require("@xyo-network/boundwitness-model");
427
407
  var import_boundwitness_validator2 = require("@xyo-network/boundwitness-validator");
428
408
  var name9 = "EscrowTerms.sellerSecret";
429
- var sellerSecretExistsValidator = /* @__PURE__ */ __name((terms) => {
409
+ var sellerSecretExistsValidator = (terms) => {
430
410
  const sellerSecret = terms.sellerSecret;
431
411
  if (!sellerSecret || sellerSecret.length === 0) {
432
412
  console.log(`${name9}: No sellerSecret: ${terms.sellerSecret}`);
433
413
  return false;
434
414
  }
435
415
  return true;
436
- }, "sellerSecretExistsValidator");
437
- var getSellerSecretSuppliedValidator = /* @__PURE__ */ __name((dictionary) => {
416
+ };
417
+ var getSellerSecretSuppliedValidator = (dictionary) => {
438
418
  return (terms) => {
439
419
  const sellerSecret = (0, import_assert3.assertEx)(terms.sellerSecret, () => `${name9}: No sellerSecret: ${terms.sellerSecret}`);
440
420
  if (!dictionary[sellerSecret]) {
@@ -443,8 +423,8 @@ var getSellerSecretSuppliedValidator = /* @__PURE__ */ __name((dictionary) => {
443
423
  }
444
424
  return true;
445
425
  };
446
- }, "getSellerSecretSuppliedValidator");
447
- var getSellerSecretSignedValidator = /* @__PURE__ */ __name((dictionary) => {
426
+ };
427
+ var getSellerSecretSignedValidator = (dictionary) => {
448
428
  return async (terms) => {
449
429
  const seller = (0, import_assert3.assertEx)(terms.seller, () => `${name9}: No seller: ${terms.seller}`);
450
430
  const sellerSecret = (0, import_assert3.assertEx)(terms.sellerSecret, () => `${name9}: No sellerSecret: ${terms.sellerSecret}`);
@@ -461,7 +441,7 @@ var getSellerSecretSignedValidator = /* @__PURE__ */ __name((dictionary) => {
461
441
  }
462
442
  return true;
463
443
  };
464
- }, "getSellerSecretSignedValidator");
444
+ };
465
445
 
466
446
  // src/Payment/Instrument/Card/Payload.ts
467
447
  var import_payload_model4 = require("@xyo-network/payload-model");
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/index.ts","../../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":["export * from './Billing/index.ts'\nexport * from './Currency.ts'\nexport * from './Escrow/index.ts'\nexport * from './Payment/index.ts'\nexport * from './Purchase/index.ts'\nexport * from './Receipt/index.ts'\n","import { isPayloadOfSchemaType, isPayloadOfSchemaTypeWithMeta, isPayloadOfSchemaTypeWithSources, Payload } 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 { AccountInstance } from '@xyo-network/account-model'\nimport { BoundWitnessBuilder } from '@xyo-network/boundwitness-builder'\nimport { IdPayload } from '@xyo-network/id-payload-plugin'\n\nimport { 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 { IdPayload, 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 { Hash } from '@xylabs/hex'\nimport {\n isPayloadOfSchemaType,\n isPayloadOfSchemaTypeWithMeta,\n isPayloadOfSchemaTypeWithSources,\n PayloadWithSources,\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 { Address, Hash } from '@xylabs/hex'\nimport { isPayloadOfSchemaType, isPayloadOfSchemaTypeWithMeta, isPayloadOfSchemaTypeWithSources, Payload } 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 { ModuleIdentifier } from '@xyo-network/module-model'\nimport { PayloadValueExpression } from '@xyo-network/payload-model'\n\nimport { 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 { ModuleIdentifier } from '@xyo-network/module-model'\nimport { PayloadValidationFunction } from '@xyo-network/payload-model'\n\nimport { 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 { Hash } from '@xylabs/hex'\nimport { BoundWitness, isBoundWitnessWithMeta } from '@xyo-network/boundwitness-model'\nimport { HashLeaseEstimate, isHashLeaseEstimateWithSources } from '@xyo-network/diviner-hash-lease'\nimport { Payload, PayloadValidationFunction, WithMeta, WithSources } from '@xyo-network/payload-model'\n\nimport { 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 { ModuleIdentifier } from '@xyo-network/module-model'\nimport { PayloadValidationFunction } from '@xyo-network/payload-model'\n\nimport { 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 { PayloadValidationFunction } from '@xyo-network/payload-model'\n\nimport { 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 { PayloadValidationFunction } from '@xyo-network/payload-model'\n\nimport { 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 { Hash } from '@xylabs/hex'\nimport { isBoundWitnessWithMeta } from '@xyo-network/boundwitness-model'\nimport { BoundWitnessValidator } from '@xyo-network/boundwitness-validator'\nimport { Payload, PayloadValidationFunction, WithMeta } from '@xyo-network/payload-model'\n\nimport { 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 { PayloadValidationFunction } from '@xyo-network/payload-model'\n\nimport { 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 { ModuleIdentifier } from '@xyo-network/module-model'\nimport { PayloadValidationFunction } from '@xyo-network/payload-model'\n\nimport { 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 { PayloadValidationFunction } from '@xyo-network/payload-model'\n\nimport { 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 { Hash } from '@xylabs/hex'\nimport { isBoundWitnessWithMeta } from '@xyo-network/boundwitness-model'\nimport { BoundWitnessValidator } from '@xyo-network/boundwitness-validator'\nimport { Payload, PayloadValidationFunction, WithMeta } from '@xyo-network/payload-model'\n\nimport { 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 { isPayloadOfSchemaType, isPayloadOfSchemaTypeWithMeta, isPayloadOfSchemaTypeWithSources, Payload } 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 {\n isPayloadOfSchemaType,\n isPayloadOfSchemaTypeWithMeta,\n isPayloadOfSchemaTypeWithSources,\n PayloadWithSources,\n} from '@xyo-network/payload-model'\n\nimport { 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 {\n isPayloadOfSchemaType,\n isPayloadOfSchemaTypeWithMeta,\n isPayloadOfSchemaTypeWithSources,\n PayloadWithSources,\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 { Hash } from '@xylabs/hex'\nimport {\n isPayloadOfSchemaType,\n isPayloadOfSchemaTypeWithMeta,\n isPayloadOfSchemaTypeWithSources,\n PayloadWithSources,\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 {\n isPayloadOfSchemaType,\n isPayloadOfSchemaTypeWithMeta,\n isPayloadOfSchemaTypeWithSources,\n PayloadWithSources,\n} from '@xyo-network/payload-model'\n\nimport { 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>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B,GAAGC,uBAAAA;;;AHoC7B,IAAMC,oBAAgBC,6CAAmCC,iBAAAA;AAKzD,IAAMC,+BAA2BC,wDAA8CF,iBAAAA;AAK/E,IAAMG,4BAAwBC,qDAA2CJ,iBAAAA;;;AIhDhF,IAAAK,wBAKO;AAwBA,IAAMC,gBAAYC,6CAA+BC,aAAAA;AAKjD,IAAMC,2BAAuBC,wDAA0CF,aAAAA;AAKvE,IAAMG,wBAAoBC,qDAAuCJ,aAAAA;;;ACvCxE,IAAAK,wBAKO;;;ACHA,IAAMC,sBAAsB,GAAGC,aAAAA;;;AD2B/B,IAAMC,sBAAkBC,6CAAqCC,mBAAAA;AAK7D,IAAMC,iCAA6BC,wDAAgDF,mBAAAA;AAKnF,IAAMG,8BAA0BC,qDAA6CJ,mBAAAA;;;AEtCpF,IAAAK,wBAKO;;;ACJA,IAAMC,iBAAiB,GAAGC,cAAAA;;;AD4B1B,IAAMC,iBAAaC,6CAAgCC,cAAAA;AAKnD,IAAMC,4BAAwBC,wDAA2CF,cAAAA;AAKzE,IAAMG,yBAAqBC,qDAAwCJ,cAAAA;;;AExC1E,IAAAK,wBAKO;;;ACHA,IAAMC,gBAAgB,GAAGC,cAAAA;;;AD2BzB,IAAMC,gBAAYC,6CAA+BC,aAAAA;AAKjD,IAAMC,2BAAuBC,wDAA0CF,aAAAA;AAKvE,IAAMG,wBAAoBC,qDAAuCJ,aAAAA;","names":["PaymentsSchema","BillingSchema","PaymentsSchema","BillingAddressSchema","BillingSchema","isBillingAddress","isPayloadOfSchemaType","BillingAddressSchema","isBillingAddressWithSources","isPayloadOfSchemaTypeWithSources","isBillingAddressWithMeta","isPayloadOfSchemaTypeWithMeta","createEscrowIntent","terms","account","result","BoundWitnessBuilder","accounts","payloads","build","createEscrowIntentWithSecret","secret","getEscrowSecret","salt","Crypto","randomUUID","schema","IdSchema","import_payload_model","EscrowSchema","EscrowOutcomeSchema","EscrowSchema","isEscrowOutcome","isPayloadOfSchemaType","isEscrowOutcomeWithSources","isPayloadOfSchemaTypeWithSources","isEscrowOutcomeWithMeta","isPayloadOfSchemaTypeWithMeta","import_payload_model","EscrowTermsSchema","EscrowSchema","isEscrowTerms","isPayloadOfSchemaType","isEscrowTermsWithSources","isPayloadOfSchemaTypeWithSources","isEscrowTermsWithMeta","isPayloadOfSchemaTypeWithMeta","moduleIdentifiersContainsOneOf","escrowTerms","propertyExpression","moduleIdentifiers","required","termsValue","undefined","Array","isArray","some","address","includes","moduleIdentifiersContainsAllOf","selector","every","validateWithinWindow","value","exp","nbf","Date","now","undefined","name","getEscrowAgentAllowedValidator","allowedEscrowAgent","terms","result","moduleIdentifiersContainsOneOf","t","escrowAgent","console","log","name","appraisalsExistValidator","terms","appraisals","length","console","log","getAppraisalsFromValidAuthoritiesValidator","dictionary","assertEx","appraisalAuthorities","appraisalBWsValid","Object","fromEntries","map","hash","bw","values","filter","isBoundWitnessWithMeta","appraisal","payload_hashes","includes","addresses","some","address","push","bws","entries","getAppraisalsValidValidator","minimumExp","estimatesByAsset","getEstimatesByAsset","now","Date","exp","asset","estimates","estimate","validateEstimate","getAppraisalsForAllAssetsValidator","assets","keys","validateWithinWindow","currency","price","isHashLeaseEstimateWithSources","sources","undefined","name","appraisalAuthoritiesExistValidator","terms","appraisalAuthorities","length","console","log","map","x","asAddress","getAppraisalAuthoritiesAllowedValidator","allowed","result","moduleIdentifiersContainsAllOf","t","name","assetsExistValidator","terms","assets","length","console","log","import_hex","name","buyerExistsValidator","terms","buyer","length","console","log","map","x","asAddress","import_assert","import_boundwitness_model","name","buyerSecretExistsValidator","terms","buyerSecret","length","console","log","getBuyerSecretSuppliedValidator","dictionary","assertEx","getBuyerSecretSignedValidator","buyer","buyerSecretBWs","Object","values","filter","isBoundWitnessWithMeta","bw","payload_hashes","includes","every","buyerAddress","addresses","errors","Promise","all","map","BoundWitnessValidator","validate","validBoundWitnesses","getNbfExpValidator","now","minRequiredDuration","minExp","terms","exp","nbf","undefined","console","log","name","getPaymentAuthoritiesAllowedValidator","allowed","terms","result","moduleIdentifiersContainsAllOf","t","paymentAuthorities","console","log","import_hex","name","sellerExistsValidator","terms","seller","length","console","log","map","x","asAddress","import_assert","import_boundwitness_model","import_boundwitness_validator","name","sellerSecretExistsValidator","terms","sellerSecret","length","console","log","getSellerSecretSuppliedValidator","dictionary","assertEx","getSellerSecretSignedValidator","seller","sellerSecretBWs","Object","values","filter","isBoundWitnessWithMeta","bw","payload_hashes","includes","every","sellerAddress","addresses","errors","Promise","all","map","BoundWitnessValidator","validate","validBoundWitnesses","import_payload_model","PaymentSchema","PaymentsSchema","PaymentInstrumentSchema","PaymentSchema","PaymentCardSchema","PaymentInstrumentSchema","isPaymentCard","isPayloadOfSchemaType","PaymentCardSchema","isPaymentCardWithSources","isPayloadOfSchemaTypeWithSources","isPaymentCardWithMeta","isPayloadOfSchemaTypeWithMeta","import_payload_model","isPayment","isPayloadOfSchemaType","PaymentSchema","isPaymentWithSources","isPayloadOfSchemaTypeWithSources","isPaymentWithMeta","isPayloadOfSchemaTypeWithMeta","import_payload_model","PaymentStatusSchema","PaymentSchema","isPaymentStatus","isPayloadOfSchemaType","PaymentStatusSchema","isPaymentStatusWithSources","isPayloadOfSchemaTypeWithSources","isPaymentStatusWithMeta","isPayloadOfSchemaTypeWithMeta","import_payload_model","PurchaseSchema","PaymentsSchema","isPurchase","isPayloadOfSchemaType","PurchaseSchema","isPurchaseWithSources","isPayloadOfSchemaTypeWithSources","isPurchaseWithMeta","isPayloadOfSchemaTypeWithMeta","import_payload_model","ReceiptSchema","PaymentsSchema","isReceipt","isPayloadOfSchemaType","ReceiptSchema","isReceiptWithSources","isPayloadOfSchemaTypeWithSources","isReceiptWithMeta","isPayloadOfSchemaTypeWithMeta"]}
1
+ {"version":3,"sources":["../../src/index.ts","../../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":["export * from './Billing/index.ts'\nexport * from './Currency.ts'\nexport * from './Escrow/index.ts'\nexport * from './Payment/index.ts'\nexport * from './Purchase/index.ts'\nexport * from './Receipt/index.ts'\n","import { isPayloadOfSchemaType, isPayloadOfSchemaTypeWithMeta, isPayloadOfSchemaTypeWithSources, Payload } 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 { AccountInstance } from '@xyo-network/account-model'\nimport { BoundWitnessBuilder } from '@xyo-network/boundwitness-builder'\nimport { IdPayload } from '@xyo-network/id-payload-plugin'\n\nimport { 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 { IdPayload, 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 { Hash } from '@xylabs/hex'\nimport {\n isPayloadOfSchemaType,\n isPayloadOfSchemaTypeWithMeta,\n isPayloadOfSchemaTypeWithSources,\n PayloadWithSources,\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 { Address, Hash } from '@xylabs/hex'\nimport { isPayloadOfSchemaType, isPayloadOfSchemaTypeWithMeta, isPayloadOfSchemaTypeWithSources, Payload } 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 { ModuleIdentifier } from '@xyo-network/module-model'\nimport { PayloadValueExpression } from '@xyo-network/payload-model'\n\nimport { 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 { ModuleIdentifier } from '@xyo-network/module-model'\nimport { PayloadValidationFunction } from '@xyo-network/payload-model'\n\nimport { 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 { Hash } from '@xylabs/hex'\nimport { BoundWitness, isBoundWitnessWithMeta } from '@xyo-network/boundwitness-model'\nimport { HashLeaseEstimate, isHashLeaseEstimateWithSources } from '@xyo-network/diviner-hash-lease'\nimport { Payload, PayloadValidationFunction, WithMeta, WithSources } from '@xyo-network/payload-model'\n\nimport { 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 { ModuleIdentifier } from '@xyo-network/module-model'\nimport { PayloadValidationFunction } from '@xyo-network/payload-model'\n\nimport { 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 { PayloadValidationFunction } from '@xyo-network/payload-model'\n\nimport { 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 { PayloadValidationFunction } from '@xyo-network/payload-model'\n\nimport { 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 { Hash } from '@xylabs/hex'\nimport { isBoundWitnessWithMeta } from '@xyo-network/boundwitness-model'\nimport { BoundWitnessValidator } from '@xyo-network/boundwitness-validator'\nimport { Payload, PayloadValidationFunction, WithMeta } from '@xyo-network/payload-model'\n\nimport { 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 { PayloadValidationFunction } from '@xyo-network/payload-model'\n\nimport { 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 { ModuleIdentifier } from '@xyo-network/module-model'\nimport { PayloadValidationFunction } from '@xyo-network/payload-model'\n\nimport { 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 { PayloadValidationFunction } from '@xyo-network/payload-model'\n\nimport { 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 { Hash } from '@xylabs/hex'\nimport { isBoundWitnessWithMeta } from '@xyo-network/boundwitness-model'\nimport { BoundWitnessValidator } from '@xyo-network/boundwitness-validator'\nimport { Payload, PayloadValidationFunction, WithMeta } from '@xyo-network/payload-model'\n\nimport { 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 { isPayloadOfSchemaType, isPayloadOfSchemaTypeWithMeta, isPayloadOfSchemaTypeWithSources, Payload } 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 {\n isPayloadOfSchemaType,\n isPayloadOfSchemaTypeWithMeta,\n isPayloadOfSchemaTypeWithSources,\n PayloadWithSources,\n} from '@xyo-network/payload-model'\n\nimport { 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 {\n isPayloadOfSchemaType,\n isPayloadOfSchemaTypeWithMeta,\n isPayloadOfSchemaTypeWithSources,\n PayloadWithSources,\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 { Hash } from '@xylabs/hex'\nimport {\n isPayloadOfSchemaType,\n isPayloadOfSchemaTypeWithMeta,\n isPayloadOfSchemaTypeWithSources,\n PayloadWithSources,\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 {\n isPayloadOfSchemaType,\n isPayloadOfSchemaTypeWithMeta,\n isPayloadOfSchemaTypeWithSources,\n PayloadWithSources,\n} from '@xyo-network/payload-model'\n\nimport { 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":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,2BAAgH;;;ACAzG,IAAM,iBAAiB;;;ACEvB,IAAM,gBAAgB,GAAG,cAAc;;;ACAvC,IAAM,uBAA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AAgB,GAAG,cAAc;;;ACAvC,IAAM,0BAA0B,GAAG,aAAa;;;ACAhD,IAAM,oBAAoB,GAAG,uBAAuB;;;AHoCpD,IAAM,oBAAgB,6CAAmC,iBAAiB;AAK1E,IAAM,+BAA2B,wDAA8C,iBAAiB;AAKhG,IAAM,4BAAwB,qDAA2C,iBAAiB;;;AIhDjG,IAAAC,wBAKO;AAwBA,IAAM,gBAAY,6CAA+B,aAAa;AAK9D,IAAM,2BAAuB,wDAA0C,aAAa;AAKpF,IAAM,wBAAoB,qDAAuC,aAAa;;;ACvCrF,IAAAC,wBAKO;;;ACHA,IAAM,sBAAsB,GAAG,aAAa;;;AD2B5C,IAAM,sBAAkB,6CAAqC,mBAAmB;AAKhF,IAAM,iCAA6B,wDAAgD,mBAAmB;AAKtG,IAAM,8BAA0B,qDAA6C,mBAAmB;;;AEtCvG,IAAAC,wBAKO;;;ACJA,IAAM,iBAAiB,GAAG,cAAc;;;AD4BxC,IAAM,iBAAa,6CAAgC,cAAc;AAKjE,IAAM,4BAAwB,wDAA2C,cAAc;AAKvF,IAAM,yBAAqB,qDAAwC,cAAc;;;AExCxF,IAAAC,wBAKO;;;ACHA,IAAM,gBAAgB,GAAG,cAAc;;;AD2BvC,IAAM,gBAAY,6CAA+B,aAAa;AAK9D,IAAM,2BAAuB,wDAA0C,aAAa;AAKpF,IAAM,wBAAoB,qDAAuC,aAAa;","names":["import_payload_model","import_payload_model","name","name","name","import_hex","name","import_assert","import_boundwitness_model","name","errors","name","import_hex","name","import_assert","import_boundwitness_model","import_boundwitness_validator","name","errors","import_payload_model","import_payload_model","import_payload_model","import_payload_model","import_payload_model"]}