1111using System . Collections . Generic ;
1212using UnityEngine ;
1313using EosSharp . Core . Api . v1 ;
14+ using EosSharp . Core . Exceptions ;
1415
1516public 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 ) ) ;
0 commit comments