This package has been deprecated

Author message:

No longer maintained


2.2.0 • Public • Published


npm version codecov MIT license Build Status XO code style DeepScan grade

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.

Creating a new client

ECMAScript modules
import Discoin from '@discoin/scambio';

const client = new Discoin('token', ['currencyCode']);
const Discoin = require('@discoin/scambio').default;

const client = new Discoin('token', ['currencyCode']);

Creating a transaction

const newTransaction = client.transactions.create({
	from: 'XYZ',
	to: 'ABC',
	amount: 100,
	// Discord user ID
	user: '210024244766179329'

Getting transactions

Get one transaction by ID
await client.transactions.getOne('808179ef-aef4-4bbb-ab37-db310235fb0c');
Get many transactions with built-in queries

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);
Get many transactions with query builder

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
		field: 'amount',
		operator: CondOperator.GREATER_THAN,
		value: 10

await client.transactions.getMany(query);

Processing transactions

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} ${}`);

	// 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.

Package Sidebar


npm i @discoin/scambio

Weekly Downloads






Unpacked Size

48.1 kB

Total Files


Last publish


  • austinhuang
  • jonahsnider