SteemConnect.Net is now available on Nuget and Github

in #programming6 years ago


As outlined in my post from last Monday, I was working on a library to interact with Steemit via SteemConnect. SteemConnect makes it easy to interact with the Steemit blockchain by adding an OAuth layer between apps/websites and Steemit.

Although my current Steemit project is frozen (I wrote about that already in the above-mentioned post), I decided to finish at least this library to enable other .NET developers bringing their idea to life. So here we go, SteemConnect.Net is available both as a Nuget package and on Github.

The library is built as .NetStandard (2.0) library. Every operation sent to the blockchain returns a transaction object. Should the API return an error, the response will contain the error message coming from the blockchain.

Let's have a quick look how to get started:

Quickstart

Initialize Library:

Config.Instance.Init("APIKEY", "APISECRET", "CALLBACK");

Create Login-Url:

var scopes = new string[] { Constants.PARAM_ACTION_OFFLINE, Constants.PARAM_ACTION_LOGIN, Constants.PARAM_ACTION_VOTE, Constants.PARAM_ACTION_COMMENT, Constants.PARAM_ACTION_CUSTOMJSON, Constants.PARAM_ACTION_DELETECOMMENT, Constants.PARAM_ACTION_COMMENT_OPTIONS, Constants.PARAN_ACTION_CLAIMREWARDBALANCE };
var loginUrl = Authentication.GetLoginUrl(scopes, null, true);

The call to the loginUrl will show the login dialog to the user and return your callback url with the login code. Just pass this response as is to GetAccessTokenAsync method.

Get AccessToken

SteemConnectEntity<AccessTokenResponse> accessTokenResponse = await Authentication.GetAccessTokenAsync(response, true);

This will return an AccessToken as well as a RefreshToken. It is your task to save them securely in your app or website.

Get user data

After obtaining the AccessToken, you can fetch the user data:

SteemConnectEntity<User> user = await SteemConnectRequest.GetUserDataAsync(AccessTokenResponse.Value.Accesstoken);

Create a new post with additional options

var meta = JsonConvert.SerializeObject(new BroadcastMetaData("DEV_APP/0.0.1", "busy", new string[] { "test", "dev", "testing" }, PostFormat.MarkDown));

var beneficiaries = new BeneficiariesExtension();
beneficiaries.Beneficiaries.Add(new Beneficiary("beneficiary", 5000));

var permlink = "qs-app-dev-test-" + DateTime.Now.Ticks.ToString();
var commentOptions = new CommentOptions(username, permlink, false, 1000, 0, true, null);

var post = await SteemConnectRequest.CreateNewCommentAsync(AccessTokenResponse.Value.Accesstoken, string.Empty, "test", username, permlink, "Post Title", "Post Body <?>", meta, commentOptions);

There is no full documentation yet, I am working on that. However, the repository on Github contains a console test program that should help everyone to figure everything out.

Even if the main project that has lead to this library is frozen for the moment, I do have some ideas left. I will use this library for sure, but felt it is the right time to make it avalaible for all that want to use it.

If you have questions or need help, feel free to open an issue on Github or ping me here on Steemit. If you want to contribute, feel free to open a pull request with your changes as well.

Happy steeming and also happy coding, everyone!

Sort:  

Schade das ich nicht mehr Power habe für einen Vernünftigen Vote für dich,
bin auch nur durch zufalle auf diesen Artikel gekommen durch einen Kommentar von dir bei ( https://steemit.com/deutsch/@greece-lover/steem-noch-immer-nicht-von-zu-boersen-transferierbar-dlive-verlaesst-steem-die-welt-geht-unter-oder-nicht ).
Nun Folgt meiner einer dir ganz gespannt.

Bin Hobby C# Freund GRINS
Auch deine Simple Json-RPC ist Cool!!!
Will ich nächste Woche mal antesten.

Super Arbeit und Super Artikel DANKE
LG Enrico

Hi, danke für die Blumen. Ich nehme das mit den Vote-Beträgen nicht so genau, bei mir ist jedes Vote willkommen :)

Der SimpleJSonRpc ist eigentlich mehr experimentel, sollte aber im großen und ganzen funktionieren, wenn sich an das Schema gehalten wird.

Hi danke für die Info, ich werde mich da ab Montag mal daran versuchen, Aktuell verbiege ich mir den Ars.... mit JSON-RPC.NET es geht,
aber irgendwie bin ich nicht so glücklich damit.
OK ich bin wie gesagt Hobby C#

Sag Bescheid wie es gelaufen ist 😊

Hello! Your post has been resteemed and upvoted by @ilovecoding because we love coding! Keep up good work! Consider upvoting this comment to support the @ilovecoding and increase your future rewards! ^_^ Steem On!

Reply !stop to disable the comment. Thanks!

Finally, .NET 😂
Can I use it with .NET Core or ASP.NET Core ??
[Edit] Never mind, I just read "built on top of .NetStandard (2.0)"

Yes, finally a .NET version... Like I wrote, I had a project that should cross post to several blockchain networks, but as others seem to not like third parties, this project is on ice (see the post of last week for more info). Hope you will find the library helpful.

Coin Marketplace

STEEM 0.20
TRX 0.13
JST 0.029
BTC 67831.26
ETH 3460.55
USDT 1.00
SBD 2.72