Blurtopian Dev: @blurtopian/dblurt npm package - 2021/12/31

in blurtopian •  3 years ago 

BANNER_2048x512 _post - MF.png

As mentioned in my previous post, there were a couple of issues I had to resolve to release the initial version of Blurtkey.

My objective/goal for this app is to release its initial version to Google Play. I still have a couple of items I need to resolve before releasing it's initial version. Particularly items #2 and #3 below.

  1. No loading indication after clicking import in the account import > page (no indication or feedback to user that import is processing)
  2. Forever loading icon on wallet page (latest wallet transaction not retrieved)
  3. Wallet operations are not working
    1. Delegate

For this update, I'm sharing how I was able to resolve item #2 above.

Forever loading icon on wallet page (latest wallet transaction not retrieved)

P.S.
We're in a holiday right now, as such, I am able to provide these frequent updates. When holidays are over, my updates will be infrequent.

1. Background

When trying to resolve issues, one of the most important step is diagnosing the problem and identifying the root cause. Because of the cognitive load I had to dedicate to work, I didn't have the capacity to consciously think of ways to troubleshoot and find out the root cause as early as I want.

2. Troubleshooting (aka Debugging)

The first step I had to make was identify the possible lines of codes that was causing the issue. I've already identified beforehand that the problem occurs in the Transactions component. It had to do with fetching the transactions.

Next, I've identified that the problem was happening inside the initAccountTransactions and fetchAccountTransactions actions. The previous change (renaming hive to blurt) helped me in identifying this location. I've identified that getting an account's transactions was happening in the getAccountTransactions method. It had this block of code.

    const transactions = await getClient().database.getAccountHistory(
      accountName,
      start || -1,
      start ? Math.min(10, start) : 1000,
      operationsBitmask,
    );

I've identified that the error was happening in this block of code by placing console logs before and after this block. I enclosed it in a try-catch statement and logged the error.

The enclosing try-catch gave me this following error which gave me the hint as to what was causing the problem.

RPCError: args.size() == 3: Expected #s argument(s), was 5

At first, I was really not sure what the error was saying since I was expecting that the library I was using was working. But eventually, it led to the conclusion that the problem was indeed in the library I was using - dblurt.

3. The Solution

Since I don't have access to the official dblurt library, I cloned the codes from blurt's repo, made my changes there, and published it as a scoped npm package.

This is an important step because time is of the essence when troubleshooting or debugging issues. It's important to not lose momentum.

The interim solution was this block of code:

  public getAccountHistory(
    account: string,
    from: number,
    limit: number,
    operation_bitmask?: [number, number]
  ): Promise<[[number, AppliedOperation]]> {
    let params = [account, from, limit]
    /*
    if (operation_bitmask && Array.isArray(operation_bitmask)) {
      if (operation_bitmask.length !== 2) {
        throw Error(
          'operation_bitmask should be generated by the helper function'
        )
      }
      params = params.concat(operation_bitmask)
    }
    */
    console.log("this.call('get_account_history', params)", params)
    return this.call('get_account_history', params)
  }

I commented out the portion where it adds to the params[] array the operation_bitmask. The error I logged from the previous section gave me the confidence that it will solve the problem since the operation_bitmask is what gets added to the paramaters. params[] has an initial size of 3 (account, from, and limit), but adding operation_bitmask increases the size of the array which resulted to the error.

RPCError: args.size() == 3: Expected #s argument(s), was 5

4. Key Take-aways

Overall, this is how I troubleshoot issues.

  1. Identify which block of code causes the error
  2. Output the specific error that the lines of code output (this is where the importance of libraries spitting out descriptive error messages)
  3. Try out solutions based on the error outputted
  4. Take a break if root cause cannot be immediately identified (taking more than two hours of continuous debugging).

5. Demo

Demo of the transactions loading successfully in the wallet page.

6. Codes

Code changes are available in Blurtopian's repository:

https://gitlab.com/blurtopian/blurtlibs/dblurt

7. NPM Package

https://www.npmjs.com/package/@blurtopian/dblurt

8. Next

My objective/goal for this app is to release its initial version to Google Play. I still have a couple of items I need to resolve before releasing it's initial version. Particularly items #2 and #3 below.

  1. No loading indication after clicking import in the account import page (no indication or feedback to user that import is processing)
  2. Forever loading icon on wallet page (latest wallet transaction not retrieved) (Resolved)
  3. Wallet operations are not working
    1. Delegate

@eastmael's Witness Projects


Find my contributions valuable? Please consider voting for my witness:

https://blurtwallet.com/~witnesses?highlight=eastmael

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE BLURT!
Sort Order:  

Really nice job!
It reflects your dedication to Blurt community.
I always appreciate your works because you do them in a nice way.
Hope your all upcoming jobs and works will occure in pleasing way.
Thanks a lot for this nice update!

  ·  3 years ago  ·  

Hopefully it goes well and can be published on Google Play soon. Amazing job.

  ·  3 years ago  ·  

From what country are you from? It's available in Google Play for open testing.

https://play.google.com/store/apps/details?id=com.blurtkey

  ·  3 years ago  ·  

It seems that it is still not accessible in the territory of Indonesia.
Googleplay.jpg

  ·  3 years ago  ·  

Thanks for the feedback. I've added all countries to open testing. Can you please try again?

  ·  3 years ago  ·  

Already accessible. The description has also been automatically translated into Indonesian. For now I'm trying to access it via a computer, later I'll try with a smartphone. Congratulations, this is a great achievement for Blurt.

Blurtkey3.jpg

Blurtkey2.jpg

BlurtKey1.jpg

Blurtkey.jpg

  ·  3 years ago  ·  

Hello dear sir @eastmeal
You are doing a nice job.
New year has come.
2021 year bye! bye!
Has gone from all us .
And New year 2022 has come.
I most welcome to new .
I wish everyone blurTian!
I hope that everything will be good
in our life.
I congratulate from bottom of my heart.
Thanks!
@firdaus1998

  ·  3 years ago  ·  

I don't know how beautiful the work has been. But i hope it ha been much better. well, do you have google play link? if so ,please give me.

thanks@eastmael

  ·  3 years ago  ·  
  ·  3 years ago  ·  

Maybe the JS version you can release and use with the recovery tool as a solution. I hope you get some more holidays.

good job mr.@eastmael

Congratulations, your post has been curated by @dsc-r2cornell. You can use the tag #R2cornell. Also, find us on Discord

Manually curated by Blessed-girl

image.png

Felicitaciones, su publicación ha sido votada por @ dsc-r2cornell. Puedes usar el tag #R2cornell. También, nos puedes encontrar en Discord