├── .gitignore ├── .gitmodules ├── LICENSE ├── README.md ├── ScatterSharp ├── ScatterSharp.Core │ ├── Api │ │ ├── AbiRequest.cs │ │ ├── ApiBase.cs │ │ ├── ApiError.cs │ │ ├── ArbitrarySignatureRequest.cs │ │ ├── AuthenticateRequest.cs │ │ ├── GetEncryptionKeyRequest.cs │ │ ├── GetPublicKeyRequest.cs │ │ ├── Identity.cs │ │ ├── IdentityAccount.cs │ │ ├── IdentityRequest.cs │ │ ├── IdentityRequiredFields.cs │ │ ├── LinkAccount.cs │ │ ├── LinkAccountRequest.cs │ │ ├── LocationFields.cs │ │ ├── Network.cs │ │ ├── NetworkRequest.cs │ │ ├── PairRequest.cs │ │ ├── PersonalFields.cs │ │ ├── RekeyRequest.cs │ │ ├── Request.cs │ │ ├── RequestWrapper.cs │ │ ├── SignatureRequest.cs │ │ ├── SignaturesResult.cs │ │ ├── Token.cs │ │ ├── TokenRequest.cs │ │ ├── Transaction.cs │ │ ├── TransferRequest.cs │ │ └── UpdateIdentityRequest.cs │ ├── Helpers │ │ ├── CryptoHelper.cs │ │ └── UtilsHelper.cs │ ├── Interfaces │ │ ├── IScatter.cs │ │ ├── ISocketService.cs │ │ └── IStorageProvider.cs │ ├── OpenTask.cs │ ├── ScatterBase.cs │ ├── ScatterConfigurator.cs │ ├── ScatterConstants.cs │ ├── ScatterSharp.Core.csproj │ ├── SocketServiceBase.cs │ └── Storage │ │ ├── FileStorageProvider.cs │ │ └── MemoryStorageProvider.cs ├── ScatterSharp.EosProvider │ ├── ScatterSharp.EosProvider.csproj │ └── ScatterSignatureProvider.cs ├── ScatterSharp.UnitTests.Core │ ├── ScatterSharp.UnitTests.Core.csproj │ └── ScatterUnitTestCases.cs ├── ScatterSharp.UnitTests.Unity3D │ ├── ScatterEosUnitTests.cs │ ├── ScatterSharp.UnitTests.Unity3D.csproj │ └── ScatterUnitTests.cs ├── ScatterSharp.UnitTests │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── ScatterEosUnitTests.cs │ ├── ScatterSharp.UnitTests.csproj │ ├── ScatterUnitTests.cs │ ├── app.config │ └── packages.config ├── ScatterSharp.Unity3D │ ├── Scatter.cs │ ├── ScatterSharp.Unity3D.csproj │ └── SocketService.cs ├── ScatterSharp.sln └── ScatterSharp │ ├── Scatter.cs │ ├── ScatterSharp.csproj │ ├── ScatterSharp.csproj.user │ └── SocketService.cs ├── Unity3D ├── README.md ├── ScatterSharpUnity3D │ ├── Assets │ │ ├── Scenes.meta │ │ ├── Scenes │ │ │ ├── SampleScene.unity │ │ │ ├── SampleScene.unity.meta │ │ │ ├── Scripts.meta │ │ │ └── Scripts │ │ │ │ ├── TestScatterScript.cs │ │ │ │ └── TestScatterScript.cs.meta │ │ ├── gs_home_devs_streamlined.png │ │ └── gs_home_devs_streamlined.png.meta │ ├── Library │ │ ├── AnnotationManager │ │ ├── AssetImportState │ │ ├── BuildPlayer.prefs │ │ ├── BuildSettings.asset │ │ ├── CurrentLayout.dwlt │ │ ├── EditorUserBuildSettings.asset │ │ ├── EditorUserSettings.asset │ │ ├── InspectorExpandedItems.asset │ │ ├── LastSceneManagerSetup.txt │ │ ├── LibraryFormatVersion.txt │ │ ├── MonoManager.asset │ │ ├── ProjectSettings.asset │ │ ├── ScriptMapper │ │ ├── ShaderCache.db │ │ ├── SpriteAtlasDatabase.asset │ │ ├── TilemapEditorUserSettings.asset │ │ ├── expandedItems │ │ └── shadercompiler-UnityShaderCompiler.exe0.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 ├── build_package_win.bat ├── create_plugins.bat └── scatter-sharp.unitypackage └── data ├── ws-detail.png └── ws.png /.gitignore: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # This .gitignore file was automatically created by Microsoft(R) Visual Studio. 3 | ################################################################################ 4 | 5 | [Ll]ibrary/ 6 | [Tt]emp/ 7 | [Oo]bj/ 8 | [Bb]uild/ 9 | [Bb]uilds/ 10 | [Bb]uild.meta 11 | 12 | *.suo 13 | 14 | # Unity3D generated meta files 15 | *.pidb.meta 16 | *.pdb.meta 17 | 18 | /ScatterSharp/.vs 19 | /ScatterSharp/packages 20 | /ScatterSharp/ScatterSharp/obj 21 | /ScatterSharp/ScatterSharp.UnitTests/obj 22 | /ScatterSharp/ScatterSharp.Core/obj 23 | /ScatterSharp/ScatterSharp.UnitTests.Core/obj 24 | /ScatterSharp/ScatterSharp.Unity3D/obj 25 | /ScatterSharp/ScatterSharp.UnitTests.Unity3D/obj 26 | /ScatterSharp/ScatterSharp.EosProvider/obj 27 | /ScatterSharp/ScatterSharp/bin 28 | /ScatterSharp/ScatterSharp.UnitTests/bin 29 | /ScatterSharp/ScatterSharp.Core/bin 30 | /ScatterSharp/ScatterSharp.UnitTests.Core/bin 31 | /ScatterSharp/ScatterSharp.Unity3D/bin 32 | /ScatterSharp/ScatterSharp.UnitTests.Unity3D/bin 33 | /ScatterSharp/ScatterSharp.EosProvider/bin 34 | /Unity3D/ScatterSharpUnity3D/Assets/Plugins 35 | /Unity3D/ScatterSharpUnity3D/.vs/ScatterSharpUnity3D/v15 36 | /Unity3D/ScatterSharpUnity3D/obj 37 | /Unity3D/ScatterSharpUnity3D/Logs 38 | /Unity3D/out.txt 39 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "eos-sharp"] 2 | path = eos-sharp 3 | url = https://github.com/getscatter/eos-sharp 4 | [submodule "socketio-sharp"] 5 | path = socketio-sharp 6 | url = https://github.com/getscatter/socketio-sharp 7 | -------------------------------------------------------------------------------- /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 | # scatter-sharp 4 | Scatter C# library to interact with ScatterDesktop / ScatterMobile 5 | 6 | ## Clone repo 7 | 8 | ``` 9 | git clone https://github.com/GetScatter/scatter-sharp --recursive 10 | ``` 11 | 12 | ### Prerequisite to build 13 | 14 | Visual Studio 2017+ 15 | 16 | ### Instalation 17 | scatter-sharp is now available throught nuget https://www.nuget.org/packages/scatter-sharp 18 | ``` 19 | Install-Package scatter-sharp 20 | ``` 21 | 22 | ### Usage 23 | 24 | #### Configuration 25 | 26 | In order to use scatter you need to create a instance with **AppName** and a **Network** configuration, connect to scatter application, request a **Identity** and then fetch a new **Eos** instance. 27 | 28 | Example: 29 | 30 | ```csharp 31 | var network = new Api.Network() 32 | { 33 | blockchain = Scatter.Blockchains.EOSIO, 34 | host = "api.eossweden.se", 35 | port = 443, 36 | protocol = "https", 37 | chainId = "aca376f206b8fc25a6ed44dbdc66547c36c6c33e3a119ffbeaef943642f0e906" 38 | }; 39 | 40 | var scatter = new Scatter(new ScatterConfigurator() 41 | { 42 | AppName = "SCATTER-SHARP", 43 | Network = network, 44 | StorageProvider = storageProvider 45 | }); 46 | 47 | await scatter.Connect(); 48 | 49 | var identity = await scatter.GetIdentity(new Api.IdentityRequiredFields() 50 | { 51 | accounts = new List() 52 | { 53 | network 54 | }, 55 | location = new List(), 56 | personal = new List() 57 | }); 58 | 59 | var eos = new Eos(new EosSharp.Core.EosConfigurator() { 60 | ChainId = network.chainId, 61 | HttpEndpoint = network.GetHttpEndpoint(), 62 | SignProvider = new ScatterSignatureProvider(scatter) 63 | }); 64 | 65 | var account = scatter.Identity.accounts.First(); 66 | 67 | var result = await eos.CreateTransaction(new EosSharp.Core.Api.v1.Transaction() 68 | { 69 | actions = new List() 70 | { 71 | new EosSharp.Core.Api.v1.Action() 72 | { 73 | account = "eosio.token", 74 | authorization = new List() 75 | { 76 | new PermissionLevel() {actor = account.name, permission = account.authority } 77 | }, 78 | name = "transfer", 79 | //Using a dictionary with key, object works on WEBGL 80 | data = new Dictionary() 81 | { 82 | { "from", account.name }, 83 | { "to", "eosio" }, 84 | { "quantity", "0.0001 EOS" }, 85 | { "memo", "Unity3D hello crypto world!" } 86 | } 87 | } 88 | } 89 | }); 90 | 91 | ... **Use all eos api methods as usual from eos-sharp** ... 92 | 93 | scatter.Dispose(); 94 | ``` 95 | 96 | #### App Storage Provider 97 | 98 | Scatter uses a appKey and Nonce to help pair your application with the users permissions. By default this information is stored on memory but you may want to save on disk to be reused later. 99 | 100 | Create a new Scatter instance and configure a FileStorageProvider with the target filePath. 101 | ```csharp 102 | var fileStorage = new FileStorageProvider(filePath); 103 | 104 | using (var scatter = new Scatter(new ScatterConfigurator() 105 | { 106 | AppName = "SCATTER-SHARP", 107 | Network = network, 108 | StorageProvider = fileStorage 109 | }) 110 | { 111 | await scatter.Connect(); 112 | .... 113 | } 114 | ``` 115 | 116 | #### Generic / Fiddler proxy 117 | 118 | Is useful to configure a proxy to investigate and debug all the information that goes through scatter-sharp <-> ScatterDesktop. Fiddler is a popular http/websocket proxy solution but you can configure any other. 119 | 120 | ##### Enabling proxy 121 | 122 | Add a proxy object to scatter configurator that accepts Url and optionaly User and Password. **Note that this is used in websocket-sharp and not the implementation for WebGL (not needed).** 123 | 124 | ```csharp 125 | var scatter = new Scatter(new ScatterConfigurator() 126 | { 127 | AppName = "SCATTER-SHARP", 128 | Network = network, 129 | StorageProvider = storageProvider, 130 | Proxy = new Proxy() 131 | { 132 | Url = "http://127.0.0.1:8888" 133 | } 134 | }); 135 | ``` 136 | 137 | ##### Fiddler unmask websocket traffic 138 | 139 | On tab "FiddlerScript" add this code in the end of function "OnBeforeRequest" 140 | 141 | ``` 142 | static function OnBeforeRequest(oSession: Session) { 143 | ... 144 | if (oSession.RequestHeaders.ExistsAndContains ("Sec-WebSocket-Extensions", "permessage-deflate")) { 145 | oSession.RequestHeaders.Remove ( "Sec-WebSocket-Extensions"); 146 | } 147 | } 148 | ``` 149 | 150 | ##### Fiddler check websocket traffic 151 | 152 | Double click "ws" icon to open websocket tab 153 | 154 | ![alt text](data/ws.png) 155 | 156 | In websocket tab you can view in real-time all the communication between scatter-sharp <-> ScatterDesktop 157 | 158 | ![alt text](data/ws-detail.png) 159 | 160 | ##### Enable proxy on Unity Editor 161 | 162 | To enable the proxy in unity editor go to the file: 163 | 164 | ``` 165 | C:\Program Files\Unity\Editor\Data\Mono\etc\mono\2.0\machine.config 166 | ``` 167 | 168 | Add this to the node: 169 | ``` 170 | 171 | 172 | 173 | ``` 174 | 175 | #### Scatter Api methods 176 | - **Connect** 177 | Connect to scatter 178 | ```csharp 179 | await scatter.Connect(); 180 | ``` 181 | 182 | - **GetVersion** 183 | Gets the Scatter version 184 | ```csharp 185 | string version = await scatter.GetVersion(); 186 | ``` 187 | 188 | - **GetIdentity** 189 | Prompts the users for an Identity if there is no permission, otherwise returns the permission without a prompt based on origin. 190 | ```csharp 191 | Identity identity = await scatter.GetIdentity(new Api.IdentityRequiredFields() { 192 | accounts = new List() 193 | { 194 | network 195 | }, 196 | location = new List(), 197 | personal = new List() 198 | }); 199 | ``` 200 | Returns: 201 | ```csharp 202 | public class Identity 203 | { 204 | public string hash; 205 | public string publicKey; 206 | public string name; 207 | public bool kyc; 208 | public List accounts; 209 | } 210 | ``` 211 | 212 | - **GetIdentityFromPermissions** 213 | Checks if an Identity has permissions and return the identity based on origin. 214 | ```csharp 215 | Identity identity = await scatter.GetIdentityFromPermissions(); 216 | ``` 217 | Returns: 218 | ```csharp 219 | public class Identity 220 | { 221 | public string hash; 222 | public string publicKey; 223 | public string name; 224 | public bool kyc; 225 | public List accounts; 226 | } 227 | ``` 228 | 229 | - **ForgetIdentity** 230 | Removes the identity permission for an origin from the user's Scatter, effectively logging them out. 231 | ```csharp 232 | bool result = await scatter.ForgetIdentity(); 233 | ``` 234 | 235 | - **Authenticate** 236 | Sign origin (appName) with the Identity's private key. Or custom data with custom publicKey 237 | ```csharp 238 | string signature = await scatter.Authenticate(); 239 | ``` 240 | 241 | - **GetArbitrarySignature** 242 | Request arbitrary data with the constraint of max 12 words 243 | ```csharp 244 | string signature = await scatter.GetArbitrarySignature(string publicKey, string data, string whatfor = "", bool isHash = false); 245 | ``` 246 | 247 | - **GetPublicKey** 248 | Allows apps to request that the user provide a user-selected Public Key to the app. ( ONBOARDING HELPER ) 249 | ```csharp 250 | string pubKey = await scatter.GetPublicKey(string blockchain); 251 | ``` 252 | 253 | - **LinkAccount** 254 | Allows the app to suggest that the user link new accounts on top of public keys ( ONBOARDING HELPER ) 255 | ```csharp 256 | bool result = await scatter.LinkAccount(string publicKey); 257 | ``` 258 | 259 | - **HasAccountFor** 260 | Allows dapps to see if a user has an account for a specific blockchain. DOES NOT PROMPT and does not return an actual account, just a boolean. 261 | ```csharp 262 | bool result = await scatter.HasAccountFor(); 263 | ``` 264 | 265 | - **SuggestNetwork** 266 | Prompts the user to add a new network to their Scatter. 267 | ```csharp 268 | bool result = await scatter.SuggestNetwork(); 269 | ``` 270 | 271 | - **AddToken** 272 | Add token to wallet 273 | ```csharp 274 | bool result = await scatter.AddToken(Token token); 275 | ``` 276 | 277 | - **On** 278 | Register listener for scatter event type 279 | ```csharp 280 | scatter.On(string type, Action callback); 281 | ``` 282 | 283 | - **Off** 284 | Remove listeners 285 | ```csharp 286 | scatter.Off(string type); 287 | scatter.Off(string type, int index); 288 | scatter.Off(Action callback); 289 | scatter.Off(string type, Action callback); 290 | ``` 291 | -------------------------------------------------------------------------------- /ScatterSharp/ScatterSharp.Core/Api/AbiRequest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace ScatterSharp.Core.Api 6 | { 7 | [Serializable] 8 | public class AbiRequest 9 | { 10 | public string account_name; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /ScatterSharp/ScatterSharp.Core/Api/ApiBase.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace ScatterSharp.Core.Api 6 | { 7 | [Serializable] 8 | public class ApiBase 9 | { 10 | public string origin; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /ScatterSharp/ScatterSharp.Core/Api/ApiError.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace ScatterSharp.Core.Api 4 | { 5 | [Serializable] 6 | public class ApiError 7 | { 8 | public string type; 9 | public string message; 10 | public string code; 11 | public string isError; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /ScatterSharp/ScatterSharp.Core/Api/ArbitrarySignatureRequest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace ScatterSharp.Core.Api 6 | { 7 | [Serializable] 8 | public class ArbitrarySignatureRequest : ApiBase 9 | { 10 | public string publicKey; 11 | public string data; 12 | public string whatfor; 13 | public bool isHash; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /ScatterSharp/ScatterSharp.Core/Api/AuthenticateRequest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace ScatterSharp.Core.Api 6 | { 7 | [Serializable] 8 | public class AuthenticateRequest : ApiBase 9 | { 10 | public string nonce; 11 | public string data; 12 | public string publicKey; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /ScatterSharp/ScatterSharp.Core/Api/GetEncryptionKeyRequest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace ScatterSharp.Core.Api 6 | { 7 | [Serializable] 8 | public class GetEncryptionKeyRequest : ApiBase 9 | { 10 | public string fromPublicKey; 11 | public string toPublicKey; 12 | public UInt64 nonce; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /ScatterSharp/ScatterSharp.Core/Api/GetPublicKeyRequest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace ScatterSharp.Core.Api 6 | { 7 | [Serializable] 8 | public class GetPublicKeyRequest : ApiBase 9 | { 10 | public string blockchain; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /ScatterSharp/ScatterSharp.Core/Api/Identity.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace ScatterSharp.Core.Api 5 | { 6 | [Serializable] 7 | public class Identity 8 | { 9 | public string hash; 10 | public string publicKey; 11 | public string name; 12 | public bool kyc; 13 | public List accounts; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /ScatterSharp/ScatterSharp.Core/Api/IdentityAccount.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace ScatterSharp.Core.Api 4 | { 5 | [Serializable] 6 | public class IdentityAccount 7 | { 8 | public string name; 9 | public string authority; 10 | public string publicKey; 11 | public string blockchain; 12 | public bool isHardware; 13 | public string chainId; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /ScatterSharp/ScatterSharp.Core/Api/IdentityRequest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace ScatterSharp.Core.Api 6 | { 7 | [Serializable] 8 | public class IdentityRequest : ApiBase 9 | { 10 | public IdentityRequiredFields fields; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /ScatterSharp/ScatterSharp.Core/Api/IdentityRequiredFields.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace ScatterSharp.Core.Api 5 | { 6 | [Serializable] 7 | public class IdentityRequiredFields 8 | { 9 | public List accounts; 10 | public List personal; 11 | public List location; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /ScatterSharp/ScatterSharp.Core/Api/LinkAccount.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace ScatterSharp.Core.Api 4 | { 5 | [Serializable] 6 | public class LinkAccount 7 | { 8 | public string name; 9 | public string authority; 10 | public string publicKey; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /ScatterSharp/ScatterSharp.Core/Api/LinkAccountRequest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace ScatterSharp.Core.Api 6 | { 7 | [Serializable] 8 | public class LinkAccountRequest : ApiBase 9 | { 10 | public LinkAccount account; 11 | public Network network; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /ScatterSharp/ScatterSharp.Core/Api/LocationFields.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace ScatterSharp.Core.Api 4 | { 5 | [Serializable] 6 | public class LocationFields 7 | { 8 | public string phone; 9 | public string address; 10 | public string city; 11 | public string state; 12 | public string country; 13 | public string zipcode; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /ScatterSharp/ScatterSharp.Core/Api/Network.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace ScatterSharp.Core.Api 4 | { 5 | [Serializable] 6 | public class Network 7 | { 8 | public string name; 9 | public string blockchain; 10 | public string host; 11 | public int port; 12 | public string protocol; 13 | public string chainId; 14 | 15 | public Network() 16 | { 17 | protocol = "https"; 18 | } 19 | 20 | public string GetHttpEndpoint() 21 | { 22 | if (port == 443) 23 | return "https://" + host; 24 | else 25 | return "http://" + host + ":" + port; 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /ScatterSharp/ScatterSharp.Core/Api/NetworkRequest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace ScatterSharp.Core.Api 6 | { 7 | [Serializable] 8 | public class NetworkRequest : ApiBase 9 | { 10 | public Network network; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /ScatterSharp/ScatterSharp.Core/Api/PairRequest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace ScatterSharp.Core.Api 6 | { 7 | [Serializable] 8 | public class PairRequest : ApiBase 9 | { 10 | public string appkey; 11 | public bool passthrough; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /ScatterSharp/ScatterSharp.Core/Api/PersonalFields.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace ScatterSharp.Core.Api 4 | { 5 | [Serializable] 6 | public class PersonalFields 7 | { 8 | public string firstname; 9 | public string lastname; 10 | public string email; 11 | public string birthdate; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /ScatterSharp/ScatterSharp.Core/Api/RekeyRequest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace ScatterSharp.Core.Api 6 | { 7 | [Serializable] 8 | public class RekeyRequest : ApiBase 9 | { 10 | public string appkey; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /ScatterSharp/ScatterSharp.Core/Api/Request.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace ScatterSharp.Core.Api 4 | { 5 | [Serializable] 6 | public class Request 7 | { 8 | public string id; 9 | public string appkey; 10 | public string nonce; 11 | public string nextNonce; 12 | 13 | public string type; 14 | public T payload; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /ScatterSharp/ScatterSharp.Core/Api/RequestWrapper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace ScatterSharp.Core.Api 6 | { 7 | [Serializable] 8 | public class RequestWrapper 9 | { 10 | public object data; 11 | public string plugin; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /ScatterSharp/ScatterSharp.Core/Api/SignatureRequest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace ScatterSharp.Core.Api 5 | { 6 | [Serializable] 7 | public class SignatureRequest : ApiBase 8 | { 9 | public Network network; 10 | public string blockchain; 11 | public List requiredFields; 12 | public Transaction transaction; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /ScatterSharp/ScatterSharp.Core/Api/SignaturesResult.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace ScatterSharp.Core.Api 5 | { 6 | [Serializable] 7 | public class SignaturesResult 8 | { 9 | public List signatures; 10 | public IdentityRequiredFields returnedFields; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /ScatterSharp/ScatterSharp.Core/Api/Token.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace ScatterSharp.Core.Api 4 | { 5 | [Serializable] 6 | public class Token 7 | { 8 | public string name; 9 | public string symbol; 10 | public string contract; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /ScatterSharp/ScatterSharp.Core/Api/TokenRequest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace ScatterSharp.Core.Api 6 | { 7 | [Serializable] 8 | public class TokenRequest : ApiBase 9 | { 10 | public Token token; 11 | public Network network; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /ScatterSharp/ScatterSharp.Core/Api/Transaction.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace ScatterSharp.Core.Api 4 | { 5 | public class Transaction 6 | { 7 | public IEnumerable abis; 8 | public string serializedTransaction; 9 | public string chainId; 10 | } 11 | } -------------------------------------------------------------------------------- /ScatterSharp/ScatterSharp.Core/Api/TransferRequest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace ScatterSharp.Core.Api 6 | { 7 | [Serializable] 8 | public class TransferRequest : ApiBase 9 | { 10 | public Network network; 11 | public string to; 12 | public string amount; 13 | public object options; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /ScatterSharp/ScatterSharp.Core/Api/UpdateIdentityRequest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace ScatterSharp.Core.Api 4 | { 5 | [Serializable] 6 | class UpdateIdentityRequest : ApiBase 7 | { 8 | public string name; 9 | public string kyc; 10 | } 11 | } -------------------------------------------------------------------------------- /ScatterSharp/ScatterSharp.Core/Helpers/CryptoHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using System.Linq; 4 | using System.Security.Cryptography; 5 | 6 | namespace ScatterSharp.Core.Helpers 7 | { 8 | public class CryptoHelper 9 | { 10 | public static byte[] AesEncrypt(byte[] keyBytes, string plainText) 11 | { 12 | using (Aes aes = Aes.Create()) 13 | { 14 | aes.IV = keyBytes.Skip(32).Take(16).ToArray(); 15 | aes.Key = keyBytes.Take(32).ToArray(); 16 | return EncryptStringToBytes_Aes(plainText, aes.Key, aes.IV); 17 | } 18 | } 19 | 20 | public static string AesDecrypt(byte[] keyBytes, byte[] cipherText) 21 | { 22 | using (Aes aes = Aes.Create()) 23 | { 24 | aes.IV = keyBytes.Skip(32).Take(16).ToArray(); 25 | aes.Key = keyBytes.Take(32).ToArray(); 26 | 27 | // Decrypt the bytes to a string. 28 | return DecryptStringFromBytes_Aes(cipherText, aes.Key, aes.IV); 29 | } 30 | } 31 | 32 | public static byte[] EncryptStringToBytes_Aes(string plainText, byte[] Key, byte[] IV) 33 | { 34 | // Check arguments. 35 | if (plainText == null || plainText.Length <= 0) 36 | throw new ArgumentNullException("plainText"); 37 | if (Key == null || Key.Length <= 0) 38 | throw new ArgumentNullException("Key"); 39 | if (IV == null || IV.Length <= 0) 40 | throw new ArgumentNullException("IV"); 41 | byte[] encrypted; 42 | 43 | // Create an Aes object 44 | // with the specified key and IV. 45 | using (Aes aesAlg = Aes.Create()) 46 | { 47 | aesAlg.Key = Key; 48 | aesAlg.IV = IV; 49 | 50 | // Create an encryptor to perform the stream transform. 51 | ICryptoTransform encryptor = aesAlg.CreateEncryptor(aesAlg.Key, aesAlg.IV); 52 | 53 | // Create the streams used for encryption. 54 | using (MemoryStream msEncrypt = new MemoryStream()) 55 | { 56 | using (CryptoStream csEncrypt = new CryptoStream(msEncrypt, encryptor, CryptoStreamMode.Write)) 57 | { 58 | using (StreamWriter swEncrypt = new StreamWriter(csEncrypt)) 59 | { 60 | //Write all data to the stream. 61 | swEncrypt.Write(plainText); 62 | } 63 | encrypted = msEncrypt.ToArray(); 64 | } 65 | } 66 | } 67 | 68 | // Return the encrypted bytes from the memory stream. 69 | return encrypted; 70 | } 71 | 72 | public static string DecryptStringFromBytes_Aes(byte[] cipherText, byte[] Key, byte[] IV) 73 | { 74 | // Check arguments. 75 | if (cipherText == null || cipherText.Length <= 0) 76 | throw new ArgumentNullException("cipherText"); 77 | if (Key == null || Key.Length <= 0) 78 | throw new ArgumentNullException("Key"); 79 | if (IV == null || IV.Length <= 0) 80 | throw new ArgumentNullException("IV"); 81 | 82 | // Declare the string used to hold 83 | // the decrypted text. 84 | string plaintext = null; 85 | 86 | // Create an Aes object 87 | // with the specified key and IV. 88 | using (Aes aesAlg = Aes.Create()) 89 | { 90 | aesAlg.Key = Key; 91 | aesAlg.IV = IV; 92 | 93 | // Create a decryptor to perform the stream transform. 94 | ICryptoTransform decryptor = aesAlg.CreateDecryptor(aesAlg.Key, aesAlg.IV); 95 | 96 | // Create the streams used for decryption. 97 | using (MemoryStream msDecrypt = new MemoryStream(cipherText)) 98 | { 99 | using (CryptoStream csDecrypt = new CryptoStream(msDecrypt, decryptor, CryptoStreamMode.Read)) 100 | { 101 | using (StreamReader srDecrypt = new StreamReader(csDecrypt)) 102 | { 103 | 104 | // Read the decrypted bytes from the decrypting stream 105 | // and place them in a string. 106 | plaintext = srDecrypt.ReadToEnd(); 107 | } 108 | } 109 | } 110 | 111 | } 112 | 113 | return plaintext; 114 | } 115 | } 116 | } 117 | -------------------------------------------------------------------------------- /ScatterSharp/ScatterSharp.Core/Helpers/UtilsHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Security.Cryptography; 3 | using System.Text; 4 | 5 | namespace ScatterSharp.Core.Helpers 6 | { 7 | public class UtilsHelper 8 | { 9 | /// 10 | /// Generate hex encoded random number 11 | /// 12 | /// number size in bytes 13 | /// 14 | public static string RandomNumber(int size = 6) 15 | { 16 | return ByteArrayToHexString(RandomNumberBytes(size)); 17 | } 18 | 19 | /// 20 | /// Generate random number and convert to byte array 21 | /// 22 | /// number size in bytes 23 | /// 24 | public static byte[] RandomNumberBytes(int size = 6) 25 | { 26 | var r = RandomNumberGenerator.Create(); 27 | byte[] numberBytes = new byte[size]; 28 | r.GetBytes(numberBytes); 29 | return numberBytes; 30 | } 31 | 32 | /// 33 | /// Encode byte array to hexadecimal string 34 | /// 35 | /// byte array to convert 36 | /// 37 | public static string ByteArrayToHexString(byte[] ba) 38 | { 39 | StringBuilder hex = new StringBuilder(ba.Length * 2); 40 | foreach (byte b in ba) 41 | hex.AppendFormat("{0:x2}", b); 42 | 43 | return hex.ToString(); 44 | } 45 | 46 | /// 47 | /// Decode hexadecimal string to byte array 48 | /// 49 | /// 50 | /// 51 | public static byte[] HexStringToByteArray(string hex) 52 | { 53 | var l = hex.Length / 2; 54 | var result = new byte[l]; 55 | for (var i = 0; i < l; ++i) 56 | result[i] = (byte)Convert.ToInt32(hex.Substring(i * 2, 2), 16); 57 | return result; 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /ScatterSharp/ScatterSharp.Core/Interfaces/IScatter.cs: -------------------------------------------------------------------------------- 1 | using ScatterSharp.Core.Api; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace ScatterSharp.Core.Interfaces 8 | { 9 | public interface IScatter : IDisposable 10 | { 11 | /// 12 | /// Connect to scatter 13 | /// 14 | /// set response timeout that overrides the default one 15 | /// 16 | Task Connect(int? timeout = null); 17 | 18 | /// 19 | /// Get configured network 20 | /// 21 | /// 22 | Network GetNetwork(); 23 | 24 | /// 25 | /// Get configured app name 26 | /// 27 | /// 28 | string GetAppName(); 29 | 30 | /// 31 | /// Get Scatter version 32 | /// 33 | /// set response timeout that overrides the default one 34 | /// 35 | Task GetVersion(int? timeout = null); 36 | 37 | /// 38 | /// Prompts the users for an Identity if there is no permission, otherwise returns the permission without a prompt based on origin. 39 | /// 40 | /// Optional required fields 41 | /// set response timeout that overrides the default one 42 | /// 43 | Task GetIdentity(IdentityRequiredFields requiredFields = null, int? timeout = null); 44 | 45 | /// 46 | /// Prompts the users for an Identity if there is no permission, otherwise returns the permission without a prompt based on origin. 47 | /// 48 | /// Optional required fields for multiple networks at once 49 | /// set response timeout that overrides the default one 50 | /// 51 | Task LoginAll(IdentityRequiredFields requiredFields = null, int? timeout = null); 52 | 53 | /// 54 | /// Checks if an Identity has permissions and return the identity based on origin. 55 | /// 56 | /// set response timeout that overrides the default one 57 | /// 58 | Task GetIdentityFromPermissions(int? timeout = null); 59 | 60 | /// 61 | /// Get authenticated user account 62 | /// 63 | /// set response timeout that overrides the default one 64 | /// 65 | Task GetAvatar(int? timeout = null); 66 | 67 | /// 68 | /// Removes the identity permission for an origin from the user's Scatter, effectively logging them out. 69 | /// 70 | /// set response timeout that overrides the default one 71 | /// 72 | Task ForgetIdentity(int? timeout = null); 73 | 74 | /// 75 | /// Sign origin (appName) with the Identity's private key. Or custom data with custom publicKey 76 | /// 77 | /// entropy nonce 78 | /// custom data 79 | /// custom publickey 80 | /// set response timeout that overrides the default one 81 | /// 82 | Task Authenticate(string nonce, string data = null, string publicKey = null, int? timeout = null); 83 | 84 | /// 85 | /// Sign arbitrary data with the constraint of max 12 words 86 | /// 87 | /// publickey to request the private key signature 88 | /// data to sign 89 | /// Optional reason for signature 90 | /// is data a sha256 hash 91 | /// set response timeout that overrides the default one 92 | /// 93 | Task GetArbitrarySignature(string publicKey, string data, string whatfor = "", bool isHash = false, int? timeout = null); 94 | 95 | /// 96 | /// Allows apps to request that the user provide a user-selected Public Key to the app. ( ONBOARDING HELPER ) 97 | /// 98 | /// 99 | /// set response timeout that overrides the default one 100 | /// 101 | Task GetPublicKey(string blockchain, int? timeout = null); 102 | 103 | /// 104 | /// Allows the app to suggest that the user link new accounts on top of public keys ( ONBOARDING HELPER ) 105 | /// 106 | /// 107 | /// set response timeout that overrides the default one 108 | /// 109 | Task LinkAccount(LinkAccount account, int? timeout = null); 110 | 111 | /// 112 | /// Allows dapps to see if a user has an account for a specific blockchain. DOES NOT PROMPT and does not return an actual account, just a boolean. 113 | /// 114 | /// set response timeout that overrides the default one 115 | /// 116 | Task HasAccountFor(int? timeout = null); 117 | 118 | /// 119 | /// Prompts the user to add a new network to their Scatter. 120 | /// 121 | /// set response timeout that overrides the default one 122 | /// 123 | Task SuggestNetwork(int? timeout = null); 124 | 125 | /// 126 | /// Request transfer of funds. 127 | /// 128 | /// 129 | /// 130 | /// 131 | /// set response timeout that overrides the default one 132 | /// 133 | Task RequestTransfer(string to, string amount, object options = null, int? timeout = null); 134 | 135 | /// 136 | /// Request transaction signature 137 | /// 138 | /// 139 | /// set response timeout that overrides the default one 140 | /// 141 | Task RequestSignature(object payload, int? timeout = null); 142 | 143 | /// 144 | /// Add token to wallet 145 | /// 146 | /// 147 | /// set response timeout that overrides the default one 148 | /// 149 | Task AddToken(Token token, int? timeout = null); 150 | 151 | /// 152 | /// Update identity information 153 | /// 154 | /// identity name 155 | /// kyc information 156 | /// set response timeout that overrides the default one 157 | /// 158 | Task UpdateIdentity(string name, string kyc = null, int? timeout = null); 159 | 160 | Task GetEncryptionKey(string fromPublicKey, string toPublicKey, UInt64 nonce, int? timeout = null); 161 | 162 | /// 163 | /// Register listener for scatter event type 164 | /// 165 | /// 166 | /// 167 | void On(string type, Action callback); 168 | 169 | /// 170 | /// Remove listener by event type 171 | /// 172 | /// event type 173 | void Off(string type); 174 | 175 | /// 176 | /// Remove listener by event type and position 177 | /// 178 | /// event type 179 | /// position 180 | void Off(string type, int index); 181 | 182 | /// 183 | /// Remove listener by callback instance 184 | /// 185 | /// 186 | void Off(Action callback); 187 | 188 | /// 189 | /// remove listner by event type and callback instance 190 | /// 191 | /// 192 | /// 193 | void Off(string type, Action callback); 194 | } 195 | } 196 | -------------------------------------------------------------------------------- /ScatterSharp/ScatterSharp.Core/Interfaces/ISocketService.cs: -------------------------------------------------------------------------------- 1 | using ScatterSharp.Core.Api; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace ScatterSharp.Core.Interfaces 8 | { 9 | public interface ISocketService : IDisposable 10 | { 11 | /// 12 | /// Link to scatter application by connecting, registering events and pair with passthrough 13 | /// 14 | /// Uri to link to 15 | /// set response timeout that overrides the default one 16 | /// 17 | Task Link(Uri uri, int? timeout = null); 18 | 19 | /// 20 | /// Pair appication to registered applications in scatter 21 | /// 22 | /// pass through rekey process 23 | /// set response timeout that overrides the default one 24 | /// 25 | Task Pair(bool passthrough = false, int? timeout = null); 26 | 27 | /// 28 | /// Send api request to scatter 29 | /// 30 | /// Request type param 31 | /// Return type param 32 | /// Request object 33 | /// set response timeout that overrides the default one 34 | /// 35 | Task SendApiRequest(Request request, int? timeout = null); 36 | 37 | /// 38 | /// Disconnect from socket 39 | /// 40 | /// 41 | Task Disconnect(); 42 | 43 | /// 44 | /// Check if socket connection is open 45 | /// 46 | /// 47 | bool IsConnected(); 48 | 49 | /// 50 | /// Check if socket service is paired with scatter 51 | /// 52 | /// 53 | bool IsPaired(); 54 | 55 | /// 56 | /// Register listener for socketio event type 57 | /// 58 | /// 59 | /// 60 | void On(string type, Action callback); 61 | 62 | /// 63 | /// Remove listener by event type 64 | /// 65 | /// event type 66 | void Off(string type); 67 | 68 | /// 69 | /// Remove listener by event type and position 70 | /// 71 | /// event type 72 | /// position 73 | void Off(string type, int index); 74 | 75 | /// 76 | /// Remove listener by callback instance 77 | /// 78 | /// 79 | void Off(Action callback); 80 | 81 | /// 82 | /// remove listner by event type and callback instance 83 | /// 84 | /// 85 | /// 86 | void Off(string type, Action callback); 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /ScatterSharp/ScatterSharp.Core/Interfaces/IStorageProvider.cs: -------------------------------------------------------------------------------- 1 | namespace ScatterSharp.Core.Interfaces 2 | { 3 | public interface IAppStorageProvider 4 | { 5 | /// 6 | /// Get Nonce 7 | /// 8 | /// 9 | string GetNonce(); 10 | 11 | /// 12 | /// Set nonce as hex string 13 | /// 14 | /// 15 | void SetNonce(string nonce); 16 | 17 | /// 18 | /// Get app key 19 | /// 20 | /// 21 | string GetAppkey(); 22 | 23 | /// 24 | /// Set appkey 25 | /// 26 | /// 27 | void SetAppkey(string appkey); 28 | 29 | /// 30 | /// Save all information to storage 31 | /// 32 | void Save(); 33 | 34 | /// 35 | /// Load all information from storage 36 | /// 37 | void Load(); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /ScatterSharp/ScatterSharp.Core/OpenTask.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading.Tasks; 3 | 4 | namespace ScatterSharp.Core 5 | { 6 | /// 7 | /// Represents all the information to open task request to scatter 8 | /// 9 | public class OpenTask 10 | { 11 | /// 12 | /// Promise task to obtain response from 13 | /// 14 | public TaskCompletionSource PromiseTask { get; set; } 15 | 16 | /// 17 | /// Request date time 18 | /// 19 | public DateTime TaskRequestTime { get; set; } 20 | 21 | /// 22 | /// Timeout in milliseconds for the task 23 | /// 24 | public int TaskTimeoutMS { get; set; } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /ScatterSharp/ScatterSharp.Core/ScatterConfigurator.cs: -------------------------------------------------------------------------------- 1 | using ScatterSharp.Core.Api; 2 | using ScatterSharp.Core.Interfaces; 3 | using SocketIOSharp.Core; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Text; 7 | 8 | namespace ScatterSharp.Core 9 | { 10 | /// 11 | /// Aggregates all properties to configure Scatter client 12 | /// 13 | public class ScatterConfigurator 14 | { 15 | /// 16 | /// App name (origin) for identifying the application 17 | /// 18 | public string AppName { get; set; } 19 | /// 20 | /// Network used in the client 21 | /// 22 | public Network Network { get; set; } 23 | /// 24 | /// Storage implemantation to save appName and nonce 25 | /// 26 | public IAppStorageProvider StorageProvider { get; set; } 27 | /// 28 | /// Proxy to route traffic (optional) 29 | /// 30 | public Proxy Proxy { get; set; } 31 | /// 32 | /// Default Timeout for all requests 33 | /// 34 | public int DefaultTimeout = 60000; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /ScatterSharp/ScatterSharp.Core/ScatterConstants.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace ScatterSharp.Core 6 | { 7 | public class ScatterConstants 8 | { 9 | /// 10 | /// Websocket URI string format 11 | /// 12 | public static readonly string WSURI = "{0}://{1}:{2}/socket.io/?EIO=3&transport=websocket"; 13 | 14 | /// 15 | /// Web socket SSL information 16 | /// 17 | public static readonly string WSS_PROTOCOL = "wss"; 18 | public static readonly string WSS_HOST = "local.get-scatter.com"; 19 | public static readonly string WSS_PORT = "50006"; 20 | 21 | /// 22 | /// Web socket information 23 | /// 24 | public static readonly string WS_PROTOCOL = "ws"; 25 | public static readonly string WS_HOST = "127.0.0.1"; 26 | public static readonly string WS_PORT = "50005"; 27 | 28 | /// 29 | /// Interval in secs to check for open thats that timeout 30 | /// 31 | public static readonly int OPEN_TASK_CHECK_INTERVAL_SECS = 1; 32 | 33 | /// 34 | /// Max number of tasks to check per cycle 35 | /// 36 | public static readonly int OPEN_TASK_NR_CHECK = 10; 37 | 38 | 39 | public class Blockchains 40 | { 41 | public static readonly string EOSIO = "eos"; 42 | public static readonly string ETH = "eth"; 43 | public static readonly string TRX = "trx"; 44 | }; 45 | 46 | public class Events 47 | { 48 | public static readonly string Disconnected = "dced"; 49 | public static readonly string LoggedOut = "logout"; 50 | }; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /ScatterSharp/ScatterSharp.Core/ScatterSharp.Core.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netstandard2.0 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /ScatterSharp/ScatterSharp.Core/SocketServiceBase.cs: -------------------------------------------------------------------------------- 1 | using Cryptography.ECDSA; 2 | using ScatterSharp.Core.Api; 3 | using ScatterSharp.Core.Helpers; 4 | using ScatterSharp.Core.Interfaces; 5 | using System; 6 | using System.Linq; 7 | using System.Collections; 8 | using System.Collections.Generic; 9 | using System.Text; 10 | using System.Threading.Tasks; 11 | using WebSocketSharp; 12 | using System.Threading; 13 | using SocketIOSharp.Core; 14 | 15 | namespace ScatterSharp.Core 16 | { 17 | /// 18 | /// Base implementation for socket service using socketio-sharp interface 19 | /// 20 | public abstract class SocketServiceBase : ISocketService 21 | { 22 | protected readonly int OPEN_TASK_CHECK_INTERVAL_SECS = 1; 23 | protected bool Paired { get; set; } 24 | protected IAppStorageProvider StorageProvider { get; set; } 25 | protected string AppName { get; set; } 26 | protected int TimeoutMS { get; set; } 27 | 28 | protected ISocketIO SockIO { get; set; } 29 | protected Dictionary OpenTasks { get; set; } 30 | protected string PairOpenId { get; set; } 31 | protected Task TimoutTasksTask { get; set; } 32 | protected Dictionary>> EventListenersDict { get; set; } 33 | 34 | /// 35 | /// Constructor for socket service 36 | /// 37 | /// Storage service for appName and nonce 38 | /// socketio-sharp configurator 39 | /// app name 40 | /// default app request timeout in milliseconds 41 | public SocketServiceBase(IAppStorageProvider storageProvider, SocketIOConfigurator config, string appName, int timeout = 60000) 42 | { 43 | OpenTasks = new Dictionary(); 44 | EventListenersDict = new Dictionary>>(); 45 | 46 | if (storageProvider == null) 47 | throw new ArgumentNullException("storageProvider"); 48 | 49 | StorageProvider = storageProvider; 50 | AppName = appName; 51 | TimeoutMS = timeout; 52 | 53 | PairOpenId = UtilsHelper.RandomNumber(24); 54 | } 55 | 56 | /// 57 | /// dispose socketio-sharp websocket 58 | /// 59 | public void Dispose() 60 | { 61 | SockIO.Dispose(); 62 | StorageProvider.Save(); 63 | } 64 | 65 | /// 66 | /// Link to scatter application by connecting, registering events and pair with passthrough 67 | /// 68 | /// Uri to link to 69 | /// set response timeout that overrides the default one 70 | /// 71 | public async Task Link(Uri uri, int? timeout = null) 72 | { 73 | if (SockIO.GetState() == WebSocketState.Open) 74 | return true; 75 | 76 | if (SockIO.GetState() != WebSocketState.Open && SockIO.GetState() != WebSocketState.Connecting) 77 | { 78 | await SockIO.ConnectAsync(uri); 79 | } 80 | 81 | if (SockIO.GetState() != WebSocketState.Open) 82 | return false; 83 | 84 | SockIO.On("paired", HandlePairedResponse); 85 | SockIO.On("rekey", HandleRekeyResponse); 86 | SockIO.On("api", HandleApiResponse); 87 | SockIO.On("event", HandleEventResponse); 88 | 89 | StartTimeoutOpenTasksCheck(); 90 | 91 | await Pair(true, timeout); 92 | return true; 93 | } 94 | 95 | /// 96 | /// Pair appication to registered applications in scatter 97 | /// 98 | /// pass through rekey process 99 | /// set response timeout that overrides the default one 100 | /// 101 | public async Task Pair(bool passthrough = false, int? timeout = null) 102 | { 103 | var pairOpenTask = new TaskCompletionSource(); 104 | var openTask = new OpenTask() 105 | { 106 | PromiseTask = pairOpenTask, 107 | TaskRequestTime = DateTime.Now, 108 | TaskTimeoutMS = timeout.HasValue ? timeout.Value : TimeoutMS 109 | }; 110 | 111 | if (OpenTasks.ContainsKey(PairOpenId)) 112 | OpenTasks[PairOpenId] = openTask; 113 | else 114 | OpenTasks.Add(PairOpenId, openTask); 115 | 116 | await SockIO.EmitAsync("pair", new RequestWrapper() 117 | { 118 | data = new PairRequest() 119 | { 120 | appkey = StorageProvider.GetAppkey(), 121 | passthrough = passthrough, 122 | origin = AppName 123 | }, 124 | plugin = AppName 125 | }); 126 | 127 | await pairOpenTask.Task; 128 | } 129 | 130 | /// 131 | /// Send api request to scatter 132 | /// 133 | /// Request type param 134 | /// Return type param 135 | /// Request object 136 | /// set response timeout that overrides the default one 137 | /// 138 | public async Task SendApiRequest(Request request, int? timeout = null) 139 | { 140 | if (request.type == "identityFromPermissions" && !Paired) 141 | { 142 | return default(TReturn); 143 | } 144 | 145 | await Pair(); 146 | 147 | if (!Paired) 148 | throw new Exception("The user did not allow this app to connect to their Scatter"); 149 | 150 | var tcs = new TaskCompletionSource(); 151 | 152 | do 153 | { 154 | request.id = UtilsHelper.RandomNumber(24); 155 | } 156 | while (OpenTasks.ContainsKey(request.id)); 157 | 158 | request.appkey = StorageProvider.GetAppkey(); 159 | request.nonce = StorageProvider.GetNonce() ?? ""; 160 | 161 | var nextNonce = UtilsHelper.RandomNumberBytes(); 162 | request.nextNonce = UtilsHelper.ByteArrayToHexString(Sha256Manager.GetHash(nextNonce)); 163 | StorageProvider.SetNonce(UtilsHelper.ByteArrayToHexString(nextNonce)); 164 | 165 | OpenTasks.Add(request.id, new OpenTask() 166 | { 167 | PromiseTask = tcs, 168 | TaskRequestTime = DateTime.Now, 169 | TaskTimeoutMS = timeout.HasValue ? timeout.Value : TimeoutMS 170 | }); 171 | 172 | await SockIO.EmitAsync("api", new RequestWrapper() 173 | { 174 | data = request, 175 | plugin = AppName 176 | }); 177 | 178 | return BuildApiResponse(await tcs.Task); 179 | } 180 | 181 | /// 182 | /// Disconnect from socket 183 | /// 184 | /// 185 | public Task Disconnect() 186 | { 187 | return SockIO.DisconnectAsync(); 188 | } 189 | 190 | /// 191 | /// Check if socket connection is open 192 | /// 193 | /// 194 | public bool IsConnected() 195 | { 196 | return SockIO.GetState() == WebSocketState.Open; 197 | } 198 | 199 | /// 200 | /// Check if socket service is paired with scatter 201 | /// 202 | /// 203 | public bool IsPaired() 204 | { 205 | return Paired; 206 | } 207 | 208 | /// 209 | /// Register listener for socketio event type 210 | /// 211 | /// 212 | /// 213 | public void On(string type, Action callback) 214 | { 215 | if (callback == null) 216 | return; 217 | 218 | List> eventListeners = null; 219 | 220 | if (EventListenersDict.TryGetValue(type, out eventListeners)) 221 | { 222 | eventListeners.Add(callback); 223 | } 224 | else 225 | { 226 | EventListenersDict.Add(type, new List>() { callback }); 227 | } 228 | } 229 | 230 | /// 231 | /// Remove listener by event type 232 | /// 233 | /// event type 234 | public void Off(string type) 235 | { 236 | if (EventListenersDict.ContainsKey(type)) 237 | EventListenersDict[type].Clear(); 238 | } 239 | 240 | /// 241 | /// Remove listener by event type and position 242 | /// 243 | /// event type 244 | /// position 245 | public void Off(string type, int index) 246 | { 247 | if (EventListenersDict.ContainsKey(type)) 248 | EventListenersDict[type].RemoveAt(index); 249 | } 250 | 251 | /// 252 | /// Remove listener by callback instance 253 | /// 254 | /// 255 | public void Off(Action callback) 256 | { 257 | foreach (var el in EventListenersDict.Values) 258 | { 259 | el.Remove(callback); 260 | } 261 | } 262 | 263 | /// 264 | /// remove listner by event type and callback instance 265 | /// 266 | /// 267 | /// 268 | public void Off(string type, Action callback) 269 | { 270 | if (EventListenersDict.ContainsKey(type)) 271 | EventListenersDict[type].Remove(callback); 272 | } 273 | 274 | #region Utils 275 | 276 | protected IEnumerator TimeoutOpenTasksCheck() 277 | { 278 | while (SockIO.GetState() == WebSocketState.Open) 279 | { 280 | var now = DateTime.Now; 281 | int count = 0; 282 | List toRemoveKeys = new List(); 283 | 284 | foreach (var key in OpenTasks.Keys.ToList()) 285 | { 286 | OpenTask openTask; 287 | if (!OpenTasks.TryGetValue(key, out openTask)) 288 | { 289 | continue; 290 | } 291 | 292 | if ((now - openTask.TaskRequestTime).TotalMilliseconds >= openTask.TaskTimeoutMS) 293 | { 294 | toRemoveKeys.Add(key); 295 | } 296 | 297 | //sleep checking each 10 requests 298 | if ((count % ScatterConstants.OPEN_TASK_NR_CHECK) == 0) 299 | { 300 | count = 0; 301 | yield return WaitForOpenTasksCheck(ScatterConstants.OPEN_TASK_CHECK_INTERVAL_SECS); 302 | } 303 | 304 | count++; 305 | } 306 | 307 | foreach (var key in toRemoveKeys) 308 | { 309 | OpenTask openTask; 310 | if (!OpenTasks.TryGetValue(key, out openTask)) 311 | continue; 312 | 313 | OpenTasks.Remove(key); 314 | 315 | openTask.PromiseTask.SetResult(BuildApiError()); 316 | } 317 | yield return WaitForOpenTasksCheck(ScatterConstants.OPEN_TASK_CHECK_INTERVAL_SECS); 318 | } 319 | } 320 | 321 | protected void HandlePairedResponse(bool? paired) 322 | { 323 | Paired = paired.GetValueOrDefault(); 324 | 325 | if (Paired) 326 | { 327 | var storedAppKey = StorageProvider.GetAppkey(); 328 | 329 | string hashed = storedAppKey.StartsWith("appkey:") ? 330 | UtilsHelper.ByteArrayToHexString(Sha256Manager.GetHash(Encoding.UTF8.GetBytes(storedAppKey))) : 331 | storedAppKey; 332 | 333 | if (string.IsNullOrWhiteSpace(storedAppKey) || 334 | storedAppKey != hashed) 335 | { 336 | StorageProvider.SetAppkey(hashed); 337 | } 338 | } 339 | 340 | OpenTask openTask; 341 | if (!OpenTasks.TryGetValue(PairOpenId, out openTask)) 342 | return; 343 | 344 | openTask.PromiseTask.SetResult(Paired); 345 | openTask.TaskTimeoutMS = int.MaxValue; 346 | } 347 | 348 | protected void GenerateNewAppKey() 349 | { 350 | StorageProvider.SetAppkey("appkey:" + UtilsHelper.RandomNumber(24)); 351 | } 352 | 353 | protected abstract TReturn BuildApiResponse(object jtoken); 354 | 355 | protected abstract void StartTimeoutOpenTasksCheck(); 356 | 357 | protected abstract object WaitForOpenTasksCheck(int openTaskCheckIntervalSecs); 358 | 359 | protected abstract object BuildApiError(); 360 | 361 | protected abstract void HandlePairedResponse(IEnumerable args); 362 | 363 | protected abstract void HandleApiResponse(IEnumerable args); 364 | 365 | protected abstract void HandleEventResponse(IEnumerable args); 366 | 367 | private void HandleRekeyResponse(IEnumerable args) 368 | { 369 | GenerateNewAppKey(); 370 | SockIO.EmitAsync("rekeyed", new RequestWrapper() 371 | { 372 | plugin = AppName, 373 | data = new RekeyRequest() 374 | { 375 | origin = AppName, 376 | appkey = StorageProvider.GetAppkey() 377 | } 378 | }); 379 | } 380 | 381 | #endregion 382 | } 383 | } 384 | -------------------------------------------------------------------------------- /ScatterSharp/ScatterSharp.Core/Storage/FileStorageProvider.cs: -------------------------------------------------------------------------------- 1 | using ScatterSharp.Core.Interfaces; 2 | using System; 3 | using System.IO; 4 | using System.Runtime.Serialization.Formatters.Binary; 5 | 6 | namespace ScatterSharp.Core.Storage 7 | { 8 | public class FileStorageProvider : IAppStorageProvider 9 | { 10 | [Serializable] 11 | public class AppData 12 | { 13 | public string Appkey; 14 | public string Nonce; 15 | } 16 | 17 | private string FilePath { get; set; } 18 | private AppData Data { get; set; } 19 | 20 | /// 21 | /// Construct file based storage implementation 22 | /// 23 | /// File path to create/update file 24 | public FileStorageProvider(string filePath) 25 | { 26 | FilePath = filePath; 27 | Load(); 28 | } 29 | 30 | /// 31 | /// Get Nonce 32 | /// 33 | /// 34 | public string GetNonce() 35 | { 36 | return Data.Nonce; 37 | } 38 | 39 | /// 40 | /// Set nonce as hex string 41 | /// 42 | /// 43 | public void SetNonce(string nonce) 44 | { 45 | Data.Nonce = nonce; 46 | } 47 | 48 | /// 49 | /// Get app key 50 | /// 51 | /// 52 | public string GetAppkey() 53 | { 54 | return Data.Appkey; 55 | } 56 | 57 | /// 58 | /// Set appkey 59 | /// 60 | /// 61 | public void SetAppkey(string appkey) 62 | { 63 | Data.Appkey = appkey; 64 | } 65 | 66 | /// 67 | /// Save all information to storage 68 | /// 69 | public void Save() 70 | { 71 | var bf = new BinaryFormatter(); 72 | var fs = File.Create(FilePath); 73 | bf.Serialize(fs, Data); 74 | fs.Close(); 75 | } 76 | 77 | /// 78 | /// Load all information from storage 79 | /// 80 | public void Load() 81 | { 82 | if (!File.Exists(FilePath)) 83 | { 84 | Data = new AppData(); 85 | return; 86 | } 87 | 88 | var bf = new BinaryFormatter(); 89 | var fs = File.Open(FilePath, FileMode.Open); 90 | Data = (AppData)bf.Deserialize(fs); 91 | 92 | fs.Close(); 93 | } 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /ScatterSharp/ScatterSharp.Core/Storage/MemoryStorageProvider.cs: -------------------------------------------------------------------------------- 1 | using ScatterSharp.Core.Interfaces; 2 | 3 | namespace ScatterSharp.Core.Storage 4 | { 5 | public class MemoryStorageProvider : IAppStorageProvider 6 | { 7 | private string Appkey { get; set; } 8 | private string Nonce { get; set; } 9 | 10 | public MemoryStorageProvider() 11 | { 12 | } 13 | 14 | public string GetAppkey() 15 | { 16 | return Appkey; 17 | } 18 | 19 | public string GetNonce() 20 | { 21 | return Nonce; 22 | } 23 | 24 | public void SetAppkey(string appkey) 25 | { 26 | Appkey = appkey; 27 | } 28 | 29 | public void SetNonce(string nonce) 30 | { 31 | Nonce = nonce; 32 | } 33 | 34 | public void Save() 35 | { 36 | } 37 | 38 | public void Load() 39 | { 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /ScatterSharp/ScatterSharp.EosProvider/ScatterSharp.EosProvider.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | netstandard2.0 5 | scatter-sharp-eos 6 | Mário Silva 7 | GetScatter 8 | scatter-sharp-eos 9 | Scatter C# library to interact with ScatterDesktop / ScatterMobile - eos signature provider implementation 10 | Copyright 2019 11 | https://github.com/GetScatter/scatter-sharp/blob/master/LICENSE 12 | https://github.com/GetScatter/scatter-sharp 13 | https://github.com/GetScatter/scatter-sharp 14 | git 15 | EOS, NetStandard, secp256k1, Blockchain, Scatter 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 28 | 29 | $(TargetsForTfmSpecificBuildOutput);CopyProjectReferencesToPackage 30 | 31 | $(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb 32 | 1.1.3 33 | 1.1.3.0 34 | 1.1.3.0 35 | eos-sharp: Fix Use convert ToDecimal instead of explicit cast 36 | eos-sharp: Fix object to float conversion InvalidCastException (by KGMaxey) 37 | eos-sharp: Add support for variant fields 38 | eos-sharp: Add support for binary extension types (by dbulha) 39 | eos-sharp: Add block_num_hint to gettransaction (by dbulha) 40 | eos-sharp: Changed authority accounts to use permission level (by dbulha) 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /ScatterSharp/ScatterSharp.EosProvider/ScatterSignatureProvider.cs: -------------------------------------------------------------------------------- 1 | using EosSharp.Core.Interfaces; 2 | using ScatterSharp.Core; 3 | using ScatterSharp.Core.Api; 4 | using ScatterSharp.Core.Helpers; 5 | using ScatterSharp.Core.Interfaces; 6 | using System; 7 | using System.Collections.Generic; 8 | using System.Linq; 9 | using System.Threading.Tasks; 10 | 11 | namespace ScatterSharp.EosProvider 12 | { 13 | /// 14 | /// Signature provider implementation for comunnicating with ScatterDesktop 15 | /// 16 | public class ScatterSignatureProvider : ISignProvider 17 | { 18 | private IScatter Scatter { get; set; } 19 | 20 | public ScatterSignatureProvider(IScatter scatter) 21 | { 22 | Scatter = scatter; 23 | } 24 | 25 | /// 26 | /// Get available public keys from signature provider 27 | /// 28 | /// List of public keys 29 | public async Task> GetAvailableKeys() 30 | { 31 | var identity = await Scatter.GetIdentityFromPermissions(); 32 | 33 | if (identity == null) 34 | throw new ArgumentNullException("identity"); 35 | 36 | if (identity.accounts == null) 37 | throw new ArgumentNullException("identity.Accounts"); 38 | 39 | return identity.accounts.Select(acc => acc.publicKey); 40 | } 41 | 42 | /// 43 | /// Sign bytes using the signature provider 44 | /// 45 | /// EOSIO Chain id 46 | /// required public keys for signing this bytes 47 | /// signature bytes 48 | /// abi contract names to get abi information from 49 | /// List of signatures per required keys 50 | public async Task> Sign(string chainId, IEnumerable requiredKeys, byte[] signBytes, IEnumerable abiNames = null) 51 | { 52 | IEnumerable abis = null; 53 | 54 | if (abiNames != null) 55 | abis = abiNames.Select(a => new AbiRequest() { account_name = a }); 56 | else 57 | abis = new List(); 58 | 59 | var result = await Scatter.RequestSignature(new SignatureRequest() 60 | { 61 | network = Scatter.GetNetwork(), 62 | blockchain = ScatterConstants.Blockchains.EOSIO, 63 | requiredFields = new List(), //TODO create concrete object for requiredFields 64 | transaction = new Transaction() 65 | { 66 | abis = abis, 67 | serializedTransaction = UtilsHelper.ByteArrayToHexString(signBytes), 68 | chainId = chainId 69 | }, 70 | origin = Scatter.GetAppName() 71 | }); 72 | 73 | return result.signatures; 74 | } 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /ScatterSharp/ScatterSharp.UnitTests.Core/ScatterSharp.UnitTests.Core.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netstandard2.0 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /ScatterSharp/ScatterSharp.UnitTests.Core/ScatterUnitTestCases.cs: -------------------------------------------------------------------------------- 1 | using ScatterSharp.Core.Api; 2 | using ScatterSharp.Core.Helpers; 3 | using System; 4 | using System.Linq; 5 | using System.Collections.Generic; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | using ScatterSharp.Core.Interfaces; 9 | using ScatterSharp.Core; 10 | 11 | namespace ScatterSharp.UnitTests.Core 12 | { 13 | public class ScatterUnitTestCases : IDisposable 14 | { 15 | private IScatter Scatter { get; set; } 16 | private Network Network { get; set; } 17 | 18 | public ScatterUnitTestCases(IScatter scatter, Network network) 19 | { 20 | Scatter = scatter; 21 | Network = network; 22 | } 23 | 24 | public void Dispose() 25 | { 26 | Scatter.Dispose(); 27 | } 28 | 29 | public async Task Connect() 30 | { 31 | await Scatter.Connect(3000); 32 | } 33 | 34 | public async Task GetVersion() 35 | { 36 | await Scatter.Connect(); 37 | return await Scatter.GetVersion(); 38 | } 39 | 40 | public async Task GetIdentity() 41 | { 42 | await Scatter.Connect(); 43 | return await GetIdentityFromScatter(); 44 | } 45 | 46 | public async Task LoginAll() 47 | { 48 | await Scatter.Connect(); 49 | return await Scatter.LoginAll(); 50 | } 51 | 52 | public async Task GetIdentityFromPermissions() 53 | { 54 | await Scatter.Connect(); 55 | return await Scatter.GetIdentityFromPermissions(); 56 | } 57 | 58 | public async Task GetAvatar() 59 | { 60 | await Scatter.Connect(); 61 | return await Scatter.GetAvatar(); 62 | } 63 | 64 | public async Task ForgetIdentity() 65 | { 66 | await Scatter.Connect(); 67 | return await Scatter.ForgetIdentity(); 68 | } 69 | 70 | public async Task Authenticate() 71 | { 72 | await Scatter.Connect(); 73 | var identity = await GetIdentityFromScatter(); 74 | return await Scatter.Authenticate(UtilsHelper.RandomNumber()); 75 | } 76 | 77 | public async Task GetArbitrarySignature() 78 | { 79 | await Scatter.Connect(); 80 | var identity = await GetIdentityFromScatter(); 81 | return await Scatter.GetArbitrarySignature(identity.publicKey, "HELLO WORLD!"); 82 | } 83 | 84 | public async Task GetPublicKey() 85 | { 86 | await Scatter.Connect(); 87 | return await Scatter.GetPublicKey(ScatterConstants.Blockchains.EOSIO); 88 | } 89 | 90 | public async Task LinkAccount() 91 | { 92 | await Scatter.Connect(); 93 | var identity = await GetIdentityFromScatter(); 94 | var account = identity.accounts.First(); 95 | return await Scatter.LinkAccount(new LinkAccount() { 96 | publicKey = account.publicKey, 97 | name = account.name, 98 | authority = account.authority 99 | }); 100 | } 101 | 102 | public async Task HasAccountFor() 103 | { 104 | await Scatter.Connect(); 105 | return await Scatter.HasAccountFor(); 106 | } 107 | 108 | public async Task SuggestNetwork() 109 | { 110 | await Scatter.Connect(); 111 | return await Scatter.SuggestNetwork(); 112 | } 113 | 114 | //TODO parse "error": "to account does not exist" 115 | 116 | public async Task RequestTransfer() 117 | { 118 | await Scatter.Connect(); 119 | return await Scatter.RequestTransfer("tester112345", "tester212345", "0.0001 EOS"); 120 | } 121 | 122 | public async Task RequestSignature() 123 | { 124 | await Scatter.Connect(); 125 | var identity = await GetIdentityFromScatter(); 126 | return await Scatter.RequestSignature(new 127 | { 128 | Network, 129 | blockchain = ScatterConstants.Blockchains.EOSIO, 130 | requiredFields = new List(), 131 | //TODO add transaction 132 | origin = Scatter.GetAppName() 133 | }); 134 | } 135 | 136 | public async Task AddToken() 137 | { 138 | await Scatter.Connect(); 139 | var identity = await GetIdentityFromScatter(); 140 | await Scatter.AddToken(new Token() 141 | { 142 | name = "EOS", 143 | symbol = "EOS", 144 | contract = "eosio.token" 145 | }); 146 | } 147 | 148 | public async Task GetEncryptionKey() 149 | { 150 | await Scatter.Connect(); 151 | 152 | var fromKey = await Scatter.GetPublicKey(ScatterConstants.Blockchains.EOSIO); 153 | var toKey = await Scatter.GetPublicKey(ScatterConstants.Blockchains.EOSIO); 154 | var r = new Random(); 155 | 156 | return await Scatter.GetEncryptionKey(fromKey, toKey, (UInt64)r.Next()); 157 | } 158 | 159 | public async Task OneWayEncryptDecrypt() 160 | { 161 | await Scatter.Connect(); 162 | 163 | var fromKey = await Scatter.GetPublicKey(ScatterConstants.Blockchains.EOSIO); 164 | var toKey = await Scatter.GetPublicKey(ScatterConstants.Blockchains.EOSIO); 165 | var r = new Random(); 166 | var encryptionKey = await Scatter.GetEncryptionKey(fromKey, toKey, (UInt64)r.Next()); 167 | var encryptionKeyBytes = UtilsHelper.HexStringToByteArray(encryptionKey); 168 | 169 | string text = "Hello crypto secret message!"; 170 | var encrypted = CryptoHelper.AesEncrypt(encryptionKeyBytes, text); 171 | var roundtrip = CryptoHelper.AesDecrypt(encryptionKeyBytes, encrypted); 172 | 173 | Console.WriteLine("FromKey: {0}", fromKey); 174 | Console.WriteLine("ToKey: {0}", toKey); 175 | Console.WriteLine("Original: {0}", text); 176 | Console.WriteLine("Encrypted: {0}", Encoding.UTF8.GetString(encrypted)); 177 | Console.WriteLine("Round Trip: {0}", roundtrip); 178 | } 179 | 180 | public async Task SimulateSendSecretMessage() 181 | { 182 | await Scatter.Connect(); 183 | 184 | var fromKey = await Scatter.GetPublicKey(ScatterConstants.Blockchains.EOSIO); 185 | var toKey = await Scatter.GetPublicKey(ScatterConstants.Blockchains.EOSIO); 186 | var r = new Random(); 187 | var nonce = (UInt64)r.Next(); 188 | var text = "Hello crypto secret message!"; 189 | var encryptionKeyA = await Scatter.GetEncryptionKey(fromKey, toKey, nonce); 190 | var encryptionKeyABytes = UtilsHelper.HexStringToByteArray(encryptionKeyA); 191 | 192 | Console.WriteLine("FromKey: {0}", fromKey); 193 | Console.WriteLine("ToKey: {0}", toKey); 194 | Console.WriteLine("Original: {0}", text); 195 | 196 | var encrypted = CryptoHelper.AesEncrypt(encryptionKeyABytes, text); 197 | Console.WriteLine("Encrypted: {0}", Encoding.UTF8.GetString(encrypted)); 198 | 199 | //...Send over the wire... 200 | 201 | var encryptionKeyB = await Scatter.GetEncryptionKey(toKey, fromKey, nonce); 202 | var encryptionKeyBBytes = UtilsHelper.HexStringToByteArray(encryptionKeyB); 203 | 204 | Console.WriteLine("A_PVT_KEY + B_PUB_KEY: {0}", encryptionKeyA); 205 | Console.WriteLine("B_PVT_KEY + A_PUB_KEY: {0}", encryptionKeyB); 206 | 207 | var roundtrip = CryptoHelper.AesDecrypt(encryptionKeyBBytes, encrypted); 208 | Console.WriteLine("Round Trip: {0}", roundtrip); 209 | 210 | return encryptionKeyA == encryptionKeyB; 211 | } 212 | 213 | private async Task GetIdentityFromScatter() 214 | { 215 | return await Scatter.GetIdentity(new IdentityRequiredFields() 216 | { 217 | accounts = new List() 218 | { 219 | Network 220 | }, 221 | location = new List(), 222 | personal = new List() 223 | }); 224 | } 225 | } 226 | } 227 | -------------------------------------------------------------------------------- /ScatterSharp/ScatterSharp.UnitTests.Unity3D/ScatterEosUnitTests.cs: -------------------------------------------------------------------------------- 1 | //using Newtonsoft.Json; 2 | using ScatterSharp.Core.Api; 3 | using ScatterSharp.UnitTests.Core; 4 | using System; 5 | using System.Threading.Tasks; 6 | 7 | namespace ScatterSharp.UnitTests 8 | { 9 | //public class ScatterEosUnitTests 10 | //{ 11 | // //mainnet 12 | // public static readonly Network network = new Network() 13 | // { 14 | // blockchain = Scatter.Blockchains.EOSIO, 15 | // host = "api.eossweden.se", 16 | // port = 443, 17 | // chainId = "aca376f206b8fc25a6ed44dbdc66547c36c6c33e3a119ffbeaef943642f0e906" 18 | // }; 19 | 20 | // //btuga testnet 21 | // //public static readonly Api.Network network = new Api.Network() 22 | // //{ 23 | // // Blockchain = Scatter.Blockchains.EOSIO, 24 | // // Host = "nodeos01.btuga.io", 25 | // // Port = 443, 26 | // // ChainId = "cf057bbfb72640471fd910bcb67639c22df9f92470936cddc1ade0e2f2e7dc4f" 27 | // //}; 28 | 29 | // public ScatterEosUnitTestCases ScatterEosUnitTestCases { get; set; } 30 | 31 | // public ScatterEosUnitTests() 32 | // { 33 | // var scatter = new Scatter("SCATTER-SHARP", network); 34 | // ScatterEosUnitTestCases = new ScatterEosUnitTestCases(scatter, network); 35 | // } 36 | 37 | // public async Task Connect() 38 | // { 39 | // bool success = false; 40 | 41 | // try 42 | // { 43 | // await ScatterEosUnitTestCases.Connect(); 44 | // success = true; 45 | // } 46 | // catch (Exception ex) 47 | // { 48 | // Console.WriteLine(JsonConvert.SerializeObject(ex)); 49 | // } 50 | 51 | // if (success) 52 | // Console.WriteLine("Test Connect run successfuly."); 53 | // else 54 | // Console.WriteLine("Test Connect run failed."); 55 | // } 56 | 57 | // public async Task PushTransaction() 58 | // { 59 | // bool success = false; 60 | 61 | // try 62 | // { 63 | // success = await ScatterEosUnitTestCases.PushTransaction(); 64 | // } 65 | // catch (Exception ex) 66 | // { 67 | // Console.WriteLine(JsonConvert.SerializeObject(ex)); 68 | // } 69 | 70 | // if (success) 71 | // Console.WriteLine("Test PushTransaction run successfuly."); 72 | // else 73 | // Console.WriteLine("Test PushTransaction run failed."); 74 | // } 75 | //} 76 | } 77 | -------------------------------------------------------------------------------- /ScatterSharp/ScatterSharp.UnitTests.Unity3D/ScatterSharp.UnitTests.Unity3D.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | netstandard2.0 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | C:\Program Files\Unity\Editor\Data\Managed\UnityEditor.dll 20 | C:\Program Files\Unity\Hub\Editor\2019.1.12f1\Editor\Data\Managed\UnityEditor.dll 21 | 22 | 23 | C:\Program Files\Unity\Editor\Data\Managed\UnityEngine.dll 24 | C:\Program Files\Unity\Hub\Editor\2019.1.12f1\Editor\Data\Managed\UnityEngine.dll 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /ScatterSharp/ScatterSharp.UnitTests.Unity3D/ScatterUnitTests.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using ScatterSharp.Core; 3 | using ScatterSharp.Core.Storage; 4 | using ScatterSharp.UnitTests.Core; 5 | using ScatterSharp.Unity3D; 6 | using System; 7 | using System.Threading.Tasks; 8 | using UnityEngine; 9 | 10 | namespace ScatterSharp.UnitTests 11 | { 12 | public class ScatterUnitTests : IDisposable 13 | { 14 | //mainnet 15 | public static readonly ScatterSharp.Core.Api.Network network = new ScatterSharp.Core.Api.Network() 16 | { 17 | blockchain = ScatterConstants.Blockchains.EOSIO, 18 | host = "nodes.eos42.io", 19 | port = 443, 20 | chainId = "aca376f206b8fc25a6ed44dbdc66547c36c6c33e3a119ffbeaef943642f0e906" 21 | }; 22 | 23 | //Jungle testnet 24 | //public static readonly ScatterSharp.Core.Api.Network network = new ScatterSharp.Core.Api.Network() 25 | //{ 26 | // blockchain = ScatterConstants.Blockchains.EOSIO, 27 | // host = "jungle.cryptolions.io", 28 | // port = 18888, 29 | // chainId = "cf057bbfb72640471fd910bcb67639c22df9f92470936cddc1ade0e2f2e7dc4f" 30 | //}; 31 | 32 | public ScatterUnitTestCases ScatterUnitTestCases { get; set; } 33 | 34 | public ScatterUnitTests(MonoBehaviour scriptInstance) 35 | { 36 | var fileStorage = new FileStorageProvider(Application.persistentDataPath + "/scatterapp.dat"); 37 | 38 | var scatter = new Scatter(new ScatterConfigurator() 39 | { 40 | AppName = "UNITY-WEBGL-SCATTER-SHARP", 41 | Network = network, 42 | StorageProvider = fileStorage 43 | }, scriptInstance); 44 | 45 | ScatterUnitTestCases = new ScatterUnitTestCases(scatter, network); 46 | } 47 | 48 | public void Dispose() 49 | { 50 | ScatterUnitTestCases.Dispose(); 51 | } 52 | 53 | public async Task Connect() 54 | { 55 | bool success = false; 56 | 57 | try 58 | { 59 | await ScatterUnitTestCases.Connect(); 60 | success = true; 61 | } 62 | catch(Exception ex) 63 | { 64 | Console.WriteLine(JsonConvert.SerializeObject(ex)); 65 | } 66 | 67 | if (success) 68 | Console.WriteLine("Test Connect run successfuly."); 69 | else 70 | Console.WriteLine("Test Connect run failed."); 71 | } 72 | 73 | public async Task GetVersion() 74 | { 75 | bool success = false; 76 | 77 | try 78 | { 79 | 80 | Console.WriteLine(JsonConvert.SerializeObject(await ScatterUnitTestCases.GetVersion())); 81 | success = true; 82 | } 83 | catch (Exception ex) 84 | { 85 | Console.WriteLine(JsonConvert.SerializeObject(ex)); 86 | } 87 | 88 | if (success) 89 | Console.WriteLine("Test GetVersion run successfuly."); 90 | else 91 | Console.WriteLine("Test GetVersion run failed."); 92 | } 93 | 94 | public async Task GetIdentity() 95 | { 96 | bool success = false; 97 | 98 | try 99 | { 100 | Console.WriteLine(JsonConvert.SerializeObject(await ScatterUnitTestCases.GetIdentity())); 101 | success = true; 102 | } 103 | catch (Exception ex) 104 | { 105 | Console.WriteLine(JsonConvert.SerializeObject(ex)); 106 | } 107 | 108 | if (success) 109 | Console.WriteLine("Test GetIdentity run successfuly."); 110 | else 111 | Console.WriteLine("Test GetIdentity run failed."); 112 | } 113 | 114 | public async Task GetIdentityFromPermissions() 115 | { 116 | bool success = false; 117 | 118 | try 119 | { 120 | Console.WriteLine(await ScatterUnitTestCases.GetIdentityFromPermissions()); 121 | success = true; 122 | } 123 | catch (Exception ex) 124 | { 125 | Console.WriteLine(JsonConvert.SerializeObject(ex)); 126 | } 127 | 128 | if (success) 129 | Console.WriteLine("Test GetIdentityFromPermissions run successfuly."); 130 | else 131 | Console.WriteLine("Test GetIdentityFromPermissions run failed."); 132 | } 133 | 134 | public async Task ForgetIdentity() 135 | { 136 | bool success = false; 137 | 138 | try 139 | { 140 | Console.WriteLine(await ScatterUnitTestCases.ForgetIdentity()); 141 | success = true; 142 | } 143 | catch (Exception ex) 144 | { 145 | Console.WriteLine(JsonConvert.SerializeObject(ex)); 146 | } 147 | 148 | if (success) 149 | Console.WriteLine("Test ForgetIdentity run successfuly."); 150 | else 151 | Console.WriteLine("Test ForgetIdentity run failed."); 152 | } 153 | 154 | public async Task Authenticate() 155 | { 156 | bool success = false; 157 | 158 | try 159 | { 160 | Console.WriteLine(await ScatterUnitTestCases.Authenticate()); 161 | success = true; 162 | } 163 | catch (Exception ex) 164 | { 165 | Console.WriteLine(JsonConvert.SerializeObject(ex)); 166 | } 167 | 168 | if (success) 169 | Console.WriteLine("Test Authenticate run successfuly."); 170 | else 171 | Console.WriteLine("Test Authenticate run failed."); 172 | } 173 | 174 | public async Task GetArbitrarySignature() 175 | { 176 | bool success = false; 177 | 178 | try 179 | { 180 | Console.WriteLine(await ScatterUnitTestCases.GetArbitrarySignature()); 181 | success = true; 182 | } 183 | catch (Exception ex) 184 | { 185 | Console.WriteLine(JsonConvert.SerializeObject(ex)); 186 | } 187 | 188 | if (success) 189 | Console.WriteLine("Test GetArbitrarySignature run successfuly."); 190 | else 191 | Console.WriteLine("Test GetArbitrarySignature run failed."); 192 | } 193 | 194 | public async Task GetPublicKey() 195 | { 196 | bool success = false; 197 | 198 | try 199 | { 200 | Console.WriteLine(await ScatterUnitTestCases.GetPublicKey()); 201 | success = true; 202 | } 203 | catch (Exception ex) 204 | { 205 | Console.WriteLine(JsonConvert.SerializeObject(ex)); 206 | } 207 | 208 | if (success) 209 | Console.WriteLine("Test GetPublicKey run successfuly."); 210 | else 211 | Console.WriteLine("Test GetPublicKey run failed."); 212 | } 213 | 214 | public async Task LinkAccount() 215 | { 216 | bool success = false; 217 | 218 | try 219 | { 220 | Console.WriteLine(await ScatterUnitTestCases.LinkAccount()); 221 | success = true; 222 | } 223 | catch (Exception ex) 224 | { 225 | Console.WriteLine(JsonConvert.SerializeObject(ex)); 226 | } 227 | 228 | if (success) 229 | Console.WriteLine("Test LinkAccount run successfuly."); 230 | else 231 | Console.WriteLine("Test LinkAccount run failed."); 232 | } 233 | 234 | public async Task HasAccountFor() 235 | { 236 | bool success = false; 237 | 238 | try 239 | { 240 | Console.WriteLine(await ScatterUnitTestCases.HasAccountFor()); 241 | success = true; 242 | } 243 | catch (Exception ex) 244 | { 245 | Console.WriteLine(JsonConvert.SerializeObject(ex)); 246 | } 247 | 248 | if (success) 249 | Console.WriteLine("Test HasAccountFor run successfuly."); 250 | else 251 | Console.WriteLine("Test HasAccountFor run failed."); 252 | } 253 | 254 | public async Task SuggestNetwork() 255 | { 256 | bool success = false; 257 | 258 | try 259 | { 260 | Console.WriteLine(await ScatterUnitTestCases.SuggestNetwork()); 261 | success = true; 262 | } 263 | catch (Exception ex) 264 | { 265 | Console.WriteLine(JsonConvert.SerializeObject(ex)); 266 | } 267 | 268 | if (success) 269 | Console.WriteLine("Test SuggestNetwork run successfuly."); 270 | else 271 | Console.WriteLine("Test SuggestNetwork run failed."); 272 | } 273 | 274 | //TODO parse "error": "to account does not exist" 275 | public async Task RequestTransfer() 276 | { 277 | bool success = false; 278 | 279 | try 280 | { 281 | Console.WriteLine(await ScatterUnitTestCases.RequestTransfer()); 282 | success = true; 283 | } 284 | catch (Exception ex) 285 | { 286 | Console.WriteLine(JsonConvert.SerializeObject(ex)); 287 | } 288 | 289 | if (success) 290 | Console.WriteLine("Test RequestTransfer run successfuly."); 291 | else 292 | Console.WriteLine("Test RequestTransfer run failed."); 293 | } 294 | 295 | public async Task RequestSignature() 296 | { 297 | bool success = false; 298 | 299 | try 300 | { 301 | Console.WriteLine(await ScatterUnitTestCases.RequestSignature()); 302 | success = true; 303 | } 304 | catch (Exception ex) 305 | { 306 | Console.WriteLine(JsonConvert.SerializeObject(ex)); 307 | } 308 | 309 | if (success) 310 | Console.WriteLine("Test RequestSignature run successfuly."); 311 | else 312 | Console.WriteLine("Test RequestSignature run failed."); 313 | } 314 | 315 | public async Task AddToken() 316 | { 317 | bool success = false; 318 | 319 | try 320 | { 321 | await ScatterUnitTestCases.AddToken(); 322 | success = true; 323 | } 324 | catch (Exception ex) 325 | { 326 | Console.WriteLine(JsonConvert.SerializeObject(ex)); 327 | } 328 | 329 | if (success) 330 | Console.WriteLine("Test AddToken run successfuly."); 331 | else 332 | Console.WriteLine("Test AddToken run failed."); 333 | } 334 | 335 | public async Task GetEncryptionKey() 336 | { 337 | bool success = false; 338 | 339 | try 340 | { 341 | Console.WriteLine(await ScatterUnitTestCases.GetEncryptionKey()); 342 | success = true; 343 | } 344 | catch (Exception ex) 345 | { 346 | Console.WriteLine(JsonConvert.SerializeObject(ex)); 347 | } 348 | 349 | if (success) 350 | Console.WriteLine("Test GetEncryptionKey run successfuly."); 351 | else 352 | Console.WriteLine("Test GetEncryptionKey run failed."); 353 | } 354 | 355 | public async Task OneWayEncryptDecrypt() 356 | { 357 | bool success = false; 358 | 359 | try 360 | { 361 | await ScatterUnitTestCases.OneWayEncryptDecrypt(); 362 | success = true; 363 | } 364 | catch (Exception ex) 365 | { 366 | Console.WriteLine(JsonConvert.SerializeObject(ex)); 367 | } 368 | 369 | if (success) 370 | Console.WriteLine("Test OneWayEncryptDecrypt run successfuly."); 371 | else 372 | Console.WriteLine("Test OneWayEncryptDecrypt run failed."); 373 | } 374 | 375 | public async Task SimulateSendSecretMessage() 376 | { 377 | bool success = false; 378 | 379 | try 380 | { 381 | success = await ScatterUnitTestCases.SimulateSendSecretMessage(); 382 | } 383 | catch (Exception ex) 384 | { 385 | Console.WriteLine(JsonConvert.SerializeObject(ex)); 386 | } 387 | 388 | if (success) 389 | Console.WriteLine("Test OneWayEncryptDecrypt run successfuly."); 390 | else 391 | Console.WriteLine("Test OneWayEncryptDecrypt run failed."); 392 | } 393 | 394 | public async Task TestAll() 395 | { 396 | await Connect(); 397 | await GetVersion(); 398 | await GetIdentity(); 399 | await GetIdentityFromPermissions(); 400 | await ForgetIdentity(); 401 | await Authenticate(); 402 | await GetArbitrarySignature(); 403 | await GetPublicKey(); 404 | await LinkAccount(); 405 | await HasAccountFor(); 406 | await SuggestNetwork(); 407 | await AddToken(); 408 | } 409 | } 410 | } 411 | -------------------------------------------------------------------------------- /ScatterSharp/ScatterSharp.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 | -------------------------------------------------------------------------------- /ScatterSharp/ScatterSharp.UnitTests/ScatterEosUnitTests.cs: -------------------------------------------------------------------------------- 1 | using EosSharp; 2 | using EosSharp.Core.Api.v1; 3 | using Microsoft.VisualStudio.TestTools.UnitTesting; 4 | using ScatterSharp.Core; 5 | using ScatterSharp.Core.Api; 6 | using ScatterSharp.EosProvider; 7 | using System.Linq; 8 | using System.Collections.Generic; 9 | using System.Threading.Tasks; 10 | using System; 11 | using Newtonsoft.Json; 12 | 13 | namespace ScatterSharp.UnitTests 14 | { 15 | [TestClass] 16 | public class ScatterEosUnitTests 17 | { 18 | //mainnet 19 | //public static readonly Network network = new Network() 20 | //{ 21 | // blockchain = Scatter.Blockchains.EOSIO, 22 | // host = "api.eossweden.se", 23 | // port = 443, 24 | // chainId = "aca376f206b8fc25a6ed44dbdc66547c36c6c33e3a119ffbeaef943642f0e906" 25 | //}; 26 | 27 | //jungle testnet 28 | public static readonly Network network = new Network() 29 | { 30 | blockchain = ScatterConstants.Blockchains.EOSIO, 31 | host = "jungle2.cryptolions.io", 32 | port = 443, 33 | chainId = "e70aaab8997e1dfce58fbfac80cbbb8fecec7b99cf982a9444273cbc64c41473" 34 | }; 35 | 36 | public Scatter Scatter { get; set; } 37 | 38 | public ScatterEosUnitTests() 39 | { 40 | Scatter = new Scatter(new ScatterConfigurator() 41 | { 42 | AppName = "MyApp", 43 | Network = network 44 | }); 45 | } 46 | 47 | [TestMethod] 48 | [TestCategory("Scatter EOS Tests")] 49 | public async Task PushTransaction() 50 | { 51 | try 52 | { 53 | await Scatter.Connect(); 54 | 55 | await Scatter.GetIdentity(new IdentityRequiredFields() 56 | { 57 | accounts = new List() 58 | { 59 | network 60 | }, 61 | location = new List(), 62 | personal = new List() 63 | }); 64 | 65 | var eos = new Eos(new EosSharp.Core.EosConfigurator() 66 | { 67 | ChainId = network.chainId, 68 | HttpEndpoint = network.GetHttpEndpoint(), 69 | SignProvider = new ScatterSignatureProvider(Scatter) 70 | }); 71 | 72 | var account = Scatter.Identity.accounts.First(); 73 | 74 | var result = await eos.CreateTransaction(new EosSharp.Core.Api.v1.Transaction() 75 | { 76 | actions = new List() 77 | { 78 | new EosSharp.Core.Api.v1.Action() 79 | { 80 | account = "eosio.token", 81 | authorization = new List() 82 | { 83 | new PermissionLevel() { actor = account.name, permission = account.authority } 84 | }, 85 | name = "transfer", 86 | data = new Dictionary() 87 | { 88 | { "from", account.name }, 89 | { "to", "auaglobalts5" }, 90 | { "quantity", "0.1000 EOS" }, 91 | { "memo", "" } 92 | } 93 | } 94 | } 95 | }); 96 | Console.WriteLine(JsonConvert.SerializeObject(result)); 97 | } 98 | catch(Exception ex) 99 | { 100 | Console.WriteLine(JsonConvert.SerializeObject(ex)); 101 | Assert.Fail(); 102 | } 103 | } 104 | } 105 | } 106 | -------------------------------------------------------------------------------- /ScatterSharp/ScatterSharp.UnitTests/ScatterSharp.UnitTests.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {969C1A19-C591-4EAE-A8F3-AE39878CA2C2} 8 | Library 9 | Properties 10 | ScatterSharp.UnitTests 11 | ScatterSharp.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 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | {E750ADC2-6362-4614-A3B3-CC5CF8114F16} 69 | EosSharp.Core 70 | 71 | 72 | {bb5d6616-77b7-4006-b4cb-fe84e2b368fc} 73 | EosSharp 74 | 75 | 76 | {d20f2a06-4626-4165-8df8-75081b742710} 77 | ScatterSharp.Core 78 | 79 | 80 | {3DC847A8-8FF2-4DF3-ACA5-F3C62023457D} 81 | ScatterSharp.EosProvider 82 | 83 | 84 | {1c962869-5f7d-4612-a9fe-bcb4cb7252b5} 85 | ScatterSharp.UnitTests.Core 86 | 87 | 88 | {a7498dea-becb-49ce-9e9d-e06fdfa29e5a} 89 | ScatterSharp 90 | 91 | 92 | 93 | 94 | 95 | 96 | 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}. 97 | 98 | 99 | 100 | 101 | 102 | -------------------------------------------------------------------------------- /ScatterSharp/ScatterSharp.UnitTests/ScatterUnitTests.cs: -------------------------------------------------------------------------------- 1 | using Cryptography.ECDSA; 2 | using Microsoft.VisualStudio.TestTools.UnitTesting; 3 | using Newtonsoft.Json; 4 | using ScatterSharp.Core; 5 | using ScatterSharp.Core.Api; 6 | using ScatterSharp.Core.Helpers; 7 | using ScatterSharp.Core.Storage; 8 | using ScatterSharp.UnitTests.Core; 9 | using System; 10 | using System.Collections.Generic; 11 | using System.Text; 12 | using System.Threading.Tasks; 13 | 14 | namespace ScatterSharp.UnitTests 15 | { 16 | [TestClass] 17 | public class ScatterUnitTests 18 | { 19 | //mainnet 20 | //public static readonly Network network = new Network() 21 | //{ 22 | // blockchain = ScatterConstants.Blockchains.EOSIO, 23 | // host = "nodes.eos42.io", 24 | // port = 443, 25 | // chainId = "aca376f206b8fc25a6ed44dbdc66547c36c6c33e3a119ffbeaef943642f0e906" 26 | //}; 27 | 28 | //Jungle testnet 29 | public static readonly Network network = new Network() 30 | { 31 | blockchain = ScatterConstants.Blockchains.EOSIO, 32 | host = "jungle2.cryptolions.io", 33 | port = 443, 34 | chainId = "e70aaab8997e1dfce58fbfac80cbbb8fecec7b99cf982a9444273cbc64c41473" 35 | }; 36 | 37 | public ScatterUnitTestCases ScatterUnitTestCases { get; set; } 38 | 39 | public ScatterUnitTests() 40 | { 41 | var storageProvider = new MemoryStorageProvider(); 42 | storageProvider.SetAppkey(UtilsHelper.ByteArrayToHexString(Sha256Manager.GetHash(Encoding.UTF8.GetBytes("appkey:0a182c0d054b6fd9f9361c82fcd040b46c41a6f61952a3ea")))); 43 | 44 | var scatter = new Scatter(new ScatterConfigurator() 45 | { 46 | AppName = "SCATTER-SHARP", 47 | Network = network, 48 | StorageProvider = storageProvider 49 | }); 50 | 51 | ScatterUnitTestCases = new ScatterUnitTestCases(scatter, network); 52 | } 53 | 54 | [TestMethod] 55 | [TestCategory("Scatter Tests")] 56 | public async Task Connect() 57 | { 58 | await ScatterUnitTestCases.Connect(); 59 | } 60 | 61 | [TestMethod] 62 | [TestCategory("Scatter Tests")] 63 | public async Task GetVersion() 64 | { 65 | Console.WriteLine(await ScatterUnitTestCases.GetVersion()); 66 | } 67 | 68 | [TestMethod] 69 | [TestCategory("Scatter Tests")] 70 | public async Task GetIdentity() 71 | { 72 | Console.WriteLine(JsonConvert.SerializeObject(await ScatterUnitTestCases.GetIdentity())); 73 | } 74 | [TestMethod] 75 | [TestCategory("Scatter Tests")] 76 | public async Task LoginAll() 77 | { 78 | Console.WriteLine(JsonConvert.SerializeObject(await ScatterUnitTestCases.LoginAll())); 79 | } 80 | 81 | [TestMethod] 82 | [TestCategory("Scatter Tests")] 83 | public async Task GetIdentityFromPermissions() 84 | { 85 | Console.WriteLine(await ScatterUnitTestCases.GetIdentityFromPermissions()); 86 | } 87 | 88 | [TestMethod] 89 | [TestCategory("Scatter Tests")] 90 | public async Task GetAvatar() 91 | { 92 | Console.WriteLine(JsonConvert.SerializeObject(await ScatterUnitTestCases.GetAvatar())); 93 | } 94 | 95 | [TestMethod] 96 | [TestCategory("Scatter Tests")] 97 | public async Task ForgetIdentity() 98 | { 99 | Console.WriteLine(await ScatterUnitTestCases.ForgetIdentity()); 100 | } 101 | 102 | [TestMethod] 103 | [TestCategory("Scatter Tests")] 104 | public async Task Authenticate() 105 | { 106 | Console.WriteLine(await ScatterUnitTestCases.Authenticate()); 107 | } 108 | 109 | [TestMethod] 110 | [TestCategory("Scatter Tests")] 111 | public async Task GetArbitrarySignature() 112 | { 113 | Console.WriteLine(await ScatterUnitTestCases.GetArbitrarySignature()); 114 | } 115 | 116 | [TestMethod] 117 | [TestCategory("Scatter Tests")] 118 | public async Task GetPublicKey() 119 | { 120 | Console.WriteLine(await ScatterUnitTestCases.GetPublicKey()); 121 | } 122 | 123 | [TestMethod] 124 | [TestCategory("Scatter Tests")] 125 | public async Task LinkAccount() 126 | { 127 | Console.WriteLine(await ScatterUnitTestCases.LinkAccount()); 128 | } 129 | 130 | [TestMethod] 131 | [TestCategory("Scatter Tests")] 132 | public async Task HasAccountFor() 133 | { 134 | Console.WriteLine(await ScatterUnitTestCases.HasAccountFor()); 135 | } 136 | 137 | [TestMethod] 138 | [TestCategory("Scatter Tests")] 139 | public async Task SuggestNetwork() 140 | { 141 | Console.WriteLine(await ScatterUnitTestCases.SuggestNetwork()); 142 | } 143 | 144 | //TODO parse "error": "to account does not exist" 145 | [TestMethod] 146 | [TestCategory("Scatter Tests")] 147 | public async Task RequestTransfer() 148 | { 149 | Console.WriteLine(await ScatterUnitTestCases.RequestTransfer()); 150 | } 151 | 152 | [TestMethod] 153 | [TestCategory("Scatter Tests")] 154 | public async Task RequestSignature() 155 | { 156 | Console.WriteLine(await ScatterUnitTestCases.RequestSignature()); 157 | } 158 | 159 | [TestMethod] 160 | [TestCategory("Scatter Tests")] 161 | public async Task AddToken() 162 | { 163 | await ScatterUnitTestCases.AddToken(); 164 | } 165 | 166 | [TestMethod] 167 | [TestCategory("Scatter Tests")] 168 | public async Task GetEncryptionKey() 169 | { 170 | Console.WriteLine(await ScatterUnitTestCases.GetEncryptionKey()); 171 | } 172 | 173 | [TestMethod] 174 | [TestCategory("Scatter Tests")] 175 | public async Task OneWayEncryptDecrypt() 176 | { 177 | await ScatterUnitTestCases.OneWayEncryptDecrypt(); 178 | } 179 | 180 | [TestMethod] 181 | [TestCategory("Scatter Tests")] 182 | public async Task SimulateSendSecretMessage() 183 | { 184 | Assert.IsTrue(await ScatterUnitTestCases.SimulateSendSecretMessage()); 185 | } 186 | } 187 | } 188 | -------------------------------------------------------------------------------- /ScatterSharp/ScatterSharp.UnitTests/app.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 10 | 11 | -------------------------------------------------------------------------------- /ScatterSharp/ScatterSharp.UnitTests/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ScatterSharp/ScatterSharp.Unity3D/Scatter.cs: -------------------------------------------------------------------------------- 1 | using ScatterSharp.Core; 2 | using ScatterSharp.Core.Storage; 3 | using SocketIOSharp.Core; 4 | using UnityEngine; 5 | 6 | namespace ScatterSharp.Unity3D 7 | { 8 | /// 9 | /// Scatter client using socket service unity3d implementation 10 | /// 11 | public class Scatter : ScatterBase 12 | { 13 | /// 14 | /// Constructor for scatter client with init configuration 15 | /// 16 | /// Configuration object 17 | /// script instance for using coroutines 18 | public Scatter(ScatterConfigurator config, MonoBehaviour scriptInstance = null) : 19 | base(config, new SocketService(config.StorageProvider ?? new MemoryStorageProvider(), new SocketIOConfigurator() 20 | { 21 | Namespace = "scatter", 22 | Proxy = config.Proxy 23 | }, config.AppName, config.DefaultTimeout, scriptInstance)) 24 | { 25 | } 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /ScatterSharp/ScatterSharp.Unity3D/ScatterSharp.Unity3D.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | netstandard2.0 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | C:\Program Files\Unity\Editor\Data\Managed\UnityEditor.dll 15 | C:\Program Files\Unity\Hub\Editor\2019.1.12f1\Editor\Data\Managed\UnityEditor.dll 16 | 17 | 18 | C:\Program Files\Unity\Editor\Data\Managed\UnityEngine.dll 19 | C:\Program Files\Unity\Hub\Editor\2019.1.12f1\Editor\Data\Managed\UnityEngine.dll 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /ScatterSharp/ScatterSharp.Unity3D/SocketService.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json.Linq; 2 | using ScatterSharp.Core; 3 | using ScatterSharp.Core.Api; 4 | using ScatterSharp.Core.Interfaces; 5 | using SocketIOSharp.Core; 6 | using SocketIOSharp.Unity3D; 7 | using System; 8 | using System.Collections.Generic; 9 | using System.Linq; 10 | using System.Threading; 11 | using System.Threading.Tasks; 12 | using UnityEngine; 13 | 14 | namespace ScatterSharp.Unity3D 15 | { 16 | /// 17 | /// Socket service implementation using socketio-sharp for unity3d 18 | /// 19 | public class SocketService : SocketServiceBase 20 | { 21 | private MonoBehaviour ScriptInstance { get; set; } 22 | 23 | public SocketService(IAppStorageProvider storageProvider, SocketIOConfigurator config, string appName, int timeout = 60000, MonoBehaviour scriptInstance = null) : 24 | base(storageProvider, config, appName, timeout) 25 | { 26 | SockIO = new SocketIO(config, scriptInstance); 27 | ScriptInstance = scriptInstance; 28 | } 29 | 30 | #region Utils 31 | 32 | protected override void StartTimeoutOpenTasksCheck() 33 | { 34 | if (Application.platform == RuntimePlatform.WebGLPlayer) 35 | { 36 | if (ScriptInstance != null) 37 | ScriptInstance.StartCoroutine(TimeoutOpenTasksCheck()); 38 | } 39 | else 40 | { 41 | TimoutTasksTask = Task.Run(() => { 42 | var e = TimeoutOpenTasksCheck(); 43 | while (e.MoveNext()); 44 | }); 45 | } 46 | } 47 | 48 | protected override object WaitForOpenTasksCheck(int openTaskCheckIntervalSecs) 49 | { 50 | if (Application.platform == RuntimePlatform.WebGLPlayer) 51 | { 52 | return new WaitForSeconds(openTaskCheckIntervalSecs); 53 | } 54 | else 55 | { 56 | Thread.Sleep(openTaskCheckIntervalSecs * 1000); 57 | return null; 58 | } 59 | } 60 | 61 | protected override object BuildApiError() 62 | { 63 | return JToken.FromObject(new ApiError() 64 | { 65 | code = "0", 66 | isError = "true", 67 | message = "Request timeout." 68 | }); 69 | } 70 | 71 | protected override TReturn BuildApiResponse(object jtoken) 72 | { 73 | var result = jtoken as JToken; 74 | 75 | if (result == null) 76 | return default(TReturn); 77 | 78 | if (result.Type == JTokenType.Object && 79 | result.SelectToken("isError") != null) 80 | { 81 | var apiError = result.ToObject(); 82 | if (apiError != null) 83 | throw new Exception(apiError.message); 84 | } 85 | 86 | return result.ToObject(); 87 | } 88 | 89 | protected override void HandlePairedResponse(IEnumerable args) 90 | { 91 | HandlePairedResponse(args.Cast().First().ToObject()); 92 | } 93 | 94 | protected override void HandleApiResponse(IEnumerable args) 95 | { 96 | var data = args.Cast().First(); 97 | 98 | if (data == null && data.Children().Count() != 2) 99 | return; 100 | 101 | var idToken = data.SelectToken("id"); 102 | 103 | if (idToken == null) 104 | throw new Exception("response id not found."); 105 | 106 | string id = idToken.ToObject(); 107 | 108 | OpenTask openTask; 109 | if (!OpenTasks.TryGetValue(id, out openTask)) 110 | return; 111 | 112 | OpenTasks.Remove(id); 113 | 114 | openTask.PromiseTask.SetResult(data.SelectToken("result")); 115 | } 116 | 117 | protected override void HandleEventResponse(IEnumerable args) 118 | { 119 | var data = args.Cast().First(); 120 | 121 | var eventToken = data.SelectToken("event"); 122 | 123 | if (eventToken == null) 124 | throw new Exception("event type not found."); 125 | 126 | string type = eventToken.ToObject(); 127 | 128 | List> eventListeners = null; 129 | 130 | if (EventListenersDict.TryGetValue(type, out eventListeners)) 131 | { 132 | foreach (var listener in eventListeners) 133 | { 134 | listener(data.SelectToken("payload")); 135 | } 136 | } 137 | } 138 | 139 | private void HandleRekeyResponse(IEnumerable args) 140 | { 141 | GenerateNewAppKey(); 142 | SockIO.EmitAsync("rekeyed", new 143 | { 144 | plugin = AppName, 145 | data = new 146 | { 147 | origin = AppName, 148 | appkey = StorageProvider.GetAppkey() 149 | } 150 | }); 151 | } 152 | 153 | #endregion 154 | } 155 | } 156 | -------------------------------------------------------------------------------- /ScatterSharp/ScatterSharp.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.27703.2042 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ScatterSharp", "ScatterSharp\ScatterSharp.csproj", "{A7498DEA-BECB-49CE-9E9D-E06FDFA29E5A}" 7 | EndProject 8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ScatterSharp.UnitTests", "ScatterSharp.UnitTests\ScatterSharp.UnitTests.csproj", "{969C1A19-C591-4EAE-A8F3-AE39878CA2C2}" 9 | EndProject 10 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ScatterSharp.Unity3D", "ScatterSharp.Unity3D\ScatterSharp.Unity3D.csproj", "{24698342-03C1-42B6-9540-A1CEEB252E23}" 11 | EndProject 12 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ScatterSharp.Core", "ScatterSharp.Core\ScatterSharp.Core.csproj", "{D20F2A06-4626-4165-8DF8-75081B742710}" 13 | EndProject 14 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EosSharp.Core", "..\eos-sharp\EosSharp\EosSharp.Core\EosSharp.Core.csproj", "{E750ADC2-6362-4614-A3B3-CC5CF8114F16}" 15 | EndProject 16 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EosSharp", "..\eos-sharp\EosSharp\EosSharp\EosSharp.csproj", "{BB5D6616-77B7-4006-B4CB-FE84E2B368FC}" 17 | EndProject 18 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EosSharp.Unity3D", "..\eos-sharp\EosSharp\EosSharp.Unity3D\EosSharp.Unity3D.csproj", "{71517F24-D1F3-4508-A95D-891D2D0EB779}" 19 | EndProject 20 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SocketIOSharp", "..\socketio-sharp\SocketIOSharp\SocketIOSharp\SocketIOSharp.csproj", "{2899C5FE-2036-4AE8-9A0D-95A12E508693}" 21 | EndProject 22 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "websocket-sharp", "..\socketio-sharp\SocketIOSharp\WebSocketSharp\websocket-sharp\websocket-sharp.csproj", "{B357BAC7-529E-4D81-A0D2-71041B19C8DE}" 23 | EndProject 24 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ScatterSharp.UnitTests.Core", "ScatterSharp.UnitTests.Core\ScatterSharp.UnitTests.Core.csproj", "{1C962869-5F7D-4612-A9FE-BCB4CB7252B5}" 25 | EndProject 26 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ScatterSharp.UnitTests.Unity3D", "ScatterSharp.UnitTests.Unity3D\ScatterSharp.UnitTests.Unity3D.csproj", "{23362DEA-4933-402F-ACB8-22ADAD36E782}" 27 | EndProject 28 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SocketIOSharp.Core", "..\socketio-sharp\SocketIOSharp\SocketIOSharp.Core\SocketIOSharp.Core.csproj", "{45F3AA32-DB9B-4526-A400-A7D96086CB7A}" 29 | EndProject 30 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SocketIOSharp.Unity3D", "..\socketio-sharp\SocketIOSharp\SocketIOSharp.Unity3D\SocketIOSharp.Unity3D.csproj", "{290D7B87-2B88-434C-8C66-CEC7742F780E}" 31 | EndProject 32 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "eos-sharp", "eos-sharp", "{26FB0683-51CD-4447-9829-8F6C50E59FE2}" 33 | EndProject 34 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "socketio-sharp", "socketio-sharp", "{725302BD-C3FC-4B95-9E5D-ACBD90F50CC1}" 35 | EndProject 36 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "scatter-sharp", "scatter-sharp", "{FA54102A-C7B4-4779-8F4B-11AA889E1563}" 37 | EndProject 38 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "scatter-sharp-providers", "scatter-sharp-providers", "{F3030BB4-F4C7-4CC4-9DC4-BE24306930E2}" 39 | EndProject 40 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ScatterSharp.EosProvider", "ScatterSharp.EosProvider\ScatterSharp.EosProvider.csproj", "{3DC847A8-8FF2-4DF3-ACA5-F3C62023457D}" 41 | EndProject 42 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "scatter-sharp-tests", "scatter-sharp-tests", "{044AD4B4-88B5-421D-BA2F-4034FB07B0F9}" 43 | EndProject 44 | Global 45 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 46 | Debug_Ubuntu|Any CPU = Debug_Ubuntu|Any CPU 47 | Debug|Any CPU = Debug|Any CPU 48 | Release_Ubuntu|Any CPU = Release_Ubuntu|Any CPU 49 | Release|Any CPU = Release|Any CPU 50 | EndGlobalSection 51 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 52 | {A7498DEA-BECB-49CE-9E9D-E06FDFA29E5A}.Debug_Ubuntu|Any CPU.ActiveCfg = Debug|Any CPU 53 | {A7498DEA-BECB-49CE-9E9D-E06FDFA29E5A}.Debug_Ubuntu|Any CPU.Build.0 = Debug|Any CPU 54 | {A7498DEA-BECB-49CE-9E9D-E06FDFA29E5A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 55 | {A7498DEA-BECB-49CE-9E9D-E06FDFA29E5A}.Debug|Any CPU.Build.0 = Debug|Any CPU 56 | {A7498DEA-BECB-49CE-9E9D-E06FDFA29E5A}.Release_Ubuntu|Any CPU.ActiveCfg = Release|Any CPU 57 | {A7498DEA-BECB-49CE-9E9D-E06FDFA29E5A}.Release_Ubuntu|Any CPU.Build.0 = Release|Any CPU 58 | {A7498DEA-BECB-49CE-9E9D-E06FDFA29E5A}.Release|Any CPU.ActiveCfg = Release|Any CPU 59 | {A7498DEA-BECB-49CE-9E9D-E06FDFA29E5A}.Release|Any CPU.Build.0 = Release|Any CPU 60 | {969C1A19-C591-4EAE-A8F3-AE39878CA2C2}.Debug_Ubuntu|Any CPU.ActiveCfg = Debug|Any CPU 61 | {969C1A19-C591-4EAE-A8F3-AE39878CA2C2}.Debug_Ubuntu|Any CPU.Build.0 = Debug|Any CPU 62 | {969C1A19-C591-4EAE-A8F3-AE39878CA2C2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 63 | {969C1A19-C591-4EAE-A8F3-AE39878CA2C2}.Debug|Any CPU.Build.0 = Debug|Any CPU 64 | {969C1A19-C591-4EAE-A8F3-AE39878CA2C2}.Release_Ubuntu|Any CPU.ActiveCfg = Release|Any CPU 65 | {969C1A19-C591-4EAE-A8F3-AE39878CA2C2}.Release_Ubuntu|Any CPU.Build.0 = Release|Any CPU 66 | {969C1A19-C591-4EAE-A8F3-AE39878CA2C2}.Release|Any CPU.ActiveCfg = Release|Any CPU 67 | {969C1A19-C591-4EAE-A8F3-AE39878CA2C2}.Release|Any CPU.Build.0 = Release|Any CPU 68 | {24698342-03C1-42B6-9540-A1CEEB252E23}.Debug_Ubuntu|Any CPU.ActiveCfg = Debug|Any CPU 69 | {24698342-03C1-42B6-9540-A1CEEB252E23}.Debug_Ubuntu|Any CPU.Build.0 = Debug|Any CPU 70 | {24698342-03C1-42B6-9540-A1CEEB252E23}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 71 | {24698342-03C1-42B6-9540-A1CEEB252E23}.Debug|Any CPU.Build.0 = Debug|Any CPU 72 | {24698342-03C1-42B6-9540-A1CEEB252E23}.Release_Ubuntu|Any CPU.ActiveCfg = Release|Any CPU 73 | {24698342-03C1-42B6-9540-A1CEEB252E23}.Release_Ubuntu|Any CPU.Build.0 = Release|Any CPU 74 | {24698342-03C1-42B6-9540-A1CEEB252E23}.Release|Any CPU.ActiveCfg = Release|Any CPU 75 | {24698342-03C1-42B6-9540-A1CEEB252E23}.Release|Any CPU.Build.0 = Release|Any CPU 76 | {D20F2A06-4626-4165-8DF8-75081B742710}.Debug_Ubuntu|Any CPU.ActiveCfg = Debug|Any CPU 77 | {D20F2A06-4626-4165-8DF8-75081B742710}.Debug_Ubuntu|Any CPU.Build.0 = Debug|Any CPU 78 | {D20F2A06-4626-4165-8DF8-75081B742710}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 79 | {D20F2A06-4626-4165-8DF8-75081B742710}.Debug|Any CPU.Build.0 = Debug|Any CPU 80 | {D20F2A06-4626-4165-8DF8-75081B742710}.Release_Ubuntu|Any CPU.ActiveCfg = Release|Any CPU 81 | {D20F2A06-4626-4165-8DF8-75081B742710}.Release_Ubuntu|Any CPU.Build.0 = Release|Any CPU 82 | {D20F2A06-4626-4165-8DF8-75081B742710}.Release|Any CPU.ActiveCfg = Release|Any CPU 83 | {D20F2A06-4626-4165-8DF8-75081B742710}.Release|Any CPU.Build.0 = Release|Any CPU 84 | {E750ADC2-6362-4614-A3B3-CC5CF8114F16}.Debug_Ubuntu|Any CPU.ActiveCfg = Debug|Any CPU 85 | {E750ADC2-6362-4614-A3B3-CC5CF8114F16}.Debug_Ubuntu|Any CPU.Build.0 = Debug|Any CPU 86 | {E750ADC2-6362-4614-A3B3-CC5CF8114F16}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 87 | {E750ADC2-6362-4614-A3B3-CC5CF8114F16}.Debug|Any CPU.Build.0 = Debug|Any CPU 88 | {E750ADC2-6362-4614-A3B3-CC5CF8114F16}.Release_Ubuntu|Any CPU.ActiveCfg = Release|Any CPU 89 | {E750ADC2-6362-4614-A3B3-CC5CF8114F16}.Release_Ubuntu|Any CPU.Build.0 = Release|Any CPU 90 | {E750ADC2-6362-4614-A3B3-CC5CF8114F16}.Release|Any CPU.ActiveCfg = Release|Any CPU 91 | {E750ADC2-6362-4614-A3B3-CC5CF8114F16}.Release|Any CPU.Build.0 = Release|Any CPU 92 | {BB5D6616-77B7-4006-B4CB-FE84E2B368FC}.Debug_Ubuntu|Any CPU.ActiveCfg = Debug|Any CPU 93 | {BB5D6616-77B7-4006-B4CB-FE84E2B368FC}.Debug_Ubuntu|Any CPU.Build.0 = Debug|Any CPU 94 | {BB5D6616-77B7-4006-B4CB-FE84E2B368FC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 95 | {BB5D6616-77B7-4006-B4CB-FE84E2B368FC}.Debug|Any CPU.Build.0 = Debug|Any CPU 96 | {BB5D6616-77B7-4006-B4CB-FE84E2B368FC}.Release_Ubuntu|Any CPU.ActiveCfg = Release|Any CPU 97 | {BB5D6616-77B7-4006-B4CB-FE84E2B368FC}.Release_Ubuntu|Any CPU.Build.0 = Release|Any CPU 98 | {BB5D6616-77B7-4006-B4CB-FE84E2B368FC}.Release|Any CPU.ActiveCfg = Release|Any CPU 99 | {BB5D6616-77B7-4006-B4CB-FE84E2B368FC}.Release|Any CPU.Build.0 = Release|Any CPU 100 | {71517F24-D1F3-4508-A95D-891D2D0EB779}.Debug_Ubuntu|Any CPU.ActiveCfg = Debug|Any CPU 101 | {71517F24-D1F3-4508-A95D-891D2D0EB779}.Debug_Ubuntu|Any CPU.Build.0 = Debug|Any CPU 102 | {71517F24-D1F3-4508-A95D-891D2D0EB779}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 103 | {71517F24-D1F3-4508-A95D-891D2D0EB779}.Debug|Any CPU.Build.0 = Debug|Any CPU 104 | {71517F24-D1F3-4508-A95D-891D2D0EB779}.Release_Ubuntu|Any CPU.ActiveCfg = Release|Any CPU 105 | {71517F24-D1F3-4508-A95D-891D2D0EB779}.Release_Ubuntu|Any CPU.Build.0 = Release|Any CPU 106 | {71517F24-D1F3-4508-A95D-891D2D0EB779}.Release|Any CPU.ActiveCfg = Release|Any CPU 107 | {71517F24-D1F3-4508-A95D-891D2D0EB779}.Release|Any CPU.Build.0 = Release|Any CPU 108 | {2899C5FE-2036-4AE8-9A0D-95A12E508693}.Debug_Ubuntu|Any CPU.ActiveCfg = Debug|Any CPU 109 | {2899C5FE-2036-4AE8-9A0D-95A12E508693}.Debug_Ubuntu|Any CPU.Build.0 = Debug|Any CPU 110 | {2899C5FE-2036-4AE8-9A0D-95A12E508693}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 111 | {2899C5FE-2036-4AE8-9A0D-95A12E508693}.Debug|Any CPU.Build.0 = Debug|Any CPU 112 | {2899C5FE-2036-4AE8-9A0D-95A12E508693}.Release_Ubuntu|Any CPU.ActiveCfg = Release|Any CPU 113 | {2899C5FE-2036-4AE8-9A0D-95A12E508693}.Release_Ubuntu|Any CPU.Build.0 = Release|Any CPU 114 | {2899C5FE-2036-4AE8-9A0D-95A12E508693}.Release|Any CPU.ActiveCfg = Release|Any CPU 115 | {2899C5FE-2036-4AE8-9A0D-95A12E508693}.Release|Any CPU.Build.0 = Release|Any CPU 116 | {B357BAC7-529E-4D81-A0D2-71041B19C8DE}.Debug_Ubuntu|Any CPU.ActiveCfg = Debug_Ubuntu|Any CPU 117 | {B357BAC7-529E-4D81-A0D2-71041B19C8DE}.Debug_Ubuntu|Any CPU.Build.0 = Debug_Ubuntu|Any CPU 118 | {B357BAC7-529E-4D81-A0D2-71041B19C8DE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 119 | {B357BAC7-529E-4D81-A0D2-71041B19C8DE}.Debug|Any CPU.Build.0 = Debug|Any CPU 120 | {B357BAC7-529E-4D81-A0D2-71041B19C8DE}.Release_Ubuntu|Any CPU.ActiveCfg = Release_Ubuntu|Any CPU 121 | {B357BAC7-529E-4D81-A0D2-71041B19C8DE}.Release_Ubuntu|Any CPU.Build.0 = Release_Ubuntu|Any CPU 122 | {B357BAC7-529E-4D81-A0D2-71041B19C8DE}.Release|Any CPU.ActiveCfg = Release|Any CPU 123 | {B357BAC7-529E-4D81-A0D2-71041B19C8DE}.Release|Any CPU.Build.0 = Release|Any CPU 124 | {1C962869-5F7D-4612-A9FE-BCB4CB7252B5}.Debug_Ubuntu|Any CPU.ActiveCfg = Debug|Any CPU 125 | {1C962869-5F7D-4612-A9FE-BCB4CB7252B5}.Debug_Ubuntu|Any CPU.Build.0 = Debug|Any CPU 126 | {1C962869-5F7D-4612-A9FE-BCB4CB7252B5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 127 | {1C962869-5F7D-4612-A9FE-BCB4CB7252B5}.Debug|Any CPU.Build.0 = Debug|Any CPU 128 | {1C962869-5F7D-4612-A9FE-BCB4CB7252B5}.Release_Ubuntu|Any CPU.ActiveCfg = Release|Any CPU 129 | {1C962869-5F7D-4612-A9FE-BCB4CB7252B5}.Release_Ubuntu|Any CPU.Build.0 = Release|Any CPU 130 | {1C962869-5F7D-4612-A9FE-BCB4CB7252B5}.Release|Any CPU.ActiveCfg = Release|Any CPU 131 | {1C962869-5F7D-4612-A9FE-BCB4CB7252B5}.Release|Any CPU.Build.0 = Release|Any CPU 132 | {23362DEA-4933-402F-ACB8-22ADAD36E782}.Debug_Ubuntu|Any CPU.ActiveCfg = Debug|Any CPU 133 | {23362DEA-4933-402F-ACB8-22ADAD36E782}.Debug_Ubuntu|Any CPU.Build.0 = Debug|Any CPU 134 | {23362DEA-4933-402F-ACB8-22ADAD36E782}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 135 | {23362DEA-4933-402F-ACB8-22ADAD36E782}.Debug|Any CPU.Build.0 = Debug|Any CPU 136 | {23362DEA-4933-402F-ACB8-22ADAD36E782}.Release_Ubuntu|Any CPU.ActiveCfg = Release|Any CPU 137 | {23362DEA-4933-402F-ACB8-22ADAD36E782}.Release_Ubuntu|Any CPU.Build.0 = Release|Any CPU 138 | {23362DEA-4933-402F-ACB8-22ADAD36E782}.Release|Any CPU.ActiveCfg = Release|Any CPU 139 | {23362DEA-4933-402F-ACB8-22ADAD36E782}.Release|Any CPU.Build.0 = Release|Any CPU 140 | {45F3AA32-DB9B-4526-A400-A7D96086CB7A}.Debug_Ubuntu|Any CPU.ActiveCfg = Debug|Any CPU 141 | {45F3AA32-DB9B-4526-A400-A7D96086CB7A}.Debug_Ubuntu|Any CPU.Build.0 = Debug|Any CPU 142 | {45F3AA32-DB9B-4526-A400-A7D96086CB7A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 143 | {45F3AA32-DB9B-4526-A400-A7D96086CB7A}.Debug|Any CPU.Build.0 = Debug|Any CPU 144 | {45F3AA32-DB9B-4526-A400-A7D96086CB7A}.Release_Ubuntu|Any CPU.ActiveCfg = Release|Any CPU 145 | {45F3AA32-DB9B-4526-A400-A7D96086CB7A}.Release_Ubuntu|Any CPU.Build.0 = Release|Any CPU 146 | {45F3AA32-DB9B-4526-A400-A7D96086CB7A}.Release|Any CPU.ActiveCfg = Release|Any CPU 147 | {45F3AA32-DB9B-4526-A400-A7D96086CB7A}.Release|Any CPU.Build.0 = Release|Any CPU 148 | {290D7B87-2B88-434C-8C66-CEC7742F780E}.Debug_Ubuntu|Any CPU.ActiveCfg = Debug|Any CPU 149 | {290D7B87-2B88-434C-8C66-CEC7742F780E}.Debug_Ubuntu|Any CPU.Build.0 = Debug|Any CPU 150 | {290D7B87-2B88-434C-8C66-CEC7742F780E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 151 | {290D7B87-2B88-434C-8C66-CEC7742F780E}.Debug|Any CPU.Build.0 = Debug|Any CPU 152 | {290D7B87-2B88-434C-8C66-CEC7742F780E}.Release_Ubuntu|Any CPU.ActiveCfg = Release|Any CPU 153 | {290D7B87-2B88-434C-8C66-CEC7742F780E}.Release_Ubuntu|Any CPU.Build.0 = Release|Any CPU 154 | {290D7B87-2B88-434C-8C66-CEC7742F780E}.Release|Any CPU.ActiveCfg = Release|Any CPU 155 | {290D7B87-2B88-434C-8C66-CEC7742F780E}.Release|Any CPU.Build.0 = Release|Any CPU 156 | {3DC847A8-8FF2-4DF3-ACA5-F3C62023457D}.Debug_Ubuntu|Any CPU.ActiveCfg = Debug|Any CPU 157 | {3DC847A8-8FF2-4DF3-ACA5-F3C62023457D}.Debug_Ubuntu|Any CPU.Build.0 = Debug|Any CPU 158 | {3DC847A8-8FF2-4DF3-ACA5-F3C62023457D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 159 | {3DC847A8-8FF2-4DF3-ACA5-F3C62023457D}.Debug|Any CPU.Build.0 = Debug|Any CPU 160 | {3DC847A8-8FF2-4DF3-ACA5-F3C62023457D}.Release_Ubuntu|Any CPU.ActiveCfg = Release|Any CPU 161 | {3DC847A8-8FF2-4DF3-ACA5-F3C62023457D}.Release_Ubuntu|Any CPU.Build.0 = Release|Any CPU 162 | {3DC847A8-8FF2-4DF3-ACA5-F3C62023457D}.Release|Any CPU.ActiveCfg = Release|Any CPU 163 | {3DC847A8-8FF2-4DF3-ACA5-F3C62023457D}.Release|Any CPU.Build.0 = Release|Any CPU 164 | EndGlobalSection 165 | GlobalSection(SolutionProperties) = preSolution 166 | HideSolutionNode = FALSE 167 | EndGlobalSection 168 | GlobalSection(NestedProjects) = preSolution 169 | {A7498DEA-BECB-49CE-9E9D-E06FDFA29E5A} = {FA54102A-C7B4-4779-8F4B-11AA889E1563} 170 | {969C1A19-C591-4EAE-A8F3-AE39878CA2C2} = {044AD4B4-88B5-421D-BA2F-4034FB07B0F9} 171 | {24698342-03C1-42B6-9540-A1CEEB252E23} = {FA54102A-C7B4-4779-8F4B-11AA889E1563} 172 | {D20F2A06-4626-4165-8DF8-75081B742710} = {FA54102A-C7B4-4779-8F4B-11AA889E1563} 173 | {E750ADC2-6362-4614-A3B3-CC5CF8114F16} = {26FB0683-51CD-4447-9829-8F6C50E59FE2} 174 | {BB5D6616-77B7-4006-B4CB-FE84E2B368FC} = {26FB0683-51CD-4447-9829-8F6C50E59FE2} 175 | {71517F24-D1F3-4508-A95D-891D2D0EB779} = {26FB0683-51CD-4447-9829-8F6C50E59FE2} 176 | {2899C5FE-2036-4AE8-9A0D-95A12E508693} = {725302BD-C3FC-4B95-9E5D-ACBD90F50CC1} 177 | {B357BAC7-529E-4D81-A0D2-71041B19C8DE} = {725302BD-C3FC-4B95-9E5D-ACBD90F50CC1} 178 | {1C962869-5F7D-4612-A9FE-BCB4CB7252B5} = {044AD4B4-88B5-421D-BA2F-4034FB07B0F9} 179 | {23362DEA-4933-402F-ACB8-22ADAD36E782} = {044AD4B4-88B5-421D-BA2F-4034FB07B0F9} 180 | {45F3AA32-DB9B-4526-A400-A7D96086CB7A} = {725302BD-C3FC-4B95-9E5D-ACBD90F50CC1} 181 | {290D7B87-2B88-434C-8C66-CEC7742F780E} = {725302BD-C3FC-4B95-9E5D-ACBD90F50CC1} 182 | {3DC847A8-8FF2-4DF3-ACA5-F3C62023457D} = {F3030BB4-F4C7-4CC4-9DC4-BE24306930E2} 183 | EndGlobalSection 184 | GlobalSection(ExtensibilityGlobals) = postSolution 185 | SolutionGuid = {C51E9EF5-EF8A-4B8D-A434-E1B6C05A89AD} 186 | EndGlobalSection 187 | EndGlobal 188 | -------------------------------------------------------------------------------- /ScatterSharp/ScatterSharp/Scatter.cs: -------------------------------------------------------------------------------- 1 | using ScatterSharp.Core; 2 | using ScatterSharp.Core.Storage; 3 | using SocketIOSharp.Core; 4 | 5 | namespace ScatterSharp 6 | { 7 | /// 8 | /// Scatter client using generic socket service 9 | /// 10 | public class Scatter : ScatterBase 11 | { 12 | /// 13 | /// Constructor for scatter client with init configuration 14 | /// 15 | /// Configuration object 16 | public Scatter(ScatterConfigurator config) : 17 | base(config, new SocketService(config.StorageProvider ?? new MemoryStorageProvider(), new SocketIOConfigurator() 18 | { 19 | Namespace = "scatter", 20 | Proxy = config.Proxy 21 | }, config.AppName, config.DefaultTimeout)) 22 | { 23 | } 24 | } 25 | 26 | } -------------------------------------------------------------------------------- /ScatterSharp/ScatterSharp/ScatterSharp.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | netstandard2.0 5 | Mário Silva 6 | GetScatter 7 | scatter-sharp 8 | scatter-sharp 9 | Scatter C# library to interact with ScatterDesktop / ScatterMobile 10 | Copyright 2019 11 | https://github.com/GetScatter/scatter-sharp/blob/master/LICENSE 12 | https://github.com/GetScatter/scatter-sharp 13 | https://github.com/GetScatter/scatter-sharp 14 | git 15 | EOS, NetStandard, secp256k1, Blockchain, Scatter 16 | 2.1.3.0 17 | 2.1.3.0 18 | eos-sharp: Fix Use convert ToDecimal instead of explicit cast 19 | eos-sharp: Fix object to float conversion InvalidCastException (by KGMaxey) 20 | eos-sharp: Add support for variant fields 21 | eos-sharp: Add support for binary extension types (by dbulha) 22 | eos-sharp: Add block_num_hint to gettransaction (by dbulha) 23 | eos-sharp: Changed authority accounts to use permission level (by dbulha) 24 | 2.1.3 25 | false 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 47 | 48 | $(TargetsForTfmSpecificBuildOutput);CopyProjectReferencesToPackage 49 | 50 | $(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /ScatterSharp/ScatterSharp/ScatterSharp.csproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | true 5 | 6 | -------------------------------------------------------------------------------- /ScatterSharp/ScatterSharp/SocketService.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json.Linq; 2 | using ScatterSharp.Core; 3 | using ScatterSharp.Core.Api; 4 | using ScatterSharp.Core.Interfaces; 5 | using SocketIOSharp; 6 | using SocketIOSharp.Core; 7 | using System; 8 | using System.Collections.Generic; 9 | using System.Linq; 10 | using System.Threading; 11 | using System.Threading.Tasks; 12 | 13 | namespace ScatterSharp 14 | { 15 | /// 16 | /// Generic socket service implementation using socketio-sharp 17 | /// 18 | public class SocketService : SocketServiceBase 19 | { 20 | public SocketService(IAppStorageProvider storageProvider, SocketIOConfigurator config, string appName, int timeout = 60000) : 21 | base(storageProvider, config, appName, timeout) 22 | { 23 | SockIO = new SocketIO(config); 24 | } 25 | 26 | #region Utils 27 | 28 | protected override void StartTimeoutOpenTasksCheck() 29 | { 30 | TimoutTasksTask = Task.Run(() => { 31 | var e = TimeoutOpenTasksCheck(); 32 | while (e.MoveNext()); 33 | }); 34 | } 35 | 36 | protected override object WaitForOpenTasksCheck(int openTaskCheckIntervalSecs) 37 | { 38 | Thread.Sleep(openTaskCheckIntervalSecs * 1000); 39 | return null; 40 | } 41 | 42 | protected override object BuildApiError() 43 | { 44 | return JToken.FromObject(new ApiError() 45 | { 46 | code = "0", 47 | isError = "true", 48 | message = "Request timeout." 49 | }); 50 | } 51 | 52 | protected override TReturn BuildApiResponse(object jtoken) 53 | { 54 | var result = jtoken as JToken; 55 | 56 | if (result == null) 57 | return default(TReturn); 58 | 59 | if (result.Type == JTokenType.Object && 60 | result.SelectToken("isError") != null) 61 | { 62 | var apiError = result.ToObject(); 63 | if (apiError != null) 64 | throw new Exception(apiError.message); 65 | } 66 | 67 | return result.ToObject(); 68 | } 69 | 70 | protected override void HandlePairedResponse(IEnumerable args) 71 | { 72 | HandlePairedResponse(args.Cast().First().ToObject()); 73 | } 74 | 75 | protected override void HandleApiResponse(IEnumerable args) 76 | { 77 | var data = args.Cast().First(); 78 | 79 | if (data == null && data.Children().Count() != 2) 80 | return; 81 | 82 | var idToken = data.SelectToken("id"); 83 | 84 | if (idToken == null) 85 | throw new Exception("response id not found."); 86 | 87 | string id = idToken.ToObject(); 88 | 89 | OpenTask openTask; 90 | if (!OpenTasks.TryGetValue(id, out openTask)) 91 | return; 92 | 93 | OpenTasks.Remove(id); 94 | 95 | openTask.PromiseTask.SetResult(data.SelectToken("result")); 96 | } 97 | 98 | protected override void HandleEventResponse(IEnumerable args) 99 | { 100 | var data = args.Cast().First(); 101 | 102 | var eventToken = data.SelectToken("event"); 103 | 104 | if (eventToken == null) 105 | throw new Exception("event type not found."); 106 | 107 | string type = eventToken.ToObject(); 108 | 109 | List> eventListeners = null; 110 | 111 | if (EventListenersDict.TryGetValue(type, out eventListeners)) 112 | { 113 | foreach (var listener in eventListeners) 114 | { 115 | listener(data.SelectToken("payload")); 116 | } 117 | } 118 | } 119 | 120 | private void HandleRekeyResponse(IEnumerable args) 121 | { 122 | GenerateNewAppKey(); 123 | SockIO.EmitAsync("rekeyed", new 124 | { 125 | plugin = AppName, 126 | data = new 127 | { 128 | origin = AppName, 129 | appkey = StorageProvider.GetAppkey() 130 | } 131 | }); 132 | } 133 | 134 | #endregion 135 | } 136 | } 137 | -------------------------------------------------------------------------------- /Unity3D/README.md: -------------------------------------------------------------------------------- 1 | # Unity3D Easy Setup 2 | 3 | ### Prerequisite to build 4 | 5 | - Unity >= 2018.1 6 | - Visual Studio 2017+ 7 | - ".NET Core cross-platform development" toolset in VS2017 8 | - "Game development with Unity" toolset in VS2017 9 | ------------------------------- 10 | 11 | ## Creating a new project 12 | 13 | - clone this repository ( `git clone https://github.com/GetScatter/scatter-sharp.git YOUR_PROJECT_NAME --recursive` ) 14 | - `cd YOUR_PROJECT_NAME/Unity3d/` 15 | - run `.\create_plugins.bat` 16 | - Open the `ScatterSharpUnity3D` project in Unity! 17 | 18 | ------------------------------- 19 | 20 | ## Adding to existing project. 21 | 22 | ### Build package windows 23 | - run `.\build_package_win.bat` 24 | 25 | You will need to modify a few settings to allow for .NET 2.0. 26 | 27 | Inside your project: 28 | - **Go to Edit -> Project Settings -> Player -> Other Settings -> Configuration -> Scripting Runtime Version -> .NET 4.6 Equivalent** 29 | - This will ask you to restart Unity3d, when it opens back up: 30 | **Go to Edit -> Project Settings -> Player -> Other Settings -> Configuration -> Api Compatibility Level -> .NET 4.6** 31 | - Get the [`scatter-sharp.unitypackage` from this repository](https://raw.githubusercontent.com/GetScatter/scatter-sharp/master/Unity3D/scatter-sharp.unitypackage) 32 | - Then back inside Unity: 33 | **Assets -> Import Package** and select the location you saved the above package to, or just open the unitypackage file with your project open. 34 | -------------------------------------------------------------------------------- /Unity3D/ScatterSharpUnity3D/Assets/Scenes.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4f704ae4b4f98ae41a0bce26658850c1 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Unity3D/ScatterSharpUnity3D/Assets/Scenes/SampleScene.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 99c9720ab356a0642a771bea13969a05 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Unity3D/ScatterSharpUnity3D/Assets/Scenes/Scripts.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1be53fc921f28ed4188ad181477a627c 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Unity3D/ScatterSharpUnity3D/Assets/Scenes/Scripts/TestScatterScript.cs: -------------------------------------------------------------------------------- 1 | using EosSharp.Unity3D; 2 | using Newtonsoft.Json; 3 | using ScatterSharp.Core; 4 | using ScatterSharp.Core.Api; 5 | using ScatterSharp.Core.Storage; 6 | using ScatterSharp.EosProvider; 7 | using ScatterSharp.UnitTests; 8 | using ScatterSharp.Unity3D; 9 | using System; 10 | using System.Linq; 11 | using System.Collections.Generic; 12 | using UnityEngine; 13 | using EosSharp.Core.Api.v1; 14 | using EosSharp.Core.Exceptions; 15 | 16 | public class TestScatterScript : MonoBehaviour 17 | { 18 | public async void PushTransaction() 19 | { 20 | try 21 | { 22 | ScatterSharp.Core.Api.Network network = new ScatterSharp.Core.Api.Network() 23 | { 24 | blockchain = ScatterConstants.Blockchains.EOSIO, 25 | host = "jungle2.cryptolions.io", 26 | port = 443, 27 | chainId = "e70aaab8997e1dfce58fbfac80cbbb8fecec7b99cf982a9444273cbc64c41473" 28 | }; 29 | 30 | var fileStorage = new FileStorageProvider(Application.persistentDataPath + "/scatterapp.dat"); 31 | using (var scatter = new Scatter(new ScatterConfigurator() 32 | { 33 | AppName = "UNITY-WEBGL-SCATTER", 34 | Network = network, 35 | StorageProvider = fileStorage 36 | }, this)) 37 | { 38 | await scatter.Connect(); 39 | 40 | await scatter.GetIdentity(new IdentityRequiredFields() 41 | { 42 | accounts = new List() 43 | { 44 | network 45 | }, 46 | location = new List(), 47 | personal = new List() 48 | }); 49 | 50 | var eos = new Eos(new EosSharp.Core.EosConfigurator() 51 | { 52 | ChainId = network.chainId, 53 | HttpEndpoint = network.GetHttpEndpoint(), 54 | SignProvider = new ScatterSignatureProvider(scatter) 55 | }); 56 | 57 | var account = scatter.Identity.accounts.First(); 58 | 59 | var result = await eos.CreateTransaction(new EosSharp.Core.Api.v1.Transaction() 60 | { 61 | actions = new List() 62 | { 63 | new EosSharp.Core.Api.v1.Action() 64 | { 65 | account = "eosio.token", 66 | authorization = new List() 67 | { 68 | new PermissionLevel() { actor = account.name, permission = account.authority } 69 | }, 70 | name = "transfer", 71 | data = new Dictionary() 72 | { 73 | { "from", account.name }, 74 | { "to", "eosio" }, 75 | { "quantity", "0.0001 EOS" }, 76 | { "memo", "Unity3D WEBGL hello crypto world!" } 77 | } 78 | } 79 | } 80 | }); 81 | print(result); 82 | } 83 | } 84 | catch(ApiErrorException ex) 85 | { 86 | print(JsonConvert.SerializeObject(ex.error)); 87 | } 88 | catch(ApiException ex) 89 | { 90 | print(ex.Content); 91 | } 92 | catch (Exception ex) 93 | { 94 | print(JsonConvert.SerializeObject(ex)); 95 | } 96 | } 97 | 98 | public async void TestAllUnitTests() 99 | { 100 | var scatterUnitTests = new ScatterUnitTests(this); 101 | await scatterUnitTests.TestAll(); 102 | } 103 | } 104 | -------------------------------------------------------------------------------- /Unity3D/ScatterSharpUnity3D/Assets/Scenes/Scripts/TestScatterScript.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8b70805e231d9594fb409b952ef388d8 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity3D/ScatterSharpUnity3D/Assets/gs_home_devs_streamlined.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GetScatter/scatter-sharp/e0bf661ea775c55618648adaa4f740e91bfa8bf9/Unity3D/ScatterSharpUnity3D/Assets/gs_home_devs_streamlined.png -------------------------------------------------------------------------------- /Unity3D/ScatterSharpUnity3D/Assets/gs_home_devs_streamlined.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cbd7b9ae971f3c042baf578da3e9dc47 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 | -------------------------------------------------------------------------------- /Unity3D/ScatterSharpUnity3D/Library/AnnotationManager: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GetScatter/scatter-sharp/e0bf661ea775c55618648adaa4f740e91bfa8bf9/Unity3D/ScatterSharpUnity3D/Library/AnnotationManager -------------------------------------------------------------------------------- /Unity3D/ScatterSharpUnity3D/Library/AssetImportState: -------------------------------------------------------------------------------- 1 | 19;0;4;0;0 -------------------------------------------------------------------------------- /Unity3D/ScatterSharpUnity3D/Library/BuildPlayer.prefs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GetScatter/scatter-sharp/e0bf661ea775c55618648adaa4f740e91bfa8bf9/Unity3D/ScatterSharpUnity3D/Library/BuildPlayer.prefs -------------------------------------------------------------------------------- /Unity3D/ScatterSharpUnity3D/Library/BuildSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GetScatter/scatter-sharp/e0bf661ea775c55618648adaa4f740e91bfa8bf9/Unity3D/ScatterSharpUnity3D/Library/BuildSettings.asset -------------------------------------------------------------------------------- /Unity3D/ScatterSharpUnity3D/Library/EditorUserBuildSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GetScatter/scatter-sharp/e0bf661ea775c55618648adaa4f740e91bfa8bf9/Unity3D/ScatterSharpUnity3D/Library/EditorUserBuildSettings.asset -------------------------------------------------------------------------------- /Unity3D/ScatterSharpUnity3D/Library/EditorUserSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GetScatter/scatter-sharp/e0bf661ea775c55618648adaa4f740e91bfa8bf9/Unity3D/ScatterSharpUnity3D/Library/EditorUserSettings.asset -------------------------------------------------------------------------------- /Unity3D/ScatterSharpUnity3D/Library/InspectorExpandedItems.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GetScatter/scatter-sharp/e0bf661ea775c55618648adaa4f740e91bfa8bf9/Unity3D/ScatterSharpUnity3D/Library/InspectorExpandedItems.asset -------------------------------------------------------------------------------- /Unity3D/ScatterSharpUnity3D/Library/LastSceneManagerSetup.txt: -------------------------------------------------------------------------------- 1 | sceneSetups: 2 | - path: Assets/Scenes/SampleScene.unity 3 | isLoaded: 1 4 | isActive: 1 5 | -------------------------------------------------------------------------------- /Unity3D/ScatterSharpUnity3D/Library/LibraryFormatVersion.txt: -------------------------------------------------------------------------------- 1 | unityRebuildLibraryVersion: 11 2 | unityForwardCompatibleVersion: 40 3 | -------------------------------------------------------------------------------- /Unity3D/ScatterSharpUnity3D/Library/MonoManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GetScatter/scatter-sharp/e0bf661ea775c55618648adaa4f740e91bfa8bf9/Unity3D/ScatterSharpUnity3D/Library/MonoManager.asset -------------------------------------------------------------------------------- /Unity3D/ScatterSharpUnity3D/Library/ProjectSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!129 &1 4 | PlayerSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 15 7 | productGUID: 911db7680d850834783d829c5ef29ba4 8 | AndroidProfiler: 0 9 | AndroidFilterTouchesWhenObscured: 0 10 | AndroidEnableSustainedPerformanceMode: 0 11 | defaultScreenOrientation: 4 12 | targetDevice: 2 13 | useOnDemandResources: 0 14 | accelerometerFrequency: 60 15 | companyName: DefaultCompany 16 | productName: ScatterSharpTest 17 | defaultCursor: {fileID: 0} 18 | cursorHotspot: {x: 0, y: 0} 19 | m_SplashScreenBackgroundColor: {r: 0.13725491, g: 0.12156863, b: 0.1254902, a: 1} 20 | m_ShowUnitySplashScreen: 1 21 | m_ShowUnitySplashLogo: 1 22 | m_SplashScreenOverlayOpacity: 1 23 | m_SplashScreenAnimation: 1 24 | m_SplashScreenLogoStyle: 1 25 | m_SplashScreenDrawMode: 0 26 | m_SplashScreenBackgroundAnimationZoom: 1 27 | m_SplashScreenLogoAnimationZoom: 1 28 | m_SplashScreenBackgroundLandscapeAspect: 1 29 | m_SplashScreenBackgroundPortraitAspect: 1 30 | m_SplashScreenBackgroundLandscapeUvs: 31 | serializedVersion: 2 32 | x: 0 33 | y: 0 34 | width: 1 35 | height: 1 36 | m_SplashScreenBackgroundPortraitUvs: 37 | serializedVersion: 2 38 | x: 0 39 | y: 0 40 | width: 1 41 | height: 1 42 | m_SplashScreenLogos: [] 43 | m_VirtualRealitySplashScreen: {fileID: 0} 44 | m_HolographicTrackingLossScreen: {fileID: 0} 45 | defaultScreenWidth: 1024 46 | defaultScreenHeight: 768 47 | defaultScreenWidthWeb: 960 48 | defaultScreenHeightWeb: 600 49 | m_StereoRenderingPath: 0 50 | m_ActiveColorSpace: 0 51 | m_MTRendering: 1 52 | m_StackTraceTypes: 010000000100000001000000010000000100000001000000 53 | iosShowActivityIndicatorOnLoading: -1 54 | androidShowActivityIndicatorOnLoading: -1 55 | iosAppInBackgroundBehavior: 0 56 | displayResolutionDialog: 1 57 | iosAllowHTTPDownload: 1 58 | allowedAutorotateToPortrait: 1 59 | allowedAutorotateToPortraitUpsideDown: 1 60 | allowedAutorotateToLandscapeRight: 1 61 | allowedAutorotateToLandscapeLeft: 1 62 | useOSAutorotation: 1 63 | use32BitDisplayBuffer: 1 64 | preserveFramebufferAlpha: 0 65 | disableDepthAndStencilBuffers: 0 66 | androidStartInFullscreen: 1 67 | androidRenderOutsideSafeArea: 0 68 | androidBlitType: 0 69 | defaultIsNativeResolution: 1 70 | macRetinaSupport: 1 71 | runInBackground: 1 72 | captureSingleScreen: 0 73 | muteOtherAudioSources: 0 74 | Prepare IOS For Recording: 0 75 | Force IOS Speakers When Recording: 0 76 | deferSystemGesturesMode: 0 77 | hideHomeButton: 0 78 | submitAnalytics: 1 79 | usePlayerLog: 1 80 | bakeCollisionMeshes: 0 81 | forceSingleInstance: 0 82 | resizableWindow: 0 83 | useMacAppStoreValidation: 0 84 | macAppStoreCategory: public.app-category.games 85 | gpuSkinning: 1 86 | graphicsJobs: 0 87 | xboxPIXTextureCapture: 0 88 | xboxEnableAvatar: 0 89 | xboxEnableKinect: 0 90 | xboxEnableKinectAutoTracking: 0 91 | xboxEnableFitness: 0 92 | visibleInBackground: 1 93 | allowFullscreenSwitch: 1 94 | graphicsJobMode: 0 95 | fullscreenMode: 1 96 | xboxSpeechDB: 0 97 | xboxEnableHeadOrientation: 0 98 | xboxEnableGuest: 0 99 | xboxEnablePIXSampling: 0 100 | metalFramebufferOnly: 0 101 | xboxOneResolution: 0 102 | xboxOneSResolution: 0 103 | xboxOneXResolution: 3 104 | xboxOneMonoLoggingLevel: 0 105 | xboxOneLoggingLevel: 1 106 | xboxOneDisableEsram: 0 107 | xboxOnePresentImmediateThreshold: 0 108 | switchQueueCommandMemory: 0 109 | vulkanEnableSetSRGBWrite: 0 110 | m_SupportedAspectRatios: 111 | 4:3: 1 112 | 5:4: 1 113 | 16:10: 1 114 | 16:9: 1 115 | Others: 1 116 | bundleVersion: 0.1 117 | preloadedAssets: [] 118 | metroInputSource: 0 119 | wsaTransparentSwapchain: 0 120 | m_HolographicPauseOnTrackingLoss: 1 121 | xboxOneDisableKinectGpuReservation: 0 122 | xboxOneEnable7thCore: 0 123 | isWsaHolographicRemotingEnabled: 0 124 | vrSettings: 125 | cardboard: 126 | depthFormat: 0 127 | enableTransitionView: 0 128 | daydream: 129 | depthFormat: 0 130 | useSustainedPerformanceMode: 0 131 | enableVideoLayer: 0 132 | useProtectedVideoMemory: 0 133 | minimumSupportedHeadTracking: 0 134 | maximumSupportedHeadTracking: 1 135 | hololens: 136 | depthFormat: 1 137 | depthBufferSharingEnabled: 0 138 | oculus: 139 | sharedDepthBuffer: 0 140 | dashSupport: 0 141 | enable360StereoCapture: 0 142 | protectGraphicsMemory: 0 143 | enableFrameTimingStats: 0 144 | useHDRDisplay: 0 145 | m_ColorGamuts: 00000000 146 | targetPixelDensity: 30 147 | resolutionScalingMode: 0 148 | androidSupportedAspectRatio: 1 149 | androidMaxAspectRatio: 2.1 150 | applicationIdentifier: {} 151 | buildNumber: {} 152 | AndroidBundleVersionCode: 1 153 | AndroidMinSdkVersion: 16 154 | AndroidTargetSdkVersion: 0 155 | AndroidPreferredInstallLocation: 1 156 | aotOptions: 157 | stripEngineCode: 1 158 | iPhoneStrippingLevel: 0 159 | iPhoneScriptCallOptimization: 0 160 | ForceInternetPermission: 0 161 | ForceSDCardPermission: 0 162 | CreateWallpaper: 0 163 | APKExpansionFiles: 0 164 | keepLoadedShadersAlive: 0 165 | StripUnusedMeshComponents: 1 166 | VertexChannelCompressionMask: 4054 167 | iPhoneSdkVersion: 988 168 | iOSTargetOSVersionString: 9.0 169 | tvOSSdkVersion: 0 170 | tvOSRequireExtendedGameController: 0 171 | tvOSTargetOSVersionString: 9.0 172 | uIPrerenderedIcon: 0 173 | uIRequiresPersistentWiFi: 0 174 | uIRequiresFullScreen: 1 175 | uIStatusBarHidden: 1 176 | uIExitOnSuspend: 0 177 | uIStatusBarStyle: 0 178 | iPhoneSplashScreen: {fileID: 0} 179 | iPhoneHighResSplashScreen: {fileID: 0} 180 | iPhoneTallHighResSplashScreen: {fileID: 0} 181 | iPhone47inSplashScreen: {fileID: 0} 182 | iPhone55inPortraitSplashScreen: {fileID: 0} 183 | iPhone55inLandscapeSplashScreen: {fileID: 0} 184 | iPhone58inPortraitSplashScreen: {fileID: 0} 185 | iPhone58inLandscapeSplashScreen: {fileID: 0} 186 | iPadPortraitSplashScreen: {fileID: 0} 187 | iPadHighResPortraitSplashScreen: {fileID: 0} 188 | iPadLandscapeSplashScreen: {fileID: 0} 189 | iPadHighResLandscapeSplashScreen: {fileID: 0} 190 | appleTVSplashScreen: {fileID: 0} 191 | appleTVSplashScreen2x: {fileID: 0} 192 | tvOSSmallIconLayers: [] 193 | tvOSSmallIconLayers2x: [] 194 | tvOSLargeIconLayers: [] 195 | tvOSLargeIconLayers2x: [] 196 | tvOSTopShelfImageLayers: [] 197 | tvOSTopShelfImageLayers2x: [] 198 | tvOSTopShelfImageWideLayers: [] 199 | tvOSTopShelfImageWideLayers2x: [] 200 | iOSLaunchScreenType: 0 201 | iOSLaunchScreenPortrait: {fileID: 0} 202 | iOSLaunchScreenLandscape: {fileID: 0} 203 | iOSLaunchScreenBackgroundColor: 204 | serializedVersion: 2 205 | rgba: 0 206 | iOSLaunchScreenFillPct: 100 207 | iOSLaunchScreenSize: 100 208 | iOSLaunchScreenCustomXibPath: 209 | iOSLaunchScreeniPadType: 0 210 | iOSLaunchScreeniPadImage: {fileID: 0} 211 | iOSLaunchScreeniPadBackgroundColor: 212 | serializedVersion: 2 213 | rgba: 0 214 | iOSLaunchScreeniPadFillPct: 100 215 | iOSLaunchScreeniPadSize: 100 216 | iOSLaunchScreeniPadCustomXibPath: 217 | iOSUseLaunchScreenStoryboard: 0 218 | iOSLaunchScreenCustomStoryboardPath: 219 | iOSDeviceRequirements: [] 220 | iOSURLSchemes: [] 221 | iOSBackgroundModes: 0 222 | iOSMetalForceHardShadows: 0 223 | metalEditorSupport: 1 224 | metalAPIValidation: 1 225 | iOSRenderExtraFrameOnPause: 0 226 | appleDeveloperTeamID: 227 | iOSManualSigningProvisioningProfileID: 228 | tvOSManualSigningProvisioningProfileID: 229 | iOSManualSigningProvisioningProfileType: 0 230 | tvOSManualSigningProvisioningProfileType: 0 231 | appleEnableAutomaticSigning: 0 232 | iOSRequireARKit: 0 233 | appleEnableProMotion: 0 234 | clonedFromGUID: c0afd0d1d80e3634a9dac47e8a0426ea 235 | templatePackageId: com.unity.3d@1.0.2 236 | templateDefaultScene: Assets/Scenes/SampleScene.unity 237 | AndroidTargetArchitectures: 5 238 | AndroidSplashScreenScale: 0 239 | androidSplashScreen: {fileID: 0} 240 | AndroidKeystoreName: 241 | AndroidKeyaliasName: 242 | AndroidBuildApkPerCpuArchitecture: 0 243 | AndroidTVCompatibility: 1 244 | AndroidIsGame: 1 245 | AndroidEnableTango: 0 246 | androidEnableBanner: 1 247 | androidUseLowAccuracyLocation: 0 248 | m_AndroidBanners: 249 | - width: 320 250 | height: 180 251 | banner: {fileID: 0} 252 | androidGamepadSupportLevel: 0 253 | resolutionDialogBanner: {fileID: 0} 254 | m_BuildTargetIcons: [] 255 | m_BuildTargetPlatformIcons: [] 256 | m_BuildTargetBatching: 257 | - m_BuildTarget: Standalone 258 | m_StaticBatching: 1 259 | m_DynamicBatching: 0 260 | - m_BuildTarget: tvOS 261 | m_StaticBatching: 1 262 | m_DynamicBatching: 0 263 | - m_BuildTarget: Android 264 | m_StaticBatching: 1 265 | m_DynamicBatching: 0 266 | - m_BuildTarget: iPhone 267 | m_StaticBatching: 1 268 | m_DynamicBatching: 0 269 | - m_BuildTarget: WebGL 270 | m_StaticBatching: 0 271 | m_DynamicBatching: 0 272 | m_BuildTargetGraphicsAPIs: 273 | - m_BuildTarget: AndroidPlayer 274 | m_APIs: 0b00000015000000 275 | m_Automatic: 1 276 | - m_BuildTarget: iOSSupport 277 | m_APIs: 10000000 278 | m_Automatic: 1 279 | - m_BuildTarget: AppleTVSupport 280 | m_APIs: 10000000 281 | m_Automatic: 0 282 | - m_BuildTarget: WebGLSupport 283 | m_APIs: 0b000000 284 | m_Automatic: 1 285 | m_BuildTargetVRSettings: 286 | - m_BuildTarget: Standalone 287 | m_Enabled: 0 288 | m_Devices: 289 | - Oculus 290 | - OpenVR 291 | m_BuildTargetEnableVuforiaSettings: [] 292 | openGLRequireES31: 0 293 | openGLRequireES31AEP: 0 294 | m_TemplateCustomTags: {} 295 | mobileMTRendering: 296 | Android: 1 297 | iPhone: 1 298 | tvOS: 1 299 | m_BuildTargetGroupLightmapEncodingQuality: [] 300 | m_BuildTargetGroupLightmapSettings: [] 301 | playModeTestRunnerEnabled: 0 302 | runPlayModeTestAsEditModeTest: 0 303 | actionOnDotNetUnhandledException: 1 304 | enableInternalProfiler: 0 305 | logObjCUncaughtExceptions: 1 306 | enableCrashReportAPI: 0 307 | cameraUsageDescription: 308 | locationUsageDescription: 309 | microphoneUsageDescription: 310 | switchNetLibKey: 311 | switchSocketMemoryPoolSize: 6144 312 | switchSocketAllocatorPoolSize: 128 313 | switchSocketConcurrencyLimit: 14 314 | switchScreenResolutionBehavior: 2 315 | switchUseCPUProfiler: 0 316 | switchApplicationID: 0x01004b9000490000 317 | switchNSODependencies: 318 | switchTitleNames_0: 319 | switchTitleNames_1: 320 | switchTitleNames_2: 321 | switchTitleNames_3: 322 | switchTitleNames_4: 323 | switchTitleNames_5: 324 | switchTitleNames_6: 325 | switchTitleNames_7: 326 | switchTitleNames_8: 327 | switchTitleNames_9: 328 | switchTitleNames_10: 329 | switchTitleNames_11: 330 | switchTitleNames_12: 331 | switchTitleNames_13: 332 | switchTitleNames_14: 333 | switchPublisherNames_0: 334 | switchPublisherNames_1: 335 | switchPublisherNames_2: 336 | switchPublisherNames_3: 337 | switchPublisherNames_4: 338 | switchPublisherNames_5: 339 | switchPublisherNames_6: 340 | switchPublisherNames_7: 341 | switchPublisherNames_8: 342 | switchPublisherNames_9: 343 | switchPublisherNames_10: 344 | switchPublisherNames_11: 345 | switchPublisherNames_12: 346 | switchPublisherNames_13: 347 | switchPublisherNames_14: 348 | switchIcons_0: {fileID: 0} 349 | switchIcons_1: {fileID: 0} 350 | switchIcons_2: {fileID: 0} 351 | switchIcons_3: {fileID: 0} 352 | switchIcons_4: {fileID: 0} 353 | switchIcons_5: {fileID: 0} 354 | switchIcons_6: {fileID: 0} 355 | switchIcons_7: {fileID: 0} 356 | switchIcons_8: {fileID: 0} 357 | switchIcons_9: {fileID: 0} 358 | switchIcons_10: {fileID: 0} 359 | switchIcons_11: {fileID: 0} 360 | switchIcons_12: {fileID: 0} 361 | switchIcons_13: {fileID: 0} 362 | switchIcons_14: {fileID: 0} 363 | switchSmallIcons_0: {fileID: 0} 364 | switchSmallIcons_1: {fileID: 0} 365 | switchSmallIcons_2: {fileID: 0} 366 | switchSmallIcons_3: {fileID: 0} 367 | switchSmallIcons_4: {fileID: 0} 368 | switchSmallIcons_5: {fileID: 0} 369 | switchSmallIcons_6: {fileID: 0} 370 | switchSmallIcons_7: {fileID: 0} 371 | switchSmallIcons_8: {fileID: 0} 372 | switchSmallIcons_9: {fileID: 0} 373 | switchSmallIcons_10: {fileID: 0} 374 | switchSmallIcons_11: {fileID: 0} 375 | switchSmallIcons_12: {fileID: 0} 376 | switchSmallIcons_13: {fileID: 0} 377 | switchSmallIcons_14: {fileID: 0} 378 | switchManualHTML: 379 | switchAccessibleURLs: 380 | switchLegalInformation: 381 | switchMainThreadStackSize: 1048576 382 | switchPresenceGroupId: 383 | switchLogoHandling: 0 384 | switchReleaseVersion: 0 385 | switchDisplayVersion: 1.0.0 386 | switchStartupUserAccount: 0 387 | switchTouchScreenUsage: 0 388 | switchSupportedLanguagesMask: 0 389 | switchLogoType: 0 390 | switchApplicationErrorCodeCategory: 391 | switchUserAccountSaveDataSize: 0 392 | switchUserAccountSaveDataJournalSize: 0 393 | switchApplicationAttribute: 0 394 | switchCardSpecSize: -1 395 | switchCardSpecClock: -1 396 | switchRatingsMask: 0 397 | switchRatingsInt_0: 0 398 | switchRatingsInt_1: 0 399 | switchRatingsInt_2: 0 400 | switchRatingsInt_3: 0 401 | switchRatingsInt_4: 0 402 | switchRatingsInt_5: 0 403 | switchRatingsInt_6: 0 404 | switchRatingsInt_7: 0 405 | switchRatingsInt_8: 0 406 | switchRatingsInt_9: 0 407 | switchRatingsInt_10: 0 408 | switchRatingsInt_11: 0 409 | switchLocalCommunicationIds_0: 410 | switchLocalCommunicationIds_1: 411 | switchLocalCommunicationIds_2: 412 | switchLocalCommunicationIds_3: 413 | switchLocalCommunicationIds_4: 414 | switchLocalCommunicationIds_5: 415 | switchLocalCommunicationIds_6: 416 | switchLocalCommunicationIds_7: 417 | switchParentalControl: 0 418 | switchAllowsScreenshot: 1 419 | switchAllowsVideoCapturing: 1 420 | switchAllowsRuntimeAddOnContentInstall: 0 421 | switchDataLossConfirmation: 0 422 | switchUserAccountLockEnabled: 0 423 | switchSupportedNpadStyles: 3 424 | switchNativeFsCacheSize: 32 425 | switchIsHoldTypeHorizontal: 0 426 | switchSupportedNpadCount: 8 427 | switchSocketConfigEnabled: 0 428 | switchTcpInitialSendBufferSize: 32 429 | switchTcpInitialReceiveBufferSize: 64 430 | switchTcpAutoSendBufferSizeMax: 256 431 | switchTcpAutoReceiveBufferSizeMax: 256 432 | switchUdpSendBufferSize: 9 433 | switchUdpReceiveBufferSize: 42 434 | switchSocketBufferEfficiency: 4 435 | switchSocketInitializeEnabled: 1 436 | switchNetworkInterfaceManagerInitializeEnabled: 1 437 | switchPlayerConnectionEnabled: 1 438 | ps4NPAgeRating: 12 439 | ps4NPTitleSecret: 440 | ps4NPTrophyPackPath: 441 | ps4ParentalLevel: 11 442 | ps4ContentID: ED1633-NPXX51362_00-0000000000000000 443 | ps4Category: 0 444 | ps4MasterVersion: 01.00 445 | ps4AppVersion: 01.00 446 | ps4AppType: 0 447 | ps4ParamSfxPath: 448 | ps4VideoOutPixelFormat: 0 449 | ps4VideoOutInitialWidth: 1920 450 | ps4VideoOutBaseModeInitialWidth: 1920 451 | ps4VideoOutReprojectionRate: 60 452 | ps4PronunciationXMLPath: 453 | ps4PronunciationSIGPath: 454 | ps4BackgroundImagePath: 455 | ps4StartupImagePath: 456 | ps4StartupImagesFolder: 457 | ps4IconImagesFolder: 458 | ps4SaveDataImagePath: 459 | ps4SdkOverride: 460 | ps4BGMPath: 461 | ps4ShareFilePath: 462 | ps4ShareOverlayImagePath: 463 | ps4PrivacyGuardImagePath: 464 | ps4NPtitleDatPath: 465 | ps4RemotePlayKeyAssignment: -1 466 | ps4RemotePlayKeyMappingDir: 467 | ps4PlayTogetherPlayerCount: 0 468 | ps4EnterButtonAssignment: 1 469 | ps4ApplicationParam1: 0 470 | ps4ApplicationParam2: 0 471 | ps4ApplicationParam3: 0 472 | ps4ApplicationParam4: 0 473 | ps4DownloadDataSize: 0 474 | ps4GarlicHeapSize: 2048 475 | ps4ProGarlicHeapSize: 2560 476 | ps4Passcode: frAQBc8Wsa1xVPfvJcrgRYwTiizs2trQ 477 | ps4pnSessions: 1 478 | ps4pnPresence: 1 479 | ps4pnFriends: 1 480 | ps4pnGameCustomData: 1 481 | playerPrefsSupport: 0 482 | enableApplicationExit: 0 483 | resetTempFolder: 1 484 | restrictedAudioUsageRights: 0 485 | ps4UseResolutionFallback: 0 486 | ps4ReprojectionSupport: 0 487 | ps4UseAudio3dBackend: 0 488 | ps4SocialScreenEnabled: 0 489 | ps4ScriptOptimizationLevel: 0 490 | ps4Audio3dVirtualSpeakerCount: 14 491 | ps4attribCpuUsage: 0 492 | ps4PatchPkgPath: 493 | ps4PatchLatestPkgPath: 494 | ps4PatchChangeinfoPath: 495 | ps4PatchDayOne: 0 496 | ps4attribUserManagement: 0 497 | ps4attribMoveSupport: 0 498 | ps4attrib3DSupport: 0 499 | ps4attribShareSupport: 0 500 | ps4attribExclusiveVR: 0 501 | ps4disableAutoHideSplash: 0 502 | ps4videoRecordingFeaturesUsed: 0 503 | ps4contentSearchFeaturesUsed: 0 504 | ps4attribEyeToEyeDistanceSettingVR: 0 505 | ps4IncludedModules: [] 506 | monoEnv: 507 | splashScreenBackgroundSourceLandscape: {fileID: 0} 508 | splashScreenBackgroundSourcePortrait: {fileID: 0} 509 | spritePackerPolicy: 510 | webGLMemorySize: 256 511 | webGLExceptionSupport: 3 512 | webGLNameFilesAsHashes: 0 513 | webGLDataCaching: 1 514 | webGLDebugSymbols: 1 515 | webGLEmscriptenArgs: 516 | webGLModulesDirectory: 517 | webGLTemplate: APPLICATION:Default 518 | webGLAnalyzeBuildSize: 0 519 | webGLUseEmbeddedResources: 0 520 | webGLCompressionFormat: 1 521 | webGLLinkerTarget: 1 522 | webGLThreadsSupport: 0 523 | scriptingDefineSymbols: {} 524 | platformArchitecture: {} 525 | scriptingBackend: {} 526 | il2cppCompilerConfiguration: {} 527 | managedStrippingLevel: {} 528 | incrementalIl2cppBuild: {} 529 | allowUnsafeCode: 0 530 | additionalIl2CppArgs: 531 | scriptingRuntimeVersion: 1 532 | apiCompatibilityLevelPerPlatform: 533 | Standalone: 6 534 | m_RenderingPath: 1 535 | m_MobileRenderingPath: 1 536 | metroPackageName: Template_3D 537 | metroPackageVersion: 538 | metroCertificatePath: 539 | metroCertificatePassword: 540 | metroCertificateSubject: 541 | metroCertificateIssuer: 542 | metroCertificateNotAfter: 0000000000000000 543 | metroApplicationDescription: Template_3D 544 | wsaImages: {} 545 | metroTileShortName: 546 | metroTileShowName: 0 547 | metroMediumTileShowName: 0 548 | metroLargeTileShowName: 0 549 | metroWideTileShowName: 0 550 | metroSupportStreamingInstall: 0 551 | metroLastRequiredScene: 0 552 | metroDefaultTileSize: 1 553 | metroTileForegroundText: 2 554 | metroTileBackgroundColor: {r: 0.13333334, g: 0.17254902, b: 0.21568628, a: 0} 555 | metroSplashScreenBackgroundColor: {r: 0.12941177, g: 0.17254902, b: 0.21568628, 556 | a: 1} 557 | metroSplashScreenUseBackgroundColor: 0 558 | platformCapabilities: {} 559 | metroTargetDeviceFamilies: {} 560 | metroFTAName: 561 | metroFTAFileTypes: [] 562 | metroProtocolName: 563 | metroCompilationOverrides: 1 564 | XboxOneProductId: 565 | XboxOneUpdateKey: 566 | XboxOneSandboxId: 567 | XboxOneContentId: 568 | XboxOneTitleId: 569 | XboxOneSCId: 570 | XboxOneGameOsOverridePath: 571 | XboxOnePackagingOverridePath: 572 | XboxOneAppManifestOverridePath: 573 | XboxOneVersion: 1.0.0.0 574 | XboxOnePackageEncryption: 0 575 | XboxOnePackageUpdateGranularity: 2 576 | XboxOneDescription: 577 | XboxOneLanguage: 578 | - enus 579 | XboxOneCapability: [] 580 | XboxOneGameRating: {} 581 | XboxOneIsContentPackage: 0 582 | XboxOneEnableGPUVariability: 0 583 | XboxOneSockets: {} 584 | XboxOneSplashScreen: {fileID: 0} 585 | XboxOneAllowedProductIds: [] 586 | XboxOnePersistentLocalStorageSize: 0 587 | XboxOneXTitleMemory: 8 588 | xboxOneScriptCompiler: 0 589 | XboxOneOverrideIdentityName: 590 | vrEditorSettings: 591 | daydream: 592 | daydreamIconForeground: {fileID: 0} 593 | daydreamIconBackground: {fileID: 0} 594 | cloudServicesEnabled: 595 | UNet: 1 596 | luminIcon: 597 | m_Name: 598 | m_ModelFolderPath: 599 | m_PortalFolderPath: 600 | luminCert: 601 | m_CertPath: 602 | m_PrivateKeyPath: 603 | luminIsChannelApp: 0 604 | luminVersion: 605 | m_VersionCode: 1 606 | m_VersionName: 607 | facebookSdkVersion: 7.9.4 608 | facebookAppId: 609 | facebookCookies: 1 610 | facebookLogging: 1 611 | facebookStatus: 1 612 | facebookXfbml: 0 613 | facebookFrictionlessRequests: 1 614 | apiCompatibilityLevel: 3 615 | cloudProjectId: f910eaef-f551-456b-a603-9186b839c9c0 616 | framebufferDepthMemorylessMode: 0 617 | projectName: ScatterSharpTest 618 | organizationId: mmcs85 619 | cloudEnabled: 0 620 | enableNativePlatformBackendsForNewInputSystem: 0 621 | disableOldInputManagerSupport: 0 622 | legacyClampBlendShapeWeights: 1 623 | -------------------------------------------------------------------------------- /Unity3D/ScatterSharpUnity3D/Library/ScriptMapper: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GetScatter/scatter-sharp/e0bf661ea775c55618648adaa4f740e91bfa8bf9/Unity3D/ScatterSharpUnity3D/Library/ScriptMapper -------------------------------------------------------------------------------- /Unity3D/ScatterSharpUnity3D/Library/ShaderCache.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GetScatter/scatter-sharp/e0bf661ea775c55618648adaa4f740e91bfa8bf9/Unity3D/ScatterSharpUnity3D/Library/ShaderCache.db -------------------------------------------------------------------------------- /Unity3D/ScatterSharpUnity3D/Library/SpriteAtlasDatabase.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GetScatter/scatter-sharp/e0bf661ea775c55618648adaa4f740e91bfa8bf9/Unity3D/ScatterSharpUnity3D/Library/SpriteAtlasDatabase.asset -------------------------------------------------------------------------------- /Unity3D/ScatterSharpUnity3D/Library/TilemapEditorUserSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GetScatter/scatter-sharp/e0bf661ea775c55618648adaa4f740e91bfa8bf9/Unity3D/ScatterSharpUnity3D/Library/TilemapEditorUserSettings.asset -------------------------------------------------------------------------------- /Unity3D/ScatterSharpUnity3D/Library/expandedItems: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GetScatter/scatter-sharp/e0bf661ea775c55618648adaa4f740e91bfa8bf9/Unity3D/ScatterSharpUnity3D/Library/expandedItems -------------------------------------------------------------------------------- /Unity3D/ScatterSharpUnity3D/Library/shadercompiler-UnityShaderCompiler.exe0.log: -------------------------------------------------------------------------------- 1 | Base path: C:/Program Files/Unity/Editor/Data 2 | Cmd: initializeCompiler 3 | Cmd: compileSnippet 4 | api=4 type=0 insize=1582 outsize=690 kw= pd=UNITY_ENABLE_REFLECTION_BUFFERS UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING UNITY_ENABLE_DETAIL_NORMALMAP SHADER_API_DESKTOP UNITY_COLORSPACE_GAMMA UNITY_LIGHT_PROBE_PROXY_VOLUME UNITY_LIGHTMAP_FULL_HDR ok=1 5 | Cmd: compileSnippet 6 | api=4 type=1 insize=1582 outsize=354 kw= pd=UNITY_ENABLE_REFLECTION_BUFFERS UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING UNITY_ENABLE_DETAIL_NORMALMAP SHADER_API_DESKTOP UNITY_COLORSPACE_GAMMA UNITY_LIGHT_PROBE_PROXY_VOLUME UNITY_LIGHTMAP_FULL_HDR ok=1 7 | Cmd: compileSnippet 8 | api=4 type=0 insize=1842 outsize=1082 kw= pd=UNITY_ENABLE_REFLECTION_BUFFERS UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING UNITY_ENABLE_DETAIL_NORMALMAP SHADER_API_DESKTOP UNITY_COLORSPACE_GAMMA UNITY_LIGHT_PROBE_PROXY_VOLUME UNITY_LIGHTMAP_FULL_HDR ok=1 9 | Cmd: compileSnippet 10 | api=4 type=1 insize=1842 outsize=798 kw= pd=UNITY_ENABLE_REFLECTION_BUFFERS UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING UNITY_ENABLE_DETAIL_NORMALMAP SHADER_API_DESKTOP UNITY_COLORSPACE_GAMMA UNITY_LIGHT_PROBE_PROXY_VOLUME UNITY_LIGHTMAP_FULL_HDR ok=1 11 | Cmd: compileSnippet 12 | api=4 type=0 insize=1701 outsize=1094 kw= pd=UNITY_ENABLE_REFLECTION_BUFFERS UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING UNITY_ENABLE_DETAIL_NORMALMAP SHADER_API_DESKTOP UNITY_COLORSPACE_GAMMA UNITY_LIGHT_PROBE_PROXY_VOLUME UNITY_LIGHTMAP_FULL_HDR ok=1 13 | Cmd: compileSnippet 14 | api=4 type=1 insize=1701 outsize=522 kw= pd=UNITY_ENABLE_REFLECTION_BUFFERS UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING UNITY_ENABLE_DETAIL_NORMALMAP SHADER_API_DESKTOP UNITY_COLORSPACE_GAMMA UNITY_LIGHT_PROBE_PROXY_VOLUME UNITY_LIGHTMAP_FULL_HDR ok=1 15 | Cmd: compileSnippet 16 | api=4 type=0 insize=16605 outsize=5666 kw=_SUNDISK_SIMPLE pd=UNITY_ENABLE_REFLECTION_BUFFERS UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING UNITY_ENABLE_DETAIL_NORMALMAP SHADER_API_DESKTOP UNITY_COLORSPACE_GAMMA UNITY_LIGHT_PROBE_PROXY_VOLUME UNITY_LIGHTMAP_FULL_HDR ok=1 17 | Cmd: compileSnippet 18 | api=4 type=1 insize=16605 outsize=902 kw=_SUNDISK_SIMPLE pd=UNITY_ENABLE_REFLECTION_BUFFERS UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING UNITY_ENABLE_DETAIL_NORMALMAP SHADER_API_DESKTOP UNITY_COLORSPACE_GAMMA UNITY_LIGHT_PROBE_PROXY_VOLUME UNITY_LIGHTMAP_FULL_HDR ok=1 19 | Cmd: compileSnippet 20 | api=4 type=0 insize=1878 outsize=1082 kw= pd=UNITY_ENABLE_REFLECTION_BUFFERS UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING UNITY_ENABLE_DETAIL_NORMALMAP SHADER_API_DESKTOP UNITY_COLORSPACE_GAMMA UNITY_LIGHT_PROBE_PROXY_VOLUME UNITY_LIGHTMAP_FULL_HDR ok=1 21 | Cmd: compileSnippet 22 | api=4 type=1 insize=1878 outsize=778 kw= pd=UNITY_ENABLE_REFLECTION_BUFFERS UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING UNITY_ENABLE_DETAIL_NORMALMAP SHADER_API_DESKTOP UNITY_COLORSPACE_GAMMA UNITY_LIGHT_PROBE_PROXY_VOLUME UNITY_LIGHTMAP_FULL_HDR ok=1 23 | Cmd: compileSnippet 24 | api=4 type=0 insize=2285 outsize=858 kw= pd=UNITY_ENABLE_REFLECTION_BUFFERS UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING UNITY_ENABLE_DETAIL_NORMALMAP SHADER_API_DESKTOP UNITY_COLORSPACE_GAMMA UNITY_LIGHT_PROBE_PROXY_VOLUME UNITY_LIGHTMAP_FULL_HDR ok=1 25 | Cmd: compileSnippet 26 | api=4 type=1 insize=2285 outsize=446 kw= pd=UNITY_ENABLE_REFLECTION_BUFFERS UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING UNITY_ENABLE_DETAIL_NORMALMAP SHADER_API_DESKTOP UNITY_COLORSPACE_GAMMA UNITY_LIGHT_PROBE_PROXY_VOLUME UNITY_LIGHTMAP_FULL_HDR ok=1 27 | Cmd: initializeCompiler 28 | Cmd: initializeCompiler 29 | Cmd: initializeCompiler 30 | Cmd: initializeCompiler 31 | -------------------------------------------------------------------------------- /Unity3D/ScatterSharpUnity3D/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 | -------------------------------------------------------------------------------- /Unity3D/ScatterSharpUnity3D/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 | -------------------------------------------------------------------------------- /Unity3D/ScatterSharpUnity3D/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 | -------------------------------------------------------------------------------- /Unity3D/ScatterSharpUnity3D/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: 7 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: 1 23 | m_ClothInterCollisionSettingsToggle: 0 24 | m_ContactPairsMode: 0 25 | m_BroadphaseType: 0 26 | m_WorldBounds: 27 | m_Center: {x: 0, y: 0, z: 0} 28 | m_Extent: {x: 250, y: 250, z: 250} 29 | m_WorldSubdivisions: 8 30 | -------------------------------------------------------------------------------- /Unity3D/ScatterSharpUnity3D/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: 1 9 | path: Assets/Scenes/SampleScene.unity 10 | guid: 99c9720ab356a0642a771bea13969a05 11 | m_configObjects: {} 12 | -------------------------------------------------------------------------------- /Unity3D/ScatterSharpUnity3D/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 | -------------------------------------------------------------------------------- /Unity3D/ScatterSharpUnity3D/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: 16000, guid: 0000000000000000f000000000000000, type: 0} 39 | - {fileID: 17000, guid: 0000000000000000f000000000000000, type: 0} 40 | m_PreloadedShaders: [] 41 | m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000, 42 | type: 0} 43 | m_CustomRenderPipeline: {fileID: 0} 44 | m_TransparencySortMode: 0 45 | m_TransparencySortAxis: {x: 0, y: 0, z: 1} 46 | m_DefaultRenderingPath: 1 47 | m_DefaultMobileRenderingPath: 1 48 | m_TierSettings: [] 49 | m_LightmapStripping: 0 50 | m_FogStripping: 0 51 | m_InstancingStripping: 0 52 | m_LightmapKeepPlain: 1 53 | m_LightmapKeepDirCombined: 1 54 | m_LightmapKeepDynamicPlain: 1 55 | m_LightmapKeepDynamicDirCombined: 1 56 | m_LightmapKeepShadowMask: 1 57 | m_LightmapKeepSubtractive: 1 58 | m_FogKeepLinear: 1 59 | m_FogKeepExp: 1 60 | m_FogKeepExp2: 1 61 | m_AlbedoSwatchInfos: [] 62 | m_LightsUseLinearIntensity: 0 63 | m_LightsUseColorTemperature: 0 64 | -------------------------------------------------------------------------------- /Unity3D/ScatterSharpUnity3D/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 | -------------------------------------------------------------------------------- /Unity3D/ScatterSharpUnity3D/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 | -------------------------------------------------------------------------------- /Unity3D/ScatterSharpUnity3D/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 | -------------------------------------------------------------------------------- /Unity3D/ScatterSharpUnity3D/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: 3 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_AutoSyncTransforms: 1 28 | m_AlwaysShowColliders: 0 29 | m_ShowColliderSleep: 1 30 | m_ShowColliderContacts: 0 31 | m_ShowColliderAABB: 0 32 | m_ContactArrowScale: 0.2 33 | m_ColliderAwakeColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.7529412} 34 | m_ColliderAsleepColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.36078432} 35 | m_ColliderContactColor: {r: 1, g: 0, b: 1, a: 0.6862745} 36 | m_ColliderAABBColor: {r: 1, g: 1, b: 0, a: 0.2509804} 37 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 38 | -------------------------------------------------------------------------------- /Unity3D/ScatterSharpUnity3D/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 | -------------------------------------------------------------------------------- /Unity3D/ScatterSharpUnity3D/ProjectSettings/ProjectVersion.txt: -------------------------------------------------------------------------------- 1 | m_EditorVersion: 2018.3.0f2 2 | -------------------------------------------------------------------------------- /Unity3D/ScatterSharpUnity3D/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: 4 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: 4 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: 4 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: 4 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: 4 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: 4 216 | asyncUploadPersistentBuffer: 1 217 | resolutionScalingFixedDPIFactor: 1 218 | excludedTargetPlatforms: [] 219 | m_PerPlatformDefaultQuality: {} 220 | -------------------------------------------------------------------------------- /Unity3D/ScatterSharpUnity3D/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 | -------------------------------------------------------------------------------- /Unity3D/ScatterSharpUnity3D/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 | -------------------------------------------------------------------------------- /Unity3D/ScatterSharpUnity3D/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: 1 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 | -------------------------------------------------------------------------------- /Unity3D/ScatterSharpUnity3D/ProjectSettings/VFXManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GetScatter/scatter-sharp/e0bf661ea775c55618648adaa4f740e91bfa8bf9/Unity3D/ScatterSharpUnity3D/ProjectSettings/VFXManager.asset -------------------------------------------------------------------------------- /Unity3D/build_package_win.bat: -------------------------------------------------------------------------------- 1 | echo off 2 | setlocal 3 | 4 | set ScatterSharpUnity3DDir=ScatterSharpUnity3D\Assets\Plugins\ 5 | 6 | if not exist "ScatterSharpUnity3D\Assets\Plugins\" ( 7 | call create_plugins.bat 8 | ) 9 | 10 | if "%UNITY_PATH%" == "" ( 11 | set UNITY_PATH=%1 12 | ) 13 | 14 | set SEARCH_UNITY_PATH=%ProgramFiles%\Unity\Hub\Editor\Unity.exe 15 | if "%UNITY_PATH%" == "" ( 16 | FOR /F "delims=" %%i IN ('dir /b /s "%SEARCH_UNITY_PATH%"') DO set UNITY_PATH=%%i 17 | ) 18 | 19 | if "%UNITY_PATH%" == "" ( 20 | echo Error: Unity path not defined. Please set the UNITY_PATH environment variable to the Unity.exe file, or pass the path as argument 21 | exit /B 1 22 | ) 23 | 24 | if not exist "%UNITY_PATH%" ( 25 | echo Error: File %UNITY_PATH% doesn't exist 26 | exit /B 1 27 | ) 28 | 29 | echo Using UNITY_PATH = %UNITY_PATH% 30 | echo Launching Unity to build scatter-sharp.unitypackage 31 | 32 | "%UNITY_PATH%" -batchmode -nographics -logFile out.txt -projectPath "%cd%/ScatterSharpUnity3D/" -exportPackage "Assets/Plugins" "..\scatter-sharp.unitypackage" -quit 33 | 34 | echo scatter-sharp.unitypackage builded successfully -------------------------------------------------------------------------------- /Unity3D/create_plugins.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | setlocal 3 | 4 | set CONFIGURATION=%1 5 | if "%CONFIGURATION%" == "" ( 6 | echo Using default build configuration Release 7 | set CONFIGURATION=Release 8 | ) 9 | 10 | for /f "usebackq tokens=1* delims=: " %%i in (`"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -latest -requires Microsoft.Component.MSBuild`) do ( 11 | if /i "%%i"=="installationPath" set InstallDir=%%j 12 | ) 13 | 14 | set ScatterSharpUnity3DDir=ScatterSharpUnity3D\Assets\Plugins\ 15 | 16 | if exist "%InstallDir%\MSBuild\Current\Bin\MSBuild.exe" ( 17 | set MSBuild="%InstallDir%\MSBuild\Current\Bin\MSBuild.exe" 18 | ) else ( 19 | set MSBuild="%InstallDir%\MSBuild\15.0\Bin\MSBuild.exe" 20 | ) 21 | 22 | if exist "%MSBuild%" ( 23 | cd ..\ScatterSharp\ 24 | echo Restoring Nuget packages 25 | dotnet restore 26 | echo Building ScatterSharp project 27 | %MSBuild% ScatterSharp.sln /p:Configuration=%CONFIGURATION% 28 | 29 | echo Copying ScatterSharp project to Assets Plugins 30 | cd ..\Unity3D 31 | 32 | if not exist "%ScatterSharpUnity3DDir%" ( 33 | mkdir %ScatterSharpUnity3DDir% 34 | ) 35 | 36 | copy %userprofile%\.nuget\packages\cryptography.ecdsa.secp256k1\1.1.2\lib\netstandard2.0\Cryptography.ECDSA.dll %ScatterSharpUnity3DDir% 37 | copy %userprofile%\.nuget\packages\json.net.aot\9.0.1\lib\netstandard2.0\Newtonsoft.Json.dll %ScatterSharpUnity3DDir% 38 | copy ..\eos-sharp\EosSharp\EosSharp.Core\bin\%CONFIGURATION%\netstandard2.0\EosSharp.Core.dll %ScatterSharpUnity3DDir% 39 | copy ..\eos-sharp\EosSharp\EosSharp.Unity3D\bin\%CONFIGURATION%\netstandard2.0\EosSharp.Unity3D.dll %ScatterSharpUnity3DDir% 40 | copy ..\socketio-sharp\SocketIOSharp\WebSocketSharp\websocket-sharp\bin\Release\websocket-sharp.dll %ScatterSharpUnity3DDir% 41 | copy ..\socketio-sharp\SocketIOSharp\SocketIOSharp.Core\bin\%CONFIGURATION%\netstandard2.0\SocketIOSharp.Core.dll %ScatterSharpUnity3DDir% 42 | copy ..\socketio-sharp\SocketIOSharp\SocketIOSharp.Unity3D\bin\%CONFIGURATION%\netstandard2.0\SocketIOSharp.Unity3D.dll %ScatterSharpUnity3DDir% 43 | copy ..\socketio-sharp\SocketIOSharp\SocketIOSharp.Unity3D\WebSocket.jslib %ScatterSharpUnity3DDir% 44 | copy ..\ScatterSharp\ScatterSharp.Core\bin\%CONFIGURATION%\netstandard2.0\ScatterSharp.Core.dll %ScatterSharpUnity3DDir% 45 | copy ..\ScatterSharp\ScatterSharp.Unity3D\bin\%CONFIGURATION%\netstandard2.0\ScatterSharp.Unity3D.dll %ScatterSharpUnity3DDir% 46 | copy ..\ScatterSharp\ScatterSharp.EosProvider\bin\%CONFIGURATION%\netstandard2.0\ScatterSharp.EosProvider.dll %ScatterSharpUnity3DDir% 47 | copy ..\ScatterSharp\ScatterSharp.UnitTests.Core\bin\%CONFIGURATION%\netstandard2.0\ScatterSharp.UnitTests.Core.dll %ScatterSharpUnity3DDir% 48 | copy ..\ScatterSharp\ScatterSharp.UnitTests.Unity3D\bin\%CONFIGURATION%\netstandard2.0\ScatterSharp.UnitTests.Unity3D.dll %ScatterSharpUnity3DDir% 49 | 50 | echo Project Assets Plugins build successfully 51 | ) 52 | -------------------------------------------------------------------------------- /Unity3D/scatter-sharp.unitypackage: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GetScatter/scatter-sharp/e0bf661ea775c55618648adaa4f740e91bfa8bf9/Unity3D/scatter-sharp.unitypackage -------------------------------------------------------------------------------- /data/ws-detail.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GetScatter/scatter-sharp/e0bf661ea775c55618648adaa4f740e91bfa8bf9/data/ws-detail.png -------------------------------------------------------------------------------- /data/ws.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GetScatter/scatter-sharp/e0bf661ea775c55618648adaa4f740e91bfa8bf9/data/ws.png --------------------------------------------------------------------------------