LensDotNet 1.0.5

dotnet add package LensDotNet --version 1.0.5                
NuGet\Install-Package LensDotNet -Version 1.0.5                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="LensDotNet" Version="1.0.5" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add LensDotNet --version 1.0.5                
#r "nuget: LensDotNet, 1.0.5"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install LensDotNet as a Cake Addin
#addin nuget:?package=LensDotNet&version=1.0.5

// Install LensDotNet as a Cake Tool
#tool nuget:?package=LensDotNet&version=1.0.5                

LensDotNet

LensDotNetLogo

LensDotNet is a .NET library that provides an easy and efficient way to interact with the Lens API. This library enables you to seamlessly utilize Lens API in various platforms, such as desktop applications, mobile apps using Xamarin MAUI, and games using Unity.

Table of Contents

Supported Frameworks

  • .net Standard 2.1
  • .net 6.0
  • .net 7.0

Installation

To install LensDotNet, you can use NuGet Package Manager. You can either use the Package Manager Console or the NuGet Package Manager in Visual Studio.

Package Manager Console

Run the following command in the Package Manager Console:

Install-Package LensDotNet

NuGet Package Manager in Visual Studio

  1. Right-click on your project in the Solution Explorer.
  2. Select 'Manage NuGet Packages...'
  3. Search for 'LensDotNet' and install the package.

Usage

Basic Setup

Here's a very basic example of how to use LensDotNet:

using LensDotNet;

// Create a LensClient instance
var config = new LensConfig("https://api-mumbai.lens.dev");
var client = new LensClient(config);

// Call ExploreProfiles and print results.
var profiles = await client.Explore.ExploreProfiles();
Console.WriteLine($"Found {profiles.Items.Length} profiles");
foreach (var profile in profiles.Items)
    Console.WriteLine($"name: {profile.Name} - owner: {profile.OwnedBy} - id: {profile.Id}");

Authenticating

Most mutations (write calls) to the API, require that the user is authenticated. Authentication is a set of steps that requires the user to sign a message with the wallet that owns the profile. To do this, LensDotNet decouples the Signing process letting the implementator (you) chose the way to do it.

This is how it works:

using LensDotNet;

// Create a LensClient instance
var config = new LensConfig("https://api-mumbai.lens.dev");
var client = new LensClient(config);

// Generate a challenge passing the user address
var challenge = await client.Authentication.GenerateChallenge(account.Address);

// Sign the challenge string with whatever method you want.
var signature = yourSignerImplementation.Sign(challenge.Text, account);

// Authenticate the client with the signed message and the address.
await client.Authentication.Authenticate(account.Address, signature);

// Check if user is authenticated
if(await client.Authentication.IsAuthenticated())
  Console.WriteLine("Authenticated!");
else
  Console.WriteLine("Not authenticated!");

For more examples, take a look at the Examples folder or explore the Tests.

Also, a guide for using with Unity is in progress. Look Here.

Contributing

We welcome contributions to improve and expand the functionality of LensDotNet. Please follow these guidelines to contribute:

  1. Fork this repository to your own account.
  2. Create a branch with a descriptive name related to the changes you're making.
  3. Make your changes and commit them to your branch.
  4. Open a pull request from your fork to the main repository, describing the changes made and the issue (if applicable) that your changes resolve.

All contributions should respect the coding style and conventions used throughout the project. Also, make sure to test your changes before submitting a pull request.

Roadmap

Here's the tentative roadmap for upcoming features. Feel free to suggest new features or improvements!

  • Basic API interaction
    • Unit tests
  • Unity support
    • Improved Unity examples
  • Advanced API methods
  • Xamarin MAUI support
    • Improved MAUI examples
  • Clients
    • Lens Client
    • Profile Client
    • Authentication Client
    • Publication Client
      • Create Publication
    • Transaction Client
    • ... TODO: add more clients ...
  • Comprehensive documentation
    • Unity Implementation
  • Examples
    • Simple Console App
    • Simple MAUI App
    • Simple Unity

Acknowledgements

  • Stanislav Silin for his amazing work on ZeroQL, the underlying graphQL client used. Also for pushing the .netstandard support so fast as well as figuring out the use in Unity.
  • Grabriel Weyer from whom I copied and pasted his JWT decoder implementation, which allowed me to reduce the number of dependencies
  • Juan Blanco, the genius behind Nethereum, which has been the most helpful for building tests.
  • A toda mi familia y a todos los que me estan viendo 👀

License

This project is licensed under the MIT License. Please see the LICENSE file for more details.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.5 163 6/13/2023
1.0.4 157 6/10/2023
1.0.3 144 6/10/2023