shitcoin_price 0.0.7+1 copy "shitcoin_price: ^0.0.7+1" to clipboard
shitcoin_price: ^0.0.7+1 copied to clipboard

Package to get the price of a token based on the liquidity pool.

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 BUSD 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';
httpClient = Client();
clientProvider = Web3Client(rpc, httpClient!);
final priceDouble = await ShitCoinPrice().asDouble(clientProvider, routerAddress, token0, token1);
print(priceDouble); // 2.688667399210412 CAKE

Or

String rpc = 'https://bsc-dataseed1.binance.org/';
String router = '0x10ed43c718714eb63d5aa57b78b54704e256024e';
String token0 = '0x0e09fabb73bd3ade0a17ecc321fd13a19e81ce82';
String token1 = '0xe9e7cea3dedca5984780bafc599bd69add087d56';
httpClient = Client();
clientProvider = Web3Client(rpc, httpClient!);
final priceBigInt = await ShitCoinPrice().asBigInt(clientProvider, routerAddress, token0, token1);
print(priceBigInt); // 2688667399210411713 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.
  • token: The address of the contract of the token that we want to consult the price.

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. ⚡

2
likes
120
pub points
0%
popularity

Publisher

unverified uploader

Package to get the price of a token based on the liquidity pool.

Repository (GitHub)
View/report issues

Documentation

API reference

License

AGPL-3.0 (license)

Dependencies

flutter, http, web3dart

More

Packages that depend on shitcoin_price