npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

rysk-sdk

v1.1.0

Published

A TypeScript SDK for Rysk finance.

Downloads

102

Readme

Build NPM Version Discord

Interact with the Rysk decentralized exchange and trade BTC, ETH, SOL and other cryptocurrency perp futures with leverage. Live on Arbitrum.

npm install rysk-sdk
# or
yarn add rysk-sdk
# or
pnpm add rysk-sdk
# or
bun install rysk-sdk

Usage

Getting started is a simple case of creating a .env file, importing the Client and instantiating an instance.

The .env file should contain the necessary contract addresses to interact with the DEX. An up-to-date copy of the relevant contract addresses can be found in the Rysk API docs.

CIAO_MAINNET_ADDRESS=<...>
ORDER_DISPATCH_MAINNET_ADDRESS=<...>

CIAO_TESTNET_ADDRESS=<...>
ORDER_DISPATCH_TESTNET_ADDRESS=<...>
import RyskSDK from 'rysk-sdk'

const MY_PRIVATE_KEY = '0x...'

const Client = new RyskSDK(MY_PRIVATE_KEY)

The client can also accept a configuration object as the second parameter.

| Key | Type | Default | Description | |--------------|--------------------------|-----------------------------------|---------------------------------------------------------------------------| | debug | boolean | false | Used to enable debug mode when running the client for additional logging. | | environment | 'testnet' \| 'mainnet' | 'testnet' | Specify the environment you wish to trade in. | | rpc | string | Arbitrum RPC based on environment | Specify a custom RPC url to used. | | subAccountId | number | 1 | Specify a sub-account ID to use. This can be from 1-255. |

import RyskSDK from 'rysk-sdk'

const CONFIG = {
  debug: false,
  environment: 'testnet',
  rpc: 'https://sepolia.arbiscan.io',
  subAccountId: 1,
}
const MY_PRIVATE_KEY = '0x...'

const Client = new RyskSDK(MY_PRIVATE_KEY)

Getting started

To get started, you will need to deposit funds and make a trade. Let's look at how we can do that now. If you need testnet funds, please head to the Rysk Discord server where we will happily help.

import RyskSDK from 'rysk-sdk'
import { OrderType, TimeInForce } from 'rysk-sdk/enums'

const MY_PRIVATE_KEY = '0x...'

const Client = new RyskSDK(MY_PRIVATE_KEY)

// Let's deposit 1000 USDC to get started. By default deposits are in USDC.
const { error, success, transactionHash } = await Client.deposit(1000)

// Now we can make an order. Let's go long on some ETH!
if (success) {
  const { error, order } = await Client.placeOrder({
    isBuy: true,
    orderType: OrderType.LIMIT,
    price: 3150,
    productId: 1002,
    quantity: 0.1,
    timeInForce: TimeInForce.GTC,
  })

  // Finally let's log out our order to check the details.
  console.log(order)
}

Handy enums

A series of useful enums can be imported from rysk-sdk/enums and used to help match against responses or compose payloads.

| Name | Values | Description | |--------------|------------------------------------------------------------------------------------------|------------------------------------------------------| | Environment | MAINNET \| TESTNET | The environment to use when initialising the client. | | Interval | '1M' \| '5M' \| '15M' \| '30M' \| '1H' \| '2H' \| '4H' \| '8H' \| '1D' \| '3D' \| '1W' | The interval to use when fetching K-line data. | | MarginAssets | USDC | Symbol values of supported margin assets. | | OrderStatus | CANCELLED \| EXPIRED \| FILLED \| OPEN \| PENDING \| REJECTED | Defines the possible states an order can be in. | | OrderType | LIMIT \| LIMIT_MAKER \| MARKET | Order types for building order payloads. | | TimeInForce | GTC \| FOK \| IOC | Time in force values for building order payloads. |

Further support

For more information on specific endpoints, please refer to the official Rysk API docs. Each function in this client contains detailed JSDocs on arguments and return types to aid the developer experience and links to their respective endpoints within the official docs.

Contributing

Want to contribute? Check out that contributing guide to get started.

Support

Trouble getting started? Feel free to join us on the official Rysk Discord server where you can get full support from the team.

License

MIT License © 2024-Present Tim Dunphy