@inco/js 0.1.21 → 0.1.22

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
@@ -188,9 +188,14 @@ var init_abi = __esm(() => {
188
188
  });
189
189
 
190
190
  // node_modules/viem/_esm/errors/data.js
191
- var SizeExceedsPaddingSizeError;
191
+ var SliceOffsetOutOfBoundsError, SizeExceedsPaddingSizeError;
192
192
  var init_data = __esm(() => {
193
193
  init_base();
194
+ SliceOffsetOutOfBoundsError = class SliceOffsetOutOfBoundsError extends BaseError {
195
+ constructor({ offset, position, size: size22 }) {
196
+ super(`Slice ${position === "start" ? "starting" : "ending"} at offset "${offset}" is out-of-bounds (size: ${size22}).`, { name: "SliceOffsetOutOfBoundsError" });
197
+ }
198
+ };
194
199
  SizeExceedsPaddingSizeError = class SizeExceedsPaddingSizeError extends BaseError {
195
200
  constructor({ size: size22, targetSize, type: type2 }) {
196
201
  super(`${type2.charAt(0).toUpperCase()}${type2.slice(1).toLowerCase()} size (${size22}) exceeds padding size (${targetSize}).`, { name: "SizeExceedsPaddingSizeError" });
@@ -252,6 +257,25 @@ var init_encoding = __esm(() => {
252
257
  };
253
258
  });
254
259
 
260
+ // node_modules/viem/_esm/utils/data/trim.js
261
+ function trim(hexOrBytes, { dir: dir2 = "left" } = {}) {
262
+ let data = typeof hexOrBytes === "string" ? hexOrBytes.replace("0x", "") : hexOrBytes;
263
+ let sliceLength = 0;
264
+ for (let i = 0;i < data.length - 1; i++) {
265
+ if (data[dir2 === "left" ? i : data.length - i - 1].toString() === "0")
266
+ sliceLength++;
267
+ else
268
+ break;
269
+ }
270
+ data = dir2 === "left" ? data.slice(sliceLength) : data.slice(0, data.length - sliceLength);
271
+ if (typeof hexOrBytes === "string") {
272
+ if (data.length === 1 && dir2 === "right")
273
+ data = `${data}0`;
274
+ return `0x${data.length % 2 === 1 ? `0${data}` : data}`;
275
+ }
276
+ return data;
277
+ }
278
+
255
279
  // node_modules/viem/_esm/utils/encoding/fromHex.js
256
280
  function assertSize(hexOrBytes, { size: size22 }) {
257
281
  if (size21(hexOrBytes) > size22)
@@ -260,6 +284,22 @@ function assertSize(hexOrBytes, { size: size22 }) {
260
284
  maxSize: size22
261
285
  });
262
286
  }
287
+ function hexToBigInt(hex, opts = {}) {
288
+ const { signed } = opts;
289
+ if (opts.size)
290
+ assertSize(hex, { size: opts.size });
291
+ const value6 = BigInt(hex);
292
+ if (!signed)
293
+ return value6;
294
+ const size22 = (hex.length - 2) / 2;
295
+ const max6 = (1n << BigInt(size22) * 8n - 1n) - 1n;
296
+ if (value6 <= max6)
297
+ return value6;
298
+ return value6 - BigInt(`0x${"f".padStart(size22 * 2, "f")}`) - 1n;
299
+ }
300
+ function hexToNumber(hex, opts = {}) {
301
+ return Number(hexToBigInt(hex, opts));
302
+ }
263
303
  var init_fromHex = __esm(() => {
264
304
  init_encoding();
265
305
  init_size();
@@ -470,6 +510,12 @@ var init__u64 = __esm(() => {
470
510
  function u32(arr) {
471
511
  return new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4));
472
512
  }
513
+ function createView(arr) {
514
+ return new DataView(arr.buffer, arr.byteOffset, arr.byteLength);
515
+ }
516
+ function rotr(word, shift2) {
517
+ return word << 32 - shift2 | word >>> shift2;
518
+ }
473
519
  function byteSwap(word) {
474
520
  return word << 24 & 4278190080 | word << 8 & 16711680 | word >>> 8 & 65280 | word >>> 24 & 255;
475
521
  }
@@ -828,6 +874,52 @@ function concatHex(values7) {
828
874
  return `0x${values7.reduce((acc, x) => acc + x.replace("0x", ""), "")}`;
829
875
  }
830
876
 
877
+ // node_modules/viem/_esm/utils/data/slice.js
878
+ function slice(value6, start5, end6, { strict: strict2 } = {}) {
879
+ if (isHex(value6, { strict: false }))
880
+ return sliceHex(value6, start5, end6, {
881
+ strict: strict2
882
+ });
883
+ return sliceBytes(value6, start5, end6, {
884
+ strict: strict2
885
+ });
886
+ }
887
+ function assertStartOffset(value6, start5) {
888
+ if (typeof start5 === "number" && start5 > 0 && start5 > size21(value6) - 1)
889
+ throw new SliceOffsetOutOfBoundsError({
890
+ offset: start5,
891
+ position: "start",
892
+ size: size21(value6)
893
+ });
894
+ }
895
+ function assertEndOffset(value6, start5, end6) {
896
+ if (typeof start5 === "number" && typeof end6 === "number" && size21(value6) !== end6 - start5) {
897
+ throw new SliceOffsetOutOfBoundsError({
898
+ offset: end6,
899
+ position: "end",
900
+ size: size21(value6)
901
+ });
902
+ }
903
+ }
904
+ function sliceBytes(value_, start5, end6, { strict: strict2 } = {}) {
905
+ assertStartOffset(value_, start5);
906
+ const value6 = value_.slice(start5, end6);
907
+ if (strict2)
908
+ assertEndOffset(value6, start5, end6);
909
+ return value6;
910
+ }
911
+ function sliceHex(value_, start5, end6, { strict: strict2 } = {}) {
912
+ assertStartOffset(value_, start5);
913
+ const value6 = `0x${value_.replace("0x", "").slice((start5 ?? 0) * 2, (end6 ?? value_.length) * 2)}`;
914
+ if (strict2)
915
+ assertEndOffset(value6, start5, end6);
916
+ return value6;
917
+ }
918
+ var init_slice = __esm(() => {
919
+ init_data();
920
+ init_size();
921
+ });
922
+
831
923
  // node_modules/viem/_esm/utils/regex.js
832
924
  var arrayRegex, bytesRegex, integerRegex;
833
925
  var init_regex = __esm(() => {
@@ -836,6 +928,861 @@ var init_regex = __esm(() => {
836
928
  integerRegex = /^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/;
837
929
  });
838
930
 
931
+ // node_modules/viem/_esm/errors/cursor.js
932
+ var NegativeOffsetError, PositionOutOfBoundsError, RecursiveReadLimitExceededError;
933
+ var init_cursor = __esm(() => {
934
+ init_base();
935
+ NegativeOffsetError = class NegativeOffsetError extends BaseError {
936
+ constructor({ offset }) {
937
+ super(`Offset \`${offset}\` cannot be negative.`, {
938
+ name: "NegativeOffsetError"
939
+ });
940
+ }
941
+ };
942
+ PositionOutOfBoundsError = class PositionOutOfBoundsError extends BaseError {
943
+ constructor({ length: length4, position }) {
944
+ super(`Position \`${position}\` is out of bounds (\`0 < position < ${length4}\`).`, { name: "PositionOutOfBoundsError" });
945
+ }
946
+ };
947
+ RecursiveReadLimitExceededError = class RecursiveReadLimitExceededError extends BaseError {
948
+ constructor({ count: count5, limit }) {
949
+ super(`Recursive read limit of \`${limit}\` exceeded (recursive read count: \`${count5}\`).`, { name: "RecursiveReadLimitExceededError" });
950
+ }
951
+ };
952
+ });
953
+
954
+ // node_modules/viem/_esm/utils/cursor.js
955
+ function createCursor(bytes, { recursiveReadLimit = 8192 } = {}) {
956
+ const cursor = Object.create(staticCursor);
957
+ cursor.bytes = bytes;
958
+ cursor.dataView = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
959
+ cursor.positionReadCount = new Map;
960
+ cursor.recursiveReadLimit = recursiveReadLimit;
961
+ return cursor;
962
+ }
963
+ var staticCursor;
964
+ var init_cursor2 = __esm(() => {
965
+ init_cursor();
966
+ staticCursor = {
967
+ bytes: new Uint8Array,
968
+ dataView: new DataView(new ArrayBuffer(0)),
969
+ position: 0,
970
+ positionReadCount: new Map,
971
+ recursiveReadCount: 0,
972
+ recursiveReadLimit: Number.POSITIVE_INFINITY,
973
+ assertReadLimit() {
974
+ if (this.recursiveReadCount >= this.recursiveReadLimit)
975
+ throw new RecursiveReadLimitExceededError({
976
+ count: this.recursiveReadCount + 1,
977
+ limit: this.recursiveReadLimit
978
+ });
979
+ },
980
+ assertPosition(position) {
981
+ if (position < 0 || position > this.bytes.length - 1)
982
+ throw new PositionOutOfBoundsError({
983
+ length: this.bytes.length,
984
+ position
985
+ });
986
+ },
987
+ decrementPosition(offset) {
988
+ if (offset < 0)
989
+ throw new NegativeOffsetError({ offset });
990
+ const position = this.position - offset;
991
+ this.assertPosition(position);
992
+ this.position = position;
993
+ },
994
+ getReadCount(position) {
995
+ return this.positionReadCount.get(position || this.position) || 0;
996
+ },
997
+ incrementPosition(offset) {
998
+ if (offset < 0)
999
+ throw new NegativeOffsetError({ offset });
1000
+ const position = this.position + offset;
1001
+ this.assertPosition(position);
1002
+ this.position = position;
1003
+ },
1004
+ inspectByte(position_) {
1005
+ const position = position_ ?? this.position;
1006
+ this.assertPosition(position);
1007
+ return this.bytes[position];
1008
+ },
1009
+ inspectBytes(length4, position_) {
1010
+ const position = position_ ?? this.position;
1011
+ this.assertPosition(position + length4 - 1);
1012
+ return this.bytes.subarray(position, position + length4);
1013
+ },
1014
+ inspectUint8(position_) {
1015
+ const position = position_ ?? this.position;
1016
+ this.assertPosition(position);
1017
+ return this.bytes[position];
1018
+ },
1019
+ inspectUint16(position_) {
1020
+ const position = position_ ?? this.position;
1021
+ this.assertPosition(position + 1);
1022
+ return this.dataView.getUint16(position);
1023
+ },
1024
+ inspectUint24(position_) {
1025
+ const position = position_ ?? this.position;
1026
+ this.assertPosition(position + 2);
1027
+ return (this.dataView.getUint16(position) << 8) + this.dataView.getUint8(position + 2);
1028
+ },
1029
+ inspectUint32(position_) {
1030
+ const position = position_ ?? this.position;
1031
+ this.assertPosition(position + 3);
1032
+ return this.dataView.getUint32(position);
1033
+ },
1034
+ pushByte(byte) {
1035
+ this.assertPosition(this.position);
1036
+ this.bytes[this.position] = byte;
1037
+ this.position++;
1038
+ },
1039
+ pushBytes(bytes) {
1040
+ this.assertPosition(this.position + bytes.length - 1);
1041
+ this.bytes.set(bytes, this.position);
1042
+ this.position += bytes.length;
1043
+ },
1044
+ pushUint8(value6) {
1045
+ this.assertPosition(this.position);
1046
+ this.bytes[this.position] = value6;
1047
+ this.position++;
1048
+ },
1049
+ pushUint16(value6) {
1050
+ this.assertPosition(this.position + 1);
1051
+ this.dataView.setUint16(this.position, value6);
1052
+ this.position += 2;
1053
+ },
1054
+ pushUint24(value6) {
1055
+ this.assertPosition(this.position + 2);
1056
+ this.dataView.setUint16(this.position, value6 >> 8);
1057
+ this.dataView.setUint8(this.position + 2, value6 & ~4294967040);
1058
+ this.position += 3;
1059
+ },
1060
+ pushUint32(value6) {
1061
+ this.assertPosition(this.position + 3);
1062
+ this.dataView.setUint32(this.position, value6);
1063
+ this.position += 4;
1064
+ },
1065
+ readByte() {
1066
+ this.assertReadLimit();
1067
+ this._touch();
1068
+ const value6 = this.inspectByte();
1069
+ this.position++;
1070
+ return value6;
1071
+ },
1072
+ readBytes(length4, size22) {
1073
+ this.assertReadLimit();
1074
+ this._touch();
1075
+ const value6 = this.inspectBytes(length4);
1076
+ this.position += size22 ?? length4;
1077
+ return value6;
1078
+ },
1079
+ readUint8() {
1080
+ this.assertReadLimit();
1081
+ this._touch();
1082
+ const value6 = this.inspectUint8();
1083
+ this.position += 1;
1084
+ return value6;
1085
+ },
1086
+ readUint16() {
1087
+ this.assertReadLimit();
1088
+ this._touch();
1089
+ const value6 = this.inspectUint16();
1090
+ this.position += 2;
1091
+ return value6;
1092
+ },
1093
+ readUint24() {
1094
+ this.assertReadLimit();
1095
+ this._touch();
1096
+ const value6 = this.inspectUint24();
1097
+ this.position += 3;
1098
+ return value6;
1099
+ },
1100
+ readUint32() {
1101
+ this.assertReadLimit();
1102
+ this._touch();
1103
+ const value6 = this.inspectUint32();
1104
+ this.position += 4;
1105
+ return value6;
1106
+ },
1107
+ get remaining() {
1108
+ return this.bytes.length - this.position;
1109
+ },
1110
+ setPosition(position) {
1111
+ const oldPosition = this.position;
1112
+ this.assertPosition(position);
1113
+ this.position = position;
1114
+ return () => this.position = oldPosition;
1115
+ },
1116
+ _touch() {
1117
+ if (this.recursiveReadLimit === Number.POSITIVE_INFINITY)
1118
+ return;
1119
+ const count5 = this.getReadCount();
1120
+ this.positionReadCount.set(this.position, count5 + 1);
1121
+ if (count5 > 0)
1122
+ this.recursiveReadCount++;
1123
+ }
1124
+ };
1125
+ });
1126
+
1127
+ // node_modules/viem/_esm/constants/unit.js
1128
+ var gweiUnits;
1129
+ var init_unit = __esm(() => {
1130
+ gweiUnits = {
1131
+ ether: -9,
1132
+ wei: 9
1133
+ };
1134
+ });
1135
+
1136
+ // node_modules/viem/_esm/utils/unit/formatUnits.js
1137
+ function formatUnits(value6, decimals) {
1138
+ let display = value6.toString();
1139
+ const negative2 = display.startsWith("-");
1140
+ if (negative2)
1141
+ display = display.slice(1);
1142
+ display = display.padStart(decimals, "0");
1143
+ let [integer3, fraction] = [
1144
+ display.slice(0, display.length - decimals),
1145
+ display.slice(display.length - decimals)
1146
+ ];
1147
+ fraction = fraction.replace(/(0+)$/, "");
1148
+ return `${negative2 ? "-" : ""}${integer3 || "0"}${fraction ? `.${fraction}` : ""}`;
1149
+ }
1150
+
1151
+ // node_modules/viem/_esm/utils/unit/formatGwei.js
1152
+ function formatGwei(wei, unit = "wei") {
1153
+ return formatUnits(wei, gweiUnits[unit]);
1154
+ }
1155
+ var init_formatGwei = __esm(() => {
1156
+ init_unit();
1157
+ });
1158
+
1159
+ // node_modules/viem/_esm/errors/transaction.js
1160
+ function prettyPrint(args2) {
1161
+ const entries3 = Object.entries(args2).map(([key, value6]) => {
1162
+ if (value6 === undefined || value6 === false)
1163
+ return null;
1164
+ return [key, value6];
1165
+ }).filter(Boolean);
1166
+ const maxLength2 = entries3.reduce((acc, [key]) => Math.max(acc, key.length), 0);
1167
+ return entries3.map(([key, value6]) => ` ${`${key}:`.padEnd(maxLength2 + 1)} ${value6}`).join(`
1168
+ `);
1169
+ }
1170
+ var InvalidLegacyVError, InvalidSerializableTransactionError, InvalidStorageKeySizeError;
1171
+ var init_transaction = __esm(() => {
1172
+ init_base();
1173
+ InvalidLegacyVError = class InvalidLegacyVError extends BaseError {
1174
+ constructor({ v }) {
1175
+ super(`Invalid \`v\` value "${v}". Expected 27 or 28.`, {
1176
+ name: "InvalidLegacyVError"
1177
+ });
1178
+ }
1179
+ };
1180
+ InvalidSerializableTransactionError = class InvalidSerializableTransactionError extends BaseError {
1181
+ constructor({ transaction }) {
1182
+ super("Cannot infer a transaction type from provided transaction.", {
1183
+ metaMessages: [
1184
+ "Provided Transaction:",
1185
+ "{",
1186
+ prettyPrint(transaction),
1187
+ "}",
1188
+ "",
1189
+ "To infer the type, either provide:",
1190
+ "- a `type` to the Transaction, or",
1191
+ "- an EIP-1559 Transaction with `maxFeePerGas`, or",
1192
+ "- an EIP-2930 Transaction with `gasPrice` & `accessList`, or",
1193
+ "- an EIP-4844 Transaction with `blobs`, `blobVersionedHashes`, `sidecars`, or",
1194
+ "- an EIP-7702 Transaction with `authorizationList`, or",
1195
+ "- a Legacy Transaction with `gasPrice`"
1196
+ ],
1197
+ name: "InvalidSerializableTransactionError"
1198
+ });
1199
+ }
1200
+ };
1201
+ InvalidStorageKeySizeError = class InvalidStorageKeySizeError extends BaseError {
1202
+ constructor({ storageKey }) {
1203
+ super(`Size for storage key "${storageKey}" is invalid. Expected 32 bytes. Got ${Math.floor((storageKey.length - 2) / 2)} bytes.`, { name: "InvalidStorageKeySizeError" });
1204
+ }
1205
+ };
1206
+ });
1207
+
1208
+ // node_modules/viem/_esm/errors/node.js
1209
+ var ExecutionRevertedError, FeeCapTooHighError, FeeCapTooLowError, NonceTooHighError, NonceTooLowError, NonceMaxValueError, InsufficientFundsError, IntrinsicGasTooHighError, IntrinsicGasTooLowError, TransactionTypeNotSupportedError, TipAboveFeeCapError;
1210
+ var init_node = __esm(() => {
1211
+ init_formatGwei();
1212
+ init_base();
1213
+ ExecutionRevertedError = class ExecutionRevertedError extends BaseError {
1214
+ constructor({ cause: cause2, message } = {}) {
1215
+ const reason = message?.replace("execution reverted: ", "")?.replace("execution reverted", "");
1216
+ super(`Execution reverted ${reason ? `with reason: ${reason}` : "for an unknown reason"}.`, {
1217
+ cause: cause2,
1218
+ name: "ExecutionRevertedError"
1219
+ });
1220
+ }
1221
+ };
1222
+ Object.defineProperty(ExecutionRevertedError, "code", {
1223
+ enumerable: true,
1224
+ configurable: true,
1225
+ writable: true,
1226
+ value: 3
1227
+ });
1228
+ Object.defineProperty(ExecutionRevertedError, "nodeMessage", {
1229
+ enumerable: true,
1230
+ configurable: true,
1231
+ writable: true,
1232
+ value: /execution reverted/
1233
+ });
1234
+ FeeCapTooHighError = class FeeCapTooHighError extends BaseError {
1235
+ constructor({ cause: cause2, maxFeePerGas } = {}) {
1236
+ super(`The fee cap (\`maxFeePerGas\`${maxFeePerGas ? ` = ${formatGwei(maxFeePerGas)} gwei` : ""}) cannot be higher than the maximum allowed value (2^256-1).`, {
1237
+ cause: cause2,
1238
+ name: "FeeCapTooHighError"
1239
+ });
1240
+ }
1241
+ };
1242
+ Object.defineProperty(FeeCapTooHighError, "nodeMessage", {
1243
+ enumerable: true,
1244
+ configurable: true,
1245
+ writable: true,
1246
+ value: /max fee per gas higher than 2\^256-1|fee cap higher than 2\^256-1/
1247
+ });
1248
+ FeeCapTooLowError = class FeeCapTooLowError extends BaseError {
1249
+ constructor({ cause: cause2, maxFeePerGas } = {}) {
1250
+ super(`The fee cap (\`maxFeePerGas\`${maxFeePerGas ? ` = ${formatGwei(maxFeePerGas)}` : ""} gwei) cannot be lower than the block base fee.`, {
1251
+ cause: cause2,
1252
+ name: "FeeCapTooLowError"
1253
+ });
1254
+ }
1255
+ };
1256
+ Object.defineProperty(FeeCapTooLowError, "nodeMessage", {
1257
+ enumerable: true,
1258
+ configurable: true,
1259
+ writable: true,
1260
+ value: /max fee per gas less than block base fee|fee cap less than block base fee|transaction is outdated/
1261
+ });
1262
+ NonceTooHighError = class NonceTooHighError extends BaseError {
1263
+ constructor({ cause: cause2, nonce } = {}) {
1264
+ super(`Nonce provided for the transaction ${nonce ? `(${nonce}) ` : ""}is higher than the next one expected.`, { cause: cause2, name: "NonceTooHighError" });
1265
+ }
1266
+ };
1267
+ Object.defineProperty(NonceTooHighError, "nodeMessage", {
1268
+ enumerable: true,
1269
+ configurable: true,
1270
+ writable: true,
1271
+ value: /nonce too high/
1272
+ });
1273
+ NonceTooLowError = class NonceTooLowError extends BaseError {
1274
+ constructor({ cause: cause2, nonce } = {}) {
1275
+ super([
1276
+ `Nonce provided for the transaction ${nonce ? `(${nonce}) ` : ""}is lower than the current nonce of the account.`,
1277
+ "Try increasing the nonce or find the latest nonce with `getTransactionCount`."
1278
+ ].join(`
1279
+ `), { cause: cause2, name: "NonceTooLowError" });
1280
+ }
1281
+ };
1282
+ Object.defineProperty(NonceTooLowError, "nodeMessage", {
1283
+ enumerable: true,
1284
+ configurable: true,
1285
+ writable: true,
1286
+ value: /nonce too low|transaction already imported|already known/
1287
+ });
1288
+ NonceMaxValueError = class NonceMaxValueError extends BaseError {
1289
+ constructor({ cause: cause2, nonce } = {}) {
1290
+ super(`Nonce provided for the transaction ${nonce ? `(${nonce}) ` : ""}exceeds the maximum allowed nonce.`, { cause: cause2, name: "NonceMaxValueError" });
1291
+ }
1292
+ };
1293
+ Object.defineProperty(NonceMaxValueError, "nodeMessage", {
1294
+ enumerable: true,
1295
+ configurable: true,
1296
+ writable: true,
1297
+ value: /nonce has max value/
1298
+ });
1299
+ InsufficientFundsError = class InsufficientFundsError extends BaseError {
1300
+ constructor({ cause: cause2 } = {}) {
1301
+ super([
1302
+ "The total cost (gas * gas fee + value) of executing this transaction exceeds the balance of the account."
1303
+ ].join(`
1304
+ `), {
1305
+ cause: cause2,
1306
+ metaMessages: [
1307
+ "This error could arise when the account does not have enough funds to:",
1308
+ " - pay for the total gas fee,",
1309
+ " - pay for the value to send.",
1310
+ " ",
1311
+ "The cost of the transaction is calculated as `gas * gas fee + value`, where:",
1312
+ " - `gas` is the amount of gas needed for transaction to execute,",
1313
+ " - `gas fee` is the gas fee,",
1314
+ " - `value` is the amount of ether to send to the recipient."
1315
+ ],
1316
+ name: "InsufficientFundsError"
1317
+ });
1318
+ }
1319
+ };
1320
+ Object.defineProperty(InsufficientFundsError, "nodeMessage", {
1321
+ enumerable: true,
1322
+ configurable: true,
1323
+ writable: true,
1324
+ value: /insufficient funds|exceeds transaction sender account balance/
1325
+ });
1326
+ IntrinsicGasTooHighError = class IntrinsicGasTooHighError extends BaseError {
1327
+ constructor({ cause: cause2, gas } = {}) {
1328
+ super(`The amount of gas ${gas ? `(${gas}) ` : ""}provided for the transaction exceeds the limit allowed for the block.`, {
1329
+ cause: cause2,
1330
+ name: "IntrinsicGasTooHighError"
1331
+ });
1332
+ }
1333
+ };
1334
+ Object.defineProperty(IntrinsicGasTooHighError, "nodeMessage", {
1335
+ enumerable: true,
1336
+ configurable: true,
1337
+ writable: true,
1338
+ value: /intrinsic gas too high|gas limit reached/
1339
+ });
1340
+ IntrinsicGasTooLowError = class IntrinsicGasTooLowError extends BaseError {
1341
+ constructor({ cause: cause2, gas } = {}) {
1342
+ super(`The amount of gas ${gas ? `(${gas}) ` : ""}provided for the transaction is too low.`, {
1343
+ cause: cause2,
1344
+ name: "IntrinsicGasTooLowError"
1345
+ });
1346
+ }
1347
+ };
1348
+ Object.defineProperty(IntrinsicGasTooLowError, "nodeMessage", {
1349
+ enumerable: true,
1350
+ configurable: true,
1351
+ writable: true,
1352
+ value: /intrinsic gas too low/
1353
+ });
1354
+ TransactionTypeNotSupportedError = class TransactionTypeNotSupportedError extends BaseError {
1355
+ constructor({ cause: cause2 }) {
1356
+ super("The transaction type is not supported for this chain.", {
1357
+ cause: cause2,
1358
+ name: "TransactionTypeNotSupportedError"
1359
+ });
1360
+ }
1361
+ };
1362
+ Object.defineProperty(TransactionTypeNotSupportedError, "nodeMessage", {
1363
+ enumerable: true,
1364
+ configurable: true,
1365
+ writable: true,
1366
+ value: /transaction type not valid/
1367
+ });
1368
+ TipAboveFeeCapError = class TipAboveFeeCapError extends BaseError {
1369
+ constructor({ cause: cause2, maxPriorityFeePerGas, maxFeePerGas } = {}) {
1370
+ super([
1371
+ `The provided tip (\`maxPriorityFeePerGas\`${maxPriorityFeePerGas ? ` = ${formatGwei(maxPriorityFeePerGas)} gwei` : ""}) cannot be higher than the fee cap (\`maxFeePerGas\`${maxFeePerGas ? ` = ${formatGwei(maxFeePerGas)} gwei` : ""}).`
1372
+ ].join(`
1373
+ `), {
1374
+ cause: cause2,
1375
+ name: "TipAboveFeeCapError"
1376
+ });
1377
+ }
1378
+ };
1379
+ Object.defineProperty(TipAboveFeeCapError, "nodeMessage", {
1380
+ enumerable: true,
1381
+ configurable: true,
1382
+ writable: true,
1383
+ value: /max priority fee per gas higher than max fee per gas|tip higher than fee cap/
1384
+ });
1385
+ });
1386
+
1387
+ // node_modules/viem/_esm/utils/formatters/formatter.js
1388
+ function defineFormatter(type2, format7) {
1389
+ return ({ exclude: exclude3, format: overrides }) => {
1390
+ return {
1391
+ exclude: exclude3,
1392
+ format: (args2) => {
1393
+ const formatted = format7(args2);
1394
+ if (exclude3) {
1395
+ for (const key of exclude3) {
1396
+ delete formatted[key];
1397
+ }
1398
+ }
1399
+ return {
1400
+ ...formatted,
1401
+ ...overrides(args2)
1402
+ };
1403
+ },
1404
+ type: type2
1405
+ };
1406
+ };
1407
+ }
1408
+
1409
+ // node_modules/viem/_esm/constants/number.js
1410
+ var maxInt8, maxInt16, maxInt24, maxInt32, maxInt40, maxInt48, maxInt56, maxInt64, maxInt72, maxInt80, maxInt88, maxInt96, maxInt104, maxInt112, maxInt120, maxInt128, maxInt136, maxInt144, maxInt152, maxInt160, maxInt168, maxInt176, maxInt184, maxInt192, maxInt200, maxInt208, maxInt216, maxInt224, maxInt232, maxInt240, maxInt248, maxInt256, minInt8, minInt16, minInt24, minInt32, minInt40, minInt48, minInt56, minInt64, minInt72, minInt80, minInt88, minInt96, minInt104, minInt112, minInt120, minInt128, minInt136, minInt144, minInt152, minInt160, minInt168, minInt176, minInt184, minInt192, minInt200, minInt208, minInt216, minInt224, minInt232, minInt240, minInt248, minInt256, maxUint8, maxUint16, maxUint24, maxUint32, maxUint40, maxUint48, maxUint56, maxUint64, maxUint72, maxUint80, maxUint88, maxUint96, maxUint104, maxUint112, maxUint120, maxUint128, maxUint136, maxUint144, maxUint152, maxUint160, maxUint168, maxUint176, maxUint184, maxUint192, maxUint200, maxUint208, maxUint216, maxUint224, maxUint232, maxUint240, maxUint248, maxUint256;
1411
+ var init_number = __esm(() => {
1412
+ maxInt8 = 2n ** (8n - 1n) - 1n;
1413
+ maxInt16 = 2n ** (16n - 1n) - 1n;
1414
+ maxInt24 = 2n ** (24n - 1n) - 1n;
1415
+ maxInt32 = 2n ** (32n - 1n) - 1n;
1416
+ maxInt40 = 2n ** (40n - 1n) - 1n;
1417
+ maxInt48 = 2n ** (48n - 1n) - 1n;
1418
+ maxInt56 = 2n ** (56n - 1n) - 1n;
1419
+ maxInt64 = 2n ** (64n - 1n) - 1n;
1420
+ maxInt72 = 2n ** (72n - 1n) - 1n;
1421
+ maxInt80 = 2n ** (80n - 1n) - 1n;
1422
+ maxInt88 = 2n ** (88n - 1n) - 1n;
1423
+ maxInt96 = 2n ** (96n - 1n) - 1n;
1424
+ maxInt104 = 2n ** (104n - 1n) - 1n;
1425
+ maxInt112 = 2n ** (112n - 1n) - 1n;
1426
+ maxInt120 = 2n ** (120n - 1n) - 1n;
1427
+ maxInt128 = 2n ** (128n - 1n) - 1n;
1428
+ maxInt136 = 2n ** (136n - 1n) - 1n;
1429
+ maxInt144 = 2n ** (144n - 1n) - 1n;
1430
+ maxInt152 = 2n ** (152n - 1n) - 1n;
1431
+ maxInt160 = 2n ** (160n - 1n) - 1n;
1432
+ maxInt168 = 2n ** (168n - 1n) - 1n;
1433
+ maxInt176 = 2n ** (176n - 1n) - 1n;
1434
+ maxInt184 = 2n ** (184n - 1n) - 1n;
1435
+ maxInt192 = 2n ** (192n - 1n) - 1n;
1436
+ maxInt200 = 2n ** (200n - 1n) - 1n;
1437
+ maxInt208 = 2n ** (208n - 1n) - 1n;
1438
+ maxInt216 = 2n ** (216n - 1n) - 1n;
1439
+ maxInt224 = 2n ** (224n - 1n) - 1n;
1440
+ maxInt232 = 2n ** (232n - 1n) - 1n;
1441
+ maxInt240 = 2n ** (240n - 1n) - 1n;
1442
+ maxInt248 = 2n ** (248n - 1n) - 1n;
1443
+ maxInt256 = 2n ** (256n - 1n) - 1n;
1444
+ minInt8 = -(2n ** (8n - 1n));
1445
+ minInt16 = -(2n ** (16n - 1n));
1446
+ minInt24 = -(2n ** (24n - 1n));
1447
+ minInt32 = -(2n ** (32n - 1n));
1448
+ minInt40 = -(2n ** (40n - 1n));
1449
+ minInt48 = -(2n ** (48n - 1n));
1450
+ minInt56 = -(2n ** (56n - 1n));
1451
+ minInt64 = -(2n ** (64n - 1n));
1452
+ minInt72 = -(2n ** (72n - 1n));
1453
+ minInt80 = -(2n ** (80n - 1n));
1454
+ minInt88 = -(2n ** (88n - 1n));
1455
+ minInt96 = -(2n ** (96n - 1n));
1456
+ minInt104 = -(2n ** (104n - 1n));
1457
+ minInt112 = -(2n ** (112n - 1n));
1458
+ minInt120 = -(2n ** (120n - 1n));
1459
+ minInt128 = -(2n ** (128n - 1n));
1460
+ minInt136 = -(2n ** (136n - 1n));
1461
+ minInt144 = -(2n ** (144n - 1n));
1462
+ minInt152 = -(2n ** (152n - 1n));
1463
+ minInt160 = -(2n ** (160n - 1n));
1464
+ minInt168 = -(2n ** (168n - 1n));
1465
+ minInt176 = -(2n ** (176n - 1n));
1466
+ minInt184 = -(2n ** (184n - 1n));
1467
+ minInt192 = -(2n ** (192n - 1n));
1468
+ minInt200 = -(2n ** (200n - 1n));
1469
+ minInt208 = -(2n ** (208n - 1n));
1470
+ minInt216 = -(2n ** (216n - 1n));
1471
+ minInt224 = -(2n ** (224n - 1n));
1472
+ minInt232 = -(2n ** (232n - 1n));
1473
+ minInt240 = -(2n ** (240n - 1n));
1474
+ minInt248 = -(2n ** (248n - 1n));
1475
+ minInt256 = -(2n ** (256n - 1n));
1476
+ maxUint8 = 2n ** 8n - 1n;
1477
+ maxUint16 = 2n ** 16n - 1n;
1478
+ maxUint24 = 2n ** 24n - 1n;
1479
+ maxUint32 = 2n ** 32n - 1n;
1480
+ maxUint40 = 2n ** 40n - 1n;
1481
+ maxUint48 = 2n ** 48n - 1n;
1482
+ maxUint56 = 2n ** 56n - 1n;
1483
+ maxUint64 = 2n ** 64n - 1n;
1484
+ maxUint72 = 2n ** 72n - 1n;
1485
+ maxUint80 = 2n ** 80n - 1n;
1486
+ maxUint88 = 2n ** 88n - 1n;
1487
+ maxUint96 = 2n ** 96n - 1n;
1488
+ maxUint104 = 2n ** 104n - 1n;
1489
+ maxUint112 = 2n ** 112n - 1n;
1490
+ maxUint120 = 2n ** 120n - 1n;
1491
+ maxUint128 = 2n ** 128n - 1n;
1492
+ maxUint136 = 2n ** 136n - 1n;
1493
+ maxUint144 = 2n ** 144n - 1n;
1494
+ maxUint152 = 2n ** 152n - 1n;
1495
+ maxUint160 = 2n ** 160n - 1n;
1496
+ maxUint168 = 2n ** 168n - 1n;
1497
+ maxUint176 = 2n ** 176n - 1n;
1498
+ maxUint184 = 2n ** 184n - 1n;
1499
+ maxUint192 = 2n ** 192n - 1n;
1500
+ maxUint200 = 2n ** 200n - 1n;
1501
+ maxUint208 = 2n ** 208n - 1n;
1502
+ maxUint216 = 2n ** 216n - 1n;
1503
+ maxUint224 = 2n ** 224n - 1n;
1504
+ maxUint232 = 2n ** 232n - 1n;
1505
+ maxUint240 = 2n ** 240n - 1n;
1506
+ maxUint248 = 2n ** 248n - 1n;
1507
+ maxUint256 = 2n ** 256n - 1n;
1508
+ });
1509
+
1510
+ // ../node_modules/@noble/hashes/esm/_md.js
1511
+ function setBigUint64(view, byteOffset, value6, isLE2) {
1512
+ if (typeof view.setBigUint64 === "function")
1513
+ return view.setBigUint64(byteOffset, value6, isLE2);
1514
+ const _32n2 = BigInt(32);
1515
+ const _u32_max = BigInt(4294967295);
1516
+ const wh = Number(value6 >> _32n2 & _u32_max);
1517
+ const wl = Number(value6 & _u32_max);
1518
+ const h = isLE2 ? 4 : 0;
1519
+ const l = isLE2 ? 0 : 4;
1520
+ view.setUint32(byteOffset + h, wh, isLE2);
1521
+ view.setUint32(byteOffset + l, wl, isLE2);
1522
+ }
1523
+ function Chi(a, b, c) {
1524
+ return a & b ^ ~a & c;
1525
+ }
1526
+ function Maj(a, b, c) {
1527
+ return a & b ^ a & c ^ b & c;
1528
+ }
1529
+ var HashMD;
1530
+ var init__md = __esm(() => {
1531
+ init__assert();
1532
+ init_utils();
1533
+ HashMD = class HashMD extends Hash {
1534
+ constructor(blockLen, outputLen, padOffset, isLE2) {
1535
+ super();
1536
+ this.blockLen = blockLen;
1537
+ this.outputLen = outputLen;
1538
+ this.padOffset = padOffset;
1539
+ this.isLE = isLE2;
1540
+ this.finished = false;
1541
+ this.length = 0;
1542
+ this.pos = 0;
1543
+ this.destroyed = false;
1544
+ this.buffer = new Uint8Array(blockLen);
1545
+ this.view = createView(this.buffer);
1546
+ }
1547
+ update(data) {
1548
+ aexists(this);
1549
+ const { view, buffer: buffer3, blockLen } = this;
1550
+ data = toBytes2(data);
1551
+ const len = data.length;
1552
+ for (let pos = 0;pos < len; ) {
1553
+ const take10 = Math.min(blockLen - this.pos, len - pos);
1554
+ if (take10 === blockLen) {
1555
+ const dataView = createView(data);
1556
+ for (;blockLen <= len - pos; pos += blockLen)
1557
+ this.process(dataView, pos);
1558
+ continue;
1559
+ }
1560
+ buffer3.set(data.subarray(pos, pos + take10), this.pos);
1561
+ this.pos += take10;
1562
+ pos += take10;
1563
+ if (this.pos === blockLen) {
1564
+ this.process(view, 0);
1565
+ this.pos = 0;
1566
+ }
1567
+ }
1568
+ this.length += data.length;
1569
+ this.roundClean();
1570
+ return this;
1571
+ }
1572
+ digestInto(out) {
1573
+ aexists(this);
1574
+ aoutput(out, this);
1575
+ this.finished = true;
1576
+ const { buffer: buffer3, view, blockLen, isLE: isLE2 } = this;
1577
+ let { pos } = this;
1578
+ buffer3[pos++] = 128;
1579
+ this.buffer.subarray(pos).fill(0);
1580
+ if (this.padOffset > blockLen - pos) {
1581
+ this.process(view, 0);
1582
+ pos = 0;
1583
+ }
1584
+ for (let i = pos;i < blockLen; i++)
1585
+ buffer3[i] = 0;
1586
+ setBigUint64(view, blockLen - 8, BigInt(this.length * 8), isLE2);
1587
+ this.process(view, 0);
1588
+ const oview = createView(out);
1589
+ const len = this.outputLen;
1590
+ if (len % 4)
1591
+ throw new Error("_sha2: outputLen should be aligned to 32bit");
1592
+ const outLen = len / 4;
1593
+ const state = this.get();
1594
+ if (outLen > state.length)
1595
+ throw new Error("_sha2: outputLen bigger than state");
1596
+ for (let i = 0;i < outLen; i++)
1597
+ oview.setUint32(4 * i, state[i], isLE2);
1598
+ }
1599
+ digest() {
1600
+ const { buffer: buffer3, outputLen } = this;
1601
+ this.digestInto(buffer3);
1602
+ const res = buffer3.slice(0, outputLen);
1603
+ this.destroy();
1604
+ return res;
1605
+ }
1606
+ _cloneInto(to) {
1607
+ to || (to = new this.constructor);
1608
+ to.set(...this.get());
1609
+ const { blockLen, buffer: buffer3, length: length4, finished, destroyed, pos } = this;
1610
+ to.length = length4;
1611
+ to.pos = pos;
1612
+ to.finished = finished;
1613
+ to.destroyed = destroyed;
1614
+ if (length4 % blockLen)
1615
+ to.buffer.set(buffer3);
1616
+ return to;
1617
+ }
1618
+ };
1619
+ });
1620
+
1621
+ // ../node_modules/@noble/hashes/esm/sha256.js
1622
+ var SHA256_K, SHA256_IV, SHA256_W, SHA256, sha256;
1623
+ var init_sha256 = __esm(() => {
1624
+ init__md();
1625
+ init_utils();
1626
+ SHA256_K = /* @__PURE__ */ new Uint32Array([
1627
+ 1116352408,
1628
+ 1899447441,
1629
+ 3049323471,
1630
+ 3921009573,
1631
+ 961987163,
1632
+ 1508970993,
1633
+ 2453635748,
1634
+ 2870763221,
1635
+ 3624381080,
1636
+ 310598401,
1637
+ 607225278,
1638
+ 1426881987,
1639
+ 1925078388,
1640
+ 2162078206,
1641
+ 2614888103,
1642
+ 3248222580,
1643
+ 3835390401,
1644
+ 4022224774,
1645
+ 264347078,
1646
+ 604807628,
1647
+ 770255983,
1648
+ 1249150122,
1649
+ 1555081692,
1650
+ 1996064986,
1651
+ 2554220882,
1652
+ 2821834349,
1653
+ 2952996808,
1654
+ 3210313671,
1655
+ 3336571891,
1656
+ 3584528711,
1657
+ 113926993,
1658
+ 338241895,
1659
+ 666307205,
1660
+ 773529912,
1661
+ 1294757372,
1662
+ 1396182291,
1663
+ 1695183700,
1664
+ 1986661051,
1665
+ 2177026350,
1666
+ 2456956037,
1667
+ 2730485921,
1668
+ 2820302411,
1669
+ 3259730800,
1670
+ 3345764771,
1671
+ 3516065817,
1672
+ 3600352804,
1673
+ 4094571909,
1674
+ 275423344,
1675
+ 430227734,
1676
+ 506948616,
1677
+ 659060556,
1678
+ 883997877,
1679
+ 958139571,
1680
+ 1322822218,
1681
+ 1537002063,
1682
+ 1747873779,
1683
+ 1955562222,
1684
+ 2024104815,
1685
+ 2227730452,
1686
+ 2361852424,
1687
+ 2428436474,
1688
+ 2756734187,
1689
+ 3204031479,
1690
+ 3329325298
1691
+ ]);
1692
+ SHA256_IV = /* @__PURE__ */ new Uint32Array([
1693
+ 1779033703,
1694
+ 3144134277,
1695
+ 1013904242,
1696
+ 2773480762,
1697
+ 1359893119,
1698
+ 2600822924,
1699
+ 528734635,
1700
+ 1541459225
1701
+ ]);
1702
+ SHA256_W = /* @__PURE__ */ new Uint32Array(64);
1703
+ SHA256 = class SHA256 extends HashMD {
1704
+ constructor() {
1705
+ super(64, 32, 8, false);
1706
+ this.A = SHA256_IV[0] | 0;
1707
+ this.B = SHA256_IV[1] | 0;
1708
+ this.C = SHA256_IV[2] | 0;
1709
+ this.D = SHA256_IV[3] | 0;
1710
+ this.E = SHA256_IV[4] | 0;
1711
+ this.F = SHA256_IV[5] | 0;
1712
+ this.G = SHA256_IV[6] | 0;
1713
+ this.H = SHA256_IV[7] | 0;
1714
+ }
1715
+ get() {
1716
+ const { A, B, C, D, E, F, G, H } = this;
1717
+ return [A, B, C, D, E, F, G, H];
1718
+ }
1719
+ set(A, B, C, D, E, F, G, H) {
1720
+ this.A = A | 0;
1721
+ this.B = B | 0;
1722
+ this.C = C | 0;
1723
+ this.D = D | 0;
1724
+ this.E = E | 0;
1725
+ this.F = F | 0;
1726
+ this.G = G | 0;
1727
+ this.H = H | 0;
1728
+ }
1729
+ process(view, offset) {
1730
+ for (let i = 0;i < 16; i++, offset += 4)
1731
+ SHA256_W[i] = view.getUint32(offset, false);
1732
+ for (let i = 16;i < 64; i++) {
1733
+ const W15 = SHA256_W[i - 15];
1734
+ const W2 = SHA256_W[i - 2];
1735
+ const s0 = rotr(W15, 7) ^ rotr(W15, 18) ^ W15 >>> 3;
1736
+ const s1 = rotr(W2, 17) ^ rotr(W2, 19) ^ W2 >>> 10;
1737
+ SHA256_W[i] = s1 + SHA256_W[i - 7] + s0 + SHA256_W[i - 16] | 0;
1738
+ }
1739
+ let { A, B, C, D, E, F, G, H } = this;
1740
+ for (let i = 0;i < 64; i++) {
1741
+ const sigma1 = rotr(E, 6) ^ rotr(E, 11) ^ rotr(E, 25);
1742
+ const T1 = H + sigma1 + Chi(E, F, G) + SHA256_K[i] + SHA256_W[i] | 0;
1743
+ const sigma0 = rotr(A, 2) ^ rotr(A, 13) ^ rotr(A, 22);
1744
+ const T2 = sigma0 + Maj(A, B, C) | 0;
1745
+ H = G;
1746
+ G = F;
1747
+ F = E;
1748
+ E = D + T1 | 0;
1749
+ D = C;
1750
+ C = B;
1751
+ B = A;
1752
+ A = T1 + T2 | 0;
1753
+ }
1754
+ A = A + this.A | 0;
1755
+ B = B + this.B | 0;
1756
+ C = C + this.C | 0;
1757
+ D = D + this.D | 0;
1758
+ E = E + this.E | 0;
1759
+ F = F + this.F | 0;
1760
+ G = G + this.G | 0;
1761
+ H = H + this.H | 0;
1762
+ this.set(A, B, C, D, E, F, G, H);
1763
+ }
1764
+ roundClean() {
1765
+ SHA256_W.fill(0);
1766
+ }
1767
+ destroy() {
1768
+ this.set(0, 0, 0, 0, 0, 0, 0, 0);
1769
+ this.buffer.fill(0);
1770
+ }
1771
+ };
1772
+ sha256 = /* @__PURE__ */ wrapConstructor(() => new SHA256);
1773
+ });
1774
+
1775
+ // node_modules/viem/_esm/errors/chain.js
1776
+ var InvalidChainIdError;
1777
+ var init_chain = __esm(() => {
1778
+ init_base();
1779
+ InvalidChainIdError = class InvalidChainIdError extends BaseError {
1780
+ constructor({ chainId }) {
1781
+ super(typeof chainId === "number" ? `Chain ID "${chainId}" is invalid.` : "Chain ID is invalid.", { name: "InvalidChainIdError" });
1782
+ }
1783
+ };
1784
+ });
1785
+
839
1786
  // node:buffer
840
1787
  var exports_buffer = {};
841
1788
  __export(exports_buffer, {
@@ -23768,6 +24715,413 @@ class TrieIterator {
23768
24715
  }
23769
24716
  }
23770
24717
  var isTrie = (u) => hasProperty(u, TrieTypeId);
24718
+ // node_modules/viem/_esm/utils/encoding/toRlp.js
24719
+ init_base();
24720
+ init_cursor2();
24721
+ init_toBytes();
24722
+ init_toHex();
24723
+ function toRlp(bytes, to = "hex") {
24724
+ const encodable = getEncodable(bytes);
24725
+ const cursor = createCursor(new Uint8Array(encodable.length));
24726
+ encodable.encode(cursor);
24727
+ if (to === "hex")
24728
+ return bytesToHex2(cursor.bytes);
24729
+ return cursor.bytes;
24730
+ }
24731
+ function getEncodable(bytes) {
24732
+ if (Array.isArray(bytes))
24733
+ return getEncodableList(bytes.map((x) => getEncodable(x)));
24734
+ return getEncodableBytes(bytes);
24735
+ }
24736
+ function getEncodableList(list) {
24737
+ const bodyLength = list.reduce((acc, x) => acc + x.length, 0);
24738
+ const sizeOfBodyLength = getSizeOfLength(bodyLength);
24739
+ const length4 = (() => {
24740
+ if (bodyLength <= 55)
24741
+ return 1 + bodyLength;
24742
+ return 1 + sizeOfBodyLength + bodyLength;
24743
+ })();
24744
+ return {
24745
+ length: length4,
24746
+ encode(cursor) {
24747
+ if (bodyLength <= 55) {
24748
+ cursor.pushByte(192 + bodyLength);
24749
+ } else {
24750
+ cursor.pushByte(192 + 55 + sizeOfBodyLength);
24751
+ if (sizeOfBodyLength === 1)
24752
+ cursor.pushUint8(bodyLength);
24753
+ else if (sizeOfBodyLength === 2)
24754
+ cursor.pushUint16(bodyLength);
24755
+ else if (sizeOfBodyLength === 3)
24756
+ cursor.pushUint24(bodyLength);
24757
+ else
24758
+ cursor.pushUint32(bodyLength);
24759
+ }
24760
+ for (const { encode: encode6 } of list) {
24761
+ encode6(cursor);
24762
+ }
24763
+ }
24764
+ };
24765
+ }
24766
+ function getEncodableBytes(bytesOrHex) {
24767
+ const bytes = typeof bytesOrHex === "string" ? hexToBytes(bytesOrHex) : bytesOrHex;
24768
+ const sizeOfBytesLength = getSizeOfLength(bytes.length);
24769
+ const length4 = (() => {
24770
+ if (bytes.length === 1 && bytes[0] < 128)
24771
+ return 1;
24772
+ if (bytes.length <= 55)
24773
+ return 1 + bytes.length;
24774
+ return 1 + sizeOfBytesLength + bytes.length;
24775
+ })();
24776
+ return {
24777
+ length: length4,
24778
+ encode(cursor) {
24779
+ if (bytes.length === 1 && bytes[0] < 128) {
24780
+ cursor.pushBytes(bytes);
24781
+ } else if (bytes.length <= 55) {
24782
+ cursor.pushByte(128 + bytes.length);
24783
+ cursor.pushBytes(bytes);
24784
+ } else {
24785
+ cursor.pushByte(128 + 55 + sizeOfBytesLength);
24786
+ if (sizeOfBytesLength === 1)
24787
+ cursor.pushUint8(bytes.length);
24788
+ else if (sizeOfBytesLength === 2)
24789
+ cursor.pushUint16(bytes.length);
24790
+ else if (sizeOfBytesLength === 3)
24791
+ cursor.pushUint24(bytes.length);
24792
+ else
24793
+ cursor.pushUint32(bytes.length);
24794
+ cursor.pushBytes(bytes);
24795
+ }
24796
+ }
24797
+ };
24798
+ }
24799
+ function getSizeOfLength(length4) {
24800
+ if (length4 < 2 ** 8)
24801
+ return 1;
24802
+ if (length4 < 2 ** 16)
24803
+ return 2;
24804
+ if (length4 < 2 ** 24)
24805
+ return 3;
24806
+ if (length4 < 2 ** 32)
24807
+ return 4;
24808
+ throw new BaseError("Length is too large.");
24809
+ }
24810
+ // node_modules/viem/_esm/utils/formatters/transaction.js
24811
+ init_fromHex();
24812
+ var transactionType = {
24813
+ "0x0": "legacy",
24814
+ "0x1": "eip2930",
24815
+ "0x2": "eip1559",
24816
+ "0x3": "eip4844",
24817
+ "0x4": "eip7702"
24818
+ };
24819
+ function formatTransaction(transaction) {
24820
+ const transaction_ = {
24821
+ ...transaction,
24822
+ blockHash: transaction.blockHash ? transaction.blockHash : null,
24823
+ blockNumber: transaction.blockNumber ? BigInt(transaction.blockNumber) : null,
24824
+ chainId: transaction.chainId ? hexToNumber(transaction.chainId) : undefined,
24825
+ gas: transaction.gas ? BigInt(transaction.gas) : undefined,
24826
+ gasPrice: transaction.gasPrice ? BigInt(transaction.gasPrice) : undefined,
24827
+ maxFeePerBlobGas: transaction.maxFeePerBlobGas ? BigInt(transaction.maxFeePerBlobGas) : undefined,
24828
+ maxFeePerGas: transaction.maxFeePerGas ? BigInt(transaction.maxFeePerGas) : undefined,
24829
+ maxPriorityFeePerGas: transaction.maxPriorityFeePerGas ? BigInt(transaction.maxPriorityFeePerGas) : undefined,
24830
+ nonce: transaction.nonce ? hexToNumber(transaction.nonce) : undefined,
24831
+ to: transaction.to ? transaction.to : null,
24832
+ transactionIndex: transaction.transactionIndex ? Number(transaction.transactionIndex) : null,
24833
+ type: transaction.type ? transactionType[transaction.type] : undefined,
24834
+ typeHex: transaction.type ? transaction.type : undefined,
24835
+ value: transaction.value ? BigInt(transaction.value) : undefined,
24836
+ v: transaction.v ? BigInt(transaction.v) : undefined
24837
+ };
24838
+ if (transaction.authorizationList)
24839
+ transaction_.authorizationList = formatAuthorizationList(transaction.authorizationList);
24840
+ transaction_.yParity = (() => {
24841
+ if (transaction.yParity)
24842
+ return Number(transaction.yParity);
24843
+ if (typeof transaction_.v === "bigint") {
24844
+ if (transaction_.v === 0n || transaction_.v === 27n)
24845
+ return 0;
24846
+ if (transaction_.v === 1n || transaction_.v === 28n)
24847
+ return 1;
24848
+ if (transaction_.v >= 35n)
24849
+ return transaction_.v % 2n === 0n ? 1 : 0;
24850
+ }
24851
+ return;
24852
+ })();
24853
+ if (transaction_.type === "legacy") {
24854
+ delete transaction_.accessList;
24855
+ delete transaction_.maxFeePerBlobGas;
24856
+ delete transaction_.maxFeePerGas;
24857
+ delete transaction_.maxPriorityFeePerGas;
24858
+ delete transaction_.yParity;
24859
+ }
24860
+ if (transaction_.type === "eip2930") {
24861
+ delete transaction_.maxFeePerBlobGas;
24862
+ delete transaction_.maxFeePerGas;
24863
+ delete transaction_.maxPriorityFeePerGas;
24864
+ }
24865
+ if (transaction_.type === "eip1559") {
24866
+ delete transaction_.maxFeePerBlobGas;
24867
+ }
24868
+ return transaction_;
24869
+ }
24870
+ var defineTransaction = /* @__PURE__ */ defineFormatter("transaction", formatTransaction);
24871
+ function formatAuthorizationList(authorizationList) {
24872
+ return authorizationList.map((authorization) => ({
24873
+ contractAddress: authorization.address,
24874
+ chainId: Number(authorization.chainId),
24875
+ nonce: Number(authorization.nonce),
24876
+ r: authorization.r,
24877
+ s: authorization.s,
24878
+ yParity: Number(authorization.yParity)
24879
+ }));
24880
+ }
24881
+
24882
+ // node_modules/viem/_esm/utils/formatters/block.js
24883
+ function formatBlock(block) {
24884
+ const transactions = (block.transactions ?? []).map((transaction) => {
24885
+ if (typeof transaction === "string")
24886
+ return transaction;
24887
+ return formatTransaction(transaction);
24888
+ });
24889
+ return {
24890
+ ...block,
24891
+ baseFeePerGas: block.baseFeePerGas ? BigInt(block.baseFeePerGas) : null,
24892
+ blobGasUsed: block.blobGasUsed ? BigInt(block.blobGasUsed) : undefined,
24893
+ difficulty: block.difficulty ? BigInt(block.difficulty) : undefined,
24894
+ excessBlobGas: block.excessBlobGas ? BigInt(block.excessBlobGas) : undefined,
24895
+ gasLimit: block.gasLimit ? BigInt(block.gasLimit) : undefined,
24896
+ gasUsed: block.gasUsed ? BigInt(block.gasUsed) : undefined,
24897
+ hash: block.hash ? block.hash : null,
24898
+ logsBloom: block.logsBloom ? block.logsBloom : null,
24899
+ nonce: block.nonce ? block.nonce : null,
24900
+ number: block.number ? BigInt(block.number) : null,
24901
+ size: block.size ? BigInt(block.size) : undefined,
24902
+ timestamp: block.timestamp ? BigInt(block.timestamp) : undefined,
24903
+ transactions,
24904
+ totalDifficulty: block.totalDifficulty ? BigInt(block.totalDifficulty) : null
24905
+ };
24906
+ }
24907
+ var defineBlock = /* @__PURE__ */ defineFormatter("block", formatBlock);
24908
+
24909
+ // node_modules/viem/_esm/utils/blob/blobsToCommitments.js
24910
+ init_toBytes();
24911
+ init_toHex();
24912
+ function blobsToCommitments(parameters) {
24913
+ const { kzg } = parameters;
24914
+ const to = parameters.to ?? (typeof parameters.blobs[0] === "string" ? "hex" : "bytes");
24915
+ const blobs = typeof parameters.blobs[0] === "string" ? parameters.blobs.map((x) => hexToBytes(x)) : parameters.blobs;
24916
+ const commitments = [];
24917
+ for (const blob of blobs)
24918
+ commitments.push(Uint8Array.from(kzg.blobToKzgCommitment(blob)));
24919
+ return to === "bytes" ? commitments : commitments.map((x) => bytesToHex2(x));
24920
+ }
24921
+
24922
+ // node_modules/viem/_esm/utils/blob/blobsToProofs.js
24923
+ init_toBytes();
24924
+ init_toHex();
24925
+ function blobsToProofs(parameters) {
24926
+ const { kzg } = parameters;
24927
+ const to = parameters.to ?? (typeof parameters.blobs[0] === "string" ? "hex" : "bytes");
24928
+ const blobs = typeof parameters.blobs[0] === "string" ? parameters.blobs.map((x) => hexToBytes(x)) : parameters.blobs;
24929
+ const commitments = typeof parameters.commitments[0] === "string" ? parameters.commitments.map((x) => hexToBytes(x)) : parameters.commitments;
24930
+ const proofs = [];
24931
+ for (let i = 0;i < blobs.length; i++) {
24932
+ const blob = blobs[i];
24933
+ const commitment = commitments[i];
24934
+ proofs.push(Uint8Array.from(kzg.computeBlobKzgProof(blob, commitment)));
24935
+ }
24936
+ return to === "bytes" ? proofs : proofs.map((x) => bytesToHex2(x));
24937
+ }
24938
+
24939
+ // node_modules/viem/_esm/utils/blob/commitmentToVersionedHash.js
24940
+ init_toHex();
24941
+
24942
+ // node_modules/viem/_esm/utils/hash/sha256.js
24943
+ init_sha256();
24944
+ init_toBytes();
24945
+ init_toHex();
24946
+ function sha2562(value6, to_) {
24947
+ const to = to_ || "hex";
24948
+ const bytes = sha256(isHex(value6, { strict: false }) ? toBytes(value6) : value6);
24949
+ if (to === "bytes")
24950
+ return bytes;
24951
+ return toHex(bytes);
24952
+ }
24953
+
24954
+ // node_modules/viem/_esm/utils/blob/commitmentToVersionedHash.js
24955
+ function commitmentToVersionedHash(parameters) {
24956
+ const { commitment, version: version2 = 1 } = parameters;
24957
+ const to = parameters.to ?? (typeof commitment === "string" ? "hex" : "bytes");
24958
+ const versionedHash = sha2562(commitment, "bytes");
24959
+ versionedHash.set([version2], 0);
24960
+ return to === "bytes" ? versionedHash : bytesToHex2(versionedHash);
24961
+ }
24962
+
24963
+ // node_modules/viem/_esm/utils/blob/commitmentsToVersionedHashes.js
24964
+ function commitmentsToVersionedHashes(parameters) {
24965
+ const { commitments, version: version2 } = parameters;
24966
+ const to = parameters.to ?? (typeof commitments[0] === "string" ? "hex" : "bytes");
24967
+ const hashes = [];
24968
+ for (const commitment of commitments) {
24969
+ hashes.push(commitmentToVersionedHash({
24970
+ commitment,
24971
+ to,
24972
+ version: version2
24973
+ }));
24974
+ }
24975
+ return hashes;
24976
+ }
24977
+
24978
+ // node_modules/viem/_esm/constants/blob.js
24979
+ var blobsPerTransaction = 6;
24980
+ var bytesPerFieldElement = 32;
24981
+ var fieldElementsPerBlob = 4096;
24982
+ var bytesPerBlob = bytesPerFieldElement * fieldElementsPerBlob;
24983
+ var maxBytesPerTransaction = bytesPerBlob * blobsPerTransaction - 1 - 1 * fieldElementsPerBlob * blobsPerTransaction;
24984
+
24985
+ // node_modules/viem/_esm/constants/kzg.js
24986
+ var versionedHashVersionKzg = 1;
24987
+
24988
+ // node_modules/viem/_esm/errors/blob.js
24989
+ init_base();
24990
+
24991
+ class BlobSizeTooLargeError extends BaseError {
24992
+ constructor({ maxSize, size: size22 }) {
24993
+ super("Blob size is too large.", {
24994
+ metaMessages: [`Max: ${maxSize} bytes`, `Given: ${size22} bytes`],
24995
+ name: "BlobSizeTooLargeError"
24996
+ });
24997
+ }
24998
+ }
24999
+
25000
+ class EmptyBlobError extends BaseError {
25001
+ constructor() {
25002
+ super("Blob data must not be empty.", { name: "EmptyBlobError" });
25003
+ }
25004
+ }
25005
+
25006
+ class InvalidVersionedHashSizeError extends BaseError {
25007
+ constructor({ hash: hash2, size: size22 }) {
25008
+ super(`Versioned hash "${hash2}" size is invalid.`, {
25009
+ metaMessages: ["Expected: 32", `Received: ${size22}`],
25010
+ name: "InvalidVersionedHashSizeError"
25011
+ });
25012
+ }
25013
+ }
25014
+
25015
+ class InvalidVersionedHashVersionError extends BaseError {
25016
+ constructor({ hash: hash2, version: version2 }) {
25017
+ super(`Versioned hash "${hash2}" version is invalid.`, {
25018
+ metaMessages: [
25019
+ `Expected: ${versionedHashVersionKzg}`,
25020
+ `Received: ${version2}`
25021
+ ],
25022
+ name: "InvalidVersionedHashVersionError"
25023
+ });
25024
+ }
25025
+ }
25026
+
25027
+ // node_modules/viem/_esm/utils/blob/toBlobs.js
25028
+ init_cursor2();
25029
+ init_size();
25030
+ init_toBytes();
25031
+ init_toHex();
25032
+ function toBlobs(parameters) {
25033
+ const to = parameters.to ?? (typeof parameters.data === "string" ? "hex" : "bytes");
25034
+ const data = typeof parameters.data === "string" ? hexToBytes(parameters.data) : parameters.data;
25035
+ const size_ = size21(data);
25036
+ if (!size_)
25037
+ throw new EmptyBlobError;
25038
+ if (size_ > maxBytesPerTransaction)
25039
+ throw new BlobSizeTooLargeError({
25040
+ maxSize: maxBytesPerTransaction,
25041
+ size: size_
25042
+ });
25043
+ const blobs = [];
25044
+ let active2 = true;
25045
+ let position = 0;
25046
+ while (active2) {
25047
+ const blob = createCursor(new Uint8Array(bytesPerBlob));
25048
+ let size22 = 0;
25049
+ while (size22 < fieldElementsPerBlob) {
25050
+ const bytes = data.slice(position, position + (bytesPerFieldElement - 1));
25051
+ blob.pushByte(0);
25052
+ blob.pushBytes(bytes);
25053
+ if (bytes.length < 31) {
25054
+ blob.pushByte(128);
25055
+ active2 = false;
25056
+ break;
25057
+ }
25058
+ size22++;
25059
+ position += 31;
25060
+ }
25061
+ blobs.push(blob);
25062
+ }
25063
+ return to === "bytes" ? blobs.map((x) => x.bytes) : blobs.map((x) => bytesToHex2(x.bytes));
25064
+ }
25065
+
25066
+ // node_modules/viem/_esm/utils/blob/toBlobSidecars.js
25067
+ function toBlobSidecars(parameters) {
25068
+ const { data, kzg, to } = parameters;
25069
+ const blobs = parameters.blobs ?? toBlobs({ data, to });
25070
+ const commitments = parameters.commitments ?? blobsToCommitments({ blobs, kzg, to });
25071
+ const proofs = parameters.proofs ?? blobsToProofs({ blobs, commitments, kzg, to });
25072
+ const sidecars = [];
25073
+ for (let i = 0;i < blobs.length; i++)
25074
+ sidecars.push({
25075
+ blob: blobs[i],
25076
+ commitment: commitments[i],
25077
+ proof: proofs[i]
25078
+ });
25079
+ return sidecars;
25080
+ }
25081
+
25082
+ // node_modules/viem/_esm/utils/transaction/getTransactionType.js
25083
+ init_transaction();
25084
+ function getTransactionType(transaction) {
25085
+ if (transaction.type)
25086
+ return transaction.type;
25087
+ if (typeof transaction.authorizationList !== "undefined")
25088
+ return "eip7702";
25089
+ if (typeof transaction.blobs !== "undefined" || typeof transaction.blobVersionedHashes !== "undefined" || typeof transaction.maxFeePerBlobGas !== "undefined" || typeof transaction.sidecars !== "undefined")
25090
+ return "eip4844";
25091
+ if (typeof transaction.maxFeePerGas !== "undefined" || typeof transaction.maxPriorityFeePerGas !== "undefined") {
25092
+ return "eip1559";
25093
+ }
25094
+ if (typeof transaction.gasPrice !== "undefined") {
25095
+ if (typeof transaction.accessList !== "undefined")
25096
+ return "eip2930";
25097
+ return "legacy";
25098
+ }
25099
+ throw new InvalidSerializableTransactionError({ transaction });
25100
+ }
25101
+
25102
+ // node_modules/viem/_esm/utils/formatters/log.js
25103
+ function formatLog(log3, { args: args2, eventName } = {}) {
25104
+ return {
25105
+ ...log3,
25106
+ blockHash: log3.blockHash ? log3.blockHash : null,
25107
+ blockNumber: log3.blockNumber ? BigInt(log3.blockNumber) : null,
25108
+ logIndex: log3.logIndex ? Number(log3.logIndex) : null,
25109
+ transactionHash: log3.transactionHash ? log3.transactionHash : null,
25110
+ transactionIndex: log3.transactionIndex ? Number(log3.transactionIndex) : null,
25111
+ ...eventName ? { args: args2, eventName } : {}
25112
+ };
25113
+ }
25114
+
25115
+ // node_modules/viem/_esm/utils/chain/defineChain.js
25116
+ function defineChain(chain) {
25117
+ return {
25118
+ formatters: undefined,
25119
+ fees: undefined,
25120
+ serializers: undefined,
25121
+ ...chain
25122
+ };
25123
+ }
25124
+
23771
25125
  // node_modules/viem/_esm/utils/abi/encodePacked.js
23772
25126
  init_abi();
23773
25127
  init_address();
@@ -23837,6 +25191,349 @@ function encode6(type2, value6, isArray2 = false) {
23837
25191
  throw new UnsupportedPackedAbiType(type2);
23838
25192
  }
23839
25193
 
25194
+ // node_modules/viem/_esm/utils/formatters/transactionReceipt.js
25195
+ init_fromHex();
25196
+ var receiptStatuses = {
25197
+ "0x0": "reverted",
25198
+ "0x1": "success"
25199
+ };
25200
+ function formatTransactionReceipt(transactionReceipt) {
25201
+ const receipt = {
25202
+ ...transactionReceipt,
25203
+ blockNumber: transactionReceipt.blockNumber ? BigInt(transactionReceipt.blockNumber) : null,
25204
+ contractAddress: transactionReceipt.contractAddress ? transactionReceipt.contractAddress : null,
25205
+ cumulativeGasUsed: transactionReceipt.cumulativeGasUsed ? BigInt(transactionReceipt.cumulativeGasUsed) : null,
25206
+ effectiveGasPrice: transactionReceipt.effectiveGasPrice ? BigInt(transactionReceipt.effectiveGasPrice) : null,
25207
+ gasUsed: transactionReceipt.gasUsed ? BigInt(transactionReceipt.gasUsed) : null,
25208
+ logs: transactionReceipt.logs ? transactionReceipt.logs.map((log3) => formatLog(log3)) : null,
25209
+ to: transactionReceipt.to ? transactionReceipt.to : null,
25210
+ transactionIndex: transactionReceipt.transactionIndex ? hexToNumber(transactionReceipt.transactionIndex) : null,
25211
+ status: transactionReceipt.status ? receiptStatuses[transactionReceipt.status] : null,
25212
+ type: transactionReceipt.type ? transactionType[transactionReceipt.type] || transactionReceipt.type : null
25213
+ };
25214
+ if (transactionReceipt.blobGasPrice)
25215
+ receipt.blobGasPrice = BigInt(transactionReceipt.blobGasPrice);
25216
+ if (transactionReceipt.blobGasUsed)
25217
+ receipt.blobGasUsed = BigInt(transactionReceipt.blobGasUsed);
25218
+ return receipt;
25219
+ }
25220
+ var defineTransactionReceipt = /* @__PURE__ */ defineFormatter("transactionReceipt", formatTransactionReceipt);
25221
+
25222
+ // node_modules/viem/_esm/utils/transaction/assertTransaction.js
25223
+ init_number();
25224
+ init_address();
25225
+ init_base();
25226
+ init_chain();
25227
+ init_node();
25228
+ init_isAddress();
25229
+ init_size();
25230
+ init_slice();
25231
+ init_fromHex();
25232
+ function assertTransactionEIP7702(transaction) {
25233
+ const { authorizationList } = transaction;
25234
+ if (authorizationList) {
25235
+ for (const authorization of authorizationList) {
25236
+ const { contractAddress, chainId } = authorization;
25237
+ if (!isAddress(contractAddress))
25238
+ throw new InvalidAddressError({ address: contractAddress });
25239
+ if (chainId < 0)
25240
+ throw new InvalidChainIdError({ chainId });
25241
+ }
25242
+ }
25243
+ assertTransactionEIP1559(transaction);
25244
+ }
25245
+ function assertTransactionEIP4844(transaction) {
25246
+ const { blobVersionedHashes } = transaction;
25247
+ if (blobVersionedHashes) {
25248
+ if (blobVersionedHashes.length === 0)
25249
+ throw new EmptyBlobError;
25250
+ for (const hash2 of blobVersionedHashes) {
25251
+ const size_ = size21(hash2);
25252
+ const version2 = hexToNumber(slice(hash2, 0, 1));
25253
+ if (size_ !== 32)
25254
+ throw new InvalidVersionedHashSizeError({ hash: hash2, size: size_ });
25255
+ if (version2 !== versionedHashVersionKzg)
25256
+ throw new InvalidVersionedHashVersionError({
25257
+ hash: hash2,
25258
+ version: version2
25259
+ });
25260
+ }
25261
+ }
25262
+ assertTransactionEIP1559(transaction);
25263
+ }
25264
+ function assertTransactionEIP1559(transaction) {
25265
+ const { chainId, maxPriorityFeePerGas, maxFeePerGas, to } = transaction;
25266
+ if (chainId <= 0)
25267
+ throw new InvalidChainIdError({ chainId });
25268
+ if (to && !isAddress(to))
25269
+ throw new InvalidAddressError({ address: to });
25270
+ if (maxFeePerGas && maxFeePerGas > maxUint256)
25271
+ throw new FeeCapTooHighError({ maxFeePerGas });
25272
+ if (maxPriorityFeePerGas && maxFeePerGas && maxPriorityFeePerGas > maxFeePerGas)
25273
+ throw new TipAboveFeeCapError({ maxFeePerGas, maxPriorityFeePerGas });
25274
+ }
25275
+ function assertTransactionEIP2930(transaction) {
25276
+ const { chainId, maxPriorityFeePerGas, gasPrice, maxFeePerGas, to } = transaction;
25277
+ if (chainId <= 0)
25278
+ throw new InvalidChainIdError({ chainId });
25279
+ if (to && !isAddress(to))
25280
+ throw new InvalidAddressError({ address: to });
25281
+ if (maxPriorityFeePerGas || maxFeePerGas)
25282
+ throw new BaseError("`maxFeePerGas`/`maxPriorityFeePerGas` is not a valid EIP-2930 Transaction attribute.");
25283
+ if (gasPrice && gasPrice > maxUint256)
25284
+ throw new FeeCapTooHighError({ maxFeePerGas: gasPrice });
25285
+ }
25286
+ function assertTransactionLegacy(transaction) {
25287
+ const { chainId, maxPriorityFeePerGas, gasPrice, maxFeePerGas, to } = transaction;
25288
+ if (to && !isAddress(to))
25289
+ throw new InvalidAddressError({ address: to });
25290
+ if (typeof chainId !== "undefined" && chainId <= 0)
25291
+ throw new InvalidChainIdError({ chainId });
25292
+ if (maxPriorityFeePerGas || maxFeePerGas)
25293
+ throw new BaseError("`maxFeePerGas`/`maxPriorityFeePerGas` is not a valid Legacy Transaction attribute.");
25294
+ if (gasPrice && gasPrice > maxUint256)
25295
+ throw new FeeCapTooHighError({ maxFeePerGas: gasPrice });
25296
+ }
25297
+
25298
+ // node_modules/viem/_esm/utils/transaction/serializeTransaction.js
25299
+ init_transaction();
25300
+ init_toHex();
25301
+
25302
+ // node_modules/viem/_esm/experimental/eip7702/utils/serializeAuthorizationList.js
25303
+ init_toHex();
25304
+ function serializeAuthorizationList(authorizationList) {
25305
+ if (!authorizationList || authorizationList.length === 0)
25306
+ return [];
25307
+ const serializedAuthorizationList = [];
25308
+ for (const authorization of authorizationList) {
25309
+ const { contractAddress, chainId, nonce, ...signature } = authorization;
25310
+ serializedAuthorizationList.push([
25311
+ chainId ? toHex(chainId) : "0x",
25312
+ contractAddress,
25313
+ nonce ? toHex(nonce) : "0x",
25314
+ ...toYParitySignatureArray({}, signature)
25315
+ ]);
25316
+ }
25317
+ return serializedAuthorizationList;
25318
+ }
25319
+
25320
+ // node_modules/viem/_esm/utils/transaction/serializeAccessList.js
25321
+ init_address();
25322
+ init_transaction();
25323
+ init_isAddress();
25324
+ function serializeAccessList(accessList) {
25325
+ if (!accessList || accessList.length === 0)
25326
+ return [];
25327
+ const serializedAccessList = [];
25328
+ for (let i = 0;i < accessList.length; i++) {
25329
+ const { address, storageKeys } = accessList[i];
25330
+ for (let j = 0;j < storageKeys.length; j++) {
25331
+ if (storageKeys[j].length - 2 !== 64) {
25332
+ throw new InvalidStorageKeySizeError({ storageKey: storageKeys[j] });
25333
+ }
25334
+ }
25335
+ if (!isAddress(address, { strict: false })) {
25336
+ throw new InvalidAddressError({ address });
25337
+ }
25338
+ serializedAccessList.push([address, storageKeys]);
25339
+ }
25340
+ return serializedAccessList;
25341
+ }
25342
+
25343
+ // node_modules/viem/_esm/utils/transaction/serializeTransaction.js
25344
+ function serializeTransaction(transaction, signature) {
25345
+ const type2 = getTransactionType(transaction);
25346
+ if (type2 === "eip1559")
25347
+ return serializeTransactionEIP1559(transaction, signature);
25348
+ if (type2 === "eip2930")
25349
+ return serializeTransactionEIP2930(transaction, signature);
25350
+ if (type2 === "eip4844")
25351
+ return serializeTransactionEIP4844(transaction, signature);
25352
+ if (type2 === "eip7702")
25353
+ return serializeTransactionEIP7702(transaction, signature);
25354
+ return serializeTransactionLegacy(transaction, signature);
25355
+ }
25356
+ function serializeTransactionEIP7702(transaction, signature) {
25357
+ const { authorizationList, chainId, gas, nonce, to, value: value6, maxFeePerGas, maxPriorityFeePerGas, accessList, data } = transaction;
25358
+ assertTransactionEIP7702(transaction);
25359
+ const serializedAccessList = serializeAccessList(accessList);
25360
+ const serializedAuthorizationList = serializeAuthorizationList(authorizationList);
25361
+ return concatHex([
25362
+ "0x04",
25363
+ toRlp([
25364
+ toHex(chainId),
25365
+ nonce ? toHex(nonce) : "0x",
25366
+ maxPriorityFeePerGas ? toHex(maxPriorityFeePerGas) : "0x",
25367
+ maxFeePerGas ? toHex(maxFeePerGas) : "0x",
25368
+ gas ? toHex(gas) : "0x",
25369
+ to ?? "0x",
25370
+ value6 ? toHex(value6) : "0x",
25371
+ data ?? "0x",
25372
+ serializedAccessList,
25373
+ serializedAuthorizationList,
25374
+ ...toYParitySignatureArray(transaction, signature)
25375
+ ])
25376
+ ]);
25377
+ }
25378
+ function serializeTransactionEIP4844(transaction, signature) {
25379
+ const { chainId, gas, nonce, to, value: value6, maxFeePerBlobGas, maxFeePerGas, maxPriorityFeePerGas, accessList, data } = transaction;
25380
+ assertTransactionEIP4844(transaction);
25381
+ let blobVersionedHashes = transaction.blobVersionedHashes;
25382
+ let sidecars = transaction.sidecars;
25383
+ if (transaction.blobs && (typeof blobVersionedHashes === "undefined" || typeof sidecars === "undefined")) {
25384
+ const blobs2 = typeof transaction.blobs[0] === "string" ? transaction.blobs : transaction.blobs.map((x) => bytesToHex2(x));
25385
+ const kzg = transaction.kzg;
25386
+ const commitments2 = blobsToCommitments({
25387
+ blobs: blobs2,
25388
+ kzg
25389
+ });
25390
+ if (typeof blobVersionedHashes === "undefined")
25391
+ blobVersionedHashes = commitmentsToVersionedHashes({
25392
+ commitments: commitments2
25393
+ });
25394
+ if (typeof sidecars === "undefined") {
25395
+ const proofs2 = blobsToProofs({ blobs: blobs2, commitments: commitments2, kzg });
25396
+ sidecars = toBlobSidecars({ blobs: blobs2, commitments: commitments2, proofs: proofs2 });
25397
+ }
25398
+ }
25399
+ const serializedAccessList = serializeAccessList(accessList);
25400
+ const serializedTransaction = [
25401
+ toHex(chainId),
25402
+ nonce ? toHex(nonce) : "0x",
25403
+ maxPriorityFeePerGas ? toHex(maxPriorityFeePerGas) : "0x",
25404
+ maxFeePerGas ? toHex(maxFeePerGas) : "0x",
25405
+ gas ? toHex(gas) : "0x",
25406
+ to ?? "0x",
25407
+ value6 ? toHex(value6) : "0x",
25408
+ data ?? "0x",
25409
+ serializedAccessList,
25410
+ maxFeePerBlobGas ? toHex(maxFeePerBlobGas) : "0x",
25411
+ blobVersionedHashes ?? [],
25412
+ ...toYParitySignatureArray(transaction, signature)
25413
+ ];
25414
+ const blobs = [];
25415
+ const commitments = [];
25416
+ const proofs = [];
25417
+ if (sidecars)
25418
+ for (let i = 0;i < sidecars.length; i++) {
25419
+ const { blob, commitment, proof } = sidecars[i];
25420
+ blobs.push(blob);
25421
+ commitments.push(commitment);
25422
+ proofs.push(proof);
25423
+ }
25424
+ return concatHex([
25425
+ "0x03",
25426
+ sidecars ? toRlp([serializedTransaction, blobs, commitments, proofs]) : toRlp(serializedTransaction)
25427
+ ]);
25428
+ }
25429
+ function serializeTransactionEIP1559(transaction, signature) {
25430
+ const { chainId, gas, nonce, to, value: value6, maxFeePerGas, maxPriorityFeePerGas, accessList, data } = transaction;
25431
+ assertTransactionEIP1559(transaction);
25432
+ const serializedAccessList = serializeAccessList(accessList);
25433
+ const serializedTransaction = [
25434
+ toHex(chainId),
25435
+ nonce ? toHex(nonce) : "0x",
25436
+ maxPriorityFeePerGas ? toHex(maxPriorityFeePerGas) : "0x",
25437
+ maxFeePerGas ? toHex(maxFeePerGas) : "0x",
25438
+ gas ? toHex(gas) : "0x",
25439
+ to ?? "0x",
25440
+ value6 ? toHex(value6) : "0x",
25441
+ data ?? "0x",
25442
+ serializedAccessList,
25443
+ ...toYParitySignatureArray(transaction, signature)
25444
+ ];
25445
+ return concatHex([
25446
+ "0x02",
25447
+ toRlp(serializedTransaction)
25448
+ ]);
25449
+ }
25450
+ function serializeTransactionEIP2930(transaction, signature) {
25451
+ const { chainId, gas, data, nonce, to, value: value6, accessList, gasPrice } = transaction;
25452
+ assertTransactionEIP2930(transaction);
25453
+ const serializedAccessList = serializeAccessList(accessList);
25454
+ const serializedTransaction = [
25455
+ toHex(chainId),
25456
+ nonce ? toHex(nonce) : "0x",
25457
+ gasPrice ? toHex(gasPrice) : "0x",
25458
+ gas ? toHex(gas) : "0x",
25459
+ to ?? "0x",
25460
+ value6 ? toHex(value6) : "0x",
25461
+ data ?? "0x",
25462
+ serializedAccessList,
25463
+ ...toYParitySignatureArray(transaction, signature)
25464
+ ];
25465
+ return concatHex([
25466
+ "0x01",
25467
+ toRlp(serializedTransaction)
25468
+ ]);
25469
+ }
25470
+ function serializeTransactionLegacy(transaction, signature) {
25471
+ const { chainId = 0, gas, data, nonce, to, value: value6, gasPrice } = transaction;
25472
+ assertTransactionLegacy(transaction);
25473
+ let serializedTransaction = [
25474
+ nonce ? toHex(nonce) : "0x",
25475
+ gasPrice ? toHex(gasPrice) : "0x",
25476
+ gas ? toHex(gas) : "0x",
25477
+ to ?? "0x",
25478
+ value6 ? toHex(value6) : "0x",
25479
+ data ?? "0x"
25480
+ ];
25481
+ if (signature) {
25482
+ const v = (() => {
25483
+ if (signature.v >= 35n) {
25484
+ const inferredChainId = (signature.v - 35n) / 2n;
25485
+ if (inferredChainId > 0)
25486
+ return signature.v;
25487
+ return 27n + (signature.v === 35n ? 0n : 1n);
25488
+ }
25489
+ if (chainId > 0)
25490
+ return BigInt(chainId * 2) + BigInt(35n + signature.v - 27n);
25491
+ const v2 = 27n + (signature.v === 27n ? 0n : 1n);
25492
+ if (signature.v !== v2)
25493
+ throw new InvalidLegacyVError({ v: signature.v });
25494
+ return v2;
25495
+ })();
25496
+ const r = trim(signature.r);
25497
+ const s = trim(signature.s);
25498
+ serializedTransaction = [
25499
+ ...serializedTransaction,
25500
+ toHex(v),
25501
+ r === "0x00" ? "0x" : r,
25502
+ s === "0x00" ? "0x" : s
25503
+ ];
25504
+ } else if (chainId > 0) {
25505
+ serializedTransaction = [
25506
+ ...serializedTransaction,
25507
+ toHex(chainId),
25508
+ "0x",
25509
+ "0x"
25510
+ ];
25511
+ }
25512
+ return toRlp(serializedTransaction);
25513
+ }
25514
+ function toYParitySignatureArray(transaction, signature_) {
25515
+ const signature = signature_ ?? transaction;
25516
+ const { v, yParity } = signature;
25517
+ if (typeof signature.r === "undefined")
25518
+ return [];
25519
+ if (typeof signature.s === "undefined")
25520
+ return [];
25521
+ if (typeof v === "undefined" && typeof yParity === "undefined")
25522
+ return [];
25523
+ const r = trim(signature.r);
25524
+ const s = trim(signature.s);
25525
+ const yParity_ = (() => {
25526
+ if (typeof yParity === "number")
25527
+ return yParity ? toHex(1) : "0x";
25528
+ if (v === 0n)
25529
+ return "0x";
25530
+ if (v === 1n)
25531
+ return toHex(1);
25532
+ return v === 27n ? "0x" : toHex(1);
25533
+ })();
25534
+ return [yParity_, r === "0x00" ? "0x" : r, s === "0x00" ? "0x" : s];
25535
+ }
25536
+
23840
25537
  // node_modules/viem/_esm/index.js
23841
25538
  init_toBytes();
23842
25539
  init_toHex();
@@ -23990,6 +25687,251 @@ function assertUint8(value6) {
23990
25687
  throw new Error(`Invalid uint8 value: ${value6}`);
23991
25688
  }
23992
25689
  }
25690
+ // node_modules/viem/_esm/op-stack/contracts.js
25691
+ var contracts = {
25692
+ gasPriceOracle: { address: "0x420000000000000000000000000000000000000F" },
25693
+ l1Block: { address: "0x4200000000000000000000000000000000000015" },
25694
+ l2CrossDomainMessenger: {
25695
+ address: "0x4200000000000000000000000000000000000007"
25696
+ },
25697
+ l2Erc721Bridge: { address: "0x4200000000000000000000000000000000000014" },
25698
+ l2StandardBridge: { address: "0x4200000000000000000000000000000000000010" },
25699
+ l2ToL1MessagePasser: {
25700
+ address: "0x4200000000000000000000000000000000000016"
25701
+ }
25702
+ };
25703
+
25704
+ // node_modules/viem/_esm/op-stack/formatters.js
25705
+ init_fromHex();
25706
+ var formatters = {
25707
+ block: /* @__PURE__ */ defineBlock({
25708
+ format(args2) {
25709
+ const transactions = args2.transactions?.map((transaction) => {
25710
+ if (typeof transaction === "string")
25711
+ return transaction;
25712
+ const formatted = formatTransaction(transaction);
25713
+ if (formatted.typeHex === "0x7e") {
25714
+ formatted.isSystemTx = transaction.isSystemTx;
25715
+ formatted.mint = transaction.mint ? hexToBigInt(transaction.mint) : undefined;
25716
+ formatted.sourceHash = transaction.sourceHash;
25717
+ formatted.type = "deposit";
25718
+ }
25719
+ return formatted;
25720
+ });
25721
+ return {
25722
+ transactions,
25723
+ stateRoot: args2.stateRoot
25724
+ };
25725
+ }
25726
+ }),
25727
+ transaction: /* @__PURE__ */ defineTransaction({
25728
+ format(args2) {
25729
+ const transaction = {};
25730
+ if (args2.type === "0x7e") {
25731
+ transaction.isSystemTx = args2.isSystemTx;
25732
+ transaction.mint = args2.mint ? hexToBigInt(args2.mint) : undefined;
25733
+ transaction.sourceHash = args2.sourceHash;
25734
+ transaction.type = "deposit";
25735
+ }
25736
+ return transaction;
25737
+ }
25738
+ }),
25739
+ transactionReceipt: /* @__PURE__ */ defineTransactionReceipt({
25740
+ format(args2) {
25741
+ return {
25742
+ l1GasPrice: args2.l1GasPrice ? hexToBigInt(args2.l1GasPrice) : null,
25743
+ l1GasUsed: args2.l1GasUsed ? hexToBigInt(args2.l1GasUsed) : null,
25744
+ l1Fee: args2.l1Fee ? hexToBigInt(args2.l1Fee) : null,
25745
+ l1FeeScalar: args2.l1FeeScalar ? Number(args2.l1FeeScalar) : null
25746
+ };
25747
+ }
25748
+ })
25749
+ };
25750
+
25751
+ // node_modules/viem/_esm/op-stack/serializers.js
25752
+ init_address();
25753
+ init_isAddress();
25754
+ init_toHex();
25755
+ function serializeTransaction2(transaction, signature) {
25756
+ if (isDeposit(transaction))
25757
+ return serializeTransactionDeposit(transaction);
25758
+ return serializeTransaction(transaction, signature);
25759
+ }
25760
+ var serializers = {
25761
+ transaction: serializeTransaction2
25762
+ };
25763
+ function serializeTransactionDeposit(transaction) {
25764
+ assertTransactionDeposit(transaction);
25765
+ const { sourceHash, data, from, gas, isSystemTx, mint, to, value: value6 } = transaction;
25766
+ const serializedTransaction = [
25767
+ sourceHash,
25768
+ from,
25769
+ to ?? "0x",
25770
+ mint ? toHex(mint) : "0x",
25771
+ value6 ? toHex(value6) : "0x",
25772
+ gas ? toHex(gas) : "0x",
25773
+ isSystemTx ? "0x1" : "0x",
25774
+ data ?? "0x"
25775
+ ];
25776
+ return concatHex([
25777
+ "0x7e",
25778
+ toRlp(serializedTransaction)
25779
+ ]);
25780
+ }
25781
+ function isDeposit(transaction) {
25782
+ if (transaction.type === "deposit")
25783
+ return true;
25784
+ if (typeof transaction.sourceHash !== "undefined")
25785
+ return true;
25786
+ return false;
25787
+ }
25788
+ function assertTransactionDeposit(transaction) {
25789
+ const { from, to } = transaction;
25790
+ if (from && !isAddress(from))
25791
+ throw new InvalidAddressError({ address: from });
25792
+ if (to && !isAddress(to))
25793
+ throw new InvalidAddressError({ address: to });
25794
+ }
25795
+
25796
+ // node_modules/viem/_esm/op-stack/chainConfig.js
25797
+ var chainConfig = {
25798
+ contracts,
25799
+ formatters,
25800
+ serializers
25801
+ };
25802
+
25803
+ // node_modules/viem/_esm/chains/definitions/anvil.js
25804
+ var anvil = /* @__PURE__ */ defineChain({
25805
+ id: 31337,
25806
+ name: "Anvil",
25807
+ nativeCurrency: {
25808
+ decimals: 18,
25809
+ name: "Ether",
25810
+ symbol: "ETH"
25811
+ },
25812
+ rpcUrls: {
25813
+ default: {
25814
+ http: ["http://127.0.0.1:8545"],
25815
+ webSocket: ["ws://127.0.0.1:8545"]
25816
+ }
25817
+ }
25818
+ });
25819
+ // node_modules/viem/_esm/chains/definitions/baseSepolia.js
25820
+ var sourceId = 11155111;
25821
+ var baseSepolia = /* @__PURE__ */ defineChain({
25822
+ ...chainConfig,
25823
+ id: 84532,
25824
+ network: "base-sepolia",
25825
+ name: "Base Sepolia",
25826
+ nativeCurrency: { name: "Sepolia Ether", symbol: "ETH", decimals: 18 },
25827
+ rpcUrls: {
25828
+ default: {
25829
+ http: ["https://sepolia.base.org"]
25830
+ }
25831
+ },
25832
+ blockExplorers: {
25833
+ default: {
25834
+ name: "Basescan",
25835
+ url: "https://sepolia.basescan.org",
25836
+ apiUrl: "https://api-sepolia.basescan.org/api"
25837
+ }
25838
+ },
25839
+ contracts: {
25840
+ ...chainConfig.contracts,
25841
+ disputeGameFactory: {
25842
+ [sourceId]: {
25843
+ address: "0xd6E6dBf4F7EA0ac412fD8b65ED297e64BB7a06E1"
25844
+ }
25845
+ },
25846
+ l2OutputOracle: {
25847
+ [sourceId]: {
25848
+ address: "0x84457ca9D0163FbC4bbfe4Dfbb20ba46e48DF254"
25849
+ }
25850
+ },
25851
+ portal: {
25852
+ [sourceId]: {
25853
+ address: "0x49f53e41452c74589e85ca1677426ba426459e85",
25854
+ blockCreated: 4446677
25855
+ }
25856
+ },
25857
+ l1StandardBridge: {
25858
+ [sourceId]: {
25859
+ address: "0xfd0Bf71F60660E2f608ed56e1659C450eB113120",
25860
+ blockCreated: 4446677
25861
+ }
25862
+ },
25863
+ multicall3: {
25864
+ address: "0xca11bde05977b3631167028862be2a173976ca11",
25865
+ blockCreated: 1059647
25866
+ }
25867
+ },
25868
+ testnet: true,
25869
+ sourceId
25870
+ });
25871
+ // node_modules/viem/_esm/chains/definitions/monadTestnet.js
25872
+ var monadTestnet = /* @__PURE__ */ defineChain({
25873
+ id: 10143,
25874
+ name: "Monad Testnet",
25875
+ nativeCurrency: {
25876
+ name: "Testnet MON Token",
25877
+ symbol: "MON",
25878
+ decimals: 18
25879
+ },
25880
+ rpcUrls: {
25881
+ default: {
25882
+ http: ["https://testnet-rpc.monad.xyz"]
25883
+ }
25884
+ },
25885
+ blockExplorers: {
25886
+ default: {
25887
+ name: "Monad Testnet explorer",
25888
+ url: "https://testnet.monadexplorer.com"
25889
+ }
25890
+ },
25891
+ contracts: {
25892
+ multicall3: {
25893
+ address: "0xcA11bde05977b3631167028862bE2a173976CA11",
25894
+ blockCreated: 251449
25895
+ }
25896
+ },
25897
+ testnet: true
25898
+ });
25899
+ // node_modules/viem/_esm/chains/definitions/sepolia.js
25900
+ var sepolia = /* @__PURE__ */ defineChain({
25901
+ id: 11155111,
25902
+ name: "Sepolia",
25903
+ nativeCurrency: { name: "Sepolia Ether", symbol: "ETH", decimals: 18 },
25904
+ rpcUrls: {
25905
+ default: {
25906
+ http: ["https://sepolia.drpc.org"]
25907
+ }
25908
+ },
25909
+ blockExplorers: {
25910
+ default: {
25911
+ name: "Etherscan",
25912
+ url: "https://sepolia.etherscan.io",
25913
+ apiUrl: "https://api-sepolia.etherscan.io/api"
25914
+ }
25915
+ },
25916
+ contracts: {
25917
+ multicall3: {
25918
+ address: "0xca11bde05977b3631167028862be2a173976ca11",
25919
+ blockCreated: 751532
25920
+ },
25921
+ ensRegistry: { address: "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e" },
25922
+ ensUniversalResolver: {
25923
+ address: "0xc8Af999e38273D658BE1b921b88A9Ddf005769cC",
25924
+ blockCreated: 5317080
25925
+ }
25926
+ },
25927
+ testnet: true
25928
+ });
25929
+ // src/viem.ts
25930
+ var chains = { sepolia, baseSepolia, monadTestnet, anvil };
25931
+ function getViemChain(chainish) {
25932
+ const { name } = getSupportedChain(chainish);
25933
+ return chains[name];
25934
+ }
23993
25935
  export {
23994
25936
  supportedChains,
23995
25937
  parseJson2 as parseJson,
@@ -23999,11 +25941,13 @@ export {
23999
25941
  mustBeHex,
24000
25942
  isFheType,
24001
25943
  handleTypes,
25944
+ getViemChain,
24002
25945
  getSupportedChain,
24003
25946
  getHandleType,
24004
25947
  fheSupportedChains,
24005
25948
  computePrehandle,
24006
25949
  computeHandle,
25950
+ chains,
24007
25951
  bytesToHex3 as bytesToHex,
24008
25952
  bytesToBigInt,
24009
25953
  bytesFromHexString,