v1.0.0 final changes
This commit is contained in:
parent
b844766d2b
commit
c808fb572b
|
@ -2443,7 +2443,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "serum-dev-tools"
|
||||
version = "0.0.4"
|
||||
version = "1.0.0"
|
||||
dependencies = [
|
||||
"anchor-client",
|
||||
"anyhow",
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
[package]
|
||||
name = "serum-dev-tools"
|
||||
version = "0.0.4"
|
||||
version = "1.0.0"
|
||||
edition = "2021"
|
||||
authors = ["Sayantan Karmakar <sayantankarmakar@outlook.com>"]
|
||||
homepage = "https://github.com/project-serum/serum-dev-tools"
|
||||
repository = "https://github.com/project-serum/serum-dev-tools"
|
||||
description = "Developer Tooling Suite for building on Serum Dex"
|
||||
license = "Apache-2.0"
|
||||
keywords = ["solana", "project-serum", "serum-dex", "devtools"]
|
||||
keywords = ["solana", "project-serum", "serum-dex", "developer", "tools", "dex"]
|
||||
|
||||
[[bin]]
|
||||
name = "serum-dev-tools"
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# Serum DevTools 🛠️
|
||||
|
||||
A developer tooling SDK for building on [serum-dex](https://github.com/project-serum/serum-dex/).
|
||||
A developer tooling CLI for building on [serum-dex](https://github.com/project-serum/serum-dex/).
|
||||
|
||||
To get started, check out this guide [here](https://sayantanxyz.hashnode.dev/serum-dev-tools).
|
||||
|
|
|
@ -15,7 +15,7 @@ use crate::{
|
|||
pub fn deploy(
|
||||
cfg_override: &ConfigOverride,
|
||||
cluster: Cluster,
|
||||
script: Option<String>,
|
||||
command: Option<String>,
|
||||
) -> Result<()> {
|
||||
with_config(cfg_override, |cfg| {
|
||||
if !is_initialized() {
|
||||
|
@ -51,10 +51,10 @@ pub fn deploy(
|
|||
|
||||
println!("Deploy Successful");
|
||||
|
||||
if script.is_some() {
|
||||
if command.is_some() {
|
||||
let script_exit = std::process::Command::new("bash")
|
||||
.arg("-c")
|
||||
.arg(script.unwrap())
|
||||
.arg(command.unwrap())
|
||||
.stdout(Stdio::inherit())
|
||||
.stderr(Stdio::inherit())
|
||||
.output()
|
||||
|
|
|
@ -29,9 +29,9 @@ pub enum Command {
|
|||
/// The cluster to deploy to
|
||||
cluster: Cluster,
|
||||
|
||||
/// The script to run after deploying
|
||||
/// The command to run after deploying
|
||||
#[clap(long)]
|
||||
script: Option<String>,
|
||||
command: Option<String>,
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -39,8 +39,8 @@ pub fn entry(opts: Opts) -> Result<()> {
|
|||
match opts.command {
|
||||
Command::Init => commands::init(),
|
||||
Command::Instance => commands::instance(),
|
||||
Command::Deploy { cluster, script } => {
|
||||
commands::deploy(&opts.cfg_override, cluster, script)
|
||||
Command::Deploy { cluster, command } => {
|
||||
commands::deploy(&opts.cfg_override, cluster, command)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -75,8 +75,6 @@ const market = await dex.initDexMarket(
|
|||
{
|
||||
lotSize: 1e-3,
|
||||
tickSize: 1e-2,
|
||||
feeRate: 10,
|
||||
quoteDustThreshold: new BN(100),
|
||||
}
|
||||
);
|
||||
```
|
||||
|
@ -88,7 +86,6 @@ dex.runMarketMaker(
|
|||
market,
|
||||
owner,
|
||||
{
|
||||
unref: true,
|
||||
durationInSecs: 30,
|
||||
orderCount: 3,
|
||||
initialBidSize: 1000,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@project-serum/serum-dev-tools",
|
||||
"version": "0.0.6",
|
||||
"version": "1.0.0",
|
||||
"description": "developer tooling suite for building on serum",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
@ -10,6 +10,14 @@
|
|||
"module": "./dist/index.js",
|
||||
"types": "./dist/index.d.ts",
|
||||
"author": "Sayantan Karmakar",
|
||||
"keywords": [
|
||||
"solana",
|
||||
"serum",
|
||||
"developer",
|
||||
"tools",
|
||||
"serum-dex",
|
||||
"project-serum"
|
||||
],
|
||||
"license": "MIT",
|
||||
"files": [
|
||||
"dist"
|
||||
|
|
|
@ -32,6 +32,13 @@ export class Coin {
|
|||
this.freezeAuthority = freezeAuthority;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the token balance for the specified owner.
|
||||
*
|
||||
* @param owner The `Keypair` whose balance to fetch.
|
||||
* @param connection The `Connection` object to connect to Solana.
|
||||
* @returns
|
||||
*/
|
||||
public async getBalance(
|
||||
owner: Keypair,
|
||||
connection: Connection,
|
||||
|
@ -53,6 +60,13 @@ export class Coin {
|
|||
return tokenAmount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fund the owner key-pair with the specified amount of this coin.
|
||||
*
|
||||
* @param decimalAmount The amount of tokens to fund account with, in decimal notation.
|
||||
* @param owner The `Keypair` to fund.
|
||||
* @param connection The `Connection` object to connect to Solana.
|
||||
*/
|
||||
public async fundAccount(
|
||||
decimalAmount: number,
|
||||
owner: Keypair,
|
||||
|
|
|
@ -1,11 +1,14 @@
|
|||
import { Keypair } from "@solana/web3.js";
|
||||
import fs from "fs";
|
||||
|
||||
/**
|
||||
* A wrapper class around @solana/web3.js `Keypair` that allows persisting key-pairs in your local filesystem.
|
||||
*/
|
||||
export class FileKeypair {
|
||||
public filePath: string;
|
||||
public keypair: Keypair;
|
||||
|
||||
constructor(filePath: string, keypair: Keypair) {
|
||||
private constructor(filePath: string, keypair: Keypair) {
|
||||
this.filePath = filePath;
|
||||
this.keypair = keypair;
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ export class DexMarket {
|
|||
|
||||
private _marketSymbol: string;
|
||||
|
||||
constructor(
|
||||
private constructor(
|
||||
address: PublicKey,
|
||||
serumMarket: Market,
|
||||
baseCoin: Coin,
|
||||
|
@ -273,7 +273,7 @@ export class DexMarket {
|
|||
* Create a `Transaction` object for placing an order.
|
||||
*
|
||||
* @param connection The `Connection` object to connect to Solana.
|
||||
* @param owner The `PublicKey` of the owner of the order.
|
||||
* @param owner The `Keypair` of the owner of the order.
|
||||
* @param serumMarket The `Market` object from `serum-ts` package.
|
||||
* @param side The `Side` of the order.
|
||||
* @param orderType The `OrderType` of the order.
|
||||
|
@ -359,7 +359,7 @@ export class DexMarket {
|
|||
* Place an order on the DexMarket.
|
||||
*
|
||||
* @param connection The `Connection` object to connect to Solana.
|
||||
* @param owner The `PublicKey` of the owner of the order.
|
||||
* @param owner The `Keypair` of the owner of the order.
|
||||
* @param serumMarket The `Market` object from `serum-ts` package.
|
||||
* @param side The `Side` of the order.
|
||||
* @param orderType The `OrderType` of the order.
|
||||
|
@ -396,7 +396,7 @@ export class DexMarket {
|
|||
* Create a `Transaction` object for cancelling an order.
|
||||
*
|
||||
* @param connection The `Connection` object to connect to Solana.
|
||||
* @param owner The `PublicKey` of the owner of the order.
|
||||
* @param owner The `Keypair` of the owner of the order.
|
||||
* @param serumMarket The `Market` object from `serum-ts` package.
|
||||
* @param order The `Order` object to cancel.
|
||||
* @returns
|
||||
|
@ -447,6 +447,14 @@ export class DexMarket {
|
|||
return txSig;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all orders placed by a keypair.
|
||||
*
|
||||
* @param owner The `Keypair` for which orders have to be fetched.
|
||||
* @param serumMarket The `Market` object from `serum-ts` package.
|
||||
* @param connection The `Connection` object to connect to Solana.
|
||||
* @returns
|
||||
*/
|
||||
static async getOrdersForOwner(
|
||||
owner: Keypair,
|
||||
serumMarket: SerumMarket,
|
||||
|
@ -460,6 +468,14 @@ export class DexMarket {
|
|||
return orders;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get or create an OpenOrder account for the specified owner.
|
||||
*
|
||||
* @param owner The `Keypair` for which OpenOrders account is required.
|
||||
* @param serumMarket The `Market` object from `serum-ts` package.
|
||||
* @param connection The `Connection` object to connect to Solana.
|
||||
* @returns
|
||||
*/
|
||||
static async getOrCreateOpenOrderAccount(
|
||||
owner: Keypair,
|
||||
serumMarket: SerumMarket,
|
||||
|
|
Loading…
Reference in New Issue