@adelos/sdk 0.1.5 → 0.1.7
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 +30 -154
- package/dist/index.d.ts +30 -154
- package/dist/index.js +84 -344
- package/dist/index.mjs +80 -340
- 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,29 @@ 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
|
+
/** Derive Public Key from Secret Key */
|
|
81
|
+
declare function derivePublicKey(secretKey: Uint8Array): Uint8Array;
|
|
82
|
+
/** Compute Shared Secret (Sender) */
|
|
202
83
|
declare function computeSharedSecret(ephemeralSk: Uint8Array, recipientMetaPk: Uint8Array): Uint8Array;
|
|
84
|
+
/** Compute Shared Secret (Recipient) */
|
|
203
85
|
declare function computeSharedSecretAsRecipient(metaSk: Uint8Array, ephemeralPk: Uint8Array): Uint8Array;
|
|
86
|
+
/** Derive Stealth Public Key */
|
|
204
87
|
declare function deriveStealthPubkey(metaPk: Uint8Array, sharedSecret: Uint8Array): Uint8Array;
|
|
88
|
+
/** Recover Stealth Private Key */
|
|
205
89
|
declare function recoverStealthSecretKey(metaSk: Uint8Array, sharedSecret: Uint8Array): Uint8Array;
|
|
206
90
|
declare function generateStealthMemo(ephemeralPubkey: Uint8Array): string;
|
|
207
91
|
declare function parseStealthMemo(memo: string): Uint8Array | null;
|
|
92
|
+
/** Full Stealth Address Generation Flow */
|
|
208
93
|
declare function generateStealthAddress(recipientMetaPk: Uint8Array): {
|
|
209
94
|
stealthPubkey: Uint8Array<ArrayBufferLike>;
|
|
210
95
|
ephemeralKeypair: {
|
|
@@ -225,46 +110,37 @@ interface StealthTransaction {
|
|
|
225
110
|
stealthAddress: PublicKey;
|
|
226
111
|
amount: bigint;
|
|
227
112
|
}
|
|
228
|
-
interface IndexerConfig {
|
|
229
|
-
rpcUrl: string;
|
|
230
|
-
heliusApiKey?: string;
|
|
231
|
-
}
|
|
232
113
|
declare class AdelosIndexer {
|
|
233
114
|
private connection;
|
|
234
|
-
|
|
235
|
-
constructor(config: IndexerConfig);
|
|
236
|
-
static create(config: IndexerConfig): AdelosIndexer;
|
|
115
|
+
constructor(connection: Connection);
|
|
237
116
|
/** Scan for stealth transfers to this recipient */
|
|
238
117
|
scanForStealthTransfers(metaSk: Uint8Array, metaPk: Uint8Array, limit?: number): Promise<StealthTransaction[]>;
|
|
239
|
-
/** Trial Decryption:
|
|
240
|
-
|
|
118
|
+
/** * Trial Decryption: Mengecek apakah transaksi ini milik user.
|
|
119
|
+
* Dibuat 'public' agar bisa dites di file testing.
|
|
120
|
+
*/
|
|
121
|
+
attemptDecryption(tx: ParsedTransactionWithMeta, metaSk: Uint8Array, metaPk: Uint8Array): {
|
|
122
|
+
stealthAddress: PublicKey;
|
|
123
|
+
amount: bigint;
|
|
124
|
+
} | null;
|
|
241
125
|
private extractMemo;
|
|
242
126
|
}
|
|
243
|
-
|
|
127
|
+
/** Helper untuk inisialisasi cepat */
|
|
128
|
+
declare function createIndexer(connection: Connection): AdelosIndexer;
|
|
244
129
|
|
|
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
130
|
declare class AdelosSDK {
|
|
253
131
|
readonly connection: Connection;
|
|
254
132
|
readonly programId: PublicKey;
|
|
255
133
|
constructor(options?: AdelosOptions);
|
|
256
|
-
deriveRegistryAddress(owner: PublicKey): [PublicKey, number];
|
|
257
134
|
getRegistry(owner: PublicKey): Promise<RegistryInfo>;
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
135
|
+
/** Menghasilkan metaSk tanpa simpan di LocalStorage (Deterministic) */
|
|
136
|
+
unlockPrivacy(signMessage: (msg: Uint8Array) => Promise<Uint8Array>): Promise<Uint8Array>;
|
|
137
|
+
/** API Satu Pintu untuk kirim SOL secara privat */
|
|
138
|
+
createStealthTransfer(sender: PublicKey, receiver: PublicKey, amountSOL: number, version?: "legacy" | "v0"): Promise<Transaction | VersionedTransaction>;
|
|
139
|
+
/** Membuat transaksi pendaftaran identitas */
|
|
140
|
+
createRegisterTransaction(owner: PublicKey, metaPubkey: Uint8Array, version?: "legacy" | "v0"): Promise<Transaction | VersionedTransaction>;
|
|
263
141
|
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>;
|
|
142
|
+
/** Satu fungsi kirim untuk semua jenis transaksi (Legacy/V0) */
|
|
143
|
+
sendAndConfirm(signedTx: Transaction | VersionedTransaction): Promise<string>;
|
|
268
144
|
}
|
|
269
145
|
|
|
270
|
-
export { ADELOS_CONFIG,
|
|
146
|
+
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, derivePublicKey, 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,29 @@ 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
|
+
/** Derive Public Key from Secret Key */
|
|
81
|
+
declare function derivePublicKey(secretKey: Uint8Array): Uint8Array;
|
|
82
|
+
/** Compute Shared Secret (Sender) */
|
|
202
83
|
declare function computeSharedSecret(ephemeralSk: Uint8Array, recipientMetaPk: Uint8Array): Uint8Array;
|
|
84
|
+
/** Compute Shared Secret (Recipient) */
|
|
203
85
|
declare function computeSharedSecretAsRecipient(metaSk: Uint8Array, ephemeralPk: Uint8Array): Uint8Array;
|
|
86
|
+
/** Derive Stealth Public Key */
|
|
204
87
|
declare function deriveStealthPubkey(metaPk: Uint8Array, sharedSecret: Uint8Array): Uint8Array;
|
|
88
|
+
/** Recover Stealth Private Key */
|
|
205
89
|
declare function recoverStealthSecretKey(metaSk: Uint8Array, sharedSecret: Uint8Array): Uint8Array;
|
|
206
90
|
declare function generateStealthMemo(ephemeralPubkey: Uint8Array): string;
|
|
207
91
|
declare function parseStealthMemo(memo: string): Uint8Array | null;
|
|
92
|
+
/** Full Stealth Address Generation Flow */
|
|
208
93
|
declare function generateStealthAddress(recipientMetaPk: Uint8Array): {
|
|
209
94
|
stealthPubkey: Uint8Array<ArrayBufferLike>;
|
|
210
95
|
ephemeralKeypair: {
|
|
@@ -225,46 +110,37 @@ interface StealthTransaction {
|
|
|
225
110
|
stealthAddress: PublicKey;
|
|
226
111
|
amount: bigint;
|
|
227
112
|
}
|
|
228
|
-
interface IndexerConfig {
|
|
229
|
-
rpcUrl: string;
|
|
230
|
-
heliusApiKey?: string;
|
|
231
|
-
}
|
|
232
113
|
declare class AdelosIndexer {
|
|
233
114
|
private connection;
|
|
234
|
-
|
|
235
|
-
constructor(config: IndexerConfig);
|
|
236
|
-
static create(config: IndexerConfig): AdelosIndexer;
|
|
115
|
+
constructor(connection: Connection);
|
|
237
116
|
/** Scan for stealth transfers to this recipient */
|
|
238
117
|
scanForStealthTransfers(metaSk: Uint8Array, metaPk: Uint8Array, limit?: number): Promise<StealthTransaction[]>;
|
|
239
|
-
/** Trial Decryption:
|
|
240
|
-
|
|
118
|
+
/** * Trial Decryption: Mengecek apakah transaksi ini milik user.
|
|
119
|
+
* Dibuat 'public' agar bisa dites di file testing.
|
|
120
|
+
*/
|
|
121
|
+
attemptDecryption(tx: ParsedTransactionWithMeta, metaSk: Uint8Array, metaPk: Uint8Array): {
|
|
122
|
+
stealthAddress: PublicKey;
|
|
123
|
+
amount: bigint;
|
|
124
|
+
} | null;
|
|
241
125
|
private extractMemo;
|
|
242
126
|
}
|
|
243
|
-
|
|
127
|
+
/** Helper untuk inisialisasi cepat */
|
|
128
|
+
declare function createIndexer(connection: Connection): AdelosIndexer;
|
|
244
129
|
|
|
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
130
|
declare class AdelosSDK {
|
|
253
131
|
readonly connection: Connection;
|
|
254
132
|
readonly programId: PublicKey;
|
|
255
133
|
constructor(options?: AdelosOptions);
|
|
256
|
-
deriveRegistryAddress(owner: PublicKey): [PublicKey, number];
|
|
257
134
|
getRegistry(owner: PublicKey): Promise<RegistryInfo>;
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
135
|
+
/** Menghasilkan metaSk tanpa simpan di LocalStorage (Deterministic) */
|
|
136
|
+
unlockPrivacy(signMessage: (msg: Uint8Array) => Promise<Uint8Array>): Promise<Uint8Array>;
|
|
137
|
+
/** API Satu Pintu untuk kirim SOL secara privat */
|
|
138
|
+
createStealthTransfer(sender: PublicKey, receiver: PublicKey, amountSOL: number, version?: "legacy" | "v0"): Promise<Transaction | VersionedTransaction>;
|
|
139
|
+
/** Membuat transaksi pendaftaran identitas */
|
|
140
|
+
createRegisterTransaction(owner: PublicKey, metaPubkey: Uint8Array, version?: "legacy" | "v0"): Promise<Transaction | VersionedTransaction>;
|
|
263
141
|
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>;
|
|
142
|
+
/** Satu fungsi kirim untuk semua jenis transaksi (Legacy/V0) */
|
|
143
|
+
sendAndConfirm(signedTx: Transaction | VersionedTransaction): Promise<string>;
|
|
268
144
|
}
|
|
269
145
|
|
|
270
|
-
export { ADELOS_CONFIG,
|
|
146
|
+
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, derivePublicKey, deriveRegistryPda, deriveStealthPubkey, generateEphemeralKeypair, generateStealthAddress, generateStealthMemo, getDiscriminator, hexToBytes, isValidMetaPubkey, parseStealthMemo, recoverStealthSecretKey };
|