API Reference
installMockStellarWallet(options)
Installs the mock wallet into a Playwright page. Must be called before page.goto().
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
page | Page | Yes | - | Playwright Page instance |
secretKey | string | Yes | - | Stellar secret key (starts with S) |
network | string | No | "TESTNET" | Network name |
networkPassphrase | string | No | Networks.TESTNET | Stellar network passphrase |
Returns
Promise<MockWallet>
1const wallet = await installMockStellarWallet({2 page,3 secretKey: "SDPDMYEWFZEL6MW37FTPNTPZFYU2QYX4MLDSA7QBS4VSNZL5JL4IKDVQ",4 network: "TESTNET",5});6
7console.log(wallet.publicKey); // "GBIIN6LP..."createWallet(secretKey, options?)
Creates a wallet instance without installing it into a page. Useful for getting the public key or keypair before page setup.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
secretKey | string | Yes | Stellar secret key |
options | WalletOptions | No | Network configuration |
1import { createWallet } from "stellar-wallet-mock";2
3const wallet = createWallet("SDPDMYEWFZEL6MW37FTPNTPZFYU2QYX4MLDSA7QBS4VSNZL5JL4IKDVQ");4console.log(wallet.publicKey); // "GBIIN6LP..."MockWallet
The wallet object returned by both installMockStellarWallet and createWallet.
| Property | Type | Description |
|---|---|---|
keypair | Keypair | Stellar Keypair instance |
publicKey | string | Public key (starts with G) |
network | string | Network name |
networkPassphrase | string | Network passphrase |
getInjectionConfig() | WalletInjectionConfig | Returns serialized config for browser injection |
Exported Types
1import type {2 MockWallet, // Wallet instance3 WalletOptions, // Network config options4 WalletInjectionConfig, // Serialized config for browser5 InstallMockWalletOptions // Options for installMockStellarWallet()6} from "stellar-wallet-mock";