Skip to main content

Non-Unity Quickstart

Use this quickstart to validate an OGAL asset account and pull its metadata without Unity tooling.

1) Identify an OGAL asset account address​

You need the asset account public key that represents the OGAL asset you want to load. Common sources:

  • Your backend/indexer storage
  • A link or QR flow that provides an asset address
  • A prior on-chain lookup using OGAL program-derived addresses

2) Fetch and decode the account using RPC​

Query the Solana RPC for the raw account data and decode it with your client model of the OGAL account layout (see the OGAL Program Reference for account layouts).

  • RPC method: getAccountInfo (or getMultipleAccounts for batching)
  • Decode the returned data bytes into your OGAL asset struct
// Pseudocode: read raw account data and decode
const accountInfo = await connection.getAccountInfo(assetPubkey);
if (!accountInfo?.data) throw new Error("Missing account data");

const assetAccount = decodeOgalAssetAccount(accountInfo.data);

Minimal field map of required values used in steps 2–4:

const fieldMap = {
owner: accountInfo.owner.toBase58(), // OGAL program ID
isMutable: assetAccount.isMutable,
metadataUri: assetAccount.metadataUri,
};

3) Verify owner and mutability fields​

Before using the data, verify it belongs to the OGAL program and that mutability matches your expectations.

  • Owner check: accountInfo.owner should equal the OGAL program ID
  • Mutability check: confirm the account flags (mutable/immutable) align with your security model
  • Program ID & namespace: validate the OGAL program ID and canonical namespace against the Protocol Identity table in OGAL Integration before trusting the account.
if (!accountInfo.owner.equals(OGAL_PROGRAM_ID)) {
throw new Error("Account is not owned by OGAL program");
}

if (!assetAccount.isMutable) {
// Treat as immutable or refuse updates depending on your pipeline
}

4) Resolve metadata URI and load content​

Use the decoded account fields to locate the metadata URI, then fetch and parse it.

  • Resolve the URI from the account (e.g., metadataUri or similar field)
  • Fetch JSON metadata
  • Load referenced media (images, models, etc.)
const metadataResponse = await fetch(assetAccount.metadataUri);
const metadata = await metadataResponse.json();

const previewImage = metadata.image;
const contentUri = metadata.properties?.content_uri;

Next steps​