Skip to content

Commit

Permalink
Problem: missing support for ue 5.4 (fix #351)
Browse files Browse the repository at this point in the history
support ue 5.4
  • Loading branch information
leejw51crypto committed Apr 27, 2024
1 parent 585b218 commit e32059c
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 15 deletions.
4 changes: 2 additions & 2 deletions CronosPlayUnreal.uplugin
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"FileVersion": 3,
"FriendlyName": "Cronos Play for Unreal Engine",
"Version": 1,
"VersionName": "v0.0.18-alpha",
"EngineVersion": "5.3.0",
"VersionName": "v0.0.19-alpha",
"EngineVersion": "5.4.0",
"Description": "Cronos labs",
"Category": "Programming",
"CreatedBy": "Cronos labs",
Expand Down
8 changes: 6 additions & 2 deletions Source/CronosPlayUnreal/Private/DynamicContractObject.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
// Copyright 2022, Cronos Labs. All Rights Reserved

#include "DynamicContractObject.h"
#include "DefiWalletCoreActor.h"

using namespace org::defi_wallet_core;
void convertCronosTXReceipt(
::org::defi_wallet_core::CronosTransactionReceiptRaw &src,
FCronosTransactionReceiptRaw &dst);
UDynamicContractObject::UDynamicContractObject() {
defiWallet = NULL;
_coreContract = NULL;
Expand Down Expand Up @@ -178,7 +182,7 @@ void UDynamicContractObject::NewSigningEthContract(FString contractaddress,
}

char hdpath[100];
snprintf(hdpath, sizeof(hdpath), "m/44'/%d'/0'/0/%d", EthCoinType,
snprintf(hdpath, sizeof(hdpath), "m/44'/%d'/0'/0/%d", 60,
walletindex);
rust::cxxbridge1::Box<PrivateKey> privatekey =
defiWallet->getCoreWallet()->get_key(hdpath);
Expand Down
7 changes: 4 additions & 3 deletions Source/CronosPlayUnreal/Private/PlayCppSdkDownloader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "Interfaces/IHttpRequest.h"
#include "Interfaces/IHttpResponse.h"
#include "Kismet/KismetRenderingLibrary.h"

FString UPlayCppSdkDownloader::UserAgent =
TEXT("CronosPlay-UnrealEngine-Agent");
// ipfs:// -> https://ipfs.io/ipfs/
Expand Down Expand Up @@ -46,7 +47,7 @@ void UPlayCppSdkDownloader::GetJsonStringFromUri(FString tokenuriuser,
}

FString tokenuri = convert_ipfs_url(tokenuriuser);
assert(HttpModule != NULL);
check(HttpModule != NULL);
TSharedRef<IHttpRequest, ESPMode::ThreadSafe> httprequest =
HttpModule->CreateRequest();
httprequest->SetVerb(TEXT("GET"));
Expand Down Expand Up @@ -96,7 +97,7 @@ void UPlayCppSdkDownloader::GetNftImageInfoFromUri(FString tokenuriuser,
}

FString tokenuri = convert_ipfs_url(tokenuriuser);
assert(HttpModule != NULL);
check(HttpModule != NULL);
TSharedRef<IHttpRequest, ESPMode::ThreadSafe> httprequest =
HttpModule->CreateRequest();

Expand Down Expand Up @@ -161,7 +162,7 @@ void UPlayCppSdkDownloader::GetNftImageFromUrl(FString imageurl, bool &success,
return;
}

assert(HttpModule != NULL);
check(HttpModule != NULL);
TSharedRef<IHttpRequest, ESPMode::ThreadSafe> httprequest =
HttpModule->CreateRequest();
httprequest->SetVerb(TEXT("GET"));
Expand Down
10 changes: 5 additions & 5 deletions Source/CronosPlayUnreal/Private/Utlis.cpp
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
// Copyright 2022, Cronos Labs. All Rights Reserved

#include "Utlis.h"
#include "Containers/UnrealString.h"

FString UUtlis::ToHex(TArray<uint8> address) {
FString UUtlis::ToHex(const TArray<uint8> &address) {
return BytesToHex(address.GetData(), address.Num());
}

std::array<std::uint8_t, 20> UUtlis::ToArray(TArray<uint8> address) {
std::array<std::uint8_t, 20> UUtlis::ToArray(const TArray<uint8> &address) {
std::array<std::uint8_t, 20> std_array{};

if (address.Num() == 20) {
auto data_begin = address.GetData();
const uint8 *data_begin = address.GetData();
std::copy_n(data_begin, 20, std_array.begin());
} else {
std_array.fill(0);
}

return std_array;
}
6 changes: 3 additions & 3 deletions Source/CronosPlayUnreal/Public/Utlis.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2022, Cronos Labs. All Rights Reserved

#pragma once

#include <array>
#include "CoreMinimal.h"
#include "Kismet/BlueprintFunctionLibrary.h"
#include "Utlis.generated.h"
Expand All @@ -23,7 +23,7 @@ class CRONOSPLAYUNREAL_API UUtlis : public UBlueprintFunctionLibrary {
UFUNCTION(BlueprintCallable,
meta = (DisplayName = "ToHex", Keywords = "PlayCppSdk"),
Category = "Utils")
static FString ToHex(TArray<uint8> address);
static FString ToHex(const TArray<uint8>& address);

/**
* Convert TArray<uint8> to std::array<uint8_t, 20>
Expand All @@ -32,5 +32,5 @@ class CRONOSPLAYUNREAL_API UUtlis : public UBlueprintFunctionLibrary {
* return all 0
*
*/
static std::array<std::uint8_t, 20> ToArray(TArray<uint8> address);
static std::array<std::uint8_t, 20> ToArray(const TArray<uint8>& address);
};

0 comments on commit e32059c

Please sign in to comment.