SorobanContractParser
in package
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
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
Return values
SorobanContractInfo —Container object with all parsed metadata