Skip to content

Commit

Permalink
feat: added transak widget (#158)
Browse files Browse the repository at this point in the history
* feat: added transak config

* feat: added transak web widget and environment enum

* feat: added missing module

* fix: resolved compile issue with ue4

* fix: compiler issue with ue4

* chore: isolated source code for ue5

* chore: removed requirement of folder name in branch name (#157)

* feat: add 4.26 support to transak widget (#156)

* feat: added transak web widget and environment enum

* fix: resolved compile issue with ue4

* fix: compiler issue with ue4

* chore: isolated source code for ue5

* feat: add blu web browser to transak widget (#3498)

* refactor: apply formatting

* refactor: move include inside respective engine macro

* refactor: expose is ready to blueprint

* refactor: change private to protected

* refactor: reorder .h and .cpp functions to match each other

* chore: update loctext namespace

* fix: compile error

* chore: removed redundant code

* chore: removed prefixes

---------

Co-authored-by: Yermek Garifullanov <[email protected]>

* chore: added comments and moved to dedicated folder

* feat: added sample asset for transak widget

* fix: minor changes for consts and enums

* fix: resolved compile issues with ue 5.4

* refactor: added marketplace module and renamed transak widget

* refactor: added marketplace module to keep marketplace features such as on ramp widget

* chore: renamed transak widget to on ramp

* chore: change misleading transak wording

* chore: source code polish

* chore: add custom openapi template (#3423)

* fix: openapi generator unique items conflicting with array (#3423)

* chore: update openapi.json (#3423)

* refactor: to generate openapi with batch files (#3423)

* chore: manually update openapi files (#3423)

* feat: implement oneof for data models (#3518)

* feat: automate the process of updating zkevm repo when it's corresponding openapi changes (#3497)

* fix: linting errors for zkevm api scripts (#3522)

---------

Co-authored-by: ImmutableJeffrey <[email protected]>
  • Loading branch information
YermekG and ImmutableJeffrey authored Jan 20, 2025
1 parent 7cebc7e commit 3b6dd66
Show file tree
Hide file tree
Showing 21 changed files with 721 additions and 87 deletions.
1 change: 0 additions & 1 deletion .github/workflows/branch-name.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ jobs:
- uses: deepakputhraya/action-branch-name@master
with:
regex: '([a-z])*\/?([a-z0-9.-])+'
allowed_prefixes: 'feat,fix,build,chore,ci,docs,style,refactor,perf,test,revert,release'
ignore: main
min_length: 5
max_length: 50
Binary file not shown.
Binary file not shown.
103 changes: 59 additions & 44 deletions Immutable.uplugin
Original file line number Diff line number Diff line change
@@ -1,45 +1,60 @@
{
"FileVersion": 3,
"Version": 1,
"VersionName": "1.3.0.alpha",
"FriendlyName": "Immutable",
"Description": "",
"Category": "Other",
"CreatedBy": "",
"CreatedByURL": "",
"DocsURL": "",
"MarketplaceURL": "",
"SupportURL": "",
"EnabledByDefault": true,
"CanContainContent": true,
"IsBetaVersion": true,
"IsExperimentalVersion": true,
"Installed": true,
"Modules": [
{
"Name": "Immutable",
"Type": "Runtime",
"LoadingPhase": "Default"
},
{
"Name": "ImmutableEditor",
"Type": "Editor",
"LoadingPhase": "Default"
},
{
"Name": "ImmutablePluginManager",
"Type": "Runtime",
"LoadingPhase": "EarliestPossible"
},
{
"Name": "ImmutableOrderbook",
"Type": "Runtime",
"LoadingPhase": "Default"
},
{
"Name": "ImmutablezkEVMAPI",
"Type": "Runtime",
"LoadingPhase": "Default"
}
]
{
"FileVersion": 3,
"Version": 1,
"VersionName": "1.3.0.alpha",
"FriendlyName": "Immutable",
"Description": "",
"Category": "Other",
"CreatedBy": "",
"CreatedByURL": "",
"DocsURL": "",
"MarketplaceURL": "",
"SupportURL": "",
"EnabledByDefault": true,
"CanContainContent": true,
"IsBetaVersion": true,
"IsExperimentalVersion": true,
"Installed": true,
"Modules": [
{
"Name": "Immutable",
"Type": "Runtime",
"LoadingPhase": "Default"
},
{
"Name": "ImmutableEditor",
"Type": "Editor",
"LoadingPhase": "Default"
},
{
"Name": "ImmutablePluginManager",
"Type": "Runtime",
"LoadingPhase": "EarliestPossible"
},
{
"Name": "ImmutableOrderbook",
"Type": "Runtime",
"LoadingPhase": "Default"
},
{
"Name": "ImmutablezkEVMAPI",
"Type": "Runtime",
"LoadingPhase": "Default"
},
{
"Name": "ImmutableMarketplace",
"Type": "Runtime",
"LoadingPhase": "Default"
}
],
"Plugins": [
{
"Name": "BLUI",
"Enabled": true
},
{
"Name": "WebBrowserWidget",
"Enabled": false
}
]
}
16 changes: 12 additions & 4 deletions Source/Immutable/Immutable.Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public Immutable(ReadOnlyTargetRules Target) : base(Target)
new string[]
{
"Core",
"JsonUtilities",
"JsonUtilities",
}
);

Expand All @@ -34,19 +34,27 @@ public Immutable(ReadOnlyTargetRules Target) : base(Target)
"UMG",
"Projects",
"DeveloperSettings",
"HTTP",
}
);

#if UE_5_0_OR_LATER
PublicDependencyModuleNames.Add("WebBrowserWidget");
#if UE_5_1_OR_LATER
PublicDependencyModuleNames.AddRange(
new string[]
{
"WebBrowser",
"WebBrowserWidget"
}
);
#else
PrivateDependencyModuleNames.Add("BluExtension");
if (Target.Platform == UnrealTargetPlatform.Win64)
{
PublicDependencyModuleNames.Add("Blu");
}
#endif

#if UE_5_0_OR_LATER
#if UE_5_1_OR_LATER
PrivateDependencyModuleNames.Add("WebBrowser");
PublicDefinitions.Add("USING_BUNDLED_CEF=1");
PublicDefinitions.Add("USING_BLUI_CEF=0");
Expand Down
17 changes: 12 additions & 5 deletions Source/Immutable/Private/Immutable/ImmutablePassport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,11 @@

#include "ImmutableAnalytics.h"
#include "Immutable/Misc/ImtblLogging.h"
#include "Immutable/ImmutableResponses.h"
#include "Immutable/ImtblJSConnector.h"
#include "JsonObjectConverter.h"
#include "Immutable/ImmutableSaveGame.h"
#include "Immutable/ImmutableUtilities.h"
#include "Immutable/ImmutableSettings.h"
#include "Kismet/GameplayStatics.h"
#include "Policies/CondensedJsonPrintPolicy.h"

#if PLATFORM_ANDROID | PLATFORM_IOS | PLATFORM_MAC
#include "GenericPlatform/GenericPlatformHttp.h"
Expand Down Expand Up @@ -49,8 +47,17 @@ void UImmutablePassport::Initialize(const FImmutablePassportInitData& Data, cons
void UImmutablePassport::Initialize(const FImtblPassportResponseDelegate& ResponseDelegate)
{
check(JSConnector.IsValid());

auto Settings = GetDefault<UImmutableSettings>();

if (Settings)
{
ResponseDelegate.ExecuteIfBound(FImmutablePassportResult{false, "Failed to find Immutable Settings"});

return;
}

UApplicationConfig* ApplicationConfig = FImmutableUtilities::GetDefaultApplicationConfig();
UApplicationConfig* ApplicationConfig = Settings->DefaultApplicationConfig.GetDefaultObject();

if (!ApplicationConfig)
{
Expand All @@ -60,7 +67,7 @@ void UImmutablePassport::Initialize(const FImtblPassportResponseDelegate& Respon
}

InitData.clientId = ApplicationConfig->GetClientID();
InitData.environment = ApplicationConfig->GetEnvironment();
InitData.environment = ApplicationConfig->GetEnvironmentString();
InitData.redirectUri = ApplicationConfig->GetRedirectURL();
InitData.logoutRedirectUri = ApplicationConfig->GetLogoutURL();

Expand Down
13 changes: 0 additions & 13 deletions Source/Immutable/Private/Immutable/ImmutableUtilities.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#include "Immutable/ImmutableUtilities.h"

#include "Immutable/ImmutablePluginSettings.h"
#include "Immutable/Misc/ImtblLogging.h"
#include "Interfaces/IPluginManager.h"
#include "Misc/FileHelper.h"
Expand All @@ -20,15 +19,3 @@ bool FImmutableUtilities::LoadGameBridge(FString& GameBridge)

return false;
}

UApplicationConfig* FImmutableUtilities::GetDefaultApplicationConfig()
{
auto Settings = GetDefault<UImmutablePluginSettings>();

if (!Settings)
{
return nullptr;
}

return Settings->DefaultApplicationConfig.GetDefaultObject();
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ bool FImtblMessagesTest::RunTest(const FString& Parameters)
// string
{
const FString RedirectUri = "https://example.com";
const FImmutablePassportInitData InitData{ClientId, RedirectUri, ImmutablePassportAction::EnvSandbox};
const FImmutablePassportInitData InitData { ClientId, RedirectUri, ImmutablePassportEnvironmentConstants::EnvironmentSandbox };
FString ExpectedJson = "{\"clientId\":\"MyExampleClientId\",\"redirectUri\":\"https://" "example.com\",\"environment\":\"sandbox\"";
ExpectedJson += ",\"engineVersion\":{";
ExpectedJson += "\"engine\":\"unreal\"";
Expand All @@ -57,7 +57,7 @@ bool FImtblMessagesTest::RunTest(const FString& Parameters)
// an FImmutablePassportInitData with an empty redirectUri should leave the
// redirectUri field out of the json string when converted
{
const FImmutablePassportInitData InitData{ClientId, "", ImmutablePassportAction::EnvSandbox};
const FImmutablePassportInitData InitData { ClientId, "", ImmutablePassportEnvironmentConstants::EnvironmentSandbox };
FString ExpectedJson = "{\"clientId\":\"MyExampleClientId\",\"environment\":\"sandbox\"";
ExpectedJson += ",\"engineVersion\":{";
ExpectedJson += "\"engine\":\"unreal\"";
Expand Down
25 changes: 19 additions & 6 deletions Source/Immutable/Public/Immutable/ApplicationConfig.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#pragma once

#include "ImmutableEnums.h"
#include "ImmutableNames.h"

#include "ApplicationConfig.generated.h"

/**
Expand All @@ -9,7 +12,7 @@
* client IDs, and environment settings for the zkEVM API, Orderbook API, and Passport.
*/
UCLASS(Abstract, Blueprintable, ClassGroup = Immutable)
class UApplicationConfig : public UObject
class IMMUTABLE_API UApplicationConfig : public UObject
{
GENERATED_BODY()

Expand Down Expand Up @@ -85,13 +88,20 @@ class UApplicationConfig : public UObject
}

/**
* Retrieves the environment configuration used for Passport initialization.
* Retrieves the environment configuration used for Passport initialization as FString .
*
* @return A constant reference to an FString representing the environment.
*/
const FString& GetEnvironment()
const FString& GetEnvironmentString() const
{
return Environment;
switch (Environment)
{
case EPassportEnvironment::Production:
return ImmutablePassportEnvironmentConstants::EnvironmentProduction;
default:
case EPassportEnvironment::Sandbox:
return ImmutablePassportEnvironmentConstants::EnvironmentProduction;
}
}

/**
Expand Down Expand Up @@ -144,9 +154,12 @@ class UApplicationConfig : public UObject
UPROPERTY(EditDefaultsOnly, Category = "Passport")
FString ClientID;

/** Environment used to initialize passport. Ex. sandbox or production */
/**
* Environment used to initialize passport. Ex. sandbox or production.
* @note The default environment is set to the Sandbox environment.
*/
UPROPERTY(EditDefaultsOnly, Category = "Passport")
FString Environment;
EPassportEnvironment Environment = EPassportEnvironment::Sandbox;

/**
* (Android, iOS, and macOS only)
Expand Down
6 changes: 4 additions & 2 deletions Source/Immutable/Public/Immutable/ImmutableDataTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,11 @@ struct IMMUTABLE_API FImmutablePassportInitData
UPROPERTY()
FString logoutRedirectUri;

/** The environment to connect to. */
/** The environment to connect to.
* @note Default value is "sandbox"
*/
UPROPERTY()
FString environment = ImmutablePassportAction::EnvSandbox;
FString environment = ImmutablePassportEnvironmentConstants::EnvironmentSandbox;

/**
* Whether silent logout is enabled.
Expand Down
10 changes: 10 additions & 0 deletions Source/Immutable/Public/Immutable/ImmutableEnums.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#pragma once

UENUM(BlueprintType)
enum class EPassportEnvironment : uint8
{
Development,
Sandbox,
Production,
};

10 changes: 7 additions & 3 deletions Source/Immutable/Public/Immutable/ImmutableNames.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ namespace ImmutablePassportAction

#if PLATFORM_ANDROID | PLATFORM_IOS | PLATFORM_MAC
const FString GetPKCEAuthUrl = TEXT("getPKCEAuthUrl");
const FString LOGIN_PKCE = TEXT("loginPKCE");; //+
const FString LOGIN_PKCE = TEXT("loginPKCE");
const FString CONNECT_PKCE = TEXT("connectPKCE");
#endif

Expand All @@ -31,10 +31,14 @@ namespace ImmutablePassportAction
const FString GetLinkedAddresses = TEXT("getLinkedAddresses");
const FString ImxTransfer = TEXT("imxTransfer");
const FString ImxBatchNftTransfer = TEXT("imxBatchNftTransfer");
const FString EnvSandbox = TEXT("sandbox");
const FString EnvProduction = TEXT("production");
const FString ImxIsRegisteredOffchain = TEXT("isRegisteredOffchain");
const FString ImxRegisterOffchain = TEXT("registerOffchain");

const FString TRACK = TEXT("track");
} // namespace ImmutablePassportAction

namespace ImmutablePassportEnvironmentConstants
{
const FString EnvironmentSandbox = TEXT("sandbox");
const FString EnvironmentProduction = TEXT("production");
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
#include "Engine/DeveloperSettings.h"
#include "ApplicationConfig.h"

#include "ImmutablePluginSettings.generated.h"
#include "ImmutableSettings.generated.h"


/**
* ImmutablePluginSettings is a configuration class for the Immutable plugin.
* Immutable developer settings is a configuration class for the Immutable plugin.
* This class contains settings that can be adjusted to control the behavior
* of the Immutable plugin within the Unreal Engine environment.
*/
UCLASS(config = Game, defaultconfig, meta = (DisplayName = "Immutable Plugin Settings"))
class IMMUTABLE_API UImmutablePluginSettings : public UDeveloperSettings
UCLASS(config = Game, defaultconfig, meta = (DisplayName = "Immutable"))
class IMMUTABLE_API UImmutableSettings : public UDeveloperSettings
{
GENERATED_BODY()

Expand All @@ -22,4 +22,5 @@ class IMMUTABLE_API UImmutablePluginSettings : public UDeveloperSettings
/// which will be used as the default configuration for the application.
UPROPERTY(Config, EditAnywhere, BlueprintReadOnly, Category = "General")
TSubclassOf<UApplicationConfig> DefaultApplicationConfig;

};
3 changes: 0 additions & 3 deletions Source/Immutable/Public/Immutable/ImmutableUtilities.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#pragma once
#include "ApplicationConfig.h"


/** A wrapper struct around various Immutable namespace utility and support methods. */
Expand All @@ -13,6 +12,4 @@ struct IMMUTABLE_API FImmutableUtilities
* @return True if the game bridge content was sucessfully retrieved. Otherwise, false.
*/
static bool LoadGameBridge(FString& GameBridge);

static UApplicationConfig* GetDefaultApplicationConfig();
};
Loading

0 comments on commit 3b6dd66

Please sign in to comment.