@cofhe/react 0.5.2 → 0.6.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/{chunk-3YAGCPSA.cjs → chunk-6ANXPYT6.cjs} +53 -54
- package/dist/chunk-6ANXPYT6.cjs.map +1 -0
- package/dist/{chunk-N3S7TQY6.js → chunk-C5RYFTRG.js} +52 -53
- package/dist/chunk-C5RYFTRG.js.map +1 -0
- package/dist/index.cjs +4 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +17 -1
- package/dist/index.d.ts +17 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/ui-base.cjs +343 -343
- package/dist/ui-base.js +1 -1
- package/package.json +9 -7
- package/dist/chunk-3YAGCPSA.cjs.map +0 -1
- package/dist/chunk-N3S7TQY6.js.map +0 -1
|
@@ -3372,7 +3372,7 @@ function useCofheTokenTransfer(writeMutationOptions) {
|
|
|
3372
3372
|
// src/hooks/useCofheTokenShield.ts
|
|
3373
3373
|
|
|
3374
3374
|
|
|
3375
|
-
var import_ts_essentials7 = __toESM(require_dist()
|
|
3375
|
+
var import_ts_essentials7 = __toESM(require_dist());
|
|
3376
3376
|
function getCofheTokenShieldCallArgs(params) {
|
|
3377
3377
|
const { token, amount, account } = params;
|
|
3378
3378
|
const tokenAddress = token.address;
|
|
@@ -4675,6 +4675,54 @@ function useCofheSimulateWriteContract(callArgs, queryOptions) {
|
|
|
4675
4675
|
});
|
|
4676
4676
|
}
|
|
4677
4677
|
|
|
4678
|
+
// src/stores/portalPersisted.tsx
|
|
4679
|
+
|
|
4680
|
+
|
|
4681
|
+
var usePortalPersisted = _zustand.create.call(void 0, )(
|
|
4682
|
+
_middleware.persist.call(void 0,
|
|
4683
|
+
(set, get) => ({
|
|
4684
|
+
hasCreatedFirstPermit: false,
|
|
4685
|
+
setHasCreatedFirstPermit: (hasCreated) => set({ hasCreatedFirstPermit: hasCreated })
|
|
4686
|
+
}),
|
|
4687
|
+
{
|
|
4688
|
+
name: "cofhesdk-react-persisted",
|
|
4689
|
+
storage: _middleware.createJSONStorage.call(void 0, () => localStorage)
|
|
4690
|
+
}
|
|
4691
|
+
)
|
|
4692
|
+
);
|
|
4693
|
+
|
|
4694
|
+
// src/hooks/permits/useCofheCreatePermit.ts
|
|
4695
|
+
var useCofheCreatePermit = ({ onSuccess, onError } = {}) => {
|
|
4696
|
+
const cofheClient = useCofheClient();
|
|
4697
|
+
const { setHasCreatedFirstPermit } = usePortalPersisted();
|
|
4698
|
+
return useInternalMutation({
|
|
4699
|
+
onSuccess,
|
|
4700
|
+
onError,
|
|
4701
|
+
onSettled: () => {
|
|
4702
|
+
setHasCreatedFirstPermit(true);
|
|
4703
|
+
},
|
|
4704
|
+
mutationFn: async (args) => {
|
|
4705
|
+
const { name, isSelf, expirationSeconds } = args;
|
|
4706
|
+
const { account } = cofheClient.getSnapshot();
|
|
4707
|
+
if (!account) throw new Error("No connected account found");
|
|
4708
|
+
if (isSelf) {
|
|
4709
|
+
await cofheClient.permits.createSelf({
|
|
4710
|
+
expiration: expirationSeconds,
|
|
4711
|
+
issuer: account,
|
|
4712
|
+
name: name.trim()
|
|
4713
|
+
});
|
|
4714
|
+
return;
|
|
4715
|
+
}
|
|
4716
|
+
await cofheClient.permits.createSharing({
|
|
4717
|
+
expiration: expirationSeconds,
|
|
4718
|
+
issuer: account,
|
|
4719
|
+
recipient: args.receiver,
|
|
4720
|
+
name: name.trim()
|
|
4721
|
+
});
|
|
4722
|
+
}
|
|
4723
|
+
});
|
|
4724
|
+
};
|
|
4725
|
+
|
|
4678
4726
|
// src/hooks/permits/useCofheNavigateToCreatePermit.tsx
|
|
4679
4727
|
|
|
4680
4728
|
var useCofheNavigateToCreatePermit = () => {
|
|
@@ -5093,56 +5141,6 @@ function usePermitDuration(options) {
|
|
|
5093
5141
|
|
|
5094
5142
|
// src/hooks/permits/usePermitForm.ts
|
|
5095
5143
|
|
|
5096
|
-
|
|
5097
|
-
// src/stores/portalPersisted.tsx
|
|
5098
|
-
|
|
5099
|
-
|
|
5100
|
-
var usePortalPersisted = _zustand.create.call(void 0, )(
|
|
5101
|
-
_middleware.persist.call(void 0,
|
|
5102
|
-
(set, get) => ({
|
|
5103
|
-
hasCreatedFirstPermit: false,
|
|
5104
|
-
setHasCreatedFirstPermit: (hasCreated) => set({ hasCreatedFirstPermit: hasCreated })
|
|
5105
|
-
}),
|
|
5106
|
-
{
|
|
5107
|
-
name: "cofhesdk-react-persisted",
|
|
5108
|
-
storage: _middleware.createJSONStorage.call(void 0, () => localStorage)
|
|
5109
|
-
}
|
|
5110
|
-
)
|
|
5111
|
-
);
|
|
5112
|
-
|
|
5113
|
-
// src/hooks/permits/useCofheCreatePermitMutation.ts
|
|
5114
|
-
var useCofheCreatePermitMutation = ({ onSuccess, onError } = {}) => {
|
|
5115
|
-
const cofheClient = useCofheClient();
|
|
5116
|
-
const { setHasCreatedFirstPermit } = usePortalPersisted();
|
|
5117
|
-
return useInternalMutation({
|
|
5118
|
-
onSuccess,
|
|
5119
|
-
onError,
|
|
5120
|
-
onSettled: () => {
|
|
5121
|
-
setHasCreatedFirstPermit(true);
|
|
5122
|
-
},
|
|
5123
|
-
mutationFn: async (args) => {
|
|
5124
|
-
const { name, isSelf, expirationSeconds } = args;
|
|
5125
|
-
const { account } = cofheClient.getSnapshot();
|
|
5126
|
-
if (!account) throw new Error("No connected account found");
|
|
5127
|
-
if (isSelf) {
|
|
5128
|
-
await cofheClient.permits.createSelf({
|
|
5129
|
-
expiration: expirationSeconds,
|
|
5130
|
-
issuer: account,
|
|
5131
|
-
name: name.trim()
|
|
5132
|
-
});
|
|
5133
|
-
return;
|
|
5134
|
-
}
|
|
5135
|
-
await cofheClient.permits.createSharing({
|
|
5136
|
-
expiration: expirationSeconds,
|
|
5137
|
-
issuer: account,
|
|
5138
|
-
recipient: args.receiver,
|
|
5139
|
-
name: name.trim()
|
|
5140
|
-
});
|
|
5141
|
-
}
|
|
5142
|
-
});
|
|
5143
|
-
};
|
|
5144
|
-
|
|
5145
|
-
// src/hooks/permits/usePermitForm.ts
|
|
5146
5144
|
function usePermitForm(options = {}) {
|
|
5147
5145
|
const { onSuccess, onError, isDelegate = false } = options;
|
|
5148
5146
|
const [permitName, setPermitName] = _react.useState.call(void 0, "");
|
|
@@ -5151,7 +5149,7 @@ function usePermitForm(options = {}) {
|
|
|
5151
5149
|
const [nameError, setNameError] = _react.useState.call(void 0, null);
|
|
5152
5150
|
const [receiverError, setReceiverError] = _react.useState.call(void 0, null);
|
|
5153
5151
|
const [durationSeconds, setDurationSeconds] = _react.useState.call(void 0, 7 * 24 * 60 * 60);
|
|
5154
|
-
const { mutateAsync: createPermitMutateAsync, isPending: isPermitCreationPending } =
|
|
5152
|
+
const { mutateAsync: createPermitMutateAsync, isPending: isPermitCreationPending } = useCofheCreatePermit({
|
|
5155
5153
|
onSuccess,
|
|
5156
5154
|
onError
|
|
5157
5155
|
});
|
|
@@ -5626,5 +5624,6 @@ function useReschedulableTimeout(callback, defaultTimeout) {
|
|
|
5626
5624
|
|
|
5627
5625
|
|
|
5628
5626
|
|
|
5629
|
-
|
|
5630
|
-
|
|
5627
|
+
|
|
5628
|
+
exports.__toESM = __toESM; exports.useInternalQueryClient = useInternalQueryClient; exports.useCofheClient = useCofheClient; exports.useInternalQueries = useInternalQueries; exports.useCofheAutoConnect = useCofheAutoConnect; exports.cofheLogger = cofheLogger; exports.createCofheConfig = createCofheConfig; exports.require_dist = require_dist; exports.CofheProvider = CofheProvider; exports.useCofheContext = useCofheContext; exports.cn = cn; exports.ETH_ADDRESS_LOWERCASE = ETH_ADDRESS_LOWERCASE; exports.isTokenOperationSupported = isTokenOperationSupported; exports.getTokenConfidentialityLabel = getTokenConfidentialityLabel; exports.DEFAULT_TOKEN_BY_CHAIN_ID = DEFAULT_TOKEN_BY_CHAIN_ID; exports.getBlockExplorerUrl = getBlockExplorerUrl; exports.getBlockExplorerTxUrl = getBlockExplorerTxUrl; exports.getBlockExplorerAddressUrl = getBlockExplorerAddressUrl; exports.getBlockExplorerTokenUrl = getBlockExplorerTokenUrl; exports.isEthPair = isEthPair; exports.isWrappedEthToken = isWrappedEthToken; exports.FheTypesList = FheTypesList; exports.truncateHash = truncateHash; exports.truncateAddress = truncateAddress; exports.sanitizeNumericInput = sanitizeNumericInput; exports.formatRelativeTime = formatRelativeTime; exports.formatExpirationLabel = formatExpirationLabel; exports.cofheHumanizeViemError = cofheHumanizeViemError; exports.useCofheConnection = useCofheConnection; exports.useCofheIsConnected = useCofheIsConnected; exports.useCofheAccount = useCofheAccount; exports.useCofheChainId = useCofheChainId; exports.useCofhePublicClient = useCofhePublicClient; exports.useCofheWalletClient = useCofheWalletClient; exports.getTokenContractConfig = getTokenContractConfig; exports.useResolvedCofheToken = useResolvedCofheToken; exports.useCofheActivePermit = useCofheActivePermit; exports.useCofheActivePermitHash = useCofheActivePermitHash; exports.useCofheAllPermits = useCofheAllPermits; exports.useCofhePermit = useCofhePermit; exports.useCofheRemovePermit = useCofheRemovePermit; exports.useCofheSelectPermit = useCofheSelectPermit; exports.constructCofheReadContractQueryForInvalidation = constructCofheReadContractQueryForInvalidation; exports.useCofheEnabled = useCofheEnabled; exports.useCustomTokensStore = useCustomTokensStore; exports.useCofheTokenLists = useCofheTokenLists; exports.useCofheTokens = useCofheTokens; exports.useCofheToken = useCofheToken; exports.formatTokenAmount = formatTokenAmount; exports.unitToWei = unitToWei; exports.formatUsdAmount = formatUsdAmount; exports.useCofheReadContractAndDecrypt = useCofheReadContractAndDecrypt; exports.useCofheTokenDecryptedBalance = useCofheTokenDecryptedBalance; exports.TransactionStatus = TransactionStatus; exports.TransactionActionType = TransactionActionType; exports.actionToString = actionToString; exports.statusToString = statusToString; exports.useTransactionStore = useTransactionStore; exports.getStepConfig = getStepConfig; exports.useCofheEncrypt = useCofheEncrypt; exports.useCofheWriteContract = useCofheWriteContract; exports.useCofheEncryptAndWriteContract = useCofheEncryptAndWriteContract; exports.usePortalModals = usePortalModals; exports.usePortalStatuses = usePortalStatuses; exports.usePortalUI = usePortalUI; exports.usePortalUIMaxContentHeight = usePortalUIMaxContentHeight; exports.usePortalNavigation = usePortalNavigation; exports.usePortalCurrentPage = usePortalCurrentPage; exports.HashLink = HashLink; exports.CopyButton = CopyButton; exports.ToastPrimitiveBase = ToastPrimitiveBase; exports.ToastPrimitive = ToastPrimitive; exports.usePortalToasts = usePortalToasts; exports.useTransactionGlobalLifecycle = useTransactionGlobalLifecycle; exports.useCofheTokenTransfer = useCofheTokenTransfer; exports.useCofheTokenApprove = useCofheTokenApprove; exports.getCofheTokenShieldCallArgs = getCofheTokenShieldCallArgs; exports.useCofheTokenShield = useCofheTokenShield; exports.useStoredTransactions = useStoredTransactions; exports.useOnceTransactionMined = useOnceTransactionMined; exports.getCofheTokenUnshieldCallArgs = getCofheTokenUnshieldCallArgs; exports.useCofheTokenUnshield = useCofheTokenUnshield; exports.getCofheTokenClaimUnshieldedCallArgs = getCofheTokenClaimUnshieldedCallArgs; exports.useCofheTokenClaimUnshielded = useCofheTokenClaimUnshielded; exports.useDecryptionWatchersStore = useDecryptionWatchersStore; exports.invalidateClaimableQueries = invalidateClaimableQueries; exports.constructUnshieldClaimsQueryKeyForInvalidation = constructUnshieldClaimsQueryKeyForInvalidation; exports.useCofheTokenClaimable = useCofheTokenClaimable; exports.useCofheTokensClaimable = useCofheTokensClaimable; exports.useCofheTokensWithExistingEncryptedBalances = useCofheTokensWithExistingEncryptedBalances; exports.constructPublicTokenBalanceQueryKeyForInvalidation = constructPublicTokenBalanceQueryKeyForInvalidation; exports.useCofheTokenPublicBalance = useCofheTokenPublicBalance; exports.useTokensWithPublicBalances = useTokensWithPublicBalances; exports.useCofheSimulateWriteContract = useCofheSimulateWriteContract; exports.usePermitDuration = usePermitDuration; exports.usePortalPersisted = usePortalPersisted; exports.useCofheCreatePermit = useCofheCreatePermit; exports.usePermitForm = usePermitForm; exports.useCofheNavigateToCreatePermit = useCofheNavigateToCreatePermit; exports.usePermitsList = usePermitsList; exports.useReceivePermit = useReceivePermit; exports.useCopyFeedback = useCopyFeedback; exports.usePermitDetailsAndActions = usePermitDetailsAndActions; exports.useTransactionReceiptsByHash = useTransactionReceiptsByHash; exports.useReschedulableTimeout = useReschedulableTimeout; exports.TMP_WBTC_ON_MAINNET = TMP_WBTC_ON_MAINNET; exports.useCoingeckoUsdPrice = useCoingeckoUsdPrice; exports.useCoingeckoContractMarketChartRange = useCoingeckoContractMarketChartRange; exports.constructTokenAllowanceQueryKeyForInvalidation = constructTokenAllowanceQueryKeyForInvalidation; exports.useTokenAllowance = useTokenAllowance;
|
|
5629
|
+
//# sourceMappingURL=chunk-6ANXPYT6.cjs.map
|