# Minting OADA

The minting feature allows users to convert ADA to OADA tokens at a 1:1 ratio. This is implemented through the `buyOada` action in the OADA protocol.

The `BuyOadaRequest` type defines the structure for minting requests:

```typescript
// src/oada/actions.ts
// Type definition for OADA minting requests
// Specifies the amount of ADA to convert to OADA tokens
type BuyOadaRequest = {
  amount: bigint;
};
```

The `buyOada` action handles the minting process:

```typescript
// src/oada/actions.ts
// Async thunk for minting OADA tokens from ADA
// Handles the complete minting process including transaction creation, signing, and submission
export const buyOada = createAsyncThunk<
  BasicResponse<string>,
  BuyOadaRequest,
  {
    dispatch: AppDispatch;
    state: RootState;
    extra: Services;
    rejectValue: FailResponse;
  }
>("buyOada", async (request: BuyOadaRequest, thunkApi) => {
  // Implementation details for minting OADA tokens
  const requestOptions = {
    method: "POST",
    headers: {
      Accept: "application/json",
      "Content-Type": "application/json;charset=UTF-8",
    },
    body: Json.stringify(request),
  };

  const rawResponse = await fetch(
    `${oadaEndpointsUrl}/buy-oada`,
    requestOptions
  );

  const wallet = thunkApi.getState().wallet.wallet!;
  const [utxos, changeAddress] = await getWalletUtxos(wallet);

  const addFee = (recipe: TxRecipe) => {
    oadaFeeAddress &&
      oadaMintFee &&
      recipe.txOuts.push({
        address: oadaFeeAddress,
        value: { lovelace: oadaMintFee },
        datum: null,
        refScript: null,
      });
    return recipe;
  };
  const signedTxResponse = await getRecipeBuildSendTx(
    utxos,
    changeAddress,
    rawResponse,
    addFee
  );

  return signedTxResponse;
});
```

## Key features of the minting process:

* 1:1 conversion ratio from ADA to OADA
* Transaction fee handling
* UTxO management for Cardano blockchain
* Secure transaction signing and submission
