Build
Skip to content

Managing Session

Example RegisterSession

Used to register a session (done automatically for you by UAuthenticator)

    const TFunction<void(FCredentials_BE)> OnSuccess = [=](FCredentials_BE Response)
    {
        //Successful registration
    };
	const FFailureCallback OnFailure = [=](const FSequenceError& Error)
	{
		UE_LOG(LogTemp,Display,TEXT("Error Message: %s"),*Error.Message);
    };
    const TOptional<USequenceWallet*> WalletOptional = USequenceWallet::Get();
    if (WalletOptional.IsSet() && WalletOptional.GetValue())
    {
	   USequenceWallet * Api = WalletOptional.GetValue();
	   Api->RegisterSession(OnSuccess,OnFailure);
    }

Example ListSessions

Lists the active sessions

    const TSuccessCallback<TArray<FSession>> OnSuccess = [=](TArray<FSession> Response)
    {
       //Response is a list of Sessions
    };
	const FFailureCallback OnFailure = [=](const FSequenceError& Error)
	{
		UE_LOG(LogTemp,Display,TEXT("Error Message: %s"),*Error.Message);
    };
    const TOptional<USequenceWallet*> WalletOptional = USequenceWallet::Get();
    if (WalletOptional.IsSet() && WalletOptional.GetValue())
    {
	   USequenceWallet * Api = WalletOptional.GetValue();
       Api->ListSessions(OnSuccess,OnFailure);
    }

Example SignOut

Closes the session

    const TOptional<USequenceWallet*> WalletOptional = USequenceWallet::Get();
    if (WalletOptional.IsSet() && WalletOptional.GetValue())
    {
	   USequenceWallet * Api = WalletOptional.GetValue();
	   Api->SignOut();
    }

Example GetWalletAddress

Gets the wallet address currently being used

    const TOptional<USequenceWallet*> WalletOptional = USequenceWallet::Get();
    if (WalletOptional.IsSet() && WalletOptional.GetValue())
    {
	   USequenceWallet * Api = WalletOptional.GetValue();
       Api->GetWalletAddress();
    }

Example GetNetworkId

Gets the network id being used

    const TOptional<USequenceWallet*> WalletOptional = USequenceWallet::Get();
    if (WalletOptional.IsSet() && WalletOptional.GetValue())
    {
       USequenceWallet * Api = WalletOptional.GetValue();
       Api->GetNetworkId();
    }

Example UpdateNetworkId

Used to update the stored network id

    const TOptional<USequenceWallet*> WalletOptional = USequenceWallet::Get();
    if (WalletOptional.IsSet() && WalletOptional.GetValue())
    {
       USequenceWallet * Api = WalletOptional.GetValue();
       Api->UpdateNetworkId(137);
    }

Example UpdateProviderUrl

    const TOptional<USequenceWallet*> WalletOptional = USequenceWallet::Get();
    if (WalletOptional.IsSet() && WalletOptional.GetValue())
    {
       USequenceWallet * Api = WalletOptional.GetValue();
	   Api->UpdateProviderURL("NewProviderUrl");
    }

Example SignOut

Closes the session & clears out cached credentials with blank ones

    const TOptional<USequenceWallet*> WalletOptional = USequenceWallet::Get();
    if (WalletOptional.IsSet() && WalletOptional.GetValue())
    {
	   USequenceWallet * Api = WalletOptional.GetValue();
       Api->SignOut();
    }