privateval projectId ="YOUR_PROJECT_ID"privateval relayUrl ="relay.walletconnect.com"privateval serverUrl ="wss://$relayUrl?projectId=$projectId"val connectionType = ConnectionType.AUTOMATIC// Describe your app and define its appearance in Keeper Wallet // when a user is prompted to connect or sign a transaction/order/messageval appMetaData = Core.Model.AppMetaData( name ="YOUR_APP_NAME", description ="YOUR_APP_DESC", url ="YOUR_WEBSITE", icons =listOf("YOUR_IMAGE_URLS"), redirect =null)CoreClient.initialize(relayServerUrl = serverUrl, connectionType = connectionType, application = this.application, metaData = appMetaData) { error ->
// Error will be thrown if there's an issue during initialization}SignClient.initialize(Sign.Params.Init(core = CoreClient)) { error ->// Error will be thrown if there's an issue during initialization}
Step 4. Get a pairing URI for Keeper Wallet
Send a request to WalletConnect to get a pairing URI for Keeper Wallet.
val pairing = CoreClient.Pairing.create()// Set the chain ID: 'W' for Mainnet or 'T' for Testnetval chains: List<String> =listOf("waves:T")val methods: List<String> =listOf("waves_signTransaction", "waves_signTransactionPackage", "waves_signOrder","waves_signMessage", "waves_signTypedData")val events: List<String> =listOf()val namespaces: Map<String, Sign.Model.Namespace.Proposal> =mapOf( namespace to Sign.Model.Namespace.Proposal(chains, methods, events, null))val connectParams = Sign.Params.Connect(namespaces, pairing)SignClient.connect(connectParams, onSuccess = {val wcUrl = pairing.uri // URI for opening Keeper Wallet }, onError = { error ->// Error will be thrown if there's an issue during connect })
Step 5. Connect Keeper Wallet
Here's how it works:
Your app calls Keeper, specifying the callback URL in the request.
The Keeper Wallet app opens and prompts the user to connect.
Once the user confirms or cancels the connection, your app receives a callback.
Deep Links are used to interact with Keeper Wallet. For the callback, the Deep Link must be configured in your app.
Your app sends a signing request via WalletConnect.
Your app calls Keeper, specifying the callback URL in the request.
The Keeper Wallet app opens and prompts the user to sign the transaction, order, or custom message.
Once the user confirms or cancels the request, your app receives a callback.
Transaction
val params =JSONObject( YOUR_TX_PARAMS ).toString()SignClient.request(Sign.Params.Request( sessionTopic = sessionTopic, method ="waves_signTransaction", params =listOf(params).toString(), chainId = currentChainId)){error->// Error will be thrown if there's an issue during request}
Order
val params =JSONObject( YOUR_ORDER_PARAMS ).toString()SignClient.request(Sign.Params.Request( sessionTopic = sessionTopic, method ="waves_signOrder", params =listOf(params).toString(), chainId = currentChainId)){error->// Error will be thrown if there's an issue during request}
Custom message
val params ="YOUR_MESSAGE"SignClient.request(Sign.Params.Request( sessionTopic = sessionTopic, method ="waves_signMessage", params =listOf(params).toString(), chainId = currentChainId)){error->// Error will be thrown if there's an issue during request}