settings.gradle
file:
build.gradle
file:
build.gradle(.kts)
(or use the gradle version catalog libs.versions.toml
file):
SuperlinkFragment
SuperlinkFragment
Fragment subclass that is part of the Superlink SDK. To do this you must include the Superlink NavGraph into your application’s NavGraph.
Here’s what your NavGraph may look like:
partnerId
, a value of argType
string
, anduserInfo
value of argType
me.superlink.sdk.data.UserInfo
defined as:Wallet
is defined as:
action_myAppStartFragment_to_superlink
, like so:
SuperlinkViewModel
class which subclasses the Android framework ViewModel class and provides access to data and operations from the Superlink
SDK.
SuperlinkViewModel
SuperlinkViewModel
class as follows:
SuperlinkViewModel
as required by your app’s design.
Android Studio should auto-import the SuperlinkViewModel
class and other Superlink classes, otherwise remember to manually import them:
SuperlinkViewModel
comprise the rest of the APIs the SDK offers.
transactionUrl: SharedFlow<String>
SuperlinkViewModel
class to handle purchasing a domain. You do this by observing an instance’s transactionUrl
SharedFlow property, collecting the value it emits, performing your custom operation with it and then completing the transaction by calling the completeTransaction
method on the instance.
The value will only be emitted when the user has selected crypto currency as their payment method. No value will be emitted for a fiat purchases.
The emitted value represents the transaction to be completed. It contains the recipient address, the coin type and the amount to be sent. The client application is expected to parse the URL and perform the transaction, before calling the completeTransaction
method to notify the SDK that the transaction has been completed. Once completed, the the SDK will show a minting screen where the user waits for the transaction to be confirmed, before receiving their domain.
Here’s an example of observing the property inside a Fragment
:
transactionUrl
property:
ethereum
1.3062319352247146e17
0x965933D5C73ef443f3a2E4B370c3b6C964fc76eC
completeTransaction(transactionID: String)
transactionUrl: SharedFlow<String>
section above the completeTransaction()
method allows your app to handover the transaction identifier back to the Superlink SDK. This will notify the SDK that the transaction has been completed and that the user can proceed to the minting screen.
transactionID: SharedFlow<String>
messageToSign: SharedFlow<String>
transactionUrl: SharedFlow<String>
property, you observe this property and grab the emitted value for digital signing in your own application process.
The message will be emitted when the user claims a free username. The client application will be required to prompt the user to sign the message. Once the user signs the message, and the completeMessageSigning
function is executed, the signed wessage will be sent back to the SDK which in turn sends it to the Superlink backend for verification. When the signed message is validated the user is given a free username.
Here’s an example:
completeMessageSigning(originalMessage: String, signedMessage: String)
messageToSign: SharedFlow<String>
above, the completeMessageSigning(...)
passes through to the SDK:
originalMessage
: to identify the transaction that has been signed;signedMessage
: the digital signaturecloseReason: SharedFlow<String>
closeReason
property simply provides a success
or empty string value to inform your application that the SDK has shutdown the web view. Like the other properties already mentioned, you’d have to observe it and handle changes to it accordingly, most likely to navigate back from the SuperlinkFragment and back to your app’s previous view.
Here’s how you can do this:
layout/superlink_loading_view.xml
file in your project’s layout resource directory, you can customize the loading screen that the Superlink SDK displays when loading the web content in the web view. Otherwise, Superlink uses a default view.
Here’s an example: