Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merge in wip #25

Merged
merged 19 commits into from
Dec 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
78 changes: 78 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: Build Plugin

on:
workflow_dispatch:
push:
branches: [ main, ci-cd ]
paths:
- 'Config/**'
- 'Content/**'
- 'Resources/**'
- 'Source/**'
- 'Thirdweb.uplugin'
- '.github/workflows/build.yml'
pull_request:
branches: [ main, ci-cd ]
paths:
- 'Config/**'
- 'Content/**'
- 'Resources/**'
- 'Source/**'
- 'Thirdweb.uplugin'
- '.github/workflows/build.yml'

jobs:
build:
name: Build Target
strategy:
fail-fast: true
matrix:
engine: [ "5.4", "5.3", "5.2" ] # ["5.5", "5.1", "5.0"]
os: [ ubuntu-latest-8, ubuntu-24.04-arm64 ] # windows-11-desktop, macos-13
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4

- name: Set Linux Target
if: ${{ matrix.os == 'ubuntu-latest-8' || matrix.os == 'ubuntu-24.04-arm64' }}
run: |
export LINUX_TARGET_TYPE="Linux"
if [[ "${{ matrix.os }}" == "ubuntu-24.04-arm64" ]]; then
export LINUX_TARGET_TYPE="LinuxArm64"
fi
echo "LINUX_TARGET_TYPE=$LINUX_TARGET_TYPE" >> "$GITHUB_ENV"

- name: Build Plugin (Linux)
if: ${{ matrix.os == 'ubuntu-latest-8' || matrix.os == 'ubuntu-24.04-arm64' }}
uses: addnab/docker-run-action@v3
with:
username: ${{ secrets.GHCR_USERNAME }}
password: ${{ secrets.GHCR_TOKEN }}
registry: ghcr.io
image: ghcr.io/epicgames/unreal-engine:dev-slim-${{ matrix.engine }}
options: -v ${{ github.workspace }}:/plugin
run: |
Engine/Build/BatchFiles/RunUAT.sh \
BuildPlugin \
-NoHostPlatform \
-TargetPlatform=Linux${{ env.LINUX_TARGET_TYPE }} \
-Package=/home/ue4//build \
-Plugin="/plugin/Thirdweb.uplugin"

# - name: Downgrade Xcode
# if: ${{ matrix.os == 'macos-13' }}
# uses: maxim-lobanov/setup-xcode@v1
# with:
# xcode-version: '14.1.0'

# - name: Debug Clang
# if: ${{ matrix.platform == 'ios' }}
# run: clang --version

# - name: Archive Build Artifact
# uses: actions/upload-artifact@v4
# with:
# name: ${{ format('{0}-{1}-{2}', matrix.platform, matrix.arch, github.run_id) }}
# path: |
# target/*/release/libthirdweb.a
# target/*/release/thirdweb.lib
Binary file modified Content/Defaults/WBP_Thirdweb_OAuthOverlay.uasset
Binary file not shown.
Binary file modified Content/Examples/NodeDocs/Thirdweb_AllNodes.uasset
Binary file not shown.
Binary file modified Content/Examples/Widgets/WBP_Thirdweb_Smart.uasset
Binary file not shown.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ Legend: ✅ Supported | ❌ Unsupported | ➖ Not applicable

## Documentation

Documentation is available at https://portal.thirdweb.com/unreal
Documentation is available at https://portal.thirdweb.com/unreal-engine

[^1]: Unreal Engine's Marketplace Guidelines - Section 3.1.b https://www.unrealengine.com/en-US/marketplace-guidelines#31b

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include "AsyncTasks/Engine/Contract/AsyncTaskContractWriteContract.h"

#include "ThirdwebRuntimeSettings.h"
#include "Components/SlateWrapperTypes.h"
#include "Engine/ThirdwebEngine.h"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#include "AsyncTasks/Wallets/InApp/AsyncTaskThirdwebGetLinkedAccounts.h"

#include "Async/TaskGraphInterfaces.h"

#include "Components/SlateWrapperTypes.h"

void UAsyncTaskThirdwebGetLinkedAccounts::Activate()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

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

#include "Async/TaskGraphInterfaces.h"
#include "Components/SlateWrapperTypes.h"

void UAsyncTaskThirdwebInAppSignMessage::Activate()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

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

#include "Async/TaskGraphInterfaces.h"
#include "Components/SlateWrapperTypes.h"

UAsyncTaskThirdwebLink* UAsyncTaskThirdwebLink::Link(UObject* WorldContextObject, const FInAppWalletHandle& Wallet, const FInAppWalletHandle& NewWallet, const FString& Input, const FString& Signature)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,11 @@

#include "ThirdwebLog.h"
#include "TimerManager.h"

#include "Async/TaskGraphInterfaces.h"
#include "Blueprint/UserWidget.h"

#include "Browser/ThirdwebOAuthBrowserUserWidget.h"

#include "Engine/World.h"

#include "Kismet/GameplayStatics.h"

#include "Misc/DateTime.h"

void UAsyncTaskThirdwebLoginWithOAuth::Activate()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

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

#include "Async/TaskGraphInterfaces.h"
#include "Components/SlateWrapperTypes.h"

void UAsyncTaskThirdwebSendOTP::Activate()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

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

#include "Async/TaskGraphInterfaces.h"
#include "Components/SlateWrapperTypes.h"

UAsyncTaskThirdwebSignIn* UAsyncTaskThirdwebSignIn::SignIn(UObject* WorldContextObject, const FInAppWalletHandle& Wallet, const FString& Input, const FString& Signature)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

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

#include "Async/TaskGraphInterfaces.h"
#include "Components/SlateWrapperTypes.h"
#include "Wallets/ThirdwebSmartWalletHandle.h"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

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

#include "Async/TaskGraphInterfaces.h"
#include "Wallets/ThirdwebInAppWalletHandle.h"

void UAsyncTaskThirdwebInAppCreateWalletBase::HandleResponse(const FInAppWalletHandle& Wallet)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include "AsyncTasks/Wallets/Smart/AsyncTaskThirdwebAddAdmin.h"

#include "Async/TaskGraphInterfaces.h"
#include "Components/SlateWrapperTypes.h"

void UAsyncTaskThirdwebAddAdmin::Activate()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,14 @@ void UAsyncTaskThirdwebCreateSessionKey::Activate()
);
}

UAsyncTaskThirdwebCreateSessionKey* UAsyncTaskThirdwebCreateSessionKey::CreateSessionKey(UObject* WorldContextObject,
const FSmartWalletHandle& Wallet,
const FString& Signer,
const TArray<FString>& ApprovedTargets,
const FString& NativeTokenLimitPerTransactionInWei,
const FDateTime& PermissionEnd)
UAsyncTaskThirdwebCreateSessionKey* UAsyncTaskThirdwebCreateSessionKey::CreateSessionKey(
UObject* WorldContextObject,
const FSmartWalletHandle& Wallet,
const FString& Signer,
const TArray<FString>& ApprovedTargets,
const FString& NativeTokenLimitPerTransactionInWei,
const FDateTime& PermissionEnd
)
{
if (!WorldContextObject)
{
Expand Down Expand Up @@ -54,7 +56,7 @@ void UAsyncTaskThirdwebCreateSessionKey::HandleResponse(const FString& TxHash)
}, TStatId(), nullptr, ENamedThreads::GameThread);
return;
}

Success.Broadcast(TxHash, TEXT(""));
SetReadyToDestroy();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include "AsyncTasks/Wallets/Smart/AsyncTaskThirdwebGetActiveSigners.h"

#include "Async/TaskGraphInterfaces.h"
#include "Components/SlateWrapperTypes.h"
#include "Containers/ThirdwebSigner.h"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include "AsyncTasks/Wallets/Smart/AsyncTaskThirdwebGetAdmins.h"

#include "Async/TaskGraphInterfaces.h"
#include "Components/SlateWrapperTypes.h"

void UAsyncTaskThirdwebGetAdmins::Activate()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

#include "AsyncTasks/Wallets/Smart/AsyncTaskThirdwebIsActiveSigner.h"

#include "Containers/ThirdwebSigner.h"

#include "Async/TaskGraphInterfaces.h"
#include "Components/SlateWrapperTypes.h"
#include "Containers/ThirdwebSigner.h"

void UAsyncTaskThirdwebIsActiveSigner::Activate()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include "AsyncTasks/Wallets/Smart/AsyncTaskThirdwebIsDeployed.h"

#include "Async/TaskGraphInterfaces.h"
#include "Components/SlateWrapperTypes.h"

void UAsyncTaskThirdwebIsDeployed::Activate()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include "AsyncTasks/Wallets/Smart/AsyncTaskThirdwebRevokeSessionKey.h"

#include "Async/TaskGraphInterfaces.h"
#include "Components/SlateWrapperTypes.h"

void UAsyncTaskThirdwebRevokeSessionKey::Activate()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include "AsyncTasks/Wallets/Smart/AsyncTaskThirdwebSmartSignMessage.h"

#include "Async/TaskGraphInterfaces.h"
#include "Components/SlateWrapperTypes.h"

void UAsyncTaskThirdwebSmartSignMessage::Activate()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@

#include "ThirdwebLog.h"
#include "ThirdwebRuntimeSettings.h"

#include "Async/Async.h"

#include "Async/TaskGraphInterfaces.h"
#include "GenericPlatform/GenericPlatformHttp.h"

#include "Widgets/Layout/SBox.h"
#include "Widgets/Text/STextBlock.h"
#if WITH_CEF
Expand Down
2 changes: 2 additions & 0 deletions Source/Thirdweb/Private/Containers/ThirdwebLinkedAccount.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

#include "Containers/ThirdwebLinkedAccount.h"

#include "Dom/JsonObject.h"

FThirdwebLinkedAccount FThirdwebLinkedAccount::FromJson(const TSharedPtr<FJsonObject>& JsonObject)
{
FThirdwebLinkedAccount LinkedAccount;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include "Containers/ThirdwebMultipartFormData.h"

#include "Containers/StringConv.h"
#include "Misc/FileHelper.h"
#include "Misc/Guid.h"

Expand Down
10 changes: 10 additions & 0 deletions Source/Thirdweb/Private/Internal/ThirdwebHeaders.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include "Internal/ThirdwebHeaders.h"

#include "Containers/UnrealString.h"
#include "Interfaces/IHttpRequest.h"

FThirdwebHeaders::FThirdwebHeaders()
Expand All @@ -16,6 +17,15 @@ void FThirdwebHeaders::Set(const FString& Name, const FString& Value, const bool
}
}

void FThirdwebHeaders::SetMany(TArray<TTuple<FString, FString>> Pairs)
{
for (const auto& Pair : Pairs)
{
Set(Pair.Key, Pair.Value);
}
}


bool FThirdwebHeaders::Remove(const FString& Name)
{
return Headers.Remove(Name) > 0;
Expand Down
26 changes: 16 additions & 10 deletions Source/Thirdweb/Private/ThirdwebUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "Thirdweb.h"
#include "ThirdwebLog.h"
#include "ThirdwebRuntimeSettings.h"
#include "Async/TaskGraphInterfaces.h"
#include "Containers/ThirdwebIPFSUploadResult.h"
#include "Containers/ThirdwebMultipartFormData.h"
#include "Dom/JsonObject.h"
Expand All @@ -21,10 +22,12 @@
#include "Interfaces/IHttpRequest.h"
#include "Interfaces/IHttpResponse.h"
#include "Interfaces/IPluginManager.h"
#include "Internal/ThirdwebHeaders.h"
#include "Kismet/GameplayStatics.h"
#include "Kismet/KismetStringLibrary.h"
#include "Misc/Base64.h"
#include "Misc/DefaultValueHelper.h"
#include "Modules/ModuleManager.h"
#include "Policies/CondensedJsonPrintPolicy.h"
#include "Serialization/JsonReader.h"
#include "Serialization/JsonSerializer.h"
Expand Down Expand Up @@ -419,8 +422,7 @@ namespace ThirdwebUtils
{
if (!IsInGameThread())
{
// Retry on the GameThread.
const FWalletHandle WalletCopy;
const FWalletHandle WalletCopy = Wallet;
FFunctionGraphTask::CreateAndDispatchWhenReady([WalletCopy]()
{
SendConnectEvent(WalletCopy);
Expand All @@ -436,13 +438,17 @@ namespace ThirdwebUtils
const TSharedRef<IHttpRequest> Request = HttpModule.CreateRequest();
Request->SetVerb("POST");
Request->SetURL("https://c.thirdweb.com/event");
Request->SetHeader("Content-Type", "application/json");
Request->SetHeader("x-sdk-name", "UnrealEngineSDK");
Request->SetHeader("x-sdk-os", UGameplayStatics::GetPlatformName());
Request->SetHeader("x-sdk-platform", "unreal-engine");
Request->SetHeader("x-sdk-version", GetPluginVersion());
Request->SetHeader("x-client-id", Settings->GetClientId());
Request->SetHeader("x-bundle-id", Settings->GetBundleId());
FThirdwebHeaders Headers;
Headers.SetMany({
{TEXT("Content-Type"), TEXT("application/json")},
{TEXT("x-sdk-name"), TEXT("UnrealEngineSDK")},
{TEXT("x-sdk-os"), UGameplayStatics::GetPlatformName()},
{TEXT("x-sdk-platform"), TEXT("unreal-engine")},
{TEXT("x-sdk-version"), GetPluginVersion()},
{TEXT("x-client-id"), Settings->GetClientId()},
{TEXT("x-bundle-id"), Settings->GetBundleId()},
});
Headers.UpdateRequest(Request);
Request->SetTimeout(5.0f);

// ReSharper disable once CppLocalVariableMayBeConst
Expand All @@ -451,7 +457,7 @@ namespace ThirdwebUtils
JsonObject->SetStringField(TEXT("action"), TEXT("connect"));
JsonObject->SetStringField(TEXT("walletAddress"), Wallet.ToAddress());
JsonObject->SetStringField(TEXT("walletType"), Wallet.GetTypeString());
Request->SetContentAsString(ThirdwebUtils::Json::ToString(JsonObject));
Request->SetContentAsString(Json::ToString(JsonObject));
Request->ProcessRequest();
}

Expand Down
Loading
Loading