@rsksmart/powpeg-sdk 1.2.0-beta.5 → 1.2.0-beta.6

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.js CHANGED
@@ -249,20 +249,20 @@ var InvalidFeeRateError = class extends Error {
249
249
  // src/api/api.ts
250
250
  var import_bridges_core_sdk3 = require("@rsksmart/bridges-core-sdk");
251
251
  var ApiService = class {
252
+ constructor(network, apiUrl, maxFeeRateSatPerByte = 1e3) {
253
+ this.maxFeeRateSatPerByte = maxFeeRateSatPerByte;
254
+ this.api = import_axios.default.create({ baseURL: apiUrl ?? this.apiUrls[network] });
255
+ }
252
256
  apiUrls = {
253
257
  MAIN: "https://api.2wp.rootstock.io",
254
258
  TEST: "https://api.2wp.testnet.rootstock.io"
255
259
  };
256
- maxFeeRateSatPerByte = 1e3;
257
260
  feeLevelBlocks = {
258
261
  slow: 5,
259
262
  average: 3,
260
263
  fast: 1
261
264
  };
262
265
  api;
263
- constructor(network, apiUrl) {
264
- this.api = import_axios.default.create({ baseURL: apiUrl ?? this.apiUrls[network] });
265
- }
266
266
  handleError(error) {
267
267
  if (import_axios.default.isAxiosError(error)) {
268
268
  if (error.response) {
@@ -362,7 +362,7 @@ var PowPegSDK = class {
362
362
  this.btcNetworkConfig = networks[network];
363
363
  this.rskProvider = new import_bridges_core_sdk4.ethers.providers.JsonRpcProvider(rpcProviderUrl ?? this.publicNodes[network]);
364
364
  this.bridge = new Bridge(this.rskProvider);
365
- this.api = new ApiService(network, apiUrl);
365
+ this.api = new ApiService(network, apiUrl, maxFeeRateSatPerByte);
366
366
  }
367
367
  txHeaderSizeInBytes = 13;
368
368
  txOutputSizeInBytes = 32;
@@ -619,6 +619,7 @@ var PowPegSDK = class {
619
619
  const initialInputCount = psbt.txInputs.length;
620
620
  const initialOutputCount = psbt.txOutputs.length;
621
621
  const addChange = change > Math.min(this.burnDustValue, this.burnDustMaxValue);
622
+ this.funding.delete(psbt);
622
623
  if (addChange) {
623
624
  psbt.addOutput({
624
625
  // Fall back to the first funding input's address when every derived
@@ -644,7 +645,6 @@ var PowPegSDK = class {
644
645
  psbt.txInputs.length === expectedInputCount && psbt.txOutputs.length === expectedOutputCount,
645
646
  `Funded PSBT structure mismatch: expected ${expectedInputCount} inputs and ${expectedOutputCount} outputs, got ${psbt.txInputs.length} and ${psbt.txOutputs.length}.`
646
647
  );
647
- this.funding.delete(psbt);
648
648
  return { psbt, inputs, transactions: hexTransactions, fee: totalFee };
649
649
  }
650
650
  /**
package/dist/index.mjs CHANGED
@@ -201,20 +201,20 @@ var InvalidFeeRateError = class extends Error {
201
201
  // src/api/api.ts
202
202
  import { ethers as ethers2 } from "@rsksmart/bridges-core-sdk";
203
203
  var ApiService = class {
204
+ constructor(network, apiUrl, maxFeeRateSatPerByte = 1e3) {
205
+ this.maxFeeRateSatPerByte = maxFeeRateSatPerByte;
206
+ this.api = axios.create({ baseURL: apiUrl ?? this.apiUrls[network] });
207
+ }
204
208
  apiUrls = {
205
209
  MAIN: "https://api.2wp.rootstock.io",
206
210
  TEST: "https://api.2wp.testnet.rootstock.io"
207
211
  };
208
- maxFeeRateSatPerByte = 1e3;
209
212
  feeLevelBlocks = {
210
213
  slow: 5,
211
214
  average: 3,
212
215
  fast: 1
213
216
  };
214
217
  api;
215
- constructor(network, apiUrl) {
216
- this.api = axios.create({ baseURL: apiUrl ?? this.apiUrls[network] });
217
- }
218
218
  handleError(error) {
219
219
  if (axios.isAxiosError(error)) {
220
220
  if (error.response) {
@@ -314,7 +314,7 @@ var PowPegSDK = class {
314
314
  this.btcNetworkConfig = networks[network];
315
315
  this.rskProvider = new ethers3.providers.JsonRpcProvider(rpcProviderUrl ?? this.publicNodes[network]);
316
316
  this.bridge = new Bridge(this.rskProvider);
317
- this.api = new ApiService(network, apiUrl);
317
+ this.api = new ApiService(network, apiUrl, maxFeeRateSatPerByte);
318
318
  }
319
319
  txHeaderSizeInBytes = 13;
320
320
  txOutputSizeInBytes = 32;
@@ -571,6 +571,7 @@ var PowPegSDK = class {
571
571
  const initialInputCount = psbt.txInputs.length;
572
572
  const initialOutputCount = psbt.txOutputs.length;
573
573
  const addChange = change > Math.min(this.burnDustValue, this.burnDustMaxValue);
574
+ this.funding.delete(psbt);
574
575
  if (addChange) {
575
576
  psbt.addOutput({
576
577
  // Fall back to the first funding input's address when every derived
@@ -596,7 +597,6 @@ var PowPegSDK = class {
596
597
  psbt.txInputs.length === expectedInputCount && psbt.txOutputs.length === expectedOutputCount,
597
598
  `Funded PSBT structure mismatch: expected ${expectedInputCount} inputs and ${expectedOutputCount} outputs, got ${psbt.txInputs.length} and ${psbt.txOutputs.length}.`
598
599
  );
599
- this.funding.delete(psbt);
600
600
  return { psbt, inputs, transactions: hexTransactions, fee: totalFee };
601
601
  }
602
602
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rsksmart/powpeg-sdk",
3
- "version": "1.2.0-beta.5",
3
+ "version": "1.2.0-beta.6",
4
4
  "description": "SDK for creating native peg-in and peg-out transactions following the PowPeg protocol.",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",