Skip to content

Deep Linking Support #313

@peerchemist

Description

@peerchemist

Summary

Add deep linking capability to handle payment URIs and direct links for seamless transaction initiation.

What is Deep Linking?

Allows opening the wallet directly to specific functionality (like send screen) with pre-filled data via custom URIs.

Current State

  • No deep linking support
  • Cannot handle peercoin: URIs from external sources
  • No integration with web/mobile payment flows

Benefits

  • One-click payments from emails/websites/forms
  • Support for standard crypto URI schemes (peercoin:address?amount=X)
  • Better integration

Implementation

Platform Setup

Android (AndroidManifest.xml):

<intent-filter>
    <action android:name="android.intent.action.VIEW" />
    <category android:name="android.intent.category.DEFAULT" />
    <category android:name="android.intent.category.BROWSABLE" />
    <data android:scheme="peercoin" />
</intent-filter>

iOS (Info.plist):

<key>CFBundleURLTypes</key>
<array>
    <dict>
        <key>CFBundleURLSchemes</key>
        <array><string>peercoin</string></array>
    </dict>
</array>

Flutter Code

Main Entry (main.dart):

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  
  // Initial URI handling
  final initialUri = await getInitialUri();
  if (initialUri != null) handleDeepLink(initialUri);
  
  // Runtime URI handling
  uriLinkStream.listen((uri) => uri != null ? handleDeepLink(uri) : null);
  
  runApp(MyApp());
}

void handleDeepLink(Uri uri) {
  if (uri.scheme == 'peercoin') {
    // Extract address, amount, label from URI
    // Navigate to send screen with pre-filled data
  }
}

Supported URI Formats

  1. Custom Scheme: peercoin://pay?address=...&amount=X&label=Y
  2. Standard BIP-21: peercoin:address?amount=X&label=Y

Parameters

  • address (required): Recipient address
  • amount (optional): Payment amount
  • label (optional): Description
  • message (optional): Additional info

Testing

  • Test URI handling from emails, browsers, other apps
  • Validate error handling for invalid inputs

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions