The following pages underline the function signatures for interacting with nftperp smart contracts. If you are familiar with making transactions programatically, this should be fairly easy.

if interacting directly with smart contracts is a bit overwhelming, alternatively, you can use nftperp SDK ✨ that abstracts away the complications

here's a starter code example, to get started with ethers v6 and setting up the clearing house contract instance

npm i ethers

You can find the ABIS here: https://github.com/nftperp/nftperp-sdk/tree/master/src/abis

import * as ethers from "ethers";
import chJSON from "<ABI-FILE-PATH>";

const rpc = "<YOUR-RPC-URL>"
const pk = "<YOUR-PRIVATE-KEY>"
const provider = new ethers.JsonRpcProvider(rpc)
const wallet = new ethers.Wallet(pk, provider)

// clearing house instance
const chAddress = "0x9e8B6D29C0410B8c7E67bB151CA7C0f9F6cBa8bF"
const ch = new ethers.Contract(chAddress, chAbi, wallet)

// example call
await ch.openPosition(...)

please refer to the next pages for detailed function specs.