Skip to content

Commit a25efee

Browse files
committed
Merge branch 'pb/circle-wallets-and-credentials' of github.com:thirdweb-dev/js into pb/circle-wallets-and-credentials
2 parents ecb8bdf + d14041a commit a25efee

File tree

128 files changed

+5126
-1897
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

128 files changed

+5126
-1897
lines changed

.changeset/lazy-files-act.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

.changeset/metal-crabs-beg.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@thirdweb-dev/service-utils": patch
3+
---
4+
5+
[service-utils] Allow client-side usageV2 reporting

.changeset/small-moons-behave.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

.changeset/thirty-monkeys-promise.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

apps/dashboard/redirects.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,12 @@ async function redirects() {
337337
destination: "/connect/account-abstraction",
338338
permanent: false,
339339
},
340+
// redirect /connect/pay to /connect/universal-bridge
341+
{
342+
source: "/connect/pay",
343+
destination: "/connect/universal-bridge",
344+
permanent: false,
345+
},
340346
// PREVIOUS CAMPAIGNS
341347
{
342348
source: "/unlimited-wallets",

apps/dashboard/src/@3rdweb-sdk/react/hooks/useEngine.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -874,8 +874,8 @@ export function useEngineSetWalletConfig(params: {
874874
const { instanceUrl, authToken } = params;
875875
const queryClient = useQueryClient();
876876

877-
return useMutation<WalletConfigResponse, void, SetWalletConfigInput>({
878-
mutationFn: async (input) => {
877+
return useMutation({
878+
mutationFn: async (input: SetWalletConfigInput) => {
879879
invariant(instanceUrl, "instance is required");
880880

881881
const res = await fetch(`${instanceUrl}configuration/wallets`, {
@@ -889,7 +889,7 @@ export function useEngineSetWalletConfig(params: {
889889
throw new Error(json.error.message);
890890
}
891891

892-
return json.result;
892+
return json.result as WalletConfigResponse;
893893
},
894894
onSuccess: () => {
895895
return queryClient.invalidateQueries({
@@ -1873,7 +1873,7 @@ export interface WalletCredential {
18731873
updatedAt: string;
18741874
}
18751875

1876-
export interface CreateWalletCredentialInput {
1876+
interface CreateWalletCredentialInput {
18771877
type: "circle";
18781878
label: string;
18791879
entitySecret?: string;
@@ -1938,7 +1938,7 @@ export function useEngineCreateWalletCredential(params: {
19381938
});
19391939
}
19401940

1941-
export interface UpdateWalletCredentialInput {
1941+
interface UpdateWalletCredentialInput {
19421942
label?: string;
19431943
isDefault?: boolean;
19441944
entitySecret?: string;

apps/dashboard/src/app/login/onboarding/AccountForm.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { zodResolver } from "@hookform/resolvers/zod";
88
import { useTrack } from "hooks/analytics/useTrack";
99
import { useState } from "react";
1010
import { useForm } from "react-hook-form";
11+
import { toast } from "sonner";
1112
import {
1213
type AccountValidationSchema,
1314
accountValidationSchema,
@@ -81,15 +82,21 @@ export const AccountForm: React.FC<AccountFormProps> = ({
8182
data,
8283
});
8384
},
84-
onError: (err) => {
85-
const error = err as Error;
85+
onError: (error) => {
86+
console.error(error);
8687

8788
if (
8889
onDuplicateError &&
8990
error?.message.match(/email address already exists/)
9091
) {
9192
onDuplicateError(values.email);
93+
return;
94+
} else if (error.message.includes("INVALID_EMAIL_ADDRESS")) {
95+
toast.error("Invalid Email Address");
96+
} else {
97+
toast.error(error.message || "Failed to update account");
9298
}
99+
93100
trackEvent({
94101
category: "account",
95102
action: "update",

apps/dashboard/src/app/team/[team_slug]/(team)/~/engine/(instance)/[engineId]/configuration/components/circle-config.tsx

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,8 @@ import {
1010
useEngineSetWalletConfig,
1111
} from "@3rdweb-sdk/react/hooks/useEngine";
1212
import { useTrack } from "hooks/analytics/useTrack";
13-
import { useTxNotifications } from "hooks/useTxNotifications";
1413
import { useForm } from "react-hook-form";
15-
import { Text } from "tw-components";
14+
import { toast } from "sonner";
1615

1716
interface CircleConfigProps {
1817
instance: EngineInstance;
@@ -28,10 +27,6 @@ export const CircleConfig: React.FC<CircleConfigProps> = ({
2827
authToken,
2928
});
3029
const trackEvent = useTrack();
31-
const { onSuccess, onError } = useTxNotifications(
32-
"Configuration set successfully.",
33-
"Failed to set configuration.",
34-
);
3530

3631
const defaultValues: SetWalletConfigInput = {
3732
type: "circle" as const,
@@ -50,7 +45,7 @@ export const CircleConfig: React.FC<CircleConfigProps> = ({
5045
const onSubmit = (data: SetWalletConfigInput) => {
5146
setCircleConfig(data, {
5247
onSuccess: () => {
53-
onSuccess();
48+
toast.success("Configuration set successfully");
5449
trackEvent({
5550
category: "engine",
5651
action: "set-wallet-config",
@@ -59,7 +54,9 @@ export const CircleConfig: React.FC<CircleConfigProps> = ({
5954
});
6055
},
6156
onError: (error) => {
62-
onError(error);
57+
toast.error("Failed to set configuration", {
58+
description: error.message,
59+
});
6360
trackEvent({
6461
category: "engine",
6562
action: "set-wallet-config",
@@ -74,7 +71,7 @@ export const CircleConfig: React.FC<CircleConfigProps> = ({
7471
return (
7572
<div className="flex flex-col gap-6">
7673
<div className="flex flex-col gap-2">
77-
<Text className="text-muted-foreground">
74+
<p className="text-muted-foreground">
7875
Circle wallets require an API Key from your Circle account with
7976
sufficient permissions. Created wallets are stored in your AWS
8077
account. Configure your Circle API Key to use Circle wallets. Learn
@@ -89,7 +86,7 @@ export const CircleConfig: React.FC<CircleConfigProps> = ({
8986
how to get an API Key
9087
</TrackedLinkTW>
9188
.
92-
</Text>
89+
</p>
9390
</div>
9491

9592
<Form {...form}>

apps/dashboard/src/app/team/[team_slug]/(team)/~/engine/(instance)/[engineId]/overview/components/create-backend-wallet-button.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ import { useState } from "react";
3838
import { useForm } from "react-hook-form";
3939
import { toast } from "sonner";
4040
import invariant from "tiny-invariant";
41-
import { Link as TwLink } from "tw-components";
4241

4342
interface CreateBackendWalletButtonProps {
4443
instance: EngineInstance;
@@ -131,7 +130,7 @@ export const CreateBackendWalletButton: React.FC<
131130
</Button>
132131
<Dialog open={isOpen} onOpenChange={setIsOpen}>
133132
<DialogContent
134-
className="z-[10001] p-0"
133+
className="z-[10001] overflow-hidden p-0"
135134
dialogOverlayClassName="z-[10000]"
136135
>
137136
<Form {...form}>
@@ -143,7 +142,7 @@ export const CreateBackendWalletButton: React.FC<
143142
</DialogTitle>
144143
</DialogHeader>
145144

146-
<div className="flex flex-col gap-5">
145+
<div className="flex flex-col gap-3">
147146
{/* Wallet type */}
148147
<FormFieldSetup
149148
label="Wallet Type"
@@ -294,13 +293,13 @@ export const CreateBackendWalletButton: React.FC<
294293
Key for Circle, you can only create testnet
295294
wallets. A production API Key cannot be used for
296295
testnet transactions, and vice versa.{" "}
297-
<TwLink
296+
<Link
298297
href="https://developers.circle.com/w3s/sandbox-vs-production"
299298
target="_blank"
300-
isExternal
299+
className="text-link-foreground hover:text-foreground"
301300
>
302301
Learn more
303-
</TwLink>
302+
</Link>
304303
</FormDescription>
305304
</div>
306305
</FormFieldSetup>

apps/dashboard/src/app/team/[team_slug]/(team)/~/engine/(instance)/[engineId]/wallet-credentials/components/create-wallet-credential-button.tsx

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { Button } from "@/components/ui/button";
2-
import { useDashboardRouter } from "@/lib/DashboardRouter";
32
import { useEngineCreateWalletCredential } from "@3rdweb-sdk/react/hooks/useEngine";
43
import { useTrack } from "hooks/analytics/useTrack";
54
import { Plus } from "lucide-react";
@@ -19,7 +18,6 @@ export const CreateWalletCredentialButton: React.FC<
1918
const [isOpen, setIsOpen] = useState(false);
2019
const trackEvent = useTrack();
2120

22-
const router = useDashboardRouter();
2321
const createCredential = useEngineCreateWalletCredential({
2422
instanceUrl,
2523
authToken,
@@ -29,8 +27,8 @@ export const CreateWalletCredentialButton: React.FC<
2927
const promise = createCredential.mutateAsync(data);
3028

3129
toast.promise(promise, {
32-
loading: "Creating wallet credential...",
3330
success: () => {
31+
setIsOpen(false);
3432
trackEvent({
3533
category: "engine",
3634
action: "create-wallet-credential",
@@ -50,9 +48,6 @@ export const CreateWalletCredentialButton: React.FC<
5048
return "Failed to create wallet credential";
5149
},
5250
});
53-
54-
setIsOpen(false);
55-
router.refresh();
5651
};
5752

5853
return (

0 commit comments

Comments
 (0)