WDK Core Documentation Refactor
Created by: ihsraham
This PR refactors the monolithic sdk/core-module/usage.md into 8 granular "How-to" guides.
This refactor was validated using a "User Zero" approach: verification was performed by explicitly following the newly created guides step-by-step from a fresh state to ensure accuracy and reproducibility. During this process, several critical gaps and inaccuracies were identified and resolved.
Resolved Issues
1. Replaced Unavailable TON Bridge
-
Issue:
@tetherto/wdk-protocol-bridge-usdt0-tonis not available on NPM. -
Resolution: Removed TON bridge references and replaced them with the working
@tetherto/wdk-protocol-bridge-usdt0-evmpackage in protocol-integration.md.
2. Corrected Failover Middleware
-
Issue: References to
@tetherto/wdk-wrapper-failover-cascadewere incorrect (404). -
Resolution: Updated documentation to use
@tetherto/wdk-provider-failoverwith the correctcreateFallbackWalletwrapper pattern (moved out ofregisterMiddleware).
Corrections & Value Additions
2. Configuration Corrections (TON)
-
Invalid Config Structure: The docs had a flat config (
tonApiKey,tonApiEndpoint) but the SDK requires a nestedtonClientobject.-
Correction: Updated guides/wallet-registration.md and configuration.md to use the correct structure:
tonClient: { secretKey: '...', url: '...' }
-
Correction: Updated guides/wallet-registration.md and configuration.md to use the correct structure:
-
Missing API Key Instructions: Users were blocked without instructions on obtaining keys.
-
Addition: Added links to TON Center (
https://t.me/toncenter) and their docs (https://docs.ton.org/...) in guides/wallet-registration.md.
-
Addition: Added links to TON Center (
-
Network/Endpoint Mismatch: Users faced "Network not allowed" errors when mixing Testnet keys with Mainnet endpoints.
- Addition: Added "Note" callouts explicitly listing Mainnet vs. Testnet endpoints for TON and Ethereum.
3. Functional Verification Fixes
-
Installation Instructions: Initial guides missed
npm installsteps for wallet and protocol packages.- Correction: Added explicit installation sections to wallet-registration.md and protocol-integration.md.
-
Invalid Test Data: The TON recipient address in transactions.md was malformed (checksum error).
-
Correction: Replaced with a valid address (
UQCz5ON7jj...).
-
Correction: Replaced with a valid address (
-
Unusable Transaction Defaults: The Ethereum example sent 1 ETH, far exceeding faucet limits.
- Correction: Reduced to 0.001 ETH.
-
Chain Mismatch: The Ethereum example used a Mainnet RPC but users typically have Testnet funds.
- Addition: Added callouts for Sepolia RPCs and Faucet links (Google Cloud, TON Testgiver).
4. Visual & Style Improvements
-
GitBook Hints: GitBook-native hints (
{% hint style="info" %}) for consistent rendering. - Usage Landing Page: Updated usage.md index to use a Cards Grid Layout, matching the design of other module pages.
File Changes
-
Refactor: sdk/core-module/usage.md -> Splitted into
sdk/core-module/guides/*.md - Update: sdk/core-module/configuration.md (Fixed TON config)
- Update: sdk/core-module/guides/protocol-integration.md (Removed TON bridge, replaced with EVM bridge)
-
Update: sdk/core-module/guides/middleware.md (Updated Failover section to use
createFallbackWalletwrapper pattern)
Verification Report
| Guide | Status | Notes |
|---|---|---|
| Installation |
|
Installed @tetherto/wdk successfully. |
| Instantiation |
|
Instance created and seed generated. |
| Register Wallets |
|
Fixed: Updated TON configuration structure & added missing API key context. |
| Manage Accounts |
|
Fixed: Added network/key mismatch (Testnet vs Mainnet) warning. |
| Send Transactions |
|
Fixed: Updated invalid TON address, added faucet links, fixed Sepolia RPC mismatch. |
| Integrate Protocols |
|
Velora verified. USDT0 Bridge (TON) removed, replaced with EVM example. |
| Middleware |
|
Logging verified. Failover updated to correct Wrapper usage (not registerMiddleware). |
| Error Handling |
|
Confirmed error patterns and dispose() functionality. |