@zkp2p/sdk 0.15.0-rc.12 → 0.15.0-rc.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/build-metadata.json +2 -2
- package/dist/{chunk-ULGTXME4.mjs → chunk-66VY2GE6.mjs} +168 -61
- package/dist/{chunk-ULGTXME4.mjs.map → chunk-66VY2GE6.mjs.map} +1 -1
- package/dist/{chunk-WDEEWFEU.mjs → chunk-PMFXZGDQ.mjs} +17 -7
- package/dist/chunk-PMFXZGDQ.mjs.map +1 -0
- package/dist/{chunk-QJ7GNYQV.mjs → chunk-R2VWADIE.mjs} +3 -3
- package/dist/{chunk-QJ7GNYQV.mjs.map → chunk-R2VWADIE.mjs.map} +1 -1
- package/dist/{chunk-YA67SM3A.mjs → chunk-RZFNRIED.mjs} +32 -12
- package/dist/chunk-RZFNRIED.mjs.map +1 -0
- package/dist/{currency-SVQO262S.mjs → currency-X67W4T35.mjs} +4 -4
- package/dist/{currency-SVQO262S.mjs.map → currency-X67W4T35.mjs.map} +1 -1
- package/dist/index.cjs +1124 -509
- 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 +953 -459
- package/dist/index.mjs.map +1 -1
- package/dist/protocolViewerParsers-5QREJV2D.mjs +5 -0
- package/dist/{protocolViewerParsers-XZNJAU3M.mjs.map → protocolViewerParsers-5QREJV2D.mjs.map} +1 -1
- package/dist/react.cjs +87 -29
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.mts +2 -2
- package/dist/react.d.ts +2 -2
- package/dist/react.mjs +60 -22
- package/dist/react.mjs.map +1 -1
- package/dist/{vaultUtils-CXUpjeBT.d.mts → vaultUtils-BqsnOAEM.d.mts} +45 -21
- package/dist/{vaultUtils-CXUpjeBT.d.ts → vaultUtils-BqsnOAEM.d.ts} +45 -21
- package/package.json +2 -8
- package/dist/chunk-WDEEWFEU.mjs.map +0 -1
- package/dist/chunk-YA67SM3A.mjs.map +0 -1
- package/dist/protocolViewerParsers-XZNJAU3M.mjs +0 -5
package/dist/build-metadata.json
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
"schemaVersion": 2,
|
|
3
3
|
"source": {
|
|
4
4
|
"repository": "zkp2p/zkp2p-clients",
|
|
5
|
-
"commitSha": "
|
|
5
|
+
"commitSha": "9c45d2bb150a36e20a189cb9399467dd8e85cf9c",
|
|
6
6
|
"kind": "github",
|
|
7
7
|
"distributable": true
|
|
8
8
|
},
|
|
9
|
-
"sdkPackageVersion": "0.15.0-rc.
|
|
9
|
+
"sdkPackageVersion": "0.15.0-rc.13",
|
|
10
10
|
"contractsPackageVersion": "0.4.4-rc.13",
|
|
11
11
|
"indexerSchemaPackageVersion": "0.23.0-rc.0",
|
|
12
12
|
"activeDisputeStack": {
|
|
@@ -1,19 +1,27 @@
|
|
|
1
|
-
import { currencyKeccak256, getCurrencyInfoFromHash } from './chunk-
|
|
2
|
-
import { __export } from './chunk-
|
|
1
|
+
import { currencyKeccak256, getCurrencyInfoFromHash } from './chunk-PMFXZGDQ.mjs';
|
|
2
|
+
import { __export } from './chunk-R2VWADIE.mjs';
|
|
3
3
|
import { hexToBytes, keccak256, toBytes, bytesToHex } from 'viem';
|
|
4
4
|
|
|
5
5
|
// src/utils/bigint.ts
|
|
6
6
|
function parseBigIntLike(value, errorMessage = "Unsupported numeric value") {
|
|
7
|
-
if (typeof value === "bigint")
|
|
8
|
-
|
|
7
|
+
if (typeof value === "bigint") {
|
|
8
|
+
return value;
|
|
9
|
+
}
|
|
10
|
+
if (typeof value === "number") {
|
|
11
|
+
return BigInt(value);
|
|
12
|
+
}
|
|
9
13
|
if (typeof value === "string") {
|
|
10
14
|
const normalized = value.trim();
|
|
11
|
-
if (!normalized)
|
|
15
|
+
if (!normalized) {
|
|
16
|
+
throw new Error(errorMessage);
|
|
17
|
+
}
|
|
12
18
|
return BigInt(normalized);
|
|
13
19
|
}
|
|
14
20
|
if (value && typeof value.toString === "function") {
|
|
15
21
|
const normalized = value.toString().trim();
|
|
16
|
-
if (!normalized)
|
|
22
|
+
if (!normalized) {
|
|
23
|
+
throw new Error(errorMessage);
|
|
24
|
+
}
|
|
17
25
|
return BigInt(normalized);
|
|
18
26
|
}
|
|
19
27
|
throw new Error(errorMessage);
|
|
@@ -75553,15 +75561,18 @@ var isValidAddress = (value) => typeof value === "string" && /^0x[a-fA-F0-9]{40}
|
|
|
75553
75561
|
var pickAddress = (contracts, keys) => {
|
|
75554
75562
|
for (const key of keys) {
|
|
75555
75563
|
const candidate = contracts[key];
|
|
75556
|
-
if (isValidAddress(candidate))
|
|
75564
|
+
if (isValidAddress(candidate)) {
|
|
75565
|
+
return candidate;
|
|
75566
|
+
}
|
|
75557
75567
|
}
|
|
75558
75568
|
return void 0;
|
|
75559
75569
|
};
|
|
75560
75570
|
var pickAbi = (source, names) => {
|
|
75561
75571
|
for (const name of names) {
|
|
75562
75572
|
const candidate = source[name];
|
|
75563
|
-
if (Array.isArray(candidate))
|
|
75573
|
+
if (Array.isArray(candidate)) {
|
|
75564
75574
|
return candidate;
|
|
75575
|
+
}
|
|
75565
75576
|
if (candidate && typeof candidate === "object" && Array.isArray(candidate.default)) {
|
|
75566
75577
|
return candidate.default;
|
|
75567
75578
|
}
|
|
@@ -75572,9 +75583,13 @@ var uniqueAddresses = (...values) => {
|
|
|
75572
75583
|
const seen = /* @__PURE__ */ new Set();
|
|
75573
75584
|
const addresses = [];
|
|
75574
75585
|
for (const value of values) {
|
|
75575
|
-
if (!isValidAddress(value))
|
|
75586
|
+
if (!isValidAddress(value)) {
|
|
75587
|
+
continue;
|
|
75588
|
+
}
|
|
75576
75589
|
const normalized = value.toLowerCase();
|
|
75577
|
-
if (seen.has(normalized))
|
|
75590
|
+
if (seen.has(normalized)) {
|
|
75591
|
+
continue;
|
|
75592
|
+
}
|
|
75578
75593
|
seen.add(normalized);
|
|
75579
75594
|
addresses.push(value);
|
|
75580
75595
|
}
|
|
@@ -75583,30 +75598,46 @@ var uniqueAddresses = (...values) => {
|
|
|
75583
75598
|
var resolveRuntimeAddressOverride = (envKeys) => {
|
|
75584
75599
|
for (const key of envKeys) {
|
|
75585
75600
|
const fromVite = readViteEnv(key);
|
|
75586
|
-
if (isValidAddress(fromVite))
|
|
75601
|
+
if (isValidAddress(fromVite)) {
|
|
75602
|
+
return fromVite;
|
|
75603
|
+
}
|
|
75587
75604
|
const fromNode = getNodeEnvVar(key);
|
|
75588
|
-
if (isValidAddress(fromNode))
|
|
75605
|
+
if (isValidAddress(fromNode)) {
|
|
75606
|
+
return fromNode;
|
|
75607
|
+
}
|
|
75589
75608
|
}
|
|
75590
75609
|
return void 0;
|
|
75591
75610
|
};
|
|
75592
75611
|
function normalizeDeploymentEnv(value) {
|
|
75593
|
-
if (!value)
|
|
75612
|
+
if (!value) {
|
|
75613
|
+
return void 0;
|
|
75614
|
+
}
|
|
75594
75615
|
const normalized = value.trim().replace(/^["']|["']$/g, "").toUpperCase();
|
|
75595
75616
|
return normalized === "STAGING" || normalized === "PREPRODUCTION" || normalized === "PRODUCTION" ? normalized : void 0;
|
|
75596
75617
|
}
|
|
75597
75618
|
function inferDeploymentFromSignals(indexerUrl) {
|
|
75598
|
-
if (!indexerUrl)
|
|
75619
|
+
if (!indexerUrl) {
|
|
75620
|
+
return void 0;
|
|
75621
|
+
}
|
|
75599
75622
|
const normalized = indexerUrl.trim().replace(/^["']|["']$/g, "").toLowerCase();
|
|
75600
|
-
if (!normalized)
|
|
75601
|
-
|
|
75602
|
-
|
|
75623
|
+
if (!normalized) {
|
|
75624
|
+
return void 0;
|
|
75625
|
+
}
|
|
75626
|
+
if (normalized.includes("/a952e1d/")) {
|
|
75627
|
+
return "STAGING";
|
|
75628
|
+
}
|
|
75629
|
+
if (normalized.includes("/8fd74dc/")) {
|
|
75630
|
+
return "PRODUCTION";
|
|
75631
|
+
}
|
|
75603
75632
|
if (normalized.includes("indexer-preprod.zkp2p.xyz") || normalized.includes("/preprod/")) {
|
|
75604
75633
|
return "PREPRODUCTION";
|
|
75605
75634
|
}
|
|
75606
75635
|
if (normalized.includes("indexer-staging.zkp2p.xyz") || normalized.includes("/staging/")) {
|
|
75607
75636
|
return "STAGING";
|
|
75608
75637
|
}
|
|
75609
|
-
if (normalized.includes("indexer.zkp2p.xyz"))
|
|
75638
|
+
if (normalized.includes("indexer.zkp2p.xyz")) {
|
|
75639
|
+
return "PRODUCTION";
|
|
75640
|
+
}
|
|
75610
75641
|
return void 0;
|
|
75611
75642
|
}
|
|
75612
75643
|
function getV3DeploymentResolution() {
|
|
@@ -75662,23 +75693,39 @@ function hasFn(abi, name) {
|
|
|
75662
75693
|
return Array.isArray(abi) && abi.some((i) => i?.type === "function" && i?.name === name);
|
|
75663
75694
|
}
|
|
75664
75695
|
function hasCreateDepositStruct(abi) {
|
|
75665
|
-
if (!Array.isArray(abi))
|
|
75696
|
+
if (!Array.isArray(abi)) {
|
|
75697
|
+
return false;
|
|
75698
|
+
}
|
|
75666
75699
|
return abi.some(
|
|
75667
75700
|
(i) => i?.type === "function" && i?.name === "createDeposit" && Array.isArray(i?.inputs) && i.inputs.length === 1 && i.inputs[0]?.type === "tuple"
|
|
75668
75701
|
);
|
|
75669
75702
|
}
|
|
75670
75703
|
function assertV3EscrowAbiComplete(abi) {
|
|
75671
|
-
if (!isDev())
|
|
75704
|
+
if (!isDev()) {
|
|
75705
|
+
return;
|
|
75706
|
+
}
|
|
75672
75707
|
const missing = [];
|
|
75673
|
-
if (!hasCreateDepositStruct(abi))
|
|
75674
|
-
|
|
75675
|
-
|
|
75676
|
-
if (!hasFn(abi, "
|
|
75708
|
+
if (!hasCreateDepositStruct(abi)) {
|
|
75709
|
+
missing.push("createDeposit(tuple)");
|
|
75710
|
+
}
|
|
75711
|
+
if (!hasFn(abi, "addPaymentMethods")) {
|
|
75712
|
+
missing.push("addPaymentMethods");
|
|
75713
|
+
}
|
|
75714
|
+
if (!hasFn(abi, "addCurrencies")) {
|
|
75715
|
+
missing.push("addCurrencies");
|
|
75716
|
+
}
|
|
75717
|
+
if (!hasFn(abi, "setPaymentMethodActive")) {
|
|
75677
75718
|
missing.push("setPaymentMethodActive");
|
|
75678
|
-
|
|
75679
|
-
if (!hasFn(abi, "
|
|
75680
|
-
|
|
75719
|
+
}
|
|
75720
|
+
if (!hasFn(abi, "deactivateCurrency")) {
|
|
75721
|
+
missing.push("deactivateCurrency");
|
|
75722
|
+
}
|
|
75723
|
+
if (!hasFn(abi, "setCurrencyMinRate")) {
|
|
75724
|
+
missing.push("setCurrencyMinRate");
|
|
75725
|
+
}
|
|
75726
|
+
if (!hasFn(abi, "getDepositPaymentMethodActive")) {
|
|
75681
75727
|
missing.push("getDepositPaymentMethodActive");
|
|
75728
|
+
}
|
|
75682
75729
|
if (missing.length) {
|
|
75683
75730
|
throw new Error(
|
|
75684
75731
|
`V3 enabled but escrow ABI incomplete. Missing: ${missing.join(", ")}`
|
|
@@ -76044,7 +76091,9 @@ function getV21Resolution(options) {
|
|
|
76044
76091
|
try {
|
|
76045
76092
|
assertV3EscrowAbiComplete(escrowAbi2);
|
|
76046
76093
|
} catch (e) {
|
|
76047
|
-
if (isDev())
|
|
76094
|
+
if (isDev()) {
|
|
76095
|
+
throw e;
|
|
76096
|
+
}
|
|
76048
76097
|
}
|
|
76049
76098
|
const orchestratorV2Address = resolvedAddresses.orchestratorV2 ?? resolvedAddresses.orchestrator;
|
|
76050
76099
|
const orchestratorAddress = orchestratorV2Address;
|
|
@@ -157627,39 +157676,61 @@ var DISPUTE_PROTECTION_POLICY_ABI2 = requireBundleAbi(
|
|
|
157627
157676
|
"DisputeProtectionPolicy"
|
|
157628
157677
|
);
|
|
157629
157678
|
function unwrapAddresses(mod) {
|
|
157630
|
-
if (!mod)
|
|
157679
|
+
if (!mod) {
|
|
157680
|
+
return {};
|
|
157681
|
+
}
|
|
157631
157682
|
const m = mod;
|
|
157632
|
-
if (m.contracts)
|
|
157633
|
-
|
|
157683
|
+
if (m.contracts) {
|
|
157684
|
+
return m;
|
|
157685
|
+
}
|
|
157686
|
+
if (m.default?.contracts) {
|
|
157634
157687
|
return m.default;
|
|
157688
|
+
}
|
|
157635
157689
|
try {
|
|
157636
157690
|
const d = typeof m.default === "function" ? m.default() : m.default;
|
|
157637
|
-
if (d?.contracts)
|
|
157691
|
+
if (d?.contracts) {
|
|
157692
|
+
return d;
|
|
157693
|
+
}
|
|
157638
157694
|
} catch {
|
|
157639
157695
|
}
|
|
157640
157696
|
return m;
|
|
157641
157697
|
}
|
|
157642
157698
|
function unwrapMethods(mod) {
|
|
157643
|
-
if (!mod)
|
|
157699
|
+
if (!mod) {
|
|
157700
|
+
return {};
|
|
157701
|
+
}
|
|
157644
157702
|
const m = mod;
|
|
157645
|
-
if (m.methods)
|
|
157646
|
-
|
|
157703
|
+
if (m.methods) {
|
|
157704
|
+
return m;
|
|
157705
|
+
}
|
|
157706
|
+
if (m.default?.methods) {
|
|
157647
157707
|
return m.default;
|
|
157708
|
+
}
|
|
157648
157709
|
try {
|
|
157649
157710
|
const d = typeof m.default === "function" ? m.default() : m.default;
|
|
157650
|
-
if (d?.methods)
|
|
157711
|
+
if (d?.methods) {
|
|
157712
|
+
return d;
|
|
157713
|
+
}
|
|
157651
157714
|
} catch {
|
|
157652
157715
|
}
|
|
157653
157716
|
return m;
|
|
157654
157717
|
}
|
|
157655
157718
|
function unwrapConstants(mod) {
|
|
157656
|
-
if (!mod)
|
|
157719
|
+
if (!mod) {
|
|
157720
|
+
return {};
|
|
157721
|
+
}
|
|
157657
157722
|
const m = mod;
|
|
157658
|
-
if (m.USDC)
|
|
157659
|
-
|
|
157723
|
+
if (m.USDC) {
|
|
157724
|
+
return m;
|
|
157725
|
+
}
|
|
157726
|
+
if (m.default?.USDC) {
|
|
157727
|
+
return m.default;
|
|
157728
|
+
}
|
|
157660
157729
|
try {
|
|
157661
157730
|
const d = typeof m.default === "function" ? m.default() : m.default;
|
|
157662
|
-
if (d?.USDC)
|
|
157731
|
+
if (d?.USDC) {
|
|
157732
|
+
return d;
|
|
157733
|
+
}
|
|
157663
157734
|
} catch {
|
|
157664
157735
|
}
|
|
157665
157736
|
return m;
|
|
@@ -157669,17 +157740,23 @@ function isValidAddress2(value) {
|
|
|
157669
157740
|
return typeof value === "string" && /^0x[a-fA-F0-9]{40}$/.test(value) && value.toLowerCase() !== ZERO_ADDRESS2;
|
|
157670
157741
|
}
|
|
157671
157742
|
function pickAddress2(contracts, keys) {
|
|
157672
|
-
if (!contracts)
|
|
157743
|
+
if (!contracts) {
|
|
157744
|
+
return void 0;
|
|
157745
|
+
}
|
|
157673
157746
|
for (const key of keys) {
|
|
157674
157747
|
const candidate = contracts[key];
|
|
157675
|
-
if (isValidAddress2(candidate))
|
|
157748
|
+
if (isValidAddress2(candidate)) {
|
|
157749
|
+
return candidate;
|
|
157750
|
+
}
|
|
157676
157751
|
}
|
|
157677
157752
|
return void 0;
|
|
157678
157753
|
}
|
|
157679
157754
|
function pickAbi2(source, names) {
|
|
157680
157755
|
for (const name of names) {
|
|
157681
157756
|
const candidate = source[name];
|
|
157682
|
-
if (Array.isArray(candidate))
|
|
157757
|
+
if (Array.isArray(candidate)) {
|
|
157758
|
+
return candidate;
|
|
157759
|
+
}
|
|
157683
157760
|
if (candidate && typeof candidate === "object" && Array.isArray(candidate.default)) {
|
|
157684
157761
|
return candidate.default;
|
|
157685
157762
|
}
|
|
@@ -157690,9 +157767,13 @@ function uniqueAddresses2(...values) {
|
|
|
157690
157767
|
const seen = /* @__PURE__ */ new Set();
|
|
157691
157768
|
const addresses = [];
|
|
157692
157769
|
for (const value of values) {
|
|
157693
|
-
if (!isValidAddress2(value))
|
|
157770
|
+
if (!isValidAddress2(value)) {
|
|
157771
|
+
continue;
|
|
157772
|
+
}
|
|
157694
157773
|
const normalized = value.toLowerCase();
|
|
157695
|
-
if (seen.has(normalized))
|
|
157774
|
+
if (seen.has(normalized)) {
|
|
157775
|
+
continue;
|
|
157776
|
+
}
|
|
157696
157777
|
seen.add(normalized);
|
|
157697
157778
|
addresses.push(value);
|
|
157698
157779
|
}
|
|
@@ -157702,7 +157783,9 @@ function readRuntimeEnv(key) {
|
|
|
157702
157783
|
try {
|
|
157703
157784
|
const meta = import.meta;
|
|
157704
157785
|
const fromVite = meta?.env?.[key];
|
|
157705
|
-
if (fromVite)
|
|
157786
|
+
if (fromVite) {
|
|
157787
|
+
return fromVite;
|
|
157788
|
+
}
|
|
157706
157789
|
} catch {
|
|
157707
157790
|
}
|
|
157708
157791
|
try {
|
|
@@ -157715,7 +157798,9 @@ function readRuntimeEnv(key) {
|
|
|
157715
157798
|
function resolveRuntimeAddressOverride2(envKeys) {
|
|
157716
157799
|
for (const key of envKeys) {
|
|
157717
157800
|
const candidate = readRuntimeEnv(key);
|
|
157718
|
-
if (isValidAddress2(candidate))
|
|
157801
|
+
if (isValidAddress2(candidate)) {
|
|
157802
|
+
return candidate;
|
|
157803
|
+
}
|
|
157719
157804
|
}
|
|
157720
157805
|
return void 0;
|
|
157721
157806
|
}
|
|
@@ -158060,38 +158145,48 @@ function getOrchestratorV4Contract(chainId, env = "production") {
|
|
|
158060
158145
|
const { addresses, abis } = getContracts(chainId, env);
|
|
158061
158146
|
const address = addresses.orchestratorV4;
|
|
158062
158147
|
const abi = abis.orchestratorV4;
|
|
158063
|
-
if (!address || !abi)
|
|
158148
|
+
if (!address || !abi) {
|
|
158149
|
+
throw new Error("OrchestratorV4 not available for this chain/environment");
|
|
158150
|
+
}
|
|
158064
158151
|
return { address, abi };
|
|
158065
158152
|
}
|
|
158066
158153
|
function getDisputeProtectionPolicyV2Contract(chainId, env = "production") {
|
|
158067
158154
|
const { addresses, abis } = getContracts(chainId, env);
|
|
158068
158155
|
const address = addresses.disputeProtectionPolicyV2;
|
|
158069
158156
|
const abi = abis.disputeProtectionPolicyV2;
|
|
158070
|
-
if (!address || !abi)
|
|
158157
|
+
if (!address || !abi) {
|
|
158071
158158
|
throw new Error("DisputeProtectionPolicyV2 not available for this chain/environment");
|
|
158159
|
+
}
|
|
158072
158160
|
return { address, abi };
|
|
158073
158161
|
}
|
|
158074
158162
|
function getStakeVaultV2Contract(chainId, env = "production") {
|
|
158075
158163
|
const { addresses, abis } = getContracts(chainId, env);
|
|
158076
158164
|
const address = addresses.stakeVaultV2;
|
|
158077
158165
|
const abi = abis.stakeVaultV2;
|
|
158078
|
-
if (!address || !abi)
|
|
158166
|
+
if (!address || !abi) {
|
|
158167
|
+
throw new Error("StakeVaultV2 not available for this chain/environment");
|
|
158168
|
+
}
|
|
158079
158169
|
return { address, abi };
|
|
158080
158170
|
}
|
|
158081
158171
|
function ensureBytes32(value, { hashIfAscii = false } = {}) {
|
|
158082
158172
|
if (value.startsWith("0x")) {
|
|
158083
158173
|
const bytes = hexToBytes(value);
|
|
158084
|
-
if (bytes.length !== 32)
|
|
158174
|
+
if (bytes.length !== 32) {
|
|
158175
|
+
throw new Error("Expected 32-byte hex value");
|
|
158176
|
+
}
|
|
158085
158177
|
return value;
|
|
158086
158178
|
}
|
|
158087
|
-
if (!hashIfAscii)
|
|
158179
|
+
if (!hashIfAscii) {
|
|
158088
158180
|
throw new Error("Expected 32-byte hex; received ascii string. Pass hashIfAscii=true to hash.");
|
|
158181
|
+
}
|
|
158089
158182
|
const hashed = keccak256(toBytes(value));
|
|
158090
158183
|
return hashed;
|
|
158091
158184
|
}
|
|
158092
158185
|
function asciiToBytes32(value) {
|
|
158093
158186
|
const b = toBytes(value);
|
|
158094
|
-
if (b.length > 32)
|
|
158187
|
+
if (b.length > 32) {
|
|
158188
|
+
throw new Error("ASCII input exceeds 32 bytes");
|
|
158189
|
+
}
|
|
158095
158190
|
const padded = new Uint8Array(32);
|
|
158096
158191
|
padded.set(b);
|
|
158097
158192
|
return bytesToHex(padded);
|
|
@@ -158299,11 +158394,15 @@ function resolvePaymentMethodHash(nameOrBytes, opts = {}) {
|
|
|
158299
158394
|
const key = nameOrBytes.toLowerCase();
|
|
158300
158395
|
const mapping = getPaymentMethodMap(env);
|
|
158301
158396
|
const mappedHash = mapping?.[key]?.paymentMethodHash ?? METHOD_NAME_TO_HASH[key];
|
|
158302
|
-
if (mappedHash)
|
|
158397
|
+
if (mappedHash) {
|
|
158398
|
+
return mappedHash;
|
|
158399
|
+
}
|
|
158303
158400
|
throw new Error(`Unknown processorName: ${nameOrBytes}`);
|
|
158304
158401
|
}
|
|
158305
158402
|
function resolveFiatCurrencyBytes32(codeOrBytes) {
|
|
158306
|
-
if (codeOrBytes.startsWith("0x"))
|
|
158403
|
+
if (codeOrBytes.startsWith("0x")) {
|
|
158404
|
+
return ensureBytes32(codeOrBytes);
|
|
158405
|
+
}
|
|
158307
158406
|
return currencyKeccak256(codeOrBytes.toUpperCase());
|
|
158308
158407
|
}
|
|
158309
158408
|
function resolvePaymentMethodHashFromCatalog(processorName, catalog) {
|
|
@@ -158329,18 +158428,26 @@ function resolvePaymentMethodHashFromCatalog(processorName, catalog) {
|
|
|
158329
158428
|
return entry.paymentMethodHash;
|
|
158330
158429
|
}
|
|
158331
158430
|
const fallbackHash = METHOD_NAME_TO_HASH[key];
|
|
158332
|
-
if (fallbackHash)
|
|
158431
|
+
if (fallbackHash) {
|
|
158432
|
+
return fallbackHash;
|
|
158433
|
+
}
|
|
158333
158434
|
const available = Object.keys(catalog || {}).sort().join(", ");
|
|
158334
158435
|
throw new Error(
|
|
158335
158436
|
available ? `Unknown processorName: ${processorName}. Available: ${available}` : `Unknown processorName: ${processorName}. The payment methods catalog is empty or unavailable.`
|
|
158336
158437
|
);
|
|
158337
158438
|
}
|
|
158338
158439
|
function resolvePaymentMethodNameFromHash(hash, catalog) {
|
|
158339
|
-
if (!hash)
|
|
158440
|
+
if (!hash) {
|
|
158441
|
+
return void 0;
|
|
158442
|
+
}
|
|
158340
158443
|
const target = ensureBytes32(hash);
|
|
158341
158444
|
for (const [name, entry] of Object.entries(catalog || {})) {
|
|
158342
|
-
if (!matchesPaymentMethodNameAndHash(name, entry?.paymentMethodHash ?? ""))
|
|
158343
|
-
|
|
158445
|
+
if (!matchesPaymentMethodNameAndHash(name, entry?.paymentMethodHash ?? "")) {
|
|
158446
|
+
continue;
|
|
158447
|
+
}
|
|
158448
|
+
if (entry?.paymentMethodHash?.toLowerCase() === target.toLowerCase()) {
|
|
158449
|
+
return name;
|
|
158450
|
+
}
|
|
158344
158451
|
}
|
|
158345
158452
|
return HASH_TO_METHOD_NAME[target.toLowerCase()];
|
|
158346
158453
|
}
|
|
@@ -158455,5 +158562,5 @@ function enrichPvIntentView(view, chainId, env = "production") {
|
|
|
158455
158562
|
}
|
|
158456
158563
|
|
|
158457
158564
|
export { DISPUTE_PROTECTION_POLICY_ABI2 as DISPUTE_PROTECTION_POLICY_ABI, DISPUTE_PROTECTION_POLICY_V2_ABI2 as DISPUTE_PROTECTION_POLICY_V2_ABI, METHOD_NAME_TO_HASH, ORCHESTRATOR_V3_ABI2 as ORCHESTRATOR_V3_ABI, ORCHESTRATOR_V4_ABI2 as ORCHESTRATOR_V4_ABI, PAYMENT_PLATFORMS, STAKE_VAULT_ABI2 as STAKE_VAULT_ABI, STAKE_VAULT_V2_ABI2 as STAKE_VAULT_V2_ABI, SUPPORTED_PAYMENT_METHOD_HASHES, asciiToBytes32, baseStaging_default4 as baseStaging_default, base_default4 as base_default, enrichPvDepositView, enrichPvIntentView, ensureBytes32, getContracts, getDisputeProtectionPolicyContract, getDisputeProtectionPolicyV2Contract, getDisputeStackAbis, getGatingServiceAddress, getIntentGuardianContract, getKnownStakeVaultContracts, getOrchestratorV3Contract, getOrchestratorV4Contract, getPaymentMethodsCatalog, getRateManagerContracts, getStakeVaultContract, getStakeVaultV2Contract, hasIntentGuardian, matchesPaymentMethodNameAndHash, matchesQuotePaymentMethod, parseBigIntLike, parseDepositView, parseIntentView, pickAddress, resolveFiatCurrencyBytes32, resolvePaymentMethodHash, resolvePaymentMethodHashFromCatalog, resolvePaymentMethodNameFromHash };
|
|
158458
|
-
//# sourceMappingURL=chunk-
|
|
158459
|
-
//# sourceMappingURL=chunk-
|
|
158565
|
+
//# sourceMappingURL=chunk-66VY2GE6.mjs.map
|
|
158566
|
+
//# sourceMappingURL=chunk-66VY2GE6.mjs.map
|