@wishknish/knishio-client-js 0.8.1 → 0.8.2

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.
@@ -546,7 +546,7 @@ class g {
546
546
  }
547
547
  /**
548
548
  * Returns JSON-ready object for cross-SDK compatibility (2025 JS best practices)
549
- *
549
+ *
550
550
  * Provides clean serialization of atomic operations with optional OTS fragments.
551
551
  * Follows 2025 JavaScript best practices with proper type safety and validation.
552
552
  *
@@ -589,7 +589,7 @@ class g {
589
589
  }
590
590
  /**
591
591
  * Creates an Atom instance from JSON data (2025 JS best practices)
592
- *
592
+ *
593
593
  * Handles cross-SDK atom deserialization with robust error handling.
594
594
  * Essential for reconstructing atoms from other SDK implementations.
595
595
  *
@@ -1861,8 +1861,7 @@ class Be extends x {
1861
1861
  }
1862
1862
  }
1863
1863
  class $t {
1864
- constructor({}) {
1865
- const e = arguments[0];
1864
+ constructor(e = {}) {
1866
1865
  for (const t in e)
1867
1866
  this[`__${t}`] = e[t];
1868
1867
  }
@@ -3106,8 +3105,8 @@ class z {
3106
3105
  signingWallet: t = null
3107
3106
  }) {
3108
3107
  let n = 0;
3109
- for (const [r, i] of Object.entries(e || {}))
3110
- n += i;
3108
+ for (const r of Object.values(e || {}))
3109
+ n += r;
3111
3110
  if (this.sourceWallet.balance - n < 0)
3112
3111
  throw new ue();
3113
3112
  const s = new P();
@@ -7178,12 +7177,42 @@ class Tr {
7178
7177
  encrypt: !!this.cipherLink
7179
7178
  });
7180
7179
  }
7180
+ /**
7181
+ * Builds the urql operation options forwarded with a query/mutation.
7182
+ *
7183
+ * Forwards the requestPolicy (so a long-lived client does not serve stale
7184
+ * cache-first reads) and, when the caller supplied a per-query abort signal,
7185
+ * the signal too — while re-supplying the X-Auth-Token header. urql REPLACES
7186
+ * (not merges) the client-level fetchOptions with any operation-context
7187
+ * fetchOptions (createRequestOperation builds the op context as
7188
+ * {...baseOpts, ...opts}), so forwarding fetchOptions WITHOUT the header would
7189
+ * drop X-Auth-Token and break auth. The header here is byte-identical to the
7190
+ * client-level one set in createUrqlClient.
7191
+ *
7192
+ * @param {object} context
7193
+ * @returns {object|undefined}
7194
+ */
7195
+ buildRequestOptions(e) {
7196
+ if (!e)
7197
+ return;
7198
+ const t = {};
7199
+ e.requestPolicy && (t.requestPolicy = e.requestPolicy);
7200
+ const n = e.fetchOptions && e.fetchOptions.signal;
7201
+ if (n) {
7202
+ const s = typeof AbortSignal < "u" && typeof AbortSignal.any == "function" ? AbortSignal.any([n, AbortSignal.timeout(6e4)]) : n;
7203
+ t.fetchOptions = {
7204
+ headers: { "X-Auth-Token": this.$__authToken },
7205
+ signal: s
7206
+ };
7207
+ }
7208
+ return Object.keys(t).length ? t : void 0;
7209
+ }
7181
7210
  async query(e) {
7182
- const { query: t, variables: n, context: s } = e, r = s && s.requestPolicy ? { requestPolicy: s.requestPolicy } : void 0, i = await this.$__client.query(t, n || {}, r).toPromise();
7211
+ const { query: t, variables: n, context: s } = e, r = this.buildRequestOptions(s), i = await this.$__client.query(t, n || {}, r).toPromise();
7183
7212
  return this.formatResponse(i);
7184
7213
  }
7185
7214
  async mutate(e) {
7186
- const { mutation: t, variables: n, context: s } = e, r = s && s.requestPolicy ? { requestPolicy: s.requestPolicy } : void 0, i = await this.$__client.mutation(t, n || {}, r).toPromise();
7215
+ const { mutation: t, variables: n, context: s } = e, r = this.buildRequestOptions(s), i = await this.$__client.mutation(t, n || {}, r).toPromise();
7187
7216
  return this.formatResponse(i);
7188
7217
  }
7189
7218
  subscribe(e, t) {