> ## Documentation Index
> Fetch the complete documentation index at: https://docs.lasersell.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Registro de wallets

> Registra wallets para el Exit Intelligence Stream usando prueba de propiedad Ed25519.

## Resumen

El registro de wallets demuestra la propiedad de una wallet de Solana ante LaserSell API. El registro es obligatorio antes de conectar wallets al Exit Intelligence Stream. El stream valida que cada wallet en tu mensaje `configure` esté registrada en tu cuenta.

El registro usa firmas Ed25519, por lo que no se necesita ninguna transacción en cadena.

## `POST /v1/wallets/register`

Registra una wallet demostrando la propiedad con una firma Ed25519.

### Solicitud

```json theme={null}
{
  "wallet_pubkey": "YourWalletPubkey...",
  "signature": "base58-encoded-ed25519-signature",
  "message": "lasersell-register:YourWalletPubkey...:1706000000",
  "label": "My Trading Wallet"
}
```

| Campo           | Tipo     | Requerido | Descripción                                                                                                              |
| --------------- | -------- | --------- | ------------------------------------------------------------------------------------------------------------------------ |
| `wallet_pubkey` | `string` | Sí        | Clave pública de la wallet de Solana a registrar.                                                                        |
| `signature`     | `string` | Sí        | Firma Ed25519 del mensaje, codificada en base58.                                                                         |
| `message`       | `string` | Sí        | Mensaje estructurado: `lasersell-register:<pubkey>:<unix_timestamp>`. La marca de tiempo debe estar dentro de 5 minutos. |
| `label`         | `string` | No        | Etiqueta opcional legible para la wallet.                                                                                |

### Respuesta

```json theme={null}
{
  "wallet_pubkey": "YourWalletPubkey...",
  "registered": true
}
```

### Autenticación

Requiere un encabezado `x-api-key` con una clave API válida.

### Errores

| Estado | Código      | Descripción                                                                                |
| ------ | ----------- | ------------------------------------------------------------------------------------------ |
| 400    | Bad Request | Formato de clave pública inválido, mensaje malformado o marca de tiempo expirada (>5 min). |
| 403    | Forbidden   | Clave API faltante o inválida, o verificación de firma fallida.                            |

## `DELETE /v1/wallets`

Desregistra una wallet.

### Solicitud

```json theme={null}
{
  "wallet_pubkey": "YourWalletPubkey..."
}
```

### Respuesta

```json theme={null}
{
  "wallet_pubkey": "YourWalletPubkey...",
  "removed": true
}
```

## Uso del SDK

Los 4 SDKs proporcionan métodos auxiliares para el registro de wallets.

### `proveOwnership` / `prove_ownership`

Genera un `WalletProof` localmente usando tu par de claves. Esta es una operación criptográfica pura sin llamada de red.

<CodeGroup>
  ```typescript TypeScript theme={null}
  import { proveOwnership } from "@lasersell/lasersell-sdk";

  const proof = proveOwnership(keypair);
  // proof = { walletPubkey, signature, message }
  ```

  ```python Python theme={null}
  from lasersell_sdk.exit_api import prove_ownership

  proof = prove_ownership(keypair)
  # proof = WalletProof(wallet_pubkey, signature, message)
  ```

  ```rust Rust theme={null}
  use lasersell_sdk::exit_api::prove_ownership;

  let proof = prove_ownership(&keypair);
  // proof = WalletProof { wallet_pubkey, signature, message }
  ```

  ```go Go theme={null}
  proof := lasersell.ProveOwnership(privateKey)
  // proof = WalletProof{WalletPubkey, Signature, Message}
  ```
</CodeGroup>

### `registerWallet` / `register_wallet`

Envía la prueba a la API para registrar la wallet.

<CodeGroup>
  ```typescript TypeScript theme={null}
  const client = ExitApiClient.withApiKey(apiKey);
  await client.registerWallet(proof, "My Wallet");
  ```

  ```python Python theme={null}
  client = ExitApiClient.with_api_key(api_key)
  await client.register_wallet(proof, label="My Wallet")
  ```

  ```rust Rust theme={null}
  client.register_wallet(&proof, Some("My Wallet")).await?;
  ```

  ```go Go theme={null}
  client.RegisterWallet(ctx, proof, lasersell.Ptr("My Wallet"))
  ```
</CodeGroup>

### `connectWithWallets` / `connect_with_wallets`

Método de conveniencia que registra wallets y se conecta al stream en un solo paso.

<CodeGroup>
  ```typescript TypeScript theme={null}
  import { StreamClient, proveOwnership } from "@lasersell/lasersell-sdk";

  const proof = proveOwnership(keypair);
  const client = new StreamClient(apiKey);
  const session = await client.connectWithWallets(
    [proof],
    { target_profit_pct: 50, stop_loss_pct: 10 },
    120, // deadline_timeout_sec
  );
  ```

  ```python Python theme={null}
  from lasersell_sdk.exit_api import prove_ownership
  from lasersell_sdk.stream.client import StreamClient

  proof = prove_ownership(keypair)
  client = StreamClient(api_key)
  session = await client.connect_with_wallets(
      [proof],
      {"target_profit_pct": 50, "stop_loss_pct": 10},
      deadline_timeout_sec=120,
  )
  ```

  ```rust Rust theme={null}
  let proof = prove_ownership(&keypair);
  let client = StreamClient::new(api_key);
  let session = client.connect_with_wallets(
      &[proof],
      strategy,
      120,
  ).await?;
  ```

  ```go Go theme={null}
  // Go SDK: register separately, then connect
  proof := lasersell.ProveOwnership(privateKey)
  client.RegisterWallet(ctx, proof, nil)
  session, _ := stream.ConnectSession(ctx, streamClient, configure)
  ```
</CodeGroup>
