> For the complete documentation index, see [llms.txt](https://docs.spacy.computer/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.spacy.computer/readme.md).

# Introduction

React-first embedded wallet SDK with verifiable, attested signing.

`@spacy-computer/sdk` is the official client SDK for **Spacy** — an embedded wallet whose signing key lives in TEE-backed hardware (Intel TDX), whose coordinator attests itself (AMD SEV-SNP), and whose every transaction emits a verifiable receipt — pinned to IPFS, pointed to from chain, validatable by anyone without trusting Spacy.

The SDK gives you Privy-style UX (Google sign-in, hosted wallet, one-call transaction signing) on top of that trust model.

## What you get

* **`<SpacyProvider>`** — wraps your React tree, owns the session and the wallet state, redirects to Google for sign-in.
* **`useWallet()`** — current user, current wallet, `login()` / `logout()` / `refresh()`.
* **`useSign()`** — `signAndSend(req)` builds an EIP-1559 transaction in the browser, asks the Spacy backend (running inside a SEV-SNP TEE) to sign the digest with the user's KMS key, and broadcasts.
* **`useAttestation(slug)`** — polls the proof endpoint until the IPFS pin and the on-chain pointer settle, so you can render a proof page or surface the receipt link in your UI.
* **`SpacyClient`** — the imperative class behind the hooks, for non-React consumers or custom orchestration.

## Three lines to integrate

```tsx
import { SpacyProvider, useWallet, useSign } from '@spacy-computer/sdk'

<SpacyProvider config={{ apiBaseUrl: 'https://api.spacy.computer', chainId: 11155111 }}>
  <App />
</SpacyProvider>
```

```tsx
const { wallet, login } = useWallet()
const { signAndSend } = useSign()

await signAndSend({ to: '0x...', value: '0.01' })
```

That's the whole surface. The browser does no signing — it only constructs the unsigned transaction, asks the attested backend for a signature over the digest, splices it back in, and broadcasts.

## Where to go next

| If you want to...                           | Go to                                     |
| ------------------------------------------- | ----------------------------------------- |
| Install the SDK and render a sign-in button | [Getting started](/getting-started.md)    |
| Understand the request flow end-to-end      | [How it works](/how-it-works.md)          |
| See every prop, hook return, and type       | [Reference](/reference/spacy-provider.md) |
| Copy a working example                      | [Recipes](/recipes/sign-in.md)            |
| Catch and handle errors                     | [Errors](/notes/errors.md)                |

## Compatibility

| Requirement                     | Version                                                                                     |
| ------------------------------- | ------------------------------------------------------------------------------------------- |
| Latest published                | `0.0.1-alpha.0` (alpha — API may still shift)                                               |
| React (peer)                    | `^18.3.0` or `^19.0.0`                                                                      |
| `viem` (peer)                   | `^2.21.0`                                                                                   |
| Module formats                  | Dual ESM + CJS (`import` and `require` both work)                                           |
| TypeScript                      | First-class — `dist/index.d.ts` ships with the package                                      |
| Chains supported out of the box | Sepolia (`11155111`), Base Sepolia (`84532`); any EVM chain via custom `chainId` + `rpcUrl` |

## License

`@spacy-computer/sdk` is published under **AGPL-3.0** as part of the [Spacy monorepo](https://github.com/itublockchain/spacy). Deliberate, not default — embedded wallet trust models should be inspectable. If you fork the SDK and run a derived service, you publish your modifications.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.spacy.computer/readme.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
