Pallet white paper
  • WALLET GUIDE
    • 1、Introduction
    • 2、Why Pallet wallet
    • 3、Getting Started
  • DEVELOPERS
    • 1、White Paper
    • 2、Wallet SDK Integration
      • 2.1 Flutter SDK
        • Integration Architecture
        • Bridge API
        • Develop Guide
        • Example
        • Integration Case
      • 2.2 Deeplink
        • Android
        • iOS
        • NFT Query
    • 3、H5 Wallet Integration
    • 4、Plugin Wallet Integration
    • 5、Wallet APIs
  • COMMON PROBLEMS
    • 1、What Is a Decentralized Wallet?
    • 2、What is MPC wallet?
    • 3、How to prevent DApp Approve scams?
    • 4、What Is the Miner Fee?
Powered by GitBook
On this page
  • Step 1: Deeplink Configuration
  • Step 2: Add Gradle Dependency
  • Step 3: Integration in APP
  • 1. Init WalletConnect
  • 2. Connect wallet via WalletConnect
  • 3. Personal Sign
  • 4. Typed Sign
  • 5. Send Transaction
  1. DEVELOPERS
  2. 2、Wallet SDK Integration
  3. 2.2 Deeplink

Android

Integrate Pallet wallet through Deeplink.

Step 1: Deeplink Configuration

<intent-filter >
    <action android:name="android.intent.action.VIEW" />
    <category android:name="android.intent.category.DEFAULT" />
    <category android:name="android.intent.category.BROWSABLE" />
    <!-- Accepts URIs that begin with "example://gizmos” -->
    <data android:scheme="palletdapp"
        android:host="wc" />
</intent-filter>

Step 2: Add Gradle Dependency

positories {
 ...
 maven { url 'https://jitpack.io' }
}

Add SDK dependencies from and find the last version.

dependencies {
 implementation 'com.github.bitbeen:PalletConnectKotlin:1.0.0'
}

Step 3: Integration in APP

1. Init WalletConnect

val connection = PalletConnectApi(object :palletConnectDelegate{
        override fun didConnect(chainId: Int?, accounts: String?) {
            TODO("Connect success, return chainId and wallet address")
        }

        override fun didDisconnect() {
            TODO("Disconnect")
        }

        override fun failedToConnect() {
            TODO("Connect fail")
        }

    })

2. Connect wallet via WalletConnect

connection.connect(
        context = requireContext(),
        dappName = "Example App",
        dappDescription = "palletconnect_android_example",
        dappUrl = "https://example.com",
        icons = listOf("Image used to showcase the dapp on the pallet App"),
        callbackUrl = "gamedapp://xxx", // Set to return the deeplink of the current App
)

3. Personal Sign

connection.personalSign(
            requireContext(),
            message = "0xff",
            account = "Wallet Address"
        ) {resp ->
            // The callback method is located in the child thread, 
            // be sure to switch to the UI thread for UI display
            uiScope.launch {    
                binding.txRespData.text = it.result.toString()
            }
        }

4. Typed Sign

connection.ethSignTypedData(
    requireContext(),
    message = "{\"types\":{\"EIP712Domain\":[{\"name\":\"name\",\"type\":\"string\"},{\"name\":\"version\",\"type\":\"string\"},{\"name\":\"chainId\",\"type\":\"uint256\"},{\"name\":\"verifyingContract\",\"type\":\"address\"}],\"Person\":[{\"name\":\"name\",\"type\":\"string\"},{\"name\":\"wallet\",\"type\":\"address\"}],\"Mail\":[{\"name\":\"from\",\"type\":\"Person\"},{\"name\":\"to\",\"type\":\"Person\"},{\"name\":\"contents\",\"type\":\"string\"}]},\"primaryType\":\"Mail\",\"domain\":{\"name\":\"Ether Mail\",\"version\":\"1\",\"chainId\":1,\"verifyingContract\":\"0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC\"},\"message\":{\"from\":{\"name\":\"Cow\",\"wallet\":\"0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826\"},\"to\":{\"name\":\"Bob\",\"wallet\":\"0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB\"},\"contents\":\"Hello, Bob!\"}}",
    account = it
){
        uiScope.launch {
            binding.txRespData.text = it.result.toString()
        }
 }

5. Send Transaction

connection.ethSendTransaction(
        requireContext(),
        Transaction(
            from = binding.txAddress.text.toString(),
            to = binding.txAddress.text.toString(),
            nonce = null,
            gasPrice = null,
            gasLimit = null,
            value = "0xff",
            data = "0x",
        )
    ) {
        uiScope.launch {
            binding.txRespData.text = it.result.toString()
        }
    }
Previous2.2 DeeplinkNextiOS

Last updated 1 year ago