# Create WDK Module

Scaffold new WDK modules with a single command. The CLI generates a fully configured project with source files, tests, TypeScript type definitions, and CI workflows — ready for you to add your blockchain or protocol integration logic.

Powered by [`create-wdk-module`](https://github.com/tetherto/create-wdk-module).

***

## Quick Start

{% stepper %}
{% step %}

#### Run the scaffolding command

{% code title="Scaffold a new module" %}

```bash
npx @tetherto/create-wdk-module@latest
```

{% endcode %}

You can also pass arguments directly to skip the interactive prompts:

{% code title="Scaffold with arguments" %}

```bash
npx @tetherto/create-wdk-module@latest wallet stellar
```

{% endcode %}
{% endstep %}

{% step %}

#### Install and run tests

{% code title="Set up the generated project" %}

```bash
cd wdk-wallet-stellar
npm install
npm test
```

{% endcode %}
{% endstep %}
{% endstepper %}

***

## Module Types

The CLI supports all five WDK module categories. The generated package name follows WDK naming conventions automatically.

| Type      | Description                   | Generated Package Example           |
| --------- | ----------------------------- | ----------------------------------- |
| `wallet`  | Blockchain wallet integration | `wdk-wallet-stellar`                |
| `swap`    | DEX/token swap protocol       | `wdk-protocol-swap-jupiter-solana`  |
| `bridge`  | Cross-chain bridge protocol   | `wdk-protocol-bridge-wormhole-evm`  |
| `lending` | DeFi lending protocol         | `wdk-protocol-lending-compound-evm` |
| `fiat`    | Fiat on/off-ramp provider     | `wdk-protocol-fiat-moonpay`         |

***

## CLI Options

| Option            | Alias | Description                                       | Default              |
| ----------------- | ----- | ------------------------------------------------- | -------------------- |
| `[type]`          |       | Module type (wallet, swap, bridge, lending, fiat) | (interactive prompt) |
| `[name]`          |       | Module or protocol name                           | (interactive prompt) |
| `[blockchain]`    |       | Target blockchain                                 | (interactive prompt) |
| `--scope <scope>` | `-s`  | npm scope (e.g., `@myorg`)                        | none                 |
| `--git`           |       | Initialize a git repository                       | `true`               |
| `--no-git`        |       | Skip git initialization                           |                      |
| `--yes`           | `-y`  | Skip prompts, use defaults                        | `false`              |
| `--version`       | `-v`  | Show version                                      |                      |
| `--help`          | `-h`  | Show help                                         |                      |

### Examples

{% code title="Common CLI usage patterns" %}

```bash
# Create a wallet module with an npm scope
npx @tetherto/create-wdk-module@latest wallet stellar --scope @myorg

# Create a swap protocol module
npx @tetherto/create-wdk-module@latest swap jupiter solana

# Create with all defaults, no prompts
npx @tetherto/create-wdk-module@latest wallet stellar --yes
```

{% endcode %}

***

## Interactive Mode

When run without arguments, the CLI guides you through module setup step by step:

{% code title="Interactive session" %}

```bash
$ npx @tetherto/create-wdk-module@latest

  Create WDK Module

? What type of module do you want to create?
  > Wallet Module (blockchain wallet integration)
    Swap Module (DEX/token swap integration)
    Bridge Module (cross-chain bridging)
    Lending Module (DeFi lending protocol)
    Fiat Module (fiat on/off-ramp)

? What is the blockchain name? (e.g., "stellar", "solana")
  > stellar

? npm scope (leave empty for none, e.g., @myorg):
  >

? Initialize git repository?
  > Yes

Creating wdk-wallet-stellar...

✓ Template files copied
✓ Initialized git repository

Success! Created wdk-wallet-stellar at ./wdk-wallet-stellar

Next steps:
  cd wdk-wallet-stellar
  npm install
  npm test
```

{% endcode %}

***

## Generated Project Structure

The scaffolded project includes source files, tests, TypeScript definitions, and GitHub CI workflows out of the box.

<details>

<summary>Wallet Module structure</summary>

{% code title="Wallet module project tree" %}

```
wdk-wallet-stellar/
├── .github/
│   ├── workflows/
│   │   ├── build.yml
│   │   └── publish.yml
│   ├── ISSUE_TEMPLATE/
│   │   └── general.md
│   └── PULL_REQUEST_TEMPLATE.md
├── src/
│   ├── wallet-manager-stellar.js
│   ├── wallet-account-stellar.js
│   └── wallet-account-read-only-stellar.js
├── tests/
│   ├── wallet-manager-stellar.test.js
│   ├── wallet-account-stellar.test.js
│   └── wallet-account-read-only-stellar.test.js
├── types/
│   ├── index.d.ts
│   └── src/
│       ├── wallet-manager-stellar.d.ts
│       ├── wallet-account-stellar.d.ts
│       └── wallet-account-read-only-stellar.d.ts
├── .editorconfig
├── .gitignore
├── .npmignore
├── bare.js
├── index.js
├── LICENSE
├── package.json
├── README.md
└── tsconfig.json
```

{% endcode %}

Wallet modules generate three core files that correspond to the WDK wallet architecture:

| File                            | Purpose                                                                |
| ------------------------------- | ---------------------------------------------------------------------- |
| `wallet-manager-*.js`           | Module entry point, handles wallet registration and account derivation |
| `wallet-account-*.js`           | Full account with signing capabilities (transactions, messages)        |
| `wallet-account-read-only-*.js` | Read-only account for balance checks and transaction history           |

</details>

<details>

<summary>Protocol Module structure (swap, bridge, lending, fiat)</summary>

{% code title="Protocol module project tree" %}

```
wdk-protocol-swap-jupiter-solana/
├── .github/
│   ├── workflows/
│   │   ├── build.yml
│   │   └── publish.yml
│   ├── ISSUE_TEMPLATE/
│   │   └── general.md
│   └── PULL_REQUEST_TEMPLATE.md
├── src/
│   └── jupiter-protocol-solana.js
├── tests/
│   └── jupiter-protocol-solana.test.js
├── types/
│   ├── index.d.ts
│   └── src/
│       └── jupiter-protocol-solana.d.ts
├── .editorconfig
├── .gitignore
├── .npmignore
├── bare.js
├── index.js
├── LICENSE
├── package.json
├── README.md
└── tsconfig.json
```

{% endcode %}

Protocol modules generate a single provider file rather than the three-file wallet pattern, since protocols interact with external services through a unified interface.

</details>

***

## Next Steps

<table data-card-size="large" data-view="cards"><thead><tr><th></th><th></th><th></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><i class="fa-code">:code:</i></td><td><strong>Wallet Modules</strong></td><td>See how official wallet modules are structured and documented</td><td><a href="/pages/eSp3C91s6PgKLa7qrmq7">/pages/eSp3C91s6PgKLa7qrmq7</a></td></tr><tr><td><i class="fa-puzzle-piece">:puzzle-piece:</i></td><td><strong>Community Modules</strong></td><td>Explore community-built modules and submit your own</td><td><a href="/pages/feau64rpJmwaa8beHRbI">/pages/feau64rpJmwaa8beHRbI</a></td></tr></tbody></table>

{% hint style="info" %}
**Reference implementation**: The [`wdk-wallet-solana`](https://github.com/tetherto/wdk-wallet-solana) module is a good reference for understanding how a production wallet module implements the WDK interfaces. The [`wdk-wallet`](https://github.com/tetherto/wdk-wallet) package defines the base classes your module must extend.
{% endhint %}

***

## Need Help?

<table data-view="cards"><thead><tr><th></th><th></th><th></th><th></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><i class="fa-discord">:discord:</i></td><td><strong>Discord Community</strong></td><td>Connect with developers, ask questions, share your projects</td><td><a href="https://discord.gg/arYXDhHB2w" class="button primary">Join Community</a></td><td><a href="https://discord.gg/arYXDhHB2w">https://discord.gg/arYXDhHB2w</a></td></tr><tr><td><i class="fa-github">:github:</i></td><td><strong>GitHub Issues</strong></td><td>Report bugs, request features, and get technical help</td><td><a href="https://github.com/tetherto/wdk-core" class="button secondary">Open an Issue</a></td><td><a href="https://github.com/tetherto/wdk-core">https://github.com/tetherto/wdk-core</a></td></tr><tr><td><i class="fa-envelope">:envelope:</i></td><td><strong>Email Contact</strong></td><td>For sensitive or private matters, contact our team directly</td><td><a href="mailto:wallet-info.tether.io" class="button secondary">Send an email</a></td><td><a href="mailto:wallet-info.tether.io">mailto:wallet-info.tether.io</a></td></tr></tbody></table>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.wdk.tether.io/tools/create-wdk-module.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
