@omnity/ree-client-ts-sdk 0.4.1 → 0.4.3

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
@@ -70,9 +70,14 @@ const poolInfo = await client.getPoolInfo("pool-address");
70
70
  const transaction = await client.createTransaction({
71
71
  address: "bc1p...", // Bitcoin address for runes
72
72
  paymentAddress: "bc1q...", // Payment address for BTC
73
- // feeRate: BigInt(25), // Optional manual fee rate in sat/vbyte
73
+ // feeRate: 25, // Optional manual fee rate in sat/vbyte
74
+ // mergeSelfRuneBtcOutputs: true, // Optional: reuse BTC output when your rune address also receives sats
74
75
  });
75
76
 
77
+ // By default, runes delivered back to your own rune address are kept on a separate
78
+ // dust output to avoid mixing with BTC change. Set `mergeSelfRuneBtcOutputs` to true
79
+ // if you prefer to consolidate the runes and sats into the same output.
80
+
76
81
  // Add a single intention (e.g., swap BTC for runes)
77
82
  transaction.addIntention({
78
83
  poolAddress: "bc1p...",
@@ -112,7 +117,7 @@ const result = await transaction.send(signedPsbt.toHex());
112
117
  const transaction = await client.createTransaction({
113
118
  address: "bc1p...",
114
119
  paymentAddress: "bc1q...",
115
- // feeRate: BigInt(25),
120
+ // feeRate: 25,
116
121
  });
117
122
 
118
123
  // Add multiple intentions in a single transaction
@@ -196,7 +201,7 @@ function WalletComponent() {
196
201
  const executeComplexTransaction = async () => {
197
202
  // Create transaction with multiple pools
198
203
  const tx = await createTransaction({
199
- // feeRate: BigInt(25), // Optional manual fee rate override
204
+ feeRate: 25, // Optional manual fee rate override
200
205
  });
201
206
 
202
207
  // Add multiple intentions
@@ -375,7 +380,7 @@ new ReeClient(config: Config)
375
380
 
376
381
  ##### Transaction Methods
377
382
 
378
- - `createTransaction(params?: { feeRate?: bigint }): Promise<Transaction>` - Create a transaction with optional manual fee rate
383
+ - `createTransaction(params?: { feeRate?: number }): Promise<Transaction>` - Create a transaction with optional manual fee rate
379
384
 
380
385
  ### Transaction
381
386
 
@@ -454,6 +459,7 @@ import {
454
459
  useRuneInfo,
455
460
  usePoolList,
456
461
  usePoolInfo,
462
+ useRecommendedFeeRate,
457
463
  } from "@ree-network/ts-sdk";
458
464
 
459
465
  function TradingDashboard() {
@@ -462,6 +468,11 @@ function TradingDashboard() {
462
468
  const { balance: runeBalance } = useRuneBalance("840000:3");
463
469
  const { utxos: btcUtxos } = useBtcUtxos();
464
470
  const { utxos: runeUtxos } = useRuneUtxos("840000:3");
471
+ const {
472
+ feeRate,
473
+ loading: feeRateLoading,
474
+ refetch: refreshFeeRate,
475
+ } = useRecommendedFeeRate();
465
476
 
466
477
  const [runes, setRunes] = useState([]);
467
478
 
@@ -482,6 +493,12 @@ function TradingDashboard() {
482
493
  <h2>Balances</h2>
483
494
  <div>BTC: {btcBalance} BTC</div>
484
495
  <div>Rune: {runeBalance}</div>
496
+ <div>
497
+ Recommended Fee Rate:{" "}
498
+ {feeRateLoading
499
+ ? "Loading..."
500
+ : `${feeRate?.min?.toString()} - ${feeRate?.max?.toString()} sat/vB`}
501
+ </div>
485
502
 
486
503
  <h2>Search Runes</h2>
487
504
  <button onClick={handleSearch}>Search DOG</button>
@@ -513,6 +530,10 @@ function TradingDashboard() {
513
530
  - `usePoolList(options?)` - Get all available pools
514
531
  - `usePoolInfo(poolAddress?, options?)` - Get specific pool information
515
532
 
533
+ **Fee Rate Hooks:**
534
+
535
+ - `useRecommendedFeeRate(options?)` - Retrieve recommended fee rate range
536
+
516
537
  #### Hook Usage Examples
517
538
 
518
539
  ```tsx
package/dist/index.d.ts CHANGED
@@ -295,11 +295,16 @@ export declare class ReeClient {
295
295
  * @param params.involvedRuneId - Optional rune ID for rune swaps
296
296
  * @returns Transaction instance
297
297
  */
298
- createTransaction({ address, paymentAddress, feeRate, }: {
298
+ createTransaction({ address, paymentAddress, feeRate, mergeSelfRuneBtcOutputs, }: {
299
299
  address: string;
300
300
  paymentAddress: string;
301
301
  feeRate?: number;
302
+ mergeSelfRuneBtcOutputs?: boolean;
302
303
  }): Promise<Transaction>;
304
+ getRecommendedFeeRate(): Promise<{
305
+ min: number;
306
+ max: number;
307
+ }>;
303
308
  }
304
309
 
305
310
  declare interface ReeContextValue {
@@ -530,6 +535,11 @@ export declare interface TransactionConfig {
530
535
  paymentAddress: string;
531
536
  /** Optional manual fee rate in satoshis per virtual byte */
532
537
  feeRate?: number;
538
+ /**
539
+ * When true, rune outputs to the local rune address reuse existing BTC value
540
+ * instead of emitting a separate dust output. Defaults to false.
541
+ */
542
+ mergeSelfRuneBtcOutputs?: boolean;
533
543
  }
534
544
 
535
545
  declare interface UseBalanceOptions {
@@ -584,6 +594,20 @@ export declare function usePoolList(): {
584
594
  refetch: () => Promise<void>;
585
595
  };
586
596
 
597
+ /**
598
+ * Hook to retrieve the recommended fee rate range
599
+ * @returns Object with minimum/maximum fee rates, loading state, error, and refetch function
600
+ */
601
+ export declare function useRecommendedFeeRate(options?: UseBalanceOptions): {
602
+ feeRate: {
603
+ min: number;
604
+ max: number;
605
+ } | null;
606
+ loading: boolean;
607
+ error: string | null;
608
+ refetch: () => Promise<void>;
609
+ };
610
+
587
611
  export declare function useRee(): ReeContextValue;
588
612
 
589
613
  /**