Skip to content

Commit d5166e2

Browse files
committed
eos-sharp: Fixes to ApiError throwing in Unity3D
update scatter-sharp to 2.0.9 fixes to create_plugin script
1 parent af7bd92 commit d5166e2

File tree

6 files changed

+50
-36
lines changed

6 files changed

+50
-36
lines changed

Diff for: ScatterSharp/ScatterSharp.EosProvider/ScatterSharp.EosProvider.csproj

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22

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

3737
</PackageReleaseNotes>
3838
</PropertyGroup>

Diff for: ScatterSharp/ScatterSharp/ScatterSharp.csproj

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
44
<TargetFramework>netstandard2.0</TargetFramework>
@@ -13,10 +13,10 @@
1313
<RepositoryUrl>https://github.com/GetScatter/scatter-sharp</RepositoryUrl>
1414
<RepositoryType>git</RepositoryType>
1515
<PackageTags>EOS, NetStandard, secp256k1, Blockchain, Scatter</PackageTags>
16-
<AssemblyVersion>2.0.8.0</AssemblyVersion>
17-
<FileVersion>2.0.8.0</FileVersion>
18-
<PackageReleaseNotes>eos-sharp: Fix unpacking transactions bug (thanks to dbulha)</PackageReleaseNotes>
19-
<Version>2.0.8</Version>
16+
<AssemblyVersion>2.0.9.0</AssemblyVersion>
17+
<FileVersion>2.0.9.0</FileVersion>
18+
<PackageReleaseNotes>eos-sharp: Fixes to ApiError throwing in Unity3D</PackageReleaseNotes>
19+
<Version>2.0.9</Version>
2020
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
2121
</PropertyGroup>
2222

Diff for: Unity3D/ScatterSharpUnity3D/Assets/Scenes/Scripts/TestScatterScript.cs

+30-22
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
using System.Collections.Generic;
1212
using UnityEngine;
1313
using EosSharp.Core.Api.v1;
14+
using EosSharp.Core.Exceptions;
1415

1516
public class TestScatterScript : MonoBehaviour
1617
{
@@ -21,13 +22,12 @@ public async void PushTransaction()
2122
ScatterSharp.Core.Api.Network network = new ScatterSharp.Core.Api.Network()
2223
{
2324
blockchain = ScatterConstants.Blockchains.EOSIO,
24-
host = "nodes.eos42.io",
25+
host = "jungle2.cryptolions.io",
2526
port = 443,
26-
chainId = "aca376f206b8fc25a6ed44dbdc66547c36c6c33e3a119ffbeaef943642f0e906"
27+
chainId = "e70aaab8997e1dfce58fbfac80cbbb8fecec7b99cf982a9444273cbc64c41473"
2728
};
2829

2930
var fileStorage = new FileStorageProvider(Application.persistentDataPath + "/scatterapp.dat");
30-
3131
using (var scatter = new Scatter(new ScatterConfigurator()
3232
{
3333
AppName = "UNITY-WEBGL-SCATTER",
@@ -40,14 +40,15 @@ public async void PushTransaction()
4040
await scatter.GetIdentity(new IdentityRequiredFields()
4141
{
4242
accounts = new List<ScatterSharp.Core.Api.Network>()
43-
{
44-
network
45-
},
43+
{
44+
network
45+
},
4646
location = new List<LocationFields>(),
4747
personal = new List<PersonalFields>()
4848
});
4949

50-
var eos = new Eos(new EosSharp.Core.EosConfigurator() {
50+
var eos = new Eos(new EosSharp.Core.EosConfigurator()
51+
{
5152
ChainId = network.chainId,
5253
HttpEndpoint = network.GetHttpEndpoint(),
5354
SignProvider = new ScatterSignatureProvider(scatter)
@@ -58,29 +59,36 @@ await scatter.GetIdentity(new IdentityRequiredFields()
5859
var result = await eos.CreateTransaction(new EosSharp.Core.Api.v1.Transaction()
5960
{
6061
actions = new List<EosSharp.Core.Api.v1.Action>()
62+
{
63+
new EosSharp.Core.Api.v1.Action()
6164
{
62-
new EosSharp.Core.Api.v1.Action()
65+
account = "eosio.token",
66+
authorization = new List<PermissionLevel>()
67+
{
68+
new PermissionLevel() { actor = account.name, permission = account.authority }
69+
},
70+
name = "transfer",
71+
data = new Dictionary<string, object>()
6372
{
64-
account = "eosio.token",
65-
authorization = new List<PermissionLevel>()
66-
{
67-
new PermissionLevel() {actor = account.name, permission = account.authority }
68-
},
69-
name = "transfer",
70-
data = new Dictionary<string, object>()
71-
{
72-
{ "from", account.name },
73-
{ "to", "eosio" },
74-
{ "quantity", "0.0001 EOS" },
75-
{ "memo", "Unity3D WEBGL hello crypto world!" }
76-
}
73+
{ "from", account.name },
74+
{ "to", "eosio" },
75+
{ "quantity", "0.0001 EOS" },
76+
{ "memo", "Unity3D WEBGL hello crypto world!" }
7777
}
7878
}
79+
}
7980
});
80-
8181
print(result);
8282
}
8383
}
84+
catch(ApiErrorException ex)
85+
{
86+
print(JsonConvert.SerializeObject(ex.error));
87+
}
88+
catch(ApiException ex)
89+
{
90+
print(ex.Content);
91+
}
8492
catch (Exception ex)
8593
{
8694
print(JsonConvert.SerializeObject(ex));

Diff for: Unity3D/create_plugins.bat

+9-3
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,18 @@ for /f "usebackq tokens=1* delims=: " %%i in (`"%ProgramFiles(x86)%\Microsoft Vi
1313

1414
set ScatterSharpUnity3DDir=ScatterSharpUnity3D\Assets\Plugins\
1515

16-
if exist "%InstallDir%\MSBuild\15.0\Bin\MSBuild.exe" (
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+
)
1721

18-
echo Building ScatterSharp project
22+
if exist "%MSBuild%" (
1923
cd ..\ScatterSharp\
24+
echo Restoring Nuget packages
2025
dotnet restore
21-
"%InstallDir%\MSBuild\15.0\Bin\MSBuild.exe" ScatterSharp.sln /p:Configuration=%CONFIGURATION%
26+
echo Building ScatterSharp project
27+
%MSBuild% ScatterSharp.sln /p:Configuration=%CONFIGURATION%
2228

2329
echo Copying ScatterSharp project to Assets Plugins
2430
cd ..\Unity3D

Diff for: Unity3D/scatter-sharp.unitypackage

411 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)