Files
github-actions[bot]andgithub-actions[bot] 4389083ca3 Version Packages (#1294)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-07-09 22:16:24 -07:00

70 KiB

@thirdweb-dev/react-native

0.2.28

Patch Changes

0.2.27

Patch Changes

0.2.26

Patch Changes

0.2.25

Patch Changes

0.2.24

Patch Changes

0.2.23

Patch Changes

0.2.22

Patch Changes

0.2.21

Patch Changes

0.2.20

Patch Changes

0.2.19

Patch Changes

0.2.18

Patch Changes

  • #1137 dec4c4a8 Thanks @iketw! - [ReactNative] Export WCV1 and WCV2 abstract classes to facilitate creation of wallet connect based wallets

    You can now extend the abstract classes WalletConnectV1 or WalletConnectV2 and set your own metadata when implementing a wallet.

    Find an example below implementing MyWallet that supports the WalletConnectV2 protocol.

    import {
      WCMeta,
      WalletConnectV2,
      WalletOptions,
      WalletConfig,
    } from '@thirdweb-dev/react-native';
    
    export class MyWallet extends WalletConnectV2 {
      static id = 'mywallet' as const; // ID needed to identify your wallet in the SDK.
      static meta = {
        name: 'My Wallet', // Name that will show up in our Connect Modal.
        iconURL:
          'my-wallet-icon-url-ipfs-or-png', // Icon that will show up in our Connect Modal.
        links: { // The WalletConnect mobile links.
          native: 'mywallet://',
          universal: 'https://mywallet.com',
        },
      };
    
      getMeta(): WCMeta {
        return MyWallet.meta;
      }
    }
    
    /**
     * The WalletConnectV2 projectId.
     *
     * We provide a default projectId but recommend you get your own
     * when launching your app in production.
     */
    type MyWalletConfig = { projectId?: string };
    
    export const myWallet = (config?: MyWalletConfig): WalletConfig<WalletConnectV2> => {
      return {
        id: MyWallet.id,
        meta: MyWallet.meta,
        create: (options: WalletOptions) =>
          new MyWallet({
            ...options,
            projectId: config?.projectId,
            walletId: MyWallet.id,
          }),
      };
    };
    

    You can then use your new wallet in the ThirdwebProvider's supportedWallets prop:

    import { ThirdwebProvider } from "@thirdweb-dev/react-native";
    
    <ThirdwebProvider supportedWallets={[myWallet()]}>
      <App />
    </ThirdwebProvider>;
    
  • #1151 2a0294d8 Thanks @MananTank! - Fix wrong balance in ConnectWallet

  • #1135 15ef4779 Thanks @iketw! - [ReactNative] Exports base UI components (react-native/components/base). They can now be used in your application.

  • #1144 9ce3eb6a Thanks @MananTank! - Remove WalletConfig.config object from wallets

  • Updated dependencies [2a443365, 3bf7f375, 6a194262, 16232de9, 54cfd6d8, 8687d6ac, 645b0303, 522453fd, 9a015a23, 6803c3e9, 0cba69ca, 56f85e57, 197a6838, 6a91b6a0, e32faeb5, a5f16b6d, b6728603, ed47fd53, 9ce3eb6a]:

0.2.17

Patch Changes

0.2.16

Patch Changes

0.2.15

Patch Changes

  • #1059 56ad0867 Thanks @iketw! - [ReactNative] Use walletConfig's selectUI to render the wallet item in the Choose your Wallet dialog

  • #1010 bba9767a Thanks @iketw! - [ReactNative-Wallets] Enables SmartWallet to connect to an app, with implementation in React Native

    • Wallets package
    1. Smart Wallet now supports connecting an external app to it. It acts as an actual wallet implementing the WC protocol
    2. There are two WalletConnect handlers to manage V1 and V2 WC connections
    3. Creates a synchronous storage interface used in WCV1
    4. To have your connector support WC, you need to implement the interface: IWalletConnectReceiver.
    5. You can now pass the flag enableConnectApp to the smart wallet config to enable a new field in our modal to connect an app to your smart wallet
    smartWallet({
        factoryAddress: "..."
        thirdwebApiKey: "apiKey"
        gasless: true,
        personalWallets: [localWallet()],
        enableConnectApp: true,
    }),
    
    • React Native
    1. Creates new modals for WC SessionRequests and SessionApprovals
    2. Implements SyncStorage using MMKV
  • #1068 fd7111d5 Thanks @MananTank! - add theme in WalletConfig.selectUI to allow creating selection UI that follows the theme of the wallet Modal

  • #1065 bd86661f Thanks @iketw! - [ReactNative] Add support for signing in with email/phone using magic sdk

    Devs can now add a new supportedWallet:

    import { Goerli } from '@thirdweb-dev/chains';
    import { ThirdwebProvider, magicWallet } from '@thirdweb-dev/react-native';
    
    <ThirdwebProvider
        activeChain={Goerli}
        supportedWallets={[
        magicWallet({
            apiKey: 'magic_api_key',
        }),
    ]}>
    
  • #1088 4f99ccb4 Thanks @iketw! - [RN/Wallets] Adds send_transaction support for wcv1 Connect to App feature

  • #1052 77123a9a Thanks @iketw! - [ReactNative] Adds support for WC QRCode scanning

    Breaking change:

    • Users will need to add the dependency react-native-camera to be able to use this version of the SDK.
  • Updated dependencies [2f1df0b5, 189daf02, afae0873, bba9767a, c6e74ef0, fd7111d5, ee4c7de2, bd86661f, 68fa1896, e21bdd03, f7b352a5, 4a1d7581, bdabbef7, 59206233, 292a321a, 98efd090, 8eecf4c2, bd86661f, f3b2ae3f, d5651006, 4f99ccb4, da576108, c85810ee, 6fd10f94, 5f1e6abb, a034b032, 35984362]:

0.2.14

Patch Changes

0.2.13

Patch Changes

0.2.12

Patch Changes

  • #995 482f6d1b Thanks @iketw! - [ReactNative] update export local wallet modal UI

  • #996 c3645c45 Thanks @MananTank! - - add theme in ConfiguredWallet.connectUI's props - to use theme aware UI for wallets

    • add useWalletConfig hook to get the ConfiguredWallet object for active wallet
    • add hooks useSetConnectedWallet, useSetConnectionStatus
    • rename useActiveChain to useChain - keep the useActiveChain also with deprecated tag
    • make useSafe hook await-able by returning the promise of connect() call
    • add hook useSmartWallet
    • allow rendering custom wallet details button via <ConnectWallet detailsButton={} /> prop
    • Rename "Export" to "Backup" in local wallet UI
  • #1011 470e0a14 Thanks @MananTank! - rename ConfiguredWallet to WalletConfig

    - import { ConfiguredWallet } from '@thirdweb-dev/react';
    + import { WalletConfig } from '@thirdweb-dev/react';
    
  • #1019 8a0dd070 Thanks @iketw! - ## [ReactNative] Adds modalTitle, buttonTitle and detailsButton props to the ConnectWallet component

    You can now customize the following props:

    1. buttonTitle

    The title of the ConnectWallet button which defaults to: "Connect Wallet":

    <ConnectWallet buttonTitle="Connect to claim" />
    
    1. modalTitle

    The title of the ConnectWallet modal which defaults to: "Choose your wallet":

    <ConnectWallet modalTitle="Select a wallet" />
    
    1. detailsButton

    The button that shows the details of the connected wallet. By default it shows the chain icon, wallet balance, account address and wallet icon:

    const customDetailsButton = (
      <View>
        <Text>Connected button details</Text>
        <Text>{shortenWalletAddress(address)}</Text>
      </View>
    );
    
    <ConnectWallet detailsButton={customDetailsButton} />;
    

    Web3Button

    The buttonTitle and modalTitle props are also available in the Web3Button config since we show a ConnectWallet button if you don't have a connected wallet:

    <Web3Button
      connectWalletProps={{
        buttonTitle: "Connect to claim",
        modalTitle: "Pick a wallet",
      }}
      contractAddress="contract-address"
      action={(contract) => contract?.erc1155.claim(0, 1)}
    >
      Claim Factory
    </Web3Button>
    
  • #989 8db78299 Thanks @iketw! - [React/ReactNative] Updated useThirdwebWallet to useWalletContext

  • Updated dependencies [e9b69300, 39bd9630, 49ec2d17, 799d98e8, c3645c45, 470e0a14, b1ede491, 738c0ec6, d495a4b8, 482f6d1b, e4356e76, 9886c858, 8db78299, 4f843833]:

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