Skip to content

warfield2016/godot-mwa-sdk

Repository files navigation

Godot Mobile Wallet Adapter SDK

License: MIT Godot 4.3 Android

Standalone Godot 4.3 GDExtension Android plugin for the Solana Mobile Wallet Adapter (MWA) 2.0 protocol. API parity with the official React Native SDK.

Features

  • Full MWA 2.0 API: authorize, sign transactions, sign messages, capabilities
  • Native Android wallet connection (Phantom, Solflare, Backpack)
  • Encrypted auth token cache (Android Keystore-backed)
  • Silent reconnection via cached tokens
  • Signal-based async API

API

MWA Method GDScript
authorize authorize(token_handle)
deauthorize deauthorize(token_handle)
get_capabilities get_capabilities()
sign_and_send_transactions sign_and_send_transactions(payloads)
sign_messages sign_messages(addresses, payloads)
sign_transactions sign_transactions(payloads)

Quick Start

var mwa = MobileWalletAdapter.new()
mwa.identity_name = "My Game"
mwa.chain = "solana:devnet"

mwa.session_ready.connect(func(): mwa.authorize())
mwa.authorized.connect(func(accts, handle, uri): print("Connected: ", accts))
mwa.error.connect(func(code, msg): print("Error: ", code, " ", msg))

mwa.transact()

Building from Source

Prerequisites

Clone

git clone --recursive https://github.com/user/godot-mwa-sdk.git
cd godot-mwa-sdk

Build C++ GDExtension

export ANDROID_NDK_ROOT=$ANDROID_HOME/ndk/23.2.8568313
cd godot-cpp && scons platform=android target=template_debug arch=arm64 -j$(nproc) && cd ..
scons platform=android arch=arm64 target=template_debug -j$(nproc)

Build Android AAR

cd android && ./gradlew assembleDebug && cd ..

Install in Godot Project

Copy addons/SolanaMWA/ into your Godot project's addons/ folder. Enable the plugin in Project Settings > Plugins.

Network Security Config

Your game's AndroidManifest.xml must allow loopback cleartext for MWA's WebSocket:

<application android:networkSecurityConfig="@xml/network_security_config">

The template config is included in the AAR at res/xml/network_security_config.xml.

Platform Support

Platform Status
Android arm64 Full MWA 2.0 support
iOS Not supported (OS restriction)
Desktop/Web Stubs return error signals

Requirements

  • Godot 4.3+
  • Android minSdk 24, targetSdk 34
  • MWA-compatible wallet (Phantom, Solflare, Backpack)

Documentation

License

MIT -- see LICENSE

Dependencies

About

Godot 4.3 GDExtension for Solana Mobile Wallet Adapter (MWA) 2.0

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors