Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
c84f73f
WIP
dirtycajunrice Sep 25, 2024
f952268
finish cpp portion of upgrade
dirtycajunrice Sep 25, 2024
5145136
Add Plugin icon
dirtycajunrice Sep 26, 2024
d44d0d3
Add editor module with editor toolbar button for quick access to sett…
dirtycajunrice Sep 26, 2024
e4cc1d3
additional updates for the widgets
dirtycajunrice Sep 26, 2024
36e9af6
push dev lib for windows
dirtycajunrice Sep 26, 2024
41dcf2e
re-added external browser as its own feature, with settings to enable…
dirtycajunrice Sep 27, 2024
2109ce2
add ecosystem wallets
dirtycajunrice Sep 30, 2024
8fcef37
add missing ecosystem calls
dirtycajunrice Sep 30, 2024
6682242
cleanup imports
dirtycajunrice Sep 30, 2024
98b70d6
Lib update
dirtycajunrice Oct 1, 2024
c2032ee
WIP
dirtycajunrice Oct 2, 2024
0591b79
Add preprocessor to change FHttpRequestHandler type pre-5.4
dirtycajunrice Oct 2, 2024
2dd97f8
Merge branch '1.4.0-dev' into 1.5.0-dev
dirtycajunrice Oct 2, 2024
1e031ad
Cleanup of docs, remove dangling enums/functions, fix a few bits of m…
dirtycajunrice Oct 3, 2024
1d23a0b
add node viewer
dirtycajunrice Oct 3, 2024
bae9245
WIP: Base and InApp C++ moved to Async
dirtycajunrice Oct 3, 2024
3de6d9c
add remaining c++ async
dirtycajunrice Oct 8, 2024
03af464
finish all unique async
dirtycajunrice Oct 8, 2024
29782ea
K2Node dynamic WIP
dirtycajunrice Oct 9, 2024
06e12bc
add Account Linking C++
dirtycajunrice Oct 10, 2024
d1edae9
WIP for create wallet node.
dirtycajunrice Oct 10, 2024
db2ffcb
clean up some commented code
dirtycajunrice Oct 10, 2024
b2174e3
first attempt at the logic assignment
dirtycajunrice Oct 10, 2024
d73d0cb
remove comment
dirtycajunrice Oct 11, 2024
6e6bf47
Finish Create Wallet
dirtycajunrice Oct 11, 2024
4fe60ab
Create Dynamic Sign in node
dirtycajunrice Oct 12, 2024
1c5319c
Merge branch 'main' into 1.5.0-dev
dirtycajunrice Oct 12, 2024
d15eb32
finish Sign message dynamic node, update all nodes, update examples
dirtycajunrice Oct 14, 2024
ce13b45
update default overlay
dirtycajunrice Oct 14, 2024
d10843a
add missing notify
dirtycajunrice Oct 14, 2024
64198c4
cleanup for win build
dirtycajunrice Oct 14, 2024
4a68920
add country codes. Update demos
dirtycajunrice Oct 15, 2024
e347e6b
Add game thread broadcast checks
dirtycajunrice Oct 15, 2024
0e03b93
Update binaries
dirtycajunrice Oct 16, 2024
3b65413
cleanup
dirtycajunrice Oct 16, 2024
19ea360
cleanup
dirtycajunrice Oct 16, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified Content/Defaults/WBP_Thirdweb_OAuthOverlay.uasset
Binary file not shown.
Binary file not shown.
Binary file modified Content/Examples/Widgets/BP_Thirdweb_OTPVerifyModal.uasset
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified Content/Examples/Widgets/WBP_Thirdweb_Guest.uasset
Binary file not shown.
Binary file modified Content/Examples/Widgets/WBP_Thirdweb_InApp.uasset
Binary file not shown.
Binary file modified Content/Examples/Widgets/WBP_Thirdweb_Smart.uasset
Binary file not shown.
Binary file modified Content/Examples/Widgets/WBP_Thirdweb_UI.uasset
Binary file not shown.
Binary file modified Content/ThirdwebMacroLibrary.uasset
Binary file not shown.
41 changes: 41 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
PYTHON_EXE ?= C:\Program Files\Python311\python.exe
BUILDS_DIR ?= E:\UnrealEngine\Thirdweb\PluginBuilds
BUILD_HOST_PLATFORM ?= false
UE_VERSION ?= 5.4
PLUGIN_VERSION ?= 1.3.0

# Determine the current OS in a platform-independent manner
ifeq ($(OS),Windows_NT)
SHELL := cmd.exe
TARGET_PLATFORMS ?= Win64+Android+Linux+LinuxArm64
PATH_SEP := \\
UE4CLI_CONFIG_DIR_BASE := %APPDATA%\ue4cli
else
UNAME_S := $(shell uname -s)
UE4CLI_CONFIG_DIR_BASE := ~/.config/ue4cli
PATH_SEP := /
ifeq ($(UNAME_S),Linux)
TARGET_PLATFORMS ?= Android+Linux+LinuxArm64
else ifeq ($(UNAME_S),darwin)
TARGET_PLATFORMS ?= IOS+Mac+TVOS+VisionOS
endif
endif

ifeq ($(BUILD_HOST_PLATFORM),false)
HOST_PLATFORM_FLAG := -NoHostPlatform
else
HOST_PLATFORM_FLAG :=
endif

UE4_EXE := $(PYTHON_EXE) -m ue4cli
UE4CLI_CONFIG_DIR := $(UE4CLI_CONFIG_DIR_BASE)$(PATH_SEP)$(UE_VERSION)

.PHONY: build
build:
$(UE4_EXE) setroot $(UE_ENGINE_DIR)
$(UE4_EXE) package $(HOST_PLATFORM_FLAG) -TargetPlatforms=$(TARGET_PLATFORMS) -Package=$(BUILDS_DIR)\\$(UE_VERSION)

.PHONY: compress
compress:
cd $(BUILDS_DIR)
pwsh -Command Compress-Archive -LiteralPath "$(BUILDS_DIR)\\$(UE_VERSION)\\Source", "$(BUILDS_DIR)\\$(UE_VERSION)\\Content", "$(BUILDS_DIR)\\$(UE_VERSION)\\Thirdweb.uplugin" -DestinationPath "$(BUILDS_DIR)\\ThirdwebSDK-$(PLUGIN_VERSION)-$(UE_VERSION).zip" -CompressionLevel Optimal
1 change: 0 additions & 1 deletion Scripts/BuildPlugin.bat
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
@echo off
CD /D ..
ue4 package -NoHostPlatform -TargetPlatforms=Win64+Android+Linux+LinuxArm64
4 changes: 2 additions & 2 deletions Source/ThirdParty/Android/libthirdweb.a
Git LFS file not shown
4 changes: 2 additions & 2 deletions Source/ThirdParty/IOS/libthirdweb.a
Git LFS file not shown
4 changes: 2 additions & 2 deletions Source/ThirdParty/IOS/libthirdweb.sim.a
Git LFS file not shown
4 changes: 2 additions & 2 deletions Source/ThirdParty/Linux/libthirdweb.a
Git LFS file not shown
4 changes: 2 additions & 2 deletions Source/ThirdParty/LinuxArm64/libthirdweb.a
Git LFS file not shown
4 changes: 2 additions & 2 deletions Source/ThirdParty/Mac/libthirdweb.a
Git LFS file not shown
4 changes: 2 additions & 2 deletions Source/ThirdParty/Win64/libthirdweb.lib
Git LFS file not shown
7 changes: 7 additions & 0 deletions Source/Thirdweb/Private/AsyncTasks/AsyncTaskThirdwebBase.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// Copyright (c) 2024 Thirdweb. All Rights Reserved.

#include "AsyncTasks/AsyncTaskThirdwebBase.h"

void UAsyncTaskThirdwebBase::Activate()
{
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
// Copyright (c) 2024 Thirdweb. All Rights Reserved.

#include "AsyncTasks/Wallets/InApp/AsyncTaskThirdwebGetLinkedAccounts.h"

#include "Components/SlateWrapperTypes.h"

void UAsyncTaskThirdwebGetLinkedAccounts::Activate()
{
InAppWallet.GetLinkedAccounts(BIND_UOBJECT_DELEGATE(FInAppWalletHandle::FGetLinkedAccountsDelegate, HandleResponse), BIND_UOBJECT_DELEGATE(FStringDelegate, HandleFailed));
}

UAsyncTaskThirdwebGetLinkedAccounts* UAsyncTaskThirdwebGetLinkedAccounts::GetLinkedAccounts(UObject* WorldContextObject, const FInAppWalletHandle& Wallet)
{
if (!WorldContextObject)
{
return nullptr;
}
NEW_TASK
Task->InAppWallet = Wallet;
Task->RegisterWithGameInstance(WorldContextObject);
return Task;
}

void UAsyncTaskThirdwebGetLinkedAccounts::HandleResponse(const TArray<FString>& LinkedAccounts)
{
if (IsInGameThread())
{
Success.Broadcast(LinkedAccounts, TEXT(""));
SetReadyToDestroy();
}
else
{
// Retry on the GameThread.
TWeakObjectPtr<UAsyncTaskThirdwebGetLinkedAccounts> WeakThis = this;
FFunctionGraphTask::CreateAndDispatchWhenReady([WeakThis, LinkedAccounts]()
{
if (WeakThis.IsValid())
{
WeakThis->HandleResponse(LinkedAccounts);
}
}, TStatId(), nullptr, ENamedThreads::GameThread);
}
}

void UAsyncTaskThirdwebGetLinkedAccounts::HandleFailed(const FString& Error)
{
if (IsInGameThread())
{
Failed.Broadcast({}, Error);
SetReadyToDestroy();
}
else
{
// Retry on the GameThread.
TWeakObjectPtr<UAsyncTaskThirdwebGetLinkedAccounts> WeakThis = this;
FFunctionGraphTask::CreateAndDispatchWhenReady([WeakThis, Error]()
{
if (WeakThis.IsValid())
{
WeakThis->HandleFailed(Error);
}
}, TStatId(), nullptr, ENamedThreads::GameThread);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
// Copyright (c) 2024 Thirdweb. All Rights Reserved.

#include "AsyncTasks/Wallets/InApp/AsyncTaskThirdwebInAppSignMessage.h"

#include "Components/SlateWrapperTypes.h"

void UAsyncTaskThirdwebInAppSignMessage::Activate()
{
InAppWallet.Sign(UnsignedMessage, BIND_UOBJECT_DELEGATE(FStringDelegate, HandleResponse), BIND_UOBJECT_DELEGATE(FStringDelegate, HandleFailed));
}

UAsyncTaskThirdwebInAppSignMessage* UAsyncTaskThirdwebInAppSignMessage::SignMessage(UObject* WorldContextObject, const FInAppWalletHandle& Wallet, const FString& Message)
{
if (!WorldContextObject)
{
return nullptr;
}
NEW_TASK
Task->InAppWallet = Wallet;
Task->UnsignedMessage = Message;
Task->RegisterWithGameInstance(WorldContextObject);
return Task;
}

void UAsyncTaskThirdwebInAppSignMessage::HandleResponse(const FString& SignedMessage)
{
if (IsInGameThread())
{
Success.Broadcast(SignedMessage, TEXT(""));
SetReadyToDestroy();
}
else
{
// Retry on the GameThread.
TWeakObjectPtr<UAsyncTaskThirdwebInAppSignMessage> WeakThis = this;
FFunctionGraphTask::CreateAndDispatchWhenReady([WeakThis, SignedMessage]()
{
if (WeakThis.IsValid())
{
WeakThis->HandleResponse(SignedMessage);
}
}, TStatId(), nullptr, ENamedThreads::GameThread);
}
}

void UAsyncTaskThirdwebInAppSignMessage::HandleFailed(const FString& Error)
{
if (IsInGameThread())
{
Failed.Broadcast(TEXT(""), Error);
SetReadyToDestroy();
}
else
{
// Retry on the GameThread.
TWeakObjectPtr<UAsyncTaskThirdwebInAppSignMessage> WeakThis = this;
FFunctionGraphTask::CreateAndDispatchWhenReady([WeakThis, Error]()
{
if (WeakThis.IsValid())
{
WeakThis->HandleFailed(Error);
}
}, TStatId(), nullptr, ENamedThreads::GameThread);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,28 +29,58 @@ UAsyncTaskThirdwebLoginWithOAuth* UAsyncTaskThirdwebLoginWithOAuth::LoginWithOAu
{
return nullptr;
}
UAsyncTaskThirdwebLoginWithOAuth* Task = NewObject<UAsyncTaskThirdwebLoginWithOAuth>(WorldContextObject);
NEW_TASK
Task->Wallet = Wallet;
Task->Browser = CreateWidget<UThirdwebOAuthBrowserUserWidget>(UGameplayStatics::GetGameInstance(WorldContextObject), UThirdwebOAuthBrowserUserWidget::StaticClass());
Task->RegisterWithGameInstance(WorldContextObject);
return Task;
}

void UAsyncTaskThirdwebLoginWithOAuth::HandleFailed(const FString& Error)
void UAsyncTaskThirdwebLoginWithOAuth::HandleAuthenticated(const FString& AuthResult)
{
Failed.Broadcast(Error);
Browser->RemoveFromParent();
SetReadyToDestroy();
Wallet.SignInWithOAuth(AuthResult, BIND_UOBJECT_DELEGATE(FSimpleDelegate, HandleSignedIn), BIND_UOBJECT_DELEGATE(FStringDelegate, HandleFailed));
}

void UAsyncTaskThirdwebLoginWithOAuth::HandleAuthenticated(const FString& AuthResult)
void UAsyncTaskThirdwebLoginWithOAuth::HandleSignedIn()
{
if (FString Error; !Wallet.SignInWithOAuth(AuthResult, Error))
if (IsInGameThread())
{
return HandleFailed(Error);
Success.Broadcast(TEXT(""));
Browser->RemoveFromParent();
SetReadyToDestroy();
}
else
{
// Retry on the GameThread.
TWeakObjectPtr<UAsyncTaskThirdwebLoginWithOAuth> WeakThis = this;
FFunctionGraphTask::CreateAndDispatchWhenReady([WeakThis]()
{
if (WeakThis.IsValid())
{
WeakThis->HandleSignedIn();
}
}, TStatId(), nullptr, ENamedThreads::GameThread);
}
Success.Broadcast(TEXT(""));
Browser->RemoveFromParent();
SetReadyToDestroy();
}

void UAsyncTaskThirdwebLoginWithOAuth::HandleFailed(const FString& Error)
{
if (IsInGameThread())
{
Browser->RemoveFromParent();
Failed.Broadcast(TEXT(""));
SetReadyToDestroy();
}
else
{
// Retry on the GameThread.
TWeakObjectPtr<UAsyncTaskThirdwebLoginWithOAuth> WeakThis = this;
FFunctionGraphTask::CreateAndDispatchWhenReady([WeakThis, Error]()
{
if (WeakThis.IsValid())
{
WeakThis->HandleFailed(Error);
}
}, TStatId(), nullptr, ENamedThreads::GameThread);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
// Copyright (c) 2024 Thirdweb. All Rights Reserved.

#include "AsyncTasks/Wallets/InApp/AsyncTaskThirdwebSendOTP.h"

#include "Components/SlateWrapperTypes.h"

void UAsyncTaskThirdwebSendOTP::Activate()
{
InAppWallet.SendOTP(BIND_UOBJECT_DELEGATE(FStreamableDelegate, HandleResponse), BIND_UOBJECT_DELEGATE(FStringDelegate, HandleFailed));
}

UAsyncTaskThirdwebSendOTP* UAsyncTaskThirdwebSendOTP::SendOTP(UObject* WorldContextObject, const FInAppWalletHandle& Wallet)
{
if (!WorldContextObject)
{
return nullptr;
}
NEW_TASK
Task->InAppWallet = Wallet;
Task->RegisterWithGameInstance(WorldContextObject);
return Task;
}

void UAsyncTaskThirdwebSendOTP::HandleResponse()
{
if (IsInGameThread())
{
Success.Broadcast(TEXT(""));
SetReadyToDestroy();
}
else
{
// Retry on the GameThread.
TWeakObjectPtr<UAsyncTaskThirdwebSendOTP> WeakThis = this;
FFunctionGraphTask::CreateAndDispatchWhenReady([WeakThis]()
{
if (WeakThis.IsValid())
{
WeakThis->HandleResponse();
}
}, TStatId(), nullptr, ENamedThreads::GameThread);
}
}

void UAsyncTaskThirdwebSendOTP::HandleFailed(const FString& Error)
{
if (IsInGameThread())
{
Failed.Broadcast(Error);
SetReadyToDestroy();
}
else
{
// Retry on the GameThread.
TWeakObjectPtr<UAsyncTaskThirdwebSendOTP> WeakThis = this;
FFunctionGraphTask::CreateAndDispatchWhenReady([WeakThis, Error]()
{
if (WeakThis.IsValid())
{
WeakThis->HandleFailed(Error);
}
}, TStatId(), nullptr, ENamedThreads::GameThread);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Copyright (c) 2024 Thirdweb. All Rights Reserved.

#include "AsyncTasks/Wallets/InApp/Create/AsyncTaskThirdwebCreateAuthEndpointWallet.h"

#include "ThirdwebRuntimeSettings.h"

#include "Wallets/ThirdwebInAppWalletHandle.h"

void UAsyncTaskThirdwebCreateAuthEndpointWallet::Activate()
{
if (UThirdwebRuntimeSettings::IsEcosystem())
{
return FInAppWalletHandle::CreateEcosystemAuthEndpointWallet(EcosystemPartnerId, BIND_CREATE_WALLET_SUCCESS_DELEGATE, BIND_CREATE_WALLET_ERROR_DELEGATE);
}
FInAppWalletHandle::CreateAuthEndpointWallet(BIND_CREATE_WALLET_SUCCESS_DELEGATE, BIND_CREATE_WALLET_ERROR_DELEGATE);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Copyright (c) 2024 Thirdweb. All Rights Reserved.

#include "AsyncTasks/Wallets/InApp/Create/AsyncTaskThirdwebCreateEmailWallet.h"

#include "ThirdwebRuntimeSettings.h"

#include "Wallets/ThirdwebInAppWalletHandle.h"

void UAsyncTaskThirdwebCreateEmailWallet::Activate()
{
if (UThirdwebRuntimeSettings::IsEcosystem())
{
return FInAppWalletHandle::CreateEcosystemEmailWallet(EcosystemPartnerId, AuthInput, BIND_CREATE_WALLET_SUCCESS_DELEGATE, BIND_CREATE_WALLET_ERROR_DELEGATE);
}
FInAppWalletHandle::CreateEmailWallet(AuthInput,BIND_CREATE_WALLET_SUCCESS_DELEGATE, BIND_CREATE_WALLET_ERROR_DELEGATE);
}
Loading