New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@sol-synth-engine/js-client

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sol-synth-engine/js-client

JavaScript client for Sol Synth Engine

latest
npmnpm
Version
0.0.7
Version published
Maintainers
1
Created
Source

Sol Synth Engine JavaScript Client

This is the JavaScript client for the Sol Synth Engine program, a synthetic asset protocol on Solana.

Features

  • Create and manage synthetic markets
  • Mint and redeem synthetic assets
  • Manage underlying tokens and treasuries
  • Query market and position information
  • Full TypeScript support

Installation

npm install @sol-synth-engine/js-client

Usage

Initialize Client

import { SolSynthEngineClient } from "@sol-synth-engine/js-client";
import { Connection, PublicKey, Keypair } from "@solana/web3.js";

// Initialize the client
const connection = new Connection("https://api.mainnet-beta.solana.com");
const programId = new PublicKey("YOUR_PROGRAM_ID");
const client = new SolSynthEngineClient(programId, connection);

// Create a wallet
const wallet = Keypair.generate();

Create Market

const marketName = "btc";
const syntheticMint = new PublicKey("YOUR_SYNTHETIC_MINT");
const oracleSource = new PublicKey("YOUR_ORACLE_SOURCE");
const syntheticOracleSource = new PublicKey("YOUR_SYNTHETIC_ORACLE_SOURCE");
const marketFeeRate = 0.01;
const marketAuthority = new PublicKey("YOUR_MARKET_AUTHORITY");

const tx = await client.createMarket(
  marketName,
  syntheticMint,
  oracleSource,
  syntheticOracleSource,
  marketFeeRate,
  marketAuthority,
);

Mint Synthetic Assets

const marketName = "btc";
const amount = 1000000; // Amount in smallest unit
const underlyingToken = new PublicKey("YOUR_UNDERLYING_TOKEN");
const syntheticToken = new PublicKey("YOUR_SYNTHETIC_TOKEN");

const tx = await client.mint(marketName, amount, underlyingToken, syntheticToken, wallet.publicKey);

Redeem Synthetic Assets

const marketName = "btc";
const amount = 1000000; // Amount in smallest unit
const syntheticToken = new PublicKey("YOUR_SYNTHETIC_TOKEN");
const underlyingToken = new PublicKey("YOUR_UNDERLYING_TOKEN");

const tx = await client.redeem(
  marketName,
  amount,
  syntheticToken,
  underlyingToken,
  wallet.publicKey,
);

Query Market Information

// Get market info
const marketInfo = await client.getMarketInfo("btc");

// Get position info
const positionInfo = await client.getPositionInfo("btc", wallet.publicKey);

// Get treasury info
const treasuryInfo = await client.getTreasuryInfo("btc", new PublicKey("YOUR_TREASURY_TOKEN"));

API Reference

SolSynthEngineClient

The main client class for interacting with the Sol Synth Engine program.

Constructor

constructor(programId: PublicKey, connection: Connection)

Methods

  • createMarket: Create a new synthetic market
  • mint: Mint synthetic assets
  • redeem: Redeem synthetic assets
  • getMarketInfo: Get market information
  • getPositionInfo: Get position information
  • getTreasuryInfo: Get treasury information
  • addUnderlyingToken: Add an underlying token to a market
  • addTreasury: Add a treasury to a market

Development

# Install dependencies
npm install

# Build the package
npm run build

# Run tests
npm test

# Clean build artifacts
npm run clean

Contributing

  • Fork the repository
  • Create your feature branch (git checkout -b feature/amazing-feature)
  • Commit your changes (git commit -m 'Add some amazing feature')
  • Push to the branch (git push origin feature/amazing-feature)
  • Open a Pull Request

License

MIT

Keywords

solana

FAQs

Package last updated on 15 Apr 2025

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