Files
github-actions[bot]andgithub-actions[bot] 1119f63a47 Version Packages (#991)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-05-09 23:23:42 -07:00

38 KiB

@thirdweb-dev/react-native

0.2.11

Patch Changes

0.2.10

Patch Changes

  • #981 ea0f9479 Thanks @iketw! - ## [ReactNative] Allow custom wallets be added to the ConnectWallet button modal

    With this new API you can build your own wallet and wallet UI and integrate it into our ConnectWallet modal:

    import type { ConfiguredWallet, ConnectUIProps } from '@thirdweb-dev/react-native';
    import { createAsyncLocalStorage, ConnectUIProps } from '@thirdweb-dev/react-native';
    import { WalletOptions } from '@thirdweb-dev/wallets';
    
    const WALLET_ID = "my-wallet-id";
    
    export const myWallet = (): ConfiguredWallet => {
      const asyncStorage = createAsyncLocalStorage(WALLET_ID);
      const configuredWallet = {
        id: WALLET_ID,
        meta: {
            id: WALLET_ID,
            name: "My Custom Wallet", // This will be displayed in the connect wallet modal
            iconURL: "ipfs or https url to an image or svg" // This will be used to fetch the icon to show in the connect wallet modal
        },
        create: (options: WalletOptions) =>
          new MyWallet({
            ...options,
            walletStorage: asyncStorage,
          }),
        connectUI(props: ConnectUIProps) {
          return <MyWalletUI {...props} />; // This will show up in the modal after the user selects your wallet
        },
      };
    
      return configuredWallet;
    };
    

    You can then add the wallet to your supportedWallets in the ThirdwebProvider:

    import { Goerli } from '@thirdweb-dev/chains';
    import {
      ThirdwebProvider,
      metamaskWallet,
    } from '@thirdweb-dev/react-native';
    
    const activeChain = Goerli;
    
    const App = () => {
      return (
        <ThirdwebProvider
          activeChain={activeChain}
          supportedChains={[activeChain]}
          supportedWallets={[
            myWallet(),
            metamaskWallet(),
          ]}>
          <AppInner />
        </ThirdwebProvider>
      );
    };
    

    This new version exposes some utility functions:

    1. formatWalletConnectDisplayUri

    Formats the wallet connect wc:// url for usage with custom wallet links

    1. shortenWalletAddress

    Shortens a wallet address for display purposes

    1. createAsyncLocalStorage and createSecureStorage

    You can use these methods to get wallet compatible storage types.

    • createAsyncLocalStorage uses MMKV in the background
    • createSecureStorage uses Expo SecureStore in the background
  • #969 12ad7fea Thanks @iketw! - [ReactNative] Remove gap prop for backward compat

  • #966 87021cee Thanks @MananTank! - Connect Wallet UI improvements

    • Allow from EOA => smart wallet / safe
    • Add warning to backup wallet for guest wallet
    • Show "Guest" instead of address for guest wallet
  • #977 93bd5733 Thanks @MananTank! - Fix Connect Wallet Open/Close issues

  • #968 9640e073 Thanks @iketw! - [ReactNative] Add guest mode warnings

  • Updated dependencies [93bdec06, ea0f9479, 05ebbc15, 5305b42d, 4ca557ae, 7d7685e3, 87021cee, eb521d24, af4b5356, 93bd5733, a2df187b, aa9b6acc]:

0.2.9

Patch Changes

0.2.8

Patch Changes

  • #874 49922de9 Thanks @iketw! - [RN] Adds Auth to React Native

    • Adds an optional secureStorage to authConfig
    • Adds expo-secure-store to store the JWT token securely in React Native, passing a default value
    • Stores the token in secure storage to be accessed by subsequent calls
    • Returns the token in useLogin to be used by the user

    How I tested:

    • Tested in Android/iOS/Web

    Usage:

    <ThirdwebProvider
          activeChain="ethereum"
          supportedWallets={[metamaskWallet(), rainbowWallet()]}
          authConfig={{
            domain: https://your-domain.com,
            authUrl: '/api/auth',
          }}>
          <AppInner />
        </ThirdwebProvider>
    
    const { login } = useLogin();
    const { logout } = useLogout();
    const { user, isLoggedIn } = useUser();
    ...
    
    const token = await login();
    
  • #886 51e6b414 Thanks @iketw! - [ReactNative] Fixes Coinbase wallet on iOS

    • Adds connect wallet hooks for the supported wallets:
    1. useMetaMaskWallet
    2. useCoinbaseWallet
    3. useRainbowWallet
    4. useTrustWallet

    Usage:

    const connect = useMetaMaskWallet();
    connect();
    
  • #916 0b1f5229 Thanks @iketw! - [ReactNative] Improve customization of buttons background and text colors

    You can now pass custom background and text colors without having to create the full theme object. Alternatively, you can complete customize the theme:

    import { ConnectWallet, darkTheme } from '@thirdweb-dev/react-native';
    
    <ConnectWallet theme={darkTheme({
       buttonBackgroundColor: '#new-color',
       buttonTextColor: '#another-color'
    })}
    />
    
    import { Web3Button, lightTheme } from '@thirdweb-dev/react-native';
    
    <Web3Button theme={lightTheme({
       buttonBackgroundColor: '#new-color',
       buttonTextColor: '#another-color'
    })}
    />
    

    Customizing theme beyond the button:

    import { ConnectWallet, darkTheme } from '@thirdweb-dev/react-native';
    
    const darkThemeCustom = darkTheme();
    
    <ConnectWallet
        theme={{
        ...darkThemeCustom,
        colors: {
            ...darkThemeCustom.colors,
            backgroundHighlight: 'blue',
        },
        }}
    />
    
  • Updated dependencies [abe88599, 49922de9, 4acb2b55, 82bea3fa, ea04edf4, 77224646, c9ee9b32, 00f4355f, a6610f12, 06cc1df3, 29146e00, 77224646, 430a5f79, 664d1cd0, bfdd8493, c2fec930, 477324ec]:

0.2.7

Patch Changes

0.2.6

Patch Changes

0.2.5

Patch Changes

0.2.4

Patch Changes

0.2.3

Patch Changes

0.2.2

Patch Changes

0.2.1

Patch Changes

0.2.0

Minor Changes

  • #584 d01b135d Thanks @MananTank! - [Wallets, RN, React, ReactCore] New Wallets SDK implementation

    Breaking changes:

    React and React Native

    1. Replaced walletConnectors with supportedWallets in the ThirdwebProvider.
      import { coinbaseWallet, metamaskWallet, ThirdwebProvider } from "@thirdweb-dev/react";
    
      const App = () => {
      - return <ThirdwebProvider walletConnectors={["metamask", "coinbaseWallet"]}>{...}</ThirdwebProvider>
      + return <ThirdwebProvider supportedWallets={[metamaskWallet(), coinbaseWallet()]}>{...}</ThirdwebProvider>
      }
    
    1. magicLinkConnector not yet implemented in this version

    2. Removed desiredChainId, use activeChain instead

    3. DAppMetaData type now requires the url field to be passed in

    4. Removed chainRpc prop from the ThirdwebProvider. You can pass custom rpcs in the Chain object through the activeChain and supportedChains props.

    5. Replaced the useNetwork hook for useChain and useSwitchChain

    6. Updated ConnectWallet button in React:

    • Removed accentColor and colorMode
    • Added a theme prop with dark and light values
    1. Updated the Web3Button button in React:
    • Removed accentColor and colorMode
    • Added a theme prop with dark and light values

    Patch Changes

    • You can now pass a theme prop to the ThirdwebProvider. Values are light and dark
      import { ThirdwebProvider } from "@thirdweb-dev/react";
    
      const App = () => {
      return <ThirdwebProvider theme='light'>{...}</ThirdwebProvider>
      }
    
    • New wallet hooks added

      • useWallet()
      • useConenct()
      • useConnectionStatus()
      • useSwitchChain()
    • Removed wagmi dependency from the react-native-compat package and updated shims

    • New ConnectWallet and Web3Button components in React Native

    • New wallets package with support for the most common wallets. MetaMask, Coinbase, WalletConnect V1 and V2 and PaperWallet

    • Added autoSwitch prop to the ThirdwebProvider to control whether or not to automatically switch to wallet's network to active chain

      import { ThirdwebProvider } from "@thirdweb-dev/react";
    
      const App = () => {
      return <ThirdwebProvider autoSwitch>{...}</ThirdwebProvider>
      }
    
  • #584 d01b135d Thanks @MananTank! - [Wallets] New and updated wallets. [RN] UI Components and Wallets support.

Patch Changes

0.1.9

Patch Changes

0.1.8

Patch Changes

0.1.7

Patch Changes

0.1.6

Patch Changes

0.1.5

Patch Changes

0.1.4

Patch Changes

0.1.3

Patch Changes

0.1.2

Patch Changes

0.1.1

Patch Changes

0.1.0

Minor Changes