Web3RequestBuilder.h

class FWeb3BaseRequest

This class is an abstract base class meant to be inherited by different types of external calls and its abstract BuildRequest member function overridden.

Subclassed by FWeb3ExternalRPCRequest, FWeb3RPCRequest, FWeb3SendContractRequest

Public Functions

virtual ~FWeb3BaseRequest() = default
inline void ExecuteRequest()

Makes the external call to HyperPlay’s http server or another rpc provider.

Public Members

int32 ChainID

The chain id to send with the HyperPlay http request, if applicable

FString ChainMetadataVar

The chain metadata so the chain can be added to the users wallet if it is not already added. Only applicable for HyperPlay http request calls.

FHttpRequestCompleteDelegate OnCompleteDelegate

The callback to be called after the http request completes

Protected Types

typedef TJsonWriterFactory<TCHAR, TCondensedJsonPrintPolicy<TCHAR>> FCondensedJsonStringWriterFactory
typedef TJsonWriter<TCHAR, TCondensedJsonPrintPolicy<TCHAR>> FCondensedJsonStringWriter

Protected Functions

void InitializeRequest()
virtual void BuildRequest() = 0

Override BuildRequest function in child class to create custom external http calls

void FinalizeRequest() const

Protected Attributes

FString RequestUrl
TSharedPtr<FJsonObject> RequestObject
TSharedPtr<FJsonObject> ChainObject
FString HttpContentString
FHttpRequestPtr Request
class FWeb3RPCRequest : public FWeb3BaseRequest

This is a child class of FWeb3BaseRequest that overrides BuildRequest to make calls to the /rpc endpoint of the local HyperPlay http server

Public Members

FString Request

The json rpc request to make, as a string

class FWeb3ExternalRPCRequest : public FWeb3BaseRequest

This is a child class of FWeb3BaseRequest that overrides BuildRequest to make json-rpc calls to an external rpc provider

Public Members

FString Url

The url of the external rpc provider

FString RequestString

The json rpc request to make, as a string

class FWeb3SendContractRequest : public FWeb3BaseRequest

Subclassed by FWeb3CallContractRequest

Public Members

FString ContractAddressVar

Contract address

FString FunctionNameVar

Function name to call send on

FString ABIVar

Contract ABI, as a string

FString ValueInWeiVar

Value in wei to send with the request. int64 is not big enough so we store it as FString

TArray<FString> ParamsVar

Array of string params. uint32 and struct params are parsed from their string values on the http server

int32 GasLimitVar

Gas limit for the transaction

class FWeb3CallContractRequest : public FWeb3SendContractRequest

FWeb3CallContractRequest is a child class of FWeb3SendContractRequest that overrides BuildRequest to make calls to the /callContract endpoint of the local HyperPlay http server. It has the same interface as FWeb3SendContractRequest.