SirinWalletSDK is an android library that wraps the connection to Finney wallet's api.
The sdk should be used by any third party app that need to communicate with Finney wallet.
- 💱 Token change service integration
- 💳 Credit card to crypto integration
Finney wallet app installed on the device
implementation "com.github.sirin-labs:SirinOS-SDK:1.0.4"
// add this in project scope build file
repositories {
// repos
maven { url "https://jitpack.io" }
}
Init the sdk in your onResume , and add callback when initialization complete:
WalletSDKManager.addFinishInitListener { // Your code }
WalletSDKManager.init(applicationContext)
After you finish working with the sdk (most of the times on the activity onPause) disconnect from the service
WalletSDKManager.disconnect()
After the finish init callback is being fired, you can use any method in the api:
Public Address - Get the deafult public address the user have in his wallet according to the coin type:
- String getPublicAddress(String coinType)
WalletSDKManager.getPublicAddress("ETH")
RPC Address - Get the rpc address that being used for the coin type:
- String getRpcAddress(String coinType)
WalletSDKManager.getRpcAddress("ETH")
Chain Id - Get the chain id that being used for the coin type:
- int getChainId(String coinType)
WalletSDKManager.getChainId("ETH")
Send transaction - open the wallet with the coin type, recipient, amount and data values that being passed via the sdk:
- void sendTransaction(String coinType, String recipient, double value, String data, IWalletCommunicationCallback callback)
val data = SendRequestEntity(recipient = "0x008023500DfB949b8854C329C6237bFC3c060Fd6",
amount = 0.001)
//amount range is 10^17 > value > 10^-10, recipient should be valid bitcoin/ether address
WalletSDKManager.sendTransaction(data,
successMethod = { hash -> toastValue("Transaction Succeed : $hash") },
failureMethod = {err -> toastValue("Transaction Failed : $err") })
Airdrop - get message signed by device key for airdrop registration, the returned message encoded in der
- void airDrop(String desc, IWalletByteResultCallback callback);
fun airDrop() {
WalletSDKManager.airDrop("description",
successMethod = {signature -> toastValue("Transaction Succeed :
${byteArrayToHexString(signature)}")},
failureMethod = {err -> toastValue("Transaction Failed : $err") })
}
- Signing personal/public message - get message signed by device key for dapps registration(personal or public message)
fun startSigningMessage() {
WalletSDKManager.startSigningMessage(signed_message_txt.text.toString(),
"desc ",
successMethod = {signature ->
toastValue("Transaction Succeed :
${byteArrayToHexString(signature)}") },
failureMethod = {err ->
toastValue("Transaction Failed : $err") })
}
- For design integrity, you can apply out style on the action buttons related to the sdk. for example:
<Button
android:text="Pay With Sirin"
style="@style/sirin_button_style"/>