From 59d93a38af81d651fcc7cb5f7f8a9c6dfca01b60 Mon Sep 17 00:00:00 2001 From: CalvinKork Date: Mon, 23 Sep 2024 14:33:31 -0500 Subject: [PATCH 1/8] Fixing 2 naming collisions & poorly named assets, UAuthenticator is now USequenceAuthenticator & UWallet is now UCryptoWallet --- .../SequencePlugin/Private/GeneralTesting.cpp | 12 +-- .../Private/Native/NativeOAuth.cpp | 14 +-- .../Private/Native/NativeOAuth.h | 12 +-- .../Private/Sequence/SequenceAPI.cpp | 6 +- ...nticator.cpp => SequenceAuthenticator.cpp} | 94 +++++++++---------- .../Private/SequenceBackendManager.cpp | 2 +- .../Private/SequenceBackendManager.h | 4 +- .../Private/SequenceRPCManager.cpp | 12 +-- .../Private/SequenceRPCManager.h | 6 +- .../Private/Tests/TestSequenceAPI.cpp | 32 +++---- .../Types/{Wallet.cpp => CryptoWallet.cpp} | 42 ++++----- .../SequencePlugin/Public/Credentials.h | 6 +- .../Public/Sequence/SequenceAPI.h | 2 +- ...uthenticator.h => SequenceAuthenticator.h} | 6 +- .../SequencePlugin/Public/SqncSpecPawn.h | 2 +- .../Public/Types/{Wallet.h => CryptoWallet.h} | 12 +-- 16 files changed, 132 insertions(+), 132 deletions(-) rename Plugins/SequencePlugin/Source/SequencePlugin/Private/{Authenticator.cpp => SequenceAuthenticator.cpp} (84%) rename Plugins/SequencePlugin/Source/SequencePlugin/Private/Types/{Wallet.cpp => CryptoWallet.cpp} (83%) rename Plugins/SequencePlugin/Source/SequencePlugin/Public/{Authenticator.h => SequenceAuthenticator.h} (98%) rename Plugins/SequencePlugin/Source/SequencePlugin/Public/Types/{Wallet.h => CryptoWallet.h} (82%) diff --git a/Plugins/SequencePlugin/Source/SequencePlugin/Private/GeneralTesting.cpp b/Plugins/SequencePlugin/Source/SequencePlugin/Private/GeneralTesting.cpp index 55b30e324..8a96bbbdf 100644 --- a/Plugins/SequencePlugin/Source/SequencePlugin/Private/GeneralTesting.cpp +++ b/Plugins/SequencePlugin/Source/SequencePlugin/Private/GeneralTesting.cpp @@ -9,7 +9,7 @@ #include "SequenceEncryptor.h" #include "Sequence/SequenceAPI.h" #include "Tests/TestSequenceAPI.h" -#include "Authenticator.h" +#include "SequenceAuthenticator.h" // Sets default values AGeneralTesting::AGeneralTesting() @@ -216,7 +216,7 @@ void AGeneralTesting::TestLoadTransakUrl() const void AGeneralTesting::TestGuestLogin() { - UAuthenticator * Auth = NewObject(); + USequenceAuthenticator * Auth = NewObject(); Auth->GuestLogin(false); } @@ -248,7 +248,7 @@ void AGeneralTesting::TestTokenBalances() const UE_LOG(LogTemp, Display, TEXT("Error with getting balances")); }; - const UAuthenticator * Auth = NewObject(); + const USequenceAuthenticator * Auth = NewObject(); const TOptional WalletOptional = USequenceWallet::Get(Auth->GetStoredCredentials().GetCredentials()); if (WalletOptional.IsSet() && WalletOptional.GetValue()) { @@ -276,7 +276,7 @@ void AGeneralTesting::TestHistory() const UE_LOG(LogTemp, Display, TEXT("Error with getting history")); }; - const UAuthenticator * Auth = NewObject(); + const USequenceAuthenticator * Auth = NewObject(); const TOptional WalletOptional = USequenceWallet::Get(Auth->GetStoredCredentials().GetCredentials()); if (WalletOptional.IsSet() && WalletOptional.GetValue()) { @@ -292,7 +292,7 @@ void AGeneralTesting::TestHistory() const void AGeneralTesting::TestGetWalletAddress() const { - const UAuthenticator * Auth = NewObject(); + const USequenceAuthenticator * Auth = NewObject(); const TOptional WalletOptional = USequenceWallet::Get(Auth->GetStoredCredentials().GetCredentials()); if (WalletOptional.IsSet() && WalletOptional.GetValue()) { @@ -316,7 +316,7 @@ void AGeneralTesting::TestEncryption() const void AGeneralTesting::TestMisc() {//used for testing various things in the engine to verify behaviour - UAuthenticator * Authenticator = NewObject(); + USequenceAuthenticator * Authenticator = NewObject(); //Authenticator->PlayFabRegisterAndLogin(TEXT("TBPTest1"), TEXT("calvinvermeulen18@gmail.com"), TEXT("Ac-123Bd-456#!ef")); Authenticator->PlayFabLogin(TEXT("TBPTest1"), TEXT("Ac-123Bd-456#!ef"), false); //Authenticator->GuestLogin(false); diff --git a/Plugins/SequencePlugin/Source/SequencePlugin/Private/Native/NativeOAuth.cpp b/Plugins/SequencePlugin/Source/SequencePlugin/Private/Native/NativeOAuth.cpp index 9383059c2..7431fd3db 100644 --- a/Plugins/SequencePlugin/Source/SequencePlugin/Private/Native/NativeOAuth.cpp +++ b/Plugins/SequencePlugin/Source/SequencePlugin/Private/Native/NativeOAuth.cpp @@ -1,6 +1,6 @@ // Copyright 2024 Horizon Blockchain Games Inc. All rights reserved. #include "NativeOAuth.h" -#include "Authenticator.h" +#include "SequenceAuthenticator.h" #include "AppleBridge.h" #include "Async/TaskGraphInterfaces.h" #include "Async/Async.h" @@ -8,7 +8,7 @@ namespace NativeOAuth { - void RequestAuthWebView(const FString& requestUrl, const FString& redirectUrl, UAuthenticator * AuthCallback) + void RequestAuthWebView(const FString& requestUrl, const FString& redirectUrl, USequenceAuthenticator * AuthCallback) { Callback = AuthCallback; #if PLATFORM_ANDROID @@ -16,7 +16,7 @@ namespace NativeOAuth #endif } - void SignInWithGoogle(const FString& clientId, UAuthenticator * AuthCallback) + void SignInWithGoogle(const FString& clientId, USequenceAuthenticator * AuthCallback) { Callback = AuthCallback; #if PLATFORM_ANDROID @@ -24,7 +24,7 @@ namespace NativeOAuth #endif // PLATFORM_ANDROID } - void SignInWithGoogle_IOS(const FString& Url, const FString& Scheme, UAuthenticator * AuthCallback) + void SignInWithGoogle_IOS(const FString& Url, const FString& Scheme, USequenceAuthenticator * AuthCallback) { Callback = AuthCallback; UAppleBridge::InitiateGoogleSSO(Url,Scheme,ProcessIosTokenizedUrlCallback); @@ -33,7 +33,7 @@ namespace NativeOAuth void ProcessIosTokenizedUrlCallback(char * tokenizedUrl) { const FString token = FString(UTF8_TO_TCHAR(tokenizedUrl)); - UAuthenticator * CallbackLcl = Callback; + USequenceAuthenticator * CallbackLcl = Callback; AsyncTask(ENamedThreads::GameThread, [CallbackLcl,token]() { CallbackLcl->UpdateMobileLogin(token); }); @@ -42,13 +42,13 @@ namespace NativeOAuth void ProcessIosCallback(char * idToken) { const FString token = FString(UTF8_TO_TCHAR(idToken)); - UAuthenticator * CallbackLcl = Callback; + USequenceAuthenticator * CallbackLcl = Callback; AsyncTask(ENamedThreads::GameThread, [CallbackLcl,token]() { CallbackLcl->UpdateMobileLogin_IdToken(token); }); } - void SignInWithApple(const FString& clientID, UAuthenticator * AuthCallback) + void SignInWithApple(const FString& clientID, USequenceAuthenticator * AuthCallback) { Callback = AuthCallback; UAppleBridge::InitiateIosSSO(clientID, ProcessIosCallback); diff --git a/Plugins/SequencePlugin/Source/SequencePlugin/Private/Native/NativeOAuth.h b/Plugins/SequencePlugin/Source/SequencePlugin/Private/Native/NativeOAuth.h index 7917f1bc7..faabcfe4c 100644 --- a/Plugins/SequencePlugin/Source/SequencePlugin/Private/Native/NativeOAuth.h +++ b/Plugins/SequencePlugin/Source/SequencePlugin/Private/Native/NativeOAuth.h @@ -1,6 +1,6 @@ // Copyright 2024 Horizon Blockchain Games Inc. All rights reserved. #pragma once -#include "Authenticator.h" +#include "SequenceAuthenticator.h" #if PLATFORM_ANDROID #include "Android/AndroidJNI.h" @@ -14,11 +14,11 @@ namespace NativeOAuth void AndroidThunkCpp_RequestAuthInWebView(const FString& requestUrl, const FString& redirectUrl); void AndroidLog(const FString& message); #endif // PLATFORM_ANDROID - inline UAuthenticator * Callback = nullptr; - void SignInWithGoogle(const FString& clientId, UAuthenticator * AuthCallback); - void SignInWithGoogle_IOS(const FString& Url, const FString& RedirectUri, UAuthenticator * AuthCallback); - void RequestAuthWebView(const FString& requestUrl, const FString& redirectUrl, UAuthenticator * AuthCallback); - void SignInWithApple(const FString& clientID, UAuthenticator * AuthCallback); + inline USequenceAuthenticator * Callback = nullptr; + void SignInWithGoogle(const FString& clientId, USequenceAuthenticator * AuthCallback); + void SignInWithGoogle_IOS(const FString& Url, const FString& RedirectUri, USequenceAuthenticator * AuthCallback); + void RequestAuthWebView(const FString& requestUrl, const FString& redirectUrl, USequenceAuthenticator * AuthCallback); + void SignInWithApple(const FString& clientID, USequenceAuthenticator * AuthCallback); void ProcessIosTokenizedUrlCallback(char * tokenizedUrl); void ProcessIosCallback(char * idToken); } \ No newline at end of file diff --git a/Plugins/SequencePlugin/Source/SequencePlugin/Private/Sequence/SequenceAPI.cpp b/Plugins/SequencePlugin/Source/SequencePlugin/Private/Sequence/SequenceAPI.cpp index 5bde4ab35..0893ef02c 100644 --- a/Plugins/SequencePlugin/Source/SequencePlugin/Private/Sequence/SequenceAPI.cpp +++ b/Plugins/SequencePlugin/Source/SequencePlugin/Private/Sequence/SequenceAPI.cpp @@ -126,7 +126,7 @@ TOptional USequenceWallet::Get() else { UE_LOG(LogTemp,Warning,TEXT("Wallet is NOT registered and valid checking on disk credentials")); - const UAuthenticator * Auth = NewObject(); + const USequenceAuthenticator * Auth = NewObject(); FStoredCredentials_BE StoredCredentials = Auth->GetStoredCredentials(); if (StoredCredentials.GetValid()) @@ -254,7 +254,7 @@ void USequenceWallet::ListSessions(const TSuccessCallback(); + const USequenceAuthenticator * Auth = NewObject(); if (this->Credentials.IsRegistered()) { const TFunction OnSuccess = [Auth] @@ -309,7 +309,7 @@ int64 USequenceWallet::GetNetworkId() const void USequenceWallet::UpdateNetworkId(int64 NewNetwork) { this->Credentials.UpdateNetwork(NewNetwork); - const UAuthenticator * auth = NewObject(); + const USequenceAuthenticator * auth = NewObject(); auth->StoreCredentials(this->Credentials); } diff --git a/Plugins/SequencePlugin/Source/SequencePlugin/Private/Authenticator.cpp b/Plugins/SequencePlugin/Source/SequencePlugin/Private/SequenceAuthenticator.cpp similarity index 84% rename from Plugins/SequencePlugin/Source/SequencePlugin/Private/Authenticator.cpp rename to Plugins/SequencePlugin/Source/SequencePlugin/Private/SequenceAuthenticator.cpp index 8f1d697dd..f79892659 100644 --- a/Plugins/SequencePlugin/Source/SequencePlugin/Private/Authenticator.cpp +++ b/Plugins/SequencePlugin/Source/SequencePlugin/Private/SequenceAuthenticator.cpp @@ -1,6 +1,6 @@ // Copyright 2024 Horizon Blockchain Games Inc. All rights reserved. -#include "Authenticator.h" +#include "SequenceAuthenticator.h" #include "Misc/Guid.h" #include "Misc/Base64.h" #include "StorableCredentials.h" @@ -20,7 +20,7 @@ #include "PlayFabResponseIntent.h" #include "Sequence/SequenceAPI.h" -UAuthenticator::UAuthenticator() +USequenceAuthenticator::USequenceAuthenticator() { this->StateToken = FGuid::NewGuid().ToString(); this->SequenceRPCManager = USequenceRPCManager::Make(false); @@ -43,7 +43,7 @@ UAuthenticator::UAuthenticator() } } -void UAuthenticator::InitiateMobileSSO_Internal(const ESocialSigninType& Type) +void USequenceAuthenticator::InitiateMobileSSO_Internal(const ESocialSigninType& Type) { #if PLATFORM_ANDROID switch (Type) @@ -79,43 +79,43 @@ void UAuthenticator::InitiateMobileSSO_Internal(const ESocialSigninType& Type) #endif } -void UAuthenticator::SetIsForcing(const bool IsForcingIn) +void USequenceAuthenticator::SetIsForcing(const bool IsForcingIn) { this->IsForcing = IsForcingIn; } -void UAuthenticator::SetIsFederating(const bool IsFederatingIn) +void USequenceAuthenticator::SetIsFederating(const bool IsFederatingIn) { this->IsFederating = IsFederatingIn; } -void UAuthenticator::SetIsFederatingSessionInUse() +void USequenceAuthenticator::SetIsFederatingSessionInUse() { this->IsFederatingSessionInUse = true; } -bool UAuthenticator::ReadAndResetIsForcing() +bool USequenceAuthenticator::ReadAndResetIsForcing() { const bool Cached_Force_State = this->IsForcing; this->IsForcing = false; return Cached_Force_State; } -bool UAuthenticator::ReadAndResetIsFederating() +bool USequenceAuthenticator::ReadAndResetIsFederating() { const bool Cached_Federate_State = this->IsFederating; this->IsFederating = false; return Cached_Federate_State; } -bool UAuthenticator::ReadAndResetIsFederatingSessionInUse() +bool USequenceAuthenticator::ReadAndResetIsFederatingSessionInUse() { const bool Cached_FederateSessionInUse_State = this->IsFederatingSessionInUse; this->IsFederatingSessionInUse = false; return Cached_FederateSessionInUse_State; } -void UAuthenticator::CheckAndFederateSessionInUse() +void USequenceAuthenticator::CheckAndFederateSessionInUse() { if (this->ReadAndResetIsFederatingSessionInUse()) { @@ -143,12 +143,12 @@ void UAuthenticator::CheckAndFederateSessionInUse() } } -void UAuthenticator::ResetFederateSessionInUse() +void USequenceAuthenticator::ResetFederateSessionInUse() { this->IsFederatingSessionInUse = false; } -void UAuthenticator::SetCustomEncryptor(UGenericNativeEncryptor * EncryptorIn) +void USequenceAuthenticator::SetCustomEncryptor(UGenericNativeEncryptor * EncryptorIn) { this->Encryptor = EncryptorIn; if (this->Encryptor) @@ -162,13 +162,13 @@ void UAuthenticator::SetCustomEncryptor(UGenericNativeEncryptor * EncryptorIn) } } -void UAuthenticator::ClearStoredCredentials() const +void USequenceAuthenticator::ClearStoredCredentials() const { const FCredentials_BE BlankCredentials; this->StoreCredentials(BlankCredentials); } -void UAuthenticator::StoreCredentials(const FCredentials_BE& Credentials) const +void USequenceAuthenticator::StoreCredentials(const FCredentials_BE& Credentials) const { if (UStorableCredentials* StorableCredentials = Cast(UGameplayStatics::CreateSaveGameObject(UStorableCredentials::StaticClass()))) { @@ -193,7 +193,7 @@ void UAuthenticator::StoreCredentials(const FCredentials_BE& Credentials) const } } -FString UAuthenticator::BuildRedirectPrefix() const +FString USequenceAuthenticator::BuildRedirectPrefix() const { const FString Redirect = UConfigFetcher::GetConfigVar(UConfigFetcher::RedirectUrl); if (Redirect.EndsWith(TEXT("/"),ESearchCase::IgnoreCase)) @@ -202,7 +202,7 @@ FString UAuthenticator::BuildRedirectPrefix() const return Redirect + "/" + this->RedirectPrefixTrailer; } -bool UAuthenticator::GetStoredCredentials(FCredentials_BE* Credentials) const +bool USequenceAuthenticator::GetStoredCredentials(FCredentials_BE* Credentials) const { bool ret = false; if (const UStorableCredentials* LoadedCredentials = Cast(UGameplayStatics::LoadGameFromSlot(this->SaveSlot, this->UserIndex))) @@ -223,7 +223,7 @@ bool UAuthenticator::GetStoredCredentials(FCredentials_BE* Credentials) const return ret; } -void UAuthenticator::CallAuthRequiresCode() const +void USequenceAuthenticator::CallAuthRequiresCode() const { if (this->AuthRequiresCode.IsBound()) this->AuthRequiresCode.Broadcast(); @@ -231,7 +231,7 @@ void UAuthenticator::CallAuthRequiresCode() const UE_LOG(LogTemp, Error, TEXT("[System Failure: nothing bound to delegate: AuthRequiresCode]")); } -void UAuthenticator::CallAuthFailure(const FString& ErrorMessageIn) const +void USequenceAuthenticator::CallAuthFailure(const FString& ErrorMessageIn) const { if (this->AuthFailure.IsBound()) this->AuthFailure.Broadcast(ErrorMessageIn); @@ -239,7 +239,7 @@ void UAuthenticator::CallAuthFailure(const FString& ErrorMessageIn) const UE_LOG(LogTemp, Error, TEXT("[System Error: nothing bound to delegate: AuthFailure]")); } -void UAuthenticator::CallAuthSuccess() const +void USequenceAuthenticator::CallAuthSuccess() const { if (this->AuthSuccess.IsBound()) this->AuthSuccess.Broadcast(); @@ -247,7 +247,7 @@ void UAuthenticator::CallAuthSuccess() const UE_LOG(LogTemp, Error, TEXT("[System Error: nothing bound to delegate: AuthSuccess]")); } -void UAuthenticator::CallFederateSuccess() const +void USequenceAuthenticator::CallFederateSuccess() const { if (this->FederateSuccess.IsBound()) { @@ -259,7 +259,7 @@ void UAuthenticator::CallFederateSuccess() const } } -void UAuthenticator::CallFederateFailure(const FString& ErrorMessageIn) const +void USequenceAuthenticator::CallFederateFailure(const FString& ErrorMessageIn) const { if (this->FederateFailure.IsBound()) { @@ -271,7 +271,7 @@ void UAuthenticator::CallFederateFailure(const FString& ErrorMessageIn) const } } -void UAuthenticator::CallFederateOrForce(const FFederationSupportData& FederationData) const +void USequenceAuthenticator::CallFederateOrForce(const FFederationSupportData& FederationData) const { if (this->FederateOrForce.IsBound()) { @@ -283,7 +283,7 @@ void UAuthenticator::CallFederateOrForce(const FFederationSupportData& Federatio } } -void UAuthenticator::UpdateMobileLogin(const FString& TokenizedUrl) +void USequenceAuthenticator::UpdateMobileLogin(const FString& TokenizedUrl) { //we need to parse out the id_token out of TokenizedUrl TArray UrlParts; @@ -314,7 +314,7 @@ void UAuthenticator::UpdateMobileLogin(const FString& TokenizedUrl) }//parse out ? } -void UAuthenticator::UpdateMobileLogin_IdToken(const FString& IdTokenIn) +void USequenceAuthenticator::UpdateMobileLogin_IdToken(const FString& IdTokenIn) { if (this->ReadAndResetIsFederating()) { @@ -326,14 +326,14 @@ void UAuthenticator::UpdateMobileLogin_IdToken(const FString& IdTokenIn) } } -void UAuthenticator::InitiateMobileSSO(const ESocialSigninType& Type, const bool ForceCreateAccountIn) +void USequenceAuthenticator::InitiateMobileSSO(const ESocialSigninType& Type, const bool ForceCreateAccountIn) { this->SetIsForcing(ForceCreateAccountIn); this->SetIsFederating(false); this->InitiateMobileSSO_Internal(Type); } -FString UAuthenticator::GetSigninURL(const ESocialSigninType& Type) const +FString USequenceAuthenticator::GetSigninURL(const ESocialSigninType& Type) const { FString SigninURL = ""; @@ -362,7 +362,7 @@ FString UAuthenticator::GetSigninURL(const ESocialSigninType& Type) const return SigninURL; } -void UAuthenticator::SocialLogin(const FString& IDTokenIn, const bool ForceCreateAccountIn) +void USequenceAuthenticator::SocialLogin(const FString& IDTokenIn, const bool ForceCreateAccountIn) { if (ForceCreateAccountIn) { @@ -392,7 +392,7 @@ void UAuthenticator::SocialLogin(const FString& IDTokenIn, const bool ForceCreat this->SequenceRPCManager->OpenOIDCSession(IDTokenIn, ForceCreateAccountIn, OnSuccess, OnFailure, OnFederationRequired); } -void UAuthenticator::EmailLogin(const FString& EmailIn, const bool ForceCreateAccountIn) +void USequenceAuthenticator::EmailLogin(const FString& EmailIn, const bool ForceCreateAccountIn) { this->SetIsForcing(ForceCreateAccountIn); this->SetIsFederating(false); @@ -416,7 +416,7 @@ void UAuthenticator::EmailLogin(const FString& EmailIn, const bool ForceCreateAc this->SequenceRPCManager->InitEmailAuth(EmailIn.ToLower(),OnSuccess,OnFailure); } -void UAuthenticator::GuestLogin(const bool ForceCreateAccountIn) +void USequenceAuthenticator::GuestLogin(const bool ForceCreateAccountIn) { if (ForceCreateAccountIn) { @@ -437,7 +437,7 @@ void UAuthenticator::GuestLogin(const bool ForceCreateAccountIn) this->SequenceRPCManager->OpenGuestSession(ForceCreateAccountIn,OnSuccess,OnFailure); } -void UAuthenticator::PlayFabRegisterAndLogin(const FString& UsernameIn, const FString& EmailIn, const FString& PasswordIn, const bool ForceCreateAccountIn) +void USequenceAuthenticator::PlayFabRegisterAndLogin(const FString& UsernameIn, const FString& EmailIn, const FString& PasswordIn, const bool ForceCreateAccountIn) { if (ForceCreateAccountIn) { @@ -478,7 +478,7 @@ void UAuthenticator::PlayFabRegisterAndLogin(const FString& UsernameIn, const FS this->PlayFabNewAccountLoginRPC(UsernameIn, EmailIn, PasswordIn, OnSuccess, OnFailure); } -void UAuthenticator::PlayFabLogin(const FString& UsernameIn, const FString& PasswordIn, const bool ForceCreateAccountIn) +void USequenceAuthenticator::PlayFabLogin(const FString& UsernameIn, const FString& PasswordIn, const bool ForceCreateAccountIn) { if (ForceCreateAccountIn) { @@ -519,7 +519,7 @@ void UAuthenticator::PlayFabLogin(const FString& UsernameIn, const FString& Pass this->PlayFabLoginRPC(UsernameIn, PasswordIn, OnSuccess, OnFailure); } -FString UAuthenticator::GenerateRedirectURL(const ESocialSigninType& Type) const +FString USequenceAuthenticator::GenerateRedirectURL(const ESocialSigninType& Type) const { FString RedirectUrl = this->BuildRedirectPrefix() + "&scope=openid+email&state=" + UrlScheme + "---" + this->StateToken + UEnum::GetValueAsString(Type); switch (Type) @@ -537,7 +537,7 @@ FString UAuthenticator::GenerateRedirectURL(const ESocialSigninType& Type) const return RedirectUrl; } -FString UAuthenticator::GenerateSigninURL(const ESocialSigninType& Type) const +FString USequenceAuthenticator::GenerateSigninURL(const ESocialSigninType& Type) const { const FString AuthClientId = SSOProviderMap[Type].ClientID; const FString AuthUrl = SSOProviderMap[Type].URL; @@ -558,7 +558,7 @@ FString UAuthenticator::GenerateSigninURL(const ESocialSigninType& Type) const return SigninUrl; } -void UAuthenticator::InitializeSequence(const FCredentials_BE& Credentials) const +void USequenceAuthenticator::InitializeSequence(const FCredentials_BE& Credentials) const { if (const TOptional WalletOptional = USequenceWallet::Get(Credentials); WalletOptional.IsSet() && WalletOptional.GetValue()) { @@ -571,7 +571,7 @@ void UAuthenticator::InitializeSequence(const FCredentials_BE& Credentials) cons } } -void UAuthenticator::PlayFabLoginRPC(const FString& UsernameIn, const FString& PasswordIn, const TSuccessCallback& OnSuccess, const FFailureCallback& OnFailure) +void USequenceAuthenticator::PlayFabLoginRPC(const FString& UsernameIn, const FString& PasswordIn, const TSuccessCallback& OnSuccess, const FFailureCallback& OnFailure) { const TFunction OnSuccessResponse = [OnSuccess, OnFailure](const FString& Response) { @@ -592,7 +592,7 @@ void UAuthenticator::PlayFabLoginRPC(const FString& UsernameIn, const FString& P PlayFabRPC(GeneratePlayFabUrl(), RequestBody, OnSuccessResponse, OnFailure); } -void UAuthenticator::PlayFabNewAccountLoginRPC(const FString& UsernameIn, const FString& EmailIn, const FString& PasswordIn, const TSuccessCallback& OnSuccess, const FFailureCallback& OnFailure) +void USequenceAuthenticator::PlayFabNewAccountLoginRPC(const FString& UsernameIn, const FString& EmailIn, const FString& PasswordIn, const TSuccessCallback& OnSuccess, const FFailureCallback& OnFailure) { const TFunction OnSuccessResponse = [OnSuccess, OnFailure](const FString& Response) { @@ -613,19 +613,19 @@ void UAuthenticator::PlayFabNewAccountLoginRPC(const FString& UsernameIn, const PlayFabRPC(GeneratePlayFabRegisterUrl(), RequestBody, OnSuccessResponse, OnFailure); } -FString UAuthenticator::GeneratePlayFabUrl() +FString USequenceAuthenticator::GeneratePlayFabUrl() { const FString TitleId = UConfigFetcher::GetConfigVar(UConfigFetcher::PlayFabTitleID); return "https://" + TitleId + ".playfabapi.com/Client/LoginWithPlayFab"; } -FString UAuthenticator::GeneratePlayFabRegisterUrl() +FString USequenceAuthenticator::GeneratePlayFabRegisterUrl() { const FString TitleId = UConfigFetcher::GetConfigVar(UConfigFetcher::PlayFabTitleID); return "https://" + TitleId + ".playfabapi.com/Client/RegisterPlayFabUser"; } -void UAuthenticator::PlayFabRPC(const FString& Url, const FString& Content, const TSuccessCallback& OnSuccess, const FFailureCallback& OnFailure) +void USequenceAuthenticator::PlayFabRPC(const FString& Url, const FString& Content, const TSuccessCallback& OnSuccess, const FFailureCallback& OnFailure) { NewObject() ->PrepareRequest() @@ -636,7 +636,7 @@ void UAuthenticator::PlayFabRPC(const FString& Url, const FString& Content, cons ->ProcessAndThen(OnSuccess, OnFailure); } -void UAuthenticator::EmailLoginCode(const FString& CodeIn) +void USequenceAuthenticator::EmailLoginCode(const FString& CodeIn) { if (this->ReadAndResetIsFederating()) { @@ -687,7 +687,7 @@ void UAuthenticator::EmailLoginCode(const FString& CodeIn) } } -void UAuthenticator::FederateEmail(const FString& EmailIn) +void USequenceAuthenticator::FederateEmail(const FString& EmailIn) { this->SetIsFederating(true); @@ -705,7 +705,7 @@ void UAuthenticator::FederateEmail(const FString& EmailIn) this->SequenceRPCManager->InitEmailFederation(EmailIn.ToLower(),OnSuccess,OnFailure); } -void UAuthenticator::FederateOIDCIdToken(const FString& IdTokenIn) +void USequenceAuthenticator::FederateOIDCIdToken(const FString& IdTokenIn) { const TFunction OnSuccess = [this]() { @@ -729,13 +729,13 @@ void UAuthenticator::FederateOIDCIdToken(const FString& IdTokenIn) } } -void UAuthenticator::InitiateMobileFederateOIDC(const ESocialSigninType& Type) +void USequenceAuthenticator::InitiateMobileFederateOIDC(const ESocialSigninType& Type) { this->SetIsFederating(true); this->InitiateMobileSSO_Internal(Type); } -void UAuthenticator::FederatePlayFabNewAccount(const FString& UsernameIn, const FString& EmailIn, const FString& PasswordIn) const +void USequenceAuthenticator::FederatePlayFabNewAccount(const FString& UsernameIn, const FString& EmailIn, const FString& PasswordIn) const { const TSuccessCallback OnSuccess = [this](const FString& SessionTicket) { @@ -773,7 +773,7 @@ void UAuthenticator::FederatePlayFabNewAccount(const FString& UsernameIn, const this->PlayFabNewAccountLoginRPC(UsernameIn, EmailIn, PasswordIn, OnSuccess, OnFailure); } -void UAuthenticator::FederatePlayFabLogin(const FString& UsernameIn, const FString& PasswordIn) const +void USequenceAuthenticator::FederatePlayFabLogin(const FString& UsernameIn, const FString& PasswordIn) const { const TSuccessCallback OnSuccess = [this](const FString& SessionTicket) { @@ -811,7 +811,7 @@ void UAuthenticator::FederatePlayFabLogin(const FString& UsernameIn, const FStri this->PlayFabLoginRPC(UsernameIn, PasswordIn, OnSuccess, OnFailure); } -void UAuthenticator::ForceOpenLastOpenSessionAttempt() +void USequenceAuthenticator::ForceOpenLastOpenSessionAttempt() { const TSuccessCallback OnSuccess = [this](const FCredentials_BE& Credentials) { @@ -828,7 +828,7 @@ void UAuthenticator::ForceOpenLastOpenSessionAttempt() this->SequenceRPCManager->ForceOpenSessionInUse(OnSuccess, OnFailure); } -FStoredCredentials_BE UAuthenticator::GetStoredCredentials() const +FStoredCredentials_BE USequenceAuthenticator::GetStoredCredentials() const { FCredentials_BE CredData; FCredentials_BE* Credentials = &CredData; diff --git a/Plugins/SequencePlugin/Source/SequencePlugin/Private/SequenceBackendManager.cpp b/Plugins/SequencePlugin/Source/SequencePlugin/Private/SequenceBackendManager.cpp index 6a9955725..cf58b7caf 100644 --- a/Plugins/SequencePlugin/Source/SequencePlugin/Private/SequenceBackendManager.cpp +++ b/Plugins/SequencePlugin/Source/SequencePlugin/Private/SequenceBackendManager.cpp @@ -84,7 +84,7 @@ ASequenceBackendManager::ASequenceBackendManager() void ASequenceBackendManager::BeginPlay() { Super::BeginPlay(); - this->Authenticator = NewObject(); + this->Authenticator = NewObject(); //setup up delegate bindings this->Authenticator->AuthSuccess.AddDynamic(this, &ASequenceBackendManager::CallShowAuthSuccessScreen); diff --git a/Plugins/SequencePlugin/Source/SequencePlugin/Private/SequenceBackendManager.h b/Plugins/SequencePlugin/Source/SequencePlugin/Private/SequenceBackendManager.h index 40feda3ae..791754ecc 100644 --- a/Plugins/SequencePlugin/Source/SequencePlugin/Private/SequenceBackendManager.h +++ b/Plugins/SequencePlugin/Source/SequencePlugin/Private/SequenceBackendManager.h @@ -6,7 +6,7 @@ #include "GameFramework/Actor.h" #include "Util/Structs/BE_Structs.h" #include "Misc/AES.h" -#include "Authenticator.h" +#include "SequenceAuthenticator.h" #include "SequenceBackendManager.generated.h" class UIndexer; @@ -71,7 +71,7 @@ class SEQUENCEPLUGIN_API ASequenceBackendManager : public AActor void CallShowFederateOrForce(const FFederationSupportData& FederationData); private: UPROPERTY() - UAuthenticator* Authenticator; + USequenceAuthenticator* Authenticator; //testing variables// bool bEnableTesting = true; diff --git a/Plugins/SequencePlugin/Source/SequencePlugin/Private/SequenceRPCManager.cpp b/Plugins/SequencePlugin/Source/SequencePlugin/Private/SequenceRPCManager.cpp index 3497d6ecf..25e626d08 100644 --- a/Plugins/SequencePlugin/Source/SequencePlugin/Private/SequenceRPCManager.cpp +++ b/Plugins/SequencePlugin/Source/SequencePlugin/Private/SequenceRPCManager.cpp @@ -1,7 +1,7 @@ // Copyright 2024 Horizon Blockchain Games Inc. All rights reserved. #include "SequenceRPCManager.h" -#include "Authenticator.h" +#include "SequenceAuthenticator.h" #include "RequestHandler.h" #include "ConfigFetcher.h" #include "Types/BinaryData.h" @@ -162,12 +162,12 @@ void USequenceRPCManager::CheckAndUpdateSessionFromPreserveSessionWallet() void USequenceRPCManager::UpdateWithRandomSessionWallet() { - this->SessionWallet = UWallet::Make(); + this->SessionWallet = UCryptoWallet::Make(); } void USequenceRPCManager::UpdateWithStoredSessionWallet() { - const UAuthenticator * Authenticator = NewObject(); + const USequenceAuthenticator * Authenticator = NewObject(); if (FStoredCredentials_BE StoredCredentials = Authenticator->GetStoredCredentials(); StoredCredentials.GetValid()) { this->SessionWallet = StoredCredentials.GetCredentials().GetSessionWallet(); @@ -182,16 +182,16 @@ USequenceRPCManager* USequenceRPCManager::Make(const bool UseStoredSessionId) { if (UseStoredSessionId) { - const UAuthenticator * Authenticator = NewObject(); + const USequenceAuthenticator * Authenticator = NewObject(); if (FStoredCredentials_BE StoredCredentials = Authenticator->GetStoredCredentials(); StoredCredentials.GetValid()) { return Make(StoredCredentials.GetCredentials().GetSessionWallet()); } } - return Make(UWallet::Make()); + return Make(UCryptoWallet::Make()); } -USequenceRPCManager* USequenceRPCManager::Make(UWallet* SessionWalletIn) +USequenceRPCManager* USequenceRPCManager::Make(UCryptoWallet* SessionWalletIn) { USequenceRPCManager * SequenceRPCManager = NewObject(); SequenceRPCManager->SessionWallet = SessionWalletIn; diff --git a/Plugins/SequencePlugin/Source/SequencePlugin/Private/SequenceRPCManager.h b/Plugins/SequencePlugin/Source/SequencePlugin/Private/SequenceRPCManager.h index e02e83080..11c154bb1 100644 --- a/Plugins/SequencePlugin/Source/SequencePlugin/Private/SequenceRPCManager.h +++ b/Plugins/SequencePlugin/Source/SequencePlugin/Private/SequenceRPCManager.h @@ -9,7 +9,7 @@ #include "Sequence/SequenceResponseIntent.h" #include "UObject/Object.h" #include "Types/Types.h" -#include "Types/Wallet.h" +#include "Types/CryptoWallet.h" #include "Util/Async.h" #include "Sequence/SequenceFederationSupport.h" #include "SequenceRPCManager.generated.h" @@ -33,7 +33,7 @@ class SEQUENCEPLUGIN_API USequenceRPCManager : public UObject FOpenSessionData Cached_OpenSessionData; UPROPERTY() - UWallet * SessionWallet = nullptr; + UCryptoWallet * SessionWallet = nullptr; FString Cached_ProjectAccessKey = ""; FString Cached_FeeQuote = ""; @@ -119,7 +119,7 @@ class SEQUENCEPLUGIN_API USequenceRPCManager : public UObject * @param SessionWalletIn The SessionWallet to Initialize with * @return The Initialized USequenceRPCManager */ - static USequenceRPCManager * Make(UWallet * SessionWalletIn); + static USequenceRPCManager * Make(UCryptoWallet * SessionWalletIn); //RPC Calls// diff --git a/Plugins/SequencePlugin/Source/SequencePlugin/Private/Tests/TestSequenceAPI.cpp b/Plugins/SequencePlugin/Source/SequencePlugin/Private/Tests/TestSequenceAPI.cpp index 5be4e28ab..0c78c2f8b 100644 --- a/Plugins/SequencePlugin/Source/SequencePlugin/Private/Tests/TestSequenceAPI.cpp +++ b/Plugins/SequencePlugin/Source/SequencePlugin/Private/Tests/TestSequenceAPI.cpp @@ -2,7 +2,7 @@ #include "TestSequenceAPI.h" #include "Sequence/SequenceAPI.h" -#include "Authenticator.h" +#include "SequenceAuthenticator.h" #include "ABI/ABI.h" #include "Native/NativeOAuth.h" @@ -21,7 +21,7 @@ void SequenceAPITest::BasicProviderTests() UE_LOG(LogTemp,Display,TEXT("Error")); }; - const UAuthenticator * Auth = NewObject(); + const USequenceAuthenticator * Auth = NewObject(); const TOptional WalletOptional = USequenceWallet::Get(Auth->GetStoredCredentials().GetCredentials(),"https://cognito-idp.us-east-2.amazonaws.com"); if (WalletOptional.IsSet() && WalletOptional.GetValue()) { @@ -54,7 +54,7 @@ void SequenceAPITest::SignMessage(TFunction OnSuccess, TFunction< }; UE_LOG(LogTemp,Display,TEXT("========================[Running Sequence API SignMessage Test]========================")); - const UAuthenticator * Auth = NewObject(); + const USequenceAuthenticator * Auth = NewObject(); const TOptional WalletOptional = USequenceWallet::Get(Auth->GetStoredCredentials().GetCredentials()); if (WalletOptional.IsSet() && WalletOptional.GetValue()) { @@ -81,7 +81,7 @@ void SequenceAPITest::ListSessions(TFunction OnSuccess, TFunction }; UE_LOG(LogTemp,Display,TEXT("========================[Running Sequence API ListSessions Test]========================")); - const UAuthenticator * Auth = NewObject(); + const USequenceAuthenticator * Auth = NewObject(); const TOptional WalletOptional = USequenceWallet::Get(Auth->GetStoredCredentials().GetCredentials()); if (WalletOptional.IsSet() && WalletOptional.GetValue()) { @@ -107,7 +107,7 @@ void SequenceAPITest::SendRaw(TFunction OnSuccess, TFunction(); + const USequenceAuthenticator * Auth = NewObject(); const TOptional WalletOptional = USequenceWallet::Get(Auth->GetStoredCredentials().GetCredentials()); if (WalletOptional.IsSet() && WalletOptional.GetValue()) { @@ -161,7 +161,7 @@ void SequenceAPITest::CallContract(TFunction OnSuccess, Txn.Push(TransactionUnion(T)); - const UAuthenticator * Auth = NewObject(); + const USequenceAuthenticator * Auth = NewObject(); const TOptional WalletOptional = USequenceWallet::Get(Auth->GetStoredCredentials().GetCredentials()); if (WalletOptional.IsSet() && WalletOptional.GetValue()) { @@ -197,7 +197,7 @@ void SequenceAPITest::SendERC20(TFunction OnSuccess, TFunction(); + const USequenceAuthenticator * Auth = NewObject(); const TOptional WalletOptional = USequenceWallet::Get(Auth->GetStoredCredentials().GetCredentials()); if (WalletOptional.IsSet() && WalletOptional.GetValue()) { @@ -232,7 +232,7 @@ void SequenceAPITest::SendERC721(TFunction OnSuccess, TFunction(); + const USequenceAuthenticator * Auth = NewObject(); const TOptional WalletOptional = USequenceWallet::Get(Auth->GetStoredCredentials().GetCredentials()); if (WalletOptional.IsSet() && WalletOptional.GetValue()) { @@ -269,7 +269,7 @@ void SequenceAPITest::SendERC1155(TFunction OnSuccess, TFunction< Txn.Push(TransactionUnion(T1155)); - const UAuthenticator * Auth = NewObject(); + const USequenceAuthenticator * Auth = NewObject(); const TOptional WalletOptional = USequenceWallet::Get(Auth->GetStoredCredentials().GetCredentials()); if (WalletOptional.IsSet() && WalletOptional.GetValue()) { @@ -299,7 +299,7 @@ void SequenceAPITest::CloseSession(TFunction OnSuccess, TFunction UE_LOG(LogTemp,Display,TEXT("========================[Running Sequence API SignOut Test]========================")); - const UAuthenticator * Auth = NewObject(); + const USequenceAuthenticator * Auth = NewObject(); const TOptional WalletOptional = USequenceWallet::Get(Auth->GetStoredCredentials().GetCredentials()); if (WalletOptional.IsSet() && WalletOptional.GetValue()) { @@ -327,7 +327,7 @@ void SequenceAPITest::GetFeeOptions(TFunction OnSuccess, TFunctio UE_LOG(LogTemp,Display,TEXT("========================[Running Sequence API GetFeeOptions Test]========================")); - const UAuthenticator * Auth = NewObject(); + const USequenceAuthenticator * Auth = NewObject(); const TOptional WalletOptional = USequenceWallet::Get(Auth->GetStoredCredentials().GetCredentials()); if (WalletOptional.IsSet() && WalletOptional.GetValue()) { @@ -368,7 +368,7 @@ void SequenceAPITest::SendTransactionWithFee(TFunction OnSuccess, OnFailure("Transaction failure", Error); }; - const UAuthenticator * Auth = NewObject(); + const USequenceAuthenticator * Auth = NewObject(); const TOptional WalletOptional = USequenceWallet::Get(Auth->GetStoredCredentials().GetCredentials()); if (WalletOptional.IsSet() && WalletOptional.GetValue()) { @@ -393,7 +393,7 @@ void SequenceAPITest::SendTransactionWithFee(TFunction OnSuccess, OnFailure("Get Fee Option Response failure", Error); }; - const UAuthenticator * Auth = NewObject(); + const USequenceAuthenticator * Auth = NewObject(); const TOptional WalletOptional = USequenceWallet::Get(Auth->GetStoredCredentials().GetCredentials()); if (WalletOptional.IsSet() && WalletOptional.GetValue()) { @@ -423,7 +423,7 @@ void SequenceAPITest::GetUnfilteredFeeOptions(TFunction OnSuccess UE_LOG(LogTemp,Display,TEXT("========================[Running Sequence API GetUnfilteredFeeOptions Test]========================")); - const UAuthenticator * Auth = NewObject(); + const USequenceAuthenticator * Auth = NewObject(); const TOptional WalletOptional = USequenceWallet::Get(Auth->GetStoredCredentials().GetCredentials()); if (WalletOptional.IsSet() && WalletOptional.GetValue()) { @@ -443,7 +443,7 @@ void SequenceAPITest::GetUnfilteredFeeOptions(TFunction OnSuccess void SequenceAPITest::GetSupportedCountries(const TSuccessCallback>& OnSuccess, const FFailureCallback& OnFailure) { - const UAuthenticator * Auth = NewObject(); + const USequenceAuthenticator * Auth = NewObject(); const TOptional WalletOptional = USequenceWallet::Get(Auth->GetStoredCredentials().GetCredentials()); if (WalletOptional.IsSet() && WalletOptional.GetValue()) { @@ -454,7 +454,7 @@ void SequenceAPITest::GetSupportedCountries(const TSuccessCallback(); + const USequenceAuthenticator * Auth = NewObject(); const TOptional WalletOptional = USequenceWallet::Get(Auth->GetStoredCredentials().GetCredentials()); if (WalletOptional.IsSet() && WalletOptional.GetValue()) { diff --git a/Plugins/SequencePlugin/Source/SequencePlugin/Private/Types/Wallet.cpp b/Plugins/SequencePlugin/Source/SequencePlugin/Private/Types/CryptoWallet.cpp similarity index 83% rename from Plugins/SequencePlugin/Source/SequencePlugin/Private/Types/Wallet.cpp rename to Plugins/SequencePlugin/Source/SequencePlugin/Private/Types/CryptoWallet.cpp index 331b0bb74..5696aa41b 100644 --- a/Plugins/SequencePlugin/Source/SequencePlugin/Private/Types/Wallet.cpp +++ b/Plugins/SequencePlugin/Source/SequencePlugin/Private/Types/CryptoWallet.cpp @@ -1,5 +1,5 @@ // Copyright 2024 Horizon Blockchain Games Inc. All rights reserved. -#include "Types/Wallet.h" +#include "Types/CryptoWallet.h" #include "Eth/EthTransaction.h" #include "Bitcoin-Cryptography-Library/cpp/Ecdsa.hpp" #include "Bitcoin-Cryptography-Library/cpp/Keccak256.hpp" @@ -9,11 +9,11 @@ #include "Eth/Crypto.h" #include "Bitcoin-Cryptography-Library/cpp/Sha256.hpp" -UWallet::UWallet(){} +UCryptoWallet::UCryptoWallet(){} -UWallet* UWallet::Make() +UCryptoWallet* UCryptoWallet::Make() { - UWallet * Wallet = NewObject(); + UCryptoWallet * Wallet = NewObject(); Wallet->PrivateKey = FPrivateKey::New(); for (int i = 0; i < 32; i++) { @@ -24,18 +24,18 @@ UWallet* UWallet::Make() return Wallet; } -UWallet* UWallet::Make(FPrivateKey PrivateKey) +UCryptoWallet* UCryptoWallet::Make(FPrivateKey PrivateKey) { - UWallet * Wallet = NewObject(); + UCryptoWallet * Wallet = NewObject(); Wallet->PrivateKey = PrivateKey; Wallet->PublicKey = GetPublicKey(Wallet->PrivateKey); Wallet->Address = GetAddress(Wallet->PublicKey); return Wallet; } -UWallet* UWallet::Make(const FString& PrivateKey) +UCryptoWallet* UCryptoWallet::Make(const FString& PrivateKey) { - UWallet * Wallet = NewObject(); + UCryptoWallet * Wallet = NewObject(); if (PrivateKey.Len() == 64) { Wallet->PrivateKey = FPrivateKey::From(PrivateKey); @@ -49,7 +49,7 @@ UWallet* UWallet::Make(const FString& PrivateKey) return Wallet; } -TArray UWallet::BuildSigningNonce(uint8_t* MessageHash, int32 Size) +TArray UCryptoWallet::BuildSigningNonce(uint8_t* MessageHash, int32 Size) { TArray nonce; FString v_0_str = "010101010101010101010101010101010101010101010101010101010101010100"; @@ -88,7 +88,7 @@ TArray UWallet::BuildSigningNonce(uint8_t* MessageHash, int32 Size) return nonce; } -TArray UWallet::SignMessage(TArray MessageBytes, int32 MessageLength) +TArray UCryptoWallet::SignMessage(TArray MessageBytes, int32 MessageLength) { TArray sig; Uint256 BigR, BigS; @@ -132,7 +132,7 @@ TArray UWallet::SignMessage(TArray MessageBytes, int32 MessageLeng return sig; } -TArray UWallet::SignMessage(FString Message) +TArray UCryptoWallet::SignMessage(FString Message) { TArray sig; Uint256 BigR, BigS; @@ -177,40 +177,40 @@ TArray UWallet::SignMessage(FString Message) return sig; } -FString UWallet::SignMessageWithoutPrefix(const FString& Message) +FString UCryptoWallet::SignMessageWithoutPrefix(const FString& Message) { TArray SigBytes = SignMessage(Message); FString Signature = BytesToHex(SigBytes.GetData(), SigBytes.Num()).ToLower(); return Signature; } -FString UWallet::SignMessageWithoutPrefix(const TArray& MessageBytes, const int32 MessageLength) +FString UCryptoWallet::SignMessageWithoutPrefix(const TArray& MessageBytes, const int32 MessageLength) { TArray SigBytes = SignMessage(MessageBytes, MessageLength); FString Signature = BytesToHex(SigBytes.GetData(), SigBytes.Num()).ToLower(); return Signature; } -FString UWallet::SignMessageWithPrefix(const FString& Message) +FString UCryptoWallet::SignMessageWithPrefix(const FString& Message) { TArray SigBytes = SignMessage(Message); FString Signature = "0x" + BytesToHex(SigBytes.GetData(), SigBytes.Num()).ToLower(); return Signature; } -FString UWallet::SignMessageWithPrefix(const TArray& MessageBytes, const int32 MessageLength) +FString UCryptoWallet::SignMessageWithPrefix(const TArray& MessageBytes, const int32 MessageLength) { TArray SigBytes = SignMessage(MessageBytes, MessageLength); FString Signature = "0x" + BytesToHex(SigBytes.GetData(), SigBytes.Num()).ToLower(); return Signature; } -FString UWallet::GetSessionId() +FString UCryptoWallet::GetSessionId() { return "0x00" + GetWalletAddress().ToHex().ToLower(); } -FString UWallet::GetSessionHash() +FString UCryptoWallet::GetSessionHash() { const FHash256 SessionHashBytes = FHash256::New(); const FUnsizedData EncodedSigningData = StringToUTF8(GetSessionId()); @@ -218,22 +218,22 @@ FString UWallet::GetSessionHash() return "0x" + SessionHashBytes.ToHex().ToLower(); } -FPrivateKey UWallet::GetWalletPrivateKey() +FPrivateKey UCryptoWallet::GetWalletPrivateKey() { return this->PrivateKey; } -FPublicKey UWallet::GetWalletPublicKey() +FPublicKey UCryptoWallet::GetWalletPublicKey() { return this->PublicKey; } -FAddress UWallet::GetWalletAddress() +FAddress UCryptoWallet::GetWalletAddress() { return this->Address; } -FString UWallet::GetWalletPrivateKeyString() +FString UCryptoWallet::GetWalletPrivateKeyString() { return BytesToHex(GetWalletPrivateKey().Ptr(), GetWalletPrivateKey().GetLength()).ToLower(); } diff --git a/Plugins/SequencePlugin/Source/SequencePlugin/Public/Credentials.h b/Plugins/SequencePlugin/Source/SequencePlugin/Public/Credentials.h index 1556ab7d5..4eb552f0a 100644 --- a/Plugins/SequencePlugin/Source/SequencePlugin/Public/Credentials.h +++ b/Plugins/SequencePlugin/Source/SequencePlugin/Public/Credentials.h @@ -3,7 +3,7 @@ #pragma once #include "CoreMinimal.h" -#include "Types/Wallet.h" +#include "Types/CryptoWallet.h" #include "Credentials.generated.h" USTRUCT() @@ -111,9 +111,9 @@ struct SEQUENCEPLUGIN_API FCredentials_BE return Network; } - UWallet * GetSessionWallet() const + UCryptoWallet * GetSessionWallet() const { - return UWallet::Make(SessionPrivateKey); + return UCryptoWallet::Make(SessionPrivateKey); } FString GetWalletAddress() const diff --git a/Plugins/SequencePlugin/Source/SequencePlugin/Public/Sequence/SequenceAPI.h b/Plugins/SequencePlugin/Source/SequencePlugin/Public/Sequence/SequenceAPI.h index 977faa600..7b33c992a 100644 --- a/Plugins/SequencePlugin/Source/SequencePlugin/Public/Sequence/SequenceAPI.h +++ b/Plugins/SequencePlugin/Source/SequencePlugin/Public/Sequence/SequenceAPI.h @@ -1,7 +1,7 @@ // Copyright 2024 Horizon Blockchain Games Inc. All rights reserved. #pragma once #include "Indexer/Structs/Struct_Data.h" -#include "Authenticator.h" +#include "SequenceAuthenticator.h" #include "Util/Async.h" #include "Eth/EthTransaction.h" #include "Util/Structs/BE_Structs.h" diff --git a/Plugins/SequencePlugin/Source/SequencePlugin/Public/Authenticator.h b/Plugins/SequencePlugin/Source/SequencePlugin/Public/SequenceAuthenticator.h similarity index 98% rename from Plugins/SequencePlugin/Source/SequencePlugin/Public/Authenticator.h rename to Plugins/SequencePlugin/Source/SequencePlugin/Public/SequenceAuthenticator.h index 44aa45c07..453d37a00 100644 --- a/Plugins/SequencePlugin/Source/SequencePlugin/Public/Authenticator.h +++ b/Plugins/SequencePlugin/Source/SequencePlugin/Public/SequenceAuthenticator.h @@ -10,7 +10,7 @@ #include "Credentials.h" #include "Sequence/SequenceFederationSupport.h" #include "Util/Async.h" -#include "Authenticator.generated.h" +#include "SequenceAuthenticator.generated.h" class USequenceRPCManager; @@ -44,7 +44,7 @@ DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnFederateOrForce, const FFederatio * */ UCLASS() -class SEQUENCEPLUGIN_API UAuthenticator : public UObject +class SEQUENCEPLUGIN_API USequenceAuthenticator : public UObject { GENERATED_BODY() public: @@ -127,7 +127,7 @@ class SEQUENCEPLUGIN_API UAuthenticator : public UObject inline static FString RedirectPrefixTrailer = "oauth/callback"; private: - UAuthenticator(); + USequenceAuthenticator(); void InitiateMobileSSO_Internal(const ESocialSigninType& Type); diff --git a/Plugins/SequencePlugin/Source/SequencePlugin/Public/SqncSpecPawn.h b/Plugins/SequencePlugin/Source/SequencePlugin/Public/SqncSpecPawn.h index 489bedb19..9294d3c0f 100644 --- a/Plugins/SequencePlugin/Source/SequencePlugin/Public/SqncSpecPawn.h +++ b/Plugins/SequencePlugin/Source/SequencePlugin/Public/SqncSpecPawn.h @@ -1,7 +1,7 @@ // Copyright 2024 Horizon Blockchain Games Inc. All rights reserved. #pragma once #include "CoreMinimal.h" -#include "Authenticator.h" +#include "SequenceAuthenticator.h" #include "GameFramework/Pawn.h" #include "SqncSpecPawn.generated.h" diff --git a/Plugins/SequencePlugin/Source/SequencePlugin/Public/Types/Wallet.h b/Plugins/SequencePlugin/Source/SequencePlugin/Public/Types/CryptoWallet.h similarity index 82% rename from Plugins/SequencePlugin/Source/SequencePlugin/Public/Types/Wallet.h rename to Plugins/SequencePlugin/Source/SequencePlugin/Public/Types/CryptoWallet.h index 0e79f7b39..a560d65f1 100644 --- a/Plugins/SequencePlugin/Source/SequencePlugin/Public/Types/Wallet.h +++ b/Plugins/SequencePlugin/Source/SequencePlugin/Public/Types/CryptoWallet.h @@ -1,10 +1,10 @@ // Copyright 2024 Horizon Blockchain Games Inc. All rights reserved. #pragma once #include "BinaryData.h" -#include "Wallet.generated.h" +#include "CryptoWallet.generated.h" UCLASS() -class SEQUENCEPLUGIN_API UWallet : public UObject +class SEQUENCEPLUGIN_API UCryptoWallet : public UObject { GENERATED_BODY() private: @@ -15,11 +15,11 @@ class SEQUENCEPLUGIN_API UWallet : public UObject /* * Generates a random wallet */ - UWallet(); + UCryptoWallet(); - static UWallet* Make(); - static UWallet* Make(FPrivateKey PrivateKey); - static UWallet* Make(const FString& PrivateKey); + static UCryptoWallet* Make(); + static UCryptoWallet* Make(FPrivateKey PrivateKey); + static UCryptoWallet* Make(const FString& PrivateKey); TArray SignMessage(TArray MessageBytes,int32 MessageLength); From 23e56573e5097a25ddf0dfeb114943080d0bbbfe Mon Sep 17 00:00:00 2001 From: CalvinKork Date: Mon, 23 Sep 2024 14:50:44 -0500 Subject: [PATCH 2/8] Fixing post rename on android --- .../Source/SequencePlugin/Private/Native/NativeOAuth.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/SequencePlugin/Source/SequencePlugin/Private/Native/NativeOAuth.cpp b/Plugins/SequencePlugin/Source/SequencePlugin/Private/Native/NativeOAuth.cpp index 7431fd3db..1c92ce3a2 100644 --- a/Plugins/SequencePlugin/Source/SequencePlugin/Private/Native/NativeOAuth.cpp +++ b/Plugins/SequencePlugin/Source/SequencePlugin/Private/Native/NativeOAuth.cpp @@ -147,7 +147,7 @@ JNI_METHOD void Java_com_epicgames_unreal_GameActivity_nativeSequenceHandleRedir { const char* redirectUrlChars = jenv->GetStringUTFChars(jRedirectUrl, 0); FString redirectUrl = FString(UTF8_TO_TCHAR(redirectUrlChars)); - UAuthenticator * CallbackLcl = Callback; + USequenceAuthenticator * CallbackLcl = Callback; AsyncTask(ENamedThreads::GameThread, [CallbackLcl,redirectUrl]() { CallbackLcl->UpdateMobileLogin(redirectUrl); }); From b75007c83d998fe817c631631a5e557a3da6bcf2 Mon Sep 17 00:00:00 2001 From: CalvinKork Date: Tue, 24 Sep 2024 08:53:05 -0500 Subject: [PATCH 3/8] Updating readmes --- Plugins/SequencePlugin/README.md | 6 ++++++ README.md | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/Plugins/SequencePlugin/README.md b/Plugins/SequencePlugin/README.md index 0c317e223..a0e5704ff 100644 --- a/Plugins/SequencePlugin/README.md +++ b/Plugins/SequencePlugin/README.md @@ -1440,3 +1440,9 @@ During the Unreal Package process in the event a code signing error occurs you c 12) Click on Mac and Applevision Pro under supported destinations and hit the delete key 13) Now the project can be built (if the build fails at first, wait a few moments then try again. It can sometimes take a bit before the build registers the run script) 14) Once you have finished running the project, and want to make changes to the code, REMEMBER to delete this xcodeproj file in the sequence-unreal folder to ensure that a new xcodeproj is creating when you packaging the project again._ + +## TroubleShooting + +In events where the editor crashes on launch, try deleting the following file, Saved/SaveGames/Cr.sav +This file contains the savegame data for credentials and if modified can result in an engine crash. +Deleting this file deletes local credentials, so you'll need to log back in. \ No newline at end of file diff --git a/README.md b/README.md index 0c317e223..a0e5704ff 100644 --- a/README.md +++ b/README.md @@ -1440,3 +1440,9 @@ During the Unreal Package process in the event a code signing error occurs you c 12) Click on Mac and Applevision Pro under supported destinations and hit the delete key 13) Now the project can be built (if the build fails at first, wait a few moments then try again. It can sometimes take a bit before the build registers the run script) 14) Once you have finished running the project, and want to make changes to the code, REMEMBER to delete this xcodeproj file in the sequence-unreal folder to ensure that a new xcodeproj is creating when you packaging the project again._ + +## TroubleShooting + +In events where the editor crashes on launch, try deleting the following file, Saved/SaveGames/Cr.sav +This file contains the savegame data for credentials and if modified can result in an engine crash. +Deleting this file deletes local credentials, so you'll need to log back in. \ No newline at end of file From 627ad8cad3967793096fe7ad3b39f22a2597ed31 Mon Sep 17 00:00:00 2001 From: CalvinKork Date: Tue, 24 Sep 2024 09:40:46 -0500 Subject: [PATCH 4/8] Small tweak to credential loader --- .../Private/SequenceAuthenticator.cpp | 32 ++++++++++++------- 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/Plugins/SequencePlugin/Source/SequencePlugin/Private/SequenceAuthenticator.cpp b/Plugins/SequencePlugin/Source/SequencePlugin/Private/SequenceAuthenticator.cpp index f79892659..ddfc5533d 100644 --- a/Plugins/SequencePlugin/Source/SequencePlugin/Private/SequenceAuthenticator.cpp +++ b/Plugins/SequencePlugin/Source/SequencePlugin/Private/SequenceAuthenticator.cpp @@ -205,20 +205,28 @@ FString USequenceAuthenticator::BuildRedirectPrefix() const bool USequenceAuthenticator::GetStoredCredentials(FCredentials_BE* Credentials) const { bool ret = false; - if (const UStorableCredentials* LoadedCredentials = Cast(UGameplayStatics::LoadGameFromSlot(this->SaveSlot, this->UserIndex))) + + //This line crashes the engine if Cr.sav is modified externally in anyway + + const USaveGame * SaveGame = UGameplayStatics::LoadGameFromSlot(this->SaveSlot, this->UserIndex); + + if (SaveGame != nullptr) { - FString CTR_Json = ""; - if (Encryptor) - {//Use set encryptor - CTR_Json = Encryptor->Decrypt(LoadedCredentials->EK); - } - else - {//Use the fallback - CTR_Json = USequenceEncryptor::Decrypt(LoadedCredentials->EK, LoadedCredentials->KL); - } + if (const UStorableCredentials* LoadedCredentials = Cast(SaveGame)) + { + FString CTR_Json = ""; + if (Encryptor) + {//Use set encryptor + CTR_Json = Encryptor->Decrypt(LoadedCredentials->EK); + } + else + {//Use the fallback + CTR_Json = USequenceEncryptor::Decrypt(LoadedCredentials->EK, LoadedCredentials->KL); + } - ret = USequenceSupport::JSONStringToStruct(CTR_Json, Credentials); - ret &= Credentials->RegisteredValid(); + ret = USequenceSupport::JSONStringToStruct(CTR_Json, Credentials); + ret &= Credentials->RegisteredValid(); + } } return ret; } From 98cf6770e6b59d2d2ecefbfc22079c80f232cf9e Mon Sep 17 00:00:00 2001 From: CalvinKork Date: Wed, 25 Sep 2024 08:51:33 -0500 Subject: [PATCH 5/8] Fixing compiler issue for logging definitions --- Plugins/SequencePlugin/Source/SequencePlugin/Private/Util/Log.h | 1 + 1 file changed, 1 insertion(+) diff --git a/Plugins/SequencePlugin/Source/SequencePlugin/Private/Util/Log.h b/Plugins/SequencePlugin/Source/SequencePlugin/Private/Util/Log.h index 2033bac55..74f7256d1 100644 --- a/Plugins/SequencePlugin/Source/SequencePlugin/Private/Util/Log.h +++ b/Plugins/SequencePlugin/Source/SequencePlugin/Private/Util/Log.h @@ -1,5 +1,6 @@ // Copyright 2024 Horizon Blockchain Games Inc. All rights reserved. #pragma once +#include "CoreMinimal.h" DECLARE_LOG_CATEGORY_EXTERN(LogSequence, Log, All); DECLARE_LOG_CATEGORY_EXTERN(LogSequenceEditor, Log, All); From 99a5cd390899df36047e8ca4b661f7fc94c48873 Mon Sep 17 00:00:00 2001 From: CalvinKork Date: Wed, 25 Sep 2024 09:40:02 -0500 Subject: [PATCH 6/8] Fixing includes on mobile --- .../SequencePlugin/Public/Indexer/Structs/SeqAttributeMap.h | 1 + .../Public/Indexer/Structs/SeqGetBalanceUpdatesReturn.h | 2 ++ .../Public/Indexer/Structs/SeqGetTokenBalancesReturn.h | 2 ++ .../Public/Indexer/Structs/SeqGetTokenSuppliesArgs.h | 1 - .../Public/Indexer/Structs/SeqGetTokenSuppliesMapArgs.h | 2 ++ .../Public/Indexer/Structs/SeqGetTokenSuppliesMapReturn.h | 3 ++- .../Public/Indexer/Structs/SeqGetTokenSuppliesReturn.h | 2 ++ .../Public/Indexer/Structs/SeqGetTransactionHistoryArgs.h | 1 + .../Public/Indexer/Structs/SeqGetTransactionHistoryReturn.h | 2 ++ .../Source/SequencePlugin/Public/Indexer/Structs/SeqPage.h | 1 + .../SequencePlugin/Public/Indexer/Structs/SeqPingReturn.h | 1 + .../SequencePlugin/Public/Indexer/Structs/SeqTokenBalance.h | 1 + .../SequencePlugin/Public/Indexer/Structs/SeqTokenMetaData.h | 2 ++ .../SequencePlugin/Public/Indexer/Structs/SeqTokenSupply.h | 1 + .../SequencePlugin/Public/Indexer/Structs/SeqTokenSupplyList.h | 2 ++ .../SequencePlugin/Public/Indexer/Structs/SeqTransaction.h | 2 ++ .../SequencePlugin/Public/Indexer/Structs/SeqTxnTransfer.h | 2 ++ 17 files changed, 26 insertions(+), 2 deletions(-) diff --git a/Plugins/SequencePlugin/Source/SequencePlugin/Public/Indexer/Structs/SeqAttributeMap.h b/Plugins/SequencePlugin/Source/SequencePlugin/Public/Indexer/Structs/SeqAttributeMap.h index 7f42b2859..8b9f84a35 100644 --- a/Plugins/SequencePlugin/Source/SequencePlugin/Public/Indexer/Structs/SeqAttributeMap.h +++ b/Plugins/SequencePlugin/Source/SequencePlugin/Public/Indexer/Structs/SeqAttributeMap.h @@ -3,6 +3,7 @@ #include "CoreMinimal.h" #include "Util/SequenceSupport.h" +#include "Dom/JsonObject.h" #include "SeqAttributeMap.generated.h" /* diff --git a/Plugins/SequencePlugin/Source/SequencePlugin/Public/Indexer/Structs/SeqGetBalanceUpdatesReturn.h b/Plugins/SequencePlugin/Source/SequencePlugin/Public/Indexer/Structs/SeqGetBalanceUpdatesReturn.h index 076bd6bc3..d889467f6 100644 --- a/Plugins/SequencePlugin/Source/SequencePlugin/Public/Indexer/Structs/SeqGetBalanceUpdatesReturn.h +++ b/Plugins/SequencePlugin/Source/SequencePlugin/Public/Indexer/Structs/SeqGetBalanceUpdatesReturn.h @@ -4,6 +4,8 @@ #include "CoreMinimal.h" #include "SeqPage.h" #include "SeqTokenBalance.h" +#include "Dom/JsonObject.h" +#include "Dom/JsonValue.h" #include "SeqGetBalanceUpdatesReturn.generated.h" USTRUCT(BlueprintType) diff --git a/Plugins/SequencePlugin/Source/SequencePlugin/Public/Indexer/Structs/SeqGetTokenBalancesReturn.h b/Plugins/SequencePlugin/Source/SequencePlugin/Public/Indexer/Structs/SeqGetTokenBalancesReturn.h index d8522d49c..c75eed387 100644 --- a/Plugins/SequencePlugin/Source/SequencePlugin/Public/Indexer/Structs/SeqGetTokenBalancesReturn.h +++ b/Plugins/SequencePlugin/Source/SequencePlugin/Public/Indexer/Structs/SeqGetTokenBalancesReturn.h @@ -5,6 +5,8 @@ #include "SeqPage.h" #include "Util/SequenceSupport.h" #include "SeqTokenBalance.h" +#include "Dom/JsonObject.h" +#include "Dom/JsonValue.h" #include "SeqGetTokenBalancesReturn.generated.h" USTRUCT(BlueprintType) diff --git a/Plugins/SequencePlugin/Source/SequencePlugin/Public/Indexer/Structs/SeqGetTokenSuppliesArgs.h b/Plugins/SequencePlugin/Source/SequencePlugin/Public/Indexer/Structs/SeqGetTokenSuppliesArgs.h index 5423bd35a..448c9db97 100644 --- a/Plugins/SequencePlugin/Source/SequencePlugin/Public/Indexer/Structs/SeqGetTokenSuppliesArgs.h +++ b/Plugins/SequencePlugin/Source/SequencePlugin/Public/Indexer/Structs/SeqGetTokenSuppliesArgs.h @@ -2,7 +2,6 @@ #pragma once #include "CoreMinimal.h" -#include "SeqPage.h" #include "SeqGetTokenSuppliesArgs.generated.h" USTRUCT(BlueprintType) diff --git a/Plugins/SequencePlugin/Source/SequencePlugin/Public/Indexer/Structs/SeqGetTokenSuppliesMapArgs.h b/Plugins/SequencePlugin/Source/SequencePlugin/Public/Indexer/Structs/SeqGetTokenSuppliesMapArgs.h index 80c352652..87e434c47 100644 --- a/Plugins/SequencePlugin/Source/SequencePlugin/Public/Indexer/Structs/SeqGetTokenSuppliesMapArgs.h +++ b/Plugins/SequencePlugin/Source/SequencePlugin/Public/Indexer/Structs/SeqGetTokenSuppliesMapArgs.h @@ -5,6 +5,8 @@ #include "SeqTokenList.h" #include "Util/SequenceSupport.h" #include "JsonObjectConverter.h" +#include "Dom/JsonObject.h" +#include "Dom/JsonValue.h" #include "SeqGetTokenSuppliesMapArgs.generated.h" USTRUCT(BlueprintType) diff --git a/Plugins/SequencePlugin/Source/SequencePlugin/Public/Indexer/Structs/SeqGetTokenSuppliesMapReturn.h b/Plugins/SequencePlugin/Source/SequencePlugin/Public/Indexer/Structs/SeqGetTokenSuppliesMapReturn.h index 2f7afac08..ca097ddcd 100644 --- a/Plugins/SequencePlugin/Source/SequencePlugin/Public/Indexer/Structs/SeqGetTokenSuppliesMapReturn.h +++ b/Plugins/SequencePlugin/Source/SequencePlugin/Public/Indexer/Structs/SeqGetTokenSuppliesMapReturn.h @@ -2,9 +2,10 @@ #pragma once #include "CoreMinimal.h" -#include "SeqTokenSupply.h" #include "SeqTokenSupplyList.h" #include "JsonObjectConverter.h" +#include "Dom/JsonObject.h" +#include "Dom/JsonValue.h" #include "SeqGetTokenSuppliesMapReturn.generated.h" USTRUCT(BlueprintType) diff --git a/Plugins/SequencePlugin/Source/SequencePlugin/Public/Indexer/Structs/SeqGetTokenSuppliesReturn.h b/Plugins/SequencePlugin/Source/SequencePlugin/Public/Indexer/Structs/SeqGetTokenSuppliesReturn.h index 886eff293..259e78536 100644 --- a/Plugins/SequencePlugin/Source/SequencePlugin/Public/Indexer/Structs/SeqGetTokenSuppliesReturn.h +++ b/Plugins/SequencePlugin/Source/SequencePlugin/Public/Indexer/Structs/SeqGetTokenSuppliesReturn.h @@ -5,6 +5,8 @@ #include "SeqPage.h" #include "Indexer/Indexer_Enums.h" #include "SeqTokenSupply.h" +#include "Dom/JsonObject.h" +#include "Dom/JsonValue.h" #include "SeqGetTokenSuppliesReturn.generated.h" USTRUCT(BlueprintType) diff --git a/Plugins/SequencePlugin/Source/SequencePlugin/Public/Indexer/Structs/SeqGetTransactionHistoryArgs.h b/Plugins/SequencePlugin/Source/SequencePlugin/Public/Indexer/Structs/SeqGetTransactionHistoryArgs.h index a9d640f12..9f2c80d1b 100644 --- a/Plugins/SequencePlugin/Source/SequencePlugin/Public/Indexer/Structs/SeqGetTransactionHistoryArgs.h +++ b/Plugins/SequencePlugin/Source/SequencePlugin/Public/Indexer/Structs/SeqGetTransactionHistoryArgs.h @@ -4,6 +4,7 @@ #include "CoreMinimal.h" #include "SeqPage.h" #include "SeqTransactionHistoryFilter.h" +#include "Dom/JsonObject.h" #include "SeqGetTransactionHistoryArgs.generated.h" USTRUCT(BlueprintType) diff --git a/Plugins/SequencePlugin/Source/SequencePlugin/Public/Indexer/Structs/SeqGetTransactionHistoryReturn.h b/Plugins/SequencePlugin/Source/SequencePlugin/Public/Indexer/Structs/SeqGetTransactionHistoryReturn.h index c44ed1156..1fcfda4e1 100644 --- a/Plugins/SequencePlugin/Source/SequencePlugin/Public/Indexer/Structs/SeqGetTransactionHistoryReturn.h +++ b/Plugins/SequencePlugin/Source/SequencePlugin/Public/Indexer/Structs/SeqGetTransactionHistoryReturn.h @@ -4,6 +4,8 @@ #include "CoreMinimal.h" #include "SeqPage.h" #include "SeqTransaction.h" +#include "Dom/JsonObject.h" +#include "Dom/JsonValue.h" #include "SeqGetTransactionHistoryReturn.generated.h" USTRUCT(BlueprintType) diff --git a/Plugins/SequencePlugin/Source/SequencePlugin/Public/Indexer/Structs/SeqPage.h b/Plugins/SequencePlugin/Source/SequencePlugin/Public/Indexer/Structs/SeqPage.h index dea83c7f6..10442eb5a 100644 --- a/Plugins/SequencePlugin/Source/SequencePlugin/Public/Indexer/Structs/SeqPage.h +++ b/Plugins/SequencePlugin/Source/SequencePlugin/Public/Indexer/Structs/SeqPage.h @@ -4,6 +4,7 @@ #include "CoreMinimal.h" #include "Util/SequenceSupport.h" #include "SeqSortBy.h" +#include "Dom/JsonObject.h" #include "SeqPage.generated.h" USTRUCT(BlueprintType) diff --git a/Plugins/SequencePlugin/Source/SequencePlugin/Public/Indexer/Structs/SeqPingReturn.h b/Plugins/SequencePlugin/Source/SequencePlugin/Public/Indexer/Structs/SeqPingReturn.h index aaecf4bcb..cd89557a9 100644 --- a/Plugins/SequencePlugin/Source/SequencePlugin/Public/Indexer/Structs/SeqPingReturn.h +++ b/Plugins/SequencePlugin/Source/SequencePlugin/Public/Indexer/Structs/SeqPingReturn.h @@ -2,6 +2,7 @@ #pragma once #include "CoreMinimal.h" +#include "Dom/JsonObject.h" #include "SeqPingReturn.generated.h" USTRUCT(BlueprintType) diff --git a/Plugins/SequencePlugin/Source/SequencePlugin/Public/Indexer/Structs/SeqTokenBalance.h b/Plugins/SequencePlugin/Source/SequencePlugin/Public/Indexer/Structs/SeqTokenBalance.h index c12f242b4..92ddc6198 100644 --- a/Plugins/SequencePlugin/Source/SequencePlugin/Public/Indexer/Structs/SeqTokenBalance.h +++ b/Plugins/SequencePlugin/Source/SequencePlugin/Public/Indexer/Structs/SeqTokenBalance.h @@ -5,6 +5,7 @@ #include "Indexer/Indexer_Enums.h" #include "SeqContractInfo.h" #include "SeqTokenMetaData.h" +#include "Dom/JsonObject.h" #include "SeqTokenBalance.generated.h" USTRUCT(BlueprintType) diff --git a/Plugins/SequencePlugin/Source/SequencePlugin/Public/Indexer/Structs/SeqTokenMetaData.h b/Plugins/SequencePlugin/Source/SequencePlugin/Public/Indexer/Structs/SeqTokenMetaData.h index 1f51e32b9..b9be601ba 100644 --- a/Plugins/SequencePlugin/Source/SequencePlugin/Public/Indexer/Structs/SeqTokenMetaData.h +++ b/Plugins/SequencePlugin/Source/SequencePlugin/Public/Indexer/Structs/SeqTokenMetaData.h @@ -4,6 +4,8 @@ #include "CoreMinimal.h" #include "Indexer/Structs/SeqAttributeMap.h" #include "Util/SequenceSupport.h" +#include "Dom/JsonObject.h" +#include "Dom/JsonValue.h" #include "SeqTokenMetaData.generated.h" USTRUCT(BlueprintType) diff --git a/Plugins/SequencePlugin/Source/SequencePlugin/Public/Indexer/Structs/SeqTokenSupply.h b/Plugins/SequencePlugin/Source/SequencePlugin/Public/Indexer/Structs/SeqTokenSupply.h index c4e4d8042..936c69807 100644 --- a/Plugins/SequencePlugin/Source/SequencePlugin/Public/Indexer/Structs/SeqTokenSupply.h +++ b/Plugins/SequencePlugin/Source/SequencePlugin/Public/Indexer/Structs/SeqTokenSupply.h @@ -4,6 +4,7 @@ #include "CoreMinimal.h" #include "SeqContractInfo.h" #include "SeqTokenMetaData.h" +#include "Dom/JsonObject.h" #include "SeqTokenSupply.generated.h" USTRUCT(BlueprintType) diff --git a/Plugins/SequencePlugin/Source/SequencePlugin/Public/Indexer/Structs/SeqTokenSupplyList.h b/Plugins/SequencePlugin/Source/SequencePlugin/Public/Indexer/Structs/SeqTokenSupplyList.h index 08527ecd4..a2c4bab5e 100644 --- a/Plugins/SequencePlugin/Source/SequencePlugin/Public/Indexer/Structs/SeqTokenSupplyList.h +++ b/Plugins/SequencePlugin/Source/SequencePlugin/Public/Indexer/Structs/SeqTokenSupplyList.h @@ -3,6 +3,8 @@ #include "CoreMinimal.h" #include "SeqTokenSupply.h" +#include "Dom/JsonObject.h" +#include "Dom/JsonValue.h" #include "SeqTokenSupplyList.generated.h" diff --git a/Plugins/SequencePlugin/Source/SequencePlugin/Public/Indexer/Structs/SeqTransaction.h b/Plugins/SequencePlugin/Source/SequencePlugin/Public/Indexer/Structs/SeqTransaction.h index 141b7d5fd..949f37c74 100644 --- a/Plugins/SequencePlugin/Source/SequencePlugin/Public/Indexer/Structs/SeqTransaction.h +++ b/Plugins/SequencePlugin/Source/SequencePlugin/Public/Indexer/Structs/SeqTransaction.h @@ -3,6 +3,8 @@ #include "CoreMinimal.h" #include "SeqTxnTransfer.h" +#include "Dom/JsonObject.h" +#include "Dom/JsonValue.h" #include "SeqTransaction.generated.h" USTRUCT(BlueprintType) diff --git a/Plugins/SequencePlugin/Source/SequencePlugin/Public/Indexer/Structs/SeqTxnTransfer.h b/Plugins/SequencePlugin/Source/SequencePlugin/Public/Indexer/Structs/SeqTxnTransfer.h index 5d52cb41f..f4a0fb706 100644 --- a/Plugins/SequencePlugin/Source/SequencePlugin/Public/Indexer/Structs/SeqTxnTransfer.h +++ b/Plugins/SequencePlugin/Source/SequencePlugin/Public/Indexer/Structs/SeqTxnTransfer.h @@ -5,6 +5,8 @@ #include "SeqTokenMetaData.h" #include "Indexer/Indexer_Enums.h" #include "SeqContractInfo.h" +#include "Dom/JsonObject.h" +#include "Dom/JsonValue.h" #include "SeqTxnTransfer.generated.h" From 67b1550bc8cc812a1336903aa0c1a7cb797d995b Mon Sep 17 00:00:00 2001 From: CalvinKork Date: Wed, 25 Sep 2024 09:51:10 -0500 Subject: [PATCH 7/8] Adding X-Access-Key to the indexer headers list to avoid rate limits --- .../Source/SequencePlugin/Private/Indexer/Indexer.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Plugins/SequencePlugin/Source/SequencePlugin/Private/Indexer/Indexer.cpp b/Plugins/SequencePlugin/Source/SequencePlugin/Private/Indexer/Indexer.cpp index 7609d408f..1c73d9803 100644 --- a/Plugins/SequencePlugin/Source/SequencePlugin/Private/Indexer/Indexer.cpp +++ b/Plugins/SequencePlugin/Source/SequencePlugin/Private/Indexer/Indexer.cpp @@ -1,6 +1,7 @@ // Copyright 2024 Horizon Blockchain Games Inc. All rights reserved. #include "Indexer/Indexer.h" +#include "ConfigFetcher.h" #include "Util/Async.h" #include "JsonObjectConverter.h" #include "Http.h" @@ -49,6 +50,7 @@ void UIndexer::HTTPPost(const int64& ChainID,const FString& Endpoint,const FStri HTTP_Post_Req->SetVerb("POST"); HTTP_Post_Req->SetHeader("Content-Type", "application/json");//2 differing headers for the request HTTP_Post_Req->SetHeader("Accept", "application/json"); + HTTP_Post_Req->SetHeader("X-Access-Key",UConfigFetcher::GetConfigVar(UConfigFetcher::ProjectAccessKey)); HTTP_Post_Req->SetTimeout(30); HTTP_Post_Req->SetURL(Url); HTTP_Post_Req->SetContentAsString(Args); From 0e5cc5b9d351a6337577d75cca7607ba1bc72604 Mon Sep 17 00:00:00 2001 From: CalvinKork Date: Wed, 25 Sep 2024 12:09:34 -0500 Subject: [PATCH 8/8] Updating versioning in preparations for a release --- Plugins/SequencePlugin/SequencePlugin.uplugin | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Plugins/SequencePlugin/SequencePlugin.uplugin b/Plugins/SequencePlugin/SequencePlugin.uplugin index 4d18f5c34..b6f0a725e 100644 --- a/Plugins/SequencePlugin/SequencePlugin.uplugin +++ b/Plugins/SequencePlugin/SequencePlugin.uplugin @@ -1,8 +1,8 @@ { "EngineVersion":"5.4", "FileVersion": 3, - "Version": 2, - "VersionName": "1.1", + "Version": 3, + "VersionName": "1.3", "FriendlyName": "SequencePlugin", "Description": "", "Category": "Sequence",