Skip to content

Conversation

@ihsraham
Copy link

@ihsraham ihsraham commented Jan 17, 2026

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-ton is not available on NPM.
  • Resolution: Removed TON bridge references and replaced them with the working @tetherto/wdk-protocol-bridge-usdt0-evm package in protocol-integration.md.

2. Corrected Failover Middleware

  • Issue: References to @tetherto/wdk-wrapper-failover-cascade were incorrect (404).
  • Resolution: Updated documentation to use @tetherto/wdk-provider-failover with the correct createFallbackWallet wrapper pattern (moved out of registerMiddleware).

Corrections & Value Additions

2. Configuration Corrections (TON)

  • Invalid Config Structure: The docs had a flat config (tonApiKey, tonApiEndpoint) but the SDK requires a nested tonClient object.
    • Correction: Updated guides/wallet-registration.md and configuration.md to use the correct structure:
      tonClient: { secretKey: '...', url: '...' }
  • 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.
  • 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 install steps 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...).
  • 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 createFallbackWallet wrapper pattern)

Verification Report

Guide Status Notes
Installation ✅ Verified Installed @tetherto/wdk successfully.
Instantiation ✅ Verified Instance created and seed generated.
Register Wallets ✅ Verified Fixed: Updated TON configuration structure & added missing API key context.
Manage Accounts ✅ Verified Fixed: Added network/key mismatch (Testnet vs Mainnet) warning.
Send Transactions ✅ Verified Fixed: Updated invalid TON address, added faucet links, fixed Sepolia RPC mismatch.
Integrate Protocols ✅ Verified Velora verified. USDT0 Bridge (TON) removed, replaced with EVM example.
Middleware ✅ Verified Logging verified. Failover updated to correct Wrapper usage (not registerMiddleware).
Error Handling ✅ Verified Confirmed error patterns and dispose() functionality.

@ihsraham ihsraham changed the base branch from main to develop January 17, 2026 11:27
@ihsraham ihsraham marked this pull request as draft January 19, 2026 15:01
@ihsraham ihsraham marked this pull request as ready for review January 20, 2026 09:25
Copy link

@lucas-tortora lucas-tortora left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Beautiful PR :) Just a few comments regarding style and structure.

{% endcode %}

{% hint style="info" %}
The WDK instance caches accounts. calling `getAccount` twice for the same index returns the same object instance.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The WDK instance caches accounts. calling `getAccount` twice for the same index returns the same object instance.
The WDK instance caches accounts. If you call `getAccount` twice using the same index, the function will return the same `Account` object instance.

{% hint style="warning" %}
**Network Mismatch Warning**
Ensure your WDK instance configuration matches your account environment.
* If using **Testnet** keys, ensure you registered the wallet with a **Testnet RPC**.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add links to the RPCs

Ensure your WDK instance configuration matches your account environment.
* If using **Testnet** keys, ensure you registered the wallet with a **Testnet RPC**.
* If using **Mainnet** keys, ensure you registered the wallet with a **Mainnet RPC**.
Using a Mainnet key on a Testnet RPC (or vice versa) will result in "Network not allowed" or 0 balance errors.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Using a Mainnet key on a Testnet RPC (or vice versa) will result in "Network not allowed" or 0 balance errors.
Using a Mainnet key on a Testnet RPC (or vice versa) will result in "Network not allowed" or zero balance errors.

We should spell out numbers unless they are being used in opertions.


## View Addresses

Once you have an account object, you can retrieve its public blockchain address.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Once you have an account object, you can retrieve its public blockchain address.
Once you have an account object, you can retrieve its public blockchain address using the `getAddress` function.


## Check Balances

You can check the native token balance of any account (e.g., ETH on Ethereum, TON on TON).

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
You can check the native token balance of any account (e.g., ETH on Ethereum, TON on TON).
You can check the native token balance of any account (e.g., ETH on Ethereum, TON on TON) by using the `getBalance()` function.

## Multi-Chain Transactions

You can orchestrate payments across different chains in a single function by acting on multiple account objects sequentially.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The following example will:
1. Retrieve an ETH and ton account using the `getAccount()` method.
2. Send ETH and `await` the transaction.
3. Send TON and `await` the transaction.

npm install @tetherto/wdk-wallet-evm @tetherto/wdk-wallet-ton @tetherto/wdk-wallet-btc
```

## Example: Registering Multiple Wallets

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
## Example: Registering Multiple Wallets
## Register Multiple Wallets


## Installation

Install the wallet managers for the blockchains you want to support:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add link to the wallet modules home page.

```

## Example: Registering Multiple Wallets

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
### Import the Wallet Manager Packages

```
{% endcode %}

Then, instantiate WDK and chain the registration calls:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Then, instantiate WDK and chain the registration calls:
### Register the Wallets
Then, instantiate WDK and chain the registration calls:

Please add link to the instantiate doc

Copy link

@lucas-tortora lucas-tortora left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Beautiful PR :) Just a few comments regarding style and structure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants