dxs-stas-sdk 1.0.8 → 1.0.9

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dxs-stas-sdk",
3
- "version": "1.0.8",
3
+ "version": "1.0.9",
4
4
  "description": "BSV Stas",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -23,7 +23,7 @@ export type TGetFundingUtxoFunction = (request?: {
23
23
  utxoIdsToSend: string[];
24
24
  estimatedFeeSatoshis: number;
25
25
  transactionsCount: number;
26
- }) => Promise<OutPoint[]>;
26
+ }) => Promise<OutPoint>;
27
27
  export type TGetTransactionsFunction = (
28
28
  ids: string[]
29
29
  ) => Promise<Record<string, Transaction>>;
@@ -39,7 +39,7 @@ export class StasBundleFactory {
39
39
  private readonly tokenScheme: TokenScheme,
40
40
  private readonly stasWallet: Wallet,
41
41
  private readonly feeWallet: Wallet,
42
- private readonly getFeeUtxoSet: TGetFundingUtxoFunction,
42
+ private readonly getFundingUtxo: TGetFundingUtxoFunction,
43
43
  private readonly getStasUtxoSet: TGetUtxoFunction,
44
44
  private readonly getTransactions: TGetTransactionsFunction
45
45
  ) {}
@@ -89,34 +89,27 @@ export class StasBundleFactory {
89
89
 
90
90
  // estimatedFee =
91
91
  // estimatedFee + stasUtxos.length * 9 + 1; /* Fee for fee transactio */
92
- const feeUtxoSet = await this.getFeeUtxoSet({
92
+ const fudingUtxo = await this.getFundingUtxo({
93
93
  utxoIdsToSend: stasUtxos.map((x) => `${x.TxId}:${x.Vout}`),
94
94
  estimatedFeeSatoshis: estimatedFee,
95
95
  transactionsCount,
96
96
  });
97
- const feeSatoshis = feeUtxoSet.reduce((a, x) => a + x.Satoshis, 0);
98
97
 
99
- if (estimatedFee > feeSatoshis) {
100
- return {
101
- message: "Insufficient balance to pay fee",
102
- devMessage: `Insufficient balance to pay fee. Estimated: ${estimatedFee}; balance: ${feeSatoshis}`,
103
- feeSatoshis: 0,
104
- };
105
- }
98
+ // if (estimatedFee > feeSatoshis) {
99
+ // return {
100
+ // message: "Insufficient balance to pay fee",
101
+ // devMessage: `Insufficient balance to pay fee. Estimated: ${estimatedFee}; balance: ${feeSatoshis}`,
102
+ // feeSatoshis: 0,
103
+ // };
104
+ // }
106
105
 
107
106
  const transactions: string[] = [];
108
- const { feeTransaction, feeUtxo } = this.buildFeeTransaction(
109
- feeUtxoSet,
110
- estimatedFee
111
- );
112
-
113
- if (feeTransaction) transactions.push(feeTransaction);
114
107
 
115
108
  return await this._createBundle(
116
109
  transactions,
117
110
  stasUtxos,
118
111
  satoshisToSend,
119
- feeUtxo,
112
+ fudingUtxo,
120
113
  to,
121
114
  note
122
115
  );