@donezone/cli 0.1.51 → 0.1.55

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/index.js CHANGED
@@ -9536,20 +9536,20 @@ var require_bn = __commonJS((exports, module) => {
9536
9536
  MPrime.call(this, "k256", "ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f");
9537
9537
  }
9538
9538
  inherits(K256, MPrime);
9539
- K256.prototype.split = function split(input, output2) {
9539
+ K256.prototype.split = function split(input, output) {
9540
9540
  var mask = 4194303;
9541
9541
  var outLen = Math.min(input.length, 9);
9542
9542
  for (var i = 0;i < outLen; i++) {
9543
- output2.words[i] = input.words[i];
9543
+ output.words[i] = input.words[i];
9544
9544
  }
9545
- output2.length = outLen;
9545
+ output.length = outLen;
9546
9546
  if (input.length <= 9) {
9547
9547
  input.words[0] = 0;
9548
9548
  input.length = 1;
9549
9549
  return;
9550
9550
  }
9551
9551
  var prev = input.words[9];
9552
- output2.words[output2.length++] = prev & mask;
9552
+ output.words[output.length++] = prev & mask;
9553
9553
  for (i = 10;i < input.length; i++) {
9554
9554
  var next = input.words[i] | 0;
9555
9555
  input.words[i - 10] = (next & mask) << 4 | prev >>> 22;
@@ -10022,11 +10022,11 @@ var require_utils4 = __commonJS((exports) => {
10022
10022
  return this[key] !== undefined ? this[key] : this[key] = computer.call(this);
10023
10023
  };
10024
10024
  }
10025
- function parseBytes(bytes2) {
10026
- return typeof bytes2 === "string" ? utils.toArray(bytes2, "hex") : bytes2;
10025
+ function parseBytes(bytes) {
10026
+ return typeof bytes === "string" ? utils.toArray(bytes, "hex") : bytes;
10027
10027
  }
10028
- function intFromLE(bytes2) {
10029
- return new BN(bytes2, "hex", "le");
10028
+ function intFromLE(bytes) {
10029
+ return new BN(bytes, "hex", "le");
10030
10030
  }
10031
10031
  var utils = exports;
10032
10032
  var BN = require_bn();
@@ -10312,18 +10312,18 @@ var require_base = __commonJS((exports, module) => {
10312
10312
  BasePoint.prototype.validate = function validate() {
10313
10313
  return this.curve.validate(this);
10314
10314
  };
10315
- BaseCurve.prototype.decodePoint = function decodePoint(bytes2, enc) {
10316
- bytes2 = utils.toArray(bytes2, enc);
10315
+ BaseCurve.prototype.decodePoint = function decodePoint(bytes, enc) {
10316
+ bytes = utils.toArray(bytes, enc);
10317
10317
  var len = this.p.byteLength();
10318
- if ((bytes2[0] === 4 || bytes2[0] === 6 || bytes2[0] === 7) && bytes2.length - 1 === 2 * len) {
10319
- if (bytes2[0] === 6)
10320
- assert(bytes2[bytes2.length - 1] % 2 === 0);
10321
- else if (bytes2[0] === 7)
10322
- assert(bytes2[bytes2.length - 1] % 2 === 1);
10323
- var res = this.point(bytes2.slice(1, 1 + len), bytes2.slice(1 + len, 1 + 2 * len));
10318
+ if ((bytes[0] === 4 || bytes[0] === 6 || bytes[0] === 7) && bytes.length - 1 === 2 * len) {
10319
+ if (bytes[0] === 6)
10320
+ assert(bytes[bytes.length - 1] % 2 === 0);
10321
+ else if (bytes[0] === 7)
10322
+ assert(bytes[bytes.length - 1] % 2 === 1);
10323
+ var res = this.point(bytes.slice(1, 1 + len), bytes.slice(1 + len, 1 + 2 * len));
10324
10324
  return res;
10325
- } else if ((bytes2[0] === 2 || bytes2[0] === 3) && bytes2.length - 1 === len) {
10326
- return this.pointFromX(bytes2.slice(1, 1 + len), bytes2[0] === 3);
10325
+ } else if ((bytes[0] === 2 || bytes[0] === 3) && bytes.length - 1 === len) {
10326
+ return this.pointFromX(bytes.slice(1, 1 + len), bytes[0] === 3);
10327
10327
  }
10328
10328
  throw new Error("Unknown point format");
10329
10329
  };
@@ -11177,8 +11177,8 @@ var require_mont = __commonJS((exports, module) => {
11177
11177
  return y.redSqr().cmp(rhs) === 0;
11178
11178
  };
11179
11179
  inherits(Point, Base.BasePoint);
11180
- MontCurve.prototype.decodePoint = function decodePoint(bytes2, enc) {
11181
- return this.point(utils.toArray(bytes2, enc), 1);
11180
+ MontCurve.prototype.decodePoint = function decodePoint(bytes, enc) {
11181
+ return this.point(utils.toArray(bytes, enc), 1);
11182
11182
  };
11183
11183
  MontCurve.prototype.point = function point(x, z) {
11184
11184
  return new Point(this, x, z);
@@ -11850,8 +11850,8 @@ var require_common = __commonJS((exports) => {
11850
11850
  };
11851
11851
  BlockHash.prototype._pad = function pad() {
11852
11852
  var len = this.pendingTotal;
11853
- var bytes2 = this._delta8;
11854
- var k = bytes2 - (len + this.padLength) % bytes2;
11853
+ var bytes = this._delta8;
11854
+ var k = bytes - (len + this.padLength) % bytes;
11855
11855
  var res = new Array(k + this.padLength);
11856
11856
  res[0] = 128;
11857
11857
  for (var i = 1;i < k; i++)
@@ -11998,9 +11998,9 @@ var require_1 = __commonJS((exports, module) => {
11998
11998
 
11999
11999
  // ../../node_modules/hash.js/lib/hash/sha/256.js
12000
12000
  var require_256 = __commonJS((exports, module) => {
12001
- function SHA2562() {
12002
- if (!(this instanceof SHA2562))
12003
- return new SHA2562;
12001
+ function SHA256() {
12002
+ if (!(this instanceof SHA256))
12003
+ return new SHA256;
12004
12004
  BlockHash.call(this);
12005
12005
  this.h = [
12006
12006
  1779033703,
@@ -12095,13 +12095,13 @@ var require_256 = __commonJS((exports, module) => {
12095
12095
  3204031479,
12096
12096
  3329325298
12097
12097
  ];
12098
- utils.inherits(SHA2562, BlockHash);
12099
- module.exports = SHA2562;
12100
- SHA2562.blockSize = 512;
12101
- SHA2562.outSize = 256;
12102
- SHA2562.hmacStrength = 192;
12103
- SHA2562.padLength = 64;
12104
- SHA2562.prototype._update = function _update(msg, start) {
12098
+ utils.inherits(SHA256, BlockHash);
12099
+ module.exports = SHA256;
12100
+ SHA256.blockSize = 512;
12101
+ SHA256.outSize = 256;
12102
+ SHA256.hmacStrength = 192;
12103
+ SHA256.padLength = 64;
12104
+ SHA256.prototype._update = function _update(msg, start) {
12105
12105
  var W = this.W;
12106
12106
  for (var i = 0;i < 16; i++)
12107
12107
  W[i] = msg[start + i];
@@ -12137,7 +12137,7 @@ var require_256 = __commonJS((exports, module) => {
12137
12137
  this.h[6] = sum32(this.h[6], g);
12138
12138
  this.h[7] = sum32(this.h[7], h);
12139
12139
  };
12140
- SHA2562.prototype._digest = function digest(enc) {
12140
+ SHA256.prototype._digest = function digest(enc) {
12141
12141
  if (enc === "hex")
12142
12142
  return utils.toHex32(this.h, "big");
12143
12143
  else
@@ -12150,7 +12150,7 @@ var require_224 = __commonJS((exports, module) => {
12150
12150
  function SHA224() {
12151
12151
  if (!(this instanceof SHA224))
12152
12152
  return new SHA224;
12153
- SHA2562.call(this);
12153
+ SHA256.call(this);
12154
12154
  this.h = [
12155
12155
  3238371032,
12156
12156
  914150663,
@@ -12163,8 +12163,8 @@ var require_224 = __commonJS((exports, module) => {
12163
12163
  ];
12164
12164
  }
12165
12165
  var utils = require_utils5();
12166
- var SHA2562 = require_256();
12167
- utils.inherits(SHA224, SHA2562);
12166
+ var SHA256 = require_256();
12167
+ utils.inherits(SHA224, SHA256);
12168
12168
  module.exports = SHA224;
12169
12169
  SHA224.blockSize = 512;
12170
12170
  SHA224.outSize = 224;
@@ -14434,10 +14434,10 @@ var require_ec = __commonJS((exports, module) => {
14434
14434
  entropyEnc: options.entropy && options.entropyEnc || "utf8",
14435
14435
  nonce: this.n.toArray()
14436
14436
  });
14437
- var bytes2 = this.n.byteLength();
14437
+ var bytes = this.n.byteLength();
14438
14438
  var ns2 = this.n.sub(new BN(2));
14439
14439
  for (;; ) {
14440
- var priv = new BN(drbg.generate(bytes2));
14440
+ var priv = new BN(drbg.generate(bytes));
14441
14441
  if (priv.cmp(ns2) > 0)
14442
14442
  continue;
14443
14443
  priv.iaddn(1);
@@ -14484,9 +14484,9 @@ var require_ec = __commonJS((exports, module) => {
14484
14484
  key = this.keyFromPrivate(key, enc);
14485
14485
  msg = this._truncateToN(msg, false, options.msgBitLength);
14486
14486
  assert(!msg.isNeg(), "Can not sign a negative message");
14487
- var bytes2 = this.n.byteLength();
14488
- var bkey = key.getPrivate().toArray("be", bytes2);
14489
- var nonce = msg.toArray("be", bytes2);
14487
+ var bytes = this.n.byteLength();
14488
+ var bkey = key.getPrivate().toArray("be", bytes);
14489
+ var nonce = msg.toArray("be", bytes);
14490
14490
  assert(new BN(nonce).eq(msg), "Can not sign message");
14491
14491
  var drbg = new HmacDRBG({
14492
14492
  hash: this.hash,
@@ -14769,19 +14769,19 @@ var require_eddsa = __commonJS((exports, module) => {
14769
14769
  enc[this.encodingLength - 1] |= point.getX().isOdd() ? 128 : 0;
14770
14770
  return enc;
14771
14771
  };
14772
- EDDSA.prototype.decodePoint = function decodePoint(bytes2) {
14773
- bytes2 = utils.parseBytes(bytes2);
14774
- var lastIx = bytes2.length - 1;
14775
- var normed = bytes2.slice(0, lastIx).concat(bytes2[lastIx] & ~128);
14776
- var xIsOdd = (bytes2[lastIx] & 128) !== 0;
14772
+ EDDSA.prototype.decodePoint = function decodePoint(bytes) {
14773
+ bytes = utils.parseBytes(bytes);
14774
+ var lastIx = bytes.length - 1;
14775
+ var normed = bytes.slice(0, lastIx).concat(bytes[lastIx] & ~128);
14776
+ var xIsOdd = (bytes[lastIx] & 128) !== 0;
14777
14777
  var y = utils.intFromLE(normed);
14778
14778
  return this.curve.pointFromY(y, xIsOdd);
14779
14779
  };
14780
14780
  EDDSA.prototype.encodeInt = function encodeInt(num) {
14781
14781
  return num.toArray("le", this.encodingLength);
14782
14782
  };
14783
- EDDSA.prototype.decodeInt = function decodeInt(bytes2) {
14784
- return utils.intFromLE(bytes2);
14783
+ EDDSA.prototype.decodeInt = function decodeInt(bytes) {
14784
+ return utils.intFromLE(bytes);
14785
14785
  };
14786
14786
  EDDSA.prototype.isPoint = function isPoint(val) {
14787
14787
  return val instanceof this.pointClass;
@@ -14844,9 +14844,9 @@ var require_memory = __commonJS((exports) => {
14844
14844
  get json() {
14845
14845
  return this.read_json();
14846
14846
  }
14847
- write(bytes2) {
14848
- this.slice.set(bytes2);
14849
- this.length = bytes2.length;
14847
+ write(bytes) {
14848
+ this.slice.set(bytes);
14849
+ this.length = bytes.length;
14850
14850
  }
14851
14851
  write_b64(b64) {
14852
14852
  this.write(Buffer.from(b64, "base64"));
@@ -14953,12 +14953,12 @@ var require_base64_js = __commonJS((exports) => {
14953
14953
  }
14954
14954
  function encodeChunk(uint8, start, end) {
14955
14955
  var tmp;
14956
- var output2 = [];
14956
+ var output = [];
14957
14957
  for (var i2 = start;i2 < end; i2 += 3) {
14958
14958
  tmp = (uint8[i2] << 16 & 16711680) + (uint8[i2 + 1] << 8 & 65280) + (uint8[i2 + 2] & 255);
14959
- output2.push(tripletToBase64(tmp));
14959
+ output.push(tripletToBase64(tmp));
14960
14960
  }
14961
- return output2.join("");
14961
+ return output.join("");
14962
14962
  }
14963
14963
  function fromByteArray(uint8) {
14964
14964
  var tmp;
@@ -15162,13 +15162,13 @@ var require_bech32 = __commonJS((exports, module) => {
15162
15162
  }
15163
15163
  return result;
15164
15164
  }
15165
- function toWordsUnsafe(bytes2) {
15166
- var res = convert(bytes2, 8, 5, true);
15165
+ function toWordsUnsafe(bytes) {
15166
+ var res = convert(bytes, 8, 5, true);
15167
15167
  if (Array.isArray(res))
15168
15168
  return res;
15169
15169
  }
15170
- function toWords(bytes2) {
15171
- var res = convert(bytes2, 8, 5, true);
15170
+ function toWords(bytes) {
15171
+ var res = convert(bytes, 8, 5, true);
15172
15172
  if (Array.isArray(res))
15173
15173
  return res;
15174
15174
  throw new Error(res);
@@ -15463,8 +15463,8 @@ var require_dist = __commonJS((exports) => {
15463
15463
  }
15464
15464
  return result;
15465
15465
  }
15466
- function toWords(bytes2) {
15467
- return convert(bytes2, 8, 5, true);
15466
+ function toWords(bytes) {
15467
+ return convert(bytes, 8, 5, true);
15468
15468
  }
15469
15469
  function fromWordsUnsafe(words) {
15470
15470
  const res = convert(words, 5, 8, false);
@@ -15639,8 +15639,8 @@ var require_backendApi = __commonJS((exports) => {
15639
15639
 
15640
15640
  // ../../node_modules/@terran-one/cosmwasm-vm-js/dist/backend/querier.js
15641
15641
  var require_querier = __commonJS((exports) => {
15642
- function parseQuery(bytes2) {
15643
- const query = JSON.parse(new TextDecoder().decode(bytes2));
15642
+ function parseQuery(bytes) {
15643
+ const query = JSON.parse(new TextDecoder().decode(bytes));
15644
15644
  return query;
15645
15645
  }
15646
15646
  function objectToBase64(obj) {
@@ -17157,7 +17157,7 @@ var require_immutable = __commonJS((exports, module) => {
17157
17157
  throw new TypeError("Invalid keyPath: expected Ordered Collection or Array: " + keyPath);
17158
17158
  }
17159
17159
  var toString = Object.prototype.toString;
17160
- function isPlainObject2(value) {
17160
+ function isPlainObject(value) {
17161
17161
  if (!value || typeof value !== "object" || toString.call(value) !== "[object Object]") {
17162
17162
  return false;
17163
17163
  }
@@ -17174,7 +17174,7 @@ var require_immutable = __commonJS((exports, module) => {
17174
17174
  return parentProto === proto;
17175
17175
  }
17176
17176
  function isDataStructure(value) {
17177
- return typeof value === "object" && (isImmutable(value) || Array.isArray(value) || isPlainObject2(value));
17177
+ return typeof value === "object" && (isImmutable(value) || Array.isArray(value) || isPlainObject(value));
17178
17178
  }
17179
17179
  function quoteString(value) {
17180
17180
  try {
@@ -17604,21 +17604,21 @@ var require_immutable = __commonJS((exports, module) => {
17604
17604
  break;
17605
17605
  }
17606
17606
  }
17607
- var exists2 = idx < len;
17608
- if (exists2 ? entries[idx][1] === value : removed) {
17607
+ var exists = idx < len;
17608
+ if (exists ? entries[idx][1] === value : removed) {
17609
17609
  return this;
17610
17610
  }
17611
17611
  SetRef(didAlter);
17612
- (removed || !exists2) && SetRef(didChangeSize);
17612
+ (removed || !exists) && SetRef(didChangeSize);
17613
17613
  if (removed && entries.length === 1) {
17614
17614
  return;
17615
17615
  }
17616
- if (!exists2 && !removed && entries.length >= MAX_ARRAY_MAP_SIZE) {
17616
+ if (!exists && !removed && entries.length >= MAX_ARRAY_MAP_SIZE) {
17617
17617
  return createNodes(ownerID, entries, key, value);
17618
17618
  }
17619
17619
  var isEditable = ownerID && ownerID === this.ownerID;
17620
17620
  var newEntries = isEditable ? entries : arrCopy(entries);
17621
- if (exists2) {
17621
+ if (exists) {
17622
17622
  if (removed) {
17623
17623
  idx === len - 1 ? newEntries.pop() : newEntries[idx] = newEntries.pop();
17624
17624
  } else {
@@ -17653,29 +17653,29 @@ var require_immutable = __commonJS((exports, module) => {
17653
17653
  var keyHashFrag = (shift === 0 ? keyHash : keyHash >>> shift) & MASK;
17654
17654
  var bit = 1 << keyHashFrag;
17655
17655
  var bitmap = this.bitmap;
17656
- var exists2 = (bitmap & bit) !== 0;
17657
- if (!exists2 && value === NOT_SET) {
17656
+ var exists = (bitmap & bit) !== 0;
17657
+ if (!exists && value === NOT_SET) {
17658
17658
  return this;
17659
17659
  }
17660
17660
  var idx = popCount(bitmap & bit - 1);
17661
17661
  var nodes = this.nodes;
17662
- var node = exists2 ? nodes[idx] : undefined;
17662
+ var node = exists ? nodes[idx] : undefined;
17663
17663
  var newNode = updateNode(node, ownerID, shift + SHIFT, keyHash, key, value, didChangeSize, didAlter);
17664
17664
  if (newNode === node) {
17665
17665
  return this;
17666
17666
  }
17667
- if (!exists2 && newNode && nodes.length >= MAX_BITMAP_INDEXED_SIZE) {
17667
+ if (!exists && newNode && nodes.length >= MAX_BITMAP_INDEXED_SIZE) {
17668
17668
  return expandNodes(ownerID, nodes, bitmap, keyHashFrag, newNode);
17669
17669
  }
17670
- if (exists2 && !newNode && nodes.length === 2 && isLeafNode(nodes[idx ^ 1])) {
17670
+ if (exists && !newNode && nodes.length === 2 && isLeafNode(nodes[idx ^ 1])) {
17671
17671
  return nodes[idx ^ 1];
17672
17672
  }
17673
- if (exists2 && newNode && nodes.length === 1 && isLeafNode(newNode)) {
17673
+ if (exists && newNode && nodes.length === 1 && isLeafNode(newNode)) {
17674
17674
  return newNode;
17675
17675
  }
17676
17676
  var isEditable = ownerID && ownerID === this.ownerID;
17677
- var newBitmap = exists2 ? newNode ? bitmap : bitmap ^ bit : bitmap | bit;
17678
- var newNodes = exists2 ? newNode ? setAt(nodes, idx, newNode, isEditable) : spliceOut(nodes, idx, isEditable) : spliceIn(nodes, idx, newNode, isEditable);
17677
+ var newBitmap = exists ? newNode ? bitmap : bitmap ^ bit : bitmap | bit;
17678
+ var newNodes = exists ? newNode ? setAt(nodes, idx, newNode, isEditable) : spliceOut(nodes, idx, isEditable) : spliceIn(nodes, idx, newNode, isEditable);
17679
17679
  if (isEditable) {
17680
17680
  this.bitmap = newBitmap;
17681
17681
  this.nodes = newNodes;
@@ -17764,18 +17764,18 @@ var require_immutable = __commonJS((exports, module) => {
17764
17764
  break;
17765
17765
  }
17766
17766
  }
17767
- var exists2 = idx < len;
17768
- if (exists2 ? entries[idx][1] === value : removed) {
17767
+ var exists = idx < len;
17768
+ if (exists ? entries[idx][1] === value : removed) {
17769
17769
  return this;
17770
17770
  }
17771
17771
  SetRef(didAlter);
17772
- (removed || !exists2) && SetRef(didChangeSize);
17772
+ (removed || !exists) && SetRef(didChangeSize);
17773
17773
  if (removed && len === 2) {
17774
17774
  return new ValueNode(ownerID, this.keyHash, entries[idx ^ 1]);
17775
17775
  }
17776
17776
  var isEditable = ownerID && ownerID === this.ownerID;
17777
17777
  var newEntries = isEditable ? entries : arrCopy(entries);
17778
- if (exists2) {
17778
+ if (exists) {
17779
17779
  if (removed) {
17780
17780
  idx === len - 1 ? newEntries.pop() : newEntries[idx] = newEntries.pop();
17781
17781
  } else {
@@ -20095,7 +20095,7 @@ var require_immutable = __commonJS((exports, module) => {
20095
20095
  return fromJSWith([], converter || defaultConverter, value, "", converter && converter.length > 2 ? [] : undefined, { "": value });
20096
20096
  }
20097
20097
  function fromJSWith(stack, converter, value, key, keyPath, parentValue) {
20098
- if (typeof value !== "string" && !isImmutable(value) && (isArrayLike(value) || hasIterator(value) || isPlainObject2(value))) {
20098
+ if (typeof value !== "string" && !isImmutable(value) && (isArrayLike(value) || hasIterator(value) || isPlainObject(value))) {
20099
20099
  if (~stack.indexOf(value)) {
20100
20100
  throw new TypeError("Cannot convert circular structure to Immutable");
20101
20101
  }
@@ -20139,7 +20139,7 @@ var require_immutable = __commonJS((exports, module) => {
20139
20139
  isAssociative,
20140
20140
  isOrdered,
20141
20141
  isValueObject,
20142
- isPlainObject: isPlainObject2,
20142
+ isPlainObject,
20143
20143
  isSeq,
20144
20144
  isList,
20145
20145
  isMap,
@@ -20195,7 +20195,7 @@ var require_immutable = __commonJS((exports, module) => {
20195
20195
  exports2.isOrdered = isOrdered;
20196
20196
  exports2.isOrderedMap = isOrderedMap;
20197
20197
  exports2.isOrderedSet = isOrderedSet;
20198
- exports2.isPlainObject = isPlainObject2;
20198
+ exports2.isPlainObject = isPlainObject;
20199
20199
  exports2.isRecord = isRecord;
20200
20200
  exports2.isSeq = isSeq;
20201
20201
  exports2.isSet = isSet;
@@ -20436,11 +20436,11 @@ var require_lib = __commonJS((exports, module) => {
20436
20436
  function isCompressed(value) {
20437
20437
  assert(toTypeString(value) === "Boolean", "Expected compressed to be a Boolean");
20438
20438
  }
20439
- function getAssertedOutput(output2 = (len) => new Uint8Array(len), length) {
20440
- if (typeof output2 === "function")
20441
- output2 = output2(length);
20442
- isUint8Array("output", output2, length);
20443
- return output2;
20439
+ function getAssertedOutput(output = (len) => new Uint8Array(len), length) {
20440
+ if (typeof output === "function")
20441
+ output = output(length);
20442
+ isUint8Array("output", output, length);
20443
+ return output;
20444
20444
  }
20445
20445
  function toTypeString(value) {
20446
20446
  return Object.prototype.toString.call(value).slice(8, -1);
@@ -20507,39 +20507,39 @@ var require_lib = __commonJS((exports, module) => {
20507
20507
  isUint8Array("public key", pubkey, [33, 65]);
20508
20508
  return secp256k1.publicKeyVerify(pubkey) === 0;
20509
20509
  },
20510
- publicKeyCreate(seckey, compressed = true, output2) {
20510
+ publicKeyCreate(seckey, compressed = true, output) {
20511
20511
  isUint8Array("private key", seckey, 32);
20512
20512
  isCompressed(compressed);
20513
- output2 = getAssertedOutput(output2, compressed ? 33 : 65);
20514
- switch (secp256k1.publicKeyCreate(output2, seckey)) {
20513
+ output = getAssertedOutput(output, compressed ? 33 : 65);
20514
+ switch (secp256k1.publicKeyCreate(output, seckey)) {
20515
20515
  case 0:
20516
- return output2;
20516
+ return output;
20517
20517
  case 1:
20518
20518
  throw new Error(errors.SECKEY_INVALID);
20519
20519
  case 2:
20520
20520
  throw new Error(errors.PUBKEY_SERIALIZE);
20521
20521
  }
20522
20522
  },
20523
- publicKeyConvert(pubkey, compressed = true, output2) {
20523
+ publicKeyConvert(pubkey, compressed = true, output) {
20524
20524
  isUint8Array("public key", pubkey, [33, 65]);
20525
20525
  isCompressed(compressed);
20526
- output2 = getAssertedOutput(output2, compressed ? 33 : 65);
20527
- switch (secp256k1.publicKeyConvert(output2, pubkey)) {
20526
+ output = getAssertedOutput(output, compressed ? 33 : 65);
20527
+ switch (secp256k1.publicKeyConvert(output, pubkey)) {
20528
20528
  case 0:
20529
- return output2;
20529
+ return output;
20530
20530
  case 1:
20531
20531
  throw new Error(errors.PUBKEY_PARSE);
20532
20532
  case 2:
20533
20533
  throw new Error(errors.PUBKEY_SERIALIZE);
20534
20534
  }
20535
20535
  },
20536
- publicKeyNegate(pubkey, compressed = true, output2) {
20536
+ publicKeyNegate(pubkey, compressed = true, output) {
20537
20537
  isUint8Array("public key", pubkey, [33, 65]);
20538
20538
  isCompressed(compressed);
20539
- output2 = getAssertedOutput(output2, compressed ? 33 : 65);
20540
- switch (secp256k1.publicKeyNegate(output2, pubkey)) {
20539
+ output = getAssertedOutput(output, compressed ? 33 : 65);
20540
+ switch (secp256k1.publicKeyNegate(output, pubkey)) {
20541
20541
  case 0:
20542
- return output2;
20542
+ return output;
20543
20543
  case 1:
20544
20544
  throw new Error(errors.PUBKEY_PARSE);
20545
20545
  case 2:
@@ -20548,17 +20548,17 @@ var require_lib = __commonJS((exports, module) => {
20548
20548
  throw new Error(errors.PUBKEY_SERIALIZE);
20549
20549
  }
20550
20550
  },
20551
- publicKeyCombine(pubkeys, compressed = true, output2) {
20551
+ publicKeyCombine(pubkeys, compressed = true, output) {
20552
20552
  assert(Array.isArray(pubkeys), "Expected public keys to be an Array");
20553
20553
  assert(pubkeys.length > 0, "Expected public keys array will have more than zero items");
20554
20554
  for (const pubkey of pubkeys) {
20555
20555
  isUint8Array("public key", pubkey, [33, 65]);
20556
20556
  }
20557
20557
  isCompressed(compressed);
20558
- output2 = getAssertedOutput(output2, compressed ? 33 : 65);
20559
- switch (secp256k1.publicKeyCombine(output2, pubkeys)) {
20558
+ output = getAssertedOutput(output, compressed ? 33 : 65);
20559
+ switch (secp256k1.publicKeyCombine(output, pubkeys)) {
20560
20560
  case 0:
20561
- return output2;
20561
+ return output;
20562
20562
  case 1:
20563
20563
  throw new Error(errors.PUBKEY_PARSE);
20564
20564
  case 2:
@@ -20567,28 +20567,28 @@ var require_lib = __commonJS((exports, module) => {
20567
20567
  throw new Error(errors.PUBKEY_SERIALIZE);
20568
20568
  }
20569
20569
  },
20570
- publicKeyTweakAdd(pubkey, tweak, compressed = true, output2) {
20570
+ publicKeyTweakAdd(pubkey, tweak, compressed = true, output) {
20571
20571
  isUint8Array("public key", pubkey, [33, 65]);
20572
20572
  isUint8Array("tweak", tweak, 32);
20573
20573
  isCompressed(compressed);
20574
- output2 = getAssertedOutput(output2, compressed ? 33 : 65);
20575
- switch (secp256k1.publicKeyTweakAdd(output2, pubkey, tweak)) {
20574
+ output = getAssertedOutput(output, compressed ? 33 : 65);
20575
+ switch (secp256k1.publicKeyTweakAdd(output, pubkey, tweak)) {
20576
20576
  case 0:
20577
- return output2;
20577
+ return output;
20578
20578
  case 1:
20579
20579
  throw new Error(errors.PUBKEY_PARSE);
20580
20580
  case 2:
20581
20581
  throw new Error(errors.TWEAK_ADD);
20582
20582
  }
20583
20583
  },
20584
- publicKeyTweakMul(pubkey, tweak, compressed = true, output2) {
20584
+ publicKeyTweakMul(pubkey, tweak, compressed = true, output) {
20585
20585
  isUint8Array("public key", pubkey, [33, 65]);
20586
20586
  isUint8Array("tweak", tweak, 32);
20587
20587
  isCompressed(compressed);
20588
- output2 = getAssertedOutput(output2, compressed ? 33 : 65);
20589
- switch (secp256k1.publicKeyTweakMul(output2, pubkey, tweak)) {
20588
+ output = getAssertedOutput(output, compressed ? 33 : 65);
20589
+ switch (secp256k1.publicKeyTweakMul(output, pubkey, tweak)) {
20590
20590
  case 0:
20591
- return output2;
20591
+ return output;
20592
20592
  case 1:
20593
20593
  throw new Error(errors.PUBKEY_PARSE);
20594
20594
  case 2:
@@ -20604,32 +20604,32 @@ var require_lib = __commonJS((exports, module) => {
20604
20604
  throw new Error(errors.SIG_PARSE);
20605
20605
  }
20606
20606
  },
20607
- signatureExport(sig, output2) {
20607
+ signatureExport(sig, output) {
20608
20608
  isUint8Array("signature", sig, 64);
20609
- output2 = getAssertedOutput(output2, 72);
20610
- const obj = { output: output2, outputlen: 72 };
20609
+ output = getAssertedOutput(output, 72);
20610
+ const obj = { output, outputlen: 72 };
20611
20611
  switch (secp256k1.signatureExport(obj, sig)) {
20612
20612
  case 0:
20613
- return output2.slice(0, obj.outputlen);
20613
+ return output.slice(0, obj.outputlen);
20614
20614
  case 1:
20615
20615
  throw new Error(errors.SIG_PARSE);
20616
20616
  case 2:
20617
20617
  throw new Error(errors.IMPOSSIBLE_CASE);
20618
20618
  }
20619
20619
  },
20620
- signatureImport(sig, output2) {
20620
+ signatureImport(sig, output) {
20621
20621
  isUint8Array("signature", sig);
20622
- output2 = getAssertedOutput(output2, 64);
20623
- switch (secp256k1.signatureImport(output2, sig)) {
20622
+ output = getAssertedOutput(output, 64);
20623
+ switch (secp256k1.signatureImport(output, sig)) {
20624
20624
  case 0:
20625
- return output2;
20625
+ return output;
20626
20626
  case 1:
20627
20627
  throw new Error(errors.SIG_PARSE);
20628
20628
  case 2:
20629
20629
  throw new Error(errors.IMPOSSIBLE_CASE);
20630
20630
  }
20631
20631
  },
20632
- ecdsaSign(msg32, seckey, options = {}, output2) {
20632
+ ecdsaSign(msg32, seckey, options = {}, output) {
20633
20633
  isUint8Array("message", msg32, 32);
20634
20634
  isUint8Array("private key", seckey, 32);
20635
20635
  assert(toTypeString(options) === "Object", "Expected options to be an Object");
@@ -20637,8 +20637,8 @@ var require_lib = __commonJS((exports, module) => {
20637
20637
  isUint8Array("options.data", options.data);
20638
20638
  if (options.noncefn !== undefined)
20639
20639
  assert(toTypeString(options.noncefn) === "Function", "Expected options.noncefn to be a Function");
20640
- output2 = getAssertedOutput(output2, 64);
20641
- const obj = { signature: output2, recid: null };
20640
+ output = getAssertedOutput(output, 64);
20641
+ const obj = { signature: output, recid: null };
20642
20642
  switch (secp256k1.ecdsaSign(obj, msg32, seckey, options.data, options.noncefn)) {
20643
20643
  case 0:
20644
20644
  return obj;
@@ -20663,15 +20663,15 @@ var require_lib = __commonJS((exports, module) => {
20663
20663
  throw new Error(errors.PUBKEY_PARSE);
20664
20664
  }
20665
20665
  },
20666
- ecdsaRecover(sig, recid, msg32, compressed = true, output2) {
20666
+ ecdsaRecover(sig, recid, msg32, compressed = true, output) {
20667
20667
  isUint8Array("signature", sig, 64);
20668
20668
  assert(toTypeString(recid) === "Number" && recid >= 0 && recid <= 3, "Expected recovery id to be a Number within interval [0, 3]");
20669
20669
  isUint8Array("message", msg32, 32);
20670
20670
  isCompressed(compressed);
20671
- output2 = getAssertedOutput(output2, compressed ? 33 : 65);
20672
- switch (secp256k1.ecdsaRecover(output2, sig, recid, msg32)) {
20671
+ output = getAssertedOutput(output, compressed ? 33 : 65);
20672
+ switch (secp256k1.ecdsaRecover(output, sig, recid, msg32)) {
20673
20673
  case 0:
20674
- return output2;
20674
+ return output;
20675
20675
  case 1:
20676
20676
  throw new Error(errors.SIG_PARSE);
20677
20677
  case 2:
@@ -20680,7 +20680,7 @@ var require_lib = __commonJS((exports, module) => {
20680
20680
  throw new Error(errors.IMPOSSIBLE_CASE);
20681
20681
  }
20682
20682
  },
20683
- ecdh(pubkey, seckey, options = {}, output2) {
20683
+ ecdh(pubkey, seckey, options = {}, output) {
20684
20684
  isUint8Array("public key", pubkey, [33, 65]);
20685
20685
  isUint8Array("private key", seckey, 32);
20686
20686
  assert(toTypeString(options) === "Object", "Expected options to be an Object");
@@ -20692,13 +20692,13 @@ var require_lib = __commonJS((exports, module) => {
20692
20692
  isUint8Array("options.xbuf", options.xbuf, 32);
20693
20693
  if (options.ybuf !== undefined)
20694
20694
  isUint8Array("options.ybuf", options.ybuf, 32);
20695
- isUint8Array("output", output2);
20695
+ isUint8Array("output", output);
20696
20696
  } else {
20697
- output2 = getAssertedOutput(output2, 32);
20697
+ output = getAssertedOutput(output, 32);
20698
20698
  }
20699
- switch (secp256k1.ecdh(output2, pubkey, seckey, options.data, options.hashfn, options.xbuf, options.ybuf)) {
20699
+ switch (secp256k1.ecdh(output, pubkey, seckey, options.data, options.hashfn, options.xbuf, options.ybuf)) {
20700
20700
  case 0:
20701
- return output2;
20701
+ return output;
20702
20702
  case 1:
20703
20703
  throw new Error(errors.PUBKEY_PARSE);
20704
20704
  case 2:
@@ -20763,10 +20763,10 @@ var require_elliptic2 = __commonJS((exports, module) => {
20763
20763
  return null;
20764
20764
  }
20765
20765
  }
20766
- function savePublicKey(output2, point) {
20767
- const pubkey = point.encode(null, output2.length === 33);
20768
- for (let i = 0;i < output2.length; ++i)
20769
- output2[i] = pubkey[i];
20766
+ function savePublicKey(output, point) {
20767
+ const pubkey = point.encode(null, output.length === 33);
20768
+ for (let i = 0;i < output.length; ++i)
20769
+ output[i] = pubkey[i];
20770
20770
  }
20771
20771
  var EC = require_elliptic().ec;
20772
20772
  var ec = new EC("secp256k1");
@@ -20814,32 +20814,32 @@ var require_elliptic2 = __commonJS((exports, module) => {
20814
20814
  const pair = loadPublicKey(pubkey);
20815
20815
  return pair === null ? 1 : 0;
20816
20816
  },
20817
- publicKeyCreate(output2, seckey) {
20817
+ publicKeyCreate(output, seckey) {
20818
20818
  const bn = new BN(seckey);
20819
20819
  if (bn.cmp(ecparams.n) >= 0 || bn.isZero())
20820
20820
  return 1;
20821
20821
  const point = ec.keyFromPrivate(seckey).getPublic();
20822
- savePublicKey(output2, point);
20822
+ savePublicKey(output, point);
20823
20823
  return 0;
20824
20824
  },
20825
- publicKeyConvert(output2, pubkey) {
20825
+ publicKeyConvert(output, pubkey) {
20826
20826
  const pair = loadPublicKey(pubkey);
20827
20827
  if (pair === null)
20828
20828
  return 1;
20829
20829
  const point = pair.getPublic();
20830
- savePublicKey(output2, point);
20830
+ savePublicKey(output, point);
20831
20831
  return 0;
20832
20832
  },
20833
- publicKeyNegate(output2, pubkey) {
20833
+ publicKeyNegate(output, pubkey) {
20834
20834
  const pair = loadPublicKey(pubkey);
20835
20835
  if (pair === null)
20836
20836
  return 1;
20837
20837
  const point = pair.getPublic();
20838
20838
  point.y = point.y.redNeg();
20839
- savePublicKey(output2, point);
20839
+ savePublicKey(output, point);
20840
20840
  return 0;
20841
20841
  },
20842
- publicKeyCombine(output2, pubkeys) {
20842
+ publicKeyCombine(output, pubkeys) {
20843
20843
  const pairs = new Array(pubkeys.length);
20844
20844
  for (let i = 0;i < pubkeys.length; ++i) {
20845
20845
  pairs[i] = loadPublicKey(pubkeys[i]);
@@ -20851,10 +20851,10 @@ var require_elliptic2 = __commonJS((exports, module) => {
20851
20851
  point = point.add(pairs[i].pub);
20852
20852
  if (point.isInfinity())
20853
20853
  return 2;
20854
- savePublicKey(output2, point);
20854
+ savePublicKey(output, point);
20855
20855
  return 0;
20856
20856
  },
20857
- publicKeyTweakAdd(output2, pubkey, tweak) {
20857
+ publicKeyTweakAdd(output, pubkey, tweak) {
20858
20858
  const pair = loadPublicKey(pubkey);
20859
20859
  if (pair === null)
20860
20860
  return 1;
@@ -20864,10 +20864,10 @@ var require_elliptic2 = __commonJS((exports, module) => {
20864
20864
  const point = pair.getPublic().add(ecparams.g.mul(tweak));
20865
20865
  if (point.isInfinity())
20866
20866
  return 2;
20867
- savePublicKey(output2, point);
20867
+ savePublicKey(output, point);
20868
20868
  return 0;
20869
20869
  },
20870
- publicKeyTweakMul(output2, pubkey, tweak) {
20870
+ publicKeyTweakMul(output, pubkey, tweak) {
20871
20871
  const pair = loadPublicKey(pubkey);
20872
20872
  if (pair === null)
20873
20873
  return 1;
@@ -20875,7 +20875,7 @@ var require_elliptic2 = __commonJS((exports, module) => {
20875
20875
  if (tweak.cmp(ecparams.n) >= 0 || tweak.isZero())
20876
20876
  return 2;
20877
20877
  const point = pair.getPublic().mul(tweak);
20878
- savePublicKey(output2, point);
20878
+ savePublicKey(output, point);
20879
20879
  return 0;
20880
20880
  },
20881
20881
  signatureNormalize(sig) {
@@ -20895,8 +20895,8 @@ var require_elliptic2 = __commonJS((exports, module) => {
20895
20895
  return 1;
20896
20896
  if (new BN(sigS).cmp(ecparams.n) >= 0)
20897
20897
  return 1;
20898
- const { output: output2 } = obj;
20899
- let r = output2.subarray(4, 4 + 33);
20898
+ const { output } = obj;
20899
+ let r = output.subarray(4, 4 + 33);
20900
20900
  r[0] = 0;
20901
20901
  r.set(sigR, 1);
20902
20902
  let lenR = 33;
@@ -20908,7 +20908,7 @@ var require_elliptic2 = __commonJS((exports, module) => {
20908
20908
  return 1;
20909
20909
  if (lenR > 1 && r[0] === 0 && !(r[1] & 128))
20910
20910
  return 1;
20911
- let s = output2.subarray(6 + 33, 6 + 33 + 33);
20911
+ let s = output.subarray(6 + 33, 6 + 33 + 33);
20912
20912
  s[0] = 0;
20913
20913
  s.set(sigS, 1);
20914
20914
  let lenS = 33;
@@ -20921,17 +20921,17 @@ var require_elliptic2 = __commonJS((exports, module) => {
20921
20921
  if (lenS > 1 && s[0] === 0 && !(s[1] & 128))
20922
20922
  return 1;
20923
20923
  obj.outputlen = 6 + lenR + lenS;
20924
- output2[0] = 48;
20925
- output2[1] = obj.outputlen - 2;
20926
- output2[2] = 2;
20927
- output2[3] = r.length;
20928
- output2.set(r, 4);
20929
- output2[4 + lenR] = 2;
20930
- output2[5 + lenR] = s.length;
20931
- output2.set(s, 6 + lenR);
20924
+ output[0] = 48;
20925
+ output[1] = obj.outputlen - 2;
20926
+ output[2] = 2;
20927
+ output[3] = r.length;
20928
+ output.set(r, 4);
20929
+ output[4 + lenR] = 2;
20930
+ output[5 + lenR] = s.length;
20931
+ output.set(s, 6 + lenR);
20932
20932
  return 0;
20933
20933
  },
20934
- signatureImport(output2, sig) {
20934
+ signatureImport(output, sig) {
20935
20935
  if (sig.length < 8)
20936
20936
  return 1;
20937
20937
  if (sig.length > 72)
@@ -20978,8 +20978,8 @@ var require_elliptic2 = __commonJS((exports, module) => {
20978
20978
  let s = new BN(sig.subarray(6 + lenR));
20979
20979
  if (s.cmp(ecparams.n) >= 0)
20980
20980
  s = new BN(0);
20981
- output2.set(r.toArrayLike(Uint8Array, "be", 32), 0);
20982
- output2.set(s.toArrayLike(Uint8Array, "be", 32), 32);
20981
+ output.set(r.toArrayLike(Uint8Array, "be", 32), 0);
20982
+ output.set(s.toArrayLike(Uint8Array, "be", 32), 32);
20983
20983
  return 0;
20984
20984
  },
20985
20985
  ecdsaSign(obj, message, seckey, data, noncefn) {
@@ -21022,7 +21022,7 @@ var require_elliptic2 = __commonJS((exports, module) => {
21022
21022
  const isValid = ec.verify(msg32, sigObj, point);
21023
21023
  return isValid ? 0 : 3;
21024
21024
  },
21025
- ecdsaRecover(output2, sig, recid, msg32) {
21025
+ ecdsaRecover(output, sig, recid, msg32) {
21026
21026
  const sigObj = { r: sig.slice(0, 32), s: sig.slice(32, 64) };
21027
21027
  const sigr = new BN(sigObj.r);
21028
21028
  const sigs = new BN(sigObj.s);
@@ -21036,10 +21036,10 @@ var require_elliptic2 = __commonJS((exports, module) => {
21036
21036
  } catch (err) {
21037
21037
  return 2;
21038
21038
  }
21039
- savePublicKey(output2, point);
21039
+ savePublicKey(output, point);
21040
21040
  return 0;
21041
21041
  },
21042
- ecdh(output2, pubkey, seckey, data, hashfn, xbuf, ybuf) {
21042
+ ecdh(output, pubkey, seckey, data, hashfn, xbuf, ybuf) {
21043
21043
  const pair = loadPublicKey(pubkey);
21044
21044
  if (pair === null)
21045
21045
  return 1;
@@ -21049,9 +21049,9 @@ var require_elliptic2 = __commonJS((exports, module) => {
21049
21049
  const point = pair.getPublic().mul(scalar);
21050
21050
  if (hashfn === undefined) {
21051
21051
  const data2 = point.encode(null, true);
21052
- const sha2562 = ec.hash().update(data2).digest();
21052
+ const sha256 = ec.hash().update(data2).digest();
21053
21053
  for (let i = 0;i < 32; ++i)
21054
- output2[i] = sha2562[i];
21054
+ output[i] = sha256[i];
21055
21055
  } else {
21056
21056
  if (!xbuf)
21057
21057
  xbuf = new Uint8Array(32);
@@ -21064,10 +21064,10 @@ var require_elliptic2 = __commonJS((exports, module) => {
21064
21064
  for (let i = 0;i < 32; ++i)
21065
21065
  ybuf[i] = y[i];
21066
21066
  const hash = hashfn(xbuf, ybuf, data);
21067
- const isValid = hash instanceof Uint8Array && hash.length === output2.length;
21067
+ const isValid = hash instanceof Uint8Array && hash.length === output.length;
21068
21068
  if (!isValid)
21069
21069
  return 2;
21070
- output2.set(hash);
21070
+ output.set(hash);
21071
21071
  }
21072
21072
  return 0;
21073
21073
  }
@@ -21197,19 +21197,19 @@ var require_instance = __commonJS((exports) => {
21197
21197
  let { deallocate } = this.exports;
21198
21198
  deallocate(region.ptr);
21199
21199
  }
21200
- allocate_bytes(bytes2) {
21201
- let region = this.allocate(bytes2.length);
21202
- region.write(bytes2);
21200
+ allocate_bytes(bytes) {
21201
+ let region = this.allocate(bytes.length);
21202
+ region.write(bytes);
21203
21203
  return region;
21204
21204
  }
21205
21205
  allocate_b64(b64) {
21206
- let bytes2 = Buffer.from(b64, "base64");
21207
- return this.allocate_bytes(bytes2);
21206
+ let bytes = Buffer.from(b64, "base64");
21207
+ return this.allocate_bytes(bytes);
21208
21208
  }
21209
21209
  allocate_str(str) {
21210
- const bytes2 = new TextEncoder().encode(str);
21211
- let region = this.allocate(bytes2.length);
21212
- region.write(bytes2);
21210
+ const bytes = new TextEncoder().encode(str);
21211
+ let region = this.allocate(bytes.length);
21212
+ region.write(bytes);
21213
21213
  return region;
21214
21214
  }
21215
21215
  allocate_json(obj) {
@@ -21883,13 +21883,13 @@ var require_bech323 = __commonJS((exports, module) => {
21883
21883
  }
21884
21884
  return result;
21885
21885
  }
21886
- function toWordsUnsafe(bytes2) {
21887
- var res = convert(bytes2, 8, 5, true);
21886
+ function toWordsUnsafe(bytes) {
21887
+ var res = convert(bytes, 8, 5, true);
21888
21888
  if (Array.isArray(res))
21889
21889
  return res;
21890
21890
  }
21891
- function toWords(bytes2) {
21892
- var res = convert(bytes2, 8, 5, true);
21891
+ function toWords(bytes) {
21892
+ var res = convert(bytes, 8, 5, true);
21893
21893
  if (Array.isArray(res))
21894
21894
  return res;
21895
21895
  throw new Error(res);
@@ -22589,23 +22589,23 @@ function utf8Decoder() {
22589
22589
  return;
22590
22590
  return _utf8Decoder !== null && _utf8Decoder !== undefined ? _utf8Decoder : _utf8Decoder = new globalThis.TextDecoder("utf-8");
22591
22591
  }
22592
- function textDecode(bytes2, encoding = "utf-8") {
22592
+ function textDecode(bytes, encoding = "utf-8") {
22593
22593
  switch (encoding.toLowerCase()) {
22594
22594
  case "utf-8":
22595
22595
  case "utf8": {
22596
22596
  const dec = utf8Decoder();
22597
- return dec ? dec.decode(bytes2) : decodeUTF8(bytes2);
22597
+ return dec ? dec.decode(bytes) : decodeUTF8(bytes);
22598
22598
  }
22599
22599
  case "utf-16le":
22600
- return decodeUTF16LE(bytes2);
22600
+ return decodeUTF16LE(bytes);
22601
22601
  case "us-ascii":
22602
22602
  case "ascii":
22603
- return decodeASCII(bytes2);
22603
+ return decodeASCII(bytes);
22604
22604
  case "latin1":
22605
22605
  case "iso-8859-1":
22606
- return decodeLatin1(bytes2);
22606
+ return decodeLatin1(bytes);
22607
22607
  case "windows-1252":
22608
- return decodeWindows1252(bytes2);
22608
+ return decodeWindows1252(bytes);
22609
22609
  default:
22610
22610
  throw new RangeError(`Encoding '${encoding}' not supported`);
22611
22611
  }
@@ -22630,15 +22630,15 @@ function pushCodePoint(parts, chunk, cp) {
22630
22630
  pushCodeUnit(parts, chunk, 55296 + (cp >> 10));
22631
22631
  pushCodeUnit(parts, chunk, 56320 + (cp & 1023));
22632
22632
  }
22633
- function decodeUTF8(bytes2) {
22633
+ function decodeUTF8(bytes) {
22634
22634
  const parts = [];
22635
22635
  const chunk = [];
22636
22636
  let i = 0;
22637
- if (bytes2.length >= 3 && bytes2[0] === 239 && bytes2[1] === 187 && bytes2[2] === 191) {
22637
+ if (bytes.length >= 3 && bytes[0] === 239 && bytes[1] === 187 && bytes[2] === 191) {
22638
22638
  i = 3;
22639
22639
  }
22640
- while (i < bytes2.length) {
22641
- const b1 = bytes2[i];
22640
+ while (i < bytes.length) {
22641
+ const b1 = bytes[i];
22642
22642
  if (b1 <= 127) {
22643
22643
  pushCodeUnit(parts, chunk, b1);
22644
22644
  i++;
@@ -22650,12 +22650,12 @@ function decodeUTF8(bytes2) {
22650
22650
  continue;
22651
22651
  }
22652
22652
  if (b1 <= 223) {
22653
- if (i + 1 >= bytes2.length) {
22653
+ if (i + 1 >= bytes.length) {
22654
22654
  pushCodeUnit(parts, chunk, REPLACEMENT);
22655
22655
  i++;
22656
22656
  continue;
22657
22657
  }
22658
- const b22 = bytes2[i + 1];
22658
+ const b22 = bytes[i + 1];
22659
22659
  if ((b22 & 192) !== 128) {
22660
22660
  pushCodeUnit(parts, chunk, REPLACEMENT);
22661
22661
  i++;
@@ -22667,13 +22667,13 @@ function decodeUTF8(bytes2) {
22667
22667
  continue;
22668
22668
  }
22669
22669
  if (b1 <= 239) {
22670
- if (i + 2 >= bytes2.length) {
22670
+ if (i + 2 >= bytes.length) {
22671
22671
  pushCodeUnit(parts, chunk, REPLACEMENT);
22672
22672
  i++;
22673
22673
  continue;
22674
22674
  }
22675
- const b22 = bytes2[i + 1];
22676
- const b32 = bytes2[i + 2];
22675
+ const b22 = bytes[i + 1];
22676
+ const b32 = bytes[i + 2];
22677
22677
  const valid2 = (b22 & 192) === 128 && (b32 & 192) === 128 && !(b1 === 224 && b22 < 160) && !(b1 === 237 && b22 >= 160);
22678
22678
  if (!valid2) {
22679
22679
  pushCodeUnit(parts, chunk, REPLACEMENT);
@@ -22685,14 +22685,14 @@ function decodeUTF8(bytes2) {
22685
22685
  i += 3;
22686
22686
  continue;
22687
22687
  }
22688
- if (i + 3 >= bytes2.length) {
22688
+ if (i + 3 >= bytes.length) {
22689
22689
  pushCodeUnit(parts, chunk, REPLACEMENT);
22690
22690
  i++;
22691
22691
  continue;
22692
22692
  }
22693
- const b2 = bytes2[i + 1];
22694
- const b3 = bytes2[i + 2];
22695
- const b4 = bytes2[i + 3];
22693
+ const b2 = bytes[i + 1];
22694
+ const b3 = bytes[i + 2];
22695
+ const b4 = bytes[i + 3];
22696
22696
  const valid = (b2 & 192) === 128 && (b3 & 192) === 128 && (b4 & 192) === 128 && !(b1 === 240 && b2 < 144) && !(b1 === 244 && b2 > 143);
22697
22697
  if (!valid) {
22698
22698
  pushCodeUnit(parts, chunk, REPLACEMENT);
@@ -22706,17 +22706,17 @@ function decodeUTF8(bytes2) {
22706
22706
  flushChunk(parts, chunk);
22707
22707
  return parts.join("");
22708
22708
  }
22709
- function decodeUTF16LE(bytes2) {
22709
+ function decodeUTF16LE(bytes) {
22710
22710
  const parts = [];
22711
22711
  const chunk = [];
22712
- const len = bytes2.length;
22712
+ const len = bytes.length;
22713
22713
  let i = 0;
22714
22714
  while (i + 1 < len) {
22715
- const u1 = bytes2[i] | bytes2[i + 1] << 8;
22715
+ const u1 = bytes[i] | bytes[i + 1] << 8;
22716
22716
  i += 2;
22717
22717
  if (u1 >= 55296 && u1 <= 56319) {
22718
22718
  if (i + 1 < len) {
22719
- const u2 = bytes2[i] | bytes2[i + 1] << 8;
22719
+ const u2 = bytes[i] | bytes[i + 1] << 8;
22720
22720
  if (u2 >= 56320 && u2 <= 57343) {
22721
22721
  pushCodeUnit(parts, chunk, u1);
22722
22722
  pushCodeUnit(parts, chunk, u2);
@@ -22741,35 +22741,35 @@ function decodeUTF16LE(bytes2) {
22741
22741
  flushChunk(parts, chunk);
22742
22742
  return parts.join("");
22743
22743
  }
22744
- function decodeASCII(bytes2) {
22744
+ function decodeASCII(bytes) {
22745
22745
  const parts = [];
22746
- for (let i = 0;i < bytes2.length; i += CHUNK) {
22747
- const end = Math.min(bytes2.length, i + CHUNK);
22746
+ for (let i = 0;i < bytes.length; i += CHUNK) {
22747
+ const end = Math.min(bytes.length, i + CHUNK);
22748
22748
  const codes = new Array(end - i);
22749
22749
  for (let j = i, k = 0;j < end; j++, k++) {
22750
- codes[k] = bytes2[j] & 127;
22750
+ codes[k] = bytes[j] & 127;
22751
22751
  }
22752
22752
  parts.push(String.fromCharCode.apply(null, codes));
22753
22753
  }
22754
22754
  return parts.join("");
22755
22755
  }
22756
- function decodeLatin1(bytes2) {
22756
+ function decodeLatin1(bytes) {
22757
22757
  const parts = [];
22758
- for (let i = 0;i < bytes2.length; i += CHUNK) {
22759
- const end = Math.min(bytes2.length, i + CHUNK);
22758
+ for (let i = 0;i < bytes.length; i += CHUNK) {
22759
+ const end = Math.min(bytes.length, i + CHUNK);
22760
22760
  const codes = new Array(end - i);
22761
22761
  for (let j = i, k = 0;j < end; j++, k++) {
22762
- codes[k] = bytes2[j];
22762
+ codes[k] = bytes[j];
22763
22763
  }
22764
22764
  parts.push(String.fromCharCode.apply(null, codes));
22765
22765
  }
22766
22766
  return parts.join("");
22767
22767
  }
22768
- function decodeWindows1252(bytes2) {
22768
+ function decodeWindows1252(bytes) {
22769
22769
  const parts = [];
22770
22770
  let out = "";
22771
- for (let i = 0;i < bytes2.length; i++) {
22772
- const b = bytes2[i];
22771
+ for (let i = 0;i < bytes.length; i++) {
22772
+ const b = bytes[i];
22773
22773
  const extra = b >= 128 && b <= 159 ? WINDOWS_1252_EXTRA[b] : undefined;
22774
22774
  out += extra !== null && extra !== undefined ? extra : String.fromCharCode(b);
22775
22775
  if (out.length >= CHUNK) {
@@ -22830,8 +22830,8 @@ class StringType2 {
22830
22830
  this.encoding = encoding;
22831
22831
  }
22832
22832
  get(data, offset = 0) {
22833
- const bytes2 = data.subarray(offset, offset + this.len);
22834
- return textDecode(bytes2, this.encoding);
22833
+ const bytes = data.subarray(offset, offset + this.len);
22834
+ return textDecode(bytes, this.encoding);
22835
22835
  }
22836
22836
  }
22837
22837
  var UINT8, UINT16_LE, UINT16_BE, UINT32_LE, UINT32_BE, INT32_BE, UINT64_LE;
@@ -24361,9 +24361,9 @@ class ZipHandler {
24361
24361
  }
24362
24362
  });
24363
24363
  const ds = new DecompressionStream("deflate-raw");
24364
- const output2 = input.pipeThrough(ds);
24364
+ const output = input.pipeThrough(ds);
24365
24365
  try {
24366
- const response = new Response(output2);
24366
+ const response = new Response(output);
24367
24367
  const buffer = await response.arrayBuffer();
24368
24368
  return new Uint8Array(buffer);
24369
24369
  } catch (err) {
@@ -24490,20 +24490,20 @@ var init_uint8array_extras = __esm(() => {
24490
24490
  // ../../node_modules/file-type/source/tokens.js
24491
24491
  function stringToBytes(string, encoding) {
24492
24492
  if (encoding === "utf-16le") {
24493
- const bytes2 = [];
24493
+ const bytes = [];
24494
24494
  for (let index = 0;index < string.length; index++) {
24495
24495
  const code = string.charCodeAt(index);
24496
- bytes2.push(code & 255, code >> 8 & 255);
24496
+ bytes.push(code & 255, code >> 8 & 255);
24497
24497
  }
24498
- return bytes2;
24498
+ return bytes;
24499
24499
  }
24500
24500
  if (encoding === "utf-16be") {
24501
- const bytes2 = [];
24501
+ const bytes = [];
24502
24502
  for (let index = 0;index < string.length; index++) {
24503
24503
  const code = string.charCodeAt(index);
24504
- bytes2.push(code >> 8 & 255, code & 255);
24504
+ bytes.push(code >> 8 & 255, code & 255);
24505
24505
  }
24506
- return bytes2;
24506
+ return bytes;
24507
24507
  }
24508
24508
  return [...string].map((character) => character.charCodeAt(0));
24509
24509
  }
@@ -24957,8 +24957,8 @@ async function decompressDeflateRawWithLimit(data, { maximumLength = maximumZipE
24957
24957
  controller.close();
24958
24958
  }
24959
24959
  });
24960
- const output2 = input.pipeThrough(new DecompressionStream("deflate-raw"));
24961
- const reader = output2.getReader();
24960
+ const output = input.pipeThrough(new DecompressionStream("deflate-raw"));
24961
+ const reader = output.getReader();
24962
24962
  const chunks = [];
24963
24963
  let totalLength = 0;
24964
24964
  try {
@@ -27511,316 +27511,7 @@ var {
27511
27511
  Help
27512
27512
  } = import__.default;
27513
27513
 
27514
- // ../../node_modules/@noble/hashes/esm/_assert.js
27515
- function bytes(b, ...lengths) {
27516
- if (!(b instanceof Uint8Array))
27517
- throw new Error("Expected Uint8Array");
27518
- if (lengths.length > 0 && !lengths.includes(b.length))
27519
- throw new Error(`Expected Uint8Array of length ${lengths}, not of length=${b.length}`);
27520
- }
27521
- function exists(instance, checkFinished = true) {
27522
- if (instance.destroyed)
27523
- throw new Error("Hash instance has been destroyed");
27524
- if (checkFinished && instance.finished)
27525
- throw new Error("Hash#digest() has already been called");
27526
- }
27527
- function output(out, instance) {
27528
- bytes(out);
27529
- const min = instance.outputLen;
27530
- if (out.length < min) {
27531
- throw new Error(`digestInto() expects output buffer of length at least ${min}`);
27532
- }
27533
- }
27534
-
27535
- // ../../node_modules/@noble/hashes/esm/utils.js
27536
- function utf8ToBytes(str) {
27537
- if (typeof str !== "string")
27538
- throw new Error(`utf8ToBytes expected string, got ${typeof str}`);
27539
- return new Uint8Array(new TextEncoder().encode(str));
27540
- }
27541
- function toBytes(data) {
27542
- if (typeof data === "string")
27543
- data = utf8ToBytes(data);
27544
- if (!u8a(data))
27545
- throw new Error(`expected Uint8Array, got ${typeof data}`);
27546
- return data;
27547
- }
27548
- function wrapConstructor(hashCons) {
27549
- const hashC = (msg) => hashCons().update(toBytes(msg)).digest();
27550
- const tmp = hashCons();
27551
- hashC.outputLen = tmp.outputLen;
27552
- hashC.blockLen = tmp.blockLen;
27553
- hashC.create = () => hashCons();
27554
- return hashC;
27555
- }
27556
- /*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
27557
- var u8a = (a) => a instanceof Uint8Array;
27558
- var createView = (arr) => new DataView(arr.buffer, arr.byteOffset, arr.byteLength);
27559
- var rotr = (word, shift) => word << 32 - shift | word >>> shift;
27560
- var isLE = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
27561
- if (!isLE)
27562
- throw new Error("Non little-endian hardware is not supported");
27563
- class Hash {
27564
- clone() {
27565
- return this._cloneInto();
27566
- }
27567
- }
27568
- var toStr = {}.toString;
27569
-
27570
- // ../../node_modules/@noble/hashes/esm/_sha2.js
27571
- function setBigUint64(view, byteOffset, value, isLE2) {
27572
- if (typeof view.setBigUint64 === "function")
27573
- return view.setBigUint64(byteOffset, value, isLE2);
27574
- const _32n = BigInt(32);
27575
- const _u32_max = BigInt(4294967295);
27576
- const wh = Number(value >> _32n & _u32_max);
27577
- const wl = Number(value & _u32_max);
27578
- const h = isLE2 ? 4 : 0;
27579
- const l = isLE2 ? 0 : 4;
27580
- view.setUint32(byteOffset + h, wh, isLE2);
27581
- view.setUint32(byteOffset + l, wl, isLE2);
27582
- }
27583
-
27584
- class SHA2 extends Hash {
27585
- constructor(blockLen, outputLen, padOffset, isLE2) {
27586
- super();
27587
- this.blockLen = blockLen;
27588
- this.outputLen = outputLen;
27589
- this.padOffset = padOffset;
27590
- this.isLE = isLE2;
27591
- this.finished = false;
27592
- this.length = 0;
27593
- this.pos = 0;
27594
- this.destroyed = false;
27595
- this.buffer = new Uint8Array(blockLen);
27596
- this.view = createView(this.buffer);
27597
- }
27598
- update(data) {
27599
- exists(this);
27600
- const { view, buffer, blockLen } = this;
27601
- data = toBytes(data);
27602
- const len = data.length;
27603
- for (let pos = 0;pos < len; ) {
27604
- const take = Math.min(blockLen - this.pos, len - pos);
27605
- if (take === blockLen) {
27606
- const dataView = createView(data);
27607
- for (;blockLen <= len - pos; pos += blockLen)
27608
- this.process(dataView, pos);
27609
- continue;
27610
- }
27611
- buffer.set(data.subarray(pos, pos + take), this.pos);
27612
- this.pos += take;
27613
- pos += take;
27614
- if (this.pos === blockLen) {
27615
- this.process(view, 0);
27616
- this.pos = 0;
27617
- }
27618
- }
27619
- this.length += data.length;
27620
- this.roundClean();
27621
- return this;
27622
- }
27623
- digestInto(out) {
27624
- exists(this);
27625
- output(out, this);
27626
- this.finished = true;
27627
- const { buffer, view, blockLen, isLE: isLE2 } = this;
27628
- let { pos } = this;
27629
- buffer[pos++] = 128;
27630
- this.buffer.subarray(pos).fill(0);
27631
- if (this.padOffset > blockLen - pos) {
27632
- this.process(view, 0);
27633
- pos = 0;
27634
- }
27635
- for (let i = pos;i < blockLen; i++)
27636
- buffer[i] = 0;
27637
- setBigUint64(view, blockLen - 8, BigInt(this.length * 8), isLE2);
27638
- this.process(view, 0);
27639
- const oview = createView(out);
27640
- const len = this.outputLen;
27641
- if (len % 4)
27642
- throw new Error("_sha2: outputLen should be aligned to 32bit");
27643
- const outLen = len / 4;
27644
- const state = this.get();
27645
- if (outLen > state.length)
27646
- throw new Error("_sha2: outputLen bigger than state");
27647
- for (let i = 0;i < outLen; i++)
27648
- oview.setUint32(4 * i, state[i], isLE2);
27649
- }
27650
- digest() {
27651
- const { buffer, outputLen } = this;
27652
- this.digestInto(buffer);
27653
- const res = buffer.slice(0, outputLen);
27654
- this.destroy();
27655
- return res;
27656
- }
27657
- _cloneInto(to) {
27658
- to || (to = new this.constructor);
27659
- to.set(...this.get());
27660
- const { blockLen, buffer, length, finished, destroyed, pos } = this;
27661
- to.length = length;
27662
- to.pos = pos;
27663
- to.finished = finished;
27664
- to.destroyed = destroyed;
27665
- if (length % blockLen)
27666
- to.buffer.set(buffer);
27667
- return to;
27668
- }
27669
- }
27670
-
27671
- // ../../node_modules/@noble/hashes/esm/sha256.js
27672
- var Chi = (a, b, c) => a & b ^ ~a & c;
27673
- var Maj = (a, b, c) => a & b ^ a & c ^ b & c;
27674
- var SHA256_K = /* @__PURE__ */ new Uint32Array([
27675
- 1116352408,
27676
- 1899447441,
27677
- 3049323471,
27678
- 3921009573,
27679
- 961987163,
27680
- 1508970993,
27681
- 2453635748,
27682
- 2870763221,
27683
- 3624381080,
27684
- 310598401,
27685
- 607225278,
27686
- 1426881987,
27687
- 1925078388,
27688
- 2162078206,
27689
- 2614888103,
27690
- 3248222580,
27691
- 3835390401,
27692
- 4022224774,
27693
- 264347078,
27694
- 604807628,
27695
- 770255983,
27696
- 1249150122,
27697
- 1555081692,
27698
- 1996064986,
27699
- 2554220882,
27700
- 2821834349,
27701
- 2952996808,
27702
- 3210313671,
27703
- 3336571891,
27704
- 3584528711,
27705
- 113926993,
27706
- 338241895,
27707
- 666307205,
27708
- 773529912,
27709
- 1294757372,
27710
- 1396182291,
27711
- 1695183700,
27712
- 1986661051,
27713
- 2177026350,
27714
- 2456956037,
27715
- 2730485921,
27716
- 2820302411,
27717
- 3259730800,
27718
- 3345764771,
27719
- 3516065817,
27720
- 3600352804,
27721
- 4094571909,
27722
- 275423344,
27723
- 430227734,
27724
- 506948616,
27725
- 659060556,
27726
- 883997877,
27727
- 958139571,
27728
- 1322822218,
27729
- 1537002063,
27730
- 1747873779,
27731
- 1955562222,
27732
- 2024104815,
27733
- 2227730452,
27734
- 2361852424,
27735
- 2428436474,
27736
- 2756734187,
27737
- 3204031479,
27738
- 3329325298
27739
- ]);
27740
- var IV = /* @__PURE__ */ new Uint32Array([
27741
- 1779033703,
27742
- 3144134277,
27743
- 1013904242,
27744
- 2773480762,
27745
- 1359893119,
27746
- 2600822924,
27747
- 528734635,
27748
- 1541459225
27749
- ]);
27750
- var SHA256_W = /* @__PURE__ */ new Uint32Array(64);
27751
-
27752
- class SHA256 extends SHA2 {
27753
- constructor() {
27754
- super(64, 32, 8, false);
27755
- this.A = IV[0] | 0;
27756
- this.B = IV[1] | 0;
27757
- this.C = IV[2] | 0;
27758
- this.D = IV[3] | 0;
27759
- this.E = IV[4] | 0;
27760
- this.F = IV[5] | 0;
27761
- this.G = IV[6] | 0;
27762
- this.H = IV[7] | 0;
27763
- }
27764
- get() {
27765
- const { A, B, C, D, E, F, G, H } = this;
27766
- return [A, B, C, D, E, F, G, H];
27767
- }
27768
- set(A, B, C, D, E, F, G, H) {
27769
- this.A = A | 0;
27770
- this.B = B | 0;
27771
- this.C = C | 0;
27772
- this.D = D | 0;
27773
- this.E = E | 0;
27774
- this.F = F | 0;
27775
- this.G = G | 0;
27776
- this.H = H | 0;
27777
- }
27778
- process(view, offset) {
27779
- for (let i = 0;i < 16; i++, offset += 4)
27780
- SHA256_W[i] = view.getUint32(offset, false);
27781
- for (let i = 16;i < 64; i++) {
27782
- const W15 = SHA256_W[i - 15];
27783
- const W2 = SHA256_W[i - 2];
27784
- const s0 = rotr(W15, 7) ^ rotr(W15, 18) ^ W15 >>> 3;
27785
- const s1 = rotr(W2, 17) ^ rotr(W2, 19) ^ W2 >>> 10;
27786
- SHA256_W[i] = s1 + SHA256_W[i - 7] + s0 + SHA256_W[i - 16] | 0;
27787
- }
27788
- let { A, B, C, D, E, F, G, H } = this;
27789
- for (let i = 0;i < 64; i++) {
27790
- const sigma1 = rotr(E, 6) ^ rotr(E, 11) ^ rotr(E, 25);
27791
- const T1 = H + sigma1 + Chi(E, F, G) + SHA256_K[i] + SHA256_W[i] | 0;
27792
- const sigma0 = rotr(A, 2) ^ rotr(A, 13) ^ rotr(A, 22);
27793
- const T2 = sigma0 + Maj(A, B, C) | 0;
27794
- H = G;
27795
- G = F;
27796
- F = E;
27797
- E = D + T1 | 0;
27798
- D = C;
27799
- C = B;
27800
- B = A;
27801
- A = T1 + T2 | 0;
27802
- }
27803
- A = A + this.A | 0;
27804
- B = B + this.B | 0;
27805
- C = C + this.C | 0;
27806
- D = D + this.D | 0;
27807
- E = E + this.E | 0;
27808
- F = F + this.F | 0;
27809
- G = G + this.G | 0;
27810
- H = H + this.H | 0;
27811
- this.set(A, B, C, D, E, F, G, H);
27812
- }
27813
- roundClean() {
27814
- SHA256_W.fill(0);
27815
- }
27816
- destroy() {
27817
- this.set(0, 0, 0, 0, 0, 0, 0, 0);
27818
- this.buffer.fill(0);
27819
- }
27820
- }
27821
- var sha256 = /* @__PURE__ */ wrapConstructor(() => new SHA256);
27822
-
27823
- // ../done-client/src/envelope.ts
27514
+ // ../done-client/src/envelope-builder.ts
27824
27515
  function normalizeMetadata(metadata) {
27825
27516
  if (!metadata)
27826
27517
  return;
@@ -27833,21 +27524,6 @@ function normalizeMetadata(metadata) {
27833
27524
  normalized.gas_limit = metadata.gas_limit;
27834
27525
  return Object.keys(normalized).length > 0 ? normalized : undefined;
27835
27526
  }
27836
- function toSignDoc(envelope) {
27837
- const metadata = normalizeMetadata(envelope.metadata);
27838
- return {
27839
- version: envelope.version ?? CURRENT_ENVELOPE_VERSION,
27840
- user_id: envelope.user_id,
27841
- session_id: envelope.session_id,
27842
- msgs: envelope.msgs.map((msg) => cloneMsg(msg)),
27843
- nonce: envelope.nonce,
27844
- expires_at: envelope.expires_at,
27845
- role: envelope.role,
27846
- agent: envelope.agent,
27847
- forwarder: envelope.forwarder,
27848
- metadata
27849
- };
27850
- }
27851
27527
  function buildEnvelope(draft) {
27852
27528
  if (!Array.isArray(draft.msgs) || draft.msgs.length === 0) {
27853
27529
  throw new Error("envelope requires at least one message");
@@ -27868,32 +27544,9 @@ function buildEnvelope(draft) {
27868
27544
  metadata
27869
27545
  };
27870
27546
  }
27871
- function signDocBytes(signDoc) {
27872
- const json = canonicalStringify(signDoc);
27873
- return new TextEncoder().encode(json);
27874
- }
27875
- function signDocDigest(signDoc) {
27876
- const bytes2 = signDocBytes(signDoc);
27877
- return sha256(bytes2);
27878
- }
27879
27547
  function cloneMsg(msg) {
27880
27548
  return structuredClone(msg);
27881
27549
  }
27882
- function canonicalStringify(value) {
27883
- return JSON.stringify(value, (_key, val) => {
27884
- if (val instanceof Map) {
27885
- return Object.fromEntries(Array.from(val.entries()).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0));
27886
- }
27887
- if (val && typeof val === "object" && !Array.isArray(val)) {
27888
- const entries = Object.entries(val).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0);
27889
- return entries.reduce((acc, [key, entry]) => {
27890
- acc[key] = entry;
27891
- return acc;
27892
- }, {});
27893
- }
27894
- return val;
27895
- });
27896
- }
27897
27550
  var CURRENT_ENVELOPE_VERSION = 1;
27898
27551
 
27899
27552
  // ../done-client/src/messages.ts
@@ -28084,490 +27737,6 @@ class DoneContractHandle {
28084
27737
  }, init);
28085
27738
  }
28086
27739
  }
28087
- // ../done-client/src/done.ts
28088
- function mergeMetadata(...entries) {
28089
- const merged = {};
28090
- for (const entry of entries) {
28091
- if (!entry)
28092
- continue;
28093
- if (entry.trace_id)
28094
- merged.trace_id = entry.trace_id;
28095
- if (entry.memo)
28096
- merged.memo = entry.memo;
28097
- if (typeof entry.gas_limit === "number")
28098
- merged.gas_limit = entry.gas_limit;
28099
- }
28100
- return Object.keys(merged).length > 0 ? merged : undefined;
28101
- }
28102
- function mergeExecuteOptions(base, overrides) {
28103
- if (!base && !overrides.memo && !overrides.passkey && !overrides.signal) {
28104
- return;
28105
- }
28106
- return {
28107
- memo: overrides.memo ?? base?.memo,
28108
- passkey: overrides.passkey ?? base?.passkey,
28109
- signal: overrides.signal ?? base?.signal
28110
- };
28111
- }
28112
- function defaultEventSourceFactory(url) {
28113
- if (typeof EventSource === "undefined") {
28114
- throw new Error("EventSource is not available in this environment");
28115
- }
28116
- return new EventSource(url);
28117
- }
28118
- function buildEventsUrl(baseUrl, eventsPath) {
28119
- const normalized = eventsPath.startsWith("/") ? eventsPath : `/${eventsPath}`;
28120
- return `${baseUrl.replace(/\/$/, "")}${normalized}`;
28121
- }
28122
- function resolveFetch(fn) {
28123
- if (fn) {
28124
- return typeof fn === "function" ? fn : (() => {
28125
- throw new Error("provided fetch implementation is not a function");
28126
- })();
28127
- }
28128
- if (typeof fetch === "function") {
28129
- return fetch.bind(globalThis);
28130
- }
28131
- throw new Error("global fetch is not available; configure Done with a fetch implementation via Done.config");
28132
- }
28133
- function resolveEventSource(factory) {
28134
- if (factory)
28135
- return factory;
28136
- if (typeof EventSource === "function") {
28137
- return (url) => new EventSource(url);
28138
- }
28139
- return;
28140
- }
28141
- function normalizeConfig(input = {}, base) {
28142
- const previous = base ?? {
28143
- doneHttp: "https://doneHttp.done.zone",
28144
- doneEvents: "https://doneEvents.done.zone",
28145
- fetch: resolveFetch(),
28146
- eventSource: resolveEventSource(),
28147
- envelopeBuilder: undefined
28148
- };
28149
- return {
28150
- doneHttp: input.doneHttp ?? previous.doneHttp,
28151
- doneEvents: input.doneEvents ?? previous.doneEvents,
28152
- fetch: resolveFetch(input.fetch ?? previous.fetch),
28153
- eventSource: resolveEventSource(input.eventSource ?? previous.eventSource),
28154
- envelopeBuilder: input.envelopeBuilder ?? input.signer ?? previous.envelopeBuilder
28155
- };
28156
- }
28157
- function resolveRoute(raw, base, extraSearch) {
28158
- const url = new URL(raw, base);
28159
- if (extraSearch) {
28160
- for (const [key, value] of Object.entries(extraSearch)) {
28161
- url.searchParams.set(key, String(value));
28162
- }
28163
- }
28164
- const pathSegments = url.pathname.replace(/^\/+/, "").split("/");
28165
- const contract = pathSegments.shift();
28166
- if (!contract) {
28167
- throw new Error("route must include contract address as first path segment");
28168
- }
28169
- const path = pathSegments.length > 0 ? `/${pathSegments.join("/")}` : "/";
28170
- const queryRecord = searchParamsToRecord(url.searchParams);
28171
- return {
28172
- url,
28173
- contract,
28174
- path,
28175
- query: Object.keys(queryRecord).length > 0 ? queryRecord : undefined
28176
- };
28177
- }
28178
- function searchParamsToRecord(params) {
28179
- const record = {};
28180
- for (const [key, value] of params) {
28181
- const existing = record[key];
28182
- if (existing === undefined) {
28183
- record[key] = value;
28184
- } else if (Array.isArray(existing)) {
28185
- existing.push(value);
28186
- } else {
28187
- record[key] = [existing, value];
28188
- }
28189
- }
28190
- return record;
28191
- }
28192
- function normalizeContractBody(body) {
28193
- if (body === undefined || body === null) {
28194
- return body;
28195
- }
28196
- if (isPlainObject(body) || Array.isArray(body)) {
28197
- return body;
28198
- }
28199
- if (typeof body === "string") {
28200
- try {
28201
- return JSON.parse(body);
28202
- } catch (err) {
28203
- throw new Error("string bodies must contain JSON payloads when invoking Done.run/query");
28204
- }
28205
- }
28206
- if (body instanceof URLSearchParams) {
28207
- return Object.fromEntries(Array.from(body));
28208
- }
28209
- throw new Error("unsupported body type for Done.run/query; provide a JSON-serialisable value");
28210
- }
28211
- function isPlainObject(value) {
28212
- if (value === null || typeof value !== "object")
28213
- return false;
28214
- const proto = Object.getPrototypeOf(value);
28215
- return proto === Object.prototype || proto === null;
28216
- }
28217
- function normalizeContractSegment(value) {
28218
- if (!value) {
28219
- throw new Error("contract identifier cannot be empty");
28220
- }
28221
- return value.replace(/^\/+/u, "").replace(/\/+$/u, "");
28222
- }
28223
-
28224
- class DoneContractClient {
28225
- backend;
28226
- address;
28227
- buildEnvelopeFn;
28228
- eventSourceFactory;
28229
- eventsPath;
28230
- defaultMetadata;
28231
- constructor(config) {
28232
- this.backend = new DoneBackendClient({ baseUrl: config.baseUrl, fetch: config.fetch });
28233
- this.address = config.address;
28234
- this.buildEnvelopeFn = config.buildEnvelope;
28235
- this.eventSourceFactory = config.eventSource;
28236
- this.eventsPath = config.eventsPath ?? "/events";
28237
- this.defaultMetadata = config.defaultMetadata;
28238
- }
28239
- get(path, request = {}, init = {}) {
28240
- const promise = this.fetchQuery(path, request, init);
28241
- return new DoneRequest(promise);
28242
- }
28243
- async query(path, request = {}, init = {}) {
28244
- const response = await this.fetchQuery(path, request, init);
28245
- return response.json();
28246
- }
28247
- async post(path, request = {}, init = {}) {
28248
- return this.execute(path, request, init);
28249
- }
28250
- async run(path, request = {}, init = {}) {
28251
- return this.execute(path, request, init);
28252
- }
28253
- async execute(path, request = {}, init = {}) {
28254
- if (!this.buildEnvelopeFn) {
28255
- throw new Error("execute requires a buildEnvelope function in contract config");
28256
- }
28257
- const normalizedCall = {
28258
- path,
28259
- query: request.query,
28260
- body: request.body
28261
- };
28262
- const transactionMsg = buildTransactionMessage(this.address, normalizedCall, request);
28263
- const metadata = mergeMetadata(this.defaultMetadata, request.metadata, { trace_id: request.traceId, memo: request.memo, gas_limit: request.gasLimit });
28264
- const buildContext = {
28265
- msg: transactionMsg,
28266
- metadata,
28267
- path,
28268
- request
28269
- };
28270
- const buildResult = await this.buildEnvelopeFn(buildContext);
28271
- if (metadata) {
28272
- buildResult.envelope.metadata = buildResult.envelope.metadata ?? metadata;
28273
- }
28274
- const executeOptions = mergeExecuteOptions(buildResult.options, {
28275
- memo: request.memo,
28276
- passkey: request.passkey,
28277
- signal: request.signal
28278
- });
28279
- return this.backend.executeEnvelope(buildResult.envelope, executeOptions, init);
28280
- }
28281
- transaction(path, request = {}) {
28282
- const normalizedCall = {
28283
- path,
28284
- query: request.query,
28285
- body: request.body
28286
- };
28287
- const msg = buildTransactionMessage(this.address, normalizedCall, request);
28288
- const metadata = mergeMetadata(this.defaultMetadata, request.metadata, {
28289
- trace_id: request.traceId,
28290
- memo: request.memo,
28291
- gas_limit: request.gasLimit
28292
- });
28293
- return { msg, metadata };
28294
- }
28295
- subscribe(topic, handler, options = {}) {
28296
- const factory = this.eventSourceFactory ?? defaultEventSourceFactory;
28297
- const eventsBase = buildEventsUrl(this.backend.baseUrl, this.eventsPath);
28298
- const encodedTopic = Array.isArray(topic) ? JSON.stringify(topic) : topic;
28299
- const url = `${eventsBase}?topic=${encodeURIComponent(encodedTopic)}`;
28300
- const source = factory(url);
28301
- const messageListener = (event) => {
28302
- if (options.rawEvent) {
28303
- handler(event);
28304
- return;
28305
- }
28306
- const data = event.data;
28307
- try {
28308
- handler(JSON.parse(data));
28309
- } catch {
28310
- handler(data);
28311
- }
28312
- };
28313
- if (typeof source.addEventListener === "function") {
28314
- source.addEventListener("message", messageListener);
28315
- } else {
28316
- source.onmessage = messageListener;
28317
- }
28318
- if (options.onError) {
28319
- if (typeof source.addEventListener === "function") {
28320
- source.addEventListener("error", options.onError);
28321
- } else {
28322
- source.onerror = options.onError;
28323
- }
28324
- }
28325
- const cleanup = () => {
28326
- if (typeof source.removeEventListener === "function") {
28327
- source.removeEventListener("message", messageListener);
28328
- if (options.onError) {
28329
- source.removeEventListener("error", options.onError);
28330
- }
28331
- }
28332
- source.close();
28333
- };
28334
- if (options.signal) {
28335
- if (options.signal.aborted) {
28336
- cleanup();
28337
- } else {
28338
- options.signal.addEventListener("abort", cleanup, { once: true });
28339
- }
28340
- }
28341
- return cleanup;
28342
- }
28343
- publishCode(request, init = {}) {
28344
- return this.backend.publishCode({
28345
- contract: this.address,
28346
- script: request.script,
28347
- msg: request.msg
28348
- }, init);
28349
- }
28350
- buildEnvelope(draft) {
28351
- return buildEnvelope(draft);
28352
- }
28353
- signDocDigest(envelope) {
28354
- return signDocDigest(toSignDoc(envelope));
28355
- }
28356
- get baseUrl() {
28357
- return this.backend.baseUrl;
28358
- }
28359
- async fetchQuery(path, request, init = {}) {
28360
- const call = { path, query: request.query, body: request.body };
28361
- return this.backend.queryContractRaw(this.address, call, init);
28362
- }
28363
- }
28364
-
28365
- class DoneRequest {
28366
- promise;
28367
- constructor(promise) {
28368
- this.promise = promise;
28369
- }
28370
- then(onfulfilled, onrejected) {
28371
- return this.promise.then(onfulfilled, onrejected);
28372
- }
28373
- catch(onrejected) {
28374
- return this.promise.catch(onrejected);
28375
- }
28376
- finally(onfinally) {
28377
- return this.promise.finally(onfinally);
28378
- }
28379
- json() {
28380
- return this.promise.then((response) => response.json());
28381
- }
28382
- text() {
28383
- return this.promise.then((response) => response.text());
28384
- }
28385
- arrayBuffer() {
28386
- return this.promise.then((response) => response.arrayBuffer());
28387
- }
28388
- }
28389
-
28390
- class DoneInstance {
28391
- settings;
28392
- backend;
28393
- CURRENT_ENVELOPE_VERSION = CURRENT_ENVELOPE_VERSION;
28394
- buildEnvelope = buildEnvelope;
28395
- signDocDigest = signDocDigest;
28396
- toSignDoc = toSignDoc;
28397
- constructor(input) {
28398
- this.settings = normalizeConfig(input);
28399
- this.backend = new DoneBackendClient({ baseUrl: this.settings.doneHttp, fetch: this.settings.fetch });
28400
- }
28401
- async run(url, init = {}) {
28402
- const {
28403
- body: rawBody,
28404
- funds,
28405
- memo,
28406
- traceId,
28407
- gasLimit,
28408
- passkey,
28409
- metadata,
28410
- search,
28411
- ...rest
28412
- } = init;
28413
- const fetchInit = { ...rest };
28414
- const resolved = resolveRoute(url, this.settings.doneHttp, search);
28415
- const contractBody = normalizeContractBody(rawBody);
28416
- const call = {
28417
- path: resolved.path,
28418
- query: resolved.query,
28419
- body: contractBody
28420
- };
28421
- const msg = buildTransactionMessage(resolved.contract, call, { funds });
28422
- const mergedMetadata = mergeMetadata(metadata, {
28423
- trace_id: traceId,
28424
- memo,
28425
- gas_limit: gasLimit
28426
- });
28427
- const builder = this.requireEnvelopeBuilder();
28428
- const request = {
28429
- body: contractBody,
28430
- query: resolved.query,
28431
- funds,
28432
- memo,
28433
- traceId,
28434
- gasLimit,
28435
- metadata: mergedMetadata,
28436
- passkey,
28437
- signal: fetchInit.signal
28438
- };
28439
- const result = await Promise.resolve(builder({
28440
- msg,
28441
- metadata: mergedMetadata,
28442
- path: resolved.path,
28443
- request
28444
- }));
28445
- if (mergedMetadata) {
28446
- result.envelope.metadata = result.envelope.metadata ?? mergedMetadata;
28447
- }
28448
- const executeOptions = mergeExecuteOptions(result.options, {
28449
- memo,
28450
- passkey,
28451
- signal: fetchInit.signal
28452
- });
28453
- return this.backend.executeEnvelope(result.envelope, executeOptions ?? {}, fetchInit);
28454
- }
28455
- async query(url, init = {}) {
28456
- const { body: rawBody, search, ...rest } = init;
28457
- const fetchInit = { ...rest };
28458
- const resolved = resolveRoute(url, this.settings.doneHttp, search);
28459
- const contractBody = normalizeContractBody(rawBody);
28460
- const call = {
28461
- path: resolved.path,
28462
- query: resolved.query,
28463
- body: contractBody
28464
- };
28465
- return this.backend.queryContract(resolved.contract, call, fetchInit);
28466
- }
28467
- subscribe(eventsUrl, topic, handler, options = {}) {
28468
- const factory = this.settings.eventSource ?? defaultEventSourceFactory;
28469
- if (!factory) {
28470
- throw new Error("EventSource is not available; configure Done with an eventSource factory");
28471
- }
28472
- const url = new URL(eventsUrl, this.settings.doneEvents);
28473
- const topicValue = Array.isArray(topic) ? JSON.stringify(topic) : topic;
28474
- url.searchParams.set("topic", topicValue);
28475
- const source = factory(url.toString());
28476
- const messageListener = (event) => {
28477
- if (options.rawEvent) {
28478
- handler(event);
28479
- return;
28480
- }
28481
- try {
28482
- handler(JSON.parse(event.data));
28483
- } catch {
28484
- handler(event.data);
28485
- }
28486
- };
28487
- if (typeof source.addEventListener === "function") {
28488
- source.addEventListener("message", messageListener);
28489
- } else {
28490
- source.onmessage = messageListener;
28491
- }
28492
- if (options.onError) {
28493
- if (typeof source.addEventListener === "function") {
28494
- source.addEventListener("error", options.onError);
28495
- } else {
28496
- source.onerror = options.onError;
28497
- }
28498
- }
28499
- const cleanup = () => {
28500
- if (typeof source.removeEventListener === "function") {
28501
- source.removeEventListener("message", messageListener);
28502
- if (options.onError) {
28503
- source.removeEventListener("error", options.onError);
28504
- }
28505
- }
28506
- source.close();
28507
- };
28508
- if (options.signal) {
28509
- if (options.signal.aborted) {
28510
- cleanup();
28511
- } else {
28512
- options.signal.addEventListener("abort", cleanup, { once: true });
28513
- }
28514
- }
28515
- return cleanup;
28516
- }
28517
- config(update) {
28518
- this.settings = normalizeConfig(update, this.settings);
28519
- this.backend = new DoneBackendClient({ baseUrl: this.settings.doneHttp, fetch: this.settings.fetch });
28520
- }
28521
- create(update = {}) {
28522
- const merged = normalizeConfig(update, this.settings);
28523
- return new DoneInstance({
28524
- doneHttp: merged.doneHttp,
28525
- doneEvents: merged.doneEvents,
28526
- fetch: merged.fetch,
28527
- eventSource: merged.eventSource,
28528
- envelopeBuilder: merged.envelopeBuilder
28529
- });
28530
- }
28531
- contract(config, maybeConfig) {
28532
- if (typeof config === "string") {
28533
- if (!maybeConfig) {
28534
- return this.buildContractHandle(config);
28535
- }
28536
- return new DoneContractClient({
28537
- baseUrl: config,
28538
- ...maybeConfig,
28539
- buildEnvelope: maybeConfig.buildEnvelope ?? this.settings.envelopeBuilder,
28540
- fetch: maybeConfig.fetch ?? this.settings.fetch,
28541
- eventSource: maybeConfig.eventSource ?? this.settings.eventSource
28542
- });
28543
- }
28544
- return new DoneContractClient({
28545
- ...config,
28546
- baseUrl: config.baseUrl,
28547
- buildEnvelope: config.buildEnvelope ?? this.settings.envelopeBuilder,
28548
- fetch: config.fetch ?? this.settings.fetch,
28549
- eventSource: config.eventSource ?? this.settings.eventSource
28550
- });
28551
- }
28552
- requireEnvelopeBuilder() {
28553
- if (!this.settings.envelopeBuilder) {
28554
- throw new Error("Done.run requires an envelope builder; configure Done.config({ signer: ... }) first");
28555
- }
28556
- return this.settings.envelopeBuilder;
28557
- }
28558
- buildContractHandle(contract) {
28559
- const address = normalizeContractSegment(contract);
28560
- const client = new DoneContractClient({
28561
- baseUrl: this.settings.doneHttp,
28562
- address,
28563
- buildEnvelope: this.settings.envelopeBuilder,
28564
- fetch: this.settings.fetch,
28565
- eventSource: this.settings.eventSource
28566
- });
28567
- return client;
28568
- }
28569
- }
28570
- var Done = new DoneInstance;
28571
27740
  // ../done-local-chain/src/chain.ts
28572
27741
  var import_cosmwasm_vm_js = __toESM(require_dist2(), 1);
28573
27742
  var import_encoding = __toESM(require_build2(), 1);
@@ -28575,8 +27744,8 @@ var import_backend = __toESM(require_backend(), 1);
28575
27744
  var import_bech32 = __toESM(require_dist(), 1);
28576
27745
 
28577
27746
  // ../done-local-chain/src/proto.ts
28578
- function decodeAny(bytes2) {
28579
- const reader = new BinaryReader(bytes2);
27747
+ function decodeAny(bytes) {
27748
+ const reader = new BinaryReader(bytes);
28580
27749
  const any = { typeUrl: "", value: new Uint8Array };
28581
27750
  while (!reader.eof()) {
28582
27751
  const tag = reader.uint32();
@@ -28594,8 +27763,8 @@ function decodeAny(bytes2) {
28594
27763
  }
28595
27764
  return any;
28596
27765
  }
28597
- function decodeMsgExecuteContract(bytes2) {
28598
- const reader = new BinaryReader(bytes2);
27766
+ function decodeMsgExecuteContract(bytes) {
27767
+ const reader = new BinaryReader(bytes);
28599
27768
  const message = {
28600
27769
  sender: "",
28601
27770
  contract: "",
@@ -28632,8 +27801,8 @@ function encodeMsgExecuteContractResponse(data) {
28632
27801
  }
28633
27802
  return writer.finish();
28634
27803
  }
28635
- function decodeCoin(bytes2) {
28636
- const reader = new BinaryReader(bytes2);
27804
+ function decodeCoin(bytes) {
27805
+ const reader = new BinaryReader(bytes);
28637
27806
  const coin = { denom: "", amount: "" };
28638
27807
  while (!reader.eof()) {
28639
27808
  const tag = reader.uint32();
@@ -28651,11 +27820,11 @@ function decodeCoin(bytes2) {
28651
27820
  }
28652
27821
  return coin;
28653
27822
  }
28654
- function decodeJsonMsg(bytes2) {
28655
- if (!bytes2 || bytes2.length === 0) {
27823
+ function decodeJsonMsg(bytes) {
27824
+ if (!bytes || bytes.length === 0) {
28656
27825
  return {};
28657
27826
  }
28658
- const jsonStr = textDecoder.decode(bytes2);
27827
+ const jsonStr = textDecoder.decode(bytes);
28659
27828
  return jsonStr ? JSON.parse(jsonStr) : {};
28660
27829
  }
28661
27830
  function toCoins(funds) {
@@ -28669,8 +27838,8 @@ var WASMVM_STARGATE_EXECUTE_PATH = "/wasmvm/execute";
28669
27838
  class BinaryReader {
28670
27839
  buf;
28671
27840
  offset = 0;
28672
- constructor(bytes2) {
28673
- this.buf = bytes2;
27841
+ constructor(bytes) {
27842
+ this.buf = bytes;
28674
27843
  }
28675
27844
  uint32() {
28676
27845
  let value = 0;
@@ -28753,10 +27922,10 @@ class BinaryWriter {
28753
27922
  }
28754
27923
 
28755
27924
  // ../done-local-chain/src/querier.ts
28756
- function encodeSuccess(bytes2) {
27925
+ function encodeSuccess(bytes) {
28757
27926
  const payload = {
28758
27927
  ok: {
28759
- ok: Buffer.from(bytes2).toString("base64")
27928
+ ok: Buffer.from(bytes).toString("base64")
28760
27929
  }
28761
27930
  };
28762
27931
  return textEncoder2.encode(JSON.stringify(payload));
@@ -28862,8 +28031,8 @@ function readArtifactFromDisk(name) {
28862
28031
  if (!existsSync(artifactPath)) {
28863
28032
  throw new Error(`Artifact '${filename}' not found in ${ARTIFACTS_DIR}`);
28864
28033
  }
28865
- const bytes2 = readFileSync(artifactPath);
28866
- return new Uint8Array(bytes2);
28034
+ const bytes = readFileSync(artifactPath);
28035
+ return new Uint8Array(bytes);
28867
28036
  }
28868
28037
  function loadArtifact(name) {
28869
28038
  if (!cache.has(name)) {
@@ -28881,8 +28050,8 @@ var ARTIFACTS_DIR = resolveArtifactsDir();
28881
28050
  var cache = new Map;
28882
28051
 
28883
28052
  // ../done-local-chain/src/batteries.ts
28884
- function sha2562(bytes2) {
28885
- return createHash("sha256").update(bytes2).digest("hex");
28053
+ function sha256(bytes) {
28054
+ return createHash("sha256").update(bytes).digest("hex");
28886
28055
  }
28887
28056
  function installDoneLocalBatteries(chain) {
28888
28057
  const selected = DEFAULT_ARTIFACTS;
@@ -28893,7 +28062,7 @@ function installDoneLocalBatteries(chain) {
28893
28062
  installs.set(name, {
28894
28063
  name,
28895
28064
  codeId,
28896
- checksum: sha2562(wasm)
28065
+ checksum: sha256(wasm)
28897
28066
  });
28898
28067
  }
28899
28068
  const get = (name) => {
@@ -28959,9 +28128,9 @@ class DoneLocalChain {
28959
28128
  };
28960
28129
  }
28961
28130
  storeCode(wasm) {
28962
- const bytes2 = wasm instanceof Uint8Array ? new Uint8Array(wasm) : new Uint8Array(wasm);
28131
+ const bytes = wasm instanceof Uint8Array ? new Uint8Array(wasm) : new Uint8Array(wasm);
28963
28132
  const id = this.nextCodeId++;
28964
- this.codes.set(id, bytes2);
28133
+ this.codes.set(id, bytes);
28965
28134
  return id;
28966
28135
  }
28967
28136
  async instantiate(codeId, options) {
@@ -32442,7 +31611,7 @@ function FNV1A64(byte) {
32442
31611
  Accumulator = Accumulator ^ Bytes[byte];
32443
31612
  Accumulator = Accumulator * Prime % Size;
32444
31613
  }
32445
- function Hash2(value) {
31614
+ function Hash(value) {
32446
31615
  Accumulator = BigInt("14695981039346656037");
32447
31616
  Visit4(value);
32448
31617
  return Accumulator;
@@ -32504,7 +31673,7 @@ function FromArray7(schema, references, value) {
32504
31673
  if (schema.uniqueItems === true && !function() {
32505
31674
  const set = new Set;
32506
31675
  for (const element of value) {
32507
- const hashed = Hash2(element);
31676
+ const hashed = Hash(element);
32508
31677
  if (set.has(hashed)) {
32509
31678
  return false;
32510
31679
  } else {
@@ -32945,7 +32114,7 @@ function* FromArray8(schema, references, path, value) {
32945
32114
  if (schema.uniqueItems === true && !function() {
32946
32115
  const set = new Set;
32947
32116
  for (const element of value) {
32948
- const hashed = Hash2(element);
32117
+ const hashed = Hash(element);
32949
32118
  if (set.has(hashed)) {
32950
32119
  return false;
32951
32120
  } else {
@@ -33966,8 +33135,8 @@ function ScoreUnion(schema, references, value) {
33966
33135
  return entries.reduce((acc, [key, schema2]) => {
33967
33136
  const literal = schema2[Kind] === "Literal" && schema2.const === value[key] ? 100 : 0;
33968
33137
  const checks = Check(schema2, references, value[key]) ? 10 : 0;
33969
- const exists2 = keys.includes(key) ? 1 : 0;
33970
- return acc + (literal + checks + exists2);
33138
+ const exists = keys.includes(key) ? 1 : 0;
33139
+ return acc + (literal + checks + exists);
33971
33140
  }, 0);
33972
33141
  } else if (schema[Kind] === "Union") {
33973
33142
  const schemas = schema.anyOf.map((schema2) => Deref(schema2, references));
@@ -35496,7 +34665,7 @@ __export(exports_value2, {
35496
34665
  Patch: () => Patch,
35497
34666
  Parse: () => Parse,
35498
34667
  Mutate: () => Mutate,
35499
- Hash: () => Hash2,
34668
+ Hash: () => Hash,
35500
34669
  Errors: () => Errors,
35501
34670
  Equal: () => Equal,
35502
34671
  Encode: () => Encode,
@@ -36076,7 +35245,7 @@ var TypeCompiler;
36076
35245
  return checkFunc(value);
36077
35246
  }
36078
35247
  function hashFunction(value) {
36079
- return Hash2(value);
35248
+ return Hash(value);
36080
35249
  }
36081
35250
  const checkFunction = compiledFunction(typeRegistryFunction, formatRegistryFunction, hashFunction);
36082
35251
  return new TypeCheck(schema, references, checkFunction, generatedCode);
@@ -44042,13 +43211,13 @@ var derivePath = (rawType) => {
44042
43211
  }
44043
43212
  return segments;
44044
43213
  };
44045
- var normalizeLocalEvent = (event, context) => {
43214
+ var normalizeLocalEvent = (event, context, contractFallback) => {
44046
43215
  if (!event)
44047
43216
  return;
44048
43217
  const rawAttributes = event.attributes ?? [];
44049
43218
  const normalizedAttributes = {};
44050
43219
  const passthroughAttributes = [];
44051
- let contract;
43220
+ let contract = contractFallback;
44052
43221
  for (const attribute of rawAttributes) {
44053
43222
  if (!attribute)
44054
43223
  continue;
@@ -44114,7 +43283,7 @@ function createDoneEventsLocalServer(options) {
44114
43283
  const normalized = normalizeLocalEvent(entry, {
44115
43284
  height: event.height,
44116
43285
  blockTime: event.blockTime
44117
- });
43286
+ }, event.contract);
44118
43287
  if (!normalized)
44119
43288
  continue;
44120
43289
  pubsub.publish(normalized.publishPath, normalized.payload);
@@ -44396,12 +43565,13 @@ async function scaffoldWorkspace(rawName, options) {
44396
43565
  await runCommand("bun", ["install"], { cwd: targetDir });
44397
43566
  }
44398
43567
  console.log(`Done workspace created at ${path.relative(cwd, targetDir) || "."}.`);
44399
- console.log("Next steps:");
44400
- console.log(` cd ${path.relative(cwd, targetDir) || slug}`);
44401
43568
  if (options.install === false) {
44402
- console.log(" bun install");
43569
+ console.log("Skipping dev server (--no-install was set). Run `bun install && bunx done dev` to get started.");
43570
+ return;
44403
43571
  }
44404
- console.log(" bunx done dev");
43572
+ console.log("Starting dev server\u2026");
43573
+ process.chdir(targetDir);
43574
+ await handleDev({});
44405
43575
  }
44406
43576
  async function scaffoldContract(workspace, rawName, options) {
44407
43577
  const slug = toSlug(rawName);
@@ -44720,11 +43890,11 @@ async function runBunBuild(entryPath, outFilePath) {
44720
43890
  const logs = (result.logs ?? []).map((log) => log?.message ?? String(log));
44721
43891
  throw new Error(logs.join("\n") || "Bun.build failed");
44722
43892
  }
44723
- const [output2] = result.outputs;
44724
- if (!output2) {
43893
+ const [output] = result.outputs;
43894
+ if (!output) {
44725
43895
  throw new Error("Bun.build did not emit an output file");
44726
43896
  }
44727
- const bundledSource = await output2.text();
43897
+ const bundledSource = await output.text();
44728
43898
  await fs.writeFile(outFilePath, bundledSource);
44729
43899
  return;
44730
43900
  }
@@ -44812,11 +43982,11 @@ function decodeUtf8FromBase64(base64) {
44812
43982
  if (!base64)
44813
43983
  return;
44814
43984
  try {
44815
- const bytes2 = Buffer.from(base64, "base64");
44816
- if (bytes2.length === 0) {
43985
+ const bytes = Buffer.from(base64, "base64");
43986
+ if (bytes.length === 0) {
44817
43987
  return "";
44818
43988
  }
44819
- return utf8Decoder2.decode(bytes2);
43989
+ return utf8Decoder2.decode(bytes);
44820
43990
  } catch {
44821
43991
  return;
44822
43992
  }