"use server";
import { AssembledTransaction } from "@stellar/stellar-sdk/contract";
import { fetchContractSpec } from "@sorokit/contract";
import { resolveSorokitConfig } from "@sorokit/core";
import { QueryClient } from "@tanstack/react-query";
export async function prepareMintAction(address: string) {
const config = resolveSorokitConfig({ network: "TESTNET" });
const queryClient = new QueryClient();
const spec = await fetchContractSpec("C...", config, queryClient);
const tx = await AssembledTransaction.build({
contractId: "C...",
method: "mint",
args: spec.funcArgsToScVals("mint", { to: address }),
networkPassphrase: config.networkPassphrase,
rpcUrl: config.rpcUrl,
});
return tx.toJson();
}