Skip to content

Commit

Permalink
panoptic readme
Browse files Browse the repository at this point in the history
  • Loading branch information
kyscott18 committed Oct 12, 2023
1 parent 3e12528 commit f79141c
Showing 1 changed file with 58 additions and 1 deletion.
59 changes: 58 additions & 1 deletion packages/panoptic-sdk/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,63 @@
# Panoptic SDK

Typescript SDK for Panoptic
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

```ts
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

Expand Down

0 comments on commit f79141c

Please sign in to comment.