https://github.com/descartesnetwork/otc-sdk
✨ Solana OTC Service SDK
https://github.com/descartesnetwork/otc-sdk
Last synced: 12 months ago
JSON representation
✨ Solana OTC Service SDK
- Host: GitHub
- URL: https://github.com/descartesnetwork/otc-sdk
- Owner: DescartesNetwork
- License: mit
- Created: 2022-07-13T11:04:13.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2022-11-20T07:57:42.000Z (over 3 years ago)
- Last Synced: 2025-07-25T13:56:40.031Z (12 months ago)
- Language: TypeScript
- Homepage: https://otc.sentre.io
- Size: 110 KB
- Stars: 0
- Watchers: 0
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# OTC SDK
[](https://www.npmjs.com/package/@sentre/otc-sdk)
[](https://www.npmjs.com/package/@sentre/otc-sdk)
[](https://www.npmjs.com/package/@sentre/otc-sdk)
[](https://github.com/DescartesNetwork/otc-sdk)
[](https://github.com/DescartesNetwork/otc-sdk)
[](https://twitter.com/SentreProtocol)
Solana OTC Service SDK. Users can exchange SPL tokens for SOL even with no SOL for transaction fees. Currently, the service is available on **mainnet ONLY**.
✨ Receive exactly desired amount of SOL. No slippage. No price impact.
✨ Never care about transaction fees.
✨ Zero down time.
## Installation
```bash
npm i @sentre/otc-sdk
```
or,
```bash
yarn add @sentre/otc-sdk
```
## Who are using?
1. [Any Arts](https://hub.sentre.io/app/any_arts?autoInstall=true) - Buy NFTs on [Magic Eden](https://magiceden.io/) by your SPL tokens.
2. [Sen Assets](https://hub.sentre.io/app/sen_assets?autoInstall=true) - Feel annoying to withdraw SOL from [Binance](https://www.binance.com/) for transaction fees on [Solana](https://solana.com/)? This app will let you exchange SPL tokens to SOL with no transaction fees.
## Usage
```ts
import { OTC } from '@sentre/otc-sdk'
const otc = new OTC()
/**
* Get whitelisted spl tokens
* You can quick review whitelist by: https://cors.sentre.io/otc/whitelist
*/
const whitelist = await otc.getWhitelist()
// {
// usdc: {
// address: 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v',
// symbol: 'USDC',
// decimals: 6,
// url: 'https://www.circle.com/en/usdc',
// },
// uxd: {
// address: '7kbnvuGBxxj8AG9qp8Scn56muWGaRaFqxg1FsRp3PaFT',
// symbol: 'UXD',
// decimals: 6,
// url: 'https://uxd.fi/',
// }
// }
/**
* Get SOL price based on USDC or UXD
*/
const solPriceBasedOnUSDC = await otc.getSolPrice({ tokenSymbol: 'usdc' })
// {
// data: {
// id: 'So11111111111111111111111111111111111111112',
// mintSymbol: 'SOL',
// vsToken: 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v',
// vsTokenSymbol: 'USDC',
// price: 34.968693228,
// },
// timeTaken: 0.047694273001980036,
// }
const solPriceBasedOnUXD = await otc.getSolPrice({ tokenSymbol: 'uxd' })
// {
// data: {
// id: 'So11111111111111111111111111111111111111112',
// mintSymbol: 'SOL',
// vsToken: '7kbnvuGBxxj8AG9qp8Scn56muWGaRaFqxg1FsRp3PaFT',
// vsTokenSymbol: 'UXD',
// price: 34.972632341,
// },
// timeTaken: 0.010716108001361135,
// }
/**
* Get exchange tx of usdc for 1 sol
*/
const wallet =
const tx = await otc.exchange({
walletAddress: wallet.publicKey.toBase58(),
tokenSymbol: 'usdc',
solAmount: 1
})
const signedTx = await wallet.signTransaction(tx)
const txId = await sendTransaction(signedTx) // This function is just a pseudo-code and should replaced it by yours.
```
## Whitelist
👉 Current whitelist: [https://cors.sentre.io/otc/whitelist](https://cors.sentre.io/otc/whitelist)
👉 Wanna support more SPL tokens? Let's create a proposal here: [https://github.com/DescartesNetwork/otc-sdk](https://github.com/DescartesNetwork/otc-sdk/issues)