Skip to content

Commit

Permalink
Problem: header file not updated (fix #324) (#325)
Browse files Browse the repository at this point in the history
update changelog

reformat

remove ue 5.0 docker pull
  • Loading branch information
leejw51crypto authored Jun 15, 2023
1 parent 2a374f3 commit 0bc2ef7
Show file tree
Hide file tree
Showing 14 changed files with 773 additions and 121 deletions.
28 changes: 0 additions & 28 deletions .github/workflows/dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,34 +42,6 @@ jobs:
cd ~/play-unreal-plugin
make RunUAT
Unreal_Build_5_0:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3

- name: Setup
run: |
sudo chmod 777 $GITHUB_WORKSPACE
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
sudo rm -rf /usr/local/lib/android
mv ./Source/ThirdParty/PlayCppSdkLibrary/PlayCppSdkLibrary.Build.cs.legacy ./Source/ThirdParty/PlayCppSdkLibrary/PlayCppSdkLibrary.Build.cs
TARGET=5.0 make
python change_version.py 5.0.0
- uses: addnab/docker-run-action@v3
with:
registry: ghcr.io
username: ${{ secrets.USER }}
password: ${{ secrets.PAT }}
image: ghcr.io/epicgames/unreal-engine:dev-slim-5.0
options: -v ${{ github.workspace }}:/home/ue4/play-unreal-plugin -e HOME=/home/ue4
run: |
cd ~/play-unreal-plugin
make RunUAT
Unreal_Build_5_1:
runs-on: ubuntu-22.04
steps:
Expand Down
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@

## [Unreleased]

## [v0.0.13-alpha] - 2023-6-12
## [v0.0.13-alpha] - 2023-6-15
- Support apple arm64
- Support Unreal Engine 5.2.0
- Update play-cpp-sdk headerfiles

## [v0.0.12-alpha] - 2023-5-04
- Support sending transactions using Metamask and Crypto.com Defi Wallet
- Use play-cpp-sdk v0.0.19-alpha
Expand Down
115 changes: 59 additions & 56 deletions Source/CronosPlayUnreal/Private/PlayCppSdkActor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ ::com::crypto::game_sdk::WalletconnectClient *APlayCppSdkActor::_coreClient =
class UserWalletConnectCallback : public WalletConnectCallback {
private:
APlayCppSdkActor *PlayCppSdkPtr;

public:
UserWalletConnectCallback(APlayCppSdkActor *PlayCppSdkPtr);
void onConnected(const WalletConnectSessionInfo &sessioninfo) const;
Expand Down Expand Up @@ -57,7 +58,8 @@ void UserWalletConnectCallback::onConnected( // NOLINT : flase positive, virtual
sessioninfo, EWalletconnectSessionState::StateConnected));
});
} else {
UE_LOG(LogTemp, Error, TEXT("Can not find PlayCppSdkActor onConnected"));
UE_LOG(LogTemp, Error,
TEXT("Can not find PlayCppSdkActor onConnected"));
}
}
void UserWalletConnectCallback::onDisconnected( // NOLINT : flase positive,
Expand Down Expand Up @@ -129,7 +131,6 @@ void UserWalletConnectCallback::onUpdated( // NOLINT : flase positive, virtual
}
}


// Sets default values
APlayCppSdkActor::APlayCppSdkActor() {
// Set this actor to call Tick() every frame. You can turn this off to
Expand Down Expand Up @@ -774,7 +775,6 @@ void APlayCppSdkActor::SendEip155Transaction(
});
}


void APlayCppSdkActor::destroyCoreClient() {
if (_coreClient != NULL) {
UE_LOG(LogTemp, Log, TEXT("PlayCppSdkActor destroyCoreClient"));
Expand Down Expand Up @@ -803,34 +803,35 @@ void APlayCppSdkActor::Erc721TransferFrom(
if (fromAddress.IsEmpty())
return;

AsyncTask(
ENamedThreads::AnyHiPriThreadNormalTask,
[this, Out, contractAddress, fromAddress, toAddress, tokenId, gasLimit,
gasPrice, fromAddressArray]() {
FWalletSendTXEip155Result txresult;
try {
if (NULL == _coreClient) {
txresult.result = TEXT("Invalid Walletconnect");
} else {
WalletConnectTxCommon common;
setCommon(common, gasLimit, gasPrice);
copyVecToTArray(_coreClient->send_contract_transaction(
Erc721TransferFromAction(
contractAddress, fromAddress,
toAddress, tokenId),
common, fromAddressArray),
txresult.tx_hash);
}
AsyncTask(ENamedThreads::AnyHiPriThreadNormalTask,
[this, Out, contractAddress, fromAddress, toAddress, tokenId,
gasLimit, gasPrice, fromAddressArray]() {
FWalletSendTXEip155Result txresult;
try {
if (NULL == _coreClient) {
txresult.result = TEXT("Invalid Walletconnect");
} else {
WalletConnectTxCommon common;
setCommon(common, gasLimit, gasPrice);
copyVecToTArray(
_coreClient->send_contract_transaction(
Erc721TransferFromAction(contractAddress,
fromAddress,
toAddress, tokenId),
common, fromAddressArray),
txresult.tx_hash);
}

} catch (const std::exception &e) {
txresult.result = FString::Printf(
TEXT("CronosPlayUnreal Erc721TransferFrom Error: %s"),
UTF8_TO_TCHAR(e.what()));
}
} catch (const std::exception &e) {
txresult.result = FString::Printf(
TEXT("CronosPlayUnreal Erc721TransferFrom Error: %s"),
UTF8_TO_TCHAR(e.what()));
}

AsyncTask(ENamedThreads::GameThread,
[Out, txresult]() { Out.ExecuteIfBound(txresult); });
});
AsyncTask(ENamedThreads::GameThread, [Out, txresult]() {
Out.ExecuteIfBound(txresult);
});
});
}

void APlayCppSdkActor::Erc721SafeTransferFrom(
Expand Down Expand Up @@ -1141,42 +1142,44 @@ void APlayCppSdkActor::Erc20TransferFrom(
// if no fromAddress, return
if (fromAddress.IsEmpty())
return;
AsyncTask(
ENamedThreads::AnyHiPriThreadNormalTask,
[this, Out, contractAddress, fromAddress, toAddress, amount, gasLimit,
gasPrice, fromAddressArray]() {
FWalletSendTXEip155Result txresult;
try {
if (NULL == _coreClient) {
txresult.result = TEXT("Invalid Walletconnect");
} else {
AsyncTask(ENamedThreads::AnyHiPriThreadNormalTask,
[this, Out, contractAddress, fromAddress, toAddress, amount,
gasLimit, gasPrice, fromAddressArray]() {
FWalletSendTXEip155Result txresult;
try {
if (NULL == _coreClient) {
txresult.result = TEXT("Invalid Walletconnect");
} else {

WalletConnectTxCommon common;
setCommon(common, gasLimit, gasPrice);
copyVecToTArray(_coreClient->send_contract_transaction(
Erc20TransferFromAction(
contractAddress, fromAddress,
toAddress, amount),
common, fromAddressArray),
txresult.tx_hash);
}
WalletConnectTxCommon common;
setCommon(common, gasLimit, gasPrice);
copyVecToTArray(
_coreClient->send_contract_transaction(
Erc20TransferFromAction(contractAddress,
fromAddress,
toAddress, amount),
common, fromAddressArray),
txresult.tx_hash);
}

} catch (const std::exception &e) {
txresult.result = FString::Printf(
TEXT("CronosPlayUnreal Erc20TransferFrom Error: %s"),
UTF8_TO_TCHAR(e.what()));
}
} catch (const std::exception &e) {
txresult.result = FString::Printf(
TEXT("CronosPlayUnreal Erc20TransferFrom Error: %s"),
UTF8_TO_TCHAR(e.what()));
}

AsyncTask(ENamedThreads::GameThread,
[Out, txresult]() { Out.ExecuteIfBound(txresult); });
});
AsyncTask(ENamedThreads::GameThread, [Out, txresult]() {
Out.ExecuteIfBound(txresult);
});
});
}

void APlayCppSdkActor::setCommon(WalletConnectTxCommon &common,
FString gaslimit, FString gasprice) {
// std::string mycronosrpc = TCHAR_TO_UTF8(*myCronosRpc);
// common.web3api_url = mycronosrpc.c_str(); // uncessary
common.web3api_url = "https://evm-dev-t3.cronos.org"; // uncessary, placeholder
common.web3api_url =
"https://evm-dev-t3.cronos.org"; // uncessary, placeholder
common.chainid = (uint64)GetChainId();
common.gas_limit = TCHAR_TO_UTF8(*gaslimit);
common.gas_price = TCHAR_TO_UTF8(*gasprice);
Expand Down
39 changes: 20 additions & 19 deletions Source/CronosPlayUnreal/Public/PlayCppSdkActor.h
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,8 @@ class CRONOSPLAYUNREAL_API APlayCppSdkActor : public AActor {
EConnectionType _connection_type = EConnectionType::URI_STRING;

/**
* SetupCallback delegate, called after calling `SetupCallback` internally, it does not expose to blueprint
* SetupCallback delegate, called after calling `SetupCallback` internally,
* it does not expose to blueprint
*/
FWalletconnectSessionInfoDelegate OnSetupCallbackDelegate;

Expand Down Expand Up @@ -698,39 +699,39 @@ class CRONOSPLAYUNREAL_API APlayCppSdkActor : public AActor {
FCronosSendContractTransactionDelegate Out);

rust::string Erc721TransferFromAction(FString contract_address,
FString from_address,
FString to_address, FString token_id);
FString from_address,
FString to_address, FString token_id);
rust::string Erc721SafeTransferFromAction(FString contract_address,
FString from_address,
FString to_address,
FString token_id);
FString from_address,
FString to_address,
FString token_id);

rust::string Erc721SafeTransferFromWithAdditionalDataAction(
FString contract_address, FString from_address, FString to_address,
FString token_id, TArray<uint8> additional_data);

rust::string Erc1155SafeTransferFromAction(FString contract_address,
FString from_address,
FString to_address,
FString token_id, FString amount,
TArray<uint8> additional_data);
FString from_address,
FString to_address,
FString token_id, FString amount,
TArray<uint8> additional_data);

rust::string Erc20ApprovalAction(FString contract_address,
FString approved_address, FString amount);
FString approved_address, FString amount);
rust::string Erc721ApprovalAction(FString contract_address,
FString approved_address,
FString token_id);
FString approved_address,
FString token_id);
rust::string Erc721SetApprovalForAllAction(FString contract_address,
FString approved_address,
bool approved);
FString approved_address,
bool approved);

rust::string Erc1155ApprovalAction(FString contract_address,
FString approved_address, bool approved);
FString approved_address, bool approved);

rust::string Erc20TransferAction(FString contract_address,
FString to_address, FString amount);
FString to_address, FString amount);

rust::string Erc20TransferFromAction(FString contract_address,
FString from_address,
FString to_address, FString amount);
FString from_address,
FString to_address, FString amount);
};
2 changes: 1 addition & 1 deletion Source/ThirdParty/PlayCppSdkLibrary/Include/android.cc
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,4 @@ rust::String secureStorageRead(rust::String userkey) {

} // namespace defi_wallet_core
} // namespace org
#endif
#endif
2 changes: 1 addition & 1 deletion Source/ThirdParty/PlayCppSdkLibrary/Include/android.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ int secureStorageWrite(rust::String userkey, rust::String uservalue);
rust::String secureStorageRead(rust::String userkey);
} // namespace defi_wallet_core
} // namespace org
#endif
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -679,9 +679,7 @@ template <typename T> std::size_t align_of() { return layout::align_of<T>(); }
#ifndef CXXBRIDGE1_RELOCATABLE
#define CXXBRIDGE1_RELOCATABLE
namespace detail {
template <typename... Ts> struct make_void {
using type = void;
};
template <typename... Ts> struct make_void { using type = void; };

template <typename... Ts> using void_t = typename make_void<Ts...>::type;

Expand Down
Loading

0 comments on commit 0bc2ef7

Please sign in to comment.