@elizaos/project-tee-starter 1.6.5-alpha.9 → 1.6.5-beta.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.
Files changed (3) hide show
  1. package/dist/index.js +518 -517
  2. package/dist/index.js.map +25 -25
  3. package/package.json +23 -23
package/dist/index.js CHANGED
@@ -720,6 +720,416 @@ var init_hmac = __esm(() => {
720
720
  hmac.create = (hash, key) => new HMAC(hash, key);
721
721
  });
722
722
 
723
+ // ../../node_modules/viem/_esm/errors/version.js
724
+ var version = "2.41.2";
725
+
726
+ // ../../node_modules/viem/_esm/errors/base.js
727
+ function walk(err, fn) {
728
+ if (fn?.(err))
729
+ return err;
730
+ if (err && typeof err === "object" && "cause" in err && err.cause !== undefined)
731
+ return walk(err.cause, fn);
732
+ return fn ? null : err;
733
+ }
734
+ var errorConfig, BaseError;
735
+ var init_base = __esm(() => {
736
+ errorConfig = {
737
+ getDocsUrl: ({ docsBaseUrl, docsPath = "", docsSlug }) => docsPath ? `${docsBaseUrl ?? "https://viem.sh"}${docsPath}${docsSlug ? `#${docsSlug}` : ""}` : undefined,
738
+ version: `viem@${version}`
739
+ };
740
+ BaseError = class BaseError extends Error {
741
+ constructor(shortMessage, args = {}) {
742
+ const details = (() => {
743
+ if (args.cause instanceof BaseError)
744
+ return args.cause.details;
745
+ if (args.cause?.message)
746
+ return args.cause.message;
747
+ return args.details;
748
+ })();
749
+ const docsPath = (() => {
750
+ if (args.cause instanceof BaseError)
751
+ return args.cause.docsPath || args.docsPath;
752
+ return args.docsPath;
753
+ })();
754
+ const docsUrl = errorConfig.getDocsUrl?.({ ...args, docsPath });
755
+ const message = [
756
+ shortMessage || "An error occurred.",
757
+ "",
758
+ ...args.metaMessages ? [...args.metaMessages, ""] : [],
759
+ ...docsUrl ? [`Docs: ${docsUrl}`] : [],
760
+ ...details ? [`Details: ${details}`] : [],
761
+ ...errorConfig.version ? [`Version: ${errorConfig.version}`] : []
762
+ ].join(`
763
+ `);
764
+ super(message, args.cause ? { cause: args.cause } : undefined);
765
+ Object.defineProperty(this, "details", {
766
+ enumerable: true,
767
+ configurable: true,
768
+ writable: true,
769
+ value: undefined
770
+ });
771
+ Object.defineProperty(this, "docsPath", {
772
+ enumerable: true,
773
+ configurable: true,
774
+ writable: true,
775
+ value: undefined
776
+ });
777
+ Object.defineProperty(this, "metaMessages", {
778
+ enumerable: true,
779
+ configurable: true,
780
+ writable: true,
781
+ value: undefined
782
+ });
783
+ Object.defineProperty(this, "shortMessage", {
784
+ enumerable: true,
785
+ configurable: true,
786
+ writable: true,
787
+ value: undefined
788
+ });
789
+ Object.defineProperty(this, "version", {
790
+ enumerable: true,
791
+ configurable: true,
792
+ writable: true,
793
+ value: undefined
794
+ });
795
+ Object.defineProperty(this, "name", {
796
+ enumerable: true,
797
+ configurable: true,
798
+ writable: true,
799
+ value: "BaseError"
800
+ });
801
+ this.details = details;
802
+ this.docsPath = docsPath;
803
+ this.metaMessages = args.metaMessages;
804
+ this.name = args.name ?? this.name;
805
+ this.shortMessage = shortMessage;
806
+ this.version = version;
807
+ }
808
+ walk(fn) {
809
+ return walk(this, fn);
810
+ }
811
+ };
812
+ });
813
+
814
+ // ../../node_modules/viem/_esm/errors/encoding.js
815
+ var IntegerOutOfRangeError, SizeOverflowError;
816
+ var init_encoding = __esm(() => {
817
+ init_base();
818
+ IntegerOutOfRangeError = class IntegerOutOfRangeError extends BaseError {
819
+ constructor({ max, min, signed, size, value }) {
820
+ super(`Number "${value}" is not in safe ${size ? `${size * 8}-bit ${signed ? "signed" : "unsigned"} ` : ""}integer range ${max ? `(${min} to ${max})` : `(above ${min})`}`, { name: "IntegerOutOfRangeError" });
821
+ }
822
+ };
823
+ SizeOverflowError = class SizeOverflowError extends BaseError {
824
+ constructor({ givenSize, maxSize }) {
825
+ super(`Size cannot exceed ${maxSize} bytes. Given size: ${givenSize} bytes.`, { name: "SizeOverflowError" });
826
+ }
827
+ };
828
+ });
829
+
830
+ // ../../node_modules/viem/_esm/utils/data/isHex.js
831
+ function isHex(value, { strict = true } = {}) {
832
+ if (!value)
833
+ return false;
834
+ if (typeof value !== "string")
835
+ return false;
836
+ return strict ? /^0x[0-9a-fA-F]*$/.test(value) : value.startsWith("0x");
837
+ }
838
+
839
+ // ../../node_modules/viem/_esm/utils/data/size.js
840
+ function size(value) {
841
+ if (isHex(value, { strict: false }))
842
+ return Math.ceil((value.length - 2) / 2);
843
+ return value.length;
844
+ }
845
+ var init_size = () => {};
846
+
847
+ // ../../node_modules/viem/_esm/utils/data/trim.js
848
+ function trim(hexOrBytes, { dir = "left" } = {}) {
849
+ let data = typeof hexOrBytes === "string" ? hexOrBytes.replace("0x", "") : hexOrBytes;
850
+ let sliceLength = 0;
851
+ for (let i = 0;i < data.length - 1; i++) {
852
+ if (data[dir === "left" ? i : data.length - i - 1].toString() === "0")
853
+ sliceLength++;
854
+ else
855
+ break;
856
+ }
857
+ data = dir === "left" ? data.slice(sliceLength) : data.slice(0, data.length - sliceLength);
858
+ if (typeof hexOrBytes === "string") {
859
+ if (data.length === 1 && dir === "right")
860
+ data = `${data}0`;
861
+ return `0x${data.length % 2 === 1 ? `0${data}` : data}`;
862
+ }
863
+ return data;
864
+ }
865
+
866
+ // ../../node_modules/viem/_esm/errors/data.js
867
+ var SliceOffsetOutOfBoundsError, SizeExceedsPaddingSizeError;
868
+ var init_data = __esm(() => {
869
+ init_base();
870
+ SliceOffsetOutOfBoundsError = class SliceOffsetOutOfBoundsError extends BaseError {
871
+ constructor({ offset, position, size: size2 }) {
872
+ super(`Slice ${position === "start" ? "starting" : "ending"} at offset "${offset}" is out-of-bounds (size: ${size2}).`, { name: "SliceOffsetOutOfBoundsError" });
873
+ }
874
+ };
875
+ SizeExceedsPaddingSizeError = class SizeExceedsPaddingSizeError extends BaseError {
876
+ constructor({ size: size2, targetSize, type }) {
877
+ super(`${type.charAt(0).toUpperCase()}${type.slice(1).toLowerCase()} size (${size2}) exceeds padding size (${targetSize}).`, { name: "SizeExceedsPaddingSizeError" });
878
+ }
879
+ };
880
+ });
881
+
882
+ // ../../node_modules/viem/_esm/utils/data/pad.js
883
+ function pad(hexOrBytes, { dir, size: size2 = 32 } = {}) {
884
+ if (typeof hexOrBytes === "string")
885
+ return padHex(hexOrBytes, { dir, size: size2 });
886
+ return padBytes(hexOrBytes, { dir, size: size2 });
887
+ }
888
+ function padHex(hex_, { dir, size: size2 = 32 } = {}) {
889
+ if (size2 === null)
890
+ return hex_;
891
+ const hex = hex_.replace("0x", "");
892
+ if (hex.length > size2 * 2)
893
+ throw new SizeExceedsPaddingSizeError({
894
+ size: Math.ceil(hex.length / 2),
895
+ targetSize: size2,
896
+ type: "hex"
897
+ });
898
+ return `0x${hex[dir === "right" ? "padEnd" : "padStart"](size2 * 2, "0")}`;
899
+ }
900
+ function padBytes(bytes, { dir, size: size2 = 32 } = {}) {
901
+ if (size2 === null)
902
+ return bytes;
903
+ if (bytes.length > size2)
904
+ throw new SizeExceedsPaddingSizeError({
905
+ size: bytes.length,
906
+ targetSize: size2,
907
+ type: "bytes"
908
+ });
909
+ const paddedBytes = new Uint8Array(size2);
910
+ for (let i = 0;i < size2; i++) {
911
+ const padEnd = dir === "right";
912
+ paddedBytes[padEnd ? i : size2 - i - 1] = bytes[padEnd ? i : bytes.length - i - 1];
913
+ }
914
+ return paddedBytes;
915
+ }
916
+ var init_pad = __esm(() => {
917
+ init_data();
918
+ });
919
+
920
+ // ../../node_modules/viem/_esm/utils/encoding/toHex.js
921
+ function toHex(value, opts = {}) {
922
+ if (typeof value === "number" || typeof value === "bigint")
923
+ return numberToHex(value, opts);
924
+ if (typeof value === "string") {
925
+ return stringToHex(value, opts);
926
+ }
927
+ if (typeof value === "boolean")
928
+ return boolToHex(value, opts);
929
+ return bytesToHex(value, opts);
930
+ }
931
+ function boolToHex(value, opts = {}) {
932
+ const hex = `0x${Number(value)}`;
933
+ if (typeof opts.size === "number") {
934
+ assertSize(hex, { size: opts.size });
935
+ return pad(hex, { size: opts.size });
936
+ }
937
+ return hex;
938
+ }
939
+ function bytesToHex(value, opts = {}) {
940
+ let string = "";
941
+ for (let i = 0;i < value.length; i++) {
942
+ string += hexes[value[i]];
943
+ }
944
+ const hex = `0x${string}`;
945
+ if (typeof opts.size === "number") {
946
+ assertSize(hex, { size: opts.size });
947
+ return pad(hex, { dir: "right", size: opts.size });
948
+ }
949
+ return hex;
950
+ }
951
+ function numberToHex(value_, opts = {}) {
952
+ const { signed, size: size2 } = opts;
953
+ const value = BigInt(value_);
954
+ let maxValue;
955
+ if (size2) {
956
+ if (signed)
957
+ maxValue = (1n << BigInt(size2) * 8n - 1n) - 1n;
958
+ else
959
+ maxValue = 2n ** (BigInt(size2) * 8n) - 1n;
960
+ } else if (typeof value_ === "number") {
961
+ maxValue = BigInt(Number.MAX_SAFE_INTEGER);
962
+ }
963
+ const minValue = typeof maxValue === "bigint" && signed ? -maxValue - 1n : 0;
964
+ if (maxValue && value > maxValue || value < minValue) {
965
+ const suffix = typeof value_ === "bigint" ? "n" : "";
966
+ throw new IntegerOutOfRangeError({
967
+ max: maxValue ? `${maxValue}${suffix}` : undefined,
968
+ min: `${minValue}${suffix}`,
969
+ signed,
970
+ size: size2,
971
+ value: `${value_}${suffix}`
972
+ });
973
+ }
974
+ const hex = `0x${(signed && value < 0 ? (1n << BigInt(size2 * 8)) + BigInt(value) : value).toString(16)}`;
975
+ if (size2)
976
+ return pad(hex, { size: size2 });
977
+ return hex;
978
+ }
979
+ function stringToHex(value_, opts = {}) {
980
+ const value = encoder.encode(value_);
981
+ return bytesToHex(value, opts);
982
+ }
983
+ var hexes, encoder;
984
+ var init_toHex = __esm(() => {
985
+ init_encoding();
986
+ init_pad();
987
+ init_fromHex();
988
+ hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_v, i) => i.toString(16).padStart(2, "0"));
989
+ encoder = /* @__PURE__ */ new TextEncoder;
990
+ });
991
+
992
+ // ../../node_modules/viem/_esm/utils/encoding/toBytes.js
993
+ function toBytes2(value, opts = {}) {
994
+ if (typeof value === "number" || typeof value === "bigint")
995
+ return numberToBytes(value, opts);
996
+ if (typeof value === "boolean")
997
+ return boolToBytes(value, opts);
998
+ if (isHex(value))
999
+ return hexToBytes(value, opts);
1000
+ return stringToBytes(value, opts);
1001
+ }
1002
+ function boolToBytes(value, opts = {}) {
1003
+ const bytes = new Uint8Array(1);
1004
+ bytes[0] = Number(value);
1005
+ if (typeof opts.size === "number") {
1006
+ assertSize(bytes, { size: opts.size });
1007
+ return pad(bytes, { size: opts.size });
1008
+ }
1009
+ return bytes;
1010
+ }
1011
+ function charCodeToBase16(char) {
1012
+ if (char >= charCodeMap.zero && char <= charCodeMap.nine)
1013
+ return char - charCodeMap.zero;
1014
+ if (char >= charCodeMap.A && char <= charCodeMap.F)
1015
+ return char - (charCodeMap.A - 10);
1016
+ if (char >= charCodeMap.a && char <= charCodeMap.f)
1017
+ return char - (charCodeMap.a - 10);
1018
+ return;
1019
+ }
1020
+ function hexToBytes(hex_, opts = {}) {
1021
+ let hex = hex_;
1022
+ if (opts.size) {
1023
+ assertSize(hex, { size: opts.size });
1024
+ hex = pad(hex, { dir: "right", size: opts.size });
1025
+ }
1026
+ let hexString = hex.slice(2);
1027
+ if (hexString.length % 2)
1028
+ hexString = `0${hexString}`;
1029
+ const length = hexString.length / 2;
1030
+ const bytes = new Uint8Array(length);
1031
+ for (let index = 0, j = 0;index < length; index++) {
1032
+ const nibbleLeft = charCodeToBase16(hexString.charCodeAt(j++));
1033
+ const nibbleRight = charCodeToBase16(hexString.charCodeAt(j++));
1034
+ if (nibbleLeft === undefined || nibbleRight === undefined) {
1035
+ throw new BaseError(`Invalid byte sequence ("${hexString[j - 2]}${hexString[j - 1]}" in "${hexString}").`);
1036
+ }
1037
+ bytes[index] = nibbleLeft * 16 + nibbleRight;
1038
+ }
1039
+ return bytes;
1040
+ }
1041
+ function numberToBytes(value, opts) {
1042
+ const hex = numberToHex(value, opts);
1043
+ return hexToBytes(hex);
1044
+ }
1045
+ function stringToBytes(value, opts = {}) {
1046
+ const bytes = encoder2.encode(value);
1047
+ if (typeof opts.size === "number") {
1048
+ assertSize(bytes, { size: opts.size });
1049
+ return pad(bytes, { dir: "right", size: opts.size });
1050
+ }
1051
+ return bytes;
1052
+ }
1053
+ var encoder2, charCodeMap;
1054
+ var init_toBytes = __esm(() => {
1055
+ init_base();
1056
+ init_pad();
1057
+ init_fromHex();
1058
+ init_toHex();
1059
+ encoder2 = /* @__PURE__ */ new TextEncoder;
1060
+ charCodeMap = {
1061
+ zero: 48,
1062
+ nine: 57,
1063
+ A: 65,
1064
+ F: 70,
1065
+ a: 97,
1066
+ f: 102
1067
+ };
1068
+ });
1069
+
1070
+ // ../../node_modules/viem/_esm/utils/encoding/fromHex.js
1071
+ function assertSize(hexOrBytes, { size: size2 }) {
1072
+ if (size(hexOrBytes) > size2)
1073
+ throw new SizeOverflowError({
1074
+ givenSize: size(hexOrBytes),
1075
+ maxSize: size2
1076
+ });
1077
+ }
1078
+ function hexToBigInt(hex, opts = {}) {
1079
+ const { signed } = opts;
1080
+ if (opts.size)
1081
+ assertSize(hex, { size: opts.size });
1082
+ const value = BigInt(hex);
1083
+ if (!signed)
1084
+ return value;
1085
+ const size2 = (hex.length - 2) / 2;
1086
+ const max = (1n << BigInt(size2) * 8n - 1n) - 1n;
1087
+ if (value <= max)
1088
+ return value;
1089
+ return value - BigInt(`0x${"f".padStart(size2 * 2, "f")}`) - 1n;
1090
+ }
1091
+ function hexToNumber(hex, opts = {}) {
1092
+ return Number(hexToBigInt(hex, opts));
1093
+ }
1094
+ var init_fromHex = __esm(() => {
1095
+ init_encoding();
1096
+ init_size();
1097
+ });
1098
+
1099
+ // ../../node_modules/viem/_esm/utils/lru.js
1100
+ var LruMap;
1101
+ var init_lru = __esm(() => {
1102
+ LruMap = class LruMap extends Map {
1103
+ constructor(size2) {
1104
+ super();
1105
+ Object.defineProperty(this, "maxSize", {
1106
+ enumerable: true,
1107
+ configurable: true,
1108
+ writable: true,
1109
+ value: undefined
1110
+ });
1111
+ this.maxSize = size2;
1112
+ }
1113
+ get(key) {
1114
+ const value = super.get(key);
1115
+ if (super.has(key) && value !== undefined) {
1116
+ this.delete(key);
1117
+ super.set(key, value);
1118
+ }
1119
+ return value;
1120
+ }
1121
+ set(key, value) {
1122
+ super.set(key, value);
1123
+ if (this.maxSize && this.size > this.maxSize) {
1124
+ const firstKey = this.keys().next().value;
1125
+ if (firstKey)
1126
+ this.delete(firstKey);
1127
+ }
1128
+ return this;
1129
+ }
1130
+ };
1131
+ });
1132
+
723
1133
  // ../../node_modules/viem/node_modules/@noble/curves/esm/abstract/utils.js
724
1134
  function isBytes2(a) {
725
1135
  return a instanceof Uint8Array || ArrayBuffer.isView(a) && a.constructor.name === "Uint8Array";
@@ -736,18 +1146,18 @@ function numberToHexUnpadded(num) {
736
1146
  const hex = num.toString(16);
737
1147
  return hex.length & 1 ? "0" + hex : hex;
738
1148
  }
739
- function hexToNumber(hex) {
1149
+ function hexToNumber2(hex) {
740
1150
  if (typeof hex !== "string")
741
1151
  throw new Error("hex string expected, got " + typeof hex);
742
1152
  return hex === "" ? _0n : BigInt("0x" + hex);
743
1153
  }
744
- function bytesToHex(bytes) {
1154
+ function bytesToHex2(bytes) {
745
1155
  abytes2(bytes);
746
1156
  if (hasHexBuiltin)
747
1157
  return bytes.toHex();
748
1158
  let hex = "";
749
1159
  for (let i = 0;i < bytes.length; i++) {
750
- hex += hexes[bytes[i]];
1160
+ hex += hexes2[bytes[i]];
751
1161
  }
752
1162
  return hex;
753
1163
  }
@@ -760,7 +1170,7 @@ function asciiToBase16(ch) {
760
1170
  return ch - (asciis.a - 10);
761
1171
  return;
762
1172
  }
763
- function hexToBytes(hex) {
1173
+ function hexToBytes2(hex) {
764
1174
  if (typeof hex !== "string")
765
1175
  throw new Error("hex string expected, got " + typeof hex);
766
1176
  if (hasHexBuiltin)
@@ -782,14 +1192,14 @@ function hexToBytes(hex) {
782
1192
  return array;
783
1193
  }
784
1194
  function bytesToNumberBE(bytes) {
785
- return hexToNumber(bytesToHex(bytes));
1195
+ return hexToNumber2(bytesToHex2(bytes));
786
1196
  }
787
1197
  function bytesToNumberLE(bytes) {
788
1198
  abytes2(bytes);
789
- return hexToNumber(bytesToHex(Uint8Array.from(bytes).reverse()));
1199
+ return hexToNumber2(bytesToHex2(Uint8Array.from(bytes).reverse()));
790
1200
  }
791
1201
  function numberToBytesBE(n, len) {
792
- return hexToBytes(n.toString(16).padStart(len * 2, "0"));
1202
+ return hexToBytes2(n.toString(16).padStart(len * 2, "0"));
793
1203
  }
794
1204
  function numberToBytesLE(n, len) {
795
1205
  return numberToBytesBE(n, len).reverse();
@@ -798,7 +1208,7 @@ function ensureBytes(title, hex, expectedLength) {
798
1208
  let res;
799
1209
  if (typeof hex === "string") {
800
1210
  try {
801
- res = hexToBytes(hex);
1211
+ res = hexToBytes2(hex);
802
1212
  } catch (e) {
803
1213
  throw new Error(title + " must be hex string or Uint8Array, cause: " + e);
804
1214
  }
@@ -820,10 +1230,10 @@ function concatBytes2(...arrays) {
820
1230
  sum += a.length;
821
1231
  }
822
1232
  const res = new Uint8Array(sum);
823
- for (let i = 0, pad = 0;i < arrays.length; i++) {
1233
+ for (let i = 0, pad2 = 0;i < arrays.length; i++) {
824
1234
  const a = arrays[i];
825
- res.set(a, pad);
826
- pad += a.length;
1235
+ res.set(a, pad2);
1236
+ pad2 += a.length;
827
1237
  }
828
1238
  return res;
829
1239
  }
@@ -917,13 +1327,13 @@ function memoized(fn) {
917
1327
  return computed;
918
1328
  };
919
1329
  }
920
- var _0n, _1n, hasHexBuiltin, hexes, asciis, isPosBig = (n) => typeof n === "bigint" && _0n <= n, bitMask = (n) => (_1n << BigInt(n)) - _1n, u8n = (len) => new Uint8Array(len), u8fr = (arr) => Uint8Array.from(arr), validatorFns;
1330
+ var _0n, _1n, hasHexBuiltin, hexes2, asciis, isPosBig = (n) => typeof n === "bigint" && _0n <= n, bitMask = (n) => (_1n << BigInt(n)) - _1n, u8n = (len) => new Uint8Array(len), u8fr = (arr) => Uint8Array.from(arr), validatorFns;
921
1331
  var init_utils2 = __esm(() => {
922
1332
  /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
923
1333
  _0n = /* @__PURE__ */ BigInt(0);
924
1334
  _1n = /* @__PURE__ */ BigInt(1);
925
1335
  hasHexBuiltin = typeof Uint8Array.from([]).toHex === "function" && typeof Uint8Array.fromHex === "function";
926
- hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, "0"));
1336
+ hexes2 = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, "0"));
927
1337
  asciis = { _0: 48, _9: 57, A: 65, F: 70, a: 97, f: 102 };
928
1338
  validatorFns = {
929
1339
  bigint: (val) => typeof val === "bigint",
@@ -1455,14 +1865,14 @@ function validatePointOpts(curve) {
1455
1865
  }
1456
1866
  return Object.freeze({ ...opts });
1457
1867
  }
1458
- function numToSizedHex(num, size) {
1459
- return bytesToHex(numberToBytesBE(num, size));
1868
+ function numToSizedHex(num, size2) {
1869
+ return bytesToHex2(numberToBytesBE(num, size2));
1460
1870
  }
1461
1871
  function weierstrassPoints(opts) {
1462
1872
  const CURVE = validatePointOpts(opts);
1463
1873
  const { Fp } = CURVE;
1464
1874
  const Fn = Field(CURVE.n, CURVE.nBitLength);
1465
- const toBytes2 = CURVE.toBytes || ((_c, point, _isCompressed) => {
1875
+ const toBytes3 = CURVE.toBytes || ((_c, point, _isCompressed) => {
1466
1876
  const a = point.toAffine();
1467
1877
  return concatBytes2(Uint8Array.from([4]), Fp.toBytes(a.x), Fp.toBytes(a.y));
1468
1878
  });
@@ -1496,7 +1906,7 @@ function weierstrassPoints(opts) {
1496
1906
  const { allowedPrivateKeyLengths: lengths, nByteLength, wrapPrivateKey, n: N } = CURVE;
1497
1907
  if (lengths && typeof key !== "bigint") {
1498
1908
  if (isBytes2(key))
1499
- key = bytesToHex(key);
1909
+ key = bytesToHex2(key);
1500
1910
  if (typeof key !== "string" || !lengths.includes(key.length))
1501
1911
  throw new Error("invalid private key");
1502
1912
  key = key.padStart(nByteLength * 2, "0");
@@ -1790,11 +2200,11 @@ function weierstrassPoints(opts) {
1790
2200
  toRawBytes(isCompressed = true) {
1791
2201
  abool("isCompressed", isCompressed);
1792
2202
  this.assertValidity();
1793
- return toBytes2(Point, this, isCompressed);
2203
+ return toBytes3(Point, this, isCompressed);
1794
2204
  }
1795
2205
  toHex(isCompressed = true) {
1796
2206
  abool("isCompressed", isCompressed);
1797
- return bytesToHex(this.toRawBytes(isCompressed));
2207
+ return bytesToHex2(this.toRawBytes(isCompressed));
1798
2208
  }
1799
2209
  }
1800
2210
  Point.BASE = new Point(CURVE.Gx, CURVE.Gy, Fp.ONE);
@@ -1936,13 +2346,13 @@ function weierstrass(curveDef) {
1936
2346
  return this.hasHighS() ? new Signature(this.r, modN(-this.s), this.recovery) : this;
1937
2347
  }
1938
2348
  toDERRawBytes() {
1939
- return hexToBytes(this.toDERHex());
2349
+ return hexToBytes2(this.toDERHex());
1940
2350
  }
1941
2351
  toDERHex() {
1942
2352
  return DER.hexFromSig(this);
1943
2353
  }
1944
2354
  toCompactRawBytes() {
1945
- return hexToBytes(this.toCompactHex());
2355
+ return hexToBytes2(this.toCompactHex());
1946
2356
  }
1947
2357
  toCompactHex() {
1948
2358
  const l = nByteLength;
@@ -2072,16 +2482,16 @@ function weierstrass(curveDef) {
2072
2482
  throw new Error("options.strict was renamed to lowS");
2073
2483
  if (format !== undefined && format !== "compact" && format !== "der")
2074
2484
  throw new Error("format must be compact or der");
2075
- const isHex = typeof sg === "string" || isBytes2(sg);
2076
- const isObj = !isHex && !format && typeof sg === "object" && sg !== null && typeof sg.r === "bigint" && typeof sg.s === "bigint";
2077
- if (!isHex && !isObj)
2485
+ const isHex2 = typeof sg === "string" || isBytes2(sg);
2486
+ const isObj = !isHex2 && !format && typeof sg === "object" && sg !== null && typeof sg.r === "bigint" && typeof sg.s === "bigint";
2487
+ if (!isHex2 && !isObj)
2078
2488
  throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");
2079
2489
  let _sig = undefined;
2080
2490
  let P;
2081
2491
  try {
2082
2492
  if (isObj)
2083
2493
  _sig = new Signature(sg.r, sg.s);
2084
- if (isHex) {
2494
+ if (isHex2) {
2085
2495
  try {
2086
2496
  if (format !== "compact")
2087
2497
  _sig = Signature.fromDER(sg);
@@ -2326,382 +2736,6 @@ var init_secp256k1 = __esm(() => {
2326
2736
  }, sha256);
2327
2737
  });
2328
2738
 
2329
- // ../../node_modules/viem/_esm/errors/version.js
2330
- var version = "2.30.1";
2331
-
2332
- // ../../node_modules/viem/_esm/errors/base.js
2333
- function walk(err, fn) {
2334
- if (fn?.(err))
2335
- return err;
2336
- if (err && typeof err === "object" && "cause" in err && err.cause !== undefined)
2337
- return walk(err.cause, fn);
2338
- return fn ? null : err;
2339
- }
2340
- var errorConfig, BaseError;
2341
- var init_base = __esm(() => {
2342
- errorConfig = {
2343
- getDocsUrl: ({ docsBaseUrl, docsPath = "", docsSlug }) => docsPath ? `${docsBaseUrl ?? "https://viem.sh"}${docsPath}${docsSlug ? `#${docsSlug}` : ""}` : undefined,
2344
- version: `viem@${version}`
2345
- };
2346
- BaseError = class BaseError extends Error {
2347
- constructor(shortMessage, args = {}) {
2348
- const details = (() => {
2349
- if (args.cause instanceof BaseError)
2350
- return args.cause.details;
2351
- if (args.cause?.message)
2352
- return args.cause.message;
2353
- return args.details;
2354
- })();
2355
- const docsPath = (() => {
2356
- if (args.cause instanceof BaseError)
2357
- return args.cause.docsPath || args.docsPath;
2358
- return args.docsPath;
2359
- })();
2360
- const docsUrl = errorConfig.getDocsUrl?.({ ...args, docsPath });
2361
- const message = [
2362
- shortMessage || "An error occurred.",
2363
- "",
2364
- ...args.metaMessages ? [...args.metaMessages, ""] : [],
2365
- ...docsUrl ? [`Docs: ${docsUrl}`] : [],
2366
- ...details ? [`Details: ${details}`] : [],
2367
- ...errorConfig.version ? [`Version: ${errorConfig.version}`] : []
2368
- ].join(`
2369
- `);
2370
- super(message, args.cause ? { cause: args.cause } : undefined);
2371
- Object.defineProperty(this, "details", {
2372
- enumerable: true,
2373
- configurable: true,
2374
- writable: true,
2375
- value: undefined
2376
- });
2377
- Object.defineProperty(this, "docsPath", {
2378
- enumerable: true,
2379
- configurable: true,
2380
- writable: true,
2381
- value: undefined
2382
- });
2383
- Object.defineProperty(this, "metaMessages", {
2384
- enumerable: true,
2385
- configurable: true,
2386
- writable: true,
2387
- value: undefined
2388
- });
2389
- Object.defineProperty(this, "shortMessage", {
2390
- enumerable: true,
2391
- configurable: true,
2392
- writable: true,
2393
- value: undefined
2394
- });
2395
- Object.defineProperty(this, "version", {
2396
- enumerable: true,
2397
- configurable: true,
2398
- writable: true,
2399
- value: undefined
2400
- });
2401
- Object.defineProperty(this, "name", {
2402
- enumerable: true,
2403
- configurable: true,
2404
- writable: true,
2405
- value: "BaseError"
2406
- });
2407
- this.details = details;
2408
- this.docsPath = docsPath;
2409
- this.metaMessages = args.metaMessages;
2410
- this.name = args.name ?? this.name;
2411
- this.shortMessage = shortMessage;
2412
- this.version = version;
2413
- }
2414
- walk(fn) {
2415
- return walk(this, fn);
2416
- }
2417
- };
2418
- });
2419
-
2420
- // ../../node_modules/viem/_esm/errors/encoding.js
2421
- var IntegerOutOfRangeError, SizeOverflowError;
2422
- var init_encoding = __esm(() => {
2423
- init_base();
2424
- IntegerOutOfRangeError = class IntegerOutOfRangeError extends BaseError {
2425
- constructor({ max, min, signed, size, value }) {
2426
- super(`Number "${value}" is not in safe ${size ? `${size * 8}-bit ${signed ? "signed" : "unsigned"} ` : ""}integer range ${max ? `(${min} to ${max})` : `(above ${min})`}`, { name: "IntegerOutOfRangeError" });
2427
- }
2428
- };
2429
- SizeOverflowError = class SizeOverflowError extends BaseError {
2430
- constructor({ givenSize, maxSize }) {
2431
- super(`Size cannot exceed ${maxSize} bytes. Given size: ${givenSize} bytes.`, { name: "SizeOverflowError" });
2432
- }
2433
- };
2434
- });
2435
-
2436
- // ../../node_modules/viem/_esm/errors/data.js
2437
- var SliceOffsetOutOfBoundsError, SizeExceedsPaddingSizeError;
2438
- var init_data = __esm(() => {
2439
- init_base();
2440
- SliceOffsetOutOfBoundsError = class SliceOffsetOutOfBoundsError extends BaseError {
2441
- constructor({ offset, position, size }) {
2442
- super(`Slice ${position === "start" ? "starting" : "ending"} at offset "${offset}" is out-of-bounds (size: ${size}).`, { name: "SliceOffsetOutOfBoundsError" });
2443
- }
2444
- };
2445
- SizeExceedsPaddingSizeError = class SizeExceedsPaddingSizeError extends BaseError {
2446
- constructor({ size, targetSize, type }) {
2447
- super(`${type.charAt(0).toUpperCase()}${type.slice(1).toLowerCase()} size (${size}) exceeds padding size (${targetSize}).`, { name: "SizeExceedsPaddingSizeError" });
2448
- }
2449
- };
2450
- });
2451
-
2452
- // ../../node_modules/viem/_esm/utils/data/pad.js
2453
- function pad(hexOrBytes, { dir, size = 32 } = {}) {
2454
- if (typeof hexOrBytes === "string")
2455
- return padHex(hexOrBytes, { dir, size });
2456
- return padBytes(hexOrBytes, { dir, size });
2457
- }
2458
- function padHex(hex_, { dir, size = 32 } = {}) {
2459
- if (size === null)
2460
- return hex_;
2461
- const hex = hex_.replace("0x", "");
2462
- if (hex.length > size * 2)
2463
- throw new SizeExceedsPaddingSizeError({
2464
- size: Math.ceil(hex.length / 2),
2465
- targetSize: size,
2466
- type: "hex"
2467
- });
2468
- return `0x${hex[dir === "right" ? "padEnd" : "padStart"](size * 2, "0")}`;
2469
- }
2470
- function padBytes(bytes, { dir, size = 32 } = {}) {
2471
- if (size === null)
2472
- return bytes;
2473
- if (bytes.length > size)
2474
- throw new SizeExceedsPaddingSizeError({
2475
- size: bytes.length,
2476
- targetSize: size,
2477
- type: "bytes"
2478
- });
2479
- const paddedBytes = new Uint8Array(size);
2480
- for (let i = 0;i < size; i++) {
2481
- const padEnd = dir === "right";
2482
- paddedBytes[padEnd ? i : size - i - 1] = bytes[padEnd ? i : bytes.length - i - 1];
2483
- }
2484
- return paddedBytes;
2485
- }
2486
- var init_pad = __esm(() => {
2487
- init_data();
2488
- });
2489
-
2490
- // ../../node_modules/viem/_esm/utils/data/isHex.js
2491
- function isHex(value, { strict = true } = {}) {
2492
- if (!value)
2493
- return false;
2494
- if (typeof value !== "string")
2495
- return false;
2496
- return strict ? /^0x[0-9a-fA-F]*$/.test(value) : value.startsWith("0x");
2497
- }
2498
-
2499
- // ../../node_modules/viem/_esm/utils/data/size.js
2500
- function size(value) {
2501
- if (isHex(value, { strict: false }))
2502
- return Math.ceil((value.length - 2) / 2);
2503
- return value.length;
2504
- }
2505
- var init_size = () => {};
2506
-
2507
- // ../../node_modules/viem/_esm/utils/data/trim.js
2508
- function trim(hexOrBytes, { dir = "left" } = {}) {
2509
- let data = typeof hexOrBytes === "string" ? hexOrBytes.replace("0x", "") : hexOrBytes;
2510
- let sliceLength = 0;
2511
- for (let i = 0;i < data.length - 1; i++) {
2512
- if (data[dir === "left" ? i : data.length - i - 1].toString() === "0")
2513
- sliceLength++;
2514
- else
2515
- break;
2516
- }
2517
- data = dir === "left" ? data.slice(sliceLength) : data.slice(0, data.length - sliceLength);
2518
- if (typeof hexOrBytes === "string") {
2519
- if (data.length === 1 && dir === "right")
2520
- data = `${data}0`;
2521
- return `0x${data.length % 2 === 1 ? `0${data}` : data}`;
2522
- }
2523
- return data;
2524
- }
2525
-
2526
- // ../../node_modules/viem/_esm/utils/encoding/toBytes.js
2527
- function toBytes2(value, opts = {}) {
2528
- if (typeof value === "number" || typeof value === "bigint")
2529
- return numberToBytes(value, opts);
2530
- if (typeof value === "boolean")
2531
- return boolToBytes(value, opts);
2532
- if (isHex(value))
2533
- return hexToBytes2(value, opts);
2534
- return stringToBytes(value, opts);
2535
- }
2536
- function boolToBytes(value, opts = {}) {
2537
- const bytes = new Uint8Array(1);
2538
- bytes[0] = Number(value);
2539
- if (typeof opts.size === "number") {
2540
- assertSize(bytes, { size: opts.size });
2541
- return pad(bytes, { size: opts.size });
2542
- }
2543
- return bytes;
2544
- }
2545
- function charCodeToBase16(char) {
2546
- if (char >= charCodeMap.zero && char <= charCodeMap.nine)
2547
- return char - charCodeMap.zero;
2548
- if (char >= charCodeMap.A && char <= charCodeMap.F)
2549
- return char - (charCodeMap.A - 10);
2550
- if (char >= charCodeMap.a && char <= charCodeMap.f)
2551
- return char - (charCodeMap.a - 10);
2552
- return;
2553
- }
2554
- function hexToBytes2(hex_, opts = {}) {
2555
- let hex = hex_;
2556
- if (opts.size) {
2557
- assertSize(hex, { size: opts.size });
2558
- hex = pad(hex, { dir: "right", size: opts.size });
2559
- }
2560
- let hexString = hex.slice(2);
2561
- if (hexString.length % 2)
2562
- hexString = `0${hexString}`;
2563
- const length = hexString.length / 2;
2564
- const bytes = new Uint8Array(length);
2565
- for (let index = 0, j = 0;index < length; index++) {
2566
- const nibbleLeft = charCodeToBase16(hexString.charCodeAt(j++));
2567
- const nibbleRight = charCodeToBase16(hexString.charCodeAt(j++));
2568
- if (nibbleLeft === undefined || nibbleRight === undefined) {
2569
- throw new BaseError(`Invalid byte sequence ("${hexString[j - 2]}${hexString[j - 1]}" in "${hexString}").`);
2570
- }
2571
- bytes[index] = nibbleLeft * 16 + nibbleRight;
2572
- }
2573
- return bytes;
2574
- }
2575
- function numberToBytes(value, opts) {
2576
- const hex = numberToHex(value, opts);
2577
- return hexToBytes2(hex);
2578
- }
2579
- function stringToBytes(value, opts = {}) {
2580
- const bytes = encoder.encode(value);
2581
- if (typeof opts.size === "number") {
2582
- assertSize(bytes, { size: opts.size });
2583
- return pad(bytes, { dir: "right", size: opts.size });
2584
- }
2585
- return bytes;
2586
- }
2587
- var encoder, charCodeMap;
2588
- var init_toBytes = __esm(() => {
2589
- init_base();
2590
- init_pad();
2591
- init_fromHex();
2592
- init_toHex();
2593
- encoder = /* @__PURE__ */ new TextEncoder;
2594
- charCodeMap = {
2595
- zero: 48,
2596
- nine: 57,
2597
- A: 65,
2598
- F: 70,
2599
- a: 97,
2600
- f: 102
2601
- };
2602
- });
2603
-
2604
- // ../../node_modules/viem/_esm/utils/encoding/fromHex.js
2605
- function assertSize(hexOrBytes, { size: size2 }) {
2606
- if (size(hexOrBytes) > size2)
2607
- throw new SizeOverflowError({
2608
- givenSize: size(hexOrBytes),
2609
- maxSize: size2
2610
- });
2611
- }
2612
- function hexToBigInt(hex, opts = {}) {
2613
- const { signed } = opts;
2614
- if (opts.size)
2615
- assertSize(hex, { size: opts.size });
2616
- const value = BigInt(hex);
2617
- if (!signed)
2618
- return value;
2619
- const size2 = (hex.length - 2) / 2;
2620
- const max = (1n << BigInt(size2) * 8n - 1n) - 1n;
2621
- if (value <= max)
2622
- return value;
2623
- return value - BigInt(`0x${"f".padStart(size2 * 2, "f")}`) - 1n;
2624
- }
2625
- function hexToNumber2(hex, opts = {}) {
2626
- return Number(hexToBigInt(hex, opts));
2627
- }
2628
- var init_fromHex = __esm(() => {
2629
- init_encoding();
2630
- init_size();
2631
- });
2632
-
2633
- // ../../node_modules/viem/_esm/utils/encoding/toHex.js
2634
- function toHex(value, opts = {}) {
2635
- if (typeof value === "number" || typeof value === "bigint")
2636
- return numberToHex(value, opts);
2637
- if (typeof value === "string") {
2638
- return stringToHex(value, opts);
2639
- }
2640
- if (typeof value === "boolean")
2641
- return boolToHex(value, opts);
2642
- return bytesToHex2(value, opts);
2643
- }
2644
- function boolToHex(value, opts = {}) {
2645
- const hex = `0x${Number(value)}`;
2646
- if (typeof opts.size === "number") {
2647
- assertSize(hex, { size: opts.size });
2648
- return pad(hex, { size: opts.size });
2649
- }
2650
- return hex;
2651
- }
2652
- function bytesToHex2(value, opts = {}) {
2653
- let string = "";
2654
- for (let i = 0;i < value.length; i++) {
2655
- string += hexes2[value[i]];
2656
- }
2657
- const hex = `0x${string}`;
2658
- if (typeof opts.size === "number") {
2659
- assertSize(hex, { size: opts.size });
2660
- return pad(hex, { dir: "right", size: opts.size });
2661
- }
2662
- return hex;
2663
- }
2664
- function numberToHex(value_, opts = {}) {
2665
- const { signed, size: size2 } = opts;
2666
- const value = BigInt(value_);
2667
- let maxValue;
2668
- if (size2) {
2669
- if (signed)
2670
- maxValue = (1n << BigInt(size2) * 8n - 1n) - 1n;
2671
- else
2672
- maxValue = 2n ** (BigInt(size2) * 8n) - 1n;
2673
- } else if (typeof value_ === "number") {
2674
- maxValue = BigInt(Number.MAX_SAFE_INTEGER);
2675
- }
2676
- const minValue = typeof maxValue === "bigint" && signed ? -maxValue - 1n : 0;
2677
- if (maxValue && value > maxValue || value < minValue) {
2678
- const suffix = typeof value_ === "bigint" ? "n" : "";
2679
- throw new IntegerOutOfRangeError({
2680
- max: maxValue ? `${maxValue}${suffix}` : undefined,
2681
- min: `${minValue}${suffix}`,
2682
- signed,
2683
- size: size2,
2684
- value: `${value_}${suffix}`
2685
- });
2686
- }
2687
- const hex = `0x${(signed && value < 0 ? (1n << BigInt(size2 * 8)) + BigInt(value) : value).toString(16)}`;
2688
- if (size2)
2689
- return pad(hex, { size: size2 });
2690
- return hex;
2691
- }
2692
- function stringToHex(value_, opts = {}) {
2693
- const value = encoder2.encode(value_);
2694
- return bytesToHex2(value, opts);
2695
- }
2696
- var hexes2, encoder2;
2697
- var init_toHex = __esm(() => {
2698
- init_encoding();
2699
- init_pad();
2700
- init_fromHex();
2701
- hexes2 = /* @__PURE__ */ Array.from({ length: 256 }, (_v, i) => i.toString(16).padStart(2, "0"));
2702
- encoder2 = /* @__PURE__ */ new TextEncoder;
2703
- });
2704
-
2705
2739
  // ../../node_modules/viem/_esm/errors/address.js
2706
2740
  var InvalidAddressError;
2707
2741
  var init_address = __esm(() => {
@@ -2719,40 +2753,6 @@ var init_address = __esm(() => {
2719
2753
  };
2720
2754
  });
2721
2755
 
2722
- // ../../node_modules/viem/_esm/utils/lru.js
2723
- var LruMap;
2724
- var init_lru = __esm(() => {
2725
- LruMap = class LruMap extends Map {
2726
- constructor(size2) {
2727
- super();
2728
- Object.defineProperty(this, "maxSize", {
2729
- enumerable: true,
2730
- configurable: true,
2731
- writable: true,
2732
- value: undefined
2733
- });
2734
- this.maxSize = size2;
2735
- }
2736
- get(key) {
2737
- const value = super.get(key);
2738
- if (super.has(key) && value !== undefined) {
2739
- this.delete(key);
2740
- super.set(key, value);
2741
- }
2742
- return value;
2743
- }
2744
- set(key, value) {
2745
- super.set(key, value);
2746
- if (this.maxSize && this.size > this.maxSize) {
2747
- const firstKey = this.keys().next().value;
2748
- if (firstKey)
2749
- this.delete(firstKey);
2750
- }
2751
- return this;
2752
- }
2753
- };
2754
- });
2755
-
2756
2756
  // ../../node_modules/@noble/hashes/esm/sha3.js
2757
2757
  function keccakP(s, rounds = 24) {
2758
2758
  const B = new Uint32Array(5 * 2);
@@ -3839,9 +3839,9 @@ function encodeBytes(value, { param }) {
3839
3839
  encoded: concat([padHex(numberToHex(bytesSize, { size: 32 })), value_])
3840
3840
  };
3841
3841
  }
3842
- if (bytesSize !== Number.parseInt(paramSize))
3842
+ if (bytesSize !== Number.parseInt(paramSize, 10))
3843
3843
  throw new AbiEncodingBytesSizeMismatchError({
3844
- expectedSize: Number.parseInt(paramSize),
3844
+ expectedSize: Number.parseInt(paramSize, 10),
3845
3845
  value
3846
3846
  });
3847
3847
  return { dynamic: false, encoded: padHex(value, { dir: "right" }) };
@@ -30602,6 +30602,24 @@ var import_dstack_sdk = __toESM(require_dist(), 1);
30602
30602
  import { logger, Service } from "@elizaos/core";
30603
30603
  import { z } from "zod";
30604
30604
 
30605
+ // ../../node_modules/viem/_esm/utils/signature/serializeSignature.js
30606
+ init_secp256k1();
30607
+ init_fromHex();
30608
+ init_toBytes();
30609
+ function serializeSignature({ r, s, to = "hex", v, yParity }) {
30610
+ const yParity_ = (() => {
30611
+ if (yParity === 0 || yParity === 1)
30612
+ return yParity;
30613
+ if (v && (v === 27n || v === 28n || v >= 35n))
30614
+ return v % 2n === 0n ? 1 : 0;
30615
+ throw new Error("Invalid `v` or `yParity` value");
30616
+ })();
30617
+ const signature = `0x${new secp256k1.Signature(hexToBigInt(r), hexToBigInt(s)).toCompactHex()}${yParity_ === 0 ? "1b" : "1c"}`;
30618
+ if (to === "hex")
30619
+ return signature;
30620
+ return hexToBytes(signature);
30621
+ }
30622
+
30605
30623
  // ../../node_modules/viem/_esm/accounts/privateKeyToAccount.js
30606
30624
  init_secp256k1();
30607
30625
  init_toHex();
@@ -30643,30 +30661,14 @@ function publicKeyToAddress(publicKey) {
30643
30661
 
30644
30662
  // ../../node_modules/viem/_esm/accounts/utils/sign.js
30645
30663
  init_secp256k1();
30646
- init_toHex();
30647
-
30648
- // ../../node_modules/viem/_esm/utils/signature/serializeSignature.js
30649
- init_secp256k1();
30650
- init_fromHex();
30651
30664
  init_toBytes();
30652
- function serializeSignature({ r, s, to = "hex", v, yParity }) {
30653
- const yParity_ = (() => {
30654
- if (yParity === 0 || yParity === 1)
30655
- return yParity;
30656
- if (v && (v === 27n || v === 28n || v >= 35n))
30657
- return v % 2n === 0n ? 1 : 0;
30658
- throw new Error("Invalid `v` or `yParity` value");
30659
- })();
30660
- const signature = `0x${new secp256k1.Signature(hexToBigInt(r), hexToBigInt(s)).toCompactHex()}${yParity_ === 0 ? "1b" : "1c"}`;
30661
- if (to === "hex")
30662
- return signature;
30663
- return hexToBytes2(signature);
30664
- }
30665
-
30666
- // ../../node_modules/viem/_esm/accounts/utils/sign.js
30665
+ init_toHex();
30667
30666
  var extraEntropy = false;
30668
30667
  async function sign({ hash, privateKey, to = "object" }) {
30669
- const { r, s, recovery } = secp256k1.sign(hash.slice(2), privateKey.slice(2), { lowS: true, extraEntropy });
30668
+ const { r, s, recovery } = secp256k1.sign(hash.slice(2), privateKey.slice(2), {
30669
+ lowS: true,
30670
+ extraEntropy: isHex(extraEntropy, { strict: false }) ? hexToBytes(extraEntropy) : extraEntropy
30671
+ });
30670
30672
  const signature = {
30671
30673
  r: numberToHex(r, { size: 32 }),
30672
30674
  s: numberToHex(s, { size: 32 }),
@@ -30694,7 +30696,7 @@ function toRlp(bytes, to = "hex") {
30694
30696
  const cursor = createCursor(new Uint8Array(encodable.length));
30695
30697
  encodable.encode(cursor);
30696
30698
  if (to === "hex")
30697
- return bytesToHex2(cursor.bytes);
30699
+ return bytesToHex(cursor.bytes);
30698
30700
  return cursor.bytes;
30699
30701
  }
30700
30702
  function getEncodable(bytes) {
@@ -30733,7 +30735,7 @@ function getEncodableList(list) {
30733
30735
  };
30734
30736
  }
30735
30737
  function getEncodableBytes(bytesOrHex) {
30736
- const bytes = typeof bytesOrHex === "string" ? hexToBytes2(bytesOrHex) : bytesOrHex;
30738
+ const bytes = typeof bytesOrHex === "string" ? hexToBytes(bytesOrHex) : bytesOrHex;
30737
30739
  const sizeOfBytesLength = getSizeOfLength(bytes.length);
30738
30740
  const length = (() => {
30739
30741
  if (bytes.length === 1 && bytes[0] < 128)
@@ -30791,7 +30793,7 @@ function hashAuthorization(parameters) {
30791
30793
  ])
30792
30794
  ]));
30793
30795
  if (to === "bytes")
30794
- return hexToBytes2(hash);
30796
+ return hexToBytes(hash);
30795
30797
  return hash;
30796
30798
  }
30797
30799
 
@@ -30830,7 +30832,7 @@ function toPrefixedMessage(message_) {
30830
30832
  return stringToHex(message_);
30831
30833
  if (typeof message_.raw === "string")
30832
30834
  return message_.raw;
30833
- return bytesToHex2(message_.raw);
30835
+ return bytesToHex(message_.raw);
30834
30836
  })();
30835
30837
  const prefix = stringToHex(`${presignMessagePrefix}${size(message)}`);
30836
30838
  return concat([prefix, message]);
@@ -30877,11 +30879,11 @@ init_toHex();
30877
30879
  function blobsToCommitments(parameters) {
30878
30880
  const { kzg } = parameters;
30879
30881
  const to = parameters.to ?? (typeof parameters.blobs[0] === "string" ? "hex" : "bytes");
30880
- const blobs = typeof parameters.blobs[0] === "string" ? parameters.blobs.map((x) => hexToBytes2(x)) : parameters.blobs;
30882
+ const blobs = typeof parameters.blobs[0] === "string" ? parameters.blobs.map((x) => hexToBytes(x)) : parameters.blobs;
30881
30883
  const commitments = [];
30882
30884
  for (const blob of blobs)
30883
30885
  commitments.push(Uint8Array.from(kzg.blobToKzgCommitment(blob)));
30884
- return to === "bytes" ? commitments : commitments.map((x) => bytesToHex2(x));
30886
+ return to === "bytes" ? commitments : commitments.map((x) => bytesToHex(x));
30885
30887
  }
30886
30888
 
30887
30889
  // ../../node_modules/viem/_esm/utils/blob/blobsToProofs.js
@@ -30890,15 +30892,15 @@ init_toHex();
30890
30892
  function blobsToProofs(parameters) {
30891
30893
  const { kzg } = parameters;
30892
30894
  const to = parameters.to ?? (typeof parameters.blobs[0] === "string" ? "hex" : "bytes");
30893
- const blobs = typeof parameters.blobs[0] === "string" ? parameters.blobs.map((x) => hexToBytes2(x)) : parameters.blobs;
30894
- const commitments = typeof parameters.commitments[0] === "string" ? parameters.commitments.map((x) => hexToBytes2(x)) : parameters.commitments;
30895
+ const blobs = typeof parameters.blobs[0] === "string" ? parameters.blobs.map((x) => hexToBytes(x)) : parameters.blobs;
30896
+ const commitments = typeof parameters.commitments[0] === "string" ? parameters.commitments.map((x) => hexToBytes(x)) : parameters.commitments;
30895
30897
  const proofs = [];
30896
30898
  for (let i = 0;i < blobs.length; i++) {
30897
30899
  const blob = blobs[i];
30898
30900
  const commitment = commitments[i];
30899
30901
  proofs.push(Uint8Array.from(kzg.computeBlobKzgProof(blob, commitment)));
30900
30902
  }
30901
- return to === "bytes" ? proofs : proofs.map((x) => bytesToHex2(x));
30903
+ return to === "bytes" ? proofs : proofs.map((x) => bytesToHex(x));
30902
30904
  }
30903
30905
 
30904
30906
  // ../../node_modules/viem/_esm/utils/blob/commitmentToVersionedHash.js
@@ -30925,7 +30927,7 @@ function commitmentToVersionedHash(parameters) {
30925
30927
  const to = parameters.to ?? (typeof commitment === "string" ? "hex" : "bytes");
30926
30928
  const versionedHash = sha2563(commitment, "bytes");
30927
30929
  versionedHash.set([version2], 0);
30928
- return to === "bytes" ? versionedHash : bytesToHex2(versionedHash);
30930
+ return to === "bytes" ? versionedHash : bytesToHex(versionedHash);
30929
30931
  }
30930
30932
 
30931
30933
  // ../../node_modules/viem/_esm/utils/blob/commitmentsToVersionedHashes.js
@@ -30999,7 +31001,7 @@ init_toBytes();
30999
31001
  init_toHex();
31000
31002
  function toBlobs(parameters) {
31001
31003
  const to = parameters.to ?? (typeof parameters.data === "string" ? "hex" : "bytes");
31002
- const data = typeof parameters.data === "string" ? hexToBytes2(parameters.data) : parameters.data;
31004
+ const data = typeof parameters.data === "string" ? hexToBytes(parameters.data) : parameters.data;
31003
31005
  const size_ = size(data);
31004
31006
  if (!size_)
31005
31007
  throw new EmptyBlobError;
@@ -31028,7 +31030,7 @@ function toBlobs(parameters) {
31028
31030
  }
31029
31031
  blobs.push(blob);
31030
31032
  }
31031
- return to === "bytes" ? blobs.map((x) => x.bytes) : blobs.map((x) => bytesToHex2(x.bytes));
31033
+ return to === "bytes" ? blobs.map((x) => x.bytes) : blobs.map((x) => bytesToHex(x.bytes));
31032
31034
  }
31033
31035
 
31034
31036
  // ../../node_modules/viem/_esm/utils/blob/toBlobSidecars.js
@@ -31081,7 +31083,7 @@ function assertTransactionEIP4844(transaction) {
31081
31083
  throw new EmptyBlobError;
31082
31084
  for (const hash of blobVersionedHashes) {
31083
31085
  const size_ = size(hash);
31084
- const version2 = hexToNumber2(slice(hash, 0, 1));
31086
+ const version2 = hexToNumber(slice(hash, 0, 1));
31085
31087
  if (size_ !== 32)
31086
31088
  throw new InvalidVersionedHashSizeError({ hash, size: size_ });
31087
31089
  if (version2 !== versionedHashVersionKzg)
@@ -31191,13 +31193,13 @@ function serializeTransactionEIP7702(transaction, signature) {
31191
31193
  return concatHex([
31192
31194
  "0x04",
31193
31195
  toRlp([
31194
- toHex(chainId),
31195
- nonce ? toHex(nonce) : "0x",
31196
- maxPriorityFeePerGas ? toHex(maxPriorityFeePerGas) : "0x",
31197
- maxFeePerGas ? toHex(maxFeePerGas) : "0x",
31198
- gas ? toHex(gas) : "0x",
31196
+ numberToHex(chainId),
31197
+ nonce ? numberToHex(nonce) : "0x",
31198
+ maxPriorityFeePerGas ? numberToHex(maxPriorityFeePerGas) : "0x",
31199
+ maxFeePerGas ? numberToHex(maxFeePerGas) : "0x",
31200
+ gas ? numberToHex(gas) : "0x",
31199
31201
  to ?? "0x",
31200
- value ? toHex(value) : "0x",
31202
+ value ? numberToHex(value) : "0x",
31201
31203
  data ?? "0x",
31202
31204
  serializedAccessList,
31203
31205
  serializedAuthorizationList,
@@ -31211,7 +31213,7 @@ function serializeTransactionEIP4844(transaction, signature) {
31211
31213
  let blobVersionedHashes = transaction.blobVersionedHashes;
31212
31214
  let sidecars = transaction.sidecars;
31213
31215
  if (transaction.blobs && (typeof blobVersionedHashes === "undefined" || typeof sidecars === "undefined")) {
31214
- const blobs2 = typeof transaction.blobs[0] === "string" ? transaction.blobs : transaction.blobs.map((x) => bytesToHex2(x));
31216
+ const blobs2 = typeof transaction.blobs[0] === "string" ? transaction.blobs : transaction.blobs.map((x) => bytesToHex(x));
31215
31217
  const kzg = transaction.kzg;
31216
31218
  const commitments2 = blobsToCommitments({
31217
31219
  blobs: blobs2,
@@ -31228,16 +31230,16 @@ function serializeTransactionEIP4844(transaction, signature) {
31228
31230
  }
31229
31231
  const serializedAccessList = serializeAccessList(accessList);
31230
31232
  const serializedTransaction = [
31231
- toHex(chainId),
31232
- nonce ? toHex(nonce) : "0x",
31233
- maxPriorityFeePerGas ? toHex(maxPriorityFeePerGas) : "0x",
31234
- maxFeePerGas ? toHex(maxFeePerGas) : "0x",
31235
- gas ? toHex(gas) : "0x",
31233
+ numberToHex(chainId),
31234
+ nonce ? numberToHex(nonce) : "0x",
31235
+ maxPriorityFeePerGas ? numberToHex(maxPriorityFeePerGas) : "0x",
31236
+ maxFeePerGas ? numberToHex(maxFeePerGas) : "0x",
31237
+ gas ? numberToHex(gas) : "0x",
31236
31238
  to ?? "0x",
31237
- value ? toHex(value) : "0x",
31239
+ value ? numberToHex(value) : "0x",
31238
31240
  data ?? "0x",
31239
31241
  serializedAccessList,
31240
- maxFeePerBlobGas ? toHex(maxFeePerBlobGas) : "0x",
31242
+ maxFeePerBlobGas ? numberToHex(maxFeePerBlobGas) : "0x",
31241
31243
  blobVersionedHashes ?? [],
31242
31244
  ...toYParitySignatureArray(transaction, signature)
31243
31245
  ];
@@ -31261,13 +31263,13 @@ function serializeTransactionEIP1559(transaction, signature) {
31261
31263
  assertTransactionEIP1559(transaction);
31262
31264
  const serializedAccessList = serializeAccessList(accessList);
31263
31265
  const serializedTransaction = [
31264
- toHex(chainId),
31265
- nonce ? toHex(nonce) : "0x",
31266
- maxPriorityFeePerGas ? toHex(maxPriorityFeePerGas) : "0x",
31267
- maxFeePerGas ? toHex(maxFeePerGas) : "0x",
31268
- gas ? toHex(gas) : "0x",
31266
+ numberToHex(chainId),
31267
+ nonce ? numberToHex(nonce) : "0x",
31268
+ maxPriorityFeePerGas ? numberToHex(maxPriorityFeePerGas) : "0x",
31269
+ maxFeePerGas ? numberToHex(maxFeePerGas) : "0x",
31270
+ gas ? numberToHex(gas) : "0x",
31269
31271
  to ?? "0x",
31270
- value ? toHex(value) : "0x",
31272
+ value ? numberToHex(value) : "0x",
31271
31273
  data ?? "0x",
31272
31274
  serializedAccessList,
31273
31275
  ...toYParitySignatureArray(transaction, signature)
@@ -31282,12 +31284,12 @@ function serializeTransactionEIP2930(transaction, signature) {
31282
31284
  assertTransactionEIP2930(transaction);
31283
31285
  const serializedAccessList = serializeAccessList(accessList);
31284
31286
  const serializedTransaction = [
31285
- toHex(chainId),
31286
- nonce ? toHex(nonce) : "0x",
31287
- gasPrice ? toHex(gasPrice) : "0x",
31288
- gas ? toHex(gas) : "0x",
31287
+ numberToHex(chainId),
31288
+ nonce ? numberToHex(nonce) : "0x",
31289
+ gasPrice ? numberToHex(gasPrice) : "0x",
31290
+ gas ? numberToHex(gas) : "0x",
31289
31291
  to ?? "0x",
31290
- value ? toHex(value) : "0x",
31292
+ value ? numberToHex(value) : "0x",
31291
31293
  data ?? "0x",
31292
31294
  serializedAccessList,
31293
31295
  ...toYParitySignatureArray(transaction, signature)
@@ -31301,11 +31303,11 @@ function serializeTransactionLegacy(transaction, signature) {
31301
31303
  const { chainId = 0, gas, data, nonce, to, value, gasPrice } = transaction;
31302
31304
  assertTransactionLegacy(transaction);
31303
31305
  let serializedTransaction = [
31304
- nonce ? toHex(nonce) : "0x",
31305
- gasPrice ? toHex(gasPrice) : "0x",
31306
- gas ? toHex(gas) : "0x",
31306
+ nonce ? numberToHex(nonce) : "0x",
31307
+ gasPrice ? numberToHex(gasPrice) : "0x",
31308
+ gas ? numberToHex(gas) : "0x",
31307
31309
  to ?? "0x",
31308
- value ? toHex(value) : "0x",
31310
+ value ? numberToHex(value) : "0x",
31309
31311
  data ?? "0x"
31310
31312
  ];
31311
31313
  if (signature) {
@@ -31327,14 +31329,14 @@ function serializeTransactionLegacy(transaction, signature) {
31327
31329
  const s = trim(signature.s);
31328
31330
  serializedTransaction = [
31329
31331
  ...serializedTransaction,
31330
- toHex(v),
31332
+ numberToHex(v),
31331
31333
  r === "0x00" ? "0x" : r,
31332
31334
  s === "0x00" ? "0x" : s
31333
31335
  ];
31334
31336
  } else if (chainId > 0) {
31335
31337
  serializedTransaction = [
31336
31338
  ...serializedTransaction,
31337
- toHex(chainId),
31339
+ numberToHex(chainId),
31338
31340
  "0x",
31339
31341
  "0x"
31340
31342
  ];
@@ -31354,12 +31356,12 @@ function toYParitySignatureArray(transaction, signature_) {
31354
31356
  const s = trim(signature.s);
31355
31357
  const yParity_ = (() => {
31356
31358
  if (typeof yParity === "number")
31357
- return yParity ? toHex(1) : "0x";
31359
+ return yParity ? numberToHex(1) : "0x";
31358
31360
  if (v === 0n)
31359
31361
  return "0x";
31360
31362
  if (v === 1n)
31361
- return toHex(1);
31362
- return v === 27n ? "0x" : toHex(1);
31363
+ return numberToHex(1);
31364
+ return v === 27n ? "0x" : numberToHex(1);
31363
31365
  })();
31364
31366
  return [yParity_, r === "0x00" ? "0x" : r, s === "0x00" ? "0x" : s];
31365
31367
  }
@@ -31376,10 +31378,10 @@ async function signTransaction(parameters) {
31376
31378
  return transaction;
31377
31379
  })();
31378
31380
  const signature = await sign({
31379
- hash: keccak256(serializer(signableTransaction)),
31381
+ hash: keccak256(await serializer(signableTransaction)),
31380
31382
  privateKey
31381
31383
  });
31382
- return serializer(transaction, signature);
31384
+ return await serializer(transaction, signature);
31383
31385
  }
31384
31386
 
31385
31387
  // ../../node_modules/viem/_esm/utils/signature/hashTypedData.js
@@ -31436,7 +31438,7 @@ function validateTypedData(parameters) {
31436
31438
  const [_type, base, size_] = integerMatch;
31437
31439
  numberToHex(value, {
31438
31440
  signed: base === "int",
31439
- size: Number.parseInt(size_) / 8
31441
+ size: Number.parseInt(size_, 10) / 8
31440
31442
  });
31441
31443
  }
31442
31444
  if (type === "address" && typeof value === "string" && !isAddress(value))
@@ -31444,9 +31446,9 @@ function validateTypedData(parameters) {
31444
31446
  const bytesMatch = type.match(bytesRegex);
31445
31447
  if (bytesMatch) {
31446
31448
  const [_type, size_] = bytesMatch;
31447
- if (size_ && size(value) !== Number.parseInt(size_))
31449
+ if (size_ && size(value) !== Number.parseInt(size_, 10))
31448
31450
  throw new BytesSizeMismatchError({
31449
- expectedSize: Number.parseInt(size_),
31451
+ expectedSize: Number.parseInt(size_, 10),
31450
31452
  givenSize: size(value)
31451
31453
  });
31452
31454
  }
@@ -31579,11 +31581,8 @@ function encodeField({ types, name, type, value }) {
31579
31581
  keccak256(encodeData({ data: value, primaryType: type, types }))
31580
31582
  ];
31581
31583
  }
31582
- if (type === "bytes") {
31583
- const prepend = value.length % 2 ? "0" : "";
31584
- value = `0x${prepend + value.slice(2)}`;
31584
+ if (type === "bytes")
31585
31585
  return [{ type: "bytes32" }, keccak256(value)];
31586
- }
31587
31586
  if (type === "string")
31588
31587
  return [{ type: "bytes32" }, keccak256(toHex(value))];
31589
31588
  if (type.lastIndexOf("]") === type.length - 1) {
@@ -33926,7 +33925,8 @@ var ConfirmedTransactionMetaResult = superstruct.type({
33926
33925
  preTokenBalances: superstruct.optional(superstruct.nullable(superstruct.array(TokenBalanceResult))),
33927
33926
  postTokenBalances: superstruct.optional(superstruct.nullable(superstruct.array(TokenBalanceResult))),
33928
33927
  loadedAddresses: superstruct.optional(LoadedAddressesResult),
33929
- computeUnitsConsumed: superstruct.optional(superstruct.number())
33928
+ computeUnitsConsumed: superstruct.optional(superstruct.number()),
33929
+ costUnits: superstruct.optional(superstruct.number())
33930
33930
  });
33931
33931
  var ParsedConfirmedTransactionMetaResult = superstruct.type({
33932
33932
  err: TransactionErrorResult,
@@ -33941,7 +33941,8 @@ var ParsedConfirmedTransactionMetaResult = superstruct.type({
33941
33941
  preTokenBalances: superstruct.optional(superstruct.nullable(superstruct.array(TokenBalanceResult))),
33942
33942
  postTokenBalances: superstruct.optional(superstruct.nullable(superstruct.array(TokenBalanceResult))),
33943
33943
  loadedAddresses: superstruct.optional(LoadedAddressesResult),
33944
- computeUnitsConsumed: superstruct.optional(superstruct.number())
33944
+ computeUnitsConsumed: superstruct.optional(superstruct.number()),
33945
+ costUnits: superstruct.optional(superstruct.number())
33945
33946
  });
33946
33947
  var TransactionVersionStruct = superstruct.union([superstruct.literal(0), superstruct.literal("legacy")]);
33947
33948
  var RewardsResult = superstruct.type({
@@ -35666,5 +35667,5 @@ export {
35666
35667
  StarterService
35667
35668
  };
35668
35669
 
35669
- //# debugId=2092273E809F18B964756E2164756E21
35670
+ //# debugId=F087CF71CDF4560E64756E2164756E21
35670
35671
  //# sourceMappingURL=index.js.map