From ce3d1ffe59a14dd122a47f011e7b118f5ff2fdd5 Mon Sep 17 00:00:00 2001 From: Sayantan Karmakar Date: Wed, 8 Jun 2022 19:05:01 +0530 Subject: [PATCH] updated docs, bump to v1.0.2 --- cli/Cargo.lock | 2 +- cli/Cargo.toml | 2 +- cli/README.md | 4 +++ ts/README.md | 72 +++++++++++++++++++++++-------------------------- ts/package.json | 2 +- 5 files changed, 40 insertions(+), 42 deletions(-) diff --git a/cli/Cargo.lock b/cli/Cargo.lock index 06139a4..359fdcd 100644 --- a/cli/Cargo.lock +++ b/cli/Cargo.lock @@ -2443,7 +2443,7 @@ dependencies = [ [[package]] name = "serum-dev-tools" -version = "1.0.1" +version = "1.0.2" dependencies = [ "anchor-client", "anyhow", diff --git a/cli/Cargo.toml b/cli/Cargo.toml index b9a258d..001b209 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "serum-dev-tools" -version = "1.0.1" +version = "1.0.2" edition = "2021" authors = ["Sayantan Karmakar "] homepage = "https://github.com/project-serum/serum-dev-tools" diff --git a/cli/README.md b/cli/README.md index 790e661..191a140 100644 --- a/cli/README.md +++ b/cli/README.md @@ -2,4 +2,8 @@ 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). diff --git a/ts/README.md b/ts/README.md index bad9f11..41f8e19 100644 --- a/ts/README.md +++ b/ts/README.md @@ -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. -``` +```javascript const owner = FileKeypair.generate("./scripts/keys/owner.json"); const airdropSig = await connection.requestAirdrop( - owner.keypair.publicKey, - 10 * LAMPORTS_PER_SOL, + owner.keypair.publicKey, + 10 * LAMPORTS_PER_SOL, ); await connection.confirmTransaction(airdropSig); ``` @@ -26,13 +26,17 @@ You can either, ## Get Started +``` +yarn add @project-serum/serum-dev-tools +``` + ### Initialize a `Dex` -``` +```javascript const connection = new Connection("http://localhost:8899", "confirmed"); const dexAddress = new PublicKey( - "7zo7HCQAZPRb4pYiQQ6fLjC8ssN3E8LkavVs8JUA5NMn" + "7zo7HCQAZPRb4pYiQQ6fLjC8ssN3E8LkavVs8JUA5NMn", ); const dex = new Dex(dexAddress, connection); @@ -40,21 +44,21 @@ const dex = new Dex(dexAddress, connection); ### Create `Coin` instances for your `Market` -``` +```javascript const baseCoin = await dex.createCoin( - "SAYA", - 9, - owner.keypair, - owner.keypair, - owner.keypair, + "SAYA", + 9, + owner.keypair, + owner.keypair, + owner.keypair, ); const quoteCoin = await dex.createCoin( - "SRM", - 9, - owner.keypair, - owner.keypair, - owner.keypair, + "SRM", + 9, + owner.keypair, + owner.keypair, + owner.keypair, ); // Fund the FileKeypair object to place orders. @@ -62,35 +66,25 @@ const quoteCoin = await dex.createCoin( 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, - } -); +```javascript +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", - } -); +```javascript +dex.runMarketMaker(market, owner, { + durationInSecs: 30, + orderCount: 3, + initialBidSize: 1000, + baseGeckoSymbol: "solana", + quoteGeckoSymbol: "usd", +}); ``` diff --git a/ts/package.json b/ts/package.json index bc3856b..3741425 100644 --- a/ts/package.json +++ b/ts/package.json @@ -1,6 +1,6 @@ { "name": "@project-serum/serum-dev-tools", - "version": "1.0.1", + "version": "1.0.2", "description": "developer tooling suite for building on serum", "repository": { "type": "git",