@btc-vision/transaction 1.7.28 → 1.7.30

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.
Files changed (134) hide show
  1. package/browser/_version.d.ts +1 -1
  2. package/browser/btc-vision-bitcoin.js +1610 -1609
  3. package/browser/consensus/ConsensusConfig.d.ts +1 -5
  4. package/browser/consensus/IConsensusConfig.d.ts +6 -0
  5. package/browser/consensus/metadata/RoswellConsensus.d.ts +1 -1
  6. package/browser/epoch/interfaces/IChallengeSolution.d.ts +15 -1
  7. package/browser/generators/builders/CalldataGenerator.d.ts +2 -2
  8. package/browser/generators/builders/DeploymentGenerator.d.ts +2 -2
  9. package/browser/generators/builders/P2WDAGenerator.d.ts +2 -2
  10. package/browser/index.js +876 -1055
  11. package/browser/opnet.d.ts +10 -3
  12. package/browser/signer/AddressRotation.d.ts +2 -3
  13. package/browser/signer/IRotationSigner.d.ts +8 -0
  14. package/browser/transaction/TransactionFactory.d.ts +4 -27
  15. package/browser/transaction/browser/WalletNetworks.d.ts +14 -0
  16. package/browser/transaction/browser/Web3Provider.d.ts +2 -25
  17. package/browser/transaction/browser/extensions/UnisatSigner.d.ts +2 -1
  18. package/browser/transaction/browser/types/Unisat.d.ts +5 -18
  19. package/browser/transaction/builders/CancelTransaction.d.ts +1 -4
  20. package/browser/transaction/builders/ConsolidatedInteractionTransaction.d.ts +3 -3
  21. package/browser/transaction/builders/CustomScriptTransaction.d.ts +2 -8
  22. package/browser/transaction/builders/DeploymentTransaction.d.ts +3 -3
  23. package/browser/transaction/builders/InteractionTransactionP2WDA.d.ts +2 -2
  24. package/browser/transaction/builders/SharedInteractionTransaction.d.ts +3 -3
  25. package/browser/transaction/interfaces/ICancelTransactionParameters.d.ts +4 -0
  26. package/browser/transaction/interfaces/ICustomTransactionParameters.d.ts +8 -0
  27. package/browser/transaction/interfaces/ITransactionParameters.d.ts +6 -6
  28. package/browser/transaction/interfaces/ITransactionResponses.d.ts +26 -0
  29. package/browser/transaction/interfaces/ITweakedTransactionData.d.ts +17 -0
  30. package/browser/transaction/interfaces/IWeb3ProviderTypes.d.ts +24 -0
  31. package/browser/transaction/shared/TweakedTransaction.d.ts +2 -14
  32. package/browser/transaction/utils/WitnessUtils.d.ts +1 -0
  33. package/browser/utxo/OPNetLimitedProvider.d.ts +1 -1
  34. package/browser/utxo/interfaces/IUTXO.d.ts +2 -2
  35. package/browser/vendors.js +90 -90
  36. package/browser/verification/TapscriptVerificator.d.ts +2 -2
  37. package/build/_version.d.ts +1 -1
  38. package/build/_version.js +1 -1
  39. package/build/consensus/ConsensusConfig.d.ts +1 -5
  40. package/build/consensus/IConsensusConfig.d.ts +6 -0
  41. package/build/consensus/IConsensusConfig.js +1 -0
  42. package/build/consensus/metadata/RoswellConsensus.d.ts +1 -1
  43. package/build/epoch/interfaces/IChallengeSolution.d.ts +15 -1
  44. package/build/epoch/validator/EpochValidator.js +35 -3
  45. package/build/generators/builders/CalldataGenerator.d.ts +2 -2
  46. package/build/generators/builders/DeploymentGenerator.d.ts +2 -2
  47. package/build/generators/builders/P2WDAGenerator.d.ts +2 -2
  48. package/build/opnet.d.ts +10 -3
  49. package/build/opnet.js +8 -2
  50. package/build/signer/AddressRotation.d.ts +2 -3
  51. package/build/signer/IRotationSigner.d.ts +8 -0
  52. package/build/signer/IRotationSigner.js +1 -0
  53. package/build/transaction/TransactionFactory.d.ts +4 -27
  54. package/build/transaction/TransactionFactory.js +1 -1
  55. package/build/transaction/browser/WalletNetworks.d.ts +14 -0
  56. package/build/transaction/browser/WalletNetworks.js +16 -0
  57. package/build/transaction/browser/Web3Provider.d.ts +2 -25
  58. package/build/transaction/browser/extensions/UnisatSigner.d.ts +2 -1
  59. package/build/transaction/browser/extensions/UnisatSigner.js +4 -4
  60. package/build/transaction/browser/types/Unisat.d.ts +5 -18
  61. package/build/transaction/browser/types/Unisat.js +0 -16
  62. package/build/transaction/builders/CancelTransaction.d.ts +1 -4
  63. package/build/transaction/builders/ConsolidatedInteractionTransaction.d.ts +3 -3
  64. package/build/transaction/builders/CustomScriptTransaction.d.ts +2 -8
  65. package/build/transaction/builders/DeploymentTransaction.d.ts +3 -3
  66. package/build/transaction/builders/InteractionTransactionP2WDA.d.ts +2 -2
  67. package/build/transaction/builders/SharedInteractionTransaction.d.ts +3 -3
  68. package/build/transaction/builders/TransactionBuilder.js +3 -21
  69. package/build/transaction/interfaces/ICancelTransactionParameters.d.ts +4 -0
  70. package/build/transaction/interfaces/ICancelTransactionParameters.js +1 -0
  71. package/build/transaction/interfaces/ICustomTransactionParameters.d.ts +8 -0
  72. package/build/transaction/interfaces/ICustomTransactionParameters.js +1 -0
  73. package/build/transaction/interfaces/ITransactionParameters.d.ts +6 -6
  74. package/build/transaction/interfaces/ITransactionResponses.d.ts +26 -0
  75. package/build/transaction/interfaces/ITransactionResponses.js +1 -0
  76. package/build/transaction/interfaces/ITweakedTransactionData.d.ts +17 -0
  77. package/build/transaction/interfaces/ITweakedTransactionData.js +1 -0
  78. package/build/transaction/interfaces/IWeb3ProviderTypes.d.ts +24 -0
  79. package/build/transaction/interfaces/IWeb3ProviderTypes.js +1 -0
  80. package/build/transaction/shared/TweakedTransaction.d.ts +2 -14
  81. package/build/transaction/shared/TweakedTransaction.js +3 -3
  82. package/build/transaction/utils/WitnessUtils.d.ts +1 -0
  83. package/build/transaction/utils/WitnessUtils.js +23 -0
  84. package/build/tsconfig.build.tsbuildinfo +1 -1
  85. package/build/utxo/OPNetLimitedProvider.d.ts +1 -1
  86. package/build/utxo/OPNetLimitedProvider.js +1 -1
  87. package/build/utxo/interfaces/IUTXO.d.ts +2 -2
  88. package/build/verification/TapscriptVerificator.d.ts +2 -2
  89. package/package.json +6 -3
  90. package/src/_version.ts +1 -1
  91. package/src/consensus/ConsensusConfig.ts +1 -28
  92. package/src/consensus/IConsensusConfig.ts +29 -0
  93. package/src/consensus/metadata/RoswellConsensus.ts +1 -1
  94. package/src/epoch/interfaces/IChallengeSolution.ts +13 -1
  95. package/src/epoch/validator/EpochValidator.ts +54 -3
  96. package/src/generators/builders/CalldataGenerator.ts +3 -3
  97. package/src/generators/builders/DeploymentGenerator.ts +3 -3
  98. package/src/generators/builders/P2WDAGenerator.ts +2 -2
  99. package/src/keypair/MessageSigner.ts +1 -1
  100. package/src/opnet.ts +10 -5
  101. package/src/signer/AddressRotation.ts +3 -4
  102. package/src/signer/IRotationSigner.ts +35 -0
  103. package/src/transaction/TransactionFactory.ts +14 -38
  104. package/src/transaction/browser/WalletNetworks.ts +15 -0
  105. package/src/transaction/browser/Web3Provider.ts +14 -78
  106. package/src/transaction/browser/extensions/UnisatSigner.ts +7 -5
  107. package/src/transaction/browser/types/Unisat.ts +5 -20
  108. package/src/transaction/builders/CancelTransaction.ts +2 -11
  109. package/src/transaction/builders/ConsolidatedInteractionTransaction.ts +3 -3
  110. package/src/transaction/builders/CustomScriptTransaction.ts +1 -15
  111. package/src/transaction/builders/DeploymentTransaction.ts +3 -3
  112. package/src/transaction/builders/InteractionTransactionP2WDA.ts +3 -3
  113. package/src/transaction/builders/SharedInteractionTransaction.ts +3 -3
  114. package/src/transaction/builders/TransactionBuilder.ts +2 -28
  115. package/src/transaction/interfaces/ICancelTransactionParameters.ts +8 -0
  116. package/src/transaction/interfaces/ICustomTransactionParameters.ts +15 -0
  117. package/src/transaction/interfaces/ITransactionParameters.ts +6 -6
  118. package/src/transaction/interfaces/ITransactionResponses.ts +29 -0
  119. package/src/transaction/interfaces/ITweakedTransactionData.ts +24 -0
  120. package/src/transaction/interfaces/IWeb3ProviderTypes.ts +74 -0
  121. package/src/transaction/offline/TransactionReconstructor.ts +1 -1
  122. package/src/transaction/shared/TweakedTransaction.ts +6 -30
  123. package/src/transaction/utils/WitnessUtils.ts +36 -0
  124. package/src/utxo/OPNetLimitedProvider.ts +3 -1
  125. package/src/utxo/interfaces/IUTXO.ts +2 -2
  126. package/src/verification/TapscriptVerificator.ts +2 -2
  127. package/browser/metadata/tokens.d.ts +0 -39
  128. package/browser/transaction/processor/PsbtTransaction.d.ts +0 -25
  129. package/build/metadata/tokens.d.ts +0 -39
  130. package/build/metadata/tokens.js +0 -100
  131. package/build/transaction/processor/PsbtTransaction.d.ts +0 -25
  132. package/build/transaction/processor/PsbtTransaction.js +0 -80
  133. package/src/metadata/tokens.ts +0 -139
  134. package/src/transaction/processor/PsbtTransaction.ts +0 -179
@@ -3501,47 +3501,9 @@ function dv(e, t) {
3501
3501
  function Ug(e) {
3502
3502
  return Qf(e), e < 253 ? 1 : e <= 65535 ? 3 : e <= 4294967295 ? 5 : 9;
3503
3503
  }
3504
- var It = {}, Ac;
3505
- function Ht() {
3506
- if (Ac) return It;
3507
- Ac = 1, Object.defineProperty(It, "__esModule", { value: !0 });
3508
- const e = 9007199254740991;
3509
- function t(a) {
3510
- if (a < 0 || a > e || a % 1 !== 0)
3511
- throw new RangeError("value out of range");
3512
- }
3513
- function r(a, s, i) {
3514
- if (t(a), s || (s = J.allocUnsafe(o(a))), !J.isBuffer(s))
3515
- throw new TypeError("buffer must be a Buffer instance");
3516
- return i || (i = 0), a < 253 ? (s.writeUInt8(a, i), Object.assign(r, { bytes: 1 })) : a <= 65535 ? (s.writeUInt8(253, i), s.writeUInt16LE(a, i + 1), Object.assign(r, { bytes: 3 })) : a <= 4294967295 ? (s.writeUInt8(254, i), s.writeUInt32LE(a, i + 1), Object.assign(r, { bytes: 5 })) : (s.writeUInt8(255, i), s.writeUInt32LE(a >>> 0, i + 1), s.writeUInt32LE(a / 4294967296 | 0, i + 5), Object.assign(r, { bytes: 9 })), s;
3517
- }
3518
- It.encode = r;
3519
- function n(a, s) {
3520
- if (!J.isBuffer(a))
3521
- throw new TypeError("buffer must be a Buffer instance");
3522
- s || (s = 0);
3523
- const i = a.readUInt8(s);
3524
- if (i < 253)
3525
- return Object.assign(n, { bytes: 1 }), i;
3526
- if (i === 253)
3527
- return Object.assign(n, { bytes: 3 }), a.readUInt16LE(s + 1);
3528
- if (i === 254)
3529
- return Object.assign(n, { bytes: 5 }), a.readUInt32LE(s + 1);
3530
- {
3531
- Object.assign(n, { bytes: 9 });
3532
- const h = a.readUInt32LE(s + 1), c = a.readUInt32LE(s + 5) * 4294967296 + h;
3533
- return t(c), c;
3534
- }
3535
- }
3536
- It.decode = n;
3537
- function o(a) {
3538
- return t(a), a < 253 ? 1 : a <= 65535 ? 3 : a <= 4294967295 ? 5 : 9;
3539
- }
3540
- return It.encodingLength = o, It;
3541
- }
3542
- var hv = Ht(), Ln = {}, qn = {}, Qa = {}, Bt = {}, Tt = {}, eo = {}, Sc;
3504
+ var Ln = {}, qn = {}, Qa = {}, It = {}, Bt = {}, eo = {}, Ac;
3543
3505
  function Ge() {
3544
- return Sc || (Sc = 1, (function(e) {
3506
+ return Ac || (Ac = 1, (function(e) {
3545
3507
  Object.defineProperty(e, "__esModule", { value: !0 }), (function(t) {
3546
3508
  t[t.UNSIGNED_TX = 0] = "UNSIGNED_TX", t[t.GLOBAL_XPUB = 1] = "GLOBAL_XPUB";
3547
3509
  })(e.GlobalTypes || (e.GlobalTypes = {})), e.GLOBAL_TYPE_NAMES = ["unsignedTx", "globalXpub"], (function(t) {
@@ -3575,10 +3537,10 @@ function Ge() {
3575
3537
  ];
3576
3538
  })(eo)), eo;
3577
3539
  }
3578
- var qr = {}, Ic;
3540
+ var qr = {}, Sc;
3579
3541
  function Ng() {
3580
- if (Ic) return qr;
3581
- Ic = 1, Object.defineProperty(qr, "__esModule", { value: !0 });
3542
+ if (Sc) return qr;
3543
+ Sc = 1, Object.defineProperty(qr, "__esModule", { value: !0 });
3582
3544
  const e = Ge(), t = (s) => [...Array(s).keys()];
3583
3545
  function r(s) {
3584
3546
  if (s.key[0] !== e.GlobalTypes.GLOBAL_XPUB)
@@ -3630,10 +3592,10 @@ function Ng() {
3630
3592
  }
3631
3593
  return qr.canAddToArray = a, qr;
3632
3594
  }
3633
- var Mn = {}, Bc;
3595
+ var Mn = {}, Ic;
3634
3596
  function Cg() {
3635
- if (Bc) return Mn;
3636
- Bc = 1, Object.defineProperty(Mn, "__esModule", { value: !0 });
3597
+ if (Ic) return Mn;
3598
+ Ic = 1, Object.defineProperty(Mn, "__esModule", { value: !0 });
3637
3599
  const e = Ge();
3638
3600
  function t(r) {
3639
3601
  return {
@@ -3643,10 +3605,10 @@ function Cg() {
3643
3605
  }
3644
3606
  return Mn.encode = t, Mn;
3645
3607
  }
3646
- var Mr = {}, Tc;
3608
+ var Mr = {}, Bc;
3647
3609
  function Lg() {
3648
- if (Tc) return Mr;
3649
- Tc = 1, Object.defineProperty(Mr, "__esModule", { value: !0 });
3610
+ if (Bc) return Mr;
3611
+ Bc = 1, Object.defineProperty(Mr, "__esModule", { value: !0 });
3650
3612
  const e = Ge();
3651
3613
  function t(a) {
3652
3614
  if (a.key[0] !== e.InputTypes.FINAL_SCRIPTSIG)
@@ -3672,10 +3634,10 @@ function Lg() {
3672
3634
  }
3673
3635
  return Mr.canAdd = o, Mr;
3674
3636
  }
3675
- var Dr = {}, zc;
3637
+ var Dr = {}, Tc;
3676
3638
  function qg() {
3677
- if (zc) return Dr;
3678
- zc = 1, Object.defineProperty(Dr, "__esModule", { value: !0 });
3639
+ if (Tc) return Dr;
3640
+ Tc = 1, Object.defineProperty(Dr, "__esModule", { value: !0 });
3679
3641
  const e = Ge();
3680
3642
  function t(a) {
3681
3643
  if (a.key[0] !== e.InputTypes.FINAL_SCRIPTWITNESS)
@@ -3701,10 +3663,10 @@ function qg() {
3701
3663
  }
3702
3664
  return Dr.canAdd = o, Dr;
3703
3665
  }
3704
- var Fr = {}, Oc;
3666
+ var Fr = {}, zc;
3705
3667
  function Mg() {
3706
- if (Oc) return Fr;
3707
- Oc = 1, Object.defineProperty(Fr, "__esModule", { value: !0 });
3668
+ if (zc) return Fr;
3669
+ zc = 1, Object.defineProperty(Fr, "__esModule", { value: !0 });
3708
3670
  const e = Ge();
3709
3671
  function t(a) {
3710
3672
  if (a.key[0] !== e.InputTypes.NON_WITNESS_UTXO)
@@ -3730,10 +3692,10 @@ function Mg() {
3730
3692
  }
3731
3693
  return Fr.canAdd = o, Fr;
3732
3694
  }
3733
- var Kr = {}, Rc;
3695
+ var Kr = {}, Oc;
3734
3696
  function Dg() {
3735
- if (Rc) return Kr;
3736
- Rc = 1, Object.defineProperty(Kr, "__esModule", { value: !0 });
3697
+ if (Oc) return Kr;
3698
+ Oc = 1, Object.defineProperty(Kr, "__esModule", { value: !0 });
3737
3699
  const e = Ge();
3738
3700
  function t(s) {
3739
3701
  if (s.key[0] !== e.InputTypes.PARTIAL_SIG)
@@ -3775,10 +3737,10 @@ function Dg() {
3775
3737
  }
3776
3738
  return Kr.canAddToArray = a, Kr;
3777
3739
  }
3778
- var Hr = {}, jc;
3740
+ var Hr = {}, Rc;
3779
3741
  function Fg() {
3780
- if (jc) return Hr;
3781
- jc = 1, Object.defineProperty(Hr, "__esModule", { value: !0 });
3742
+ if (Rc) return Hr;
3743
+ Rc = 1, Object.defineProperty(Hr, "__esModule", { value: !0 });
3782
3744
  const e = Ge();
3783
3745
  function t(a) {
3784
3746
  if (a.key[0] !== e.InputTypes.POR_COMMITMENT)
@@ -3804,10 +3766,10 @@ function Fg() {
3804
3766
  }
3805
3767
  return Hr.canAdd = o, Hr;
3806
3768
  }
3807
- var $r = {}, Pc;
3769
+ var $r = {}, jc;
3808
3770
  function Kg() {
3809
- if (Pc) return $r;
3810
- Pc = 1, Object.defineProperty($r, "__esModule", { value: !0 });
3771
+ if (jc) return $r;
3772
+ jc = 1, Object.defineProperty($r, "__esModule", { value: !0 });
3811
3773
  const e = Ge();
3812
3774
  function t(a) {
3813
3775
  if (a.key[0] !== e.InputTypes.SIGHASH_TYPE)
@@ -3834,10 +3796,10 @@ function Kg() {
3834
3796
  }
3835
3797
  return $r.canAdd = o, $r;
3836
3798
  }
3837
- var Gr = {}, Uc;
3799
+ var Gr = {}, Pc;
3838
3800
  function Hg() {
3839
- if (Uc) return Gr;
3840
- Uc = 1, Object.defineProperty(Gr, "__esModule", { value: !0 });
3801
+ if (Pc) return Gr;
3802
+ Pc = 1, Object.defineProperty(Gr, "__esModule", { value: !0 });
3841
3803
  const e = Ge();
3842
3804
  function t(a) {
3843
3805
  if (a.key[0] !== e.InputTypes.TAP_KEY_SIG || a.key.length !== 1)
@@ -3864,10 +3826,10 @@ function Hg() {
3864
3826
  }
3865
3827
  return Gr.canAdd = o, Gr;
3866
3828
  }
3867
- var Wr = {}, Nc;
3829
+ var Wr = {}, Uc;
3868
3830
  function $g() {
3869
- if (Nc) return Wr;
3870
- Nc = 1, Object.defineProperty(Wr, "__esModule", { value: !0 });
3831
+ if (Uc) return Wr;
3832
+ Uc = 1, Object.defineProperty(Wr, "__esModule", { value: !0 });
3871
3833
  const e = Ge();
3872
3834
  function t(a) {
3873
3835
  if (a.key[0] !== e.InputTypes.TAP_LEAF_SCRIPT)
@@ -3905,10 +3867,10 @@ function $g() {
3905
3867
  }
3906
3868
  return Wr.canAddToArray = o, Wr;
3907
3869
  }
3908
- var Vr = {}, Cc;
3870
+ var Vr = {}, Nc;
3909
3871
  function Gg() {
3910
- if (Cc) return Vr;
3911
- Cc = 1, Object.defineProperty(Vr, "__esModule", { value: !0 });
3872
+ if (Nc) return Vr;
3873
+ Nc = 1, Object.defineProperty(Vr, "__esModule", { value: !0 });
3912
3874
  const e = Ge();
3913
3875
  function t(a) {
3914
3876
  if (a.key[0] !== e.InputTypes.TAP_MERKLE_ROOT || a.key.length !== 1)
@@ -3933,10 +3895,10 @@ function Gg() {
3933
3895
  }
3934
3896
  return Vr.canAdd = o, Vr;
3935
3897
  }
3936
- var Zr = {}, Lc;
3898
+ var Zr = {}, Cc;
3937
3899
  function Wg() {
3938
- if (Lc) return Zr;
3939
- Lc = 1, Object.defineProperty(Zr, "__esModule", { value: !0 });
3900
+ if (Cc) return Zr;
3901
+ Cc = 1, Object.defineProperty(Zr, "__esModule", { value: !0 });
3940
3902
  const e = Ge();
3941
3903
  function t(a) {
3942
3904
  if (a.key[0] !== e.InputTypes.TAP_SCRIPT_SIG)
@@ -3979,7 +3941,45 @@ function Wg() {
3979
3941
  }
3980
3942
  return Zr.canAddToArray = o, Zr;
3981
3943
  }
3982
- var Yr = {}, Br = {}, qc;
3944
+ var Yr = {}, Br = {}, Tt = {}, Lc;
3945
+ function Ht() {
3946
+ if (Lc) return Tt;
3947
+ Lc = 1, Object.defineProperty(Tt, "__esModule", { value: !0 });
3948
+ const e = 9007199254740991;
3949
+ function t(a) {
3950
+ if (a < 0 || a > e || a % 1 !== 0)
3951
+ throw new RangeError("value out of range");
3952
+ }
3953
+ function r(a, s, i) {
3954
+ if (t(a), s || (s = J.allocUnsafe(o(a))), !J.isBuffer(s))
3955
+ throw new TypeError("buffer must be a Buffer instance");
3956
+ return i || (i = 0), a < 253 ? (s.writeUInt8(a, i), Object.assign(r, { bytes: 1 })) : a <= 65535 ? (s.writeUInt8(253, i), s.writeUInt16LE(a, i + 1), Object.assign(r, { bytes: 3 })) : a <= 4294967295 ? (s.writeUInt8(254, i), s.writeUInt32LE(a, i + 1), Object.assign(r, { bytes: 5 })) : (s.writeUInt8(255, i), s.writeUInt32LE(a >>> 0, i + 1), s.writeUInt32LE(a / 4294967296 | 0, i + 5), Object.assign(r, { bytes: 9 })), s;
3957
+ }
3958
+ Tt.encode = r;
3959
+ function n(a, s) {
3960
+ if (!J.isBuffer(a))
3961
+ throw new TypeError("buffer must be a Buffer instance");
3962
+ s || (s = 0);
3963
+ const i = a.readUInt8(s);
3964
+ if (i < 253)
3965
+ return Object.assign(n, { bytes: 1 }), i;
3966
+ if (i === 253)
3967
+ return Object.assign(n, { bytes: 3 }), a.readUInt16LE(s + 1);
3968
+ if (i === 254)
3969
+ return Object.assign(n, { bytes: 5 }), a.readUInt32LE(s + 1);
3970
+ {
3971
+ Object.assign(n, { bytes: 9 });
3972
+ const h = a.readUInt32LE(s + 1), c = a.readUInt32LE(s + 5) * 4294967296 + h;
3973
+ return t(c), c;
3974
+ }
3975
+ }
3976
+ Tt.decode = n;
3977
+ function o(a) {
3978
+ return t(a), a < 253 ? 1 : a <= 65535 ? 3 : a <= 4294967295 ? 5 : 9;
3979
+ }
3980
+ return Tt.encodingLength = o, Tt;
3981
+ }
3982
+ var qc;
3983
3983
  function gs() {
3984
3984
  if (qc) return Br;
3985
3985
  qc = 1, Object.defineProperty(Br, "__esModule", { value: !0 });
@@ -4338,15 +4338,15 @@ function eb() {
4338
4338
  }
4339
4339
  var Vc;
4340
4340
  function bs() {
4341
- if (Vc) return Tt;
4342
- Vc = 1, Object.defineProperty(Tt, "__esModule", { value: !0 });
4341
+ if (Vc) return Bt;
4342
+ Vc = 1, Object.defineProperty(Bt, "__esModule", { value: !0 });
4343
4343
  const e = Ge(), t = Ng(), r = Cg(), n = Lg(), o = qg(), a = Mg(), s = Dg(), i = Fg(), h = Kg(), l = Hg(), c = $g(), w = Gg(), g = Wg(), v = Vg(), k = Zg(), y = ed(), m = Yg(), A = Xg(), E = Jg(), x = Qg(), z = eb(), F = {
4344
4344
  unsignedTx: r,
4345
4345
  globalXpub: t,
4346
4346
  // pass an Array of key bytes that require pubkey beside the key
4347
4347
  checkPubkey: m.makeChecker([])
4348
4348
  };
4349
- Tt.globals = F;
4349
+ Bt.globals = F;
4350
4350
  const j = {
4351
4351
  nonWitnessUtxo: a,
4352
4352
  partialSig: s,
@@ -4379,7 +4379,7 @@ function bs() {
4379
4379
  ),
4380
4380
  tapMerkleRoot: w
4381
4381
  };
4382
- Tt.inputs = j;
4382
+ Bt.inputs = j;
4383
4383
  const I = {
4384
4384
  bip32Derivation: y.makeConverter(
4385
4385
  e.OutputTypes.BIP32_DERIVATION
@@ -4401,12 +4401,12 @@ function bs() {
4401
4401
  e.OutputTypes.TAP_INTERNAL_KEY
4402
4402
  )
4403
4403
  };
4404
- return Tt.outputs = I, Tt;
4404
+ return Bt.outputs = I, Bt;
4405
4405
  }
4406
4406
  var Zc;
4407
4407
  function rb() {
4408
- if (Zc) return Bt;
4409
- Zc = 1, Object.defineProperty(Bt, "__esModule", { value: !0 });
4408
+ if (Zc) return It;
4409
+ Zc = 1, Object.defineProperty(It, "__esModule", { value: !0 });
4410
4410
  const e = bs(), t = gs(), r = Ht(), n = Ge();
4411
4411
  function o(i, h) {
4412
4412
  let l = 0;
@@ -4488,14 +4488,14 @@ function rb() {
4488
4488
  outputKeyVals: j
4489
4489
  });
4490
4490
  }
4491
- Bt.psbtFromBuffer = o;
4491
+ It.psbtFromBuffer = o;
4492
4492
  function a(i, h, l) {
4493
4493
  if (!h.equals(J.from([l])))
4494
4494
  throw new Error(
4495
4495
  `Format Error: Invalid ${i} key: ${h.toString("hex")}`
4496
4496
  );
4497
4497
  }
4498
- Bt.checkKeyBuffer = a;
4498
+ It.checkKeyBuffer = a;
4499
4499
  function s(i, { globalMapKeyVals: h, inputKeyVals: l, outputKeyVals: c }) {
4500
4500
  const w = {
4501
4501
  unsignedTx: i
@@ -4691,7 +4691,7 @@ function rb() {
4691
4691
  }
4692
4692
  return { globalMap: w, inputs: y, outputs: m };
4693
4693
  }
4694
- return Bt.psbtFromKeyVals = s, Bt;
4694
+ return It.psbtFromKeyVals = s, It;
4695
4695
  }
4696
4696
  var Xt = {}, Yc;
4697
4697
  function tb() {
@@ -5026,7 +5026,7 @@ function ab() {
5026
5026
  }
5027
5027
  return Ln.Psbt = o, Ln;
5028
5028
  }
5029
- var pv = ab(), gv = td(), Le = {}, ru;
5029
+ var hv = ab(), pv = Ht(), gv = td(), Le = {}, ru;
5030
5030
  function ob() {
5031
5031
  if (ru) return Le;
5032
5032
  ru = 1;
@@ -11990,9 +11990,9 @@ export {
11990
11990
  nd as l,
11991
11991
  _v as m,
11992
11992
  kv as n,
11993
- pv as p,
11993
+ hv as p,
11994
11994
  vv as s,
11995
11995
  lv as t,
11996
11996
  gv as u,
11997
- hv as v
11997
+ pv as v
11998
11998
  };
@@ -1,12 +1,12 @@
1
1
  import { Network, Taptree } from '../../node_modules/@btc-vision/bitcoin/build/index.js';
2
- import { ChallengeSolution } from '../epoch/ChallengeSolution.js';
2
+ import { IChallengeSolution } from '../epoch/interfaces/IChallengeSolution.js';
3
3
  import { Feature, Features } from '../generators/Features.js';
4
4
  export interface ContractAddressVerificationParams {
5
5
  readonly deployerPubKey: Buffer;
6
6
  readonly contractSaltPubKey: Buffer;
7
7
  readonly originalSalt: Buffer;
8
8
  readonly bytecode: Buffer;
9
- readonly challenge: ChallengeSolution;
9
+ readonly challenge: IChallengeSolution;
10
10
  readonly priorityFee: bigint;
11
11
  readonly features: Feature<Features>[];
12
12
  readonly calldata?: Buffer;
@@ -1 +1 @@
1
- export declare const version = "1.7.28";
1
+ export declare const version = "1.7.30";
package/build/_version.js CHANGED
@@ -1 +1 @@
1
- export const version = '1.7.28';
1
+ export const version = '1.7.30';
@@ -1,9 +1,5 @@
1
1
  import { Consensus } from './Consensus.js';
2
- export interface ConsensusConfig<T extends Consensus> {
3
- readonly CONSENSUS: T;
4
- readonly CONSENSUS_NAME: string;
5
- readonly ENABLED_AT_BLOCK: bigint;
6
- }
2
+ import { ConsensusConfig } from './IConsensusConfig.js';
7
3
  export declare const OPNetConsensusConfig: {
8
4
  [key in Consensus]?: ConsensusConfig<key>;
9
5
  };
@@ -0,0 +1,6 @@
1
+ import { Consensus } from './Consensus.js';
2
+ export interface ConsensusConfig<T extends Consensus> {
3
+ readonly CONSENSUS: T;
4
+ readonly CONSENSUS_NAME: string;
5
+ readonly ENABLED_AT_BLOCK: bigint;
6
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -1,3 +1,3 @@
1
- import { ConsensusConfig } from '../ConsensusConfig.js';
1
+ import { ConsensusConfig } from '../IConsensusConfig.js';
2
2
  import { Consensus } from '../Consensus.js';
3
3
  export declare const RoswellConsensus: ConsensusConfig<Consensus.Roswell>;
@@ -16,6 +16,18 @@ export interface IChallengeSolution {
16
16
  readonly graffiti: Buffer;
17
17
  readonly difficulty: number;
18
18
  readonly verification: IChallengeVerification;
19
+ verifySubmissionSignature(): boolean;
20
+ getSubmission(): IChallengeSubmission | undefined;
21
+ toRaw(): RawChallenge;
22
+ verify(): boolean;
23
+ toBuffer(): Buffer;
24
+ toHex(): string;
25
+ calculateSolution(): Buffer;
26
+ checkDifficulty(minDifficulty: number): {
27
+ valid: boolean;
28
+ difficulty: number;
29
+ };
30
+ getMiningTargetBlock(): bigint | null;
19
31
  }
20
32
  export interface RawChallengeVerification {
21
33
  readonly epochHash: string;
@@ -36,8 +48,10 @@ export interface RawChallengeSubmission {
36
48
  export interface IChallengeSubmission {
37
49
  readonly publicKey: Address;
38
50
  readonly solution: Buffer;
39
- readonly graffiti?: Buffer;
51
+ readonly graffiti: Buffer | undefined;
40
52
  readonly signature: Buffer;
53
+ readonly epochNumber: bigint;
54
+ verifySignature(): boolean;
41
55
  }
42
56
  export interface RawChallenge {
43
57
  readonly epochNumber: string;
@@ -1,5 +1,6 @@
1
- import { ChallengeSolution } from '../ChallengeSolution.js';
2
1
  import { crypto } from '@btc-vision/bitcoin';
2
+ import { Address } from '../../keypair/Address.js';
3
+ import { stringToBuffer } from '../../utils/StringToBuffer.js';
3
4
  export class EpochValidator {
4
5
  static bufferToUint8Array(buffer) {
5
6
  return new Uint8Array(buffer);
@@ -76,8 +77,39 @@ export class EpochValidator {
76
77
  return epochNumber * this.BLOCKS_PER_EPOCH - 1n;
77
78
  }
78
79
  static validateEpochWinner(epochData) {
79
- const preimage = new ChallengeSolution(epochData);
80
- return this.verifySolution(preimage);
80
+ try {
81
+ const epochNumber = BigInt(epochData.epochNumber);
82
+ const publicKey = Address.fromString(epochData.mldsaPublicKey, epochData.legacyPublicKey);
83
+ const solution = stringToBuffer(epochData.solution);
84
+ const salt = stringToBuffer(epochData.salt);
85
+ const difficulty = epochData.difficulty;
86
+ const verification = {
87
+ epochHash: stringToBuffer(epochData.verification.epochHash),
88
+ epochRoot: stringToBuffer(epochData.verification.epochRoot),
89
+ targetHash: stringToBuffer(epochData.verification.targetHash),
90
+ targetChecksum: stringToBuffer(epochData.verification.targetChecksum),
91
+ startBlock: BigInt(epochData.verification.startBlock),
92
+ endBlock: BigInt(epochData.verification.endBlock),
93
+ proofs: Object.freeze(epochData.verification.proofs.map((p) => stringToBuffer(p))),
94
+ };
95
+ const calculatedPreimage = this.calculatePreimage(verification.targetChecksum, publicKey.toBuffer(), salt);
96
+ const computedSolution = this.sha1(calculatedPreimage);
97
+ const computedSolutionBuffer = this.uint8ArrayToBuffer(computedSolution);
98
+ if (!computedSolutionBuffer.equals(solution)) {
99
+ return false;
100
+ }
101
+ const matchingBits = this.countMatchingBits(computedSolutionBuffer, verification.targetHash);
102
+ if (matchingBits !== difficulty) {
103
+ return false;
104
+ }
105
+ const expectedStartBlock = epochNumber * this.BLOCKS_PER_EPOCH;
106
+ const expectedEndBlock = expectedStartBlock + this.BLOCKS_PER_EPOCH - 1n;
107
+ return !(verification.startBlock !== expectedStartBlock ||
108
+ verification.endBlock !== expectedEndBlock);
109
+ }
110
+ catch {
111
+ return false;
112
+ }
81
113
  }
82
114
  static validateChallengeSolution(challenge) {
83
115
  return this.verifySolution(challenge);
@@ -1,9 +1,9 @@
1
1
  import { Network } from '@btc-vision/bitcoin';
2
2
  import { Feature, Features } from '../Features.js';
3
3
  import { Generator } from '../Generator.js';
4
- import { ChallengeSolution } from '../../epoch/ChallengeSolution.js';
4
+ import { IChallengeSolution } from '../../epoch/interfaces/IChallengeSolution.js';
5
5
  export declare class CalldataGenerator extends Generator {
6
6
  constructor(senderPubKey: Buffer, contractSaltPubKey: Buffer, network?: Network);
7
7
  static getPubKeyAsBuffer(witnessKeys: Buffer[], network: Network): Buffer;
8
- compile(calldata: Buffer, contractSecret: Buffer, challenge: ChallengeSolution, maxPriority: bigint, featuresRaw?: Feature<Features>[]): Buffer;
8
+ compile(calldata: Buffer, contractSecret: Buffer, challenge: IChallengeSolution, maxPriority: bigint, featuresRaw?: Feature<Features>[]): Buffer;
9
9
  }
@@ -1,11 +1,11 @@
1
1
  import { Network } from '@btc-vision/bitcoin';
2
2
  import { Generator } from '../Generator.js';
3
3
  import { Feature, Features } from '../Features.js';
4
- import { ChallengeSolution } from '../../epoch/ChallengeSolution.js';
4
+ import { IChallengeSolution } from '../../epoch/interfaces/IChallengeSolution.js';
5
5
  export declare const OPNET_DEPLOYMENT_VERSION = 0;
6
6
  export declare const versionBuffer: Buffer<ArrayBuffer>;
7
7
  export declare class DeploymentGenerator extends Generator {
8
8
  constructor(senderPubKey: Buffer, contractSaltPubKey: Buffer, network?: Network);
9
- compile(contractBytecode: Buffer, contractSalt: Buffer, challenge: ChallengeSolution, maxPriority: bigint, calldata?: Buffer, features?: Feature<Features>[]): Buffer;
9
+ compile(contractBytecode: Buffer, contractSalt: Buffer, challenge: IChallengeSolution, maxPriority: bigint, calldata?: Buffer, features?: Feature<Features>[]): Buffer;
10
10
  private getAsm;
11
11
  }
@@ -1,12 +1,12 @@
1
1
  import { Network } from '@btc-vision/bitcoin';
2
2
  import { Feature, Features } from '../Features.js';
3
3
  import { Generator } from '../Generator.js';
4
- import { ChallengeSolution } from '../../epoch/ChallengeSolution.js';
4
+ import { IChallengeSolution } from '../../epoch/interfaces/IChallengeSolution.js';
5
5
  export declare class P2WDAGenerator extends Generator {
6
6
  private static readonly P2WDA_VERSION;
7
7
  constructor(senderPubKey: Buffer, contractSaltPubKey: Buffer, network?: Network);
8
8
  static validateWitnessSize(dataSize: number, maxWitnessFields?: number, maxBytesPerWitness?: number): boolean;
9
- compile(calldata: Buffer, contractSecret: Buffer, challenge: ChallengeSolution, maxPriority: bigint, featuresRaw?: Feature<Features>[]): Buffer;
9
+ compile(calldata: Buffer, contractSecret: Buffer, challenge: IChallengeSolution, maxPriority: bigint, featuresRaw?: Feature<Features>[]): Buffer;
10
10
  getHeader(maxPriority: bigint, features?: Features[]): Buffer;
11
11
  private writeFeatures;
12
12
  }
package/build/opnet.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { Unisat } from './transaction/browser/types/Unisat.js';
2
+ import { OPWallet } from './transaction/browser/types/OPWallet.js';
2
3
  export { version } from './_version.js';
3
4
  export * from './bytecode/Compressor.js';
4
5
  export * from './generators/builders/CalldataGenerator.js';
@@ -28,10 +29,16 @@ export * from './generators/MLDSAData.js';
28
29
  export * from './metadata/ContractBaseMetadata.js';
29
30
  export * from './network/ChainId.js';
30
31
  export * from './signer/TweakedSigner.js';
32
+ export * from './signer/IRotationSigner.js';
31
33
  export * from './signer/AddressRotation.js';
32
34
  export * from './transaction/enums/TransactionType.js';
33
35
  export * from './transaction/interfaces/ITransactionParameters.js';
34
36
  export * from './transaction/interfaces/IConsolidatedTransactionParameters.js';
37
+ export * from './transaction/interfaces/ITransactionResponses.js';
38
+ export * from './transaction/interfaces/IWeb3ProviderTypes.js';
39
+ export * from './transaction/interfaces/ICancelTransactionParameters.js';
40
+ export * from './transaction/interfaces/ICustomTransactionParameters.js';
41
+ export * from './transaction/interfaces/ITweakedTransactionData.js';
35
42
  export * from './transaction/interfaces/Tap.js';
36
43
  export * from './transaction/TransactionFactory.js';
37
44
  export * from './transaction/builders/CancelTransaction.js';
@@ -60,12 +67,12 @@ export * from './utils/BitcoinUtils.js';
60
67
  export * from './utils/lengths.js';
61
68
  export * from './utxo/interfaces/IUTXO.js';
62
69
  export * from './utxo/OPNetLimitedProvider.js';
63
- export * from './transaction/processor/PsbtTransaction.js';
64
70
  export * from './transaction/psbt/PSBTTypes.js';
65
71
  export * from './transaction/shared/TweakedTransaction.js';
66
72
  export * from './utxo/interfaces/BroadcastResponse.js';
67
73
  export * from './transaction/shared/P2TR_MS.js';
68
74
  export * from './consensus/Consensus.js';
75
+ export * from './consensus/IConsensusConfig.js';
69
76
  export * from './consensus/ConsensusConfig.js';
70
77
  export * from './consensus/metadata/RoswellConsensus.js';
71
78
  export * from './abi/ABICoder.js';
@@ -85,7 +92,7 @@ export * from './transaction/browser/extensions/XverseSigner.js';
85
92
  export * from './transaction/browser/types/Unisat.js';
86
93
  export * from './transaction/browser/types/Xverse.js';
87
94
  export * from './transaction/browser/types/OPWallet.js';
88
- export * from './metadata/tokens.js';
95
+ export * from './transaction/browser/WalletNetworks.js';
89
96
  export * from './transaction/browser/Web3Provider.js';
90
97
  export * from './keypair/Secp256k1PointDeriver.js';
91
98
  export * from './transaction/ContractAddress.js';
@@ -94,6 +101,6 @@ export * from './deterministic/CustomMap.js';
94
101
  declare global {
95
102
  interface Window {
96
103
  unisat?: Unisat;
97
- opnet?: Unisat;
104
+ opnet?: OPWallet;
98
105
  }
99
106
  }
package/build/opnet.js CHANGED
@@ -27,10 +27,16 @@ export * from './generators/MLDSAData.js';
27
27
  export * from './metadata/ContractBaseMetadata.js';
28
28
  export * from './network/ChainId.js';
29
29
  export * from './signer/TweakedSigner.js';
30
+ export * from './signer/IRotationSigner.js';
30
31
  export * from './signer/AddressRotation.js';
31
32
  export * from './transaction/enums/TransactionType.js';
32
33
  export * from './transaction/interfaces/ITransactionParameters.js';
33
34
  export * from './transaction/interfaces/IConsolidatedTransactionParameters.js';
35
+ export * from './transaction/interfaces/ITransactionResponses.js';
36
+ export * from './transaction/interfaces/IWeb3ProviderTypes.js';
37
+ export * from './transaction/interfaces/ICancelTransactionParameters.js';
38
+ export * from './transaction/interfaces/ICustomTransactionParameters.js';
39
+ export * from './transaction/interfaces/ITweakedTransactionData.js';
34
40
  export * from './transaction/interfaces/Tap.js';
35
41
  export * from './transaction/TransactionFactory.js';
36
42
  export * from './transaction/builders/CancelTransaction.js';
@@ -56,12 +62,12 @@ export * from './utils/BitcoinUtils.js';
56
62
  export * from './utils/lengths.js';
57
63
  export * from './utxo/interfaces/IUTXO.js';
58
64
  export * from './utxo/OPNetLimitedProvider.js';
59
- export * from './transaction/processor/PsbtTransaction.js';
60
65
  export * from './transaction/psbt/PSBTTypes.js';
61
66
  export * from './transaction/shared/TweakedTransaction.js';
62
67
  export * from './utxo/interfaces/BroadcastResponse.js';
63
68
  export * from './transaction/shared/P2TR_MS.js';
64
69
  export * from './consensus/Consensus.js';
70
+ export * from './consensus/IConsensusConfig.js';
65
71
  export * from './consensus/ConsensusConfig.js';
66
72
  export * from './consensus/metadata/RoswellConsensus.js';
67
73
  export * from './abi/ABICoder.js';
@@ -81,7 +87,7 @@ export * from './transaction/browser/extensions/XverseSigner.js';
81
87
  export * from './transaction/browser/types/Unisat.js';
82
88
  export * from './transaction/browser/types/Xverse.js';
83
89
  export * from './transaction/browser/types/OPWallet.js';
84
- export * from './metadata/tokens.js';
90
+ export * from './transaction/browser/WalletNetworks.js';
85
91
  export * from './transaction/browser/Web3Provider.js';
86
92
  export * from './keypair/Secp256k1PointDeriver.js';
87
93
  export * from './transaction/ContractAddress.js';
@@ -1,7 +1,6 @@
1
- import { Signer } from '@btc-vision/bitcoin';
2
- import { ECPairInterface } from 'ecpair';
1
+ import { RotationSignerBase } from './IRotationSigner.js';
3
2
  import { UnisatSigner } from '../transaction/browser/extensions/UnisatSigner.js';
4
- export type RotationSigner = Signer | ECPairInterface | UnisatSigner;
3
+ export type RotationSigner = RotationSignerBase | UnisatSigner;
5
4
  export type SignerMap = Map<string, RotationSigner>;
6
5
  export interface AddressRotationConfig {
7
6
  readonly enabled: boolean;
@@ -0,0 +1,8 @@
1
+ import { Signer } from '@btc-vision/bitcoin';
2
+ import { ECPairInterface } from 'ecpair';
3
+ export type RotationSignerBase = Signer | ECPairInterface;
4
+ export type SignerMapBase = Map<string, RotationSignerBase>;
5
+ export interface AddressRotationConfigBase {
6
+ readonly enabled: boolean;
7
+ readonly signerMap: SignerMapBase;
8
+ }
@@ -0,0 +1 @@
1
+ export {};