updated docs, bump to v1.0.2

This commit is contained in:
Sayantan Karmakar 2022-06-08 19:05:01 +05:30
parent 51c3f1f871
commit ce3d1ffe59
5 changed files with 40 additions and 42 deletions

2
cli/Cargo.lock generated
View File

@ -2443,7 +2443,7 @@ dependencies = [
[[package]] [[package]]
name = "serum-dev-tools" name = "serum-dev-tools"
version = "1.0.1" version = "1.0.2"
dependencies = [ dependencies = [
"anchor-client", "anchor-client",
"anyhow", "anyhow",

View File

@ -1,6 +1,6 @@
[package] [package]
name = "serum-dev-tools" name = "serum-dev-tools"
version = "1.0.1" version = "1.0.2"
edition = "2021" edition = "2021"
authors = ["Sayantan Karmakar <sayantankarmakar@outlook.com>"] authors = ["Sayantan Karmakar <sayantankarmakar@outlook.com>"]
homepage = "https://github.com/project-serum/serum-dev-tools" homepage = "https://github.com/project-serum/serum-dev-tools"

View File

@ -2,4 +2,8 @@
A developer tooling CLI 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/).
```
cargo install serum-dev-tools
```
To get started, check out this guide [here](https://sayantanxyz.hashnode.dev/serum-dev-tools). To get started, check out this guide [here](https://sayantanxyz.hashnode.dev/serum-dev-tools).

View File

@ -6,12 +6,12 @@ A developer tooling SDK for building on [serum-dex](https://github.com/project-s
You will need to use the `FileKeypair` class that extends the [`Keypair`](https://solana-labs.github.io/solana-web3.js/classes/Keypair.html) class from [`@solana/web3.js`](https://npmjs.com/package/@solana/web3.js) to provide easy file-based keypair management, which is required for the market making features provided by this package. You will need to use the `FileKeypair` class that extends the [`Keypair`](https://solana-labs.github.io/solana-web3.js/classes/Keypair.html) class from [`@solana/web3.js`](https://npmjs.com/package/@solana/web3.js) to provide easy file-based keypair management, which is required for the market making features provided by this package.
``` ```javascript
const owner = FileKeypair.generate("./scripts/keys/owner.json"); const owner = FileKeypair.generate("./scripts/keys/owner.json");
const airdropSig = await connection.requestAirdrop( const airdropSig = await connection.requestAirdrop(
owner.keypair.publicKey, owner.keypair.publicKey,
10 * LAMPORTS_PER_SOL, 10 * LAMPORTS_PER_SOL,
); );
await connection.confirmTransaction(airdropSig); await connection.confirmTransaction(airdropSig);
``` ```
@ -26,13 +26,17 @@ You can either,
## Get Started ## Get Started
```
yarn add @project-serum/serum-dev-tools
```
### Initialize a `Dex` ### Initialize a `Dex`
``` ```javascript
const connection = new Connection("http://localhost:8899", "confirmed"); const connection = new Connection("http://localhost:8899", "confirmed");
const dexAddress = new PublicKey( const dexAddress = new PublicKey(
"7zo7HCQAZPRb4pYiQQ6fLjC8ssN3E8LkavVs8JUA5NMn" "7zo7HCQAZPRb4pYiQQ6fLjC8ssN3E8LkavVs8JUA5NMn",
); );
const dex = new Dex(dexAddress, connection); const dex = new Dex(dexAddress, connection);
@ -40,21 +44,21 @@ const dex = new Dex(dexAddress, connection);
### Create `Coin` instances for your `Market` ### Create `Coin` instances for your `Market`
``` ```javascript
const baseCoin = await dex.createCoin( const baseCoin = await dex.createCoin(
"SAYA", "SAYA",
9, 9,
owner.keypair, owner.keypair,
owner.keypair, owner.keypair,
owner.keypair, owner.keypair,
); );
const quoteCoin = await dex.createCoin( const quoteCoin = await dex.createCoin(
"SRM", "SRM",
9, 9,
owner.keypair, owner.keypair,
owner.keypair, owner.keypair,
owner.keypair, owner.keypair,
); );
// Fund the FileKeypair object to place orders. // Fund the FileKeypair object to place orders.
@ -62,35 +66,25 @@ const quoteCoin = await dex.createCoin(
await baseCoin.fundAccount(1000000, owner.keypair, connection); await baseCoin.fundAccount(1000000, owner.keypair, connection);
await quoteCoin.fundAccount(2000000, owner.keypair, connection); await quoteCoin.fundAccount(2000000, owner.keypair, connection);
``` ```
### Initialize a `Market` ### Initialize a `Market`
``` ```javascript
const market = await dex.initDexMarket( const market = await dex.initDexMarket(owner.keypair, baseCoin, quoteCoin, {
owner.keypair, lotSize: 1e-3,
baseCoin, tickSize: 1e-2,
quoteCoin, });
{
lotSize: 1e-3,
tickSize: 1e-2,
}
);
``` ```
### Run a Market Maker ### Run a Market Maker
``` ```javascript
dex.runMarketMaker( dex.runMarketMaker(market, owner, {
market, durationInSecs: 30,
owner, orderCount: 3,
{ initialBidSize: 1000,
durationInSecs: 30, baseGeckoSymbol: "solana",
orderCount: 3, quoteGeckoSymbol: "usd",
initialBidSize: 1000, });
baseGeckoSymbol: "solana",
quoteGeckoSymbol: "usd",
}
);
``` ```

View File

@ -1,6 +1,6 @@
{ {
"name": "@project-serum/serum-dev-tools", "name": "@project-serum/serum-dev-tools",
"version": "1.0.1", "version": "1.0.2",
"description": "developer tooling suite for building on serum", "description": "developer tooling suite for building on serum",
"repository": { "repository": {
"type": "git", "type": "git",