Integrate the Wallet SDK
Integrate the Wallet SDK into your application
pod 'SudoDIWallet'
Install pod dependencies by running the following command in your project directory:
pod install --repo-update
This will update the local CocoaPods repository and install the latest version of the Wallet SDK.
In order to instantiate a Wallet client, make sure you have followed the instructions for Getting Started.
To instantiate the wallet client in your application, add the following
Swift
To instantiate the client in your application with a custom file path, add the following:
import SudoDIWallet
let filePath: String = // The path to store wallet data
SudoDIWalletClientBuilder.setBaseStorageDirectory(path: filePath)
let walletClient = try SudoDIWalletClientBuilder.build()
Alternatively, the client can be instantiated using a default file path to the user's documents directory, via the following:
import SudoDIWallet
let walletClient = try SudoDIWalletClientBuilder.build()
You only need one
SudoDIWalletClient
instance for a given user per device. Instantiating multiple clients using them at the same time may cause unexpected runtime errors to occur.To gain access to the iOS SDK and sample app providing a reference for integrating the SDK, please contact us.
The Android SDK is open source and compatible with Android 6 (API level 23) and above.
Gradle
Add this line to the dependencies section of the app module
build.gradle
and synchronize your project with Android Studio.dependencies {
implementation 'com.sudoplatform:sudodiwallet:[email protected]'
// Sudo DI Wallet Transitive Dependency for binary interaction
implementation "net.java.dev.jna:jna:[email protected]"
}
Please note that due to the Sudo DI Wallet's requirement to interact with binary, Java Native Access (JNA) must be included as a dependency, as seen above.
In order to instantiate a Wallet client, make sure you have followed the first page of instructions for Getting Started (see Prerequisites above).
Currently the Android SDK supports the primary Android ABIs:
armeabi-v7a
and arm64-v8a
, as well as the emulator ABI: x86
.Emulator ABI
x86_64
is not currently supported. If using an emulator, please use an x86
ABI emulator.To instantiate a client in your application add the following:
Kotlin
// val appContext: Context - The Android application context
val walletClient = SudoDIWalletClient.builder()
.setContext(appContext)
.build()
By default, wallet data will be stored locally in your application context's file directory, however, this can be overwritten with another accessible file directory if desired using the builder like so:
// val appContext: Context - The Android application context
// val directory: String - Absolute path to device data directory
val walletClient = SudoDIWalletClient.builder()
.setContext(appContext)
.setBaseStorageDirectory(directory)
.build()
You only need one
SudoDIWalletClient
instance for a given user per device. Instantiating multiple clients and using them at the same time may cause unexpected runtime errors to occur.To gain access to the Android SDK and sample app providing a reference for integrating the SDK, please contact us.
Last modified 4mo ago