@zkp2p/sdk 0.12.1 → 0.12.2-rc.1
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 +96 -24
- package/dist/build-metadata.json +22 -0
- package/dist/{chunk-GHQK65J2.mjs → chunk-3J4FPMPW.mjs} +2 -2
- package/dist/{chunk-GHQK65J2.mjs.map → chunk-3J4FPMPW.mjs.map} +1 -1
- package/dist/chunk-NCX4BO7G.mjs +12 -0
- package/dist/chunk-NCX4BO7G.mjs.map +1 -0
- package/dist/{chunk-DZQOCRT4.mjs → chunk-QVEW2DTE.mjs} +373 -373
- package/dist/{chunk-DZQOCRT4.mjs.map → chunk-QVEW2DTE.mjs.map} +1 -1
- package/dist/{chunk-FCOH36IX.mjs → chunk-YA67SM3A.mjs} +2 -2
- package/dist/{chunk-FCOH36IX.mjs.map → chunk-YA67SM3A.mjs.map} +1 -1
- package/dist/{chunk-ZFBH4HD7.mjs → chunk-ZB22BZLZ.mjs} +2 -2
- package/dist/{chunk-ZFBH4HD7.mjs.map → chunk-ZB22BZLZ.mjs.map} +1 -1
- package/dist/{currency-MARF3D2J.mjs → currency-XA62DCJH.mjs} +4 -4
- package/dist/{currency-MARF3D2J.mjs.map → currency-XA62DCJH.mjs.map} +1 -1
- package/dist/index.cjs +2263 -561
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +34 -9
- package/dist/index.d.ts +34 -9
- package/dist/index.mjs +1638 -105
- package/dist/index.mjs.map +1 -1
- package/dist/protocolViewerParsers-KB2FTOE6.mjs +5 -0
- package/dist/{protocolViewerParsers-WK2QPJH7.mjs.map → protocolViewerParsers-KB2FTOE6.mjs.map} +1 -1
- package/dist/react.cjs +41 -0
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.mts +15 -3
- package/dist/react.d.ts +15 -3
- package/dist/react.mjs +44 -4
- package/dist/react.mjs.map +1 -1
- package/dist/{timeout-YLP3WHZF.mjs → timeout-7UJ6HZ4K.mjs} +4 -4
- package/dist/{timeout-YLP3WHZF.mjs.map → timeout-7UJ6HZ4K.mjs.map} +1 -1
- package/dist/{vaultUtils-Bc9KwywX.d.mts → vaultUtils-Dla_eG15.d.mts} +206 -43
- package/dist/{vaultUtils-Bc9KwywX.d.ts → vaultUtils-Dla_eG15.d.ts} +206 -43
- package/package.json +23 -22
- package/dist/chunk-J5LGTIGS.mjs +0 -9
- package/dist/chunk-J5LGTIGS.mjs.map +0 -1
- package/dist/protocolViewerParsers-WK2QPJH7.mjs +0 -5
package/dist/react.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Z as Zkp2pClient, P as PostDepositDetailsRequest, a1 as SignalIntentMethodParams,
|
|
2
|
-
export {
|
|
1
|
+
import { Z as Zkp2pClient, P as PostDepositDetailsRequest, a1 as SignalIntentMethodParams, bO as PreparedTransaction, a2 as FulfillIntentMethodParams, dw as SendTransactionFn, dx as SendBatchFn, du as DelegationDepositTarget, dv as BatchResult, af as IntentGuardianErrorCode, ab as IntentGuardianPolicy, ac as IntentGuardianQuote } from './vaultUtils-Dla_eG15.mjs';
|
|
2
|
+
export { ds as DelegationRoute, dt as DelegationState, dM as VAULT_ZERO_ADDRESS, dl as ZERO_RATE_MANAGER_ID, dN as asErrorMessage, dO as assertDelegationMethodSupport, dr as classifyDelegationState, dq as getDelegationRoute, dm as isZeroRateManagerId, dn as normalizeRateManagerId, dp as normalizeRegistry } from './vaultUtils-Dla_eG15.mjs';
|
|
3
3
|
import { Hash, Address, Hex } from 'viem';
|
|
4
4
|
import '@zkp2p/indexer-schema';
|
|
5
5
|
import 'abitype';
|
|
@@ -195,6 +195,18 @@ declare function useSetRetainOnEmpty({ client, onSuccess, onError }: UseSetRetai
|
|
|
195
195
|
txHash: `0x${string}` | null;
|
|
196
196
|
};
|
|
197
197
|
|
|
198
|
+
interface UseSetDisputeProtectionEnabledOptions {
|
|
199
|
+
client: Zkp2pClient | null;
|
|
200
|
+
onSuccess?: (hash: Hash) => void;
|
|
201
|
+
onError?: (error: Error) => void;
|
|
202
|
+
}
|
|
203
|
+
declare function useSetDisputeProtectionEnabled({ client, onSuccess, onError, }: UseSetDisputeProtectionEnabledOptions): {
|
|
204
|
+
setDisputeProtectionEnabled: (params: Parameters<Zkp2pClient["setDisputeProtectionEnabled"]>[0]) => Promise<`0x${string}` | null>;
|
|
205
|
+
isLoading: boolean;
|
|
206
|
+
error: Error | null;
|
|
207
|
+
txHash: `0x${string}` | null;
|
|
208
|
+
};
|
|
209
|
+
|
|
198
210
|
interface UseSetDelegateOptions {
|
|
199
211
|
client: Zkp2pClient | null;
|
|
200
212
|
onSuccess?: (hash: Hash) => void;
|
|
@@ -441,4 +453,4 @@ declare function usePruneExpiredIntents({ client, onSuccess, onError }: UsePrune
|
|
|
441
453
|
txHash: `0x${string}` | null;
|
|
442
454
|
};
|
|
443
455
|
|
|
444
|
-
export { BatchResult, type CreateVaultParams, DelegationDepositTarget, PreparedTransaction, SendBatchFn, SendTransactionFn, type UseAddCurrenciesOptions, type UseAddFundsOptions, type UseAddPaymentMethodsOptions, type UseCreateDepositOptions, type UseCreateVaultOptions, type UseDeactivateCurrencyOptions, type UseExtendIntentLifetimeOptions, type UseFulfillIntentOptions, type UsePruneExpiredIntentsOptions, type UseReleaseFundsToPayerOptions, type UseRemoveCurrencyOptions, type UseRemoveDelegateOptions, type UseRemoveFundsOptions, type UseRemovePaymentMethodOptions, type UseSetAcceptingIntentsOptions, type UseSetCurrencyMinRateOptions, type UseSetDelegateOptions, type UseSetIntentRangeOptions, type UseSetPaymentMethodActiveOptions, type UseSetRetainOnEmptyOptions, type UseSetVaultConfigOptions, type UseSetVaultFeeOptions, type UseSetVaultMinRateOptions, type UseSignalIntentOptions, type UseVaultDelegationOptions, type UseWithdrawDepositOptions, useAddCurrencies, useAddFunds, useAddPaymentMethods, useCreateDeposit, useCreateVault, useDeactivateCurrency, useExtendIntentLifetime, useFulfillIntent, usePruneExpiredIntents, useReleaseFundsToPayer, useRemoveCurrency, useRemoveDelegate, useRemoveFunds, useRemovePaymentMethod, useSetAcceptingIntents, useSetCurrencyMinRate, useSetDelegate, useSetIntentRange, useSetPaymentMethodActive, useSetRetainOnEmpty, useSetVaultConfig, useSetVaultFee, useSetVaultMinRate, useSignalIntent, useVaultDelegation, useWithdrawDeposit };
|
|
456
|
+
export { BatchResult, type CreateVaultParams, DelegationDepositTarget, PreparedTransaction, SendBatchFn, SendTransactionFn, type UseAddCurrenciesOptions, type UseAddFundsOptions, type UseAddPaymentMethodsOptions, type UseCreateDepositOptions, type UseCreateVaultOptions, type UseDeactivateCurrencyOptions, type UseExtendIntentLifetimeOptions, type UseFulfillIntentOptions, type UsePruneExpiredIntentsOptions, type UseReleaseFundsToPayerOptions, type UseRemoveCurrencyOptions, type UseRemoveDelegateOptions, type UseRemoveFundsOptions, type UseRemovePaymentMethodOptions, type UseSetAcceptingIntentsOptions, type UseSetCurrencyMinRateOptions, type UseSetDelegateOptions, type UseSetDisputeProtectionEnabledOptions, type UseSetIntentRangeOptions, type UseSetPaymentMethodActiveOptions, type UseSetRetainOnEmptyOptions, type UseSetVaultConfigOptions, type UseSetVaultFeeOptions, type UseSetVaultMinRateOptions, type UseSignalIntentOptions, type UseVaultDelegationOptions, type UseWithdrawDepositOptions, useAddCurrencies, useAddFunds, useAddPaymentMethods, useCreateDeposit, useCreateVault, useDeactivateCurrency, useExtendIntentLifetime, useFulfillIntent, usePruneExpiredIntents, useReleaseFundsToPayer, useRemoveCurrency, useRemoveDelegate, useRemoveFunds, useRemovePaymentMethod, useSetAcceptingIntents, useSetCurrencyMinRate, useSetDelegate, useSetDisputeProtectionEnabled, useSetIntentRange, useSetPaymentMethodActive, useSetRetainOnEmpty, useSetVaultConfig, useSetVaultFee, useSetVaultMinRate, useSignalIntent, useVaultDelegation, useWithdrawDeposit };
|
package/dist/react.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Z as Zkp2pClient, P as PostDepositDetailsRequest, a1 as SignalIntentMethodParams,
|
|
2
|
-
export {
|
|
1
|
+
import { Z as Zkp2pClient, P as PostDepositDetailsRequest, a1 as SignalIntentMethodParams, bO as PreparedTransaction, a2 as FulfillIntentMethodParams, dw as SendTransactionFn, dx as SendBatchFn, du as DelegationDepositTarget, dv as BatchResult, af as IntentGuardianErrorCode, ab as IntentGuardianPolicy, ac as IntentGuardianQuote } from './vaultUtils-Dla_eG15.js';
|
|
2
|
+
export { ds as DelegationRoute, dt as DelegationState, dM as VAULT_ZERO_ADDRESS, dl as ZERO_RATE_MANAGER_ID, dN as asErrorMessage, dO as assertDelegationMethodSupport, dr as classifyDelegationState, dq as getDelegationRoute, dm as isZeroRateManagerId, dn as normalizeRateManagerId, dp as normalizeRegistry } from './vaultUtils-Dla_eG15.js';
|
|
3
3
|
import { Hash, Address, Hex } from 'viem';
|
|
4
4
|
import '@zkp2p/indexer-schema';
|
|
5
5
|
import 'abitype';
|
|
@@ -195,6 +195,18 @@ declare function useSetRetainOnEmpty({ client, onSuccess, onError }: UseSetRetai
|
|
|
195
195
|
txHash: `0x${string}` | null;
|
|
196
196
|
};
|
|
197
197
|
|
|
198
|
+
interface UseSetDisputeProtectionEnabledOptions {
|
|
199
|
+
client: Zkp2pClient | null;
|
|
200
|
+
onSuccess?: (hash: Hash) => void;
|
|
201
|
+
onError?: (error: Error) => void;
|
|
202
|
+
}
|
|
203
|
+
declare function useSetDisputeProtectionEnabled({ client, onSuccess, onError, }: UseSetDisputeProtectionEnabledOptions): {
|
|
204
|
+
setDisputeProtectionEnabled: (params: Parameters<Zkp2pClient["setDisputeProtectionEnabled"]>[0]) => Promise<`0x${string}` | null>;
|
|
205
|
+
isLoading: boolean;
|
|
206
|
+
error: Error | null;
|
|
207
|
+
txHash: `0x${string}` | null;
|
|
208
|
+
};
|
|
209
|
+
|
|
198
210
|
interface UseSetDelegateOptions {
|
|
199
211
|
client: Zkp2pClient | null;
|
|
200
212
|
onSuccess?: (hash: Hash) => void;
|
|
@@ -441,4 +453,4 @@ declare function usePruneExpiredIntents({ client, onSuccess, onError }: UsePrune
|
|
|
441
453
|
txHash: `0x${string}` | null;
|
|
442
454
|
};
|
|
443
455
|
|
|
444
|
-
export { BatchResult, type CreateVaultParams, DelegationDepositTarget, PreparedTransaction, SendBatchFn, SendTransactionFn, type UseAddCurrenciesOptions, type UseAddFundsOptions, type UseAddPaymentMethodsOptions, type UseCreateDepositOptions, type UseCreateVaultOptions, type UseDeactivateCurrencyOptions, type UseExtendIntentLifetimeOptions, type UseFulfillIntentOptions, type UsePruneExpiredIntentsOptions, type UseReleaseFundsToPayerOptions, type UseRemoveCurrencyOptions, type UseRemoveDelegateOptions, type UseRemoveFundsOptions, type UseRemovePaymentMethodOptions, type UseSetAcceptingIntentsOptions, type UseSetCurrencyMinRateOptions, type UseSetDelegateOptions, type UseSetIntentRangeOptions, type UseSetPaymentMethodActiveOptions, type UseSetRetainOnEmptyOptions, type UseSetVaultConfigOptions, type UseSetVaultFeeOptions, type UseSetVaultMinRateOptions, type UseSignalIntentOptions, type UseVaultDelegationOptions, type UseWithdrawDepositOptions, useAddCurrencies, useAddFunds, useAddPaymentMethods, useCreateDeposit, useCreateVault, useDeactivateCurrency, useExtendIntentLifetime, useFulfillIntent, usePruneExpiredIntents, useReleaseFundsToPayer, useRemoveCurrency, useRemoveDelegate, useRemoveFunds, useRemovePaymentMethod, useSetAcceptingIntents, useSetCurrencyMinRate, useSetDelegate, useSetIntentRange, useSetPaymentMethodActive, useSetRetainOnEmpty, useSetVaultConfig, useSetVaultFee, useSetVaultMinRate, useSignalIntent, useVaultDelegation, useWithdrawDeposit };
|
|
456
|
+
export { BatchResult, type CreateVaultParams, DelegationDepositTarget, PreparedTransaction, SendBatchFn, SendTransactionFn, type UseAddCurrenciesOptions, type UseAddFundsOptions, type UseAddPaymentMethodsOptions, type UseCreateDepositOptions, type UseCreateVaultOptions, type UseDeactivateCurrencyOptions, type UseExtendIntentLifetimeOptions, type UseFulfillIntentOptions, type UsePruneExpiredIntentsOptions, type UseReleaseFundsToPayerOptions, type UseRemoveCurrencyOptions, type UseRemoveDelegateOptions, type UseRemoveFundsOptions, type UseRemovePaymentMethodOptions, type UseSetAcceptingIntentsOptions, type UseSetCurrencyMinRateOptions, type UseSetDelegateOptions, type UseSetDisputeProtectionEnabledOptions, type UseSetIntentRangeOptions, type UseSetPaymentMethodActiveOptions, type UseSetRetainOnEmptyOptions, type UseSetVaultConfigOptions, type UseSetVaultFeeOptions, type UseSetVaultMinRateOptions, type UseSignalIntentOptions, type UseVaultDelegationOptions, type UseWithdrawDepositOptions, useAddCurrencies, useAddFunds, useAddPaymentMethods, useCreateDeposit, useCreateVault, useDeactivateCurrency, useExtendIntentLifetime, useFulfillIntent, usePruneExpiredIntents, useReleaseFundsToPayer, useRemoveCurrency, useRemoveDelegate, useRemoveFunds, useRemovePaymentMethod, useSetAcceptingIntents, useSetCurrencyMinRate, useSetDelegate, useSetDisputeProtectionEnabled, useSetIntentRange, useSetPaymentMethodActive, useSetRetainOnEmpty, useSetVaultConfig, useSetVaultFee, useSetVaultMinRate, useSignalIntent, useVaultDelegation, useWithdrawDeposit };
|
package/dist/react.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { asErrorMessage, ZERO_ADDRESS, getDelegationRoute, assertDelegationMethodSupport, prepareClearDelegationTx, normalizeRateManagerId, normalizeRegistry, isZeroRateManagerId, assertAtomicDelegationSwitchSupport, prepareSetDelegationTx, classifyIntentGuardianError } from './chunk-
|
|
2
|
-
export { ZERO_ADDRESS as VAULT_ZERO_ADDRESS, ZERO_RATE_MANAGER_ID, asErrorMessage, assertDelegationMethodSupport, classifyDelegationState, getDelegationRoute, isZeroRateManagerId, normalizeRateManagerId, normalizeRegistry } from './chunk-
|
|
3
|
-
import './chunk-
|
|
1
|
+
import { asErrorMessage, ZERO_ADDRESS, getDelegationRoute, assertDelegationMethodSupport, prepareClearDelegationTx, normalizeRateManagerId, normalizeRegistry, isZeroRateManagerId, assertAtomicDelegationSwitchSupport, prepareSetDelegationTx, classifyIntentGuardianError } from './chunk-YA67SM3A.mjs';
|
|
2
|
+
export { ZERO_ADDRESS as VAULT_ZERO_ADDRESS, ZERO_RATE_MANAGER_ID, asErrorMessage, assertDelegationMethodSupport, classifyDelegationState, getDelegationRoute, isZeroRateManagerId, normalizeRateManagerId, normalizeRegistry } from './chunk-YA67SM3A.mjs';
|
|
3
|
+
import './chunk-NCX4BO7G.mjs';
|
|
4
4
|
import { useState, useCallback, useMemo } from 'react';
|
|
5
5
|
|
|
6
6
|
function useCreateDeposit({ client, onSuccess, onError }) {
|
|
@@ -432,6 +432,46 @@ function useSetRetainOnEmpty({ client, onSuccess, onError }) {
|
|
|
432
432
|
);
|
|
433
433
|
return useMemo(() => ({ setRetainOnEmpty, isLoading, error, txHash }), [setRetainOnEmpty, isLoading, error, txHash]);
|
|
434
434
|
}
|
|
435
|
+
function useSetDisputeProtectionEnabled({
|
|
436
|
+
client,
|
|
437
|
+
onSuccess,
|
|
438
|
+
onError
|
|
439
|
+
}) {
|
|
440
|
+
const [isLoading, setIsLoading] = useState(false);
|
|
441
|
+
const [error, setError] = useState(null);
|
|
442
|
+
const [txHash, setTxHash] = useState(null);
|
|
443
|
+
const setDisputeProtectionEnabled = useCallback(
|
|
444
|
+
async (params) => {
|
|
445
|
+
if (!client) {
|
|
446
|
+
const nextError = new Error("Zkp2pClient is not initialized");
|
|
447
|
+
setError(nextError);
|
|
448
|
+
onError?.(nextError);
|
|
449
|
+
return null;
|
|
450
|
+
}
|
|
451
|
+
setIsLoading(true);
|
|
452
|
+
setError(null);
|
|
453
|
+
setTxHash(null);
|
|
454
|
+
try {
|
|
455
|
+
const hash = await client.setDisputeProtectionEnabled(params);
|
|
456
|
+
setTxHash(hash);
|
|
457
|
+
onSuccess?.(hash);
|
|
458
|
+
return hash;
|
|
459
|
+
} catch (caught) {
|
|
460
|
+
const nextError = caught instanceof Error ? caught : new Error(String(caught));
|
|
461
|
+
setError(nextError);
|
|
462
|
+
onError?.(nextError);
|
|
463
|
+
return null;
|
|
464
|
+
} finally {
|
|
465
|
+
setIsLoading(false);
|
|
466
|
+
}
|
|
467
|
+
},
|
|
468
|
+
[client, onError, onSuccess]
|
|
469
|
+
);
|
|
470
|
+
return useMemo(
|
|
471
|
+
() => ({ setDisputeProtectionEnabled, isLoading, error, txHash }),
|
|
472
|
+
[setDisputeProtectionEnabled, isLoading, error, txHash]
|
|
473
|
+
);
|
|
474
|
+
}
|
|
435
475
|
function useSetDelegate({ client, onSuccess, onError }) {
|
|
436
476
|
const [isLoading, setIsLoading] = useState(false);
|
|
437
477
|
const [error, setError] = useState(null);
|
|
@@ -1501,6 +1541,6 @@ function usePruneExpiredIntents({ client, onSuccess, onError }) {
|
|
|
1501
1541
|
return useMemo(() => ({ pruneExpiredIntents, isLoading, error, txHash }), [pruneExpiredIntents, isLoading, error, txHash]);
|
|
1502
1542
|
}
|
|
1503
1543
|
|
|
1504
|
-
export { useAddCurrencies, useAddFunds, useAddPaymentMethods, useCreateDeposit, useCreateVault, useDeactivateCurrency, useExtendIntentLifetime, useFulfillIntent, usePruneExpiredIntents, useReleaseFundsToPayer, useRemoveCurrency, useRemoveDelegate, useRemoveFunds, useRemovePaymentMethod, useSetAcceptingIntents, useSetCurrencyMinRate, useSetDelegate, useSetIntentRange, useSetPaymentMethodActive, useSetRetainOnEmpty, useSetVaultConfig, useSetVaultFee, useSetVaultMinRate, useSignalIntent, useVaultDelegation, useWithdrawDeposit };
|
|
1544
|
+
export { useAddCurrencies, useAddFunds, useAddPaymentMethods, useCreateDeposit, useCreateVault, useDeactivateCurrency, useExtendIntentLifetime, useFulfillIntent, usePruneExpiredIntents, useReleaseFundsToPayer, useRemoveCurrency, useRemoveDelegate, useRemoveFunds, useRemovePaymentMethod, useSetAcceptingIntents, useSetCurrencyMinRate, useSetDelegate, useSetDisputeProtectionEnabled, useSetIntentRange, useSetPaymentMethodActive, useSetRetainOnEmpty, useSetVaultConfig, useSetVaultFee, useSetVaultMinRate, useSignalIntent, useVaultDelegation, useWithdrawDeposit };
|
|
1505
1545
|
//# sourceMappingURL=react.mjs.map
|
|
1506
1546
|
//# sourceMappingURL=react.mjs.map
|