GithubHelp home page GithubHelp logo

zagmi / shitcoin_price Goto Github PK

View Code? Open in Web Editor NEW
7.0 2.0 1.0 58 KB

Package to get the price of some token based on the liquidity pool. ๐Ÿ“‰

Home Page: https://pub.dev/packages/shitcoin_price

License: GNU Affero General Public License v3.0

Dart 100.00%
cryptocurrency ethereum flutter pancakeswap polygon sushiswap uniswap binance-smart-chain

shitcoin_price's Introduction

Package Info

This package uses the pool contract of each router & different cryptocurrency exchange platforms to take the price of any token even if it's not verified, it's free and without any kind of api key or registration required. ๐Ÿ˜Ž

Features

Get the price in his token pair of any token on the Ethereum network and its subnets such as Binance Smart Chain, Polygon and others more.

Getting Started

Add the package to your pubspec.yaml file as shown below.

dependencies:

  shitcoin_price: any

Then import the package into your code like this.

import 'package:shitcoin_price/shitcoin_price.dart';

Usage

You can call the function and give it the parameters it wants to query, for example:

  String rpc = 'https://bsc-dataseed1.binance.org/';
  String router = '0x10ed43c718714eb63d5aa57b78b54704e256024e';
  String token0 = '0x0e09fabb73bd3ade0a17ecc321fd13a19e81ce82';
  String token1 = '0xe9e7cea3dedca5984780bafc599bd69add087d56';
  final httpClient = Client();
  final provider = Web3Client(rpc, httpClient);
  final priceDouble = await ShitCoinPrice().asDouble(provider, router, token0, token1);
  print(priceDouble); // 1.7973780251387401 CAKE

Or

String rpc = 'https://bsc-dataseed1.binance.org/';
String router = '0x10ed43c718714eb63d5aa57b78b54704e256024e';
String token0 = '0x0e09fabb73bd3ade0a17ecc321fd13a19e81ce82';
String token1 = '0xe9e7cea3dedca5984780bafc599bd69add087d56';
final httpClient = Client();
final provider = Web3Client(rpc, httpClient);
final priceBigInt = await ShitCoinPrice().asBigInt(provider, router, token0, token1);
print(priceBigInt); // 1797378025138740195 CAKE

In this example we import the package function and use it to get the price of a token, in this case CAKE and it returns a double or bigint number depending on how you handle the logic of the function.

  • rpc: The rpc url on the network that we want to query.
  • router: The address of the router, Uniswap, Pancakeswap, SushiSwap, or other.
  • token0: The address of the contract of the token that we want to consult the price.
  • token1: The address of the contract of the token pair that we want to consult.

NOTE: Check the test folder for an example implementation.

Additional Information

This package will be updated and added more features and utilities related to free price queries and market capitalization data, feel free to contribute!

Greetings. โšก

shitcoin_price's People

Contributors

kreme18 avatar santiirepair avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

kreme18

shitcoin_price's Issues

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.