Skip to content

Commit

Permalink
eos-sharp: Fixes to ApiError throwing in Unity3D
Browse files Browse the repository at this point in the history
update scatter-sharp to 2.0.9
fixes to create_plugin script
  • Loading branch information
mmcs85 committed May 1, 2019
1 parent af7bd92 commit d5166e2
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 36 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
Expand Down Expand Up @@ -29,10 +29,10 @@
<TargetsForTfmSpecificBuildOutput>$(TargetsForTfmSpecificBuildOutput);CopyProjectReferencesToPackage</TargetsForTfmSpecificBuildOutput>
<!-- include PDBs in the NuGet package -->
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
<Version>1.0.5</Version>
<AssemblyVersion>1.0.5.0</AssemblyVersion>
<FileVersion>1.0.5.0</FileVersion>
<PackageReleaseNotes>eos-sharp: Fix unpacking transactions bug (thanks to dbulha)
<Version>1.0.6</Version>
<AssemblyVersion>1.0.6.0</AssemblyVersion>
<FileVersion>1.0.6.0</FileVersion>
<PackageReleaseNotes>eos-sharp: Fixes to ApiError throwing in Unity3D

</PackageReleaseNotes>
</PropertyGroup>
Expand Down
10 changes: 5 additions & 5 deletions ScatterSharp/ScatterSharp/ScatterSharp.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
Expand All @@ -13,10 +13,10 @@
<RepositoryUrl>https://github.com/GetScatter/scatter-sharp</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageTags>EOS, NetStandard, secp256k1, Blockchain, Scatter</PackageTags>
<AssemblyVersion>2.0.8.0</AssemblyVersion>
<FileVersion>2.0.8.0</FileVersion>
<PackageReleaseNotes>eos-sharp: Fix unpacking transactions bug (thanks to dbulha)</PackageReleaseNotes>
<Version>2.0.8</Version>
<AssemblyVersion>2.0.9.0</AssemblyVersion>
<FileVersion>2.0.9.0</FileVersion>
<PackageReleaseNotes>eos-sharp: Fixes to ApiError throwing in Unity3D</PackageReleaseNotes>
<Version>2.0.9</Version>
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
using System.Collections.Generic;
using UnityEngine;
using EosSharp.Core.Api.v1;
using EosSharp.Core.Exceptions;

public class TestScatterScript : MonoBehaviour
{
Expand All @@ -21,13 +22,12 @@ public async void PushTransaction()
ScatterSharp.Core.Api.Network network = new ScatterSharp.Core.Api.Network()
{
blockchain = ScatterConstants.Blockchains.EOSIO,
host = "nodes.eos42.io",
host = "jungle2.cryptolions.io",
port = 443,
chainId = "aca376f206b8fc25a6ed44dbdc66547c36c6c33e3a119ffbeaef943642f0e906"
chainId = "e70aaab8997e1dfce58fbfac80cbbb8fecec7b99cf982a9444273cbc64c41473"
};

var fileStorage = new FileStorageProvider(Application.persistentDataPath + "/scatterapp.dat");

using (var scatter = new Scatter(new ScatterConfigurator()
{
AppName = "UNITY-WEBGL-SCATTER",
Expand All @@ -40,14 +40,15 @@ public async void PushTransaction()
await scatter.GetIdentity(new IdentityRequiredFields()
{
accounts = new List<ScatterSharp.Core.Api.Network>()
{
network
},
{
network
},
location = new List<LocationFields>(),
personal = new List<PersonalFields>()
});

var eos = new Eos(new EosSharp.Core.EosConfigurator() {
var eos = new Eos(new EosSharp.Core.EosConfigurator()
{
ChainId = network.chainId,
HttpEndpoint = network.GetHttpEndpoint(),
SignProvider = new ScatterSignatureProvider(scatter)
Expand All @@ -58,29 +59,36 @@ await scatter.GetIdentity(new IdentityRequiredFields()
var result = await eos.CreateTransaction(new EosSharp.Core.Api.v1.Transaction()
{
actions = new List<EosSharp.Core.Api.v1.Action>()
{
new EosSharp.Core.Api.v1.Action()
{
new EosSharp.Core.Api.v1.Action()
account = "eosio.token",
authorization = new List<PermissionLevel>()
{
new PermissionLevel() { actor = account.name, permission = account.authority }
},
name = "transfer",
data = new Dictionary<string, object>()
{
account = "eosio.token",
authorization = new List<PermissionLevel>()
{
new PermissionLevel() {actor = account.name, permission = account.authority }
},
name = "transfer",
data = new Dictionary<string, object>()
{
{ "from", account.name },
{ "to", "eosio" },
{ "quantity", "0.0001 EOS" },
{ "memo", "Unity3D WEBGL hello crypto world!" }
}
{ "from", account.name },
{ "to", "eosio" },
{ "quantity", "0.0001 EOS" },
{ "memo", "Unity3D WEBGL hello crypto world!" }
}
}
}
});

print(result);
}
}
catch(ApiErrorException ex)
{
print(JsonConvert.SerializeObject(ex.error));
}
catch(ApiException ex)
{
print(ex.Content);
}
catch (Exception ex)
{
print(JsonConvert.SerializeObject(ex));
Expand Down
12 changes: 9 additions & 3 deletions Unity3D/create_plugins.bat
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,18 @@ for /f "usebackq tokens=1* delims=: " %%i in (`"%ProgramFiles(x86)%\Microsoft Vi

set ScatterSharpUnity3DDir=ScatterSharpUnity3D\Assets\Plugins\

if exist "%InstallDir%\MSBuild\15.0\Bin\MSBuild.exe" (
if exist "%InstallDir%\MSBuild\Current\Bin\MSBuild.exe" (
set MSBuild="%InstallDir%\MSBuild\Current\Bin\MSBuild.exe"
) else (
set MSBuild="%InstallDir%\MSBuild\15.0\Bin\MSBuild.exe"
)

echo Building ScatterSharp project
if exist "%MSBuild%" (
cd ..\ScatterSharp\
echo Restoring Nuget packages
dotnet restore
"%InstallDir%\MSBuild\15.0\Bin\MSBuild.exe" ScatterSharp.sln /p:Configuration=%CONFIGURATION%
echo Building ScatterSharp project
%MSBuild% ScatterSharp.sln /p:Configuration=%CONFIGURATION%

echo Copying ScatterSharp project to Assets Plugins
cd ..\Unity3D
Expand Down
Binary file modified Unity3D/scatter-sharp.unitypackage
Binary file not shown.

0 comments on commit d5166e2

Please sign in to comment.