Stellar PHP SDK API Documentation

SorobanContractParser

Parser for extracting metadata from Soroban contract WASM bytecode

This utility class parses compiled Soroban contract WASM bytecode to extract embedded metadata following the custom sections format defined in SEP-47 and SEP-48. The parser extracts:

  • Environment Meta: Soroban interface version requirements
  • Contract Spec: Function signatures, types, and events (SEP-48)
  • Contract Meta: Custom metadata key-value pairs (SEP-47)

The extracted metadata enables type-safe contract interaction and introspection without executing the contract code.

Tags
see
https://developers.stellar.org/docs/tools/sdks/build-your-own

SDK Building Guide

see
https://github.com/stellar/stellar-protocol/blob/master/ecosystem/sep-0047.md

SEP-47: Contract Metadata

see
https://github.com/stellar/stellar-protocol/blob/master/ecosystem/sep-0048.md

SEP-48: Contract Spec

since
1.0.0

Table of Contents

Methods

parseContractByteCode()  : SorobanContractInfo
Parses contract WASM bytecode to extract all metadata

Methods

parseContractByteCode()

Parses contract WASM bytecode to extract all metadata

public static parseContractByteCode(string $byteCode) : SorobanContractInfo

Extracts environment meta, contract spec entries, and custom metadata from the contract's WASM bytecode custom sections. All metadata must be present for successful parsing.

Parameters
$byteCode : string

The compiled WASM bytecode of the contract

Tags
throws
SorobanContractParserException

If bytecode is invalid or required metadata is missing

Return values
SorobanContractInfo

Container object with all parsed metadata


        
On this page

Search results