Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 27 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Welcome to the tip.cc API Client npm package!

# Installation
## Installation

Simply create an npm project if you don't have an already, and install the package.

Expand All @@ -11,7 +11,7 @@ npm init
npm i tipcc.js
```

# Getting Started
## Getting Started

> Tip: Want to get started without an introduction? Check out our [documentation](https://tipccjs.org/).

Expand Down Expand Up @@ -59,6 +59,8 @@ client.on('ready', async () => {

## Transactions

### Events

To receive transactions as events, use [TransactionManager](https://tipccjs.org/classes/TransactionManager)'s events:

```js
Expand All @@ -71,6 +73,8 @@ client.transactions.on('tip', (transaction) => {
});
```

### Fetching

You can also get a single or many transactions by id:

```js
Expand All @@ -97,6 +101,27 @@ client.on('ready', async () => {
Using no filter will get all transactions for the bot/user.
This is not recommended, unless you know what you're doing.

### Creating (sending)

You can send a transaction to one or more users:

```js
client.on('ready', async () => {
const transaction = await client.transactions.create({
recipient_s: ['discord-id-here'],
value: '0.1',
currencyCode: 'BTC',
});

const amount = transaction[0].amount;

console.log(`${amount.value} ${amount.currencyCode} successfully sent to ${transaction[0].recipient.username}`);
});
```

Notice that you can choose between using a `rawValue` or `value` when sending a transaction.
The `value` will automatically get converted, while `rawValue` assumes you have done this conversion yourself.

## Exchange rates

Use the [ExchangeRateCache](https://tipccjs.org/classes/ExchangeRateCache) to get exchange rates:
Expand Down