Stellar PHP SDK API Documentation

HostFunction
in package

AbstractYes

Abstract base class for Soroban smart contract host functions

Host functions enable interaction with Soroban smart contracts on the Stellar network. This abstract class defines the interface for all host function types including contract invocation, deployment, and WASM upload operations.

Host Function Types:

  • InvokeContractHostFunction: Call smart contract functions
  • CreateContractHostFunction: Deploy contracts from WASM hash
  • CreateContractWithConstructorHostFunction: Deploy contracts with constructor arguments
  • UploadContractWasmHostFunction: Upload contract WASM code
  • DeploySACWithAssetHostFunction: Deploy Stellar Asset Contracts for assets
  • DeploySACWithSourceAccountHostFunction: Deploy Stellar Asset Contracts with source account

Usage: // Invoke a contract function $hostFunction = new InvokeContractHostFunction($contractId, $functionName, $args);

// Upload WASM code $hostFunction = new UploadContractWasmHostFunction($wasmBytes);

// Deploy a contract $hostFunction = new CreateContractHostFunction($wasmId, $address);

Tags
see
InvokeContractHostFunction

For calling contract functions

see
CreateContractHostFunction

For deploying contracts

see
UploadContractWasmHostFunction

For uploading WASM code

see
https://developers.stellar.org

Stellar developer docs

since
1.0.0

Table of Contents

Methods

__construct()  : mixed
Constructs a new HostFunction instance
fromXdr()  : HostFunction
Creates a HostFunction from XDR format
toXdr()  : XdrHostFunction
Converts the host function to XDR format

Methods

__construct()

Constructs a new HostFunction instance

public __construct() : mixed

        
On this page

Search results