https://github.com/descartesnetwork/sen-otc-prog
https://github.com/descartesnetwork/sen-otc-prog
Last synced: about 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/descartesnetwork/sen-otc-prog
- Owner: DescartesNetwork
- License: mit
- Created: 2022-11-18T02:24:12.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2023-07-25T13:16:11.000Z (almost 3 years ago)
- Last Synced: 2025-07-01T04:08:20.259Z (about 1 year ago)
- Language: TypeScript
- Size: 182 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# OTC
## IMPORTANT!
In this program, we will use strict conventions that
- `a` is the amount of token `A` that the MAKER wants to sell.
- `b` is the amount of token `B` that the MAKER wants to buy.
- `x` is the amount of token `A` that a TAKER takes out of the treasury.
- `y` is the amount of token `B` that a TAKER puts in of the treasury.
- `maker_fee` is always about the token `B`.
- `taker_fee` is always about the token `A`.
## Installation
```bash
npm i @sentre/otc
```
or,
```bash
yarn add @sentre/otc
```
## Usage
```js
import Otc, { DEFAULT_OTC_PROGRAM_ID, DEFAULT_RPC_ENDPOINT } from '@sentre/otc'
import { Wallet, web3 } from '@project-serum/anchor'
const wallet = new Wallet(web3.Keypair.generate())
const otc = new Otc(wallet, DEFAULT_RPC_ENDPOINT, DEFAULT_OTC_PROGRAM_ID)
const order = await otc.getOrderData(
'9EKdURf9kaR8yeu9sWSiGQaeMz59zfigQe4mcfsGnLW8',
)
```