Skip to content

Commit 4c4df85

Browse files
committed
Merge branch 'main' into bc/turborepo
2 parents fd9e5e9 + ee547aa commit 4c4df85

File tree

25 files changed

+428
-359
lines changed

25 files changed

+428
-359
lines changed

.changeset/loud-bulldogs-hide.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@turnkey/sdk-react": major
3+
---
4+
5+
Remove references to server actions and import from sdk-server

.changeset/orange-carrots-sparkle.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@turnkey/sdk-server": major
3+
---
4+
5+
Add server actions

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

+18-20
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,10 @@ import {
44
Export,
55
Import,
66
useTurnkey,
7-
getSuborgs,
8-
getVerifiedSuborgs,
97
OtpVerification,
108
OtpType,
11-
initOtpAuth,
129
} from "@turnkey/sdk-react";
10+
import { server } from "@turnkey/sdk-server";
1311
import { useEffect, useState } from "react";
1412
import "./dashboard.css";
1513
import {
@@ -84,31 +82,31 @@ export default function Dashboard() {
8482
toast.success("Wallet successfully imported");
8583
};
8684
const handleResendEmail = async () => {
87-
const initAuthResponse = await initOtpAuth({
85+
const sendOtpResponse = await server.sendOtp({
8886
suborgID: suborgId,
8987
otpType: OtpType.Email,
9088
contact: emailInput,
9189
userIdentifier: authIframeClient?.iframePublicKey!,
9290
});
93-
if (!initAuthResponse || !initAuthResponse.otpId!) {
91+
if (!sendOtpResponse || !sendOtpResponse.otpId!) {
9492
toast.error("Failed to send OTP");
9593
return;
9694
}
97-
setOtpId(initAuthResponse?.otpId!);
95+
setOtpId(sendOtpResponse?.otpId!);
9896
};
9997
const handleResendSms = async () => {
100-
const initAuthResponse = await initOtpAuth({
98+
const sendOtpResponse = await server.sendOtp({
10199
suborgID: suborgId,
102100
otpType: OtpType.Sms,
103101
contact: phoneInput,
104102
customSmsMessage: "Your Turnkey Demo OTP is {{.OtpCode}}",
105103
userIdentifier: authIframeClient?.iframePublicKey!,
106104
});
107-
if (!initAuthResponse || !initAuthResponse.otpId!) {
105+
if (!sendOtpResponse || !sendOtpResponse.otpId!) {
108106
toast.error("Failed to send OTP");
109107
return;
110108
}
111-
setOtpId(initAuthResponse?.otpId!);
109+
setOtpId(sendOtpResponse?.otpId!);
112110
};
113111

114112
const handleOtpSuccess = async (credentialBundle: any) => {
@@ -125,7 +123,7 @@ export default function Dashboard() {
125123
toast.error("Please enter a valid email address");
126124
return;
127125
}
128-
const suborgs = await getVerifiedSuborgs({
126+
const suborgs = await server.getVerifiedSuborgs({
129127
filterType: "EMAIL",
130128
filterValue: emailInput,
131129
});
@@ -139,17 +137,17 @@ export default function Dashboard() {
139137
userEmail: emailInput,
140138
userTagIds: [],
141139
});
142-
const initAuthResponse = await initOtpAuth({
140+
const sendOtpResponse = await server.sendOtp({
143141
suborgID: suborgId,
144142
otpType: OtpType.Email,
145143
contact: emailInput,
146144
userIdentifier: authIframeClient?.iframePublicKey!,
147145
});
148-
if (!initAuthResponse || !initAuthResponse.otpId!) {
146+
if (!sendOtpResponse || !sendOtpResponse.otpId!) {
149147
toast.error("Failed to send OTP");
150148
return;
151149
}
152-
setOtpId(initAuthResponse?.otpId!);
150+
setOtpId(sendOtpResponse?.otpId!);
153151
setIsEmailModalOpen(false);
154152
setIsOtpModalOpen(true);
155153
};
@@ -159,7 +157,7 @@ export default function Dashboard() {
159157
toast.error("Please enter a valid phone number.");
160158
return;
161159
}
162-
const suborgs = await getVerifiedSuborgs({
160+
const suborgs = await server.getVerifiedSuborgs({
163161
filterType: "PHONE_NUMBER",
164162
filterValue: phoneInput,
165163
});
@@ -173,18 +171,18 @@ export default function Dashboard() {
173171
userPhoneNumber: phoneInput,
174172
userTagIds: [],
175173
});
176-
const initAuthResponse = await initOtpAuth({
174+
const sendOtpResponse = await server.sendOtp({
177175
suborgID: suborgId,
178176
otpType: OtpType.Sms,
179177
contact: phoneInput,
180178
customSmsMessage: "Your Turnkey Demo OTP is {{.OtpCode}}",
181179
userIdentifier: authIframeClient?.iframePublicKey!,
182180
});
183-
if (!initAuthResponse || !initAuthResponse.otpId!) {
181+
if (!sendOtpResponse || !sendOtpResponse.otpId!) {
184182
toast.error("Failed to send OTP");
185183
return;
186184
}
187-
setOtpId(initAuthResponse?.otpId!);
185+
setOtpId(sendOtpResponse?.otpId!);
188186
setIsEmailModalOpen(false);
189187
setIsOtpModalOpen(true);
190188
};
@@ -223,7 +221,7 @@ export default function Dashboard() {
223221
console.error(`Unknown OAuth type: ${oauthType}`);
224222
}
225223
if (oidcToken) {
226-
const suborgs = await getSuborgs({
224+
const suborgs = await server.getSuborgs({
227225
filterType: "OIDC_TOKEN",
228226
filterValue: oidcToken.idToken,
229227
});
@@ -323,7 +321,7 @@ export default function Dashboard() {
323321
});
324322
setWallets(walletsResponse.wallets);
325323
if (userResponse.user.userEmail) {
326-
const suborgs = await getVerifiedSuborgs({
324+
const suborgs = await server.getVerifiedSuborgs({
327325
filterType: "EMAIL",
328326
filterValue: userResponse.user.userEmail,
329327
});
@@ -337,7 +335,7 @@ export default function Dashboard() {
337335
}
338336
}
339337
if (userResponse.user.userPhoneNumber) {
340-
const suborgs = await getVerifiedSuborgs({
338+
const suborgs = await server.getVerifiedSuborgs({
341339
filterType: "PHONE_NUMBER",
342340
filterValue: userResponse.user.userPhoneNumber,
343341
});

examples/sweeper/package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"prompts": "^2.4.2"
1818
},
1919
"devDependencies": {
20-
"@types/prompts": "^2.4.2"
20+
"@types/prompts": "^2.4.2",
21+
"typescript": "^5.1.3"
2122
}
2223
}

examples/trading-runner/package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
"prompts": "^2.4.2"
2121
},
2222
"devDependencies": {
23-
"@types/prompts": "^2.4.2"
23+
"@types/prompts": "^2.4.2",
24+
"typescript": "^5.1.3"
2425
}
2526
}

examples/with-uniswap/package.json

+3
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,8 @@
1717
"ethers": "^6.10.0",
1818
"hardhat": "^2.12.7",
1919
"jsbi": "^3.2.5"
20+
},
21+
"devDependencies": {
22+
"typescript": "^5.1.3"
2023
}
2124
}

examples/with-viem/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@
2121
"dotenv": "^16.0.3",
2222
"fetch": "^1.1.0",
2323
"prompts": "^2.4.2",
24-
"typescript": "5.1",
2524
"viem": "^1.16.6"
2625
},
2726
"devDependencies": {
28-
"@types/prompts": "^2.4.2"
27+
"@types/prompts": "^2.4.2",
28+
"typescript": "^5.1.3"
2929
}
3030
}

packages/eip-1193-provider/package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
"@turnkey/http": "workspace:*"
5656
},
5757
"devDependencies": {
58-
"hardhat": "^2.22.2"
58+
"hardhat": "^2.22.2",
59+
"typescript": "^5.1.3"
5960
}
6061
}

packages/sdk-react/src/actions/createSuborg.ts

-79
This file was deleted.

packages/sdk-react/src/actions/getSuborgs.ts

-38
This file was deleted.

packages/sdk-react/src/actions/getVerifiedSuborgs.ts

-38
This file was deleted.

packages/sdk-react/src/actions/index.ts

-8
This file was deleted.

0 commit comments

Comments
 (0)