public FavoriteTokenTests()
        {
            client = new CleosClient();
            config = JsonConvert.DeserializeObject <Config>(File.ReadAllText("config.json"));
            client.CreateWalletAsync("default", "/home/cleos-net/wallet/wallet.key").Wait();
            client.ImportPrivateKeyToWalletAsync(config.PrivateKey, "default").Wait();
            var builder = new DbContextOptionsBuilder();

            builder.UseMySql(config.MySql);
            db = new KyubeyContext(builder.Options);
        }
Exemple #2
0
        static async Task InitializeOneBox()
        {
            var configFileName = "config";
            var builder        = new ConfigurationBuilder()
                                 .SetBasePath(Directory.GetCurrentDirectory())
                                 .AddJsonFile($"{configFileName}.json")
                                 .AddEnvironmentVariables();
            var config = builder.Build();

            configObject = config.Get <Config>();

            var optionsBuilder = new DbContextOptionsBuilder <KyubeyContext>();

            optionsBuilder.UseMySql(config["MySQL"]);
            dbContext = new KyubeyContext(optionsBuilder.Options);

            client = new CleosClient();
            var createResult = await client.CreateWalletAsync("default", "/home/cleos-net/wallet/wallet.key");

            var privateKey = SecurityTool.Decrypt(config["EncryptText"], config["EncryptKey"]);
            //manual unlock
            //var unlockResult = await client.UnlockWalletAsync(SecurityTool.Decrypt(config["EncryptWalletKey"], config["EncryptKey"]));
            var importResult = await client.ImportPrivateKeyToWalletAsync(privateKey, "default");
        }