0.1.6 • Published 11 months ago

@jup-ag/perp-sdk v0.1.6

Weekly downloads
-
License
ISC
Repository
-
Last release
11 months ago

Perp SDK

Install

npm i @jup-ag/perp-sdk

Subscribing to status updates for Position Requests (used in frontend)

import { CreatePerpClient, Status } from "@jup-ag/perp-sdk";

const workerEndpoint = "http://127.0.0.1:8787"

function handler(key: string, status: Status, description: string) {
  console.log(`Got new status update for ${key}; Status: ${status}; Description: ${description}`)
}

function main() {
  const perpClient = CreatePerpClient(workerEndpoint)
  const key = "SomePositionRequestPubKeyBase58"
  perpClient.onStatusUpdate(key, handler)
}

Setting status updates (used by Keeper)

import { CreatePerpClient, Status } from "@jup-ag/perp-sdk";

const workerEndpoint = "http://127.0.0.1:8787"

async function main() {
  const perpClient = CreatePerpClient(workerEndpoint)
  const key = "SomePositionRequestPubKeyBase58"
  const ok = await perpClient.updateStatus(key, Status.Error, "Something went wrong")

  if (!ok) {
    throw new Error("Failed to update status")
  }

  const res = await perpClient.getStatus(key)
  console.log({ res })
}
0.1.6

11 months ago

0.1.5

12 months ago

0.1.4

12 months ago

0.1.3

12 months ago

0.1.2

12 months ago

0.1.1

12 months ago

0.1.0

12 months ago

0.0.9

12 months ago

0.0.8

12 months ago

0.0.7

12 months ago

0.0.6

12 months ago

0.0.5

12 months ago

0.0.3

12 months ago

0.0.2

12 months ago

0.0.1

12 months ago