Code Monkey home page Code Monkey logo

algorand-coding-challenges-4's Introduction

๐ŸŽฎ Algorand Coding Challenge: Fix The Bug ๐Ÿž!

๐Ÿšฉ Challenge 4: How Do I Atomically Send 2 Payment Transactions? ๐Ÿค”

I want to group 2 payment transactions using Algorand's atomic transfers feature but it's not working!

Inside of index.ts file, there is code that is trying to atomically group 2 payment transactions and synchronously send them using atomic transfers. The code is using the Algorand JavaScript SDK and the AlgoKit Utils TypeScript.

However, if you try to run the index.ts file after going into the challenge directory, opening Docker Desktop, and then running:

algokit bootstrap all
algokit localnet start
npm run start

it will fail and show this error: TypeError: signer is not a function

Find out what is wrong and fix the bug.

๐Ÿ’ฌ Meet other hackers working on this challenge and get help in the General Dev Discord Channel!

Checkpoint 1: ๐Ÿงฐ Prerequisites

  1. Install AlgoKit.
  2. Install Docker. It is used to run a local Algorand network for development.
  3. Install Node.JS / npm

Checkpoint 2: ๐Ÿ’ป Set up your development environment

  1. Fork this repository.
  2. Clone the repository
cd [DIRECTORY_OF_YOUR_CHOICE]
git clone [FORKED_REPO_URL]
  1. Open the cloned repository with the code editor of your choosing.
  2. Setup Dev environment using AlgoKit. Run the below command inside of the challenge folder.
algokit bootstrap all

This command will install all dependencies and also generate a .env file for you.

Video walkthrough of forking and cloning this repository:

fork-clone-tutorial.mp4

Now you are ready to fix the bug!

Checkpoint 3: ๐Ÿž Fix the bug ๐Ÿง

  1. Open Docker Desktop and launch Algorand localnet by running algokit localnet start in your terminal For more info click me!.
  2. Go to ./index.ts and read the comments on the file and fix the bug!
  3. After fixing the bug run the below command inside of the challenge folder:
npm run start
  1. If you see: The first payment transaction sent 1000000 microAlgos and the second payment transaction sent 2000000 microAlgos in the console, you successfully fixed the bug! ๐Ÿ˜†

References

๐Ÿ˜ฐ Are you struggling?

atc.addTransaction() takes in a transactionWithSigner object as the parameter. You can get the signer of an account using the makeBasicAccountTransactionSigner function from the Algorand JavaScript SDK.

Checkpoint 4: ๐Ÿ’ฏ Submit your answer

  1. After fixing the bug, push your code to your forked Github repo and make a PR to the original repo.
  2. Inside the PR include:
    1. What was the problem?
    2. How did you solve the problem?
    3. Screenshot of your terminal showing the result of running index.ts file.

Checkpoint 5: ๐Ÿ† Claim your certificate of completion NFT! ๐ŸŽ“

The Algorand Developer Relations team will review the submission and "approve" the PR by labeling it Approved. Once it's approved, we will share the magic link to claim your certificate of completion NFT in the comment of the PR!

The certificate of completion NFT is a verifiable credential minted on the GoPlausible platform that follows the W3C standard for certificates and OpenBadges standard for badges.

๐ŸŽ‰ Congratulations on completing the challenge Algodev! This was the final challenge of the 1st season of #AlgoCodingChallenge. Be on the lookout for the 2nd season of #AlgoCodingChallenge!

algorand-coding-challenges-4's People

Contributors

iskysun96 avatar hongthaipham avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.