TypeScript IDL (Interface Definition Language) for the Xeenon Tokens Program on Solana.
This package provides the complete IDL definition for the Xeenon Tokens Program, a Solana program that enables token trading, borrowing, staking, and rewards distribution. The IDL is available in both JSON format and TypeScript types for easy integration with Solana development tools.
- Complete IDL Definition: Full interface definition for all program instructions, accounts, events, and types
- TypeScript Support: Strongly typed definitions for all program structures
- Solana Integration: Compatible with Anchor, Solana Web3.js, and other Solana development tools
- Rewards System: Support for creator and staker rewards distribution
- Trading Operations: Buy/sell operations with exact cash/token amounts
- Borrowing System: Collateralized borrowing with debt management
- Market Management: Market creation, configuration, and period management
npm install @graviton-inc/xeenon-tokens-program-idlor
yarn add @graviton-inc/xeenon-tokens-program-idlimport { idl, Tokens } from '@graviton-inc/xeenon-tokens-program-idl';
// Use the IDL with Anchor
const program = new Program<Tokens>(idl, programId, provider);
// Use the TypeScript types
const marketAccount: Tokens['accounts'][0] = // ... your market accountThe Xeenon Tokens Program ID is:
XEENqbVXt8y94cH7WMwYyQSuDgkvzZTzEzpsWLZu7Jf
initXeenonPosition: Create a user position in a market, required to stake and borrow
buyWithExactCashIn: Buy tokens with exact cash amountsellWithExactTokenIn: Sell tokens for exact cash amount
depositToken: Deposit tokens to stakewithdrawToken: Withdraw staked tokensborrow: Borrow against staked collateralrepay: Repay borrowed amount
claimCreatorRewards: Claim rewards for market creatorsclaimStakerRewards: Claim rewards for stakersaccruePositionRewards: Accrue rewards for positions for previous period. Needs to be called before depositToken, withdrawToken, or claimStakerRewards for every period that has passed and the position has been active.
xeenonMarket: Main market account with trading and staking dataxeenonMarketGroup: Market group configurationxeenonPosition: User position in a marketxeenonMarketPeriod: Period-specific rewards of a market
marketMeta: Market metadata and configurationmarketLinear: Linear market state and price curvepersonalPosition: User's personal position data
The program emits various events for tracking operations:
marketCreatedEvent: Market creationdepositEvent: Token depositswithdrawEvent: Token withdrawalsborrowEvent: Borrowing operationsrepayEvent: Repayment operationsbuyWithExactCashInEvent: Buy operationssellWithExactTokenInEvent: Sell operationsclaimCreatorRewardsEvent: Creator reward claimsclaimStakerRewardsEvent: Staker reward claimsmarketPeriodClosedEvent: Period closurefloorRaisedEvent: Floor price updates
The program includes comprehensive error handling:
6000: Insufficient Staked Balance6001: Insufficient Global Staked Balance6002: Invalid Mint Percentage Options6003: Invalid Creator Rewards Share Percentage6004: Invalid Closing Period6005: Borrow Power Exceeded6006: Insufficient Debt to Repay6007: Cannot withdraw collateral with outstanding debt6008: Invalid Period Provided6009: Invalid Next Period Provided6010: Period is not closed6011: Position period does not match market period6012: No rewards to claim6013: Arithmetic overflow
yarn buildsrc/
├── index.ts # Main exports
├── tokens.ts # TypeScript type definitions
└── tokens.json # Raw IDL JSON
The project uses TypeScript 5.5.4 with strict type checking. The build process generates both JavaScript and TypeScript declaration files.
import { Program, AnchorProvider } from '@coral-xyz/anchor';
import { idl, Tokens } from '@graviton-inc/xeenon-tokens-program-idl';
const provider = AnchorProvider.env();
const program = new Program<Tokens>(idl, programId, provider);
// Initialize a market
await program.methods
.initXeenonMarket({
name: "My Token",
symbol: "MTK",
uri: "https://example.com/metadata.json",
creatorRewardsSharePercentage: 10
})
.accounts({
payer: wallet.publicKey,
// ... other required accounts
})
.rpc();import { Connection, PublicKey, Transaction } from '@solana/web3.js';
import { idl } from '@graviton-inc/xeenon-tokens-program-idl';
// Create instruction from IDL
const instruction = await program.methods
.depositToken(new BN(1000000))
.accounts({
payer: wallet.publicKey,
// ... other accounts
})
.instruction();
const transaction = new Transaction().add(instruction);MIT License.
For questions and support, please create an issue in this repository.