Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CosmWasm support for wallet-monitor #93

Open
5 of 22 tasks
PinchiDev opened this issue Aug 15, 2023 · 5 comments
Open
5 of 22 tasks

CosmWasm support for wallet-monitor #93

PinchiDev opened this issue Aug 15, 2023 · 5 comments

Comments

@PinchiDev
Copy link
Contributor

PinchiDev commented Aug 15, 2023

Implementing Support for CosmWasm Blockchains

Introduction

To facilitate the onboarding of future developers and provide a comprehensive guide for this task, I am documenting the step-by-step process that I followed while integrating support for CosmWasm blockchains into the wallet-monitor. Throughout the documentation, I will include comments containing valuable insights and practical information that can assist developers in seamlessly navigating the implementation process.

Project Description

This project aims to implement support for CosmWasm blockchains within Xlabs wallet-monitor library. This library facilitates the monitoring of balances across multiple wallets in various blockchains. In addition, to balance monitoring, the library will export these balances as Prometheus metrics and execute rebalancing strategies between wallets.

Tasks

Get Development Environment in a Working State

  • Install dependencies in /wallet-monitor and /src folders.
  • Compile the TypeScript files using tsc -w.
  • Make sure the build is running correctly npm run build.

Get Testing Logic and Capacities in Place

  • Make a Kepler wallet and use the faucet to obtain some balance.
  • Check the balance in the blockchain explorer for the specific CosmWasm blockchain.

Implement the "CosmWasmWalletToolbox" class

  • Create a new file in src/wallets/cosmwasm and extend the "WalletToolbox" class.
  • modify/create respective validations and methods for the cosmwasm data formats.
  • Implement the connection logic to interact with the respective CosmWasm blockchain.
  • test if the connection with the respective blockchain was successful and the correct values were passed.

Create a new balances file to implement the respective auxiliary functions

  • Create a new file in src/balances/cosmwasm for implementing the auxiliary functions needed.

Implement Logic for Pulling Native Balance

  • Implement the logic for pulling the native balance of the test wallet in the respective CosmWasm blockchain.
  • test pullCosmWasmNativeBalance and compare the balance obtained with the block explorer data.

Implement Logic for Pulling Token Balance

  • Implement the logic for pulling the token balance of the test wallet in the respective CosmWasm blockchain.
  • test pullCosmWasmTokenBalance and compare the balance obtained with the block explorer data.

Implement Logic for Pulling Token Data

  • Implement the logic for pulling token data of a certain token in the respective CosmWasm blockchain.
  • test pullCosmWasmTokenData check the data.

Implement Logic for Getting a Public Address from a private key

  • Implement the logic to transform a private key from a cosmwasm wallet into a public address.
  • test getAdressFromPrivateKey checking the existence of the address in the explorer.

Implement Logic for Transferring Native Balance

  • Implement the logic for transferring native balance between wallets in CosmWasm blockchains.
  • test transferNativeBalance and compare the balances for the respective wallets in the block explorer.

Write Project Wrap-up and Plan Next Steps

  • Document the implementation and achievements.
  • Plan the next steps and potential enhancements.

Contributing

Please feel free to comment on this issue, this is a work in progress from a developer in progress so any contributions are welcome.


The implementation of this project will be pivotal in providing comprehensive support for the emerging technology of CosmWasm blockchains. It will not only facilitate the seamless monitoring of wallet balances but also allow the execution of complex balancing strategies. Feel free to join the development!

@PinchiDev
Copy link
Contributor Author

PinchiDev commented Aug 15, 2023

I didn't find any problems while cloning or installing dependencies but while compiling typescript I am having issues with grpc modules.

image

This is the history of commands I tried and didnt work yet on the specific problem:

212  sudo apt install -y build-essential cmake
213  sudo apt install -y libgrpc-dev
214  sudo apt install -y protobuf-compiler
215  sudo npm install -g grpc
216  node -v
217  npm install -g npm@7
218  sudo npm install -g grpc
219  npx grpc
220  nvm install 14.17.0
221  nvm use 14.17.0
222  sudo npm install -g grpc
223  node -v
224  git clone https://github.com/XLabs/wallet-monitor.git
225  cd wallet-monitor/
226  npm i
227  cd src/
228  npm i
229  tsc -w
230  history

I will research this issue and comment on the cause and solution once found.

@PinchiDev
Copy link
Contributor Author

Following up on the previous issue, iI was missing the npm run build-grpc command. This solved the issue with the grpc modules and now it's building correctly.

Note for the future: The command you are looking for is npm run build-grpc && tsc -w for compiling (the -w stand for watch).

Marking the third task as completed.

@solanoepalacio
Copy link
Collaborator

doesn't npm run build run npm run build-grpc && tsc ?

@PinchiDev
Copy link
Contributor Author

PinchiDev commented Aug 15, 2023

@solanoepalacio That was my first guess, but apparently, it didn't build in that instance. It was only when I explicitly run the mentioned command that it built correctly.

@PinchiDev
Copy link
Contributor Author

It was straightforward for the fourth and fifth bullet points, I created a Kepler wallet in the sei-atalantic2 testnet and used the faucet as described in the documentation: https://docs.sei.io/develop/resources
Here you will find the respective rpc endpoints and useful information about Sei blockchains.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants