@opendatalabs/vana-sdk 3.22.0-pr.208.e9c19e9 → 3.22.0-pr.209.13d545d

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.
@@ -1219,8 +1219,6 @@ __export(index_node_exports, {
1219
1219
  ENCLAVE_TRUST_ANCHORS: () => ENCLAVE_TRUST_ANCHORS,
1220
1220
  ENCLAVE_WALLET_PURPOSE: () => ENCLAVE_WALLET_PURPOSE,
1221
1221
  ESCROW_DEPOSIT_ABI: () => ESCROW_DEPOSIT_ABI2,
1222
- EscrowWithdrawalLifecycleError: () => EscrowWithdrawalLifecycleError,
1223
- EscrowWithdrawalRejectionError: () => EscrowWithdrawalRejectionError,
1224
1222
  ExpiredTokenError: () => ExpiredTokenError,
1225
1223
  FEE_REGISTRY_ABI: () => FEE_REGISTRY_ABI,
1226
1224
  GENERIC_PAYMENT_TYPES: () => GENERIC_PAYMENT_TYPES,
@@ -1306,7 +1304,6 @@ __export(index_node_exports, {
1306
1304
  UserRejectedRequestError: () => UserRejectedRequestError,
1307
1305
  VanaError: () => VanaError,
1308
1306
  VanaStorage: () => VanaStorage,
1309
- WITHDRAW_AUTHORIZATION_TYPES: () => WITHDRAW_AUTHORIZATION_TYPES,
1310
1307
  WRITER_ATTRIBUTION_KEY: () => WRITER_ATTRIBUTION_KEY,
1311
1308
  WRITE_CONTENT_DISPOSITION_HEADER: () => WRITE_CONTENT_DISPOSITION_HEADER,
1312
1309
  WRITE_FILENAME_HEADER: () => WRITE_FILENAME_HEADER,
@@ -1344,7 +1341,6 @@ __export(index_node_exports, {
1344
1341
  buildPersonalServerRegistrationTypedData: () => buildPersonalServerRegistrationTypedData,
1345
1342
  buildSetDataPointStatusRequest: () => buildSetDataPointStatusRequest,
1346
1343
  buildWeb3SignedHeader: () => buildWeb3SignedHeader,
1347
- buildWithdrawAuthorizationTypedData: () => buildWithdrawAuthorizationTypedData,
1348
1344
  builderRegistrationDomain: () => builderRegistrationDomain,
1349
1345
  canonicalJobRequestBytes: () => canonicalJobRequestBytes,
1350
1346
  chains: () => chains,
@@ -1469,7 +1465,6 @@ __export(index_node_exports, {
1469
1465
  verifyWeb3Signed: () => verifyWeb3Signed,
1470
1466
  waitForDerivativeStatus: () => waitForDerivativeStatus,
1471
1467
  waitForQuestion: () => waitForQuestion,
1472
- withdrawAuthorizationDomain: () => withdrawAuthorizationDomain,
1473
1468
  writeData: () => writeData,
1474
1469
  writePersonalServerData: () => writePersonalServerData
1475
1470
  });
@@ -32628,9 +32623,6 @@ function escrowPaymentDomain(config) {
32628
32623
  config.contracts.dataPortabilityEscrow
32629
32624
  );
32630
32625
  }
32631
- function withdrawAuthorizationDomain(config) {
32632
- return escrowPaymentDomain(config);
32633
- }
32634
32626
  var GRANT_REGISTRATION_TYPES = {
32635
32627
  GrantRegistration: [
32636
32628
  { name: "grantorAddress", type: "address" },
@@ -32663,15 +32655,6 @@ var BUILDER_REGISTRATION_TYPES = {
32663
32655
  { name: "appUrl", type: "string" }
32664
32656
  ]
32665
32657
  };
32666
- var WITHDRAW_AUTHORIZATION_TYPES = {
32667
- WithdrawAuthorization: [
32668
- { name: "account", type: "address" },
32669
- { name: "asset", type: "address" },
32670
- { name: "amount", type: "uint256" },
32671
- { name: "withdrawNonce", type: "uint256" },
32672
- { name: "deadline", type: "uint256" }
32673
- ]
32674
- };
32675
32658
  var ADD_DATA_TYPES = {
32676
32659
  AddData: [
32677
32660
  { name: "ownerAddress", type: "address" },
@@ -32690,14 +32673,6 @@ var RECORD_DATA_ACCESS_TYPES = {
32690
32673
  { name: "recordId", type: "bytes32" }
32691
32674
  ]
32692
32675
  };
32693
- function buildWithdrawAuthorizationTypedData(config, message) {
32694
- return {
32695
- domain: withdrawAuthorizationDomain(config),
32696
- types: WITHDRAW_AUTHORIZATION_TYPES,
32697
- primaryType: "WithdrawAuthorization",
32698
- message
32699
- };
32700
- }
32701
32676
 
32702
32677
  // src/protocol/identity.ts
32703
32678
  var secp256k14 = __toESM(require("@noble/secp256k1"), 1);
@@ -32908,11 +32883,9 @@ function canonicalJsonBytes(value) {
32908
32883
  return textEncoder.encode(JSON.stringify(sortJsonKeys(value)));
32909
32884
  }
32910
32885
  function canonicalJobRequestBytes(request) {
32911
- validateJobRequest(request);
32912
32886
  return canonicalJsonBytes(request);
32913
32887
  }
32914
32888
  function requestPlaintext(envelope) {
32915
- validateRequestEnvelope(envelope);
32916
32889
  return canonicalJsonBytes(envelope);
32917
32890
  }
32918
32891
  function resultPlaintext(result) {
@@ -32945,99 +32918,42 @@ function parseObject(plaintext, kind) {
32945
32918
  throw new JobEnvelopeError(`Invalid ${kind}: malformed JSON`);
32946
32919
  }
32947
32920
  }
32948
- function isPlainObject2(value) {
32949
- if (value === null || typeof value !== "object") return false;
32950
- const prototype = Object.getPrototypeOf(value);
32951
- return prototype === Object.prototype || prototype === null;
32952
- }
32953
- function requirePlainObject(value, field, kind) {
32954
- if (!isPlainObject2(value)) {
32955
- throw new JobEnvelopeError(`Invalid ${kind}: invalid ${field}`);
32956
- }
32957
- }
32958
- function requireExactKeys(value, expectedKeys, kind) {
32959
- for (const key of expectedKeys) {
32960
- if (!Object.hasOwn(value, key) || value[key] === void 0) {
32961
- throw new JobEnvelopeError(`Invalid ${kind}: missing ${key}`);
32962
- }
32963
- }
32964
- const expected = new Set(expectedKeys);
32965
- for (const key of Reflect.ownKeys(value)) {
32966
- if (!expected.has(key)) {
32967
- throw new JobEnvelopeError(
32968
- `Invalid ${kind}: unknown field ${String(key)}`
32969
- );
32970
- }
32971
- }
32972
- }
32973
32921
  function requireString(value, field, kind) {
32974
32922
  if (typeof value !== "string" || value.length === 0) {
32975
32923
  throw new JobEnvelopeError(`Invalid ${kind}: missing ${field}`);
32976
32924
  }
32977
32925
  }
32978
- function validateJobRequest(value) {
32979
- requirePlainObject(value, "request", "job request");
32980
- requireExactKeys(
32981
- value,
32982
- [
32983
- "v",
32984
- "jobId",
32985
- "owner",
32986
- "builder",
32987
- "builderPublicKey",
32988
- "grantId",
32989
- "scope",
32990
- "operation",
32991
- "pinnedVersion",
32992
- "deadline"
32993
- ],
32994
- "job request"
32995
- );
32996
- if (value.v !== JOB_PROTOCOL_VERSION) {
32926
+ function validateRequestEnvelope(value) {
32927
+ const request = value.request;
32928
+ if (request === null || typeof request !== "object" || Array.isArray(request)) {
32929
+ throw new JobEnvelopeError("Invalid job request envelope: missing request");
32930
+ }
32931
+ const fields = request;
32932
+ if (fields.v !== 1) {
32997
32933
  throw new JobEnvelopeError(
32998
- `Unsupported job request version: ${String(value.v)}`
32934
+ `Unsupported job request version: ${String(fields.v)}`
32999
32935
  );
33000
32936
  }
33001
- requireString(value.jobId, "jobId", "job request");
33002
- if (typeof value.owner !== "string" || !(0, import_viem15.isAddress)(value.owner)) {
33003
- throw new JobEnvelopeError("Invalid job request: invalid owner");
33004
- }
33005
- if (typeof value.builder !== "string" || !(0, import_viem15.isAddress)(value.builder)) {
33006
- throw new JobEnvelopeError("Invalid job request: invalid builder");
33007
- }
33008
- if (typeof value.builderPublicKey !== "string" || !(0, import_viem15.isHex)(value.builderPublicKey)) {
33009
- throw new JobEnvelopeError("Invalid job request: invalid builderPublicKey");
33010
- }
33011
- if (typeof value.grantId !== "string" || !(0, import_viem15.isHex)(value.grantId)) {
33012
- throw new JobEnvelopeError("Invalid job request: invalid grantId");
33013
- }
33014
- requireString(value.scope, "scope", "job request");
33015
- if (!JOB_OPERATIONS.includes(value.operation)) {
33016
- throw new JobEnvelopeError("Invalid job request: invalid operation");
33017
- }
33018
- if (value.pinnedVersion !== null && typeof value.pinnedVersion !== "string") {
32937
+ for (const field of [
32938
+ "jobId",
32939
+ "owner",
32940
+ "builder",
32941
+ "builderPublicKey",
32942
+ "grantId",
32943
+ "scope",
32944
+ "operation",
32945
+ "deadline"
32946
+ ]) {
32947
+ requireString(fields[field], field, "job request");
32948
+ }
32949
+ if (fields.pinnedVersion !== null && typeof fields.pinnedVersion !== "string") {
33019
32950
  throw new JobEnvelopeError("Invalid job request: missing pinnedVersion");
33020
32951
  }
33021
- if (typeof value.deadline !== "string" || !Number.isFinite(Date.parse(value.deadline))) {
33022
- throw new JobEnvelopeError("Invalid job request: invalid deadline");
33023
- }
33024
- return value;
33025
- }
33026
- function validateRequestEnvelope(value) {
33027
- requirePlainObject(value, "envelope", "job request envelope");
33028
- requireExactKeys(value, ["request", "auth"], "job request envelope");
33029
- validateJobRequest(value.request);
33030
32952
  requireString(value.auth, "auth", "job request envelope");
33031
32953
  return value;
33032
32954
  }
33033
32955
  function validateResult(value) {
33034
- requirePlainObject(value, "result", "job result");
33035
- requireExactKeys(
33036
- value,
33037
- ["v", "jobId", "scope", "version", "contentType", "body"],
33038
- "job result"
33039
- );
33040
- if (value.v !== JOB_PROTOCOL_VERSION) {
32956
+ if (value.v !== 1) {
33041
32957
  throw new JobEnvelopeError(
33042
32958
  `Unsupported job result version: ${String(value.v)}`
33043
32959
  );
@@ -33053,10 +32969,10 @@ function validateResult(value) {
33053
32969
  }
33054
32970
  return value;
33055
32971
  }
33056
- async function sealJobRequest(envelope, enclavePublicKey, ecies) {
32972
+ async function sealJobRequest(e, enclavePublicKey, ecies) {
33057
32973
  const encrypted = await ecies.encrypt(
33058
32974
  (0, import_viem15.fromHex)(enclavePublicKey, "bytes"),
33059
- requestPlaintext(envelope)
32975
+ requestPlaintext(e)
33060
32976
  );
33061
32977
  return encryptedBytesToBase64(encrypted);
33062
32978
  }
@@ -33069,11 +32985,10 @@ async function openJobRequest(ciphertext, privateKey, ecies) {
33069
32985
  parseObject(plaintext, "job request envelope")
33070
32986
  );
33071
32987
  }
33072
- async function sealJobResult(result, builderPublicKey, ecies) {
33073
- validateResult(result);
32988
+ async function sealJobResult(r, builderPublicKey, ecies) {
33074
32989
  const encrypted = await ecies.encrypt(
33075
32990
  (0, import_viem15.fromHex)(builderPublicKey, "bytes"),
33076
- resultPlaintext(result)
32991
+ resultPlaintext(r)
33077
32992
  );
33078
32993
  const ciphertext = encryptedBytesToBase64(encrypted);
33079
32994
  const bytes = fromBase64(ciphertext);
@@ -36162,7 +36077,6 @@ function createGatewayClient(baseUrl) {
36162
36077
  }
36163
36078
 
36164
36079
  // src/protocol/escrow.ts
36165
- var import_viem27 = require("viem");
36166
36080
  var GENERIC_PAYMENT_TYPES = {
36167
36081
  GenericPayment: [
36168
36082
  { name: "payerAddress", type: "address" },
@@ -36202,26 +36116,6 @@ var ESCROW_DEPOSIT_ABI2 = [
36202
36116
  }
36203
36117
  ];
36204
36118
  var NATIVE_ASSET_ADDRESS = "0x0000000000000000000000000000000000000000";
36205
- var EscrowWithdrawalLifecycleError = class extends Error {
36206
- constructor(httpStatus, result) {
36207
- super(result.error);
36208
- this.httpStatus = httpStatus;
36209
- this.result = result;
36210
- }
36211
- httpStatus;
36212
- result;
36213
- name = "EscrowWithdrawalLifecycleError";
36214
- };
36215
- var EscrowWithdrawalRejectionError = class extends Error {
36216
- constructor(httpStatus, result) {
36217
- super(result.error);
36218
- this.httpStatus = httpStatus;
36219
- this.result = result;
36220
- }
36221
- httpStatus;
36222
- result;
36223
- name = "EscrowWithdrawalRejectionError";
36224
- };
36225
36119
  function createEscrowGatewayClient(baseUrl) {
36226
36120
  const base = baseUrl.replace(/\/+$/, "");
36227
36121
  async function throwOnError(res, context) {
@@ -36237,27 +36131,6 @@ function createEscrowGatewayClient(baseUrl) {
36237
36131
  );
36238
36132
  }
36239
36133
  }
36240
- async function throwOnWithdrawError(res) {
36241
- if (res.ok) return;
36242
- let body;
36243
- try {
36244
- body = await res.json();
36245
- } catch {
36246
- throw new Error(
36247
- `Escrow gateway error (POST /v1/escrow/withdraw): ${res.status} ${res.statusText}`
36248
- );
36249
- }
36250
- if (isEscrowWithdrawalFailureResult(body)) {
36251
- throw new EscrowWithdrawalLifecycleError(res.status, body);
36252
- }
36253
- if (isEscrowWithdrawalRejectedResult(body)) {
36254
- throw new EscrowWithdrawalRejectionError(res.status, body);
36255
- }
36256
- const error = getGatewayErrorMessage(body);
36257
- throw new Error(
36258
- `Escrow gateway error (POST /v1/escrow/withdraw): ${res.status} ${res.statusText}${error ? `: ${error}` : ""}`
36259
- );
36260
- }
36261
36134
  return {
36262
36135
  async submitDeposit({ txHash }) {
36263
36136
  const res = await fetch(`${base}/v1/escrow/deposit`, {
@@ -36313,108 +36186,9 @@ function createEscrowGatewayClient(baseUrl) {
36313
36186
  });
36314
36187
  await throwOnError(res, "POST /v1/escrow/pay");
36315
36188
  return res.json();
36316
- },
36317
- async withdraw({
36318
- account,
36319
- asset,
36320
- amount,
36321
- withdrawNonce,
36322
- deadline,
36323
- signature
36324
- }) {
36325
- const res = await fetch(`${base}/v1/escrow/withdraw`, {
36326
- method: "POST",
36327
- headers: {
36328
- "Content-Type": "application/json",
36329
- Authorization: `Web3Signed ${signature}`
36330
- },
36331
- body: JSON.stringify({
36332
- account,
36333
- asset,
36334
- amount,
36335
- withdrawNonce,
36336
- deadline
36337
- })
36338
- });
36339
- await throwOnWithdrawError(res);
36340
- return res.json();
36341
- },
36342
- async getWithdrawNonce(account) {
36343
- const res = await fetch(
36344
- `${base}/v1/escrow/withdraw/nonce?account=${encodeURIComponent(account)}`,
36345
- { cache: "no-store" }
36346
- );
36347
- await throwOnError(res, "GET /v1/escrow/withdraw/nonce");
36348
- const body = await res.json();
36349
- if (!isWithdrawNonceResponse(body, account)) {
36350
- throw new Error(
36351
- "GET /v1/escrow/withdraw/nonce: invalid response structure"
36352
- );
36353
- }
36354
- return body;
36355
36189
  }
36356
36190
  };
36357
36191
  }
36358
- function getGatewayErrorMessage(body) {
36359
- if (typeof body === "object" && body !== null && "error" in body && typeof body.error === "string") {
36360
- return body.error;
36361
- }
36362
- return void 0;
36363
- }
36364
- function isEscrowWithdrawalFailureResult(body) {
36365
- if (typeof body !== "object" || body === null) return false;
36366
- const value = body;
36367
- return value.success === false && (value.status === "retryable" || value.status === "reorged" || value.status === "failed") && typeof value.error === "string" && isAddressHex(value.account) && isAddressHex(value.asset) && isUint256Decimal(value.amount) && isUint256Decimal(value.withdrawNonce) && isUint256Decimal(value.deadline) && (isHash(value.txHash) || value.txHash === null) && (!("blockNumber" in value) || isBlockNumber(value.blockNumber));
36368
- }
36369
- function isEscrowWithdrawalRejectedResult(body) {
36370
- if (typeof body !== "object" || body === null) return false;
36371
- const value = body;
36372
- return value.success === false && value.status === "rejected" && isWithdrawalRejectionCode(value.code) && typeof value.error === "string" && isAddressHex(value.account) && isAddressHex(value.asset) && isUint256Decimal(value.amount) && isUint256Decimal(value.withdrawNonce) && isUint256Decimal(value.deadline) && optionalUint256Decimal(value.balance) && optionalUint256Decimal(value.authorizedAmount) && optionalUint256Decimal(value.withdrawingAmount) && optionalUint256Decimal(value.availableAmount) && optionalUint256Decimal(value.requestedAmount) && optionalUint256Decimal(value.minimumAmount);
36373
- }
36374
- function isWithdrawalRejectionCode(value) {
36375
- return value === "below_minimum" || value === "deadline_too_far" || value === "expired" || value === "insufficient_available" || value === "stale_nonce";
36376
- }
36377
- function optionalUint256Decimal(value) {
36378
- return value === void 0 || isUint256Decimal(value);
36379
- }
36380
- function isAddressHex(value) {
36381
- return typeof value === "string" && (0, import_viem27.isHex)(value, { strict: true }) && value.length === 42;
36382
- }
36383
- function isHash(value) {
36384
- return typeof value === "string" && (0, import_viem27.isHex)(value, { strict: true }) && value.length === 66;
36385
- }
36386
- function isUint256Decimal(value) {
36387
- if (typeof value !== "string" || value.length === 0 || value.length > 78) {
36388
- return false;
36389
- }
36390
- if (!/^(0|[1-9]\d*)$/.test(value)) return false;
36391
- return BigInt(value) <= 2n ** 256n - 1n;
36392
- }
36393
- function isBlockNumber(value) {
36394
- return value === null || isUint256Decimal(value);
36395
- }
36396
- function isWithdrawNonceResponse(body, requestedAccount) {
36397
- if (typeof body !== "object" || body === null) return false;
36398
- const value = body;
36399
- if (value.success !== true) return false;
36400
- if (!isAddressHex(value.account)) return false;
36401
- if (value.account.toLowerCase() !== requestedAccount.toLowerCase())
36402
- return false;
36403
- if (typeof value.chainId !== "string") return false;
36404
- if (!/^(0|[1-9]\d*)$/.test(value.chainId)) return false;
36405
- const isLastNull = value.lastWithdrawNonce === null;
36406
- const lastNonceValid = isLastNull || isUint256Decimal(value.lastWithdrawNonce);
36407
- if (!lastNonceValid) return false;
36408
- if (!isUint256Decimal(value.nextWithdrawNonce)) return false;
36409
- if (isLastNull) {
36410
- return value.nextWithdrawNonce === "1";
36411
- }
36412
- const lastNonce = BigInt(value.lastWithdrawNonce);
36413
- const nextNonce = BigInt(value.nextWithdrawNonce);
36414
- const expectedNextNonce = lastNonce + 1n;
36415
- if (expectedNextNonce > 2n ** 256n - 1n) return false;
36416
- return nextNonce === expectedNextNonce;
36417
- }
36418
36192
 
36419
36193
  // src/direct/escrow-payment.ts
36420
36194
  var GRANT_OP_TYPE = "grant";
@@ -36451,12 +36225,12 @@ var UINT256_MAX = (1n << 256n) - 1n;
36451
36225
  var ADDRESS_RE = /^0x[0-9a-fA-F]{40}$/;
36452
36226
  var BYTES32_RE = /^0x[0-9a-fA-F]{64}$/;
36453
36227
  var SIGNATURE_RE = /^0x[0-9a-fA-F]{130}$/;
36454
- function isUint256Decimal2(value, allowZero) {
36228
+ function isUint256Decimal(value, allowZero) {
36455
36229
  const pattern = allowZero ? /^(0|[1-9]\d*)$/ : /^[1-9]\d*$/;
36456
36230
  return value.length <= UINT256_MAX.toString().length && pattern.test(value) && BigInt(value) <= UINT256_MAX;
36457
36231
  }
36458
36232
  function isValidAccessRecord(record) {
36459
- return BYTES32_RE.test(record.dataPointId) && isUint256Decimal2(record.version, false) && ADDRESS_RE.test(record.accessor) && BYTES32_RE.test(record.recordId) && SIGNATURE_RE.test(record.signature);
36233
+ return BYTES32_RE.test(record.dataPointId) && isUint256Decimal(record.version, false) && ADDRESS_RE.test(record.accessor) && BYTES32_RE.test(record.recordId) && SIGNATURE_RE.test(record.signature);
36460
36234
  }
36461
36235
  function validateSigningOperation(payerAddress, required) {
36462
36236
  if (!ADDRESS_RE.test(payerAddress)) {
@@ -36468,10 +36242,10 @@ function validateSigningOperation(payerAddress, required) {
36468
36242
  if (!ADDRESS_RE.test(required.asset || NATIVE_ASSET_ADDRESS)) {
36469
36243
  throw new Error("Payment asset must be a 20-byte EVM address");
36470
36244
  }
36471
- if (!isUint256Decimal2(required.amount, true)) {
36245
+ if (!isUint256Decimal(required.amount, true)) {
36472
36246
  throw new Error("Payment amount must be a canonical uint256 decimal");
36473
36247
  }
36474
- if (required.paymentNonce !== void 0 && !isUint256Decimal2(required.paymentNonce, false)) {
36248
+ if (required.paymentNonce !== void 0 && !isUint256Decimal(required.paymentNonce, false)) {
36475
36249
  throw new Error("Payment nonce must be a positive uint256 decimal");
36476
36250
  }
36477
36251
  const accessRecord = required.accessRecord;
@@ -36602,7 +36376,7 @@ function paymentResponseMetadataFromHeader(header) {
36602
36376
  const registrationFee = stringField(breakdown, "registrationFee");
36603
36377
  const dataAccessFee = stringField(breakdown, "dataAccessFee");
36604
36378
  const paidAt = stringField(result, "paidAt");
36605
- if (result?.success !== true || !opType || !opId || !BYTES32_RE.test(opId) || !payerAddress || !ADDRESS_RE.test(payerAddress) || !asset || !ADDRESS_RE.test(asset) || !amount || !isUint256Decimal2(amount, true) || !paymentNonce || !isUint256Decimal2(paymentNonce, false) || !registrationFee || !isUint256Decimal2(registrationFee, true) || !dataAccessFee || !isUint256Decimal2(dataAccessFee, true) || typeof breakdown?.registrationPaid !== "boolean" || !paidAt || !isCanonicalIsoTimestamp(paidAt)) {
36379
+ if (result?.success !== true || !opType || !opId || !BYTES32_RE.test(opId) || !payerAddress || !ADDRESS_RE.test(payerAddress) || !asset || !ADDRESS_RE.test(asset) || !amount || !isUint256Decimal(amount, true) || !paymentNonce || !isUint256Decimal(paymentNonce, false) || !registrationFee || !isUint256Decimal(registrationFee, true) || !dataAccessFee || !isUint256Decimal(dataAccessFee, true) || typeof breakdown?.registrationPaid !== "boolean" || !paidAt || !isCanonicalIsoTimestamp(paidAt)) {
36606
36380
  return void 0;
36607
36381
  }
36608
36382
  return {
@@ -36692,15 +36466,15 @@ function isBytes32Hex(value) {
36692
36466
  return /^0x[0-9a-fA-F]{64}$/.test(value);
36693
36467
  }
36694
36468
  var UINT256_MAX2 = (1n << 256n) - 1n;
36695
- function isAddressHex2(value) {
36469
+ function isAddressHex(value) {
36696
36470
  return /^0x[0-9a-fA-F]{40}$/.test(value);
36697
36471
  }
36698
- function isUint256Decimal3(value, allowZero) {
36472
+ function isUint256Decimal2(value, allowZero) {
36699
36473
  const pattern = allowZero ? /^(0|[1-9]\d*)$/ : /^[1-9]\d*$/;
36700
36474
  return value.length <= UINT256_MAX2.toString().length && pattern.test(value) && BigInt(value) <= UINT256_MAX2;
36701
36475
  }
36702
36476
  function isValidDataAccessRecord(record) {
36703
- return isBytes32Hex(record.dataPointId) && isUint256Decimal3(record.version, false) && isAddressHex2(record.accessor) && isBytes32Hex(record.recordId) && /^0x[0-9a-fA-F]{130}$/.test(record.signature);
36477
+ return isBytes32Hex(record.dataPointId) && isUint256Decimal2(record.version, false) && isAddressHex(record.accessor) && isBytes32Hex(record.recordId) && /^0x[0-9a-fA-F]{130}$/.test(record.signature);
36704
36478
  }
36705
36479
  function parseLegacyGrantOperation(params) {
36706
36480
  const { challengeGrantId, challengeOpId, challengeOpType, grantId } = params;
@@ -36751,7 +36525,7 @@ function parseCanonicalDataAccessAccept(value) {
36751
36525
  const accessRecord = parseAccessRecord(accept?.accessRecord);
36752
36526
  const acceptAsset = stringField2(accept, "asset");
36753
36527
  const acceptAmount = stringField2(accept, "amount");
36754
- if (!network || !payerAddress || !isAddressHex2(payerAddress) || !opId || !isBytes32Hex(opId) || !asset || !isAddressHex2(asset) || !amount || !isUint256Decimal3(amount, true) || !paymentNonce || !isUint256Decimal3(paymentNonce, false) || !accessRecord || !isValidDataAccessRecord(accessRecord) || payerAddress.toLowerCase() !== accessRecord.accessor.toLowerCase() || opId.toLowerCase() !== accessRecord.recordId.toLowerCase() || !acceptAsset || acceptAsset.toLowerCase() !== asset.toLowerCase() || acceptAmount !== amount) {
36528
+ if (!network || !payerAddress || !isAddressHex(payerAddress) || !opId || !isBytes32Hex(opId) || !asset || !isAddressHex(asset) || !amount || !isUint256Decimal2(amount, true) || !paymentNonce || !isUint256Decimal2(paymentNonce, false) || !accessRecord || !isValidDataAccessRecord(accessRecord) || payerAddress.toLowerCase() !== accessRecord.accessor.toLowerCase() || opId.toLowerCase() !== accessRecord.recordId.toLowerCase() || !acceptAsset || acceptAsset.toLowerCase() !== asset.toLowerCase() || acceptAmount !== amount) {
36755
36529
  return null;
36756
36530
  }
36757
36531
  return {
@@ -36836,7 +36610,7 @@ async function parsePersonalServerPaymentRequired(res, grantId) {
36836
36610
  const acceptAmount = stringField2(accept, "amount");
36837
36611
  const accessRecord2 = parseAccessRecord(accept.accessRecord);
36838
36612
  const hasAccessRecord = accept.accessRecord !== void 0;
36839
- if (!network || !payerAddress || !isAddressHex2(payerAddress) || !opId || !isBytes32Hex(opId) || !asset || !isAddressHex2(asset) || !amount || !isUint256Decimal3(amount, true) || !paymentNonce || !isUint256Decimal3(paymentNonce, false) || !acceptAsset || acceptAsset.toLowerCase() !== asset.toLowerCase() || acceptAmount !== amount || hasAccessRecord && (!accessRecord2 || !isValidDataAccessRecord(accessRecord2) || accessRecord2.accessor.toLowerCase() !== payerAddress.toLowerCase()) || amount === "0" && !accessRecord2) {
36613
+ if (!network || !payerAddress || !isAddressHex(payerAddress) || !opId || !isBytes32Hex(opId) || !asset || !isAddressHex(asset) || !amount || !isUint256Decimal2(amount, true) || !paymentNonce || !isUint256Decimal2(paymentNonce, false) || !acceptAsset || acceptAsset.toLowerCase() !== asset.toLowerCase() || acceptAmount !== amount || hasAccessRecord && (!accessRecord2 || !isValidDataAccessRecord(accessRecord2) || accessRecord2.accessor.toLowerCase() !== payerAddress.toLowerCase()) || amount === "0" && !accessRecord2) {
36840
36614
  throw new PersonalServerReadError(
36841
36615
  "Personal Server grant payment challenge was untrusted or incomplete",
36842
36616
  402
@@ -36994,8 +36768,6 @@ async function parsePSError(response) {
36994
36768
  ENCLAVE_TRUST_ANCHORS,
36995
36769
  ENCLAVE_WALLET_PURPOSE,
36996
36770
  ESCROW_DEPOSIT_ABI,
36997
- EscrowWithdrawalLifecycleError,
36998
- EscrowWithdrawalRejectionError,
36999
36771
  ExpiredTokenError,
37000
36772
  FEE_REGISTRY_ABI,
37001
36773
  GENERIC_PAYMENT_TYPES,
@@ -37081,7 +36853,6 @@ async function parsePSError(response) {
37081
36853
  UserRejectedRequestError,
37082
36854
  VanaError,
37083
36855
  VanaStorage,
37084
- WITHDRAW_AUTHORIZATION_TYPES,
37085
36856
  WRITER_ATTRIBUTION_KEY,
37086
36857
  WRITE_CONTENT_DISPOSITION_HEADER,
37087
36858
  WRITE_FILENAME_HEADER,
@@ -37119,7 +36890,6 @@ async function parsePSError(response) {
37119
36890
  buildPersonalServerRegistrationTypedData,
37120
36891
  buildSetDataPointStatusRequest,
37121
36892
  buildWeb3SignedHeader,
37122
- buildWithdrawAuthorizationTypedData,
37123
36893
  builderRegistrationDomain,
37124
36894
  canonicalJobRequestBytes,
37125
36895
  chains,
@@ -37244,7 +37014,6 @@ async function parsePSError(response) {
37244
37014
  verifyWeb3Signed,
37245
37015
  waitForDerivativeStatus,
37246
37016
  waitForQuestion,
37247
- withdrawAuthorizationDomain,
37248
37017
  writeData,
37249
37018
  writePersonalServerData
37250
37019
  });