@omnity/ree-client-ts-sdk 0.4.2 → 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 +21 -0
- package/dist/index.d.ts +25 -1
- package/dist/ree-sdk.cjs.js +55 -55
- package/dist/ree-sdk.es.js +3161 -3025
- 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 {
|
|
@@ -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
|
/**
|