@ghostspeak/sdk 1.7.1 → 2.0.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.
Files changed (101) hide show
  1. package/dist/.tsbuildinfo +1 -1
  2. package/dist/EscrowInstructions-4P3H6ETO.js +2 -0
  3. package/dist/EscrowInstructions-4P3H6ETO.js.map +1 -0
  4. package/dist/GhostSpeakClient-4SROinEf.d.ts +503 -0
  5. package/dist/accounts-IUZMPYVE.js +2 -0
  6. package/dist/accounts-IUZMPYVE.js.map +1 -0
  7. package/dist/agent-GZ2OES75.js +2 -0
  8. package/dist/agent-GZ2OES75.js.map +1 -0
  9. package/dist/auctionMarketplace-W4YM7HKU.js +2 -0
  10. package/dist/auctionMarketplace-W4YM7HKU.js.map +1 -0
  11. package/dist/chunk-2KOOI5BX.js +2 -0
  12. package/dist/chunk-2KOOI5BX.js.map +1 -0
  13. package/dist/chunk-32GWTXRJ.js +3 -0
  14. package/dist/chunk-32GWTXRJ.js.map +1 -0
  15. package/dist/chunk-B4WUFVLE.js +2 -0
  16. package/dist/chunk-B4WUFVLE.js.map +1 -0
  17. package/dist/chunk-C2OTQ5YS.js +2 -0
  18. package/dist/chunk-C2OTQ5YS.js.map +1 -0
  19. package/dist/chunk-CTC4ZJ26.js +5 -0
  20. package/dist/chunk-CTC4ZJ26.js.map +1 -0
  21. package/dist/chunk-DF7LLAMH.js +2 -0
  22. package/dist/chunk-DF7LLAMH.js.map +1 -0
  23. package/dist/chunk-DJ356OUX.js +2 -0
  24. package/dist/chunk-DJ356OUX.js.map +1 -0
  25. package/dist/chunk-DK5YDBXR.js +2 -0
  26. package/dist/chunk-DK5YDBXR.js.map +1 -0
  27. package/dist/chunk-DOTF5ECA.js +4 -0
  28. package/dist/chunk-DOTF5ECA.js.map +1 -0
  29. package/dist/chunk-FKEUXXZS.js +30 -0
  30. package/dist/chunk-FKEUXXZS.js.map +1 -0
  31. package/dist/chunk-GSHXEKBW.js +2 -0
  32. package/dist/chunk-GSHXEKBW.js.map +1 -0
  33. package/dist/chunk-IZDAEOLH.js +2 -0
  34. package/dist/chunk-IZDAEOLH.js.map +1 -0
  35. package/dist/chunk-JY554RGE.js +3 -0
  36. package/dist/chunk-JY554RGE.js.map +1 -0
  37. package/dist/chunk-KK3HV2RD.js +3 -0
  38. package/dist/chunk-KK3HV2RD.js.map +1 -0
  39. package/dist/chunk-PPOCDM6G.js +2 -0
  40. package/dist/chunk-PPOCDM6G.js.map +1 -0
  41. package/dist/chunk-PUI35LBF.js +2 -0
  42. package/dist/chunk-PUI35LBF.js.map +1 -0
  43. package/dist/chunk-Q34J6YDA.js +11 -0
  44. package/dist/chunk-Q34J6YDA.js.map +1 -0
  45. package/dist/chunk-QATBFZMM.js +3 -0
  46. package/dist/chunk-QATBFZMM.js.map +1 -0
  47. package/dist/chunk-QTKN3VZV.js +2 -0
  48. package/dist/chunk-QTKN3VZV.js.map +1 -0
  49. package/dist/chunk-RFBYMTTN.js +2 -0
  50. package/dist/chunk-RFBYMTTN.js.map +1 -0
  51. package/dist/chunk-RJJPOLCK.js +22 -0
  52. package/dist/chunk-RJJPOLCK.js.map +1 -0
  53. package/dist/chunk-RTWJTEND.js +2 -0
  54. package/dist/chunk-RTWJTEND.js.map +1 -0
  55. package/dist/chunk-SR3ZJCME.js +2 -0
  56. package/dist/chunk-SR3ZJCME.js.map +1 -0
  57. package/dist/chunk-TAWXH7KX.js +2 -0
  58. package/dist/chunk-TAWXH7KX.js.map +1 -0
  59. package/dist/client.d.ts +4 -0
  60. package/dist/client.js +2 -0
  61. package/dist/client.js.map +1 -0
  62. package/dist/confidential-transfer-manager-CGS3T5DG.js +2 -0
  63. package/dist/confidential-transfer-manager-CGS3T5DG.js.map +1 -0
  64. package/dist/crypto.d.ts +331 -0
  65. package/dist/crypto.js +2 -0
  66. package/dist/crypto.js.map +1 -0
  67. package/dist/elgamal-3ABOJSHC.js +2 -0
  68. package/dist/elgamal-3ABOJSHC.js.map +1 -0
  69. package/dist/enhanced-client-errors-W22U3LNH.js +2 -0
  70. package/dist/enhanced-client-errors-W22U3LNH.js.map +1 -0
  71. package/dist/errors.d.ts +119 -0
  72. package/dist/errors.js +2 -0
  73. package/dist/errors.js.map +1 -0
  74. package/dist/feature-flags-CEaxXgQQ.d.ts +4157 -0
  75. package/dist/generated-U3L4KUE4.js +2 -0
  76. package/dist/generated-U3L4KUE4.js.map +1 -0
  77. package/dist/ghostspeak_wasm-3KPNJTSS.js +2 -0
  78. package/dist/ghostspeak_wasm-3KPNJTSS.js.map +1 -0
  79. package/dist/index.d.ts +1944 -17757
  80. package/dist/index.js +17 -45969
  81. package/dist/index.js.map +1 -1
  82. package/dist/ipfs-types-BlxtJ3q2.d.ts +194 -0
  83. package/dist/metafile-esm.json +1 -0
  84. package/dist/minimal/core-minimal.d.ts +444 -0
  85. package/dist/minimal/core-minimal.js +12 -0
  86. package/dist/minimal/core-minimal.js.map +1 -0
  87. package/dist/pda-2GUWRQ5G.js +2 -0
  88. package/dist/pda-2GUWRQ5G.js.map +1 -0
  89. package/dist/registerAgentCompressed-L6ACXD2Z.js +2 -0
  90. package/dist/registerAgentCompressed-L6ACXD2Z.js.map +1 -0
  91. package/dist/token-2022-rpc-SRHRFN5Y.js +2 -0
  92. package/dist/token-2022-rpc-SRHRFN5Y.js.map +1 -0
  93. package/dist/types.d.ts +396 -0
  94. package/dist/types.js +2 -0
  95. package/dist/types.js.map +1 -0
  96. package/dist/utils.d.ts +19 -0
  97. package/dist/utils.js +2 -0
  98. package/dist/utils.js.map +1 -0
  99. package/dist/zk-proof-builder-GXZ42QZA.js +2 -0
  100. package/dist/zk-proof-builder-GXZ42QZA.js.map +1 -0
  101. package/package.json +27 -1
@@ -0,0 +1,444 @@
1
+ import { Address } from '@solana/addresses';
2
+ import { Rpc, GetLatestBlockhashApi, SendTransactionApi, GetAccountInfoApi, SimulateTransactionApi, GetFeeForMessageApi, GetProgramAccountsApi, GetEpochInfoApi, GetSignatureStatusesApi, GetMultipleAccountsApi, RpcSubscriptions, SignatureNotificationsApi, SlotNotificationsApi } from '@solana/kit';
3
+
4
+ /**
5
+ * IPFS configuration and types for GhostSpeak SDK
6
+ */
7
+ /**
8
+ * IPFS provider configuration
9
+ */
10
+ interface IPFSProviderConfig {
11
+ /** Provider name */
12
+ name: 'pinata' | 'infura' | 'ipfs-http-client' | 'web3-storage' | 'custom' | 'test';
13
+ /** API endpoint URL */
14
+ endpoint?: string;
15
+ /** API key for authentication */
16
+ apiKey?: string;
17
+ /** API secret for authentication */
18
+ apiSecret?: string;
19
+ /** JWT token for authentication */
20
+ jwt?: string;
21
+ /** Custom headers */
22
+ headers?: Record<string, string>;
23
+ /** Request timeout in milliseconds */
24
+ timeout?: number;
25
+ }
26
+ /**
27
+ * IPFS client configuration
28
+ */
29
+ interface IPFSConfig {
30
+ /** Primary provider */
31
+ provider: IPFSProviderConfig;
32
+ /** Fallback providers */
33
+ fallbackProviders?: IPFSProviderConfig[];
34
+ /** Default IPFS gateway for retrieving content */
35
+ gateway?: string;
36
+ /** Additional gateways for redundancy */
37
+ gateways?: string[];
38
+ /** Whether to automatically pin uploaded content */
39
+ autoPinning?: boolean;
40
+ /** Content size threshold for IPFS (bytes) - content above this will use IPFS */
41
+ sizeThreshold?: number;
42
+ /** Maximum retry attempts for failed operations */
43
+ maxRetries?: number;
44
+ /** Retry delay in milliseconds */
45
+ retryDelay?: number;
46
+ /** Enable caching of IPFS content */
47
+ enableCache?: boolean;
48
+ /** Cache TTL in milliseconds */
49
+ cacheTTL?: number;
50
+ }
51
+
52
+ type RpcApi = Rpc<GetLatestBlockhashApi & SendTransactionApi & GetAccountInfoApi & SimulateTransactionApi & GetFeeForMessageApi & GetProgramAccountsApi>;
53
+ type ExtendedRpcApi = RpcApi & Rpc<GetEpochInfoApi & GetSignatureStatusesApi & GetMultipleAccountsApi>;
54
+ type RpcSubscriptionApi = RpcSubscriptions<SignatureNotificationsApi & SlotNotificationsApi>;
55
+ type Commitment = 'processed' | 'confirmed' | 'finalized';
56
+
57
+ interface GhostSpeakConfig {
58
+ programId?: Address;
59
+ rpc: ExtendedRpcApi;
60
+ rpcSubscriptions?: RpcSubscriptionApi;
61
+ commitment?: Commitment;
62
+ transactionTimeout?: number;
63
+ defaultFeePayer?: Address;
64
+ retryConfig?: RetryConfig;
65
+ cluster?: 'mainnet-beta' | 'devnet' | 'testnet' | 'localnet';
66
+ rpcEndpoint?: string;
67
+ wsEndpoint?: string;
68
+ /** Token 2022 configuration options */
69
+ token2022?: Token2022Config;
70
+ /** IPFS configuration for large content storage */
71
+ ipfsConfig?: IPFSConfig;
72
+ }
73
+ interface Token2022Config {
74
+ /** Enable Token 2022 features by default */
75
+ enabled?: boolean;
76
+ /** Default behavior for transfer fees */
77
+ defaultExpectTransferFees?: boolean;
78
+ /** Maximum transfer fee slippage (basis points) */
79
+ maxFeeSlippageBasisPoints?: number;
80
+ /** Enable confidential transfers by default */
81
+ enableConfidentialTransfers?: boolean;
82
+ /** Default Token 2022 program address (for custom deployments) */
83
+ programAddress?: Address;
84
+ /** Cache token program detection results for this many seconds */
85
+ tokenProgramCacheTtl?: number;
86
+ }
87
+ interface RetryConfig {
88
+ maxRetries?: number;
89
+ baseDelay?: number;
90
+ maxDelay?: number;
91
+ backoffMultiplier?: number;
92
+ retryableErrors?: string[];
93
+ }
94
+
95
+ /**
96
+ * Main GhostSpeak client with fluent API design
97
+ *
98
+ * Example usage:
99
+ * ```typescript
100
+ * const ghostspeak = new GhostSpeak()
101
+ *
102
+ * // Create an agent
103
+ * const agent = await ghostspeak
104
+ * .agent()
105
+ * .create({ name: "My Agent", capabilities: ["coding"] })
106
+ * .compressed()
107
+ * .execute()
108
+ *
109
+ * // Create an escrow
110
+ * const escrow = await ghostspeak
111
+ * .escrow()
112
+ * .between(buyer, seller)
113
+ * .amount(sol(10))
114
+ * .withMilestones([...])
115
+ * .execute()
116
+ * ```
117
+ */
118
+ declare class GhostSpeak {
119
+ private config;
120
+ constructor(config?: Partial<GhostSpeakConfig>);
121
+ /**
122
+ * Agent operations
123
+ */
124
+ agent(): AgentBuilder;
125
+ /**
126
+ * Escrow operations
127
+ */
128
+ escrow(): EscrowBuilder;
129
+ /**
130
+ * Channel operations
131
+ */
132
+ channel(): ChannelBuilder;
133
+ /**
134
+ * Marketplace operations
135
+ */
136
+ marketplace(): MarketplaceBuilder;
137
+ /**
138
+ * Governance operations
139
+ */
140
+ governance(): GovernanceBuilder;
141
+ /**
142
+ * Token-2022 operations
143
+ */
144
+ token2022(): Token2022Builder;
145
+ /**
146
+ * Enable development mode features
147
+ */
148
+ enableDevMode(): this;
149
+ /**
150
+ * Configure network
151
+ */
152
+ useNetwork(cluster: 'mainnet-beta' | 'devnet' | 'testnet' | 'localnet'): this;
153
+ /**
154
+ * Configure custom RPC
155
+ */
156
+ useRpc(endpoint: string, wsEndpoint?: string): this;
157
+ /**
158
+ * Get default RPC endpoint for cluster
159
+ */
160
+ private getDefaultRpcEndpoint;
161
+ }
162
+ /**
163
+ * Agent builder for fluent API
164
+ */
165
+ declare class AgentBuilder {
166
+ private module;
167
+ private params;
168
+ constructor(config: GhostSpeakConfig);
169
+ create(params: {
170
+ name: string;
171
+ capabilities: string[];
172
+ }): this;
173
+ withType(agentType: number): this;
174
+ withIPFS(): this;
175
+ compressed(): this;
176
+ debug(): this;
177
+ private validateParams;
178
+ getCost(): Promise<bigint>;
179
+ simulate(): Promise<unknown>;
180
+ explain(): Promise<string>;
181
+ execute(): Promise<{
182
+ address: Address;
183
+ signature: string;
184
+ }>;
185
+ private deriveAgentAddress;
186
+ }
187
+ /**
188
+ * Escrow builder for fluent API
189
+ */
190
+ declare class EscrowBuilder {
191
+ private module;
192
+ private params;
193
+ constructor(config: GhostSpeakConfig);
194
+ between(buyer: Address, seller: Address): this;
195
+ amount(lamports: bigint): this;
196
+ description(desc: string): this;
197
+ withMilestones(milestones: Array<{
198
+ amount: bigint;
199
+ description: string;
200
+ }>): this;
201
+ debug(): this;
202
+ private validateParams;
203
+ getCost(): Promise<bigint>;
204
+ explain(): Promise<string>;
205
+ execute(): Promise<{
206
+ address: Address;
207
+ signature: string;
208
+ }>;
209
+ private deriveEscrowAddress;
210
+ }
211
+ /**
212
+ * Channel builder for fluent API
213
+ */
214
+ declare class ChannelBuilder {
215
+ private module;
216
+ private params;
217
+ constructor(config: GhostSpeakConfig);
218
+ create(name: string): this;
219
+ description(desc: string): this;
220
+ private(): this;
221
+ maxMembers(max: number): this;
222
+ debug(): this;
223
+ private validateParams;
224
+ getCost(): Promise<bigint>;
225
+ explain(): Promise<string>;
226
+ execute(): Promise<{
227
+ address: Address;
228
+ signature: string;
229
+ }>;
230
+ private deriveChannelAddress;
231
+ }
232
+ declare class MarketplaceBuilder {
233
+ private config;
234
+ constructor(config: GhostSpeakConfig);
235
+ }
236
+ declare class GovernanceBuilder {
237
+ private config;
238
+ constructor(config: GhostSpeakConfig);
239
+ }
240
+ declare class Token2022Builder {
241
+ private config;
242
+ constructor(config: GhostSpeakConfig);
243
+ }
244
+
245
+ /**
246
+ * Comprehensive Type System for GhostSpeak SDK
247
+ *
248
+ * All types are exported as individual named exports using ES2015 module syntax
249
+ * for better tree-shaking and compatibility with ESLint rules.
250
+ */
251
+
252
+ /**
253
+ * Agent entity
254
+ */
255
+ interface Agent {
256
+ address: Address;
257
+ type: AgentType;
258
+ owner: Address;
259
+ metadata: AgentMetadata;
260
+ reputation: Reputation;
261
+ isActive: boolean;
262
+ isVerified: boolean;
263
+ createdAt: Date;
264
+ }
265
+ /**
266
+ * Agent types
267
+ */
268
+ declare enum AgentType {
269
+ General = 0,
270
+ Specialized = 1,
271
+ Oracle = 2,
272
+ Validator = 3
273
+ }
274
+ /**
275
+ * Agent metadata
276
+ */
277
+ interface AgentMetadata {
278
+ name: string;
279
+ description: string;
280
+ capabilities: string[];
281
+ avatar?: string;
282
+ website?: string;
283
+ socialLinks?: Record<string, string>;
284
+ }
285
+ /**
286
+ * Reputation data
287
+ */
288
+ interface Reputation {
289
+ score: number;
290
+ jobsCompleted: number;
291
+ successRate: number;
292
+ totalEarnings: bigint;
293
+ ratings: Rating[];
294
+ }
295
+ /**
296
+ * Rating entry
297
+ */
298
+ interface Rating {
299
+ from: Address;
300
+ score: number;
301
+ comment?: string;
302
+ timestamp: Date;
303
+ }
304
+ /**
305
+ * Escrow entity
306
+ */
307
+ interface Escrow {
308
+ address: Address;
309
+ buyer: Address;
310
+ seller: Address;
311
+ amount: bigint;
312
+ status: EscrowStatus;
313
+ description: string;
314
+ milestones?: Milestone[];
315
+ createdAt: Date;
316
+ completedAt?: Date;
317
+ }
318
+ /**
319
+ * Escrow status
320
+ */
321
+ declare enum EscrowStatus {
322
+ Active = "active",
323
+ Completed = "completed",
324
+ Cancelled = "cancelled",
325
+ Disputed = "disputed",
326
+ Refunded = "refunded"
327
+ }
328
+ /**
329
+ * Milestone for escrow
330
+ */
331
+ interface Milestone {
332
+ amount: bigint;
333
+ description: string;
334
+ completed: boolean;
335
+ completedAt?: Date;
336
+ }
337
+ /**
338
+ * Channel entity
339
+ */
340
+ interface Channel {
341
+ address: Address;
342
+ name: string;
343
+ description: string;
344
+ type: ChannelType;
345
+ creator: Address;
346
+ members: Address[];
347
+ isPrivate: boolean;
348
+ maxMembers: number;
349
+ messageCount: number;
350
+ createdAt: Date;
351
+ }
352
+ /**
353
+ * Channel types
354
+ */
355
+ declare enum ChannelType {
356
+ Public = "public",
357
+ Private = "private",
358
+ Direct = "direct",
359
+ Group = "group"
360
+ }
361
+ /**
362
+ * SDK error with context
363
+ */
364
+ interface SDKError {
365
+ code: ErrorCode;
366
+ message: string;
367
+ context?: Record<string, unknown>;
368
+ solution?: string;
369
+ instruction?: string;
370
+ }
371
+ /**
372
+ * Error codes
373
+ */
374
+ declare enum ErrorCode {
375
+ NETWORK_ERROR = "NETWORK_ERROR",
376
+ RPC_ERROR = "RPC_ERROR",
377
+ TIMEOUT = "TIMEOUT",
378
+ INSUFFICIENT_BALANCE = "INSUFFICIENT_BALANCE",
379
+ TRANSACTION_FAILED = "TRANSACTION_FAILED",
380
+ SIMULATION_FAILED = "SIMULATION_FAILED",
381
+ ACCOUNT_NOT_FOUND = "ACCOUNT_NOT_FOUND",
382
+ INVALID_ACCOUNT = "INVALID_ACCOUNT",
383
+ UNAUTHORIZED = "UNAUTHORIZED",
384
+ INVALID_INPUT = "INVALID_INPUT",
385
+ INVALID_ADDRESS = "INVALID_ADDRESS",
386
+ INVALID_AMOUNT = "INVALID_AMOUNT",
387
+ PROGRAM_ERROR = "PROGRAM_ERROR",
388
+ INSTRUCTION_ERROR = "INSTRUCTION_ERROR",
389
+ UNKNOWN_ERROR = "UNKNOWN_ERROR"
390
+ }
391
+
392
+ /**
393
+ * Common utility functions for GhostSpeak SDK
394
+ */
395
+ /**
396
+ * Convert SOL to lamports
397
+ */
398
+ declare function sol(amount: number): bigint;
399
+
400
+ /**
401
+ * Smart Error System with Actionable Solutions
402
+ *
403
+ * Every error includes context and suggested solutions to help developers
404
+ * quickly resolve issues.
405
+ */
406
+
407
+ /**
408
+ * Base GhostSpeak error class
409
+ */
410
+ declare class GhostSpeakError extends Error {
411
+ readonly code: ErrorCode;
412
+ readonly context: Record<string, unknown>;
413
+ readonly solution?: string;
414
+ readonly instruction?: string;
415
+ constructor(code: ErrorCode, message: string, context?: Record<string, unknown>, solution?: string, instruction?: string);
416
+ /**
417
+ * Format error for display
418
+ */
419
+ toString(): string;
420
+ /**
421
+ * Convert to SDK error type
422
+ */
423
+ toSDKError(): SDKError;
424
+ }
425
+ /**
426
+ * Network-related errors
427
+ */
428
+ declare class NetworkError extends GhostSpeakError {
429
+ constructor(endpoint: string, originalError?: Error);
430
+ }
431
+ /**
432
+ * Insufficient balance error
433
+ */
434
+ declare class InsufficientBalanceError extends GhostSpeakError {
435
+ constructor(required: bigint, available: bigint, address: Address);
436
+ }
437
+ /**
438
+ * Validation error for invalid inputs
439
+ */
440
+ declare class ValidationError extends GhostSpeakError {
441
+ constructor(message: string, context?: Record<string, unknown>);
442
+ }
443
+
444
+ export { type Agent, AgentType, type Channel, ChannelType, type Escrow, EscrowStatus, type GhostSpeakConfig, GhostSpeakError, InsufficientBalanceError, NetworkError, type SDKError, ValidationError, GhostSpeak as default, sol };