[Development - The Magic Frog] - Added Wallet and Fund Transfer feature

in #utopian-io6 years ago (edited)

Repository

https://github.com/mktcode/the-magic-frog

The Magic Frog is a unique platform which facilitates collaborative storytelling and rewards authors for their contribution to the story line using community consensus. It uses the Steem blockchain under the hood to generate rewards.

New Features

As part of the task request, We needed to show User's Account Balance and Recent transactions On a separate Page. For this I had to move the then Present User Modal Into a full route Page, and Stream transaction data from the Steem blockchain.

  • User Wallet Balance
    To Add the user wallet route, I added the route link to Authenticated Navbar Component, like this
<li class="nav-item"><nuxt-link to="/wallet" class="nav-link">{{ $t('nav.wallet') }}</nuxt-link></li>

And then created the Wallet Page in the Pages directory, which will be rendered when user navigates to the wallet route, as found in this commit .
Now I had to retrieve the User Wallet Balance and Show in the AccountBalance component. For this I used sc2.me() method which returns the required data as Follows :

    login() {
      this.sc2.me((err, user) => {
        if (err) {
          console.log(err);
        } else {
          this.user = user;
        }
      });
  • Displaying Transfer History
    To display the transfer history, I retrieved the users transactions using SteemJs and filtered them to get only transfers. and store them in a local array. Then I displayed them In a dynamic table using v-for attribute from Vue.JS. Here is I filtered transactions as from this commit:
  const getTransfers = function (account) {
         return new Promise((resolve, reject) => {
           steem.api.getAccountHistory(account,-1,1000, (err, res) => {
             if (!err) {
               res = res.filter( tx => tx[1].op[0] ==="transfer" )
               res= res.reverse();
               resolve(res);
            } else {
               reject(err);
             }
           });
         });
       };
  • Fund Transfer Feature
    To add the Fund transfer feature, I created a transfer Modal, which will take transfer details from the user and generate a hot signing link for transfer with Steemconnect. The url looks like
 transferUrl: function(){  
 return "https://v2.steemconnect.com/sign/transfer?to="+this.reciever+"&amount="+this.amount+"%20"+this.currency+"&memo="+this.memo;
}

After this basic set up, @mkt did a great job completing the wallet and transfer features and making the front end look like what it looks like today. You can see the screenshots below or visit The-Magic-Frog. You can also check out @mkt's post about development update.

Screen Shots

  • Account Balance
    Screenshot from 2018-06-11 13-31-52.png

  • Transfer History
    Screenshot from 2018-06-11 14-07-37.png

Merged PR

GitHub Account

https://github.com/aneilpatel05

Sort:  

Thanks for getting things started and providing the basis! It was rather easy for me to build on top of that. I've just sent you the reward we agreed on! :)

Thanks @mkt for the kind gesture :) Looking forward to help you again in future.

PS You already made my day :P

Great to hear! Have a good one! ;)

Thanks for the contribution, @aneilpatel! Very cool that you helped out with a task request, keep up the good work!

Your contribution has been evaluated according to Utopian policies and guidelines, as well as a predefined set of questions pertaining to the category.

To view those questions and the relevant answers related to your post, click here.


Need help? Write a ticket on https://support.utopian.io/.
Chat with us on Discord.
[utopian-moderator]

Hey @aneilpatel
Thanks for contributing on Utopian.
We’re already looking forward to your next contribution!

Contributing on Utopian
Learn how to contribute on our website or by watching this tutorial on Youtube.

Want to chat? Join us on Discord https://discord.gg/h52nFrV.

Vote for Utopian Witness!

Coin Marketplace

STEEM 0.30
TRX 0.12
JST 0.034
BTC 63960.62
ETH 3142.95
USDT 1.00
SBD 3.95