SorobanAuthorizedFunction
in package
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
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
$contractFn
public
XdrInvokeContractArgs|null
$contractFn
= null
contract function invocation arguments if this is a contract call
$createContractHostFn
public
XdrCreateContractArgs|null
$createContractHostFn
= null
contract creation arguments if this is a contract deployment
$createContractV2HostFn
public
XdrCreateContractArgsV2|null
$createContractV2HostFn
= null
contract creation with constructor arguments
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
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
forCreateContractFunction()
Creates an authorized function for contract creation.
public
static forCreateContractFunction(XdrCreateContractArgs $createContractHostFn) : SorobanAuthorizedFunction
Parameters
- $createContractHostFn : XdrCreateContractArgs
-
the contract creation arguments
Return values
SorobanAuthorizedFunction —the authorized function for contract creation
forCreateContractWithConstructorFunction()
Creates an authorized function for contract creation with constructor.
public
static forCreateContractWithConstructorFunction(XdrCreateContractArgsV2 $createContractV2HostFn) : SorobanAuthorizedFunction
Parameters
- $createContractV2HostFn : XdrCreateContractArgsV2
-
the contract creation with constructor arguments
Return values
SorobanAuthorizedFunction —the authorized function for contract creation with constructor
fromXdr()
Creates SorobanAuthorizedFunction from its XDR representation.
public
static fromXdr(XdrSorobanAuthorizedFunction $xdr) : SorobanAuthorizedFunction
Parameters
- $xdr : XdrSorobanAuthorizedFunction
-
the XDR object to decode
Return values
SorobanAuthorizedFunction —the decoded authorized function
getContractFn()
Returns the contract invocation arguments if this is a contract call.
public
getContractFn() : XdrInvokeContractArgs|null
Return values
XdrInvokeContractArgs|null —the invocation arguments or null if not a contract call
getCreateContractHostFn()
Returns the contract creation arguments if this is a contract deployment.
public
getCreateContractHostFn() : XdrCreateContractArgs|null
Return values
XdrCreateContractArgs|null —the creation arguments or null if not a deployment
getCreateContractV2HostFn()
Returns the contract creation with constructor arguments.
public
getCreateContractV2HostFn() : XdrCreateContractArgsV2|null
Return values
XdrCreateContractArgsV2|null —the creation arguments or null if not a V2 deployment
setContractFn()
Sets the contract invocation arguments.
public
setContractFn(XdrInvokeContractArgs|null $contractFn) : void
Parameters
- $contractFn : XdrInvokeContractArgs|null
-
the invocation arguments
setCreateContractHostFn()
Sets the contract creation arguments.
public
setCreateContractHostFn(XdrCreateContractArgs|null $createContractHostFn) : void
Parameters
- $createContractHostFn : XdrCreateContractArgs|null
-
the creation arguments
setCreateContractV2HostFn()
Sets the contract creation with constructor arguments.
public
setCreateContractV2HostFn(XdrCreateContractArgsV2|null $createContractV2HostFn) : void
Parameters
- $createContractV2HostFn : XdrCreateContractArgsV2|null
-
the creation arguments
toXdr()
Converts this object to its XDR representation.
public
toXdr() : XdrSorobanAuthorizedFunction
Return values
XdrSorobanAuthorizedFunction —the XDR encoded authorized function