Coder Social home page Coder Social logo

isabella232 / walletconnectunity Goto Github PK

View Code? Open in Web Editor NEW

This project forked from walletconnect/walletconnectunity

0.0 0.0 0.0 5.93 MB

This project is an extension of WalletConnectSharp that brings WalletConnect to Unity.

License: MIT License

C# 100.00%

walletconnectunity's Introduction

WalletConnectUnity

This project is an extension of WalletConnectSharp that brings WalletConnect to Unity. This project has been built using Unity 2019.4.28f1 (LTS), and has been tested using 2020.1.14f1.

This project includes a working demo scene (TODO: needs to show sample transactions)

⚠️ This is beta software: This software is currently in beta and under development. Please proceed with caution, and open a new issue if you encounter a bug ⚠️

Installation

To use WalletConnectUnity, you would need Unity2019.4.28f1 or above.

After making a new project in Unity, you will need to download WalletConnectUnity from this repo by cloning it, forking it, or downloading as a zip file. Take the contents of the Assets folder in the repo and place it in your Unity Project.

Once imported in your Unity Project, create a game object in your scene named Wallet Connect and attach the Wallet Connect component to the your new game object. You can configure both the connection settings and app details in the Wallet Connect Component.

Usage

To use WalletConnect in your Unity project, simply create an empty GameObject in your Scene and attach the WalletConnect component to your GameObject. Attaching this script will automatically attach any required components as well

example

Options

  • Default Wallet
    • The default wallet to open up on iOS when no when no wallet is specified in OpenMobileWallet
  • Auto Save and Resume
    • Automatically saves the session when the application pauses or quits and resumes the session when the app resumes or starts.
  • Connect On Awake
    • Whether you would like WalletConnect to automatically start listening for a Wallet connection on awake. The user will still need to initiate a connection either by scanning a QR code or through deep linking
  • Connect On Start
    • Whether you would like WalletConnect to automatically start listening for a Wallet connection on start. The user will still need to initiate a connection either by scanning a QR code or through deep linking
  • Create New Session On Session Disconnect
    • WalletConnect will create a new session every time the current session ends.
  • Connect Session Retry Count
    • How many times a session should attempt to reconnect to the bridge server before failing.
  • Custom Bridge Url
    • Set a custom bridge to connect to. Leave this blank to use WalletConnect default bridges.
  • Chain Id
    • Unused will be used to specify chain to interact with.
  • Connected Event
    • A Unity Event that is triggered when a Wallet session has started. Nothing is passed to this event listener.
  • Connected Event Session
    • A Unity Event that is triggered when a Wallet session has started. The Session data is passed to this event listener
  • Disconnected Event Session
    • A Unity Event that is triggered when a Wallet session has disconnected. The Session data is passed to this event listener.
  • Connection Failed Event
    • A Unity Event that is triggered when a Wallet session has failed to connect either due to transport errors, network errors, or user declining to create session. The Session data is passed to this event listener
  • New Session Connected
    • A Unity Event that is triggered when a new Wallet session has been successfully created and connected. The Session data is passed to this event listener. This event will only be called once in a session's lifetime.
  • Resumed Session Connected
    • A Unity Event that is triggered when a Wallet session has been successfully resumed and connected. The Session data is passed to this event listener.
  • App Data
    • This is the Session data that is given and shown in the Wallet

QRCode Generation

This project comes with a component to automitcally generate a QR Code image and place it onto a UI Image. To do this, simply attach the WalletConnect QR Image component to your Image and select your WalletConnect GameObject reference

example2

API

To access the current WalletConnect object in any Scene, you can do WalletConnect.Instance. This object will include a reference to the WalletConnectProtocol object, the Connection URL and some helper functions. For reference on how to use the WalletConnectProtocol object, see WalletConnectSharp for more details.

NEthereum

Currently, this project DOES NOT include the NEthereum Extension. To add the extension, simply add the WalletConnect.NEthereum folder from WalletConnectSharp and then include the proper NEthereum Unity libraries in your project.

Once you have done this, to create a new NEthereum Web3 instance, you can simply do

var wcProtocol = WalletConnect.Instance.Protocol
var web3 = new Web3(wcProtocol.CreateProvider(new Uri("https://mainnet.infura.io/v3/<infruaId>"));

walletconnectunity's People

Contributors

alansley avatar ecp4224 avatar gigajuwels avatar koenrijpstra avatar leon-do avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.