public async Task <TransferPage> CreateTransferPage(BlockchainClient client, String pid)
        {
            TransferPage package = new TransferPage(client, pid);
            await package.getLocation();

            return(package);
        }
示例#2
0
        public static string DoSignVTHOTx(List <string[]> transactions, string privateKey, bool isSend, int?gasLimit)
        {
            byte chainTag = 0;

            byte[] blockRef = null;

            var clauses = new List <ToClause>();

            foreach (var transaction in transactions)
            {
                var amount = Amount.VTHO();
                amount.SetDecimalAmount(transaction[1]);
                clauses.Add(
                    ERC20Contract.BuildTranferToClause(ERC20Token.VTHO, Address.FromHexString(transaction[0]), amount));
                chainTag = ByteUtils.ToByteArray(transaction[2])[0];
                blockRef = transaction[3] == null?BlockchainClient.GetBlockRef(null).ToByteArray() : ByteUtils.ToByteArray(transaction[3]);
            }
            int gas            = clauses.Count * gasLimit ?? 80000;
            var rawTransaction = RawTransactionFactory.Instance.CreateRawTransaction(chainTag, blockRef,
                                                                                     720, gas, (byte)0x0, CryptoUtils.GenerateTxNonce(), clauses.ToArray());

            if (isSend)
            {
                var result = TransactionClient.SignThenTransfer(rawTransaction, ECKeyPair.Create(privateKey));
                return(JsonConvert.SerializeObject(result));
            }
            else
            {
                var result = TransactionClient.Sign(rawTransaction, ECKeyPair.Create(privateKey));
                return(ByteUtils.ToHexString(result.Encode(), Prefix.ZeroLowerX));
            }
        }
        public static void GetChainTag()
        {
            byte   chainTagByte = BlockchainClient.GetChainTag();
            string chainTag     = string.Format("%02x", chainTagByte);

            WriteLine("ChainTag:");
            WriteLine("0x" + chainTag);
        }
        public TransferPage(BlockchainClient client, String pid)
        {
            this.client = client;

            InitializeComponent();
            propertyId.Text = pid;

            NavigationPage.SetHasNavigationBar(this, false);
        }
 public void init()
 {
     mockBlockService = new Mock <IBlockchainService>();
     clientWithMock   = new BlockchainClient(mockBlockService.Object);
     user             = new User()
     {
         username = "******"
     };
 }
        void updateAssetList(BlockchainClient localClient)
        {
            properties.Clear();
            var props = Task.Run(() => localClient.GetMyProperties()).Result;

            foreach (Property obj in props)
            {
                properties.Add(obj);
            }
        }
        void UpdateTransactionList(BlockchainClient localClient)
        {
            transactions.Clear();
            var Results = Task.Run(() => localClient.GetUserTransactions()).Result;

            foreach (var transaction in Results)
            {
                transactions.Add(transaction);
            }
        }
示例#8
0
        void UpdatePackageList(BlockchainClient localClient)
        {
            packagesOwn.Clear();
            var packages = Task.Run(() => localClient.GetMyPackages()).Result;

            foreach (var package in packages)
            {
                packagesOwn.Add(package);
            }
        }
示例#9
0
 public HistoryDetailPage(CreatePackage package, BlockchainClient client)
 {
     this.client  = client;
     this.package = package;
     InitializeComponent();
     NavigationPage.SetHasNavigationBar(this, false);
     BindingContext = package;
     recipient.Text = package.recipient.Substring(35);
     sender.Text    = package.sender.Substring(35);
     propertyListView.ItemsSource = GetProperties(package).Split(new char[] { ',' });
 }
        public HistoryPage(BlockchainClient client)
        {
            this.client  = client;
            transactions = new ObservableCollection <CreatePackage>();

            NavigationPage.SetHasNavigationBar(this, false);
            InitializeComponent();

            UpdateTransactionList(client);
            listView.ItemsSource = transactions;
        }
示例#11
0
        public PackagesPage(BlockchainClient client)
        {
            this.client = client;
            packagesOwn = new ObservableCollection <Package>();

            InitializeComponent();
            NavigationPage.SetHasNavigationBar(this, false);

            UpdatePackageList(client);
            listView.ItemsSource = packagesOwn;
        }
示例#12
0
        public async Task <ActionResult <string> > Post(IFormFile file)
        {
            var impl    = new FingerPrintImpl();
            var chain   = new BlockchainClient();
            var content = file.OpenReadStream();

            var signature = impl.DoFingerPrint(content);
            await chain.CreateToken(signature);

            return(signature);
        }
        public UserPage(BlockchainClient client)
        {
            this.client = client;
            properties  = new ObservableCollection <Property>();

            InitializeComponent();
            NavigationPage.SetHasNavigationBar(this, false);

            updateAssetList(client);
            current_asset_list.ItemsSource = properties;
        }
        public WelcomePage(BlockchainClient client)
        {
            if (client == null)
            {
                throw new ArgumentException();
            }

            BindingContext = client.thisTrader;
            this.client    = client;
            properties     = new ObservableCollection <Property>();
            InitializeComponent();
            updateAssetList(client);
        }
        public CreatePackagePage(BlockchainClient client, List <Property> props)
        {
            this.client      = client;
            SelectedDataList = new ObservableCollection <SelectedData <Property> >();

            props.ForEach(prop => SelectedDataList.Add(new SelectedData <Property>()
            {
                data = prop, selected = false
            }));
            InitializeComponent();

            NavigationPage.SetHasNavigationBar(this, false);
            property_list.ItemsSource = SelectedDataList;
        }
示例#16
0
        public TabbedPage1(BlockchainClient client)
        {
            InitializeComponent();
            this.Title = String.Format("Hello, {0}!", client.thisTrader.fullName);
            NavigationPage.SetHasNavigationBar(this, false);


            var userPage     = new NavigationPage(new UserPage(client));
            var packagesPage = new NavigationPage(new PackagesPage(client));
            var historyPage  = new NavigationPage(new HistoryPage(client));

            userPage.Title     = "My Properties";
            packagesPage.Title = "My Packages";
            historyPage.Title  = "My History";


            InitializeComponent();
            Children.Add(userPage);
            Children.Add(packagesPage);
            Children.Add(historyPage);
        }
示例#17
0
 public HomeController(IOptions <BlockchainClient> blockchainClient_)
 {
     _blockchainClient = blockchainClient_.Value;
 }
示例#18
0
 public RegisterPropertyPage(BlockchainClient blockchainclient)
 {
     InitializeComponent();
     NavigationPage.SetHasNavigationBar(this, false);
     client = blockchainclient;
 }
 public SendEmailPage(BlockchainClient client, String pid)
 {
     this.client = client;
     packageId   = pid;
     InitializeComponent();
 }
示例#20
0
 public RegisterPage(BlockchainClient client)
 {
     this.client = client;
     InitializeComponent();
     NavigationPage.SetHasNavigationBar(this, false);
 }
 public BlockchainController(IWalletService walletService)
 {
     _blockchainClient = new BlockchainClient();
     _walletService    = walletService;
 }
示例#22
0
 public TransferController(IBlockchainService service)
 {
     client = new BlockchainClient(service);
 }
示例#23
0
 public MainPage(IBlockchainService bcservice)
 {
     client = new BlockchainClient(bcservice);
     InitializeComponent();
     NavigationPage.SetHasNavigationBar(this, false);
 }