@megaeth-labs/wallet-sdk-react 0.1.8 → 0.1.10-beta.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/index.cjs +12 -1
- package/dist/index.d.cts +8 -3
- package/dist/index.d.ts +8 -3
- package/dist/index.js +11 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -40,6 +40,7 @@ __export(index_exports, {
|
|
|
40
40
|
useDisconnect: () => useDisconnect,
|
|
41
41
|
useGetFromContract: () => useGetFromContract,
|
|
42
42
|
useGrantPermissions: () => useGrantPermissions,
|
|
43
|
+
useManageAccount: () => useManageAccount,
|
|
43
44
|
usePermissions: () => usePermissions,
|
|
44
45
|
useRevokePermissions: () => useRevokePermissions,
|
|
45
46
|
useSignData: () => useSignData,
|
|
@@ -57,7 +58,10 @@ var Context = (0, import_react.createContext)({});
|
|
|
57
58
|
var startedInitialisation = false;
|
|
58
59
|
var MegaProvider = ({ config, children }) => {
|
|
59
60
|
const [initialised, setInitialised] = (0, import_react.useState)(false);
|
|
60
|
-
const [status, setStatus] = (0, import_react.useState)({
|
|
61
|
+
const [status, setStatus] = (0, import_react.useState)({
|
|
62
|
+
status: "disconnected",
|
|
63
|
+
network: config.network
|
|
64
|
+
});
|
|
61
65
|
const value = (0, import_react.useMemo)(
|
|
62
66
|
() => ({
|
|
63
67
|
config,
|
|
@@ -175,6 +179,12 @@ var useAuthenticate = (options) => {
|
|
|
175
179
|
...options
|
|
176
180
|
});
|
|
177
181
|
};
|
|
182
|
+
var useManageAccount = (options) => {
|
|
183
|
+
return (0, import_react_query.useMutation)({
|
|
184
|
+
mutationFn: import_wallet_sdk.mega.manageAccount,
|
|
185
|
+
...options
|
|
186
|
+
});
|
|
187
|
+
};
|
|
178
188
|
// Annotate the CommonJS export names for ESM import in node:
|
|
179
189
|
0 && (module.exports = {
|
|
180
190
|
MegaProvider,
|
|
@@ -187,6 +197,7 @@ var useAuthenticate = (options) => {
|
|
|
187
197
|
useDisconnect,
|
|
188
198
|
useGetFromContract,
|
|
189
199
|
useGrantPermissions,
|
|
200
|
+
useManageAccount,
|
|
190
201
|
usePermissions,
|
|
191
202
|
useRevokePermissions,
|
|
192
203
|
useSignData,
|
package/dist/index.d.cts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
2
|
+
import { UseMutationOptions, UndefinedInitialDataOptions } from '@tanstack/react-query';
|
|
1
3
|
import * as _megaeth_labs_wallet_sdk from '@megaeth-labs/wallet-sdk';
|
|
2
4
|
import { Config, mega, ConnectionStatus } from '@megaeth-labs/wallet-sdk';
|
|
3
5
|
export { mega } from '@megaeth-labs/wallet-sdk';
|
|
4
|
-
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
5
|
-
import { UseMutationOptions, UndefinedInitialDataOptions } from '@tanstack/react-query';
|
|
6
6
|
import React, { PropsWithChildren } from 'react';
|
|
7
7
|
|
|
8
8
|
interface MegaProviderProps extends PropsWithChildren {
|
|
@@ -13,6 +13,7 @@ declare const useStatus: () => {
|
|
|
13
13
|
initialised: boolean;
|
|
14
14
|
status: "connected" | "disconnected" | "cancelled";
|
|
15
15
|
address?: `0x${string}`;
|
|
16
|
+
network: _megaeth_labs_wallet_sdk.Network;
|
|
16
17
|
};
|
|
17
18
|
declare const useConnect: (options?: Omit<UseMutationOptions<Awaited<ReturnType<typeof mega.connect>>, Error, void, unknown>, "mutationFn">) => _tanstack_react_query.UseMutationResult<ConnectionStatus, Error, void, unknown>;
|
|
18
19
|
declare const useDisconnect: (options?: Omit<UseMutationOptions<Awaited<ReturnType<typeof mega.disconnect>>, Error, void, unknown>, "mutationFn">) => _tanstack_react_query.UseMutationResult<ConnectionStatus, Error, void, unknown>;
|
|
@@ -27,5 +28,9 @@ declare const useBalances: (tokens?: string[], options?: Omit<UndefinedInitialDa
|
|
|
27
28
|
declare const usePermissions: (address?: string, options?: Omit<UndefinedInitialDataOptions<Awaited<ReturnType<typeof mega.getPermissions>>, Error>, "queryKey" | "queryFn">) => _tanstack_react_query.UseQueryResult<_megaeth_labs_wallet_sdk.GetPermissionsResponse | undefined, Error>;
|
|
28
29
|
declare const useSignData: (options?: Omit<UseMutationOptions<Awaited<ReturnType<typeof mega.signData>>, Error, Parameters<typeof mega.signData>[0]>, "mutationFn">) => _tanstack_react_query.UseMutationResult<_megaeth_labs_wallet_sdk.SignDataResponse, Error, _megaeth_labs_wallet_sdk.SignDataRequest, unknown>;
|
|
29
30
|
declare const useAuthenticate: (options?: Omit<UseMutationOptions<Awaited<ReturnType<typeof mega.authenticate>>, Error>, "mutationFn">) => _tanstack_react_query.UseMutationResult<_megaeth_labs_wallet_sdk.AuthenticateResponse, Error, void, unknown>;
|
|
31
|
+
declare const useManageAccount: (options?: Omit<UseMutationOptions<Awaited<ReturnType<typeof mega.manageAccount>>, Error, Parameters<typeof mega.manageAccount>[0]>, "mutationFn">) => _tanstack_react_query.UseMutationResult<void, Error, {
|
|
32
|
+
method: string;
|
|
33
|
+
data?: any;
|
|
34
|
+
}, unknown>;
|
|
30
35
|
|
|
31
|
-
export { MegaProvider, useAuthenticate, useBalances, useCallContract, useConnect, useDeposit, useDisconnect, useGetFromContract, useGrantPermissions, usePermissions, useRevokePermissions, useSignData, useSignMessage, useStatus, useTransfer };
|
|
36
|
+
export { MegaProvider, useAuthenticate, useBalances, useCallContract, useConnect, useDeposit, useDisconnect, useGetFromContract, useGrantPermissions, useManageAccount, usePermissions, useRevokePermissions, useSignData, useSignMessage, useStatus, useTransfer };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
2
|
+
import { UseMutationOptions, UndefinedInitialDataOptions } from '@tanstack/react-query';
|
|
1
3
|
import * as _megaeth_labs_wallet_sdk from '@megaeth-labs/wallet-sdk';
|
|
2
4
|
import { Config, mega, ConnectionStatus } from '@megaeth-labs/wallet-sdk';
|
|
3
5
|
export { mega } from '@megaeth-labs/wallet-sdk';
|
|
4
|
-
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
5
|
-
import { UseMutationOptions, UndefinedInitialDataOptions } from '@tanstack/react-query';
|
|
6
6
|
import React, { PropsWithChildren } from 'react';
|
|
7
7
|
|
|
8
8
|
interface MegaProviderProps extends PropsWithChildren {
|
|
@@ -13,6 +13,7 @@ declare const useStatus: () => {
|
|
|
13
13
|
initialised: boolean;
|
|
14
14
|
status: "connected" | "disconnected" | "cancelled";
|
|
15
15
|
address?: `0x${string}`;
|
|
16
|
+
network: _megaeth_labs_wallet_sdk.Network;
|
|
16
17
|
};
|
|
17
18
|
declare const useConnect: (options?: Omit<UseMutationOptions<Awaited<ReturnType<typeof mega.connect>>, Error, void, unknown>, "mutationFn">) => _tanstack_react_query.UseMutationResult<ConnectionStatus, Error, void, unknown>;
|
|
18
19
|
declare const useDisconnect: (options?: Omit<UseMutationOptions<Awaited<ReturnType<typeof mega.disconnect>>, Error, void, unknown>, "mutationFn">) => _tanstack_react_query.UseMutationResult<ConnectionStatus, Error, void, unknown>;
|
|
@@ -27,5 +28,9 @@ declare const useBalances: (tokens?: string[], options?: Omit<UndefinedInitialDa
|
|
|
27
28
|
declare const usePermissions: (address?: string, options?: Omit<UndefinedInitialDataOptions<Awaited<ReturnType<typeof mega.getPermissions>>, Error>, "queryKey" | "queryFn">) => _tanstack_react_query.UseQueryResult<_megaeth_labs_wallet_sdk.GetPermissionsResponse | undefined, Error>;
|
|
28
29
|
declare const useSignData: (options?: Omit<UseMutationOptions<Awaited<ReturnType<typeof mega.signData>>, Error, Parameters<typeof mega.signData>[0]>, "mutationFn">) => _tanstack_react_query.UseMutationResult<_megaeth_labs_wallet_sdk.SignDataResponse, Error, _megaeth_labs_wallet_sdk.SignDataRequest, unknown>;
|
|
29
30
|
declare const useAuthenticate: (options?: Omit<UseMutationOptions<Awaited<ReturnType<typeof mega.authenticate>>, Error>, "mutationFn">) => _tanstack_react_query.UseMutationResult<_megaeth_labs_wallet_sdk.AuthenticateResponse, Error, void, unknown>;
|
|
31
|
+
declare const useManageAccount: (options?: Omit<UseMutationOptions<Awaited<ReturnType<typeof mega.manageAccount>>, Error, Parameters<typeof mega.manageAccount>[0]>, "mutationFn">) => _tanstack_react_query.UseMutationResult<void, Error, {
|
|
32
|
+
method: string;
|
|
33
|
+
data?: any;
|
|
34
|
+
}, unknown>;
|
|
30
35
|
|
|
31
|
-
export { MegaProvider, useAuthenticate, useBalances, useCallContract, useConnect, useDeposit, useDisconnect, useGetFromContract, useGrantPermissions, usePermissions, useRevokePermissions, useSignData, useSignMessage, useStatus, useTransfer };
|
|
36
|
+
export { MegaProvider, useAuthenticate, useBalances, useCallContract, useConnect, useDeposit, useDisconnect, useGetFromContract, useGrantPermissions, useManageAccount, usePermissions, useRevokePermissions, useSignData, useSignMessage, useStatus, useTransfer };
|
package/dist/index.js
CHANGED
|
@@ -19,7 +19,10 @@ var Context = createContext({});
|
|
|
19
19
|
var startedInitialisation = false;
|
|
20
20
|
var MegaProvider = ({ config, children }) => {
|
|
21
21
|
const [initialised, setInitialised] = useState(false);
|
|
22
|
-
const [status, setStatus] = useState({
|
|
22
|
+
const [status, setStatus] = useState({
|
|
23
|
+
status: "disconnected",
|
|
24
|
+
network: config.network
|
|
25
|
+
});
|
|
23
26
|
const value = useMemo(
|
|
24
27
|
() => ({
|
|
25
28
|
config,
|
|
@@ -137,6 +140,12 @@ var useAuthenticate = (options) => {
|
|
|
137
140
|
...options
|
|
138
141
|
});
|
|
139
142
|
};
|
|
143
|
+
var useManageAccount = (options) => {
|
|
144
|
+
return useMutation({
|
|
145
|
+
mutationFn: mega.manageAccount,
|
|
146
|
+
...options
|
|
147
|
+
});
|
|
148
|
+
};
|
|
140
149
|
export {
|
|
141
150
|
MegaProvider,
|
|
142
151
|
mega2 as mega,
|
|
@@ -148,6 +157,7 @@ export {
|
|
|
148
157
|
useDisconnect,
|
|
149
158
|
useGetFromContract,
|
|
150
159
|
useGrantPermissions,
|
|
160
|
+
useManageAccount,
|
|
151
161
|
usePermissions,
|
|
152
162
|
useRevokePermissions,
|
|
153
163
|
useSignData,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@megaeth-labs/wallet-sdk-react",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.10-beta.1",
|
|
4
4
|
"description": "MegaETH Wallet SDK React Wrapper for web applications",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"access": "restricted"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@megaeth-labs/wallet-sdk": "0.1.
|
|
33
|
+
"@megaeth-labs/wallet-sdk": "0.1.13"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
36
|
"@tanstack/react-query": "^5",
|