API Reference

installMockStellarWallet(options)

Installs the mock wallet into a Playwright page. Must be called before page.goto().

Parameters

ParameterTypeRequiredDefaultDescription
pagePageYes-Playwright Page instance
secretKeystringYes-Stellar secret key (starts with S)
networkstringNo"TESTNET"Network name
networkPassphrasestringNoNetworks.TESTNETStellar 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

ParameterTypeRequiredDescription
secretKeystringYesStellar secret key
optionsWalletOptionsNoNetwork 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.

PropertyTypeDescription
keypairKeypairStellar Keypair instance
publicKeystringPublic key (starts with G)
networkstringNetwork name
networkPassphrasestringNetwork passphrase
getInjectionConfig()WalletInjectionConfigReturns serialized config for browser injection

Exported Types

1import type {
2 MockWallet, // Wallet instance
3 WalletOptions, // Network config options
4 WalletInjectionConfig, // Serialized config for browser
5 InstallMockWalletOptions // Options for installMockStellarWallet()
6} from "stellar-wallet-mock";