@adelos/sdk 0.1.1 → 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/README.md +87 -59
- package/dist/index.d.mts +89 -421
- package/dist/index.d.ts +89 -421
- package/dist/index.js +360 -685
- package/dist/index.mjs +360 -688
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,50 +1,44 @@
|
|
|
1
|
-
import { PublicKey, Connection, TransactionInstruction, Transaction } from '@solana/web3.js';
|
|
1
|
+
import { PublicKey, Connection, TransactionInstruction, Transaction, VersionedTransaction } from '@solana/web3.js';
|
|
2
|
+
import * as ed from '@noble/ed25519';
|
|
2
3
|
|
|
3
4
|
/** Represents a registry account data */
|
|
4
5
|
interface RegistryAccount {
|
|
5
|
-
/** Owner's wallet public key */
|
|
6
6
|
owner: PublicKey;
|
|
7
|
-
/** Meta public key (encryption key, 32 bytes) */
|
|
8
7
|
metaPubkey: Uint8Array;
|
|
9
|
-
/** PDA bump seed */
|
|
10
8
|
bump: number;
|
|
11
9
|
}
|
|
12
10
|
/** Options for initializing the Adelos SDK */
|
|
13
11
|
interface AdelosOptions {
|
|
14
|
-
/**
|
|
12
|
+
/** Custom RPC URL (optional - uses devnet default if not set) */
|
|
15
13
|
rpcUrl?: string;
|
|
16
|
-
/**
|
|
17
|
-
|
|
14
|
+
/** Helius API key for indexer webhooks (optional) */
|
|
15
|
+
heliusApiKey?: string;
|
|
18
16
|
}
|
|
19
17
|
/** Result of a registry lookup */
|
|
20
18
|
interface RegistryInfo {
|
|
21
|
-
/** PDA address of the registry */
|
|
22
19
|
address: PublicKey;
|
|
23
|
-
/** Registry account data */
|
|
24
20
|
account: RegistryAccount;
|
|
25
|
-
/** Whether the registry exists */
|
|
26
21
|
exists: boolean;
|
|
27
22
|
}
|
|
28
|
-
/** Transaction result */
|
|
29
|
-
interface TransactionResult {
|
|
30
|
-
/** Transaction signature */
|
|
31
|
-
signature: string;
|
|
32
|
-
/** Registry PDA address */
|
|
33
|
-
registryAddress: PublicKey;
|
|
34
|
-
}
|
|
35
23
|
|
|
36
|
-
|
|
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
|
+
};
|
|
37
33
|
declare const PROGRAM_ID: PublicKey;
|
|
38
|
-
|
|
39
|
-
declare const
|
|
40
|
-
|
|
41
|
-
declare const
|
|
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";
|
|
42
39
|
|
|
43
40
|
/**
|
|
44
41
|
* Derives the registry PDA for a given owner
|
|
45
|
-
* @param owner - The owner's wallet public key
|
|
46
|
-
* @param programId - Optional custom program ID
|
|
47
|
-
* @returns Tuple of [PDA address, bump seed]
|
|
48
42
|
*/
|
|
49
43
|
declare function deriveRegistryPda(owner: PublicKey, programId?: PublicKey): [PublicKey, number];
|
|
50
44
|
/**
|
|
@@ -78,8 +72,31 @@ declare const IDL: {
|
|
|
78
72
|
readonly name: "adelos_registry";
|
|
79
73
|
readonly version: "0.1.0";
|
|
80
74
|
readonly spec: "0.1.0";
|
|
75
|
+
readonly description: "Privacy Registry for Adelos Protocol";
|
|
81
76
|
};
|
|
82
77
|
readonly instructions: readonly [{
|
|
78
|
+
readonly name: "close_registry";
|
|
79
|
+
readonly discriminator: readonly [76, 32, 154, 180, 51, 159, 218, 102];
|
|
80
|
+
readonly accounts: readonly [{
|
|
81
|
+
readonly name: "owner";
|
|
82
|
+
readonly writable: true;
|
|
83
|
+
readonly signer: true;
|
|
84
|
+
readonly relations: readonly ["registry"];
|
|
85
|
+
}, {
|
|
86
|
+
readonly name: "registry";
|
|
87
|
+
readonly writable: true;
|
|
88
|
+
readonly pda: {
|
|
89
|
+
readonly seeds: readonly [{
|
|
90
|
+
readonly kind: "const";
|
|
91
|
+
readonly value: readonly [114, 101, 103, 105, 115, 116, 114, 121];
|
|
92
|
+
}, {
|
|
93
|
+
readonly kind: "account";
|
|
94
|
+
readonly path: "owner";
|
|
95
|
+
}];
|
|
96
|
+
};
|
|
97
|
+
}];
|
|
98
|
+
readonly args: readonly [];
|
|
99
|
+
}, {
|
|
83
100
|
readonly name: "register_identity";
|
|
84
101
|
readonly discriminator: readonly [164, 118, 227, 177, 47, 176, 187, 248];
|
|
85
102
|
readonly accounts: readonly [{
|
|
@@ -113,10 +130,24 @@ declare const IDL: {
|
|
|
113
130
|
readonly discriminator: readonly [130, 54, 88, 104, 222, 124, 238, 252];
|
|
114
131
|
readonly accounts: readonly [{
|
|
115
132
|
readonly name: "owner";
|
|
133
|
+
readonly writable: true;
|
|
116
134
|
readonly signer: true;
|
|
135
|
+
readonly relations: readonly ["registry"];
|
|
117
136
|
}, {
|
|
118
137
|
readonly name: "registry";
|
|
119
138
|
readonly writable: true;
|
|
139
|
+
readonly pda: {
|
|
140
|
+
readonly seeds: readonly [{
|
|
141
|
+
readonly kind: "const";
|
|
142
|
+
readonly value: readonly [114, 101, 103, 105, 115, 116, 114, 121];
|
|
143
|
+
}, {
|
|
144
|
+
readonly kind: "account";
|
|
145
|
+
readonly path: "owner";
|
|
146
|
+
}];
|
|
147
|
+
};
|
|
148
|
+
}, {
|
|
149
|
+
readonly name: "system_program";
|
|
150
|
+
readonly address: "11111111111111111111111111111111";
|
|
120
151
|
}];
|
|
121
152
|
readonly args: readonly [{
|
|
122
153
|
readonly name: "new_meta_pubkey";
|
|
@@ -124,23 +155,20 @@ declare const IDL: {
|
|
|
124
155
|
readonly array: readonly ["u8", 32];
|
|
125
156
|
};
|
|
126
157
|
}];
|
|
127
|
-
}, {
|
|
128
|
-
readonly name: "close_registry";
|
|
129
|
-
readonly discriminator: readonly [76, 32, 154, 180, 51, 159, 218, 102];
|
|
130
|
-
readonly accounts: readonly [{
|
|
131
|
-
readonly name: "owner";
|
|
132
|
-
readonly writable: true;
|
|
133
|
-
readonly signer: true;
|
|
134
|
-
}, {
|
|
135
|
-
readonly name: "registry";
|
|
136
|
-
readonly writable: true;
|
|
137
|
-
}];
|
|
138
|
-
readonly args: readonly [];
|
|
139
158
|
}];
|
|
140
159
|
readonly accounts: readonly [{
|
|
141
160
|
readonly name: "RegistryAccount";
|
|
142
161
|
readonly discriminator: readonly [113, 93, 106, 201, 100, 166, 146, 98];
|
|
143
162
|
}];
|
|
163
|
+
readonly errors: readonly [{
|
|
164
|
+
readonly code: 6000;
|
|
165
|
+
readonly name: "InvalidMetaPubkey";
|
|
166
|
+
readonly msg: "Invalid meta_pubkey";
|
|
167
|
+
}, {
|
|
168
|
+
readonly code: 6001;
|
|
169
|
+
readonly name: "Unauthorized";
|
|
170
|
+
readonly msg: "Unauthorized";
|
|
171
|
+
}];
|
|
144
172
|
readonly types: readonly [{
|
|
145
173
|
readonly name: "RegistryAccount";
|
|
146
174
|
readonly type: {
|
|
@@ -159,444 +187,84 @@ declare const IDL: {
|
|
|
159
187
|
}];
|
|
160
188
|
};
|
|
161
189
|
}];
|
|
162
|
-
readonly errors: readonly [{
|
|
163
|
-
readonly code: 6000;
|
|
164
|
-
readonly name: "InvalidMetaPubkey";
|
|
165
|
-
readonly msg: "Invalid meta_pubkey";
|
|
166
|
-
}, {
|
|
167
|
-
readonly code: 6001;
|
|
168
|
-
readonly name: "Unauthorized";
|
|
169
|
-
readonly msg: "Unauthorized";
|
|
170
|
-
}];
|
|
171
190
|
};
|
|
172
191
|
type AdelosIDL = typeof IDL;
|
|
173
192
|
|
|
174
193
|
/**
|
|
175
194
|
* Adelos Cryptography Module
|
|
176
|
-
*
|
|
177
195
|
* Implements Single-Key Stealth Address (SKSA) using Ed25519 curve operations.
|
|
178
|
-
*
|
|
179
|
-
* Flow:
|
|
180
|
-
* 1. Sender gets recipient's meta_pubkey from registry
|
|
181
|
-
* 2. Sender generates ephemeral keypair
|
|
182
|
-
* 3. ECDH: shared_secret = ephemeral_sk * meta_pubkey
|
|
183
|
-
* 4. Stealth pubkey = meta_pubkey + hash_to_scalar(shared_secret) * G
|
|
184
|
-
* 5. Recipient can recover stealth_sk = meta_sk + hash_to_scalar(shared_secret)
|
|
185
|
-
*/
|
|
186
|
-
/**
|
|
187
|
-
* Generates an ephemeral keypair for stealth address derivation
|
|
188
|
-
* @returns Object with secretKey (32 bytes) and publicKey (32 bytes)
|
|
189
196
|
*/
|
|
197
|
+
|
|
190
198
|
declare function generateEphemeralKeypair(): {
|
|
191
|
-
secretKey:
|
|
192
|
-
publicKey:
|
|
199
|
+
secretKey: ed.Bytes;
|
|
200
|
+
publicKey: ed.Bytes;
|
|
193
201
|
};
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
* @param recipientMetaPubkey - Recipient's meta public key (32 bytes)
|
|
198
|
-
* @returns Shared secret (32 bytes)
|
|
199
|
-
*/
|
|
200
|
-
declare function computeSharedSecret(ephemeralSk: Uint8Array, recipientMetaPubkey: Uint8Array): Promise<Uint8Array>;
|
|
201
|
-
/**
|
|
202
|
-
* Derives a stealth public key from meta pubkey and shared secret
|
|
203
|
-
*
|
|
204
|
-
* stealth_pubkey = meta_pubkey + hash_to_scalar(shared_secret) * G
|
|
205
|
-
*
|
|
206
|
-
* @param metaPubkey - Recipient's meta public key (32 bytes)
|
|
207
|
-
* @param sharedSecret - ECDH shared secret (32 bytes)
|
|
208
|
-
* @returns Stealth public key (32 bytes)
|
|
209
|
-
*/
|
|
210
|
-
declare function deriveStealthPubkey(metaPubkey: Uint8Array, sharedSecret: Uint8Array): Uint8Array;
|
|
211
|
-
/**
|
|
212
|
-
* Recovers the stealth secret key (for recipient)
|
|
213
|
-
*
|
|
214
|
-
* stealth_sk = meta_sk + hash_to_scalar(shared_secret)
|
|
215
|
-
*
|
|
216
|
-
* @param metaSk - Recipient's meta secret key (32 bytes)
|
|
217
|
-
* @param sharedSecret - ECDH shared secret (32 bytes)
|
|
218
|
-
* @returns Stealth secret key (32 bytes)
|
|
219
|
-
*/
|
|
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;
|
|
220
205
|
declare function recoverStealthSecretKey(metaSk: Uint8Array, sharedSecret: Uint8Array): Uint8Array;
|
|
221
|
-
/**
|
|
222
|
-
* Computes shared secret from recipient's perspective
|
|
223
|
-
* (using meta secret key and sender's ephemeral pubkey)
|
|
224
|
-
*
|
|
225
|
-
* @param metaSk - Recipient's meta secret key (32 bytes)
|
|
226
|
-
* @param ephemeralPubkey - Sender's ephemeral public key (32 bytes)
|
|
227
|
-
* @returns Shared secret (32 bytes)
|
|
228
|
-
*/
|
|
229
|
-
declare function computeSharedSecretAsRecipient(metaSk: Uint8Array, ephemeralPubkey: Uint8Array): Promise<Uint8Array>;
|
|
230
|
-
/**
|
|
231
|
-
* Generates memo string for stealth transfer
|
|
232
|
-
* Format: ADLSv1:[ephemeral_pubkey_hex]
|
|
233
|
-
*
|
|
234
|
-
* @param ephemeralPubkey - Ephemeral public key (32 bytes)
|
|
235
|
-
* @returns Memo string
|
|
236
|
-
*/
|
|
237
206
|
declare function generateStealthMemo(ephemeralPubkey: Uint8Array): string;
|
|
238
|
-
/**
|
|
239
|
-
* Parses a stealth transfer memo
|
|
240
|
-
*
|
|
241
|
-
* @param memo - Memo string
|
|
242
|
-
* @returns Ephemeral public key or null if invalid
|
|
243
|
-
*/
|
|
244
207
|
declare function parseStealthMemo(memo: string): Uint8Array | null;
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
*
|
|
248
|
-
* @param recipientMetaPubkey - Recipient's meta public key from registry
|
|
249
|
-
* @returns Object with stealthPubkey, ephemeralPubkey, and memo
|
|
250
|
-
*/
|
|
251
|
-
declare function generateStealthAddress(recipientMetaPubkey: Uint8Array): Promise<{
|
|
252
|
-
stealthPubkey: Uint8Array;
|
|
208
|
+
declare function generateStealthAddress(recipientMetaPk: Uint8Array): {
|
|
209
|
+
stealthPubkey: Uint8Array<ArrayBufferLike>;
|
|
253
210
|
ephemeralKeypair: {
|
|
254
|
-
secretKey:
|
|
255
|
-
publicKey:
|
|
211
|
+
secretKey: ed.Bytes;
|
|
212
|
+
publicKey: ed.Bytes;
|
|
256
213
|
};
|
|
257
|
-
sharedSecret: Uint8Array
|
|
214
|
+
sharedSecret: Uint8Array<ArrayBufferLike>;
|
|
258
215
|
memo: string;
|
|
259
|
-
}>;
|
|
260
|
-
/**
|
|
261
|
-
* Checks if a transaction is for this recipient (for scanning)
|
|
262
|
-
*
|
|
263
|
-
* @param metaSk - Recipient's meta secret key
|
|
264
|
-
* @param metaPubkey - Recipient's meta public key
|
|
265
|
-
* @param ephemeralPubkey - Ephemeral pubkey from memo
|
|
266
|
-
* @param targetAddress - The address that received funds
|
|
267
|
-
* @returns True if this transaction is for the recipient
|
|
268
|
-
*/
|
|
269
|
-
declare function isStealthTransactionForMe(metaSk: Uint8Array, metaPubkey: Uint8Array, ephemeralPubkey: Uint8Array, targetAddress: Uint8Array): Promise<boolean>;
|
|
270
|
-
|
|
271
|
-
/**
|
|
272
|
-
* Adelos Light Protocol Integration
|
|
273
|
-
*
|
|
274
|
-
* Provides ZK-Compression for confidential transfers using Light Protocol.
|
|
275
|
-
* Compressed tokens are stored in Merkle trees instead of regular accounts,
|
|
276
|
-
* providing significant cost savings and enhanced privacy.
|
|
277
|
-
*/
|
|
278
|
-
|
|
279
|
-
/** Light Protocol program IDs */
|
|
280
|
-
declare const LIGHT_PROGRAM_IDS: {
|
|
281
|
-
LIGHT_SYSTEM_PROGRAM: PublicKey;
|
|
282
|
-
COMPRESSED_TOKEN_PROGRAM: PublicKey;
|
|
283
|
-
ACCOUNT_COMPRESSION_PROGRAM: PublicKey;
|
|
284
216
|
};
|
|
285
|
-
/** Configuration for Light Protocol RPC */
|
|
286
|
-
interface LightConfig {
|
|
287
|
-
/** Light Protocol RPC endpoint */
|
|
288
|
-
rpcUrl: string;
|
|
289
|
-
/** Compression public key (for tree) */
|
|
290
|
-
compressionPubkey?: PublicKey;
|
|
291
|
-
}
|
|
292
|
-
/** Compressed account info */
|
|
293
|
-
interface CompressedAccount {
|
|
294
|
-
/** Account hash */
|
|
295
|
-
hash: string;
|
|
296
|
-
/** Owner public key */
|
|
297
|
-
owner: PublicKey;
|
|
298
|
-
/** Lamports in account */
|
|
299
|
-
lamports: number;
|
|
300
|
-
/** Account data */
|
|
301
|
-
data: Uint8Array;
|
|
302
|
-
/** Merkle tree address */
|
|
303
|
-
tree: PublicKey;
|
|
304
|
-
/** Leaf index in tree */
|
|
305
|
-
leafIndex: number;
|
|
306
|
-
}
|
|
307
|
-
/** Compressed token balance */
|
|
308
|
-
interface CompressedTokenBalance {
|
|
309
|
-
/** Token mint */
|
|
310
|
-
mint: PublicKey;
|
|
311
|
-
/** Balance amount */
|
|
312
|
-
amount: bigint;
|
|
313
|
-
/** Source accounts */
|
|
314
|
-
accounts: CompressedAccount[];
|
|
315
|
-
}
|
|
316
|
-
/**
|
|
317
|
-
* Light Protocol client for ZK-Compression operations
|
|
318
|
-
*/
|
|
319
|
-
declare class LightClient {
|
|
320
|
-
private connection;
|
|
321
|
-
private config;
|
|
322
|
-
constructor(connection: Connection, config: LightConfig);
|
|
323
|
-
/**
|
|
324
|
-
* Creates a new Light Protocol client
|
|
325
|
-
*
|
|
326
|
-
* @param rpcUrl - Solana RPC URL with Light Protocol support
|
|
327
|
-
* @returns LightClient instance
|
|
328
|
-
*/
|
|
329
|
-
static create(rpcUrl: string): LightClient;
|
|
330
|
-
/**
|
|
331
|
-
* Gets compressed SOL balance for an address
|
|
332
|
-
*
|
|
333
|
-
* @param owner - Owner public key
|
|
334
|
-
* @returns Compressed SOL balance in lamports
|
|
335
|
-
*/
|
|
336
|
-
getCompressedSolBalance(owner: PublicKey): Promise<bigint>;
|
|
337
|
-
/**
|
|
338
|
-
* Gets compressed token balances for an address
|
|
339
|
-
*
|
|
340
|
-
* @param owner - Owner public key
|
|
341
|
-
* @param mint - Optional token mint to filter
|
|
342
|
-
* @returns Array of compressed token balances
|
|
343
|
-
*/
|
|
344
|
-
getCompressedTokenBalances(owner: PublicKey, mint?: PublicKey): Promise<CompressedTokenBalance[]>;
|
|
345
|
-
/**
|
|
346
|
-
* Creates a compressed SOL transfer instruction
|
|
347
|
-
*
|
|
348
|
-
* Note: This creates the instruction data structure.
|
|
349
|
-
* Actual ZK proof generation requires Light Protocol SDK.
|
|
350
|
-
*
|
|
351
|
-
* @param from - Sender public key
|
|
352
|
-
* @param to - Recipient public key (can be stealth address)
|
|
353
|
-
* @param amount - Amount in lamports
|
|
354
|
-
* @returns Transaction instruction (placeholder)
|
|
355
|
-
*/
|
|
356
|
-
createCompressedTransferInstruction(from: PublicKey, to: PublicKey, amount: bigint): TransactionInstruction;
|
|
357
|
-
/**
|
|
358
|
-
* Compresses SOL from regular account to compressed account
|
|
359
|
-
*
|
|
360
|
-
* @param owner - Owner public key
|
|
361
|
-
* @param amount - Amount in lamports to compress
|
|
362
|
-
* @returns Transaction (unsigned)
|
|
363
|
-
*/
|
|
364
|
-
createCompressSolTransaction(owner: PublicKey, amount: bigint): Promise<Transaction>;
|
|
365
|
-
/**
|
|
366
|
-
* Decompresses SOL from compressed account to regular account
|
|
367
|
-
*
|
|
368
|
-
* @param owner - Owner public key
|
|
369
|
-
* @param amount - Amount in lamports to decompress
|
|
370
|
-
* @returns Transaction (unsigned)
|
|
371
|
-
*/
|
|
372
|
-
createDecompressSolTransaction(owner: PublicKey, amount: bigint): Promise<Transaction>;
|
|
373
|
-
/**
|
|
374
|
-
* Creates a stealth compressed transfer
|
|
375
|
-
* Combines stealth addressing with ZK-compression
|
|
376
|
-
*
|
|
377
|
-
* @param from - Sender public key
|
|
378
|
-
* @param stealthPubkey - Derived stealth address for recipient
|
|
379
|
-
* @param amount - Amount in lamports
|
|
380
|
-
* @param memo - Stealth memo containing ephemeral pubkey
|
|
381
|
-
* @returns Transaction (unsigned)
|
|
382
|
-
*/
|
|
383
|
-
createStealthCompressedTransfer(from: PublicKey, stealthPubkey: Uint8Array, amount: bigint, memo: string): Promise<Transaction>;
|
|
384
|
-
}
|
|
385
|
-
/**
|
|
386
|
-
* Creates a Light Protocol client for ZK-compression operations
|
|
387
|
-
*
|
|
388
|
-
* @param rpcUrl - RPC URL with Light Protocol support
|
|
389
|
-
* @returns LightClient instance
|
|
390
|
-
*/
|
|
391
|
-
declare function createLightClient(rpcUrl: string): LightClient;
|
|
392
217
|
|
|
393
218
|
/**
|
|
394
|
-
* Adelos Indexer
|
|
395
|
-
*
|
|
396
|
-
* Provides transaction scanning for stealth transfers.
|
|
397
|
-
* Supports:
|
|
398
|
-
* 1. Helius Webhook integration for real-time notifications
|
|
399
|
-
* 2. Manual RPC scanning for historical transactions
|
|
219
|
+
* Adelos Indexer - Privacy-Preserving Transaction Scanner
|
|
400
220
|
*/
|
|
401
221
|
|
|
402
|
-
/** Stealth transaction detected by indexer */
|
|
403
222
|
interface StealthTransaction {
|
|
404
|
-
/** Transaction signature */
|
|
405
223
|
signature: string;
|
|
406
|
-
/** Block time (unix timestamp) */
|
|
407
224
|
blockTime: number | null;
|
|
408
|
-
/** Slot number */
|
|
409
|
-
slot: number;
|
|
410
|
-
/** Sender's wallet (if detectable) */
|
|
411
|
-
sender: PublicKey | null;
|
|
412
|
-
/** Stealth address that received funds */
|
|
413
225
|
stealthAddress: PublicKey;
|
|
414
|
-
/** Amount transferred (lamports) */
|
|
415
226
|
amount: bigint;
|
|
416
|
-
/** Ephemeral public key from memo */
|
|
417
|
-
ephemeralPubkey: Uint8Array;
|
|
418
|
-
/** Whether this is for the current user */
|
|
419
|
-
isForMe: boolean;
|
|
420
|
-
/** Recovered stealth secret key (if isForMe) */
|
|
421
|
-
stealthSecretKey?: Uint8Array;
|
|
422
|
-
}
|
|
423
|
-
/** Helius webhook payload */
|
|
424
|
-
interface HeliusWebhookPayload {
|
|
425
|
-
type: string;
|
|
426
|
-
signature: string;
|
|
427
|
-
slot: number;
|
|
428
|
-
timestamp: number;
|
|
429
|
-
accountData: Array<{
|
|
430
|
-
account: string;
|
|
431
|
-
nativeBalanceChange: number;
|
|
432
|
-
tokenBalanceChanges: Array<{
|
|
433
|
-
mint: string;
|
|
434
|
-
rawTokenAmount: {
|
|
435
|
-
tokenAmount: string;
|
|
436
|
-
};
|
|
437
|
-
}>;
|
|
438
|
-
}>;
|
|
439
|
-
instructions: Array<{
|
|
440
|
-
programId: string;
|
|
441
|
-
data: string;
|
|
442
|
-
accounts: string[];
|
|
443
|
-
}>;
|
|
444
227
|
}
|
|
445
|
-
/** Indexer configuration */
|
|
446
228
|
interface IndexerConfig {
|
|
447
|
-
/** Solana RPC URL */
|
|
448
229
|
rpcUrl: string;
|
|
449
|
-
/** Helius API key (optional, for webhooks) */
|
|
450
230
|
heliusApiKey?: string;
|
|
451
|
-
/** Scan interval in ms (for polling mode) */
|
|
452
|
-
scanInterval?: number;
|
|
453
231
|
}
|
|
454
|
-
/**
|
|
455
|
-
* Adelos Indexer for scanning stealth transfers
|
|
456
|
-
*/
|
|
457
232
|
declare class AdelosIndexer {
|
|
458
233
|
private connection;
|
|
459
|
-
private
|
|
460
|
-
private isScanning;
|
|
461
|
-
private scanIntervalId;
|
|
462
|
-
/** Callback for when a stealth transaction is detected */
|
|
463
|
-
onTransaction?: (tx: StealthTransaction) => void;
|
|
234
|
+
private heliusApiKey?;
|
|
464
235
|
constructor(config: IndexerConfig);
|
|
465
|
-
/**
|
|
466
|
-
* Creates an indexer instance
|
|
467
|
-
*/
|
|
468
236
|
static create(config: IndexerConfig): AdelosIndexer;
|
|
469
|
-
/**
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
* @param metaPubkey - Recipient's meta public key
|
|
474
|
-
* @param limit - Number of transactions to scan
|
|
475
|
-
* @returns Array of stealth transactions for this recipient
|
|
476
|
-
*/
|
|
477
|
-
scanForStealthTransfers(metaSk: Uint8Array, metaPubkey: Uint8Array, limit?: number): Promise<StealthTransaction[]>;
|
|
478
|
-
/**
|
|
479
|
-
* Scans all transactions with ADLSv1 memo prefix
|
|
480
|
-
*
|
|
481
|
-
* @param metaSk - Recipient's meta secret key
|
|
482
|
-
* @param metaPubkey - Recipient's meta public key
|
|
483
|
-
* @param since - Scan transactions after this signature
|
|
484
|
-
* @returns Array of stealth transactions
|
|
485
|
-
*/
|
|
486
|
-
scanByMemoPrefix(metaSk: Uint8Array, metaPubkey: Uint8Array, since?: string): Promise<StealthTransaction[]>;
|
|
487
|
-
/**
|
|
488
|
-
* Extracts memo from a parsed transaction
|
|
489
|
-
*/
|
|
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;
|
|
490
241
|
private extractMemo;
|
|
491
|
-
/**
|
|
492
|
-
* Parses a transaction to extract stealth transfer info
|
|
493
|
-
*/
|
|
494
|
-
private parseStealthTransaction;
|
|
495
|
-
/**
|
|
496
|
-
* Starts continuous scanning for stealth transfers
|
|
497
|
-
*
|
|
498
|
-
* @param metaSk - Recipient's meta secret key
|
|
499
|
-
* @param metaPubkey - Recipient's meta public key
|
|
500
|
-
*/
|
|
501
|
-
startScanning(metaSk: Uint8Array, metaPubkey: Uint8Array): void;
|
|
502
|
-
/**
|
|
503
|
-
* Stops continuous scanning
|
|
504
|
-
*/
|
|
505
|
-
stopScanning(): void;
|
|
506
|
-
/**
|
|
507
|
-
* Processes a Helius webhook payload
|
|
508
|
-
*
|
|
509
|
-
* @param payload - Webhook payload from Helius
|
|
510
|
-
* @param metaSk - Recipient's meta secret key
|
|
511
|
-
* @param metaPubkey - Recipient's meta public key
|
|
512
|
-
* @returns Stealth transaction if detected and for this recipient
|
|
513
|
-
*/
|
|
514
|
-
processWebhook(payload: HeliusWebhookPayload, metaSk: Uint8Array, metaPubkey: Uint8Array): Promise<StealthTransaction | null>;
|
|
515
|
-
/**
|
|
516
|
-
* Sets up Helius webhook for real-time notifications
|
|
517
|
-
*
|
|
518
|
-
* @param webhookUrl - Your server's webhook endpoint
|
|
519
|
-
* @returns Webhook ID
|
|
520
|
-
*/
|
|
521
|
-
setupHeliusWebhook(webhookUrl: string): Promise<string | null>;
|
|
522
242
|
}
|
|
523
|
-
/**
|
|
524
|
-
* Creates an Adelos indexer instance
|
|
525
|
-
*/
|
|
526
243
|
declare function createIndexer(config: IndexerConfig): AdelosIndexer;
|
|
527
244
|
|
|
528
245
|
/**
|
|
529
|
-
* Adelos SDK - Privacy
|
|
246
|
+
* Adelos SDK - Privacy Stealth Transfers on Solana (Devnet)
|
|
530
247
|
*
|
|
531
248
|
* @example
|
|
532
|
-
*
|
|
533
|
-
* import { AdelosSDK } from "@adelos/sdk";
|
|
534
|
-
*
|
|
535
|
-
* const sdk = new AdelosSDK({ rpcUrl: "https://api.devnet.solana.com" });
|
|
536
|
-
*
|
|
537
|
-
* // Register identity
|
|
538
|
-
* const metaPubkey = new Uint8Array(32).fill(1);
|
|
539
|
-
* const result = await sdk.register(wallet, metaPubkey);
|
|
540
|
-
*
|
|
541
|
-
* // Get registry
|
|
249
|
+
* const sdk = new AdelosSDK();
|
|
542
250
|
* const registry = await sdk.getRegistry(ownerPubkey);
|
|
543
|
-
* console.log(registry.account.metaPubkey);
|
|
544
|
-
* ```
|
|
545
251
|
*/
|
|
546
252
|
declare class AdelosSDK {
|
|
547
253
|
readonly connection: Connection;
|
|
548
254
|
readonly programId: PublicKey;
|
|
549
|
-
private program;
|
|
550
255
|
constructor(options?: AdelosOptions);
|
|
551
|
-
/**
|
|
552
|
-
* Derives the registry PDA for an owner
|
|
553
|
-
*/
|
|
554
256
|
deriveRegistryAddress(owner: PublicKey): [PublicKey, number];
|
|
555
|
-
/**
|
|
556
|
-
* Fetches a registry account by owner
|
|
557
|
-
*/
|
|
558
257
|
getRegistry(owner: PublicKey): Promise<RegistryInfo>;
|
|
559
|
-
/**
|
|
560
|
-
* Gets the meta pubkey for an owner
|
|
561
|
-
* @returns The meta pubkey as Uint8Array, or null if not registered
|
|
562
|
-
*/
|
|
563
258
|
getMetaPubkey(owner: PublicKey): Promise<Uint8Array | null>;
|
|
564
|
-
/**
|
|
565
|
-
* Gets the meta pubkey as hex string
|
|
566
|
-
*/
|
|
567
|
-
getMetaPubkeyHex(owner: PublicKey): Promise<string | null>;
|
|
568
|
-
/**
|
|
569
|
-
* Checks if an owner has a registered identity
|
|
570
|
-
*/
|
|
571
259
|
isRegistered(owner: PublicKey): Promise<boolean>;
|
|
572
|
-
/**
|
|
573
|
-
* Creates a register identity instruction
|
|
574
|
-
*/
|
|
575
260
|
createRegisterInstruction(owner: PublicKey, metaPubkey: Uint8Array): TransactionInstruction;
|
|
576
|
-
/**
|
|
577
|
-
* Creates an update identity instruction
|
|
578
|
-
*/
|
|
579
261
|
createUpdateInstruction(owner: PublicKey, newMetaPubkey: Uint8Array): TransactionInstruction;
|
|
580
|
-
/**
|
|
581
|
-
* Creates a close registry instruction
|
|
582
|
-
*/
|
|
583
262
|
createCloseInstruction(owner: PublicKey): TransactionInstruction;
|
|
584
|
-
|
|
585
|
-
* Creates a register transaction (unsigned)
|
|
586
|
-
*/
|
|
263
|
+
buildTransaction(payer: PublicKey, instructions: TransactionInstruction[], version?: "legacy" | "v0"): Promise<Transaction | VersionedTransaction>;
|
|
587
264
|
createRegisterTransaction(owner: PublicKey, metaPubkey: Uint8Array): Promise<Transaction>;
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
createUpdateTransaction(owner: PublicKey, newMetaPubkey: Uint8Array): Promise<Transaction>;
|
|
592
|
-
/**
|
|
593
|
-
* Creates a close transaction (unsigned)
|
|
594
|
-
*/
|
|
595
|
-
createCloseTransaction(owner: PublicKey): Promise<Transaction>;
|
|
596
|
-
/**
|
|
597
|
-
* Sends a signed transaction and confirms it
|
|
598
|
-
*/
|
|
599
|
-
sendAndConfirm(signedTransaction: Transaction): Promise<string>;
|
|
265
|
+
createRegisterTransactionV0(owner: PublicKey, metaPubkey: Uint8Array): Promise<VersionedTransaction>;
|
|
266
|
+
sendAndConfirm(signedTx: Transaction): Promise<string>;
|
|
267
|
+
sendAndConfirmV0(signedTx: VersionedTransaction): Promise<string>;
|
|
600
268
|
}
|
|
601
269
|
|
|
602
|
-
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 };
|