Step 1. Add the JitPack repository to your build file
Add it in your root settings.gradle at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
Add it in your settings.gradle.kts at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url = uri("https://jitpack.io") }
}
}
Add to pom.xml
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
Add it in your build.sbt at the end of resolvers:
resolvers += "jitpack" at "https://jitpack.io"
Add it in your project.clj at the end of repositories:
:repositories [["jitpack" "https://jitpack.io"]]
Step 2. Add the dependency
dependencies {
implementation 'com.github.sirin-labs:sirinos-sdk:1.0.4'
}
dependencies {
implementation("com.github.sirin-labs:sirinos-sdk:1.0.4")
}
<dependency>
<groupId>com.github.sirin-labs</groupId>
<artifactId>sirinos-sdk</artifactId>
<version>1.0.4</version>
</dependency>
libraryDependencies += "com.github.sirin-labs" % "sirinos-sdk" % "1.0.4"
:dependencies [[com.github.sirin-labs/sirinos-sdk "1.0.4"]]
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.
:credit_card: 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:
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"/>
https://github.com/sirin-labs/SirinOS-SDK-DemoApp