public async Task <IdentityAccount> GetAccount()
    {
        try
        {
            ScatterSharp.Core.Api.Network network = new ScatterSharp.Core.Api.Network()
            {
                blockchain = ScatterConstants.Blockchains.EOSIO,
                host       = "jungle3.cryptolions.io",
                port       = 443,
                chainId    = "2a02a0053e5a8cf73a56ba0fda11e4d92e0238a4a2aa74fccf46d5a910746840"
            };

            var fileStorage = new FileStorageProvider(Application.persistentDataPath + "/scatterapp.dat");
            using (var scatter = new Scatter(new ScatterConfigurator()
            {
                AppName = "UNITY-PC-SCATTER",
                Network = network,
                StorageProvider = fileStorage
            }, this))
            {
                await scatter.Connect();

                await scatter.GetIdentity(new IdentityRequiredFields()
                {
                    accounts = new List <ScatterSharp.Core.Api.Network>()
                    {
                        network
                    },
                    location = new List <LocationFields>(),
                    personal = new List <PersonalFields>()
                });

                var eos = new Eos(new EosSharp.Core.EosConfigurator()
                {
                    ChainId      = network.chainId,
                    HttpEndpoint = network.GetHttpEndpoint(),
                    SignProvider = new ScatterSignatureProvider(scatter)
                });

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

                return(account);
            }
        }
        catch (ApiErrorException ex)
        {
            print(JsonConvert.SerializeObject(ex.error));
            return(null);
        }
        catch (ApiException ex)
        {
            print(ex.Content);
            return(null);
        }
        catch (Exception ex)
        {
            print(JsonConvert.SerializeObject(ex));
            return(null);
        }
    }
Exemple #2
0
    public async void InitScatter()
    {
        var network = new ScatterSharp.Api.Network()
        {
            Blockchain = Scatter.Blockchains.EOSIO,
            Host       = "api.eossweden.se",
            Port       = 443,
            Protocol   = "https",
            ChainId    = "aca376f206b8fc25a6ed44dbdc66547c36c6c33e3a119ffbeaef943642f0e906"
        };

        var scatter = new Scatter("UnityTestApp", network);

        await scatter.Connect();

        var identity = 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>()
        });

        Debug.Log(identity);

        var eos = scatter.Eos();
    }
 private async Task <Identity> GetIdentityFromScatter()
 {
     return(await Scatter.GetIdentity(new IdentityRequiredFields()
     {
         accounts = new List <Network>()
         {
             Network
         },
         location = new List <LocationFields>(),
         personal = new List <PersonalFields>()
     }));
 }
Exemple #4
0
        public static async void Login()
        {
            mScatter = new Scatter(mScatterTitle, mNetwork);

            try
            {
                await mScatter.Connect();
            }
            catch (WebSocketException ex)
            {
                string errorMsg = "";
                switch (ex.ErrorCode)
                {
                case 10061:
                    errorMsg = "데스크탑 스캐터가 실행중이지 않습니다.";
                    break;

                default:
                    errorMsg = ex.Message;
                    break;
                }
                Form1.tbConsoleQueue.Enqueue(errorMsg);
                Form1.btnLoginQueue.Enqueue(true);
                return;
            }

            var identity = await mScatter.GetIdentity(new ScatterSharp.Api.IdentityRequiredFields()
            {
                Accounts = new List <ScatterSharp.Api.Network>()
                {
                    mNetwork
                },
                Location = new List <ScatterSharp.Api.LocationFields>(),
                Personal = new List <ScatterSharp.Api.PersonalFields>()
            });

            string accountName = identity.Accounts[0].Name;

            Form1.tbConsoleQueue.Enqueue("PvP Poker 서버에 " + accountName + " 계정으로 로그인중입니다.");

            var sendPacket = new LoginReqPacket()
            {
                AccountName = accountName
            };

            mAClient.Send(sendPacket);
        }
Exemple #5
0
    public async void PushTransaction()
    {
        try
        {
            var network = new ScatterSharp.Api.Network()
            {
                Blockchain = Scatter.Blockchains.EOSIO,
                Host       = "api.jungle.alohaeos.com",
                Port       = 443,
                Protocol   = "https",
                ChainId    = "038f4b0fc8ff18a4f0842a8f0564611f6e96e8535901dd45e43ac8691a1c4dca"
            };

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

            using (var scatter = new Scatter("UNITY-SCATTER-JUNGLE", 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>()
                });

                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 = "eosio", quantity = "0.0001 EOS", memo = "Unity 3D hello crypto world!" }
                        }
                    }
                });

                print(result);
            }
        }
        catch (Exception ex)
        {
            print(JsonConvert.SerializeObject(ex));
        }
    }
    public async void PushTransaction()
    {
        try
        {
            ScatterSharp.Core.Api.Network network = new ScatterSharp.Core.Api.Network()
            {
                blockchain = ScatterConstants.Blockchains.EOSIO,
                host       = "nodes.eos42.io",
                port       = 443,
                chainId    = "aca376f206b8fc25a6ed44dbdc66547c36c6c33e3a119ffbeaef943642f0e906"
            };

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

            using (var scatter = new Scatter(new ScatterConfigurator()
            {
                AppName = "UNITY-WEBGL-SCATTER",
                Network = network,
                StorageProvider = fileStorage
            }, this))
            {
                await scatter.Connect();

                await scatter.GetIdentity(new IdentityRequiredFields()
                {
                    accounts = new List <ScatterSharp.Core.Api.Network>()
                    {
                        network
                    },
                    location = new List <LocationFields>(),
                    personal = new List <PersonalFields>()
                });

                var eos = new Eos(new EosSharp.Core.EosConfigurator()
                {
                    ChainId      = network.chainId,
                    HttpEndpoint = network.GetHttpEndpoint(),
                    SignProvider = new ScatterSignatureProvider(scatter)
                });

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

                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()
                        {
                            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!" }
                            }
                        }
                    }
                });

                print(result);
            }
        }
        catch (Exception ex)
        {
            print(JsonConvert.SerializeObject(ex));
        }
    }
Exemple #7
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 void PushTransaction()
    {
        try
        {
            ScatterSharp.Core.Api.Network network = new ScatterSharp.Core.Api.Network()
            {
                blockchain = ScatterConstants.Blockchains.EOSIO,
                host       = "jungle3.cryptolions.io",
                port       = 443,
                chainId    = "2a02a0053e5a8cf73a56ba0fda11e4d92e0238a4a2aa74fccf46d5a910746840"
            };

            var fileStorage = new FileStorageProvider(Application.persistentDataPath + "/scatterapp.dat");
            using (var scatter = new Scatter(new ScatterConfigurator()
            {
                AppName = "UNITY-PC-SCATTER",
                Network = network,
                StorageProvider = fileStorage
            }, this))
            {
                await scatter.Connect();

                await scatter.GetIdentity(new IdentityRequiredFields()
                {
                    accounts = new List <ScatterSharp.Core.Api.Network>()
                    {
                        network
                    },
                    location = new List <LocationFields>(),
                    personal = new List <PersonalFields>()
                });

                var eos = new Eos(new EosSharp.Core.EosConfigurator()
                {
                    ChainId      = network.chainId,
                    HttpEndpoint = network.GetHttpEndpoint(),
                    SignProvider = new ScatterSignatureProvider(scatter)
                });

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

                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()
                        {
                            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!" }
                            }
                        }
                    }
                });

                print(result);
            }
        }
        catch (ApiErrorException ex)
        {
            print(JsonConvert.SerializeObject(ex.error));
        }
        catch (ApiException ex)
        {
            print(ex.Content);
        }
        catch (Exception ex)
        {
            print(JsonConvert.SerializeObject(ex));
        }
    }