crypull 1.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -28,6 +28,7 @@
28
28
  - [6. Global Market Data (`market`)](#6-global-market-overview)
29
29
  - [7. Ethereum Gas Tracker (`gas`)](#7-ethereum-gas-tracker)
30
30
  - [8. Fear & Greed Index (`sentiment`)](#8-fear--greed-index)
31
+ - [9. Donate / Support (`donate`)](#9-donate--support)
31
32
  - [🛠️ Usage in Your Project (TypeScript / Node.js)](#%EF%B8%8F-usage-in-your-project-typescript--nodejs)
32
33
  - [1. Import and Initialize](#1-import-and-initialize)
33
34
  - [2. Available API Methods](#2-available-api-methods)
@@ -118,6 +119,12 @@ Check current market sentiment (e.g., Extreme Fear vs. Extreme Greed).
118
119
  $ crypull sentiment
119
120
  ```
120
121
 
122
+ ### 9. Donate / Support
123
+ Show donation addresses to support development.
124
+ ```bash
125
+ $ crypull donate
126
+ ```
127
+
121
128
  ---
122
129
 
123
130
  ## 🛠️ Usage in Your Project (TypeScript / Node.js)
@@ -203,6 +210,17 @@ Crypull queries data from the following platforms. It handles all rate-limits gr
203
210
 
204
211
  ---
205
212
 
213
+ ## 💖 Donate
214
+
215
+ If you find this project useful, consider supporting the development!
216
+
217
+ - **BTC:** `bc1qj4zt3lva4r68xspayg0p8s4hyg40nhjz8fuhqq`
218
+ - **EVM (All Chains):** `0x63a875d0c4Dad8E18B95D844caE6FF915dF0a2BD`
219
+ - **Solana:** `8J5VvZu6ayQa4XnSAAzx4YX3QsXYyyNrP4Zr7JEx1KFY`
220
+ - **TRX:** `TPgZSrHUhKdjyMwaGd15utJvsbk85oBbit`
221
+
222
+ ---
223
+
206
224
  <div align="center">
207
225
 
208
226
  **Built with ❤️ for Web3 Developers by [Md Foisal Islam](https://github.com/Foisalislambd)**
package/dist/cli.js CHANGED
@@ -4,6 +4,7 @@
4
4
  var commander = require('commander');
5
5
  var pc = require('picocolors');
6
6
  var asciichart = require('asciichart');
7
+ var prompts = require('@clack/prompts');
7
8
 
8
9
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
9
10
 
@@ -677,7 +678,7 @@ var Crypull = class {
677
678
  */
678
679
  async gas() {
679
680
  try {
680
- const res = await fetch(`https://api.etherscan.io/api?module=gastracker&action=gasoracle`);
681
+ const res = await fetch(`https://api.etherscan.io/v2/api?chainid=1&module=gastracker&action=gasoracle`);
681
682
  if (!res.ok) return null;
682
683
  const data = await res.json();
683
684
  if (data.status !== "1") return null;
@@ -725,11 +726,9 @@ var Crypull = class {
725
726
 
726
727
  // src/index.ts
727
728
  var crypull = new Crypull();
728
-
729
- // src/cli.ts
730
729
  var program = new commander.Command();
731
- program.name("crypull").description("A human-friendly CLI to fetch crypto prices and info from multiple providers").version("1.0.0");
732
- program.command("price <query>").description("Get the current price of a cryptocurrency (symbol or contract address)").action(async (query) => {
730
+ program.name("crypull").description("A human-friendly CLI to fetch crypto prices and info from multiple providers").version("1.0.1");
731
+ var handlePrice = async (query) => {
733
732
  console.log(pc__default.default.cyan(`
734
733
  Fetching price for ${pc__default.default.bold(query)}...`));
735
734
  const data = await crypull.price(query);
@@ -746,8 +745,8 @@ Fetching price for ${pc__default.default.bold(query)}...`));
746
745
  console.log(`${pc__default.default.gray("Updated:")} ${new Date(data.lastUpdated).toLocaleTimeString()}`);
747
746
  console.log(pc__default.default.white(`----------------------------------------
748
747
  `));
749
- });
750
- program.command("info <query>").description("Get detailed info about a cryptocurrency (market cap, volume, FDV, etc.)").action(async (query) => {
748
+ };
749
+ var handleInfo = async (query) => {
751
750
  console.log(pc__default.default.cyan(`
752
751
  Fetching detailed info for ${pc__default.default.bold(query)}...`));
753
752
  const data = await crypull.info(query);
@@ -834,8 +833,8 @@ Fetching detailed info for ${pc__default.default.bold(query)}...`));
834
833
  console.log(`${pc__default.default.gray("Updated:")} ${new Date(data.lastUpdated).toLocaleTimeString()}`);
835
834
  console.log(pc__default.default.white(`----------------------------------------
836
835
  `));
837
- });
838
- program.command("top").description("Show top 50 cryptocurrencies by market cap").action(async () => {
836
+ };
837
+ var handleTop = async () => {
839
838
  console.log(pc__default.default.cyan(`
840
839
  Fetching top 50 cryptocurrencies...`));
841
840
  const results = await crypull.top();
@@ -859,8 +858,8 @@ Fetching top 50 cryptocurrencies...`));
859
858
  });
860
859
  console.log(pc__default.default.white(`----------------------------------------
861
860
  `));
862
- });
863
- program.command("search <query>").description("Search for tokens or coins across multiple providers").action(async (query) => {
861
+ };
862
+ var handleSearch = async (query) => {
864
863
  console.log(pc__default.default.cyan(`
865
864
  Searching for ${pc__default.default.bold(query)}...`));
866
865
  const results = await crypull.search(query);
@@ -883,8 +882,8 @@ Searching for ${pc__default.default.bold(query)}...`));
883
882
  });
884
883
  console.log(pc__default.default.white(`----------------------------------------
885
884
  `));
886
- });
887
- program.command("trending").description("Show top 10 trending coins/tokens right now").action(async () => {
885
+ };
886
+ var handleTrending = async () => {
888
887
  console.log(pc__default.default.cyan(`
889
888
  Fetching top trending coins...`));
890
889
  const results = await crypull.trending();
@@ -908,8 +907,8 @@ Fetching top trending coins...`));
908
907
  });
909
908
  console.log(pc__default.default.white(`----------------------------------------
910
909
  `));
911
- });
912
- program.command("market").description("Show global cryptocurrency market overview").action(async () => {
910
+ };
911
+ var handleMarket = async () => {
913
912
  console.log(pc__default.default.cyan(`
914
913
  Fetching global market data...`));
915
914
  const data = await crypull.market();
@@ -930,8 +929,8 @@ Fetching global market data...`));
930
929
  console.log(`${pc__default.default.gray("Updated:")} ${new Date(data.lastUpdated).toLocaleTimeString()}`);
931
930
  console.log(pc__default.default.white(`----------------------------------------
932
931
  `));
933
- });
934
- program.command("sentiment").description("Show current Crypto Fear & Greed Index").action(async () => {
932
+ };
933
+ var handleSentiment = async () => {
935
934
  console.log(pc__default.default.cyan(`
936
935
  Fetching Fear & Greed Index...`));
937
936
  const data = await crypull.sentiment();
@@ -954,8 +953,8 @@ Fetching Fear & Greed Index...`));
954
953
  console.log(`${pc__default.default.gray("Classification:")} ${color(pc__default.default.bold(data.classification))}`);
955
954
  console.log(pc__default.default.white(`----------------------------------------
956
955
  `));
957
- });
958
- program.command("gas").description("Show current Ethereum network gas prices").action(async () => {
956
+ };
957
+ var handleGas = async () => {
959
958
  console.log(pc__default.default.cyan(`
960
959
  Fetching network gas prices...`));
961
960
  const data = await crypull.gas();
@@ -975,8 +974,8 @@ Fetching network gas prices...`));
975
974
  }
976
975
  console.log(pc__default.default.white(`----------------------------------------
977
976
  `));
978
- });
979
- program.command("chart <query>").description("Draw a terminal ASCII chart of historical prices").option("-d, --days <days>", "Number of days to chart", "7").action(async (query, options) => {
977
+ };
978
+ var handleChart = async (query, options) => {
980
979
  const days = parseInt(options.days) || 7;
981
980
  console.log(pc__default.default.cyan(`
982
981
  Fetching ${days}-day chart data for ${pc__default.default.bold(query)}...`));
@@ -999,7 +998,97 @@ Fetching ${days}-day chart data for ${pc__default.default.bold(query)}...`));
999
998
  console.log(pc__default.default.white(`
1000
999
  ` + asciichart__namespace.plot(data.prices, chartConfig) + `
1001
1000
  `));
1002
- });
1003
- program.parse(process.argv);
1001
+ };
1002
+ var handleDonate = () => {
1003
+ console.log(pc__default.default.cyan(`
1004
+ \u{1F496} Support the development of crypull:`));
1005
+ console.log(pc__default.default.white(`----------------------------------------`));
1006
+ console.log(`${pc__default.default.yellow("BTC:")} ${pc__default.default.white("bc1qj4zt3lva4r68xspayg0p8s4hyg40nhjz8fuhqq")}`);
1007
+ console.log(`${pc__default.default.blue("EVM (All):")} ${pc__default.default.white("0x63a875d0c4Dad8E18B95D844caE6FF915dF0a2BD")}`);
1008
+ console.log(`${pc__default.default.green("Solana:")} ${pc__default.default.white("8J5VvZu6ayQa4XnSAAzx4YX3QsXYyyNrP4Zr7JEx1KFY")}`);
1009
+ console.log(`${pc__default.default.red("TRX:")} ${pc__default.default.white("TPgZSrHUhKdjyMwaGd15utJvsbk85oBbit")}`);
1010
+ console.log(pc__default.default.white(`----------------------------------------
1011
+ `));
1012
+ };
1013
+ program.command("price <query>").description("Get the current price of a cryptocurrency (symbol or contract address)").action(handlePrice);
1014
+ program.command("info <query>").description("Get detailed info about a cryptocurrency (market cap, volume, FDV, etc.)").action(handleInfo);
1015
+ program.command("top").description("Show top 50 cryptocurrencies by market cap").action(handleTop);
1016
+ program.command("search <query>").description("Search for tokens or coins across multiple providers").action(handleSearch);
1017
+ program.command("trending").description("Show top 10 trending coins/tokens right now").action(handleTrending);
1018
+ program.command("market").description("Show global cryptocurrency market overview").action(handleMarket);
1019
+ program.command("sentiment").description("Show current Crypto Fear & Greed Index").action(handleSentiment);
1020
+ program.command("gas").description("Show current Ethereum network gas prices").action(handleGas);
1021
+ program.command("chart <query>").description("Draw a terminal ASCII chart of historical prices").option("-d, --days <days>", "Number of days to chart", "7").action(handleChart);
1022
+ program.command("donate").description("Show donation addresses to support development").action(handleDonate);
1023
+ async function interactiveMode() {
1024
+ console.clear();
1025
+ prompts.intro(pc__default.default.bgCyan(pc__default.default.black(" crypull CLI ")));
1026
+ while (true) {
1027
+ const action = await prompts.select({
1028
+ message: "What would you like to do?",
1029
+ options: [
1030
+ { value: "price", label: "\u{1F4B0} Get token price" },
1031
+ { value: "info", label: "\u2139\uFE0F Get detailed token info" },
1032
+ { value: "top", label: "\u{1F3C6} Show top 50 cryptocurrencies" },
1033
+ { value: "search", label: "\u{1F50D} Search for a token" },
1034
+ { value: "trending", label: "\u{1F525} Show trending coins" },
1035
+ { value: "market", label: "\u{1F30D} Show global market overview" },
1036
+ { value: "sentiment", label: "\u{1F3AD} Show Fear & Greed Index" },
1037
+ { value: "gas", label: "\u26FD Show ETH gas prices" },
1038
+ { value: "chart", label: "\u{1F4C8} Show historical price chart" },
1039
+ { value: "donate", label: "\u{1F496} Donate / Support" },
1040
+ { value: "exit", label: "\u274C Exit" }
1041
+ ]
1042
+ });
1043
+ if (prompts.isCancel(action) || action === "exit") {
1044
+ prompts.outro("Goodbye!");
1045
+ process.exit(0);
1046
+ }
1047
+ if (["price", "info", "search", "chart"].includes(action)) {
1048
+ const query = await prompts.text({
1049
+ message: "Enter token symbol or contract address:",
1050
+ placeholder: "e.g., btc, ethereum, 0x...",
1051
+ validate: (value) => {
1052
+ if (!value) return "Please enter a valid query.";
1053
+ }
1054
+ });
1055
+ if (prompts.isCancel(query)) {
1056
+ prompts.outro("Goodbye!");
1057
+ process.exit(0);
1058
+ }
1059
+ if (action === "price") await handlePrice(query);
1060
+ else if (action === "info") await handleInfo(query);
1061
+ else if (action === "search") await handleSearch(query);
1062
+ else if (action === "chart") {
1063
+ const days = await prompts.text({
1064
+ message: "Enter number of days for the chart (default 7):",
1065
+ placeholder: "7",
1066
+ defaultValue: "7"
1067
+ });
1068
+ if (prompts.isCancel(days)) {
1069
+ prompts.outro("Goodbye!");
1070
+ process.exit(0);
1071
+ }
1072
+ await handleChart(query, { days });
1073
+ }
1074
+ } else {
1075
+ if (action === "top") await handleTop();
1076
+ else if (action === "trending") await handleTrending();
1077
+ else if (action === "market") await handleMarket();
1078
+ else if (action === "sentiment") await handleSentiment();
1079
+ else if (action === "gas") await handleGas();
1080
+ else if (action === "donate") handleDonate();
1081
+ }
1082
+ console.log(pc__default.default.gray("\n---\n"));
1083
+ }
1084
+ }
1085
+ if (process.argv.length <= 2) {
1086
+ interactiveMode().catch((err) => {
1087
+ console.error(pc__default.default.red("An error occurred:"), err);
1088
+ process.exit(1);
1089
+ });
1090
+ } else {
1091
+ program.parse(process.argv);
1092
+ }
1004
1093
  //# sourceMappingURL=cli.js.map
1005
1094
  //# sourceMappingURL=cli.js.map