emblem-vault-sdk 1.9.2 → 1.9.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/dist/bundle.js CHANGED
@@ -709476,7 +709476,7 @@ const bignumber_1 = require("@ethersproject/bignumber");
709476
709476
  const utils_1 = require("./utils");
709477
709477
  const sats_connect_1 = require("sats-connect");
709478
709478
  const derive_1 = require("./derive");
709479
- const SDK_VERSION = '1.9.2';
709479
+ const SDK_VERSION = '1.9.3';
709480
709480
  class EmblemVaultSDK {
709481
709481
  constructor(apiKey, baseUrl) {
709482
709482
  this.apiKey = apiKey;
@@ -709934,9 +709934,8 @@ class EmblemVaultSDK {
709934
709934
  });
709935
709935
  });
709936
709936
  }
709937
- generatePSBT(phrase) {
709937
+ generatePSBT(phrase, satsPerByte = 20) {
709938
709938
  return __awaiter(this, void 0, void 0, function* () {
709939
- const desiredFeeRate = 2; // sats per byte -> mainnet will be much higher
709940
709939
  const { paymentAddress, paymentPublicKey, ordinalsAddress } = yield this.getSatsConnectAddress();
709941
709940
  // change this to mainnet
709942
709941
  if (window.bitcoin) {
@@ -709993,18 +709992,18 @@ class EmblemVaultSDK {
709993
709992
  });
709994
709993
  totalFeeInput += utxo.value;
709995
709994
  size = (0, derive_1.getPsbtTxnSize)(phrase, psbt.toBase64());
709996
- if (totalFeeInput >= desiredFeeRate * size) {
709995
+ if (totalFeeInput >= satsPerByte * size) {
709997
709996
  break;
709998
709997
  }
709999
709998
  }
710000
- if (totalFeeInput < desiredFeeRate * size) {
709999
+ if (totalFeeInput < satsPerByte * size) {
710001
710000
  throw new Error("Insufficient funds at desired fee rate");
710002
710001
  }
710003
710002
  // maybe add output for change if change is greater than 1000 sats (dust)
710004
- if (desiredFeeRate * size > 1000) {
710003
+ if (satsPerByte * size > 1000) {
710005
710004
  psbt.addOutput({
710006
710005
  address: paymentAddress,
710007
- value: totalFeeInput - Math.ceil(desiredFeeRate * size),
710006
+ value: totalFeeInput - Math.ceil(satsPerByte * size),
710008
710007
  });
710009
710008
  }
710010
710009
  // sign
package/dist/index.js CHANGED
@@ -36,7 +36,7 @@ const bignumber_1 = require("@ethersproject/bignumber");
36
36
  const utils_1 = require("./utils");
37
37
  const sats_connect_1 = require("sats-connect");
38
38
  const derive_1 = require("./derive");
39
- const SDK_VERSION = '1.9.2';
39
+ const SDK_VERSION = '1.9.3';
40
40
  class EmblemVaultSDK {
41
41
  constructor(apiKey, baseUrl) {
42
42
  this.apiKey = apiKey;
@@ -494,9 +494,8 @@ class EmblemVaultSDK {
494
494
  });
495
495
  });
496
496
  }
497
- generatePSBT(phrase) {
497
+ generatePSBT(phrase, satsPerByte = 20) {
498
498
  return __awaiter(this, void 0, void 0, function* () {
499
- const desiredFeeRate = 2; // sats per byte -> mainnet will be much higher
500
499
  const { paymentAddress, paymentPublicKey, ordinalsAddress } = yield this.getSatsConnectAddress();
501
500
  // change this to mainnet
502
501
  if (window.bitcoin) {
@@ -553,18 +552,18 @@ class EmblemVaultSDK {
553
552
  });
554
553
  totalFeeInput += utxo.value;
555
554
  size = (0, derive_1.getPsbtTxnSize)(phrase, psbt.toBase64());
556
- if (totalFeeInput >= desiredFeeRate * size) {
555
+ if (totalFeeInput >= satsPerByte * size) {
557
556
  break;
558
557
  }
559
558
  }
560
- if (totalFeeInput < desiredFeeRate * size) {
559
+ if (totalFeeInput < satsPerByte * size) {
561
560
  throw new Error("Insufficient funds at desired fee rate");
562
561
  }
563
562
  // maybe add output for change if change is greater than 1000 sats (dust)
564
- if (desiredFeeRate * size > 1000) {
563
+ if (satsPerByte * size > 1000) {
565
564
  psbt.addOutput({
566
565
  address: paymentAddress,
567
- value: totalFeeInput - Math.ceil(desiredFeeRate * size),
566
+ value: totalFeeInput - Math.ceil(satsPerByte * size),
568
567
  });
569
568
  }
570
569
  // sign
package/docs/bundle.js CHANGED
@@ -709476,7 +709476,7 @@ const bignumber_1 = require("@ethersproject/bignumber");
709476
709476
  const utils_1 = require("./utils");
709477
709477
  const sats_connect_1 = require("sats-connect");
709478
709478
  const derive_1 = require("./derive");
709479
- const SDK_VERSION = '1.9.2';
709479
+ const SDK_VERSION = '1.9.3';
709480
709480
  class EmblemVaultSDK {
709481
709481
  constructor(apiKey, baseUrl) {
709482
709482
  this.apiKey = apiKey;
@@ -709934,9 +709934,8 @@ class EmblemVaultSDK {
709934
709934
  });
709935
709935
  });
709936
709936
  }
709937
- generatePSBT(phrase) {
709937
+ generatePSBT(phrase, satsPerByte = 20) {
709938
709938
  return __awaiter(this, void 0, void 0, function* () {
709939
- const desiredFeeRate = 2; // sats per byte -> mainnet will be much higher
709940
709939
  const { paymentAddress, paymentPublicKey, ordinalsAddress } = yield this.getSatsConnectAddress();
709941
709940
  // change this to mainnet
709942
709941
  if (window.bitcoin) {
@@ -709993,18 +709992,18 @@ class EmblemVaultSDK {
709993
709992
  });
709994
709993
  totalFeeInput += utxo.value;
709995
709994
  size = (0, derive_1.getPsbtTxnSize)(phrase, psbt.toBase64());
709996
- if (totalFeeInput >= desiredFeeRate * size) {
709995
+ if (totalFeeInput >= satsPerByte * size) {
709997
709996
  break;
709998
709997
  }
709999
709998
  }
710000
- if (totalFeeInput < desiredFeeRate * size) {
709999
+ if (totalFeeInput < satsPerByte * size) {
710001
710000
  throw new Error("Insufficient funds at desired fee rate");
710002
710001
  }
710003
710002
  // maybe add output for change if change is greater than 1000 sats (dust)
710004
- if (desiredFeeRate * size > 1000) {
710003
+ if (satsPerByte * size > 1000) {
710005
710004
  psbt.addOutput({
710006
710005
  address: paymentAddress,
710007
- value: totalFeeInput - Math.ceil(desiredFeeRate * size),
710006
+ value: totalFeeInput - Math.ceil(satsPerByte * size),
710008
710007
  });
710009
710008
  }
710010
710009
  // sign
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "emblem-vault-sdk",
3
- "version": "1.9.2",
3
+ "version": "1.9.3",
4
4
  "description": "Emblem Vault Software Development Kit",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
package/src/index.ts CHANGED
@@ -404,9 +404,7 @@ class EmblemVaultSDK {
404
404
  });
405
405
  }
406
406
 
407
- async generatePSBT(phrase: string) {
408
-
409
- const desiredFeeRate = 2; // sats per byte -> mainnet will be much higher
407
+ async generatePSBT(phrase: string, satsPerByte: number = 20) {
410
408
 
411
409
  const { paymentAddress, paymentPublicKey, ordinalsAddress } = await this.getSatsConnectAddress();
412
410
 
@@ -481,20 +479,20 @@ class EmblemVaultSDK {
481
479
 
482
480
  size = getPsbtTxnSize(phrase, psbt.toBase64());
483
481
 
484
- if (totalFeeInput >= desiredFeeRate * size) {
482
+ if (totalFeeInput >= satsPerByte * size) {
485
483
  break;
486
484
  }
487
485
  }
488
486
 
489
- if (totalFeeInput < desiredFeeRate * size) {
487
+ if (totalFeeInput < satsPerByte * size) {
490
488
  throw new Error("Insufficient funds at desired fee rate");
491
489
  }
492
490
 
493
491
  // maybe add output for change if change is greater than 1000 sats (dust)
494
- if (desiredFeeRate * size > 1000) {
492
+ if (satsPerByte * size > 1000) {
495
493
  psbt.addOutput({
496
494
  address: paymentAddress,
497
- value: totalFeeInput - Math.ceil(desiredFeeRate * size),
495
+ value: totalFeeInput - Math.ceil(satsPerByte * size),
498
496
  });
499
497
  }
500
498
 
package/types/index.d.ts CHANGED
@@ -46,7 +46,7 @@ declare class EmblemVaultSDK {
46
46
  legacyBalanceFromContractByAddress(web3: any, address: string): Promise<number[]>;
47
47
  refreshLegacyOwnership(web3: any, address: string): Promise<void>;
48
48
  getSatsConnectAddress(): Promise<SatsConnectAddress>;
49
- generatePSBT(phrase: string): Promise<void>;
49
+ generatePSBT(phrase: string, satsPerByte?: number): Promise<void>;
50
50
  getTaprootAddressFromMnemonic(phrase: string): Promise<{
51
51
  p2tr: any;
52
52
  tweakedSigner: import("bip32/types/bip32").Signer;