Skip to content

Commit 3b6dd66

Browse files
feat: added transak widget (#158)
* 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]>
1 parent 7cebc7e commit 3b6dd66

21 files changed

+721
-87
lines changed

.github/workflows/branch-name.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ jobs:
99
- uses: deepakputhraya/action-branch-name@master
1010
with:
1111
regex: '([a-z])*\/?([a-z0-9.-])+'
12-
allowed_prefixes: 'feat,fix,build,chore,ci,docs,style,refactor,perf,test,revert,release'
1312
ignore: main
1413
min_length: 5
1514
max_length: 50
Binary file not shown.
Binary file not shown.

Immutable.uplugin

Lines changed: 59 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,60 @@
1-
{
2-
"FileVersion": 3,
3-
"Version": 1,
4-
"VersionName": "1.3.0.alpha",
5-
"FriendlyName": "Immutable",
6-
"Description": "",
7-
"Category": "Other",
8-
"CreatedBy": "",
9-
"CreatedByURL": "",
10-
"DocsURL": "",
11-
"MarketplaceURL": "",
12-
"SupportURL": "",
13-
"EnabledByDefault": true,
14-
"CanContainContent": true,
15-
"IsBetaVersion": true,
16-
"IsExperimentalVersion": true,
17-
"Installed": true,
18-
"Modules": [
19-
{
20-
"Name": "Immutable",
21-
"Type": "Runtime",
22-
"LoadingPhase": "Default"
23-
},
24-
{
25-
"Name": "ImmutableEditor",
26-
"Type": "Editor",
27-
"LoadingPhase": "Default"
28-
},
29-
{
30-
"Name": "ImmutablePluginManager",
31-
"Type": "Runtime",
32-
"LoadingPhase": "EarliestPossible"
33-
},
34-
{
35-
"Name": "ImmutableOrderbook",
36-
"Type": "Runtime",
37-
"LoadingPhase": "Default"
38-
},
39-
{
40-
"Name": "ImmutablezkEVMAPI",
41-
"Type": "Runtime",
42-
"LoadingPhase": "Default"
43-
}
44-
]
1+
{
2+
"FileVersion": 3,
3+
"Version": 1,
4+
"VersionName": "1.3.0.alpha",
5+
"FriendlyName": "Immutable",
6+
"Description": "",
7+
"Category": "Other",
8+
"CreatedBy": "",
9+
"CreatedByURL": "",
10+
"DocsURL": "",
11+
"MarketplaceURL": "",
12+
"SupportURL": "",
13+
"EnabledByDefault": true,
14+
"CanContainContent": true,
15+
"IsBetaVersion": true,
16+
"IsExperimentalVersion": true,
17+
"Installed": true,
18+
"Modules": [
19+
{
20+
"Name": "Immutable",
21+
"Type": "Runtime",
22+
"LoadingPhase": "Default"
23+
},
24+
{
25+
"Name": "ImmutableEditor",
26+
"Type": "Editor",
27+
"LoadingPhase": "Default"
28+
},
29+
{
30+
"Name": "ImmutablePluginManager",
31+
"Type": "Runtime",
32+
"LoadingPhase": "EarliestPossible"
33+
},
34+
{
35+
"Name": "ImmutableOrderbook",
36+
"Type": "Runtime",
37+
"LoadingPhase": "Default"
38+
},
39+
{
40+
"Name": "ImmutablezkEVMAPI",
41+
"Type": "Runtime",
42+
"LoadingPhase": "Default"
43+
},
44+
{
45+
"Name": "ImmutableMarketplace",
46+
"Type": "Runtime",
47+
"LoadingPhase": "Default"
48+
}
49+
],
50+
"Plugins": [
51+
{
52+
"Name": "BLUI",
53+
"Enabled": true
54+
},
55+
{
56+
"Name": "WebBrowserWidget",
57+
"Enabled": false
58+
}
59+
]
4560
}

Source/Immutable/Immutable.Build.cs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public Immutable(ReadOnlyTargetRules Target) : base(Target)
1919
new string[]
2020
{
2121
"Core",
22-
"JsonUtilities",
22+
"JsonUtilities",
2323
}
2424
);
2525

@@ -34,19 +34,27 @@ public Immutable(ReadOnlyTargetRules Target) : base(Target)
3434
"UMG",
3535
"Projects",
3636
"DeveloperSettings",
37+
"HTTP",
3738
}
3839
);
3940

40-
#if UE_5_0_OR_LATER
41-
PublicDependencyModuleNames.Add("WebBrowserWidget");
41+
#if UE_5_1_OR_LATER
42+
PublicDependencyModuleNames.AddRange(
43+
new string[]
44+
{
45+
"WebBrowser",
46+
"WebBrowserWidget"
47+
}
48+
);
4249
#else
50+
PrivateDependencyModuleNames.Add("BluExtension");
4351
if (Target.Platform == UnrealTargetPlatform.Win64)
4452
{
4553
PublicDependencyModuleNames.Add("Blu");
4654
}
4755
#endif
4856

49-
#if UE_5_0_OR_LATER
57+
#if UE_5_1_OR_LATER
5058
PrivateDependencyModuleNames.Add("WebBrowser");
5159
PublicDefinitions.Add("USING_BUNDLED_CEF=1");
5260
PublicDefinitions.Add("USING_BLUI_CEF=0");

Source/Immutable/Private/Immutable/ImmutablePassport.cpp

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,11 @@
44

55
#include "ImmutableAnalytics.h"
66
#include "Immutable/Misc/ImtblLogging.h"
7-
#include "Immutable/ImmutableResponses.h"
87
#include "Immutable/ImtblJSConnector.h"
98
#include "JsonObjectConverter.h"
109
#include "Immutable/ImmutableSaveGame.h"
11-
#include "Immutable/ImmutableUtilities.h"
10+
#include "Immutable/ImmutableSettings.h"
1211
#include "Kismet/GameplayStatics.h"
13-
#include "Policies/CondensedJsonPrintPolicy.h"
1412

1513
#if PLATFORM_ANDROID | PLATFORM_IOS | PLATFORM_MAC
1614
#include "GenericPlatform/GenericPlatformHttp.h"
@@ -49,8 +47,17 @@ void UImmutablePassport::Initialize(const FImmutablePassportInitData& Data, cons
4947
void UImmutablePassport::Initialize(const FImtblPassportResponseDelegate& ResponseDelegate)
5048
{
5149
check(JSConnector.IsValid());
50+
51+
auto Settings = GetDefault<UImmutableSettings>();
52+
53+
if (Settings)
54+
{
55+
ResponseDelegate.ExecuteIfBound(FImmutablePassportResult{false, "Failed to find Immutable Settings"});
56+
57+
return;
58+
}
5259

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

5562
if (!ApplicationConfig)
5663
{
@@ -60,7 +67,7 @@ void UImmutablePassport::Initialize(const FImtblPassportResponseDelegate& Respon
6067
}
6168

6269
InitData.clientId = ApplicationConfig->GetClientID();
63-
InitData.environment = ApplicationConfig->GetEnvironment();
70+
InitData.environment = ApplicationConfig->GetEnvironmentString();
6471
InitData.redirectUri = ApplicationConfig->GetRedirectURL();
6572
InitData.logoutRedirectUri = ApplicationConfig->GetLogoutURL();
6673

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#include "Immutable/ImmutableUtilities.h"
22

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

2120
return false;
2221
}
23-
24-
UApplicationConfig* FImmutableUtilities::GetDefaultApplicationConfig()
25-
{
26-
auto Settings = GetDefault<UImmutablePluginSettings>();
27-
28-
if (!Settings)
29-
{
30-
return nullptr;
31-
}
32-
33-
return Settings->DefaultApplicationConfig.GetDefaultObject();
34-
}

Source/Immutable/Private/Immutable/Tests/ImtblMessagesTest.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ bool FImtblMessagesTest::RunTest(const FString& Parameters)
4040
// string
4141
{
4242
const FString RedirectUri = "https://example.com";
43-
const FImmutablePassportInitData InitData{ClientId, RedirectUri, ImmutablePassportAction::EnvSandbox};
43+
const FImmutablePassportInitData InitData { ClientId, RedirectUri, ImmutablePassportEnvironmentConstants::EnvironmentSandbox };
4444
FString ExpectedJson = "{\"clientId\":\"MyExampleClientId\",\"redirectUri\":\"https://" "example.com\",\"environment\":\"sandbox\"";
4545
ExpectedJson += ",\"engineVersion\":{";
4646
ExpectedJson += "\"engine\":\"unreal\"";
@@ -57,7 +57,7 @@ bool FImtblMessagesTest::RunTest(const FString& Parameters)
5757
// an FImmutablePassportInitData with an empty redirectUri should leave the
5858
// redirectUri field out of the json string when converted
5959
{
60-
const FImmutablePassportInitData InitData{ClientId, "", ImmutablePassportAction::EnvSandbox};
60+
const FImmutablePassportInitData InitData { ClientId, "", ImmutablePassportEnvironmentConstants::EnvironmentSandbox };
6161
FString ExpectedJson = "{\"clientId\":\"MyExampleClientId\",\"environment\":\"sandbox\"";
6262
ExpectedJson += ",\"engineVersion\":{";
6363
ExpectedJson += "\"engine\":\"unreal\"";

Source/Immutable/Public/Immutable/ApplicationConfig.h

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
#pragma once
22

3+
#include "ImmutableEnums.h"
4+
#include "ImmutableNames.h"
5+
36
#include "ApplicationConfig.generated.h"
47

58
/**
@@ -9,7 +12,7 @@
912
* client IDs, and environment settings for the zkEVM API, Orderbook API, and Passport.
1013
*/
1114
UCLASS(Abstract, Blueprintable, ClassGroup = Immutable)
12-
class UApplicationConfig : public UObject
15+
class IMMUTABLE_API UApplicationConfig : public UObject
1316
{
1417
GENERATED_BODY()
1518

@@ -85,13 +88,20 @@ class UApplicationConfig : public UObject
8588
}
8689

8790
/**
88-
* Retrieves the environment configuration used for Passport initialization.
91+
* Retrieves the environment configuration used for Passport initialization as FString .
8992
*
9093
* @return A constant reference to an FString representing the environment.
9194
*/
92-
const FString& GetEnvironment()
95+
const FString& GetEnvironmentString() const
9396
{
94-
return Environment;
97+
switch (Environment)
98+
{
99+
case EPassportEnvironment::Production:
100+
return ImmutablePassportEnvironmentConstants::EnvironmentProduction;
101+
default:
102+
case EPassportEnvironment::Sandbox:
103+
return ImmutablePassportEnvironmentConstants::EnvironmentProduction;
104+
}
95105
}
96106

97107
/**
@@ -144,9 +154,12 @@ class UApplicationConfig : public UObject
144154
UPROPERTY(EditDefaultsOnly, Category = "Passport")
145155
FString ClientID;
146156

147-
/** Environment used to initialize passport. Ex. sandbox or production */
157+
/**
158+
* Environment used to initialize passport. Ex. sandbox or production.
159+
* @note The default environment is set to the Sandbox environment.
160+
*/
148161
UPROPERTY(EditDefaultsOnly, Category = "Passport")
149-
FString Environment;
162+
EPassportEnvironment Environment = EPassportEnvironment::Sandbox;
150163

151164
/**
152165
* (Android, iOS, and macOS only)

Source/Immutable/Public/Immutable/ImmutableDataTypes.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,11 @@ struct IMMUTABLE_API FImmutablePassportInitData
6161
UPROPERTY()
6262
FString logoutRedirectUri;
6363

64-
/** The environment to connect to. */
64+
/** The environment to connect to.
65+
* @note Default value is "sandbox"
66+
*/
6567
UPROPERTY()
66-
FString environment = ImmutablePassportAction::EnvSandbox;
68+
FString environment = ImmutablePassportEnvironmentConstants::EnvironmentSandbox;
6769

6870
/**
6971
* Whether silent logout is enabled.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#pragma once
2+
3+
UENUM(BlueprintType)
4+
enum class EPassportEnvironment : uint8
5+
{
6+
Development,
7+
Sandbox,
8+
Production,
9+
};
10+

Source/Immutable/Public/Immutable/ImmutableNames.h

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ namespace ImmutablePassportAction
2020

2121
#if PLATFORM_ANDROID | PLATFORM_IOS | PLATFORM_MAC
2222
const FString GetPKCEAuthUrl = TEXT("getPKCEAuthUrl");
23-
const FString LOGIN_PKCE = TEXT("loginPKCE");; //+
23+
const FString LOGIN_PKCE = TEXT("loginPKCE");
2424
const FString CONNECT_PKCE = TEXT("connectPKCE");
2525
#endif
2626

@@ -31,10 +31,14 @@ namespace ImmutablePassportAction
3131
const FString GetLinkedAddresses = TEXT("getLinkedAddresses");
3232
const FString ImxTransfer = TEXT("imxTransfer");
3333
const FString ImxBatchNftTransfer = TEXT("imxBatchNftTransfer");
34-
const FString EnvSandbox = TEXT("sandbox");
35-
const FString EnvProduction = TEXT("production");
3634
const FString ImxIsRegisteredOffchain = TEXT("isRegisteredOffchain");
3735
const FString ImxRegisterOffchain = TEXT("registerOffchain");
3836

3937
const FString TRACK = TEXT("track");
4038
} // namespace ImmutablePassportAction
39+
40+
namespace ImmutablePassportEnvironmentConstants
41+
{
42+
const FString EnvironmentSandbox = TEXT("sandbox");
43+
const FString EnvironmentProduction = TEXT("production");
44+
}

Source/Immutable/Public/Immutable/ImmutablePluginSettings.h renamed to Source/Immutable/Public/Immutable/ImmutableSettings.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@
33
#include "Engine/DeveloperSettings.h"
44
#include "ApplicationConfig.h"
55

6-
#include "ImmutablePluginSettings.generated.h"
6+
#include "ImmutableSettings.generated.h"
77

88

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

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

Source/Immutable/Public/Immutable/ImmutableUtilities.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#pragma once
2-
#include "ApplicationConfig.h"
32

43

54
/** A wrapper struct around various Immutable namespace utility and support methods. */
@@ -13,6 +12,4 @@ struct IMMUTABLE_API FImmutableUtilities
1312
* @return True if the game bridge content was sucessfully retrieved. Otherwise, false.
1413
*/
1514
static bool LoadGameBridge(FString& GameBridge);
16-
17-
static UApplicationConfig* GetDefaultApplicationConfig();
1815
};

0 commit comments

Comments
 (0)