@omnity/ree-client-ts-sdk 0.4.2 → 0.4.4
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 +21 -0
- package/dist/index.d.ts +26 -1
- package/dist/ree-sdk.cjs.js +55 -55
- package/dist/ree-sdk.es.js +3163 -3026
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -71,8 +71,13 @@ const transaction = await client.createTransaction({
|
|
|
71
71
|
address: "bc1p...", // Bitcoin address for runes
|
|
72
72
|
paymentAddress: "bc1q...", // Payment address for BTC
|
|
73
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...",
|
|
@@ -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 {
|
|
@@ -528,8 +533,14 @@ export declare interface TransactionConfig {
|
|
|
528
533
|
exchangeId: string;
|
|
529
534
|
address: string;
|
|
530
535
|
paymentAddress: string;
|
|
536
|
+
clientInfo?: string;
|
|
531
537
|
/** Optional manual fee rate in satoshis per virtual byte */
|
|
532
538
|
feeRate?: number;
|
|
539
|
+
/**
|
|
540
|
+
* When true, rune outputs to the local rune address reuse existing BTC value
|
|
541
|
+
* instead of emitting a separate dust output. Defaults to false.
|
|
542
|
+
*/
|
|
543
|
+
mergeSelfRuneBtcOutputs?: boolean;
|
|
533
544
|
}
|
|
534
545
|
|
|
535
546
|
declare interface UseBalanceOptions {
|
|
@@ -584,6 +595,20 @@ export declare function usePoolList(): {
|
|
|
584
595
|
refetch: () => Promise<void>;
|
|
585
596
|
};
|
|
586
597
|
|
|
598
|
+
/**
|
|
599
|
+
* Hook to retrieve the recommended fee rate range
|
|
600
|
+
* @returns Object with minimum/maximum fee rates, loading state, error, and refetch function
|
|
601
|
+
*/
|
|
602
|
+
export declare function useRecommendedFeeRate(options?: UseBalanceOptions): {
|
|
603
|
+
feeRate: {
|
|
604
|
+
min: number;
|
|
605
|
+
max: number;
|
|
606
|
+
} | null;
|
|
607
|
+
loading: boolean;
|
|
608
|
+
error: string | null;
|
|
609
|
+
refetch: () => Promise<void>;
|
|
610
|
+
};
|
|
611
|
+
|
|
587
612
|
export declare function useRee(): ReeContextValue;
|
|
588
613
|
|
|
589
614
|
/**
|