0.1.6 • Published 2 years ago

@jup-ag/perp-sdk v0.1.6

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years 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

2 years ago

0.1.5

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago

0.0.9

2 years ago

0.0.8

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago