@rougechain/sdk 0.2.0 → 0.3.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/README.md CHANGED
@@ -1,272 +1,293 @@
1
- # @rougechain/sdk
1
+ <p align="center">
2
+ <a href="https://rougechain.io">
3
+ <img src="https://rougechain.io/logo.webp" alt="RougeChain" width="80" height="80" />
4
+ </a>
5
+ </p>
2
6
 
3
- Official SDK for **RougeChain** — a post-quantum Layer 1 blockchain secured by ML-DSA-65 (CRYSTALS-Dilithium) signatures.
7
+ <h1 align="center">@rougechain/sdk</h1>
4
8
 
5
- Build dApps on RougeChain from any JavaScript/TypeScript environment: browser, Node.js, or React Native.
9
+ <p align="center">
10
+ <strong>Build quantum-safe dApps on RougeChain</strong><br />
11
+ Transfers · DEX · NFTs · Bridge · Mail · Messenger
12
+ </p>
6
13
 
7
- ## Installation
14
+ <p align="center">
15
+ <a href="https://www.npmjs.com/package/@rougechain/sdk"><img src="https://img.shields.io/npm/v/@rougechain/sdk?color=00d2be&label=npm" alt="npm version" /></a>
16
+ <a href="https://www.npmjs.com/package/@rougechain/sdk"><img src="https://img.shields.io/npm/dm/@rougechain/sdk?color=00d2be" alt="npm downloads" /></a>
17
+ <a href="https://github.com/cyberdreadx/quantum-vault/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue" alt="MIT license" /></a>
18
+ <a href="https://docs.rougechain.io"><img src="https://img.shields.io/badge/docs-rougechain-00d2be" alt="docs" /></a>
19
+ </p>
20
+
21
+ ---
22
+
23
+ The official SDK for **RougeChain** — a post-quantum Layer 1 blockchain secured by **ML-DSA-65** (CRYSTALS-Dilithium). All transaction signing happens client-side with NIST-approved post-quantum cryptography. Private keys never leave your application.
24
+
25
+ Works in the **browser**, **Node.js 18+**, and **React Native**.
26
+
27
+ ## Install
8
28
 
9
29
  ```bash
10
30
  npm install @rougechain/sdk
11
31
  ```
12
32
 
13
- ## Quick Start
33
+ ## 30-Second Quickstart
14
34
 
15
35
  ```typescript
16
- import { RougeChain, Wallet } from '@rougechain/sdk';
17
-
18
- // Connect to a RougeChain node
19
- const rc = new RougeChain('https://testnet.rougechain.io/api');
36
+ import { RougeChain, Wallet } from "@rougechain/sdk";
20
37
 
21
- // Generate a new post-quantum wallet
38
+ const rc = new RougeChain("https://testnet.rougechain.io/api");
22
39
  const wallet = Wallet.generate();
23
- console.log('Public key:', wallet.publicKey);
24
40
 
25
- // Request testnet tokens
41
+ // Get testnet tokens
26
42
  await rc.faucet(wallet);
27
43
 
28
- // Check balance
29
- const balance = await rc.getBalance(wallet.publicKey);
30
- console.log('Balance:', balance);
31
-
32
- // Transfer tokens
44
+ // Send 100 XRGE
33
45
  await rc.transfer(wallet, { to: recipientPubKey, amount: 100 });
46
+
47
+ // Check balance
48
+ const { balance } = await rc.getBalance(wallet.publicKey);
34
49
  ```
35
50
 
36
- ## Core Concepts
51
+ ## Features
37
52
 
38
- ### Wallet
53
+ | Feature | Sub-client | Description |
54
+ |---------|-----------|-------------|
55
+ | **Wallet** | — | ML-DSA-65 keypair generation, import/export, client-side signing |
56
+ | **Transfers** | `rc` | Send XRGE or custom tokens, burn tokens |
57
+ | **Token Creation** | `rc` | Launch new tokens with on-chain logo support |
58
+ | **Staking** | `rc` | Stake/unstake XRGE for validation |
59
+ | **DEX** | `rc.dex` | AMM pools, swaps with slippage protection, liquidity |
60
+ | **NFTs** | `rc.nft` | RC-721 collections, mint, batch mint, royalties, freeze |
61
+ | **Bridge** | `rc.bridge` | ETH ↔ qETH, USDC ↔ qUSDC, XRGE bridge (Base Sepolia) |
62
+ | **Mail** | `rc.mail` | On-chain encrypted email (`@rouge.quant`) |
63
+ | **Messenger** | `rc.messenger` | E2E encrypted messaging with self-destruct |
39
64
 
40
- All signing happens client-side. Private keys never leave your application.
65
+ ## Wallet
41
66
 
42
67
  ```typescript
43
- import { Wallet } from '@rougechain/sdk';
68
+ import { Wallet } from "@rougechain/sdk";
44
69
 
45
- // Generate a new ML-DSA-65 keypair
70
+ // Generate a new post-quantum keypair
46
71
  const wallet = Wallet.generate();
47
72
 
48
73
  // Restore from saved keys
49
74
  const restored = Wallet.fromKeys(publicKey, privateKey);
50
75
 
51
- // Export for storage (your responsibility to store securely)
76
+ // Export for storage
52
77
  const keys = wallet.toJSON(); // { publicKey, privateKey }
53
78
 
54
79
  // Verify keypair integrity
55
- const valid = wallet.verify(); // true
80
+ wallet.verify(); // true
56
81
  ```
57
82
 
58
- ### Client
59
-
60
- The `RougeChain` client handles all API communication. Pass a wallet to any write method to sign transactions automatically.
83
+ ## Transfers & Tokens
61
84
 
62
85
  ```typescript
63
- import { RougeChain } from '@rougechain/sdk';
64
-
65
- const rc = new RougeChain('https://testnet.rougechain.io/api');
66
-
67
- // With API key (if the node requires it)
68
- const rc = new RougeChain('https://testnet.rougechain.io/api', {
69
- apiKey: 'your-api-key',
70
- });
71
-
72
- // Custom fetch (useful for Node.js < 18 or React Native)
73
- const rc = new RougeChain('https://testnet.rougechain.io/api', {
74
- fetch: customFetchFn,
75
- });
76
- ```
77
-
78
- ## API Reference
79
-
80
- ### Queries (no wallet needed)
81
-
82
- ```typescript
83
- // Node
84
- const stats = await rc.getStats();
85
- const health = await rc.getHealth();
86
-
87
- // Blocks
88
- const blocks = await rc.getBlocks({ limit: 10 });
89
- const summary = await rc.getBlocksSummary('24h');
90
-
91
- // Balance
92
- const balance = await rc.getBalance(publicKey);
93
- const tokenBal = await rc.getTokenBalance(publicKey, 'MYTOKEN');
94
-
95
- // Tokens
96
- const tokens = await rc.getTokens();
97
- const meta = await rc.getTokenMetadata('MYTOKEN');
98
- const holders = await rc.getTokenHolders('MYTOKEN');
99
-
100
- // Validators
101
- const validators = await rc.getValidators();
102
- const finality = await rc.getFinality();
103
-
104
- // Burned tokens
105
- const burned = await rc.getBurnedTokens();
106
- ```
107
-
108
- ### Transfers & Tokens
109
-
110
- ```typescript
111
- // Transfer XRGE
86
+ // Send XRGE
112
87
  await rc.transfer(wallet, { to: recipient, amount: 100 });
113
88
 
114
- // Transfer custom token
115
- await rc.transfer(wallet, { to: recipient, amount: 50, token: 'MYTOKEN' });
89
+ // Send custom token
90
+ await rc.transfer(wallet, { to: recipient, amount: 50, token: "MYTOKEN" });
116
91
 
117
- // Create a new token
92
+ // Create a new token (costs 100 XRGE)
118
93
  await rc.createToken(wallet, {
119
- name: 'My Token',
120
- symbol: 'MTK',
94
+ name: "My Token",
95
+ symbol: "MTK",
121
96
  totalSupply: 1_000_000,
97
+ image: "https://example.com/logo.png", // optional — URL or data:image/webp;base64,...
122
98
  });
123
99
 
124
- // Burn tokens
125
- await rc.burn(wallet, 500, 1, 'XRGE');
126
-
127
- // Faucet (testnet only)
128
- await rc.faucet(wallet);
129
- ```
130
-
131
- ### Staking
100
+ // Update token metadata (creator only)
101
+ await rc.updateTokenMetadata(wallet, {
102
+ symbol: "MTK",
103
+ image: "data:image/webp;base64,UklGR...", // base64 logos persist on-chain
104
+ description: "A community token",
105
+ website: "https://mytoken.io",
106
+ });
132
107
 
133
- ```typescript
134
- await rc.stake(wallet, { amount: 1000 });
135
- await rc.unstake(wallet, { amount: 500 });
108
+ // Burn tokens
109
+ await rc.burn(wallet, 500);
136
110
  ```
137
111
 
138
- ### DEX (rc.dex)
112
+ ## DEX (`rc.dex`)
139
113
 
140
114
  ```typescript
141
- // List pools
142
- const pools = await rc.dex.getPools();
143
-
144
- // Get pool details
145
- const pool = await rc.dex.getPool('XRGE-MTK');
146
-
147
- // Get swap quote
115
+ // Get a swap quote
148
116
  const quote = await rc.dex.quote({
149
- poolId: 'XRGE-MTK',
150
- tokenIn: 'XRGE',
117
+ poolId: "XRGE-MTK",
118
+ tokenIn: "XRGE",
151
119
  amountIn: 100,
152
120
  });
121
+ console.log(`You'll receive ${quote.amount_out} MTK`);
153
122
 
154
- // Execute swap
123
+ // Execute swap with slippage protection
155
124
  await rc.dex.swap(wallet, {
156
- tokenIn: 'XRGE',
157
- tokenOut: 'MTK',
125
+ tokenIn: "XRGE",
126
+ tokenOut: "MTK",
158
127
  amountIn: 100,
159
- minAmountOut: 95,
128
+ minAmountOut: quote.amount_out * 0.98, // 2% slippage
160
129
  });
161
130
 
162
- // Create pool
131
+ // Create a new liquidity pool
163
132
  await rc.dex.createPool(wallet, {
164
- tokenA: 'XRGE',
165
- tokenB: 'MTK',
166
- amountA: 10000,
167
- amountB: 5000,
133
+ tokenA: "XRGE",
134
+ tokenB: "MTK",
135
+ amountA: 10_000,
136
+ amountB: 5_000,
168
137
  });
169
138
 
170
139
  // Add / remove liquidity
171
- await rc.dex.addLiquidity(wallet, { poolId: 'XRGE-MTK', amountA: 1000, amountB: 500 });
172
- await rc.dex.removeLiquidity(wallet, { poolId: 'XRGE-MTK', lpAmount: 100 });
173
-
174
- // Pool analytics
175
- const events = await rc.dex.getPoolEvents('XRGE-MTK');
176
- const stats = await rc.dex.getPoolStats('XRGE-MTK');
140
+ await rc.dex.addLiquidity(wallet, {
141
+ poolId: "XRGE-MTK",
142
+ amountA: 1000,
143
+ amountB: 500,
144
+ });
145
+ await rc.dex.removeLiquidity(wallet, { poolId: "XRGE-MTK", lpAmount: 100 });
177
146
  ```
178
147
 
179
- ### NFTs (rc.nft)
148
+ ## NFTs (`rc.nft`)
180
149
 
181
- RougeChain implements the RC-721 NFT standard with collections, royalties, freezing, and batch minting.
150
+ RC-721 standard with collections, royalties, freezing, and batch minting.
182
151
 
183
152
  ```typescript
184
- // Create a collection
153
+ // Create a collection (5% royalty, max 10k supply)
185
154
  await rc.nft.createCollection(wallet, {
186
- symbol: 'ART',
187
- name: 'My Art Collection',
188
- royaltyBps: 500, // 5% royalty
189
- maxSupply: 10000,
190
- description: 'A post-quantum NFT collection',
155
+ symbol: "ART",
156
+ name: "My Art Collection",
157
+ royaltyBps: 500,
158
+ maxSupply: 10_000,
191
159
  });
192
160
 
193
- // Mint an NFT
161
+ // Mint
194
162
  await rc.nft.mint(wallet, {
195
- collectionId: 'abc123',
196
- name: 'Piece #1',
197
- metadataUri: 'https://example.com/nft/1.json',
198
- attributes: { rarity: 'legendary' },
163
+ collectionId: "abc123",
164
+ name: "Piece #1",
165
+ metadataUri: "https://example.com/nft/1.json",
166
+ attributes: { rarity: "legendary" },
199
167
  });
200
168
 
201
- // Batch mint (up to 50)
169
+ // Batch mint (up to 50 at once)
202
170
  await rc.nft.batchMint(wallet, {
203
- collectionId: 'abc123',
204
- names: ['#1', '#2', '#3'],
205
- uris: ['https://example.com/1.json', 'https://example.com/2.json', 'https://example.com/3.json'],
171
+ collectionId: "abc123",
172
+ names: ["#1", "#2", "#3"],
206
173
  });
207
174
 
208
- // Transfer with optional sale price (triggers royalty)
175
+ // Transfer with sale price (triggers royalty)
209
176
  await rc.nft.transfer(wallet, {
210
- collectionId: 'abc123',
177
+ collectionId: "abc123",
211
178
  tokenId: 1,
212
179
  to: buyerPubKey,
213
- salePrice: 100, // triggers royalty payment to creator
180
+ salePrice: 100,
214
181
  });
215
182
 
216
- // Burn, lock, freeze
217
- await rc.nft.burn(wallet, { collectionId: 'abc123', tokenId: 1 });
218
- await rc.nft.lock(wallet, { collectionId: 'abc123', tokenId: 2, locked: true });
219
- await rc.nft.freezeCollection(wallet, { collectionId: 'abc123', frozen: true });
220
-
221
- // Queries
222
- const collections = await rc.nft.getCollections();
223
- const collection = await rc.nft.getCollection('abc123');
224
- const tokens = await rc.nft.getTokens('abc123', { limit: 20, offset: 0 });
225
- const token = await rc.nft.getToken('abc123', 1);
183
+ // Query
226
184
  const myNfts = await rc.nft.getByOwner(wallet.publicKey);
227
185
  ```
228
186
 
229
- ### Bridge (rc.bridge)
187
+ ## Bridge (`rc.bridge`)
230
188
 
231
- Bridge between Base Sepolia ETH and RougeChain qETH.
189
+ Bridge assets between **Base Sepolia** and **RougeChain L1**. Supports ETH ↔ qETH, USDC ↔ qUSDC, and XRGE.
232
190
 
233
191
  ```typescript
234
- // Check bridge status
192
+ // Check bridge status & supported tokens
235
193
  const config = await rc.bridge.getConfig();
236
- // { enabled: true, custodyAddress: '0x...', chainId: 84532 }
194
+ // { enabled: true, supportedTokens: ["ETH", "USDC"], chainId: 84532 }
237
195
 
238
- // Withdraw qETH to receive ETH on Base Sepolia
239
- await rc.bridge.withdraw(wallet, {
240
- amount: 500000, // in qETH units
241
- evmAddress: '0xYourBaseSepoliaAddress',
196
+ // Claim qETH after depositing ETH to custody address
197
+ await rc.bridge.claim({
198
+ evmTxHash: "0x...",
199
+ evmAddress: "0x...",
200
+ evmSignature: "0x...",
201
+ recipientPubkey: wallet.publicKey,
202
+ token: "ETH",
242
203
  });
243
204
 
244
- // Claim (after depositing ETH to custody address)
205
+ // Claim qUSDC after depositing USDC
245
206
  await rc.bridge.claim({
246
- evmTxHash: '0x...',
247
- evmAddress: '0x...',
248
- evmSignature: '0x...', // personal_sign from MetaMask
207
+ evmTxHash: "0x...",
208
+ evmAddress: "0x...",
209
+ evmSignature: "0x...",
249
210
  recipientPubkey: wallet.publicKey,
211
+ token: "USDC",
212
+ });
213
+
214
+ // Withdraw qETH → receive ETH on Base Sepolia
215
+ await rc.bridge.withdraw(wallet, {
216
+ amount: 500_000,
217
+ evmAddress: "0xYourAddress",
218
+ tokenSymbol: "qETH",
219
+ });
220
+
221
+ // XRGE bridge
222
+ const xrgeConfig = await rc.bridge.getXrgeConfig();
223
+ await rc.bridge.withdrawXrge(wallet, {
224
+ amount: 1000,
225
+ evmAddress: "0xYourAddress",
226
+ });
227
+ ```
228
+
229
+ ## Mail (`rc.mail`)
230
+
231
+ On-chain encrypted email with `@rouge.quant` addresses.
232
+
233
+ ```typescript
234
+ // Send an encrypted email
235
+ await rc.mail.send({
236
+ from: wallet.publicKey,
237
+ to: recipientPubKey,
238
+ subject: "Hello",
239
+ body: "This is a test",
240
+ encrypted_subject: encryptedSubject,
241
+ encrypted_body: encryptedBody,
242
+ });
243
+
244
+ // Read inbox
245
+ const inbox = await rc.mail.getInbox(wallet.publicKey);
246
+
247
+ // Move to trash
248
+ await rc.mail.move(messageId, "trash");
249
+
250
+ // Mark as read
251
+ await rc.mail.markRead(messageId);
252
+ ```
253
+
254
+ ## Messenger (`rc.messenger`)
255
+
256
+ End-to-end encrypted messaging with media and self-destruct support.
257
+
258
+ ```typescript
259
+ // Register wallet for messaging
260
+ await rc.messenger.registerWallet(wallet.publicKey, "Alice");
261
+
262
+ // Create a conversation
263
+ const result = await rc.messenger.createConversation([
264
+ wallet.publicKey,
265
+ recipientPubKey,
266
+ ]);
267
+
268
+ // Send an encrypted message
269
+ await rc.messenger.sendMessage(conversationId, wallet.publicKey, encryptedContent, {
270
+ selfDestruct: true,
250
271
  });
251
272
 
252
- // List pending withdrawals
253
- const withdrawals = await rc.bridge.getWithdrawals();
273
+ // Read messages
274
+ const messages = await rc.messenger.getMessages(conversationId);
254
275
  ```
255
276
 
256
- ### Low-Level Signing
277
+ ## Low-Level Signing
257
278
 
258
- For advanced use cases, sign transactions manually:
279
+ For advanced use cases:
259
280
 
260
281
  ```typescript
261
- import { signTransaction, verifyTransaction, generateNonce } from '@rougechain/sdk';
282
+ import { signTransaction, verifyTransaction, generateNonce } from "@rougechain/sdk";
262
283
 
263
284
  const payload = {
264
- type: 'transfer' as const,
285
+ type: "transfer" as const,
265
286
  from: wallet.publicKey,
266
287
  to: recipient,
267
288
  amount: 100,
268
289
  fee: 1,
269
- token: 'XRGE',
290
+ token: "XRGE",
270
291
  timestamp: Date.now(),
271
292
  nonce: generateNonce(),
272
293
  };
@@ -275,60 +296,40 @@ const signedTx = signTransaction(payload, wallet.privateKey, wallet.publicKey);
275
296
  const valid = verifyTransaction(signedTx); // true
276
297
  ```
277
298
 
278
- ## Environment Setup
279
-
280
- ### Browser
281
-
282
- Works out of the box with any bundler (Vite, webpack, etc.).
283
-
284
- ### Node.js 18+
285
-
286
- Works out of the box (native `fetch` and `crypto.getRandomValues`).
287
-
288
- ### Node.js < 18
289
-
290
- Provide a fetch polyfill:
291
-
292
- ```typescript
293
- import fetch from 'node-fetch';
294
- const rc = new RougeChain('https://testnet.rougechain.io/api', { fetch });
295
- ```
296
-
297
- ### React Native
299
+ ## Environment Support
298
300
 
299
- Install a `crypto.getRandomValues` polyfill before importing the SDK:
300
-
301
- ```typescript
302
- import 'react-native-get-random-values';
303
- import { RougeChain, Wallet } from '@rougechain/sdk';
304
- ```
301
+ | Environment | Notes |
302
+ |-------------|-------|
303
+ | **Browser** | Works with any bundler (Vite, webpack, etc.) |
304
+ | **Node.js 18+** | Works out of the box |
305
+ | **Node.js < 18** | Pass a fetch polyfill: `new RougeChain(url, { fetch })` |
306
+ | **React Native** | Install `react-native-get-random-values` before importing |
305
307
 
306
308
  ## TypeScript
307
309
 
308
- The SDK is written in TypeScript and ships with full type declarations. All interfaces are exported:
310
+ Written in TypeScript with full type declarations shipped. All interfaces are exported:
309
311
 
310
312
  ```typescript
311
313
  import type {
312
- Block,
313
- Transaction,
314
- TokenMetadata,
315
- NftCollection,
316
- NftToken,
317
- LiquidityPool,
318
- BalanceResponse,
319
- Validator,
320
- BridgeConfig,
321
- WalletKeys,
322
- ApiResponse,
323
- } from '@rougechain/sdk';
314
+ Block, Transaction, TokenMetadata, NftCollection,
315
+ NftToken, LiquidityPool, BalanceResponse, Validator,
316
+ BridgeConfig, MailMessage, MessengerMessage, WalletKeys,
317
+ } from "@rougechain/sdk";
324
318
  ```
325
319
 
326
320
  ## Security
327
321
 
328
- - **Post-quantum cryptography**: All signatures use ML-DSA-65 (CRYSTALS-Dilithium), resistant to quantum attacks.
329
- - **Client-side signing**: Private keys never leave your application. Transactions are signed locally and submitted to the node pre-signed.
330
- - **No key storage**: The SDK does not store keys. Persistence is your application's responsibility.
322
+ - **Post-quantum cryptography** All signatures use ML-DSA-65 (CRYSTALS-Dilithium), resistant to quantum computer attacks
323
+ - **Client-side signing** Private keys never leave your application
324
+ - **No key storage** The SDK does not store or transmit keys
325
+
326
+ ## Links
327
+
328
+ - [Website](https://rougechain.io)
329
+ - [Documentation](https://docs.rougechain.io)
330
+ - [Chrome Extension](https://chromewebstore.google.com/detail/rougechain-wallet)
331
+ - [GitHub](https://github.com/cyberdreadx/quantum-vault)
331
332
 
332
333
  ## License
333
334
 
334
- MIT
335
+ MIT © [RougeChain](https://rougechain.io)
package/dist/index.cjs CHANGED
@@ -62,13 +62,31 @@ function buildAndSign(wallet, payload) {
62
62
  function createSignedTransfer(wallet, to, amount, fee = 1, token = "XRGE") {
63
63
  return buildAndSign(wallet, { type: "transfer", to, amount, fee, token });
64
64
  }
65
- function createSignedTokenCreation(wallet, tokenName, tokenSymbol, initialSupply, fee = 10) {
65
+ function createSignedTokenCreation(wallet, tokenName, tokenSymbol, initialSupply, fee = 10, image) {
66
66
  return buildAndSign(wallet, {
67
67
  type: "create_token",
68
68
  token_name: tokenName,
69
69
  token_symbol: tokenSymbol,
70
70
  initial_supply: initialSupply,
71
- fee
71
+ fee,
72
+ ...image ? { image } : {}
73
+ });
74
+ }
75
+ function createSignedTokenMetadataUpdate(wallet, tokenSymbol, metadata) {
76
+ return buildAndSign(wallet, {
77
+ type: "update_token_metadata",
78
+ token_symbol: tokenSymbol,
79
+ ...metadata.image !== void 0 ? { image: metadata.image } : {},
80
+ ...metadata.description !== void 0 ? { description: metadata.description } : {},
81
+ ...metadata.website !== void 0 ? { website: metadata.website } : {},
82
+ ...metadata.twitter !== void 0 ? { twitter: metadata.twitter } : {},
83
+ ...metadata.discord !== void 0 ? { discord: metadata.discord } : {}
84
+ });
85
+ }
86
+ function createSignedTokenMetadataClaim(wallet, tokenSymbol) {
87
+ return buildAndSign(wallet, {
88
+ type: "claim_token_metadata",
89
+ token_symbol: tokenSymbol
72
90
  });
73
91
  }
74
92
  function createSignedSwap(wallet, tokenIn, tokenOut, amountIn, minAmountOut) {
@@ -348,7 +366,8 @@ var RougeChain = class {
348
366
  params.name,
349
367
  params.symbol,
350
368
  params.totalSupply,
351
- params.fee
369
+ params.fee,
370
+ params.image
352
371
  );
353
372
  return this.submitTx("/v2/token/create", tx);
354
373
  }
@@ -369,24 +388,18 @@ var RougeChain = class {
369
388
  return this.submitTx("/v2/transfer", tx);
370
389
  }
371
390
  async updateTokenMetadata(wallet, params) {
372
- try {
373
- const data = await this.post("/token/metadata/update", {
374
- token_symbol: params.symbol,
375
- from_public_key: wallet.publicKey,
376
- from_private_key: wallet.privateKey,
377
- image: params.image,
378
- description: params.description,
379
- website: params.website,
380
- twitter: params.twitter,
381
- discord: params.discord
382
- });
383
- return data;
384
- } catch (e) {
385
- return {
386
- success: false,
387
- error: e instanceof Error ? e.message : String(e)
388
- };
389
- }
391
+ const tx = createSignedTokenMetadataUpdate(wallet, params.symbol, {
392
+ image: params.image,
393
+ description: params.description,
394
+ website: params.website,
395
+ twitter: params.twitter,
396
+ discord: params.discord
397
+ });
398
+ return this.submitTx("/v2/token/metadata/update", tx);
399
+ }
400
+ async claimTokenMetadata(wallet, tokenSymbol) {
401
+ const tx = createSignedTokenMetadataClaim(wallet, tokenSymbol);
402
+ return this.submitTx("/v2/token/metadata/claim", tx);
390
403
  }
391
404
  };
392
405
  var NftClient = class {
@@ -885,6 +898,8 @@ exports.RougeChain = RougeChain;
885
898
  exports.Wallet = Wallet;
886
899
  exports.bytesToHex = bytesToHex;
887
900
  exports.createSignedBridgeWithdraw = createSignedBridgeWithdraw;
901
+ exports.createSignedTokenMetadataClaim = createSignedTokenMetadataClaim;
902
+ exports.createSignedTokenMetadataUpdate = createSignedTokenMetadataUpdate;
888
903
  exports.generateNonce = generateNonce;
889
904
  exports.hexToBytes = hexToBytes;
890
905
  exports.isBurnAddress = isBurnAddress;