@xyo-network/wallet-xl1-cli 0.1.8 → 0.1.10
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.
- package/dist/bin/wallet.mjs +1423 -123
- package/package.json +4 -4
package/dist/bin/wallet.mjs
CHANGED
|
@@ -14196,7 +14196,7 @@ var init_esm$4 = __esmMin((() => {
|
|
|
14196
14196
|
};
|
|
14197
14197
|
}));
|
|
14198
14198
|
//#endregion
|
|
14199
|
-
//#region ../../node_modules/.pnpm/@ariestools+telemetry@8.1.
|
|
14199
|
+
//#region ../../node_modules/.pnpm/@ariestools+telemetry@8.1.3_@opentelemetry+api@1.9.1/node_modules/@ariestools/telemetry/dist/neutral/index.mjs
|
|
14200
14200
|
async function timeBudget(name, logger, func, budget, status = false) {
|
|
14201
14201
|
const start = Date.now();
|
|
14202
14202
|
const timer = status ? setInterval(() => {
|
|
@@ -14207,7 +14207,7 @@ async function timeBudget(name, logger, func, budget, status = false) {
|
|
|
14207
14207
|
const duration = Date.now() - start;
|
|
14208
14208
|
if (timer === void 0 && budget > 0 && duration > budget) if (duration > 100 * budget) logger?.warn(`Function [${name}] execution exceeded 100x budget: ${duration}ms > ${budget}ms`);
|
|
14209
14209
|
else if (duration > 10 * budget) logger?.info(`Function [${name}] execution exceeded 10x budget: ${duration}ms > ${budget}ms`);
|
|
14210
|
-
else logger?.log(`Function [${name}] execution exceeded
|
|
14210
|
+
else logger?.log(`Function [${name}] execution exceeded budget: ${duration}ms > ${budget}ms`);
|
|
14211
14211
|
if (timer !== void 0) clearInterval(timer);
|
|
14212
14212
|
return result;
|
|
14213
14213
|
}
|
|
@@ -14412,7 +14412,7 @@ var init_neutral$4 = __esmMin((() => {
|
|
|
14412
14412
|
});
|
|
14413
14413
|
}));
|
|
14414
14414
|
//#endregion
|
|
14415
|
-
//#region ../../node_modules/.pnpm/@ariestools+sdk@8.1.
|
|
14415
|
+
//#region ../../node_modules/.pnpm/@ariestools+sdk@8.1.3_@opentelemetry+api@1.9.1_zod@4.4.3/node_modules/@ariestools/sdk/dist/node/index.mjs
|
|
14416
14416
|
function findErrorCode(error) {
|
|
14417
14417
|
let current = error;
|
|
14418
14418
|
for (let depth = 0; depth < 8 && current instanceof Error; depth++) {
|
|
@@ -14670,7 +14670,7 @@ function getFunctionName(depth = 2) {
|
|
|
14670
14670
|
let newIndex;
|
|
14671
14671
|
const stackParts = error.stack?.split("\n")[depth]?.split(" ");
|
|
14672
14672
|
const funcName = stackParts?.find((item, index) => {
|
|
14673
|
-
if (item
|
|
14673
|
+
if (item === "at" || item.length === 0) return;
|
|
14674
14674
|
if (item === "new") newIndex = index;
|
|
14675
14675
|
return true;
|
|
14676
14676
|
}) ?? "<unknown>";
|
|
@@ -14800,15 +14800,25 @@ var init_node$4 = __esmMin((() => {
|
|
|
14800
14800
|
ERR_TLS_CERT_ALTNAME_INVALID: "tls"
|
|
14801
14801
|
};
|
|
14802
14802
|
FetchError = class extends Error {
|
|
14803
|
+
/** Cross-realm marker consumed by {@link isFetchError}. */
|
|
14803
14804
|
__fetchErrorMarker = fetchErrorMarker;
|
|
14805
|
+
/** Raw unparseable body text for `parse` failures. */
|
|
14804
14806
|
body;
|
|
14807
|
+
/** Node, undici, or TLS system error code when available. */
|
|
14805
14808
|
code;
|
|
14809
|
+
/** HTTP method associated with the failed request. */
|
|
14806
14810
|
method;
|
|
14811
|
+
/** Parsed response for rejected HTTP-status requests. */
|
|
14807
14812
|
response;
|
|
14813
|
+
/** HTTP status when a response was received. */
|
|
14808
14814
|
status;
|
|
14815
|
+
/** HTTP reason phrase when a response was received. */
|
|
14809
14816
|
statusText;
|
|
14817
|
+
/** Classified reason for the fetch failure. */
|
|
14810
14818
|
type;
|
|
14819
|
+
/** Request URL associated with the failure. */
|
|
14811
14820
|
url;
|
|
14821
|
+
/** Creates a structured fetch error from a message and request context. */
|
|
14812
14822
|
constructor(message, context = {}) {
|
|
14813
14823
|
super(message, { cause: context.cause });
|
|
14814
14824
|
this.name = "FetchError";
|
|
@@ -14821,6 +14831,7 @@ var init_node$4 = __esmMin((() => {
|
|
|
14821
14831
|
this.response = context.response;
|
|
14822
14832
|
this.body = context.body;
|
|
14823
14833
|
}
|
|
14834
|
+
/** Returns a circular-reference-free representation for logs and telemetry. */
|
|
14824
14835
|
toJSON() {
|
|
14825
14836
|
return {
|
|
14826
14837
|
name: this.name,
|
|
@@ -14835,7 +14846,9 @@ var init_node$4 = __esmMin((() => {
|
|
|
14835
14846
|
}
|
|
14836
14847
|
};
|
|
14837
14848
|
FetchClientError = class extends FetchError {
|
|
14849
|
+
/** Effective request configuration, including the resolved request URL. */
|
|
14838
14850
|
config;
|
|
14851
|
+
/** Creates an HTTP-status error with its response and request configuration. */
|
|
14839
14852
|
constructor(message, response, config) {
|
|
14840
14853
|
super(message, {
|
|
14841
14854
|
type: "http-status",
|
|
@@ -14850,13 +14863,17 @@ var init_node$4 = __esmMin((() => {
|
|
|
14850
14863
|
}
|
|
14851
14864
|
};
|
|
14852
14865
|
FetchClient = class _FetchClient {
|
|
14866
|
+
/** Instance defaults shallow-merged beneath every request configuration. */
|
|
14853
14867
|
defaults;
|
|
14868
|
+
/** Creates a client with reusable request defaults. */
|
|
14854
14869
|
constructor(defaults = {}) {
|
|
14855
14870
|
this.defaults = defaults;
|
|
14856
14871
|
}
|
|
14872
|
+
/** Creates a client with the supplied request defaults. */
|
|
14857
14873
|
static create(config) {
|
|
14858
14874
|
return new _FetchClient(config);
|
|
14859
14875
|
}
|
|
14876
|
+
/** Sends a `DELETE` request and parses its response as JSON. */
|
|
14860
14877
|
delete(url, config) {
|
|
14861
14878
|
return this.request({
|
|
14862
14879
|
...config,
|
|
@@ -14864,6 +14881,7 @@ var init_node$4 = __esmMin((() => {
|
|
|
14864
14881
|
method: "DELETE"
|
|
14865
14882
|
});
|
|
14866
14883
|
}
|
|
14884
|
+
/** Sends a `GET` request and parses its response as JSON. */
|
|
14867
14885
|
get(url, config) {
|
|
14868
14886
|
return this.request({
|
|
14869
14887
|
...config,
|
|
@@ -14871,6 +14889,7 @@ var init_node$4 = __esmMin((() => {
|
|
|
14871
14889
|
method: "GET"
|
|
14872
14890
|
});
|
|
14873
14891
|
}
|
|
14892
|
+
/** Serializes `data`, sends a `PATCH` request, and parses the JSON response. */
|
|
14874
14893
|
patch(url, data, config) {
|
|
14875
14894
|
return this.request({
|
|
14876
14895
|
...config,
|
|
@@ -14879,6 +14898,7 @@ var init_node$4 = __esmMin((() => {
|
|
|
14879
14898
|
method: "PATCH"
|
|
14880
14899
|
});
|
|
14881
14900
|
}
|
|
14901
|
+
/** Serializes `data`, sends a `POST` request, and parses the JSON response. */
|
|
14882
14902
|
post(url, data, config) {
|
|
14883
14903
|
return this.request({
|
|
14884
14904
|
...config,
|
|
@@ -14887,6 +14907,7 @@ var init_node$4 = __esmMin((() => {
|
|
|
14887
14907
|
method: "POST"
|
|
14888
14908
|
});
|
|
14889
14909
|
}
|
|
14910
|
+
/** Serializes `data`, sends a `PUT` request, and parses the JSON response. */
|
|
14890
14911
|
put(url, data, config) {
|
|
14891
14912
|
return this.request({
|
|
14892
14913
|
...config,
|
|
@@ -14895,6 +14916,12 @@ var init_node$4 = __esmMin((() => {
|
|
|
14895
14916
|
method: "PUT"
|
|
14896
14917
|
});
|
|
14897
14918
|
}
|
|
14919
|
+
/**
|
|
14920
|
+
* Resolves and executes a request using native fetch semantics.
|
|
14921
|
+
* @returns Response metadata and parsed JSON, or `null` for an empty body.
|
|
14922
|
+
* @throws {@link FetchClientError} when `validateStatus` rejects the status.
|
|
14923
|
+
* @throws {@link FetchError} for transport or JSON parsing failures.
|
|
14924
|
+
*/
|
|
14898
14925
|
async request(config) {
|
|
14899
14926
|
const merged = {
|
|
14900
14927
|
...this.defaults,
|
|
@@ -14928,9 +14955,11 @@ var init_node$4 = __esmMin((() => {
|
|
|
14928
14955
|
}
|
|
14929
14956
|
};
|
|
14930
14957
|
FetchJsonClient = class _FetchJsonClient extends FetchClient {
|
|
14958
|
+
/** Creates a JSON client with reusable request and compression defaults. */
|
|
14931
14959
|
constructor(config) {
|
|
14932
14960
|
super(config);
|
|
14933
14961
|
}
|
|
14962
|
+
/** Creates a JSON client with the supplied defaults. */
|
|
14934
14963
|
static create(config) {
|
|
14935
14964
|
return new _FetchJsonClient(config);
|
|
14936
14965
|
}
|
|
@@ -14983,7 +15012,7 @@ var init_node$4 = __esmMin((() => {
|
|
|
14983
15012
|
assertError = (value, assert, defaultMessage) => {
|
|
14984
15013
|
if (!isUndefined(assert)) {
|
|
14985
15014
|
const assertString = typeof assert === "string" ? assert : typeof assert === "boolean" ? defaultMessage : assert(value, defaultMessage);
|
|
14986
|
-
if (isString$2(assertString)
|
|
15015
|
+
if (assertString === true || isString$2(assertString)) throw new Error(assertString === true ? defaultMessage : assertString);
|
|
14987
15016
|
}
|
|
14988
15017
|
};
|
|
14989
15018
|
handleError = (error, handler) => {
|
|
@@ -15102,8 +15131,11 @@ var init_node$4 = __esmMin((() => {
|
|
|
15102
15131
|
MIN_GC_FREQUENCY = 1e3;
|
|
15103
15132
|
MIN_HISTORY_INTERVAL = 1e3;
|
|
15104
15133
|
Base = class _Base {
|
|
15134
|
+
/** Process-wide fallback logger used by instances without an explicit logger. */
|
|
15105
15135
|
static defaultLogger;
|
|
15136
|
+
/** Weak references grouped by runtime class name for diagnostic instance counts. */
|
|
15106
15137
|
static globalInstances = {};
|
|
15138
|
+
/** Recorded instance-count samples grouped by runtime class name. */
|
|
15107
15139
|
static globalInstancesCountHistory = {};
|
|
15108
15140
|
static _historyInterval = DEFAULT_HISTORY_INTERVAL;
|
|
15109
15141
|
static _historyTime = DEFAULT_HISTORY_TIME;
|
|
@@ -15111,59 +15143,85 @@ var init_node$4 = __esmMin((() => {
|
|
|
15111
15143
|
static _lastGC = 0;
|
|
15112
15144
|
static _maxGcFrequency = MAX_GC_FREQUENCY;
|
|
15113
15145
|
_params;
|
|
15146
|
+
/**
|
|
15147
|
+
* Stores the shared services and registers a weak reference for instance
|
|
15148
|
+
* diagnostics.
|
|
15149
|
+
* @param params - Logger and telemetry providers plus subclass parameters.
|
|
15150
|
+
*/
|
|
15114
15151
|
constructor(params) {
|
|
15115
15152
|
this._params = params;
|
|
15116
15153
|
params?.logger?.debug(`Base constructed [${this.constructor.name}]`);
|
|
15117
15154
|
this.recordInstance();
|
|
15118
15155
|
}
|
|
15156
|
+
/** Interval between instance-count samples, in milliseconds. */
|
|
15119
15157
|
static get historyInterval() {
|
|
15120
15158
|
return this._historyInterval;
|
|
15121
15159
|
}
|
|
15160
|
+
/**
|
|
15161
|
+
* Sets the sample interval, clamped to at least one second.
|
|
15162
|
+
* @throws When the requested interval exceeds {@link historyTime}.
|
|
15163
|
+
*/
|
|
15122
15164
|
static set historyInterval(value) {
|
|
15123
15165
|
assertEx(value <= this.historyTime, () => `historyInterval [${value}] must be less than or equal to historyTime [${this.historyTime}]`);
|
|
15124
15166
|
this._historyInterval = Math.max(value, MIN_HISTORY_INTERVAL);
|
|
15125
15167
|
}
|
|
15168
|
+
/** Configured retention window for instance-count history, in milliseconds. */
|
|
15126
15169
|
static get historyTime() {
|
|
15127
15170
|
return this._historyTime;
|
|
15128
15171
|
}
|
|
15172
|
+
/**
|
|
15173
|
+
* Applies the requested history-time configuration.
|
|
15174
|
+
* @throws When the requested value is shorter than {@link historyInterval}.
|
|
15175
|
+
*/
|
|
15129
15176
|
static set historyTime(value) {
|
|
15130
15177
|
assertEx(value >= this.historyInterval, () => `historyTime [${value}] must be greater than or equal to historyInterval [${this.historyInterval}]`);
|
|
15131
15178
|
this._historyInterval = value;
|
|
15132
15179
|
}
|
|
15180
|
+
/** Minimum elapsed time between unforced garbage-collection scans. */
|
|
15133
15181
|
static get maxGcFrequency() {
|
|
15134
15182
|
return this._maxGcFrequency;
|
|
15135
15183
|
}
|
|
15184
|
+
/** Sets the scan interval, clamped to at least one second. */
|
|
15136
15185
|
static set maxGcFrequency(value) {
|
|
15137
15186
|
this._maxGcFrequency = Math.max(value, MIN_GC_FREQUENCY);
|
|
15138
15187
|
}
|
|
15188
|
+
/** Maximum number of samples retained for each runtime class. */
|
|
15139
15189
|
static get maxHistoryDepth() {
|
|
15140
15190
|
return Math.floor(this.historyTime / this.historyInterval);
|
|
15141
15191
|
}
|
|
15192
|
+
/** Explicit instance logger or the process-wide default logger. */
|
|
15142
15193
|
get logger() {
|
|
15143
15194
|
return this.params?.logger ?? _Base.defaultLogger;
|
|
15144
15195
|
}
|
|
15196
|
+
/** Meter created lazily from the configured provider for the runtime class. */
|
|
15145
15197
|
get meter() {
|
|
15146
15198
|
return this.params?.meterProvider?.getMeter(this.constructor.name);
|
|
15147
15199
|
}
|
|
15200
|
+
/** Construction parameters retained by this instance. */
|
|
15148
15201
|
get params() {
|
|
15149
15202
|
return this._params;
|
|
15150
15203
|
}
|
|
15204
|
+
/** Tracer created lazily from the configured provider for the runtime class. */
|
|
15151
15205
|
get tracer() {
|
|
15152
15206
|
return this.params?.traceProvider?.getTracer(this.constructor.name);
|
|
15153
15207
|
}
|
|
15208
|
+
/** Implements forced, frequency-limited, or class-specific cleanup. */
|
|
15154
15209
|
static gc(classNameOrForce = false) {
|
|
15155
15210
|
if (typeof classNameOrForce === "string") this.gcClass(classNameOrForce);
|
|
15156
15211
|
else if (classNameOrForce || Date.now() - this._lastGC > this._maxGcFrequency) this.gcAll();
|
|
15157
15212
|
}
|
|
15213
|
+
/** Returns the currently tracked weak-reference count for a runtime class. */
|
|
15158
15214
|
static instanceCount(className) {
|
|
15159
15215
|
return this.globalInstances[className]?.length ?? 0;
|
|
15160
15216
|
}
|
|
15217
|
+
/** Runs eligible cleanup and returns counts for all tracked runtime classes. */
|
|
15161
15218
|
static instanceCounts() {
|
|
15162
15219
|
this.gc();
|
|
15163
15220
|
const result = {};
|
|
15164
15221
|
for (const [className, instances] of Object.entries(this.globalInstances)) result[className] = instances.length;
|
|
15165
15222
|
return result;
|
|
15166
15223
|
}
|
|
15224
|
+
/** Starts periodic instance-count sampling, replacing an existing timer. */
|
|
15167
15225
|
static startHistory() {
|
|
15168
15226
|
if (this._historyTimeout !== void 0) this.stopHistory();
|
|
15169
15227
|
const timeoutHandler = () => {
|
|
@@ -15173,6 +15231,7 @@ var init_node$4 = __esmMin((() => {
|
|
|
15173
15231
|
};
|
|
15174
15232
|
this._historyTimeout = setTimeout(timeoutHandler, this.historyInterval);
|
|
15175
15233
|
}
|
|
15234
|
+
/** Stops periodic instance-count sampling when it is active. */
|
|
15176
15235
|
static stopHistory() {
|
|
15177
15236
|
if (this._historyTimeout === void 0) return;
|
|
15178
15237
|
clearTimeout(this._historyTimeout);
|
|
@@ -15417,8 +15476,13 @@ var init_node$4 = __esmMin((() => {
|
|
|
15417
15476
|
static anyMap = /* @__PURE__ */ new WeakMap();
|
|
15418
15477
|
static eventsMap = /* @__PURE__ */ new WeakMap();
|
|
15419
15478
|
static isGlobalDebugEnabled = false;
|
|
15479
|
+
/** Type-only event map exposed for consumers that need to infer event data. */
|
|
15420
15480
|
eventData = {};
|
|
15421
15481
|
_canEmitMetaEvents = false;
|
|
15482
|
+
/**
|
|
15483
|
+
* Creates isolated named and wildcard listener registries.
|
|
15484
|
+
* @param params - Base services and optional per-instance debug behavior.
|
|
15485
|
+
*/
|
|
15422
15486
|
constructor(params = {}) {
|
|
15423
15487
|
const mutatedParams = { ...params };
|
|
15424
15488
|
if (mutatedParams.debug) mutatedParams.debug.logger ??= (type, debugName, eventName, eventData) => {
|
|
@@ -15444,6 +15508,7 @@ var init_node$4 = __esmMin((() => {
|
|
|
15444
15508
|
const env = processGlobal.process?.env;
|
|
15445
15509
|
return env?.DEBUG === "events" || env?.DEBUG === "*" || this.isGlobalDebugEnabled;
|
|
15446
15510
|
}
|
|
15511
|
+
/** Enables or disables process-wide event debug logging. */
|
|
15447
15512
|
static set isDebugEnabled(newValue) {
|
|
15448
15513
|
this.isGlobalDebugEnabled = newValue;
|
|
15449
15514
|
}
|
|
@@ -15682,8 +15747,10 @@ var init_node$4 = __esmMin((() => {
|
|
|
15682
15747
|
}
|
|
15683
15748
|
};
|
|
15684
15749
|
BaseEmitter = class extends Base {
|
|
15750
|
+
/** Type-only event map exposed for consumers that need to infer event data. */
|
|
15685
15751
|
eventData = {};
|
|
15686
15752
|
events;
|
|
15753
|
+
/** Creates an emitter with an isolated listener registry. */
|
|
15687
15754
|
constructor(params) {
|
|
15688
15755
|
super(params);
|
|
15689
15756
|
this.events = new Events();
|
|
@@ -15770,6 +15837,12 @@ var init_node$4 = __esmMin((() => {
|
|
|
15770
15837
|
defaultParams;
|
|
15771
15838
|
/** Labels identifying resources created by this factory. */
|
|
15772
15839
|
labels;
|
|
15840
|
+
/**
|
|
15841
|
+
* Creates a factory with reusable defaults and merged class labels.
|
|
15842
|
+
* @param creatable - Creatable constructor invoked by {@link create}.
|
|
15843
|
+
* @param params - Default parameters overridden by each create call.
|
|
15844
|
+
* @param labels - Labels merged over any static creatable labels.
|
|
15845
|
+
*/
|
|
15773
15846
|
constructor(creatable2, params, labels = {}) {
|
|
15774
15847
|
this.creatable = creatable2;
|
|
15775
15848
|
this.defaultParams = params;
|
|
@@ -15809,6 +15882,12 @@ var init_node$4 = __esmMin((() => {
|
|
|
15809
15882
|
_status = null;
|
|
15810
15883
|
_statusMutex = new Mutex();
|
|
15811
15884
|
_validatedParams;
|
|
15885
|
+
/**
|
|
15886
|
+
* Constructs an instance for the static creation pipeline.
|
|
15887
|
+
* @param key - Private construction token supplied by {@link create}.
|
|
15888
|
+
* @param params - Unvalidated parameters retained until first access.
|
|
15889
|
+
* @throws When called directly instead of through {@link create}.
|
|
15890
|
+
*/
|
|
15812
15891
|
constructor(key, params) {
|
|
15813
15892
|
assertEx(key === AbstractCreatableConstructorKey, () => "AbstractCreatable should not be instantiated directly, use the static create method instead");
|
|
15814
15893
|
super(params);
|
|
@@ -16054,32 +16133,42 @@ var init_node$4 = __esmMin((() => {
|
|
|
16054
16133
|
trace: 6
|
|
16055
16134
|
});
|
|
16056
16135
|
LevelLogger = class {
|
|
16136
|
+
/** Highest numeric verbosity admitted by this logger. */
|
|
16057
16137
|
level;
|
|
16138
|
+
/** Destination logger receiving admitted messages. */
|
|
16058
16139
|
logger;
|
|
16140
|
+
/** Creates a threshold filter around a destination logger. */
|
|
16059
16141
|
constructor(logger, level = LogLevel.warn) {
|
|
16060
16142
|
this.level = level;
|
|
16061
16143
|
this.logger = logger;
|
|
16062
16144
|
}
|
|
16145
|
+
/** Debug function or a no-op when debug messages exceed the threshold. */
|
|
16063
16146
|
get debug() {
|
|
16064
16147
|
return this.level >= LogLevel.debug ? this.logger.debug : NoOpLogFunction;
|
|
16065
16148
|
}
|
|
16149
|
+
/** Error function or a no-op when errors exceed the threshold. */
|
|
16066
16150
|
get error() {
|
|
16067
16151
|
return this.level >= LogLevel.error ? this.logger.error : NoOpLogFunction;
|
|
16068
16152
|
}
|
|
16153
|
+
/** Info function or a no-op when informational messages exceed the threshold. */
|
|
16069
16154
|
get info() {
|
|
16070
16155
|
return this.level >= LogLevel.info ? this.logger.info : NoOpLogFunction;
|
|
16071
16156
|
}
|
|
16157
|
+
/** General log function or a no-op when it exceeds the threshold. */
|
|
16072
16158
|
get log() {
|
|
16073
16159
|
return this.level >= LogLevel.log ? this.logger.log : NoOpLogFunction;
|
|
16074
16160
|
}
|
|
16161
|
+
/** Trace function or a no-op when trace messages exceed the threshold. */
|
|
16075
16162
|
get trace() {
|
|
16076
16163
|
return this.level >= LogLevel.trace ? this.logger.trace : NoOpLogFunction;
|
|
16077
16164
|
}
|
|
16165
|
+
/** Warning function or a no-op when warnings exceed the threshold. */
|
|
16078
16166
|
get warn() {
|
|
16079
16167
|
return this.level >= LogLevel.warn ? this.logger.warn : NoOpLogFunction;
|
|
16080
16168
|
}
|
|
16081
16169
|
};
|
|
16082
16170
|
ConsoleLogger = class extends LevelLogger {
|
|
16171
|
+
/** Creates a console-backed logger at the selected verbosity threshold. */
|
|
16083
16172
|
constructor(level = LogLevel.warn) {
|
|
16084
16173
|
super(console, level);
|
|
16085
16174
|
}
|
|
@@ -16087,28 +16176,40 @@ var init_node$4 = __esmMin((() => {
|
|
|
16087
16176
|
IdLogger = class {
|
|
16088
16177
|
_id;
|
|
16089
16178
|
_logger;
|
|
16179
|
+
/**
|
|
16180
|
+
* Wraps a logger with an optional lazily evaluated identifier.
|
|
16181
|
+
* @param logger - Destination for all prefixed messages.
|
|
16182
|
+
* @param id - Callback evaluated for each log call.
|
|
16183
|
+
*/
|
|
16090
16184
|
constructor(logger, id) {
|
|
16091
16185
|
this._logger = logger;
|
|
16092
16186
|
this._id = id;
|
|
16093
16187
|
}
|
|
16188
|
+
/** Replaces the identifier callback with a fixed identifier. */
|
|
16094
16189
|
set id(id) {
|
|
16095
16190
|
this._id = () => id;
|
|
16096
16191
|
}
|
|
16192
|
+
/** Forwards a debug message prefixed with the current identifier. */
|
|
16097
16193
|
debug(...data) {
|
|
16098
16194
|
this._logger?.debug(this.prefix(), ...data);
|
|
16099
16195
|
}
|
|
16196
|
+
/** Forwards an error message prefixed with the current identifier. */
|
|
16100
16197
|
error(...data) {
|
|
16101
16198
|
this._logger?.error(this.prefix(), ...data);
|
|
16102
16199
|
}
|
|
16200
|
+
/** Forwards an informational message prefixed with the current identifier. */
|
|
16103
16201
|
info(...data) {
|
|
16104
16202
|
this._logger?.info(this.prefix(), ...data);
|
|
16105
16203
|
}
|
|
16204
|
+
/** Forwards a general log message prefixed with the current identifier. */
|
|
16106
16205
|
log(...data) {
|
|
16107
16206
|
this._logger?.log(this.prefix(), ...data);
|
|
16108
16207
|
}
|
|
16208
|
+
/** Forwards a trace message prefixed with the current identifier. */
|
|
16109
16209
|
trace(...data) {
|
|
16110
16210
|
this._logger?.trace(this.prefix(), ...data);
|
|
16111
16211
|
}
|
|
16212
|
+
/** Forwards a warning prefixed with the current identifier. */
|
|
16112
16213
|
warn(...data) {
|
|
16113
16214
|
this._logger?.warn(this.prefix(), ...data);
|
|
16114
16215
|
}
|
|
@@ -16193,7 +16294,9 @@ var init_node$4 = __esmMin((() => {
|
|
|
16193
16294
|
JsonObjectZod = /* @__PURE__ */ record$2(/* @__PURE__ */ string$4(), JsonValueZod);
|
|
16194
16295
|
isJsonObject = zodIsFactory(JsonObjectZod);
|
|
16195
16296
|
ObjectWrapper = class {
|
|
16297
|
+
/** Wrapped object exposed without copying or freezing. */
|
|
16196
16298
|
obj;
|
|
16299
|
+
/** Retains the supplied object by reference. */
|
|
16197
16300
|
constructor(obj) {
|
|
16198
16301
|
this.obj = obj;
|
|
16199
16302
|
}
|
|
@@ -16258,7 +16361,7 @@ var init_node$4 = __esmMin((() => {
|
|
|
16258
16361
|
return result;
|
|
16259
16362
|
};
|
|
16260
16363
|
toSafeJsonValue = (value, cycleList, maxDepth = 3) => {
|
|
16261
|
-
if (
|
|
16364
|
+
if (typeof value === "object" && maxDepth <= 0) return "[MaxDepth]";
|
|
16262
16365
|
if (cycleList?.includes(value) === true) return "[Circular]";
|
|
16263
16366
|
switch (typeof value) {
|
|
16264
16367
|
case "string":
|
|
@@ -16289,10 +16392,20 @@ var init_node$4 = __esmMin((() => {
|
|
|
16289
16392
|
/** Whether the promise has been cancelled via a value callback. */
|
|
16290
16393
|
cancelled;
|
|
16291
16394
|
_value;
|
|
16395
|
+
/**
|
|
16396
|
+
* Creates a promise with metadata available to cancellation callbacks.
|
|
16397
|
+
* @param func - Standard promise executor.
|
|
16398
|
+
* @param value - Metadata inspected by {@link PromiseEx.then} and {@link PromiseEx.value}.
|
|
16399
|
+
*/
|
|
16292
16400
|
constructor(func, value) {
|
|
16293
16401
|
super(func);
|
|
16294
16402
|
this._value = value;
|
|
16295
16403
|
}
|
|
16404
|
+
/**
|
|
16405
|
+
* Registers settlement callbacks and optionally inspects attached metadata.
|
|
16406
|
+
* Returning true from `onvalue` marks the instance as cancelled but does not
|
|
16407
|
+
* suppress or abort normal promise settlement.
|
|
16408
|
+
*/
|
|
16296
16409
|
then(onfulfilled, onrejected, onvalue) {
|
|
16297
16410
|
if (onvalue?.(this._value) === true) this.cancelled = true;
|
|
16298
16411
|
return super.then(onfulfilled, onrejected);
|
|
@@ -16720,7 +16833,7 @@ var init_base = __esmMin((() => {
|
|
|
16720
16833
|
}));
|
|
16721
16834
|
}));
|
|
16722
16835
|
//#endregion
|
|
16723
|
-
//#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.2.
|
|
16836
|
+
//#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.2.2_@ariestools+sdk@8.1.3_@opentelemetry+api@1.9.1_zod_e3037e945b6aa9d20a93ce0deff04109/node_modules/@xyo-network/sdk-protocol-core/dist/neutral/address.mjs
|
|
16724
16837
|
function encodeQuantAddress(hrp, bytes) {
|
|
16725
16838
|
return bech32m$1.encodeFromBytes(hrp, toUint8Array(bytes));
|
|
16726
16839
|
}
|
|
@@ -16750,7 +16863,7 @@ var init_address$5 = __esmMin((() => {
|
|
|
16750
16863
|
toXyoAddress = zodToFactory(XyoAddressZod, "toXyoAddress");
|
|
16751
16864
|
}));
|
|
16752
16865
|
//#endregion
|
|
16753
|
-
//#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.2.
|
|
16866
|
+
//#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.2.2_@ariestools+sdk@8.1.3_@opentelemetry+api@1.9.1_zod_e3037e945b6aa9d20a93ce0deff04109/node_modules/@xyo-network/sdk-protocol-core/dist/neutral/account-model.mjs
|
|
16754
16867
|
function asSignOptions(value) {
|
|
16755
16868
|
if (value === void 0) return void 0;
|
|
16756
16869
|
return "byteLength" in value ? { previousHash: value } : value;
|
|
@@ -71465,7 +71578,7 @@ var init_lib_esm = __esmMin((() => {
|
|
|
71465
71578
|
init_ethers();
|
|
71466
71579
|
}));
|
|
71467
71580
|
//#endregion
|
|
71468
|
-
//#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.2.
|
|
71581
|
+
//#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.2.2_@ariestools+sdk@8.1.3_@opentelemetry+api@1.9.1_zod_e3037e945b6aa9d20a93ce0deff04109/node_modules/@xyo-network/sdk-protocol-core/dist/neutral/data.mjs
|
|
71469
71582
|
function checkLength(bytes, length) {
|
|
71470
71583
|
assertEx(bytes.byteLength === length, () => `Length Mismatch: ${bytes.byteLength} !== ${length} => ${base16$1.encode(new Uint8Array(bytes))}`);
|
|
71471
71584
|
}
|
|
@@ -71475,9 +71588,11 @@ var init_data = __esmMin((() => {
|
|
|
71475
71588
|
init_base();
|
|
71476
71589
|
init_lib_esm();
|
|
71477
71590
|
AbstractData = class {
|
|
71591
|
+
/** Type guard for {@link AbstractData} instances. */
|
|
71478
71592
|
static is(value) {
|
|
71479
71593
|
return value instanceof this;
|
|
71480
71594
|
}
|
|
71595
|
+
/** Byte length of the underlying buffer. */
|
|
71481
71596
|
get length() {
|
|
71482
71597
|
return this.bytes.byteLength;
|
|
71483
71598
|
}
|
|
@@ -71485,25 +71600,38 @@ var init_data = __esmMin((() => {
|
|
|
71485
71600
|
Data = class _Data extends AbstractData {
|
|
71486
71601
|
_bytes;
|
|
71487
71602
|
_length;
|
|
71603
|
+
/**
|
|
71604
|
+
* @param length - Expected byte length (asserted on encode views)
|
|
71605
|
+
* @param bytes - Optional initial bytes
|
|
71606
|
+
* @param base - Optional radix when parsing string-like input via `toUint8Array`
|
|
71607
|
+
*/
|
|
71488
71608
|
constructor(length, bytes, base) {
|
|
71489
71609
|
super();
|
|
71490
71610
|
this._bytes = toUint8Array(bytes, length, base)?.buffer;
|
|
71491
71611
|
this._length = length;
|
|
71492
71612
|
}
|
|
71613
|
+
/**
|
|
71614
|
+
* Wrap an ArrayBuffer as {@link Data}, or return `undefined` when `data` is missing.
|
|
71615
|
+
* @param data - Source buffer
|
|
71616
|
+
*/
|
|
71493
71617
|
static from(data) {
|
|
71494
71618
|
return data ? new _Data(data.byteLength, data) : void 0;
|
|
71495
71619
|
}
|
|
71620
|
+
/** Base58 encoding of the bytes (asserts configured length). */
|
|
71496
71621
|
get base58() {
|
|
71497
71622
|
checkLength(this.bytes, this._length);
|
|
71498
71623
|
return base58$1.encode(new Uint8Array(this.bytes));
|
|
71499
71624
|
}
|
|
71625
|
+
/** Underlying byte buffer (throws if uninitialized). */
|
|
71500
71626
|
get bytes() {
|
|
71501
71627
|
return assertEx(this._bytes, () => "Data uninitialized");
|
|
71502
71628
|
}
|
|
71629
|
+
/** Lowercase hex encoding of the bytes (asserts configured length). */
|
|
71503
71630
|
get hex() {
|
|
71504
71631
|
checkLength(this.bytes, this._length);
|
|
71505
71632
|
return base16$1.encode(new Uint8Array(this.bytes)).toLowerCase();
|
|
71506
71633
|
}
|
|
71634
|
+
/** Keccak-256 digest of the bytes (asserts configured length). */
|
|
71507
71635
|
get keccak256() {
|
|
71508
71636
|
checkLength(this.bytes, this._length);
|
|
71509
71637
|
return toArrayBuffer(keccak256(new Uint8Array(this.bytes)));
|
|
@@ -71511,7 +71639,7 @@ var init_data = __esmMin((() => {
|
|
|
71511
71639
|
};
|
|
71512
71640
|
}));
|
|
71513
71641
|
//#endregion
|
|
71514
|
-
//#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.2.
|
|
71642
|
+
//#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.2.2_@ariestools+sdk@8.1.3_@opentelemetry+api@1.9.1_zod_e3037e945b6aa9d20a93ce0deff04109/node_modules/@xyo-network/sdk-protocol-core/dist/neutral/wasm.mjs
|
|
71515
71643
|
var validate$3, bigInt, bulkMemory, exceptions, extendedConst, gc, memory64, multiValue, mutableGlobals, relaxedSimd, saturatedFloatToInt, signExtensions, simd, streamingCompilation, tailCall, threads, WasmFeatureDetectors, WasmSupport;
|
|
71516
71644
|
var init_wasm = __esmMin((() => {
|
|
71517
71645
|
init_node$4();
|
|
@@ -72101,7 +72229,7 @@ var init_wasm = __esmMin((() => {
|
|
|
72101
72229
|
};
|
|
72102
72230
|
}));
|
|
72103
72231
|
//#endregion
|
|
72104
|
-
//#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.2.
|
|
72232
|
+
//#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.2.2_@ariestools+sdk@8.1.3_@opentelemetry+api@1.9.1_zod_e3037e945b6aa9d20a93ce0deff04109/node_modules/@xyo-network/sdk-protocol-core/dist/neutral/elliptic.mjs
|
|
72105
72233
|
function compareArrayBuffers(b1, b2) {
|
|
72106
72234
|
if (b1.byteLength !== b2.byteLength) return false;
|
|
72107
72235
|
const a1 = new Uint8Array(b1);
|
|
@@ -72131,15 +72259,36 @@ var init_elliptic = __esmMin((async () => {
|
|
|
72131
72259
|
3
|
|
72132
72260
|
];
|
|
72133
72261
|
Elliptic = class {
|
|
72262
|
+
/** WebAssembly feature probe used before instantiating secp256k1. */
|
|
72134
72263
|
static wasmSupport = wasmSupportStatic$1;
|
|
72135
72264
|
static _secp256k1;
|
|
72136
72265
|
static _secp256k1Mutex = new Mutex();
|
|
72266
|
+
/**
|
|
72267
|
+
* Derives a 20-byte eth-style address from a 64-byte uncompressed public key
|
|
72268
|
+
* (keccak256 of the key, last 20 bytes).
|
|
72269
|
+
*
|
|
72270
|
+
* @param key - 64-byte public key (no 0x04 prefix)
|
|
72271
|
+
* @returns 20-byte address buffer
|
|
72272
|
+
*/
|
|
72137
72273
|
static addressFromPublicKey(key) {
|
|
72138
72274
|
return new Data(64, key).keccak256.slice(12);
|
|
72139
72275
|
}
|
|
72276
|
+
/**
|
|
72277
|
+
* Ensures the secp256k1 WebAssembly module is loaded.
|
|
72278
|
+
*
|
|
72279
|
+
* @returns Initialized secp256k1 instance
|
|
72280
|
+
*/
|
|
72140
72281
|
static initialize() {
|
|
72141
72282
|
return this.secp256k1();
|
|
72142
72283
|
}
|
|
72284
|
+
/**
|
|
72285
|
+
* Derives an uncompressed secp256k1 public key from a private key.
|
|
72286
|
+
*
|
|
72287
|
+
* @param privateKey - 32-byte private key
|
|
72288
|
+
* @param prefix - When `true`, include the leading 0x04 byte
|
|
72289
|
+
* @returns Public key bytes (64 or 65 bytes depending on `prefix`)
|
|
72290
|
+
* @throws If the private key is zero
|
|
72291
|
+
*/
|
|
72143
72292
|
static async publicKeyFromPrivateKey(privateKey, prefix = false) {
|
|
72144
72293
|
const { derivePublicKeyUncompressed } = await this.secp256k1();
|
|
72145
72294
|
if (BigInt(toHex(privateKey, { prefix: true })) === 0n) throw new Error(`Invalid private key [${toHex(privateKey)}]`);
|
|
@@ -72147,9 +72296,20 @@ var init_elliptic = __esmMin((async () => {
|
|
|
72147
72296
|
const fullPublicKey = typeof derivedPublicKey === "string" ? toUint8Array(derivedPublicKey) : derivedPublicKey;
|
|
72148
72297
|
return (prefix ? fullPublicKey : fullPublicKey.slice(1)).buffer;
|
|
72149
72298
|
}
|
|
72299
|
+
/**
|
|
72300
|
+
* Whether the secp256k1 WebAssembly module has already been instantiated.
|
|
72301
|
+
*
|
|
72302
|
+
* @returns `true` if ready for sign/verify without re-init wait
|
|
72303
|
+
*/
|
|
72150
72304
|
static ready() {
|
|
72151
72305
|
return !!this._secp256k1;
|
|
72152
72306
|
}
|
|
72307
|
+
/**
|
|
72308
|
+
* Lazily instantiates and caches the secp256k1 WebAssembly module (mutex-guarded).
|
|
72309
|
+
*
|
|
72310
|
+
* @returns Shared secp256k1 instance
|
|
72311
|
+
* @throws If WebAssembly is unavailable
|
|
72312
|
+
*/
|
|
72153
72313
|
static async secp256k1() {
|
|
72154
72314
|
return await this._secp256k1Mutex.runExclusive(async () => {
|
|
72155
72315
|
if (this._secp256k1) return this._secp256k1;
|
|
@@ -72159,11 +72319,29 @@ var init_elliptic = __esmMin((async () => {
|
|
|
72159
72319
|
return secp256k1;
|
|
72160
72320
|
});
|
|
72161
72321
|
}
|
|
72322
|
+
/**
|
|
72323
|
+
* Creates a compact secp256k1 signature over a message hash.
|
|
72324
|
+
*
|
|
72325
|
+
* @param hash - 32-byte message hash
|
|
72326
|
+
* @param key - 32-byte private key
|
|
72327
|
+
* @returns Compact signature bytes
|
|
72328
|
+
*/
|
|
72162
72329
|
static async sign(hash, key) {
|
|
72163
72330
|
const { signMessageHashCompact } = await this.secp256k1();
|
|
72164
72331
|
const signature = signMessageHashCompact(new Uint8Array(key), toUint8Array(hash));
|
|
72165
72332
|
return (typeof signature === "string" ? toUint8Array(signature) : signature).buffer;
|
|
72166
72333
|
}
|
|
72334
|
+
/**
|
|
72335
|
+
* Verifies a compact signature by recovering the public key and comparing addresses.
|
|
72336
|
+
*
|
|
72337
|
+
* Tries recovery IDs 0–3 against the expected 20-byte address.
|
|
72338
|
+
*
|
|
72339
|
+
* @param msg - Message hash that was signed
|
|
72340
|
+
* @param signature - Compact signature bytes
|
|
72341
|
+
* @param address - Expected 20-byte address
|
|
72342
|
+
* @returns `true` if any recovery id yields the expected address
|
|
72343
|
+
* @throws If WebAssembly cannot be used
|
|
72344
|
+
*/
|
|
72167
72345
|
static async verify(msg, signature, address) {
|
|
72168
72346
|
const verifier = await this.secp256k1();
|
|
72169
72347
|
if (this.wasmSupport.canUseWasm) {
|
|
@@ -72184,7 +72362,7 @@ var init_elliptic = __esmMin((async () => {
|
|
|
72184
72362
|
};
|
|
72185
72363
|
}));
|
|
72186
72364
|
//#endregion
|
|
72187
|
-
//#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.2.
|
|
72365
|
+
//#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.2.2_@ariestools+sdk@8.1.3_@opentelemetry+api@1.9.1_zod_e3037e945b6aa9d20a93ce0deff04109/node_modules/@xyo-network/sdk-protocol-core/dist/neutral/account.mjs
|
|
72188
72366
|
function base64urlEncode(bytes) {
|
|
72189
72367
|
return base64urlnopad$1.encode(bytes);
|
|
72190
72368
|
}
|
|
@@ -72362,18 +72540,45 @@ var init_account = __esmMin((async () => {
|
|
|
72362
72540
|
EllipticKey = class extends Data {};
|
|
72363
72541
|
AddressValue = class extends EllipticKey {
|
|
72364
72542
|
_isAddress = true;
|
|
72543
|
+
/**
|
|
72544
|
+
* @param address - 20-byte address or 64-byte public key bytes
|
|
72545
|
+
*/
|
|
72365
72546
|
constructor(address) {
|
|
72366
72547
|
super(20, AddressValue.addressFromAddressOrPublicKey(address));
|
|
72367
72548
|
}
|
|
72549
|
+
/**
|
|
72550
|
+
* Returns address bytes if already 20 bytes; otherwise derives from public key.
|
|
72551
|
+
*
|
|
72552
|
+
* @param bytes - Address or public-key bytes
|
|
72553
|
+
* @returns 20-byte address buffer
|
|
72554
|
+
*/
|
|
72368
72555
|
static addressFromAddressOrPublicKey(bytes) {
|
|
72369
72556
|
return bytes.byteLength === 20 ? bytes : this.addressFromPublicKey(bytes);
|
|
72370
72557
|
}
|
|
72558
|
+
/**
|
|
72559
|
+
* Derives a 20-byte address from a 64-byte uncompressed secp256k1 public key
|
|
72560
|
+
* (keccak256 of the key, last 20 bytes).
|
|
72561
|
+
*
|
|
72562
|
+
* @param key - 64-byte public key (no 0x04 prefix)
|
|
72563
|
+
* @returns 20-byte address buffer
|
|
72564
|
+
*/
|
|
72371
72565
|
static addressFromPublicKey(key) {
|
|
72372
72566
|
return new Data(64, key).keccak256.slice(12);
|
|
72373
72567
|
}
|
|
72568
|
+
/**
|
|
72569
|
+
* Ensures the secp256k1 WebAssembly backend is ready.
|
|
72570
|
+
*
|
|
72571
|
+
* @returns `true` when the elliptic module initialized successfully
|
|
72572
|
+
*/
|
|
72374
72573
|
static async initialize() {
|
|
72375
72574
|
return isDefined(await Elliptic.secp256k1());
|
|
72376
72575
|
}
|
|
72576
|
+
/**
|
|
72577
|
+
* Type guard for {@link AddressValue} instances.
|
|
72578
|
+
*
|
|
72579
|
+
* @param value - Value to test
|
|
72580
|
+
* @returns `true` if `value` is an AddressValue
|
|
72581
|
+
*/
|
|
72377
72582
|
static isAddress(value) {
|
|
72378
72583
|
return value._isAddress;
|
|
72379
72584
|
}
|
|
@@ -72389,19 +72594,45 @@ var init_account = __esmMin((async () => {
|
|
|
72389
72594
|
const addressValue = new AddressValue(address);
|
|
72390
72595
|
this._address = addressValue;
|
|
72391
72596
|
}
|
|
72597
|
+
/**
|
|
72598
|
+
* Creates a public key from 64-byte uncompressed key material.
|
|
72599
|
+
*
|
|
72600
|
+
* @param bytes - 64-byte public key (no 0x04 prefix)
|
|
72601
|
+
* @returns New public key instance
|
|
72602
|
+
*/
|
|
72392
72603
|
static async create(bytes) {
|
|
72393
|
-
return
|
|
72604
|
+
return new PublicKey(this.privateConstructorKey, bytes);
|
|
72394
72605
|
}
|
|
72606
|
+
/**
|
|
72607
|
+
* Derives a public key from a 32-byte private key.
|
|
72608
|
+
*
|
|
72609
|
+
* @param bytes - Private key as buffer or bigint
|
|
72610
|
+
* @returns Public key instance for the private key
|
|
72611
|
+
*/
|
|
72395
72612
|
static async fromPrivate(bytes) {
|
|
72396
72613
|
const publicKey = await Elliptic.publicKeyFromPrivateKey(toArrayBuffer(bytes));
|
|
72397
72614
|
return new PublicKey(this.privateConstructorKey, publicKey);
|
|
72398
72615
|
}
|
|
72616
|
+
/**
|
|
72617
|
+
* Type guard for {@link PublicKey} instances.
|
|
72618
|
+
*
|
|
72619
|
+
* @param value - Value to test
|
|
72620
|
+
* @returns `true` if `value` is a PublicKey
|
|
72621
|
+
*/
|
|
72399
72622
|
static isPublicKey(value) {
|
|
72400
72623
|
return value._isPublicKey;
|
|
72401
72624
|
}
|
|
72625
|
+
/** 20-byte address derived from this public key. */
|
|
72402
72626
|
get address() {
|
|
72403
72627
|
return this._address;
|
|
72404
72628
|
}
|
|
72629
|
+
/**
|
|
72630
|
+
* Verifies a signature recovers to this public key's address.
|
|
72631
|
+
*
|
|
72632
|
+
* @param msg - Message hash that was signed
|
|
72633
|
+
* @param signature - Compact signature bytes
|
|
72634
|
+
* @returns `true` if verification succeeds
|
|
72635
|
+
*/
|
|
72405
72636
|
async verify(msg, signature) {
|
|
72406
72637
|
return await Elliptic.verify(msg, signature, this.address.bytes);
|
|
72407
72638
|
}
|
|
@@ -72416,18 +72647,44 @@ var init_account = __esmMin((async () => {
|
|
|
72416
72647
|
super(32, value);
|
|
72417
72648
|
this._public = publicKey;
|
|
72418
72649
|
}
|
|
72650
|
+
/**
|
|
72651
|
+
* Creates a private key and derives its matching public key.
|
|
72652
|
+
*
|
|
72653
|
+
* @param value - 32-byte private key as buffer or bigint
|
|
72654
|
+
* @returns New private key instance
|
|
72655
|
+
*/
|
|
72419
72656
|
static async create(value) {
|
|
72420
72657
|
return new PrivateKey(this.privateConstructorKey, toArrayBuffer(value), await PublicKey.fromPrivate(value));
|
|
72421
72658
|
}
|
|
72659
|
+
/**
|
|
72660
|
+
* Type guard for {@link PrivateKey} instances.
|
|
72661
|
+
*
|
|
72662
|
+
* @param value - Value to test
|
|
72663
|
+
* @returns `true` if `value` is a PrivateKey
|
|
72664
|
+
*/
|
|
72422
72665
|
static isPrivateKey(value) {
|
|
72423
72666
|
return value._isPrivateKey;
|
|
72424
72667
|
}
|
|
72668
|
+
/** Public key corresponding to this private key. */
|
|
72425
72669
|
get public() {
|
|
72426
72670
|
return this._public;
|
|
72427
72671
|
}
|
|
72672
|
+
/**
|
|
72673
|
+
* Signs a message hash with this private key (compact secp256k1 signature).
|
|
72674
|
+
*
|
|
72675
|
+
* @param hash - 32-byte message hash
|
|
72676
|
+
* @returns Compact signature bytes
|
|
72677
|
+
*/
|
|
72428
72678
|
async sign(hash) {
|
|
72429
72679
|
return await Elliptic.sign(hash, this.bytes);
|
|
72430
72680
|
}
|
|
72681
|
+
/**
|
|
72682
|
+
* Verifies a signature against this key's derived address.
|
|
72683
|
+
*
|
|
72684
|
+
* @param msg - Message hash that was signed
|
|
72685
|
+
* @param signature - Compact signature bytes
|
|
72686
|
+
* @returns `true` if verification succeeds
|
|
72687
|
+
*/
|
|
72431
72688
|
async verify(msg, signature) {
|
|
72432
72689
|
return await Elliptic.verify(msg, signature, this.public.address.bytes);
|
|
72433
72690
|
}
|
|
@@ -72439,6 +72696,7 @@ var init_account = __esmMin((async () => {
|
|
|
72439
72696
|
_signingMutex = new Mutex();
|
|
72440
72697
|
_node = void 0;
|
|
72441
72698
|
_previousHash;
|
|
72699
|
+
/** Signing algorithm for this account (`secp256k1`). */
|
|
72442
72700
|
algorithm = "secp256k1";
|
|
72443
72701
|
constructor(key, privateKey, node) {
|
|
72444
72702
|
assertEx(key === Account._protectedConstructorKey, () => "Do not call this protected constructor");
|
|
@@ -72446,6 +72704,15 @@ var init_account = __esmMin((async () => {
|
|
|
72446
72704
|
this._privateKey = privateKey;
|
|
72447
72705
|
this._node = node;
|
|
72448
72706
|
}
|
|
72707
|
+
/**
|
|
72708
|
+
* Creates an account from phrase, mnemonic, private key, or random entropy.
|
|
72709
|
+
*
|
|
72710
|
+
* Deduplicates by address so only one live instance exists per address, then
|
|
72711
|
+
* loads any configured previous-hash state.
|
|
72712
|
+
*
|
|
72713
|
+
* @param opts - Optional initialization config (phrase, mnemonic, privateKey, previousHash)
|
|
72714
|
+
* @returns A unique {@link AccountInstance} for the derived address
|
|
72715
|
+
*/
|
|
72449
72716
|
static async create(opts) {
|
|
72450
72717
|
let privateKeyToUse;
|
|
72451
72718
|
let node;
|
|
@@ -72461,43 +72728,93 @@ var init_account = __esmMin((async () => {
|
|
|
72461
72728
|
const privateKey = await PrivateKey.create(privateKeyToUse.buffer);
|
|
72462
72729
|
return await new Account(this._protectedConstructorKey, privateKey, node).verifyUniqueAddress().loadPreviousHash(opts?.previousHash);
|
|
72463
72730
|
}
|
|
72731
|
+
/**
|
|
72732
|
+
* Decodes a JWT into its header, payload, and signature parts without verifying.
|
|
72733
|
+
*
|
|
72734
|
+
* @param token - Compact JWS string (`header.payload.signature`)
|
|
72735
|
+
* @returns Parsed JWT parts
|
|
72736
|
+
*/
|
|
72464
72737
|
static decodeJwt(token) {
|
|
72465
72738
|
return decodeJwt(token);
|
|
72466
72739
|
}
|
|
72740
|
+
/**
|
|
72741
|
+
* Creates an account from a raw 32-byte private key.
|
|
72742
|
+
*
|
|
72743
|
+
* @param key - Private key as buffer, bigint, or hex string
|
|
72744
|
+
* @returns Account instance for the derived secp256k1 address
|
|
72745
|
+
*/
|
|
72467
72746
|
static async fromPrivateKey(key) {
|
|
72468
72747
|
const privateKey = toUint8Array(key, 32)?.buffer;
|
|
72469
72748
|
return await this.create({ privateKey });
|
|
72470
72749
|
}
|
|
72750
|
+
/**
|
|
72751
|
+
* Returns whether the address looks like a 20-byte (40-hex) legacy secp256k1 address.
|
|
72752
|
+
*
|
|
72753
|
+
* @param address - Candidate XYO address
|
|
72754
|
+
* @returns `true` if the address is 40 hex characters
|
|
72755
|
+
*/
|
|
72471
72756
|
static isAddress(address) {
|
|
72472
72757
|
return address.length === 40;
|
|
72473
72758
|
}
|
|
72759
|
+
/**
|
|
72760
|
+
* Creates an account with a cryptographically random private key.
|
|
72761
|
+
*
|
|
72762
|
+
* @returns Fresh random account instance
|
|
72763
|
+
*/
|
|
72474
72764
|
static async random() {
|
|
72475
72765
|
return await this.create();
|
|
72476
72766
|
}
|
|
72767
|
+
/**
|
|
72768
|
+
* Verifies an ES256K JWT (structure, claims, and secp256k1 signature).
|
|
72769
|
+
*
|
|
72770
|
+
* @param token - Compact JWS string to verify
|
|
72771
|
+
* @param options - Optional audience, clock, and claim checks
|
|
72772
|
+
* @returns Verification result with header/payload and failure reasons
|
|
72773
|
+
*/
|
|
72477
72774
|
static async verifyJwt(token, options) {
|
|
72478
72775
|
return await verifyJwt(token, options);
|
|
72479
72776
|
}
|
|
72777
|
+
/** 20-byte eth-style address as lowercase hex (no `0x` prefix). */
|
|
72480
72778
|
get address() {
|
|
72481
72779
|
return asAddress(this.public.address.hex, true);
|
|
72482
72780
|
}
|
|
72781
|
+
/** Raw 20-byte address bytes. */
|
|
72483
72782
|
get addressBytes() {
|
|
72484
72783
|
return this.public.address.bytes;
|
|
72485
72784
|
}
|
|
72785
|
+
/** Previous-hash anti-replay value as lowercase hex, or `undefined` if unset. */
|
|
72486
72786
|
get previousHash() {
|
|
72487
72787
|
return this.previousHashBytes ? toHex(this.previousHashBytes, { prefix: false }).toLowerCase() : void 0;
|
|
72488
72788
|
}
|
|
72789
|
+
/** Previous-hash anti-replay value as raw bytes, or `undefined` if unset. */
|
|
72489
72790
|
get previousHashBytes() {
|
|
72490
72791
|
return this._previousHash;
|
|
72491
72792
|
}
|
|
72793
|
+
/** secp256k1 private key for this account. */
|
|
72492
72794
|
get private() {
|
|
72493
72795
|
return this._privateKey;
|
|
72494
72796
|
}
|
|
72797
|
+
/** secp256k1 public key derived from the private key. */
|
|
72495
72798
|
get public() {
|
|
72496
72799
|
return this.private.public;
|
|
72497
72800
|
}
|
|
72801
|
+
/**
|
|
72802
|
+
* Hook for deferred initialization of public key and address material.
|
|
72803
|
+
*
|
|
72804
|
+
* @returns This instance (currently a no-op)
|
|
72805
|
+
*/
|
|
72498
72806
|
async initialize() {
|
|
72499
|
-
return
|
|
72807
|
+
return this;
|
|
72500
72808
|
}
|
|
72809
|
+
/**
|
|
72810
|
+
* Loads the previous-hash chain state from the given value or the shared store.
|
|
72811
|
+
*
|
|
72812
|
+
* When `previousHash` is provided it is written through to the store so an
|
|
72813
|
+
* empty store cannot later clobber the explicit value at sign time.
|
|
72814
|
+
*
|
|
72815
|
+
* @param previousHash - Optional explicit previous hash (buffer or hex)
|
|
72816
|
+
* @returns This instance with chain state applied
|
|
72817
|
+
*/
|
|
72501
72818
|
async loadPreviousHash(previousHash) {
|
|
72502
72819
|
return await this._signingMutex.runExclusive(async () => {
|
|
72503
72820
|
if (isDefined(previousHash)) {
|
|
@@ -72538,13 +72855,31 @@ var init_account = __esmMin((async () => {
|
|
|
72538
72855
|
return [signature, currentPreviousHash];
|
|
72539
72856
|
});
|
|
72540
72857
|
}
|
|
72858
|
+
/**
|
|
72859
|
+
* Creates and signs an ES256K JWT with this account (detached, non-chained).
|
|
72860
|
+
*
|
|
72861
|
+
* @param options - Audience, TTL/exp, and optional custom claims
|
|
72862
|
+
* @returns Compact token plus parsed header and payload
|
|
72863
|
+
*/
|
|
72541
72864
|
async signJwt(options) {
|
|
72542
72865
|
return await createJwt$2(this, options);
|
|
72543
72866
|
}
|
|
72867
|
+
/**
|
|
72868
|
+
* Verifies a secp256k1 signature against this account's address.
|
|
72869
|
+
*
|
|
72870
|
+
* @param msg - Message hash that was signed
|
|
72871
|
+
* @param signature - Compact secp256k1 signature bytes
|
|
72872
|
+
* @returns `true` if the signature recovers to this account's address
|
|
72873
|
+
*/
|
|
72544
72874
|
async verify(msg, signature) {
|
|
72545
72875
|
await Elliptic.initialize();
|
|
72546
72876
|
return await Elliptic.verify(msg, signature, this.addressBytes);
|
|
72547
72877
|
}
|
|
72878
|
+
/**
|
|
72879
|
+
* Ensures only one live account instance exists per address.
|
|
72880
|
+
*
|
|
72881
|
+
* @returns This instance if first for the address, otherwise the cached instance
|
|
72882
|
+
*/
|
|
72548
72883
|
verifyUniqueAddress() {
|
|
72549
72884
|
const address = this.address;
|
|
72550
72885
|
const currentAddressObject = Account._addressMap[address]?.deref();
|
|
@@ -72553,29 +72888,31 @@ var init_account = __esmMin((async () => {
|
|
|
72553
72888
|
return this;
|
|
72554
72889
|
}
|
|
72555
72890
|
};
|
|
72891
|
+
/** Shared store for previous-hash anti-replay values, keyed by address. */
|
|
72556
72892
|
__publicField$19(Account, "previousHashStore");
|
|
72893
|
+
/** Globally unique class identifier for this account implementation. */
|
|
72557
72894
|
__publicField$19(Account, "uniqueName", globallyUnique("Account", Account, "xyo"));
|
|
72558
72895
|
__publicField$19(Account, "_addressMap", {});
|
|
72559
72896
|
__publicField$19(Account, "_protectedConstructorKey", /* @__PURE__ */ Symbol());
|
|
72560
72897
|
Account = __decorateClass$20([staticImplements()], Account);
|
|
72561
72898
|
}));
|
|
72562
72899
|
//#endregion
|
|
72563
|
-
//#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.2.
|
|
72900
|
+
//#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.2.2_@ariestools+sdk@8.1.3_@opentelemetry+api@1.9.1_zod_e3037e945b6aa9d20a93ce0deff04109/node_modules/@xyo-network/sdk-protocol-core/dist/neutral/huri.mjs
|
|
72564
72901
|
var init_huri = __esmMin((async () => {
|
|
72565
72902
|
init_node$4();
|
|
72566
72903
|
await init_account();
|
|
72567
72904
|
}));
|
|
72568
72905
|
//#endregion
|
|
72569
|
-
//#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.2.
|
|
72906
|
+
//#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.2.2_@ariestools+sdk@8.1.3_@opentelemetry+api@1.9.1_zod_e3037e945b6aa9d20a93ce0deff04109/node_modules/@xyo-network/sdk-protocol-core/dist/neutral/api.mjs
|
|
72570
72907
|
var init_api = __esmMin((async () => {
|
|
72571
72908
|
await init_huri();
|
|
72572
72909
|
init_node$4();
|
|
72573
72910
|
}));
|
|
72574
72911
|
//#endregion
|
|
72575
|
-
//#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.2.
|
|
72912
|
+
//#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.2.2_@ariestools+sdk@8.1.3_@opentelemetry+api@1.9.1_zod_e3037e945b6aa9d20a93ce0deff04109/node_modules/@xyo-network/sdk-protocol-core/dist/neutral/api-models.mjs
|
|
72576
72913
|
var init_api_models = __esmMin((() => {}));
|
|
72577
72914
|
//#endregion
|
|
72578
|
-
//#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.2.
|
|
72915
|
+
//#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.2.2_@ariestools+sdk@8.1.3_@opentelemetry+api@1.9.1_zod_e3037e945b6aa9d20a93ce0deff04109/node_modules/@xyo-network/sdk-protocol-core/dist/neutral/payload-model.mjs
|
|
72579
72916
|
function WithStorageMetaZod(valueZod) {
|
|
72580
72917
|
return /* @__PURE__ */ object$4({
|
|
72581
72918
|
...valueZod.shape,
|
|
@@ -72687,11 +73024,22 @@ var init_payload_model = __esmMin((() => {
|
|
|
72687
73024
|
assertEx(isSequence(hexString), () => `Invalid sequence [${hexString}] [${epoch}, ${nonce}, ${addressHex}]`);
|
|
72688
73025
|
return this.create(hexString);
|
|
72689
73026
|
}
|
|
73027
|
+
/**
|
|
73028
|
+
* Parses a hex string, string, or buffer as a sequence.
|
|
73029
|
+
* @param value - Sequence bytes as hex or ArrayBuffer-like
|
|
73030
|
+
* @returns Parser over the sequence
|
|
73031
|
+
* @throws If the value is not a valid local or qualified sequence
|
|
73032
|
+
*/
|
|
72690
73033
|
static parse(value) {
|
|
72691
73034
|
const hex = toHex(value);
|
|
72692
73035
|
if (isSequence(hex)) return this.create(hex);
|
|
72693
73036
|
throw new Error(`Invalid sequence [${hex}]`);
|
|
72694
73037
|
}
|
|
73038
|
+
/**
|
|
73039
|
+
* Converts a short number/hex to an epoch, or extracts the epoch from a sequence.
|
|
73040
|
+
* @param value - Timestamp, hex, epoch, or sequence
|
|
73041
|
+
* @returns Epoch component
|
|
73042
|
+
*/
|
|
72695
73043
|
static toEpoch(value) {
|
|
72696
73044
|
assertEx(typeof value !== "number" || Number.isSafeInteger(value), () => "Value must be in integer");
|
|
72697
73045
|
const hex = toHex(value, { prefix: false });
|
|
@@ -72702,6 +73050,12 @@ var init_payload_model = __esmMin((() => {
|
|
|
72702
73050
|
if (isSequence(hex)) return hex.slice(0, SequenceConstants.epochBytes * 2);
|
|
72703
73051
|
throw new Error(`Value could not be converted to epoch [${hex}]`);
|
|
72704
73052
|
}
|
|
73053
|
+
/**
|
|
73054
|
+
* Converts a hash/hex to a nonce (optionally with index), or extracts the nonce from a sequence.
|
|
73055
|
+
* @param value - Hash, hex, or sequence to derive the nonce from
|
|
73056
|
+
* @param index - Nonce index component (default 0)
|
|
73057
|
+
* @returns Nonce component
|
|
73058
|
+
*/
|
|
72705
73059
|
static toNonce(value, index = 0) {
|
|
72706
73060
|
assertEx(typeof value !== "number" || Number.isSafeInteger(value), () => "Value must be in integer");
|
|
72707
73061
|
const hex = toHex(value, { prefix: false });
|
|
@@ -72718,26 +73072,31 @@ var init_payload_model = __esmMin((() => {
|
|
|
72718
73072
|
static create(hex) {
|
|
72719
73073
|
return new _SequenceParser(this.privateConstructorKey, hex);
|
|
72720
73074
|
}
|
|
73075
|
+
/** Address component of a qualified sequence (zeroes when local-only) */
|
|
72721
73076
|
get address() {
|
|
72722
73077
|
const start = SequenceConstants.localSequenceBytes;
|
|
72723
73078
|
const end = SequenceConstants.qualifiedSequenceBytes;
|
|
72724
73079
|
return toAddress(this.data.slice(start, end).buffer, { prefix: false });
|
|
72725
73080
|
}
|
|
73081
|
+
/** Epoch component of the sequence */
|
|
72726
73082
|
get epoch() {
|
|
72727
73083
|
const start = 0;
|
|
72728
73084
|
const end = SequenceConstants.epochBytes;
|
|
72729
73085
|
return toHex(this.data.slice(start, end).buffer, { prefix: false });
|
|
72730
73086
|
}
|
|
73087
|
+
/** Local sequence (epoch + nonce) without address */
|
|
72731
73088
|
get localSequence() {
|
|
72732
73089
|
const start = 0;
|
|
72733
73090
|
const end = SequenceConstants.localSequenceBytes;
|
|
72734
73091
|
return toHex(this.data.slice(start, end).buffer, { prefix: false });
|
|
72735
73092
|
}
|
|
73093
|
+
/** Nonce component of the sequence */
|
|
72736
73094
|
get nonce() {
|
|
72737
73095
|
const start = SequenceConstants.epochBytes;
|
|
72738
73096
|
const end = SequenceConstants.localSequenceBytes;
|
|
72739
73097
|
return toHex(this.data.slice(start, end).buffer, { prefix: false });
|
|
72740
73098
|
}
|
|
73099
|
+
/** Qualified sequence (local + address), padded with zero address if local-only */
|
|
72741
73100
|
get qualifiedSequence() {
|
|
72742
73101
|
const start = 0;
|
|
72743
73102
|
const end = SequenceConstants.qualifiedSequenceBytes;
|
|
@@ -72815,13 +73174,13 @@ var init_payload_model = __esmMin((() => {
|
|
|
72815
73174
|
/* @__PURE__ */ literal$2("year")
|
|
72816
73175
|
]);
|
|
72817
73176
|
QueryFieldsZod = /* @__PURE__ */ object$4({
|
|
72818
|
-
/**
|
|
73177
|
+
/** The addresses of the intended handlers */
|
|
72819
73178
|
address: /* @__PURE__ */ optional$2(queryAddressZod),
|
|
72820
|
-
/**
|
|
73179
|
+
/** The maximum XYO that can be spent executing the query */
|
|
72821
73180
|
budget: /* @__PURE__ */ optional$2(/* @__PURE__ */ number$5()),
|
|
72822
|
-
/**
|
|
73181
|
+
/** The frequency on which this query can be rerun */
|
|
72823
73182
|
maxFrequency: /* @__PURE__ */ optional$2(maxFrequencyZod),
|
|
72824
|
-
/**
|
|
73183
|
+
/** The starting point for the bidding on the query */
|
|
72825
73184
|
minBid: /* @__PURE__ */ optional$2(/* @__PURE__ */ number$5())
|
|
72826
73185
|
});
|
|
72827
73186
|
})), BoundWitnessSchema, signatureOrNullZod, SignaturesMetaZod, UnsignedSignaturesMetaZod, SignedSignaturesMetaZod, BoundWitnessRequiredFieldsZod, BoundWitnessMetaZod, BoundWitnessPayloadZod, BoundWitnessWithRequiredZod, BoundWitnessZod, isBoundWitness, asBoundWitness, SignedBoundWitnessZod, UnsignedBoundWitnessZod, AnyUnsignedBoundWitnessZod, QueryBoundWitnessFieldsZod, QueryBoundWitnessZod, isQueryBoundWitness;
|
|
@@ -74270,7 +74629,7 @@ var init_dist_esm = __esmMin((() => {
|
|
|
74270
74629
|
init_unsubscribe();
|
|
74271
74630
|
}));
|
|
74272
74631
|
//#endregion
|
|
74273
|
-
//#region ../../node_modules/.pnpm/@ariestools+threads@8.1.
|
|
74632
|
+
//#region ../../node_modules/.pnpm/@ariestools+threads@8.1.2_@opentelemetry+api@1.9.1_observable-fns@0.6.1_supports-color@10.2.2_zod@4.4.3/node_modules/@ariestools/threads/dist/node/master/index-node.mjs
|
|
74274
74633
|
function resolveScriptPath(scriptPath, baseURL) {
|
|
74275
74634
|
const makeAbsolute = (filePath) => {
|
|
74276
74635
|
return path.isAbsolute(filePath) ? filePath : path.join(baseURL ?? cwd(), filePath);
|
|
@@ -74845,6 +75204,7 @@ var init_index_node = __esmMin((() => {
|
|
|
74845
75204
|
})();
|
|
74846
75205
|
};
|
|
74847
75206
|
ObservablePromise = class _ObservablePromise extends Observable {
|
|
75207
|
+
/** Standard object tag identifying this hybrid promise. */
|
|
74848
75208
|
[Symbol.toStringTag] = "[object ObservablePromise]";
|
|
74849
75209
|
initHasRun = false;
|
|
74850
75210
|
fulfillmentCallbacks = [];
|
|
@@ -74853,6 +75213,10 @@ var init_index_node = __esmMin((() => {
|
|
|
74853
75213
|
firstValueSet = false;
|
|
74854
75214
|
rejection;
|
|
74855
75215
|
state = "pending";
|
|
75216
|
+
/**
|
|
75217
|
+
* Create an observable promise.
|
|
75218
|
+
* @param init Initializes each observable subscription.
|
|
75219
|
+
*/
|
|
74856
75220
|
constructor(init) {
|
|
74857
75221
|
super((originalObserver) => {
|
|
74858
75222
|
const self = this;
|
|
@@ -74924,12 +75288,15 @@ var init_index_node = __esmMin((() => {
|
|
|
74924
75288
|
this.rejectionCallbacks.push(rejectionCallback);
|
|
74925
75289
|
});
|
|
74926
75290
|
}
|
|
75291
|
+
/** Register handlers for the first emitted value or a rejection. */
|
|
74927
75292
|
then(onFulfilledRaw, onRejectedRaw) {
|
|
74928
75293
|
return this.createPromise(onFulfilledRaw, onRejectedRaw);
|
|
74929
75294
|
}
|
|
75295
|
+
/** Register a rejection handler. */
|
|
74930
75296
|
catch(onRejected) {
|
|
74931
75297
|
return this.createPromise(void 0, onRejected);
|
|
74932
75298
|
}
|
|
75299
|
+
/** Register a handler invoked after fulfillment or rejection. */
|
|
74933
75300
|
finally(onCompleted) {
|
|
74934
75301
|
const handler = onCompleted || doNothing2;
|
|
74935
75302
|
return this.createPromise((value) => {
|
|
@@ -74937,6 +75304,7 @@ var init_index_node = __esmMin((() => {
|
|
|
74937
75304
|
return value;
|
|
74938
75305
|
}, () => handler());
|
|
74939
75306
|
}
|
|
75307
|
+
/** Convert an observable, thenable, or array-like value to an observable promise. */
|
|
74940
75308
|
static from(thing) {
|
|
74941
75309
|
return isThenable(thing) ? new _ObservablePromise((observer) => {
|
|
74942
75310
|
(async () => {
|
|
@@ -77203,7 +77571,7 @@ var require_index_umd = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
77203
77571
|
}));
|
|
77204
77572
|
}));
|
|
77205
77573
|
//#endregion
|
|
77206
|
-
//#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.2.
|
|
77574
|
+
//#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.2.2_@ariestools+sdk@8.1.3_@opentelemetry+api@1.9.1_zod_e3037e945b6aa9d20a93ce0deff04109/node_modules/@xyo-network/sdk-protocol-core/dist/node/hash.mjs
|
|
77207
77575
|
var import_index_umd, __require, createNodeWorker, removeEmptyFields, subSort, sortFields, subtleHashFunc, wasmHashFunc, wasmSupportStatic, omitByPredicate, ObjectHasher, NodeObjectHasher;
|
|
77208
77576
|
var init_hash = __esmMin((() => {
|
|
77209
77577
|
init_node$4();
|
|
@@ -77255,14 +77623,23 @@ var init_hash = __esmMin((() => {
|
|
|
77255
77623
|
return String(key).startsWith(prefix);
|
|
77256
77624
|
};
|
|
77257
77625
|
ObjectHasher = class _ObjectHasher extends ObjectWrapper {
|
|
77626
|
+
/** When true, prefer thread pools for subtle/WebAssembly hashing when worker URLs are configured. */
|
|
77258
77627
|
static allowHashPooling = true;
|
|
77628
|
+
/** When true, try Web Crypto SubtleDigest first. */
|
|
77259
77629
|
static allowSubtle = true;
|
|
77630
|
+
/** Browser worker factory; set by {@link BrowserObjectHasher}. */
|
|
77260
77631
|
static createBrowserWorker;
|
|
77632
|
+
/** Node worker factory; set by platform entrypoints. */
|
|
77261
77633
|
static createNodeWorker;
|
|
77634
|
+
/** URL of the subtle-hash worker bundle (browser). */
|
|
77262
77635
|
static subtleHashWorkerUrl;
|
|
77636
|
+
/** When true, emit a warning if falling back to a pure-JS path (reserved). */
|
|
77263
77637
|
static warnIfUsingJsHash = true;
|
|
77638
|
+
/** URL of the WebAssembly-hash worker bundle (browser). */
|
|
77264
77639
|
static wasmHashWorkerUrl;
|
|
77640
|
+
/** Promise that settles when WebAssembly feature detection has completed. */
|
|
77265
77641
|
static wasmInitialized = wasmSupportStatic.initialize();
|
|
77642
|
+
/** Shared WebAssembly feature-support instance (requires `bigInt`). */
|
|
77266
77643
|
static wasmSupport = wasmSupportStatic;
|
|
77267
77644
|
static _subtleHashPool;
|
|
77268
77645
|
static _wasmHashPool;
|
|
@@ -77286,18 +77663,38 @@ var init_hash = __esmMin((() => {
|
|
|
77286
77663
|
return null;
|
|
77287
77664
|
}
|
|
77288
77665
|
}
|
|
77289
|
-
|
|
77290
|
-
|
|
77291
|
-
|
|
77666
|
+
/**
|
|
77667
|
+
* Create a platform worker from a browser script location or Node source function.
|
|
77668
|
+
* @param scriptUrl - Worker script location (browser)
|
|
77669
|
+
* @param func - Worker source factory (Node)
|
|
77670
|
+
*/
|
|
77671
|
+
static createWorker(scriptUrl, func) {
|
|
77672
|
+
if (scriptUrl) console.debug(`createWorker: ${scriptUrl.href}`);
|
|
77673
|
+
return assertEx(this.createBrowserWorker?.(scriptUrl) ?? this.createNodeWorker?.(func), () => "Unable to create worker");
|
|
77292
77674
|
}
|
|
77675
|
+
/**
|
|
77676
|
+
* Filter objects whose hash is not in `hash`.
|
|
77677
|
+
* @param objs - Objects to hash and filter
|
|
77678
|
+
* @param hash - Single hash or list of hashes to exclude
|
|
77679
|
+
*/
|
|
77293
77680
|
static async filterExcludeByHash(objs = [], hash) {
|
|
77294
77681
|
const hashes = Array.isArray(hash) ? hash : [hash];
|
|
77295
77682
|
return (await this.hashPairs(objs)).filter(([_, objHash]) => !hashes.includes(objHash))?.map((pair) => pair[0]);
|
|
77296
77683
|
}
|
|
77684
|
+
/**
|
|
77685
|
+
* Filter objects whose hash is in `hash`.
|
|
77686
|
+
* @param objs - Objects to hash and filter
|
|
77687
|
+
* @param hash - Single hash or list of hashes to include
|
|
77688
|
+
*/
|
|
77297
77689
|
static async filterIncludeByHash(objs = [], hash) {
|
|
77298
77690
|
const hashes = Array.isArray(hash) ? hash : [hash];
|
|
77299
77691
|
return (await this.hashPairs(objs)).filter(([_, objHash]) => hashes.includes(objHash))?.map((pair) => pair[0]);
|
|
77300
77692
|
}
|
|
77693
|
+
/**
|
|
77694
|
+
* Find the first object whose hash equals `hash`.
|
|
77695
|
+
* @param objs - Objects to search
|
|
77696
|
+
* @param hash - Target hash
|
|
77697
|
+
*/
|
|
77301
77698
|
static async findByHash(objs = [], hash) {
|
|
77302
77699
|
return (await this.hashPairs(objs)).find(([_, objHash]) => objHash === hash)?.[0];
|
|
77303
77700
|
}
|
|
@@ -77322,6 +77719,11 @@ var init_hash = __esmMin((() => {
|
|
|
77322
77719
|
}
|
|
77323
77720
|
throw new Error("No subtle or wasm hashing available");
|
|
77324
77721
|
}
|
|
77722
|
+
/**
|
|
77723
|
+
* SHA-256 hash raw bytes (no JSON canonicalization).
|
|
77724
|
+
* @param bytes - Input bytes
|
|
77725
|
+
* @returns Hex hash
|
|
77726
|
+
*/
|
|
77325
77727
|
static async hashBytes(bytes) {
|
|
77326
77728
|
const bytesArray = new Uint8Array(bytes);
|
|
77327
77729
|
if (_ObjectHasher.allowSubtle) return hexFromArrayBuffer(await this.subtleHash(bytesArray), { bitLength: 256 });
|
|
@@ -77329,6 +77731,12 @@ var init_hash = __esmMin((() => {
|
|
|
77329
77731
|
if (_ObjectHasher.wasmSupport.canUseWasm) return await this.wasmHash(bytesArray);
|
|
77330
77732
|
throw new Error("No subtle or wasm hashing available");
|
|
77331
77733
|
}
|
|
77734
|
+
/**
|
|
77735
|
+
* Prepare an object for hashing: drop `_`-prefixed keys, remove empty fields, sort keys.
|
|
77736
|
+
* Does not sort keys inside array elements.
|
|
77737
|
+
* @param obj - Source object
|
|
77738
|
+
* @returns Canonicalized clone
|
|
77739
|
+
*/
|
|
77332
77740
|
static hashFields(obj) {
|
|
77333
77741
|
return sortFields(removeEmptyFields(omitBy(obj, omitByPredicate("_"))));
|
|
77334
77742
|
}
|
|
@@ -77357,18 +77765,33 @@ var init_hash = __esmMin((() => {
|
|
|
77357
77765
|
static json(payload, meta = false) {
|
|
77358
77766
|
return sortFields(removeEmptyFields(meta ? payload : omitBy(payload, omitByPredicate("_"))));
|
|
77359
77767
|
}
|
|
77360
|
-
/** @deprecated
|
|
77768
|
+
/** @deprecated Prefer {@link ObjectHasher.json} for the same canonicalization */
|
|
77361
77769
|
static jsonPayload(payload, meta = false) {
|
|
77362
77770
|
return this.json(payload, meta);
|
|
77363
77771
|
}
|
|
77772
|
+
/**
|
|
77773
|
+
* JSON-stringify the canonical hash fields of `obj`.
|
|
77774
|
+
* @param obj - Source object
|
|
77775
|
+
* @returns Stable JSON string used as the hash input
|
|
77776
|
+
*/
|
|
77364
77777
|
static stringifyHashFields(obj) {
|
|
77365
77778
|
return JSON.stringify(this.hashFields(obj));
|
|
77366
77779
|
}
|
|
77780
|
+
/**
|
|
77781
|
+
* SHA-256 via SubtleCrypto (main thread or worker pool).
|
|
77782
|
+
* @param data - Encoded bytes
|
|
77783
|
+
* @returns Raw digest buffer
|
|
77784
|
+
*/
|
|
77367
77785
|
static async subtleHash(data) {
|
|
77368
77786
|
const pool = this.subtleHashPool;
|
|
77369
77787
|
if (pool === null) return await globalThis.crypto.subtle.digest("SHA-256", data);
|
|
77370
77788
|
return await pool.queue(async (thread) => await thread.hash(data));
|
|
77371
77789
|
}
|
|
77790
|
+
/**
|
|
77791
|
+
* SHA-256 via hash-wasm (main thread or worker pool).
|
|
77792
|
+
* @param data - Encoded bytes
|
|
77793
|
+
* @returns Hex hash
|
|
77794
|
+
*/
|
|
77372
77795
|
static async wasmHash(data) {
|
|
77373
77796
|
const pool = this.wasmHashPool;
|
|
77374
77797
|
if (pool === null) return asHash(await (0, import_index_umd.sha256)(data), true);
|
|
@@ -77379,6 +77802,7 @@ var init_hash = __esmMin((() => {
|
|
|
77379
77802
|
const createFunc = () => spawn$1(this.createWorker(url, func));
|
|
77380
77803
|
return Pool(createFunc, size);
|
|
77381
77804
|
}
|
|
77805
|
+
/** Hash the wrapped object instance. */
|
|
77382
77806
|
async hash() {
|
|
77383
77807
|
return await _ObjectHasher.hash(this.obj);
|
|
77384
77808
|
}
|
|
@@ -77393,11 +77817,12 @@ var init_hash = __esmMin((() => {
|
|
|
77393
77817
|
};
|
|
77394
77818
|
ObjectHasher.createNodeWorker = createNodeWorker;
|
|
77395
77819
|
NodeObjectHasher = class extends ObjectHasher {
|
|
77820
|
+
/** Factory for Node worker threads used by the hash pool. */
|
|
77396
77821
|
static createNodeWorker = createNodeWorker;
|
|
77397
77822
|
};
|
|
77398
77823
|
}));
|
|
77399
77824
|
//#endregion
|
|
77400
|
-
//#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.2.
|
|
77825
|
+
//#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.2.2_@ariestools+sdk@8.1.3_@opentelemetry+api@1.9.1_zod_e3037e945b6aa9d20a93ce0deff04109/node_modules/@xyo-network/sdk-protocol-core/dist/neutral/payload-builder.mjs
|
|
77401
77826
|
var omitSchema, PayloadBuilder;
|
|
77402
77827
|
var init_payload_builder = __esmMin((() => {
|
|
77403
77828
|
init_node$4();
|
|
@@ -77409,10 +77834,14 @@ var init_payload_builder = __esmMin((() => {
|
|
|
77409
77834
|
return result;
|
|
77410
77835
|
};
|
|
77411
77836
|
PayloadBuilder = class _PayloadBuilder {
|
|
77837
|
+
/** Construction options (schema, optional logger) */
|
|
77412
77838
|
options;
|
|
77413
77839
|
_fields;
|
|
77414
77840
|
_meta;
|
|
77415
77841
|
_schema;
|
|
77842
|
+
/**
|
|
77843
|
+
* @param options - Builder options; `schema` is required
|
|
77844
|
+
*/
|
|
77416
77845
|
constructor(options) {
|
|
77417
77846
|
this.options = options;
|
|
77418
77847
|
const { schema } = options;
|
|
@@ -77436,17 +77865,40 @@ var init_payload_builder = __esmMin((() => {
|
|
|
77436
77865
|
return (await Promise.all(payloads.map(async (payload, i) => await this.addSequencedStorageMeta(payload, timestamp, i)))).toSorted(this.compareStorageMeta);
|
|
77437
77866
|
})() : this.addSequencedStorageMeta(payloads, index);
|
|
77438
77867
|
}
|
|
77868
|
+
/**
|
|
77869
|
+
* Compares two payloads by `_sequence` for ordering.
|
|
77870
|
+
* @param a - Left payload with storage meta
|
|
77871
|
+
* @param b - Right payload with storage meta
|
|
77872
|
+
* @param comparer - Sequence comparer (default local sequence order)
|
|
77873
|
+
* @returns Negative, zero, or positive comparison result
|
|
77874
|
+
*/
|
|
77439
77875
|
static compareStorageMeta(a, b, comparer = SequenceComparer.local) {
|
|
77440
77876
|
return comparer(a._sequence, b._sequence);
|
|
77441
77877
|
}
|
|
77878
|
+
/**
|
|
77879
|
+
* Computes the data hash of a payload (storage + client meta stripped).
|
|
77880
|
+
* @param payload - Payload to hash
|
|
77881
|
+
* @returns Data hash
|
|
77882
|
+
*/
|
|
77442
77883
|
static async dataHash(payload) {
|
|
77443
77884
|
return await NodeObjectHasher.hash(this.omitMeta(payload));
|
|
77444
77885
|
}
|
|
77886
|
+
/**
|
|
77887
|
+
* Pairs each payload with its data hash.
|
|
77888
|
+
* @param payloads - Payloads to hash
|
|
77889
|
+
* @returns Array of `[payload, dataHash]` tuples
|
|
77890
|
+
*/
|
|
77445
77891
|
static async dataHashPairs(payloads) {
|
|
77446
77892
|
return await Promise.all(payloads.map(async (payload) => {
|
|
77447
77893
|
return [payload, await this.dataHash(payload)];
|
|
77448
77894
|
}));
|
|
77449
77895
|
}
|
|
77896
|
+
/**
|
|
77897
|
+
* Builds the field set used for data hashing: schema applied, empty fields removed, meta stripped.
|
|
77898
|
+
* @param schema - Schema to assign
|
|
77899
|
+
* @param payload - Payload fields without schema
|
|
77900
|
+
* @returns Data-hashable fields (no storage or client meta)
|
|
77901
|
+
*/
|
|
77450
77902
|
static dataHashableFields(schema, payload) {
|
|
77451
77903
|
const cleanFields = removeEmptyFields({
|
|
77452
77904
|
...payload,
|
|
@@ -77460,38 +77912,78 @@ var init_payload_builder = __esmMin((() => {
|
|
|
77460
77912
|
return await this.dataHash(payload);
|
|
77461
77913
|
})) : void 0;
|
|
77462
77914
|
}
|
|
77915
|
+
/**
|
|
77916
|
+
* Excludes payloads whose data hash or root hash matches any of the given hashes.
|
|
77917
|
+
* @param payloads - Payloads to filter
|
|
77918
|
+
* @param hash - Hash or hashes to exclude
|
|
77919
|
+
* @returns Payloads not matching the hash(es)
|
|
77920
|
+
*/
|
|
77463
77921
|
static async filterExclude(payloads = [], hash) {
|
|
77464
77922
|
return await NodeObjectHasher.filterExcludeByHash(await this.filterExcludeByDataHash(payloads, hash), hash);
|
|
77465
77923
|
}
|
|
77924
|
+
/**
|
|
77925
|
+
* Excludes payloads whose data hash matches any of the given hashes.
|
|
77926
|
+
* @param payloads - Payloads to filter
|
|
77927
|
+
* @param hash - Data hash or hashes to exclude
|
|
77928
|
+
* @returns Payloads not matching the data hash(es)
|
|
77929
|
+
*/
|
|
77466
77930
|
static async filterExcludeByDataHash(payloads = [], hash) {
|
|
77467
77931
|
const hashes = Array.isArray(hash) ? hash : [hash];
|
|
77468
77932
|
return (await this.dataHashPairs(payloads)).filter(([_, objHash]) => !hashes.includes(objHash))?.map((pair) => pair[0]);
|
|
77469
77933
|
}
|
|
77934
|
+
/**
|
|
77935
|
+
* Includes only payloads whose data hash matches any of the given hashes.
|
|
77936
|
+
* @param payloads - Payloads to filter
|
|
77937
|
+
* @param hash - Data hash or hashes to include
|
|
77938
|
+
* @returns Matching payloads
|
|
77939
|
+
*/
|
|
77470
77940
|
static async filterIncludeByDataHash(payloads = [], hash) {
|
|
77471
77941
|
const hashes = Array.isArray(hash) ? hash : [hash];
|
|
77472
77942
|
return (await this.dataHashPairs(payloads)).filter(([_, objHash]) => hashes.includes(objHash))?.map((pair) => pair[0]);
|
|
77473
77943
|
}
|
|
77944
|
+
/**
|
|
77945
|
+
* Includes payloads that match by either root hash or data hash.
|
|
77946
|
+
* @param payloads - Payloads to filter
|
|
77947
|
+
* @param hash - Root and/or data hash(es) to include
|
|
77948
|
+
* @returns Matching payloads (order follows `hash`)
|
|
77949
|
+
*/
|
|
77474
77950
|
static async filterIncludeByEitherHash(payloads = [], hash) {
|
|
77475
77951
|
const hashes = Array.isArray(hash) ? hash : [hash];
|
|
77476
77952
|
const map = await this.toAllHashMap(payloads);
|
|
77477
77953
|
return hashes.map((hash2) => map[String(hash2)]).filter(exists$1);
|
|
77478
77954
|
}
|
|
77955
|
+
/**
|
|
77956
|
+
* Finds the first payload with the given data hash.
|
|
77957
|
+
* @param payloads - Payloads to search
|
|
77958
|
+
* @param hash - Data hash to match
|
|
77959
|
+
* @returns Matching payload, or `undefined`
|
|
77960
|
+
*/
|
|
77479
77961
|
static async findByDataHash(payloads = [], hash) {
|
|
77480
77962
|
return (await this.dataHashPairs(payloads)).find(([_, objHash]) => objHash === hash)?.[0];
|
|
77481
77963
|
}
|
|
77964
|
+
/**
|
|
77965
|
+
* Computes the root hash of a payload (storage meta stripped; client meta retained).
|
|
77966
|
+
* @param payload - Payload to hash
|
|
77967
|
+
* @returns Root hash
|
|
77968
|
+
*/
|
|
77482
77969
|
static async hash(payload) {
|
|
77483
77970
|
return await NodeObjectHasher.hash(this.omitStorageMeta(payload));
|
|
77484
77971
|
}
|
|
77485
77972
|
/**
|
|
77486
|
-
* Creates an array of payload/hash tuples
|
|
77487
|
-
* @param
|
|
77488
|
-
* @returns
|
|
77973
|
+
* Creates an array of payload/root-hash tuples.
|
|
77974
|
+
* @param payloads - Payloads to hash
|
|
77975
|
+
* @returns Array of `[payload, rootHash]` tuples
|
|
77489
77976
|
*/
|
|
77490
77977
|
static async hashPairs(payloads) {
|
|
77491
77978
|
return await Promise.all(payloads.map(async (payload) => {
|
|
77492
77979
|
return [payload, await this.hash(payload)];
|
|
77493
77980
|
}));
|
|
77494
77981
|
}
|
|
77982
|
+
/**
|
|
77983
|
+
* Returns the field set used for root hashing (storage meta stripped).
|
|
77984
|
+
* @param payload - Payload to prepare
|
|
77985
|
+
* @returns Payload without storage meta
|
|
77986
|
+
*/
|
|
77495
77987
|
static hashableFields(payload) {
|
|
77496
77988
|
return this.omitStorageMeta(payload);
|
|
77497
77989
|
}
|
|
@@ -77513,9 +78005,21 @@ var init_payload_builder = __esmMin((() => {
|
|
|
77513
78005
|
static pickClientMeta(payloads, maxDepth = 1) {
|
|
77514
78006
|
return Array.isArray(payloads) ? payloads.map((payload) => this.pickClientMeta(payload, maxDepth)) : pickByPrefix(payloads, "$", maxDepth);
|
|
77515
78007
|
}
|
|
78008
|
+
/**
|
|
78009
|
+
* Sorts payloads by `_sequence`.
|
|
78010
|
+
* @param payloads - Payloads with storage meta
|
|
78011
|
+
* @param direction - `1` ascending (default), `-1` descending
|
|
78012
|
+
* @param comparer - Sequence comparer (default local sequence order)
|
|
78013
|
+
* @returns New sorted array
|
|
78014
|
+
*/
|
|
77516
78015
|
static sortByStorageMeta(payloads, direction = 1, comparer = SequenceComparer.local) {
|
|
77517
78016
|
return payloads.toSorted((a, b) => direction * comparer(a._sequence, b._sequence));
|
|
77518
78017
|
}
|
|
78018
|
+
/**
|
|
78019
|
+
* Maps both root hash and data hash of each payload to that payload.
|
|
78020
|
+
* @param payloads - Payloads to index
|
|
78021
|
+
* @returns Map of hash → payload (both hash kinds as keys)
|
|
78022
|
+
*/
|
|
77519
78023
|
static async toAllHashMap(payloads) {
|
|
77520
78024
|
const pairs = await this.hashPairs(payloads);
|
|
77521
78025
|
const entries = await Promise.all(pairs.map(async ([payload, payloadHash]) => {
|
|
@@ -77524,14 +78028,19 @@ var init_payload_builder = __esmMin((() => {
|
|
|
77524
78028
|
}));
|
|
77525
78029
|
return Object.fromEntries(entries.flat());
|
|
77526
78030
|
}
|
|
78031
|
+
/**
|
|
78032
|
+
* Maps data hashes to their payloads.
|
|
78033
|
+
* @param objs - Payloads to index
|
|
78034
|
+
* @returns Map of data hash → payload
|
|
78035
|
+
*/
|
|
77527
78036
|
static async toDataHashMap(objs) {
|
|
77528
78037
|
const pairs = await this.dataHashPairs(objs);
|
|
77529
78038
|
return Object.fromEntries(pairs.map(([payload, dataHash]) => [dataHash, payload]));
|
|
77530
78039
|
}
|
|
77531
78040
|
/**
|
|
77532
|
-
*
|
|
77533
|
-
* @param objs
|
|
77534
|
-
* @returns
|
|
78041
|
+
* Maps root hashes to their payloads.
|
|
78042
|
+
* @param objs - Payloads to index
|
|
78043
|
+
* @returns Map of root hash → payload
|
|
77535
78044
|
*/
|
|
77536
78045
|
static async toHashMap(objs) {
|
|
77537
78046
|
const pairs = await this.hashPairs(objs);
|
|
@@ -77545,6 +78054,10 @@ var init_payload_builder = __esmMin((() => {
|
|
|
77545
78054
|
_sequence
|
|
77546
78055
|
};
|
|
77547
78056
|
}
|
|
78057
|
+
/**
|
|
78058
|
+
* Builds the payload from configured schema, fields, and client meta.
|
|
78059
|
+
* @returns Constructed payload (or builder-specific result type)
|
|
78060
|
+
*/
|
|
77548
78061
|
build() {
|
|
77549
78062
|
return {
|
|
77550
78063
|
schema: this._schema,
|
|
@@ -77552,26 +78065,44 @@ var init_payload_builder = __esmMin((() => {
|
|
|
77552
78065
|
...this._meta
|
|
77553
78066
|
};
|
|
77554
78067
|
}
|
|
78068
|
+
/**
|
|
78069
|
+
* Returns the instance's data-hashable field set.
|
|
78070
|
+
* @returns Fields ready for data hashing
|
|
78071
|
+
*/
|
|
77555
78072
|
async dataHashableFields() {
|
|
77556
78073
|
return await _PayloadBuilder.dataHashableFields(assertEx(this._schema, () => "Payload: Missing Schema"), this._fields);
|
|
77557
78074
|
}
|
|
78075
|
+
/**
|
|
78076
|
+
* Sets payload body fields (schema/meta stripped, empty fields removed).
|
|
78077
|
+
* @param fields - Fields without schema, storage meta, or client meta
|
|
78078
|
+
* @returns `this` for chaining
|
|
78079
|
+
*/
|
|
77558
78080
|
fields(fields) {
|
|
77559
78081
|
const withoutSchema = omitSchema(removeEmptyFields(structuredClone(fields)));
|
|
77560
78082
|
const withoutStorageMeta = _PayloadBuilder.omitStorageMeta(withoutSchema);
|
|
77561
78083
|
this._fields = _PayloadBuilder.omitClientMeta(withoutStorageMeta);
|
|
77562
78084
|
return this;
|
|
77563
78085
|
}
|
|
78086
|
+
/**
|
|
78087
|
+
* Sets client meta (`$`-prefixed fields only).
|
|
78088
|
+
* @param meta - Client meta to retain
|
|
78089
|
+
* @returns `this` for chaining
|
|
78090
|
+
*/
|
|
77564
78091
|
meta(meta) {
|
|
77565
78092
|
this._meta = pickByPrefix(meta, "$");
|
|
77566
78093
|
return this;
|
|
77567
78094
|
}
|
|
78095
|
+
/**
|
|
78096
|
+
* Sets the payload schema.
|
|
78097
|
+
* @param value - Schema URI
|
|
78098
|
+
*/
|
|
77568
78099
|
schema(value) {
|
|
77569
78100
|
this._schema = value;
|
|
77570
78101
|
}
|
|
77571
78102
|
};
|
|
77572
78103
|
}));
|
|
77573
78104
|
//#endregion
|
|
77574
|
-
//#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.2.
|
|
78105
|
+
//#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.2.2_@ariestools+sdk@8.1.3_@opentelemetry+api@1.9.1_zod_e3037e945b6aa9d20a93ce0deff04109/node_modules/@xyo-network/sdk-protocol-core/dist/neutral/schema-name-validator.mjs
|
|
77575
78106
|
function domainLevel(validator, level) {
|
|
77576
78107
|
return validator.parts?.slice(0, level + 1).toReversed().join(".");
|
|
77577
78108
|
}
|
|
@@ -77620,9 +78151,11 @@ var init_schema_name_validator = __esmMin((() => {
|
|
|
77620
78151
|
this._rootDomain = this._rootDomain ?? domainLevel(this, 1);
|
|
77621
78152
|
return this._rootDomain;
|
|
77622
78153
|
}
|
|
78154
|
+
/** Schema name under validation. */
|
|
77623
78155
|
get schema() {
|
|
77624
78156
|
return this._schema;
|
|
77625
78157
|
}
|
|
78158
|
+
/** Updates the schema name and clears cached derived fields on next read. */
|
|
77626
78159
|
set schema(schema) {
|
|
77627
78160
|
this._schema = schema;
|
|
77628
78161
|
}
|
|
@@ -77640,7 +78173,7 @@ var init_schema_name_validator = __esmMin((() => {
|
|
|
77640
78173
|
};
|
|
77641
78174
|
}));
|
|
77642
78175
|
//#endregion
|
|
77643
|
-
//#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.2.
|
|
78176
|
+
//#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.2.2_@ariestools+sdk@8.1.3_@opentelemetry+api@1.9.1_zod_e3037e945b6aa9d20a93ce0deff04109/node_modules/@xyo-network/sdk-protocol-core/dist/neutral/payload-validator.mjs
|
|
77644
78177
|
var defaultSchemaNameValidatorFactory, PayloadValidator;
|
|
77645
78178
|
var init_payload_validator = __esmMin((() => {
|
|
77646
78179
|
init_node$4();
|
|
@@ -77649,32 +78182,52 @@ var init_payload_validator = __esmMin((() => {
|
|
|
77649
78182
|
PayloadValidator = class _PayloadValidator extends ValidatorBase {
|
|
77650
78183
|
static schemaNameValidatorFactory = defaultSchemaNameValidatorFactory;
|
|
77651
78184
|
_schemaValidator;
|
|
78185
|
+
/** Payload under validation */
|
|
77652
78186
|
payload;
|
|
78187
|
+
/**
|
|
78188
|
+
* @param payload - Payload to validate
|
|
78189
|
+
*/
|
|
77653
78190
|
constructor(payload) {
|
|
77654
78191
|
super(payload);
|
|
77655
78192
|
this.payload = payload;
|
|
77656
78193
|
}
|
|
78194
|
+
/**
|
|
78195
|
+
* Replaces the factory used to build schema-name validators.
|
|
78196
|
+
* @param factory - Schema-name validator factory
|
|
78197
|
+
*/
|
|
77657
78198
|
static setSchemaNameValidatorFactory(factory) {
|
|
77658
78199
|
this.schemaNameValidatorFactory = factory;
|
|
77659
78200
|
}
|
|
78201
|
+
/**
|
|
78202
|
+
* Lazily created schema-name validator for this payload's schema.
|
|
78203
|
+
* @returns Schema-name validator, or `undefined` if none could be created
|
|
78204
|
+
*/
|
|
77660
78205
|
get schemaValidator() {
|
|
77661
78206
|
this._schemaValidator = this._schemaValidator ?? _PayloadValidator.schemaNameValidatorFactory?.(this.payload.schema);
|
|
77662
78207
|
if (isUndefined(this._schemaValidator)) console.warn(`No schema name validator set [${this.payload.schema}]`);
|
|
77663
78208
|
return this._schemaValidator;
|
|
77664
78209
|
}
|
|
78210
|
+
/**
|
|
78211
|
+
* Validates that `schema` is present and well-formed.
|
|
78212
|
+
* @returns Schema-name validation errors
|
|
78213
|
+
*/
|
|
77665
78214
|
schemaName() {
|
|
77666
78215
|
const errors = [];
|
|
77667
78216
|
if (this.obj.schema === void 0) errors.push(/* @__PURE__ */ new Error("schema missing"));
|
|
77668
78217
|
else errors.push(...this.schemaValidator?.all() ?? []);
|
|
77669
78218
|
return errors;
|
|
77670
78219
|
}
|
|
78220
|
+
/**
|
|
78221
|
+
* Runs all structural payload checks.
|
|
78222
|
+
* @returns Validation errors
|
|
78223
|
+
*/
|
|
77671
78224
|
validate() {
|
|
77672
78225
|
return [...this.schemaName()];
|
|
77673
78226
|
}
|
|
77674
78227
|
};
|
|
77675
78228
|
}));
|
|
77676
78229
|
//#endregion
|
|
77677
|
-
//#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.2.
|
|
78230
|
+
//#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.2.2_@ariestools+sdk@8.1.3_@opentelemetry+api@1.9.1_zod_e3037e945b6aa9d20a93ce0deff04109/node_modules/@xyo-network/sdk-protocol-core/dist/neutral/payload-wrapper.mjs
|
|
77678
78231
|
var isPayloadWrapperBase, PayloadWrapperBase, PayloadDataWrapper, PayloadWrapper, Uint256RegEx, payloadPropertiesJsonSchema, payloadJsonSchema;
|
|
77679
78232
|
var init_payload_wrapper = __esmMin((() => {
|
|
77680
78233
|
init_node$4();
|
|
@@ -77686,7 +78239,11 @@ var init_payload_wrapper = __esmMin((() => {
|
|
|
77686
78239
|
};
|
|
77687
78240
|
PayloadWrapperBase = class {
|
|
77688
78241
|
_errors;
|
|
78242
|
+
/** Underlying payload instance */
|
|
77689
78243
|
payload;
|
|
78244
|
+
/**
|
|
78245
|
+
* @param payload - Payload to wrap
|
|
78246
|
+
*/
|
|
77690
78247
|
constructor(payload) {
|
|
77691
78248
|
this.payload = payload;
|
|
77692
78249
|
}
|
|
@@ -77700,22 +78257,47 @@ var init_payload_wrapper = __esmMin((() => {
|
|
|
77700
78257
|
if (isAnyPayload(payload)) return payload;
|
|
77701
78258
|
throw new TypeError("Can not unwrap an object that is not a PayloadWrapper or Payload");
|
|
77702
78259
|
}
|
|
78260
|
+
/**
|
|
78261
|
+
* Data hash of the wrapped payload (meta stripped).
|
|
78262
|
+
* @returns Data hash
|
|
78263
|
+
*/
|
|
77703
78264
|
async dataHash() {
|
|
77704
78265
|
return await PayloadBuilder.dataHash(this.payload);
|
|
77705
78266
|
}
|
|
78267
|
+
/**
|
|
78268
|
+
* Cached validation errors for the wrapped payload.
|
|
78269
|
+
* @returns Validation errors (empty when valid)
|
|
78270
|
+
*/
|
|
77706
78271
|
async getErrors() {
|
|
77707
78272
|
this._errors = this._errors ?? await this.validate();
|
|
77708
78273
|
return this._errors;
|
|
77709
78274
|
}
|
|
78275
|
+
/**
|
|
78276
|
+
* Whether the wrapped payload currently validates with no errors.
|
|
78277
|
+
* @returns `true` when valid
|
|
78278
|
+
*/
|
|
77710
78279
|
async getValid() {
|
|
77711
78280
|
return (await this.getErrors()).length === 0;
|
|
77712
78281
|
}
|
|
78282
|
+
/**
|
|
78283
|
+
* Root hash of the wrapped payload (storage meta stripped).
|
|
78284
|
+
* @returns Root hash
|
|
78285
|
+
*/
|
|
77713
78286
|
async hash() {
|
|
77714
78287
|
return await PayloadBuilder.hash(this.payload);
|
|
77715
78288
|
}
|
|
78289
|
+
/**
|
|
78290
|
+
* Schema of the wrapped payload.
|
|
78291
|
+
* Intentionally a method (not a getter) to avoid confusion with `payload.schema`.
|
|
78292
|
+
* @returns Schema URI
|
|
78293
|
+
*/
|
|
77716
78294
|
schema() {
|
|
77717
78295
|
return assertEx(this.payload?.schema, () => "Missing payload schema");
|
|
77718
78296
|
}
|
|
78297
|
+
/**
|
|
78298
|
+
* Validates the wrapped payload. Base implementation returns no errors; subclasses override.
|
|
78299
|
+
* @returns Validation errors
|
|
78300
|
+
*/
|
|
77719
78301
|
validate() {
|
|
77720
78302
|
return [];
|
|
77721
78303
|
}
|
|
@@ -77725,9 +78307,19 @@ var init_payload_wrapper = __esmMin((() => {
|
|
|
77725
78307
|
constructor(payload) {
|
|
77726
78308
|
super(payload);
|
|
77727
78309
|
}
|
|
78310
|
+
/**
|
|
78311
|
+
* Narrows `value` to this wrapper class when it is an instance.
|
|
78312
|
+
* @param value - Value to test
|
|
78313
|
+
* @returns The wrapper, or `null`
|
|
78314
|
+
*/
|
|
77728
78315
|
static as(value) {
|
|
77729
78316
|
return value instanceof this ? value : null;
|
|
77730
78317
|
}
|
|
78318
|
+
/**
|
|
78319
|
+
* Loads a payload by address using the configured {@link PayloadLoaderFactory}.
|
|
78320
|
+
* @param address - Address key for the loader
|
|
78321
|
+
* @returns Wrapped payload, or `null` if no loader is set or nothing was found
|
|
78322
|
+
*/
|
|
77731
78323
|
static async load(address) {
|
|
77732
78324
|
if (this.loaderFactory === null) {
|
|
77733
78325
|
console.warn("No loader factory set");
|
|
@@ -77736,13 +78328,27 @@ var init_payload_wrapper = __esmMin((() => {
|
|
|
77736
78328
|
const payload = await this.loaderFactory()(address);
|
|
77737
78329
|
return payload ? new _PayloadDataWrapper(payload) : null;
|
|
77738
78330
|
}
|
|
78331
|
+
/**
|
|
78332
|
+
* Parses a JSON string or object into a {@link PayloadDataWrapper}.
|
|
78333
|
+
* @param payload - JSON string or payload-like object
|
|
78334
|
+
* @returns Wrapped payload
|
|
78335
|
+
*/
|
|
77739
78336
|
static parse(payload) {
|
|
77740
78337
|
const hydratedObj = typeof payload === "string" ? JSON.parse(payload) : payload;
|
|
77741
78338
|
return this.wrap(hydratedObj);
|
|
77742
78339
|
}
|
|
78340
|
+
/**
|
|
78341
|
+
* Sets (or clears) the factory used by {@link PayloadDataWrapper.load}.
|
|
78342
|
+
* @param factory - Loader factory, or `null` to clear
|
|
78343
|
+
*/
|
|
77743
78344
|
static setLoaderFactory(factory) {
|
|
77744
78345
|
this.loaderFactory = factory;
|
|
77745
78346
|
}
|
|
78347
|
+
/**
|
|
78348
|
+
* Like {@link PayloadDataWrapper.parse}, but returns `undefined` on null/undefined or parse failure.
|
|
78349
|
+
* @param obj - Value to parse
|
|
78350
|
+
* @returns Wrapped payload, or `undefined`
|
|
78351
|
+
*/
|
|
77746
78352
|
static tryParse(obj) {
|
|
77747
78353
|
if (obj === void 0 || obj === null) return;
|
|
77748
78354
|
try {
|
|
@@ -77751,6 +78357,12 @@ var init_payload_wrapper = __esmMin((() => {
|
|
|
77751
78357
|
return;
|
|
77752
78358
|
}
|
|
77753
78359
|
}
|
|
78360
|
+
/**
|
|
78361
|
+
* Wraps a payload (or existing wrapper) as a {@link PayloadDataWrapper}.
|
|
78362
|
+
* @param payload - Payload or wrapper
|
|
78363
|
+
* @returns Data wrapper instance
|
|
78364
|
+
* @throws When `payload` is an array or a non-object
|
|
78365
|
+
*/
|
|
77754
78366
|
static wrap(payload) {
|
|
77755
78367
|
assertEx(!Array.isArray(payload), () => "Array can not be converted to PayloadWrapper");
|
|
77756
78368
|
switch (typeof payload) {
|
|
@@ -77762,6 +78374,11 @@ var init_payload_wrapper = __esmMin((() => {
|
|
|
77762
78374
|
default: throw new Error(`Can only parse objects [${typeof payload}]`);
|
|
77763
78375
|
}
|
|
77764
78376
|
}
|
|
78377
|
+
/**
|
|
78378
|
+
* Maps payloads to wrappers keyed by data hash.
|
|
78379
|
+
* @param payloads - Payloads or wrappers to index
|
|
78380
|
+
* @returns Map of data hash string → wrapper
|
|
78381
|
+
*/
|
|
77765
78382
|
static async wrappedMap(payloads) {
|
|
77766
78383
|
const result = {};
|
|
77767
78384
|
await Promise.all(payloads.map(async (payload) => {
|
|
@@ -77771,6 +78388,10 @@ var init_payload_wrapper = __esmMin((() => {
|
|
|
77771
78388
|
}));
|
|
77772
78389
|
return result;
|
|
77773
78390
|
}
|
|
78391
|
+
/**
|
|
78392
|
+
* Validates the wrapped payload with {@link PayloadValidator}.
|
|
78393
|
+
* @returns Validation errors
|
|
78394
|
+
*/
|
|
77774
78395
|
async validate() {
|
|
77775
78396
|
return await new PayloadValidator(this.payload).validate();
|
|
77776
78397
|
}
|
|
@@ -77799,7 +78420,7 @@ var init_payload_wrapper = __esmMin((() => {
|
|
|
77799
78420
|
};
|
|
77800
78421
|
}));
|
|
77801
78422
|
//#endregion
|
|
77802
|
-
//#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.2.
|
|
78423
|
+
//#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.2.2_@ariestools+sdk@8.1.3_@opentelemetry+api@1.9.1_zod_e3037e945b6aa9d20a93ce0deff04109/node_modules/@xyo-network/sdk-protocol-core/dist/neutral/payload.mjs
|
|
77803
78424
|
var init_payload = __esmMin((async () => {
|
|
77804
78425
|
await init_huri();
|
|
77805
78426
|
init_payload_builder();
|
|
@@ -77808,7 +78429,7 @@ var init_payload = __esmMin((async () => {
|
|
|
77808
78429
|
init_payload_wrapper();
|
|
77809
78430
|
}));
|
|
77810
78431
|
//#endregion
|
|
77811
|
-
//#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.2.
|
|
78432
|
+
//#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.2.2_@ariestools+sdk@8.1.3_@opentelemetry+api@1.9.1_zod_e3037e945b6aa9d20a93ce0deff04109/node_modules/@xyo-network/sdk-protocol-core/dist/neutral/boundwitness-builder.mjs
|
|
77812
78433
|
function missingSchemaMessage(payload) {
|
|
77813
78434
|
return `Builder: Missing Schema
|
|
77814
78435
|
${JSON.stringify(payload, null, 2)}`;
|
|
@@ -77847,6 +78468,9 @@ var init_boundwitness_builder = __esmMin((async () => {
|
|
|
77847
78468
|
_payloadHashes;
|
|
77848
78469
|
_payloadSchemas;
|
|
77849
78470
|
_payloads = [];
|
|
78471
|
+
/**
|
|
78472
|
+
* @param options - Optional builder options (schema is always the bound-witness schema)
|
|
78473
|
+
*/
|
|
77850
78474
|
constructor(options) {
|
|
77851
78475
|
super({
|
|
77852
78476
|
...options,
|
|
@@ -77858,6 +78482,12 @@ var init_boundwitness_builder = __esmMin((async () => {
|
|
|
77858
78482
|
assertEx(!fields.payload_hashes.includes(null), () => "nulls found in hashes");
|
|
77859
78483
|
assertEx(!fields.payload_schemas.includes(null), () => "nulls found in schemas");
|
|
77860
78484
|
}
|
|
78485
|
+
/**
|
|
78486
|
+
* Builds the generated linking fields from parties and payloads.
|
|
78487
|
+
* @param parties - Bound-witness parties (signers and/or participants)
|
|
78488
|
+
* @param payloads - Optional payloads to hash and schema-list
|
|
78489
|
+
* @returns Generated bound-witness linking fields
|
|
78490
|
+
*/
|
|
77861
78491
|
static async linkingFields(parties, payloads) {
|
|
77862
78492
|
const addresses = parties.map((party) => party.address.toLowerCase());
|
|
77863
78493
|
const previous_hashes = parties.map((party) => party.previousHash ?? null);
|
|
@@ -77868,9 +78498,21 @@ var init_boundwitness_builder = __esmMin((async () => {
|
|
|
77868
78498
|
previous_hashes
|
|
77869
78499
|
};
|
|
77870
78500
|
}
|
|
78501
|
+
/**
|
|
78502
|
+
* Returns the signature for an address in a signed bound witness.
|
|
78503
|
+
* @param payload - Signed bound witness
|
|
78504
|
+
* @param address - Address whose signature to read
|
|
78505
|
+
* @returns Signature hex for that address's slot
|
|
78506
|
+
*/
|
|
77871
78507
|
static signature(payload, address) {
|
|
77872
78508
|
return payload.$signatures[this.addressIndex(payload, address)];
|
|
77873
78509
|
}
|
|
78510
|
+
/**
|
|
78511
|
+
* Signs a data hash with each account, using each account's previous-hash bytes.
|
|
78512
|
+
* @param accounts - Accounts to sign with
|
|
78513
|
+
* @param dataHash - Bound-witness data hash to sign
|
|
78514
|
+
* @returns Hex signatures in account order
|
|
78515
|
+
*/
|
|
77874
78516
|
static async signatures(accounts, dataHash) {
|
|
77875
78517
|
const hashBytes = toArrayBuffer(dataHash);
|
|
77876
78518
|
const previousHashesBytes = accounts?.map((account) => account.previousHashBytes);
|
|
@@ -77878,27 +78520,44 @@ var init_boundwitness_builder = __esmMin((async () => {
|
|
|
77878
78520
|
return hexFromArrayBuffer((await account.sign(hashBytes, previousHashesBytes[index]))[0]);
|
|
77879
78521
|
}));
|
|
77880
78522
|
}
|
|
78523
|
+
/**
|
|
78524
|
+
* Index of an address in a bound witness's `addresses` array.
|
|
78525
|
+
* @param payload - Bound witness
|
|
78526
|
+
* @param address - Address to locate
|
|
78527
|
+
* @returns Zero-based index
|
|
78528
|
+
* @throws {Error} When the address is not listed
|
|
78529
|
+
*/
|
|
77881
78530
|
static addressIndex(payload, address) {
|
|
77882
78531
|
const index = payload.addresses.indexOf(address);
|
|
77883
78532
|
if (index === -1) throw new Error("Invalid address");
|
|
77884
78533
|
return index;
|
|
77885
78534
|
}
|
|
78535
|
+
/**
|
|
78536
|
+
* Previous hash recorded for an address in a bound witness.
|
|
78537
|
+
* @param boundWitness - Bound witness
|
|
78538
|
+
* @param address - Address whose previous hash to read
|
|
78539
|
+
* @returns Lowercased previous hash, or `undefined` when null/missing
|
|
78540
|
+
*/
|
|
77886
78541
|
static previousHash(boundWitness, address) {
|
|
77887
78542
|
return asHash(boundWitness.previous_hashes[this.addressIndex(boundWitness, address)])?.toLowerCase();
|
|
77888
78543
|
}
|
|
78544
|
+
/** Lowercased party addresses (throws if duplicates) */
|
|
77889
78545
|
get addresses() {
|
|
77890
78546
|
const addresses = this._parties.map((party) => party.address.toLowerCase());
|
|
77891
78547
|
uniqueAddresses(addresses, true);
|
|
77892
78548
|
return addresses;
|
|
77893
78549
|
}
|
|
78550
|
+
/** Explicit payload schemas when set via hashes, otherwise derived from attached payloads */
|
|
77894
78551
|
get payloadSchemas() {
|
|
77895
78552
|
return this._payloadSchemas ?? this._payloads.map((payload) => {
|
|
77896
78553
|
return assertEx(payload.schema, () => missingSchemaMessage(payload));
|
|
77897
78554
|
});
|
|
77898
78555
|
}
|
|
78556
|
+
/** Previous-hash bytes for each party (null when none) */
|
|
77899
78557
|
get previousHashBytes() {
|
|
77900
78558
|
return this._parties.map((party) => isSigningParty(party) ? party.previousHashBytes ?? null : party.previousHash == null ? null : toArrayBuffer(party.previousHash));
|
|
77901
78559
|
}
|
|
78560
|
+
/** Previous hashes for each party (null when none) */
|
|
77902
78561
|
get previousHashes() {
|
|
77903
78562
|
return this._parties.map((party) => party.previousHash ?? null);
|
|
77904
78563
|
}
|
|
@@ -77934,10 +78593,18 @@ var init_boundwitness_builder = __esmMin((async () => {
|
|
|
77934
78593
|
];
|
|
77935
78594
|
});
|
|
77936
78595
|
}
|
|
78596
|
+
/**
|
|
78597
|
+
* Data hash of the bound witness as currently configured (parties + payloads + fields).
|
|
78598
|
+
* @returns Data hash
|
|
78599
|
+
*/
|
|
77937
78600
|
async dataHash() {
|
|
77938
78601
|
const dataHashableFields = await this.dataHashableFields();
|
|
77939
78602
|
return await NodeObjectHasher.hash(dataHashableFields);
|
|
77940
78603
|
}
|
|
78604
|
+
/**
|
|
78605
|
+
* Builds data-hashable fields: custom fields plus generated linking fields.
|
|
78606
|
+
* @returns Data-hashable bound-witness fields
|
|
78607
|
+
*/
|
|
77941
78608
|
async dataHashableFields() {
|
|
77942
78609
|
const generatedFields = await _BoundWitnessBuilder.linkingFields(this._parties, this._payloads);
|
|
77943
78610
|
_BoundWitnessBuilder.validateGeneratedFields(generatedFields);
|
|
@@ -77947,17 +78614,32 @@ var init_boundwitness_builder = __esmMin((async () => {
|
|
|
77947
78614
|
};
|
|
77948
78615
|
return await _BoundWitnessBuilder.dataHashableFields(this._schema, fields);
|
|
77949
78616
|
}
|
|
78617
|
+
/**
|
|
78618
|
+
* Attaches a module error payload included with the built result.
|
|
78619
|
+
* @param payload - Error payload to attach
|
|
78620
|
+
* @returns `this` for chaining
|
|
78621
|
+
*/
|
|
77950
78622
|
error(payload) {
|
|
77951
78623
|
assertEx(this._errorHashes === void 0, () => "Can not set errors when hashes already set");
|
|
77952
78624
|
if (payload) this._errors.push(assertEx(sortFields(payload)));
|
|
77953
78625
|
return this;
|
|
77954
78626
|
}
|
|
78627
|
+
/**
|
|
78628
|
+
* Attaches multiple module error payloads (null entries skipped).
|
|
78629
|
+
* @param errors - Errors to attach
|
|
78630
|
+
* @returns `this` for chaining
|
|
78631
|
+
*/
|
|
77955
78632
|
errors(errors) {
|
|
77956
78633
|
if (errors) {
|
|
77957
78634
|
for (const error of errors) if (error !== null) this.error(error);
|
|
77958
78635
|
}
|
|
77959
78636
|
return this;
|
|
77960
78637
|
}
|
|
78638
|
+
/**
|
|
78639
|
+
* Sets custom bound-witness fields. Generated linking fields are stripped if present.
|
|
78640
|
+
* @param fields - Fields excluding schema, meta, and generated linking fields
|
|
78641
|
+
* @returns `this` for chaining
|
|
78642
|
+
*/
|
|
77961
78643
|
fields(fields) {
|
|
77962
78644
|
const clone = structuredClone(fields);
|
|
77963
78645
|
for (const field of GeneratedBoundWitnessFields) delete clone[field];
|
|
@@ -77966,17 +78648,35 @@ var init_boundwitness_builder = __esmMin((async () => {
|
|
|
77966
78648
|
this._fields = _BoundWitnessBuilder.omitStorageMeta(withoutClientMeta);
|
|
77967
78649
|
return this;
|
|
77968
78650
|
}
|
|
78651
|
+
/**
|
|
78652
|
+
* Sets payload hashes and schemas without attaching full payloads.
|
|
78653
|
+
* Mutually exclusive with {@link BoundWitnessBuilder.payload}.
|
|
78654
|
+
* @param hashes - Payload hashes (parallel to `schema`)
|
|
78655
|
+
* @param schema - Payload schemas (parallel to `hashes`)
|
|
78656
|
+
* @returns `this` for chaining
|
|
78657
|
+
*/
|
|
77969
78658
|
hashes(hashes, schema) {
|
|
77970
78659
|
assertEx(this.payloads.length === 0, () => "Can not set hashes when payloads already set");
|
|
77971
78660
|
this._payloadHashes = hashes;
|
|
77972
78661
|
this._payloadSchemas = schema;
|
|
77973
78662
|
return this;
|
|
77974
78663
|
}
|
|
78664
|
+
/**
|
|
78665
|
+
* Attaches a payload whose root hash and schema will be recorded on the bound witness.
|
|
78666
|
+
* Mutually exclusive with {@link BoundWitnessBuilder.hashes}.
|
|
78667
|
+
* @param payload - Payload to include
|
|
78668
|
+
* @returns `this` for chaining
|
|
78669
|
+
*/
|
|
77975
78670
|
payload(payload) {
|
|
77976
78671
|
assertEx(this._payloadHashes === void 0, () => "Can not set payloads when hashes already set");
|
|
77977
78672
|
if (payload) this._payloads.push(assertEx(sortFields(payload)));
|
|
77978
78673
|
return this;
|
|
77979
78674
|
}
|
|
78675
|
+
/**
|
|
78676
|
+
* Attaches multiple payloads (null entries skipped).
|
|
78677
|
+
* @param payloads - Payloads to include
|
|
78678
|
+
* @returns `this` for chaining
|
|
78679
|
+
*/
|
|
77980
78680
|
payloads(payloads) {
|
|
77981
78681
|
if (payloads) {
|
|
77982
78682
|
for (const payload of payloads) if (payload !== null) this.payload(payload);
|
|
@@ -77992,23 +78692,45 @@ var init_boundwitness_builder = __esmMin((async () => {
|
|
|
77992
78692
|
* Reserves a signature slot for a party identified by address only. The slot
|
|
77993
78693
|
* stays null through build(); the party fills it later with cosignBoundWitness.
|
|
77994
78694
|
* Slot order follows the order in which signers and participants are added.
|
|
78695
|
+
* @param participant - Address-only party
|
|
78696
|
+
* @returns `this` for chaining
|
|
77995
78697
|
*/
|
|
77996
78698
|
participant(participant) {
|
|
77997
78699
|
this.party(participant);
|
|
77998
78700
|
return this;
|
|
77999
78701
|
}
|
|
78702
|
+
/**
|
|
78703
|
+
* Reserves signature slots for multiple address-only parties.
|
|
78704
|
+
* @param participants - Address-only parties
|
|
78705
|
+
* @returns `this` for chaining
|
|
78706
|
+
*/
|
|
78000
78707
|
participants(participants) {
|
|
78001
78708
|
for (const participant of participants) this.party(participant);
|
|
78002
78709
|
return this;
|
|
78003
78710
|
}
|
|
78711
|
+
/**
|
|
78712
|
+
* Adds a local account that will sign at build time.
|
|
78713
|
+
* @param account - Account instance
|
|
78714
|
+
* @returns `this` for chaining
|
|
78715
|
+
*/
|
|
78004
78716
|
signer(account) {
|
|
78005
78717
|
this.party(account);
|
|
78006
78718
|
return this;
|
|
78007
78719
|
}
|
|
78720
|
+
/**
|
|
78721
|
+
* Adds multiple local accounts that will sign at build time.
|
|
78722
|
+
* @param accounts - Account instances
|
|
78723
|
+
* @returns `this` for chaining
|
|
78724
|
+
*/
|
|
78008
78725
|
signers(accounts) {
|
|
78009
78726
|
for (const account of accounts) this.party(account);
|
|
78010
78727
|
return this;
|
|
78011
78728
|
}
|
|
78729
|
+
/**
|
|
78730
|
+
* Sets client meta `$sourceQuery` to the given query hash.
|
|
78731
|
+
* @param sourceQuery - Source query hash
|
|
78732
|
+
* @returns `this` for chaining
|
|
78733
|
+
*/
|
|
78012
78734
|
sourceQuery(sourceQuery) {
|
|
78013
78735
|
this._meta = {
|
|
78014
78736
|
...this._meta,
|
|
@@ -78016,12 +78738,20 @@ var init_boundwitness_builder = __esmMin((async () => {
|
|
|
78016
78738
|
};
|
|
78017
78739
|
return this;
|
|
78018
78740
|
}
|
|
78019
|
-
/**
|
|
78741
|
+
/**
|
|
78742
|
+
* @deprecated Use {@link BoundWitnessBuilder.signer} instead
|
|
78743
|
+
* @param account - Account instance
|
|
78744
|
+
* @returns `this` for chaining
|
|
78745
|
+
*/
|
|
78020
78746
|
witness(account) {
|
|
78021
78747
|
this._parties.push(account);
|
|
78022
78748
|
return this;
|
|
78023
78749
|
}
|
|
78024
|
-
/**
|
|
78750
|
+
/**
|
|
78751
|
+
* @deprecated Use {@link BoundWitnessBuilder.signers} instead
|
|
78752
|
+
* @param accounts - Account instances
|
|
78753
|
+
* @returns `this` for chaining
|
|
78754
|
+
*/
|
|
78025
78755
|
witnesses(accounts) {
|
|
78026
78756
|
this._parties.push(...accounts);
|
|
78027
78757
|
return this;
|
|
@@ -78029,12 +78759,21 @@ var init_boundwitness_builder = __esmMin((async () => {
|
|
|
78029
78759
|
};
|
|
78030
78760
|
QueryBoundWitnessBuilder = class extends BoundWitnessBuilder {
|
|
78031
78761
|
_query;
|
|
78762
|
+
/**
|
|
78763
|
+
* Extends base data-hashable fields with the query payload's data hash.
|
|
78764
|
+
* @returns Data-hashable fields including `query`
|
|
78765
|
+
*/
|
|
78032
78766
|
async dataHashableFields() {
|
|
78033
78767
|
return {
|
|
78034
78768
|
...await super.dataHashableFields(),
|
|
78035
78769
|
query: await PayloadBuilder.dataHash(assertEx(this._query, () => "No Query Specified"))
|
|
78036
78770
|
};
|
|
78037
78771
|
}
|
|
78772
|
+
/**
|
|
78773
|
+
* Sets the query payload (also added as a bound-witness payload).
|
|
78774
|
+
* @param query - Query payload to bind
|
|
78775
|
+
* @returns `this` for chaining
|
|
78776
|
+
*/
|
|
78038
78777
|
query(query) {
|
|
78039
78778
|
this.payload(query);
|
|
78040
78779
|
this._query = query;
|
|
@@ -78043,7 +78782,7 @@ var init_boundwitness_builder = __esmMin((async () => {
|
|
|
78043
78782
|
};
|
|
78044
78783
|
}));
|
|
78045
78784
|
//#endregion
|
|
78046
|
-
//#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.2.
|
|
78785
|
+
//#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.2.2_@ariestools+sdk@8.1.3_@opentelemetry+api@1.9.1_zod_e3037e945b6aa9d20a93ce0deff04109/node_modules/@xyo-network/sdk-protocol-core/dist/neutral/boundwitness-validator.mjs
|
|
78047
78786
|
var boundWitnessArrayPropertyContains, addressesContains, validateArraysSameLength, BoundWitnessValidator;
|
|
78048
78787
|
var init_boundwitness_validator = __esmMin((async () => {
|
|
78049
78788
|
init_node$4();
|
|
@@ -78061,6 +78800,13 @@ var init_boundwitness_validator = __esmMin((async () => {
|
|
|
78061
78800
|
return a.length == b.length ? [] : [/* @__PURE__ */ new Error(`${message} [${a.length} !== ${b.length}]`)];
|
|
78062
78801
|
};
|
|
78063
78802
|
BoundWitnessValidator = class _BoundWitnessValidator extends PayloadValidator {
|
|
78803
|
+
/**
|
|
78804
|
+
* Verifies a single address/signature pair against a data-hash digest.
|
|
78805
|
+
* @param hash - Data-hash bytes that were signed
|
|
78806
|
+
* @param address - Claimed signer address
|
|
78807
|
+
* @param signature - Signature bytes, or missing
|
|
78808
|
+
* @returns Errors when the signature is missing or fails verification
|
|
78809
|
+
*/
|
|
78064
78810
|
static async validateSignature(hash, address, signature) {
|
|
78065
78811
|
if (!signature) return [/* @__PURE__ */ new Error(`Missing signature [${address}]`)];
|
|
78066
78812
|
if (!await verifySignature(address, hash, signature)) return [/* @__PURE__ */ new Error(`Invalid signature [${address}]`)];
|
|
@@ -78077,15 +78823,24 @@ var init_boundwitness_validator = __esmMin((async () => {
|
|
|
78077
78823
|
...errors
|
|
78078
78824
|
];
|
|
78079
78825
|
}
|
|
78826
|
+
/** Expected bound-witness schema URI */
|
|
78080
78827
|
get expectedSchema() {
|
|
78081
78828
|
return BoundWitnessSchema;
|
|
78082
78829
|
}
|
|
78830
|
+
/**
|
|
78831
|
+
* Validates that at least one address is present and all addresses are unique.
|
|
78832
|
+
* @returns Address-related errors
|
|
78833
|
+
*/
|
|
78083
78834
|
addresses() {
|
|
78084
78835
|
const errors = [...this.addressesUniqueness()];
|
|
78085
78836
|
const { addresses } = this.obj;
|
|
78086
78837
|
if ((addresses?.length ?? 0) === 0) errors.push(/* @__PURE__ */ new Error("addresses missing [at least one address required]"));
|
|
78087
78838
|
return errors;
|
|
78088
78839
|
}
|
|
78840
|
+
/**
|
|
78841
|
+
* Validates that `addresses` contains no duplicates.
|
|
78842
|
+
* @returns Uniqueness errors
|
|
78843
|
+
*/
|
|
78089
78844
|
addressesUniqueness() {
|
|
78090
78845
|
const errors = [];
|
|
78091
78846
|
const { addresses = [] } = this.obj;
|
|
@@ -78093,16 +78848,28 @@ var init_boundwitness_validator = __esmMin((async () => {
|
|
|
78093
78848
|
if (addresses?.length !== uniqAddresses?.length) errors.push(/* @__PURE__ */ new Error("addresses must be unique"));
|
|
78094
78849
|
return errors;
|
|
78095
78850
|
}
|
|
78851
|
+
/**
|
|
78852
|
+
* Validates that `previous_hashes` is an array aligned with `addresses`.
|
|
78853
|
+
* @returns Previous-hash structure errors
|
|
78854
|
+
*/
|
|
78096
78855
|
previousHashes() {
|
|
78097
78856
|
const { addresses = [], previous_hashes } = this.obj;
|
|
78098
78857
|
if (!Array.isArray(previous_hashes)) return [/* @__PURE__ */ new Error("previous_hashes missing [array required]")];
|
|
78099
78858
|
return validateArraysSameLength(previous_hashes, addresses, "Length mismatch: previous_hashes/addresses");
|
|
78100
78859
|
}
|
|
78860
|
+
/**
|
|
78861
|
+
* Validates that the payload schema is the bound-witness schema.
|
|
78862
|
+
* @returns Schema errors
|
|
78863
|
+
*/
|
|
78101
78864
|
schema() {
|
|
78102
78865
|
const errors = [];
|
|
78103
78866
|
if (this.obj.schema !== this.expectedSchema) errors.push(/* @__PURE__ */ new Error(`invalid schema [${this.expectedSchema} !== ${this.obj.schema}]`));
|
|
78104
78867
|
return errors;
|
|
78105
78868
|
}
|
|
78869
|
+
/**
|
|
78870
|
+
* Validates each entry in `payload_schemas` with the schema-name validator factory.
|
|
78871
|
+
* @returns Payload-schema name errors
|
|
78872
|
+
*/
|
|
78106
78873
|
schemas() {
|
|
78107
78874
|
const errors = [];
|
|
78108
78875
|
const Schemas = this.obj.payload_schemas;
|
|
@@ -78114,10 +78881,19 @@ var init_boundwitness_validator = __esmMin((async () => {
|
|
|
78114
78881
|
}
|
|
78115
78882
|
return errors;
|
|
78116
78883
|
}
|
|
78884
|
+
/**
|
|
78885
|
+
* Validates that `$signatures` aligns with `addresses` and each signature verifies
|
|
78886
|
+
* against the bound witness data hash.
|
|
78887
|
+
* @returns Signature errors
|
|
78888
|
+
*/
|
|
78117
78889
|
async signatures() {
|
|
78118
78890
|
const signatureErrors = await Promise.all(this.obj.addresses?.map(async (address, index) => _BoundWitnessValidator.validateSignature(toArrayBuffer(await PayloadBuilder.dataHash(this.payload)), address, toArrayBuffer(this.obj.$signatures?.[index] ?? void 0))) ?? []);
|
|
78119
78891
|
return [...validateArraysSameLength(this.obj.$signatures ?? [], this.obj.addresses ?? [], "Length mismatch: address/signature"), ...signatureErrors.flat()];
|
|
78120
78892
|
}
|
|
78893
|
+
/**
|
|
78894
|
+
* Runs all bound-witness structural and signature checks plus base payload validation.
|
|
78895
|
+
* @returns Combined validation errors
|
|
78896
|
+
*/
|
|
78121
78897
|
async validate() {
|
|
78122
78898
|
return [
|
|
78123
78899
|
...await this.signatures(),
|
|
@@ -78129,16 +78905,24 @@ var init_boundwitness_validator = __esmMin((async () => {
|
|
|
78129
78905
|
...await super.validate()
|
|
78130
78906
|
];
|
|
78131
78907
|
}
|
|
78908
|
+
/**
|
|
78909
|
+
* Validates parallel array length constraints for bound-witness fields.
|
|
78910
|
+
* @returns Array-length errors
|
|
78911
|
+
*/
|
|
78132
78912
|
validateArrayLengths() {
|
|
78133
78913
|
return [...this.validatePayloadHashesLength()];
|
|
78134
78914
|
}
|
|
78915
|
+
/**
|
|
78916
|
+
* Validates that `payload_hashes` and `payload_schemas` have the same length.
|
|
78917
|
+
* @returns Length-mismatch errors
|
|
78918
|
+
*/
|
|
78135
78919
|
validatePayloadHashesLength() {
|
|
78136
78920
|
return [...this.validateArrayLength("payload_hashes", "payload_schemas")];
|
|
78137
78921
|
}
|
|
78138
78922
|
};
|
|
78139
78923
|
}));
|
|
78140
78924
|
//#endregion
|
|
78141
|
-
//#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.2.
|
|
78925
|
+
//#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.2.2_@ariestools+sdk@8.1.3_@opentelemetry+api@1.9.1_zod_e3037e945b6aa9d20a93ce0deff04109/node_modules/@xyo-network/sdk-protocol-core/dist/neutral/boundwitness-wrapper.mjs
|
|
78142
78926
|
var isBoundWitnessWrapper, BoundWitnessWrapper, QueryBoundWitnessWrapper, SignatureRegEx, boundWitnessProperties, boundWitnessJsonSchema;
|
|
78143
78927
|
var init_boundwitness_wrapper = __esmMin((async () => {
|
|
78144
78928
|
init_node$4();
|
|
@@ -78156,24 +78940,50 @@ var init_boundwitness_wrapper = __esmMin((async () => {
|
|
|
78156
78940
|
BoundWitnessWrapper = class _BoundWitnessWrapper extends PayloadWrapperBase {
|
|
78157
78941
|
_payloadDataMap;
|
|
78158
78942
|
_payloadMap;
|
|
78943
|
+
/** Bound witness being wrapped (same object as {@link PayloadWrapperBase.payload}) */
|
|
78159
78944
|
boundwitness;
|
|
78945
|
+
/** Optional module error payloads associated with this bound witness */
|
|
78160
78946
|
moduleErrors;
|
|
78947
|
+
/** Payloads attached to this bound witness (not necessarily all referenced hashes) */
|
|
78161
78948
|
payloads = [];
|
|
78949
|
+
/**
|
|
78950
|
+
* @param boundwitness - Bound witness to wrap
|
|
78951
|
+
* @param payloads - Optional attached payloads
|
|
78952
|
+
* @param moduleErrors - Optional module error payloads
|
|
78953
|
+
*/
|
|
78162
78954
|
constructor(boundwitness, payloads = [], moduleErrors) {
|
|
78163
78955
|
super(boundwitness);
|
|
78164
78956
|
this.boundwitness = boundwitness;
|
|
78165
78957
|
this.payloads = payloads;
|
|
78166
78958
|
this.moduleErrors = moduleErrors;
|
|
78167
78959
|
}
|
|
78960
|
+
/**
|
|
78961
|
+
* Narrows `value` to this wrapper class when it is an instance.
|
|
78962
|
+
* @param value - Value to test
|
|
78963
|
+
* @returns The wrapper, or `undefined`
|
|
78964
|
+
*/
|
|
78168
78965
|
static as(value) {
|
|
78169
78966
|
return value instanceof this ? value : void 0;
|
|
78170
78967
|
}
|
|
78968
|
+
/**
|
|
78969
|
+
* Loads a bound witness by address via {@link PayloadWrapper.load}.
|
|
78970
|
+
* @param address - Address key for the loader
|
|
78971
|
+
* @returns Wrapped bound witness, or `null` if not found
|
|
78972
|
+
* @throws When the loaded payload is not a bound witness
|
|
78973
|
+
*/
|
|
78171
78974
|
static async load(address) {
|
|
78172
78975
|
const payload = (await PayloadWrapper.load(address))?.payload;
|
|
78173
78976
|
assertEx(payload && isBoundWitness(payload), () => "Attempt to load non-boundwitness");
|
|
78174
78977
|
const boundWitness = payload && isBoundWitness(payload) ? payload : void 0;
|
|
78175
78978
|
return boundWitness ? this.wrap(boundWitness) : null;
|
|
78176
78979
|
}
|
|
78980
|
+
/**
|
|
78981
|
+
* Parses a JSON string, object, or existing wrapper into a {@link BoundWitnessWrapper}.
|
|
78982
|
+
* @param obj - Value to parse
|
|
78983
|
+
* @param payloads - Optional payloads to attach
|
|
78984
|
+
* @returns Bound-witness wrapper
|
|
78985
|
+
* @throws When `obj` cannot be parsed as a bound witness
|
|
78986
|
+
*/
|
|
78177
78987
|
static parse(obj, payloads) {
|
|
78178
78988
|
let hydratedObj;
|
|
78179
78989
|
switch (typeof obj) {
|
|
@@ -78190,6 +79000,12 @@ var init_boundwitness_wrapper = __esmMin((async () => {
|
|
|
78190
79000
|
}
|
|
78191
79001
|
throw new Error(`Unable to parse [${typeof obj}]`);
|
|
78192
79002
|
}
|
|
79003
|
+
/**
|
|
79004
|
+
* Like {@link BoundWitnessWrapper.parse}, but returns `undefined` on failure or undefined input.
|
|
79005
|
+
* @param obj - Value to parse
|
|
79006
|
+
* @param payloads - Optional payloads to attach
|
|
79007
|
+
* @returns Bound-witness wrapper, or `undefined`
|
|
79008
|
+
*/
|
|
78193
79009
|
static tryParse(obj, payloads) {
|
|
78194
79010
|
if (obj === void 0) return void 0;
|
|
78195
79011
|
try {
|
|
@@ -78198,6 +79014,12 @@ var init_boundwitness_wrapper = __esmMin((async () => {
|
|
|
78198
79014
|
return;
|
|
78199
79015
|
}
|
|
78200
79016
|
}
|
|
79017
|
+
/**
|
|
79018
|
+
* Wraps a bound witness (or payload wrapper holding one) as a {@link BoundWitnessWrapper}.
|
|
79019
|
+
* @param obj - Bound witness or wrapper
|
|
79020
|
+
* @param payloads - Optional payloads to attach
|
|
79021
|
+
* @returns Bound-witness wrapper
|
|
79022
|
+
*/
|
|
78201
79023
|
static wrap(obj, payloads) {
|
|
78202
79024
|
switch (typeof obj) {
|
|
78203
79025
|
case "object":
|
|
@@ -78205,6 +79027,11 @@ var init_boundwitness_wrapper = __esmMin((async () => {
|
|
|
78205
79027
|
return obj instanceof PayloadWrapper && obj.schema() === BoundWitnessSchema ? this.parse(obj.payload, payloads) : this.parse(obj, payloads);
|
|
78206
79028
|
}
|
|
78207
79029
|
}
|
|
79030
|
+
/**
|
|
79031
|
+
* Maps bound witnesses to wrappers keyed by data hash.
|
|
79032
|
+
* @param boundWitnesses - Bound witnesses or wrappers to index
|
|
79033
|
+
* @returns Map of data hash string → wrapper
|
|
79034
|
+
*/
|
|
78208
79035
|
static async wrappedDataHashMap(boundWitnesses) {
|
|
78209
79036
|
const result = {};
|
|
78210
79037
|
await Promise.all(boundWitnesses.map(async (payload) => {
|
|
@@ -78214,18 +79041,27 @@ var init_boundwitness_wrapper = __esmMin((async () => {
|
|
|
78214
79041
|
}));
|
|
78215
79042
|
return result;
|
|
78216
79043
|
}
|
|
79044
|
+
/** Signer addresses on the bound witness */
|
|
78217
79045
|
get addresses() {
|
|
78218
79046
|
return this.boundwitness.addresses;
|
|
78219
79047
|
}
|
|
79048
|
+
/** Payload hashes recorded on the bound witness */
|
|
78220
79049
|
get payloadHashes() {
|
|
78221
79050
|
return this.boundwitness.payload_hashes;
|
|
78222
79051
|
}
|
|
79052
|
+
/** Payload schemas recorded on the bound witness (parallel to {@link BoundWitnessWrapper.payloadHashes}) */
|
|
78223
79053
|
get payloadSchemas() {
|
|
78224
79054
|
return this.boundwitness.payload_schemas;
|
|
78225
79055
|
}
|
|
79056
|
+
/** Previous hashes per address (parallel to {@link BoundWitnessWrapper.addresses}) */
|
|
78226
79057
|
get previousHashes() {
|
|
78227
79058
|
return this.boundwitness.previous_hashes;
|
|
78228
79059
|
}
|
|
79060
|
+
/**
|
|
79061
|
+
* Walks nested bound witnesses in the attached payloads.
|
|
79062
|
+
* @param depth - Remaining dig depth; `0` returns this wrapper; omit to dig until no inner BW
|
|
79063
|
+
* @returns Innermost (or depth-limited) bound-witness wrapper
|
|
79064
|
+
*/
|
|
78229
79065
|
async dig(depth) {
|
|
78230
79066
|
if (depth === 0) return this;
|
|
78231
79067
|
const innerBoundwitnessIndex = this.payloadSchemas.indexOf(BoundWitnessSchema);
|
|
@@ -78238,6 +79074,11 @@ var init_boundwitness_wrapper = __esmMin((async () => {
|
|
|
78238
79074
|
assertEx(depth === 0, () => `Dig failed [Remaining Depth: ${depth}]`);
|
|
78239
79075
|
return this;
|
|
78240
79076
|
}
|
|
79077
|
+
/**
|
|
79078
|
+
* Payload hashes from the bound witness that are not present among attached payloads
|
|
79079
|
+
* (matched by either root hash or data hash).
|
|
79080
|
+
* @returns Missing payload hashes
|
|
79081
|
+
*/
|
|
78241
79082
|
async getMissingPayloads() {
|
|
78242
79083
|
const dataHashMap = await this.payloadsDataHashMap();
|
|
78243
79084
|
const rootHashMap = await this.payloadsHashMap();
|
|
@@ -78246,43 +79087,90 @@ var init_boundwitness_wrapper = __esmMin((async () => {
|
|
|
78246
79087
|
return !Object.hasOwn(dataHashMap, hashKey) && !Object.hasOwn(rootHashMap, hashKey);
|
|
78247
79088
|
});
|
|
78248
79089
|
}
|
|
79090
|
+
/**
|
|
79091
|
+
* Wraps each attached payload as a {@link PayloadWrapper}.
|
|
79092
|
+
* @returns Wrapped payloads
|
|
79093
|
+
*/
|
|
78249
79094
|
async getWrappedPayloads() {
|
|
78250
79095
|
return this.payloads.map((payload) => PayloadWrapper.wrap(payload));
|
|
78251
79096
|
}
|
|
79097
|
+
/**
|
|
79098
|
+
* Payload hashes (from the bound witness) whose schema matches `schema`.
|
|
79099
|
+
* @param schema - Schema URI to match
|
|
79100
|
+
* @returns Matching payload hashes
|
|
79101
|
+
*/
|
|
78252
79102
|
hashesBySchema(schema) {
|
|
78253
79103
|
const result = [];
|
|
78254
79104
|
for (const [index, payloadSchema] of this.payloadSchemas.entries()) if (payloadSchema === schema) result.push(asHash(this.payloadHashes[index], true));
|
|
78255
79105
|
return result;
|
|
78256
79106
|
}
|
|
79107
|
+
/**
|
|
79108
|
+
* Resolves attached payloads by data hash.
|
|
79109
|
+
* @param hashes - Data hashes to resolve
|
|
79110
|
+
* @returns Payloads in the same order as `hashes`
|
|
79111
|
+
* @throws When a hash is not found among attached payloads
|
|
79112
|
+
*/
|
|
78257
79113
|
async payloadsByDataHashes(hashes) {
|
|
78258
79114
|
const map = await this.payloadsDataHashMap();
|
|
78259
79115
|
return hashes.map((hash) => {
|
|
78260
79116
|
return assertEx(map[String(hash)], () => "Hash not found");
|
|
78261
79117
|
});
|
|
78262
79118
|
}
|
|
79119
|
+
/**
|
|
79120
|
+
* Resolves attached payloads by root hash.
|
|
79121
|
+
* @param hashes - Root hashes to resolve
|
|
79122
|
+
* @returns Payloads in the same order as `hashes`
|
|
79123
|
+
* @throws When a hash is not found among attached payloads
|
|
79124
|
+
*/
|
|
78263
79125
|
async payloadsByHashes(hashes) {
|
|
78264
79126
|
const map = await this.payloadsHashMap();
|
|
78265
79127
|
return hashes.map((hash) => {
|
|
78266
79128
|
return assertEx(map[String(hash)], () => "Hash not found");
|
|
78267
79129
|
});
|
|
78268
79130
|
}
|
|
79131
|
+
/**
|
|
79132
|
+
* Filters attached payloads by schema.
|
|
79133
|
+
* @param schema - Schema URI to match
|
|
79134
|
+
* @returns Matching attached payloads
|
|
79135
|
+
*/
|
|
78269
79136
|
payloadsBySchema(schema) {
|
|
78270
79137
|
return this.payloads.filter((payload) => payload?.schema === schema);
|
|
78271
79138
|
}
|
|
79139
|
+
/**
|
|
79140
|
+
* Cached map of data hash → attached payload.
|
|
79141
|
+
* @returns Partial record of data hashes to payloads
|
|
79142
|
+
*/
|
|
78272
79143
|
async payloadsDataHashMap() {
|
|
78273
79144
|
this._payloadDataMap = this._payloadDataMap ?? await PayloadBuilder.toDataHashMap(this.payloads);
|
|
78274
79145
|
return this._payloadDataMap;
|
|
78275
79146
|
}
|
|
79147
|
+
/**
|
|
79148
|
+
* Cached map of root hash → attached payload.
|
|
79149
|
+
* @returns Partial record of root hashes to payloads
|
|
79150
|
+
*/
|
|
78276
79151
|
async payloadsHashMap() {
|
|
78277
79152
|
this._payloadMap = this._payloadMap ?? await PayloadBuilder.toHashMap(this.payloads);
|
|
78278
79153
|
return this._payloadMap;
|
|
78279
79154
|
}
|
|
79155
|
+
/**
|
|
79156
|
+
* Previous hash recorded for an address on this bound witness.
|
|
79157
|
+
* @param address - Address to look up
|
|
79158
|
+
* @returns Previous hash, or `undefined` when the address is absent / slot is null
|
|
79159
|
+
*/
|
|
78280
79160
|
prev(address) {
|
|
78281
79161
|
return this.previousHashes[this.addresses.indexOf(address)];
|
|
78282
79162
|
}
|
|
79163
|
+
/**
|
|
79164
|
+
* Tuple form of the wrapped bound witness and its attached payloads.
|
|
79165
|
+
* @returns `[boundWitness, payloads]`
|
|
79166
|
+
*/
|
|
78283
79167
|
toResult() {
|
|
78284
79168
|
return [this.boundwitness, this.payloads];
|
|
78285
79169
|
}
|
|
79170
|
+
/**
|
|
79171
|
+
* Validates the bound witness with {@link BoundWitnessValidator}.
|
|
79172
|
+
* @returns Validation errors
|
|
79173
|
+
*/
|
|
78286
79174
|
async validate() {
|
|
78287
79175
|
return await new BoundWitnessValidator(this.boundwitness).validate();
|
|
78288
79176
|
}
|
|
@@ -78290,6 +79178,13 @@ var init_boundwitness_wrapper = __esmMin((async () => {
|
|
|
78290
79178
|
QueryBoundWitnessWrapper = class _QueryBoundWitnessWrapper extends BoundWitnessWrapper {
|
|
78291
79179
|
_payloadsWithoutQuery;
|
|
78292
79180
|
_query;
|
|
79181
|
+
/**
|
|
79182
|
+
* Parses an object as a {@link QueryBoundWitnessWrapper}.
|
|
79183
|
+
* @param obj - Query bound witness or existing wrapper
|
|
79184
|
+
* @param payloads - Optional payloads to attach (should include the query payload)
|
|
79185
|
+
* @returns Query bound-witness wrapper
|
|
79186
|
+
* @throws When `obj` is an array or not a query bound witness
|
|
79187
|
+
*/
|
|
78293
79188
|
static parseQuery(obj, payloads) {
|
|
78294
79189
|
assertEx(!Array.isArray(obj), () => "Array can not be converted to QueryBoundWitnessWrapper");
|
|
78295
79190
|
switch (typeof obj) {
|
|
@@ -78302,6 +79197,11 @@ var init_boundwitness_wrapper = __esmMin((async () => {
|
|
|
78302
79197
|
}
|
|
78303
79198
|
throw new Error(`Unable to parse [${typeof obj}]`);
|
|
78304
79199
|
}
|
|
79200
|
+
/**
|
|
79201
|
+
* Like {@link QueryBoundWitnessWrapper.parseQuery}, but returns `undefined` on failure or undefined input.
|
|
79202
|
+
* @param obj - Value to parse
|
|
79203
|
+
* @returns Query bound-witness wrapper, or `undefined`
|
|
79204
|
+
*/
|
|
78305
79205
|
static tryParseQuery(obj) {
|
|
78306
79206
|
if (obj === void 0) return void 0;
|
|
78307
79207
|
try {
|
|
@@ -78310,6 +79210,10 @@ var init_boundwitness_wrapper = __esmMin((async () => {
|
|
|
78310
79210
|
return;
|
|
78311
79211
|
}
|
|
78312
79212
|
}
|
|
79213
|
+
/**
|
|
79214
|
+
* Attached payloads excluding the query payload (matched by the BW `query` hash).
|
|
79215
|
+
* @returns Wrapped non-query payloads
|
|
79216
|
+
*/
|
|
78313
79217
|
async getPayloadsWithoutQuery() {
|
|
78314
79218
|
if (!this._payloadsWithoutQuery) {
|
|
78315
79219
|
const payloadsWithoutQuery = await PayloadBuilder.filterExclude(this.payloads, asHash(this.payload.query, true));
|
|
@@ -78317,6 +79221,11 @@ var init_boundwitness_wrapper = __esmMin((async () => {
|
|
|
78317
79221
|
}
|
|
78318
79222
|
return this._payloadsWithoutQuery;
|
|
78319
79223
|
}
|
|
79224
|
+
/**
|
|
79225
|
+
* Resolves the query payload from attached payloads using the BW's `query` data hash.
|
|
79226
|
+
* @returns Query payload
|
|
79227
|
+
* @throws When the query payload is not among attached payloads
|
|
79228
|
+
*/
|
|
78320
79229
|
async getQuery() {
|
|
78321
79230
|
const payloadMap = await this.payloadsDataHashMap();
|
|
78322
79231
|
const queryHash = String(asHash(this.boundwitness.query, true));
|
|
@@ -78402,7 +79311,7 @@ var init_boundwitness_wrapper = __esmMin((async () => {
|
|
|
78402
79311
|
};
|
|
78403
79312
|
}));
|
|
78404
79313
|
//#endregion
|
|
78405
|
-
//#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.2.
|
|
79314
|
+
//#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.2.2_@ariestools+sdk@8.1.3_@opentelemetry+api@1.9.1_zod_e3037e945b6aa9d20a93ce0deff04109/node_modules/@xyo-network/sdk-protocol-core/dist/neutral/boundwitness.mjs
|
|
78406
79315
|
var init_boundwitness = __esmMin((async () => {
|
|
78407
79316
|
await init_boundwitness_builder();
|
|
78408
79317
|
init_boundwitness_model();
|
|
@@ -78424,7 +79333,7 @@ var init_config_payload_plugin = __esmMin((() => {
|
|
|
78424
79333
|
PayloadZodOfSchema(ConfigSchema);
|
|
78425
79334
|
}));
|
|
78426
79335
|
//#endregion
|
|
78427
|
-
//#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.2.
|
|
79336
|
+
//#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.2.2_@ariestools+sdk@8.1.3_@opentelemetry+api@1.9.1_zod_e3037e945b6aa9d20a93ce0deff04109/node_modules/@xyo-network/sdk-protocol-core/dist/node/core.mjs
|
|
78428
79337
|
var init_core = __esmMin((() => {
|
|
78429
79338
|
init_address$5();
|
|
78430
79339
|
init_data();
|
|
@@ -78433,7 +79342,7 @@ var init_core = __esmMin((() => {
|
|
|
78433
79342
|
init_wasm();
|
|
78434
79343
|
}));
|
|
78435
79344
|
//#endregion
|
|
78436
|
-
//#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.2.
|
|
79345
|
+
//#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.2.2_@ariestools+sdk@8.1.3_@opentelemetry+api@1.9.1_zod_e3037e945b6aa9d20a93ce0deff04109/node_modules/@xyo-network/sdk-protocol-core/dist/neutral/dns.mjs
|
|
78437
79346
|
var init_dns = __esmMin((() => {
|
|
78438
79347
|
init_node$4();
|
|
78439
79348
|
})), SchemaSchema, optionalStringZod$1, schemaDefinitionZod, SchemaPayloadZod, isSchemaPayload, init_schema_payload_plugin = __esmMin((() => {
|
|
@@ -78519,7 +79428,7 @@ var init_value_payload_plugin = __esmMin((() => {
|
|
|
78519
79428
|
PayloadZodOfSchema(ValueSchema);
|
|
78520
79429
|
}));
|
|
78521
79430
|
//#endregion
|
|
78522
|
-
//#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.2.
|
|
79431
|
+
//#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.2.2_@ariestools+sdk@8.1.3_@opentelemetry+api@1.9.1_zod_e3037e945b6aa9d20a93ce0deff04109/node_modules/@xyo-network/sdk-protocol-core/dist/neutral/core-payload-plugins.mjs
|
|
78523
79432
|
var init_core_payload_plugins = __esmMin((async () => {
|
|
78524
79433
|
init_config_payload_plugin();
|
|
78525
79434
|
await init_domain_payload_plugin();
|
|
@@ -78534,7 +79443,7 @@ var init_core_payload_plugins = __esmMin((async () => {
|
|
|
78534
79443
|
init_schema_payload_plugin();
|
|
78535
79444
|
}));
|
|
78536
79445
|
//#endregion
|
|
78537
|
-
//#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.2.
|
|
79446
|
+
//#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.2.2_@ariestools+sdk@8.1.3_@opentelemetry+api@1.9.1_zod_e3037e945b6aa9d20a93ce0deff04109/node_modules/@xyo-network/sdk-protocol-core/dist/neutral/key-model.mjs
|
|
78538
79447
|
var init_key_model = __esmMin((() => {}));
|
|
78539
79448
|
//#endregion
|
|
78540
79449
|
//#region ../../node_modules/.pnpm/@noble+hashes@2.2.0/node_modules/@noble/hashes/utils.js
|
|
@@ -80102,20 +81011,38 @@ var init_ml_dsa = __esmMin((() => {
|
|
|
80102
81011
|
}))();
|
|
80103
81012
|
}));
|
|
80104
81013
|
//#endregion
|
|
80105
|
-
//#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.2.
|
|
81014
|
+
//#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.2.2_@ariestools+sdk@8.1.3_@opentelemetry+api@1.9.1_zod_e3037e945b6aa9d20a93ce0deff04109/node_modules/@xyo-network/sdk-protocol-core/dist/neutral/pqc.mjs
|
|
80106
81015
|
var MlDsa;
|
|
80107
81016
|
var init_pqc = __esmMin((() => {
|
|
80108
81017
|
init_node$4();
|
|
80109
81018
|
init_ml_dsa();
|
|
80110
81019
|
init_data();
|
|
80111
81020
|
MlDsa = class {
|
|
81021
|
+
/** Concatenated public key + signature length in bytes. */
|
|
80112
81022
|
static bundleLength = 5261;
|
|
81023
|
+
/** ML-DSA-65 public key length in bytes. */
|
|
80113
81024
|
static publicKeyLength = 1952;
|
|
81025
|
+
/** ML-DSA-65 secret key length in bytes. */
|
|
80114
81026
|
static secretKeyLength = 4032;
|
|
81027
|
+
/** ML-DSA-65 signature length in bytes. */
|
|
80115
81028
|
static signatureLength = 3309;
|
|
81029
|
+
/**
|
|
81030
|
+
* Derives a 20-byte address payload from an ML-DSA public key
|
|
81031
|
+
* (keccak256 of the key, last 20 bytes — same truncation as eth-style).
|
|
81032
|
+
*
|
|
81033
|
+
* @param publicKey - ML-DSA public key bytes
|
|
81034
|
+
* @returns 20-byte address buffer
|
|
81035
|
+
*/
|
|
80116
81036
|
static addressFromPublicKey(publicKey) {
|
|
80117
81037
|
return new Data(publicKey.byteLength, publicKey).keccak256.slice(12);
|
|
80118
81038
|
}
|
|
81039
|
+
/**
|
|
81040
|
+
* Concatenates public key and signature into a single wire bundle.
|
|
81041
|
+
*
|
|
81042
|
+
* @param publicKey - ML-DSA public key bytes
|
|
81043
|
+
* @param signature - ML-DSA signature bytes
|
|
81044
|
+
* @returns Bundle buffer (`publicKey || signature`)
|
|
81045
|
+
*/
|
|
80119
81046
|
static bundle(publicKey, signature) {
|
|
80120
81047
|
const pk = toUint8Array(publicKey);
|
|
80121
81048
|
const sig = toUint8Array(signature);
|
|
@@ -80124,13 +81051,33 @@ var init_pqc = __esmMin((() => {
|
|
|
80124
81051
|
out.set(sig, pk.byteLength);
|
|
80125
81052
|
return out.buffer;
|
|
80126
81053
|
}
|
|
81054
|
+
/**
|
|
81055
|
+
* Generates an ML-DSA-65 key pair, optionally from a 32-byte seed.
|
|
81056
|
+
*
|
|
81057
|
+
* @param seed - Optional 32-byte seed for deterministic keygen
|
|
81058
|
+
* @returns Public and secret key pair
|
|
81059
|
+
*/
|
|
80127
81060
|
static keygen(seed) {
|
|
80128
81061
|
const seedBytes = seed === void 0 ? void 0 : toUint8Array(seed, 32);
|
|
80129
81062
|
return ml_dsa65.keygen(seedBytes);
|
|
80130
81063
|
}
|
|
81064
|
+
/**
|
|
81065
|
+
* Signs a message with an ML-DSA-65 secret key.
|
|
81066
|
+
*
|
|
81067
|
+
* @param secretKey - ML-DSA secret key bytes
|
|
81068
|
+
* @param message - Message bytes to sign
|
|
81069
|
+
* @returns Signature buffer
|
|
81070
|
+
*/
|
|
80131
81071
|
static sign(secretKey, message) {
|
|
80132
81072
|
return ml_dsa65.sign(toUint8Array(message), toUint8Array(secretKey)).buffer;
|
|
80133
81073
|
}
|
|
81074
|
+
/**
|
|
81075
|
+
* Splits a public-key + signature bundle into its components.
|
|
81076
|
+
*
|
|
81077
|
+
* @param bundle - Concatenated bundle of expected {@link MlDsa.bundleLength}
|
|
81078
|
+
* @returns Public key and signature slices
|
|
81079
|
+
* @throws If bundle length is wrong
|
|
81080
|
+
*/
|
|
80134
81081
|
static unbundle(bundle) {
|
|
80135
81082
|
if (bundle.byteLength !== this.bundleLength) throw new Error(`Invalid ML-DSA signature bundle length [${bundle.byteLength} !== ${this.bundleLength}]`);
|
|
80136
81083
|
const bytes = toUint8Array(bundle);
|
|
@@ -80139,6 +81086,14 @@ var init_pqc = __esmMin((() => {
|
|
|
80139
81086
|
signature: bytes.slice(this.publicKeyLength).buffer
|
|
80140
81087
|
};
|
|
80141
81088
|
}
|
|
81089
|
+
/**
|
|
81090
|
+
* Verifies an ML-DSA-65 signature over a message.
|
|
81091
|
+
*
|
|
81092
|
+
* @param publicKey - ML-DSA public key bytes
|
|
81093
|
+
* @param message - Message that was signed
|
|
81094
|
+
* @param signature - Signature bytes
|
|
81095
|
+
* @returns `true` if the signature is valid
|
|
81096
|
+
*/
|
|
80142
81097
|
static verify(publicKey, message, signature) {
|
|
80143
81098
|
return ml_dsa65.verify(toUint8Array(signature), toUint8Array(message), toUint8Array(publicKey));
|
|
80144
81099
|
}
|
|
@@ -80340,12 +81295,12 @@ var init_build = __esmMin((() => {
|
|
|
80340
81295
|
}));
|
|
80341
81296
|
}));
|
|
80342
81297
|
//#endregion
|
|
80343
|
-
//#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.2.
|
|
81298
|
+
//#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.2.2_@ariestools+sdk@8.1.3_@opentelemetry+api@1.9.1_zod_e3037e945b6aa9d20a93ce0deff04109/node_modules/@xyo-network/sdk-protocol-core/dist/neutral/previous-hash-store-indexeddb.mjs
|
|
80344
81299
|
var init_previous_hash_store_indexeddb = __esmMin((() => {
|
|
80345
81300
|
init_build();
|
|
80346
81301
|
}));
|
|
80347
81302
|
//#endregion
|
|
80348
|
-
//#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.2.
|
|
81303
|
+
//#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.2.2_@ariestools+sdk@8.1.3_@opentelemetry+api@1.9.1_zod_e3037e945b6aa9d20a93ce0deff04109/node_modules/@xyo-network/sdk-protocol-core/dist/neutral/previous-hash-store-model.mjs
|
|
80349
81304
|
var init_previous_hash_store_model = __esmMin((() => {})), InMemoryBackend;
|
|
80350
81305
|
var init_previous_hash_store_storage = __esmMin((() => {
|
|
80351
81306
|
InMemoryBackend = class {
|
|
@@ -80363,14 +81318,14 @@ var init_previous_hash_store_storage = __esmMin((() => {
|
|
|
80363
81318
|
new InMemoryBackend();
|
|
80364
81319
|
}));
|
|
80365
81320
|
//#endregion
|
|
80366
|
-
//#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.2.
|
|
81321
|
+
//#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.2.2_@ariestools+sdk@8.1.3_@opentelemetry+api@1.9.1_zod_e3037e945b6aa9d20a93ce0deff04109/node_modules/@xyo-network/sdk-protocol-core/dist/neutral/previous-hash-store.mjs
|
|
80367
81322
|
var init_previous_hash_store = __esmMin((() => {
|
|
80368
81323
|
init_previous_hash_store_indexeddb();
|
|
80369
81324
|
init_previous_hash_store_model();
|
|
80370
81325
|
init_previous_hash_store_storage();
|
|
80371
81326
|
}));
|
|
80372
81327
|
//#endregion
|
|
80373
|
-
//#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.2.
|
|
81328
|
+
//#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.2.2_@ariestools+sdk@8.1.3_@opentelemetry+api@1.9.1_zod_e3037e945b6aa9d20a93ce0deff04109/node_modules/@xyo-network/sdk-protocol-core/dist/neutral/quant-account.mjs
|
|
80374
81329
|
function buffersEqual(a, b) {
|
|
80375
81330
|
if (a.byteLength !== b.byteLength) return false;
|
|
80376
81331
|
const a1 = new Uint8Array(a);
|
|
@@ -80403,7 +81358,7 @@ var init_quant_account = __esmMin((() => {
|
|
|
80403
81358
|
registerVerifier("ml-dsa-65", async (address, hash, signatureBundle) => {
|
|
80404
81359
|
const { publicKey, signature } = MlDsa.unbundle(signatureBundle);
|
|
80405
81360
|
if (!buffersEqual(addressTo20Bytes(address), MlDsa.addressFromPublicKey(publicKey))) return false;
|
|
80406
|
-
return
|
|
81361
|
+
return MlDsa.verify(publicKey, hash, signature);
|
|
80407
81362
|
});
|
|
80408
81363
|
QuantAccount = class {
|
|
80409
81364
|
_address;
|
|
@@ -80412,6 +81367,7 @@ var init_quant_account = __esmMin((() => {
|
|
|
80412
81367
|
_previousHash;
|
|
80413
81368
|
_publicKey;
|
|
80414
81369
|
_secretKey;
|
|
81370
|
+
/** Signing algorithm for this account (`ml-dsa-65`). */
|
|
80415
81371
|
algorithm = "ml-dsa-65";
|
|
80416
81372
|
constructor(key, secretKey, publicKey) {
|
|
80417
81373
|
assertEx(key === QuantAccount._protectedConstructorKey, () => "Do not call this protected constructor");
|
|
@@ -80421,39 +81377,81 @@ var init_quant_account = __esmMin((() => {
|
|
|
80421
81377
|
const hrp = assertEx(hrpForAlgorithm("ml-dsa-65"), () => "No HRP registered for algorithm [ml-dsa-65]");
|
|
80422
81378
|
this._address = encodeQuantAddress(hrp, this._addressBytes);
|
|
80423
81379
|
}
|
|
81380
|
+
/**
|
|
81381
|
+
* Creates a quant account from an optional 32-byte seed or random keygen.
|
|
81382
|
+
*
|
|
81383
|
+
* Deduplicates by address so only one live instance exists per address, then
|
|
81384
|
+
* loads any configured previous-hash state.
|
|
81385
|
+
*
|
|
81386
|
+
* @param opts - Optional privateKey seed and previousHash
|
|
81387
|
+
* @returns A unique quant account instance for the derived address
|
|
81388
|
+
*/
|
|
80424
81389
|
static async create(opts) {
|
|
80425
81390
|
let seed;
|
|
80426
81391
|
if (opts && isPrivateKeyInitializationConfig(opts)) seed = toUint8Array(opts.privateKey, 32).buffer;
|
|
80427
81392
|
const keyPair = MlDsa.keygen(seed);
|
|
80428
81393
|
return await new QuantAccount(this._protectedConstructorKey, keyPair.secretKey, keyPair.publicKey).verifyUniqueAddress().loadPreviousHash(opts?.previousHash);
|
|
80429
81394
|
}
|
|
81395
|
+
/**
|
|
81396
|
+
* Creates a quant account from a 32-byte ML-DSA seed (private key material).
|
|
81397
|
+
*
|
|
81398
|
+
* @param key - Seed as buffer, bigint, or hex string
|
|
81399
|
+
* @returns Quant account instance for the derived address
|
|
81400
|
+
*/
|
|
80430
81401
|
static async fromPrivateKey(key) {
|
|
80431
81402
|
const privateKey = toUint8Array(key, 32).buffer;
|
|
80432
81403
|
return await this.create({ privateKey });
|
|
80433
81404
|
}
|
|
81405
|
+
/**
|
|
81406
|
+
* Returns whether the string is a bech32m quant address for ML-DSA-65.
|
|
81407
|
+
*
|
|
81408
|
+
* @param address - Candidate address string
|
|
81409
|
+
* @returns `true` if decode succeeds and HRP matches `ml-dsa-65`
|
|
81410
|
+
*/
|
|
80434
81411
|
static isAddress(address) {
|
|
80435
81412
|
return tryDecodeQuantAddress(address)?.hrp === hrpForAlgorithm("ml-dsa-65");
|
|
80436
81413
|
}
|
|
81414
|
+
/**
|
|
81415
|
+
* Creates a quant account with a random ML-DSA-65 key pair.
|
|
81416
|
+
*
|
|
81417
|
+
* @returns Fresh random quant account instance
|
|
81418
|
+
*/
|
|
80437
81419
|
static async random() {
|
|
80438
81420
|
return await this.create();
|
|
80439
81421
|
}
|
|
81422
|
+
/** Bech32m quant address (algorithm HRP + 20-byte payload). */
|
|
80440
81423
|
get address() {
|
|
80441
81424
|
return this._address;
|
|
80442
81425
|
}
|
|
81426
|
+
/** Raw 20-byte address payload bytes. */
|
|
80443
81427
|
get addressBytes() {
|
|
80444
81428
|
return this._addressBytes;
|
|
80445
81429
|
}
|
|
81430
|
+
/** Previous-hash anti-replay value as lowercase hex, or `undefined` if unset. */
|
|
80446
81431
|
get previousHash() {
|
|
80447
81432
|
return this.previousHashBytes ? toHex(this.previousHashBytes, { prefix: false }).toLowerCase() : void 0;
|
|
80448
81433
|
}
|
|
81434
|
+
/** Not supported — previous hash is advanced only via chained `sign`. */
|
|
80449
81435
|
set previousHash(_value) {}
|
|
81436
|
+
/** Previous-hash anti-replay value as raw bytes, or `undefined` if unset. */
|
|
80450
81437
|
get previousHashBytes() {
|
|
80451
81438
|
return this._previousHash;
|
|
80452
81439
|
}
|
|
81440
|
+
/** Not supported — previous hash is advanced only via chained `sign`. */
|
|
80453
81441
|
set previousHashBytes(_value) {}
|
|
81442
|
+
/** ML-DSA-65 public key bytes. */
|
|
80454
81443
|
get publicKey() {
|
|
80455
81444
|
return this._publicKey.buffer;
|
|
80456
81445
|
}
|
|
81446
|
+
/**
|
|
81447
|
+
* Loads the previous-hash chain state from the given value or the shared store.
|
|
81448
|
+
*
|
|
81449
|
+
* When `previousHash` is provided it is written through to the store so an
|
|
81450
|
+
* empty store cannot later clobber the explicit value at sign time.
|
|
81451
|
+
*
|
|
81452
|
+
* @param previousHash - Optional explicit previous hash (buffer or hex)
|
|
81453
|
+
* @returns This instance with chain state applied
|
|
81454
|
+
*/
|
|
80457
81455
|
async loadPreviousHash(previousHash) {
|
|
80458
81456
|
return await this._signingMutex.runExclusive(async () => {
|
|
80459
81457
|
if (isDefined(previousHash)) {
|
|
@@ -80497,18 +81495,39 @@ var init_quant_account = __esmMin((() => {
|
|
|
80497
81495
|
return [bundle, currentPreviousHash];
|
|
80498
81496
|
});
|
|
80499
81497
|
}
|
|
81498
|
+
/**
|
|
81499
|
+
* JWT signing is not implemented for ML-DSA-65 (no standard IANA JOSE algorithm yet).
|
|
81500
|
+
*
|
|
81501
|
+
* @param _options - Sign-JWT options (unused)
|
|
81502
|
+
* @returns Never resolves successfully
|
|
81503
|
+
* @throws Always — ML-DSA JWT is unsupported
|
|
81504
|
+
*/
|
|
80500
81505
|
async signJwt(_options) {
|
|
80501
|
-
|
|
81506
|
+
throw new Error("JWT signing is not implemented for ml-dsa-65 (no standard IANA JOSE alg yet)");
|
|
80502
81507
|
}
|
|
81508
|
+
/**
|
|
81509
|
+
* Verifies an ML-DSA-65 signature or public-key + signature bundle.
|
|
81510
|
+
*
|
|
81511
|
+
* Bundled signatures must derive to this account's address before verify.
|
|
81512
|
+
*
|
|
81513
|
+
* @param msg - Message that was signed
|
|
81514
|
+
* @param signature - Raw signature or ML-DSA bundle
|
|
81515
|
+
* @returns `true` if verification succeeds
|
|
81516
|
+
*/
|
|
80503
81517
|
async verify(msg, signature) {
|
|
80504
81518
|
if (signature.byteLength === MlDsa.bundleLength) {
|
|
80505
81519
|
const { publicKey, signature: sig } = MlDsa.unbundle(signature);
|
|
80506
81520
|
if (!buffersEqual(MlDsa.addressFromPublicKey(publicKey), this._addressBytes)) return false;
|
|
80507
|
-
return
|
|
81521
|
+
return MlDsa.verify(publicKey, msg, sig);
|
|
80508
81522
|
}
|
|
80509
|
-
if (signature.byteLength === MlDsa.signatureLength) return
|
|
80510
|
-
return
|
|
81523
|
+
if (signature.byteLength === MlDsa.signatureLength) return MlDsa.verify(this._publicKey.buffer, msg, signature);
|
|
81524
|
+
return false;
|
|
80511
81525
|
}
|
|
81526
|
+
/**
|
|
81527
|
+
* Ensures only one live quant account instance exists per address.
|
|
81528
|
+
*
|
|
81529
|
+
* @returns This instance if first for the address, otherwise the cached instance
|
|
81530
|
+
*/
|
|
80512
81531
|
verifyUniqueAddress() {
|
|
80513
81532
|
const address = this.address;
|
|
80514
81533
|
const existing = QuantAccount._addressMap[address]?.deref();
|
|
@@ -80519,6 +81538,7 @@ var init_quant_account = __esmMin((() => {
|
|
|
80519
81538
|
return existing;
|
|
80520
81539
|
}
|
|
80521
81540
|
};
|
|
81541
|
+
/** Shared store for previous-hash anti-replay values, keyed by address. */
|
|
80522
81542
|
__publicField$18(QuantAccount, "previousHashStore");
|
|
80523
81543
|
__publicField$18(QuantAccount, "_addressMap", {});
|
|
80524
81544
|
__publicField$18(QuantAccount, "_protectedConstructorKey", /* @__PURE__ */ Symbol());
|
|
@@ -82987,9 +84007,20 @@ zoo`.split("\n"));
|
|
|
82987
84007
|
__publicField$17 = (obj, key, value) => __defNormalProp$17(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
82988
84008
|
HDWallet = class extends Account {
|
|
82989
84009
|
node;
|
|
84010
|
+
/**
|
|
84011
|
+
* Not supported: Account holds an immutable private key, so a neutered
|
|
84012
|
+
* (public-only) HDWallet cannot be produced safely.
|
|
84013
|
+
*
|
|
84014
|
+
* @throws Always — use `extendedKey` with an xpub-capable consumer instead
|
|
84015
|
+
*/
|
|
82990
84016
|
neuter = () => {
|
|
82991
84017
|
throw new Error("neuter() is not supported for HDWallet [private key cannot be removed]; use extendedKey with an xpub-capable consumer instead");
|
|
82992
84018
|
};
|
|
84019
|
+
/**
|
|
84020
|
+
* @param key - Protected constructor key (use static factories)
|
|
84021
|
+
* @param node - Underlying ethers HD node
|
|
84022
|
+
* @param privateKey - secp256k1 private key for this node
|
|
84023
|
+
*/
|
|
82993
84024
|
constructor(key, node, privateKey) {
|
|
82994
84025
|
super(key, privateKey);
|
|
82995
84026
|
this.node = node;
|
|
@@ -83008,70 +84039,143 @@ zoo`.split("\n"));
|
|
|
83008
84039
|
this._addressMap[createdWallet.address] = ref;
|
|
83009
84040
|
return createdWallet;
|
|
83010
84041
|
}
|
|
84042
|
+
/**
|
|
84043
|
+
* Creates a wallet from phrase or mnemonic config (not from private key).
|
|
84044
|
+
*
|
|
84045
|
+
* @param opts - Phrase or mnemonic initialization config
|
|
84046
|
+
* @returns HD wallet instance
|
|
84047
|
+
* @throws If config is missing, or is a private-key config
|
|
84048
|
+
*/
|
|
83011
84049
|
static async create(opts) {
|
|
83012
84050
|
if (isPhraseInitializationConfig(opts)) return await this.fromPhrase(opts.phrase);
|
|
83013
84051
|
if (isMnemonicInitializationConfig(opts)) return await this.fromPhrase(opts.mnemonic, opts.path);
|
|
83014
84052
|
if (isPrivateKeyInitializationConfig(opts)) throw new Error("Invalid initialization config. from privateKey not supported. Use Account.fromPrivateKey instead.");
|
|
83015
84053
|
throw new Error("Invalid initialization config");
|
|
83016
84054
|
}
|
|
84055
|
+
/**
|
|
84056
|
+
* Creates a wallet from an existing ethers HD node.
|
|
84057
|
+
*
|
|
84058
|
+
* @param node - ethers `HDNodeWallet` at the desired path
|
|
84059
|
+
* @param previousHash - Optional previous-hash chain seed
|
|
84060
|
+
* @returns Wallet instance for the node's private key
|
|
84061
|
+
*/
|
|
83017
84062
|
static async createFromNode(node, previousHash) {
|
|
83018
84063
|
return await this.createFromNodeInternal(node, previousHash);
|
|
83019
84064
|
}
|
|
84065
|
+
/**
|
|
84066
|
+
* Creates a wallet from an xprv/xpub extended key string.
|
|
84067
|
+
*
|
|
84068
|
+
* @param key - BIP-32 extended key
|
|
84069
|
+
* @returns Wallet instance for the extended key node
|
|
84070
|
+
*/
|
|
83020
84071
|
static async fromExtendedKey(key) {
|
|
83021
84072
|
const node = HDNodeWallet.fromExtendedKey(key);
|
|
83022
84073
|
return await this.createFromNode(node);
|
|
83023
84074
|
}
|
|
84075
|
+
/**
|
|
84076
|
+
* Creates a wallet from a BIP-39 mnemonic at the given derivation path.
|
|
84077
|
+
*
|
|
84078
|
+
* @param mnemonic - ethers `Mnemonic` instance
|
|
84079
|
+
* @param path - BIP-32 path (defaults to ethers `defaultPath`)
|
|
84080
|
+
* @returns Wallet instance at that path
|
|
84081
|
+
*/
|
|
83024
84082
|
static async fromMnemonic(mnemonic, path = defaultPath) {
|
|
83025
84083
|
return await this.createFromNodeInternal(HDNodeWallet.fromMnemonic(mnemonic, path));
|
|
83026
84084
|
}
|
|
84085
|
+
/**
|
|
84086
|
+
* Creates a wallet from a BIP-39 mnemonic phrase string.
|
|
84087
|
+
*
|
|
84088
|
+
* @param phrase - Space-separated mnemonic words
|
|
84089
|
+
* @param path - BIP-32 path (defaults to ethers `defaultPath`)
|
|
84090
|
+
* @returns Wallet instance at that path
|
|
84091
|
+
*/
|
|
83027
84092
|
static async fromPhrase(phrase, path = defaultPath) {
|
|
83028
84093
|
return await this.fromMnemonic(Mnemonic.fromPhrase(phrase), path);
|
|
83029
84094
|
}
|
|
84095
|
+
/**
|
|
84096
|
+
* Creates a wallet from a BIP-32 master seed.
|
|
84097
|
+
*
|
|
84098
|
+
* @param seed - Seed bytes or hex string
|
|
84099
|
+
* @returns Wallet instance at the seed's master node
|
|
84100
|
+
*/
|
|
83030
84101
|
static async fromSeed(seed) {
|
|
83031
84102
|
return await this.createFromNodeInternal(HDNodeWallet.fromSeed(toUint8Array(seed)));
|
|
83032
84103
|
}
|
|
84104
|
+
/**
|
|
84105
|
+
* Generates a BIP-39 mnemonic phrase.
|
|
84106
|
+
*
|
|
84107
|
+
* @param wordlist - BIP-39 wordlist (default: English)
|
|
84108
|
+
* @param strength - Entropy bits (default 256 → 24 words)
|
|
84109
|
+
* @returns Mnemonic phrase string
|
|
84110
|
+
*/
|
|
83033
84111
|
static generateMnemonic(wordlist$10 = wordlist, strength = 256) {
|
|
83034
84112
|
return generateMnemonic(wordlist$10, strength);
|
|
83035
84113
|
}
|
|
84114
|
+
/**
|
|
84115
|
+
* Creates a wallet from a newly generated random mnemonic.
|
|
84116
|
+
*
|
|
84117
|
+
* @returns Fresh random HD wallet
|
|
84118
|
+
*/
|
|
83036
84119
|
static async random() {
|
|
83037
84120
|
return await this.fromMnemonic(Mnemonic.fromPhrase(this.generateMnemonic()));
|
|
83038
84121
|
}
|
|
84122
|
+
/** 20-byte eth-style address from the HD node (lowercase hex, no `0x`). */
|
|
83039
84123
|
get address() {
|
|
83040
84124
|
return asAddress(hexFromHexString(this.node.address, { prefix: false }), true);
|
|
83041
84125
|
}
|
|
84126
|
+
/** Raw 20-byte address bytes. */
|
|
83042
84127
|
get addressBytes() {
|
|
83043
84128
|
return toUint8Array(this.address, void 0, 16).buffer;
|
|
83044
84129
|
}
|
|
84130
|
+
/** BIP-32 chain code of this node. */
|
|
83045
84131
|
get chainCode() {
|
|
83046
84132
|
return this.node.chainCode;
|
|
83047
84133
|
}
|
|
84134
|
+
/** BIP-32 depth of this node. */
|
|
83048
84135
|
get depth() {
|
|
83049
84136
|
return this.node.depth;
|
|
83050
84137
|
}
|
|
84138
|
+
/** BIP-32 extended private/public key string for this node. */
|
|
83051
84139
|
get extendedKey() {
|
|
83052
84140
|
return this.node.extendedKey;
|
|
83053
84141
|
}
|
|
84142
|
+
/** BIP-32 fingerprint of this node. */
|
|
83054
84143
|
get fingerprint() {
|
|
83055
84144
|
return this.node.fingerprint;
|
|
83056
84145
|
}
|
|
84146
|
+
/** BIP-32 child index of this node. */
|
|
83057
84147
|
get index() {
|
|
83058
84148
|
return this.node.index;
|
|
83059
84149
|
}
|
|
84150
|
+
/** BIP-39 mnemonic attached to this node, if any. */
|
|
83060
84151
|
get mnemonic() {
|
|
83061
84152
|
return this.node.mnemonic;
|
|
83062
84153
|
}
|
|
84154
|
+
/** BIP-32 parent fingerprint. */
|
|
83063
84155
|
get parentFingerprint() {
|
|
83064
84156
|
return this.node.parentFingerprint;
|
|
83065
84157
|
}
|
|
84158
|
+
/** Absolute BIP-32 path of this node, or `null`. */
|
|
83066
84159
|
get path() {
|
|
83067
84160
|
return this.node.path;
|
|
83068
84161
|
}
|
|
84162
|
+
/** secp256k1 private key hex (lowercase, typically `0x`-prefixed from ethers). */
|
|
83069
84163
|
get privateKey() {
|
|
83070
84164
|
return this.node.privateKey.toLowerCase();
|
|
83071
84165
|
}
|
|
84166
|
+
/** secp256k1 public key hex (lowercase). */
|
|
83072
84167
|
get publicKey() {
|
|
83073
84168
|
return this.node.publicKey.toLowerCase();
|
|
83074
84169
|
}
|
|
84170
|
+
/**
|
|
84171
|
+
* Derives a child wallet at a relative or absolute path under this node.
|
|
84172
|
+
*
|
|
84173
|
+
* Absolute paths (`m/...`) must be under this wallet's current path.
|
|
84174
|
+
*
|
|
84175
|
+
* @param path - Relative path or absolute path under this node
|
|
84176
|
+
* @returns Child wallet instance
|
|
84177
|
+
* @throws If an absolute path is not under this wallet's path
|
|
84178
|
+
*/
|
|
83075
84179
|
async derivePath(path) {
|
|
83076
84180
|
if (path.startsWith("m/")) {
|
|
83077
84181
|
const parentPath = this.path;
|
|
@@ -83084,6 +84188,7 @@ zoo`.split("\n"));
|
|
|
83084
84188
|
return await HDWallet.createFromNode(this.node.derivePath(path));
|
|
83085
84189
|
}
|
|
83086
84190
|
};
|
|
84191
|
+
/** Globally unique class identifier for this wallet implementation. */
|
|
83087
84192
|
__publicField$17(HDWallet, "uniqueName", globallyUnique("HDWallet", HDWallet, "xyo"));
|
|
83088
84193
|
__publicField$17(HDWallet, "_addressMap", {});
|
|
83089
84194
|
HDWallet = __decorateClass$18([staticImplements()], HDWallet);
|
|
@@ -83127,12 +84232,12 @@ var init_network = __esmMin((() => {
|
|
|
83127
84232
|
PayloadZodOfSchema(NetworkSchema);
|
|
83128
84233
|
}));
|
|
83129
84234
|
//#endregion
|
|
83130
|
-
//#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.2.
|
|
84235
|
+
//#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.2.2_@ariestools+sdk@8.1.3_@opentelemetry+api@1.9.1_zod_e3037e945b6aa9d20a93ce0deff04109/node_modules/@xyo-network/sdk-protocol-core/dist/neutral/payload-utils.mjs
|
|
83131
84236
|
var init_payload_utils = __esmMin((() => {
|
|
83132
84237
|
init_hash();
|
|
83133
84238
|
}));
|
|
83134
84239
|
//#endregion
|
|
83135
|
-
//#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.2.
|
|
84240
|
+
//#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.2.2_@ariestools+sdk@8.1.3_@opentelemetry+api@1.9.1_zod_e3037e945b6aa9d20a93ce0deff04109/node_modules/@xyo-network/sdk-protocol-core/dist/neutral/protocol.mjs
|
|
83136
84241
|
var init_protocol$1 = __esmMin((async () => {
|
|
83137
84242
|
await init_boundwitness();
|
|
83138
84243
|
init_core();
|
|
@@ -83140,7 +84245,7 @@ var init_protocol$1 = __esmMin((async () => {
|
|
|
83140
84245
|
await init_payload();
|
|
83141
84246
|
}));
|
|
83142
84247
|
//#endregion
|
|
83143
|
-
//#region ../../node_modules/.pnpm/@ariestools+sdk@8.1.
|
|
84248
|
+
//#region ../../node_modules/.pnpm/@ariestools+sdk@8.1.3_@opentelemetry+api@1.9.1_zod@4.4.3/node_modules/@ariestools/sdk/dist/neutral/geo.mjs
|
|
83144
84249
|
function toMercatorLngLat(value) {
|
|
83145
84250
|
if (value instanceof MercatorLngLat) return value;
|
|
83146
84251
|
if (!value) return new MercatorLngLat(0, 0);
|
|
@@ -83419,7 +84524,7 @@ var init_geo = __esmMin((() => {
|
|
|
83419
84524
|
};
|
|
83420
84525
|
}));
|
|
83421
84526
|
//#endregion
|
|
83422
|
-
//#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.2.
|
|
84527
|
+
//#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.2.2_@ariestools+sdk@8.1.3_@opentelemetry+api@1.9.1_zod_e3037e945b6aa9d20a93ce0deff04109/node_modules/@xyo-network/sdk-protocol-core/dist/neutral/quadkey.mjs
|
|
83423
84528
|
function gridOffsetForDigit(digit, blockSize) {
|
|
83424
84529
|
switch (digit) {
|
|
83425
84530
|
case "1": return {
|
|
@@ -83464,26 +84569,52 @@ var init_quadkey = __esmMin((() => {
|
|
|
83464
84569
|
assertEx(value < 2n ** bits && value >= 0, () => "Not a 256 Bit Uint!");
|
|
83465
84570
|
};
|
|
83466
84571
|
(class _Quadkey {
|
|
84572
|
+
/** Zero id at zoom 0. */
|
|
83467
84573
|
static Zero = _Quadkey.from(0, 0n);
|
|
84574
|
+
/** Empty root quadkey (zoom 0, id 0). */
|
|
83468
84575
|
static root = new _Quadkey();
|
|
84576
|
+
/** Runtime type marker for {@link isQuadkey}. */
|
|
83469
84577
|
static type = "Quadkey";
|
|
83470
84578
|
_geoJson;
|
|
84579
|
+
/** Packed key: zoom in the top byte, id in the lower 248 bits. */
|
|
83471
84580
|
key;
|
|
84581
|
+
/** Instance type marker (`'Quadkey'`). */
|
|
83472
84582
|
type = _Quadkey.type;
|
|
84583
|
+
/**
|
|
84584
|
+
* @param key - Packed 256-bit key (zoom + id); bare ids may trigger zoom guessing
|
|
84585
|
+
*/
|
|
83473
84586
|
constructor(key = 0n) {
|
|
83474
84587
|
assertMaxBitUint(key);
|
|
83475
84588
|
this.key = key;
|
|
83476
84589
|
if (this.zoom === 0 && this.id !== 0n) this.guessZoom();
|
|
83477
84590
|
}
|
|
84591
|
+
/**
|
|
84592
|
+
* Build a quadkey from zoom and tile id.
|
|
84593
|
+
* @param zoom - Zoom level
|
|
84594
|
+
* @param id - Base-4 tile id as bigint
|
|
84595
|
+
*/
|
|
83478
84596
|
static from(zoom, id) {
|
|
83479
84597
|
return new _Quadkey().setId(id).setZoom(zoom);
|
|
83480
84598
|
}
|
|
84599
|
+
/**
|
|
84600
|
+
* Build a quadkey from zoom and a big-endian id buffer.
|
|
84601
|
+
* @param zoom - Zoom level
|
|
84602
|
+
* @param id - Id bytes
|
|
84603
|
+
*/
|
|
83481
84604
|
static fromArrayBuffer(zoom, id) {
|
|
83482
84605
|
return new _Quadkey().setId(BigInt(hexFromArrayBuffer(id, { prefix: true }))).setZoom(zoom);
|
|
83483
84606
|
}
|
|
84607
|
+
/**
|
|
84608
|
+
* Parse a hex-encoded packed key (zoom may be guessed from id).
|
|
84609
|
+
* @param value - Hex string
|
|
84610
|
+
*/
|
|
83484
84611
|
static fromBase16String(value) {
|
|
83485
84612
|
return new _Quadkey(BigInt(hexFromHexString(value, { prefix: true })));
|
|
83486
84613
|
}
|
|
84614
|
+
/**
|
|
84615
|
+
* Parse a Microsoft-style base-4 quadkey string (`''`/`fhr` → root).
|
|
84616
|
+
* @param value - Base-4 digit string
|
|
84617
|
+
*/
|
|
83487
84618
|
static fromBase4String(value) {
|
|
83488
84619
|
if (value === void 0 || ["fhr", ""].includes(value)) return this.root;
|
|
83489
84620
|
let id = 0n;
|
|
@@ -83494,44 +84625,71 @@ var init_quadkey = __esmMin((() => {
|
|
|
83494
84625
|
}
|
|
83495
84626
|
return new _Quadkey().setId(id).setZoom(value.length);
|
|
83496
84627
|
}
|
|
84628
|
+
/**
|
|
84629
|
+
* All tiles covering `boundingBox` at the given zoom as quadkeys.
|
|
84630
|
+
* @param boundingBox - Mercator bounding box
|
|
84631
|
+
* @param zoom - Target zoom (floored)
|
|
84632
|
+
*/
|
|
83497
84633
|
static fromBoundingBox(boundingBox, zoom) {
|
|
83498
84634
|
const tiles = tilesFromBoundingBox(boundingBox, Math.floor(zoom));
|
|
83499
84635
|
return Array.from(tiles, (tile) => assertEx(this.fromTile(tile), () => "Bad Quadkey"));
|
|
83500
84636
|
}
|
|
84637
|
+
/**
|
|
84638
|
+
* Quadkey for the tile containing `point` at `zoom`.
|
|
84639
|
+
* @param point - Lng/lat
|
|
84640
|
+
* @param zoom - Target zoom
|
|
84641
|
+
*/
|
|
83501
84642
|
static fromLngLat(point, zoom) {
|
|
83502
84643
|
const quadkeyString = tileToQuadkey(tileFromPoint(point, zoom));
|
|
83503
84644
|
return this.fromBase4String(quadkeyString);
|
|
83504
84645
|
}
|
|
84646
|
+
/**
|
|
84647
|
+
* Parse an id string at the given base (currently base 16 only) and zoom.
|
|
84648
|
+
* @param zoom - Zoom level
|
|
84649
|
+
* @param id - Id string
|
|
84650
|
+
* @param base - Numeric base (default 16)
|
|
84651
|
+
*/
|
|
83505
84652
|
static fromString(zoom, id, base = 16) {
|
|
83506
84653
|
switch (base) {
|
|
83507
84654
|
case 16: return this.fromBase16String(id).setZoom(zoom);
|
|
83508
84655
|
default: throw new Error(`Invalid base [${base}]`);
|
|
83509
84656
|
}
|
|
83510
84657
|
}
|
|
84658
|
+
/**
|
|
84659
|
+
* Convert a mercator tile `[x, y, z]` to a quadkey.
|
|
84660
|
+
* @param tile - Mercator tile
|
|
84661
|
+
*/
|
|
83511
84662
|
static fromTile(tile) {
|
|
83512
84663
|
return this.fromBase4String(tileToQuadkey(tile));
|
|
83513
84664
|
}
|
|
84665
|
+
/** Tile id as a base-10 string. */
|
|
83514
84666
|
get base10String() {
|
|
83515
84667
|
return this.id.toString(10);
|
|
83516
84668
|
}
|
|
84669
|
+
/** Tile id as a zero-padded 62-char hex string. */
|
|
83517
84670
|
get base16String() {
|
|
83518
84671
|
return this.id.toString(16).padStart(62, "0");
|
|
83519
84672
|
}
|
|
84673
|
+
/** Microsoft-style base-4 quadkey string (empty at root). */
|
|
83520
84674
|
get base4Hash() {
|
|
83521
84675
|
if (this.id === 0n && this.zoom === 0) return "";
|
|
83522
84676
|
return this.id.toString(4).padStart(this.zoom, "0");
|
|
83523
84677
|
}
|
|
84678
|
+
/** Label form of {@link base4Hash} (`'fhr'` when empty). */
|
|
83524
84679
|
get base4HashLabel() {
|
|
83525
84680
|
const hash = this.base4Hash;
|
|
83526
84681
|
return hash.length === 0 ? "fhr" : hash;
|
|
83527
84682
|
}
|
|
84683
|
+
/** Geographic bounding box of this tile. */
|
|
83528
84684
|
get boundingBox() {
|
|
83529
84685
|
return tileToBoundingBox(this.tile);
|
|
83530
84686
|
}
|
|
84687
|
+
/** Geographic center of this tile. */
|
|
83531
84688
|
get center() {
|
|
83532
84689
|
const result = boundingBoxToCenter(this.boundingBox);
|
|
83533
84690
|
return new MercatorLngLat(result[0], result[1]);
|
|
83534
84691
|
}
|
|
84692
|
+
/** The four child tiles at zoom + 1. */
|
|
83535
84693
|
get children() {
|
|
83536
84694
|
assertEx(this.zoom < MAX_ZOOM - 1, () => "Can not get children of bottom tiles");
|
|
83537
84695
|
const result = [];
|
|
@@ -83542,6 +84700,7 @@ var init_quadkey = __esmMin((() => {
|
|
|
83542
84700
|
}
|
|
83543
84701
|
return result;
|
|
83544
84702
|
}
|
|
84703
|
+
/** Grid location `{ col, row, zoom }` derived from the base-4 hash. */
|
|
83545
84704
|
get gridLocation() {
|
|
83546
84705
|
const tileData = tileFromQuadkey(this.base4Hash);
|
|
83547
84706
|
return {
|
|
@@ -83550,27 +84709,37 @@ var init_quadkey = __esmMin((() => {
|
|
|
83550
84709
|
zoom: tileData[2]
|
|
83551
84710
|
};
|
|
83552
84711
|
}
|
|
84712
|
+
/** Tile id (lower 248 bits of {@link key}). */
|
|
83553
84713
|
get id() {
|
|
83554
84714
|
return this.key & ID_MASK;
|
|
83555
84715
|
}
|
|
84716
|
+
/** Parent tile at zoom - 1, or `undefined` at zoom 0. */
|
|
83556
84717
|
get parent() {
|
|
83557
84718
|
if (this.zoom <= 0) return;
|
|
83558
84719
|
return new _Quadkey().setId(this.id >> 2n).setZoom(this.zoom - 1);
|
|
83559
84720
|
}
|
|
84721
|
+
/** The three sibling tiles sharing the same parent. */
|
|
83560
84722
|
get siblings() {
|
|
83561
84723
|
const filteredSiblings = assertEx(this.parent?.children, () => `siblings: parentChildren ${this.base4Hash}`).filter((quadkey) => quadkey.key !== this.key);
|
|
83562
84724
|
assertEx(filteredSiblings.length === 3, () => `siblings: expected 3 [${filteredSiblings.length}]`);
|
|
83563
84725
|
return filteredSiblings;
|
|
83564
84726
|
}
|
|
84727
|
+
/** Mercator tile `[x, y, z]` for this quadkey. */
|
|
83565
84728
|
get tile() {
|
|
83566
84729
|
return tileFromQuadkey(this.base4Hash);
|
|
83567
84730
|
}
|
|
84731
|
+
/** Whether zoom/id are in range (id fits within zoom digit count). */
|
|
83568
84732
|
get valid() {
|
|
83569
84733
|
return this.zoom < MAX_ZOOM && this.id < 4n ** BigInt(this.zoom);
|
|
83570
84734
|
}
|
|
84735
|
+
/** Zoom level stored in the top byte of {@link key}. */
|
|
83571
84736
|
get zoom() {
|
|
83572
84737
|
return Number((this.key & ZOOM_MASK) >> 248n);
|
|
83573
84738
|
}
|
|
84739
|
+
/**
|
|
84740
|
+
* All descendant tiles at exactly `zoom` (or `[this]` when zoom equals current).
|
|
84741
|
+
* @param zoom - Target zoom ≥ current zoom
|
|
84742
|
+
*/
|
|
83574
84743
|
childrenByZoom(zoom) {
|
|
83575
84744
|
assertEx(zoom >= this.zoom && zoom < MAX_ZOOM, () => `childrenByZoom: zoom must be in [${this.zoom}, ${MAX_ZOOM}) [${zoom}]`);
|
|
83576
84745
|
if (zoom === this.zoom) return [this];
|
|
@@ -83578,16 +84747,26 @@ var init_quadkey = __esmMin((() => {
|
|
|
83578
84747
|
for (const quadkey of this.children) deepResult = [...deepResult, ...quadkey.childrenByZoom(zoom)];
|
|
83579
84748
|
return deepResult;
|
|
83580
84749
|
}
|
|
84750
|
+
/** Shallow copy with the same packed key. */
|
|
83581
84751
|
clone() {
|
|
83582
84752
|
return new _Quadkey(this.key);
|
|
83583
84753
|
}
|
|
84754
|
+
/**
|
|
84755
|
+
* Key equality.
|
|
84756
|
+
* @param obj - Other quadkey
|
|
84757
|
+
*/
|
|
83584
84758
|
equals(obj) {
|
|
83585
84759
|
return obj.key === this.key;
|
|
83586
84760
|
}
|
|
84761
|
+
/** Lazily built GeoJSON helper for this tile. */
|
|
83587
84762
|
geoJson() {
|
|
83588
84763
|
this._geoJson = this._geoJson ?? new GeoJson(this.base4Hash);
|
|
83589
84764
|
return this._geoJson;
|
|
83590
84765
|
}
|
|
84766
|
+
/**
|
|
84767
|
+
* Pixel-space bounding box within a square grid of `size`.
|
|
84768
|
+
* @param size - Full grid size in pixels
|
|
84769
|
+
*/
|
|
83591
84770
|
getGridBoundingBox(size) {
|
|
83592
84771
|
const hash = this.base4Hash;
|
|
83593
84772
|
let index = 0;
|
|
@@ -83613,6 +84792,10 @@ var init_quadkey = __esmMin((() => {
|
|
|
83613
84792
|
getGridLocation() {
|
|
83614
84793
|
return this.gridLocation;
|
|
83615
84794
|
}
|
|
84795
|
+
/**
|
|
84796
|
+
* Whether any corner of this tile lies inside `boundingBox`.
|
|
84797
|
+
* @param boundingBox - Geographic box to test
|
|
84798
|
+
*/
|
|
83616
84799
|
isInBoundingBox(boundingBox) {
|
|
83617
84800
|
const tileBoundingBox = tileToBoundingBox(this.tile);
|
|
83618
84801
|
return boundingBox.contains(tileBoundingBox.getNorthEast()) || boundingBox.contains(tileBoundingBox.getNorthWest()) || boundingBox.contains(tileBoundingBox.getSouthEast()) || boundingBox.contains(tileBoundingBox.getSouthWest());
|
|
@@ -83630,25 +84813,40 @@ var init_quadkey = __esmMin((() => {
|
|
|
83630
84813
|
z
|
|
83631
84814
|
]);
|
|
83632
84815
|
}
|
|
84816
|
+
/**
|
|
84817
|
+
* Set the tile id (preserves zoom).
|
|
84818
|
+
* @param id - Base-4 tile id
|
|
84819
|
+
*/
|
|
83633
84820
|
setId(id) {
|
|
83634
84821
|
assertMaxBitUint(id, 248n);
|
|
83635
84822
|
this.setKey(this.zoom, id);
|
|
83636
84823
|
return this;
|
|
83637
84824
|
}
|
|
84825
|
+
/**
|
|
84826
|
+
* Replace packed key then set zoom.
|
|
84827
|
+
* @param zoom - Zoom level
|
|
84828
|
+
* @param key - Packed or bare id bits
|
|
84829
|
+
*/
|
|
83638
84830
|
setKey(zoom, key) {
|
|
83639
84831
|
assertMaxBitUint(key);
|
|
83640
84832
|
this.key = key;
|
|
83641
84833
|
this.setZoom(zoom);
|
|
83642
84834
|
return this;
|
|
83643
84835
|
}
|
|
84836
|
+
/**
|
|
84837
|
+
* Set zoom in the top byte (preserves id bits).
|
|
84838
|
+
* @param zoom - Zoom level (< 124)
|
|
84839
|
+
*/
|
|
83644
84840
|
setZoom(zoom) {
|
|
83645
84841
|
assertEx(zoom < MAX_ZOOM, () => `Invalid zoom [${zoom}] max=${MAX_ZOOM}`);
|
|
83646
84842
|
this.key = this.key & ID_MASK | BigInt(zoom) << 248n;
|
|
83647
84843
|
return this;
|
|
83648
84844
|
}
|
|
84845
|
+
/** JSON serialization uses {@link base4HashLabel}. */
|
|
83649
84846
|
toJSON() {
|
|
83650
84847
|
return this.base4HashLabel;
|
|
83651
84848
|
}
|
|
84849
|
+
/** String form is the base-4 hash. */
|
|
83652
84850
|
toString() {
|
|
83653
84851
|
return this.base4Hash;
|
|
83654
84852
|
}
|
|
@@ -83659,7 +84857,7 @@ var init_quadkey = __esmMin((() => {
|
|
|
83659
84857
|
});
|
|
83660
84858
|
}));
|
|
83661
84859
|
//#endregion
|
|
83662
|
-
//#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.2.
|
|
84860
|
+
//#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.2.2_@ariestools+sdk@8.1.3_@opentelemetry+api@1.9.1_zod_e3037e945b6aa9d20a93ce0deff04109/node_modules/@xyo-network/sdk-protocol-core/dist/neutral/quant-wallet.mjs
|
|
83663
84861
|
function bip85DefaultLeafTail(index = 0) {
|
|
83664
84862
|
return `${BIP85_PURPOSE}/${BIP85_HEX_APP}/32'/${index}'`;
|
|
83665
84863
|
}
|
|
@@ -83701,11 +84899,17 @@ var init_quant_wallet = __esmMin((() => {
|
|
|
83701
84899
|
BIP85_HEX_APP = "128169'";
|
|
83702
84900
|
BIP85_HMAC_KEY = "bip-entropy-from-k";
|
|
83703
84901
|
QuantHDWallet = class {
|
|
84902
|
+
/** Signing algorithm for derived accounts (`ml-dsa-65`). */
|
|
83704
84903
|
algorithm = "ml-dsa-65";
|
|
83705
84904
|
_account;
|
|
83706
84905
|
_master;
|
|
83707
84906
|
_seed;
|
|
83708
84907
|
node;
|
|
84908
|
+
/**
|
|
84909
|
+
* Not implemented for ML-DSA-65 HD wallets.
|
|
84910
|
+
*
|
|
84911
|
+
* @throws Always
|
|
84912
|
+
*/
|
|
83709
84913
|
neuter = () => {
|
|
83710
84914
|
throw new Error("neuter() is not implemented for ml-dsa-65 HD wallets");
|
|
83711
84915
|
};
|
|
@@ -83716,6 +84920,13 @@ var init_quant_wallet = __esmMin((() => {
|
|
|
83716
84920
|
this._seed = seed;
|
|
83717
84921
|
this._account = account;
|
|
83718
84922
|
}
|
|
84923
|
+
/**
|
|
84924
|
+
* Creates a quant HD wallet from phrase or mnemonic config (not private key).
|
|
84925
|
+
*
|
|
84926
|
+
* @param opts - Phrase or mnemonic initialization config
|
|
84927
|
+
* @returns Quant HD wallet instance
|
|
84928
|
+
* @throws If config is missing, or is a private-key config
|
|
84929
|
+
*/
|
|
83719
84930
|
static async create(opts) {
|
|
83720
84931
|
if (isPhraseInitializationConfig(opts)) return await this.fromPhrase(opts.phrase);
|
|
83721
84932
|
if (isMnemonicInitializationConfig(opts)) return await this.fromPhrase(opts.mnemonic, opts.path);
|
|
@@ -83730,77 +84941,148 @@ var init_quant_wallet = __esmMin((() => {
|
|
|
83730
84941
|
});
|
|
83731
84942
|
return new QuantHDWallet(this._protectedConstructorKey, node, master, seed, account).verifyUniqueWallet();
|
|
83732
84943
|
}
|
|
84944
|
+
/**
|
|
84945
|
+
* Creates a wallet from an xprv/xpub extended key.
|
|
84946
|
+
*
|
|
84947
|
+
* Root (depth 0) keys retain a master node so absolute BIP-85 paths can resolve.
|
|
84948
|
+
*
|
|
84949
|
+
* @param key - BIP-32 extended key
|
|
84950
|
+
* @returns Quant HD wallet for the node
|
|
84951
|
+
*/
|
|
83733
84952
|
static async fromExtendedKey(key) {
|
|
83734
84953
|
const node = HDNodeWallet.fromExtendedKey(key);
|
|
83735
84954
|
const master = node.depth === 0 ? node : void 0;
|
|
83736
84955
|
return await this.createFromNode(node, master);
|
|
83737
84956
|
}
|
|
84957
|
+
/**
|
|
84958
|
+
* Creates a wallet from a BIP-39 mnemonic at the given path.
|
|
84959
|
+
*
|
|
84960
|
+
* @param mnemonic - ethers `Mnemonic` instance
|
|
84961
|
+
* @param path - BIP-32 path (defaults to ethers `defaultPath`)
|
|
84962
|
+
* @returns Quant HD wallet with BIP-85-derived ML-DSA identity
|
|
84963
|
+
*/
|
|
83738
84964
|
static async fromMnemonic(mnemonic, path = defaultPath) {
|
|
83739
84965
|
const master = HDNodeWallet.fromMnemonic(mnemonic, "m");
|
|
83740
84966
|
const node = path === "m" || path === "m/" ? master : master.derivePath(path.startsWith("m/") ? path.slice(2) : path);
|
|
83741
84967
|
return await this.createFromNode(node, master);
|
|
83742
84968
|
}
|
|
84969
|
+
/**
|
|
84970
|
+
* Creates a wallet from a BIP-39 mnemonic phrase string.
|
|
84971
|
+
*
|
|
84972
|
+
* @param phrase - Space-separated mnemonic words
|
|
84973
|
+
* @param path - BIP-32 path (defaults to ethers `defaultPath`)
|
|
84974
|
+
* @returns Quant HD wallet instance
|
|
84975
|
+
*/
|
|
83743
84976
|
static async fromPhrase(phrase, path = defaultPath) {
|
|
83744
84977
|
return await this.fromMnemonic(Mnemonic.fromPhrase(phrase), path);
|
|
83745
84978
|
}
|
|
84979
|
+
/**
|
|
84980
|
+
* Not supported on quant HD wallets — use seed/phrase/mnemonic/extended-key factories.
|
|
84981
|
+
*
|
|
84982
|
+
* @param _key - Unused private key argument
|
|
84983
|
+
* @throws Always
|
|
84984
|
+
*/
|
|
83746
84985
|
static async fromPrivateKey(_key) {
|
|
83747
|
-
|
|
84986
|
+
throw new Error("fromPrivateKey is not supported on QuantHDWallet — use fromSeed, fromPhrase, fromMnemonic, or fromExtendedKey");
|
|
83748
84987
|
}
|
|
84988
|
+
/**
|
|
84989
|
+
* Creates a wallet from a BIP-32 master seed.
|
|
84990
|
+
*
|
|
84991
|
+
* @param seed - Seed bytes or hex string
|
|
84992
|
+
* @returns Quant HD wallet at the master node
|
|
84993
|
+
*/
|
|
83749
84994
|
static async fromSeed(seed) {
|
|
83750
84995
|
const master = HDNodeWallet.fromSeed(toUint8Array(seed));
|
|
83751
84996
|
return await this.createFromNode(master, master);
|
|
83752
84997
|
}
|
|
84998
|
+
/**
|
|
84999
|
+
* Generates a BIP-39 mnemonic phrase.
|
|
85000
|
+
*
|
|
85001
|
+
* @param wordlist - BIP-39 wordlist (default: English)
|
|
85002
|
+
* @param strength - Entropy bits (default 256 → 24 words)
|
|
85003
|
+
* @returns Mnemonic phrase string
|
|
85004
|
+
*/
|
|
83753
85005
|
static generateMnemonic(wordlist$9 = wordlist, strength = 256) {
|
|
83754
85006
|
return generateMnemonic(wordlist$9, strength);
|
|
83755
85007
|
}
|
|
85008
|
+
/**
|
|
85009
|
+
* Creates a quant HD wallet from a newly generated random mnemonic.
|
|
85010
|
+
*
|
|
85011
|
+
* @returns Fresh random quant HD wallet
|
|
85012
|
+
*/
|
|
83756
85013
|
static async random() {
|
|
83757
85014
|
return await this.fromPhrase(this.generateMnemonic());
|
|
83758
85015
|
}
|
|
85016
|
+
/** Bech32m quant address of the inner ML-DSA account. */
|
|
83759
85017
|
get address() {
|
|
83760
85018
|
return this._account.address;
|
|
83761
85019
|
}
|
|
85020
|
+
/** Raw 20-byte address payload of the inner account. */
|
|
83762
85021
|
get addressBytes() {
|
|
83763
85022
|
return this._account.addressBytes;
|
|
83764
85023
|
}
|
|
85024
|
+
/** BIP-32 chain code of this HD node. */
|
|
83765
85025
|
get chainCode() {
|
|
83766
85026
|
return this.node.chainCode;
|
|
83767
85027
|
}
|
|
85028
|
+
/** BIP-32 depth of this HD node. */
|
|
83768
85029
|
get depth() {
|
|
83769
85030
|
return this.node.depth;
|
|
83770
85031
|
}
|
|
85032
|
+
/** BIP-32 extended key string for this HD node. */
|
|
83771
85033
|
get extendedKey() {
|
|
83772
85034
|
return this.node.extendedKey;
|
|
83773
85035
|
}
|
|
85036
|
+
/** BIP-32 fingerprint of this HD node. */
|
|
83774
85037
|
get fingerprint() {
|
|
83775
85038
|
return this.node.fingerprint;
|
|
83776
85039
|
}
|
|
85040
|
+
/** BIP-32 child index of this HD node. */
|
|
83777
85041
|
get index() {
|
|
83778
85042
|
return this.node.index;
|
|
83779
85043
|
}
|
|
85044
|
+
/** BIP-39 mnemonic attached to this node, if any. */
|
|
83780
85045
|
get mnemonic() {
|
|
83781
85046
|
return this.node.mnemonic;
|
|
83782
85047
|
}
|
|
85048
|
+
/** BIP-32 parent fingerprint. */
|
|
83783
85049
|
get parentFingerprint() {
|
|
83784
85050
|
return this.node.parentFingerprint;
|
|
83785
85051
|
}
|
|
85052
|
+
/** Absolute BIP-32 path of this node, or `null`. */
|
|
83786
85053
|
get path() {
|
|
83787
85054
|
return this.node.path;
|
|
83788
85055
|
}
|
|
85056
|
+
/** Previous-hash anti-replay value from the inner account. */
|
|
83789
85057
|
get previousHash() {
|
|
83790
85058
|
return this._account.previousHash;
|
|
83791
85059
|
}
|
|
85060
|
+
/** Not supported — previous hash is advanced only via chained `sign`. */
|
|
83792
85061
|
set previousHash(_value) {}
|
|
85062
|
+
/** Previous-hash anti-replay bytes from the inner account. */
|
|
83793
85063
|
get previousHashBytes() {
|
|
83794
85064
|
return this._account.previousHashBytes;
|
|
83795
85065
|
}
|
|
85066
|
+
/** Not supported — previous hash is advanced only via chained `sign`. */
|
|
83796
85067
|
set previousHashBytes(_value) {}
|
|
85068
|
+
/** BIP-85-derived 32-byte ML-DSA seed as lowercase hex (no `0x`). */
|
|
83797
85069
|
get privateKey() {
|
|
83798
85070
|
return hexFromArrayBuffer(this._seed.buffer, { prefix: false }).toLowerCase();
|
|
83799
85071
|
}
|
|
85072
|
+
/** ML-DSA-65 public key as lowercase hex (no `0x`). */
|
|
83800
85073
|
get publicKey() {
|
|
83801
85074
|
const bytes = this._account.publicKey;
|
|
83802
85075
|
return hexFromArrayBuffer(bytes, { prefix: false }).toLowerCase();
|
|
83803
85076
|
}
|
|
85077
|
+
/**
|
|
85078
|
+
* Derives a child quant wallet at a relative, absolute, or BIP-85 path.
|
|
85079
|
+
*
|
|
85080
|
+
* Absolute BIP-85 paths require a master node (from mnemonic/seed/root xkey).
|
|
85081
|
+
*
|
|
85082
|
+
* @param path - Relative path, absolute path, or BIP-85 absolute path
|
|
85083
|
+
* @returns Child quant HD wallet
|
|
85084
|
+
* @throws If absolute BIP-85 derivation lacks a master, or path is invalid
|
|
85085
|
+
*/
|
|
83804
85086
|
async derivePath(path) {
|
|
83805
85087
|
if (path.startsWith("m/")) {
|
|
83806
85088
|
if (isBip85AbsolutePath(path)) {
|
|
@@ -83821,12 +85103,30 @@ var init_quant_wallet = __esmMin((() => {
|
|
|
83821
85103
|
async sign(hash, optionsOrPreviousHash) {
|
|
83822
85104
|
return await this._account.sign(hash, asSignOptions(optionsOrPreviousHash));
|
|
83823
85105
|
}
|
|
85106
|
+
/**
|
|
85107
|
+
* Delegates JWT signing to the inner account (currently unsupported for ML-DSA).
|
|
85108
|
+
*
|
|
85109
|
+
* @param options - Sign-JWT options
|
|
85110
|
+
* @returns JWT result if implemented
|
|
85111
|
+
*/
|
|
83824
85112
|
async signJwt(options) {
|
|
83825
85113
|
return await this._account.signJwt(options);
|
|
83826
85114
|
}
|
|
85115
|
+
/**
|
|
85116
|
+
* Verifies a signature with the inner quant account.
|
|
85117
|
+
*
|
|
85118
|
+
* @param msg - Message that was signed
|
|
85119
|
+
* @param signature - Raw signature or ML-DSA bundle
|
|
85120
|
+
* @returns `true` if verification succeeds
|
|
85121
|
+
*/
|
|
83827
85122
|
async verify(msg, signature) {
|
|
83828
85123
|
return await this._account.verify(msg, signature);
|
|
83829
85124
|
}
|
|
85125
|
+
/**
|
|
85126
|
+
* Ensures only one live quant HD wallet instance exists per address.
|
|
85127
|
+
*
|
|
85128
|
+
* @returns This instance if first for the address, otherwise the cached instance
|
|
85129
|
+
*/
|
|
83830
85130
|
verifyUniqueWallet() {
|
|
83831
85131
|
const address = this.address;
|
|
83832
85132
|
const existing = QuantHDWallet._walletAddressMap[address]?.deref();
|
|
@@ -89755,7 +91055,7 @@ var init_schema_cache = __esmMin((async () => {
|
|
|
89755
91055
|
init_schema_payload_plugin();
|
|
89756
91056
|
}));
|
|
89757
91057
|
//#endregion
|
|
89758
|
-
//#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.2.
|
|
91058
|
+
//#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.2.2_@ariestools+sdk@8.1.3_@opentelemetry+api@1.9.1_zod_e3037e945b6aa9d20a93ce0deff04109/node_modules/@xyo-network/sdk-protocol-core/dist/neutral/sdk-utils.mjs
|
|
89759
91059
|
var init_sdk_utils = __esmMin((async () => {
|
|
89760
91060
|
await init_api();
|
|
89761
91061
|
init_api_models();
|
|
@@ -89767,7 +91067,7 @@ var init_sdk_utils = __esmMin((async () => {
|
|
|
89767
91067
|
await init_schema_cache();
|
|
89768
91068
|
}));
|
|
89769
91069
|
//#endregion
|
|
89770
|
-
//#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.2.
|
|
91070
|
+
//#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol-core@7.2.2_@ariestools+sdk@8.1.3_@opentelemetry+api@1.9.1_zod_e3037e945b6aa9d20a93ce0deff04109/node_modules/@xyo-network/sdk-protocol-core/dist/node/index.mjs
|
|
89771
91071
|
var init_node$3 = __esmMin((async () => {
|
|
89772
91072
|
await init_account();
|
|
89773
91073
|
init_account_model();
|
|
@@ -89822,7 +91122,7 @@ var init_node$3 = __esmMin((async () => {
|
|
|
89822
91122
|
init_wasm();
|
|
89823
91123
|
}));
|
|
89824
91124
|
//#endregion
|
|
89825
|
-
//#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol@7.2.
|
|
91125
|
+
//#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol@7.2.2_@ariestools+sdk@8.1.3_@opentelemetry+api@1.9.1_zod@4.4._e749b213cd73883e7d74cab511eb277a/node_modules/@xyo-network/sdk-protocol/dist/neutral/index.mjs
|
|
89826
91126
|
var init_neutral$3 = __esmMin((async () => {
|
|
89827
91127
|
await init_node$3();
|
|
89828
91128
|
}));
|
|
@@ -90479,7 +91779,7 @@ var init_index_min = __esmMin((() => {
|
|
|
90479
91779
|
};
|
|
90480
91780
|
}));
|
|
90481
91781
|
//#endregion
|
|
90482
|
-
//#region ../../node_modules/.pnpm/@xyo-network+sdk@7.2.1_@ariestools+sdk@8.1.
|
|
91782
|
+
//#region ../../node_modules/.pnpm/@xyo-network+sdk@7.2.1_@ariestools+sdk@8.1.3_@opentelemetry+api@1.9.1_zod@4.4.3__@opent_17fee32f2668cb1c2390db1dd02c1af4/node_modules/@xyo-network/sdk/dist/neutral/module-model.mjs
|
|
90483
91783
|
function creatableModule() {
|
|
90484
91784
|
return (constructor) => {};
|
|
90485
91785
|
}
|
|
@@ -91233,7 +92533,7 @@ var init_node_model = __esmMin((async () => {
|
|
|
91233
92533
|
NodeConfigSchema = asSchema("network.xyo.node.config", true);
|
|
91234
92534
|
}));
|
|
91235
92535
|
//#endregion
|
|
91236
|
-
//#region ../../node_modules/.pnpm/@xyo-network+sdk@7.2.1_@ariestools+sdk@8.1.
|
|
92536
|
+
//#region ../../node_modules/.pnpm/@xyo-network+sdk@7.2.1_@ariestools+sdk@8.1.3_@opentelemetry+api@1.9.1_zod@4.4.3__@opent_17fee32f2668cb1c2390db1dd02c1af4/node_modules/@xyo-network/sdk/dist/neutral/module-abstract.mjs
|
|
91237
92537
|
async function determineAccount(params, allowRandomAccount = true) {
|
|
91238
92538
|
if (isDetermineAccountFromAccountParams(params)) {
|
|
91239
92539
|
if (params.account === "random") {
|
|
@@ -92663,7 +93963,7 @@ var init_bridge_model = __esmMin((async () => {
|
|
|
92663
93963
|
BridgeConfigSchema = asSchema("network.xyo.bridge.config", true);
|
|
92664
93964
|
}));
|
|
92665
93965
|
//#endregion
|
|
92666
|
-
//#region ../../node_modules/.pnpm/@xyo-network+sdk@7.2.1_@ariestools+sdk@8.1.
|
|
93966
|
+
//#region ../../node_modules/.pnpm/@xyo-network+sdk@7.2.1_@ariestools+sdk@8.1.3_@opentelemetry+api@1.9.1_zod@4.4.3__@opent_17fee32f2668cb1c2390db1dd02c1af4/node_modules/@xyo-network/sdk/dist/neutral/module-wrapper.mjs
|
|
92667
93967
|
function constructableModuleWrapper() {
|
|
92668
93968
|
return (constructor) => {};
|
|
92669
93969
|
}
|
|
@@ -92936,7 +94236,7 @@ var init_module_wrapper = __esmMin((async () => {
|
|
|
92936
94236
|
ModuleWrapper = __decorateClass$14([constructableModuleWrapper()], ModuleWrapper);
|
|
92937
94237
|
}));
|
|
92938
94238
|
//#endregion
|
|
92939
|
-
//#region ../../node_modules/.pnpm/@xyo-network+sdk@7.2.1_@ariestools+sdk@8.1.
|
|
94239
|
+
//#region ../../node_modules/.pnpm/@xyo-network+sdk@7.2.1_@ariestools+sdk@8.1.3_@opentelemetry+api@1.9.1_zod@4.4.3__@opent_17fee32f2668cb1c2390db1dd02c1af4/node_modules/@xyo-network/sdk/dist/neutral/archivist-wrapper.mjs
|
|
92940
94240
|
var ArchivistWrapper;
|
|
92941
94241
|
var init_archivist_wrapper = __esmMin((async () => {
|
|
92942
94242
|
await init_archivist_model();
|
|
@@ -93036,7 +94336,7 @@ var init_archivist_wrapper = __esmMin((async () => {
|
|
|
93036
94336
|
};
|
|
93037
94337
|
}));
|
|
93038
94338
|
//#endregion
|
|
93039
|
-
//#region ../../node_modules/.pnpm/@xyo-network+sdk@7.2.1_@ariestools+sdk@8.1.
|
|
94339
|
+
//#region ../../node_modules/.pnpm/@xyo-network+sdk@7.2.1_@ariestools+sdk@8.1.3_@opentelemetry+api@1.9.1_zod@4.4.3__@opent_17fee32f2668cb1c2390db1dd02c1af4/node_modules/@xyo-network/sdk/dist/neutral/diviner-wrapper.mjs
|
|
93040
94340
|
var DivinerWrapper;
|
|
93041
94341
|
var init_diviner_wrapper = __esmMin((async () => {
|
|
93042
94342
|
await init_diviner_model();
|
|
@@ -93056,7 +94356,7 @@ var init_diviner_wrapper = __esmMin((async () => {
|
|
|
93056
94356
|
};
|
|
93057
94357
|
}));
|
|
93058
94358
|
//#endregion
|
|
93059
|
-
//#region ../../node_modules/.pnpm/@xyo-network+sdk@7.2.1_@ariestools+sdk@8.1.
|
|
94359
|
+
//#region ../../node_modules/.pnpm/@xyo-network+sdk@7.2.1_@ariestools+sdk@8.1.3_@opentelemetry+api@1.9.1_zod@4.4.3__@opent_17fee32f2668cb1c2390db1dd02c1af4/node_modules/@xyo-network/sdk/dist/neutral/node-wrapper.mjs
|
|
93060
94360
|
var NodeWrapper, init_node_wrapper = __esmMin((async () => {
|
|
93061
94361
|
await init_neutral$3();
|
|
93062
94362
|
init_async_mutex();
|
|
@@ -93228,7 +94528,7 @@ var init_witness_model = __esmMin((async () => {
|
|
|
93228
94528
|
WitnessConfigSchema = asSchema("network.xyo.witness.config", true);
|
|
93229
94529
|
}));
|
|
93230
94530
|
//#endregion
|
|
93231
|
-
//#region ../../node_modules/.pnpm/@xyo-network+sdk@7.2.1_@ariestools+sdk@8.1.
|
|
94531
|
+
//#region ../../node_modules/.pnpm/@xyo-network+sdk@7.2.1_@ariestools+sdk@8.1.3_@opentelemetry+api@1.9.1_zod@4.4.3__@opent_17fee32f2668cb1c2390db1dd02c1af4/node_modules/@xyo-network/sdk/dist/neutral/witness-wrapper.mjs
|
|
93232
94532
|
var WitnessWrapper;
|
|
93233
94533
|
var init_witness_wrapper = __esmMin((async () => {
|
|
93234
94534
|
await init_module_wrapper();
|
|
@@ -93248,7 +94548,7 @@ var init_witness_wrapper = __esmMin((async () => {
|
|
|
93248
94548
|
};
|
|
93249
94549
|
}));
|
|
93250
94550
|
//#endregion
|
|
93251
|
-
//#region ../../node_modules/.pnpm/@xyo-network+sdk@7.2.1_@ariestools+sdk@8.1.
|
|
94551
|
+
//#region ../../node_modules/.pnpm/@xyo-network+sdk@7.2.1_@ariestools+sdk@8.1.3_@opentelemetry+api@1.9.1_zod@4.4.3__@opent_17fee32f2668cb1c2390db1dd02c1af4/node_modules/@xyo-network/sdk/dist/neutral/bridge-abstract.mjs
|
|
93252
94552
|
var AbstractBridge, AbstractBridgeModuleResolver, wrapModuleWithType, ModuleProxyResolver, AbstractModuleProxy, init_bridge_abstract = __esmMin((async () => {
|
|
93253
94553
|
init_node$4();
|
|
93254
94554
|
await init_neutral$3();
|
|
@@ -93962,7 +95262,7 @@ var init_bridge_http = __esmMin((async () => {
|
|
|
93962
95262
|
HttpBridge = __decorateClass$13([creatableModule()], HttpBridge);
|
|
93963
95263
|
}));
|
|
93964
95264
|
//#endregion
|
|
93965
|
-
//#region ../../node_modules/.pnpm/@xyo-network+sdk@7.2.1_@ariestools+sdk@8.1.
|
|
95265
|
+
//#region ../../node_modules/.pnpm/@xyo-network+sdk@7.2.1_@ariestools+sdk@8.1.3_@opentelemetry+api@1.9.1_zod@4.4.3__@opent_17fee32f2668cb1c2390db1dd02c1af4/node_modules/@xyo-network/sdk/dist/neutral/diviner-abstract.mjs
|
|
93966
95266
|
var delayedResolve, AbstractDiviner, init_diviner_abstract = __esmMin((async () => {
|
|
93967
95267
|
init_node$4();
|
|
93968
95268
|
await init_neutral$3();
|
|
@@ -94098,7 +95398,7 @@ var init_diviner_boundwitness = __esmMin((async () => {
|
|
|
94098
95398
|
PayloadZodOfSchema(BoundWitnessDivinerQuerySchema$1), { ...QueryFieldsZod.shape };
|
|
94099
95399
|
}));
|
|
94100
95400
|
//#endregion
|
|
94101
|
-
//#region ../../node_modules/.pnpm/@xyo-network+sdk@7.2.1_@ariestools+sdk@8.1.
|
|
95401
|
+
//#region ../../node_modules/.pnpm/@xyo-network+sdk@7.2.1_@ariestools+sdk@8.1.3_@opentelemetry+api@1.9.1_zod@4.4.3__@opent_17fee32f2668cb1c2390db1dd02c1af4/node_modules/@xyo-network/sdk/dist/neutral/diviner-identity.mjs
|
|
94102
95402
|
var __defProp$13, __getOwnPropDesc$12, __defNormalProp$11, __decorateClass$12, __publicField$11, IdentityDiviner;
|
|
94103
95403
|
var init_diviner_identity = __esmMin((async () => {
|
|
94104
95404
|
init_node$4();
|
|
@@ -94129,7 +95429,7 @@ var init_diviner_identity = __esmMin((async () => {
|
|
|
94129
95429
|
IdentityDiviner = __decorateClass$12([creatableModule()], IdentityDiviner);
|
|
94130
95430
|
}));
|
|
94131
95431
|
//#endregion
|
|
94132
|
-
//#region ../../node_modules/.pnpm/@xyo-network+sdk@7.2.1_@ariestools+sdk@8.1.
|
|
95432
|
+
//#region ../../node_modules/.pnpm/@xyo-network+sdk@7.2.1_@ariestools+sdk@8.1.3_@opentelemetry+api@1.9.1_zod@4.4.3__@opent_17fee32f2668cb1c2390db1dd02c1af4/node_modules/@xyo-network/sdk/dist/neutral/diviner-payload-abstract.mjs
|
|
94133
95433
|
var PayloadDiviner, init_diviner_payload_abstract = __esmMin((async () => {
|
|
94134
95434
|
await init_diviner_abstract();
|
|
94135
95435
|
await init_diviner_payload_model();
|
|
@@ -94448,7 +95748,7 @@ var init_archivist_memory = __esmMin((async () => {
|
|
|
94448
95748
|
MemoryArchivist = __decorateClass$10([creatableModule()], MemoryArchivist);
|
|
94449
95749
|
}));
|
|
94450
95750
|
//#endregion
|
|
94451
|
-
//#region ../../node_modules/.pnpm/@xyo-network+sdk@7.2.1_@ariestools+sdk@8.1.
|
|
95751
|
+
//#region ../../node_modules/.pnpm/@xyo-network+sdk@7.2.1_@ariestools+sdk@8.1.3_@opentelemetry+api@1.9.1_zod@4.4.3__@opent_17fee32f2668cb1c2390db1dd02c1af4/node_modules/@xyo-network/sdk/dist/neutral/archivist.mjs
|
|
94452
95752
|
var init_archivist = __esmMin((async () => {
|
|
94453
95753
|
await init_archivist_abstract();
|
|
94454
95754
|
await init_archivist_memory();
|
|
@@ -94456,7 +95756,7 @@ var init_archivist = __esmMin((async () => {
|
|
|
94456
95756
|
await init_archivist_wrapper();
|
|
94457
95757
|
}));
|
|
94458
95758
|
//#endregion
|
|
94459
|
-
//#region ../../node_modules/.pnpm/@xyo-network+sdk@7.2.1_@ariestools+sdk@8.1.
|
|
95759
|
+
//#region ../../node_modules/.pnpm/@xyo-network+sdk@7.2.1_@ariestools+sdk@8.1.3_@opentelemetry+api@1.9.1_zod@4.4.3__@opent_17fee32f2668cb1c2390db1dd02c1af4/node_modules/@xyo-network/sdk/dist/neutral/boundwitness-loader.mjs
|
|
94460
95760
|
var init_boundwitness_loader = __esmMin((async () => {
|
|
94461
95761
|
init_node$4();
|
|
94462
95762
|
await init_neutral$3();
|
|
@@ -94464,27 +95764,27 @@ var init_boundwitness_loader = __esmMin((async () => {
|
|
|
94464
95764
|
await init_archivist_memory();
|
|
94465
95765
|
}));
|
|
94466
95766
|
//#endregion
|
|
94467
|
-
//#region ../../node_modules/.pnpm/@xyo-network+sdk@7.2.1_@ariestools+sdk@8.1.
|
|
95767
|
+
//#region ../../node_modules/.pnpm/@xyo-network+sdk@7.2.1_@ariestools+sdk@8.1.3_@opentelemetry+api@1.9.1_zod@4.4.3__@opent_17fee32f2668cb1c2390db1dd02c1af4/node_modules/@xyo-network/sdk/dist/neutral/bridge-wrapper.mjs
|
|
94468
95768
|
var init_bridge_wrapper = __esmMin((async () => {
|
|
94469
95769
|
await init_bridge_model();
|
|
94470
95770
|
await init_module_wrapper();
|
|
94471
95771
|
}));
|
|
94472
95772
|
//#endregion
|
|
94473
|
-
//#region ../../node_modules/.pnpm/@xyo-network+sdk@7.2.1_@ariestools+sdk@8.1.
|
|
95773
|
+
//#region ../../node_modules/.pnpm/@xyo-network+sdk@7.2.1_@ariestools+sdk@8.1.3_@opentelemetry+api@1.9.1_zod@4.4.3__@opent_17fee32f2668cb1c2390db1dd02c1af4/node_modules/@xyo-network/sdk/dist/neutral/bridge.mjs
|
|
94474
95774
|
var init_bridge = __esmMin((async () => {
|
|
94475
95775
|
await init_bridge_abstract();
|
|
94476
95776
|
await init_bridge_model();
|
|
94477
95777
|
await init_bridge_wrapper();
|
|
94478
95778
|
}));
|
|
94479
95779
|
//#endregion
|
|
94480
|
-
//#region ../../node_modules/.pnpm/@xyo-network+sdk@7.2.1_@ariestools+sdk@8.1.
|
|
95780
|
+
//#region ../../node_modules/.pnpm/@xyo-network+sdk@7.2.1_@ariestools+sdk@8.1.3_@opentelemetry+api@1.9.1_zod@4.4.3__@opent_17fee32f2668cb1c2390db1dd02c1af4/node_modules/@xyo-network/sdk/dist/neutral/diviner.mjs
|
|
94481
95781
|
var init_diviner = __esmMin((async () => {
|
|
94482
95782
|
await init_diviner_abstract();
|
|
94483
95783
|
await init_diviner_model();
|
|
94484
95784
|
await init_diviner_wrapper();
|
|
94485
95785
|
}));
|
|
94486
95786
|
//#endregion
|
|
94487
|
-
//#region ../../node_modules/.pnpm/@xyo-network+sdk@7.2.1_@ariestools+sdk@8.1.
|
|
95787
|
+
//#region ../../node_modules/.pnpm/@xyo-network+sdk@7.2.1_@ariestools+sdk@8.1.3_@opentelemetry+api@1.9.1_zod@4.4.3__@opent_17fee32f2668cb1c2390db1dd02c1af4/node_modules/@xyo-network/sdk/dist/neutral/node-abstract.mjs
|
|
94488
95788
|
var AbstractNode, attachedPrivateModules, attachedPublicModules, NodeHelper;
|
|
94489
95789
|
var init_node_abstract = __esmMin((async () => {
|
|
94490
95790
|
init_node$4();
|
|
@@ -94695,7 +95995,7 @@ var init_node_abstract = __esmMin((async () => {
|
|
|
94695
95995
|
};
|
|
94696
95996
|
}));
|
|
94697
95997
|
//#endregion
|
|
94698
|
-
//#region ../../node_modules/.pnpm/@xyo-network+sdk@7.2.1_@ariestools+sdk@8.1.
|
|
95998
|
+
//#region ../../node_modules/.pnpm/@xyo-network+sdk@7.2.1_@ariestools+sdk@8.1.3_@opentelemetry+api@1.9.1_zod@4.4.3__@opent_17fee32f2668cb1c2390db1dd02c1af4/node_modules/@xyo-network/sdk/dist/neutral/node-memory.mjs
|
|
94699
95999
|
var __defProp$10, __getOwnPropDesc$9, __decorateClass$9, MemoryNode, flatAttachAllToExistingNode, flatAttachChildToExistingNode, flatAttachToExistingNode, attachToExistingNode, DEFAULT_NODE_PARAMS, attachToNewNode, flatAttachToNewNode, MemoryNodeHelper;
|
|
94700
96000
|
var init_node_memory = __esmMin((async () => {
|
|
94701
96001
|
init_node$4();
|
|
@@ -94924,7 +96224,7 @@ var init_node_memory = __esmMin((async () => {
|
|
|
94924
96224
|
};
|
|
94925
96225
|
}));
|
|
94926
96226
|
//#endregion
|
|
94927
|
-
//#region ../../node_modules/.pnpm/@xyo-network+sdk@7.2.1_@ariestools+sdk@8.1.
|
|
96227
|
+
//#region ../../node_modules/.pnpm/@xyo-network+sdk@7.2.1_@ariestools+sdk@8.1.3_@opentelemetry+api@1.9.1_zod@4.4.3__@opent_17fee32f2668cb1c2390db1dd02c1af4/node_modules/@xyo-network/sdk/dist/neutral/manifest-wrapper.mjs
|
|
94928
96228
|
var init_manifest_wrapper = __esmMin((async () => {
|
|
94929
96229
|
init_node$4();
|
|
94930
96230
|
await init_neutral$3();
|
|
@@ -94932,7 +96232,7 @@ var init_manifest_wrapper = __esmMin((async () => {
|
|
|
94932
96232
|
await init_node_memory();
|
|
94933
96233
|
}));
|
|
94934
96234
|
//#endregion
|
|
94935
|
-
//#region ../../node_modules/.pnpm/@xyo-network+sdk@7.2.1_@ariestools+sdk@8.1.
|
|
96235
|
+
//#region ../../node_modules/.pnpm/@xyo-network+sdk@7.2.1_@ariestools+sdk@8.1.3_@opentelemetry+api@1.9.1_zod@4.4.3__@opent_17fee32f2668cb1c2390db1dd02c1af4/node_modules/@xyo-network/sdk/dist/neutral/module-event-emitter.mjs
|
|
94936
96236
|
var init_module_event_emitter = __esmMin((() => {
|
|
94937
96237
|
init_node$4();
|
|
94938
96238
|
})), applyBoundWitnessDivinerQueryPayload, BoundWitnessDivinerSchema, BoundWitnessDivinerConfigSchema, BoundWitnessDiviner, BoundWitnessDivinerQuerySchema, BoundWitnessDivinerQueryPayloadZod, isBoundWitnessDivinerQueryPayload, MemoryBoundWitnessDiviner, init_diviner_boundwitness_memory = __esmMin((async () => {
|
|
@@ -95088,7 +96388,7 @@ var init_node_view = __esmMin((async () => {
|
|
|
95088
96388
|
ViewNode = __decorateClass$8([creatableModule()], ViewNode);
|
|
95089
96389
|
}));
|
|
95090
96390
|
//#endregion
|
|
95091
|
-
//#region ../../node_modules/.pnpm/@xyo-network+sdk@7.2.1_@ariestools+sdk@8.1.
|
|
96391
|
+
//#region ../../node_modules/.pnpm/@xyo-network+sdk@7.2.1_@ariestools+sdk@8.1.3_@opentelemetry+api@1.9.1_zod@4.4.3__@opent_17fee32f2668cb1c2390db1dd02c1af4/node_modules/@xyo-network/sdk/dist/neutral/sentinel-abstract.mjs
|
|
95092
96392
|
var AbstractSentinel;
|
|
95093
96393
|
var init_sentinel_abstract = __esmMin((async () => {
|
|
95094
96394
|
init_node$4();
|
|
@@ -95201,7 +96501,7 @@ var init_sentinel_abstract = __esmMin((async () => {
|
|
|
95201
96501
|
};
|
|
95202
96502
|
}));
|
|
95203
96503
|
//#endregion
|
|
95204
|
-
//#region ../../node_modules/.pnpm/@xyo-network+sdk@7.2.1_@ariestools+sdk@8.1.
|
|
96504
|
+
//#region ../../node_modules/.pnpm/@xyo-network+sdk@7.2.1_@ariestools+sdk@8.1.3_@opentelemetry+api@1.9.1_zod@4.4.3__@opent_17fee32f2668cb1c2390db1dd02c1af4/node_modules/@xyo-network/sdk/dist/neutral/sentinel-memory.mjs
|
|
95205
96505
|
var SentinelIntervalAutomationWrapper, SentinelRunner, MemorySentinel;
|
|
95206
96506
|
var init_sentinel_memory = __esmMin((async () => {
|
|
95207
96507
|
init_node$4();
|
|
@@ -95481,7 +96781,7 @@ var init_sentinel_memory = __esmMin((async () => {
|
|
|
95481
96781
|
};
|
|
95482
96782
|
}));
|
|
95483
96783
|
//#endregion
|
|
95484
|
-
//#region ../../node_modules/.pnpm/@xyo-network+sdk@7.2.1_@ariestools+sdk@8.1.
|
|
96784
|
+
//#region ../../node_modules/.pnpm/@xyo-network+sdk@7.2.1_@ariestools+sdk@8.1.3_@opentelemetry+api@1.9.1_zod@4.4.3__@opent_17fee32f2668cb1c2390db1dd02c1af4/node_modules/@xyo-network/sdk/dist/neutral/witness-abstract.mjs
|
|
95485
96785
|
var AbstractWitness, init_witness_abstract = __esmMin((async () => {
|
|
95486
96786
|
init_node$4();
|
|
95487
96787
|
await init_neutral$3();
|
|
@@ -95589,7 +96889,7 @@ var init_module_factory_locator = __esmMin((async () => {
|
|
|
95589
96889
|
HttpBridge.factory(), ViewArchivist.factory(), ViewNode.factory(), AdhocWitness.factory(), GenericPayloadDiviner.factory(), MemoryBoundWitnessDiviner.factory(), IdentityDiviner.factory(), MemoryArchivist.factory(), MemoryArchivist.factory(), MemoryNode.factory(), MemorySentinel.factory(), GenericPayloadDiviner.factory();
|
|
95590
96890
|
}));
|
|
95591
96891
|
//#endregion
|
|
95592
|
-
//#region ../../node_modules/.pnpm/@xyo-network+sdk@7.2.1_@ariestools+sdk@8.1.
|
|
96892
|
+
//#region ../../node_modules/.pnpm/@xyo-network+sdk@7.2.1_@ariestools+sdk@8.1.3_@opentelemetry+api@1.9.1_zod@4.4.3__@opent_17fee32f2668cb1c2390db1dd02c1af4/node_modules/@xyo-network/sdk/dist/neutral/module.mjs
|
|
95593
96893
|
var init_module = __esmMin((async () => {
|
|
95594
96894
|
await init_module_abstract();
|
|
95595
96895
|
init_module_event_emitter();
|
|
@@ -95599,7 +96899,7 @@ var init_module = __esmMin((async () => {
|
|
|
95599
96899
|
await init_module_wrapper();
|
|
95600
96900
|
}));
|
|
95601
96901
|
//#endregion
|
|
95602
|
-
//#region ../../node_modules/.pnpm/@xyo-network+sdk@7.2.1_@ariestools+sdk@8.1.
|
|
96902
|
+
//#region ../../node_modules/.pnpm/@xyo-network+sdk@7.2.1_@ariestools+sdk@8.1.3_@opentelemetry+api@1.9.1_zod@4.4.3__@opent_17fee32f2668cb1c2390db1dd02c1af4/node_modules/@xyo-network/sdk/dist/neutral/node.mjs
|
|
95603
96903
|
var init_node$2 = __esmMin((async () => {
|
|
95604
96904
|
await init_node_abstract();
|
|
95605
96905
|
await init_node_memory();
|
|
@@ -95607,13 +96907,13 @@ var init_node$2 = __esmMin((async () => {
|
|
|
95607
96907
|
await init_node_wrapper();
|
|
95608
96908
|
}));
|
|
95609
96909
|
//#endregion
|
|
95610
|
-
//#region ../../node_modules/.pnpm/@xyo-network+sdk@7.2.1_@ariestools+sdk@8.1.
|
|
96910
|
+
//#region ../../node_modules/.pnpm/@xyo-network+sdk@7.2.1_@ariestools+sdk@8.1.3_@opentelemetry+api@1.9.1_zod@4.4.3__@opent_17fee32f2668cb1c2390db1dd02c1af4/node_modules/@xyo-network/sdk/dist/neutral/payloadset-plugin.mjs
|
|
95611
96911
|
var init_payloadset_plugin = __esmMin((async () => {
|
|
95612
96912
|
init_node$4();
|
|
95613
96913
|
await init_neutral$3();
|
|
95614
96914
|
}));
|
|
95615
96915
|
//#endregion
|
|
95616
|
-
//#region ../../node_modules/.pnpm/@xyo-network+sdk@7.2.1_@ariestools+sdk@8.1.
|
|
96916
|
+
//#region ../../node_modules/.pnpm/@xyo-network+sdk@7.2.1_@ariestools+sdk@8.1.3_@opentelemetry+api@1.9.1_zod@4.4.3__@opent_17fee32f2668cb1c2390db1dd02c1af4/node_modules/@xyo-network/sdk/dist/neutral/sentinel.mjs
|
|
95617
96917
|
var init_sentinel = __esmMin((async () => {
|
|
95618
96918
|
await init_sentinel_abstract();
|
|
95619
96919
|
await init_sentinel_memory();
|
|
@@ -95621,14 +96921,14 @@ var init_sentinel = __esmMin((async () => {
|
|
|
95621
96921
|
await init_sentinel_wrapper();
|
|
95622
96922
|
}));
|
|
95623
96923
|
//#endregion
|
|
95624
|
-
//#region ../../node_modules/.pnpm/@xyo-network+sdk@7.2.1_@ariestools+sdk@8.1.
|
|
96924
|
+
//#region ../../node_modules/.pnpm/@xyo-network+sdk@7.2.1_@ariestools+sdk@8.1.3_@opentelemetry+api@1.9.1_zod@4.4.3__@opent_17fee32f2668cb1c2390db1dd02c1af4/node_modules/@xyo-network/sdk/dist/neutral/witness.mjs
|
|
95625
96925
|
var init_witness = __esmMin((async () => {
|
|
95626
96926
|
await init_witness_abstract();
|
|
95627
96927
|
await init_witness_model();
|
|
95628
96928
|
await init_witness_wrapper();
|
|
95629
96929
|
}));
|
|
95630
96930
|
//#endregion
|
|
95631
|
-
//#region ../../node_modules/.pnpm/@xyo-network+sdk@7.2.1_@ariestools+sdk@8.1.
|
|
96931
|
+
//#region ../../node_modules/.pnpm/@xyo-network+sdk@7.2.1_@ariestools+sdk@8.1.3_@opentelemetry+api@1.9.1_zod@4.4.3__@opent_17fee32f2668cb1c2390db1dd02c1af4/node_modules/@xyo-network/sdk/dist/neutral/modules.mjs
|
|
95632
96932
|
var init_modules$1 = __esmMin((async () => {
|
|
95633
96933
|
await init_address_payload_plugin();
|
|
95634
96934
|
await init_api_location_diviner();
|
|
@@ -95644,7 +96944,7 @@ var init_modules$1 = __esmMin((async () => {
|
|
|
95644
96944
|
await init_witness();
|
|
95645
96945
|
}));
|
|
95646
96946
|
//#endregion
|
|
95647
|
-
//#region ../../node_modules/.pnpm/@xyo-network+sdk@7.2.1_@ariestools+sdk@8.1.
|
|
96947
|
+
//#region ../../node_modules/.pnpm/@xyo-network+sdk@7.2.1_@ariestools+sdk@8.1.3_@opentelemetry+api@1.9.1_zod@4.4.3__@opent_17fee32f2668cb1c2390db1dd02c1af4/node_modules/@xyo-network/sdk/dist/node/index.mjs
|
|
95648
96948
|
var init_node$1 = __esmMin((async () => {
|
|
95649
96949
|
await init_neutral$3();
|
|
95650
96950
|
await init_archivist_generic();
|
|
@@ -95660,7 +96960,7 @@ var init_node$1 = __esmMin((async () => {
|
|
|
95660
96960
|
await init_witness_adhoc();
|
|
95661
96961
|
}));
|
|
95662
96962
|
//#endregion
|
|
95663
|
-
//#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol@7.2.
|
|
96963
|
+
//#region ../../node_modules/.pnpm/@xyo-network+sdk-protocol@7.2.2_@ariestools+sdk@8.1.3_@opentelemetry+api@1.9.1_zod@4.4._e749b213cd73883e7d74cab511eb277a/node_modules/@xyo-network/sdk-protocol/dist/neutral/quant-wallet.mjs
|
|
95664
96964
|
init_source();
|
|
95665
96965
|
await init_node$1();
|
|
95666
96966
|
init_quant_wallet();
|
|
@@ -97923,7 +99223,7 @@ var init_zod = __esmMin((() => {
|
|
|
97923
99223
|
zod_default = external_exports;
|
|
97924
99224
|
}));
|
|
97925
99225
|
//#endregion
|
|
97926
|
-
//#region ../../node_modules/.pnpm/@xyo-network+xl1-protocol@4.5.2_@ariestools+sdk@8.1.
|
|
99226
|
+
//#region ../../node_modules/.pnpm/@xyo-network+xl1-protocol@4.5.2_@ariestools+sdk@8.1.3_@opentelemetry+api@1.9.1_zod@4.4._14a0bf4e60b3466add81a9b6df323a06/node_modules/@xyo-network/xl1-protocol/dist/neutral/protocol-model.mjs
|
|
97927
99227
|
function isValidStep(step) {
|
|
97928
99228
|
if (typeof step === "number" && Number.isSafeInteger(step)) return step >= 0 && step < StepSizes.length;
|
|
97929
99229
|
return false;
|
|
@@ -98661,7 +99961,7 @@ srcConfirmation: (/* @__PURE__ */ optional$2(HexZod)).check(describe$1("Source c
|
|
|
98661
99961
|
AsObjectFactory.create(isTransactionRejection);
|
|
98662
99962
|
}));
|
|
98663
99963
|
//#endregion
|
|
98664
|
-
//#region ../../node_modules/.pnpm/@xyo-network+xl1-protocol@4.5.2_@ariestools+sdk@8.1.
|
|
99964
|
+
//#region ../../node_modules/.pnpm/@xyo-network+xl1-protocol@4.5.2_@ariestools+sdk@8.1.3_@opentelemetry+api@1.9.1_zod@4.4._14a0bf4e60b3466add81a9b6df323a06/node_modules/@xyo-network/xl1-protocol/dist/neutral/protocol-lib.mjs
|
|
98665
99965
|
function rewardAddressFromStepIdentity({ block, step }) {
|
|
98666
99966
|
const resolvedStepSize = step < StepSizes.length ? StepSizes[step] : step;
|
|
98667
99967
|
return toAddress(keccak256(new TextEncoder().encode(`${block}|${resolvedStepSize}`)).slice(-40), { prefix: false });
|
|
@@ -98875,7 +100175,7 @@ var init_protocol_lib = __esmMin((async () => {
|
|
|
98875
100175
|
XyoViewerMoniker = "XyoViewer";
|
|
98876
100176
|
}));
|
|
98877
100177
|
//#endregion
|
|
98878
|
-
//#region ../../node_modules/.pnpm/@xyo-network+xl1-protocol@4.5.2_@ariestools+sdk@8.1.
|
|
100178
|
+
//#region ../../node_modules/.pnpm/@xyo-network+xl1-protocol@4.5.2_@ariestools+sdk@8.1.3_@opentelemetry+api@1.9.1_zod@4.4._14a0bf4e60b3466add81a9b6df323a06/node_modules/@xyo-network/xl1-protocol/dist/neutral/network-model.mjs
|
|
98879
100179
|
function root(address) {
|
|
98880
100180
|
return `evm/events/${address.toLowerCase()}`;
|
|
98881
100181
|
}
|
|
@@ -99047,7 +100347,7 @@ var init_network_model = __esmMin((async () => {
|
|
|
99047
100347
|
});
|
|
99048
100348
|
}));
|
|
99049
100349
|
//#endregion
|
|
99050
|
-
//#region ../../node_modules/.pnpm/@xyo-network+xl1-protocol@4.5.2_@ariestools+sdk@8.1.
|
|
100350
|
+
//#region ../../node_modules/.pnpm/@xyo-network+xl1-protocol@4.5.2_@ariestools+sdk@8.1.3_@opentelemetry+api@1.9.1_zod@4.4._14a0bf4e60b3466add81a9b6df323a06/node_modules/@xyo-network/xl1-protocol/dist/neutral/schema.mjs
|
|
99051
100351
|
var asRequiredStrings, mergeJsonSchemaRequired, BlockBoundWitnessJsonSchema, BlockBoundWitnessSchemaPayload, StorageMetaJsonSchema, BlockBoundWitnessWithStorageMetaJsonSchema, BlockBoundWitnessWithStorageMetaSchemaPayload, ExecutableJsonSchema, TransactionBoundWitnessJsonSchema, TransactionBoundWitnessSchemaPayload, TransactionBoundWitnessWithStorageMetaJsonSchema, TransactionBoundWitnessWithStorageMetaSchemaPayload, ChainStakeIntentPayloadJsonSchema, ChainStakeIntentPayloadJsonSchemaPayload, HashPayloadJsonSchema, HashPayloadJsonSchemaPayload, TransferPayloadJsonSchema, TransferPayloadJsonSchemaPayload;
|
|
99052
100352
|
var init_schema = __esmMin((async () => {
|
|
99053
100353
|
init_node$4();
|
|
@@ -99289,7 +100589,7 @@ var init_schema = __esmMin((async () => {
|
|
|
99289
100589
|
TransferPayloadJsonSchemaPayload = new PayloadBuilder({ schema: SchemaSchema }).fields({ definition: TransferPayloadJsonSchema }).build();
|
|
99290
100590
|
}));
|
|
99291
100591
|
//#endregion
|
|
99292
|
-
//#region ../../node_modules/.pnpm/@xyo-network+xl1-protocol@4.5.2_@ariestools+sdk@8.1.
|
|
100592
|
+
//#region ../../node_modules/.pnpm/@xyo-network+xl1-protocol@4.5.2_@ariestools+sdk@8.1.3_@opentelemetry+api@1.9.1_zod@4.4._14a0bf4e60b3466add81a9b6df323a06/node_modules/@xyo-network/xl1-protocol/dist/neutral/validation.mjs
|
|
99293
100593
|
function getPayloadsFromPayloadArray(payloads, hashes) {
|
|
99294
100594
|
return hashes.map((hash) => payloads.find((payload) => payload._hash === hash || payload._dataHash === hash));
|
|
99295
100595
|
}
|
|
@@ -99457,7 +100757,7 @@ var init_validation$1 = __esmMin((async () => {
|
|
|
99457
100757
|
};
|
|
99458
100758
|
}));
|
|
99459
100759
|
//#endregion
|
|
99460
|
-
//#region ../../node_modules/.pnpm/@xyo-network+xl1-protocol@4.5.2_@ariestools+sdk@8.1.
|
|
100760
|
+
//#region ../../node_modules/.pnpm/@xyo-network+xl1-protocol@4.5.2_@ariestools+sdk@8.1.3_@opentelemetry+api@1.9.1_zod@4.4._14a0bf4e60b3466add81a9b6df323a06/node_modules/@xyo-network/xl1-protocol/dist/neutral/index.mjs
|
|
99461
100761
|
var init_neutral$2 = __esmMin((async () => {
|
|
99462
100762
|
await init_network_model();
|
|
99463
100763
|
await init_protocol_lib();
|
|
@@ -99465,7 +100765,7 @@ var init_neutral$2 = __esmMin((async () => {
|
|
|
99465
100765
|
await init_validation$1();
|
|
99466
100766
|
}));
|
|
99467
100767
|
//#endregion
|
|
99468
|
-
//#region ../../node_modules/.pnpm/@xyo-network+xl1-sdk@4.5.2_@ariestools+sdk@8.1.
|
|
100768
|
+
//#region ../../node_modules/.pnpm/@xyo-network+xl1-sdk@4.5.2_@ariestools+sdk@8.1.3_@opentelemetry+api@1.9.1_zod@4.4.3__@m_dc0dd298d74018ffeb60a46379811c7a/node_modules/@xyo-network/xl1-sdk/dist/neutral/driver-memory.mjs
|
|
99469
100769
|
var LruCacheMap, MemoryMap;
|
|
99470
100770
|
var init_driver_memory = __esmMin((() => {
|
|
99471
100771
|
init_index_min();
|
|
@@ -254554,7 +255854,7 @@ var require_dist = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
254554
255854
|
require_util$4();
|
|
254555
255855
|
}));
|
|
254556
255856
|
//#endregion
|
|
254557
|
-
//#region ../../node_modules/.pnpm/@xyo-network+xl1-sdk@4.5.2_@ariestools+sdk@8.1.
|
|
255857
|
+
//#region ../../node_modules/.pnpm/@xyo-network+xl1-sdk@4.5.2_@ariestools+sdk@8.1.3_@opentelemetry+api@1.9.1_zod@4.4.3__@m_dc0dd298d74018ffeb60a46379811c7a/node_modules/@xyo-network/xl1-sdk/dist/node/protocol-sdk.mjs
|
|
254558
255858
|
function blockRangeSteps(range, steps) {
|
|
254559
255859
|
const result = [];
|
|
254560
255860
|
for (const step of steps) {
|
|
@@ -279813,7 +281113,7 @@ var init_v2 = __esmMin((() => {
|
|
|
279813
281113
|
init_utils$2();
|
|
279814
281114
|
}));
|
|
279815
281115
|
//#endregion
|
|
279816
|
-
//#region ../../node_modules/.pnpm/@xyo-network+xl1-sdk@4.5.2_@ariestools+sdk@8.1.
|
|
281116
|
+
//#region ../../node_modules/.pnpm/@xyo-network+xl1-sdk@4.5.2_@ariestools+sdk@8.1.3_@opentelemetry+api@1.9.1_zod@4.4.3__@m_dc0dd298d74018ffeb60a46379811c7a/node_modules/@xyo-network/xl1-sdk/dist/neutral/rpc.mjs
|
|
279817
281117
|
function browserWindow() {
|
|
279818
281118
|
return globalThis;
|
|
279819
281119
|
}
|
|
@@ -282250,7 +283550,7 @@ var init_rpc = __esmMin((async () => {
|
|
|
282250
283550
|
};
|
|
282251
283551
|
}));
|
|
282252
283552
|
//#endregion
|
|
282253
|
-
//#region ../../node_modules/.pnpm/@xyo-network+xl1-sdk@4.5.2_@ariestools+sdk@8.1.
|
|
283553
|
+
//#region ../../node_modules/.pnpm/@xyo-network+xl1-sdk@4.5.2_@ariestools+sdk@8.1.3_@opentelemetry+api@1.9.1_zod@4.4.3__@m_dc0dd298d74018ffeb60a46379811c7a/node_modules/@xyo-network/xl1-sdk/dist/neutral/rest-block-viewer.mjs
|
|
282254
283554
|
var __defProp$6, __getOwnPropDesc$5, __defNormalProp$5, __decorateClass$5, __publicField$5, REST_SUMMARY_CACHE_MAX_BY_STEP, MIN_HEAD_POLL_INTERVAL_MS, CURRENT_BLOCK_CACHE_TTL_MS, CURRENT_BLOCK_CACHE_KEY, BLOCKS_BY_NUMBER_STEP_ACCEL_MIN_LIMIT, PayloadFileZod, RestBlockViewer, RestChainContractViewer, MIN_HEAD_POLL_INTERVAL_MS2, RestChainStateViewer, RestFinalizationViewer, MAX_STEP_BY_FAMILY, RestIndexViewer;
|
|
282255
283555
|
var init_rest_block_viewer = __esmMin((async () => {
|
|
282256
283556
|
await init_network_model();
|
|
@@ -302549,7 +303849,7 @@ var init_neutral$1 = __esmMin((() => {
|
|
|
302549
303849
|
};
|
|
302550
303850
|
}));
|
|
302551
303851
|
//#endregion
|
|
302552
|
-
//#region ../../node_modules/.pnpm/@xyo-network+xl1-sdk@4.5.2_@ariestools+sdk@8.1.
|
|
303852
|
+
//#region ../../node_modules/.pnpm/@xyo-network+xl1-sdk@4.5.2_@ariestools+sdk@8.1.3_@opentelemetry+api@1.9.1_zod@4.4.3__@m_dc0dd298d74018ffeb60a46379811c7a/node_modules/@xyo-network/xl1-sdk/dist/neutral/providers.mjs
|
|
302553
303853
|
function estimateBlockNumberFromHead(headNumber, headTimestampSec, targetDate = DEFAULT_ESTIMATE_BLOCK_DATE, avgBlockTimeSec = 12) {
|
|
302554
303854
|
const targetTimestampSec = Math.floor(targetDate.getTime() / 1e3);
|
|
302555
303855
|
if (targetTimestampSec >= headTimestampSec) return headNumber;
|
|
@@ -304733,7 +306033,7 @@ var init_providers = __esmMin((async () => {
|
|
|
304733
306033
|
];
|
|
304734
306034
|
}));
|
|
304735
306035
|
//#endregion
|
|
304736
|
-
//#region ../../node_modules/.pnpm/@xyo-network+xl1-sdk@4.5.2_@ariestools+sdk@8.1.
|
|
306036
|
+
//#region ../../node_modules/.pnpm/@xyo-network+xl1-sdk@4.5.2_@ariestools+sdk@8.1.3_@opentelemetry+api@1.9.1_zod@4.4.3__@m_dc0dd298d74018ffeb60a46379811c7a/node_modules/@xyo-network/xl1-sdk/dist/neutral/gateway.mjs
|
|
304737
306037
|
var __defProp$3, __getOwnPropDesc$3, __defNormalProp$3, __decorateClass$3, __publicField$3, XyoSignerWrapper;
|
|
304738
306038
|
var init_gateway = __esmMin((async () => {
|
|
304739
306039
|
await init_protocol_lib();
|
|
@@ -304784,7 +306084,7 @@ var init_gateway = __esmMin((async () => {
|
|
|
304784
306084
|
XyoSignerWrapper = __decorateClass$3([creatableProvider()], XyoSignerWrapper);
|
|
304785
306085
|
}));
|
|
304786
306086
|
//#endregion
|
|
304787
|
-
//#region ../../node_modules/.pnpm/@xyo-network+xl1-sdk@4.5.2_@ariestools+sdk@8.1.
|
|
306087
|
+
//#region ../../node_modules/.pnpm/@xyo-network+xl1-sdk@4.5.2_@ariestools+sdk@8.1.3_@opentelemetry+api@1.9.1_zod@4.4.3__@m_dc0dd298d74018ffeb60a46379811c7a/node_modules/@xyo-network/xl1-sdk/dist/neutral/wrappers.mjs
|
|
304788
306088
|
function parseHexOrBigInt(value) {
|
|
304789
306089
|
return AttoXL1(typeof value === "bigint" ? value : hexToBigInt(value));
|
|
304790
306090
|
}
|
|
@@ -305024,7 +306324,7 @@ var init_wrappers$1 = __esmMin((async () => {
|
|
|
305024
306324
|
};
|
|
305025
306325
|
}));
|
|
305026
306326
|
//#endregion
|
|
305027
|
-
//#region ../../node_modules/.pnpm/@xyo-network+xl1-sdk@4.5.2_@ariestools+sdk@8.1.
|
|
306327
|
+
//#region ../../node_modules/.pnpm/@xyo-network+xl1-sdk@4.5.2_@ariestools+sdk@8.1.3_@opentelemetry+api@1.9.1_zod@4.4.3__@m_dc0dd298d74018ffeb60a46379811c7a/node_modules/@xyo-network/xl1-sdk/dist/neutral/index.mjs
|
|
305028
306328
|
var init_neutral = __esmMin((async () => {
|
|
305029
306329
|
await init_neutral$2();
|
|
305030
306330
|
init_driver_memory();
|
|
@@ -310202,7 +311502,7 @@ async function runYargsCli(options) {
|
|
|
310202
311502
|
await configured.version().help().parseAsync();
|
|
310203
311503
|
}
|
|
310204
311504
|
//#endregion
|
|
310205
|
-
//#region ../../node_modules/.pnpm/@xyo-network+chain-sdk@4.4.
|
|
311505
|
+
//#region ../../node_modules/.pnpm/@xyo-network+chain-sdk@4.4.0_2a39c5ab41a27413a13d99a7f5f98acd/node_modules/@xyo-network/chain-sdk/dist/neutral/analyze.mjs
|
|
310206
311506
|
var analyzeBlock, analyzeChain, ChainSummaryBalancesSchema, isChainSummaryBalances, bigintBalances, BalanceAnalyzer, ChainFinalizer, ChainHeadSelector, ChainSummaryProducersSchema, isChainSummaryProducers, ChainProducersAnalyzer, ChainSummaryStakeIntentSchema, isChainSummaryStakeIntent, ChainStakeIntentAnalyzer, ChainSummaryTransfersSchema, isChainSummaryTransfers, bigintTransfers, TransferAnalyzer;
|
|
310207
311507
|
var init_analyze = __esmMin((async () => {
|
|
310208
311508
|
init_node$4();
|
|
@@ -310492,7 +311792,7 @@ var init_analyze = __esmMin((async () => {
|
|
|
310492
311792
|
};
|
|
310493
311793
|
}));
|
|
310494
311794
|
//#endregion
|
|
310495
|
-
//#region ../../node_modules/.pnpm/@xyo-network+chain-sdk@4.4.
|
|
311795
|
+
//#region ../../node_modules/.pnpm/@xyo-network+chain-sdk@4.4.0_2a39c5ab41a27413a13d99a7f5f98acd/node_modules/@xyo-network/chain-sdk/dist/neutral/protocol.mjs
|
|
310496
311796
|
function calculateCompletedStepReward(step, balance) {
|
|
310497
311797
|
return AttoXL1(StepRewardFractions[step][0] * balance / StepRewardFractions[step][1]);
|
|
310498
311798
|
}
|
|
@@ -310664,7 +311964,7 @@ var init_protocol = __esmMin((async () => {
|
|
|
310664
311964
|
toSortedBlocks = (blocks, compareFn = sortBlocksAscending) => sortBlocks([...blocks], compareFn);
|
|
310665
311965
|
}));
|
|
310666
311966
|
//#endregion
|
|
310667
|
-
//#region ../../node_modules/.pnpm/@xyo-network+chain-sdk@4.4.
|
|
311967
|
+
//#region ../../node_modules/.pnpm/@xyo-network+chain-sdk@4.4.0_2a39c5ab41a27413a13d99a7f5f98acd/node_modules/@xyo-network/chain-sdk/dist/neutral/ethereum.mjs
|
|
310668
311968
|
function blockRangeChunks(fromBlock, toBlock, chunkSize) {
|
|
310669
311969
|
if (!Number.isInteger(chunkSize) || chunkSize < 1) throw new TypeError(`chunkSize must be an integer >= 1, got ${chunkSize}`);
|
|
310670
311970
|
if (!Number.isFinite(fromBlock) || !Number.isFinite(toBlock)) throw new TypeError(`fromBlock and toBlock must be finite numbers, got [${fromBlock}, ${toBlock}]`);
|
|
@@ -311140,7 +312440,7 @@ var init_ethereum = __esmMin((async () => {
|
|
|
311140
312440
|
EvmStakeRunner = __decorateClass$2([creatableProvider()], EvmStakeRunner);
|
|
311141
312441
|
}));
|
|
311142
312442
|
//#endregion
|
|
311143
|
-
//#region ../../node_modules/.pnpm/@xyo-network+chain-sdk@4.4.
|
|
312443
|
+
//#region ../../node_modules/.pnpm/@xyo-network+chain-sdk@4.4.0_2a39c5ab41a27413a13d99a7f5f98acd/node_modules/@xyo-network/chain-sdk/dist/neutral/validation.mjs
|
|
311144
312444
|
function TransactionTransfersInBlockValidatorFactory(transfersValidator) {
|
|
311145
312445
|
return async (context, hydratedBlock) => {
|
|
311146
312446
|
const [block, payloads] = hydratedBlock;
|
|
@@ -311560,7 +312860,7 @@ var init_validation = __esmMin((async () => {
|
|
|
311560
312860
|
};
|
|
311561
312861
|
}));
|
|
311562
312862
|
//#endregion
|
|
311563
|
-
//#region ../../node_modules/.pnpm/@xyo-network+chain-sdk@4.4.
|
|
312863
|
+
//#region ../../node_modules/.pnpm/@xyo-network+chain-sdk@4.4.0_2a39c5ab41a27413a13d99a7f5f98acd/node_modules/@xyo-network/chain-sdk/dist/neutral/modules.mjs
|
|
311564
312864
|
var __defProp$1, __getOwnPropDesc$1, __getProtoOf, __reflectGet, __defNormalProp$1, __decorateClass$1, __publicField$1, __superGet, BlockRewardDivinerConfigSchema, BlockRewardDiviner, BlockRewardSchema, isBlockReward, asBlockReward, asOptionalBlockReward, isBlockRewardWithSources, asBlockRewardWithSources, asOptionalBlockRewardWithSources, FixedPercentageBlockRewardDivinerConfigSchema, FixedPercentageBlockRewardDiviner, countDecimalPlaces, BlockValidationDivinerConfigSchema, BlockValidationDiviner, HeadValidationDivinerConfigSchema, HeadValidationDiviner, ArchivistNextWitnessConfigSchema, ArchivistNextWitness, WeightedNetworkStakeSchema, isWeightedNetworkStake, asWeightedNetworkStakePayload, asWeightedNetworkStakePayloadWithStorageMeta, NetworkStakeObserveSchema, isNetworkStakeObserve, asNetworkStakeObservePayload, asNetworkStakeObservePayloadWithStorageMeta;
|
|
311565
312865
|
var init_modules = __esmMin((async () => {
|
|
311566
312866
|
await init_node$1();
|
|
@@ -318524,7 +319824,7 @@ var require_index_shim = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
318524
319824
|
});
|
|
318525
319825
|
}));
|
|
318526
319826
|
//#endregion
|
|
318527
|
-
//#region ../../node_modules/.pnpm/@xyo-network+chain-sdk@4.4.
|
|
319827
|
+
//#region ../../node_modules/.pnpm/@xyo-network+chain-sdk@4.4.0_2a39c5ab41a27413a13d99a7f5f98acd/node_modules/@xyo-network/chain-sdk/dist/neutral/utils.mjs
|
|
318528
319828
|
function formatNumberForDisplay(value, significantFigures = 5, bigIntShift = 18) {
|
|
318529
319829
|
const resolvedValue = typeof value === "bigint" ? bigIntToFixedPointString(value, bigIntShift) : value;
|
|
318530
319830
|
if (!resolvedValue.includes(".")) return safeReturnInteger(resolvedValue);
|
|
@@ -319217,7 +320517,7 @@ var init_utils = __esmMin((async () => {
|
|
|
319217
320517
|
};
|
|
319218
320518
|
}));
|
|
319219
320519
|
//#endregion
|
|
319220
|
-
//#region ../../node_modules/.pnpm/@xyo-network+chain-sdk@4.4.
|
|
320520
|
+
//#region ../../node_modules/.pnpm/@xyo-network+chain-sdk@4.4.0_2a39c5ab41a27413a13d99a7f5f98acd/node_modules/@xyo-network/chain-sdk/dist/neutral/services.mjs
|
|
319221
320521
|
async function processPendingBlocks({ blockValidationViewer, blockViewer, context, logger, mempoolViewer, finalizationRunner, allowedProducers, minCandidates, deadLetterQueueRunner }) {
|
|
319222
320522
|
const start = Date.now();
|
|
319223
320523
|
const currentBlock = await blockViewer.currentBlock();
|
|
@@ -360216,7 +361516,7 @@ var require_src = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
360216
361516
|
});
|
|
360217
361517
|
}));
|
|
360218
361518
|
//#endregion
|
|
360219
|
-
//#region ../../node_modules/.pnpm/@xyo-network+chain-sdk@4.4.
|
|
361519
|
+
//#region ../../node_modules/.pnpm/@xyo-network+chain-sdk@4.4.0_2a39c5ab41a27413a13d99a7f5f98acd/node_modules/@xyo-network/chain-sdk/dist/node/telemetry.mjs
|
|
360220
361520
|
function initTelemetry(params) {
|
|
360221
361521
|
const { attributes, metricsConfig, otlpEndpoint } = params;
|
|
360222
361522
|
initContextManager();
|
|
@@ -360323,7 +361623,7 @@ var init_telemetry = __esmMin((() => {
|
|
|
360323
361623
|
};
|
|
360324
361624
|
}));
|
|
360325
361625
|
//#endregion
|
|
360326
|
-
//#region ../../node_modules/.pnpm/@xyo-network+chain-sdk@4.4.
|
|
361626
|
+
//#region ../../node_modules/.pnpm/@xyo-network+chain-sdk@4.4.0_2a39c5ab41a27413a13d99a7f5f98acd/node_modules/@xyo-network/chain-sdk/dist/neutral/wrappers.mjs
|
|
360327
361627
|
var sumTransfers, HydratedBlockWrapper;
|
|
360328
361628
|
var init_wrappers = __esmMin((async () => {
|
|
360329
361629
|
init_node$4();
|
|
@@ -360418,7 +361718,7 @@ var init_wrappers = __esmMin((async () => {
|
|
|
360418
361718
|
};
|
|
360419
361719
|
}));
|
|
360420
361720
|
//#endregion
|
|
360421
|
-
//#region ../../node_modules/.pnpm/@xyo-network+chain-sdk@4.4.
|
|
361721
|
+
//#region ../../node_modules/.pnpm/@xyo-network+chain-sdk@4.4.0_2a39c5ab41a27413a13d99a7f5f98acd/node_modules/@xyo-network/chain-sdk/dist/node/index.mjs
|
|
360422
361722
|
var node_exports = /* @__PURE__ */ __exportAll({
|
|
360423
361723
|
AbstractEvmProvider: () => AbstractEvmProvider,
|
|
360424
361724
|
AbstractEvmRunner: () => AbstractEvmRunner,
|