Unity SDK
Overview of WAX Cloud Wallet SDK
The WAX Cloud Wallet Unity SDK enables seamless integration between Unity applications and the WAX Cloud Wallet mobile app. This SDK provides developers with a robust solution for implementing blockchain transactions in their Unity applications, offering cross-platform support and secure transaction signing capabilities.
The SDK abstracts the complexity of blockchain interactions, allowing developers to focus on building great user experiences while ensuring secure transaction signing and user authentication.
Key Features
Cross-Platform Support
- Mobile Platforms: Android and iOS support with native integration
- Desktop Platforms: QR code-based authentication for desktop applications
- WebGL: Remote signing support for web-based applications
- Automatic Platform Configuration: Handles platform-specific setup automatically
⚠️ Note: WebGL is now supported but only for remote signing. Stay tuned for additional WebGL features in upcoming updates!
Transaction Management
1. Secure Transaction Signing
- End-to-end encrypted communication
- Transaction status tracking
- Timeout handling
2. Authentication & Security
- Secure user authentication
- Encrypted data transfer
- Single-use token implementation
- Secure wallet session management
3. Developer Experience
- Simple Integration
- Minimal configuration required
- Comprehensive C# support
- Event System
- Real-time connection status updates
- Transaction event notifications
4. Platform-Specific Features
- Android: Automatic manifest configuration
- iOS: Automatic URL scheme registration
- Desktop: QR code scanning support
Installation
Via UPM (Unity Package Manager)
Using Git URL
Add the following line to your Packages/manifest.json
:
{
"dependencies": {
"com.wax.cloudwallet": "https://github.com/worldwide-asset-exchange/cloudwallet-unity-sdk.git?path=Assets/CloudWalletPlugin"
}
}
For specific versions:
{
"dependencies": {
"com.wax.cloudwallet": "https://github.com/worldwide-asset-exchange/cloudwallet-unity-sdk.git?path=Assets/CloudWalletPlugin#1.0.0"
}
}
Using OpenUPM
openupm add com.wax.cloudwallet
Via Unity Package
- Download the latest
CloudWalletPlugin.*.*.*.unitypackage
from the releases page - In Unity, go to
Assets > Import Package > Custom Package
- Select the downloaded
.unitypackage
file - Click "Import" to import all the necessary files
Getting Started
Initialization
Initialize the plugin with your dApp information:
using CloudWalletPlugin;
public class YourMonoBehaviour : MonoBehaviour
{
private CloudWalletPluginConnector connector;
private void Start()
{
connector = CloudWalletPluginConnector.Initialize(
dappName: "YourDAppName",
origin: "yourdapp.com",
icon: "https://your-icon-url.com/icon.png",
description: "Your dApp description",
schema: "yourdapp",
sutGenerationUrl: "https://your-backend.com/sut/generate",
sdkClientId: "your-client-id"
);
}
}
Wallet Connection
// Activate wallet
public async void ConnectWallet()
{
try
{
string nonce = Guid.NewGuid().ToString();
await connector.Activate(nonce);
Debug.Log("Wallet connected successfully");
}
catch (Exception e)
{
Debug.LogError($"Connection failed: {e.Message}");
}
}
// Deactivate wallet
public async void DisconnectWallet()
{
try
{
await connector.Deactivate();
Debug.Log("Wallet disconnected successfully");
}
catch (Exception e)
{
Debug.LogError($"Disconnection failed: {e.Message}");
}
}
Transaction Signing
public async void SignTransaction()
{
try
{
var transaction = new Transaction
{
// Configure your transaction here
};
var signedTransaction = await connector.SignTransaction(transaction);
Debug.Log("Transaction signed successfully");
}
catch (Exception e)
{
Debug.LogError($"Transaction signing failed: {e.Message}");
}
}
Security Considerations
- All sensitive data is encrypted during transmission
- Single-use tokens are required for authentication
- Wallet sessions are managed securely
- Platform-specific security measures are implemented automatically
Best Practices
- Always initialize the SDK before use
- Handle exceptions appropriately
- Implement proper error messaging for users
- Use the singleton pattern for SDK access
- Follow platform-specific guidelines for deployment
Support
For support, please:
- Check the GitHub Issues
- Review the documentation
- Contact support at support@wax.io