Find a full description and walkthrough for this guide in our docs:
https://docs.perp.fi/sdk-documentation/smart-contract-javascript-dev-guide
The code present here is for informational purposes only. Try it with testnet before using any code provided with mainnet funds. If you find bugs, please create an issue or PR. We welcome your feedback or contributions!