Skip to content

[ID-3789] fix: send transaction with confirmation hash, e2e tests #494

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:
VALIDATE_ALL_CODEBASE: true
DEFAULT_BRANCH: main
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
FILTER_REGEX_EXCLUDE: (.*src/Packages/Passport/Runtime/ThirdParty/.*|.*src/Packages/Passport/Runtime/Resources/.*|.*Plugins/.*|.*src/Packages/Passport/Runtime/Assets/ImmutableAndroid.androidlib/.*|.*src/Packages/Orderbook|.*src/Packages/ZkEvmApi/.*|.*sample|.*src/Packages/Passport/WebGLTemplates~|.*.github/workflows)
FILTER_REGEX_EXCLUDE: (.*src/Packages/Passport/Runtime/ThirdParty/.*|.*src/Packages/Passport/Runtime/Resources/.*|.*Plugins/.*|.*src/Packages/Passport/Runtime/Assets/ImmutableAndroid.androidlib/.*|.*src/Packages/Orderbook|.*src/Packages/ZkEvmApi/.*|.*sample|.*src/Packages/Passport/WebGLTemplates~|.*.github/workflows|.*src/Packages/Passport/Samples~)
VALIDATE_MARKDOWN: false
VALIDATE_GITLEAKS: false
VALIDATE_JSCPD: false
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -107,4 +107,6 @@ sample/Assets/Vuplex*

__pycache__/
*.pyc
.pytest_cache/
.pytest_cache/

xcuserdata/
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,4 @@ public static void NavigateToUnauthenticatedScene()
{
UnityEngine.SceneManagement.SceneManager.LoadScene("UnauthenticatedScene");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ private void ShowOutput(string message)
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -146,4 +146,4 @@ private void ShowOutput(string message)
Output.text = message;
}
}
}
}
8 changes: 4 additions & 4 deletions sample/Assets/Scripts/Passport/ImxConnect/ImxConnectScript.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ private async UniTaskVoid ConnectImxAsync()
try
{
await Passport.Instance.ConnectImx();

SampleAppManager.IsConnectedToImx = true;
ShowOutput("Connected to IMX"); // Show success early

Expand All @@ -37,14 +37,14 @@ private async UniTaskVoid ConnectImxAsync()
if (unauthSceneManager != null)
{
unauthSceneManager.OnImxConnected?.Invoke();
return;
return;
}

var authSceneManager = FindObjectOfType<AuthenticatedSceneManager>();
if (authSceneManager != null)
{
authSceneManager.UpdateImxButtonStates();
authSceneManager.OnImxConnected?.Invoke();
authSceneManager.OnImxConnected?.Invoke();
return;
}
}
Expand All @@ -61,4 +61,4 @@ private void ShowOutput(string message)
Output.text = message;
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,4 @@ private void ShowOutput(string message)
Output.text = message;
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ private async UniTaskVoid CheckIsRegisteredOffchainAsync()
try
{
bool isRegistered = await SampleAppManager.PassportInstance.IsRegisteredOffchain();

if (isRegistered)
{
ShowOutput("Registered");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,4 +105,4 @@ private void ShowOutput(string message)
Output.text = message;
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,4 @@ private void ShowOutput(string message)
Output.text = message;
}
}
}
}
2 changes: 1 addition & 1 deletion sample/Assets/Scripts/Passport/Login/LoginScript.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,4 @@ private void ShowOutput(string message)
Output.text = message;
}
}
}
}
2 changes: 1 addition & 1 deletion sample/Assets/Scripts/Passport/Logout/LogoutScript.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@ private async UniTaskVoid LogoutAsync()
Debug.LogError($"Failed to logout: {ex.Message}");
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,4 @@ public void ShowLinkWallet()
}

// Add more navigation methods as needed for other features
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,4 @@ private void ShowOutput(string message)
Debug.LogWarning($"[SetCallTimeoutScript] Output Text is not assigned. Message: {message}");
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,4 @@ private void ShowOutput(string message)
Output.text = message;
}
}
}
}
2 changes: 1 addition & 1 deletion sample/Assets/Scripts/Passport/Relogin/ReloginScript.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,4 @@ private void ShowOutput(string message)
Output.text = message;
}
}
}
}
2 changes: 1 addition & 1 deletion sample/Assets/Scripts/Passport/SampleAppManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ public static class SampleAppManager
/// Holds the Passport instance for IMX operations.
/// </summary>
public static Immutable.Passport.Passport PassportInstance { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ void Awake()
{
OnImxConnected = () => { UnityEngine.SceneManagement.SceneManager.LoadScene("AuthenticatedScene"); };
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ private async UniTaskVoid ConnectZkEvmAsync()
try
{
await Passport.Instance.ConnectEvm();

// Add these lines to update connection state and refresh UI
SampleAppManager.IsConnectedToZkEvm = true;
var sceneManager = FindObjectOfType<AuthenticatedSceneManager>();
Expand All @@ -44,7 +44,7 @@ private async UniTaskVoid ConnectZkEvmAsync()
{
Debug.LogWarning("Could not find AuthenticatedSceneManager to update button states");
}

ShowOutput("Connected to EVM");
}
catch (System.Exception ex)
Expand All @@ -60,4 +60,4 @@ private void ShowOutput(string message)
output.text = message;
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,4 @@ private void ShowOutput(string message)
Output.text = message;
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,4 @@ private void ShowOutput(string message)
Output.text = message;
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ void Start()
ShowOutput("Passport instance is null");
return;
}

// Make sure UI elements are initialised
if (ConfirmToggle != null && GetTransactionReceiptToggle != null)
{
Expand Down Expand Up @@ -66,16 +66,16 @@ private async UniTaskVoid SendTransactionAsync()
value = ValueInputField != null ? ValueInputField.text : "",
data = DataInputField != null ? DataInputField.text : ""
};

if (ConfirmToggle != null && ConfirmToggle.isOn)
{
TransactionReceiptResponse response = await SampleAppManager.PassportInstance.ZkEvmSendTransactionWithConfirmation(request);
ShowOutput($"Transaction hash: {response.transactionHash}\nStatus: {GetTransactionStatusString(response.status)}");
ShowOutput($"Transaction hash: {response.hash}\nStatus: {GetTransactionStatusString(response.status)}");
}
else
{
string transactionHash = await SampleAppManager.PassportInstance.ZkEvmSendTransaction(request);

if (GetTransactionReceiptToggle != null && GetTransactionReceiptToggle.isOn)
{
string? status = await PollStatus(transactionHash);
Expand Down Expand Up @@ -150,4 +150,4 @@ private void ShowOutput(string message)
Debug.Log($"ZkEvmSendTransactionScript: {message}");
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@ private void ShowOutput(string message)
Output.text = message;
}
}
}
}
1 change: 1 addition & 0 deletions sample/Tests/test/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ def test_2_imx_functions(self):

# Connect to IMX
self.altdriver.find_object(By.NAME, "ConnectBtn").tap()
time.sleep(5)
text = output.get_text()
print(f"ConnectBtn output: {text}")
self.assertEqual("Connected to IMX", text)
Expand Down
1 change: 1 addition & 0 deletions sample/Tests/test/test_android.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ def test_6_pkce_relogin(self):

# Click Connect to IMX button
self.altdriver.find_object(By.NAME, "ConnectBtn").tap()
time.sleep(5)
self.assertEqual("Connected to IMX", output.get_text())

self.altdriver.stop()
Expand Down
Loading
Loading