Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: enhance readme code highlights #23

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ $ yarn add @raydium-io/raydium-sdk-v2

### Initialization

```
```javascript
import { Raydium } from '@raydium-io/raydium-sdk'
const raydium = await Raydium.load({
connection,
Expand All @@ -37,7 +37,7 @@ const raydium = await Raydium.load({

#### how to transform token account data

```
```javascript
import { parseTokenAccountResp } from '@raydium-io/raydium-sdk'

const solAccountResp = await connection.getAccountInfo(owner.publicKey)
Expand Down Expand Up @@ -70,29 +70,29 @@ raydium.account.tokenAccountRawInfos
#### Api methods (https://github.com/raydium-io/raydium-sdk-V2/blob/master/src/api/api.ts)

- fetch raydium default mint list
```
```javascript
const data = await raydium.api.getTokenList()
```

- fetch mints recognizable by raydium
```
```javascript
const data = await raydium.api.getTokenInfo(['So11111111111111111111111111111111111111112', '4k3Dyjzvzp8eMZWUXbBCjEvwSkkk59S5iCNLY3QrkX6R'])
```

- fetch pool list
available fetch params defined here: https://github.com/raydium-io/raydium-sdk-V2/blob/master/src/api/type.ts#L249
```
```javascript
const data = await raydium.api.getPoolList({})
```

- fetch poolInfo by id
```
```javascript
// ids: join pool ids by comma(,)
const data = await raydium.api.fetchPoolById({ ids: 'AVs9TA4nWDzfPJE9gGVNJMVhcQy3V9PGazuz33BfG2RA,8sLbNZoA1cfnvMJLPfp98ZLAnFSYCFApfJKMbiXNLwxj' })
```

- fetch pool list by mints
```
```javascript
const data = await raydium.api.fetchPoolByMints({
mint1: 'So11111111111111111111111111111111111111112',
mint2: '4k3Dyjzvzp8eMZWUXbBCjEvwSkkk59S5iCNLY3QrkX6R' // optional,
Expand All @@ -101,7 +101,7 @@ const data = await raydium.api.fetchPoolByMints({
```

- fetch farmInfo by id
```
```javascript
// ids: join farm ids by comma(,)
const data = await raydium.api.fetchFarmInfoById({ ids: '4EwbZo8BZXP5313z5A2H11MRBP15M5n6YxfmkjXESKAW,HUDr9BDaAGqi37xbQHzxCyXvfMCKPTPNF8g9c9bPu1Fu' })
```
Expand Down