Skip to content

Commit

Permalink
example code for users who facing issue while using the sdk
Browse files Browse the repository at this point in the history
  • Loading branch information
oselezi committed Nov 26, 2024
1 parent 70df6bf commit c930a9c
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 0 deletions.
21 changes: 21 additions & 0 deletions example/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { Connection, Keypair, PublicKey } from '@solana/web3.js';
import base58 from 'bs58';
import { createRequire } from 'module';
const require = createRequire(import.meta.url);

const SDK = require('@oselezi/solana-volume-sdk');
console.log('SDK Exports:', SDK);

const { AMM } = SDK;

// Initialize Solana connection
const connection = new Connection('https://api.mainnet-beta.solana.com');

// Your private key and mint address
const privateKeyBase58 = 'YOUR_PRIVATE_KEY';
const payerSecretKey = base58.decode(privateKeyBase58);
const payerWallet = Keypair.fromSecretKey(payerSecretKey);
const mint = new PublicKey('YOUR_TOKEN_MINT');

// Create an instance of the AMM class
const amm = new AMM(connection, payerWallet, { disableLogs: false });
24 changes: 24 additions & 0 deletions example/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"name": "solana-volume-sdk-example",
"version": "0.0.1",
"description": "Solana Auto AMM and Volume example",
"scripts": {
"start": "npx tsx index.ts"
},
"type": "module",
"author": "oselezi",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/oselezi/solana-volume-sdk.git"
},
"dependencies": {
"@oselezi/solana-volume-sdk": "^1.5.5",
"@solana/web3.js": "^1.73.0",
"bs58": "^5.0.0"
},
"devDependencies": {
"typescript": "^5.0.0"
},
"sideEffects": false
}
12 changes: 12 additions & 0 deletions example/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"compilerOptions": {
"target": "ES2020",
"module": "ESNext",
"moduleResolution": "NodeNext",
"esModuleInterop": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"skipLibCheck": true,
"allowSyntheticDefaultImports": true
}
}

0 comments on commit c930a9c

Please sign in to comment.