@sudobility/contracts 1.12.0 → 1.13.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/dist/evm/src/evm/{mailer-client.d.ts → evm-mailer-client.d.ts} +146 -50
- package/dist/evm/src/evm/evm-mailer-client.d.ts.map +1 -0
- package/dist/evm/src/evm/evm-mailer-client.js +924 -0
- package/dist/evm/src/evm/evm-mailer-client.js.map +1 -0
- package/dist/evm/src/evm/index.d.ts +1 -1
- 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 +1 -1
- package/dist/solana/solana/index.d.ts.map +1 -1
- package/dist/solana/solana/index.js +4 -3
- package/dist/solana/solana/index.js.map +1 -1
- package/dist/solana/solana/solana-mailer-client.d.ts +209 -0
- package/dist/solana/solana/solana-mailer-client.d.ts.map +1 -0
- package/dist/solana/solana/solana-mailer-client.js +1004 -0
- package/dist/solana/solana/solana-mailer-client.js.map +1 -0
- package/dist/solana/solana/types.d.ts +3 -2
- package/dist/solana/solana/types.d.ts.map +1 -1
- package/dist/solana/solana/types.js.map +1 -1
- package/dist/{unified-esm/src/evm/mailer-client.d.ts → unified/src/evm/evm-mailer-client.d.ts} +146 -50
- package/dist/unified/src/evm/evm-mailer-client.d.ts.map +1 -0
- package/dist/unified/src/evm/evm-mailer-client.js +924 -0
- package/dist/unified/src/evm/evm-mailer-client.js.map +1 -0
- package/dist/unified/src/evm/index.d.ts +1 -1
- package/dist/unified/src/evm/index.d.ts.map +1 -1
- package/dist/unified/src/evm/index.js +4 -4
- package/dist/unified/src/evm/index.js.map +1 -1
- package/dist/unified/src/react/context/MailerProvider.d.ts +26 -20
- package/dist/unified/src/react/context/MailerProvider.d.ts.map +1 -1
- package/dist/unified/src/react/context/MailerProvider.js +26 -26
- package/dist/unified/src/react/context/MailerProvider.js.map +1 -1
- package/dist/unified/src/react/hooks/useMailerMutations.d.ts +225 -192
- package/dist/unified/src/react/hooks/useMailerMutations.d.ts.map +1 -1
- package/dist/unified/src/react/hooks/useMailerMutations.js +263 -266
- package/dist/unified/src/react/hooks/useMailerMutations.js.map +1 -1
- package/dist/unified/src/react/hooks/useMailerQueries.d.ts +117 -63
- package/dist/unified/src/react/hooks/useMailerQueries.d.ts.map +1 -1
- package/dist/unified/src/react/hooks/useMailerQueries.js +239 -104
- package/dist/unified/src/react/hooks/useMailerQueries.js.map +1 -1
- package/dist/unified/src/react/index.d.ts +5 -3
- package/dist/unified/src/react/index.d.ts.map +1 -1
- package/dist/unified/src/react/index.js +41 -26
- package/dist/unified/src/react/index.js.map +1 -1
- package/dist/unified/src/solana/index.d.ts +1 -1
- package/dist/unified/src/solana/index.d.ts.map +1 -1
- package/dist/unified/src/solana/index.js +4 -3
- package/dist/unified/src/solana/index.js.map +1 -1
- package/dist/unified/src/solana/solana-mailer-client.d.ts +209 -0
- package/dist/unified/src/solana/solana-mailer-client.d.ts.map +1 -0
- package/dist/unified/src/solana/solana-mailer-client.js +1004 -0
- package/dist/unified/src/solana/solana-mailer-client.js.map +1 -0
- package/dist/unified/src/solana/types.d.ts +3 -2
- package/dist/unified/src/solana/types.d.ts.map +1 -1
- package/dist/unified/src/solana/types.js.map +1 -1
- package/dist/unified/src/unified/index.d.ts +1 -1
- package/dist/unified/src/unified/index.d.ts.map +1 -1
- package/dist/unified/src/unified/onchain-mailer-client.d.ts +187 -268
- package/dist/unified/src/unified/onchain-mailer-client.d.ts.map +1 -1
- package/dist/unified/src/unified/onchain-mailer-client.js +539 -1614
- package/dist/unified/src/unified/onchain-mailer-client.js.map +1 -1
- package/dist/unified/src/unified/types.d.ts +23 -6
- package/dist/unified/src/unified/types.d.ts.map +1 -1
- package/dist/{unified/src/evm/mailer-client.d.ts → unified-esm/src/evm/evm-mailer-client.d.ts} +146 -50
- package/dist/unified-esm/src/evm/evm-mailer-client.d.ts.map +1 -0
- package/dist/unified-esm/src/evm/evm-mailer-client.js +920 -0
- package/dist/unified-esm/src/evm/evm-mailer-client.js.map +1 -0
- package/dist/unified-esm/src/evm/index.d.ts +1 -1
- package/dist/unified-esm/src/evm/index.d.ts.map +1 -1
- package/dist/unified-esm/src/evm/index.js +2 -2
- package/dist/unified-esm/src/evm/index.js.map +1 -1
- package/dist/unified-esm/src/react/context/MailerProvider.d.ts +26 -20
- package/dist/unified-esm/src/react/context/MailerProvider.d.ts.map +1 -1
- package/dist/unified-esm/src/react/context/MailerProvider.js +25 -26
- package/dist/unified-esm/src/react/context/MailerProvider.js.map +1 -1
- package/dist/unified-esm/src/react/hooks/useMailerMutations.d.ts +225 -192
- package/dist/unified-esm/src/react/hooks/useMailerMutations.d.ts.map +1 -1
- package/dist/unified-esm/src/react/hooks/useMailerMutations.js +254 -262
- package/dist/unified-esm/src/react/hooks/useMailerMutations.js.map +1 -1
- package/dist/unified-esm/src/react/hooks/useMailerQueries.d.ts +117 -63
- package/dist/unified-esm/src/react/hooks/useMailerQueries.d.ts.map +1 -1
- package/dist/unified-esm/src/react/hooks/useMailerQueries.js +232 -102
- package/dist/unified-esm/src/react/hooks/useMailerQueries.js.map +1 -1
- package/dist/unified-esm/src/react/index.d.ts +5 -3
- package/dist/unified-esm/src/react/index.d.ts.map +1 -1
- package/dist/unified-esm/src/react/index.js +9 -5
- package/dist/unified-esm/src/react/index.js.map +1 -1
- package/dist/unified-esm/src/solana/index.d.ts +1 -1
- package/dist/unified-esm/src/solana/index.d.ts.map +1 -1
- package/dist/unified-esm/src/solana/index.js +2 -1
- package/dist/unified-esm/src/solana/index.js.map +1 -1
- package/dist/unified-esm/src/solana/solana-mailer-client.d.ts +209 -0
- package/dist/unified-esm/src/solana/solana-mailer-client.d.ts.map +1 -0
- package/dist/unified-esm/src/solana/solana-mailer-client.js +1000 -0
- package/dist/unified-esm/src/solana/solana-mailer-client.js.map +1 -0
- package/dist/unified-esm/src/solana/types.d.ts +3 -2
- package/dist/unified-esm/src/solana/types.d.ts.map +1 -1
- package/dist/unified-esm/src/solana/types.js.map +1 -1
- package/dist/unified-esm/src/unified/index.d.ts +1 -1
- package/dist/unified-esm/src/unified/index.d.ts.map +1 -1
- package/dist/unified-esm/src/unified/onchain-mailer-client.d.ts +187 -268
- package/dist/unified-esm/src/unified/onchain-mailer-client.d.ts.map +1 -1
- package/dist/unified-esm/src/unified/onchain-mailer-client.js +539 -1614
- package/dist/unified-esm/src/unified/onchain-mailer-client.js.map +1 -1
- package/dist/unified-esm/src/unified/types.d.ts +23 -6
- package/dist/unified-esm/src/unified/types.d.ts.map +1 -1
- package/package.json +5 -4
- package/programs/mailer/Cargo.toml +1 -1
- package/dist/evm/src/evm/mailer-client.d.ts.map +0 -1
- package/dist/evm/src/evm/mailer-client.js +0 -619
- package/dist/evm/src/evm/mailer-client.js.map +0 -1
- package/dist/solana/solana/mailer-client.d.ts +0 -282
- package/dist/solana/solana/mailer-client.d.ts.map +0 -1
- package/dist/solana/solana/mailer-client.js +0 -989
- package/dist/solana/solana/mailer-client.js.map +0 -1
- package/dist/unified/src/evm/mailer-client.d.ts.map +0 -1
- package/dist/unified/src/evm/mailer-client.js +0 -619
- package/dist/unified/src/evm/mailer-client.js.map +0 -1
- package/dist/unified/src/solana/mailer-client.d.ts +0 -282
- package/dist/unified/src/solana/mailer-client.d.ts.map +0 -1
- package/dist/unified/src/solana/mailer-client.js +0 -989
- package/dist/unified/src/solana/mailer-client.js.map +0 -1
- package/dist/unified-esm/src/evm/mailer-client.d.ts.map +0 -1
- package/dist/unified-esm/src/evm/mailer-client.js +0 -615
- package/dist/unified-esm/src/evm/mailer-client.js.map +0 -1
- package/dist/unified-esm/src/solana/mailer-client.d.ts +0 -282
- package/dist/unified-esm/src/solana/mailer-client.d.ts.map +0 -1
- package/dist/unified-esm/src/solana/mailer-client.js +0 -985
- package/dist/unified-esm/src/solana/mailer-client.js.map +0 -1
|
@@ -1,16 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
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;
|
|
4
10
|
exports.useGetSendFee = useGetSendFee;
|
|
5
11
|
exports.useGetDelegationFee = useGetDelegationFee;
|
|
6
12
|
exports.useGetClaimableAmount = useGetClaimableAmount;
|
|
7
13
|
exports.useGetOwnerClaimable = useGetOwnerClaimable;
|
|
8
14
|
exports.useGetDelegation = useGetDelegation;
|
|
9
15
|
exports.useIsPaused = useIsPaused;
|
|
10
|
-
exports.
|
|
11
|
-
exports.useChainType = useChainType;
|
|
16
|
+
exports.useHasPermission = useHasPermission;
|
|
12
17
|
const react_query_1 = require("@tanstack/react-query");
|
|
13
|
-
const
|
|
18
|
+
const types_1 = require("@sudobility/types");
|
|
14
19
|
/**
|
|
15
20
|
* Query keys for React Query cache management
|
|
16
21
|
*/
|
|
@@ -22,176 +27,306 @@ exports.mailerQueryKeys = {
|
|
|
22
27
|
ownerClaimable: () => [...exports.mailerQueryKeys.all, 'ownerClaimable'],
|
|
23
28
|
delegation: (address) => [...exports.mailerQueryKeys.all, 'delegation', address],
|
|
24
29
|
isPaused: () => [...exports.mailerQueryKeys.all, 'isPaused'],
|
|
30
|
+
permissions: (contractAddress, walletAddress) => [...exports.mailerQueryKeys.all, 'permissions', contractAddress, walletAddress],
|
|
25
31
|
};
|
|
26
32
|
/**
|
|
27
|
-
* Hook
|
|
33
|
+
* Hook for fee-related queries
|
|
28
34
|
*
|
|
29
35
|
* @example
|
|
30
36
|
* ```tsx
|
|
31
37
|
* function FeeDisplay() {
|
|
32
|
-
* const {
|
|
38
|
+
* const { sendFee, delegationFee } = useFees(client, chainInfo);
|
|
33
39
|
*
|
|
34
|
-
* if (isLoading) return <div>Loading...</div>;
|
|
35
|
-
*
|
|
40
|
+
* if (sendFee.isLoading) return <div>Loading...</div>;
|
|
41
|
+
*
|
|
42
|
+
* return (
|
|
43
|
+
* <div>
|
|
44
|
+
* Send Fee: {Number(sendFee.data) / 1_000_000} USDC
|
|
45
|
+
* Delegation Fee: {Number(delegationFee.data) / 1_000_000} USDC
|
|
46
|
+
* </div>
|
|
47
|
+
* );
|
|
36
48
|
* }
|
|
37
49
|
* ```
|
|
38
50
|
*/
|
|
39
|
-
function
|
|
40
|
-
const
|
|
41
|
-
return (0, react_query_1.useQuery)({
|
|
51
|
+
function useFees(client, chainInfo, publicClientOrConnection, options) {
|
|
52
|
+
const sendFee = (0, react_query_1.useQuery)({
|
|
42
53
|
queryKey: exports.mailerQueryKeys.sendFee(),
|
|
43
|
-
queryFn: () =>
|
|
54
|
+
queryFn: () => {
|
|
55
|
+
if (chainInfo.chainType === types_1.ChainType.EVM) {
|
|
56
|
+
return client.getSendFee(chainInfo, publicClientOrConnection);
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
return client.getSendFee(chainInfo, undefined, publicClientOrConnection);
|
|
60
|
+
}
|
|
61
|
+
},
|
|
44
62
|
staleTime: 5 * 60 * 1000, // 5 minutes - fees don't change often
|
|
45
|
-
...options,
|
|
63
|
+
...options?.sendFee,
|
|
46
64
|
});
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* Hook to get the current delegation fee
|
|
50
|
-
*
|
|
51
|
-
* @example
|
|
52
|
-
* ```tsx
|
|
53
|
-
* function DelegationFeeDisplay() {
|
|
54
|
-
* const { data: fee, isLoading } = useGetDelegationFee();
|
|
55
|
-
*
|
|
56
|
-
* if (isLoading) return <div>Loading...</div>;
|
|
57
|
-
* return <div>Delegation Fee: {Number(fee) / 1_000_000} USDC</div>;
|
|
58
|
-
* }
|
|
59
|
-
* ```
|
|
60
|
-
*/
|
|
61
|
-
function useGetDelegationFee(options) {
|
|
62
|
-
const client = (0, MailerProvider_1.useMailerClient)();
|
|
63
|
-
return (0, react_query_1.useQuery)({
|
|
65
|
+
const delegationFee = (0, react_query_1.useQuery)({
|
|
64
66
|
queryKey: exports.mailerQueryKeys.delegationFee(),
|
|
65
|
-
queryFn: () =>
|
|
66
|
-
|
|
67
|
-
|
|
67
|
+
queryFn: () => {
|
|
68
|
+
if (chainInfo.chainType === types_1.ChainType.EVM) {
|
|
69
|
+
return client.getDelegationFee(chainInfo, publicClientOrConnection);
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
return client.getDelegationFee(chainInfo, undefined, publicClientOrConnection);
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
staleTime: 5 * 60 * 1000,
|
|
76
|
+
...options?.delegationFee,
|
|
68
77
|
});
|
|
78
|
+
return {
|
|
79
|
+
sendFee,
|
|
80
|
+
delegationFee,
|
|
81
|
+
};
|
|
69
82
|
}
|
|
70
83
|
/**
|
|
71
|
-
* Hook
|
|
84
|
+
* Hook for claimable amount queries
|
|
72
85
|
*
|
|
73
|
-
* @param address - Address to check (defaults to connected wallet)
|
|
74
86
|
* @example
|
|
75
87
|
* ```tsx
|
|
76
|
-
* function
|
|
77
|
-
* const {
|
|
88
|
+
* function ClaimableDisplay({ address }: { address?: string }) {
|
|
89
|
+
* const { claimableAmount, ownerClaimable } = useClaimableAmounts(
|
|
90
|
+
* client,
|
|
91
|
+
* chainInfo,
|
|
92
|
+
* address
|
|
93
|
+
* );
|
|
78
94
|
*
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
*
|
|
95
|
+
* return (
|
|
96
|
+
* <div>
|
|
97
|
+
* User Claimable: {Number(claimableAmount.data) / 1_000_000} USDC
|
|
98
|
+
* Owner Claimable: {Number(ownerClaimable.data) / 1_000_000} USDC
|
|
99
|
+
* </div>
|
|
100
|
+
* );
|
|
82
101
|
* }
|
|
83
102
|
* ```
|
|
84
103
|
*/
|
|
85
|
-
function
|
|
86
|
-
const
|
|
87
|
-
return (0, react_query_1.useQuery)({
|
|
104
|
+
function useClaimableAmounts(client, chainInfo, address, publicClientOrConnection, options) {
|
|
105
|
+
const claimableAmount = (0, react_query_1.useQuery)({
|
|
88
106
|
queryKey: exports.mailerQueryKeys.claimableAmount(address),
|
|
89
|
-
queryFn: () =>
|
|
90
|
-
|
|
91
|
-
|
|
107
|
+
queryFn: async () => {
|
|
108
|
+
if (!address)
|
|
109
|
+
return BigInt(0);
|
|
110
|
+
let result;
|
|
111
|
+
if (chainInfo.chainType === types_1.ChainType.EVM) {
|
|
112
|
+
result = await client.getRecipientClaimable(address, chainInfo, publicClientOrConnection);
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
result = await client.getRecipientClaimable(address, chainInfo, undefined, publicClientOrConnection);
|
|
116
|
+
}
|
|
117
|
+
// Extract just the amount from the result
|
|
118
|
+
return result ? result.amount : BigInt(0);
|
|
119
|
+
},
|
|
120
|
+
enabled: Boolean(address),
|
|
121
|
+
staleTime: 30 * 1000, // 30 seconds
|
|
122
|
+
...options?.claimableAmount,
|
|
92
123
|
});
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* Hook to get owner's claimable fee balance
|
|
96
|
-
*
|
|
97
|
-
* @example
|
|
98
|
-
* ```tsx
|
|
99
|
-
* function OwnerDashboard() {
|
|
100
|
-
* const { data: amount, isLoading } = useGetOwnerClaimable();
|
|
101
|
-
*
|
|
102
|
-
* if (isLoading) return <div>Loading...</div>;
|
|
103
|
-
* return <div>Owner Fees: {Number(amount) / 1_000_000} USDC</div>;
|
|
104
|
-
* }
|
|
105
|
-
* ```
|
|
106
|
-
*/
|
|
107
|
-
function useGetOwnerClaimable(options) {
|
|
108
|
-
const client = (0, MailerProvider_1.useMailerClient)();
|
|
109
|
-
return (0, react_query_1.useQuery)({
|
|
124
|
+
const ownerClaimable = (0, react_query_1.useQuery)({
|
|
110
125
|
queryKey: exports.mailerQueryKeys.ownerClaimable(),
|
|
111
|
-
queryFn: () =>
|
|
112
|
-
|
|
113
|
-
|
|
126
|
+
queryFn: () => {
|
|
127
|
+
if (chainInfo.chainType === types_1.ChainType.EVM) {
|
|
128
|
+
return client.getOwnerClaimable(chainInfo, publicClientOrConnection);
|
|
129
|
+
}
|
|
130
|
+
else {
|
|
131
|
+
return client.getOwnerClaimable(chainInfo, undefined, publicClientOrConnection);
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
staleTime: 30 * 1000,
|
|
135
|
+
...options?.ownerClaimable,
|
|
114
136
|
});
|
|
137
|
+
return {
|
|
138
|
+
claimableAmount,
|
|
139
|
+
ownerClaimable,
|
|
140
|
+
};
|
|
115
141
|
}
|
|
116
142
|
/**
|
|
117
|
-
* Hook
|
|
143
|
+
* Hook for delegation and permission queries
|
|
118
144
|
*
|
|
119
|
-
* @param address - Address to check delegation for (defaults to connected wallet)
|
|
120
145
|
* @example
|
|
121
146
|
* ```tsx
|
|
122
|
-
* function DelegationStatus() {
|
|
123
|
-
* const {
|
|
147
|
+
* function DelegationStatus({ address }: { address: string }) {
|
|
148
|
+
* const { delegation, hasPermission } = useDelegationAndPermissions(
|
|
149
|
+
* client,
|
|
150
|
+
* chainInfo,
|
|
151
|
+
* {
|
|
152
|
+
* delegationAddress: address,
|
|
153
|
+
* contractAddress: '0xContract...',
|
|
154
|
+
* walletAddress: address
|
|
155
|
+
* }
|
|
156
|
+
* );
|
|
124
157
|
*
|
|
125
|
-
*
|
|
126
|
-
*
|
|
127
|
-
*
|
|
158
|
+
* return (
|
|
159
|
+
* <div>
|
|
160
|
+
* Delegated to: {delegation.data}
|
|
161
|
+
* Has Permission: {hasPermission.data ? 'Yes' : 'No'}
|
|
162
|
+
* </div>
|
|
163
|
+
* );
|
|
128
164
|
* }
|
|
129
165
|
* ```
|
|
130
166
|
*/
|
|
131
|
-
function
|
|
132
|
-
const
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
167
|
+
function useDelegationAndPermissions(client, chainInfo, params, publicClientOrConnection, options) {
|
|
168
|
+
const delegation = (0, react_query_1.useQuery)({
|
|
169
|
+
queryKey: exports.mailerQueryKeys.delegation(params?.delegationAddress),
|
|
170
|
+
queryFn: async () => {
|
|
171
|
+
if (!params?.delegationAddress)
|
|
172
|
+
return null;
|
|
173
|
+
if (chainInfo.chainType === types_1.ChainType.EVM) {
|
|
174
|
+
return client.getDelegation(params.delegationAddress, chainInfo, publicClientOrConnection);
|
|
175
|
+
}
|
|
176
|
+
else {
|
|
177
|
+
return client.getDelegation(params.delegationAddress, chainInfo, undefined, publicClientOrConnection);
|
|
178
|
+
}
|
|
179
|
+
},
|
|
180
|
+
enabled: Boolean(params?.delegationAddress),
|
|
181
|
+
staleTime: 30 * 1000,
|
|
182
|
+
...options?.delegation,
|
|
183
|
+
});
|
|
184
|
+
const hasPermission = (0, react_query_1.useQuery)({
|
|
185
|
+
queryKey: exports.mailerQueryKeys.permissions(params?.contractAddress, params?.walletAddress),
|
|
186
|
+
queryFn: async () => {
|
|
187
|
+
if (!params?.contractAddress || !params?.walletAddress) {
|
|
188
|
+
return false;
|
|
189
|
+
}
|
|
190
|
+
return client.hasPermission(chainInfo, params.contractAddress, params.walletAddress, publicClientOrConnection);
|
|
191
|
+
},
|
|
192
|
+
enabled: Boolean(params?.contractAddress && params?.walletAddress),
|
|
193
|
+
staleTime: 30 * 1000,
|
|
194
|
+
...options?.hasPermission,
|
|
138
195
|
});
|
|
196
|
+
return {
|
|
197
|
+
delegation,
|
|
198
|
+
hasPermission,
|
|
199
|
+
};
|
|
139
200
|
}
|
|
140
201
|
/**
|
|
141
|
-
* Hook
|
|
202
|
+
* Hook for contract state queries
|
|
142
203
|
*
|
|
143
204
|
* @example
|
|
144
205
|
* ```tsx
|
|
145
|
-
* function
|
|
146
|
-
* const {
|
|
206
|
+
* function ContractStatus() {
|
|
207
|
+
* const { isPaused } = useContractState(client, chainInfo);
|
|
147
208
|
*
|
|
148
|
-
* if (isLoading) return <div>Loading...</div>;
|
|
149
209
|
* return (
|
|
150
210
|
* <div>
|
|
151
|
-
* Contract
|
|
211
|
+
* Contract: {isPaused.data ? 'Paused' : 'Active'}
|
|
152
212
|
* </div>
|
|
153
213
|
* );
|
|
154
214
|
* }
|
|
155
215
|
* ```
|
|
156
216
|
*/
|
|
157
|
-
function
|
|
158
|
-
const
|
|
159
|
-
return (0, react_query_1.useQuery)({
|
|
217
|
+
function useContractState(client, chainInfo, publicClientOrConnection, options) {
|
|
218
|
+
const isPaused = (0, react_query_1.useQuery)({
|
|
160
219
|
queryKey: exports.mailerQueryKeys.isPaused(),
|
|
161
|
-
queryFn: () =>
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
220
|
+
queryFn: () => {
|
|
221
|
+
if (chainInfo.chainType === types_1.ChainType.EVM) {
|
|
222
|
+
return client.isPaused(chainInfo, publicClientOrConnection);
|
|
223
|
+
}
|
|
224
|
+
else {
|
|
225
|
+
return client.isPaused(chainInfo, undefined, publicClientOrConnection);
|
|
226
|
+
}
|
|
227
|
+
},
|
|
228
|
+
staleTime: 30 * 1000,
|
|
229
|
+
...options?.isPaused,
|
|
165
230
|
});
|
|
231
|
+
return {
|
|
232
|
+
isPaused,
|
|
233
|
+
};
|
|
166
234
|
}
|
|
167
235
|
/**
|
|
168
|
-
*
|
|
236
|
+
* Helper hook to get wallet address from different wallet types
|
|
169
237
|
*
|
|
170
238
|
* @example
|
|
171
239
|
* ```tsx
|
|
172
|
-
* function
|
|
173
|
-
* const address = useWalletAddress();
|
|
174
|
-
* return <div>
|
|
240
|
+
* function WalletDisplay({ wallet }: { wallet: Wallet }) {
|
|
241
|
+
* const address = useWalletAddress(wallet);
|
|
242
|
+
* return <div>Address: {address}</div>;
|
|
175
243
|
* }
|
|
176
244
|
* ```
|
|
177
245
|
*/
|
|
178
|
-
function useWalletAddress() {
|
|
179
|
-
|
|
180
|
-
|
|
246
|
+
function useWalletAddress(wallet) {
|
|
247
|
+
if (!wallet)
|
|
248
|
+
return undefined;
|
|
249
|
+
// For EVM wallets
|
|
250
|
+
if ('walletClient' in wallet && wallet.walletClient) {
|
|
251
|
+
return wallet.walletClient.account?.address;
|
|
252
|
+
}
|
|
253
|
+
// For Solana wallets
|
|
254
|
+
if ('wallet' in wallet && wallet.wallet) {
|
|
255
|
+
return wallet.wallet.publicKey?.toString();
|
|
256
|
+
}
|
|
257
|
+
return undefined;
|
|
181
258
|
}
|
|
182
259
|
/**
|
|
183
|
-
*
|
|
260
|
+
* Helper hook to get chain type from ChainInfo
|
|
184
261
|
*
|
|
185
262
|
* @example
|
|
186
263
|
* ```tsx
|
|
187
|
-
* function ChainBadge() {
|
|
188
|
-
* const chainType = useChainType();
|
|
264
|
+
* function ChainBadge({ chainInfo }: { chainInfo: ChainInfo }) {
|
|
265
|
+
* const chainType = useChainType(chainInfo);
|
|
189
266
|
* return <div>Chain: {chainType}</div>;
|
|
190
267
|
* }
|
|
191
268
|
* ```
|
|
192
269
|
*/
|
|
193
|
-
function useChainType() {
|
|
194
|
-
|
|
195
|
-
|
|
270
|
+
function useChainType(chainInfo) {
|
|
271
|
+
return chainInfo.chainType || types_1.ChainType.EVM;
|
|
272
|
+
}
|
|
273
|
+
// ========== Legacy individual hooks for backward compatibility ==========
|
|
274
|
+
// These use context for convenience but the grouped hooks above are preferred
|
|
275
|
+
const MailerProvider_1 = require("../context/MailerProvider");
|
|
276
|
+
/**
|
|
277
|
+
* @deprecated Use useFees() instead
|
|
278
|
+
*/
|
|
279
|
+
function useGetSendFee(options) {
|
|
280
|
+
const { client, chainInfo } = (0, MailerProvider_1.useMailerContext)();
|
|
281
|
+
const { sendFee } = useFees(client, chainInfo, undefined, { sendFee: options });
|
|
282
|
+
return sendFee;
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* @deprecated Use useFees() instead
|
|
286
|
+
*/
|
|
287
|
+
function useGetDelegationFee(options) {
|
|
288
|
+
const { client, chainInfo } = (0, MailerProvider_1.useMailerContext)();
|
|
289
|
+
const { delegationFee } = useFees(client, chainInfo, undefined, { delegationFee: options });
|
|
290
|
+
return delegationFee;
|
|
291
|
+
}
|
|
292
|
+
/**
|
|
293
|
+
* @deprecated Use useClaimableAmounts() instead
|
|
294
|
+
*/
|
|
295
|
+
function useGetClaimableAmount(address, options) {
|
|
296
|
+
const { client, chainInfo } = (0, MailerProvider_1.useMailerContext)();
|
|
297
|
+
const { claimableAmount } = useClaimableAmounts(client, chainInfo, address, undefined, { claimableAmount: options });
|
|
298
|
+
return claimableAmount;
|
|
299
|
+
}
|
|
300
|
+
/**
|
|
301
|
+
* @deprecated Use useClaimableAmounts() instead
|
|
302
|
+
*/
|
|
303
|
+
function useGetOwnerClaimable(options) {
|
|
304
|
+
const { client, chainInfo } = (0, MailerProvider_1.useMailerContext)();
|
|
305
|
+
const { ownerClaimable } = useClaimableAmounts(client, chainInfo, undefined, undefined, { ownerClaimable: options });
|
|
306
|
+
return ownerClaimable;
|
|
307
|
+
}
|
|
308
|
+
/**
|
|
309
|
+
* @deprecated Use useDelegationAndPermissions() instead
|
|
310
|
+
*/
|
|
311
|
+
function useGetDelegation(address, options) {
|
|
312
|
+
const { client, chainInfo } = (0, MailerProvider_1.useMailerContext)();
|
|
313
|
+
const { delegation } = useDelegationAndPermissions(client, chainInfo, { delegationAddress: address }, undefined, { delegation: options });
|
|
314
|
+
return delegation;
|
|
315
|
+
}
|
|
316
|
+
/**
|
|
317
|
+
* @deprecated Use useContractState() instead
|
|
318
|
+
*/
|
|
319
|
+
function useIsPaused(options) {
|
|
320
|
+
const { client, chainInfo } = (0, MailerProvider_1.useMailerContext)();
|
|
321
|
+
const { isPaused } = useContractState(client, chainInfo, undefined, { isPaused: options });
|
|
322
|
+
return isPaused;
|
|
323
|
+
}
|
|
324
|
+
/**
|
|
325
|
+
* @deprecated Use useDelegationAndPermissions() instead
|
|
326
|
+
*/
|
|
327
|
+
function useHasPermission(contractAddress, walletAddress, options) {
|
|
328
|
+
const { client, chainInfo } = (0, MailerProvider_1.useMailerContext)();
|
|
329
|
+
const { hasPermission } = useDelegationAndPermissions(client, chainInfo, { contractAddress, walletAddress }, undefined, { hasPermission: options });
|
|
330
|
+
return hasPermission;
|
|
196
331
|
}
|
|
197
332
|
//# sourceMappingURL=useMailerQueries.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMailerQueries.js","sourceRoot":"","sources":["../../../../../src/react/hooks/useMailerQueries.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"useMailerQueries.js","sourceRoot":"","sources":["../../../../../src/react/hooks/useMailerQueries.ts"],"names":[],"mappings":";;;AA0CA,0BAuCC;AAuBD,kDA6CC;AA2BD,kEAmDC;AAkBD,4CAwBC;AAaD,4CAcC;AAaD,oCAEC;AAUD,sCAMC;AAKD,kDAMC;AAKD,sDAOC;AAKD,oDAMC;AAKD,4CAaC;AAKD,kCAMC;AAKD,4CAcC;AAzZD,uDAAkF;AAClF,6CAA8C;AAO9C;;GAEG;AACU,QAAA,eAAe,GAAG;IAC7B,GAAG,EAAE,CAAC,QAAQ,CAAU;IACxB,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC,GAAG,uBAAe,CAAC,GAAG,EAAE,SAAS,CAAU;IAC3D,aAAa,EAAE,GAAG,EAAE,CAAC,CAAC,GAAG,uBAAe,CAAC,GAAG,EAAE,eAAe,CAAU;IACvE,eAAe,EAAE,CAAC,OAAgB,EAAE,EAAE,CAAC,CAAC,GAAG,uBAAe,CAAC,GAAG,EAAE,iBAAiB,EAAE,OAAO,CAAU;IACpG,cAAc,EAAE,GAAG,EAAE,CAAC,CAAC,GAAG,uBAAe,CAAC,GAAG,EAAE,gBAAgB,CAAU;IACzE,UAAU,EAAE,CAAC,OAAgB,EAAE,EAAE,CAAC,CAAC,GAAG,uBAAe,CAAC,GAAG,EAAE,YAAY,EAAE,OAAO,CAAU;IAC1F,QAAQ,EAAE,GAAG,EAAE,CAAC,CAAC,GAAG,uBAAe,CAAC,GAAG,EAAE,UAAU,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iCAAgB,GAAE,CAAC;IACjD,MAAM,EAAE,aAAa,EAAE,GAAG,2BAA2B,CACnD,MAAM,EACN,SAAS,EACT,EAAE,eAAe,EAAE,aAAa,EAAE,EAClC,SAAS,EACT,EAAE,aAAa,EAAE,OAAO,EAAE,CAC3B,CAAC;IACF,OAAO,aAAa,CAAC;AACvB,CAAC"}
|
|
@@ -30,8 +30,10 @@
|
|
|
30
30
|
* }
|
|
31
31
|
* ```
|
|
32
32
|
*/
|
|
33
|
-
export { MailerProvider, useMailerClient, QueryClient, QueryClientProvider } from './context/MailerProvider';
|
|
34
|
-
export {
|
|
35
|
-
export {
|
|
33
|
+
export { MailerProvider, useMailerClient, useMailerContext, QueryClient, QueryClientProvider } from './context/MailerProvider';
|
|
34
|
+
export { useFees, useClaimableAmounts, useDelegationAndPermissions, useContractState, mailerQueryKeys, } from './hooks/useMailerQueries';
|
|
35
|
+
export { useMessaging, useClaims, useDelegation, usePermissions, useContractControl, useOwnerOperations, } from './hooks/useMailerMutations';
|
|
36
|
+
export { useGetSendFee, useGetDelegationFee, useGetClaimableAmount, useGetOwnerClaimable, useGetDelegation, useIsPaused, useWalletAddress, useChainType, useHasPermission, } from './hooks/useMailerQueries';
|
|
37
|
+
export { useSendMessage, useSendPrepared, useClaimRevenue, useClaimOwnerShare, useClaimExpiredShares, useDelegateTo, useRejectDelegation, useSetFees, useSetPermission, useRemovePermission, usePause, useUnpause, useEmergencyUnpause, useDistributeClaimableFunds, } from './hooks/useMailerMutations';
|
|
36
38
|
export type { ChainConfig, MessageResult, UnifiedTransaction } from '../unified/types';
|
|
37
39
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/react/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAGH,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/react/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAGH,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,gBAAgB,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAG/H,OAAO,EACL,OAAO,EACP,mBAAmB,EACnB,2BAA2B,EAC3B,gBAAgB,EAChB,eAAe,GAChB,MAAM,0BAA0B,CAAC;AAGlC,OAAO,EACL,YAAY,EACZ,SAAS,EACT,aAAa,EACb,cAAc,EACd,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,4BAA4B,CAAC;AAGpC,OAAO,EACL,aAAa,EACb,mBAAmB,EACnB,qBAAqB,EACrB,oBAAoB,EACpB,gBAAgB,EAChB,WAAW,EACX,gBAAgB,EAChB,YAAY,EACZ,gBAAgB,GACjB,MAAM,0BAA0B,CAAC;AAGlC,OAAO,EACL,cAAc,EACd,eAAe,EACf,eAAe,EACf,kBAAkB,EAClB,qBAAqB,EACrB,aAAa,EACb,mBAAmB,EACnB,UAAU,EACV,gBAAgB,EAChB,mBAAmB,EACnB,QAAQ,EACR,UAAU,EACV,mBAAmB,EACnB,2BAA2B,GAC5B,MAAM,4BAA4B,CAAC;AAGpC,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -32,39 +32,54 @@
|
|
|
32
32
|
* ```
|
|
33
33
|
*/
|
|
34
34
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
-
exports.useDistributeClaimableFunds = exports.useEmergencyUnpause = exports.useUnpause = exports.usePause = exports.
|
|
35
|
+
exports.useDistributeClaimableFunds = exports.useEmergencyUnpause = exports.useUnpause = exports.usePause = exports.useRemovePermission = exports.useSetPermission = exports.useSetFees = exports.useRejectDelegation = exports.useDelegateTo = exports.useClaimExpiredShares = exports.useClaimOwnerShare = exports.useClaimRevenue = exports.useSendPrepared = exports.useSendMessage = exports.useHasPermission = exports.useChainType = exports.useWalletAddress = exports.useIsPaused = exports.useGetDelegation = exports.useGetOwnerClaimable = exports.useGetClaimableAmount = exports.useGetDelegationFee = exports.useGetSendFee = exports.useOwnerOperations = exports.useContractControl = exports.usePermissions = exports.useDelegation = exports.useClaims = exports.useMessaging = exports.mailerQueryKeys = exports.useContractState = exports.useDelegationAndPermissions = exports.useClaimableAmounts = exports.useFees = exports.QueryClientProvider = exports.QueryClient = exports.useMailerContext = exports.useMailerClient = exports.MailerProvider = void 0;
|
|
36
36
|
// Context and Provider
|
|
37
37
|
var MailerProvider_1 = require("./context/MailerProvider");
|
|
38
38
|
Object.defineProperty(exports, "MailerProvider", { enumerable: true, get: function () { return MailerProvider_1.MailerProvider; } });
|
|
39
39
|
Object.defineProperty(exports, "useMailerClient", { enumerable: true, get: function () { return MailerProvider_1.useMailerClient; } });
|
|
40
|
+
Object.defineProperty(exports, "useMailerContext", { enumerable: true, get: function () { return MailerProvider_1.useMailerContext; } });
|
|
40
41
|
Object.defineProperty(exports, "QueryClient", { enumerable: true, get: function () { return MailerProvider_1.QueryClient; } });
|
|
41
42
|
Object.defineProperty(exports, "QueryClientProvider", { enumerable: true, get: function () { return MailerProvider_1.QueryClientProvider; } });
|
|
42
|
-
// Query Hooks (
|
|
43
|
+
// Grouped Query Hooks (Preferred - no context dependency)
|
|
43
44
|
var useMailerQueries_1 = require("./hooks/useMailerQueries");
|
|
44
|
-
Object.defineProperty(exports, "
|
|
45
|
-
Object.defineProperty(exports, "
|
|
46
|
-
Object.defineProperty(exports, "
|
|
47
|
-
Object.defineProperty(exports, "
|
|
48
|
-
Object.defineProperty(exports, "useGetDelegation", { enumerable: true, get: function () { return useMailerQueries_1.useGetDelegation; } });
|
|
49
|
-
Object.defineProperty(exports, "useIsPaused", { enumerable: true, get: function () { return useMailerQueries_1.useIsPaused; } });
|
|
50
|
-
Object.defineProperty(exports, "useWalletAddress", { enumerable: true, get: function () { return useMailerQueries_1.useWalletAddress; } });
|
|
51
|
-
Object.defineProperty(exports, "useChainType", { enumerable: true, get: function () { return useMailerQueries_1.useChainType; } });
|
|
45
|
+
Object.defineProperty(exports, "useFees", { enumerable: true, get: function () { return useMailerQueries_1.useFees; } });
|
|
46
|
+
Object.defineProperty(exports, "useClaimableAmounts", { enumerable: true, get: function () { return useMailerQueries_1.useClaimableAmounts; } });
|
|
47
|
+
Object.defineProperty(exports, "useDelegationAndPermissions", { enumerable: true, get: function () { return useMailerQueries_1.useDelegationAndPermissions; } });
|
|
48
|
+
Object.defineProperty(exports, "useContractState", { enumerable: true, get: function () { return useMailerQueries_1.useContractState; } });
|
|
52
49
|
Object.defineProperty(exports, "mailerQueryKeys", { enumerable: true, get: function () { return useMailerQueries_1.mailerQueryKeys; } });
|
|
53
|
-
// Mutation Hooks (
|
|
50
|
+
// Grouped Mutation Hooks (Preferred - no context dependency)
|
|
54
51
|
var useMailerMutations_1 = require("./hooks/useMailerMutations");
|
|
55
|
-
Object.defineProperty(exports, "
|
|
56
|
-
Object.defineProperty(exports, "
|
|
57
|
-
Object.defineProperty(exports, "
|
|
58
|
-
Object.defineProperty(exports, "
|
|
59
|
-
Object.defineProperty(exports, "
|
|
60
|
-
Object.defineProperty(exports, "
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
Object.defineProperty(exports, "
|
|
64
|
-
Object.defineProperty(exports, "
|
|
65
|
-
Object.defineProperty(exports, "
|
|
66
|
-
Object.defineProperty(exports, "
|
|
67
|
-
Object.defineProperty(exports, "
|
|
68
|
-
Object.defineProperty(exports, "
|
|
69
|
-
Object.defineProperty(exports, "
|
|
52
|
+
Object.defineProperty(exports, "useMessaging", { enumerable: true, get: function () { return useMailerMutations_1.useMessaging; } });
|
|
53
|
+
Object.defineProperty(exports, "useClaims", { enumerable: true, get: function () { return useMailerMutations_1.useClaims; } });
|
|
54
|
+
Object.defineProperty(exports, "useDelegation", { enumerable: true, get: function () { return useMailerMutations_1.useDelegation; } });
|
|
55
|
+
Object.defineProperty(exports, "usePermissions", { enumerable: true, get: function () { return useMailerMutations_1.usePermissions; } });
|
|
56
|
+
Object.defineProperty(exports, "useContractControl", { enumerable: true, get: function () { return useMailerMutations_1.useContractControl; } });
|
|
57
|
+
Object.defineProperty(exports, "useOwnerOperations", { enumerable: true, get: function () { return useMailerMutations_1.useOwnerOperations; } });
|
|
58
|
+
// Legacy Individual Query Hooks (Deprecated - use grouped hooks above)
|
|
59
|
+
var useMailerQueries_2 = require("./hooks/useMailerQueries");
|
|
60
|
+
Object.defineProperty(exports, "useGetSendFee", { enumerable: true, get: function () { return useMailerQueries_2.useGetSendFee; } });
|
|
61
|
+
Object.defineProperty(exports, "useGetDelegationFee", { enumerable: true, get: function () { return useMailerQueries_2.useGetDelegationFee; } });
|
|
62
|
+
Object.defineProperty(exports, "useGetClaimableAmount", { enumerable: true, get: function () { return useMailerQueries_2.useGetClaimableAmount; } });
|
|
63
|
+
Object.defineProperty(exports, "useGetOwnerClaimable", { enumerable: true, get: function () { return useMailerQueries_2.useGetOwnerClaimable; } });
|
|
64
|
+
Object.defineProperty(exports, "useGetDelegation", { enumerable: true, get: function () { return useMailerQueries_2.useGetDelegation; } });
|
|
65
|
+
Object.defineProperty(exports, "useIsPaused", { enumerable: true, get: function () { return useMailerQueries_2.useIsPaused; } });
|
|
66
|
+
Object.defineProperty(exports, "useWalletAddress", { enumerable: true, get: function () { return useMailerQueries_2.useWalletAddress; } });
|
|
67
|
+
Object.defineProperty(exports, "useChainType", { enumerable: true, get: function () { return useMailerQueries_2.useChainType; } });
|
|
68
|
+
Object.defineProperty(exports, "useHasPermission", { enumerable: true, get: function () { return useMailerQueries_2.useHasPermission; } });
|
|
69
|
+
// Legacy Individual Mutation Hooks (Deprecated - use grouped hooks above)
|
|
70
|
+
var useMailerMutations_2 = require("./hooks/useMailerMutations");
|
|
71
|
+
Object.defineProperty(exports, "useSendMessage", { enumerable: true, get: function () { return useMailerMutations_2.useSendMessage; } });
|
|
72
|
+
Object.defineProperty(exports, "useSendPrepared", { enumerable: true, get: function () { return useMailerMutations_2.useSendPrepared; } });
|
|
73
|
+
Object.defineProperty(exports, "useClaimRevenue", { enumerable: true, get: function () { return useMailerMutations_2.useClaimRevenue; } });
|
|
74
|
+
Object.defineProperty(exports, "useClaimOwnerShare", { enumerable: true, get: function () { return useMailerMutations_2.useClaimOwnerShare; } });
|
|
75
|
+
Object.defineProperty(exports, "useClaimExpiredShares", { enumerable: true, get: function () { return useMailerMutations_2.useClaimExpiredShares; } });
|
|
76
|
+
Object.defineProperty(exports, "useDelegateTo", { enumerable: true, get: function () { return useMailerMutations_2.useDelegateTo; } });
|
|
77
|
+
Object.defineProperty(exports, "useRejectDelegation", { enumerable: true, get: function () { return useMailerMutations_2.useRejectDelegation; } });
|
|
78
|
+
Object.defineProperty(exports, "useSetFees", { enumerable: true, get: function () { return useMailerMutations_2.useSetFees; } });
|
|
79
|
+
Object.defineProperty(exports, "useSetPermission", { enumerable: true, get: function () { return useMailerMutations_2.useSetPermission; } });
|
|
80
|
+
Object.defineProperty(exports, "useRemovePermission", { enumerable: true, get: function () { return useMailerMutations_2.useRemovePermission; } });
|
|
81
|
+
Object.defineProperty(exports, "usePause", { enumerable: true, get: function () { return useMailerMutations_2.usePause; } });
|
|
82
|
+
Object.defineProperty(exports, "useUnpause", { enumerable: true, get: function () { return useMailerMutations_2.useUnpause; } });
|
|
83
|
+
Object.defineProperty(exports, "useEmergencyUnpause", { enumerable: true, get: function () { return useMailerMutations_2.useEmergencyUnpause; } });
|
|
84
|
+
Object.defineProperty(exports, "useDistributeClaimableFunds", { enumerable: true, get: function () { return useMailerMutations_2.useDistributeClaimableFunds; } });
|
|
70
85
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/react/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;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B,yHAAA,mBAAmB,OAAA;AACnB,8GAAA,QAAQ,OAAA;AACR,gHAAA,UAAU,OAAA;AACV,yHAAA,mBAAmB,OAAA;AACnB,iIAAA,2BAA2B,OAAA"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { SolanaMailerClient, type SolanaWallet, type Wallet, type ComputeUnitOptions, type TransactionResult } from './solana-mailer-client.js';
|
|
2
2
|
export * from './types.js';
|
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/solana/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/solana/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,kBAAkB,EAClB,KAAK,YAAY,EACjB,KAAK,MAAM,EACX,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACvB,MAAM,2BAA2B,CAAC;AAEnC,cAAc,YAAY,CAAC"}
|
|
@@ -14,8 +14,9 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
exports.SolanaMailerClient = void 0;
|
|
18
|
+
// Export stateless client and types
|
|
19
|
+
var solana_mailer_client_js_1 = require("./solana-mailer-client");
|
|
20
|
+
Object.defineProperty(exports, "SolanaMailerClient", { enumerable: true, get: function () { return solana_mailer_client_js_1.SolanaMailerClient; } });
|
|
20
21
|
__exportStar(require("./types"), exports);
|
|
21
22
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/solana/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/solana/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,oCAAoC;AACpC,qEAMmC;AALjC,6HAAA,kBAAkB,OAAA;AAOpB,6CAA2B"}
|