Security News
Opengrep Emerges as Open Source Alternative Amid Semgrep Licensing Controversy
Opengrep forks Semgrep to preserve open source SAST in response to controversial licensing changes.
@discoin/scambio
Advanced tools
[![npm version](https://img.shields.io/npm/v/@discoin/scambio)](https://www.npmjs.com/package/@discoin/scambio) [![codecov](https://codecov.io/gh/Discoin/scambio/branch/merge/graph/badge.svg)](https://codecov.io/gh/Discoin/scambio) [![MIT license](https:/
The official JS/TS library for Discoin. Features browser and first-class TypeScript support.
yarn add @discoin/scambio
# Or for npm
npm i @discoin/scambio
# Or for pnpm
pnpm i @discoin/scambio
If you want to do more complex queries you may want to use the @nestjsx/crud-request package, which is specifically designed for the Discoin API. Most users won't need it but it is listed as a peer dependency. You can safely ignore any warnings about it if you aren't using it.
Below are several examples of how you can use the library. You do everything through a client instance or its static members.
import Discoin from '@discoin/scambio';
const client = new Discoin('token', ['currencyCode']);
const Discoin = require('@discoin/scambio').default;
const client = new Discoin('token', ['currencyCode']);
const newTransaction = client.transactions.create({
from: 'XYZ',
to: 'ABC',
amount: 100,
// Discord user ID
user: '210024244766179329'
});
await client.transactions.getOne('808179ef-aef4-4bbb-ab37-db310235fb0c');
This uses common queries, which are generated specifically for your client and don't need any extra dependencies.
await client.transactions.getMany(client.commonQueries.UNHANDLED_TRANSACTIONS);
This uses the @nestjsx/crud-request
query builder.
You should use this when you are performing very complex queries or are dynamically creating queries.
import {RequestQueryBuilder, CondOperator} from '@nestjsx/crud-request';
const query = RequestQueryBuilder.create()
// Only get transactions where the `amount` field > 10
.setFilter({
field: 'amount',
operator: CondOperator.GREATER_THAN,
value: 10
})
.query();
await client.transactions.getMany(query);
You can mark a transaction as handled after you have paid the user. This helps to keep transactions atomic and can make retrying failed transactions very simple.
const unhandledTransactions = await client.transactions.getMany(client.commonQueries.UNHANDLED_TRANSACTIONS);
unhandledTransactions.forEach(async transaction => {
console.log(`${transaction.user} received ${transaction.payout} ${transaction.to.id}`);
// After you're done with the transaction, mark it as completed
await transaction.update({handled: true});
});
Pull requests and issues are always welcome! Please, read our Code of Conduct and our contributing guide if you are interested in helping to improve the library..
Copyright 2019-2020 Jonah Snider. Distributed under the MIT licence.
If you would like the licence to be something other than MIT for you or your organization please get in touch.
FAQs
[![npm version](https://img.shields.io/npm/v/@discoin/scambio)](https://www.npmjs.com/package/@discoin/scambio) [![codecov](https://codecov.io/gh/Discoin/scambio/branch/merge/graph/badge.svg)](https://codecov.io/gh/Discoin/scambio) [![MIT license](https:/
We found that @discoin/scambio demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Opengrep forks Semgrep to preserve open source SAST in response to controversial licensing changes.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.