enjin / enjin-csharp-sdk Goto Github PK
View Code? Open in Web Editor NEWEnjin Cloud SDK for C#.
Home Page: https://enjin.io/products/platform
License: Apache License 2.0
Enjin Cloud SDK for C#.
Home Page: https://enjin.io/products/platform
License: Apache License 2.0
So the 'Quick Start' guide has:
ProjectClient client = ProjectClient.Builder().BaseUri(EnjinHosts.KOVAN).Build();
For me at least, I'm getting an error that Project Client does not contain a definition for Builder()
This sounds weird but when I just clone without adding anything and build
it says I don't have README.md? Following is the exact message.
NU5039 The readme file 'README.md' does not exist in the package.
As per the error below the DeletePlayer method says it returns a bool but it looks like it infact returns a null and that then can not be converted to a boolean.
crit: Enjin-SDK[0]
An error occured while processing a request or a response.
System.ArgumentException: Can not convert Null to Boolean.
at Newtonsoft.Json.Linq.JToken.op_Explicit(JToken value)
at Newtonsoft.Json.Linq.JToken.ToObject(Type objectType)
at Newtonsoft.Json.Linq.JToken.ToObject[T]()
at Enjin.SDK.Graphql.GraphqlData`1.ProcessJsonResult(JToken result)
at lambda_method96(Closure , Object[] )
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObjectUsingCreatorWithParameters(JsonReader reader, JsonObjectContract contract, JsonProperty containerProperty, ObjectConstructor`1 creator, String id)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateNewObject(JsonReader reader, JsonObjectContract objectContract, JsonProperty containerMember, JsonProperty containerProperty, String id, Boolean& createdFromNonDefaultCreator)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.ResolvePropertyAndCreatorValues(JsonObjectContract contract, JsonProperty containerProperty, JsonReader reader, Type objectType)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObjectUsingCreatorWithParameters(JsonReader reader, JsonObjectContract contract, JsonProperty containerProperty, ObjectConstructor`1 creator, String id)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateNewObject(JsonReader reader, JsonObjectContract objectContract, JsonProperty containerMember, JsonProperty containerProperty, String id, Boolean& createdFromNonDefaultCreator)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
at Newtonsoft.Json.JsonSerializer.Deserialize(JsonReader reader, Type objectType)
at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)
at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings)
at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value)
at Enjin.SDK.BaseSchema.<SendRequest>b__12_0[T](Task`1 task)
Can you publish to nuget? This gives us an easy way to update to the latest when new updates are released :)
https://docs.microsoft.com/en-us/nuget/nuget-org/publish-a-package
I added my project on Jumpnet. UUID : 7577d864-9b88-443c-8897-8d3e941dfb9c
I can use the GraphQL Playground just fine to make a call to https://jumpnet.cloud.enjin.io/graphql/project,
passing in the UUID and secret, and getting back the access token.
But when I do the same using the C# SDK, I get the following error...
Syntax Error: Unexpected
ProjectClient client = new ProjectClient(EnjinHosts.JUMP_NET);
AuthProject project = new AuthProject()
.Uuid("7577d864-9b88-443c-8897-8d3e941dfb9c")
.Secret("xxxxx");
GraphqlResponse<AccessToken> res = client.AuthProject(project).Result;
Any ideas?
TODO
Firstly i wanted to say that they look extreamly useful but i see one main issue with them. If you build your application to rely on them then you need to be able to deal with the case when the reader crashes or looses connection and needs to resume. If not you would need to ge thte state of everything when you restart the app or process. To me it seems like it could be ideal to be able to specify the events you are interested in from a block going forward or something like that and you have the events report the block so you can keep track of where you are up to and resume from there once connection is back or your app is back up again.
If developers could do something like that then i could see a lot of the API calls not being needed for queries and managing local state that is in sync with the blockchain would be a lot easier.
I am only starting to play with the library so i may have missed something but the auth workflow feels a little wrong to me. When we authenticate a project or a player Enjin returns a JWT token that is valid for 24 hours and then i beleive you need to renew it using the original authentication method as i assume you can't refresh the token using the token. For a short running program this is not an issue but for a server side program that may run for days, weeks or months it would be.bFrom what i can tell the clients don't really have anything in there to manage this or help with this and instead the developer needs to code it all and i would think it would be common task for almost anyone using the lib.
Perhaps you could have an Authentication Helper or something that could optionally be passed to the clients when created that could do the token management and refresh for the client by taking in the AuthProject UUID and Secret from config or some other source like a secret store. If the project auth is going to expire in say 30 minutes it will create a project client and get a new auth token to be used by all project clients that use the AuthHelper. For the playerClient i think it is a little more complex as as to refresh those you need the project aith token and the player details but the authhelper could provide the project token needed and i would think the player details would be in the player token since they are jwt tokens.
honestly i have not quite understood yet when you would use the player access token vs just using the access token for the project as it seems like you cna do most things if not all on the project in relation to the players. I get the reason froma security side of things but if their tokens expire then you still need to project level auth token to keep getting the players tokens so does not really let you seperate things out unless you do it at login one time or something as normally a user should be online for less than 24 hours
The result object for GetWallet does not have balances property. I can't workout how to see the NFT's on an ethAddress the same as the graphql below returns in the playground.
query {
GetWallet(ethAddress: "0x854Cd273c80eF85C3e674B0637AB067b962744F2") {
ethAddress
enjAllowance
enjBalance
ethBalance
balances {
asset{name}
id
index
value
project {
name
}
}
assetsCreated {
id
items {
name
id
}
}
}
}
I'm currently trying this out in unity and I notice that the query variable within the CreateRequestBody method that's located in the BaseSchema.cs file is not compiling the query, but the variables variable is generating the input properly.
On a side note: Base on what I have gathered so far, I wouldn't be able to really do anything anyways assuming that most of the current GraphQL are for the early access api correct (i.e. AuthProject is an early access GraphQL query)?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.