@rougechain/sdk 1.3.0 → 1.3.1
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.cts +1131 -0
- package/dist/index.d.ts +1131 -0
- package/package.json +1 -1
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,1131 @@
|
|
|
1
|
+
interface WalletKeys {
|
|
2
|
+
publicKey: string;
|
|
3
|
+
privateKey: string;
|
|
4
|
+
mnemonic?: string;
|
|
5
|
+
}
|
|
6
|
+
interface ApiResponse<T = unknown> {
|
|
7
|
+
success: boolean;
|
|
8
|
+
error?: string;
|
|
9
|
+
data?: T;
|
|
10
|
+
}
|
|
11
|
+
type TransactionType = "transfer" | "create_token" | "swap" | "create_pool" | "add_liquidity" | "remove_liquidity" | "stake" | "unstake" | "faucet" | "nft_create_collection" | "nft_mint" | "nft_batch_mint" | "nft_transfer" | "nft_burn" | "nft_lock" | "nft_freeze_collection" | "bridge_withdraw" | "update_token_metadata" | "claim_token_metadata" | "approve" | "transfer_from" | "shield" | "shielded_transfer" | "unshield" | "contract_deploy" | "contract_call";
|
|
12
|
+
interface TransactionPayload {
|
|
13
|
+
type: TransactionType;
|
|
14
|
+
from: string;
|
|
15
|
+
to?: string;
|
|
16
|
+
amount?: number;
|
|
17
|
+
fee?: number;
|
|
18
|
+
token?: string;
|
|
19
|
+
tokenSymbol?: string;
|
|
20
|
+
evmAddress?: string;
|
|
21
|
+
timestamp: number;
|
|
22
|
+
nonce: string;
|
|
23
|
+
token_name?: string;
|
|
24
|
+
token_symbol?: string;
|
|
25
|
+
initial_supply?: number;
|
|
26
|
+
token_in?: string;
|
|
27
|
+
token_out?: string;
|
|
28
|
+
amount_in?: number;
|
|
29
|
+
min_amount_out?: number;
|
|
30
|
+
pool_id?: string;
|
|
31
|
+
token_a?: string;
|
|
32
|
+
token_b?: string;
|
|
33
|
+
amount_a?: number;
|
|
34
|
+
amount_b?: number;
|
|
35
|
+
lp_amount?: number;
|
|
36
|
+
symbol?: string;
|
|
37
|
+
name?: string;
|
|
38
|
+
collectionId?: string;
|
|
39
|
+
description?: string;
|
|
40
|
+
image?: string;
|
|
41
|
+
maxSupply?: number;
|
|
42
|
+
royaltyBps?: number;
|
|
43
|
+
tokenId?: number;
|
|
44
|
+
metadataUri?: string;
|
|
45
|
+
attributes?: unknown;
|
|
46
|
+
locked?: boolean;
|
|
47
|
+
frozen?: boolean;
|
|
48
|
+
salePrice?: number;
|
|
49
|
+
names?: string[];
|
|
50
|
+
uris?: string[];
|
|
51
|
+
batchAttributes?: unknown[];
|
|
52
|
+
website?: string;
|
|
53
|
+
twitter?: string;
|
|
54
|
+
discord?: string;
|
|
55
|
+
publicMint?: boolean;
|
|
56
|
+
mintPrice?: number;
|
|
57
|
+
tokenGateSymbol?: string;
|
|
58
|
+
tokenGateAmount?: number;
|
|
59
|
+
discountPct?: number;
|
|
60
|
+
spender?: string;
|
|
61
|
+
owner?: string;
|
|
62
|
+
}
|
|
63
|
+
interface SignedTransaction {
|
|
64
|
+
payload: TransactionPayload;
|
|
65
|
+
signature: string;
|
|
66
|
+
public_key: string;
|
|
67
|
+
}
|
|
68
|
+
interface BlockHeader {
|
|
69
|
+
version: number;
|
|
70
|
+
chain_id: string;
|
|
71
|
+
height: number;
|
|
72
|
+
time: number;
|
|
73
|
+
prev_hash: string;
|
|
74
|
+
tx_hash: string;
|
|
75
|
+
proposer_pub_key: string;
|
|
76
|
+
}
|
|
77
|
+
interface Transaction {
|
|
78
|
+
version: number;
|
|
79
|
+
tx_type: string;
|
|
80
|
+
from_pub_key: string;
|
|
81
|
+
target_pub_key?: string | null;
|
|
82
|
+
amount: number;
|
|
83
|
+
fee: number;
|
|
84
|
+
sig: string;
|
|
85
|
+
token_name?: string | null;
|
|
86
|
+
token_symbol?: string | null;
|
|
87
|
+
token_decimals?: number | null;
|
|
88
|
+
token_total_supply?: number | null;
|
|
89
|
+
pool_id?: string | null;
|
|
90
|
+
token_a_symbol?: string | null;
|
|
91
|
+
token_b_symbol?: string | null;
|
|
92
|
+
amount_a?: number | null;
|
|
93
|
+
amount_b?: number | null;
|
|
94
|
+
min_amount_out?: number | null;
|
|
95
|
+
swap_path?: string[] | null;
|
|
96
|
+
lp_amount?: number | null;
|
|
97
|
+
faucet?: boolean;
|
|
98
|
+
signed_payload?: string | null;
|
|
99
|
+
}
|
|
100
|
+
interface Block {
|
|
101
|
+
version: number;
|
|
102
|
+
header: BlockHeader;
|
|
103
|
+
txs: Transaction[];
|
|
104
|
+
proposer_sig: string;
|
|
105
|
+
hash: string;
|
|
106
|
+
}
|
|
107
|
+
interface NodeStats {
|
|
108
|
+
height: number;
|
|
109
|
+
peers: number;
|
|
110
|
+
network_height: number;
|
|
111
|
+
mining: boolean;
|
|
112
|
+
total_fees: number;
|
|
113
|
+
last_block_fees: number;
|
|
114
|
+
finalized_height: number;
|
|
115
|
+
ws_clients: number;
|
|
116
|
+
/** Current EIP-1559 base fee (XRGE) */
|
|
117
|
+
base_fee: number;
|
|
118
|
+
/** Total fees burned via EIP-1559 mechanism */
|
|
119
|
+
total_fees_burned: number;
|
|
120
|
+
}
|
|
121
|
+
interface TokenMetadata {
|
|
122
|
+
symbol: string;
|
|
123
|
+
name: string;
|
|
124
|
+
creator: string;
|
|
125
|
+
image?: string;
|
|
126
|
+
description?: string;
|
|
127
|
+
website?: string;
|
|
128
|
+
twitter?: string;
|
|
129
|
+
discord?: string;
|
|
130
|
+
created_at: number;
|
|
131
|
+
updated_at: number;
|
|
132
|
+
}
|
|
133
|
+
interface TokenHolder {
|
|
134
|
+
address: string;
|
|
135
|
+
balance: number;
|
|
136
|
+
}
|
|
137
|
+
interface BalanceResponse {
|
|
138
|
+
balance: number;
|
|
139
|
+
token_balances: Record<string, number>;
|
|
140
|
+
lp_balances: Record<string, number>;
|
|
141
|
+
}
|
|
142
|
+
interface LiquidityPool {
|
|
143
|
+
pool_id: string;
|
|
144
|
+
token_a_symbol: string;
|
|
145
|
+
token_b_symbol: string;
|
|
146
|
+
reserve_a: number;
|
|
147
|
+
reserve_b: number;
|
|
148
|
+
total_lp: number;
|
|
149
|
+
fee_rate: number;
|
|
150
|
+
created_at: number;
|
|
151
|
+
}
|
|
152
|
+
interface SwapQuote {
|
|
153
|
+
amount_out: number;
|
|
154
|
+
price_impact: number;
|
|
155
|
+
path: string[];
|
|
156
|
+
}
|
|
157
|
+
interface PoolEvent {
|
|
158
|
+
event_type: string;
|
|
159
|
+
pool_id: string;
|
|
160
|
+
actor: string;
|
|
161
|
+
token_a_amount?: number;
|
|
162
|
+
token_b_amount?: number;
|
|
163
|
+
lp_amount?: number;
|
|
164
|
+
timestamp: number;
|
|
165
|
+
}
|
|
166
|
+
interface PoolStats {
|
|
167
|
+
pool_id: string;
|
|
168
|
+
volume_24h: number;
|
|
169
|
+
trades_24h: number;
|
|
170
|
+
tvl: number;
|
|
171
|
+
}
|
|
172
|
+
interface PriceSnapshot {
|
|
173
|
+
pool_id: string;
|
|
174
|
+
timestamp: number;
|
|
175
|
+
block_height: number;
|
|
176
|
+
reserve_a: number;
|
|
177
|
+
reserve_b: number;
|
|
178
|
+
price_a_in_b: number;
|
|
179
|
+
price_b_in_a: number;
|
|
180
|
+
}
|
|
181
|
+
interface NftCollection {
|
|
182
|
+
collection_id: string;
|
|
183
|
+
symbol: string;
|
|
184
|
+
name: string;
|
|
185
|
+
creator: string;
|
|
186
|
+
description?: string;
|
|
187
|
+
image?: string;
|
|
188
|
+
max_supply?: number;
|
|
189
|
+
minted: number;
|
|
190
|
+
royalty_bps: number;
|
|
191
|
+
royalty_recipient: string;
|
|
192
|
+
frozen: boolean;
|
|
193
|
+
created_at: number;
|
|
194
|
+
public_mint?: boolean;
|
|
195
|
+
mint_price?: number;
|
|
196
|
+
token_gate_symbol?: string;
|
|
197
|
+
token_gate_amount?: number;
|
|
198
|
+
discount_pct?: number;
|
|
199
|
+
}
|
|
200
|
+
interface NftToken {
|
|
201
|
+
collection_id: string;
|
|
202
|
+
token_id: number;
|
|
203
|
+
owner: string;
|
|
204
|
+
creator: string;
|
|
205
|
+
name: string;
|
|
206
|
+
metadata_uri?: string;
|
|
207
|
+
attributes?: unknown;
|
|
208
|
+
locked: boolean;
|
|
209
|
+
minted_at: number;
|
|
210
|
+
transferred_at: number;
|
|
211
|
+
}
|
|
212
|
+
interface Validator {
|
|
213
|
+
public_key: string;
|
|
214
|
+
stake: number;
|
|
215
|
+
status: string;
|
|
216
|
+
jailed_until: number;
|
|
217
|
+
uptime: number;
|
|
218
|
+
}
|
|
219
|
+
interface BridgeConfig {
|
|
220
|
+
enabled: boolean;
|
|
221
|
+
custodyAddress?: string;
|
|
222
|
+
chainId: number;
|
|
223
|
+
supportedTokens?: string[];
|
|
224
|
+
}
|
|
225
|
+
interface BridgeWithdrawal {
|
|
226
|
+
tx_id: string;
|
|
227
|
+
from_pub_key: string;
|
|
228
|
+
evm_address: string;
|
|
229
|
+
amount_units: number;
|
|
230
|
+
status: string;
|
|
231
|
+
created_at: number;
|
|
232
|
+
}
|
|
233
|
+
interface XrgeBridgeConfig {
|
|
234
|
+
enabled: boolean;
|
|
235
|
+
vaultAddress?: string;
|
|
236
|
+
tokenAddress?: string;
|
|
237
|
+
chainId: number;
|
|
238
|
+
}
|
|
239
|
+
interface NameEntry {
|
|
240
|
+
name: string;
|
|
241
|
+
wallet_id: string;
|
|
242
|
+
registered_at: string;
|
|
243
|
+
}
|
|
244
|
+
interface ResolvedName {
|
|
245
|
+
entry?: NameEntry;
|
|
246
|
+
wallet?: {
|
|
247
|
+
id: string;
|
|
248
|
+
display_name: string;
|
|
249
|
+
signing_public_key: string;
|
|
250
|
+
encryption_public_key: string;
|
|
251
|
+
};
|
|
252
|
+
}
|
|
253
|
+
interface MailMessage {
|
|
254
|
+
id: string;
|
|
255
|
+
from: string;
|
|
256
|
+
to: string;
|
|
257
|
+
subject: string;
|
|
258
|
+
body: string;
|
|
259
|
+
encrypted_subject?: string;
|
|
260
|
+
encrypted_body?: string;
|
|
261
|
+
attachment_encrypted?: string;
|
|
262
|
+
attachmentEncrypted?: string;
|
|
263
|
+
has_attachment?: boolean;
|
|
264
|
+
hasAttachment?: boolean;
|
|
265
|
+
reply_to_id?: string;
|
|
266
|
+
replyToId?: string;
|
|
267
|
+
signature?: string;
|
|
268
|
+
contentSignature?: string;
|
|
269
|
+
read: boolean;
|
|
270
|
+
folder: "inbox" | "sent" | "trash";
|
|
271
|
+
created_at: number;
|
|
272
|
+
createdAt?: string;
|
|
273
|
+
fromWalletId?: string;
|
|
274
|
+
from_wallet_id?: string;
|
|
275
|
+
toWalletIds?: string[];
|
|
276
|
+
to_wallet_ids?: string[];
|
|
277
|
+
subjectEncrypted?: string;
|
|
278
|
+
subject_encrypted?: string;
|
|
279
|
+
bodyEncrypted?: string;
|
|
280
|
+
body_encrypted?: string;
|
|
281
|
+
}
|
|
282
|
+
interface SendMailParams {
|
|
283
|
+
from: string;
|
|
284
|
+
to: string;
|
|
285
|
+
subject?: string;
|
|
286
|
+
body?: string;
|
|
287
|
+
encrypted_subject: string;
|
|
288
|
+
encrypted_body: string;
|
|
289
|
+
encrypted_attachment?: string;
|
|
290
|
+
content_signature?: string;
|
|
291
|
+
reply_to_id?: string;
|
|
292
|
+
}
|
|
293
|
+
interface MessengerWallet {
|
|
294
|
+
id: string;
|
|
295
|
+
displayName: string;
|
|
296
|
+
signingPublicKey: string;
|
|
297
|
+
encryptionPublicKey: string;
|
|
298
|
+
created_at: number;
|
|
299
|
+
}
|
|
300
|
+
interface MessengerConversation {
|
|
301
|
+
id: string;
|
|
302
|
+
participants: string[];
|
|
303
|
+
created_at: number;
|
|
304
|
+
last_message_at?: string;
|
|
305
|
+
last_sender_id?: string;
|
|
306
|
+
last_message_preview?: string;
|
|
307
|
+
unread_count?: number;
|
|
308
|
+
}
|
|
309
|
+
interface MessengerMessage {
|
|
310
|
+
id: string;
|
|
311
|
+
conversation_id: string;
|
|
312
|
+
sender_wallet_id: string;
|
|
313
|
+
/** @deprecated Use sender_wallet_id */
|
|
314
|
+
sender?: string;
|
|
315
|
+
encrypted_content: string;
|
|
316
|
+
signature: string;
|
|
317
|
+
self_destruct: boolean;
|
|
318
|
+
destruct_after_seconds?: number;
|
|
319
|
+
created_at: number | string;
|
|
320
|
+
is_read: boolean;
|
|
321
|
+
read_at?: string;
|
|
322
|
+
message_type: string;
|
|
323
|
+
spoiler: boolean;
|
|
324
|
+
/** Legacy — some old messages may have these */
|
|
325
|
+
media_type?: string;
|
|
326
|
+
media_data?: string;
|
|
327
|
+
}
|
|
328
|
+
interface TransferParams {
|
|
329
|
+
to: string;
|
|
330
|
+
amount: number;
|
|
331
|
+
fee?: number;
|
|
332
|
+
token?: string;
|
|
333
|
+
}
|
|
334
|
+
interface CreateTokenParams {
|
|
335
|
+
name: string;
|
|
336
|
+
symbol: string;
|
|
337
|
+
totalSupply: number;
|
|
338
|
+
fee?: number;
|
|
339
|
+
/** Token logo — URL or data URI (base64). Stored on-chain in token metadata. */
|
|
340
|
+
image?: string;
|
|
341
|
+
/** Whether this token supports ongoing minting by the creator */
|
|
342
|
+
mintable?: boolean;
|
|
343
|
+
/** Maximum supply cap (only applies if mintable is true) */
|
|
344
|
+
maxSupply?: number;
|
|
345
|
+
}
|
|
346
|
+
interface MintTokenParams {
|
|
347
|
+
symbol: string;
|
|
348
|
+
amount: number;
|
|
349
|
+
fee?: number;
|
|
350
|
+
}
|
|
351
|
+
interface FeeInfo {
|
|
352
|
+
success: boolean;
|
|
353
|
+
base_fee: number;
|
|
354
|
+
priority_fee_suggestion: number;
|
|
355
|
+
total_fee_suggestion: number;
|
|
356
|
+
total_fees_burned: number;
|
|
357
|
+
target_txs_per_block: number;
|
|
358
|
+
fee_floor: number;
|
|
359
|
+
}
|
|
360
|
+
interface VoteMessage {
|
|
361
|
+
vote_type: string;
|
|
362
|
+
height: number;
|
|
363
|
+
round: number;
|
|
364
|
+
block_hash: string;
|
|
365
|
+
voter_pub_key: string;
|
|
366
|
+
signature: string;
|
|
367
|
+
}
|
|
368
|
+
interface FinalityProof {
|
|
369
|
+
height: number;
|
|
370
|
+
block_hash: string;
|
|
371
|
+
total_stake: number;
|
|
372
|
+
voting_stake: number;
|
|
373
|
+
quorum_threshold: number;
|
|
374
|
+
precommit_votes: VoteMessage[];
|
|
375
|
+
created_at: number;
|
|
376
|
+
}
|
|
377
|
+
interface WsSubscribeMessage {
|
|
378
|
+
subscribe?: string[];
|
|
379
|
+
unsubscribe?: string[];
|
|
380
|
+
}
|
|
381
|
+
interface SwapParams {
|
|
382
|
+
tokenIn: string;
|
|
383
|
+
tokenOut: string;
|
|
384
|
+
amountIn: number;
|
|
385
|
+
minAmountOut: number;
|
|
386
|
+
}
|
|
387
|
+
interface CreatePoolParams {
|
|
388
|
+
tokenA: string;
|
|
389
|
+
tokenB: string;
|
|
390
|
+
amountA: number;
|
|
391
|
+
amountB: number;
|
|
392
|
+
}
|
|
393
|
+
interface AddLiquidityParams {
|
|
394
|
+
poolId: string;
|
|
395
|
+
amountA: number;
|
|
396
|
+
amountB: number;
|
|
397
|
+
}
|
|
398
|
+
interface RemoveLiquidityParams {
|
|
399
|
+
poolId: string;
|
|
400
|
+
lpAmount: number;
|
|
401
|
+
}
|
|
402
|
+
interface StakeParams {
|
|
403
|
+
amount: number;
|
|
404
|
+
fee?: number;
|
|
405
|
+
}
|
|
406
|
+
interface CreateNftCollectionParams {
|
|
407
|
+
symbol: string;
|
|
408
|
+
name: string;
|
|
409
|
+
maxSupply?: number;
|
|
410
|
+
royaltyBps?: number;
|
|
411
|
+
image?: string;
|
|
412
|
+
description?: string;
|
|
413
|
+
publicMint?: boolean;
|
|
414
|
+
mintPrice?: number;
|
|
415
|
+
tokenGateSymbol?: string;
|
|
416
|
+
tokenGateAmount?: number;
|
|
417
|
+
discountPct?: number;
|
|
418
|
+
}
|
|
419
|
+
interface MintNftParams {
|
|
420
|
+
collectionId: string;
|
|
421
|
+
name: string;
|
|
422
|
+
metadataUri?: string;
|
|
423
|
+
attributes?: unknown;
|
|
424
|
+
}
|
|
425
|
+
interface BatchMintNftParams {
|
|
426
|
+
collectionId: string;
|
|
427
|
+
names: string[];
|
|
428
|
+
uris?: string[];
|
|
429
|
+
batchAttributes?: unknown[];
|
|
430
|
+
}
|
|
431
|
+
interface TransferNftParams {
|
|
432
|
+
collectionId: string;
|
|
433
|
+
tokenId: number;
|
|
434
|
+
to: string;
|
|
435
|
+
salePrice?: number;
|
|
436
|
+
}
|
|
437
|
+
interface BurnNftParams {
|
|
438
|
+
collectionId: string;
|
|
439
|
+
tokenId: number;
|
|
440
|
+
}
|
|
441
|
+
interface LockNftParams {
|
|
442
|
+
collectionId: string;
|
|
443
|
+
tokenId: number;
|
|
444
|
+
locked: boolean;
|
|
445
|
+
}
|
|
446
|
+
interface FreezeCollectionParams {
|
|
447
|
+
collectionId: string;
|
|
448
|
+
frozen: boolean;
|
|
449
|
+
}
|
|
450
|
+
interface BridgeWithdrawParams {
|
|
451
|
+
amount: number;
|
|
452
|
+
evmAddress: string;
|
|
453
|
+
fee?: number;
|
|
454
|
+
tokenSymbol?: string;
|
|
455
|
+
}
|
|
456
|
+
interface BridgeClaimParams {
|
|
457
|
+
evmTxHash: string;
|
|
458
|
+
evmAddress: string;
|
|
459
|
+
evmSignature: string;
|
|
460
|
+
recipientPubkey: string;
|
|
461
|
+
token?: "ETH" | "USDC";
|
|
462
|
+
}
|
|
463
|
+
interface XrgeBridgeClaimParams {
|
|
464
|
+
evmTxHash: string;
|
|
465
|
+
evmAddress: string;
|
|
466
|
+
amount: string;
|
|
467
|
+
recipientPubkey: string;
|
|
468
|
+
}
|
|
469
|
+
interface XrgeBridgeWithdrawParams {
|
|
470
|
+
amount: number;
|
|
471
|
+
evmAddress: string;
|
|
472
|
+
}
|
|
473
|
+
interface SwapQuoteParams {
|
|
474
|
+
poolId: string;
|
|
475
|
+
tokenIn: string;
|
|
476
|
+
tokenOut: string;
|
|
477
|
+
amountIn: number;
|
|
478
|
+
}
|
|
479
|
+
interface TokenMetadataUpdateParams {
|
|
480
|
+
symbol: string;
|
|
481
|
+
image?: string;
|
|
482
|
+
description?: string;
|
|
483
|
+
website?: string;
|
|
484
|
+
twitter?: string;
|
|
485
|
+
discord?: string;
|
|
486
|
+
}
|
|
487
|
+
interface ApproveParams {
|
|
488
|
+
spender: string;
|
|
489
|
+
tokenSymbol: string;
|
|
490
|
+
amount: number;
|
|
491
|
+
}
|
|
492
|
+
interface TransferFromParams {
|
|
493
|
+
owner: string;
|
|
494
|
+
to: string;
|
|
495
|
+
tokenSymbol: string;
|
|
496
|
+
amount: number;
|
|
497
|
+
}
|
|
498
|
+
interface ShieldParams {
|
|
499
|
+
/** Amount to shield (integer XRGE) */
|
|
500
|
+
amount: number;
|
|
501
|
+
}
|
|
502
|
+
interface ShieldedTransferParams {
|
|
503
|
+
/** Nullifiers of consumed input notes (hex) */
|
|
504
|
+
nullifiers: string[];
|
|
505
|
+
/** Commitments for output notes (hex) */
|
|
506
|
+
outputCommitments: string[];
|
|
507
|
+
/** STARK proof bytes (hex) */
|
|
508
|
+
proof: string;
|
|
509
|
+
/** Fee paid from the shielded pool */
|
|
510
|
+
shieldedFee?: number;
|
|
511
|
+
}
|
|
512
|
+
interface UnshieldParams {
|
|
513
|
+
/** Nullifiers of consumed notes (hex) */
|
|
514
|
+
nullifiers: string[];
|
|
515
|
+
/** Amount to unshield (integer XRGE) */
|
|
516
|
+
amount: number;
|
|
517
|
+
/** STARK proof bytes (hex) */
|
|
518
|
+
proof: string;
|
|
519
|
+
}
|
|
520
|
+
interface ShieldedStats {
|
|
521
|
+
success: boolean;
|
|
522
|
+
commitment_count: number;
|
|
523
|
+
nullifier_count: number;
|
|
524
|
+
active_notes: number;
|
|
525
|
+
}
|
|
526
|
+
interface RollupStatus {
|
|
527
|
+
pending_transfers: number;
|
|
528
|
+
completed_batches: number;
|
|
529
|
+
next_batch_id: number;
|
|
530
|
+
max_batch_size: number;
|
|
531
|
+
batch_timeout_secs: number;
|
|
532
|
+
current_state_root: string;
|
|
533
|
+
accounts_tracked: number;
|
|
534
|
+
}
|
|
535
|
+
interface RollupBatchResult {
|
|
536
|
+
batch_id: number;
|
|
537
|
+
transfer_count: number;
|
|
538
|
+
total_fees: number;
|
|
539
|
+
pre_state_root: string;
|
|
540
|
+
post_state_root: string;
|
|
541
|
+
proof_size_bytes: number;
|
|
542
|
+
proof_time_ms: number;
|
|
543
|
+
verified: boolean;
|
|
544
|
+
}
|
|
545
|
+
interface RollupSubmitParams {
|
|
546
|
+
sender: string;
|
|
547
|
+
receiver: string;
|
|
548
|
+
amount: number;
|
|
549
|
+
fee?: number;
|
|
550
|
+
}
|
|
551
|
+
interface RollupSubmitResult {
|
|
552
|
+
success: boolean;
|
|
553
|
+
queued: boolean;
|
|
554
|
+
batch_completed: boolean;
|
|
555
|
+
batch?: RollupBatchResult;
|
|
556
|
+
pending_transfers?: number;
|
|
557
|
+
max_batch_size?: number;
|
|
558
|
+
}
|
|
559
|
+
interface ContractMetadata {
|
|
560
|
+
address: string;
|
|
561
|
+
deployer: string;
|
|
562
|
+
codeHash: string;
|
|
563
|
+
createdAt: number;
|
|
564
|
+
wasmSize: number;
|
|
565
|
+
}
|
|
566
|
+
interface ContractEvent {
|
|
567
|
+
contractAddr: string;
|
|
568
|
+
topic: string;
|
|
569
|
+
data: string;
|
|
570
|
+
blockHeight: number;
|
|
571
|
+
txHash: string;
|
|
572
|
+
}
|
|
573
|
+
interface ContractCallResult {
|
|
574
|
+
success: boolean;
|
|
575
|
+
returnData?: unknown;
|
|
576
|
+
gasUsed: number;
|
|
577
|
+
events: ContractEvent[];
|
|
578
|
+
error?: string;
|
|
579
|
+
}
|
|
580
|
+
interface DeployContractParams {
|
|
581
|
+
/** Base64-encoded WASM bytecode */
|
|
582
|
+
wasm: string;
|
|
583
|
+
/** Deployer's public key */
|
|
584
|
+
deployer: string;
|
|
585
|
+
/** Nonce for deterministic address */
|
|
586
|
+
nonce?: number;
|
|
587
|
+
}
|
|
588
|
+
interface CallContractParams {
|
|
589
|
+
/** Contract address (hex) */
|
|
590
|
+
contractAddr: string;
|
|
591
|
+
/** Method name to call */
|
|
592
|
+
method: string;
|
|
593
|
+
/** Caller's public key */
|
|
594
|
+
caller?: string;
|
|
595
|
+
/** JSON arguments */
|
|
596
|
+
args?: unknown;
|
|
597
|
+
/** Gas limit (default 10M) */
|
|
598
|
+
gasLimit?: number;
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
/**
|
|
602
|
+
* Client-side shielded transaction crypto primitives.
|
|
603
|
+
*
|
|
604
|
+
* Mirrors the Rust commitment.rs exactly:
|
|
605
|
+
* commitment = SHA-256("ROUGECHAIN_COMMITMENT_V1" || value || pubkey || randomness)
|
|
606
|
+
* nullifier = SHA-256("ROUGECHAIN_NULLIFIER_V1" || randomness || commitment)
|
|
607
|
+
*/
|
|
608
|
+
/** Generate 32 bytes of cryptographically secure randomness (hex-encoded). */
|
|
609
|
+
declare function generateRandomness(): string;
|
|
610
|
+
/**
|
|
611
|
+
* Compute a shielded note commitment.
|
|
612
|
+
*
|
|
613
|
+
* @param value - Note value in XRGE (integer)
|
|
614
|
+
* @param ownerPubKey - Owner's ML-DSA-65 public key (hex)
|
|
615
|
+
* @param randomness - 32-byte blinding factor (hex)
|
|
616
|
+
* @returns 32-byte commitment hash (hex)
|
|
617
|
+
*/
|
|
618
|
+
declare function computeCommitment(value: number, ownerPubKey: string, randomness: string): string;
|
|
619
|
+
/**
|
|
620
|
+
* Compute a nullifier for a shielded note.
|
|
621
|
+
*
|
|
622
|
+
* @param randomness - The note's blinding factor (hex)
|
|
623
|
+
* @param commitment - The note's commitment hash (hex)
|
|
624
|
+
* @returns 32-byte nullifier hash (hex)
|
|
625
|
+
*/
|
|
626
|
+
declare function computeNullifier(randomness: string, commitment: string): string;
|
|
627
|
+
/** A shielded note — kept locally by the owner (never sent to chain). */
|
|
628
|
+
interface ShieldedNote {
|
|
629
|
+
commitment: string;
|
|
630
|
+
nullifier: string;
|
|
631
|
+
value: number;
|
|
632
|
+
randomness: string;
|
|
633
|
+
ownerPubKey: string;
|
|
634
|
+
}
|
|
635
|
+
/**
|
|
636
|
+
* Create a new shielded note for a given value.
|
|
637
|
+
*
|
|
638
|
+
* @param value - XRGE amount (integer)
|
|
639
|
+
* @param ownerPubKey - Owner's public key (hex)
|
|
640
|
+
* @returns A ShieldedNote with all derived fields
|
|
641
|
+
*/
|
|
642
|
+
declare function createShieldedNote(value: number, ownerPubKey: string): ShieldedNote;
|
|
643
|
+
|
|
644
|
+
type FetchFn = typeof globalThis.fetch;
|
|
645
|
+
interface RougeChainOptions {
|
|
646
|
+
/** Custom fetch implementation (defaults to globalThis.fetch) */
|
|
647
|
+
fetch?: FetchFn;
|
|
648
|
+
/** Optional API key for authenticated endpoints */
|
|
649
|
+
apiKey?: string;
|
|
650
|
+
}
|
|
651
|
+
declare class RougeChain {
|
|
652
|
+
/** @internal */ readonly baseUrl: string;
|
|
653
|
+
/** @internal */ readonly fetchFn: FetchFn;
|
|
654
|
+
/** @internal */ readonly headers: Record<string, string>;
|
|
655
|
+
readonly nft: NftClient;
|
|
656
|
+
readonly dex: DexClient;
|
|
657
|
+
readonly bridge: BridgeClient;
|
|
658
|
+
readonly mail: MailClient;
|
|
659
|
+
readonly messenger: MessengerClient;
|
|
660
|
+
readonly shielded: ShieldedClient;
|
|
661
|
+
readonly social: SocialClient;
|
|
662
|
+
constructor(baseUrl: string, options?: RougeChainOptions);
|
|
663
|
+
/** @internal */
|
|
664
|
+
get<T = unknown>(path: string): Promise<T>;
|
|
665
|
+
/** @internal */
|
|
666
|
+
post<T = unknown>(path: string, body: unknown): Promise<T>;
|
|
667
|
+
/** @internal */
|
|
668
|
+
submitTx(endpoint: string, signedTx: SignedTransaction): Promise<ApiResponse>;
|
|
669
|
+
getStats(): Promise<NodeStats>;
|
|
670
|
+
getHealth(): Promise<{
|
|
671
|
+
status: string;
|
|
672
|
+
chain_id: string;
|
|
673
|
+
height: number;
|
|
674
|
+
}>;
|
|
675
|
+
getBlocks(opts?: {
|
|
676
|
+
limit?: number;
|
|
677
|
+
}): Promise<Block[]>;
|
|
678
|
+
getBlocksSummary(range?: "1h" | "24h" | "7d"): Promise<unknown>;
|
|
679
|
+
getBalance(publicKey: string): Promise<BalanceResponse>;
|
|
680
|
+
getTokenBalance(publicKey: string, token: string): Promise<number>;
|
|
681
|
+
getTransactions(opts?: {
|
|
682
|
+
limit?: number;
|
|
683
|
+
offset?: number;
|
|
684
|
+
}): Promise<unknown>;
|
|
685
|
+
getTokens(): Promise<TokenMetadata[]>;
|
|
686
|
+
getTokenMetadata(symbol: string): Promise<TokenMetadata>;
|
|
687
|
+
getTokenHolders(symbol: string): Promise<TokenHolder[]>;
|
|
688
|
+
getTokenTransactions(symbol: string): Promise<unknown>;
|
|
689
|
+
getValidators(): Promise<Validator[]>;
|
|
690
|
+
getValidatorStats(): Promise<unknown>;
|
|
691
|
+
getFinality(): Promise<{
|
|
692
|
+
finalized_height: number;
|
|
693
|
+
tip_height: number;
|
|
694
|
+
total_stake: number;
|
|
695
|
+
finalized_stake: number;
|
|
696
|
+
}>;
|
|
697
|
+
/** Get current EIP-1559 fee information including base fee and suggestions. */
|
|
698
|
+
getFeeInfo(): Promise<FeeInfo>;
|
|
699
|
+
/**
|
|
700
|
+
* Get a BFT finality proof for a specific block height.
|
|
701
|
+
* Returns the aggregated precommit votes that prove ≥2/3 validator stake agreed.
|
|
702
|
+
*/
|
|
703
|
+
getFinalityProof(height: number): Promise<{
|
|
704
|
+
success: boolean;
|
|
705
|
+
proof?: FinalityProof;
|
|
706
|
+
error?: string;
|
|
707
|
+
}>;
|
|
708
|
+
getPeers(): Promise<string[]>;
|
|
709
|
+
getBurnedTokens(): Promise<{
|
|
710
|
+
burned: Record<string, number>;
|
|
711
|
+
total_xrge_burned: number;
|
|
712
|
+
}>;
|
|
713
|
+
/**
|
|
714
|
+
* Resolve a rouge1… address to its public key, or a public key to its rouge1 address.
|
|
715
|
+
* Uses the persistent on-chain address index for O(1) lookups.
|
|
716
|
+
*/
|
|
717
|
+
resolveAddress(input: string): Promise<{
|
|
718
|
+
success: boolean;
|
|
719
|
+
address?: string;
|
|
720
|
+
publicKey?: string;
|
|
721
|
+
balance?: number;
|
|
722
|
+
error?: string;
|
|
723
|
+
}>;
|
|
724
|
+
/** Get the current sequential nonce for an account. */
|
|
725
|
+
getNonce(publicKey: string): Promise<{
|
|
726
|
+
nonce: number;
|
|
727
|
+
next_nonce: number;
|
|
728
|
+
}>;
|
|
729
|
+
/** Register an Expo push token — signed by wallet to prove ownership. */
|
|
730
|
+
registerPushToken(wallet: WalletKeys, pushToken: string, platform?: string): Promise<ApiResponse>;
|
|
731
|
+
/** Unregister push notifications — signed by wallet to prove ownership. */
|
|
732
|
+
unregisterPushToken(wallet: WalletKeys): Promise<ApiResponse>;
|
|
733
|
+
transfer(wallet: WalletKeys, params: TransferParams): Promise<ApiResponse>;
|
|
734
|
+
createToken(wallet: WalletKeys, params: CreateTokenParams): Promise<ApiResponse>;
|
|
735
|
+
stake(wallet: WalletKeys, params: StakeParams): Promise<ApiResponse>;
|
|
736
|
+
unstake(wallet: WalletKeys, params: StakeParams): Promise<ApiResponse>;
|
|
737
|
+
faucet(wallet: WalletKeys): Promise<ApiResponse>;
|
|
738
|
+
burn(wallet: WalletKeys, amount: number, fee?: number, token?: string): Promise<ApiResponse>;
|
|
739
|
+
updateTokenMetadata(wallet: WalletKeys, params: TokenMetadataUpdateParams): Promise<ApiResponse>;
|
|
740
|
+
claimTokenMetadata(wallet: WalletKeys, tokenSymbol: string): Promise<ApiResponse>;
|
|
741
|
+
/**
|
|
742
|
+
* Mint additional tokens for a mintable token (creator only).
|
|
743
|
+
* The token must have been created with `mintable: true`.
|
|
744
|
+
*/
|
|
745
|
+
mintTokens(wallet: WalletKeys, params: MintTokenParams): Promise<ApiResponse>;
|
|
746
|
+
/**
|
|
747
|
+
* Connect to the node's WebSocket and optionally subscribe to specific topics.
|
|
748
|
+
* Topics: "blocks", "transactions", "stats", "account:<pubkey>", "token:<symbol>"
|
|
749
|
+
*
|
|
750
|
+
* @example
|
|
751
|
+
* const ws = client.connectWebSocket(["blocks", "account:abc123"]);
|
|
752
|
+
* ws.onmessage = (e) => console.log(JSON.parse(e.data));
|
|
753
|
+
*/
|
|
754
|
+
connectWebSocket(topics?: string[]): WebSocket;
|
|
755
|
+
/** Get the current rollup accumulator status. */
|
|
756
|
+
getRollupStatus(): Promise<RollupStatus>;
|
|
757
|
+
/** Submit a transfer into the rollup batch accumulator. */
|
|
758
|
+
submitRollupTransfer(params: RollupSubmitParams): Promise<RollupSubmitResult>;
|
|
759
|
+
/** Get the result of a completed rollup batch by ID. */
|
|
760
|
+
getRollupBatch(batchId: number): Promise<RollupBatchResult>;
|
|
761
|
+
}
|
|
762
|
+
declare class NftClient {
|
|
763
|
+
private readonly rc;
|
|
764
|
+
constructor(rc: RougeChain);
|
|
765
|
+
getCollections(): Promise<NftCollection[]>;
|
|
766
|
+
getCollection(collectionId: string): Promise<NftCollection>;
|
|
767
|
+
/**
|
|
768
|
+
* Poll until a collection exists on-chain (i.e. the create tx has been mined).
|
|
769
|
+
* Useful after `createCollection` since the tx goes to the mempool first.
|
|
770
|
+
* @returns the collection once found, or throws after the timeout.
|
|
771
|
+
*/
|
|
772
|
+
waitForCollection(collectionId: string, opts?: {
|
|
773
|
+
timeoutMs?: number;
|
|
774
|
+
pollMs?: number;
|
|
775
|
+
}): Promise<NftCollection>;
|
|
776
|
+
getTokens(collectionId: string, opts?: {
|
|
777
|
+
limit?: number;
|
|
778
|
+
offset?: number;
|
|
779
|
+
}): Promise<{
|
|
780
|
+
tokens: NftToken[];
|
|
781
|
+
total: number;
|
|
782
|
+
}>;
|
|
783
|
+
getToken(collectionId: string, tokenId: number): Promise<NftToken>;
|
|
784
|
+
getByOwner(pubkey: string): Promise<NftToken[]>;
|
|
785
|
+
createCollection(wallet: WalletKeys, params: CreateNftCollectionParams): Promise<ApiResponse>;
|
|
786
|
+
mint(wallet: WalletKeys, params: MintNftParams): Promise<ApiResponse>;
|
|
787
|
+
batchMint(wallet: WalletKeys, params: BatchMintNftParams): Promise<ApiResponse>;
|
|
788
|
+
transfer(wallet: WalletKeys, params: TransferNftParams): Promise<ApiResponse>;
|
|
789
|
+
burn(wallet: WalletKeys, params: BurnNftParams): Promise<ApiResponse>;
|
|
790
|
+
lock(wallet: WalletKeys, params: LockNftParams): Promise<ApiResponse>;
|
|
791
|
+
freezeCollection(wallet: WalletKeys, params: FreezeCollectionParams): Promise<ApiResponse>;
|
|
792
|
+
}
|
|
793
|
+
declare class DexClient {
|
|
794
|
+
private readonly rc;
|
|
795
|
+
constructor(rc: RougeChain);
|
|
796
|
+
getPools(): Promise<LiquidityPool[]>;
|
|
797
|
+
getPool(poolId: string): Promise<LiquidityPool>;
|
|
798
|
+
getPoolEvents(poolId: string): Promise<PoolEvent[]>;
|
|
799
|
+
getPriceHistory(poolId: string): Promise<PriceSnapshot[]>;
|
|
800
|
+
getPoolStats(poolId: string): Promise<PoolStats>;
|
|
801
|
+
quote(params: SwapQuoteParams): Promise<SwapQuote>;
|
|
802
|
+
swap(wallet: WalletKeys, params: SwapParams): Promise<ApiResponse>;
|
|
803
|
+
createPool(wallet: WalletKeys, params: CreatePoolParams): Promise<ApiResponse>;
|
|
804
|
+
addLiquidity(wallet: WalletKeys, params: AddLiquidityParams): Promise<ApiResponse>;
|
|
805
|
+
removeLiquidity(wallet: WalletKeys, params: RemoveLiquidityParams): Promise<ApiResponse>;
|
|
806
|
+
}
|
|
807
|
+
declare class BridgeClient {
|
|
808
|
+
private readonly rc;
|
|
809
|
+
constructor(rc: RougeChain);
|
|
810
|
+
getConfig(): Promise<BridgeConfig>;
|
|
811
|
+
getWithdrawals(): Promise<BridgeWithdrawal[]>;
|
|
812
|
+
/** Withdraw qETH/qUSDC — signed client-side, private key never sent to server */
|
|
813
|
+
withdraw(wallet: WalletKeys, params: BridgeWithdrawParams): Promise<ApiResponse>;
|
|
814
|
+
/** Claim qETH or qUSDC after depositing on Base Sepolia */
|
|
815
|
+
claim(params: BridgeClaimParams): Promise<ApiResponse>;
|
|
816
|
+
getXrgeConfig(): Promise<XrgeBridgeConfig>;
|
|
817
|
+
claimXrge(params: XrgeBridgeClaimParams): Promise<ApiResponse>;
|
|
818
|
+
withdrawXrge(wallet: WalletKeys, params: XrgeBridgeWithdrawParams): Promise<ApiResponse>;
|
|
819
|
+
getXrgeWithdrawals(): Promise<BridgeWithdrawal[]>;
|
|
820
|
+
}
|
|
821
|
+
declare class MailClient {
|
|
822
|
+
private readonly rc;
|
|
823
|
+
constructor(rc: RougeChain);
|
|
824
|
+
registerName(wallet: WalletKeys, name: string, walletId: string): Promise<ApiResponse>;
|
|
825
|
+
resolveName(name: string): Promise<ResolvedName | null>;
|
|
826
|
+
reverseLookup(walletId: string): Promise<string | null>;
|
|
827
|
+
releaseName(wallet: WalletKeys, name: string): Promise<ApiResponse>;
|
|
828
|
+
send(wallet: WalletKeys, params: SendMailParams): Promise<ApiResponse>;
|
|
829
|
+
getInbox(wallet: WalletKeys): Promise<MailMessage[]>;
|
|
830
|
+
getSent(wallet: WalletKeys): Promise<MailMessage[]>;
|
|
831
|
+
getTrash(wallet: WalletKeys): Promise<MailMessage[]>;
|
|
832
|
+
getMessage(wallet: WalletKeys, messageId: string): Promise<MailMessage | null>;
|
|
833
|
+
move(wallet: WalletKeys, messageId: string, folder: string): Promise<ApiResponse>;
|
|
834
|
+
markRead(wallet: WalletKeys, messageId: string): Promise<ApiResponse>;
|
|
835
|
+
delete(wallet: WalletKeys, messageId: string): Promise<ApiResponse>;
|
|
836
|
+
}
|
|
837
|
+
declare class MessengerClient {
|
|
838
|
+
private readonly rc;
|
|
839
|
+
constructor(rc: RougeChain);
|
|
840
|
+
getWallets(): Promise<MessengerWallet[]>;
|
|
841
|
+
registerWallet(wallet: WalletKeys, opts: {
|
|
842
|
+
id: string;
|
|
843
|
+
displayName: string;
|
|
844
|
+
signingPublicKey: string;
|
|
845
|
+
encryptionPublicKey: string;
|
|
846
|
+
discoverable?: boolean;
|
|
847
|
+
}): Promise<ApiResponse>;
|
|
848
|
+
getConversations(wallet: WalletKeys): Promise<MessengerConversation[]>;
|
|
849
|
+
createConversation(wallet: WalletKeys, participantIds: string[], opts?: {
|
|
850
|
+
name?: string;
|
|
851
|
+
isGroup?: boolean;
|
|
852
|
+
}): Promise<ApiResponse>;
|
|
853
|
+
getMessages(wallet: WalletKeys, conversationId: string): Promise<MessengerMessage[]>;
|
|
854
|
+
sendMessage(wallet: WalletKeys, conversationId: string, encryptedContent: string, opts?: {
|
|
855
|
+
contentSignature?: string;
|
|
856
|
+
messageType?: string;
|
|
857
|
+
selfDestruct?: boolean;
|
|
858
|
+
destructAfterSeconds?: number;
|
|
859
|
+
spoiler?: boolean;
|
|
860
|
+
}): Promise<ApiResponse>;
|
|
861
|
+
deleteMessage(wallet: WalletKeys, messageId: string, conversationId: string): Promise<ApiResponse>;
|
|
862
|
+
deleteConversation(wallet: WalletKeys, conversationId: string): Promise<ApiResponse>;
|
|
863
|
+
markRead(wallet: WalletKeys, messageId: string, conversationId: string): Promise<ApiResponse>;
|
|
864
|
+
}
|
|
865
|
+
declare class ShieldedClient {
|
|
866
|
+
private readonly rc;
|
|
867
|
+
constructor(rc: RougeChain);
|
|
868
|
+
getStats(): Promise<ShieldedStats>;
|
|
869
|
+
isNullifierSpent(nullifierHex: string): Promise<{
|
|
870
|
+
spent: boolean;
|
|
871
|
+
}>;
|
|
872
|
+
/**
|
|
873
|
+
* Shield public XRGE into a private note.
|
|
874
|
+
* Creates the commitment client-side, submits to the chain.
|
|
875
|
+
*
|
|
876
|
+
* @returns The ShieldedNote (keep this locally — it's the only way to spend the note)
|
|
877
|
+
*/
|
|
878
|
+
shield(wallet: WalletKeys, params: ShieldParams): Promise<ApiResponse & {
|
|
879
|
+
note?: ShieldedNote;
|
|
880
|
+
}>;
|
|
881
|
+
/**
|
|
882
|
+
* Transfer between shielded notes (private → private).
|
|
883
|
+
* Requires a pre-generated STARK proof.
|
|
884
|
+
*/
|
|
885
|
+
transfer(wallet: WalletKeys, params: ShieldedTransferParams): Promise<ApiResponse>;
|
|
886
|
+
/**
|
|
887
|
+
* Unshield a private note back to public XRGE.
|
|
888
|
+
* Requires a STARK proof of note ownership.
|
|
889
|
+
*/
|
|
890
|
+
unshield(wallet: WalletKeys, params: UnshieldParams): Promise<ApiResponse>;
|
|
891
|
+
/** Deploy a WASM smart contract */
|
|
892
|
+
deployContract(params: {
|
|
893
|
+
wasm: string;
|
|
894
|
+
deployer: string;
|
|
895
|
+
nonce?: number;
|
|
896
|
+
}): Promise<ApiResponse>;
|
|
897
|
+
/** Call a WASM smart contract method (mutating) */
|
|
898
|
+
callContract(params: {
|
|
899
|
+
contractAddr: string;
|
|
900
|
+
method: string;
|
|
901
|
+
caller?: string;
|
|
902
|
+
args?: unknown;
|
|
903
|
+
gasLimit?: number;
|
|
904
|
+
}): Promise<ApiResponse>;
|
|
905
|
+
/** Get contract metadata */
|
|
906
|
+
getContract(addr: string): Promise<ApiResponse>;
|
|
907
|
+
/** Read contract storage. Omit key for full state dump. */
|
|
908
|
+
getContractState(addr: string, key?: string): Promise<ApiResponse>;
|
|
909
|
+
/** Get contract events */
|
|
910
|
+
getContractEvents(addr: string, limit?: number): Promise<ApiResponse>;
|
|
911
|
+
/** List all deployed contracts */
|
|
912
|
+
listContracts(): Promise<ApiResponse>;
|
|
913
|
+
}
|
|
914
|
+
interface TrackStats {
|
|
915
|
+
plays: number;
|
|
916
|
+
likes: number;
|
|
917
|
+
commentCount: number;
|
|
918
|
+
liked: boolean;
|
|
919
|
+
}
|
|
920
|
+
interface ArtistStats {
|
|
921
|
+
followers: number;
|
|
922
|
+
following: number;
|
|
923
|
+
isFollowing: boolean;
|
|
924
|
+
}
|
|
925
|
+
interface SocialComment {
|
|
926
|
+
id: string;
|
|
927
|
+
track_id: string;
|
|
928
|
+
wallet_pubkey: string;
|
|
929
|
+
body: string;
|
|
930
|
+
timestamp: string;
|
|
931
|
+
}
|
|
932
|
+
interface SocialPost {
|
|
933
|
+
id: string;
|
|
934
|
+
author_pubkey: string;
|
|
935
|
+
body: string;
|
|
936
|
+
reply_to_id: string | null;
|
|
937
|
+
created_at: string;
|
|
938
|
+
}
|
|
939
|
+
interface PostStats {
|
|
940
|
+
likes: number;
|
|
941
|
+
reposts: number;
|
|
942
|
+
replies: number;
|
|
943
|
+
liked: boolean;
|
|
944
|
+
reposted: boolean;
|
|
945
|
+
}
|
|
946
|
+
declare class SocialClient {
|
|
947
|
+
private readonly rc;
|
|
948
|
+
constructor(rc: RougeChain);
|
|
949
|
+
recordPlay(wallet: WalletKeys, trackId: string): Promise<ApiResponse>;
|
|
950
|
+
toggleLike(wallet: WalletKeys, trackId: string): Promise<ApiResponse & {
|
|
951
|
+
liked?: boolean;
|
|
952
|
+
likes?: number;
|
|
953
|
+
}>;
|
|
954
|
+
postComment(wallet: WalletKeys, trackId: string, body: string): Promise<ApiResponse & {
|
|
955
|
+
comment?: SocialComment;
|
|
956
|
+
}>;
|
|
957
|
+
deleteComment(wallet: WalletKeys, commentId: string): Promise<ApiResponse>;
|
|
958
|
+
toggleFollow(wallet: WalletKeys, artistPubkey: string): Promise<ApiResponse & {
|
|
959
|
+
following?: boolean;
|
|
960
|
+
followers?: number;
|
|
961
|
+
}>;
|
|
962
|
+
getTrackStats(trackId: string, viewerPubkey?: string): Promise<TrackStats>;
|
|
963
|
+
getComments(trackId: string, limit?: number, offset?: number): Promise<SocialComment[]>;
|
|
964
|
+
getArtistStats(pubkey: string, viewerPubkey?: string): Promise<ArtistStats>;
|
|
965
|
+
getUserLikes(pubkey: string): Promise<string[]>;
|
|
966
|
+
getUserFollowing(pubkey: string): Promise<string[]>;
|
|
967
|
+
createPost(wallet: WalletKeys, body: string, replyToId?: string): Promise<ApiResponse & {
|
|
968
|
+
post?: SocialPost;
|
|
969
|
+
}>;
|
|
970
|
+
deletePost(wallet: WalletKeys, postId: string): Promise<ApiResponse>;
|
|
971
|
+
toggleRepost(wallet: WalletKeys, postId: string): Promise<ApiResponse & {
|
|
972
|
+
reposted?: boolean;
|
|
973
|
+
reposts?: number;
|
|
974
|
+
}>;
|
|
975
|
+
getPost(postId: string, viewerPubkey?: string): Promise<{
|
|
976
|
+
post: SocialPost;
|
|
977
|
+
stats: PostStats;
|
|
978
|
+
} | null>;
|
|
979
|
+
getPostStats(postId: string, viewerPubkey?: string): Promise<PostStats>;
|
|
980
|
+
getPostReplies(postId: string, limit?: number, offset?: number): Promise<SocialPost[]>;
|
|
981
|
+
getUserPosts(pubkey: string, limit?: number, offset?: number): Promise<{
|
|
982
|
+
posts: SocialPost[];
|
|
983
|
+
total: number;
|
|
984
|
+
}>;
|
|
985
|
+
getGlobalTimeline(limit?: number, offset?: number): Promise<SocialPost[]>;
|
|
986
|
+
getFollowingFeed(wallet: WalletKeys, limit?: number, offset?: number): Promise<SocialPost[]>;
|
|
987
|
+
hideTrack(wallet: WalletKeys, trackId: string, hidden?: boolean): Promise<ApiResponse & {
|
|
988
|
+
hidden?: boolean;
|
|
989
|
+
}>;
|
|
990
|
+
getHiddenTracks(pubkey: string): Promise<string[]>;
|
|
991
|
+
}
|
|
992
|
+
|
|
993
|
+
declare class Wallet implements WalletKeys {
|
|
994
|
+
readonly publicKey: string;
|
|
995
|
+
readonly privateKey: string;
|
|
996
|
+
readonly mnemonic?: string;
|
|
997
|
+
private constructor();
|
|
998
|
+
/**
|
|
999
|
+
* Generate a new ML-DSA-65 keypair with a BIP-39 mnemonic.
|
|
1000
|
+
* The mnemonic is stored on the wallet for backup/recovery.
|
|
1001
|
+
* @param strength 256 = 24 words (default, post-quantum safe), 128 = 12 words
|
|
1002
|
+
*/
|
|
1003
|
+
static generate(strength?: 128 | 256): Wallet;
|
|
1004
|
+
/**
|
|
1005
|
+
* Generate a wallet using pure random entropy (no mnemonic).
|
|
1006
|
+
* Keys cannot be recovered from a seed phrase.
|
|
1007
|
+
*/
|
|
1008
|
+
static generateRandom(): Wallet;
|
|
1009
|
+
/**
|
|
1010
|
+
* Restore a wallet from a BIP-39 mnemonic seed phrase.
|
|
1011
|
+
* @param mnemonic 12 or 24 word BIP-39 mnemonic
|
|
1012
|
+
* @param passphrase Optional BIP-39 passphrase (25th word)
|
|
1013
|
+
*/
|
|
1014
|
+
static fromMnemonic(mnemonic: string, passphrase?: string): Wallet;
|
|
1015
|
+
/**
|
|
1016
|
+
* Restore a wallet from existing hex-encoded keys.
|
|
1017
|
+
*/
|
|
1018
|
+
static fromKeys(publicKey: string, privateKey: string): Wallet;
|
|
1019
|
+
/**
|
|
1020
|
+
* Export keys as a plain object (for serialization/storage).
|
|
1021
|
+
*/
|
|
1022
|
+
toJSON(): WalletKeys;
|
|
1023
|
+
/**
|
|
1024
|
+
* Derive the compact Bech32m address from the public key.
|
|
1025
|
+
* Returns a ~63-character `rouge1...` string.
|
|
1026
|
+
*/
|
|
1027
|
+
address(): Promise<string>;
|
|
1028
|
+
/**
|
|
1029
|
+
* Verify that the keypair is valid by signing and verifying a test message.
|
|
1030
|
+
*/
|
|
1031
|
+
verify(): boolean;
|
|
1032
|
+
}
|
|
1033
|
+
|
|
1034
|
+
/**
|
|
1035
|
+
* BIP-39 Mnemonic Seed Phrase Support for RougeChain
|
|
1036
|
+
*
|
|
1037
|
+
* Derivation path:
|
|
1038
|
+
* Mnemonic (12/24 words)
|
|
1039
|
+
* → PBKDF2 (standard BIP-39) → 512-bit seed
|
|
1040
|
+
* → HKDF-SHA256(seed, info="rougechain-ml-dsa-65-v1") → 32-byte ML-DSA seed
|
|
1041
|
+
* → ml_dsa65.keygen(seed) → deterministic keypair
|
|
1042
|
+
*
|
|
1043
|
+
* The domain separator ensures the same mnemonic produces different keys
|
|
1044
|
+
* than Ethereum/Solana wallets, preventing cross-chain key reuse.
|
|
1045
|
+
*/
|
|
1046
|
+
/**
|
|
1047
|
+
* Generate a new BIP-39 mnemonic phrase.
|
|
1048
|
+
* @param strength 128 = 12 words (default), 256 = 24 words
|
|
1049
|
+
*/
|
|
1050
|
+
declare function generateMnemonic(strength?: 128 | 256): string;
|
|
1051
|
+
/**
|
|
1052
|
+
* Validate a BIP-39 mnemonic phrase.
|
|
1053
|
+
*/
|
|
1054
|
+
declare function validateMnemonic(mnemonic: string): boolean;
|
|
1055
|
+
/**
|
|
1056
|
+
* Derive a 32-byte ML-DSA-65 seed from a BIP-39 mnemonic.
|
|
1057
|
+
*
|
|
1058
|
+
* mnemonic → PBKDF2 → 512-bit BIP-39 seed → HKDF-SHA256 → 32-byte ML-DSA seed
|
|
1059
|
+
*
|
|
1060
|
+
* @param mnemonic BIP-39 mnemonic (12 or 24 words)
|
|
1061
|
+
* @param passphrase Optional BIP-39 passphrase (25th word)
|
|
1062
|
+
* @returns 32-byte seed suitable for ml_dsa65.keygen()
|
|
1063
|
+
*/
|
|
1064
|
+
declare function mnemonicToMLDSASeed(mnemonic: string, passphrase?: string): Uint8Array;
|
|
1065
|
+
/**
|
|
1066
|
+
* Generate an ML-DSA-65 keypair from a BIP-39 mnemonic.
|
|
1067
|
+
*
|
|
1068
|
+
* Same mnemonic + passphrase always yields the same keypair.
|
|
1069
|
+
*
|
|
1070
|
+
* @param mnemonic BIP-39 mnemonic (12 or 24 words)
|
|
1071
|
+
* @param passphrase Optional BIP-39 passphrase (25th word)
|
|
1072
|
+
* @returns { publicKey, secretKey } as hex strings
|
|
1073
|
+
*/
|
|
1074
|
+
declare function keypairFromMnemonic(mnemonic: string, passphrase?: string): {
|
|
1075
|
+
publicKey: string;
|
|
1076
|
+
secretKey: string;
|
|
1077
|
+
};
|
|
1078
|
+
|
|
1079
|
+
declare const BURN_ADDRESS = "XRGE_BURN_0x000000000000000000000000000000000000000000000000000000000000DEAD";
|
|
1080
|
+
declare function serializePayload(payload: TransactionPayload): Uint8Array;
|
|
1081
|
+
declare function signTransaction(payload: TransactionPayload, privateKey: string, publicKey: string): SignedTransaction;
|
|
1082
|
+
declare function verifyTransaction(signedTx: SignedTransaction): boolean;
|
|
1083
|
+
declare function isBurnAddress(address: string): boolean;
|
|
1084
|
+
declare function createSignedTokenMetadataUpdate(wallet: WalletKeys, tokenSymbol: string, metadata: {
|
|
1085
|
+
image?: string;
|
|
1086
|
+
description?: string;
|
|
1087
|
+
website?: string;
|
|
1088
|
+
twitter?: string;
|
|
1089
|
+
discord?: string;
|
|
1090
|
+
}): SignedTransaction;
|
|
1091
|
+
declare function createSignedTokenMetadataClaim(wallet: WalletKeys, tokenSymbol: string): SignedTransaction;
|
|
1092
|
+
declare function createSignedTokenApproval(wallet: WalletKeys, spender: string, tokenSymbol: string, amount: number): SignedTransaction;
|
|
1093
|
+
declare function createSignedTokenTransferFrom(wallet: WalletKeys, owner: string, to: string, tokenSymbol: string, amount: number): SignedTransaction;
|
|
1094
|
+
declare function createSignedBridgeWithdraw(wallet: WalletKeys, amount: number, evmAddress: string, tokenSymbol?: string, fee?: number): SignedTransaction;
|
|
1095
|
+
declare function createSignedShield(wallet: WalletKeys, amount: number, commitment: string): SignedTransaction;
|
|
1096
|
+
declare function createSignedShieldedTransfer(wallet: WalletKeys, nullifiers: string[], outputCommitments: string[], proof: string, shieldedFee?: number): SignedTransaction;
|
|
1097
|
+
declare function createSignedUnshield(wallet: WalletKeys, nullifiers: string[], amount: number, proof: string): SignedTransaction;
|
|
1098
|
+
declare function signRequest(wallet: WalletKeys, payload: Record<string, unknown>): SignedTransaction;
|
|
1099
|
+
|
|
1100
|
+
declare function hexToBytes(hex: string): Uint8Array;
|
|
1101
|
+
declare function bytesToHex(bytes: Uint8Array): string;
|
|
1102
|
+
declare function generateNonce(): string;
|
|
1103
|
+
|
|
1104
|
+
/**
|
|
1105
|
+
* RougeChain Bech32m Address Utilities for SDK
|
|
1106
|
+
*
|
|
1107
|
+
* Derives compact, human-readable addresses from PQC public keys:
|
|
1108
|
+
* address = bech32m("rouge", SHA-256(raw_pubkey_bytes))
|
|
1109
|
+
*
|
|
1110
|
+
* Result: ~63-char address like "rouge1q8f3x7k2m4n9p..."
|
|
1111
|
+
* Matches the Rust implementation in core/crypto/src/lib.rs exactly.
|
|
1112
|
+
*/
|
|
1113
|
+
/**
|
|
1114
|
+
* Derive a compact Bech32m address from an ML-DSA-65 public key (hex).
|
|
1115
|
+
* Returns a ~63-character string like "rouge1q8f3x7k2m4n9p..."
|
|
1116
|
+
*/
|
|
1117
|
+
declare function pubkeyToAddress(publicKeyHex: string): Promise<string>;
|
|
1118
|
+
/**
|
|
1119
|
+
* Decode a Bech32m address back to its 32-byte SHA-256 hash (hex).
|
|
1120
|
+
*/
|
|
1121
|
+
declare function addressToHash(address: string): string;
|
|
1122
|
+
/**
|
|
1123
|
+
* Check if a string is a valid RougeChain Bech32m address.
|
|
1124
|
+
*/
|
|
1125
|
+
declare function isRougeAddress(input: string): boolean;
|
|
1126
|
+
/**
|
|
1127
|
+
* Format an address for compact display: "rouge1q8f3...k9m2"
|
|
1128
|
+
*/
|
|
1129
|
+
declare function formatAddress(address: string, prefixLen?: number, suffixLen?: number): string;
|
|
1130
|
+
|
|
1131
|
+
export { type AddLiquidityParams, type ApiResponse, type ApproveParams, type ArtistStats, BURN_ADDRESS, type BalanceResponse, type BatchMintNftParams, type Block, type BlockHeader, type BridgeClaimParams, type BridgeConfig, type BridgeWithdrawParams, type BridgeWithdrawal, type BurnNftParams, type CallContractParams, type ContractCallResult, type ContractEvent, type ContractMetadata, type CreateNftCollectionParams, type CreatePoolParams, type CreateTokenParams, type DeployContractParams, type FeeInfo, type FinalityProof, type FreezeCollectionParams, type LiquidityPool, type LockNftParams, type MailMessage, type MessengerConversation, type MessengerMessage, type MessengerWallet, type MintNftParams, type MintTokenParams, type NameEntry, type NftCollection, type NftToken, type NodeStats, type PoolEvent, type PoolStats, type PostStats, type PriceSnapshot, type RemoveLiquidityParams, type ResolvedName, type RollupBatchResult, type RollupStatus, type RollupSubmitParams, type RollupSubmitResult, RougeChain, type RougeChainOptions, type SendMailParams, type ShieldParams, type ShieldedNote, type ShieldedStats, type ShieldedTransferParams, type SignedTransaction, type SocialComment, type SocialPost, type StakeParams, type SwapParams, type SwapQuote, type SwapQuoteParams, type TokenHolder, type TokenMetadata, type TokenMetadataUpdateParams, type TrackStats, type Transaction, type TransactionPayload, type TransactionType, type TransferFromParams, type TransferNftParams, type TransferParams, type UnshieldParams, type Validator, type VoteMessage, Wallet, type WalletKeys, type WsSubscribeMessage, type XrgeBridgeClaimParams, type XrgeBridgeConfig, type XrgeBridgeWithdrawParams, addressToHash, bytesToHex, computeCommitment, computeNullifier, createShieldedNote, createSignedBridgeWithdraw, createSignedShield, createSignedShieldedTransfer, createSignedTokenApproval, createSignedTokenMetadataClaim, createSignedTokenMetadataUpdate, createSignedTokenTransferFrom, createSignedUnshield, formatAddress, generateMnemonic, generateNonce, generateRandomness, hexToBytes, isBurnAddress, isRougeAddress, keypairFromMnemonic, mnemonicToMLDSASeed, pubkeyToAddress, serializePayload, signRequest, signTransaction, validateMnemonic, verifyTransaction };
|