For the complete documentation index, see llms.txt. This page is also available as Markdown.

Helpers

Some important helpers that we'll need.

Valid Wallet

In order to know if the Stellar Wallet is valid, we've created a custom function.

export const isValidWallet = (wallet: string) => {
  // Verify that the wallet is 56 characters long and starts with 'G'
  if (wallet.length !== 56 || wallet[0] !== "G") {
    return false;
  }

  // Verify that the wallet is a valid base32 string
  const base32Regex = /^[A-Z2-7]+$/;
  if (!base32Regex.test(wallet)) {
    return false;
  }

  return true;
};

Build Escrow from Response

The Initialize Escrow function returns the initialized escrow, but we need to structure it properly to store it correctly in the context.