Wallet Adapter Plugin
Use the standard Aptos Wallet Adapter to connect Watchee from any dApp.
When to Use This
watchee-minikit | @watchee/wallet-adapter-plugin | |
|---|---|---|
| Use case | Mini-apps that run exclusively inside Watchee | Standard dApps that work everywhere |
| Auth | minikit.walletAuth() — automatic | useWallet().connect("Watchee") — user-initiated |
| Scope | Full MiniKit API (payments, social, haptics) | Wallet only (connect, sign, submit) |
| Works outside Watchee | No | Yes (deep link fallback) |
If your app only runs inside Watchee, use MiniKit. If you want your dApp to support Watchee alongside other Aptos wallets, use this plugin.
Installation
npm install @watchee/wallet-adapter-plugin
Peer dependency: @aptos-labs/ts-sdk (>= 1.33.0). If you already use the Aptos Wallet Adapter, you have this.
Setup
Add WatcheeWallet to the Wallet Adapter Provider:
import { AptosWalletAdapterProvider } from "@aptos-labs/wallet-adapter-react";
import { WatcheeWallet } from "@watchee/wallet-adapter-plugin";
import { Network } from "@aptos-labs/ts-sdk";
function App() {
const wallets = [
new WatcheeWallet({ network: Network.MAINNET }),
];
return (
<AptosWalletAdapterProvider
plugins={wallets}
autoConnect={true}
dappConfig={{ network: Network.MAINNET }}
>
{/* Your app */}
</AptosWalletAdapterProvider>
);
}
Connect & Disconnect
Use the standard useWallet hook from @aptos-labs/wallet-adapter-react:
import { useWallet } from "@aptos-labs/wallet-adapter-react";
function ConnectButton() {
const { connect, disconnect, account, connected } = useWallet();
if (connected) {
return (
<div>
<p>Connected: {account?.address}</p>
<button onClick={disconnect}>Disconnect</button>
</div>
);
}
return <button onClick={() => connect("Watchee")}>Connect Watchee</button>;
}
Sign Transactions
import { useWallet } from "@aptos-labs/wallet-adapter-react";
function TransferAPT() {
const { signAndSubmitTransaction } = useWallet();
const handleTransfer = async () => {
const result = await signAndSubmitTransaction({
data: {
function: "0x1::coin::transfer",
typeArguments: ["0x1::aptos_coin::AptosCoin"],
functionArguments: ["0xRecipientAddress", 100_000_000], // 1 APT
},
});
console.log("Transaction hash:", result.hash);
};
return <button onClick={handleTransfer}>Send 1 APT</button>;
}
Sign Messages
const { signMessage } = useWallet();
const handleVerify = async () => {
const result = await signMessage({
message: "Verify account ownership",
nonce: Date.now().toString(),
});
console.log("Signature:", result.signature);
// Send signature to your backend for verification
};
How It Works
Inside Watchee (Mini-Apps)
When your dApp runs inside the Watchee app, the plugin detects window.WatcheeSDK (injected by the native bridge) and uses it directly. The user is already authenticated, so connect() resolves immediately with the active account.
Outside Watchee (Standalone dApps)
When your dApp runs in a regular browser, clicking "Connect Watchee" opens the Watchee app via deep link (watcheetv://wallet/connect). If the Watchee app is not installed, the user is redirected to the Watchee download page.
Configuration
interface WatcheeWalletConfig {
/** Target Aptos network. Defaults to Network.MAINNET. */
network?: Network;
}
Pass to the constructor:
new WatcheeWallet({ network: Network.TESTNET })
AIP-62 Features
The plugin implements all required AIP-62 Wallet Standard features:
| Feature | Version | Description |
|---|---|---|
aptos:connect | 1.0.0 | Connect wallet |
aptos:disconnect | 1.0.0 | Disconnect wallet |
aptos:account | 1.0.0 | Get connected account info |
aptos:network | 1.0.0 | Get current network |
aptos:signTransaction | 1.0.0 | Sign a raw transaction |
aptos:signMessage | 1.0.0 | Sign an arbitrary message |
aptos:onAccountChange | 1.0.0 | Listen for account changes |
aptos:onNetworkChange | 1.0.0 | Listen for network changes |
Best Practices
- Enable
autoConnect: SetautoConnect={true}on the provider so returning users reconnect automatically. - Handle errors: Wrap all wallet calls in try/catch — users can cancel prompts or lose network.
- Match networks: Ensure the
networkyou pass toWatcheeWalletmatches yourdappConfig.network. - Test both paths: Verify your dApp works both inside the Watchee app (native bridge) and in a regular browser (deep link fallback).