Developer Documentation

Build on Solana with WalletAI. Connect to the injected provider, authenticate users, and tap the Tenseuron compute network.

API Reference

A lightweight Solana provider injected at window.walletai

Injected Provider API

A lightweight Solana provider injected at window.walletai

// Detect WalletAI
if (window.walletai?.isWalletAI) {
  const { publicKey } = await window.walletai.connect();
  console.log('Connected:', publicKey);
}

Wallet Connection

Request wallet connection and handle user approval

// Request connection
try {
  const { publicKey } = await window.walletai.connect();
  console.log('Connected:', publicKey);
} catch (error) {
  console.error('Connection rejected');
}

Message Signing

Sign a message to authenticate the wallet with your backend

// Sign a message — returns a base58 signature
const { signature } = await window.walletai.signMessage(
  'login:' + Date.now()
);
console.log('Signature:', signature);

Account Discovery

Read the connected account and listen for changes

// Current account(s)
const accounts = await window.walletai.getAccounts();

// React to account changes
window.walletai.on('accountsChanged', (accts) => {
  console.log('Account changed:', accts[0]);
});

Integration Examples

Get started quickly with these code examples

React Integration

Connect WalletAI to your React dApp

import { useEffect, useState } from 'react';

function useWalletAI() {
  const [account, setAccount] = useState<string | null>(null);

  const connect = async () => {
    if (window.walletai?.isWalletAI) {
      const { publicKey } = await window.walletai.connect();
      setAccount(publicKey);
    }
  };

  useEffect(() => {
    window.walletai?.getAccounts?.().then((a) => {
      if (a?.[0]) setAccount(a[0]);
    });
  }, []);

  return { account, connect };
}

Next.js Integration

Use WalletAI in your Next.js application

'use client';

import { useState } from 'react';

export default function WalletButton() {
  const [account, setAccount] = useState<string | null>(null);

  const connect = async () => {
    if (window.walletai?.isWalletAI) {
      const { publicKey } = await window.walletai.connect();
      setAccount(publicKey);
    }
  };

  return (
    <button onClick={connect}>
      {account ? account.slice(0, 6) + '…' : 'Connect Wallet'}
    </button>
  );
}

Building with WalletAI

Connect your Solana dApp and tap the Tenseuron compute network

Connect & Authenticate

Detect window.walletai, connect, and verify users with a signed message

Read On-chain State

Use the connected address to query SOL and SPL balances via Solana RPC

Tenseuron Compute API

Submit AI tasks to /api/compute and poll for results — the same backend the wallet uses

Agents & Automations

Create and manage autonomous agents via the /api/agents endpoints