thirdweb 5.105.22 → 5.105.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/dist/cjs/react/core/hooks/usePaymentMethods.js +52 -174
  2. package/dist/cjs/react/core/hooks/usePaymentMethods.js.map +1 -1
  3. package/dist/cjs/react/core/machines/paymentMachine.js.map +1 -1
  4. package/dist/cjs/react/web/ui/Bridge/payment-selection/TokenSelection.js +3 -17
  5. package/dist/cjs/react/web/ui/Bridge/payment-selection/TokenSelection.js.map +1 -1
  6. package/dist/cjs/react/web/wallets/shared/WalletConnectConnection.js +7 -33
  7. package/dist/cjs/react/web/wallets/shared/WalletConnectConnection.js.map +1 -1
  8. package/dist/cjs/utils/web/isMobile.js +0 -2
  9. package/dist/cjs/utils/web/isMobile.js.map +1 -1
  10. package/dist/cjs/version.js +1 -1
  11. package/dist/cjs/wallets/create-wallet.js +21 -4
  12. package/dist/cjs/wallets/create-wallet.js.map +1 -1
  13. package/dist/cjs/wallets/wallet-connect/controller.js +27 -25
  14. package/dist/cjs/wallets/wallet-connect/controller.js.map +1 -1
  15. package/dist/esm/react/core/hooks/usePaymentMethods.js +53 -175
  16. package/dist/esm/react/core/hooks/usePaymentMethods.js.map +1 -1
  17. package/dist/esm/react/core/machines/paymentMachine.js.map +1 -1
  18. package/dist/esm/react/web/ui/Bridge/payment-selection/TokenSelection.js +3 -17
  19. package/dist/esm/react/web/ui/Bridge/payment-selection/TokenSelection.js.map +1 -1
  20. package/dist/esm/react/web/wallets/shared/WalletConnectConnection.js +8 -34
  21. package/dist/esm/react/web/wallets/shared/WalletConnectConnection.js.map +1 -1
  22. package/dist/esm/utils/web/isMobile.js +2 -2
  23. package/dist/esm/utils/web/isMobile.js.map +1 -1
  24. package/dist/esm/version.js +1 -1
  25. package/dist/esm/wallets/create-wallet.js +21 -4
  26. package/dist/esm/wallets/create-wallet.js.map +1 -1
  27. package/dist/esm/wallets/wallet-connect/controller.js +27 -25
  28. package/dist/esm/wallets/wallet-connect/controller.js.map +1 -1
  29. package/dist/types/react/core/hooks/usePaymentMethods.d.ts.map +1 -1
  30. package/dist/types/react/core/machines/paymentMachine.d.ts +2 -0
  31. package/dist/types/react/core/machines/paymentMachine.d.ts.map +1 -1
  32. package/dist/types/react/web/ui/Bridge/payment-selection/TokenSelection.d.ts.map +1 -1
  33. package/dist/types/react/web/wallets/shared/WalletConnectConnection.d.ts.map +1 -1
  34. package/dist/types/utils/web/isMobile.d.ts +0 -8
  35. package/dist/types/utils/web/isMobile.d.ts.map +1 -1
  36. package/dist/types/version.d.ts +1 -1
  37. package/dist/types/wallets/create-wallet.d.ts.map +1 -1
  38. package/dist/types/wallets/wallet-connect/controller.d.ts.map +1 -1
  39. package/package.json +1 -1
  40. package/src/react/core/hooks/usePaymentMethods.ts +77 -230
  41. package/src/react/core/machines/paymentMachine.ts +2 -0
  42. package/src/react/web/ui/Bridge/payment-selection/TokenSelection.tsx +19 -66
  43. package/src/react/web/wallets/shared/WalletConnectConnection.tsx +11 -46
  44. package/src/utils/web/isMobile.ts +2 -2
  45. package/src/version.ts +1 -1
  46. package/src/wallets/create-wallet.ts +53 -31
  47. package/src/wallets/wallet-connect/controller.ts +28 -25
  48. package/dist/cjs/react/core/hooks/useBridgeQuote.js +0 -52
  49. package/dist/cjs/react/core/hooks/useBridgeQuote.js.map +0 -1
  50. package/dist/esm/react/core/hooks/useBridgeQuote.js +0 -49
  51. package/dist/esm/react/core/hooks/useBridgeQuote.js.map +0 -1
  52. package/dist/types/react/core/hooks/useBridgeQuote.d.ts +0 -15
  53. package/dist/types/react/core/hooks/useBridgeQuote.d.ts.map +0 -1
  54. package/src/react/core/hooks/useBridgeQuote.ts +0 -71
@@ -1,28 +1,15 @@
1
1
  import { useQuery } from "@tanstack/react-query";
2
- import { chains } from "../../../bridge/Chains.js";
3
- import { routes } from "../../../bridge/Routes.js";
2
+ import type { Quote } from "../../../bridge/index.js";
3
+ import { ApiError } from "../../../bridge/types/Errors.js";
4
4
  import type { Token } from "../../../bridge/types/Token.js";
5
- import {
6
- getCachedChain,
7
- getInsightEnabledChainIds,
8
- } from "../../../chains/utils.js";
9
5
  import type { ThirdwebClient } from "../../../client/client.js";
10
- import { getOwnedTokens } from "../../../insight/get-tokens.js";
11
- import { toTokens } from "../../../utils/units.js";
6
+ import { getThirdwebBaseUrl } from "../../../utils/domains.js";
7
+ import { getClientFetch } from "../../../utils/fetch.js";
8
+ import { toTokens, toUnits } from "../../../utils/units.js";
12
9
  import type { Wallet } from "../../../wallets/interfaces/wallet.js";
13
- import {
14
- type GetWalletBalanceResult,
15
- getWalletBalance,
16
- } from "../../../wallets/utils/getWalletBalance.js";
17
10
  import type { PaymentMethod } from "../machines/paymentMachine.js";
18
11
  import { useActiveWallet } from "./wallets/useActiveWallet.js";
19
12
 
20
- type OwnedTokenWithQuote = {
21
- originToken: Token;
22
- balance: bigint;
23
- originAmount: bigint;
24
- };
25
-
26
13
  /**
27
14
  * Hook that returns available payment methods for BridgeEmbed
28
15
  * Fetches real routes data based on the destination token
@@ -57,225 +44,85 @@ export function usePaymentMethods(options: {
57
44
  const localWallet = useActiveWallet(); // TODO (bridge): get all connected wallets
58
45
  const wallet = payerWallet || localWallet;
59
46
 
60
- const routesQuery = useQuery({
47
+ const query = useQuery({
61
48
  enabled: !!wallet,
62
49
  queryFn: async (): Promise<PaymentMethod[]> => {
63
- if (!wallet) {
50
+ const account = wallet?.getAccount();
51
+ if (!wallet || !account) {
64
52
  throw new Error("No wallet connected");
65
53
  }
66
54
 
67
- // 1. Get all supported chains
68
- const [allChains, insightEnabledChainIds] = await Promise.all([
69
- chains({ client }),
70
- getInsightEnabledChainIds(),
71
- ]);
72
-
73
- // 2. Check insight availability for all chains
74
- const insightEnabledChains = allChains.filter((c) =>
75
- insightEnabledChainIds.includes(c.chainId),
55
+ const url = new URL(
56
+ `${getThirdwebBaseUrl("bridge")}/v1/buy/quote/${account.address}`,
76
57
  );
77
-
78
- // 3. Get all owned tokens for insight-enabled chains
79
- let allOwnedTokens: Array<{
80
- balance: bigint;
81
- originToken: Token;
82
- }> = [];
83
- let page = 0;
84
- const limit = 500;
85
-
86
- while (true) {
87
- let batch: GetWalletBalanceResult[];
88
- try {
89
- batch = await getOwnedTokens({
90
- chains: insightEnabledChains.map((c) => getCachedChain(c.chainId)),
91
- client,
92
- ownerAddress: wallet.getAccount()?.address || "",
93
- queryOptions: {
94
- limit,
95
- metadata: "false",
96
- page,
97
- },
98
- });
99
- } catch (error) {
100
- // If the batch fails, fall back to getting native balance for each chain
101
- console.warn(`Failed to get owned tokens for batch ${page}:`, error);
102
-
103
- const chainsInBatch = insightEnabledChains.map((c) =>
104
- getCachedChain(c.chainId),
105
- );
106
- const nativeBalances = await Promise.allSettled(
107
- chainsInBatch.map(async (chain) => {
108
- const balance = await getWalletBalance({
109
- address: wallet.getAccount()?.address || "",
110
- chain,
111
- client,
112
- });
113
- return balance;
114
- }),
115
- );
116
-
117
- // Transform successful native balances into the same format as getOwnedTokens results
118
- batch = nativeBalances
119
- .filter((result) => result.status === "fulfilled")
120
- .map((result) => result.value)
121
- .filter((balance) => balance.value > 0n);
122
-
123
- // Convert to our format
124
- const tokensWithBalance = batch.map((b) => ({
125
- balance: b.value,
126
- originToken: {
127
- address: b.tokenAddress,
128
- chainId: b.chainId,
129
- decimals: b.decimals,
130
- iconUri: "",
131
- name: b.name,
132
- prices: {
133
- USD: 0,
134
- },
135
- symbol: b.symbol,
136
- } as Token,
137
- }));
138
-
139
- allOwnedTokens = [...allOwnedTokens, ...tokensWithBalance];
140
- break;
141
- }
142
-
143
- if (batch.length === 0) {
144
- break;
145
- }
146
-
147
- // Convert to our format and filter out zero balances
148
- const tokensWithBalance = batch
149
- .filter((b) => b.value > 0n)
150
- .map((b) => ({
151
- balance: b.value,
152
- originToken: {
153
- address: b.tokenAddress,
154
- chainId: b.chainId,
155
- decimals: b.decimals,
156
- iconUri: "",
157
- name: b.name,
158
- prices: {
159
- USD: 0,
160
- },
161
- symbol: b.symbol,
162
- } as Token,
163
- }));
164
-
165
- allOwnedTokens = [...allOwnedTokens, ...tokensWithBalance];
166
- page += 1;
167
- }
168
-
169
- // 4. For each chain where we have owned tokens, fetch possible routes
170
- const chainsWithOwnedTokens = Array.from(
171
- new Set(allOwnedTokens.map((t) => t.originToken.chainId)),
58
+ url.searchParams.set(
59
+ "destinationChainId",
60
+ destinationToken.chainId.toString(),
172
61
  );
173
-
174
- const allValidOriginTokens = new Map<string, Token>();
175
-
176
- // Add destination token if included
177
- if (includeDestinationToken) {
178
- const tokenKey = `${
179
- destinationToken.chainId
180
- }-${destinationToken.address.toLowerCase()}`;
181
- allValidOriginTokens.set(tokenKey, destinationToken);
182
- }
183
-
184
- // Fetch routes for each chain with owned tokens
185
- await Promise.all(
186
- chainsWithOwnedTokens.map(async (chainId) => {
187
- try {
188
- // TODO (bridge): this is quite inefficient, need to fix the popularity sorting to really capture all users tokens
189
- const routesForChain = await routes({
190
- client,
191
- destinationChainId: destinationToken.chainId,
192
- destinationTokenAddress: destinationToken.address,
193
- includePrices: true,
194
- limit: 100,
195
- maxSteps: 3,
196
- originChainId: chainId,
197
- });
198
-
199
- // Add all origin tokens from this chain's routes
200
- for (const route of routesForChain) {
201
- // Skip if the origin token is the same as the destination token, will be added later only if includeDestinationToken is true
202
- if (
203
- route.originToken.chainId === destinationToken.chainId &&
204
- route.originToken.address.toLowerCase() ===
205
- destinationToken.address.toLowerCase()
206
- ) {
207
- continue;
208
- }
209
- const tokenKey = `${
210
- route.originToken.chainId
211
- }-${route.originToken.address.toLowerCase()}`;
212
- allValidOriginTokens.set(tokenKey, route.originToken);
213
- }
214
- } catch (error) {
215
- // Log error but don't fail the entire operation
216
- console.warn(`Failed to fetch routes for chain ${chainId}:`, error);
217
- }
218
- }),
62
+ url.searchParams.set("destinationTokenAddress", destinationToken.address);
63
+ url.searchParams.set(
64
+ "amount",
65
+ toUnits(destinationAmount, destinationToken.decimals).toString(),
219
66
  );
220
67
 
221
- // 5. Filter owned tokens to only include valid origin tokens
222
- const validOwnedTokens: OwnedTokenWithQuote[] = [];
223
-
224
- for (const ownedToken of allOwnedTokens) {
225
- const tokenKey = `${
226
- ownedToken.originToken.chainId
227
- }-${ownedToken.originToken.address.toLowerCase()}`;
228
- const validOriginToken = allValidOriginTokens.get(tokenKey);
229
-
230
- if (validOriginToken) {
231
- validOwnedTokens.push({
232
- balance: ownedToken.balance,
233
- originAmount: 0n,
234
- originToken: validOriginToken, // Use the token with pricing info from routes
235
- });
236
- }
68
+ const clientFetch = getClientFetch(client);
69
+ const response = await clientFetch(url.toString());
70
+ if (!response.ok) {
71
+ const errorJson = await response.json();
72
+ throw new ApiError({
73
+ code: errorJson.code || "UNKNOWN_ERROR",
74
+ correlationId: errorJson.correlationId || undefined,
75
+ message: errorJson.message || response.statusText,
76
+ statusCode: response.status,
77
+ });
237
78
  }
238
79
 
239
- // Sort by dollar balance descending
240
- validOwnedTokens.sort((a, b) => {
241
- const aDollarBalance =
242
- Number.parseFloat(toTokens(a.balance, a.originToken.decimals)) *
243
- (a.originToken.prices.USD || 0);
244
- const bDollarBalance =
245
- Number.parseFloat(toTokens(b.balance, b.originToken.decimals)) *
246
- (b.originToken.prices.USD || 0);
247
- return bDollarBalance - aDollarBalance;
248
- });
249
-
250
- const suitableOriginTokens: OwnedTokenWithQuote[] = [];
251
-
252
- for (const token of validOwnedTokens) {
253
- if (
254
- includeDestinationToken &&
255
- token.originToken.address.toLowerCase() ===
256
- destinationToken.address.toLowerCase() &&
257
- token.originToken.chainId === destinationToken.chainId
258
- ) {
259
- // Add same token to the front of the list
260
- suitableOriginTokens.unshift(token);
261
- continue;
262
- }
263
-
264
- suitableOriginTokens.push(token);
265
- }
266
-
267
- const transformedRoutes = [
268
- ...suitableOriginTokens.map((s) => ({
269
- balance: s.balance,
270
- originToken: s.originToken,
271
- payerWallet: wallet,
272
- type: "wallet" as const,
273
- })),
274
- ];
275
- return transformedRoutes;
80
+ const {
81
+ data: allValidOriginTokens,
82
+ }: { data: { quote: Quote; balance: string; token: Token }[] } =
83
+ await response.json();
84
+
85
+ // Sort by enough balance to pay THEN gross balance
86
+ const validTokenQuotes = allValidOriginTokens.map((s) => ({
87
+ balance: BigInt(s.balance),
88
+ originToken: s.token,
89
+ payerWallet: wallet,
90
+ type: "wallet" as const,
91
+ quote: s.quote,
92
+ }));
93
+ const insufficientBalanceQuotes = validTokenQuotes
94
+ .filter((s) => s.balance < s.quote.originAmount)
95
+ .sort((a, b) => {
96
+ return (
97
+ Number.parseFloat(
98
+ toTokens(a.quote.originAmount, a.originToken.decimals),
99
+ ) *
100
+ (a.originToken.prices.USD || 1) -
101
+ Number.parseFloat(
102
+ toTokens(b.quote.originAmount, b.originToken.decimals),
103
+ ) *
104
+ (b.originToken.prices.USD || 1)
105
+ );
106
+ });
107
+ const sufficientBalanceQuotes = validTokenQuotes
108
+ .filter((s) => s.balance >= s.quote.originAmount)
109
+ .sort((a, b) => {
110
+ return (
111
+ Number.parseFloat(
112
+ toTokens(b.quote.originAmount, b.originToken.decimals),
113
+ ) *
114
+ (b.originToken.prices.USD || 1) -
115
+ Number.parseFloat(
116
+ toTokens(a.quote.originAmount, a.originToken.decimals),
117
+ ) *
118
+ (a.originToken.prices.USD || 1)
119
+ );
120
+ });
121
+ // Move all sufficient balance quotes to the top
122
+ return [...sufficientBalanceQuotes, ...insufficientBalanceQuotes];
276
123
  },
277
124
  queryKey: [
278
- "bridge-routes",
125
+ "payment-methods",
279
126
  destinationToken.chainId,
280
127
  destinationToken.address,
281
128
  destinationAmount,
@@ -287,11 +134,11 @@ export function usePaymentMethods(options: {
287
134
  });
288
135
 
289
136
  return {
290
- data: routesQuery.data || [],
291
- error: routesQuery.error,
292
- isError: routesQuery.isError,
293
- isLoading: routesQuery.isLoading,
294
- isSuccess: routesQuery.isSuccess,
295
- refetch: routesQuery.refetch,
137
+ data: query.data || [],
138
+ error: query.error,
139
+ isError: query.isError,
140
+ isLoading: query.isLoading,
141
+ isSuccess: query.isSuccess,
142
+ refetch: query.refetch,
296
143
  };
297
144
  }
@@ -1,4 +1,5 @@
1
1
  import { useCallback, useState } from "react";
2
+ import type { Quote } from "../../../bridge/index.js";
2
3
  import type { Token } from "../../../bridge/types/Token.js";
3
4
  import type { Address } from "../../../utils/address.js";
4
5
  import type { AsyncStorage } from "../../../utils/storage/AsyncStorage.js";
@@ -24,6 +25,7 @@ export type PaymentMethod =
24
25
  payerWallet: Wallet;
25
26
  originToken: Token;
26
27
  balance: bigint;
28
+ quote: Quote;
27
29
  }
28
30
  | {
29
31
  type: "fiat";
@@ -3,7 +3,6 @@ import type { Token } from "../../../../../bridge/types/Token.js";
3
3
  import type { ThirdwebClient } from "../../../../../client/client.js";
4
4
  import { useCustomTheme } from "../../../../core/design-system/CustomThemeProvider.js";
5
5
  import { radius, spacing } from "../../../../core/design-system/index.js";
6
- import { useBridgeQuote } from "../../../../core/hooks/useBridgeQuote.js";
7
6
  import type { PaymentMethod } from "../../../../core/machines/paymentMachine.js";
8
7
  import { formatTokenAmount } from "../../ConnectWallet/screens/formatTokenBalance.js";
9
8
  import { Container } from "../../components/basic.js";
@@ -36,29 +35,12 @@ interface PaymentMethodTokenRowProps {
36
35
 
37
36
  function PaymentMethodTokenRow({
38
37
  paymentMethod,
39
- destinationToken,
40
- destinationAmount,
41
38
  client,
42
39
  onPaymentMethodSelected,
43
- feePayer,
44
40
  }: PaymentMethodTokenRowProps) {
45
41
  const theme = useCustomTheme();
46
42
 
47
- // Fetch individual quote for this specific token pair
48
- const {
49
- data: quote,
50
- isLoading: quoteLoading,
51
- error: quoteError,
52
- } = useBridgeQuote({
53
- client,
54
- destinationAmount,
55
- destinationToken,
56
- feePayer,
57
- originToken: paymentMethod.originToken,
58
- });
59
-
60
- // Use the fetched originAmount if available, otherwise fall back to the one from paymentMethod
61
- const displayOriginAmount = quote?.originAmount;
43
+ const displayOriginAmount = paymentMethod.quote.originAmount;
62
44
  const hasEnoughBalance = displayOriginAmount
63
45
  ? paymentMethod.balance >= displayOriginAmount
64
46
  : false;
@@ -97,57 +79,28 @@ function PaymentMethodTokenRow({
97
79
  gap="3xs"
98
80
  style={{ alignItems: "flex-end", flex: 1 }}
99
81
  >
100
- {quoteLoading ? (
101
- <>
102
- {/* Price amount skeleton */}
103
- <Skeleton height="16px" width="80px" />
104
- {/* Balance skeleton */}
105
- <Container flex="row" gap="3xs">
106
- <Skeleton height="12px" width="50px" />
107
- <Skeleton height="12px" width="40px" />
108
- </Container>
109
- </>
110
- ) : quoteError ? (
111
- <Text color="danger" size="sm" style={{ fontWeight: 600 }}>
112
- Quote failed
82
+ <Text
83
+ color="primaryText"
84
+ size="sm"
85
+ style={{ fontWeight: 600, textWrap: "nowrap" }}
86
+ >
87
+ {formatTokenAmount(
88
+ displayOriginAmount,
89
+ paymentMethod.originToken.decimals,
90
+ )}{" "}
91
+ {paymentMethod.originToken.symbol}
92
+ </Text>
93
+ <Container flex="row" gap="3xs">
94
+ <Text color="secondaryText" size="xs">
95
+ Balance:{" "}
113
96
  </Text>
114
- ) : displayOriginAmount ? (
115
- <Text
116
- color="primaryText"
117
- size="sm"
118
- style={{ fontWeight: 600, textWrap: "nowrap" }}
119
- >
97
+ <Text color={hasEnoughBalance ? "success" : "danger"} size="xs">
120
98
  {formatTokenAmount(
121
- displayOriginAmount,
99
+ paymentMethod.balance,
122
100
  paymentMethod.originToken.decimals,
123
- )}{" "}
124
- {paymentMethod.originToken.symbol}
101
+ )}
125
102
  </Text>
126
- ) : (
127
- "--.--"
128
- )}
129
- {!quoteLoading && (
130
- <Container flex="row" gap="3xs">
131
- <Text color="secondaryText" size="xs">
132
- Balance:{" "}
133
- </Text>
134
- <Text
135
- color={
136
- !quoteLoading
137
- ? hasEnoughBalance
138
- ? "success"
139
- : "danger"
140
- : "secondaryText"
141
- }
142
- size="xs"
143
- >
144
- {formatTokenAmount(
145
- paymentMethod.balance,
146
- paymentMethod.originToken.decimals,
147
- )}
148
- </Text>
149
- </Container>
150
- )}
103
+ </Container>
151
104
  </Container>
152
105
  </Container>
153
106
  </Button>
@@ -3,7 +3,7 @@ import type { Chain } from "../../../../chains/types.js";
3
3
  import type { ThirdwebClient } from "../../../../client/client.js";
4
4
  import { wait } from "../../../../utils/promise/wait.js";
5
5
  import { formatWalletConnectUrl } from "../../../../utils/url.js";
6
- import { isAndroid, isIOS, isMobile } from "../../../../utils/web/isMobile.js";
6
+ import { isMobile } from "../../../../utils/web/isMobile.js";
7
7
  import { openWindow } from "../../../../utils/web/openWindow.js";
8
8
  import type { WCSupportedWalletIds } from "../../../../wallets/__generated__/wallet-ids.js";
9
9
  import type { Wallet } from "../../../../wallets/interfaces/wallet.js";
@@ -47,35 +47,23 @@ export const WalletConnectConnection: React.FC<{
47
47
  client: props.client,
48
48
  walletConnect: {
49
49
  onDisplayUri(uri) {
50
- const preferNative =
51
- walletInfo.mobile.native || walletInfo.mobile.universal;
52
50
  try {
53
51
  if (isMobile()) {
54
- if (isAndroid()) {
55
- if (preferNative) {
56
- openWindow(
57
- formatWalletConnectUrl(preferNative, uri).redirect,
58
- );
59
- }
60
- } else if (isIOS()) {
61
- if (preferNative) {
62
- openWindow(
63
- formatWalletConnectUrl(preferNative, uri).redirect,
64
- );
65
- }
52
+ const mobileAppLink =
53
+ walletInfo.mobile.native || walletInfo.mobile.universal;
54
+ if (mobileAppLink) {
55
+ openWindow(
56
+ formatWalletConnectUrl(mobileAppLink, uri).redirect,
57
+ );
66
58
  } else {
67
- const preferUniversal =
68
- walletInfo.mobile.universal || walletInfo.mobile.native;
69
- if (preferUniversal) {
70
- openWindow(
71
- formatWalletConnectUrl(preferUniversal, uri).redirect,
72
- );
73
- }
59
+ // on android, wc:// links show the app picker
60
+ openWindow(uri);
74
61
  }
75
62
  } else {
76
63
  setQrCodeUri(uri);
77
64
  }
78
- } catch {
65
+ } catch (e) {
66
+ console.error(e);
79
67
  setErrorConnecting(true);
80
68
  }
81
69
  },
@@ -216,28 +204,7 @@ export const WalletConnectStandaloneConnection: React.FC<{
216
204
  chain: props.chain,
217
205
  client: props.client,
218
206
  onDisplayUri(uri) {
219
- const platformUris = {
220
- android: walletInfo.mobile.universal || "",
221
- ios: walletInfo.mobile.native || "",
222
- other: walletInfo.mobile.universal || "",
223
- };
224
-
225
207
  setQrCodeUri(uri);
226
- if (isMobile()) {
227
- if (isAndroid()) {
228
- openWindow(
229
- `${platformUris.android}wc?uri=${encodeURIComponent(uri)}`,
230
- );
231
- } else if (isIOS()) {
232
- openWindow(
233
- `${platformUris.ios}wc?uri=${encodeURIComponent(uri)}`,
234
- );
235
- } else {
236
- openWindow(
237
- `${platformUris.other}wc?uri=${encodeURIComponent(uri)}`,
238
- );
239
- }
240
- }
241
208
  },
242
209
  optionalChains: props.chains,
243
210
  projectId: props.walletConnect?.projectId,
@@ -253,8 +220,6 @@ export const WalletConnectStandaloneConnection: React.FC<{
253
220
  }
254
221
  }, [
255
222
  props.walletConnect,
256
- walletInfo.mobile.native,
257
- walletInfo.mobile.universal,
258
223
  wallet,
259
224
  props.chain,
260
225
  props.client,
@@ -3,7 +3,7 @@ import { detectOS } from "../detect-platform.js";
3
3
  /**
4
4
  * @internal
5
5
  */
6
- export function isAndroid(): boolean {
6
+ function isAndroid(): boolean {
7
7
  // can only detect if useragent is defined
8
8
  if (typeof navigator === "undefined") {
9
9
  return false;
@@ -15,7 +15,7 @@ export function isAndroid(): boolean {
15
15
  /**
16
16
  * @internal
17
17
  */
18
- export function isIOS(): boolean {
18
+ function isIOS(): boolean {
19
19
  // can only detect if useragent is defined
20
20
  if (typeof navigator === "undefined") {
21
21
  return false;
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const version = "5.105.22";
1
+ export const version = "5.105.24";