Skip to content

Commit

Permalink
fix default wallets
Browse files Browse the repository at this point in the history
  • Loading branch information
joaquim-verges committed Jun 17, 2024
1 parent 67efdd3 commit c5cda6b
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import { parseTheme } from "../../../core/design-system/CustomThemeProvider.js";
import type { Theme } from "../../../core/design-system/index.js";
import type { ConnectButtonProps } from "../../../core/hooks/connection/ConnectButtonProps.js";
import type { ConnectEmbedProps } from "../../../core/hooks/connection/ConnectEmbedProps.js";
import { getDefaultWallets } from "../../../web/wallets/defaultWallets.js";
import { radius, spacing } from "../../design-system/index.js";
import { useActiveWallet } from "../../hooks/wallets/useActiveWallet.js";
import { useConnect } from "../../hooks/wallets/useConnect.js";
import { getDefaultWallets } from "../../wallets/defaultWallets.js";
import { ThemedButtonWithIcon } from "../components/button.js";
import { Spacer } from "../components/spacer.js";
import { ThemedText } from "../components/text.js";
Expand Down
29 changes: 29 additions & 0 deletions packages/thirdweb/src/react/native/wallets/defaultWallets.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import type { Chain } from "../../../chains/types.js";
import {
COINBASE,
METAMASK,
RAINBOW,
ZERION,
} from "../../../wallets/constants.js";
import type { Wallet } from "../../../wallets/interfaces/wallet.js";
import { createWallet } from "../../../wallets/native/create-wallet.js";
import type { AppMetadata } from "../../../wallets/types.js";

/**
* @internal
*/
export function getDefaultWallets(options?: {
appMetadata?: AppMetadata;
chains?: Chain[];
}): Wallet[] {
return [
createWallet("inApp"),
createWallet(METAMASK),
createWallet(COINBASE, {
appMetadata: options?.appMetadata,
chains: options?.chains,
}),
createWallet(RAINBOW),
createWallet(ZERION),
];
}
1 change: 1 addition & 0 deletions packages/thirdweb/src/wallets/in-app/native/in-app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ import { createInAppWallet } from "../core/wallet/in-app-core.js";
export function inAppWallet(
createOptions?: CreateWalletArgs<"inApp">[1],
): Wallet<"inApp"> {
console.log("inAppWallet NATIVE");
return createInAppWallet({
createOptions,
connectorFactory: async (client: ThirdwebClient) => {
Expand Down
9 changes: 4 additions & 5 deletions packages/thirdweb/src/wallets/native/create-wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import type { WCSupportedWalletIds } from "../__generated__/wallet-ids.js";
import { coinbaseWalletSDK } from "../coinbase/coinbase-wallet.js";
import { getCoinbaseMobileProvider } from "../coinbase/coinbaseMobileSDK.js";
import { COINBASE } from "../constants.js";
import { inAppWallet } from "../in-app/native/in-app.js";
import type { Account, Wallet } from "../interfaces/wallet.js";
import { smartWallet } from "../smart/smart-wallet.js";
import type { WCConnectOptions } from "../wallet-connect/types.js";
Expand Down Expand Up @@ -54,11 +55,9 @@ export function createWallet<const ID extends WalletId>(
*/
case "embedded":
case "inApp": {
// TODO pass RN connector
throw new Error("TODO");
// return inAppWallet(
// creationOptions as CreateWalletArgs<"inApp">[1],
// ) as Wallet<ID>;
return inAppWallet(
creationOptions as CreateWalletArgs<"inApp">[1],
) as Wallet<ID>;
}

/**
Expand Down

0 comments on commit c5cda6b

Please sign in to comment.