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
4
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.1.0 to 0.2.0

src/api/oracle/index.ts

46

lib/types.d.ts

@@ -70,3 +70,4 @@ import { BrowserProvider, JsonRpcSigner, JsonRpcProvider, TransactionReceipt, Wallet } from "ethers";

tokensPair: FixedAndFloatTokensPair;
marketRate: bigint;
marketRateBefore: bigint;
marketRateAfter: bigint;
tradeRate: bigint;

@@ -157,4 +158,4 @@ lpFee: bigint;

export interface LiquidityDistribution {
totalNotional: bigint;
currentSwapRate: bigint;
provisionDistribution: ProvisionDistribution;
currentFutureRate: bigint;
intervalLiquidity: IntervalLiquidity[];

@@ -199,7 +200,44 @@ }

}
export interface OracleAPIConfig {
oracleServiceUrl: string;
}
export class OracleAPI {
constructor(config: RhoSDKConfig);
constructor(config: OracleAPIConfig);
getRates(): Promise<OracleRecord[]>;
getMarketRate(marketId: string): Promise<OracleRecord>;
}
export interface SubgraphAPIConfig {
apiUrl: string;
}
export interface CommonEventProps {
id: string;
marketId: string;
transactionHash: string;
blockNumber: string;
blockTimestamp: string;
owner: string;
}
export interface TradeEvent extends CommonEventProps {
futureId: string;
initiator: string;
notional: bigint;
openInterest: bigint;
direction: number;
tradeRate: bigint;
protocolFee: bigint;
lpFee: bigint;
}
export interface EventsFilter {
userAddress?: string;
marketIds?: string[];
futureIds?: string[];
timestampFrom?: number;
timestampTo?: number;
offset?: number;
limit?: number;
}
export class SubgraphAPI {
constructor(config: SubgraphAPIConfig);
getTrades(filter?: EventsFilter): Promise<TradeEvent[]>;
}
export default class RhoSDK {

@@ -206,0 +244,0 @@ config: RhoSDKConfig;

3

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

@@ -19,2 +19,3 @@ "source": "src/index.ts",

"test": "yarn build && jest index.test.ts --no-cache",
"test_subgraph": "yarn build && jest subgraph-api.test.ts --no-cache",
"prepack": "yarn build"

@@ -21,0 +22,0 @@ },

@@ -68,3 +68,5 @@ import {RouterABI, ViewABI, QuoterABI, ERC20ABI} from './abi'

this.oracleAPI = new OracleAPI(config);
this.oracleAPI = new OracleAPI({
oracleServiceUrl: config.oracleServiceUrl
});
}

@@ -214,7 +216,7 @@

const [ totalNotional, currentSwapRate, intervalLiquidity ] = Object.values(data) as any
const [ provisionDistribution, currentFutureRate, intervalLiquidity ] = Object.values(data) as any
return {
totalNotional,
currentSwapRate,
provisionDistribution,
currentFutureRate,
intervalLiquidity

@@ -487,1 +489,2 @@ }

export * from './api/oracle'
export * from './api/subgraph'

@@ -79,3 +79,4 @@ export interface ProvisionDistribution {

tokensPair: FixedAndFloatTokensPair;
marketRate: bigint;
marketRateBefore: bigint;
marketRateAfter: bigint;
tradeRate: bigint;

@@ -180,4 +181,4 @@ lpFee: bigint

export interface LiquidityDistribution {
totalNotional: bigint
currentSwapRate: bigint
provisionDistribution: ProvisionDistribution
currentFutureRate: bigint
intervalLiquidity: IntervalLiquidity[]

@@ -184,0 +185,0 @@ }

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