API Reference
Constructor
const wallet = new SaturnWallet();Creates a new instance of the Saturn Wallet SDK. Automatically checks for existing connections and validates them.
Methods
getCurrentAddress()
getCurrentAddress()Returns the currently connected wallet address with validation.
try {
const address = await wallet.getCurrentAddress();
console.log(`Current address: ${address}`);
} catch (error) {
console.error("Error getting address:", error.message);
}Returns: Promise<string> - The wallet address
Throws: Error if wallet not connected or validation fails
connect(message)
connect(message)Connects to the wallet by requesting a message signature with ownership proof.
Parameters:
message(string, required): Message to be signed for connection
Returns: Promise<Object> - Connection object with address, signature, and publicKey
Promise<Object> - Connection object with address, signature, and publicKeyThrows: Error if connection fails, message is invalid, or validation fails
sendTransaction(params)
sendTransaction(params)Sends a transaction with the specified parameters and comprehensive validation.
Parameters:
params(object, required): Transaction parametersasset(string): Asset symbol (e.g., "CIRX")amount(string): Amount to send (must be positive number)toAddress(string): Recipient address
Returns: Promise<Object> - Transaction result with hash, block, and status
Throws: Error if wallet not connected, invalid parameters, or transaction fails
disconnect()
disconnect()Disconnects the wallet from the current dApp and clears local state.
Returns: Promise<boolean> - True if disconnected successfully
Throws: Error if disconnect operation fails (local state still cleared)
isConnected()
isConnected()Checks if the wallet is currently connected with full validation.
Returns: boolean - True if wallet is connected and validated
Throws: Error if connection validation fails (clears invalid connection state)
Last updated