dApp Integration Guide

This comprehensive guide will walk you through integrating eckoWALLET into your decentralized application step by step.

What You'll Learn

  • Detecting and connecting to eckoWALLET

  • Managing connection state

  • Retrieving account information

  • Signing transactions

  • Handling user interactions

  • Best practices and error handling

Prerequisites

  • Basic knowledge of JavaScript/TypeScript

  • Understanding of Kadena blockchain and Pact smart contracts

  • A web application or dApp to integrate with

Quick Start

1. Detect eckoWALLET

First, check if eckoWALLET is installed:

2. Connect to Wallet

Request permission to connect:

3. Get Account Info

Retrieve connected account details:

4. Sign Transaction

Request transaction signature from user:

Complete Integration Example

Here's a full React component demonstrating eckoWALLET integration:

Step-by-Step Integration

Step 1: Project Setup

Install necessary dependencies:

Or with Yarn:

Step 2: Create Wallet Context (React)

Create a context to manage wallet state throughout your app:

Step 3: Use the Wallet Hook

Step 4: Signing Transactions

Create a utility function for building and signing transactions:

Usage:

Advanced Patterns

Multi-Chain Support

Batch Transactions (QuickSign)

Error Handling Best Practices

Testing Your Integration

Local Testing

  1. Install eckoWALLET: Add extension to your browser

  2. Switch to Testnet: In eckoWALLET settings, switch to testnet04

  3. Get Test KDA: Use a testnet faucet

  4. Test Transactions: Try all flows in your dApp

Testing Checklist

Common Issues and Solutions

Wallet Not Detected

Issue: window.kadena is undefined

Solutions:

  • Wait for page load before checking

  • Add small delay for extension injection

  • Show installation prompt if not found

Connection Fails

Issue: User can't connect

Possible causes:

  • Wallet is locked

  • Wrong network selected

  • User rejected request

Solutions:

  • Check wallet is unlocked

  • Verify network ID matches

  • Handle rejection gracefully

Transaction Signing Fails

Issue: Signing request fails

Common causes:

  • Invalid Pact code

  • Incorrect capabilities

  • Insufficient gas

  • Wrong chain ID

Solutions:

  • Validate Pact code before signing

  • Ensure capabilities match code

  • Use appropriate gas settings

  • Verify chain ID

Best Practices

1. User Experience

  • Show clear installation prompts

  • Provide feedback during operations

  • Handle errors gracefully

  • Don't assume wallet is installed

2. Security

  • Always verify transaction details with users

  • Don't auto-sign without user interaction

  • Validate all inputs

  • Use HTTPS for your dApp

3. Performance

  • Cache connection state

  • Debounce frequent requests

  • Lazy load wallet integration

  • Minimize unnecessary requests

4. Compatibility

  • Test on multiple browsers

  • Handle edge cases

  • Provide fallbacks

  • Keep dependencies updated

Next Steps

Resources

Need Help?

Last updated