Table of Contents

Getting Started

Add to your project

You can get LoopNet from nuget. You can run the following command with the packet manager console while in Visual Studio to install it into your project.

Install-Package LoopNet

Create the LoopNet client

You must create the LoopNet client. How you retrieve the L1 Private Key and Eth address is up to you, they just need to be strings to be passed as parameters into the client constructor.

The first parameter is the chainId. It can either be 1 for mainnet, or 5 for test

var loopNetClient = await LoopNetClient.CreateLoopNetClientAsync(1, "L1 Private Key", "Eth Address in 0x format");

The LoopNet client will generate your Loopring Layer 2 Private Key and retrieve your Loopring API key. These are saved into the client and used automatically by any calls it has to make to the Loopring API.

Usage

Once the client has been created you can start using it.

var tokenTransferResponse = await loopNetClient.PostTokenTransferAsync("0x991B6fE54d46e5e0CEEd38911cD4a8694bed386A", "LRC", 0.01m, "LRC", "LoopNet test");

This will send 0.01 LRC to 0x991B6fE54d46e5e0CEEd38911cD4a8694bed386A with the memo 'LoopNet test', fees will be paid in LRC as well.

LoopNet will throw an exception if the Loopring API returns that the request was not successful so be sure to handle them in your code.

You can view all the methods the LoopNet client provides here: LoopNetClient