Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

king-coin-api

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

king-coin-api - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

48

index.js
const axios = require('axios')
const url = 'https://kcbot.ru/server/api/'
class API {
constructor({ token }) {
exports.KingCoinApi = class {
constructor({ token } = {}) {
this.token = token
}
async getMyBalance(action = 'myBalance', token = this.token) {
const data = await axios.post(url, {
getMyBalance(action = 'myBalance', token = this.token) {
return axios.post(url, {
action,
token
})
.then(data => data?.data)
.catch(console.error)
return data
}).then(data => data?.data).catch(console.error)
}
async getUserBalance({ action = 'balance', token = this.token, user_ids = this.user_ids } = {}) {
const data = await axios.post(url, {
getUserBalance({ action = 'balance', token = this.token, user_ids = this.user_ids } = {}) {
return axios.post(url, {
action,
token,
user_ids
})
.then(data => data?.data)
.catch(console.error)
return data
}).then(data => data?.data).catch(console.error)
}
async getHistory({ action = 'tx', token = this.token, filter = this.filter, count = this.count, offset = this.offset } = {}) {
const data = await axios.post(url, {
getHistory({ action = 'tx', token = this.token, filter = this.filter, count = this.count, offset = this.offset } = {}) {
return axios.post(url, {
action,

@@ -38,11 +30,7 @@ token,

offset: !offset ? 0 : offset
})
.then(data => data?.data)
.catch(console.error)
return data
}).then(data => data?.data).catch(console.error)
}
async sendCoins({ action = 'transfer', token = this.token, receiver = this.receiver, amount = this.amount, payload = this.payload } = {}) {
const data = await axios.post(url, {
sendCoins({ action = 'transfer', token = this.token, receiver = this.receiver, amount = this.amount, payload = this.payload } = {}) {
return axios.post(url, {
action,

@@ -53,10 +41,4 @@ token,

payload: !payload ? 0 : payload
})
.then(data => data?.data)
.catch(console.error)
return data
}).then(data => data?.data).catch(console.error)
}
}
module.exports = { API }
}
{
"name": "king-coin-api",
"version": "1.0.2",
"version": "1.0.3",
"description": "Модуль для удобного использования KingCoin API",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -27,4 +27,4 @@ <p align=center>

```js
const { API } = require('king-coin-api')
const api = new API({ token: 'YOUR_TOKEN' }) // Ваш токен
const { KingCoinApi } = require('king-coin-api')
const api = new KingCoinApi({ token: 'YOUR_TOKEN' }) // Ваш токен

@@ -37,3 +37,7 @@ // Получение баланса мерчанта

getMyBalance() // Вызов функции
```
## 💸 Получение баланса пользователей
```js
// Получение баланса пользователей

@@ -46,4 +50,8 @@ async function getUserBalance() {

getUserBalance() // Вызов функции
```
// Получение историю переводов
## 📄 Получение истории переводов
```js
// Получение истории переводов
async function getHistory() {

@@ -54,3 +62,6 @@ const history = await api.getHistory({ filter: "IN", count: 20 }) // Получаем 20 последних пополнений

getHistory() // Вызов функции
```
## 💳 Перевод коинов пользователю
```js
//Перевод коинов пользователю

@@ -62,3 +73,2 @@ async function sendCoins() {

sendCoins() // Вызов функции
```
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc