Solana Provider
Not yet supported. The
@alien_org/solana-providerpackage is currently under development and not available for use.
The @alien_org/solana-provider package provides a
wallet-standard
compatible Solana wallet for mini apps. It bridges the Alien app’s
native wallet to any Solana dApp stack (wallet adapters, Anchor,
web3.js, etc.).
Installation
npm install @alien_org/solana-providerQuick Start
Call initAlienWallet() once at your app’s entry point. Wallet
adapters will auto-discover the Alien wallet.
import { initAlienWallet } from '@alien_org/solana-provider';
// Register at app startup (e.g., main.tsx)
initAlienWallet();That’s it — your existing Solana wallet adapter code will see “Alien” as an available wallet.
How It Works
Your dApp (wallet adapter)
↓ wallet-standard discovery
AlienSolanaWallet
↓ bridge requests
Alien App (native wallet)initAlienWallet()registers anAlienSolanaWalletinstance via@wallet-standard/wallet- Wallet adapters (e.g.,
@solana/wallet-adapter-react) auto-discover it - All wallet operations (connect, sign, send) go through the bridge to the Alien app’s native wallet
Requirements
- Bridge must be available (running inside the Alien app)
- Contract version 1.0.0 or higher
- If the bridge is unavailable or the version is too old,
initAlienWallet()silently returns without registering
Features
The wallet implements these wallet-standard features:
| Feature | Description |
|---|---|
standard:connect | Connect to the wallet |
standard:disconnect | Disconnect from the wallet |
standard:events | Listen for account changes |
solana:signTransaction | Sign a transaction |
solana:signAndSendTransaction | Sign and send a transaction |
solana:signMessage | Sign an arbitrary message |
Supported transaction versions: legacy and 0.
Supported chains: solana:mainnet, solana:devnet,
solana:testnet.
Usage with Wallet Adapter
import {
ConnectionProvider,
WalletProvider,
} from '@solana/wallet-adapter-react';
import { initAlienWallet } from '@alien_org/solana-provider';
// Register before rendering
initAlienWallet();
function App() {
return (
<ConnectionProvider endpoint={rpcUrl}>
<WalletProvider wallets={[]} autoConnect>
<YourApp />
</WalletProvider>
</ConnectionProvider>
);
}Pass an empty wallets array — the Alien wallet is discovered
automatically via wallet-standard. No manual adapter needed.
Error Handling
Wallet operations throw AlienWalletError on failure.
import { AlienWalletError } from '@alien_org/solana-provider';
try {
await wallet.connect();
} catch (error) {
if (error instanceof AlienWalletError) {
console.error(error.code, error.message);
}
}Error Codes
| Code | Name | Description |
|---|---|---|
5000 | USER_REJECTED | User rejected the request |
-32602 | INVALID_PARAMS | Invalid request parameters |
-32603 | INTERNAL_ERROR | Internal wallet error |
8000 | REQUEST_EXPIRED | Request timed out (60s) |
Named constants are available from @alien_org/contract:
import { WALLET_ERROR } from '@alien_org/contract';
if (error.code === WALLET_ERROR.USER_REJECTED) {
// User cancelled
}API Reference
initAlienWallet
function initAlienWallet(): void;Registers the Alien wallet with wallet-standard. Call once at app startup. Safe to call multiple times (idempotent). Does nothing if the bridge is unavailable or the contract version doesn’t support wallet methods.
AlienSolanaWallet
The wallet-standard Wallet implementation. You typically
don’t interact with this directly — wallet adapters handle it.
class AlienSolanaWallet implements Wallet {
readonly version: '1.0.0';
readonly name: 'Alien';
readonly chains: ['solana:mainnet', 'solana:devnet', 'solana:testnet'];
readonly accounts: readonly WalletAccount[];
readonly features: { /* see Features table */ };
}AlienSolanaAccount
Represents a connected Solana account.
class AlienSolanaAccount implements WalletAccount {
readonly address: string; // Base58 public key
readonly publicKey: Uint8Array;
readonly chains: SolanaChain[];
readonly features: string[];
}AlienWalletError
Error class with a numeric code property matching wallet
error codes.
class AlienWalletError extends Error {
readonly code: WalletSolanaErrorCode;
}Next Steps
- Bridge Reference — Wallet methods and events
- React SDK — React hooks for mini apps
- Testing — Test your mini app