Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions content/docs/overview/changelog.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,30 @@ Stay up to date with the latest improvements, new features, and bug fixes across

---

### July 09, 2026

**What's New**
- **pear-wrk-wdk** ([v1.0.0-beta.9](https://github.com/tetherto/pear-wrk-wdk/releases/tag/v1.0.0-beta.9)): Add HRPC-only generic-module construction, method calls, lifecycle handling, and host events, plus a separate length-prefixed JSON-RPC server entrypoint for native hosts. JSON-RPC supports the existing WDK, wallet, protocol, and secret operations but not wallet resets or generic modules in this release. Production logging now defaults to ERROR, JSC object logging is serialized safely, and temporary secret-buffer cleanup is improved.
- **wdk-utils** ([v1.0.0-beta.9](https://github.com/tetherto/wdk-utils/releases/tag/v1.0.0-beta.9)): Add `deriveSeedKey()` for domain-separated HKDF-SHA256 byte keys and `deriveSeedKeyPair()` for deterministic Ed25519 keypairs. Both require caller-supplied `salt` and `info` values and expect high-entropy seed bytes rather than mnemonic words.

**Changes**
- **wallet-tron-gasfree** ([v1.0.0-beta.8](https://github.com/tetherto/wdk-wallet-tron-gasfree/releases/tag/v1.0.0-beta.8)): Add `transactionMaxFee` to the shared config type while native quote, sign, and send methods remain unsupported, so the field has no runtime enforcement path. GasFree TRC20 transfers continue to use per-call `transferMaxFee`, and provider transfer and activation fee fields are converted to `bigint` before addition.

---

### July 08, 2026

**What's New**
- **wdk-wallet** ([v1.0.0-beta.14](https://github.com/tetherto/wdk-wallet/releases/tag/v1.0.0-beta.14)): Add optional `minAmountOut` to shared swap and swidge options, in destination-token base units, and forward it through the Swidge swap adapters. The base package does not validate or enforce the minimum; concrete provider behavior remains provider-defined.
- **wallet-btc** ([v1.0.0-beta.11](https://github.com/tetherto/wdk-wallet-btc/releases/tag/v1.0.0-beta.11)): Let writable Bitcoin accounts quote and broadcast signed raw transaction hex. Signed-hex quotes fetch referenced previous transactions through the configured client without broadcasting, while signed-hex sends broadcast the exact payload and apply `transactionMaxFee` when configured. Read-only accounts still quote transaction objects only. An updated descriptor dependency raises the Node.js minimum to 20.19.0.
- **react-native-core** ([v1.0.0-beta.13](https://github.com/tetherto/wdk-react-native-core/releases/tag/v1.0.0-beta.13)): Add the `useModule()` hook, `ModuleService`, generic-module event subscriptions, and runtime `WdkConfigs.modules`. The published package still pins Pear Worklet beta.8, which lacks the required module HRPC methods, so the new API is not runnable through the default dependency graph. The React Native source entry is present, but the declared default JavaScript and type outputs under `dist/` are missing from this tag.
- **worklet-bundler** ([v1.0.0-beta.5](https://github.com/tetherto/wdk-worklet-bundler/releases/tag/v1.0.0-beta.5)): Restore the built CLI and API files missing from beta.4, making the published HRPC/JSON-RPC transport, HRPC generic-module config, native addon linking, `addons.yml`, and ESM-to-CJS options available. Native linking now includes `bare-posix` automatically.

**Fixes**
- **wdk-core** ([v1.0.0-beta.14](https://github.com/tetherto/wdk/releases/tag/v1.0.0-beta.14)): Export the type-only `WdkAccount` intersection and use it as the declared return type of `getAccount()` and `getAccountByPath()`, so writable wallet and protocol methods are represented together. Runtime account behavior is unchanged.

---

### July 07, 2026

**What's New**
Expand Down
2 changes: 1 addition & 1 deletion content/docs/resources/concepts.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Account Abstraction is a blockchain technology that separates the concept of a u
WDK provides Account Abstraction support through specialized wallet modules:

- `@tetherto/wdk-wallet-evm-erc4337` - EVM chains with ERC-4337 standard
- `@tetherto/wdk-wallet-ton-gasless` - TON blockchain with gasless transactions
- `@tetherto/wdk-wallet-ton-gasless` - TON blockchain with gasless Jetton transfers
- `@tetherto/wdk-wallet-tron-gasfree` - TRON blockchain with gas-free transactions

These modules allow developers to implement gasless transaction flows where users can pay fees in tokens like USD₮ or XAU₮ instead of native blockchain tokens.
Expand Down
2 changes: 1 addition & 1 deletion content/docs/sdk/all-modules.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Wallet modules provide blockchain-specific wallet functionality for managing add
| [`@tetherto/wdk-wallet-evm-erc4337`](https://github.com/tetherto/wdk-wallet-evm-erc-4337) | EVM | ERC-4337 Account Abstraction for EVM chains | [Docs](/sdk/wallet-modules/wallet-evm-erc-4337/) |
| [`@tetherto/wdk-wallet-evm-7702-gasless`](https://github.com/tetherto/wdk-wallet-evm-7702-gasless) | EVM | EIP-7702 gasless account abstraction for EVM chains | [Docs](/sdk/wallet-modules/wallet-evm-7702-gasless/) |
| [`@tetherto/wdk-wallet-ton`](https://github.com/tetherto/wdk-wallet-ton) | TON | TON blockchain wallet | [Docs](/sdk/wallet-modules/wallet-ton/) |
| [`@tetherto/wdk-wallet-ton-gasless`](https://github.com/tetherto/wdk-wallet-ton-gasless) | TON | Gasless transactions on TON | [Docs](/sdk/wallet-modules/wallet-ton-gasless/) |
| [`@tetherto/wdk-wallet-ton-gasless`](https://github.com/tetherto/wdk-wallet-ton-gasless) | TON | Gasless Jetton transfers on TON | [Docs](/sdk/wallet-modules/wallet-ton-gasless/) |
| [`@tetherto/wdk-wallet-tron`](https://github.com/tetherto/wdk-wallet-tron) | TRON | TRON blockchain wallet | [Docs](/sdk/wallet-modules/wallet-tron/) |
| [`@tetherto/wdk-wallet-tron-gasfree`](https://github.com/tetherto/wdk-wallet-tron-gasfree) | TRON | Gas-free transactions on TRON | [Docs](/sdk/wallet-modules/wallet-tron-gasfree/) |
| [`@tetherto/wdk-wallet-solana`](https://github.com/tetherto/wdk-wallet-solana) | Solana | Solana blockchain wallet | [Docs](/sdk/wallet-modules/wallet-solana/) |
Expand Down
28 changes: 22 additions & 6 deletions content/docs/sdk/core-module/api-reference.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ icon: Code
|-------|-------------|---------|
| [WDK](#wdk) | Main class for managing wallets across multiple blockchains. Orchestrates wallet managers, protocols, middleware, and local transaction policies. | [Constructor](#constructor), [Methods](#methods) |
| [IWalletAccount](#iwalletaccount) | Base writable wallet account interface from `@tetherto/wdk-wallet`. | [Methods](#methods-1) |
| [IWalletAccountWithProtocols](#iwalletaccountwithprotocols) | Extended wallet account interface that supports protocol registration and access. Extends `IWalletAccount`. | [Methods](#methods-2) |
| [IWalletAccountWithProtocols](#iwalletaccountwithprotocols) | Protocol registration and access surface added to a wallet account. | [Methods](#methods-2) |
| [WdkAccount](#wdkaccount) | Consumer-facing account type returned by `getAccount()` and `getAccountByPath()`. | Type alias |

## WDK

Expand Down Expand Up @@ -47,8 +48,8 @@ const wdk2 = new WDK(seedBytes)
| `registerProtocol(blockchain, label, protocol, config)` | Registers a protocol globally for a blockchain | `WDK` | - |
| `registerMiddleware(blockchain, middleware)` | Registers middleware for account decoration | `WDK` | - |
| `registerPolicy(policies, options?)` | Registers local transaction policies for wallet account and protocol write methods | `WDK` | If policy configuration is invalid |
| `getAccount(blockchain, index?)` | Returns a wallet account for a blockchain and index | `Promise<IWalletAccountWithProtocols>` | If wallet not registered |
| `getAccountByPath(blockchain, path)` | Returns a wallet account for a blockchain and derivation path | `Promise<IWalletAccountWithProtocols>` | If wallet not registered |
| `getAccount(blockchain, index?)` | Returns a wallet account for a blockchain and index | `Promise<WdkAccount>` | If wallet not registered |
| `getAccountByPath(blockchain, path)` | Returns a wallet account for a blockchain and derivation path | `Promise<WdkAccount>` | If wallet not registered |
| `getFeeRates(blockchain)` | Returns current fee rates for a registered blockchain | `Promise<FeeRates>` | If wallet not registered |
| `dispose(blockchains?)` | Disposes all registered wallets, or only the named blockchains, and clears keys and account state managed by WDK | `void` | - |

Expand Down Expand Up @@ -259,7 +260,7 @@ Returns a wallet account for a specific blockchain and index using BIP-44 deriva
- `blockchain` (string): The name of the blockchain (e.g., "ethereum")
- `index` (number, optional): The index of the account to get (default: 0)

**Returns:** `Promise<IWalletAccountWithProtocols>` - The wallet account with protocol support. When a registered policy targets the account, the returned runtime account is policy-enforced and exposes matching `simulate` helpers.
**Returns:** `Promise<WdkAccount>` - The writable wallet account with protocol support. When a registered policy targets the account, the returned runtime account is policy-enforced and exposes matching `simulate` helpers.

**Throws:** Error if no wallet has been registered for the given blockchain. Throws `PolicyConfigurationError` if a registered policy applies but the wallet account does not expose a read-only account view.

Expand Down Expand Up @@ -289,7 +290,7 @@ Returns a wallet account for a specific blockchain and BIP-44 derivation path.
- `blockchain` (string): The name of the blockchain (e.g., "ethereum")
- `path` (string): The derivation path (e.g., "0'/0/0")

**Returns:** `Promise<IWalletAccountWithProtocols>` - The wallet account with protocol support. When a registered policy targets the account, the returned runtime account is policy-enforced and exposes matching `simulate` helpers.
**Returns:** `Promise<WdkAccount>` - The writable wallet account with protocol support. When a registered policy targets the account, the returned runtime account is policy-enforced and exposes matching `simulate` helpers.

**Throws:** Error if no wallet has been registered for the given blockchain. Throws `PolicyConfigurationError` if a registered policy applies but the wallet account does not expose a read-only account view.

Expand Down Expand Up @@ -419,7 +420,7 @@ console.log('Signed transaction:', signedTransaction)

## IWalletAccountWithProtocols

Extended wallet account interface that supports protocol registration and access. Extends `IWalletAccount` from `@tetherto/wdk-wallet`.
Protocol registration and access surface that WDK adds to a wallet account. The consumer-facing [`WdkAccount`](#wdkaccount) type combines this interface with `IWalletAccount` from `@tetherto/wdk-wallet`.

### Methods

Expand Down Expand Up @@ -666,6 +667,20 @@ wdk.dispose()

## Types

### WdkAccount

`WdkAccount` is the exported type returned by `getAccount()` and `getAccountByPath()`. It combines the writable wallet methods with the protocol registration and lookup surface. This is a type-only export; there is no runtime `WdkAccount` value.

```typescript title="Use WdkAccount"
import WDK, { type WdkAccount } from '@tetherto/wdk'

async function getBitcoinAccount(wdk: WDK): Promise<WdkAccount> {
return wdk.getAccount('bitcoin')
}
```

The published definition is `IWalletAccount & IWalletAccountWithProtocols`. Concrete wallet packages can expose additional methods beyond this shared shape. The declared return type of `IWalletAccountWithProtocols.registerProtocol()` remains `IWalletAccountWithProtocols`, so assigning the result of that chained call can narrow away the writable-account methods in TypeScript.

### FeeRates

```typescript title="Type: FeeRates"
Expand Down Expand Up @@ -832,6 +847,7 @@ type SwidgeOptions = {
recipient?: string;
refundAddress?: string;
slippage?: number; // decimal, e.g. 0.01 for 1%
minAmountOut?: number | bigint; // destination-token base units; provider-defined enforcement
} & (
| { fromTokenAmount: number | bigint } // exact-in
| { toTokenAmount: number | bigint } // exact-out
Expand Down
5 changes: 5 additions & 0 deletions content/docs/sdk/swidge-modules/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,14 @@ console.log('Fees:', quote.fees)
| `recipient` | `string` | Optional recipient for the output tokens. |
| `refundAddress` | `string` | Optional address that receives refunds if the transaction cannot complete. |
| `slippage` | `number` | Optional decimal slippage tolerance, for example `0.01` for 1%. |
| `minAmountOut` | `number \| bigint` | Optional minimum destination amount, in destination-token base units, passed to the provider. |
| `fromTokenAmount` | `number \| bigint` | Exact source amount to spend. Do not pass with `toTokenAmount`. |
| `toTokenAmount` | `number \| bigint` | Exact destination amount to receive. Do not pass with `fromTokenAmount`. |

<Callout type="info">
The shared WDK wallet package passes `minAmountOut` to the concrete provider but does not validate or enforce it. Confirm provider-specific support before relying on this field as an execution guard.
</Callout>

## Execute a route

Call `quoteSwidge()` first, show the quote to the user, then call `swidge()` with the same route options after explicit confirmation. Apply fee caps with `SwidgeProtocolConfig` where supported by the provider.
Expand Down
16 changes: 9 additions & 7 deletions content/docs/sdk/wallet-modules/wallet-btc/api-reference.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,9 @@ new WalletAccountBtc(seed, path, config)
|--------|-------------|---------|
| `getAddress()` | Returns the account's Bitcoin address | `Promise<string>` |
| `getBalance()` | Returns the total account balance in satoshis, including unconfirmed funds when present | `Promise<bigint>` |
| `sendTransaction(options, timeoutMs?)` | Sends a Bitcoin transaction and optionally polls until spent inputs disappear from unspent outputs | `Promise<{hash: string, fee: bigint}>` |
| `sendTransaction(tx, timeoutMs?)` | Signs and sends transaction options, or broadcasts signed raw transaction hex, then optionally polls spent inputs | `Promise<{hash: string, fee: bigint}>` |
| `signTransaction(options)` | Signs a Bitcoin transaction without broadcasting it | `Promise<string>` |
| `quoteSendTransaction(options)` | Estimates the fee for a transaction | `Promise<{fee: bigint}>` |
| `quoteSendTransaction(tx)` | Estimates an unsigned transaction fee or calculates the fee of signed raw transaction hex | `Promise<{fee: bigint}>` |
| `getTransfers(options?)` | Returns the account's transfer history | `Promise<BtcTransfer[]>` |
| `getTransactionReceipt(hash)` | Returns a transaction's receipt | `Promise<BtcTransactionReceipt \| null>` |
| `getMaxSpendable()` | Returns the maximum spendable amount | `Promise<BtcMaxSpendableResult>` |
Expand Down Expand Up @@ -160,10 +160,10 @@ console.log('Balance:', balance, 'satoshis')
```

##### `sendTransaction(options, timeoutMs?)`
Sends a Bitcoin transaction to a single recipient and optionally polls after broadcast until spent inputs disappear from the unspent-output set.
Accepts either transaction options or signed raw Bitcoin transaction hex. With transaction options, the wallet builds, signs, and broadcasts a single-recipient transaction. With signed hex, it broadcasts the exact supplied transaction without rebuilding or signing it. Both paths can poll after broadcast until spent inputs disappear from the unspent-output set.

**Parameters:**
- `options` (BtcTransaction): Transaction options
- `options` (`BtcTransaction | string`): Transaction options or signed raw transaction hex
- `to` (string): Recipient's Bitcoin address
- `value` (number | bigint): Amount in satoshis
- `feeRate` (number | bigint, optional): Fee rate in sat/vB. If provided, overrides the fee rate estimated from the blockchain.
Expand All @@ -174,7 +174,7 @@ Sends a Bitcoin transaction to a single recipient and optionally polls after bro
- `hash`: Transaction hash
- `fee`: Transaction fee in satoshis

**Throws:** Error if the estimated transaction fee exceeds `transactionMaxFee` when configured.
**Throws:** Error if the transaction fee exceeds `transactionMaxFee` when configured. Invalid raw transaction data, unavailable previous transactions, and broadcast rejection errors propagate from the configured client.

**Example:**
```javascript
Expand Down Expand Up @@ -212,10 +212,10 @@ console.log('Signed transaction:', signedTransaction)
```

##### `quoteSendTransaction(options)`
Estimates the fee for a transaction without broadcasting it.
Estimates the fee for transaction options or calculates the fee encoded by signed raw transaction hex, without broadcasting it.

**Parameters:**
- `options` (BtcTransaction): Same as sendTransaction options
- `options` (`BtcTransaction | string`): Transaction options or signed raw transaction hex
- `to` (string): Recipient's Bitcoin address
- `value` (number | bigint): Amount in satoshis
- `feeRate` (number | bigint, optional): Fee rate in sat/vB. If provided, overrides the fee rate estimated from the blockchain.
Expand All @@ -233,6 +233,8 @@ const quote = await account.quoteSendTransaction({
console.log('Estimated fee:', quote.fee, 'satoshis')
```

For signed hex, the wallet parses the transaction and fetches every referenced previous transaction through the configured client to calculate input value minus output value. This path requires network access, does not validate signatures before broadcast, does not broadcast, and does not apply `transactionMaxFee`.

##### `getTransfers(options?)`
Returns the account's transfer history with detailed transaction information.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ const config = {

### Transaction Max Fee

The `transactionMaxFee` option sets the maximum fee, in satoshis, for BTC `sendTransaction()` and `signTransaction()` operations. Use it to stop a native BTC send or signed transaction from being created when the estimated fee is higher than your app allows.
The `transactionMaxFee` option sets the maximum fee, in satoshis, for BTC `sendTransaction()` and `signTransaction()` operations. It blocks building or signing a transaction above the cap and also blocks `sendTransaction(signedHex)` from broadcasting externally supplied signed hex when its calculated fee is above the cap.

**Type:** `number | bigint` (optional)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ This guide explains how to [install the package](#1-install-the-package), [creat

### Prerequisites

* **[Node.js](https://nodejs.org/)**: version 18 or higher.
* **[Node.js](https://nodejs.org/)**: version 20.19.0 or higher. Wallet BTC beta.11 depends on `@bitcoinerlab/descriptors` 3.1.7, which sets this minimum.
* **[npm](https://www.npmjs.com/)**: usually comes with Node.js.

```bash title="Install @tetherto/wdk-wallet-btc"
Expand Down
Loading
Loading