@sudobility/contracts 1.13.0 → 1.13.2
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/evm/src/evm/evm-mailer-client.js +3 -3
- package/dist/evm/src/evm/evm-mailer-client.js.map +1 -1
- package/dist/evm/src/evm/index.d.ts +3 -3
- package/dist/evm/src/evm/index.d.ts.map +1 -1
- package/dist/evm/src/evm/index.js +4 -4
- package/dist/evm/src/evm/index.js.map +1 -1
- package/dist/solana/solana/index.d.ts +2 -2
- package/dist/solana/solana/index.d.ts.map +1 -1
- package/dist/solana/solana/index.js +3 -3
- package/dist/solana/solana/index.js.map +1 -1
- package/dist/solana/solana/solana-mailer-client.d.ts +1 -1
- package/dist/solana/solana/solana-mailer-client.d.ts.map +1 -1
- package/dist/solana/solana/solana-mailer-client.js +1 -1
- package/dist/solana/solana/solana-mailer-client.js.map +1 -1
- package/dist/solana/solana/types.d.ts +1 -1
- package/dist/solana/solana/types.d.ts.map +1 -1
- package/dist/solana/solana/types.js +5 -5
- package/dist/solana/solana/types.js.map +1 -1
- package/dist/unified/src/evm/evm-mailer-client.js +7 -11
- package/dist/unified/src/evm/evm-mailer-client.js.map +1 -1
- package/dist/unified/src/evm/index.d.ts +3 -3
- package/dist/unified/src/evm/index.d.ts.map +1 -1
- package/dist/unified/src/evm/index.js +2 -7
- package/dist/unified/src/evm/index.js.map +1 -1
- package/dist/unified/src/react/context/MailerProvider.js +14 -55
- package/dist/unified/src/react/context/MailerProvider.js.map +1 -1
- package/dist/unified/src/react/hooks/useMailerMutations.js +76 -98
- package/dist/unified/src/react/hooks/useMailerMutations.js.map +1 -1
- package/dist/unified/src/react/hooks/useMailerQueries.js +52 -68
- package/dist/unified/src/react/hooks/useMailerQueries.js.map +1 -1
- package/dist/unified/src/react/index.js +5 -47
- package/dist/unified/src/react/index.js.map +1 -1
- package/dist/unified/src/solana/index.d.ts +2 -2
- package/dist/unified/src/solana/index.d.ts.map +1 -1
- package/dist/unified/src/solana/index.js +2 -20
- package/dist/unified/src/solana/index.js.map +1 -1
- package/dist/unified/src/solana/solana-mailer-client.d.ts +1 -1
- package/dist/unified/src/solana/solana-mailer-client.d.ts.map +1 -1
- package/dist/unified/src/solana/solana-mailer-client.js +129 -133
- package/dist/unified/src/solana/solana-mailer-client.js.map +1 -1
- package/dist/unified/src/solana/types.d.ts +1 -1
- package/dist/unified/src/solana/types.d.ts.map +1 -1
- package/dist/unified/src/solana/types.js +6 -13
- package/dist/unified/src/solana/types.js.map +1 -1
- package/dist/unified/src/unified/index.d.ts +3 -3
- package/dist/unified/src/unified/index.d.ts.map +1 -1
- package/dist/unified/src/unified/index.js +2 -7
- package/dist/unified/src/unified/index.js.map +1 -1
- package/dist/unified/src/unified/onchain-mailer-client.d.ts +3 -3
- package/dist/unified/src/unified/onchain-mailer-client.d.ts.map +1 -1
- package/dist/unified/src/unified/onchain-mailer-client.js +88 -125
- package/dist/unified/src/unified/onchain-mailer-client.js.map +1 -1
- package/dist/unified/src/unified/types.js +1 -2
- package/dist/unified/src/unified/wallet-detector.js +10 -14
- package/dist/unified/src/unified/wallet-detector.js.map +1 -1
- package/dist/unified/src/utils/chain-config.d.ts +1 -1
- package/dist/unified/src/utils/chain-config.d.ts.map +1 -1
- package/dist/unified/src/utils/chain-config.js +9 -13
- package/dist/unified/src/utils/chain-config.js.map +1 -1
- package/dist/unified/src/utils/currency.js +6 -11
- package/dist/unified/src/utils/currency.js.map +1 -1
- package/dist/unified/src/utils/index.d.ts +3 -3
- package/dist/unified/src/utils/index.d.ts.map +1 -1
- package/dist/unified/src/utils/index.js +3 -19
- package/dist/unified/src/utils/index.js.map +1 -1
- package/dist/unified/src/utils/validation.js +11 -17
- package/dist/unified/src/utils/validation.js.map +1 -1
- package/dist/unified/typechain-types/Mailer.js +1 -2
- package/dist/unified/typechain-types/MockUSDC.js +1 -2
- package/dist/unified/typechain-types/common.js +1 -2
- package/dist/unified/typechain-types/factories/Mailer__factory.js +4 -8
- package/dist/unified/typechain-types/factories/Mailer__factory.js.map +1 -1
- package/dist/unified/typechain-types/factories/MockUSDC__factory.js +4 -8
- package/dist/unified/typechain-types/factories/MockUSDC__factory.js.map +1 -1
- package/dist/unified/typechain-types/factories/index.js +3 -41
- package/dist/unified/typechain-types/factories/index.js.map +1 -1
- package/dist/unified/typechain-types/factories/interfaces/IERC20__factory.js +4 -8
- package/dist/unified/typechain-types/factories/interfaces/IERC20__factory.js.map +1 -1
- package/dist/unified/typechain-types/factories/interfaces/index.js +1 -5
- package/dist/unified/typechain-types/factories/interfaces/index.js.map +1 -1
- package/dist/unified/typechain-types/index.js +4 -43
- package/dist/unified/typechain-types/index.js.map +1 -1
- package/dist/unified/typechain-types/interfaces/IERC20.js +1 -2
- package/dist/unified/typechain-types/interfaces/index.js +1 -2
- package/package.json +12 -18
- package/dist/unified/package.json +0 -3
- package/dist/unified-esm/src/evm/evm-mailer-client.d.ts +0 -1062
- package/dist/unified-esm/src/evm/evm-mailer-client.d.ts.map +0 -1
- package/dist/unified-esm/src/evm/evm-mailer-client.js +0 -920
- package/dist/unified-esm/src/evm/evm-mailer-client.js.map +0 -1
- package/dist/unified-esm/src/evm/index.d.ts +0 -4
- package/dist/unified-esm/src/evm/index.d.ts.map +0 -1
- package/dist/unified-esm/src/evm/index.js +0 -5
- package/dist/unified-esm/src/evm/index.js.map +0 -1
- package/dist/unified-esm/src/react/context/MailerProvider.d.ts +0 -108
- package/dist/unified-esm/src/react/context/MailerProvider.d.ts.map +0 -1
- package/dist/unified-esm/src/react/context/MailerProvider.js +0 -119
- package/dist/unified-esm/src/react/context/MailerProvider.js.map +0 -1
- package/dist/unified-esm/src/react/hooks/useMailerMutations.d.ts +0 -334
- package/dist/unified-esm/src/react/hooks/useMailerMutations.d.ts.map +0 -1
- package/dist/unified-esm/src/react/hooks/useMailerMutations.js +0 -392
- package/dist/unified-esm/src/react/hooks/useMailerMutations.js.map +0 -1
- package/dist/unified-esm/src/react/hooks/useMailerQueries.d.ts +0 -184
- package/dist/unified-esm/src/react/hooks/useMailerQueries.d.ts.map +0 -1
- package/dist/unified-esm/src/react/hooks/useMailerQueries.js +0 -316
- package/dist/unified-esm/src/react/hooks/useMailerQueries.js.map +0 -1
- package/dist/unified-esm/src/react/index.d.ts +0 -39
- package/dist/unified-esm/src/react/index.d.ts.map +0 -1
- package/dist/unified-esm/src/react/index.js +0 -43
- package/dist/unified-esm/src/react/index.js.map +0 -1
- package/dist/unified-esm/src/solana/index.d.ts +0 -3
- package/dist/unified-esm/src/solana/index.d.ts.map +0 -1
- package/dist/unified-esm/src/solana/index.js +0 -4
- package/dist/unified-esm/src/solana/index.js.map +0 -1
- package/dist/unified-esm/src/solana/solana-mailer-client.d.ts +0 -209
- package/dist/unified-esm/src/solana/solana-mailer-client.d.ts.map +0 -1
- package/dist/unified-esm/src/solana/solana-mailer-client.js +0 -1000
- package/dist/unified-esm/src/solana/solana-mailer-client.js.map +0 -1
- package/dist/unified-esm/src/solana/types.d.ts +0 -29
- package/dist/unified-esm/src/solana/types.d.ts.map +0 -1
- package/dist/unified-esm/src/solana/types.js +0 -16
- package/dist/unified-esm/src/solana/types.js.map +0 -1
- package/dist/unified-esm/src/unified/index.d.ts +0 -4
- package/dist/unified-esm/src/unified/index.d.ts.map +0 -1
- package/dist/unified-esm/src/unified/index.js +0 -4
- package/dist/unified-esm/src/unified/index.js.map +0 -1
- package/dist/unified-esm/src/unified/onchain-mailer-client.d.ts +0 -258
- package/dist/unified-esm/src/unified/onchain-mailer-client.d.ts.map +0 -1
- package/dist/unified-esm/src/unified/onchain-mailer-client.js +0 -731
- package/dist/unified-esm/src/unified/onchain-mailer-client.js.map +0 -1
- package/dist/unified-esm/src/unified/types.d.ts +0 -54
- package/dist/unified-esm/src/unified/types.d.ts.map +0 -1
- package/dist/unified-esm/src/unified/types.js +0 -2
- package/dist/unified-esm/src/unified/types.js.map +0 -1
- package/dist/unified-esm/src/unified/wallet-detector.d.ts +0 -28
- package/dist/unified-esm/src/unified/wallet-detector.d.ts.map +0 -1
- package/dist/unified-esm/src/unified/wallet-detector.js +0 -59
- package/dist/unified-esm/src/unified/wallet-detector.js.map +0 -1
- package/dist/unified-esm/src/utils/chain-config.d.ts +0 -75
- package/dist/unified-esm/src/utils/chain-config.d.ts.map +0 -1
- package/dist/unified-esm/src/utils/chain-config.js +0 -199
- package/dist/unified-esm/src/utils/chain-config.js.map +0 -1
- package/dist/unified-esm/src/utils/currency.d.ts +0 -26
- package/dist/unified-esm/src/utils/currency.d.ts.map +0 -1
- package/dist/unified-esm/src/utils/currency.js +0 -31
- package/dist/unified-esm/src/utils/currency.js.map +0 -1
- package/dist/unified-esm/src/utils/index.d.ts +0 -4
- package/dist/unified-esm/src/utils/index.d.ts.map +0 -1
- package/dist/unified-esm/src/utils/index.js +0 -4
- package/dist/unified-esm/src/utils/index.js.map +0 -1
- package/dist/unified-esm/src/utils/validation.d.ts +0 -10
- package/dist/unified-esm/src/utils/validation.d.ts.map +0 -1
- package/dist/unified-esm/src/utils/validation.js +0 -96
- package/dist/unified-esm/src/utils/validation.js.map +0 -1
- package/dist/unified-esm/typechain-types/Mailer.d.ts +0 -698
- package/dist/unified-esm/typechain-types/Mailer.d.ts.map +0 -1
- package/dist/unified-esm/typechain-types/Mailer.js +0 -2
- package/dist/unified-esm/typechain-types/Mailer.js.map +0 -1
- package/dist/unified-esm/typechain-types/MockUSDC.d.ts +0 -118
- package/dist/unified-esm/typechain-types/MockUSDC.d.ts.map +0 -1
- package/dist/unified-esm/typechain-types/MockUSDC.js +0 -2
- package/dist/unified-esm/typechain-types/MockUSDC.js.map +0 -1
- package/dist/unified-esm/typechain-types/common.d.ts +0 -51
- package/dist/unified-esm/typechain-types/common.d.ts.map +0 -1
- package/dist/unified-esm/typechain-types/common.js +0 -2
- package/dist/unified-esm/typechain-types/common.js.map +0 -1
- package/dist/unified-esm/typechain-types/factories/Mailer__factory.d.ts +0 -875
- package/dist/unified-esm/typechain-types/factories/Mailer__factory.d.ts.map +0 -1
- package/dist/unified-esm/typechain-types/factories/Mailer__factory.js +0 -1121
- package/dist/unified-esm/typechain-types/factories/Mailer__factory.js.map +0 -1
- package/dist/unified-esm/typechain-types/factories/MockUSDC__factory.d.ts +0 -193
- package/dist/unified-esm/typechain-types/factories/MockUSDC__factory.d.ts.map +0 -1
- package/dist/unified-esm/typechain-types/factories/MockUSDC__factory.js +0 -259
- package/dist/unified-esm/typechain-types/factories/MockUSDC__factory.js.map +0 -1
- package/dist/unified-esm/typechain-types/factories/index.d.ts +0 -4
- package/dist/unified-esm/typechain-types/factories/index.d.ts.map +0 -1
- package/dist/unified-esm/typechain-types/factories/index.js +0 -7
- package/dist/unified-esm/typechain-types/factories/index.js.map +0 -1
- package/dist/unified-esm/typechain-types/factories/interfaces/IERC20__factory.d.ts +0 -80
- package/dist/unified-esm/typechain-types/factories/interfaces/IERC20__factory.d.ts.map +0 -1
- package/dist/unified-esm/typechain-types/factories/interfaces/IERC20__factory.js +0 -112
- package/dist/unified-esm/typechain-types/factories/interfaces/IERC20__factory.js.map +0 -1
- package/dist/unified-esm/typechain-types/factories/interfaces/index.d.ts +0 -2
- package/dist/unified-esm/typechain-types/factories/interfaces/index.d.ts.map +0 -1
- package/dist/unified-esm/typechain-types/factories/interfaces/index.js +0 -5
- package/dist/unified-esm/typechain-types/factories/interfaces/index.js.map +0 -1
- package/dist/unified-esm/typechain-types/index.d.ts +0 -10
- package/dist/unified-esm/typechain-types/index.d.ts.map +0 -1
- package/dist/unified-esm/typechain-types/index.js +0 -5
- package/dist/unified-esm/typechain-types/index.js.map +0 -1
- package/dist/unified-esm/typechain-types/interfaces/IERC20.d.ts +0 -70
- package/dist/unified-esm/typechain-types/interfaces/IERC20.d.ts.map +0 -1
- package/dist/unified-esm/typechain-types/interfaces/IERC20.js +0 -2
- package/dist/unified-esm/typechain-types/interfaces/IERC20.js.map +0 -1
- package/dist/unified-esm/typechain-types/interfaces/index.d.ts +0 -2
- package/dist/unified-esm/typechain-types/interfaces/index.d.ts.map +0 -1
- package/dist/unified-esm/typechain-types/interfaces/index.js +0 -2
- package/dist/unified-esm/typechain-types/interfaces/index.js.map +0 -1
|
@@ -1,27 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.useMessaging = useMessaging;
|
|
4
|
-
exports.useClaims = useClaims;
|
|
5
|
-
exports.useDelegation = useDelegation;
|
|
6
|
-
exports.usePermissions = usePermissions;
|
|
7
|
-
exports.useContractControl = useContractControl;
|
|
8
|
-
exports.useOwnerOperations = useOwnerOperations;
|
|
9
|
-
exports.useSendMessage = useSendMessage;
|
|
10
|
-
exports.useSendPrepared = useSendPrepared;
|
|
11
|
-
exports.useClaimRevenue = useClaimRevenue;
|
|
12
|
-
exports.useClaimOwnerShare = useClaimOwnerShare;
|
|
13
|
-
exports.useClaimExpiredShares = useClaimExpiredShares;
|
|
14
|
-
exports.useDelegateTo = useDelegateTo;
|
|
15
|
-
exports.useRejectDelegation = useRejectDelegation;
|
|
16
|
-
exports.useSetPermission = useSetPermission;
|
|
17
|
-
exports.useRemovePermission = useRemovePermission;
|
|
18
|
-
exports.useSetFees = useSetFees;
|
|
19
|
-
exports.usePause = usePause;
|
|
20
|
-
exports.useUnpause = useUnpause;
|
|
21
|
-
exports.useEmergencyUnpause = useEmergencyUnpause;
|
|
22
|
-
exports.useDistributeClaimableFunds = useDistributeClaimableFunds;
|
|
23
|
-
const react_query_1 = require("@tanstack/react-query");
|
|
24
|
-
const useMailerQueries_1 = require("./useMailerQueries");
|
|
1
|
+
import { useMutation, useQueryClient } from '@tanstack/react-query';
|
|
2
|
+
import { mailerQueryKeys } from './useMailerQueries';
|
|
25
3
|
/**
|
|
26
4
|
* Hook for message-related operations
|
|
27
5
|
*
|
|
@@ -47,21 +25,21 @@ const useMailerQueries_1 = require("./useMailerQueries");
|
|
|
47
25
|
* }
|
|
48
26
|
* ```
|
|
49
27
|
*/
|
|
50
|
-
function useMessaging(client, connectedWallet, chainInfo, options) {
|
|
51
|
-
const queryClient =
|
|
52
|
-
const sendMessage =
|
|
28
|
+
export function useMessaging(client, connectedWallet, chainInfo, options) {
|
|
29
|
+
const queryClient = useQueryClient();
|
|
30
|
+
const sendMessage = useMutation({
|
|
53
31
|
mutationFn: async ({ subject, body, priority = false, resolveSenderToName = false }) => client.sendMessage(connectedWallet, chainInfo, subject, body, { priority, resolveSenderToName }),
|
|
54
32
|
onSuccess: () => {
|
|
55
|
-
queryClient.invalidateQueries({ queryKey:
|
|
56
|
-
queryClient.invalidateQueries({ queryKey:
|
|
33
|
+
queryClient.invalidateQueries({ queryKey: mailerQueryKeys.claimableAmount() });
|
|
34
|
+
queryClient.invalidateQueries({ queryKey: mailerQueryKeys.ownerClaimable() });
|
|
57
35
|
},
|
|
58
36
|
...options?.sendMessage,
|
|
59
37
|
});
|
|
60
|
-
const sendPrepared =
|
|
38
|
+
const sendPrepared = useMutation({
|
|
61
39
|
mutationFn: async ({ to, mailId, priority = false, resolveSenderToName = false }) => client.sendPrepared(connectedWallet, chainInfo, to, mailId, { priority, resolveSenderToName }),
|
|
62
40
|
onSuccess: () => {
|
|
63
|
-
queryClient.invalidateQueries({ queryKey:
|
|
64
|
-
queryClient.invalidateQueries({ queryKey:
|
|
41
|
+
queryClient.invalidateQueries({ queryKey: mailerQueryKeys.claimableAmount() });
|
|
42
|
+
queryClient.invalidateQueries({ queryKey: mailerQueryKeys.ownerClaimable() });
|
|
65
43
|
},
|
|
66
44
|
...options?.sendPrepared,
|
|
67
45
|
});
|
|
@@ -91,27 +69,27 @@ function useMessaging(client, connectedWallet, chainInfo, options) {
|
|
|
91
69
|
* }
|
|
92
70
|
* ```
|
|
93
71
|
*/
|
|
94
|
-
function useClaims(client, connectedWallet, chainInfo, options) {
|
|
95
|
-
const queryClient =
|
|
96
|
-
const claimRevenue =
|
|
72
|
+
export function useClaims(client, connectedWallet, chainInfo, options) {
|
|
73
|
+
const queryClient = useQueryClient();
|
|
74
|
+
const claimRevenue = useMutation({
|
|
97
75
|
mutationFn: () => client.claimRevenue(connectedWallet, chainInfo),
|
|
98
76
|
onSuccess: () => {
|
|
99
|
-
queryClient.invalidateQueries({ queryKey:
|
|
77
|
+
queryClient.invalidateQueries({ queryKey: mailerQueryKeys.claimableAmount() });
|
|
100
78
|
},
|
|
101
79
|
...options?.claimRevenue,
|
|
102
80
|
});
|
|
103
|
-
const claimOwnerShare =
|
|
81
|
+
const claimOwnerShare = useMutation({
|
|
104
82
|
mutationFn: () => client.claimOwnerShare(connectedWallet, chainInfo),
|
|
105
83
|
onSuccess: () => {
|
|
106
|
-
queryClient.invalidateQueries({ queryKey:
|
|
84
|
+
queryClient.invalidateQueries({ queryKey: mailerQueryKeys.ownerClaimable() });
|
|
107
85
|
},
|
|
108
86
|
...options?.claimOwnerShare,
|
|
109
87
|
});
|
|
110
|
-
const claimExpiredShares =
|
|
88
|
+
const claimExpiredShares = useMutation({
|
|
111
89
|
mutationFn: async ({ recipient }) => client.claimExpiredShares(connectedWallet, chainInfo, recipient),
|
|
112
90
|
onSuccess: (_, variables) => {
|
|
113
|
-
queryClient.invalidateQueries({ queryKey:
|
|
114
|
-
queryClient.invalidateQueries({ queryKey:
|
|
91
|
+
queryClient.invalidateQueries({ queryKey: mailerQueryKeys.claimableAmount(variables.recipient) });
|
|
92
|
+
queryClient.invalidateQueries({ queryKey: mailerQueryKeys.ownerClaimable() });
|
|
115
93
|
},
|
|
116
94
|
...options?.claimExpiredShares,
|
|
117
95
|
});
|
|
@@ -142,19 +120,19 @@ function useClaims(client, connectedWallet, chainInfo, options) {
|
|
|
142
120
|
* }
|
|
143
121
|
* ```
|
|
144
122
|
*/
|
|
145
|
-
function useDelegation(client, connectedWallet, chainInfo, options) {
|
|
146
|
-
const queryClient =
|
|
147
|
-
const delegateTo =
|
|
123
|
+
export function useDelegation(client, connectedWallet, chainInfo, options) {
|
|
124
|
+
const queryClient = useQueryClient();
|
|
125
|
+
const delegateTo = useMutation({
|
|
148
126
|
mutationFn: async ({ delegate }) => client.delegateTo(connectedWallet, chainInfo, delegate),
|
|
149
127
|
onSuccess: () => {
|
|
150
|
-
queryClient.invalidateQueries({ queryKey:
|
|
128
|
+
queryClient.invalidateQueries({ queryKey: mailerQueryKeys.delegation() });
|
|
151
129
|
},
|
|
152
130
|
...options?.delegateTo,
|
|
153
131
|
});
|
|
154
|
-
const rejectDelegation =
|
|
132
|
+
const rejectDelegation = useMutation({
|
|
155
133
|
mutationFn: async ({ delegatorAddress }) => client.rejectDelegation(connectedWallet, chainInfo, delegatorAddress),
|
|
156
134
|
onSuccess: () => {
|
|
157
|
-
queryClient.invalidateQueries({ queryKey:
|
|
135
|
+
queryClient.invalidateQueries({ queryKey: mailerQueryKeys.delegation() });
|
|
158
136
|
},
|
|
159
137
|
...options?.rejectDelegation,
|
|
160
138
|
});
|
|
@@ -184,19 +162,19 @@ function useDelegation(client, connectedWallet, chainInfo, options) {
|
|
|
184
162
|
* }
|
|
185
163
|
* ```
|
|
186
164
|
*/
|
|
187
|
-
function usePermissions(client, connectedWallet, chainInfo, options) {
|
|
188
|
-
const queryClient =
|
|
189
|
-
const setPermission =
|
|
165
|
+
export function usePermissions(client, connectedWallet, chainInfo, options) {
|
|
166
|
+
const queryClient = useQueryClient();
|
|
167
|
+
const setPermission = useMutation({
|
|
190
168
|
mutationFn: async ({ contractAddress }) => client.setPermission(connectedWallet, chainInfo, contractAddress),
|
|
191
169
|
onSuccess: () => {
|
|
192
|
-
queryClient.invalidateQueries({ queryKey:
|
|
170
|
+
queryClient.invalidateQueries({ queryKey: mailerQueryKeys.permissions() });
|
|
193
171
|
},
|
|
194
172
|
...options?.setPermission,
|
|
195
173
|
});
|
|
196
|
-
const removePermission =
|
|
174
|
+
const removePermission = useMutation({
|
|
197
175
|
mutationFn: async ({ contractAddress }) => client.removePermission(connectedWallet, chainInfo, contractAddress),
|
|
198
176
|
onSuccess: () => {
|
|
199
|
-
queryClient.invalidateQueries({ queryKey:
|
|
177
|
+
queryClient.invalidateQueries({ queryKey: mailerQueryKeys.permissions() });
|
|
200
178
|
},
|
|
201
179
|
...options?.removePermission,
|
|
202
180
|
});
|
|
@@ -223,27 +201,27 @@ function usePermissions(client, connectedWallet, chainInfo, options) {
|
|
|
223
201
|
* }
|
|
224
202
|
* ```
|
|
225
203
|
*/
|
|
226
|
-
function useContractControl(client, connectedWallet, chainInfo, options) {
|
|
227
|
-
const queryClient =
|
|
228
|
-
const pause =
|
|
204
|
+
export function useContractControl(client, connectedWallet, chainInfo, options) {
|
|
205
|
+
const queryClient = useQueryClient();
|
|
206
|
+
const pause = useMutation({
|
|
229
207
|
mutationFn: () => client.pause(connectedWallet, chainInfo),
|
|
230
208
|
onSuccess: () => {
|
|
231
|
-
queryClient.invalidateQueries({ queryKey:
|
|
232
|
-
queryClient.invalidateQueries({ queryKey:
|
|
209
|
+
queryClient.invalidateQueries({ queryKey: mailerQueryKeys.isPaused() });
|
|
210
|
+
queryClient.invalidateQueries({ queryKey: mailerQueryKeys.ownerClaimable() });
|
|
233
211
|
},
|
|
234
212
|
...options?.pause,
|
|
235
213
|
});
|
|
236
|
-
const unpause =
|
|
214
|
+
const unpause = useMutation({
|
|
237
215
|
mutationFn: () => client.unpause(connectedWallet, chainInfo),
|
|
238
216
|
onSuccess: () => {
|
|
239
|
-
queryClient.invalidateQueries({ queryKey:
|
|
217
|
+
queryClient.invalidateQueries({ queryKey: mailerQueryKeys.isPaused() });
|
|
240
218
|
},
|
|
241
219
|
...options?.unpause,
|
|
242
220
|
});
|
|
243
|
-
const emergencyUnpause =
|
|
221
|
+
const emergencyUnpause = useMutation({
|
|
244
222
|
mutationFn: () => client.emergencyUnpause(connectedWallet, chainInfo),
|
|
245
223
|
onSuccess: () => {
|
|
246
|
-
queryClient.invalidateQueries({ queryKey:
|
|
224
|
+
queryClient.invalidateQueries({ queryKey: mailerQueryKeys.isPaused() });
|
|
247
225
|
},
|
|
248
226
|
...options?.emergencyUnpause,
|
|
249
227
|
});
|
|
@@ -274,20 +252,20 @@ function useContractControl(client, connectedWallet, chainInfo, options) {
|
|
|
274
252
|
* }
|
|
275
253
|
* ```
|
|
276
254
|
*/
|
|
277
|
-
function useOwnerOperations(client, connectedWallet, chainInfo, options) {
|
|
278
|
-
const queryClient =
|
|
279
|
-
const setFees =
|
|
255
|
+
export function useOwnerOperations(client, connectedWallet, chainInfo, options) {
|
|
256
|
+
const queryClient = useQueryClient();
|
|
257
|
+
const setFees = useMutation({
|
|
280
258
|
mutationFn: async ({ sendFee, delegationFee }) => client.setFees(connectedWallet, chainInfo, sendFee, delegationFee),
|
|
281
259
|
onSuccess: () => {
|
|
282
|
-
queryClient.invalidateQueries({ queryKey:
|
|
283
|
-
queryClient.invalidateQueries({ queryKey:
|
|
260
|
+
queryClient.invalidateQueries({ queryKey: mailerQueryKeys.sendFee() });
|
|
261
|
+
queryClient.invalidateQueries({ queryKey: mailerQueryKeys.delegationFee() });
|
|
284
262
|
},
|
|
285
263
|
...options?.setFees,
|
|
286
264
|
});
|
|
287
|
-
const distributeClaimableFunds =
|
|
265
|
+
const distributeClaimableFunds = useMutation({
|
|
288
266
|
mutationFn: async ({ recipient }) => client.distributeClaimableFunds(connectedWallet, chainInfo, recipient),
|
|
289
267
|
onSuccess: (_, variables) => {
|
|
290
|
-
queryClient.invalidateQueries({ queryKey:
|
|
268
|
+
queryClient.invalidateQueries({ queryKey: mailerQueryKeys.claimableAmount(variables.recipient) });
|
|
291
269
|
},
|
|
292
270
|
...options?.distributeClaimableFunds,
|
|
293
271
|
});
|
|
@@ -298,116 +276,116 @@ function useOwnerOperations(client, connectedWallet, chainInfo, options) {
|
|
|
298
276
|
}
|
|
299
277
|
// ========== Legacy individual hooks for backward compatibility ==========
|
|
300
278
|
// These use context for convenience but the grouped hooks above are preferred
|
|
301
|
-
|
|
279
|
+
import { useMailerContext } from '../context/MailerProvider';
|
|
302
280
|
/**
|
|
303
281
|
* @deprecated Use useMessaging() instead
|
|
304
282
|
*/
|
|
305
|
-
function useSendMessage(options) {
|
|
306
|
-
const { client, wallet, chainInfo } =
|
|
283
|
+
export function useSendMessage(options) {
|
|
284
|
+
const { client, wallet, chainInfo } = useMailerContext();
|
|
307
285
|
const { sendMessage } = useMessaging(client, wallet, chainInfo, { sendMessage: options });
|
|
308
286
|
return sendMessage;
|
|
309
287
|
}
|
|
310
288
|
/**
|
|
311
289
|
* @deprecated Use useMessaging() instead
|
|
312
290
|
*/
|
|
313
|
-
function useSendPrepared(options) {
|
|
314
|
-
const { client, wallet, chainInfo } =
|
|
291
|
+
export function useSendPrepared(options) {
|
|
292
|
+
const { client, wallet, chainInfo } = useMailerContext();
|
|
315
293
|
const { sendPrepared } = useMessaging(client, wallet, chainInfo, { sendPrepared: options });
|
|
316
294
|
return sendPrepared;
|
|
317
295
|
}
|
|
318
296
|
/**
|
|
319
297
|
* @deprecated Use useClaims() instead
|
|
320
298
|
*/
|
|
321
|
-
function useClaimRevenue(options) {
|
|
322
|
-
const { client, wallet, chainInfo } =
|
|
299
|
+
export function useClaimRevenue(options) {
|
|
300
|
+
const { client, wallet, chainInfo } = useMailerContext();
|
|
323
301
|
const { claimRevenue } = useClaims(client, wallet, chainInfo, { claimRevenue: options });
|
|
324
302
|
return claimRevenue;
|
|
325
303
|
}
|
|
326
304
|
/**
|
|
327
305
|
* @deprecated Use useClaims() instead
|
|
328
306
|
*/
|
|
329
|
-
function useClaimOwnerShare(options) {
|
|
330
|
-
const { client, wallet, chainInfo } =
|
|
307
|
+
export function useClaimOwnerShare(options) {
|
|
308
|
+
const { client, wallet, chainInfo } = useMailerContext();
|
|
331
309
|
const { claimOwnerShare } = useClaims(client, wallet, chainInfo, { claimOwnerShare: options });
|
|
332
310
|
return claimOwnerShare;
|
|
333
311
|
}
|
|
334
312
|
/**
|
|
335
313
|
* @deprecated Use useClaims() instead
|
|
336
314
|
*/
|
|
337
|
-
function useClaimExpiredShares(options) {
|
|
338
|
-
const { client, wallet, chainInfo } =
|
|
315
|
+
export function useClaimExpiredShares(options) {
|
|
316
|
+
const { client, wallet, chainInfo } = useMailerContext();
|
|
339
317
|
const { claimExpiredShares } = useClaims(client, wallet, chainInfo, { claimExpiredShares: options });
|
|
340
318
|
return claimExpiredShares;
|
|
341
319
|
}
|
|
342
320
|
/**
|
|
343
321
|
* @deprecated Use useDelegation() instead
|
|
344
322
|
*/
|
|
345
|
-
function useDelegateTo(options) {
|
|
346
|
-
const { client, wallet, chainInfo } =
|
|
323
|
+
export function useDelegateTo(options) {
|
|
324
|
+
const { client, wallet, chainInfo } = useMailerContext();
|
|
347
325
|
const { delegateTo } = useDelegation(client, wallet, chainInfo, { delegateTo: options });
|
|
348
326
|
return delegateTo;
|
|
349
327
|
}
|
|
350
328
|
/**
|
|
351
329
|
* @deprecated Use useDelegation() instead
|
|
352
330
|
*/
|
|
353
|
-
function useRejectDelegation(options) {
|
|
354
|
-
const { client, wallet, chainInfo } =
|
|
331
|
+
export function useRejectDelegation(options) {
|
|
332
|
+
const { client, wallet, chainInfo } = useMailerContext();
|
|
355
333
|
const { rejectDelegation } = useDelegation(client, wallet, chainInfo, { rejectDelegation: options });
|
|
356
334
|
return rejectDelegation;
|
|
357
335
|
}
|
|
358
336
|
/**
|
|
359
337
|
* @deprecated Use usePermissions() instead
|
|
360
338
|
*/
|
|
361
|
-
function useSetPermission(options) {
|
|
362
|
-
const { client, wallet, chainInfo } =
|
|
339
|
+
export function useSetPermission(options) {
|
|
340
|
+
const { client, wallet, chainInfo } = useMailerContext();
|
|
363
341
|
const { setPermission } = usePermissions(client, wallet, chainInfo, { setPermission: options });
|
|
364
342
|
return setPermission;
|
|
365
343
|
}
|
|
366
344
|
/**
|
|
367
345
|
* @deprecated Use usePermissions() instead
|
|
368
346
|
*/
|
|
369
|
-
function useRemovePermission(options) {
|
|
370
|
-
const { client, wallet, chainInfo } =
|
|
347
|
+
export function useRemovePermission(options) {
|
|
348
|
+
const { client, wallet, chainInfo } = useMailerContext();
|
|
371
349
|
const { removePermission } = usePermissions(client, wallet, chainInfo, { removePermission: options });
|
|
372
350
|
return removePermission;
|
|
373
351
|
}
|
|
374
352
|
/**
|
|
375
353
|
* @deprecated Use useOwnerOperations() instead
|
|
376
354
|
*/
|
|
377
|
-
function useSetFees(options) {
|
|
378
|
-
const { client, wallet, chainInfo } =
|
|
355
|
+
export function useSetFees(options) {
|
|
356
|
+
const { client, wallet, chainInfo } = useMailerContext();
|
|
379
357
|
const { setFees } = useOwnerOperations(client, wallet, chainInfo, { setFees: options });
|
|
380
358
|
return setFees;
|
|
381
359
|
}
|
|
382
360
|
/**
|
|
383
361
|
* @deprecated Use useContractControl() instead
|
|
384
362
|
*/
|
|
385
|
-
function usePause(options) {
|
|
386
|
-
const { client, wallet, chainInfo } =
|
|
363
|
+
export function usePause(options) {
|
|
364
|
+
const { client, wallet, chainInfo } = useMailerContext();
|
|
387
365
|
const { pause } = useContractControl(client, wallet, chainInfo, { pause: options });
|
|
388
366
|
return pause;
|
|
389
367
|
}
|
|
390
368
|
/**
|
|
391
369
|
* @deprecated Use useContractControl() instead
|
|
392
370
|
*/
|
|
393
|
-
function useUnpause(options) {
|
|
394
|
-
const { client, wallet, chainInfo } =
|
|
371
|
+
export function useUnpause(options) {
|
|
372
|
+
const { client, wallet, chainInfo } = useMailerContext();
|
|
395
373
|
const { unpause } = useContractControl(client, wallet, chainInfo, { unpause: options });
|
|
396
374
|
return unpause;
|
|
397
375
|
}
|
|
398
376
|
/**
|
|
399
377
|
* @deprecated Use useContractControl() instead
|
|
400
378
|
*/
|
|
401
|
-
function useEmergencyUnpause(options) {
|
|
402
|
-
const { client, wallet, chainInfo } =
|
|
379
|
+
export function useEmergencyUnpause(options) {
|
|
380
|
+
const { client, wallet, chainInfo } = useMailerContext();
|
|
403
381
|
const { emergencyUnpause } = useContractControl(client, wallet, chainInfo, { emergencyUnpause: options });
|
|
404
382
|
return emergencyUnpause;
|
|
405
383
|
}
|
|
406
384
|
/**
|
|
407
385
|
* @deprecated Use useOwnerOperations() instead
|
|
408
386
|
*/
|
|
409
|
-
function useDistributeClaimableFunds(options) {
|
|
410
|
-
const { client, wallet, chainInfo } =
|
|
387
|
+
export function useDistributeClaimableFunds(options) {
|
|
388
|
+
const { client, wallet, chainInfo } = useMailerContext();
|
|
411
389
|
const { distributeClaimableFunds } = useOwnerOperations(client, wallet, chainInfo, { distributeClaimableFunds: options });
|
|
412
390
|
return distributeClaimableFunds;
|
|
413
391
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMailerMutations.js","sourceRoot":"","sources":["../../../../../src/react/hooks/useMailerMutations.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useMailerMutations.js","sourceRoot":"","sources":["../../../../../src/react/hooks/useMailerMutations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAyC,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC3G,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAKrD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,UAAU,YAAY,CAC1B,MAA2B,EAC3B,eAAuB,EACvB,SAAoB,EACpB,OAGC;IAED,MAAM,WAAW,GAAG,cAAc,EAAE,CAAC;IAErC,MAAM,WAAW,GAAG,WAAW,CAAC;QAC9B,UAAU,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,GAAG,KAAK,EAAE,mBAAmB,GAAG,KAAK,EAAE,EAAE,EAAE,CACrF,MAAM,CAAC,WAAW,CAAC,eAAe,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,QAAQ,EAAE,mBAAmB,EAAE,CAAC;QAClG,SAAS,EAAE,GAAG,EAAE;YACd,WAAW,CAAC,iBAAiB,CAAC,EAAE,QAAQ,EAAE,eAAe,CAAC,eAAe,EAAE,EAAE,CAAC,CAAC;YAC/E,WAAW,CAAC,iBAAiB,CAAC,EAAE,QAAQ,EAAE,eAAe,CAAC,cAAc,EAAE,EAAE,CAAC,CAAC;QAChF,CAAC;QACD,GAAG,OAAO,E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,EAAE,SAAS,EAAE,GAAG,gBAAgB,EAAE,CAAC;IACzD,MAAM,EAAE,gBAAgB,EAAE,GAAG,kBAAkB,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,EAAE,gBAAgB,EAAE,OAAO,EAAE,CAAC,CAAC;IAC1G,OAAO,gBAAgB,CAAC;AAC1B,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,2BAA2B,CACzC,OAA8E;IAE9E,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,gBAAgB,EAAE,CAAC;IACzD,MAAM,EAAE,wBAAwB,EAAE,GAAG,kBAAkB,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,EAAE,wBAAwB,EAAE,OAAO,EAAE,CAAC,CAAC;IAC1H,OAAO,wBAAwB,CAAC;AAClC,CAAC"}
|
|
@@ -1,33 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.mailerQueryKeys = void 0;
|
|
4
|
-
exports.useFees = useFees;
|
|
5
|
-
exports.useClaimableAmounts = useClaimableAmounts;
|
|
6
|
-
exports.useDelegationAndPermissions = useDelegationAndPermissions;
|
|
7
|
-
exports.useContractState = useContractState;
|
|
8
|
-
exports.useWalletAddress = useWalletAddress;
|
|
9
|
-
exports.useChainType = useChainType;
|
|
10
|
-
exports.useGetSendFee = useGetSendFee;
|
|
11
|
-
exports.useGetDelegationFee = useGetDelegationFee;
|
|
12
|
-
exports.useGetClaimableAmount = useGetClaimableAmount;
|
|
13
|
-
exports.useGetOwnerClaimable = useGetOwnerClaimable;
|
|
14
|
-
exports.useGetDelegation = useGetDelegation;
|
|
15
|
-
exports.useIsPaused = useIsPaused;
|
|
16
|
-
exports.useHasPermission = useHasPermission;
|
|
17
|
-
const react_query_1 = require("@tanstack/react-query");
|
|
18
|
-
const types_1 = require("@sudobility/types");
|
|
1
|
+
import { useQuery } from '@tanstack/react-query';
|
|
2
|
+
import { ChainType } from '@sudobility/types';
|
|
19
3
|
/**
|
|
20
4
|
* Query keys for React Query cache management
|
|
21
5
|
*/
|
|
22
|
-
|
|
6
|
+
export const mailerQueryKeys = {
|
|
23
7
|
all: ['mailer'],
|
|
24
|
-
sendFee: () => [...
|
|
25
|
-
delegationFee: () => [...
|
|
26
|
-
claimableAmount: (address) => [...
|
|
27
|
-
ownerClaimable: () => [...
|
|
28
|
-
delegation: (address) => [...
|
|
29
|
-
isPaused: () => [...
|
|
30
|
-
permissions: (contractAddress, walletAddress) => [...
|
|
8
|
+
sendFee: () => [...mailerQueryKeys.all, 'sendFee'],
|
|
9
|
+
delegationFee: () => [...mailerQueryKeys.all, 'delegationFee'],
|
|
10
|
+
claimableAmount: (address) => [...mailerQueryKeys.all, 'claimableAmount', address],
|
|
11
|
+
ownerClaimable: () => [...mailerQueryKeys.all, 'ownerClaimable'],
|
|
12
|
+
delegation: (address) => [...mailerQueryKeys.all, 'delegation', address],
|
|
13
|
+
isPaused: () => [...mailerQueryKeys.all, 'isPaused'],
|
|
14
|
+
permissions: (contractAddress, walletAddress) => [...mailerQueryKeys.all, 'permissions', contractAddress, walletAddress],
|
|
31
15
|
};
|
|
32
16
|
/**
|
|
33
17
|
* Hook for fee-related queries
|
|
@@ -48,11 +32,11 @@ exports.mailerQueryKeys = {
|
|
|
48
32
|
* }
|
|
49
33
|
* ```
|
|
50
34
|
*/
|
|
51
|
-
function useFees(client, chainInfo, publicClientOrConnection, options) {
|
|
52
|
-
const sendFee =
|
|
53
|
-
queryKey:
|
|
35
|
+
export function useFees(client, chainInfo, publicClientOrConnection, options) {
|
|
36
|
+
const sendFee = useQuery({
|
|
37
|
+
queryKey: mailerQueryKeys.sendFee(),
|
|
54
38
|
queryFn: () => {
|
|
55
|
-
if (chainInfo.chainType ===
|
|
39
|
+
if (chainInfo.chainType === ChainType.EVM) {
|
|
56
40
|
return client.getSendFee(chainInfo, publicClientOrConnection);
|
|
57
41
|
}
|
|
58
42
|
else {
|
|
@@ -62,10 +46,10 @@ function useFees(client, chainInfo, publicClientOrConnection, options) {
|
|
|
62
46
|
staleTime: 5 * 60 * 1000, // 5 minutes - fees don't change often
|
|
63
47
|
...options?.sendFee,
|
|
64
48
|
});
|
|
65
|
-
const delegationFee =
|
|
66
|
-
queryKey:
|
|
49
|
+
const delegationFee = useQuery({
|
|
50
|
+
queryKey: mailerQueryKeys.delegationFee(),
|
|
67
51
|
queryFn: () => {
|
|
68
|
-
if (chainInfo.chainType ===
|
|
52
|
+
if (chainInfo.chainType === ChainType.EVM) {
|
|
69
53
|
return client.getDelegationFee(chainInfo, publicClientOrConnection);
|
|
70
54
|
}
|
|
71
55
|
else {
|
|
@@ -101,14 +85,14 @@ function useFees(client, chainInfo, publicClientOrConnection, options) {
|
|
|
101
85
|
* }
|
|
102
86
|
* ```
|
|
103
87
|
*/
|
|
104
|
-
function useClaimableAmounts(client, chainInfo, address, publicClientOrConnection, options) {
|
|
105
|
-
const claimableAmount =
|
|
106
|
-
queryKey:
|
|
88
|
+
export function useClaimableAmounts(client, chainInfo, address, publicClientOrConnection, options) {
|
|
89
|
+
const claimableAmount = useQuery({
|
|
90
|
+
queryKey: mailerQueryKeys.claimableAmount(address),
|
|
107
91
|
queryFn: async () => {
|
|
108
92
|
if (!address)
|
|
109
93
|
return BigInt(0);
|
|
110
94
|
let result;
|
|
111
|
-
if (chainInfo.chainType ===
|
|
95
|
+
if (chainInfo.chainType === ChainType.EVM) {
|
|
112
96
|
result = await client.getRecipientClaimable(address, chainInfo, publicClientOrConnection);
|
|
113
97
|
}
|
|
114
98
|
else {
|
|
@@ -121,10 +105,10 @@ function useClaimableAmounts(client, chainInfo, address, publicClientOrConnectio
|
|
|
121
105
|
staleTime: 30 * 1000, // 30 seconds
|
|
122
106
|
...options?.claimableAmount,
|
|
123
107
|
});
|
|
124
|
-
const ownerClaimable =
|
|
125
|
-
queryKey:
|
|
108
|
+
const ownerClaimable = useQuery({
|
|
109
|
+
queryKey: mailerQueryKeys.ownerClaimable(),
|
|
126
110
|
queryFn: () => {
|
|
127
|
-
if (chainInfo.chainType ===
|
|
111
|
+
if (chainInfo.chainType === ChainType.EVM) {
|
|
128
112
|
return client.getOwnerClaimable(chainInfo, publicClientOrConnection);
|
|
129
113
|
}
|
|
130
114
|
else {
|
|
@@ -164,13 +148,13 @@ function useClaimableAmounts(client, chainInfo, address, publicClientOrConnectio
|
|
|
164
148
|
* }
|
|
165
149
|
* ```
|
|
166
150
|
*/
|
|
167
|
-
function useDelegationAndPermissions(client, chainInfo, params, publicClientOrConnection, options) {
|
|
168
|
-
const delegation =
|
|
169
|
-
queryKey:
|
|
151
|
+
export function useDelegationAndPermissions(client, chainInfo, params, publicClientOrConnection, options) {
|
|
152
|
+
const delegation = useQuery({
|
|
153
|
+
queryKey: mailerQueryKeys.delegation(params?.delegationAddress),
|
|
170
154
|
queryFn: async () => {
|
|
171
155
|
if (!params?.delegationAddress)
|
|
172
156
|
return null;
|
|
173
|
-
if (chainInfo.chainType ===
|
|
157
|
+
if (chainInfo.chainType === ChainType.EVM) {
|
|
174
158
|
return client.getDelegation(params.delegationAddress, chainInfo, publicClientOrConnection);
|
|
175
159
|
}
|
|
176
160
|
else {
|
|
@@ -181,8 +165,8 @@ function useDelegationAndPermissions(client, chainInfo, params, publicClientOrCo
|
|
|
181
165
|
staleTime: 30 * 1000,
|
|
182
166
|
...options?.delegation,
|
|
183
167
|
});
|
|
184
|
-
const hasPermission =
|
|
185
|
-
queryKey:
|
|
168
|
+
const hasPermission = useQuery({
|
|
169
|
+
queryKey: mailerQueryKeys.permissions(params?.contractAddress, params?.walletAddress),
|
|
186
170
|
queryFn: async () => {
|
|
187
171
|
if (!params?.contractAddress || !params?.walletAddress) {
|
|
188
172
|
return false;
|
|
@@ -214,11 +198,11 @@ function useDelegationAndPermissions(client, chainInfo, params, publicClientOrCo
|
|
|
214
198
|
* }
|
|
215
199
|
* ```
|
|
216
200
|
*/
|
|
217
|
-
function useContractState(client, chainInfo, publicClientOrConnection, options) {
|
|
218
|
-
const isPaused =
|
|
219
|
-
queryKey:
|
|
201
|
+
export function useContractState(client, chainInfo, publicClientOrConnection, options) {
|
|
202
|
+
const isPaused = useQuery({
|
|
203
|
+
queryKey: mailerQueryKeys.isPaused(),
|
|
220
204
|
queryFn: () => {
|
|
221
|
-
if (chainInfo.chainType ===
|
|
205
|
+
if (chainInfo.chainType === ChainType.EVM) {
|
|
222
206
|
return client.isPaused(chainInfo, publicClientOrConnection);
|
|
223
207
|
}
|
|
224
208
|
else {
|
|
@@ -243,7 +227,7 @@ function useContractState(client, chainInfo, publicClientOrConnection, options)
|
|
|
243
227
|
* }
|
|
244
228
|
* ```
|
|
245
229
|
*/
|
|
246
|
-
function useWalletAddress(wallet) {
|
|
230
|
+
export function useWalletAddress(wallet) {
|
|
247
231
|
if (!wallet)
|
|
248
232
|
return undefined;
|
|
249
233
|
// For EVM wallets
|
|
@@ -267,65 +251,65 @@ function useWalletAddress(wallet) {
|
|
|
267
251
|
* }
|
|
268
252
|
* ```
|
|
269
253
|
*/
|
|
270
|
-
function useChainType(chainInfo) {
|
|
271
|
-
return chainInfo.chainType ||
|
|
254
|
+
export function useChainType(chainInfo) {
|
|
255
|
+
return chainInfo.chainType || ChainType.EVM;
|
|
272
256
|
}
|
|
273
257
|
// ========== Legacy individual hooks for backward compatibility ==========
|
|
274
258
|
// These use context for convenience but the grouped hooks above are preferred
|
|
275
|
-
|
|
259
|
+
import { useMailerContext } from '../context/MailerProvider';
|
|
276
260
|
/**
|
|
277
261
|
* @deprecated Use useFees() instead
|
|
278
262
|
*/
|
|
279
|
-
function useGetSendFee(options) {
|
|
280
|
-
const { client, chainInfo } =
|
|
263
|
+
export function useGetSendFee(options) {
|
|
264
|
+
const { client, chainInfo } = useMailerContext();
|
|
281
265
|
const { sendFee } = useFees(client, chainInfo, undefined, { sendFee: options });
|
|
282
266
|
return sendFee;
|
|
283
267
|
}
|
|
284
268
|
/**
|
|
285
269
|
* @deprecated Use useFees() instead
|
|
286
270
|
*/
|
|
287
|
-
function useGetDelegationFee(options) {
|
|
288
|
-
const { client, chainInfo } =
|
|
271
|
+
export function useGetDelegationFee(options) {
|
|
272
|
+
const { client, chainInfo } = useMailerContext();
|
|
289
273
|
const { delegationFee } = useFees(client, chainInfo, undefined, { delegationFee: options });
|
|
290
274
|
return delegationFee;
|
|
291
275
|
}
|
|
292
276
|
/**
|
|
293
277
|
* @deprecated Use useClaimableAmounts() instead
|
|
294
278
|
*/
|
|
295
|
-
function useGetClaimableAmount(address, options) {
|
|
296
|
-
const { client, chainInfo } =
|
|
279
|
+
export function useGetClaimableAmount(address, options) {
|
|
280
|
+
const { client, chainInfo } = useMailerContext();
|
|
297
281
|
const { claimableAmount } = useClaimableAmounts(client, chainInfo, address, undefined, { claimableAmount: options });
|
|
298
282
|
return claimableAmount;
|
|
299
283
|
}
|
|
300
284
|
/**
|
|
301
285
|
* @deprecated Use useClaimableAmounts() instead
|
|
302
286
|
*/
|
|
303
|
-
function useGetOwnerClaimable(options) {
|
|
304
|
-
const { client, chainInfo } =
|
|
287
|
+
export function useGetOwnerClaimable(options) {
|
|
288
|
+
const { client, chainInfo } = useMailerContext();
|
|
305
289
|
const { ownerClaimable } = useClaimableAmounts(client, chainInfo, undefined, undefined, { ownerClaimable: options });
|
|
306
290
|
return ownerClaimable;
|
|
307
291
|
}
|
|
308
292
|
/**
|
|
309
293
|
* @deprecated Use useDelegationAndPermissions() instead
|
|
310
294
|
*/
|
|
311
|
-
function useGetDelegation(address, options) {
|
|
312
|
-
const { client, chainInfo } =
|
|
295
|
+
export function useGetDelegation(address, options) {
|
|
296
|
+
const { client, chainInfo } = useMailerContext();
|
|
313
297
|
const { delegation } = useDelegationAndPermissions(client, chainInfo, { delegationAddress: address }, undefined, { delegation: options });
|
|
314
298
|
return delegation;
|
|
315
299
|
}
|
|
316
300
|
/**
|
|
317
301
|
* @deprecated Use useContractState() instead
|
|
318
302
|
*/
|
|
319
|
-
function useIsPaused(options) {
|
|
320
|
-
const { client, chainInfo } =
|
|
303
|
+
export function useIsPaused(options) {
|
|
304
|
+
const { client, chainInfo } = useMailerContext();
|
|
321
305
|
const { isPaused } = useContractState(client, chainInfo, undefined, { isPaused: options });
|
|
322
306
|
return isPaused;
|
|
323
307
|
}
|
|
324
308
|
/**
|
|
325
309
|
* @deprecated Use useDelegationAndPermissions() instead
|
|
326
310
|
*/
|
|
327
|
-
function useHasPermission(contractAddress, walletAddress, options) {
|
|
328
|
-
const { client, chainInfo } =
|
|
311
|
+
export function useHasPermission(contractAddress, walletAddress, options) {
|
|
312
|
+
const { client, chainInfo } = useMailerContext();
|
|
329
313
|
const { hasPermission } = useDelegationAndPermissions(client, chainInfo, { contractAddress, walletAddress }, undefined, { hasPermission: options });
|
|
330
314
|
return hasPermission;
|
|
331
315
|
}
|