Skip to content

Commit 7885eb4

Browse files
committed
fix: duplicated wallet rdns
1 parent dd77c7f commit 7885eb4

File tree

35 files changed

+416
-92
lines changed

35 files changed

+416
-92
lines changed

.changeset/lovely-items-live.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"thirdweb": patch
3+
---
4+
5+
Fixes Brave Wallet Metadata

packages/thirdweb/scripts/wallets/generate.ts

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,22 @@ import { join } from "node:path";
44
import { format } from "prettier";
55
import sharp from "sharp";
66

7-
const walletConnectWalletsJson = await fetch(
7+
const walletConnectWallets = await fetch(
88
"https://explorer-api.walletconnect.com/w3m/v1/getAllListings?projectId=145769e410f16970a79ff77b2d89a1e0",
9-
).then((res) => res.json());
9+
).then(async (res) => {
10+
const wallets: { listings: Record<string, Wallet> } = await res.json();
11+
12+
// Remove duplicated wallets by wallet RDNS
13+
const filteredWallets: Wallet[] = [];
14+
for (const _w of Object.values(wallets.listings)) {
15+
if (_w.rdns && filteredWallets.find((w) => w.rdns === _w.rdns)) {
16+
continue;
17+
}
18+
filteredWallets.push(_w);
19+
}
20+
21+
return filteredWallets;
22+
});
1023

1124
const extraWalletsJson = JSON.parse(
1225
await readFile(join(__dirname, "./extra-wallets.json"), "utf-8"),
@@ -61,10 +74,10 @@ type Wallet = {
6174
};
6275
};
6376

64-
const allWalletsArray = Object.values(walletConnectWalletsJson.listings)
77+
const allWalletsArray = Object.values(walletConnectWallets)
6578
.map((w) => ({ ...(w as Omit<Wallet, "type">), _type: "wc" }))
6679
.concat(
67-
extraWalletsJson.map((w) => ({
80+
extraWalletsJson.map((w: Wallet) => ({
6881
...(w as Omit<Wallet, "type">),
6982
_type: "extra",
7083
})),

packages/thirdweb/src/wallets/__generated__/getWalletInfo.ts

Lines changed: 67 additions & 25 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/thirdweb/src/wallets/__generated__/wallet-ids.ts

Lines changed: 9 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/thirdweb/src/wallets/__generated__/wallet-infos.ts

Lines changed: 45 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/thirdweb/src/wallets/__generated__/wallet/app.nightly/image.ts

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)