omergoksoy / bitacle

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

bitacle

Bitacle is a ICP Canister(which is not online right now), which made for Dacade's Course.

This contract is used to get the 1 ICP -> BTC currency exchange rate.

Packages Used

  • Ic0
  • Azle
  • @dfinity

Prerequisites

Setup

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash
nvm use 18
DFX_VERSION=0.14.1 sh -ci "$(curl -fsSL https://sdk.dfinity.org/install.sh)"
echo 'export PATH="$PATH:$HOME/bin"' >> "$HOME/.bashrc"

then reload your terminal.

Installation

  1. Clone the repository:

    git clone https://github.com/iamknownasfesal/bitacle.git

  2. Install dependencies:

    DO NOT USE "npm install" or "pnpm i", ONLY USE "yarn".

    cd bitacle-contract
    yarn
    cd bitacle-service
    yarn
    

Testing

  1. Start the Internet Computer emulator:

    dfx start --clean --background

  2. Deploy the canisters:

    cd bitacle-contract
    dfx deploy
    

    click the link on the terminal, should look like this:
    bitacle: http://127.0.0.1:4943/?canisterId=bd3sg-teaaa-aaaaa-qaaba-cai&id=bkyz2-fmaaa-aaaaa-qaaaq-cai

  3. Create a .env file in bitacle-service like .env.example:

    cd bitacle-service
    touch test
    vim test
    

    get your canister id from the given link, it should be on top, and create your .env based on .env.example

  4. Run the service:

    npm run start

  5. There you go!

    Console can logs errors from canister, if it is "Not Found" errors you shouldn't care about these.

  6. You can check rounds from the given dashboard link, look at the section 2

    In dashboard, click to query in bottom of getLatestRound, you should be able to get the latest exchange rate, when it got updated and roundId to query next.

Troubleshooting

That's it! Let me know if you have any questions or need further assistance.

About


Languages

Language:TypeScript 100.0%