DeploySACWithSourceAccountHostFunction
extends HostFunction
in package
Represents a Soroban host function for deploying a Stellar Asset Contract from a source account
This host function deploys a Stellar Asset Contract (SAC) for the native asset (XLM) controlled by a specific source account. Unlike DeploySACWithAssetHostFunction which deploys for existing Stellar assets, this variant creates a SAC tied to an account's identity.
The deployment uses:
- A source account address (the account that controls the asset)
- A salt value for deterministic address generation
This is useful for creating wrapped native asset contracts where the issuing account wants control over the SAC deployment.
Usage:
// Deploy SAC with source account
$address = Address::fromAccountId("GABC...");
$hostFunction = new DeploySACWithSourceAccountHostFunction($address);
// Deploy with specific salt for reproducibility $hostFunction = new DeploySACWithSourceAccountHostFunction($address, $salt);
// Use in an InvokeHostFunctionOperation $operation = (new InvokeHostFunctionOperationBuilder($hostFunction))->build();
Tags
Table of Contents
Properties
Methods
- __construct() : mixed
- Constructs a new DeploySACWithSourceAccountHostFunction
- fromXdr() : DeploySACWithSourceAccountHostFunction
- Creates a DeploySACWithSourceAccountHostFunction from XDR format
- getAddress() : Address
- Gets the source account address
- getSalt() : string
- Gets the salt value
- setAddress() : void
- Sets the source account address
- setSalt() : void
- Sets the salt value
- toXdr() : XdrHostFunction
- Converts the deploy SAC host function to XDR format
Properties
$address
public
Address
$address
The source account address
$salt
public
string
$salt
The salt value for contract address generation
Methods
__construct()
Constructs a new DeploySACWithSourceAccountHostFunction
public
__construct(Address $address[, string|null $salt = null ]) : mixed
Parameters
- $address : Address
-
The source account address
- $salt : string|null = null
-
Optional salt (32 random bytes generated if not provided)
Tags
fromXdr()
Creates a DeploySACWithSourceAccountHostFunction from XDR format
public
static fromXdr(XdrHostFunction $xdr) : DeploySACWithSourceAccountHostFunction
Parameters
- $xdr : XdrHostFunction
-
The XDR host function
Tags
Return values
DeploySACWithSourceAccountHostFunction —The decoded host function
getAddress()
Gets the source account address
public
getAddress() : Address
Return values
Address —The source account address
getSalt()
Gets the salt value
public
getSalt() : string
Return values
string —The salt value for contract address generation
setAddress()
Sets the source account address
public
setAddress(Address $address) : void
Parameters
- $address : Address
-
The source account address
setSalt()
Sets the salt value
public
setSalt(string $salt) : void
Parameters
- $salt : string
-
The salt value for contract address generation
toXdr()
Converts the deploy SAC host function to XDR format
public
toXdr() : XdrHostFunction
Return values
XdrHostFunction —The XDR host function