> ## Documentation Index
> Fetch the complete documentation index at: https://algorand-54fd52b3.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# TypeScript

> moltworld-sdk for Node.js 20 and browser-backed EVM wallets.

```bash theme={null}
npm install moltworld-sdk
```

For the current WIF deployment, provide an EIP-1193/viem-compatible EVM signer and use the chat method. Browser users can connect an injected wallet or WalletConnect when a public Reown project ID is configured; mobile browsers need that project ID. The client pays the 402 challenge through x402 `ExactEvmScheme`, checks the quote and WIF rail before signing, and verifies the receipt.

## Create a Robinhood client

```ts theme={null}
import { MoltworldClient } from "moltworld-sdk";

const client = new MoltworldClient({
  baseUrl: "https://moltworldd.vercel.app",
  evmSigner, // backed by an injected EIP-1193 wallet or controlled EVM signer
  maxPerRequestUsd: 0.25,
  budgetUsd: 5,
});

const result = await client.chat("gpt-4o", {
  messages: [{ role: "user", content: "Hi" }],
  max_tokens: 200,
});

console.log(result.data.choices[0].message.content);
console.log(result.receipt?.amountAtomic, result.receipt?.assetSymbol);
```

Configure the wallet on Robinhood Chain mainnet (`eip155:4663`). WIF is an 18-decimal ERC-20. The SDK reads the gateway's advertised network, asset, recipient, and price before signing. If Permit2 needs an allowance, arrange the exact approval separately; the SDK does not broadcast an unlimited approval.

## Current Robinhood scope

Owner-funded WIF mandates support live agent payments through local MCP and the TypeScript SDK. Approved marketplace APIs support WIF checkout when enabled. Creator payouts use merchant-authorized transfers and on-chain verification. Media and automatic WIF refunds remain unavailable; the mandate contract is unaudited.

## Free calls

```ts theme={null}
await client.models("chat");
await client.quote("gpt-4o", body);
await client.receipt(requestId);
client.spentUsd;
```

The quote is free and does not sign or pay. The signed 402 challenge is authoritative for the exact WIF amount.

## Result fields

| Field | Meaning |
| - | - |
| `data` | Parsed response body |
| `requestId` | Request id |
| `receipt` | Decoded signed receipt; WIF amount is in `amountAtomic` |
| `verification` | Receipt and request/response hash checks |
| `paidMicro` | USD quote value used for budget accounting |
| `replayed` | `true` when the response was replayed for an earlier payment |

> **Legacy Algorand options:** `mnemonic`, `privateKeyBase64`, AVM signers, mandates, media methods, and USDC fields remain for isolated Algorand deployments only. They cannot be used to pay the Robinhood WIF rail.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.