├── .gitignore ├── EosSharp ├── EosSharp.Core │ ├── Api │ │ └── v1 │ │ │ ├── Definitions │ │ │ ├── EosApiMethodDef.t4 │ │ │ ├── EosApiTypeDef.t4 │ │ │ └── EosApiUtils.t4 │ │ │ ├── EosApi.cs │ │ │ ├── EosApi.tt │ │ │ ├── EosTypes.cs │ │ │ └── EosTypes.tt │ ├── DataAttributes │ │ └── AbiFieldTypeAttribute.cs │ ├── EosBase.cs │ ├── EosConfigurator.cs │ ├── EosSharp.Core.csproj │ ├── Exceptions │ │ ├── ApiErrorException.cs │ │ └── ApiException.cs │ ├── Helpers │ │ ├── CryptoHelper.cs │ │ └── SerializationHelper.cs │ ├── Interfaces │ │ ├── IHttpHandler.cs │ │ └── ISignProvider.cs │ ├── Providers │ │ ├── AbiSerializationProvider.cs │ │ ├── CombinedSignersProvider.cs │ │ └── DefaultSignProvider.cs │ └── SignedTransaction.cs ├── EosSharp.UnitTests.Core │ ├── ApiUnitTestCases.cs │ ├── EosSharp.UnitTests.Core.csproj │ ├── EosTestCasesDef.t4 │ ├── EosUnitTestCases.cs │ └── SerializationUnitTestCases.cs ├── EosSharp.UnitTests.Unity3D │ ├── ApiUnitTests.cs │ ├── ApiUnitTests.tt │ ├── EosSharp.UnitTests.Unity3D.csproj │ ├── EosUnitTests.cs │ ├── EosUnitTests.tt │ ├── SerializationUnitTests.cs │ ├── SerializationUnitTests.tt │ ├── SignUnitTests.cs │ ├── StressUnitTests.cs │ ├── UnityTester │ │ ├── Assets │ │ │ ├── Plugins.meta │ │ │ ├── Scenes.meta │ │ │ ├── Scenes │ │ │ │ ├── SampleScene.unity │ │ │ │ ├── SampleScene.unity.meta │ │ │ │ ├── Scripts.meta │ │ │ │ └── Scripts │ │ │ │ │ ├── UnitTestsScript.cs │ │ │ │ │ └── UnitTestsScript.cs.meta │ │ │ ├── gs_home_devs_streamlined.png │ │ │ └── gs_home_devs_streamlined.png.meta │ │ ├── Logs │ │ │ └── Packages-Update.log │ │ ├── Packages │ │ │ └── manifest.json │ │ └── ProjectSettings │ │ │ ├── AudioManager.asset │ │ │ ├── ClusterInputManager.asset │ │ │ ├── DynamicsManager.asset │ │ │ ├── EditorBuildSettings.asset │ │ │ ├── EditorSettings.asset │ │ │ ├── GraphicsSettings.asset │ │ │ ├── InputManager.asset │ │ │ ├── NavMeshAreas.asset │ │ │ ├── NetworkManager.asset │ │ │ ├── Physics2DSettings.asset │ │ │ ├── PresetManager.asset │ │ │ ├── ProjectSettings.asset │ │ │ ├── ProjectVersion.txt │ │ │ ├── QualitySettings.asset │ │ │ ├── TagManager.asset │ │ │ ├── TimeManager.asset │ │ │ ├── UnityConnectSettings.asset │ │ │ └── VFXManager.asset │ └── app.config ├── EosSharp.UnitTests │ ├── ApiUnitTests.cs │ ├── ApiUnitTests.tt │ ├── EosSharp.UnitTests.csproj │ ├── EosUnitTests.cs │ ├── EosUnitTests.tt │ ├── MultisigUnitTests.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── SerializationUnitTests.cs │ ├── SerializationUnitTests.tt │ ├── SignUnitTests.cs │ ├── StressUnitTests.cs │ ├── app.config │ └── packages.config ├── EosSharp.Unity3D │ ├── Eos.cs │ ├── EosSharp.Unity3D.csproj │ ├── HttpHelper.cs │ └── UnityWebRequestAwaiter.cs ├── EosSharp.sln └── EosSharp │ ├── Eos.cs │ ├── EosSharp.csproj │ └── HttpHelper.cs ├── LICENSE └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # This .gitignore file was automatically created by Microsoft(R) Visual Studio. 3 | ################################################################################ 4 | 5 | /EosSharp/EosSharp/obj 6 | /EosSharp/EosSharp.UnitTests/obj 7 | /EosSharp/packages 8 | *.suo 9 | /EosSharp/EosSharp/bin 10 | /EosSharp/EosSharp.UnitTests/bin 11 | /EosSharp/.vs 12 | /EosSharp/EosSharp.Unity3D/obj 13 | /EosSharp/EosSharp.Unity3D/bin 14 | /EosSharp/EosSharp.Core/bin 15 | /EosSharp/EosSharp.Core/obj 16 | /EosSharp/EosSharp.UnitTests.Core/bin/Debug/netstandard2.0 17 | /EosSharp/EosSharp.UnitTests.Core/obj 18 | /EosSharp/EosSharp.UnitTests.Unity3D/bin/Debug/netstandard2.0 19 | /EosSharp/EosSharp.UnitTests.Unity3D/obj 20 | /EosSharp/EosSharp.UnitTests.Unity3D/UnityTester/Assets/Plugins 21 | /EosSharp/EosSharp.UnitTests.Unity3D/UnityTester/.vs/UnityTester/v15 22 | /EosSharp/EosSharp.UnitTests.Unity3D/UnityTester/obj/Debug 23 | -------------------------------------------------------------------------------- /EosSharp/EosSharp.Core/Api/v1/Definitions/EosApiUtils.t4: -------------------------------------------------------------------------------- 1 | <#+ 2 | public class Field 3 | { 4 | public string Name { get; set; } 5 | public string Type { get; set; } 6 | public string Default { get; set; } 7 | public string AbiFieldType { get; set; } 8 | } 9 | 10 | public class ApiType 11 | { 12 | public string Name { get; set; } 13 | public Field[] Fields { get; set; } 14 | } 15 | 16 | public class ApiMethod 17 | { 18 | public string Module { get; set; } 19 | public string Name { get; set; } 20 | public string ResponseGenericTypes { get; set; } 21 | public bool IsResponseCollection { get; set; } 22 | public bool IsCachable { get; set; } 23 | public Field[] Request { get; set; } 24 | public Field[] Response { get; set; } 25 | public Field[] GenericResponse { get; set; } 26 | } 27 | 28 | public string SnakeCaseToPascalCase(string s) 29 | { 30 | var result = s.ToLower().Replace("_", " "); 31 | TextInfo info = CultureInfo.CurrentCulture.TextInfo; 32 | result = info.ToTitleCase(result).Replace(" ", string.Empty); 33 | return result; 34 | } 35 | 36 | public string RenderFieldDefault(Field field) { 37 | if(string.IsNullOrWhiteSpace(field.Default)) 38 | return ";"; 39 | 40 | if(field.Type.ToLower() == "string") { 41 | return " = \"" + field.Default + "\";"; 42 | } 43 | else { 44 | return " = " + field.Default + ";"; 45 | } 46 | } 47 | 48 | public string EscapeKeyWords(string s) { 49 | 50 | switch(s) { 51 | case "base": 52 | return "@base"; 53 | case "class": 54 | return "@class"; 55 | case "new": 56 | return "@new"; 57 | } 58 | 59 | return s; 60 | } 61 | #> -------------------------------------------------------------------------------- /EosSharp/EosSharp.Core/Api/v1/EosApi.cs: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | // Auto Generated, do not edit. 6 | using EosSharp.Core; 7 | using EosSharp.Core.Api.v1; 8 | using EosSharp.Core.Interfaces; 9 | using System.Collections.Generic; 10 | using System.Threading.Tasks; 11 | 12 | namespace EosSharp.Core.Api.v1 13 | { 14 | 15 | /// 16 | /// EosApi defines api methods to interface with a http handler 17 | /// 18 | public class EosApi 19 | { 20 | public EosConfigurator Config { get; set; } 21 | public IHttpHandler HttpHandler { get; set; } 22 | 23 | /// 24 | /// Eos Client api constructor. 25 | /// 26 | /// Configures client parameters 27 | /// Http handler implementation 28 | public EosApi(EosConfigurator config, IHttpHandler httpHandler) 29 | { 30 | Config = config; 31 | HttpHandler = httpHandler; 32 | } 33 | 34 | public async Task GetInfo() 35 | { 36 | var url = string.Format("{0}/v1/chain/get_info", Config.HttpEndpoint); 37 | return await HttpHandler.GetJsonAsync(url); 38 | } 39 | public async Task GetAccount(GetAccountRequest data) 40 | { 41 | var url = string.Format("{0}/v1/chain/get_account", Config.HttpEndpoint); 42 | return await HttpHandler.PostJsonAsync(url, data); 43 | } 44 | public async Task GetCode(GetCodeRequest data, bool reload = false) 45 | { 46 | var url = string.Format("{0}/v1/chain/get_code", Config.HttpEndpoint); 47 | return await HttpHandler.PostJsonWithCacheAsync(url, data, reload); 48 | } 49 | public async Task GetAbi(GetAbiRequest data, bool reload = false) 50 | { 51 | var url = string.Format("{0}/v1/chain/get_abi", Config.HttpEndpoint); 52 | return await HttpHandler.PostJsonWithCacheAsync(url, data, reload); 53 | } 54 | public async Task GetRawCodeAndAbi(GetRawCodeAndAbiRequest data, bool reload = false) 55 | { 56 | var url = string.Format("{0}/v1/chain/get_raw_code_and_abi", Config.HttpEndpoint); 57 | return await HttpHandler.PostJsonWithCacheAsync(url, data, reload); 58 | } 59 | public async Task GetRawAbi(GetRawAbiRequest data, bool reload = false) 60 | { 61 | var url = string.Format("{0}/v1/chain/get_raw_abi", Config.HttpEndpoint); 62 | return await HttpHandler.PostJsonWithCacheAsync(url, data, reload); 63 | } 64 | public async Task AbiJsonToBin(AbiJsonToBinRequest data) 65 | { 66 | var url = string.Format("{0}/v1/chain/abi_json_to_bin", Config.HttpEndpoint); 67 | return await HttpHandler.PostJsonAsync(url, data); 68 | } 69 | public async Task AbiBinToJson(AbiBinToJsonRequest data) 70 | { 71 | var url = string.Format("{0}/v1/chain/abi_bin_to_json", Config.HttpEndpoint); 72 | return await HttpHandler.PostJsonAsync(url, data); 73 | } 74 | public async Task GetRequiredKeys(GetRequiredKeysRequest data) 75 | { 76 | var url = string.Format("{0}/v1/chain/get_required_keys", Config.HttpEndpoint); 77 | return await HttpHandler.PostJsonAsync(url, data); 78 | } 79 | public async Task GetBlock(GetBlockRequest data) 80 | { 81 | var url = string.Format("{0}/v1/chain/get_block", Config.HttpEndpoint); 82 | return await HttpHandler.PostJsonAsync(url, data); 83 | } 84 | public async Task GetBlockHeaderState(GetBlockHeaderStateRequest data) 85 | { 86 | var url = string.Format("{0}/v1/chain/get_block_header_state", Config.HttpEndpoint); 87 | return await HttpHandler.PostJsonAsync(url, data); 88 | } 89 | public async Task> GetTableRows(GetTableRowsRequest data) 90 | { 91 | var url = string.Format("{0}/v1/chain/get_table_rows", Config.HttpEndpoint); 92 | return await HttpHandler.PostJsonAsync>(url, data); 93 | } 94 | public async Task GetTableRows(GetTableRowsRequest data) 95 | { 96 | var url = string.Format("{0}/v1/chain/get_table_rows", Config.HttpEndpoint); 97 | return await HttpHandler.PostJsonAsync(url, data); 98 | } 99 | public async Task GetTableByScope(GetTableByScopeRequest data) 100 | { 101 | var url = string.Format("{0}/v1/chain/get_table_by_scope", Config.HttpEndpoint); 102 | return await HttpHandler.PostJsonAsync(url, data); 103 | } 104 | public async Task GetCurrencyBalance(GetCurrencyBalanceRequest data) 105 | { 106 | var url = string.Format("{0}/v1/chain/get_currency_balance", Config.HttpEndpoint); 107 | return new GetCurrencyBalanceResponse() { assets = await HttpHandler.PostJsonAsync>(url, data) }; 108 | } 109 | public async Task GetCurrencyStats(GetCurrencyStatsRequest data) 110 | { 111 | var url = string.Format("{0}/v1/chain/get_currency_stats", Config.HttpEndpoint); 112 | return new GetCurrencyStatsResponse() { stats = await HttpHandler.PostJsonAsync>(url, data) }; 113 | } 114 | public async Task GetProducers(GetProducersRequest data) 115 | { 116 | var url = string.Format("{0}/v1/chain/get_producers", Config.HttpEndpoint); 117 | return await HttpHandler.PostJsonAsync(url, data); 118 | } 119 | public async Task GetProducerSchedule() 120 | { 121 | var url = string.Format("{0}/v1/chain/get_producer_schedule", Config.HttpEndpoint); 122 | return await HttpHandler.GetJsonAsync(url); 123 | } 124 | public async Task GetScheduledTransactions(GetScheduledTransactionsRequest data) 125 | { 126 | var url = string.Format("{0}/v1/chain/get_scheduled_transactions", Config.HttpEndpoint); 127 | return await HttpHandler.PostJsonAsync(url, data); 128 | } 129 | public async Task PushTransaction(PushTransactionRequest data) 130 | { 131 | var url = string.Format("{0}/v1/chain/push_transaction", Config.HttpEndpoint); 132 | return await HttpHandler.PostJsonAsync(url, data); 133 | } 134 | public async Task GetActions(GetActionsRequest data) 135 | { 136 | var url = string.Format("{0}/v1/history/get_actions", Config.HttpEndpoint); 137 | return await HttpHandler.PostJsonAsync(url, data); 138 | } 139 | public async Task GetTransaction(GetTransactionRequest data) 140 | { 141 | var url = string.Format("{0}/v1/history/get_transaction", Config.HttpEndpoint); 142 | return await HttpHandler.PostJsonAsync(url, data); 143 | } 144 | public async Task GetKeyAccounts(GetKeyAccountsRequest data) 145 | { 146 | var url = string.Format("{0}/v1/history/get_key_accounts", Config.HttpEndpoint); 147 | return await HttpHandler.PostJsonAsync(url, data); 148 | } 149 | public async Task GetControlledAccounts(GetControlledAccountsRequest data) 150 | { 151 | var url = string.Format("{0}/v1/history/get_controlled_accounts", Config.HttpEndpoint); 152 | return await HttpHandler.PostJsonAsync(url, data); 153 | } 154 | } 155 | } 156 | -------------------------------------------------------------------------------- /EosSharp/EosSharp.Core/Api/v1/EosApi.tt: -------------------------------------------------------------------------------- 1 | <#@ template debug="false" hostspecific="false" language="C#" #> 2 | <#@ assembly name="System.Core" #> 3 | <#@ import namespace="System.Globalization" #> 4 | <#@ include file=".\..\..\..\EosSharp.Core\Api\v1\Definitions\EosApiTypeDef.t4" #> 5 | <#@ include file=".\..\..\..\EosSharp.Core\Api\v1\Definitions\EosApiMethodDef.t4" #> 6 | <#@ output extension=".cs" #> 7 | // Auto Generated, do not edit. 8 | using EosSharp.Core; 9 | using EosSharp.Core.Api.v1; 10 | using EosSharp.Core.Interfaces; 11 | using System.Collections.Generic; 12 | using System.Threading.Tasks; 13 | 14 | namespace EosSharp.Core.Api.v1 15 | { 16 | 17 | /// 18 | /// EosApi defines api methods to interface with a http handler 19 | /// 20 | public class EosApi 21 | { 22 | public EosConfigurator Config { get; set; } 23 | public IHttpHandler HttpHandler { get; set; } 24 | 25 | /// 26 | /// Eos Client api constructor. 27 | /// 28 | /// Configures client parameters 29 | /// Http handler implementation 30 | public EosApi(EosConfigurator config, IHttpHandler httpHandler) 31 | { 32 | Config = config; 33 | HttpHandler = httpHandler; 34 | } 35 | 36 | <# foreach (var method in apiMethods) { #> 37 | <# if(method.Request == null) { #> 38 | <# if(!string.IsNullOrWhiteSpace(method.ResponseGenericTypes)) {#> 39 | public async Task<<#= SnakeCaseToPascalCase(method.Name) #>Response<#= method.ResponseGenericTypes #>> <#= SnakeCaseToPascalCase(method.Name) #><#= method.ResponseGenericTypes #>() 40 | { 41 | var url = string.Format("{0}/v1/<#= method.Module #>/<#= method.Name #>", Config.HttpEndpoint); 42 | <# if(method.IsResponseCollection) { #> 43 | return new <#= SnakeCaseToPascalCase(method.Name) #>Response() { <#= EscapeKeyWords(method.Response[0].Name) #> = await HttpHandler.GetJsonAsync<<#= method.Response[0].Type#>>(url) }; 44 | <# } else { #> 45 | return await HttpHandler.GetJsonAsync<<#= SnakeCaseToPascalCase(method.Name) #>Response<#= method.ResponseGenericTypes #>>(url); 46 | <# } #> 47 | } 48 | <# } #> 49 | public async Task<<#= SnakeCaseToPascalCase(method.Name) #>Response> <#= SnakeCaseToPascalCase(method.Name) #>() 50 | { 51 | var url = string.Format("{0}/v1/<#= method.Module #>/<#= method.Name #>", Config.HttpEndpoint); 52 | <# if(method.IsResponseCollection) { #> 53 | return new <#= SnakeCaseToPascalCase(method.Name) #>Response() { <#= EscapeKeyWords(method.Response[0].Name) #> = await HttpHandler.GetJsonAsync<<#= method.Response[0].Type#>>(url) }; 54 | <# } else { #> 55 | return await HttpHandler.GetJsonAsync<<#= SnakeCaseToPascalCase(method.Name) #>Response>(url); 56 | <# } #> 57 | } 58 | <# } else { #> 59 | <# if(!string.IsNullOrWhiteSpace(method.ResponseGenericTypes)) {#> 60 | public async Task<<#= SnakeCaseToPascalCase(method.Name) #>Response<#= method.ResponseGenericTypes #>> <#= SnakeCaseToPascalCase(method.Name) #><#= method.ResponseGenericTypes #>(<#= SnakeCaseToPascalCase(method.Name) #>Request data<#= method.IsCachable ? ", bool reload = false" : "" #>) 61 | { 62 | var url = string.Format("{0}/v1/<#= method.Module #>/<#= method.Name #>", Config.HttpEndpoint); 63 | <# if(method.IsResponseCollection) { #> 64 | return new <#= SnakeCaseToPascalCase(method.Name) #>Response() { <#= EscapeKeyWords(method.Response[0].Name) #> = await httpHandler.PostJson<#= method.IsCachable ? "WithCache" : "" #>Async<<#= method.Response[0].Type#>>(url, data<#= method.IsCachable ? ", reload" : "" #>) }; 65 | <# } else { #> 66 | return await HttpHandler.PostJson<#= method.IsCachable ? "WithCache" : "" #>Async<<#= SnakeCaseToPascalCase(method.Name) #>Response<#= method.ResponseGenericTypes #>>(url, data<#= method.IsCachable ? ", reload" : "" #>); 67 | <# } #> 68 | } 69 | <# } #> 70 | public async Task<<#= SnakeCaseToPascalCase(method.Name) #>Response> <#= SnakeCaseToPascalCase(method.Name) #>(<#= SnakeCaseToPascalCase(method.Name) #>Request data<#= method.IsCachable ? ", bool reload = false" : "" #>) 71 | { 72 | var url = string.Format("{0}/v1/<#= method.Module #>/<#= method.Name #>", Config.HttpEndpoint); 73 | <# if(method.IsResponseCollection) { #> 74 | return new <#= SnakeCaseToPascalCase(method.Name) #>Response() { <#= EscapeKeyWords(method.Response[0].Name) #> = await HttpHandler.PostJson<#= method.IsCachable ? "WithCache" : "" #>Async<<#= method.Response[0].Type#>>(url, data<#= method.IsCachable ? ", reload" : "" #>) }; 75 | <# } else { #> 76 | return await HttpHandler.PostJson<#= method.IsCachable ? "WithCache" : "" #>Async<<#= SnakeCaseToPascalCase(method.Name) #>Response>(url, data<#= method.IsCachable ? ", reload" : "" #>); 77 | <# } #> 78 | } 79 | <# } #> 80 | <# } #> 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /EosSharp/EosSharp.Core/Api/v1/EosTypes.tt: -------------------------------------------------------------------------------- 1 | <#@ template debug="false" hostspecific="false" language="C#" #> 2 | <#@ assembly name="System.Core" #> 3 | <#@ import namespace="System.Globalization" #> 4 | <#@ include file=".\Definitions\EosApiTypeDef.t4" #> 5 | <#@ include file=".\Definitions\EosApiMethodDef.t4" #> 6 | <#@ output extension=".cs" #> 7 | // Auto Generated, do not edit. 8 | using EosSharp.Core.DataAttributes; 9 | using System; 10 | using System.Collections.Generic; 11 | 12 | namespace EosSharp.Core.Api.v1 13 | { 14 | #region generate api types 15 | <# foreach (var type in apiTypes) { #> 16 | [Serializable] 17 | public class <#= type.Name #> 18 | { 19 | <# foreach (var field in type.Fields) { #> 20 | <#= !string.IsNullOrWhiteSpace(field.AbiFieldType) ? "[AbiFieldType(\""+ field.AbiFieldType +"\")]" : "" #> 21 | public <#= field.Type #> <#= EscapeKeyWords(field.Name) #><#= RenderFieldDefault(field) #> 22 | <# } #> 23 | } 24 | <# } #> 25 | #endregion 26 | 27 | #region generate api method types 28 | <# foreach (var method in apiMethods) { #> 29 | <# if (method.Request != null) { #> 30 | [Serializable] 31 | public class <#= SnakeCaseToPascalCase(method.Name) #>Request 32 | { 33 | <# foreach (var field in method.Request) { #> 34 | public <#= field.Type #> <#= EscapeKeyWords(field.Name) #><#= RenderFieldDefault(field) #> 35 | <# } #> 36 | } 37 | <# } #> 38 | <# if (method.Response != null) { #> 39 | [Serializable] 40 | public class <#= SnakeCaseToPascalCase(method.Name) #>Response 41 | { 42 | <# foreach (var field in method.Response) { #> 43 | public <#= field.Type #> <#= EscapeKeyWords(field.Name) #><#= RenderFieldDefault(field) #> 44 | <# } #> 45 | } 46 | <# } #> 47 | <# if (method.GenericResponse != null && !string.IsNullOrWhiteSpace(method.ResponseGenericTypes)) { #> 48 | [Serializable] 49 | public class <#= SnakeCaseToPascalCase(method.Name) #>Response<#= method.ResponseGenericTypes #> 50 | { 51 | <# foreach (var field in method.GenericResponse) { #> 52 | public <#= field.Type #> <#= EscapeKeyWords(field.Name) #><#= RenderFieldDefault(field) #> 53 | <# } #> 54 | } 55 | <# } #> 56 | <# } #> 57 | #endregion 58 | } 59 | 60 | -------------------------------------------------------------------------------- /EosSharp/EosSharp.Core/DataAttributes/AbiFieldTypeAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace EosSharp.Core.DataAttributes 4 | { 5 | /// 6 | /// Data Attribute to map how the field is represented in the abi 7 | /// 8 | public class AbiFieldTypeAttribute : Attribute 9 | { 10 | public string AbiType { get; set; } 11 | 12 | public AbiFieldTypeAttribute(string abiType) 13 | { 14 | AbiType = abiType; 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /EosSharp/EosSharp.Core/EosConfigurator.cs: -------------------------------------------------------------------------------- 1 | using EosSharp.Core.Interfaces; 2 | using System; 3 | 4 | namespace EosSharp.Core 5 | { 6 | /// 7 | /// Aggregates all properties to configure Eos client 8 | /// 9 | public class EosConfigurator 10 | { 11 | /// 12 | /// http or https location of a nodeosd server providing a chain API. 13 | /// 14 | public string HttpEndpoint { get; set; } = "http://127.0.0.1:8888"; 15 | /// 16 | /// unique ID for the blockchain you're connecting to. If no ChainId is provided it will get from the get_info API call. 17 | /// 18 | public string ChainId { get; set; } 19 | /// 20 | /// number of seconds before the transaction will expire. The time is based on the nodeosd's clock. 21 | /// An unexpired transaction that may have had an error is a liability until the expiration is reached, this time should be brief. 22 | /// 23 | public double ExpireSeconds { get; set; } = 60; 24 | 25 | /// 26 | /// How many blocks behind to use for TAPoS reference block 27 | /// 28 | public UInt32 blocksBehind { get; set; } = 3; 29 | /// 30 | /// signature implementation to handle available keys and signing transactions. Use the DefaultSignProvider with a privateKey to sign transactions inside the lib. 31 | /// 32 | public ISignProvider SignProvider { get; set; } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /EosSharp/EosSharp.Core/EosSharp.Core.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netstandard2.0 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | EosApi.tt 14 | True 15 | True 16 | 17 | 18 | EosTypes.tt 19 | True 20 | True 21 | 22 | 23 | 24 | 25 | 26 | EosApi.cs 27 | TextTemplatingFileGenerator 28 | 29 | 30 | EosTypes.cs 31 | TextTemplatingFileGenerator 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /EosSharp/EosSharp.Core/Exceptions/ApiErrorException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Runtime.Serialization; 4 | 5 | namespace EosSharp.Core.Exceptions 6 | { 7 | /// 8 | /// Wrapper exception for EOSIO api error 9 | /// 10 | [Serializable] 11 | public class ApiErrorException : Exception 12 | { 13 | public int code; 14 | public string message; 15 | public ApiError error; 16 | 17 | public ApiErrorException() 18 | { 19 | 20 | } 21 | 22 | public ApiErrorException(SerializationInfo info, StreamingContext context) 23 | { 24 | if (info == null) 25 | return; 26 | 27 | code = info.GetInt32("code"); 28 | message = info.GetString("message"); 29 | error = (ApiError)info.GetValue("error", typeof(ApiError)); 30 | } 31 | 32 | public override void GetObjectData(SerializationInfo info, StreamingContext context) 33 | { 34 | if (info == null) 35 | return; 36 | 37 | base.GetObjectData(info, context); 38 | info.AddValue("code", code); 39 | info.AddValue("message", message); 40 | info.AddValue("error", error); 41 | } 42 | } 43 | 44 | /// 45 | /// EOSIO Api Error 46 | /// 47 | [Serializable] 48 | public class ApiError 49 | { 50 | public int code; 51 | public string name; 52 | public string what; 53 | public List details; 54 | } 55 | 56 | /// 57 | /// EOSIO Api Error detail 58 | /// 59 | [Serializable] 60 | public class ApiErrorDetail 61 | { 62 | public string message; 63 | public string file; 64 | public int line_number; 65 | public string method; 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /EosSharp/EosSharp.Core/Exceptions/ApiException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.Serialization; 3 | 4 | namespace EosSharp.Core.Exceptions 5 | { 6 | /// 7 | /// Generic Api exception 8 | /// 9 | [Serializable] 10 | public class ApiException : Exception 11 | { 12 | public int StatusCode { get; set; } 13 | public string Content { get; set; } 14 | 15 | public ApiException() 16 | { 17 | 18 | } 19 | 20 | public ApiException(SerializationInfo info, StreamingContext context) 21 | { 22 | if (info == null) 23 | return; 24 | 25 | StatusCode = info.GetInt32("StatusCode"); 26 | Content = info.GetString("Content"); 27 | } 28 | 29 | public override void GetObjectData(SerializationInfo info, StreamingContext context) 30 | { 31 | if (info == null) 32 | return; 33 | 34 | base.GetObjectData(info, context); 35 | info.AddValue("StatusCode", StatusCode); 36 | info.AddValue("Content", Content); 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /EosSharp/EosSharp.Core/Interfaces/IHttpHandler.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using System.Net.Http; 3 | using System.Threading; 4 | using System.Threading.Tasks; 5 | 6 | namespace EosSharp.Core.Interfaces 7 | { 8 | /// 9 | /// Http handler interface for cross platform specific implementations 10 | /// 11 | public interface IHttpHandler 12 | { 13 | /// 14 | /// Clear cached responses from requests called with Post/GetWithCacheAsync 15 | /// 16 | void ClearResponseCache(); 17 | 18 | /// 19 | /// Make post request with data converted to json asynchronously 20 | /// 21 | /// Response type 22 | /// Url to send the request 23 | /// data sent in the body 24 | /// Response data deserialized to type TResponseData 25 | Task PostJsonAsync(string url, object data); 26 | 27 | /// 28 | /// Make post request with data converted to json asynchronously 29 | /// 30 | /// Response type 31 | /// Url to send the request 32 | /// data sent in the body 33 | /// Notification that operation should be canceled 34 | /// Response data deserialized to type TResponseData 35 | Task PostJsonAsync(string url, object data, CancellationToken cancellationToken); 36 | 37 | /// 38 | /// Make post request with data converted to json asynchronously. 39 | /// Response is cached based on input (url, data) 40 | /// 41 | /// Response type 42 | /// Url to send the request 43 | /// data sent in the body 44 | /// ignore cached value and make a request caching the result 45 | /// Response data deserialized to type TResponseData 46 | Task PostJsonWithCacheAsync(string url, object data, bool reload = false); 47 | 48 | /// 49 | /// Make post request with data converted to json asynchronously. 50 | /// Response is cached based on input (url, data) 51 | /// 52 | /// Response type 53 | /// Url to send the request 54 | /// data sent in the body 55 | /// Notification that operation should be canceled 56 | /// ignore cached value and make a request caching the result 57 | /// Response data deserialized to type TResponseData 58 | Task PostJsonWithCacheAsync(string url, object data, CancellationToken cancellationToken, bool reload = false); 59 | 60 | /// 61 | /// Make get request asynchronously. 62 | /// 63 | /// Response type 64 | /// Url to send the request 65 | /// Response data deserialized to type TResponseData 66 | Task GetJsonAsync(string url); 67 | 68 | /// 69 | /// Make get request asynchronously. 70 | /// 71 | /// Response type 72 | /// Url to send the request 73 | /// Notification that operation should be canceled 74 | /// Response data deserialized to type TResponseData 75 | Task GetJsonAsync(string url, CancellationToken cancellationToken); 76 | 77 | /// 78 | /// Generic http request sent asynchronously 79 | /// 80 | /// request body 81 | /// Stream with response 82 | Task SendAsync(HttpRequestMessage request); 83 | 84 | /// 85 | /// Generic http request sent asynchronously 86 | /// 87 | /// request body 88 | /// /// Notification that operation should be canceled 89 | /// Stream with response 90 | Task SendAsync(HttpRequestMessage request, CancellationToken cancellationToken); 91 | 92 | /// 93 | /// Upsert response data in the data store 94 | /// 95 | /// response data type 96 | /// data key 97 | /// response data 98 | void UpdateResponseDataCache(string hashKey, TResponseData responseData); 99 | 100 | /// 101 | /// Calculate request unique hash key 102 | /// 103 | /// Url to send the request 104 | /// data sent in the body 105 | /// 106 | string GetRequestHashKey(string url, object data); 107 | 108 | /// 109 | /// Convert response to stream 110 | /// 111 | /// response object 112 | /// Stream with response 113 | Task BuildSendResponse(HttpResponseMessage response); 114 | 115 | /// 116 | /// Convert stream to a string 117 | /// 118 | /// 119 | /// 120 | Task StreamToStringAsync(Stream stream); 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /EosSharp/EosSharp.Core/Interfaces/ISignProvider.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Threading.Tasks; 3 | 4 | namespace EosSharp.Core.Interfaces 5 | { 6 | /// 7 | /// Signature provider Interface to delegate multiple signing implementations 8 | /// 9 | public interface ISignProvider 10 | { 11 | /// 12 | /// Get available public keys from signature provider 13 | /// 14 | /// List of public keys 15 | Task> GetAvailableKeys(); 16 | 17 | /// 18 | /// Sign bytes using the signature provider 19 | /// 20 | /// EOSIO Chain id 21 | /// required public keys for signing this bytes 22 | /// signature bytes 23 | /// abi contract names to get abi information from 24 | /// List of signatures per required keys 25 | Task> Sign(string chainId, IEnumerable requiredKeys, byte[] signBytes, IEnumerable abiNames = null); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /EosSharp/EosSharp.Core/Providers/CombinedSignersProvider.cs: -------------------------------------------------------------------------------- 1 | using EosSharp.Core.Interfaces; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Linq; 7 | 8 | namespace EosSharp.Core.Providers 9 | { 10 | /// 11 | /// Signature provider that combine multiple signature providers to complete all the signatures for a transaction 12 | /// 13 | public class CombinedSignersProvider : ISignProvider 14 | { 15 | private List Signers { get; set; } 16 | 17 | /// 18 | /// Creates the provider with a list of signature providers 19 | /// 20 | /// 21 | public CombinedSignersProvider(List signers) 22 | { 23 | if (signers == null || signers.Count == 0) 24 | throw new ArgumentNullException("Required atleast one signer."); 25 | 26 | Signers = signers; 27 | } 28 | 29 | /// 30 | /// Get available public keys from the list of signature providers 31 | /// 32 | /// List of public keys 33 | public async Task> GetAvailableKeys() 34 | { 35 | var availableKeysListTasks = Signers.Select(s => s.GetAvailableKeys()); 36 | var availableKeysList = await Task.WhenAll(availableKeysListTasks); 37 | return availableKeysList.SelectMany(k => k).Distinct(); 38 | } 39 | 40 | /// 41 | /// Sign bytes using the list of signature providers 42 | /// 43 | /// EOSIO Chain id 44 | /// required public keys for signing this bytes 45 | /// signature bytes 46 | /// abi contract names to get abi information from 47 | /// List of signatures per required keys 48 | public async Task> Sign(string chainId, IEnumerable requiredKeys, byte[] signBytes, IEnumerable abiNames = null) 49 | { 50 | var signatureTasks = Signers.Select(s => s.Sign(chainId, requiredKeys, signBytes, abiNames)); 51 | var signatures = await Task.WhenAll(signatureTasks); 52 | return signatures.SelectMany(k => k).Distinct(); 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /EosSharp/EosSharp.Core/Providers/DefaultSignProvider.cs: -------------------------------------------------------------------------------- 1 | using Cryptography.ECDSA; 2 | using EosSharp.Core.Helpers; 3 | using EosSharp.Core.Interfaces; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | 10 | namespace EosSharp.Core.Providers 11 | { 12 | /// 13 | /// Signature provider default implementation that stores private keys in memory 14 | /// 15 | public class DefaultSignProvider : ISignProvider 16 | { 17 | private readonly byte[] KeyTypeBytes = Encoding.UTF8.GetBytes("K1"); 18 | private readonly Dictionary Keys = new Dictionary(); 19 | 20 | /// 21 | /// Create provider with single private key 22 | /// 23 | /// 24 | public DefaultSignProvider(string privateKey) 25 | { 26 | var privKeyBytes = CryptoHelper.GetPrivateKeyBytesWithoutCheckSum(privateKey); 27 | var pubKey = CryptoHelper.PubKeyBytesToString(Secp256K1Manager.GetPublicKey(privKeyBytes, true)); 28 | Keys.Add(pubKey, privKeyBytes); 29 | } 30 | 31 | /// 32 | /// Create provider with list of private keys 33 | /// 34 | /// 35 | public DefaultSignProvider(List privateKeys) 36 | { 37 | if (privateKeys == null || privateKeys.Count == 0) 38 | throw new ArgumentNullException("privateKeys"); 39 | 40 | foreach(var key in privateKeys) 41 | { 42 | var privKeyBytes = CryptoHelper.GetPrivateKeyBytesWithoutCheckSum(key); 43 | var pubKey = CryptoHelper.PubKeyBytesToString(Secp256K1Manager.GetPublicKey(privKeyBytes, true)); 44 | Keys.Add(pubKey, privKeyBytes); 45 | } 46 | } 47 | 48 | /// 49 | /// Create provider with dictionary of encoded key pairs 50 | /// 51 | /// 52 | public DefaultSignProvider(Dictionary encodedKeys) 53 | { 54 | if (encodedKeys == null || encodedKeys.Count == 0) 55 | throw new ArgumentNullException("encodedKeys"); 56 | 57 | foreach (var keyPair in encodedKeys) 58 | { 59 | var privKeyBytes = CryptoHelper.GetPrivateKeyBytesWithoutCheckSum(keyPair.Value); 60 | Keys.Add(keyPair.Key, privKeyBytes); 61 | } 62 | } 63 | 64 | /// 65 | /// Create provider with dictionary of key pair with private key as byte array 66 | /// 67 | /// 68 | public DefaultSignProvider(Dictionary keys) 69 | { 70 | if (keys == null || keys.Count == 0) 71 | throw new ArgumentNullException("encodedKeys"); 72 | 73 | Keys = keys; 74 | } 75 | 76 | /// 77 | /// Get available public keys from signature provider 78 | /// 79 | /// List of public keys 80 | public Task> GetAvailableKeys() 81 | { 82 | return Task.FromResult(Keys.Keys.AsEnumerable()); 83 | } 84 | 85 | /// 86 | /// Sign bytes using the signature provider 87 | /// 88 | /// EOSIO Chain id 89 | /// required public keys for signing this bytes 90 | /// signature bytes 91 | /// abi contract names to get abi information from 92 | /// List of signatures per required keys 93 | public Task> Sign(string chainId, IEnumerable requiredKeys, byte[] signBytes, IEnumerable abiNames = null) 94 | { 95 | if (requiredKeys == null) 96 | return Task.FromResult(new List().AsEnumerable()); 97 | 98 | var availableAndReqKeys = requiredKeys.Intersect(Keys.Keys); 99 | 100 | var data = new List() 101 | { 102 | Hex.HexToBytes(chainId), 103 | signBytes, 104 | new byte[32] 105 | }; 106 | 107 | var hash = Sha256Manager.GetHash(SerializationHelper.Combine(data)); 108 | 109 | return Task.FromResult(availableAndReqKeys.Select(key => 110 | { 111 | var sign = Secp256K1Manager.SignCompressedCompact(hash, Keys[key]); 112 | var check = new List() { sign, KeyTypeBytes }; 113 | var checksum = Ripemd160Manager.GetHash(SerializationHelper.Combine(check)).Take(4).ToArray(); 114 | var signAndChecksum = new List() { sign, checksum }; 115 | 116 | return "SIG_K1_" + Base58.Encode(SerializationHelper.Combine(signAndChecksum)); 117 | })); 118 | } 119 | } 120 | } -------------------------------------------------------------------------------- /EosSharp/EosSharp.Core/SignedTransaction.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace EosSharp.Core 6 | { 7 | public class SignedTransaction 8 | { 9 | public IEnumerable Signatures { get; set; } 10 | public byte[] PackedTransaction { get; set; } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /EosSharp/EosSharp.UnitTests.Core/ApiUnitTestCases.cs: -------------------------------------------------------------------------------- 1 | using EosSharp.Core; 2 | using EosSharp.Core.Api.v1; 3 | using EosSharp.Core.Helpers; 4 | using EosSharp.Core.Providers; 5 | using System; 6 | using System.Collections.Generic; 7 | using System.Linq; 8 | using System.Threading.Tasks; 9 | 10 | namespace EosSharp.UnitTests 11 | { 12 | public class ApiUnitTestCases 13 | { 14 | private EosConfigurator EosConfig; 15 | private EosApi DefaultApi; 16 | 17 | public ApiUnitTestCases(EosConfigurator eosConfig, EosApi api) 18 | { 19 | EosConfig = eosConfig; 20 | DefaultApi = api; 21 | } 22 | 23 | public Task GetInfo() 24 | { 25 | return DefaultApi.GetInfo(); 26 | } 27 | 28 | public Task GetAccount() 29 | { 30 | return DefaultApi.GetAccount(new GetAccountRequest() 31 | { 32 | account_name = "eosio" 33 | }); 34 | } 35 | 36 | public Task GetCode() 37 | { 38 | return DefaultApi.GetCode(new GetCodeRequest() 39 | { 40 | account_name = "eosio.token", 41 | code_as_wasm = true 42 | }); 43 | } 44 | 45 | public Task GetAbi() 46 | { 47 | return DefaultApi.GetAbi(new GetAbiRequest() 48 | { 49 | account_name = "eosio.token" 50 | }); 51 | } 52 | 53 | public async Task GetRawCodeAndAbi() 54 | { 55 | var result = await DefaultApi.GetRawCodeAndAbi(new GetRawCodeAndAbiRequest() 56 | { 57 | account_name = "eosio.token" 58 | }); 59 | 60 | var abiSerializer = new AbiSerializationProvider(DefaultApi); 61 | var abiObject = abiSerializer.DeserializePackedAbi(result.abi); 62 | } 63 | 64 | public async Task GetRawAbi() 65 | { 66 | var result = await DefaultApi.GetRawAbi(new GetRawAbiRequest() 67 | { 68 | account_name = "eosio.token" 69 | }); 70 | 71 | var abiSerializer = new AbiSerializationProvider(DefaultApi); 72 | var abiObject = abiSerializer.DeserializePackedAbi(result.abi); 73 | } 74 | 75 | public Task AbiJsonToBin() 76 | { 77 | return DefaultApi.AbiJsonToBin(new AbiJsonToBinRequest() { 78 | code = "eosio.token", 79 | action = "transfer", 80 | args = new Dictionary() { 81 | { "from", "eosio" }, 82 | { "to", "eosio.names" }, 83 | { "quantity", "1.0000 EOS" }, 84 | { "memo", "hello crypto world!" } 85 | } 86 | }); 87 | } 88 | 89 | public async Task AbiBinToJson() 90 | { 91 | var binArgsResult = await DefaultApi.AbiJsonToBin(new AbiJsonToBinRequest() 92 | { 93 | code = "eosio.token", 94 | action = "transfer", 95 | args = new Dictionary() { 96 | { "from", "eosio" }, 97 | { "to", "eosio.names" }, 98 | { "quantity", "1.0000 EOS" }, 99 | { "memo", "hello crypto world!" } 100 | } 101 | }); 102 | 103 | await DefaultApi.AbiBinToJson(new AbiBinToJsonRequest() 104 | { 105 | code = "eosio.token", 106 | action = "transfer", 107 | binargs = binArgsResult.binargs 108 | }); 109 | } 110 | 111 | public async Task GetRequiredKeys() 112 | { 113 | var getInfoResult = await DefaultApi.GetInfo(); 114 | var getBlockResult = await DefaultApi.GetBlock(new GetBlockRequest() 115 | { 116 | block_num_or_id = getInfoResult.last_irreversible_block_num.ToString() 117 | }); 118 | 119 | var trx = new Transaction() 120 | { 121 | //trx headers 122 | expiration = getInfoResult.head_block_time.AddSeconds(60), //expire Seconds 123 | ref_block_num = (UInt16)(getInfoResult.last_irreversible_block_num & 0xFFFF), 124 | ref_block_prefix = getBlockResult.ref_block_prefix, 125 | // trx info 126 | max_net_usage_words = 0, 127 | max_cpu_usage_ms = 0, 128 | delay_sec = 0, 129 | context_free_actions = new List(), 130 | actions = new List() 131 | { 132 | new Core.Api.v1.Action() 133 | { 134 | account = "eosio.token", 135 | authorization = new List() 136 | { 137 | new PermissionLevel() {actor = "tester112345", permission = "active" } 138 | }, 139 | name = "transfer", 140 | data = new Dictionary() { 141 | { "from", "tester112345" }, 142 | { "to", "tester212345" }, 143 | { "quantity", "1.0000 EOS" }, 144 | { "memo", "hello crypto world!" } 145 | } 146 | } 147 | }, 148 | transaction_extensions = new List() 149 | }; 150 | 151 | int actionIndex = 0; 152 | var abiSerializer = new AbiSerializationProvider(DefaultApi); 153 | var abiResponses = await abiSerializer.GetTransactionAbis(trx); 154 | 155 | foreach (var action in trx.context_free_actions) 156 | { 157 | action.data = SerializationHelper.ByteArrayToHexString(abiSerializer.SerializeActionData(action, abiResponses[actionIndex++])); 158 | } 159 | 160 | foreach (var action in trx.actions) 161 | { 162 | action.data = SerializationHelper.ByteArrayToHexString(abiSerializer.SerializeActionData(action, abiResponses[actionIndex++])); 163 | } 164 | 165 | var getRequiredResult = await DefaultApi.GetRequiredKeys(new GetRequiredKeysRequest() 166 | { 167 | available_keys = new List() { "EOS8Q8CJqwnSsV4A6HDBEqmQCqpQcBnhGME1RUvydDRnswNngpqfr" }, 168 | transaction = trx 169 | }); 170 | } 171 | 172 | public async Task GetBlock() 173 | { 174 | var getInfoResult = await DefaultApi.GetInfo(); 175 | var getBlockResult = await DefaultApi.GetBlock(new GetBlockRequest() 176 | { 177 | block_num_or_id = getInfoResult.last_irreversible_block_num.ToString() 178 | }); 179 | } 180 | 181 | public async Task GetBlockHeaderState() 182 | { 183 | var getInfoResult = await DefaultApi.GetInfo(); 184 | var result = await DefaultApi.GetBlockHeaderState(new GetBlockHeaderStateRequest() 185 | { 186 | block_num_or_id = getInfoResult.head_block_num.ToString() 187 | }); 188 | } 189 | 190 | public Task GetTableRows() 191 | { 192 | return DefaultApi.GetTableRows(new GetTableRowsRequest() 193 | { 194 | json = true, 195 | code = "eosio.token", 196 | scope = "EOS", 197 | table = "stat" 198 | }); 199 | } 200 | 201 | public Task GetTableByScope() 202 | { 203 | return DefaultApi.GetTableByScope(new GetTableByScopeRequest() 204 | { 205 | code = "eosio.token", 206 | table = "accounts" 207 | }); 208 | } 209 | 210 | public Task GetCurrencyBalance() 211 | { 212 | return DefaultApi.GetCurrencyBalance(new GetCurrencyBalanceRequest() 213 | { 214 | code = "eosio.token", 215 | account = "tester112345", 216 | symbol = "EOS" 217 | }); 218 | } 219 | 220 | public Task GetCurrencyStats() 221 | { 222 | return DefaultApi.GetCurrencyStats(new GetCurrencyStatsRequest() 223 | { 224 | code = "eosio.token", 225 | symbol = "EOS" 226 | }); 227 | } 228 | 229 | public Task GetProducers() 230 | { 231 | return DefaultApi.GetProducers(new GetProducersRequest() 232 | { 233 | json = false, 234 | }); 235 | } 236 | 237 | public Task GetProducerSchedule() 238 | { 239 | return DefaultApi.GetProducerSchedule(); 240 | } 241 | 242 | public Task GetScheduledTransactions() 243 | { 244 | return DefaultApi.GetScheduledTransactions(new GetScheduledTransactionsRequest() { 245 | json = true 246 | }); 247 | } 248 | 249 | public Task PushTransaction() 250 | { 251 | return CreateTransaction(); 252 | } 253 | 254 | public Task GetActions() 255 | { 256 | return DefaultApi.GetActions(new GetActionsRequest() { 257 | account_name = "eosio" 258 | }); 259 | } 260 | 261 | public async Task GetTransaction() 262 | { 263 | var trxResult = await CreateTransaction(); 264 | 265 | var result = await DefaultApi.GetTransaction(new GetTransactionRequest() 266 | { 267 | id = trxResult.transaction_id 268 | }); 269 | } 270 | 271 | public Task GetKeyAccounts() 272 | { 273 | return DefaultApi.GetKeyAccounts(new GetKeyAccountsRequest() 274 | { 275 | public_key = "EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV" 276 | }); 277 | } 278 | 279 | public Task GetControlledAccounts() 280 | { 281 | return DefaultApi.GetControlledAccounts(new GetControlledAccountsRequest() 282 | { 283 | controlling_account = "eosio" 284 | }); 285 | } 286 | 287 | private async Task CreateTransaction() 288 | { 289 | var getInfoResult = await DefaultApi.GetInfo(); 290 | var getBlockResult = await DefaultApi.GetBlock(new GetBlockRequest() 291 | { 292 | block_num_or_id = getInfoResult.last_irreversible_block_num.ToString() 293 | }); 294 | 295 | 296 | var trx = new Transaction() 297 | { 298 | //trx headers 299 | expiration = getInfoResult.head_block_time.AddSeconds(60), //expire Seconds 300 | ref_block_num = (UInt16)(getInfoResult.last_irreversible_block_num & 0xFFFF), 301 | ref_block_prefix = getBlockResult.ref_block_prefix, 302 | // trx info 303 | max_net_usage_words = 0, 304 | max_cpu_usage_ms = 0, 305 | delay_sec = 0, 306 | context_free_actions = new List(), 307 | transaction_extensions = new List(), 308 | actions = new List() 309 | { 310 | new Core.Api.v1.Action() 311 | { 312 | account = "eosio.token", 313 | authorization = new List() 314 | { 315 | new PermissionLevel() {actor = "player1", permission = "active" } 316 | }, 317 | name = "transfer", 318 | data = new Dictionary() { 319 | { "from", "player1" }, 320 | { "to", "player2" }, 321 | { "quantity", "1.0000 EOS" }, 322 | { "memo", "hello crypto world!" } 323 | } 324 | } 325 | } 326 | }; 327 | 328 | var abiSerializer = new AbiSerializationProvider(DefaultApi); 329 | var packedTrx = await abiSerializer.SerializePackedTransaction(trx); 330 | var requiredKeys = new List() { "EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV" }; 331 | var signatures = await EosConfig.SignProvider.Sign(DefaultApi.Config.ChainId, requiredKeys, packedTrx); 332 | 333 | return await DefaultApi.PushTransaction(new PushTransactionRequest() 334 | { 335 | signatures = signatures.ToArray(), 336 | compression = 0, 337 | packed_context_free_data = "", 338 | packed_trx = SerializationHelper.ByteArrayToHexString(packedTrx) 339 | }); 340 | } 341 | } 342 | } 343 | -------------------------------------------------------------------------------- /EosSharp/EosSharp.UnitTests.Core/EosSharp.UnitTests.Core.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netstandard2.0 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /EosSharp/EosSharp.UnitTests.Core/EosTestCasesDef.t4: -------------------------------------------------------------------------------- 1 | <#+ 2 | string[] ApiUnitTestCases = new string[] { 3 | "GetInfo", 4 | "GetAccount", 5 | "GetCode", 6 | "GetAbi", 7 | "GetRawCodeAndAbi", 8 | "GetRawAbi", 9 | "AbiJsonToBin", 10 | "AbiBinToJson", 11 | "GetRequiredKeys", 12 | "GetBlock", 13 | "GetBlockHeaderState", 14 | "GetTableRows", 15 | "GetTableByScope", 16 | "GetCurrencyBalance", 17 | "GetCurrencyStats", 18 | "GetProducers", 19 | "GetProducerSchedule", 20 | "GetScheduledTransactions", 21 | "PushTransaction", 22 | "GetActions", 23 | "GetTransaction", 24 | "GetKeyAccounts", 25 | "GetControlledAccounts" 26 | }; 27 | 28 | string[] EosUnitTestCases = new string[] { 29 | "GetBlock", 30 | "GetTableRows", 31 | "GetTableRowsGeneric", 32 | "GetProducers", 33 | "GetScheduledTransactions", 34 | "CreateTransactionArrayData", 35 | "CreateTransactionActionArrayStructData", 36 | "CreateTransactionAnonymousObjectData", 37 | "CreateTransaction", 38 | "CreateNewAccount" 39 | }; 40 | 41 | string[] SerializationUnitTestCases = new string[] { 42 | "DoubleSerialization", 43 | "DecimalSerialization" 44 | }; 45 | 46 | #> -------------------------------------------------------------------------------- /EosSharp/EosSharp.UnitTests.Core/EosUnitTestCases.cs: -------------------------------------------------------------------------------- 1 | using EosSharp.Core; 2 | using EosSharp.Core.Api.v1; 3 | using System; 4 | using System.Collections; 5 | using System.Collections.Generic; 6 | using System.Threading.Tasks; 7 | 8 | namespace EosSharp.UnitTests 9 | { 10 | public class EosUnitTestCases 11 | { 12 | EosBase Eos { get; set; } 13 | public EosUnitTestCases(EosBase eos) 14 | { 15 | Eos = eos; 16 | } 17 | 18 | public Task GetBlock() 19 | { 20 | return Eos.GetBlock("13503532"); 21 | } 22 | 23 | public Task GetTableRows() 24 | { 25 | return Eos.GetTableRows(new GetTableRowsRequest() 26 | { 27 | json = false, 28 | code = "eosio.token", 29 | scope = "EOS", 30 | table = "stat" 31 | }); 32 | } 33 | 34 | [Serializable] 35 | class Stat 36 | { 37 | public string issuer { get; set; } 38 | public string max_supply { get; set; } 39 | public string supply { get; set; } 40 | } 41 | 42 | public Task GetTableRowsGeneric() 43 | { 44 | return Eos.GetTableRows(new GetTableRowsRequest() 45 | { 46 | json = true, 47 | code = "eosio.token", 48 | scope = "EOS", 49 | table = "stat" 50 | }); 51 | } 52 | 53 | public Task GetProducers() 54 | { 55 | return Eos.GetProducers(new GetProducersRequest() 56 | { 57 | json = false 58 | }); 59 | } 60 | 61 | public Task GetScheduledTransactions() 62 | { 63 | return Eos.GetScheduledTransactions(new GetScheduledTransactionsRequest() 64 | { 65 | json = false 66 | }); 67 | } 68 | 69 | public Task CreateTransactionArrayData() 70 | { 71 | return Eos.CreateTransaction(new Transaction() 72 | { 73 | actions = new List() 74 | { 75 | new Core.Api.v1.Action() 76 | { 77 | account = "platform", 78 | authorization = new List() 79 | { 80 | new PermissionLevel() {actor = "player1", permission = "active" } 81 | }, 82 | name = "testarr", 83 | data = new { user = "player1", array = new List() { 1, 6, 3} } 84 | //data = new { user = "player1", array = new UInt64[] { 1, 6, 3} } 85 | //data = new { user = "player1", array = new Queue(new UInt64[] { 1, 6, 3}) } 86 | //data = new { user = "player1", array = new Stack(new UInt64[] { 1, 6, 3}) } 87 | //data = new { user = "player1", array = new ArrayList() { 1, 6, 3} } 88 | } 89 | } 90 | }); 91 | } 92 | 93 | public Task CreateTransactionActionArrayStructData() 94 | { 95 | var args = new List() 96 | { 97 | { 98 | new Dictionary() 99 | { 100 | { "air_id", Convert.ToUInt64("8") }, 101 | { "air_place", Convert.ToString("监测点8888") }, 102 | { "air_pm2_5", Convert.ToString("pm2.5数值") }, 103 | { "air_voc", Convert.ToString("voc数值") }, 104 | { "air_carbon", Convert.ToString("碳数值") }, 105 | { "air_nitrogen", Convert.ToString("氮数值") }, 106 | { "air_sulfur", Convert.ToString("硫数值") }, 107 | { "air_longitude", Convert.ToString("经度") }, 108 | { "air_latitude", Convert.ToString("纬度") } 109 | } 110 | } 111 | }; 112 | 113 | return Eos.CreateTransaction(new Transaction() 114 | { 115 | actions = new List() 116 | { 117 | new Core.Api.v1.Action() 118 | { 119 | account = "platform", 120 | authorization = new List() 121 | { 122 | new PermissionLevel() {actor = "player1", permission = "active" } 123 | }, 124 | name = "airquality", 125 | data = new { 126 | aql = args, 127 | a = args, 128 | b = args 129 | } 130 | } 131 | } 132 | }); 133 | } 134 | 135 | public Task CreateTransactionAnonymousObjectData() 136 | { 137 | return Eos.CreateTransaction(new Transaction() 138 | { 139 | actions = new List() 140 | { 141 | new Core.Api.v1.Action() 142 | { 143 | account = "eosio.token", 144 | authorization = new List() 145 | { 146 | new PermissionLevel() {actor = "tester112345", permission = "active" } 147 | }, 148 | name = "transfer", 149 | data = new { from = "tester112345", to = "tester212345", quantity = "0.0001 EOS", memo = "hello crypto world!" } 150 | } 151 | } 152 | }); 153 | } 154 | 155 | public Task CreateTransaction() 156 | { 157 | return Eos.CreateTransaction(new Transaction() 158 | { 159 | actions = new List() 160 | { 161 | new Core.Api.v1.Action() 162 | { 163 | account = "eosio.token", 164 | authorization = new List() 165 | { 166 | new PermissionLevel() {actor = "bensigbensig", permission = "active" } 167 | }, 168 | name = "transfer", 169 | data = new Dictionary() 170 | { 171 | { "from", "bensigbensig" }, 172 | { "to", "bluchain1234" }, 173 | { "quantity", "0.0001 EOS" }, 174 | { "memo", "hello crypto world!" } 175 | } 176 | } 177 | } 178 | }); 179 | } 180 | 181 | public Task CreateNewAccount() 182 | { 183 | return Eos.CreateTransaction(new Transaction() 184 | { 185 | actions = new List() 186 | { 187 | new Core.Api.v1.Action() 188 | { 189 | account = "eosio", 190 | authorization = new List() 191 | { 192 | new PermissionLevel() {actor = "tester112345", permission = "active"} 193 | }, 194 | name = "newaccount", 195 | data = new Dictionary() { 196 | { "creator", "tester112345" }, 197 | { "name", "mynewaccount" }, 198 | { "owner", new Dictionary() { 199 | { "threshold", 1 }, 200 | { "keys", new List() { 201 | new Dictionary() { 202 | { "key", "EOS8Q8CJqwnSsV4A6HDBEqmQCqpQcBnhGME1RUvydDRnswNngpqfr" }, 203 | { "weight", 1} 204 | } 205 | }}, 206 | { "accounts", new List() }, 207 | { "waits", new List() } 208 | }}, 209 | { "active", new Dictionary() { 210 | { "threshold", 1 }, 211 | { "keys", new List() { 212 | new Dictionary() { 213 | { "key", "EOS8Q8CJqwnSsV4A6HDBEqmQCqpQcBnhGME1RUvydDRnswNngpqfr" }, 214 | { "weight", 1} 215 | } 216 | }}, 217 | { "accounts", new List() }, 218 | { "waits", new List() } 219 | }} 220 | } 221 | }, 222 | new Core.Api.v1.Action() 223 | { 224 | account = "eosio", 225 | authorization = new List() 226 | { 227 | new PermissionLevel() { actor = "tester112345", permission = "active"} 228 | }, 229 | name = "buyrambytes", 230 | data = new Dictionary() { 231 | { "payer", "tester112345" }, 232 | { "receiver", "mynewaccount" }, 233 | { "bytes", 8192 }, 234 | } 235 | }, 236 | new Core.Api.v1.Action() 237 | { 238 | account = "eosio", 239 | authorization = new List() 240 | { 241 | new PermissionLevel() { actor = "tester112345", permission = "active"} 242 | }, 243 | name = "delegatebw", 244 | data = new Dictionary() { 245 | { "from", "tester112345" }, 246 | { "receiver", "mynewaccount" }, 247 | { "stake_net_quantity", "1.0000 EOS" }, 248 | { "stake_cpu_quantity", "1.0000 EOS" }, 249 | { "transfer", false }, 250 | } 251 | } 252 | } 253 | }); 254 | } 255 | 256 | public Task CreateTransaction2Providers() 257 | { 258 | return Eos.CreateTransaction(new Transaction() 259 | { 260 | actions = new List() 261 | { 262 | new Core.Api.v1.Action() 263 | { 264 | account = "eosio.token", 265 | authorization = new List() 266 | { 267 | new PermissionLevel() {actor = "lotustester2", permission = "active" }, 268 | new PermissionLevel() {actor = "lotustester1", permission = "active" } 269 | }, 270 | name = "transfer", 271 | data = new Dictionary() 272 | { 273 | { "from", "lotustester1" }, 274 | { "to", "lotustester2" }, 275 | { "quantity", "0.0001 EOS" }, 276 | { "memo", "hello crypto world! lt1 to lt2" } 277 | } 278 | } 279 | } 280 | }); 281 | } 282 | } 283 | } 284 | -------------------------------------------------------------------------------- /EosSharp/EosSharp.UnitTests.Core/SerializationUnitTestCases.cs: -------------------------------------------------------------------------------- 1 | using EosSharp.Core.Helpers; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | 6 | namespace EosSharp.UnitTests 7 | { 8 | public class SerializationUnitTestCases 9 | { 10 | public void DoubleSerialization() 11 | { 12 | string doubleStr = "10001"; 13 | var doubleBytes = SerializationHelper.DecimalToBinary(8, doubleStr); 14 | var doubleBytes2 = BitConverter.GetBytes(Convert.ToUInt64(doubleStr)); 15 | var doubleResStr = SerializationHelper.BinaryToDecimal(doubleBytes); 16 | } 17 | 18 | public void DecimalSerialization() 19 | { 20 | string decimalStr = "10001"; 21 | var decimalBytes = SerializationHelper.DecimalToBinary(16, decimalStr); 22 | 23 | Int32[] bits = decimal.GetBits(Convert.ToDecimal(decimalStr)); 24 | List bytes = new List(); 25 | foreach (Int32 i in bits) 26 | { 27 | bytes.AddRange(BitConverter.GetBytes(i)); 28 | } 29 | var decimalBytes2 = bytes.ToArray(); 30 | 31 | var decimalResStr = SerializationHelper.BinaryToDecimal(decimalBytes); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /EosSharp/EosSharp.UnitTests.Unity3D/ApiUnitTests.tt: -------------------------------------------------------------------------------- 1 | <#@ template debug="false" hostspecific="false" language="C#" #> 2 | <#@ assembly name="System.Core" #> 3 | <#@ import namespace="System.Globalization" #> 4 | <#@ include file=".\..\EosSharp.UnitTests.Core\EosTestCasesDef.t4" #> 5 | <#@ output extension=".cs" #> 6 | // Auto Generated, do not edit. 7 | using EosSharp.Core; 8 | using EosSharp.Core.Api.v1; 9 | using EosSharp.Core.Providers; 10 | using EosSharp.Unity3D; 11 | using Newtonsoft.Json; 12 | using System; 13 | using System.Threading.Tasks; 14 | 15 | namespace EosSharp.UnitTests.Unity3D 16 | { 17 | public class ApiUnitTests 18 | { 19 | ApiUnitTestCases ApiUnitTestCases; 20 | public ApiUnitTests() 21 | { 22 | var eosConfig = new EosConfigurator() 23 | { 24 | SignProvider = new DefaultSignProvider("5K57oSZLpfzePvQNpsLS6NfKXLhhRARNU13q6u2ZPQCGHgKLbTA"), 25 | 26 | //HttpEndpoint = "https://nodes.eos42.io", //Mainnet 27 | //ChainId = "aca376f206b8fc25a6ed44dbdc66547c36c6c33e3a119ffbeaef943642f0e906" 28 | 29 | HttpEndpoint = "https://nodeos01.btuga.io", 30 | ChainId = "cf057bbfb72640471fd910bcb67639c22df9f92470936cddc1ade0e2f2e7dc4f" 31 | }; 32 | var eosApi = new EosApi(eosConfig, new HttpHandler()); 33 | 34 | ApiUnitTestCases = new ApiUnitTestCases(eosConfig, eosApi); 35 | } 36 | 37 | <# foreach (var tc in ApiUnitTestCases) { #> 38 | public async Task <#= tc #>() 39 | { 40 | bool success = false; 41 | try 42 | { 43 | await ApiUnitTestCases.<#= tc #>(); 44 | success = true; 45 | } 46 | catch (Exception ex) 47 | { 48 | Console.WriteLine(JsonConvert.SerializeObject(ex)); 49 | } 50 | 51 | if(success) 52 | Console.WriteLine("Test <#= tc #> run successfuly."); 53 | else 54 | Console.WriteLine("Test <#= tc #> run failed."); 55 | } 56 | <# } #> 57 | 58 | public async Task TestAll() 59 | { 60 | <# foreach (var tc in ApiUnitTestCases) { #> 61 | await <#= tc #>(); 62 | <# } #> 63 | } 64 | } 65 | } -------------------------------------------------------------------------------- /EosSharp/EosSharp.UnitTests.Unity3D/EosSharp.UnitTests.Unity3D.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netstandard2.0 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | ApiUnitTests.tt 22 | True 23 | True 24 | 25 | 26 | EosUnitTests.tt 27 | True 28 | True 29 | 30 | 31 | SerializationUnitTests.tt 32 | True 33 | True 34 | 35 | 36 | 37 | 38 | 39 | ApiUnitTests.cs 40 | TextTemplatingFileGenerator 41 | 42 | 43 | EosUnitTests.cs 44 | TextTemplatingFileGenerator 45 | 46 | 47 | SerializationUnitTests.cs 48 | TextTemplatingFileGenerator 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /EosSharp/EosSharp.UnitTests.Unity3D/EosUnitTests.cs: -------------------------------------------------------------------------------- 1 | // Auto Generated, do not edit. 2 | using EosSharp.Core; 3 | using EosSharp.Core.Api.v1; 4 | using EosSharp.Core.Providers; 5 | using EosSharp.Unity3D; 6 | using Newtonsoft.Json; 7 | using System; 8 | using System.Threading.Tasks; 9 | 10 | namespace EosSharp.UnitTests.Unity3D 11 | { 12 | public class EosUnitTests 13 | { 14 | EosUnitTestCases EosUnitTestCases; 15 | public EosUnitTests() 16 | { 17 | var eosConfig = new EosConfigurator() 18 | { 19 | SignProvider = new DefaultSignProvider("5K57oSZLpfzePvQNpsLS6NfKXLhhRARNU13q6u2ZPQCGHgKLbTA"), 20 | 21 | //HttpEndpoint = "https://nodes.eos42.io", //Mainnet 22 | //ChainId = "aca376f206b8fc25a6ed44dbdc66547c36c6c33e3a119ffbeaef943642f0e906" 23 | 24 | HttpEndpoint = "https://nodeos01.btuga.io", 25 | ChainId = "cf057bbfb72640471fd910bcb67639c22df9f92470936cddc1ade0e2f2e7dc4f" 26 | }; 27 | var eosApi = new EosApi(eosConfig, new HttpHandler()); 28 | 29 | EosUnitTestCases = new EosUnitTestCases(new Eos(eosConfig)); 30 | } 31 | public async Task GetBlock() 32 | { 33 | bool success = false; 34 | try 35 | { 36 | await EosUnitTestCases.GetBlock(); 37 | success = true; 38 | } 39 | catch (Exception ex) 40 | { 41 | Console.WriteLine(JsonConvert.SerializeObject(ex)); 42 | } 43 | 44 | if(success) 45 | Console.WriteLine("Test GetBlock run successfuly."); 46 | else 47 | Console.WriteLine("Test GetBlock run failed."); 48 | } 49 | public async Task GetTableRows() 50 | { 51 | bool success = false; 52 | try 53 | { 54 | await EosUnitTestCases.GetTableRows(); 55 | success = true; 56 | } 57 | catch (Exception ex) 58 | { 59 | Console.WriteLine(JsonConvert.SerializeObject(ex)); 60 | } 61 | 62 | if(success) 63 | Console.WriteLine("Test GetTableRows run successfuly."); 64 | else 65 | Console.WriteLine("Test GetTableRows run failed."); 66 | } 67 | public async Task GetTableRowsGeneric() 68 | { 69 | bool success = false; 70 | try 71 | { 72 | await EosUnitTestCases.GetTableRowsGeneric(); 73 | success = true; 74 | } 75 | catch (Exception ex) 76 | { 77 | Console.WriteLine(JsonConvert.SerializeObject(ex)); 78 | } 79 | 80 | if(success) 81 | Console.WriteLine("Test GetTableRowsGeneric run successfuly."); 82 | else 83 | Console.WriteLine("Test GetTableRowsGeneric run failed."); 84 | } 85 | public async Task GetProducers() 86 | { 87 | bool success = false; 88 | try 89 | { 90 | await EosUnitTestCases.GetProducers(); 91 | success = true; 92 | } 93 | catch (Exception ex) 94 | { 95 | Console.WriteLine(JsonConvert.SerializeObject(ex)); 96 | } 97 | 98 | if(success) 99 | Console.WriteLine("Test GetProducers run successfuly."); 100 | else 101 | Console.WriteLine("Test GetProducers run failed."); 102 | } 103 | public async Task GetScheduledTransactions() 104 | { 105 | bool success = false; 106 | try 107 | { 108 | await EosUnitTestCases.GetScheduledTransactions(); 109 | success = true; 110 | } 111 | catch (Exception ex) 112 | { 113 | Console.WriteLine(JsonConvert.SerializeObject(ex)); 114 | } 115 | 116 | if(success) 117 | Console.WriteLine("Test GetScheduledTransactions run successfuly."); 118 | else 119 | Console.WriteLine("Test GetScheduledTransactions run failed."); 120 | } 121 | public async Task CreateTransactionArrayData() 122 | { 123 | bool success = false; 124 | try 125 | { 126 | await EosUnitTestCases.CreateTransactionArrayData(); 127 | success = true; 128 | } 129 | catch (Exception ex) 130 | { 131 | Console.WriteLine(JsonConvert.SerializeObject(ex)); 132 | } 133 | 134 | if(success) 135 | Console.WriteLine("Test CreateTransactionArrayData run successfuly."); 136 | else 137 | Console.WriteLine("Test CreateTransactionArrayData run failed."); 138 | } 139 | public async Task CreateTransactionActionArrayStructData() 140 | { 141 | bool success = false; 142 | try 143 | { 144 | await EosUnitTestCases.CreateTransactionActionArrayStructData(); 145 | success = true; 146 | } 147 | catch (Exception ex) 148 | { 149 | Console.WriteLine(JsonConvert.SerializeObject(ex)); 150 | } 151 | 152 | if(success) 153 | Console.WriteLine("Test CreateTransactionActionArrayStructData run successfuly."); 154 | else 155 | Console.WriteLine("Test CreateTransactionActionArrayStructData run failed."); 156 | } 157 | public async Task CreateTransactionAnonymousObjectData() 158 | { 159 | bool success = false; 160 | try 161 | { 162 | await EosUnitTestCases.CreateTransactionAnonymousObjectData(); 163 | success = true; 164 | } 165 | catch (Exception ex) 166 | { 167 | Console.WriteLine(JsonConvert.SerializeObject(ex)); 168 | } 169 | 170 | if(success) 171 | Console.WriteLine("Test CreateTransactionAnonymousObjectData run successfuly."); 172 | else 173 | Console.WriteLine("Test CreateTransactionAnonymousObjectData run failed."); 174 | } 175 | public async Task CreateTransaction() 176 | { 177 | bool success = false; 178 | try 179 | { 180 | await EosUnitTestCases.CreateTransaction(); 181 | success = true; 182 | } 183 | catch (Exception ex) 184 | { 185 | Console.WriteLine(JsonConvert.SerializeObject(ex)); 186 | } 187 | 188 | if(success) 189 | Console.WriteLine("Test CreateTransaction run successfuly."); 190 | else 191 | Console.WriteLine("Test CreateTransaction run failed."); 192 | } 193 | public async Task CreateNewAccount() 194 | { 195 | bool success = false; 196 | try 197 | { 198 | await EosUnitTestCases.CreateNewAccount(); 199 | success = true; 200 | } 201 | catch (Exception ex) 202 | { 203 | Console.WriteLine(JsonConvert.SerializeObject(ex)); 204 | } 205 | 206 | if(success) 207 | Console.WriteLine("Test CreateNewAccount run successfuly."); 208 | else 209 | Console.WriteLine("Test CreateNewAccount run failed."); 210 | } 211 | public async Task CreateTransaction2Providers() 212 | { 213 | bool success = false; 214 | try 215 | { 216 | await EosUnitTestCases.CreateTransaction2Providers(); 217 | success = true; 218 | } 219 | catch (Exception ex) 220 | { 221 | Console.WriteLine(JsonConvert.SerializeObject(ex)); 222 | } 223 | 224 | if(success) 225 | Console.WriteLine("Test CreateTransaction2Providers run successfuly."); 226 | else 227 | Console.WriteLine("Test CreateTransaction2Providers run failed."); 228 | } 229 | 230 | public async Task TestAll() 231 | { 232 | await GetBlock(); 233 | await GetTableRows(); 234 | await GetTableRowsGeneric(); 235 | await GetProducers(); 236 | await GetScheduledTransactions(); 237 | await CreateTransactionArrayData(); 238 | await CreateTransactionActionArrayStructData(); 239 | await CreateTransactionAnonymousObjectData(); 240 | await CreateTransaction(); 241 | await CreateNewAccount(); 242 | await CreateTransaction2Providers(); 243 | } 244 | } 245 | } -------------------------------------------------------------------------------- /EosSharp/EosSharp.UnitTests.Unity3D/EosUnitTests.tt: -------------------------------------------------------------------------------- 1 | <#@ template debug="false" hostspecific="false" language="C#" #> 2 | <#@ assembly name="System.Core" #> 3 | <#@ import namespace="System.Globalization" #> 4 | <#@ include file=".\..\EosSharp.UnitTests.Core\EosTestCasesDef.t4" #> 5 | <#@ output extension=".cs" #> 6 | // Auto Generated, do not edit. 7 | using EosSharp.Core; 8 | using EosSharp.Core.Api.v1; 9 | using EosSharp.Core.Providers; 10 | using EosSharp.Unity3D; 11 | using Newtonsoft.Json; 12 | using System; 13 | using System.Threading.Tasks; 14 | 15 | namespace EosSharp.UnitTests.Unity3D 16 | { 17 | public class EosUnitTests 18 | { 19 | EosUnitTestCases EosUnitTestCases; 20 | public EosUnitTests() 21 | { 22 | var eosConfig = new EosConfigurator() 23 | { 24 | SignProvider = new DefaultSignProvider("5K57oSZLpfzePvQNpsLS6NfKXLhhRARNU13q6u2ZPQCGHgKLbTA"), 25 | 26 | //HttpEndpoint = "https://nodes.eos42.io", //Mainnet 27 | //ChainId = "aca376f206b8fc25a6ed44dbdc66547c36c6c33e3a119ffbeaef943642f0e906" 28 | 29 | HttpEndpoint = "https://nodeos01.btuga.io", 30 | ChainId = "cf057bbfb72640471fd910bcb67639c22df9f92470936cddc1ade0e2f2e7dc4f" 31 | }; 32 | var eosApi = new EosApi(eosConfig, new HttpHandler()); 33 | 34 | EosUnitTestCases = new EosUnitTestCases(new Eos(eosConfig)); 35 | } 36 | <# foreach (var tc in EosUnitTestCases) { #> 37 | public async Task <#= tc #>() 38 | { 39 | bool success = false; 40 | try 41 | { 42 | await EosUnitTestCases.<#= tc #>(); 43 | success = true; 44 | } 45 | catch (Exception ex) 46 | { 47 | Console.WriteLine(JsonConvert.SerializeObject(ex)); 48 | } 49 | 50 | if(success) 51 | Console.WriteLine("Test <#= tc #> run successfuly."); 52 | else 53 | Console.WriteLine("Test <#= tc #> run failed."); 54 | } 55 | <# } #> 56 | 57 | public async Task TestAll() 58 | { 59 | <# foreach (var tc in EosUnitTestCases) { #> 60 | await <#= tc #>(); 61 | <# } #> 62 | } 63 | } 64 | } -------------------------------------------------------------------------------- /EosSharp/EosSharp.UnitTests.Unity3D/SerializationUnitTests.cs: -------------------------------------------------------------------------------- 1 | // Auto Generated, do not edit. 2 | using Newtonsoft.Json; 3 | using System; 4 | 5 | namespace EosSharp.UnitTests.Unity3D 6 | { 7 | public class SerializationUnitTests 8 | { 9 | SerializationUnitTestCases SerializationUnitTestCases; 10 | public SerializationUnitTests() 11 | { 12 | SerializationUnitTestCases = new SerializationUnitTestCases(); 13 | } 14 | 15 | public void DoubleSerialization() 16 | { 17 | bool success = false; 18 | try 19 | { 20 | SerializationUnitTestCases.DoubleSerialization(); 21 | success = true; 22 | } 23 | catch (Exception ex) 24 | { 25 | Console.WriteLine(JsonConvert.SerializeObject(ex)); 26 | } 27 | 28 | if(success) 29 | Console.WriteLine("Test DoubleSerialization run successfuly."); 30 | else 31 | Console.WriteLine("Test DoubleSerialization run failed."); 32 | } 33 | public void DecimalSerialization() 34 | { 35 | bool success = false; 36 | try 37 | { 38 | SerializationUnitTestCases.DecimalSerialization(); 39 | success = true; 40 | } 41 | catch (Exception ex) 42 | { 43 | Console.WriteLine(JsonConvert.SerializeObject(ex)); 44 | } 45 | 46 | if(success) 47 | Console.WriteLine("Test DecimalSerialization run successfuly."); 48 | else 49 | Console.WriteLine("Test DecimalSerialization run failed."); 50 | } 51 | 52 | public void TestAll() 53 | { 54 | DoubleSerialization(); 55 | DecimalSerialization(); 56 | } 57 | } 58 | } -------------------------------------------------------------------------------- /EosSharp/EosSharp.UnitTests.Unity3D/SerializationUnitTests.tt: -------------------------------------------------------------------------------- 1 | <#@ template debug="false" hostspecific="false" language="C#" #> 2 | <#@ assembly name="System.Core" #> 3 | <#@ import namespace="System.Globalization" #> 4 | <#@ include file=".\..\EosSharp.UnitTests.Core\EosTestCasesDef.t4" #> 5 | <#@ output extension=".cs" #> 6 | // Auto Generated, do not edit. 7 | using Newtonsoft.Json; 8 | using System; 9 | 10 | namespace EosSharp.UnitTests.Unity3D 11 | { 12 | public class SerializationUnitTests 13 | { 14 | SerializationUnitTestCases SerializationUnitTestCases; 15 | public SerializationUnitTests() 16 | { 17 | SerializationUnitTestCases = new SerializationUnitTestCases(); 18 | } 19 | 20 | <# foreach (var tc in SerializationUnitTestCases) { #> 21 | public void <#= tc #>() 22 | { 23 | bool success = false; 24 | try 25 | { 26 | SerializationUnitTestCases.<#= tc #>(); 27 | success = true; 28 | } 29 | catch (Exception ex) 30 | { 31 | Console.WriteLine(JsonConvert.SerializeObject(ex)); 32 | } 33 | 34 | if(success) 35 | Console.WriteLine("Test <#= tc #> run successfuly."); 36 | else 37 | Console.WriteLine("Test <#= tc #> run failed."); 38 | } 39 | <# } #> 40 | 41 | public void TestAll() 42 | { 43 | <# foreach (var tc in SerializationUnitTestCases) { #> 44 | <#= tc #>(); 45 | <# } #> 46 | } 47 | } 48 | } -------------------------------------------------------------------------------- /EosSharp/EosSharp.UnitTests.Unity3D/SignUnitTests.cs: -------------------------------------------------------------------------------- 1 | using EosSharp.Core; 2 | using EosSharp.Core.Api.v1; 3 | using EosSharp.Core.Helpers; 4 | using EosSharp.Core.Providers; 5 | using EosSharp.Unity3D; 6 | using Newtonsoft.Json; 7 | using System; 8 | using System.Collections.Generic; 9 | using System.Linq; 10 | using System.Text; 11 | using System.Threading.Tasks; 12 | 13 | namespace EosSharp.UnitTests.Unity3D 14 | { 15 | public class SignUnitTests 16 | { 17 | readonly EosConfigurator EosConfig = null; 18 | EosApi DefaultApi { get; set; } 19 | public SignUnitTests() 20 | { 21 | EosConfig = new EosConfigurator() 22 | { 23 | SignProvider = new DefaultSignProvider("5K57oSZLpfzePvQNpsLS6NfKXLhhRARNU13q6u2ZPQCGHgKLbTA"), 24 | 25 | //HttpEndpoint = "https://nodes.eos42.io", //Mainnet 26 | //ChainId = "aca376f206b8fc25a6ed44dbdc66547c36c6c33e3a119ffbeaef943642f0e906" 27 | 28 | HttpEndpoint = "https://nodeos01.btuga.io", 29 | ChainId = "cf057bbfb72640471fd910bcb67639c22df9f92470936cddc1ade0e2f2e7dc4f" 30 | }; 31 | DefaultApi = new EosApi(EosConfig, new HttpHandler()); 32 | } 33 | 34 | public void GenerateKeyPair() 35 | { 36 | Console.WriteLine(JsonConvert.SerializeObject(CryptoHelper.GenerateKeyPair("R1"))); 37 | Console.WriteLine(JsonConvert.SerializeObject(CryptoHelper.GenerateKeyPair())); 38 | } 39 | 40 | public void Base64ToByteArray() 41 | { 42 | string base64EncodedData = "DmVvc2lvOjphYmkvMS4wAQxhY2NvdW50X25hbWUEbmFtZQcIdHJhbnNmZXIABARmcm9tDGFjY291bnRfbmFtZQJ0bwxhY2NvdW50X25hbWUIcXVhbnRpdHkFYXNzZXQEbWVtbwZzdHJpbmcGY3JlYXRlAAIGaXNzdWVyDGFjY291bnRfbmFtZQ5tYXhpbXVtX3N1cHBseQVhc3NldAVpc3N1ZQADAnRvDGFjY291bnRfbmFtZQhxdWFudGl0eQVhc3NldARtZW1vBnN0cmluZwZyZXRpcmUAAghxdWFudGl0eQVhc3NldARtZW1vBnN0cmluZwVjbG9zZQACBW93bmVyDGFjY291bnRfbmFtZQZzeW1ib2wGc3ltYm9sB2FjY291bnQAAQdiYWxhbmNlBWFzc2V0DmN1cnJlbmN5X3N0YXRzAAMGc3VwcGx5BWFzc2V0Cm1heF9zdXBwbHkFYXNzZXQGaXNzdWVyDGFjY291bnRfbmFtZQUAAABXLTzNzQh0cmFuc2ZlcucFIyMgVHJhbnNmZXIgVGVybXMgJiBDb25kaXRpb25zCgpJLCB7e2Zyb219fSwgY2VydGlmeSB0aGUgZm9sbG93aW5nIHRvIGJlIHRydWUgdG8gdGhlIGJlc3Qgb2YgbXkga25vd2xlZGdlOgoKMS4gSSBjZXJ0aWZ5IHRoYXQge3txdWFudGl0eX19IGlzIG5vdCB0aGUgcHJvY2VlZHMgb2YgZnJhdWR1bGVudCBvciB2aW9sZW50IGFjdGl2aXRpZXMuCjIuIEkgY2VydGlmeSB0aGF0LCB0byB0aGUgYmVzdCBvZiBteSBrbm93bGVkZ2UsIHt7dG99fSBpcyBub3Qgc3VwcG9ydGluZyBpbml0aWF0aW9uIG9mIHZpb2xlbmNlIGFnYWluc3Qgb3RoZXJzLgozLiBJIGhhdmUgZGlzY2xvc2VkIGFueSBjb250cmFjdHVhbCB0ZXJtcyAmIGNvbmRpdGlvbnMgd2l0aCByZXNwZWN0IHRvIHt7cXVhbnRpdHl9fSB0byB7e3RvfX0uCgpJIHVuZGVyc3RhbmQgdGhhdCBmdW5kcyB0cmFuc2ZlcnMgYXJlIG5vdCByZXZlcnNpYmxlIGFmdGVyIHRoZSB7e3RyYW5zYWN0aW9uLmRlbGF5fX0gc2Vjb25kcyBvciBvdGhlciBkZWxheSBhcyBjb25maWd1cmVkIGJ5IHt7ZnJvbX19J3MgcGVybWlzc2lvbnMuCgpJZiB0aGlzIGFjdGlvbiBmYWlscyB0byBiZSBpcnJldmVyc2libHkgY29uZmlybWVkIGFmdGVyIHJlY2VpdmluZyBnb29kcyBvciBzZXJ2aWNlcyBmcm9tICd7e3RvfX0nLCBJIGFncmVlIHRvIGVpdGhlciByZXR1cm4gdGhlIGdvb2RzIG9yIHNlcnZpY2VzIG9yIHJlc2VuZCB7e3F1YW50aXR5fX0gaW4gYSB0aW1lbHkgbWFubmVyLgoAAAAAAKUxdgVpc3N1ZQAAAAAAqGzURQZjcmVhdGUAAAAAAKjrsroGcmV0aXJlAAAAAAAAhWlEBWNsb3NlAAIAAAA4T00RMgNpNjQBCGN1cnJlbmN5AQZ1aW50NjQHYWNjb3VudAAAAAAAkE3GA2k2NAEIY3VycmVuY3kBBnVpbnQ2NA5jdXJyZW5jeV9zdGF0cwAAAA==="; 43 | var base64EncodedBytes = SerializationHelper.Base64FcStringToByteArray(base64EncodedData); 44 | } 45 | 46 | public async Task SignProvider() 47 | { 48 | var signProvider = new DefaultSignProvider("5K57oSZLpfzePvQNpsLS6NfKXLhhRARNU13q6u2ZPQCGHgKLbTA"); 49 | var requiredKeys = new List() { "EOS8Q8CJqwnSsV4A6HDBEqmQCqpQcBnhGME1RUvydDRnswNngpqfr" }; 50 | 51 | if ((await signProvider.GetAvailableKeys()).All(ak => requiredKeys.Contains(ak))) 52 | Console.WriteLine("Test SignProvider run successfuly."); 53 | else 54 | Console.WriteLine("Test SignProvider run failed."); 55 | } 56 | 57 | public async Task SignHelloWorld() 58 | { 59 | var requiredKeys = new List() { "EOS8Q8CJqwnSsV4A6HDBEqmQCqpQcBnhGME1RUvydDRnswNngpqfr" }; 60 | var helloBytes = Encoding.UTF8.GetBytes("Hello world!"); 61 | var signatures = await EosConfig.SignProvider.Sign(DefaultApi.Config.ChainId, requiredKeys, helloBytes); 62 | 63 | if (signatures.First() == "SIG_K1_JxtwrzV246xdAgqgH36oX5MjMeg1sEFdUWuwnE9Fhr9eqi5JzgmKXm9UEJgNZMLYdnZhphL1QmE8aW7rTDPC8k8acvkoMR") 64 | Console.WriteLine("Test SignHelloWorld run successfuly."); 65 | else 66 | Console.WriteLine("Test SignHelloWorld run failed."); 67 | } 68 | 69 | public async Task SignTransaction() 70 | { 71 | bool success = false; 72 | try 73 | { 74 | var trx = new Transaction() 75 | { 76 | // trx info 77 | max_net_usage_words = 0, 78 | max_cpu_usage_ms = 0, 79 | delay_sec = 0, 80 | context_free_actions = new List(), 81 | transaction_extensions = new List(), 82 | actions = new List() 83 | { 84 | new Core.Api.v1.Action() 85 | { 86 | account = "eosio.token", 87 | authorization = new List() 88 | { 89 | new PermissionLevel() {actor = "tester112345", permission = "active" } 90 | }, 91 | name = "transfer", 92 | data = new Dictionary() 93 | { 94 | { "from", "tester112345" }, 95 | { "to", "tester212345" }, 96 | { "quantity", "0.0001 EOS" }, 97 | { "memo", "hello crypto world!" } 98 | } 99 | } 100 | } 101 | }; 102 | 103 | var abiSerializer = new AbiSerializationProvider(DefaultApi); 104 | var packedTrx = await abiSerializer.SerializePackedTransaction(trx); 105 | var requiredKeys = new List() { "EOS8Q8CJqwnSsV4A6HDBEqmQCqpQcBnhGME1RUvydDRnswNngpqfr" }; 106 | var signatures = await EosConfig.SignProvider.Sign(DefaultApi.Config.ChainId, requiredKeys, packedTrx); 107 | 108 | success = signatures.First() == "SIG_K1_Jze1PGnAo9MVHkxRxekZQKJebM11AgtK4NhsFtDEZsLujrocvJ5dnhejyr9RQji2K3DWdyUpM9BGyWts7FFr8Wib95hiTj"; 109 | } 110 | catch (Exception ex) 111 | { 112 | Console.WriteLine(JsonConvert.SerializeObject(ex)); 113 | } 114 | 115 | if (success) 116 | Console.WriteLine("Test SignTransaction run successfuly."); 117 | else 118 | Console.WriteLine("Test SignTransaction run failed."); 119 | } 120 | 121 | public async Task TestAll() 122 | { 123 | await SignProvider(); 124 | await SignHelloWorld(); 125 | await SignTransaction(); 126 | } 127 | } 128 | } 129 | -------------------------------------------------------------------------------- /EosSharp/EosSharp.UnitTests.Unity3D/StressUnitTests.cs: -------------------------------------------------------------------------------- 1 | using EosSharp.Core; 2 | using EosSharp.Core.Providers; 3 | using EosSharp.Unity3D; 4 | using Newtonsoft.Json; 5 | using System; 6 | using System.Collections.Generic; 7 | using System.Threading.Tasks; 8 | 9 | namespace EosSharp.UnitTests.Unity3D 10 | { 11 | public class StressUnitTests 12 | { 13 | Eos Eos { get; set; } 14 | public StressUnitTests() 15 | { 16 | Eos = new Eos(new EosConfigurator() 17 | { 18 | SignProvider = new DefaultSignProvider("5K57oSZLpfzePvQNpsLS6NfKXLhhRARNU13q6u2ZPQCGHgKLbTA"), 19 | 20 | HttpEndpoint = "https://api.eossweden.se", //Mainnet 21 | ChainId = "aca376f206b8fc25a6ed44dbdc66547c36c6c33e3a119ffbeaef943642f0e906" 22 | 23 | //HttpEndpoint = "https://nodeos01.btuga.io", 24 | //ChainId = "cf057bbfb72640471fd910bcb67639c22df9f92470936cddc1ade0e2f2e7dc4f" 25 | }); 26 | } 27 | 28 | public async Task GetBlockTaskLoop() 29 | { 30 | bool success = false; 31 | int nrTasks = 50; 32 | int nrBlocks = 1000; 33 | int blockStartPos = 100; 34 | int taskBlocks = nrBlocks / nrTasks; 35 | 36 | try 37 | { 38 | List tasks = new List(); 39 | 40 | for (int i = 0; i < nrTasks; i++) 41 | { 42 | for (int j = 1; j <= taskBlocks; j++) 43 | { 44 | try 45 | { 46 | await Eos.GetBlock((i * taskBlocks + blockStartPos + j).ToString()); 47 | } 48 | catch (Exception ex) 49 | { 50 | Console.WriteLine(JsonConvert.SerializeObject(ex)); 51 | } 52 | } 53 | } 54 | 55 | await Task.WhenAll(tasks.ToArray()); 56 | 57 | success = true; 58 | } 59 | catch (Exception ex) 60 | { 61 | Console.WriteLine(JsonConvert.SerializeObject(ex)); 62 | } 63 | 64 | if (success) 65 | Console.WriteLine("Test GetBlockTaskLoop run successfuly."); 66 | else 67 | Console.WriteLine("Test GetBlockTaskLoop run failed."); 68 | } 69 | 70 | public async Task TestAll() 71 | { 72 | //TODO disabled for now because of CORS policy blocked in localhost 73 | //await GetBlockTaskLoop(); 74 | await Task.FromResult(0); 75 | } 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /EosSharp/EosSharp.UnitTests.Unity3D/UnityTester/Assets/Plugins.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: df467aa2cb4274149bd32ddea1e96e99 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /EosSharp/EosSharp.UnitTests.Unity3D/UnityTester/Assets/Scenes.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8734696c225819646b9f975cf10af64c 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /EosSharp/EosSharp.UnitTests.Unity3D/UnityTester/Assets/Scenes/SampleScene.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 621e2cbb5e258fd4f9674d8e495660ac 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /EosSharp/EosSharp.UnitTests.Unity3D/UnityTester/Assets/Scenes/Scripts.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 20d4469e0dd48354db160ea0275cba33 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /EosSharp/EosSharp.UnitTests.Unity3D/UnityTester/Assets/Scenes/Scripts/UnitTestsScript.cs: -------------------------------------------------------------------------------- 1 | using EosSharp.UnitTests.Unity3D; 2 | using Newtonsoft.Json; 3 | using System; 4 | using UnityEngine; 5 | 6 | public class UnitTestsScript : MonoBehaviour 7 | { 8 | public async void UnitTestAll() 9 | { 10 | try 11 | { 12 | ApiUnitTests autc = new ApiUnitTests(); 13 | await autc.TestAll(); 14 | 15 | EosUnitTests eut = new EosUnitTests(); 16 | await eut.TestAll(); 17 | 18 | SerializationUnitTests sut = new SerializationUnitTests(); 19 | sut.TestAll(); 20 | 21 | SignUnitTests signUnitTests = new SignUnitTests(); 22 | await signUnitTests.TestAll(); 23 | 24 | StressUnitTests stressUnitTests = new StressUnitTests(); 25 | await stressUnitTests.TestAll(); 26 | } 27 | catch (Exception ex) 28 | { 29 | print(JsonConvert.SerializeObject(ex)); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /EosSharp/EosSharp.UnitTests.Unity3D/UnityTester/Assets/Scenes/Scripts/UnitTestsScript.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f12df905f1e00714eb53d8685af878de 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /EosSharp/EosSharp.UnitTests.Unity3D/UnityTester/Assets/gs_home_devs_streamlined.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GetScatter/eos-sharp/32bca8879a778a58c9f44315475d18e63c7c76e1/EosSharp/EosSharp.UnitTests.Unity3D/UnityTester/Assets/gs_home_devs_streamlined.png -------------------------------------------------------------------------------- /EosSharp/EosSharp.UnitTests.Unity3D/UnityTester/Assets/gs_home_devs_streamlined.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c4b0d10a67912b44586f7aab127dd3f2 3 | TextureImporter: 4 | fileIDToRecycleName: {} 5 | externalObjects: {} 6 | serializedVersion: 7 7 | mipmaps: 8 | mipMapMode: 0 9 | enableMipMap: 1 10 | sRGBTexture: 1 11 | linearTexture: 0 12 | fadeOut: 0 13 | borderMipMap: 0 14 | mipMapsPreserveCoverage: 0 15 | alphaTestReferenceValue: 0.5 16 | mipMapFadeDistanceStart: 1 17 | mipMapFadeDistanceEnd: 3 18 | bumpmap: 19 | convertToNormalMap: 0 20 | externalNormalMap: 0 21 | heightScale: 0.25 22 | normalMapFilter: 0 23 | isReadable: 0 24 | streamingMipmaps: 0 25 | streamingMipmapsPriority: 0 26 | grayScaleToAlpha: 0 27 | generateCubemap: 6 28 | cubemapConvolution: 0 29 | seamlessCubemap: 0 30 | textureFormat: 1 31 | maxTextureSize: 2048 32 | textureSettings: 33 | serializedVersion: 2 34 | filterMode: -1 35 | aniso: -1 36 | mipBias: -100 37 | wrapU: -1 38 | wrapV: -1 39 | wrapW: -1 40 | nPOTScale: 1 41 | lightmap: 0 42 | compressionQuality: 50 43 | spriteMode: 0 44 | spriteExtrude: 1 45 | spriteMeshType: 1 46 | alignment: 0 47 | spritePivot: {x: 0.5, y: 0.5} 48 | spritePixelsToUnits: 100 49 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 50 | spriteGenerateFallbackPhysicsShape: 1 51 | alphaUsage: 1 52 | alphaIsTransparency: 0 53 | spriteTessellationDetail: -1 54 | textureType: 0 55 | textureShape: 1 56 | singleChannelComponent: 0 57 | maxTextureSizeSet: 0 58 | compressionQualitySet: 0 59 | textureFormatSet: 0 60 | platformSettings: 61 | - serializedVersion: 2 62 | buildTarget: DefaultTexturePlatform 63 | maxTextureSize: 2048 64 | resizeAlgorithm: 0 65 | textureFormat: -1 66 | textureCompression: 1 67 | compressionQuality: 50 68 | crunchedCompression: 0 69 | allowsAlphaSplitting: 0 70 | overridden: 0 71 | androidETC2FallbackOverride: 0 72 | spriteSheet: 73 | serializedVersion: 2 74 | sprites: [] 75 | outline: [] 76 | physicsShape: [] 77 | bones: [] 78 | spriteID: 79 | vertices: [] 80 | indices: 81 | edges: [] 82 | weights: [] 83 | spritePackingTag: 84 | pSDRemoveMatte: 0 85 | pSDShowRemoveMatteOption: 0 86 | userData: 87 | assetBundleName: 88 | assetBundleVariant: 89 | -------------------------------------------------------------------------------- /EosSharp/EosSharp.UnitTests.Unity3D/UnityTester/Logs/Packages-Update.log: -------------------------------------------------------------------------------- 1 | 2 | === Fri Jan 11 16:19:59 2019 3 | 4 | Packages were changed. 5 | Update Mode: mergeDefaultDependencies 6 | 7 | The following packages were added: 8 | com.unity.analytics@3.2.2 9 | com.unity.purchasing@2.0.3 10 | com.unity.ads@2.3.1 11 | com.unity.textmeshpro@1.3.0 12 | com.unity.package-manager-ui@2.0.3 13 | com.unity.collab-proxy@1.2.15 14 | com.unity.modules.ai@1.0.0 15 | com.unity.modules.animation@1.0.0 16 | com.unity.modules.assetbundle@1.0.0 17 | com.unity.modules.audio@1.0.0 18 | com.unity.modules.cloth@1.0.0 19 | com.unity.modules.director@1.0.0 20 | com.unity.modules.imageconversion@1.0.0 21 | com.unity.modules.imgui@1.0.0 22 | com.unity.modules.jsonserialize@1.0.0 23 | com.unity.modules.particlesystem@1.0.0 24 | com.unity.modules.physics@1.0.0 25 | com.unity.modules.physics2d@1.0.0 26 | com.unity.modules.screencapture@1.0.0 27 | com.unity.modules.terrain@1.0.0 28 | com.unity.modules.terrainphysics@1.0.0 29 | com.unity.modules.tilemap@1.0.0 30 | com.unity.modules.ui@1.0.0 31 | com.unity.modules.uielements@1.0.0 32 | com.unity.modules.umbra@1.0.0 33 | com.unity.modules.unityanalytics@1.0.0 34 | com.unity.modules.unitywebrequest@1.0.0 35 | com.unity.modules.unitywebrequestassetbundle@1.0.0 36 | com.unity.modules.unitywebrequestaudio@1.0.0 37 | com.unity.modules.unitywebrequesttexture@1.0.0 38 | com.unity.modules.unitywebrequestwww@1.0.0 39 | com.unity.modules.vehicles@1.0.0 40 | com.unity.modules.video@1.0.0 41 | com.unity.modules.vr@1.0.0 42 | com.unity.modules.wind@1.0.0 43 | com.unity.modules.xr@1.0.0 44 | -------------------------------------------------------------------------------- /EosSharp/EosSharp.UnitTests.Unity3D/UnityTester/Packages/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "com.unity.ads": "2.3.1", 4 | "com.unity.analytics": "3.2.2", 5 | "com.unity.collab-proxy": "1.2.15", 6 | "com.unity.package-manager-ui": "2.0.3", 7 | "com.unity.purchasing": "2.0.3", 8 | "com.unity.textmeshpro": "1.3.0", 9 | "com.unity.modules.ai": "1.0.0", 10 | "com.unity.modules.animation": "1.0.0", 11 | "com.unity.modules.assetbundle": "1.0.0", 12 | "com.unity.modules.audio": "1.0.0", 13 | "com.unity.modules.cloth": "1.0.0", 14 | "com.unity.modules.director": "1.0.0", 15 | "com.unity.modules.imageconversion": "1.0.0", 16 | "com.unity.modules.imgui": "1.0.0", 17 | "com.unity.modules.jsonserialize": "1.0.0", 18 | "com.unity.modules.particlesystem": "1.0.0", 19 | "com.unity.modules.physics": "1.0.0", 20 | "com.unity.modules.physics2d": "1.0.0", 21 | "com.unity.modules.screencapture": "1.0.0", 22 | "com.unity.modules.terrain": "1.0.0", 23 | "com.unity.modules.terrainphysics": "1.0.0", 24 | "com.unity.modules.tilemap": "1.0.0", 25 | "com.unity.modules.ui": "1.0.0", 26 | "com.unity.modules.uielements": "1.0.0", 27 | "com.unity.modules.umbra": "1.0.0", 28 | "com.unity.modules.unityanalytics": "1.0.0", 29 | "com.unity.modules.unitywebrequest": "1.0.0", 30 | "com.unity.modules.unitywebrequestassetbundle": "1.0.0", 31 | "com.unity.modules.unitywebrequestaudio": "1.0.0", 32 | "com.unity.modules.unitywebrequesttexture": "1.0.0", 33 | "com.unity.modules.unitywebrequestwww": "1.0.0", 34 | "com.unity.modules.vehicles": "1.0.0", 35 | "com.unity.modules.video": "1.0.0", 36 | "com.unity.modules.vr": "1.0.0", 37 | "com.unity.modules.wind": "1.0.0", 38 | "com.unity.modules.xr": "1.0.0" 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /EosSharp/EosSharp.UnitTests.Unity3D/UnityTester/ProjectSettings/AudioManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!11 &1 4 | AudioManager: 5 | m_ObjectHideFlags: 0 6 | m_Volume: 1 7 | Rolloff Scale: 1 8 | Doppler Factor: 1 9 | Default Speaker Mode: 2 10 | m_SampleRate: 0 11 | m_DSPBufferSize: 1024 12 | m_VirtualVoiceCount: 512 13 | m_RealVoiceCount: 32 14 | m_SpatializerPlugin: 15 | m_AmbisonicDecoderPlugin: 16 | m_DisableAudio: 0 17 | m_VirtualizeEffects: 1 18 | -------------------------------------------------------------------------------- /EosSharp/EosSharp.UnitTests.Unity3D/UnityTester/ProjectSettings/ClusterInputManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!236 &1 4 | ClusterInputManager: 5 | m_ObjectHideFlags: 0 6 | m_Inputs: [] 7 | -------------------------------------------------------------------------------- /EosSharp/EosSharp.UnitTests.Unity3D/UnityTester/ProjectSettings/DynamicsManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!55 &1 4 | PhysicsManager: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 8 7 | m_Gravity: {x: 0, y: -9.81, z: 0} 8 | m_DefaultMaterial: {fileID: 0} 9 | m_BounceThreshold: 2 10 | m_SleepThreshold: 0.005 11 | m_DefaultContactOffset: 0.01 12 | m_DefaultSolverIterations: 6 13 | m_DefaultSolverVelocityIterations: 1 14 | m_QueriesHitBackfaces: 0 15 | m_QueriesHitTriggers: 1 16 | m_EnableAdaptiveForce: 0 17 | m_ClothInterCollisionDistance: 0 18 | m_ClothInterCollisionStiffness: 0 19 | m_ContactsGeneration: 1 20 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 21 | m_AutoSimulation: 1 22 | m_AutoSyncTransforms: 0 23 | m_ReuseCollisionCallbacks: 1 24 | m_ClothInterCollisionSettingsToggle: 0 25 | m_ContactPairsMode: 0 26 | m_BroadphaseType: 0 27 | m_WorldBounds: 28 | m_Center: {x: 0, y: 0, z: 0} 29 | m_Extent: {x: 250, y: 250, z: 250} 30 | m_WorldSubdivisions: 8 31 | -------------------------------------------------------------------------------- /EosSharp/EosSharp.UnitTests.Unity3D/UnityTester/ProjectSettings/EditorBuildSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1045 &1 4 | EditorBuildSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_Scenes: 8 | - enabled: 0 9 | path: 10 | guid: 00000000000000000000000000000000 11 | m_configObjects: {} 12 | -------------------------------------------------------------------------------- /EosSharp/EosSharp.UnitTests.Unity3D/UnityTester/ProjectSettings/EditorSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!159 &1 4 | EditorSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 7 7 | m_ExternalVersionControlSupport: Visible Meta Files 8 | m_SerializationMode: 2 9 | m_LineEndingsForNewScripts: 2 10 | m_DefaultBehaviorMode: 0 11 | m_SpritePackerMode: 0 12 | m_SpritePackerPaddingPower: 1 13 | m_EtcTextureCompressorBehavior: 1 14 | m_EtcTextureFastCompressor: 1 15 | m_EtcTextureNormalCompressor: 2 16 | m_EtcTextureBestCompressor: 4 17 | m_ProjectGenerationIncludedExtensions: txt;xml;fnt;cd 18 | m_ProjectGenerationRootNamespace: 19 | m_UserGeneratedProjectSuffix: 20 | m_CollabEditorSettings: 21 | inProgressEnabled: 1 22 | -------------------------------------------------------------------------------- /EosSharp/EosSharp.UnitTests.Unity3D/UnityTester/ProjectSettings/GraphicsSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!30 &1 4 | GraphicsSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 12 7 | m_Deferred: 8 | m_Mode: 1 9 | m_Shader: {fileID: 69, guid: 0000000000000000f000000000000000, type: 0} 10 | m_DeferredReflections: 11 | m_Mode: 1 12 | m_Shader: {fileID: 74, guid: 0000000000000000f000000000000000, type: 0} 13 | m_ScreenSpaceShadows: 14 | m_Mode: 1 15 | m_Shader: {fileID: 64, guid: 0000000000000000f000000000000000, type: 0} 16 | m_LegacyDeferred: 17 | m_Mode: 1 18 | m_Shader: {fileID: 63, guid: 0000000000000000f000000000000000, type: 0} 19 | m_DepthNormals: 20 | m_Mode: 1 21 | m_Shader: {fileID: 62, guid: 0000000000000000f000000000000000, type: 0} 22 | m_MotionVectors: 23 | m_Mode: 1 24 | m_Shader: {fileID: 75, guid: 0000000000000000f000000000000000, type: 0} 25 | m_LightHalo: 26 | m_Mode: 1 27 | m_Shader: {fileID: 105, guid: 0000000000000000f000000000000000, type: 0} 28 | m_LensFlare: 29 | m_Mode: 1 30 | m_Shader: {fileID: 102, guid: 0000000000000000f000000000000000, type: 0} 31 | m_AlwaysIncludedShaders: 32 | - {fileID: 7, guid: 0000000000000000f000000000000000, type: 0} 33 | - {fileID: 15104, guid: 0000000000000000f000000000000000, type: 0} 34 | - {fileID: 15105, guid: 0000000000000000f000000000000000, type: 0} 35 | - {fileID: 15106, guid: 0000000000000000f000000000000000, type: 0} 36 | - {fileID: 10753, guid: 0000000000000000f000000000000000, type: 0} 37 | - {fileID: 10770, guid: 0000000000000000f000000000000000, type: 0} 38 | - {fileID: 10783, guid: 0000000000000000f000000000000000, type: 0} 39 | - {fileID: 16000, guid: 0000000000000000f000000000000000, type: 0} 40 | - {fileID: 17000, guid: 0000000000000000f000000000000000, type: 0} 41 | m_PreloadedShaders: [] 42 | m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000, 43 | type: 0} 44 | m_CustomRenderPipeline: {fileID: 0} 45 | m_TransparencySortMode: 0 46 | m_TransparencySortAxis: {x: 0, y: 0, z: 1} 47 | m_DefaultRenderingPath: 1 48 | m_DefaultMobileRenderingPath: 1 49 | m_TierSettings: [] 50 | m_LightmapStripping: 0 51 | m_FogStripping: 0 52 | m_InstancingStripping: 0 53 | m_LightmapKeepPlain: 1 54 | m_LightmapKeepDirCombined: 1 55 | m_LightmapKeepDynamicPlain: 1 56 | m_LightmapKeepDynamicDirCombined: 1 57 | m_LightmapKeepShadowMask: 1 58 | m_LightmapKeepSubtractive: 1 59 | m_FogKeepLinear: 1 60 | m_FogKeepExp: 1 61 | m_FogKeepExp2: 1 62 | m_AlbedoSwatchInfos: [] 63 | m_LightsUseLinearIntensity: 0 64 | m_LightsUseColorTemperature: 0 65 | -------------------------------------------------------------------------------- /EosSharp/EosSharp.UnitTests.Unity3D/UnityTester/ProjectSettings/InputManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!13 &1 4 | InputManager: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_Axes: 8 | - serializedVersion: 3 9 | m_Name: Horizontal 10 | descriptiveName: 11 | descriptiveNegativeName: 12 | negativeButton: left 13 | positiveButton: right 14 | altNegativeButton: a 15 | altPositiveButton: d 16 | gravity: 3 17 | dead: 0.001 18 | sensitivity: 3 19 | snap: 1 20 | invert: 0 21 | type: 0 22 | axis: 0 23 | joyNum: 0 24 | - serializedVersion: 3 25 | m_Name: Vertical 26 | descriptiveName: 27 | descriptiveNegativeName: 28 | negativeButton: down 29 | positiveButton: up 30 | altNegativeButton: s 31 | altPositiveButton: w 32 | gravity: 3 33 | dead: 0.001 34 | sensitivity: 3 35 | snap: 1 36 | invert: 0 37 | type: 0 38 | axis: 0 39 | joyNum: 0 40 | - serializedVersion: 3 41 | m_Name: Fire1 42 | descriptiveName: 43 | descriptiveNegativeName: 44 | negativeButton: 45 | positiveButton: left ctrl 46 | altNegativeButton: 47 | altPositiveButton: mouse 0 48 | gravity: 1000 49 | dead: 0.001 50 | sensitivity: 1000 51 | snap: 0 52 | invert: 0 53 | type: 0 54 | axis: 0 55 | joyNum: 0 56 | - serializedVersion: 3 57 | m_Name: Fire2 58 | descriptiveName: 59 | descriptiveNegativeName: 60 | negativeButton: 61 | positiveButton: left alt 62 | altNegativeButton: 63 | altPositiveButton: mouse 1 64 | gravity: 1000 65 | dead: 0.001 66 | sensitivity: 1000 67 | snap: 0 68 | invert: 0 69 | type: 0 70 | axis: 0 71 | joyNum: 0 72 | - serializedVersion: 3 73 | m_Name: Fire3 74 | descriptiveName: 75 | descriptiveNegativeName: 76 | negativeButton: 77 | positiveButton: left shift 78 | altNegativeButton: 79 | altPositiveButton: mouse 2 80 | gravity: 1000 81 | dead: 0.001 82 | sensitivity: 1000 83 | snap: 0 84 | invert: 0 85 | type: 0 86 | axis: 0 87 | joyNum: 0 88 | - serializedVersion: 3 89 | m_Name: Jump 90 | descriptiveName: 91 | descriptiveNegativeName: 92 | negativeButton: 93 | positiveButton: space 94 | altNegativeButton: 95 | altPositiveButton: 96 | gravity: 1000 97 | dead: 0.001 98 | sensitivity: 1000 99 | snap: 0 100 | invert: 0 101 | type: 0 102 | axis: 0 103 | joyNum: 0 104 | - serializedVersion: 3 105 | m_Name: Mouse X 106 | descriptiveName: 107 | descriptiveNegativeName: 108 | negativeButton: 109 | positiveButton: 110 | altNegativeButton: 111 | altPositiveButton: 112 | gravity: 0 113 | dead: 0 114 | sensitivity: 0.1 115 | snap: 0 116 | invert: 0 117 | type: 1 118 | axis: 0 119 | joyNum: 0 120 | - serializedVersion: 3 121 | m_Name: Mouse Y 122 | descriptiveName: 123 | descriptiveNegativeName: 124 | negativeButton: 125 | positiveButton: 126 | altNegativeButton: 127 | altPositiveButton: 128 | gravity: 0 129 | dead: 0 130 | sensitivity: 0.1 131 | snap: 0 132 | invert: 0 133 | type: 1 134 | axis: 1 135 | joyNum: 0 136 | - serializedVersion: 3 137 | m_Name: Mouse ScrollWheel 138 | descriptiveName: 139 | descriptiveNegativeName: 140 | negativeButton: 141 | positiveButton: 142 | altNegativeButton: 143 | altPositiveButton: 144 | gravity: 0 145 | dead: 0 146 | sensitivity: 0.1 147 | snap: 0 148 | invert: 0 149 | type: 1 150 | axis: 2 151 | joyNum: 0 152 | - serializedVersion: 3 153 | m_Name: Horizontal 154 | descriptiveName: 155 | descriptiveNegativeName: 156 | negativeButton: 157 | positiveButton: 158 | altNegativeButton: 159 | altPositiveButton: 160 | gravity: 0 161 | dead: 0.19 162 | sensitivity: 1 163 | snap: 0 164 | invert: 0 165 | type: 2 166 | axis: 0 167 | joyNum: 0 168 | - serializedVersion: 3 169 | m_Name: Vertical 170 | descriptiveName: 171 | descriptiveNegativeName: 172 | negativeButton: 173 | positiveButton: 174 | altNegativeButton: 175 | altPositiveButton: 176 | gravity: 0 177 | dead: 0.19 178 | sensitivity: 1 179 | snap: 0 180 | invert: 1 181 | type: 2 182 | axis: 1 183 | joyNum: 0 184 | - serializedVersion: 3 185 | m_Name: Fire1 186 | descriptiveName: 187 | descriptiveNegativeName: 188 | negativeButton: 189 | positiveButton: joystick button 0 190 | altNegativeButton: 191 | altPositiveButton: 192 | gravity: 1000 193 | dead: 0.001 194 | sensitivity: 1000 195 | snap: 0 196 | invert: 0 197 | type: 0 198 | axis: 0 199 | joyNum: 0 200 | - serializedVersion: 3 201 | m_Name: Fire2 202 | descriptiveName: 203 | descriptiveNegativeName: 204 | negativeButton: 205 | positiveButton: joystick button 1 206 | altNegativeButton: 207 | altPositiveButton: 208 | gravity: 1000 209 | dead: 0.001 210 | sensitivity: 1000 211 | snap: 0 212 | invert: 0 213 | type: 0 214 | axis: 0 215 | joyNum: 0 216 | - serializedVersion: 3 217 | m_Name: Fire3 218 | descriptiveName: 219 | descriptiveNegativeName: 220 | negativeButton: 221 | positiveButton: joystick button 2 222 | altNegativeButton: 223 | altPositiveButton: 224 | gravity: 1000 225 | dead: 0.001 226 | sensitivity: 1000 227 | snap: 0 228 | invert: 0 229 | type: 0 230 | axis: 0 231 | joyNum: 0 232 | - serializedVersion: 3 233 | m_Name: Jump 234 | descriptiveName: 235 | descriptiveNegativeName: 236 | negativeButton: 237 | positiveButton: joystick button 3 238 | altNegativeButton: 239 | altPositiveButton: 240 | gravity: 1000 241 | dead: 0.001 242 | sensitivity: 1000 243 | snap: 0 244 | invert: 0 245 | type: 0 246 | axis: 0 247 | joyNum: 0 248 | - serializedVersion: 3 249 | m_Name: Submit 250 | descriptiveName: 251 | descriptiveNegativeName: 252 | negativeButton: 253 | positiveButton: return 254 | altNegativeButton: 255 | altPositiveButton: joystick button 0 256 | gravity: 1000 257 | dead: 0.001 258 | sensitivity: 1000 259 | snap: 0 260 | invert: 0 261 | type: 0 262 | axis: 0 263 | joyNum: 0 264 | - serializedVersion: 3 265 | m_Name: Submit 266 | descriptiveName: 267 | descriptiveNegativeName: 268 | negativeButton: 269 | positiveButton: enter 270 | altNegativeButton: 271 | altPositiveButton: space 272 | gravity: 1000 273 | dead: 0.001 274 | sensitivity: 1000 275 | snap: 0 276 | invert: 0 277 | type: 0 278 | axis: 0 279 | joyNum: 0 280 | - serializedVersion: 3 281 | m_Name: Cancel 282 | descriptiveName: 283 | descriptiveNegativeName: 284 | negativeButton: 285 | positiveButton: escape 286 | altNegativeButton: 287 | altPositiveButton: joystick button 1 288 | gravity: 1000 289 | dead: 0.001 290 | sensitivity: 1000 291 | snap: 0 292 | invert: 0 293 | type: 0 294 | axis: 0 295 | joyNum: 0 296 | -------------------------------------------------------------------------------- /EosSharp/EosSharp.UnitTests.Unity3D/UnityTester/ProjectSettings/NavMeshAreas.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!126 &1 4 | NavMeshProjectSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | areas: 8 | - name: Walkable 9 | cost: 1 10 | - name: Not Walkable 11 | cost: 1 12 | - name: Jump 13 | cost: 2 14 | - name: 15 | cost: 1 16 | - name: 17 | cost: 1 18 | - name: 19 | cost: 1 20 | - name: 21 | cost: 1 22 | - name: 23 | cost: 1 24 | - name: 25 | cost: 1 26 | - name: 27 | cost: 1 28 | - name: 29 | cost: 1 30 | - name: 31 | cost: 1 32 | - name: 33 | cost: 1 34 | - name: 35 | cost: 1 36 | - name: 37 | cost: 1 38 | - name: 39 | cost: 1 40 | - name: 41 | cost: 1 42 | - name: 43 | cost: 1 44 | - name: 45 | cost: 1 46 | - name: 47 | cost: 1 48 | - name: 49 | cost: 1 50 | - name: 51 | cost: 1 52 | - name: 53 | cost: 1 54 | - name: 55 | cost: 1 56 | - name: 57 | cost: 1 58 | - name: 59 | cost: 1 60 | - name: 61 | cost: 1 62 | - name: 63 | cost: 1 64 | - name: 65 | cost: 1 66 | - name: 67 | cost: 1 68 | - name: 69 | cost: 1 70 | - name: 71 | cost: 1 72 | m_LastAgentTypeID: -887442657 73 | m_Settings: 74 | - serializedVersion: 2 75 | agentTypeID: 0 76 | agentRadius: 0.5 77 | agentHeight: 2 78 | agentSlope: 45 79 | agentClimb: 0.75 80 | ledgeDropHeight: 0 81 | maxJumpAcrossDistance: 0 82 | minRegionArea: 2 83 | manualCellSize: 0 84 | cellSize: 0.16666667 85 | manualTileSize: 0 86 | tileSize: 256 87 | accuratePlacement: 0 88 | debug: 89 | m_Flags: 0 90 | m_SettingNames: 91 | - Humanoid 92 | -------------------------------------------------------------------------------- /EosSharp/EosSharp.UnitTests.Unity3D/UnityTester/ProjectSettings/NetworkManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!149 &1 4 | NetworkManager: 5 | m_ObjectHideFlags: 0 6 | m_DebugLevel: 0 7 | m_Sendrate: 15 8 | m_AssetToPrefab: {} 9 | -------------------------------------------------------------------------------- /EosSharp/EosSharp.UnitTests.Unity3D/UnityTester/ProjectSettings/Physics2DSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!19 &1 4 | Physics2DSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 4 7 | m_Gravity: {x: 0, y: -9.81} 8 | m_DefaultMaterial: {fileID: 0} 9 | m_VelocityIterations: 8 10 | m_PositionIterations: 3 11 | m_VelocityThreshold: 1 12 | m_MaxLinearCorrection: 0.2 13 | m_MaxAngularCorrection: 8 14 | m_MaxTranslationSpeed: 100 15 | m_MaxRotationSpeed: 360 16 | m_BaumgarteScale: 0.2 17 | m_BaumgarteTimeOfImpactScale: 0.75 18 | m_TimeToSleep: 0.5 19 | m_LinearSleepTolerance: 0.01 20 | m_AngularSleepTolerance: 2 21 | m_DefaultContactOffset: 0.01 22 | m_AutoSimulation: 1 23 | m_QueriesHitTriggers: 1 24 | m_QueriesStartInColliders: 1 25 | m_ChangeStopsCallbacks: 0 26 | m_CallbacksOnDisable: 1 27 | m_ReuseCollisionCallbacks: 1 28 | m_AutoSyncTransforms: 0 29 | m_AlwaysShowColliders: 0 30 | m_ShowColliderSleep: 1 31 | m_ShowColliderContacts: 0 32 | m_ShowColliderAABB: 0 33 | m_ContactArrowScale: 0.2 34 | m_ColliderAwakeColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.7529412} 35 | m_ColliderAsleepColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.36078432} 36 | m_ColliderContactColor: {r: 1, g: 0, b: 1, a: 0.6862745} 37 | m_ColliderAABBColor: {r: 1, g: 1, b: 0, a: 0.2509804} 38 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 39 | -------------------------------------------------------------------------------- /EosSharp/EosSharp.UnitTests.Unity3D/UnityTester/ProjectSettings/PresetManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1386491679 &1 4 | PresetManager: 5 | m_ObjectHideFlags: 0 6 | m_DefaultList: 7 | - type: 8 | m_NativeTypeID: 108 9 | m_ManagedTypePPtr: {fileID: 0} 10 | m_ManagedTypeFallback: 11 | defaultPresets: 12 | - m_Preset: {fileID: 2655988077585873504, guid: c1cf8506f04ef2c4a88b64b6c4202eea, 13 | type: 2} 14 | - type: 15 | m_NativeTypeID: 1020 16 | m_ManagedTypePPtr: {fileID: 0} 17 | m_ManagedTypeFallback: 18 | defaultPresets: 19 | - m_Preset: {fileID: 2655988077585873504, guid: 0cd792cc87e492d43b4e95b205fc5cc6, 20 | type: 2} 21 | - type: 22 | m_NativeTypeID: 1006 23 | m_ManagedTypePPtr: {fileID: 0} 24 | m_ManagedTypeFallback: 25 | defaultPresets: 26 | - m_Preset: {fileID: 2655988077585873504, guid: 7a99f8aa944efe94cb9bd74562b7d5f9, 27 | type: 2} 28 | -------------------------------------------------------------------------------- /EosSharp/EosSharp.UnitTests.Unity3D/UnityTester/ProjectSettings/ProjectVersion.txt: -------------------------------------------------------------------------------- 1 | m_EditorVersion: 2018.3.0f2 2 | -------------------------------------------------------------------------------- /EosSharp/EosSharp.UnitTests.Unity3D/UnityTester/ProjectSettings/QualitySettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!47 &1 4 | QualitySettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 5 7 | m_CurrentQuality: 4 8 | m_QualitySettings: 9 | - serializedVersion: 2 10 | name: Very Low 11 | pixelLightCount: 0 12 | shadows: 0 13 | shadowResolution: 0 14 | shadowProjection: 1 15 | shadowCascades: 1 16 | shadowDistance: 15 17 | shadowNearPlaneOffset: 3 18 | shadowCascade2Split: 0.33333334 19 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 20 | shadowmaskMode: 0 21 | blendWeights: 1 22 | textureQuality: 1 23 | anisotropicTextures: 0 24 | antiAliasing: 0 25 | softParticles: 0 26 | softVegetation: 0 27 | realtimeReflectionProbes: 0 28 | billboardsFaceCameraPosition: 0 29 | vSyncCount: 0 30 | lodBias: 0.3 31 | maximumLODLevel: 0 32 | streamingMipmapsActive: 0 33 | streamingMipmapsAddAllCameras: 1 34 | streamingMipmapsMemoryBudget: 512 35 | streamingMipmapsRenderersPerFrame: 512 36 | streamingMipmapsMaxLevelReduction: 2 37 | streamingMipmapsMaxFileIORequests: 1024 38 | particleRaycastBudget: 4 39 | asyncUploadTimeSlice: 2 40 | asyncUploadBufferSize: 16 41 | asyncUploadPersistentBuffer: 1 42 | resolutionScalingFixedDPIFactor: 1 43 | excludedTargetPlatforms: [] 44 | - serializedVersion: 2 45 | name: Low 46 | pixelLightCount: 0 47 | shadows: 0 48 | shadowResolution: 0 49 | shadowProjection: 1 50 | shadowCascades: 1 51 | shadowDistance: 20 52 | shadowNearPlaneOffset: 3 53 | shadowCascade2Split: 0.33333334 54 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 55 | shadowmaskMode: 0 56 | blendWeights: 2 57 | textureQuality: 0 58 | anisotropicTextures: 0 59 | antiAliasing: 0 60 | softParticles: 0 61 | softVegetation: 0 62 | realtimeReflectionProbes: 0 63 | billboardsFaceCameraPosition: 0 64 | vSyncCount: 0 65 | lodBias: 0.4 66 | maximumLODLevel: 0 67 | streamingMipmapsActive: 0 68 | streamingMipmapsAddAllCameras: 1 69 | streamingMipmapsMemoryBudget: 512 70 | streamingMipmapsRenderersPerFrame: 512 71 | streamingMipmapsMaxLevelReduction: 2 72 | streamingMipmapsMaxFileIORequests: 1024 73 | particleRaycastBudget: 16 74 | asyncUploadTimeSlice: 2 75 | asyncUploadBufferSize: 16 76 | asyncUploadPersistentBuffer: 1 77 | resolutionScalingFixedDPIFactor: 1 78 | excludedTargetPlatforms: [] 79 | - serializedVersion: 2 80 | name: Medium 81 | pixelLightCount: 1 82 | shadows: 1 83 | shadowResolution: 0 84 | shadowProjection: 1 85 | shadowCascades: 1 86 | shadowDistance: 20 87 | shadowNearPlaneOffset: 3 88 | shadowCascade2Split: 0.33333334 89 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 90 | shadowmaskMode: 0 91 | blendWeights: 2 92 | textureQuality: 0 93 | anisotropicTextures: 1 94 | antiAliasing: 0 95 | softParticles: 0 96 | softVegetation: 0 97 | realtimeReflectionProbes: 0 98 | billboardsFaceCameraPosition: 0 99 | vSyncCount: 1 100 | lodBias: 0.7 101 | maximumLODLevel: 0 102 | streamingMipmapsActive: 0 103 | streamingMipmapsAddAllCameras: 1 104 | streamingMipmapsMemoryBudget: 512 105 | streamingMipmapsRenderersPerFrame: 512 106 | streamingMipmapsMaxLevelReduction: 2 107 | streamingMipmapsMaxFileIORequests: 1024 108 | particleRaycastBudget: 64 109 | asyncUploadTimeSlice: 2 110 | asyncUploadBufferSize: 16 111 | asyncUploadPersistentBuffer: 1 112 | resolutionScalingFixedDPIFactor: 1 113 | excludedTargetPlatforms: [] 114 | - serializedVersion: 2 115 | name: High 116 | pixelLightCount: 2 117 | shadows: 2 118 | shadowResolution: 1 119 | shadowProjection: 1 120 | shadowCascades: 2 121 | shadowDistance: 40 122 | shadowNearPlaneOffset: 3 123 | shadowCascade2Split: 0.33333334 124 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 125 | shadowmaskMode: 1 126 | blendWeights: 2 127 | textureQuality: 0 128 | anisotropicTextures: 1 129 | antiAliasing: 2 130 | softParticles: 0 131 | softVegetation: 1 132 | realtimeReflectionProbes: 1 133 | billboardsFaceCameraPosition: 1 134 | vSyncCount: 1 135 | lodBias: 1 136 | maximumLODLevel: 0 137 | streamingMipmapsActive: 0 138 | streamingMipmapsAddAllCameras: 1 139 | streamingMipmapsMemoryBudget: 512 140 | streamingMipmapsRenderersPerFrame: 512 141 | streamingMipmapsMaxLevelReduction: 2 142 | streamingMipmapsMaxFileIORequests: 1024 143 | particleRaycastBudget: 256 144 | asyncUploadTimeSlice: 2 145 | asyncUploadBufferSize: 16 146 | asyncUploadPersistentBuffer: 1 147 | resolutionScalingFixedDPIFactor: 1 148 | excludedTargetPlatforms: [] 149 | - serializedVersion: 2 150 | name: Very High 151 | pixelLightCount: 3 152 | shadows: 2 153 | shadowResolution: 2 154 | shadowProjection: 1 155 | shadowCascades: 2 156 | shadowDistance: 40 157 | shadowNearPlaneOffset: 3 158 | shadowCascade2Split: 0.33333334 159 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 160 | shadowmaskMode: 1 161 | blendWeights: 4 162 | textureQuality: 0 163 | anisotropicTextures: 1 164 | antiAliasing: 4 165 | softParticles: 1 166 | softVegetation: 1 167 | realtimeReflectionProbes: 1 168 | billboardsFaceCameraPosition: 1 169 | vSyncCount: 1 170 | lodBias: 1.5 171 | maximumLODLevel: 0 172 | streamingMipmapsActive: 0 173 | streamingMipmapsAddAllCameras: 1 174 | streamingMipmapsMemoryBudget: 512 175 | streamingMipmapsRenderersPerFrame: 512 176 | streamingMipmapsMaxLevelReduction: 2 177 | streamingMipmapsMaxFileIORequests: 1024 178 | particleRaycastBudget: 1024 179 | asyncUploadTimeSlice: 2 180 | asyncUploadBufferSize: 16 181 | asyncUploadPersistentBuffer: 1 182 | resolutionScalingFixedDPIFactor: 1 183 | excludedTargetPlatforms: [] 184 | - serializedVersion: 2 185 | name: Ultra 186 | pixelLightCount: 4 187 | shadows: 2 188 | shadowResolution: 2 189 | shadowProjection: 1 190 | shadowCascades: 4 191 | shadowDistance: 150 192 | shadowNearPlaneOffset: 3 193 | shadowCascade2Split: 0.33333334 194 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 195 | shadowmaskMode: 1 196 | blendWeights: 4 197 | textureQuality: 0 198 | anisotropicTextures: 1 199 | antiAliasing: 4 200 | softParticles: 1 201 | softVegetation: 1 202 | realtimeReflectionProbes: 1 203 | billboardsFaceCameraPosition: 1 204 | vSyncCount: 1 205 | lodBias: 2 206 | maximumLODLevel: 0 207 | streamingMipmapsActive: 0 208 | streamingMipmapsAddAllCameras: 1 209 | streamingMipmapsMemoryBudget: 512 210 | streamingMipmapsRenderersPerFrame: 512 211 | streamingMipmapsMaxLevelReduction: 2 212 | streamingMipmapsMaxFileIORequests: 1024 213 | particleRaycastBudget: 4096 214 | asyncUploadTimeSlice: 2 215 | asyncUploadBufferSize: 16 216 | asyncUploadPersistentBuffer: 1 217 | resolutionScalingFixedDPIFactor: 1 218 | excludedTargetPlatforms: [] 219 | m_PerPlatformDefaultQuality: {} 220 | -------------------------------------------------------------------------------- /EosSharp/EosSharp.UnitTests.Unity3D/UnityTester/ProjectSettings/TagManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!78 &1 4 | TagManager: 5 | serializedVersion: 2 6 | tags: [] 7 | layers: 8 | - Default 9 | - TransparentFX 10 | - Ignore Raycast 11 | - 12 | - Water 13 | - UI 14 | - 15 | - 16 | - PostProcessing 17 | - 18 | - 19 | - 20 | - 21 | - 22 | - 23 | - 24 | - 25 | - 26 | - 27 | - 28 | - 29 | - 30 | - 31 | - 32 | - 33 | - 34 | - 35 | - 36 | - 37 | - 38 | - 39 | - 40 | m_SortingLayers: 41 | - name: Default 42 | uniqueID: 0 43 | locked: 0 44 | -------------------------------------------------------------------------------- /EosSharp/EosSharp.UnitTests.Unity3D/UnityTester/ProjectSettings/TimeManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!5 &1 4 | TimeManager: 5 | m_ObjectHideFlags: 0 6 | Fixed Timestep: 0.02 7 | Maximum Allowed Timestep: 0.1 8 | m_TimeScale: 1 9 | Maximum Particle Timestep: 0.03 10 | -------------------------------------------------------------------------------- /EosSharp/EosSharp.UnitTests.Unity3D/UnityTester/ProjectSettings/UnityConnectSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!310 &1 4 | UnityConnectSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 1 7 | m_Enabled: 1 8 | m_TestMode: 0 9 | m_EventOldUrl: https://api.uca.cloud.unity3d.com/v1/events 10 | m_EventUrl: https://cdp.cloud.unity3d.com/v1/events 11 | m_ConfigUrl: https://config.uca.cloud.unity3d.com 12 | m_TestInitMode: 0 13 | CrashReportingSettings: 14 | m_EventUrl: https://perf-events.cloud.unity3d.com 15 | m_Enabled: 0 16 | m_LogBufferSize: 10 17 | m_CaptureEditorExceptions: 1 18 | UnityPurchasingSettings: 19 | m_Enabled: 0 20 | m_TestMode: 0 21 | UnityAnalyticsSettings: 22 | m_Enabled: 0 23 | m_TestMode: 0 24 | m_InitializeOnStartup: 1 25 | UnityAdsSettings: 26 | m_Enabled: 0 27 | m_InitializeOnStartup: 1 28 | m_TestMode: 0 29 | m_IosGameId: 30 | m_AndroidGameId: 31 | m_GameIds: {} 32 | m_GameId: 33 | PerformanceReportingSettings: 34 | m_Enabled: 0 35 | -------------------------------------------------------------------------------- /EosSharp/EosSharp.UnitTests.Unity3D/UnityTester/ProjectSettings/VFXManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!937362698 &1 4 | VFXManager: 5 | m_ObjectHideFlags: 0 6 | m_IndirectShader: {fileID: 0} 7 | m_CopyBufferShader: {fileID: 0} 8 | m_SortShader: {fileID: 0} 9 | m_RenderPipeSettingsPath: 10 | m_FixedTimeStep: 0.016666668 11 | m_MaxDeltaTime: 0.05 12 | -------------------------------------------------------------------------------- /EosSharp/EosSharp.UnitTests.Unity3D/app.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 10 | 11 | -------------------------------------------------------------------------------- /EosSharp/EosSharp.UnitTests/ApiUnitTests.tt: -------------------------------------------------------------------------------- 1 | <#@ template debug="false" hostspecific="false" language="C#" #> 2 | <#@ assembly name="System.Core" #> 3 | <#@ import namespace="System.Globalization" #> 4 | <#@ include file=".\..\EosSharp.UnitTests.Core\EosTestCasesDef.t4" #> 5 | <#@ output extension=".cs" #> 6 | // Auto Generated, do not edit. 7 | using EosSharp.Core; 8 | using EosSharp.Core.Api.v1; 9 | using EosSharp.Core.Providers; 10 | using Microsoft.VisualStudio.TestTools.UnitTesting; 11 | using Newtonsoft.Json; 12 | using System; 13 | using System.Threading.Tasks; 14 | 15 | namespace EosSharp.UnitTests 16 | { 17 | [TestClass] 18 | public class ApiUnitTests 19 | { 20 | ApiUnitTestCases ApiUnitTestCases; 21 | public ApiUnitTests() 22 | { 23 | var eosConfig = new EosConfigurator() 24 | { 25 | SignProvider = new DefaultSignProvider("5K57oSZLpfzePvQNpsLS6NfKXLhhRARNU13q6u2ZPQCGHgKLbTA"), 26 | 27 | //HttpEndpoint = "https://nodes.eos42.io", //Mainnet 28 | //ChainId = "aca376f206b8fc25a6ed44dbdc66547c36c6c33e3a119ffbeaef943642f0e906" 29 | 30 | HttpEndpoint = "https://jungle2.cryptolions.io", 31 | ChainId = "e70aaab8997e1dfce58fbfac80cbbb8fecec7b99cf982a9444273cbc64c41473" 32 | 33 | //HttpEndpoint = "http://localhost:8888", 34 | //ChainId = "cf057bbfb72640471fd910bcb67639c22df9f92470936cddc1ade0e2f2e7dc4f" 35 | }; 36 | var eosApi = new EosApi(eosConfig, new HttpHandler()); 37 | 38 | ApiUnitTestCases = new ApiUnitTestCases(eosConfig, eosApi); 39 | } 40 | 41 | <# foreach (var tc in ApiUnitTestCases) { #> 42 | [TestMethod] 43 | [TestCategory("Api Tests")] 44 | public async Task <#= tc #>() 45 | { 46 | bool success = false; 47 | try 48 | { 49 | await ApiUnitTestCases.<#= tc #>(); 50 | success = true; 51 | } 52 | catch (Exception ex) 53 | { 54 | Console.WriteLine(JsonConvert.SerializeObject(ex)); 55 | } 56 | 57 | Assert.IsTrue(success); 58 | } 59 | <# } #> 60 | } 61 | } -------------------------------------------------------------------------------- /EosSharp/EosSharp.UnitTests/EosSharp.UnitTests.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {969C1A19-C591-4EAE-A8F3-AE39878CA2C2} 8 | Library 9 | Properties 10 | EosSharp.UnitTests 11 | EosSharp.UnitTests 12 | v4.7.1 13 | 512 14 | {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 15 | 15.0 16 | $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) 17 | $(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages 18 | False 19 | UnitTest 20 | 21 | 22 | 23 | 24 | true 25 | full 26 | false 27 | bin\Debug\ 28 | DEBUG;TRACE 29 | prompt 30 | 4 31 | 32 | 33 | pdbonly 34 | true 35 | bin\Release\ 36 | TRACE 37 | prompt 38 | 4 39 | 40 | 41 | 42 | ..\packages\Cryptography.ECDSA.Secp256K1.1.1.2\lib\netstandard2.0\Cryptography.ECDSA.dll 43 | 44 | 45 | 46 | ..\packages\MSTest.TestFramework.1.4.0\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll 47 | 48 | 49 | ..\packages\MSTest.TestFramework.1.4.0\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll 50 | 51 | 52 | ..\packages\Newtonsoft.Json.12.0.1\lib\net45\Newtonsoft.Json.dll 53 | 54 | 55 | 56 | 57 | 58 | 59 | SerializationUnitTests.tt 60 | True 61 | True 62 | 63 | 64 | EosUnitTests.tt 65 | True 66 | True 67 | 68 | 69 | ApiUnitTests.tt 70 | True 71 | True 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | {7f63bfd8-ac29-419f-a532-cc6ddeef1b46} 85 | EosSharp.Core 86 | 87 | 88 | {fe13b07e-bbc9-4142-b653-affbd567c4f6} 89 | EosSharp.UnitTests.Core 90 | 91 | 92 | {a7498dea-becb-49ce-9e9d-e06fdfa29e5a} 93 | EosSharp 94 | 95 | 96 | 97 | 98 | TextTemplatingFileGenerator 99 | ApiUnitTests.cs 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | TextTemplatingFileGenerator 108 | EosUnitTests.cs 109 | 110 | 111 | 112 | 113 | TextTemplatingFileGenerator 114 | SerializationUnitTests.cs 115 | 116 | 117 | 118 | 119 | 120 | 121 | This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. 122 | 123 | 124 | 125 | 126 | 127 | -------------------------------------------------------------------------------- /EosSharp/EosSharp.UnitTests/EosUnitTests.cs: -------------------------------------------------------------------------------- 1 | // Auto Generated, do not edit. 2 | using EosSharp.Core; 3 | using EosSharp.Core.Api.v1; 4 | using EosSharp.Core.Providers; 5 | using Microsoft.VisualStudio.TestTools.UnitTesting; 6 | using Newtonsoft.Json; 7 | using System; 8 | using System.Threading.Tasks; 9 | 10 | namespace EosSharp.UnitTests 11 | { 12 | [TestClass] 13 | public class EosUnitTests 14 | { 15 | EosUnitTestCases EosUnitTestCases; 16 | public EosUnitTests() 17 | { 18 | var eosConfig = new EosConfigurator() 19 | { 20 | SignProvider = new DefaultSignProvider("5K57oSZLpfzePvQNpsLS6NfKXLhhRARNU13q6u2ZPQCGHgKLbTA"), 21 | 22 | //HttpEndpoint = "https://nodes.eos42.io", //Mainnet 23 | //ChainId = "aca376f206b8fc25a6ed44dbdc66547c36c6c33e3a119ffbeaef943642f0e906" 24 | 25 | HttpEndpoint = "https://jungle2.cryptolions.io", 26 | ChainId = "e70aaab8997e1dfce58fbfac80cbbb8fecec7b99cf982a9444273cbc64c41473" 27 | 28 | //HttpEndpoint = "http://localhost:8888", 29 | //ChainId = "cf057bbfb72640471fd910bcb67639c22df9f92470936cddc1ade0e2f2e7dc4f" 30 | }; 31 | EosUnitTestCases = new EosUnitTestCases(new Eos(eosConfig)); 32 | } 33 | [TestMethod] 34 | [TestCategory("Eos Tests")] 35 | public async Task GetBlock() 36 | { 37 | bool success = false; 38 | try 39 | { 40 | await EosUnitTestCases.GetBlock(); 41 | success = true; 42 | } 43 | catch (Exception ex) 44 | { 45 | Console.WriteLine(JsonConvert.SerializeObject(ex)); 46 | } 47 | 48 | Assert.IsTrue(success); 49 | } 50 | [TestMethod] 51 | [TestCategory("Eos Tests")] 52 | public async Task GetTableRows() 53 | { 54 | bool success = false; 55 | try 56 | { 57 | await EosUnitTestCases.GetTableRows(); 58 | success = true; 59 | } 60 | catch (Exception ex) 61 | { 62 | Console.WriteLine(JsonConvert.SerializeObject(ex)); 63 | } 64 | 65 | Assert.IsTrue(success); 66 | } 67 | [TestMethod] 68 | [TestCategory("Eos Tests")] 69 | public async Task GetTableRowsGeneric() 70 | { 71 | bool success = false; 72 | try 73 | { 74 | await EosUnitTestCases.GetTableRowsGeneric(); 75 | success = true; 76 | } 77 | catch (Exception ex) 78 | { 79 | Console.WriteLine(JsonConvert.SerializeObject(ex)); 80 | } 81 | 82 | Assert.IsTrue(success); 83 | } 84 | [TestMethod] 85 | [TestCategory("Eos Tests")] 86 | public async Task GetProducers() 87 | { 88 | bool success = false; 89 | try 90 | { 91 | await EosUnitTestCases.GetProducers(); 92 | success = true; 93 | } 94 | catch (Exception ex) 95 | { 96 | Console.WriteLine(JsonConvert.SerializeObject(ex)); 97 | } 98 | 99 | Assert.IsTrue(success); 100 | } 101 | [TestMethod] 102 | [TestCategory("Eos Tests")] 103 | public async Task GetScheduledTransactions() 104 | { 105 | bool success = false; 106 | try 107 | { 108 | await EosUnitTestCases.GetScheduledTransactions(); 109 | success = true; 110 | } 111 | catch (Exception ex) 112 | { 113 | Console.WriteLine(JsonConvert.SerializeObject(ex)); 114 | } 115 | 116 | Assert.IsTrue(success); 117 | } 118 | [TestMethod] 119 | [TestCategory("Eos Tests")] 120 | public async Task CreateTransactionArrayData() 121 | { 122 | bool success = false; 123 | try 124 | { 125 | await EosUnitTestCases.CreateTransactionArrayData(); 126 | success = true; 127 | } 128 | catch (Exception ex) 129 | { 130 | Console.WriteLine(JsonConvert.SerializeObject(ex)); 131 | } 132 | 133 | Assert.IsTrue(success); 134 | } 135 | [TestMethod] 136 | [TestCategory("Eos Tests")] 137 | public async Task CreateTransactionActionArrayStructData() 138 | { 139 | bool success = false; 140 | try 141 | { 142 | await EosUnitTestCases.CreateTransactionActionArrayStructData(); 143 | success = true; 144 | } 145 | catch (Exception ex) 146 | { 147 | Console.WriteLine(JsonConvert.SerializeObject(ex)); 148 | } 149 | 150 | Assert.IsTrue(success); 151 | } 152 | [TestMethod] 153 | [TestCategory("Eos Tests")] 154 | public async Task CreateTransactionAnonymousObjectData() 155 | { 156 | bool success = false; 157 | try 158 | { 159 | await EosUnitTestCases.CreateTransactionAnonymousObjectData(); 160 | success = true; 161 | } 162 | catch (Exception ex) 163 | { 164 | Console.WriteLine(JsonConvert.SerializeObject(ex)); 165 | } 166 | 167 | Assert.IsTrue(success); 168 | } 169 | [TestMethod] 170 | [TestCategory("Eos Tests")] 171 | public async Task CreateTransaction() 172 | { 173 | bool success = false; 174 | try 175 | { 176 | await EosUnitTestCases.CreateTransaction(); 177 | success = true; 178 | } 179 | catch (Exception ex) 180 | { 181 | Console.WriteLine(JsonConvert.SerializeObject(ex)); 182 | } 183 | 184 | Assert.IsTrue(success); 185 | } 186 | [TestMethod] 187 | [TestCategory("Eos Tests")] 188 | public async Task CreateNewAccount() 189 | { 190 | bool success = false; 191 | try 192 | { 193 | await EosUnitTestCases.CreateNewAccount(); 194 | success = true; 195 | } 196 | catch (Exception ex) 197 | { 198 | Console.WriteLine(JsonConvert.SerializeObject(ex)); 199 | } 200 | 201 | Assert.IsTrue(success); 202 | } 203 | } 204 | } -------------------------------------------------------------------------------- /EosSharp/EosSharp.UnitTests/EosUnitTests.tt: -------------------------------------------------------------------------------- 1 | <#@ template debug="false" hostspecific="false" language="C#" #> 2 | <#@ assembly name="System.Core" #> 3 | <#@ import namespace="System.Globalization" #> 4 | <#@ include file=".\..\EosSharp.UnitTests.Core\EosTestCasesDef.t4" #> 5 | <#@ output extension=".cs" #> 6 | // Auto Generated, do not edit. 7 | using EosSharp.Core; 8 | using EosSharp.Core.Api.v1; 9 | using EosSharp.Core.Providers; 10 | using Microsoft.VisualStudio.TestTools.UnitTesting; 11 | using Newtonsoft.Json; 12 | using System; 13 | using System.Threading.Tasks; 14 | 15 | namespace EosSharp.UnitTests 16 | { 17 | [TestClass] 18 | public class EosUnitTests 19 | { 20 | EosUnitTestCases EosUnitTestCases; 21 | public EosUnitTests() 22 | { 23 | var eosConfig = new EosConfigurator() 24 | { 25 | SignProvider = new DefaultSignProvider("5K57oSZLpfzePvQNpsLS6NfKXLhhRARNU13q6u2ZPQCGHgKLbTA"), 26 | 27 | //HttpEndpoint = "https://nodes.eos42.io", //Mainnet 28 | //ChainId = "aca376f206b8fc25a6ed44dbdc66547c36c6c33e3a119ffbeaef943642f0e906" 29 | 30 | HttpEndpoint = "https://jungle2.cryptolions.io", 31 | ChainId = "e70aaab8997e1dfce58fbfac80cbbb8fecec7b99cf982a9444273cbc64c41473" 32 | 33 | //HttpEndpoint = "http://localhost:8888", 34 | //ChainId = "cf057bbfb72640471fd910bcb67639c22df9f92470936cddc1ade0e2f2e7dc4f" 35 | }; 36 | EosUnitTestCases = new EosUnitTestCases(new Eos(eosConfig)); 37 | } 38 | <# foreach (var tc in EosUnitTestCases) { #> 39 | [TestMethod] 40 | [TestCategory("Eos Tests")] 41 | public async Task <#= tc #>() 42 | { 43 | bool success = false; 44 | try 45 | { 46 | await EosUnitTestCases.<#= tc #>(); 47 | success = true; 48 | } 49 | catch (Exception ex) 50 | { 51 | Console.WriteLine(JsonConvert.SerializeObject(ex)); 52 | } 53 | 54 | Assert.IsTrue(success); 55 | } 56 | <# } #> 57 | } 58 | } -------------------------------------------------------------------------------- /EosSharp/EosSharp.UnitTests/MultisigUnitTests.cs: -------------------------------------------------------------------------------- 1 | using Cryptography.ECDSA; 2 | using EosSharp.Core; 3 | using EosSharp.Core.Api.v1; 4 | using EosSharp.Core.Helpers; 5 | using EosSharp.Core.Interfaces; 6 | using EosSharp.Core.Providers; 7 | using Microsoft.VisualStudio.TestTools.UnitTesting; 8 | using Newtonsoft.Json; 9 | using System; 10 | using System.Collections.Generic; 11 | using System.Threading.Tasks; 12 | 13 | namespace EosSharp.UnitTests 14 | { 15 | [TestClass] 16 | public class MultisigUnitTests 17 | { 18 | EosUnitTestCases EosUnitTestCases; 19 | public MultisigUnitTests() 20 | { 21 | var eosConfig = new EosConfigurator() 22 | { 23 | SignProvider = new CombinedSignersProvider(new List() { 24 | new DefaultSignProvider("5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3"), 25 | new DefaultSignProvider("5JjWBn4DKVPe7DSXXXK852CQeEVBQjyqW9s7vbzXAQqxLxca5Hz") 26 | }), 27 | 28 | //HttpEndpoint = "https://nodes.eos42.io", //Mainnet 29 | //ChainId = "aca376f206b8fc25a6ed44dbdc66547c36c6c33e3a119ffbeaef943642f0e906" 30 | 31 | HttpEndpoint = "https://jungle2.cryptolions.io", 32 | ChainId = "e70aaab8997e1dfce58fbfac80cbbb8fecec7b99cf982a9444273cbc64c41473" 33 | 34 | //HttpEndpoint = "http://localhost:8888", 35 | //ChainId = "cf057bbfb72640471fd910bcb67639c22df9f92470936cddc1ade0e2f2e7dc4f" 36 | }; 37 | EosUnitTestCases = new EosUnitTestCases(new Eos(eosConfig)); 38 | } 39 | 40 | [TestMethod] 41 | [TestCategory("Multisig Tests")] 42 | public async Task CreateTransaction2ProvidersAsync() 43 | { 44 | bool success = false; 45 | try 46 | { 47 | await EosUnitTestCases.CreateTransaction2Providers(); 48 | success = true; 49 | } 50 | catch (Exception ex) 51 | { 52 | Console.WriteLine(JsonConvert.SerializeObject(ex)); 53 | } 54 | 55 | Assert.IsTrue(success); 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /EosSharp/EosSharp.UnitTests/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | [assembly: AssemblyTitle("EosSharp.UnitTests")] 6 | [assembly: AssemblyDescription("")] 7 | [assembly: AssemblyConfiguration("")] 8 | [assembly: AssemblyCompany("")] 9 | [assembly: AssemblyProduct("EosSharp.UnitTests")] 10 | [assembly: AssemblyCopyright("Copyright © 2018")] 11 | [assembly: AssemblyTrademark("")] 12 | [assembly: AssemblyCulture("")] 13 | 14 | [assembly: ComVisible(false)] 15 | 16 | [assembly: Guid("969c1a19-c591-4eae-a8f3-ae39878ca2c2")] 17 | 18 | // [assembly: AssemblyVersion("1.0.*")] 19 | [assembly: AssemblyVersion("1.0.0.0")] 20 | [assembly: AssemblyFileVersion("1.0.0.0")] 21 | -------------------------------------------------------------------------------- /EosSharp/EosSharp.UnitTests/SerializationUnitTests.cs: -------------------------------------------------------------------------------- 1 | // Auto Generated, do not edit. 2 | using Microsoft.VisualStudio.TestTools.UnitTesting; 3 | using Newtonsoft.Json; 4 | using System; 5 | 6 | namespace EosSharp.UnitTests 7 | { 8 | [TestClass] 9 | public class SerializationUnitTests 10 | { 11 | SerializationUnitTestCases SerializationUnitTestCases; 12 | public SerializationUnitTests() 13 | { 14 | SerializationUnitTestCases = new SerializationUnitTestCases(); 15 | } 16 | 17 | [TestMethod] 18 | [TestCategory("Serialization Tests")] 19 | public void DoubleSerialization() 20 | { 21 | bool success = false; 22 | try 23 | { 24 | SerializationUnitTestCases.DoubleSerialization(); 25 | success = true; 26 | } 27 | catch (Exception ex) 28 | { 29 | Console.WriteLine(JsonConvert.SerializeObject(ex)); 30 | } 31 | 32 | Assert.IsTrue(success); 33 | } 34 | [TestMethod] 35 | [TestCategory("Serialization Tests")] 36 | public void DecimalSerialization() 37 | { 38 | bool success = false; 39 | try 40 | { 41 | SerializationUnitTestCases.DecimalSerialization(); 42 | success = true; 43 | } 44 | catch (Exception ex) 45 | { 46 | Console.WriteLine(JsonConvert.SerializeObject(ex)); 47 | } 48 | 49 | Assert.IsTrue(success); 50 | } 51 | } 52 | } -------------------------------------------------------------------------------- /EosSharp/EosSharp.UnitTests/SerializationUnitTests.tt: -------------------------------------------------------------------------------- 1 | <#@ template debug="false" hostspecific="false" language="C#" #> 2 | <#@ assembly name="System.Core" #> 3 | <#@ import namespace="System.Globalization" #> 4 | <#@ include file=".\..\EosSharp.UnitTests.Core\EosTestCasesDef.t4" #> 5 | <#@ output extension=".cs" #> 6 | // Auto Generated, do not edit. 7 | using Microsoft.VisualStudio.TestTools.UnitTesting; 8 | using Newtonsoft.Json; 9 | using System; 10 | 11 | namespace EosSharp.UnitTests 12 | { 13 | [TestClass] 14 | public class SerializationUnitTests 15 | { 16 | SerializationUnitTestCases SerializationUnitTestCases; 17 | public SerializationUnitTests() 18 | { 19 | SerializationUnitTestCases = new SerializationUnitTestCases(); 20 | } 21 | 22 | <# foreach (var tc in SerializationUnitTestCases) { #> 23 | [TestMethod] 24 | [TestCategory("Serialization Tests")] 25 | public void <#= tc #>() 26 | { 27 | bool success = false; 28 | try 29 | { 30 | SerializationUnitTestCases.<#= tc #>(); 31 | success = true; 32 | } 33 | catch (Exception ex) 34 | { 35 | Console.WriteLine(JsonConvert.SerializeObject(ex)); 36 | } 37 | 38 | Assert.IsTrue(success); 39 | } 40 | <# } #> 41 | } 42 | } -------------------------------------------------------------------------------- /EosSharp/EosSharp.UnitTests/SignUnitTests.cs: -------------------------------------------------------------------------------- 1 | using Cryptography.ECDSA; 2 | using EosSharp.Core; 3 | using EosSharp.Core.Api.v1; 4 | using EosSharp.Core.Helpers; 5 | using EosSharp.Core.Providers; 6 | using Microsoft.VisualStudio.TestTools.UnitTesting; 7 | using Newtonsoft.Json; 8 | using System; 9 | using System.Collections.Generic; 10 | using System.Linq; 11 | using System.Text; 12 | using System.Threading.Tasks; 13 | 14 | namespace EosSharp.UnitTests 15 | { 16 | [TestClass] 17 | public class SignUnitTests 18 | { 19 | readonly EosConfigurator EosConfig = null; 20 | EosApi DefaultApi { get; set; } 21 | public SignUnitTests() 22 | { 23 | EosConfig = new EosConfigurator() 24 | { 25 | SignProvider = new DefaultSignProvider("5K57oSZLpfzePvQNpsLS6NfKXLhhRARNU13q6u2ZPQCGHgKLbTA"), 26 | 27 | //HttpEndpoint = "https://nodes.eos42.io", //Mainnet 28 | //ChainId = "aca376f206b8fc25a6ed44dbdc66547c36c6c33e3a119ffbeaef943642f0e906" 29 | 30 | HttpEndpoint = "https://jungle2.cryptolions.io", 31 | ChainId = "e70aaab8997e1dfce58fbfac80cbbb8fecec7b99cf982a9444273cbc64c41473" 32 | }; 33 | DefaultApi = new EosApi(EosConfig, new HttpHandler()); 34 | } 35 | 36 | [TestMethod] 37 | [TestCategory("Signature Tests")] 38 | public void GenerateKeyPair() 39 | { 40 | Console.WriteLine(JsonConvert.SerializeObject(CryptoHelper.GenerateKeyPair())); 41 | } 42 | 43 | [TestMethod] 44 | [TestCategory("Signature Tests")] 45 | public void VerifyKeyTypes() 46 | { 47 | var key = CryptoHelper.GenerateKeyPair(); 48 | 49 | CryptoHelper.PrivKeyStringToBytes(key.PrivateKey); 50 | CryptoHelper.PubKeyStringToBytes(key.PublicKey); 51 | 52 | var helloBytes = Encoding.UTF8.GetBytes("Hello world!"); 53 | 54 | var hash = Sha256Manager.GetHash(helloBytes); 55 | 56 | var sign = Secp256K1Manager.SignCompressedCompact(hash, CryptoHelper.GetPrivateKeyBytesWithoutCheckSum(key.PrivateKey)); 57 | var check = new List() { sign, Encoding.UTF8.GetBytes("K1") }; 58 | var checksum = Ripemd160Manager.GetHash(SerializationHelper.Combine(check)).Take(4).ToArray(); 59 | var signAndChecksum = new List() { sign, checksum }; 60 | 61 | CryptoHelper.SignStringToBytes("SIG_K1_" + Base58.Encode(SerializationHelper.Combine(signAndChecksum))); 62 | } 63 | 64 | [TestMethod] 65 | [TestCategory("Signature Tests")] 66 | public void Base64ToByteArray() 67 | { 68 | string base64EncodedData = "DmVvc2lvOjphYmkvMS4wAQxhY2NvdW50X25hbWUEbmFtZQcIdHJhbnNmZXIABARmcm9tDGFjY291bnRfbmFtZQJ0bwxhY2NvdW50X25hbWUIcXVhbnRpdHkFYXNzZXQEbWVtbwZzdHJpbmcGY3JlYXRlAAIGaXNzdWVyDGFjY291bnRfbmFtZQ5tYXhpbXVtX3N1cHBseQVhc3NldAVpc3N1ZQADAnRvDGFjY291bnRfbmFtZQhxdWFudGl0eQVhc3NldARtZW1vBnN0cmluZwZyZXRpcmUAAghxdWFudGl0eQVhc3NldARtZW1vBnN0cmluZwVjbG9zZQACBW93bmVyDGFjY291bnRfbmFtZQZzeW1ib2wGc3ltYm9sB2FjY291bnQAAQdiYWxhbmNlBWFzc2V0DmN1cnJlbmN5X3N0YXRzAAMGc3VwcGx5BWFzc2V0Cm1heF9zdXBwbHkFYXNzZXQGaXNzdWVyDGFjY291bnRfbmFtZQUAAABXLTzNzQh0cmFuc2ZlcucFIyMgVHJhbnNmZXIgVGVybXMgJiBDb25kaXRpb25zCgpJLCB7e2Zyb219fSwgY2VydGlmeSB0aGUgZm9sbG93aW5nIHRvIGJlIHRydWUgdG8gdGhlIGJlc3Qgb2YgbXkga25vd2xlZGdlOgoKMS4gSSBjZXJ0aWZ5IHRoYXQge3txdWFudGl0eX19IGlzIG5vdCB0aGUgcHJvY2VlZHMgb2YgZnJhdWR1bGVudCBvciB2aW9sZW50IGFjdGl2aXRpZXMuCjIuIEkgY2VydGlmeSB0aGF0LCB0byB0aGUgYmVzdCBvZiBteSBrbm93bGVkZ2UsIHt7dG99fSBpcyBub3Qgc3VwcG9ydGluZyBpbml0aWF0aW9uIG9mIHZpb2xlbmNlIGFnYWluc3Qgb3RoZXJzLgozLiBJIGhhdmUgZGlzY2xvc2VkIGFueSBjb250cmFjdHVhbCB0ZXJtcyAmIGNvbmRpdGlvbnMgd2l0aCByZXNwZWN0IHRvIHt7cXVhbnRpdHl9fSB0byB7e3RvfX0uCgpJIHVuZGVyc3RhbmQgdGhhdCBmdW5kcyB0cmFuc2ZlcnMgYXJlIG5vdCByZXZlcnNpYmxlIGFmdGVyIHRoZSB7e3RyYW5zYWN0aW9uLmRlbGF5fX0gc2Vjb25kcyBvciBvdGhlciBkZWxheSBhcyBjb25maWd1cmVkIGJ5IHt7ZnJvbX19J3MgcGVybWlzc2lvbnMuCgpJZiB0aGlzIGFjdGlvbiBmYWlscyB0byBiZSBpcnJldmVyc2libHkgY29uZmlybWVkIGFmdGVyIHJlY2VpdmluZyBnb29kcyBvciBzZXJ2aWNlcyBmcm9tICd7e3RvfX0nLCBJIGFncmVlIHRvIGVpdGhlciByZXR1cm4gdGhlIGdvb2RzIG9yIHNlcnZpY2VzIG9yIHJlc2VuZCB7e3F1YW50aXR5fX0gaW4gYSB0aW1lbHkgbWFubmVyLgoAAAAAAKUxdgVpc3N1ZQAAAAAAqGzURQZjcmVhdGUAAAAAAKjrsroGcmV0aXJlAAAAAAAAhWlEBWNsb3NlAAIAAAA4T00RMgNpNjQBCGN1cnJlbmN5AQZ1aW50NjQHYWNjb3VudAAAAAAAkE3GA2k2NAEIY3VycmVuY3kBBnVpbnQ2NA5jdXJyZW5jeV9zdGF0cwAAAA==="; 69 | var base64EncodedBytes = SerializationHelper.Base64FcStringToByteArray(base64EncodedData); 70 | } 71 | 72 | [TestMethod] 73 | [TestCategory("Signature Tests")] 74 | public async Task SignProvider() 75 | { 76 | var signProvider = new DefaultSignProvider("5K57oSZLpfzePvQNpsLS6NfKXLhhRARNU13q6u2ZPQCGHgKLbTA"); 77 | var requiredKeys = new List() { "EOS8Q8CJqwnSsV4A6HDBEqmQCqpQcBnhGME1RUvydDRnswNngpqfr" }; 78 | 79 | Assert.IsTrue((await signProvider.GetAvailableKeys()).All(ak => requiredKeys.Contains(ak))); 80 | } 81 | 82 | [TestMethod] 83 | [TestCategory("Signature Tests")] 84 | public void SignParse() 85 | { 86 | var signature = "SIG_K1_KZoEShDrNxiAQq8rYafahdudAESBAfHQxU7ihavonMDMND4jNSHhk9q4UVbs7tTLK6RidFmFmSruipEM1chyxFgN46meSF"; 87 | var keyBytes = CryptoHelper.SignStringToBytes(signature); 88 | } 89 | 90 | [TestMethod] 91 | [TestCategory("Signature Tests")] 92 | public async Task SignHelloWorld() 93 | { 94 | var requiredKeys = new List() { "EOS8Q8CJqwnSsV4A6HDBEqmQCqpQcBnhGME1RUvydDRnswNngpqfr" }; 95 | var helloBytes = Encoding.UTF8.GetBytes("Hello world!"); 96 | var signatures = await EosConfig.SignProvider.Sign(DefaultApi.Config.ChainId, requiredKeys, helloBytes); 97 | 98 | Assert.IsTrue(signatures.First() == "SIG_K1_KZ16wreoktSNYiiJaR3DgUW3QNSHYvhqXcZDc1nvKdFJ7h2HTQPofmBYJos3VgJ1q1ZjCnJQCN6ffagyQL4g9imXD9Fm8m"); 99 | } 100 | 101 | [TestMethod] 102 | [TestCategory("Signature Tests")] 103 | public async Task SignTransaction() 104 | { 105 | var trx = new Transaction() 106 | { 107 | // trx info 108 | max_net_usage_words = 0, 109 | max_cpu_usage_ms = 0, 110 | delay_sec = 0, 111 | context_free_actions = new List(), 112 | transaction_extensions = new List(), 113 | actions = new List() 114 | { 115 | new Core.Api.v1.Action() 116 | { 117 | account = "eosio.token", 118 | authorization = new List() 119 | { 120 | new PermissionLevel() {actor = "tester112345", permission = "active" } 121 | }, 122 | name = "transfer", 123 | data = new { from = "tester112345", to = "tester212345", quantity = "1.0000 EOS", memo = "hello crypto world!" } 124 | } 125 | } 126 | }; 127 | 128 | var abiSerializer = new AbiSerializationProvider(DefaultApi); 129 | var packedTrx = await abiSerializer.SerializePackedTransaction(trx); 130 | var requiredKeys = new List() { "EOS8Q8CJqwnSsV4A6HDBEqmQCqpQcBnhGME1RUvydDRnswNngpqfr" }; 131 | var signatures = await EosConfig.SignProvider.Sign(DefaultApi.Config.ChainId, requiredKeys, packedTrx); 132 | 133 | Assert.IsTrue(signatures.First() == "SIG_K1_KVsYuAMd2gopMCsCPxgUMCaPRMvtnMVTbbEDSujBSw6TVeu7v7xHFRYT2Y6nBKSKS6hHjjJE6YZQNdbrMYX71FibTatikf"); 134 | } 135 | 136 | [TestMethod] 137 | [TestCategory("Signature Tests")] 138 | public async Task DeserializePackedTransaction() 139 | { 140 | var packed_trx = ""; 141 | var abiSerializer = new AbiSerializationProvider(DefaultApi); 142 | var trx = await abiSerializer.DeserializePackedTransaction(packed_trx); 143 | Console.WriteLine(JsonConvert.SerializeObject(trx)); 144 | } 145 | } 146 | } 147 | -------------------------------------------------------------------------------- /EosSharp/EosSharp.UnitTests/StressUnitTests.cs: -------------------------------------------------------------------------------- 1 | using EosSharp.Core; 2 | using EosSharp.Core.Providers; 3 | using Microsoft.VisualStudio.TestTools.UnitTesting; 4 | using Newtonsoft.Json; 5 | using System; 6 | using System.Collections.Generic; 7 | using System.Linq; 8 | using System.Text; 9 | using System.Threading.Tasks; 10 | 11 | namespace EosSharp.UnitTests 12 | { 13 | [TestClass] 14 | public class StressUnitTests 15 | { 16 | Eos Eos { get; set; } 17 | public StressUnitTests() 18 | { 19 | Eos = new Eos(new EosConfigurator() 20 | { 21 | SignProvider = new DefaultSignProvider("5K57oSZLpfzePvQNpsLS6NfKXLhhRARNU13q6u2ZPQCGHgKLbTA"), 22 | 23 | HttpEndpoint = "https://api.eossweden.se", //Mainnet 24 | ChainId = "aca376f206b8fc25a6ed44dbdc66547c36c6c33e3a119ffbeaef943642f0e906" 25 | 26 | //HttpEndpoint = "https://nodeos01.btuga.io", 27 | //ChainId = "cf057bbfb72640471fd910bcb67639c22df9f92470936cddc1ade0e2f2e7dc4f" 28 | }); 29 | } 30 | 31 | [TestMethod] 32 | [TestCategory("Stress Tests")] 33 | public async Task GetBlockTaskLoop() 34 | { 35 | bool success = false; 36 | int nrTasks = 50; 37 | int nrBlocks = 1000; 38 | int blockStartPos = 100; 39 | int taskBlocks = nrBlocks / nrTasks; 40 | 41 | try 42 | { 43 | List tasks = new List(); 44 | 45 | for (int i = 0; i < nrTasks; i++) 46 | { 47 | tasks.Add(Task.Factory.StartNew(async (taskIdObj) => 48 | { 49 | int taskId = taskIdObj as int? ?? 0; 50 | for (int j = 1; j <= taskBlocks; j++) 51 | { 52 | try 53 | { 54 | await Eos.GetBlock((taskId * taskBlocks + blockStartPos + j).ToString()); 55 | } 56 | catch (Exception ex) 57 | { 58 | Console.WriteLine(JsonConvert.SerializeObject(ex)); 59 | } 60 | } 61 | }, i).Unwrap()); 62 | } 63 | 64 | await Task.WhenAll(tasks.ToArray()); 65 | 66 | success = true; 67 | } 68 | catch (Exception ex) 69 | { 70 | Console.WriteLine(JsonConvert.SerializeObject(ex)); 71 | } 72 | 73 | Assert.IsTrue(success); 74 | } 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /EosSharp/EosSharp.UnitTests/app.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /EosSharp/EosSharp.UnitTests/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /EosSharp/EosSharp.Unity3D/Eos.cs: -------------------------------------------------------------------------------- 1 | using EosSharp.Core; 2 | 3 | namespace EosSharp.Unity3D 4 | { 5 | /// 6 | /// EOSIO client wrapper using general purpose HttpHandler 7 | /// 8 | public class Eos : EosBase 9 | { 10 | /// 11 | /// EOSIO Client wrapper constructor. 12 | /// 13 | /// Configures client parameters 14 | public Eos(EosConfigurator configuratior) : 15 | base(configuratior, new HttpHandler()) 16 | { 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /EosSharp/EosSharp.Unity3D/EosSharp.Unity3D.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netstandard2.0 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | C:\Program Files\Unity\Editor\Data\Managed\UnityEditor.dll 19 | C:\Program Files\Unity\Hub\Editor\2019.1.7f1\Editor\Data\Managed\UnityEditor.dll 20 | 21 | 22 | C:\Program Files\Unity\Editor\Data\Managed\UnityEngine.dll 23 | C:\Program Files\Unity\Hub\Editor\2019.1.7f1\Editor\Data\Managed\UnityEngine.dll 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /EosSharp/EosSharp.Unity3D/HttpHelper.cs: -------------------------------------------------------------------------------- 1 | using Cryptography.ECDSA; 2 | using EosSharp.Core.Exceptions; 3 | using EosSharp.Core.Helpers; 4 | using EosSharp.Core.Interfaces; 5 | using Newtonsoft.Json; 6 | using System; 7 | using System.Collections.Generic; 8 | using System.IO; 9 | using System.Net.Http; 10 | using System.Text; 11 | using System.Threading; 12 | using System.Threading.Tasks; 13 | using UnityEngine; 14 | using UnityEngine.Networking; 15 | 16 | namespace EosSharp.Unity3D 17 | { 18 | public class HttpHandler : IHttpHandler 19 | { 20 | private static readonly HttpClient client = new HttpClient(); 21 | private static Dictionary ResponseCache { get; set; } = new Dictionary(); 22 | 23 | /// 24 | /// Clear cached responses from requests called with Post/GetWithCacheAsync 25 | /// 26 | public void ClearResponseCache() 27 | { 28 | ResponseCache.Clear(); 29 | } 30 | 31 | /// 32 | /// Make post request with data converted to json asynchronously 33 | /// 34 | /// Response type 35 | /// Url to send the request 36 | /// data sent in the body 37 | /// Response data deserialized to type TResponseData 38 | public async Task PostJsonAsync(string url, object data) 39 | { 40 | UnityWebRequest uwr = BuildUnityWebRequest(url, UnityWebRequest.kHttpVerbPOST, data); 41 | 42 | await uwr.SendWebRequest(); 43 | CheckUnityWebRequestErrors(uwr); 44 | 45 | return JsonConvert.DeserializeObject(uwr.downloadHandler.text); 46 | } 47 | 48 | /// 49 | /// Make post request with data converted to json asynchronously 50 | /// 51 | /// Response type 52 | /// Url to send the request 53 | /// data sent in the body 54 | /// Notification that operation should be canceled 55 | /// Response data deserialized to type TResponseData 56 | public Task PostJsonAsync(string url, object data, CancellationToken cancellationToken) 57 | { 58 | return PostJsonAsync(url, data); 59 | } 60 | 61 | /// 62 | /// Make post request with data converted to json asynchronously. 63 | /// Response is cached based on input (url, data) 64 | /// 65 | /// Response type 66 | /// Url to send the request 67 | /// data sent in the body 68 | /// ignore cached value and make a request caching the result 69 | /// Response data deserialized to type TResponseData 70 | public async Task PostJsonWithCacheAsync(string url, object data, bool reload = false) 71 | { 72 | string hashKey = GetRequestHashKey(url, data); 73 | 74 | if (!reload) 75 | { 76 | object value; 77 | if (ResponseCache.TryGetValue(hashKey, out value)) 78 | return (TResponseData)value; 79 | } 80 | 81 | UnityWebRequest uwr = BuildUnityWebRequest(url, UnityWebRequest.kHttpVerbPOST, data); 82 | 83 | await uwr.SendWebRequest(); 84 | CheckUnityWebRequestErrors(uwr); 85 | 86 | return JsonConvert.DeserializeObject(uwr.downloadHandler.text); 87 | } 88 | 89 | /// 90 | /// Make post request with data converted to json asynchronously. 91 | /// Response is cached based on input (url, data) 92 | /// 93 | /// Response type 94 | /// Url to send the request 95 | /// data sent in the body 96 | /// Notification that operation should be canceled 97 | /// ignore cached value and make a request caching the result 98 | /// Response data deserialized to type TResponseData 99 | public Task PostJsonWithCacheAsync(string url, object data, CancellationToken cancellationToken, bool reload = false) 100 | { 101 | return PostJsonWithCacheAsync(url, data, reload); 102 | } 103 | 104 | /// 105 | /// Make get request asynchronously. 106 | /// 107 | /// Response type 108 | /// Url to send the request 109 | /// Response data deserialized to type TResponseData 110 | public async Task GetJsonAsync(string url) 111 | { 112 | UnityWebRequest uwr = UnityWebRequest.Get(url); 113 | 114 | await uwr.SendWebRequest(); 115 | CheckUnityWebRequestErrors(uwr); 116 | 117 | return JsonConvert.DeserializeObject(uwr.downloadHandler.text); 118 | } 119 | 120 | /// 121 | /// Make get request asynchronously. 122 | /// 123 | /// Response type 124 | /// Url to send the request 125 | /// Notification that operation should be canceled 126 | /// Response data deserialized to type TResponseData 127 | public Task GetJsonAsync(string url, CancellationToken cancellationToken) 128 | { 129 | return GetJsonAsync(url); 130 | } 131 | 132 | /// 133 | /// Generic http request sent asynchronously 134 | /// 135 | /// request body 136 | /// Stream with response 137 | public async Task SendAsync(HttpRequestMessage request) 138 | { 139 | var response = await client.SendAsync(request, HttpCompletionOption.ResponseHeadersRead); 140 | return await BuildSendResponse(response); 141 | } 142 | 143 | /// 144 | /// Generic http request sent asynchronously 145 | /// 146 | /// request body 147 | /// /// Notification that operation should be canceled 148 | /// Stream with response 149 | public async Task SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) 150 | { 151 | var response = await client.SendAsync(request, HttpCompletionOption.ResponseHeadersRead, cancellationToken); 152 | return await BuildSendResponse(response); 153 | } 154 | 155 | /// 156 | /// Upsert response data in the data store 157 | /// 158 | /// response data type 159 | /// data key 160 | /// response data 161 | public void UpdateResponseDataCache(string hashKey, TResponseData responseData) 162 | { 163 | if (ResponseCache.ContainsKey(hashKey)) 164 | { 165 | ResponseCache[hashKey] = responseData; 166 | } 167 | else 168 | { 169 | ResponseCache.Add(hashKey, responseData); 170 | } 171 | } 172 | 173 | /// 174 | /// Calculate request unique hash key 175 | /// 176 | /// Url to send the request 177 | /// data sent in the body 178 | /// 179 | public string GetRequestHashKey(string url, object data) 180 | { 181 | var keyBytes = new List() 182 | { 183 | Encoding.UTF8.GetBytes(url), 184 | SerializationHelper.ObjectToByteArray(data) 185 | }; 186 | return Encoding.Default.GetString(Sha256Manager.GetHash(SerializationHelper.Combine(keyBytes))); 187 | } 188 | 189 | /// 190 | /// Convert response to stream 191 | /// 192 | /// response object 193 | /// Stream with response 194 | public async Task BuildSendResponse(HttpResponseMessage response) 195 | { 196 | var stream = await response.Content.ReadAsStreamAsync(); 197 | 198 | if (response.IsSuccessStatusCode) 199 | return stream; 200 | 201 | var content = await StreamToStringAsync(stream); 202 | throw BuildApiError(content, (int)response.StatusCode); 203 | } 204 | 205 | /// 206 | /// Convert stream to a string 207 | /// 208 | /// 209 | /// 210 | public async Task StreamToStringAsync(Stream stream) 211 | { 212 | string content = null; 213 | 214 | if (stream != null) 215 | using (var sr = new StreamReader(stream)) 216 | content = await sr.ReadToEndAsync(); 217 | 218 | return content; 219 | } 220 | 221 | /// 222 | /// Build unity web request 223 | /// 224 | /// Url to send the request 225 | /// Http verb 226 | /// data sent in the body 227 | /// 228 | private static UnityWebRequest BuildUnityWebRequest(string url, string verb, object data) 229 | { 230 | var uwr = new UnityWebRequest(url, verb) 231 | { 232 | uploadHandler = (UploadHandler)new UploadHandlerRaw(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(data))), 233 | downloadHandler = (DownloadHandler)new DownloadHandlerBuffer() 234 | }; 235 | 236 | uwr.SetRequestHeader("Content-Type", "application/json"); 237 | return uwr; 238 | } 239 | 240 | /// 241 | /// Build Api Error from response content and http status code 242 | /// 243 | /// content to build 244 | /// status code 245 | /// ApiError object 246 | private static ApiErrorException BuildApiError(string content, int statusCode = 0) 247 | { 248 | ApiErrorException apiError; 249 | try 250 | { 251 | apiError = JsonConvert.DeserializeObject(content); 252 | } 253 | catch (Exception) 254 | { 255 | throw new ApiException() 256 | { 257 | StatusCode = statusCode, 258 | Content = content 259 | }; 260 | } 261 | 262 | return apiError; 263 | } 264 | 265 | /// 266 | /// Checks Unity web request for errors and throws 267 | /// 268 | /// 269 | private static void CheckUnityWebRequestErrors(UnityWebRequest uwr) 270 | { 271 | if (uwr.isNetworkError) 272 | { 273 | throw BuildApiError("Error While Sending: " + uwr.error, (int)uwr.responseCode); 274 | } 275 | else if (uwr.isHttpError) 276 | { 277 | throw BuildApiError(uwr.downloadHandler.text, (int)uwr.responseCode); 278 | } 279 | } 280 | } 281 | } 282 | -------------------------------------------------------------------------------- /EosSharp/EosSharp.Unity3D/UnityWebRequestAwaiter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.CompilerServices; 3 | using UnityEngine; 4 | using UnityEngine.Networking; 5 | 6 | namespace EosSharp.Unity3D 7 | { 8 | /// 9 | /// Class to implement async / awayt on a UnityWebRequest class 10 | /// 11 | public class UnityWebRequestAwaiter : INotifyCompletion 12 | { 13 | private UnityWebRequestAsyncOperation asyncOp; 14 | private Action continuation; 15 | 16 | public UnityWebRequestAwaiter(UnityWebRequestAsyncOperation asyncOp) 17 | { 18 | this.asyncOp = asyncOp; 19 | asyncOp.completed += OnRequestCompleted; 20 | } 21 | 22 | public bool IsCompleted { get { return asyncOp.isDone; } } 23 | 24 | public void GetResult() { } 25 | 26 | public void OnCompleted(Action continuation) 27 | { 28 | this.continuation = continuation; 29 | } 30 | 31 | private void OnRequestCompleted(AsyncOperation obj) 32 | { 33 | if(continuation != null) 34 | continuation(); 35 | } 36 | } 37 | 38 | /// 39 | /// Extender to augment UnityWebRequest clas 40 | /// 41 | public static class ExtensionMethods 42 | { 43 | public static UnityWebRequestAwaiter GetAwaiter(this UnityWebRequestAsyncOperation asyncOp) 44 | { 45 | return new UnityWebRequestAwaiter(asyncOp); 46 | } 47 | } 48 | } -------------------------------------------------------------------------------- /EosSharp/EosSharp.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.28803.202 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EosSharp", "EosSharp\EosSharp.csproj", "{A7498DEA-BECB-49CE-9E9D-E06FDFA29E5A}" 7 | EndProject 8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EosSharp.UnitTests", "EosSharp.UnitTests\EosSharp.UnitTests.csproj", "{969C1A19-C591-4EAE-A8F3-AE39878CA2C2}" 9 | EndProject 10 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EosSharp.Core", "EosSharp.Core\EosSharp.Core.csproj", "{7F63BFD8-AC29-419F-A532-CC6DDEEF1B46}" 11 | EndProject 12 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EosSharp.Unity3D", "EosSharp.Unity3D\EosSharp.Unity3D.csproj", "{1A2FC066-2DCE-43DC-8E5A-6FE10505DFA9}" 13 | EndProject 14 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EosSharp.UnitTests.Unity3D", "EosSharp.UnitTests.Unity3D\EosSharp.UnitTests.Unity3D.csproj", "{3F15E919-D4FA-4960-ACB2-AF5F486C1D58}" 15 | EndProject 16 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EosSharp.UnitTests.Core", "EosSharp.UnitTests.Core\EosSharp.UnitTests.Core.csproj", "{FE13B07E-BBC9-4142-B653-AFFBD567C4F6}" 17 | EndProject 18 | Global 19 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 20 | Debug|Any CPU = Debug|Any CPU 21 | Release|Any CPU = Release|Any CPU 22 | EndGlobalSection 23 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 24 | {A7498DEA-BECB-49CE-9E9D-E06FDFA29E5A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 25 | {A7498DEA-BECB-49CE-9E9D-E06FDFA29E5A}.Debug|Any CPU.Build.0 = Debug|Any CPU 26 | {A7498DEA-BECB-49CE-9E9D-E06FDFA29E5A}.Release|Any CPU.ActiveCfg = Release|Any CPU 27 | {A7498DEA-BECB-49CE-9E9D-E06FDFA29E5A}.Release|Any CPU.Build.0 = Release|Any CPU 28 | {969C1A19-C591-4EAE-A8F3-AE39878CA2C2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 29 | {969C1A19-C591-4EAE-A8F3-AE39878CA2C2}.Debug|Any CPU.Build.0 = Debug|Any CPU 30 | {969C1A19-C591-4EAE-A8F3-AE39878CA2C2}.Release|Any CPU.ActiveCfg = Release|Any CPU 31 | {969C1A19-C591-4EAE-A8F3-AE39878CA2C2}.Release|Any CPU.Build.0 = Release|Any CPU 32 | {7F63BFD8-AC29-419F-A532-CC6DDEEF1B46}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 33 | {7F63BFD8-AC29-419F-A532-CC6DDEEF1B46}.Debug|Any CPU.Build.0 = Debug|Any CPU 34 | {7F63BFD8-AC29-419F-A532-CC6DDEEF1B46}.Release|Any CPU.ActiveCfg = Release|Any CPU 35 | {7F63BFD8-AC29-419F-A532-CC6DDEEF1B46}.Release|Any CPU.Build.0 = Release|Any CPU 36 | {1A2FC066-2DCE-43DC-8E5A-6FE10505DFA9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 37 | {1A2FC066-2DCE-43DC-8E5A-6FE10505DFA9}.Debug|Any CPU.Build.0 = Debug|Any CPU 38 | {1A2FC066-2DCE-43DC-8E5A-6FE10505DFA9}.Release|Any CPU.ActiveCfg = Release|Any CPU 39 | {1A2FC066-2DCE-43DC-8E5A-6FE10505DFA9}.Release|Any CPU.Build.0 = Release|Any CPU 40 | {3F15E919-D4FA-4960-ACB2-AF5F486C1D58}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 41 | {3F15E919-D4FA-4960-ACB2-AF5F486C1D58}.Debug|Any CPU.Build.0 = Debug|Any CPU 42 | {3F15E919-D4FA-4960-ACB2-AF5F486C1D58}.Release|Any CPU.ActiveCfg = Release|Any CPU 43 | {3F15E919-D4FA-4960-ACB2-AF5F486C1D58}.Release|Any CPU.Build.0 = Release|Any CPU 44 | {FE13B07E-BBC9-4142-B653-AFFBD567C4F6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 45 | {FE13B07E-BBC9-4142-B653-AFFBD567C4F6}.Debug|Any CPU.Build.0 = Debug|Any CPU 46 | {FE13B07E-BBC9-4142-B653-AFFBD567C4F6}.Release|Any CPU.ActiveCfg = Release|Any CPU 47 | {FE13B07E-BBC9-4142-B653-AFFBD567C4F6}.Release|Any CPU.Build.0 = Release|Any CPU 48 | EndGlobalSection 49 | GlobalSection(SolutionProperties) = preSolution 50 | HideSolutionNode = FALSE 51 | EndGlobalSection 52 | GlobalSection(ExtensibilityGlobals) = postSolution 53 | SolutionGuid = {C51E9EF5-EF8A-4B8D-A434-E1B6C05A89AD} 54 | EndGlobalSection 55 | EndGlobal 56 | -------------------------------------------------------------------------------- /EosSharp/EosSharp/Eos.cs: -------------------------------------------------------------------------------- 1 | using EosSharp.Core; 2 | 3 | namespace EosSharp 4 | { 5 | /// 6 | /// EOSIO client wrapper using general purpose HttpHandler 7 | /// 8 | public class Eos : EosBase 9 | { 10 | /// 11 | /// EOSIO Client wrapper constructor. 12 | /// 13 | /// Configures client parameters 14 | public Eos(EosConfigurator config) : 15 | base(config, new HttpHandler()) 16 | { 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /EosSharp/EosSharp/EosSharp.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | netstandard2.0 5 | Mário Silva 6 | GetScatter 7 | EOS, NetStandard, secp256k1, Blockchain 8 | C# client library for EOSIO blockchains. The library is based on https://github.com/EOSIO/eosjs and MIT licensed. 9 | https://github.com/GetScatter/eos-sharp/blob/master/LICENSE 10 | https://github.com/GetScatter/eos-sharp 11 | https://github.com/GetScatter/eos-sharp 12 | git 13 | Copyright 2019 14 | eos-sharp 15 | eos-sharp 16 | 2.2.0.0 17 | 2.2.0.0 18 | 2.2.0 19 | Fix Use convert ToDecimal instead of explicit cast 20 | Fix object to float conversion InvalidCastException (by KGMaxey) 21 | Add support for variant fields 22 | Add support for binary extension types (by dbulha) 23 | Add block_num_hint to gettransaction (by dbulha) 24 | Changed authority accounts to use permission level (by dbulha) 25 | false 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 46 | 47 | $(TargetsForTfmSpecificBuildOutput);CopyProjectReferencesToPackage 48 | 49 | $(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /EosSharp/EosSharp/HttpHelper.cs: -------------------------------------------------------------------------------- 1 | using Cryptography.ECDSA; 2 | using EosSharp.Core.Exceptions; 3 | using EosSharp.Core.Helpers; 4 | using EosSharp.Core.Interfaces; 5 | using Newtonsoft.Json; 6 | using System; 7 | using System.Collections.Generic; 8 | using System.IO; 9 | using System.Net.Http; 10 | using System.Text; 11 | using System.Threading; 12 | using System.Threading.Tasks; 13 | 14 | namespace EosSharp 15 | { 16 | /// 17 | /// Http Handler implementation using System.Net.Http.HttpClient 18 | /// 19 | public class HttpHandler : IHttpHandler 20 | { 21 | private static readonly HttpClient client = new HttpClient(); 22 | private static Dictionary ResponseCache { get; set; } = new Dictionary(); 23 | 24 | /// 25 | /// Clear cached responses from requests called with Post/GetWithCacheAsync 26 | /// 27 | public void ClearResponseCache() 28 | { 29 | ResponseCache.Clear(); 30 | } 31 | 32 | /// 33 | /// Make post request with data converted to json asynchronously 34 | /// 35 | /// Response type 36 | /// Url to send the request 37 | /// data sent in the body 38 | /// Response data deserialized to type TResponseData 39 | public async Task PostJsonAsync(string url, object data) 40 | { 41 | HttpRequestMessage request = BuildJsonRequestMessage(url, data); 42 | var result = await SendAsync(request); 43 | return DeserializeJsonFromStream(result); 44 | } 45 | 46 | /// 47 | /// Make post request with data converted to json asynchronously 48 | /// 49 | /// Response type 50 | /// Url to send the request 51 | /// data sent in the body 52 | /// Notification that operation should be canceled 53 | /// Response data deserialized to type TResponseData 54 | public async Task PostJsonAsync(string url, object data, CancellationToken cancellationToken) 55 | { 56 | HttpRequestMessage request = BuildJsonRequestMessage(url, data); 57 | var result = await SendAsync(request, cancellationToken); 58 | return DeserializeJsonFromStream(result); 59 | } 60 | 61 | /// 62 | /// Make post request with data converted to json asynchronously. 63 | /// Response is cached based on input (url, data) 64 | /// 65 | /// Response type 66 | /// Url to send the request 67 | /// data sent in the body 68 | /// ignore cached value and make a request caching the result 69 | /// Response data deserialized to type TResponseData 70 | public async Task PostJsonWithCacheAsync(string url, object data, bool reload = false) 71 | { 72 | string hashKey = GetRequestHashKey(url, data); 73 | 74 | if (!reload) 75 | { 76 | object value; 77 | if (ResponseCache.TryGetValue(hashKey, out value)) 78 | return (TResponseData)value; 79 | } 80 | 81 | HttpRequestMessage request = BuildJsonRequestMessage(url, data); 82 | var result = await SendAsync(request); 83 | var responseData = DeserializeJsonFromStream(result); 84 | UpdateResponseDataCache(hashKey, responseData); 85 | 86 | return responseData; 87 | } 88 | 89 | /// 90 | /// Make post request with data converted to json asynchronously. 91 | /// Response is cached based on input (url, data) 92 | /// 93 | /// Response type 94 | /// Url to send the request 95 | /// data sent in the body 96 | /// Notification that operation should be canceled 97 | /// ignore cached value and make a request caching the result 98 | /// Response data deserialized to type TResponseData 99 | public async Task PostJsonWithCacheAsync(string url, object data, CancellationToken cancellationToken, bool reload = false) 100 | { 101 | string hashKey = GetRequestHashKey(url, data); 102 | 103 | if (!reload) 104 | { 105 | object value; 106 | if (ResponseCache.TryGetValue(hashKey, out value)) 107 | return (TResponseData)value; 108 | } 109 | 110 | HttpRequestMessage request = BuildJsonRequestMessage(url, data); 111 | var result = await SendAsync(request, cancellationToken); 112 | var responseData = DeserializeJsonFromStream(result); 113 | UpdateResponseDataCache(hashKey, responseData); 114 | 115 | return responseData; 116 | } 117 | 118 | /// 119 | /// Make get request asynchronously. 120 | /// 121 | /// Response type 122 | /// Url to send the request 123 | /// Response data deserialized to type TResponseData 124 | public async Task GetJsonAsync(string url) 125 | { 126 | var request = new HttpRequestMessage(HttpMethod.Get, url); 127 | var result = await SendAsync(request); 128 | return DeserializeJsonFromStream(result); 129 | } 130 | 131 | /// 132 | /// Make get request asynchronously. 133 | /// 134 | /// Response type 135 | /// Url to send the request 136 | /// Notification that operation should be canceled 137 | /// Response data deserialized to type TResponseData 138 | public async Task GetJsonAsync(string url, CancellationToken cancellationToken) 139 | { 140 | var request = new HttpRequestMessage(HttpMethod.Get, url); 141 | var result = await SendAsync(request, cancellationToken); 142 | return DeserializeJsonFromStream(result); 143 | } 144 | 145 | /// 146 | /// Generic http request sent asynchronously 147 | /// 148 | /// request body 149 | /// Stream with response 150 | public async Task SendAsync(HttpRequestMessage request) 151 | { 152 | var response = await client.SendAsync(request, HttpCompletionOption.ResponseHeadersRead); 153 | return await BuildSendResponse(response); 154 | } 155 | 156 | /// 157 | /// Generic http request sent asynchronously 158 | /// 159 | /// request body 160 | /// /// Notification that operation should be canceled 161 | /// Stream with response 162 | public async Task SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) 163 | { 164 | var response = await client.SendAsync(request, HttpCompletionOption.ResponseHeadersRead, cancellationToken); 165 | return await BuildSendResponse(response); 166 | } 167 | 168 | /// 169 | /// Upsert response data in the data store 170 | /// 171 | /// response data type 172 | /// data key 173 | /// response data 174 | public void UpdateResponseDataCache(string hashKey, TResponseData responseData) 175 | { 176 | if (ResponseCache.ContainsKey(hashKey)) 177 | { 178 | ResponseCache[hashKey] = responseData; 179 | } 180 | else 181 | { 182 | ResponseCache.Add(hashKey, responseData); 183 | } 184 | } 185 | 186 | /// 187 | /// Calculate request unique hash key 188 | /// 189 | /// Url to send the request 190 | /// data sent in the body 191 | /// 192 | public string GetRequestHashKey(string url, object data) 193 | { 194 | var keyBytes = new List() 195 | { 196 | Encoding.UTF8.GetBytes(url), 197 | SerializationHelper.ObjectToByteArray(data) 198 | }; 199 | return Encoding.Default.GetString(Sha256Manager.GetHash(SerializationHelper.Combine(keyBytes))); 200 | } 201 | 202 | /// 203 | /// Convert response to stream 204 | /// 205 | /// response object 206 | /// Stream with response 207 | public async Task BuildSendResponse(HttpResponseMessage response) 208 | { 209 | var stream = await response.Content.ReadAsStreamAsync(); 210 | 211 | if (response.IsSuccessStatusCode) 212 | return stream; 213 | 214 | var content = await StreamToStringAsync(stream); 215 | 216 | ApiErrorException apiError = null; 217 | try 218 | { 219 | apiError = JsonConvert.DeserializeObject(content); 220 | } 221 | catch(Exception) 222 | { 223 | throw new ApiException 224 | { 225 | StatusCode = (int)response.StatusCode, 226 | Content = content 227 | }; 228 | } 229 | 230 | throw apiError; 231 | } 232 | 233 | /// 234 | /// Convert stream to a string 235 | /// 236 | /// 237 | /// 238 | public async Task StreamToStringAsync(Stream stream) 239 | { 240 | string content = null; 241 | 242 | if (stream != null) 243 | using (var sr = new StreamReader(stream)) 244 | content = await sr.ReadToEndAsync(); 245 | 246 | return content; 247 | } 248 | 249 | /// 250 | /// Generic method to convert a stream with json data to any type 251 | /// 252 | /// type to convert 253 | /// stream with json content 254 | /// TData object 255 | public TData DeserializeJsonFromStream(Stream stream) 256 | { 257 | if (stream == null || stream.CanRead == false) 258 | return default(TData); 259 | 260 | using (var sr = new StreamReader(stream)) 261 | using (var jtr = new JsonTextReader(sr)) 262 | { 263 | return JsonSerializer.Create().Deserialize(jtr); 264 | } 265 | } 266 | 267 | /// 268 | /// Build json request data from object data 269 | /// 270 | /// Url to send the request 271 | /// object data 272 | /// request message 273 | public HttpRequestMessage BuildJsonRequestMessage(string url, object data) 274 | { 275 | return new HttpRequestMessage(HttpMethod.Post, url) 276 | { 277 | Content = new StringContent(JsonConvert.SerializeObject(data), Encoding.UTF8, "application/json") 278 | }; 279 | } 280 | } 281 | } 282 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019, Respective Authors all rights reserved. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # This library is not actively maintained 2 | 3 | # eos-sharp 4 | C# client library for EOSIO blockchains. The library is based on https://github.com/EOSIO/eosjs and MIT licensed. 5 | 6 | ``` 7 | Install-Package eos-sharp 8 | ``` 9 | 10 | ### Prerequisite to build 11 | 12 | Visual Studio 2017+ 13 | 14 | ### Instalation 15 | eos-sharp is now available through nuget https://www.nuget.org/packages/eos-sharp 16 | 17 | ``` 18 | Install-Package eos-sharp 19 | ``` 20 | 21 | ### Usage 22 | 23 | #### Configuration 24 | 25 | In order to interact with eos blockchain you need to create a new instance of the **Eos** class with a **EosConfigurator**. 26 | 27 | Example: 28 | 29 | ```csharp 30 | Eos eos = new Eos(new EosConfigurator() 31 | { 32 | HttpEndpoint = "https://nodes.eos42.io", //Mainnet 33 | ChainId = "aca376f206b8fc25a6ed44dbdc66547c36c6c33e3a119ffbeaef943642f0e906", 34 | ExpireSeconds = 60, 35 | SignProvider = new DefaultSignProvider("myprivatekey") 36 | }); 37 | ``` 38 | * HttpEndpoint - http or https location of a nodeosd server providing a chain API. 39 | * ChainId - unique ID for the blockchain you're connecting to. If no ChainId is provided it will get from the get_info API call. 40 | * ExpireInSeconds - number of seconds before the transaction will expire. The time is based on the nodeosd's clock. An unexpired transaction that may have had an error is a liability until the expiration is reached, this time should be brief. 41 | * SignProvider - signature implementation to handle available keys and signing transactions. Use the DefaultSignProvider with a privateKey to sign transactions inside the lib. 42 | 43 | #### Api read methods 44 | 45 | - **GetInfo** call 46 | ```csharp 47 | var result = await eos.GetInfo(); 48 | ``` 49 | Returns: 50 | ```csharp 51 | class GetInfoResponse 52 | { 53 | string server_version; 54 | string chain_id; 55 | UInt32 head_block_num; 56 | UInt32 last_irreversible_block_num; 57 | string last_irreversible_block_id; 58 | string head_block_id; 59 | DateTime head_block_time; 60 | string head_block_producer; 61 | string virtual_block_cpu_limit; 62 | string virtual_block_net_limit; 63 | string block_cpu_limit; 64 | string block_net_limit; 65 | } 66 | ``` 67 | 68 | - **GetAccount** call 69 | ```csharp 70 | var result = await eos.GetAccount("myaccountname"); 71 | ``` 72 | Returns: 73 | ```csharp 74 | class GetAccountResponse 75 | { 76 | string account_name; 77 | UInt32 head_block_num; 78 | DateTime head_block_time; 79 | bool privileged; 80 | DateTime last_code_update; 81 | DateTime created; 82 | Int64 ram_quota; 83 | Int64 net_weight; 84 | Int64 cpu_weight; 85 | Resource net_limit; 86 | Resource cpu_limit; 87 | UInt64 ram_usage; 88 | List permissions; 89 | RefundRequest refund_request; 90 | SelfDelegatedBandwidth self_delegated_bandwidth; 91 | TotalResources total_resources; 92 | VoterInfo voter_info; 93 | } 94 | ``` 95 | 96 | - **GetBlock** call 97 | ```csharp 98 | var result = await eos.GetBlock("blockIdOrNumber"); 99 | ``` 100 | Returns: 101 | ```csharp 102 | class GetBlockResponse 103 | { 104 | DateTime timestamp; 105 | string producer; 106 | UInt32 confirmed; 107 | string previous; 108 | string transaction_mroot; 109 | string action_mroot; 110 | UInt32 schedule_version; 111 | Schedule new_producers; 112 | List block_extensions; 113 | List header_extensions; 114 | string producer_signature; 115 | List transactions; 116 | string id; 117 | UInt32 block_num; 118 | UInt32 ref_block_prefix; 119 | } 120 | ``` 121 | 122 | - **GetTableRows** call 123 | * Json 124 | * Code - accountName of the contract to search for table rows 125 | * Scope - scope text segmenting the table set 126 | * Table - table name 127 | * TableKey - unused so far? 128 | * LowerBound - lower bound for the selected index value 129 | * UpperBound - upper bound for the selected index value 130 | * KeyType - Type of the index choosen, ex: i64 131 | * Limit 132 | * IndexPosition - 1 - primary (first), 2 - secondary index (in order defined by multi_index), 3 - third index, etc 133 | * EncodeType - dec, hex 134 | * Reverse - reverse result order 135 | * ShowPayer - show ram payer 136 | 137 | ```csharp 138 | var result = await eos.GetTableRows(new GetTableRowsRequest() { 139 | json = true, 140 | code = "eosio.token", 141 | scope = "EOS", 142 | table = "stat" 143 | }); 144 | ``` 145 | 146 | Returns: 147 | 148 | ```csharp 149 | class GetTableRowsResponse 150 | { 151 | List rows 152 | bool? more 153 | } 154 | ``` 155 | 156 | Using generic type 157 | 158 | ```csharp 159 | /*JsonProperty helps map the fields from the api*/ 160 | public class Stat 161 | { 162 | public string issuer { get; set; } 163 | public string max_supply { get; set; } 164 | public string supply { get; set; } 165 | } 166 | 167 | var result = await Eos.GetTableRows(new GetTableRowsRequest() 168 | { 169 | json = true, 170 | code = "eosio.token", 171 | scope = "EOS", 172 | table = "stat" 173 | }); 174 | ``` 175 | 176 | Returns: 177 | 178 | ```csharp 179 | class GetTableRowsResponse 180 | { 181 | List rows 182 | bool? more 183 | } 184 | ``` 185 | 186 | - **GetTableByScope** call 187 | * Code - accountName of the contract to search for tables 188 | * Table - table name to filter 189 | * LowerBound - lower bound of scope, optional 190 | * UpperBound - upper bound of scope, optional 191 | * Limit 192 | * Reverse - reverse result order 193 | 194 | ```csharp 195 | var result = await eos.GetTableByScope(new GetTableByScopeRequest() { 196 | code = "eosio.token", 197 | table = "accounts" 198 | }); 199 | ``` 200 | 201 | Returns: 202 | 203 | ```csharp 204 | class GetTableByScopeResponse 205 | { 206 | List rows 207 | string more 208 | } 209 | 210 | class TableByScopeResultRow 211 | { 212 | string code; 213 | string scope; 214 | string table; 215 | string payer; 216 | UInt32? count; 217 | } 218 | ``` 219 | 220 | - **GetActions** call 221 | * accountName - accountName to get actions history 222 | * pos - a absolute sequence positon -1 is the end/last action 223 | * offset - the number of actions relative to pos, negative numbers return [pos-offset,pos), positive numbers return [pos,pos+offset) 224 | 225 | ```csharp 226 | var result = await eos.GetActions("myaccountname", 0, 10); 227 | ``` 228 | 229 | Returns: 230 | 231 | ```csharp 232 | class GetActionsResponse 233 | { 234 | List actions; 235 | UInt32 last_irreversible_block; 236 | bool time_limit_exceeded_error; 237 | } 238 | ``` 239 | 240 | #### Create Transaction 241 | 242 | **NOTE: using anonymous objects and / or properties as action data is not supported on WEBGL Unity exports 243 | Use data as dictionary or strongly typed objects with fields.** 244 | 245 | ```csharp 246 | var result = await eos.CreateTransaction(new Transaction() 247 | { 248 | actions = new List() 249 | { 250 | new Api.v1.Action() 251 | { 252 | account = "eosio.token", 253 | authorization = new List() 254 | { 255 | new PermissionLevel() {actor = "tester112345", permission = "active" } 256 | }, 257 | name = "transfer", 258 | data = new { from = "tester112345", to = "tester212345", quantity = "0.0001 EOS", memo = "hello crypto world!" } 259 | } 260 | } 261 | }); 262 | ``` 263 | 264 | Data can also be a Dictionary with key as string. The dictionary value can be any object with nested Dictionaries 265 | 266 | ```csharp 267 | var result = await eos.CreateTransaction(new Transaction() 268 | { 269 | actions = new List() 270 | { 271 | new Api.v1.Action() 272 | { 273 | account = "eosio.token", 274 | authorization = new List() 275 | { 276 | new PermissionLevel() {actor = "tester112345", permission = "active" } 277 | }, 278 | name = "transfer", 279 | data = new Dictionary() 280 | { 281 | { "from", "tester112345" }, 282 | { "to", "tester212345" }, 283 | { "quantity", "0.0001 EOS" }, 284 | { "memo", "hello crypto world!" } 285 | } 286 | } 287 | } 288 | }); 289 | ``` 290 | 291 | Returns the transactionId 292 | #### Custom SignProvider 293 | 294 | Is also possible to implement your own **ISignProvider** to customize how the signatures and key handling is done. 295 | 296 | Example: 297 | 298 | ```csharp 299 | /// 300 | /// Signature provider implementation that uses a private server to hold keys 301 | /// 302 | class SuperSecretSignProvider : ISignProvider 303 | { 304 | /// 305 | /// Get available public keys from signature provider server 306 | /// 307 | /// List of public keys 308 | public async Task> GetAvailableKeys() 309 | { 310 | var result = await HttpHelper.GetJsonAsync("https://supersecretserver.com/get_available_keys"); 311 | return result.Keys; 312 | } 313 | 314 | /// 315 | /// Sign bytes using the signature provider server 316 | /// 317 | /// EOSIO Chain id 318 | /// required public keys for signing this bytes 319 | /// signature bytes 320 | /// abi contract names to get abi information from 321 | /// List of signatures per required keys 322 | public async Task> Sign(string chainId, List requiredKeys, byte[] signBytes) 323 | { 324 | var result = await HttpHelper.PostJsonAsync("https://supersecretserver.com/sign", new SecretRequest { 325 | chainId = chainId, 326 | RequiredKeys = requiredKeys, 327 | Data = signBytes 328 | }); 329 | return result.Signatures; 330 | } 331 | } 332 | 333 | // create new Eos client instance using your custom signature provider 334 | Eos eos = new Eos(new EosConfigurator() 335 | { 336 | SignProvider = new SuperSecretSignProvider(), 337 | HttpEndpoint = "https://nodes.eos42.io", //Mainnet 338 | ChainId = "aca376f206b8fc25a6ed44dbdc66547c36c6c33e3a119ffbeaef943642f0e906" 339 | }); 340 | ``` 341 | #### CombinedSignersProvider 342 | 343 | Is also possible to combine multiple signature providers to complete all the signatures for a transaction 344 | 345 | Example: 346 | 347 | ```csharp 348 | Eos eos = new Eos(new EosConfigurator() 349 | { 350 | HttpEndpoint = "https://nodes.eos42.io", //Mainnet 351 | ChainId = "aca376f206b8fc25a6ed44dbdc66547c36c6c33e3a119ffbeaef943642f0e906", 352 | ExpireSeconds = 60, 353 | SignProvider = new CombinedSignersProvider(new List() { 354 | new SuperSecretSignProvider(), 355 | new DefaultSignProvider("myprivatekey") 356 | }), 357 | }); 358 | ``` 359 | 360 | --------------------------------------------------------------------------------