@provex/react 1.11.0 → 2.0.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.
package/dist/index.d.ts CHANGED
@@ -1,10 +1,13 @@
1
- import { C as CreateDepositRawParams, I as IndexerAdapter, P as ProveXClientConfig, a as PaginationOptions, b as PaginatedResult, c as IndexedDeposit, d as IndexedIntent, R as ReputationData, W as WritableMethod, F as FulfillIntentParams, e as CreateDepositParams$1, T as TransactionResult, f as PreparedTransaction, S as SignalIntentParams, g as SignalIntentResult, h as PayeeDetails, M as MakerRegistrationParams, A as AttestationParams, i as AttestationResponse, j as WalletAdapter, U as UseProvexBuyOptions, k as UseProvexBuyReturn, l as PhaseRenderProps, B as BuyProps } from './ProvexProvider-BAFqjyNz.js';
2
- export { y as ApiClient, n as BuyPhase, Y as DepositInfo, D as DepositPaymentMethod, a0 as IndexedVerifier, Z as IntentStatus, _ as PayeeInfo, p as PhaseComponentProps, t as ProveXError, v as ProveXErrorCode, m as ProvexConfig, r as ProvexContextValue, q as ProvexProvider, s as ProvexProviderProps, o as ProvexTheme, X as ReputationLimits, V as ReputationLimitsParams, w as SignalIntentRawParams, $ as SignalIntentStatus, x as createApiClient, G as getRate, J as intentStatuses, E as useDeposits, N as useOptionalProvexPublicClient, Q as useOptionalProvexWallet, H as usePayeeDetails, u as useProvex, L as useProvexPublicClient, O as useProvexWallet, z as useReputationLimits, K as useSignalIntent } from './ProvexProvider-BAFqjyNz.js';
1
+ import { C as CreateDepositRawParams, I as IndexerAdapter, P as ProveXClientConfig, a as PaginationOptions, b as PaginatedResult, c as IndexedDeposit, d as IndexedIntent, R as ReputationData, W as WritableMethod, F as FulfillIntentParams, e as CreateDepositParams$1, T as TransactionResult, f as PreparedTransaction, S as SignalIntentParams, g as SignalIntentResult, h as PayeeDetails, M as MakerRegistrationParams, i as WalletAdapter, U as UseProvexBuyOptions, j as UseProvexBuyReturn, k as PhaseRenderProps, B as BuyProps } from './ProvexProvider-BE5MY2Zz.js';
2
+ export { A as ApiClient, m as BuyPhase, K as DEFAULT_SIGNAL_INTENT_MESSAGES, Y as DepositInfo, D as DepositPaymentMethod, a5 as IndexedVerifier, Z as IntentStatus, _ as PayeeInfo, o as PhaseComponentProps, t as ProveXError, v as ProveXErrorCode, l as ProvexConfig, r as ProvexContextValue, p as ProvexProvider, s as ProvexProviderProps, n as ProvexTheme, X as ReputationLimits, V as ReputationLimitsParams, a0 as SignalIntentDeposit, a2 as SignalIntentMessages, w as SignalIntentRawParams, $ as SignalIntentStatus, a1 as SignalIntentTransaction, a4 as StartOrderParams, a3 as UseSignalIntentOptions, x as createApiClient, E as getRate, H as intentStatuses, q as useClock, z as useDeposits, N as useOptionalProvexPublicClient, Q as useOptionalProvexWallet, G as usePayeeDetails, u as useProvex, L as useProvexPublicClient, O as useProvexWallet, y as useReputationLimits, J as useSignalIntent } from './ProvexProvider-BE5MY2Zz.js';
3
+ import { C as Clock } from './clock-BDtn-Itb.js';
4
+ export { T as TimerHandle, s as systemClock } from './clock-BDtn-Itb.js';
5
+ import { Hex, Chain, PublicClient } from 'viem';
6
+ import { ProvingClient, CaptureRequest, CaptureAdapter, ProvingState, ManualTransactionSelect } from '@provex/proving';
3
7
  export { CaptureAdapter, CaptureCandidate, ProvingState } from '@provex/proving';
4
8
  import * as react_jsx_runtime from 'react/jsx-runtime';
5
9
  import * as React from 'react';
6
10
  import React__default from 'react';
7
- import { Hex, Chain, PublicClient } from 'viem';
8
11
  import { ChainId } from '@provex/utils/chain';
9
12
  import { FeeInfo } from '@provex/utils/fees';
10
13
  import { TakerTier } from '@provex/utils/payment';
@@ -14,8 +17,8 @@ import { Version } from '@provex/utils/contracts';
14
17
  import { WriteHookParams } from '@valve-tech/wallet-adapter';
15
18
  import * as _tanstack_query_core from '@tanstack/query-core';
16
19
  import { UseQueryResult } from '@tanstack/react-query';
20
+ import { V3AttestationResponseObject } from '@provex/utils';
17
21
  import '@provex/utils/currencies';
18
- import '@provex/utils';
19
22
 
20
23
  /**
21
24
  * @fileoverview Hook for reading protocol fee configuration.
@@ -96,37 +99,168 @@ declare function useProtocolFees({ chainId, escrowAddress, enabled, }: UseProtoc
96
99
  declare function useProtocolFeePercentage(params: UseProtocolFeesParams): string | undefined;
97
100
 
98
101
  /**
99
- * @fileoverview Hook for fetching user reputation (taker tier).
102
+ * @fileoverview The three-state answer to "is this wallet on the president
103
+ * (VIP) allowlist", and the filtering rule that follows from it.
100
104
  *
101
- * Calculates the user's reputation tier based on:
102
- * - Fulfilled volume (in USDC, 1:1 with USD)
103
- * - Lock score (penalty for cancellations)
104
- * - Cooldown status
105
+ * Before a session exists, VIP status is not "no". It is "not known yet".
106
+ * Reading unknown as "not VIP" would apply normal cooldowns and caps to a
107
+ * VIP and hide providers they may use. The rule here keeps unknown from
108
+ * acting as "not VIP".
109
+ */
110
+
111
+ /** The standing of a wallet on the president (VIP) allowlist. */
112
+ type VipStatus = 'unknown' | 'normal' | 'vip';
113
+ /**
114
+ * The tier that buyer-facing cooldown and cap filtering should use, or
115
+ * `null` for "do not filter".
105
116
  *
106
- * Uses the IndexerAdapter for data — no direct Ponder queries.
117
+ * - `'unknown'` returns `null`: never hide a provider, or block an amount,
118
+ * for a rule that may not apply to this wallet.
119
+ * - `'vip'` returns president: no cap, no cooldown.
120
+ * - `'normal'` returns the wallet's own tier.
121
+ */
122
+ declare function filteringTierFor(options: {
123
+ vipStatus: VipStatus;
124
+ tier: TakerTier;
125
+ }): TakerTier | null;
126
+
127
+ /**
128
+ * @fileoverview Hook for a wallet's reputation: tier, cooldown and lock score.
129
+ *
130
+ * Reputation counts both sides of a trade. Taker (buyer) and maker (seller)
131
+ * volume add at one-to-one weight, so sellers climb the tier ladder next to
132
+ * buyers. Volumes stay `bigint` in base units until the display layer.
133
+ *
134
+ * The hook is headless. It reads no build-time environment value and needs
135
+ * no wallet-connect, router or design-system package. The host app injects:
136
+ * - `source`: where the stats come from (default: the `ProvexProvider`
137
+ * indexer adapter). An app with live subscriptions passes its own.
138
+ * - `vipStatus`: the answer from its sign-in session (default: `'normal'`).
139
+ * - `disabled`: the kill switch (default: `config.reputationDisabled` from
140
+ * `ProvexProvider`, then `false`).
141
+ *
142
+ * @remarks
143
+ * Reputation is PulseChain-only. The `chainId` option stays on the signature
144
+ * for backward compatibility and does not change the data source.
107
145
  *
108
146
  * @see {@link @provex/utils/reputation} for tier definitions
109
- * @see {@link useReputationLimits} for applying limits to specific payments
147
+ * @see {@link useReputationLimits} for applying limits to a specific payment
110
148
  */
111
149
 
112
150
  /**
113
- * Hook to fetch and calculate user reputation tier.
114
- *
115
- * @param address - User's wallet address
116
- * @param chainId - Current chain ID
117
- * @returns User reputation data and loading state
151
+ * The stats row the tier is computed from. Structurally the same as the
152
+ * indexer client's `UserReputationStats`, so an app can pass that row as is.
153
+ * Maker fields are optional until the indexer reindex lands; `undefined`
154
+ * reads as zero.
118
155
  */
119
- declare function useReputation({ address, chainId, }: {
156
+ interface ReputationStats {
157
+ /** Taker-side fulfilled volume in USDC base units (6 decimals). */
158
+ fulfilledVolume: bigint;
159
+ /** Taker-side fulfilled intent count. */
160
+ fulfilledCount: number;
161
+ /** Maker-side fulfilled volume in USDC base units. */
162
+ fulfilledMakerVolume?: bigint;
163
+ /** Maker-side fulfilled intent count. */
164
+ fulfilledMakerCount?: number;
165
+ /** Late cancellations (pruned more than 15 minutes after signal). */
166
+ lateCancellations: number;
167
+ }
168
+ /** What a {@link ReputationSource} reports for one wallet. */
169
+ interface ReputationSourceResult {
170
+ /** The stats row, or `null` when not loaded. */
171
+ stats: ReputationStats | null;
172
+ /** Seconds since epoch of the last signaled intent, or `null` for never. */
173
+ lastSignaledTimestamp: bigint | number | null;
174
+ /** True while the first load is in flight. */
175
+ isLoading: boolean;
176
+ /** The load error, if any. */
177
+ error: Error | null;
178
+ /** Ask the source to reload. */
179
+ refetch: () => void | Promise<unknown>;
180
+ }
181
+ /**
182
+ * A hook that supplies reputation data for a wallet. It is called on every
183
+ * render, so pass the same function each time (a module-level hook).
184
+ */
185
+ type ReputationSource = (params: {
120
186
  address: Hex | undefined;
121
- chainId: ChainId;
122
- }): {
187
+ }) => ReputationSourceResult;
188
+ /** Options for {@link useUserReputation}. */
189
+ interface UseUserReputationOptions {
190
+ /** The wallet to score. */
191
+ address: Hex | undefined;
192
+ /** @deprecated Reputation is PulseChain-only. Kept for compatibility. */
193
+ chainId?: ChainId;
194
+ /** Data source. Defaults to the `ProvexProvider` indexer adapter. */
195
+ source?: ReputationSource;
196
+ /** VIP status from the host's session. Defaults to `'normal'`. */
197
+ vipStatus?: VipStatus;
198
+ /**
199
+ * Kill switch. When true the hook reports the neutral default and never
200
+ * filters. Defaults to `ProvexProvider` `config.reputationDisabled`.
201
+ */
202
+ disabled?: boolean;
203
+ }
204
+ /** Return value of {@link useUserReputation}. */
205
+ interface UseUserReputationResult {
123
206
  reputation: UserReputation;
207
+ /**
208
+ * The most recent signaled intent timestamp (ms since epoch). Pair with
209
+ * `getCooldownHours({ tier, providerKey })` to derive per-provider
210
+ * cooldown. Null if the wallet never signaled an intent.
211
+ */
212
+ lastSignaledIntentMs: number | null;
213
+ /** The wallet's VIP status as the host reported it. */
214
+ vipStatus: VipStatus;
215
+ /**
216
+ * The tier buyer-facing cooldown and cap filtering should use, or `null`
217
+ * for "do not filter" (VIP status unknown, or the kill switch is on). Use
218
+ * this, not `reputation.tier`, for anything that hides providers or blocks
219
+ * amounts.
220
+ */
221
+ filteringTier: TakerTier | null;
124
222
  isLoading: boolean;
125
223
  error: Error | null;
126
- refetch: () => void;
127
- };
224
+ refetch: () => Promise<void>;
225
+ }
226
+ /**
227
+ * Compute the user-facing reputation from one stats row and the last
228
+ * signaled-intent timestamp that starts the cooldown clock.
229
+ *
230
+ * Taker and maker volume add at 1.0x weight. The lock score is diluted by
231
+ * the combined fulfilled count, so a long history earns relief from late
232
+ * cancellations. Each penalty step drops the tier by one rung.
233
+ *
234
+ * @param stats - The raw stats row, or `null` when not yet loaded
235
+ * @param pulseTimestamp - Last signaled intent in seconds, or `null` if never
236
+ * @param now - Clock injection for tests (defaults to the current time)
237
+ */
238
+ declare function computeUserReputation({ stats, pulseTimestamp, now, }: {
239
+ stats: ReputationStats | null | undefined;
240
+ pulseTimestamp: bigint | number | null | undefined;
241
+ now?: () => Date;
242
+ }): UserReputation;
243
+ /**
244
+ * The default {@link ReputationSource}: reads the `ProvexProvider` indexer
245
+ * adapter. The adapter row has no maker fields, so tiers from this source
246
+ * count taker volume only. Apps with maker stats pass their own source.
247
+ */
248
+ declare const useIndexerReputationSource: ReputationSource;
249
+ /**
250
+ * Fetch and compute a wallet's reputation tier.
251
+ *
252
+ * @example
253
+ * ```ts
254
+ * const { reputation, filteringTier } = useUserReputation({
255
+ * address,
256
+ * vipStatus, // from your session
257
+ * disabled: false, // your kill switch
258
+ * })
259
+ * ```
260
+ */
261
+ declare function useUserReputation({ address, source, vipStatus, disabled, }: UseUserReputationOptions): UseUserReputationResult;
128
262
  /**
129
- * Get display info for a tier.
263
+ * Display info for a tier: name, caps, cooldown, badge color and volume band.
130
264
  */
131
265
  declare function getTierDisplayInfo(tier: TakerTier): {
132
266
  name: string;
@@ -136,6 +270,37 @@ declare function getTierDisplayInfo(tier: TakerTier): {
136
270
  volumeRangeDisplay: string;
137
271
  };
138
272
 
273
+ /**
274
+ * @fileoverview Deprecated alias for the reputation hook.
275
+ *
276
+ * `useReputation` was the first reputation hook in `@provex/react`. The
277
+ * maker+taker model in {@link useUserReputation} replaced it. This file keeps
278
+ * the old export names working so the change stays non-breaking in 1.x.
279
+ *
280
+ * @deprecated Import `useUserReputation` and `getTierDisplayInfo` from
281
+ * `@provex/react` instead.
282
+ */
283
+
284
+ /**
285
+ * Fetch and compute a wallet's reputation tier through the
286
+ * `ProvexProvider` indexer adapter.
287
+ *
288
+ * Reputation is PulseChain-only now, so `chainId` no longer changes the data
289
+ * source. It stays on the signature for compatibility.
290
+ *
291
+ * @deprecated Use {@link useUserReputation}. It adds maker volume, VIP
292
+ * status, `filteringTier` and an explicit kill switch.
293
+ */
294
+ declare function useReputation({ address, chainId, }: {
295
+ address: Hex | undefined;
296
+ chainId: ChainId;
297
+ }): {
298
+ reputation: UserReputation;
299
+ isLoading: boolean;
300
+ error: Error | null;
301
+ refetch: () => void;
302
+ };
303
+
139
304
  /**
140
305
  * @fileoverview Hook for checking nullifier usage (double-spend prevention).
141
306
  *
@@ -359,6 +524,59 @@ declare const useV3Escrow: ({ chainId, escrowAddress, onSlowSync, onTransactionC
359
524
  refetchDepositCounter: (options?: _tanstack_query_core.RefetchOptions) => Promise<_tanstack_query_core.QueryObserverResult<bigint, Error>>;
360
525
  };
361
526
 
527
+ /**
528
+ * @fileoverview Indexer sync utilities for waiting on blockchain state.
529
+ *
530
+ * Provides polling functions to wait for transactions and state changes
531
+ * to be indexed before updating the UI.
532
+ *
533
+ * @remarks
534
+ * These functions accept query callbacks instead of importing a specific
535
+ * indexer implementation. This allows consumers to bring their own data
536
+ * source (Ponder, The Graph, custom API, etc.).
537
+ *
538
+ * @see {@link useTransactionWithIndexer} for the React hook wrapper
539
+ */
540
+
541
+ /**
542
+ * Poll until a deposit reaches a specific status.
543
+ *
544
+ * @param queryDeposit - Function to query deposit state (from IndexerAdapter)
545
+ * @param depositIdHex - Serialized deposit orderId hex
546
+ * @param status - Target status to wait for
547
+ * @param onSuccess - Called when status is reached
548
+ * @param onSlowSync - Called once if sync exceeds threshold
549
+ * @param slowSyncThresholdMs - Threshold in ms before calling onSlowSync (default 15000)
550
+ * @param clock - Time source for the poll delay and the threshold (default systemClock)
551
+ */
552
+ declare const checkMutation: ({ queryDeposit, depositIdHex, status, onSuccess, onSlowSync, slowSyncThresholdMs, clock, }: {
553
+ queryDeposit: IndexerAdapter["getDepositById"];
554
+ depositIdHex: Hex;
555
+ status: string;
556
+ onSuccess?: () => void;
557
+ onSlowSync?: () => void;
558
+ slowSyncThresholdMs?: number;
559
+ clock?: Clock;
560
+ }) => Promise<void>;
561
+ /**
562
+ * Poll until a transaction is indexed.
563
+ *
564
+ * @param queryTransaction - Function to query transaction state (from IndexerAdapter)
565
+ * @param hash - Transaction hash to wait for
566
+ * @param onSuccess - Called when the transaction is found
567
+ * @param onSlowSync - Called once if sync exceeds threshold
568
+ * @param slowSyncThresholdMs - Threshold in ms before calling onSlowSync (default 15000)
569
+ * @param clock - Time source for the poll delay and the threshold (default systemClock)
570
+ */
571
+ declare const checkTransactionIndexed: ({ queryTransaction, hash, onSuccess, onSlowSync, slowSyncThresholdMs, clock, }: {
572
+ queryTransaction: IndexerAdapter["getTransactionByHash"];
573
+ hash: Hex;
574
+ onSuccess?: () => void;
575
+ onSlowSync?: () => void;
576
+ slowSyncThresholdMs?: number;
577
+ clock?: Clock;
578
+ }) => Promise<void>;
579
+
362
580
  /**
363
581
  * Phase of the transaction lifecycle.
364
582
  */
@@ -615,7 +833,7 @@ declare class ProveXClient {
615
833
  * Handles all encoding internally:
616
834
  * 1. Registers payee details with the API (so buyers can discover them)
617
835
  * 2. Hashes provider keys and currency codes to bytes32
618
- * 3. Expands sub-providers (e.g., 'zelle' → zelle-chase, zelle-bofa, zelle-citi)
836
+ * 3. Collapses bank-level keys to their rail (e.g., 'zelle-chase' → 'zelle'); Zelle is one rail
619
837
  * 4. Encodes gating service witness signers
620
838
  * 5. Submits the on-chain transaction
621
839
  *
@@ -702,12 +920,6 @@ declare class ProveXClient {
702
920
  registerMaker(params: MakerRegistrationParams): Promise<{
703
921
  id: string;
704
922
  } | null>;
705
- /**
706
- * Submit zkTLS proofs and get a signed attestation for fulfillIntent.
707
- * This is the proof verification step — after the buyer makes payment and
708
- * generates proofs via the browser extension.
709
- */
710
- getAttestation(params: AttestationParams): Promise<AttestationResponse>;
711
923
  /** Make a POST request to the API. */
712
924
  private apiPost;
713
925
  waitForTransactionIndexed(hash: Hex): Promise<void>;
@@ -797,6 +1009,145 @@ declare function useOrchestratorAddress({ escrowAddress, chainId, enabled, }: {
797
1009
  enabled?: boolean;
798
1010
  }): UseQueryResult<Hex, Error>;
799
1011
 
1012
+ /**
1013
+ * @fileoverview Pure builder for the wallet-backed {@link ProvingClient} that
1014
+ * {@link useProvingFlow} hands to the shared `@provex/proving` machine.
1015
+ *
1016
+ * It holds the `fulfillIntent` body that lived in the Provex app's
1017
+ * `useProvingClientShim`. The body mirrors the order the transaction-flight
1018
+ * strip depends on. No React and no wallet library is imported here: the
1019
+ * caller injects the wallet write, the public client and the gas inputs.
1020
+ */
1021
+
1022
+ /** Fee inputs that a gas oracle returns for one transaction. */
1023
+ interface GasInputs {
1024
+ maxPriorityFeePerGas?: bigint;
1025
+ maxFeePerGas?: bigint;
1026
+ }
1027
+ /** Arguments the wallet write receives for the `fulfillIntent` call. */
1028
+ interface WalletFulfillWriteArgs extends GasInputs {
1029
+ address: Hex;
1030
+ abi: unknown;
1031
+ functionName: 'fulfillIntent';
1032
+ args: readonly unknown[];
1033
+ /**
1034
+ * Pins the broadcast to the settlement chain. A wallet library that honors
1035
+ * this field refuses to send on another chain, so the nullifier can only
1036
+ * settle on the chain we intend.
1037
+ */
1038
+ chainId?: number;
1039
+ }
1040
+ /** Encoded `fulfillIntent` call for one attestation. */
1041
+ interface EncodedFulfill {
1042
+ args: readonly unknown[];
1043
+ calldata: Hex;
1044
+ abi: unknown;
1045
+ }
1046
+ /** Data for the speed-up prefill that the transaction-flight strip stores. */
1047
+ interface FulfillPrefill {
1048
+ to: Hex;
1049
+ data: Hex;
1050
+ value: bigint;
1051
+ originalTip?: bigint;
1052
+ }
1053
+ /** Everything {@link createWalletProvingClient} needs. All values are resolved. */
1054
+ interface WalletProvingClientOptions {
1055
+ /** Orchestrator contract address for the settlement chain. */
1056
+ orchestratorAddress: Hex;
1057
+ /** Settlement chain. It also pins the wallet write. */
1058
+ chainId: number;
1059
+ /** Wallet write bound to the connected wallet. */
1060
+ writeContract: (args: WalletFulfillWriteArgs) => Promise<Hex>;
1061
+ /**
1062
+ * Public client used to wait for the receipt. When it is undefined (before
1063
+ * wallet hydration) the client skips the wait and returns no receipt.
1064
+ */
1065
+ publicClient: {
1066
+ waitForTransactionReceipt: (args: {
1067
+ hash: Hex;
1068
+ }) => Promise<unknown>;
1069
+ } | undefined;
1070
+ /** Registry read. It already holds the payment method, so it takes the nullifier only. */
1071
+ checkNullifierUsed: (nullifier: Hex) => Promise<boolean | null>;
1072
+ /** Gas oracle for this transaction. */
1073
+ getGasInputs: () => Promise<GasInputs>;
1074
+ /** Replaces {@link encodeOrchestratorFulfill}. Optional. */
1075
+ encodeFulfill?: (attestation: V3AttestationResponseObject, verificationData: Hex, intentHash: Hex) => EncodedFulfill;
1076
+ /** Called after the broadcast and before the hash callback. Optional. */
1077
+ onPrefill?: (prefill: FulfillPrefill, gasInputs: GasInputs, hash: Hex) => void;
1078
+ }
1079
+
1080
+ /**
1081
+ * @fileoverview useProvingFlow — the one headless hook that drives the enclave
1082
+ * proving pipeline (authenticate, capture, attest, fulfill) for @provex/react
1083
+ * consumers and for the Provex app.
1084
+ *
1085
+ * It wraps `useProving` from @provex/proving. It imports no Chakra, no router
1086
+ * and no wallet-connect library. The caller injects wallet writes and gas
1087
+ * inputs through the `rail` option.
1088
+ */
1089
+
1090
+ /** The rail submits the transaction through an injected wallet write. */
1091
+ interface WalletProvingRail extends Omit<WalletProvingClientOptions, 'chainId'> {
1092
+ kind: 'wallet';
1093
+ }
1094
+ /** The rail submits the transaction through a ready-made `fulfillIntent`. */
1095
+ interface ClientProvingRail {
1096
+ kind: 'client';
1097
+ /** For example `ProveXClient.fulfillIntent`. */
1098
+ fulfillIntent: ProvingClient['fulfillIntent'];
1099
+ /** Registry read. It already holds the payment method, so it takes the nullifier only. */
1100
+ checkNullifierUsed: (nullifier: Hex) => Promise<boolean | null>;
1101
+ }
1102
+ /** How the flow reads the nullifier registry and submits `fulfillIntent`. */
1103
+ type ProvingRail = WalletProvingRail | ClientProvingRail;
1104
+ /** Options for {@link useProvingFlow}. All values are already resolved. */
1105
+ interface UseProvingFlowOptions {
1106
+ /** Wallet write, gas inputs and registry read. Memoize it: a new object builds a new client. */
1107
+ rail: ProvingRail;
1108
+ /** The capture request for the selected deposit, payment method and intent. */
1109
+ request: CaptureRequest;
1110
+ /** Payment method id for the nullifier registry lookup. */
1111
+ paymentMethodId: Hex;
1112
+ /**
1113
+ * Settlement chain that pins the rail. Defaults to `request.chainId`.
1114
+ * `useProving` refuses to run when the two differ.
1115
+ */
1116
+ chainId?: number;
1117
+ /**
1118
+ * Capture adapter override. When it is omitted, the hook builds the
1119
+ * extension enclave adapter from `window.peer`. Tests inject a fake here.
1120
+ */
1121
+ captureAdapter?: CaptureAdapter;
1122
+ /** Gate origin for the default extension enclave adapter. */
1123
+ attestationBaseUrl: string;
1124
+ /** Enclave origin for the default adapter. Left out when it is undefined. */
1125
+ attestationServiceUrl?: string;
1126
+ /** Fires when the wallet popup is about to open. */
1127
+ onAwaitingSignature?: () => void;
1128
+ /** Receives the broadcast transaction hash. */
1129
+ onTransactionHash?: (hash: Hex) => void;
1130
+ /** Fires once when the flow reaches `complete`. */
1131
+ onComplete?: (attestation: V3AttestationResponseObject) => void;
1132
+ }
1133
+ /** Return shape of {@link useProvingFlow}. */
1134
+ interface UseProvingFlowReturn {
1135
+ state: ProvingState;
1136
+ authenticate: () => Promise<void>;
1137
+ fulfill: () => Promise<void>;
1138
+ retryVerification: () => Promise<void>;
1139
+ retrySubmission: () => Promise<void>;
1140
+ /** Bridge for the transaction picker that the capture adapter opens. */
1141
+ manualSelect: ManualTransactionSelect;
1142
+ }
1143
+ /**
1144
+ * Drive the enclave proving pipeline.
1145
+ *
1146
+ * @param options - Resolved dependencies. The hook resolves no contract itself.
1147
+ * @returns The `useProving` state and actions, plus the manual-select bridge.
1148
+ */
1149
+ declare function useProvingFlow(options: UseProvingFlowOptions): UseProvingFlowReturn;
1150
+
800
1151
  /**
801
1152
  * @fileoverview useProvexBuy — headless state machine for the buy flow.
802
1153
  *
@@ -950,4 +1301,4 @@ declare function CompletePhase({ className, style, render, }: PhaseRenderProps<C
950
1301
  */
951
1302
  declare function ProvexBuy({ wallet, onIntentSignaled, onComplete, paymentMethods, className, style, theme, }: BuyProps): react_jsx_runtime.JSX.Element;
952
1303
 
953
- export { AttestationParams, AttestationResponse, BrowsePhase, type BrowsePhaseState, BuyProps, type CancelIntentStatus, CommittedPhase, type CommittedPhaseState, CompletePhase, type CompletePhaseState, CreateDepositParams$1 as CreateDepositParams, CreateDepositRawParams, FulfillIntentParams, IndexedDeposit, IndexedIntent, IndexerAdapter, MakerRegistrationParams, type MutationSyncOptions, PaginatedResult, PaginationOptions, PayeeDetails, PhaseRenderProps, PreparedTransaction, type ProtocolFeesResult, ProveXClient, ProveXClientConfig, ProvexBuy, ProvexBuyProvider, type ProvexBuyProviderProps, ProvingPhase, type ProvingPhaseActions, type ProvingPhaseState, type ReleaseFundsStatus, ReputationData, SignalIntentParams, SignalIntentResult, type TransactionPhase, TransactionResult, type TransactionSyncOptions, type UseProtocolFeesParams, UseProvexBuyOptions, UseProvexBuyReturn, type UseTransactionWithIndexerOptions, type CreateDepositParams as V3EscrowCreateDepositParams, type V3EscrowStatus, WalletAdapter, WritableMethod, createProveXClient, getTierDisplayInfo, useAllowance, useCancelIntent, useNullifierRegistry, useOrchestratorAddress, useProtocolFeePercentage, useProtocolFees, useProveXClient, useProvexBuy, useProvexBuyContext, useReleaseFundsToPayer, useReputation, useTransactionWithIndexer, useV3Escrow };
1304
+ export { BrowsePhase, type BrowsePhaseState, BuyProps, type CancelIntentStatus, type ClientProvingRail, Clock, CommittedPhase, type CommittedPhaseState, CompletePhase, type CompletePhaseState, CreateDepositParams$1 as CreateDepositParams, CreateDepositRawParams, type EncodedFulfill, FulfillIntentParams, type FulfillPrefill, type GasInputs, IndexedDeposit, IndexedIntent, IndexerAdapter, MakerRegistrationParams, type MutationSyncOptions, PaginatedResult, PaginationOptions, PayeeDetails, PhaseRenderProps, PreparedTransaction, type ProtocolFeesResult, ProveXClient, ProveXClientConfig, ProvexBuy, ProvexBuyProvider, type ProvexBuyProviderProps, ProvingPhase, type ProvingPhaseActions, type ProvingPhaseState, type ProvingRail, type ReleaseFundsStatus, ReputationData, type ReputationSource, type ReputationSourceResult, type ReputationStats, SignalIntentParams, SignalIntentResult, type TransactionPhase, TransactionResult, type TransactionSyncOptions, type UseProtocolFeesParams, UseProvexBuyOptions, UseProvexBuyReturn, type UseProvingFlowOptions, type UseProvingFlowReturn, type UseTransactionWithIndexerOptions, type UseUserReputationOptions, type UseUserReputationResult, type CreateDepositParams as V3EscrowCreateDepositParams, type V3EscrowStatus, type VipStatus, WalletAdapter, type WalletFulfillWriteArgs, type WalletProvingRail, WritableMethod, checkMutation, checkTransactionIndexed, computeUserReputation, createProveXClient, filteringTierFor, getTierDisplayInfo, useAllowance, useCancelIntent, useIndexerReputationSource, useNullifierRegistry, useOrchestratorAddress, useProtocolFeePercentage, useProtocolFees, useProveXClient, useProvexBuy, useProvexBuyContext, useProvingFlow, useReleaseFundsToPayer, useReputation, useTransactionWithIndexer, useUserReputation, useV3Escrow };
package/dist/index.js CHANGED
@@ -1,11 +1,19 @@
1
- import { useOptionalProvexPublicClient, useOptionalProvexWallet, useContractRead, getTransactionGasInputs, useOptionalProvex, createProveXClient, checkTransactionIndexed, ProveXError, isUserRejectionError, getUserFriendlyErrorMessage, useOrchestratorAddress, checkMutation } from './chunk-B3N7BGJD.js';
2
- export { BrowsePhase, CommittedPhase, CompletePhase, ProveXClient, ProveXError, ProvexBuy, ProvexBuyProvider, ProvexProvider, ProvingPhase, createApiClient, createProveXClient, getRate, getTierDisplayInfo, intentStatuses, useDeposits, useNullifierRegistry, useOptionalProvexPublicClient, useOptionalProvexWallet, useOrchestratorAddress, usePayeeDetails, useProtocolFeePercentage, useProtocolFees, useProveXClient, useProvex, useProvexBuy, useProvexBuyContext, useProvexPublicClient, useProvexWallet, useReputation, useReputationLimits, useSignalIntent } from './chunk-B3N7BGJD.js';
1
+ import { useUserReputation, useOptionalProvexPublicClient, useOptionalProvexWallet, useContractRead, getTransactionGasInputs, useOptionalProvex, createProveXClient, checkTransactionIndexed, ProveXError, isUserRejectionError, getUserFriendlyErrorMessage, useOrchestratorAddress, checkMutation } from './chunk-RVG3ZJZK.js';
2
+ export { BrowsePhase, CommittedPhase, CompletePhase, DEFAULT_SIGNAL_INTENT_MESSAGES, ProveXClient, ProveXError, ProvexBuy, ProvexBuyProvider, ProvexProvider, ProvingPhase, checkMutation, checkTransactionIndexed, computeUserReputation, createApiClient, createProveXClient, filteringTierFor, getRate, getTierDisplayInfo, intentStatuses, systemClock, useClock, useDeposits, useIndexerReputationSource, useNullifierRegistry, useOptionalProvexPublicClient, useOptionalProvexWallet, useOrchestratorAddress, usePayeeDetails, useProtocolFeePercentage, useProtocolFees, useProveXClient, useProvex, useProvexBuy, useProvexBuyContext, useProvexPublicClient, useProvexWallet, useProvingFlow, useReputationLimits, useSignalIntent, useUserReputation } from './chunk-RVG3ZJZK.js';
3
3
  import { useMemo, useState, useCallback } from 'react';
4
4
  import { maxUint256, erc20Abi, encodeFunctionData } from 'viem';
5
5
  import { V2EscrowAbi, V3EscrowAbi } from '@provex/abis';
6
6
  import { getEscrowVersion, getLatestContract, supportsOrchestrator, getLatestConfiguredVersion } from '@provex/utils/contracts';
7
7
  import { orderId } from '@provex/utils/ids';
8
8
 
9
+ // src/hooks/useReputation.ts
10
+ function useReputation({
11
+ address,
12
+ chainId
13
+ }) {
14
+ const { reputation, isLoading, error, refetch } = useUserReputation({ address, chainId });
15
+ return { reputation, isLoading, error, refetch };
16
+ }
9
17
  var useAllowance = ({
10
18
  token,
11
19
  spender,
@@ -543,6 +551,6 @@ var useTransactionWithIndexer = (options = {}) => {
543
551
  };
544
552
  };
545
553
 
546
- export { useAllowance, useCancelIntent, useReleaseFundsToPayer, useTransactionWithIndexer, useV3Escrow };
554
+ export { useAllowance, useCancelIntent, useReleaseFundsToPayer, useReputation, useTransactionWithIndexer, useV3Escrow };
547
555
  //# sourceMappingURL=index.js.map
548
556
  //# sourceMappingURL=index.js.map