getscatter / eos-sharp Goto Github PK
View Code? Open in Web Editor NEWC# client library for EOS blockchains
License: MIT License
C# client library for EOS blockchains
License: MIT License
I found in use that sending memo information in Korean is always truncated.
For example: "hihihi만들어드립니다만들어드립니다다만들어드립니다hihihi"
Show when viewing the transaction:
(Memo: hihihi만들어드립니다만들�)
I am writing a web API to get data from a multi-index table by passing its key which is the primary key?
Is there any method available?
JsonReaderException: Could not convert string to integer: 499999950150. Path 'net_weight', line 1, position 271.
Will probably also fail on cpu_weight. Should be something larger than Int32.
I use a 50 thread loop queue to perform "get_block" , total of 100,000 blocks, and finally there will always be 1-3 threads in the "runing" state can not exit.
I found that the code for these threads is running to line 115 of the HttpHelper.cs:
return JsonSerializer.Create(jsonSettings).Deserialize(jtr);
I am writing web API to get users data from multi-index table data. Below is my API method:
[HttpGet]
public async IAsyncEnumerable<GetTableRowsResponse> GetUsers()
//public async Task<IHttpActionResult> GetUsers()
{
Eos eos = new Eos(new EosConfigurator()
{
HttpEndpoint = "http://127.0.0.1:8888/v1/chain", //running nodeos on localhost
ChainId = "nodeoschainid",
ExpireSeconds = 60,
SignProvider = new DefaultSignProvider("MyPK")
});
var result = await eos.GetTableRows(new GetTableRowsRequest()
{
json = true,
code = "groupacc",
scope = "groupacc",
table = "users"
});
yield return result;
}
This is throwing exception:
ApiErrorException: Exception of type 'EosSharp.Core.Exceptions.ApiErrorException' was thrown.
I have users data in multi-index table users and return all users from API. can anybody help me with the error and return types?
Hey - Nuget packages is out of date. Would you mind update it ?
thanks
I can't find a function to generate an eos private key in eos-sharp.
I tried to send a "newaccount" transaction, but got "Out of Range" message from EOS node.
AbiSerializationProvider.WriteBool method should be:
WriteByte(ms, (bool)value ? (byte)1 : (byte)0);
or it will write wrong bytes into MemoryStream.
Digital Signatures fail to serialize when attempting to push any transaction that contains digital signature in one of the action arguments.
System.Exception: checksum doesn't match.
at EosSharp.Core.Helpers.CryptoHelper.StringToKey (System.String key, System.Int32 size, System.String keyType) [0x0009b] in <1aafbe1be8d2427d8f9e860b61f6dcf3>:0
at EosSharp.Core.Helpers.CryptoHelper.SignStringToBytes (System.String sign) [0x00014] in <1aafbe1be8d2427d8f9e860b61f6dcf3>:0
at EosSharp.Core.Providers.AbiSerializationProvider.WriteSignature (System.IO.MemoryStream ms, System.Object value) [0x00007] in <1aafbe1be8d2427d8f9e860b61f6dcf3>:0
at EosSharp.Core.Providers.AbiSerializationProvider.WriteAbiType (System.IO.MemoryStream ms, System.Object value, System.String type, EosSharp.Core.Api.v1.Abi abi) [0x000fc] in <1aafbe1be8d2427d8f9e860b61f6dcf3>:0
at EosSharp.Core.Providers.AbiSerializationProvider.WriteAbiStruct (System.IO.MemoryStream ms, System.Object value, EosSharp.Core.Api.v1.AbiStruct abiStruct, EosSharp.Core.Api.v1.Abi abi) [0x000b7] in <1aafbe1be8d2427d8f9e860b61f6dcf3>:0
at EosSharp.Core.Providers.AbiSerializationProvider.SerializeActionData (EosSharp.Core.Api.v1.Action action, EosSharp.Core.Api.v1.Abi abi) [0x00089] in <1aafbe1be8d2427d8f9e860b61f6dcf3>:0
at EosSharp.Core.Providers.AbiSerializationProvider.WriteAction (System.IO.MemoryStream ms, EosSharp.Core.Api.v1.Action action, EosSharp.Core.Api.v1.Abi abi) [0x00064] in <1aafbe1be8d2427d8f9e860b61f6dcf3>:0
at EosSharp.Core.Providers.AbiSerializationProvider+<SerializePackedTransaction>d__15.MoveNext () [0x001c2] in <1aafbe1be8d2427d8f9e860b61f6dcf3>:0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <d7ac571ca2d04b2f981d0d886fa067cf>:0
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <d7ac571ca2d04b2f981d0d886fa067cf>:0
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <d7ac571ca2d04b2f981d0d886fa067cf>:0
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <d7ac571ca2d04b2f981d0d886fa067cf>:0
at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () [0x00000] in <d7ac571ca2d04b2f981d0d886fa067cf>:0
at EosSharp.Core.EosBase+<CreateTransaction>d__31.MoveNext () [0x002cf] in <1aafbe1be8d2427d8f9e860b61f6dcf3>:0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <d7ac571ca2d04b2f981d0d886fa067cf>:0
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <d7ac571ca2d04b2f981d0d886fa067cf>:0
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <d7ac571ca2d04b2f981d0d886fa067cf>:0
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <d7ac571ca2d04b2f981d0d886fa067cf>:0
at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () [0x00000] in <d7ac571ca2d04b2f981d0d886fa067cf>:0
at TestScatterScript+<PushTransaction>d__5.MoveNext () [0x00320] in /Users/hotmdev4/Desktop/drakos/scatter-sharp/Unity3D/ScatterSharpUnity3D/Assets/Scenes/Scripts/TestScatterScript.cs:101
UnityEngine.MonoBehaviour:print(Object)
<PushTransaction>d__5:MoveNext() (at Assets/Scenes/Scripts/TestScatterScript.cs:128)
System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1:SetException(Exception)
EosSharp.Core.<CreateTransaction>d__31:MoveNext()
System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1:SetException(Exception)
EosSharp.Core.Providers.<SerializePackedTransaction>d__15:MoveNext()
System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1:SetResult(Abi)
EosSharp.Core.Providers.<GetAbi>d__22:MoveNext()
System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1:SetResult(GetRawAbiResponse)
EosSharp.Core.Api.v1.<GetRawAbi>d__14:MoveNext()
System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1:SetResult(GetRawAbiResponse)
EosSharp.Unity3D.<PostJsonWithCacheAsync>d__8`1:MoveNext()
System.Runtime.CompilerServices.MoveNextRunner:Run()
EosSharp.Unity3D.UnityWebRequestAwaiter:OnRequestCompleted(AsyncOperation)
UnityEngine.AsyncOperation:InvokeCompletionEvent()
signature
type.ACTION test(signature sig);
CreateTransaction
function should fail with the above exception regardless of the value of the sig
parameter.The exception is being thrown in CryptoHelper.cs#L178
. I took the code from CryptoHelper and created a small script that runs the same code and generated the below output. I appears that not only do the checksums not match, but they aren't even the same length.
https://gist.github.com/ARoomWithABue/93cf3b365cd9399795a79a09080eaed4
output:
sig: SIG_K1_KZoEShDrNxiAQq8rYafahdudAESBAfHQxU7ihavonMDMND4jNSHhk9q4UVbs7tTLK6RidFmFmSruipEM1chyxFgN46meSF
digest.Length: 20
digest: [ 38, 189, 167, 157, 74, 198, 230, 153, 7, 108, 205, 141, 173, 55, 95, 93, 55, 145, 150, 148 ]
keyBytes.Length: 69
keyBytes: [ 32, 38, 154, 38, 22, 40, 38, 160, 196, 66, 4, 145, 119, 1, 107, 17, 153, 30, 216, 157, 113, 141, 147, 102, 88, 34, 143, 211, 255, 111, 135, 1, 66, 84, 64, 216, 43, 97, 182, 191, 13, 140, 160, 33, 64, 219, 35, 209, 74, 254, 105, 206, 62, 187, 171, 125, 215, 92, 244, 189, 36, 170, 32, 27, 147, 54, 219, 221, 188 ]
keyBytes checksum: [ 147, 54, 219, 221, 188 ]
digest checksum: [ 38, 189, 167, 157 ]
Hi, are you planning to distribute it throught nuget ?
Hi, I generate a keypair using
eosKeyPair = EosSharp.Core.Helpers.CryptoHelper.GenerateKeyPair();
and then create a new EOS account with the public key. This works fine.
But when I try to sign a transaction in eos-sharp I get a check-sum-error-exception.
When I try to import the private key to Scatter I get "Private key not long enough".
This is an example of a private key generated that don't work:
2jTY92qynZetndq69sPif3Yp4hyBd3wduwaar7BafNUKx7K5vp
What am I doing wrong?
Steps to reproduce:
var keyPair = EosSharp.Core.Helpers.CryptoHelper.GenerateKeyPair();
var pubKeyBytes = [EosSharp.Core.Helpers.CryptoHelper.PubKeyStringToBytes(keyPair.PublicKey);
var encrypted = EosSharp.Core.Helpers.CryptoHelper.AesEncrypt(pubKeyBytes, "Testing testing");
// The error throws here
Hell, I could be doing this wrong but I couldn't find any documentation on these functions.
The line 146 of EosSharp/Helpers/CryptoHelper.cs should be:
keyType == "sha256x2" ? SerializationHelper.Combine(new List<byte[]>() { new byte[] { 128 }, key }) : key,
or it will not return the correct string while keyType == "sha256x2".
Class CryptoHelper contains an incorrect constant 'SIGN_KEY_DATA_SIZE', expected 65, current 64
Hi guys,
I am using eos-sharp with Xamarin to build a wallet app for eos.io bloackchain
The problem is when I tried to connect to Blockchain node which support only TLS1.2
HttpClient couldn't connect to node and thrown SSL exception:
The SSL connection could not be established.
After doing some research I found that the solution is to add
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;
before connection to Blockchain node API. But unfortunately it doesn't affect HttpClient on .Net Core
Finally I found this Solution on Stackoverflow
https://stackoverflow.com/questions/49399205/how-to-use-tls-1-2-in-asp-net-core-2-0
And the solution is to use HttpHandler with HttpClient :
var handler = new HttpClientHandler
{
SslProtocols = SslProtocols.Tls12 | SslProtocols.Tls11 | SslProtocols.Tls
};
HttpClient client = new HttpClient(handler);
My question is can I addHttoClient Handler which supports TLS12 to EosSharpHttpHandler
And make it optionally to force support tls12?
Thanks
Hello, I am using eos-sharp and calling mintasset action of atomicasset smart-contract. I am facing issue to call the method, and getting this error, I didn't understand what is the issue.
{System.Exception: Missing pair_string_variant_int8_int16_int32_int64_uint8_uint16_uint32_uint64_float32_float64_string_INT8_VEC_INT16_VEC_INT32_VEC_INT64_VEC_UINT8_VEC_UINT16_VEC_UINT32_VEC_UINT64_VEC_FLOAT_VEC_DOUBLE_VEC_STRING_VEC.key (type=string) at EosS…}
SerializationHelper.DecimalToBinary does not convert correctly to byte array
uint64 10001 converted to 17
uint64 10002 converted to 18
EOS contract code
struct airquality_struct
{
uint64_t air_id;
std::string air_place;
std::string air_pm2_5;
std::string air_voc;
std::string air_carbon;
std::string air_nitrogen;
std::string air_sulfur;
std::string air_longitude;
std::string air_latitude;
};
typedef std::vector<airquality_struct> airquality_list;
error in file AbiSerializationProvider.cs 725
throw new Exception("Type supported writer not found.");
引发的异常:“System.Exception”(位于 EosSharp.Core.dll 中)
引发的异常:“System.Exception”(位于 mscorlib.dll 中)
引发的异常:“System.AggregateException”(位于 mscorlib.dll 中)
string signature = "SIG_K1_JyngtE5o5zqFGxNQZfQ7CWsvG4wfPfrxs8Z7YDTNtEGHos8Pso9z2p4EHBoNhd3UcBu7zn5iTxASfPfbAbcAdJCdoLxbAS";
var MyAction1 = new EosSharp.Core.Api.v1.Action() {
account = "zar",
authorization = new List<PermissionLevel>() { new PermissionLevel() {
actor = "mycontract", permission = "active" }
},
name = "dummyaction",
data = new {
sign = signature
}
};
Packed data for above
1f9dcb5e92bf8736e53c0000000001000000000000aef900267519192fa54e01000000000000aef90000b86ae1696ede41001f22a5ee328c54421bddb73110f6ddce3258e214c611aac33a1532affb3adcc2bd3f3276e5223189fa58cdd0a9cb054d1360e26d2a24047e6628392a68d9dd9900
Transcoding the signature to hex
1f22a5ee328c54421bddb73110f6ddce3258e214c611aac33a1532affb3adcc2bd3f3276e5223189fa58cdd0a9cb054d1360e26d2a24047e6628392a68d9dd9920
The last byte is 0x00, should be 0x20
Confirm using commandline (cleos)
{
"expiration": "2020-05-25T10:13:38",
"ref_block_num": 47374,
"ref_block_prefix": 2492603937,
"max_net_usage_words": 0,
"max_cpu_usage_ms": 0,
"delay_sec": 0,
"context_free_actions": [],
"actions": [{
"account": "zar",
"name": "dummyaction",
"authorization": [{
"actor": "mycontract",
"permission": "active"
}
],
"data": "001f22a5ee328c54421bddb73110f6ddce3258e214c611aac33a1532affb3adcc2bd3f3276e5223189fa58cdd0a9cb054d1360e26d2a24047e6628392a68d9dd9920"
}
],
"transaction_extensions": [],
"signatures": [],
"context_free_data": []
}
It appears that packing of the transaction is dropping the last byte of the signature?
I use the following method for signing a hash of data (the resulting sig seems to be valid):
public static string SignHash(byte[] hash, string privateKey) {
var sign = Secp256K1Manager.SignCompressedCompact(hash, EosSharp.Core.Helpers.CryptoHelper.GetPrivateKeyBytesWithoutCheckSum(privateKey));
var check = new List<byte[]>() { sign, Encoding.UTF8.GetBytes("K1") };
var checksum = Ripemd160Manager.GetHash(EosSharp.Core.Helpers.SerializationHelper.Combine(check)).Take(4).ToArray();
return "SIG_K1_" + Base58.Encode(EosSharp.Core.Helpers.SerializationHelper.Combine(new List<byte[]>() { sign, checksum }));
}
How to get the total count of Actions. I am doing this,
var r = getEos();
var resultaction = await r.GetActions("groupaccount", 0, 1000);
Instead of 1000, I want to give the maximum count. I need to display all actions. Please help
It appears no array type may be used in the data
member of a Api.v1.Action
. Attempted to use an Array and List types and received the following exception.
Here is the full Exception dump.
{"ClassName":"System.InvalidCastException","Message":"Specified cast is not valid.","Data":null,"InnerException":null,"HelpURL":null,"StackTraceString":" at (wrapper castclass) System.Object.__castclass_with_cache(object,intptr,intptr)\r\n at EosSharp.Core.Providers.AbiSerializationProvider.WriteAbiType (System.IO.MemoryStream ms, System.Object value, System.String type, EosSharp.Core.Api.v1.Abi abi) [0x0005a] in <c63f229511f44af0a6b4f36a0587bfc6>:0 \r\n at EosSharp.Core.Providers.AbiSerializationProvider.WriteAbiStruct (System.IO.MemoryStream ms, System.Object value, EosSharp.Core.Api.v1.AbiStruct abiStruct, EosSharp.Core.Api.v1.Abi abi) [0x000b7] in <c63f229511f44af0a6b4f36a0587bfc6>:0 \r\n at EosSharp.Core.Providers.AbiSerializationProvider.SerializeActionData (EosSharp.Core.Api.v1.Action action, EosSharp.Core.Api.v1.Abi abi) [0x00089] in <c63f229511f44af0a6b4f36a0587bfc6>:0 \r\n at EosSharp.Core.Providers.AbiSerializationProvider.WriteAction (System.IO.MemoryStream ms, EosSharp.Core.Api.v1.Action action, EosSharp.Core.Api.v1.Abi abi) [0x00064] in <c63f229511f44af0a6b4f36a0587bfc6>:0 \r\n at EosSharp.Core.Providers.AbiSerializationProvider+<SerializePackedTransaction>d__15.MoveNext () [0x001c2] in <c63f229511f44af0a6b4f36a0587bfc6>:0 \r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <ac823e2bb42b41bda67924a45a0173c3>:0 \r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <ac823e2bb42b41bda67924a45a0173c3>:0 \r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <ac823e2bb42b41bda67924a45a0173c3>:0 \r\n at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <ac823e2bb42b41bda67924a45a0173c3>:0 \r\n at System.Runtime.CompilerServices.TaskAwaiter1[TResult].GetResult () [0x00000] in <ac823e2bb42b41bda67924a45a0173c3>:0 \r\n at EosSharp.Core.EosBase+<CreateTransaction>d__31.MoveNext () [0x002cf] in <c63f229511f44af0a6b4f36a0587bfc6>:0 \r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <ac823e2bb42b41bda67924a45a0173c3>:0 \r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <ac823e2bb42b41bda67924a45a0173c3>:0 \r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <ac823e2bb42b41bda67924a45a0173c3>:0 \r\n at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <ac823e2bb42b41bda67924a45a0173c3>:0 \r\n at System.Runtime.CompilerServices.TaskAwaiter1[TResult].GetResult () [0x00000] in <ac823e2bb42b41bda67924a45a0173c3>:0 \r\n at ScatterTransaction+<run>d__21.MoveNext () [0x004b2] in C:\\dev\\unity\\turnbased\\Turn Based\\Assets\\Scripts\\Common\\ScatterTransaction.cs:118 ","RemoteStackTraceString":null,"RemoteStackIndex":0,"ExceptionMethod":null,"HResult":-2147467262,"Source":"mscorlib"} UnityEngine.Debug:Log(Object) <run>d__21:MoveNext() (at Assets/Scripts/Common/ScatterTransaction.cs:153) System.Runtime.CompilerServices.AsyncTaskMethodBuilder1:SetException(Exception) EosSharp.Core.<CreateTransaction>d__31:MoveNext() System.Runtime.CompilerServices.AsyncTaskMethodBuilder1:SetException(Exception) EosSharp.Core.Providers.<SerializePackedTransaction>d__15:MoveNext() System.Runtime.CompilerServices.AsyncTaskMethodBuilder1:SetResult(Abi) EosSharp.Core.Providers.<GetAbi>d__22:MoveNext() System.Runtime.CompilerServices.AsyncTaskMethodBuilder1:SetResult(GetRawAbiResponse) EosSharp.Core.Api.v1.<GetRawAbi>d__14:MoveNext() System.Runtime.CompilerServices.AsyncTaskMethodBuilder1:SetResult(GetRawAbiResponse) EosSharp.Unity3D.<PostJsonWithCacheAsync>d__81:MoveNext() System.Runtime.CompilerServices.MoveNextRunner:Run() EosSharp.Unity3D.UnityWebRequestAwaiter:OnRequestCompleted(AsyncOperation) UnityEngine.AsyncOperation:InvokeCompletionEvent()
Here is the simple EOS action I used to test:
void emptyarray( name user, vector<uint64_t>) {
print("It worked!");
}
Generated ABI:
{
"name": "emptyarray",
"base": "",
"fields": [
{
"name": "user",
"type": "name"
},
{
"name": "array",
"type": "uint64[]"
}
]
}
C# snippet
var result = await eos.CreateTransaction(new EosSharp.Core.Api.v1.Transaction()
{
actions = new List<EosSharp.Core.Api.v1.Action>()
{
new EosSharp.Core.Api.v1.Action()
{
account = MYACCOUNT,
authorization = new List<PermissionLevel>()
{
new PermissionLevel() {actor = MYUSER, permission = MYAUTHORITY }
},
name = "emptyarray",
data = new Dictionary<string, object>()
{
{ "user", MYUSER },
{ "array", new List<uint>() },
}
}
}
});
Tested this using cleos
and eosjs
and this works as expected.
When casting an object to a float, using parenthesis casting causes an InvalidCastException. I only just started reading a few of the articles linked below to catch myself up with this issue and learn more about how casting works in C#, but our testing shows that changing the code to use the conversion tool handles this just fine.
http://www.interact-sw.co.uk/iangblog/2004/01/20/casting
private static void WriteFloat32(MemoryStream ms, object value)
{
// ms.Write(BitConverter.GetBytes((float)value), 0, 4);
ms.Write(BitConverter.GetBytes(Convert.ToSingle(value), 0, 4);
}
Currently we're running in Unity and just pulled down this repository straight into our project out of simplicity so we are able to use this work around now. If there's anything we're missing please let us know and we appreciate your help!
Has anybody generated unique id like UUID in eos smart contract? I need to generate, trying boost library but not sure. Please help.
EOS 1.5.0 made a number of changes to Get Table: https://github.com/EOSIO/eos/releases/tag/v1.5.0
We need to add support for reverse search and showing ram payer.
Trying to create a transaction using the sample code and always get an exception - "The response ended prematurely"
Calling Wax chain btw -
Eos eos = new Eos(new EosConfigurator()
{
HttpEndpoint = "https://chain.wax.io", //Mainnet
ChainId = "1064487b3cd1a897ce03ae5b6a865651747e2e152090f99c1d19d44e01aea5a4",
ExpireSeconds = 60,
SignProvider = new DefaultSignProvider(....
at System.Net.Http.HttpConnection.d__53.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable1.ConfiguredTaskAwaiter.GetResult() at System.Net.Http.HttpConnectionPool.<SendWithNtConnectionAuthAsync>d__48.MoveNext() at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.ConfiguredTaskAwaitable
1.ConfiguredTaskAwaiter.GetResult()
at System.Net.Http.HttpConnectionPool.d__47.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable1.ConfiguredTaskAwaiter.GetResult() at System.Net.Http.RedirectHandler.<SendAsync>d__4.MoveNext() at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.ConfiguredTaskAwaitable
1.ConfiguredTaskAwaiter.GetResult()
at System.Net.Http.HttpClient.d__71.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter1.GetResult() at EosSharp.HttpHandler.<SendAsync>d__12.MoveNext() at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter
1.GetResult()
at EosSharp.HttpHandler.d__81.MoveNext() at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter
1.GetResult()
at EosSharp.Core.Api.v1.EosApi.d__14.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter1.GetResult() at EosSharp.Core.Providers.AbiSerializationProvider.<GetAbi>d__22.MoveNext() at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter
1.GetResult()
at EosSharp.Core.Providers.AbiSerializationProvider.d__15.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter1.GetResult() at EosSharp.Core.EosBase.<SignTransaction>d__32.MoveNext() at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter
1.GetResult()
at EosSharp.Core.EosBase.d__31.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at WaxBlockchainTesting.Blockchain.d__0.MoveNext() in C:\Users\tvance\source\repos\WindowsFormsApp1\WaxBlockchainTesting\WaxBlockchainTesting\Blockchain.cs:line 38
Currently, eos sharp is failing on iOS due to the following error:
System.Reflection.Emit is not supported.
This is called by FastMember.TypeAccessor.Create
Unfortunately, for iOS support we need to replace all functions using System.Reflection.Emit.
hi, i got an error by use the GetBlock api
request block : 55894564
{"ClassName":"Newtonsoft.Json.JsonReaderException","Message":"Unexpected character encountered while parsing value: {. Path 'new_producers', line 1, position 368.","Data":null,"InnerException":null,"HelpURL":null,"StackTraceString":" at Newtonsoft.Json.JsonTextReader.ReadStringValue(ReadType readType)\n at Newtonsoft.Json.JsonTextReader.ReadAsString()\n at Newtonsoft.Json.JsonReader.ReadForType(JsonContract contract, Boolean hasConverter)\n at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id)\n at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)\n at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)\n at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)\n at Newtonsoft.Json.JsonSerializer.Deserialize[T](JsonReader reader)\n at EosSharp.HttpHandler.DeserializeJsonFromStream[TData](Stream stream)\n at EosSharp.HttpHandler.PostJsonAsync[TResponseData](String url, Object data)\n at EosSharp.Core.Api.v1.EosApi.GetBlock(GetBlockRequest data)\n at Stardust.EOS.Hatcher.Workers.DrawWorker.ExecuteAsync(CancellationToken stoppingToken) in /Users/wesley/Documents/Development/NETCore/Developing/Hatcher/Stardust.EOS.Hatcher/Workers/DrawWorker.cs:line 99","RemoteStackTraceString":null,"RemoteStackIndex":0,"ExceptionMethod":null,"HResult":-2146233088,"Source":"Newtonsoft.Json","WatsonBuckets":null}
When I hang up the VPN, debugging can go to await Api.GetInfo() and then exit without reporting the exception. When I don't use VPN, I won't enter this function. What is the reason?
If the value of a "dictionary type Transaction Data" contain a comma, It will response "Input string is not in a correct format" error when sending transaction.
For example:
Data = new Dictionary<string, string>()
{
{ "owner", "tester112345" },
{ "sym", "4,HVT" }
}
If the value of "sym" is "4,HVT", the transaction can't be send out, but "4.HVT" can.
The type of EosSharp.Api.v1.BlockTransaction.Trx is BlockDetailedTransaction, but many times you only get a hash string on "trx" from EOS blockchains while run "Api.GetBlock", and if got a string, the CreateTransaction method will not run.
Hi,
I couldn't find much information on how to generate the associated public key if you have a private key with you in eos-sharp. I could only see public/private key pairs being generated only when we make use of generateKeyPair. Is there a functionality to generate public key if you have only the private key with you in eos-sharp?
If transfer 0.1 EOS using EOS.CreateTransaction method, It will transfer 0.0232 EOS. the EOS amount is changed.
Using cleos I am using command to call action and it works:
cleos push action groupsample erase '["user2"]' -p groupsample@active
groupsample is the account used for deploying a smart contract and authorization also.
I want to do this in .Net using eos-sharp. I am trying this:
public async Task pushaction()
{
try
{
var result = await eos.CreateTransaction(new EosSharp.Core.Api.v1.Transaction()
{
actions = new List<EosSharp.Core.Api.v1.Action>()
{
new EosSharp.Core.Api.v1.Action()
{
account = "groupsample",
authorization = new List<PermissionLevel>()
{
new PermissionLevel() {actor = "groupsample", permission = "active" }
},
name = "erase",
data = new Dictionary<string, string>()
{
{ "key", "user2" }
}
}
}
});
}
catch(Exception ex)
{
}
}
But this is throwing an exception:
Exception of type 'EosSharp.Core.Exceptions.ApiErrorException' was thrown.
After I called below method I cannot catch error message when the error occurred.
await eos.CreateTransaction(new Transaction()
How can I catch error message when the error occur?
I wrote web API to get all records of table using:
var result = await eos.GetTableRows(new GetTableRowsRequest() {
json = true,
code = "eosio.token",
scope = "EOS",
table = "stat"
});
By default, it gives first 10 records only. I know, if I want more I can give limit
option parameter. But what if I need all records from a table? What value should I set the limit
value to get all records of the table? Please guide.
Need to read a byte before ReadAbiStruct
Need to add some basic examples for highly used methods like
Hi, i am triyng to make push a transaction with Xamarin app.
Here is my code:
static async Task sendTransaction(int id, string datatx)
{
Console.WriteLine("Empieza SEND Tx");
string idTX = id.ToString();
Console.WriteLine("Tx to id: " + idTX);
GlobalVariables.idPUT = GlobalVariables.initialLastID + 1;
try {
var result2 = await eos.CreateTransaction(new Transaction()
{
actions = new List<EosSharp.Core.Api.v1.Action>()
{
new EosSharp.Core.Api.v1.Action()
{
account = "crud",
authorization = new List<PermissionLevel>()
{
new PermissionLevel() {actor = "bob", permission = "active" }
},
name = "create",
data = new { user = "bob", id = idTX, data = datatx }
}
}
});
Console.WriteLine("Tx realizada");
}
catch (Exception ex) { Console.WriteLine(ex); }
}
It is returning the following error:
EosSharp.Core.Exceptions.ApiErrorException: Exception of type 'EosSharp.Core.Exceptions.ApiErrorException' was thrown.
at EosSharp.HttpHandler.BuildSendResponse (System.Net.Http.HttpResponseMessage response) [0x00182] in C:\eosio-mmcs\getscatter\eos-sharp\EosSharp\EosSharp\HttpHelper.cs:230
at EosSharp.HttpHandler.SendAsync (System.Net.Http.HttpRequestMessage request) [0x000b5] in C:\eosio-mmcs\getscatter\eos-sharp\EosSharp\EosSharp\HttpHelper.cs:153
at EosSharp.HttpHandler.PostJsonAsync[TResponseData] (System.String url, System.Object data) [0x00043] in C:\eosio-mmcs\getscatter\eos-sharp\EosSharp\EosSharp\HttpHelper.cs:42
at EosSharp.Core.Api.v1.EosApi.PushTransaction (EosSharp.Core.Api.v1.PushTransactionRequest data) [0x0009a] in :0
at EosSharp.Core.EosBase.BroadcastTransaction (EosSharp.Core.SignedTransaction strx) [0x000cd] in :0
at EosSharp.Core.EosBase.CreateTransaction (EosSharp.Core.Api.v1.Transaction trx, System.Collections.Generic.List`1[T] requiredKeys) [0x00106] in :0
at App1.App.sendTransaction (System.Int32 id, System.String datatx)
Any help please?
Your package only contains .net standard 2.0
How about adding .NetFramework
binaries?
var result = await eos.CreateTransaction(new EosSharp.Api.v1.Transaction() { Actions = new List<EosSharp.Api.v1.Action>() { new EosSharp.Api.v1.Action() { Account = "eosio", Authorization = new List<PermissionLevel>() { new PermissionLevel() {Actor = "myeosaccount", Permission = "owner" } }, Name = "voteproducer", Data =new { voter = "myeosaccount", proxy = "", producers =new string[] { "eosbeijingbp", "eoscannonchn" } } } } });
The above code can run, but if the producers order is changed, it won't run:
var result = await eos.CreateTransaction(new EosSharp.Api.v1.Transaction() { Actions = new List<EosSharp.Api.v1.Action>() { new EosSharp.Api.v1.Action() { Account = "eosio", Authorization = new List<PermissionLevel>() { new PermissionLevel() {Actor = "myeosaccount", Permission = "owner" } }, Name = "voteproducer", Data =new { voter = "myeosaccount", proxy = "", producers =new string[] { "eoscannonchn", "eosbeijingbp"} } } } });
The EOS mainnet will response "voteproducer eosio_assert_message assertion failure" for this code.
I installed eos-sharp in the visual studio using the NuGet package. My code is as below:
using EosSharp;
using EosSharp.Core;
using EosSharp.Core.Providers;
using System.Windows.Forms;
namespace eostest
{
public partial class Form1 : Form
{
Eos eos = new Eos(new EosConfigurator()
{
HttpEndpoint = "https://127.0.0.1:8888",
ChainId = "cf057bbfb72640471fd910bcb67639c22df9f92470936cddc1ade0e2f2e7dc4f",
ExpireSeconds = 60,
SignProvider = new DefaultSignProvider("myprivatekey")
});
public Form1()
{
InitializeComponent();
getinfo();
}
public async void getinfo()
{
var result = await eos.GetInfo();
}
}
}
Nodeos is running on the localhost. I confirmed by using http://localhost:8888/v1/chain/get_info which shows the output. When I run this program, nothing happens.
After 1:40 minutes it throws an exception as below:
This exception was originally thrown at this call stack:
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(System.Threading.Tasks.Task)
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task)
System.Runtime.CompilerServices.TaskAwaiter.GetResult()
EosSharp.HttpHandler.SendAsync(System.Net.Http.HttpRequestMessage) in HttpHelper.cs
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(System.Threading.Tasks.Task)
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task)
System.Runtime.CompilerServices.TaskAwaiter.GetResult()
EosSharp.HttpHandler.GetJsonAsync(string) in HttpHelper.cs
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(System.Threading.Tasks.Task)
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task)
...
[Call Stack Truncated]
How would I confirm whether the parameters are correct and the chain is connected or not? Any help would be appreciated.
Hey there guys,
Wanted to bring to attention that eos-sharp is not actively maintained anymore.
I'm open to discussing possible viable solutions to continue this if it is in the interest of the EOSIO community
Regards
Following the main readme.md the Memo doesn't seem to be printing. You can check under the account 'mirrorserver' on the main net.
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.