@mezo-org/passport 0.4.0-dev.73 → 0.4.0-dev.75
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/src/hooks/useAuthenticateWithWallet.d.ts +13 -13
- package/dist/src/hooks/useAuthenticateWithWallet.d.ts.map +1 -1
- package/dist/src/hooks/useAuthenticateWithWallet.js +4 -4
- package/dist/src/hooks/useAuthenticateWithWallet.js.map +1 -1
- package/dist/src/hooks/useSignInWithWallet.d.ts +13 -13
- package/dist/src/hooks/useSignInWithWallet.d.ts.map +1 -1
- package/dist/src/hooks/useSignUpWithWallet.d.ts +13 -13
- package/dist/src/hooks/useSignUpWithWallet.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/hooks/useAuthenticateWithWallet.ts +14 -6
- package/src/hooks/useSignInWithWallet.ts +2 -2
- package/src/hooks/useSignUpWithWallet.ts +2 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { MutationOptions } from "@tanstack/react-query";
|
|
1
|
+
import { DefaultError, MutationOptions } from "@tanstack/react-query";
|
|
2
2
|
import type { Session } from "../api";
|
|
3
|
-
declare function useAuthenticateWithWallet(shouldCreateAccount?: boolean, mutationOptions?: Omit<MutationOptions<Session>, "mutationFn" | "mutationKey">): {
|
|
3
|
+
declare function useAuthenticateWithWallet(shouldCreateAccount?: boolean, mutationOptions?: Omit<MutationOptions<Session, DefaultError, number | void>, "mutationFn" | "mutationKey">): {
|
|
4
4
|
data: undefined;
|
|
5
5
|
variables: undefined;
|
|
6
6
|
error: null;
|
|
@@ -15,11 +15,11 @@ declare function useAuthenticateWithWallet(shouldCreateAccount?: boolean, mutati
|
|
|
15
15
|
failureReason: Error | null;
|
|
16
16
|
isPaused: boolean;
|
|
17
17
|
submittedAt: number;
|
|
18
|
-
authenticateWithWallet: import("@tanstack/react-query").UseMutateFunction<Session, Error, void, unknown>;
|
|
19
|
-
authenticateWithWalletAsync: import("@tanstack/react-query").UseMutateAsyncFunction<Session, Error, void, unknown>;
|
|
18
|
+
authenticateWithWallet: import("@tanstack/react-query").UseMutateFunction<Session, Error, number | void | undefined, unknown>;
|
|
19
|
+
authenticateWithWalletAsync: import("@tanstack/react-query").UseMutateAsyncFunction<Session, Error, number | void | undefined, unknown>;
|
|
20
20
|
} | {
|
|
21
21
|
data: undefined;
|
|
22
|
-
variables: void;
|
|
22
|
+
variables: number | void | undefined;
|
|
23
23
|
error: null;
|
|
24
24
|
isError: false;
|
|
25
25
|
isIdle: false;
|
|
@@ -32,12 +32,12 @@ declare function useAuthenticateWithWallet(shouldCreateAccount?: boolean, mutati
|
|
|
32
32
|
failureReason: Error | null;
|
|
33
33
|
isPaused: boolean;
|
|
34
34
|
submittedAt: number;
|
|
35
|
-
authenticateWithWallet: import("@tanstack/react-query").UseMutateFunction<Session, Error, void, unknown>;
|
|
36
|
-
authenticateWithWalletAsync: import("@tanstack/react-query").UseMutateAsyncFunction<Session, Error, void, unknown>;
|
|
35
|
+
authenticateWithWallet: import("@tanstack/react-query").UseMutateFunction<Session, Error, number | void | undefined, unknown>;
|
|
36
|
+
authenticateWithWalletAsync: import("@tanstack/react-query").UseMutateAsyncFunction<Session, Error, number | void | undefined, unknown>;
|
|
37
37
|
} | {
|
|
38
38
|
data: undefined;
|
|
39
39
|
error: Error;
|
|
40
|
-
variables: void;
|
|
40
|
+
variables: number | void | undefined;
|
|
41
41
|
isError: true;
|
|
42
42
|
isIdle: false;
|
|
43
43
|
isPending: false;
|
|
@@ -49,12 +49,12 @@ declare function useAuthenticateWithWallet(shouldCreateAccount?: boolean, mutati
|
|
|
49
49
|
failureReason: Error | null;
|
|
50
50
|
isPaused: boolean;
|
|
51
51
|
submittedAt: number;
|
|
52
|
-
authenticateWithWallet: import("@tanstack/react-query").UseMutateFunction<Session, Error, void, unknown>;
|
|
53
|
-
authenticateWithWalletAsync: import("@tanstack/react-query").UseMutateAsyncFunction<Session, Error, void, unknown>;
|
|
52
|
+
authenticateWithWallet: import("@tanstack/react-query").UseMutateFunction<Session, Error, number | void | undefined, unknown>;
|
|
53
|
+
authenticateWithWalletAsync: import("@tanstack/react-query").UseMutateAsyncFunction<Session, Error, number | void | undefined, unknown>;
|
|
54
54
|
} | {
|
|
55
55
|
data: Session;
|
|
56
56
|
error: null;
|
|
57
|
-
variables: void;
|
|
57
|
+
variables: number | void | undefined;
|
|
58
58
|
isError: false;
|
|
59
59
|
isIdle: false;
|
|
60
60
|
isPending: false;
|
|
@@ -66,8 +66,8 @@ declare function useAuthenticateWithWallet(shouldCreateAccount?: boolean, mutati
|
|
|
66
66
|
failureReason: Error | null;
|
|
67
67
|
isPaused: boolean;
|
|
68
68
|
submittedAt: number;
|
|
69
|
-
authenticateWithWallet: import("@tanstack/react-query").UseMutateFunction<Session, Error, void, unknown>;
|
|
70
|
-
authenticateWithWalletAsync: import("@tanstack/react-query").UseMutateAsyncFunction<Session, Error, void, unknown>;
|
|
69
|
+
authenticateWithWallet: import("@tanstack/react-query").UseMutateFunction<Session, Error, number | void | undefined, unknown>;
|
|
70
|
+
authenticateWithWalletAsync: import("@tanstack/react-query").UseMutateAsyncFunction<Session, Error, number | void | undefined, unknown>;
|
|
71
71
|
};
|
|
72
72
|
export { useAuthenticateWithWallet };
|
|
73
73
|
//# sourceMappingURL=useAuthenticateWithWallet.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAuthenticateWithWallet.d.ts","sourceRoot":"","sources":["../../../src/hooks/useAuthenticateWithWallet.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"useAuthenticateWithWallet.d.ts","sourceRoot":"","sources":["../../../src/hooks/useAuthenticateWithWallet.ts"],"names":[],"mappings":"AACA,OAAO,EACL,YAAY,EACZ,eAAe,EAEhB,MAAM,uBAAuB,CAAA;AAS9B,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAA;AAGrC,iBAAS,yBAAyB,CAChC,mBAAmB,UAAQ,EAC3B,eAAe,GAAE,IAAI,CACnB,eAAe,CAAC,OAAO,EAAE,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC,EACrD,YAAY,GAAG,aAAa,CACxB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8FP;AAED,OAAO,EAAE,yBAAyB,EAAE,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useSignMessage } from "wagmi";
|
|
2
|
-
import { useMutation } from "@tanstack/react-query";
|
|
2
|
+
import { useMutation, } from "@tanstack/react-query";
|
|
3
3
|
import { useCreateAccount } from "./useCreateAccount";
|
|
4
4
|
import { useCreateSession } from "./useCreateSession";
|
|
5
5
|
import { useEnsureNoSessionAndFetchNonce } from "./useEnsureNoSessionAndFetchNonce";
|
|
@@ -7,7 +7,7 @@ import { createSignInWithWalletMessage, verifyDomainInSignInWithWalletMessage, }
|
|
|
7
7
|
import { useGetAccountByAddress } from "./useGetAccountByAddress";
|
|
8
8
|
import useWalletAccount from "./useWalletAccount";
|
|
9
9
|
function useAuthenticateWithWallet(shouldCreateAccount = false, mutationOptions = {}) {
|
|
10
|
-
const { walletAddress, chainId, connector, networkFamily } = useWalletAccount();
|
|
10
|
+
const { walletAddress, chainId: walletChainId, connector, networkFamily, } = useWalletAccount();
|
|
11
11
|
const { ensureNoSessionAndFetchNonce } = useEnsureNoSessionAndFetchNonce();
|
|
12
12
|
const { createSessionAsync } = useCreateSession();
|
|
13
13
|
const { createAccountAsync } = useCreateAccount();
|
|
@@ -17,12 +17,12 @@ function useAuthenticateWithWallet(shouldCreateAccount = false, mutationOptions
|
|
|
17
17
|
retry: false,
|
|
18
18
|
});
|
|
19
19
|
const { mutate, mutateAsync, ...signInMutationRestParameters } = useMutation({
|
|
20
|
-
mutationFn: async () => {
|
|
20
|
+
mutationFn: async (chainId) => {
|
|
21
21
|
if (!walletAddress) {
|
|
22
22
|
throw new Error("Sign in error: Wallet not connected!");
|
|
23
23
|
}
|
|
24
24
|
const nonce = await ensureNoSessionAndFetchNonce();
|
|
25
|
-
const messageResult = createSignInWithWalletMessage(walletAddress, nonce, networkFamily, chainId);
|
|
25
|
+
const messageResult = createSignInWithWalletMessage(walletAddress, nonce, networkFamily, chainId ?? walletChainId);
|
|
26
26
|
const signatureResult = await signMessageAsync({
|
|
27
27
|
message: messageResult,
|
|
28
28
|
connector,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAuthenticateWithWallet.js","sourceRoot":"","sources":["../../../src/hooks/useAuthenticateWithWallet.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;AACtC,OAAO,
|
|
1
|
+
{"version":3,"file":"useAuthenticateWithWallet.js","sourceRoot":"","sources":["../../../src/hooks/useAuthenticateWithWallet.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { MutationOptions } from "@tanstack/react-query";
|
|
1
|
+
import { DefaultError, MutationOptions } from "@tanstack/react-query";
|
|
2
2
|
import type { Session } from "../api";
|
|
3
|
-
declare function useSignInWithWallet(mutationOptions?: Omit<MutationOptions<Session>, "mutationFn" | "mutationKey">): {
|
|
3
|
+
declare function useSignInWithWallet(mutationOptions?: Omit<MutationOptions<Session, DefaultError, number | void>, "mutationFn" | "mutationKey">): {
|
|
4
4
|
data: undefined;
|
|
5
5
|
variables: undefined;
|
|
6
6
|
error: null;
|
|
@@ -15,11 +15,11 @@ declare function useSignInWithWallet(mutationOptions?: Omit<MutationOptions<Sess
|
|
|
15
15
|
failureReason: Error | null;
|
|
16
16
|
isPaused: boolean;
|
|
17
17
|
submittedAt: number;
|
|
18
|
-
signInWithWallet: import("@tanstack/react-query").UseMutateFunction<Session, Error, void, unknown>;
|
|
19
|
-
signInWithWalletAsync: import("@tanstack/react-query").UseMutateAsyncFunction<Session, Error, void, unknown>;
|
|
18
|
+
signInWithWallet: import("@tanstack/react-query").UseMutateFunction<Session, Error, number | void | undefined, unknown>;
|
|
19
|
+
signInWithWalletAsync: import("@tanstack/react-query").UseMutateAsyncFunction<Session, Error, number | void | undefined, unknown>;
|
|
20
20
|
} | {
|
|
21
21
|
data: undefined;
|
|
22
|
-
variables: void;
|
|
22
|
+
variables: number | void | undefined;
|
|
23
23
|
error: null;
|
|
24
24
|
isError: false;
|
|
25
25
|
isIdle: false;
|
|
@@ -32,12 +32,12 @@ declare function useSignInWithWallet(mutationOptions?: Omit<MutationOptions<Sess
|
|
|
32
32
|
failureReason: Error | null;
|
|
33
33
|
isPaused: boolean;
|
|
34
34
|
submittedAt: number;
|
|
35
|
-
signInWithWallet: import("@tanstack/react-query").UseMutateFunction<Session, Error, void, unknown>;
|
|
36
|
-
signInWithWalletAsync: import("@tanstack/react-query").UseMutateAsyncFunction<Session, Error, void, unknown>;
|
|
35
|
+
signInWithWallet: import("@tanstack/react-query").UseMutateFunction<Session, Error, number | void | undefined, unknown>;
|
|
36
|
+
signInWithWalletAsync: import("@tanstack/react-query").UseMutateAsyncFunction<Session, Error, number | void | undefined, unknown>;
|
|
37
37
|
} | {
|
|
38
38
|
data: undefined;
|
|
39
39
|
error: Error;
|
|
40
|
-
variables: void;
|
|
40
|
+
variables: number | void | undefined;
|
|
41
41
|
isError: true;
|
|
42
42
|
isIdle: false;
|
|
43
43
|
isPending: false;
|
|
@@ -49,12 +49,12 @@ declare function useSignInWithWallet(mutationOptions?: Omit<MutationOptions<Sess
|
|
|
49
49
|
failureReason: Error | null;
|
|
50
50
|
isPaused: boolean;
|
|
51
51
|
submittedAt: number;
|
|
52
|
-
signInWithWallet: import("@tanstack/react-query").UseMutateFunction<Session, Error, void, unknown>;
|
|
53
|
-
signInWithWalletAsync: import("@tanstack/react-query").UseMutateAsyncFunction<Session, Error, void, unknown>;
|
|
52
|
+
signInWithWallet: import("@tanstack/react-query").UseMutateFunction<Session, Error, number | void | undefined, unknown>;
|
|
53
|
+
signInWithWalletAsync: import("@tanstack/react-query").UseMutateAsyncFunction<Session, Error, number | void | undefined, unknown>;
|
|
54
54
|
} | {
|
|
55
55
|
data: Session;
|
|
56
56
|
error: null;
|
|
57
|
-
variables: void;
|
|
57
|
+
variables: number | void | undefined;
|
|
58
58
|
isError: false;
|
|
59
59
|
isIdle: false;
|
|
60
60
|
isPending: false;
|
|
@@ -66,8 +66,8 @@ declare function useSignInWithWallet(mutationOptions?: Omit<MutationOptions<Sess
|
|
|
66
66
|
failureReason: Error | null;
|
|
67
67
|
isPaused: boolean;
|
|
68
68
|
submittedAt: number;
|
|
69
|
-
signInWithWallet: import("@tanstack/react-query").UseMutateFunction<Session, Error, void, unknown>;
|
|
70
|
-
signInWithWalletAsync: import("@tanstack/react-query").UseMutateAsyncFunction<Session, Error, void, unknown>;
|
|
69
|
+
signInWithWallet: import("@tanstack/react-query").UseMutateFunction<Session, Error, number | void | undefined, unknown>;
|
|
70
|
+
signInWithWalletAsync: import("@tanstack/react-query").UseMutateAsyncFunction<Session, Error, number | void | undefined, unknown>;
|
|
71
71
|
};
|
|
72
72
|
export { useSignInWithWallet };
|
|
73
73
|
//# sourceMappingURL=useSignInWithWallet.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSignInWithWallet.d.ts","sourceRoot":"","sources":["../../../src/hooks/useSignInWithWallet.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;
|
|
1
|
+
{"version":3,"file":"useSignInWithWallet.d.ts","sourceRoot":"","sources":["../../../src/hooks/useSignInWithWallet.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAErE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAA;AAErC,iBAAS,mBAAmB,CAC1B,eAAe,GAAE,IAAI,CACnB,eAAe,CAAC,OAAO,EAAE,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC,EACrD,YAAY,GAAG,aAAa,CACxB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAUP;AAED,OAAO,EAAE,mBAAmB,EAAE,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { MutationOptions } from "@tanstack/react-query";
|
|
1
|
+
import { DefaultError, MutationOptions } from "@tanstack/react-query";
|
|
2
2
|
import type { Session } from "../api";
|
|
3
|
-
declare function useSignUpWithWallet(mutationOptions?: Omit<MutationOptions<Session>, "mutationFn" | "mutationKey">): {
|
|
3
|
+
declare function useSignUpWithWallet(mutationOptions?: Omit<MutationOptions<Session, DefaultError, number | void>, "mutationFn" | "mutationKey">): {
|
|
4
4
|
data: undefined;
|
|
5
5
|
variables: undefined;
|
|
6
6
|
error: null;
|
|
@@ -15,11 +15,11 @@ declare function useSignUpWithWallet(mutationOptions?: Omit<MutationOptions<Sess
|
|
|
15
15
|
failureReason: Error | null;
|
|
16
16
|
isPaused: boolean;
|
|
17
17
|
submittedAt: number;
|
|
18
|
-
signUpWithWallet: import("@tanstack/react-query").UseMutateFunction<Session, Error, void, unknown>;
|
|
19
|
-
signUpWithWalletAsync: import("@tanstack/react-query").UseMutateAsyncFunction<Session, Error, void, unknown>;
|
|
18
|
+
signUpWithWallet: import("@tanstack/react-query").UseMutateFunction<Session, Error, number | void | undefined, unknown>;
|
|
19
|
+
signUpWithWalletAsync: import("@tanstack/react-query").UseMutateAsyncFunction<Session, Error, number | void | undefined, unknown>;
|
|
20
20
|
} | {
|
|
21
21
|
data: undefined;
|
|
22
|
-
variables: void;
|
|
22
|
+
variables: number | void | undefined;
|
|
23
23
|
error: null;
|
|
24
24
|
isError: false;
|
|
25
25
|
isIdle: false;
|
|
@@ -32,12 +32,12 @@ declare function useSignUpWithWallet(mutationOptions?: Omit<MutationOptions<Sess
|
|
|
32
32
|
failureReason: Error | null;
|
|
33
33
|
isPaused: boolean;
|
|
34
34
|
submittedAt: number;
|
|
35
|
-
signUpWithWallet: import("@tanstack/react-query").UseMutateFunction<Session, Error, void, unknown>;
|
|
36
|
-
signUpWithWalletAsync: import("@tanstack/react-query").UseMutateAsyncFunction<Session, Error, void, unknown>;
|
|
35
|
+
signUpWithWallet: import("@tanstack/react-query").UseMutateFunction<Session, Error, number | void | undefined, unknown>;
|
|
36
|
+
signUpWithWalletAsync: import("@tanstack/react-query").UseMutateAsyncFunction<Session, Error, number | void | undefined, unknown>;
|
|
37
37
|
} | {
|
|
38
38
|
data: undefined;
|
|
39
39
|
error: Error;
|
|
40
|
-
variables: void;
|
|
40
|
+
variables: number | void | undefined;
|
|
41
41
|
isError: true;
|
|
42
42
|
isIdle: false;
|
|
43
43
|
isPending: false;
|
|
@@ -49,12 +49,12 @@ declare function useSignUpWithWallet(mutationOptions?: Omit<MutationOptions<Sess
|
|
|
49
49
|
failureReason: Error | null;
|
|
50
50
|
isPaused: boolean;
|
|
51
51
|
submittedAt: number;
|
|
52
|
-
signUpWithWallet: import("@tanstack/react-query").UseMutateFunction<Session, Error, void, unknown>;
|
|
53
|
-
signUpWithWalletAsync: import("@tanstack/react-query").UseMutateAsyncFunction<Session, Error, void, unknown>;
|
|
52
|
+
signUpWithWallet: import("@tanstack/react-query").UseMutateFunction<Session, Error, number | void | undefined, unknown>;
|
|
53
|
+
signUpWithWalletAsync: import("@tanstack/react-query").UseMutateAsyncFunction<Session, Error, number | void | undefined, unknown>;
|
|
54
54
|
} | {
|
|
55
55
|
data: Session;
|
|
56
56
|
error: null;
|
|
57
|
-
variables: void;
|
|
57
|
+
variables: number | void | undefined;
|
|
58
58
|
isError: false;
|
|
59
59
|
isIdle: false;
|
|
60
60
|
isPending: false;
|
|
@@ -66,8 +66,8 @@ declare function useSignUpWithWallet(mutationOptions?: Omit<MutationOptions<Sess
|
|
|
66
66
|
failureReason: Error | null;
|
|
67
67
|
isPaused: boolean;
|
|
68
68
|
submittedAt: number;
|
|
69
|
-
signUpWithWallet: import("@tanstack/react-query").UseMutateFunction<Session, Error, void, unknown>;
|
|
70
|
-
signUpWithWalletAsync: import("@tanstack/react-query").UseMutateAsyncFunction<Session, Error, void, unknown>;
|
|
69
|
+
signUpWithWallet: import("@tanstack/react-query").UseMutateFunction<Session, Error, number | void | undefined, unknown>;
|
|
70
|
+
signUpWithWalletAsync: import("@tanstack/react-query").UseMutateAsyncFunction<Session, Error, number | void | undefined, unknown>;
|
|
71
71
|
};
|
|
72
72
|
export { useSignUpWithWallet };
|
|
73
73
|
//# sourceMappingURL=useSignUpWithWallet.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSignUpWithWallet.d.ts","sourceRoot":"","sources":["../../../src/hooks/useSignUpWithWallet.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;
|
|
1
|
+
{"version":3,"file":"useSignUpWithWallet.d.ts","sourceRoot":"","sources":["../../../src/hooks/useSignUpWithWallet.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAErE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAA;AAErC,iBAAS,mBAAmB,CAC1B,eAAe,GAAE,IAAI,CACnB,eAAe,CAAC,OAAO,EAAE,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC,EACrD,YAAY,GAAG,aAAa,CACxB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAUP;AAED,OAAO,EAAE,mBAAmB,EAAE,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mezo-org/passport",
|
|
3
|
-
"version": "0.4.0-dev.
|
|
3
|
+
"version": "0.4.0-dev.75",
|
|
4
4
|
"main": "dist/src/index.js",
|
|
5
5
|
"license": "GPL-3.0-only",
|
|
6
6
|
"scripts": {
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"typescript": "^5.4.3"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@mezo-org/mezo-clay": "0.1.0-dev.
|
|
40
|
+
"@mezo-org/mezo-clay": "0.1.0-dev.28",
|
|
41
41
|
"@mezo-org/mezod-contracts": "^1.0.0",
|
|
42
42
|
"@mezo-org/musd-contracts": "^1.0.1",
|
|
43
43
|
"@mezo-org/orangekit": "1.0.0-beta.40-dev.19",
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { useSignMessage } from "wagmi"
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
DefaultError,
|
|
4
|
+
MutationOptions,
|
|
5
|
+
useMutation,
|
|
6
|
+
} from "@tanstack/react-query"
|
|
3
7
|
import { useCreateAccount } from "./useCreateAccount"
|
|
4
8
|
import { useCreateSession } from "./useCreateSession"
|
|
5
9
|
import { useEnsureNoSessionAndFetchNonce } from "./useEnsureNoSessionAndFetchNonce"
|
|
@@ -14,12 +18,16 @@ import useWalletAccount from "./useWalletAccount"
|
|
|
14
18
|
function useAuthenticateWithWallet(
|
|
15
19
|
shouldCreateAccount = false,
|
|
16
20
|
mutationOptions: Omit<
|
|
17
|
-
MutationOptions<Session>,
|
|
21
|
+
MutationOptions<Session, DefaultError, number | void>,
|
|
18
22
|
"mutationFn" | "mutationKey"
|
|
19
23
|
> = {},
|
|
20
24
|
) {
|
|
21
|
-
const {
|
|
22
|
-
|
|
25
|
+
const {
|
|
26
|
+
walletAddress,
|
|
27
|
+
chainId: walletChainId,
|
|
28
|
+
connector,
|
|
29
|
+
networkFamily,
|
|
30
|
+
} = useWalletAccount()
|
|
23
31
|
const { ensureNoSessionAndFetchNonce } = useEnsureNoSessionAndFetchNonce()
|
|
24
32
|
const { createSessionAsync } = useCreateSession()
|
|
25
33
|
const { createAccountAsync } = useCreateAccount()
|
|
@@ -34,7 +42,7 @@ function useAuthenticateWithWallet(
|
|
|
34
42
|
)
|
|
35
43
|
|
|
36
44
|
const { mutate, mutateAsync, ...signInMutationRestParameters } = useMutation({
|
|
37
|
-
mutationFn: async () => {
|
|
45
|
+
mutationFn: async (chainId?: number | void) => {
|
|
38
46
|
if (!walletAddress) {
|
|
39
47
|
throw new Error("Sign in error: Wallet not connected!")
|
|
40
48
|
}
|
|
@@ -45,7 +53,7 @@ function useAuthenticateWithWallet(
|
|
|
45
53
|
walletAddress,
|
|
46
54
|
nonce,
|
|
47
55
|
networkFamily,
|
|
48
|
-
chainId,
|
|
56
|
+
chainId ?? walletChainId,
|
|
49
57
|
)
|
|
50
58
|
const signatureResult = await signMessageAsync({
|
|
51
59
|
message: messageResult,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { MutationOptions } from "@tanstack/react-query"
|
|
1
|
+
import { DefaultError, MutationOptions } from "@tanstack/react-query"
|
|
2
2
|
import { useAuthenticateWithWallet } from "./useAuthenticateWithWallet"
|
|
3
3
|
import type { Session } from "../api"
|
|
4
4
|
|
|
5
5
|
function useSignInWithWallet(
|
|
6
6
|
mutationOptions: Omit<
|
|
7
|
-
MutationOptions<Session>,
|
|
7
|
+
MutationOptions<Session, DefaultError, number | void>,
|
|
8
8
|
"mutationFn" | "mutationKey"
|
|
9
9
|
> = {},
|
|
10
10
|
) {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { MutationOptions } from "@tanstack/react-query"
|
|
1
|
+
import { DefaultError, MutationOptions } from "@tanstack/react-query"
|
|
2
2
|
import { useAuthenticateWithWallet } from "./useAuthenticateWithWallet"
|
|
3
3
|
import type { Session } from "../api"
|
|
4
4
|
|
|
5
5
|
function useSignUpWithWallet(
|
|
6
6
|
mutationOptions: Omit<
|
|
7
|
-
MutationOptions<Session>,
|
|
7
|
+
MutationOptions<Session, DefaultError, number | void>,
|
|
8
8
|
"mutationFn" | "mutationKey"
|
|
9
9
|
> = {},
|
|
10
10
|
) {
|