@orderly.network/core 2.8.10 → 2.8.11-alpha.0

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.mjs CHANGED
@@ -31,10 +31,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
31
31
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
32
32
  mod
33
33
  ));
34
- var __publicField = (obj, key, value) => {
35
- __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
36
- return value;
37
- };
34
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
38
35
 
39
36
  // ../../node_modules/.pnpm/base64-js@1.5.1/node_modules/base64-js/index.js
40
37
  var require_base64_js = __commonJS({
@@ -62,8 +59,7 @@ var require_base64_js = __commonJS({
62
59
  throw new Error("Invalid string. Length must be a multiple of 4");
63
60
  }
64
61
  var validLen = b64.indexOf("=");
65
- if (validLen === -1)
66
- validLen = len2;
62
+ if (validLen === -1) validLen = len2;
67
63
  var placeHoldersLen = validLen === len2 ? 0 : 4 - validLen % 4;
68
64
  return [validLen, placeHoldersLen];
69
65
  }
@@ -259,16 +255,14 @@ var require_buffer = __commonJS({
259
255
  Object.defineProperty(Buffer4.prototype, "parent", {
260
256
  enumerable: true,
261
257
  get: function() {
262
- if (!Buffer4.isBuffer(this))
263
- return void 0;
258
+ if (!Buffer4.isBuffer(this)) return void 0;
264
259
  return this.buffer;
265
260
  }
266
261
  });
267
262
  Object.defineProperty(Buffer4.prototype, "offset", {
268
263
  enumerable: true,
269
264
  get: function() {
270
- if (!Buffer4.isBuffer(this))
271
- return void 0;
265
+ if (!Buffer4.isBuffer(this)) return void 0;
272
266
  return this.byteOffset;
273
267
  }
274
268
  });
@@ -320,8 +314,7 @@ var require_buffer = __commonJS({
320
314
  return Buffer4.from(valueOf, encodingOrOffset, length);
321
315
  }
322
316
  var b = fromObject(value);
323
- if (b)
324
- return b;
317
+ if (b) return b;
325
318
  if (typeof Symbol !== "undefined" && Symbol.toPrimitive != null && typeof value[Symbol.toPrimitive] === "function") {
326
319
  return Buffer4.from(
327
320
  value[Symbol.toPrimitive]("string"),
@@ -452,17 +445,14 @@ var require_buffer = __commonJS({
452
445
  return b != null && b._isBuffer === true && b !== Buffer4.prototype;
453
446
  };
454
447
  Buffer4.compare = function compare(a, b) {
455
- if (isInstance(a, Uint8Array))
456
- a = Buffer4.from(a, a.offset, a.byteLength);
457
- if (isInstance(b, Uint8Array))
458
- b = Buffer4.from(b, b.offset, b.byteLength);
448
+ if (isInstance(a, Uint8Array)) a = Buffer4.from(a, a.offset, a.byteLength);
449
+ if (isInstance(b, Uint8Array)) b = Buffer4.from(b, b.offset, b.byteLength);
459
450
  if (!Buffer4.isBuffer(a) || !Buffer4.isBuffer(b)) {
460
451
  throw new TypeError(
461
452
  'The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array'
462
453
  );
463
454
  }
464
- if (a === b)
465
- return 0;
455
+ if (a === b) return 0;
466
456
  var x = a.length;
467
457
  var y = b.length;
468
458
  for (var i = 0, len = Math.min(x, y); i < len; ++i) {
@@ -472,10 +462,8 @@ var require_buffer = __commonJS({
472
462
  break;
473
463
  }
474
464
  }
475
- if (x < y)
476
- return -1;
477
- if (y < x)
478
- return 1;
465
+ if (x < y) return -1;
466
+ if (y < x) return 1;
479
467
  return 0;
480
468
  };
481
469
  Buffer4.isEncoding = function isEncoding(encoding) {
@@ -547,8 +535,7 @@ var require_buffer = __commonJS({
547
535
  }
548
536
  var len = string.length;
549
537
  var mustMatch = arguments.length > 2 && arguments[2] === true;
550
- if (!mustMatch && len === 0)
551
- return 0;
538
+ if (!mustMatch && len === 0) return 0;
552
539
  var loweredCase = false;
553
540
  for (; ; ) {
554
541
  switch (encoding) {
@@ -597,8 +584,7 @@ var require_buffer = __commonJS({
597
584
  if (end <= start) {
598
585
  return "";
599
586
  }
600
- if (!encoding)
601
- encoding = "utf8";
587
+ if (!encoding) encoding = "utf8";
602
588
  while (true) {
603
589
  switch (encoding) {
604
590
  case "hex":
@@ -619,8 +605,7 @@ var require_buffer = __commonJS({
619
605
  case "utf-16le":
620
606
  return utf16leSlice(this, start, end);
621
607
  default:
622
- if (loweredCase)
623
- throw new TypeError("Unknown encoding: " + encoding);
608
+ if (loweredCase) throw new TypeError("Unknown encoding: " + encoding);
624
609
  encoding = (encoding + "").toLowerCase();
625
610
  loweredCase = true;
626
611
  }
@@ -668,26 +653,21 @@ var require_buffer = __commonJS({
668
653
  };
669
654
  Buffer4.prototype.toString = function toString() {
670
655
  var length = this.length;
671
- if (length === 0)
672
- return "";
673
- if (arguments.length === 0)
674
- return utf8Slice(this, 0, length);
656
+ if (length === 0) return "";
657
+ if (arguments.length === 0) return utf8Slice(this, 0, length);
675
658
  return slowToString.apply(this, arguments);
676
659
  };
677
660
  Buffer4.prototype.toLocaleString = Buffer4.prototype.toString;
678
661
  Buffer4.prototype.equals = function equals(b) {
679
- if (!Buffer4.isBuffer(b))
680
- throw new TypeError("Argument must be a Buffer");
681
- if (this === b)
682
- return true;
662
+ if (!Buffer4.isBuffer(b)) throw new TypeError("Argument must be a Buffer");
663
+ if (this === b) return true;
683
664
  return Buffer4.compare(this, b) === 0;
684
665
  };
685
666
  Buffer4.prototype.inspect = function inspect() {
686
667
  var str = "";
687
668
  var max = exports.INSPECT_MAX_BYTES;
688
669
  str = this.toString("hex", 0, max).replace(/(.{2})/g, "$1 ").trim();
689
- if (this.length > max)
690
- str += " ... ";
670
+ if (this.length > max) str += " ... ";
691
671
  return "<Buffer " + str + ">";
692
672
  };
693
673
  if (customInspectSymbol) {
@@ -730,8 +710,7 @@ var require_buffer = __commonJS({
730
710
  end >>>= 0;
731
711
  thisStart >>>= 0;
732
712
  thisEnd >>>= 0;
733
- if (this === target)
734
- return 0;
713
+ if (this === target) return 0;
735
714
  var x = thisEnd - thisStart;
736
715
  var y = end - start;
737
716
  var len = Math.min(x, y);
@@ -744,15 +723,12 @@ var require_buffer = __commonJS({
744
723
  break;
745
724
  }
746
725
  }
747
- if (x < y)
748
- return -1;
749
- if (y < x)
750
- return 1;
726
+ if (x < y) return -1;
727
+ if (y < x) return 1;
751
728
  return 0;
752
729
  };
753
730
  function bidirectionalIndexOf(buffer, val, byteOffset, encoding, dir) {
754
- if (buffer.length === 0)
755
- return -1;
731
+ if (buffer.length === 0) return -1;
756
732
  if (typeof byteOffset === "string") {
757
733
  encoding = byteOffset;
758
734
  byteOffset = 0;
@@ -765,18 +741,13 @@ var require_buffer = __commonJS({
765
741
  if (numberIsNaN(byteOffset)) {
766
742
  byteOffset = dir ? 0 : buffer.length - 1;
767
743
  }
768
- if (byteOffset < 0)
769
- byteOffset = buffer.length + byteOffset;
744
+ if (byteOffset < 0) byteOffset = buffer.length + byteOffset;
770
745
  if (byteOffset >= buffer.length) {
771
- if (dir)
772
- return -1;
773
- else
774
- byteOffset = buffer.length - 1;
746
+ if (dir) return -1;
747
+ else byteOffset = buffer.length - 1;
775
748
  } else if (byteOffset < 0) {
776
- if (dir)
777
- byteOffset = 0;
778
- else
779
- return -1;
749
+ if (dir) byteOffset = 0;
750
+ else return -1;
780
751
  }
781
752
  if (typeof val === "string") {
782
753
  val = Buffer4.from(val, encoding);
@@ -827,19 +798,15 @@ var require_buffer = __commonJS({
827
798
  var foundIndex = -1;
828
799
  for (i = byteOffset; i < arrLength; i++) {
829
800
  if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
830
- if (foundIndex === -1)
831
- foundIndex = i;
832
- if (i - foundIndex + 1 === valLength)
833
- return foundIndex * indexSize;
801
+ if (foundIndex === -1) foundIndex = i;
802
+ if (i - foundIndex + 1 === valLength) return foundIndex * indexSize;
834
803
  } else {
835
- if (foundIndex !== -1)
836
- i -= i - foundIndex;
804
+ if (foundIndex !== -1) i -= i - foundIndex;
837
805
  foundIndex = -1;
838
806
  }
839
807
  }
840
808
  } else {
841
- if (byteOffset + valLength > arrLength)
842
- byteOffset = arrLength - valLength;
809
+ if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength;
843
810
  for (i = byteOffset; i >= 0; i--) {
844
811
  var found = true;
845
812
  for (var j = 0; j < valLength; j++) {
@@ -848,8 +815,7 @@ var require_buffer = __commonJS({
848
815
  break;
849
816
  }
850
817
  }
851
- if (found)
852
- return i;
818
+ if (found) return i;
853
819
  }
854
820
  }
855
821
  return -1;
@@ -880,8 +846,7 @@ var require_buffer = __commonJS({
880
846
  }
881
847
  for (var i = 0; i < length; ++i) {
882
848
  var parsed = parseInt(string.substr(i * 2, 2), 16);
883
- if (numberIsNaN(parsed))
884
- return i;
849
+ if (numberIsNaN(parsed)) return i;
885
850
  buf[offset + i] = parsed;
886
851
  }
887
852
  return i;
@@ -911,8 +876,7 @@ var require_buffer = __commonJS({
911
876
  offset = offset >>> 0;
912
877
  if (isFinite(length)) {
913
878
  length = length >>> 0;
914
- if (encoding === void 0)
915
- encoding = "utf8";
879
+ if (encoding === void 0) encoding = "utf8";
916
880
  } else {
917
881
  encoding = length;
918
882
  length = void 0;
@@ -923,13 +887,11 @@ var require_buffer = __commonJS({
923
887
  );
924
888
  }
925
889
  var remaining = this.length - offset;
926
- if (length === void 0 || length > remaining)
927
- length = remaining;
890
+ if (length === void 0 || length > remaining) length = remaining;
928
891
  if (string.length > 0 && (length < 0 || offset < 0) || offset > this.length) {
929
892
  throw new RangeError("Attempt to write outside buffer bounds");
930
893
  }
931
- if (!encoding)
932
- encoding = "utf8";
894
+ if (!encoding) encoding = "utf8";
933
895
  var loweredCase = false;
934
896
  for (; ; ) {
935
897
  switch (encoding) {
@@ -950,8 +912,7 @@ var require_buffer = __commonJS({
950
912
  case "utf-16le":
951
913
  return ucs2Write(this, string, offset, length);
952
914
  default:
953
- if (loweredCase)
954
- throw new TypeError("Unknown encoding: " + encoding);
915
+ if (loweredCase) throw new TypeError("Unknown encoding: " + encoding);
955
916
  encoding = ("" + encoding).toLowerCase();
956
917
  loweredCase = true;
957
918
  }
@@ -1064,10 +1025,8 @@ var require_buffer = __commonJS({
1064
1025
  }
1065
1026
  function hexSlice(buf, start, end) {
1066
1027
  var len = buf.length;
1067
- if (!start || start < 0)
1068
- start = 0;
1069
- if (!end || end < 0 || end > len)
1070
- end = len;
1028
+ if (!start || start < 0) start = 0;
1029
+ if (!end || end < 0 || end > len) end = len;
1071
1030
  var out = "";
1072
1031
  for (var i = start; i < end; ++i) {
1073
1032
  out += hexSliceLookupTable[buf[i]];
@@ -1088,35 +1047,29 @@ var require_buffer = __commonJS({
1088
1047
  end = end === void 0 ? len : ~~end;
1089
1048
  if (start < 0) {
1090
1049
  start += len;
1091
- if (start < 0)
1092
- start = 0;
1050
+ if (start < 0) start = 0;
1093
1051
  } else if (start > len) {
1094
1052
  start = len;
1095
1053
  }
1096
1054
  if (end < 0) {
1097
1055
  end += len;
1098
- if (end < 0)
1099
- end = 0;
1056
+ if (end < 0) end = 0;
1100
1057
  } else if (end > len) {
1101
1058
  end = len;
1102
1059
  }
1103
- if (end < start)
1104
- end = start;
1060
+ if (end < start) end = start;
1105
1061
  var newBuf = this.subarray(start, end);
1106
1062
  Object.setPrototypeOf(newBuf, Buffer4.prototype);
1107
1063
  return newBuf;
1108
1064
  };
1109
1065
  function checkOffset(offset, ext, length) {
1110
- if (offset % 1 !== 0 || offset < 0)
1111
- throw new RangeError("offset is not uint");
1112
- if (offset + ext > length)
1113
- throw new RangeError("Trying to access beyond buffer length");
1066
+ if (offset % 1 !== 0 || offset < 0) throw new RangeError("offset is not uint");
1067
+ if (offset + ext > length) throw new RangeError("Trying to access beyond buffer length");
1114
1068
  }
1115
1069
  Buffer4.prototype.readUintLE = Buffer4.prototype.readUIntLE = function readUIntLE(offset, byteLength2, noAssert) {
1116
1070
  offset = offset >>> 0;
1117
1071
  byteLength2 = byteLength2 >>> 0;
1118
- if (!noAssert)
1119
- checkOffset(offset, byteLength2, this.length);
1072
+ if (!noAssert) checkOffset(offset, byteLength2, this.length);
1120
1073
  var val = this[offset];
1121
1074
  var mul = 1;
1122
1075
  var i = 0;
@@ -1140,39 +1093,33 @@ var require_buffer = __commonJS({
1140
1093
  };
1141
1094
  Buffer4.prototype.readUint8 = Buffer4.prototype.readUInt8 = function readUInt8(offset, noAssert) {
1142
1095
  offset = offset >>> 0;
1143
- if (!noAssert)
1144
- checkOffset(offset, 1, this.length);
1096
+ if (!noAssert) checkOffset(offset, 1, this.length);
1145
1097
  return this[offset];
1146
1098
  };
1147
1099
  Buffer4.prototype.readUint16LE = Buffer4.prototype.readUInt16LE = function readUInt16LE(offset, noAssert) {
1148
1100
  offset = offset >>> 0;
1149
- if (!noAssert)
1150
- checkOffset(offset, 2, this.length);
1101
+ if (!noAssert) checkOffset(offset, 2, this.length);
1151
1102
  return this[offset] | this[offset + 1] << 8;
1152
1103
  };
1153
1104
  Buffer4.prototype.readUint16BE = Buffer4.prototype.readUInt16BE = function readUInt16BE(offset, noAssert) {
1154
1105
  offset = offset >>> 0;
1155
- if (!noAssert)
1156
- checkOffset(offset, 2, this.length);
1106
+ if (!noAssert) checkOffset(offset, 2, this.length);
1157
1107
  return this[offset] << 8 | this[offset + 1];
1158
1108
  };
1159
1109
  Buffer4.prototype.readUint32LE = Buffer4.prototype.readUInt32LE = function readUInt32LE(offset, noAssert) {
1160
1110
  offset = offset >>> 0;
1161
- if (!noAssert)
1162
- checkOffset(offset, 4, this.length);
1111
+ if (!noAssert) checkOffset(offset, 4, this.length);
1163
1112
  return (this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16) + this[offset + 3] * 16777216;
1164
1113
  };
1165
1114
  Buffer4.prototype.readUint32BE = Buffer4.prototype.readUInt32BE = function readUInt32BE(offset, noAssert) {
1166
1115
  offset = offset >>> 0;
1167
- if (!noAssert)
1168
- checkOffset(offset, 4, this.length);
1116
+ if (!noAssert) checkOffset(offset, 4, this.length);
1169
1117
  return this[offset] * 16777216 + (this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3]);
1170
1118
  };
1171
1119
  Buffer4.prototype.readIntLE = function readIntLE(offset, byteLength2, noAssert) {
1172
1120
  offset = offset >>> 0;
1173
1121
  byteLength2 = byteLength2 >>> 0;
1174
- if (!noAssert)
1175
- checkOffset(offset, byteLength2, this.length);
1122
+ if (!noAssert) checkOffset(offset, byteLength2, this.length);
1176
1123
  var val = this[offset];
1177
1124
  var mul = 1;
1178
1125
  var i = 0;
@@ -1180,15 +1127,13 @@ var require_buffer = __commonJS({
1180
1127
  val += this[offset + i] * mul;
1181
1128
  }
1182
1129
  mul *= 128;
1183
- if (val >= mul)
1184
- val -= Math.pow(2, 8 * byteLength2);
1130
+ if (val >= mul) val -= Math.pow(2, 8 * byteLength2);
1185
1131
  return val;
1186
1132
  };
1187
1133
  Buffer4.prototype.readIntBE = function readIntBE(offset, byteLength2, noAssert) {
1188
1134
  offset = offset >>> 0;
1189
1135
  byteLength2 = byteLength2 >>> 0;
1190
- if (!noAssert)
1191
- checkOffset(offset, byteLength2, this.length);
1136
+ if (!noAssert) checkOffset(offset, byteLength2, this.length);
1192
1137
  var i = byteLength2;
1193
1138
  var mul = 1;
1194
1139
  var val = this[offset + --i];
@@ -1196,75 +1141,61 @@ var require_buffer = __commonJS({
1196
1141
  val += this[offset + --i] * mul;
1197
1142
  }
1198
1143
  mul *= 128;
1199
- if (val >= mul)
1200
- val -= Math.pow(2, 8 * byteLength2);
1144
+ if (val >= mul) val -= Math.pow(2, 8 * byteLength2);
1201
1145
  return val;
1202
1146
  };
1203
1147
  Buffer4.prototype.readInt8 = function readInt8(offset, noAssert) {
1204
1148
  offset = offset >>> 0;
1205
- if (!noAssert)
1206
- checkOffset(offset, 1, this.length);
1207
- if (!(this[offset] & 128))
1208
- return this[offset];
1149
+ if (!noAssert) checkOffset(offset, 1, this.length);
1150
+ if (!(this[offset] & 128)) return this[offset];
1209
1151
  return (255 - this[offset] + 1) * -1;
1210
1152
  };
1211
1153
  Buffer4.prototype.readInt16LE = function readInt16LE(offset, noAssert) {
1212
1154
  offset = offset >>> 0;
1213
- if (!noAssert)
1214
- checkOffset(offset, 2, this.length);
1155
+ if (!noAssert) checkOffset(offset, 2, this.length);
1215
1156
  var val = this[offset] | this[offset + 1] << 8;
1216
1157
  return val & 32768 ? val | 4294901760 : val;
1217
1158
  };
1218
1159
  Buffer4.prototype.readInt16BE = function readInt16BE(offset, noAssert) {
1219
1160
  offset = offset >>> 0;
1220
- if (!noAssert)
1221
- checkOffset(offset, 2, this.length);
1161
+ if (!noAssert) checkOffset(offset, 2, this.length);
1222
1162
  var val = this[offset + 1] | this[offset] << 8;
1223
1163
  return val & 32768 ? val | 4294901760 : val;
1224
1164
  };
1225
1165
  Buffer4.prototype.readInt32LE = function readInt32LE(offset, noAssert) {
1226
1166
  offset = offset >>> 0;
1227
- if (!noAssert)
1228
- checkOffset(offset, 4, this.length);
1167
+ if (!noAssert) checkOffset(offset, 4, this.length);
1229
1168
  return this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16 | this[offset + 3] << 24;
1230
1169
  };
1231
1170
  Buffer4.prototype.readInt32BE = function readInt32BE(offset, noAssert) {
1232
1171
  offset = offset >>> 0;
1233
- if (!noAssert)
1234
- checkOffset(offset, 4, this.length);
1172
+ if (!noAssert) checkOffset(offset, 4, this.length);
1235
1173
  return this[offset] << 24 | this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3];
1236
1174
  };
1237
1175
  Buffer4.prototype.readFloatLE = function readFloatLE(offset, noAssert) {
1238
1176
  offset = offset >>> 0;
1239
- if (!noAssert)
1240
- checkOffset(offset, 4, this.length);
1177
+ if (!noAssert) checkOffset(offset, 4, this.length);
1241
1178
  return ieee754.read(this, offset, true, 23, 4);
1242
1179
  };
1243
1180
  Buffer4.prototype.readFloatBE = function readFloatBE(offset, noAssert) {
1244
1181
  offset = offset >>> 0;
1245
- if (!noAssert)
1246
- checkOffset(offset, 4, this.length);
1182
+ if (!noAssert) checkOffset(offset, 4, this.length);
1247
1183
  return ieee754.read(this, offset, false, 23, 4);
1248
1184
  };
1249
1185
  Buffer4.prototype.readDoubleLE = function readDoubleLE(offset, noAssert) {
1250
1186
  offset = offset >>> 0;
1251
- if (!noAssert)
1252
- checkOffset(offset, 8, this.length);
1187
+ if (!noAssert) checkOffset(offset, 8, this.length);
1253
1188
  return ieee754.read(this, offset, true, 52, 8);
1254
1189
  };
1255
1190
  Buffer4.prototype.readDoubleBE = function readDoubleBE(offset, noAssert) {
1256
1191
  offset = offset >>> 0;
1257
- if (!noAssert)
1258
- checkOffset(offset, 8, this.length);
1192
+ if (!noAssert) checkOffset(offset, 8, this.length);
1259
1193
  return ieee754.read(this, offset, false, 52, 8);
1260
1194
  };
1261
1195
  function checkInt(buf, value, offset, ext, max, min) {
1262
- if (!Buffer4.isBuffer(buf))
1263
- throw new TypeError('"buffer" argument must be a Buffer instance');
1264
- if (value > max || value < min)
1265
- throw new RangeError('"value" argument is out of bounds');
1266
- if (offset + ext > buf.length)
1267
- throw new RangeError("Index out of range");
1196
+ if (!Buffer4.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance');
1197
+ if (value > max || value < min) throw new RangeError('"value" argument is out of bounds');
1198
+ if (offset + ext > buf.length) throw new RangeError("Index out of range");
1268
1199
  }
1269
1200
  Buffer4.prototype.writeUintLE = Buffer4.prototype.writeUIntLE = function writeUIntLE(value, offset, byteLength2, noAssert) {
1270
1201
  value = +value;
@@ -1301,16 +1232,14 @@ var require_buffer = __commonJS({
1301
1232
  Buffer4.prototype.writeUint8 = Buffer4.prototype.writeUInt8 = function writeUInt8(value, offset, noAssert) {
1302
1233
  value = +value;
1303
1234
  offset = offset >>> 0;
1304
- if (!noAssert)
1305
- checkInt(this, value, offset, 1, 255, 0);
1235
+ if (!noAssert) checkInt(this, value, offset, 1, 255, 0);
1306
1236
  this[offset] = value & 255;
1307
1237
  return offset + 1;
1308
1238
  };
1309
1239
  Buffer4.prototype.writeUint16LE = Buffer4.prototype.writeUInt16LE = function writeUInt16LE(value, offset, noAssert) {
1310
1240
  value = +value;
1311
1241
  offset = offset >>> 0;
1312
- if (!noAssert)
1313
- checkInt(this, value, offset, 2, 65535, 0);
1242
+ if (!noAssert) checkInt(this, value, offset, 2, 65535, 0);
1314
1243
  this[offset] = value & 255;
1315
1244
  this[offset + 1] = value >>> 8;
1316
1245
  return offset + 2;
@@ -1318,8 +1247,7 @@ var require_buffer = __commonJS({
1318
1247
  Buffer4.prototype.writeUint16BE = Buffer4.prototype.writeUInt16BE = function writeUInt16BE(value, offset, noAssert) {
1319
1248
  value = +value;
1320
1249
  offset = offset >>> 0;
1321
- if (!noAssert)
1322
- checkInt(this, value, offset, 2, 65535, 0);
1250
+ if (!noAssert) checkInt(this, value, offset, 2, 65535, 0);
1323
1251
  this[offset] = value >>> 8;
1324
1252
  this[offset + 1] = value & 255;
1325
1253
  return offset + 2;
@@ -1327,8 +1255,7 @@ var require_buffer = __commonJS({
1327
1255
  Buffer4.prototype.writeUint32LE = Buffer4.prototype.writeUInt32LE = function writeUInt32LE(value, offset, noAssert) {
1328
1256
  value = +value;
1329
1257
  offset = offset >>> 0;
1330
- if (!noAssert)
1331
- checkInt(this, value, offset, 4, 4294967295, 0);
1258
+ if (!noAssert) checkInt(this, value, offset, 4, 4294967295, 0);
1332
1259
  this[offset + 3] = value >>> 24;
1333
1260
  this[offset + 2] = value >>> 16;
1334
1261
  this[offset + 1] = value >>> 8;
@@ -1338,8 +1265,7 @@ var require_buffer = __commonJS({
1338
1265
  Buffer4.prototype.writeUint32BE = Buffer4.prototype.writeUInt32BE = function writeUInt32BE(value, offset, noAssert) {
1339
1266
  value = +value;
1340
1267
  offset = offset >>> 0;
1341
- if (!noAssert)
1342
- checkInt(this, value, offset, 4, 4294967295, 0);
1268
+ if (!noAssert) checkInt(this, value, offset, 4, 4294967295, 0);
1343
1269
  this[offset] = value >>> 24;
1344
1270
  this[offset + 1] = value >>> 16;
1345
1271
  this[offset + 2] = value >>> 8;
@@ -1387,18 +1313,15 @@ var require_buffer = __commonJS({
1387
1313
  Buffer4.prototype.writeInt8 = function writeInt8(value, offset, noAssert) {
1388
1314
  value = +value;
1389
1315
  offset = offset >>> 0;
1390
- if (!noAssert)
1391
- checkInt(this, value, offset, 1, 127, -128);
1392
- if (value < 0)
1393
- value = 255 + value + 1;
1316
+ if (!noAssert) checkInt(this, value, offset, 1, 127, -128);
1317
+ if (value < 0) value = 255 + value + 1;
1394
1318
  this[offset] = value & 255;
1395
1319
  return offset + 1;
1396
1320
  };
1397
1321
  Buffer4.prototype.writeInt16LE = function writeInt16LE(value, offset, noAssert) {
1398
1322
  value = +value;
1399
1323
  offset = offset >>> 0;
1400
- if (!noAssert)
1401
- checkInt(this, value, offset, 2, 32767, -32768);
1324
+ if (!noAssert) checkInt(this, value, offset, 2, 32767, -32768);
1402
1325
  this[offset] = value & 255;
1403
1326
  this[offset + 1] = value >>> 8;
1404
1327
  return offset + 2;
@@ -1406,8 +1329,7 @@ var require_buffer = __commonJS({
1406
1329
  Buffer4.prototype.writeInt16BE = function writeInt16BE(value, offset, noAssert) {
1407
1330
  value = +value;
1408
1331
  offset = offset >>> 0;
1409
- if (!noAssert)
1410
- checkInt(this, value, offset, 2, 32767, -32768);
1332
+ if (!noAssert) checkInt(this, value, offset, 2, 32767, -32768);
1411
1333
  this[offset] = value >>> 8;
1412
1334
  this[offset + 1] = value & 255;
1413
1335
  return offset + 2;
@@ -1415,8 +1337,7 @@ var require_buffer = __commonJS({
1415
1337
  Buffer4.prototype.writeInt32LE = function writeInt32LE(value, offset, noAssert) {
1416
1338
  value = +value;
1417
1339
  offset = offset >>> 0;
1418
- if (!noAssert)
1419
- checkInt(this, value, offset, 4, 2147483647, -2147483648);
1340
+ if (!noAssert) checkInt(this, value, offset, 4, 2147483647, -2147483648);
1420
1341
  this[offset] = value & 255;
1421
1342
  this[offset + 1] = value >>> 8;
1422
1343
  this[offset + 2] = value >>> 16;
@@ -1426,10 +1347,8 @@ var require_buffer = __commonJS({
1426
1347
  Buffer4.prototype.writeInt32BE = function writeInt32BE(value, offset, noAssert) {
1427
1348
  value = +value;
1428
1349
  offset = offset >>> 0;
1429
- if (!noAssert)
1430
- checkInt(this, value, offset, 4, 2147483647, -2147483648);
1431
- if (value < 0)
1432
- value = 4294967295 + value + 1;
1350
+ if (!noAssert) checkInt(this, value, offset, 4, 2147483647, -2147483648);
1351
+ if (value < 0) value = 4294967295 + value + 1;
1433
1352
  this[offset] = value >>> 24;
1434
1353
  this[offset + 1] = value >>> 16;
1435
1354
  this[offset + 2] = value >>> 8;
@@ -1437,10 +1356,8 @@ var require_buffer = __commonJS({
1437
1356
  return offset + 4;
1438
1357
  };
1439
1358
  function checkIEEE754(buf, value, offset, ext, max, min) {
1440
- if (offset + ext > buf.length)
1441
- throw new RangeError("Index out of range");
1442
- if (offset < 0)
1443
- throw new RangeError("Index out of range");
1359
+ if (offset + ext > buf.length) throw new RangeError("Index out of range");
1360
+ if (offset < 0) throw new RangeError("Index out of range");
1444
1361
  }
1445
1362
  function writeFloat(buf, value, offset, littleEndian, noAssert) {
1446
1363
  value = +value;
@@ -1473,31 +1390,20 @@ var require_buffer = __commonJS({
1473
1390
  return writeDouble(this, value, offset, false, noAssert);
1474
1391
  };
1475
1392
  Buffer4.prototype.copy = function copy(target, targetStart, start, end) {
1476
- if (!Buffer4.isBuffer(target))
1477
- throw new TypeError("argument should be a Buffer");
1478
- if (!start)
1479
- start = 0;
1480
- if (!end && end !== 0)
1481
- end = this.length;
1482
- if (targetStart >= target.length)
1483
- targetStart = target.length;
1484
- if (!targetStart)
1485
- targetStart = 0;
1486
- if (end > 0 && end < start)
1487
- end = start;
1488
- if (end === start)
1489
- return 0;
1490
- if (target.length === 0 || this.length === 0)
1491
- return 0;
1393
+ if (!Buffer4.isBuffer(target)) throw new TypeError("argument should be a Buffer");
1394
+ if (!start) start = 0;
1395
+ if (!end && end !== 0) end = this.length;
1396
+ if (targetStart >= target.length) targetStart = target.length;
1397
+ if (!targetStart) targetStart = 0;
1398
+ if (end > 0 && end < start) end = start;
1399
+ if (end === start) return 0;
1400
+ if (target.length === 0 || this.length === 0) return 0;
1492
1401
  if (targetStart < 0) {
1493
1402
  throw new RangeError("targetStart out of bounds");
1494
1403
  }
1495
- if (start < 0 || start >= this.length)
1496
- throw new RangeError("Index out of range");
1497
- if (end < 0)
1498
- throw new RangeError("sourceEnd out of bounds");
1499
- if (end > this.length)
1500
- end = this.length;
1404
+ if (start < 0 || start >= this.length) throw new RangeError("Index out of range");
1405
+ if (end < 0) throw new RangeError("sourceEnd out of bounds");
1406
+ if (end > this.length) end = this.length;
1501
1407
  if (target.length - targetStart < end - start) {
1502
1408
  end = target.length - targetStart + start;
1503
1409
  }
@@ -1548,8 +1454,7 @@ var require_buffer = __commonJS({
1548
1454
  }
1549
1455
  start = start >>> 0;
1550
1456
  end = end === void 0 ? this.length : end >>> 0;
1551
- if (!val)
1552
- val = 0;
1457
+ if (!val) val = 0;
1553
1458
  var i;
1554
1459
  if (typeof val === "number") {
1555
1460
  for (i = start; i < end; ++i) {
@@ -1571,8 +1476,7 @@ var require_buffer = __commonJS({
1571
1476
  function base64clean(str) {
1572
1477
  str = str.split("=")[0];
1573
1478
  str = str.trim().replace(INVALID_BASE64_RE, "");
1574
- if (str.length < 2)
1575
- return "";
1479
+ if (str.length < 2) return "";
1576
1480
  while (str.length % 4 !== 0) {
1577
1481
  str = str + "=";
1578
1482
  }
@@ -1589,51 +1493,43 @@ var require_buffer = __commonJS({
1589
1493
  if (codePoint > 55295 && codePoint < 57344) {
1590
1494
  if (!leadSurrogate) {
1591
1495
  if (codePoint > 56319) {
1592
- if ((units -= 3) > -1)
1593
- bytes.push(239, 191, 189);
1496
+ if ((units -= 3) > -1) bytes.push(239, 191, 189);
1594
1497
  continue;
1595
1498
  } else if (i + 1 === length) {
1596
- if ((units -= 3) > -1)
1597
- bytes.push(239, 191, 189);
1499
+ if ((units -= 3) > -1) bytes.push(239, 191, 189);
1598
1500
  continue;
1599
1501
  }
1600
1502
  leadSurrogate = codePoint;
1601
1503
  continue;
1602
1504
  }
1603
1505
  if (codePoint < 56320) {
1604
- if ((units -= 3) > -1)
1605
- bytes.push(239, 191, 189);
1506
+ if ((units -= 3) > -1) bytes.push(239, 191, 189);
1606
1507
  leadSurrogate = codePoint;
1607
1508
  continue;
1608
1509
  }
1609
1510
  codePoint = (leadSurrogate - 55296 << 10 | codePoint - 56320) + 65536;
1610
1511
  } else if (leadSurrogate) {
1611
- if ((units -= 3) > -1)
1612
- bytes.push(239, 191, 189);
1512
+ if ((units -= 3) > -1) bytes.push(239, 191, 189);
1613
1513
  }
1614
1514
  leadSurrogate = null;
1615
1515
  if (codePoint < 128) {
1616
- if ((units -= 1) < 0)
1617
- break;
1516
+ if ((units -= 1) < 0) break;
1618
1517
  bytes.push(codePoint);
1619
1518
  } else if (codePoint < 2048) {
1620
- if ((units -= 2) < 0)
1621
- break;
1519
+ if ((units -= 2) < 0) break;
1622
1520
  bytes.push(
1623
1521
  codePoint >> 6 | 192,
1624
1522
  codePoint & 63 | 128
1625
1523
  );
1626
1524
  } else if (codePoint < 65536) {
1627
- if ((units -= 3) < 0)
1628
- break;
1525
+ if ((units -= 3) < 0) break;
1629
1526
  bytes.push(
1630
1527
  codePoint >> 12 | 224,
1631
1528
  codePoint >> 6 & 63 | 128,
1632
1529
  codePoint & 63 | 128
1633
1530
  );
1634
1531
  } else if (codePoint < 1114112) {
1635
- if ((units -= 4) < 0)
1636
- break;
1532
+ if ((units -= 4) < 0) break;
1637
1533
  bytes.push(
1638
1534
  codePoint >> 18 | 240,
1639
1535
  codePoint >> 12 & 63 | 128,
@@ -1657,8 +1553,7 @@ var require_buffer = __commonJS({
1657
1553
  var c, hi, lo;
1658
1554
  var byteArray = [];
1659
1555
  for (var i = 0; i < str.length; ++i) {
1660
- if ((units -= 2) < 0)
1661
- break;
1556
+ if ((units -= 2) < 0) break;
1662
1557
  c = str.charCodeAt(i);
1663
1558
  hi = c >> 8;
1664
1559
  lo = c % 256;
@@ -1672,8 +1567,7 @@ var require_buffer = __commonJS({
1672
1567
  }
1673
1568
  function blitBuffer(src, dst, offset, length) {
1674
1569
  for (var i = 0; i < length; ++i) {
1675
- if (i + offset >= dst.length || i >= src.length)
1676
- break;
1570
+ if (i + offset >= dst.length || i >= src.length) break;
1677
1571
  dst[i + offset] = src[i];
1678
1572
  }
1679
1573
  return i;
@@ -1684,7 +1578,7 @@ var require_buffer = __commonJS({
1684
1578
  function numberIsNaN(obj) {
1685
1579
  return obj !== obj;
1686
1580
  }
1687
- var hexSliceLookupTable = function() {
1581
+ var hexSliceLookupTable = (function() {
1688
1582
  var alphabet = "0123456789abcdef";
1689
1583
  var table = new Array(256);
1690
1584
  for (var i = 0; i < 16; ++i) {
@@ -1694,7 +1588,7 @@ var require_buffer = __commonJS({
1694
1588
  }
1695
1589
  }
1696
1590
  return table;
1697
- }();
1591
+ })();
1698
1592
  }
1699
1593
  });
1700
1594
 
@@ -1969,7 +1863,7 @@ var init_shim = __esm({
1969
1863
  "use strict";
1970
1864
  import_buffer = __toESM(require_buffer());
1971
1865
  import_process = __toESM(require_process());
1972
- _globalThis = function(Object2) {
1866
+ _globalThis = (function(Object2) {
1973
1867
  function get() {
1974
1868
  var _global3 = this || self;
1975
1869
  delete Object2.prototype.__magic__;
@@ -1988,7 +1882,7 @@ var init_shim = __esm({
1988
1882
  var _global2 = __magic__;
1989
1883
  return _global2;
1990
1884
  }
1991
- }(Object);
1885
+ })(Object);
1992
1886
  _global = _globalThis;
1993
1887
  }
1994
1888
  });
@@ -2644,8 +2538,7 @@ var LocalStorageStore = class extends BaseKeyStore {
2644
2538
  orderlyKey = this.getItem(address, "orderlyKey");
2645
2539
  } else {
2646
2540
  const address2 = this.getAddress();
2647
- if (!address2)
2648
- return null;
2541
+ if (!address2) return null;
2649
2542
  orderlyKey = this.getItem(address2, "orderlyKey");
2650
2543
  }
2651
2544
  if (!orderlyKey) {
@@ -5839,8 +5732,7 @@ var Assets = class {
5839
5732
  throw new Error("decimals is required");
5840
5733
  }
5841
5734
  const brokerId = this.configStore.get("brokerId");
5842
- if (!brokerId)
5843
- throw new Error("[Assets]:brokerId is required");
5735
+ if (!brokerId) throw new Error("[Assets]:brokerId is required");
5844
5736
  const depositData = {
5845
5737
  accountId: this.account.accountIdHashStr,
5846
5738
  brokerHash: parseBrokerHash(brokerId),
@@ -5909,8 +5801,7 @@ var Assets = class {
5909
5801
  throw new Error("decimals is required");
5910
5802
  }
5911
5803
  const brokerId = this.configStore.get("brokerId");
5912
- if (!brokerId)
5913
- throw new Error("[Assets]:brokerId is required");
5804
+ if (!brokerId) throw new Error("[Assets]:brokerId is required");
5914
5805
  const contractInfo = this.contractManger.getContractInfoByEnv();
5915
5806
  const contractAddress = getContractInfoByChainId(
5916
5807
  this.account.walletAdapter.chainId,
@@ -6207,12 +6098,9 @@ var _Account = class _Account {
6207
6098
  logout() {
6208
6099
  }
6209
6100
  async setAddress(address, wallet, options) {
6210
- if (!address)
6211
- throw new SDKError("Address is required");
6212
- if (!wallet)
6213
- throw new SDKError("Wallet is required");
6214
- if (!wallet?.chain?.id)
6215
- throw new SDKError("Chain id is required");
6101
+ if (!address) throw new SDKError("Address is required");
6102
+ if (!wallet) throw new SDKError("Wallet is required");
6103
+ if (!wallet?.chain?.id) throw new SDKError("Chain id is required");
6216
6104
  if (this.stateValue.address === address) {
6217
6105
  console.warn(
6218
6106
  "address parameter is the same as the current address, if you want to change chain, please use `switchChain` method."
@@ -6759,12 +6647,10 @@ var _Account = class _Account {
6759
6647
  }
6760
6648
  async importOrderlyKey(options) {
6761
6649
  const { address, secretKey, chainNamespace } = options;
6762
- if (!address || !secretKey || !chainNamespace)
6763
- return;
6650
+ if (!address || !secretKey || !chainNamespace) return;
6764
6651
  const accountInfo = await this._checkAccountExist(address, chainNamespace);
6765
6652
  const accountId = accountInfo?.account_id;
6766
- if (!accountId)
6767
- return;
6653
+ if (!accountId) return;
6768
6654
  const orderlyKey = new BaseOrderlyKeyPair(secretKey);
6769
6655
  const res = await this.checkOrderlyKey(address, orderlyKey, accountId);
6770
6656
  if (res) {
@@ -6773,8 +6659,7 @@ var _Account = class _Account {
6773
6659
  return res;
6774
6660
  }
6775
6661
  async checkOrderlyKey(address, orderlyKey, accountId) {
6776
- if (!address || !orderlyKey || !accountId)
6777
- return;
6662
+ if (!address || !orderlyKey || !accountId) return;
6778
6663
  const publicKey = await orderlyKey.getPublicKey();
6779
6664
  const orderlyKeyStatus = await this._checkOrderlyKeyState(
6780
6665
  accountId,