@zkp2p/sdk 0.9.0 → 0.10.0-rc.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/README.md +53 -13
- package/dist/{chunk-FSIRPX4W.mjs → chunk-7M37EVN5.mjs} +33261 -248
- package/dist/chunk-7M37EVN5.mjs.map +1 -0
- package/dist/{chunk-EIOXBVXP.mjs → chunk-LPJE2MN7.mjs} +3 -39
- package/dist/chunk-LPJE2MN7.mjs.map +1 -0
- package/dist/index.cjs +33760 -400
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +59 -60
- package/dist/index.d.ts +59 -60
- package/dist/index.mjs +389 -19
- package/dist/index.mjs.map +1 -1
- package/dist/protocolViewerParsers-VDFKSVGT.mjs +5 -0
- package/dist/{protocolViewerParsers-ER62YZ5L.mjs.map → protocolViewerParsers-VDFKSVGT.mjs.map} +1 -1
- package/dist/react.cjs +82 -93
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.mts +33 -14
- package/dist/react.d.ts +33 -14
- package/dist/react.mjs +84 -67
- package/dist/react.mjs.map +1 -1
- package/dist/{vaultUtils-aJdIIILM.d.mts → vaultUtils-DtkWNsxi.d.mts} +388 -102
- package/dist/{vaultUtils-aJdIIILM.d.ts → vaultUtils-DtkWNsxi.d.ts} +388 -102
- package/package.json +1 -1
- package/dist/chunk-EIOXBVXP.mjs.map +0 -1
- package/dist/chunk-FSIRPX4W.mjs.map +0 -1
- package/dist/protocolViewerParsers-ER62YZ5L.mjs +0 -5
package/dist/react.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Z as Zkp2pClient, P as PostDepositDetailsRequest,
|
|
2
|
-
export {
|
|
1
|
+
import { Z as Zkp2pClient, P as PostDepositDetailsRequest, a2 as SignalIntentMethodParams, bM as PreparedTransaction, bX as TakerStake, E as GetTakerStakeRequest, F as GetTakerStakeResponse, c8 as TakerCapacity, H as GetTakerCapacityRequest, J as GetTakerCapacityResponse, a3 as FulfillIntentMethodParams, dp as SendTransactionFn, dq as SendBatchFn, dm as DelegationDepositTarget, dn as BatchResult } from './vaultUtils-DtkWNsxi.mjs';
|
|
2
|
+
export { dk as DelegationRoute, dl as DelegationState, dr as VAULT_ZERO_ADDRESS, de as ZERO_RATE_MANAGER_ID, ds as asErrorMessage, dt as assertDelegationMethodSupport, dj as classifyDelegationState, di as getDelegationRoute, df as isZeroRateManagerId, dg as normalizeRateManagerId, dh as normalizeRegistry } from './vaultUtils-DtkWNsxi.mjs';
|
|
3
3
|
import { Hash, Address, Hex } from 'viem';
|
|
4
4
|
import '@zkp2p/indexer-schema';
|
|
5
5
|
import 'abitype';
|
|
@@ -60,26 +60,45 @@ declare function useSignalIntent({ client, onSuccess, onError }: UseSignalIntent
|
|
|
60
60
|
prepared: PreparedTransaction | null;
|
|
61
61
|
};
|
|
62
62
|
|
|
63
|
-
interface
|
|
63
|
+
interface UseGetTakerStakeOptions {
|
|
64
64
|
client: Zkp2pClient | null;
|
|
65
65
|
owner?: string | null;
|
|
66
66
|
chainId?: number | null;
|
|
67
67
|
autoFetch?: boolean;
|
|
68
|
-
onSuccess?: (
|
|
68
|
+
onSuccess?: (stake: TakerStake) => void;
|
|
69
69
|
onError?: (error: Error) => void;
|
|
70
70
|
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
71
|
+
/**
|
|
72
|
+
* Fetches the stake portfolio backing a taker: balances, reservation
|
|
73
|
+
* aggregates, delegation, and exit state.
|
|
74
|
+
*/
|
|
75
|
+
declare function useGetTakerStake({ client, owner, chainId, autoFetch, onSuccess, onError, }: UseGetTakerStakeOptions): {
|
|
76
|
+
getTakerStake: (params?: GetTakerStakeRequest) => Promise<GetTakerStakeResponse | null>;
|
|
77
|
+
takerStake: TakerStake | null;
|
|
74
78
|
isLoading: boolean;
|
|
75
79
|
error: Error | null;
|
|
76
80
|
};
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
81
|
+
|
|
82
|
+
interface UseGetTakerCapacityOptions {
|
|
83
|
+
client: Zkp2pClient | null;
|
|
84
|
+
owner?: string | null;
|
|
85
|
+
chainId?: number | null;
|
|
86
|
+
autoFetch?: boolean;
|
|
87
|
+
onSuccess?: (capacity: TakerCapacity) => void;
|
|
88
|
+
onError?: (error: Error) => void;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Fetches per-platform bonded taking capacity, free takes, and operational
|
|
92
|
+
* gates for a taker's shared stake portfolio. Platform capacities are
|
|
93
|
+
* alternative views of one shared balance — never sum them. Capacity can
|
|
94
|
+
* change whenever any authorized relayer uses the shared stake, so refetch
|
|
95
|
+
* immediately before signaling an intent; the contract stays authoritative.
|
|
96
|
+
*/
|
|
97
|
+
declare function useGetTakerCapacity({ client, owner, chainId, autoFetch, onSuccess, onError, }: UseGetTakerCapacityOptions): {
|
|
98
|
+
getTakerCapacity: (params?: GetTakerCapacityRequest) => Promise<GetTakerCapacityResponse | null>;
|
|
99
|
+
takerCapacity: TakerCapacity | null;
|
|
100
|
+
isLoading: boolean;
|
|
101
|
+
error: Error | null;
|
|
83
102
|
};
|
|
84
103
|
|
|
85
104
|
interface UseFulfillIntentOptions {
|
|
@@ -431,4 +450,4 @@ declare function usePruneExpiredIntents({ client, onSuccess, onError }: UsePrune
|
|
|
431
450
|
txHash: `0x${string}` | null;
|
|
432
451
|
};
|
|
433
452
|
|
|
434
|
-
export { BatchResult, type CreateVaultParams, DelegationDepositTarget, PreparedTransaction, SendBatchFn, SendTransactionFn, type UseAddCurrenciesOptions, type UseAddFundsOptions, type UseAddPaymentMethodsOptions, type UseCreateDepositOptions, type UseCreateVaultOptions, type UseDeactivateCurrencyOptions, type UseFulfillIntentOptions, type
|
|
453
|
+
export { BatchResult, type CreateVaultParams, DelegationDepositTarget, PreparedTransaction, SendBatchFn, SendTransactionFn, type UseAddCurrenciesOptions, type UseAddFundsOptions, type UseAddPaymentMethodsOptions, type UseCreateDepositOptions, type UseCreateVaultOptions, type UseDeactivateCurrencyOptions, type UseFulfillIntentOptions, type UseGetTakerCapacityOptions, type UseGetTakerStakeOptions, 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, useFulfillIntent, useGetTakerCapacity, useGetTakerStake, usePruneExpiredIntents, useReleaseFundsToPayer, useRemoveCurrency, useRemoveDelegate, useRemoveFunds, useRemovePaymentMethod, useSetAcceptingIntents, useSetCurrencyMinRate, useSetDelegate, 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,
|
|
2
|
-
export {
|
|
1
|
+
import { Z as Zkp2pClient, P as PostDepositDetailsRequest, a2 as SignalIntentMethodParams, bM as PreparedTransaction, bX as TakerStake, E as GetTakerStakeRequest, F as GetTakerStakeResponse, c8 as TakerCapacity, H as GetTakerCapacityRequest, J as GetTakerCapacityResponse, a3 as FulfillIntentMethodParams, dp as SendTransactionFn, dq as SendBatchFn, dm as DelegationDepositTarget, dn as BatchResult } from './vaultUtils-DtkWNsxi.js';
|
|
2
|
+
export { dk as DelegationRoute, dl as DelegationState, dr as VAULT_ZERO_ADDRESS, de as ZERO_RATE_MANAGER_ID, ds as asErrorMessage, dt as assertDelegationMethodSupport, dj as classifyDelegationState, di as getDelegationRoute, df as isZeroRateManagerId, dg as normalizeRateManagerId, dh as normalizeRegistry } from './vaultUtils-DtkWNsxi.js';
|
|
3
3
|
import { Hash, Address, Hex } from 'viem';
|
|
4
4
|
import '@zkp2p/indexer-schema';
|
|
5
5
|
import 'abitype';
|
|
@@ -60,26 +60,45 @@ declare function useSignalIntent({ client, onSuccess, onError }: UseSignalIntent
|
|
|
60
60
|
prepared: PreparedTransaction | null;
|
|
61
61
|
};
|
|
62
62
|
|
|
63
|
-
interface
|
|
63
|
+
interface UseGetTakerStakeOptions {
|
|
64
64
|
client: Zkp2pClient | null;
|
|
65
65
|
owner?: string | null;
|
|
66
66
|
chainId?: number | null;
|
|
67
67
|
autoFetch?: boolean;
|
|
68
|
-
onSuccess?: (
|
|
68
|
+
onSuccess?: (stake: TakerStake) => void;
|
|
69
69
|
onError?: (error: Error) => void;
|
|
70
70
|
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
71
|
+
/**
|
|
72
|
+
* Fetches the stake portfolio backing a taker: balances, reservation
|
|
73
|
+
* aggregates, delegation, and exit state.
|
|
74
|
+
*/
|
|
75
|
+
declare function useGetTakerStake({ client, owner, chainId, autoFetch, onSuccess, onError, }: UseGetTakerStakeOptions): {
|
|
76
|
+
getTakerStake: (params?: GetTakerStakeRequest) => Promise<GetTakerStakeResponse | null>;
|
|
77
|
+
takerStake: TakerStake | null;
|
|
74
78
|
isLoading: boolean;
|
|
75
79
|
error: Error | null;
|
|
76
80
|
};
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
81
|
+
|
|
82
|
+
interface UseGetTakerCapacityOptions {
|
|
83
|
+
client: Zkp2pClient | null;
|
|
84
|
+
owner?: string | null;
|
|
85
|
+
chainId?: number | null;
|
|
86
|
+
autoFetch?: boolean;
|
|
87
|
+
onSuccess?: (capacity: TakerCapacity) => void;
|
|
88
|
+
onError?: (error: Error) => void;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Fetches per-platform bonded taking capacity, free takes, and operational
|
|
92
|
+
* gates for a taker's shared stake portfolio. Platform capacities are
|
|
93
|
+
* alternative views of one shared balance — never sum them. Capacity can
|
|
94
|
+
* change whenever any authorized relayer uses the shared stake, so refetch
|
|
95
|
+
* immediately before signaling an intent; the contract stays authoritative.
|
|
96
|
+
*/
|
|
97
|
+
declare function useGetTakerCapacity({ client, owner, chainId, autoFetch, onSuccess, onError, }: UseGetTakerCapacityOptions): {
|
|
98
|
+
getTakerCapacity: (params?: GetTakerCapacityRequest) => Promise<GetTakerCapacityResponse | null>;
|
|
99
|
+
takerCapacity: TakerCapacity | null;
|
|
100
|
+
isLoading: boolean;
|
|
101
|
+
error: Error | null;
|
|
83
102
|
};
|
|
84
103
|
|
|
85
104
|
interface UseFulfillIntentOptions {
|
|
@@ -431,4 +450,4 @@ declare function usePruneExpiredIntents({ client, onSuccess, onError }: UsePrune
|
|
|
431
450
|
txHash: `0x${string}` | null;
|
|
432
451
|
};
|
|
433
452
|
|
|
434
|
-
export { BatchResult, type CreateVaultParams, DelegationDepositTarget, PreparedTransaction, SendBatchFn, SendTransactionFn, type UseAddCurrenciesOptions, type UseAddFundsOptions, type UseAddPaymentMethodsOptions, type UseCreateDepositOptions, type UseCreateVaultOptions, type UseDeactivateCurrencyOptions, type UseFulfillIntentOptions, type
|
|
453
|
+
export { BatchResult, type CreateVaultParams, DelegationDepositTarget, PreparedTransaction, SendBatchFn, SendTransactionFn, type UseAddCurrenciesOptions, type UseAddFundsOptions, type UseAddPaymentMethodsOptions, type UseCreateDepositOptions, type UseCreateVaultOptions, type UseDeactivateCurrencyOptions, type UseFulfillIntentOptions, type UseGetTakerCapacityOptions, type UseGetTakerStakeOptions, 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, useFulfillIntent, useGetTakerCapacity, useGetTakerStake, usePruneExpiredIntents, useReleaseFundsToPayer, useRemoveCurrency, useRemoveDelegate, useRemoveFunds, useRemovePaymentMethod, useSetAcceptingIntents, useSetCurrencyMinRate, useSetDelegate, useSetIntentRange, useSetPaymentMethodActive, useSetRetainOnEmpty, useSetVaultConfig, useSetVaultFee, useSetVaultMinRate, useSignalIntent, useVaultDelegation, useWithdrawDeposit };
|
package/dist/react.mjs
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { ZERO_ADDRESS as VAULT_ZERO_ADDRESS, ZERO_RATE_MANAGER_ID, asErrorMessage, assertDelegationMethodSupport, classifyDelegationState, getDelegationRoute, isZeroRateManagerId, normalizeRateManagerId, normalizeRegistry } from './chunk-
|
|
1
|
+
import { asErrorMessage, ZERO_ADDRESS, getDelegationRoute, assertDelegationMethodSupport, prepareClearDelegationTx, normalizeRateManagerId, normalizeRegistry, isZeroRateManagerId, assertAtomicDelegationSwitchSupport, prepareSetDelegationTx } from './chunk-LPJE2MN7.mjs';
|
|
2
|
+
export { ZERO_ADDRESS as VAULT_ZERO_ADDRESS, ZERO_RATE_MANAGER_ID, asErrorMessage, assertDelegationMethodSupport, classifyDelegationState, getDelegationRoute, isZeroRateManagerId, normalizeRateManagerId, normalizeRegistry } from './chunk-LPJE2MN7.mjs';
|
|
3
3
|
import './chunk-J5LGTIGS.mjs';
|
|
4
|
-
import { useState, useCallback, useMemo, useEffect } from 'react';
|
|
5
|
-
import { formatUnits } from 'viem';
|
|
4
|
+
import { useState, useCallback, useMemo, useRef, useEffect } from 'react';
|
|
6
5
|
|
|
7
6
|
function useCreateDeposit({ client, onSuccess, onError }) {
|
|
8
7
|
const [isLoading, setIsLoading] = useState(false);
|
|
@@ -106,7 +105,7 @@ function useSignalIntent({ client, onSuccess, onError }) {
|
|
|
106
105
|
[signalIntent, prepareSignalIntent, isLoading, error, txHash, prepared]
|
|
107
106
|
);
|
|
108
107
|
}
|
|
109
|
-
function
|
|
108
|
+
function useGetTakerStake({
|
|
110
109
|
client,
|
|
111
110
|
owner,
|
|
112
111
|
chainId,
|
|
@@ -116,97 +115,115 @@ function useGetTakerTier({
|
|
|
116
115
|
}) {
|
|
117
116
|
const [isLoading, setIsLoading] = useState(false);
|
|
118
117
|
const [error, setError] = useState(null);
|
|
119
|
-
const [
|
|
120
|
-
const
|
|
118
|
+
const [takerStake, setTakerStake] = useState(null);
|
|
119
|
+
const onSuccessRef = useRef(onSuccess);
|
|
120
|
+
const onErrorRef = useRef(onError);
|
|
121
|
+
useEffect(() => {
|
|
122
|
+
onSuccessRef.current = onSuccess;
|
|
123
|
+
onErrorRef.current = onError;
|
|
124
|
+
});
|
|
125
|
+
const getTakerStake = useCallback(
|
|
121
126
|
async (params) => {
|
|
122
127
|
if (!client) {
|
|
123
128
|
const err = new Error("Zkp2pClient is not initialized");
|
|
124
129
|
setError(err);
|
|
125
|
-
|
|
130
|
+
onErrorRef.current?.(err);
|
|
126
131
|
return null;
|
|
127
132
|
}
|
|
128
133
|
const request = params ?? (owner && chainId ? { owner, chainId } : null);
|
|
129
134
|
if (!request) {
|
|
130
135
|
const err = new Error("Owner address and chainId are required");
|
|
131
136
|
setError(err);
|
|
132
|
-
|
|
137
|
+
onErrorRef.current?.(err);
|
|
133
138
|
return null;
|
|
134
139
|
}
|
|
135
140
|
setIsLoading(true);
|
|
136
141
|
setError(null);
|
|
137
|
-
|
|
142
|
+
setTakerStake(null);
|
|
138
143
|
try {
|
|
139
|
-
const response = await client.
|
|
140
|
-
|
|
141
|
-
|
|
144
|
+
const response = await client.getTakerStake(request);
|
|
145
|
+
setTakerStake(response.responseObject);
|
|
146
|
+
onSuccessRef.current?.(response.responseObject);
|
|
142
147
|
return response;
|
|
143
148
|
} catch (err) {
|
|
144
149
|
const e = err instanceof Error ? err : new Error(String(err));
|
|
145
150
|
setError(e);
|
|
146
|
-
|
|
151
|
+
onErrorRef.current?.(e);
|
|
147
152
|
return null;
|
|
148
153
|
} finally {
|
|
149
154
|
setIsLoading(false);
|
|
150
155
|
}
|
|
151
156
|
},
|
|
152
|
-
[client, owner, chainId
|
|
157
|
+
[client, owner, chainId]
|
|
153
158
|
);
|
|
154
159
|
useEffect(() => {
|
|
155
160
|
if (!autoFetch || !owner || !chainId) return;
|
|
156
|
-
void
|
|
157
|
-
}, [autoFetch, owner, chainId,
|
|
161
|
+
void getTakerStake({ owner, chainId });
|
|
162
|
+
}, [autoFetch, owner, chainId, getTakerStake]);
|
|
158
163
|
return useMemo(
|
|
159
|
-
() => ({
|
|
160
|
-
[
|
|
164
|
+
() => ({ getTakerStake, takerStake, isLoading, error }),
|
|
165
|
+
[getTakerStake, takerStake, isLoading, error]
|
|
161
166
|
);
|
|
162
167
|
}
|
|
163
|
-
function
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
const
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
const
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
168
|
+
function useGetTakerCapacity({
|
|
169
|
+
client,
|
|
170
|
+
owner,
|
|
171
|
+
chainId,
|
|
172
|
+
autoFetch = true,
|
|
173
|
+
onSuccess,
|
|
174
|
+
onError
|
|
175
|
+
}) {
|
|
176
|
+
const [isLoading, setIsLoading] = useState(false);
|
|
177
|
+
const [error, setError] = useState(null);
|
|
178
|
+
const [takerCapacity, setTakerCapacity] = useState(null);
|
|
179
|
+
const onSuccessRef = useRef(onSuccess);
|
|
180
|
+
const onErrorRef = useRef(onError);
|
|
181
|
+
useEffect(() => {
|
|
182
|
+
onSuccessRef.current = onSuccess;
|
|
183
|
+
onErrorRef.current = onError;
|
|
184
|
+
});
|
|
185
|
+
const getTakerCapacity = useCallback(
|
|
186
|
+
async (params) => {
|
|
187
|
+
if (!client) {
|
|
188
|
+
const err = new Error("Zkp2pClient is not initialized");
|
|
189
|
+
setError(err);
|
|
190
|
+
onErrorRef.current?.(err);
|
|
191
|
+
return null;
|
|
192
|
+
}
|
|
193
|
+
const request = params ?? (owner && chainId ? { owner, chainId } : null);
|
|
194
|
+
if (!request) {
|
|
195
|
+
const err = new Error("Owner address and chainId are required");
|
|
196
|
+
setError(err);
|
|
197
|
+
onErrorRef.current?.(err);
|
|
198
|
+
return null;
|
|
199
|
+
}
|
|
200
|
+
setIsLoading(true);
|
|
201
|
+
setError(null);
|
|
202
|
+
setTakerCapacity(null);
|
|
203
|
+
try {
|
|
204
|
+
const response = await client.getTakerCapacity(request);
|
|
205
|
+
setTakerCapacity(response.responseObject);
|
|
206
|
+
onSuccessRef.current?.(response.responseObject);
|
|
207
|
+
return response;
|
|
208
|
+
} catch (err) {
|
|
209
|
+
const e = err instanceof Error ? err : new Error(String(err));
|
|
210
|
+
setError(e);
|
|
211
|
+
onErrorRef.current?.(e);
|
|
212
|
+
return null;
|
|
213
|
+
} finally {
|
|
214
|
+
setIsLoading(false);
|
|
215
|
+
}
|
|
216
|
+
},
|
|
217
|
+
[client, owner, chainId]
|
|
218
|
+
);
|
|
219
|
+
useEffect(() => {
|
|
220
|
+
if (!autoFetch || !owner || !chainId) return;
|
|
221
|
+
void getTakerCapacity({ owner, chainId });
|
|
222
|
+
}, [autoFetch, owner, chainId, getTakerCapacity]);
|
|
223
|
+
return useMemo(
|
|
224
|
+
() => ({ getTakerCapacity, takerCapacity, isLoading, error }),
|
|
225
|
+
[getTakerCapacity, takerCapacity, isLoading, error]
|
|
226
|
+
);
|
|
210
227
|
}
|
|
211
228
|
function useFulfillIntent({ client, onSuccess, onError }) {
|
|
212
229
|
const [isLoading, setIsLoading] = useState(false);
|
|
@@ -1467,6 +1484,6 @@ function usePruneExpiredIntents({ client, onSuccess, onError }) {
|
|
|
1467
1484
|
return useMemo(() => ({ pruneExpiredIntents, isLoading, error, txHash }), [pruneExpiredIntents, isLoading, error, txHash]);
|
|
1468
1485
|
}
|
|
1469
1486
|
|
|
1470
|
-
export {
|
|
1487
|
+
export { useAddCurrencies, useAddFunds, useAddPaymentMethods, useCreateDeposit, useCreateVault, useDeactivateCurrency, useFulfillIntent, useGetTakerCapacity, useGetTakerStake, usePruneExpiredIntents, useReleaseFundsToPayer, useRemoveCurrency, useRemoveDelegate, useRemoveFunds, useRemovePaymentMethod, useSetAcceptingIntents, useSetCurrencyMinRate, useSetDelegate, useSetIntentRange, useSetPaymentMethodActive, useSetRetainOnEmpty, useSetVaultConfig, useSetVaultFee, useSetVaultMinRate, useSignalIntent, useVaultDelegation, useWithdrawDeposit };
|
|
1471
1488
|
//# sourceMappingURL=react.mjs.map
|
|
1472
1489
|
//# sourceMappingURL=react.mjs.map
|