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

Auction Actions

The auction system provides several Redux actions for managing bids.

The stakeAuctionBid action handles placing new bids:

// src/oada/actions.ts
// Async thunk for placing bids in the stake auction
export const stakeAuctionBid = createAsyncThunk<
  BasicResponse<string>,
  StakeAuctionBidRequest,
  {
    dispatch: AppDispatch;
    state: RootState;
    extra: Services;
    rejectValue: FailResponse;
  }
>("stakeAuctionBid", async (request: StakeAuctionBidRequest, thunkApi) => {
  const wallet = thunkApi.getState().wallet.wallet!;
  const [utxos, changeAddress] = await getWalletUtxos(wallet);

  const ownerPkh = bech32AddressToPaymentPkh(changeAddress);
  const stakeAddress = addressToStakeAddress(changeAddress);

  if (stakeAddress === null) {
    return {
      tag: "Fail",
      contents: `Could not get stake address from ${changeAddress}`,
    };
  }

  const serverRequest = {
    ownerPkh,
    stakeAddressBech32: request.stakeAddressBech32,
    bidType: request.bidType,
    bidApy: BigInt(request.bidApy.toString()),
    bidValue: request.bidValue,
  };

  const requestOptions = {
    method: "POST",
    headers: {
      Accept: "application/json",
      "Content-Type": "application/json;charset=UTF-8",
    },
    body: Json.stringify(serverRequest),
  };

  const rawResponse = await fetch(
    `${oadaEndpointsUrl}/stake-auction-bid`,
    requestOptions
  );

  return await getRecipeBuildSendTx(utxos, changeAddress, rawResponse);
});

The cancelStakeAuctionBid action handles canceling existing bids:

Last updated