From V0.18 to V0.19

Summary

This upgrade guide is specific to implementing the SDK itself, you can also find the features that ship with V19 here.

There are a number of breaking changes in v0.19, mainly to the way the SDK is structured. To upgrade you should follow three steps, which are outlined in the breaking changes section below.

1

Switch to sdk-react-core

Uninstall sdk-react (if used) and install the latest sdk-react-core.

3

Viem as default

If you’re happy for Viem to be the default instead of Ethers, do nothing. Otherwise, use the Ethers extension.

Breaking Changes

sdk-react -> sdk-react-core

Previously you could use the SDK in two ways. The first was by installing sdk-react which came with all of the possible WalletConnectors pre-bundled. The second was by installing sdk-react-core and then adding WalletConnectors yourself alongside it.

While the first was helpful in getting started, the general feedback was that the bundle size was too large. So we’ve decided to remove the sdk-react package and make sdk-react-core the main way of installing the SDK.

To get started in this way, you should uninstall sdk-react and install sdk-react-core instead. If you’re already using sdk-react-core, it’s worth upgrading it to the latest version.

npm uninstall @dynamic-labs/sdk-react

npm install @dynamic-labs/sdk-react-core

WalletConnectors

As mentioned above, sdk-react-core doesn’t come with any WalletConnectors pre-bundled.

There are also no more all packages available.

You should install them according to the table below.

Package NameChainWalletConnector to include
@dynamic-labs/ethereumEVMEthereumWalletConnectors
@dynamic-labs/algorandALGOAlgorandWalletConnectors
@dynamic-labs/solanaSOLSolanaWalletConnectors
@dynamic-labs/flowFLOWFlowWalletConnectors
@dynamic-labs/starknetSTARKStarknetWalletConnectors
@dynamic-labs/cosmosCOSMOSCosmosWalletConnectors
EVM Addon Wallets
Package NameWhich WalletsWalletConnector to include
@dynamic-labs/magicmagicMagicWalletConnectors
@dynamic-labs/blocto-evmbloctoBloctoEvmWalletConnectors

Magic and Blocto were previously available via the ethereum-all package which is now deprecated, please note that you will no longer get Magic & Blocto with the ethereum package - use the above packages instead.

Here’s an example for Ethereum & Flow:

npm install @dynamic-labs/ethereum @dynamic-labs/flow

Using WalletConnectors

Using WalletConnectors looks like the following (ethereum and flow example):

import { EthereumWalletConnectors } from "@dynamic-labs/ethereum";
import { FlowWalletConnectors } from "@dynamic-labs/flow";


const App = () => (
  <DynamicContextProvider
     settings={{
       ...
       walletConnectors: [ EthereumWalletConnectors, FlowWalletConnectors ],
  		 ...
    }}>
    <DynamicWidget />
  </DynamicContextProvider>
);

export default App;

Ethers -> Viem

We’ve also changed the way we interact with the BlockChain RPC and the Wallet. Previously we used Ethers.js by default and gave you a Viem version if you needed, but with Viem now rising further in popularity and functionality, we’ve now moved to Viem as the default library.

Please not that since Viem is now a peer dependancy of the SDK, it will be installed even if you use Ethers.

If you’re happy to use Viem, this should not have much of an effect on you. If you would still like to use Ethers or do not want to migrate your own application to using Viem, we have provided an extension for accessing Ethers within our Connectors:

npm i @dynamic-labs/ethers-v5
import { EthersExtension } from "@dynamic-labs/ethers-v5";

return (
  <DynamicContextProvider
    settings={{
      environmentId: "XXXXX",
      walletConnectorExtensions: [EthersExtension],
    }}
  >
    <App />
  </DynamicContextProvider>
);

You can then access the signer like so:

const signer = await primaryWallet.connector.ethers?.getSigner();

If you want to use Ethers V6 instead of V5, it’s as simple as using @dynamic-labs/ethers-v6 instead of @dynamic-labs/ethers-v5.

WalletConnector methods naming

Since the move to Viem, we have also updated the method names on the WalletConnector as they previously used Ethers Terminology.

V0.18V0.19
getWeb3Provider()getPublicClient()
getRpcProvider()getWalletClient()

onConnectSuccess -> onConnect

We’ve also renamed the onConnectSuccess callback to onConnect.

Non-breaking changes

New Callbacks added

New Hooks added

From V0.17 to V0.18

Summary

There are no major breaking changes in V0.18. There are a few minor changes in V0.18.x, which you can find below.

You can also find the features that ship with V0.18 here.

Updates to API URIs

Our api is served now from www.dynamicauth.com instead of www.dynamic.xyz, which should reduce issues for end users behind specific firewall providers.. Please update any rules and validations that you might have on the dynamic.xyz URIs.

Changes to ​​DynamicContextProvider

Prop rename from: displayTermsOfService to: displaySiweStatement.

This affects DynamicContextProvider. If you’re passing displayTermsOfService to DynamicContextProvider, you should update your code like so:

<DynamicContextProvider
  settings={{
    environmentId: "1234abcd-1234-abcd-1234-abcd12343abc",
    displayTermsOfService: false,
    ...
  }}
>
</DynamicContextProvider>

Multiwallet prop has been removed.

If you have multiwallet enabled please enable it in your dashboard:

<DynamicContextProvider
  settings={{
    multiWallet: true,
    ...
  }}
>
  {...}
</DynamicContextProvider>

Changes to DynamicContext

ConnectedWallets

connectedWallets now represents all the wallets that are actually connected

const { connectedWallets } = useDynamicContext();
LinkedWallets

Used to be called ConnectedWallets now only represents that wallets that are linked to the account (only relevant to connect-and-auth flow)

const { linkedWallets } = useDynamicContext();

Updates to Walletbook

If you have a dependancy on @dynamic-labs/walletbook < v0.19, please remove it from your dependancies as it should now be included by default alongside the sdk-react package.

From V0.16 to V0.17

Breaking Changes

  • In favor of supporting MagicLink Wallets we removed the support for Fortmatic.

  • chainName on EvmNetwork is deprecated in favor of name. If you’re passing evmNetworks to DynamicContextProvider or DynamicWagmiConnector, you should update your code like so:

<DynamicContextProvider
  settings={{
    environmentId: 'YOUR_ENV_ID',
    evmNetworks: [
      {
        blockExplorerUrls: [],
        chainId: 1,
        iconUrls: [],
     -  chainName: 'Ethereum',
     +  name: 'Ethereum',
        nativeCurrency: {
          decimals: 18,
          name: 'Ether',
          symbol: 'ETH',
        },
        networkId: 1,
        rpcUrls: [],
      },
    ],
  }}
>
  <HomePage />
</DynamicContextProvider>

chainName is a deprecated field on the EVMchain (and will be removed on v18), but if you pass a custom EVM network you will need to change to name.

  • the multiWallet prop on DynamicContextProvider is deprecated in favor of the Dashboard settings. See here for more info.

From V0.15 to V0.16

Breaking Change

  • With the introduction of email login and social verification we moved to verifiedCredentials instead of blockchainAccounts. blockChainAccounts was removed from the user’s object.

From V0.14 to V0.15

Breaking Change

  • Based on your feedback, our team has been hard at work to completely redesign our SDK UI and move it to ShadowDom. Now in addition, to the default customizations that we provide in the our admin dashboard, you have full control and ability to customize any element in the Dynamic’s SDK to your liking. If you previously used any CSS Classes to override our previous SDK modal you will need to update them to the current CSS classes.
    For more info see: Custom CSS.

  • As we introduced more callbacks, we now require all the callbacks to be nested under eventsCallbacks. See Callbacks for more info.

  • We removed user.walletPublicKey, instead please use primaryWallet.address, which you can access from useDynamicContext.