0 purchases
vatom wallet sdk
Vatom™ Flutter Sdk #
Welcome to the SDK to embed the Vatom™ Wallet in Flutter Apps, a powerful tool designed to effortlessly integrate the Vatom™ Wallet functions directly into your Flutter applications.
This SDK allows you to easily and efficiently incorporate digital asset management into your application, providing your users with a comprehensive experience.
Installation #
flutter pub add vatom_wallet_sdk
copied to clipboard
iOS Permissions Configuration
To enable camera permissions in your Flutter project for iOS, add the following code block to your `ios/Podfile` file:
post_install do |installer|
...
## other code required
target.build_configurations.each do |config|
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= [
'$(inherited)',
## dart: PermissionGroup.camera
'PERMISSION_CAMERA=1',
]
end
...
end
end
copied to clipboard
Info.plist Configuration
Add the following entries to your ios/Runner/Info.plist file:
<key>io.flutter.embedded_views_preview</key>
<string>YES</string>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
<key>NSAllowsArbitraryLoadsInWebContent</key>
<true/>
</dict>
<key>NSCameraUsageDescription</key>
<string>Allow $(PRODUCT_NAME) to access your camera</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>App requires geolocation to improve the quality of the service</string>
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>This app needs access to location when open.</string>
<key>NSLocationAlwaysUsageDescription</key>
<string>This app needs access to location when in the background.</string>
...
</dict>
copied to clipboard
Once added, run pod install in your ios directory to apply the changes.
These entries define the permissions and descriptions required by your Flutter app. Modify the descriptions as needed to suit your app's functionality.
Android Permissions Configuration
Make sure you have Kotlin version greater than or equal to 1.9.10 installed.
AndroidManifest.xml Configuration
Ensure the following permissions are added to your android/app/src/main/AndroidManifest.xml file:
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.VIDEO_CAPTURE" />
<uses-permission android:name="android.permission.AUDIO_CAPTURE" />
<uses-feature android:name="android.hardware.camera" />
copied to clipboard
These permissions are necessary for the proper functioning of your Flutter app on Android devices. The
Make sure to update the permissions as needed based on your app's requirements.
Usage/Examples #
Integrating our SDK for embedding the Vatom™ Wallet in Flutter projects is both simple and powerful. Initialize the wallet with just a few steps and empower users to effortlessly conduct transactions.
Explore code examples and guides in our documentation to unlock the full potential of financial management capabilities. Elevate your Flutter application to new heights with intuitive and secure wallet features.
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:vatom_wallet_sdk/vatom_wallet_sdk.dart';
main() {
WidgetsFlutterBinding.ensureInitialized();
// Create VatomConfig instance
final VatomConfig vatomConfig = VatomConfigFeatures(
language: "en",
scanner: ScannerFeatures(enabled: false),
hideNavigation: false,
hideDrawer: false,
hideTokenActions: false,
disableNewTokenToast: false,
// mapStyle: json.style
emptyStateImage: "url"
emptyStateTitle: "Hi!"
emptyStateMessage: "This is empty :("
disableArPickup: false,
pageConfig: PageConfig(
features: PageFeatures(
icon: PageFeaturesIcon(badges: false, editions: false, titles: false),
footer: PageFeaturesFooter(enabled: true, icons: [
PageFeaturesFooterIcon(id: "map", src: "", title: "Map"),
]),
),
),
);
// Create VatomWallet instance
final VatomWallet wallet = VatomWallet(
accessToken:"your_access_token_here",
refreshToken: "your_refresh_token_here",
businessId: "your_business_id_here",
config: vatomConfig,
//not requiered
initialRoute: "map",
);
// Use the wallet instance as needed
// Example: Print the base URL
print("Base URL: ${wallet.config?.baseUrl}");
runApp(
MaterialApp(
home: Scaffold(
body: SafeArea(
child: Column(
children: [
Expanded(
child: wallet,
),
],
),
),
),
),
);
}
copied to clipboard
VatomConfig Properties #
language: The "language" field is used to specify the language setting for an application. The default language is English ("en"). This field allows users to customize the language in which the app's content is displayed, providing a localized and personalized experience. (e.g., "es" for Spanish)
hideNavigation: Set this property to false if you want to show the wallet navigation. The default value is true.
hideDrawer: Set to false by default, deactivates the drawer, rendering it inaccessible. Developers can customize this option to control the initial availability of the drawer, ensuring its activation or deactivation based on specific app requirements.
scanner: Configure the scanner feature with the following options:
enabled: Set to false to hide the scanner icon on the home page; The default value is true.
disableNewTokenToast: Disables the toast notification for new tokens. Default is false.
hideTokenActions: Hides token actions UI. Default is false.
pageConfig: Configuration for the page layout, including features like icons and footer.
features: Specifies the features for the page.
icon: Configuration for icons on the page.
badges: Enables or disables badges. Default is true.
editions: Enables or disables editions. Default is true.
titles: Enables or disables titles. Default is true.
footer: Configuration for the footer on the page.
enabled: Enables or disables the footer. Default is true.
icons: List of footer icons, each having an ID, source, and title.
maxDistanceForPickup: Max distance between the user and the object allowed so it can be picked up (in meters).
emptyStateImage: Customize the image on the empty view.
emptyStateTitle: Customize the title for the empty state.
emptyStateMessage: Customize the message for the empty state.
systemThemeOverride: Override the system theme
These properties allow you to customize the behavior of the wallet according to your preferences.
navigateToTab() @Deprecated #
The navigateToTab function allows navigation to a specific tab in the application, providing a tab route and optional parameters.
await wallet.navigateToTab("Connect", {"paramKey": "paramValue"});
copied to clipboard
Parameters #
tabRoute (String): The route of the tab to navigate to.
params (Map<String, dynamic>, optional): Additional parameters that can be passed to the tab.
Example #
try {
await wallet.navigateToTab("Connect", {"paramKey": "paramValue"});
} catch (e) {
print("Error: $e");
}
copied to clipboard
navigate() #
The navigate function facilitates navigation within the wallet SDK by sending a message to trigger a specific route.
Parameters: #
route (String): The route to navigate to within the wallet SDK.
params (Map<String, dynamic>) (optional): Additional parameters to be passed along with the navigation request.
Usage: #
// Example 1: Navigate to a route without additional parameters.
wallet.navigate("home");
// Example 2: Navigate to a route with additional parameters.
wallet.navigate("profile", {"any": "..."});
copied to clipboard
openCommunity() #
The openCommunity function facilitates the opening of a community within the wallet SDK. It sends a message to the wallet SDK to navigate to a specific community, and optionally to a specific room within that community.
Parameters: #
communityId (String): The unique identifier of the community to be opened.
roomId (String, optional): The unique identifier of the room within the community to navigate to.
Usage: #
// Example: Open a community without specifying a room.
await wallet.openCommunity("communityId");
// Example: Open a specific room within a community.
await wallet.openCommunity("communityId", roomId: "roomId");
copied to clipboard
listTokens() #
The listTokens function is intended to be called by the host application to retrieve a list of tokens owned by the user within the wallet SDK.
Usage: #
var userTokens = await listTokens();
copied to clipboard
getToken() #
The getToken function is intended to be called by the host application to retrieve information about a specific token in the user's wallet inventory.
Parameters: #
tokenId (String): The unique identifier of the token for which information is requested.
Returns: #
{
"id":"320ca...",
"type":"vatom",
"parentId":".",
"owner":"b02...",
"author":"739f...",
"lastOwner":"739f..."
"modified":1697142415000,
"shouldShowNotification":true,
"created":1695758987000,
...
}
copied to clipboard
Usage: #
var tokenInfo = await wallet.getToken('tokenId123');
copied to clipboard
getPublicToken() #
The getPublicToken function is designed to be called by the host application to retrieve information about a public token that is not neccessarily in the user's wallet inventory (e.g. dropped on the map)
Parameters: #
tokenId (String): The unique identifier of the token for which public information is requested.
Returns: #
{
"id":"320ca...",
"type":"vatom",
"parentId":".",
"owner":"b02...",
"author":"739f...",
"lastOwner":"739f..."
"modified":1697142415000,
"shouldShowNotification":true,
"created":1695758987000,
...
}
copied to clipboard
Usage: #
var publicTokenInfo = await wallet.getPublicToken('tokenId123');
copied to clipboard
openToken() #
The openToken function facilitates the navigation to the NFT detail screen within the wallet SDK.
Parameters: #
tokenId (String): The unique identifier of the NFT for which the detail screen should be opened.
Usage: #
// Example: Open the NFT detail screen for a specific token.
await wallet.openToken("abc123");
copied to clipboard
trashToken() #
The trashToken function is designed to be called by the host application to initiate the removal or deletion of a specific token within the wallet SDK.
Parameters: #
tokenId (String): The unique identifier of the token to be trashed or deleted.
Usage: #
await wallet.trashToken('tokenId123');
copied to clipboard
performAction() #
The performAction function is intended to be called by the host application to initiate a specific action on a token within the wallet SDK.
Parameters: #
tokenId (String): The unique identifier of the token on which the action will be performed.
actionName (String): The name of the action to be executed on the token.
payload (Object?): An optional payload containing additional data required for the specified action. It can be null if no additional data is needed.
Returns: #
Future: A Future representing the result of the action. The host application can await this Future to handle the outcome of the performed action.
Usage: #
await wallet.performAction('tokenId123', 'activate', {'param': 'value'});
copied to clipboard
isLoggedIn() #
The isLoggedIn function allows the host application to check whether the user is currently logged in to the wallet SDK.
Usage: #
var userLoggedIn = await wallet.isLoggedIn();
if (userLoggedIn) {
// User is logged in, perform actions accordingly.
} else {
// User is not logged in, handle the scenario appropriately.
}
copied to clipboard
getCurrentUser() #
The getCurrentUser function is used to retrieve the current user's data from the wallet SDK. It sends a message to the wallet SDK to fetch the user data and returns a Future containing a UserData object.
Returns: #
{
"default_business_id": "3D...",
"default_space_id": null,
"email": "[email protected]",
"email_verified": true,
"location": {
"country": "USA",
"latitude": 0.0000000,
"locality": "Sample City",
"longitude": 0.0000000,
"postal_code": "12345",
"region": "Sample Region"
},
"name": "John Doe",
"phone_number": "+123456789",
"phone_number_verified": false,
"picture": "https://example.com/profile.jpg",
"sub": "sample-sub-id",
"updated_at": 9876543210,
"wallet_address": "sample-wallet-address",
"website": "https://example.com",
"guest": false,
"deferred_deeplink": null
}
copied to clipboard
Usage: #
var currentUser = await wallet.getCurrentUser();
if (currentUser != null) {
// Use the user data for various purposes.
print("User Name: ${currentUser.name}");
print("User Email: ${currentUser.email}");
} else {
// Handle the scenario where user data retrieval fails.
print("Error fetching user data.");
}
copied to clipboard
logOut() #
The logOut function initiates the log-out process in the wallet SDK by sending a message to trigger the log-out action.
Usage: #
// Example: Initiate the log-out process.
await wallet.logOut();
copied to clipboard
linkTo() #
The linkTo function allows navigation to a specific tab in the application, providing a url.
Usage: #
// You can catch errors like
void linkTo(String path) async {
wallet.linkTo(path).catchError(
(error) => print('Error: $error'),
);
}
// or you can use like
ElevatedButton(
onPressed: () {
linkTo("/map");
},
child: Text('map'),
)
copied to clipboard
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.