@provex/react 1.9.2-rc.20260725134754.714d99f → 1.9.2-rc.20260725154152.dfd6bd9
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/{chunk-UL3B2WE2.js → chunk-LBZZ7TJT.js} +71 -23
- package/dist/chunk-LBZZ7TJT.js.map +1 -0
- package/dist/index.cjs +67 -19
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +37 -2
- package/dist/index.d.ts +37 -2
- package/dist/index.js +2 -2
- package/dist/wagmi.cjs +67 -19
- package/dist/wagmi.cjs.map +1 -1
- package/dist/wagmi.js +1 -1
- package/package.json +5 -5
- package/dist/chunk-UL3B2WE2.js.map +0 -1
|
@@ -6,10 +6,11 @@ import { SUPPORTED_CURRENCIES, tickerToContractId } from '@provex/utils/currenci
|
|
|
6
6
|
import { parseUnits, formatUnits } from '@provex/utils/units';
|
|
7
7
|
import { providerKeyToContractId, providerConfigs, computePayeeDetailsHash, resolveRailProviderKey, tiers, verifiablePaymentMethods, getPlatformRisk, verifierGetsKey, resolveApiProviderKey, getPaymentMethodName } from '@provex/utils/payment';
|
|
8
8
|
import { convertCurrencyToTokenOutput } from '@provex/utils/conversionRates';
|
|
9
|
-
import { getLatestContract,
|
|
9
|
+
import { getLatestContract, getEscrowVersion, getConfiguredOrchestratorForEscrow, reclaimSigners, getPaymentAttestationVerifier } from '@provex/utils/contracts';
|
|
10
10
|
import { encodeV3PaymentProof } from '@provex/utils';
|
|
11
|
+
import { toEscrowCurrencies } from '@provex/utils/deposit';
|
|
11
12
|
import { normalizeFeePrecision } from '@provex/utils/fees';
|
|
12
|
-
import {
|
|
13
|
+
import { OrchestratorAbi, escrowAbiByVersion, V3EscrowAbi, PaymentVerifierRegistryAbi, UnifiedPaymentVerifierAbi, NullifierRegistryAbi, V4OrchestratorAbi } from '@provex/abis';
|
|
13
14
|
import { publicClient, getDefaultToken } from '@provex/utils/tokens';
|
|
14
15
|
import { chainIdToChain } from '@provex/utils/chain';
|
|
15
16
|
import { base } from 'viem/chains';
|
|
@@ -379,82 +380,85 @@ var ProveXClient = class {
|
|
|
379
380
|
this.onSlowSync = config.onSlowSync;
|
|
380
381
|
this.apiUrl = config.apiUrl ?? defaults?.apiUrl ?? "https://app.provex.com";
|
|
381
382
|
this.createDepositRaw = this.buildWritableMethod({
|
|
382
|
-
abi:
|
|
383
|
+
abi: () => this.getEscrowAbi(),
|
|
383
384
|
contractResolver: () => this.getEscrowAddress(),
|
|
384
385
|
functionName: "createDeposit",
|
|
385
|
-
argsMapper: (params) => [
|
|
386
|
+
argsMapper: (params) => [{
|
|
387
|
+
...params,
|
|
388
|
+
currencies: params.currencies.map((perMethod) => toEscrowCurrencies(perMethod, this.getEscrowGeneration()))
|
|
389
|
+
}]
|
|
386
390
|
});
|
|
387
391
|
this.addFunds = this.buildWritableMethod({
|
|
388
|
-
abi:
|
|
392
|
+
abi: () => this.getEscrowAbi(),
|
|
389
393
|
contractResolver: () => this.getEscrowAddress(),
|
|
390
394
|
functionName: "addFunds",
|
|
391
395
|
argsMapper: (params) => [params.depositId, params.amount]
|
|
392
396
|
});
|
|
393
397
|
this.removeFunds = this.buildWritableMethod({
|
|
394
|
-
abi:
|
|
398
|
+
abi: () => this.getEscrowAbi(),
|
|
395
399
|
contractResolver: () => this.getEscrowAddress(),
|
|
396
400
|
functionName: "removeFunds",
|
|
397
401
|
argsMapper: (params) => [params.depositId, params.amount]
|
|
398
402
|
});
|
|
399
403
|
this.withdrawDeposit = this.buildWritableMethod({
|
|
400
|
-
abi:
|
|
404
|
+
abi: () => this.getEscrowAbi(),
|
|
401
405
|
contractResolver: () => this.getEscrowAddress(),
|
|
402
406
|
functionName: "withdrawDeposit",
|
|
403
407
|
argsMapper: (params) => [params.depositId]
|
|
404
408
|
});
|
|
405
409
|
this.pruneExpiredIntents = this.buildWritableMethod({
|
|
406
|
-
abi:
|
|
410
|
+
abi: () => this.getEscrowAbi(),
|
|
407
411
|
contractResolver: () => this.getEscrowAddress(),
|
|
408
412
|
functionName: "pruneExpiredIntents",
|
|
409
413
|
argsMapper: (params) => [params.depositId]
|
|
410
414
|
});
|
|
411
415
|
this.setAcceptingIntents = this.buildWritableMethod({
|
|
412
|
-
abi:
|
|
416
|
+
abi: () => this.getEscrowAbi(),
|
|
413
417
|
contractResolver: () => this.getEscrowAddress(),
|
|
414
418
|
functionName: "setAcceptingIntents",
|
|
415
419
|
argsMapper: (params) => [params.depositId, params.accepting]
|
|
416
420
|
});
|
|
417
421
|
this.setRetainOnEmpty = this.buildWritableMethod({
|
|
418
|
-
abi:
|
|
422
|
+
abi: () => this.getEscrowAbi(),
|
|
419
423
|
contractResolver: () => this.getEscrowAddress(),
|
|
420
424
|
functionName: "setRetainOnEmpty",
|
|
421
425
|
argsMapper: (params) => [params.depositId, params.retain]
|
|
422
426
|
});
|
|
423
427
|
this.setIntentRange = this.buildWritableMethod({
|
|
424
|
-
abi:
|
|
428
|
+
abi: () => this.getEscrowAbi(),
|
|
425
429
|
contractResolver: () => this.getEscrowAddress(),
|
|
426
430
|
functionName: "setIntentRange",
|
|
427
431
|
argsMapper: (params) => [params.depositId, { min: params.min, max: params.max }]
|
|
428
432
|
});
|
|
429
433
|
this.setPaymentMethodActive = this.buildWritableMethod({
|
|
430
|
-
abi:
|
|
434
|
+
abi: () => this.getEscrowAbi(),
|
|
431
435
|
contractResolver: () => this.getEscrowAddress(),
|
|
432
436
|
functionName: "setPaymentMethodActive",
|
|
433
437
|
argsMapper: (params) => [params.depositId, params.paymentMethod, params.active]
|
|
434
438
|
});
|
|
435
439
|
this.setCurrencyMinRate = this.buildWritableMethod({
|
|
436
|
-
abi:
|
|
440
|
+
abi: () => this.getEscrowAbi(),
|
|
437
441
|
contractResolver: () => this.getEscrowAddress(),
|
|
438
442
|
functionName: "setCurrencyMinRate",
|
|
439
443
|
argsMapper: (params) => [params.depositId, params.paymentMethod, params.currency, params.rate]
|
|
440
444
|
});
|
|
441
445
|
this.addCurrencies = this.buildWritableMethod({
|
|
442
|
-
abi:
|
|
446
|
+
abi: () => this.getEscrowAbi(),
|
|
443
447
|
contractResolver: () => this.getEscrowAddress(),
|
|
444
448
|
functionName: "addCurrencies",
|
|
445
|
-
argsMapper: (params) => [params.depositId, params.paymentMethod, params.currencies]
|
|
449
|
+
argsMapper: (params) => [params.depositId, params.paymentMethod, toEscrowCurrencies(params.currencies, this.getEscrowGeneration())]
|
|
446
450
|
});
|
|
447
451
|
this.deactivateCurrency = this.buildWritableMethod({
|
|
448
|
-
abi:
|
|
452
|
+
abi: () => this.getEscrowAbi(),
|
|
449
453
|
contractResolver: () => this.getEscrowAddress(),
|
|
450
454
|
functionName: "deactivateCurrency",
|
|
451
455
|
argsMapper: (params) => [params.depositId, params.paymentMethod, params.currencyCode]
|
|
452
456
|
});
|
|
453
457
|
this.addPaymentMethods = this.buildWritableMethod({
|
|
454
|
-
abi:
|
|
458
|
+
abi: () => this.getEscrowAbi(),
|
|
455
459
|
contractResolver: () => this.getEscrowAddress(),
|
|
456
460
|
functionName: "addPaymentMethods",
|
|
457
|
-
argsMapper: (params) => [params.depositId, params.paymentMethods, params.paymentMethodData, params.currencies]
|
|
461
|
+
argsMapper: (params) => [params.depositId, params.paymentMethods, params.paymentMethodData, params.currencies.map((perMethod) => toEscrowCurrencies(perMethod, this.getEscrowGeneration()))]
|
|
458
462
|
});
|
|
459
463
|
this.cancelIntent = this.buildWritableMethod({
|
|
460
464
|
abi: OrchestratorAbi,
|
|
@@ -489,17 +493,61 @@ var ProveXClient = class {
|
|
|
489
493
|
});
|
|
490
494
|
}
|
|
491
495
|
// ─── Address Resolution ──────────────────────────────────────────────────
|
|
492
|
-
/**
|
|
496
|
+
/**
|
|
497
|
+
* The escrow this client acts on.
|
|
498
|
+
*
|
|
499
|
+
* Callers that touch a specific deposit MUST construct the client with
|
|
500
|
+
* `escrowAddress: deposit.escrow` — the v3 fallback below is only correct
|
|
501
|
+
* for a client that has no deposit in hand, and silently sends every write
|
|
502
|
+
* to the previous generation otherwise.
|
|
503
|
+
*/
|
|
493
504
|
getEscrowAddress() {
|
|
494
505
|
if (this.escrowOverride) return this.escrowOverride;
|
|
495
506
|
const addr = getLatestContract(this.chainId, "escrow", "v3");
|
|
496
507
|
if (!addr) throw new ProveXError("VALIDATION_ERROR", `No V3 escrow found for chain ${this.chainId}`);
|
|
497
508
|
return addr;
|
|
498
509
|
}
|
|
499
|
-
/**
|
|
510
|
+
/**
|
|
511
|
+
* The escrow's generation, used to pick the matching interface.
|
|
512
|
+
*
|
|
513
|
+
* An unrecognised address is not an error: callers may point the client at a
|
|
514
|
+
* fork or a local deployment through `escrowAddress`. Those fall back to v3,
|
|
515
|
+
* which is what this client assumed for every escrow before generations were
|
|
516
|
+
* resolved at all — so an override that worked before still works.
|
|
517
|
+
*/
|
|
518
|
+
getEscrowGeneration() {
|
|
519
|
+
return getEscrowVersion(this.getEscrowAddress(), this.chainId) ?? "v3";
|
|
520
|
+
}
|
|
521
|
+
/**
|
|
522
|
+
* The escrow interface matching this client's escrow generation.
|
|
523
|
+
*
|
|
524
|
+
* EscrowV2 is not signature-compatible with the v3 escrow for every maker
|
|
525
|
+
* write — `createDeposit`, `addPaymentMethods` and `addCurrencies` each gain
|
|
526
|
+
* an oracle rate config in their currency tuple, which changes the selector.
|
|
527
|
+
* Binding one generation's interface to whatever address we resolved
|
|
528
|
+
* produces a call the contract cannot decode, and since these writes are not
|
|
529
|
+
* simulated the maker signs and pays gas for a certain revert.
|
|
530
|
+
*/
|
|
531
|
+
getEscrowAbi() {
|
|
532
|
+
return escrowAbiByVersion[this.getEscrowGeneration()];
|
|
533
|
+
}
|
|
534
|
+
/**
|
|
535
|
+
* Get the orchestrator address (cached after first read).
|
|
536
|
+
*
|
|
537
|
+
* Generation decides where this comes from. v2 and v3 escrows expose
|
|
538
|
+
* `orchestrator()`; EscrowV2 authorizes through an `OrchestratorRegistry`
|
|
539
|
+
* and exposes no such function, so reading it reverts and the address has to
|
|
540
|
+
* come from configuration. Probing on-chain first would therefore break
|
|
541
|
+
* every v4 flow before the wallet ever opens.
|
|
542
|
+
*/
|
|
500
543
|
async getOrchestratorAddress() {
|
|
501
544
|
if (this.cachedOrchestratorAddress) return this.cachedOrchestratorAddress;
|
|
502
545
|
const escrow = this.getEscrowAddress();
|
|
546
|
+
const configured = getConfiguredOrchestratorForEscrow(escrow);
|
|
547
|
+
if (configured) {
|
|
548
|
+
this.cachedOrchestratorAddress = configured;
|
|
549
|
+
return configured;
|
|
550
|
+
}
|
|
503
551
|
const result = await this.readContract({
|
|
504
552
|
address: escrow,
|
|
505
553
|
abi: V3EscrowAbi,
|
|
@@ -988,7 +1036,7 @@ var ProveXClient = class {
|
|
|
988
1036
|
const to = await contractResolver(params);
|
|
989
1037
|
const args = argsMapper(params);
|
|
990
1038
|
const data = encodeFunctionData({
|
|
991
|
-
abi,
|
|
1039
|
+
abi: typeof abi === "function" ? abi() : abi,
|
|
992
1040
|
functionName,
|
|
993
1041
|
args
|
|
994
1042
|
});
|
|
@@ -2491,5 +2539,5 @@ function ProvexBuyRoot({
|
|
|
2491
2539
|
}
|
|
2492
2540
|
|
|
2493
2541
|
export { BrowsePhase, CommittedPhase, CompletePhase, ProveXClient, ProveXError, ProvexBuy, ProvexBuyProvider, ProvexProvider, ProvingPhase, checkMutation, checkTransactionIndexed, createApiClient, createProveXClient, getRate, getTierDisplayInfo, getTransactionGasInputs, getUserFriendlyErrorMessage, intentStatuses, isUserRejectionError, useContractRead, useDeposits, useNullifierRegistry, useOptionalProvex, useOptionalProvexPublicClient, useOptionalProvexWallet, useOrchestratorAddress, usePayeeDetails, useProtocolFeePercentage, useProtocolFees, useProveXClient, useProvex, useProvexBuy, useProvexBuyContext, useProvexPublicClient, useProvexWallet, useReputation, useReputationLimits, useSignalIntent };
|
|
2494
|
-
//# sourceMappingURL=chunk-
|
|
2495
|
-
//# sourceMappingURL=chunk-
|
|
2542
|
+
//# sourceMappingURL=chunk-LBZZ7TJT.js.map
|
|
2543
|
+
//# sourceMappingURL=chunk-LBZZ7TJT.js.map
|