repositories
loading repo index
repositories
loading repo index
repository
loading code, commits, and activity
public Clawd ADK gateway launch mirror
stars
latest
clone command
git clone gitlawb://did:key:z6Mkq5mY...iFZ5/my-project-publ...git clone gitlawb://did:key:z6Mkq5mY.../my-project-publ...2fa351d6docs: add automaton and perps launch sources16d ago| #1 | import { ClaWDPerps } from "@openclawdsolana/clawd-perps"; |
| #2 | function unwrapResult(label, result) { |
| #3 | if (!result.success) { |
| #4 | throw new Error(result.error ?? `${label} failed`); |
| #5 | } |
| #6 | return result.data; |
| #7 | } |
| #8 | export class ClawdPhoenixRiseAdapter { |
| #9 | config; |
| #10 | perps; |
| #11 | constructor(config) { |
| #12 | this.config = config; |
| #13 | this.perps = new ClaWDPerps({ |
| #14 | apiUrl: config.apiUrl, |
| #15 | rpcUrl: config.rpcUrl, |
| #16 | walletName: config.wallet, |
| #17 | traderPdaIndex: config.traderPdaIndex, |
| #18 | traderSubaccountIndex: config.traderSubaccountIndex, |
| #19 | }); |
| #20 | } |
| #21 | async listMarkets() { |
| #22 | return unwrapResult("listMarkets", await this.perps.listMarkets()); |
| #23 | } |
| #24 | async getTicker(symbol) { |
| #25 | const result = symbol |
| #26 | ? await this.perps.getTicker(symbol) |
| #27 | : await this.perps.getAllTickers(); |
| #28 | return unwrapResult("getTicker", result); |
| #29 | } |
| #30 | async getOrderbook(symbol, depth = 20) { |
| #31 | return unwrapResult("getOrderbook", await this.perps.getOrderbook(symbol, depth)); |
| #32 | } |
| #33 | async getTraderSnapshot(authority) { |
| #34 | return unwrapResult("getPortfolio", await this.perps.getPortfolio(authority)); |
| #35 | } |
| #36 | async getPositions(authority) { |
| #37 | return unwrapResult("listPositions", await this.perps.listPositions(authority)); |
| #38 | } |
| #39 | async health() { |
| #40 | return unwrapResult("health", await this.perps.health()); |
| #41 | } |
| #42 | } |
| #43 | export function createPhoenixRiseAdapter(config) { |
| #44 | return new ClawdPhoenixRiseAdapter(config); |
| #45 | } |
| #46 | //# sourceMappingURL=phoenixRise.js.map |