DynamicSDK.init
ClientProps
Param | Type | Description |
---|---|---|
environmentId | string | The ID of the environment of your dynamic application. |
apiBaseUrl | string? | Allows you to override the URL to which the SDK will make its API requests. |
cssOverrides | string? | Allows you to inject CSS into our UI modules (currently out of effect) |
appName | string? | How you’d like your app to be named in our copies. |
appLogoUrl | string? | A URL of the logo of your app. |
logLevel | LoggerLevel? | Allows you to set the level of the logs to the console |
DynamicSDK.instance
"Changes"
, which will be triggered when the property
changes value. We will omit these from the docs below as they are implicit.auth
moduleProperty | Type | Description |
---|---|---|
token | string | null | The JWT of the currently logged in user. |
authenticatedUser | UserProfile | null | The UserProfile object of the logged in user. |
logout | Future<void> logout() | Allows you to log the current user out. |
auth.email
submoduleProperty | Type | Description |
---|---|---|
sendOTP | Future<void> sendOTP(String email) | Sends an OTP token to the target email. |
resendOTP | Future<void> resendOTP() | Sends another OTP token to the same email as the last call to sendOTP . |
verifyOTP | Future<void> verifyOTP(String token) | Receives an OTP token and logs the user in if it is valid. |
auth.sms
submoduleProperty | Type | Description |
---|---|---|
sendOTP | Future<void> sendOTP(PhoneData phoneData) | Sends an OTP token to the target PhoneData. |
resendOTP | Future<void> resendOTP() | Sends another OTP token to the same phone number as the last call to sendOTP . |
verifyOTP | Future<void> verifyOTP(String token) | Receives an OTP token and logs the user in if it is valid. |
auth.social
submoduleProperty | Type | Description |
---|---|---|
connect | Future<void> connect({required SocialProvider provider, String? redirectPathname}) | Requests social connection to the provided SocialProvider. |
sdk
moduleProperty | Type | Description |
---|---|---|
loaded | boolean | Whether the SDK has loaded and is ready to handle requests. |
ui
moduleProperty | Type | Description |
---|---|---|
showAuth | void | Opens up Dynamic’s authentication flow modal for your user to sign in. Automatically closes when finished. |
showUserProfile | void | Opens up Dynamic’s user profile modal, allowing your user to manage their profile and wallets. |
wallets
moduleProperty | Type | Description |
---|---|---|
userWallets | BaseWallet[] | The array of all the user’s wallets. |
primary | BaseWallet | null | The primary wallet of the user. |
setPrimary | Future<void> setPrimary({required String walletId}) | Sets primary [wallet]/sdks(/react-sdk/objects/wallet) of the user. |
getBalance | Future<String> getBalance({required BaseWallet wallet}) | Returns the balance of a wallet. |
getNetwork | Future<Network> getNetwork({required BaseWallet wallet}) | Returns the network the wallet is connected to. |
signMessage | Future<String> signMessage({required BaseWallet wallet, required String message}) | Signs a message with this wallet. |
switchNetwork | Future<void> switchNetwork({required BaseWallet wallet, required Network network}) | Switches the wallet’s network. |
wallets.embedded
submoduleProperty | Type | Description |
---|---|---|
hasWallet | boolean | Whether the logged in user has an embedded wallet. |
getWallet | BaseWallet | null | Retrieves the embedded wallet of the current user, or null if it doesn’t exist. |
createWallet | BaseWallet | Creates an embedded wallet for the current user. Throws if one already exists. |