onchain-devex 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Solana DevEx Platform Team
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,83 @@
1
+ # onchain-devex
2
+
3
+ TypeScript SDK for CPI debugging on Solana. Parse any mainnet transaction into a detailed execution trace with cross-program invocation analysis, error diagnostics, and performance metrics.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ npm install onchain-devex @solana/web3.js
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ### Debug a Transaction via Platform API
14
+
15
+ ```typescript
16
+ import { SolanaDevExClient } from 'onchain-devex';
17
+
18
+ const client = new SolanaDevExClient();
19
+
20
+ const result = await client.debugTransaction(
21
+ '5KSSXcvFCi3HHbgDJkbMz3mwwtzkvVjv78Qik9JUfx9Xkgca7AZBQqBBaVYVocRY1zKBVH4xic7FwWDvnsCqHwYD'
22
+ );
23
+
24
+ // CPI execution trace
25
+ result.cpiFlow?.forEach(step => {
26
+ console.log(`${step.program} → ${step.instruction} (${step.computeUnits} CU)`);
27
+ });
28
+
29
+ // Error diagnostics with fix suggestions
30
+ result.errors?.forEach(err => {
31
+ console.log(`${err.severity}: ${err.message}`);
32
+ console.log(`Fix: ${err.suggestedFix}`);
33
+ });
34
+
35
+ // Performance: compute units, fees, efficiency
36
+ console.log(result.performance);
37
+ ```
38
+
39
+ ### Direct RPC (No Platform Dependency)
40
+
41
+ Use Solana RPC utilities directly — no API key, no platform needed:
42
+
43
+ ```typescript
44
+ import {
45
+ SolanaRpcClient,
46
+ getTransactionDetails,
47
+ parseTransactionForCPI,
48
+ analyzeTransactionErrors
49
+ } from 'onchain-devex';
50
+
51
+ // Full RPC client
52
+ const rpc = new SolanaRpcClient('https://api.mainnet-beta.solana.com');
53
+ const details = await rpc.getTransactionDetails('tx-signature');
54
+
55
+ // Or standalone functions
56
+ const tx = await getTransactionDetails('tx-signature');
57
+ const cpiTrace = parseTransactionForCPI(tx);
58
+ const errors = analyzeTransactionErrors(tx);
59
+ ```
60
+
61
+ ## Configuration
62
+
63
+ ```typescript
64
+ const client = new SolanaDevExClient({
65
+ apiUrl: 'https://onchain-devex.tools', // default
66
+ timeout: 30000,
67
+ retryAttempts: 3,
68
+ enableCaching: true
69
+ });
70
+ ```
71
+
72
+ ## What This Does
73
+
74
+ - Fetches real Solana mainnet transaction data
75
+ - Parses cross-program invocations into a readable trace
76
+ - Identifies errors with severity levels and suggested fixes
77
+ - Reports compute unit usage, fees, and efficiency metrics
78
+ - Caches results to reduce RPC calls
79
+ - Works with any Solana transaction signature
80
+
81
+ ## License
82
+
83
+ MIT
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Main SDK Client for Solana DevEx Platform
3
+ * Provides typed methods to interact with the platform's APIs
4
+ */
5
+ import { SolanaDevExConfig, DebugResult } from './types';
6
+ /**
7
+ * Client for the Solana DevEx Platform API
8
+ *
9
+ * @example
10
+ * ```typescript
11
+ * const client = new SolanaDevExClient();
12
+ * const result = await client.debugTransaction('your-tx-signature');
13
+ * console.log(result.cpiFlow);
14
+ * ```
15
+ */
16
+ export declare class SolanaDevExClient {
17
+ private config;
18
+ private cache;
19
+ constructor(config?: SolanaDevExConfig);
20
+ /**
21
+ * Debug a Solana transaction by signature.
22
+ * Fetches real mainnet data via the platform's RPC integration.
23
+ *
24
+ * @param signature - Base58 transaction signature
25
+ * @returns Detailed debugging info: CPI flow, errors, performance, metadata
26
+ */
27
+ debugTransaction(signature: string): Promise<DebugResult>;
28
+ updateConfig(config: Partial<SolanaDevExConfig>): void;
29
+ getConfig(): Omit<SolanaDevExConfig, 'apiKey'>;
30
+ clearCache(): void;
31
+ private makeRequest;
32
+ private getFromCache;
33
+ private setCache;
34
+ private validateConfig;
35
+ private validateSignature;
36
+ private delay;
37
+ }
38
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACL,iBAAiB,EACjB,WAAW,EAMZ,MAAM,SAAS,CAAC;AAsBjB;;;;;;;;;GASG;AACH,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,MAAM,CAA8B;IAC5C,OAAO,CAAC,KAAK,CAA6D;gBAE9D,MAAM,GAAE,iBAAsB;IAM1C;;;;;;OAMG;IACG,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IA2B/D,YAAY,CAAC,MAAM,EAAE,OAAO,CAAC,iBAAiB,CAAC,GAAG,IAAI;IAMtD,SAAS,IAAI,IAAI,CAAC,iBAAiB,EAAE,QAAQ,CAAC;IAK9C,UAAU,IAAI,IAAI;YAMJ,WAAW;IAwDzB,OAAO,CAAC,YAAY;IAWpB,OAAO,CAAC,QAAQ;IAKhB,OAAO,CAAC,cAAc;IAMtB,OAAO,CAAC,iBAAiB;IAMzB,OAAO,CAAC,KAAK;CAGd"}
package/dist/client.js ADDED
@@ -0,0 +1,187 @@
1
+ "use strict";
2
+ /**
3
+ * Main SDK Client for Solana DevEx Platform
4
+ * Provides typed methods to interact with the platform's APIs
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.SolanaDevExClient = void 0;
8
+ const types_1 = require("./types");
9
+ let globalFetch;
10
+ if (typeof fetch === 'undefined') {
11
+ try {
12
+ globalFetch = require('cross-fetch');
13
+ }
14
+ catch {
15
+ throw new Error('Fetch is not available. Please install cross-fetch or use Node.js 18+.');
16
+ }
17
+ }
18
+ else {
19
+ globalFetch = fetch;
20
+ }
21
+ const DEFAULT_CONFIG = {
22
+ apiUrl: 'https://onchain-devex.tools',
23
+ rpcEndpoint: 'https://api.mainnet-beta.solana.com',
24
+ apiKey: '',
25
+ timeout: 30000,
26
+ retryAttempts: 3,
27
+ enableCaching: true
28
+ };
29
+ /**
30
+ * Client for the Solana DevEx Platform API
31
+ *
32
+ * @example
33
+ * ```typescript
34
+ * const client = new SolanaDevExClient();
35
+ * const result = await client.debugTransaction('your-tx-signature');
36
+ * console.log(result.cpiFlow);
37
+ * ```
38
+ */
39
+ class SolanaDevExClient {
40
+ constructor(config = {}) {
41
+ Object.defineProperty(this, "config", {
42
+ enumerable: true,
43
+ configurable: true,
44
+ writable: true,
45
+ value: void 0
46
+ });
47
+ Object.defineProperty(this, "cache", {
48
+ enumerable: true,
49
+ configurable: true,
50
+ writable: true,
51
+ value: void 0
52
+ });
53
+ this.config = { ...DEFAULT_CONFIG, ...config };
54
+ this.cache = new Map();
55
+ this.validateConfig();
56
+ }
57
+ /**
58
+ * Debug a Solana transaction by signature.
59
+ * Fetches real mainnet data via the platform's RPC integration.
60
+ *
61
+ * @param signature - Base58 transaction signature
62
+ * @returns Detailed debugging info: CPI flow, errors, performance, metadata
63
+ */
64
+ async debugTransaction(signature) {
65
+ this.validateSignature(signature);
66
+ const cacheKey = `debug:${signature}`;
67
+ const cached = this.getFromCache(cacheKey);
68
+ if (cached)
69
+ return cached;
70
+ try {
71
+ const response = await this.makeRequest('POST', '/api/debug-transaction', {
72
+ signature
73
+ });
74
+ if (response.success && response.data) {
75
+ this.setCache(cacheKey, response.data, 300000); // 5 min
76
+ return response.data;
77
+ }
78
+ throw new types_1.SolanaDevExError(response.error || 'Failed to debug transaction', 'DEBUG_FAILED');
79
+ }
80
+ catch (error) {
81
+ if (error instanceof types_1.SolanaDevExError)
82
+ throw error;
83
+ throw new types_1.NetworkError(`Transaction debugging failed: ${error instanceof Error ? error.message : 'Unknown error'}`);
84
+ }
85
+ }
86
+ updateConfig(config) {
87
+ this.config = { ...this.config, ...config };
88
+ this.validateConfig();
89
+ if (config.apiUrl)
90
+ this.clearCache();
91
+ }
92
+ getConfig() {
93
+ const { apiKey, ...safeConfig } = this.config;
94
+ return safeConfig;
95
+ }
96
+ clearCache() {
97
+ this.cache.clear();
98
+ }
99
+ // --- Private methods ---
100
+ async makeRequest(method, path, body) {
101
+ const url = `${this.config.apiUrl}${path}`;
102
+ let lastError = null;
103
+ for (let attempt = 1; attempt <= this.config.retryAttempts; attempt++) {
104
+ try {
105
+ const controller = new AbortController();
106
+ const timeoutId = setTimeout(() => controller.abort(), this.config.timeout);
107
+ const headers = {
108
+ 'Content-Type': 'application/json',
109
+ 'User-Agent': 'onchain-devex'
110
+ };
111
+ if (this.config.apiKey) {
112
+ headers['Authorization'] = `Bearer ${this.config.apiKey}`;
113
+ }
114
+ const response = await globalFetch(url, {
115
+ method,
116
+ headers,
117
+ body: body ? JSON.stringify(body) : undefined,
118
+ signal: controller.signal
119
+ });
120
+ clearTimeout(timeoutId);
121
+ if (response.status === 401)
122
+ throw new types_1.AuthenticationError();
123
+ if (response.status === 429) {
124
+ const retryAfter = parseInt(response.headers.get('Retry-After') || '1', 10);
125
+ await this.delay(retryAfter * 1000);
126
+ continue;
127
+ }
128
+ if (!response.ok) {
129
+ const errorText = await response.text();
130
+ throw new types_1.NetworkError(`HTTP ${response.status}: ${errorText}`, response.status);
131
+ }
132
+ return await response.json();
133
+ }
134
+ catch (error) {
135
+ lastError = error instanceof Error ? error : new Error('Unknown error');
136
+ if (error instanceof types_1.AuthenticationError || error instanceof types_1.ValidationError)
137
+ throw error;
138
+ if (attempt === this.config.retryAttempts)
139
+ break;
140
+ await this.delay(Math.pow(2, attempt - 1) * 1000);
141
+ }
142
+ }
143
+ throw lastError || new types_1.NetworkError('All retry attempts failed');
144
+ }
145
+ getFromCache(key) {
146
+ if (!this.config.enableCaching)
147
+ return null;
148
+ const cached = this.cache.get(key);
149
+ if (!cached)
150
+ return null;
151
+ if (Date.now() > cached.timestamp + cached.ttl) {
152
+ this.cache.delete(key);
153
+ return null;
154
+ }
155
+ return cached.data;
156
+ }
157
+ setCache(key, data, ttl) {
158
+ if (!this.config.enableCaching)
159
+ return;
160
+ this.cache.set(key, { data, timestamp: Date.now(), ttl });
161
+ }
162
+ validateConfig() {
163
+ if (!this.config.apiUrl)
164
+ throw new types_1.ValidationError('API URL is required');
165
+ try {
166
+ new URL(this.config.apiUrl);
167
+ }
168
+ catch {
169
+ throw new types_1.ValidationError('Invalid API URL');
170
+ }
171
+ if (this.config.timeout <= 0)
172
+ throw new types_1.ValidationError('Timeout must be positive');
173
+ }
174
+ validateSignature(signature) {
175
+ if (!signature || typeof signature !== 'string')
176
+ throw new types_1.ValidationError('Transaction signature required');
177
+ if (signature.length < 80 || signature.length > 100)
178
+ throw new types_1.ValidationError('Invalid signature format');
179
+ if (!/^[1-9A-HJ-NP-Za-km-z]+$/.test(signature))
180
+ throw new types_1.ValidationError('Signature must be valid base58');
181
+ }
182
+ delay(ms) {
183
+ return new Promise(resolve => setTimeout(resolve, ms));
184
+ }
185
+ }
186
+ exports.SolanaDevExClient = SolanaDevExClient;
187
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1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@@
1
+ /**
2
+ * onchain-devex
3
+ * TypeScript SDK for CPI debugging on Solana
4
+ *
5
+ * @version 0.1.0
6
+ * @license MIT
7
+ */
8
+ export { SolanaDevExClient } from './client';
9
+ export { SolanaRpcClient, getTransactionDetails, parseTransactionForCPI, analyzeTransactionErrors, getNetworkHealth } from './rpc';
10
+ export type { SolanaDevExConfig, APIResponse, CPIAccount, CPIFlowStep, TransactionError, TransactionPerformance, TransactionMetadata, DebugResult, RpcTransactionDetails, NetworkMetrics, } from './types';
11
+ export { SolanaDevExError, NetworkError, AuthenticationError, ValidationError } from './types';
12
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAG7C,OAAO,EACL,eAAe,EACf,qBAAqB,EACrB,sBAAsB,EACtB,wBAAwB,EACxB,gBAAgB,EACjB,MAAM,OAAO,CAAC;AAGf,YAAY,EACV,iBAAiB,EACjB,WAAW,EACX,UAAU,EACV,WAAW,EACX,gBAAgB,EAChB,sBAAsB,EACtB,mBAAmB,EACnB,WAAW,EACX,qBAAqB,EACrB,cAAc,GACf,MAAM,SAAS,CAAC;AAGjB,OAAO,EACL,gBAAgB,EAChB,YAAY,EACZ,mBAAmB,EACnB,eAAe,EAChB,MAAM,SAAS,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ /**
3
+ * onchain-devex
4
+ * TypeScript SDK for CPI debugging on Solana
5
+ *
6
+ * @version 0.1.0
7
+ * @license MIT
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.ValidationError = exports.AuthenticationError = exports.NetworkError = exports.SolanaDevExError = exports.getNetworkHealth = exports.analyzeTransactionErrors = exports.parseTransactionForCPI = exports.getTransactionDetails = exports.SolanaRpcClient = exports.SolanaDevExClient = void 0;
11
+ // Main client - API access to onchain-devex.tools
12
+ var client_1 = require("./client");
13
+ Object.defineProperty(exports, "SolanaDevExClient", { enumerable: true, get: function () { return client_1.SolanaDevExClient; } });
14
+ // Direct Solana RPC utilities (no platform dependency)
15
+ var rpc_1 = require("./rpc");
16
+ Object.defineProperty(exports, "SolanaRpcClient", { enumerable: true, get: function () { return rpc_1.SolanaRpcClient; } });
17
+ Object.defineProperty(exports, "getTransactionDetails", { enumerable: true, get: function () { return rpc_1.getTransactionDetails; } });
18
+ Object.defineProperty(exports, "parseTransactionForCPI", { enumerable: true, get: function () { return rpc_1.parseTransactionForCPI; } });
19
+ Object.defineProperty(exports, "analyzeTransactionErrors", { enumerable: true, get: function () { return rpc_1.analyzeTransactionErrors; } });
20
+ Object.defineProperty(exports, "getNetworkHealth", { enumerable: true, get: function () { return rpc_1.getNetworkHealth; } });
21
+ // Error classes
22
+ var types_1 = require("./types");
23
+ Object.defineProperty(exports, "SolanaDevExError", { enumerable: true, get: function () { return types_1.SolanaDevExError; } });
24
+ Object.defineProperty(exports, "NetworkError", { enumerable: true, get: function () { return types_1.NetworkError; } });
25
+ Object.defineProperty(exports, "AuthenticationError", { enumerable: true, get: function () { return types_1.AuthenticationError; } });
26
+ Object.defineProperty(exports, "ValidationError", { enumerable: true, get: function () { return types_1.ValidationError; } });
27
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH,kDAAkD;AAClD,mCAA6C;AAApC,2GAAA,iBAAiB,OAAA;AAE1B,uDAAuD;AACvD,6BAMe;AALb,sGAAA,eAAe,OAAA;AACf,4GAAA,qBAAqB,OAAA;AACrB,6GAAA,sBAAsB,OAAA;AACtB,+GAAA,wBAAwB,OAAA;AACxB,uGAAA,gBAAgB,OAAA;AAiBlB,gBAAgB;AAChB,iCAKiB;AAJf,yGAAA,gBAAgB,OAAA;AAChB,qGAAA,YAAY,OAAA;AACZ,4GAAA,mBAAmB,OAAA;AACnB,wGAAA,eAAe,OAAA"}
package/dist/rpc.d.ts ADDED
@@ -0,0 +1,92 @@
1
+ /**
2
+ * Solana RPC Utilities - Standalone wrappers for direct blockchain interaction
3
+ * These functions provide direct access to Solana RPC functionality without requiring platform APIs
4
+ */
5
+ import { ParsedTransactionWithMeta } from '@solana/web3.js';
6
+ import { CPIFlowStep, TransactionError, TransactionPerformance } from './types';
7
+ /**
8
+ * Standalone Solana RPC client for direct blockchain access
9
+ */
10
+ export declare class SolanaRpcClient {
11
+ private connection;
12
+ constructor(rpcEndpoint?: string);
13
+ /**
14
+ * Get detailed transaction information including parsed instructions
15
+ */
16
+ getTransactionDetails(signature: string): Promise<ParsedTransactionWithMeta | null>;
17
+ /**
18
+ * Parse transaction to extract CPI flow and instruction hierarchy
19
+ */
20
+ parseTransactionForCPI(transaction: ParsedTransactionWithMeta): CPIFlowStep[];
21
+ /**
22
+ * Analyze transaction for errors and provide detailed diagnostics
23
+ */
24
+ analyzeTransactionErrors(transaction: ParsedTransactionWithMeta): TransactionError[];
25
+ /**
26
+ * Calculate compute metrics and efficiency scores
27
+ */
28
+ calculatePerformanceMetrics(transaction: ParsedTransactionWithMeta): TransactionPerformance;
29
+ /**
30
+ * Get current network health and performance metrics
31
+ */
32
+ getNetworkHealth(): Promise<{
33
+ slot: number;
34
+ blockHeight: number;
35
+ latency: number;
36
+ status: 'healthy' | 'degraded' | 'down';
37
+ }>;
38
+ /**
39
+ * Validate transaction signature format
40
+ */
41
+ private validateSignature;
42
+ /**
43
+ * Create a CPI step from an instruction (internal helper)
44
+ */
45
+ private createCPIStep;
46
+ /**
47
+ * Extract accounts from parsed instruction (internal helper)
48
+ */
49
+ private extractAccountsFromParsed;
50
+ /**
51
+ * Extract accounts from partially decoded instruction (internal helper)
52
+ */
53
+ private extractAccountsFromPartial;
54
+ /**
55
+ * Extract accounts from compiled instruction (internal helper)
56
+ */
57
+ private extractAccountsFromCompiled;
58
+ /**
59
+ * Get account metadata from transaction (internal helper)
60
+ */
61
+ private getAccountInfo;
62
+ /**
63
+ * Get friendly account name (internal helper)
64
+ */
65
+ private getAccountName;
66
+ /**
67
+ * Get instruction error message (internal helper)
68
+ */
69
+ private getInstructionError;
70
+ /**
71
+ * Estimate compute units for instruction (internal helper)
72
+ */
73
+ private estimateComputeUnits;
74
+ /**
75
+ * Assess gas efficiency (internal helper)
76
+ */
77
+ private assessGasEfficiency;
78
+ /**
79
+ * Get optimization suggestions (internal helper)
80
+ */
81
+ private getSuggestedOptimizations;
82
+ }
83
+ export declare function getTransactionDetails(signature: string, rpcEndpoint?: string): Promise<ParsedTransactionWithMeta | null>;
84
+ export declare function parseTransactionForCPI(transaction: ParsedTransactionWithMeta): CPIFlowStep[];
85
+ export declare function analyzeTransactionErrors(transaction: ParsedTransactionWithMeta): TransactionError[];
86
+ export declare function getNetworkHealth(rpcEndpoint?: string): Promise<{
87
+ slot: number;
88
+ blockHeight: number;
89
+ latency: number;
90
+ status: "healthy" | "degraded" | "down";
91
+ }>;
92
+ //# sourceMappingURL=rpc.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rpc.d.ts","sourceRoot":"","sources":["../src/rpc.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAyB,yBAAyB,EAAgC,MAAM,iBAAiB,CAAC;AACjH,OAAO,EACL,WAAW,EAEX,gBAAgB,EAChB,sBAAsB,EAIvB,MAAM,SAAS,CAAC;AA4DjB;;GAEG;AACH,qBAAa,eAAe;IAC1B,OAAO,CAAC,UAAU,CAAa;gBAEnB,WAAW,CAAC,EAAE,MAAM;IAKhC;;OAEG;IACG,qBAAqB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,yBAAyB,GAAG,IAAI,CAAC;IAkBzF;;OAEG;IACH,sBAAsB,CAAC,WAAW,EAAE,yBAAyB,GAAG,WAAW,EAAE;IAoC7E;;OAEG;IACH,wBAAwB,CAAC,W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* Solana RPC Utilities - Standalone wrappers for direct blockchain interaction
4
+ * These functions provide direct access to Solana RPC functionality without requiring platform APIs
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.SolanaRpcClient = void 0;
8
+ exports.getTransactionDetails = getTransactionDetails;
9
+ exports.parseTransactionForCPI = parseTransactionForCPI;
10
+ exports.analyzeTransactionErrors = analyzeTransactionErrors;
11
+ exports.getNetworkHealth = getNetworkHealth;
12
+ const web3_js_1 = require("@solana/web3.js");
13
+ const types_1 = require("./types");
14
+ // Known program mappings for better display names
15
+ const KNOWN_PROGRAMS = {
16
+ 'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA': 'Token Program',
17
+ 'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL': 'Associated Token Program',
18
+ 'ComputeBudget111111111111111111111111111111': 'Compute Budget Program',
19
+ '11111111111111111111111111111111': 'System Program',
20
+ 'BPFLoaderUpgradeab1e11111111111111111111111': 'BPF Upgradeable Loader',
21
+ 'Vote111111111111111111111111111111111111111': 'Vote Program',
22
+ 'Stake11111111111111111111111111111111111111': 'Stake Program',
23
+ 'DjVE6JNiYqPL2QXyCUUh8rNjHrbz9hXHNYt99MQ59qw1': 'Dex Program',
24
+ '9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM': 'AMM Program',
25
+ '675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8': 'Raydium AMM Program',
26
+ 'EhpADApTrarMJx1rMHj8SBgaTKMCvvzM27RBBe8S9xwL': 'Raydium CLMM Program',
27
+ 'whirLbMiicVdio4qvUfM5KAg6Ct8VwpYzGff3uctyCc': 'Orca Whirlpools Program'
28
+ };
29
+ // Known error patterns for transaction analysis
30
+ const ERROR_PATTERNS = [
31
+ {
32
+ pattern: /insufficient.*balance/i,
33
+ type: 'account_balance_mismatch',
34
+ severity: 'critical',
35
+ getDetails: () => ({
36
+ message: 'Account has insufficient balance for the requested operation',
37
+ suggestedFix: 'Ensure the account has enough SOL or tokens before executing the transaction',
38
+ estimatedFixTime: '5-10 minutes',
39
+ documentation: 'https://docs.solana.com/developing/programming-model/accounts#account-balance'
40
+ })
41
+ },
42
+ {
43
+ pattern: /realloc.*constraint/i,
44
+ type: 'realloc_constraint',
45
+ severity: 'critical',
46
+ getDetails: () => ({
47
+ message: 'Account reallocation exceeded maximum allowed size limit',
48
+ suggestedFix: 'Implement PDA chunking pattern to split large data across multiple accounts',
49
+ estimatedFixTime: '2-4 hours',
50
+ documentation: 'https://docs.rs/anchor-lang/latest/anchor_lang/accounts/account/struct.Account.html#account-reallocation'
51
+ })
52
+ },
53
+ {
54
+ pattern: /compute.*budget.*exceeded/i,
55
+ type: 'compute_budget',
56
+ severity: 'warning',
57
+ getDetails: () => ({
58
+ message: 'Transaction exceeded the compute budget limit',
59
+ suggestedFix: 'Optimize instruction logic or request additional compute units',
60
+ estimatedFixTime: '1-2 hours',
61
+ documentation: 'https://docs.solana.com/developing/programming-model/runtime#compute-budget'
62
+ })
63
+ }
64
+ ];
65
+ /**
66
+ * Standalone Solana RPC client for direct blockchain access
67
+ */
68
+ class SolanaRpcClient {
69
+ constructor(rpcEndpoint) {
70
+ Object.defineProperty(this, "connection", {
71
+ enumerable: true,
72
+ configurable: true,
73
+ writable: true,
74
+ value: void 0
75
+ });
76
+ const endpoint = rpcEndpoint || 'https://api.mainnet-beta.solana.com';
77
+ this.connection = new web3_js_1.Connection(endpoint, 'confirmed');
78
+ }
79
+ /**
80
+ * Get detailed transaction information including parsed instructions
81
+ */
82
+ async getTransactionDetails(signature) {
83
+ this.validateSignature(signature);
84
+ try {
85
+ const transaction = await this.connection.getParsedTransaction(signature, {
86
+ maxSupportedTransactionVersion: 0,
87
+ commitment: 'confirmed'
88
+ });
89
+ return transaction;
90
+ }
91
+ catch (error) {
92
+ throw new types_1.NetworkError(`Failed to fetch transaction: ${error instanceof Error ? error.message : 'Unknown error'}`, error instanceof Error && 'status' in error ? error.status : undefined);
93
+ }
94
+ }
95
+ /**
96
+ * Parse transaction to extract CPI flow and instruction hierarchy
97
+ */
98
+ parseTransactionForCPI(transaction) {
99
+ if (!transaction?.transaction?.message?.instructions) {
100
+ return [];
101
+ }
102
+ const cpiFlow = [];
103
+ let instructionId = 0;
104
+ // Process top-level instructions
105
+ transaction.transaction.message.instructions.forEach((instruction, index) => {
106
+ const step = this.createCPIStep(instruction, index, 0, transaction);
107
+ if (step) {
108
+ cpiFlow.push(step);
109
+ instructionId++;
110
+ }
111
+ // Process inner instructions (CPI calls)
112
+ if (transaction.meta?.innerInstructions) {
113
+ const innerInstruction = transaction.meta.innerInstructions.find(inner => inner.index === index);
114
+ if (innerInstruction) {
115
+ innerInstruction.instructions.forEach((inner) => {
116
+ const innerStep = this.createCPIStep(inner, instructionId++, 1, transaction);
117
+ if (innerStep) {
118
+ cpiFlow.push(innerStep);
119
+ }
120
+ });
121
+ }
122
+ }
123
+ });
124
+ return cpiFlow;
125
+ }
126
+ /**
127
+ * Analyze transaction for errors and provide detailed diagnostics
128
+ */
129
+ analyzeTransactionErrors(transaction) {
130
+ const errors = [];
131
+ if (!transaction.meta) {
132
+ return errors;
133
+ }
134
+ // Check for transaction-level errors
135
+ if (transaction.meta.err) {
136
+ const errorString = JSON.stringify(transaction.meta.err);
137
+ // Match against known error patterns
138
+ for (const pattern of ERROR_PATTERNS) {
139
+ const match = errorString.match(pattern.pattern);
140
+ if (match) {
141
+ const details = pattern.getDetails(match);
142
+ errors.push({
143
+ type: pattern.type,
144
+ severity: pattern.severity,
145
+ instruction: 0,
146
+ programId: 'System',
147
+ message: details.message || `Transaction failed: ${errorString}`,
148
+ suggestedFix: details.suggestedFix || 'Review transaction parameters and retry',
149
+ ...details
150
+ });
151
+ }
152
+ }
153
+ }
154
+ // Check for high compute usage
155
+ const computeUnitsConsumed = transaction.meta.computeUnitsConsumed || 0;
156
+ if (computeUnitsConsumed > 800000) {
157
+ errors.push({
158
+ type: 'compute_budget',
159
+ severity: 'warning',
160
+ instruction: 0,
161
+ programId: 'System',
162
+ message: `High compute usage detected: ${computeUnitsConsumed.toLocaleString()} units`,
163
+ suggestedFix: 'Consider optimizing instruction logic or splitting into multiple transactions',
164
+ estimatedFixTime: '1-3 hours',
165
+ documentation: 'https://docs.solana.com/developing/programming-model/runtime#compute-budget'
166
+ });
167
+ }
168
+ return errors;
169
+ }
170
+ /**
171
+ * Calculate compute metrics and efficiency scores
172
+ */
173
+ calculatePerformanceMetrics(transaction) {
174
+ const meta = transaction.meta;
175
+ const computeUnitsConsumed = meta?.computeUnitsConsumed || 0;
176
+ const fee = meta?.fee || 0;
177
+ const slot = transaction.slot || 0;
178
+ // Estimate requested compute units
179
+ const estimatedRequested = Math.max(computeUnitsConsumed * 1.2, 200000);
180
+ // Calculate efficiency
181
+ const efficiency = estimatedRequested > 0 ? (computeUnitsConsumed / estimatedRequested) * 100 : 0;
182
+ let optimizationMessage;
183
+ if (efficiency > 90) {
184
+ optimizationMessage = 'Excellent - Highly optimized transaction with minimal compute waste';
185
+ }
186
+ else if (efficiency > 70) {
187
+ optimizationMessage = 'Good - Well structured transaction with some optimization opportunities';
188
+ }
189
+ else if (efficiency > 50) {
190
+ optimizationMessage = 'Moderate - Transaction could benefit from optimization';
191
+ }
192
+ else {
193
+ optimizationMessage = 'Poor - Significant optimization needed to improve efficiency';
194
+ }
195
+ return {
196
+ computeUnitsUsed: computeUnitsConsumed,
197
+ computeUnitsRequested: Math.round(estimatedRequested),
198
+ fee,
199
+ slot,
200
+ computeEfficiency: Math.round(efficiency * 10) / 10,
201
+ gasOptimization: optimizationMessage
202
+ };
203
+ }
204
+ /**
205
+ * Get current network health and performance metrics
206
+ */
207
+ async getNetworkHealth() {
208
+ try {
209
+ const startTime = Date.now();
210
+ const slot = await this.connection.getSlot();
211
+ const blockHeight = await this.connection.getBlockHeight();
212
+ const latency = Date.now() - startTime;
213
+ let status;
214
+ if (latency < 500) {
215
+ status = 'healthy';
216
+ }
217
+ else if (latency < 2000) {
218
+ status = 'degraded';
219
+ }
220
+ else {
221
+ status = 'down';
222
+ }
223
+ return {
224
+ slot,
225
+ blockHeight,
226
+ latency,
227
+ status
228
+ };
229
+ }
230
+ catch (error) {
231
+ throw new types_1.NetworkError(`Failed to get network health: ${error instanceof Error ? error.message : 'Unknown error'}`);
232
+ }
233
+ }
234
+ /**
235
+ * Validate transaction signature format
236
+ */
237
+ validateSignature(signature) {
238
+ if (!signature || typeof signature !== 'string') {
239
+ throw new types_1.ValidationError('Transaction signature is required and must be a string');
240
+ }
241
+ if (signature.length < 80 || signature.length > 100) {
242
+ throw new types_1.ValidationError('Invalid transaction signature format');
243
+ }
244
+ }
245
+ /**
246
+ * Create a CPI step from an instruction (internal helper)
247
+ */
248
+ createCPIStep(instruction, id, depth, transaction) {
249
+ try {
250
+ let programId;
251
+ let instructionType;
252
+ let accounts = [];
253
+ if ('programId' in instruction) {
254
+ programId = instruction.programId.toString();
255
+ if ('parsed' in instruction) {
256
+ instructionType = instruction.parsed?.type || 'unknown';
257
+ accounts = this.extractAccountsFromParsed(instruction, transaction);
258
+ }
259
+ else {
260
+ instructionType = 'unknown';
261
+ accounts = this.extractAccountsFromPartial(instruction, transaction);
262
+ }
263
+ }
264
+ else {
265
+ // Compiled instruction
266
+ const accountKeys = transaction.transaction.message.accountKeys || [];
267
+ if (accountKeys[instruction.programIdIndex]) {
268
+ programId = accountKeys[instruction.programIdIndex].toString();
269
+ instructionType = 'compiled';
270
+ accounts = this.extractAccountsFromCompiled(instruction, transaction);
271
+ }
272
+ else {
273
+ return null;
274
+ }
275
+ }
276
+ const programName = KNOWN_PROGRAMS[programId] || 'Unknown Program';
277
+ const success = !transaction.meta?.err;
278
+ const computeUnits = this.estimateComputeUnits(instructionType, accounts.length);
279
+ return {
280
+ id: id.toString(),
281
+ program: programName,
282
+ programId,
283
+ instruction: instructionType,
284
+ depth,
285
+ accounts,
286
+ success,
287
+ error: success ? undefined : this.getInstructionError(transaction),
288
+ computeUnits,
289
+ gasEfficiency: this.assessGasEfficiency(computeUnits, accounts.length),
290
+ suggestedOptimizations: this.getSuggestedOptimizations(instructionType, accounts.length)
291
+ };
292
+ }
293
+ catch (error) {
294
+ return null;
295
+ }
296
+ }
297
+ /**
298
+ * Extract accounts from parsed instruction (internal helper)
299
+ */
300
+ extractAccountsFromParsed(instruction, transaction) {
301
+ const accounts = [];
302
+ if (instruction.parsed?.info) {
303
+ const info = instruction.parsed.info;
304
+ const accountFields = ['account', 'source', 'destination', 'authority', 'mint', 'owner'];
305
+ for (const field of accountFields) {
306
+ if (info[field] && typeof info[field] === 'string') {
307
+ try {
308
+ const pubkey = info[field];
309
+ const accountInfo = this.getAccountInfo(pubkey, transaction);
310
+ accounts.push({
311
+ pubkey,
312
+ name: this.getAccountName(field),
313
+ isSigner: accountInfo.isSigner,
314
+ isWritable: accountInfo.isWritable,
315
+ dataChange: true,
316
+ rentExemption: true
317
+ });
318
+ }
319
+ catch (error) {
320
+ // Skip invalid pubkeys
321
+ }
322
+ }
323
+ }
324
+ }
325
+ return accounts;
326
+ }
327
+ /**
328
+ * Extract accounts from partially decoded instruction (internal helper)
329
+ */
330
+ extractAccountsFromPartial(instruction, transaction) {
331
+ if (!instruction.accounts)
332
+ return [];
333
+ return instruction.accounts.map((pubkey, index) => {
334
+ const accountInfo = this.getAccountInfo(pubkey.toString(), transaction);
335
+ return {
336
+ pubkey: pubkey.toString(),
337
+ name: `Account ${index + 1}`,
338
+ isSigner: accountInfo.isSigner,
339
+ isWritable: accountInfo.isWritable,
340
+ dataChange: accountInfo.isWritable,
341
+ rentExemption: true
342
+ };
343
+ });
344
+ }
345
+ /**
346
+ * Extract accounts from compiled instruction (internal helper)
347
+ */
348
+ extractAccountsFromCompiled(instruction, transaction) {
349
+ const accountKeys = transaction.transaction.message.accountKeys || [];
350
+ return instruction.accounts.map((accountIndex, index) => {
351
+ const pubkey = accountKeys[accountIndex]?.toString() || '';
352
+ const accountInfo = this.getAccountInfo(pubkey, transaction);
353
+ return {
354
+ pubkey,
355
+ name: `Account ${index + 1}`,
356
+ isSigner: accountInfo.isSigner,
357
+ isWritable: accountInfo.isWritable,
358
+ dataChange: accountInfo.isWritable,
359
+ rentExemption: true
360
+ };
361
+ });
362
+ }
363
+ /**
364
+ * Get account metadata from transaction (internal helper)
365
+ */
366
+ getAccountInfo(pubkey, transaction) {
367
+ const accountKeys = transaction.transaction.message.accountKeys || [];
368
+ const index = accountKeys.findIndex(key => key.toString() === pubkey);
369
+ if (index === -1) {
370
+ return { isSigner: false, isWritable: false };
371
+ }
372
+ // Conservative assumptions for parsed transactions
373
+ const numRequiredSignatures = 1;
374
+ const numReadonlyUnsignedAccounts = Math.max(0, accountKeys.length - 5);
375
+ return {
376
+ isSigner: index < numRequiredSignatures,
377
+ isWritable: index < accountKeys.length - numReadonlyUnsignedAccounts
378
+ };
379
+ }
380
+ /**
381
+ * Get friendly account name (internal helper)
382
+ */
383
+ getAccountName(role) {
384
+ const roleNames = {
385
+ account: 'Target Account',
386
+ source: 'Source Account',
387
+ destination: 'Destination Account',
388
+ authority: 'Authority Account',
389
+ mint: 'Token Mint',
390
+ owner: 'Owner Account'
391
+ };
392
+ return roleNames[role] || 'Account';
393
+ }
394
+ /**
395
+ * Get instruction error message (internal helper)
396
+ */
397
+ getInstructionError(transaction) {
398
+ if (transaction.meta?.err) {
399
+ return JSON.stringify(transaction.meta.err);
400
+ }
401
+ return 'Unknown error';
402
+ }
403
+ /**
404
+ * Estimate compute units for instruction (internal helper)
405
+ */
406
+ estimateComputeUnits(instructionType, accountCount) {
407
+ const baseUnits = {
408
+ 'transfer': 2300,
409
+ 'createAccount': 5000,
410
+ 'createIdempotent': 6000,
411
+ 'initialize': 8000,
412
+ 'swap': 25000,
413
+ 'stake': 15000,
414
+ 'unknown': 10000,
415
+ 'compiled': 15000
416
+ };
417
+ const base = baseUnits[instructionType] || baseUnits['unknown'];
418
+ const accountMultiplier = Math.max(1, Math.floor(accountCount / 3));
419
+ return base * accountMultiplier;
420
+ }
421
+ /**
422
+ * Assess gas efficiency (internal helper)
423
+ */
424
+ assessGasEfficiency(computeUnits, accountCount) {
425
+ const ratio = computeUnits / Math.max(1, accountCount);
426
+ if (ratio < 5000)
427
+ return 'optimal';
428
+ if (ratio < 15000)
429
+ return 'good';
430
+ return 'poor';
431
+ }
432
+ /**
433
+ * Get optimization suggestions (internal helper)
434
+ */
435
+ getSuggestedOptimizations(instructionType, accountCount) {
436
+ const optimizations = [];
437
+ if (accountCount > 10) {
438
+ optimizations.push('Consider reducing the number of accounts in single instruction');
439
+ }
440
+ if (instructionType === 'swap') {
441
+ optimizations.push('Use direct routes to minimize CPI calls');
442
+ optimizations.push('Consider batching multiple swaps');
443
+ }
444
+ if (instructionType === 'unknown' || instructionType === 'compiled') {
445
+ optimizations.push('Use parsed instructions for better debugging');
446
+ }
447
+ return optimizations;
448
+ }
449
+ }
450
+ exports.SolanaRpcClient = SolanaRpcClient;
451
+ // Convenience functions for direct usage
452
+ async function getTransactionDetails(signature, rpcEndpoint) {
453
+ const client = new SolanaRpcClient(rpcEndpoint);
454
+ return client.getTransactionDetails(signature);
455
+ }
456
+ function parseTransactionForCPI(transaction) {
457
+ const client = new SolanaRpcClient();
458
+ return client.parseTransactionForCPI(transaction);
459
+ }
460
+ function analyzeTransactionErrors(transaction) {
461
+ const client = new SolanaRpcClient();
462
+ return client.analyzeTransactionErrors(transaction);
463
+ }
464
+ async function getNetworkHealth(rpcEndpoint) {
465
+ const client = new SolanaRpcClient(rpcEndpoint);
466
+ return client.getNetworkHealth();
467
+ }
468
+ //# sourceMappingURL=rpc.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rpc.js","sourceRoot":"","sources":["../src/rpc.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAmgBH,sDAGC;AAED,wDAGC;AAED,4DAGC;AAED,4CAGC;AAnhBD,6CAAiH;AACjH,mCAQiB;AAEjB,kDAAkD;AAClD,MAAM,cAAc,GAA2B;IAC7C,6CAA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KAAK,UAAU,qBAAqB,CAAC,SAAiB,EAAE,WAAoB;IACjF,MAAM,MAAM,GAAG,IAAI,eAAe,CAAC,WAAW,CAAC,CAAC;IAChD,OAAO,MAAM,CAAC,qBAAqB,CAAC,SAAS,CAAC,CAAC;AACjD,CAAC;AAED,SAAgB,sBAAsB,CAAC,WAAsC;IAC3E,MAAM,MAAM,GAAG,IAAI,eAAe,EAAE,CAAC;IACrC,OAAO,MAAM,CAAC,sBAAsB,CAAC,WAAW,CAAC,CAAC;AACpD,CAAC;AAED,SAAgB,wBAAwB,CAAC,WAAsC;IAC7E,MAAM,MAAM,GAAG,IAAI,eAAe,EAAE,CAAC;IACrC,OAAO,MAAM,CAAC,wBAAwB,CAAC,WAAW,CAAC,CAAC;AACtD,CAAC;AAEM,KAAK,UAAU,gBAAgB,CAAC,WAAoB;IACzD,MAAM,MAAM,GAAG,IAAI,eAAe,CAAC,WAAW,CAAC,CAAC;IAChD,OAAO,MAAM,CAAC,gBAAgB,EAAE,CAAC;AACnC,CAAC"}
@@ -0,0 +1,126 @@
1
+ /**
2
+ * Core types for onchain-devex
3
+ */
4
+ export interface APIResponse<T> {
5
+ success: boolean;
6
+ data: T | null;
7
+ error?: string;
8
+ timestamp?: string;
9
+ }
10
+ export interface CPIAccount {
11
+ pubkey: string;
12
+ name?: string;
13
+ isSigner: boolean;
14
+ isWritable: boolean;
15
+ beforeBalance?: number;
16
+ afterBalance?: number;
17
+ dataChange?: boolean;
18
+ dataSize?: number;
19
+ rentExemption?: boolean;
20
+ }
21
+ export interface CPIFlowStep {
22
+ id: string;
23
+ program: string;
24
+ programId: string;
25
+ instruction: string;
26
+ depth: number;
27
+ accounts: CPIAccount[];
28
+ success: boolean;
29
+ error?: string;
30
+ computeUnits: number;
31
+ gasEfficiency: 'optimal' | 'good' | 'poor';
32
+ suggestedOptimizations?: string[];
33
+ }
34
+ export interface TransactionError {
35
+ type: 'account_balance_mismatch' | 'realloc_constraint' | 'program_error' | 'compute_budget' | 'rent_violation' | 'account_size_exceeded' | 'authority_mismatch';
36
+ severity: 'critical' | 'warning' | 'info';
37
+ instruction: number;
38
+ programId: string;
39
+ message: string;
40
+ suggestedFix: string;
41
+ codeExample?: string;
42
+ documentation?: string;
43
+ estimatedFixTime?: string;
44
+ }
45
+ export interface TransactionPerformance {
46
+ computeUnitsUsed: number;
47
+ computeUnitsRequested: number;
48
+ fee: number;
49
+ slot: number;
50
+ computeEfficiency: number;
51
+ gasOptimization: string;
52
+ }
53
+ export interface TransactionMetadata {
54
+ blockTime: string;
55
+ confirmations: number;
56
+ programsInvolved: string[];
57
+ accountsModified: number;
58
+ totalInstructions: number;
59
+ }
60
+ export interface DebugResult {
61
+ signature: string;
62
+ status: 'analyzing' | 'success' | 'error' | 'not-found';
63
+ cpiFlow?: CPIFlowStep[];
64
+ errors?: TransactionError[];
65
+ performance?: TransactionPerformance;
66
+ metadata?: TransactionMetadata;
67
+ }
68
+ export interface NetworkMetrics {
69
+ slot: number;
70
+ blockHeight: number;
71
+ latency: number;
72
+ tps: number;
73
+ status: 'healthy' | 'degraded' | 'down';
74
+ health: boolean;
75
+ timestamp: string;
76
+ }
77
+ export interface RpcTransactionDetails {
78
+ signature: string;
79
+ slot: number;
80
+ blockTime: number | null;
81
+ meta: {
82
+ err: any;
83
+ fee: number;
84
+ preBalances: number[];
85
+ postBalances: number[];
86
+ innerInstructions?: any[];
87
+ logMessages?: string[];
88
+ computeUnitsConsumed?: number;
89
+ };
90
+ transaction: {
91
+ message: {
92
+ accountKeys: any[];
93
+ header: {
94
+ numRequiredSignatures: number;
95
+ numReadonlySignedAccounts: number;
96
+ numReadonlyUnsignedAccounts: number;
97
+ };
98
+ instructions: any[];
99
+ recentBlockhash: string;
100
+ };
101
+ signatures: string[];
102
+ };
103
+ }
104
+ export interface SolanaDevExConfig {
105
+ apiUrl?: string;
106
+ rpcEndpoint?: string;
107
+ apiKey?: string;
108
+ timeout?: number;
109
+ retryAttempts?: number;
110
+ enableCaching?: boolean;
111
+ }
112
+ export declare class SolanaDevExError extends Error {
113
+ readonly code: string;
114
+ readonly statusCode?: number;
115
+ constructor(message: string, code: string, statusCode?: number);
116
+ }
117
+ export declare class NetworkError extends SolanaDevExError {
118
+ constructor(message: string, statusCode?: number);
119
+ }
120
+ export declare class ValidationError extends SolanaDevExError {
121
+ constructor(message: string);
122
+ }
123
+ export declare class AuthenticationError extends SolanaDevExError {
124
+ constructor(message?: string);
125
+ }
126
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,MAAM,WAAW,WAAW,CAAC,CAAC;IAC5B,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,CAAC,GAAG,IAAI,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAGD,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,OAAO,CAAC;IAClB,UAAU,EAAE,OAAO,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,UAAU,EAAE,CAAC;IACvB,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;IACrB,aAA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B,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAGD,qBAAa,gBAAiB,SAAQ,KAAK;IACzC,SAAgB,IAAI,EAAE,MAAM,CAAC;IAC7B,SAAgB,UAAU,CAAC,EAAE,MAAM,CAAC;gBAExB,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM;CAM/D;AAED,qBAAa,YAAa,SAAQ,gBAAgB;gBACpC,OAAO,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM;CAIjD;AAED,qBAAa,eAAgB,SAAQ,gBAAgB;gBACvC,OAAO,EAAE,MAAM;CAI5B;AAED,qBAAa,mBAAoB,SAAQ,gBAAgB;gBAC3C,OAAO,GAAE,MAAgC;CAItD"}
package/dist/types.js ADDED
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ /**
3
+ * Core types for onchain-devex
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.AuthenticationError = exports.ValidationError = exports.NetworkError = exports.SolanaDevExError = void 0;
7
+ // Errors
8
+ class SolanaDevExError extends Error {
9
+ constructor(message, code, statusCode) {
10
+ super(message);
11
+ Object.defineProperty(this, "code", {
12
+ enumerable: true,
13
+ configurable: true,
14
+ writable: true,
15
+ value: void 0
16
+ });
17
+ Object.defineProperty(this, "statusCode", {
18
+ enumerable: true,
19
+ configurable: true,
20
+ writable: true,
21
+ value: void 0
22
+ });
23
+ this.name = 'SolanaDevExError';
24
+ this.code = code;
25
+ this.statusCode = statusCode;
26
+ }
27
+ }
28
+ exports.SolanaDevExError = SolanaDevExError;
29
+ class NetworkError extends SolanaDevExError {
30
+ constructor(message, statusCode) {
31
+ super(message, 'NETWORK_ERROR', statusCode);
32
+ this.name = 'NetworkError';
33
+ }
34
+ }
35
+ exports.NetworkError = NetworkError;
36
+ class ValidationError extends SolanaDevExError {
37
+ constructor(message) {
38
+ super(message, 'VALIDATION_ERROR', 400);
39
+ this.name = 'ValidationError';
40
+ }
41
+ }
42
+ exports.ValidationError = ValidationError;
43
+ class AuthenticationError extends SolanaDevExError {
44
+ constructor(message = 'Authentication failed') {
45
+ super(message, 'AUTH_ERROR', 401);
46
+ this.name = 'AuthenticationError';
47
+ }
48
+ }
49
+ exports.AuthenticationError = AuthenticationError;
50
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AA6HH,SAAS;AACT,MAAa,gBAAiB,SAAQ,KAAK;IAIzC,YAAY,OAAe,EAAE,IAAY,EAAE,UAAmB;QAC5D,KAAK,CAAC,OAAO,CAAC,CAAC;QAJD;;;;;WAAa;QACb;;;;;WAAoB;QAIlC,IAAI,CAAC,IAAI,GAAG,kBAAkB,CAAC;QAC/B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IAC/B,CAAC;CACF;AAVD,4CAUC;AAED,MAAa,YAAa,SAAQ,gBAAgB;IAChD,YAAY,OAAe,EAAE,UAAmB;QAC9C,KAAK,CAAC,OAAO,EAAE,eAAe,EAAE,UAAU,CAAC,CAAC;QAC5C,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC;IAC7B,CAAC;CACF;AALD,oCAKC;AAED,MAAa,eAAgB,SAAQ,gBAAgB;IACnD,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,EAAE,kBAAkB,EAAE,GAAG,CAAC,CAAC;QACxC,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;IAChC,CAAC;CACF;AALD,0CAKC;AAED,MAAa,mBAAoB,SAAQ,gBAAgB;IACvD,YAAY,UAAkB,uBAAuB;QACnD,KAAK,CAAC,OAAO,EAAE,YAAY,EAAE,GAAG,CAAC,CAAC;QAClC,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAC;IACpC,CAAC;CACF;AALD,kDAKC"}
package/package.json ADDED
@@ -0,0 +1,52 @@
1
+ {
2
+ "name": "onchain-devex",
3
+ "version": "0.1.0",
4
+ "description": "TypeScript SDK for Solana DevEx Platform - CPI debugging, security scanning, and direct RPC utilities",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "files": [
8
+ "dist",
9
+ "README.md"
10
+ ],
11
+ "scripts": {
12
+ "build": "tsc",
13
+ "clean": "rm -rf dist",
14
+ "prepublishOnly": "npm run clean && npm run build"
15
+ },
16
+ "keywords": [
17
+ "solana",
18
+ "web3",
19
+ "cpi",
20
+ "debugging",
21
+ "security",
22
+ "developer-tools",
23
+ "blockchain"
24
+ ],
25
+ "author": "onchain-devex",
26
+ "license": "MIT",
27
+ "repository": {
28
+ "type": "git",
29
+ "url": "https://github.com/tyler-james-bridges/solana-devex-platform.git",
30
+ "directory": "packages/sdk"
31
+ },
32
+ "bugs": {
33
+ "url": "https://github.com/tyler-james-bridges/solana-devex-platform/issues"
34
+ },
35
+ "homepage": "https://onchain-devex.tools",
36
+ "peerDependencies": {
37
+ "@solana/web3.js": "^1.95.0"
38
+ },
39
+ "dependencies": {
40
+ "cross-fetch": "^4.0.0"
41
+ },
42
+ "devDependencies": {
43
+ "@solana/web3.js": "^1.95.0",
44
+ "typescript": "^5.4.0"
45
+ },
46
+ "engines": {
47
+ "node": ">=18.0.0"
48
+ },
49
+ "publishConfig": {
50
+ "registry": "https://registry.npmjs.org/"
51
+ }
52
+ }