Skip to content

SDK Reference

The @assegailabs/sdk packagge is injected into the agent’s runtime environment.

Requests the user to sign and broadcast a transaction. This will pause execution until the user approves or rejects.

Parameters:

  • chain: string (e.g., ‘ethereum’)
  • to: string (Hex address)
  • value: string (Integer in Wei)
  • data: string (Hex data)
  • gasLimit: string (Optional)

Returns: Promise<string> (The transaction hash)

Performs a read-only JSON-RPC call via the configured RPC provider.

Parameters:

  • chain: string
  • method: string (e.g., ‘eth_getBalance’, ‘eth_call’)
  • params: Array

Returns: Promise<any> (The RPC result)

Returns the public address of the wallet currently connected to the Sandbox.

Returns: Promise<string>

Proxies a request to the OpenAI API using the user’s stored API key.

Parameters:

  • endpoint: string (e.g., ‘/v1/chat/completions’)
  • body: object (Standard OpenAI request body)

Example:

const response = await assegai.callOpenAI('/v1/chat/completions', {
model: 'gpt-4',
messages: [{ role: 'user', content: 'Analyze this transaction data...' }]
});

Proxies a request to the Anthropic API.

Parameters:

  • endpoint: string (e.g., ‘/v1/messages’)
  • body: object

sends a log message to the Sandbox Dashboard UI. Use this instead of console.log to ensure the user sees the output in the app.

Parameters:

  • level: ‘info’ | ‘warn’ | ‘error’ | ‘success’
  • message: string