New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@rholabs/rho-sdk

Package Overview
Dependencies
Maintainers
5
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rholabs/rho-sdk - npm Package Compare versions

Comparing version 0.3.4 to 0.3.5

40

lib/types.d.ts

@@ -328,2 +328,7 @@ import { BrowserProvider, JsonRpcSigner, JsonRpcProvider, TransactionReceipt, Wallet, TransactionRequest } from "ethers";

export type GetMarginUpdatesRequest = Omit<GetRequestBase, 'futureId'>;
export type GetPositionOwnershipTransferParams = Omit<GetRequestBase, 'before' | 'count'> & {
limit?: number;
skip?: number;
};
export type GetPositionLiquidationsParams = GetPositionOwnershipTransferParams;
export interface Trade {

@@ -382,2 +387,35 @@ txHash: string;

}
export interface PositionOwnershipTransferFuture {
futureId: string;
fixedTokenAmount: string;
floatTokenAmount: string;
floatTradeValue: string;
notional: string;
marketRate: string;
}
export interface PositionOwnershipTransfer {
transactionHash: string;
marketId: string;
from: string;
to: string;
deposit: string;
marginTransfer: string;
positionsMtmPayment: string;
reward: string;
floatIndex: string;
blockNumber: number;
timestamp: number;
futures: PositionOwnershipTransferFuture[];
}
export interface PositionLiquidation {
marketId: string;
futureIds: string[];
positionsPercentages: string[];
owner: string;
liquidator: string;
reward: string;
blockNumber: number;
timestamp: number;
transactionHash: string;
}
export class DataServiceAPI {

@@ -389,2 +427,4 @@ constructor(config: DataServiceConfig);

getMarginUpdates(params?: GetMarginUpdatesRequest): Promise<MarginUpdate[]>;
getPositionOwnershipTransfers(params?: GetPositionOwnershipTransferParams): Promise<PositionOwnershipTransfer[]>;
getPositionLiqudations(params?: GetPositionLiquidationsParams): Promise<PositionLiquidation[]>;
}

@@ -391,0 +431,0 @@ export interface SubgraphAPIConfig {

2

package.json
{
"name": "@rholabs/rho-sdk",
"version": "0.3.4",
"version": "0.3.5",
"description": "Rho Protocol SDK",

@@ -5,0 +5,0 @@ "source": "src/index.ts",

@@ -23,2 +23,4 @@ import { RhoSDKNetwork } from '../../sdk-typings'

export type GetMarginUpdatesRequest = Omit<GetRequestBase, 'futureId'>
export type GetPositionOwnershipTransferParams = Omit<GetRequestBase, 'before' | 'count'> & { limit?: number; skip?: number }
export type GetPositionLiquidationsParams = GetPositionOwnershipTransferParams

@@ -84,2 +86,38 @@ export interface Trade {

export interface PositionOwnershipTransferFuture {
futureId: string
fixedTokenAmount: string
floatTokenAmount: string
floatTradeValue: string
notional: string
marketRate: string
}
export interface PositionOwnershipTransfer {
transactionHash: string
marketId: string
from: string
to: string
deposit: string
marginTransfer: string
positionsMtmPayment: string
reward: string
floatIndex: string
blockNumber: number
timestamp: number
futures: PositionOwnershipTransferFuture[]
}
export interface PositionLiquidation {
marketId: string
futureIds: string[]
positionsPercentages: string[]
owner: string
liquidator: string
reward: string
blockNumber: number
timestamp: number
transactionHash: string
}
export class DataServiceAPI {

@@ -98,6 +136,4 @@ private readonly config: DataServiceConfig

async getTrades(params: GetRequestBase = {}) {
const url = this.getUrl()
const { data } = await axios.get<GetTradesResponse>(
`${url}/api/v1/trades`
`${this.getUrl()}/api/v1/trades`
, {

@@ -111,6 +147,4 @@ params

async getProvision(params: GetRequestBase = {}) {
const url = this.getUrl()
const { data } = await axios.get<GetProvisionsResponse>(
`${url}/api/v1/provisions`
`${this.getUrl()}/api/v1/provisions`
, {

@@ -124,6 +158,4 @@ params

async getMarginUpdates(params: GetMarginUpdatesRequest = {}) {
const url = this.getUrl()
const { data } = await axios.get<GetMarginUpdatesResponse>(
`${url}/api/v1/margin-updates`
`${this.getUrl()}/api/v1/margin-updates`
, {

@@ -135,2 +167,22 @@ params

}
async getPositionOwnershipTransfers(params: GetPositionOwnershipTransferParams = {}) {
const { data } = await axios.get<{ cached: boolean; data: PositionOwnershipTransfer[] }>(
`${this.getUrl()}/api/v1/position-ownership-transfers`
, {
params
})
return data.data
}
async getPositionLiqudations(params: GetPositionLiquidationsParams = {}) {
const { data } = await axios.get<{ cached: boolean; data: PositionLiquidation[] }>(
`${this.getUrl()}/api/v1/position-liquidations`
, {
params
})
return data.data
}
}

@@ -37,2 +37,21 @@ import { describe, expect, test } from '@jest/globals'

)
test(
'getPositionOwnershipTransfers',
async () => {
const items = await api.getPositionOwnershipTransfers({ limit: 1 })
expect(items.length).toBe(1)
expect(items[0].marketId).toMatch('0x')
},
waitTimeout
)
test(
'getPositionLiqudations',
async () => {
const items = await api.getPositionLiqudations({ limit: 1 })
expect(items.length).toBeGreaterThanOrEqual(0)
},
waitTimeout
)
})

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc