Stellar PHP SDK API Documentation

SorobanAuthorizedFunction

Authorized function for Soroban invocations

This class represents one of three types of authorized operations in Soroban: contract function invocation, contract creation, or contract creation with constructor. Exactly one of the three function types must be set.

Tags
see
SorobanAuthorizedInvocation
see
https://developers.stellar.org/docs/learn/smart-contract-internals/authorization

Soroban Authorization

since
1.0.0

Table of Contents

Properties

$contractFn  : XdrInvokeContractArgs|null
$createContractHostFn  : XdrCreateContractArgs|null
$createContractV2HostFn  : XdrCreateContractArgsV2|null

Methods

__construct()  : mixed
Creates a new authorized function.
forContractFunction()  : SorobanAuthorizedFunction
Creates an authorized function for a contract invocation.
forCreateContractFunction()  : SorobanAuthorizedFunction
Creates an authorized function for contract creation.
forCreateContractWithConstructorFunction()  : SorobanAuthorizedFunction
Creates an authorized function for contract creation with constructor.
fromXdr()  : SorobanAuthorizedFunction
Creates SorobanAuthorizedFunction from its XDR representation.
getContractFn()  : XdrInvokeContractArgs|null
Returns the contract invocation arguments if this is a contract call.
getCreateContractHostFn()  : XdrCreateContractArgs|null
Returns the contract creation arguments if this is a contract deployment.
getCreateContractV2HostFn()  : XdrCreateContractArgsV2|null
Returns the contract creation with constructor arguments.
setContractFn()  : void
Sets the contract invocation arguments.
setCreateContractHostFn()  : void
Sets the contract creation arguments.
setCreateContractV2HostFn()  : void
Sets the contract creation with constructor arguments.
toXdr()  : XdrSorobanAuthorizedFunction
Converts this object to its XDR representation.

Properties

Methods

__construct()

Creates a new authorized function.

public __construct([XdrInvokeContractArgs|null $contractFn = null ][, XdrCreateContractArgs|null $createContractHostFn = null ][, XdrCreateContractArgsV2|null $createContractV2HostFn = null ]) : mixed
Parameters
$contractFn : XdrInvokeContractArgs|null = null

contract invocation arguments (mutually exclusive with other params)

$createContractHostFn : XdrCreateContractArgs|null = null

contract creation arguments (mutually exclusive with other params)

$createContractV2HostFn : XdrCreateContractArgsV2|null = null

contract creation with constructor (mutually exclusive with other params)

Tags
throws
InvalidArgumentException

if all parameters are null (at least one must be provided)

forContractFunction()

Creates an authorized function for a contract invocation.

public static forContractFunction(Address $contractAddress, string $functionName[, array<string|int, XdrSCVal$args = array() ]) : SorobanAuthorizedFunction
Parameters
$contractAddress : Address

the address of the contract to invoke

$functionName : string

the name of the function to call

$args : array<string|int, XdrSCVal> = array()

the function arguments

Return values
SorobanAuthorizedFunction

the authorized function for contract invocation


        
On this page

Search results