@rougechain/sdk 0.1.1 → 0.2.0

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 CHANGED
@@ -7,7 +7,7 @@ interface ApiResponse<T = unknown> {
7
7
  error?: string;
8
8
  data?: T;
9
9
  }
10
- 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";
10
+ 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";
11
11
  interface TransactionPayload {
12
12
  type: TransactionType;
13
13
  from: string;
@@ -15,6 +15,8 @@ interface TransactionPayload {
15
15
  amount?: number;
16
16
  fee?: number;
17
17
  token?: string;
18
+ tokenSymbol?: string;
19
+ evmAddress?: string;
18
20
  timestamp: number;
19
21
  nonce: string;
20
22
  token_name?: string;
@@ -189,6 +191,7 @@ interface BridgeConfig {
189
191
  enabled: boolean;
190
192
  custodyAddress?: string;
191
193
  chainId: number;
194
+ supportedTokens?: string[];
192
195
  }
193
196
  interface BridgeWithdrawal {
194
197
  tx_id: string;
@@ -198,6 +201,56 @@ interface BridgeWithdrawal {
198
201
  status: string;
199
202
  created_at: number;
200
203
  }
204
+ interface XrgeBridgeConfig {
205
+ enabled: boolean;
206
+ vaultAddress?: string;
207
+ tokenAddress?: string;
208
+ chainId: number;
209
+ }
210
+ interface MailMessage {
211
+ id: string;
212
+ from: string;
213
+ to: string;
214
+ subject: string;
215
+ body: string;
216
+ encrypted_subject?: string;
217
+ encrypted_body?: string;
218
+ reply_to_id?: string;
219
+ read: boolean;
220
+ folder: "inbox" | "sent" | "trash";
221
+ created_at: number;
222
+ }
223
+ interface SendMailParams {
224
+ from: string;
225
+ to: string;
226
+ subject: string;
227
+ body: string;
228
+ encrypted_subject: string;
229
+ encrypted_body: string;
230
+ reply_to_id?: string;
231
+ }
232
+ interface MessengerWallet {
233
+ wallet_id: string;
234
+ display_name?: string;
235
+ encryption_public_key?: string;
236
+ created_at: number;
237
+ }
238
+ interface MessengerConversation {
239
+ id: string;
240
+ participants: string[];
241
+ created_at: number;
242
+ }
243
+ interface MessengerMessage {
244
+ id: string;
245
+ conversation_id: string;
246
+ sender: string;
247
+ encrypted_content: string;
248
+ media_type?: string;
249
+ media_data?: string;
250
+ self_destruct?: boolean;
251
+ read?: boolean;
252
+ created_at: number;
253
+ }
201
254
  interface TransferParams {
202
255
  to: string;
203
256
  amount: number;
@@ -278,6 +331,24 @@ interface BridgeWithdrawParams {
278
331
  amount: number;
279
332
  evmAddress: string;
280
333
  fee?: number;
334
+ tokenSymbol?: string;
335
+ }
336
+ interface BridgeClaimParams {
337
+ evmTxHash: string;
338
+ evmAddress: string;
339
+ evmSignature: string;
340
+ recipientPubkey: string;
341
+ token?: "ETH" | "USDC";
342
+ }
343
+ interface XrgeBridgeClaimParams {
344
+ evmTxHash: string;
345
+ evmAddress: string;
346
+ amount: string;
347
+ recipientPubkey: string;
348
+ }
349
+ interface XrgeBridgeWithdrawParams {
350
+ amount: number;
351
+ evmAddress: string;
281
352
  }
282
353
  interface SwapQuoteParams {
283
354
  poolId: string;
@@ -301,12 +372,14 @@ interface RougeChainOptions {
301
372
  apiKey?: string;
302
373
  }
303
374
  declare class RougeChain {
304
- private readonly baseUrl;
305
- private readonly fetchFn;
306
- private readonly headers;
375
+ /** @internal */ readonly baseUrl: string;
376
+ /** @internal */ readonly fetchFn: FetchFn;
377
+ /** @internal */ readonly headers: Record<string, string>;
307
378
  readonly nft: NftClient;
308
379
  readonly dex: DexClient;
309
380
  readonly bridge: BridgeClient;
381
+ readonly mail: MailClient;
382
+ readonly messenger: MessengerClient;
310
383
  constructor(baseUrl: string, options?: RougeChainOptions);
311
384
  /** @internal */
312
385
  get<T = unknown>(path: string): Promise<T>;
@@ -396,13 +469,41 @@ declare class BridgeClient {
396
469
  constructor(rc: RougeChain);
397
470
  getConfig(): Promise<BridgeConfig>;
398
471
  getWithdrawals(): Promise<BridgeWithdrawal[]>;
472
+ /** Withdraw qETH/qUSDC — signed client-side, private key never sent to server */
399
473
  withdraw(wallet: WalletKeys, params: BridgeWithdrawParams): Promise<ApiResponse>;
400
- claim(params: {
401
- evmTxHash: string;
402
- evmAddress: string;
403
- evmSignature: string;
404
- recipientPubkey: string;
474
+ /** Claim qETH or qUSDC after depositing on Base Sepolia */
475
+ claim(params: BridgeClaimParams): Promise<ApiResponse>;
476
+ getXrgeConfig(): Promise<XrgeBridgeConfig>;
477
+ claimXrge(params: XrgeBridgeClaimParams): Promise<ApiResponse>;
478
+ withdrawXrge(wallet: WalletKeys, params: XrgeBridgeWithdrawParams): Promise<ApiResponse>;
479
+ getXrgeWithdrawals(): Promise<BridgeWithdrawal[]>;
480
+ }
481
+ declare class MailClient {
482
+ private readonly rc;
483
+ constructor(rc: RougeChain);
484
+ send(params: SendMailParams): Promise<ApiResponse>;
485
+ getInbox(walletId: string): Promise<MailMessage[]>;
486
+ getSent(walletId: string): Promise<MailMessage[]>;
487
+ getTrash(walletId: string): Promise<MailMessage[]>;
488
+ getMessage(id: string): Promise<MailMessage>;
489
+ move(messageId: string, folder: string): Promise<ApiResponse>;
490
+ markRead(messageId: string): Promise<ApiResponse>;
491
+ delete(id: string): Promise<ApiResponse>;
492
+ }
493
+ declare class MessengerClient {
494
+ private readonly rc;
495
+ constructor(rc: RougeChain);
496
+ getWallets(): Promise<MessengerWallet[]>;
497
+ registerWallet(walletId: string, displayName?: string, encryptionPublicKey?: string): Promise<ApiResponse>;
498
+ getConversations(walletId: string): Promise<MessengerConversation[]>;
499
+ createConversation(participants: string[]): Promise<ApiResponse>;
500
+ getMessages(conversationId: string): Promise<MessengerMessage[]>;
501
+ sendMessage(conversationId: string, sender: string, encryptedContent: string, opts?: {
502
+ mediaType?: string;
503
+ mediaData?: string;
504
+ selfDestruct?: boolean;
405
505
  }): Promise<ApiResponse>;
506
+ markRead(messageId: string): Promise<ApiResponse>;
406
507
  }
407
508
 
408
509
  declare class Wallet implements WalletKeys {
@@ -433,9 +534,10 @@ declare function serializePayload(payload: TransactionPayload): Uint8Array;
433
534
  declare function signTransaction(payload: TransactionPayload, privateKey: string, publicKey: string): SignedTransaction;
434
535
  declare function verifyTransaction(signedTx: SignedTransaction): boolean;
435
536
  declare function isBurnAddress(address: string): boolean;
537
+ declare function createSignedBridgeWithdraw(wallet: WalletKeys, amount: number, evmAddress: string, tokenSymbol?: string, fee?: number): SignedTransaction;
436
538
 
437
539
  declare function hexToBytes(hex: string): Uint8Array;
438
540
  declare function bytesToHex(bytes: Uint8Array): string;
439
541
  declare function generateNonce(): string;
440
542
 
441
- export { type AddLiquidityParams, type ApiResponse, BURN_ADDRESS, type BalanceResponse, type BatchMintNftParams, type Block, type BlockHeader, type BridgeConfig, type BridgeWithdrawParams, type BridgeWithdrawal, type BurnNftParams, type CreateNftCollectionParams, type CreatePoolParams, type CreateTokenParams, type FreezeCollectionParams, type LiquidityPool, type LockNftParams, type MintNftParams, type NftCollection, type NftToken, type NodeStats, type PoolEvent, type PoolStats, type RemoveLiquidityParams, RougeChain, type RougeChainOptions, type SignedTransaction, type StakeParams, type SwapParams, type SwapQuote, type SwapQuoteParams, type TokenHolder, type TokenMetadata, type TokenMetadataUpdateParams, type Transaction, type TransactionPayload, type TransactionType, type TransferNftParams, type TransferParams, type Validator, Wallet, type WalletKeys, bytesToHex, generateNonce, hexToBytes, isBurnAddress, serializePayload, signTransaction, verifyTransaction };
543
+ export { type AddLiquidityParams, type ApiResponse, BURN_ADDRESS, type BalanceResponse, type BatchMintNftParams, type Block, type BlockHeader, type BridgeClaimParams, type BridgeConfig, type BridgeWithdrawParams, type BridgeWithdrawal, type BurnNftParams, type CreateNftCollectionParams, type CreatePoolParams, type CreateTokenParams, type FreezeCollectionParams, type LiquidityPool, type LockNftParams, type MailMessage, type MessengerConversation, type MessengerMessage, type MessengerWallet, type MintNftParams, type NftCollection, type NftToken, type NodeStats, type PoolEvent, type PoolStats, type RemoveLiquidityParams, RougeChain, type RougeChainOptions, type SendMailParams, type SignedTransaction, type StakeParams, type SwapParams, type SwapQuote, type SwapQuoteParams, type TokenHolder, type TokenMetadata, type TokenMetadataUpdateParams, type Transaction, type TransactionPayload, type TransactionType, type TransferNftParams, type TransferParams, type Validator, Wallet, type WalletKeys, type XrgeBridgeClaimParams, type XrgeBridgeConfig, type XrgeBridgeWithdrawParams, bytesToHex, createSignedBridgeWithdraw, generateNonce, hexToBytes, isBurnAddress, serializePayload, signTransaction, verifyTransaction };
package/dist/index.d.ts CHANGED
@@ -7,7 +7,7 @@ interface ApiResponse<T = unknown> {
7
7
  error?: string;
8
8
  data?: T;
9
9
  }
10
- 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";
10
+ 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";
11
11
  interface TransactionPayload {
12
12
  type: TransactionType;
13
13
  from: string;
@@ -15,6 +15,8 @@ interface TransactionPayload {
15
15
  amount?: number;
16
16
  fee?: number;
17
17
  token?: string;
18
+ tokenSymbol?: string;
19
+ evmAddress?: string;
18
20
  timestamp: number;
19
21
  nonce: string;
20
22
  token_name?: string;
@@ -189,6 +191,7 @@ interface BridgeConfig {
189
191
  enabled: boolean;
190
192
  custodyAddress?: string;
191
193
  chainId: number;
194
+ supportedTokens?: string[];
192
195
  }
193
196
  interface BridgeWithdrawal {
194
197
  tx_id: string;
@@ -198,6 +201,56 @@ interface BridgeWithdrawal {
198
201
  status: string;
199
202
  created_at: number;
200
203
  }
204
+ interface XrgeBridgeConfig {
205
+ enabled: boolean;
206
+ vaultAddress?: string;
207
+ tokenAddress?: string;
208
+ chainId: number;
209
+ }
210
+ interface MailMessage {
211
+ id: string;
212
+ from: string;
213
+ to: string;
214
+ subject: string;
215
+ body: string;
216
+ encrypted_subject?: string;
217
+ encrypted_body?: string;
218
+ reply_to_id?: string;
219
+ read: boolean;
220
+ folder: "inbox" | "sent" | "trash";
221
+ created_at: number;
222
+ }
223
+ interface SendMailParams {
224
+ from: string;
225
+ to: string;
226
+ subject: string;
227
+ body: string;
228
+ encrypted_subject: string;
229
+ encrypted_body: string;
230
+ reply_to_id?: string;
231
+ }
232
+ interface MessengerWallet {
233
+ wallet_id: string;
234
+ display_name?: string;
235
+ encryption_public_key?: string;
236
+ created_at: number;
237
+ }
238
+ interface MessengerConversation {
239
+ id: string;
240
+ participants: string[];
241
+ created_at: number;
242
+ }
243
+ interface MessengerMessage {
244
+ id: string;
245
+ conversation_id: string;
246
+ sender: string;
247
+ encrypted_content: string;
248
+ media_type?: string;
249
+ media_data?: string;
250
+ self_destruct?: boolean;
251
+ read?: boolean;
252
+ created_at: number;
253
+ }
201
254
  interface TransferParams {
202
255
  to: string;
203
256
  amount: number;
@@ -278,6 +331,24 @@ interface BridgeWithdrawParams {
278
331
  amount: number;
279
332
  evmAddress: string;
280
333
  fee?: number;
334
+ tokenSymbol?: string;
335
+ }
336
+ interface BridgeClaimParams {
337
+ evmTxHash: string;
338
+ evmAddress: string;
339
+ evmSignature: string;
340
+ recipientPubkey: string;
341
+ token?: "ETH" | "USDC";
342
+ }
343
+ interface XrgeBridgeClaimParams {
344
+ evmTxHash: string;
345
+ evmAddress: string;
346
+ amount: string;
347
+ recipientPubkey: string;
348
+ }
349
+ interface XrgeBridgeWithdrawParams {
350
+ amount: number;
351
+ evmAddress: string;
281
352
  }
282
353
  interface SwapQuoteParams {
283
354
  poolId: string;
@@ -301,12 +372,14 @@ interface RougeChainOptions {
301
372
  apiKey?: string;
302
373
  }
303
374
  declare class RougeChain {
304
- private readonly baseUrl;
305
- private readonly fetchFn;
306
- private readonly headers;
375
+ /** @internal */ readonly baseUrl: string;
376
+ /** @internal */ readonly fetchFn: FetchFn;
377
+ /** @internal */ readonly headers: Record<string, string>;
307
378
  readonly nft: NftClient;
308
379
  readonly dex: DexClient;
309
380
  readonly bridge: BridgeClient;
381
+ readonly mail: MailClient;
382
+ readonly messenger: MessengerClient;
310
383
  constructor(baseUrl: string, options?: RougeChainOptions);
311
384
  /** @internal */
312
385
  get<T = unknown>(path: string): Promise<T>;
@@ -396,13 +469,41 @@ declare class BridgeClient {
396
469
  constructor(rc: RougeChain);
397
470
  getConfig(): Promise<BridgeConfig>;
398
471
  getWithdrawals(): Promise<BridgeWithdrawal[]>;
472
+ /** Withdraw qETH/qUSDC — signed client-side, private key never sent to server */
399
473
  withdraw(wallet: WalletKeys, params: BridgeWithdrawParams): Promise<ApiResponse>;
400
- claim(params: {
401
- evmTxHash: string;
402
- evmAddress: string;
403
- evmSignature: string;
404
- recipientPubkey: string;
474
+ /** Claim qETH or qUSDC after depositing on Base Sepolia */
475
+ claim(params: BridgeClaimParams): Promise<ApiResponse>;
476
+ getXrgeConfig(): Promise<XrgeBridgeConfig>;
477
+ claimXrge(params: XrgeBridgeClaimParams): Promise<ApiResponse>;
478
+ withdrawXrge(wallet: WalletKeys, params: XrgeBridgeWithdrawParams): Promise<ApiResponse>;
479
+ getXrgeWithdrawals(): Promise<BridgeWithdrawal[]>;
480
+ }
481
+ declare class MailClient {
482
+ private readonly rc;
483
+ constructor(rc: RougeChain);
484
+ send(params: SendMailParams): Promise<ApiResponse>;
485
+ getInbox(walletId: string): Promise<MailMessage[]>;
486
+ getSent(walletId: string): Promise<MailMessage[]>;
487
+ getTrash(walletId: string): Promise<MailMessage[]>;
488
+ getMessage(id: string): Promise<MailMessage>;
489
+ move(messageId: string, folder: string): Promise<ApiResponse>;
490
+ markRead(messageId: string): Promise<ApiResponse>;
491
+ delete(id: string): Promise<ApiResponse>;
492
+ }
493
+ declare class MessengerClient {
494
+ private readonly rc;
495
+ constructor(rc: RougeChain);
496
+ getWallets(): Promise<MessengerWallet[]>;
497
+ registerWallet(walletId: string, displayName?: string, encryptionPublicKey?: string): Promise<ApiResponse>;
498
+ getConversations(walletId: string): Promise<MessengerConversation[]>;
499
+ createConversation(participants: string[]): Promise<ApiResponse>;
500
+ getMessages(conversationId: string): Promise<MessengerMessage[]>;
501
+ sendMessage(conversationId: string, sender: string, encryptedContent: string, opts?: {
502
+ mediaType?: string;
503
+ mediaData?: string;
504
+ selfDestruct?: boolean;
405
505
  }): Promise<ApiResponse>;
506
+ markRead(messageId: string): Promise<ApiResponse>;
406
507
  }
407
508
 
408
509
  declare class Wallet implements WalletKeys {
@@ -433,9 +534,10 @@ declare function serializePayload(payload: TransactionPayload): Uint8Array;
433
534
  declare function signTransaction(payload: TransactionPayload, privateKey: string, publicKey: string): SignedTransaction;
434
535
  declare function verifyTransaction(signedTx: SignedTransaction): boolean;
435
536
  declare function isBurnAddress(address: string): boolean;
537
+ declare function createSignedBridgeWithdraw(wallet: WalletKeys, amount: number, evmAddress: string, tokenSymbol?: string, fee?: number): SignedTransaction;
436
538
 
437
539
  declare function hexToBytes(hex: string): Uint8Array;
438
540
  declare function bytesToHex(bytes: Uint8Array): string;
439
541
  declare function generateNonce(): string;
440
542
 
441
- export { type AddLiquidityParams, type ApiResponse, BURN_ADDRESS, type BalanceResponse, type BatchMintNftParams, type Block, type BlockHeader, type BridgeConfig, type BridgeWithdrawParams, type BridgeWithdrawal, type BurnNftParams, type CreateNftCollectionParams, type CreatePoolParams, type CreateTokenParams, type FreezeCollectionParams, type LiquidityPool, type LockNftParams, type MintNftParams, type NftCollection, type NftToken, type NodeStats, type PoolEvent, type PoolStats, type RemoveLiquidityParams, RougeChain, type RougeChainOptions, type SignedTransaction, type StakeParams, type SwapParams, type SwapQuote, type SwapQuoteParams, type TokenHolder, type TokenMetadata, type TokenMetadataUpdateParams, type Transaction, type TransactionPayload, type TransactionType, type TransferNftParams, type TransferParams, type Validator, Wallet, type WalletKeys, bytesToHex, generateNonce, hexToBytes, isBurnAddress, serializePayload, signTransaction, verifyTransaction };
543
+ export { type AddLiquidityParams, type ApiResponse, BURN_ADDRESS, type BalanceResponse, type BatchMintNftParams, type Block, type BlockHeader, type BridgeClaimParams, type BridgeConfig, type BridgeWithdrawParams, type BridgeWithdrawal, type BurnNftParams, type CreateNftCollectionParams, type CreatePoolParams, type CreateTokenParams, type FreezeCollectionParams, type LiquidityPool, type LockNftParams, type MailMessage, type MessengerConversation, type MessengerMessage, type MessengerWallet, type MintNftParams, type NftCollection, type NftToken, type NodeStats, type PoolEvent, type PoolStats, type RemoveLiquidityParams, RougeChain, type RougeChainOptions, type SendMailParams, type SignedTransaction, type StakeParams, type SwapParams, type SwapQuote, type SwapQuoteParams, type TokenHolder, type TokenMetadata, type TokenMetadataUpdateParams, type Transaction, type TransactionPayload, type TransactionType, type TransferNftParams, type TransferParams, type Validator, Wallet, type WalletKeys, type XrgeBridgeClaimParams, type XrgeBridgeConfig, type XrgeBridgeWithdrawParams, bytesToHex, createSignedBridgeWithdraw, generateNonce, hexToBytes, isBurnAddress, serializePayload, signTransaction, verifyTransaction };