@zkp2p/sdk 0.12.2-rc.2 → 0.12.2-rc.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.
package/dist/index.mjs CHANGED
@@ -2,12 +2,12 @@ import { IntentGuardianOperations } from './chunk-YA67SM3A.mjs';
2
2
  export { ZERO_RATE_MANAGER_ID, classifyDelegationState, classifyIntentGuardianError, getDelegationRoute, isZeroRateManagerId, normalizeRateManagerId, normalizeRegistry } from './chunk-YA67SM3A.mjs';
3
3
  import { NetworkError, ValidationError, APIError } from './chunk-3J4FPMPW.mjs';
4
4
  export { APIError, ContractError, ErrorCode, NetworkError, ValidationError, ZKP2PError } from './chunk-3J4FPMPW.mjs';
5
- import { OrchestratorRegistry_default, DisputeProtectionPolicy_default, METHOD_NAME_TO_HASH, matchesQuotePaymentMethod, matchesPaymentMethodNameAndHash, getContracts, getRateManagerContracts, getPaymentMethodsCatalog, resolvePaymentMethodHashFromCatalog, getGatingServiceAddress, parseBigIntLike, SUPPORTED_PAYMENT_METHOD_HASHES, resolveFiatCurrencyBytes32, resolvePaymentMethodNameFromHash, OrchestratorV3_default, MultiAttestationVerifier_default, DisputeNullifierRegistry_default, DisputeVerifier_default, WhitelistPolicy_default, StakeVault_default, IntentLifecycleHookV1_default } from './chunk-67JSDBUL.mjs';
6
- export { DISPUTE_PROTECTION_POLICY_ABI, ORCHESTRATOR_V3_ABI, PAYMENT_PLATFORMS, STAKE_VAULT_ABI, asciiToBytes32, enrichPvDepositView, enrichPvIntentView, ensureBytes32, getContracts, getDisputeProtectionPolicyContract, getGatingServiceAddress, getIntentGuardianContract, getOrchestratorV3Contract, getPaymentMethodsCatalog, getRateManagerContracts, getStakeVaultContract, hasIntentGuardian, parseDepositView, parseIntentView, resolveFiatCurrencyBytes32, resolvePaymentMethodHash, resolvePaymentMethodHashFromCatalog, resolvePaymentMethodNameFromHash } from './chunk-67JSDBUL.mjs';
5
+ import { OrchestratorRegistry_default, DISPUTE_PROTECTION_POLICY_ABI, DisputeProtectionPolicy_default, METHOD_NAME_TO_HASH, matchesQuotePaymentMethod, matchesPaymentMethodNameAndHash, getContracts, getRateManagerContracts, getPaymentMethodsCatalog, resolvePaymentMethodHashFromCatalog, getGatingServiceAddress, parseBigIntLike, SUPPORTED_PAYMENT_METHOD_HASHES, resolveFiatCurrencyBytes32, resolvePaymentMethodNameFromHash, OrchestratorV3_default, MultiAttestationVerifier_default, DisputeNullifierRegistry_default, DisputeVerifier_default, WhitelistPolicy_default, StakeVault_default, IntentLifecycleHookV1_default } from './chunk-RVINERIL.mjs';
6
+ export { DISPUTE_PROTECTION_POLICY_ABI2 as DISPUTE_PROTECTION_POLICY_ABI, ORCHESTRATOR_V3_ABI, PAYMENT_PLATFORMS, STAKE_VAULT_ABI, asciiToBytes32, enrichPvDepositView, enrichPvIntentView, ensureBytes32, getContracts, getDisputeProtectionPolicyContract, getGatingServiceAddress, getIntentGuardianContract, getOrchestratorV3Contract, getPaymentMethodsCatalog, getRateManagerContracts, getStakeVaultContract, hasIntentGuardian, parseDepositView, parseIntentView, resolveFiatCurrencyBytes32, resolvePaymentMethodHash, resolvePaymentMethodHashFromCatalog, resolvePaymentMethodNameFromHash } from './chunk-RVINERIL.mjs';
7
7
  import { Currency, currencyKeccak256 } from './chunk-ZB22BZLZ.mjs';
8
8
  export { Currency, currencyInfo, getCurrencyCodeFromHash, getCurrencyInfoFromCountryCode, getCurrencyInfoFromHash, isSupportedCurrencyHash, mapConversionRatesToOnchainMinRate } from './chunk-ZB22BZLZ.mjs';
9
- import { define_ZKP2P_SDK_BUILD_METADATA_default } from './chunk-UQEKVVIN.mjs';
10
- import { concatHex, encodeFunctionData, encodeAbiParameters, createPublicClient, http, isAddress, zeroAddress, keccak256, formatUnits } from 'viem';
9
+ import { define_ZKP2P_SDK_BUILD_METADATA_default } from './chunk-FYCYFFYS.mjs';
10
+ import { keccak256, concatHex, encodeFunctionData, encodeAbiParameters, createPublicClient, http, isAddress, zeroAddress, formatUnits } from 'viem';
11
11
  import { hardhat, base } from 'viem/chains';
12
12
  import { createEncryptedBuyerTeeSessionMaterial as createEncryptedBuyerTeeSessionMaterial$1, createEncryptedSellerCredentialUpload } from '@zkp2p/zkp2p-attestation';
13
13
  export { createNitroAttestationClient } from '@zkp2p/zkp2p-attestation';
@@ -357,7 +357,7 @@ async function withRetry(fn, maxRetries = 3, delayMs = 1e3, timeoutMs) {
357
357
  for (let i = 0; i < maxRetries; i++) {
358
358
  try {
359
359
  if (timeoutMs) {
360
- const { withTimeout } = await import('./timeout-CQ4Y2Z4T.mjs');
360
+ const { withTimeout } = await import('./timeout-TJYY2GX6.mjs');
361
361
  return await withTimeout(fn(), timeoutMs, `Operation timed out after ${timeoutMs}ms`);
362
362
  }
363
363
  return await fn();
@@ -535,6 +535,7 @@ function createAttestationTransport(primaryBaseUrl, options = {}) {
535
535
  }
536
536
 
537
537
  // src/adapters/attestation.ts
538
+ var isAttestationMaterialTimeout = (error) => error instanceof Error && "code" in error && error.code === "TIMEOUT";
538
539
  function headers() {
539
540
  return { "Content-Type": "application/json" };
540
541
  }
@@ -552,35 +553,42 @@ async function createEncryptedSellerCredentialUploadForPlatform({
552
553
  platform,
553
554
  timeoutMs
554
555
  }) {
555
- if (platform === "wise") {
556
- if (!isWiseCredentialUploadInput(payload)) {
557
- throw new Error("apiToken is required for wise seller credential uploads");
556
+ try {
557
+ if (platform === "wise") {
558
+ if (!isWiseCredentialUploadInput(payload)) {
559
+ throw new Error("apiToken is required for wise seller credential uploads");
560
+ }
561
+ return await createEncryptedSellerCredentialUpload({
562
+ attestationServiceUrl,
563
+ platform: "wise",
564
+ ...payload.callerAddress ? { callerAddress: payload.callerAddress } : {},
565
+ sessionMaterial: payload.sessionMaterial,
566
+ ...typeof timeoutMs === "number" ? { timeoutMs } : {},
567
+ fetch: attestationTransport.fetch,
568
+ ...cryptoRuntime?.subtle ? { subtle: cryptoRuntime.subtle } : {},
569
+ ...cryptoRuntime?.getRandomValues ? { getRandomValues: cryptoRuntime.getRandomValues } : {}
570
+ });
558
571
  }
559
- return createEncryptedSellerCredentialUpload({
572
+ if (!isPayeeBoundSellerCredentialUploadInput(payload)) {
573
+ throw new Error(`payeeId is required for ${platform} seller credential uploads`);
574
+ }
575
+ return await createEncryptedSellerCredentialUpload({
560
576
  attestationServiceUrl,
561
- platform: "wise",
577
+ platform,
562
578
  ...payload.callerAddress ? { callerAddress: payload.callerAddress } : {},
579
+ payeeId: payload.payeeId,
563
580
  sessionMaterial: payload.sessionMaterial,
564
581
  ...typeof timeoutMs === "number" ? { timeoutMs } : {},
565
582
  fetch: attestationTransport.fetch,
566
583
  ...cryptoRuntime?.subtle ? { subtle: cryptoRuntime.subtle } : {},
567
584
  ...cryptoRuntime?.getRandomValues ? { getRandomValues: cryptoRuntime.getRandomValues } : {}
568
585
  });
586
+ } catch (error) {
587
+ if (isAttestationMaterialTimeout(error)) {
588
+ throw new NetworkError(error.message, { cause: error });
589
+ }
590
+ throw error;
569
591
  }
570
- if (!isPayeeBoundSellerCredentialUploadInput(payload)) {
571
- throw new Error(`payeeId is required for ${platform} seller credential uploads`);
572
- }
573
- return createEncryptedSellerCredentialUpload({
574
- attestationServiceUrl,
575
- platform,
576
- ...payload.callerAddress ? { callerAddress: payload.callerAddress } : {},
577
- payeeId: payload.payeeId,
578
- sessionMaterial: payload.sessionMaterial,
579
- ...typeof timeoutMs === "number" ? { timeoutMs } : {},
580
- fetch: attestationTransport.fetch,
581
- ...cryptoRuntime?.subtle ? { subtle: cryptoRuntime.subtle } : {},
582
- ...cryptoRuntime?.getRandomValues ? { getRandomValues: cryptoRuntime.getRandomValues } : {}
583
- });
584
592
  }
585
593
  async function apiVerifyBuyerTeePayment(payload, attestationServiceUrl, platform, actionType, options = {}) {
586
594
  return withRetry(async () => {
@@ -852,7 +860,7 @@ async function sendTransactionWithAttribution(walletClient, request, referrer, o
852
860
  // src/utils/constants.ts
853
861
  var DEFAULT_BASE_API_URL = "https://api.zkp2p.xyz";
854
862
 
855
- // ../../node_modules/.pnpm/@zkp2p+contracts-v2@0.4.1-rc.6_ethers@6.16.0_bufferutil@4.1.0_utf-8-validate@5.0.10__typescript@5.9.3_zod@4.4.3/node_modules/@zkp2p/contracts-v2/oracleFeeds/chainlink.json
863
+ // ../../node_modules/.pnpm/@zkp2p+contracts-v2@0.4.1-rc.9_ethers@6.16.0_bufferutil@4.1.0_utf-8-validate@5.0.10__typescript@5.9.3_zod@4.4.3/node_modules/@zkp2p/contracts-v2/oracleFeeds/chainlink.json
856
864
  var chainlink_default = {
857
865
  feeds: [
858
866
  {
@@ -1898,7 +1906,7 @@ var ProtocolViewerReader = class {
1898
1906
  if (inputCount === null) {
1899
1907
  throw new Error("Configured ProtocolViewer ABI does not expose getDeposit");
1900
1908
  }
1901
- const { parseDepositView: parseDepositView2 } = await import('./protocolViewerParsers-QE6LWS3W.mjs');
1909
+ const { parseDepositView: parseDepositView2 } = await import('./protocolViewerParsers-YYBBYCEJ.mjs');
1902
1910
  if (inputCount >= 3) {
1903
1911
  return tryContexts(
1904
1912
  protocolViewerContexts,
@@ -1984,7 +1992,7 @@ var ProtocolViewerReader = class {
1984
1992
  return Promise.all(ids.map((id) => this.config.host.getPvDepositById(id)));
1985
1993
  }
1986
1994
  const bn = ids.map((id) => typeof id === "bigint" ? id : parseRawDepositId(id));
1987
- const { parseDepositView: parseDepositView2 } = await import('./protocolViewerParsers-QE6LWS3W.mjs');
1995
+ const { parseDepositView: parseDepositView2 } = await import('./protocolViewerParsers-YYBBYCEJ.mjs');
1988
1996
  if (inputCount >= 2) {
1989
1997
  const requests = ids.map((id, index) => ({
1990
1998
  index,
@@ -2089,7 +2097,7 @@ var ProtocolViewerReader = class {
2089
2097
  if (!protocolViewerAddress || !protocolViewerAbi || inputCount === null) {
2090
2098
  return this.config.host.getPvAccountDepositsFromIndexer(owner);
2091
2099
  }
2092
- const { parseDepositView: parseDepositView2 } = await import('./protocolViewerParsers-QE6LWS3W.mjs');
2100
+ const { parseDepositView: parseDepositView2 } = await import('./protocolViewerParsers-YYBBYCEJ.mjs');
2093
2101
  const { address, abi } = this.config.host.requireProtocolViewer();
2094
2102
  if (inputCount >= 2) {
2095
2103
  const readAndFilter = async (raw2) => {
@@ -2160,7 +2168,7 @@ var ProtocolViewerReader = class {
2160
2168
  if (protocolViewerEntries.length === 0) {
2161
2169
  throw new Error("ProtocolViewer not available for this network");
2162
2170
  }
2163
- const { parseIntentView: parseIntentView2 } = await import('./protocolViewerParsers-QE6LWS3W.mjs');
2171
+ const { parseIntentView: parseIntentView2 } = await import('./protocolViewerParsers-YYBBYCEJ.mjs');
2164
2172
  const intentsByHash = /* @__PURE__ */ new Map();
2165
2173
  let attemptedRead = false;
2166
2174
  let hadSuccessfulRead = false;
@@ -2268,7 +2276,7 @@ var ProtocolViewerReader = class {
2268
2276
  if (protocolViewerEntries.length === 0) {
2269
2277
  throw new Error("ProtocolViewer not available for this network");
2270
2278
  }
2271
- const { parseIntentView: parseIntentView2 } = await import('./protocolViewerParsers-QE6LWS3W.mjs');
2279
+ const { parseIntentView: parseIntentView2 } = await import('./protocolViewerParsers-YYBBYCEJ.mjs');
2272
2280
  let lastError;
2273
2281
  for (const pvEntry of protocolViewerEntries) {
2274
2282
  const inputCount = this.pvEntryFunctionInputCount(pvEntry, "getIntent");
@@ -3625,6 +3633,23 @@ var STAKING_STATE_QUERY = (
3625
3633
  }
3626
3634
  `
3627
3635
  );
3636
+ var TAKER_STAKE_AUTHORIZATIONS_QUERY = (
3637
+ /* GraphQL */
3638
+ `
3639
+ query TakerStakeAuthorizations($where: TakerStakeAuthorization_bool_exp!, $limit: Int!) {
3640
+ TakerStakeAuthorization(where: $where, order_by: [{ id: asc }], limit: $limit) {
3641
+ id
3642
+ chainId
3643
+ vaultAddress
3644
+ taker
3645
+ stakeOwner
3646
+ authorized
3647
+ updatedAtBlockNumber
3648
+ updatedAt
3649
+ }
3650
+ }
3651
+ `
3652
+ );
3628
3653
  var STAKE_LOCKS_QUERY = (
3629
3654
  /* GraphQL */
3630
3655
  `
@@ -4317,6 +4342,602 @@ var REFERRAL_SIGNATURE_TYPES = {
4317
4342
  { name: "issuedAt", type: "uint256" }
4318
4343
  ]
4319
4344
  };
4345
+ var currencyKeccak2562 = (inputString) => {
4346
+ const bytes = new TextEncoder().encode(inputString);
4347
+ return keccak256(bytes);
4348
+ };
4349
+ var Currency2 = {
4350
+ AED: "AED",
4351
+ ARS: "ARS",
4352
+ AUD: "AUD",
4353
+ BRL: "BRL",
4354
+ CAD: "CAD",
4355
+ CHF: "CHF",
4356
+ CNY: "CNY",
4357
+ CZK: "CZK",
4358
+ DKK: "DKK",
4359
+ EUR: "EUR",
4360
+ GBP: "GBP",
4361
+ HKD: "HKD",
4362
+ HUF: "HUF",
4363
+ IDR: "IDR",
4364
+ ILS: "ILS",
4365
+ INR: "INR",
4366
+ JPY: "JPY",
4367
+ KES: "KES",
4368
+ NOK: "NOK",
4369
+ MXN: "MXN",
4370
+ MYR: "MYR",
4371
+ NZD: "NZD",
4372
+ PHP: "PHP",
4373
+ PLN: "PLN",
4374
+ RON: "RON",
4375
+ SAR: "SAR",
4376
+ SEK: "SEK",
4377
+ SGD: "SGD",
4378
+ THB: "THB",
4379
+ TRY: "TRY",
4380
+ UGX: "UGX",
4381
+ USD: "USD",
4382
+ VND: "VND",
4383
+ ZAR: "ZAR"
4384
+ };
4385
+ var currencyInfo2 = {
4386
+ [Currency2.AED]: {
4387
+ currency: Currency2.AED,
4388
+ currencyCode: "AED",
4389
+ currencyName: "United Arab Emirates Dirham",
4390
+ currencyCodeHash: currencyKeccak2562("AED"),
4391
+ currencySymbol: "\u062F.\u0625",
4392
+ countryCode: "ae"
4393
+ },
4394
+ [Currency2.ARS]: {
4395
+ currency: Currency2.ARS,
4396
+ currencyCode: "ARS",
4397
+ currencyName: "Argentine Peso",
4398
+ currencyCodeHash: currencyKeccak2562("ARS"),
4399
+ currencySymbol: "$",
4400
+ countryCode: "ar"
4401
+ },
4402
+ [Currency2.AUD]: {
4403
+ currency: Currency2.AUD,
4404
+ currencyCode: "AUD",
4405
+ currencyName: "Australian Dollar",
4406
+ currencyCodeHash: currencyKeccak2562("AUD"),
4407
+ currencySymbol: "A$",
4408
+ countryCode: "au"
4409
+ },
4410
+ [Currency2.BRL]: {
4411
+ currency: Currency2.BRL,
4412
+ currencyCode: "BRL",
4413
+ currencyName: "Brazilian Real",
4414
+ currencyCodeHash: currencyKeccak2562("BRL"),
4415
+ currencySymbol: "R$",
4416
+ countryCode: "br"
4417
+ },
4418
+ [Currency2.CAD]: {
4419
+ currency: Currency2.CAD,
4420
+ currencyCode: "CAD",
4421
+ currencyName: "Canadian Dollar",
4422
+ currencyCodeHash: currencyKeccak2562("CAD"),
4423
+ currencySymbol: "C$",
4424
+ countryCode: "ca"
4425
+ },
4426
+ [Currency2.CHF]: {
4427
+ currency: Currency2.CHF,
4428
+ currencyCode: "CHF",
4429
+ currencyName: "Swiss Franc",
4430
+ currencyCodeHash: currencyKeccak2562("CHF"),
4431
+ currencySymbol: "Fr",
4432
+ countryCode: "ch"
4433
+ },
4434
+ [Currency2.CNY]: {
4435
+ currency: Currency2.CNY,
4436
+ currencyCode: "CNY",
4437
+ currencyName: "Chinese Yuan",
4438
+ currencyCodeHash: currencyKeccak2562("CNY"),
4439
+ currencySymbol: "\xA5",
4440
+ countryCode: "cn"
4441
+ },
4442
+ [Currency2.CZK]: {
4443
+ currency: Currency2.CZK,
4444
+ currencyCode: "CZK",
4445
+ currencyName: "Czech Koruna",
4446
+ currencyCodeHash: currencyKeccak2562("CZK"),
4447
+ currencySymbol: "K\u010D",
4448
+ countryCode: "cz"
4449
+ },
4450
+ [Currency2.DKK]: {
4451
+ currency: Currency2.DKK,
4452
+ currencyCode: "DKK",
4453
+ currencyName: "Danish Krone",
4454
+ currencyCodeHash: currencyKeccak2562("DKK"),
4455
+ currencySymbol: "kr",
4456
+ countryCode: "dk"
4457
+ },
4458
+ [Currency2.EUR]: {
4459
+ currency: Currency2.EUR,
4460
+ currencyCode: "EUR",
4461
+ currencyName: "Euro",
4462
+ currencyCodeHash: currencyKeccak2562("EUR"),
4463
+ currencySymbol: "\u20AC",
4464
+ countryCode: "eu"
4465
+ },
4466
+ [Currency2.GBP]: {
4467
+ currency: Currency2.GBP,
4468
+ currencyCode: "GBP",
4469
+ currencyName: "British Pound",
4470
+ currencyCodeHash: currencyKeccak2562("GBP"),
4471
+ currencySymbol: "\xA3",
4472
+ countryCode: "gb"
4473
+ },
4474
+ [Currency2.HKD]: {
4475
+ currency: Currency2.HKD,
4476
+ currencyCode: "HKD",
4477
+ currencyName: "Hong Kong Dollar",
4478
+ currencyCodeHash: currencyKeccak2562("HKD"),
4479
+ currencySymbol: "HK$",
4480
+ countryCode: "hk"
4481
+ },
4482
+ [Currency2.HUF]: {
4483
+ currency: Currency2.HUF,
4484
+ currencyCode: "HUF",
4485
+ currencyName: "Hungarian Forint",
4486
+ currencyCodeHash: currencyKeccak2562("HUF"),
4487
+ currencySymbol: "Ft",
4488
+ countryCode: "hu"
4489
+ },
4490
+ [Currency2.IDR]: {
4491
+ currency: Currency2.IDR,
4492
+ currencyCode: "IDR",
4493
+ currencyName: "Indonesian Rupiah",
4494
+ currencyCodeHash: currencyKeccak2562("IDR"),
4495
+ currencySymbol: "Rp",
4496
+ countryCode: "id"
4497
+ },
4498
+ [Currency2.INR]: {
4499
+ currency: Currency2.INR,
4500
+ currencyCode: "INR",
4501
+ currencyName: "Indian Rupee",
4502
+ currencyCodeHash: currencyKeccak2562("INR"),
4503
+ currencySymbol: "\u20B9",
4504
+ countryCode: "in"
4505
+ },
4506
+ [Currency2.ILS]: {
4507
+ currency: Currency2.ILS,
4508
+ currencyCode: "ILS",
4509
+ currencyName: "Israeli New Shekel",
4510
+ currencyCodeHash: currencyKeccak2562("ILS"),
4511
+ currencySymbol: "\u20AA",
4512
+ countryCode: "il"
4513
+ },
4514
+ [Currency2.JPY]: {
4515
+ currency: Currency2.JPY,
4516
+ currencyCode: "JPY",
4517
+ currencyName: "Japanese Yen",
4518
+ currencyCodeHash: currencyKeccak2562("JPY"),
4519
+ currencySymbol: "\xA5",
4520
+ countryCode: "jp"
4521
+ },
4522
+ [Currency2.KES]: {
4523
+ currency: Currency2.KES,
4524
+ currencyCode: "KES",
4525
+ currencyName: "Kenyan Shilling",
4526
+ currencyCodeHash: currencyKeccak2562("KES"),
4527
+ currencySymbol: "KSh",
4528
+ countryCode: "ke"
4529
+ },
4530
+ [Currency2.MXN]: {
4531
+ currency: Currency2.MXN,
4532
+ currencyCode: "MXN",
4533
+ currencyName: "Mexican Peso",
4534
+ currencyCodeHash: currencyKeccak2562("MXN"),
4535
+ currencySymbol: "$",
4536
+ countryCode: "mx"
4537
+ },
4538
+ [Currency2.MYR]: {
4539
+ currency: Currency2.MYR,
4540
+ currencyCode: "MYR",
4541
+ currencyName: "Malaysian Ringgit",
4542
+ currencyCodeHash: currencyKeccak2562("MYR"),
4543
+ currencySymbol: "RM",
4544
+ countryCode: "my"
4545
+ },
4546
+ [Currency2.NOK]: {
4547
+ currency: Currency2.NOK,
4548
+ currencyCode: "NOK",
4549
+ currencyName: "Norwegian Krone",
4550
+ currencyCodeHash: currencyKeccak2562("NOK"),
4551
+ currencySymbol: "kr",
4552
+ countryCode: "no"
4553
+ },
4554
+ [Currency2.NZD]: {
4555
+ currency: Currency2.NZD,
4556
+ currencyCode: "NZD",
4557
+ currencyName: "New Zealand Dollar",
4558
+ currencyCodeHash: currencyKeccak2562("NZD"),
4559
+ currencySymbol: "NZ$",
4560
+ countryCode: "nz"
4561
+ },
4562
+ [Currency2.PHP]: {
4563
+ currency: Currency2.PHP,
4564
+ currencyCode: "PHP",
4565
+ currencyName: "Philippine Peso",
4566
+ currencyCodeHash: currencyKeccak2562("PHP"),
4567
+ currencySymbol: "\u20B1",
4568
+ countryCode: "ph"
4569
+ },
4570
+ [Currency2.PLN]: {
4571
+ currency: Currency2.PLN,
4572
+ currencyCode: "PLN",
4573
+ currencyName: "Polish Z\u0142oty",
4574
+ currencyCodeHash: currencyKeccak2562("PLN"),
4575
+ currencySymbol: "z\u0142",
4576
+ countryCode: "pl"
4577
+ },
4578
+ [Currency2.RON]: {
4579
+ currency: Currency2.RON,
4580
+ currencyCode: "RON",
4581
+ currencyName: "Romanian Leu",
4582
+ currencyCodeHash: currencyKeccak2562("RON"),
4583
+ currencySymbol: "lei",
4584
+ countryCode: "ro"
4585
+ },
4586
+ [Currency2.SAR]: {
4587
+ currency: Currency2.SAR,
4588
+ currencyCode: "SAR",
4589
+ currencyName: "Saudi Riyal",
4590
+ currencyCodeHash: currencyKeccak2562("SAR"),
4591
+ currencySymbol: "\uFDFC",
4592
+ countryCode: "sa"
4593
+ },
4594
+ [Currency2.SEK]: {
4595
+ currency: Currency2.SEK,
4596
+ currencyCode: "SEK",
4597
+ currencyName: "Swedish Krona",
4598
+ currencyCodeHash: currencyKeccak2562("SEK"),
4599
+ currencySymbol: "kr",
4600
+ countryCode: "se"
4601
+ },
4602
+ [Currency2.SGD]: {
4603
+ currency: Currency2.SGD,
4604
+ currencyCode: "SGD",
4605
+ currencyName: "Singapore Dollar",
4606
+ currencyCodeHash: currencyKeccak2562("SGD"),
4607
+ currencySymbol: "S$",
4608
+ countryCode: "sg"
4609
+ },
4610
+ [Currency2.THB]: {
4611
+ currency: Currency2.THB,
4612
+ currencyCode: "THB",
4613
+ currencyName: "Thai Baht",
4614
+ currencyCodeHash: currencyKeccak2562("THB"),
4615
+ currencySymbol: "\u0E3F",
4616
+ countryCode: "th"
4617
+ },
4618
+ [Currency2.TRY]: {
4619
+ currency: Currency2.TRY,
4620
+ currencyCode: "TRY",
4621
+ currencyName: "Turkish Lira",
4622
+ currencyCodeHash: currencyKeccak2562("TRY"),
4623
+ currencySymbol: "\u20BA",
4624
+ countryCode: "tr"
4625
+ },
4626
+ [Currency2.UGX]: {
4627
+ currency: Currency2.UGX,
4628
+ currencyCode: "UGX",
4629
+ currencyName: "Ugandan Shilling",
4630
+ currencyCodeHash: currencyKeccak2562("UGX"),
4631
+ currencySymbol: "USh",
4632
+ countryCode: "ug"
4633
+ },
4634
+ [Currency2.USD]: {
4635
+ currency: Currency2.USD,
4636
+ currencyCode: "USD",
4637
+ currencyName: "United States Dollar",
4638
+ currencyCodeHash: currencyKeccak2562("USD"),
4639
+ currencySymbol: "$",
4640
+ countryCode: "us"
4641
+ },
4642
+ [Currency2.VND]: {
4643
+ currency: Currency2.VND,
4644
+ currencyCode: "VND",
4645
+ currencyName: "Vietnamese Dong",
4646
+ currencyCodeHash: currencyKeccak2562("VND"),
4647
+ currencySymbol: "\u20AB",
4648
+ countryCode: "vn"
4649
+ },
4650
+ [Currency2.ZAR]: {
4651
+ currency: Currency2.ZAR,
4652
+ currencyCode: "ZAR",
4653
+ currencyName: "South African Rand",
4654
+ currencyCodeHash: currencyKeccak2562("ZAR"),
4655
+ currencySymbol: "R",
4656
+ countryCode: "za"
4657
+ }
4658
+ };
4659
+ var PaymentPlatform = {
4660
+ VENMO: "venmo",
4661
+ CASHAPP: "cashapp",
4662
+ CHIME: "chime",
4663
+ LUXON: "luxon",
4664
+ REVOLUT: "revolut",
4665
+ WISE: "wise",
4666
+ MERCADO_PAGO: "mercadopago",
4667
+ ZELLE: "zelle",
4668
+ PAYPAL: "paypal",
4669
+ MONZO: "monzo",
4670
+ N26: "n26",
4671
+ ALIPAY: "alipay"
4672
+ };
4673
+ [...Object.values(PaymentPlatform)];
4674
+ var encodeZelleRecipientId = (recipientId) => {
4675
+ const payload = {
4676
+ name: "",
4677
+ action: "payment",
4678
+ token: recipientId
4679
+ };
4680
+ return btoa(JSON.stringify(payload));
4681
+ };
4682
+ var zelleBankOfAmericaSendConfig = {
4683
+ paymentMethodName: "Bank of America",
4684
+ paymentMethodIcon: void 0,
4685
+ // Icon provided by client-side assets
4686
+ defaultPaymentMode: "QR_CODE",
4687
+ useCustomQRCode: true,
4688
+ troubleScanningQRCodeLink: (recipientId, sendCurrency, amountFiatToSend) => `https://www.bankofamerica.com/`,
4689
+ getFormattedSendLink: (recipientId, sendCurrency, amountFiatToSend) => {
4690
+ return `https://www.bankofamerica.com/movemoney`;
4691
+ },
4692
+ deepLinkEmbedsRecipient: false,
4693
+ supportsSendingPaymentOnWeb: true,
4694
+ showTroubleScanningQRCodeLink: true,
4695
+ sendPaymentWarning: (sendCurrency, amountFiatToSend) => {
4696
+ return `Send exactly ${amountFiatToSend} ${currencyInfo2[sendCurrency].currencyCode} in a single payment through Bank of America's Zelle.`;
4697
+ },
4698
+ sendPaymentInfo: (sendCurrency, amountFiatToSend) => {
4699
+ return `Only use Bank of America. Scan the QR code and manually enter the recipient email. Double-check the email before sending.`;
4700
+ },
4701
+ sendPaymentDos: (sendCurrency, amountFiatToSend) => [
4702
+ { text: "Use Bank of America", emphasize: ["Bank of America"] },
4703
+ {
4704
+ text: "Scan the QR code and manually enter the recipient email",
4705
+ emphasize: ["manually", "recipient email"]
4706
+ },
4707
+ {
4708
+ text: "Double-check the email before sending",
4709
+ emphasize: ["Double-check"]
4710
+ },
4711
+ {
4712
+ text: `Send exactly ${amountFiatToSend} ${currencyInfo2[sendCurrency].currencyCode} in a single payment`,
4713
+ emphasize: [
4714
+ "exactly",
4715
+ amountFiatToSend,
4716
+ currencyInfo2[sendCurrency].currencyCode,
4717
+ "single"
4718
+ ]
4719
+ }
4720
+ ],
4721
+ sendPaymentDonts: () => [
4722
+ { text: "Do not use any other bank", emphasize: ["Do not"] }
4723
+ ]
4724
+ };
4725
+ var zelleBankOfAmericaVerifyConfig = {
4726
+ authLink: "https://www.bankofamerica.com/",
4727
+ actionType: "transfer_zelle_bofa",
4728
+ actionPlatform: PaymentPlatform.ZELLE,
4729
+ buyerTeeParams: {
4730
+ includeMetadataIndex: true
4731
+ },
4732
+ numPaymentsFetched: 15,
4733
+ minExtensionVersion: "0.6.3",
4734
+ supportsAppclip: false,
4735
+ totalProofs: 1,
4736
+ parseMetadata: (metadata) => {
4737
+ const amountStr = metadata.amount ?? "";
4738
+ let dateStr = metadata.date ?? "";
4739
+ if (dateStr && dateStr.length === 10) {
4740
+ dateStr = `${dateStr}T23:59:59`;
4741
+ }
4742
+ const recipientIdStr = metadata.recipient || "";
4743
+ return {
4744
+ amount: amountStr,
4745
+ parsedAmount: amountStr !== "",
4746
+ date: dateStr,
4747
+ parsedDate: dateStr !== "",
4748
+ recipientId: recipientIdStr,
4749
+ parsedRecipientId: false,
4750
+ currency: Currency2.USD,
4751
+ parsedCurrency: true
4752
+ };
4753
+ },
4754
+ getSubjectText: (metadata) => {
4755
+ if (!metadata.amount || !metadata.recipient) {
4756
+ return "";
4757
+ }
4758
+ return `Transfer of $${Number(metadata.amount)} to ${metadata.recipient}`;
4759
+ }
4760
+ };
4761
+ var zelleChaseSendConfig = {
4762
+ paymentMethodName: "Chase",
4763
+ paymentMethodIcon: void 0,
4764
+ // Icon provided by client-side assets
4765
+ defaultPaymentMode: "QR_CODE",
4766
+ useCustomQRCode: true,
4767
+ troubleScanningQRCodeLink: (recipientId, sendCurrency, amountFiatToSend) => `https://secure.chase.com/web/auth/dashboard#/dashboard/singleDoor/singleDoorController/index`,
4768
+ getFormattedSendLink: (recipientId, sendCurrency, amountFiatToSend) => {
4769
+ const encodedRecipientId = encodeZelleRecipientId(recipientId);
4770
+ return `https://enroll.zellepay.com/qr-codes?data=${encodedRecipientId}`;
4771
+ },
4772
+ deepLinkEmbedsRecipient: true,
4773
+ supportsSendingPaymentOnWeb: true,
4774
+ showTroubleScanningQRCodeLink: true,
4775
+ sendPaymentWarning: (sendCurrency, amountFiatToSend) => {
4776
+ return `Send exactly ${amountFiatToSend} ${currencyInfo2[sendCurrency].currencyCode} in a single payment through Chase's Zelle.`;
4777
+ },
4778
+ sendPaymentInfo: (sendCurrency, amountFiatToSend) => {
4779
+ return `Do not send using any other bank.`;
4780
+ },
4781
+ sendPaymentDos: (sendCurrency, amountFiatToSend) => [
4782
+ { text: "Use Chase for this payment", emphasize: ["Chase"] },
4783
+ {
4784
+ text: `Send exactly ${amountFiatToSend} ${currencyInfo2[sendCurrency].currencyCode} in a single payment`,
4785
+ emphasize: [
4786
+ "exactly",
4787
+ amountFiatToSend,
4788
+ currencyInfo2[sendCurrency].currencyCode,
4789
+ "single"
4790
+ ]
4791
+ }
4792
+ ],
4793
+ sendPaymentDonts: () => [
4794
+ { text: "Do not send using any other bank", emphasize: ["Do not"] }
4795
+ ]
4796
+ };
4797
+ var zelleChaseVerifyConfig = {
4798
+ authLink: "https://secure.chase.com/web/auth/dashboard#/dashboard/singleDoor/payments/activity;params=qp,sentactivity",
4799
+ actionType: "transfer_zelle_chase",
4800
+ actionPlatform: PaymentPlatform.ZELLE,
4801
+ buyerTeeParams: {
4802
+ includeMetadataIndex: true
4803
+ },
4804
+ numPaymentsFetched: 15,
4805
+ minExtensionVersion: "0.6.3",
4806
+ supportsAppclip: false,
4807
+ totalProofs: 2,
4808
+ parseMetadata: (metadata) => {
4809
+ const amountStr = metadata.amount ?? "";
4810
+ let dateStr = metadata.date ?? "";
4811
+ if (dateStr && dateStr.length === 8) {
4812
+ const year = dateStr.substring(0, 4);
4813
+ const month = dateStr.substring(4, 6);
4814
+ const day = dateStr.substring(6, 8);
4815
+ dateStr = `${year}-${month}-${day}T23:59:59`;
4816
+ }
4817
+ const recipientIdStr = metadata.recipient || "";
4818
+ return {
4819
+ amount: amountStr,
4820
+ parsedAmount: amountStr !== "",
4821
+ date: dateStr,
4822
+ parsedDate: dateStr !== "",
4823
+ recipientId: recipientIdStr,
4824
+ parsedRecipientId: false,
4825
+ currency: Currency2.USD,
4826
+ parsedCurrency: true
4827
+ };
4828
+ },
4829
+ getSubjectText: (metadata) => {
4830
+ if (!metadata.amount || !metadata.recipient) {
4831
+ return "";
4832
+ }
4833
+ return `Transfer of $${Number(metadata.amount)} to ${metadata.recipient}`;
4834
+ }
4835
+ };
4836
+ var zelleCitiSendConfig = {
4837
+ paymentMethodName: "Citi",
4838
+ paymentMethodIcon: void 0,
4839
+ // Icon provided by client-side assets
4840
+ defaultPaymentMode: "QR_CODE",
4841
+ useCustomQRCode: true,
4842
+ troubleScanningQRCodeLink: (recipientId, sendCurrency, amountFiatToSend) => `https://online.citi.com/US/nga/zelle/transfer`,
4843
+ getFormattedSendLink: (recipientId, sendCurrency, amountFiatToSend) => {
4844
+ const encodedRecipientId = encodeZelleRecipientId(recipientId);
4845
+ return `https://enroll.zellepay.com/qr-codes?data=${encodedRecipientId}`;
4846
+ },
4847
+ deepLinkEmbedsRecipient: true,
4848
+ supportsSendingPaymentOnWeb: true,
4849
+ showTroubleScanningQRCodeLink: true,
4850
+ sendPaymentWarning: (sendCurrency, amountFiatToSend) => {
4851
+ return `Send exactly ${amountFiatToSend} ${currencyInfo2[sendCurrency].currencyCode} in a single payment through Citi's Zelle.`;
4852
+ },
4853
+ sendPaymentInfo: (sendCurrency, amountFiatToSend) => {
4854
+ return `Do not send using any other bank.`;
4855
+ },
4856
+ sendPaymentDos: (sendCurrency, amountFiatToSend) => [
4857
+ { text: "Use Citi for this payment", emphasize: ["Citi"] },
4858
+ {
4859
+ text: `Send exactly ${amountFiatToSend} ${currencyInfo2[sendCurrency].currencyCode} in a single payment`,
4860
+ emphasize: [
4861
+ "exactly",
4862
+ amountFiatToSend,
4863
+ currencyInfo2[sendCurrency].currencyCode,
4864
+ "single"
4865
+ ]
4866
+ }
4867
+ ],
4868
+ sendPaymentDonts: () => [
4869
+ { text: "Do not send using any other bank", emphasize: ["Do not"] }
4870
+ ]
4871
+ };
4872
+ var zelleCitiVerifyConfig = {
4873
+ authLink: "https://online.citi.com/US/nga/zelle/transfer",
4874
+ actionType: "transfer_zelle_citi",
4875
+ actionPlatform: PaymentPlatform.ZELLE,
4876
+ buyerTeeParams: {
4877
+ includeMetadataIndex: true
4878
+ },
4879
+ numPaymentsFetched: 15,
4880
+ minExtensionVersion: "0.6.3",
4881
+ supportsAppclip: false,
4882
+ totalProofs: 1,
4883
+ parseMetadata: (metadata) => {
4884
+ const amountStr = metadata.amount ?? "";
4885
+ let dateStr = metadata.date ?? "";
4886
+ if (dateStr && dateStr.length === 8) {
4887
+ const year = dateStr.substring(0, 4);
4888
+ const month = dateStr.substring(4, 6);
4889
+ const day = dateStr.substring(6, 8);
4890
+ dateStr = `${year}-${month}-${day}T23:59:59`;
4891
+ }
4892
+ const recipientIdStr = metadata.recipient || "";
4893
+ return {
4894
+ amount: amountStr,
4895
+ parsedAmount: amountStr !== "",
4896
+ date: dateStr,
4897
+ parsedDate: dateStr !== "",
4898
+ recipientId: recipientIdStr,
4899
+ parsedRecipientId: recipientIdStr !== "",
4900
+ currency: Currency2.USD,
4901
+ parsedCurrency: true
4902
+ };
4903
+ },
4904
+ getSubjectText: (metadata) => {
4905
+ if (!metadata.amount || !metadata.recipient) {
4906
+ return "";
4907
+ }
4908
+ return `Transfer of $${Number(metadata.amount)} to ${metadata.recipient}`;
4909
+ }
4910
+ };
4911
+ var genericZelleBankRoutes = [
4912
+ {
4913
+ bankId: "chase",
4914
+ sendConfig: zelleChaseSendConfig,
4915
+ verifyConfig: zelleChaseVerifyConfig
4916
+ },
4917
+ {
4918
+ bankId: "bofa",
4919
+ sendConfig: zelleBankOfAmericaSendConfig,
4920
+ verifyConfig: zelleBankOfAmericaVerifyConfig
4921
+ },
4922
+ {
4923
+ bankId: "citi",
4924
+ sendConfig: zelleCitiSendConfig,
4925
+ verifyConfig: zelleCitiVerifyConfig
4926
+ }
4927
+ ];
4928
+ genericZelleBankRoutes.map(({ sendConfig, verifyConfig }) => ({
4929
+ sendConfig,
4930
+ verifyConfig
4931
+ }));
4932
+ var DISPUTE_PROTECTION_STAKE_PLATFORMS = [
4933
+ PaymentPlatform.VENMO,
4934
+ PaymentPlatform.PAYPAL,
4935
+ PaymentPlatform.CASHAPP
4936
+ ];
4937
+ new Set(
4938
+ DISPUTE_PROTECTION_STAKE_PLATFORMS
4939
+ );
4940
+ var isCanonicalDisputeProtectionProjection = (projection) => typeof projection.disputeProtectionOptedOut === "boolean" && typeof projection.disputeProtectionRequiresStake === "boolean" && (!projection.disputeProtectionRequiresStake || !projection.disputeProtectionOptedOut);
4320
4941
 
4321
4942
  // src/adapters/api.ts
4322
4943
  function createHeaders(apiKey, authorizationToken, extraHeaders) {
@@ -4851,7 +5472,7 @@ function resolveSignalableEscrow(chainId, runtimeEnv) {
4851
5472
  }
4852
5473
  }
4853
5474
  function hasDisputeProtectionFields(row) {
4854
- return typeof row.disputeProtectionOptedIn === "boolean" && typeof row.disputeProtectionRequiresStake === "boolean";
5475
+ return isCanonicalDisputeProtectionProjection(row);
4855
5476
  }
4856
5477
  function isSignalableEscrowRow(rowEscrowAddress, signalableEscrow) {
4857
5478
  if (!signalableEscrow) return true;
@@ -5450,7 +6071,7 @@ var AccessPolicyOperations = class {
5450
6071
  address,
5451
6072
  abi,
5452
6073
  functionName: "enabled",
5453
- args: [params.escrow, params.depositId]
6074
+ args: [params.escrow, params.depositId, params.paymentMethod]
5454
6075
  });
5455
6076
  }
5456
6077
  /** Groups are enumerable onchain; direct addresses deliberately are not. */
@@ -5460,7 +6081,7 @@ var AccessPolicyOperations = class {
5460
6081
  address,
5461
6082
  abi,
5462
6083
  functionName: "getAllowedGroups",
5463
- args: [params.escrow, params.depositId]
6084
+ args: [params.escrow, params.depositId, params.paymentMethod]
5464
6085
  });
5465
6086
  }
5466
6087
  /**
@@ -5476,12 +6097,12 @@ var AccessPolicyOperations = class {
5476
6097
  args: [params.escrow, params.depositId, params.taker]
5477
6098
  });
5478
6099
  }
5479
- async maxGroupsPerDeposit() {
6100
+ async maxGroupsPerDepositPaymentMethod() {
5480
6101
  const { address, abi } = this.requirePolicy();
5481
6102
  return await this.config.getPublicClient().readContract({
5482
6103
  address,
5483
6104
  abi,
5484
- functionName: "MAX_GROUPS_PER_DEPOSIT"
6105
+ functionName: "MAX_GROUPS_PER_DEPOSIT_PAYMENT_METHOD"
5485
6106
  });
5486
6107
  }
5487
6108
  async groupExists(groupId) {
@@ -5517,28 +6138,35 @@ var AccessPolicyOperations = class {
5517
6138
  prepareConfigureDeposit(params) {
5518
6139
  return this.preparePolicyCall(
5519
6140
  "configureDeposit",
5520
- [params.escrow, params.depositId, params.enabled, params.groupIds, params.takers],
6141
+ [
6142
+ params.escrow,
6143
+ params.depositId,
6144
+ params.paymentMethod,
6145
+ params.enabled,
6146
+ params.groupIds,
6147
+ params.takers
6148
+ ],
5521
6149
  params.txOverrides
5522
6150
  );
5523
6151
  }
5524
6152
  prepareSetEnabled(params) {
5525
6153
  return this.preparePolicyCall(
5526
6154
  "setEnabled",
5527
- [params.escrow, params.depositId, params.enabled],
6155
+ [params.escrow, params.depositId, params.paymentMethod, params.enabled],
5528
6156
  params.txOverrides
5529
6157
  );
5530
6158
  }
5531
6159
  prepareAddAllowedGroups(params) {
5532
6160
  return this.preparePolicyCall(
5533
6161
  "addAllowedGroups",
5534
- [params.escrow, params.depositId, params.groupIds],
6162
+ [params.escrow, params.depositId, params.paymentMethod, params.groupIds],
5535
6163
  params.txOverrides
5536
6164
  );
5537
6165
  }
5538
6166
  prepareRemoveAllowedGroups(params) {
5539
6167
  return this.preparePolicyCall(
5540
6168
  "removeAllowedGroups",
5541
- [params.escrow, params.depositId, params.groupIds],
6169
+ [params.escrow, params.depositId, params.paymentMethod, params.groupIds],
5542
6170
  params.txOverrides
5543
6171
  );
5544
6172
  }
@@ -5558,23 +6186,31 @@ var AccessPolicyOperations = class {
5558
6186
  }
5559
6187
  /** Encodes one planner step. */
5560
6188
  preparePlanStep(params) {
5561
- const { escrow, depositId, step, txOverrides } = params;
6189
+ const { escrow, depositId, paymentMethod, step, txOverrides } = params;
5562
6190
  switch (step.kind) {
5563
6191
  case "configureDeposit":
5564
6192
  return this.prepareConfigureDeposit({
5565
6193
  escrow,
5566
6194
  depositId,
6195
+ paymentMethod,
5567
6196
  enabled: step.enabled,
5568
6197
  groupIds: step.groupIds,
5569
6198
  takers: step.takers,
5570
6199
  txOverrides
5571
6200
  });
5572
6201
  case "setEnabled":
5573
- return this.prepareSetEnabled({ escrow, depositId, enabled: step.enabled, txOverrides });
6202
+ return this.prepareSetEnabled({
6203
+ escrow,
6204
+ depositId,
6205
+ paymentMethod,
6206
+ enabled: step.enabled,
6207
+ txOverrides
6208
+ });
5574
6209
  case "addAllowedGroups":
5575
6210
  return this.prepareAddAllowedGroups({
5576
6211
  escrow,
5577
6212
  depositId,
6213
+ paymentMethod,
5578
6214
  groupIds: step.groupIds,
5579
6215
  txOverrides
5580
6216
  });
@@ -5582,6 +6218,7 @@ var AccessPolicyOperations = class {
5582
6218
  return this.prepareRemoveAllowedGroups({
5583
6219
  escrow,
5584
6220
  depositId,
6221
+ paymentMethod,
5585
6222
  groupIds: step.groupIds,
5586
6223
  txOverrides
5587
6224
  });
@@ -5613,6 +6250,7 @@ var AccessPolicyOperations = class {
5613
6250
  (step) => this.preparePlanStep({
5614
6251
  escrow: params.escrow,
5615
6252
  depositId: params.depositId,
6253
+ paymentMethod: params.paymentMethod,
5616
6254
  step,
5617
6255
  txOverrides: params.txOverrides
5618
6256
  })
@@ -5690,9 +6328,13 @@ var StakeOperations = class {
5690
6328
  getRiskWindow(paymentMethodHash) {
5691
6329
  return this.readPolicy("getRiskWindow", [paymentMethodHash]);
5692
6330
  }
5693
- /** Whether a specific escrow deposit has opted into dispute protection. */
5694
- isDisputeProtectionEnabled(escrow, depositId) {
5695
- return this.readPolicy("isDisputeProtectionEnabled", [escrow, depositId]);
6331
+ /** Whether a specific escrow deposit payment method has opted into dispute protection. */
6332
+ isDisputeProtectionEnabled(escrow, depositId, paymentMethod) {
6333
+ return this.readPolicy("isDisputeProtectionEnabled", [
6334
+ escrow,
6335
+ depositId,
6336
+ paymentMethod
6337
+ ]);
5696
6338
  }
5697
6339
  async getStakeVaultState(params) {
5698
6340
  const taker = params.taker ?? params.staker;
@@ -6495,13 +7137,13 @@ function decodeCursor(cursor, prefix, validate) {
6495
7137
  throw new ValidationError(`cursor must be a valid ${prefix} cursor`, "cursor");
6496
7138
  }
6497
7139
  }
6498
- function decodeLockCursor(cursor) {
6499
- return decodeCursor(cursor, "zkp2p-lock-v1", (value) => {
7140
+ function decodeIdCursor(cursor, prefix) {
7141
+ return decodeCursor(cursor, prefix, (value) => {
6500
7142
  if (typeof value !== "object" || value === null || typeof Reflect.get(value, "id") !== "string") {
6501
- throw new Error("invalid lock cursor");
7143
+ throw new Error("invalid id cursor");
6502
7144
  }
6503
7145
  const id = Reflect.get(value, "id");
6504
- if (id.length === 0) throw new Error("invalid lock cursor");
7146
+ if (id.length === 0) throw new Error("invalid id cursor");
6505
7147
  return id;
6506
7148
  });
6507
7149
  }
@@ -6578,7 +7220,7 @@ function normalizeActivityKind(value, field) {
6578
7220
  }
6579
7221
  return value;
6580
7222
  }
6581
- function latestLockAsOf(items) {
7223
+ function latestUpdatedAsOf(items) {
6582
7224
  if (items.length === 0) return null;
6583
7225
  const latest = items.reduce(
6584
7226
  (current, item) => BigInt(item.updatedAtBlockNumber) > BigInt(current.updatedAtBlockNumber) ? item : current
@@ -6620,6 +7262,35 @@ function normalizeStakeLockRow(row, index, scope) {
6620
7262
  updatedAt: normalizeDecimal(row.updatedAt, `${field}.updatedAt`)
6621
7263
  };
6622
7264
  }
7265
+ function normalizeTakerStakeAuthorizationRow(row, index, scope) {
7266
+ const field = `TakerStakeAuthorization[${index}]`;
7267
+ if (row.chainId !== scope.chainId) throw new Error(`${field}.chainId does not match the query`);
7268
+ if (normalizeAddress4(row.vaultAddress, `${field}.vaultAddress`) !== scope.vaultAddress) {
7269
+ throw new Error(`${field}.vaultAddress does not match the query`);
7270
+ }
7271
+ const taker = normalizeAddress4(row.taker, `${field}.taker`);
7272
+ const stakeOwner = normalizeAddress4(row.stakeOwner, `${field}.stakeOwner`);
7273
+ const scoped = scope.side === "stakeOwner" ? stakeOwner : taker;
7274
+ if (scoped !== scope.scopedAddress) {
7275
+ throw new Error(`${field}.${scope.side} does not match the query`);
7276
+ }
7277
+ if (typeof row.authorized !== "boolean") {
7278
+ throw new Error(`${field}.authorized must be a boolean`);
7279
+ }
7280
+ if (scope.authorized !== void 0 && row.authorized !== scope.authorized) {
7281
+ throw new Error(`${field}.authorized does not match the query`);
7282
+ }
7283
+ return {
7284
+ taker,
7285
+ stakeOwner,
7286
+ authorized: row.authorized,
7287
+ updatedAtBlockNumber: normalizeDecimal(
7288
+ row.updatedAtBlockNumber,
7289
+ `${field}.updatedAtBlockNumber`
7290
+ ),
7291
+ updatedAt: normalizeDecimal(row.updatedAt, `${field}.updatedAt`)
7292
+ };
7293
+ }
6623
7294
  function normalizeStakeActivityRow(row, index, scope) {
6624
7295
  const field = `StakeActivity[${index}]`;
6625
7296
  if (row.chainId !== scope.chainId) throw new Error(`${field}.chainId does not match the query`);
@@ -6770,7 +7441,7 @@ var IndexerStakingService = class {
6770
7441
  const vaultAddress = normalizeAddress4(params.vaultAddress, "vaultAddress");
6771
7442
  const stakeOwner = normalizeAddress4(params.stakeOwner, "stakeOwner");
6772
7443
  const status = params.status ? normalizeLockStatus(params.status, "status") : void 0;
6773
- const afterId = params.cursor ? decodeLockCursor(params.cursor) : void 0;
7444
+ const afterId = params.cursor ? decodeIdCursor(params.cursor, "zkp2p-lock-v1") : void 0;
6774
7445
  const filters = [
6775
7446
  { chainId: { _eq: params.chainId } },
6776
7447
  { vaultAddress: { _eq: vaultAddress } },
@@ -6807,7 +7478,67 @@ var IndexerStakingService = class {
6807
7478
  return {
6808
7479
  items,
6809
7480
  nextCursor: normalized.length > limit ? encodeCursor("zkp2p-lock-v1", { id: visible[visible.length - 1].id }) : null,
6810
- asOf: latestLockAsOf(items)
7481
+ asOf: latestUpdatedAsOf(items)
7482
+ };
7483
+ }
7484
+ /**
7485
+ * Pages one side of the vault's authorization graph: takers a stake owner
7486
+ * has authorized, or stake owners that have authorized a taker. Exactly one
7487
+ * of `stakeOwner` or `taker` scopes the page.
7488
+ */
7489
+ async fetchTakerStakeAuthorizations(params, init) {
7490
+ validateChainId(params.chainId);
7491
+ const limit = validateLimit(params.limit);
7492
+ const vaultAddress = normalizeAddress4(params.vaultAddress, "vaultAddress");
7493
+ if (params.stakeOwner === void 0 === (params.taker === void 0)) {
7494
+ throw new ValidationError(
7495
+ "exactly one of stakeOwner or taker must be provided",
7496
+ "stakeOwner"
7497
+ );
7498
+ }
7499
+ const scope = params.stakeOwner !== void 0 ? {
7500
+ side: "stakeOwner",
7501
+ address: normalizeAddress4(params.stakeOwner, "stakeOwner")
7502
+ } : { side: "taker", address: normalizeAddress4(params.taker, "taker") };
7503
+ const afterId = params.cursor ? decodeIdCursor(params.cursor, "zkp2p-stake-auth-v1") : void 0;
7504
+ const filters = [
7505
+ { chainId: { _eq: params.chainId } },
7506
+ { vaultAddress: { _eq: vaultAddress } },
7507
+ { [scope.side]: { _eq: scope.address } }
7508
+ ];
7509
+ if (params.authorized !== void 0) filters.push({ authorized: { _eq: params.authorized } });
7510
+ if (afterId) filters.push({ id: { _gt: afterId } });
7511
+ const data3 = await this.client.query(
7512
+ {
7513
+ query: TAKER_STAKE_AUTHORIZATIONS_QUERY,
7514
+ variables: { limit: limit + 1, where: { _and: filters } }
7515
+ },
7516
+ init
7517
+ );
7518
+ let previousId = afterId;
7519
+ const normalized = data3.TakerStakeAuthorization.map((row, index) => {
7520
+ const id = assertNonEmptyId(row.id, `TakerStakeAuthorization[${index}].id`);
7521
+ if (previousId !== void 0 && id <= previousId) {
7522
+ throw new Error("TakerStakeAuthorization cursor did not advance");
7523
+ }
7524
+ previousId = id;
7525
+ return {
7526
+ item: normalizeTakerStakeAuthorizationRow(row, index, {
7527
+ chainId: params.chainId,
7528
+ vaultAddress,
7529
+ side: scope.side,
7530
+ scopedAddress: scope.address,
7531
+ authorized: params.authorized
7532
+ }),
7533
+ id
7534
+ };
7535
+ });
7536
+ const visible = normalized.slice(0, limit);
7537
+ const items = visible.map(({ item }) => item);
7538
+ return {
7539
+ items,
7540
+ nextCursor: normalized.length > limit ? encodeCursor("zkp2p-stake-auth-v1", { id: visible[visible.length - 1].id }) : null,
7541
+ asOf: latestUpdatedAsOf(items)
6811
7542
  };
6812
7543
  }
6813
7544
  async fetchStakeActivity(params, init) {
@@ -7001,17 +7732,17 @@ var IndexerStakingService = class {
7001
7732
  }
7002
7733
  };
7003
7734
 
7004
- // ../../node_modules/.pnpm/@zkp2p+contracts-v2@0.4.1-rc.6_ethers@6.16.0_bufferutil@4.1.0_utf-8-validate@5.0.10__typescript@5.9.3_zod@4.4.3/node_modules/@zkp2p/contracts-v2/_esm/index.js
7005
- var version = "0.4.1-rc.6";
7735
+ // ../../node_modules/.pnpm/@zkp2p+contracts-v2@0.4.1-rc.9_ethers@6.16.0_bufferutil@4.1.0_utf-8-validate@5.0.10__typescript@5.9.3_zod@4.4.3/node_modules/@zkp2p/contracts-v2/_esm/index.js
7736
+ var version = "0.4.1-rc.9";
7006
7737
 
7007
- // ../../node_modules/.pnpm/@zkp2p+contracts-v2@0.4.1-rc.6_ethers@6.16.0_bufferutil@4.1.0_utf-8-validate@5.0.10__typescript@5.9.3_zod@4.4.3/node_modules/@zkp2p/contracts-v2/_esm/disputeStack/base.js
7738
+ // ../../node_modules/.pnpm/@zkp2p+contracts-v2@0.4.1-rc.9_ethers@6.16.0_bufferutil@4.1.0_utf-8-validate@5.0.10__typescript@5.9.3_zod@4.4.3/node_modules/@zkp2p/contracts-v2/_esm/disputeStack/base.js
7008
7739
  var data = {
7009
- "schemaVersion": 1,
7740
+ "schemaVersion": 2,
7010
7741
  "network": "base",
7011
7742
  "chainId": 8453,
7012
7743
  "activeDisputeStack": {
7013
- "version": 1,
7014
- "selectionHash": "a4f17ae7c1620ecfe7d036f0b9cc7b39c50e1382dc8dc14d2e5f7f21061cd5ad"
7744
+ "version": 2,
7745
+ "selectionHash": "ba40c2954b408d0c658881a8d28e5bfcc9bade5cc3d953fd17eae1eca69d841c"
7015
7746
  },
7016
7747
  "runtimeIdentities": {
7017
7748
  "Orchestrator": {
@@ -7027,32 +7758,32 @@ var data = {
7027
7758
  "runtimeCodeHash": "0x4e58f26129559301c017ff264b61dd2255ed2107593d308472ef32d07b8745e9"
7028
7759
  },
7029
7760
  "StakeVault": {
7030
- "address": "0x4d16F4a9946CfC76b1c1A4B63aa9D94cdA2dbCEB",
7761
+ "address": "0x47c26258222e2f96424bD2B21bf173f0DA5034C7",
7031
7762
  "runtimeCodeHash": "0xfd8d2a910b9ac2c55675ae06d0504f9aac43b02b7022755cf229b571156c681d"
7032
7763
  },
7033
7764
  "DisputeProtectionPolicy": {
7034
- "address": "0xcEc48F7242eDBf02875BB4629115Bd927e1287aA",
7035
- "runtimeCodeHash": "0x9c4be279da216021183638eaef79ebf98db248472685e9ecd0de3f24a513a641"
7765
+ "address": "0xbF4B769dB70DBEc89b6b2c44988304a7aD2de4Fc",
7766
+ "runtimeCodeHash": "0xf5a7756f16556da69c91c55bdcffd9fd95cc8cbdb772699827ec4c66db136dfe"
7036
7767
  },
7037
7768
  "IntentLifecycleHookV1": {
7038
- "address": "0x71467dCac3B50eeED5A485aC6a70f27B1EAC1970",
7039
- "runtimeCodeHash": "0x35789014e608a248f3244b61210fa259fee3566c33f50fd0e3fa1f5ae22e370b"
7769
+ "address": "0x5Dd6C675a7406fE8C9f0D93394a36fd6e8c50031",
7770
+ "runtimeCodeHash": "0x2b479a570ddea7a990f2cae8fa95eb3b8599fc8b367332b8dab92f7d0cebf7e0"
7040
7771
  },
7041
7772
  "RecognizedPredecessorHook": {
7042
- "address": "0x251d78fb6bBb4071995Bce74bAfC9E4168638622",
7043
- "runtimeCodeHash": "0x03d02863ed5eaa096d4089cb1e126681c0621d99409124f4af5be7ed83e341fe"
7773
+ "address": "0x71467dCac3B50eeED5A485aC6a70f27B1EAC1970",
7774
+ "runtimeCodeHash": "0x35789014e608a248f3244b61210fa259fee3566c33f50fd0e3fa1f5ae22e370b"
7044
7775
  },
7045
7776
  "RecognizedPredecessorPolicy": {
7046
- "address": "0xc086b6120B5e61EF48221E6A78c69737c9948dF9",
7047
- "runtimeCodeHash": "0xf08bce9ad622b9d45ce310493627cbef3bf6c4ac915661d5bc572bb59b61e084"
7777
+ "address": "0xcEc48F7242eDBf02875BB4629115Bd927e1287aA",
7778
+ "runtimeCodeHash": "0x9c4be279da216021183638eaef79ebf98db248472685e9ecd0de3f24a513a641"
7048
7779
  },
7049
7780
  "OrchestratorRegistry": {
7050
7781
  "address": "0xBe9fED15ED7A4B915C03EFcEcb9662739C3382A9",
7051
7782
  "runtimeCodeHash": "0xf0d132d621ac03181a6fade6a93bd0968d33830c8bf393793236787e7978aee1"
7052
7783
  },
7053
7784
  "WhitelistPolicy": {
7054
- "address": "0xBC53641b4B2504f0061D6a9426C61B8eBE9B4Ff0",
7055
- "runtimeCodeHash": "0xa3cf0fdf3835887de432cbac9c192edf6c93a8589748aa93f8294333d57024b2"
7785
+ "address": "0x389Cd9bA91FfFcd83d267B241E975541892759Ce",
7786
+ "runtimeCodeHash": "0xa83d138a5b89d2fd2861702febc6333e542dcdc8994ee76c345dcbd22fe685a4"
7056
7787
  },
7057
7788
  "DisputeVerifier": {
7058
7789
  "address": "0x30d4947f005653637005eed991005119D9eB2f34",
@@ -7076,26 +7807,26 @@ var data = {
7076
7807
  "StakeToken": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"
7077
7808
  },
7078
7809
  "expectedRelations": {
7079
- "activeLifecycleHook": "0x71467dCac3B50eeED5A485aC6a70f27B1EAC1970",
7080
- "recognizedPredecessorPolicy": "0xc086b6120B5e61EF48221E6A78c69737c9948dF9",
7810
+ "activeLifecycleHook": "0x5Dd6C675a7406fE8C9f0D93394a36fd6e8c50031",
7811
+ "recognizedPredecessorPolicy": "0xcEc48F7242eDBf02875BB4629115Bd927e1287aA",
7081
7812
  "registeredOrchestrator": "0x014025fDE093f8701d86e9f38e2C3a9b779cb5c7",
7082
- "authorizedLifecycleHook": "0x71467dCac3B50eeED5A485aC6a70f27B1EAC1970",
7083
- "disputeNullifierAuthorizedWriter": "0xcEc48F7242eDBf02875BB4629115Bd927e1287aA",
7813
+ "authorizedLifecycleHook": "0x5Dd6C675a7406fE8C9f0D93394a36fd6e8c50031",
7814
+ "disputeNullifierAuthorizedWriter": "0xbF4B769dB70DBEc89b6b2c44988304a7aD2de4Fc",
7084
7815
  "orchestratorEscrowRegistry": "0xeD0e847B101abc96E796260AC358e12BAa2f5B21",
7085
7816
  "orchestratorPaymentVerifierRegistry": "0x2b82D24437ff66Fb173eabDfD67ee2ACeb8bEb1e",
7086
7817
  "orchestratorRelayerRegistry": "0xEbA979889a9c97382A92472fF3703786fF180083",
7087
7818
  "hookOrchestratorRegistry": "0xBe9fED15ED7A4B915C03EFcEcb9662739C3382A9",
7088
- "hookWhitelistPolicy": "0xBC53641b4B2504f0061D6a9426C61B8eBE9B4Ff0",
7089
- "hookDisputeProtectionPolicy": "0xcEc48F7242eDBf02875BB4629115Bd927e1287aA",
7819
+ "hookWhitelistPolicy": "0x389Cd9bA91FfFcd83d267B241E975541892759Ce",
7820
+ "hookDisputeProtectionPolicy": "0xbF4B769dB70DBEc89b6b2c44988304a7aD2de4Fc",
7090
7821
  "whitelistGroupRegistry": "0x39F80118f9eB619135f116171b6Cb91D372C5AF2",
7091
7822
  "whitelistEscrowRegistry": "0xeD0e847B101abc96E796260AC358e12BAa2f5B21",
7092
7823
  "whitelistOrchestratorRegistry": "0xBe9fED15ED7A4B915C03EFcEcb9662739C3382A9",
7093
- "policyStakeVault": "0x4d16F4a9946CfC76b1c1A4B63aa9D94cdA2dbCEB",
7824
+ "policyStakeVault": "0x47c26258222e2f96424bD2B21bf173f0DA5034C7",
7094
7825
  "policyDisputeVerifier": "0x30d4947f005653637005eed991005119D9eB2f34",
7095
7826
  "policyDisputeNullifierRegistry": "0xA845615b5203F7a21321DdF5e3a1ca024D93a443",
7096
7827
  "disputeVerifierNullifierRegistry": "0x5455e761b866dfa6A2f5Dc6d6525825bf9C09aeB",
7097
7828
  "disputeVerifierAttestationVerifier": "0x9Fe920b24e50e6a6362BA71a1BeB502A99c402d5",
7098
- "vaultController": "0xcEc48F7242eDBf02875BB4629115Bd927e1287aA",
7829
+ "vaultController": "0xbF4B769dB70DBEc89b6b2c44988304a7aD2de4Fc",
7099
7830
  "vaultStakeToken": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"
7100
7831
  },
7101
7832
  "expectedGovernance": {
@@ -7131,15 +7862,15 @@ var data = {
7131
7862
  "0x888888359E981B5225CA48fbCdCeff702FC3b888",
7132
7863
  "0x014025fDE093f8701d86e9f38e2C3a9b779cb5c7"
7133
7864
  ],
7134
- "lifecycleHookAuthorizationFromBlock": "50201693",
7865
+ "lifecycleHookAuthorizationFromBlock": "50537204",
7135
7866
  "authorizedLifecycleHooks": [
7136
- "0x71467dCac3B50eeED5A485aC6a70f27B1EAC1970"
7867
+ "0x5Dd6C675a7406fE8C9f0D93394a36fd6e8c50031"
7137
7868
  ],
7138
7869
  "passiveDisputeNullifierWriters": [
7139
- "0xc086b6120B5e61EF48221E6A78c69737c9948dF9"
7870
+ "0xcEc48F7242eDBf02875BB4629115Bd927e1287aA"
7140
7871
  ],
7141
7872
  "activeDisputeNullifierWriters": [
7142
- "0xcEc48F7242eDBf02875BB4629115Bd927e1287aA"
7873
+ "0xbF4B769dB70DBEc89b6b2c44988304a7aD2de4Fc"
7143
7874
  ]
7144
7875
  },
7145
7876
  "riskWindowSecondsByPaymentMethod": {
@@ -7174,14 +7905,14 @@ var data = {
7174
7905
  };
7175
7906
  var base_default = data;
7176
7907
 
7177
- // ../../node_modules/.pnpm/@zkp2p+contracts-v2@0.4.1-rc.6_ethers@6.16.0_bufferutil@4.1.0_utf-8-validate@5.0.10__typescript@5.9.3_zod@4.4.3/node_modules/@zkp2p/contracts-v2/_esm/disputeStack/baseStaging.js
7908
+ // ../../node_modules/.pnpm/@zkp2p+contracts-v2@0.4.1-rc.9_ethers@6.16.0_bufferutil@4.1.0_utf-8-validate@5.0.10__typescript@5.9.3_zod@4.4.3/node_modules/@zkp2p/contracts-v2/_esm/disputeStack/baseStaging.js
7178
7909
  var data2 = {
7179
- "schemaVersion": 1,
7910
+ "schemaVersion": 2,
7180
7911
  "network": "base_staging",
7181
7912
  "chainId": 8453,
7182
7913
  "activeDisputeStack": {
7183
- "version": 1,
7184
- "selectionHash": "586c90f9de3d10b6d48f4286c709aa7f870fc2fdcfb0af1da947c1da76132dd0"
7914
+ "version": 2,
7915
+ "selectionHash": "6c49c1ce51eec594a22385c4efcab08aa9926b6b63a725e14a0027ec5d2f4fc9"
7185
7916
  },
7186
7917
  "runtimeIdentities": {
7187
7918
  "Orchestrator": {
@@ -7197,16 +7928,16 @@ var data2 = {
7197
7928
  "runtimeCodeHash": "0x4e58f26129559301c017ff264b61dd2255ed2107593d308472ef32d07b8745e9"
7198
7929
  },
7199
7930
  "StakeVault": {
7200
- "address": "0x01075fdCB8D38fD5A1070db41B3c00DC2459e71e",
7931
+ "address": "0x92d7B59E99e1CD2066540Cd2413b8714948b731f",
7201
7932
  "runtimeCodeHash": "0xfd8d2a910b9ac2c55675ae06d0504f9aac43b02b7022755cf229b571156c681d"
7202
7933
  },
7203
7934
  "DisputeProtectionPolicy": {
7204
- "address": "0x51436B8051cCf52739A2090C29DA208B70eC2663",
7205
- "runtimeCodeHash": "0xa4c6a33333e10da596805b6127e96f78e40fe5a0f0ab0cfa8f4683fbeac91a37"
7935
+ "address": "0x484fA07F085eb66bb7C2b649Ea9d5894b2B6681c",
7936
+ "runtimeCodeHash": "0x70c43bfae8253a6a166f9697ddc27b2d77b4d9841e01fefc2db84037d9a98622"
7206
7937
  },
7207
7938
  "IntentLifecycleHookV1": {
7208
- "address": "0x3AB0879499b28e03bfcA4F5bC2CBe2070Fba4E36",
7209
- "runtimeCodeHash": "0x376364aa8b693ee8e02eacc48527114ce3cc529714be5a3f316c7323561721ab"
7939
+ "address": "0x5A7f6cb7397134da1fDEFA7E2D434b4Cf18E56D9",
7940
+ "runtimeCodeHash": "0xb9ce42108c706f9241aeb41ffdc0da6b7584e8482183055452098b2f16c7abfd"
7210
7941
  },
7211
7942
  "RecognizedPredecessorHook": {
7212
7943
  "address": "0x19D9F0Fcb08C60D8bd0CD061C34eae27eF8b6e65",
@@ -7221,8 +7952,8 @@ var data2 = {
7221
7952
  "runtimeCodeHash": "0xf0d132d621ac03181a6fade6a93bd0968d33830c8bf393793236787e7978aee1"
7222
7953
  },
7223
7954
  "WhitelistPolicy": {
7224
- "address": "0x7d9277cb8bb78a51eeaafB7CFF306E7DA4C972fD",
7225
- "runtimeCodeHash": "0x917965fdc75580147ad0787c86f8b2a0f0185ef6e101567b82dc1245d6eb63bc"
7955
+ "address": "0xF79aAD1BAaB617fF3Eb299225c80893F22F743Fe",
7956
+ "runtimeCodeHash": "0x1ece96bb7be9cdd2433a2aad66c9b2d710e3e210a65876e0f8c1e43662ee5653"
7226
7957
  },
7227
7958
  "DisputeVerifier": {
7228
7959
  "address": "0x973578148c5Fd49b9f68B50B26066555325AC708",
@@ -7246,26 +7977,26 @@ var data2 = {
7246
7977
  "StakeToken": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"
7247
7978
  },
7248
7979
  "expectedRelations": {
7249
- "activeLifecycleHook": "0x3AB0879499b28e03bfcA4F5bC2CBe2070Fba4E36",
7980
+ "activeLifecycleHook": "0x5A7f6cb7397134da1fDEFA7E2D434b4Cf18E56D9",
7250
7981
  "recognizedPredecessorPolicy": "0x21517b7743E727ae47A66FafF93550B689c15020",
7251
7982
  "registeredOrchestrator": "0x2b5E8Ab562e45fA89D73802605E145ED3E3EeF4f",
7252
- "authorizedLifecycleHook": "0x3AB0879499b28e03bfcA4F5bC2CBe2070Fba4E36",
7253
- "disputeNullifierAuthorizedWriter": "0x51436B8051cCf52739A2090C29DA208B70eC2663",
7983
+ "authorizedLifecycleHook": "0x5A7f6cb7397134da1fDEFA7E2D434b4Cf18E56D9",
7984
+ "disputeNullifierAuthorizedWriter": "0x484fA07F085eb66bb7C2b649Ea9d5894b2B6681c",
7254
7985
  "orchestratorEscrowRegistry": "0xc545f336eC77E69bf115729acCbf2e557A00ac91",
7255
7986
  "orchestratorPaymentVerifierRegistry": "0x2261416DA54C85f975C73FA56EF4D2D6b0aEF7Cc",
7256
7987
  "orchestratorRelayerRegistry": "0xB214650b424E6b5fdcB1259566eB7A512D8Bd25E",
7257
7988
  "hookOrchestratorRegistry": "0xfA6384EB6176cfEC049540526A3d2126C3666d8A",
7258
- "hookWhitelistPolicy": "0x7d9277cb8bb78a51eeaafB7CFF306E7DA4C972fD",
7259
- "hookDisputeProtectionPolicy": "0x51436B8051cCf52739A2090C29DA208B70eC2663",
7989
+ "hookWhitelistPolicy": "0xF79aAD1BAaB617fF3Eb299225c80893F22F743Fe",
7990
+ "hookDisputeProtectionPolicy": "0x484fA07F085eb66bb7C2b649Ea9d5894b2B6681c",
7260
7991
  "whitelistGroupRegistry": "0x54Ff7788Cb42B46FE2F016a65Fd0f654Bb9BcF3D",
7261
7992
  "whitelistEscrowRegistry": "0xc545f336eC77E69bf115729acCbf2e557A00ac91",
7262
7993
  "whitelistOrchestratorRegistry": "0xfA6384EB6176cfEC049540526A3d2126C3666d8A",
7263
- "policyStakeVault": "0x01075fdCB8D38fD5A1070db41B3c00DC2459e71e",
7994
+ "policyStakeVault": "0x92d7B59E99e1CD2066540Cd2413b8714948b731f",
7264
7995
  "policyDisputeVerifier": "0x973578148c5Fd49b9f68B50B26066555325AC708",
7265
7996
  "policyDisputeNullifierRegistry": "0xE0B05a9655AF0f31E32904267baa50FbC7f217ea",
7266
7997
  "disputeVerifierNullifierRegistry": "0x2eb43d6C7c7Ec4220Aa6B8735BC053824a71778C",
7267
7998
  "disputeVerifierAttestationVerifier": "0x9855a39aC5975069632e91160d8712CBfF19e864",
7268
- "vaultController": "0x51436B8051cCf52739A2090C29DA208B70eC2663",
7999
+ "vaultController": "0x484fA07F085eb66bb7C2b649Ea9d5894b2B6681c",
7269
8000
  "vaultStakeToken": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"
7270
8001
  },
7271
8002
  "expectedGovernance": {
@@ -7301,15 +8032,15 @@ var data2 = {
7301
8032
  "0xc17a59227B136c45fAa153086a15EF87ED14bE00",
7302
8033
  "0x2b5E8Ab562e45fA89D73802605E145ED3E3EeF4f"
7303
8034
  ],
7304
- "lifecycleHookAuthorizationFromBlock": "50201496",
8035
+ "lifecycleHookAuthorizationFromBlock": "50536390",
7305
8036
  "authorizedLifecycleHooks": [
7306
- "0x3AB0879499b28e03bfcA4F5bC2CBe2070Fba4E36"
8037
+ "0x5A7f6cb7397134da1fDEFA7E2D434b4Cf18E56D9"
7307
8038
  ],
7308
8039
  "passiveDisputeNullifierWriters": [
7309
8040
  "0x21517b7743E727ae47A66FafF93550B689c15020"
7310
8041
  ],
7311
8042
  "activeDisputeNullifierWriters": [
7312
- "0x51436B8051cCf52739A2090C29DA208B70eC2663"
8043
+ "0x484fA07F085eb66bb7C2b649Ea9d5894b2B6681c"
7313
8044
  ]
7314
8045
  },
7315
8046
  "riskWindowSecondsByPaymentMethod": {
@@ -7334,7 +8065,7 @@ var data2 = {
7334
8065
  "prerequisites": {
7335
8066
  "orchestratorPaused": false,
7336
8067
  "admissionsPaused": false,
7337
- "allowMultipleIntents": true,
8068
+ "allowMultipleIntents": false,
7338
8069
  "orchestratorRegistered": true,
7339
8070
  "lifecycleHookAuthorized": true,
7340
8071
  "disputeNullifierWriterAuthorized": true,
@@ -7348,7 +8079,7 @@ var baseStaging_default = data2;
7348
8079
 
7349
8080
  // src/buildMetadata.ts
7350
8081
  var DEVELOPMENT_BUILD_METADATA = {
7351
- schemaVersion: 1,
8082
+ schemaVersion: 2,
7352
8083
  source: {
7353
8084
  repository: "zkp2p/zkp2p-clients",
7354
8085
  commitSha: "development",
@@ -7359,13 +8090,14 @@ var DEVELOPMENT_BUILD_METADATA = {
7359
8090
  contractsPackageVersion: "development",
7360
8091
  indexerSchemaPackageVersion: "development",
7361
8092
  activeDisputeStack: {
7362
- base: { version: 1, selectionHash: "development" },
7363
- baseStaging: { version: 1, selectionHash: "development" }
8093
+ base: { version: 2, selectionHash: "development" },
8094
+ baseStaging: { version: 2, selectionHash: "development" }
7364
8095
  }
7365
8096
  };
7366
8097
  var SDK_BUILD_METADATA = typeof define_ZKP2P_SDK_BUILD_METADATA_default === "undefined" ? DEVELOPMENT_BUILD_METADATA : define_ZKP2P_SDK_BUILD_METADATA_default;
7367
8098
 
7368
8099
  // src/client/DisputeProtectionReadiness.ts
8100
+ var DisputeProtectionPolicy = DISPUTE_PROTECTION_POLICY_ABI ?? DisputeProtectionPolicy_default;
7369
8101
  var SUCCESSOR_RUNTIME_IDENTITIES = [
7370
8102
  "IntentLifecycleHookV1",
7371
8103
  "StakeVault",
@@ -7380,7 +8112,7 @@ var GOVERNANCE_ABIS = {
7380
8112
  OrchestratorRegistry: OrchestratorRegistry_default,
7381
8113
  OrchestratorV3: OrchestratorV3_default,
7382
8114
  StakeVault: StakeVault_default,
7383
- DisputeProtectionPolicy: DisputeProtectionPolicy_default,
8115
+ DisputeProtectionPolicy,
7384
8116
  WhitelistPolicy: WhitelistPolicy_default,
7385
8117
  DisputeVerifier: DisputeVerifier_default,
7386
8118
  DisputeNullifierRegistry: DisputeNullifierRegistry_default,
@@ -7389,7 +8121,7 @@ var GOVERNANCE_ABIS = {
7389
8121
  var ORCHESTRATOR_AUTHORIZATION_EVENTS = OrchestratorRegistry_default.filter(
7390
8122
  (item) => item.type === "event" && (item.name === "OrchestratorAdded" || item.name === "OrchestratorRemoved")
7391
8123
  );
7392
- var LIFECYCLE_HOOK_AUTHORIZATION_EVENTS = DisputeProtectionPolicy_default.filter(
8124
+ var LIFECYCLE_HOOK_AUTHORIZATION_EVENTS = DisputeProtectionPolicy.filter(
7393
8125
  (item) => item.type === "event" && item.name === "LifecycleHookAuthorizationUpdated"
7394
8126
  );
7395
8127
  var FALLBACK_LOG_BLOCK_SPAN = 10000n;
@@ -7425,6 +8157,17 @@ function expectAddressSet(label, actual, expected) {
7425
8157
  throw new ReadinessMismatch(`${label} mismatch`);
7426
8158
  }
7427
8159
  }
8160
+ function expectAddressSubsetWithRequired(label, actual, expected, required) {
8161
+ const actualAddresses = normalizeAddressSet(label, actual);
8162
+ const expectedAddresses = new Set(normalizeAddressSet(label, expected));
8163
+ const unknown = actualAddresses.filter((address) => !expectedAddresses.has(address));
8164
+ if (unknown.length > 0) {
8165
+ throw new ReadinessMismatch(`${label} mismatch`);
8166
+ }
8167
+ if (!actualAddresses.includes(required.toLowerCase())) {
8168
+ throw new ReadinessMismatch(`${label} is missing the active successor orchestrator`);
8169
+ }
8170
+ }
7428
8171
  function fallbackBlockRanges(fromBlock, toBlock) {
7429
8172
  const ranges = [];
7430
8173
  for (let start = fromBlock; start <= toBlock; start += FALLBACK_LOG_BLOCK_SPAN) {
@@ -7483,7 +8226,7 @@ function validatePackagedIdentity(config) {
7483
8226
  if (buildMetadata.contractsPackageVersion !== contractsPackageVersion) {
7484
8227
  return "contracts package version does not match SDK build metadata";
7485
8228
  }
7486
- if (manifest.schemaVersion !== 1 || manifest.chainId !== chainId || manifest.network !== "base" && manifest.network !== "base_staging") {
8229
+ if (manifest.schemaVersion !== 2 || manifest.chainId !== chainId || manifest.network !== "base" && manifest.network !== "base_staging") {
7487
8230
  return "dispute readiness manifest chain identity mismatch";
7488
8231
  }
7489
8232
  const selected = manifest.network === "base" ? buildMetadata.activeDisputeStack.base : buildMetadata.activeDisputeStack.baseStaging;
@@ -7713,10 +8456,11 @@ var DisputeProtectionReadinessReader = class {
7713
8456
  "hook",
7714
8457
  "isAuthorized"
7715
8458
  );
7716
- expectAddressSet(
8459
+ expectAddressSubsetWithRequired(
7717
8460
  "OrchestratorRegistry authorized orchestrators",
7718
8461
  orchestrators,
7719
- authorizations.authorizedOrchestrators
8462
+ authorizations.authorizedOrchestrators,
8463
+ this.config.manifest.runtimeIdentities.OrchestratorV3.address
7720
8464
  );
7721
8465
  expectAddressSet(
7722
8466
  "DisputeProtectionPolicy authorized lifecycle hooks",
@@ -7738,6 +8482,10 @@ var DisputeProtectionReadinessReader = class {
7738
8482
  const riskWindows = Object.entries(manifest.riskWindowSecondsByPaymentMethod).sort(
7739
8483
  ([left], [right]) => left.localeCompare(right)
7740
8484
  );
8485
+ const sentinelPaymentMethod = riskWindows[0]?.[0];
8486
+ if (!sentinelPaymentMethod) {
8487
+ throw new ReadinessMismatch("DisputeProtectionPolicy sentinel payment method is missing");
8488
+ }
7741
8489
  const contracts = [
7742
8490
  {
7743
8491
  address: identities.IntentLifecycleHookV1.address,
@@ -7775,34 +8523,38 @@ var DisputeProtectionReadinessReader = class {
7775
8523
  abi: WhitelistPolicy_default,
7776
8524
  functionName: "orchestratorRegistry"
7777
8525
  },
7778
- { address: policy, abi: DisputeProtectionPolicy_default, functionName: "stakeVault" },
7779
- { address: policy, abi: DisputeProtectionPolicy_default, functionName: "disputeVerifier" },
8526
+ { address: policy, abi: DisputeProtectionPolicy, functionName: "stakeVault" },
8527
+ { address: policy, abi: DisputeProtectionPolicy, functionName: "disputeVerifier" },
7780
8528
  {
7781
8529
  address: policy,
7782
- abi: DisputeProtectionPolicy_default,
8530
+ abi: DisputeProtectionPolicy,
7783
8531
  functionName: "disputeNullifierRegistry"
7784
8532
  },
7785
8533
  {
7786
8534
  address: policy,
7787
- abi: DisputeProtectionPolicy_default,
8535
+ abi: DisputeProtectionPolicy,
7788
8536
  functionName: "isLifecycleHookAuthorized",
7789
8537
  args: [relations.authorizedLifecycleHook]
7790
8538
  },
7791
- { address: policy, abi: DisputeProtectionPolicy_default, functionName: "admissionsPaused" },
8539
+ { address: policy, abi: DisputeProtectionPolicy, functionName: "admissionsPaused" },
7792
8540
  {
7793
8541
  address: policy,
7794
- abi: DisputeProtectionPolicy_default,
8542
+ abi: DisputeProtectionPolicy,
7795
8543
  functionName: "PENDING_COVERAGE_MATURITY"
7796
8544
  },
7797
8545
  {
7798
8546
  address: policy,
7799
- abi: DisputeProtectionPolicy_default,
8547
+ abi: DisputeProtectionPolicy,
7800
8548
  functionName: "isDisputeProtectionEnabled",
7801
- args: [manifest.sentinel.escrow, BigInt(manifest.sentinel.depositId)]
8549
+ args: [
8550
+ manifest.sentinel.escrow,
8551
+ BigInt(manifest.sentinel.depositId),
8552
+ sentinelPaymentMethod
8553
+ ]
7802
8554
  },
7803
8555
  ...riskWindows.map(([paymentMethod]) => ({
7804
8556
  address: policy,
7805
- abi: DisputeProtectionPolicy_default,
8557
+ abi: DisputeProtectionPolicy,
7806
8558
  functionName: "getRiskWindow",
7807
8559
  args: [paymentMethod]
7808
8560
  })),
@@ -8382,7 +9134,12 @@ var Zkp2pClient = class {
8382
9134
  () => []
8383
9135
  );
8384
9136
  /** Enable or disable dispute protection for one deposit. */
8385
- this.setDisputeProtectionEnabled = this.buildDisputeProtectionPolicyMethod("setDisputeProtectionEnabled", (params) => [params.escrow, params.depositId, params.enabled]);
9137
+ this.setDisputeProtectionEnabled = this.buildDisputeProtectionPolicyMethod("setDisputeProtectionEnabled", (params) => [
9138
+ params.escrow,
9139
+ params.depositId,
9140
+ params.paymentMethod,
9141
+ params.enabled
9142
+ ]);
8386
9143
  /**
8387
9144
  * Release one protected intent whose risk window matured, unlocking its
8388
9145
  * stake cover. Permissionless once mature. Pass `disputeProtectionPolicyAddress` to
@@ -10300,6 +11057,15 @@ var Zkp2pClient = class {
10300
11057
  getStakeLocks: (params, options) => {
10301
11058
  return stakingService.fetchStakeLocks(params, { signal: options?.signal });
10302
11059
  },
11060
+ /**
11061
+ * Pages one side of the vault's authorization graph: the takers a stake
11062
+ * owner has authorized, or the stake owners that have authorized a taker.
11063
+ */
11064
+ getTakerStakeAuthorizations: (params, options) => {
11065
+ return stakingService.fetchTakerStakeAuthorizations(params, {
11066
+ signal: options?.signal
11067
+ });
11068
+ },
10303
11069
  /** Pages append-only activity relevant to either side of a merchant's stake delegation. */
10304
11070
  getStakeActivity: (params, options) => {
10305
11071
  return stakingService.fetchStakeActivity(params, { signal: options?.signal });
@@ -10478,8 +11244,8 @@ var Zkp2pClient = class {
10478
11244
  return this._stakeOps.getRiskWindow(paymentMethodHash);
10479
11245
  }
10480
11246
  /** Read whether an escrow deposit has opted into dispute protection. */
10481
- isDisputeProtectionEnabled(escrow, depositId) {
10482
- return this._stakeOps.isDisputeProtectionEnabled(escrow, depositId);
11247
+ isDisputeProtectionEnabled(escrow, depositId, paymentMethod) {
11248
+ return this._stakeOps.isDisputeProtectionEnabled(escrow, depositId, paymentMethod);
10483
11249
  }
10484
11250
  /**
10485
11251
  * Registers payee details with the curator API and returns hashed on-chain IDs.
@@ -10682,7 +11448,7 @@ var Zkp2pClient = class {
10682
11448
  }
10683
11449
  }
10684
11450
  });
10685
- const { mapConversionRatesToOnchainMinRate: mapConversionRatesToOnchainMinRate2 } = await import('./currency-Y5CH6IXG.mjs');
11451
+ const { mapConversionRatesToOnchainMinRate: mapConversionRatesToOnchainMinRate2 } = await import('./currency-CTXWPQTT.mjs');
10686
11452
  currencies = mapConversionRatesToOnchainMinRate2(
10687
11453
  params.conversionRates,
10688
11454
  paymentMethods.length
@@ -11382,7 +12148,7 @@ function selectRiskMode(amount, freeStake, disputeProtected) {
11382
12148
  }
11383
12149
 
11384
12150
  // src/client/accessPolicyPlan.ts
11385
- var MAX_GROUPS_PER_DEPOSIT = 10;
12151
+ var MAX_GROUPS_PER_DEPOSIT_PAYMENT_METHOD = 10;
11386
12152
  var MAX_ADDRESSES_PER_CALL = 50;
11387
12153
  var MAX_WHITELISTED_ADDRESSES = 500;
11388
12154
  var chunk = (values, size) => {
@@ -11434,7 +12200,7 @@ var planAccessPolicyUpdate = (persistedInput, draftInput) => {
11434
12200
  if (draft.enabled && draft.groupIds.length === 0 && draft.addresses.length === 0) {
11435
12201
  violations.push("empty-restricted-policy");
11436
12202
  }
11437
- if (draft.groupIds.length > MAX_GROUPS_PER_DEPOSIT) {
12203
+ if (draft.groupIds.length > MAX_GROUPS_PER_DEPOSIT_PAYMENT_METHOD) {
11438
12204
  violations.push("group-cap-exceeded");
11439
12205
  }
11440
12206
  if (draft.addresses.length > MAX_WHITELISTED_ADDRESSES) {
@@ -11451,7 +12217,7 @@ var planAccessPolicyUpdate = (persistedInput, draftInput) => {
11451
12217
  };
11452
12218
  }
11453
12219
  const peakIfAddingFirst = (/* @__PURE__ */ new Set([...persisted.groupIds, ...diff.addedGroupIds])).size;
11454
- const mustRemoveGroupsFirst = peakIfAddingFirst > MAX_GROUPS_PER_DEPOSIT;
12220
+ const mustRemoveGroupsFirst = peakIfAddingFirst > MAX_GROUPS_PER_DEPOSIT_PAYMENT_METHOD;
11455
12221
  const ordering = !draft.enabled ? "disable-first" : mustRemoveGroupsFirst ? "removals-first" : "additions-first";
11456
12222
  const steps = [];
11457
12223
  const additionSteps = () => {
@@ -11537,6 +12303,6 @@ var planAccessPolicyUpdate = (persistedInput, draftInput) => {
11537
12303
  };
11538
12304
  };
11539
12305
 
11540
- export { AccessPolicyOperations, AccessPolicyUnsupportedError, BASE_BUILDER_CODE, CHAINLINK_ORACLE_ADAPTER, CHAINLINK_ORACLE_FEEDS, ContractRouter, DEFAULT_ORACLE_MAX_STALENESS_SECONDS, IndexerClient, IndexerDepositService, IndexerRateManagerService, IndexerStakingService, MAX_ADDRESSES_PER_CALL, MAX_GROUPS_PER_DEPOSIT, MAX_WHITELISTED_ADDRESSES, Zkp2pClient as OfframpClient, PEER_EXTENSION_CHROME_URL, PLATFORM_METADATA, PYTH_CONTRACT_BASE, PYTH_ORACLE_ADAPTER, PYTH_ORACLE_FEEDS, REFERRAL_SIGNATURE_DOMAIN, REFERRAL_SIGNATURE_TYPES, RISK_BPS_DENOMINATOR, SDK_BUILD_METADATA, SPREAD_ORACLE_FEEDS, SUPPORTED_CHAIN_IDS, TOKEN_METADATA, ZKP2P_ANDROID_REFERRER, ZKP2P_IOS_REFERRER, Zkp2pClient, apiCreateReferralCode, apiCreateSellerCredentialBundle, apiGetDepositBundle, apiGetOrderbook, apiGetOrderbookTable, apiGetOwnerDeposits, apiGetPayeeDetails, apiGetQuote, apiGetQuotesBestByPlatform, apiGetReferralDashboard, apiGetReferralEarnings, apiLookupReferralCode, apiPostDepositDetails, apiRedeemReferralCode, apiRequestIdentityAttestation, apiSignIntentV3, apiSignIntentV3Raw, apiUpdateReferralCode, apiUploadGoogleOAuthSellerCredential, apiUploadSellerCredentialBundle, apiValidatePayeeDetails, apiVerifyBuyerTeePayment, appendAttributionToCalldata, assertValidReferrerFeeConfig, buildStakingEntityIds, calculateRequiredCoverage, calculateStakeBackedCapacity, compareEventCursorIdsByRecency, convertDepositsForLiquidity, convertIndexerDepositToEscrowView, convertIndexerIntentsToEscrowViews, createCompositeDepositId, createEncryptedBuyerTeeSessionMaterial, createPeerExtensionSdk, defaultIndexerEndpoint, diffAccessPolicy, encodePythAdapterConfig, encodeSpreadOracleAdapterConfig, encodeWithAttribution, fetchFulfillmentAndPayment as fetchIndexerFulfillmentAndPayment, getAttributionDataSuffix, getPeerExtensionState, getSpreadOracleConfig, isPeerExtensionAvailable, isValidReferralCode, isValidReferrerFeeBps, isValidReferrerFeeRecipient, logger, normalizeAccessPolicyState, normalizeReferralCode, openPeerExtensionInstallPage, parseReferrerFeeConfig, peerExtensionSdk, planAccessPolicyUpdate, referrerFeeConfigToPreciseUnits, selectRiskMode, sendTransactionWithAttribution, setLogLevel, validateOracleFeedsOnChain };
12306
+ export { AccessPolicyOperations, AccessPolicyUnsupportedError, BASE_BUILDER_CODE, CHAINLINK_ORACLE_ADAPTER, CHAINLINK_ORACLE_FEEDS, ContractRouter, DEFAULT_ORACLE_MAX_STALENESS_SECONDS, IndexerClient, IndexerDepositService, IndexerRateManagerService, IndexerStakingService, MAX_ADDRESSES_PER_CALL, MAX_GROUPS_PER_DEPOSIT_PAYMENT_METHOD, MAX_WHITELISTED_ADDRESSES, Zkp2pClient as OfframpClient, PEER_EXTENSION_CHROME_URL, PLATFORM_METADATA, PYTH_CONTRACT_BASE, PYTH_ORACLE_ADAPTER, PYTH_ORACLE_FEEDS, REFERRAL_SIGNATURE_DOMAIN, REFERRAL_SIGNATURE_TYPES, RISK_BPS_DENOMINATOR, SDK_BUILD_METADATA, SPREAD_ORACLE_FEEDS, SUPPORTED_CHAIN_IDS, TOKEN_METADATA, ZKP2P_ANDROID_REFERRER, ZKP2P_IOS_REFERRER, Zkp2pClient, apiCreateReferralCode, apiCreateSellerCredentialBundle, apiGetDepositBundle, apiGetOrderbook, apiGetOrderbookTable, apiGetOwnerDeposits, apiGetPayeeDetails, apiGetQuote, apiGetQuotesBestByPlatform, apiGetReferralDashboard, apiGetReferralEarnings, apiLookupReferralCode, apiPostDepositDetails, apiRedeemReferralCode, apiRequestIdentityAttestation, apiSignIntentV3, apiSignIntentV3Raw, apiUpdateReferralCode, apiUploadGoogleOAuthSellerCredential, apiUploadSellerCredentialBundle, apiValidatePayeeDetails, apiVerifyBuyerTeePayment, appendAttributionToCalldata, assertValidReferrerFeeConfig, buildStakingEntityIds, calculateRequiredCoverage, calculateStakeBackedCapacity, compareEventCursorIdsByRecency, convertDepositsForLiquidity, convertIndexerDepositToEscrowView, convertIndexerIntentsToEscrowViews, createCompositeDepositId, createEncryptedBuyerTeeSessionMaterial, createPeerExtensionSdk, defaultIndexerEndpoint, diffAccessPolicy, encodePythAdapterConfig, encodeSpreadOracleAdapterConfig, encodeWithAttribution, fetchFulfillmentAndPayment as fetchIndexerFulfillmentAndPayment, getAttributionDataSuffix, getPeerExtensionState, getSpreadOracleConfig, isPeerExtensionAvailable, isValidReferralCode, isValidReferrerFeeBps, isValidReferrerFeeRecipient, logger, normalizeAccessPolicyState, normalizeReferralCode, openPeerExtensionInstallPage, parseReferrerFeeConfig, peerExtensionSdk, planAccessPolicyUpdate, referrerFeeConfigToPreciseUnits, selectRiskMode, sendTransactionWithAttribution, setLogLevel, validateOracleFeedsOnChain };
11541
12307
  //# sourceMappingURL=index.mjs.map
11542
12308
  //# sourceMappingURL=index.mjs.map