diff --git a/docs/pages/guides/unreal-ew-guide.mdx b/docs/pages/guides/unreal-ew-guide.mdx index 352bc248a66..54bf2c327a2 100644 --- a/docs/pages/guides/unreal-ew-guide.mdx +++ b/docs/pages/guides/unreal-ew-guide.mdx @@ -38,9 +38,8 @@ We recommend using the Built-In UI for development purposes, [learn how to creat ## 2. Interact with the SDK To enable interaction with the Sequence SDK, start by creating a widget blueprint for your project. -Open the Sequence Pawn, locate the Auth Success event, and create a UserWidget of your choice. -Finally, implement the widget functionality using C++ or use the Blueprint components directly. -For Blueprints, use the `SequenceWalletBP` reference to access the functions in the following sections. +Open the Sequence Pawn, locate the `Auth Success` event, and create a reference of your new UserWidget. +Finally, use our subsystems like the `SequenceWalletBP` to access our features from the following sections. ## 3. Display Wallet Information @@ -49,36 +48,8 @@ Then, use it to fetch and display the wallet's address and current balance direc Example Use Case:
Build a UserWidget for your users Web3 profile. -```cpp -void GameUserWidget::UpdateAddress() -{ - // Get the reference to the users wallet - const TOptional WalletOptional = USequenceWallet::Get(); - const USequenceWallet* Wallet = WalletOptional.GetValue(); - - // Apply the wallet address to a text field - const FString Address = Wallet->GetWalletAddress(); - this->WalletAddress->SetText(FText::FromString("Wallet Address: " + Address)); -} -``` - -```cpp -void GameUserWidget::UpdateBalance() -{ - // Get the reference to the users wallet - const TOptional WalletOptional = USequenceWallet::Get(); - const USequenceWallet* Wallet = WalletOptional.GetValue(); - const FString Address = Wallet->GetWalletAddress(); - - // Make an asynchronous request to fetch the users balance for the chains native token - Wallet->GetEtherBalance(Address, [this](const FSeqEtherBalance& Balance) - { - const FString BalanceText = FString::Printf(TEXT("Balance: %lld"), Balance.balanceWei); - this->EtherBalance->SetText(FText::FromString(BalanceText)); - }, - [](const FSequenceError& Error){}); -} -``` +{'img'} +{'img'} ## 4. Sign a Message @@ -87,69 +58,16 @@ and initiate the signing process through the wallet to generate the signature. Example Use Case:
You can use this feature to sign a message from your backend, allowing you to verify your user's wallet upon receipt. -```cpp -void GameUserWidget::SignMessage() -{ - // Get the user input from the UEditableTextBox - const FString& MessageInputText = this->MessageInput->GetText().ToString(); - const TOptional WalletOptional = USequenceWallet::Get(); - const USequenceWallet* Wallet = WalletOptional.GetValue(); - - // Sign the user's input message - Wallet->SignMessage(MessageInputText, [this, MessageInputText](const FSeqSignMessageResponse_Response& Response) - { - const FString& SignedMessageText = *Response.Data.Message; - this->SignedMessage->SetText(FText::FromString("Signed Message: " + SignedMessageText)); - }, - [](const FSequenceError& Error){}); -} -``` - -## 5. Send an ERC20 Transaction - -To send an ERC20 transaction, first retrieve the user's wallet reference. Then, use the recipient's address, -token contract address, and amount from the boilerplate's input fields to initiate the transaction. +{'img'} + +## 5. Send Ether to another User + +To send an Ether transaction, use the recipient's address and amount from the boilerplate's input fields to initiate +the transaction with the `SequenceWalletBP` subsystem and listen to the response event. Example Use Case:
A user initiates a payment transaction to another user within your game client. -```cpp -void GameUserWidget::SendERC20Transaction() -{ - // Get the reference to the sequence wallet. - const TOptional WalletOptional = USequenceWallet::Get(); - const USequenceWallet* Wallet = WalletOptional.GetValue(); - - // Here we get the transaction values from the widgets input fields. - const FString RecipientAddress = RecipientAddressInput->GetText().ToString(); - const FString TokenContractAddress = TokenContractAddressInput->GetText().ToString(); - const FString TransactionValue = TransactionValueInput->GetText().ToString(); - - // Create the transaction object. - TArray> Txn; - - FERC20Transaction T20; - T20.to = ToAddress; - T20.tokenAddress = TokenAddress; - T20.value = TransactionValue; - - Txn.Push(TUnion(T20)); - - // Get the fee options before we send the transaction, - Wallet->GetFeeOptions(Txn, [this, Txn, Wallet](const TArray& Response) - { - const FFeeOption SelectedFeeOption = Response[0]; - UE_LOG(LogTemp, Log, TEXT("Using FeeOption value: %s"), *SelectedFeeOption.Value); - - // Send the transaction including the selected fee option. - Wallet->SendTransactionWithFeeOption(Txn, SelectedFeeOption, [=](const FSeqTransactionResponse_Data& Transaction) - { - UE_LOG(LogTemp, Log, TEXT("SUCCESS: Transaction sent, hash: %s"), *Transaction.TxHash); - }, - [](const FSequenceError& Error) {}); - }, - [](const FSequenceError& Error) {}); -} -``` +{'img'} :::warning Make sure to include your own error handling. The provided code snippets are simplified. diff --git a/docs/public/img/unreal/unreal_boilerplate_address.png b/docs/public/img/unreal/unreal_boilerplate_address.png new file mode 100644 index 00000000000..98d90a4405a --- /dev/null +++ b/docs/public/img/unreal/unreal_boilerplate_address.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:64b9a923a0b19b00cf85bcce6d40a17334f3d3903e725d61d6e5c45b37528560 +size 236972 diff --git a/docs/public/img/unreal/unreal_boilerplate_balance.png b/docs/public/img/unreal/unreal_boilerplate_balance.png new file mode 100644 index 00000000000..98920be6d23 --- /dev/null +++ b/docs/public/img/unreal/unreal_boilerplate_balance.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:39dc1cea0286d35143d7e534209941b9a16d6a731ff74c3e30f20ec9360985d2 +size 532314 diff --git a/docs/public/img/unreal/unreal_boilerplate_signature.png b/docs/public/img/unreal/unreal_boilerplate_signature.png new file mode 100644 index 00000000000..cff7caa3263 --- /dev/null +++ b/docs/public/img/unreal/unreal_boilerplate_signature.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6529b83189465f2aea869353681b0c8ad9605238decc78ce00f2f6c5a78340dc +size 478712 diff --git a/docs/public/img/unreal/unreal_boilerplate_transaction.png b/docs/public/img/unreal/unreal_boilerplate_transaction.png new file mode 100644 index 00000000000..c57900f449a --- /dev/null +++ b/docs/public/img/unreal/unreal_boilerplate_transaction.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:70dc1335c5a90b26e80b1ce6b7bbfad266bdff49e51b0c7a0977591fa24ba517 +size 601442