@zkp2p/sdk 0.12.2-rc.2 → 0.12.2-rc.4
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 +26 -10
- package/dist/build-metadata.json +9 -9
- package/dist/{chunk-67JSDBUL.mjs → chunk-6XJOOLD5.mjs} +1251 -155
- package/dist/chunk-6XJOOLD5.mjs.map +1 -0
- package/dist/chunk-ALXVPWTM.mjs +12 -0
- package/dist/chunk-ALXVPWTM.mjs.map +1 -0
- package/dist/{currency-Y5CH6IXG.mjs → currency-KBPBKLN2.mjs} +3 -3
- package/dist/{currency-Y5CH6IXG.mjs.map → currency-KBPBKLN2.mjs.map} +1 -1
- package/dist/index.cjs +5653 -740
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +6 -6
- package/dist/index.d.ts +6 -6
- package/dist/index.mjs +968 -359
- package/dist/index.mjs.map +1 -1
- package/dist/protocolViewerParsers-CB3CJ2TB.mjs +5 -0
- package/dist/{protocolViewerParsers-QE6LWS3W.mjs.map → protocolViewerParsers-CB3CJ2TB.mjs.map} +1 -1
- package/dist/react.d.mts +2 -2
- package/dist/react.d.ts +2 -2
- package/dist/react.mjs +1 -1
- package/dist/{timeout-CQ4Y2Z4T.mjs → timeout-EL45PCAU.mjs} +3 -3
- package/dist/{timeout-CQ4Y2Z4T.mjs.map → timeout-EL45PCAU.mjs.map} +1 -1
- package/dist/{vaultUtils-Dla_eG15.d.mts → vaultUtils-D9um2feo.d.mts} +74 -138
- package/dist/{vaultUtils-Dla_eG15.d.ts → vaultUtils-D9um2feo.d.ts} +74 -138
- package/package.json +4 -4
- package/dist/chunk-67JSDBUL.mjs.map +0 -1
- package/dist/chunk-UQEKVVIN.mjs +0 -12
- package/dist/chunk-UQEKVVIN.mjs.map +0 -1
- package/dist/protocolViewerParsers-QE6LWS3W.mjs +0 -5
package/dist/index.mjs
CHANGED
|
@@ -2,15 +2,15 @@ import { IntentGuardianOperations } from './chunk-YA67SM3A.mjs';
|
|
|
2
2
|
export { ZERO_RATE_MANAGER_ID, classifyDelegationState, classifyIntentGuardianError, getDelegationRoute, isZeroRateManagerId, normalizeRateManagerId, normalizeRegistry } from './chunk-YA67SM3A.mjs';
|
|
3
3
|
import { NetworkError, ValidationError, APIError } from './chunk-3J4FPMPW.mjs';
|
|
4
4
|
export { APIError, ContractError, ErrorCode, NetworkError, ValidationError, ZKP2PError } from './chunk-3J4FPMPW.mjs';
|
|
5
|
-
import { OrchestratorRegistry_default, DisputeProtectionPolicy_default, METHOD_NAME_TO_HASH, matchesQuotePaymentMethod, matchesPaymentMethodNameAndHash, getContracts, getRateManagerContracts, getPaymentMethodsCatalog, resolvePaymentMethodHashFromCatalog, getGatingServiceAddress, parseBigIntLike, SUPPORTED_PAYMENT_METHOD_HASHES, resolveFiatCurrencyBytes32, resolvePaymentMethodNameFromHash, OrchestratorV3_default,
|
|
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-
|
|
5
|
+
import { OrchestratorRegistry_default, DISPUTE_PROTECTION_POLICY_ABI, DisputeProtectionPolicy_default, METHOD_NAME_TO_HASH, matchesQuotePaymentMethod, matchesPaymentMethodNameAndHash, MultiAttestationVerifier_default, getContracts, getRateManagerContracts, getPaymentMethodsCatalog, resolvePaymentMethodHashFromCatalog, getGatingServiceAddress, parseBigIntLike, SUPPORTED_PAYMENT_METHOD_HASHES, resolveFiatCurrencyBytes32, resolvePaymentMethodNameFromHash, OrchestratorV3_default, DisputeNullifierRegistry_default, DisputeVerifier_default, WhitelistPolicy_default, StakeVault_default, IntentLifecycleHookV1_default } from './chunk-6XJOOLD5.mjs';
|
|
6
|
+
export { DISPUTE_PROTECTION_POLICY_ABI2 as DISPUTE_PROTECTION_POLICY_ABI, ORCHESTRATOR_V3_ABI, PAYMENT_PLATFORMS, STAKE_VAULT_ABI, asciiToBytes32, enrichPvDepositView, enrichPvIntentView, ensureBytes32, getContracts, getDisputeProtectionPolicyContract, getGatingServiceAddress, getIntentGuardianContract, getOrchestratorV3Contract, getPaymentMethodsCatalog, getRateManagerContracts, getStakeVaultContract, hasIntentGuardian, parseDepositView, parseIntentView, resolveFiatCurrencyBytes32, resolvePaymentMethodHash, resolvePaymentMethodHashFromCatalog, resolvePaymentMethodNameFromHash } from './chunk-6XJOOLD5.mjs';
|
|
7
7
|
import { Currency, currencyKeccak256 } from './chunk-ZB22BZLZ.mjs';
|
|
8
8
|
export { Currency, currencyInfo, getCurrencyCodeFromHash, getCurrencyInfoFromCountryCode, getCurrencyInfoFromHash, isSupportedCurrencyHash, mapConversionRatesToOnchainMinRate } from './chunk-ZB22BZLZ.mjs';
|
|
9
|
-
import { define_ZKP2P_SDK_BUILD_METADATA_default } from './chunk-
|
|
10
|
-
import { concatHex, encodeFunctionData, encodeAbiParameters, createPublicClient, http, isAddress, zeroAddress,
|
|
9
|
+
import { define_ZKP2P_SDK_BUILD_METADATA_default } from './chunk-ALXVPWTM.mjs';
|
|
10
|
+
import { keccak256, concatHex, encodeFunctionData, encodeAbiParameters, createPublicClient, http, isAddress, zeroAddress, formatUnits } from 'viem';
|
|
11
11
|
import { hardhat, base } from 'viem/chains';
|
|
12
12
|
import { createEncryptedBuyerTeeSessionMaterial as createEncryptedBuyerTeeSessionMaterial$1, createEncryptedSellerCredentialUpload } from '@zkp2p/zkp2p-attestation';
|
|
13
|
-
export { createNitroAttestationClient } from '@zkp2p/zkp2p-attestation';
|
|
13
|
+
export { createNitroAttestationClient, verifyDisputeAttestation } from '@zkp2p/zkp2p-attestation';
|
|
14
14
|
import { AbiCoder } from 'ethers';
|
|
15
15
|
import { Attribution } from 'ox/erc8021';
|
|
16
16
|
|
|
@@ -352,12 +352,12 @@ function parseAPIError(response, responseText) {
|
|
|
352
352
|
}
|
|
353
353
|
return new APIError(message, response.status, { url: response.url, responseBody: parsedBody });
|
|
354
354
|
}
|
|
355
|
-
async function withRetry(fn, maxRetries = 3, delayMs = 1e3, timeoutMs) {
|
|
355
|
+
async function withRetry(fn, maxRetries = 3, delayMs = 1e3, timeoutMs, shouldRetry) {
|
|
356
356
|
let lastErr;
|
|
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-EL45PCAU.mjs');
|
|
361
361
|
return await withTimeout(fn(), timeoutMs, `Operation timed out after ${timeoutMs}ms`);
|
|
362
362
|
}
|
|
363
363
|
return await fn();
|
|
@@ -365,7 +365,7 @@ async function withRetry(fn, maxRetries = 3, delayMs = 1e3, timeoutMs) {
|
|
|
365
365
|
lastErr = err;
|
|
366
366
|
const isNetwork = err instanceof NetworkError;
|
|
367
367
|
const isRateLimit = err instanceof APIError && err.status === 429;
|
|
368
|
-
const retryable = isNetwork || isRateLimit;
|
|
368
|
+
const retryable = isNetwork || isRateLimit || shouldRetry?.(err) === true;
|
|
369
369
|
if (!retryable || i === maxRetries - 1) throw err;
|
|
370
370
|
const base2 = isRateLimit ? delayMs * Math.pow(2, i) : delayMs;
|
|
371
371
|
const jitter = Math.floor(Math.random() * Math.min(1e3, base2));
|
|
@@ -377,6 +377,8 @@ async function withRetry(fn, maxRetries = 3, delayMs = 1e3, timeoutMs) {
|
|
|
377
377
|
|
|
378
378
|
// src/adapters/verification.ts
|
|
379
379
|
var ENFORCED_ON_CHAIN_MESSAGE = /enforced on-chain/i;
|
|
380
|
+
var RETRYABLE_SIGN_INTENT_STATUSES = /* @__PURE__ */ new Set([500, 502, 503, 504]);
|
|
381
|
+
var isRetryableSignIntentError = (error) => error instanceof APIError && error.status !== void 0 && RETRYABLE_SIGN_INTENT_STATUSES.has(error.status);
|
|
380
382
|
var readCuratorMessage = (body) => {
|
|
381
383
|
try {
|
|
382
384
|
const parsed = JSON.parse(body);
|
|
@@ -418,7 +420,8 @@ async function apiSignIntentV3Raw(request, opts) {
|
|
|
418
420
|
},
|
|
419
421
|
3,
|
|
420
422
|
1e3,
|
|
421
|
-
opts.timeoutMs
|
|
423
|
+
opts.timeoutMs,
|
|
424
|
+
isRetryableSignIntentError
|
|
422
425
|
);
|
|
423
426
|
}
|
|
424
427
|
async function apiSignIntentV3(request, opts) {
|
|
@@ -535,6 +538,7 @@ function createAttestationTransport(primaryBaseUrl, options = {}) {
|
|
|
535
538
|
}
|
|
536
539
|
|
|
537
540
|
// src/adapters/attestation.ts
|
|
541
|
+
var isAttestationMaterialTimeout = (error) => error instanceof Error && "code" in error && error.code === "TIMEOUT";
|
|
538
542
|
function headers() {
|
|
539
543
|
return { "Content-Type": "application/json" };
|
|
540
544
|
}
|
|
@@ -552,35 +556,42 @@ async function createEncryptedSellerCredentialUploadForPlatform({
|
|
|
552
556
|
platform,
|
|
553
557
|
timeoutMs
|
|
554
558
|
}) {
|
|
555
|
-
|
|
556
|
-
if (
|
|
557
|
-
|
|
559
|
+
try {
|
|
560
|
+
if (platform === "wise") {
|
|
561
|
+
if (!isWiseCredentialUploadInput(payload)) {
|
|
562
|
+
throw new Error("apiToken is required for wise seller credential uploads");
|
|
563
|
+
}
|
|
564
|
+
return await createEncryptedSellerCredentialUpload({
|
|
565
|
+
attestationServiceUrl,
|
|
566
|
+
platform: "wise",
|
|
567
|
+
...payload.callerAddress ? { callerAddress: payload.callerAddress } : {},
|
|
568
|
+
sessionMaterial: payload.sessionMaterial,
|
|
569
|
+
...typeof timeoutMs === "number" ? { timeoutMs } : {},
|
|
570
|
+
fetch: attestationTransport.fetch,
|
|
571
|
+
...cryptoRuntime?.subtle ? { subtle: cryptoRuntime.subtle } : {},
|
|
572
|
+
...cryptoRuntime?.getRandomValues ? { getRandomValues: cryptoRuntime.getRandomValues } : {}
|
|
573
|
+
});
|
|
574
|
+
}
|
|
575
|
+
if (!isPayeeBoundSellerCredentialUploadInput(payload)) {
|
|
576
|
+
throw new Error(`payeeId is required for ${platform} seller credential uploads`);
|
|
558
577
|
}
|
|
559
|
-
return createEncryptedSellerCredentialUpload({
|
|
578
|
+
return await createEncryptedSellerCredentialUpload({
|
|
560
579
|
attestationServiceUrl,
|
|
561
|
-
platform
|
|
580
|
+
platform,
|
|
562
581
|
...payload.callerAddress ? { callerAddress: payload.callerAddress } : {},
|
|
582
|
+
payeeId: payload.payeeId,
|
|
563
583
|
sessionMaterial: payload.sessionMaterial,
|
|
564
584
|
...typeof timeoutMs === "number" ? { timeoutMs } : {},
|
|
565
585
|
fetch: attestationTransport.fetch,
|
|
566
586
|
...cryptoRuntime?.subtle ? { subtle: cryptoRuntime.subtle } : {},
|
|
567
587
|
...cryptoRuntime?.getRandomValues ? { getRandomValues: cryptoRuntime.getRandomValues } : {}
|
|
568
588
|
});
|
|
589
|
+
} catch (error) {
|
|
590
|
+
if (isAttestationMaterialTimeout(error)) {
|
|
591
|
+
throw new NetworkError(error.message, { cause: error });
|
|
592
|
+
}
|
|
593
|
+
throw error;
|
|
569
594
|
}
|
|
570
|
-
if (!isPayeeBoundSellerCredentialUploadInput(payload)) {
|
|
571
|
-
throw new Error(`payeeId is required for ${platform} seller credential uploads`);
|
|
572
|
-
}
|
|
573
|
-
return createEncryptedSellerCredentialUpload({
|
|
574
|
-
attestationServiceUrl,
|
|
575
|
-
platform,
|
|
576
|
-
...payload.callerAddress ? { callerAddress: payload.callerAddress } : {},
|
|
577
|
-
payeeId: payload.payeeId,
|
|
578
|
-
sessionMaterial: payload.sessionMaterial,
|
|
579
|
-
...typeof timeoutMs === "number" ? { timeoutMs } : {},
|
|
580
|
-
fetch: attestationTransport.fetch,
|
|
581
|
-
...cryptoRuntime?.subtle ? { subtle: cryptoRuntime.subtle } : {},
|
|
582
|
-
...cryptoRuntime?.getRandomValues ? { getRandomValues: cryptoRuntime.getRandomValues } : {}
|
|
583
|
-
});
|
|
584
595
|
}
|
|
585
596
|
async function apiVerifyBuyerTeePayment(payload, attestationServiceUrl, platform, actionType, options = {}) {
|
|
586
597
|
return withRetry(async () => {
|
|
@@ -852,7 +863,7 @@ async function sendTransactionWithAttribution(walletClient, request, referrer, o
|
|
|
852
863
|
// src/utils/constants.ts
|
|
853
864
|
var DEFAULT_BASE_API_URL = "https://api.zkp2p.xyz";
|
|
854
865
|
|
|
855
|
-
// ../../node_modules/.pnpm/@zkp2p+contracts-v2@0.4.1-rc.
|
|
866
|
+
// ../../node_modules/.pnpm/@zkp2p+contracts-v2@0.4.1-rc.9_ethers@6.16.0_bufferutil@4.1.0_utf-8-validate@5.0.10__typescript@5.9.3_zod@4.5.4/node_modules/@zkp2p/contracts-v2/oracleFeeds/chainlink.json
|
|
856
867
|
var chainlink_default = {
|
|
857
868
|
feeds: [
|
|
858
869
|
{
|
|
@@ -1898,7 +1909,7 @@ var ProtocolViewerReader = class {
|
|
|
1898
1909
|
if (inputCount === null) {
|
|
1899
1910
|
throw new Error("Configured ProtocolViewer ABI does not expose getDeposit");
|
|
1900
1911
|
}
|
|
1901
|
-
const { parseDepositView: parseDepositView2 } = await import('./protocolViewerParsers-
|
|
1912
|
+
const { parseDepositView: parseDepositView2 } = await import('./protocolViewerParsers-CB3CJ2TB.mjs');
|
|
1902
1913
|
if (inputCount >= 3) {
|
|
1903
1914
|
return tryContexts(
|
|
1904
1915
|
protocolViewerContexts,
|
|
@@ -1984,7 +1995,7 @@ var ProtocolViewerReader = class {
|
|
|
1984
1995
|
return Promise.all(ids.map((id) => this.config.host.getPvDepositById(id)));
|
|
1985
1996
|
}
|
|
1986
1997
|
const bn = ids.map((id) => typeof id === "bigint" ? id : parseRawDepositId(id));
|
|
1987
|
-
const { parseDepositView: parseDepositView2 } = await import('./protocolViewerParsers-
|
|
1998
|
+
const { parseDepositView: parseDepositView2 } = await import('./protocolViewerParsers-CB3CJ2TB.mjs');
|
|
1988
1999
|
if (inputCount >= 2) {
|
|
1989
2000
|
const requests = ids.map((id, index) => ({
|
|
1990
2001
|
index,
|
|
@@ -2089,7 +2100,7 @@ var ProtocolViewerReader = class {
|
|
|
2089
2100
|
if (!protocolViewerAddress || !protocolViewerAbi || inputCount === null) {
|
|
2090
2101
|
return this.config.host.getPvAccountDepositsFromIndexer(owner);
|
|
2091
2102
|
}
|
|
2092
|
-
const { parseDepositView: parseDepositView2 } = await import('./protocolViewerParsers-
|
|
2103
|
+
const { parseDepositView: parseDepositView2 } = await import('./protocolViewerParsers-CB3CJ2TB.mjs');
|
|
2093
2104
|
const { address, abi } = this.config.host.requireProtocolViewer();
|
|
2094
2105
|
if (inputCount >= 2) {
|
|
2095
2106
|
const readAndFilter = async (raw2) => {
|
|
@@ -2160,7 +2171,7 @@ var ProtocolViewerReader = class {
|
|
|
2160
2171
|
if (protocolViewerEntries.length === 0) {
|
|
2161
2172
|
throw new Error("ProtocolViewer not available for this network");
|
|
2162
2173
|
}
|
|
2163
|
-
const { parseIntentView: parseIntentView2 } = await import('./protocolViewerParsers-
|
|
2174
|
+
const { parseIntentView: parseIntentView2 } = await import('./protocolViewerParsers-CB3CJ2TB.mjs');
|
|
2164
2175
|
const intentsByHash = /* @__PURE__ */ new Map();
|
|
2165
2176
|
let attemptedRead = false;
|
|
2166
2177
|
let hadSuccessfulRead = false;
|
|
@@ -2268,7 +2279,7 @@ var ProtocolViewerReader = class {
|
|
|
2268
2279
|
if (protocolViewerEntries.length === 0) {
|
|
2269
2280
|
throw new Error("ProtocolViewer not available for this network");
|
|
2270
2281
|
}
|
|
2271
|
-
const { parseIntentView: parseIntentView2 } = await import('./protocolViewerParsers-
|
|
2282
|
+
const { parseIntentView: parseIntentView2 } = await import('./protocolViewerParsers-CB3CJ2TB.mjs');
|
|
2272
2283
|
let lastError;
|
|
2273
2284
|
for (const pvEntry of protocolViewerEntries) {
|
|
2274
2285
|
const inputCount = this.pvEntryFunctionInputCount(pvEntry, "getIntent");
|
|
@@ -3625,6 +3636,23 @@ var STAKING_STATE_QUERY = (
|
|
|
3625
3636
|
}
|
|
3626
3637
|
`
|
|
3627
3638
|
);
|
|
3639
|
+
var TAKER_STAKE_AUTHORIZATIONS_QUERY = (
|
|
3640
|
+
/* GraphQL */
|
|
3641
|
+
`
|
|
3642
|
+
query TakerStakeAuthorizations($where: TakerStakeAuthorization_bool_exp!, $limit: Int!) {
|
|
3643
|
+
TakerStakeAuthorization(where: $where, order_by: [{ id: asc }], limit: $limit) {
|
|
3644
|
+
id
|
|
3645
|
+
chainId
|
|
3646
|
+
vaultAddress
|
|
3647
|
+
taker
|
|
3648
|
+
stakeOwner
|
|
3649
|
+
authorized
|
|
3650
|
+
updatedAtBlockNumber
|
|
3651
|
+
updatedAt
|
|
3652
|
+
}
|
|
3653
|
+
}
|
|
3654
|
+
`
|
|
3655
|
+
);
|
|
3628
3656
|
var STAKE_LOCKS_QUERY = (
|
|
3629
3657
|
/* GraphQL */
|
|
3630
3658
|
`
|
|
@@ -4317,6 +4345,602 @@ var REFERRAL_SIGNATURE_TYPES = {
|
|
|
4317
4345
|
{ name: "issuedAt", type: "uint256" }
|
|
4318
4346
|
]
|
|
4319
4347
|
};
|
|
4348
|
+
var currencyKeccak2562 = (inputString) => {
|
|
4349
|
+
const bytes = new TextEncoder().encode(inputString);
|
|
4350
|
+
return keccak256(bytes);
|
|
4351
|
+
};
|
|
4352
|
+
var Currency2 = {
|
|
4353
|
+
AED: "AED",
|
|
4354
|
+
ARS: "ARS",
|
|
4355
|
+
AUD: "AUD",
|
|
4356
|
+
BRL: "BRL",
|
|
4357
|
+
CAD: "CAD",
|
|
4358
|
+
CHF: "CHF",
|
|
4359
|
+
CNY: "CNY",
|
|
4360
|
+
CZK: "CZK",
|
|
4361
|
+
DKK: "DKK",
|
|
4362
|
+
EUR: "EUR",
|
|
4363
|
+
GBP: "GBP",
|
|
4364
|
+
HKD: "HKD",
|
|
4365
|
+
HUF: "HUF",
|
|
4366
|
+
IDR: "IDR",
|
|
4367
|
+
ILS: "ILS",
|
|
4368
|
+
INR: "INR",
|
|
4369
|
+
JPY: "JPY",
|
|
4370
|
+
KES: "KES",
|
|
4371
|
+
NOK: "NOK",
|
|
4372
|
+
MXN: "MXN",
|
|
4373
|
+
MYR: "MYR",
|
|
4374
|
+
NZD: "NZD",
|
|
4375
|
+
PHP: "PHP",
|
|
4376
|
+
PLN: "PLN",
|
|
4377
|
+
RON: "RON",
|
|
4378
|
+
SAR: "SAR",
|
|
4379
|
+
SEK: "SEK",
|
|
4380
|
+
SGD: "SGD",
|
|
4381
|
+
THB: "THB",
|
|
4382
|
+
TRY: "TRY",
|
|
4383
|
+
UGX: "UGX",
|
|
4384
|
+
USD: "USD",
|
|
4385
|
+
VND: "VND",
|
|
4386
|
+
ZAR: "ZAR"
|
|
4387
|
+
};
|
|
4388
|
+
var currencyInfo2 = {
|
|
4389
|
+
[Currency2.AED]: {
|
|
4390
|
+
currency: Currency2.AED,
|
|
4391
|
+
currencyCode: "AED",
|
|
4392
|
+
currencyName: "United Arab Emirates Dirham",
|
|
4393
|
+
currencyCodeHash: currencyKeccak2562("AED"),
|
|
4394
|
+
currencySymbol: "\u062F.\u0625",
|
|
4395
|
+
countryCode: "ae"
|
|
4396
|
+
},
|
|
4397
|
+
[Currency2.ARS]: {
|
|
4398
|
+
currency: Currency2.ARS,
|
|
4399
|
+
currencyCode: "ARS",
|
|
4400
|
+
currencyName: "Argentine Peso",
|
|
4401
|
+
currencyCodeHash: currencyKeccak2562("ARS"),
|
|
4402
|
+
currencySymbol: "$",
|
|
4403
|
+
countryCode: "ar"
|
|
4404
|
+
},
|
|
4405
|
+
[Currency2.AUD]: {
|
|
4406
|
+
currency: Currency2.AUD,
|
|
4407
|
+
currencyCode: "AUD",
|
|
4408
|
+
currencyName: "Australian Dollar",
|
|
4409
|
+
currencyCodeHash: currencyKeccak2562("AUD"),
|
|
4410
|
+
currencySymbol: "A$",
|
|
4411
|
+
countryCode: "au"
|
|
4412
|
+
},
|
|
4413
|
+
[Currency2.BRL]: {
|
|
4414
|
+
currency: Currency2.BRL,
|
|
4415
|
+
currencyCode: "BRL",
|
|
4416
|
+
currencyName: "Brazilian Real",
|
|
4417
|
+
currencyCodeHash: currencyKeccak2562("BRL"),
|
|
4418
|
+
currencySymbol: "R$",
|
|
4419
|
+
countryCode: "br"
|
|
4420
|
+
},
|
|
4421
|
+
[Currency2.CAD]: {
|
|
4422
|
+
currency: Currency2.CAD,
|
|
4423
|
+
currencyCode: "CAD",
|
|
4424
|
+
currencyName: "Canadian Dollar",
|
|
4425
|
+
currencyCodeHash: currencyKeccak2562("CAD"),
|
|
4426
|
+
currencySymbol: "C$",
|
|
4427
|
+
countryCode: "ca"
|
|
4428
|
+
},
|
|
4429
|
+
[Currency2.CHF]: {
|
|
4430
|
+
currency: Currency2.CHF,
|
|
4431
|
+
currencyCode: "CHF",
|
|
4432
|
+
currencyName: "Swiss Franc",
|
|
4433
|
+
currencyCodeHash: currencyKeccak2562("CHF"),
|
|
4434
|
+
currencySymbol: "Fr",
|
|
4435
|
+
countryCode: "ch"
|
|
4436
|
+
},
|
|
4437
|
+
[Currency2.CNY]: {
|
|
4438
|
+
currency: Currency2.CNY,
|
|
4439
|
+
currencyCode: "CNY",
|
|
4440
|
+
currencyName: "Chinese Yuan",
|
|
4441
|
+
currencyCodeHash: currencyKeccak2562("CNY"),
|
|
4442
|
+
currencySymbol: "\xA5",
|
|
4443
|
+
countryCode: "cn"
|
|
4444
|
+
},
|
|
4445
|
+
[Currency2.CZK]: {
|
|
4446
|
+
currency: Currency2.CZK,
|
|
4447
|
+
currencyCode: "CZK",
|
|
4448
|
+
currencyName: "Czech Koruna",
|
|
4449
|
+
currencyCodeHash: currencyKeccak2562("CZK"),
|
|
4450
|
+
currencySymbol: "K\u010D",
|
|
4451
|
+
countryCode: "cz"
|
|
4452
|
+
},
|
|
4453
|
+
[Currency2.DKK]: {
|
|
4454
|
+
currency: Currency2.DKK,
|
|
4455
|
+
currencyCode: "DKK",
|
|
4456
|
+
currencyName: "Danish Krone",
|
|
4457
|
+
currencyCodeHash: currencyKeccak2562("DKK"),
|
|
4458
|
+
currencySymbol: "kr",
|
|
4459
|
+
countryCode: "dk"
|
|
4460
|
+
},
|
|
4461
|
+
[Currency2.EUR]: {
|
|
4462
|
+
currency: Currency2.EUR,
|
|
4463
|
+
currencyCode: "EUR",
|
|
4464
|
+
currencyName: "Euro",
|
|
4465
|
+
currencyCodeHash: currencyKeccak2562("EUR"),
|
|
4466
|
+
currencySymbol: "\u20AC",
|
|
4467
|
+
countryCode: "eu"
|
|
4468
|
+
},
|
|
4469
|
+
[Currency2.GBP]: {
|
|
4470
|
+
currency: Currency2.GBP,
|
|
4471
|
+
currencyCode: "GBP",
|
|
4472
|
+
currencyName: "British Pound",
|
|
4473
|
+
currencyCodeHash: currencyKeccak2562("GBP"),
|
|
4474
|
+
currencySymbol: "\xA3",
|
|
4475
|
+
countryCode: "gb"
|
|
4476
|
+
},
|
|
4477
|
+
[Currency2.HKD]: {
|
|
4478
|
+
currency: Currency2.HKD,
|
|
4479
|
+
currencyCode: "HKD",
|
|
4480
|
+
currencyName: "Hong Kong Dollar",
|
|
4481
|
+
currencyCodeHash: currencyKeccak2562("HKD"),
|
|
4482
|
+
currencySymbol: "HK$",
|
|
4483
|
+
countryCode: "hk"
|
|
4484
|
+
},
|
|
4485
|
+
[Currency2.HUF]: {
|
|
4486
|
+
currency: Currency2.HUF,
|
|
4487
|
+
currencyCode: "HUF",
|
|
4488
|
+
currencyName: "Hungarian Forint",
|
|
4489
|
+
currencyCodeHash: currencyKeccak2562("HUF"),
|
|
4490
|
+
currencySymbol: "Ft",
|
|
4491
|
+
countryCode: "hu"
|
|
4492
|
+
},
|
|
4493
|
+
[Currency2.IDR]: {
|
|
4494
|
+
currency: Currency2.IDR,
|
|
4495
|
+
currencyCode: "IDR",
|
|
4496
|
+
currencyName: "Indonesian Rupiah",
|
|
4497
|
+
currencyCodeHash: currencyKeccak2562("IDR"),
|
|
4498
|
+
currencySymbol: "Rp",
|
|
4499
|
+
countryCode: "id"
|
|
4500
|
+
},
|
|
4501
|
+
[Currency2.INR]: {
|
|
4502
|
+
currency: Currency2.INR,
|
|
4503
|
+
currencyCode: "INR",
|
|
4504
|
+
currencyName: "Indian Rupee",
|
|
4505
|
+
currencyCodeHash: currencyKeccak2562("INR"),
|
|
4506
|
+
currencySymbol: "\u20B9",
|
|
4507
|
+
countryCode: "in"
|
|
4508
|
+
},
|
|
4509
|
+
[Currency2.ILS]: {
|
|
4510
|
+
currency: Currency2.ILS,
|
|
4511
|
+
currencyCode: "ILS",
|
|
4512
|
+
currencyName: "Israeli New Shekel",
|
|
4513
|
+
currencyCodeHash: currencyKeccak2562("ILS"),
|
|
4514
|
+
currencySymbol: "\u20AA",
|
|
4515
|
+
countryCode: "il"
|
|
4516
|
+
},
|
|
4517
|
+
[Currency2.JPY]: {
|
|
4518
|
+
currency: Currency2.JPY,
|
|
4519
|
+
currencyCode: "JPY",
|
|
4520
|
+
currencyName: "Japanese Yen",
|
|
4521
|
+
currencyCodeHash: currencyKeccak2562("JPY"),
|
|
4522
|
+
currencySymbol: "\xA5",
|
|
4523
|
+
countryCode: "jp"
|
|
4524
|
+
},
|
|
4525
|
+
[Currency2.KES]: {
|
|
4526
|
+
currency: Currency2.KES,
|
|
4527
|
+
currencyCode: "KES",
|
|
4528
|
+
currencyName: "Kenyan Shilling",
|
|
4529
|
+
currencyCodeHash: currencyKeccak2562("KES"),
|
|
4530
|
+
currencySymbol: "KSh",
|
|
4531
|
+
countryCode: "ke"
|
|
4532
|
+
},
|
|
4533
|
+
[Currency2.MXN]: {
|
|
4534
|
+
currency: Currency2.MXN,
|
|
4535
|
+
currencyCode: "MXN",
|
|
4536
|
+
currencyName: "Mexican Peso",
|
|
4537
|
+
currencyCodeHash: currencyKeccak2562("MXN"),
|
|
4538
|
+
currencySymbol: "$",
|
|
4539
|
+
countryCode: "mx"
|
|
4540
|
+
},
|
|
4541
|
+
[Currency2.MYR]: {
|
|
4542
|
+
currency: Currency2.MYR,
|
|
4543
|
+
currencyCode: "MYR",
|
|
4544
|
+
currencyName: "Malaysian Ringgit",
|
|
4545
|
+
currencyCodeHash: currencyKeccak2562("MYR"),
|
|
4546
|
+
currencySymbol: "RM",
|
|
4547
|
+
countryCode: "my"
|
|
4548
|
+
},
|
|
4549
|
+
[Currency2.NOK]: {
|
|
4550
|
+
currency: Currency2.NOK,
|
|
4551
|
+
currencyCode: "NOK",
|
|
4552
|
+
currencyName: "Norwegian Krone",
|
|
4553
|
+
currencyCodeHash: currencyKeccak2562("NOK"),
|
|
4554
|
+
currencySymbol: "kr",
|
|
4555
|
+
countryCode: "no"
|
|
4556
|
+
},
|
|
4557
|
+
[Currency2.NZD]: {
|
|
4558
|
+
currency: Currency2.NZD,
|
|
4559
|
+
currencyCode: "NZD",
|
|
4560
|
+
currencyName: "New Zealand Dollar",
|
|
4561
|
+
currencyCodeHash: currencyKeccak2562("NZD"),
|
|
4562
|
+
currencySymbol: "NZ$",
|
|
4563
|
+
countryCode: "nz"
|
|
4564
|
+
},
|
|
4565
|
+
[Currency2.PHP]: {
|
|
4566
|
+
currency: Currency2.PHP,
|
|
4567
|
+
currencyCode: "PHP",
|
|
4568
|
+
currencyName: "Philippine Peso",
|
|
4569
|
+
currencyCodeHash: currencyKeccak2562("PHP"),
|
|
4570
|
+
currencySymbol: "\u20B1",
|
|
4571
|
+
countryCode: "ph"
|
|
4572
|
+
},
|
|
4573
|
+
[Currency2.PLN]: {
|
|
4574
|
+
currency: Currency2.PLN,
|
|
4575
|
+
currencyCode: "PLN",
|
|
4576
|
+
currencyName: "Polish Z\u0142oty",
|
|
4577
|
+
currencyCodeHash: currencyKeccak2562("PLN"),
|
|
4578
|
+
currencySymbol: "z\u0142",
|
|
4579
|
+
countryCode: "pl"
|
|
4580
|
+
},
|
|
4581
|
+
[Currency2.RON]: {
|
|
4582
|
+
currency: Currency2.RON,
|
|
4583
|
+
currencyCode: "RON",
|
|
4584
|
+
currencyName: "Romanian Leu",
|
|
4585
|
+
currencyCodeHash: currencyKeccak2562("RON"),
|
|
4586
|
+
currencySymbol: "lei",
|
|
4587
|
+
countryCode: "ro"
|
|
4588
|
+
},
|
|
4589
|
+
[Currency2.SAR]: {
|
|
4590
|
+
currency: Currency2.SAR,
|
|
4591
|
+
currencyCode: "SAR",
|
|
4592
|
+
currencyName: "Saudi Riyal",
|
|
4593
|
+
currencyCodeHash: currencyKeccak2562("SAR"),
|
|
4594
|
+
currencySymbol: "\uFDFC",
|
|
4595
|
+
countryCode: "sa"
|
|
4596
|
+
},
|
|
4597
|
+
[Currency2.SEK]: {
|
|
4598
|
+
currency: Currency2.SEK,
|
|
4599
|
+
currencyCode: "SEK",
|
|
4600
|
+
currencyName: "Swedish Krona",
|
|
4601
|
+
currencyCodeHash: currencyKeccak2562("SEK"),
|
|
4602
|
+
currencySymbol: "kr",
|
|
4603
|
+
countryCode: "se"
|
|
4604
|
+
},
|
|
4605
|
+
[Currency2.SGD]: {
|
|
4606
|
+
currency: Currency2.SGD,
|
|
4607
|
+
currencyCode: "SGD",
|
|
4608
|
+
currencyName: "Singapore Dollar",
|
|
4609
|
+
currencyCodeHash: currencyKeccak2562("SGD"),
|
|
4610
|
+
currencySymbol: "S$",
|
|
4611
|
+
countryCode: "sg"
|
|
4612
|
+
},
|
|
4613
|
+
[Currency2.THB]: {
|
|
4614
|
+
currency: Currency2.THB,
|
|
4615
|
+
currencyCode: "THB",
|
|
4616
|
+
currencyName: "Thai Baht",
|
|
4617
|
+
currencyCodeHash: currencyKeccak2562("THB"),
|
|
4618
|
+
currencySymbol: "\u0E3F",
|
|
4619
|
+
countryCode: "th"
|
|
4620
|
+
},
|
|
4621
|
+
[Currency2.TRY]: {
|
|
4622
|
+
currency: Currency2.TRY,
|
|
4623
|
+
currencyCode: "TRY",
|
|
4624
|
+
currencyName: "Turkish Lira",
|
|
4625
|
+
currencyCodeHash: currencyKeccak2562("TRY"),
|
|
4626
|
+
currencySymbol: "\u20BA",
|
|
4627
|
+
countryCode: "tr"
|
|
4628
|
+
},
|
|
4629
|
+
[Currency2.UGX]: {
|
|
4630
|
+
currency: Currency2.UGX,
|
|
4631
|
+
currencyCode: "UGX",
|
|
4632
|
+
currencyName: "Ugandan Shilling",
|
|
4633
|
+
currencyCodeHash: currencyKeccak2562("UGX"),
|
|
4634
|
+
currencySymbol: "USh",
|
|
4635
|
+
countryCode: "ug"
|
|
4636
|
+
},
|
|
4637
|
+
[Currency2.USD]: {
|
|
4638
|
+
currency: Currency2.USD,
|
|
4639
|
+
currencyCode: "USD",
|
|
4640
|
+
currencyName: "United States Dollar",
|
|
4641
|
+
currencyCodeHash: currencyKeccak2562("USD"),
|
|
4642
|
+
currencySymbol: "$",
|
|
4643
|
+
countryCode: "us"
|
|
4644
|
+
},
|
|
4645
|
+
[Currency2.VND]: {
|
|
4646
|
+
currency: Currency2.VND,
|
|
4647
|
+
currencyCode: "VND",
|
|
4648
|
+
currencyName: "Vietnamese Dong",
|
|
4649
|
+
currencyCodeHash: currencyKeccak2562("VND"),
|
|
4650
|
+
currencySymbol: "\u20AB",
|
|
4651
|
+
countryCode: "vn"
|
|
4652
|
+
},
|
|
4653
|
+
[Currency2.ZAR]: {
|
|
4654
|
+
currency: Currency2.ZAR,
|
|
4655
|
+
currencyCode: "ZAR",
|
|
4656
|
+
currencyName: "South African Rand",
|
|
4657
|
+
currencyCodeHash: currencyKeccak2562("ZAR"),
|
|
4658
|
+
currencySymbol: "R",
|
|
4659
|
+
countryCode: "za"
|
|
4660
|
+
}
|
|
4661
|
+
};
|
|
4662
|
+
var PaymentPlatform = {
|
|
4663
|
+
VENMO: "venmo",
|
|
4664
|
+
CASHAPP: "cashapp",
|
|
4665
|
+
CHIME: "chime",
|
|
4666
|
+
LUXON: "luxon",
|
|
4667
|
+
REVOLUT: "revolut",
|
|
4668
|
+
WISE: "wise",
|
|
4669
|
+
MERCADO_PAGO: "mercadopago",
|
|
4670
|
+
ZELLE: "zelle",
|
|
4671
|
+
PAYPAL: "paypal",
|
|
4672
|
+
MONZO: "monzo",
|
|
4673
|
+
N26: "n26",
|
|
4674
|
+
ALIPAY: "alipay",
|
|
4675
|
+
UPI: "upi"
|
|
4676
|
+
};
|
|
4677
|
+
[...Object.values(PaymentPlatform)];
|
|
4678
|
+
var encodeZelleRecipientId = (recipientId) => {
|
|
4679
|
+
const payload = {
|
|
4680
|
+
name: "",
|
|
4681
|
+
action: "payment",
|
|
4682
|
+
token: recipientId
|
|
4683
|
+
};
|
|
4684
|
+
return btoa(JSON.stringify(payload));
|
|
4685
|
+
};
|
|
4686
|
+
var zelleBankOfAmericaSendConfig = {
|
|
4687
|
+
paymentMethodName: "Bank of America",
|
|
4688
|
+
paymentMethodIcon: void 0,
|
|
4689
|
+
// Icon provided by client-side assets
|
|
4690
|
+
defaultPaymentMode: "QR_CODE",
|
|
4691
|
+
useCustomQRCode: true,
|
|
4692
|
+
troubleScanningQRCodeLink: (recipientId, sendCurrency, amountFiatToSend) => `https://www.bankofamerica.com/`,
|
|
4693
|
+
getFormattedSendLink: (recipientId, sendCurrency, amountFiatToSend) => {
|
|
4694
|
+
return `https://www.bankofamerica.com/movemoney`;
|
|
4695
|
+
},
|
|
4696
|
+
deepLinkEmbedsRecipient: false,
|
|
4697
|
+
supportsSendingPaymentOnWeb: true,
|
|
4698
|
+
showTroubleScanningQRCodeLink: true,
|
|
4699
|
+
sendPaymentWarning: (sendCurrency, amountFiatToSend) => {
|
|
4700
|
+
return `Send exactly ${amountFiatToSend} ${currencyInfo2[sendCurrency].currencyCode} in a single payment through Bank of America's Zelle.`;
|
|
4701
|
+
},
|
|
4702
|
+
sendPaymentInfo: (sendCurrency, amountFiatToSend) => {
|
|
4703
|
+
return `Only use Bank of America. Scan the QR code and manually enter the recipient email. Double-check the email before sending.`;
|
|
4704
|
+
},
|
|
4705
|
+
sendPaymentDos: (sendCurrency, amountFiatToSend) => [
|
|
4706
|
+
{ text: "Use Bank of America", emphasize: ["Bank of America"] },
|
|
4707
|
+
{
|
|
4708
|
+
text: "Scan the QR code and manually enter the recipient email",
|
|
4709
|
+
emphasize: ["manually", "recipient email"]
|
|
4710
|
+
},
|
|
4711
|
+
{
|
|
4712
|
+
text: "Double-check the email before sending",
|
|
4713
|
+
emphasize: ["Double-check"]
|
|
4714
|
+
},
|
|
4715
|
+
{
|
|
4716
|
+
text: `Send exactly ${amountFiatToSend} ${currencyInfo2[sendCurrency].currencyCode} in a single payment`,
|
|
4717
|
+
emphasize: [
|
|
4718
|
+
"exactly",
|
|
4719
|
+
amountFiatToSend,
|
|
4720
|
+
currencyInfo2[sendCurrency].currencyCode,
|
|
4721
|
+
"single"
|
|
4722
|
+
]
|
|
4723
|
+
}
|
|
4724
|
+
],
|
|
4725
|
+
sendPaymentDonts: () => [
|
|
4726
|
+
{ text: "Do not use any other bank", emphasize: ["Do not"] }
|
|
4727
|
+
]
|
|
4728
|
+
};
|
|
4729
|
+
var zelleBankOfAmericaVerifyConfig = {
|
|
4730
|
+
authLink: "https://www.bankofamerica.com/",
|
|
4731
|
+
actionType: "transfer_zelle_bofa",
|
|
4732
|
+
actionPlatform: PaymentPlatform.ZELLE,
|
|
4733
|
+
buyerTeeParams: {
|
|
4734
|
+
includeMetadataIndex: true
|
|
4735
|
+
},
|
|
4736
|
+
numPaymentsFetched: 15,
|
|
4737
|
+
minExtensionVersion: "0.6.3",
|
|
4738
|
+
supportsAppclip: false,
|
|
4739
|
+
totalProofs: 1,
|
|
4740
|
+
parseMetadata: (metadata) => {
|
|
4741
|
+
const amountStr = metadata.amount ?? "";
|
|
4742
|
+
let dateStr = metadata.date ?? "";
|
|
4743
|
+
if (dateStr && dateStr.length === 10) {
|
|
4744
|
+
dateStr = `${dateStr}T23:59:59`;
|
|
4745
|
+
}
|
|
4746
|
+
const recipientIdStr = metadata.recipient || "";
|
|
4747
|
+
return {
|
|
4748
|
+
amount: amountStr,
|
|
4749
|
+
parsedAmount: amountStr !== "",
|
|
4750
|
+
date: dateStr,
|
|
4751
|
+
parsedDate: dateStr !== "",
|
|
4752
|
+
recipientId: recipientIdStr,
|
|
4753
|
+
parsedRecipientId: false,
|
|
4754
|
+
currency: Currency2.USD,
|
|
4755
|
+
parsedCurrency: true
|
|
4756
|
+
};
|
|
4757
|
+
},
|
|
4758
|
+
getSubjectText: (metadata) => {
|
|
4759
|
+
if (!metadata.amount || !metadata.recipient) {
|
|
4760
|
+
return "";
|
|
4761
|
+
}
|
|
4762
|
+
return `Transfer of $${Number(metadata.amount)} to ${metadata.recipient}`;
|
|
4763
|
+
}
|
|
4764
|
+
};
|
|
4765
|
+
var zelleChaseSendConfig = {
|
|
4766
|
+
paymentMethodName: "Chase",
|
|
4767
|
+
paymentMethodIcon: void 0,
|
|
4768
|
+
// Icon provided by client-side assets
|
|
4769
|
+
defaultPaymentMode: "QR_CODE",
|
|
4770
|
+
useCustomQRCode: true,
|
|
4771
|
+
troubleScanningQRCodeLink: (recipientId, sendCurrency, amountFiatToSend) => `https://secure.chase.com/web/auth/dashboard#/dashboard/singleDoor/singleDoorController/index`,
|
|
4772
|
+
getFormattedSendLink: (recipientId, sendCurrency, amountFiatToSend) => {
|
|
4773
|
+
const encodedRecipientId = encodeZelleRecipientId(recipientId);
|
|
4774
|
+
return `https://enroll.zellepay.com/qr-codes?data=${encodedRecipientId}`;
|
|
4775
|
+
},
|
|
4776
|
+
deepLinkEmbedsRecipient: true,
|
|
4777
|
+
supportsSendingPaymentOnWeb: true,
|
|
4778
|
+
showTroubleScanningQRCodeLink: true,
|
|
4779
|
+
sendPaymentWarning: (sendCurrency, amountFiatToSend) => {
|
|
4780
|
+
return `Send exactly ${amountFiatToSend} ${currencyInfo2[sendCurrency].currencyCode} in a single payment through Chase's Zelle.`;
|
|
4781
|
+
},
|
|
4782
|
+
sendPaymentInfo: (sendCurrency, amountFiatToSend) => {
|
|
4783
|
+
return `Do not send using any other bank.`;
|
|
4784
|
+
},
|
|
4785
|
+
sendPaymentDos: (sendCurrency, amountFiatToSend) => [
|
|
4786
|
+
{ text: "Use Chase for this payment", emphasize: ["Chase"] },
|
|
4787
|
+
{
|
|
4788
|
+
text: `Send exactly ${amountFiatToSend} ${currencyInfo2[sendCurrency].currencyCode} in a single payment`,
|
|
4789
|
+
emphasize: [
|
|
4790
|
+
"exactly",
|
|
4791
|
+
amountFiatToSend,
|
|
4792
|
+
currencyInfo2[sendCurrency].currencyCode,
|
|
4793
|
+
"single"
|
|
4794
|
+
]
|
|
4795
|
+
}
|
|
4796
|
+
],
|
|
4797
|
+
sendPaymentDonts: () => [
|
|
4798
|
+
{ text: "Do not send using any other bank", emphasize: ["Do not"] }
|
|
4799
|
+
]
|
|
4800
|
+
};
|
|
4801
|
+
var zelleChaseVerifyConfig = {
|
|
4802
|
+
authLink: "https://secure.chase.com/web/auth/dashboard#/dashboard/singleDoor/payments/activity;params=qp,sentactivity",
|
|
4803
|
+
actionType: "transfer_zelle_chase",
|
|
4804
|
+
actionPlatform: PaymentPlatform.ZELLE,
|
|
4805
|
+
buyerTeeParams: {
|
|
4806
|
+
includeMetadataIndex: true
|
|
4807
|
+
},
|
|
4808
|
+
numPaymentsFetched: 15,
|
|
4809
|
+
minExtensionVersion: "0.6.3",
|
|
4810
|
+
supportsAppclip: false,
|
|
4811
|
+
totalProofs: 2,
|
|
4812
|
+
parseMetadata: (metadata) => {
|
|
4813
|
+
const amountStr = metadata.amount ?? "";
|
|
4814
|
+
let dateStr = metadata.date ?? "";
|
|
4815
|
+
if (dateStr && dateStr.length === 8) {
|
|
4816
|
+
const year = dateStr.substring(0, 4);
|
|
4817
|
+
const month = dateStr.substring(4, 6);
|
|
4818
|
+
const day = dateStr.substring(6, 8);
|
|
4819
|
+
dateStr = `${year}-${month}-${day}T23:59:59`;
|
|
4820
|
+
}
|
|
4821
|
+
const recipientIdStr = metadata.recipient || "";
|
|
4822
|
+
return {
|
|
4823
|
+
amount: amountStr,
|
|
4824
|
+
parsedAmount: amountStr !== "",
|
|
4825
|
+
date: dateStr,
|
|
4826
|
+
parsedDate: dateStr !== "",
|
|
4827
|
+
recipientId: recipientIdStr,
|
|
4828
|
+
parsedRecipientId: false,
|
|
4829
|
+
currency: Currency2.USD,
|
|
4830
|
+
parsedCurrency: true
|
|
4831
|
+
};
|
|
4832
|
+
},
|
|
4833
|
+
getSubjectText: (metadata) => {
|
|
4834
|
+
if (!metadata.amount || !metadata.recipient) {
|
|
4835
|
+
return "";
|
|
4836
|
+
}
|
|
4837
|
+
return `Transfer of $${Number(metadata.amount)} to ${metadata.recipient}`;
|
|
4838
|
+
}
|
|
4839
|
+
};
|
|
4840
|
+
var zelleCitiSendConfig = {
|
|
4841
|
+
paymentMethodName: "Citi",
|
|
4842
|
+
paymentMethodIcon: void 0,
|
|
4843
|
+
// Icon provided by client-side assets
|
|
4844
|
+
defaultPaymentMode: "QR_CODE",
|
|
4845
|
+
useCustomQRCode: true,
|
|
4846
|
+
troubleScanningQRCodeLink: (recipientId, sendCurrency, amountFiatToSend) => `https://online.citi.com/US/nga/zelle/transfer`,
|
|
4847
|
+
getFormattedSendLink: (recipientId, sendCurrency, amountFiatToSend) => {
|
|
4848
|
+
const encodedRecipientId = encodeZelleRecipientId(recipientId);
|
|
4849
|
+
return `https://enroll.zellepay.com/qr-codes?data=${encodedRecipientId}`;
|
|
4850
|
+
},
|
|
4851
|
+
deepLinkEmbedsRecipient: true,
|
|
4852
|
+
supportsSendingPaymentOnWeb: true,
|
|
4853
|
+
showTroubleScanningQRCodeLink: true,
|
|
4854
|
+
sendPaymentWarning: (sendCurrency, amountFiatToSend) => {
|
|
4855
|
+
return `Send exactly ${amountFiatToSend} ${currencyInfo2[sendCurrency].currencyCode} in a single payment through Citi's Zelle.`;
|
|
4856
|
+
},
|
|
4857
|
+
sendPaymentInfo: (sendCurrency, amountFiatToSend) => {
|
|
4858
|
+
return `Do not send using any other bank.`;
|
|
4859
|
+
},
|
|
4860
|
+
sendPaymentDos: (sendCurrency, amountFiatToSend) => [
|
|
4861
|
+
{ text: "Use Citi for this payment", emphasize: ["Citi"] },
|
|
4862
|
+
{
|
|
4863
|
+
text: `Send exactly ${amountFiatToSend} ${currencyInfo2[sendCurrency].currencyCode} in a single payment`,
|
|
4864
|
+
emphasize: [
|
|
4865
|
+
"exactly",
|
|
4866
|
+
amountFiatToSend,
|
|
4867
|
+
currencyInfo2[sendCurrency].currencyCode,
|
|
4868
|
+
"single"
|
|
4869
|
+
]
|
|
4870
|
+
}
|
|
4871
|
+
],
|
|
4872
|
+
sendPaymentDonts: () => [
|
|
4873
|
+
{ text: "Do not send using any other bank", emphasize: ["Do not"] }
|
|
4874
|
+
]
|
|
4875
|
+
};
|
|
4876
|
+
var zelleCitiVerifyConfig = {
|
|
4877
|
+
authLink: "https://online.citi.com/US/nga/zelle/transfer",
|
|
4878
|
+
actionType: "transfer_zelle_citi",
|
|
4879
|
+
actionPlatform: PaymentPlatform.ZELLE,
|
|
4880
|
+
buyerTeeParams: {
|
|
4881
|
+
includeMetadataIndex: true
|
|
4882
|
+
},
|
|
4883
|
+
numPaymentsFetched: 15,
|
|
4884
|
+
minExtensionVersion: "0.6.3",
|
|
4885
|
+
supportsAppclip: false,
|
|
4886
|
+
totalProofs: 1,
|
|
4887
|
+
parseMetadata: (metadata) => {
|
|
4888
|
+
const amountStr = metadata.amount ?? "";
|
|
4889
|
+
let dateStr = metadata.date ?? "";
|
|
4890
|
+
if (dateStr && dateStr.length === 8) {
|
|
4891
|
+
const year = dateStr.substring(0, 4);
|
|
4892
|
+
const month = dateStr.substring(4, 6);
|
|
4893
|
+
const day = dateStr.substring(6, 8);
|
|
4894
|
+
dateStr = `${year}-${month}-${day}T23:59:59`;
|
|
4895
|
+
}
|
|
4896
|
+
const recipientIdStr = metadata.recipient || "";
|
|
4897
|
+
return {
|
|
4898
|
+
amount: amountStr,
|
|
4899
|
+
parsedAmount: amountStr !== "",
|
|
4900
|
+
date: dateStr,
|
|
4901
|
+
parsedDate: dateStr !== "",
|
|
4902
|
+
recipientId: recipientIdStr,
|
|
4903
|
+
parsedRecipientId: recipientIdStr !== "",
|
|
4904
|
+
currency: Currency2.USD,
|
|
4905
|
+
parsedCurrency: true
|
|
4906
|
+
};
|
|
4907
|
+
},
|
|
4908
|
+
getSubjectText: (metadata) => {
|
|
4909
|
+
if (!metadata.amount || !metadata.recipient) {
|
|
4910
|
+
return "";
|
|
4911
|
+
}
|
|
4912
|
+
return `Transfer of $${Number(metadata.amount)} to ${metadata.recipient}`;
|
|
4913
|
+
}
|
|
4914
|
+
};
|
|
4915
|
+
var genericZelleBankRoutes = [
|
|
4916
|
+
{
|
|
4917
|
+
bankId: "chase",
|
|
4918
|
+
sendConfig: zelleChaseSendConfig,
|
|
4919
|
+
verifyConfig: zelleChaseVerifyConfig
|
|
4920
|
+
},
|
|
4921
|
+
{
|
|
4922
|
+
bankId: "bofa",
|
|
4923
|
+
sendConfig: zelleBankOfAmericaSendConfig,
|
|
4924
|
+
verifyConfig: zelleBankOfAmericaVerifyConfig
|
|
4925
|
+
},
|
|
4926
|
+
{
|
|
4927
|
+
bankId: "citi",
|
|
4928
|
+
sendConfig: zelleCitiSendConfig,
|
|
4929
|
+
verifyConfig: zelleCitiVerifyConfig
|
|
4930
|
+
}
|
|
4931
|
+
];
|
|
4932
|
+
genericZelleBankRoutes.map(({ sendConfig, verifyConfig }) => ({
|
|
4933
|
+
sendConfig,
|
|
4934
|
+
verifyConfig
|
|
4935
|
+
}));
|
|
4936
|
+
var DISPUTE_PROTECTION_STAKE_PLATFORMS = [
|
|
4937
|
+
PaymentPlatform.VENMO,
|
|
4938
|
+
PaymentPlatform.PAYPAL
|
|
4939
|
+
];
|
|
4940
|
+
new Set(
|
|
4941
|
+
DISPUTE_PROTECTION_STAKE_PLATFORMS
|
|
4942
|
+
);
|
|
4943
|
+
var isCanonicalDisputeProtectionProjection = (projection) => typeof projection.disputeProtectionOptedOut === "boolean" && typeof projection.disputeProtectionRequiresStake === "boolean" && (!projection.disputeProtectionRequiresStake || !projection.disputeProtectionOptedOut);
|
|
4320
4944
|
|
|
4321
4945
|
// src/adapters/api.ts
|
|
4322
4946
|
function createHeaders(apiKey, authorizationToken, extraHeaders) {
|
|
@@ -4851,7 +5475,7 @@ function resolveSignalableEscrow(chainId, runtimeEnv) {
|
|
|
4851
5475
|
}
|
|
4852
5476
|
}
|
|
4853
5477
|
function hasDisputeProtectionFields(row) {
|
|
4854
|
-
return
|
|
5478
|
+
return isCanonicalDisputeProtectionProjection(row);
|
|
4855
5479
|
}
|
|
4856
5480
|
function isSignalableEscrowRow(rowEscrowAddress, signalableEscrow) {
|
|
4857
5481
|
if (!signalableEscrow) return true;
|
|
@@ -5416,6 +6040,11 @@ var getRateManagerReadFunction = (abi, functionName) => Array.isArray(abi) && ab
|
|
|
5416
6040
|
);
|
|
5417
6041
|
|
|
5418
6042
|
// src/client/AccessPolicyOperations.ts
|
|
6043
|
+
var PEER_PAY_MERCHANT_GROUP_ID_BY_ENVIRONMENT = {
|
|
6044
|
+
production: "0x174b8a29536721a3eae290bfd55651b85a53fc334b971d993fa93ed8dde15e48",
|
|
6045
|
+
preproduction: "0x174b8a29536721a3eae290bfd55651b85a53fc334b971d993fa93ed8dde15e48",
|
|
6046
|
+
staging: "0xc82c20c00033046a2f017b65532d7148a337282f17c73296663a530e49ba00f7"
|
|
6047
|
+
};
|
|
5419
6048
|
var AccessPolicyUnsupportedError = class extends Error {
|
|
5420
6049
|
constructor(contract) {
|
|
5421
6050
|
super(`${contract} is not deployed for this environment.`);
|
|
@@ -5450,7 +6079,7 @@ var AccessPolicyOperations = class {
|
|
|
5450
6079
|
address,
|
|
5451
6080
|
abi,
|
|
5452
6081
|
functionName: "enabled",
|
|
5453
|
-
args: [params.escrow, params.depositId]
|
|
6082
|
+
args: [params.escrow, params.depositId, params.paymentMethod]
|
|
5454
6083
|
});
|
|
5455
6084
|
}
|
|
5456
6085
|
/** Groups are enumerable onchain; direct addresses deliberately are not. */
|
|
@@ -5460,7 +6089,7 @@ var AccessPolicyOperations = class {
|
|
|
5460
6089
|
address,
|
|
5461
6090
|
abi,
|
|
5462
6091
|
functionName: "getAllowedGroups",
|
|
5463
|
-
args: [params.escrow, params.depositId]
|
|
6092
|
+
args: [params.escrow, params.depositId, params.paymentMethod]
|
|
5464
6093
|
});
|
|
5465
6094
|
}
|
|
5466
6095
|
/**
|
|
@@ -5476,12 +6105,12 @@ var AccessPolicyOperations = class {
|
|
|
5476
6105
|
args: [params.escrow, params.depositId, params.taker]
|
|
5477
6106
|
});
|
|
5478
6107
|
}
|
|
5479
|
-
async
|
|
6108
|
+
async maxGroupsPerDepositPaymentMethod() {
|
|
5480
6109
|
const { address, abi } = this.requirePolicy();
|
|
5481
6110
|
return await this.config.getPublicClient().readContract({
|
|
5482
6111
|
address,
|
|
5483
6112
|
abi,
|
|
5484
|
-
functionName: "
|
|
6113
|
+
functionName: "MAX_GROUPS_PER_DEPOSIT_PAYMENT_METHOD"
|
|
5485
6114
|
});
|
|
5486
6115
|
}
|
|
5487
6116
|
async groupExists(groupId) {
|
|
@@ -5514,38 +6143,31 @@ var AccessPolicyOperations = class {
|
|
|
5514
6143
|
txOverrides
|
|
5515
6144
|
});
|
|
5516
6145
|
}
|
|
5517
|
-
|
|
6146
|
+
/** Configure the fixed Peer Pay merchant default while creating a sell deposit. */
|
|
6147
|
+
prepareConfigurePeerPayMerchantDeposit(params) {
|
|
6148
|
+
const runtimeEnv = this.config.getRuntimeEnv?.();
|
|
6149
|
+
if (!runtimeEnv) {
|
|
6150
|
+
throw new Error("Runtime environment is required to configure the Peer Pay merchant policy.");
|
|
6151
|
+
}
|
|
6152
|
+
const merchantGroupId = PEER_PAY_MERCHANT_GROUP_ID_BY_ENVIRONMENT[runtimeEnv];
|
|
5518
6153
|
return this.preparePolicyCall(
|
|
5519
6154
|
"configureDeposit",
|
|
5520
|
-
[params.escrow, params.depositId, params.
|
|
6155
|
+
[params.escrow, params.depositId, params.paymentMethod, true, [merchantGroupId], []],
|
|
5521
6156
|
params.txOverrides
|
|
5522
6157
|
);
|
|
5523
6158
|
}
|
|
5524
|
-
|
|
6159
|
+
/** Fail open before removing historical policy entries. */
|
|
6160
|
+
prepareDisable(params) {
|
|
5525
6161
|
return this.preparePolicyCall(
|
|
5526
6162
|
"setEnabled",
|
|
5527
|
-
[params.escrow, params.depositId, params.
|
|
5528
|
-
params.txOverrides
|
|
5529
|
-
);
|
|
5530
|
-
}
|
|
5531
|
-
prepareAddAllowedGroups(params) {
|
|
5532
|
-
return this.preparePolicyCall(
|
|
5533
|
-
"addAllowedGroups",
|
|
5534
|
-
[params.escrow, params.depositId, params.groupIds],
|
|
6163
|
+
[params.escrow, params.depositId, params.paymentMethod, false],
|
|
5535
6164
|
params.txOverrides
|
|
5536
6165
|
);
|
|
5537
6166
|
}
|
|
5538
6167
|
prepareRemoveAllowedGroups(params) {
|
|
5539
6168
|
return this.preparePolicyCall(
|
|
5540
6169
|
"removeAllowedGroups",
|
|
5541
|
-
[params.escrow, params.depositId, params.groupIds],
|
|
5542
|
-
params.txOverrides
|
|
5543
|
-
);
|
|
5544
|
-
}
|
|
5545
|
-
prepareAddWhitelistedAddresses(params) {
|
|
5546
|
-
return this.preparePolicyCall(
|
|
5547
|
-
"addWhitelistedAddresses",
|
|
5548
|
-
[params.escrow, params.depositId, params.takers],
|
|
6170
|
+
[params.escrow, params.depositId, params.paymentMethod, params.groupIds],
|
|
5549
6171
|
params.txOverrides
|
|
5550
6172
|
);
|
|
5551
6173
|
}
|
|
@@ -5556,68 +6178,6 @@ var AccessPolicyOperations = class {
|
|
|
5556
6178
|
params.txOverrides
|
|
5557
6179
|
);
|
|
5558
6180
|
}
|
|
5559
|
-
/** Encodes one planner step. */
|
|
5560
|
-
preparePlanStep(params) {
|
|
5561
|
-
const { escrow, depositId, step, txOverrides } = params;
|
|
5562
|
-
switch (step.kind) {
|
|
5563
|
-
case "configureDeposit":
|
|
5564
|
-
return this.prepareConfigureDeposit({
|
|
5565
|
-
escrow,
|
|
5566
|
-
depositId,
|
|
5567
|
-
enabled: step.enabled,
|
|
5568
|
-
groupIds: step.groupIds,
|
|
5569
|
-
takers: step.takers,
|
|
5570
|
-
txOverrides
|
|
5571
|
-
});
|
|
5572
|
-
case "setEnabled":
|
|
5573
|
-
return this.prepareSetEnabled({ escrow, depositId, enabled: step.enabled, txOverrides });
|
|
5574
|
-
case "addAllowedGroups":
|
|
5575
|
-
return this.prepareAddAllowedGroups({
|
|
5576
|
-
escrow,
|
|
5577
|
-
depositId,
|
|
5578
|
-
groupIds: step.groupIds,
|
|
5579
|
-
txOverrides
|
|
5580
|
-
});
|
|
5581
|
-
case "removeAllowedGroups":
|
|
5582
|
-
return this.prepareRemoveAllowedGroups({
|
|
5583
|
-
escrow,
|
|
5584
|
-
depositId,
|
|
5585
|
-
groupIds: step.groupIds,
|
|
5586
|
-
txOverrides
|
|
5587
|
-
});
|
|
5588
|
-
case "addWhitelistedAddresses":
|
|
5589
|
-
return this.prepareAddWhitelistedAddresses({
|
|
5590
|
-
escrow,
|
|
5591
|
-
depositId,
|
|
5592
|
-
takers: step.takers,
|
|
5593
|
-
txOverrides
|
|
5594
|
-
});
|
|
5595
|
-
case "removeWhitelistedAddresses":
|
|
5596
|
-
return this.prepareRemoveWhitelistedAddresses({
|
|
5597
|
-
escrow,
|
|
5598
|
-
depositId,
|
|
5599
|
-
takers: step.takers,
|
|
5600
|
-
txOverrides
|
|
5601
|
-
});
|
|
5602
|
-
}
|
|
5603
|
-
}
|
|
5604
|
-
/**
|
|
5605
|
-
* Encodes a whole plan, in order.
|
|
5606
|
-
*
|
|
5607
|
-
* A plan with violations encodes to nothing: an invalid draft must be
|
|
5608
|
-
* rejected before a wallet is ever opened.
|
|
5609
|
-
*/
|
|
5610
|
-
preparePlan(params) {
|
|
5611
|
-
if (params.plan.violations.length > 0) return [];
|
|
5612
|
-
return params.plan.steps.map(
|
|
5613
|
-
(step) => this.preparePlanStep({
|
|
5614
|
-
escrow: params.escrow,
|
|
5615
|
-
depositId: params.depositId,
|
|
5616
|
-
step,
|
|
5617
|
-
txOverrides: params.txOverrides
|
|
5618
|
-
})
|
|
5619
|
-
);
|
|
5620
|
-
}
|
|
5621
6181
|
};
|
|
5622
6182
|
var StakeOperations = class {
|
|
5623
6183
|
constructor(config) {
|
|
@@ -5690,9 +6250,13 @@ var StakeOperations = class {
|
|
|
5690
6250
|
getRiskWindow(paymentMethodHash) {
|
|
5691
6251
|
return this.readPolicy("getRiskWindow", [paymentMethodHash]);
|
|
5692
6252
|
}
|
|
5693
|
-
/** Whether a specific escrow deposit has opted into dispute protection. */
|
|
5694
|
-
isDisputeProtectionEnabled(escrow, depositId) {
|
|
5695
|
-
return this.readPolicy("isDisputeProtectionEnabled", [
|
|
6253
|
+
/** Whether a specific escrow deposit payment method has opted into dispute protection. */
|
|
6254
|
+
isDisputeProtectionEnabled(escrow, depositId, paymentMethod) {
|
|
6255
|
+
return this.readPolicy("isDisputeProtectionEnabled", [
|
|
6256
|
+
escrow,
|
|
6257
|
+
depositId,
|
|
6258
|
+
paymentMethod
|
|
6259
|
+
]);
|
|
5696
6260
|
}
|
|
5697
6261
|
async getStakeVaultState(params) {
|
|
5698
6262
|
const taker = params.taker ?? params.staker;
|
|
@@ -6495,13 +7059,13 @@ function decodeCursor(cursor, prefix, validate) {
|
|
|
6495
7059
|
throw new ValidationError(`cursor must be a valid ${prefix} cursor`, "cursor");
|
|
6496
7060
|
}
|
|
6497
7061
|
}
|
|
6498
|
-
function
|
|
6499
|
-
return decodeCursor(cursor,
|
|
7062
|
+
function decodeIdCursor(cursor, prefix) {
|
|
7063
|
+
return decodeCursor(cursor, prefix, (value) => {
|
|
6500
7064
|
if (typeof value !== "object" || value === null || typeof Reflect.get(value, "id") !== "string") {
|
|
6501
|
-
throw new Error("invalid
|
|
7065
|
+
throw new Error("invalid id cursor");
|
|
6502
7066
|
}
|
|
6503
7067
|
const id = Reflect.get(value, "id");
|
|
6504
|
-
if (id.length === 0) throw new Error("invalid
|
|
7068
|
+
if (id.length === 0) throw new Error("invalid id cursor");
|
|
6505
7069
|
return id;
|
|
6506
7070
|
});
|
|
6507
7071
|
}
|
|
@@ -6578,7 +7142,7 @@ function normalizeActivityKind(value, field) {
|
|
|
6578
7142
|
}
|
|
6579
7143
|
return value;
|
|
6580
7144
|
}
|
|
6581
|
-
function
|
|
7145
|
+
function latestUpdatedAsOf(items) {
|
|
6582
7146
|
if (items.length === 0) return null;
|
|
6583
7147
|
const latest = items.reduce(
|
|
6584
7148
|
(current, item) => BigInt(item.updatedAtBlockNumber) > BigInt(current.updatedAtBlockNumber) ? item : current
|
|
@@ -6620,6 +7184,35 @@ function normalizeStakeLockRow(row, index, scope) {
|
|
|
6620
7184
|
updatedAt: normalizeDecimal(row.updatedAt, `${field}.updatedAt`)
|
|
6621
7185
|
};
|
|
6622
7186
|
}
|
|
7187
|
+
function normalizeTakerStakeAuthorizationRow(row, index, scope) {
|
|
7188
|
+
const field = `TakerStakeAuthorization[${index}]`;
|
|
7189
|
+
if (row.chainId !== scope.chainId) throw new Error(`${field}.chainId does not match the query`);
|
|
7190
|
+
if (normalizeAddress4(row.vaultAddress, `${field}.vaultAddress`) !== scope.vaultAddress) {
|
|
7191
|
+
throw new Error(`${field}.vaultAddress does not match the query`);
|
|
7192
|
+
}
|
|
7193
|
+
const taker = normalizeAddress4(row.taker, `${field}.taker`);
|
|
7194
|
+
const stakeOwner = normalizeAddress4(row.stakeOwner, `${field}.stakeOwner`);
|
|
7195
|
+
const scoped = scope.side === "stakeOwner" ? stakeOwner : taker;
|
|
7196
|
+
if (scoped !== scope.scopedAddress) {
|
|
7197
|
+
throw new Error(`${field}.${scope.side} does not match the query`);
|
|
7198
|
+
}
|
|
7199
|
+
if (typeof row.authorized !== "boolean") {
|
|
7200
|
+
throw new Error(`${field}.authorized must be a boolean`);
|
|
7201
|
+
}
|
|
7202
|
+
if (scope.authorized !== void 0 && row.authorized !== scope.authorized) {
|
|
7203
|
+
throw new Error(`${field}.authorized does not match the query`);
|
|
7204
|
+
}
|
|
7205
|
+
return {
|
|
7206
|
+
taker,
|
|
7207
|
+
stakeOwner,
|
|
7208
|
+
authorized: row.authorized,
|
|
7209
|
+
updatedAtBlockNumber: normalizeDecimal(
|
|
7210
|
+
row.updatedAtBlockNumber,
|
|
7211
|
+
`${field}.updatedAtBlockNumber`
|
|
7212
|
+
),
|
|
7213
|
+
updatedAt: normalizeDecimal(row.updatedAt, `${field}.updatedAt`)
|
|
7214
|
+
};
|
|
7215
|
+
}
|
|
6623
7216
|
function normalizeStakeActivityRow(row, index, scope) {
|
|
6624
7217
|
const field = `StakeActivity[${index}]`;
|
|
6625
7218
|
if (row.chainId !== scope.chainId) throw new Error(`${field}.chainId does not match the query`);
|
|
@@ -6770,7 +7363,7 @@ var IndexerStakingService = class {
|
|
|
6770
7363
|
const vaultAddress = normalizeAddress4(params.vaultAddress, "vaultAddress");
|
|
6771
7364
|
const stakeOwner = normalizeAddress4(params.stakeOwner, "stakeOwner");
|
|
6772
7365
|
const status = params.status ? normalizeLockStatus(params.status, "status") : void 0;
|
|
6773
|
-
const afterId = params.cursor ?
|
|
7366
|
+
const afterId = params.cursor ? decodeIdCursor(params.cursor, "zkp2p-lock-v1") : void 0;
|
|
6774
7367
|
const filters = [
|
|
6775
7368
|
{ chainId: { _eq: params.chainId } },
|
|
6776
7369
|
{ vaultAddress: { _eq: vaultAddress } },
|
|
@@ -6807,7 +7400,67 @@ var IndexerStakingService = class {
|
|
|
6807
7400
|
return {
|
|
6808
7401
|
items,
|
|
6809
7402
|
nextCursor: normalized.length > limit ? encodeCursor("zkp2p-lock-v1", { id: visible[visible.length - 1].id }) : null,
|
|
6810
|
-
asOf:
|
|
7403
|
+
asOf: latestUpdatedAsOf(items)
|
|
7404
|
+
};
|
|
7405
|
+
}
|
|
7406
|
+
/**
|
|
7407
|
+
* Pages one side of the vault's authorization graph: takers a stake owner
|
|
7408
|
+
* has authorized, or stake owners that have authorized a taker. Exactly one
|
|
7409
|
+
* of `stakeOwner` or `taker` scopes the page.
|
|
7410
|
+
*/
|
|
7411
|
+
async fetchTakerStakeAuthorizations(params, init) {
|
|
7412
|
+
validateChainId(params.chainId);
|
|
7413
|
+
const limit = validateLimit(params.limit);
|
|
7414
|
+
const vaultAddress = normalizeAddress4(params.vaultAddress, "vaultAddress");
|
|
7415
|
+
if (params.stakeOwner === void 0 === (params.taker === void 0)) {
|
|
7416
|
+
throw new ValidationError(
|
|
7417
|
+
"exactly one of stakeOwner or taker must be provided",
|
|
7418
|
+
"stakeOwner"
|
|
7419
|
+
);
|
|
7420
|
+
}
|
|
7421
|
+
const scope = params.stakeOwner !== void 0 ? {
|
|
7422
|
+
side: "stakeOwner",
|
|
7423
|
+
address: normalizeAddress4(params.stakeOwner, "stakeOwner")
|
|
7424
|
+
} : { side: "taker", address: normalizeAddress4(params.taker, "taker") };
|
|
7425
|
+
const afterId = params.cursor ? decodeIdCursor(params.cursor, "zkp2p-stake-auth-v1") : void 0;
|
|
7426
|
+
const filters = [
|
|
7427
|
+
{ chainId: { _eq: params.chainId } },
|
|
7428
|
+
{ vaultAddress: { _eq: vaultAddress } },
|
|
7429
|
+
{ [scope.side]: { _eq: scope.address } }
|
|
7430
|
+
];
|
|
7431
|
+
if (params.authorized !== void 0) filters.push({ authorized: { _eq: params.authorized } });
|
|
7432
|
+
if (afterId) filters.push({ id: { _gt: afterId } });
|
|
7433
|
+
const data3 = await this.client.query(
|
|
7434
|
+
{
|
|
7435
|
+
query: TAKER_STAKE_AUTHORIZATIONS_QUERY,
|
|
7436
|
+
variables: { limit: limit + 1, where: { _and: filters } }
|
|
7437
|
+
},
|
|
7438
|
+
init
|
|
7439
|
+
);
|
|
7440
|
+
let previousId = afterId;
|
|
7441
|
+
const normalized = data3.TakerStakeAuthorization.map((row, index) => {
|
|
7442
|
+
const id = assertNonEmptyId(row.id, `TakerStakeAuthorization[${index}].id`);
|
|
7443
|
+
if (previousId !== void 0 && id <= previousId) {
|
|
7444
|
+
throw new Error("TakerStakeAuthorization cursor did not advance");
|
|
7445
|
+
}
|
|
7446
|
+
previousId = id;
|
|
7447
|
+
return {
|
|
7448
|
+
item: normalizeTakerStakeAuthorizationRow(row, index, {
|
|
7449
|
+
chainId: params.chainId,
|
|
7450
|
+
vaultAddress,
|
|
7451
|
+
side: scope.side,
|
|
7452
|
+
scopedAddress: scope.address,
|
|
7453
|
+
authorized: params.authorized
|
|
7454
|
+
}),
|
|
7455
|
+
id
|
|
7456
|
+
};
|
|
7457
|
+
});
|
|
7458
|
+
const visible = normalized.slice(0, limit);
|
|
7459
|
+
const items = visible.map(({ item }) => item);
|
|
7460
|
+
return {
|
|
7461
|
+
items,
|
|
7462
|
+
nextCursor: normalized.length > limit ? encodeCursor("zkp2p-stake-auth-v1", { id: visible[visible.length - 1].id }) : null,
|
|
7463
|
+
asOf: latestUpdatedAsOf(items)
|
|
6811
7464
|
};
|
|
6812
7465
|
}
|
|
6813
7466
|
async fetchStakeActivity(params, init) {
|
|
@@ -7001,17 +7654,17 @@ var IndexerStakingService = class {
|
|
|
7001
7654
|
}
|
|
7002
7655
|
};
|
|
7003
7656
|
|
|
7004
|
-
// ../../node_modules/.pnpm/@zkp2p+contracts-v2@0.4.1-rc.
|
|
7005
|
-
var version = "0.4.1-rc.
|
|
7657
|
+
// ../../node_modules/.pnpm/@zkp2p+contracts-v2@0.4.1-rc.9_ethers@6.16.0_bufferutil@4.1.0_utf-8-validate@5.0.10__typescript@5.9.3_zod@4.5.4/node_modules/@zkp2p/contracts-v2/_esm/index.js
|
|
7658
|
+
var version = "0.4.1-rc.9";
|
|
7006
7659
|
|
|
7007
|
-
// ../../node_modules/.pnpm/@zkp2p+contracts-v2@0.4.1-rc.
|
|
7660
|
+
// ../../node_modules/.pnpm/@zkp2p+contracts-v2@0.4.1-rc.9_ethers@6.16.0_bufferutil@4.1.0_utf-8-validate@5.0.10__typescript@5.9.3_zod@4.5.4/node_modules/@zkp2p/contracts-v2/_esm/disputeStack/base.js
|
|
7008
7661
|
var data = {
|
|
7009
|
-
"schemaVersion":
|
|
7662
|
+
"schemaVersion": 2,
|
|
7010
7663
|
"network": "base",
|
|
7011
7664
|
"chainId": 8453,
|
|
7012
7665
|
"activeDisputeStack": {
|
|
7013
|
-
"version":
|
|
7014
|
-
"selectionHash": "
|
|
7666
|
+
"version": 2,
|
|
7667
|
+
"selectionHash": "ba40c2954b408d0c658881a8d28e5bfcc9bade5cc3d953fd17eae1eca69d841c"
|
|
7015
7668
|
},
|
|
7016
7669
|
"runtimeIdentities": {
|
|
7017
7670
|
"Orchestrator": {
|
|
@@ -7027,32 +7680,32 @@ var data = {
|
|
|
7027
7680
|
"runtimeCodeHash": "0x4e58f26129559301c017ff264b61dd2255ed2107593d308472ef32d07b8745e9"
|
|
7028
7681
|
},
|
|
7029
7682
|
"StakeVault": {
|
|
7030
|
-
"address": "
|
|
7683
|
+
"address": "0x47c26258222e2f96424bD2B21bf173f0DA5034C7",
|
|
7031
7684
|
"runtimeCodeHash": "0xfd8d2a910b9ac2c55675ae06d0504f9aac43b02b7022755cf229b571156c681d"
|
|
7032
7685
|
},
|
|
7033
7686
|
"DisputeProtectionPolicy": {
|
|
7034
|
-
"address": "
|
|
7035
|
-
"runtimeCodeHash": "
|
|
7687
|
+
"address": "0xbF4B769dB70DBEc89b6b2c44988304a7aD2de4Fc",
|
|
7688
|
+
"runtimeCodeHash": "0xf5a7756f16556da69c91c55bdcffd9fd95cc8cbdb772699827ec4c66db136dfe"
|
|
7036
7689
|
},
|
|
7037
7690
|
"IntentLifecycleHookV1": {
|
|
7038
|
-
"address": "
|
|
7039
|
-
"runtimeCodeHash": "
|
|
7691
|
+
"address": "0x5Dd6C675a7406fE8C9f0D93394a36fd6e8c50031",
|
|
7692
|
+
"runtimeCodeHash": "0x2b479a570ddea7a990f2cae8fa95eb3b8599fc8b367332b8dab92f7d0cebf7e0"
|
|
7040
7693
|
},
|
|
7041
7694
|
"RecognizedPredecessorHook": {
|
|
7042
|
-
"address": "
|
|
7043
|
-
"runtimeCodeHash": "
|
|
7695
|
+
"address": "0x71467dCac3B50eeED5A485aC6a70f27B1EAC1970",
|
|
7696
|
+
"runtimeCodeHash": "0x35789014e608a248f3244b61210fa259fee3566c33f50fd0e3fa1f5ae22e370b"
|
|
7044
7697
|
},
|
|
7045
7698
|
"RecognizedPredecessorPolicy": {
|
|
7046
|
-
"address": "
|
|
7047
|
-
"runtimeCodeHash": "
|
|
7699
|
+
"address": "0xcEc48F7242eDBf02875BB4629115Bd927e1287aA",
|
|
7700
|
+
"runtimeCodeHash": "0x9c4be279da216021183638eaef79ebf98db248472685e9ecd0de3f24a513a641"
|
|
7048
7701
|
},
|
|
7049
7702
|
"OrchestratorRegistry": {
|
|
7050
7703
|
"address": "0xBe9fED15ED7A4B915C03EFcEcb9662739C3382A9",
|
|
7051
7704
|
"runtimeCodeHash": "0xf0d132d621ac03181a6fade6a93bd0968d33830c8bf393793236787e7978aee1"
|
|
7052
7705
|
},
|
|
7053
7706
|
"WhitelistPolicy": {
|
|
7054
|
-
"address": "
|
|
7055
|
-
"runtimeCodeHash": "
|
|
7707
|
+
"address": "0x389Cd9bA91FfFcd83d267B241E975541892759Ce",
|
|
7708
|
+
"runtimeCodeHash": "0xa83d138a5b89d2fd2861702febc6333e542dcdc8994ee76c345dcbd22fe685a4"
|
|
7056
7709
|
},
|
|
7057
7710
|
"DisputeVerifier": {
|
|
7058
7711
|
"address": "0x30d4947f005653637005eed991005119D9eB2f34",
|
|
@@ -7076,26 +7729,26 @@ var data = {
|
|
|
7076
7729
|
"StakeToken": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"
|
|
7077
7730
|
},
|
|
7078
7731
|
"expectedRelations": {
|
|
7079
|
-
"activeLifecycleHook": "
|
|
7080
|
-
"recognizedPredecessorPolicy": "
|
|
7732
|
+
"activeLifecycleHook": "0x5Dd6C675a7406fE8C9f0D93394a36fd6e8c50031",
|
|
7733
|
+
"recognizedPredecessorPolicy": "0xcEc48F7242eDBf02875BB4629115Bd927e1287aA",
|
|
7081
7734
|
"registeredOrchestrator": "0x014025fDE093f8701d86e9f38e2C3a9b779cb5c7",
|
|
7082
|
-
"authorizedLifecycleHook": "
|
|
7083
|
-
"disputeNullifierAuthorizedWriter": "
|
|
7735
|
+
"authorizedLifecycleHook": "0x5Dd6C675a7406fE8C9f0D93394a36fd6e8c50031",
|
|
7736
|
+
"disputeNullifierAuthorizedWriter": "0xbF4B769dB70DBEc89b6b2c44988304a7aD2de4Fc",
|
|
7084
7737
|
"orchestratorEscrowRegistry": "0xeD0e847B101abc96E796260AC358e12BAa2f5B21",
|
|
7085
7738
|
"orchestratorPaymentVerifierRegistry": "0x2b82D24437ff66Fb173eabDfD67ee2ACeb8bEb1e",
|
|
7086
7739
|
"orchestratorRelayerRegistry": "0xEbA979889a9c97382A92472fF3703786fF180083",
|
|
7087
7740
|
"hookOrchestratorRegistry": "0xBe9fED15ED7A4B915C03EFcEcb9662739C3382A9",
|
|
7088
|
-
"hookWhitelistPolicy": "
|
|
7089
|
-
"hookDisputeProtectionPolicy": "
|
|
7741
|
+
"hookWhitelistPolicy": "0x389Cd9bA91FfFcd83d267B241E975541892759Ce",
|
|
7742
|
+
"hookDisputeProtectionPolicy": "0xbF4B769dB70DBEc89b6b2c44988304a7aD2de4Fc",
|
|
7090
7743
|
"whitelistGroupRegistry": "0x39F80118f9eB619135f116171b6Cb91D372C5AF2",
|
|
7091
7744
|
"whitelistEscrowRegistry": "0xeD0e847B101abc96E796260AC358e12BAa2f5B21",
|
|
7092
7745
|
"whitelistOrchestratorRegistry": "0xBe9fED15ED7A4B915C03EFcEcb9662739C3382A9",
|
|
7093
|
-
"policyStakeVault": "
|
|
7746
|
+
"policyStakeVault": "0x47c26258222e2f96424bD2B21bf173f0DA5034C7",
|
|
7094
7747
|
"policyDisputeVerifier": "0x30d4947f005653637005eed991005119D9eB2f34",
|
|
7095
7748
|
"policyDisputeNullifierRegistry": "0xA845615b5203F7a21321DdF5e3a1ca024D93a443",
|
|
7096
7749
|
"disputeVerifierNullifierRegistry": "0x5455e761b866dfa6A2f5Dc6d6525825bf9C09aeB",
|
|
7097
7750
|
"disputeVerifierAttestationVerifier": "0x9Fe920b24e50e6a6362BA71a1BeB502A99c402d5",
|
|
7098
|
-
"vaultController": "
|
|
7751
|
+
"vaultController": "0xbF4B769dB70DBEc89b6b2c44988304a7aD2de4Fc",
|
|
7099
7752
|
"vaultStakeToken": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"
|
|
7100
7753
|
},
|
|
7101
7754
|
"expectedGovernance": {
|
|
@@ -7131,15 +7784,15 @@ var data = {
|
|
|
7131
7784
|
"0x888888359E981B5225CA48fbCdCeff702FC3b888",
|
|
7132
7785
|
"0x014025fDE093f8701d86e9f38e2C3a9b779cb5c7"
|
|
7133
7786
|
],
|
|
7134
|
-
"lifecycleHookAuthorizationFromBlock": "
|
|
7787
|
+
"lifecycleHookAuthorizationFromBlock": "50537204",
|
|
7135
7788
|
"authorizedLifecycleHooks": [
|
|
7136
|
-
"
|
|
7789
|
+
"0x5Dd6C675a7406fE8C9f0D93394a36fd6e8c50031"
|
|
7137
7790
|
],
|
|
7138
7791
|
"passiveDisputeNullifierWriters": [
|
|
7139
|
-
"
|
|
7792
|
+
"0xcEc48F7242eDBf02875BB4629115Bd927e1287aA"
|
|
7140
7793
|
],
|
|
7141
7794
|
"activeDisputeNullifierWriters": [
|
|
7142
|
-
"
|
|
7795
|
+
"0xbF4B769dB70DBEc89b6b2c44988304a7aD2de4Fc"
|
|
7143
7796
|
]
|
|
7144
7797
|
},
|
|
7145
7798
|
"riskWindowSecondsByPaymentMethod": {
|
|
@@ -7174,14 +7827,14 @@ var data = {
|
|
|
7174
7827
|
};
|
|
7175
7828
|
var base_default = data;
|
|
7176
7829
|
|
|
7177
|
-
// ../../node_modules/.pnpm/@zkp2p+contracts-v2@0.4.1-rc.
|
|
7830
|
+
// ../../node_modules/.pnpm/@zkp2p+contracts-v2@0.4.1-rc.9_ethers@6.16.0_bufferutil@4.1.0_utf-8-validate@5.0.10__typescript@5.9.3_zod@4.5.4/node_modules/@zkp2p/contracts-v2/_esm/disputeStack/baseStaging.js
|
|
7178
7831
|
var data2 = {
|
|
7179
|
-
"schemaVersion":
|
|
7832
|
+
"schemaVersion": 2,
|
|
7180
7833
|
"network": "base_staging",
|
|
7181
7834
|
"chainId": 8453,
|
|
7182
7835
|
"activeDisputeStack": {
|
|
7183
|
-
"version":
|
|
7184
|
-
"selectionHash": "
|
|
7836
|
+
"version": 2,
|
|
7837
|
+
"selectionHash": "6c49c1ce51eec594a22385c4efcab08aa9926b6b63a725e14a0027ec5d2f4fc9"
|
|
7185
7838
|
},
|
|
7186
7839
|
"runtimeIdentities": {
|
|
7187
7840
|
"Orchestrator": {
|
|
@@ -7197,16 +7850,16 @@ var data2 = {
|
|
|
7197
7850
|
"runtimeCodeHash": "0x4e58f26129559301c017ff264b61dd2255ed2107593d308472ef32d07b8745e9"
|
|
7198
7851
|
},
|
|
7199
7852
|
"StakeVault": {
|
|
7200
|
-
"address": "
|
|
7853
|
+
"address": "0x92d7B59E99e1CD2066540Cd2413b8714948b731f",
|
|
7201
7854
|
"runtimeCodeHash": "0xfd8d2a910b9ac2c55675ae06d0504f9aac43b02b7022755cf229b571156c681d"
|
|
7202
7855
|
},
|
|
7203
7856
|
"DisputeProtectionPolicy": {
|
|
7204
|
-
"address": "
|
|
7205
|
-
"runtimeCodeHash": "
|
|
7857
|
+
"address": "0x484fA07F085eb66bb7C2b649Ea9d5894b2B6681c",
|
|
7858
|
+
"runtimeCodeHash": "0x70c43bfae8253a6a166f9697ddc27b2d77b4d9841e01fefc2db84037d9a98622"
|
|
7206
7859
|
},
|
|
7207
7860
|
"IntentLifecycleHookV1": {
|
|
7208
|
-
"address": "
|
|
7209
|
-
"runtimeCodeHash": "
|
|
7861
|
+
"address": "0x5A7f6cb7397134da1fDEFA7E2D434b4Cf18E56D9",
|
|
7862
|
+
"runtimeCodeHash": "0xb9ce42108c706f9241aeb41ffdc0da6b7584e8482183055452098b2f16c7abfd"
|
|
7210
7863
|
},
|
|
7211
7864
|
"RecognizedPredecessorHook": {
|
|
7212
7865
|
"address": "0x19D9F0Fcb08C60D8bd0CD061C34eae27eF8b6e65",
|
|
@@ -7221,8 +7874,8 @@ var data2 = {
|
|
|
7221
7874
|
"runtimeCodeHash": "0xf0d132d621ac03181a6fade6a93bd0968d33830c8bf393793236787e7978aee1"
|
|
7222
7875
|
},
|
|
7223
7876
|
"WhitelistPolicy": {
|
|
7224
|
-
"address": "
|
|
7225
|
-
"runtimeCodeHash": "
|
|
7877
|
+
"address": "0xF79aAD1BAaB617fF3Eb299225c80893F22F743Fe",
|
|
7878
|
+
"runtimeCodeHash": "0x1ece96bb7be9cdd2433a2aad66c9b2d710e3e210a65876e0f8c1e43662ee5653"
|
|
7226
7879
|
},
|
|
7227
7880
|
"DisputeVerifier": {
|
|
7228
7881
|
"address": "0x973578148c5Fd49b9f68B50B26066555325AC708",
|
|
@@ -7246,26 +7899,26 @@ var data2 = {
|
|
|
7246
7899
|
"StakeToken": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"
|
|
7247
7900
|
},
|
|
7248
7901
|
"expectedRelations": {
|
|
7249
|
-
"activeLifecycleHook": "
|
|
7902
|
+
"activeLifecycleHook": "0x5A7f6cb7397134da1fDEFA7E2D434b4Cf18E56D9",
|
|
7250
7903
|
"recognizedPredecessorPolicy": "0x21517b7743E727ae47A66FafF93550B689c15020",
|
|
7251
7904
|
"registeredOrchestrator": "0x2b5E8Ab562e45fA89D73802605E145ED3E3EeF4f",
|
|
7252
|
-
"authorizedLifecycleHook": "
|
|
7253
|
-
"disputeNullifierAuthorizedWriter": "
|
|
7905
|
+
"authorizedLifecycleHook": "0x5A7f6cb7397134da1fDEFA7E2D434b4Cf18E56D9",
|
|
7906
|
+
"disputeNullifierAuthorizedWriter": "0x484fA07F085eb66bb7C2b649Ea9d5894b2B6681c",
|
|
7254
7907
|
"orchestratorEscrowRegistry": "0xc545f336eC77E69bf115729acCbf2e557A00ac91",
|
|
7255
7908
|
"orchestratorPaymentVerifierRegistry": "0x2261416DA54C85f975C73FA56EF4D2D6b0aEF7Cc",
|
|
7256
7909
|
"orchestratorRelayerRegistry": "0xB214650b424E6b5fdcB1259566eB7A512D8Bd25E",
|
|
7257
7910
|
"hookOrchestratorRegistry": "0xfA6384EB6176cfEC049540526A3d2126C3666d8A",
|
|
7258
|
-
"hookWhitelistPolicy": "
|
|
7259
|
-
"hookDisputeProtectionPolicy": "
|
|
7911
|
+
"hookWhitelistPolicy": "0xF79aAD1BAaB617fF3Eb299225c80893F22F743Fe",
|
|
7912
|
+
"hookDisputeProtectionPolicy": "0x484fA07F085eb66bb7C2b649Ea9d5894b2B6681c",
|
|
7260
7913
|
"whitelistGroupRegistry": "0x54Ff7788Cb42B46FE2F016a65Fd0f654Bb9BcF3D",
|
|
7261
7914
|
"whitelistEscrowRegistry": "0xc545f336eC77E69bf115729acCbf2e557A00ac91",
|
|
7262
7915
|
"whitelistOrchestratorRegistry": "0xfA6384EB6176cfEC049540526A3d2126C3666d8A",
|
|
7263
|
-
"policyStakeVault": "
|
|
7916
|
+
"policyStakeVault": "0x92d7B59E99e1CD2066540Cd2413b8714948b731f",
|
|
7264
7917
|
"policyDisputeVerifier": "0x973578148c5Fd49b9f68B50B26066555325AC708",
|
|
7265
7918
|
"policyDisputeNullifierRegistry": "0xE0B05a9655AF0f31E32904267baa50FbC7f217ea",
|
|
7266
7919
|
"disputeVerifierNullifierRegistry": "0x2eb43d6C7c7Ec4220Aa6B8735BC053824a71778C",
|
|
7267
7920
|
"disputeVerifierAttestationVerifier": "0x9855a39aC5975069632e91160d8712CBfF19e864",
|
|
7268
|
-
"vaultController": "
|
|
7921
|
+
"vaultController": "0x484fA07F085eb66bb7C2b649Ea9d5894b2B6681c",
|
|
7269
7922
|
"vaultStakeToken": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"
|
|
7270
7923
|
},
|
|
7271
7924
|
"expectedGovernance": {
|
|
@@ -7301,15 +7954,15 @@ var data2 = {
|
|
|
7301
7954
|
"0xc17a59227B136c45fAa153086a15EF87ED14bE00",
|
|
7302
7955
|
"0x2b5E8Ab562e45fA89D73802605E145ED3E3EeF4f"
|
|
7303
7956
|
],
|
|
7304
|
-
"lifecycleHookAuthorizationFromBlock": "
|
|
7957
|
+
"lifecycleHookAuthorizationFromBlock": "50536390",
|
|
7305
7958
|
"authorizedLifecycleHooks": [
|
|
7306
|
-
"
|
|
7959
|
+
"0x5A7f6cb7397134da1fDEFA7E2D434b4Cf18E56D9"
|
|
7307
7960
|
],
|
|
7308
7961
|
"passiveDisputeNullifierWriters": [
|
|
7309
7962
|
"0x21517b7743E727ae47A66FafF93550B689c15020"
|
|
7310
7963
|
],
|
|
7311
7964
|
"activeDisputeNullifierWriters": [
|
|
7312
|
-
"
|
|
7965
|
+
"0x484fA07F085eb66bb7C2b649Ea9d5894b2B6681c"
|
|
7313
7966
|
]
|
|
7314
7967
|
},
|
|
7315
7968
|
"riskWindowSecondsByPaymentMethod": {
|
|
@@ -7334,7 +7987,7 @@ var data2 = {
|
|
|
7334
7987
|
"prerequisites": {
|
|
7335
7988
|
"orchestratorPaused": false,
|
|
7336
7989
|
"admissionsPaused": false,
|
|
7337
|
-
"allowMultipleIntents":
|
|
7990
|
+
"allowMultipleIntents": false,
|
|
7338
7991
|
"orchestratorRegistered": true,
|
|
7339
7992
|
"lifecycleHookAuthorized": true,
|
|
7340
7993
|
"disputeNullifierWriterAuthorized": true,
|
|
@@ -7348,7 +8001,7 @@ var baseStaging_default = data2;
|
|
|
7348
8001
|
|
|
7349
8002
|
// src/buildMetadata.ts
|
|
7350
8003
|
var DEVELOPMENT_BUILD_METADATA = {
|
|
7351
|
-
schemaVersion:
|
|
8004
|
+
schemaVersion: 2,
|
|
7352
8005
|
source: {
|
|
7353
8006
|
repository: "zkp2p/zkp2p-clients",
|
|
7354
8007
|
commitSha: "development",
|
|
@@ -7359,13 +8012,14 @@ var DEVELOPMENT_BUILD_METADATA = {
|
|
|
7359
8012
|
contractsPackageVersion: "development",
|
|
7360
8013
|
indexerSchemaPackageVersion: "development",
|
|
7361
8014
|
activeDisputeStack: {
|
|
7362
|
-
base: { version:
|
|
7363
|
-
baseStaging: { version:
|
|
8015
|
+
base: { version: 2, selectionHash: "development" },
|
|
8016
|
+
baseStaging: { version: 2, selectionHash: "development" }
|
|
7364
8017
|
}
|
|
7365
8018
|
};
|
|
7366
8019
|
var SDK_BUILD_METADATA = typeof define_ZKP2P_SDK_BUILD_METADATA_default === "undefined" ? DEVELOPMENT_BUILD_METADATA : define_ZKP2P_SDK_BUILD_METADATA_default;
|
|
7367
8020
|
|
|
7368
8021
|
// src/client/DisputeProtectionReadiness.ts
|
|
8022
|
+
var DisputeProtectionPolicy = DISPUTE_PROTECTION_POLICY_ABI ?? DisputeProtectionPolicy_default;
|
|
7369
8023
|
var SUCCESSOR_RUNTIME_IDENTITIES = [
|
|
7370
8024
|
"IntentLifecycleHookV1",
|
|
7371
8025
|
"StakeVault",
|
|
@@ -7380,7 +8034,7 @@ var GOVERNANCE_ABIS = {
|
|
|
7380
8034
|
OrchestratorRegistry: OrchestratorRegistry_default,
|
|
7381
8035
|
OrchestratorV3: OrchestratorV3_default,
|
|
7382
8036
|
StakeVault: StakeVault_default,
|
|
7383
|
-
DisputeProtectionPolicy
|
|
8037
|
+
DisputeProtectionPolicy,
|
|
7384
8038
|
WhitelistPolicy: WhitelistPolicy_default,
|
|
7385
8039
|
DisputeVerifier: DisputeVerifier_default,
|
|
7386
8040
|
DisputeNullifierRegistry: DisputeNullifierRegistry_default,
|
|
@@ -7389,7 +8043,7 @@ var GOVERNANCE_ABIS = {
|
|
|
7389
8043
|
var ORCHESTRATOR_AUTHORIZATION_EVENTS = OrchestratorRegistry_default.filter(
|
|
7390
8044
|
(item) => item.type === "event" && (item.name === "OrchestratorAdded" || item.name === "OrchestratorRemoved")
|
|
7391
8045
|
);
|
|
7392
|
-
var LIFECYCLE_HOOK_AUTHORIZATION_EVENTS =
|
|
8046
|
+
var LIFECYCLE_HOOK_AUTHORIZATION_EVENTS = DisputeProtectionPolicy.filter(
|
|
7393
8047
|
(item) => item.type === "event" && item.name === "LifecycleHookAuthorizationUpdated"
|
|
7394
8048
|
);
|
|
7395
8049
|
var FALLBACK_LOG_BLOCK_SPAN = 10000n;
|
|
@@ -7425,6 +8079,17 @@ function expectAddressSet(label, actual, expected) {
|
|
|
7425
8079
|
throw new ReadinessMismatch(`${label} mismatch`);
|
|
7426
8080
|
}
|
|
7427
8081
|
}
|
|
8082
|
+
function expectAddressSubsetWithRequired(label, actual, expected, required) {
|
|
8083
|
+
const actualAddresses = normalizeAddressSet(label, actual);
|
|
8084
|
+
const expectedAddresses = new Set(normalizeAddressSet(label, expected));
|
|
8085
|
+
const unknown = actualAddresses.filter((address) => !expectedAddresses.has(address));
|
|
8086
|
+
if (unknown.length > 0) {
|
|
8087
|
+
throw new ReadinessMismatch(`${label} mismatch`);
|
|
8088
|
+
}
|
|
8089
|
+
if (!actualAddresses.includes(required.toLowerCase())) {
|
|
8090
|
+
throw new ReadinessMismatch(`${label} is missing the active successor orchestrator`);
|
|
8091
|
+
}
|
|
8092
|
+
}
|
|
7428
8093
|
function fallbackBlockRanges(fromBlock, toBlock) {
|
|
7429
8094
|
const ranges = [];
|
|
7430
8095
|
for (let start = fromBlock; start <= toBlock; start += FALLBACK_LOG_BLOCK_SPAN) {
|
|
@@ -7474,6 +8139,55 @@ function replayAddressAuthorizations(label, events, addressField, enabledField)
|
|
|
7474
8139
|
function manifestForEnvironment(environment) {
|
|
7475
8140
|
return environment === "staging" ? baseStaging_default : base_default;
|
|
7476
8141
|
}
|
|
8142
|
+
async function readDisputeAttestationConfig({
|
|
8143
|
+
publicClient,
|
|
8144
|
+
chainId,
|
|
8145
|
+
environment = "production"
|
|
8146
|
+
}) {
|
|
8147
|
+
const manifest = manifestForEnvironment(environment);
|
|
8148
|
+
if (manifest.chainId !== chainId) {
|
|
8149
|
+
throw new Error(
|
|
8150
|
+
`Dispute attestation is unavailable for chainId=${chainId}, env=${environment}`
|
|
8151
|
+
);
|
|
8152
|
+
}
|
|
8153
|
+
const asOfBlock = await publicClient.getBlockNumber();
|
|
8154
|
+
const attestationVerifier = manifest.runtimeIdentities.MultiAttestationVerifier.address;
|
|
8155
|
+
const [rawRequiredSignatures, rawTrustedSigners] = await publicClient.multicall({
|
|
8156
|
+
allowFailure: false,
|
|
8157
|
+
blockNumber: asOfBlock,
|
|
8158
|
+
contracts: [
|
|
8159
|
+
{
|
|
8160
|
+
address: attestationVerifier,
|
|
8161
|
+
abi: MultiAttestationVerifier_default,
|
|
8162
|
+
functionName: "requiredSignatures"
|
|
8163
|
+
},
|
|
8164
|
+
{
|
|
8165
|
+
address: attestationVerifier,
|
|
8166
|
+
abi: MultiAttestationVerifier_default,
|
|
8167
|
+
functionName: "witnesses"
|
|
8168
|
+
}
|
|
8169
|
+
]
|
|
8170
|
+
});
|
|
8171
|
+
const requiredSignatures = typeof rawRequiredSignatures === "bigint" ? Number(rawRequiredSignatures) : Number.NaN;
|
|
8172
|
+
if (!Number.isSafeInteger(requiredSignatures) || requiredSignatures < 1) {
|
|
8173
|
+
throw new Error("Dispute attestation verifier has an invalid signature threshold");
|
|
8174
|
+
}
|
|
8175
|
+
const trustedSigners = normalizeAddressSet(
|
|
8176
|
+
"MultiAttestationVerifier.witnesses",
|
|
8177
|
+
rawTrustedSigners
|
|
8178
|
+
);
|
|
8179
|
+
if (trustedSigners.length < requiredSignatures) {
|
|
8180
|
+
throw new Error("Dispute attestation verifier has fewer witnesses than required signatures");
|
|
8181
|
+
}
|
|
8182
|
+
return {
|
|
8183
|
+
asOfBlock,
|
|
8184
|
+
chainId: manifest.chainId,
|
|
8185
|
+
policyAddress: manifest.runtimeIdentities.DisputeProtectionPolicy.address,
|
|
8186
|
+
verifierAddress: manifest.runtimeIdentities.DisputeVerifier.address,
|
|
8187
|
+
trustedSigners,
|
|
8188
|
+
requiredSignatures
|
|
8189
|
+
};
|
|
8190
|
+
}
|
|
7477
8191
|
function validatePackagedIdentity(config) {
|
|
7478
8192
|
const { buildMetadata, chainId, contractsPackageVersion, manifest } = config;
|
|
7479
8193
|
if (!buildMetadata.source.distributable) return "SDK build metadata is not distributable";
|
|
@@ -7483,7 +8197,7 @@ function validatePackagedIdentity(config) {
|
|
|
7483
8197
|
if (buildMetadata.contractsPackageVersion !== contractsPackageVersion) {
|
|
7484
8198
|
return "contracts package version does not match SDK build metadata";
|
|
7485
8199
|
}
|
|
7486
|
-
if (manifest.schemaVersion !==
|
|
8200
|
+
if (manifest.schemaVersion !== 2 || manifest.chainId !== chainId || manifest.network !== "base" && manifest.network !== "base_staging") {
|
|
7487
8201
|
return "dispute readiness manifest chain identity mismatch";
|
|
7488
8202
|
}
|
|
7489
8203
|
const selected = manifest.network === "base" ? buildMetadata.activeDisputeStack.base : buildMetadata.activeDisputeStack.baseStaging;
|
|
@@ -7713,10 +8427,11 @@ var DisputeProtectionReadinessReader = class {
|
|
|
7713
8427
|
"hook",
|
|
7714
8428
|
"isAuthorized"
|
|
7715
8429
|
);
|
|
7716
|
-
|
|
8430
|
+
expectAddressSubsetWithRequired(
|
|
7717
8431
|
"OrchestratorRegistry authorized orchestrators",
|
|
7718
8432
|
orchestrators,
|
|
7719
|
-
authorizations.authorizedOrchestrators
|
|
8433
|
+
authorizations.authorizedOrchestrators,
|
|
8434
|
+
this.config.manifest.runtimeIdentities.OrchestratorV3.address
|
|
7720
8435
|
);
|
|
7721
8436
|
expectAddressSet(
|
|
7722
8437
|
"DisputeProtectionPolicy authorized lifecycle hooks",
|
|
@@ -7738,6 +8453,10 @@ var DisputeProtectionReadinessReader = class {
|
|
|
7738
8453
|
const riskWindows = Object.entries(manifest.riskWindowSecondsByPaymentMethod).sort(
|
|
7739
8454
|
([left], [right]) => left.localeCompare(right)
|
|
7740
8455
|
);
|
|
8456
|
+
const sentinelPaymentMethod = riskWindows[0]?.[0];
|
|
8457
|
+
if (!sentinelPaymentMethod) {
|
|
8458
|
+
throw new ReadinessMismatch("DisputeProtectionPolicy sentinel payment method is missing");
|
|
8459
|
+
}
|
|
7741
8460
|
const contracts = [
|
|
7742
8461
|
{
|
|
7743
8462
|
address: identities.IntentLifecycleHookV1.address,
|
|
@@ -7775,34 +8494,38 @@ var DisputeProtectionReadinessReader = class {
|
|
|
7775
8494
|
abi: WhitelistPolicy_default,
|
|
7776
8495
|
functionName: "orchestratorRegistry"
|
|
7777
8496
|
},
|
|
7778
|
-
{ address: policy, abi:
|
|
7779
|
-
{ address: policy, abi:
|
|
8497
|
+
{ address: policy, abi: DisputeProtectionPolicy, functionName: "stakeVault" },
|
|
8498
|
+
{ address: policy, abi: DisputeProtectionPolicy, functionName: "disputeVerifier" },
|
|
7780
8499
|
{
|
|
7781
8500
|
address: policy,
|
|
7782
|
-
abi:
|
|
8501
|
+
abi: DisputeProtectionPolicy,
|
|
7783
8502
|
functionName: "disputeNullifierRegistry"
|
|
7784
8503
|
},
|
|
7785
8504
|
{
|
|
7786
8505
|
address: policy,
|
|
7787
|
-
abi:
|
|
8506
|
+
abi: DisputeProtectionPolicy,
|
|
7788
8507
|
functionName: "isLifecycleHookAuthorized",
|
|
7789
8508
|
args: [relations.authorizedLifecycleHook]
|
|
7790
8509
|
},
|
|
7791
|
-
{ address: policy, abi:
|
|
8510
|
+
{ address: policy, abi: DisputeProtectionPolicy, functionName: "admissionsPaused" },
|
|
7792
8511
|
{
|
|
7793
8512
|
address: policy,
|
|
7794
|
-
abi:
|
|
8513
|
+
abi: DisputeProtectionPolicy,
|
|
7795
8514
|
functionName: "PENDING_COVERAGE_MATURITY"
|
|
7796
8515
|
},
|
|
7797
8516
|
{
|
|
7798
8517
|
address: policy,
|
|
7799
|
-
abi:
|
|
8518
|
+
abi: DisputeProtectionPolicy,
|
|
7800
8519
|
functionName: "isDisputeProtectionEnabled",
|
|
7801
|
-
args: [
|
|
8520
|
+
args: [
|
|
8521
|
+
manifest.sentinel.escrow,
|
|
8522
|
+
BigInt(manifest.sentinel.depositId),
|
|
8523
|
+
sentinelPaymentMethod
|
|
8524
|
+
]
|
|
7802
8525
|
},
|
|
7803
8526
|
...riskWindows.map(([paymentMethod]) => ({
|
|
7804
8527
|
address: policy,
|
|
7805
|
-
abi:
|
|
8528
|
+
abi: DisputeProtectionPolicy,
|
|
7806
8529
|
functionName: "getRiskWindow",
|
|
7807
8530
|
args: [paymentMethod]
|
|
7808
8531
|
})),
|
|
@@ -8349,6 +9072,26 @@ function assertCatalogPaymentMethods(paymentMethods, chainId, runtimeEnv, field)
|
|
|
8349
9072
|
}
|
|
8350
9073
|
});
|
|
8351
9074
|
}
|
|
9075
|
+
function assertCatalogCurrencies(paymentMethods, currencies, chainId, runtimeEnv, field) {
|
|
9076
|
+
const catalogByHash = new Map(
|
|
9077
|
+
Object.values(getPaymentMethodsCatalog(chainId, runtimeEnv)).map((entry) => [
|
|
9078
|
+
entry.paymentMethodHash.toLowerCase(),
|
|
9079
|
+
new Set(entry.currencies?.map((currency) => currency.toLowerCase()) ?? [])
|
|
9080
|
+
])
|
|
9081
|
+
);
|
|
9082
|
+
paymentMethods.forEach((paymentMethod, paymentMethodIndex) => {
|
|
9083
|
+
const allowedCurrencies = catalogByHash.get(paymentMethod.toLowerCase());
|
|
9084
|
+
if (!allowedCurrencies?.size) return;
|
|
9085
|
+
currencies[paymentMethodIndex]?.forEach((currency, currencyIndex) => {
|
|
9086
|
+
if (!allowedCurrencies.has(currency.code.toLowerCase())) {
|
|
9087
|
+
throw new ValidationError(
|
|
9088
|
+
`Unsupported currency hash ${currency.code} for payment method ${paymentMethod}`,
|
|
9089
|
+
`${field}[${paymentMethodIndex}][${currencyIndex}].code`
|
|
9090
|
+
);
|
|
9091
|
+
}
|
|
9092
|
+
});
|
|
9093
|
+
});
|
|
9094
|
+
}
|
|
8352
9095
|
var Zkp2pClient = class {
|
|
8353
9096
|
/**
|
|
8354
9097
|
* Creates a new Zkp2pClient instance.
|
|
@@ -8382,7 +9125,12 @@ var Zkp2pClient = class {
|
|
|
8382
9125
|
() => []
|
|
8383
9126
|
);
|
|
8384
9127
|
/** Enable or disable dispute protection for one deposit. */
|
|
8385
|
-
this.setDisputeProtectionEnabled = this.buildDisputeProtectionPolicyMethod("setDisputeProtectionEnabled", (params) => [
|
|
9128
|
+
this.setDisputeProtectionEnabled = this.buildDisputeProtectionPolicyMethod("setDisputeProtectionEnabled", (params) => [
|
|
9129
|
+
params.escrow,
|
|
9130
|
+
params.depositId,
|
|
9131
|
+
params.paymentMethod,
|
|
9132
|
+
params.enabled
|
|
9133
|
+
]);
|
|
8386
9134
|
/**
|
|
8387
9135
|
* Release one protected intent whose risk window matured, unlocking its
|
|
8388
9136
|
* stake cover. Permissionless once mature. Pass `disputeProtectionPolicyAddress` to
|
|
@@ -9457,6 +10205,7 @@ var Zkp2pClient = class {
|
|
|
9457
10205
|
});
|
|
9458
10206
|
this._accessPolicyOps = new AccessPolicyOperations({
|
|
9459
10207
|
getPublicClient: () => this.publicClient,
|
|
10208
|
+
getRuntimeEnv: () => this.runtimeEnv,
|
|
9460
10209
|
getPolicyAddress: () => this.whitelistPolicyAddress,
|
|
9461
10210
|
getPolicyAbi: () => this.whitelistPolicyAbi,
|
|
9462
10211
|
getRegistryAddress: () => this.addressGroupRegistryAddress,
|
|
@@ -10300,6 +11049,15 @@ var Zkp2pClient = class {
|
|
|
10300
11049
|
getStakeLocks: (params, options) => {
|
|
10301
11050
|
return stakingService.fetchStakeLocks(params, { signal: options?.signal });
|
|
10302
11051
|
},
|
|
11052
|
+
/**
|
|
11053
|
+
* Pages one side of the vault's authorization graph: the takers a stake
|
|
11054
|
+
* owner has authorized, or the stake owners that have authorized a taker.
|
|
11055
|
+
*/
|
|
11056
|
+
getTakerStakeAuthorizations: (params, options) => {
|
|
11057
|
+
return stakingService.fetchTakerStakeAuthorizations(params, {
|
|
11058
|
+
signal: options?.signal
|
|
11059
|
+
});
|
|
11060
|
+
},
|
|
10303
11061
|
/** Pages append-only activity relevant to either side of a merchant's stake delegation. */
|
|
10304
11062
|
getStakeActivity: (params, options) => {
|
|
10305
11063
|
return stakingService.fetchStakeActivity(params, { signal: options?.signal });
|
|
@@ -10478,8 +11236,8 @@ var Zkp2pClient = class {
|
|
|
10478
11236
|
return this._stakeOps.getRiskWindow(paymentMethodHash);
|
|
10479
11237
|
}
|
|
10480
11238
|
/** Read whether an escrow deposit has opted into dispute protection. */
|
|
10481
|
-
isDisputeProtectionEnabled(escrow, depositId) {
|
|
10482
|
-
return this._stakeOps.isDisputeProtectionEnabled(escrow, depositId);
|
|
11239
|
+
isDisputeProtectionEnabled(escrow, depositId, paymentMethod) {
|
|
11240
|
+
return this._stakeOps.isDisputeProtectionEnabled(escrow, depositId, paymentMethod);
|
|
10483
11241
|
}
|
|
10484
11242
|
/**
|
|
10485
11243
|
* Registers payee details with the curator API and returns hashed on-chain IDs.
|
|
@@ -10637,6 +11395,13 @@ var Zkp2pClient = class {
|
|
|
10637
11395
|
this.runtimeEnv,
|
|
10638
11396
|
"paymentMethodsOverride"
|
|
10639
11397
|
);
|
|
11398
|
+
assertCatalogCurrencies(
|
|
11399
|
+
params.paymentMethodsOverride,
|
|
11400
|
+
params.currenciesOverride,
|
|
11401
|
+
this.chainId,
|
|
11402
|
+
this.runtimeEnv,
|
|
11403
|
+
"currenciesOverride"
|
|
11404
|
+
);
|
|
10640
11405
|
paymentMethods = params.paymentMethodsOverride;
|
|
10641
11406
|
paymentMethodData = params.paymentMethodDataOverride;
|
|
10642
11407
|
currencies = params.currenciesOverride;
|
|
@@ -10682,7 +11447,7 @@ var Zkp2pClient = class {
|
|
|
10682
11447
|
}
|
|
10683
11448
|
}
|
|
10684
11449
|
});
|
|
10685
|
-
const { mapConversionRatesToOnchainMinRate: mapConversionRatesToOnchainMinRate2 } = await import('./currency-
|
|
11450
|
+
const { mapConversionRatesToOnchainMinRate: mapConversionRatesToOnchainMinRate2 } = await import('./currency-KBPBKLN2.mjs');
|
|
10686
11451
|
currencies = mapConversionRatesToOnchainMinRate2(
|
|
10687
11452
|
params.conversionRates,
|
|
10688
11453
|
paymentMethods.length
|
|
@@ -11381,162 +12146,6 @@ function selectRiskMode(amount, freeStake, disputeProtected) {
|
|
|
11381
12146
|
throw new RangeError("insufficient free stake for dispute-protected admission");
|
|
11382
12147
|
}
|
|
11383
12148
|
|
|
11384
|
-
|
|
11385
|
-
var MAX_GROUPS_PER_DEPOSIT = 10;
|
|
11386
|
-
var MAX_ADDRESSES_PER_CALL = 50;
|
|
11387
|
-
var MAX_WHITELISTED_ADDRESSES = 500;
|
|
11388
|
-
var chunk = (values, size) => {
|
|
11389
|
-
if (values.length <= size) return values.length > 0 ? [values] : [];
|
|
11390
|
-
const batches = [];
|
|
11391
|
-
for (let index = 0; index < values.length; index += size) {
|
|
11392
|
-
batches.push(values.slice(index, index + size));
|
|
11393
|
-
}
|
|
11394
|
-
return batches;
|
|
11395
|
-
};
|
|
11396
|
-
var normalizeList = (values) => {
|
|
11397
|
-
const seen = /* @__PURE__ */ new Set();
|
|
11398
|
-
const normalized = [];
|
|
11399
|
-
for (const value of values) {
|
|
11400
|
-
if (typeof value !== "string") continue;
|
|
11401
|
-
const trimmed = value.trim().toLowerCase();
|
|
11402
|
-
if (!trimmed || seen.has(trimmed)) continue;
|
|
11403
|
-
seen.add(trimmed);
|
|
11404
|
-
normalized.push(trimmed);
|
|
11405
|
-
}
|
|
11406
|
-
return normalized;
|
|
11407
|
-
};
|
|
11408
|
-
var normalizeAccessPolicyState = (state) => ({
|
|
11409
|
-
enabled: Boolean(state.enabled),
|
|
11410
|
-
groupIds: normalizeList(state.groupIds),
|
|
11411
|
-
addresses: normalizeList(state.addresses)
|
|
11412
|
-
});
|
|
11413
|
-
var difference = (left, right) => {
|
|
11414
|
-
const exclude = new Set(right);
|
|
11415
|
-
return left.filter((value) => !exclude.has(value));
|
|
11416
|
-
};
|
|
11417
|
-
var diffAccessPolicy = (persistedInput, draftInput) => {
|
|
11418
|
-
const persisted = normalizeAccessPolicyState(persistedInput);
|
|
11419
|
-
const draft = normalizeAccessPolicyState(draftInput);
|
|
11420
|
-
return {
|
|
11421
|
-
addedGroupIds: difference(draft.groupIds, persisted.groupIds),
|
|
11422
|
-
removedGroupIds: difference(persisted.groupIds, draft.groupIds),
|
|
11423
|
-
addedAddresses: difference(draft.addresses, persisted.addresses),
|
|
11424
|
-
removedAddresses: difference(persisted.addresses, draft.addresses),
|
|
11425
|
-
enabledChanged: persisted.enabled !== draft.enabled
|
|
11426
|
-
};
|
|
11427
|
-
};
|
|
11428
|
-
var planAccessPolicyUpdate = (persistedInput, draftInput) => {
|
|
11429
|
-
const persisted = normalizeAccessPolicyState(persistedInput);
|
|
11430
|
-
const draft = normalizeAccessPolicyState(draftInput);
|
|
11431
|
-
const diff = diffAccessPolicy(persisted, draft);
|
|
11432
|
-
const hasChanges = diff.enabledChanged || diff.addedGroupIds.length > 0 || diff.removedGroupIds.length > 0 || diff.addedAddresses.length > 0 || diff.removedAddresses.length > 0;
|
|
11433
|
-
const violations = [];
|
|
11434
|
-
if (draft.enabled && draft.groupIds.length === 0 && draft.addresses.length === 0) {
|
|
11435
|
-
violations.push("empty-restricted-policy");
|
|
11436
|
-
}
|
|
11437
|
-
if (draft.groupIds.length > MAX_GROUPS_PER_DEPOSIT) {
|
|
11438
|
-
violations.push("group-cap-exceeded");
|
|
11439
|
-
}
|
|
11440
|
-
if (draft.addresses.length > MAX_WHITELISTED_ADDRESSES) {
|
|
11441
|
-
violations.push("address-cap-exceeded");
|
|
11442
|
-
}
|
|
11443
|
-
if (!hasChanges || violations.length > 0) {
|
|
11444
|
-
return {
|
|
11445
|
-
diff,
|
|
11446
|
-
steps: [],
|
|
11447
|
-
hasChanges,
|
|
11448
|
-
ordering: hasChanges ? "additions-first" : "no-changes",
|
|
11449
|
-
violations,
|
|
11450
|
-
resultingGroupCount: draft.groupIds.length
|
|
11451
|
-
};
|
|
11452
|
-
}
|
|
11453
|
-
const peakIfAddingFirst = (/* @__PURE__ */ new Set([...persisted.groupIds, ...diff.addedGroupIds])).size;
|
|
11454
|
-
const mustRemoveGroupsFirst = peakIfAddingFirst > MAX_GROUPS_PER_DEPOSIT;
|
|
11455
|
-
const ordering = !draft.enabled ? "disable-first" : mustRemoveGroupsFirst ? "removals-first" : "additions-first";
|
|
11456
|
-
const steps = [];
|
|
11457
|
-
const additionSteps = () => {
|
|
11458
|
-
const collected = [];
|
|
11459
|
-
if (diff.addedGroupIds.length > 0) {
|
|
11460
|
-
collected.push({
|
|
11461
|
-
kind: "addAllowedGroups",
|
|
11462
|
-
groupIds: diff.addedGroupIds
|
|
11463
|
-
});
|
|
11464
|
-
}
|
|
11465
|
-
for (const batch of chunk(diff.addedAddresses, MAX_ADDRESSES_PER_CALL)) {
|
|
11466
|
-
collected.push({ kind: "addWhitelistedAddresses", takers: batch });
|
|
11467
|
-
}
|
|
11468
|
-
return collected;
|
|
11469
|
-
};
|
|
11470
|
-
const removalSteps = () => {
|
|
11471
|
-
const collected = [];
|
|
11472
|
-
if (diff.removedGroupIds.length > 0) {
|
|
11473
|
-
collected.push({
|
|
11474
|
-
kind: "removeAllowedGroups",
|
|
11475
|
-
groupIds: diff.removedGroupIds
|
|
11476
|
-
});
|
|
11477
|
-
}
|
|
11478
|
-
for (const batch of chunk(diff.removedAddresses, MAX_ADDRESSES_PER_CALL)) {
|
|
11479
|
-
collected.push({ kind: "removeWhitelistedAddresses", takers: batch });
|
|
11480
|
-
}
|
|
11481
|
-
return collected;
|
|
11482
|
-
};
|
|
11483
|
-
if (ordering === "disable-first") {
|
|
11484
|
-
if (diff.enabledChanged) {
|
|
11485
|
-
steps.push({ kind: "setEnabled", enabled: false });
|
|
11486
|
-
}
|
|
11487
|
-
steps.push(...removalSteps(), ...additionSteps());
|
|
11488
|
-
return {
|
|
11489
|
-
diff,
|
|
11490
|
-
steps,
|
|
11491
|
-
hasChanges,
|
|
11492
|
-
ordering,
|
|
11493
|
-
violations,
|
|
11494
|
-
resultingGroupCount: draft.groupIds.length
|
|
11495
|
-
};
|
|
11496
|
-
}
|
|
11497
|
-
if (ordering === "removals-first") {
|
|
11498
|
-
if (persisted.enabled) {
|
|
11499
|
-
steps.push({ kind: "setEnabled", enabled: false });
|
|
11500
|
-
}
|
|
11501
|
-
steps.push(...removalSteps(), ...additionSteps());
|
|
11502
|
-
steps.push({ kind: "setEnabled", enabled: true });
|
|
11503
|
-
return {
|
|
11504
|
-
diff,
|
|
11505
|
-
steps,
|
|
11506
|
-
hasChanges,
|
|
11507
|
-
ordering,
|
|
11508
|
-
violations,
|
|
11509
|
-
resultingGroupCount: draft.groupIds.length
|
|
11510
|
-
};
|
|
11511
|
-
}
|
|
11512
|
-
if (diff.enabledChanged) {
|
|
11513
|
-
const [firstBatch = [], ...overflowBatches] = chunk(
|
|
11514
|
-
diff.addedAddresses,
|
|
11515
|
-
MAX_ADDRESSES_PER_CALL
|
|
11516
|
-
);
|
|
11517
|
-
steps.push({
|
|
11518
|
-
kind: "configureDeposit",
|
|
11519
|
-
enabled: true,
|
|
11520
|
-
groupIds: diff.addedGroupIds,
|
|
11521
|
-
takers: firstBatch
|
|
11522
|
-
});
|
|
11523
|
-
for (const batch of overflowBatches) {
|
|
11524
|
-
steps.push({ kind: "addWhitelistedAddresses", takers: batch });
|
|
11525
|
-
}
|
|
11526
|
-
} else {
|
|
11527
|
-
steps.push(...additionSteps());
|
|
11528
|
-
}
|
|
11529
|
-
steps.push(...removalSteps());
|
|
11530
|
-
return {
|
|
11531
|
-
diff,
|
|
11532
|
-
steps,
|
|
11533
|
-
hasChanges,
|
|
11534
|
-
ordering,
|
|
11535
|
-
violations,
|
|
11536
|
-
resultingGroupCount: draft.groupIds.length
|
|
11537
|
-
};
|
|
11538
|
-
};
|
|
11539
|
-
|
|
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 };
|
|
12149
|
+
export { AccessPolicyOperations, AccessPolicyUnsupportedError, BASE_BUILDER_CODE, CHAINLINK_ORACLE_ADAPTER, CHAINLINK_ORACLE_FEEDS, ContractRouter, DEFAULT_ORACLE_MAX_STALENESS_SECONDS, IndexerClient, IndexerDepositService, IndexerRateManagerService, IndexerStakingService, 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, encodePythAdapterConfig, encodeSpreadOracleAdapterConfig, encodeWithAttribution, fetchFulfillmentAndPayment as fetchIndexerFulfillmentAndPayment, getAttributionDataSuffix, getPeerExtensionState, getSpreadOracleConfig, isPeerExtensionAvailable, isValidReferralCode, isValidReferrerFeeBps, isValidReferrerFeeRecipient, logger, normalizeReferralCode, openPeerExtensionInstallPage, parseReferrerFeeConfig, peerExtensionSdk, readDisputeAttestationConfig, referrerFeeConfigToPreciseUnits, selectRiskMode, sendTransactionWithAttribution, setLogLevel, validateOracleFeedsOnChain };
|
|
11541
12150
|
//# sourceMappingURL=index.mjs.map
|
|
11542
12151
|
//# sourceMappingURL=index.mjs.map
|