402mob-runtime 0.3.1 → 0.3.3

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/README.md +38 -3
  2. package/dist/runtime/cli.js +1185 -614
  3. package/package.json +1 -1
@@ -32,11 +32,11 @@ var __export = (target, all) => {
32
32
  for (var name in all)
33
33
  __defProp(target, name, { get: all[name], enumerable: true });
34
34
  };
35
- var __copyProps = (to, from15, except, desc) => {
36
- if (from15 && typeof from15 === "object" || typeof from15 === "function") {
37
- for (let key of __getOwnPropNames(from15))
35
+ var __copyProps = (to, from16, except, desc) => {
36
+ if (from16 && typeof from16 === "object" || typeof from16 === "function") {
37
+ for (let key of __getOwnPropNames(from16))
38
38
  if (!__hasOwnProp.call(to, key) && key !== except)
39
- __defProp(to, key, { get: () => from15[key], enumerable: !(desc = __getOwnPropDesc(from15, key)) || desc.enumerable });
39
+ __defProp(to, key, { get: () => from16[key], enumerable: !(desc = __getOwnPropDesc(from16, key)) || desc.enumerable });
40
40
  }
41
41
  return to;
42
42
  };
@@ -504,7 +504,7 @@ function FpSqrt(P) {
504
504
  return sqrt5mod8;
505
505
  return tonelliShanks(P);
506
506
  }
507
- function validateField(field) {
507
+ function validateField(field2) {
508
508
  const initial = {
509
509
  ORDER: "bigint",
510
510
  MASK: "bigint",
@@ -515,7 +515,7 @@ function validateField(field) {
515
515
  map2[val] = "function";
516
516
  return map2;
517
517
  }, initial);
518
- return validateObject(field, opts);
518
+ return validateObject(field2, opts);
519
519
  }
520
520
  function FpPow(Fp, num2, power) {
521
521
  if (power < _0n2)
@@ -985,24 +985,24 @@ var init_hmac = __esm({
985
985
  "node_modules/@noble/hashes/esm/hmac.js"() {
986
986
  init_utils();
987
987
  HMAC = class extends Hash {
988
- constructor(hash5, _key) {
988
+ constructor(hash6, _key) {
989
989
  super();
990
990
  this.finished = false;
991
991
  this.destroyed = false;
992
- ahash(hash5);
992
+ ahash(hash6);
993
993
  const key = toBytes(_key);
994
- this.iHash = hash5.create();
994
+ this.iHash = hash6.create();
995
995
  if (typeof this.iHash.update !== "function")
996
996
  throw new Error("Expected instance of class which extends utils.Hash");
997
997
  this.blockLen = this.iHash.blockLen;
998
998
  this.outputLen = this.iHash.outputLen;
999
999
  const blockLen = this.blockLen;
1000
1000
  const pad4 = new Uint8Array(blockLen);
1001
- pad4.set(key.length > blockLen ? hash5.create().update(key).digest() : key);
1001
+ pad4.set(key.length > blockLen ? hash6.create().update(key).digest() : key);
1002
1002
  for (let i = 0; i < pad4.length; i++)
1003
1003
  pad4[i] ^= 54;
1004
1004
  this.iHash.update(pad4);
1005
- this.oHash = hash5.create();
1005
+ this.oHash = hash6.create();
1006
1006
  for (let i = 0; i < pad4.length; i++)
1007
1007
  pad4[i] ^= 54 ^ 92;
1008
1008
  this.oHash.update(pad4);
@@ -1048,8 +1048,8 @@ var init_hmac = __esm({
1048
1048
  this.iHash.destroy();
1049
1049
  }
1050
1050
  };
1051
- hmac = (hash5, key, message) => new HMAC(hash5, key).update(message).digest();
1052
- hmac.create = (hash5, key) => new HMAC(hash5, key);
1051
+ hmac = (hash6, key, message) => new HMAC(hash6, key).update(message).digest();
1052
+ hmac.create = (hash6, key) => new HMAC(hash6, key);
1053
1053
  }
1054
1054
  });
1055
1055
 
@@ -1095,11 +1095,11 @@ function validateMSMPoints(points, c) {
1095
1095
  throw new Error("invalid point at index " + i);
1096
1096
  });
1097
1097
  }
1098
- function validateMSMScalars(scalars, field) {
1098
+ function validateMSMScalars(scalars, field2) {
1099
1099
  if (!Array.isArray(scalars))
1100
1100
  throw new Error("array of scalars expected");
1101
1101
  scalars.forEach((s, i) => {
1102
- if (!field.isValid(s))
1102
+ if (!field2.isValid(s))
1103
1103
  throw new Error("invalid scalar at index " + i);
1104
1104
  });
1105
1105
  }
@@ -1808,7 +1808,7 @@ function weierstrass(curveDef) {
1808
1808
  function normalizeS(s) {
1809
1809
  return isBiggerThanHalfOrder(s) ? modN2(-s) : s;
1810
1810
  }
1811
- const slcNum = (b, from15, to) => bytesToNumberBE(b.slice(from15, to));
1811
+ const slcNum = (b, from16, to) => bytesToNumberBE(b.slice(from16, to));
1812
1812
  class Signature {
1813
1813
  constructor(r, s, recovery) {
1814
1814
  aInRange("r", r, _1n4, CURVE_ORDER);
@@ -1959,14 +1959,14 @@ function weierstrass(curveDef) {
1959
1959
  function prepSig(msgHash, privateKey, opts = defaultSigOpts) {
1960
1960
  if (["recovered", "canonical"].some((k) => k in opts))
1961
1961
  throw new Error("sign() legacy options not supported");
1962
- const { hash: hash5, randomBytes: randomBytes5 } = CURVE;
1962
+ const { hash: hash6, randomBytes: randomBytes5 } = CURVE;
1963
1963
  let { lowS, prehash, extraEntropy: ent } = opts;
1964
1964
  if (lowS == null)
1965
1965
  lowS = true;
1966
1966
  msgHash = ensureBytes("msgHash", msgHash);
1967
1967
  validateSigVerOpts(opts);
1968
1968
  if (prehash)
1969
- msgHash = ensureBytes("prehashed msgHash", hash5(msgHash));
1969
+ msgHash = ensureBytes("prehashed msgHash", hash6(msgHash));
1970
1970
  const h1int = bits2int_modN(msgHash);
1971
1971
  const d = normPrivateKeyToScalar(privateKey);
1972
1972
  const seedArgs = [int2octets(d), int2octets(h1int)];
@@ -2007,8 +2007,8 @@ function weierstrass(curveDef) {
2007
2007
  return drbg(seed, k2sig);
2008
2008
  }
2009
2009
  Point2.BASE._setWindowSize(8);
2010
- function verify(signature2, msgHash, publicKey, opts = defaultVerOpts) {
2011
- const sg = signature2;
2010
+ function verify(signature3, msgHash, publicKey, opts = defaultVerOpts) {
2011
+ const sg = signature3;
2012
2012
  msgHash = ensureBytes("msgHash", msgHash);
2013
2013
  publicKey = ensureBytes("publicKey", publicKey);
2014
2014
  const { lowS, prehash, format: format2 } = opts;
@@ -2289,15 +2289,15 @@ var init_weierstrass = __esm({
2289
2289
  });
2290
2290
 
2291
2291
  // node_modules/@noble/curves/esm/_shortw_utils.js
2292
- function getHash(hash5) {
2292
+ function getHash(hash6) {
2293
2293
  return {
2294
- hash: hash5,
2295
- hmac: (key, ...msgs) => hmac(hash5, key, concatBytes(...msgs)),
2294
+ hash: hash6,
2295
+ hmac: (key, ...msgs) => hmac(hash6, key, concatBytes(...msgs)),
2296
2296
  randomBytes: randomBytes2
2297
2297
  };
2298
2298
  }
2299
2299
  function createCurve(curveDef, defHash) {
2300
- const create2 = (hash5) => weierstrass({ ...curveDef, ...getHash(hash5) });
2300
+ const create2 = (hash6) => weierstrass({ ...curveDef, ...getHash(hash6) });
2301
2301
  return { ...create2(defHash), create: create2 };
2302
2302
  }
2303
2303
  var init_shortw_utils = __esm({
@@ -2375,7 +2375,7 @@ function hash_to_field(msg, count, options) {
2375
2375
  k: "isSafeInteger",
2376
2376
  hash: "hash"
2377
2377
  });
2378
- const { p, k, m, hash: hash5, expand, DST: _DST } = options;
2378
+ const { p, k, m, hash: hash6, expand, DST: _DST } = options;
2379
2379
  abytes2(msg);
2380
2380
  anum(count);
2381
2381
  const DST = typeof _DST === "string" ? utf8ToBytes2(_DST) : _DST;
@@ -2384,9 +2384,9 @@ function hash_to_field(msg, count, options) {
2384
2384
  const len_in_bytes = count * m * L;
2385
2385
  let prb;
2386
2386
  if (expand === "xmd") {
2387
- prb = expand_message_xmd(msg, DST, len_in_bytes, hash5);
2387
+ prb = expand_message_xmd(msg, DST, len_in_bytes, hash6);
2388
2388
  } else if (expand === "xof") {
2389
- prb = expand_message_xof(msg, DST, len_in_bytes, k, hash5);
2389
+ prb = expand_message_xof(msg, DST, len_in_bytes, k, hash6);
2390
2390
  } else if (expand === "_internal_pass") {
2391
2391
  prb = msg;
2392
2392
  } else {
@@ -2404,13 +2404,13 @@ function hash_to_field(msg, count, options) {
2404
2404
  }
2405
2405
  return u;
2406
2406
  }
2407
- function isogenyMap(field, map2) {
2407
+ function isogenyMap(field2, map2) {
2408
2408
  const coeff = map2.map((i) => Array.from(i).reverse());
2409
2409
  return (x, y) => {
2410
- const [xn, xd, yn, yd] = coeff.map((val) => val.reduce((acc, i) => field.add(field.mul(acc, x), i)));
2411
- const [xd_inv, yd_inv] = FpInvertBatch(field, [xd, yd], true);
2412
- x = field.mul(xn, xd_inv);
2413
- y = field.mul(y, field.mul(yn, yd_inv));
2410
+ const [xn, xd, yn, yd] = coeff.map((val) => val.reduce((acc, i) => field2.add(field2.mul(acc, x), i)));
2411
+ const [xd_inv, yd_inv] = FpInvertBatch(field2, [xd, yd], true);
2412
+ x = field2.mul(xn, xd_inv);
2413
+ y = field2.mul(y, field2.mul(yn, yd_inv));
2414
2414
  return { x, y };
2415
2415
  };
2416
2416
  }
@@ -2544,8 +2544,8 @@ function schnorrSign(message, privateKey, auxRand = randomBytes2(32)) {
2544
2544
  throw new Error("sign: Invalid signature produced");
2545
2545
  return sig;
2546
2546
  }
2547
- function schnorrVerify(signature2, message, publicKey) {
2548
- const sig = ensureBytes("signature", signature2, 64);
2547
+ function schnorrVerify(signature3, message, publicKey) {
2548
+ const sig = ensureBytes("signature", signature3, 64);
2549
2549
  const m = ensureBytes("message", message);
2550
2550
  const pub = ensureBytes("publicKey", publicKey, 32);
2551
2551
  try {
@@ -3452,13 +3452,13 @@ function checksumAddress(address_, chainId) {
3452
3452
  if (checksumAddressCache.has(`${address_}.${chainId}`))
3453
3453
  return checksumAddressCache.get(`${address_}.${chainId}`);
3454
3454
  const hexAddress = chainId ? `${chainId}${address_.toLowerCase()}` : address_.substring(2).toLowerCase();
3455
- const hash5 = keccak256(stringToBytes(hexAddress), "bytes");
3455
+ const hash6 = keccak256(stringToBytes(hexAddress), "bytes");
3456
3456
  const address4 = (chainId ? hexAddress.substring(`${chainId}0x`.length) : hexAddress).split("");
3457
3457
  for (let i = 0; i < 40; i += 2) {
3458
- if (hash5[i >> 1] >> 4 >= 8 && address4[i]) {
3458
+ if (hash6[i >> 1] >> 4 >= 8 && address4[i]) {
3459
3459
  address4[i] = address4[i].toUpperCase();
3460
3460
  }
3461
- if ((hash5[i >> 1] & 15) >= 8 && address4[i + 1]) {
3461
+ if ((hash6[i >> 1] & 15) >= 8 && address4[i + 1]) {
3462
3462
  address4[i + 1] = address4[i + 1].toUpperCase();
3463
3463
  }
3464
3464
  }
@@ -3851,7 +3851,7 @@ var init_toRlp = __esm({
3851
3851
  function hashAuthorization(parameters) {
3852
3852
  const { chainId, nonce, to } = parameters;
3853
3853
  const address4 = parameters.contractAddress ?? parameters.address;
3854
- const hash5 = keccak256(concatHex([
3854
+ const hash6 = keccak256(concatHex([
3855
3855
  "0x05",
3856
3856
  toRlp([
3857
3857
  chainId ? numberToHex(chainId) : "0x",
@@ -3860,8 +3860,8 @@ function hashAuthorization(parameters) {
3860
3860
  ])
3861
3861
  ]));
3862
3862
  if (to === "bytes")
3863
- return hexToBytes2(hash5);
3864
- return hash5;
3863
+ return hexToBytes2(hash6);
3864
+ return hash6;
3865
3865
  }
3866
3866
  var init_hashAuthorization = __esm({
3867
3867
  "node_modules/viem/_esm/utils/authorization/hashAuthorization.js"() {
@@ -3935,7 +3935,56 @@ function formatEther(wei, unit = "wei") {
3935
3935
  function formatGwei(wei, unit = "wei") {
3936
3936
  return format(wei, exponents.gwei - exponents[unit]);
3937
3937
  }
3938
- var exponents, InvalidDecimalsError;
3938
+ function from(value, decimals = 0) {
3939
+ if (!Number.isInteger(decimals) || decimals < 0)
3940
+ throw new InvalidDecimalsError({ decimals });
3941
+ if (!/^-?(?:[0-9]+(?:\.[0-9]*)?|\.[0-9]+)$/.test(value))
3942
+ throw new InvalidDecimalNumberError({ value });
3943
+ let [integer2 = "", fraction = "0"] = value.split(".");
3944
+ const negative = integer2.startsWith("-");
3945
+ if (negative)
3946
+ integer2 = integer2.slice(1);
3947
+ if (integer2 === "")
3948
+ integer2 = "0";
3949
+ fraction = fraction.replace(/(0+)$/, "");
3950
+ if (decimals === 0) {
3951
+ if (fraction.length > 0 && Number.parseInt(fraction[0], 10) >= 5)
3952
+ integer2 = `${BigInt(integer2) + 1n}`;
3953
+ fraction = "";
3954
+ } else if (fraction.length > decimals) {
3955
+ const left = fraction.slice(0, decimals);
3956
+ const roundDigit = Number.parseInt(fraction.slice(decimals, decimals + 1), 10);
3957
+ if (roundDigit >= 5) {
3958
+ const carried = carry(left);
3959
+ if (carried.length > decimals) {
3960
+ fraction = carried.slice(1);
3961
+ integer2 = `${BigInt(integer2) + 1n}`;
3962
+ } else {
3963
+ fraction = carried;
3964
+ }
3965
+ } else {
3966
+ fraction = left;
3967
+ }
3968
+ } else {
3969
+ fraction = fraction.padEnd(decimals, "0");
3970
+ }
3971
+ return BigInt(`${negative ? "-" : ""}${integer2}${fraction}`);
3972
+ }
3973
+ function carry(digits) {
3974
+ const out2 = digits.split("");
3975
+ let i = out2.length - 1;
3976
+ while (i >= 0) {
3977
+ const d = Number.parseInt(out2[i], 10) + 1;
3978
+ if (d < 10) {
3979
+ out2[i] = String(d);
3980
+ return out2.join("");
3981
+ }
3982
+ out2[i] = "0";
3983
+ i--;
3984
+ }
3985
+ return `1${out2.join("")}`;
3986
+ }
3987
+ var exponents, InvalidDecimalNumberError, InvalidDecimalsError;
3939
3988
  var init_Value = __esm({
3940
3989
  "node_modules/viem/_esm/utils/unit/Value.js"() {
3941
3990
  exponents = {
@@ -3945,6 +3994,17 @@ var init_Value = __esm({
3945
3994
  finney: 15,
3946
3995
  ether: 18
3947
3996
  };
3997
+ InvalidDecimalNumberError = class extends Error {
3998
+ constructor({ value }) {
3999
+ super(`Value \`${value}\` is not a valid decimal number.`);
4000
+ Object.defineProperty(this, "name", {
4001
+ enumerable: true,
4002
+ configurable: true,
4003
+ writable: true,
4004
+ value: "Value.InvalidDecimalNumberError"
4005
+ });
4006
+ }
4007
+ };
3948
4008
  InvalidDecimalsError = class extends Error {
3949
4009
  constructor({ decimals }) {
3950
4010
  super(`\`decimals\` must be a non-negative integer. Got \`${decimals}\`.`);
@@ -4073,7 +4133,7 @@ var init_transaction = __esm({
4073
4133
  }
4074
4134
  };
4075
4135
  TransactionNotFoundError = class extends BaseError {
4076
- constructor({ blockHash, blockNumber, blockTag, hash: hash5, index: index2 }) {
4136
+ constructor({ blockHash, blockNumber, blockTag, hash: hash6, index: index2 }) {
4077
4137
  let identifier = "Transaction";
4078
4138
  if (blockTag && index2 !== void 0)
4079
4139
  identifier = `Transaction at block time "${blockTag}" at index "${index2}"`;
@@ -4081,16 +4141,16 @@ var init_transaction = __esm({
4081
4141
  identifier = `Transaction at block hash "${blockHash}" at index "${index2}"`;
4082
4142
  if (blockNumber && index2 !== void 0)
4083
4143
  identifier = `Transaction at block number "${blockNumber}" at index "${index2}"`;
4084
- if (hash5)
4085
- identifier = `Transaction with hash "${hash5}"`;
4144
+ if (hash6)
4145
+ identifier = `Transaction with hash "${hash6}"`;
4086
4146
  super(`${identifier} could not be found.`, {
4087
4147
  name: "TransactionNotFoundError"
4088
4148
  });
4089
4149
  }
4090
4150
  };
4091
4151
  TransactionReceiptNotFoundError = class extends BaseError {
4092
- constructor({ hash: hash5 }) {
4093
- super(`Transaction receipt with hash "${hash5}" could not be found. The Transaction may not be processed on a block yet.`, {
4152
+ constructor({ hash: hash6 }) {
4153
+ super(`Transaction receipt with hash "${hash6}" could not be found. The Transaction may not be processed on a block yet.`, {
4094
4154
  name: "TransactionReceiptNotFoundError"
4095
4155
  });
4096
4156
  }
@@ -4117,8 +4177,8 @@ var init_transaction = __esm({
4117
4177
  }
4118
4178
  };
4119
4179
  WaitForTransactionReceiptTimeoutError = class extends BaseError {
4120
- constructor({ hash: hash5 }) {
4121
- super(`Timed out while waiting for transaction with hash "${hash5}" to be confirmed.`, { name: "WaitForTransactionReceiptTimeoutError" });
4180
+ constructor({ hash: hash6 }) {
4181
+ super(`Timed out while waiting for transaction with hash "${hash6}" to be confirmed.`, { name: "WaitForTransactionReceiptTimeoutError" });
4122
4182
  }
4123
4183
  };
4124
4184
  }
@@ -4130,11 +4190,11 @@ function serializeAuthorizationList(authorizationList) {
4130
4190
  return [];
4131
4191
  const serializedAuthorizationList = [];
4132
4192
  for (const authorization of authorizationList) {
4133
- const { chainId, nonce, ...signature2 } = authorization;
4193
+ const { chainId, nonce, ...signature3 } = authorization;
4134
4194
  const contractAddress = authorization.address;
4135
- const signatureArray = toYParitySignatureArray({}, signature2);
4136
- if (signatureArray.length > 0 && signature2.yParity)
4137
- signatureArray[0] = toHex(signature2.yParity);
4195
+ const signatureArray = toYParitySignatureArray({}, signature3);
4196
+ if (signatureArray.length > 0 && signature3.yParity)
4197
+ signatureArray[0] = toHex(signature3.yParity);
4138
4198
  serializedAuthorizationList.push([
4139
4199
  chainId ? toHex(chainId) : "0x",
4140
4200
  contractAddress,
@@ -4292,16 +4352,16 @@ var init_blob2 = __esm({
4292
4352
  }
4293
4353
  };
4294
4354
  InvalidVersionedHashSizeError = class extends BaseError {
4295
- constructor({ hash: hash5, size: size5 }) {
4296
- super(`Versioned hash "${hash5}" size is invalid.`, {
4355
+ constructor({ hash: hash6, size: size5 }) {
4356
+ super(`Versioned hash "${hash6}" size is invalid.`, {
4297
4357
  metaMessages: ["Expected: 32", `Received: ${size5}`],
4298
4358
  name: "InvalidVersionedHashSizeError"
4299
4359
  });
4300
4360
  }
4301
4361
  };
4302
4362
  InvalidVersionedHashVersionError = class extends BaseError {
4303
- constructor({ hash: hash5, version: version5 }) {
4304
- super(`Versioned hash "${hash5}" version is invalid.`, {
4363
+ constructor({ hash: hash6, version: version5 }) {
4364
+ super(`Versioned hash "${hash6}" version is invalid.`, {
4305
4365
  metaMessages: [
4306
4366
  `Expected: ${versionedHashVersionKzg}`,
4307
4367
  `Received: ${version5}`
@@ -4774,14 +4834,14 @@ function assertTransactionEIP4844(transaction) {
4774
4834
  if (blobVersionedHashes) {
4775
4835
  if (blobVersionedHashes.length === 0)
4776
4836
  throw new EmptyBlobError();
4777
- for (const hash5 of blobVersionedHashes) {
4778
- const size_ = size(hash5);
4779
- const version5 = hexToNumber2(slice(hash5, 0, 1));
4837
+ for (const hash6 of blobVersionedHashes) {
4838
+ const size_ = size(hash6);
4839
+ const version5 = hexToNumber2(slice(hash6, 0, 1));
4780
4840
  if (size_ !== 32)
4781
- throw new InvalidVersionedHashSizeError({ hash: hash5, size: size_ });
4841
+ throw new InvalidVersionedHashSizeError({ hash: hash6, size: size_ });
4782
4842
  if (version5 !== versionedHashVersionKzg)
4783
4843
  throw new InvalidVersionedHashVersionError({
4784
- hash: hash5,
4844
+ hash: hash6,
4785
4845
  version: version5
4786
4846
  });
4787
4847
  }
@@ -4889,19 +4949,19 @@ var init_serializeAccessList = __esm({
4889
4949
  });
4890
4950
 
4891
4951
  // node_modules/viem/_esm/utils/transaction/serializeTransaction.js
4892
- function serializeTransaction(transaction, signature2) {
4952
+ function serializeTransaction(transaction, signature3) {
4893
4953
  const type = getTransactionType(transaction);
4894
4954
  if (type === "eip1559")
4895
- return serializeTransactionEIP1559(transaction, signature2);
4955
+ return serializeTransactionEIP1559(transaction, signature3);
4896
4956
  if (type === "eip2930")
4897
- return serializeTransactionEIP2930(transaction, signature2);
4957
+ return serializeTransactionEIP2930(transaction, signature3);
4898
4958
  if (type === "eip4844")
4899
- return serializeTransactionEIP4844(transaction, signature2);
4959
+ return serializeTransactionEIP4844(transaction, signature3);
4900
4960
  if (type === "eip7702")
4901
- return serializeTransactionEIP7702(transaction, signature2);
4902
- return serializeTransactionLegacy(transaction, signature2);
4961
+ return serializeTransactionEIP7702(transaction, signature3);
4962
+ return serializeTransactionLegacy(transaction, signature3);
4903
4963
  }
4904
- function serializeTransactionEIP7702(transaction, signature2) {
4964
+ function serializeTransactionEIP7702(transaction, signature3) {
4905
4965
  const { authorizationList, chainId, gas, nonce, to, value, maxFeePerGas, maxPriorityFeePerGas, accessList, data } = transaction;
4906
4966
  assertTransactionEIP7702(transaction);
4907
4967
  const serializedAccessList = serializeAccessList(accessList);
@@ -4919,11 +4979,11 @@ function serializeTransactionEIP7702(transaction, signature2) {
4919
4979
  data ?? "0x",
4920
4980
  serializedAccessList,
4921
4981
  serializedAuthorizationList,
4922
- ...toYParitySignatureArray(transaction, signature2)
4982
+ ...toYParitySignatureArray(transaction, signature3)
4923
4983
  ])
4924
4984
  ]);
4925
4985
  }
4926
- function serializeTransactionEIP4844(transaction, signature2) {
4986
+ function serializeTransactionEIP4844(transaction, signature3) {
4927
4987
  const { chainId, gas, nonce, to, value, maxFeePerBlobGas, maxFeePerGas, maxPriorityFeePerGas, accessList, data } = transaction;
4928
4988
  assertTransactionEIP4844(transaction);
4929
4989
  let blobVersionedHashes = transaction.blobVersionedHashes;
@@ -4957,7 +5017,7 @@ function serializeTransactionEIP4844(transaction, signature2) {
4957
5017
  serializedAccessList,
4958
5018
  maxFeePerBlobGas ? numberToHex(maxFeePerBlobGas) : "0x",
4959
5019
  blobVersionedHashes ?? [],
4960
- ...toYParitySignatureArray(transaction, signature2)
5020
+ ...toYParitySignatureArray(transaction, signature3)
4961
5021
  ];
4962
5022
  const blobs = [];
4963
5023
  const commitments = [];
@@ -4980,7 +5040,7 @@ function serializeTransactionEIP4844(transaction, signature2) {
4980
5040
  )
4981
5041
  ]);
4982
5042
  }
4983
- function serializeTransactionEIP1559(transaction, signature2) {
5043
+ function serializeTransactionEIP1559(transaction, signature3) {
4984
5044
  const { chainId, gas, nonce, to, value, maxFeePerGas, maxPriorityFeePerGas, accessList, data } = transaction;
4985
5045
  assertTransactionEIP1559(transaction);
4986
5046
  const serializedAccessList = serializeAccessList(accessList);
@@ -4994,14 +5054,14 @@ function serializeTransactionEIP1559(transaction, signature2) {
4994
5054
  value ? numberToHex(value) : "0x",
4995
5055
  data ?? "0x",
4996
5056
  serializedAccessList,
4997
- ...toYParitySignatureArray(transaction, signature2)
5057
+ ...toYParitySignatureArray(transaction, signature3)
4998
5058
  ];
4999
5059
  return concatHex([
5000
5060
  "0x02",
5001
5061
  toRlp(serializedTransaction)
5002
5062
  ]);
5003
5063
  }
5004
- function serializeTransactionEIP2930(transaction, signature2) {
5064
+ function serializeTransactionEIP2930(transaction, signature3) {
5005
5065
  const { chainId, gas, data, nonce, to, value, accessList, gasPrice } = transaction;
5006
5066
  assertTransactionEIP2930(transaction);
5007
5067
  const serializedAccessList = serializeAccessList(accessList);
@@ -5014,14 +5074,14 @@ function serializeTransactionEIP2930(transaction, signature2) {
5014
5074
  value ? numberToHex(value) : "0x",
5015
5075
  data ?? "0x",
5016
5076
  serializedAccessList,
5017
- ...toYParitySignatureArray(transaction, signature2)
5077
+ ...toYParitySignatureArray(transaction, signature3)
5018
5078
  ];
5019
5079
  return concatHex([
5020
5080
  "0x01",
5021
5081
  toRlp(serializedTransaction)
5022
5082
  ]);
5023
5083
  }
5024
- function serializeTransactionLegacy(transaction, signature2) {
5084
+ function serializeTransactionLegacy(transaction, signature3) {
5025
5085
  const { chainId = 0, gas, data, nonce, to, value, gasPrice } = transaction;
5026
5086
  assertTransactionLegacy(transaction);
5027
5087
  let serializedTransaction = [
@@ -5032,23 +5092,23 @@ function serializeTransactionLegacy(transaction, signature2) {
5032
5092
  value ? numberToHex(value) : "0x",
5033
5093
  data ?? "0x"
5034
5094
  ];
5035
- if (signature2) {
5095
+ if (signature3) {
5036
5096
  const v2 = (() => {
5037
- if (signature2.v >= 35n) {
5038
- const inferredChainId = (signature2.v - 35n) / 2n;
5097
+ if (signature3.v >= 35n) {
5098
+ const inferredChainId = (signature3.v - 35n) / 2n;
5039
5099
  if (inferredChainId > 0)
5040
- return signature2.v;
5041
- return 27n + (signature2.v === 35n ? 0n : 1n);
5100
+ return signature3.v;
5101
+ return 27n + (signature3.v === 35n ? 0n : 1n);
5042
5102
  }
5043
5103
  if (chainId > 0)
5044
- return BigInt(chainId * 2) + BigInt(35n + signature2.v - 27n);
5045
- const v3 = 27n + (signature2.v === 27n ? 0n : 1n);
5046
- if (signature2.v !== v3)
5047
- throw new InvalidLegacyVError({ v: signature2.v });
5104
+ return BigInt(chainId * 2) + BigInt(35n + signature3.v - 27n);
5105
+ const v3 = 27n + (signature3.v === 27n ? 0n : 1n);
5106
+ if (signature3.v !== v3)
5107
+ throw new InvalidLegacyVError({ v: signature3.v });
5048
5108
  return v3;
5049
5109
  })();
5050
- const r = trim(signature2.r);
5051
- const s = trim(signature2.s);
5110
+ const r = trim(signature3.r);
5111
+ const s = trim(signature3.s);
5052
5112
  serializedTransaction = [
5053
5113
  ...serializedTransaction,
5054
5114
  numberToHex(v2),
@@ -5066,16 +5126,16 @@ function serializeTransactionLegacy(transaction, signature2) {
5066
5126
  return toRlp(serializedTransaction);
5067
5127
  }
5068
5128
  function toYParitySignatureArray(transaction, signature_) {
5069
- const signature2 = signature_ ?? transaction;
5070
- const { v: v2, yParity } = signature2;
5071
- if (typeof signature2.r === "undefined")
5129
+ const signature3 = signature_ ?? transaction;
5130
+ const { v: v2, yParity } = signature3;
5131
+ if (typeof signature3.r === "undefined")
5072
5132
  return [];
5073
- if (typeof signature2.s === "undefined")
5133
+ if (typeof signature3.s === "undefined")
5074
5134
  return [];
5075
5135
  if (typeof v2 === "undefined" && typeof yParity === "undefined")
5076
5136
  return [];
5077
- const r = trim(signature2.r);
5078
- const s = trim(signature2.s);
5137
+ const r = trim(signature3.r);
5138
+ const s = trim(signature3.s);
5079
5139
  const yParity_ = (() => {
5080
5140
  if (typeof yParity === "number")
5081
5141
  return yParity ? numberToHex(1) : "0x";
@@ -5244,11 +5304,11 @@ var init_abi = __esm({
5244
5304
  }
5245
5305
  };
5246
5306
  AbiErrorSignatureNotFoundError = class extends BaseError {
5247
- constructor(signature2, { docsPath: docsPath8, cause }) {
5307
+ constructor(signature3, { docsPath: docsPath8, cause }) {
5248
5308
  super([
5249
- `Encoded error signature "${signature2}" not found on ABI.`,
5309
+ `Encoded error signature "${signature3}" not found on ABI.`,
5250
5310
  "Make sure you are using the correct ABI and that the error exists on it.",
5251
- `You can look up the decoded signature here: https://4byte.sourcify.dev/?q=${signature2}.`
5311
+ `You can look up the decoded signature here: https://4byte.sourcify.dev/?q=${signature3}.`
5252
5312
  ].join("\n"), {
5253
5313
  docsPath: docsPath8,
5254
5314
  name: "AbiErrorSignatureNotFoundError",
@@ -5260,7 +5320,7 @@ var init_abi = __esm({
5260
5320
  writable: true,
5261
5321
  value: void 0
5262
5322
  });
5263
- this.signature = signature2;
5323
+ this.signature = signature3;
5264
5324
  }
5265
5325
  };
5266
5326
  AbiEventSignatureEmptyTopicsError = class extends BaseError {
@@ -5272,11 +5332,11 @@ var init_abi = __esm({
5272
5332
  }
5273
5333
  };
5274
5334
  AbiEventSignatureNotFoundError = class extends BaseError {
5275
- constructor(signature2, { docsPath: docsPath8 }) {
5335
+ constructor(signature3, { docsPath: docsPath8 }) {
5276
5336
  super([
5277
- `Encoded event signature "${signature2}" not found on ABI.`,
5337
+ `Encoded event signature "${signature3}" not found on ABI.`,
5278
5338
  "Make sure you are using the correct ABI and that the event exists on it.",
5279
- `You can look up the signature here: https://4byte.sourcify.dev/?q=${signature2}.`
5339
+ `You can look up the signature here: https://4byte.sourcify.dev/?q=${signature3}.`
5280
5340
  ].join("\n"), {
5281
5341
  docsPath: docsPath8,
5282
5342
  name: "AbiEventSignatureNotFoundError"
@@ -5318,11 +5378,11 @@ var init_abi = __esm({
5318
5378
  }
5319
5379
  };
5320
5380
  AbiFunctionSignatureNotFoundError = class extends BaseError {
5321
- constructor(signature2, { docsPath: docsPath8 }) {
5381
+ constructor(signature3, { docsPath: docsPath8 }) {
5322
5382
  super([
5323
- `Encoded function signature "${signature2}" not found on ABI.`,
5383
+ `Encoded function signature "${signature3}" not found on ABI.`,
5324
5384
  "Make sure you are using the correct ABI and that the function exists on it.",
5325
- `You can look up the signature here: https://4byte.sourcify.dev/?q=${signature2}.`
5385
+ `You can look up the signature here: https://4byte.sourcify.dev/?q=${signature3}.`
5326
5386
  ].join("\n"), {
5327
5387
  docsPath: docsPath8,
5328
5388
  name: "AbiFunctionSignatureNotFoundError"
@@ -5710,8 +5770,8 @@ var init_typedData = __esm({
5710
5770
  init_stringify();
5711
5771
  init_base();
5712
5772
  InvalidDomainError = class extends BaseError {
5713
- constructor({ domain: domain2 }) {
5714
- super(`Invalid domain "${stringify(domain2)}".`, {
5773
+ constructor({ domain: domain3 }) {
5774
+ super(`Invalid domain "${stringify(domain3)}".`, {
5715
5775
  metaMessages: ["Must be a valid EIP-712 domain."]
5716
5776
  });
5717
5777
  }
@@ -5748,7 +5808,7 @@ var init_typedData = __esm({
5748
5808
 
5749
5809
  // node_modules/viem/_esm/utils/typedData.js
5750
5810
  function validateTypedData(parameters) {
5751
- const { domain: domain2, message, primaryType, types } = parameters;
5811
+ const { domain: domain3, message, primaryType, types } = parameters;
5752
5812
  const validateData = (struct, data) => {
5753
5813
  for (const param of struct) {
5754
5814
  const { name, type } = param;
@@ -5782,10 +5842,10 @@ function validateTypedData(parameters) {
5782
5842
  };
5783
5843
  for (const type of Object.keys(types))
5784
5844
  validateReference(type);
5785
- if (types.EIP712Domain && domain2) {
5786
- if (typeof domain2 !== "object")
5787
- throw new InvalidDomainError({ domain: domain2 });
5788
- validateData(types.EIP712Domain, domain2);
5845
+ if (types.EIP712Domain && domain3) {
5846
+ if (typeof domain3 !== "object")
5847
+ throw new InvalidDomainError({ domain: domain3 });
5848
+ validateData(types.EIP712Domain, domain3);
5789
5849
  }
5790
5850
  if (primaryType !== "EIP712Domain") {
5791
5851
  if (types[primaryType])
@@ -5794,19 +5854,19 @@ function validateTypedData(parameters) {
5794
5854
  throw new InvalidPrimaryTypeError({ primaryType, types });
5795
5855
  }
5796
5856
  }
5797
- function getTypesForEIP712Domain({ domain: domain2 }) {
5857
+ function getTypesForEIP712Domain({ domain: domain3 }) {
5798
5858
  return [
5799
- typeof domain2?.name === "string" && { name: "name", type: "string" },
5800
- typeof domain2?.version === "string" && { name: "version", type: "string" },
5801
- (typeof domain2?.chainId === "number" || typeof domain2?.chainId === "bigint") && {
5859
+ typeof domain3?.name === "string" && { name: "name", type: "string" },
5860
+ typeof domain3?.version === "string" && { name: "version", type: "string" },
5861
+ (typeof domain3?.chainId === "number" || typeof domain3?.chainId === "bigint") && {
5802
5862
  name: "chainId",
5803
5863
  type: "uint256"
5804
5864
  },
5805
- domain2?.verifyingContract && {
5865
+ domain3?.verifyingContract && {
5806
5866
  name: "verifyingContract",
5807
5867
  type: "address"
5808
5868
  },
5809
- domain2?.salt && { name: "salt", type: "bytes32" }
5869
+ domain3?.salt && { name: "salt", type: "bytes32" }
5810
5870
  ].filter(Boolean);
5811
5871
  }
5812
5872
  function validateReference(type) {
@@ -5827,21 +5887,21 @@ var init_typedData2 = __esm({
5827
5887
 
5828
5888
  // node_modules/viem/_esm/utils/signature/hashTypedData.js
5829
5889
  function hashTypedData(parameters) {
5830
- const { domain: domain2 = {}, message, primaryType } = parameters;
5890
+ const { domain: domain3 = {}, message, primaryType } = parameters;
5831
5891
  const types = {
5832
- EIP712Domain: getTypesForEIP712Domain({ domain: domain2 }),
5892
+ EIP712Domain: getTypesForEIP712Domain({ domain: domain3 }),
5833
5893
  ...parameters.types
5834
5894
  };
5835
5895
  validateTypedData({
5836
- domain: domain2,
5896
+ domain: domain3,
5837
5897
  message,
5838
5898
  primaryType,
5839
5899
  types
5840
5900
  });
5841
5901
  const parts = ["0x1901"];
5842
- if (domain2)
5902
+ if (domain3)
5843
5903
  parts.push(hashDomain({
5844
- domain: domain2,
5904
+ domain: domain3,
5845
5905
  types
5846
5906
  }));
5847
5907
  if (primaryType !== "EIP712Domain")
@@ -5852,9 +5912,9 @@ function hashTypedData(parameters) {
5852
5912
  }));
5853
5913
  return keccak256(concat(parts));
5854
5914
  }
5855
- function hashDomain({ domain: domain2, types }) {
5915
+ function hashDomain({ domain: domain3, types }) {
5856
5916
  return hashStruct({
5857
- data: domain2,
5917
+ data: domain3,
5858
5918
  primaryType: "EIP712Domain",
5859
5919
  types
5860
5920
  });
@@ -5870,12 +5930,12 @@ function hashStruct({ data, primaryType, types }) {
5870
5930
  function encodeData({ data, primaryType, types }) {
5871
5931
  const encodedTypes = [{ type: "bytes32" }];
5872
5932
  const encodedValues = [hashType({ primaryType, types })];
5873
- for (const field of types[primaryType]) {
5933
+ for (const field2 of types[primaryType]) {
5874
5934
  const [type, value] = encodeField({
5875
5935
  types,
5876
- name: field.name,
5877
- type: field.type,
5878
- value: data[field.name]
5936
+ name: field2.name,
5937
+ type: field2.type,
5938
+ value: data[field2.name]
5879
5939
  });
5880
5940
  encodedTypes.push(type);
5881
5941
  encodedValues.push(value);
@@ -5902,8 +5962,8 @@ function findTypeDependencies({ primaryType: primaryType_, types }, results = /*
5902
5962
  return results;
5903
5963
  }
5904
5964
  results.add(primaryType);
5905
- for (const field of types[primaryType]) {
5906
- findTypeDependencies({ primaryType: field.type, types }, results);
5965
+ for (const field2 of types[primaryType]) {
5966
+ findTypeDependencies({ primaryType: field2.type, types }, results);
5907
5967
  }
5908
5968
  return results;
5909
5969
  }
@@ -6107,44 +6167,44 @@ var init_formatAbiItem2 = __esm({
6107
6167
  });
6108
6168
 
6109
6169
  // node_modules/abitype/dist/esm/human-readable/runtime/signatures.js
6110
- function isErrorSignature(signature2) {
6111
- return errorSignatureRegex.test(signature2);
6170
+ function isErrorSignature(signature3) {
6171
+ return errorSignatureRegex.test(signature3);
6112
6172
  }
6113
- function execErrorSignature(signature2) {
6114
- return execTyped(errorSignatureRegex, signature2);
6173
+ function execErrorSignature(signature3) {
6174
+ return execTyped(errorSignatureRegex, signature3);
6115
6175
  }
6116
- function isEventSignature(signature2) {
6117
- return eventSignatureRegex.test(signature2);
6176
+ function isEventSignature(signature3) {
6177
+ return eventSignatureRegex.test(signature3);
6118
6178
  }
6119
- function execEventSignature(signature2) {
6120
- return execTyped(eventSignatureRegex, signature2);
6179
+ function execEventSignature(signature3) {
6180
+ return execTyped(eventSignatureRegex, signature3);
6121
6181
  }
6122
- function isFunctionSignature(signature2) {
6123
- return functionSignatureRegex.test(signature2);
6182
+ function isFunctionSignature(signature3) {
6183
+ return functionSignatureRegex.test(signature3);
6124
6184
  }
6125
- function execFunctionSignature(signature2) {
6126
- return execTyped(functionSignatureRegex, signature2);
6185
+ function execFunctionSignature(signature3) {
6186
+ return execTyped(functionSignatureRegex, signature3);
6127
6187
  }
6128
- function isStructSignature(signature2) {
6129
- return structSignatureRegex.test(signature2);
6188
+ function isStructSignature(signature3) {
6189
+ return structSignatureRegex.test(signature3);
6130
6190
  }
6131
- function execStructSignature(signature2) {
6132
- return execTyped(structSignatureRegex, signature2);
6191
+ function execStructSignature(signature3) {
6192
+ return execTyped(structSignatureRegex, signature3);
6133
6193
  }
6134
- function isConstructorSignature(signature2) {
6135
- return constructorSignatureRegex.test(signature2);
6194
+ function isConstructorSignature(signature3) {
6195
+ return constructorSignatureRegex.test(signature3);
6136
6196
  }
6137
- function execConstructorSignature(signature2) {
6138
- return execTyped(constructorSignatureRegex, signature2);
6197
+ function execConstructorSignature(signature3) {
6198
+ return execTyped(constructorSignatureRegex, signature3);
6139
6199
  }
6140
- function isFallbackSignature(signature2) {
6141
- return fallbackSignatureRegex.test(signature2);
6200
+ function isFallbackSignature(signature3) {
6201
+ return fallbackSignatureRegex.test(signature3);
6142
6202
  }
6143
- function execFallbackSignature(signature2) {
6144
- return execTyped(fallbackSignatureRegex, signature2);
6203
+ function execFallbackSignature(signature3) {
6204
+ return execTyped(fallbackSignatureRegex, signature3);
6145
6205
  }
6146
- function isReceiveSignature(signature2) {
6147
- return receiveSignatureRegex.test(signature2);
6206
+ function isReceiveSignature(signature3) {
6207
+ return receiveSignatureRegex.test(signature3);
6148
6208
  }
6149
6209
  var errorSignatureRegex, eventSignatureRegex, functionSignatureRegex, structSignatureRegex, constructorSignatureRegex, fallbackSignatureRegex, receiveSignatureRegex, modifiers, eventModifiers, functionModifiers;
6150
6210
  var init_signatures = __esm({
@@ -6178,9 +6238,9 @@ var init_abiItem = __esm({
6178
6238
  "node_modules/abitype/dist/esm/human-readable/errors/abiItem.js"() {
6179
6239
  init_errors();
6180
6240
  InvalidAbiItemError = class extends BaseError2 {
6181
- constructor({ signature: signature2 }) {
6241
+ constructor({ signature: signature3 }) {
6182
6242
  super("Failed to parse ABI item.", {
6183
- details: `parseAbiItem(${JSON.stringify(signature2, null, 2)})`,
6243
+ details: `parseAbiItem(${JSON.stringify(signature3, null, 2)})`,
6184
6244
  docsPath: "/api/human#parseabiitem-1"
6185
6245
  });
6186
6246
  Object.defineProperty(this, "name", {
@@ -6326,9 +6386,9 @@ var init_signature = __esm({
6326
6386
  "node_modules/abitype/dist/esm/human-readable/errors/signature.js"() {
6327
6387
  init_errors();
6328
6388
  InvalidSignatureError = class extends BaseError2 {
6329
- constructor({ signature: signature2, type }) {
6389
+ constructor({ signature: signature3, type }) {
6330
6390
  super(`Invalid ${type} signature.`, {
6331
- details: signature2
6391
+ details: signature3
6332
6392
  });
6333
6393
  Object.defineProperty(this, "name", {
6334
6394
  enumerable: true,
@@ -6339,9 +6399,9 @@ var init_signature = __esm({
6339
6399
  }
6340
6400
  };
6341
6401
  UnknownSignatureError = class extends BaseError2 {
6342
- constructor({ signature: signature2 }) {
6402
+ constructor({ signature: signature3 }) {
6343
6403
  super("Unknown signature.", {
6344
- details: signature2
6404
+ details: signature3
6345
6405
  });
6346
6406
  Object.defineProperty(this, "name", {
6347
6407
  enumerable: true,
@@ -6352,9 +6412,9 @@ var init_signature = __esm({
6352
6412
  }
6353
6413
  };
6354
6414
  InvalidStructSignatureError = class extends BaseError2 {
6355
- constructor({ signature: signature2 }) {
6415
+ constructor({ signature: signature3 }) {
6356
6416
  super("Invalid struct signature.", {
6357
- details: signature2,
6417
+ details: signature3,
6358
6418
  metaMessages: ["No properties exist."]
6359
6419
  });
6360
6420
  Object.defineProperty(this, "name", {
@@ -6491,28 +6551,28 @@ var init_cache = __esm({
6491
6551
  });
6492
6552
 
6493
6553
  // node_modules/abitype/dist/esm/human-readable/runtime/utils.js
6494
- function parseSignature(signature2, structs = {}) {
6495
- if (isFunctionSignature(signature2))
6496
- return parseFunctionSignature(signature2, structs);
6497
- if (isEventSignature(signature2))
6498
- return parseEventSignature(signature2, structs);
6499
- if (isErrorSignature(signature2))
6500
- return parseErrorSignature(signature2, structs);
6501
- if (isConstructorSignature(signature2))
6502
- return parseConstructorSignature(signature2, structs);
6503
- if (isFallbackSignature(signature2))
6504
- return parseFallbackSignature(signature2);
6505
- if (isReceiveSignature(signature2))
6554
+ function parseSignature(signature3, structs = {}) {
6555
+ if (isFunctionSignature(signature3))
6556
+ return parseFunctionSignature(signature3, structs);
6557
+ if (isEventSignature(signature3))
6558
+ return parseEventSignature(signature3, structs);
6559
+ if (isErrorSignature(signature3))
6560
+ return parseErrorSignature(signature3, structs);
6561
+ if (isConstructorSignature(signature3))
6562
+ return parseConstructorSignature(signature3, structs);
6563
+ if (isFallbackSignature(signature3))
6564
+ return parseFallbackSignature(signature3);
6565
+ if (isReceiveSignature(signature3))
6506
6566
  return {
6507
6567
  type: "receive",
6508
6568
  stateMutability: "payable"
6509
6569
  };
6510
- throw new UnknownSignatureError({ signature: signature2 });
6570
+ throw new UnknownSignatureError({ signature: signature3 });
6511
6571
  }
6512
- function parseFunctionSignature(signature2, structs = {}) {
6513
- const match = execFunctionSignature(signature2);
6572
+ function parseFunctionSignature(signature3, structs = {}) {
6573
+ const match = execFunctionSignature(signature3);
6514
6574
  if (!match)
6515
- throw new InvalidSignatureError({ signature: signature2, type: "function" });
6575
+ throw new InvalidSignatureError({ signature: signature3, type: "function" });
6516
6576
  const inputParams = splitParameters(match.parameters);
6517
6577
  const inputs = [];
6518
6578
  const inputLength = inputParams.length;
@@ -6543,10 +6603,10 @@ function parseFunctionSignature(signature2, structs = {}) {
6543
6603
  outputs
6544
6604
  };
6545
6605
  }
6546
- function parseEventSignature(signature2, structs = {}) {
6547
- const match = execEventSignature(signature2);
6606
+ function parseEventSignature(signature3, structs = {}) {
6607
+ const match = execEventSignature(signature3);
6548
6608
  if (!match)
6549
- throw new InvalidSignatureError({ signature: signature2, type: "event" });
6609
+ throw new InvalidSignatureError({ signature: signature3, type: "event" });
6550
6610
  const params = splitParameters(match.parameters);
6551
6611
  const abiParameters = [];
6552
6612
  const length = params.length;
@@ -6558,10 +6618,10 @@ function parseEventSignature(signature2, structs = {}) {
6558
6618
  }));
6559
6619
  return { name: match.name, type: "event", inputs: abiParameters };
6560
6620
  }
6561
- function parseErrorSignature(signature2, structs = {}) {
6562
- const match = execErrorSignature(signature2);
6621
+ function parseErrorSignature(signature3, structs = {}) {
6622
+ const match = execErrorSignature(signature3);
6563
6623
  if (!match)
6564
- throw new InvalidSignatureError({ signature: signature2, type: "error" });
6624
+ throw new InvalidSignatureError({ signature: signature3, type: "error" });
6565
6625
  const params = splitParameters(match.parameters);
6566
6626
  const abiParameters = [];
6567
6627
  const length = params.length;
@@ -6569,10 +6629,10 @@ function parseErrorSignature(signature2, structs = {}) {
6569
6629
  abiParameters.push(parseAbiParameter(params[i], { structs, type: "error" }));
6570
6630
  return { name: match.name, type: "error", inputs: abiParameters };
6571
6631
  }
6572
- function parseConstructorSignature(signature2, structs = {}) {
6573
- const match = execConstructorSignature(signature2);
6632
+ function parseConstructorSignature(signature3, structs = {}) {
6633
+ const match = execConstructorSignature(signature3);
6574
6634
  if (!match)
6575
- throw new InvalidSignatureError({ signature: signature2, type: "constructor" });
6635
+ throw new InvalidSignatureError({ signature: signature3, type: "constructor" });
6576
6636
  const params = splitParameters(match.parameters);
6577
6637
  const abiParameters = [];
6578
6638
  const length = params.length;
@@ -6584,10 +6644,10 @@ function parseConstructorSignature(signature2, structs = {}) {
6584
6644
  inputs: abiParameters
6585
6645
  };
6586
6646
  }
6587
- function parseFallbackSignature(signature2) {
6588
- const match = execFallbackSignature(signature2);
6647
+ function parseFallbackSignature(signature3) {
6648
+ const match = execFallbackSignature(signature3);
6589
6649
  if (!match)
6590
- throw new InvalidSignatureError({ signature: signature2, type: "fallback" });
6650
+ throw new InvalidSignatureError({ signature: signature3, type: "fallback" });
6591
6651
  return {
6592
6652
  type: "fallback",
6593
6653
  stateMutability: match.stateMutability ?? "nonpayable"
@@ -6706,12 +6766,12 @@ function parseStructs(signatures) {
6706
6766
  const shallowStructs = {};
6707
6767
  const signaturesLength = signatures.length;
6708
6768
  for (let i = 0; i < signaturesLength; i++) {
6709
- const signature2 = signatures[i];
6710
- if (!isStructSignature(signature2))
6769
+ const signature3 = signatures[i];
6770
+ if (!isStructSignature(signature3))
6711
6771
  continue;
6712
- const match = execStructSignature(signature2);
6772
+ const match = execStructSignature(signature3);
6713
6773
  if (!match)
6714
- throw new InvalidSignatureError({ signature: signature2, type: "struct" });
6774
+ throw new InvalidSignatureError({ signature: signature3, type: "struct" });
6715
6775
  const properties = match.properties.split(";");
6716
6776
  const components = [];
6717
6777
  const propertiesLength = properties.length;
@@ -6726,7 +6786,7 @@ function parseStructs(signatures) {
6726
6786
  components.push(abiParameter);
6727
6787
  }
6728
6788
  if (!components.length)
6729
- throw new InvalidStructSignatureError({ signature: signature2 });
6789
+ throw new InvalidStructSignatureError({ signature: signature3 });
6730
6790
  shallowStructs[match.name] = components;
6731
6791
  }
6732
6792
  const resolvedStructs = {};
@@ -6789,10 +6849,10 @@ function parseAbi(signatures) {
6789
6849
  const abi3 = [];
6790
6850
  const length = signatures.length;
6791
6851
  for (let i = 0; i < length; i++) {
6792
- const signature2 = signatures[i];
6793
- if (isStructSignature(signature2))
6852
+ const signature3 = signatures[i];
6853
+ if (isStructSignature(signature3))
6794
6854
  continue;
6795
- abi3.push(parseSignature(signature2, structs));
6855
+ abi3.push(parseSignature(signature3, structs));
6796
6856
  }
6797
6857
  return abi3;
6798
6858
  }
@@ -6805,15 +6865,15 @@ var init_parseAbi = __esm({
6805
6865
  });
6806
6866
 
6807
6867
  // node_modules/abitype/dist/esm/human-readable/parseAbiItem.js
6808
- function parseAbiItem(signature2) {
6868
+ function parseAbiItem(signature3) {
6809
6869
  let abiItem;
6810
- if (typeof signature2 === "string")
6811
- abiItem = parseSignature(signature2);
6870
+ if (typeof signature3 === "string")
6871
+ abiItem = parseSignature(signature3);
6812
6872
  else {
6813
- const structs = parseStructs(signature2);
6814
- const length = signature2.length;
6873
+ const structs = parseStructs(signature3);
6874
+ const length = signature3.length;
6815
6875
  for (let i = 0; i < length; i++) {
6816
- const signature_ = signature2[i];
6876
+ const signature_ = signature3[i];
6817
6877
  if (isStructSignature(signature_))
6818
6878
  continue;
6819
6879
  abiItem = parseSignature(signature_, structs);
@@ -6821,7 +6881,7 @@ function parseAbiItem(signature2) {
6821
6881
  }
6822
6882
  }
6823
6883
  if (!abiItem)
6824
- throw new InvalidAbiItemError({ signature: signature2 });
6884
+ throw new InvalidAbiItemError({ signature: signature3 });
6825
6885
  return abiItem;
6826
6886
  }
6827
6887
  var init_parseAbiItem = __esm({
@@ -6846,10 +6906,10 @@ function parseAbiParameters(params) {
6846
6906
  const structs = parseStructs(params);
6847
6907
  const length = params.length;
6848
6908
  for (let i = 0; i < length; i++) {
6849
- const signature2 = params[i];
6850
- if (isStructSignature(signature2))
6909
+ const signature3 = params[i];
6910
+ if (isStructSignature(signature3))
6851
6911
  continue;
6852
- const parameters = splitParameters(signature2);
6912
+ const parameters = splitParameters(signature3);
6853
6913
  const length2 = parameters.length;
6854
6914
  for (let k = 0; k < length2; k++) {
6855
6915
  abiParameters.push(parseAbiParameter(parameters[k], { modifiers, structs }));
@@ -6925,14 +6985,14 @@ var init_hashSignature = __esm({
6925
6985
  });
6926
6986
 
6927
6987
  // node_modules/viem/_esm/utils/hash/normalizeSignature.js
6928
- function normalizeSignature(signature2) {
6988
+ function normalizeSignature(signature3) {
6929
6989
  let active = true;
6930
6990
  let current = "";
6931
6991
  let level = 0;
6932
6992
  let result = "";
6933
6993
  let valid = false;
6934
- for (let i = 0; i < signature2.length; i++) {
6935
- const char = signature2[i];
6994
+ for (let i = 0; i < signature3.length; i++) {
6995
+ const char = signature3[i];
6936
6996
  if (["(", ")", ","].includes(char))
6937
6997
  active = true;
6938
6998
  if (char === "(")
@@ -7186,8 +7246,8 @@ function encodeEventTopics(parameters) {
7186
7246
  if (abiItem.anonymous)
7187
7247
  return topics;
7188
7248
  const definition = formatAbiItem(abiItem);
7189
- const signature2 = toEventSelector(definition);
7190
- return [signature2, ...topics];
7249
+ const signature3 = toEventSelector(definition);
7250
+ return [signature3, ...topics];
7191
7251
  }
7192
7252
  function encodeArg({ param, value }) {
7193
7253
  if (param.type === "string")
@@ -7309,9 +7369,9 @@ function encodeFunctionData(parameters) {
7309
7369
  return prepareEncodeFunctionData(parameters);
7310
7370
  })();
7311
7371
  const abiItem = abi3[0];
7312
- const signature2 = functionName;
7372
+ const signature3 = functionName;
7313
7373
  const data = "inputs" in abiItem && abiItem.inputs ? encodeAbiParameters(abiItem.inputs, args ?? []) : void 0;
7314
- return concatHex([signature2, data ?? "0x"]);
7374
+ return concatHex([signature3, data ?? "0x"]);
7315
7375
  }
7316
7376
  var init_encodeFunctionData = __esm({
7317
7377
  "node_modules/viem/_esm/utils/abi/encodeFunctionData.js"() {
@@ -7612,13 +7672,13 @@ var init_decodeAbiParameters = __esm({
7612
7672
  // node_modules/viem/_esm/utils/abi/decodeErrorResult.js
7613
7673
  function decodeErrorResult(parameters) {
7614
7674
  const { abi: abi3, data, cause } = parameters;
7615
- const signature2 = slice(data, 0, 4);
7616
- if (signature2 === "0x")
7675
+ const signature3 = slice(data, 0, 4);
7676
+ if (signature3 === "0x")
7617
7677
  throw new AbiDecodingZeroDataError({ cause });
7618
7678
  const abi_ = [...abi3 || [], solidityError, solidityPanic];
7619
- const abiItem = abi_.find((x) => x.type === "error" && signature2 === toFunctionSelector(formatAbiItem(x)));
7679
+ const abiItem = abi_.find((x) => x.type === "error" && signature3 === toFunctionSelector(formatAbiItem(x)));
7620
7680
  if (!abiItem)
7621
- throw new AbiErrorSignatureNotFoundError(signature2, {
7681
+ throw new AbiErrorSignatureNotFoundError(signature3, {
7622
7682
  docsPath: "/docs/contract/decodeErrorResult",
7623
7683
  cause
7624
7684
  });
@@ -7902,18 +7962,18 @@ ${prettyStateOverride(stateOverride)}`;
7902
7962
  }
7903
7963
  } else if (message)
7904
7964
  reason = message;
7905
- let signature2;
7965
+ let signature3;
7906
7966
  if (cause instanceof AbiErrorSignatureNotFoundError) {
7907
- signature2 = cause.signature;
7967
+ signature3 = cause.signature;
7908
7968
  metaMessages = [
7909
- `Unable to decode signature "${signature2}" as it was not found on the provided ABI.`,
7969
+ `Unable to decode signature "${signature3}" as it was not found on the provided ABI.`,
7910
7970
  "Make sure you are using the correct ABI and that the error exists on it.",
7911
- `You can look up the decoded signature here: https://4byte.sourcify.dev/?q=${signature2}.`
7971
+ `You can look up the decoded signature here: https://4byte.sourcify.dev/?q=${signature3}.`
7912
7972
  ];
7913
7973
  }
7914
- super(reason && reason !== "execution reverted" || signature2 ? [
7915
- `The contract function "${functionName}" reverted with the following ${signature2 ? "signature" : "reason"}:`,
7916
- reason || signature2
7974
+ super(reason && reason !== "execution reverted" || signature3 ? [
7975
+ `The contract function "${functionName}" reverted with the following ${signature3 ? "signature" : "reason"}:`,
7976
+ reason || signature3
7917
7977
  ].join("\n") : `The contract function "${functionName}" reverted.`, {
7918
7978
  cause: cause ?? error62,
7919
7979
  metaMessages,
@@ -7946,7 +8006,7 @@ ${prettyStateOverride(stateOverride)}`;
7946
8006
  this.data = decodedData;
7947
8007
  this.raw = data;
7948
8008
  this.reason = reason;
7949
- this.signature = signature2;
8009
+ this.signature = signature3;
7950
8010
  }
7951
8011
  };
7952
8012
  ContractFunctionZeroDataError = class extends BaseError {
@@ -8625,17 +8685,17 @@ var init_getContractError = __esm({
8625
8685
  });
8626
8686
 
8627
8687
  // node_modules/viem/_esm/utils/signature/recoverPublicKey.js
8628
- async function recoverPublicKey({ hash: hash5, signature: signature2 }) {
8629
- const hashHex = isHex(hash5) ? hash5 : toHex(hash5);
8688
+ async function recoverPublicKey({ hash: hash6, signature: signature3 }) {
8689
+ const hashHex = isHex(hash6) ? hash6 : toHex(hash6);
8630
8690
  const { secp256k1: secp256k12 } = await Promise.resolve().then(() => (init_secp256k1(), secp256k1_exports));
8631
8691
  const signature_ = (() => {
8632
- if (typeof signature2 === "object" && "r" in signature2 && "s" in signature2) {
8633
- const { r, s, v: v2, yParity } = signature2;
8692
+ if (typeof signature3 === "object" && "r" in signature3 && "s" in signature3) {
8693
+ const { r, s, v: v2, yParity } = signature3;
8634
8694
  const yParityOrV2 = Number(yParity ?? v2);
8635
8695
  const recoveryBit2 = toRecoveryBit(yParityOrV2);
8636
8696
  return new secp256k12.Signature(hexToBigInt(r), hexToBigInt(s)).addRecoveryBit(recoveryBit2);
8637
8697
  }
8638
- const signatureHex = isHex(signature2) ? signature2 : toHex(signature2);
8698
+ const signatureHex = isHex(signature3) ? signature3 : toHex(signature3);
8639
8699
  if (size(signatureHex) !== 65)
8640
8700
  throw new Error("invalid signature length");
8641
8701
  const yParityOrV = hexToNumber2(`0x${signatureHex.slice(130)}`);
@@ -8664,8 +8724,8 @@ var init_recoverPublicKey = __esm({
8664
8724
  });
8665
8725
 
8666
8726
  // node_modules/viem/_esm/utils/signature/recoverAddress.js
8667
- async function recoverAddress({ hash: hash5, signature: signature2 }) {
8668
- return publicKeyToAddress(await recoverPublicKey({ hash: hash5, signature: signature2 }));
8727
+ async function recoverAddress({ hash: hash6, signature: signature3 }) {
8728
+ return publicKeyToAddress(await recoverPublicKey({ hash: hash6, signature: signature3 }));
8669
8729
  }
8670
8730
  var init_recoverAddress = __esm({
8671
8731
  "node_modules/viem/_esm/utils/signature/recoverAddress.js"() {
@@ -8676,10 +8736,10 @@ var init_recoverAddress = __esm({
8676
8736
 
8677
8737
  // node_modules/viem/_esm/utils/authorization/recoverAuthorizationAddress.js
8678
8738
  async function recoverAuthorizationAddress(parameters) {
8679
- const { authorization, signature: signature2 } = parameters;
8739
+ const { authorization, signature: signature3 } = parameters;
8680
8740
  return recoverAddress({
8681
8741
  hash: hashAuthorization(authorization),
8682
- signature: signature2 ?? authorization
8742
+ signature: signature3 ?? authorization
8683
8743
  });
8684
8744
  }
8685
8745
  var init_recoverAuthorizationAddress = __esm({
@@ -9551,14 +9611,14 @@ async function prepareTransactionRequest(client, args) {
9551
9611
  return false;
9552
9612
  })();
9553
9613
  const fillResult = attemptFill ? await getAction(client, fillTransaction, "fillTransaction")({ ...request, nonce }).then((result) => {
9554
- const { chainId: chainId2, from: from15, gas: gas2, gasPrice, nonce: nonce2, maxFeePerBlobGas, maxFeePerGas, maxPriorityFeePerGas, type: type2, ...rest } = result.transaction;
9614
+ const { chainId: chainId2, from: from16, gas: gas2, gasPrice, nonce: nonce2, maxFeePerBlobGas, maxFeePerGas, maxPriorityFeePerGas, type: type2, ...rest } = result.transaction;
9555
9615
  const feeToken = "feeToken" in rest ? rest.feeToken : void 0;
9556
9616
  const hasFilledFeePayerSignature = "feePayerSignature" in rest && rest.feePayerSignature !== null && typeof rest.feePayerSignature !== "undefined";
9557
9617
  const shouldUseFilledFeeToken = typeof feeToken !== "undefined" && feeToken !== null && (!("feeToken" in request) || hasFilledFeePayerSignature);
9558
9618
  supportsFillTransaction.set(client.uid, true);
9559
9619
  return {
9560
9620
  ...request,
9561
- ...from15 ? { from: from15 } : {},
9621
+ ...from16 ? { from: from16 } : {},
9562
9622
  ...type2 && !request.type ? { type: type2 } : {},
9563
9623
  ...typeof chainId2 !== "undefined" ? { chainId: chainId2 } : {},
9564
9624
  ...typeof gas2 !== "undefined" ? { gas: gas2 } : {},
@@ -9894,12 +9954,12 @@ var init_log2 = __esm({
9894
9954
  function decodeEventLog(parameters) {
9895
9955
  const { abi: abi3, data, strict: strict_, topics } = parameters;
9896
9956
  const strict = strict_ ?? true;
9897
- const [signature2, ...argTopics] = topics;
9898
- if (!signature2)
9957
+ const [signature3, ...argTopics] = topics;
9958
+ if (!signature3)
9899
9959
  throw new AbiEventSignatureEmptyTopicsError({ docsPath: docsPath3 });
9900
- const abiItem = abi3.find((x) => x.type === "event" && signature2 === toEventSelector(formatAbiItem(x)));
9960
+ const abiItem = abi3.find((x) => x.type === "event" && signature3 === toEventSelector(formatAbiItem(x)));
9901
9961
  if (!(abiItem && "name" in abiItem) || abiItem.type !== "event")
9902
- throw new AbiEventSignatureNotFoundError(signature2, { docsPath: docsPath3 });
9962
+ throw new AbiEventSignatureNotFoundError(signature3, { docsPath: docsPath3 });
9903
9963
  const { name, inputs } = abiItem;
9904
9964
  const isUnnamed = inputs?.some((x) => !("name" in x && x.name));
9905
9965
  const args = isUnnamed ? [] : {};
@@ -10537,7 +10597,7 @@ function assert2(value) {
10537
10597
  if (value.BYTES_PER_ELEMENT !== 1 || value.constructor.name !== "Uint8Array")
10538
10598
  throw new InvalidBytesTypeError(value);
10539
10599
  }
10540
- function from(value) {
10600
+ function from2(value) {
10541
10601
  if (value instanceof Uint8Array)
10542
10602
  return value;
10543
10603
  if (typeof value === "string")
@@ -10733,7 +10793,7 @@ function assert3(value, options = {}) {
10733
10793
  function concat2(...values) {
10734
10794
  return `0x${values.reduce((acc, x) => acc + x.replace("0x", ""), "")}`;
10735
10795
  }
10736
- function from2(value) {
10796
+ function from3(value) {
10737
10797
  if (value instanceof Uint8Array)
10738
10798
  return fromBytes(value);
10739
10799
  if (Array.isArray(value))
@@ -11746,10 +11806,10 @@ var init_ccip = __esm({
11746
11806
  // node_modules/viem/_esm/utils/abi/decodeFunctionData.js
11747
11807
  function decodeFunctionData(parameters) {
11748
11808
  const { abi: abi3, data } = parameters;
11749
- const signature2 = slice(data, 0, 4);
11750
- const description = abi3.find((x) => x.type === "function" && signature2 === toFunctionSelector(formatAbiItem(x)));
11809
+ const signature3 = slice(data, 0, 4);
11810
+ const description = abi3.find((x) => x.type === "function" && signature3 === toFunctionSelector(formatAbiItem(x)));
11751
11811
  if (!description)
11752
- throw new AbiFunctionSignatureNotFoundError(signature2, {
11812
+ throw new AbiFunctionSignatureNotFoundError(signature3, {
11753
11813
  docsPath: "/docs/contract/decodeFunctionData"
11754
11814
  });
11755
11815
  return {
@@ -11780,14 +11840,14 @@ function encodeErrorResult(parameters) {
11780
11840
  if (abiItem.type !== "error")
11781
11841
  throw new AbiErrorNotFoundError(void 0, { docsPath: docsPath6 });
11782
11842
  const definition = formatAbiItem(abiItem);
11783
- const signature2 = toFunctionSelector(definition);
11843
+ const signature3 = toFunctionSelector(definition);
11784
11844
  let data = "0x";
11785
11845
  if (args && args.length > 0) {
11786
11846
  if (!abiItem.inputs)
11787
11847
  throw new AbiErrorInputsNotFoundError(abiItem.name, { docsPath: docsPath6 });
11788
11848
  data = encodeAbiParameters(abiItem.inputs, args);
11789
11849
  }
11790
- return concatHex([signature2, data]);
11850
+ return concatHex([signature3, data]);
11791
11851
  }
11792
11852
  var docsPath6;
11793
11853
  var init_encodeErrorResult = __esm({
@@ -12645,12 +12705,12 @@ function watchContractEvent(client, parameters) {
12645
12705
  for (const log of logs)
12646
12706
  emit.onLogs([log]);
12647
12707
  };
12648
- const getLogsInRange = (from15, to) => getAction(client, getContractEvents, "getContractEvents")({
12708
+ const getLogsInRange = (from16, to) => getAction(client, getContractEvents, "getContractEvents")({
12649
12709
  abi: abi3,
12650
12710
  address: address4,
12651
12711
  args,
12652
12712
  eventName,
12653
- fromBlock: from15,
12713
+ fromBlock: from16,
12654
12714
  toBlock: to,
12655
12715
  strict
12656
12716
  });
@@ -12681,17 +12741,17 @@ function watchContractEvent(client, parameters) {
12681
12741
  previousBlockNumber ??= blockNumber;
12682
12742
  let size5 = blockNumber - previousBlockNumber;
12683
12743
  while (previousBlockNumber < blockNumber) {
12684
- const from15 = previousBlockNumber + 1n;
12744
+ const from16 = previousBlockNumber + 1n;
12685
12745
  const end = previousBlockNumber + size5;
12686
12746
  const to = end < blockNumber ? end : blockNumber;
12687
- const logs = await getLogsInRange(from15, to).catch((error62) => {
12688
- if (from15 === to || !isRangeError(error62))
12747
+ const logs = await getLogsInRange(from16, to).catch((error62) => {
12748
+ if (from16 === to || !isRangeError(error62))
12689
12749
  throw error62;
12690
12750
  });
12691
12751
  if (!active)
12692
12752
  return;
12693
12753
  if (!logs) {
12694
- size5 = (to - from15 + 1n) / 2n;
12754
+ size5 = (to - from16 + 1n) / 2n;
12695
12755
  continue;
12696
12756
  }
12697
12757
  previousBlockNumber = to;
@@ -13005,10 +13065,10 @@ var init_Base64 = __esm({
13005
13065
  });
13006
13066
 
13007
13067
  // node_modules/viem/_esm/utils/authorization/verifyAuthorization.js
13008
- async function verifyAuthorization({ address: address4, authorization, signature: signature2 }) {
13068
+ async function verifyAuthorization({ address: address4, authorization, signature: signature3 }) {
13009
13069
  return isAddressEqual(getAddress(address4), await recoverAuthorizationAddress({
13010
13070
  authorization,
13011
- signature: signature2
13071
+ signature: signature3
13012
13072
  }));
13013
13073
  }
13014
13074
  var init_verifyAuthorization = __esm({
@@ -13161,9 +13221,9 @@ function buildRequest(request, options = {}) {
13161
13221
  delay: ({ count, error: error62 }) => {
13162
13222
  const retryAfter = getHttpError(error62)?.headers?.get("Retry-After");
13163
13223
  if (retryAfter) {
13164
- const seconds = Number.parseInt(retryAfter, 10);
13165
- if (!Number.isNaN(seconds))
13166
- return seconds * 1e3;
13224
+ const seconds2 = Number.parseInt(retryAfter, 10);
13225
+ if (!Number.isNaN(seconds2))
13226
+ return seconds2 * 1e3;
13167
13227
  const delay2 = Date.parse(retryAfter) - Date.now();
13168
13228
  if (delay2 > 0)
13169
13229
  return delay2;
@@ -13599,7 +13659,7 @@ var init_Caches = __esm({
13599
13659
  // node_modules/ox/_esm/core/Hash.js
13600
13660
  function keccak2562(value, options = {}) {
13601
13661
  const { as = typeof value === "string" ? "Hex" : "Bytes" } = options;
13602
- const bytes = keccak_256(from(value));
13662
+ const bytes = keccak_256(from2(value));
13603
13663
  if (as === "Bytes")
13604
13664
  return bytes;
13605
13665
  return fromBytes(bytes);
@@ -13634,7 +13694,7 @@ function assert4(publicKey, options = {}) {
13634
13694
  }
13635
13695
  throw new InvalidError({ publicKey });
13636
13696
  }
13637
- function from3(value) {
13697
+ function from4(value) {
13638
13698
  const publicKey = (() => {
13639
13699
  if (validate3(value))
13640
13700
  return fromHex2(value);
@@ -13756,7 +13816,7 @@ var init_PublicKey = __esm({
13756
13816
  super(`Value \`${publicKey}\` is an invalid public key size.`, {
13757
13817
  metaMessages: [
13758
13818
  "Expected: 33 bytes (compressed + prefix), 64 bytes (uncompressed) or 65 bytes (uncompressed + prefix).",
13759
- `Received ${size3(from2(publicKey))} bytes.`
13819
+ `Received ${size3(from3(publicKey))} bytes.`
13760
13820
  ]
13761
13821
  });
13762
13822
  Object.defineProperty(this, "name", {
@@ -13793,13 +13853,13 @@ function checksum2(address4) {
13793
13853
  return checksum.get(address4);
13794
13854
  assert5(address4, { strict: false });
13795
13855
  const hexAddress = address4.substring(2).toLowerCase();
13796
- const hash5 = keccak2562(fromString(hexAddress), { as: "Bytes" });
13856
+ const hash6 = keccak2562(fromString(hexAddress), { as: "Bytes" });
13797
13857
  const characters = hexAddress.split("");
13798
13858
  for (let i = 0; i < 40; i += 2) {
13799
- if (hash5[i >> 1] >> 4 >= 8 && characters[i]) {
13859
+ if (hash6[i >> 1] >> 4 >= 8 && characters[i]) {
13800
13860
  characters[i] = characters[i].toUpperCase();
13801
13861
  }
13802
- if ((hash5[i >> 1] & 15) >= 8 && characters[i + 1]) {
13862
+ if ((hash6[i >> 1] & 15) >= 8 && characters[i + 1]) {
13803
13863
  characters[i + 1] = characters[i + 1].toUpperCase();
13804
13864
  }
13805
13865
  }
@@ -13807,7 +13867,7 @@ function checksum2(address4) {
13807
13867
  checksum.set(address4, result);
13808
13868
  return result;
13809
13869
  }
13810
- function from4(address4, options = {}) {
13870
+ function from5(address4, options = {}) {
13811
13871
  const { checksum: checksumVal = false } = options;
13812
13872
  assert5(address4);
13813
13873
  if (checksumVal)
@@ -13816,7 +13876,7 @@ function from4(address4, options = {}) {
13816
13876
  }
13817
13877
  function fromPublicKey(publicKey, options = {}) {
13818
13878
  const address4 = keccak2562(`0x${toHex2(publicKey).slice(4)}`).substring(26);
13819
- return from4(`0x${address4}`, options);
13879
+ return from5(`0x${address4}`, options);
13820
13880
  }
13821
13881
  function validate4(address4, options = {}) {
13822
13882
  const { strict = true } = options ?? {};
@@ -14658,7 +14718,7 @@ function encodePacked(types, values) {
14658
14718
  }
14659
14719
  return concat2(...data);
14660
14720
  }
14661
- function from5(parameters) {
14721
+ function from6(parameters) {
14662
14722
  if (Array.isArray(parameters) && typeof parameters[0] === "string")
14663
14723
  return parseAbiParameters(parameters);
14664
14724
  if (typeof parameters === "string")
@@ -14813,7 +14873,7 @@ var init_AbiParameters = __esm({
14813
14873
  });
14814
14874
 
14815
14875
  // node_modules/ox/_esm/core/Rlp.js
14816
- function from6(value, options) {
14876
+ function from7(value, options) {
14817
14877
  const { as } = options;
14818
14878
  const encodable = getEncodable2(value);
14819
14879
  const cursor = create(new Uint8Array(encodable.length));
@@ -14824,7 +14884,7 @@ function from6(value, options) {
14824
14884
  }
14825
14885
  function fromHex3(hex3, options = {}) {
14826
14886
  const { as = "Hex" } = options;
14827
- return from6(hex3, { as });
14887
+ return from7(hex3, { as });
14828
14888
  }
14829
14889
  function getEncodable2(bytes) {
14830
14890
  if (Array.isArray(bytes))
@@ -14915,31 +14975,31 @@ var init_Rlp = __esm({
14915
14975
  });
14916
14976
 
14917
14977
  // node_modules/ox/_esm/core/Signature.js
14918
- function assert6(signature2, options = {}) {
14978
+ function assert6(signature3, options = {}) {
14919
14979
  const { recovered } = options;
14920
- if (typeof signature2.r === "undefined")
14921
- throw new MissingPropertiesError({ signature: signature2 });
14922
- if (typeof signature2.s === "undefined")
14923
- throw new MissingPropertiesError({ signature: signature2 });
14924
- if (recovered && typeof signature2.yParity === "undefined")
14925
- throw new MissingPropertiesError({ signature: signature2 });
14926
- if (signature2.r < 0n || signature2.r > maxUint2562)
14927
- throw new InvalidRError({ value: signature2.r });
14928
- if (signature2.s < 0n || signature2.s > maxUint2562)
14929
- throw new InvalidSError({ value: signature2.s });
14930
- if (typeof signature2.yParity === "number" && signature2.yParity !== 0 && signature2.yParity !== 1)
14931
- throw new InvalidYParityError({ value: signature2.yParity });
14932
- }
14933
- function fromBytes4(signature2) {
14934
- return fromHex4(fromBytes(signature2));
14935
- }
14936
- function fromHex4(signature2) {
14937
- if (signature2.length !== 130 && signature2.length !== 132)
14938
- throw new InvalidSerializedSizeError2({ signature: signature2 });
14939
- const r = BigInt(slice3(signature2, 0, 32));
14940
- const s = BigInt(slice3(signature2, 32, 64));
14980
+ if (typeof signature3.r === "undefined")
14981
+ throw new MissingPropertiesError({ signature: signature3 });
14982
+ if (typeof signature3.s === "undefined")
14983
+ throw new MissingPropertiesError({ signature: signature3 });
14984
+ if (recovered && typeof signature3.yParity === "undefined")
14985
+ throw new MissingPropertiesError({ signature: signature3 });
14986
+ if (signature3.r < 0n || signature3.r > maxUint2562)
14987
+ throw new InvalidRError({ value: signature3.r });
14988
+ if (signature3.s < 0n || signature3.s > maxUint2562)
14989
+ throw new InvalidSError({ value: signature3.s });
14990
+ if (typeof signature3.yParity === "number" && signature3.yParity !== 0 && signature3.yParity !== 1)
14991
+ throw new InvalidYParityError({ value: signature3.yParity });
14992
+ }
14993
+ function fromBytes4(signature3) {
14994
+ return fromHex4(fromBytes(signature3));
14995
+ }
14996
+ function fromHex4(signature3) {
14997
+ if (signature3.length !== 130 && signature3.length !== 132)
14998
+ throw new InvalidSerializedSizeError2({ signature: signature3 });
14999
+ const r = BigInt(slice3(signature3, 0, 32));
15000
+ const s = BigInt(slice3(signature3, 32, 64));
14941
15001
  const yParity = (() => {
14942
- const yParity2 = Number(`0x${signature2.slice(130)}`);
15002
+ const yParity2 = Number(`0x${signature3.slice(130)}`);
14943
15003
  if (Number.isNaN(yParity2))
14944
15004
  return void 0;
14945
15005
  try {
@@ -14964,47 +15024,47 @@ function extract2(value) {
14964
15024
  return void 0;
14965
15025
  if (typeof value.s === "undefined")
14966
15026
  return void 0;
14967
- return from7(value);
15027
+ return from8(value);
14968
15028
  }
14969
- function from7(signature2) {
15029
+ function from8(signature3) {
14970
15030
  const signature_ = (() => {
14971
- if (typeof signature2 === "string")
14972
- return fromHex4(signature2);
14973
- if (signature2 instanceof Uint8Array)
14974
- return fromBytes4(signature2);
14975
- if (typeof signature2.r === "string")
14976
- return fromRpc2(signature2);
14977
- if (signature2.v)
14978
- return fromLegacy(signature2);
15031
+ if (typeof signature3 === "string")
15032
+ return fromHex4(signature3);
15033
+ if (signature3 instanceof Uint8Array)
15034
+ return fromBytes4(signature3);
15035
+ if (typeof signature3.r === "string")
15036
+ return fromRpc2(signature3);
15037
+ if (signature3.v)
15038
+ return fromLegacy(signature3);
14979
15039
  return {
14980
- r: signature2.r,
14981
- s: signature2.s,
14982
- ...typeof signature2.yParity !== "undefined" ? { yParity: signature2.yParity } : {}
15040
+ r: signature3.r,
15041
+ s: signature3.s,
15042
+ ...typeof signature3.yParity !== "undefined" ? { yParity: signature3.yParity } : {}
14983
15043
  };
14984
15044
  })();
14985
15045
  assert6(signature_);
14986
15046
  return signature_;
14987
15047
  }
14988
- function fromLegacy(signature2) {
15048
+ function fromLegacy(signature3) {
14989
15049
  return {
14990
- r: signature2.r,
14991
- s: signature2.s,
14992
- yParity: vToYParity(signature2.v)
15050
+ r: signature3.r,
15051
+ s: signature3.s,
15052
+ yParity: vToYParity(signature3.v)
14993
15053
  };
14994
15054
  }
14995
- function fromRpc2(signature2) {
15055
+ function fromRpc2(signature3) {
14996
15056
  const yParity = (() => {
14997
- const v2 = signature2.v ? Number(signature2.v) : void 0;
14998
- let yParity2 = signature2.yParity ? Number(signature2.yParity) : void 0;
15057
+ const v2 = signature3.v ? Number(signature3.v) : void 0;
15058
+ let yParity2 = signature3.yParity ? Number(signature3.yParity) : void 0;
14999
15059
  if (typeof v2 === "number" && typeof yParity2 !== "number")
15000
15060
  yParity2 = vToYParity(v2);
15001
15061
  if (typeof yParity2 !== "number")
15002
- throw new InvalidYParityError({ value: signature2.yParity });
15062
+ throw new InvalidYParityError({ value: signature3.yParity });
15003
15063
  return yParity2;
15004
15064
  })();
15005
15065
  return {
15006
- r: BigInt(signature2.r),
15007
- s: BigInt(signature2.s),
15066
+ r: BigInt(signature3.r),
15067
+ s: BigInt(signature3.s),
15008
15068
  yParity
15009
15069
  };
15010
15070
  }
@@ -15025,11 +15085,11 @@ var init_Signature = __esm({
15025
15085
  init_Json();
15026
15086
  init_Solidity();
15027
15087
  InvalidSerializedSizeError2 = class extends BaseError3 {
15028
- constructor({ signature: signature2 }) {
15029
- super(`Value \`${signature2}\` is an invalid signature size.`, {
15088
+ constructor({ signature: signature3 }) {
15089
+ super(`Value \`${signature3}\` is an invalid signature size.`, {
15030
15090
  metaMessages: [
15031
15091
  "Expected: 64 bytes or 65 bytes.",
15032
- `Received ${size3(from2(signature2))} bytes.`
15092
+ `Received ${size3(from3(signature3))} bytes.`
15033
15093
  ]
15034
15094
  });
15035
15095
  Object.defineProperty(this, "name", {
@@ -15041,8 +15101,8 @@ var init_Signature = __esm({
15041
15101
  }
15042
15102
  };
15043
15103
  MissingPropertiesError = class extends BaseError3 {
15044
- constructor({ signature: signature2 }) {
15045
- super(`Signature \`${stringify2(signature2)}\` is missing either an \`r\`, \`s\`, or \`yParity\` property.`);
15104
+ constructor({ signature: signature3 }) {
15105
+ super(`Signature \`${stringify2(signature3)}\` is missing either an \`r\`, \`s\`, or \`yParity\` property.`);
15046
15106
  Object.defineProperty(this, "name", {
15047
15107
  enumerable: true,
15048
15108
  configurable: true,
@@ -15099,21 +15159,21 @@ var init_Signature = __esm({
15099
15159
  });
15100
15160
 
15101
15161
  // node_modules/ox/_esm/core/Authorization.js
15102
- function from8(authorization, options = {}) {
15162
+ function from9(authorization, options = {}) {
15103
15163
  if (typeof authorization.chainId === "string")
15104
15164
  return fromRpc3(authorization);
15105
15165
  return { ...authorization, ...options.signature };
15106
15166
  }
15107
15167
  function fromRpc3(authorization) {
15108
15168
  const { address: address4, chainId, nonce } = authorization;
15109
- const signature2 = fromRpc2(authorization);
15110
- assert6({ r: signature2.r, s: signature2.s });
15111
- assertYParity(signature2.yParity);
15169
+ const signature3 = fromRpc2(authorization);
15170
+ assert6({ r: signature3.r, s: signature3.s });
15171
+ assertYParity(signature3.yParity);
15112
15172
  return {
15113
15173
  address: address4,
15114
15174
  chainId: Number(chainId),
15115
15175
  nonce: BigInt(nonce),
15116
- ...signature2
15176
+ ...signature3
15117
15177
  };
15118
15178
  }
15119
15179
  function getSignPayload(authorization) {
@@ -15129,8 +15189,8 @@ function hash3(authorization, options = {}) {
15129
15189
  }
15130
15190
  function toTuple(authorization) {
15131
15191
  const { address: address4, chainId, nonce, r, s, yParity } = authorization;
15132
- const signature2 = extract2({ r, s });
15133
- if (signature2 && typeof yParity !== "undefined")
15192
+ const signature3 = extract2({ r, s });
15193
+ if (signature3 && typeof yParity !== "undefined")
15134
15194
  assertYParity(yParity);
15135
15195
  return [
15136
15196
  chainId ? fromNumber(chainId) : "0x",
@@ -15139,10 +15199,10 @@ function toTuple(authorization) {
15139
15199
  // EIP-7702 permits any `y_parity` below 2**8 in an authorization tuple, and a
15140
15200
  // tuple that fails recovery does not invalidate the transaction. Encode
15141
15201
  // `yParity` as is, so that serialization preserves the transaction hash.
15142
- ...signature2 ? [
15202
+ ...signature3 ? [
15143
15203
  yParity ? fromNumber(yParity, { size: 1 }) : "0x",
15144
- signature2.r === 0n ? "0x" : trimLeft2(fromNumber(signature2.r)),
15145
- signature2.s === 0n ? "0x" : trimLeft2(fromNumber(signature2.s))
15204
+ signature3.r === 0n ? "0x" : trimLeft2(fromNumber(signature3.r)),
15205
+ signature3.s === 0n ? "0x" : trimLeft2(fromNumber(signature3.s))
15146
15206
  ] : []
15147
15207
  ];
15148
15208
  }
@@ -15171,11 +15231,11 @@ function recoverAddress2(options) {
15171
15231
  return fromPublicKey(recoverPublicKey2(options));
15172
15232
  }
15173
15233
  function recoverPublicKey2(options) {
15174
- const { payload, signature: signature2 } = options;
15175
- const { r, s, yParity } = signature2;
15234
+ const { payload, signature: signature3 } = options;
15235
+ const { r, s, yParity } = signature3;
15176
15236
  const signature_ = new secp256k1.Signature(BigInt(r), BigInt(s)).addRecoveryBit(yParity);
15177
- const point = signature_.recoverPublicKey(from2(payload).substring(2));
15178
- return from3(point);
15237
+ const point = signature_.recoverPublicKey(from3(payload).substring(2));
15238
+ return from4(point);
15179
15239
  }
15180
15240
  var fromSeedDomain;
15181
15241
  var init_Secp256k1 = __esm({
@@ -15194,7 +15254,7 @@ var SignatureErc8010_exports = {};
15194
15254
  __export(SignatureErc8010_exports, {
15195
15255
  InvalidWrappedSignatureError: () => InvalidWrappedSignatureError,
15196
15256
  assert: () => assert7,
15197
- from: () => from9,
15257
+ from: () => from10,
15198
15258
  magicBytes: () => magicBytes,
15199
15259
  suffixParameters: () => suffixParameters,
15200
15260
  unwrap: () => unwrap,
@@ -15208,7 +15268,7 @@ function assert7(value) {
15208
15268
  } else
15209
15269
  assert6(value.authorization);
15210
15270
  }
15211
- function from9(value) {
15271
+ function from10(value) {
15212
15272
  if (typeof value === "string")
15213
15273
  return unwrap(value);
15214
15274
  return value;
@@ -15217,9 +15277,9 @@ function unwrap(wrapped) {
15217
15277
  assert7(wrapped);
15218
15278
  const suffixLength = toNumber(slice3(wrapped, -64, -32));
15219
15279
  const suffix = slice3(wrapped, -suffixLength - 64, -64);
15220
- const signature2 = slice3(wrapped, 0, -suffixLength - 64);
15280
+ const signature3 = slice3(wrapped, 0, -suffixLength - 64);
15221
15281
  const [auth, to, data] = decode3(suffixParameters, suffix);
15222
- const authorization = from8({
15282
+ const authorization = from9({
15223
15283
  address: auth.delegation,
15224
15284
  chainId: Number(auth.chainId),
15225
15285
  nonce: auth.nonce,
@@ -15229,16 +15289,16 @@ function unwrap(wrapped) {
15229
15289
  });
15230
15290
  return {
15231
15291
  authorization,
15232
- signature: signature2,
15292
+ signature: signature3,
15233
15293
  ...data && data !== "0x" ? { data, to } : {}
15234
15294
  };
15235
15295
  }
15236
15296
  function wrap(value) {
15237
- const { data, signature: signature2 } = value;
15297
+ const { data, signature: signature3 } = value;
15238
15298
  assert7(value);
15239
15299
  const self = recoverAddress2({
15240
15300
  payload: getSignPayload(value.authorization),
15241
- signature: from7(value.authorization)
15301
+ signature: from8(value.authorization)
15242
15302
  });
15243
15303
  const suffix = encode4(suffixParameters, [
15244
15304
  {
@@ -15250,7 +15310,7 @@ function wrap(value) {
15250
15310
  data ?? "0x"
15251
15311
  ]);
15252
15312
  const suffixLength = fromNumber(size3(suffix), { size: 32 });
15253
- return concat2(signature2, suffix, suffixLength, magicBytes);
15313
+ return concat2(signature3, suffix, suffixLength, magicBytes);
15254
15314
  }
15255
15315
  function validate5(value) {
15256
15316
  try {
@@ -15270,7 +15330,7 @@ var init_SignatureErc8010 = __esm({
15270
15330
  init_Secp256k1();
15271
15331
  init_Signature();
15272
15332
  magicBytes = "0x8010801080108010801080108010801080108010801080108010801080108010";
15273
- suffixParameters = from5("(uint256 chainId, address delegation, uint256 nonce, uint8 yParity, uint256 r, uint256 s), address to, bytes data");
15333
+ suffixParameters = from6("(uint256 chainId, address delegation, uint256 nonce, uint8 yParity, uint256 r, uint256 s), address to, bytes data");
15274
15334
  InvalidWrappedSignatureError = class extends BaseError3 {
15275
15335
  constructor(wrapped) {
15276
15336
  super(`Value \`${wrapped}\` is an invalid ERC-8010 wrapped signature.`);
@@ -15292,6 +15352,29 @@ var init_erc8010 = __esm({
15292
15352
  }
15293
15353
  });
15294
15354
 
15355
+ // node_modules/viem/_esm/utils/signature/recoverMessageAddress.js
15356
+ async function recoverMessageAddress({ message, signature: signature3 }) {
15357
+ return recoverAddress({ hash: hashMessage(message), signature: signature3 });
15358
+ }
15359
+ var init_recoverMessageAddress = __esm({
15360
+ "node_modules/viem/_esm/utils/signature/recoverMessageAddress.js"() {
15361
+ init_hashMessage();
15362
+ init_recoverAddress();
15363
+ }
15364
+ });
15365
+
15366
+ // node_modules/viem/_esm/utils/signature/verifyMessage.js
15367
+ async function verifyMessage({ address: address4, message, signature: signature3 }) {
15368
+ return isAddressEqual(getAddress(address4), await recoverMessageAddress({ message, signature: signature3 }));
15369
+ }
15370
+ var init_verifyMessage = __esm({
15371
+ "node_modules/viem/_esm/utils/signature/verifyMessage.js"() {
15372
+ init_getAddress();
15373
+ init_isAddressEqual();
15374
+ init_recoverMessageAddress();
15375
+ }
15376
+ });
15377
+
15295
15378
  // node_modules/viem/_esm/utils/unit/formatUnits.js
15296
15379
  function formatUnits(value, decimals) {
15297
15380
  return format(value, decimals);
@@ -15302,6 +15385,16 @@ var init_formatUnits = __esm({
15302
15385
  }
15303
15386
  });
15304
15387
 
15388
+ // node_modules/viem/_esm/utils/unit/parseUnits.js
15389
+ function parseUnits(value, decimals) {
15390
+ return from(value, decimals);
15391
+ }
15392
+ var init_parseUnits = __esm({
15393
+ "node_modules/viem/_esm/utils/unit/parseUnits.js"() {
15394
+ init_Value();
15395
+ }
15396
+ });
15397
+
15305
15398
  // node_modules/viem/_esm/utils/index.js
15306
15399
  var init_utils5 = __esm({
15307
15400
  "node_modules/viem/_esm/utils/index.js"() {
@@ -15311,14 +15404,14 @@ var init_utils5 = __esm({
15311
15404
  });
15312
15405
 
15313
15406
  // node_modules/viem/_esm/actions/public/getTransaction.js
15314
- async function getTransaction(client, { blockHash, blockNumber, blockTag: blockTag_, hash: hash5, index: index2, sender, nonce }) {
15407
+ async function getTransaction(client, { blockHash, blockNumber, blockTag: blockTag_, hash: hash6, index: index2, sender, nonce }) {
15315
15408
  const blockTag = blockTag_ || "latest";
15316
15409
  const blockNumberHex = blockNumber !== void 0 ? numberToHex(blockNumber) : void 0;
15317
15410
  let transaction = null;
15318
- if (hash5) {
15411
+ if (hash6) {
15319
15412
  transaction = await client.request({
15320
15413
  method: "eth_getTransactionByHash",
15321
- params: [hash5]
15414
+ params: [hash6]
15322
15415
  }, { dedupe: true });
15323
15416
  } else if (blockHash) {
15324
15417
  transaction = await client.request({
@@ -15341,7 +15434,7 @@ async function getTransaction(client, { blockHash, blockNumber, blockTag: blockT
15341
15434
  blockHash,
15342
15435
  blockNumber,
15343
15436
  blockTag,
15344
- hash: hash5,
15437
+ hash: hash6,
15345
15438
  index: index2
15346
15439
  });
15347
15440
  const format2 = client.chain?.formatters?.transaction?.format || formatTransaction;
@@ -15356,13 +15449,13 @@ var init_getTransaction = __esm({
15356
15449
  });
15357
15450
 
15358
15451
  // node_modules/viem/_esm/actions/public/getTransactionReceipt.js
15359
- async function getTransactionReceipt(client, { hash: hash5 }) {
15452
+ async function getTransactionReceipt(client, { hash: hash6 }) {
15360
15453
  const receipt = await client.request({
15361
15454
  method: "eth_getTransactionReceipt",
15362
- params: [hash5]
15455
+ params: [hash6]
15363
15456
  }, { dedupe: true });
15364
15457
  if (!receipt)
15365
- throw new TransactionReceiptNotFoundError({ hash: hash5 });
15458
+ throw new TransactionReceiptNotFoundError({ hash: hash6 });
15366
15459
  const format2 = client.chain?.formatters?.transactionReceipt?.format || formatTransactionReceipt;
15367
15460
  return format2(receipt, "getTransactionReceipt");
15368
15461
  }
@@ -15565,14 +15658,14 @@ var init_multicall = __esm({
15565
15658
  });
15566
15659
 
15567
15660
  // node_modules/ox/_esm/core/internal/abiItem.js
15568
- function normalizeSignature2(signature2) {
15661
+ function normalizeSignature2(signature3) {
15569
15662
  let active = true;
15570
15663
  let current = "";
15571
15664
  let level = 0;
15572
15665
  let result = "";
15573
15666
  let valid = false;
15574
- for (let i = 0; i < signature2.length; i++) {
15575
- const char = signature2[i];
15667
+ for (let i = 0; i < signature3.length; i++) {
15668
+ const char = signature3[i];
15576
15669
  if (["(", ")", ","].includes(char))
15577
15670
  active = true;
15578
15671
  if (char === "(")
@@ -15699,7 +15792,7 @@ var init_abiItem2 = __esm({
15699
15792
  });
15700
15793
 
15701
15794
  // node_modules/ox/_esm/core/AbiItem.js
15702
- function from10(abiItem, options = {}) {
15795
+ function from11(abiItem, options = {}) {
15703
15796
  const { prepare = true } = options;
15704
15797
  const item = (() => {
15705
15798
  if (Array.isArray(abiItem))
@@ -15803,12 +15896,12 @@ function getSignature(...parameters) {
15803
15896
  }
15804
15897
  return parameters[0];
15805
15898
  })();
15806
- const signature2 = (() => {
15899
+ const signature3 = (() => {
15807
15900
  if (typeof abiItem === "string")
15808
15901
  return abiItem;
15809
15902
  return formatAbiItem2(abiItem);
15810
15903
  })();
15811
- return normalizeSignature2(signature2);
15904
+ return normalizeSignature2(signature3);
15812
15905
  }
15813
15906
  function getSignatureHash(...parameters) {
15814
15907
  const abiItem = (() => {
@@ -15872,8 +15965,8 @@ var init_AbiItem = __esm({
15872
15965
  });
15873
15966
 
15874
15967
  // node_modules/ox/_esm/core/AbiEvent.js
15875
- function from12(abiEvent, options = {}) {
15876
- return from10(abiEvent, options);
15968
+ function from13(abiEvent, options = {}) {
15969
+ return from11(abiEvent, options);
15877
15970
  }
15878
15971
  function getSelector2(abiItem) {
15879
15972
  return getSignatureHash(abiItem);
@@ -16000,7 +16093,7 @@ async function waitForTransactionReceipt(client, parameters) {
16000
16093
  const {
16001
16094
  checkReplacement = client.chain?.supportsTransactionReplacementDetection ?? true,
16002
16095
  confirmations = 1,
16003
- hash: hash5,
16096
+ hash: hash6,
16004
16097
  onReplaced,
16005
16098
  retryCount = 6,
16006
16099
  retryDelay = ({ count }) => ~~(1 << count) * 200,
@@ -16019,7 +16112,7 @@ async function waitForTransactionReceipt(client, parameters) {
16019
16112
  const observerId = stringify([
16020
16113
  "waitForTransactionReceipt",
16021
16114
  client.uid,
16022
- hash5,
16115
+ hash6,
16023
16116
  // Concurrent calls with different behavior-defining options must not
16024
16117
  // share an observer: the first call's polling closure decides timeout,
16025
16118
  // confirmations, polling interval and replacement checks for everyone.
@@ -16042,10 +16135,10 @@ async function waitForTransactionReceipt(client, parameters) {
16042
16135
  const timer = timeout ? setTimeout(() => {
16043
16136
  _unwatch?.();
16044
16137
  _unobserve?.();
16045
- reject(new WaitForTransactionReceiptTimeoutError({ hash: hash5 }));
16138
+ reject(new WaitForTransactionReceiptTimeoutError({ hash: hash6 }));
16046
16139
  }, timeout) : void 0;
16047
16140
  _unobserve = observe(observerId, { onReplaced, resolve: resolve3, reject }, async (emit) => {
16048
- receipt = await getAction(client, getTransactionReceipt, "getTransactionReceipt")({ hash: hash5 }).catch(() => void 0);
16141
+ receipt = await getAction(client, getTransactionReceipt, "getTransactionReceipt")({ hash: hash6 }).catch(() => void 0);
16049
16142
  if (receipt && confirmations <= 1) {
16050
16143
  clearTimeout(timer);
16051
16144
  emit.resolve(receipt);
@@ -16081,7 +16174,7 @@ async function waitForTransactionReceipt(client, parameters) {
16081
16174
  if (checkReplacement && !transaction) {
16082
16175
  retrying = true;
16083
16176
  await withRetry(async () => {
16084
- transaction = await getAction(client, getTransaction, "getTransaction")({ hash: hash5 });
16177
+ transaction = await getAction(client, getTransaction, "getTransaction")({ hash: hash6 });
16085
16178
  if (transaction.blockNumber)
16086
16179
  blockNumber = transaction.blockNumber;
16087
16180
  }, {
@@ -16093,7 +16186,7 @@ async function waitForTransactionReceipt(client, parameters) {
16093
16186
  });
16094
16187
  retrying = false;
16095
16188
  }
16096
- receipt = await getAction(client, getTransactionReceipt, "getTransactionReceipt")({ hash: hash5 });
16189
+ receipt = await getAction(client, getTransactionReceipt, "getTransactionReceipt")({ hash: hash6 });
16097
16190
  if (confirmations > 1 && (!receipt.blockNumber || blockNumber - receipt.blockNumber + 1n < confirmations))
16098
16191
  return;
16099
16192
  done(() => emit.resolve(receipt));
@@ -16102,7 +16195,7 @@ async function waitForTransactionReceipt(client, parameters) {
16102
16195
  retrying = false;
16103
16196
  const replaced = transaction ?? (checkReplacement && replacement ? {
16104
16197
  ...replacement,
16105
- hash: hash5.toLowerCase()
16198
+ hash: hash6.toLowerCase()
16106
16199
  } : void 0);
16107
16200
  if (!replaced)
16108
16201
  return;
@@ -16224,8 +16317,8 @@ var init_waitForTransactionReceipt = __esm({
16224
16317
  });
16225
16318
 
16226
16319
  // node_modules/viem/_esm/actions/token/internal.js
16227
- function toAmount(amount3, decimals) {
16228
- return { amount: amount3, decimals, formatted: formatUnits(amount3, decimals) };
16320
+ function toAmount(amount4, decimals) {
16321
+ return { amount: amount4, decimals, formatted: formatUnits(amount4, decimals) };
16229
16322
  }
16230
16323
  function resolveToken(client, parameters) {
16231
16324
  const { decimals, token } = parameters;
@@ -16475,12 +16568,12 @@ var require_common = __commonJS({
16475
16568
  createDebug.skips = [];
16476
16569
  createDebug.formatters = {};
16477
16570
  function selectColor(namespace) {
16478
- let hash5 = 0;
16571
+ let hash6 = 0;
16479
16572
  for (let i = 0; i < namespace.length; i++) {
16480
- hash5 = (hash5 << 5) - hash5 + namespace.charCodeAt(i);
16481
- hash5 |= 0;
16573
+ hash6 = (hash6 << 5) - hash6 + namespace.charCodeAt(i);
16574
+ hash6 |= 0;
16482
16575
  }
16483
- return createDebug.colors[Math.abs(hash5) % createDebug.colors.length];
16576
+ return createDebug.colors[Math.abs(hash6) % createDebug.colors.length];
16484
16577
  }
16485
16578
  createDebug.selectColor = selectColor;
16486
16579
  function createDebug(namespace) {
@@ -32099,8 +32192,8 @@ var require_text = __commonJS({
32099
32192
  var debug = require_src()("body-parser:text");
32100
32193
  var read = require_read();
32101
32194
  var { normalizeOptions, passthrough } = require_utils();
32102
- module.exports = text3;
32103
- function text3(options) {
32195
+ module.exports = text4;
32196
+ function text4(options) {
32104
32197
  const normalizedOptions = normalizeOptions(options, "text/plain");
32105
32198
  return function textParser(req, res, next) {
32106
32199
  read(req, res, next, passthrough, debug, normalizedOptions);
@@ -32246,10 +32339,10 @@ var require_object_inspect = __commonJS({
32246
32339
  } else if (indexOf(seen, obj) >= 0) {
32247
32340
  return "[Circular]";
32248
32341
  }
32249
- function inspect(value, from15, noIndent) {
32250
- if (from15) {
32342
+ function inspect(value, from16, noIndent) {
32343
+ if (from16) {
32251
32344
  seen = $arrSlice.call(seen);
32252
- seen.push(from15);
32345
+ seen.push(from16);
32253
32346
  }
32254
32347
  if (noIndent) {
32255
32348
  var newOpts = {
@@ -34212,8 +34305,8 @@ var require_stringify = __commonJS({
34212
34305
  formatter: formats.formatters[defaultFormat],
34213
34306
  // deprecated
34214
34307
  indices: false,
34215
- serializeDate: function serializeDate(date7) {
34216
- return toISO.call(date7);
34308
+ serializeDate: function serializeDate(date8) {
34309
+ return toISO.call(date8);
34217
34310
  },
34218
34311
  skipNulls: false,
34219
34312
  strictNullHandling: false
@@ -35381,9 +35474,9 @@ var require_etag = __commonJS({
35381
35474
  if (entity.length === 0) {
35382
35475
  return '"0-2jmj7l5rSw0yVb/vlWAYkK/YBwk"';
35383
35476
  }
35384
- var hash5 = crypto3.createHash("sha1").update(entity, "utf8").digest("base64").substring(0, 27);
35477
+ var hash6 = crypto3.createHash("sha1").update(entity, "utf8").digest("base64").substring(0, 27);
35385
35478
  var len = typeof entity === "string" ? Buffer.byteLength(entity, "utf8") : entity.length;
35386
- return '"' + len.toString(16) + "-" + hash5 + '"';
35479
+ return '"' + len.toString(16) + "-" + hash6 + '"';
35387
35480
  }
35388
35481
  function etag(entity, options) {
35389
35482
  if (entity == null) {
@@ -36498,11 +36591,11 @@ var require_dist2 = __commonJS({
36498
36591
  exports.TokenData = TokenData;
36499
36592
  var PathError = class extends TypeError {
36500
36593
  constructor(message, originalPath) {
36501
- let text3 = message;
36594
+ let text4 = message;
36502
36595
  if (originalPath)
36503
- text3 += `: ${originalPath}`;
36504
- text3 += `; visit https://git.new/pathToRegexpError for info`;
36505
- super(text3);
36596
+ text4 += `: ${originalPath}`;
36597
+ text4 += `; visit https://git.new/pathToRegexpError for info`;
36598
+ super(text4);
36506
36599
  this.originalPath = originalPath;
36507
36600
  }
36508
36601
  };
@@ -38325,8 +38418,8 @@ var require_fresh = __commonJS({
38325
38418
  }
38326
38419
  return true;
38327
38420
  }
38328
- function parseHttpDate(date7) {
38329
- var timestamp = date7 && Date.parse(date7);
38421
+ function parseHttpDate(date8) {
38422
+ var timestamp = date8 && Date.parse(date8);
38330
38423
  return typeof timestamp === "number" ? timestamp : NaN;
38331
38424
  }
38332
38425
  function parseTokenList(str) {
@@ -39511,8 +39604,8 @@ var require_send = __commonJS({
39511
39604
  }
39512
39605
  return list;
39513
39606
  }
39514
- function parseHttpDate(date7) {
39515
- var timestamp = date7 && Date.parse(date7);
39607
+ function parseHttpDate(date8) {
39608
+ var timestamp = date8 && Date.parse(date8);
39516
39609
  return typeof timestamp === "number" ? timestamp : NaN;
39517
39610
  }
39518
39611
  function parseTokenList(str) {
@@ -39559,14 +39652,14 @@ var require_vary = __commonJS({
39559
39652
  module.exports = vary;
39560
39653
  module.exports.append = append;
39561
39654
  var FIELD_NAME_REGEXP = /^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/;
39562
- function append(header, field) {
39655
+ function append(header, field2) {
39563
39656
  if (typeof header !== "string") {
39564
39657
  throw new TypeError("header argument is required");
39565
39658
  }
39566
- if (!field) {
39659
+ if (!field2) {
39567
39660
  throw new TypeError("field argument is required");
39568
39661
  }
39569
- var fields = !Array.isArray(field) ? parse3(String(field)) : field;
39662
+ var fields = !Array.isArray(field2) ? parse3(String(field2)) : field2;
39570
39663
  for (var j = 0; j < fields.length; j++) {
39571
39664
  if (!FIELD_NAME_REGEXP.test(fields[j])) {
39572
39665
  throw new TypeError("field argument contains an invalid header name");
@@ -39612,13 +39705,13 @@ var require_vary = __commonJS({
39612
39705
  list.push(header.substring(start, end));
39613
39706
  return list;
39614
39707
  }
39615
- function vary(res, field) {
39708
+ function vary(res, field2) {
39616
39709
  if (!res || !res.getHeader || !res.setHeader) {
39617
39710
  throw new TypeError("res argument is required");
39618
39711
  }
39619
39712
  var val = res.getHeader("Vary") || "";
39620
39713
  var header = Array.isArray(val) ? val.join(", ") : String(val);
39621
- if (val = append(header, field)) {
39714
+ if (val = append(header, field2)) {
39622
39715
  res.setHeader("Vary", val);
39623
39716
  }
39624
39717
  }
@@ -39889,33 +39982,33 @@ var require_response = __commonJS({
39889
39982
  this.set("Content-Disposition", contentDisposition.create(name));
39890
39983
  return this;
39891
39984
  };
39892
- res.append = function append(field, val) {
39893
- var prev = this.get(field);
39985
+ res.append = function append(field2, val) {
39986
+ var prev = this.get(field2);
39894
39987
  var value = val;
39895
39988
  if (prev) {
39896
39989
  value = Array.isArray(prev) ? prev.concat(val) : Array.isArray(val) ? [prev].concat(val) : [prev, val];
39897
39990
  }
39898
- return this.set(field, value);
39991
+ return this.set(field2, value);
39899
39992
  };
39900
- res.set = res.header = function header(field, val) {
39993
+ res.set = res.header = function header(field2, val) {
39901
39994
  if (arguments.length === 2) {
39902
39995
  var value = Array.isArray(val) ? val.map(String) : String(val);
39903
- if (field.toLowerCase() === "content-type") {
39996
+ if (field2.toLowerCase() === "content-type") {
39904
39997
  if (Array.isArray(value)) {
39905
39998
  throw new TypeError("Content-Type cannot be set to an Array");
39906
39999
  }
39907
40000
  value = mime.contentType(value);
39908
40001
  }
39909
- this.setHeader(field, value);
40002
+ this.setHeader(field2, value);
39910
40003
  } else {
39911
- for (var key in field) {
39912
- this.set(key, field[key]);
40004
+ for (var key in field2) {
40005
+ this.set(key, field2[key]);
39913
40006
  }
39914
40007
  }
39915
40008
  return this;
39916
40009
  };
39917
- res.get = function(field) {
39918
- return this.getHeader(field);
40010
+ res.get = function(field2) {
40011
+ return this.getHeader(field2);
39919
40012
  };
39920
40013
  res.clearCookie = function clearCookie(name, options) {
39921
40014
  const opts = { path: "/", ...options, expires: /* @__PURE__ */ new Date(1) };
@@ -39987,8 +40080,8 @@ var require_response = __commonJS({
39987
40080
  this.end(body);
39988
40081
  }
39989
40082
  };
39990
- res.vary = function(field) {
39991
- vary(this, field);
40083
+ res.vary = function(field2) {
40084
+ vary(this, field2);
39992
40085
  return this;
39993
40086
  };
39994
40087
  res.render = function render(view, options, callback) {
@@ -43802,14 +43895,14 @@ var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
43802
43895
  const shape = zod.def.shape;
43803
43896
  const propValues = {};
43804
43897
  for (const key in shape) {
43805
- const field = shape[key]._zod;
43806
- if (field.values) {
43898
+ const field2 = shape[key]._zod;
43899
+ if (field2.values) {
43807
43900
  if (!Object.prototype.hasOwnProperty.call(propValues, key)) {
43808
43901
  assignProp(propValues, key, /* @__PURE__ */ new Set());
43809
43902
  }
43810
- for (const v2 of field.values)
43903
+ for (const v2 of field2.values)
43811
43904
  propValues[key].add(v2);
43812
- if (field.optin !== void 0)
43905
+ if (field2.optin !== void 0)
43813
43906
  propValues[key].add(void 0);
43814
43907
  }
43815
43908
  }
@@ -49603,8 +49696,8 @@ function ko_default() {
49603
49696
  }
49604
49697
 
49605
49698
  // node_modules/zod/v4/locales/lt.js
49606
- var capitalizeFirstCharacter = (text3) => {
49607
- return text3.charAt(0).toUpperCase() + text3.slice(1);
49699
+ var capitalizeFirstCharacter = (text4) => {
49700
+ return text4.charAt(0).toUpperCase() + text4.slice(1);
49608
49701
  };
49609
49702
  function getUnitTypeFromNumber(number4) {
49610
49703
  const abs = Math.abs(number4);
@@ -56747,8 +56840,8 @@ var objectProcessor = (schema, ctx, _json, params) => {
56747
56840
  }
56748
56841
  const requiredKeys = [];
56749
56842
  for (const key of Object.keys(shape)) {
56750
- const field = def.shape[key];
56751
- if (ctx.io === "input" ? inputOptin(field) === void 0 : field._zod.optout === void 0) {
56843
+ const field2 = def.shape[key];
56844
+ if (ctx.io === "input" ? inputOptin(field2) === void 0 : field2._zod.optout === void 0) {
56752
56845
  requiredKeys.push(key);
56753
56846
  }
56754
56847
  }
@@ -60079,11 +60172,11 @@ var RuntimeStore = class {
60079
60172
  writeNewPrivate(marker, { version: 1, id: randomUUID(), kind: create2 });
60080
60173
  closeSync(openSync(file2, "wx", 384));
60081
60174
  }
60082
- const identity = bindingSchema.parse(readPrivateJson(marker));
60175
+ const identity2 = bindingSchema.parse(readPrivateJson(marker));
60083
60176
  privateFile(file2);
60084
60177
  for (const suffix of ["-wal", "-shm", "-journal"]) if (existsSync(file2 + suffix)) privateFile(file2 + suffix);
60085
- this.id = identity.id;
60086
- this.kind = identity.kind;
60178
+ this.id = identity2.id;
60179
+ this.kind = identity2.kind;
60087
60180
  this.db = new DatabaseSync(file2, { open: true });
60088
60181
  try {
60089
60182
  this.db.exec("PRAGMA journal_mode=WAL; PRAGMA synchronous=FULL; PRAGMA busy_timeout=5000; PRAGMA foreign_keys=ON;");
@@ -60097,9 +60190,9 @@ var RuntimeStore = class {
60097
60190
  status TEXT NOT NULL,attempts INTEGER NOT NULL,result TEXT,replay TEXT NOT NULL,PRIMARY KEY(job,key));
60098
60191
  CREATE TABLE events(sequence INTEGER PRIMARY KEY AUTOINCREMENT,job TEXT NOT NULL,kind TEXT NOT NULL,code TEXT NOT NULL,at INTEGER NOT NULL);
60099
60192
  `);
60100
- this.put("identity", identity);
60193
+ this.put("identity", identity2);
60101
60194
  }
60102
- requireThat(canonical(this.get("identity")) === canonical(identity), "runtime_identity_mismatch");
60195
+ requireThat(canonical(this.get("identity")) === canonical(identity2), "runtime_identity_mismatch");
60103
60196
  requireThat(Object.values(this.db.prepare("PRAGMA quick_check").get() ?? {})[0] === "ok", "runtime_corrupt");
60104
60197
  } catch (error62) {
60105
60198
  this.db.close();
@@ -60156,10 +60249,10 @@ function serializeSignature({ r, s, to = "hex", v: v2, yParity }) {
60156
60249
  return v2 % 2n === 0n ? 1 : 0;
60157
60250
  throw new Error("Invalid `v` or `yParity` value");
60158
60251
  })();
60159
- const signature2 = `0x${new secp256k1.Signature(hexToBigInt(r), hexToBigInt(s)).toCompactHex()}${yParity_ === 0 ? "1b" : "1c"}`;
60252
+ const signature3 = `0x${new secp256k1.Signature(hexToBigInt(r), hexToBigInt(s)).toCompactHex()}${yParity_ === 0 ? "1b" : "1c"}`;
60160
60253
  if (to === "hex")
60161
- return signature2;
60162
- return hexToBytes2(signature2);
60254
+ return signature3;
60255
+ return hexToBytes2(signature3);
60163
60256
  }
60164
60257
 
60165
60258
  // node_modules/viem/_esm/accounts/generatePrivateKey.js
@@ -60209,12 +60302,12 @@ init_isHex();
60209
60302
  init_toBytes();
60210
60303
  init_toHex();
60211
60304
  var extraEntropy = false;
60212
- async function sign({ hash: hash5, privateKey, to = "object" }) {
60213
- const { r, s, recovery } = secp256k1.sign(hash5.slice(2), privateKey.slice(2), {
60305
+ async function sign({ hash: hash6, privateKey, to = "object" }) {
60306
+ const { r, s, recovery } = secp256k1.sign(hash6.slice(2), privateKey.slice(2), {
60214
60307
  lowS: true,
60215
60308
  extraEntropy: isHex(extraEntropy, { strict: false }) ? hexToBytes2(extraEntropy) : extraEntropy
60216
60309
  });
60217
- const signature2 = {
60310
+ const signature3 = {
60218
60311
  r: numberToHex(r, { size: 32 }),
60219
60312
  s: numberToHex(s, { size: 32 }),
60220
60313
  v: recovery ? 28n : 27n,
@@ -60222,8 +60315,8 @@ async function sign({ hash: hash5, privateKey, to = "object" }) {
60222
60315
  };
60223
60316
  return (() => {
60224
60317
  if (to === "bytes" || to === "hex")
60225
- return serializeSignature({ ...signature2, to });
60226
- return signature2;
60318
+ return serializeSignature({ ...signature3, to });
60319
+ return signature3;
60227
60320
  })();
60228
60321
  }
60229
60322
 
@@ -60232,7 +60325,7 @@ init_hashAuthorization();
60232
60325
  async function signAuthorization(parameters) {
60233
60326
  const { chainId, nonce, privateKey, to = "object" } = parameters;
60234
60327
  const address4 = parameters.contractAddress ?? parameters.address;
60235
- const signature2 = await sign({
60328
+ const signature3 = await sign({
60236
60329
  hash: hashAuthorization({ address: address4, chainId, nonce }),
60237
60330
  privateKey,
60238
60331
  to
@@ -60242,9 +60335,9 @@ async function signAuthorization(parameters) {
60242
60335
  address: address4,
60243
60336
  chainId,
60244
60337
  nonce,
60245
- ...signature2
60338
+ ...signature3
60246
60339
  };
60247
- return signature2;
60340
+ return signature3;
60248
60341
  }
60249
60342
 
60250
60343
  // node_modules/viem/_esm/accounts/utils/signMessage.js
@@ -60266,11 +60359,11 @@ async function signTransaction(parameters) {
60266
60359
  };
60267
60360
  return transaction;
60268
60361
  })();
60269
- const signature2 = await sign({
60362
+ const signature3 = await sign({
60270
60363
  hash: keccak256(await serializer(signableTransaction)),
60271
60364
  privateKey
60272
60365
  });
60273
- return await serializer(transaction, signature2);
60366
+ return await serializer(transaction, signature3);
60274
60367
  }
60275
60368
 
60276
60369
  // node_modules/viem/_esm/accounts/utils/signTypedData.js
@@ -60292,8 +60385,8 @@ function privateKeyToAccount(privateKey, options = {}) {
60292
60385
  const account = toAccount({
60293
60386
  address: address4,
60294
60387
  nonceManager,
60295
- async sign({ hash: hash5 }) {
60296
- return sign({ hash: hash5, privateKey, to: "hex" });
60388
+ async sign({ hash: hash6 }) {
60389
+ return sign({ hash: hash6, privateKey, to: "hex" });
60297
60390
  },
60298
60391
  async signAuthorization(authorization) {
60299
60392
  return signAuthorization({ ...authorization, privateKey });
@@ -60512,10 +60605,10 @@ function encodedLabelToLabelhash(label) {
60512
60605
  return null;
60513
60606
  if (label.indexOf("]") !== 65)
60514
60607
  return null;
60515
- const hash5 = `0x${label.slice(1, 65)}`;
60516
- if (!isHex(hash5))
60608
+ const hash6 = `0x${label.slice(1, 65)}`;
60609
+ if (!isHex(hash6))
60517
60610
  return null;
60518
- return hash5;
60611
+ return hash6;
60519
60612
  }
60520
60613
 
60521
60614
  // node_modules/viem/_esm/utils/ens/namehash.js
@@ -60536,8 +60629,8 @@ function namehash(name) {
60536
60629
  init_toBytes();
60537
60630
 
60538
60631
  // node_modules/viem/_esm/utils/ens/encodeLabelhash.js
60539
- function encodeLabelhash(hash5) {
60540
- return `[${hash5.slice(2)}]`;
60632
+ function encodeLabelhash(hash6) {
60633
+ return `[${hash6.slice(2)}]`;
60541
60634
  }
60542
60635
 
60543
60636
  // node_modules/viem/_esm/utils/ens/labelhash.js
@@ -61489,13 +61582,13 @@ async function getProof(client, { address: address4, blockHash, blockNumber, blo
61489
61582
 
61490
61583
  // node_modules/viem/_esm/actions/public/getRawTransaction.js
61491
61584
  init_transaction();
61492
- async function getRawTransaction(client, { hash: hash5 }) {
61585
+ async function getRawTransaction(client, { hash: hash6 }) {
61493
61586
  const rawTransaction = await client.request({
61494
61587
  method: "eth_getRawTransactionByHash",
61495
- params: [hash5]
61588
+ params: [hash6]
61496
61589
  }, { dedupe: true });
61497
61590
  if (!rawTransaction)
61498
- throw new TransactionNotFoundError({ hash: hash5 });
61591
+ throw new TransactionNotFoundError({ hash: hash6 });
61499
61592
  return rawTransaction;
61500
61593
  }
61501
61594
 
@@ -61537,10 +61630,10 @@ init_getTransaction();
61537
61630
  init_getAction();
61538
61631
  init_getBlockNumber();
61539
61632
  init_getTransaction();
61540
- async function getTransactionConfirmations(client, { hash: hash5, transactionReceipt }) {
61633
+ async function getTransactionConfirmations(client, { hash: hash6, transactionReceipt }) {
61541
61634
  const [blockNumber, transaction] = await Promise.all([
61542
61635
  getAction(client, getBlockNumber, "getBlockNumber")({}),
61543
- hash5 ? getAction(client, getTransaction, "getTransaction")({ hash: hash5 }) : void 0
61636
+ hash6 ? getAction(client, getTransaction, "getTransaction")({ hash: hash6 }) : void 0
61544
61637
  ]);
61545
61638
  const transactionBlockNumber = transactionReceipt?.blockNumber || transaction?.blockNumber;
61546
61639
  if (!transactionBlockNumber)
@@ -61680,8 +61773,8 @@ function encode5(...parameters) {
61680
61773
  const { bytecode, args } = options;
61681
61774
  return concat2(bytecode, abiConstructor.inputs?.length && args?.length ? encode4(abiConstructor.inputs, args) : "0x");
61682
61775
  }
61683
- function from11(abiConstructor) {
61684
- return from10(abiConstructor);
61776
+ function from12(abiConstructor) {
61777
+ return from11(abiConstructor);
61685
61778
  }
61686
61779
  function fromAbi2(abi3) {
61687
61780
  const item = abi3.find((item2) => item2.type === "constructor");
@@ -61732,8 +61825,8 @@ function encodeData2(...parameters) {
61732
61825
  const data = args.length > 0 ? encode4(item.inputs, args) : void 0;
61733
61826
  return data ? concat2(selector, data) : selector;
61734
61827
  }
61735
- function from13(abiFunction, options = {}) {
61736
- return from10(abiFunction, options);
61828
+ function from14(abiFunction, options = {}) {
61829
+ return from11(abiFunction, options);
61737
61830
  }
61738
61831
  function fromAbi3(abi3, name, options) {
61739
61832
  const item = fromAbi(abi3, name, options);
@@ -61761,22 +61854,22 @@ var getBalanceCode = "0x6080604052348015600e575f80fd5b5061016d8061001c5f395ff3fe
61761
61854
  var staticCallCode = "0x608060405234801561000f575f5ffd5b5060043610610029575f3560e01c8063fd00430c1461002d575b5f5ffd5b6100476004803603810190610042919061012b565b610049565b005b80825f375f5f825f865afa610060573d5f5f3e3d5ffd5b3d5f5f3e3d5ff35b5f5ffd5b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f61009982610070565b9050919050565b6100a98161008f565b81146100b3575f5ffd5b50565b5f813590506100c4816100a0565b92915050565b5f5ffd5b5f5ffd5b5f5ffd5b5f5f83601f8401126100eb576100ea6100ca565b5b8235905067ffffffffffffffff811115610108576101076100ce565b5b602083019150836001820283011115610124576101236100d2565b5b9250929050565b5f5f5f6040848603121561014257610141610068565b5b5f61014f868287016100b6565b935050602084013567ffffffffffffffff8111156101705761016f61006c565b5b61017c868287016100d6565b9250925050925092509256fea2646970667358221220635ed99185cacf3f2acba6921f23687c969cec2bbaf5f9ad599f507e6e105e6964736f6c63430008230033";
61762
61855
  var assetProbeGas = 1000000n;
61763
61856
  var staticCallAddressBase = 0x00000000000000000000000000000000deadbeefn;
61764
- var transferEventSelector = getSelector2(from12("event Transfer(address indexed from, address indexed to, uint256 value)"));
61765
- var balanceOfFunction = from13("function balanceOf(address) returns (uint256)");
61766
- var decimalsFunction = from13("function decimals() returns (uint256)");
61767
- var tokenUriFunction = from13("function tokenURI(uint256) returns (string)");
61768
- var symbolFunction = from13("function symbol() returns (string)");
61769
- var staticCallFunction = from13("function query(address target, bytes data)");
61857
+ var transferEventSelector = getSelector2(from13("event Transfer(address indexed from, address indexed to, uint256 value)"));
61858
+ var balanceOfFunction = from14("function balanceOf(address) returns (uint256)");
61859
+ var decimalsFunction = from14("function decimals() returns (uint256)");
61860
+ var tokenUriFunction = from14("function tokenURI(uint256) returns (string)");
61861
+ var symbolFunction = from14("function symbol() returns (string)");
61862
+ var staticCallFunction = from14("function query(address target, bytes data)");
61770
61863
  async function simulateCalls(client, parameters) {
61771
61864
  const { blockNumber, blockTag, calls, stateOverrides, traceAssetChanges, traceTransfers, validation } = parameters;
61772
61865
  const account = parameters.account ? parseAccount(parameters.account) : void 0;
61773
61866
  if (traceAssetChanges && !account)
61774
61867
  throw new BaseError("`account` is required when `traceAssetChanges` is true");
61775
- const getBalanceData = account ? encode5(from11("constructor(bytes, bytes)"), {
61868
+ const getBalanceData = account ? encode5(from12("constructor(bytes, bytes)"), {
61776
61869
  bytecode: deploylessCallViaBytecodeBytecode,
61777
61870
  args: [
61778
61871
  getBalanceCode,
61779
- encodeData2(from13("function getBalance(address)"), [account.address])
61872
+ encodeData2(from14("function getBalance(address)"), [account.address])
61780
61873
  ]
61781
61874
  }) : void 0;
61782
61875
  const blockTag_ = blockTag ?? client.experimental_blockTag ?? "latest";
@@ -62015,7 +62108,7 @@ var SignatureErc6492_exports = {};
62015
62108
  __export(SignatureErc6492_exports, {
62016
62109
  InvalidWrappedSignatureError: () => InvalidWrappedSignatureError2,
62017
62110
  assert: () => assert8,
62018
- from: () => from14,
62111
+ from: () => from15,
62019
62112
  magicBytes: () => magicBytes2,
62020
62113
  universalSignatureValidatorAbi: () => universalSignatureValidatorAbi,
62021
62114
  universalSignatureValidatorBytecode: () => universalSignatureValidatorBytecode,
@@ -62076,22 +62169,22 @@ function assert8(wrapped) {
62076
62169
  if (slice3(wrapped, -32) !== magicBytes2)
62077
62170
  throw new InvalidWrappedSignatureError2(wrapped);
62078
62171
  }
62079
- function from14(wrapped) {
62172
+ function from15(wrapped) {
62080
62173
  if (typeof wrapped === "string")
62081
62174
  return unwrap2(wrapped);
62082
62175
  return wrapped;
62083
62176
  }
62084
62177
  function unwrap2(wrapped) {
62085
62178
  assert8(wrapped);
62086
- const [to, data, signature2] = decode3(from5("address, bytes, bytes"), wrapped);
62087
- return { data, signature: signature2, to };
62179
+ const [to, data, signature3] = decode3(from6("address, bytes, bytes"), wrapped);
62180
+ return { data, signature: signature3, to };
62088
62181
  }
62089
62182
  function wrap2(value) {
62090
- const { data, signature: signature2, to } = value;
62091
- return concat2(encode4(from5("address, bytes, bytes"), [
62183
+ const { data, signature: signature3, to } = value;
62184
+ return concat2(encode4(from6("address, bytes, bytes"), [
62092
62185
  to,
62093
62186
  data,
62094
- signature2
62187
+ signature3
62095
62188
  ]), magicBytes2);
62096
62189
  }
62097
62190
  function validate6(wrapped) {
@@ -62133,41 +62226,41 @@ init_recoverAddress();
62133
62226
  init_call();
62134
62227
  init_readContract();
62135
62228
  async function verifyHash(client, parameters) {
62136
- const { address: address4, chain = client.chain, hash: hash5, erc6492VerifierAddress: verifierAddress = parameters.universalSignatureVerifierAddress ?? chain?.contracts?.erc6492Verifier?.address, multicallAddress = parameters.multicallAddress ?? chain?.contracts?.multicall3?.address, mode = "auto" } = parameters;
62229
+ const { address: address4, chain = client.chain, hash: hash6, erc6492VerifierAddress: verifierAddress = parameters.universalSignatureVerifierAddress ?? chain?.contracts?.erc6492Verifier?.address, multicallAddress = parameters.multicallAddress ?? chain?.contracts?.multicall3?.address, mode = "auto" } = parameters;
62137
62230
  if (chain?.verifyHash)
62138
62231
  return await chain.verifyHash(client, parameters);
62139
- const signature2 = (() => {
62140
- const signature3 = parameters.signature;
62141
- if (isHex(signature3))
62142
- return signature3;
62143
- if (typeof signature3 === "object" && "r" in signature3 && "s" in signature3)
62144
- return serializeSignature(signature3);
62145
- return bytesToHex2(signature3);
62232
+ const signature3 = (() => {
62233
+ const signature4 = parameters.signature;
62234
+ if (isHex(signature4))
62235
+ return signature4;
62236
+ if (typeof signature4 === "object" && "r" in signature4 && "s" in signature4)
62237
+ return serializeSignature(signature4);
62238
+ return bytesToHex2(signature4);
62146
62239
  })();
62147
62240
  try {
62148
62241
  if (mode === "eoa") {
62149
62242
  try {
62150
- const verified = isAddressEqual(getAddress(address4), await recoverAddress({ hash: hash5, signature: signature2 }));
62243
+ const verified = isAddressEqual(getAddress(address4), await recoverAddress({ hash: hash6, signature: signature3 }));
62151
62244
  if (verified)
62152
62245
  return true;
62153
62246
  } catch {
62154
62247
  }
62155
62248
  }
62156
- if (SignatureErc8010_exports.validate(signature2))
62249
+ if (SignatureErc8010_exports.validate(signature3))
62157
62250
  return await verifyErc8010(client, {
62158
62251
  ...parameters,
62159
62252
  multicallAddress,
62160
- signature: signature2
62253
+ signature: signature3
62161
62254
  });
62162
62255
  return await verifyErc6492(client, {
62163
62256
  ...parameters,
62164
62257
  verifierAddress,
62165
- signature: signature2
62258
+ signature: signature3
62166
62259
  });
62167
62260
  } catch (error62) {
62168
62261
  if (mode !== "eoa") {
62169
62262
  try {
62170
- const verified = isAddressEqual(getAddress(address4), await recoverAddress({ hash: hash5, signature: signature2 }));
62263
+ const verified = isAddressEqual(getAddress(address4), await recoverAddress({ hash: hash6, signature: signature3 }));
62171
62264
  if (verified)
62172
62265
  return true;
62173
62266
  } catch {
@@ -62180,8 +62273,8 @@ async function verifyHash(client, parameters) {
62180
62273
  }
62181
62274
  }
62182
62275
  async function verifyErc8010(client, parameters) {
62183
- const { address: address4, blockHash, blockNumber, blockTag, hash: hash5, multicallAddress, requireCanonical } = parameters;
62184
- const { authorization: authorization_ox, data: initData, signature: signature2, to } = SignatureErc8010_exports.unwrap(parameters.signature);
62276
+ const { address: address4, blockHash, blockNumber, blockTag, hash: hash6, multicallAddress, requireCanonical } = parameters;
62277
+ const { authorization: authorization_ox, data: initData, signature: signature3, to } = SignatureErc8010_exports.unwrap(parameters.signature);
62185
62278
  const code = await getCode(client, {
62186
62279
  address: address4,
62187
62280
  blockHash,
@@ -62192,7 +62285,7 @@ async function verifyErc8010(client, parameters) {
62192
62285
  if (code === concatHex(["0xef0100", authorization_ox.address]))
62193
62286
  return await verifyErc1271(client, {
62194
62287
  ...parameters,
62195
- signature: signature2
62288
+ signature: signature3
62196
62289
  });
62197
62290
  const authorization = {
62198
62291
  address: authorization_ox.address,
@@ -62232,7 +62325,7 @@ async function verifyErc8010(client, parameters) {
62232
62325
  callData: encodeFunctionData({
62233
62326
  abi: erc1271Abi,
62234
62327
  functionName: "isValidSignature",
62235
- args: [hash5, signature2]
62328
+ args: [hash6, signature3]
62236
62329
  })
62237
62330
  }
62238
62331
  ]
@@ -62244,15 +62337,15 @@ async function verifyErc8010(client, parameters) {
62244
62337
  throw new VerificationError();
62245
62338
  }
62246
62339
  async function verifyErc6492(client, parameters) {
62247
- const { address: address4, factory, factoryData, hash: hash5, signature: signature2, verifierAddress, ...rest } = parameters;
62340
+ const { address: address4, factory, factoryData, hash: hash6, signature: signature3, verifierAddress, ...rest } = parameters;
62248
62341
  const wrappedSignature = await (async () => {
62249
62342
  if (!factory && !factoryData)
62250
- return signature2;
62251
- if (SignatureErc6492_exports.validate(signature2))
62252
- return signature2;
62343
+ return signature3;
62344
+ if (SignatureErc6492_exports.validate(signature3))
62345
+ return signature3;
62253
62346
  return SignatureErc6492_exports.wrap({
62254
62347
  data: factoryData,
62255
- signature: signature2,
62348
+ signature: signature3,
62256
62349
  to: factory
62257
62350
  });
62258
62351
  })();
@@ -62261,13 +62354,13 @@ async function verifyErc6492(client, parameters) {
62261
62354
  data: encodeFunctionData({
62262
62355
  abi: erc6492SignatureValidatorAbi,
62263
62356
  functionName: "isValidSig",
62264
- args: [address4, hash5, wrappedSignature]
62357
+ args: [address4, hash6, wrappedSignature]
62265
62358
  }),
62266
62359
  ...rest
62267
62360
  } : {
62268
62361
  data: encodeDeployData({
62269
62362
  abi: erc6492SignatureValidatorAbi,
62270
- args: [address4, hash5, wrappedSignature],
62363
+ args: [address4, hash6, wrappedSignature],
62271
62364
  bytecode: erc6492SignatureValidatorByteCode
62272
62365
  }),
62273
62366
  ...rest
@@ -62282,11 +62375,11 @@ async function verifyErc6492(client, parameters) {
62282
62375
  throw new VerificationError();
62283
62376
  }
62284
62377
  async function verifyErc1271(client, parameters) {
62285
- const { address: address4, blockHash, blockNumber, blockTag, hash: hash5, requireCanonical, signature: signature2 } = parameters;
62378
+ const { address: address4, blockHash, blockNumber, blockTag, hash: hash6, requireCanonical, signature: signature3 } = parameters;
62286
62379
  const result = await getAction(client, readContract, "readContract")({
62287
62380
  address: address4,
62288
62381
  abi: erc1271Abi,
62289
- args: [hash5, signature2],
62382
+ args: [hash6, signature3],
62290
62383
  blockHash,
62291
62384
  blockNumber,
62292
62385
  blockTag,
@@ -62307,14 +62400,14 @@ var VerificationError = class extends Error {
62307
62400
  // node_modules/viem/_esm/actions/public/verifyMessage.js
62308
62401
  init_getAction();
62309
62402
  init_hashMessage();
62310
- async function verifyMessage(client, { address: address4, message, factory, factoryData, signature: signature2, ...callRequest }) {
62311
- const hash5 = hashMessage(message);
62403
+ async function verifyMessage2(client, { address: address4, message, factory, factoryData, signature: signature3, ...callRequest }) {
62404
+ const hash6 = hashMessage(message);
62312
62405
  return getAction(client, verifyHash, "verifyHash")({
62313
62406
  address: address4,
62314
62407
  factory,
62315
62408
  factoryData,
62316
- hash: hash5,
62317
- signature: signature2,
62409
+ hash: hash6,
62410
+ signature: signature3,
62318
62411
  ...callRequest
62319
62412
  });
62320
62413
  }
@@ -62323,14 +62416,14 @@ async function verifyMessage(client, { address: address4, message, factory, fact
62323
62416
  init_getAction();
62324
62417
  init_hashTypedData();
62325
62418
  async function verifyTypedData(client, parameters) {
62326
- const { address: address4, factory, factoryData, signature: signature2, message, primaryType, types, domain: domain2, ...callRequest } = parameters;
62327
- const hash5 = hashTypedData({ message, primaryType, types, domain: domain2 });
62419
+ const { address: address4, factory, factoryData, signature: signature3, message, primaryType, types, domain: domain3, ...callRequest } = parameters;
62420
+ const hash6 = hashTypedData({ message, primaryType, types, domain: domain3 });
62328
62421
  return getAction(client, verifyHash, "verifyHash")({
62329
62422
  address: address4,
62330
62423
  factory,
62331
62424
  factoryData,
62332
- hash: hash5,
62333
- signature: signature2,
62425
+ hash: hash6,
62426
+ signature: signature3,
62334
62427
  ...callRequest
62335
62428
  });
62336
62429
  }
@@ -62373,8 +62466,8 @@ function watchBlockHeaders(client, { onBlockHeader, onError }) {
62373
62466
  if (!active)
62374
62467
  return;
62375
62468
  const blockHeader = (client.chain?.formatters?.block?.format || formatBlock)(data.result, "watchBlockHeaders");
62376
- for (const field of blockFields)
62377
- delete blockHeader[field];
62469
+ for (const field2 of blockFields)
62470
+ delete blockHeader[field2];
62378
62471
  emit.onBlockHeader(blockHeader, prevBlockHeader);
62379
62472
  prevBlockHeader = blockHeader;
62380
62473
  },
@@ -62583,12 +62676,12 @@ function watchEvent(client, { address: address4, args, batch = true, event, even
62583
62676
  for (const log of logs)
62584
62677
  emit.onLogs([log]);
62585
62678
  };
62586
- const getLogsInRange = (from15, to) => getAction(client, getLogs, "getLogs")({
62679
+ const getLogsInRange = (from16, to) => getAction(client, getLogs, "getLogs")({
62587
62680
  address: address4,
62588
62681
  args,
62589
62682
  event,
62590
62683
  events,
62591
- fromBlock: from15,
62684
+ fromBlock: from16,
62592
62685
  strict,
62593
62686
  toBlock: to
62594
62687
  });
@@ -62619,17 +62712,17 @@ function watchEvent(client, { address: address4, args, batch = true, event, even
62619
62712
  previousBlockNumber ??= blockNumber;
62620
62713
  let size5 = blockNumber - previousBlockNumber;
62621
62714
  while (previousBlockNumber < blockNumber) {
62622
- const from15 = previousBlockNumber + 1n;
62715
+ const from16 = previousBlockNumber + 1n;
62623
62716
  const end = previousBlockNumber + size5;
62624
62717
  const to = end < blockNumber ? end : blockNumber;
62625
- const logs = await getLogsInRange(from15, to).catch((error62) => {
62626
- if (from15 === to || !isRangeError2(error62))
62718
+ const logs = await getLogsInRange(from16, to).catch((error62) => {
62719
+ if (from16 === to || !isRangeError2(error62))
62627
62720
  throw error62;
62628
62721
  });
62629
62722
  if (!active)
62630
62723
  return;
62631
62724
  if (!logs) {
62632
- size5 = (to - from15 + 1n) / 2n;
62725
+ size5 = (to - from16 + 1n) / 2n;
62633
62726
  continue;
62634
62727
  }
62635
62728
  previousBlockNumber = to;
@@ -62772,8 +62865,8 @@ function watchPendingTransactions(client, { batch = true, onError, onTransaction
62772
62865
  if (batch)
62773
62866
  emit.onTransactions(hashes);
62774
62867
  else
62775
- for (const hash5 of hashes)
62776
- emit.onTransactions([hash5]);
62868
+ for (const hash6 of hashes)
62869
+ emit.onTransactions([hash6]);
62777
62870
  } catch (err) {
62778
62871
  emit.onError?.(err);
62779
62872
  }
@@ -62856,8 +62949,8 @@ var suffixRegex = /(?:URI: (?<uri>.+))\n(?:Version: (?<version>.+))\n(?:Chain ID
62856
62949
  init_isAddress();
62857
62950
  init_isAddressEqual();
62858
62951
  function validateSiweMessage(parameters) {
62859
- const { address: address4, domain: domain2, message, nonce, scheme, time: time3 = /* @__PURE__ */ new Date() } = parameters;
62860
- if (domain2 && message.domain !== domain2)
62952
+ const { address: address4, domain: domain3, message, nonce, scheme, time: time3 = /* @__PURE__ */ new Date() } = parameters;
62953
+ if (domain3 && message.domain !== domain3)
62861
62954
  return false;
62862
62955
  if (nonce && message.nonce !== nonce)
62863
62956
  return false;
@@ -62892,13 +62985,13 @@ function validateSiweMessage(parameters) {
62892
62985
 
62893
62986
  // node_modules/viem/_esm/actions/siwe/verifySiweMessage.js
62894
62987
  async function verifySiweMessage(client, parameters) {
62895
- const { address: address4, domain: domain2, message, nonce, scheme, signature: signature2, time: time3 = /* @__PURE__ */ new Date(), ...callRequest } = parameters;
62988
+ const { address: address4, domain: domain3, message, nonce, scheme, signature: signature3, time: time3 = /* @__PURE__ */ new Date(), ...callRequest } = parameters;
62896
62989
  const parsed = parseSiweMessage(message);
62897
62990
  if (!parsed.address)
62898
62991
  return false;
62899
62992
  const isValid = validateSiweMessage({
62900
62993
  address: address4,
62901
- domain: domain2,
62994
+ domain: domain3,
62902
62995
  message: parsed,
62903
62996
  nonce,
62904
62997
  scheme,
@@ -62906,11 +62999,11 @@ async function verifySiweMessage(client, parameters) {
62906
62999
  });
62907
63000
  if (!isValid)
62908
63001
  return false;
62909
- const hash5 = hashMessage(message);
63002
+ const hash6 = hashMessage(message);
62910
63003
  return verifyHash(client, {
62911
63004
  address: parsed.address,
62912
- hash: hash5,
62913
- signature: signature2,
63005
+ hash: hash6,
63006
+ signature: signature3,
62914
63007
  ...callRequest
62915
63008
  });
62916
63009
  }
@@ -62921,7 +63014,7 @@ init_readContract();
62921
63014
  init_internal();
62922
63015
  async function getAllowance(client, parameters) {
62923
63016
  const { account, decimals, spender, token, ...rest } = parameters;
62924
- const [amount3, { decimals: resolved }] = await Promise.all([
63017
+ const [amount4, { decimals: resolved }] = await Promise.all([
62925
63018
  readContract(client, {
62926
63019
  ...rest,
62927
63020
  ...getAllowance.call(client, { account, spender, token })
@@ -62931,7 +63024,7 @@ async function getAllowance(client, parameters) {
62931
63024
  token
62932
63025
  })
62933
63026
  ]);
62934
- return toAmount(amount3, resolved);
63027
+ return toAmount(amount4, resolved);
62935
63028
  }
62936
63029
  (function(getAllowance2) {
62937
63030
  function call2(client, args) {
@@ -62956,7 +63049,7 @@ async function getBalance2(client, parameters) {
62956
63049
  if (!account_)
62957
63050
  throw new AccountNotFoundError();
62958
63051
  const account = parseAccount(account_).address;
62959
- const [amount3, { decimals: resolved }] = await Promise.all([
63052
+ const [amount4, { decimals: resolved }] = await Promise.all([
62960
63053
  readContract(client, {
62961
63054
  ...rest,
62962
63055
  ...getBalance2.call(client, { account, token })
@@ -62966,7 +63059,7 @@ async function getBalance2(client, parameters) {
62966
63059
  token
62967
63060
  })
62968
63061
  ]);
62969
- return toAmount(amount3, resolved);
63062
+ return toAmount(amount4, resolved);
62970
63063
  }
62971
63064
  (function(getBalance3) {
62972
63065
  function call2(client, args) {
@@ -63025,7 +63118,7 @@ init_readContract();
63025
63118
  init_internal();
63026
63119
  async function getTotalSupply(client, parameters) {
63027
63120
  const { decimals, token, ...rest } = parameters;
63028
- const [amount3, { decimals: resolved }] = await Promise.all([
63121
+ const [amount4, { decimals: resolved }] = await Promise.all([
63029
63122
  readContract(client, {
63030
63123
  ...rest,
63031
63124
  ...getTotalSupply.call(client, { token })
@@ -63035,7 +63128,7 @@ async function getTotalSupply(client, parameters) {
63035
63128
  token
63036
63129
  })
63037
63130
  ]);
63038
- return toAmount(amount3, resolved);
63131
+ return toAmount(amount4, resolved);
63039
63132
  }
63040
63133
  (function(getTotalSupply2) {
63041
63134
  function call2(client, args) {
@@ -63106,7 +63199,7 @@ function publicActions(client) {
63106
63199
  simulateCalls: (args) => simulateCalls(client, args),
63107
63200
  simulateContract: (args) => simulateContract(client, args),
63108
63201
  verifyHash: (args) => verifyHash(client, args),
63109
- verifyMessage: (args) => verifyMessage(client, args),
63202
+ verifyMessage: (args) => verifyMessage2(client, args),
63110
63203
  verifySiweMessage: (args) => verifySiweMessage(client, args),
63111
63204
  verifyTypedData: (args) => verifyTypedData(client, args),
63112
63205
  uninstallFilter: (args) => uninstallFilter(client, args),
@@ -63260,6 +63353,8 @@ function http(url2, config2 = {}) {
63260
63353
 
63261
63354
  // node_modules/viem/_esm/index.js
63262
63355
  init_decodeEventLog();
63356
+ init_verifyMessage();
63357
+ init_parseUnits();
63263
63358
 
63264
63359
  // node_modules/viem/_esm/op-stack/contracts.js
63265
63360
  var contracts = {
@@ -63334,20 +63429,20 @@ init_concat();
63334
63429
  init_toHex();
63335
63430
  init_toRlp();
63336
63431
  init_serializeTransaction();
63337
- function serializeTransaction2(transaction, signature2) {
63432
+ function serializeTransaction2(transaction, signature3) {
63338
63433
  if (isDeposit(transaction))
63339
63434
  return serializeTransactionDeposit(transaction);
63340
- return serializeTransaction(transaction, signature2);
63435
+ return serializeTransaction(transaction, signature3);
63341
63436
  }
63342
63437
  var serializers = {
63343
63438
  transaction: serializeTransaction2
63344
63439
  };
63345
63440
  function serializeTransactionDeposit(transaction) {
63346
63441
  assertTransactionDeposit(transaction);
63347
- const { sourceHash, data, from: from15, gas, isSystemTx, mint, to, value } = transaction;
63442
+ const { sourceHash, data, from: from16, gas, isSystemTx, mint, to, value } = transaction;
63348
63443
  const serializedTransaction = [
63349
63444
  sourceHash,
63350
- from15,
63445
+ from16,
63351
63446
  to ?? "0x",
63352
63447
  mint ? toHex(mint) : "0x",
63353
63448
  value ? toHex(value) : "0x",
@@ -63368,9 +63463,9 @@ function isDeposit(transaction) {
63368
63463
  return false;
63369
63464
  }
63370
63465
  function assertTransactionDeposit(transaction) {
63371
- const { from: from15, to } = transaction;
63372
- if (from15 && !isAddress(from15))
63373
- throw new InvalidAddressError({ address: from15 });
63466
+ const { from: from16, to } = transaction;
63467
+ if (from16 && !isAddress(from16))
63468
+ throw new InvalidAddressError({ address: from16 });
63374
63469
  if (to && !isAddress(to))
63375
63470
  throw new InvalidAddressError({ address: to });
63376
63471
  }
@@ -63524,14 +63619,14 @@ var textResult = external_exports.object({
63524
63619
  lines: external_exports.number().int().nonnegative()
63525
63620
  }).strict();
63526
63621
  function textStatistics(input2) {
63527
- const { text: text3 } = textInput.parse(input2);
63622
+ const { text: text4 } = textInput.parse(input2);
63528
63623
  return {
63529
63624
  version: TEXT_CAPABILITY,
63530
- sha256: sha256(Buffer.from(text3)),
63531
- utf8Bytes: Buffer.byteLength(text3),
63532
- codePoints: [...text3].length,
63533
- words: text3.match(/\S+/gu)?.length ?? 0,
63534
- lines: text3.length ? text3.split("\n").length : 0
63625
+ sha256: sha256(Buffer.from(text4)),
63626
+ utf8Bytes: Buffer.byteLength(text4),
63627
+ codePoints: [...text4].length,
63628
+ words: text4.match(/\S+/gu)?.length ?? 0,
63629
+ lines: text4.length ? text4.split("\n").length : 0
63535
63630
  };
63536
63631
  }
63537
63632
  function evaluateTextStatistics(input2, bytes) {
@@ -63541,6 +63636,11 @@ function evaluateTextStatistics(input2, bytes) {
63541
63636
  return false;
63542
63637
  }
63543
63638
  }
63639
+ var TEXT_ACCEPTANCE_CRITERION = "Result equals text-statistics-v1 for the exact signed input.";
63640
+ function checkTextNegotiation(n, buyer, merchantId, priceUSDC) {
63641
+ requireThat(n.buyer.toLowerCase() === buyer.toLowerCase() && n.sellerMerchantId === merchantId && n.terms.capability === TEXT_CAPABILITY && n.terms.paymentTerms === "direct_prepayment" && n.terms.deliverable === TEXT_DELIVERABLE && n.terms.contentType === "application/json" && toAtomic(n.terms.priceUSDC) === toAtomic(priceUSDC) && canonical(n.terms.acceptanceCriteria) === canonical([TEXT_ACCEPTANCE_CRITERION]), "unsupported_negotiated_task");
63642
+ requireThat(n.reference.termsHash === sha256(canonical({ negotiationId: n.reference.negotiationId, buyerMerchantId: n.buyerMerchantId, sellerMerchantId: n.sellerMerchantId, terms: n.terms })), "negotiation_hash_mismatch");
63643
+ }
63544
63644
 
63545
63645
  // src/runtime/wallet.ts
63546
63646
  var delegationPolicy = external_exports.object({
@@ -63904,10 +64004,10 @@ var BaseUsdcReader = class {
63904
64004
  requireThat((u.protocol === "https:" || u.protocol === "http:" && ["127.0.0.1", "localhost", "[::1]"].includes(u.hostname)) && !u.username && !u.password && !u.hash, "invalid_rpc");
63905
64005
  this.client = createPublicClient({ chain: base, transport: http(url2, { retryCount: 0, timeout: 1e4 }) });
63906
64006
  }
63907
- async balance(wallet2) {
64007
+ async balance(wallet3) {
63908
64008
  try {
63909
64009
  requireThat(await this.client.getChainId() === 8453, "wrong_rpc_chain");
63910
- return await this.client.readContract({ address: USDC, abi: abi2, functionName: "balanceOf", args: [wallet2] });
64010
+ return await this.client.readContract({ address: USDC, abi: abi2, functionName: "balanceOf", args: [wallet3] });
63911
64011
  } catch (e) {
63912
64012
  if (e instanceof RuntimeFault) throw e;
63913
64013
  throw new RuntimeFault("chain_unavailable", true);
@@ -63917,9 +64017,12 @@ var BaseUsdcReader = class {
63917
64017
  try {
63918
64018
  requireThat(await this.client.getChainId() === 8453, "wrong_rpc_chain");
63919
64019
  const r = await this.client.getTransactionReceipt({ hash: proof2.transaction });
64020
+ requireThat(r.transactionHash.toLowerCase() === proof2.transaction.toLowerCase(), "transaction_mismatch");
63920
64021
  requireThat(r.status === "success", "transaction_reverted");
63921
- const tip = await this.client.getBlockNumber();
64022
+ const tip = await this.client.getBlockNumber({ cacheTime: 0 });
63922
64023
  if (tip < r.blockNumber + 2n) throw new RuntimeFault("chain_confirming", true);
64024
+ const block = await this.client.getBlock({ blockNumber: r.blockNumber });
64025
+ if (!block.hash || block.hash.toLowerCase() !== r.blockHash.toLowerCase()) throw new RuntimeFault("chain_confirming", true);
63923
64026
  const matches = r.logs.filter((log) => {
63924
64027
  if (log.address.toLowerCase() !== USDC.toLowerCase()) return false;
63925
64028
  try {
@@ -63981,21 +64084,35 @@ var workerProfileViewSchema = external_exports.object({
63981
64084
  workTicket: external_exports.object({ method: external_exports.literal("POST"), challengePath: external_exports.literal("/v1/work-tickets/challenges"), merchantId: external_exports.string().uuid(), guide: external_exports.literal("/work-tickets.md"), paymentRequiredToCreate: external_exports.literal(false), quoteRequired: external_exports.literal(true) }).strict()
63982
64085
  }).strict().refine((value) => value.merchant.id === value.workerProfile.merchantId && value.merchant.id === value.workTicket.merchantId, "Worker routing must reference the same merchant.");
63983
64086
 
64087
+ // src/transaction-evidence/core.ts
64088
+ import { createHash as createHash3 } from "node:crypto";
64089
+
64090
+ // src/transaction-evidence/negotiation.ts
64091
+ var uuid5 = external_exports.string().uuid();
64092
+ var hash4 = external_exports.string().regex(/^[a-f0-9]{64}$/);
64093
+ var workerCapabilityId2 = external_exports.string().regex(/^[a-z0-9][a-z0-9-]{1,62}[a-z0-9]$/);
64094
+ var workerContentType2 = external_exports.enum(["application/json", "text/plain; charset=utf-8"]);
64095
+ var text2 = (max) => external_exports.string().trim().min(1).refine((s) => Array.from(s).length <= max).meta({ maxLength: max });
64096
+ var negotiationPaymentTerms = external_exports.enum(["direct_prepayment", "pay_on_acceptance", "protected_inspection"]);
64097
+ var negotiationTerms = external_exports.object({ capability: workerCapabilityId2, deliverable: text2(1e3), acceptanceCriteria: external_exports.array(text2(300)).min(1).max(10), priceUSDC: external_exports.string().regex(/^(?:0|[1-9][0-9]{0,5})(?:\.[0-9]{1,6})?$/).refine((s) => Number(s) > 0, "Price must be positive."), paymentTerms: negotiationPaymentTerms, contentType: workerContentType2, deliverySeconds: external_exports.number().int().min(60).max(604800) }).strict();
64098
+ var negotiationReference = external_exports.object({ negotiationId: uuid5, acceptedRevision: external_exports.number().int().positive(), termsHash: hash4 }).strict();
64099
+ var negotiationExecution = external_exports.object({ reference: negotiationReference, terms: negotiationTerms, buyer: external_exports.string().regex(/^0x[0-9a-fA-F]{40}$/), buyerMerchantId: uuid5, sellerMerchantId: uuid5, payTo: external_exports.string().regex(/^0x[0-9a-fA-F]{40}$/), expiresAt: external_exports.string().datetime(), deliveryDeadline: external_exports.string().datetime() }).strict();
64100
+
63984
64101
  // src/transaction-evidence/schema.ts
63985
64102
  var EVIDENCE_PROTOCOL = "402mob.transaction-evidence.v1";
63986
64103
  var MAX_BUNDLE_BYTES = 256 * 1024;
63987
64104
  var EVIDENCE_ASSET = "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913";
63988
- var uuid5 = external_exports.string().uuid();
63989
- var hash4 = external_exports.string().regex(/^[a-f0-9]{64}$/);
64105
+ var uuid8 = external_exports.string().uuid();
64106
+ var hash5 = external_exports.string().regex(/^[a-f0-9]{64}$/);
63990
64107
  var address3 = external_exports.string().regex(/^0x[0-9a-fA-F]{40}$/);
63991
64108
  var date6 = external_exports.string().datetime();
63992
64109
  var amount2 = external_exports.string().regex(/^[1-9][0-9]{0,11}$/);
63993
64110
  var contentType = external_exports.enum(["application/json", "text/plain; charset=utf-8"]);
63994
- var evidenceProofSchema = external_exports.object({ challengeId: uuid5.nullable(), message: external_exports.string().min(1).max(64 * 1024).nullable(), signature: external_exports.string().regex(/^0x[0-9a-fA-F]{130}$/).nullable() }).strict();
64111
+ var evidenceProofSchema = external_exports.object({ challengeId: uuid8.nullable(), message: external_exports.string().min(1).max(64 * 1024).nullable(), signature: external_exports.string().regex(/^0x[0-9a-fA-F]{130}$/).nullable() }).strict();
63995
64112
  var evidenceReaderSchema = external_exports.object({ buyer: address3 }).strict();
63996
- var evidenceReadProofSchema = external_exports.object({ challengeId: uuid5, signature: external_exports.string().regex(/^0x[0-9a-fA-F]{130}$/) }).strict();
63997
- var evidenceReadChallengeSchema = external_exports.object({ challengeId: uuid5, message: external_exports.string().min(1).max(4096), expiresAt: date6 }).strict();
63998
- var evidenceAgreementSchema = external_exports.object({ protocol: external_exports.literal("402mob.work-agreement.v1"), requestId: uuid5, proposalId: uuid5, proposalTermsHash: hash4, settlementMode: external_exports.literal("direct_prepayment") }).strict();
64113
+ var evidenceReadProofSchema = external_exports.object({ challengeId: uuid8, signature: external_exports.string().regex(/^0x[0-9a-fA-F]{130}$/) }).strict();
64114
+ var evidenceReadChallengeSchema = external_exports.object({ challengeId: uuid8, message: external_exports.string().min(1).max(4096), expiresAt: date6 }).strict();
64115
+ var evidenceAgreementSchema = external_exports.object({ protocol: external_exports.literal("402mob.work-agreement.v1"), requestId: uuid8, proposalId: uuid8, proposalTermsHash: hash5, settlementMode: external_exports.literal("direct_prepayment") }).strict();
63999
64116
  var transactionEvidenceContentSchema = external_exports.object({
64000
64117
  protocol: external_exports.literal(EVIDENCE_PROTOCOL),
64001
64118
  kind: external_exports.literal("work_ticket"),
@@ -64003,52 +64120,289 @@ var transactionEvidenceContentSchema = external_exports.object({
64003
64120
  exportedAt: date6,
64004
64121
  network: external_exports.literal("eip155:8453"),
64005
64122
  asset: external_exports.literal(EVIDENCE_ASSET),
64006
- subject: external_exports.object({ ticketId: uuid5, buyer: address3, merchantId: uuid5, capability: external_exports.string().min(3).max(100), inputHash: hash4, maxAmountAtomic: amount2, expiresAt: date6, idempotencyKey: external_exports.string().regex(/^[A-Za-z0-9_-]{16,128}$/) }).strict(),
64123
+ subject: external_exports.object({ ticketId: uuid8, buyer: address3, merchantId: uuid8, capability: external_exports.string().min(3).max(100), inputHash: hash5, maxAmountAtomic: amount2, expiresAt: date6, idempotencyKey: external_exports.string().regex(/^[A-Za-z0-9_-]{16,128}$/) }).strict(),
64124
+ negotiation: negotiationExecution.optional(),
64007
64125
  grant: evidenceProofSchema,
64008
64126
  agreement: evidenceAgreementSchema.nullable(),
64009
- selection: external_exports.object({ requestId: uuid5, proposalId: uuid5, termsHash: hash4, proof: evidenceProofSchema }).strict().nullable(),
64010
- quote: external_exports.object({ id: uuid5, amountAtomic: amount2, payTo: address3, deliverable: external_exports.string().min(1).max(300), contentType, termsHash: hash4, expiresAt: date6, acceptance: evidenceProofSchema }).strict().nullable(),
64011
- delivery: external_exports.object({ resultHash: hash4.nullable(), contentType: contentType.nullable(), receipt: external_exports.object({ verdict: external_exports.enum(["accepted", "disputed"]), proof: evidenceProofSchema }).strict().nullable() }).strict(),
64127
+ selection: external_exports.object({ requestId: uuid8, proposalId: uuid8, termsHash: hash5, proof: evidenceProofSchema }).strict().nullable(),
64128
+ quote: external_exports.object({ id: uuid8, amountAtomic: amount2, payTo: address3, deliverable: external_exports.string().min(1).max(300), contentType, termsHash: hash5, expiresAt: date6, acceptance: evidenceProofSchema }).strict().nullable(),
64129
+ delivery: external_exports.object({ resultHash: hash5.nullable(), contentType: contentType.nullable(), receipt: external_exports.object({ verdict: external_exports.enum(["accepted", "disputed"]), proof: evidenceProofSchema }).strict().nullable() }).strict(),
64012
64130
  observations: external_exports.object({
64013
64131
  source: external_exports.literal("unsigned_server_snapshot"),
64014
64132
  ticketState: external_exports.enum(["open", "claimed", "quoted", "accepted", "paying", "paid", "delivered", "accepted_by_buyer", "disputed", "expired"]),
64015
64133
  createdAt: date6,
64016
64134
  retentionExpiresAt: date6,
64017
64135
  resultAvailable: external_exports.boolean(),
64018
- payment: external_exports.object({ operationId: uuid5, state: external_exports.enum(["executing", "staged", "settling", "pending", "settled", "failed", "expired"]), settlementRecorded: external_exports.boolean(), transactionHash: external_exports.string().regex(/^0x[0-9a-fA-F]{64}$/).nullable(), amountAtomic: amount2, payer: address3, recipient: address3, network: external_exports.literal("eip155:8453"), asset: external_exports.literal(EVIDENCE_ASSET) }).strict().nullable()
64136
+ payment: external_exports.object({ operationId: uuid8, state: external_exports.enum(["executing", "staged", "settling", "pending", "settled", "failed", "expired"]), settlementRecorded: external_exports.boolean(), transactionHash: external_exports.string().regex(/^0x[0-9a-fA-F]{64}$/).nullable(), amountAtomic: amount2, payer: address3, recipient: address3, network: external_exports.literal("eip155:8453"), asset: external_exports.literal(EVIDENCE_ASSET) }).strict().nullable()
64019
64137
  }).strict()
64020
64138
  }).strict();
64021
- var transactionEvidenceSchema = transactionEvidenceContentSchema.extend({ bundleHash: hash4 }).strict();
64139
+ var transactionEvidenceSchema = transactionEvidenceContentSchema.extend({ bundleHash: hash5 }).strict();
64022
64140
 
64023
64141
  // src/transaction-evidence/core.ts
64024
64142
  function evidenceCanonical(value) {
64025
64143
  if (value === null || typeof value !== "object") {
64026
- const text3 = JSON.stringify(value);
64027
- if (text3 === void 0) throw new Error("Non-JSON value");
64028
- return text3;
64144
+ const text4 = JSON.stringify(value);
64145
+ if (text4 === void 0) throw new Error("Non-JSON value");
64146
+ return text4;
64029
64147
  }
64030
64148
  if (Array.isArray(value)) return "[" + value.map(evidenceCanonical).join(",") + "]";
64031
64149
  return "{" + Object.keys(value).sort().map((k) => JSON.stringify(k) + ":" + evidenceCanonical(value[k])).join(",") + "}";
64032
64150
  }
64151
+ var evidenceHash = (value) => createHash3("sha256").update(value).digest("hex");
64152
+ function parseEvidenceBundle(value) {
64153
+ const serialized = JSON.stringify(value);
64154
+ if (!serialized || Buffer.byteLength(serialized) > MAX_BUNDLE_BYTES) throw new Error("Invalid evidence size");
64155
+ return transactionEvidenceSchema.parse(value);
64156
+ }
64157
+ function field(message, label) {
64158
+ const lines = message.split("\n").filter((l) => l.startsWith(label + ": "));
64159
+ if (lines.length !== 1) throw new Error("Missing or duplicated " + label);
64160
+ return lines[0].slice(label.length + 2);
64161
+ }
64162
+ function same(actual, expected) {
64163
+ if (actual !== expected) throw new Error("Binding mismatch");
64164
+ }
64165
+ function exactMessage(message, heading, labels, ending, secondLine) {
64166
+ same(message, [heading, ...secondLine ? [secondLine] : [], ...labels.map((label) => label + ": " + field(message, label)), ending].join("\n"));
64167
+ }
64168
+ function iso(value) {
64169
+ const ms = Date.parse(value);
64170
+ if (!Number.isFinite(ms) || new Date(ms).toISOString() !== value) throw new Error("Invalid time");
64171
+ return ms;
64172
+ }
64033
64173
  var proposalDeadlineSchema = external_exports.string().datetime();
64174
+ function proposalDeadline(value) {
64175
+ return Date.parse(proposalDeadlineSchema.parse(value));
64176
+ }
64177
+ var quoted = (s) => JSON.stringify(s).replace(/[\u2028\u2029]/g, (c) => "\\u" + c.charCodeAt(0).toString(16));
64178
+ async function verifyEvidenceBundle(value, expected) {
64179
+ const checks = [];
64180
+ const add = (code, status, detail2) => checks.push({ code, status, detail: detail2 });
64181
+ const finish = () => ({ protocol: "402mob.transaction-evidence-report.v1", outcome: checks.some((c) => c.status === "invalid") ? "invalid" : checks.some((c) => c.status === "missing") ? "incomplete" : "checked", checks, chainVerification: "not_performed", qualityAssessment: "not_performed", snapshotAuthenticity: "not_proven" });
64182
+ let b;
64183
+ try {
64184
+ b = parseEvidenceBundle(value);
64185
+ } catch {
64186
+ add("schema", "invalid", "Malformed or oversized evidence bundle.");
64187
+ return finish();
64188
+ }
64189
+ const { bundleHash, ...content } = b;
64190
+ const test = (code, fn, detail2) => {
64191
+ try {
64192
+ fn();
64193
+ add(code, "verified", detail2);
64194
+ return true;
64195
+ } catch {
64196
+ add(code, "invalid", "Signature, hash or binding does not match.");
64197
+ return false;
64198
+ }
64199
+ };
64200
+ test("bundle_integrity", () => {
64201
+ same(evidenceHash(evidenceCanonical(content)), bundleHash);
64202
+ if (expected.bundleHash !== void 0) same(bundleHash, expected.bundleHash);
64203
+ }, "Canonical snapshot hash matches. Without a previously trusted hash this is not provenance.");
64204
+ const context = test("expected_context", () => {
64205
+ if (!expected.origin || !expected.ticketId || !/^0x[0-9a-fA-F]{40}$/.test(expected.buyer)) throw new Error("Expectations required");
64206
+ same(new URL(expected.origin).origin, expected.origin);
64207
+ same(b.origin, expected.origin);
64208
+ same(b.subject.ticketId, expected.ticketId);
64209
+ same(b.subject.buyer.toLowerCase(), expected.buyer.toLowerCase());
64210
+ }, "Bundle labels match caller-supplied origin, ticket and buyer; labels alone are not signed.");
64211
+ if (!context) return finish();
64212
+ const t = b.subject;
64213
+ const proof2 = async (code, p, heading, bindings) => {
64214
+ if (!p?.message || !p.signature || !p.challengeId) {
64215
+ add(code, "missing", "Exact message, signature or challenge ID was not retained or the action has not occurred.");
64216
+ return false;
64217
+ }
64218
+ try {
64219
+ same(p.message.split("\n")[0], heading);
64220
+ same(field(p.message, "Origin"), expected.origin);
64221
+ same(field(p.message, "Challenge"), p.challengeId);
64222
+ iso(field(p.message, "Expires"));
64223
+ bindings(p.message);
64224
+ if (!await verifyMessage({ address: expected.buyer, message: p.message, signature: p.signature })) throw new Error("Signature");
64225
+ add(code, "verified", "Buyer EIP-191 signature and the recorded action bindings match. This is not payment authority or quality certification.");
64226
+ return true;
64227
+ } catch {
64228
+ add(code, "invalid", "Signature, message format or action bindings do not match.");
64229
+ return false;
64230
+ }
64231
+ };
64232
+ const grantVerified = await proof2("grant", b.grant, "402Mob agent work ticket grant", (m) => {
64233
+ exactMessage(m, "402Mob agent work ticket grant", [...b.negotiation ? ["Negotiation"] : [], ...b.agreement ? ["Agreement"] : [], "Origin", "Buyer wallet", "Worker merchant", "Capability", "Input SHA-256", "Maximum USDC atomic", "Network", "Asset", "Issued", "Ticket expires", "Idempotency key", "Policy SHA-256", "Challenge", "Expires"], "This EIP-191 signature grants this ticket policy up to its maximum budget. It does not authorize payment. Accepting a seller quote and x402 payment each require separate authorization.");
64234
+ same(field(m, "Buyer wallet").toLowerCase(), t.buyer.toLowerCase());
64235
+ same(field(m, "Worker merchant"), t.merchantId);
64236
+ same(field(m, "Capability"), quoted(t.capability));
64237
+ same(field(m, "Input SHA-256"), t.inputHash);
64238
+ same(field(m, "Maximum USDC atomic"), t.maxAmountAtomic);
64239
+ same(field(m, "Network"), b.network);
64240
+ same(field(m, "Asset").toLowerCase(), EVIDENCE_ASSET);
64241
+ same(field(m, "Ticket expires"), t.expiresAt);
64242
+ same(field(m, "Idempotency key"), t.idempotencyKey);
64243
+ const issued = iso(field(m, "Issued")), expires = iso(t.expiresAt), until = iso(field(m, "Expires")), duration3 = (expires - issued) / 1e3;
64244
+ if (!Number.isInteger(duration3) || duration3 < 60 || duration3 > 86400 || until <= issued || until > Math.min(expires, issued + 3e5)) throw new Error("Grant time");
64245
+ if (b.negotiation) {
64246
+ same(field(m, "Negotiation"), evidenceCanonical(b.negotiation.reference));
64247
+ if (b.agreement) throw new Error("Conflicting bindings");
64248
+ }
64249
+ const agreementLines = m.split("\n").filter((l) => l.startsWith("Agreement: "));
64250
+ if (b.agreement) same(field(m, "Agreement"), evidenceCanonical(b.agreement));
64251
+ else same(agreementLines.length, 0);
64252
+ const policy = { buyer: t.buyer.toLowerCase(), merchantId: t.merchantId, capability: t.capability, inputHash: t.inputHash, maxAmount: t.maxAmountAtomic, expiresInSeconds: duration3, idempotencyKey: t.idempotencyKey, ...b.negotiation ? { negotiation: b.negotiation.reference } : {}, ...b.agreement ? { agreement: b.agreement } : {} };
64253
+ same(field(m, "Policy SHA-256"), evidenceHash(evidenceCanonical(policy)));
64254
+ });
64255
+ if (b.agreement) {
64256
+ const a = b.agreement, s = b.selection;
64257
+ if (!s) {
64258
+ add("selection", "missing", "Linked agreement has no retained selection proof.");
64259
+ } else await proof2("selection", s.proof, "402Mob fresh-work proposal selection", (m) => {
64260
+ exactMessage(m, "402Mob fresh-work proposal selection", ["Origin", "Buyer", "Request", "Proposal", "Terms", "Terms SHA-256", "Network", "Challenge", "Expires"], "This selects a proposal and returns a separate settlement template only. It creates no Work Ticket, authorizes no payment and enforces no delivery deadline or test-purchase spending. Review and separately sign the settlement terms for the selected mode.", "Direct Work Ticket requires a new grant and quote acceptance.");
64261
+ same(s.requestId, a.requestId);
64262
+ same(s.proposalId, a.proposalId);
64263
+ same(s.termsHash, a.proposalTermsHash);
64264
+ same(field(m, "Buyer").toLowerCase(), t.buyer.toLowerCase());
64265
+ same(field(m, "Request"), s.requestId);
64266
+ same(field(m, "Proposal"), s.proposalId);
64267
+ same(field(m, "Terms SHA-256"), s.termsHash);
64268
+ same(field(m, "Network").toLowerCase(), `eip155:8453; asset: ${EVIDENCE_ASSET}`);
64269
+ const serialized = JSON.parse(field(m, "Terms"));
64270
+ if (typeof serialized !== "string") throw new Error("Terms");
64271
+ const proposal = JSON.parse(serialized);
64272
+ same(evidenceCanonical(proposal), serialized);
64273
+ const { termsHash, ...unsigned } = proposal;
64274
+ same(termsHash, s.termsHash);
64275
+ same(evidenceHash(evidenceCanonical(unsigned)), s.termsHash);
64276
+ same(proposal.id, s.proposalId);
64277
+ same(proposal.requestId, s.requestId);
64278
+ same(proposal.merchantId, t.merchantId);
64279
+ same(proposal.kind, "proposal");
64280
+ same(proposal.terms.capability, t.capability);
64281
+ if ((proposal.terms.settlementMode ?? "direct_prepayment") !== "direct_prepayment") throw new Error("Wrong settlement mode");
64282
+ if (typeof proposal.terms.priceUSDC !== "string" || !/^(?:0|[1-9][0-9]{0,5})(?:\.[0-9]{1,6})?$/.test(proposal.terms.priceUSDC)) throw new Error("Invalid price");
64283
+ same(parseUnits(proposal.terms.priceUSDC, 6).toString(), t.maxAmountAtomic);
64284
+ if (iso(field(m, "Expires")) > proposalDeadline(proposal.terms.deliveryDeadline)) throw new Error("Selection deadline");
64285
+ if (b.quote) {
64286
+ same(proposal.payoutAddress.toLowerCase(), b.quote.payTo.toLowerCase());
64287
+ same(proposal.terms.deliverable, b.quote.deliverable);
64288
+ same(b.quote.amountAtomic, t.maxAmountAtomic);
64289
+ }
64290
+ });
64291
+ } else {
64292
+ add("selection", b.selection ? "invalid" : "not_applicable", b.selection ? "Selection supplied without a signed agreement reference." : "Unlinked ticket; no verified selection linkage claimed.");
64293
+ }
64294
+ if (b.negotiation) test("negotiation_binding", () => {
64295
+ const n = b.negotiation;
64296
+ same(n.reference.termsHash, evidenceHash(evidenceCanonical({ negotiationId: n.reference.negotiationId, buyerMerchantId: n.buyerMerchantId, sellerMerchantId: n.sellerMerchantId, terms: n.terms })));
64297
+ same(n.buyer.toLowerCase(), t.buyer.toLowerCase());
64298
+ same(n.sellerMerchantId, t.merchantId);
64299
+ same(n.terms.capability, t.capability);
64300
+ same(n.terms.paymentTerms, "direct_prepayment");
64301
+ same(parseUnits(n.terms.priceUSDC, 6).toString(), t.maxAmountAtomic);
64302
+ same(iso(n.deliveryDeadline) - iso(b.observations.createdAt), n.terms.deliverySeconds * 1e3);
64303
+ if (iso(t.expiresAt) > Math.min(iso(n.expiresAt), iso(n.deliveryDeadline))) throw new Error("Negotiation expiry");
64304
+ if (b.quote) {
64305
+ same(b.quote.amountAtomic, t.maxAmountAtomic);
64306
+ same(b.quote.payTo.toLowerCase(), n.payTo.toLowerCase());
64307
+ same(b.quote.deliverable, n.terms.deliverable);
64308
+ same(b.quote.contentType, n.terms.contentType);
64309
+ }
64310
+ }, "Negotiated terms match the grant and quote. API acceptance history and task quality are not independently proven.");
64311
+ let ticketBound = false, grantBound = false;
64312
+ if (b.quote) {
64313
+ const q = b.quote;
64314
+ test("quote_terms_hash", () => {
64315
+ same(evidenceHash(evidenceCanonical({ ...b.negotiation ? { negotiation: b.negotiation } : {}, ticketId: t.ticketId, merchantId: t.merchantId, quoteId: q.id, amount: q.amountAtomic, deliverable: q.deliverable, contentType: q.contentType, expiresAt: q.expiresAt })), q.termsHash);
64316
+ if (BigInt(q.amountAtomic) > BigInt(t.maxAmountAtomic) || iso(q.expiresAt) > iso(t.expiresAt)) throw new Error("Quote exceeds grant");
64317
+ }, "Quote hash matches the recorded terms; this is not a seller signature.");
64318
+ const hasGrantBinding = q.acceptance?.message?.split("\n").some((l) => l.startsWith("Grant challenge: ") || l.startsWith("Grant message SHA-256: ")) ?? false;
64319
+ ticketBound = await proof2("quote_acceptance", q.acceptance, "402Mob work quote acceptance", (m) => {
64320
+ const detailed = m.split("\n").some((l) => l.startsWith("Deliverable: ") || l.startsWith("Result content type: "));
64321
+ if (hasGrantBinding && !detailed) throw new Error("Unknown acceptance format");
64322
+ exactMessage(m, "402Mob work quote acceptance", ["Origin", "Ticket", ...hasGrantBinding ? ["Grant challenge", "Grant message SHA-256"] : [], ...b.negotiation ? ["Negotiation", "Negotiated terms SHA-256"] : [], "Buyer wallet", "Worker merchant", "Worker payout wallet", "Quote", ...detailed ? ["Deliverable", "Result content type"] : [], "Quote terms SHA-256", "Amount atomic USDC", "Network", "Asset", "Quote expires", "Challenge", "Expires"], "This signature accepts these exact work terms and the exact amount. It does not authorize a payment; payment requires a separate x402 authorization.");
64323
+ if (b.negotiation) {
64324
+ same(field(m, "Negotiation"), evidenceCanonical(b.negotiation.reference));
64325
+ same(field(m, "Negotiated terms SHA-256"), evidenceHash(evidenceCanonical(b.negotiation)));
64326
+ }
64327
+ if (hasGrantBinding) {
64328
+ if (!b.grant.message || !b.grant.challengeId) throw new Error("Missing bound grant");
64329
+ same(field(m, "Grant challenge"), b.grant.challengeId);
64330
+ same(field(m, "Grant message SHA-256"), evidenceHash(b.grant.message));
64331
+ }
64332
+ same(field(m, "Ticket"), t.ticketId);
64333
+ same(field(m, "Buyer wallet").toLowerCase(), t.buyer.toLowerCase());
64334
+ same(field(m, "Worker merchant"), t.merchantId);
64335
+ same(field(m, "Worker payout wallet").toLowerCase(), q.payTo.toLowerCase());
64336
+ same(field(m, "Quote"), q.id);
64337
+ same(field(m, "Quote terms SHA-256"), q.termsHash);
64338
+ same(field(m, "Amount atomic USDC"), q.amountAtomic);
64339
+ same(field(m, "Network"), b.network);
64340
+ same(field(m, "Asset").toLowerCase(), b.asset);
64341
+ same(field(m, "Quote expires"), q.expiresAt);
64342
+ if (m.split("\n").some((l) => l.startsWith("Deliverable: ") || l.startsWith("Result content type: "))) {
64343
+ same(field(m, "Deliverable"), JSON.stringify(q.deliverable));
64344
+ same(field(m, "Result content type"), q.contentType);
64345
+ }
64346
+ if (iso(field(m, "Expires")) > Math.min(iso(q.expiresAt), iso(t.expiresAt))) throw new Error("Acceptance time");
64347
+ });
64348
+ grantBound = ticketBound && hasGrantBinding && grantVerified;
64349
+ } else add("quote_acceptance", "missing", "No quote and acceptance are recorded.");
64350
+ const receipt = b.delivery.receipt;
64351
+ if (receipt) {
64352
+ const receiptBound = await proof2("buyer_receipt", receipt.proof, "402Mob work result receipt", (m) => {
64353
+ exactMessage(m, "402Mob work result receipt", ["Origin", "Ticket", "Buyer wallet", "Result SHA-256", "Verdict", "Challenge", "Expires"], "This records the buyer wallet's judgment of the result. It is not arbitration, a refund, or a certification of work quality.");
64354
+ same(field(m, "Ticket"), t.ticketId);
64355
+ same(field(m, "Buyer wallet").toLowerCase(), t.buyer.toLowerCase());
64356
+ same(field(m, "Result SHA-256"), b.delivery.resultHash);
64357
+ same(field(m, "Verdict"), receipt.verdict);
64358
+ });
64359
+ ticketBound = ticketBound || receiptBound;
64360
+ } else add("buyer_receipt", "missing", "No buyer judgment was recorded; silence is not acceptance.");
64361
+ test("delivery_record_consistency", () => {
64362
+ if (b.delivery.resultHash === null !== (b.delivery.contentType === null)) throw new Error("Partial delivery metadata");
64363
+ if (b.observations.resultAvailable && !b.delivery.resultHash) throw new Error("Missing result hash");
64364
+ if (b.delivery.resultHash) {
64365
+ if (!b.quote) throw new Error("Missing quote");
64366
+ same(b.delivery.contentType, b.quote.contentType);
64367
+ }
64368
+ }, "Recorded delivery metadata is consistent with the quote; availability is an unsigned server observation.");
64369
+ add("ticket_id_binding", ticketBound ? "verified" : "missing", ticketBound ? "A verified quote acceptance or receipt includes this ticket ID." : "The grant predates ticket allocation; the ticket ID remains a server association.");
64370
+ add("grant_ticket_binding", grantBound ? "verified" : "missing", grantBound ? "Verified quote acceptance binds this ticket ID to the exact verified grant message and challenge." : "No verified acceptance binds this ticket to its grant. Historical acceptance/receipt signatures on the ticket ID alone do not establish that relationship.");
64371
+ const payment = b.observations.payment;
64372
+ if (payment) test("payment_record_consistency", () => {
64373
+ if (!b.quote) throw new Error("Missing quote");
64374
+ same(payment.payer.toLowerCase(), t.buyer.toLowerCase());
64375
+ same(payment.recipient.toLowerCase(), b.quote.payTo.toLowerCase());
64376
+ same(payment.amountAtomic, b.quote.amountAtomic);
64377
+ if (payment.settlementRecorded && !payment.transactionHash) throw new Error("Missing transaction");
64378
+ }, "Unsigned payment record matches the recorded quote. Settlement has NOT been verified on-chain.");
64379
+ else add("payment_record_consistency", "missing", "No payment record is available.");
64380
+ for (const [code, bytes, hash6] of [["input_bytes", expected.inputBytes, t.inputHash], ["result_bytes", expected.resultBytes, b.delivery.resultHash]]) {
64381
+ if (bytes === void 0) add(code, "missing", "Bytes were not supplied for offline hash comparison.");
64382
+ else test(code, () => {
64383
+ same(evidenceHash(bytes), hash6);
64384
+ }, "Supplied bytes match the recorded hash; this does not assess correctness.");
64385
+ }
64386
+ return finish();
64387
+ }
64034
64388
 
64035
64389
  // src/transaction-evidence/offer-schema.ts
64036
- var text2 = (max) => external_exports.string().trim().min(1).refine((v2) => Array.from(v2).length <= max, `Use at most ${max} Unicode code points.`).meta({ maxLength: max });
64390
+ var text3 = (max) => external_exports.string().trim().min(1).refine((v2) => Array.from(v2).length <= max, `Use at most ${max} Unicode code points.`).meta({ maxLength: max });
64037
64391
  var https = external_exports.string().url().max(2048).refine((value) => {
64038
64392
  const u = new URL(value);
64039
64393
  return value.startsWith("https://") && !/[\s#]/u.test(value) && u.protocol === "https:" && !u.username && !u.password && !u.hash;
64040
64394
  }, "Use an HTTPS URL without credentials or a fragment.");
64041
64395
  var purchaseDecisionSchema = external_exports.object({
64042
64396
  protocol: external_exports.literal("402mob.purchase-decision.v1"),
64043
- intendedUse: text2(500),
64397
+ intendedUse: text3(500),
64044
64398
  resultSchema: external_exports.object({ uri: https, version: external_exports.string().regex(/^(0|[1-9][0-9]{0,8})\.(0|[1-9][0-9]{0,8})\.(0|[1-9][0-9]{0,8})$/), sha256: external_exports.string().regex(/^[a-f0-9]{64}$/) }).strict().nullable(),
64045
64399
  coverage: external_exports.object({ asOf: external_exports.string().datetime(), from: external_exports.string().datetime().optional(), through: external_exports.string().datetime().optional() }).strict().superRefine((c, ctx) => {
64046
64400
  if (c.from === void 0 !== (c.through === void 0)) ctx.addIssue({ code: "custom", message: "Provide both coverage from and through, or neither." });
64047
64401
  if (c.from && c.through && Date.parse(c.from) > Date.parse(c.through)) ctx.addIssue({ code: "custom", path: ["through"], message: "Coverage through must not precede from." });
64048
64402
  }),
64049
- limitations: external_exports.array(text2(300)).min(1).max(8),
64050
- reuseTerms: text2(3e3),
64051
- publicSample: text2(1024).optional()
64403
+ limitations: external_exports.array(text3(300)).min(1).max(8),
64404
+ reuseTerms: text3(3e3),
64405
+ publicSample: text3(1024).optional()
64052
64406
  }).strict().refine((v2) => Buffer.byteLength(evidenceCanonical(v2), "utf8") <= 8192, "Purchase decision metadata must fit 8 KiB of canonical UTF-8 JSON.");
64053
64407
  var wallet = external_exports.string().regex(/^0x[0-9a-fA-F]{40}$/);
64054
64408
  var digest2 = external_exports.string().regex(/^[a-f0-9]{64}$/);
@@ -64057,8 +64411,8 @@ var evidenceOfferTermsSchema = external_exports.object({
64057
64411
  merchantId: external_exports.string().uuid(),
64058
64412
  offerId: external_exports.string().uuid(),
64059
64413
  version: external_exports.string().regex(/^(0|[1-9][0-9]{0,8})\.(0|[1-9][0-9]{0,8})\.(0|[1-9][0-9]{0,8})$/),
64060
- title: text2(100),
64061
- description: text2(300),
64414
+ title: text3(100),
64415
+ description: text3(300),
64062
64416
  payee: wallet,
64063
64417
  network: external_exports.literal("eip155:8453"),
64064
64418
  asset: wallet,
@@ -64181,9 +64535,9 @@ var inspectedResource = external_exports.object({
64181
64535
  var workerResults = external_exports.object({ items: external_exports.array(workerProfileViewSchema).max(WORKER_PAGE_MAX), nextCursor: external_exports.number().int().nonnegative().nullable() }).strict();
64182
64536
  var resourceResults = external_exports.object({ items: external_exports.array(external_exports.object({ merchant: merchant.omit({ payoutAddress: true }), offer })), nextCursor: external_exports.number().int().nonnegative().nullable() });
64183
64537
  var RuntimeCatalog = class {
64184
- constructor(wallet2, fetcher = fetch) {
64185
- this.wallet = wallet2;
64186
- this.http = new RuntimeHttp(wallet2.origin, fetcher);
64538
+ constructor(wallet3, fetcher = fetch) {
64539
+ this.wallet = wallet3;
64540
+ this.http = new RuntimeHttp(wallet3.origin, fetcher);
64187
64541
  }
64188
64542
  wallet;
64189
64543
  http;
@@ -64317,16 +64671,16 @@ var RuntimeCore = class {
64317
64671
  record: (code) => this.event(id, "observation", code),
64318
64672
  effect: async (key, input2, replay, perform) => {
64319
64673
  assertLease();
64320
- const hash5 = sha256(canonical(input2));
64674
+ const hash6 = sha256(canonical(input2));
64321
64675
  const prior = this.store.db.prepare("SELECT * FROM actions WHERE job=? AND key=?").get(id, key);
64322
64676
  if (prior) {
64323
- requireThat(prior.input_hash === hash5 && prior.replay === replay, "action_terms_changed");
64677
+ requireThat(prior.input_hash === hash6 && prior.replay === replay, "action_terms_changed");
64324
64678
  if (prior.status === "complete") return JSON.parse(String(prior.result));
64325
64679
  requireThat(replay === "safe", "uncertain_nonreplayable_action");
64326
64680
  requireThat(Number(prior.attempts) < 4, "action_retry_limit");
64327
64681
  }
64328
64682
  this.store.db.prepare(`INSERT INTO actions VALUES(?,?,?,'uncertain',1,NULL,?)
64329
- ON CONFLICT(job,key) DO UPDATE SET attempts=attempts+1`).run(id, key, hash5, replay);
64683
+ ON CONFLICT(job,key) DO UPDATE SET attempts=attempts+1`).run(id, key, hash6, replay);
64330
64684
  this.event(id, "dispatch", key);
64331
64685
  const result = await perform();
64332
64686
  assertLease();
@@ -64372,12 +64726,12 @@ var state = external_exports.object({
64372
64726
  transaction: external_exports.string().regex(/^0x[0-9a-fA-F]{64}$/).optional()
64373
64727
  }).strict();
64374
64728
  var ArtifactRuntime = class {
64375
- constructor(wallet2, fetcher = fetch, model) {
64376
- this.wallet = wallet2;
64729
+ constructor(wallet3, fetcher = fetch, model) {
64730
+ this.wallet = wallet3;
64377
64731
  this.model = model;
64378
- this.core = new RuntimeCore(wallet2.store, wallet2.clock);
64379
- this.http = new RuntimeHttp(wallet2.origin, fetcher);
64380
- this.catalog = new RuntimeCatalog(wallet2, fetcher);
64732
+ this.core = new RuntimeCore(wallet3.store, wallet3.clock);
64733
+ this.http = new RuntimeHttp(wallet3.origin, fetcher);
64734
+ this.catalog = new RuntimeCatalog(wallet3, fetcher);
64381
64735
  }
64382
64736
  wallet;
64383
64737
  model;
@@ -64407,11 +64761,11 @@ var ArtifactRuntime = class {
64407
64761
  const task = savedTask.parse(j.input), s = state.parse(j.state);
64408
64762
  let result = null;
64409
64763
  if (s.resultBase64) {
64410
- const text3 = Buffer.from(s.resultBase64, "base64").toString("utf8");
64764
+ const text4 = Buffer.from(s.resultBase64, "base64").toString("utf8");
64411
64765
  try {
64412
- result = s.terms?.contentType === "application/json" ? JSON.parse(text3) : text3;
64766
+ result = s.terms?.contentType === "application/json" ? JSON.parse(text4) : text4;
64413
64767
  } catch {
64414
- result = text3;
64768
+ result = text4;
64415
64769
  }
64416
64770
  }
64417
64771
  return {
@@ -64502,6 +64856,179 @@ var ArtifactRuntime = class {
64502
64856
  }
64503
64857
  };
64504
64858
 
64859
+ // src/transaction-evidence/records-schema.ts
64860
+ var digest3 = external_exports.string().regex(/^[a-f0-9]{64}$/);
64861
+ var hexDigest = external_exports.string().regex(/^0x[a-f0-9]{64}$/);
64862
+ var wallet2 = external_exports.string().regex(/^0x[0-9a-fA-F]{40}$/);
64863
+ var signature2 = external_exports.string().regex(/^0x[0-9a-fA-F]{130}$/);
64864
+ var transactionHashSchema = external_exports.string().regex(/^0x[0-9a-fA-F]{64}$/);
64865
+ var seconds = external_exports.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER);
64866
+ var amount3 = external_exports.string().regex(/^[1-9][0-9]{0,11}$/);
64867
+ var date7 = external_exports.string().datetime();
64868
+ var recordKindSchema = external_exports.enum(["operation", "protected_json", "protected_inspection"]);
64869
+ var recordIdSchema = external_exports.union([external_exports.string().uuid(), hexDigest]);
64870
+ var uuid9 = external_exports.string().uuid();
64871
+ var { $schema: _uuidSchema, ...uuidJson } = external_exports.toJSONSchema(uuid9);
64872
+ var { $schema: _hexSchema, ...hexJson } = external_exports.toJSONSchema(hexDigest);
64873
+ var recordReferenceConstraint = { allOf: [{ oneOf: [
64874
+ { type: "object", properties: { kind: { const: "operation" }, id: uuidJson } },
64875
+ { type: "object", properties: { kind: { enum: ["protected_json", "protected_inspection"] }, id: hexJson } }
64876
+ ] }] };
64877
+ var correctRecordId = (r) => (r.kind === "operation" ? uuid9 : hexDigest).safeParse(r.id).success;
64878
+ var recordReadSchema = external_exports.object({ kind: recordKindSchema, id: recordIdSchema, wallet: wallet2 }).strict().refine(correctRecordId, { path: ["id"], message: "Use a UUID for operations or lowercase bytes32 for protected jobs." }).meta(recordReferenceConstraint);
64879
+ var recordExportSchema = external_exports.object({ kind: recordKindSchema, id: recordIdSchema, challengeId: uuid9, signature: signature2 }).strict().refine(correctRecordId, { path: ["id"], message: "Use a UUID for operations or lowercase bytes32 for protected jobs." }).meta(recordReferenceConstraint);
64880
+ var signedRecordSchema = external_exports.object({ message: external_exports.string().min(1).max(2e4), signature: signature2 }).strict();
64881
+ var complaintBinding = external_exports.object({ payer: wallet2, recipient: wallet2, requestHash: digest3, workTicketId: external_exports.string().uuid().nullable(), quoteTermsHash: digest3.nullable(), resultHashAtOpen: digest3.nullable(), transaction: transactionHashSchema.nullable(), amountAtomic: amount3, asset: wallet2, network: external_exports.literal("eip155:8453") }).strict();
64882
+ var complaintFields = { wallet: wallet2, expectedRevision: external_exports.number().int().min(0).max(32), binding: complaintBinding, detail: external_exports.string().min(1).refine((s) => s.trim() === s && Array.from(s).length <= 2e3), evidenceHashes: external_exports.array(digest3).max(8) };
64883
+ var complaintStatementSchema = external_exports.discriminatedUnion("action", [
64884
+ external_exports.object({ ...complaintFields, action: external_exports.literal("open"), expectedRevision: external_exports.literal(0), reason: external_exports.enum(["not_delivered", "unreadable", "terms_mismatch"]) }).strict(),
64885
+ external_exports.object({ ...complaintFields, action: external_exports.literal("respond") }).strict(),
64886
+ external_exports.object({ ...complaintFields, action: external_exports.literal("close"), outcome: external_exports.enum(["resolved", "unresolved"]) }).strict()
64887
+ ]);
64888
+ var protectedTermsSchema = external_exports.object({ buyer: wallet2, seller: wallet2, amount: amount3, workHash: hexDigest, deliveryDeadline: seconds, evaluationPeriod: seconds, correctionPeriod: seconds, resolutionDeadline: seconds, reviewPeriod: seconds, appealPeriod: seconds, appealVerifier: wallet2, fallbackVerifier: wallet2, appealOriginHash: hexDigest, fallbackOriginHash: hexDigest, verifierHash: hexDigest, nonce: hexDigest }).strict();
64889
+ var protectedJobSchema = external_exports.object({ terms: protectedTermsSchema, state: external_exports.number().int().min(1).max(8), resultHash: hexDigest, attempt: external_exports.number().int().min(0).max(2), evaluationUntil: seconds, correctionUntil: seconds, fallbackUntil: seconds, buyerReceived: external_exports.boolean(), outcome: external_exports.number().int().min(0).max(8), reviewUntil: seconds, appealUntil: seconds, appealUsed: external_exports.boolean(), reason: external_exports.number().int().min(0).max(255), evidenceHash: hexDigest }).strict();
64890
+ var common = { protocol: external_exports.literal("402mob.transaction-evidence.v2"), origin: external_exports.string().url().max(2048), exportedAt: date7, network: external_exports.literal("eip155:8453"), asset: external_exports.literal(EVIDENCE_ASSET), source: external_exports.literal("unsigned_server_snapshot") };
64891
+ var operationContentSchema = external_exports.object({
64892
+ ...common,
64893
+ kind: external_exports.literal("operation"),
64894
+ subject: external_exports.object({ operationId: external_exports.string().uuid(), buyer: wallet2, seller: wallet2, route: external_exports.string().min(1).max(2048), requestHash: digest3, amountAtomic: amount3 }).strict(),
64895
+ payment: external_exports.object({ state: external_exports.enum(["executing", "staged", "settling", "pending", "settled", "failed", "expired"]), transactionHash: transactionHashSchema.nullable(), settlementRecorded: external_exports.boolean(), createdAt: date7, retentionExpiresAt: date7 }).strict(),
64896
+ offer: external_exports.object({ merchantId: external_exports.string().uuid(), offerId: external_exports.string().uuid(), terms: external_exports.object({ document: external_exports.string().min(1).max(2e4), hash: digest3 }).strict().nullable() }).strict().nullable(),
64897
+ delivery: external_exports.object({ resultHash: digest3.nullable(), contentType: external_exports.string().max(128).nullable(), receipts: external_exports.array(signedRecordSchema).max(100) }).strict(),
64898
+ complaint: external_exports.object({ availability: external_exports.enum(["absent", "expired", "retained"]), events: external_exports.array(signedRecordSchema).max(32) }).strict()
64899
+ }).strict();
64900
+ var protectedContentSchema = external_exports.object({
64901
+ ...common,
64902
+ kind: external_exports.enum(["protected_json", "protected_inspection"]),
64903
+ subject: external_exports.object({ jobId: hexDigest, contract: wallet2, buyer: wallet2, seller: wallet2 }).strict(),
64904
+ snapshot: external_exports.object({ observedAtSeconds: seconds, job: protectedJobSchema }).strict(),
64905
+ candidates: external_exports.array(external_exports.object({ attempt: external_exports.number().int().min(1).max(2), resultHash: hexDigest, signature: signature2, replicaA: signature2.nullable(), replicaB: signature2.nullable() }).strict()).max(2),
64906
+ // These records are not retained by the source services. Never reconstruct signatures.
64907
+ unretainedProofs: external_exports.tuple([external_exports.literal("funding_authorization"), external_exports.literal("buyer_acceptance"), external_exports.literal("verdicts"), external_exports.literal("appeals")])
64908
+ }).strict();
64909
+ var recordContentSchema = external_exports.union([operationContentSchema, protectedContentSchema]);
64910
+ var recordEvidenceSchema = external_exports.union([operationContentSchema.extend({ bundleHash: digest3 }).strict(), protectedContentSchema.extend({ bundleHash: digest3 }).strict()]);
64911
+ var verificationReportSchema = external_exports.object({
64912
+ protocol: external_exports.literal("402mob.transaction-evidence-report.v1"),
64913
+ outcome: external_exports.enum(["invalid", "incomplete", "checked"]),
64914
+ checks: external_exports.array(external_exports.object({ code: external_exports.string().min(1).max(128), status: external_exports.enum(["verified", "invalid", "missing", "not_applicable"]), detail: external_exports.string().min(1).max(2e3) }).strict()).max(256),
64915
+ chainVerification: external_exports.literal("not_performed"),
64916
+ qualityAssessment: external_exports.literal("not_performed"),
64917
+ snapshotAuthenticity: external_exports.literal("not_proven")
64918
+ }).strict();
64919
+
64920
+ // src/transaction-evidence/protected-format.ts
64921
+ var identity = [{ name: "jobId", type: "bytes32" }, { name: "attempt", type: "uint256" }, { name: "resultHash", type: "bytes32" }];
64922
+ var challengeFields = [...identity, { name: "reason", type: "uint8" }, { name: "evidenceHash", type: "bytes32" }];
64923
+ var actionTypes = { Candidate: identity, Verdict: [...identity, { name: "valid", type: "bool" }], Accept: identity, Receipt: identity, Replica: [...identity, { name: "retainedUntil", type: "uint256" }], Challenge: challengeFields, Appeal: [...challengeFields, { name: "round", type: "uint8" }, { name: "valid", type: "bool" }] };
64924
+
64925
+ // src/transaction-evidence/records.ts
64926
+ var MAX_RECORD_BYTES = 1024 * 1024;
64927
+ function parseRecordEvidence(value) {
64928
+ if (Buffer.byteLength(JSON.stringify(value) ?? "") > MAX_RECORD_BYTES) throw new Error("Evidence exceeds size limit");
64929
+ return recordEvidenceSchema.parse(value);
64930
+ }
64931
+
64932
+ // src/transaction-evidence/client.ts
64933
+ function recordEvidenceReadMessage(origin2, kind, id, wallet3, challengeId, expiresAt) {
64934
+ return ["402Mob private transaction record evidence read", `Origin: ${origin2}`, `Kind: ${kind}`, `Subject: ${id}`, `Wallet: ${wallet3.toLowerCase()}`, "Scope: retained_transaction_records", `Challenge: ${challengeId}`, `Expires: ${expiresAt}`, "Read retained participant proofs and observations only. No payment, funding, grant, receipt, dispute action, refund or settlement is authorized."].join("\n");
64935
+ }
64936
+ function evidenceReadMessage(origin2, ticketId, buyer, challengeId, expiresAt) {
64937
+ return ["402Mob private transaction evidence read", `Origin: ${origin2}`, `Ticket: ${ticketId}`, `Buyer: ${buyer.toLowerCase()}`, `Challenge: ${challengeId}`, `Expires: ${expiresAt}`, "Read retained authorization proofs and server observations only. No payment, grant, receipt, refund or dispute action is authorized."].join("\n");
64938
+ }
64939
+ var TransactionEvidenceError = class extends Error {
64940
+ constructor(status, code, message) {
64941
+ super(message);
64942
+ this.status = status;
64943
+ this.code = code;
64944
+ this.name = "TransactionEvidenceError";
64945
+ }
64946
+ status;
64947
+ code;
64948
+ };
64949
+ var TransactionEvidenceClient = class {
64950
+ origin;
64951
+ fetcher;
64952
+ apiKey;
64953
+ constructor(options) {
64954
+ const url2 = new URL(options.baseUrl);
64955
+ if (url2.username || url2.password || url2.search || url2.hash || url2.pathname !== "/" || !(url2.protocol === "https:" || url2.protocol === "http:" && ["localhost", "127.0.0.1", "[::1]"].includes(url2.hostname))) throw new TypeError("Use an HTTPS service origin (HTTP is permitted only on loopback).");
64956
+ this.origin = url2.origin;
64957
+ this.fetcher = options.fetch ?? globalThis.fetch;
64958
+ this.apiKey = options.apiKey;
64959
+ }
64960
+ id(id) {
64961
+ if (!/^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(id)) throw new TypeError("ticketId must be a UUID");
64962
+ return id;
64963
+ }
64964
+ async request(path, body, merchant2 = false) {
64965
+ if (merchant2 && !this.apiKey) throw new TypeError("A merchant:work credential is required.");
64966
+ const controller = new AbortController(), timer = setTimeout(() => controller.abort(), 15e3);
64967
+ try {
64968
+ const response = await this.fetcher(this.origin + path, { method: body === void 0 ? "GET" : "POST", redirect: "error", signal: controller.signal, headers: { Accept: "application/json", ...body === void 0 ? {} : { "Content-Type": "application/json" }, ...merchant2 ? { Authorization: "Bearer " + this.apiKey } : {} }, ...body === void 0 ? {} : { body: JSON.stringify(body) } });
64969
+ if (!response.body) throw new TransactionEvidenceError(response.status, "invalid_response", "Evidence response has no body.");
64970
+ const reader = response.body.getReader(), parts = [];
64971
+ let size5 = 0;
64972
+ try {
64973
+ while (true) {
64974
+ const chunk = await reader.read();
64975
+ if (chunk.done) break;
64976
+ size5 += chunk.value.length;
64977
+ if (size5 > (path.startsWith("/v1/transaction-evidence/") ? MAX_RECORD_BYTES : MAX_BUNDLE_BYTES)) {
64978
+ await reader.cancel();
64979
+ throw new TransactionEvidenceError(response.status, "invalid_response", "Evidence response exceeds the size limit.");
64980
+ }
64981
+ parts.push(chunk.value);
64982
+ }
64983
+ } finally {
64984
+ reader.releaseLock();
64985
+ }
64986
+ let data;
64987
+ try {
64988
+ data = JSON.parse(Buffer.concat(parts).toString("utf8"));
64989
+ } catch {
64990
+ throw new TransactionEvidenceError(response.status, "invalid_response", "Evidence response is not JSON.");
64991
+ }
64992
+ if (!response.ok) {
64993
+ const code = data && typeof data === "object" && "error" in data && typeof data.error === "string" ? data.error : "http_error";
64994
+ throw new TransactionEvidenceError(response.status, code, "Evidence request was rejected. No payment was attempted.");
64995
+ }
64996
+ return data;
64997
+ } finally {
64998
+ clearTimeout(timer);
64999
+ }
65000
+ }
65001
+ async createBuyerReadChallenge(ticketId, buyer) {
65002
+ const body = evidenceReaderSchema.parse({ buyer }), id = this.id(ticketId), data = evidenceReadChallengeSchema.parse(await this.request(`/v1/work-tickets/${id}/evidence-challenges`, body));
65003
+ if (data.message !== evidenceReadMessage(this.origin, id, buyer, data.challengeId, data.expiresAt)) throw new TransactionEvidenceError(200, "invalid_response", "Evidence read challenge does not match the requested read.");
65004
+ return data;
65005
+ }
65006
+ bundle(value, id, buyer) {
65007
+ const b = parseEvidenceBundle(value), { bundleHash, ...content } = b;
65008
+ if (b.origin !== this.origin || b.subject.ticketId !== id || buyer !== void 0 && b.subject.buyer.toLowerCase() !== buyer.toLowerCase() || evidenceHash(evidenceCanonical(content)) !== bundleHash) throw new TransactionEvidenceError(200, "invalid_response", "Evidence bundle context or hash does not match.");
65009
+ return b;
65010
+ }
65011
+ async readBuyerEvidence(ticketId, buyer, proof2) {
65012
+ const id = this.id(ticketId);
65013
+ evidenceReaderSchema.parse({ buyer });
65014
+ return this.bundle(await this.request(`/v1/work-tickets/${id}/evidence`, evidenceReadProofSchema.parse(proof2)), id, buyer);
65015
+ }
65016
+ async readMerchantEvidence(ticketId) {
65017
+ const id = this.id(ticketId);
65018
+ return this.bundle(await this.request(`/v1/agent/work-tickets/${id}/evidence`, void 0, true), id);
65019
+ }
65020
+ async createRecordReadChallenge(kind, id, wallet3) {
65021
+ const body = recordReadSchema.parse({ kind, id, wallet: wallet3 }), data = evidenceReadChallengeSchema.parse(await this.request("/v1/transaction-evidence/challenges", body));
65022
+ if (data.message !== recordEvidenceReadMessage(this.origin, kind, id, wallet3, data.challengeId, data.expiresAt)) throw new TransactionEvidenceError(200, "invalid_response", "Read challenge does not match the requested scope.");
65023
+ return data;
65024
+ }
65025
+ async readRecordEvidence(kind, id, proof2) {
65026
+ const b = parseRecordEvidence(await this.request("/v1/transaction-evidence/exports", recordExportSchema.parse({ kind, id, ...proof2 }))), { bundleHash, ...content } = b;
65027
+ if (b.origin !== this.origin || b.kind !== kind || ("operationId" in b.subject ? b.subject.operationId : b.subject.jobId) !== id || evidenceHash(evidenceCanonical(content)) !== bundleHash) throw new TransactionEvidenceError(200, "invalid_response", "Evidence context or hash does not match.");
65028
+ return b;
65029
+ }
65030
+ };
65031
+
64505
65032
  // src/runtime/buyer.ts
64506
65033
  import { randomUUID as randomUUID4 } from "node:crypto";
64507
65034
 
@@ -64523,26 +65050,27 @@ var ticket = external_exports.object({
64523
65050
  result: external_exports.object({ sha256: digest.nullable(), contentType: external_exports.string().nullable() })
64524
65051
  });
64525
65052
  var ticketResponse = external_exports.object({ ticket });
64526
- var privateTicket = ticket.extend({ buyer: external_exports.string(), input: external_exports.unknown() });
65053
+ var privateTicket = ticket.extend({ negotiation: negotiationExecution.optional(), buyer: external_exports.string(), input: external_exports.unknown() });
64527
65054
  var quoteChallenge = challenge2.extend({ quote: quote.extend({ payTo: external_exports.string(), network: external_exports.literal("eip155:8453"), asset: external_exports.string() }) });
64528
65055
  function unexpired(c, now, maxMs) {
64529
65056
  requireThat(Date.parse(c.expiresAt) > now + 1e3 && Date.parse(c.expiresAt) <= now + maxMs + 3e4, "challenge_expired_or_invalid");
64530
65057
  }
64531
- function grantMessage(c, b, amount3, key, now) {
65058
+ function grantMessage(c, b, amount4, key, now) {
64532
65059
  unexpired(c, now, 3e5);
64533
65060
  const issued = c.message.match(/^Issued: (.+)$/m)?.[1];
64534
65061
  requireThat(issued, "grant_issued_missing");
64535
65062
  requireThat(Number.isFinite(Date.parse(issued)) && Math.abs(now - Date.parse(issued)) < 3e5, "grant_issued_invalid");
64536
65063
  const expires = new Date(Date.parse(issued) + b.expiresInSeconds * 1e3).toISOString(), inputHash = sha256(canonical(b.input));
64537
- const policy = { buyer: b.buyer.toLowerCase(), merchantId: b.merchantId, capability: b.capability, inputHash, maxAmount: amount3, expiresInSeconds: b.expiresInSeconds, idempotencyKey: key };
65064
+ const policy = { ...b.negotiation ? { negotiation: b.negotiation } : {}, buyer: b.buyer.toLowerCase(), merchantId: b.merchantId, capability: b.capability, inputHash, maxAmount: amount4, expiresInSeconds: b.expiresInSeconds, idempotencyKey: key };
64538
65065
  return [
64539
65066
  "402Mob agent work ticket grant",
65067
+ ...b.negotiation ? [`Negotiation: ${canonical(b.negotiation)}`] : [],
64540
65068
  "Origin: ORIGIN",
64541
65069
  `Buyer wallet: ${b.buyer.toLowerCase()}`,
64542
65070
  `Worker merchant: ${b.merchantId}`,
64543
65071
  `Capability: ${quoteSignatureText(b.capability)}`,
64544
65072
  `Input SHA-256: ${inputHash}`,
64545
- `Maximum USDC atomic: ${amount3}`,
65073
+ `Maximum USDC atomic: ${amount4}`,
64546
65074
  "Network: eip155:8453",
64547
65075
  `Asset: ${USDC}`,
64548
65076
  `Issued: ${issued}`,
@@ -64557,7 +65085,7 @@ function grantMessage(c, b, amount3, key, now) {
64557
65085
  function quoteHash(t) {
64558
65086
  const q = t.quote;
64559
65087
  requireThat(q, "quote_missing");
64560
- return sha256(canonical({ ticketId: t.id, merchantId: t.merchantId, quoteId: q.id, amount: q.amountAtomic, deliverable: q.deliverable, contentType: q.contentType, expiresAt: q.expiresAt }));
65088
+ return sha256(canonical({ ...t.negotiation ? { negotiation: t.negotiation } : {}, ticketId: t.id, merchantId: t.merchantId, quoteId: q.id, amount: q.amountAtomic, deliverable: q.deliverable, contentType: q.contentType, expiresAt: q.expiresAt }));
64561
65089
  }
64562
65090
 
64563
65091
  // src/runtime/buyer.ts
@@ -64565,6 +65093,8 @@ var workBuyerTask = external_exports.object({
64565
65093
  id: uuid3,
64566
65094
  input: textInput,
64567
65095
  maxPriceUSDC: amount,
65096
+ negotiation: negotiationReference.optional(),
65097
+ expiresInSeconds: external_exports.number().int().min(60).max(86400).optional(),
64568
65098
  merchantId: uuid3.optional().describe("Choose the seller for this task. Required unless the delegation fixes a merchant.")
64569
65099
  }).strict();
64570
65100
  var buyerTask = external_exports.union([workBuyerTask, artifactTask]);
@@ -64574,7 +65104,7 @@ var buyerView = external_exports.object({
64574
65104
  offerId: uuid3.optional(),
64575
65105
  merchantId: uuid3,
64576
65106
  status: external_exports.enum(["active", "complete", "rejected", "needs_attention"]),
64577
- stage: external_exports.enum(["create", "quote", "pay", "result", "receipt", "done"]),
65107
+ stage: external_exports.enum(["create", "bind", "quote", "pay", "result", "receipt", "done"]),
64578
65108
  error: external_exports.string().nullable(),
64579
65109
  nextAt: external_exports.number().int().nonnegative(),
64580
65110
  ticketId: uuid3.nullable(),
@@ -64589,9 +65119,10 @@ var buyerView = external_exports.object({
64589
65119
  }).strict();
64590
65120
  var taskInput = workBuyerTask.extend({ delegation: uuid3, deadline: date5, targetMerchantId: uuid3.optional() }).strict();
64591
65121
  var stateSchema = external_exports.object({
64592
- stage: external_exports.enum(["create", "quote", "pay", "result", "receipt", "done"]),
65122
+ stage: external_exports.enum(["create", "bind", "quote", "pay", "result", "receipt", "done"]),
64593
65123
  ticketId: uuid3.optional(),
64594
65124
  proofRevision: external_exports.number().int().min(0).max(3).default(0),
65125
+ negotiation: negotiationExecution.optional(),
64595
65126
  operationId: uuid3.optional(),
64596
65127
  grant: proof.optional(),
64597
65128
  accepted: quoteChallenge.optional(),
@@ -64600,12 +65131,13 @@ var stateSchema = external_exports.object({
64600
65131
  verdict: external_exports.enum(["accepted", "disputed"]).optional()
64601
65132
  }).strict();
64602
65133
  var BuyerRuntime = class {
64603
- constructor(wallet2, fetcher = fetch, model) {
64604
- this.wallet = wallet2;
65134
+ constructor(wallet3, fetcher = fetch, model) {
65135
+ this.wallet = wallet3;
64605
65136
  this.model = model;
64606
- this.core = new RuntimeCore(wallet2.store, wallet2.clock);
64607
- this.http = new RuntimeHttp(wallet2.origin, fetcher);
64608
- this.artifacts = new ArtifactRuntime(wallet2, fetcher, model);
65137
+ this.evidence = new TransactionEvidenceClient({ baseUrl: wallet3.origin, fetch: fetcher });
65138
+ this.core = new RuntimeCore(wallet3.store, wallet3.clock);
65139
+ this.http = new RuntimeHttp(wallet3.origin, fetcher);
65140
+ this.artifacts = new ArtifactRuntime(wallet3, fetcher, model);
64609
65141
  this.catalog = this.artifacts.catalog;
64610
65142
  }
64611
65143
  wallet;
@@ -64615,6 +65147,7 @@ var BuyerRuntime = class {
64615
65147
  http;
64616
65148
  artifacts;
64617
65149
  catalog;
65150
+ evidence;
64618
65151
  create(delegation, input2) {
64619
65152
  const parsed = buyerTask.parse(input2);
64620
65153
  if ("kind" in parsed) return buyerView.parse(this.artifacts.create(delegation, parsed));
@@ -64668,6 +65201,19 @@ var BuyerRuntime = class {
64668
65201
  tick(id) {
64669
65202
  return this.core.tick(id, this);
64670
65203
  }
65204
+ async evidenceRead(read) {
65205
+ try {
65206
+ return await read();
65207
+ } catch (error62) {
65208
+ if (error62 instanceof TransactionEvidenceError) {
65209
+ if (error62.status === 429 || error62.status >= 500) throw new RemoteHttpFault(error62.status);
65210
+ throw new RuntimeFault("negotiation_evidence_invalid");
65211
+ }
65212
+ if (error62 instanceof external_exports.ZodError) throw new RuntimeFault("negotiation_evidence_invalid");
65213
+ if (error62 instanceof RuntimeFault) throw error62;
65214
+ throw new RuntimeFault("transport_uncertain", true);
65215
+ }
65216
+ }
64671
65217
  async proofKey(c, s, key, terms) {
64672
65218
  await c.effect(key + "-terms", terms, "safe", async () => true);
64673
65219
  return (name) => name + (s.proofRevision ? ":" + s.proofRevision : "");
@@ -64681,7 +65227,11 @@ var BuyerRuntime = class {
64681
65227
  checkTicket(t, c, state2) {
64682
65228
  const task = taskInput.parse(c.job.input), p = this.wallet.policy(task.delegation).policy;
64683
65229
  requireThat(t.id === state2.ticketId && t.merchantId === (task.targetMerchantId ?? p.merchantId) && t.capability === TEXT_CAPABILITY && t.inputHash === sha256(canonical(task.input)) && t.maxPriceAtomic === toAtomic(task.maxPriceUSDC).toString(), "ticket_binding_mismatch");
64684
- if (t.quote) requireThat(quoteHash(t) === t.quote.termsHash, "quote_hash_mismatch");
65230
+ if (task.negotiation && state2.stage !== "bind") {
65231
+ requireThat(state2.negotiation && canonical(state2.negotiation.reference) === canonical(task.negotiation), "negotiation_binding_missing");
65232
+ checkTextNegotiation(state2.negotiation, this.wallet.address, t.merchantId, task.maxPriceUSDC);
65233
+ }
65234
+ if (t.quote && state2.stage !== "bind") requireThat(quoteHash({ ...t, ...state2.negotiation ? { negotiation: state2.negotiation } : {} }) === t.quote.termsHash, "quote_hash_mismatch");
64685
65235
  if (state2.accepted) requireThat(t.quote && canonical(t.quote) === canonical(quote.parse(state2.accepted.quote)), "quote_changed");
64686
65236
  if (state2.operationId) requireThat(t.payment.operationId === state2.operationId, "payment_operation_changed");
64687
65237
  }
@@ -64695,7 +65245,7 @@ var BuyerRuntime = class {
64695
65245
  if (s.stage === "create") {
64696
65246
  this.wallet.assertActive(task.delegation);
64697
65247
  if (this.model && !await this.model.admit(c, { role: "buyer", capability: TEXT_CAPABILITY, input: task.input, maxPriceUSDC: task.maxPriceUSDC })) return { state: s, status: "rejected" };
64698
- const body = { buyer, merchantId, capability: TEXT_CAPABILITY, input: task.input, maxPriceUSDC: task.maxPriceUSDC, expiresInSeconds: 3600 };
65248
+ const body = { ...task.negotiation ? { negotiation: task.negotiation } : {}, buyer, merchantId, capability: TEXT_CAPABILITY, input: task.input, maxPriceUSDC: task.maxPriceUSDC, expiresInSeconds: task.expiresInSeconds ?? 3600 };
64699
65249
  const action = await this.proofKey(c, s, "grant", body);
64700
65250
  const signed = await c.effect(action("grant-proof"), body, "safe", async () => {
64701
65251
  const ch = await this.http.json("/v1/work-tickets/challenges", challenge2, body, { "Idempotency-Key": key });
@@ -64715,7 +65265,7 @@ var BuyerRuntime = class {
64715
65265
  } catch (error62) {
64716
65266
  return this.renewProof(c, s, error62, "invalid_work_ticket_challenge");
64717
65267
  }
64718
- const next = { ...s, proofRevision: 0, stage: "quote", ticketId: created.ticket.id, grant: proof.parse(signed) };
65268
+ const next = { ...s, proofRevision: 0, stage: task.negotiation ? "bind" : "quote", ticketId: created.ticket.id, grant: proof.parse(signed) };
64719
65269
  this.checkTicket(created.ticket, c, next);
64720
65270
  return { state: next };
64721
65271
  }
@@ -64723,6 +65273,22 @@ var BuyerRuntime = class {
64723
65273
  const path = `/v1/work-tickets/${s.ticketId}`;
64724
65274
  const current = (await this.http.json(path, ticketResponse)).ticket;
64725
65275
  this.checkTicket(current, c, s);
65276
+ if (s.stage === "bind") {
65277
+ requireThat(task.negotiation, "negotiation_reference_missing");
65278
+ const binding = await c.effect("negotiation-evidence", { ticketId: s.ticketId, reference: task.negotiation }, "safe", async () => {
65279
+ const ch = await this.evidenceRead(() => this.evidence.createBuyerReadChallenge(s.ticketId, buyer));
65280
+ unexpired(ch, this.wallet.clock(), 12e4);
65281
+ const signature3 = await this.wallet.signMessage(ch.message);
65282
+ const evidence = await this.evidenceRead(() => this.evidence.readBuyerEvidence(s.ticketId, buyer, { challengeId: ch.challengeId, signature: signature3 }));
65283
+ const checked = await verifyEvidenceBundle(evidence, { origin: this.http.origin, ticketId: s.ticketId, buyer });
65284
+ requireThat(!checked.checks.some((x) => x.status === "invalid") && evidence.grant.message === s.grant.message && evidence.grant.signature === s.grant.signature, "negotiation_evidence_invalid");
65285
+ const n = negotiationExecution.parse(evidence.negotiation);
65286
+ requireThat(canonical(n.reference) === canonical(task.negotiation), "negotiation_reference_mismatch");
65287
+ checkTextNegotiation(n, buyer, merchantId, task.maxPriceUSDC);
65288
+ return n;
65289
+ });
65290
+ return { state: { ...s, negotiation: binding, stage: "quote" } };
65291
+ }
64726
65292
  if (s.stage === "quote") {
64727
65293
  if (current.state === "open" || current.state === "claimed") return { state: s, waitMs: 5e3 };
64728
65294
  requireThat(current.state === "quoted" || current.state === "accepted", "quote_unavailable");
@@ -64734,13 +65300,14 @@ var BuyerRuntime = class {
64734
65300
  unexpired(ch, this.wallet.clock(), 12e4);
64735
65301
  const q = ch.quote;
64736
65302
  address.parse(q.payTo);
64737
- requireThat((!policy.payee || q.payTo.toLowerCase() === policy.payee.toLowerCase()) && q.asset.toLowerCase() === USDC.toLowerCase() && q.termsHash === current.quote?.termsHash && q.deliverable === TEXT_DELIVERABLE && q.contentType === "application/json" && BigInt(q.amountAtomic) <= toAtomic(task.maxPriceUSDC) && Date.parse(q.expiresAt) > this.wallet.clock() + 5e3, "quote_outside_task");
65303
+ requireThat((!s.negotiation || q.payTo.toLowerCase() === s.negotiation.payTo.toLowerCase() && BigInt(q.amountAtomic) === toAtomic(s.negotiation.terms.priceUSDC) && Date.parse(q.expiresAt) <= Date.parse(s.negotiation.deliveryDeadline) && Date.parse(q.expiresAt) <= Date.parse(s.negotiation.expiresAt)) && (!policy.payee || q.payTo.toLowerCase() === policy.payee.toLowerCase()) && q.asset.toLowerCase() === USDC.toLowerCase() && q.termsHash === current.quote?.termsHash && q.deliverable === TEXT_DELIVERABLE && q.contentType === "application/json" && BigInt(q.amountAtomic) <= toAtomic(task.maxPriceUSDC) && Date.parse(q.expiresAt) > this.wallet.clock() + 5e3, "quote_outside_task");
64738
65304
  const expected = [
64739
65305
  "402Mob work quote acceptance",
64740
65306
  `Origin: ${this.http.origin}`,
64741
65307
  `Ticket: ${s.ticketId}`,
64742
65308
  `Grant challenge: ${s.grant.challengeId}`,
64743
65309
  `Grant message SHA-256: ${sha256(s.grant.message)}`,
65310
+ ...s.negotiation ? [`Negotiation: ${canonical(s.negotiation.reference)}`, `Negotiated terms SHA-256: ${sha256(canonical(s.negotiation))}`] : [],
64744
65311
  `Buyer wallet: ${buyer}`,
64745
65312
  `Worker merchant: ${merchantId}`,
64746
65313
  `Worker payout wallet: ${q.payTo}`,
@@ -64855,8 +65422,8 @@ var BuyerRuntime = class {
64855
65422
  return { state: s, status: "complete" };
64856
65423
  }
64857
65424
  };
64858
- function newBuyerTask(text3, maxPriceUSDC, merchantId) {
64859
- return workBuyerTask.parse({ id: randomUUID4(), input: { text: text3 }, maxPriceUSDC, ...merchantId !== void 0 ? { merchantId } : {} });
65425
+ function newBuyerTask(text4, maxPriceUSDC, merchantId) {
65426
+ return workBuyerTask.parse({ id: randomUUID4(), input: { text: text4 }, maxPriceUSDC, ...merchantId !== void 0 ? { merchantId } : {} });
64860
65427
  }
64861
65428
 
64862
65429
  // src/runtime/server.ts
@@ -65118,6 +65685,10 @@ var SellerRuntime = class {
65118
65685
  return { state: { ...s, stage: "done" }, status: "complete" };
65119
65686
  }
65120
65687
  if (t.capability !== TEXT_CAPABILITY || !textInput.safeParse(t.input).success || BigInt(t.maxPriceAtomic) < toAtomic(this.config.priceUSDC)) return { state: { ...s, stage: "done" }, status: "rejected" };
65688
+ if (t.negotiation) {
65689
+ checkTextNegotiation(t.negotiation, t.buyer, t.merchantId, this.config.priceUSDC);
65690
+ requireThat(t.negotiation.payTo.toLowerCase() === this.address.toLowerCase(), "negotiation_payout_mismatch");
65691
+ }
65121
65692
  requireThat(sha256(canonical(t.input)) === t.inputHash, "input_integrity_mismatch");
65122
65693
  if (t.quote) requireThat(quoteHash(t) === t.quote.termsHash && t.quote.amountAtomic === String(toAtomic(this.config.priceUSDC)) && t.quote.deliverable === TEXT_DELIVERABLE && t.quote.contentType === "application/json", "seller_quote_changed");
65123
65694
  if (s.stage === "inspect") {
@@ -65266,11 +65837,11 @@ var ModelGate = class {
65266
65837
  async admit(c, context) {
65267
65838
  const input2 = { adapter: this.adapter.id, context }, encoded = canonical(input2);
65268
65839
  requireThat(Buffer.byteLength(encoded) <= 2e4, "model_context_too_large");
65269
- const key = "model-decision:" + c.job.id, hash5 = sha256(encoded);
65840
+ const key = "model-decision:" + c.job.id, hash6 = sha256(encoded);
65270
65841
  const decision = await c.effect("model-admission", input2, "safe", async () => {
65271
65842
  const saved = this.store.get(key);
65272
65843
  if (saved) {
65273
- requireThat(saved.hash === hash5, "model_context_changed");
65844
+ requireThat(saved.hash === hash6, "model_context_changed");
65274
65845
  return admission.parse(saved.decision);
65275
65846
  }
65276
65847
  const reserve = Buffer.byteLength(encoded) + 2304;
@@ -65306,7 +65877,7 @@ var ModelGate = class {
65306
65877
  parsed = void 0;
65307
65878
  }
65308
65879
  if (parsed?.success) {
65309
- this.store.put(key, { hash: hash5, decision: parsed.data });
65880
+ this.store.put(key, { hash: hash6, decision: parsed.data });
65310
65881
  return parsed.data;
65311
65882
  }
65312
65883
  c.record("model_schema_repair");
@@ -65400,9 +65971,9 @@ var WalletWebService = class {
65400
65971
  agentGateway;
65401
65972
  model;
65402
65973
  open() {
65403
- const wallet2 = new DelegatedWallet(this.store, this.chain, this.clock);
65404
- requireThat(wallet2.origin === this.serviceOrigin, "wallet_service_origin_changed");
65405
- this.runtime = new BuyerRuntime(wallet2, this.fetcher, this.model);
65974
+ const wallet3 = new DelegatedWallet(this.store, this.chain, this.clock);
65975
+ requireThat(wallet3.origin === this.serviceOrigin, "wallet_service_origin_changed");
65976
+ this.runtime = new BuyerRuntime(wallet3, this.fetcher, this.model);
65406
65977
  }
65407
65978
  ready() {
65408
65979
  requireThat(this.runtime, "wallet_not_created");
@@ -65434,8 +66005,8 @@ var WalletWebService = class {
65434
66005
  });
65435
66006
  }
65436
66007
  async balance() {
65437
- const wallet2 = this.ready().wallet, balance = await this.chain.balance(wallet2.address);
65438
- return webBalance.parse({ address: wallet2.address, network: NETWORK, asset: USDC, balanceAtomic: String(balance), observedAt: new Date(this.clock()).toISOString() });
66008
+ const wallet3 = this.ready().wallet, balance = await this.chain.balance(wallet3.address);
66009
+ return webBalance.parse({ address: wallet3.address, network: NETWORK, asset: USDC, balanceAtomic: String(balance), observedAt: new Date(this.clock()).toISOString() });
65439
66010
  }
65440
66011
  grant(input2) {
65441
66012
  const { requestId, policy } = webGrantInput.parse(input2);
@@ -65851,7 +66422,7 @@ async function main() {
65851
66422
  requireThat(positionals.length === 2, "expected_role_and_command");
65852
66423
  if (role === "buyer") {
65853
66424
  if (command === "prepare") {
65854
- const text3 = readFileSync2(needed("text-file"), "utf8"), task2 = newBuyerTask(text3, needed("max-usdc"), v["merchant-id"]);
66425
+ const text4 = readFileSync2(needed("text-file"), "utf8"), task2 = newBuyerTask(text4, needed("max-usdc"), v["merchant-id"]);
65855
66426
  out(needed("out"), task2);
65856
66427
  print({ id: task2.id, requestFile: resolve2(needed("out")) });
65857
66428
  return;
@@ -65973,17 +66544,17 @@ async function main() {
65973
66544
  requireThat(!store.get("wallet"), "wallet_already_exists");
65974
66545
  DelegatedWallet.initialize(store, { origin: v.origin ?? "https://evidence.contact", maxTotalUSDC: v["max-usdc"] ?? null });
65975
66546
  }
65976
- const wallet2 = new DelegatedWallet(store, chain);
66547
+ const wallet3 = new DelegatedWallet(store, chain);
65977
66548
  if (command === "init" || command === "status") {
65978
- print(wallet2.status());
66549
+ print(wallet3.status());
65979
66550
  return;
65980
66551
  }
65981
66552
  if (command === "limit") {
65982
- print(wallet2.setLimit(readJson(needed("file"))));
66553
+ print(wallet3.setLimit(readJson(needed("file"))));
65983
66554
  return;
65984
66555
  }
65985
66556
  if (command === "allocation") {
65986
- print(wallet2.increaseAllocation(needed("id"), readJson(needed("file"))));
66557
+ print(wallet3.increaseAllocation(needed("id"), readJson(needed("file"))));
65987
66558
  return;
65988
66559
  }
65989
66560
  if (command === "grant") {
@@ -65991,34 +66562,34 @@ async function main() {
65991
66562
  if (file2) requireThat(!existsSync2(file2), "credential_file_exists");
65992
66563
  requireThat(!v.file || !v.name && !v["max-usdc"], "choose_policy_file_or_name");
65993
66564
  const gateway = origin(v.gateway ?? "http://127.0.0.1:4031");
65994
- const grant = wallet2.grant(v.file ? readJson(v.file) : { name: needed("name"), ...v["max-usdc"] ? { maxTotalUSDC: v["max-usdc"] } : {} }, randomUUID5());
66565
+ const grant = wallet3.grant(v.file ? readJson(v.file) : { name: needed("name"), ...v["max-usdc"] ? { maxTotalUSDC: v["max-usdc"] } : {} }, randomUUID5());
65995
66566
  const connection = { ...grant, gateway };
65996
66567
  if (file2) {
65997
66568
  try {
65998
66569
  out(file2, connection);
65999
66570
  } catch (e) {
66000
- wallet2.revoke(grant.id);
66571
+ wallet3.revoke(grant.id);
66001
66572
  throw e;
66002
66573
  }
66003
- print({ delegationId: grant.id, credentialFile: resolve2(file2), wallet: wallet2.address, policy: grant.policy });
66574
+ print({ delegationId: grant.id, credentialFile: resolve2(file2), wallet: wallet3.address, policy: grant.policy });
66004
66575
  } else print(connection);
66005
66576
  return;
66006
66577
  }
66007
66578
  if (command === "revoke") {
66008
- wallet2.revoke(uuid3.parse(needed("id")));
66009
- print(wallet2.status(needed("id")));
66579
+ wallet3.revoke(uuid3.parse(needed("id")));
66580
+ print(wallet3.status(needed("id")));
66010
66581
  return;
66011
66582
  }
66012
66583
  if (command === "retry") {
66013
- const buyer2 = new BuyerRuntime(wallet2);
66584
+ const buyer2 = new BuyerRuntime(wallet3);
66014
66585
  buyer2.core.retry(uuid3.parse(needed("id")));
66015
66586
  print(buyer2.core.context(needed("id")));
66016
66587
  return;
66017
66588
  }
66018
66589
  requireThat(command === "serve", "unknown_wallet_command");
66019
66590
  const port = external_exports.coerce.number().int().min(1).max(65535).parse(v.port ?? "4031");
66020
- const buyer = new BuyerRuntime(wallet2, fetch, loadModelGate(store, v["model-config"])), server = await listenLoopback(createWalletApp(buyer), port);
66021
- print({ gateway: `http://127.0.0.1:${port}`, wallet: wallet2.address, message: "Agents use delegation credentials; keep this directory under owner control." });
66591
+ const buyer = new BuyerRuntime(wallet3, fetch, loadModelGate(store, v["model-config"])), server = await listenLoopback(createWalletApp(buyer), port);
66592
+ print({ gateway: `http://127.0.0.1:${port}`, wallet: wallet3.address, message: "Agents use delegation credentials; keep this directory under owner control." });
66022
66593
  try {
66023
66594
  while (!stopped) {
66024
66595
  for (const job of buyer.core.active(buyer.name)) {