Installation

To install the SDK, run the following command:

npm install @aori-io/sdk

Or using Yarn:

yarn add @aori-io/sdk

Initialization

After installation, use the following import command interact with the SDK to import the base class AoriProvider that will allow you to do many of the base functionalities:

import { AoriProvider } from '@aori-io/sdk';

Then access specific functions like so:

const provider = new AoriProvider(...);
...
await provider.makeOrder(...);

Sidenote: Websockets

As the Aori API is a Websocket-based API, requests and responses may come back in an asynchronous manner. The AoriProvider class is an event-based class that is built to handle this, managing requests through the use of a counter.

Request:
aori_makeOrder(id = 63, ...)

Corresponding response:
{
  id: 63,
  result: ...
}

AoriProvider also inherits the EventEmitter class, meaning that it will emit events when the responses of requests and notifications (where no request was made to receive) are made.

const provider = new AoriProvider(...);
...
provider.on(NotificationEvents.OrderToExecute, (...) => {
  ...
});