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()

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)

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

Throws: Error if connection fails, message is invalid, or validation fails

sendTransaction(params)

Sends a transaction with the specified parameters and comprehensive validation.

Parameters:

  • params (object, required): Transaction parameters

    • asset (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()

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()

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