> ## Documentation Index
> Fetch the complete documentation index at: https://www.dynamic.xyz/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Creating Extensions

> Build a custom extension that adds wallet providers or other runtime services to the Dynamic JavaScript SDK.

An extension is a function that adds functionality to a `DynamicClient`. Use it to integrate a wallet that Dynamic does not officially support, or to add new features that the Dynamic team has not implemented. If you publish it to npm, other developers can import and call the extension to add that functionality to their own Dynamic client; you can also keep it internal to your own codebase.

<Warning>
  The core extension APIs (`WalletProvider`, `Storage`, `registerExtension`, etc.) may change between major versions of the Dynamic SDK. Pin your extension to a specific major version and review the release notes before upgrading.
</Warning>

## Extension skeleton

Every extension follows the same pattern: check whether it is already registered with `hasExtension`, call `registerExtension`, then add the providers or services the extension contributes.

```typescript theme={"system"}
import {
  getDefaultClient,
  hasExtension,
  registerExtension,
} from "@dynamic-labs-sdk/client/core";
import type { DynamicClient } from "@dynamic-labs-sdk/client";

const MY_EXTENSION_KEY = "myCustomExtension";

export const addMyExtension = (
  client: DynamicClient = getDefaultClient()
): void => {
  if (hasExtension({ extensionKey: MY_EXTENSION_KEY }, client)) {
    return;
  }

  registerExtension({ extensionKey: MY_EXTENSION_KEY }, client);

  // Register wallet providers or use core services below.
};
```

* `extensionKey` is a unique string for your extension.
* `hasExtension` makes the call idempotent so multiple imports do not double-register.
* `client` defaults to `getDefaultClient()`. Only pass a client explicitly if your app uses multiple Dynamic clients.

## Extension interfaces

<CardGroup cols={2}>
  <Card title="Publish" icon="upload" href="/docs/javascript/reference/creating-extensions/publish">
    Package and publish your extension to npm.
  </Card>

  <Card title="Custom Functions" icon="code" href="/docs/javascript/reference/creating-extensions/custom-functions">
    Add standalone functions that use `DynamicClient` services.
  </Card>

  <Card title="Wallet Provider" icon="wallet" href="/docs/javascript/reference/creating-extensions/wallet-provider/overview">
    Integrate a custom wallet through supported standards or a `WalletProvider`.
  </Card>

  <Card title="Services" icon="gears" href="/docs/javascript/reference/creating-extensions/services/storage">
    Use storage, deep links, and registry priority from `DynamicCore`.
  </Card>
</CardGroup>

## Glossary

| Term                              | Definition                                                                                                   |
| --------------------------------- | ------------------------------------------------------------------------------------------------------------ |
| `Extension (or custom extension)` | A function or set of functions that adds runtime behavior to a `DynamicClient` through `registerExtension`.  |
| `Extension author`                | The developer who builds the extension.                                                                      |
| `Consumer app / final developer`  | The application that imports the extension, calls its setup function, and uses the Dynamic SDK alongside it. |
| `DynamicClient`                   | The SDK client that holds state, services, and registered extensions. Create one with `createDynamicClient`. |
| `DynamicCore`                     | The service container inside `DynamicClient`; exposes `Storage`, `openDeeplink`, and other services.         |
| `extensionKey`                    | A unique string identifying an extension, used with `registerExtension` and `hasExtension`.                  |
| `WalletProvider`                  | Interface that connects a wallet to the SDK so it can be discovered, connected, and used for signing.        |
| `WalletProviderRegistry`          | The registry that stores wallet providers and resolves them by `key`.                                        |
| `WalletProviderPriority`          | Priority value that controls which registration wins when multiple providers share a `key`.                  |
| `Storage`                         | `DynamicCore` service for persisting extension state, with `default` and `secure` tiers.                     |
| `openDeeplink`                    | `DynamicCore` service for opening cross-platform deep links from an extension.                               |

## Related

* [Adding Extensions](/docs/javascript/reference/adding-extensions) — Use existing chain and addon extensions.
* [Creating a Dynamic Client](/docs/javascript/reference/client/create-dynamic-client)
* [Initializing the Dynamic Client](/docs/javascript/reference/client/initialize-dynamic-client)
