Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@panoptic-xyz/sdk

Package Overview
Dependencies
Maintainers
2
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@panoptic-xyz/sdk

Typescript SDK for Panoptic.

  • 0.0.1-alpha.5
  • latest
  • npm
  • Socket score

Version published
Maintainers
2
Created
Source

Panoptic SDK

Typescript SDK for Panoptic.

Overview

This SDK aims to provide a developer friendly, performant, and robust way to access the Panoptic protocol. An extension is used to provide a seamless extension to Viem. The main entities of the SDK are:

  • get functions: Gather data by reading from the blockchain
  • utility functions: Perform off-chain calculations
  • simulate functions: Estimate gas and return a formatted transaction for a specific action

Example

import { createPublicClient, http } from 'viem'
import { sepolia } from 'viem/chains'
import {
  publicActionsPanoptic,
  sepoliaPanoptic,
  createPanopticPosition
} from '@panoptic-xyz/sdk'

export const publicClient = createPublicClient({
  chain: mainnet,
  transport: http(),
}).extend(publicActionsReverseMirage)

// Pass in or read a uniswap pool
const uniswapPool = ...

// Read the data from the corresponding panoptic pool
const panopticPool = await publicClient.getPanopticPool({
  uniswapPool,
  factory: sepoliaPanoptic.factory,
})

// Create a new position, specifying legs
const newPosition = createPanopticPosition(panopticPool, [
  {
    asset: "token0",
    optionRatio: 1,
    position: "long",
    tokenType: "token0",
    riskPartnerIndex: 0,
    tickLower: 0,
    tickUpper: 300
  },
  undefined,
  undefined,
  undefined,
])

// Mint the new position from the panoptic pool
const { result } = await publicClient.simulatePanopticMintOptions({
  position: newPosition,
  amount: 10n ** 18n
});

API

  • Entities

    • PanopticFactory: The factory contract in the Panoptic protocol
    • PanopticSemiFungiblePositionManager: The semi-fungible position manager in the Panoptic protocol
    • PanopticPool: A pool created by PanopticFactory
    • PanopticPoolData: The state of a PanopticPool
    • PanopticCollateral: A collateral tracker in a PanopticPool
    • PanopticCollateralData: The state of a PanopticCollateral
    • PanopticPosition: A user position in a PanopticPool
    • PanopticPositionData: The state of a PanopticPosition
    • PanopticCollateralPosition: A user position in a PanopticCollateral
    • PanopticCollateralPositionData: The state of a PanopticCollateralPosition
  • Utilities

    • createPanopticPool
    • createPanopticCollateral
    • createPanopticPosition
    • createPanopticSemiFungiblePosition
    • calculatePanopticTokenID
    • calculatePanopticPositionKey
  • Public Actions

    • getPanopticPool
    • getPanopticPoolData
    • getPanopticCollateralData
    • getPanopticCollateralPositionData
    • getPanoptionLegData
    • getPanopticPositionData
    • getPanopticSemiFungiblePositionData
    • getPanopticCheckCollateral
    • simulatePanopticDeployNewPool
    • simulatePanopticMintOptions
    • simulatePanopticBurnOptions
    • simulatePanopticRollOptions
    • simulatePanopticForceExercise
    • simulatePanopticLiquidateAccount
    • simulatePanopticCollateralMint
    • simulatePanopticCollateralDeposit
    • simulatePanopticCollateralRedeem
    • simulatePanopticCollateralWithdraw
    • simulatePanopticSFPMInitializeAMMPool
    • simulatePanopticSFPMMintTokenizedPosition
    • simulatePanopticSFPMBurnTokenizedPosition
    • simulatePanopticSFPMRollTokenizedPositions
  • Chains

    • sepoliaPanoptic
  • ABIs

    • panopticFactoryABI
    • panopticCollateralTrackerABI
    • panopticPoolABI
    • panopticSemiFuniblePositionManagerABI

FAQs

Package last updated on 01 Nov 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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