跳到主要内容

Wallet Integration

This guide explains how to add Monolythium support to your wallet, dApp, or frontend. It covers EVM chain parameters, Keplr configuration, the Monolythium Browser Wallet's dual provider, and library-specific examples for wagmi and viem.


Chain Parameters

MetaMask / EIP-3085

Use wallet_addEthereumChain to add Monolythium to any EIP-3085-compatible wallet:

// Testnet
const testnetParams = {
chainId: '0x1B1C', // 6940
chainName: 'Monolythium Testnet',
nativeCurrency: {
name: 'Lythium',
symbol: 'LYTH',
decimals: 18,
},
rpcUrls: ['https://evm.testnet.mononodes.xyz'],
blockExplorerUrls: ['https://testnet.monoscan.xyz'],
};

// Mainnet
const mainnetParams = {
chainId: '0x1B1D', // 6941
chainName: 'Monolythium',
nativeCurrency: {
name: 'Lythium',
symbol: 'LYTH',
decimals: 18,
},
rpcUrls: ['https://evm.mainnet.mononodes.xyz'],
blockExplorerUrls: ['https://monoscan.xyz'],
};

// Add the chain
await window.ethereum.request({
method: 'wallet_addEthereumChain',
params: [testnetParams],
});

// Switch to the chain
await window.ethereum.request({
method: 'wallet_switchEthereumChain',
params: [{ chainId: '0x1B1C' }],
});

Keplr Chain Suggestion

Use experimentalSuggestChain to add Monolythium to Keplr or any Keplr-compatible wallet (Leap, Monolythium Browser Wallet):

await window.keplr.experimentalSuggestChain({
chainId: 'mono_6940-1',
chainName: 'Monolythium Testnet',
rpc: 'https://rpc.testnet.mononodes.xyz',
rest: 'https://rest.testnet.mononodes.xyz',
bip44: { coinType: 60 },
bech32Config: {
bech32PrefixAccAddr: 'mono',
bech32PrefixAccPub: 'monopub',
bech32PrefixValAddr: 'monovaloper',
bech32PrefixValPub: 'monovaloperpub',
bech32PrefixConsAddr: 'monovalcons',
bech32PrefixConsPub: 'monovalconspub',
},
currencies: [{
coinDenom: 'LYTH',
coinMinimalDenom: 'alyth',
coinDecimals: 18,
}],
feeCurrencies: [{
coinDenom: 'LYTH',
coinMinimalDenom: 'alyth',
coinDecimals: 18,
gasPriceStep: {
low: 10000000000,
average: 15000000000,
high: 25000000000,
},
}],
stakeCurrency: {
coinDenom: 'LYTH',
coinMinimalDenom: 'alyth',
coinDecimals: 18,
},
features: ['eth-address-gen', 'eth-key-sign'],
});

// Enable and get the key
await window.keplr.enable('mono_6940-1');
const key = await window.keplr.getKey('mono_6940-1');
console.log('Bech32:', key.bech32Address); // mono1...
console.log('Algo:', key.algo); // ethsecp256k1

Monolythium Browser Wallet

The Monolythium Browser Wallet provides two provider interfaces from a single extension:

EIP-1193 Provider (window.monolythium)

Standard Ethereum provider for EVM interactions:

// Check availability
if (window.monolythium) {
const accounts = await window.monolythium.request({
method: 'eth_requestAccounts',
});
console.log('EVM address:', accounts[0]); // 0x...
}

EIP-6963 Discovery

The recommended way to detect the wallet without relying on global injection:

window.addEventListener('eip6963:announceProvider', (event) => {
if (event.detail.info.rdns === 'xyz.monolythium.wallet') {
const provider = event.detail.provider;
// Use this provider for all EVM interactions
}
});
window.dispatchEvent(new Event('eip6963:requestProvider'));
EIP-6963 FieldValue
nameMonolythium Wallet
rdnsxyz.monolythium.wallet
uuidb2e3c4a0-mono-lyth-ext0-wallet00000001

Keplr-Compatible Provider (window.keplr)

If no existing Keplr extension is installed, the Monolythium Browser Wallet also injects a Keplr-compatible provider at window.keplr for Cosmos operations (staking, governance, IBC):

await window.keplr.enable('mono_6940-1');
const signer = window.getOfflineSigner('mono_6940-1');
const accounts = await signer.getAccounts();
console.log('Cosmos address:', accounts[0].address); // mono1...
No Conflict

If Keplr is already installed, the Monolythium wallet does not override window.keplr. Users can still access EVM features through window.monolythium.


viem Chain Definition

Define Monolythium as a custom chain for viem:

import { defineChain } from 'viem';

export const monolythiumTestnet = defineChain({
id: 6940,
name: 'Monolythium Testnet',
nativeCurrency: {
name: 'Lythium',
symbol: 'LYTH',
decimals: 18,
},
rpcUrls: {
default: { http: ['https://evm.testnet.mononodes.xyz'] },
},
blockExplorers: {
default: {
name: 'Monoscan',
url: 'https://testnet.monoscan.xyz',
},
},
});

export const monolythiumMainnet = defineChain({
id: 6941,
name: 'Monolythium',
nativeCurrency: {
name: 'Lythium',
symbol: 'LYTH',
decimals: 18,
},
rpcUrls: {
default: { http: ['https://evm.mainnet.mononodes.xyz'] },
},
blockExplorers: {
default: {
name: 'Monoscan',
url: 'https://monoscan.xyz',
},
},
});

Use with viem clients:

import { createPublicClient, createWalletClient, http, custom } from 'viem';

// Read-only client
const publicClient = createPublicClient({
chain: monolythiumTestnet,
transport: http(),
});

// Browser wallet client
const walletClient = createWalletClient({
chain: monolythiumTestnet,
transport: custom(window.monolythium),
});

wagmi Configuration

Add Monolythium to a wagmi-powered dApp:

import { http, createConfig } from 'wagmi';
import { injected } from 'wagmi/connectors';
import { monolythiumTestnet, monolythiumMainnet } from './chains';

export const config = createConfig({
chains: [monolythiumTestnet, monolythiumMainnet],
connectors: [
injected({
target: {
id: 'monolythium',
name: 'Monolythium Wallet',
provider: () => window.monolythium,
},
}),
injected(), // MetaMask and other injected wallets
],
transports: {
[monolythiumTestnet.id]: http(),
[monolythiumMainnet.id]: http(),
},
});

Use wagmi hooks in your components:

import { useAccount, useBalance, useSendTransaction } from 'wagmi';
import { parseEther } from 'viem';

function SendLYTH() {
const { address } = useAccount();
const { data: balance } = useBalance({ address });
const { sendTransaction } = useSendTransaction();

return (
<button onClick={() =>
sendTransaction({
to: '0xRecipient...',
value: parseEther('1'),
})
}>
Send 1 LYTH (Balance: {balance?.formatted} {balance?.symbol})
</button>
);
}

Important Notes

Legacy Transactions

Monolythium uses the paris EVM version and does not support EIP-1559 base fee mechanics. All transactions use legacy (type 0) gas pricing. Most wallet libraries handle this automatically when the RPC does not advertise EIP-1559 support.

Minimum Gas Price

The minimum gas price is 10000000000 wei (10 gwei equivalent). Transactions with a lower gas price will be rejected by the mempool.

Dual Address Format

Each Monolythium account has both an EVM address (0x...) and a Cosmos address (mono1...) derived from the same private key. EVM wallets (MetaMask) only see the 0x address. Cosmos wallets (Keplr) see the mono1 address. Both control the same on-chain account.

Coin Type

Monolythium uses BIP-44 coin type 60 (same as Ethereum), not 118 (standard Cosmos). This means Ethereum-style key derivation (m/44'/60'/0'/0/0) is used for both EVM and Cosmos addresses.