🚀 DAY 2 OF LAUNCH WEEK: Announcing Socket Certified Patches: One-Click Fixes for Vulnerable Dependencies.Learn more →
Socket
Book a DemoInstallSign in
Socket

@project-serum/serum-dev-tools

Package Overview
Dependencies
Maintainers
6
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@project-serum/serum-dev-tools

developer tooling suite for building on serum

latest
Source
npmnpm
Version
1.0.5
Version published
Maintainers
6
Created
Source

Serum DevTools 🛠️

A developer tooling SDK for building on serum-dex.

Prerequisites

You will need to use the FileKeypair class that extends the Keypair class from @solana/web3.js to provide easy file-based keypair management, which is required for the market making features provided by this package.

const owner = FileKeypair.generate("./scripts/keys/owner.json");

const airdropSig = await connection.requestAirdrop(
  owner.keypair.publicKey,
  10 * LAMPORTS_PER_SOL,
);
await connection.confirmTransaction(airdropSig);

You need to have a serum-dex program deployed on the cluster you wish to interact with.

You can either,

  • Use the serum-dev-tools CLI to deploy the program.

  • use the already deployed serum-dex programs, 9xQeWvG816bUx9EPjHmaT23yvVM2ZWbrrpZb9PusVFin on mainnet-beta and DESVgJVGajEgKGXhb6XmqDHGz3VjdgP7rEVESBgxmroY on devnet.

Get Started

yarn add @project-serum/serum-dev-tools

Initialize a Dex

const connection = new Connection("http://localhost:8899", "confirmed");

const dexAddress = new PublicKey(
  "7zo7HCQAZPRb4pYiQQ6fLjC8ssN3E8LkavVs8JUA5NMn",
);

const dex = new Dex(dexAddress, connection);

Create Coin instances for your Market

const baseCoin = await dex.createCoin(
  "SAYA",
  9,
  owner.keypair,
  owner.keypair,
  owner.keypair,
);

const quoteCoin = await dex.createCoin(
  "SRM",
  9,
  owner.keypair,
  owner.keypair,
  owner.keypair,
);

// Fund the FileKeypair object to place orders.

await baseCoin.fundAccount(1000000, owner.keypair, connection);

await quoteCoin.fundAccount(2000000, owner.keypair, connection);

Initialize a Market

const market = await dex.initDexMarket(owner.keypair, baseCoin, quoteCoin, {
  lotSize: 1e-3,
  tickSize: 1e-2,
});

Run a Market Maker

dex.runMarketMaker(market, owner, {
  durationInSecs: 30,
  orderCount: 3,
  initialBidSize: 1000,
  baseGeckoSymbol: "solana",
  quoteGeckoSymbol: "usd",
});

Run a crank

dex.runCrank(market, owner, {
  durationInSecs: 20,
  verbose: true,
});

Keywords

solana

FAQs

Package last updated on 23 Jun 2022

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