InvokeHostFunctionOperation
public class InvokeHostFunctionOperation : Operation, @unchecked Sendable
Invokes Soroban host functions for smart contract deployment, creation, and invocation operations.
-
The host function to invoke.
Declaration
Swift
public let hostFunction: HostFunctionXDR -
The authorizations required to execute the host function.
Declaration
Swift
public var auth: [SorobanAuthorizationEntryXDR] { get set } -
Creates a new invoke host function operation with specified parameters.
Declaration
Swift
public init(hostFunction: HostFunctionXDR, auth: [SorobanAuthorizationEntryXDR] = [], sourceAccountId: String? = nil) -
Creates an operation to invoke a function on a deployed smart contract.
Declaration
Swift
public static func forInvokingContract(contractId: String, functionName: String, functionArguments: [SCValXDR] = [], sourceAccountId: String? = nil, auth: [SorobanAuthorizationEntryXDR]? = nil) throws -> InvokeHostFunctionOperation -
Creates an operation to upload Wasm bytecode for contract deployment.
Declaration
Swift
public static func forUploadingContractWasm(contractCode: Data, sourceAccountId: String? = nil) throws -> InvokeHostFunctionOperation -
Creates an operation to instantiate a contract from uploaded Wasm using contract ID preimage.
Declaration
Swift
public static func forCreatingContract(wasmId: String, address: SCAddressXDR, salt: WrappedData32? = nil, sourceAccountId: String? = nil) throws -> InvokeHostFunctionOperation -
Creates an operation to instantiate a contract with constructor arguments (protocol >= 22).
Declaration
Swift
public static func forCreatingContractWithConstructor(wasmId: String, address: SCAddressXDR, constructorArguments: [SCValXDR] = [], salt: WrappedData32? = nil, sourceAccountId: String? = nil) throws -> InvokeHostFunctionOperation -
Creates an operation to deploy a Stellar Asset Contract for a specific asset.
Declaration
Swift
public static func forDeploySACWithAsset(asset: Asset, sourceAccountId: String? = nil) throws -> InvokeHostFunctionOperation -
Creates a new InvokeHostFunctionOperation object from the given InvokeHostFunctionOpXDR object.
Declaration
Swift
public init(fromXDR: InvokeHostFunctionOpXDR, sourceAccountId: String?) throwsParameters
fromXDRthe InvokeHostFunctionOpXDR object to be used to create a new InvokeHostFunctionOperation object.
sourceAccountId(optional) source account Id, must be valid, otherwise it will be ignored.
View on GitHub
Install in Dash