{"_id":"@alteredgene445/pnp-sdk","name":"@alteredgene445/pnp-sdk","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@alteredgene445/pnp-sdk","version":"0.1.0","private":false,"license":"Apache-2.0","type":"module","main":"dist/index.cjs","module":"dist/index.js","types":"dist/index.d.ts","bin":{"pnp":"dist/cli.cjs"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"}},"publishConfig":{"access":"public"},"sideEffects":false,"scripts":{"build":"tsup","clean":"rm -rf dist","dev":"tsup --watch","typecheck":"tsc --noEmit","lint":"eslint .","format":"prettier -w .","test":"vitest run","test:watch":"vitest","docs":"typedoc","example:market":"tsx examples/create-market.ts","api:server":"tsx examples/market-api-server.ts","status:market":"tsx scripts/market-status.ts","proxy:markets":"tsx scripts/getMarketProxy.ts","proxy:settlement":"node dist/cli.cjs settlementCritera","market:info":"tsx scripts/market-info.ts","market:redeem":"tsx scripts/redeemPosition.ts","dev:test":"tsx src/dev-test.ts"},"dependencies":{"@coral-xyz/anchor":">=0.29.0","@solana/spl-token":"^0.4.6","@solana/web3.js":"^1.95.1","@types/express":"^5.0.3","bn.js":"^5.2.2","bs58":"^5.0.0","chalk":"^5.3.0","dotenv":"^17.2.1","express":"^5.1.0","zod":"^3.23.8"},"peerDependencies":{"@coral-xyz/anchor":">=0.29.0"},"devDependencies":{"@coral-xyz/anchor":"^0.31.1","@types/bn.js":"^5.2.0","@types/node":"^22.7.4","@typescript-eslint/eslint-plugin":"^8.7.0","@typescript-eslint/parser":"^8.7.0","dotenv-cli":"^10.0.0","eslint":"^9.12.0","eslint-config-prettier":"^9.1.0","eslint-plugin-import":"^2.29.1","prettier":"^3.3.3","tsup":"^8.2.4","tsx":"^4.20.5","typedoc":"^0.25.13","typescript":"5.4.5","vitest":"^2.1.1"},"_id":"@alteredgene445/pnp-sdk@0.1.0","gitHead":"dec46c20971cc97317276aa4c9adc1f5779205bc","description":"Production-ready SDK skeleton for Solana markets: create market, trade, and redeem position.","_nodeVersion":"23.6.1","_npmVersion":"10.9.2","dist":{"integrity":"sha512-526VwznTLiwo6oG/sboVF/JufpvrusCZu6QS8pXy1yvI/2/NSZE1nleaywYrAEMu+JuW328HeBUDdX7DY35iPg==","shasum":"07c22690f811c28d928177077b2a26faf593a26f","tarball":"https://registry.npmjs.org/@alteredgene445/pnp-sdk/-/pnp-sdk-0.1.0.tgz","fileCount":16,"unpackedSize":1882393,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQD9Y1bKZwh0DHwNxsN5u5exxiDYG8oGymXR3v7JJZqAZwIhAJ7xOFNPH3XN6qT5Nb8dxSV+v3KCpaks/EXgJRCCcreO"}]},"_npmUser":{"name":"alteredgene445","email":"darpit009@gmail.com"},"directories":{},"maintainers":[{"name":"alteredgene445","email":"darpit009@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/pnp-sdk_0.1.0_1758957319884_0.8248344779792363"},"_hasShrinkwrap":false}},"time":{"created":"2025-09-27T07:15:19.772Z","0.1.0":"2025-09-27T07:15:20.181Z","modified":"2025-09-27T07:15:20.512Z"},"maintainers":[{"name":"alteredgene445","email":"darpit009@gmail.com"}],"description":"Production-ready SDK skeleton for Solana markets: create market, trade, and redeem position.","license":"Apache-2.0","readme":"# @pnp-sdk\n\nProduction-ready SDK skeleton for Solana markets: create market, trade, and redeem position.\n\nNOTE: Instruction builders are placeholders. Provide your program IDL or Borsh layouts to wire real data.\n\n## Install\n\n```bash\nnpm i @pnp-sdk\n```\n\n## Usage (Node)\n\n### Environment Setup\n\nCreate a `.env` file with the following variables:\n\n```env\n# Solana RPC URL (mainnet, devnet, testnet, or local)\nRPC_URL=https://api.devnet.solana.com\n\n# Wallet private key (as Base58 string or array)\nWALLET_SECRET_BASE58=YourBase58EncodedPrivateKeyHere\n# OR as array\nWALLET_SECRET_ARRAY=[38,217,47,162,6,...] # your array of numbers\n\n# Program ID is embedded in the program IDL; no env needed\n\n# Optional: Mint addresses for market creation\nBASE_MINT=YourBaseMintAddressHere\nQUOTE_MINT=YourQuoteMintAddressHere\n```\n\n### With Base58 Private Key\n\n```ts\nimport { PNPClient } from \"@pnp-sdk\";\nimport bs58 from \"bs58\";\nimport * as dotenv from \"dotenv\";\n\ndotenv.config();\n\nconst maybePk = process.env.WALLET_SECRET_BASE58 ? bs58.decode(process.env.WALLET_SECRET_BASE58) : undefined;\nconst client = new PNPClient(process.env.RPC_URL!, maybePk);\n\n// Read-only\nconst global = await client.fetchGlobalConfig();\n// With private key present, you can access write modules:\n// await client.trading!.buyTokensUsdc(...)\n```\n\n### With Private Key Array\n\n```ts\nimport { PNPClient } from \"@pnp-sdk\";\nimport * as dotenv from \"dotenv\";\n\ndotenv.config();\n\nconst privateKeyArray = JSON.parse(process.env.WALLET_SECRET_ARRAY!);\nconst privateKeyBytes = new Uint8Array(privateKeyArray);\nconst client = new PNPClient(process.env.RPC_URL!, privateKeyBytes);\n```\n\n## Development\n\n- Build: `npm run build`\n- Test: `npm test`\n- Typecheck: `npm run typecheck`\n\n## REST API Server\n\nThe SDK includes an Express server implementation that allows you to create markets via HTTP endpoints:\n\n```bash\n# Start the API server\nnpm run api:server\n\n# Access the API at http://localhost:3000\n```\n\n### API Endpoints\n\n- `GET /health` - Health check endpoint\n- `POST /create-market` - Create a new market\n  - Request body: `{ \"question\": \"Your market question here\" }`\n\n### Command Line Interface\n\nYou can also create markets directly from the command line:\n\n```bash\n# Create a market with a specific question\nnpm run api:server \"Will this market prediction come true?\"\n```\n\n### Example Response\n\n```json\n{\n  \"success\": true,\n  \"txSignature\": \"2NPJ3NCuP1EZpN8DAwyjUgKJbRNZ6ZzmLSz8gXq3wMARMjeY3Y8xpGKUQo4hjiP7eoqAa6bHLNvWUbHMRGZ1sk9n\",\n  \"market\": \"CL9tjeJL38C3KyVvUxSHiiMzfvvB6gNn6TCweE9TH45t\",\n  \"yesTokenMint\": \"BzPKqzBNKw3hjj7BNn6oT7GXG3LKv7R1mFQby5bAYvdG\",\n  \"noTokenMint\": \"5ctuKQpZMQ2HoMvjXZHxAT3QxCN5mq8Ss1U5YCvFg8aZ\",\n  \"marketDetails\": {\n    \"id\": \"42\",\n    \"question\": \"Will this market prediction come true?\",\n    \"creator\": \"BUbQNJKKRvZesSPbgJyw1nHDRNMn7demZjcaqWpLXcFe\",\n    \"initialLiquidity\": \"50000000\",\n    \"marketReserves\": \"50000000\",\n    \"yesTokenSupply\": \"50000000\",\n    \"noTokenSupply\": \"50000000\",\n    \"endTime\": \"2025-08-27T19:12:28.000Z\",\n    \"resolved\": false\n  }\n}\n```\n\n## Next steps\n\n- Replace placeholder instruction data encodings with your program's IDL/Borsh schemas.\n- Add account metas per instruction (vaults, ATAs, mints, PDAs).\n- Expand tests to integration against `solana-test-validator`.\n","readmeFilename":"README.md","_rev":"1-38f62544040922bdb82a3de0a3751489"}