A native UAL allowing the use of supported SignatureProviders, similar to the js-based UAL allowing developers and users the same interaction flow and UI/UX on all different platforms. The priority of this plugin is for user and developer experience, while building the same base with extension-capabilities allowing to support additional SignatureProviders like Wombat, MetaMask, AIKON, other Wallets or SideChain-Auth in the future.
Requires Unity 2019.1+ with .NET 4.x+ Runtime
This package can be included into your project by either:
- Installing the package via Unity's Package Manager (UPM) in the editor (recommended).
- Importing the .unitypackage which you can download here.
- Manually add the files in this repo.
- Installing it via NuGet.
In your Unity project:
-
Open the Package Manager Window/Tab
-
Click on + icon and then click on "Add Package From Git URL"
-
Enter URL:
https://github.com/liquiidio/UniversalAuthenticatorLibrarySharp.git#upm
Download the UnityPackage here.
Then in your Unity project:
-
Open up the import a custom package window
-
Navigate to where you downloaded the file and open it.
-
Check all the relevant files needed (if this is a first time import, just select ALL) and click on import.
Download this the latest Release.
Then in your Unity project, copy the sources from UniversalAuthenticatorLibrarySharp
into your Unity Assets
directory.
None of the dependencies is contained in this Package and no matter which installation method you choose, you have to install it manually in addition to this Package.
EosSharp is a library containing the necessary functionallity to serialize and deserialize Actions, Transactions, Blocks and other Data In addition it contains the necessary functionallity for all kinds of cryptographic operations Lastly it contains the functionallity allowing you and the AnchorLink-Library to access EOSIO or LEAP-based Nodes via their APIs.
EosSharp installation
Follow the Instructions in the EosSharp Repository
Or install the Package directly via UPM Installing via Unity Package Manager (UPM). In your Unity project: Open the Package Manager Window/Tab Click Add Package From Git URL Enter URL: https://github.com/liquiidio/EosSharp.git#upm
Allows users and developers to connect and communicate with Anchor Wallet and ESR-based applications. The Anchor & ESR Integration consists of multiple libraries for the ESR-Protocol, the Anchor-integration, Transports among others.
AnchorLinkSharp package installation
Follow the Instructions in the AnchorLinkSharp Repository
Or install the Package directly via UPM Installing via Unity Package Manager (UPM). In your Unity project: Open the Package Manager Window/Tab Click Add Package From Git URL Enter URL: https://github.com/liquiidio/AnchorLinkSharp.git#upm
A combination of local HttpListeners receiving OAuth-Callbacks from WCW-related web-adresses opened through the WebView-Plugin, gathering necessary initial information like OAuth-Tokens, followed by regular non-browser-based (non-WebView required) communication with the WCW-API/Server.
WCW package installation Follow the Instructions in the WCWUnity Repository
Or install the Package directly via UPM Installing via Unity Package Manager (UPM). In your Unity project: Open the Package Manager Window/Tab Click Add Package From Git URL Enter URL: https://github.com/liquiidio/WcwUnity.git#upm
-
In a Unity scene, add the Canvas authenticator handler prefab i.e. Canvas.
-
Add the specific authenticators that will be used e.g. AnchorWallet or WAX Cloud Wallet as prefabs to the scene and specify them in the handler that was added in Step 1.
-
Create a new script inheriting from MonoBehaviour, add a public member of type
UnityCanvasUAL
and assign it in the editor. -
In the Start-method, instantiate/initialize the handler prefab added above and add an action when the user login is successful.
N.B. Ensure that there is an assign event handler/callback for the login to get the User
object. Click here for more information.
UnityCanvasUAL.OnUserLogin += UserLogin;
await UnityCanvasUAL.Init();
-
In a Unity scene, add the authenticator handler prefab i.e. UIToolkit .
-
Add the specific authenticators that will be used e.g. AnchorWallet or WAX Cloud Wallet as prefabs to the scene and specify them in the handler that was added in Step 1.
-
Create a new script inheriting from MonoBehaviour, add a public member of type
UnityUiToolkitUAL
and assign it in the editor. -
In the Start-method, instantiate/initialize the respective handler prefab added above and add an action when the user login is successful.
N.B. Ensure that there is an assign event handler/callback for the login to get the User
object. Click here for more information.
UnityCanvasUAL.OnUserLogin += UserLogin;
await UnityCanvasUAL.Init();
To get the user that has logged in and to use the data to sign a transaction do the following:
-
After setting up a scene as explained here, add a memeber of type
User
-
Create a new method (which should match the one called by the action in the getting started section) and pass a
User
parameter. -
Then assign the parameter to the variable of type
User
.
This is most effective when assigned as an event handler/callback .
UnityXXXUal.OnUserLogin += [UserLoggedInMethod];
To perform a transfer action, do the following (ensure that you have a User
member assigned as shown here:
public async Task Transfer(string frmAcc, string toAcc, string qnty, string memo)
{
var action = new EosSharp.Core.Api.v1.Action
{
account = "eosio.token",
name = "transfer",
authorization = new List<PermissionLevel>
{
new PermissionLevel()
{
actor =
"............1", // ............1 will be resolved to the signing accounts permission
permission =
"............2" // ............2 will be resolved to the signing accounts authority
}
},
data = new Dictionary<string, object>
{
{"from", frmAcc},
{"to", toAcc},
{"quantity", qnty},
{"memo", memo}
}
};
try
{
await user.SignTransaction(new[] {action});
}
catch (Exception e)
{
Debug.Log(e);
throw;
}
}
To perform a generic transaction, do the following (ensure that you have a User
member assigned as shown here:
public async Task Transact(EosSharp.Core.Api.v1.Action action)
{
var transactResult = await User.SignTransaction(new []{ action });
}