@adelos/sdk 0.1.2 → 0.1.3
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/dist/index.d.mts +42 -470
- package/dist/index.d.ts +42 -470
- package/dist/index.js +137 -725
- package/dist/index.mjs +137 -725
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,90 +1,44 @@
|
|
|
1
1
|
import { PublicKey, Connection, TransactionInstruction, Transaction, VersionedTransaction } from '@solana/web3.js';
|
|
2
|
-
|
|
3
|
-
/** Supported Solana clusters */
|
|
4
|
-
type SolanaCluster = "devnet" | "mainnet-beta" | "localnet";
|
|
5
|
-
/** Program IDs for Adelos Registry per cluster */
|
|
6
|
-
declare const PROGRAM_IDS: Record<SolanaCluster, PublicKey>;
|
|
7
|
-
/** RPC URLs per cluster */
|
|
8
|
-
declare const RPC_URLS: Record<SolanaCluster, string>;
|
|
9
|
-
/** Default Program ID (Devnet) */
|
|
10
|
-
declare const PROGRAM_ID: PublicKey;
|
|
11
|
-
/** Memo Program ID for stealth address scanning */
|
|
12
|
-
declare const MEMO_PROGRAM_ID: PublicKey;
|
|
13
|
-
/** Seed prefix for registry PDA derivation */
|
|
14
|
-
declare const REGISTRY_SEED = "registry";
|
|
15
|
-
/** Size of the registry account in bytes */
|
|
16
|
-
declare const REGISTRY_ACCOUNT_SIZE: number;
|
|
17
|
-
/** Adelos Protocol version prefix for memos */
|
|
18
|
-
declare const MEMO_PREFIX = "ADLSv1:";
|
|
19
|
-
/** Stealth address derivation domain separator */
|
|
20
|
-
declare const STEALTH_DOMAIN = "adelos:stealth:v1";
|
|
2
|
+
import * as ed from '@noble/ed25519';
|
|
21
3
|
|
|
22
4
|
/** Represents a registry account data */
|
|
23
5
|
interface RegistryAccount {
|
|
24
|
-
/** Owner's wallet public key */
|
|
25
6
|
owner: PublicKey;
|
|
26
|
-
/** Meta public key (encryption key, 32 bytes) */
|
|
27
7
|
metaPubkey: Uint8Array;
|
|
28
|
-
/** PDA bump seed */
|
|
29
8
|
bump: number;
|
|
30
9
|
}
|
|
31
|
-
/**
|
|
32
|
-
* Options for initializing the Adelos SDK
|
|
33
|
-
*
|
|
34
|
-
* @example
|
|
35
|
-
* // Simple usage - just specify cluster
|
|
36
|
-
* const sdk = new AdelosSDK({ cluster: "devnet" });
|
|
37
|
-
*
|
|
38
|
-
* // Custom RPC (e.g., QuickNode, Helius)
|
|
39
|
-
* const sdk = new AdelosSDK({
|
|
40
|
-
* cluster: "devnet",
|
|
41
|
-
* rpcUrl: "https://my-quicknode-endpoint.com"
|
|
42
|
-
* });
|
|
43
|
-
*/
|
|
10
|
+
/** Options for initializing the Adelos SDK */
|
|
44
11
|
interface AdelosOptions {
|
|
45
|
-
/**
|
|
46
|
-
cluster?: SolanaCluster;
|
|
47
|
-
/** Custom RPC URL (optional - overrides cluster default) */
|
|
12
|
+
/** Custom RPC URL (optional - uses devnet default if not set) */
|
|
48
13
|
rpcUrl?: string;
|
|
49
14
|
/** Helius API key for indexer webhooks (optional) */
|
|
50
15
|
heliusApiKey?: string;
|
|
51
16
|
}
|
|
52
17
|
/** Result of a registry lookup */
|
|
53
18
|
interface RegistryInfo {
|
|
54
|
-
/** PDA address of the registry */
|
|
55
19
|
address: PublicKey;
|
|
56
|
-
/** Registry account data */
|
|
57
20
|
account: RegistryAccount;
|
|
58
|
-
/** Whether the registry exists */
|
|
59
21
|
exists: boolean;
|
|
60
22
|
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
/** Shared secret (for debugging, don't expose in production) */
|
|
78
|
-
sharedSecret: Uint8Array;
|
|
79
|
-
/** Memo to include in transaction */
|
|
80
|
-
memo: string;
|
|
81
|
-
}
|
|
23
|
+
|
|
24
|
+
type SolanaCluster = "devnet";
|
|
25
|
+
declare const ADELOS_CONFIG: {
|
|
26
|
+
readonly PROGRAM_ID: PublicKey;
|
|
27
|
+
readonly RPC_URL: string;
|
|
28
|
+
readonly MEMO_PROGRAM_ID: PublicKey;
|
|
29
|
+
readonly REGISTRY_SEED: "registry";
|
|
30
|
+
readonly MEMO_PREFIX: "ADLSv1:";
|
|
31
|
+
readonly STEALTH_DOMAIN: "adelos:stealth:v1";
|
|
32
|
+
};
|
|
33
|
+
declare const PROGRAM_ID: PublicKey;
|
|
34
|
+
declare const RPC_URL: string;
|
|
35
|
+
declare const MEMO_PROGRAM_ID: PublicKey;
|
|
36
|
+
declare const REGISTRY_SEED: "registry";
|
|
37
|
+
declare const MEMO_PREFIX: "ADLSv1:";
|
|
38
|
+
declare const STEALTH_DOMAIN: "adelos:stealth:v1";
|
|
82
39
|
|
|
83
40
|
/**
|
|
84
41
|
* Derives the registry PDA for a given owner
|
|
85
|
-
* @param owner - The owner's wallet public key
|
|
86
|
-
* @param programId - Optional custom program ID
|
|
87
|
-
* @returns Tuple of [PDA address, bump seed]
|
|
88
42
|
*/
|
|
89
43
|
declare function deriveRegistryPda(owner: PublicKey, programId?: PublicKey): [PublicKey, number];
|
|
90
44
|
/**
|
|
@@ -238,461 +192,79 @@ type AdelosIDL = typeof IDL;
|
|
|
238
192
|
|
|
239
193
|
/**
|
|
240
194
|
* Adelos Cryptography Module
|
|
241
|
-
*
|
|
242
195
|
* Implements Single-Key Stealth Address (SKSA) using Ed25519 curve operations.
|
|
243
|
-
*
|
|
244
|
-
* Flow:
|
|
245
|
-
* 1. Sender gets recipient's meta_pubkey from registry
|
|
246
|
-
* 2. Sender generates ephemeral keypair
|
|
247
|
-
* 3. ECDH: shared_secret = ephemeral_sk * meta_pubkey
|
|
248
|
-
* 4. Stealth pubkey = meta_pubkey + hash_to_scalar(shared_secret) * G
|
|
249
|
-
* 5. Recipient can recover stealth_sk = meta_sk + hash_to_scalar(shared_secret)
|
|
250
|
-
*/
|
|
251
|
-
/**
|
|
252
|
-
* Generates an ephemeral keypair for stealth address derivation
|
|
253
|
-
* @returns Object with secretKey (32 bytes) and publicKey (32 bytes)
|
|
254
196
|
*/
|
|
197
|
+
|
|
255
198
|
declare function generateEphemeralKeypair(): {
|
|
256
|
-
secretKey:
|
|
257
|
-
publicKey:
|
|
199
|
+
secretKey: ed.Bytes;
|
|
200
|
+
publicKey: ed.Bytes;
|
|
258
201
|
};
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
* @param recipientMetaPubkey - Recipient's meta public key (32 bytes)
|
|
263
|
-
* @returns Shared secret (32 bytes)
|
|
264
|
-
*/
|
|
265
|
-
declare function computeSharedSecret(ephemeralSk: Uint8Array, recipientMetaPubkey: Uint8Array): Promise<Uint8Array>;
|
|
266
|
-
/**
|
|
267
|
-
* Derives a stealth public key from meta pubkey and shared secret
|
|
268
|
-
*
|
|
269
|
-
* stealth_pubkey = meta_pubkey + hash_to_scalar(shared_secret) * G
|
|
270
|
-
*
|
|
271
|
-
* @param metaPubkey - Recipient's meta public key (32 bytes)
|
|
272
|
-
* @param sharedSecret - ECDH shared secret (32 bytes)
|
|
273
|
-
* @returns Stealth public key (32 bytes)
|
|
274
|
-
*/
|
|
275
|
-
declare function deriveStealthPubkey(metaPubkey: Uint8Array, sharedSecret: Uint8Array): Uint8Array;
|
|
276
|
-
/**
|
|
277
|
-
* Recovers the stealth secret key (for recipient)
|
|
278
|
-
*
|
|
279
|
-
* stealth_sk = meta_sk + hash_to_scalar(shared_secret)
|
|
280
|
-
*
|
|
281
|
-
* @param metaSk - Recipient's meta secret key (32 bytes)
|
|
282
|
-
* @param sharedSecret - ECDH shared secret (32 bytes)
|
|
283
|
-
* @returns Stealth secret key (32 bytes)
|
|
284
|
-
*/
|
|
202
|
+
declare function computeSharedSecret(ephemeralSk: Uint8Array, recipientMetaPk: Uint8Array): Uint8Array;
|
|
203
|
+
declare function computeSharedSecretAsRecipient(metaSk: Uint8Array, ephemeralPk: Uint8Array): Uint8Array;
|
|
204
|
+
declare function deriveStealthPubkey(metaPk: Uint8Array, sharedSecret: Uint8Array): Uint8Array;
|
|
285
205
|
declare function recoverStealthSecretKey(metaSk: Uint8Array, sharedSecret: Uint8Array): Uint8Array;
|
|
286
|
-
/**
|
|
287
|
-
* Computes shared secret from recipient's perspective
|
|
288
|
-
* (using meta secret key and sender's ephemeral pubkey)
|
|
289
|
-
*
|
|
290
|
-
* @param metaSk - Recipient's meta secret key (32 bytes)
|
|
291
|
-
* @param ephemeralPubkey - Sender's ephemeral public key (32 bytes)
|
|
292
|
-
* @returns Shared secret (32 bytes)
|
|
293
|
-
*/
|
|
294
|
-
declare function computeSharedSecretAsRecipient(metaSk: Uint8Array, ephemeralPubkey: Uint8Array): Promise<Uint8Array>;
|
|
295
|
-
/**
|
|
296
|
-
* Generates memo string for stealth transfer
|
|
297
|
-
* Format: ADLSv1:[ephemeral_pubkey_hex]
|
|
298
|
-
*
|
|
299
|
-
* @param ephemeralPubkey - Ephemeral public key (32 bytes)
|
|
300
|
-
* @returns Memo string
|
|
301
|
-
*/
|
|
302
206
|
declare function generateStealthMemo(ephemeralPubkey: Uint8Array): string;
|
|
303
|
-
/**
|
|
304
|
-
* Parses a stealth transfer memo
|
|
305
|
-
*
|
|
306
|
-
* @param memo - Memo string
|
|
307
|
-
* @returns Ephemeral public key or null if invalid
|
|
308
|
-
*/
|
|
309
207
|
declare function parseStealthMemo(memo: string): Uint8Array | null;
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
*
|
|
313
|
-
* @param recipientMetaPubkey - Recipient's meta public key from registry
|
|
314
|
-
* @returns Object with stealthPubkey, ephemeralPubkey, and memo
|
|
315
|
-
*/
|
|
316
|
-
declare function generateStealthAddress(recipientMetaPubkey: Uint8Array): Promise<{
|
|
317
|
-
stealthPubkey: Uint8Array;
|
|
208
|
+
declare function generateStealthAddress(recipientMetaPk: Uint8Array): {
|
|
209
|
+
stealthPubkey: Uint8Array<ArrayBufferLike>;
|
|
318
210
|
ephemeralKeypair: {
|
|
319
|
-
secretKey:
|
|
320
|
-
publicKey:
|
|
211
|
+
secretKey: ed.Bytes;
|
|
212
|
+
publicKey: ed.Bytes;
|
|
321
213
|
};
|
|
322
|
-
sharedSecret: Uint8Array
|
|
214
|
+
sharedSecret: Uint8Array<ArrayBufferLike>;
|
|
323
215
|
memo: string;
|
|
324
|
-
}>;
|
|
325
|
-
/**
|
|
326
|
-
* Checks if a transaction is for this recipient (for scanning)
|
|
327
|
-
*
|
|
328
|
-
* @param metaSk - Recipient's meta secret key
|
|
329
|
-
* @param metaPubkey - Recipient's meta public key
|
|
330
|
-
* @param ephemeralPubkey - Ephemeral pubkey from memo
|
|
331
|
-
* @param targetAddress - The address that received funds
|
|
332
|
-
* @returns True if this transaction is for the recipient
|
|
333
|
-
*/
|
|
334
|
-
declare function isStealthTransactionForMe(metaSk: Uint8Array, metaPubkey: Uint8Array, ephemeralPubkey: Uint8Array, targetAddress: Uint8Array): Promise<boolean>;
|
|
335
|
-
|
|
336
|
-
/**
|
|
337
|
-
* Adelos Light Protocol Integration
|
|
338
|
-
*
|
|
339
|
-
* Provides ZK-Compression for confidential transfers using Light Protocol.
|
|
340
|
-
* Compressed tokens are stored in Merkle trees instead of regular accounts,
|
|
341
|
-
* providing significant cost savings and enhanced privacy.
|
|
342
|
-
*/
|
|
343
|
-
|
|
344
|
-
/** Light Protocol program IDs */
|
|
345
|
-
declare const LIGHT_PROGRAM_IDS: {
|
|
346
|
-
LIGHT_SYSTEM_PROGRAM: PublicKey;
|
|
347
|
-
COMPRESSED_TOKEN_PROGRAM: PublicKey;
|
|
348
|
-
ACCOUNT_COMPRESSION_PROGRAM: PublicKey;
|
|
349
216
|
};
|
|
350
|
-
/** Configuration for Light Protocol RPC */
|
|
351
|
-
interface LightConfig {
|
|
352
|
-
/** Light Protocol RPC endpoint */
|
|
353
|
-
rpcUrl: string;
|
|
354
|
-
/** Compression public key (for tree) */
|
|
355
|
-
compressionPubkey?: PublicKey;
|
|
356
|
-
}
|
|
357
|
-
/** Compressed account info */
|
|
358
|
-
interface CompressedAccount {
|
|
359
|
-
/** Account hash */
|
|
360
|
-
hash: string;
|
|
361
|
-
/** Owner public key */
|
|
362
|
-
owner: PublicKey;
|
|
363
|
-
/** Lamports in account */
|
|
364
|
-
lamports: number;
|
|
365
|
-
/** Account data */
|
|
366
|
-
data: Uint8Array;
|
|
367
|
-
/** Merkle tree address */
|
|
368
|
-
tree: PublicKey;
|
|
369
|
-
/** Leaf index in tree */
|
|
370
|
-
leafIndex: number;
|
|
371
|
-
}
|
|
372
|
-
/** Compressed token balance */
|
|
373
|
-
interface CompressedTokenBalance {
|
|
374
|
-
/** Token mint */
|
|
375
|
-
mint: PublicKey;
|
|
376
|
-
/** Balance amount */
|
|
377
|
-
amount: bigint;
|
|
378
|
-
/** Source accounts */
|
|
379
|
-
accounts: CompressedAccount[];
|
|
380
|
-
}
|
|
381
|
-
/**
|
|
382
|
-
* Light Protocol client for ZK-Compression operations
|
|
383
|
-
*/
|
|
384
|
-
declare class LightClient {
|
|
385
|
-
private connection;
|
|
386
|
-
private config;
|
|
387
|
-
constructor(connection: Connection, config: LightConfig);
|
|
388
|
-
/**
|
|
389
|
-
* Creates a new Light Protocol client
|
|
390
|
-
*
|
|
391
|
-
* @param rpcUrl - Solana RPC URL with Light Protocol support
|
|
392
|
-
* @returns LightClient instance
|
|
393
|
-
*/
|
|
394
|
-
static create(rpcUrl: string): LightClient;
|
|
395
|
-
/**
|
|
396
|
-
* Gets compressed SOL balance for an address
|
|
397
|
-
*
|
|
398
|
-
* @param owner - Owner public key
|
|
399
|
-
* @returns Compressed SOL balance in lamports
|
|
400
|
-
*/
|
|
401
|
-
getCompressedSolBalance(owner: PublicKey): Promise<bigint>;
|
|
402
|
-
/**
|
|
403
|
-
* Gets compressed token balances for an address
|
|
404
|
-
*
|
|
405
|
-
* @param owner - Owner public key
|
|
406
|
-
* @param mint - Optional token mint to filter
|
|
407
|
-
* @returns Array of compressed token balances
|
|
408
|
-
*/
|
|
409
|
-
getCompressedTokenBalances(owner: PublicKey, mint?: PublicKey): Promise<CompressedTokenBalance[]>;
|
|
410
|
-
/**
|
|
411
|
-
* Creates a compressed SOL transfer instruction
|
|
412
|
-
*
|
|
413
|
-
* Note: This creates the instruction data structure.
|
|
414
|
-
* Actual ZK proof generation requires Light Protocol SDK.
|
|
415
|
-
*
|
|
416
|
-
* @param from - Sender public key
|
|
417
|
-
* @param to - Recipient public key (can be stealth address)
|
|
418
|
-
* @param amount - Amount in lamports
|
|
419
|
-
* @returns Transaction instruction (placeholder)
|
|
420
|
-
*/
|
|
421
|
-
createCompressedTransferInstruction(from: PublicKey, to: PublicKey, amount: bigint): TransactionInstruction;
|
|
422
|
-
/**
|
|
423
|
-
* Compresses SOL from regular account to compressed account
|
|
424
|
-
*
|
|
425
|
-
* @param owner - Owner public key
|
|
426
|
-
* @param amount - Amount in lamports to compress
|
|
427
|
-
* @returns Transaction (unsigned)
|
|
428
|
-
*/
|
|
429
|
-
createCompressSolTransaction(owner: PublicKey, amount: bigint): Promise<Transaction>;
|
|
430
|
-
/**
|
|
431
|
-
* Decompresses SOL from compressed account to regular account
|
|
432
|
-
*
|
|
433
|
-
* @param owner - Owner public key
|
|
434
|
-
* @param amount - Amount in lamports to decompress
|
|
435
|
-
* @returns Transaction (unsigned)
|
|
436
|
-
*/
|
|
437
|
-
createDecompressSolTransaction(owner: PublicKey, amount: bigint): Promise<Transaction>;
|
|
438
|
-
/**
|
|
439
|
-
* Creates a stealth compressed transfer
|
|
440
|
-
* Combines stealth addressing with ZK-compression
|
|
441
|
-
*
|
|
442
|
-
* @param from - Sender public key
|
|
443
|
-
* @param stealthPubkey - Derived stealth address for recipient
|
|
444
|
-
* @param amount - Amount in lamports
|
|
445
|
-
* @param memo - Stealth memo containing ephemeral pubkey
|
|
446
|
-
* @returns Transaction (unsigned)
|
|
447
|
-
*/
|
|
448
|
-
createStealthCompressedTransfer(from: PublicKey, stealthPubkey: Uint8Array, amount: bigint, memo: string): Promise<Transaction>;
|
|
449
|
-
}
|
|
450
|
-
/**
|
|
451
|
-
* Creates a Light Protocol client for ZK-compression operations
|
|
452
|
-
*
|
|
453
|
-
* @param rpcUrl - RPC URL with Light Protocol support
|
|
454
|
-
* @returns LightClient instance
|
|
455
|
-
*/
|
|
456
|
-
declare function createLightClient(rpcUrl: string): LightClient;
|
|
457
217
|
|
|
458
218
|
/**
|
|
459
|
-
* Adelos Indexer
|
|
460
|
-
*
|
|
461
|
-
* Provides transaction scanning for stealth transfers.
|
|
462
|
-
* Supports:
|
|
463
|
-
* 1. Helius Webhook integration for real-time notifications
|
|
464
|
-
* 2. Manual RPC scanning for historical transactions
|
|
219
|
+
* Adelos Indexer - Privacy-Preserving Transaction Scanner
|
|
465
220
|
*/
|
|
466
221
|
|
|
467
|
-
/** Stealth transaction detected by indexer */
|
|
468
222
|
interface StealthTransaction {
|
|
469
|
-
/** Transaction signature */
|
|
470
223
|
signature: string;
|
|
471
|
-
/** Block time (unix timestamp) */
|
|
472
224
|
blockTime: number | null;
|
|
473
|
-
/** Slot number */
|
|
474
|
-
slot: number;
|
|
475
|
-
/** Sender's wallet (if detectable) */
|
|
476
|
-
sender: PublicKey | null;
|
|
477
|
-
/** Stealth address that received funds */
|
|
478
225
|
stealthAddress: PublicKey;
|
|
479
|
-
/** Amount transferred (lamports) */
|
|
480
226
|
amount: bigint;
|
|
481
|
-
/** Ephemeral public key from memo */
|
|
482
|
-
ephemeralPubkey: Uint8Array;
|
|
483
|
-
/** Whether this is for the current user */
|
|
484
|
-
isForMe: boolean;
|
|
485
|
-
/** Recovered stealth secret key (if isForMe) */
|
|
486
|
-
stealthSecretKey?: Uint8Array;
|
|
487
227
|
}
|
|
488
|
-
/** Helius webhook payload */
|
|
489
|
-
interface HeliusWebhookPayload {
|
|
490
|
-
type: string;
|
|
491
|
-
signature: string;
|
|
492
|
-
slot: number;
|
|
493
|
-
timestamp: number;
|
|
494
|
-
accountData: Array<{
|
|
495
|
-
account: string;
|
|
496
|
-
nativeBalanceChange: number;
|
|
497
|
-
tokenBalanceChanges: Array<{
|
|
498
|
-
mint: string;
|
|
499
|
-
rawTokenAmount: {
|
|
500
|
-
tokenAmount: string;
|
|
501
|
-
};
|
|
502
|
-
}>;
|
|
503
|
-
}>;
|
|
504
|
-
instructions: Array<{
|
|
505
|
-
programId: string;
|
|
506
|
-
data: string;
|
|
507
|
-
accounts: string[];
|
|
508
|
-
}>;
|
|
509
|
-
}
|
|
510
|
-
/** Indexer configuration */
|
|
511
228
|
interface IndexerConfig {
|
|
512
|
-
/** Solana RPC URL */
|
|
513
229
|
rpcUrl: string;
|
|
514
|
-
/** Helius API key (optional, for webhooks) */
|
|
515
230
|
heliusApiKey?: string;
|
|
516
|
-
/** Scan interval in ms (for polling mode) */
|
|
517
|
-
scanInterval?: number;
|
|
518
231
|
}
|
|
519
|
-
/**
|
|
520
|
-
* Adelos Indexer for scanning stealth transfers
|
|
521
|
-
*/
|
|
522
232
|
declare class AdelosIndexer {
|
|
523
233
|
private connection;
|
|
524
|
-
private
|
|
525
|
-
private isScanning;
|
|
526
|
-
private scanIntervalId;
|
|
527
|
-
/** Callback for when a stealth transaction is detected */
|
|
528
|
-
onTransaction?: (tx: StealthTransaction) => void;
|
|
234
|
+
private heliusApiKey?;
|
|
529
235
|
constructor(config: IndexerConfig);
|
|
530
|
-
/**
|
|
531
|
-
* Creates an indexer instance
|
|
532
|
-
*/
|
|
533
236
|
static create(config: IndexerConfig): AdelosIndexer;
|
|
534
|
-
/**
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
* The metaPubkey should never appear in transactions - that's the whole point of stealth addresses.
|
|
539
|
-
* We scan memo program for ADLSv1: prefix, then use Trial Decryption to check if it's for us.
|
|
540
|
-
*
|
|
541
|
-
* @param metaSk - Recipient's meta secret key
|
|
542
|
-
* @param metaPubkey - Recipient's meta public key
|
|
543
|
-
* @param limit - Number of transactions to scan
|
|
544
|
-
* @returns Array of stealth transactions for this recipient
|
|
545
|
-
*/
|
|
546
|
-
scanForStealthTransfers(metaSk: Uint8Array, metaPubkey: Uint8Array, limit?: number): Promise<StealthTransaction[]>;
|
|
547
|
-
/**
|
|
548
|
-
* Scans all transactions with ADLSv1 memo prefix
|
|
549
|
-
*
|
|
550
|
-
* @param metaSk - Recipient's meta secret key
|
|
551
|
-
* @param metaPubkey - Recipient's meta public key
|
|
552
|
-
* @param since - Scan transactions after this signature
|
|
553
|
-
* @returns Array of stealth transactions
|
|
554
|
-
*/
|
|
555
|
-
scanByMemoPrefix(metaSk: Uint8Array, metaPubkey: Uint8Array, since?: string): Promise<StealthTransaction[]>;
|
|
556
|
-
/**
|
|
557
|
-
* Extracts memo from a parsed transaction
|
|
558
|
-
*/
|
|
237
|
+
/** Scan for stealth transfers to this recipient */
|
|
238
|
+
scanForStealthTransfers(metaSk: Uint8Array, metaPk: Uint8Array, limit?: number): Promise<StealthTransaction[]>;
|
|
239
|
+
/** Trial Decryption: Check if transaction is for this recipient */
|
|
240
|
+
private attemptDecryption;
|
|
559
241
|
private extractMemo;
|
|
560
|
-
/**
|
|
561
|
-
* Parses a transaction to extract stealth transfer info using Trial Decryption
|
|
562
|
-
*
|
|
563
|
-
* Trial Decryption: First compute expected stealth address, then find if it exists in tx accounts
|
|
564
|
-
*/
|
|
565
|
-
private parseStealthTransaction;
|
|
566
|
-
/**
|
|
567
|
-
* Starts continuous scanning for stealth transfers
|
|
568
|
-
*
|
|
569
|
-
* @param metaSk - Recipient's meta secret key
|
|
570
|
-
* @param metaPubkey - Recipient's meta public key
|
|
571
|
-
*/
|
|
572
|
-
startScanning(metaSk: Uint8Array, metaPubkey: Uint8Array): void;
|
|
573
|
-
/**
|
|
574
|
-
* Stops continuous scanning
|
|
575
|
-
*/
|
|
576
|
-
stopScanning(): void;
|
|
577
|
-
/**
|
|
578
|
-
* Processes a Helius webhook payload
|
|
579
|
-
*
|
|
580
|
-
* @param payload - Webhook payload from Helius
|
|
581
|
-
* @param metaSk - Recipient's meta secret key
|
|
582
|
-
* @param metaPubkey - Recipient's meta public key
|
|
583
|
-
* @returns Stealth transaction if detected and for this recipient
|
|
584
|
-
*/
|
|
585
|
-
processWebhook(payload: HeliusWebhookPayload, metaSk: Uint8Array, metaPubkey: Uint8Array): Promise<StealthTransaction | null>;
|
|
586
|
-
/**
|
|
587
|
-
* Sets up Helius webhook for real-time notifications
|
|
588
|
-
*
|
|
589
|
-
* @param webhookUrl - Your server's webhook endpoint
|
|
590
|
-
* @returns Webhook ID
|
|
591
|
-
*/
|
|
592
|
-
setupHeliusWebhook(webhookUrl: string): Promise<string | null>;
|
|
593
242
|
}
|
|
594
|
-
/**
|
|
595
|
-
* Creates an Adelos indexer instance
|
|
596
|
-
*/
|
|
597
243
|
declare function createIndexer(config: IndexerConfig): AdelosIndexer;
|
|
598
244
|
|
|
599
245
|
/**
|
|
600
|
-
* Adelos SDK - Privacy
|
|
246
|
+
* Adelos SDK - Privacy Stealth Transfers on Solana (Devnet)
|
|
601
247
|
*
|
|
602
248
|
* @example
|
|
603
|
-
*
|
|
604
|
-
* import { AdelosSDK } from "@adelos/sdk";
|
|
605
|
-
*
|
|
606
|
-
* // Simple usage with cluster
|
|
607
|
-
* const sdk = new AdelosSDK({ cluster: "devnet" });
|
|
608
|
-
*
|
|
609
|
-
* // With custom RPC (QuickNode, Helius)
|
|
610
|
-
* const sdk = new AdelosSDK({
|
|
611
|
-
* cluster: "devnet",
|
|
612
|
-
* rpcUrl: "https://my-quicknode-endpoint.com"
|
|
613
|
-
* });
|
|
614
|
-
*
|
|
615
|
-
* // Register identity
|
|
616
|
-
* const metaPubkey = new Uint8Array(32).fill(1);
|
|
617
|
-
* const tx = await sdk.createRegisterTransactionV0(walletPubkey, metaPubkey);
|
|
618
|
-
*
|
|
619
|
-
* // Get registry
|
|
249
|
+
* const sdk = new AdelosSDK();
|
|
620
250
|
* const registry = await sdk.getRegistry(ownerPubkey);
|
|
621
|
-
* console.log(registry.account.metaPubkey);
|
|
622
|
-
* ```
|
|
623
251
|
*/
|
|
624
252
|
declare class AdelosSDK {
|
|
625
253
|
readonly connection: Connection;
|
|
626
254
|
readonly programId: PublicKey;
|
|
627
|
-
readonly cluster: SolanaCluster;
|
|
628
|
-
readonly heliusApiKey?: string;
|
|
629
255
|
constructor(options?: AdelosOptions);
|
|
630
|
-
/**
|
|
631
|
-
* Derives the registry PDA for an owner
|
|
632
|
-
*/
|
|
633
256
|
deriveRegistryAddress(owner: PublicKey): [PublicKey, number];
|
|
634
|
-
/**
|
|
635
|
-
* Fetches a registry account by owner
|
|
636
|
-
*/
|
|
637
257
|
getRegistry(owner: PublicKey): Promise<RegistryInfo>;
|
|
638
|
-
/**
|
|
639
|
-
* Gets the meta pubkey for an owner
|
|
640
|
-
* @returns The meta pubkey as Uint8Array, or null if not registered
|
|
641
|
-
*/
|
|
642
258
|
getMetaPubkey(owner: PublicKey): Promise<Uint8Array | null>;
|
|
643
|
-
/**
|
|
644
|
-
* Gets the meta pubkey as hex string
|
|
645
|
-
*/
|
|
646
|
-
getMetaPubkeyHex(owner: PublicKey): Promise<string | null>;
|
|
647
|
-
/**
|
|
648
|
-
* Checks if an owner has a registered identity
|
|
649
|
-
*/
|
|
650
259
|
isRegistered(owner: PublicKey): Promise<boolean>;
|
|
651
|
-
/**
|
|
652
|
-
* Creates a register identity instruction
|
|
653
|
-
*/
|
|
654
260
|
createRegisterInstruction(owner: PublicKey, metaPubkey: Uint8Array): TransactionInstruction;
|
|
655
|
-
/**
|
|
656
|
-
* Creates an update identity instruction
|
|
657
|
-
*/
|
|
658
261
|
createUpdateInstruction(owner: PublicKey, newMetaPubkey: Uint8Array): TransactionInstruction;
|
|
659
|
-
/**
|
|
660
|
-
* Creates a close registry instruction
|
|
661
|
-
*/
|
|
662
262
|
createCloseInstruction(owner: PublicKey): TransactionInstruction;
|
|
663
|
-
|
|
664
|
-
* Creates a register transaction (unsigned) - Legacy format
|
|
665
|
-
*/
|
|
263
|
+
buildTransaction(payer: PublicKey, instructions: TransactionInstruction[], version?: "legacy" | "v0"): Promise<Transaction | VersionedTransaction>;
|
|
666
264
|
createRegisterTransaction(owner: PublicKey, metaPubkey: Uint8Array): Promise<Transaction>;
|
|
667
|
-
/**
|
|
668
|
-
* Creates a register transaction (unsigned) - Versioned format (v0)
|
|
669
|
-
* Recommended for modern Solana applications
|
|
670
|
-
*/
|
|
671
265
|
createRegisterTransactionV0(owner: PublicKey, metaPubkey: Uint8Array): Promise<VersionedTransaction>;
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
*/
|
|
675
|
-
createUpdateTransaction(owner: PublicKey, newMetaPubkey: Uint8Array): Promise<Transaction>;
|
|
676
|
-
/**
|
|
677
|
-
* Creates an update transaction (unsigned) - Versioned format (v0)
|
|
678
|
-
*/
|
|
679
|
-
createUpdateTransactionV0(owner: PublicKey, newMetaPubkey: Uint8Array): Promise<VersionedTransaction>;
|
|
680
|
-
/**
|
|
681
|
-
* Creates a close transaction (unsigned) - Legacy format
|
|
682
|
-
*/
|
|
683
|
-
createCloseTransaction(owner: PublicKey): Promise<Transaction>;
|
|
684
|
-
/**
|
|
685
|
-
* Creates a close transaction (unsigned) - Versioned format (v0)
|
|
686
|
-
*/
|
|
687
|
-
createCloseTransactionV0(owner: PublicKey): Promise<VersionedTransaction>;
|
|
688
|
-
/**
|
|
689
|
-
* Sends a signed legacy transaction and confirms it
|
|
690
|
-
*/
|
|
691
|
-
sendAndConfirm(signedTransaction: Transaction): Promise<string>;
|
|
692
|
-
/**
|
|
693
|
-
* Sends a signed versioned transaction and confirms it
|
|
694
|
-
*/
|
|
695
|
-
sendAndConfirmV0(signedTransaction: VersionedTransaction): Promise<string>;
|
|
266
|
+
sendAndConfirm(signedTx: Transaction): Promise<string>;
|
|
267
|
+
sendAndConfirmV0(signedTx: VersionedTransaction): Promise<string>;
|
|
696
268
|
}
|
|
697
269
|
|
|
698
|
-
export { type AdelosIDL, AdelosIndexer, type AdelosOptions, AdelosSDK,
|
|
270
|
+
export { ADELOS_CONFIG, type AdelosIDL, AdelosIndexer, type AdelosOptions, AdelosSDK, IDL, type IndexerConfig, MEMO_PREFIX, MEMO_PROGRAM_ID, PROGRAM_ID, REGISTRY_SEED, RPC_URL, type RegistryAccount, type RegistryInfo, STEALTH_DOMAIN, type SolanaCluster, type StealthTransaction, bytesToHex, computeSharedSecret, computeSharedSecretAsRecipient, createIndexer, deriveRegistryPda, deriveStealthPubkey, generateEphemeralKeypair, generateStealthAddress, generateStealthMemo, getDiscriminator, hexToBytes, isValidMetaPubkey, parseStealthMemo, recoverStealthSecretKey };
|