Skip to main content

Initialization

Creating a UniPassSDK instance

The UniPassSDK Constructor takes an object with UniPassSDKOptions as input

unipassInstance = UniPassSDK(UniPassSDKOptions)

Arguments

UniPassSDKOptions

ParameterTypeMandatoryDescription
contextandroid.content.ContextYesAndroid context to launch UniPass Wallet, usually is the current activity
activityAppCompatActivityYesAndroid activity to use UniPassSDK
envcom.unipass.core.types.EnvironmentYesSDK Environment
redirectUrlUriNoURL that UniPassSDK will redirect API responses
walletUrlStringNoUniPass Wallet Url,Default is https://testnet.wallet.unipass.id
appSettingscom.unipass.core.types.AppSettingsNoconfiguration optional object to use custom app settings. Refer AppSettings for more info

AppSettings

// appSettings
data class AppSettings(
val chain: ChainType = ChainType.polygon,
val appName: String? = null,
val appIcon: String? = null,
val theme: UniPassTheme = UniPassTheme.dark
)

// ChainType
enum class ChainType(val value: String) {
eth("eth"),
polygon("polygon"),
bsc("bsc"),
rangers("rangers"),
scroll("scroll")
}

//(UniPassTheme)
enum class UniPassTheme(val value: String){
dark("dark"),
light("light")
}

Code sample

unipassInstance = UniPassSDK(
UniPassSDKOptions(
context = this,
activity = this,
redirectUrl = Uri.parse("unipassapp://com.unipass.wallet/redirect"),
env = Environment.TESTNET
)
)

If you are using v0.0.3 or below, you also need to call the setResultUrl API in onNewIntent

Set Result URL

override fun onNewIntent(intent: Intent?) {
super.onNewIntent(intent)
unipassInstance.setResultUrl(intent?.data)
}