-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[DX-2787] feat: added zkevm transaction receipt acquirement method (#85)
* feat: added get transaction receipt functionality * chore: game bridge update, tag 1.35.5 * fix: removed unnecessary code, edited comments * feat: updated widget blueprints with new method
- Loading branch information
Showing
13 changed files
with
289 additions
and
2 deletions.
There are no files selected for viewing
Binary file modified
BIN
+23.7 KB
(110%)
Content/BlueprintSampleContent/ImtblAuthenticatedWidget4_26.uasset
Binary file not shown.
Binary file modified
BIN
-7.34 KB
(92%)
Content/BlueprintSampleContent/ImtblEvmBalanceWidget4_26.uasset
Binary file not shown.
Binary file added
BIN
+104 KB
Content/BlueprintSampleContent/ImtblEvmTransactionReceiptWidget4_26.uasset
Binary file not shown.
Binary file not shown.
64 changes: 64 additions & 0 deletions
64
Source/Immutable/Private/Immutable/Actions/ImtblPassportZkEvmGetTransactionReceiptAA.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
// Fill out your copyright notice in the Description page of Project Settings. | ||
|
||
#include "Immutable/Actions/ImtblPassportZkEvmGetTransactionReceiptAA.h" | ||
|
||
#include "Immutable/ImmutablePassport.h" | ||
#include "Immutable/ImmutableSubsystem.h" | ||
#include "Immutable/Misc/ImtblLogging.h" | ||
|
||
UImtblPassportZkEvmGetTransactionReceiptAA* UImtblPassportZkEvmGetTransactionReceiptAA::ZkEvmGetTransactionReceipt(UObject* WorldContextObject, const FString& Hash) | ||
{ | ||
UImtblPassportZkEvmGetTransactionReceiptAA* PassportZkEvmSendTransactionBlueprintNode = NewObject<UImtblPassportZkEvmGetTransactionReceiptAA>(); | ||
|
||
PassportZkEvmSendTransactionBlueprintNode->WorldContextObject = WorldContextObject; | ||
PassportZkEvmSendTransactionBlueprintNode->Hash = Hash; | ||
|
||
return PassportZkEvmSendTransactionBlueprintNode; | ||
} | ||
|
||
void UImtblPassportZkEvmGetTransactionReceiptAA::Activate() | ||
{ | ||
if (!WorldContextObject || !WorldContextObject->GetWorld()) | ||
{ | ||
const FString ErrorMessage = "ZkEvmSendTransaction failed due to missing world or world " "context object."; | ||
IMTBL_WARN("%s", *ErrorMessage) | ||
Failed.Broadcast(ErrorMessage, FZkEvmTransactionReceipt()); | ||
return; | ||
} | ||
|
||
GetSubsystem()->WhenReady(this, &UImtblPassportZkEvmGetTransactionReceiptAA::DoZkEvmGetTransactionReceipt); | ||
} | ||
|
||
void UImtblPassportZkEvmGetTransactionReceiptAA::DoZkEvmGetTransactionReceipt(TWeakObjectPtr<UImtblJSConnector> JSConnector) | ||
{ | ||
auto Passport = GetSubsystem()->GetPassport(); | ||
|
||
if (Passport.IsValid()) | ||
{ | ||
Passport->ZkEvmGetTransactionReceipt({ Hash }, UImmutablePassport::FImtblPassportResponseDelegate::CreateUObject(this, &UImtblPassportZkEvmGetTransactionReceiptAA::OnZkEvmGetTransactionReceiptResponse)); | ||
} | ||
} | ||
|
||
void UImtblPassportZkEvmGetTransactionReceiptAA::OnZkEvmGetTransactionReceiptResponse(FImmutablePassportResult Result) | ||
{ | ||
if (Result.Success) | ||
{ | ||
auto Receipt = JsonObjectToUStruct<FZkEvmTransactionReceipt>(Result.Response.JsonObject); | ||
|
||
if (Receipt.IsSet()) | ||
{ | ||
IMTBL_LOG("ZkEvmGetTransactionReceipt success") | ||
Success.Broadcast(TEXT(""), Receipt.GetValue()); | ||
} | ||
else | ||
{ | ||
IMTBL_LOG("ZkEvm Transaction Receipt is not provided") | ||
Success.Broadcast(TEXT(""), FZkEvmTransactionReceipt()); | ||
} | ||
} | ||
else | ||
{ | ||
IMTBL_LOG("ZkEvmGetTransactionReceipt failed") | ||
Failed.Broadcast(Result.Message, FZkEvmTransactionReceipt()); | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
Source/Immutable/Private/Immutable/ImmutableBlueprintLibrary.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#include "Immutable/ImmutableBlueprintLibrary.h" | ||
|
||
|
||
void UImmutableBlueprintLibrary::BreakFZkEvmTransactionReceiptLog(FZkEvmTransactionReceiptLog Log, FString& Address, FString& Data, | ||
FString& BlockNumber, FString& TransactionHash, FString& TransactionIndex, FString& BlockHash, FString& LogIndex, bool& Removed, | ||
TArray<FString>& Topics) | ||
{ | ||
Address = Log.address; | ||
Data = Log.data; | ||
BlockNumber = Log.blockNumber; | ||
TransactionHash = Log.transactionHash; | ||
TransactionIndex = Log.transactionIndex; | ||
BlockHash = Log.blockHash; | ||
LogIndex = Log.logIndex; | ||
Removed = Log.removed; | ||
Topics = Log.topics; | ||
} | ||
|
||
void UImmutableBlueprintLibrary::BreakZkEvmTransactionReceipt(FZkEvmTransactionReceipt Receipt, FString& BlockHash, FString& BlockNumber, | ||
FString& ContractAddress, FString& CumulativeGasUsed, FString& EffectiveGasPrice, FString& From, FString& GasUsed, FString& LogsBloom, | ||
FString& Status, FString& To, FString& TransactionHash, FString& TransactionIndex, FString& Type, TArray<FZkEvmTransactionReceiptLog>& Logs) | ||
{ | ||
BlockHash = Receipt.blockHash; | ||
BlockNumber = Receipt.blockNumber; | ||
ContractAddress = Receipt.contractAddress; | ||
CumulativeGasUsed = Receipt.cumulativeGasUsed; | ||
EffectiveGasPrice = Receipt.effectiveGasPrice; | ||
From = Receipt.from; | ||
GasUsed = Receipt.gasUsed; | ||
LogsBloom = Receipt.logsBloom; | ||
Status = Receipt.status; | ||
To = Receipt.to; | ||
TransactionHash = Receipt.transactionHash; | ||
TransactionIndex = Receipt.transactionIndex; | ||
Type = Receipt.type; | ||
Logs = Receipt.logs; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
Source/Immutable/Public/Immutable/Actions/ImtblPassportZkEvmGetTransactionReceiptAA.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// Fill out your copyright notice in the Description page of Project Settings. | ||
|
||
#pragma once | ||
|
||
#include "CoreMinimal.h" | ||
#include "Immutable/ImmutablePassport.h" | ||
#include "ImtblBlueprintAsyncAction.h" | ||
|
||
#include "ImtblPassportZkEvmGetTransactionReceiptAA.generated.h" | ||
|
||
|
||
/** | ||
* | ||
*/ | ||
UCLASS() | ||
class IMMUTABLE_API UImtblPassportZkEvmGetTransactionReceiptAA : public UImtblBlueprintAsyncAction | ||
{ | ||
GENERATED_BODY() | ||
|
||
DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FZkEvmGetTransactionReceiptOutputPin, FString, ErrorMessage, const struct FZkEvmTransactionReceipt&, Receipt); | ||
|
||
public: | ||
UFUNCTION(BlueprintCallable, meta = (WorldContext = "WorldContextObject", BlueprintInternalUseOnly = "true"), Category = "Immutable") | ||
static UImtblPassportZkEvmGetTransactionReceiptAA* ZkEvmGetTransactionReceipt(UObject* WorldContextObject, const FString& Hash); | ||
|
||
virtual void Activate() override; | ||
|
||
private: | ||
FString Hash; | ||
|
||
UPROPERTY(BlueprintAssignable) | ||
FZkEvmGetTransactionReceiptOutputPin Success; | ||
UPROPERTY(BlueprintAssignable) | ||
FZkEvmGetTransactionReceiptOutputPin Failed; | ||
|
||
void DoZkEvmGetTransactionReceipt(TWeakObjectPtr<class UImtblJSConnector> JSGetConnector); | ||
void OnZkEvmGetTransactionReceiptResponse(FImmutablePassportResult Result); | ||
}; |
22 changes: 22 additions & 0 deletions
22
Source/Immutable/Public/Immutable/ImmutableBlueprintLibrary.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#pragma once | ||
|
||
#include "Kismet/BlueprintFunctionLibrary.h" | ||
#include "Immutable/ImmutableDataTypes.h" | ||
|
||
#include "ImmutableBlueprintLibrary.generated.h" | ||
|
||
|
||
UCLASS() | ||
class IMMUTABLE_API UImmutableBlueprintLibrary : public UBlueprintFunctionLibrary | ||
{ | ||
GENERATED_BODY() | ||
|
||
public: | ||
|
||
UFUNCTION(BlueprintPure, Category = "Immutable", meta = (NativeBreakFunc)) | ||
static void BreakFZkEvmTransactionReceiptLog(FZkEvmTransactionReceiptLog Log, FString& Address, FString& Data, FString& BlockNumber, FString& TransactionHash, FString& TransactionIndex, FString& BlockHash, FString& LogIndex, bool& Removed, TArray<FString>& Topics); | ||
|
||
UFUNCTION(BlueprintPure, Category = "Immutable", meta = (NativeBreakFunc)) | ||
static void BreakZkEvmTransactionReceipt(FZkEvmTransactionReceipt Receipt, FString& BlockHash, FString& BlockNumber, FString& ContractAddress, FString& CumulativeGasUsed, FString& EffectiveGasPrice, FString& From, FString& GasUsed, FString& LogsBloom, FString& Status, FString& To, FString& TransactionHash, FString& TransactionIndex, FString& Type, TArray<FZkEvmTransactionReceiptLog>& Logs); | ||
|
||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters