@omnity/ree-client-ts-sdk 0.2.7 → 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/dist/index.d.ts CHANGED
@@ -53,9 +53,14 @@ declare function getScriptByAddress(address: string, network?: Network): Uint8Ar
53
53
 
54
54
  declare function hexToBytes(hex: string): Uint8Array;
55
55
 
56
+ declare type InputCoin = {
57
+ coin: CoinBalance;
58
+ from: string;
59
+ };
60
+
56
61
  export declare type Intention = {
57
- inputCoins: CoinBalance[];
58
- outputCoins: CoinBalance[];
62
+ inputCoins: InputCoin[];
63
+ outputCoins: OutputCoin[];
59
64
  action: string;
60
65
  actionParams?: string;
61
66
  poolAddress: string;
@@ -109,6 +114,11 @@ export declare const Network: {
109
114
 
110
115
  export declare type Network = (typeof Network)[keyof typeof Network];
111
116
 
117
+ declare type OutputCoin = {
118
+ coin: CoinBalance;
119
+ to: string;
120
+ };
121
+
112
122
  export declare type Pool = {
113
123
  name: string;
114
124
  address: string;
@@ -259,11 +269,9 @@ export declare class ReeClient {
259
269
  * @param params.involvedRuneId - Optional rune ID for rune swaps
260
270
  * @returns Transaction instance
261
271
  */
262
- createTransaction({ address, paymentAddress, involvedRuneIds, involvedPoolAddresses, }: {
272
+ createTransaction({ address, paymentAddress, }: {
263
273
  address: string;
264
274
  paymentAddress: string;
265
- involvedRuneIds?: string[];
266
- involvedPoolAddresses: string[];
267
275
  }): Promise<Transaction>;
268
276
  }
269
277
 
@@ -316,7 +324,12 @@ export declare class Transaction {
316
324
  private txFee;
317
325
  private additionalDustNeeded;
318
326
  private inputUtxos;
319
- constructor(config: TransactionConfig, orchestrator: ActorSubclass);
327
+ private getBtcUtxos;
328
+ private getRuneUtxos;
329
+ constructor(config: TransactionConfig, orchestrator: ActorSubclass, utxoFetchers: {
330
+ btc: (address: string) => Promise<Utxo[]>;
331
+ rune: (address: string, runeId: string) => Promise<Utxo[]>;
332
+ });
320
333
  /**
321
334
  * Add a UTXO as transaction input
322
335
  * @param utxo - The UTXO to add as input
@@ -357,18 +370,9 @@ export declare class Transaction {
357
370
  * @returns Fee calculation result
358
371
  */
359
372
  private addBtcAndFees;
360
- /**
361
- * Process all intentions and calculate input/output amounts for the transaction
362
- * This method handles multiple intentions in a single transaction, calculating:
363
- * - Pool UTXOs to be consumed as inputs
364
- * - User rune UTXOs needed for input coins
365
- * - Final BTC and rune amounts for all parties (user and pools)
366
- *
367
- * @returns Object containing calculated amounts for transaction outputs
368
- * @throws Error if pools have insufficient funds for the requested operations
369
- */
370
- private addInputAndCalculateOutputs;
371
- private addRuneOutputs;
373
+ private getInvolvedAddressUtxos;
374
+ private addInputsAndCalculateOutputs;
375
+ private addOutputs;
372
376
  /**
373
377
  * Add an intention to the transaction
374
378
  * Multiple intentions can be added to create complex, atomic transactions
@@ -435,9 +439,6 @@ export declare interface TransactionConfig {
435
439
  exchangeId: string;
436
440
  address: string;
437
441
  paymentAddress: string;
438
- btcUtxos: Utxo[];
439
- involvedPoolUtxos: Record<string, Utxo[]>;
440
- involvedRuneUtxos?: Record<string, Utxo[]>;
441
442
  }
442
443
 
443
444
  declare interface UseBalanceOptions {