PixBee Bot - Not just another HIVE Bot - part4

Words
1700
Reading
8 min
Listen
Play
2y

Wrote in Portuguese and translated to English using GT.


pixbee-ascii-art.png

Hi HiveDevs friends!

PixBee Bot - Not just another HIVE Bot - part1
PixBee Bot - Not just another HIVE Bot - part2
PixBee Bot - Not just another HIVE Bot - part3

In this post I will show how I set up a frontend to show relevant system information to PixBee users.

Choosing Templates

To provide an easy way to check if Pixbee is working and if PIX and HBD tokens are available, we decided to create a frontend.

To do this, we chose a dashboard template and customized it with information that would be relevant to users.

https://www.bootstrapdash.com/demo/corona-free/jquery/template/index.html

After analyzing several dashboard models and templates, we chose one that was aligned with the visual identity we wanted to give to PixBee.

A bit of Cyberpunk with modernity, that was responsive to work on both desktop and mobile and the chosen one was this template called Corona.

We liked the font formatting options, the buttons with or without icons and the colors, tables and graphs with animations.

In addition to being easy to edit and light to load quickly.

Creation of APIs

After defining what data we would display on the frontend, we started creating some APIs to obtain the information that would be displayed on the home page and some other support APIs for specific calculations.

Updating Data

As we are working on the MVP (Minimum Viable Product), I wanted to do something simple but effective, without depending on more complex frameworks.

In the future, I believe that choosing a more modern framework will be necessary to facilitate updates, but for now...

We thought of a way to "create our own framework" using pure JavaScript, where it would be functional to populate the backend data.

To do this, we standardized the types of variables, which could be text, objects and values, where depending on each type of variable, we would use the properties of the HTML components to insert the data into the correct attributes, such as .value, .innerHtml or .style.

This is what the code looked like to get the ApI data and populate it from time to time on the dashboard:

function getPageData() {
  // a elements list that use InnerHtml property
  const elementsInnerHTMLKeys = [
    "proBanner",
    "OurExchangePer",
    "OurExchangeFee",
    "OurRefundPer",
    "HBDBRLChangeIcon",
    "BTCBRLChangeIcon",
    "BTCUSDChangeIcon",
    "HIVEUSDChangeIcon",
    "HIVEBRLChangeIcon",
    "HBDBRLChangePerc",
    "BTCBRLChangePerc",
    "BTCUSDChangePerc",
    "HIVEUSDChangePerc",
    "HIVEBRLChangePerc",
  ];

  fetch("/apidata")
  .then(response => response.json())
  .then(data => {
    // object to store account balance
    var accBalance = new Object();
    // for each variable received, check if its on inner html list
    // or use value property
    // or check for specific variable name to used it as necessary
    for (const [key, value] of Object.entries(data)) {
      var htmlElement = document.getElementById(key);
      if(htmlElement !== null) {
        if (elementsInnerHTMLKeys.includes(key)) {
          htmlElement.innerHTML = value;
          if(key=="proBanner")
            document.querySelector('#bannerClose').addEventListener('click',function(){closeProBanner();});
        } else if(key=="progressDayFly"){
          htmlElement.style.width = value + "%";
        } else {
          htmlElement.innerText = value;

          if(key==="HivePriceBRL")
            accBalance.hivePriceBRL = value;
          else if(key==="HBDPriceBRL")
            accBalance.hbdPriceBRL = value;
          else if(key==="balanceHbd")
            accBalance.hbd = value;
          else if(key==="balancePix")
            accBalance.pix = value;
          else if(key=="balanceHive")
            accBalance.hive = value;
        }
      }
    }
    setAccountsBalance(accBalance);
  })
} 

(function(window, document, undefined) {
  window.onload = init;
  function init(){
    // set an interval to update page. long interval to not consume api and overload server, dont need to be real time (yet)
    setInterval(getPageData, 30*60000);
    getPageData();
  }
})(window, document, undefined);

This way, we found a simple way to add variables to the dashboard, without having to deal with them one by one.

Pages

Thinking about a future, where KYC might be necessary, I also decided to create some other pages, such as:

  • Login,
  • How to use,
  • About,
  • Settings

With some basic information populated on this page, let's focus on the dashboard. Then we come back to improve each of these other pages.

image.pngimage.pngimage.png

Dashboard

Now, when users access the Pixbee website, it is possible to view various system information.

Simulation

image.png

This simulator is a valuable tool for users as it allows them to accurately estimate the amount of tokens they will receive before carrying out a transaction. This helps increase users' trust in the service and ensure a positive experience.

As a next step, I plan to develop a calculator that will allow users to enter how much they want to receive and how much they want to send.

Additionally, I will continue working on updates and improvements for PixBee, always ensuring the best possible experience for users.

Uptime

image.png

Maybe it's not very relevant, but to bring a certain dynamism, we put the time that PixBee is flying... oops, running..., when PixBee is restarted to receive updates the value will be reset.

Liquidit Pool

image.png

To provide an easy way to check if Pix and HBD tokens are available, we have created a chart to display the amount of each token available. This way, the user will be able to know before sending whether the transaction will be complete.

If there is no amount available, the user will be automatically reimbursed in the case of HBD, and in the case of PIX, they will have the option to be reimbursed, or PixBee's role will be to buy HBD and send it to the specified account.

A process that will still be done manually, but over the course of the project I want to automate with a trading bot and a balance account bot.

And this is what our dashboard looked like:

image.png

image.png

image.png

image.png

Real Use Cases

luh-abrao-cryptedd.png

After a series of tests in a test environment, I finally put Pixbee into production in the Beta version and got one more person to test, my friend lucianaabrao@lucianaabrao, she made a withdrawal and found the process very easy to follow and managed to make a direct Pix from the Hive wallet!

The process started by sending Hive, which was not available and she received the refund automatically.

Then she converted HIVE to HBD and did PIX successfully.

image.png

And to test both sides of the process, I made a purchase to ensure that everything is working correctly and guarantee PIX liquidity in the service.

Then it was shiftrox@shiftrox's turn, who again tested and approved the service.

image.png

Images and Logo

PixBee's images and logo were made with the help of artificial intelligence, where after several prompts and attempts, we got something we liked.

LogoMini LogoAvatar
logo.pnglogo-mini.pngpixbee.jpeg

And did you like it?
https://aphid-glowing-fish.ngrok-free.app/





Vers茫o Brasileira

Ol谩 amigos HiveDevs!

PixBee Bot - Not just another HIVE Bot - part1
PixBee Bot - Not just another HIVE Bot - part1
PixBee Bot - Not just another HIVE Bot - part3

Nesse post vou mostrar como montei um frontend para mostrar informa莽玫es relevantes do sistema para os usu谩rios PixBee.

Escolhendo Modelos

Para fornecer uma forma f谩cil de verificar se a Pixbee est谩 funcionando e se h谩 tokens PIX e HBD dispon铆veis, decidimos criar um frontend.

Para isso, escolhemos um template de dashboard e personalizamos com informa莽玫es que seriam relevantes para os usu谩rios.

https://www.bootstrapdash.com/demo/corona-free/jquery/template/index.html

Depois de analisar diversos modelos e templates de dashboard, escolhemos um que estava alinhado com identidade visual que quer铆amos dar para PixBee.

Um pouco de Cyberpunk com modernidade, que fosse responsivo para funcionar tanto em desktop quanto em mobile e o escolhido foi esse template de nome Corona.

Gostamos das op莽玫es de formata莽茫o de fonte, dos botoes com ou sem 铆cones e as cores, tabelas e gr谩ficos com anima莽玫es.

Alem de ser f谩cil de editar e leve para carregar r谩pido.

Cria莽茫o das APIs

Depois de definir quais dados iriamos exibir no frontend, partimos para a cria莽茫o de algumas APIs para obter as informa莽玫es que seriam exibidas na pagina inicial e algumas outras APIs de suporte para c谩lculos espec铆ficos.

Atualizando Dados

Como estamos trabalhando no MVP (Produto M铆nimo Vi谩vel), queria fazer algo simples mas eficaz, sem depender de frameworks mais complexos.

No futuro, creio que a escolha de um framework mais moderno sera necess谩rio para facilitar os updates, mas por hora...

Pensamos em uma forma de "criar nosso pr贸prio framework" usando JavaScript puro, onde fosse funcional para popular os dados do backend.

Para isso, padronizamos os tipos de vari谩veis, podendo ser texto, objetos e valores, onde dependendo de cada tipo de vari谩vel, iria usar as propriedades dos componentes HTML para inserir os dados nos atributos corretos, como .value, .innerHtml ou .style.

Essa foi assim que ficou o c贸digo para pegar os dados da ApI e popular de tempo em tempo no dashboard:

function getPageData() {
  // a elements list that use InnerHtml property
  const elementsInnerHTMLKeys = [
    "proBanner",
    "OurExchangePer",
    "OurExchangeFee",
    "OurRefundPer",
    "HBDBRLChangeIcon",
    "BTCBRLChangeIcon",
    "BTCUSDChangeIcon",
    "HIVEUSDChangeIcon",
    "HIVEBRLChangeIcon",
    "HBDBRLChangePerc",
    "BTCBRLChangePerc",
    "BTCUSDChangePerc",
    "HIVEUSDChangePerc",
    "HIVEBRLChangePerc",
  ];

  fetch("/apidata")
  .then(response => response.json())
  .then(data => {
    // object to store account balance
    var accBalance = new Object();
    // for each variable received, check if its on inner html list
    // or use value property
    // or check for specific variable name to used it as necessary
    for (const [key, value] of Object.entries(data)) {
      var htmlElement = document.getElementById(key);
      if(htmlElement !== null) {
        if (elementsInnerHTMLKeys.includes(key)) {
          htmlElement.innerHTML = value;
          if(key=="proBanner")
            document.querySelector('#bannerClose').addEventListener('click',function(){closeProBanner();});
        } else if(key=="progressDayFly"){
          htmlElement.style.width = value + "%";
        } else {
          htmlElement.innerText = value;

          if(key==="HivePriceBRL")
            accBalance.hivePriceBRL = value;
          else if(key==="HBDPriceBRL")
            accBalance.hbdPriceBRL = value;
          else if(key==="balanceHbd")
            accBalance.hbd = value;
          else if(key==="balancePix")
            accBalance.pix = value;
          else if(key=="balanceHive")
            accBalance.hive = value;
        }
      }
    }
    setAccountsBalance(accBalance);
  })
} 

(function(window, document, undefined) {
  window.onload = init;
  function init(){
    // set an interval to update page. long interval to not consume api and overload server, dont need to be real time (yet)
    setInterval(getPageData, 30*60000);
    getPageData();
  }
})(window, document, undefined);

Dessa forma, encontramos uma maneira simples de adicionar vari谩veis no dashboard, sem ter que tratar uma a uma.

Paginas

Pensando em um futuro, onde talvez um KYC seja necess谩rio, resolvi tamb茅m criar algumas outras paginas, como:

  • Login,
  • Como Usar,
  • Sobre,
  • Configura莽玫es

Com algumas informa莽玫es b谩sicas populadas em casa uma dessa pagina, vamos focar no dashboard. Depois voltamos para melhorar cada uma dessas outras paginas.

image.pngimage.pngimage.png

Dashboard

Agora, quando os usu谩rios acessarem o site Pixbee, 茅 poss铆vel visualizar diversas informa莽玫es do sistema.

Simula莽茫o

image.png

Esse simulador 茅 uma ferramenta valiosa para os usu谩rios, pois lhes permite estimar com precis茫o a quantidade de tokens que receber茫o antes de realizar uma transa莽茫o. Isso ajuda a aumentar a confian莽a dos usu谩rios no servi莽o e a garantir uma experi锚ncia positiva.

Como pr贸ximo passo, planejo desenvolver uma calculadora que permitir谩 aos usu谩rios informar quanto desejam receber e quanto desejam enviar.

Al茅m disso, continuarei trabalhando em atualiza莽玫es e melhorias para o PixBee, garantindo sempre a melhor experi锚ncia poss铆vel para os usu谩rios.

Uptime

image.png

Talvez n茫o seja muito relevante, mas para trazer um certo dinamismo, colocamos o tempo que PixBee esta voando... ops, rodando..., quando a PixBee for reiniciada para receber atualiza莽玫es o valor sera reiniciado.

Liquidit Pool

image.png

Para fornecer uma forma f谩cil de verificar se h谩 tokens Pix e HBD dispon铆veis, criamos um gr谩fico para exibir a quantidade de cada token dispon铆vel. Dessa forma, o usu谩rio poder谩 saber antes de enviar se a transa莽茫o sera completa.

Caso n茫o tenha valor dispon铆vel, o usu谩rio sera reembolsado automaticamente em caso de HBD, e em caso de PIX, ter谩 a op莽茫o de ser reembolsado, ou a fun莽茫o da PixBee sera de comprar HBD e enviar para a conta especificada.

Um processo que ainda sera feito manualmente, mas que com o tempo do projeto desejo automatizar com um trading bot e com um balance account bot.

E assim ficou nosso dashboard:

image.png

image.png

image.png

image.png

Casos Reais de Uso

luh-abrao-cryptedd.png

Ap贸s uma s茅rie de testes em ambiente de teste, finalmente coloquei a Pixbee em produ莽茫o na vers茫o Beta e consegui mais uma pessoa pra testar, minha amiga lucianaabrao, ela fez um saque e achou o processo bem f谩cil de seguir e conseguiu fazer um Pix direto da carteira Hive!

O processo comecou enviando Hive, o que nao estava disponivel e ela recebeu o remebolso automaticamente.

Depois ela converteu HIVE em HBD e fez PIX com sucesso.

image.png

E para testar ambos lados do processo, fiz uma compra para garantir que tudo est谩 funcionando corretamente e garantir a liquidez de PIX no servi莽o.

Depois foi a vez do shiftrox, que novamente testou e aprovou o servi莽o.

image.png

Imagens e Logo

As imagens e logo da PixBee foram feitas com o Auxilio da Inteligencia artificial, onde que depois de diversos prompts e tentativas, obtivemos algo que gostamos.

LogoMini LogoAvatar
logo.pnglogo-mini.pngpixbee.jpeg

E voc锚s gostaram?
https://aphid-glowing-fish.ngrok-free.app/


PixBee Bot - Not just another HIVE Bot - part4 | Ecency