Skip to main content

Architecture

Screenshot2026 01 27at18 51 38 Important: All examples in this documentation use the Tonnub mobile wallet as a reference. After deploying the corresponding environments by the Holders team, it is necessary to adapt the paths and names according to your wallet’s naming.

How It Works

  1. Pre-content injection: JavaScript code is injected into WebView before the page loads via injectedJavaScriptBeforeContentLoaded
  2. Bidirectional communication: The web app sends messages via window.ReactNativeWebView.postMessage(), and the native app responds via webView.injectJavaScript()
  3. Promise-based API: Most methods return Promises and use callbacks to receive results

API Priorities

Communication Mechanism

Message Format from WebView to Native

Response Format from Native to WebView

Basic Injection Pattern

TonConnect Bridge

Window Object:window.tonhub
Purpose: Implementation of TonConnect v2 protocol for wallet connection and transaction signing.
Priority: Critical (required for operation)

TypeScript Interface

Injection Implementation

Native-Side Handling

Solana Transaction Methods

Two additional methods are added for Solana wallet support in Holders.

sendSolanaTransaction

Sends a legacy (pre-v0) Solana transaction. The transaction is passed as a base64-encoded serialized message.
Parameters:
  • transaction (string) — Base64-encoded serialized Solana message (legacy format)
Returns:
  • result (string) — Base58-encoded transaction signature on success
  • error — Error object on rejection or failure

sendSolanaVersionedTransaction

Sends a versioned (v0) Solana transaction. Used for transactions with Address Lookup Tables.
Parameters:
  • transaction (string) — Base64-encoded serialized VersionedTransaction
Returns:
  • result (string) — Base58-encoded transaction signature on success
  • error — Error object on rejection or failure

Native-Side Implementation of Solana Methods

Solana Transaction Processing

WebView Usage Example

Javascript

Main Button API

Window Object:window['main-button']
Purpose: Control native action button displayed over the WebView (similar to Telegram Mini Apps).
Priority: High

TypeScript Interface

Injection Implementation

Typescript

Native-Side Handling

Typescript

Status Bar API

Window Object:window['status-bar']
Purpose: Control status bar style and provide device safe area insets.
**Priority: **Medium

TypeScript Interface

Injection Implementation

Typescript

Native-Side Handling

Typescript

Toaster API

**Window Object: **window['toaster']
Purpose: Display native toast notifications over the WebView.
Priority: Medium

TypeScript Interface

Injection Implementation

Typescript

Native-Side Handling

Typescript

Auth API

Window Object:window['tonhub-auth']
**Purpose: **Request biometric user authentication and manage app protection state.
Priority: High (for critical operations)

TypeScript Interface

Injection Implementation

Typescript

Native-Side Handling

Typescript

Wallet API

Window Object:window['dapp-wallet']
Purpose: Integration with Apple Pay and Google Pay for adding cards to device wallet.
Priority: Medium (for card functionality)

TypeScript Interface

Injection Implementation

Typescript

Native-Side Handling (iOS Example)

Typescript

DApp Client API

Window Object:window['dapp-client']
**Purpose: **Manage application lifecycle, navigation, and native interface interaction.
Priority: High

TypeScript Interface

Injection Implementation

Typescript

Native-Side Handling

Typescript

Support API

Window Object: window[‘dapp-support’]
Purpose: Integration with support system (e.g., Intercom) for user communication.
Priority: Low (optional)

TypeScript Interface

Injection Implementation

Typescript

Native-Side Handling

Typescript

Emitter API

Window Object:window['dapp-emitter']
Purpose: Transfer events from WebView to native application (e.g., loading events).
Priority: Medium

TypeScript Interface

Injection Implementation

Typescript

Native-Side Handling

Typescript

Testing

API Availability Check

In WebView browser console:

Test Calls

Javascript