@xyo-network/boundwitness-builder 7.0.0 → 7.0.3
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.
|
@@ -15,16 +15,17 @@ export declare class BoundWitnessBuilder<TBoundWitness extends BoundWitness = Bo
|
|
|
15
15
|
private _payloadSchemas?;
|
|
16
16
|
private _payloads;
|
|
17
17
|
constructor(options?: Omit<PayloadBuilderOptions, 'schema'>);
|
|
18
|
+
private static validateGeneratedFields;
|
|
19
|
+
protected static linkingFields<T extends BoundWitness>(accounts: AccountInstance[], payloads?: Payload[]): Promise<Pick<T, GeneratedBoundWitnessFields>>;
|
|
20
|
+
protected static signature<T extends BoundWitness>(payload: T, address: XyoAddress): import("@xylabs/sdk-js").BrandedHex | null;
|
|
21
|
+
protected static signatures(accounts: AccountInstance[], dataHash: Hash): Promise<string[]>;
|
|
22
|
+
static addressIndex<T extends BoundWitness>(payload: T, address: XyoAddress): number;
|
|
23
|
+
static previousHash<T extends BoundWitness>(boundWitness: T, address: XyoAddress): string | undefined;
|
|
18
24
|
protected get addresses(): XyoAddress[];
|
|
19
25
|
protected get payloadSchemas(): string[];
|
|
20
26
|
protected get previousHashBytes(): (ArrayBufferLike | null)[];
|
|
21
27
|
protected get previousHashes(): (Hash | null)[];
|
|
22
|
-
|
|
23
|
-
static previousHash<T extends BoundWitness>(boundWitness: T, address: XyoAddress): string | undefined;
|
|
24
|
-
protected static linkingFields<T extends BoundWitness>(accounts: AccountInstance[], payloads?: Payload[]): Promise<Pick<T, GeneratedBoundWitnessFields>>;
|
|
25
|
-
protected static signature<T extends BoundWitness>(payload: T, address: XyoAddress): import("@xylabs/sdk-js").BrandedHex | null;
|
|
26
|
-
protected static signatures(accounts: AccountInstance[], dataHash: Hash): Promise<string[]>;
|
|
27
|
-
private static validateGeneratedFields;
|
|
28
|
+
protected sign(): Promise<Hex[]>;
|
|
28
29
|
build(): Promise<[Signed<TBoundWitness>, TPayload[], ModuleError[]]>;
|
|
29
30
|
build(sign: false): Promise<[Unsigned<TBoundWitness>, TPayload[], ModuleError[]]>;
|
|
30
31
|
build(sign: true): Promise<[Signed<TBoundWitness>, TPayload[], ModuleError[]]>;
|
|
@@ -43,8 +44,5 @@ export declare class BoundWitnessBuilder<TBoundWitness extends BoundWitness = Bo
|
|
|
43
44
|
witness(account: AccountInstance): this;
|
|
44
45
|
/** @deprecated use signers instead */
|
|
45
46
|
witnesses(accounts: AccountInstance[]): this;
|
|
46
|
-
protected sign(): Promise<Hex[]>;
|
|
47
|
-
private generatedFields;
|
|
48
|
-
private missingSchemaMessage;
|
|
49
47
|
}
|
|
50
48
|
//# sourceMappingURL=BoundWitnessBuilder.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BoundWitnessBuilder.d.ts","sourceRoot":"","sources":["../../src/BoundWitnessBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAA;AAI/C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AACjE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,KAAK,EACV,YAAY,EACZ,cAAc,EACd,MAAM,EACN,QAAQ,EACT,MAAM,iCAAiC,CAAA;AAKxC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAA;AACzE,OAAO,EAAc,cAAc,EAAE,MAAM,8BAA8B,CAAA;AACzE,OAAO,KAAK,EACV,WAAW,EAAE,OAAO,EAAE,MAAM,EAC5B,iBAAiB,EACjB,WAAW,EACX,aAAa,EACb,kBAAkB,EACnB,MAAM,4BAA4B,CAAA;AAGnC,OAAO,EAAE,2BAA2B,EAAE,MAAM,kCAAkC,CAAA;
|
|
1
|
+
{"version":3,"file":"BoundWitnessBuilder.d.ts","sourceRoot":"","sources":["../../src/BoundWitnessBuilder.ts"],"names":[],"mappings":"AAAA,OAA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CAAC,aAAa,CAAC,CAAC;IAUxE,KAAK,CAAC,OAAO,CAAC,EAAE,WAAW;IAQ3B,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,WAAW,GAAG,IAAI,CAAC,EAAE;IAW7B,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,IAAI,CAAC,kBAAkB,CAAC,iBAAiB,CAAC,aAAa,CAAC,CAAC,EAC7F,WAAW,GAAG,gBAAgB,GAAG,iBAAiB,GAAG,iBAAiB,CAAC,CAAC,GAAG,IAAI;IAcjF,MAAM,CAAC,MAAM,EAAE,IAAI,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE;IAOvC,OAAO,CAAC,OAAO,CAAC,EAAE,QAAQ;IAQ1B,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,GAAG,IAAI,CAAC,EAAE;IAUvC,MAAM,CAAC,OAAO,EAAE,eAAe;IAM/B,OAAO,CAAC,QAAQ,EAAE,eAAe,EAAE;IAMnC,WAAW,CAAC,WAAW,EAAE,IAAI;IAQ7B,qCAAqC;IACrC,OAAO,CAAC,OAAO,EAAE,eAAe;IAKhC,sCAAsC;IACtC,SAAS,CAAC,QAAQ,EAAE,eAAe,EAAE;CAItC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"combinationsByBoundwitness.d.ts","sourceRoot":"","sources":["../../src/combinationsByBoundwitness.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAA;AAGnE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;AAEzD;;;;;GAKG;AACH,eAAO,MAAM,0BAA0B,GAAU,UAAU,OAAO,EAAE,KAAG,OAAO,CAAC,CAAC,YAAY,EAAE,GAAG,OAAO,EAAE,CAAC,EAAE,
|
|
1
|
+
{"version":3,"file":"combinationsByBoundwitness.d.ts","sourceRoot":"","sources":["../../src/combinationsByBoundwitness.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAA;AAGnE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;AAEzD;;;;;GAKG;AACH,eAAO,MAAM,0BAA0B,GAAU,UAAU,OAAO,EAAE,KAAG,OAAO,CAAC,CAAC,YAAY,EAAE,GAAG,OAAO,EAAE,CAAC,EAAE,CAiB5G,CAAA"}
|
package/dist/neutral/index.mjs
CHANGED
|
@@ -38,6 +38,10 @@ var uniqueAccounts = (accounts, throwOnFalse = false) => {
|
|
|
38
38
|
};
|
|
39
39
|
|
|
40
40
|
// src/BoundWitnessBuilder.ts
|
|
41
|
+
function missingSchemaMessage(payload) {
|
|
42
|
+
return `Builder: Missing Schema
|
|
43
|
+
${JSON.stringify(payload, null, 2)}`;
|
|
44
|
+
}
|
|
41
45
|
var BoundWitnessBuilder = class _BoundWitnessBuilder extends PayloadBuilder {
|
|
42
46
|
static _buildMutex = new Mutex();
|
|
43
47
|
_accounts = [];
|
|
@@ -49,35 +53,15 @@ var BoundWitnessBuilder = class _BoundWitnessBuilder extends PayloadBuilder {
|
|
|
49
53
|
constructor(options) {
|
|
50
54
|
super({ ...options, schema: BoundWitnessSchema });
|
|
51
55
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
get payloadSchemas() {
|
|
57
|
-
return this._payloadSchemas ?? this._payloads.map((payload) => {
|
|
58
|
-
return assertEx(payload.schema, () => this.missingSchemaMessage(payload));
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
get previousHashBytes() {
|
|
62
|
-
return this._accounts.map((account) => account.previousHashBytes ?? null);
|
|
63
|
-
}
|
|
64
|
-
get previousHashes() {
|
|
65
|
-
return this._accounts.map((account) => account.previousHash ?? null);
|
|
66
|
-
}
|
|
67
|
-
static addressIndex(payload, address) {
|
|
68
|
-
const index = payload.addresses.indexOf(address);
|
|
69
|
-
if (index === -1) {
|
|
70
|
-
throw new Error("Invalid address");
|
|
71
|
-
}
|
|
72
|
-
return index;
|
|
73
|
-
}
|
|
74
|
-
static previousHash(boundWitness, address) {
|
|
75
|
-
return asHash(boundWitness.previous_hashes[this.addressIndex(boundWitness, address)])?.toLowerCase();
|
|
56
|
+
static validateGeneratedFields(fields) {
|
|
57
|
+
assertEx(fields.payload_hashes?.length === fields.payload_schemas?.length, () => "Payload hash/schema mismatch");
|
|
58
|
+
assertEx(!fields.payload_hashes.includes(null), () => "nulls found in hashes");
|
|
59
|
+
assertEx(!fields.payload_schemas.includes(null), () => "nulls found in schemas");
|
|
76
60
|
}
|
|
77
61
|
static async linkingFields(accounts, payloads) {
|
|
78
62
|
const addresses = accounts.map((account) => account.address.toLowerCase());
|
|
79
63
|
const previous_hashes = accounts.map((account) => account.previousHash ?? null);
|
|
80
|
-
const payload_hashes = payloads ? await
|
|
64
|
+
const payload_hashes = payloads ? await this.hashes(payloads) : [];
|
|
81
65
|
const payload_schemas = payloads?.map(({ schema }) => schema) ?? [];
|
|
82
66
|
return {
|
|
83
67
|
addresses,
|
|
@@ -92,12 +76,43 @@ var BoundWitnessBuilder = class _BoundWitnessBuilder extends PayloadBuilder {
|
|
|
92
76
|
static async signatures(accounts, dataHash) {
|
|
93
77
|
const hashBytes = toArrayBuffer(dataHash);
|
|
94
78
|
const previousHashesBytes = accounts?.map((account) => account.previousHashBytes);
|
|
95
|
-
return await Promise.all(accounts.map(async (account, index) =>
|
|
79
|
+
return await Promise.all(accounts.map(async (account, index) => {
|
|
80
|
+
const signature = await account.sign(hashBytes, previousHashesBytes[index]);
|
|
81
|
+
return hexFromArrayBuffer(signature[0]);
|
|
82
|
+
}));
|
|
96
83
|
}
|
|
97
|
-
static
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
84
|
+
static addressIndex(payload, address) {
|
|
85
|
+
const index = payload.addresses.indexOf(address);
|
|
86
|
+
if (index === -1) {
|
|
87
|
+
throw new Error("Invalid address");
|
|
88
|
+
}
|
|
89
|
+
return index;
|
|
90
|
+
}
|
|
91
|
+
static previousHash(boundWitness, address) {
|
|
92
|
+
return asHash(boundWitness.previous_hashes[this.addressIndex(boundWitness, address)])?.toLowerCase();
|
|
93
|
+
}
|
|
94
|
+
get addresses() {
|
|
95
|
+
uniqueAccounts(this._accounts, true);
|
|
96
|
+
return this._accounts.map((account) => account.address.toLowerCase());
|
|
97
|
+
}
|
|
98
|
+
get payloadSchemas() {
|
|
99
|
+
return this._payloadSchemas ?? this._payloads.map((payload) => {
|
|
100
|
+
return assertEx(payload.schema, () => missingSchemaMessage(payload));
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
get previousHashBytes() {
|
|
104
|
+
return this._accounts.map((account) => account.previousHashBytes ?? null);
|
|
105
|
+
}
|
|
106
|
+
get previousHashes() {
|
|
107
|
+
return this._accounts.map((account) => account.previousHash ?? null);
|
|
108
|
+
}
|
|
109
|
+
async sign() {
|
|
110
|
+
uniqueAccounts(this._accounts, true);
|
|
111
|
+
const hashBytes = toArrayBuffer(await this.dataHash());
|
|
112
|
+
return await Promise.all(this._accounts.map(async (account) => {
|
|
113
|
+
const signature = await account.sign(hashBytes);
|
|
114
|
+
return hexFromArrayBuffer(signature[0]);
|
|
115
|
+
}));
|
|
101
116
|
}
|
|
102
117
|
async build(sign = true) {
|
|
103
118
|
return await _BoundWitnessBuilder._buildMutex.runExclusive(async () => {
|
|
@@ -122,7 +137,7 @@ var BoundWitnessBuilder = class _BoundWitnessBuilder extends PayloadBuilder {
|
|
|
122
137
|
return hash;
|
|
123
138
|
}
|
|
124
139
|
async dataHashableFields() {
|
|
125
|
-
const generatedFields = await this.
|
|
140
|
+
const generatedFields = await _BoundWitnessBuilder.linkingFields(this._accounts, this._payloads);
|
|
126
141
|
_BoundWitnessBuilder.validateGeneratedFields(generatedFields);
|
|
127
142
|
const fields = {
|
|
128
143
|
...PayloadBuilder.omitMeta(this._fields ?? {}),
|
|
@@ -152,11 +167,10 @@ var BoundWitnessBuilder = class _BoundWitnessBuilder extends PayloadBuilder {
|
|
|
152
167
|
for (const field of GeneratedBoundWitnessFields) {
|
|
153
168
|
delete clone[field];
|
|
154
169
|
}
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
);
|
|
170
|
+
const withoutEmptyFields = removeEmptyFields(clone);
|
|
171
|
+
const withoutSchema = omitSchema(withoutEmptyFields);
|
|
172
|
+
const withoutClientMeta = _BoundWitnessBuilder.omitClientMeta(withoutSchema);
|
|
173
|
+
this._fields = _BoundWitnessBuilder.omitStorageMeta(withoutClientMeta);
|
|
160
174
|
return this;
|
|
161
175
|
}
|
|
162
176
|
hashes(hashes, schema) {
|
|
@@ -208,18 +222,6 @@ var BoundWitnessBuilder = class _BoundWitnessBuilder extends PayloadBuilder {
|
|
|
208
222
|
this._accounts?.push(...accounts);
|
|
209
223
|
return this;
|
|
210
224
|
}
|
|
211
|
-
async sign() {
|
|
212
|
-
uniqueAccounts(this._accounts, true);
|
|
213
|
-
const hashBytes = toArrayBuffer(await this.dataHash());
|
|
214
|
-
return await Promise.all(this._accounts.map(async (account) => hexFromArrayBuffer((await account.sign(hashBytes))[0])));
|
|
215
|
-
}
|
|
216
|
-
async generatedFields() {
|
|
217
|
-
return await _BoundWitnessBuilder.linkingFields(this._accounts, this._payloads);
|
|
218
|
-
}
|
|
219
|
-
missingSchemaMessage(payload) {
|
|
220
|
-
return `Builder: Missing Schema
|
|
221
|
-
${JSON.stringify(payload, null, 2)}`;
|
|
222
|
-
}
|
|
223
225
|
};
|
|
224
226
|
|
|
225
227
|
// src/combinationsByBoundwitness.ts
|
|
@@ -237,7 +239,10 @@ var combinationsByBoundwitness = async (payloads) => {
|
|
|
237
239
|
const results = [];
|
|
238
240
|
for (const bw of bws) {
|
|
239
241
|
const { payload_hashes } = bw;
|
|
240
|
-
const p = payload_hashes.map((h) =>
|
|
242
|
+
const p = payload_hashes.map((h) => {
|
|
243
|
+
const hashKey = String(asHash2(h, true));
|
|
244
|
+
return payloadDictionary[hashKey];
|
|
245
|
+
}).filter(exists);
|
|
241
246
|
if (p.length === payload_hashes.length) {
|
|
242
247
|
const complete = [bw, ...p];
|
|
243
248
|
results.push(complete);
|
|
@@ -251,7 +256,7 @@ import { asHash as asHash3 } from "@xylabs/sdk-js";
|
|
|
251
256
|
var intraBoundwitnessSchemaCombinations = (boundwitness, schemas) => {
|
|
252
257
|
const indexMap = {};
|
|
253
258
|
for (const [index, element] of boundwitness.payload_schemas.entries()) {
|
|
254
|
-
if (!indexMap
|
|
259
|
+
if (!Object.hasOwn(indexMap, element)) {
|
|
255
260
|
indexMap[element] = [];
|
|
256
261
|
}
|
|
257
262
|
indexMap[element].push(index);
|
|
@@ -259,7 +264,7 @@ var intraBoundwitnessSchemaCombinations = (boundwitness, schemas) => {
|
|
|
259
264
|
let uniqueCombinations = [[]];
|
|
260
265
|
for (const element of schemas) {
|
|
261
266
|
const newCombinations = [];
|
|
262
|
-
const indices = indexMap[element]
|
|
267
|
+
const indices = indexMap[element] ?? [];
|
|
263
268
|
for (const combination of uniqueCombinations) {
|
|
264
269
|
for (const index of indices) {
|
|
265
270
|
if (!combination.includes(index)) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/BoundWitnessBuilder.ts", "../../src/GeneratedBoundWitnessFields.ts", "../../src/uniqueAddresses.ts", "../../src/uniqueAccounts.ts", "../../src/combinationsByBoundwitness.ts", "../../src/intraBoundwitnessSchemaCombinations.ts", "../../src/Query/QueryBoundWitnessBuilder.ts"],
|
|
4
|
-
"sourcesContent": ["import type { Hash, Hex } from '@xylabs/sdk-js'\nimport {\n asHash, assertEx, hexFromArrayBuffer, toArrayBuffer,\n} from '@xylabs/sdk-js'\nimport type { AccountInstance } from '@xyo-network/account-model'\nimport type { XyoAddress } from '@xyo-network/address'\nimport type {\n BoundWitness,\n PossiblySigned,\n Signed,\n Unsigned,\n} from '@xyo-network/boundwitness-model'\nimport { BoundWitnessSchema } from '@xyo-network/boundwitness-model'\nimport {\n ObjectHasher, removeEmptyFields, sortFields,\n} from '@xyo-network/hash'\nimport type { PayloadBuilderOptions } from '@xyo-network/payload-builder'\nimport { omitSchema, PayloadBuilder } from '@xyo-network/payload-builder'\nimport type {\n ModuleError, Payload, Schema,\n WithoutClientMeta,\n WithoutMeta,\n WithoutSchema,\n WithoutStorageMeta,\n} from '@xyo-network/payload-model'\nimport { Mutex } from 'async-mutex'\n\nimport { GeneratedBoundWitnessFields } from './GeneratedBoundWitnessFields.ts'\nimport { uniqueAccounts } from './uniqueAccounts.ts'\n\nexport class BoundWitnessBuilder<\n TBoundWitness extends BoundWitness = BoundWitness,\n TPayload extends Payload = Payload>\n extends PayloadBuilder<\n TBoundWitness,\n Promise<[PossiblySigned<TBoundWitness>, TPayload[], ModuleError[]]>\n > {\n private static readonly _buildMutex = new Mutex()\n\n private _accounts: AccountInstance[] = []\n private _errorHashes?: Hash[]\n private _errors: ModuleError[] = []\n private _payloadHashes?: Hash[]\n private _payloadSchemas?: Schema[]\n private _payloads: TPayload[] = []\n\n constructor(options?: Omit<PayloadBuilderOptions, 'schema'>) {\n super({ ...options, schema: BoundWitnessSchema })\n }\n\n protected get addresses(): XyoAddress[] {\n uniqueAccounts(this._accounts, true)\n return this._accounts.map(account => account.address.toLowerCase()) as XyoAddress[]\n }\n\n protected get payloadSchemas(): string[] {\n return (\n this._payloadSchemas\n ?? this._payloads.map((payload) => {\n return assertEx(payload.schema, () => this.missingSchemaMessage(payload))\n })\n )\n }\n\n protected get previousHashBytes(): (ArrayBufferLike | null)[] {\n return this._accounts.map(account => account.previousHashBytes ?? null)\n }\n\n protected get previousHashes(): (Hash | null)[] {\n return this._accounts.map(account => account.previousHash ?? null)\n }\n\n static addressIndex<T extends BoundWitness>(payload: T, address: XyoAddress) {\n const index = payload.addresses.indexOf(address)\n if (index === -1) {\n throw new Error('Invalid address')\n }\n return index\n }\n\n static previousHash<T extends BoundWitness>(boundWitness: T, address: XyoAddress) {\n return asHash(boundWitness.previous_hashes[this.addressIndex(boundWitness, address)])?.toLowerCase()\n }\n\n protected static async linkingFields<T extends BoundWitness>(\n accounts: AccountInstance[],\n payloads?: Payload[],\n ): Promise<Pick<T, GeneratedBoundWitnessFields>> {\n const addresses = accounts.map(account => account.address.toLowerCase() as XyoAddress)\n const previous_hashes = accounts.map(account => account.previousHash ?? null)\n const payload_hashes = payloads ? await BoundWitnessBuilder.hashes(payloads) : []\n const payload_schemas = payloads?.map(({ schema }) => schema) ?? []\n return {\n addresses, payload_hashes, payload_schemas, previous_hashes,\n }\n }\n\n protected static signature<T extends BoundWitness>(payload: T, address: XyoAddress) {\n return payload.$signatures[this.addressIndex(payload, address)]\n }\n\n protected static async signatures(accounts: AccountInstance[], dataHash: Hash): Promise<string[]> {\n const hashBytes = toArrayBuffer(dataHash)\n const previousHashesBytes = accounts?.map(account => account.previousHashBytes)\n return await Promise.all(accounts.map(async (account, index) => hexFromArrayBuffer((await account.sign(hashBytes, previousHashesBytes[index]))[0])))\n }\n\n private static validateGeneratedFields(fields: Pick<BoundWitness, GeneratedBoundWitnessFields>) {\n assertEx(fields.payload_hashes?.length === fields.payload_schemas?.length, () => 'Payload hash/schema mismatch')\n assertEx(!(fields.payload_hashes as (Hash | null)[]).includes(null), () => 'nulls found in hashes')\n assertEx(!(fields.payload_schemas as (Schema | null)[]).includes(null), () => 'nulls found in schemas')\n }\n\n override async build(): Promise<[Signed<TBoundWitness>, TPayload[], ModuleError[]]>\n override async build(sign: false): Promise<[Unsigned<TBoundWitness>, TPayload[], ModuleError[]]>\n override async build(sign: true): Promise<[Signed<TBoundWitness>, TPayload[], ModuleError[]]>\n override async build(sign = true): Promise<[PossiblySigned<TBoundWitness>, TPayload[], ModuleError[]]> {\n return await BoundWitnessBuilder._buildMutex.runExclusive(async () => {\n const dataHashableFields = await this.dataHashableFields()\n const $signatures = sign ? await this.sign() : this.addresses.map(() => null)\n\n const ret = {\n ...this._meta, ...dataHashableFields, ...this._fields, $signatures,\n } as Signed<TBoundWitness>\n return [\n ret,\n this._payloads,\n this._errors,\n ]\n })\n }\n\n async dataHash() {\n const dataHashableFields = await this.dataHashableFields()\n const hash = await ObjectHasher.hash(dataHashableFields)\n return hash\n }\n\n override async dataHashableFields(): Promise<WithoutMeta<TBoundWitness>> {\n const generatedFields: Pick<TBoundWitness, GeneratedBoundWitnessFields> = await this.generatedFields()\n BoundWitnessBuilder.validateGeneratedFields(generatedFields)\n const fields: WithoutSchema<TBoundWitness> = {\n ...PayloadBuilder.omitMeta(this._fields ?? {}),\n ...generatedFields,\n } as WithoutSchema<TBoundWitness>\n return await BoundWitnessBuilder.dataHashableFields<TBoundWitness>(this._schema, fields)\n }\n\n error(payload?: ModuleError) {\n assertEx(this._errorHashes === undefined, () => 'Can not set errors when hashes already set')\n if (payload) {\n this._errors.push(assertEx(sortFields(payload)))\n }\n return this\n }\n\n errors(errors?: (ModuleError | null)[]) {\n if (errors) {\n for (const error of errors) {\n if (error !== null) {\n this.error(error)\n }\n }\n }\n return this\n }\n\n override fields(fields: WithoutSchema<Omit<WithoutStorageMeta<WithoutClientMeta<TBoundWitness>>,\n 'addresses' | 'payload_hashes' | 'payload_schemas' | 'previous_hashes'>>): this {\n // clean it up just incase\n const clone = structuredClone(fields) as unknown as Partial<TBoundWitness>\n for (const field of GeneratedBoundWitnessFields) {\n delete clone[field]\n }\n // we need to do the cast here since ts seems to not like nested, yet same, generics\n this._fields\n = BoundWitnessBuilder.omitStorageMeta(\n BoundWitnessBuilder.omitClientMeta(\n omitSchema(removeEmptyFields(clone)),\n ),\n ) as unknown as WithoutStorageMeta<WithoutClientMeta<WithoutSchema<TBoundWitness>>>\n return this\n }\n\n hashes(hashes: Hash[], schema: Schema[]) {\n assertEx(this.payloads.length === 0, () => 'Can not set hashes when payloads already set')\n this._payloadHashes = hashes\n this._payloadSchemas = schema\n return this\n }\n\n payload(payload?: TPayload) {\n assertEx(this._payloadHashes === undefined, () => 'Can not set payloads when hashes already set')\n if (payload) {\n this._payloads.push(assertEx(sortFields<TPayload>(payload)))\n }\n return this\n }\n\n payloads(payloads?: (TPayload | null)[]) {\n if (payloads)\n for (const payload of payloads) {\n if (payload !== null) {\n this.payload(payload)\n }\n }\n return this\n }\n\n signer(account: AccountInstance) {\n uniqueAccounts([...this._accounts, account], true)\n this._accounts?.push(account)\n return this\n }\n\n signers(accounts: AccountInstance[]) {\n uniqueAccounts([...this._accounts, ...accounts], true)\n this._accounts?.push(...accounts)\n return this\n }\n\n sourceQuery(sourceQuery: Hash) {\n this._meta = {\n ...this._meta,\n $sourceQuery: sourceQuery,\n } as typeof this._meta\n return this\n }\n\n /** @deprecated use signer instead */\n witness(account: AccountInstance) {\n this._accounts?.push(account)\n return this\n }\n\n /** @deprecated use signers instead */\n witnesses(accounts: AccountInstance[]) {\n this._accounts?.push(...accounts)\n return this\n }\n\n protected async sign(): Promise<Hex[]> {\n uniqueAccounts(this._accounts, true)\n const hashBytes = toArrayBuffer(await this.dataHash())\n return await Promise.all(this._accounts.map(async account => hexFromArrayBuffer((await account.sign(hashBytes))[0])))\n }\n\n private async generatedFields(): Promise<Pick<TBoundWitness, GeneratedBoundWitnessFields>> {\n return await BoundWitnessBuilder.linkingFields(this._accounts, this._payloads)\n }\n\n private missingSchemaMessage(payload: Payload) {\n return `Builder: Missing Schema\\n${JSON.stringify(payload, null, 2)}`\n }\n}\n", "export const GeneratedBoundWitnessFields = ['addresses', 'payload_hashes', 'payload_schemas', 'previous_hashes'] as const\nexport type GeneratedBoundWitnessFields = typeof GeneratedBoundWitnessFields[number]\n", "import type { XyoAddress } from '@xyo-network/address'\n\nexport const uniqueAddresses = (addresses: XyoAddress[], throwOnFalse = false) => {\n const addressesSet = new Set<XyoAddress>()\n for (const address of addresses) {\n if (addressesSet.has(address)) {\n if (throwOnFalse) {\n throw new Error('Duplicate address')\n }\n return false\n }\n addressesSet.add(address)\n }\n return true\n}\n", "import type { AccountInstance } from '@xyo-network/account-model'\n\nimport { uniqueAddresses } from './uniqueAddresses.ts'\n\nexport const uniqueAccounts = (accounts: AccountInstance[], throwOnFalse = false) => {\n return uniqueAddresses(accounts.map(account => account.address), throwOnFalse)\n}\n", "import {\n asHash, difference, exists,\n} from '@xylabs/sdk-js'\nimport type { BoundWitness } from '@xyo-network/boundwitness-model'\nimport { isBoundWitness } from '@xyo-network/boundwitness-model'\nimport { PayloadBuilder } from '@xyo-network/payload-builder'\nimport type { Payload } from '@xyo-network/payload-model'\n\n/**\n * Returns tuples of bound witnesses and their payloads from the supplied payloads. Omits\n * bound witnesses where the payloads were not included in the supplied payloads.\n * @param payloads An array of bound witnesses and payloads\n * @returns An array of tuples of bound witnesses and their payloads\n */\nexport const combinationsByBoundwitness = async (payloads: Payload[]): Promise<[BoundWitness, ...Payload[]][]> => {\n const bws = new Set<BoundWitness>(payloads.filter(x => isBoundWitness(x)))\n const remaining = difference(new Set(payloads), bws)\n const payloadDictionary = await PayloadBuilder.toHashMap([...remaining])\n const results = [] as [BoundWitness, ...Payload[]][]\n for (const bw of bws) {\n const { payload_hashes } = bw\n const p = payload_hashes.map(h => payloadDictionary[asHash(h, true)]).filter(exists)\n if (p.length === payload_hashes.length) {\n const complete = [bw, ...p] as [BoundWitness, ...Payload[]]\n results.push(complete)\n }\n }\n return results\n}\n", "import { asHash, type Hash } from '@xylabs/sdk-js'\nimport type { BoundWitness } from '@xyo-network/boundwitness-model'\nimport type { Schema } from '@xyo-network/payload-model'\n\n/**\n * Returns all the possible combinations of payloads for the supplied schemas within the bound witness\n * @param boundwitness The bound witness to search\n * @param schemas The schemas to search for unique combinations of\n * @returns The payload hashes corresponding to the unique combinations of the supplied schemas\n */\nexport const intraBoundwitnessSchemaCombinations = (boundwitness: BoundWitness, schemas: Schema[]): Hash[][] => {\n // Map to store the indices of each element in the source array\n const indexMap: Record<string, number[]> = {}\n\n // Populate the index map with positions of each element\n for (const [index, element] of boundwitness.payload_schemas.entries()) {\n if (!indexMap[element]) {\n indexMap[element] = []\n }\n indexMap[element].push(index)\n }\n\n // Initialize an array to store unique combinations\n let uniqueCombinations = [[]] as number[][]\n\n // Iterate over each element in the target array\n for (const element of schemas) {\n const newCombinations: number[][] = []\n // Get the array of indices for the current element\n const indices = indexMap[element] || []\n\n // Iterate over existing combinations\n for (const combination of uniqueCombinations) {\n // Iterate over each index in the indices array\n for (const index of indices) {\n // Check if the index is already in the combination\n if (!combination.includes(index)) {\n const newCombination = [...combination, index]\n // Only add the new combination if its length matches the current target index\n if (newCombination.length === schemas.indexOf(element) + 1) {\n newCombinations.push(newCombination)\n }\n }\n }\n }\n\n // Update the unique combinations for the next iteration\n uniqueCombinations = newCombinations\n }\n\n return uniqueCombinations.map((indexes) => {\n return indexes.map((index) => {\n return asHash(boundwitness.payload_hashes[index], true)\n })\n })\n}\n", "import { assertEx } from '@xylabs/sdk-js'\nimport type { QueryBoundWitness } from '@xyo-network/boundwitness-model'\nimport { PayloadBuilder } from '@xyo-network/payload'\nimport type { Query, WithoutMeta } from '@xyo-network/payload-model'\n\nimport { BoundWitnessBuilder } from '../BoundWitnessBuilder.ts'\n\nexport class QueryBoundWitnessBuilder<\n TBoundWitness extends QueryBoundWitness = QueryBoundWitness,\n TQuery extends Query = Query,\n> extends BoundWitnessBuilder<TBoundWitness> {\n private _query: TQuery | undefined\n\n override async dataHashableFields(): Promise<WithoutMeta<TBoundWitness>> {\n const fields = {\n ...(await super.dataHashableFields()),\n query: await PayloadBuilder.dataHash(assertEx(this._query, () => 'No Query Specified')),\n } as TBoundWitness\n return { ...fields } as WithoutMeta<TBoundWitness>\n }\n\n query<T extends TQuery>(query: T) {\n this.payload(query)\n this._query = query\n return this\n }\n}\n"],
|
|
5
|
-
"mappings": ";AACA;AAAA,EACE;AAAA,EAAQ;AAAA,EAAU;AAAA,EAAoB;AAAA,OACjC;AASP,SAAS,0BAA0B;AACnC;AAAA,EACE;AAAA,EAAc;AAAA,EAAmB;AAAA,OAC5B;AAEP,SAAS,YAAY,sBAAsB;AAQ3C,SAAS,aAAa;;;ACzBf,IAAM,8BAA8B,CAAC,aAAa,kBAAkB,mBAAmB,iBAAiB;;;ACExG,IAAM,kBAAkB,CAAC,WAAyB,eAAe,UAAU;AAChF,QAAM,eAAe,oBAAI,IAAgB;AACzC,aAAW,WAAW,WAAW;AAC/B,QAAI,aAAa,IAAI,OAAO,GAAG;AAC7B,UAAI,cAAc;AAChB,cAAM,IAAI,MAAM,mBAAmB;AAAA,MACrC;AACA,aAAO;AAAA,IACT;AACA,iBAAa,IAAI,OAAO;AAAA,EAC1B;AACA,SAAO;AACT;;;ACVO,IAAM,iBAAiB,CAAC,UAA6B,eAAe,UAAU;AACnF,SAAO,gBAAgB,SAAS,IAAI,aAAW,QAAQ,OAAO,GAAG,YAAY;AAC/E;;;
|
|
4
|
+
"sourcesContent": ["import type { Hash, Hex } from '@xylabs/sdk-js'\nimport {\n asHash, assertEx, hexFromArrayBuffer, toArrayBuffer,\n} from '@xylabs/sdk-js'\nimport type { AccountInstance } from '@xyo-network/account-model'\nimport type { XyoAddress } from '@xyo-network/address'\nimport type {\n BoundWitness,\n PossiblySigned,\n Signed,\n Unsigned,\n} from '@xyo-network/boundwitness-model'\nimport { BoundWitnessSchema } from '@xyo-network/boundwitness-model'\nimport {\n ObjectHasher, removeEmptyFields, sortFields,\n} from '@xyo-network/hash'\nimport type { PayloadBuilderOptions } from '@xyo-network/payload-builder'\nimport { omitSchema, PayloadBuilder } from '@xyo-network/payload-builder'\nimport type {\n ModuleError, Payload, Schema,\n WithoutClientMeta,\n WithoutMeta,\n WithoutSchema,\n WithoutStorageMeta,\n} from '@xyo-network/payload-model'\nimport { Mutex } from 'async-mutex'\n\nimport { GeneratedBoundWitnessFields } from './GeneratedBoundWitnessFields.ts'\nimport { uniqueAccounts } from './uniqueAccounts.ts'\n\nfunction missingSchemaMessage(payload: Payload) {\n return `Builder: Missing Schema\\n${JSON.stringify(payload, null, 2)}`\n}\n\nexport class BoundWitnessBuilder<\n TBoundWitness extends BoundWitness = BoundWitness,\n TPayload extends Payload = Payload>\n extends PayloadBuilder<\n TBoundWitness,\n Promise<[PossiblySigned<TBoundWitness>, TPayload[], ModuleError[]]>\n > {\n private static readonly _buildMutex = new Mutex()\n\n private _accounts: AccountInstance[] = []\n private _errorHashes?: Hash[]\n private _errors: ModuleError[] = []\n private _payloadHashes?: Hash[]\n private _payloadSchemas?: Schema[]\n private _payloads: TPayload[] = []\n\n constructor(options?: Omit<PayloadBuilderOptions, 'schema'>) {\n super({ ...options, schema: BoundWitnessSchema })\n }\n\n private static validateGeneratedFields(fields: Pick<BoundWitness, GeneratedBoundWitnessFields>) {\n assertEx(fields.payload_hashes?.length === fields.payload_schemas?.length, () => 'Payload hash/schema mismatch')\n assertEx(!(fields.payload_hashes as (Hash | null)[]).includes(null), () => 'nulls found in hashes')\n assertEx(!(fields.payload_schemas as (Schema | null)[]).includes(null), () => 'nulls found in schemas')\n }\n\n protected static async linkingFields<T extends BoundWitness>(\n accounts: AccountInstance[],\n payloads?: Payload[],\n ): Promise<Pick<T, GeneratedBoundWitnessFields>> {\n const addresses = accounts.map(account => account.address.toLowerCase() as XyoAddress)\n const previous_hashes = accounts.map(account => account.previousHash ?? null)\n const payload_hashes = payloads ? await this.hashes(payloads) : []\n const payload_schemas = payloads?.map(({ schema }) => schema) ?? []\n return {\n addresses, payload_hashes, payload_schemas, previous_hashes,\n }\n }\n\n protected static signature<T extends BoundWitness>(payload: T, address: XyoAddress) {\n return payload.$signatures[this.addressIndex(payload, address)]\n }\n\n protected static async signatures(accounts: AccountInstance[], dataHash: Hash): Promise<string[]> {\n const hashBytes = toArrayBuffer(dataHash)\n const previousHashesBytes = accounts?.map(account => account.previousHashBytes)\n return await Promise.all(accounts.map(async (account, index) => {\n const signature = await account.sign(hashBytes, previousHashesBytes[index])\n return hexFromArrayBuffer(signature[0])\n }))\n }\n\n static addressIndex<T extends BoundWitness>(payload: T, address: XyoAddress) {\n const index = payload.addresses.indexOf(address)\n if (index === -1) {\n throw new Error('Invalid address')\n }\n return index\n }\n\n static previousHash<T extends BoundWitness>(boundWitness: T, address: XyoAddress) {\n return asHash(boundWitness.previous_hashes[this.addressIndex(boundWitness, address)])?.toLowerCase()\n }\n\n protected get addresses(): XyoAddress[] {\n uniqueAccounts(this._accounts, true)\n return this._accounts.map(account => account.address.toLowerCase()) as XyoAddress[]\n }\n\n protected get payloadSchemas(): string[] {\n return (\n this._payloadSchemas\n ?? this._payloads.map((payload) => {\n return assertEx(payload.schema, () => missingSchemaMessage(payload))\n })\n )\n }\n\n protected get previousHashBytes(): (ArrayBufferLike | null)[] {\n return this._accounts.map(account => account.previousHashBytes ?? null)\n }\n\n protected get previousHashes(): (Hash | null)[] {\n return this._accounts.map(account => account.previousHash ?? null)\n }\n\n protected async sign(): Promise<Hex[]> {\n uniqueAccounts(this._accounts, true)\n const hashBytes = toArrayBuffer(await this.dataHash())\n return await Promise.all(this._accounts.map(async (account) => {\n const signature = await account.sign(hashBytes)\n return hexFromArrayBuffer(signature[0])\n }))\n }\n\n override async build(): Promise<[Signed<TBoundWitness>, TPayload[], ModuleError[]]>\n override async build(sign: false): Promise<[Unsigned<TBoundWitness>, TPayload[], ModuleError[]]>\n override async build(sign: true): Promise<[Signed<TBoundWitness>, TPayload[], ModuleError[]]>\n override async build(sign = true): Promise<[PossiblySigned<TBoundWitness>, TPayload[], ModuleError[]]> {\n return await BoundWitnessBuilder._buildMutex.runExclusive(async () => {\n const dataHashableFields = await this.dataHashableFields()\n const $signatures = sign ? await this.sign() : this.addresses.map(() => null)\n\n const ret = {\n ...this._meta, ...dataHashableFields, ...this._fields, $signatures,\n } as Signed<TBoundWitness>\n return [\n ret,\n this._payloads,\n this._errors,\n ]\n })\n }\n\n async dataHash() {\n const dataHashableFields = await this.dataHashableFields()\n const hash = await ObjectHasher.hash(dataHashableFields)\n return hash\n }\n\n override async dataHashableFields(): Promise<WithoutMeta<TBoundWitness>> {\n const generatedFields: Pick<TBoundWitness, GeneratedBoundWitnessFields> = await BoundWitnessBuilder.linkingFields(this._accounts, this._payloads)\n BoundWitnessBuilder.validateGeneratedFields(generatedFields)\n const fields: WithoutSchema<TBoundWitness> = {\n ...PayloadBuilder.omitMeta(this._fields ?? {}),\n ...generatedFields,\n } as WithoutSchema<TBoundWitness>\n return await BoundWitnessBuilder.dataHashableFields<TBoundWitness>(this._schema, fields)\n }\n\n error(payload?: ModuleError) {\n assertEx(this._errorHashes === undefined, () => 'Can not set errors when hashes already set')\n if (payload) {\n this._errors.push(assertEx(sortFields(payload)))\n }\n return this\n }\n\n errors(errors?: (ModuleError | null)[]) {\n if (errors) {\n for (const error of errors) {\n if (error !== null) {\n this.error(error)\n }\n }\n }\n return this\n }\n\n override fields(fields: WithoutSchema<Omit<WithoutStorageMeta<WithoutClientMeta<TBoundWitness>>,\n 'addresses' | 'payload_hashes' | 'payload_schemas' | 'previous_hashes'>>): this {\n // clean it up just incase\n const clone = structuredClone(fields) as unknown as Partial<TBoundWitness>\n for (const field of GeneratedBoundWitnessFields) {\n delete clone[field]\n }\n const withoutEmptyFields = removeEmptyFields(clone)\n const withoutSchema = omitSchema(withoutEmptyFields)\n const withoutClientMeta = BoundWitnessBuilder.omitClientMeta(withoutSchema)\n // we need to do the cast here since ts seems to not like nested, yet same, generics\n this._fields = BoundWitnessBuilder.omitStorageMeta(withoutClientMeta) as unknown as WithoutStorageMeta<WithoutClientMeta<WithoutSchema<TBoundWitness>>>\n return this\n }\n\n hashes(hashes: Hash[], schema: Schema[]) {\n assertEx(this.payloads.length === 0, () => 'Can not set hashes when payloads already set')\n this._payloadHashes = hashes\n this._payloadSchemas = schema\n return this\n }\n\n payload(payload?: TPayload) {\n assertEx(this._payloadHashes === undefined, () => 'Can not set payloads when hashes already set')\n if (payload) {\n this._payloads.push(assertEx(sortFields<TPayload>(payload)))\n }\n return this\n }\n\n payloads(payloads?: (TPayload | null)[]) {\n if (payloads)\n for (const payload of payloads) {\n if (payload !== null) {\n this.payload(payload)\n }\n }\n return this\n }\n\n signer(account: AccountInstance) {\n uniqueAccounts([...this._accounts, account], true)\n this._accounts?.push(account)\n return this\n }\n\n signers(accounts: AccountInstance[]) {\n uniqueAccounts([...this._accounts, ...accounts], true)\n this._accounts?.push(...accounts)\n return this\n }\n\n sourceQuery(sourceQuery: Hash) {\n this._meta = {\n ...this._meta,\n $sourceQuery: sourceQuery,\n } as typeof this._meta\n return this\n }\n\n /** @deprecated use signer instead */\n witness(account: AccountInstance) {\n this._accounts?.push(account)\n return this\n }\n\n /** @deprecated use signers instead */\n witnesses(accounts: AccountInstance[]) {\n this._accounts?.push(...accounts)\n return this\n }\n}\n", "export const GeneratedBoundWitnessFields = ['addresses', 'payload_hashes', 'payload_schemas', 'previous_hashes'] as const\nexport type GeneratedBoundWitnessFields = typeof GeneratedBoundWitnessFields[number]\n", "import type { XyoAddress } from '@xyo-network/address'\n\nexport const uniqueAddresses = (addresses: XyoAddress[], throwOnFalse = false) => {\n const addressesSet = new Set<XyoAddress>()\n for (const address of addresses) {\n if (addressesSet.has(address)) {\n if (throwOnFalse) {\n throw new Error('Duplicate address')\n }\n return false\n }\n addressesSet.add(address)\n }\n return true\n}\n", "import type { AccountInstance } from '@xyo-network/account-model'\n\nimport { uniqueAddresses } from './uniqueAddresses.ts'\n\nexport const uniqueAccounts = (accounts: AccountInstance[], throwOnFalse = false) => {\n return uniqueAddresses(accounts.map(account => account.address), throwOnFalse)\n}\n", "import {\n asHash, difference, exists,\n} from '@xylabs/sdk-js'\nimport type { BoundWitness } from '@xyo-network/boundwitness-model'\nimport { isBoundWitness } from '@xyo-network/boundwitness-model'\nimport { PayloadBuilder } from '@xyo-network/payload-builder'\nimport type { Payload } from '@xyo-network/payload-model'\n\n/**\n * Returns tuples of bound witnesses and their payloads from the supplied payloads. Omits\n * bound witnesses where the payloads were not included in the supplied payloads.\n * @param payloads An array of bound witnesses and payloads\n * @returns An array of tuples of bound witnesses and their payloads\n */\nexport const combinationsByBoundwitness = async (payloads: Payload[]): Promise<[BoundWitness, ...Payload[]][]> => {\n const bws = new Set<BoundWitness>(payloads.filter(x => isBoundWitness(x)))\n const remaining = difference(new Set(payloads), bws)\n const payloadDictionary = await PayloadBuilder.toHashMap([...remaining]) as Record<string, Payload>\n const results = [] as [BoundWitness, ...Payload[]][]\n for (const bw of bws) {\n const { payload_hashes } = bw\n const p = payload_hashes.map((h) => {\n const hashKey = String(asHash(h, true))\n return payloadDictionary[hashKey]\n }).filter(exists)\n if (p.length === payload_hashes.length) {\n const complete = [bw, ...p] as [BoundWitness, ...Payload[]]\n results.push(complete)\n }\n }\n return results\n}\n", "import { asHash, type Hash } from '@xylabs/sdk-js'\nimport type { BoundWitness } from '@xyo-network/boundwitness-model'\nimport type { Schema } from '@xyo-network/payload-model'\n\n/**\n * Returns all the possible combinations of payloads for the supplied schemas within the bound witness\n * @param boundwitness The bound witness to search\n * @param schemas The schemas to search for unique combinations of\n * @returns The payload hashes corresponding to the unique combinations of the supplied schemas\n */\nexport const intraBoundwitnessSchemaCombinations = (boundwitness: BoundWitness, schemas: Schema[]): Hash[][] => {\n // Map to store the indices of each element in the source array\n const indexMap: Record<string, number[]> = {}\n\n // Populate the index map with positions of each element\n for (const [index, element] of boundwitness.payload_schemas.entries()) {\n if (!Object.hasOwn(indexMap, element)) {\n indexMap[element] = []\n }\n indexMap[element].push(index)\n }\n\n // Initialize an array to store unique combinations\n let uniqueCombinations = [[]] as number[][]\n\n // Iterate over each element in the target array\n for (const element of schemas) {\n const newCombinations: number[][] = []\n // Get the array of indices for the current element\n const indices = indexMap[element] ?? []\n\n // Iterate over existing combinations\n for (const combination of uniqueCombinations) {\n // Iterate over each index in the indices array\n for (const index of indices) {\n // Check if the index is already in the combination\n if (!combination.includes(index)) {\n const newCombination = [...combination, index]\n // Only add the new combination if its length matches the current target index\n if (newCombination.length === schemas.indexOf(element) + 1) {\n newCombinations.push(newCombination)\n }\n }\n }\n }\n\n // Update the unique combinations for the next iteration\n uniqueCombinations = newCombinations\n }\n\n return uniqueCombinations.map((indexes) => {\n return indexes.map((index) => {\n return asHash(boundwitness.payload_hashes[index], true)\n })\n })\n}\n", "import { assertEx } from '@xylabs/sdk-js'\nimport type { QueryBoundWitness } from '@xyo-network/boundwitness-model'\nimport { PayloadBuilder } from '@xyo-network/payload'\nimport type { Query, WithoutMeta } from '@xyo-network/payload-model'\n\nimport { BoundWitnessBuilder } from '../BoundWitnessBuilder.ts'\n\nexport class QueryBoundWitnessBuilder<\n TBoundWitness extends QueryBoundWitness = QueryBoundWitness,\n TQuery extends Query = Query,\n> extends BoundWitnessBuilder<TBoundWitness> {\n private _query: TQuery | undefined\n\n override async dataHashableFields(): Promise<WithoutMeta<TBoundWitness>> {\n const fields = {\n ...(await super.dataHashableFields()),\n query: await PayloadBuilder.dataHash(assertEx(this._query, () => 'No Query Specified')),\n } as TBoundWitness\n return { ...fields } as WithoutMeta<TBoundWitness>\n }\n\n query<T extends TQuery>(query: T) {\n this.payload(query)\n this._query = query\n return this\n }\n}\n"],
|
|
5
|
+
"mappings": ";AACA;AAAA,EACE;AAAA,EAAQ;AAAA,EAAU;AAAA,EAAoB;AAAA,OACjC;AASP,SAAS,0BAA0B;AACnC;AAAA,EACE;AAAA,EAAc;AAAA,EAAmB;AAAA,OAC5B;AAEP,SAAS,YAAY,sBAAsB;AAQ3C,SAAS,aAAa;;;ACzBf,IAAM,8BAA8B,CAAC,aAAa,kBAAkB,mBAAmB,iBAAiB;;;ACExG,IAAM,kBAAkB,CAAC,WAAyB,eAAe,UAAU;AAChF,QAAM,eAAe,oBAAI,IAAgB;AACzC,aAAW,WAAW,WAAW;AAC/B,QAAI,aAAa,IAAI,OAAO,GAAG;AAC7B,UAAI,cAAc;AAChB,cAAM,IAAI,MAAM,mBAAmB;AAAA,MACrC;AACA,aAAO;AAAA,IACT;AACA,iBAAa,IAAI,OAAO;AAAA,EAC1B;AACA,SAAO;AACT;;;ACVO,IAAM,iBAAiB,CAAC,UAA6B,eAAe,UAAU;AACnF,SAAO,gBAAgB,SAAS,IAAI,aAAW,QAAQ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C,CAAC,CAAC;AAG5B,aAAW,WAAW,SAAS;AAC7B,UAAM,kBAA8B,CAAC;AAErC,UAAM,UAAU,SAAS,OAAO,KAAK,CAAC;AAGtC,eAAW,eAAe,oBAAoB;AAE5C,iBAAW,SAAS,SAAS;AAE3B,YAAI,CAAC,YAAY,SAAS,KAAK,GAAG;AAChC,gBAAM,iBAAiB,CAAC,GAAG,aAAa,KAAK;AAE7C,cAAI,eAAe,WAAW,QAAQ,QAAQ,OAAO,IAAI,GAAG;AAC1D,4BAAgB,KAAK,cAAc;AAAA,UACrC;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAGA,yBAAqB;AAAA,EACvB;AAEA,SAAO,mBAAmB,IAAI,CAAC,YAAY;AACzC,WAAO,QAAQ,IAAI,CAAC,UAAU;AAC5B,aAAOA,QAAO,aAAa,eAAe,KAAK,GAAG,IAAI;AAAA,IACxD,CAAC;AAAA,EACH,CAAC;AACH;;;ACvDA,SAAS,YAAAC,iBAAgB;AAEzB,SAAS,kBAAAC,uBAAsB;AAKxB,IAAM,2BAAN,cAGG,oBAAmC;AAAA,EACnC;AAAA,EAER,MAAe,qBAA0D;AACvE,UAAM,SAAS;AAAA,MACb,GAAI,MAAM,MAAM,mBAAmB;AAAA,MACnC,OAAO,MAAMC,gBAAe,SAASC,UAAS,KAAK,QAAQ,MAAM,oBAAoB,CAAC;AAAA,IACxF;AACA,WAAO,EAAE,GAAG,OAAO;AAAA,EACrB;AAAA,EAEA,MAAwB,OAAU;AAChC,SAAK,QAAQ,KAAK;AAClB,SAAK,SAAS;AACd,WAAO;AAAA,EACT;AACF;",
|
|
6
6
|
"names": ["asHash", "PayloadBuilder", "asHash", "assertEx", "PayloadBuilder", "PayloadBuilder", "assertEx"]
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xyo-network/boundwitness-builder",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.0.3",
|
|
4
4
|
"description": "Primary SDK for using XYO Protocol 2.0",
|
|
5
5
|
"homepage": "https://xyo.network",
|
|
6
6
|
"bugs": {
|
|
@@ -34,13 +34,13 @@
|
|
|
34
34
|
"README.md"
|
|
35
35
|
],
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@xyo-network/account-model": "~7.0.
|
|
38
|
-
"@xyo-network/
|
|
39
|
-
"@xyo-network/
|
|
40
|
-
"@xyo-network/
|
|
41
|
-
"@xyo-network/payload": "~7.0.
|
|
42
|
-
"@xyo-network/payload
|
|
43
|
-
"@xyo-network/
|
|
37
|
+
"@xyo-network/account-model": "~7.0.3",
|
|
38
|
+
"@xyo-network/address": "~7.0.3",
|
|
39
|
+
"@xyo-network/boundwitness-model": "~7.0.3",
|
|
40
|
+
"@xyo-network/payload-builder": "~7.0.3",
|
|
41
|
+
"@xyo-network/payload-model": "~7.0.3",
|
|
42
|
+
"@xyo-network/payload": "~7.0.3",
|
|
43
|
+
"@xyo-network/hash": "~7.0.3"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@bitauth/libauth": "~3.0.0",
|
|
@@ -48,24 +48,24 @@
|
|
|
48
48
|
"@opentelemetry/sdk-trace-base": "^2.8.0",
|
|
49
49
|
"@scure/base": "~2.2.0",
|
|
50
50
|
"@scure/bip39": "~2.2.0",
|
|
51
|
-
"@xylabs/sdk-js": "^6.1.
|
|
52
|
-
"@xylabs/threads": "^6.1.
|
|
53
|
-
"@xylabs/toolchain": "~8.
|
|
54
|
-
"@xylabs/tsconfig": "~8.
|
|
55
|
-
"@xylabs/vitest-extended": "^6.1.
|
|
51
|
+
"@xylabs/sdk-js": "^6.1.4",
|
|
52
|
+
"@xylabs/threads": "^6.1.4",
|
|
53
|
+
"@xylabs/toolchain": "~8.3.0",
|
|
54
|
+
"@xylabs/tsconfig": "~8.3.0",
|
|
55
|
+
"@xylabs/vitest-extended": "^6.1.4",
|
|
56
56
|
"async-mutex": "^0.5.0",
|
|
57
57
|
"debug": "^4.4.3",
|
|
58
|
-
"eslint": "^10.
|
|
59
|
-
"ethers": "^6.
|
|
58
|
+
"eslint": "^10.5.0",
|
|
59
|
+
"ethers": "^6.17.0",
|
|
60
60
|
"hash-wasm": "~4.12.0",
|
|
61
61
|
"observable-fns": "^0.6.1",
|
|
62
62
|
"typescript": "~6.0.3",
|
|
63
|
-
"vite": "^8.0
|
|
64
|
-
"vitest": "~4.1.
|
|
63
|
+
"vite": "^8.1.0",
|
|
64
|
+
"vitest": "~4.1.9",
|
|
65
65
|
"zod": "^4.4.3",
|
|
66
|
-
"@xyo-network/account": "~7.0.
|
|
67
|
-
"@xyo-network/elliptic": "~7.0.
|
|
68
|
-
"@xyo-network/wallet": "~7.0.
|
|
66
|
+
"@xyo-network/account": "~7.0.3",
|
|
67
|
+
"@xyo-network/elliptic": "~7.0.3",
|
|
68
|
+
"@xyo-network/wallet": "~7.0.3"
|
|
69
69
|
},
|
|
70
70
|
"peerDependencies": {
|
|
71
71
|
"@bitauth/libauth": "~3.0",
|