Callbacks are a way to hook into the SDK and run your own code at certain points. You can think of them as event listeners.

You do not need to import anything extra to make use of callbacks, instead simply add them using the eventsCallbacks field inside the settings prop on DynamicContextProvider.

<DynamicContextProvider
  settings={{
    eventsCallbacks: {
      // callbacks go here
    },
  }}
>
  ...
</DynamicContextProvider>

onAuthFlowOpen: Called after the auth flow modal is opened.

onAuthFlowClose: Called whenever the auth flow modal is closed.

onAuthFlowCancel: Called when the auth modal is closed before authentication is successful (alongside onAuthFlowClose).

onBeforeConnectSuccessConfirmation: Callback that runs before Dynamic establishes a wallet connection. Good place to run checks (e.g. compliance) before the wallet connection is established.

onConnect: Called when the user successfully connects a wallet.

onAuthSuccess: Called after the user successfully authenticates.

onEmbeddedWalletCreated: Called after embedded wallet created for user.

onLogout: Called after the user logs out.

onUserProfileUpdate: Called when the user successfully updated their profile.

onEmailVerificationSuccess: Called when the email verification process succeeds.

onEmailVerificationFailure: Called when the email verification process fails.

onLinkSuccess: Called when the user successfully links a wallet.

onUnlinkSuccess: Called when the user successfully unlinks a wallet.

onSignedMessage: Called when the user signs a message and it allows you to act on that message.

Was this page helpful?