Quick Start

Connect

Create an image for QRCode

This step is needed only if the Unity app does not run on a mobile device with the xPortal app already installed.

For the QR code to be displayed, an empty Image component needs to be created, as shown below.

QR Code Holder

Connect to xPortal

Call the Connect method as shown below.

After the Connect method is called, a web socket will be created to communicate with the xPortal app, and a QR code will be automatically generated on that blank image. After the QR code is scanned and the connection is approved inside xPortal, the OnConnected callback will be triggered.

Login on a Mobile Device

The QR code cannot be scanned if the xPortal app is on the same device, so a method called DeepLinkLogin needs to be used to communicate directly with the xPortal app.

After the Connect method from the previous point is called, and after the OnSessionConnected callback is received, the DeepLinkLogin method needs to be called to trigger the login prompt inside xPortal:

This has the same result as the QR scanning method. After the connection is approved inside xPortal, the OnConnected callback will be triggered.

Send EGLD Transaction

To send a transaction the SendEGLDTransaction method will be used.

After SendTransaction is called, the xPortal app will receive a notification to sign the transaction. If the user decides to approve the transaction, the signature will be automatically applied, and the transaction will be sent automatically to MultiversX blockchain for processing. In this case, an operationStatus of Complete will be received. If the user declines to sign or an error occurs, an operationStatus of Error will be received.

After a transaction is submitted to the blockchain, it takes some time for a validator to process it. An app needs to check if that transaction was successfully processed or not before continuing execution. This is done using the CheckTransactionStatus API method.

Disconnect

To terminate the user's active session simply call disconnect.

This will trigger the OnDisconnected method and close the web socket.

This concludes the Quick Start. Check the Complete API for advanced functionalities.

Last updated