Skip to content

Commit 98b7a9d

Browse files
committed
feat: add walletClient
1 parent 9293478 commit 98b7a9d

File tree

2 files changed

+18
-18
lines changed
  • examples/react-components/src/app/dashboard
  • packages/sdk-react/src/components/auth

2 files changed

+18
-18
lines changed

examples/react-components/src/app/dashboard/page.tsx

+12-12
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export default function Dashboard() {
5656
const [isDeleteModalOpen, setIsDeleteModalOpen] = useState(false);
5757
const [isPasskeyModalOpen, setIsPasskeyModalOpen] = useState(false);
5858
const [messageToSign, setMessageToSign] = useState(
59-
"Signing within Turnkey Demo.",
59+
"Signing within Turnkey Demo."
6060
);
6161
const [signature, setSignature] = useState<any>(null);
6262
const [suborgId, setSuborgId] = useState<string>("");
@@ -135,7 +135,7 @@ export default function Dashboard() {
135135
await authIframeClient?.updateUser({
136136
organizationId: suborgId,
137137
userId: user.userId,
138-
email: emailInput,
138+
userEmail: emailInput,
139139
});
140140

141141
const sendOtpResponse = await server.sendOtp({
@@ -169,7 +169,7 @@ export default function Dashboard() {
169169
await authIframeClient?.updateUser({
170170
organizationId: suborgId,
171171
userId: user.userId,
172-
phoneNumber: phoneInput,
172+
userPhoneNumber: phoneInput,
173173
});
174174

175175
const sendOtpResponse = await server.sendOtp({
@@ -452,19 +452,19 @@ export default function Dashboard() {
452452
signature.r,
453453
signature.s,
454454
signature.v,
455-
selectedAccount!,
455+
selectedAccount!
456456
)
457457
: verifySolSignatureWithAddress(
458458
messageToSign,
459459
signature.r,
460460
signature.s,
461-
selectedAccount!,
461+
selectedAccount!
462462
);
463463

464464
setMessageSigningResult(
465465
verificationPassed
466466
? "Verified! The address used to sign the message matches your wallet address."
467-
: "Verification failed.",
467+
: "Verification failed."
468468
);
469469
};
470470
if (loading) {
@@ -548,13 +548,13 @@ export default function Dashboard() {
548548
{user &&
549549
user.oauthProviders &&
550550
user.oauthProviders.some((provider: { issuer: string }) =>
551-
provider.issuer.toLowerCase().includes("google"),
551+
provider.issuer.toLowerCase().includes("google")
552552
) && <span className="loginMethodDetails">{}</span>}
553553
</div>
554554
{user &&
555555
user.oauthProviders &&
556556
user.oauthProviders.some((provider: { issuer: string }) =>
557-
provider.issuer.toLowerCase().includes("google"),
557+
provider.issuer.toLowerCase().includes("google")
558558
) ? (
559559
<CheckCircleIcon sx={{ color: "#4c48ff" }} />
560560
) : (
@@ -571,7 +571,7 @@ export default function Dashboard() {
571571
{user &&
572572
user.oauthProviders &&
573573
user.oauthProviders.some((provider: { issuer: string }) =>
574-
provider.issuer.toLowerCase().includes("apple"),
574+
provider.issuer.toLowerCase().includes("apple")
575575
) ? (
576576
<CheckCircleIcon sx={{ color: "#4c48ff" }} />
577577
) : (
@@ -588,7 +588,7 @@ export default function Dashboard() {
588588
{user &&
589589
user.oauthProviders &&
590590
user.oauthProviders.some((provider: { issuer: string }) =>
591-
provider.issuer.toLowerCase().includes("facebook"),
591+
provider.issuer.toLowerCase().includes("facebook")
592592
) ? (
593593
<CheckCircleIcon sx={{ color: "#4c48ff" }} />
594594
) : (
@@ -664,7 +664,7 @@ export default function Dashboard() {
664664
account.addressFormat === "ADDRESS_FORMAT_ETHEREUM"
665665
? `https://etherscan.io/address/${account.address}`
666666
: `https://solscan.io/account/${account.address}`,
667-
"_blank",
667+
"_blank"
668668
)
669669
}
670670
style={{
@@ -681,7 +681,7 @@ export default function Dashboard() {
681681
)}
682682
<span className="accountAddress">{`${account.address.slice(
683683
0,
684-
5,
684+
5
685685
)}...${account.address.slice(-5)}`}</span>
686686
<LaunchIcon className="launchIcon" />
687687
</div>

packages/sdk-react/src/components/auth/Auth.tsx

+6-6
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ const Auth: React.FC<AuthProps> = ({
8888
customSmsMessage,
8989
customAccounts,
9090
}) => {
91-
const { authIframeClient, passkeyClient } = useTurnkey();
91+
const { authIframeClient, passkeyClient, walletClient } = useTurnkey();
9292
const router = useRouter();
9393
const [email, setEmail] = useState<string>("");
9494
const [phone, setPhone] = useState<string>("");
@@ -139,13 +139,13 @@ const Auth: React.FC<AuthProps> = ({
139139

140140
const handleAuthSuccess = async (
141141
credentialBundle: any,
142-
expirationSeconds?: string,
142+
expirationSeconds?: string
143143
) => {
144144
if (credentialBundle) {
145145
await authIframeClient!.injectCredentialBundle(credentialBundle);
146146
await authIframeClient!.loginWithAuthBundle(
147147
credentialBundle,
148-
expirationSeconds,
148+
expirationSeconds
149149
);
150150
await onAuthSuccess();
151151
}
@@ -195,7 +195,7 @@ const Auth: React.FC<AuthProps> = ({
195195
await passkeyClient?.loginWithPasskey(
196196
SessionType.READ_WRITE,
197197
authIframeClient!,
198-
authIframeClient?.iframePublicKey!,
198+
authIframeClient?.iframePublicKey!
199199
);
200200
router.push("/dashboard");
201201
} catch {
@@ -208,7 +208,7 @@ const Auth: React.FC<AuthProps> = ({
208208
await passkeyClient?.loginWithPasskey(
209209
SessionType.READ_WRITE,
210210
authIframeClient!,
211-
authIframeClient?.iframePublicKey!,
211+
authIframeClient?.iframePublicKey!
212212
);
213213
router.push("/dashboard");
214214
} catch (error) {
@@ -219,7 +219,7 @@ const Auth: React.FC<AuthProps> = ({
219219
const handleOtpLogin = async (
220220
type: FilterType.Email | FilterType.PhoneNumber,
221221
value: string,
222-
otpType: string,
222+
otpType: string
223223
) => {
224224
const createSuborgData: Record<string, any> = {};
225225
if (type === FilterType.Email) createSuborgData.email = value;

0 commit comments

Comments
 (0)