Developer Reference
Moi Wallet is open source. Full setup instructions, architecture notes, environment configuration, and build pipelines are maintained in the GitHub README files for each project — this page points you to the right repository and explains how the Chrome extension exposes the wallet to web pages.
Mobile App (React Native / Expo)
Cross-platform wallet for iOS and Android, built with React Native and Expo.
For local development setup, environment configuration, EAS build configuration, and architecture overview, refer to the official README:
👉 github.com/sarvalabs/moi-wallet-mobile
DApp developers can refer to the DApp docs on GitHub to understand how to connect to Moi Wallet mobile via WalletConnect.
Topics covered in the repo:
- Prerequisites and dependency installation
- Running on iOS and Android simulators or physical devices
- Expo and EAS build workflows
- Project structure and key modules
- Integration with
js-moi-sdk
Chrome Extension (Turborepo / pnpm monorepo)
Browser wallet for Chromium-based browsers, built as a pnpm monorepo with Turborepo.
For local development setup, extension manifest configuration, monorepo structure, and build instructions, refer to the official README:
👉 github.com/sarvalabs/moi-wallet-extension
Topics covered in the repo:
- Monorepo layout (
apps/,packages/) - Building and loading the extension in Chrome
- Popup, runtime, and provider injection architecture
- Shared packages and workspace dependencies
window.moi provider injection
The Chrome extension injects a read-only window.moi object into every web page so MOI-compatible DApps can discover and communicate with the wallet without a separate SDK install.
How injection works
- The extension's content script (
content-runtime) runs on matched pages and injects the inpage script (apps/inpage) into the page context. - The inpage script creates a frozen
BrowserTransportinstance and assigns it towindow.moiusing a non-writable, non-configurable property:
Object.defineProperty(globalThis, "moi", {
writable: false,
enumerable: true,
configurable: false,
value: browserTransport,
});
- DApp JavaScript calls methods on
window.moi— requests are forwarded from the page, through the content script, to the extension background runtime, which opens approval popups when user consent is required. - Responses flow back over the same message channel as JSON-RPC results.
The injected provider is marked with __isMOIWallet: true so DApps can detect Moi Wallet specifically:
if (globalThis?.moi?.__isMOIWallet === true) {
console.log("MOI Wallet is installed");
}
DApp API surface
The primary integration method is JSON-RPC over window.moi.request:
globalThis.moi.request<TResult = unknown>(
method: string,
params: unknown[] = []
): Promise<JsonRpcResponse<TResult>>;
Common methods include:
| Method | Purpose |
|---|---|
wallet.ClientVersion | Returns the wallet version string |
wallet.Accounts | Returns connected account addresses |
wallet.RequestPermissions | Prompts the user to grant site permissions |
wallet.SignMessage | Prompts the user to sign a hex-encoded message |
wallet.SignInteraction | Prompts the user to sign an MOI interaction |
wallet.SendInteraction | Signs and broadcasts an interaction |
Event listeners are supported for account and network changes:
globalThis.moi.addListener("accountChange", (address) => {
console.log("Account changed to:", address);
});
For the full method list, permission model, and request/response shapes, see the extension SPECIFICATION.md and README integration guide.
Architecture overview
DApp page (window.moi)
↕ postMessage
Content script (content-runtime)
↕ chrome.runtime messaging
Background runtime (apps/runtime)
↕ popup UI
Extension popup (apps/popup) — user approval for connect, sign, send
The mobile app does not inject window.moi. Mobile DApp integration uses WalletConnect instead. See DApp Connections.
Shared SDK
Both clients interact with the MOI network through js-moi-sdk. Check each project's README for the exact SDK version pin.
Contribute
Interested in contributing code, documentation, or bug reports? See Contribute to Moi Wallet.
End-user documentation
For wallet usage guides (create wallet, DApp connections, security settings), start with the Introduction or Getting Started section.