@xyo-network/payment-payload-plugins 2.91.3 → 2.91.5

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.
@@ -1,7 +1,9 @@
1
1
  import { AccountInstance } from '@xyo-network/account-model';
2
+ import { IdPayload } from '@xyo-network/id-payload-plugin';
2
3
  import { EscrowTerms } from './Terms';
3
4
  /**
4
5
  * Creates an escrow intent
6
+ * @deprecated Use createEscrowIntentWithSecret instead
5
7
  * @param terms The payloads describing the terms for the escrow
6
8
  * @param account The account to create the escrow intent with
7
9
  * @returns The escrow intent
@@ -17,4 +19,22 @@ export declare const createEscrowIntent: (terms: EscrowTerms[], account: Account
17
19
  schema: "network.xyo.error.module";
18
20
  sources?: Lowercase<string>[] | undefined;
19
21
  }>[]]>;
22
+ /**
23
+ * Creates an escrow intent (for a buyer or seller) using the supplied secret
24
+ * @param terms The payload describing the terms for the escrow
25
+ * @param secret The secret for the escrow principal party to use for the escrow
26
+ * @param account The account to create the escrow intent with
27
+ * @returns The escrow intent
28
+ */
29
+ export declare const createEscrowIntentWithSecret: (terms: EscrowTerms, secret: IdPayload, account: AccountInstance) => Promise<[import("@xyo-network/payload-model").WithMeta<import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & import("@xyo-network/boundwitness-model").BoundWitnessFields & {
30
+ schema: "network.xyo.boundwitness";
31
+ }>, import("@xyo-network/payload-model").WithMeta<{
32
+ schema: string;
33
+ } & import("@xyo-network/payload-model").PayloadFields>[], import("@xyo-network/payload-model").WithMeta<import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & {
34
+ message?: string | undefined;
35
+ name?: string | undefined;
36
+ query?: Lowercase<string> | undefined;
37
+ schema: "network.xyo.error.module";
38
+ sources?: Lowercase<string>[] | undefined;
39
+ }>[]]>;
20
40
  //# sourceMappingURL=createEscrowIntent.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"createEscrowIntent.d.ts","sourceRoot":"","sources":["../../../src/Escrow/createEscrowIntent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AAG5D,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAErC;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,UAAiB,WAAW,EAAE,WAAW,eAAe;;;;;;;;;;MAGtF,CAAA"}
1
+ {"version":3,"file":"createEscrowIntent.d.ts","sourceRoot":"","sources":["../../../src/Escrow/createEscrowIntent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AAE5D,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAA;AAE1D,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAErC;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,UAAiB,WAAW,EAAE,WAAW,eAAe;;;;;;;;;;MAGtF,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,4BAA4B,UAAiB,WAAW,UAAU,SAAS,WAAW,eAAe;;;;;;;;;;MAGjH,CAAA"}
@@ -1,7 +1,9 @@
1
1
  import { AccountInstance } from '@xyo-network/account-model';
2
+ import { IdPayload } from '@xyo-network/id-payload-plugin';
2
3
  import { EscrowTerms } from './Terms';
3
4
  /**
4
5
  * Creates an escrow intent
6
+ * @deprecated Use createEscrowIntentWithSecret instead
5
7
  * @param terms The payloads describing the terms for the escrow
6
8
  * @param account The account to create the escrow intent with
7
9
  * @returns The escrow intent
@@ -17,4 +19,22 @@ export declare const createEscrowIntent: (terms: EscrowTerms[], account: Account
17
19
  schema: "network.xyo.error.module";
18
20
  sources?: Lowercase<string>[] | undefined;
19
21
  }>[]]>;
22
+ /**
23
+ * Creates an escrow intent (for a buyer or seller) using the supplied secret
24
+ * @param terms The payload describing the terms for the escrow
25
+ * @param secret The secret for the escrow principal party to use for the escrow
26
+ * @param account The account to create the escrow intent with
27
+ * @returns The escrow intent
28
+ */
29
+ export declare const createEscrowIntentWithSecret: (terms: EscrowTerms, secret: IdPayload, account: AccountInstance) => Promise<[import("@xyo-network/payload-model").WithMeta<import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & import("@xyo-network/boundwitness-model").BoundWitnessFields & {
30
+ schema: "network.xyo.boundwitness";
31
+ }>, import("@xyo-network/payload-model").WithMeta<{
32
+ schema: string;
33
+ } & import("@xyo-network/payload-model").PayloadFields>[], import("@xyo-network/payload-model").WithMeta<import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & {
34
+ message?: string | undefined;
35
+ name?: string | undefined;
36
+ query?: Lowercase<string> | undefined;
37
+ schema: "network.xyo.error.module";
38
+ sources?: Lowercase<string>[] | undefined;
39
+ }>[]]>;
20
40
  //# sourceMappingURL=createEscrowIntent.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"createEscrowIntent.d.ts","sourceRoot":"","sources":["../../../src/Escrow/createEscrowIntent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AAG5D,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAErC;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,UAAiB,WAAW,EAAE,WAAW,eAAe;;;;;;;;;;MAGtF,CAAA"}
1
+ {"version":3,"file":"createEscrowIntent.d.ts","sourceRoot":"","sources":["../../../src/Escrow/createEscrowIntent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AAE5D,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAA;AAE1D,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAErC;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,UAAiB,WAAW,EAAE,WAAW,eAAe;;;;;;;;;;MAGtF,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,4BAA4B,UAAiB,WAAW,UAAU,SAAS,WAAW,eAAe;;;;;;;;;;MAGjH,CAAA"}
@@ -1,7 +1,9 @@
1
1
  import { AccountInstance } from '@xyo-network/account-model';
2
+ import { IdPayload } from '@xyo-network/id-payload-plugin';
2
3
  import { EscrowTerms } from './Terms';
3
4
  /**
4
5
  * Creates an escrow intent
6
+ * @deprecated Use createEscrowIntentWithSecret instead
5
7
  * @param terms The payloads describing the terms for the escrow
6
8
  * @param account The account to create the escrow intent with
7
9
  * @returns The escrow intent
@@ -17,4 +19,22 @@ export declare const createEscrowIntent: (terms: EscrowTerms[], account: Account
17
19
  schema: "network.xyo.error.module";
18
20
  sources?: Lowercase<string>[] | undefined;
19
21
  }>[]]>;
22
+ /**
23
+ * Creates an escrow intent (for a buyer or seller) using the supplied secret
24
+ * @param terms The payload describing the terms for the escrow
25
+ * @param secret The secret for the escrow principal party to use for the escrow
26
+ * @param account The account to create the escrow intent with
27
+ * @returns The escrow intent
28
+ */
29
+ export declare const createEscrowIntentWithSecret: (terms: EscrowTerms, secret: IdPayload, account: AccountInstance) => Promise<[import("@xyo-network/payload-model").WithMeta<import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & import("@xyo-network/boundwitness-model").BoundWitnessFields & {
30
+ schema: "network.xyo.boundwitness";
31
+ }>, import("@xyo-network/payload-model").WithMeta<{
32
+ schema: string;
33
+ } & import("@xyo-network/payload-model").PayloadFields>[], import("@xyo-network/payload-model").WithMeta<import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & {
34
+ message?: string | undefined;
35
+ name?: string | undefined;
36
+ query?: Lowercase<string> | undefined;
37
+ schema: "network.xyo.error.module";
38
+ sources?: Lowercase<string>[] | undefined;
39
+ }>[]]>;
20
40
  //# sourceMappingURL=createEscrowIntent.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"createEscrowIntent.d.ts","sourceRoot":"","sources":["../../../src/Escrow/createEscrowIntent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AAG5D,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAErC;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,UAAiB,WAAW,EAAE,WAAW,eAAe;;;;;;;;;;MAGtF,CAAA"}
1
+ {"version":3,"file":"createEscrowIntent.d.ts","sourceRoot":"","sources":["../../../src/Escrow/createEscrowIntent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AAE5D,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAA;AAE1D,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAErC;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,UAAiB,WAAW,EAAE,WAAW,eAAe;;;;;;;;;;MAGtF,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,4BAA4B,UAAiB,WAAW,UAAU,SAAS,WAAW,eAAe;;;;;;;;;;MAGjH,CAAA"}
@@ -25,6 +25,7 @@ __export(src_exports, {
25
25
  PaymentSchema: () => PaymentSchema,
26
26
  PurchaseSchema: () => PurchaseSchema,
27
27
  createEscrowIntent: () => createEscrowIntent,
28
+ createEscrowIntentWithSecret: () => createEscrowIntentWithSecret,
28
29
  getEscrowSecret: () => getEscrowSecret,
29
30
  isEscrowTerms: () => isEscrowTerms,
30
31
  isPayment: () => isPayment
@@ -37,6 +38,10 @@ var createEscrowIntent = async (terms, account) => {
37
38
  const result = await new import_boundwitness_builder.BoundWitnessBuilder({ accounts: [account] }).payloads([...terms]).build();
38
39
  return result;
39
40
  };
41
+ var createEscrowIntentWithSecret = async (terms, secret, account) => {
42
+ const result = await new import_boundwitness_builder.BoundWitnessBuilder({ accounts: [account] }).payloads([terms, secret]).build();
43
+ return result;
44
+ };
40
45
 
41
46
  // src/Escrow/getEscrowSecret.ts
42
47
  var import_crypto = require("@xylabs/crypto");
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/index.ts","../../src/Escrow/createEscrowIntent.ts","../../src/Escrow/getEscrowSecret.ts","../../src/Escrow/Schema.ts","../../src/Escrow/Terms.ts","../../src/Payment.ts","../../src/Purchase.ts"],"sourcesContent":["export * from './Currency'\nexport * from './Escrow'\nexport * from './Payment'\nexport * from './Purchase'\n","import { AccountInstance } from '@xyo-network/account-model'\nimport { BoundWitnessBuilder } from '@xyo-network/boundwitness-builder'\n\nimport { EscrowTerms } from './Terms'\n\n/**\n * Creates an escrow intent\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","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","export type EscrowSchema = 'network.xyo.escrow'\nexport const EscrowSchema: EscrowSchema = 'network.xyo.escrow'\n","import { Address, Hash } from '@xylabs/hex'\nimport { isPayloadOfSchemaType, Payload } from '@xyo-network/payload-model'\n\nimport { EscrowSchema } from './Schema'\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\nexport const isEscrowTerms = isPayloadOfSchemaType<EscrowTerms>(EscrowTermsSchema)\n","import { isPayloadOfSchemaType, PayloadWithSources } from '@xyo-network/payload-model'\n\nimport { SupportedCurrency } from './Currency'\n\nexport type PaymentSchema = 'network.xyo.payments.payment'\nexport const PaymentSchema: PaymentSchema = 'network.xyo.payments.payment'\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 a payment made\n */\nexport type Payment = PayloadWithSources<PaymentFields, PaymentSchema>\n\nexport const isPayment = isPayloadOfSchemaType<Payment>(PaymentSchema)\n","import { Hash } from '@xylabs/hex'\nimport { PayloadWithSources } from '@xyo-network/payload-model'\n\nexport type PurchaseSchema = 'network.xyo.payments.purchase'\nexport const PurchaseSchema: PurchaseSchema = 'network.xyo.payments.purchase'\n\nexport interface PurchaseFields {\n /**\n * The hashes that were purchased\n */\n hashes: Hash[]\n /**\n * The payments for this purchase. Array to allow for multiple payments\n * for a single quote.\n */\n payments: Hash[]\n}\n\n/**\n * A purchase ties a payment made to a quote\n */\nexport type Purchase = PayloadWithSources<PurchaseFields, PurchaseSchema>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACCA,kCAAoC;AAU7B,IAAM,qBAAqB,OAAO,OAAsB,YAA6B;AAC1F,QAAM,SAAS,MAAM,IAAI,gDAAoB,EAAE,UAAU,CAAC,OAAO,EAAE,CAAC,EAAE,SAAS,CAAC,GAAG,KAAK,CAAC,EAAE,MAAM;AACjG,SAAO;AACT;;;ACdA,oBAAuB;AACvB,+BAAoC;AAM7B,IAAM,kBAAkB,MAAiB;AAC9C,SAAO,EAAE,MAAM,qBAAO,WAAW,GAAG,QAAQ,kCAAS;AACvD;;;ACRO,IAAM,eAA6B;;;ACA1C,2BAA+C;AAIxC,IAAM,oBAAoB,GAAG,YAAY;AAwDzC,IAAM,oBAAgB,4CAAmC,iBAAiB;;;AC7DjF,IAAAA,wBAA0D;AAKnD,IAAM,gBAA+B;AAkBrC,IAAM,gBAAY,6CAA+B,aAAa;;;ACnB9D,IAAM,iBAAiC;","names":["import_payload_model"]}
1
+ {"version":3,"sources":["../../src/index.ts","../../src/Escrow/createEscrowIntent.ts","../../src/Escrow/getEscrowSecret.ts","../../src/Escrow/Schema.ts","../../src/Escrow/Terms.ts","../../src/Payment.ts","../../src/Purchase.ts"],"sourcesContent":["export * from './Currency'\nexport * from './Escrow'\nexport * from './Payment'\nexport * from './Purchase'\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'\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","export type EscrowSchema = 'network.xyo.escrow'\nexport const EscrowSchema: EscrowSchema = 'network.xyo.escrow'\n","import { Address, Hash } from '@xylabs/hex'\nimport { isPayloadOfSchemaType, Payload } from '@xyo-network/payload-model'\n\nimport { EscrowSchema } from './Schema'\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\nexport const isEscrowTerms = isPayloadOfSchemaType<EscrowTerms>(EscrowTermsSchema)\n","import { isPayloadOfSchemaType, PayloadWithSources } from '@xyo-network/payload-model'\n\nimport { SupportedCurrency } from './Currency'\n\nexport type PaymentSchema = 'network.xyo.payments.payment'\nexport const PaymentSchema: PaymentSchema = 'network.xyo.payments.payment'\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 a payment made\n */\nexport type Payment = PayloadWithSources<PaymentFields, PaymentSchema>\n\nexport const isPayment = isPayloadOfSchemaType<Payment>(PaymentSchema)\n","import { Hash } from '@xylabs/hex'\nimport { PayloadWithSources } from '@xyo-network/payload-model'\n\nexport type PurchaseSchema = 'network.xyo.payments.purchase'\nexport const PurchaseSchema: PurchaseSchema = 'network.xyo.payments.purchase'\n\nexport interface PurchaseFields {\n /**\n * The hashes that were purchased\n */\n hashes: Hash[]\n /**\n * The payments for this purchase. Array to allow for multiple payments\n * for a single quote.\n */\n payments: Hash[]\n}\n\n/**\n * A purchase ties a payment made to a quote\n */\nexport type Purchase = PayloadWithSources<PurchaseFields, PurchaseSchema>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACCA,kCAAoC;AAY7B,IAAM,qBAAqB,OAAO,OAAsB,YAA6B;AAC1F,QAAM,SAAS,MAAM,IAAI,gDAAoB,EAAE,UAAU,CAAC,OAAO,EAAE,CAAC,EAAE,SAAS,CAAC,GAAG,KAAK,CAAC,EAAE,MAAM;AACjG,SAAO;AACT;AASO,IAAM,+BAA+B,OAAO,OAAoB,QAAmB,YAA6B;AACrH,QAAM,SAAS,MAAM,IAAI,gDAAoB,EAAE,UAAU,CAAC,OAAO,EAAE,CAAC,EAAE,SAAS,CAAC,OAAO,MAAM,CAAC,EAAE,MAAM;AACtG,SAAO;AACT;;;AC5BA,oBAAuB;AACvB,+BAAoC;AAM7B,IAAM,kBAAkB,MAAiB;AAC9C,SAAO,EAAE,MAAM,qBAAO,WAAW,GAAG,QAAQ,kCAAS;AACvD;;;ACRO,IAAM,eAA6B;;;ACA1C,2BAA+C;AAIxC,IAAM,oBAAoB,GAAG,YAAY;AAwDzC,IAAM,oBAAgB,4CAAmC,iBAAiB;;;AC7DjF,IAAAA,wBAA0D;AAKnD,IAAM,gBAA+B;AAkBrC,IAAM,gBAAY,6CAA+B,aAAa;;;ACnB9D,IAAM,iBAAiC;","names":["import_payload_model"]}
@@ -4,6 +4,10 @@ var createEscrowIntent = async (terms, account) => {
4
4
  const result = await new BoundWitnessBuilder({ accounts: [account] }).payloads([...terms]).build();
5
5
  return result;
6
6
  };
7
+ var createEscrowIntentWithSecret = async (terms, secret, account) => {
8
+ const result = await new BoundWitnessBuilder({ accounts: [account] }).payloads([terms, secret]).build();
9
+ return result;
10
+ };
7
11
 
8
12
  // src/Escrow/getEscrowSecret.ts
9
13
  import { Crypto } from "@xylabs/crypto";
@@ -33,6 +37,7 @@ export {
33
37
  PaymentSchema,
34
38
  PurchaseSchema,
35
39
  createEscrowIntent,
40
+ createEscrowIntentWithSecret,
36
41
  getEscrowSecret,
37
42
  isEscrowTerms,
38
43
  isPayment
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/Escrow/createEscrowIntent.ts","../../src/Escrow/getEscrowSecret.ts","../../src/Escrow/Schema.ts","../../src/Escrow/Terms.ts","../../src/Payment.ts","../../src/Purchase.ts"],"sourcesContent":["import { AccountInstance } from '@xyo-network/account-model'\nimport { BoundWitnessBuilder } from '@xyo-network/boundwitness-builder'\n\nimport { EscrowTerms } from './Terms'\n\n/**\n * Creates an escrow intent\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","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","export type EscrowSchema = 'network.xyo.escrow'\nexport const EscrowSchema: EscrowSchema = 'network.xyo.escrow'\n","import { Address, Hash } from '@xylabs/hex'\nimport { isPayloadOfSchemaType, Payload } from '@xyo-network/payload-model'\n\nimport { EscrowSchema } from './Schema'\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\nexport const isEscrowTerms = isPayloadOfSchemaType<EscrowTerms>(EscrowTermsSchema)\n","import { isPayloadOfSchemaType, PayloadWithSources } from '@xyo-network/payload-model'\n\nimport { SupportedCurrency } from './Currency'\n\nexport type PaymentSchema = 'network.xyo.payments.payment'\nexport const PaymentSchema: PaymentSchema = 'network.xyo.payments.payment'\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 a payment made\n */\nexport type Payment = PayloadWithSources<PaymentFields, PaymentSchema>\n\nexport const isPayment = isPayloadOfSchemaType<Payment>(PaymentSchema)\n","import { Hash } from '@xylabs/hex'\nimport { PayloadWithSources } from '@xyo-network/payload-model'\n\nexport type PurchaseSchema = 'network.xyo.payments.purchase'\nexport const PurchaseSchema: PurchaseSchema = 'network.xyo.payments.purchase'\n\nexport interface PurchaseFields {\n /**\n * The hashes that were purchased\n */\n hashes: Hash[]\n /**\n * The payments for this purchase. Array to allow for multiple payments\n * for a single quote.\n */\n payments: Hash[]\n}\n\n/**\n * A purchase ties a payment made to a quote\n */\nexport type Purchase = PayloadWithSources<PurchaseFields, PurchaseSchema>\n"],"mappings":";AACA,SAAS,2BAA2B;AAU7B,IAAM,qBAAqB,OAAO,OAAsB,YAA6B;AAC1F,QAAM,SAAS,MAAM,IAAI,oBAAoB,EAAE,UAAU,CAAC,OAAO,EAAE,CAAC,EAAE,SAAS,CAAC,GAAG,KAAK,CAAC,EAAE,MAAM;AACjG,SAAO;AACT;;;ACdA,SAAS,cAAc;AACvB,SAAoB,gBAAgB;AAM7B,IAAM,kBAAkB,MAAiB;AAC9C,SAAO,EAAE,MAAM,OAAO,WAAW,GAAG,QAAQ,SAAS;AACvD;;;ACRO,IAAM,eAA6B;;;ACA1C,SAAS,6BAAsC;AAIxC,IAAM,oBAAoB,GAAG,YAAY;AAwDzC,IAAM,gBAAgB,sBAAmC,iBAAiB;;;AC7DjF,SAAS,yBAAAA,8BAAiD;AAKnD,IAAM,gBAA+B;AAkBrC,IAAM,YAAYA,uBAA+B,aAAa;;;ACnB9D,IAAM,iBAAiC;","names":["isPayloadOfSchemaType"]}
1
+ {"version":3,"sources":["../../src/Escrow/createEscrowIntent.ts","../../src/Escrow/getEscrowSecret.ts","../../src/Escrow/Schema.ts","../../src/Escrow/Terms.ts","../../src/Payment.ts","../../src/Purchase.ts"],"sourcesContent":["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'\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","export type EscrowSchema = 'network.xyo.escrow'\nexport const EscrowSchema: EscrowSchema = 'network.xyo.escrow'\n","import { Address, Hash } from '@xylabs/hex'\nimport { isPayloadOfSchemaType, Payload } from '@xyo-network/payload-model'\n\nimport { EscrowSchema } from './Schema'\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\nexport const isEscrowTerms = isPayloadOfSchemaType<EscrowTerms>(EscrowTermsSchema)\n","import { isPayloadOfSchemaType, PayloadWithSources } from '@xyo-network/payload-model'\n\nimport { SupportedCurrency } from './Currency'\n\nexport type PaymentSchema = 'network.xyo.payments.payment'\nexport const PaymentSchema: PaymentSchema = 'network.xyo.payments.payment'\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 a payment made\n */\nexport type Payment = PayloadWithSources<PaymentFields, PaymentSchema>\n\nexport const isPayment = isPayloadOfSchemaType<Payment>(PaymentSchema)\n","import { Hash } from '@xylabs/hex'\nimport { PayloadWithSources } from '@xyo-network/payload-model'\n\nexport type PurchaseSchema = 'network.xyo.payments.purchase'\nexport const PurchaseSchema: PurchaseSchema = 'network.xyo.payments.purchase'\n\nexport interface PurchaseFields {\n /**\n * The hashes that were purchased\n */\n hashes: Hash[]\n /**\n * The payments for this purchase. Array to allow for multiple payments\n * for a single quote.\n */\n payments: Hash[]\n}\n\n/**\n * A purchase ties a payment made to a quote\n */\nexport type Purchase = PayloadWithSources<PurchaseFields, PurchaseSchema>\n"],"mappings":";AACA,SAAS,2BAA2B;AAY7B,IAAM,qBAAqB,OAAO,OAAsB,YAA6B;AAC1F,QAAM,SAAS,MAAM,IAAI,oBAAoB,EAAE,UAAU,CAAC,OAAO,EAAE,CAAC,EAAE,SAAS,CAAC,GAAG,KAAK,CAAC,EAAE,MAAM;AACjG,SAAO;AACT;AASO,IAAM,+BAA+B,OAAO,OAAoB,QAAmB,YAA6B;AACrH,QAAM,SAAS,MAAM,IAAI,oBAAoB,EAAE,UAAU,CAAC,OAAO,EAAE,CAAC,EAAE,SAAS,CAAC,OAAO,MAAM,CAAC,EAAE,MAAM;AACtG,SAAO;AACT;;;AC5BA,SAAS,cAAc;AACvB,SAAoB,gBAAgB;AAM7B,IAAM,kBAAkB,MAAiB;AAC9C,SAAO,EAAE,MAAM,OAAO,WAAW,GAAG,QAAQ,SAAS;AACvD;;;ACRO,IAAM,eAA6B;;;ACA1C,SAAS,6BAAsC;AAIxC,IAAM,oBAAoB,GAAG,YAAY;AAwDzC,IAAM,gBAAgB,sBAAmC,iBAAiB;;;AC7DjF,SAAS,yBAAAA,8BAAiD;AAKnD,IAAM,gBAA+B;AAkBrC,IAAM,YAAYA,uBAA+B,aAAa;;;ACnB9D,IAAM,iBAAiC;","names":["isPayloadOfSchemaType"]}
@@ -1,7 +1,9 @@
1
1
  import { AccountInstance } from '@xyo-network/account-model';
2
+ import { IdPayload } from '@xyo-network/id-payload-plugin';
2
3
  import { EscrowTerms } from './Terms';
3
4
  /**
4
5
  * Creates an escrow intent
6
+ * @deprecated Use createEscrowIntentWithSecret instead
5
7
  * @param terms The payloads describing the terms for the escrow
6
8
  * @param account The account to create the escrow intent with
7
9
  * @returns The escrow intent
@@ -17,4 +19,22 @@ export declare const createEscrowIntent: (terms: EscrowTerms[], account: Account
17
19
  schema: "network.xyo.error.module";
18
20
  sources?: Lowercase<string>[] | undefined;
19
21
  }>[]]>;
22
+ /**
23
+ * Creates an escrow intent (for a buyer or seller) using the supplied secret
24
+ * @param terms The payload describing the terms for the escrow
25
+ * @param secret The secret for the escrow principal party to use for the escrow
26
+ * @param account The account to create the escrow intent with
27
+ * @returns The escrow intent
28
+ */
29
+ export declare const createEscrowIntentWithSecret: (terms: EscrowTerms, secret: IdPayload, account: AccountInstance) => Promise<[import("@xyo-network/payload-model").WithMeta<import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & import("@xyo-network/boundwitness-model").BoundWitnessFields & {
30
+ schema: "network.xyo.boundwitness";
31
+ }>, import("@xyo-network/payload-model").WithMeta<{
32
+ schema: string;
33
+ } & import("@xyo-network/payload-model").PayloadFields>[], import("@xyo-network/payload-model").WithMeta<import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & {
34
+ message?: string | undefined;
35
+ name?: string | undefined;
36
+ query?: Lowercase<string> | undefined;
37
+ schema: "network.xyo.error.module";
38
+ sources?: Lowercase<string>[] | undefined;
39
+ }>[]]>;
20
40
  //# sourceMappingURL=createEscrowIntent.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"createEscrowIntent.d.ts","sourceRoot":"","sources":["../../../src/Escrow/createEscrowIntent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AAG5D,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAErC;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,UAAiB,WAAW,EAAE,WAAW,eAAe;;;;;;;;;;MAGtF,CAAA"}
1
+ {"version":3,"file":"createEscrowIntent.d.ts","sourceRoot":"","sources":["../../../src/Escrow/createEscrowIntent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AAE5D,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAA;AAE1D,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAErC;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,UAAiB,WAAW,EAAE,WAAW,eAAe;;;;;;;;;;MAGtF,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,4BAA4B,UAAiB,WAAW,UAAU,SAAS,WAAW,eAAe;;;;;;;;;;MAGjH,CAAA"}
@@ -1,7 +1,9 @@
1
1
  import { AccountInstance } from '@xyo-network/account-model';
2
+ import { IdPayload } from '@xyo-network/id-payload-plugin';
2
3
  import { EscrowTerms } from './Terms';
3
4
  /**
4
5
  * Creates an escrow intent
6
+ * @deprecated Use createEscrowIntentWithSecret instead
5
7
  * @param terms The payloads describing the terms for the escrow
6
8
  * @param account The account to create the escrow intent with
7
9
  * @returns The escrow intent
@@ -17,4 +19,22 @@ export declare const createEscrowIntent: (terms: EscrowTerms[], account: Account
17
19
  schema: "network.xyo.error.module";
18
20
  sources?: Lowercase<string>[] | undefined;
19
21
  }>[]]>;
22
+ /**
23
+ * Creates an escrow intent (for a buyer or seller) using the supplied secret
24
+ * @param terms The payload describing the terms for the escrow
25
+ * @param secret The secret for the escrow principal party to use for the escrow
26
+ * @param account The account to create the escrow intent with
27
+ * @returns The escrow intent
28
+ */
29
+ export declare const createEscrowIntentWithSecret: (terms: EscrowTerms, secret: IdPayload, account: AccountInstance) => Promise<[import("@xyo-network/payload-model").WithMeta<import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & import("@xyo-network/boundwitness-model").BoundWitnessFields & {
30
+ schema: "network.xyo.boundwitness";
31
+ }>, import("@xyo-network/payload-model").WithMeta<{
32
+ schema: string;
33
+ } & import("@xyo-network/payload-model").PayloadFields>[], import("@xyo-network/payload-model").WithMeta<import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & {
34
+ message?: string | undefined;
35
+ name?: string | undefined;
36
+ query?: Lowercase<string> | undefined;
37
+ schema: "network.xyo.error.module";
38
+ sources?: Lowercase<string>[] | undefined;
39
+ }>[]]>;
20
40
  //# sourceMappingURL=createEscrowIntent.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"createEscrowIntent.d.ts","sourceRoot":"","sources":["../../../src/Escrow/createEscrowIntent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AAG5D,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAErC;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,UAAiB,WAAW,EAAE,WAAW,eAAe;;;;;;;;;;MAGtF,CAAA"}
1
+ {"version":3,"file":"createEscrowIntent.d.ts","sourceRoot":"","sources":["../../../src/Escrow/createEscrowIntent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AAE5D,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAA;AAE1D,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAErC;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,UAAiB,WAAW,EAAE,WAAW,eAAe;;;;;;;;;;MAGtF,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,4BAA4B,UAAiB,WAAW,UAAU,SAAS,WAAW,eAAe;;;;;;;;;;MAGjH,CAAA"}
@@ -1,7 +1,9 @@
1
1
  import { AccountInstance } from '@xyo-network/account-model';
2
+ import { IdPayload } from '@xyo-network/id-payload-plugin';
2
3
  import { EscrowTerms } from './Terms';
3
4
  /**
4
5
  * Creates an escrow intent
6
+ * @deprecated Use createEscrowIntentWithSecret instead
5
7
  * @param terms The payloads describing the terms for the escrow
6
8
  * @param account The account to create the escrow intent with
7
9
  * @returns The escrow intent
@@ -17,4 +19,22 @@ export declare const createEscrowIntent: (terms: EscrowTerms[], account: Account
17
19
  schema: "network.xyo.error.module";
18
20
  sources?: Lowercase<string>[] | undefined;
19
21
  }>[]]>;
22
+ /**
23
+ * Creates an escrow intent (for a buyer or seller) using the supplied secret
24
+ * @param terms The payload describing the terms for the escrow
25
+ * @param secret The secret for the escrow principal party to use for the escrow
26
+ * @param account The account to create the escrow intent with
27
+ * @returns The escrow intent
28
+ */
29
+ export declare const createEscrowIntentWithSecret: (terms: EscrowTerms, secret: IdPayload, account: AccountInstance) => Promise<[import("@xyo-network/payload-model").WithMeta<import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & import("@xyo-network/boundwitness-model").BoundWitnessFields & {
30
+ schema: "network.xyo.boundwitness";
31
+ }>, import("@xyo-network/payload-model").WithMeta<{
32
+ schema: string;
33
+ } & import("@xyo-network/payload-model").PayloadFields>[], import("@xyo-network/payload-model").WithMeta<import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & {
34
+ message?: string | undefined;
35
+ name?: string | undefined;
36
+ query?: Lowercase<string> | undefined;
37
+ schema: "network.xyo.error.module";
38
+ sources?: Lowercase<string>[] | undefined;
39
+ }>[]]>;
20
40
  //# sourceMappingURL=createEscrowIntent.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"createEscrowIntent.d.ts","sourceRoot":"","sources":["../../../src/Escrow/createEscrowIntent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AAG5D,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAErC;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,UAAiB,WAAW,EAAE,WAAW,eAAe;;;;;;;;;;MAGtF,CAAA"}
1
+ {"version":3,"file":"createEscrowIntent.d.ts","sourceRoot":"","sources":["../../../src/Escrow/createEscrowIntent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AAE5D,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAA;AAE1D,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAErC;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,UAAiB,WAAW,EAAE,WAAW,eAAe;;;;;;;;;;MAGtF,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,4BAA4B,UAAiB,WAAW,UAAU,SAAS,WAAW,eAAe;;;;;;;;;;MAGjH,CAAA"}
@@ -25,6 +25,7 @@ __export(src_exports, {
25
25
  PaymentSchema: () => PaymentSchema,
26
26
  PurchaseSchema: () => PurchaseSchema,
27
27
  createEscrowIntent: () => createEscrowIntent,
28
+ createEscrowIntentWithSecret: () => createEscrowIntentWithSecret,
28
29
  getEscrowSecret: () => getEscrowSecret,
29
30
  isEscrowTerms: () => isEscrowTerms,
30
31
  isPayment: () => isPayment
@@ -37,6 +38,10 @@ var createEscrowIntent = async (terms, account) => {
37
38
  const result = await new import_boundwitness_builder.BoundWitnessBuilder({ accounts: [account] }).payloads([...terms]).build();
38
39
  return result;
39
40
  };
41
+ var createEscrowIntentWithSecret = async (terms, secret, account) => {
42
+ const result = await new import_boundwitness_builder.BoundWitnessBuilder({ accounts: [account] }).payloads([terms, secret]).build();
43
+ return result;
44
+ };
40
45
 
41
46
  // src/Escrow/getEscrowSecret.ts
42
47
  var import_crypto = require("@xylabs/crypto");
@@ -67,6 +72,7 @@ var PurchaseSchema = "network.xyo.payments.purchase";
67
72
  PaymentSchema,
68
73
  PurchaseSchema,
69
74
  createEscrowIntent,
75
+ createEscrowIntentWithSecret,
70
76
  getEscrowSecret,
71
77
  isEscrowTerms,
72
78
  isPayment
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/index.ts","../../src/Escrow/createEscrowIntent.ts","../../src/Escrow/getEscrowSecret.ts","../../src/Escrow/Schema.ts","../../src/Escrow/Terms.ts","../../src/Payment.ts","../../src/Purchase.ts"],"sourcesContent":["export * from './Currency'\nexport * from './Escrow'\nexport * from './Payment'\nexport * from './Purchase'\n","import { AccountInstance } from '@xyo-network/account-model'\nimport { BoundWitnessBuilder } from '@xyo-network/boundwitness-builder'\n\nimport { EscrowTerms } from './Terms'\n\n/**\n * Creates an escrow intent\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","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","export type EscrowSchema = 'network.xyo.escrow'\nexport const EscrowSchema: EscrowSchema = 'network.xyo.escrow'\n","import { Address, Hash } from '@xylabs/hex'\nimport { isPayloadOfSchemaType, Payload } from '@xyo-network/payload-model'\n\nimport { EscrowSchema } from './Schema'\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\nexport const isEscrowTerms = isPayloadOfSchemaType<EscrowTerms>(EscrowTermsSchema)\n","import { isPayloadOfSchemaType, PayloadWithSources } from '@xyo-network/payload-model'\n\nimport { SupportedCurrency } from './Currency'\n\nexport type PaymentSchema = 'network.xyo.payments.payment'\nexport const PaymentSchema: PaymentSchema = 'network.xyo.payments.payment'\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 a payment made\n */\nexport type Payment = PayloadWithSources<PaymentFields, PaymentSchema>\n\nexport const isPayment = isPayloadOfSchemaType<Payment>(PaymentSchema)\n","import { Hash } from '@xylabs/hex'\nimport { PayloadWithSources } from '@xyo-network/payload-model'\n\nexport type PurchaseSchema = 'network.xyo.payments.purchase'\nexport const PurchaseSchema: PurchaseSchema = 'network.xyo.payments.purchase'\n\nexport interface PurchaseFields {\n /**\n * The hashes that were purchased\n */\n hashes: Hash[]\n /**\n * The payments for this purchase. Array to allow for multiple payments\n * for a single quote.\n */\n payments: Hash[]\n}\n\n/**\n * A purchase ties a payment made to a quote\n */\nexport type Purchase = PayloadWithSources<PurchaseFields, PurchaseSchema>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACCA,kCAAoC;AAU7B,IAAM,qBAAqB,OAAO,OAAsB,YAA6B;AAC1F,QAAM,SAAS,MAAM,IAAI,gDAAoB,EAAE,UAAU,CAAC,OAAO,EAAE,CAAC,EAAE,SAAS,CAAC,GAAG,KAAK,CAAC,EAAE,MAAM;AACjG,SAAO;AACT;;;ACdA,oBAAuB;AACvB,+BAAoC;AAM7B,IAAM,kBAAkB,MAAiB;AAC9C,SAAO,EAAE,MAAM,qBAAO,WAAW,GAAG,QAAQ,kCAAS;AACvD;;;ACRO,IAAM,eAA6B;;;ACA1C,2BAA+C;AAIxC,IAAM,oBAAoB,GAAG,YAAY;AAwDzC,IAAM,oBAAgB,4CAAmC,iBAAiB;;;AC7DjF,IAAAA,wBAA0D;AAKnD,IAAM,gBAA+B;AAkBrC,IAAM,gBAAY,6CAA+B,aAAa;;;ACnB9D,IAAM,iBAAiC;","names":["import_payload_model"]}
1
+ {"version":3,"sources":["../../src/index.ts","../../src/Escrow/createEscrowIntent.ts","../../src/Escrow/getEscrowSecret.ts","../../src/Escrow/Schema.ts","../../src/Escrow/Terms.ts","../../src/Payment.ts","../../src/Purchase.ts"],"sourcesContent":["export * from './Currency'\nexport * from './Escrow'\nexport * from './Payment'\nexport * from './Purchase'\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'\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","export type EscrowSchema = 'network.xyo.escrow'\nexport const EscrowSchema: EscrowSchema = 'network.xyo.escrow'\n","import { Address, Hash } from '@xylabs/hex'\nimport { isPayloadOfSchemaType, Payload } from '@xyo-network/payload-model'\n\nimport { EscrowSchema } from './Schema'\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\nexport const isEscrowTerms = isPayloadOfSchemaType<EscrowTerms>(EscrowTermsSchema)\n","import { isPayloadOfSchemaType, PayloadWithSources } from '@xyo-network/payload-model'\n\nimport { SupportedCurrency } from './Currency'\n\nexport type PaymentSchema = 'network.xyo.payments.payment'\nexport const PaymentSchema: PaymentSchema = 'network.xyo.payments.payment'\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 a payment made\n */\nexport type Payment = PayloadWithSources<PaymentFields, PaymentSchema>\n\nexport const isPayment = isPayloadOfSchemaType<Payment>(PaymentSchema)\n","import { Hash } from '@xylabs/hex'\nimport { PayloadWithSources } from '@xyo-network/payload-model'\n\nexport type PurchaseSchema = 'network.xyo.payments.purchase'\nexport const PurchaseSchema: PurchaseSchema = 'network.xyo.payments.purchase'\n\nexport interface PurchaseFields {\n /**\n * The hashes that were purchased\n */\n hashes: Hash[]\n /**\n * The payments for this purchase. Array to allow for multiple payments\n * for a single quote.\n */\n payments: Hash[]\n}\n\n/**\n * A purchase ties a payment made to a quote\n */\nexport type Purchase = PayloadWithSources<PurchaseFields, PurchaseSchema>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACCA,kCAAoC;AAY7B,IAAM,qBAAqB,OAAO,OAAsB,YAA6B;AAC1F,QAAM,SAAS,MAAM,IAAI,gDAAoB,EAAE,UAAU,CAAC,OAAO,EAAE,CAAC,EAAE,SAAS,CAAC,GAAG,KAAK,CAAC,EAAE,MAAM;AACjG,SAAO;AACT;AASO,IAAM,+BAA+B,OAAO,OAAoB,QAAmB,YAA6B;AACrH,QAAM,SAAS,MAAM,IAAI,gDAAoB,EAAE,UAAU,CAAC,OAAO,EAAE,CAAC,EAAE,SAAS,CAAC,OAAO,MAAM,CAAC,EAAE,MAAM;AACtG,SAAO;AACT;;;AC5BA,oBAAuB;AACvB,+BAAoC;AAM7B,IAAM,kBAAkB,MAAiB;AAC9C,SAAO,EAAE,MAAM,qBAAO,WAAW,GAAG,QAAQ,kCAAS;AACvD;;;ACRO,IAAM,eAA6B;;;ACA1C,2BAA+C;AAIxC,IAAM,oBAAoB,GAAG,YAAY;AAwDzC,IAAM,oBAAgB,4CAAmC,iBAAiB;;;AC7DjF,IAAAA,wBAA0D;AAKnD,IAAM,gBAA+B;AAkBrC,IAAM,gBAAY,6CAA+B,aAAa;;;ACnB9D,IAAM,iBAAiC;","names":["import_payload_model"]}
@@ -4,6 +4,10 @@ var createEscrowIntent = async (terms, account) => {
4
4
  const result = await new BoundWitnessBuilder({ accounts: [account] }).payloads([...terms]).build();
5
5
  return result;
6
6
  };
7
+ var createEscrowIntentWithSecret = async (terms, secret, account) => {
8
+ const result = await new BoundWitnessBuilder({ accounts: [account] }).payloads([terms, secret]).build();
9
+ return result;
10
+ };
7
11
 
8
12
  // src/Escrow/getEscrowSecret.ts
9
13
  import { Crypto } from "@xylabs/crypto";
@@ -33,6 +37,7 @@ export {
33
37
  PaymentSchema,
34
38
  PurchaseSchema,
35
39
  createEscrowIntent,
40
+ createEscrowIntentWithSecret,
36
41
  getEscrowSecret,
37
42
  isEscrowTerms,
38
43
  isPayment
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/Escrow/createEscrowIntent.ts","../../src/Escrow/getEscrowSecret.ts","../../src/Escrow/Schema.ts","../../src/Escrow/Terms.ts","../../src/Payment.ts","../../src/Purchase.ts"],"sourcesContent":["import { AccountInstance } from '@xyo-network/account-model'\nimport { BoundWitnessBuilder } from '@xyo-network/boundwitness-builder'\n\nimport { EscrowTerms } from './Terms'\n\n/**\n * Creates an escrow intent\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","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","export type EscrowSchema = 'network.xyo.escrow'\nexport const EscrowSchema: EscrowSchema = 'network.xyo.escrow'\n","import { Address, Hash } from '@xylabs/hex'\nimport { isPayloadOfSchemaType, Payload } from '@xyo-network/payload-model'\n\nimport { EscrowSchema } from './Schema'\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\nexport const isEscrowTerms = isPayloadOfSchemaType<EscrowTerms>(EscrowTermsSchema)\n","import { isPayloadOfSchemaType, PayloadWithSources } from '@xyo-network/payload-model'\n\nimport { SupportedCurrency } from './Currency'\n\nexport type PaymentSchema = 'network.xyo.payments.payment'\nexport const PaymentSchema: PaymentSchema = 'network.xyo.payments.payment'\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 a payment made\n */\nexport type Payment = PayloadWithSources<PaymentFields, PaymentSchema>\n\nexport const isPayment = isPayloadOfSchemaType<Payment>(PaymentSchema)\n","import { Hash } from '@xylabs/hex'\nimport { PayloadWithSources } from '@xyo-network/payload-model'\n\nexport type PurchaseSchema = 'network.xyo.payments.purchase'\nexport const PurchaseSchema: PurchaseSchema = 'network.xyo.payments.purchase'\n\nexport interface PurchaseFields {\n /**\n * The hashes that were purchased\n */\n hashes: Hash[]\n /**\n * The payments for this purchase. Array to allow for multiple payments\n * for a single quote.\n */\n payments: Hash[]\n}\n\n/**\n * A purchase ties a payment made to a quote\n */\nexport type Purchase = PayloadWithSources<PurchaseFields, PurchaseSchema>\n"],"mappings":";AACA,SAAS,2BAA2B;AAU7B,IAAM,qBAAqB,OAAO,OAAsB,YAA6B;AAC1F,QAAM,SAAS,MAAM,IAAI,oBAAoB,EAAE,UAAU,CAAC,OAAO,EAAE,CAAC,EAAE,SAAS,CAAC,GAAG,KAAK,CAAC,EAAE,MAAM;AACjG,SAAO;AACT;;;ACdA,SAAS,cAAc;AACvB,SAAoB,gBAAgB;AAM7B,IAAM,kBAAkB,MAAiB;AAC9C,SAAO,EAAE,MAAM,OAAO,WAAW,GAAG,QAAQ,SAAS;AACvD;;;ACRO,IAAM,eAA6B;;;ACA1C,SAAS,6BAAsC;AAIxC,IAAM,oBAAoB,GAAG,YAAY;AAwDzC,IAAM,gBAAgB,sBAAmC,iBAAiB;;;AC7DjF,SAAS,yBAAAA,8BAAiD;AAKnD,IAAM,gBAA+B;AAkBrC,IAAM,YAAYA,uBAA+B,aAAa;;;ACnB9D,IAAM,iBAAiC;","names":["isPayloadOfSchemaType"]}
1
+ {"version":3,"sources":["../../src/Escrow/createEscrowIntent.ts","../../src/Escrow/getEscrowSecret.ts","../../src/Escrow/Schema.ts","../../src/Escrow/Terms.ts","../../src/Payment.ts","../../src/Purchase.ts"],"sourcesContent":["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'\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","export type EscrowSchema = 'network.xyo.escrow'\nexport const EscrowSchema: EscrowSchema = 'network.xyo.escrow'\n","import { Address, Hash } from '@xylabs/hex'\nimport { isPayloadOfSchemaType, Payload } from '@xyo-network/payload-model'\n\nimport { EscrowSchema } from './Schema'\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\nexport const isEscrowTerms = isPayloadOfSchemaType<EscrowTerms>(EscrowTermsSchema)\n","import { isPayloadOfSchemaType, PayloadWithSources } from '@xyo-network/payload-model'\n\nimport { SupportedCurrency } from './Currency'\n\nexport type PaymentSchema = 'network.xyo.payments.payment'\nexport const PaymentSchema: PaymentSchema = 'network.xyo.payments.payment'\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 a payment made\n */\nexport type Payment = PayloadWithSources<PaymentFields, PaymentSchema>\n\nexport const isPayment = isPayloadOfSchemaType<Payment>(PaymentSchema)\n","import { Hash } from '@xylabs/hex'\nimport { PayloadWithSources } from '@xyo-network/payload-model'\n\nexport type PurchaseSchema = 'network.xyo.payments.purchase'\nexport const PurchaseSchema: PurchaseSchema = 'network.xyo.payments.purchase'\n\nexport interface PurchaseFields {\n /**\n * The hashes that were purchased\n */\n hashes: Hash[]\n /**\n * The payments for this purchase. Array to allow for multiple payments\n * for a single quote.\n */\n payments: Hash[]\n}\n\n/**\n * A purchase ties a payment made to a quote\n */\nexport type Purchase = PayloadWithSources<PurchaseFields, PurchaseSchema>\n"],"mappings":";AACA,SAAS,2BAA2B;AAY7B,IAAM,qBAAqB,OAAO,OAAsB,YAA6B;AAC1F,QAAM,SAAS,MAAM,IAAI,oBAAoB,EAAE,UAAU,CAAC,OAAO,EAAE,CAAC,EAAE,SAAS,CAAC,GAAG,KAAK,CAAC,EAAE,MAAM;AACjG,SAAO;AACT;AASO,IAAM,+BAA+B,OAAO,OAAoB,QAAmB,YAA6B;AACrH,QAAM,SAAS,MAAM,IAAI,oBAAoB,EAAE,UAAU,CAAC,OAAO,EAAE,CAAC,EAAE,SAAS,CAAC,OAAO,MAAM,CAAC,EAAE,MAAM;AACtG,SAAO;AACT;;;AC5BA,SAAS,cAAc;AACvB,SAAoB,gBAAgB;AAM7B,IAAM,kBAAkB,MAAiB;AAC9C,SAAO,EAAE,MAAM,OAAO,WAAW,GAAG,QAAQ,SAAS;AACvD;;;ACRO,IAAM,eAA6B;;;ACA1C,SAAS,6BAAsC;AAIxC,IAAM,oBAAoB,GAAG,YAAY;AAwDzC,IAAM,gBAAgB,sBAAmC,iBAAiB;;;AC7DjF,SAAS,yBAAAA,8BAAiD;AAKnD,IAAM,gBAA+B;AAkBrC,IAAM,YAAYA,uBAA+B,aAAa;;;ACnB9D,IAAM,iBAAiC;","names":["isPayloadOfSchemaType"]}
package/package.json CHANGED
@@ -12,14 +12,14 @@
12
12
  "dependencies": {
13
13
  "@xylabs/crypto": "^3.0.25",
14
14
  "@xylabs/hex": "^3.0.25",
15
- "@xyo-network/account-model": "^2.94.5",
16
- "@xyo-network/boundwitness-builder": "^2.94.5",
17
- "@xyo-network/id-payload-plugin": "^2.94.5",
18
- "@xyo-network/payload-model": "^2.94.5"
15
+ "@xyo-network/account-model": "^2.94.11",
16
+ "@xyo-network/boundwitness-builder": "^2.94.11",
17
+ "@xyo-network/id-payload-plugin": "^2.94.11",
18
+ "@xyo-network/payload-model": "^2.94.11"
19
19
  },
20
20
  "devDependencies": {
21
- "@xylabs/ts-scripts-yarn3": "^3.5.2",
22
- "@xylabs/tsconfig": "^3.5.2",
21
+ "@xylabs/ts-scripts-yarn3": "^3.9.0",
22
+ "@xylabs/tsconfig": "^3.9.0",
23
23
  "typescript": "^5.4.3"
24
24
  },
25
25
  "description": "Typescript/Javascript Plugins for XYO Platform",
@@ -61,6 +61,6 @@
61
61
  "url": "https://github.com/XYOracleNetwork/plugins.git"
62
62
  },
63
63
  "sideEffects": false,
64
- "version": "2.91.3",
64
+ "version": "2.91.5",
65
65
  "type": "module"
66
66
  }
@@ -1,10 +1,12 @@
1
1
  import { AccountInstance } from '@xyo-network/account-model'
2
2
  import { BoundWitnessBuilder } from '@xyo-network/boundwitness-builder'
3
+ import { IdPayload } from '@xyo-network/id-payload-plugin'
3
4
 
4
5
  import { EscrowTerms } from './Terms'
5
6
 
6
7
  /**
7
8
  * Creates an escrow intent
9
+ * @deprecated Use createEscrowIntentWithSecret instead
8
10
  * @param terms The payloads describing the terms for the escrow
9
11
  * @param account The account to create the escrow intent with
10
12
  * @returns The escrow intent
@@ -13,3 +15,15 @@ export const createEscrowIntent = async (terms: EscrowTerms[], account: AccountI
13
15
  const result = await new BoundWitnessBuilder({ accounts: [account] }).payloads([...terms]).build()
14
16
  return result
15
17
  }
18
+
19
+ /**
20
+ * Creates an escrow intent (for a buyer or seller) using the supplied secret
21
+ * @param terms The payload describing the terms for the escrow
22
+ * @param secret The secret for the escrow principal party to use for the escrow
23
+ * @param account The account to create the escrow intent with
24
+ * @returns The escrow intent
25
+ */
26
+ export const createEscrowIntentWithSecret = async (terms: EscrowTerms, secret: IdPayload, account: AccountInstance) => {
27
+ const result = await new BoundWitnessBuilder({ accounts: [account] }).payloads([terms, secret]).build()
28
+ return result
29
+ }