npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

cosmo-api

v1.0.11

Published

API Cosmo App для разработки ботов, приложений, сайтов.

Downloads

8

Readme

cosmo-api

API Cosmo App для разработки ботов, приложений, сайтов.

npm package

Установка

Windows:

  • Скачайте и установите, желательно, последнюю версию Node.JS
  • Создайте в удобном месте папку, например cosmo_market
  • Перейдите в командную строку из этой папки: напишите cmd за место пути до папки
  • В появившейся консоли пропишите: npm i --save cosmo-api

Ubuntu:

  • Установите Node.JS по этому гайду
  • Создайте в удобном месте папку, например cosmo_market
  • Перейдите в папку: cd (путь до вашей папки)
  • Пропишите: npm i --save cosmo-api

Начало работы

Для начала использования, вам нужно создать в своей папке исполняемый файл, пусть это будет index.js

Теперь его нужно открыть и импортировать библиотеку:

const { COSMOAPI } = require('cosmo-api');
const cosmo = new COSMOAPI(options);

|Опция|Тип|Описание| |-|-|-| |options|Object|Опции конструктора| |options.key|String|Ключ для взаимодействия с API|

Где взять эти значения

  • Получение ключа (key): в настройках бота есть команда Получить API ключ

API

getTransfers - Получение переводов

const test = async () => {
    const result = await cosmo.methods.getTransfers(type, offset, limit);
    console.log(result);
}
test();

|Параметр|Тип|Описание| |-|-|-| |type|String|Тип необходимых переводов, доступно: all - все, in - пополнения, out - выводы| |offset|Number|Смещение, необходимое для выборки определённого подмножества переводов| |limit|Number|Количество переводов которое нужно получить, максимальное значение 100|

createTransfer - Перевод пользователю или в магазин

const test = () => {
    const result = await cosmo.methods.createTransfer(toId, amount); // 1 коин = 1.00 ед.
    console.log(result);
}
test();

|Параметр|Тип|Описание| |-|-|-| |toId|Number|Айди получателя| |amount|Number|Сумма перевода|

getMyBalance - Получение баланса текущего пользователя или магазина

const test = async() => {
    const myBalance = await cosmo.methods.getMyBalance();
    console.log(myBalance);
}
test();

getBalance - Получение балансов пользователей и магазинов

const test = async() => {
    const balances = await cosmo.methods.getBalance(ids);
    console.log(balances);
}
test();

|Параметр|Тип|Описание| |-|-|-| |ids|Number[]|Айди получателей|

Ссылки