community.js 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. "use strict";
  2. /**
  3. * There are many awesome community services that provide Ethereum
  4. * nodes both for developers just starting out and for large-scale
  5. * communities.
  6. *
  7. * @_section: api/providers/thirdparty: Community Providers [thirdparty]
  8. */
  9. Object.defineProperty(exports, "__esModule", { value: true });
  10. exports.showThrottleMessage = void 0;
  11. // Show the throttle message only once per service
  12. const shown = new Set();
  13. /**
  14. * Displays a warning in tht console when the community resource is
  15. * being used too heavily by the app, recommending the developer
  16. * acquire their own credentials instead of using the community
  17. * credentials.
  18. *
  19. * The notification will only occur once per service.
  20. */
  21. function showThrottleMessage(service) {
  22. if (shown.has(service)) {
  23. return;
  24. }
  25. shown.add(service);
  26. console.log("========= NOTICE =========");
  27. console.log(`Request-Rate Exceeded for ${service} (this message will not be repeated)`);
  28. console.log("");
  29. console.log("The default API keys for each service are provided as a highly-throttled,");
  30. console.log("community resource for low-traffic projects and early prototyping.");
  31. console.log("");
  32. console.log("While your application will continue to function, we highly recommended");
  33. console.log("signing up for your own API keys to improve performance, increase your");
  34. console.log("request rate/limit and enable other perks, such as metrics and advanced APIs.");
  35. console.log("");
  36. console.log("For more details: https:/\/docs.ethers.org/api-keys/");
  37. console.log("==========================");
  38. }
  39. exports.showThrottleMessage = showThrottleMessage;
  40. //# sourceMappingURL=community.js.map