> For the complete documentation index, see [llms.txt](https://docs.trustlesswork.com/trustless-work/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.trustlesswork.com/trustless-work/v1-es/dapps-oss/escrow-lab/ayudantes.md).

# Ayudantes

## Monedero válido

Para saber si el Monedero Stellar es válido, hemos creado una función personalizada.

```typescript
export const isValidWallet = (wallet: string) => {
  // Verificar que el monedero tenga 56 caracteres y comience con 'G'
  if (wallet.length !== 56 || wallet[0] !== "G") {
    return false;
  }

  // Verificar que el monedero sea una cadena base32 válida
  const base32Regex = /^[A-Z2-7]+$/;
  if (!base32Regex.test(wallet)) {
    return false;
  }

  return true;
};

```

## Construir Escrow desde la Respuesta

El `Inicializar Escrow` la función devuelve el escrow inicializado, pero necesitamos estructurarlo correctamente para almacenarlo adecuadamente en el contexto.

```typescript
import {
  InitializeEscrowResponse,
  UpdateEscrowResponse,
} from "@/@types/escrows/escrow-response.entity";
import { Escrow } from "@/@types/escrows/escrow.entity";

/**
 * Construye un objeto Escrow a partir de un InitializeEscrowResponse, esta estructura es
 * utilizada para crear un nuevo escrow basado en la entidad del Escrow
 */
export const buildEscrowFromResponse = (
  result: InitializeEscrowResponse | UpdateEscrowResponse,
  walletAddress: string
): Escrow => ({
  contractId: result.contractId,
  signer: walletAddress || "",
  engagementId: result.escrow.engagementId,
  title: result.escrow.title,
  description: result.escrow.description,
  amount: result.escrow.amount,
  platformFee: result.escrow.platformFee,
  receiverMemo: result.escrow.receiverMemo ?? 0,
  roles: {
    approver: result.escrow.roles.approver,
    serviceProvider: result.escrow.roles.serviceProvider,
    platformAddress: result.escrow.roles.platformAddress,
    releaseSigner: result.escrow.roles.releaseSigner,
    disputeResolver: result.escrow.roles.disputeResolver,
    receiver: result.escrow.roles.receiver,
  },
  flags: {
    disputeFlag: false,
    releaseFlag: false,
    resolvedFlag: false,
  },
  trustline: {
    address: result.escrow.trustline.address,
    decimals: result.escrow.trustline.decimals,
  },
  milestones: result.escrow.milestones.map((m) => ({
    description: m.description,
    status: "pending",
    evidence: "",
    approvedFlag: false,
  })),
});

```


---

# 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.trustlesswork.com/trustless-work/v1-es/dapps-oss/escrow-lab/ayudantes.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
