https://github.com/descartesnetwork/sen-js
The library for Sen Ecosystem
https://github.com/descartesnetwork/sen-js
Last synced: 6 months ago
JSON representation
The library for Sen Ecosystem
- Host: GitHub
- URL: https://github.com/descartesnetwork/sen-js
- Owner: DescartesNetwork
- License: mit
- Created: 2021-07-24T14:03:54.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2022-07-14T06:34:09.000Z (about 4 years ago)
- Last Synced: 2025-02-20T22:13:20.896Z (over 1 year ago)
- Language: TypeScript
- Homepage: https://descartesnetwork.github.io/sen-js/
- Size: 602 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# SEN JS
## Introduction
This library is to help developers can integrate their projects to Sentre Ecosystem easily.
Sentre is an open liquidity protocol built on Solana. It's aiming to build and open, friendly, and free environment for both DApps developers, and DeFi users.
[](https://www.npmjs.com/package/@senswap/sen-js)
[](https://www.npmjs.com/package/@senswap/sen-js)
[](https://github.com/DescartesNetwork/sen-js/blob/master/LICENSE)
## Installation
```shell
npm i @senswap/sen-js
```
## Usage
```ts
import { Swap } from '@senswap/sen-js'
// Or
// const { Swap } = require('@senswap/sen-js')
const swapProgramAddress = '4erFSLP7oBFSVC1t35jdxmbfxEhYCKfoM6XdG2BLR3UF'
const spltProgramAddress = 'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA'
const splataProgramAddress = 'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL'
const nodeUrl = 'https://api.devnet.solana.com'
const swap = new Swap(
swapProgramAddress,
spltProgramAddress,
splataProgramAddress,
nodeUrl
)
// Should be placed in an async wrapper
const poolData = await swap.getPoolData('9NodRcEmSxg2KMtPnFfzSvXGbBFXkRA4zgejhSGVpt9F')
console.log(poolData)
// {
// owner: "8UaZw2jDhJzv5V53569JbCd3bD4BnyCfBH3sjwgajGS9"
// state: 1
// mint_lpt: "EsPTPmXhwpp5XjzCms6juqgrGCAhsTEaC47Lvm29RwTF"
// taxman: "8UaZw2jDhJzv5V53569JbCd3bD4BnyCfBH3sjwgajGS9"
// mint_a: "5YwUkPdXLoujGkZuo9B4LsLKj3hdkDcfP4derpspifSJ"
// treasury_a: "J9aSEQkAF3Umy6mipq9EppLLrKWS26q5m4HaV2KG8atv"
// reserve_a: 3110702644000n
// mint_b: "27hdcZv7RtuMp75vupThR3T4KLsL61t476eosMdoec4c"
// treasury_b: "9s2NgRPn4f7X6Kng4x8JEDcZ9kwphFg1kPD4oLQFEbM7"
// reserve_b: 4570811590939n
// fee_ratio: 2500000n
// tax_ratio: 0n
// }
```
## Testing
```shell
npm test
```
## Related works
### Soprox ABI
* https://www.npmjs.com/package/soprox-abi
* https://soprox.descartes.network/development/soproxabi
### SenHub
* https://docs.sentre.io/