Beispiel #1
0
    public async void PushTransaction()
    {
        try
        {
            var network = new ScatterSharp.Api.Network()
            {
                Blockchain = Scatter.Blockchains.EOSIO,
                Host       = "eos.greymass.com",
                Port       = 443,
                Protocol   = "https",
                ChainId    = "aca376f206b8fc25a6ed44dbdc66547c36c6c33e3a119ffbeaef943642f0e906"
            };

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

            using (var scatter = new Scatter("dicePoker", network, fileStorage))
            {
                await scatter.Connect();

                await scatter.GetIdentity(new ScatterSharp.Api.IdentityRequiredFields()
                {
                    Accounts = new List <ScatterSharp.Api.Network>()
                    {
                        network
                    },
                    Location = new List <ScatterSharp.Api.LocationFields>(),
                    Personal = new List <ScatterSharp.Api.PersonalFields>()
                });

                print(scatter.GetVersion());

                var eos = scatter.Eos();

                var account = scatter.Identity.Accounts.First();

                var result = await eos.CreateTransaction(new Transaction()
                {
                    Actions = new List <EosSharp.Api.v1.Action>()
                    {
                        new EosSharp.Api.v1.Action()
                        {
                            Account       = "eosio.token",
                            Authorization = new List <PermissionLevel>()
                            {
                                new PermissionLevel()
                                {
                                    Actor = account.Name, Permission = account.Authority
                                }
                            },
                            Name = "transfer",
                            Data = new { from = account.Name, to = "eosvegasjack", quantity = "0.0001 EOS", memo = "Unity 3D test from blockfish!" }
                        }
                    }
                });

                print(result);
            }
        }

        catch (Exception ex)
        {
            print(JsonConvert.SerializeObject(ex));
        }
    }
        public async Task <string> GetVersion()
        {
            await Scatter.Connect();

            return(await Scatter.GetVersion());
        }