-
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.
- Loading branch information
1 parent
8203fad
commit cea584b
Showing
7 changed files
with
325 additions
and
0 deletions.
There are no files selected for viewing
52 changes: 52 additions & 0 deletions
52
Source/Immutable/Private/Immutable/Actions/ImtblPassportZkEvmSignTypedDataV4AsyncAction.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,52 @@ | ||
// Fill out your copyright notice in the Description page of Project Settings. | ||
|
||
#include "Immutable/Actions/ImtblPassportZkEvmSignTypedDataV4AsyncAction.h" | ||
|
||
#include "Immutable/ImmutablePassport.h" | ||
#include "Immutable/ImmutableSubsystem.h" | ||
#include "Immutable/Misc/ImtblLogging.h" | ||
|
||
UImtblPassportZkEvmSignTypedDataV4AsyncAction* UImtblPassportZkEvmSignTypedDataV4AsyncAction::ZkEvmSignTypedDataV4(UObject* WorldContextObject, const FZkEvmSignTypedDataV4Request& Request) | ||
{ | ||
UImtblPassportZkEvmSignTypedDataV4AsyncAction* PassportZkEvmSignTypedDataV4BlueprintNode = NewObject<UImtblPassportZkEvmSignTypedDataV4AsyncAction>(); | ||
PassportZkEvmSignTypedDataV4BlueprintNode->WorldContextObject = WorldContextObject; | ||
PassportZkEvmSignTypedDataV4BlueprintNode->SignRequest = Request; | ||
return PassportZkEvmSignTypedDataV4BlueprintNode; | ||
} | ||
|
||
void UImtblPassportZkEvmSignTypedDataV4AsyncAction::Activate() | ||
{ | ||
if (!WorldContextObject || !WorldContextObject->GetWorld()) | ||
{ | ||
FString Err = "zkEVM Sign Typed Data V4 failed due to missing world or world " "context object."; | ||
IMTBL_WARN("%s", *Err) | ||
Failed.Broadcast(Err, TEXT("")); | ||
return; | ||
} | ||
|
||
GetSubsystem()->WhenReady(this, &UImtblPassportZkEvmSignTypedDataV4AsyncAction::DoZkEvmSignTypedDataV4); | ||
} | ||
|
||
void UImtblPassportZkEvmSignTypedDataV4AsyncAction::DoZkEvmSignTypedDataV4(TWeakObjectPtr<UImtblJSConnector> JSConnector) | ||
{ | ||
auto Passport = GetSubsystem()->GetPassport(); | ||
|
||
if (Passport.IsValid()) | ||
{ | ||
Passport->ZkEvmSignTypedDataV4(SignRequest, UImmutablePassport::FImtblPassportResponseDelegate::CreateUObject(this, &UImtblPassportZkEvmSignTypedDataV4AsyncAction::OnZkEvmSignTypedDataV4Response)); | ||
} | ||
} | ||
|
||
void UImtblPassportZkEvmSignTypedDataV4AsyncAction::OnZkEvmSignTypedDataV4Response(FImmutablePassportResult Result) | ||
{ | ||
if (Result.Success) | ||
{ | ||
IMTBL_LOG("zkEVM Sign Typed Data V4 success") | ||
MessageSigned.Broadcast(TEXT(""), UImmutablePassport::GetResponseResultAsString(Result.Response)); | ||
} | ||
else | ||
{ | ||
IMTBL_LOG("zkEVM Sign Typed Data V4 failed") | ||
Failed.Broadcast(Result.Error, TEXT("")); | ||
} | ||
} |
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
36 changes: 36 additions & 0 deletions
36
Source/Immutable/Public/Immutable/Actions/ImtblPassportZkEvmSignTypedDataV4AsyncAction.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,36 @@ | ||
// 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 "ImtblPassportZkEvmSignTypedDataV4AsyncAction.generated.h" | ||
|
||
/** | ||
* Async action blueprint node for zkEVM Send Transaction | ||
*/ | ||
UCLASS() | ||
class IMMUTABLE_API UImtblPassportZkEvmSignTypedDataV4AsyncAction : public UImtblBlueprintAsyncAction | ||
{ | ||
GENERATED_BODY() | ||
|
||
DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FPassportZkEvmSignTypedDataV4OutputPin, FString, ErrorMessage, FString, Signature); | ||
|
||
public: | ||
UFUNCTION(BlueprintCallable, meta = (WorldContext = "WorldContextObject", BlueprintInternalUseOnly = "true"), Category = "Immutable") | ||
static UImtblPassportZkEvmSignTypedDataV4AsyncAction* ZkEvmSignTypedDataV4(UObject* WorldContextObject, const FZkEvmSignTypedDataV4Request& Request); | ||
|
||
virtual void Activate() override; | ||
|
||
private: | ||
FZkEvmSignTypedDataV4Request SignRequest; | ||
|
||
UPROPERTY(BlueprintAssignable) | ||
FPassportZkEvmSignTypedDataV4OutputPin MessageSigned; | ||
UPROPERTY(BlueprintAssignable) | ||
FPassportZkEvmSignTypedDataV4OutputPin Failed; | ||
|
||
void DoZkEvmSignTypedDataV4(TWeakObjectPtr<class UImtblJSConnector> JSGetConnector); | ||
void OnZkEvmSignTypedDataV4Response(FImmutablePassportResult Result); | ||
}; |
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