File tree Expand file tree Collapse file tree 8 files changed +1027
-556
lines changed
Expand file tree Collapse file tree 8 files changed +1027
-556
lines changed Original file line number Diff line number Diff line change @@ -152,6 +152,40 @@ export interface WalletConnectInterface extends BaseWalletInterface {
152152 } ) => Promise < void > ;
153153}
154154
155+ /**
156+ * Type for a WalletConnect app retrieved from the WalletConnect `wallets` endpoint.
157+ */
158+ export interface WalletConnectApp {
159+ id : string ;
160+ name : string ;
161+ slug : string ;
162+ description ?: string ;
163+ homepage ?: string ;
164+ chains : string [ ] ;
165+ versions : string [ ] ;
166+ sdks : string [ ] ;
167+ app_type : "wallet" | string ;
168+ category ?: string ;
169+ image_url ?: {
170+ sm ?: string ;
171+ md ?: string ;
172+ lg ?: string ;
173+ } ;
174+ mobile ?: {
175+ native ?: string ;
176+ universal ?: string ;
177+ } ;
178+ desktop ?: {
179+ native ?: string ;
180+ universal ?: string | null ;
181+ } ;
182+ injected ?: Array < {
183+ namespace : string ;
184+ injected_id : string ;
185+ } > ;
186+ rdns ?: string ;
187+ }
188+
155189/**
156190 * Union of supported wallet behavior interfaces.
157191 * @internal
Original file line number Diff line number Diff line change @@ -37,6 +37,7 @@ export {
3737 decodeVerificationToken ,
3838 getClientSignatureMessageForLogin ,
3939 getClientSignatureMessageForSignup ,
40+ fetchWalletConnectApps ,
4041 addressFormatConfig ,
4142} from "./utils" ;
4243
Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ import {
2727import {
2828 type CreateSubOrgParams ,
2929 type WalletProvider ,
30+ type WalletConnectApp ,
3031 Chain ,
3132 GrpcStatus ,
3233 TurnkeyRequestError ,
@@ -1433,3 +1434,37 @@ export function getClientSignatureMessageForSignup({
14331434 ) ;
14341435 }
14351436}
1437+
1438+ export async function fetchWalletConnectApps (
1439+ projectId : string ,
1440+ ) : Promise < WalletConnectApp [ ] > {
1441+ const url =
1442+ `https://explorer-api.walletconnect.com/v3/wallets` +
1443+ `?projectId=${ projectId } ` ;
1444+
1445+ const res = await fetch ( url , {
1446+ headers : {
1447+ Accept : "application/json" ,
1448+ } ,
1449+ } ) ;
1450+
1451+ if ( ! res . ok ) {
1452+ throw new Error (
1453+ `Failed to fetch WalletConnect apps: ${ res . status } ${ res . statusText } ` ,
1454+ ) ;
1455+ }
1456+
1457+ const json = await res . json ( ) ;
1458+
1459+ /**
1460+ * API shape:
1461+ * {
1462+ * listings: {
1463+ * [id: string]: WalletConnectApp
1464+ * }
1465+ * }
1466+ */
1467+ const listings = json . listings ?? { } ;
1468+
1469+ return Object . values ( listings ) as WalletConnectApp [ ] ;
1470+ }
You can’t perform that action at this time.
0 commit comments