@adelos/sdk 0.1.3 → 0.1.6
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 +28 -154
- package/dist/index.d.ts +28 -154
- package/dist/index.js +78 -343
- package/dist/index.mjs +75 -339
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PublicKey, Connection,
|
|
1
|
+
import { PublicKey, Connection, ParsedTransactionWithMeta, Transaction, VersionedTransaction, TransactionInstruction } from '@solana/web3.js';
|
|
2
2
|
import * as ed from '@noble/ed25519';
|
|
3
3
|
|
|
4
4
|
/** Represents a registry account data */
|
|
@@ -29,6 +29,7 @@ declare const ADELOS_CONFIG: {
|
|
|
29
29
|
readonly REGISTRY_SEED: "registry";
|
|
30
30
|
readonly MEMO_PREFIX: "ADLSv1:";
|
|
31
31
|
readonly STEALTH_DOMAIN: "adelos:stealth:v1";
|
|
32
|
+
readonly UNLOCK_MESSAGE: "Adelos Protocol: Unlock Privacy Identity\n\nThis will derive your unique privacy key for stealth addresses. This does not cost gas.";
|
|
32
33
|
};
|
|
33
34
|
declare const PROGRAM_ID: PublicKey;
|
|
34
35
|
declare const RPC_URL: string;
|
|
@@ -66,145 +67,27 @@ declare function bytesToHex(bytes: Uint8Array): string;
|
|
|
66
67
|
*/
|
|
67
68
|
declare function getDiscriminator(instructionName: string): Uint8Array;
|
|
68
69
|
|
|
69
|
-
declare const IDL: {
|
|
70
|
-
readonly address: "7T1UxHJ6psKiQheKZXxANu6mhgsmgaX55eNKZZL5u4Rp";
|
|
71
|
-
readonly metadata: {
|
|
72
|
-
readonly name: "adelos_registry";
|
|
73
|
-
readonly version: "0.1.0";
|
|
74
|
-
readonly spec: "0.1.0";
|
|
75
|
-
readonly description: "Privacy Registry for Adelos Protocol";
|
|
76
|
-
};
|
|
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
|
-
}, {
|
|
100
|
-
readonly name: "register_identity";
|
|
101
|
-
readonly discriminator: readonly [164, 118, 227, 177, 47, 176, 187, 248];
|
|
102
|
-
readonly accounts: readonly [{
|
|
103
|
-
readonly name: "owner";
|
|
104
|
-
readonly writable: true;
|
|
105
|
-
readonly signer: true;
|
|
106
|
-
}, {
|
|
107
|
-
readonly name: "registry";
|
|
108
|
-
readonly writable: true;
|
|
109
|
-
readonly pda: {
|
|
110
|
-
readonly seeds: readonly [{
|
|
111
|
-
readonly kind: "const";
|
|
112
|
-
readonly value: readonly [114, 101, 103, 105, 115, 116, 114, 121];
|
|
113
|
-
}, {
|
|
114
|
-
readonly kind: "account";
|
|
115
|
-
readonly path: "owner";
|
|
116
|
-
}];
|
|
117
|
-
};
|
|
118
|
-
}, {
|
|
119
|
-
readonly name: "system_program";
|
|
120
|
-
readonly address: "11111111111111111111111111111111";
|
|
121
|
-
}];
|
|
122
|
-
readonly args: readonly [{
|
|
123
|
-
readonly name: "meta_pubkey";
|
|
124
|
-
readonly type: {
|
|
125
|
-
readonly array: readonly ["u8", 32];
|
|
126
|
-
};
|
|
127
|
-
}];
|
|
128
|
-
}, {
|
|
129
|
-
readonly name: "update_identity";
|
|
130
|
-
readonly discriminator: readonly [130, 54, 88, 104, 222, 124, 238, 252];
|
|
131
|
-
readonly accounts: readonly [{
|
|
132
|
-
readonly name: "owner";
|
|
133
|
-
readonly writable: true;
|
|
134
|
-
readonly signer: true;
|
|
135
|
-
readonly relations: readonly ["registry"];
|
|
136
|
-
}, {
|
|
137
|
-
readonly name: "registry";
|
|
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";
|
|
151
|
-
}];
|
|
152
|
-
readonly args: readonly [{
|
|
153
|
-
readonly name: "new_meta_pubkey";
|
|
154
|
-
readonly type: {
|
|
155
|
-
readonly array: readonly ["u8", 32];
|
|
156
|
-
};
|
|
157
|
-
}];
|
|
158
|
-
}];
|
|
159
|
-
readonly accounts: readonly [{
|
|
160
|
-
readonly name: "RegistryAccount";
|
|
161
|
-
readonly discriminator: readonly [113, 93, 106, 201, 100, 166, 146, 98];
|
|
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
|
-
}];
|
|
172
|
-
readonly types: readonly [{
|
|
173
|
-
readonly name: "RegistryAccount";
|
|
174
|
-
readonly type: {
|
|
175
|
-
readonly kind: "struct";
|
|
176
|
-
readonly fields: readonly [{
|
|
177
|
-
readonly name: "owner";
|
|
178
|
-
readonly type: "pubkey";
|
|
179
|
-
}, {
|
|
180
|
-
readonly name: "meta_pubkey";
|
|
181
|
-
readonly type: {
|
|
182
|
-
readonly array: readonly ["u8", 32];
|
|
183
|
-
};
|
|
184
|
-
}, {
|
|
185
|
-
readonly name: "bump";
|
|
186
|
-
readonly type: "u8";
|
|
187
|
-
}];
|
|
188
|
-
};
|
|
189
|
-
}];
|
|
190
|
-
};
|
|
191
|
-
type AdelosIDL = typeof IDL;
|
|
192
|
-
|
|
193
70
|
/**
|
|
194
71
|
* Adelos Cryptography Module
|
|
195
|
-
* Implements Single-Key Stealth Address (SKSA) using Ed25519
|
|
72
|
+
* Implements Single-Key Stealth Address (SKSA) using Pure Ed25519 Scalar Operations.
|
|
196
73
|
*/
|
|
197
74
|
|
|
75
|
+
/** Generate Ephemeral Keypair (Pure Scalar) */
|
|
198
76
|
declare function generateEphemeralKeypair(): {
|
|
199
77
|
secretKey: ed.Bytes;
|
|
200
78
|
publicKey: ed.Bytes;
|
|
201
79
|
};
|
|
80
|
+
/** Compute Shared Secret (Sender) */
|
|
202
81
|
declare function computeSharedSecret(ephemeralSk: Uint8Array, recipientMetaPk: Uint8Array): Uint8Array;
|
|
82
|
+
/** Compute Shared Secret (Recipient) */
|
|
203
83
|
declare function computeSharedSecretAsRecipient(metaSk: Uint8Array, ephemeralPk: Uint8Array): Uint8Array;
|
|
84
|
+
/** Derive Stealth Public Key */
|
|
204
85
|
declare function deriveStealthPubkey(metaPk: Uint8Array, sharedSecret: Uint8Array): Uint8Array;
|
|
86
|
+
/** Recover Stealth Private Key */
|
|
205
87
|
declare function recoverStealthSecretKey(metaSk: Uint8Array, sharedSecret: Uint8Array): Uint8Array;
|
|
206
88
|
declare function generateStealthMemo(ephemeralPubkey: Uint8Array): string;
|
|
207
89
|
declare function parseStealthMemo(memo: string): Uint8Array | null;
|
|
90
|
+
/** Full Stealth Address Generation Flow */
|
|
208
91
|
declare function generateStealthAddress(recipientMetaPk: Uint8Array): {
|
|
209
92
|
stealthPubkey: Uint8Array<ArrayBufferLike>;
|
|
210
93
|
ephemeralKeypair: {
|
|
@@ -225,46 +108,37 @@ interface StealthTransaction {
|
|
|
225
108
|
stealthAddress: PublicKey;
|
|
226
109
|
amount: bigint;
|
|
227
110
|
}
|
|
228
|
-
interface IndexerConfig {
|
|
229
|
-
rpcUrl: string;
|
|
230
|
-
heliusApiKey?: string;
|
|
231
|
-
}
|
|
232
111
|
declare class AdelosIndexer {
|
|
233
112
|
private connection;
|
|
234
|
-
|
|
235
|
-
constructor(config: IndexerConfig);
|
|
236
|
-
static create(config: IndexerConfig): AdelosIndexer;
|
|
113
|
+
constructor(connection: Connection);
|
|
237
114
|
/** Scan for stealth transfers to this recipient */
|
|
238
115
|
scanForStealthTransfers(metaSk: Uint8Array, metaPk: Uint8Array, limit?: number): Promise<StealthTransaction[]>;
|
|
239
|
-
/** Trial Decryption:
|
|
240
|
-
|
|
116
|
+
/** * Trial Decryption: Mengecek apakah transaksi ini milik user.
|
|
117
|
+
* Dibuat 'public' agar bisa dites di file testing.
|
|
118
|
+
*/
|
|
119
|
+
attemptDecryption(tx: ParsedTransactionWithMeta, metaSk: Uint8Array, metaPk: Uint8Array): {
|
|
120
|
+
stealthAddress: PublicKey;
|
|
121
|
+
amount: bigint;
|
|
122
|
+
} | null;
|
|
241
123
|
private extractMemo;
|
|
242
124
|
}
|
|
243
|
-
|
|
125
|
+
/** Helper untuk inisialisasi cepat */
|
|
126
|
+
declare function createIndexer(connection: Connection): AdelosIndexer;
|
|
244
127
|
|
|
245
|
-
/**
|
|
246
|
-
* Adelos SDK - Privacy Stealth Transfers on Solana (Devnet)
|
|
247
|
-
*
|
|
248
|
-
* @example
|
|
249
|
-
* const sdk = new AdelosSDK();
|
|
250
|
-
* const registry = await sdk.getRegistry(ownerPubkey);
|
|
251
|
-
*/
|
|
252
128
|
declare class AdelosSDK {
|
|
253
129
|
readonly connection: Connection;
|
|
254
130
|
readonly programId: PublicKey;
|
|
255
131
|
constructor(options?: AdelosOptions);
|
|
256
|
-
deriveRegistryAddress(owner: PublicKey): [PublicKey, number];
|
|
257
132
|
getRegistry(owner: PublicKey): Promise<RegistryInfo>;
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
133
|
+
/** Menghasilkan metaSk tanpa simpan di LocalStorage (Deterministic) */
|
|
134
|
+
unlockPrivacy(signMessage: (msg: Uint8Array) => Promise<Uint8Array>): Promise<Uint8Array>;
|
|
135
|
+
/** API Satu Pintu untuk kirim SOL secara privat */
|
|
136
|
+
createStealthTransfer(sender: PublicKey, receiver: PublicKey, amountSOL: number, version?: "legacy" | "v0"): Promise<Transaction | VersionedTransaction>;
|
|
137
|
+
/** Membuat transaksi pendaftaran identitas */
|
|
138
|
+
createRegisterTransaction(owner: PublicKey, metaPubkey: Uint8Array, version?: "legacy" | "v0"): Promise<Transaction | VersionedTransaction>;
|
|
263
139
|
buildTransaction(payer: PublicKey, instructions: TransactionInstruction[], version?: "legacy" | "v0"): Promise<Transaction | VersionedTransaction>;
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
sendAndConfirm(signedTx: Transaction): Promise<string>;
|
|
267
|
-
sendAndConfirmV0(signedTx: VersionedTransaction): Promise<string>;
|
|
140
|
+
/** Satu fungsi kirim untuk semua jenis transaksi (Legacy/V0) */
|
|
141
|
+
sendAndConfirm(signedTx: Transaction | VersionedTransaction): Promise<string>;
|
|
268
142
|
}
|
|
269
143
|
|
|
270
|
-
export { ADELOS_CONFIG,
|
|
144
|
+
export { ADELOS_CONFIG, AdelosIndexer, type AdelosOptions, AdelosSDK, 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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PublicKey, Connection,
|
|
1
|
+
import { PublicKey, Connection, ParsedTransactionWithMeta, Transaction, VersionedTransaction, TransactionInstruction } from '@solana/web3.js';
|
|
2
2
|
import * as ed from '@noble/ed25519';
|
|
3
3
|
|
|
4
4
|
/** Represents a registry account data */
|
|
@@ -29,6 +29,7 @@ declare const ADELOS_CONFIG: {
|
|
|
29
29
|
readonly REGISTRY_SEED: "registry";
|
|
30
30
|
readonly MEMO_PREFIX: "ADLSv1:";
|
|
31
31
|
readonly STEALTH_DOMAIN: "adelos:stealth:v1";
|
|
32
|
+
readonly UNLOCK_MESSAGE: "Adelos Protocol: Unlock Privacy Identity\n\nThis will derive your unique privacy key for stealth addresses. This does not cost gas.";
|
|
32
33
|
};
|
|
33
34
|
declare const PROGRAM_ID: PublicKey;
|
|
34
35
|
declare const RPC_URL: string;
|
|
@@ -66,145 +67,27 @@ declare function bytesToHex(bytes: Uint8Array): string;
|
|
|
66
67
|
*/
|
|
67
68
|
declare function getDiscriminator(instructionName: string): Uint8Array;
|
|
68
69
|
|
|
69
|
-
declare const IDL: {
|
|
70
|
-
readonly address: "7T1UxHJ6psKiQheKZXxANu6mhgsmgaX55eNKZZL5u4Rp";
|
|
71
|
-
readonly metadata: {
|
|
72
|
-
readonly name: "adelos_registry";
|
|
73
|
-
readonly version: "0.1.0";
|
|
74
|
-
readonly spec: "0.1.0";
|
|
75
|
-
readonly description: "Privacy Registry for Adelos Protocol";
|
|
76
|
-
};
|
|
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
|
-
}, {
|
|
100
|
-
readonly name: "register_identity";
|
|
101
|
-
readonly discriminator: readonly [164, 118, 227, 177, 47, 176, 187, 248];
|
|
102
|
-
readonly accounts: readonly [{
|
|
103
|
-
readonly name: "owner";
|
|
104
|
-
readonly writable: true;
|
|
105
|
-
readonly signer: true;
|
|
106
|
-
}, {
|
|
107
|
-
readonly name: "registry";
|
|
108
|
-
readonly writable: true;
|
|
109
|
-
readonly pda: {
|
|
110
|
-
readonly seeds: readonly [{
|
|
111
|
-
readonly kind: "const";
|
|
112
|
-
readonly value: readonly [114, 101, 103, 105, 115, 116, 114, 121];
|
|
113
|
-
}, {
|
|
114
|
-
readonly kind: "account";
|
|
115
|
-
readonly path: "owner";
|
|
116
|
-
}];
|
|
117
|
-
};
|
|
118
|
-
}, {
|
|
119
|
-
readonly name: "system_program";
|
|
120
|
-
readonly address: "11111111111111111111111111111111";
|
|
121
|
-
}];
|
|
122
|
-
readonly args: readonly [{
|
|
123
|
-
readonly name: "meta_pubkey";
|
|
124
|
-
readonly type: {
|
|
125
|
-
readonly array: readonly ["u8", 32];
|
|
126
|
-
};
|
|
127
|
-
}];
|
|
128
|
-
}, {
|
|
129
|
-
readonly name: "update_identity";
|
|
130
|
-
readonly discriminator: readonly [130, 54, 88, 104, 222, 124, 238, 252];
|
|
131
|
-
readonly accounts: readonly [{
|
|
132
|
-
readonly name: "owner";
|
|
133
|
-
readonly writable: true;
|
|
134
|
-
readonly signer: true;
|
|
135
|
-
readonly relations: readonly ["registry"];
|
|
136
|
-
}, {
|
|
137
|
-
readonly name: "registry";
|
|
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";
|
|
151
|
-
}];
|
|
152
|
-
readonly args: readonly [{
|
|
153
|
-
readonly name: "new_meta_pubkey";
|
|
154
|
-
readonly type: {
|
|
155
|
-
readonly array: readonly ["u8", 32];
|
|
156
|
-
};
|
|
157
|
-
}];
|
|
158
|
-
}];
|
|
159
|
-
readonly accounts: readonly [{
|
|
160
|
-
readonly name: "RegistryAccount";
|
|
161
|
-
readonly discriminator: readonly [113, 93, 106, 201, 100, 166, 146, 98];
|
|
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
|
-
}];
|
|
172
|
-
readonly types: readonly [{
|
|
173
|
-
readonly name: "RegistryAccount";
|
|
174
|
-
readonly type: {
|
|
175
|
-
readonly kind: "struct";
|
|
176
|
-
readonly fields: readonly [{
|
|
177
|
-
readonly name: "owner";
|
|
178
|
-
readonly type: "pubkey";
|
|
179
|
-
}, {
|
|
180
|
-
readonly name: "meta_pubkey";
|
|
181
|
-
readonly type: {
|
|
182
|
-
readonly array: readonly ["u8", 32];
|
|
183
|
-
};
|
|
184
|
-
}, {
|
|
185
|
-
readonly name: "bump";
|
|
186
|
-
readonly type: "u8";
|
|
187
|
-
}];
|
|
188
|
-
};
|
|
189
|
-
}];
|
|
190
|
-
};
|
|
191
|
-
type AdelosIDL = typeof IDL;
|
|
192
|
-
|
|
193
70
|
/**
|
|
194
71
|
* Adelos Cryptography Module
|
|
195
|
-
* Implements Single-Key Stealth Address (SKSA) using Ed25519
|
|
72
|
+
* Implements Single-Key Stealth Address (SKSA) using Pure Ed25519 Scalar Operations.
|
|
196
73
|
*/
|
|
197
74
|
|
|
75
|
+
/** Generate Ephemeral Keypair (Pure Scalar) */
|
|
198
76
|
declare function generateEphemeralKeypair(): {
|
|
199
77
|
secretKey: ed.Bytes;
|
|
200
78
|
publicKey: ed.Bytes;
|
|
201
79
|
};
|
|
80
|
+
/** Compute Shared Secret (Sender) */
|
|
202
81
|
declare function computeSharedSecret(ephemeralSk: Uint8Array, recipientMetaPk: Uint8Array): Uint8Array;
|
|
82
|
+
/** Compute Shared Secret (Recipient) */
|
|
203
83
|
declare function computeSharedSecretAsRecipient(metaSk: Uint8Array, ephemeralPk: Uint8Array): Uint8Array;
|
|
84
|
+
/** Derive Stealth Public Key */
|
|
204
85
|
declare function deriveStealthPubkey(metaPk: Uint8Array, sharedSecret: Uint8Array): Uint8Array;
|
|
86
|
+
/** Recover Stealth Private Key */
|
|
205
87
|
declare function recoverStealthSecretKey(metaSk: Uint8Array, sharedSecret: Uint8Array): Uint8Array;
|
|
206
88
|
declare function generateStealthMemo(ephemeralPubkey: Uint8Array): string;
|
|
207
89
|
declare function parseStealthMemo(memo: string): Uint8Array | null;
|
|
90
|
+
/** Full Stealth Address Generation Flow */
|
|
208
91
|
declare function generateStealthAddress(recipientMetaPk: Uint8Array): {
|
|
209
92
|
stealthPubkey: Uint8Array<ArrayBufferLike>;
|
|
210
93
|
ephemeralKeypair: {
|
|
@@ -225,46 +108,37 @@ interface StealthTransaction {
|
|
|
225
108
|
stealthAddress: PublicKey;
|
|
226
109
|
amount: bigint;
|
|
227
110
|
}
|
|
228
|
-
interface IndexerConfig {
|
|
229
|
-
rpcUrl: string;
|
|
230
|
-
heliusApiKey?: string;
|
|
231
|
-
}
|
|
232
111
|
declare class AdelosIndexer {
|
|
233
112
|
private connection;
|
|
234
|
-
|
|
235
|
-
constructor(config: IndexerConfig);
|
|
236
|
-
static create(config: IndexerConfig): AdelosIndexer;
|
|
113
|
+
constructor(connection: Connection);
|
|
237
114
|
/** Scan for stealth transfers to this recipient */
|
|
238
115
|
scanForStealthTransfers(metaSk: Uint8Array, metaPk: Uint8Array, limit?: number): Promise<StealthTransaction[]>;
|
|
239
|
-
/** Trial Decryption:
|
|
240
|
-
|
|
116
|
+
/** * Trial Decryption: Mengecek apakah transaksi ini milik user.
|
|
117
|
+
* Dibuat 'public' agar bisa dites di file testing.
|
|
118
|
+
*/
|
|
119
|
+
attemptDecryption(tx: ParsedTransactionWithMeta, metaSk: Uint8Array, metaPk: Uint8Array): {
|
|
120
|
+
stealthAddress: PublicKey;
|
|
121
|
+
amount: bigint;
|
|
122
|
+
} | null;
|
|
241
123
|
private extractMemo;
|
|
242
124
|
}
|
|
243
|
-
|
|
125
|
+
/** Helper untuk inisialisasi cepat */
|
|
126
|
+
declare function createIndexer(connection: Connection): AdelosIndexer;
|
|
244
127
|
|
|
245
|
-
/**
|
|
246
|
-
* Adelos SDK - Privacy Stealth Transfers on Solana (Devnet)
|
|
247
|
-
*
|
|
248
|
-
* @example
|
|
249
|
-
* const sdk = new AdelosSDK();
|
|
250
|
-
* const registry = await sdk.getRegistry(ownerPubkey);
|
|
251
|
-
*/
|
|
252
128
|
declare class AdelosSDK {
|
|
253
129
|
readonly connection: Connection;
|
|
254
130
|
readonly programId: PublicKey;
|
|
255
131
|
constructor(options?: AdelosOptions);
|
|
256
|
-
deriveRegistryAddress(owner: PublicKey): [PublicKey, number];
|
|
257
132
|
getRegistry(owner: PublicKey): Promise<RegistryInfo>;
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
133
|
+
/** Menghasilkan metaSk tanpa simpan di LocalStorage (Deterministic) */
|
|
134
|
+
unlockPrivacy(signMessage: (msg: Uint8Array) => Promise<Uint8Array>): Promise<Uint8Array>;
|
|
135
|
+
/** API Satu Pintu untuk kirim SOL secara privat */
|
|
136
|
+
createStealthTransfer(sender: PublicKey, receiver: PublicKey, amountSOL: number, version?: "legacy" | "v0"): Promise<Transaction | VersionedTransaction>;
|
|
137
|
+
/** Membuat transaksi pendaftaran identitas */
|
|
138
|
+
createRegisterTransaction(owner: PublicKey, metaPubkey: Uint8Array, version?: "legacy" | "v0"): Promise<Transaction | VersionedTransaction>;
|
|
263
139
|
buildTransaction(payer: PublicKey, instructions: TransactionInstruction[], version?: "legacy" | "v0"): Promise<Transaction | VersionedTransaction>;
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
sendAndConfirm(signedTx: Transaction): Promise<string>;
|
|
267
|
-
sendAndConfirmV0(signedTx: VersionedTransaction): Promise<string>;
|
|
140
|
+
/** Satu fungsi kirim untuk semua jenis transaksi (Legacy/V0) */
|
|
141
|
+
sendAndConfirm(signedTx: Transaction | VersionedTransaction): Promise<string>;
|
|
268
142
|
}
|
|
269
143
|
|
|
270
|
-
export { ADELOS_CONFIG,
|
|
144
|
+
export { ADELOS_CONFIG, AdelosIndexer, type AdelosOptions, AdelosSDK, 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 };
|