create-openfort 0.1.8 → 0.1.10
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/CHANGELOG.md +12 -0
- package/dist/index.js +16 -16
- package/package.json +1 -1
- package/template/backend/package.json +7 -1
- package/template/backend/pnpm-lock.yaml +187 -33
- package/template/backend/src/app.ts +1 -1
- package/template/openfort-templates/firebase/biome.json +3 -3
- package/template/openfort-templates/firebase/package.json +1 -1
- package/template/openfort-templates/firebase/src/App.tsx +10 -10
- package/template/openfort-templates/firebase/src/components/cards/head.tsx +157 -145
- package/template/openfort-templates/firebase/src/components/cards/main.tsx +63 -52
- package/template/openfort-templates/firebase/src/components/ui/Sheet.tsx +14 -16
- package/template/openfort-templates/firebase/src/components/ui/Tabs.tsx +46 -36
- package/template/openfort-templates/firebase/src/components/ui/TruncateData.tsx +14 -8
- package/template/openfort-templates/firebase/src/integrations/firebase/client.ts +6 -6
- package/template/openfort-templates/firebase/src/integrations/firebase/components/FirebaseAuthCard.tsx +74 -46
- package/template/openfort-templates/firebase/src/integrations/firebase/errors.ts +57 -37
- package/template/openfort-templates/firebase/src/integrations/firebase/index.ts +3 -3
- package/template/openfort-templates/firebase/src/integrations/openfort/index.ts +1 -1
- package/template/openfort-templates/firebase/src/integrations/openfort/providers.tsx +23 -11
- package/template/openfort-templates/firebase/src/ui/openfort/blockchain/ActionsCard.tsx +47 -35
- package/template/openfort-templates/firebase/src/ui/openfort/blockchain/SignCard.tsx +30 -28
- package/template/openfort-templates/firebase/src/ui/openfort/index.ts +4 -6
- package/template/openfort-templates/firebase/src/ui/openfort/profile/UserProfileCard.tsx +32 -20
- package/template/openfort-templates/firebase/src/ui/openfort/wallets/WalletCreation.tsx +51 -27
- package/template/openfort-templates/firebase/src/ui/openfort/wallets/WalletListCard.tsx +66 -40
- package/template/openfort-templates/firebase/src/ui/openfort/wallets/WalletPasswordSheets.tsx +65 -41
- package/template/openfort-templates/firebase/vite.config.ts +3 -3
- package/template/openfort-templates/headless/biome.json +3 -3
- package/template/openfort-templates/headless/package.json +1 -1
- package/template/openfort-templates/headless/src/components/cards/auth.tsx +2 -2
- package/template/openfort-templates/headless/src/components/cards/profile.tsx +1 -3
- package/template/openfort-templates/headless/src/components/providers.tsx +4 -1
- package/template/openfort-templates/headless/src/index.css +10 -4
- package/template/openfort-templates/openfort-ui/biome.json +3 -3
- package/template/openfort-templates/openfort-ui/package.json +1 -1
- package/template/openfort-templates/openfort-ui/src/App.tsx +1 -3
- package/template/openfort-templates/openfort-ui/src/components/cards/auth.tsx +9 -11
- package/template/openfort-templates/openfort-ui/src/components/cards/head.tsx +157 -145
- package/template/openfort-templates/openfort-ui/src/components/cards/main.tsx +50 -41
- package/template/openfort-templates/openfort-ui/src/components/cards/profile.tsx +29 -35
- package/template/openfort-templates/openfort-ui/src/components/cards/sign.tsx +35 -49
- package/template/openfort-templates/openfort-ui/src/components/cards/wallets.tsx +51 -37
- package/template/openfort-templates/openfort-ui/src/components/createWallet.tsx +63 -30
- package/template/openfort-templates/openfort-ui/src/components/passwordRecovery.tsx +61 -56
- package/template/openfort-templates/openfort-ui/src/components/providers.tsx +14 -15
- package/template/openfort-templates/openfort-ui/src/components/ui/Sheet.tsx +14 -16
- package/template/openfort-templates/openfort-ui/src/components/ui/Tabs.tsx +46 -36
- package/template/openfort-templates/openfort-ui/src/components/ui/TruncateData.tsx +14 -8
- package/template/openfort-templates/openfort-ui/vite.config.ts +2 -2
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import { BookOpenIcon } from
|
|
2
|
-
import { useSignOut, useUser } from
|
|
3
|
-
import { useAccount } from
|
|
4
|
-
import { Auth } from
|
|
1
|
+
import { BookOpenIcon } from '@heroicons/react/24/outline'
|
|
2
|
+
import { useSignOut, useUser } from '@openfort/react'
|
|
3
|
+
import { useAccount } from 'wagmi'
|
|
4
|
+
import { Auth } from './auth'
|
|
5
5
|
|
|
6
6
|
export const Profile = ({
|
|
7
7
|
sampleGithubUrl,
|
|
8
8
|
description,
|
|
9
9
|
}: {
|
|
10
|
-
sampleGithubUrl: string
|
|
11
|
-
description: string
|
|
10
|
+
sampleGithubUrl: string
|
|
11
|
+
description: string
|
|
12
12
|
}) => {
|
|
13
|
-
const { user } = useUser()
|
|
14
|
-
const isLocal = window.location.hostname ===
|
|
15
|
-
const { signOut } = useSignOut()
|
|
13
|
+
const { user } = useUser()
|
|
14
|
+
const isLocal = window.location.hostname === 'localhost'
|
|
15
|
+
const { signOut } = useSignOut()
|
|
16
16
|
|
|
17
|
-
const { isConnected } = useAccount()
|
|
17
|
+
const { isConnected } = useAccount()
|
|
18
18
|
|
|
19
19
|
if (!isConnected) {
|
|
20
|
-
return <Auth
|
|
20
|
+
return <Auth />
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
return (
|
|
24
24
|
<div className="flex flex-col flex-1 gap-4">
|
|
25
25
|
<h1 className="truncate">
|
|
26
|
-
Welcome, {user?.
|
|
26
|
+
Welcome, {user?.name || user?.email}
|
|
27
27
|
</h1>
|
|
28
28
|
<p className="text-zinc-400 text-sm">
|
|
29
29
|
{description}
|
|
@@ -31,27 +31,21 @@ export const Profile = ({
|
|
|
31
31
|
You can sign messages and interact with smart contracts.
|
|
32
32
|
</p>
|
|
33
33
|
<p>
|
|
34
|
-
|
|
35
34
|
<div className="border border-zinc-700 rounded p-4">
|
|
36
35
|
<h2 className="mb-2">Get started</h2>
|
|
37
36
|
<p className="mb-2 text-zinc-400 text-sm">
|
|
38
|
-
Start by creating a wallet, minting some tokens and signing
|
|
37
|
+
Start by creating a wallet, minting some tokens and signing
|
|
38
|
+
messages.
|
|
39
39
|
</p>
|
|
40
|
-
{
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
<p className="mb-2 text-sm">
|
|
50
|
-
Clone this project and test it yourself, it is open source!
|
|
51
|
-
</p>
|
|
52
|
-
</>
|
|
53
|
-
)
|
|
54
|
-
}
|
|
40
|
+
{isLocal ? (
|
|
41
|
+
<p className="mb-2 text-sm">
|
|
42
|
+
Edit <code>src/components/main.tsx</code> to customize the app.
|
|
43
|
+
</p>
|
|
44
|
+
) : (
|
|
45
|
+
<p className="mb-2 text-sm">
|
|
46
|
+
Clone this project and test it yourself, it is open source!
|
|
47
|
+
</p>
|
|
48
|
+
)}
|
|
55
49
|
<div className="flex gap-4 mt-4">
|
|
56
50
|
<a
|
|
57
51
|
href={sampleGithubUrl}
|
|
@@ -60,7 +54,8 @@ export const Profile = ({
|
|
|
60
54
|
rel="noreferrer"
|
|
61
55
|
>
|
|
62
56
|
<img
|
|
63
|
-
src="/githubLogo.svg"
|
|
57
|
+
src="/githubLogo.svg"
|
|
58
|
+
className="w-5 h-5 mr-2"
|
|
64
59
|
alt="GitHub logo"
|
|
65
60
|
/>
|
|
66
61
|
View on github
|
|
@@ -76,17 +71,16 @@ export const Profile = ({
|
|
|
76
71
|
</a>
|
|
77
72
|
</div>
|
|
78
73
|
</div>
|
|
79
|
-
|
|
80
74
|
</p>
|
|
81
75
|
|
|
82
76
|
<button
|
|
83
77
|
onClick={() => {
|
|
84
|
-
signOut()
|
|
78
|
+
signOut()
|
|
85
79
|
}}
|
|
86
80
|
className="btn mt-auto"
|
|
87
81
|
>
|
|
88
82
|
Sign Out
|
|
89
83
|
</button>
|
|
90
|
-
</div
|
|
91
|
-
)
|
|
92
|
-
}
|
|
84
|
+
</div>
|
|
85
|
+
)
|
|
86
|
+
}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { useChainId, useSignMessage, useSignTypedData } from
|
|
2
|
-
import { TruncateData } from
|
|
3
|
-
|
|
1
|
+
import { useChainId, useSignMessage, useSignTypedData } from 'wagmi'
|
|
2
|
+
import { TruncateData } from '../ui/TruncateData'
|
|
4
3
|
|
|
5
4
|
function SignTypedData() {
|
|
6
5
|
const { signTypedData, error, data } = useSignTypedData()
|
|
7
|
-
const chainId = useChainId()
|
|
6
|
+
const chainId = useChainId()
|
|
8
7
|
|
|
9
8
|
return (
|
|
10
9
|
<div>
|
|
@@ -15,52 +14,47 @@ function SignTypedData() {
|
|
|
15
14
|
event.preventDefault()
|
|
16
15
|
signTypedData({
|
|
17
16
|
domain: {
|
|
18
|
-
name:
|
|
19
|
-
version:
|
|
17
|
+
name: 'Ether Mail',
|
|
18
|
+
version: '1',
|
|
20
19
|
chainId: chainId,
|
|
21
|
-
verifyingContract:
|
|
20
|
+
verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC',
|
|
22
21
|
},
|
|
23
22
|
types: {
|
|
24
23
|
Person: [
|
|
25
|
-
{ name:
|
|
26
|
-
{ name:
|
|
24
|
+
{ name: 'name', type: 'string' },
|
|
25
|
+
{ name: 'wallet', type: 'address' },
|
|
27
26
|
],
|
|
28
27
|
Mail: [
|
|
29
|
-
{ name:
|
|
30
|
-
{ name:
|
|
31
|
-
{ name:
|
|
32
|
-
]
|
|
28
|
+
{ name: 'from', type: 'Person' },
|
|
29
|
+
{ name: 'to', type: 'Person' },
|
|
30
|
+
{ name: 'contents', type: 'string' },
|
|
31
|
+
],
|
|
33
32
|
},
|
|
34
|
-
primaryType:
|
|
33
|
+
primaryType: 'Mail',
|
|
35
34
|
message: {
|
|
36
35
|
from: {
|
|
37
|
-
name:
|
|
38
|
-
wallet:
|
|
36
|
+
name: 'Cow',
|
|
37
|
+
wallet: '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826',
|
|
39
38
|
},
|
|
40
39
|
to: {
|
|
41
|
-
name:
|
|
42
|
-
wallet:
|
|
40
|
+
name: 'Bob',
|
|
41
|
+
wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB',
|
|
43
42
|
},
|
|
44
|
-
contents:
|
|
45
|
-
}
|
|
43
|
+
contents: 'Hello, Bob!',
|
|
44
|
+
},
|
|
46
45
|
})
|
|
47
46
|
}}
|
|
48
47
|
>
|
|
49
|
-
<button
|
|
50
|
-
type="submit"
|
|
51
|
-
className="btn"
|
|
52
|
-
>
|
|
48
|
+
<button type="submit" className="btn">
|
|
53
49
|
Sign Message
|
|
54
50
|
</button>
|
|
55
|
-
|
|
56
51
|
</form>
|
|
57
52
|
<TruncateData data={data} />
|
|
58
53
|
<TruncateData data={error?.message} className="text-red-500" />
|
|
59
|
-
</div
|
|
54
|
+
</div>
|
|
60
55
|
)
|
|
61
56
|
}
|
|
62
57
|
|
|
63
|
-
|
|
64
58
|
function SignMessage() {
|
|
65
59
|
const { data, signMessage, error } = useSignMessage()
|
|
66
60
|
|
|
@@ -72,40 +66,32 @@ function SignMessage() {
|
|
|
72
66
|
onSubmit={(event) => {
|
|
73
67
|
event.preventDefault()
|
|
74
68
|
const formData = new FormData(event.target as HTMLFormElement)
|
|
75
|
-
console.log(
|
|
69
|
+
console.log('Message to sign:', formData.get('message'))
|
|
76
70
|
signMessage({ message: formData.get('message') as string })
|
|
77
71
|
}}
|
|
78
72
|
>
|
|
79
|
-
<input
|
|
80
|
-
|
|
81
|
-
placeholder="Message to sign"
|
|
82
|
-
/>
|
|
83
|
-
<button
|
|
84
|
-
type="submit"
|
|
85
|
-
className="btn"
|
|
86
|
-
>
|
|
73
|
+
<input name="message" placeholder="Message to sign" />
|
|
74
|
+
<button type="submit" className="btn">
|
|
87
75
|
Sign Message
|
|
88
76
|
</button>
|
|
89
77
|
</form>
|
|
90
78
|
<TruncateData data={error?.message} className="text-red-500" />
|
|
91
79
|
<TruncateData data={data} />
|
|
92
|
-
</div
|
|
80
|
+
</div>
|
|
93
81
|
)
|
|
94
82
|
}
|
|
95
83
|
|
|
96
84
|
export const Sign = () => {
|
|
97
85
|
return (
|
|
98
|
-
|
|
99
|
-
<
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
<
|
|
105
|
-
|
|
106
|
-
<SignTypedData />
|
|
107
|
-
</div>
|
|
86
|
+
<div className="flex flex-col w-full">
|
|
87
|
+
<h1>Signatures</h1>
|
|
88
|
+
<p className="mb-4 text-sm text-zinc-400">
|
|
89
|
+
Sign messages and typed data with your connected wallet.
|
|
90
|
+
</p>
|
|
91
|
+
<div className="space-y-6">
|
|
92
|
+
<SignMessage />
|
|
93
|
+
<SignTypedData />
|
|
108
94
|
</div>
|
|
109
|
-
|
|
95
|
+
</div>
|
|
110
96
|
)
|
|
111
|
-
}
|
|
97
|
+
}
|
|
@@ -1,17 +1,35 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
FingerPrintIcon,
|
|
3
|
+
KeyIcon,
|
|
4
|
+
LockClosedIcon,
|
|
5
|
+
} from '@heroicons/react/24/outline'
|
|
6
|
+
import {
|
|
7
|
+
RecoveryMethod,
|
|
8
|
+
type UserWallet,
|
|
9
|
+
useSignOut,
|
|
10
|
+
useUser,
|
|
11
|
+
useWallets,
|
|
12
|
+
} from '@openfort/react'
|
|
13
|
+
import { useState } from 'react'
|
|
14
|
+
import { useAccount } from 'wagmi'
|
|
15
|
+
import { CreateWallet, CreateWalletSheet } from '../createWallet'
|
|
16
|
+
import { WalletRecoverPasswordSheet } from '../passwordRecovery'
|
|
7
17
|
|
|
8
18
|
export const Wallets = () => {
|
|
9
|
-
const {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
19
|
+
const {
|
|
20
|
+
wallets,
|
|
21
|
+
isLoadingWallets,
|
|
22
|
+
availableWallets,
|
|
23
|
+
setActiveWallet,
|
|
24
|
+
isConnecting,
|
|
25
|
+
} = useWallets()
|
|
26
|
+
const { user, isAuthenticated } = useUser()
|
|
27
|
+
const { isConnected } = useAccount()
|
|
28
|
+
const [createWalletSheetOpen, setCreateWalletSheetOpen] = useState(false)
|
|
29
|
+
const [walletToRecover, setWalletToRecover] = useState<UserWallet | null>(
|
|
30
|
+
null,
|
|
31
|
+
)
|
|
32
|
+
const { signOut } = useSignOut()
|
|
15
33
|
|
|
16
34
|
if (isLoadingWallets || (!user && isAuthenticated)) {
|
|
17
35
|
return <div>Loading wallets...</div>
|
|
@@ -27,23 +45,23 @@ export const Wallets = () => {
|
|
|
27
45
|
}
|
|
28
46
|
|
|
29
47
|
const renderWalletRecovery = (wallet: UserWallet) => {
|
|
30
|
-
let Icon = LockClosedIcon
|
|
31
|
-
let text =
|
|
32
|
-
const method = wallet.recoveryMethod
|
|
48
|
+
let Icon = LockClosedIcon
|
|
49
|
+
let text = 'Unknown'
|
|
50
|
+
const method = wallet.recoveryMethod
|
|
33
51
|
|
|
34
52
|
switch (method) {
|
|
35
53
|
case RecoveryMethod.PASSWORD:
|
|
36
|
-
Icon = KeyIcon
|
|
37
|
-
text =
|
|
38
|
-
break
|
|
54
|
+
Icon = KeyIcon
|
|
55
|
+
text = 'Password'
|
|
56
|
+
break
|
|
39
57
|
case RecoveryMethod.AUTOMATIC:
|
|
40
|
-
Icon = LockClosedIcon
|
|
41
|
-
text =
|
|
42
|
-
break
|
|
58
|
+
Icon = LockClosedIcon
|
|
59
|
+
text = 'Automatic'
|
|
60
|
+
break
|
|
43
61
|
case RecoveryMethod.PASSKEY:
|
|
44
|
-
Icon = FingerPrintIcon
|
|
45
|
-
text =
|
|
46
|
-
break
|
|
62
|
+
Icon = FingerPrintIcon
|
|
63
|
+
text = 'Passkey'
|
|
64
|
+
break
|
|
47
65
|
}
|
|
48
66
|
|
|
49
67
|
return (
|
|
@@ -55,14 +73,13 @@ export const Wallets = () => {
|
|
|
55
73
|
}
|
|
56
74
|
|
|
57
75
|
const handleWalletClick = (wallet: UserWallet) => {
|
|
58
|
-
if (wallet.isActive || isConnecting) return
|
|
59
|
-
const method = wallet.recoveryMethod
|
|
76
|
+
if (wallet.isActive || isConnecting) return
|
|
77
|
+
const method = wallet.recoveryMethod
|
|
60
78
|
if (method === RecoveryMethod.PASSWORD) {
|
|
61
|
-
setWalletToRecover(wallet)
|
|
62
|
-
|
|
79
|
+
setWalletToRecover(wallet)
|
|
63
80
|
} else {
|
|
64
81
|
setActiveWallet({
|
|
65
|
-
walletId:
|
|
82
|
+
walletId: 'xyz.openfort',
|
|
66
83
|
address: wallet.address,
|
|
67
84
|
})
|
|
68
85
|
}
|
|
@@ -86,13 +103,11 @@ export const Wallets = () => {
|
|
|
86
103
|
disabled={wallet.isActive || isConnecting}
|
|
87
104
|
>
|
|
88
105
|
{wallet.isConnecting ? (
|
|
89
|
-
<p>
|
|
90
|
-
Connecting...
|
|
91
|
-
</p>
|
|
106
|
+
<p>Connecting...</p>
|
|
92
107
|
) : (
|
|
93
108
|
<div className="flex justify-between items-center">
|
|
94
109
|
<p className="font-medium mr-2">
|
|
95
|
-
{wallet.address.substring(0, 6)
|
|
110
|
+
{`${wallet.address.substring(0, 6)}...${wallet.address.substring(wallet.address.length - 4)}`}
|
|
96
111
|
</p>
|
|
97
112
|
{renderWalletRecovery(wallet)}
|
|
98
113
|
</div>
|
|
@@ -118,17 +133,16 @@ export const Wallets = () => {
|
|
|
118
133
|
onClose={() => setCreateWalletSheetOpen(false)}
|
|
119
134
|
/>
|
|
120
135
|
|
|
121
|
-
{
|
|
122
|
-
!isConnected &&
|
|
136
|
+
{!isConnected && (
|
|
123
137
|
<button
|
|
124
138
|
onClick={() => {
|
|
125
|
-
signOut()
|
|
139
|
+
signOut()
|
|
126
140
|
}}
|
|
127
141
|
className="mt-auto btn"
|
|
128
142
|
>
|
|
129
143
|
Sign Out
|
|
130
144
|
</button>
|
|
131
|
-
}
|
|
145
|
+
)}
|
|
132
146
|
</div>
|
|
133
147
|
)
|
|
134
148
|
}
|
|
@@ -1,22 +1,36 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import {
|
|
2
|
+
FingerPrintIcon,
|
|
3
|
+
KeyIcon,
|
|
4
|
+
LockClosedIcon,
|
|
5
|
+
} from '@heroicons/react/24/outline'
|
|
6
|
+
import { RecoveryMethod, useWallets } from '@openfort/react'
|
|
7
|
+
import { useState } from 'react'
|
|
8
|
+
import { CreateWalletPasswordSheet } from './passwordRecovery'
|
|
9
|
+
import { Sheet } from './ui/Sheet'
|
|
6
10
|
|
|
7
|
-
export const CreateWalletSheet = ({
|
|
11
|
+
export const CreateWalletSheet = ({
|
|
12
|
+
open,
|
|
13
|
+
onClose,
|
|
14
|
+
}: {
|
|
15
|
+
open: boolean
|
|
16
|
+
onClose: () => void
|
|
17
|
+
}) => {
|
|
8
18
|
return (
|
|
9
19
|
<Sheet
|
|
10
20
|
open={open}
|
|
11
|
-
onClose={() => {
|
|
21
|
+
onClose={() => {
|
|
22
|
+
onClose()
|
|
23
|
+
}}
|
|
12
24
|
title="Create Wallet"
|
|
13
25
|
description="Please choose a recovery method for your new wallet."
|
|
14
26
|
>
|
|
15
27
|
<CreateWallet
|
|
16
|
-
onWalletCreated={() => {
|
|
28
|
+
onWalletCreated={() => {
|
|
29
|
+
onClose()
|
|
30
|
+
}}
|
|
17
31
|
/>
|
|
18
32
|
</Sheet>
|
|
19
|
-
)
|
|
33
|
+
)
|
|
20
34
|
}
|
|
21
35
|
|
|
22
36
|
export const CreateWallet = ({
|
|
@@ -24,16 +38,16 @@ export const CreateWallet = ({
|
|
|
24
38
|
}: {
|
|
25
39
|
onWalletCreated?: () => void
|
|
26
40
|
}) => {
|
|
27
|
-
const [passwordSheetOpen, setPasswordSheetOpen] = useState(false)
|
|
41
|
+
const [passwordSheetOpen, setPasswordSheetOpen] = useState(false)
|
|
28
42
|
|
|
29
43
|
const { isCreating, createWallet, error } = useWallets({
|
|
30
44
|
onSuccess: () => {
|
|
31
|
-
onWalletCreated?.()
|
|
32
|
-
}
|
|
33
|
-
})
|
|
45
|
+
onWalletCreated?.()
|
|
46
|
+
},
|
|
47
|
+
})
|
|
34
48
|
|
|
35
49
|
if (isCreating) {
|
|
36
|
-
return <div>Creating wallet...</div
|
|
50
|
+
return <div>Creating wallet...</div>
|
|
37
51
|
}
|
|
38
52
|
|
|
39
53
|
return (
|
|
@@ -41,30 +55,38 @@ export const CreateWallet = ({
|
|
|
41
55
|
<div className="flex flex-col gap-4 wallet-option-group mb-4">
|
|
42
56
|
<button
|
|
43
57
|
className="wallet-option cursor-pointer"
|
|
44
|
-
onClick={() =>
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
58
|
+
onClick={() =>
|
|
59
|
+
createWallet({
|
|
60
|
+
recovery: {
|
|
61
|
+
recoveryMethod: RecoveryMethod.PASSKEY,
|
|
62
|
+
},
|
|
63
|
+
})
|
|
64
|
+
}
|
|
49
65
|
>
|
|
50
66
|
<FingerPrintIcon />
|
|
51
67
|
<div className="flex flex-col text-start">
|
|
52
68
|
<h4>Passkey</h4>
|
|
53
|
-
<p className="text-sm hover-description">
|
|
69
|
+
<p className="text-sm hover-description">
|
|
70
|
+
Secure your wallet with biometric authentication.
|
|
71
|
+
</p>
|
|
54
72
|
</div>
|
|
55
73
|
</button>
|
|
56
74
|
<button
|
|
57
75
|
className="wallet-option cursor-pointer"
|
|
58
|
-
onClick={() =>
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
76
|
+
onClick={() =>
|
|
77
|
+
createWallet({
|
|
78
|
+
recovery: {
|
|
79
|
+
recoveryMethod: RecoveryMethod.AUTOMATIC,
|
|
80
|
+
},
|
|
81
|
+
})
|
|
82
|
+
}
|
|
63
83
|
>
|
|
64
84
|
<LockClosedIcon />
|
|
65
85
|
<div className="flex flex-col text-start">
|
|
66
86
|
<h4>Automatic recovery</h4>
|
|
67
|
-
<p className="text-sm hover-description">
|
|
87
|
+
<p className="text-sm hover-description">
|
|
88
|
+
Uses encryption session to recover your wallet.
|
|
89
|
+
</p>
|
|
68
90
|
</div>
|
|
69
91
|
</button>
|
|
70
92
|
<button
|
|
@@ -74,15 +96,26 @@ export const CreateWallet = ({
|
|
|
74
96
|
<KeyIcon />
|
|
75
97
|
<div className="flex flex-col text-start">
|
|
76
98
|
<h4>Password</h4>
|
|
77
|
-
<p className="text-sm hover-description">
|
|
99
|
+
<p className="text-sm hover-description">
|
|
100
|
+
Create a strong password to secure your wallet.
|
|
101
|
+
</p>
|
|
78
102
|
</div>
|
|
79
103
|
</button>
|
|
80
104
|
</div>
|
|
81
|
-
{error &&
|
|
105
|
+
{error && (
|
|
106
|
+
<p className="text-red-500 text-sm mb-2">Error: {error.message}</p>
|
|
107
|
+
)}
|
|
82
108
|
<p className="mb-4 text-xs text-zinc-400">
|
|
83
|
-
Disclaimer: This is a demo of Openfort recovery methods. In production,
|
|
109
|
+
Disclaimer: This is a demo of Openfort recovery methods. In production,
|
|
110
|
+
it's best to choose one method for a smoother user experience.
|
|
84
111
|
</p>
|
|
85
|
-
<CreateWalletPasswordSheet
|
|
112
|
+
<CreateWalletPasswordSheet
|
|
113
|
+
open={passwordSheetOpen}
|
|
114
|
+
onClose={() => setPasswordSheetOpen(false)}
|
|
115
|
+
onCreateWallet={() => {
|
|
116
|
+
onWalletCreated?.()
|
|
117
|
+
}}
|
|
118
|
+
/>
|
|
86
119
|
</>
|
|
87
120
|
)
|
|
88
121
|
}
|