diff --git a/Plugins/SequencePlugin/Content/Core/Pawn_Components/AC_SequencePawn_Component.uasset b/Plugins/SequencePlugin/Content/Core/Pawn_Components/AC_SequencePawn_Component.uasset index 9387239e9..aaf867316 100644 --- a/Plugins/SequencePlugin/Content/Core/Pawn_Components/AC_SequencePawn_Component.uasset +++ b/Plugins/SequencePlugin/Content/Core/Pawn_Components/AC_SequencePawn_Component.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c9e98f46668233166316278e81da225edcc5b5dec838547eff17f2473d3fb020 -size 2374223 +oid sha256:8b791c47c7cc0be72b4be832085448682755097fd1e8733b5cc0f42882fe84ff +size 2377660 diff --git a/Plugins/SequencePlugin/Source/SequencePlugin/Private/Sequence/SequenceAPI.cpp b/Plugins/SequencePlugin/Source/SequencePlugin/Private/Sequence/SequenceAPI.cpp index 991300a45..2729743d0 100644 --- a/Plugins/SequencePlugin/Source/SequencePlugin/Private/Sequence/SequenceAPI.cpp +++ b/Plugins/SequencePlugin/Source/SequencePlugin/Private/Sequence/SequenceAPI.cpp @@ -203,6 +203,14 @@ void USequenceWallet::ListSessions(const TSuccessCallback& OnSuccess, const FFailureCallback& OnFailure) const +{ + if (this->SequenceRPCManager) + { + this->SequenceRPCManager->ListAccounts(this->Credentials, OnSuccess, OnFailure); + } +} + void USequenceWallet::GetSessionAuthProof(const FString& Nonce, const TSuccessCallback& OnSuccess, const FFailureCallback& OnFailure) const { if (this->SequenceRPCManager) diff --git a/Plugins/SequencePlugin/Source/SequencePlugin/Private/Sequence/SequenceSendIntent.h b/Plugins/SequencePlugin/Source/SequencePlugin/Private/Sequence/SequenceSendIntent.h index a4863135b..26958bae6 100644 --- a/Plugins/SequencePlugin/Source/SequencePlugin/Private/Sequence/SequenceSendIntent.h +++ b/Plugins/SequencePlugin/Source/SequencePlugin/Private/Sequence/SequenceSendIntent.h @@ -17,6 +17,7 @@ static const FString SendTransactionOP = "sendTransaction"; static const FString FeeOptionsOP = "feeOptions"; static const FString GetIdTokenOP = "getIdToken"; static const FString ListSessionsOP = "listSessions"; +static const FString ListAccountsOP = "listAccounts"; static const FString GetSessionAuthProofOP = "sessionAuthProof"; static const FString SignMessageOP = "signMessage"; static const FString FederateSessionOP = "federateAccount"; @@ -446,6 +447,30 @@ struct SEQUENCEPLUGIN_API FListSessionsData : public FGenericData } }; +USTRUCT() +struct SEQUENCEPLUGIN_API FListAccountsData : public FGenericData +{ + GENERATED_USTRUCT_BODY() + UPROPERTY() + FString wallet = ""; + + FListAccountsData() + { + Operation = ListAccountsOP; + } + + FListAccountsData(const FString& WalletIn) + { + Operation = ListAccountsOP; + wallet = WalletIn; + } + + virtual FString GetJson() const override + { + return ""; + } +}; + USTRUCT() struct SEQUENCEPLUGIN_API FGetSessionAuthProofData : public FGenericData { diff --git a/Plugins/SequencePlugin/Source/SequencePlugin/Private/Sequence/SequenceWalletBP.cpp b/Plugins/SequencePlugin/Source/SequencePlugin/Private/Sequence/SequenceWalletBP.cpp index 4e8c88799..22ba04cde 100644 --- a/Plugins/SequencePlugin/Source/SequencePlugin/Private/Sequence/SequenceWalletBP.cpp +++ b/Plugins/SequencePlugin/Source/SequencePlugin/Private/Sequence/SequenceWalletBP.cpp @@ -73,6 +73,14 @@ void USequenceWalletBP::CallOnApiListSessions(const FSequenceResponseStatus& Sta UE_LOG(LogTemp, Error, TEXT("[Nothing bound to: OnApiListSessions]")); } +void USequenceWalletBP::CallOnApiListAccounts(const FSequenceResponseStatus& Status, const FSeqListAccountsResponse_Data& Response) const +{ + if (this->OnApiListAccounts.IsBound()) + this->OnApiListAccounts.Broadcast(Status, Response); + else + UE_LOG(LogTemp, Error, TEXT("[Nothing bound to: OnApiListAccounts]")); +} + void USequenceWalletBP::CallOnApiGetSessionAuthProof(const FSequenceResponseStatus& Status, const FSeqGetSessionAuthProof_Data Response) const { if (this->OnApiGetSessionAuthProof.IsBound()) @@ -455,6 +463,26 @@ void USequenceWalletBP::ApiListSessions() } } +void USequenceWalletBP::ApiListAccounts() +{ + const TFunction OnSuccess = [this](const FSeqListAccountsResponse_Data& Response) + { + this->CallOnApiListAccounts(FSequenceResponseStatus(true, ListAccountsTrt), Response); + }; + + const TFunction OnFailure = [this](const FSequenceError& Err) + { + this->CallOnApiListAccounts(FSequenceResponseStatus(false, Err.Message, ListAccountsTrt), {}); + }; + + const TOptional WalletOptional = USequenceWallet::Get(); + if (WalletOptional.IsSet() && WalletOptional.GetValue()) + { + const USequenceWallet* Wallet = WalletOptional.GetValue(); + Wallet->ListAccounts(OnSuccess, OnFailure); + } +} + void USequenceWalletBP::ApiGetSessionAuthProof(const FString& Nonce) { diff --git a/Plugins/SequencePlugin/Source/SequencePlugin/Private/SequenceRPCManager.cpp b/Plugins/SequencePlugin/Source/SequencePlugin/Private/SequenceRPCManager.cpp index 81273f7cc..2912bdacd 100644 --- a/Plugins/SequencePlugin/Source/SequencePlugin/Private/SequenceRPCManager.cpp +++ b/Plugins/SequencePlugin/Source/SequencePlugin/Private/SequenceRPCManager.cpp @@ -131,6 +131,13 @@ FString USequenceRPCManager::BuildListSessionIntent(const FCredentials_BE& Crede return Intent; } +FString USequenceRPCManager::BuildListAccountsIntent(const FCredentials_BE& Credentials) const +{ + const FListAccountsData ListAccountsData(Credentials.GetWalletAddress()); + const FString Intent = this->GenerateIntent(ListAccountsData); + return Intent; +} + FString USequenceRPCManager::BuildGetSessionAuthProofIntent(const FCredentials_BE& Credentials, const FString& Nonce) const { const FGetSessionAuthProofData GetSessionAuthProofData(Credentials.GetNetworkString(), Credentials.GetWalletAddress(), Nonce); @@ -441,6 +448,33 @@ void USequenceRPCManager::ListSessions(const FCredentials_BE& Credentials, const } } +void USequenceRPCManager::ListAccounts(const FCredentials_BE& Credentials, const TSuccessCallback& OnSuccess, const FFailureCallback& OnFailure) const +{ + const TSuccessCallback OnResponse = [OnSuccess, OnFailure](const FString& Response) + { + const FSeqListAccountsResponse ParsedResponse = USequenceSupport::JSONStringToStruct(Response); + + UE_LOG(LogTemp, Log, TEXT("%s"), *Response); + if (ParsedResponse.IsValid()) + { + OnSuccess(ParsedResponse.Response.Data); + } + else + { + OnFailure(FSequenceError(RequestFail, "Error Parsing Response: " + Response)); + } + }; + + if (Credentials.RegisteredValid()) + { + this->SequenceRPC(this->BuildAuthenticatorIntentsUrl(), this->BuildListAccountsIntent(Credentials), OnResponse, OnFailure); + } + else + { + OnFailure(FSequenceError(RequestFail, "[Session Not Registered Please Register Session First]")); + } +} + void USequenceRPCManager::GetSessionAuthProof(const FCredentials_BE& Credentials, const FString& Nonce, const TSuccessCallback& OnSuccess, const FFailureCallback& OnFailure) const { const TSuccessCallback OnResponse = [OnSuccess, OnFailure](const FString& Response) diff --git a/Plugins/SequencePlugin/Source/SequencePlugin/Private/SequenceRPCManager.h b/Plugins/SequencePlugin/Source/SequencePlugin/Private/SequenceRPCManager.h index 745902c4c..0277cdfd9 100644 --- a/Plugins/SequencePlugin/Source/SequencePlugin/Private/SequenceRPCManager.h +++ b/Plugins/SequencePlugin/Source/SequencePlugin/Private/SequenceRPCManager.h @@ -69,6 +69,7 @@ class SEQUENCEPLUGIN_API USequenceRPCManager : public UObject FString BuildSendTransactionWithFeeIntent(const FCredentials_BE& Credentials, const TArray& Transactions,const FString& FeeQuote) const; FString BuildGetIdTokenIntent(const FCredentials_BE& Credentials, const FString& nonce) const; FString BuildListSessionIntent(const FCredentials_BE& Credentials) const; + FString BuildListAccountsIntent(const FCredentials_BE& Credentials) const; FString BuildGetSessionAuthProofIntent(const FCredentials_BE& Credentials, const FString& Nonce) const; FString BuildCloseSessionIntent() const; FString BuildSessionValidationIntent() const; @@ -199,6 +200,7 @@ class SEQUENCEPLUGIN_API USequenceRPCManager : public UObject void ListSessions(const FCredentials_BE& Credentials, const TSuccessCallback>& OnSuccess, const FFailureCallback& OnFailure) const; + void ListAccounts(const FCredentials_BE& Credentials, const TSuccessCallback& OnSuccess, const FFailureCallback& OnFailure) const; void GetSessionAuthProof(const FCredentials_BE& Credentials, const FString& Nonce, const TSuccessCallback& OnSuccess, const FFailureCallback& OnFailure) const; /** diff --git a/Plugins/SequencePlugin/Source/SequencePlugin/Public/Marketplace/Structs/SeqMarketplaceSortBy.h b/Plugins/SequencePlugin/Source/SequencePlugin/Public/Marketplace/Structs/SeqMarketplaceSortBy.h index 6e2463b8c..74dfde91b 100644 --- a/Plugins/SequencePlugin/Source/SequencePlugin/Public/Marketplace/Structs/SeqMarketplaceSortBy.h +++ b/Plugins/SequencePlugin/Source/SequencePlugin/Public/Marketplace/Structs/SeqMarketplaceSortBy.h @@ -2,6 +2,7 @@ #include "CoreMinimal.h" #include "Marketplace/Marketplace_Enums.h" +#include "Dom/JsonObject.h" #include "SeqMarketplaceSortBy.generated.h" USTRUCT(BlueprintType) diff --git a/Plugins/SequencePlugin/Source/SequencePlugin/Public/Sequence/SequenceAPI.h b/Plugins/SequencePlugin/Source/SequencePlugin/Public/Sequence/SequenceAPI.h index e4cb8181b..ee6753332 100644 --- a/Plugins/SequencePlugin/Source/SequencePlugin/Public/Sequence/SequenceAPI.h +++ b/Plugins/SequencePlugin/Source/SequencePlugin/Public/Sequence/SequenceAPI.h @@ -209,6 +209,7 @@ class SEQUENCEPLUGIN_API USequenceWallet : public UGameInstanceSubsystem void ListSessions(const TSuccessCallback>& OnSuccess, const FFailureCallback& OnFailure) const; + void ListAccounts(const TSuccessCallback& OnSuccess, const FFailureCallback& OnFailure) const; void GetSessionAuthProof(const FString& Nonce, const TSuccessCallback& OnSuccess, const FFailureCallback& OnFailure) const; diff --git a/Plugins/SequencePlugin/Source/SequencePlugin/Public/Sequence/SequenceResponseIntent.h b/Plugins/SequencePlugin/Source/SequencePlugin/Public/Sequence/SequenceResponseIntent.h index 348e78eed..5eb2cc96e 100644 --- a/Plugins/SequencePlugin/Source/SequencePlugin/Public/Sequence/SequenceResponseIntent.h +++ b/Plugins/SequencePlugin/Source/SequencePlugin/Public/Sequence/SequenceResponseIntent.h @@ -639,6 +639,66 @@ struct SEQUENCEPLUGIN_API FSeqListSessionsResponse } }; +USTRUCT(Blueprintable) +struct SEQUENCEPLUGIN_API FSeqAccount +{ + GENERATED_BODY() + + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Default") + FString Id = ""; + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Default") + FString Type = ""; + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Default") + FString Issuer = ""; + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Default") + FString Email = ""; + + +}; + +USTRUCT(Blueprintable) +struct SEQUENCEPLUGIN_API FSeqListAccountsResponse_Data +{ + GENERATED_BODY() + + UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Default") + TArray Accounts; + UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Default") + FString CurrentAccountId = ""; +}; + + + +USTRUCT() +struct SEQUENCEPLUGIN_API FSeqListAccountsResponse_Response +{ + GENERATED_BODY() + UPROPERTY() + FString Code = ""; + UPROPERTY() + FSeqListAccountsResponse_Data Data; + + bool IsValid() const + { + return Code.Equals(TEXT("accountList"), ESearchCase::IgnoreCase); + } +}; + +USTRUCT() +struct SEQUENCEPLUGIN_API FSeqListAccountsResponse +{ + GENERATED_BODY() + + UPROPERTY() + FSeqListAccountsResponse_Response Response; + + bool IsValid() const + { + return Response.IsValid(); + } +}; + + //ListSessions// diff --git a/Plugins/SequencePlugin/Source/SequencePlugin/Public/Sequence/SequenceWalletBP.h b/Plugins/SequencePlugin/Source/SequencePlugin/Public/Sequence/SequenceWalletBP.h index 82e8e6d01..e9aa51a34 100644 --- a/Plugins/SequencePlugin/Source/SequencePlugin/Public/Sequence/SequenceWalletBP.h +++ b/Plugins/SequencePlugin/Source/SequencePlugin/Public/Sequence/SequenceWalletBP.h @@ -23,6 +23,7 @@ DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnIApiSendTransactionWtihFeeOption DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnIApiSendTransaction, FSequenceResponseStatus, ResponseStatus, FSeqTransactionResponse_Data, Response); DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnIApiGetIdToken, FSequenceResponseStatus, ResponseStatus, FSeqIdTokenResponse_Data, Response); DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnIApiListSessions, FSequenceResponseStatus, ResponseStatus, const TArray&, Sessions); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnIApiListAccounts, FSequenceResponseStatus, ResponseStatus, const FSeqListAccountsResponse_Data&, Data); DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnIApiGetSessionAuthProof, FSequenceResponseStatus, ResponseStatus, const FSeqGetSessionAuthProof_Data, Response); DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnIApiGetSupportedTransakCountries, FSequenceResponseStatus, ResponseStatus, const TArray&, SupportedCountries); @@ -85,6 +86,9 @@ class SEQUENCEPLUGIN_API USequenceWalletBP : public UGameInstanceSubsystem UPROPERTY(BlueprintAssignable, Category="0xSequence SDK - Events") FOnIApiListSessions OnApiListSessions; + UPROPERTY(BlueprintAssignable, Category = "0xSequence SDK - Events") + FOnIApiListAccounts OnApiListAccounts; + UPROPERTY(BlueprintAssignable, Category = "0xSequence SDK - Events") FOnIApiGetSessionAuthProof OnApiGetSessionAuthProof; @@ -140,6 +144,7 @@ class SEQUENCEPLUGIN_API USequenceWalletBP : public UGameInstanceSubsystem void CallOnApiSendTransaction(const FSequenceResponseStatus& Status, const FSeqTransactionResponse_Data& Response) const; void CallOnApiGetIdToken(const FSequenceResponseStatus& Status, const FSeqIdTokenResponse_Data& Response) const; void CallOnApiListSessions(const FSequenceResponseStatus& Status, const TArray& Sessions) const; + void CallOnApiListAccounts(const FSequenceResponseStatus& Status, const FSeqListAccountsResponse_Data& Response) const; void CallOnApiGetSessionAuthProof(const FSequenceResponseStatus& Status, const FSeqGetSessionAuthProof_Data Response) const; void CallOnApiGetSupportedTransakCountries(const FSequenceResponseStatus& Status, const TArray& SupportedCountries) const; @@ -265,6 +270,9 @@ class SEQUENCEPLUGIN_API USequenceWalletBP : public UGameInstanceSubsystem UFUNCTION(BlueprintCallable, Category="0xSequence SDK - Functions") void ApiListSessions(); + UFUNCTION(BlueprintCallable, Category = "0xSequence SDK - Functions") + void ApiListAccounts(); + UFUNCTION(BlueprintCallable, Category = "0xSequence SDK - Functions") void ApiGetSessionAuthProof(const FString& Nonce); diff --git a/Plugins/SequencePlugin/Source/SequencePlugin/Public/Sequence/SequenceWalletBPTypes.h b/Plugins/SequencePlugin/Source/SequencePlugin/Public/Sequence/SequenceWalletBPTypes.h index 43afd42bb..dfded28de 100644 --- a/Plugins/SequencePlugin/Source/SequencePlugin/Public/Sequence/SequenceWalletBPTypes.h +++ b/Plugins/SequencePlugin/Source/SequencePlugin/Public/Sequence/SequenceWalletBPTypes.h @@ -41,6 +41,7 @@ enum ETransactionResponseType SendTransactionTrt UMETA(DisplayName = "SendTransaction"), GetIdTokenTrt UMETA(DisplayName = "GetIdToken"), ListSessionsTrt UMETA(DisplayName = "ListSessions"), + ListAccountsTrt UMETA(DisplayName = "ListAccounts"), GetSessionAuthProofTrt UMETA(DisplayName = "GetSessionAuthProof"), GetSupportedTransakCountriesTrt UMETA(DisplayName = "GetSupportedTransakCountries"), PingTrt UMETA(DisplayName = "Ping"),