@zkp2p/sdk 0.12.2-rc.0 → 0.12.2-rc.2
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/README.md +96 -24
- package/dist/build-metadata.json +22 -0
- package/dist/{chunk-GHQK65J2.mjs → chunk-3J4FPMPW.mjs} +2 -2
- package/dist/{chunk-GHQK65J2.mjs.map → chunk-3J4FPMPW.mjs.map} +1 -1
- package/dist/{chunk-4U4GTDCJ.mjs → chunk-67JSDBUL.mjs} +373 -373
- package/dist/{chunk-4U4GTDCJ.mjs.map → chunk-67JSDBUL.mjs.map} +1 -1
- package/dist/chunk-UQEKVVIN.mjs +12 -0
- package/dist/chunk-UQEKVVIN.mjs.map +1 -0
- package/dist/{chunk-FCOH36IX.mjs → chunk-YA67SM3A.mjs} +2 -2
- package/dist/{chunk-FCOH36IX.mjs.map → chunk-YA67SM3A.mjs.map} +1 -1
- package/dist/{chunk-ZFBH4HD7.mjs → chunk-ZB22BZLZ.mjs} +2 -2
- package/dist/{chunk-ZFBH4HD7.mjs.map → chunk-ZB22BZLZ.mjs.map} +1 -1
- package/dist/{currency-MARF3D2J.mjs → currency-Y5CH6IXG.mjs} +4 -4
- package/dist/{currency-MARF3D2J.mjs.map → currency-Y5CH6IXG.mjs.map} +1 -1
- package/dist/index.cjs +2267 -562
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +35 -10
- package/dist/index.d.ts +35 -10
- package/dist/index.mjs +1642 -106
- package/dist/index.mjs.map +1 -1
- package/dist/protocolViewerParsers-QE6LWS3W.mjs +5 -0
- package/dist/{protocolViewerParsers-JGW65QV4.mjs.map → protocolViewerParsers-QE6LWS3W.mjs.map} +1 -1
- package/dist/react.cjs +41 -0
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.mts +15 -3
- package/dist/react.d.ts +15 -3
- package/dist/react.mjs +44 -4
- package/dist/react.mjs.map +1 -1
- package/dist/{timeout-YLP3WHZF.mjs → timeout-CQ4Y2Z4T.mjs} +4 -4
- package/dist/{timeout-YLP3WHZF.mjs.map → timeout-CQ4Y2Z4T.mjs.map} +1 -1
- package/dist/{vaultUtils-BmJ6T8rn.d.mts → vaultUtils-Dla_eG15.d.mts} +203 -40
- package/dist/{vaultUtils-BmJ6T8rn.d.ts → vaultUtils-Dla_eG15.d.ts} +203 -40
- package/package.json +22 -21
- package/dist/chunk-J5LGTIGS.mjs +0 -9
- package/dist/chunk-J5LGTIGS.mjs.map +0 -1
- package/dist/protocolViewerParsers-JGW65QV4.mjs +0 -5
package/dist/index.mjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { IntentGuardianOperations } from './chunk-
|
|
2
|
-
export { ZERO_RATE_MANAGER_ID, classifyDelegationState, classifyIntentGuardianError, getDelegationRoute, isZeroRateManagerId, normalizeRateManagerId, normalizeRegistry } from './chunk-
|
|
3
|
-
import { NetworkError, ValidationError, APIError } from './chunk-
|
|
4
|
-
export { APIError, ContractError, ErrorCode, NetworkError, ValidationError, ZKP2PError } from './chunk-
|
|
5
|
-
import { METHOD_NAME_TO_HASH, matchesQuotePaymentMethod, matchesPaymentMethodNameAndHash, getContracts, getRateManagerContracts, getPaymentMethodsCatalog, resolvePaymentMethodHashFromCatalog, getGatingServiceAddress, parseBigIntLike, SUPPORTED_PAYMENT_METHOD_HASHES, resolveFiatCurrencyBytes32, resolvePaymentMethodNameFromHash } from './chunk-
|
|
6
|
-
export {
|
|
7
|
-
import { Currency, currencyKeccak256 } from './chunk-
|
|
8
|
-
export { Currency, currencyInfo, getCurrencyCodeFromHash, getCurrencyInfoFromCountryCode, getCurrencyInfoFromHash, isSupportedCurrencyHash, mapConversionRatesToOnchainMinRate } from './chunk-
|
|
9
|
-
import './chunk-
|
|
10
|
-
import { concatHex, encodeFunctionData, encodeAbiParameters, createPublicClient, http, isAddress, zeroAddress, formatUnits } from 'viem';
|
|
1
|
+
import { IntentGuardianOperations } from './chunk-YA67SM3A.mjs';
|
|
2
|
+
export { ZERO_RATE_MANAGER_ID, classifyDelegationState, classifyIntentGuardianError, getDelegationRoute, isZeroRateManagerId, normalizeRateManagerId, normalizeRegistry } from './chunk-YA67SM3A.mjs';
|
|
3
|
+
import { NetworkError, ValidationError, APIError } from './chunk-3J4FPMPW.mjs';
|
|
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';
|
|
7
|
+
import { Currency, currencyKeccak256 } from './chunk-ZB22BZLZ.mjs';
|
|
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';
|
|
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-
|
|
360
|
+
const { withTimeout } = await import('./timeout-CQ4Y2Z4T.mjs');
|
|
361
361
|
return await withTimeout(fn(), timeoutMs, `Operation timed out after ${timeoutMs}ms`);
|
|
362
362
|
}
|
|
363
363
|
return await fn();
|
|
@@ -852,7 +852,7 @@ async function sendTransactionWithAttribution(walletClient, request, referrer, o
|
|
|
852
852
|
// src/utils/constants.ts
|
|
853
853
|
var DEFAULT_BASE_API_URL = "https://api.zkp2p.xyz";
|
|
854
854
|
|
|
855
|
-
// ../../node_modules/.pnpm/@zkp2p+contracts-v2@0.4.
|
|
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
|
|
856
856
|
var chainlink_default = {
|
|
857
857
|
feeds: [
|
|
858
858
|
{
|
|
@@ -1300,7 +1300,7 @@ var IntentOperations = class {
|
|
|
1300
1300
|
}
|
|
1301
1301
|
];
|
|
1302
1302
|
const { referrer } = params.txOverrides ?? {};
|
|
1303
|
-
const
|
|
1303
|
+
const data3 = encodeWithAttribution(
|
|
1304
1304
|
{
|
|
1305
1305
|
abi: orchestratorContext.abi,
|
|
1306
1306
|
functionName: "signalIntent",
|
|
@@ -1310,7 +1310,7 @@ var IntentOperations = class {
|
|
|
1310
1310
|
);
|
|
1311
1311
|
return {
|
|
1312
1312
|
to: orchestratorContext.address,
|
|
1313
|
-
data,
|
|
1313
|
+
data: data3,
|
|
1314
1314
|
value: 0n,
|
|
1315
1315
|
chainId: this.config.getChainId(),
|
|
1316
1316
|
abi: orchestratorContext.abi,
|
|
@@ -1325,7 +1325,7 @@ var IntentOperations = class {
|
|
|
1325
1325
|
});
|
|
1326
1326
|
const args = [params.intentHash];
|
|
1327
1327
|
const { referrer } = params.txOverrides ?? {};
|
|
1328
|
-
const
|
|
1328
|
+
const data3 = encodeWithAttribution(
|
|
1329
1329
|
{
|
|
1330
1330
|
abi: orchestratorContext.abi,
|
|
1331
1331
|
functionName: "cancelIntent",
|
|
@@ -1335,7 +1335,7 @@ var IntentOperations = class {
|
|
|
1335
1335
|
);
|
|
1336
1336
|
return {
|
|
1337
1337
|
to: orchestratorContext.address,
|
|
1338
|
-
data,
|
|
1338
|
+
data: data3,
|
|
1339
1339
|
value: 0n,
|
|
1340
1340
|
chainId: this.config.getChainId(),
|
|
1341
1341
|
abi: orchestratorContext.abi,
|
|
@@ -1350,7 +1350,7 @@ var IntentOperations = class {
|
|
|
1350
1350
|
});
|
|
1351
1351
|
const args = [params.intentHash];
|
|
1352
1352
|
const { referrer } = params.txOverrides ?? {};
|
|
1353
|
-
const
|
|
1353
|
+
const data3 = encodeWithAttribution(
|
|
1354
1354
|
{
|
|
1355
1355
|
abi: orchestratorContext.abi,
|
|
1356
1356
|
functionName: "releaseFundsToPayer",
|
|
@@ -1360,7 +1360,7 @@ var IntentOperations = class {
|
|
|
1360
1360
|
);
|
|
1361
1361
|
return {
|
|
1362
1362
|
to: orchestratorContext.address,
|
|
1363
|
-
data,
|
|
1363
|
+
data: data3,
|
|
1364
1364
|
value: 0n,
|
|
1365
1365
|
chainId: this.config.getChainId(),
|
|
1366
1366
|
abi: orchestratorContext.abi,
|
|
@@ -1524,7 +1524,7 @@ var IntentOperations = class {
|
|
|
1524
1524
|
}
|
|
1525
1525
|
];
|
|
1526
1526
|
const { referrer } = params.txOverrides ?? {};
|
|
1527
|
-
const
|
|
1527
|
+
const data3 = encodeWithAttribution(
|
|
1528
1528
|
{
|
|
1529
1529
|
abi: orchestratorContext.abi,
|
|
1530
1530
|
functionName: "fulfillIntent",
|
|
@@ -1534,7 +1534,7 @@ var IntentOperations = class {
|
|
|
1534
1534
|
);
|
|
1535
1535
|
return {
|
|
1536
1536
|
to: orchestratorContext.address,
|
|
1537
|
-
data,
|
|
1537
|
+
data: data3,
|
|
1538
1538
|
value: 0n,
|
|
1539
1539
|
chainId: this.config.getChainId(),
|
|
1540
1540
|
abi: orchestratorContext.abi,
|
|
@@ -1898,7 +1898,7 @@ var ProtocolViewerReader = class {
|
|
|
1898
1898
|
if (inputCount === null) {
|
|
1899
1899
|
throw new Error("Configured ProtocolViewer ABI does not expose getDeposit");
|
|
1900
1900
|
}
|
|
1901
|
-
const { parseDepositView: parseDepositView2 } = await import('./protocolViewerParsers-
|
|
1901
|
+
const { parseDepositView: parseDepositView2 } = await import('./protocolViewerParsers-QE6LWS3W.mjs');
|
|
1902
1902
|
if (inputCount >= 3) {
|
|
1903
1903
|
return tryContexts(
|
|
1904
1904
|
protocolViewerContexts,
|
|
@@ -1984,7 +1984,7 @@ var ProtocolViewerReader = class {
|
|
|
1984
1984
|
return Promise.all(ids.map((id) => this.config.host.getPvDepositById(id)));
|
|
1985
1985
|
}
|
|
1986
1986
|
const bn = ids.map((id) => typeof id === "bigint" ? id : parseRawDepositId(id));
|
|
1987
|
-
const { parseDepositView: parseDepositView2 } = await import('./protocolViewerParsers-
|
|
1987
|
+
const { parseDepositView: parseDepositView2 } = await import('./protocolViewerParsers-QE6LWS3W.mjs');
|
|
1988
1988
|
if (inputCount >= 2) {
|
|
1989
1989
|
const requests = ids.map((id, index) => ({
|
|
1990
1990
|
index,
|
|
@@ -2089,7 +2089,7 @@ var ProtocolViewerReader = class {
|
|
|
2089
2089
|
if (!protocolViewerAddress || !protocolViewerAbi || inputCount === null) {
|
|
2090
2090
|
return this.config.host.getPvAccountDepositsFromIndexer(owner);
|
|
2091
2091
|
}
|
|
2092
|
-
const { parseDepositView: parseDepositView2 } = await import('./protocolViewerParsers-
|
|
2092
|
+
const { parseDepositView: parseDepositView2 } = await import('./protocolViewerParsers-QE6LWS3W.mjs');
|
|
2093
2093
|
const { address, abi } = this.config.host.requireProtocolViewer();
|
|
2094
2094
|
if (inputCount >= 2) {
|
|
2095
2095
|
const readAndFilter = async (raw2) => {
|
|
@@ -2160,7 +2160,7 @@ var ProtocolViewerReader = class {
|
|
|
2160
2160
|
if (protocolViewerEntries.length === 0) {
|
|
2161
2161
|
throw new Error("ProtocolViewer not available for this network");
|
|
2162
2162
|
}
|
|
2163
|
-
const { parseIntentView: parseIntentView2 } = await import('./protocolViewerParsers-
|
|
2163
|
+
const { parseIntentView: parseIntentView2 } = await import('./protocolViewerParsers-QE6LWS3W.mjs');
|
|
2164
2164
|
const intentsByHash = /* @__PURE__ */ new Map();
|
|
2165
2165
|
let attemptedRead = false;
|
|
2166
2166
|
let hadSuccessfulRead = false;
|
|
@@ -2268,7 +2268,7 @@ var ProtocolViewerReader = class {
|
|
|
2268
2268
|
if (protocolViewerEntries.length === 0) {
|
|
2269
2269
|
throw new Error("ProtocolViewer not available for this network");
|
|
2270
2270
|
}
|
|
2271
|
-
const { parseIntentView: parseIntentView2 } = await import('./protocolViewerParsers-
|
|
2271
|
+
const { parseIntentView: parseIntentView2 } = await import('./protocolViewerParsers-QE6LWS3W.mjs');
|
|
2272
2272
|
let lastError;
|
|
2273
2273
|
for (const pvEntry of protocolViewerEntries) {
|
|
2274
2274
|
const inputCount = this.pvEntryFunctionInputCount(pvEntry, "getIntent");
|
|
@@ -3603,7 +3603,7 @@ var STAKING_STATE_QUERY = (
|
|
|
3603
3603
|
updatedAtBlockNumber
|
|
3604
3604
|
updatedAt
|
|
3605
3605
|
}
|
|
3606
|
-
|
|
3606
|
+
DisputeProtectionRiskWindow(
|
|
3607
3607
|
where: { chainId: { _eq: $chainId }, policyAddress: { _eq: $policy } }
|
|
3608
3608
|
order_by: { paymentMethod: asc }
|
|
3609
3609
|
) {
|
|
@@ -3618,6 +3618,107 @@ var STAKING_STATE_QUERY = (
|
|
|
3618
3618
|
updatedAtBlockNumber
|
|
3619
3619
|
updatedAt
|
|
3620
3620
|
}
|
|
3621
|
+
chain_metadata(where: { chain_id: { _eq: $chainId } }, limit: 1) {
|
|
3622
|
+
chain_id
|
|
3623
|
+
latest_processed_block
|
|
3624
|
+
}
|
|
3625
|
+
}
|
|
3626
|
+
`
|
|
3627
|
+
);
|
|
3628
|
+
var STAKE_LOCKS_QUERY = (
|
|
3629
|
+
/* GraphQL */
|
|
3630
|
+
`
|
|
3631
|
+
query StakeLocks($where: StakeLock_bool_exp!, $limit: Int!) {
|
|
3632
|
+
StakeLock(where: $where, order_by: [{ id: asc }], limit: $limit) {
|
|
3633
|
+
id
|
|
3634
|
+
chainId
|
|
3635
|
+
vaultAddress
|
|
3636
|
+
lockId
|
|
3637
|
+
stakeOwner
|
|
3638
|
+
initialAmount
|
|
3639
|
+
currentAmount
|
|
3640
|
+
maturesAt
|
|
3641
|
+
status
|
|
3642
|
+
unlockedAmount
|
|
3643
|
+
claimedAmount
|
|
3644
|
+
createdAt
|
|
3645
|
+
updatedAtBlockNumber
|
|
3646
|
+
updatedAt
|
|
3647
|
+
}
|
|
3648
|
+
}
|
|
3649
|
+
`
|
|
3650
|
+
);
|
|
3651
|
+
var STAKE_ACTIVITY_QUERY = (
|
|
3652
|
+
/* GraphQL */
|
|
3653
|
+
`
|
|
3654
|
+
query StakeActivityPage($where: StakeActivity_bool_exp!, $limit: Int!) {
|
|
3655
|
+
StakeActivity(
|
|
3656
|
+
where: $where
|
|
3657
|
+
order_by: [{ blockNumber: asc }, { logIndex: asc }, { id: asc }]
|
|
3658
|
+
limit: $limit
|
|
3659
|
+
) {
|
|
3660
|
+
id
|
|
3661
|
+
chainId
|
|
3662
|
+
vaultAddress
|
|
3663
|
+
stakeOwner
|
|
3664
|
+
taker
|
|
3665
|
+
beneficiary
|
|
3666
|
+
kind
|
|
3667
|
+
lockId
|
|
3668
|
+
counterparty
|
|
3669
|
+
amount
|
|
3670
|
+
previousAmount
|
|
3671
|
+
stakeBalanceAfter
|
|
3672
|
+
lockedStakeAfter
|
|
3673
|
+
freeStakeAfter
|
|
3674
|
+
claimableAfter
|
|
3675
|
+
maturesAt
|
|
3676
|
+
blockNumber
|
|
3677
|
+
logIndex
|
|
3678
|
+
timestamp
|
|
3679
|
+
}
|
|
3680
|
+
}
|
|
3681
|
+
`
|
|
3682
|
+
);
|
|
3683
|
+
var DISPUTE_PROTECTION_INTENTS_QUERY = (
|
|
3684
|
+
/* GraphQL */
|
|
3685
|
+
`
|
|
3686
|
+
query FinalizedDisputeProtectionIntents($where: DisputeProtectionIntent_bool_exp!, $limit: Int!) {
|
|
3687
|
+
DisputeProtectionIntent(
|
|
3688
|
+
where: $where
|
|
3689
|
+
order_by: [{ disputedAtBlockNumber: asc }, { disputedAtLogIndex: asc }, { id: asc }]
|
|
3690
|
+
limit: $limit
|
|
3691
|
+
) {
|
|
3692
|
+
id
|
|
3693
|
+
chainId
|
|
3694
|
+
policyAddress
|
|
3695
|
+
intentHash
|
|
3696
|
+
status
|
|
3697
|
+
stakeOwner
|
|
3698
|
+
depositor
|
|
3699
|
+
taker
|
|
3700
|
+
paymentMethod
|
|
3701
|
+
amount
|
|
3702
|
+
riskWindow
|
|
3703
|
+
releaseEligibleAt
|
|
3704
|
+
releaseAmount
|
|
3705
|
+
isManualRelease
|
|
3706
|
+
compensatedAmount
|
|
3707
|
+
disputeId
|
|
3708
|
+
openedAt
|
|
3709
|
+
openedTxHash
|
|
3710
|
+
cancelledAt
|
|
3711
|
+
cancelledTxHash
|
|
3712
|
+
settledAt
|
|
3713
|
+
settledTxHash
|
|
3714
|
+
releasedAt
|
|
3715
|
+
releasedTxHash
|
|
3716
|
+
disputedAt
|
|
3717
|
+
disputedTxHash
|
|
3718
|
+
disputedAtBlockNumber
|
|
3719
|
+
disputedAtLogIndex
|
|
3720
|
+
updatedAt
|
|
3721
|
+
}
|
|
3621
3722
|
}
|
|
3622
3723
|
`
|
|
3623
3724
|
);
|
|
@@ -4527,19 +4628,19 @@ async function apiGetPayeeDetails(req, baseApiUrl, timeoutMs) {
|
|
|
4527
4628
|
});
|
|
4528
4629
|
}
|
|
4529
4630
|
async function apiValidatePayeeDetails(req, baseApiUrl, timeoutMs) {
|
|
4530
|
-
const
|
|
4631
|
+
const data3 = await apiFetch({
|
|
4531
4632
|
url: `${withApiBase(baseApiUrl)}/v2/makers/validate`,
|
|
4532
4633
|
method: "POST",
|
|
4533
4634
|
body: req,
|
|
4534
4635
|
timeoutMs
|
|
4535
4636
|
});
|
|
4536
|
-
if (typeof
|
|
4637
|
+
if (typeof data3?.responseObject === "boolean") {
|
|
4537
4638
|
return {
|
|
4538
|
-
...
|
|
4539
|
-
responseObject: { isValid:
|
|
4639
|
+
...data3,
|
|
4640
|
+
responseObject: { isValid: data3.responseObject }
|
|
4540
4641
|
};
|
|
4541
4642
|
}
|
|
4542
|
-
return
|
|
4643
|
+
return data3;
|
|
4543
4644
|
}
|
|
4544
4645
|
async function apiGetOwnerDeposits(req, apiKey, baseApiUrl, authToken, timeoutMs) {
|
|
4545
4646
|
const escrowAddress = requireEscrowAddress(
|
|
@@ -4749,6 +4850,9 @@ function resolveSignalableEscrow(chainId, runtimeEnv) {
|
|
|
4749
4850
|
return void 0;
|
|
4750
4851
|
}
|
|
4751
4852
|
}
|
|
4853
|
+
function hasDisputeProtectionFields(row) {
|
|
4854
|
+
return typeof row.disputeProtectionOptedIn === "boolean" && typeof row.disputeProtectionRequiresStake === "boolean";
|
|
4855
|
+
}
|
|
4752
4856
|
function isSignalableEscrowRow(rowEscrowAddress, signalableEscrow) {
|
|
4753
4857
|
if (!signalableEscrow) return true;
|
|
4754
4858
|
if (!rowEscrowAddress) return true;
|
|
@@ -4775,7 +4879,7 @@ async function apiGetOrderbookTable(params, optsOrBaseApiUrl, timeoutMs) {
|
|
|
4775
4879
|
return {
|
|
4776
4880
|
...responseObject,
|
|
4777
4881
|
rows: responseObject.rows.filter(
|
|
4778
|
-
(row) => matchesPaymentMethodNameAndHash(row.paymentPlatform, row.paymentMethodHash) && isSignalableEscrowRow(row.escrowAddress, signalableEscrow)
|
|
4882
|
+
(row) => hasDisputeProtectionFields(row) && matchesPaymentMethodNameAndHash(row.paymentPlatform, row.paymentMethodHash) && isSignalableEscrowRow(row.escrowAddress, signalableEscrow)
|
|
4779
4883
|
)
|
|
4780
4884
|
};
|
|
4781
4885
|
}
|
|
@@ -5529,10 +5633,10 @@ var StakeOperations = class {
|
|
|
5529
5633
|
return { address, abi, stakeToken };
|
|
5530
5634
|
}
|
|
5531
5635
|
getPolicyContract() {
|
|
5532
|
-
const address = this.config.
|
|
5533
|
-
const abi = this.config.
|
|
5636
|
+
const address = this.config.getDisputeProtectionPolicyAddress();
|
|
5637
|
+
const abi = this.config.getDisputeProtectionPolicyAbi();
|
|
5534
5638
|
if (!address || !abi) {
|
|
5535
|
-
throw new Error("
|
|
5639
|
+
throw new Error("DisputeProtectionPolicy not available for this chain/environment");
|
|
5536
5640
|
}
|
|
5537
5641
|
return { address, abi };
|
|
5538
5642
|
}
|
|
@@ -5575,7 +5679,7 @@ var StakeOperations = class {
|
|
|
5575
5679
|
getTakerAuthorization(stakeOwner, taker) {
|
|
5576
5680
|
return this.read("authorizedTakers", [stakeOwner, taker]);
|
|
5577
5681
|
}
|
|
5578
|
-
/** Whether the policy is refusing new
|
|
5682
|
+
/** Whether the policy is refusing new dispute-protected admissions. */
|
|
5579
5683
|
getAdmissionsPaused() {
|
|
5580
5684
|
return this.readPolicy("admissionsPaused");
|
|
5581
5685
|
}
|
|
@@ -5586,9 +5690,9 @@ var StakeOperations = class {
|
|
|
5586
5690
|
getRiskWindow(paymentMethodHash) {
|
|
5587
5691
|
return this.readPolicy("getRiskWindow", [paymentMethodHash]);
|
|
5588
5692
|
}
|
|
5589
|
-
/** Whether a specific escrow deposit has opted into
|
|
5590
|
-
|
|
5591
|
-
return this.readPolicy("
|
|
5693
|
+
/** Whether a specific escrow deposit has opted into dispute protection. */
|
|
5694
|
+
isDisputeProtectionEnabled(escrow, depositId) {
|
|
5695
|
+
return this.readPolicy("isDisputeProtectionEnabled", [escrow, depositId]);
|
|
5592
5696
|
}
|
|
5593
5697
|
async getStakeVaultState(params) {
|
|
5594
5698
|
const taker = params.taker ?? params.staker;
|
|
@@ -6338,6 +6442,8 @@ var IndexerRateManagerService = class {
|
|
|
6338
6442
|
}
|
|
6339
6443
|
}
|
|
6340
6444
|
};
|
|
6445
|
+
var DEFAULT_PAGE_LIMIT = 50;
|
|
6446
|
+
var MAX_PAGE_LIMIT = 100;
|
|
6341
6447
|
var ZERO_STAKE = {
|
|
6342
6448
|
totalUsdc: "0",
|
|
6343
6449
|
lockedUsdc: "0",
|
|
@@ -6358,6 +6464,262 @@ function normalizeDecimal(value, field) {
|
|
|
6358
6464
|
}
|
|
6359
6465
|
return value;
|
|
6360
6466
|
}
|
|
6467
|
+
function normalizeOptionalDecimal(value, field) {
|
|
6468
|
+
return value === null || value === void 0 ? null : normalizeDecimal(value, field);
|
|
6469
|
+
}
|
|
6470
|
+
function validateChainId(chainId) {
|
|
6471
|
+
if (!Number.isInteger(chainId) || chainId <= 0) {
|
|
6472
|
+
throw new ValidationError("chainId must be a positive integer", "chainId");
|
|
6473
|
+
}
|
|
6474
|
+
}
|
|
6475
|
+
function validateLimit(limit) {
|
|
6476
|
+
const resolved = limit ?? DEFAULT_PAGE_LIMIT;
|
|
6477
|
+
if (!Number.isInteger(resolved) || resolved < 1 || resolved > MAX_PAGE_LIMIT) {
|
|
6478
|
+
throw new ValidationError("limit must be an integer from 1 to 100", "limit");
|
|
6479
|
+
}
|
|
6480
|
+
return resolved;
|
|
6481
|
+
}
|
|
6482
|
+
function encodeCursor(prefix, value) {
|
|
6483
|
+
const encoded = btoa(JSON.stringify(value)).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
6484
|
+
return `${prefix}.${encoded}`;
|
|
6485
|
+
}
|
|
6486
|
+
function decodeCursor(cursor, prefix, validate) {
|
|
6487
|
+
try {
|
|
6488
|
+
const encoded = cursor.slice(prefix.length + 1).replace(/-/g, "+").replace(/_/g, "/");
|
|
6489
|
+
const padded = encoded.padEnd(Math.ceil(encoded.length / 4) * 4, "=");
|
|
6490
|
+
if (!cursor.startsWith(`${prefix}.`) || encoded.length === 0) {
|
|
6491
|
+
throw new Error("wrong cursor kind");
|
|
6492
|
+
}
|
|
6493
|
+
return validate(JSON.parse(atob(padded)));
|
|
6494
|
+
} catch {
|
|
6495
|
+
throw new ValidationError(`cursor must be a valid ${prefix} cursor`, "cursor");
|
|
6496
|
+
}
|
|
6497
|
+
}
|
|
6498
|
+
function decodeLockCursor(cursor) {
|
|
6499
|
+
return decodeCursor(cursor, "zkp2p-lock-v1", (value) => {
|
|
6500
|
+
if (typeof value !== "object" || value === null || typeof Reflect.get(value, "id") !== "string") {
|
|
6501
|
+
throw new Error("invalid lock cursor");
|
|
6502
|
+
}
|
|
6503
|
+
const id = Reflect.get(value, "id");
|
|
6504
|
+
if (id.length === 0) throw new Error("invalid lock cursor");
|
|
6505
|
+
return id;
|
|
6506
|
+
});
|
|
6507
|
+
}
|
|
6508
|
+
function decodeEventCursor(cursor, prefix) {
|
|
6509
|
+
return decodeCursor(cursor, prefix, (value) => {
|
|
6510
|
+
if (typeof value !== "object" || value === null) throw new Error("invalid event cursor");
|
|
6511
|
+
const blockNumber = Reflect.get(value, "blockNumber");
|
|
6512
|
+
const logIndex = Reflect.get(value, "logIndex");
|
|
6513
|
+
const id = Reflect.get(value, "id");
|
|
6514
|
+
if (typeof blockNumber !== "string" || typeof logIndex !== "string" || typeof id !== "string") {
|
|
6515
|
+
throw new Error("invalid event cursor");
|
|
6516
|
+
}
|
|
6517
|
+
if (id.length === 0) throw new Error("invalid event cursor");
|
|
6518
|
+
return {
|
|
6519
|
+
blockNumber: normalizeDecimal(blockNumber, "cursor.blockNumber"),
|
|
6520
|
+
logIndex: normalizeDecimal(logIndex, "cursor.logIndex"),
|
|
6521
|
+
id
|
|
6522
|
+
};
|
|
6523
|
+
});
|
|
6524
|
+
}
|
|
6525
|
+
function compareEventCursor(left, right) {
|
|
6526
|
+
const leftBlock = BigInt(left.blockNumber);
|
|
6527
|
+
const rightBlock = BigInt(right.blockNumber);
|
|
6528
|
+
if (leftBlock !== rightBlock) return leftBlock < rightBlock ? -1 : 1;
|
|
6529
|
+
const leftLog = BigInt(left.logIndex);
|
|
6530
|
+
const rightLog = BigInt(right.logIndex);
|
|
6531
|
+
if (leftLog !== rightLog) return leftLog < rightLog ? -1 : 1;
|
|
6532
|
+
return left.id === right.id ? 0 : left.id < right.id ? -1 : 1;
|
|
6533
|
+
}
|
|
6534
|
+
function eventKeysetPredicate(cursor, blockField, logField) {
|
|
6535
|
+
return {
|
|
6536
|
+
_or: [
|
|
6537
|
+
{ [blockField]: { _gt: cursor.blockNumber } },
|
|
6538
|
+
{
|
|
6539
|
+
_and: [
|
|
6540
|
+
{ [blockField]: { _eq: cursor.blockNumber } },
|
|
6541
|
+
{ [logField]: { _gt: cursor.logIndex } }
|
|
6542
|
+
]
|
|
6543
|
+
},
|
|
6544
|
+
{
|
|
6545
|
+
_and: [
|
|
6546
|
+
{ [blockField]: { _eq: cursor.blockNumber } },
|
|
6547
|
+
{ [logField]: { _eq: cursor.logIndex } },
|
|
6548
|
+
{ id: { _gt: cursor.id } }
|
|
6549
|
+
]
|
|
6550
|
+
}
|
|
6551
|
+
]
|
|
6552
|
+
};
|
|
6553
|
+
}
|
|
6554
|
+
var STAKE_LOCK_STATUSES = /* @__PURE__ */ new Set(["ACTIVE", "UNLOCKED", "RESOLVED"]);
|
|
6555
|
+
var STAKE_ACTIVITY_KINDS = /* @__PURE__ */ new Set([
|
|
6556
|
+
"DEPOSITED",
|
|
6557
|
+
"WITHDRAWN",
|
|
6558
|
+
"TAKER_AUTHORIZATION_UPDATED",
|
|
6559
|
+
"STAKE_OWNER_SELECTED",
|
|
6560
|
+
"LOCK_FUNDED",
|
|
6561
|
+
"STAKE_LOCKED",
|
|
6562
|
+
"STAKE_LOCK_INCREASED",
|
|
6563
|
+
"STAKE_LOCK_RESIZED",
|
|
6564
|
+
"STAKE_UNLOCKED",
|
|
6565
|
+
"STAKE_LOCK_RESOLVED",
|
|
6566
|
+
"CLAIM_CREATED",
|
|
6567
|
+
"CLAIM_WITHDRAWN"
|
|
6568
|
+
]);
|
|
6569
|
+
function normalizeLockStatus(value, field) {
|
|
6570
|
+
if (!STAKE_LOCK_STATUSES.has(value)) {
|
|
6571
|
+
throw new Error(`${field} is not a supported stake lock status`);
|
|
6572
|
+
}
|
|
6573
|
+
return value;
|
|
6574
|
+
}
|
|
6575
|
+
function normalizeActivityKind(value, field) {
|
|
6576
|
+
if (!STAKE_ACTIVITY_KINDS.has(value)) {
|
|
6577
|
+
throw new Error(`${field} is not a supported stake activity kind`);
|
|
6578
|
+
}
|
|
6579
|
+
return value;
|
|
6580
|
+
}
|
|
6581
|
+
function latestLockAsOf(items) {
|
|
6582
|
+
if (items.length === 0) return null;
|
|
6583
|
+
const latest = items.reduce(
|
|
6584
|
+
(current, item) => BigInt(item.updatedAtBlockNumber) > BigInt(current.updatedAtBlockNumber) ? item : current
|
|
6585
|
+
);
|
|
6586
|
+
return { blockNumber: latest.updatedAtBlockNumber, timestamp: latest.updatedAt };
|
|
6587
|
+
}
|
|
6588
|
+
function assertNonEmptyId(id, field) {
|
|
6589
|
+
if (id.length === 0) throw new Error(`${field} must not be empty`);
|
|
6590
|
+
return id;
|
|
6591
|
+
}
|
|
6592
|
+
function normalizeStakeLockRow(row, index, scope) {
|
|
6593
|
+
const field = `StakeLock[${index}]`;
|
|
6594
|
+
if (row.chainId !== scope.chainId) throw new Error(`${field}.chainId does not match the query`);
|
|
6595
|
+
if (normalizeAddress4(row.vaultAddress, `${field}.vaultAddress`) !== scope.vaultAddress) {
|
|
6596
|
+
throw new Error(`${field}.vaultAddress does not match the query`);
|
|
6597
|
+
}
|
|
6598
|
+
const stakeOwner = normalizeAddress4(row.stakeOwner, `${field}.stakeOwner`);
|
|
6599
|
+
if (stakeOwner !== scope.stakeOwner) {
|
|
6600
|
+
throw new Error(`${field}.stakeOwner does not match the query`);
|
|
6601
|
+
}
|
|
6602
|
+
const status = normalizeLockStatus(row.status, `${field}.status`);
|
|
6603
|
+
if (scope.status && status !== scope.status) {
|
|
6604
|
+
throw new Error(`${field}.status does not match the query`);
|
|
6605
|
+
}
|
|
6606
|
+
return {
|
|
6607
|
+
lockId: assertNonEmptyId(row.lockId, `${field}.lockId`),
|
|
6608
|
+
stakeOwner,
|
|
6609
|
+
initialAmount: normalizeDecimal(row.initialAmount, `${field}.initialAmount`),
|
|
6610
|
+
currentAmount: normalizeDecimal(row.currentAmount, `${field}.currentAmount`),
|
|
6611
|
+
maturesAt: normalizeDecimal(row.maturesAt, `${field}.maturesAt`),
|
|
6612
|
+
status,
|
|
6613
|
+
unlockedAmount: normalizeDecimal(row.unlockedAmount, `${field}.unlockedAmount`),
|
|
6614
|
+
claimedAmount: normalizeDecimal(row.claimedAmount, `${field}.claimedAmount`),
|
|
6615
|
+
createdAt: normalizeDecimal(row.createdAt, `${field}.createdAt`),
|
|
6616
|
+
updatedAtBlockNumber: normalizeDecimal(
|
|
6617
|
+
row.updatedAtBlockNumber,
|
|
6618
|
+
`${field}.updatedAtBlockNumber`
|
|
6619
|
+
),
|
|
6620
|
+
updatedAt: normalizeDecimal(row.updatedAt, `${field}.updatedAt`)
|
|
6621
|
+
};
|
|
6622
|
+
}
|
|
6623
|
+
function normalizeStakeActivityRow(row, index, scope) {
|
|
6624
|
+
const field = `StakeActivity[${index}]`;
|
|
6625
|
+
if (row.chainId !== scope.chainId) throw new Error(`${field}.chainId does not match the query`);
|
|
6626
|
+
if (normalizeAddress4(row.vaultAddress, `${field}.vaultAddress`) !== scope.vaultAddress) {
|
|
6627
|
+
throw new Error(`${field}.vaultAddress does not match the query`);
|
|
6628
|
+
}
|
|
6629
|
+
const stakeOwner = normalizeNullableAddress(row.stakeOwner, `${field}.stakeOwner`);
|
|
6630
|
+
const taker = normalizeNullableAddress(row.taker, `${field}.taker`);
|
|
6631
|
+
if (stakeOwner !== scope.merchant && taker !== scope.merchant) {
|
|
6632
|
+
throw new Error(`${field} is not relevant to the requested merchant`);
|
|
6633
|
+
}
|
|
6634
|
+
const kind = normalizeActivityKind(row.kind, `${field}.kind`);
|
|
6635
|
+
if (scope.kind && kind !== scope.kind) {
|
|
6636
|
+
throw new Error(`${field}.kind does not match the query`);
|
|
6637
|
+
}
|
|
6638
|
+
const blockNumber = normalizeDecimal(row.blockNumber, `${field}.blockNumber`);
|
|
6639
|
+
const logIndex = normalizeDecimal(row.logIndex, `${field}.logIndex`);
|
|
6640
|
+
const id = assertNonEmptyId(row.id, `${field}.id`);
|
|
6641
|
+
return {
|
|
6642
|
+
item: {
|
|
6643
|
+
stakeOwner,
|
|
6644
|
+
taker,
|
|
6645
|
+
beneficiary: normalizeNullableAddress(row.beneficiary, `${field}.beneficiary`),
|
|
6646
|
+
kind,
|
|
6647
|
+
lockId: row.lockId ?? null,
|
|
6648
|
+
counterparty: normalizeNullableAddress(row.counterparty, `${field}.counterparty`),
|
|
6649
|
+
amount: normalizeDecimal(row.amount, `${field}.amount`),
|
|
6650
|
+
previousAmount: normalizeOptionalDecimal(row.previousAmount, `${field}.previousAmount`),
|
|
6651
|
+
stakeBalanceAfter: normalizeOptionalDecimal(
|
|
6652
|
+
row.stakeBalanceAfter,
|
|
6653
|
+
`${field}.stakeBalanceAfter`
|
|
6654
|
+
),
|
|
6655
|
+
lockedStakeAfter: normalizeOptionalDecimal(row.lockedStakeAfter, `${field}.lockedStakeAfter`),
|
|
6656
|
+
freeStakeAfter: normalizeOptionalDecimal(row.freeStakeAfter, `${field}.freeStakeAfter`),
|
|
6657
|
+
claimableAfter: normalizeOptionalDecimal(row.claimableAfter, `${field}.claimableAfter`),
|
|
6658
|
+
maturesAt: normalizeOptionalDecimal(row.maturesAt, `${field}.maturesAt`),
|
|
6659
|
+
blockNumber,
|
|
6660
|
+
logIndex,
|
|
6661
|
+
timestamp: normalizeDecimal(row.timestamp, `${field}.timestamp`)
|
|
6662
|
+
},
|
|
6663
|
+
cursor: { blockNumber, logIndex, id }
|
|
6664
|
+
};
|
|
6665
|
+
}
|
|
6666
|
+
function normalizeDisputeRow(row, index, scope) {
|
|
6667
|
+
const field = `DisputeProtectionIntent[${index}]`;
|
|
6668
|
+
if (row.chainId !== scope.chainId) throw new Error(`${field}.chainId does not match the query`);
|
|
6669
|
+
const policyAddress = normalizeAddress4(row.policyAddress, `${field}.policyAddress`);
|
|
6670
|
+
if (policyAddress !== scope.policyAddress) {
|
|
6671
|
+
throw new Error(`${field}.policyAddress does not match the query`);
|
|
6672
|
+
}
|
|
6673
|
+
if (row.status !== "DISPUTED") throw new Error(`${field}.status must be DISPUTED`);
|
|
6674
|
+
if (row.disputedAtBlockNumber === null || row.disputedAtBlockNumber === void 0 || row.disputedAtLogIndex === null || row.disputedAtLogIndex === void 0 || row.disputedAt === null || row.disputedAt === void 0 || row.disputedTxHash === null || row.disputedTxHash === void 0) {
|
|
6675
|
+
throw new Error(`${field} DISPUTED row must include its finalized event cursor`);
|
|
6676
|
+
}
|
|
6677
|
+
const blockNumber = normalizeDecimal(row.disputedAtBlockNumber, `${field}.disputedAtBlockNumber`);
|
|
6678
|
+
if (BigInt(blockNumber) > BigInt(scope.throughBlockNumber)) {
|
|
6679
|
+
throw new Error(`${field}.disputedAtBlockNumber exceeds throughBlockNumber`);
|
|
6680
|
+
}
|
|
6681
|
+
const logIndex = normalizeDecimal(row.disputedAtLogIndex, `${field}.disputedAtLogIndex`);
|
|
6682
|
+
const disputedAt = normalizeDecimal(row.disputedAt, `${field}.disputedAt`);
|
|
6683
|
+
const id = assertNonEmptyId(row.id, `${field}.id`);
|
|
6684
|
+
return {
|
|
6685
|
+
item: {
|
|
6686
|
+
policyAddress,
|
|
6687
|
+
intentHash: row.intentHash,
|
|
6688
|
+
status: "DISPUTED",
|
|
6689
|
+
stakeOwner: normalizeAddress4(row.stakeOwner, `${field}.stakeOwner`),
|
|
6690
|
+
depositor: normalizeAddress4(row.depositor, `${field}.depositor`),
|
|
6691
|
+
taker: normalizeAddress4(row.taker, `${field}.taker`),
|
|
6692
|
+
paymentMethod: row.paymentMethod,
|
|
6693
|
+
amount: normalizeDecimal(row.amount, `${field}.amount`),
|
|
6694
|
+
riskWindow: normalizeDecimal(row.riskWindow, `${field}.riskWindow`),
|
|
6695
|
+
releaseEligibleAt: normalizeOptionalDecimal(
|
|
6696
|
+
row.releaseEligibleAt,
|
|
6697
|
+
`${field}.releaseEligibleAt`
|
|
6698
|
+
),
|
|
6699
|
+
releaseAmount: normalizeOptionalDecimal(row.releaseAmount, `${field}.releaseAmount`),
|
|
6700
|
+
isManualRelease: row.isManualRelease ?? null,
|
|
6701
|
+
compensatedAmount: normalizeOptionalDecimal(
|
|
6702
|
+
row.compensatedAmount,
|
|
6703
|
+
`${field}.compensatedAmount`
|
|
6704
|
+
),
|
|
6705
|
+
disputeId: row.disputeId ?? null,
|
|
6706
|
+
openedAt: normalizeDecimal(row.openedAt, `${field}.openedAt`),
|
|
6707
|
+
openedTxHash: row.openedTxHash,
|
|
6708
|
+
cancelledAt: normalizeOptionalDecimal(row.cancelledAt, `${field}.cancelledAt`),
|
|
6709
|
+
cancelledTxHash: row.cancelledTxHash ?? null,
|
|
6710
|
+
settledAt: normalizeOptionalDecimal(row.settledAt, `${field}.settledAt`),
|
|
6711
|
+
settledTxHash: row.settledTxHash ?? null,
|
|
6712
|
+
releasedAt: normalizeOptionalDecimal(row.releasedAt, `${field}.releasedAt`),
|
|
6713
|
+
releasedTxHash: row.releasedTxHash ?? null,
|
|
6714
|
+
disputedAt,
|
|
6715
|
+
disputedTxHash: row.disputedTxHash,
|
|
6716
|
+
disputedAtBlockNumber: blockNumber,
|
|
6717
|
+
disputedAtLogIndex: logIndex,
|
|
6718
|
+
updatedAt: normalizeDecimal(row.updatedAt, `${field}.updatedAt`)
|
|
6719
|
+
},
|
|
6720
|
+
cursor: { blockNumber, logIndex, id }
|
|
6721
|
+
};
|
|
6722
|
+
}
|
|
6361
6723
|
function freshnessOf(row, field) {
|
|
6362
6724
|
if (!row) return null;
|
|
6363
6725
|
return {
|
|
@@ -6368,19 +6730,25 @@ function freshnessOf(row, field) {
|
|
|
6368
6730
|
updatedAt: normalizeDecimal(row.updatedAt, `${field}.updatedAt`)
|
|
6369
6731
|
};
|
|
6370
6732
|
}
|
|
6371
|
-
function
|
|
6372
|
-
const
|
|
6373
|
-
if (
|
|
6374
|
-
|
|
6733
|
+
function indexerHeadBlockNumber(rows, chainId) {
|
|
6734
|
+
const row = rows[0];
|
|
6735
|
+
if (row === void 0) return null;
|
|
6736
|
+
if (row.chain_id !== chainId) {
|
|
6737
|
+
throw new Error("chain_metadata.chain_id does not match the query");
|
|
6738
|
+
}
|
|
6739
|
+
if (!Number.isSafeInteger(row.latest_processed_block) || row.latest_processed_block < 0) {
|
|
6740
|
+
throw new Error("chain_metadata.latest_processed_block must be a non-negative safe integer");
|
|
6741
|
+
}
|
|
6742
|
+
return row.latest_processed_block.toString();
|
|
6375
6743
|
}
|
|
6376
6744
|
function buildStakingEntityIds(params) {
|
|
6377
6745
|
if (!Number.isInteger(params.chainId) || params.chainId <= 0) {
|
|
6378
6746
|
throw new ValidationError("chainId must be a positive integer", "chainId");
|
|
6379
6747
|
}
|
|
6380
6748
|
const vaultAddress = normalizeAddress4(params.vaultAddress, "vaultAddress");
|
|
6381
|
-
const
|
|
6382
|
-
params.
|
|
6383
|
-
"
|
|
6749
|
+
const disputeProtectionPolicyAddress = normalizeAddress4(
|
|
6750
|
+
params.disputeProtectionPolicyAddress,
|
|
6751
|
+
"disputeProtectionPolicyAddress"
|
|
6384
6752
|
);
|
|
6385
6753
|
const taker = normalizeAddress4(params.taker, "taker");
|
|
6386
6754
|
const stakeOwner = normalizeAddress4(params.stakeOwner, "stakeOwner");
|
|
@@ -6389,19 +6757,157 @@ function buildStakingEntityIds(params) {
|
|
|
6389
6757
|
stakeAccountId: `${params.chainId}_${vaultAddress}_${stakeOwner}`,
|
|
6390
6758
|
claimAccountId: `${params.chainId}_${vaultAddress}_${taker}`,
|
|
6391
6759
|
vaultConfigId: `${params.chainId}_${vaultAddress}`,
|
|
6392
|
-
policy:
|
|
6760
|
+
policy: disputeProtectionPolicyAddress
|
|
6393
6761
|
};
|
|
6394
6762
|
}
|
|
6395
6763
|
var IndexerStakingService = class {
|
|
6396
6764
|
constructor(client) {
|
|
6397
6765
|
this.client = client;
|
|
6398
6766
|
}
|
|
6767
|
+
async fetchStakeLocks(params, init) {
|
|
6768
|
+
validateChainId(params.chainId);
|
|
6769
|
+
const limit = validateLimit(params.limit);
|
|
6770
|
+
const vaultAddress = normalizeAddress4(params.vaultAddress, "vaultAddress");
|
|
6771
|
+
const stakeOwner = normalizeAddress4(params.stakeOwner, "stakeOwner");
|
|
6772
|
+
const status = params.status ? normalizeLockStatus(params.status, "status") : void 0;
|
|
6773
|
+
const afterId = params.cursor ? decodeLockCursor(params.cursor) : void 0;
|
|
6774
|
+
const filters = [
|
|
6775
|
+
{ chainId: { _eq: params.chainId } },
|
|
6776
|
+
{ vaultAddress: { _eq: vaultAddress } },
|
|
6777
|
+
{ stakeOwner: { _eq: stakeOwner } }
|
|
6778
|
+
];
|
|
6779
|
+
if (status) filters.push({ status: { _eq: status } });
|
|
6780
|
+
if (afterId) filters.push({ id: { _gt: afterId } });
|
|
6781
|
+
const data3 = await this.client.query(
|
|
6782
|
+
{
|
|
6783
|
+
query: STAKE_LOCKS_QUERY,
|
|
6784
|
+
variables: { limit: limit + 1, where: { _and: filters } }
|
|
6785
|
+
},
|
|
6786
|
+
init
|
|
6787
|
+
);
|
|
6788
|
+
let previousId = afterId;
|
|
6789
|
+
const normalized = data3.StakeLock.map((row, index) => {
|
|
6790
|
+
const id = assertNonEmptyId(row.id, `StakeLock[${index}].id`);
|
|
6791
|
+
if (previousId !== void 0 && id <= previousId) {
|
|
6792
|
+
throw new Error("StakeLock cursor did not advance");
|
|
6793
|
+
}
|
|
6794
|
+
previousId = id;
|
|
6795
|
+
return {
|
|
6796
|
+
item: normalizeStakeLockRow(row, index, {
|
|
6797
|
+
chainId: params.chainId,
|
|
6798
|
+
vaultAddress,
|
|
6799
|
+
stakeOwner,
|
|
6800
|
+
status
|
|
6801
|
+
}),
|
|
6802
|
+
id
|
|
6803
|
+
};
|
|
6804
|
+
});
|
|
6805
|
+
const visible = normalized.slice(0, limit);
|
|
6806
|
+
const items = visible.map(({ item }) => item);
|
|
6807
|
+
return {
|
|
6808
|
+
items,
|
|
6809
|
+
nextCursor: normalized.length > limit ? encodeCursor("zkp2p-lock-v1", { id: visible[visible.length - 1].id }) : null,
|
|
6810
|
+
asOf: latestLockAsOf(items)
|
|
6811
|
+
};
|
|
6812
|
+
}
|
|
6813
|
+
async fetchStakeActivity(params, init) {
|
|
6814
|
+
validateChainId(params.chainId);
|
|
6815
|
+
const limit = validateLimit(params.limit);
|
|
6816
|
+
const vaultAddress = normalizeAddress4(params.vaultAddress, "vaultAddress");
|
|
6817
|
+
const merchant = normalizeAddress4(params.merchant, "merchant");
|
|
6818
|
+
const kind = params.kind ? normalizeActivityKind(params.kind, "kind") : void 0;
|
|
6819
|
+
const after = params.cursor ? decodeEventCursor(params.cursor, "zkp2p-activity-v1") : void 0;
|
|
6820
|
+
const filters = [
|
|
6821
|
+
{ chainId: { _eq: params.chainId } },
|
|
6822
|
+
{ vaultAddress: { _eq: vaultAddress } },
|
|
6823
|
+
{
|
|
6824
|
+
_or: [{ stakeOwner: { _eq: merchant } }, { taker: { _eq: merchant } }]
|
|
6825
|
+
}
|
|
6826
|
+
];
|
|
6827
|
+
if (kind) filters.push({ kind: { _eq: kind } });
|
|
6828
|
+
if (after) filters.push(eventKeysetPredicate(after, "blockNumber", "logIndex"));
|
|
6829
|
+
const data3 = await this.client.query(
|
|
6830
|
+
{
|
|
6831
|
+
query: STAKE_ACTIVITY_QUERY,
|
|
6832
|
+
variables: { limit: limit + 1, where: { _and: filters } }
|
|
6833
|
+
},
|
|
6834
|
+
init
|
|
6835
|
+
);
|
|
6836
|
+
let previous = after;
|
|
6837
|
+
const normalized = data3.StakeActivity.map((row, index) => {
|
|
6838
|
+
const result = normalizeStakeActivityRow(row, index, {
|
|
6839
|
+
chainId: params.chainId,
|
|
6840
|
+
vaultAddress,
|
|
6841
|
+
merchant,
|
|
6842
|
+
kind
|
|
6843
|
+
});
|
|
6844
|
+
if (previous && compareEventCursor(result.cursor, previous) <= 0) {
|
|
6845
|
+
throw new Error("StakeActivity cursor did not advance");
|
|
6846
|
+
}
|
|
6847
|
+
previous = result.cursor;
|
|
6848
|
+
return result;
|
|
6849
|
+
});
|
|
6850
|
+
const visible = normalized.slice(0, limit);
|
|
6851
|
+
const last = visible[visible.length - 1];
|
|
6852
|
+
return {
|
|
6853
|
+
items: visible.map(({ item }) => item),
|
|
6854
|
+
nextCursor: normalized.length > limit && last ? encodeCursor("zkp2p-activity-v1", last.cursor) : null,
|
|
6855
|
+
asOf: last ? { blockNumber: last.item.blockNumber, timestamp: last.item.timestamp } : null
|
|
6856
|
+
};
|
|
6857
|
+
}
|
|
6858
|
+
async fetchDisputeProtectionIntents(params, init) {
|
|
6859
|
+
validateChainId(params.chainId);
|
|
6860
|
+
const limit = validateLimit(params.limit);
|
|
6861
|
+
const policyAddress = normalizeAddress4(params.policyAddress, "policyAddress");
|
|
6862
|
+
const throughBlockNumber = normalizeDecimal(params.throughBlockNumber, "throughBlockNumber");
|
|
6863
|
+
const after = params.cursor ? decodeEventCursor(params.cursor, "zkp2p-dispute-v1") : void 0;
|
|
6864
|
+
if (after && BigInt(after.blockNumber) > BigInt(throughBlockNumber)) {
|
|
6865
|
+
throw new ValidationError("cursor exceeds throughBlockNumber", "cursor");
|
|
6866
|
+
}
|
|
6867
|
+
const filters = [
|
|
6868
|
+
{ chainId: { _eq: params.chainId } },
|
|
6869
|
+
{ policyAddress: { _eq: policyAddress } },
|
|
6870
|
+
{ status: { _eq: "DISPUTED" } },
|
|
6871
|
+
{ disputedAtBlockNumber: { _lte: throughBlockNumber } }
|
|
6872
|
+
];
|
|
6873
|
+
if (after) {
|
|
6874
|
+
filters.push(eventKeysetPredicate(after, "disputedAtBlockNumber", "disputedAtLogIndex"));
|
|
6875
|
+
}
|
|
6876
|
+
const data3 = await this.client.query(
|
|
6877
|
+
{
|
|
6878
|
+
query: DISPUTE_PROTECTION_INTENTS_QUERY,
|
|
6879
|
+
variables: { limit: limit + 1, where: { _and: filters } }
|
|
6880
|
+
},
|
|
6881
|
+
init
|
|
6882
|
+
);
|
|
6883
|
+
let previous = after;
|
|
6884
|
+
const normalized = data3.DisputeProtectionIntent.map((row, index) => {
|
|
6885
|
+
const result = normalizeDisputeRow(row, index, {
|
|
6886
|
+
chainId: params.chainId,
|
|
6887
|
+
policyAddress,
|
|
6888
|
+
throughBlockNumber
|
|
6889
|
+
});
|
|
6890
|
+
if (previous && compareEventCursor(result.cursor, previous) <= 0) {
|
|
6891
|
+
throw new Error("DisputeProtectionIntent cursor did not advance");
|
|
6892
|
+
}
|
|
6893
|
+
previous = result.cursor;
|
|
6894
|
+
return result;
|
|
6895
|
+
});
|
|
6896
|
+
const visible = normalized.slice(0, limit);
|
|
6897
|
+
const last = visible[visible.length - 1];
|
|
6898
|
+
return {
|
|
6899
|
+
items: visible.map(({ item }) => item),
|
|
6900
|
+
nextCursor: normalized.length > limit && last ? encodeCursor("zkp2p-dispute-v1", last.cursor) : null,
|
|
6901
|
+
endCursor: last ? encodeCursor("zkp2p-dispute-v1", last.cursor) : null,
|
|
6902
|
+
asOf: last ? { blockNumber: last.item.disputedAtBlockNumber, timestamp: last.item.disputedAt } : null
|
|
6903
|
+
};
|
|
6904
|
+
}
|
|
6399
6905
|
async fetchStakingState(params, init) {
|
|
6400
6906
|
const ids = buildStakingEntityIds(params);
|
|
6401
6907
|
const vaultAddress = normalizeAddress4(params.vaultAddress, "vaultAddress");
|
|
6402
6908
|
const taker = normalizeAddress4(params.taker, "taker");
|
|
6403
6909
|
const requestedStakeOwner = normalizeAddress4(params.stakeOwner, "stakeOwner");
|
|
6404
|
-
const
|
|
6910
|
+
const data3 = await this.client.query(
|
|
6405
6911
|
{
|
|
6406
6912
|
query: STAKING_STATE_QUERY,
|
|
6407
6913
|
variables: {
|
|
@@ -6413,20 +6919,20 @@ var IndexerStakingService = class {
|
|
|
6413
6919
|
},
|
|
6414
6920
|
init
|
|
6415
6921
|
);
|
|
6416
|
-
const takerState =
|
|
6922
|
+
const takerState = data3.TakerStakeState_by_pk;
|
|
6417
6923
|
const indexedStakeOwner = takerState ? normalizeAddress4(takerState.stakeOwner, "TakerStakeState.stakeOwner") : taker;
|
|
6418
6924
|
const selectedStakeOwner = normalizeNullableAddress(
|
|
6419
6925
|
takerState?.selectedStakeOwner,
|
|
6420
6926
|
"TakerStakeState.selectedStakeOwner"
|
|
6421
6927
|
);
|
|
6422
|
-
const stakeAccount =
|
|
6928
|
+
const stakeAccount = data3.StakeAccountState_by_pk;
|
|
6423
6929
|
const stakeAccountOwner = stakeAccount ? normalizeAddress4(stakeAccount.stakeOwner, "StakeAccountState.stakeOwner") : requestedStakeOwner;
|
|
6424
6930
|
const stakeAccountMatchesEffectiveOwner = requestedStakeOwner === indexedStakeOwner && stakeAccountOwner === indexedStakeOwner;
|
|
6425
|
-
const claimAccount =
|
|
6931
|
+
const claimAccount = data3.ClaimAccountState_by_pk;
|
|
6426
6932
|
if (claimAccount && normalizeAddress4(claimAccount.beneficiary, "ClaimAccountState.beneficiary") !== taker) {
|
|
6427
6933
|
throw new Error("ClaimAccountState beneficiary does not match the requested taker");
|
|
6428
6934
|
}
|
|
6429
|
-
const authorizations =
|
|
6935
|
+
const authorizations = data3.TakerStakeAuthorization.map((authorization, index) => ({
|
|
6430
6936
|
stakeOwner: normalizeAddress4(
|
|
6431
6937
|
authorization.stakeOwner,
|
|
6432
6938
|
`TakerStakeAuthorization[${index}].stakeOwner`
|
|
@@ -6437,18 +6943,18 @@ var IndexerStakingService = class {
|
|
|
6437
6943
|
`TakerStakeAuthorization[${index}]`
|
|
6438
6944
|
)
|
|
6439
6945
|
}));
|
|
6440
|
-
const riskWindows =
|
|
6946
|
+
const riskWindows = data3.DisputeProtectionRiskWindow.map((row, index) => ({
|
|
6441
6947
|
paymentMethod: row.paymentMethod,
|
|
6442
6948
|
riskWindowSeconds: normalizeDecimal(
|
|
6443
6949
|
row.riskWindow,
|
|
6444
|
-
`
|
|
6950
|
+
`DisputeProtectionRiskWindow[${index}].riskWindow`
|
|
6445
6951
|
),
|
|
6446
|
-
updatedAt: normalizeDecimal(row.updatedAt, `
|
|
6952
|
+
updatedAt: normalizeDecimal(row.updatedAt, `DisputeProtectionRiskWindow[${index}].updatedAt`)
|
|
6447
6953
|
}));
|
|
6448
6954
|
const takerFreshness = freshnessOf(takerState, "TakerStakeState");
|
|
6449
6955
|
const stakeFreshness = freshnessOf(stakeAccount, "StakeAccountState");
|
|
6450
6956
|
const claimFreshness = freshnessOf(claimAccount, "ClaimAccountState");
|
|
6451
|
-
const vaultFreshness = freshnessOf(
|
|
6957
|
+
const vaultFreshness = freshnessOf(data3.StakeVaultConfig_by_pk, "StakeVaultConfig");
|
|
6452
6958
|
const authorizationFreshness = authorizations.map((authorization) => authorization.freshness);
|
|
6453
6959
|
return {
|
|
6454
6960
|
chainId: params.chainId,
|
|
@@ -6468,17 +6974,17 @@ var IndexerStakingService = class {
|
|
|
6468
6974
|
claimableUsdc: claimAccount ? normalizeDecimal(claimAccount.claimableAmount, "ClaimAccountState.claimableAmount") : "0",
|
|
6469
6975
|
authorizations,
|
|
6470
6976
|
riskWindows,
|
|
6471
|
-
vault:
|
|
6977
|
+
vault: data3.StakeVaultConfig_by_pk ? {
|
|
6472
6978
|
controller: normalizeNullableAddress(
|
|
6473
|
-
|
|
6979
|
+
data3.StakeVaultConfig_by_pk.controller,
|
|
6474
6980
|
"StakeVaultConfig.controller"
|
|
6475
6981
|
),
|
|
6476
6982
|
pendingController: normalizeNullableAddress(
|
|
6477
|
-
|
|
6983
|
+
data3.StakeVaultConfig_by_pk.pendingController,
|
|
6478
6984
|
"StakeVaultConfig.pendingController"
|
|
6479
6985
|
),
|
|
6480
|
-
pendingControllerValidAt:
|
|
6481
|
-
|
|
6986
|
+
pendingControllerValidAt: data3.StakeVaultConfig_by_pk.pendingControllerValidAt ? normalizeDecimal(
|
|
6987
|
+
data3.StakeVaultConfig_by_pk.pendingControllerValidAt,
|
|
6482
6988
|
"StakeVaultConfig.pendingControllerValidAt"
|
|
6483
6989
|
) : null
|
|
6484
6990
|
} : null,
|
|
@@ -6489,18 +6995,1023 @@ var IndexerStakingService = class {
|
|
|
6489
6995
|
claimAccountState: claimFreshness,
|
|
6490
6996
|
stakeVaultConfig: vaultFreshness,
|
|
6491
6997
|
authorizations: authorizationFreshness,
|
|
6492
|
-
|
|
6493
|
-
takerFreshness,
|
|
6494
|
-
stakeFreshness,
|
|
6495
|
-
claimFreshness,
|
|
6496
|
-
vaultFreshness,
|
|
6497
|
-
...authorizationFreshness
|
|
6498
|
-
])
|
|
6998
|
+
indexerHeadBlockNumber: indexerHeadBlockNumber(data3.chain_metadata, params.chainId)
|
|
6499
6999
|
}
|
|
6500
7000
|
};
|
|
6501
7001
|
}
|
|
6502
7002
|
};
|
|
6503
7003
|
|
|
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";
|
|
7006
|
+
|
|
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
|
|
7008
|
+
var data = {
|
|
7009
|
+
"schemaVersion": 1,
|
|
7010
|
+
"network": "base",
|
|
7011
|
+
"chainId": 8453,
|
|
7012
|
+
"activeDisputeStack": {
|
|
7013
|
+
"version": 1,
|
|
7014
|
+
"selectionHash": "a4f17ae7c1620ecfe7d036f0b9cc7b39c50e1382dc8dc14d2e5f7f21061cd5ad"
|
|
7015
|
+
},
|
|
7016
|
+
"runtimeIdentities": {
|
|
7017
|
+
"Orchestrator": {
|
|
7018
|
+
"address": "0x88888883Ed048FF0a415271B28b2F52d431810D0",
|
|
7019
|
+
"runtimeCodeHash": "0xf511343f2903dd1877c490796cc9423fac66b162b59004d55e522046c1ceb050"
|
|
7020
|
+
},
|
|
7021
|
+
"OrchestratorV2": {
|
|
7022
|
+
"address": "0x888888359E981B5225CA48fbCdCeff702FC3b888",
|
|
7023
|
+
"runtimeCodeHash": "0xcf70a08cc24fcc00799f9f365d0998abe37c718c93ee370a78d1ca06c60d01e0"
|
|
7024
|
+
},
|
|
7025
|
+
"OrchestratorV3": {
|
|
7026
|
+
"address": "0x014025fDE093f8701d86e9f38e2C3a9b779cb5c7",
|
|
7027
|
+
"runtimeCodeHash": "0x4e58f26129559301c017ff264b61dd2255ed2107593d308472ef32d07b8745e9"
|
|
7028
|
+
},
|
|
7029
|
+
"StakeVault": {
|
|
7030
|
+
"address": "0x4d16F4a9946CfC76b1c1A4B63aa9D94cdA2dbCEB",
|
|
7031
|
+
"runtimeCodeHash": "0xfd8d2a910b9ac2c55675ae06d0504f9aac43b02b7022755cf229b571156c681d"
|
|
7032
|
+
},
|
|
7033
|
+
"DisputeProtectionPolicy": {
|
|
7034
|
+
"address": "0xcEc48F7242eDBf02875BB4629115Bd927e1287aA",
|
|
7035
|
+
"runtimeCodeHash": "0x9c4be279da216021183638eaef79ebf98db248472685e9ecd0de3f24a513a641"
|
|
7036
|
+
},
|
|
7037
|
+
"IntentLifecycleHookV1": {
|
|
7038
|
+
"address": "0x71467dCac3B50eeED5A485aC6a70f27B1EAC1970",
|
|
7039
|
+
"runtimeCodeHash": "0x35789014e608a248f3244b61210fa259fee3566c33f50fd0e3fa1f5ae22e370b"
|
|
7040
|
+
},
|
|
7041
|
+
"RecognizedPredecessorHook": {
|
|
7042
|
+
"address": "0x251d78fb6bBb4071995Bce74bAfC9E4168638622",
|
|
7043
|
+
"runtimeCodeHash": "0x03d02863ed5eaa096d4089cb1e126681c0621d99409124f4af5be7ed83e341fe"
|
|
7044
|
+
},
|
|
7045
|
+
"RecognizedPredecessorPolicy": {
|
|
7046
|
+
"address": "0xc086b6120B5e61EF48221E6A78c69737c9948dF9",
|
|
7047
|
+
"runtimeCodeHash": "0xf08bce9ad622b9d45ce310493627cbef3bf6c4ac915661d5bc572bb59b61e084"
|
|
7048
|
+
},
|
|
7049
|
+
"OrchestratorRegistry": {
|
|
7050
|
+
"address": "0xBe9fED15ED7A4B915C03EFcEcb9662739C3382A9",
|
|
7051
|
+
"runtimeCodeHash": "0xf0d132d621ac03181a6fade6a93bd0968d33830c8bf393793236787e7978aee1"
|
|
7052
|
+
},
|
|
7053
|
+
"WhitelistPolicy": {
|
|
7054
|
+
"address": "0xBC53641b4B2504f0061D6a9426C61B8eBE9B4Ff0",
|
|
7055
|
+
"runtimeCodeHash": "0xa3cf0fdf3835887de432cbac9c192edf6c93a8589748aa93f8294333d57024b2"
|
|
7056
|
+
},
|
|
7057
|
+
"DisputeVerifier": {
|
|
7058
|
+
"address": "0x30d4947f005653637005eed991005119D9eB2f34",
|
|
7059
|
+
"runtimeCodeHash": "0x65246e11392befc33d92246cf3ac2467d1f338a8b73c6514b76fab0a70a01ead"
|
|
7060
|
+
},
|
|
7061
|
+
"DisputeNullifierRegistry": {
|
|
7062
|
+
"address": "0xA845615b5203F7a21321DdF5e3a1ca024D93a443",
|
|
7063
|
+
"runtimeCodeHash": "0x1a711749b7700142265363c9c184c195ac81a1415e2142aa84edcbf1cd88142a"
|
|
7064
|
+
},
|
|
7065
|
+
"MultiAttestationVerifier": {
|
|
7066
|
+
"address": "0x9Fe920b24e50e6a6362BA71a1BeB502A99c402d5",
|
|
7067
|
+
"runtimeCodeHash": "0x828a5dae520d3eaed904dfed56994dc6e892eb6416b58ad952c079e220ef841a"
|
|
7068
|
+
}
|
|
7069
|
+
},
|
|
7070
|
+
"addressExpectations": {
|
|
7071
|
+
"AddressGroupRegistry": "0x39F80118f9eB619135f116171b6Cb91D372C5AF2",
|
|
7072
|
+
"EscrowRegistry": "0xeD0e847B101abc96E796260AC358e12BAa2f5B21",
|
|
7073
|
+
"PaymentVerifierRegistry": "0x2b82D24437ff66Fb173eabDfD67ee2ACeb8bEb1e",
|
|
7074
|
+
"RelayerRegistry": "0xEbA979889a9c97382A92472fF3703786fF180083",
|
|
7075
|
+
"NullifierRegistryV2": "0x5455e761b866dfa6A2f5Dc6d6525825bf9C09aeB",
|
|
7076
|
+
"StakeToken": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"
|
|
7077
|
+
},
|
|
7078
|
+
"expectedRelations": {
|
|
7079
|
+
"activeLifecycleHook": "0x71467dCac3B50eeED5A485aC6a70f27B1EAC1970",
|
|
7080
|
+
"recognizedPredecessorPolicy": "0xc086b6120B5e61EF48221E6A78c69737c9948dF9",
|
|
7081
|
+
"registeredOrchestrator": "0x014025fDE093f8701d86e9f38e2C3a9b779cb5c7",
|
|
7082
|
+
"authorizedLifecycleHook": "0x71467dCac3B50eeED5A485aC6a70f27B1EAC1970",
|
|
7083
|
+
"disputeNullifierAuthorizedWriter": "0xcEc48F7242eDBf02875BB4629115Bd927e1287aA",
|
|
7084
|
+
"orchestratorEscrowRegistry": "0xeD0e847B101abc96E796260AC358e12BAa2f5B21",
|
|
7085
|
+
"orchestratorPaymentVerifierRegistry": "0x2b82D24437ff66Fb173eabDfD67ee2ACeb8bEb1e",
|
|
7086
|
+
"orchestratorRelayerRegistry": "0xEbA979889a9c97382A92472fF3703786fF180083",
|
|
7087
|
+
"hookOrchestratorRegistry": "0xBe9fED15ED7A4B915C03EFcEcb9662739C3382A9",
|
|
7088
|
+
"hookWhitelistPolicy": "0xBC53641b4B2504f0061D6a9426C61B8eBE9B4Ff0",
|
|
7089
|
+
"hookDisputeProtectionPolicy": "0xcEc48F7242eDBf02875BB4629115Bd927e1287aA",
|
|
7090
|
+
"whitelistGroupRegistry": "0x39F80118f9eB619135f116171b6Cb91D372C5AF2",
|
|
7091
|
+
"whitelistEscrowRegistry": "0xeD0e847B101abc96E796260AC358e12BAa2f5B21",
|
|
7092
|
+
"whitelistOrchestratorRegistry": "0xBe9fED15ED7A4B915C03EFcEcb9662739C3382A9",
|
|
7093
|
+
"policyStakeVault": "0x4d16F4a9946CfC76b1c1A4B63aa9D94cdA2dbCEB",
|
|
7094
|
+
"policyDisputeVerifier": "0x30d4947f005653637005eed991005119D9eB2f34",
|
|
7095
|
+
"policyDisputeNullifierRegistry": "0xA845615b5203F7a21321DdF5e3a1ca024D93a443",
|
|
7096
|
+
"disputeVerifierNullifierRegistry": "0x5455e761b866dfa6A2f5Dc6d6525825bf9C09aeB",
|
|
7097
|
+
"disputeVerifierAttestationVerifier": "0x9Fe920b24e50e6a6362BA71a1BeB502A99c402d5",
|
|
7098
|
+
"vaultController": "0xcEc48F7242eDBf02875BB4629115Bd927e1287aA",
|
|
7099
|
+
"vaultStakeToken": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"
|
|
7100
|
+
},
|
|
7101
|
+
"expectedGovernance": {
|
|
7102
|
+
"owner": "0x0bC26FF515411396DD588Abd6Ef6846E04470227",
|
|
7103
|
+
"governedRuntimeIdentities": [
|
|
7104
|
+
"OrchestratorRegistry",
|
|
7105
|
+
"OrchestratorV3",
|
|
7106
|
+
"StakeVault",
|
|
7107
|
+
"DisputeProtectionPolicy",
|
|
7108
|
+
"WhitelistPolicy",
|
|
7109
|
+
"DisputeVerifier",
|
|
7110
|
+
"DisputeNullifierRegistry",
|
|
7111
|
+
"MultiAttestationVerifier"
|
|
7112
|
+
],
|
|
7113
|
+
"pendingOwner": "0x0000000000000000000000000000000000000000",
|
|
7114
|
+
"twoStepGovernedRuntimeIdentities": [
|
|
7115
|
+
"StakeVault",
|
|
7116
|
+
"DisputeProtectionPolicy",
|
|
7117
|
+
"DisputeVerifier"
|
|
7118
|
+
]
|
|
7119
|
+
},
|
|
7120
|
+
"attestationTrust": {
|
|
7121
|
+
"requiredSignatures": "1",
|
|
7122
|
+
"witnesses": [
|
|
7123
|
+
"0xDB4Ed7FAF170F0f6493E3adaaCaaFaF47092c754",
|
|
7124
|
+
"0xE078D93bFdd87A8c5C5cCA5905DCbA0Dd7A1F0BD"
|
|
7125
|
+
]
|
|
7126
|
+
},
|
|
7127
|
+
"exactAuthorizationSets": {
|
|
7128
|
+
"orchestratorAuthorizationFromBlock": "42878566",
|
|
7129
|
+
"authorizedOrchestrators": [
|
|
7130
|
+
"0x88888883Ed048FF0a415271B28b2F52d431810D0",
|
|
7131
|
+
"0x888888359E981B5225CA48fbCdCeff702FC3b888",
|
|
7132
|
+
"0x014025fDE093f8701d86e9f38e2C3a9b779cb5c7"
|
|
7133
|
+
],
|
|
7134
|
+
"lifecycleHookAuthorizationFromBlock": "50201693",
|
|
7135
|
+
"authorizedLifecycleHooks": [
|
|
7136
|
+
"0x71467dCac3B50eeED5A485aC6a70f27B1EAC1970"
|
|
7137
|
+
],
|
|
7138
|
+
"passiveDisputeNullifierWriters": [
|
|
7139
|
+
"0xc086b6120B5e61EF48221E6A78c69737c9948dF9"
|
|
7140
|
+
],
|
|
7141
|
+
"activeDisputeNullifierWriters": [
|
|
7142
|
+
"0xcEc48F7242eDBf02875BB4629115Bd927e1287aA"
|
|
7143
|
+
]
|
|
7144
|
+
},
|
|
7145
|
+
"riskWindowSecondsByPaymentMethod": {
|
|
7146
|
+
"0x10940ee67cfb3c6c064569ec92c0ee934cd7afa18dd2ca2d6a2254fcb009c17d": "1209600",
|
|
7147
|
+
"0x3ccc3d4d5e769b1f82dc4988485551dc0cd3c7a3926d7d8a4dde91507199490f": "1209600",
|
|
7148
|
+
"0x554a007c2217df766b977723b276671aee5ebb4adaea0edb6433c88b3e61dac5": "0",
|
|
7149
|
+
"0x5908bb0c9b87763ac6171d4104847667e7f02b4c47b574fe890c1f439ed128bb": "0",
|
|
7150
|
+
"0x617f88ab82b5c1b014c539f7e75121427f0bb50a4c58b187a238531e7d58605d": "0",
|
|
7151
|
+
"0x62c7ed738ad3e7618111348af32691b5767777fbaf46a2d8943237625552645c": "0",
|
|
7152
|
+
"0x90262a3db0edd0be2369c6b28f9e8511ec0bac7136cefbada0880602f87e7268": "1209600",
|
|
7153
|
+
"0xa5418819c024239299ea32e09defae8ec412c03e58f5c75f1b2fe84c857f5483": "0",
|
|
7154
|
+
"0xcac9daea62d7b89d75ac73af4ee14dcf25721012ae82b568c2ea5c808eaa04ff": "0",
|
|
7155
|
+
"0xf752c7d19698ecb0bb8988abf9b9a53a4c3657f3bc8850a6fb59fdf3e3ce8cd3": "0"
|
|
7156
|
+
},
|
|
7157
|
+
"sentinel": {
|
|
7158
|
+
"escrow": "0x0000000000000000000000000000000000000001",
|
|
7159
|
+
"depositId": "0",
|
|
7160
|
+
"expected": false
|
|
7161
|
+
},
|
|
7162
|
+
"prerequisites": {
|
|
7163
|
+
"orchestratorPaused": false,
|
|
7164
|
+
"admissionsPaused": false,
|
|
7165
|
+
"allowMultipleIntents": true,
|
|
7166
|
+
"orchestratorRegistered": true,
|
|
7167
|
+
"lifecycleHookAuthorized": true,
|
|
7168
|
+
"disputeNullifierWriterAuthorized": true,
|
|
7169
|
+
"vaultControllerActivated": true,
|
|
7170
|
+
"vaultPendingController": "0x0000000000000000000000000000000000000000",
|
|
7171
|
+
"vaultPendingControllerValidAt": "0",
|
|
7172
|
+
"pendingCoverageMaturity": "18446744073709551615"
|
|
7173
|
+
}
|
|
7174
|
+
};
|
|
7175
|
+
var base_default = data;
|
|
7176
|
+
|
|
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
|
|
7178
|
+
var data2 = {
|
|
7179
|
+
"schemaVersion": 1,
|
|
7180
|
+
"network": "base_staging",
|
|
7181
|
+
"chainId": 8453,
|
|
7182
|
+
"activeDisputeStack": {
|
|
7183
|
+
"version": 1,
|
|
7184
|
+
"selectionHash": "586c90f9de3d10b6d48f4286c709aa7f870fc2fdcfb0af1da947c1da76132dd0"
|
|
7185
|
+
},
|
|
7186
|
+
"runtimeIdentities": {
|
|
7187
|
+
"Orchestrator": {
|
|
7188
|
+
"address": "0xF9b9CD27Deea496B960b3cb5221b514705fCaF5e",
|
|
7189
|
+
"runtimeCodeHash": "0xf511343f2903dd1877c490796cc9423fac66b162b59004d55e522046c1ceb050"
|
|
7190
|
+
},
|
|
7191
|
+
"OrchestratorV2": {
|
|
7192
|
+
"address": "0xc17a59227B136c45fAa153086a15EF87ED14bE00",
|
|
7193
|
+
"runtimeCodeHash": "0xcf70a08cc24fcc00799f9f365d0998abe37c718c93ee370a78d1ca06c60d01e0"
|
|
7194
|
+
},
|
|
7195
|
+
"OrchestratorV3": {
|
|
7196
|
+
"address": "0x2b5E8Ab562e45fA89D73802605E145ED3E3EeF4f",
|
|
7197
|
+
"runtimeCodeHash": "0x4e58f26129559301c017ff264b61dd2255ed2107593d308472ef32d07b8745e9"
|
|
7198
|
+
},
|
|
7199
|
+
"StakeVault": {
|
|
7200
|
+
"address": "0x01075fdCB8D38fD5A1070db41B3c00DC2459e71e",
|
|
7201
|
+
"runtimeCodeHash": "0xfd8d2a910b9ac2c55675ae06d0504f9aac43b02b7022755cf229b571156c681d"
|
|
7202
|
+
},
|
|
7203
|
+
"DisputeProtectionPolicy": {
|
|
7204
|
+
"address": "0x51436B8051cCf52739A2090C29DA208B70eC2663",
|
|
7205
|
+
"runtimeCodeHash": "0xa4c6a33333e10da596805b6127e96f78e40fe5a0f0ab0cfa8f4683fbeac91a37"
|
|
7206
|
+
},
|
|
7207
|
+
"IntentLifecycleHookV1": {
|
|
7208
|
+
"address": "0x3AB0879499b28e03bfcA4F5bC2CBe2070Fba4E36",
|
|
7209
|
+
"runtimeCodeHash": "0x376364aa8b693ee8e02eacc48527114ce3cc529714be5a3f316c7323561721ab"
|
|
7210
|
+
},
|
|
7211
|
+
"RecognizedPredecessorHook": {
|
|
7212
|
+
"address": "0x19D9F0Fcb08C60D8bd0CD061C34eae27eF8b6e65",
|
|
7213
|
+
"runtimeCodeHash": "0xba70239e37624f5808e2f79e100e83a17daeb1558f310543187f5d8a121ec367"
|
|
7214
|
+
},
|
|
7215
|
+
"RecognizedPredecessorPolicy": {
|
|
7216
|
+
"address": "0x21517b7743E727ae47A66FafF93550B689c15020",
|
|
7217
|
+
"runtimeCodeHash": "0x4e6617a94819ad15693289b173a9a66a78cfe1dd706f6b4fdc5a5f6ad6a32971"
|
|
7218
|
+
},
|
|
7219
|
+
"OrchestratorRegistry": {
|
|
7220
|
+
"address": "0xfA6384EB6176cfEC049540526A3d2126C3666d8A",
|
|
7221
|
+
"runtimeCodeHash": "0xf0d132d621ac03181a6fade6a93bd0968d33830c8bf393793236787e7978aee1"
|
|
7222
|
+
},
|
|
7223
|
+
"WhitelistPolicy": {
|
|
7224
|
+
"address": "0x7d9277cb8bb78a51eeaafB7CFF306E7DA4C972fD",
|
|
7225
|
+
"runtimeCodeHash": "0x917965fdc75580147ad0787c86f8b2a0f0185ef6e101567b82dc1245d6eb63bc"
|
|
7226
|
+
},
|
|
7227
|
+
"DisputeVerifier": {
|
|
7228
|
+
"address": "0x973578148c5Fd49b9f68B50B26066555325AC708",
|
|
7229
|
+
"runtimeCodeHash": "0xb3b34734cfd162cd129d0c84285461c751321545213ec20164745b8e72f9dd6c"
|
|
7230
|
+
},
|
|
7231
|
+
"DisputeNullifierRegistry": {
|
|
7232
|
+
"address": "0xE0B05a9655AF0f31E32904267baa50FbC7f217ea",
|
|
7233
|
+
"runtimeCodeHash": "0x1a711749b7700142265363c9c184c195ac81a1415e2142aa84edcbf1cd88142a"
|
|
7234
|
+
},
|
|
7235
|
+
"MultiAttestationVerifier": {
|
|
7236
|
+
"address": "0x9855a39aC5975069632e91160d8712CBfF19e864",
|
|
7237
|
+
"runtimeCodeHash": "0x828a5dae520d3eaed904dfed56994dc6e892eb6416b58ad952c079e220ef841a"
|
|
7238
|
+
}
|
|
7239
|
+
},
|
|
7240
|
+
"addressExpectations": {
|
|
7241
|
+
"AddressGroupRegistry": "0x54Ff7788Cb42B46FE2F016a65Fd0f654Bb9BcF3D",
|
|
7242
|
+
"EscrowRegistry": "0xc545f336eC77E69bf115729acCbf2e557A00ac91",
|
|
7243
|
+
"PaymentVerifierRegistry": "0x2261416DA54C85f975C73FA56EF4D2D6b0aEF7Cc",
|
|
7244
|
+
"RelayerRegistry": "0xB214650b424E6b5fdcB1259566eB7A512D8Bd25E",
|
|
7245
|
+
"NullifierRegistryV2": "0x2eb43d6C7c7Ec4220Aa6B8735BC053824a71778C",
|
|
7246
|
+
"StakeToken": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"
|
|
7247
|
+
},
|
|
7248
|
+
"expectedRelations": {
|
|
7249
|
+
"activeLifecycleHook": "0x3AB0879499b28e03bfcA4F5bC2CBe2070Fba4E36",
|
|
7250
|
+
"recognizedPredecessorPolicy": "0x21517b7743E727ae47A66FafF93550B689c15020",
|
|
7251
|
+
"registeredOrchestrator": "0x2b5E8Ab562e45fA89D73802605E145ED3E3EeF4f",
|
|
7252
|
+
"authorizedLifecycleHook": "0x3AB0879499b28e03bfcA4F5bC2CBe2070Fba4E36",
|
|
7253
|
+
"disputeNullifierAuthorizedWriter": "0x51436B8051cCf52739A2090C29DA208B70eC2663",
|
|
7254
|
+
"orchestratorEscrowRegistry": "0xc545f336eC77E69bf115729acCbf2e557A00ac91",
|
|
7255
|
+
"orchestratorPaymentVerifierRegistry": "0x2261416DA54C85f975C73FA56EF4D2D6b0aEF7Cc",
|
|
7256
|
+
"orchestratorRelayerRegistry": "0xB214650b424E6b5fdcB1259566eB7A512D8Bd25E",
|
|
7257
|
+
"hookOrchestratorRegistry": "0xfA6384EB6176cfEC049540526A3d2126C3666d8A",
|
|
7258
|
+
"hookWhitelistPolicy": "0x7d9277cb8bb78a51eeaafB7CFF306E7DA4C972fD",
|
|
7259
|
+
"hookDisputeProtectionPolicy": "0x51436B8051cCf52739A2090C29DA208B70eC2663",
|
|
7260
|
+
"whitelistGroupRegistry": "0x54Ff7788Cb42B46FE2F016a65Fd0f654Bb9BcF3D",
|
|
7261
|
+
"whitelistEscrowRegistry": "0xc545f336eC77E69bf115729acCbf2e557A00ac91",
|
|
7262
|
+
"whitelistOrchestratorRegistry": "0xfA6384EB6176cfEC049540526A3d2126C3666d8A",
|
|
7263
|
+
"policyStakeVault": "0x01075fdCB8D38fD5A1070db41B3c00DC2459e71e",
|
|
7264
|
+
"policyDisputeVerifier": "0x973578148c5Fd49b9f68B50B26066555325AC708",
|
|
7265
|
+
"policyDisputeNullifierRegistry": "0xE0B05a9655AF0f31E32904267baa50FbC7f217ea",
|
|
7266
|
+
"disputeVerifierNullifierRegistry": "0x2eb43d6C7c7Ec4220Aa6B8735BC053824a71778C",
|
|
7267
|
+
"disputeVerifierAttestationVerifier": "0x9855a39aC5975069632e91160d8712CBfF19e864",
|
|
7268
|
+
"vaultController": "0x51436B8051cCf52739A2090C29DA208B70eC2663",
|
|
7269
|
+
"vaultStakeToken": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"
|
|
7270
|
+
},
|
|
7271
|
+
"expectedGovernance": {
|
|
7272
|
+
"owner": "0x84e113087C97Cd80eA9D78983D4B8Ff61ECa1929",
|
|
7273
|
+
"governedRuntimeIdentities": [
|
|
7274
|
+
"OrchestratorRegistry",
|
|
7275
|
+
"OrchestratorV3",
|
|
7276
|
+
"StakeVault",
|
|
7277
|
+
"DisputeProtectionPolicy",
|
|
7278
|
+
"WhitelistPolicy",
|
|
7279
|
+
"DisputeVerifier",
|
|
7280
|
+
"DisputeNullifierRegistry",
|
|
7281
|
+
"MultiAttestationVerifier"
|
|
7282
|
+
],
|
|
7283
|
+
"pendingOwner": "0x0000000000000000000000000000000000000000",
|
|
7284
|
+
"twoStepGovernedRuntimeIdentities": [
|
|
7285
|
+
"StakeVault",
|
|
7286
|
+
"DisputeProtectionPolicy",
|
|
7287
|
+
"DisputeVerifier"
|
|
7288
|
+
]
|
|
7289
|
+
},
|
|
7290
|
+
"attestationTrust": {
|
|
7291
|
+
"requiredSignatures": "1",
|
|
7292
|
+
"witnesses": [
|
|
7293
|
+
"0x66649F896521b0fb487fE2077b4FBDA283d7f19a",
|
|
7294
|
+
"0x4ab950AE1e3326578Bf7e643a2031E858aBa2927"
|
|
7295
|
+
]
|
|
7296
|
+
},
|
|
7297
|
+
"exactAuthorizationSets": {
|
|
7298
|
+
"orchestratorAuthorizationFromBlock": "42614859",
|
|
7299
|
+
"authorizedOrchestrators": [
|
|
7300
|
+
"0xF9b9CD27Deea496B960b3cb5221b514705fCaF5e",
|
|
7301
|
+
"0xc17a59227B136c45fAa153086a15EF87ED14bE00",
|
|
7302
|
+
"0x2b5E8Ab562e45fA89D73802605E145ED3E3EeF4f"
|
|
7303
|
+
],
|
|
7304
|
+
"lifecycleHookAuthorizationFromBlock": "50201496",
|
|
7305
|
+
"authorizedLifecycleHooks": [
|
|
7306
|
+
"0x3AB0879499b28e03bfcA4F5bC2CBe2070Fba4E36"
|
|
7307
|
+
],
|
|
7308
|
+
"passiveDisputeNullifierWriters": [
|
|
7309
|
+
"0x21517b7743E727ae47A66FafF93550B689c15020"
|
|
7310
|
+
],
|
|
7311
|
+
"activeDisputeNullifierWriters": [
|
|
7312
|
+
"0x51436B8051cCf52739A2090C29DA208B70eC2663"
|
|
7313
|
+
]
|
|
7314
|
+
},
|
|
7315
|
+
"riskWindowSecondsByPaymentMethod": {
|
|
7316
|
+
"0x10940ee67cfb3c6c064569ec92c0ee934cd7afa18dd2ca2d6a2254fcb009c17d": "1209600",
|
|
7317
|
+
"0x1d966dbd6aeb8674d7c05174bd0ded7b56a798672bfb862ef20bbe8c2bbfce18": "0",
|
|
7318
|
+
"0x3ccc3d4d5e769b1f82dc4988485551dc0cd3c7a3926d7d8a4dde91507199490f": "1209600",
|
|
7319
|
+
"0x554a007c2217df766b977723b276671aee5ebb4adaea0edb6433c88b3e61dac5": "0",
|
|
7320
|
+
"0x5908bb0c9b87763ac6171d4104847667e7f02b4c47b574fe890c1f439ed128bb": "0",
|
|
7321
|
+
"0x617f88ab82b5c1b014c539f7e75121427f0bb50a4c58b187a238531e7d58605d": "0",
|
|
7322
|
+
"0x62c7ed738ad3e7618111348af32691b5767777fbaf46a2d8943237625552645c": "0",
|
|
7323
|
+
"0x90262a3db0edd0be2369c6b28f9e8511ec0bac7136cefbada0880602f87e7268": "1209600",
|
|
7324
|
+
"0xa5418819c024239299ea32e09defae8ec412c03e58f5c75f1b2fe84c857f5483": "0",
|
|
7325
|
+
"0xcac9daea62d7b89d75ac73af4ee14dcf25721012ae82b568c2ea5c808eaa04ff": "0",
|
|
7326
|
+
"0xf752c7d19698ecb0bb8988abf9b9a53a4c3657f3bc8850a6fb59fdf3e3ce8cd3": "0",
|
|
7327
|
+
"0xf81480907d808d639ad3230869e4b05a3b01b2d34e323af40f2efab807effd32": "0"
|
|
7328
|
+
},
|
|
7329
|
+
"sentinel": {
|
|
7330
|
+
"escrow": "0x0000000000000000000000000000000000000001",
|
|
7331
|
+
"depositId": "0",
|
|
7332
|
+
"expected": false
|
|
7333
|
+
},
|
|
7334
|
+
"prerequisites": {
|
|
7335
|
+
"orchestratorPaused": false,
|
|
7336
|
+
"admissionsPaused": false,
|
|
7337
|
+
"allowMultipleIntents": true,
|
|
7338
|
+
"orchestratorRegistered": true,
|
|
7339
|
+
"lifecycleHookAuthorized": true,
|
|
7340
|
+
"disputeNullifierWriterAuthorized": true,
|
|
7341
|
+
"vaultControllerActivated": true,
|
|
7342
|
+
"vaultPendingController": "0x0000000000000000000000000000000000000000",
|
|
7343
|
+
"vaultPendingControllerValidAt": "0",
|
|
7344
|
+
"pendingCoverageMaturity": "18446744073709551615"
|
|
7345
|
+
}
|
|
7346
|
+
};
|
|
7347
|
+
var baseStaging_default = data2;
|
|
7348
|
+
|
|
7349
|
+
// src/buildMetadata.ts
|
|
7350
|
+
var DEVELOPMENT_BUILD_METADATA = {
|
|
7351
|
+
schemaVersion: 1,
|
|
7352
|
+
source: {
|
|
7353
|
+
repository: "zkp2p/zkp2p-clients",
|
|
7354
|
+
commitSha: "development",
|
|
7355
|
+
kind: "development",
|
|
7356
|
+
distributable: false
|
|
7357
|
+
},
|
|
7358
|
+
sdkPackageVersion: "development",
|
|
7359
|
+
contractsPackageVersion: "development",
|
|
7360
|
+
indexerSchemaPackageVersion: "development",
|
|
7361
|
+
activeDisputeStack: {
|
|
7362
|
+
base: { version: 1, selectionHash: "development" },
|
|
7363
|
+
baseStaging: { version: 1, selectionHash: "development" }
|
|
7364
|
+
}
|
|
7365
|
+
};
|
|
7366
|
+
var SDK_BUILD_METADATA = typeof define_ZKP2P_SDK_BUILD_METADATA_default === "undefined" ? DEVELOPMENT_BUILD_METADATA : define_ZKP2P_SDK_BUILD_METADATA_default;
|
|
7367
|
+
|
|
7368
|
+
// src/client/DisputeProtectionReadiness.ts
|
|
7369
|
+
var SUCCESSOR_RUNTIME_IDENTITIES = [
|
|
7370
|
+
"IntentLifecycleHookV1",
|
|
7371
|
+
"StakeVault",
|
|
7372
|
+
"DisputeProtectionPolicy",
|
|
7373
|
+
"OrchestratorRegistry",
|
|
7374
|
+
"WhitelistPolicy",
|
|
7375
|
+
"DisputeVerifier",
|
|
7376
|
+
"DisputeNullifierRegistry",
|
|
7377
|
+
"MultiAttestationVerifier"
|
|
7378
|
+
];
|
|
7379
|
+
var GOVERNANCE_ABIS = {
|
|
7380
|
+
OrchestratorRegistry: OrchestratorRegistry_default,
|
|
7381
|
+
OrchestratorV3: OrchestratorV3_default,
|
|
7382
|
+
StakeVault: StakeVault_default,
|
|
7383
|
+
DisputeProtectionPolicy: DisputeProtectionPolicy_default,
|
|
7384
|
+
WhitelistPolicy: WhitelistPolicy_default,
|
|
7385
|
+
DisputeVerifier: DisputeVerifier_default,
|
|
7386
|
+
DisputeNullifierRegistry: DisputeNullifierRegistry_default,
|
|
7387
|
+
MultiAttestationVerifier: MultiAttestationVerifier_default
|
|
7388
|
+
};
|
|
7389
|
+
var ORCHESTRATOR_AUTHORIZATION_EVENTS = OrchestratorRegistry_default.filter(
|
|
7390
|
+
(item) => item.type === "event" && (item.name === "OrchestratorAdded" || item.name === "OrchestratorRemoved")
|
|
7391
|
+
);
|
|
7392
|
+
var LIFECYCLE_HOOK_AUTHORIZATION_EVENTS = DisputeProtectionPolicy_default.filter(
|
|
7393
|
+
(item) => item.type === "event" && item.name === "LifecycleHookAuthorizationUpdated"
|
|
7394
|
+
);
|
|
7395
|
+
var FALLBACK_LOG_BLOCK_SPAN = 10000n;
|
|
7396
|
+
var LOG_QUERY_CONCURRENCY = 8;
|
|
7397
|
+
var ReadinessMismatch = class extends Error {
|
|
7398
|
+
};
|
|
7399
|
+
function sameAddress(actual, expected) {
|
|
7400
|
+
return typeof actual === "string" && actual.toLowerCase() === expected.toLowerCase();
|
|
7401
|
+
}
|
|
7402
|
+
function expectAddress(label, actual, expected) {
|
|
7403
|
+
if (!sameAddress(actual, expected)) throw new ReadinessMismatch(`${label} mismatch`);
|
|
7404
|
+
}
|
|
7405
|
+
function expectBoolean(label, actual, expected) {
|
|
7406
|
+
if (actual !== expected) throw new ReadinessMismatch(`${label} expected ${String(expected)}`);
|
|
7407
|
+
}
|
|
7408
|
+
function expectBigInt(label, actual, expected) {
|
|
7409
|
+
if (actual !== expected) throw new ReadinessMismatch(`${label} mismatch`);
|
|
7410
|
+
}
|
|
7411
|
+
function normalizeAddressSet(label, addresses) {
|
|
7412
|
+
if (!Array.isArray(addresses) || addresses.some((address) => typeof address !== "string")) {
|
|
7413
|
+
throw new ReadinessMismatch(`${label} is not an address array`);
|
|
7414
|
+
}
|
|
7415
|
+
const normalized = addresses.map((address) => address.toLowerCase()).sort();
|
|
7416
|
+
if (new Set(normalized).size !== normalized.length) {
|
|
7417
|
+
throw new ReadinessMismatch(`${label} contains duplicate addresses`);
|
|
7418
|
+
}
|
|
7419
|
+
return normalized;
|
|
7420
|
+
}
|
|
7421
|
+
function expectAddressSet(label, actual, expected) {
|
|
7422
|
+
const actualAddresses = normalizeAddressSet(label, actual);
|
|
7423
|
+
const expectedAddresses = normalizeAddressSet(label, expected);
|
|
7424
|
+
if (actualAddresses.length !== expectedAddresses.length || actualAddresses.some((address, index) => address !== expectedAddresses[index])) {
|
|
7425
|
+
throw new ReadinessMismatch(`${label} mismatch`);
|
|
7426
|
+
}
|
|
7427
|
+
}
|
|
7428
|
+
function fallbackBlockRanges(fromBlock, toBlock) {
|
|
7429
|
+
const ranges = [];
|
|
7430
|
+
for (let start = fromBlock; start <= toBlock; start += FALLBACK_LOG_BLOCK_SPAN) {
|
|
7431
|
+
const end = start + FALLBACK_LOG_BLOCK_SPAN - 1n;
|
|
7432
|
+
ranges.push([start, end < toBlock ? end : toBlock]);
|
|
7433
|
+
}
|
|
7434
|
+
return ranges;
|
|
7435
|
+
}
|
|
7436
|
+
function isLogRangeLimitError(cause) {
|
|
7437
|
+
let error = cause;
|
|
7438
|
+
while (error instanceof Error) {
|
|
7439
|
+
if (/(?:block range.{0,40}(?:too (?:large|wide)|exceed|limit)|limited to.{0,40}(?:blocks?|range)|response size exceeded|query returned more than|too many (?:logs|results)|maximum block range)/i.test(
|
|
7440
|
+
error.message
|
|
7441
|
+
)) {
|
|
7442
|
+
return true;
|
|
7443
|
+
}
|
|
7444
|
+
error = error.cause;
|
|
7445
|
+
}
|
|
7446
|
+
return false;
|
|
7447
|
+
}
|
|
7448
|
+
function compareAuthorizationEvents(left, right) {
|
|
7449
|
+
if ((left.blockNumber ?? 0n) !== (right.blockNumber ?? 0n)) {
|
|
7450
|
+
return (left.blockNumber ?? 0n) < (right.blockNumber ?? 0n) ? -1 : 1;
|
|
7451
|
+
}
|
|
7452
|
+
if ((left.transactionIndex ?? 0) !== (right.transactionIndex ?? 0)) {
|
|
7453
|
+
return (left.transactionIndex ?? 0) - (right.transactionIndex ?? 0);
|
|
7454
|
+
}
|
|
7455
|
+
return (left.logIndex ?? 0) - (right.logIndex ?? 0);
|
|
7456
|
+
}
|
|
7457
|
+
function replayAddressAuthorizations(label, events, addressField, enabledField) {
|
|
7458
|
+
const authorized = /* @__PURE__ */ new Set();
|
|
7459
|
+
for (const event of [...events].sort(compareAuthorizationEvents)) {
|
|
7460
|
+
const address = event.args?.[addressField];
|
|
7461
|
+
if (typeof address !== "string") {
|
|
7462
|
+
throw new ReadinessMismatch(`${label} event address is malformed`);
|
|
7463
|
+
}
|
|
7464
|
+
const normalized = address.toLowerCase();
|
|
7465
|
+
const enabled = enabledField ? event.args?.[enabledField] : event.args?.enabled;
|
|
7466
|
+
if (typeof enabled !== "boolean") {
|
|
7467
|
+
throw new ReadinessMismatch(`${label} event authorization is malformed`);
|
|
7468
|
+
}
|
|
7469
|
+
if (enabled) authorized.add(normalized);
|
|
7470
|
+
else authorized.delete(normalized);
|
|
7471
|
+
}
|
|
7472
|
+
return [...authorized];
|
|
7473
|
+
}
|
|
7474
|
+
function manifestForEnvironment(environment) {
|
|
7475
|
+
return environment === "staging" ? baseStaging_default : base_default;
|
|
7476
|
+
}
|
|
7477
|
+
function validatePackagedIdentity(config) {
|
|
7478
|
+
const { buildMetadata, chainId, contractsPackageVersion, manifest } = config;
|
|
7479
|
+
if (!buildMetadata.source.distributable) return "SDK build metadata is not distributable";
|
|
7480
|
+
if (buildMetadata.source.kind !== "github" || buildMetadata.source.repository !== "zkp2p/zkp2p-clients" || !/^[0-9a-f]{40}$/.test(buildMetadata.source.commitSha)) {
|
|
7481
|
+
return "SDK build source identity is invalid";
|
|
7482
|
+
}
|
|
7483
|
+
if (buildMetadata.contractsPackageVersion !== contractsPackageVersion) {
|
|
7484
|
+
return "contracts package version does not match SDK build metadata";
|
|
7485
|
+
}
|
|
7486
|
+
if (manifest.schemaVersion !== 1 || manifest.chainId !== chainId || manifest.network !== "base" && manifest.network !== "base_staging") {
|
|
7487
|
+
return "dispute readiness manifest chain identity mismatch";
|
|
7488
|
+
}
|
|
7489
|
+
const selected = manifest.network === "base" ? buildMetadata.activeDisputeStack.base : buildMetadata.activeDisputeStack.baseStaging;
|
|
7490
|
+
if (selected.version !== manifest.activeDisputeStack.version || selected.selectionHash !== manifest.activeDisputeStack.selectionHash) {
|
|
7491
|
+
return "active dispute manifest selection does not match SDK build metadata";
|
|
7492
|
+
}
|
|
7493
|
+
return null;
|
|
7494
|
+
}
|
|
7495
|
+
function knownResult(state, readyForDisputeProtection, blockNumber, config, lifecycleHook, paused, allowMultipleIntents, policyAdmissionsPaused) {
|
|
7496
|
+
return {
|
|
7497
|
+
state,
|
|
7498
|
+
readyForDisputeProtection,
|
|
7499
|
+
asOfBlock: blockNumber,
|
|
7500
|
+
manifestNetwork: config.manifest.network,
|
|
7501
|
+
manifestSelectionHash: config.manifest.activeDisputeStack.selectionHash,
|
|
7502
|
+
contractsPackageVersion: config.contractsPackageVersion,
|
|
7503
|
+
activeLifecycleHook: lifecycleHook,
|
|
7504
|
+
orchestratorPaused: paused,
|
|
7505
|
+
allowMultipleIntents,
|
|
7506
|
+
policyAdmissionsPaused
|
|
7507
|
+
};
|
|
7508
|
+
}
|
|
7509
|
+
var DisputeProtectionReadinessReader = class {
|
|
7510
|
+
constructor(config) {
|
|
7511
|
+
this.config = config;
|
|
7512
|
+
}
|
|
7513
|
+
async verifyRuntimeIdentities(names, blockNumber) {
|
|
7514
|
+
await Promise.all(
|
|
7515
|
+
names.map(async (name) => {
|
|
7516
|
+
const identity = this.config.manifest.runtimeIdentities[name];
|
|
7517
|
+
const bytecode = await this.config.publicClient.getBytecode({
|
|
7518
|
+
address: identity.address,
|
|
7519
|
+
blockNumber
|
|
7520
|
+
});
|
|
7521
|
+
if (!bytecode || bytecode === "0x") {
|
|
7522
|
+
throw new ReadinessMismatch(`${name} runtime bytecode unavailable`);
|
|
7523
|
+
}
|
|
7524
|
+
if (keccak256(bytecode).toLowerCase() !== identity.runtimeCodeHash.toLowerCase()) {
|
|
7525
|
+
throw new ReadinessMismatch(`${name} runtime code hash mismatch`);
|
|
7526
|
+
}
|
|
7527
|
+
})
|
|
7528
|
+
);
|
|
7529
|
+
}
|
|
7530
|
+
async readOrchestrator(blockNumber) {
|
|
7531
|
+
const { manifest, publicClient } = this.config;
|
|
7532
|
+
const orchestrator = manifest.runtimeIdentities.OrchestratorV3.address;
|
|
7533
|
+
const result = await publicClient.multicall({
|
|
7534
|
+
allowFailure: false,
|
|
7535
|
+
blockNumber,
|
|
7536
|
+
contracts: [
|
|
7537
|
+
{ address: orchestrator, abi: OrchestratorV3_default, functionName: "lifecycleHook" },
|
|
7538
|
+
{ address: orchestrator, abi: OrchestratorV3_default, functionName: "paused" },
|
|
7539
|
+
{ address: orchestrator, abi: OrchestratorV3_default, functionName: "allowMultipleIntents" },
|
|
7540
|
+
{ address: orchestrator, abi: OrchestratorV3_default, functionName: "chainId" },
|
|
7541
|
+
{ address: orchestrator, abi: OrchestratorV3_default, functionName: "escrowRegistry" },
|
|
7542
|
+
{ address: orchestrator, abi: OrchestratorV3_default, functionName: "paymentVerifierRegistry" },
|
|
7543
|
+
{ address: orchestrator, abi: OrchestratorV3_default, functionName: "relayerRegistry" }
|
|
7544
|
+
]
|
|
7545
|
+
});
|
|
7546
|
+
const lifecycleHook = result[0];
|
|
7547
|
+
if (typeof lifecycleHook !== "string") {
|
|
7548
|
+
throw new ReadinessMismatch("OrchestratorV3.lifecycleHook is not an address");
|
|
7549
|
+
}
|
|
7550
|
+
expectBigInt("OrchestratorV3.chainId", result[3], BigInt(manifest.chainId));
|
|
7551
|
+
expectAddress(
|
|
7552
|
+
"OrchestratorV3.escrowRegistry",
|
|
7553
|
+
result[4],
|
|
7554
|
+
manifest.expectedRelations.orchestratorEscrowRegistry
|
|
7555
|
+
);
|
|
7556
|
+
expectAddress(
|
|
7557
|
+
"OrchestratorV3.paymentVerifierRegistry",
|
|
7558
|
+
result[5],
|
|
7559
|
+
manifest.expectedRelations.orchestratorPaymentVerifierRegistry
|
|
7560
|
+
);
|
|
7561
|
+
expectAddress(
|
|
7562
|
+
"OrchestratorV3.relayerRegistry",
|
|
7563
|
+
result[6],
|
|
7564
|
+
manifest.expectedRelations.orchestratorRelayerRegistry
|
|
7565
|
+
);
|
|
7566
|
+
if (typeof result[1] !== "boolean" || typeof result[2] !== "boolean") {
|
|
7567
|
+
throw new ReadinessMismatch("OrchestratorV3 readiness flags are malformed");
|
|
7568
|
+
}
|
|
7569
|
+
return {
|
|
7570
|
+
lifecycleHook: lifecycleHook.toLowerCase(),
|
|
7571
|
+
paused: result[1],
|
|
7572
|
+
allowMultipleIntents: result[2]
|
|
7573
|
+
};
|
|
7574
|
+
}
|
|
7575
|
+
async verifyGovernance(blockNumber) {
|
|
7576
|
+
const { manifest, publicClient } = this.config;
|
|
7577
|
+
const governance = manifest.expectedGovernance;
|
|
7578
|
+
const ownerContracts = governance.governedRuntimeIdentities.map((name) => ({
|
|
7579
|
+
address: manifest.runtimeIdentities[name].address,
|
|
7580
|
+
abi: GOVERNANCE_ABIS[name],
|
|
7581
|
+
functionName: "owner"
|
|
7582
|
+
}));
|
|
7583
|
+
const pendingOwnerContracts = governance.twoStepGovernedRuntimeIdentities.map((name) => ({
|
|
7584
|
+
address: manifest.runtimeIdentities[name].address,
|
|
7585
|
+
abi: GOVERNANCE_ABIS[name],
|
|
7586
|
+
functionName: "pendingOwner"
|
|
7587
|
+
}));
|
|
7588
|
+
const results = await publicClient.multicall({
|
|
7589
|
+
allowFailure: false,
|
|
7590
|
+
blockNumber,
|
|
7591
|
+
contracts: [...ownerContracts, ...pendingOwnerContracts]
|
|
7592
|
+
});
|
|
7593
|
+
governance.governedRuntimeIdentities.forEach((name, index) => {
|
|
7594
|
+
expectAddress(`${name}.owner`, results[index], governance.owner);
|
|
7595
|
+
});
|
|
7596
|
+
governance.twoStepGovernedRuntimeIdentities.forEach((name, index) => {
|
|
7597
|
+
expectAddress(
|
|
7598
|
+
`${name}.pendingOwner`,
|
|
7599
|
+
results[ownerContracts.length + index],
|
|
7600
|
+
governance.pendingOwner
|
|
7601
|
+
);
|
|
7602
|
+
});
|
|
7603
|
+
}
|
|
7604
|
+
async verifyAttestationTrust(blockNumber) {
|
|
7605
|
+
const { manifest, publicClient } = this.config;
|
|
7606
|
+
const verifier = manifest.runtimeIdentities.MultiAttestationVerifier.address;
|
|
7607
|
+
const results = await publicClient.multicall({
|
|
7608
|
+
allowFailure: false,
|
|
7609
|
+
blockNumber,
|
|
7610
|
+
contracts: [
|
|
7611
|
+
{
|
|
7612
|
+
address: verifier,
|
|
7613
|
+
abi: MultiAttestationVerifier_default,
|
|
7614
|
+
functionName: "requiredSignatures"
|
|
7615
|
+
},
|
|
7616
|
+
{ address: verifier, abi: MultiAttestationVerifier_default, functionName: "witnesses" }
|
|
7617
|
+
]
|
|
7618
|
+
});
|
|
7619
|
+
expectBigInt(
|
|
7620
|
+
"MultiAttestationVerifier.requiredSignatures",
|
|
7621
|
+
results[0],
|
|
7622
|
+
BigInt(manifest.attestationTrust.requiredSignatures)
|
|
7623
|
+
);
|
|
7624
|
+
expectAddressSet(
|
|
7625
|
+
"MultiAttestationVerifier.witnesses",
|
|
7626
|
+
results[1],
|
|
7627
|
+
manifest.attestationTrust.witnesses
|
|
7628
|
+
);
|
|
7629
|
+
}
|
|
7630
|
+
async readAuthorizationEvents(params) {
|
|
7631
|
+
if (params.fromBlock > params.toBlock) {
|
|
7632
|
+
throw new ReadinessMismatch("authorization event range is invalid");
|
|
7633
|
+
}
|
|
7634
|
+
let logs;
|
|
7635
|
+
try {
|
|
7636
|
+
logs = await this.readAuthorizationEventRange(params, params.fromBlock, params.toBlock);
|
|
7637
|
+
} catch (cause) {
|
|
7638
|
+
if (!isLogRangeLimitError(cause)) throw cause;
|
|
7639
|
+
const ranges = fallbackBlockRanges(params.fromBlock, params.toBlock);
|
|
7640
|
+
const batches = [];
|
|
7641
|
+
for (let index = 0; index < ranges.length; index += LOG_QUERY_CONCURRENCY) {
|
|
7642
|
+
const batch = await Promise.all(
|
|
7643
|
+
ranges.slice(index, index + LOG_QUERY_CONCURRENCY).map(
|
|
7644
|
+
([fromBlock, toBlock]) => this.readAuthorizationEventRange(params, fromBlock, toBlock)
|
|
7645
|
+
)
|
|
7646
|
+
);
|
|
7647
|
+
batches.push(...batch);
|
|
7648
|
+
}
|
|
7649
|
+
logs = batches.flat();
|
|
7650
|
+
}
|
|
7651
|
+
return logs;
|
|
7652
|
+
}
|
|
7653
|
+
async readAuthorizationEventRange(params, fromBlock, toBlock) {
|
|
7654
|
+
const logs = await this.config.publicClient.getLogs({
|
|
7655
|
+
address: params.address,
|
|
7656
|
+
events: params.events,
|
|
7657
|
+
fromBlock,
|
|
7658
|
+
toBlock,
|
|
7659
|
+
strict: true
|
|
7660
|
+
});
|
|
7661
|
+
return logs.map((event) => ({
|
|
7662
|
+
eventName: event.eventName,
|
|
7663
|
+
blockNumber: event.blockNumber,
|
|
7664
|
+
transactionIndex: event.transactionIndex,
|
|
7665
|
+
logIndex: event.logIndex,
|
|
7666
|
+
args: event.args
|
|
7667
|
+
}));
|
|
7668
|
+
}
|
|
7669
|
+
async verifyExactAuthorizationSets(blockNumber, successorActive) {
|
|
7670
|
+
const { manifest, publicClient } = this.config;
|
|
7671
|
+
const identities = manifest.runtimeIdentities;
|
|
7672
|
+
const authorizations = manifest.exactAuthorizationSets;
|
|
7673
|
+
const [orchestratorEvents, lifecycleHookEvents, writers] = await Promise.all([
|
|
7674
|
+
this.readAuthorizationEvents({
|
|
7675
|
+
address: identities.OrchestratorRegistry.address,
|
|
7676
|
+
events: ORCHESTRATOR_AUTHORIZATION_EVENTS,
|
|
7677
|
+
fromBlock: BigInt(authorizations.orchestratorAuthorizationFromBlock),
|
|
7678
|
+
toBlock: blockNumber
|
|
7679
|
+
}),
|
|
7680
|
+
this.readAuthorizationEvents({
|
|
7681
|
+
address: identities.DisputeProtectionPolicy.address,
|
|
7682
|
+
events: LIFECYCLE_HOOK_AUTHORIZATION_EVENTS,
|
|
7683
|
+
fromBlock: BigInt(authorizations.lifecycleHookAuthorizationFromBlock),
|
|
7684
|
+
toBlock: blockNumber
|
|
7685
|
+
}),
|
|
7686
|
+
publicClient.readContract({
|
|
7687
|
+
address: identities.DisputeNullifierRegistry.address,
|
|
7688
|
+
abi: DisputeNullifierRegistry_default,
|
|
7689
|
+
functionName: "getWriters",
|
|
7690
|
+
blockNumber
|
|
7691
|
+
})
|
|
7692
|
+
]);
|
|
7693
|
+
const orchestratorAuthorizationEvents = orchestratorEvents.map((event) => {
|
|
7694
|
+
if (event.eventName !== "OrchestratorAdded" && event.eventName !== "OrchestratorRemoved") {
|
|
7695
|
+
throw new ReadinessMismatch("OrchestratorRegistry authorization event is malformed");
|
|
7696
|
+
}
|
|
7697
|
+
return {
|
|
7698
|
+
...event,
|
|
7699
|
+
args: {
|
|
7700
|
+
orchestrator: event.args?.orchestrator,
|
|
7701
|
+
enabled: event.eventName === "OrchestratorAdded"
|
|
7702
|
+
}
|
|
7703
|
+
};
|
|
7704
|
+
});
|
|
7705
|
+
const orchestrators = replayAddressAuthorizations(
|
|
7706
|
+
"OrchestratorRegistry authorization",
|
|
7707
|
+
orchestratorAuthorizationEvents,
|
|
7708
|
+
"orchestrator"
|
|
7709
|
+
);
|
|
7710
|
+
const lifecycleHooks = replayAddressAuthorizations(
|
|
7711
|
+
"DisputeProtectionPolicy lifecycle authorization",
|
|
7712
|
+
lifecycleHookEvents,
|
|
7713
|
+
"hook",
|
|
7714
|
+
"isAuthorized"
|
|
7715
|
+
);
|
|
7716
|
+
expectAddressSet(
|
|
7717
|
+
"OrchestratorRegistry authorized orchestrators",
|
|
7718
|
+
orchestrators,
|
|
7719
|
+
authorizations.authorizedOrchestrators
|
|
7720
|
+
);
|
|
7721
|
+
expectAddressSet(
|
|
7722
|
+
"DisputeProtectionPolicy authorized lifecycle hooks",
|
|
7723
|
+
lifecycleHooks,
|
|
7724
|
+
authorizations.authorizedLifecycleHooks
|
|
7725
|
+
);
|
|
7726
|
+
expectAddressSet(
|
|
7727
|
+
"DisputeNullifierRegistry writers",
|
|
7728
|
+
writers,
|
|
7729
|
+
successorActive ? authorizations.activeDisputeNullifierWriters : authorizations.passiveDisputeNullifierWriters
|
|
7730
|
+
);
|
|
7731
|
+
}
|
|
7732
|
+
async verifySuccessorState(blockNumber, successorActive) {
|
|
7733
|
+
const { manifest, publicClient } = this.config;
|
|
7734
|
+
const identities = manifest.runtimeIdentities;
|
|
7735
|
+
const relations = manifest.expectedRelations;
|
|
7736
|
+
const prerequisite = manifest.prerequisites;
|
|
7737
|
+
const policy = identities.DisputeProtectionPolicy.address;
|
|
7738
|
+
const riskWindows = Object.entries(manifest.riskWindowSecondsByPaymentMethod).sort(
|
|
7739
|
+
([left], [right]) => left.localeCompare(right)
|
|
7740
|
+
);
|
|
7741
|
+
const contracts = [
|
|
7742
|
+
{
|
|
7743
|
+
address: identities.IntentLifecycleHookV1.address,
|
|
7744
|
+
abi: IntentLifecycleHookV1_default,
|
|
7745
|
+
functionName: "orchestratorRegistry"
|
|
7746
|
+
},
|
|
7747
|
+
{
|
|
7748
|
+
address: identities.IntentLifecycleHookV1.address,
|
|
7749
|
+
abi: IntentLifecycleHookV1_default,
|
|
7750
|
+
functionName: "whitelistPolicy"
|
|
7751
|
+
},
|
|
7752
|
+
{
|
|
7753
|
+
address: identities.IntentLifecycleHookV1.address,
|
|
7754
|
+
abi: IntentLifecycleHookV1_default,
|
|
7755
|
+
functionName: "disputeProtectionPolicy"
|
|
7756
|
+
},
|
|
7757
|
+
{
|
|
7758
|
+
address: identities.OrchestratorRegistry.address,
|
|
7759
|
+
abi: OrchestratorRegistry_default,
|
|
7760
|
+
functionName: "isOrchestrator",
|
|
7761
|
+
args: [relations.registeredOrchestrator]
|
|
7762
|
+
},
|
|
7763
|
+
{
|
|
7764
|
+
address: identities.WhitelistPolicy.address,
|
|
7765
|
+
abi: WhitelistPolicy_default,
|
|
7766
|
+
functionName: "groupRegistry"
|
|
7767
|
+
},
|
|
7768
|
+
{
|
|
7769
|
+
address: identities.WhitelistPolicy.address,
|
|
7770
|
+
abi: WhitelistPolicy_default,
|
|
7771
|
+
functionName: "escrowRegistry"
|
|
7772
|
+
},
|
|
7773
|
+
{
|
|
7774
|
+
address: identities.WhitelistPolicy.address,
|
|
7775
|
+
abi: WhitelistPolicy_default,
|
|
7776
|
+
functionName: "orchestratorRegistry"
|
|
7777
|
+
},
|
|
7778
|
+
{ address: policy, abi: DisputeProtectionPolicy_default, functionName: "stakeVault" },
|
|
7779
|
+
{ address: policy, abi: DisputeProtectionPolicy_default, functionName: "disputeVerifier" },
|
|
7780
|
+
{
|
|
7781
|
+
address: policy,
|
|
7782
|
+
abi: DisputeProtectionPolicy_default,
|
|
7783
|
+
functionName: "disputeNullifierRegistry"
|
|
7784
|
+
},
|
|
7785
|
+
{
|
|
7786
|
+
address: policy,
|
|
7787
|
+
abi: DisputeProtectionPolicy_default,
|
|
7788
|
+
functionName: "isLifecycleHookAuthorized",
|
|
7789
|
+
args: [relations.authorizedLifecycleHook]
|
|
7790
|
+
},
|
|
7791
|
+
{ address: policy, abi: DisputeProtectionPolicy_default, functionName: "admissionsPaused" },
|
|
7792
|
+
{
|
|
7793
|
+
address: policy,
|
|
7794
|
+
abi: DisputeProtectionPolicy_default,
|
|
7795
|
+
functionName: "PENDING_COVERAGE_MATURITY"
|
|
7796
|
+
},
|
|
7797
|
+
{
|
|
7798
|
+
address: policy,
|
|
7799
|
+
abi: DisputeProtectionPolicy_default,
|
|
7800
|
+
functionName: "isDisputeProtectionEnabled",
|
|
7801
|
+
args: [manifest.sentinel.escrow, BigInt(manifest.sentinel.depositId)]
|
|
7802
|
+
},
|
|
7803
|
+
...riskWindows.map(([paymentMethod]) => ({
|
|
7804
|
+
address: policy,
|
|
7805
|
+
abi: DisputeProtectionPolicy_default,
|
|
7806
|
+
functionName: "getRiskWindow",
|
|
7807
|
+
args: [paymentMethod]
|
|
7808
|
+
})),
|
|
7809
|
+
{
|
|
7810
|
+
address: identities.DisputeVerifier.address,
|
|
7811
|
+
abi: DisputeVerifier_default,
|
|
7812
|
+
functionName: "nullifierRegistry"
|
|
7813
|
+
},
|
|
7814
|
+
{
|
|
7815
|
+
address: identities.DisputeVerifier.address,
|
|
7816
|
+
abi: DisputeVerifier_default,
|
|
7817
|
+
functionName: "attestationVerifier"
|
|
7818
|
+
},
|
|
7819
|
+
{ address: identities.StakeVault.address, abi: StakeVault_default, functionName: "controller" },
|
|
7820
|
+
{ address: identities.StakeVault.address, abi: StakeVault_default, functionName: "stakeToken" },
|
|
7821
|
+
{
|
|
7822
|
+
address: identities.StakeVault.address,
|
|
7823
|
+
abi: StakeVault_default,
|
|
7824
|
+
functionName: "pendingController"
|
|
7825
|
+
},
|
|
7826
|
+
{
|
|
7827
|
+
address: identities.StakeVault.address,
|
|
7828
|
+
abi: StakeVault_default,
|
|
7829
|
+
functionName: "pendingControllerValidAt"
|
|
7830
|
+
}
|
|
7831
|
+
];
|
|
7832
|
+
const result = await publicClient.multicall({
|
|
7833
|
+
allowFailure: false,
|
|
7834
|
+
blockNumber,
|
|
7835
|
+
// The dynamic risk-window suffix prevents viem from inferring one fixed
|
|
7836
|
+
// ABI tuple, while every entry remains assembled from packaged ABIs.
|
|
7837
|
+
contracts
|
|
7838
|
+
});
|
|
7839
|
+
expectAddress(
|
|
7840
|
+
"IntentLifecycleHookV1.orchestratorRegistry",
|
|
7841
|
+
result[0],
|
|
7842
|
+
relations.hookOrchestratorRegistry
|
|
7843
|
+
);
|
|
7844
|
+
expectAddress(
|
|
7845
|
+
"IntentLifecycleHookV1.whitelistPolicy",
|
|
7846
|
+
result[1],
|
|
7847
|
+
relations.hookWhitelistPolicy
|
|
7848
|
+
);
|
|
7849
|
+
expectAddress(
|
|
7850
|
+
"IntentLifecycleHookV1.disputeProtectionPolicy",
|
|
7851
|
+
result[2],
|
|
7852
|
+
relations.hookDisputeProtectionPolicy
|
|
7853
|
+
);
|
|
7854
|
+
expectBoolean(
|
|
7855
|
+
"OrchestratorRegistry.isOrchestrator",
|
|
7856
|
+
result[3],
|
|
7857
|
+
prerequisite.orchestratorRegistered
|
|
7858
|
+
);
|
|
7859
|
+
expectAddress("WhitelistPolicy.groupRegistry", result[4], relations.whitelistGroupRegistry);
|
|
7860
|
+
expectAddress("WhitelistPolicy.escrowRegistry", result[5], relations.whitelistEscrowRegistry);
|
|
7861
|
+
expectAddress(
|
|
7862
|
+
"WhitelistPolicy.orchestratorRegistry",
|
|
7863
|
+
result[6],
|
|
7864
|
+
relations.whitelistOrchestratorRegistry
|
|
7865
|
+
);
|
|
7866
|
+
expectAddress("DisputeProtectionPolicy.stakeVault", result[7], relations.policyStakeVault);
|
|
7867
|
+
expectAddress(
|
|
7868
|
+
"DisputeProtectionPolicy.disputeVerifier",
|
|
7869
|
+
result[8],
|
|
7870
|
+
relations.policyDisputeVerifier
|
|
7871
|
+
);
|
|
7872
|
+
expectAddress(
|
|
7873
|
+
"DisputeProtectionPolicy.disputeNullifierRegistry",
|
|
7874
|
+
result[9],
|
|
7875
|
+
relations.policyDisputeNullifierRegistry
|
|
7876
|
+
);
|
|
7877
|
+
expectBoolean(
|
|
7878
|
+
"DisputeProtectionPolicy.isLifecycleHookAuthorized",
|
|
7879
|
+
result[10],
|
|
7880
|
+
prerequisite.lifecycleHookAuthorized
|
|
7881
|
+
);
|
|
7882
|
+
if (typeof result[11] !== "boolean") {
|
|
7883
|
+
throw new ReadinessMismatch("DisputeProtectionPolicy.admissionsPaused is malformed");
|
|
7884
|
+
}
|
|
7885
|
+
const policyAdmissionsPaused = result[11];
|
|
7886
|
+
expectBigInt(
|
|
7887
|
+
"DisputeProtectionPolicy.PENDING_COVERAGE_MATURITY",
|
|
7888
|
+
result[12],
|
|
7889
|
+
BigInt(prerequisite.pendingCoverageMaturity)
|
|
7890
|
+
);
|
|
7891
|
+
expectBoolean("DisputeProtectionPolicy.sentinel", result[13], manifest.sentinel.expected);
|
|
7892
|
+
let index = 14;
|
|
7893
|
+
for (const [paymentMethod, seconds] of riskWindows) {
|
|
7894
|
+
expectBigInt(
|
|
7895
|
+
`DisputeProtectionPolicy.getRiskWindow(${paymentMethod})`,
|
|
7896
|
+
result[index],
|
|
7897
|
+
BigInt(seconds)
|
|
7898
|
+
);
|
|
7899
|
+
index += 1;
|
|
7900
|
+
}
|
|
7901
|
+
expectAddress(
|
|
7902
|
+
"DisputeVerifier.nullifierRegistry",
|
|
7903
|
+
result[index++],
|
|
7904
|
+
relations.disputeVerifierNullifierRegistry
|
|
7905
|
+
);
|
|
7906
|
+
expectAddress(
|
|
7907
|
+
"DisputeVerifier.attestationVerifier",
|
|
7908
|
+
result[index++],
|
|
7909
|
+
relations.disputeVerifierAttestationVerifier
|
|
7910
|
+
);
|
|
7911
|
+
expectAddress("StakeVault.controller", result[index++], relations.vaultController);
|
|
7912
|
+
expectAddress("StakeVault.stakeToken", result[index++], relations.vaultStakeToken);
|
|
7913
|
+
expectAddress("StakeVault.pendingController", result[index++], zeroAddress);
|
|
7914
|
+
expectBigInt("StakeVault.pendingControllerValidAt", result[index], 0n);
|
|
7915
|
+
await this.verifyGovernance(blockNumber);
|
|
7916
|
+
await this.verifyAttestationTrust(blockNumber);
|
|
7917
|
+
await this.verifyExactAuthorizationSets(blockNumber, successorActive);
|
|
7918
|
+
return policyAdmissionsPaused;
|
|
7919
|
+
}
|
|
7920
|
+
async read(options = {}) {
|
|
7921
|
+
const packageMismatch = validatePackagedIdentity(this.config);
|
|
7922
|
+
if (packageMismatch) {
|
|
7923
|
+
return {
|
|
7924
|
+
state: "mismatch",
|
|
7925
|
+
readyForDisputeProtection: false,
|
|
7926
|
+
asOfBlock: null,
|
|
7927
|
+
reason: packageMismatch
|
|
7928
|
+
};
|
|
7929
|
+
}
|
|
7930
|
+
let blockNumber = null;
|
|
7931
|
+
try {
|
|
7932
|
+
blockNumber = await this.config.publicClient.getBlockNumber();
|
|
7933
|
+
await this.verifyRuntimeIdentities(["OrchestratorV3"], blockNumber);
|
|
7934
|
+
const orchestrator = await this.readOrchestrator(blockNumber);
|
|
7935
|
+
const hook = orchestrator.lifecycleHook;
|
|
7936
|
+
const identities = this.config.manifest.runtimeIdentities;
|
|
7937
|
+
if (sameAddress(hook, zeroAddress)) {
|
|
7938
|
+
return knownResult(
|
|
7939
|
+
"verified_no_hook",
|
|
7940
|
+
false,
|
|
7941
|
+
blockNumber,
|
|
7942
|
+
this.config,
|
|
7943
|
+
hook,
|
|
7944
|
+
orchestrator.paused,
|
|
7945
|
+
orchestrator.allowMultipleIntents,
|
|
7946
|
+
null
|
|
7947
|
+
);
|
|
7948
|
+
}
|
|
7949
|
+
if (sameAddress(hook, identities.RecognizedPredecessorHook.address)) {
|
|
7950
|
+
await this.verifyRuntimeIdentities(
|
|
7951
|
+
["RecognizedPredecessorHook", "RecognizedPredecessorPolicy"],
|
|
7952
|
+
blockNumber
|
|
7953
|
+
);
|
|
7954
|
+
if (!options.verifyPassiveSuccessor) {
|
|
7955
|
+
return knownResult(
|
|
7956
|
+
"recognized_predecessor",
|
|
7957
|
+
false,
|
|
7958
|
+
blockNumber,
|
|
7959
|
+
this.config,
|
|
7960
|
+
hook,
|
|
7961
|
+
orchestrator.paused,
|
|
7962
|
+
orchestrator.allowMultipleIntents,
|
|
7963
|
+
null
|
|
7964
|
+
);
|
|
7965
|
+
}
|
|
7966
|
+
await this.verifyRuntimeIdentities(SUCCESSOR_RUNTIME_IDENTITIES, blockNumber);
|
|
7967
|
+
const policyAdmissionsPaused2 = await this.verifySuccessorState(blockNumber, false);
|
|
7968
|
+
return knownResult(
|
|
7969
|
+
"passive_successor",
|
|
7970
|
+
false,
|
|
7971
|
+
blockNumber,
|
|
7972
|
+
this.config,
|
|
7973
|
+
hook,
|
|
7974
|
+
orchestrator.paused,
|
|
7975
|
+
orchestrator.allowMultipleIntents,
|
|
7976
|
+
policyAdmissionsPaused2
|
|
7977
|
+
);
|
|
7978
|
+
}
|
|
7979
|
+
if (!sameAddress(hook, identities.IntentLifecycleHookV1.address)) {
|
|
7980
|
+
throw new ReadinessMismatch("OrchestratorV3.lifecycleHook is not a recognized deployment");
|
|
7981
|
+
}
|
|
7982
|
+
await this.verifyRuntimeIdentities(SUCCESSOR_RUNTIME_IDENTITIES, blockNumber);
|
|
7983
|
+
const policyAdmissionsPaused = await this.verifySuccessorState(blockNumber, true);
|
|
7984
|
+
const readyForDisputeProtection = orchestrator.paused === this.config.manifest.prerequisites.orchestratorPaused && orchestrator.allowMultipleIntents === this.config.manifest.prerequisites.allowMultipleIntents && policyAdmissionsPaused === this.config.manifest.prerequisites.admissionsPaused;
|
|
7985
|
+
return knownResult(
|
|
7986
|
+
"active_successor_verified",
|
|
7987
|
+
readyForDisputeProtection,
|
|
7988
|
+
blockNumber,
|
|
7989
|
+
this.config,
|
|
7990
|
+
hook,
|
|
7991
|
+
orchestrator.paused,
|
|
7992
|
+
orchestrator.allowMultipleIntents,
|
|
7993
|
+
policyAdmissionsPaused
|
|
7994
|
+
);
|
|
7995
|
+
} catch (error) {
|
|
7996
|
+
return {
|
|
7997
|
+
state: "mismatch",
|
|
7998
|
+
readyForDisputeProtection: false,
|
|
7999
|
+
asOfBlock: blockNumber,
|
|
8000
|
+
reason: error instanceof ReadinessMismatch ? error.message : `dispute readiness RPC failed: ${error instanceof Error ? error.message : String(error)}`
|
|
8001
|
+
};
|
|
8002
|
+
}
|
|
8003
|
+
}
|
|
8004
|
+
};
|
|
8005
|
+
function createDisputeProtectionReadinessReader(params) {
|
|
8006
|
+
return new DisputeProtectionReadinessReader({
|
|
8007
|
+
publicClient: params.publicClient,
|
|
8008
|
+
chainId: params.chainId,
|
|
8009
|
+
manifest: manifestForEnvironment(params.environment),
|
|
8010
|
+
buildMetadata: SDK_BUILD_METADATA,
|
|
8011
|
+
contractsPackageVersion: version
|
|
8012
|
+
});
|
|
8013
|
+
}
|
|
8014
|
+
|
|
6504
8015
|
// src/indexer/intentVerification.ts
|
|
6505
8016
|
async function fetchFulfillmentAndPayment(client, intentHash) {
|
|
6506
8017
|
return client.query({
|
|
@@ -6870,17 +8381,19 @@ var Zkp2pClient = class {
|
|
|
6870
8381
|
"clearStakeOwner",
|
|
6871
8382
|
() => []
|
|
6872
8383
|
);
|
|
8384
|
+
/** Enable or disable dispute protection for one deposit. */
|
|
8385
|
+
this.setDisputeProtectionEnabled = this.buildDisputeProtectionPolicyMethod("setDisputeProtectionEnabled", (params) => [params.escrow, params.depositId, params.enabled]);
|
|
6873
8386
|
/**
|
|
6874
|
-
* Release one
|
|
6875
|
-
* stake cover. Permissionless once mature. Pass `
|
|
8387
|
+
* Release one protected intent whose risk window matured, unlocking its
|
|
8388
|
+
* stake cover. Permissionless once mature. Pass `disputeProtectionPolicyAddress` to
|
|
6876
8389
|
* pin the transaction to a snapshotted deployment.
|
|
6877
8390
|
*/
|
|
6878
|
-
this.
|
|
8391
|
+
this.releaseMaturedDisputeProtectionIntent = this.buildDisputeProtectionPolicyMethod("releaseMaturedDisputeProtectionIntent", (params) => [params.intentHash]);
|
|
6879
8392
|
/**
|
|
6880
|
-
* Release multiple matured
|
|
6881
|
-
* Pass `
|
|
8393
|
+
* Release multiple matured protected intents in one transaction.
|
|
8394
|
+
* Pass `disputeProtectionPolicyAddress` to pin the transaction to a snapshotted deployment.
|
|
6882
8395
|
*/
|
|
6883
|
-
this.
|
|
8396
|
+
this.releaseMaturedDisputeProtectionIntents = this.buildDisputeProtectionPolicyMethod("releaseMaturedDisputeProtectionIntents", (params) => [params.intentHashes]);
|
|
6884
8397
|
// ╔═══════════════════════════════════════════════════════════════════════════╗
|
|
6885
8398
|
// ║ CORE: DEPOSIT MANAGEMENT ║
|
|
6886
8399
|
// ╚═══════════════════════════════════════════════════════════════════════════╝
|
|
@@ -7746,6 +9259,11 @@ var Zkp2pClient = class {
|
|
|
7746
9259
|
chain: selectedChain,
|
|
7747
9260
|
transport: opts.rpcTransport ?? http(rpc, { batch: false })
|
|
7748
9261
|
});
|
|
9262
|
+
this._disputeProtectionReadinessReader = createDisputeProtectionReadinessReader({
|
|
9263
|
+
publicClient: this.publicClient,
|
|
9264
|
+
chainId: this.chainId,
|
|
9265
|
+
environment: this.runtimeEnv
|
|
9266
|
+
});
|
|
7749
9267
|
const { addresses, abis } = getContracts(this.chainId, this.runtimeEnv);
|
|
7750
9268
|
const toAddress = (value) => this.isValidHexAddress(value) ? value : void 0;
|
|
7751
9269
|
const uniqAddresses = (values) => {
|
|
@@ -7813,8 +9331,8 @@ var Zkp2pClient = class {
|
|
|
7813
9331
|
this.intentGuardianAbi = abis.intentGuardian;
|
|
7814
9332
|
this.stakeVaultAddress = toAddress(addresses.stakeVault);
|
|
7815
9333
|
this.stakeVaultAbi = abis.stakeVault;
|
|
7816
|
-
this.
|
|
7817
|
-
this.
|
|
9334
|
+
this.disputeProtectionPolicyAddress = toAddress(addresses.disputeProtectionPolicy);
|
|
9335
|
+
this.disputeProtectionPolicyAbi = abis.disputeProtectionPolicy;
|
|
7818
9336
|
if (!this.rateManagerRegistryAddress || !this.rateManagerRegistryAbi) {
|
|
7819
9337
|
try {
|
|
7820
9338
|
const rateManagerContracts = getRateManagerContracts(this.chainId, this.runtimeEnv);
|
|
@@ -7904,8 +9422,8 @@ var Zkp2pClient = class {
|
|
|
7904
9422
|
getStakeVaultAddress: () => this.stakeVaultAddress,
|
|
7905
9423
|
getStakeVaultAbi: () => this.stakeVaultAbi,
|
|
7906
9424
|
getStakeTokenAddress: () => this._usdcAddress,
|
|
7907
|
-
|
|
7908
|
-
|
|
9425
|
+
getDisputeProtectionPolicyAddress: () => this.disputeProtectionPolicyAddress,
|
|
9426
|
+
getDisputeProtectionPolicyAbi: () => this.disputeProtectionPolicyAbi
|
|
7909
9427
|
});
|
|
7910
9428
|
this._intentGuardianOps = new IntentGuardianOperations({
|
|
7911
9429
|
getPublicClient: () => this.publicClient,
|
|
@@ -8246,7 +9764,7 @@ var Zkp2pClient = class {
|
|
|
8246
9764
|
const escrowAbi = opts.escrowAbi ?? this.escrowAbi;
|
|
8247
9765
|
if (!escrowAddress || !escrowAbi) throw new Error("Escrow not available");
|
|
8248
9766
|
const { referrer, value } = opts.txOverrides ?? {};
|
|
8249
|
-
const
|
|
9767
|
+
const data3 = encodeWithAttribution(
|
|
8250
9768
|
{
|
|
8251
9769
|
abi: escrowAbi,
|
|
8252
9770
|
functionName: opts.functionName,
|
|
@@ -8256,7 +9774,7 @@ var Zkp2pClient = class {
|
|
|
8256
9774
|
);
|
|
8257
9775
|
return {
|
|
8258
9776
|
to: escrowAddress,
|
|
8259
|
-
data,
|
|
9777
|
+
data: data3,
|
|
8260
9778
|
value: opts.value ?? value ?? 0n,
|
|
8261
9779
|
chainId: this.chainId,
|
|
8262
9780
|
abi: escrowAbi,
|
|
@@ -8269,7 +9787,7 @@ var Zkp2pClient = class {
|
|
|
8269
9787
|
const orchestratorAbi = opts.orchestratorAbi ?? this.orchestratorAbi;
|
|
8270
9788
|
if (!orchestratorAddress || !orchestratorAbi) throw new Error("Orchestrator not available");
|
|
8271
9789
|
const { referrer, value } = opts.txOverrides ?? {};
|
|
8272
|
-
const
|
|
9790
|
+
const data3 = encodeWithAttribution(
|
|
8273
9791
|
{
|
|
8274
9792
|
abi: orchestratorAbi,
|
|
8275
9793
|
functionName: opts.functionName,
|
|
@@ -8279,7 +9797,7 @@ var Zkp2pClient = class {
|
|
|
8279
9797
|
);
|
|
8280
9798
|
return {
|
|
8281
9799
|
to: orchestratorAddress,
|
|
8282
|
-
data,
|
|
9800
|
+
data: data3,
|
|
8283
9801
|
value: opts.value ?? value ?? 0n,
|
|
8284
9802
|
chainId: this.chainId,
|
|
8285
9803
|
abi: orchestratorAbi,
|
|
@@ -8300,7 +9818,7 @@ var Zkp2pClient = class {
|
|
|
8300
9818
|
}
|
|
8301
9819
|
prepareContractTransaction(opts) {
|
|
8302
9820
|
const { referrer, value } = opts.txOverrides ?? {};
|
|
8303
|
-
const
|
|
9821
|
+
const data3 = encodeWithAttribution(
|
|
8304
9822
|
{
|
|
8305
9823
|
abi: opts.abi,
|
|
8306
9824
|
functionName: opts.functionName,
|
|
@@ -8310,7 +9828,7 @@ var Zkp2pClient = class {
|
|
|
8310
9828
|
);
|
|
8311
9829
|
return {
|
|
8312
9830
|
to: opts.address,
|
|
8313
|
-
data,
|
|
9831
|
+
data: data3,
|
|
8314
9832
|
value: opts.value ?? value ?? 0n,
|
|
8315
9833
|
chainId: this.chainId,
|
|
8316
9834
|
abi: opts.abi,
|
|
@@ -8370,12 +9888,12 @@ var Zkp2pClient = class {
|
|
|
8370
9888
|
buildArgs
|
|
8371
9889
|
);
|
|
8372
9890
|
}
|
|
8373
|
-
|
|
9891
|
+
buildDisputeProtectionPolicyMethod(functionName, buildArgs) {
|
|
8374
9892
|
return this.buildContractMethod(
|
|
8375
9893
|
(params) => ({
|
|
8376
|
-
address: params.
|
|
8377
|
-
abi: this.
|
|
8378
|
-
label: "
|
|
9894
|
+
address: params.disputeProtectionPolicyAddress ?? this.disputeProtectionPolicyAddress,
|
|
9895
|
+
abi: this.disputeProtectionPolicyAbi,
|
|
9896
|
+
label: "DisputeProtectionPolicy"
|
|
8379
9897
|
}),
|
|
8380
9898
|
functionName,
|
|
8381
9899
|
buildArgs
|
|
@@ -8778,6 +10296,20 @@ var Zkp2pClient = class {
|
|
|
8778
10296
|
signal: options?.signal
|
|
8779
10297
|
});
|
|
8780
10298
|
},
|
|
10299
|
+
/** Pages stake-owner locks by immutable lock identity. */
|
|
10300
|
+
getStakeLocks: (params, options) => {
|
|
10301
|
+
return stakingService.fetchStakeLocks(params, { signal: options?.signal });
|
|
10302
|
+
},
|
|
10303
|
+
/** Pages append-only activity relevant to either side of a merchant's stake delegation. */
|
|
10304
|
+
getStakeActivity: (params, options) => {
|
|
10305
|
+
return stakingService.fetchStakeActivity(params, { signal: options?.signal });
|
|
10306
|
+
},
|
|
10307
|
+
/** Pages the exact active policy's finalized dispute stream. */
|
|
10308
|
+
getDisputeProtectionIntents: (params, options) => {
|
|
10309
|
+
return stakingService.fetchDisputeProtectionIntents(params, {
|
|
10310
|
+
signal: options?.signal
|
|
10311
|
+
});
|
|
10312
|
+
},
|
|
8781
10313
|
/**
|
|
8782
10314
|
* Fetches chronological fund activities for a specific deposit.
|
|
8783
10315
|
*/
|
|
@@ -8877,12 +10409,12 @@ var Zkp2pClient = class {
|
|
|
8877
10409
|
}
|
|
8878
10410
|
return { address: this.orchestratorV3Address, abi: this.orchestratorV3Abi };
|
|
8879
10411
|
}
|
|
8880
|
-
/** Return the resolved
|
|
8881
|
-
|
|
8882
|
-
if (!this.
|
|
8883
|
-
throw new Error("
|
|
10412
|
+
/** Return the resolved DisputeProtectionPolicy coordinates for keeper integrations. */
|
|
10413
|
+
getDisputeProtectionPolicyContract() {
|
|
10414
|
+
if (!this.disputeProtectionPolicyAddress || !this.disputeProtectionPolicyAbi) {
|
|
10415
|
+
throw new Error("DisputeProtectionPolicy not available for this chain/environment");
|
|
8884
10416
|
}
|
|
8885
|
-
return { address: this.
|
|
10417
|
+
return { address: this.disputeProtectionPolicyAddress, abi: this.disputeProtectionPolicyAbi };
|
|
8886
10418
|
}
|
|
8887
10419
|
/**
|
|
8888
10420
|
* Ensure the connected wallet has approved enough USDC for StakeVault.
|
|
@@ -8930,10 +10462,14 @@ var Zkp2pClient = class {
|
|
|
8930
10462
|
getStakeVaultState(params) {
|
|
8931
10463
|
return this._stakeOps.getStakeVaultState(params);
|
|
8932
10464
|
}
|
|
8933
|
-
/** Read whether the
|
|
10465
|
+
/** Read whether the DisputeProtectionPolicy is refusing new dispute-protected admissions. */
|
|
8934
10466
|
getAdmissionsPaused() {
|
|
8935
10467
|
return this._stakeOps.getAdmissionsPaused();
|
|
8936
10468
|
}
|
|
10469
|
+
/** Prove the exact packaged dispute-protection deployment at one block. */
|
|
10470
|
+
getDisputeProtectionReadiness(options) {
|
|
10471
|
+
return this._disputeProtectionReadinessReader.read(options);
|
|
10472
|
+
}
|
|
8937
10473
|
/**
|
|
8938
10474
|
* Read a payment method's minimum collateral lock window in seconds. Zero
|
|
8939
10475
|
* means the method admits unbonded — no stake is locked at admission.
|
|
@@ -8941,9 +10477,9 @@ var Zkp2pClient = class {
|
|
|
8941
10477
|
getRiskWindow(paymentMethodHash) {
|
|
8942
10478
|
return this._stakeOps.getRiskWindow(paymentMethodHash);
|
|
8943
10479
|
}
|
|
8944
|
-
/** Read whether an escrow deposit has opted into
|
|
8945
|
-
|
|
8946
|
-
return this._stakeOps.
|
|
10480
|
+
/** Read whether an escrow deposit has opted into dispute protection. */
|
|
10481
|
+
isDisputeProtectionEnabled(escrow, depositId) {
|
|
10482
|
+
return this._stakeOps.isDisputeProtectionEnabled(escrow, depositId);
|
|
8947
10483
|
}
|
|
8948
10484
|
/**
|
|
8949
10485
|
* Registers payee details with the curator API and returns hashed on-chain IDs.
|
|
@@ -9146,7 +10682,7 @@ var Zkp2pClient = class {
|
|
|
9146
10682
|
}
|
|
9147
10683
|
}
|
|
9148
10684
|
});
|
|
9149
|
-
const { mapConversionRatesToOnchainMinRate: mapConversionRatesToOnchainMinRate2 } = await import('./currency-
|
|
10685
|
+
const { mapConversionRatesToOnchainMinRate: mapConversionRatesToOnchainMinRate2 } = await import('./currency-Y5CH6IXG.mjs');
|
|
9150
10686
|
currencies = mapConversionRatesToOnchainMinRate2(
|
|
9151
10687
|
params.conversionRates,
|
|
9152
10688
|
paymentMethods.length
|
|
@@ -9742,7 +11278,7 @@ var Zkp2pClient = class {
|
|
|
9742
11278
|
rateManagerV1: this.rateManagerV1Address,
|
|
9743
11279
|
orchestratorRegistry: this.orchestratorRegistryAddress,
|
|
9744
11280
|
stakeVault: this.stakeVaultAddress,
|
|
9745
|
-
|
|
11281
|
+
disputeProtectionPolicy: this.disputeProtectionPolicyAddress,
|
|
9746
11282
|
usdc: this._usdcAddress
|
|
9747
11283
|
};
|
|
9748
11284
|
}
|
|
@@ -9832,17 +11368,17 @@ function integer(value, label) {
|
|
|
9832
11368
|
if (parsed < 0n) throw new RangeError(`${label} must be non-negative`);
|
|
9833
11369
|
return parsed;
|
|
9834
11370
|
}
|
|
9835
|
-
function calculateRequiredCoverage(amount,
|
|
9836
|
-
return
|
|
11371
|
+
function calculateRequiredCoverage(amount, disputeProtected) {
|
|
11372
|
+
return disputeProtected ? integer(amount, "amount") : 0n;
|
|
9837
11373
|
}
|
|
9838
11374
|
function calculateStakeBackedCapacity(freeStake) {
|
|
9839
11375
|
return integer(freeStake, "freeStake");
|
|
9840
11376
|
}
|
|
9841
|
-
function selectRiskMode(amount, freeStake,
|
|
9842
|
-
const required = calculateRequiredCoverage(amount,
|
|
9843
|
-
if (!
|
|
11377
|
+
function selectRiskMode(amount, freeStake, disputeProtected) {
|
|
11378
|
+
const required = calculateRequiredCoverage(amount, disputeProtected);
|
|
11379
|
+
if (!disputeProtected) return "UNBONDED";
|
|
9844
11380
|
if (integer(freeStake, "freeStake") >= required) return "STAKE_BACKED";
|
|
9845
|
-
throw new RangeError("insufficient free stake for
|
|
11381
|
+
throw new RangeError("insufficient free stake for dispute-protected admission");
|
|
9846
11382
|
}
|
|
9847
11383
|
|
|
9848
11384
|
// src/client/accessPolicyPlan.ts
|
|
@@ -10001,6 +11537,6 @@ var planAccessPolicyUpdate = (persistedInput, draftInput) => {
|
|
|
10001
11537
|
};
|
|
10002
11538
|
};
|
|
10003
11539
|
|
|
10004
|
-
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, 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 };
|
|
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 };
|
|
10005
11541
|
//# sourceMappingURL=index.mjs.map
|
|
10006
11542
|
//# sourceMappingURL=index.mjs.map
|