Skip to content
This repository has been archived by the owner on Aug 5, 2024. It is now read-only.

Commit

Permalink
chore: update in app wallet query docs
Browse files Browse the repository at this point in the history
  • Loading branch information
ElasticBottle committed Jun 7, 2024
1 parent cce1229 commit 387305b
Showing 1 changed file with 53 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Getting User Details on the server

If you want to get the user details for a given thirdweb Embedded Wallet on the server, you can make a `GET` request on `https://embedded-wallet.thirdweb.com/api/2023-11-30/embedded-wallet/user-details`

Here's an example function on how you might perform the query:

```ts
export async function fetchEmbeddedWalletMetadataFromThirdweb(
args:
| {
queryBy: "walletAddress";
walletAddress: string;
}
| {
queryBy: "email";
email: string;
},
| {
queryBy: "phone";
phone: string;
},
) {
const url = new URL(
"https://embedded-wallet.thirdweb.com/api/2023-11-30/embedded-wallet/user-details",
);
if (args.queryBy === "walletAddress") {
url.searchParams.set("queryBy", "walletAddress");
url.searchParams.set("walletAddress", args.walletAddress);
}
if (args.queryBy === "email") {
url.searchParams.set("queryBy", "email");
url.searchParams.set("email", args.email);
}
if (args.queryBy === "phone") {
url.searchParams.set("queryBy", "phone");
url.searchParams.set("phone", args.phone);
}

const resp = await fetchReq(url.href, {
headers: {
Authorization: `Bearer ${THIRD_WEB_CLIENT_SECRET}`,
},
});

const data = (await resp.json()) as {
userId: string;
walletAddress: string;
email: string;
createdAt: string;
}[];
return data;
}
```

0 comments on commit 387305b

Please sign in to comment.