@neus/sdk 1.0.10 → 1.1.0

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.
@@ -124,11 +124,10 @@ function getVerifyGateUserError(err) {
124
124
  }
125
125
  return null;
126
126
  }
127
- function dispatchNeusProofCreatedForHost({ qHash, walletAddress, ...legacyInput }) {
127
+ function dispatchNeusProofCreatedForHost({ qHash, walletAddress }) {
128
128
  try {
129
129
  if (typeof window === "undefined") return;
130
- const raw = typeof qHash === "string" && qHash.trim() || typeof legacyInput.proofId === "string" && legacyInput.proofId.trim() || // Legacy input compatibility only. Do not expose or store proofId.
131
- "";
130
+ const raw = typeof qHash === "string" ? qHash.trim() : "";
132
131
  if (!raw) return;
133
132
  const w = typeof walletAddress === "string" ? walletAddress.trim() : "";
134
133
  const normalizedWallet = w && /^0x[a-fA-F0-9]{40}$/.test(w) ? w.toLowerCase() : w;
@@ -211,8 +210,7 @@ function VerifyGate({
211
210
  onError = void 0,
212
211
  wallet = void 0,
213
212
  chain = void 0,
214
- signatureMethod = void 0,
215
- ...legacyProps
213
+ signatureMethod = void 0
216
214
  }) {
217
215
  const [state, setState] = useState("idle");
218
216
  const [error, setError] = useState(null);
@@ -229,7 +227,7 @@ function VerifyGate({
229
227
  return Array.isArray(requiredVerifiers) && requiredVerifiers.length > 0 ? requiredVerifiers : ["ownership-basic"];
230
228
  }, [requiredVerifiers]);
231
229
  const primaryVerifier = verifierList[0];
232
- const qHash = qHashProp || legacyProps.proofId || null;
230
+ const qHash = qHashProp || null;
233
231
  const resolvedQHash = qHash;
234
232
  const hasInteractiveVerifier = useMemo(
235
233
  () => verifierList.some((verifierId) => {
@@ -277,7 +275,7 @@ function VerifyGate({
277
275
  setExistingProofs(gateResult);
278
276
  const existingProof = gateResult.existing?.[primaryVerifier];
279
277
  if (existingProof && onVerified) {
280
- const existingQHash = existingProof.qHash || existingProof.proofId || null;
278
+ const existingQHash = existingProof.qHash || null;
281
279
  onVerified({
282
280
  qHash: existingQHash,
283
281
  address: existingProof.walletAddress || address,
@@ -307,7 +305,7 @@ function VerifyGate({
307
305
  return provider.address;
308
306
  }
309
307
  if (typeof provider.request !== "function") {
310
- throw new Error("No wallet provider available");
308
+ throw new Error("Connect a wallet and try again.");
311
309
  }
312
310
  let accounts = await provider.request({ method: "eth_accounts" });
313
311
  if (!accounts || accounts.length === 0) {
@@ -315,7 +313,7 @@ function VerifyGate({
315
313
  accounts = await provider.request({ method: "eth_accounts" });
316
314
  }
317
315
  if (!accounts || accounts.length === 0) {
318
- throw new Error("No wallet accounts available");
316
+ throw new Error("Connect a wallet and try again.");
319
317
  }
320
318
  return accounts[0];
321
319
  }, [wallet]);
@@ -388,7 +386,7 @@ function VerifyGate({
388
386
  }, [client, buildGateRequirements, wallet, inferChainFromAddress, signatureMethod]);
389
387
  const launchHostedCheckout = useCallback(async () => {
390
388
  if (typeof window === "undefined") {
391
- throw new Error("Hosted checkout is only available in browser environments");
389
+ throw new Error("Open this in a browser to verify.");
392
390
  }
393
391
  const origin = window.location.origin;
394
392
  const returnUrl = window.location.href;
@@ -446,7 +444,7 @@ function VerifyGate({
446
444
  completed = true;
447
445
  cleanup();
448
446
  if (payload?.eligible === false) {
449
- reject(new Error("Hosted checkout completed but eligibility was not satisfied."));
447
+ reject(new Error("Verification could not be completed."));
450
448
  return;
451
449
  }
452
450
  resolve(payload);
@@ -546,7 +544,7 @@ function VerifyGate({
546
544
  setState("interactive-checkout");
547
545
  onStateChange?.("interactive-checkout");
548
546
  const checkoutResult = await launchHostedCheckout();
549
- const checkoutQHash = checkoutResult?.qHash || checkoutResult?.proofId || null;
547
+ const checkoutQHash = checkoutResult?.qHash || null;
550
548
  const handoffWallet = typeof checkoutResult?.walletAddress === "string" && checkoutResult.walletAddress.trim() || walletAddress && String(walletAddress).trim() || "";
551
549
  setState("verified");
552
550
  dispatchNeusProofCreatedForHost({
@@ -573,7 +571,7 @@ function VerifyGate({
573
571
  const buildDataForVerifier = (verifierId) => {
574
572
  if (!CREATABLE_VERIFIERS.has(verifierId)) {
575
573
  throw new Error(
576
- `${verifierId} cannot be created via the wallet flow. It requires hosted checkout or a server integration.`
574
+ "This check requires the hosted verifier."
577
575
  );
578
576
  }
579
577
  const explicit = verifierData && verifierData[verifierId];
@@ -587,12 +585,12 @@ function VerifyGate({
587
585
  if (verifierId === "wallet-link") {
588
586
  if (!explicit?.secondaryWalletAddress || !explicit?.signature || !explicit?.chain || !explicit?.signatureMethod) {
589
587
  throw new Error(
590
- "wallet-link direct mode requires verifierData: { secondaryWalletAddress, signature, chain, signatureMethod }. For user-facing flows, prefer hosted checkout."
588
+ "Missing required wallet details."
591
589
  );
592
590
  }
593
591
  return explicit;
594
592
  }
595
- throw new Error(`${verifierId} requires explicit verifierData`);
593
+ throw new Error("Missing required verification details.");
596
594
  };
597
595
  const verifyOne = async (verifierId) => {
598
596
  const dataForVerifier = buildDataForVerifier(verifierId);
@@ -611,17 +609,17 @@ function VerifyGate({
611
609
  wallet: wallet || (typeof window !== "undefined" ? window.ethereum : void 0)
612
610
  });
613
611
  setState("verifying");
614
- const qHashToCheck = created.qHash || created.proofId || created?.data?.qHash || created?.data?.proofId;
612
+ const qHashToCheck = created.qHash || created?.data?.qHash;
615
613
  const final = await client.pollProofStatus(qHashToCheck, { interval: 3e3, timeout: 6e4 });
616
614
  const verifiedVerifiers = final?.data?.verifiedVerifiers || [];
617
615
  const verifierResult = verifiedVerifiers.find((v) => v.verifierId === verifierId);
618
616
  if (!verifierResult || verifierResult.verified !== true) {
619
- throw new Error(`Verification failed for ${verifierId}`);
617
+ throw new Error("Verification could not be completed.");
620
618
  }
621
619
  const hubTx = final?.data?.hubTransaction || {};
622
620
  const crosschain = final?.data?.crosschain || {};
623
621
  const txHash = hubTx?.txHash || crosschain?.hubTxHash || null;
624
- const finalQHash = final?.qHash || final?.proofId || qHashToCheck;
622
+ const finalQHash = final?.qHash || qHashToCheck;
625
623
  return {
626
624
  verifierId,
627
625
  qHash: finalQHash,
@@ -849,7 +847,7 @@ function VerifyGate({
849
847
  textUnderlineOffset: "2px",
850
848
  opacity: disabled || isProcessing ? 0.6 : 0.9
851
849
  },
852
- children: "Already verified? Sign to reuse existing proofs."
850
+ children: "Already verified? Reuse your proof."
853
851
  }
854
852
  ),
855
853
  error && /* @__PURE__ */ jsx("div", { style: {