@zkp2p/sdk 0.14.5-rc.1 → 0.14.5
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 +42 -14
- package/dist/build-metadata.json +3 -3
- package/dist/chunk-2K2ATNTY.mjs +12 -0
- package/dist/chunk-2K2ATNTY.mjs.map +1 -0
- package/dist/{chunk-5YLUC57N.mjs → chunk-QGFAF5VH.mjs} +9178 -6666
- package/dist/chunk-QGFAF5VH.mjs.map +1 -0
- package/dist/{currency-ROSO5JUH.mjs → currency-HGHBHKCR.mjs} +3 -3
- package/dist/{currency-ROSO5JUH.mjs.map → currency-HGHBHKCR.mjs.map} +1 -1
- package/dist/index.cjs +9789 -7117
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +8 -3
- package/dist/index.d.ts +8 -3
- package/dist/index.mjs +190 -52
- package/dist/index.mjs.map +1 -1
- package/dist/protocolViewerParsers-EKSTC7KZ.mjs +5 -0
- package/dist/{protocolViewerParsers-64F4BSMS.mjs.map → protocolViewerParsers-EKSTC7KZ.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-Z2D444ZE.mjs → timeout-XMVMQWWA.mjs} +3 -3
- package/dist/{timeout-Z2D444ZE.mjs.map → timeout-XMVMQWWA.mjs.map} +1 -1
- package/dist/{vaultUtils-BadWrrW3.d.mts → vaultUtils-CGxOY369.d.mts} +34 -4
- package/dist/{vaultUtils-BadWrrW3.d.ts → vaultUtils-CGxOY369.d.ts} +34 -4
- package/package.json +2 -2
- package/dist/chunk-5YLUC57N.mjs.map +0 -1
- package/dist/chunk-XFXOKA35.mjs +0 -12
- package/dist/chunk-XFXOKA35.mjs.map +0 -1
- package/dist/protocolViewerParsers-64F4BSMS.mjs +0 -5
package/dist/index.mjs
CHANGED
|
@@ -2,11 +2,11 @@ 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, 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-
|
|
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-
|
|
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-QGFAF5VH.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-QGFAF5VH.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-
|
|
9
|
+
import { define_ZKP2P_SDK_BUILD_METADATA_default } from './chunk-2K2ATNTY.mjs';
|
|
10
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';
|
|
@@ -357,7 +357,7 @@ async function withRetry(fn, maxRetries = 3, delayMs = 1e3, timeoutMs, shouldRet
|
|
|
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-XMVMQWWA.mjs');
|
|
361
361
|
return await withTimeout(fn(), timeoutMs, `Operation timed out after ${timeoutMs}ms`);
|
|
362
362
|
}
|
|
363
363
|
return await fn();
|
|
@@ -700,7 +700,16 @@ async function createEncryptedBuyerTeeSessionMaterial({
|
|
|
700
700
|
...attestationRuntime?.subtle ? { subtle: attestationRuntime.subtle } : {},
|
|
701
701
|
...attestationRuntime?.getRandomValues ? { getRandomValues: attestationRuntime.getRandomValues } : {}
|
|
702
702
|
};
|
|
703
|
-
return
|
|
703
|
+
return withRetry(async () => {
|
|
704
|
+
try {
|
|
705
|
+
return await createEncryptedBuyerTeeSessionMaterial$1(params);
|
|
706
|
+
} catch (error) {
|
|
707
|
+
if (isAttestationMaterialTimeout(error)) {
|
|
708
|
+
throw new NetworkError(error.message, { cause: error });
|
|
709
|
+
}
|
|
710
|
+
throw error;
|
|
711
|
+
}
|
|
712
|
+
});
|
|
704
713
|
}
|
|
705
714
|
async function apiCreateSellerCredentialBundle(payload, attestationServiceUrl, platform, timeoutMs, attestationRuntime, options = {}) {
|
|
706
715
|
return withRetry(
|
|
@@ -881,78 +890,104 @@ async function sendTransactionWithAttribution(walletClient, request, referrer, o
|
|
|
881
890
|
// src/utils/constants.ts
|
|
882
891
|
var DEFAULT_BASE_API_URL = "https://api.zkp2p.xyz";
|
|
883
892
|
|
|
884
|
-
// ../../node_modules/.pnpm/@zkp2p+contracts-v2@0.4.
|
|
893
|
+
// ../../node_modules/.pnpm/@zkp2p+contracts-v2@0.4.3_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
|
|
885
894
|
var chainlink_default = {
|
|
886
895
|
feeds: [
|
|
887
896
|
{
|
|
888
897
|
pair: "AUD/USD",
|
|
889
898
|
feed: "0x46e51B8cA41d709928EdA9Ae43e42193E6CDf229",
|
|
890
|
-
decimals: 8
|
|
899
|
+
decimals: 8,
|
|
900
|
+
provider: "chainlink"
|
|
891
901
|
},
|
|
892
902
|
{
|
|
893
903
|
pair: "BRL/USD",
|
|
894
904
|
feed: "0x0b0E64c05083FdF9ED7C5D3d8262c4216eFc9394",
|
|
895
|
-
decimals: 8
|
|
905
|
+
decimals: 8,
|
|
906
|
+
provider: "chainlink"
|
|
896
907
|
},
|
|
897
908
|
{
|
|
898
909
|
pair: "CAD/USD",
|
|
899
910
|
feed: "0xA840145F87572E82519d578b1F36340368a25D5d",
|
|
900
|
-
decimals: 8
|
|
911
|
+
decimals: 8,
|
|
912
|
+
provider: "chainlink"
|
|
901
913
|
},
|
|
902
914
|
{
|
|
903
915
|
pair: "CHF/USD",
|
|
904
916
|
feed: "0x3A1d6444fb6a402470098E23DaD0B7E86E14252F",
|
|
905
|
-
decimals: 8
|
|
917
|
+
decimals: 8,
|
|
918
|
+
provider: "chainlink"
|
|
919
|
+
},
|
|
920
|
+
{
|
|
921
|
+
pair: "CNY/USD",
|
|
922
|
+
feed: "0xc034d806DbeA6b13980D94174eA5FF83E1C191C3",
|
|
923
|
+
decimals: 8,
|
|
924
|
+
provider: "zkp2p"
|
|
906
925
|
},
|
|
907
926
|
{
|
|
908
927
|
pair: "EUR/USD",
|
|
909
928
|
feed: "0xc91D87E81faB8f93699ECf7Ee9B44D11e1D53F0F",
|
|
910
|
-
decimals: 8
|
|
929
|
+
decimals: 8,
|
|
930
|
+
provider: "chainlink"
|
|
911
931
|
},
|
|
912
932
|
{
|
|
913
933
|
pair: "GBP/USD",
|
|
914
934
|
feed: "0xCceA6576904C118037695eB71195a5425E69Fa15",
|
|
915
|
-
decimals: 8
|
|
935
|
+
decimals: 8,
|
|
936
|
+
provider: "chainlink"
|
|
916
937
|
},
|
|
917
938
|
{
|
|
918
939
|
pair: "IDR/USD",
|
|
919
940
|
feed: "0x05A6cF213EcC5501A11a08EBefA4A8a60313ef97",
|
|
920
|
-
decimals: 8
|
|
941
|
+
decimals: 8,
|
|
942
|
+
provider: "chainlink"
|
|
943
|
+
},
|
|
944
|
+
{
|
|
945
|
+
pair: "INR/USD",
|
|
946
|
+
feed: "0x053A03F1704aE3F71082D3cDFD50BC830415A326",
|
|
947
|
+
decimals: 8,
|
|
948
|
+
provider: "zkp2p"
|
|
921
949
|
},
|
|
922
950
|
{
|
|
923
951
|
pair: "MXN/USD",
|
|
924
952
|
feed: "0x9e8Ee77c76d4fa41306056D1C3196AF5da1600bd",
|
|
925
|
-
decimals: 8
|
|
953
|
+
decimals: 8,
|
|
954
|
+
provider: "chainlink"
|
|
926
955
|
},
|
|
927
956
|
{
|
|
928
957
|
pair: "NGN/USD",
|
|
929
958
|
feed: "0xdfbb5Cbc88E382de007bfe6CE99C388176ED80aD",
|
|
930
|
-
decimals: 8
|
|
959
|
+
decimals: 8,
|
|
960
|
+
provider: "chainlink"
|
|
931
961
|
},
|
|
932
962
|
{
|
|
933
963
|
pair: "NZD/USD",
|
|
934
964
|
feed: "0x06bdFe07E71C476157FC025d3cCD4BBe08e83EF9",
|
|
935
|
-
decimals: 8
|
|
965
|
+
decimals: 8,
|
|
966
|
+
provider: "chainlink"
|
|
936
967
|
},
|
|
937
968
|
{
|
|
938
969
|
pair: "PHP/USD",
|
|
939
970
|
feed: "0x0396000dc82bfAEe746A9Ac6dC69dAd3223Ca9c6",
|
|
940
|
-
decimals: 8
|
|
971
|
+
decimals: 8,
|
|
972
|
+
provider: "chainlink"
|
|
941
973
|
},
|
|
942
974
|
{
|
|
943
975
|
pair: "SGD/USD",
|
|
944
976
|
feed: "0x81575495532fB311Efc5C993B612564274F0949b",
|
|
945
|
-
decimals: 8
|
|
977
|
+
decimals: 8,
|
|
978
|
+
provider: "chainlink"
|
|
946
979
|
},
|
|
947
980
|
{
|
|
948
981
|
pair: "TRY/USD",
|
|
949
982
|
feed: "0x29413773e7CD4Dfd6Ad89a50887877b88a6C592C",
|
|
950
|
-
decimals: 8
|
|
983
|
+
decimals: 8,
|
|
984
|
+
provider: "chainlink"
|
|
951
985
|
},
|
|
952
986
|
{
|
|
953
987
|
pair: "ZAR/USD",
|
|
954
988
|
feed: "0x2ecc8A8B370fC6a217166b2782a35339bEBEe98B",
|
|
955
|
-
decimals: 8
|
|
989
|
+
decimals: 8,
|
|
990
|
+
provider: "chainlink"
|
|
956
991
|
}
|
|
957
992
|
]
|
|
958
993
|
};
|
|
@@ -1934,7 +1969,7 @@ var ProtocolViewerReader = class {
|
|
|
1934
1969
|
if (inputCount === null) {
|
|
1935
1970
|
throw new Error("Configured ProtocolViewer ABI does not expose getDeposit");
|
|
1936
1971
|
}
|
|
1937
|
-
const { parseDepositView: parseDepositView2 } = await import('./protocolViewerParsers-
|
|
1972
|
+
const { parseDepositView: parseDepositView2 } = await import('./protocolViewerParsers-EKSTC7KZ.mjs');
|
|
1938
1973
|
if (inputCount >= 3) {
|
|
1939
1974
|
return tryContexts(
|
|
1940
1975
|
protocolViewerContexts,
|
|
@@ -2020,7 +2055,7 @@ var ProtocolViewerReader = class {
|
|
|
2020
2055
|
return Promise.all(ids.map((id) => this.config.host.getPvDepositById(id)));
|
|
2021
2056
|
}
|
|
2022
2057
|
const bn = ids.map((id) => typeof id === "bigint" ? id : parseRawDepositId(id));
|
|
2023
|
-
const { parseDepositView: parseDepositView2 } = await import('./protocolViewerParsers-
|
|
2058
|
+
const { parseDepositView: parseDepositView2 } = await import('./protocolViewerParsers-EKSTC7KZ.mjs');
|
|
2024
2059
|
if (inputCount >= 2) {
|
|
2025
2060
|
const requests = ids.map((id, index) => ({
|
|
2026
2061
|
index,
|
|
@@ -2125,7 +2160,7 @@ var ProtocolViewerReader = class {
|
|
|
2125
2160
|
if (!protocolViewerAddress || !protocolViewerAbi || inputCount === null) {
|
|
2126
2161
|
return this.config.host.getPvAccountDepositsFromIndexer(owner);
|
|
2127
2162
|
}
|
|
2128
|
-
const { parseDepositView: parseDepositView2 } = await import('./protocolViewerParsers-
|
|
2163
|
+
const { parseDepositView: parseDepositView2 } = await import('./protocolViewerParsers-EKSTC7KZ.mjs');
|
|
2129
2164
|
const { address, abi } = this.config.host.requireProtocolViewer();
|
|
2130
2165
|
if (inputCount >= 2) {
|
|
2131
2166
|
const readAndFilter = async (raw2) => {
|
|
@@ -2196,7 +2231,7 @@ var ProtocolViewerReader = class {
|
|
|
2196
2231
|
if (protocolViewerEntries.length === 0) {
|
|
2197
2232
|
throw new Error("ProtocolViewer not available for this network");
|
|
2198
2233
|
}
|
|
2199
|
-
const { parseIntentView: parseIntentView2 } = await import('./protocolViewerParsers-
|
|
2234
|
+
const { parseIntentView: parseIntentView2 } = await import('./protocolViewerParsers-EKSTC7KZ.mjs');
|
|
2200
2235
|
const intentsByHash = /* @__PURE__ */ new Map();
|
|
2201
2236
|
let attemptedRead = false;
|
|
2202
2237
|
let hadSuccessfulRead = false;
|
|
@@ -2304,7 +2339,7 @@ var ProtocolViewerReader = class {
|
|
|
2304
2339
|
if (protocolViewerEntries.length === 0) {
|
|
2305
2340
|
throw new Error("ProtocolViewer not available for this network");
|
|
2306
2341
|
}
|
|
2307
|
-
const { parseIntentView: parseIntentView2 } = await import('./protocolViewerParsers-
|
|
2342
|
+
const { parseIntentView: parseIntentView2 } = await import('./protocolViewerParsers-EKSTC7KZ.mjs');
|
|
2308
2343
|
let lastError;
|
|
2309
2344
|
for (const pvEntry of protocolViewerEntries) {
|
|
2310
2345
|
const inputCount = this.pvEntryFunctionInputCount(pvEntry, "getIntent");
|
|
@@ -3733,6 +3768,21 @@ var STAKE_ACTIVITY_QUERY = (
|
|
|
3733
3768
|
}
|
|
3734
3769
|
`
|
|
3735
3770
|
);
|
|
3771
|
+
var STAKE_ACCOUNTS_QUERY = (
|
|
3772
|
+
/* GraphQL */
|
|
3773
|
+
`
|
|
3774
|
+
query StakeAccounts($where: StakeAccountState_bool_exp!, $limit: Int!) {
|
|
3775
|
+
StakeAccountState(where: $where, order_by: { id: asc }, limit: $limit) {
|
|
3776
|
+
id
|
|
3777
|
+
chainId
|
|
3778
|
+
vaultAddress
|
|
3779
|
+
stakeOwner
|
|
3780
|
+
totalStake
|
|
3781
|
+
lockedStake
|
|
3782
|
+
}
|
|
3783
|
+
}
|
|
3784
|
+
`
|
|
3785
|
+
);
|
|
3736
3786
|
var DISPUTE_PROTECTION_INTENTS_QUERY = (
|
|
3737
3787
|
/* GraphQL */
|
|
3738
3788
|
`
|
|
@@ -5441,16 +5491,37 @@ async function apiUploadSellerCredential(processorName, payeeDetails, bundle, ba
|
|
|
5441
5491
|
});
|
|
5442
5492
|
}
|
|
5443
5493
|
async function apiUploadGoogleOAuthSellerCredential(processorName, payeeDetails, body, baseApiUrl, opts) {
|
|
5494
|
+
return apiUploadEmailOAuthSellerCredential(
|
|
5495
|
+
"google",
|
|
5496
|
+
processorName,
|
|
5497
|
+
payeeDetails,
|
|
5498
|
+
body,
|
|
5499
|
+
baseApiUrl,
|
|
5500
|
+
opts
|
|
5501
|
+
);
|
|
5502
|
+
}
|
|
5503
|
+
async function apiUploadMicrosoftOAuthSellerCredential(processorName, payeeDetails, body, baseApiUrl, opts) {
|
|
5504
|
+
return apiUploadEmailOAuthSellerCredential(
|
|
5505
|
+
"microsoft",
|
|
5506
|
+
processorName,
|
|
5507
|
+
payeeDetails,
|
|
5508
|
+
body,
|
|
5509
|
+
baseApiUrl,
|
|
5510
|
+
opts
|
|
5511
|
+
);
|
|
5512
|
+
}
|
|
5513
|
+
async function apiUploadEmailOAuthSellerCredential(provider, processorName, payeeDetails, body, baseApiUrl, opts) {
|
|
5514
|
+
const providerName = provider === "google" ? "Google" : "Microsoft";
|
|
5444
5515
|
if (processorName !== "paypal" && processorName !== "venmo") {
|
|
5445
5516
|
throw new ValidationError(
|
|
5446
|
-
`Unsupported
|
|
5517
|
+
`Unsupported ${providerName} OAuth seller credential platform: ${String(processorName)}`,
|
|
5447
5518
|
"processorName"
|
|
5448
5519
|
);
|
|
5449
5520
|
}
|
|
5450
5521
|
const endpoint = `/v2/makers/${encodeURIComponent(processorName)}/${encodeURIComponent(
|
|
5451
5522
|
payeeDetails
|
|
5452
|
-
)}/seller-credential
|
|
5453
|
-
if (opts?.signal?.aborted) throw new Error(
|
|
5523
|
+
)}/seller-credential/${provider}-oauth`;
|
|
5524
|
+
if (opts?.signal?.aborted) throw new Error(`${providerName} OAuth upload cancelled.`);
|
|
5454
5525
|
const controller = new AbortController();
|
|
5455
5526
|
const abort = () => controller.abort();
|
|
5456
5527
|
opts?.signal?.addEventListener("abort", abort, { once: true });
|
|
@@ -5466,11 +5537,11 @@ async function apiUploadGoogleOAuthSellerCredential(processorName, payeeDetails,
|
|
|
5466
5537
|
body,
|
|
5467
5538
|
authorizationToken: opts?.authorizationToken,
|
|
5468
5539
|
signal: controller.signal,
|
|
5469
|
-
// A lost response may already have consumed the one-time
|
|
5540
|
+
// A lost response may already have consumed the one-time authorization code.
|
|
5470
5541
|
retryCount: 1
|
|
5471
5542
|
});
|
|
5472
5543
|
} catch (error) {
|
|
5473
|
-
if (timedOut) throw new Error(
|
|
5544
|
+
if (timedOut) throw new Error(`${providerName} OAuth upload timed out.`);
|
|
5474
5545
|
throw error;
|
|
5475
5546
|
} finally {
|
|
5476
5547
|
opts?.signal?.removeEventListener("abort", abort);
|
|
@@ -7295,7 +7366,7 @@ function normalizeStakeActivityRow(row, index, scope) {
|
|
|
7295
7366
|
}
|
|
7296
7367
|
const stakeOwner = normalizeNullableAddress(row.stakeOwner, `${field}.stakeOwner`);
|
|
7297
7368
|
const taker = normalizeNullableAddress(row.taker, `${field}.taker`);
|
|
7298
|
-
if (stakeOwner !== scope.merchant && taker !== scope.merchant) {
|
|
7369
|
+
if (scope.merchant && stakeOwner !== scope.merchant && taker !== scope.merchant) {
|
|
7299
7370
|
throw new Error(`${field} is not relevant to the requested merchant`);
|
|
7300
7371
|
}
|
|
7301
7372
|
const kind = normalizeActivityKind(row.kind, `${field}.kind`);
|
|
@@ -7431,6 +7502,56 @@ var IndexerStakingService = class {
|
|
|
7431
7502
|
constructor(client) {
|
|
7432
7503
|
this.client = client;
|
|
7433
7504
|
}
|
|
7505
|
+
/** Sum current positive stake accounts for one vault. */
|
|
7506
|
+
async fetchStakeTotals(params, init) {
|
|
7507
|
+
validateChainId(params.chainId);
|
|
7508
|
+
const vaultAddress = normalizeAddress4(params.vaultAddress, "vaultAddress");
|
|
7509
|
+
let afterId;
|
|
7510
|
+
let totalStaked = 0n;
|
|
7511
|
+
let totalLocked = 0n;
|
|
7512
|
+
let stakerCount = 0;
|
|
7513
|
+
for (; ; ) {
|
|
7514
|
+
const data3 = await this.client.query(
|
|
7515
|
+
{
|
|
7516
|
+
query: STAKE_ACCOUNTS_QUERY,
|
|
7517
|
+
variables: {
|
|
7518
|
+
limit: 500,
|
|
7519
|
+
where: {
|
|
7520
|
+
_and: [
|
|
7521
|
+
{ chainId: { _eq: params.chainId } },
|
|
7522
|
+
{ vaultAddress: { _eq: vaultAddress } },
|
|
7523
|
+
...afterId ? [{ id: { _gt: afterId } }] : []
|
|
7524
|
+
]
|
|
7525
|
+
}
|
|
7526
|
+
}
|
|
7527
|
+
},
|
|
7528
|
+
init
|
|
7529
|
+
);
|
|
7530
|
+
const accounts = data3.StakeAccountState;
|
|
7531
|
+
for (const [index, account] of accounts.entries()) {
|
|
7532
|
+
const field = `StakeAccountState[${index}]`;
|
|
7533
|
+
if (account.chainId !== params.chainId || normalizeAddress4(account.vaultAddress, `${field}.vaultAddress`) !== vaultAddress) {
|
|
7534
|
+
throw new Error(`${field} does not match the requested vault`);
|
|
7535
|
+
}
|
|
7536
|
+
normalizeAddress4(account.stakeOwner, `${field}.stakeOwner`);
|
|
7537
|
+
if (afterId && account.id <= afterId)
|
|
7538
|
+
throw new Error("StakeAccountState cursor did not advance");
|
|
7539
|
+
const stake = BigInt(normalizeDecimal(account.totalStake, `${field}.totalStake`));
|
|
7540
|
+
const locked = BigInt(normalizeDecimal(account.lockedStake, `${field}.lockedStake`));
|
|
7541
|
+
if (locked > stake) throw new Error(`${field}.lockedStake exceeds totalStake`);
|
|
7542
|
+
if (stake > 0n) stakerCount += 1;
|
|
7543
|
+
totalStaked += stake;
|
|
7544
|
+
totalLocked += locked;
|
|
7545
|
+
afterId = account.id;
|
|
7546
|
+
}
|
|
7547
|
+
if (accounts.length < 500) break;
|
|
7548
|
+
}
|
|
7549
|
+
return {
|
|
7550
|
+
totalStaked: totalStaked.toString(),
|
|
7551
|
+
totalLocked: totalLocked.toString(),
|
|
7552
|
+
stakerCount
|
|
7553
|
+
};
|
|
7554
|
+
}
|
|
7434
7555
|
async fetchStakeLocks(params, init) {
|
|
7435
7556
|
validateChainId(params.chainId);
|
|
7436
7557
|
const limit = validateLimit(params.limit);
|
|
@@ -7541,7 +7662,7 @@ var IndexerStakingService = class {
|
|
|
7541
7662
|
validateChainId(params.chainId);
|
|
7542
7663
|
const limit = validateLimit(params.limit);
|
|
7543
7664
|
const vaultAddress = normalizeAddress4(params.vaultAddress, "vaultAddress");
|
|
7544
|
-
const merchant = normalizeAddress4(params.merchant, "merchant");
|
|
7665
|
+
const merchant = params.merchant === void 0 ? void 0 : normalizeAddress4(params.merchant, "merchant");
|
|
7545
7666
|
const kind = params.kind ? normalizeActivityKind(params.kind, "kind") : void 0;
|
|
7546
7667
|
const direction = params.orderDirection ?? "asc";
|
|
7547
7668
|
if (direction !== "asc" && direction !== "desc") {
|
|
@@ -7551,11 +7672,12 @@ var IndexerStakingService = class {
|
|
|
7551
7672
|
const after = params.cursor ? decodeEventCursor(params.cursor, cursorKind) : void 0;
|
|
7552
7673
|
const filters = [
|
|
7553
7674
|
{ chainId: { _eq: params.chainId } },
|
|
7554
|
-
{ vaultAddress: { _eq: vaultAddress } }
|
|
7555
|
-
{
|
|
7556
|
-
_or: [{ stakeOwner: { _eq: merchant } }, { taker: { _eq: merchant } }]
|
|
7557
|
-
}
|
|
7675
|
+
{ vaultAddress: { _eq: vaultAddress } }
|
|
7558
7676
|
];
|
|
7677
|
+
if (merchant)
|
|
7678
|
+
filters.push({
|
|
7679
|
+
_or: [{ stakeOwner: { _eq: merchant } }, { taker: { _eq: merchant } }]
|
|
7680
|
+
});
|
|
7559
7681
|
if (kind) filters.push({ kind: { _eq: kind } });
|
|
7560
7682
|
if (after) filters.push(eventKeysetPredicate(after, "blockNumber", "logIndex", direction));
|
|
7561
7683
|
const data3 = await this.client.query(
|
|
@@ -7738,10 +7860,10 @@ var IndexerStakingService = class {
|
|
|
7738
7860
|
}
|
|
7739
7861
|
};
|
|
7740
7862
|
|
|
7741
|
-
// ../../node_modules/.pnpm/@zkp2p+contracts-v2@0.4.
|
|
7742
|
-
var version = "0.4.
|
|
7863
|
+
// ../../node_modules/.pnpm/@zkp2p+contracts-v2@0.4.3_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
|
|
7864
|
+
var version = "0.4.3";
|
|
7743
7865
|
|
|
7744
|
-
// ../../node_modules/.pnpm/@zkp2p+contracts-v2@0.4.
|
|
7866
|
+
// ../../node_modules/.pnpm/@zkp2p+contracts-v2@0.4.3_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
|
|
7745
7867
|
var data = {
|
|
7746
7868
|
"schemaVersion": 2,
|
|
7747
7869
|
"network": "base",
|
|
@@ -7913,7 +8035,7 @@ var data = {
|
|
|
7913
8035
|
};
|
|
7914
8036
|
var base_default = data;
|
|
7915
8037
|
|
|
7916
|
-
// ../../node_modules/.pnpm/@zkp2p+contracts-v2@0.4.
|
|
8038
|
+
// ../../node_modules/.pnpm/@zkp2p+contracts-v2@0.4.3_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
|
|
7917
8039
|
var data2 = {
|
|
7918
8040
|
"schemaVersion": 2,
|
|
7919
8041
|
"network": "base_staging",
|
|
@@ -11175,10 +11297,11 @@ var Zkp2pClient = class {
|
|
|
11175
11297
|
signal: options?.signal
|
|
11176
11298
|
});
|
|
11177
11299
|
},
|
|
11178
|
-
/** Pages
|
|
11300
|
+
/** Pages vault activity, optionally scoped to either side of a merchant's stake delegation. */
|
|
11179
11301
|
getStakeActivity: (params, options) => {
|
|
11180
11302
|
return stakingService.fetchStakeActivity(params, { signal: options?.signal });
|
|
11181
11303
|
},
|
|
11304
|
+
getStakeTotals: (params, options) => stakingService.fetchStakeTotals(params, { signal: options?.signal }),
|
|
11182
11305
|
/** Pages the exact active policy's finalized dispute stream. */
|
|
11183
11306
|
getDisputeProtectionIntents: (params, options) => {
|
|
11184
11307
|
return stakingService.fetchDisputeProtectionIntents(params, {
|
|
@@ -11583,7 +11706,7 @@ var Zkp2pClient = class {
|
|
|
11583
11706
|
}
|
|
11584
11707
|
}
|
|
11585
11708
|
});
|
|
11586
|
-
const { mapConversionRatesToOnchainMinRate: mapConversionRatesToOnchainMinRate2 } = await import('./currency-
|
|
11709
|
+
const { mapConversionRatesToOnchainMinRate: mapConversionRatesToOnchainMinRate2 } = await import('./currency-HGHBHKCR.mjs');
|
|
11587
11710
|
currencies = mapConversionRatesToOnchainMinRate2(
|
|
11588
11711
|
params.conversionRates,
|
|
11589
11712
|
paymentMethods.length
|
|
@@ -12008,11 +12131,18 @@ var Zkp2pClient = class {
|
|
|
12008
12131
|
* callers send the one-time Google code plus the stable seller identity.
|
|
12009
12132
|
*/
|
|
12010
12133
|
async uploadGoogleOAuthSellerCredential(params, opts) {
|
|
12011
|
-
|
|
12134
|
+
return this.uploadEmailOAuthSellerCredential({ ...params, provider: "google" }, opts);
|
|
12135
|
+
}
|
|
12136
|
+
async uploadMicrosoftOAuthSellerCredential(params, opts) {
|
|
12137
|
+
return this.uploadEmailOAuthSellerCredential({ ...params, provider: "microsoft" }, opts);
|
|
12138
|
+
}
|
|
12139
|
+
async uploadEmailOAuthSellerCredential(params, opts) {
|
|
12140
|
+
const providerName = params.provider === "google" ? "Google" : "Microsoft";
|
|
12141
|
+
if (opts?.signal?.aborted) throw new Error(`${providerName} OAuth upload cancelled.`);
|
|
12012
12142
|
const platform = params.platform;
|
|
12013
12143
|
if (platform !== "paypal" && platform !== "venmo") {
|
|
12014
12144
|
throw new ValidationError(
|
|
12015
|
-
`Unsupported
|
|
12145
|
+
`Unsupported ${providerName} OAuth seller credential platform: ${String(platform)}`,
|
|
12016
12146
|
"platform"
|
|
12017
12147
|
);
|
|
12018
12148
|
}
|
|
@@ -12025,16 +12155,24 @@ var Zkp2pClient = class {
|
|
|
12025
12155
|
authorizationCode: params.authorizationCode,
|
|
12026
12156
|
redirectUri: params.redirectUri
|
|
12027
12157
|
};
|
|
12028
|
-
|
|
12158
|
+
const uploadBody = params.platform === "paypal" ? { ...body, payeeEmail: params.payeeEmail } : body;
|
|
12159
|
+
const uploadOptions = {
|
|
12160
|
+
timeoutMs,
|
|
12161
|
+
...opts?.signal ? { signal: opts.signal } : {},
|
|
12162
|
+
...authorizationToken ? { authorizationToken } : {}
|
|
12163
|
+
};
|
|
12164
|
+
return params.provider === "google" ? apiUploadGoogleOAuthSellerCredential(
|
|
12029
12165
|
params.platform,
|
|
12030
12166
|
params.payeeDetails,
|
|
12031
|
-
|
|
12167
|
+
uploadBody,
|
|
12032
12168
|
baseApiUrl,
|
|
12033
|
-
|
|
12034
|
-
|
|
12035
|
-
|
|
12036
|
-
|
|
12037
|
-
}
|
|
12169
|
+
uploadOptions
|
|
12170
|
+
) : apiUploadMicrosoftOAuthSellerCredential(
|
|
12171
|
+
params.platform,
|
|
12172
|
+
params.payeeDetails,
|
|
12173
|
+
{ ...uploadBody, codeVerifier: params.codeVerifier },
|
|
12174
|
+
baseApiUrl,
|
|
12175
|
+
uploadOptions
|
|
12038
12176
|
);
|
|
12039
12177
|
}
|
|
12040
12178
|
/**
|
|
@@ -12464,6 +12602,6 @@ function openVenmoGmailConnect(options) {
|
|
|
12464
12602
|
});
|
|
12465
12603
|
}
|
|
12466
12604
|
|
|
12467
|
-
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, VenmoGmailConnectError, ZKP2P_ANDROID_REFERRER, ZKP2P_IOS_REFERRER, Zkp2pClient, apiCreateReferralCode, apiCreateSellerCredentialBundle, apiGetDepositBundle, apiGetOrderbook, apiGetOrderbookTable, apiGetOwnerDeposits, apiGetPayeeDetails, apiGetQuote, apiGetQuotesBestByPlatform, apiGetReferralDashboard, apiGetReferralEarnings, apiGetSellerCredentialStatus, 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, getAmazonPaySellerIdentity, getAttributionDataSuffix, getPeerExtensionState, getSpreadOracleConfig, getVenmoGmailConnectUrl, isPeerExtensionAvailable, isValidReferralCode, isValidReferrerFeeBps, isValidReferrerFeeRecipient, logger, normalizeReferralCode, openPeerExtensionInstallPage, openVenmoGmailConnect, parseReferrerFeeConfig, parseVenmoGmailAppearance, peerExtensionSdk, readDisputeAttestationConfig, referrerFeeConfigToPreciseUnits, selectRiskMode, sendTransactionWithAttribution, setLogLevel, validateOracleFeedsOnChain };
|
|
12605
|
+
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, VenmoGmailConnectError, ZKP2P_ANDROID_REFERRER, ZKP2P_IOS_REFERRER, Zkp2pClient, apiCreateReferralCode, apiCreateSellerCredentialBundle, apiGetDepositBundle, apiGetOrderbook, apiGetOrderbookTable, apiGetOwnerDeposits, apiGetPayeeDetails, apiGetQuote, apiGetQuotesBestByPlatform, apiGetReferralDashboard, apiGetReferralEarnings, apiGetSellerCredentialStatus, apiLookupReferralCode, apiPostDepositDetails, apiRedeemReferralCode, apiRequestIdentityAttestation, apiSignIntentV3, apiSignIntentV3Raw, apiUpdateReferralCode, apiUploadGoogleOAuthSellerCredential, apiUploadMicrosoftOAuthSellerCredential, apiUploadSellerCredentialBundle, apiValidatePayeeDetails, apiVerifyBuyerTeePayment, appendAttributionToCalldata, assertValidReferrerFeeConfig, buildStakingEntityIds, calculateRequiredCoverage, calculateStakeBackedCapacity, compareEventCursorIdsByRecency, convertDepositsForLiquidity, convertIndexerDepositToEscrowView, convertIndexerIntentsToEscrowViews, createCompositeDepositId, createEncryptedBuyerTeeSessionMaterial, createPeerExtensionSdk, defaultIndexerEndpoint, encodePythAdapterConfig, encodeSpreadOracleAdapterConfig, encodeWithAttribution, fetchFulfillmentAndPayment as fetchIndexerFulfillmentAndPayment, getAmazonPaySellerIdentity, getAttributionDataSuffix, getPeerExtensionState, getSpreadOracleConfig, getVenmoGmailConnectUrl, isPeerExtensionAvailable, isValidReferralCode, isValidReferrerFeeBps, isValidReferrerFeeRecipient, logger, normalizeReferralCode, openPeerExtensionInstallPage, openVenmoGmailConnect, parseReferrerFeeConfig, parseVenmoGmailAppearance, peerExtensionSdk, readDisputeAttestationConfig, referrerFeeConfigToPreciseUnits, selectRiskMode, sendTransactionWithAttribution, setLogLevel, validateOracleFeedsOnChain };
|
|
12468
12606
|
//# sourceMappingURL=index.mjs.map
|
|
12469
12607
|
//# sourceMappingURL=index.mjs.map
|