@opcat-labs/scrypt-ts-opcat 2.0.1-beta-4e9e00a1-20251208 → 2.0.2

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 (72) hide show
  1. package/assets/.templates/smart-contract/builtin-libs/p2pk.scrypt.map +1 -1
  2. package/assets/.templates/smart-contract/builtin-libs/p2pk.scrypt.tpl +0 -3
  3. package/assets/.templates/smart-contract/builtin-libs/p2pkh.scrypt.map +1 -1
  4. package/assets/.templates/smart-contract/builtin-libs/p2pkh.scrypt.tpl +0 -3
  5. package/assets/smart-contract/builtin-libs/backtrace.scrypt +12 -12
  6. package/assets/smart-contract/builtin-libs/byteStringReader.scrypt +5 -5
  7. package/assets/smart-contract/builtin-libs/byteStringWriter.scrypt +6 -6
  8. package/assets/smart-contract/builtin-libs/contextUtils.scrypt +16 -16
  9. package/assets/smart-contract/builtin-libs/p2pk.scrypt +1 -4
  10. package/assets/smart-contract/builtin-libs/p2pkh.scrypt +1 -4
  11. package/assets/smart-contract/builtin-libs/stateLib.scrypt +1 -1
  12. package/assets/smart-contract/builtin-libs/stateUtils.scrypt +1 -1
  13. package/assets/smart-contract/builtin-libs/stdUtils.scrypt +12 -12
  14. package/assets/smart-contract/builtin-libs/txHashPreimageUtils.scrypt +7 -7
  15. package/assets/smart-contract/builtin-libs/txUtils.scrypt +12 -12
  16. package/assets/smart-contract/types/structs.scrypt +8 -8
  17. package/dist/cjs/providers/dummyProvider.cjs +0 -10
  18. package/dist/cjs/providers/dummyProvider.js.map +1 -1
  19. package/dist/cjs/providers/mempoolProvider.cjs +0 -44
  20. package/dist/cjs/providers/mempoolProvider.js.map +1 -1
  21. package/dist/cjs/providers/rpcProvider.cjs +3 -46
  22. package/dist/cjs/providers/rpcProvider.js.map +1 -1
  23. package/dist/cjs/psbt/extPsbt.cjs +1 -8
  24. package/dist/cjs/psbt/extPsbt.js.map +1 -1
  25. package/dist/cjs/psbt/psbt.cjs +1 -3
  26. package/dist/cjs/psbt/psbt.js.map +1 -1
  27. package/dist/cjs/smart-contract/builtin-libs/index.cjs +1 -5
  28. package/dist/cjs/smart-contract/builtin-libs/index.js.map +1 -1
  29. package/dist/cjs/smart-contract/smartContract.cjs +0 -22
  30. package/dist/cjs/smart-contract/smartContract.js.map +1 -1
  31. package/dist/esm/providers/dummyProvider.js +0 -10
  32. package/dist/esm/providers/dummyProvider.js.map +1 -1
  33. package/dist/esm/providers/mempoolProvider.js +0 -44
  34. package/dist/esm/providers/mempoolProvider.js.map +1 -1
  35. package/dist/esm/providers/rpcProvider.js +2 -45
  36. package/dist/esm/providers/rpcProvider.js.map +1 -1
  37. package/dist/esm/psbt/extPsbt.js +1 -8
  38. package/dist/esm/psbt/extPsbt.js.map +1 -1
  39. package/dist/esm/psbt/psbt.js +1 -3
  40. package/dist/esm/psbt/psbt.js.map +1 -1
  41. package/dist/esm/smart-contract/builtin-libs/index.js +0 -1
  42. package/dist/esm/smart-contract/builtin-libs/index.js.map +1 -1
  43. package/dist/esm/smart-contract/smartContract.js +1 -23
  44. package/dist/esm/smart-contract/smartContract.js.map +1 -1
  45. package/dist/types/providers/chainProvider.d.ts +0 -12
  46. package/dist/types/providers/chainProvider.d.ts.map +1 -1
  47. package/dist/types/providers/dummyProvider.d.ts +2 -4
  48. package/dist/types/providers/dummyProvider.d.ts.map +1 -1
  49. package/dist/types/providers/mempoolProvider.d.ts +2 -4
  50. package/dist/types/providers/mempoolProvider.d.ts.map +1 -1
  51. package/dist/types/providers/rpcProvider.d.ts +2 -4
  52. package/dist/types/providers/rpcProvider.d.ts.map +1 -1
  53. package/dist/types/psbt/extPsbt.d.ts.map +1 -1
  54. package/dist/types/psbt/psbt.d.ts.map +1 -1
  55. package/dist/types/smart-contract/builtin-libs/index.d.ts +0 -1
  56. package/dist/types/smart-contract/builtin-libs/index.d.ts.map +1 -1
  57. package/dist/types/smart-contract/smartContract.d.ts +0 -20
  58. package/dist/types/smart-contract/smartContract.d.ts.map +1 -1
  59. package/package.json +3 -4
  60. package/scrypt.index.json +0 -4
  61. package/src/smart-contract/builtin-libs/index.ts +1 -2
  62. package/assets/.templates/smart-contract/builtin-libs/genesis.scrypt.map +0 -1
  63. package/assets/.templates/smart-contract/builtin-libs/genesis.scrypt.tpl +0 -32
  64. package/assets/.templates/smart-contract/builtin-libs/genesis.transformer.json +0 -9
  65. package/assets/smart-contract/builtin-libs/genesis.scrypt +0 -34
  66. package/dist/cjs/smart-contract/builtin-libs/genesis.cjs +0 -201
  67. package/dist/cjs/smart-contract/builtin-libs/genesis.js.map +0 -1
  68. package/dist/esm/smart-contract/builtin-libs/genesis.js +0 -197
  69. package/dist/esm/smart-contract/builtin-libs/genesis.js.map +0 -1
  70. package/dist/types/smart-contract/builtin-libs/genesis.d.ts +0 -67
  71. package/dist/types/smart-contract/builtin-libs/genesis.d.ts.map +0 -1
  72. package/src/smart-contract/builtin-libs/genesis.ts +0 -203
@@ -1 +1 @@
1
- [[],[],[],[],[[9,0,14,13]],[[2,0,16,4],[8,0,16,21],[15,0,16,13]],[[2,0,24,4],[18,0,24,11],[25,0,24,23],[29,0,24,18]],[[4,0,25,8],[12,0,25,20],[20,0,25,15],[21,0,25,29],[26,0,25,34],[30,0,25,39],[37,0,25,15]],[],[]]
1
+ [[],[[9,0,14,13]],[[2,0,16,4],[8,0,16,21],[15,0,16,13]],[[2,0,24,4],[18,0,24,11],[25,0,24,23],[29,0,24,18]],[[4,0,25,8],[12,0,25,20],[20,0,25,15],[21,0,25,29],[26,0,25,34],[30,0,25,39],[37,0,25,15]],[],[]]
@@ -1,6 +1,3 @@
1
- import "@opcat-labs/scrypt-ts-opcat/assets/.templates/smart-contract/builtin-libs/txUtils.scrypt.tpl";
2
- import "@opcat-labs/scrypt-ts-opcat/assets/.templates/smart-contract/builtin-libs/contextUtils.scrypt.tpl";
3
-
4
1
 
5
2
  contract P2PK {
6
3
  const PubKey pubKey;
@@ -1 +1 @@
1
- [[],[],[],[],[[9,0,16,13]],[[2,0,18,4],[8,0,18,19],[18,0,18,13]],[[2,0,26,4],[18,0,26,11],[25,0,26,23],[29,0,26,18],[34,0,26,36],[41,0,26,28]],[[4,0,27,8],[12,0,28,12],[20,0,28,24],[28,0,28,12],[31,0,28,35],[35,0,28,40]],[[4,0,31,8],[12,0,31,20],[20,0,31,15],[21,0,31,29],[26,0,31,34],[32,0,31,15]],[],[]]
1
+ [[],[[9,0,16,13]],[[2,0,18,4],[8,0,18,19],[18,0,18,13]],[[2,0,26,4],[18,0,26,11],[25,0,26,23],[29,0,26,18],[34,0,26,36],[41,0,26,28]],[[4,0,27,8],[12,0,28,12],[20,0,28,24],[28,0,28,12],[31,0,28,35],[35,0,28,40]],[[4,0,31,8],[12,0,31,20],[20,0,31,15],[21,0,31,29],[26,0,31,34],[32,0,31,15]],[],[]]
@@ -1,6 +1,3 @@
1
- import "@opcat-labs/scrypt-ts-opcat/assets/.templates/smart-contract/builtin-libs/txUtils.scrypt.tpl";
2
- import "@opcat-labs/scrypt-ts-opcat/assets/.templates/smart-contract/builtin-libs/contextUtils.scrypt.tpl";
3
-
4
1
 
5
2
  contract P2PKH {
6
3
  const Ripemd160 addr;
@@ -6,33 +6,33 @@ import "stdUtils.scrypt";
6
6
 
7
7
 
8
8
 
9
- struct _opcat_labs_scrypt_ts_opcat_2_0_0__rs__ChainTxVerifyResponse {
9
+ struct _opcat_labs_scrypt_ts_opcat_2_0_2__rs__ChainTxVerifyResponse {
10
10
  bytes prevPrevScript;
11
11
  bytes prevPrevOutpoint;
12
12
  }
13
13
 
14
- library _opcat_labs_scrypt_ts_opcat_2_0_0__rs__Backtrace {
15
- static function checkPrevTxHashPreimage(_opcat_labs_scrypt_ts_opcat_2_0_0__rs__TxHashPreimage txHashPreimage, bytes t_prevouts, int t_inputIndex) : bool {
16
- bytes txHash = _opcat_labs_scrypt_ts_opcat_2_0_0__rs__TxHashPreimageUtils.getTxHashFromTxHashPreimage(txHashPreimage);
14
+ library _opcat_labs_scrypt_ts_opcat_2_0_2__rs__Backtrace {
15
+ static function checkPrevTxHashPreimage(_opcat_labs_scrypt_ts_opcat_2_0_2__rs__TxHashPreimage txHashPreimage, bytes t_prevouts, int t_inputIndex) : bool {
16
+ bytes txHash = _opcat_labs_scrypt_ts_opcat_2_0_2__rs__TxHashPreimageUtils.getTxHashFromTxHashPreimage(txHashPreimage);
17
17
  require(txHash == t_prevouts[t_inputIndex * 36 : t_inputIndex * 36 + 32]);
18
18
  return true;
19
19
  }
20
- static function verifyFromOutpoint(_opcat_labs_scrypt_ts_opcat_2_0_0__rs__BacktraceInfo backtraceInfo, bytes t_genesisOutpoint, bytes t_selfScript, bytes t_prevTxInputList) : bool {
21
- _opcat_labs_scrypt_ts_opcat_2_0_0__rs__ChainTxVerifyResponse res = _opcat_labs_scrypt_ts_opcat_2_0_0__rs__Backtrace.verifyChainTxs(backtraceInfo, t_prevTxInputList);
20
+ static function verifyFromOutpoint(_opcat_labs_scrypt_ts_opcat_2_0_2__rs__BacktraceInfo backtraceInfo, bytes t_genesisOutpoint, bytes t_selfScript, bytes t_prevTxInputList) : bool {
21
+ _opcat_labs_scrypt_ts_opcat_2_0_2__rs__ChainTxVerifyResponse res = _opcat_labs_scrypt_ts_opcat_2_0_2__rs__Backtrace.verifyChainTxs(backtraceInfo, t_prevTxInputList);
22
22
  require(res.prevPrevOutpoint == t_genesisOutpoint || res.prevPrevScript == t_selfScript);
23
23
  return true;
24
24
  }
25
- static function verifyFromScript(_opcat_labs_scrypt_ts_opcat_2_0_0__rs__BacktraceInfo backtraceInfo, bytes t_genesisScript, bytes t_selfScript, bytes t_prevTxInputList) : bool {
26
- _opcat_labs_scrypt_ts_opcat_2_0_0__rs__ChainTxVerifyResponse res = _opcat_labs_scrypt_ts_opcat_2_0_0__rs__Backtrace.verifyChainTxs(backtraceInfo, t_prevTxInputList);
25
+ static function verifyFromScript(_opcat_labs_scrypt_ts_opcat_2_0_2__rs__BacktraceInfo backtraceInfo, bytes t_genesisScript, bytes t_selfScript, bytes t_prevTxInputList) : bool {
26
+ _opcat_labs_scrypt_ts_opcat_2_0_2__rs__ChainTxVerifyResponse res = _opcat_labs_scrypt_ts_opcat_2_0_2__rs__Backtrace.verifyChainTxs(backtraceInfo, t_prevTxInputList);
27
27
  require(res.prevPrevScript == t_genesisScript || res.prevPrevScript == t_selfScript);
28
28
  return true;
29
29
  }
30
- static function verifyChainTxs(_opcat_labs_scrypt_ts_opcat_2_0_0__rs__BacktraceInfo backtraceInfo, bytes t_prevTxInputList) : _opcat_labs_scrypt_ts_opcat_2_0_0__rs__ChainTxVerifyResponse {
31
- require(t_prevTxInputList[backtraceInfo.prevTxInputIndex * 72 : (backtraceInfo.prevTxInputIndex + 1) * 72] == _opcat_labs_scrypt_ts_opcat_2_0_0__rs__TxUtils.mergeInput(backtraceInfo.prevTxInput));
30
+ static function verifyChainTxs(_opcat_labs_scrypt_ts_opcat_2_0_2__rs__BacktraceInfo backtraceInfo, bytes t_prevTxInputList) : _opcat_labs_scrypt_ts_opcat_2_0_2__rs__ChainTxVerifyResponse {
31
+ require(t_prevTxInputList[backtraceInfo.prevTxInputIndex * 72 : (backtraceInfo.prevTxInputIndex + 1) * 72] == _opcat_labs_scrypt_ts_opcat_2_0_2__rs__TxUtils.mergeInput(backtraceInfo.prevTxInput));
32
32
  bytes prevPrevTxHash = backtraceInfo.prevTxInput.prevTxHash;
33
- require(prevPrevTxHash == _opcat_labs_scrypt_ts_opcat_2_0_0__rs__TxHashPreimageUtils.getTxHashFromTxHashPreimage(backtraceInfo.prevPrevTxPreimage));
33
+ require(prevPrevTxHash == _opcat_labs_scrypt_ts_opcat_2_0_2__rs__TxHashPreimageUtils.getTxHashFromTxHashPreimage(backtraceInfo.prevPrevTxPreimage));
34
34
  bytes prevPrevScript = backtraceInfo.prevPrevTxPreimage.outputList[backtraceInfo.prevTxInput.prevOutputIndex * 72 + 8 : (backtraceInfo.prevTxInput.prevOutputIndex) * 72 + 8 + 32];
35
- bytes prevPrevOutpoint = prevPrevTxHash + _opcat_labs_scrypt_ts_opcat_2_0_0__rs__StdUtils.uint32ToByteString(backtraceInfo.prevTxInput.prevOutputIndex);
35
+ bytes prevPrevOutpoint = prevPrevTxHash + _opcat_labs_scrypt_ts_opcat_2_0_2__rs__StdUtils.uint32ToByteString(backtraceInfo.prevTxInput.prevOutputIndex);
36
36
  return {prevPrevScript, prevPrevOutpoint};
37
37
  }
38
38
  }
@@ -3,7 +3,7 @@ import "stdUtils.scrypt";
3
3
 
4
4
 
5
5
 
6
- library _opcat_labs_scrypt_ts_opcat_2_0_0__rs__ByteStringReader {
6
+ library _opcat_labs_scrypt_ts_opcat_2_0_2__rs__ByteStringReader {
7
7
  bytes buf;
8
8
  int pos;
9
9
  constructor(bytes buf) {
@@ -23,15 +23,15 @@ library _opcat_labs_scrypt_ts_opcat_2_0_0__rs__ByteStringReader {
23
23
  l = header;
24
24
  ret = buf[this.pos : this.pos + l];
25
25
  } else if(header == 0x4c) {
26
- l = _opcat_labs_scrypt_ts_opcat_2_0_0__rs__StdUtils.fromLEUnsigned(buf[this.pos : this.pos + 1]);
26
+ l = _opcat_labs_scrypt_ts_opcat_2_0_2__rs__StdUtils.fromLEUnsigned(buf[this.pos : this.pos + 1]);
27
27
  this.pos += 1;
28
28
  ret = this.buf[this.pos : this.pos + l];
29
29
  } else if(header == 0x4d) {
30
- l = _opcat_labs_scrypt_ts_opcat_2_0_0__rs__StdUtils.fromLEUnsigned(this.buf[this.pos : this.pos + 2]);
30
+ l = _opcat_labs_scrypt_ts_opcat_2_0_2__rs__StdUtils.fromLEUnsigned(this.buf[this.pos : this.pos + 2]);
31
31
  this.pos += 2;
32
32
  ret = this.buf[this.pos : this.pos + l];
33
33
  } else if(header == 0x4e) {
34
- l = _opcat_labs_scrypt_ts_opcat_2_0_0__rs__StdUtils.fromLEUnsigned(this.buf[this.pos : this.pos + 4]);
34
+ l = _opcat_labs_scrypt_ts_opcat_2_0_2__rs__StdUtils.fromLEUnsigned(this.buf[this.pos : this.pos + 4]);
35
35
  this.pos += 4;
36
36
  ret = this.buf[this.pos : this.pos + l];
37
37
  } else {
@@ -61,6 +61,6 @@ library _opcat_labs_scrypt_ts_opcat_2_0_0__rs__ByteStringReader {
61
61
  } else {
62
62
  ret = header;
63
63
  }
64
- return _opcat_labs_scrypt_ts_opcat_2_0_0__rs__StdUtils.fromLEUnsigned(ret);
64
+ return _opcat_labs_scrypt_ts_opcat_2_0_2__rs__StdUtils.fromLEUnsigned(ret);
65
65
  }
66
66
  }
@@ -3,7 +3,7 @@ import "stdUtils.scrypt";
3
3
 
4
4
 
5
5
 
6
- library _opcat_labs_scrypt_ts_opcat_2_0_0__rs__ByteStringWriter {
6
+ library _opcat_labs_scrypt_ts_opcat_2_0_2__rs__ByteStringWriter {
7
7
  bytes buf;
8
8
  constructor() {
9
9
  this.buf = b'';
@@ -12,13 +12,13 @@ library _opcat_labs_scrypt_ts_opcat_2_0_0__rs__ByteStringWriter {
12
12
  int n = len(buf);
13
13
  bytes header = b'';
14
14
  if(n < 0x4c) {
15
- header = _opcat_labs_scrypt_ts_opcat_2_0_0__rs__StdUtils.toLEUnsigned(n, 1);
15
+ header = _opcat_labs_scrypt_ts_opcat_2_0_2__rs__StdUtils.toLEUnsigned(n, 1);
16
16
  } else if(n < 0x100) {
17
- header = b'4c' + _opcat_labs_scrypt_ts_opcat_2_0_0__rs__StdUtils.toLEUnsigned(n, 1);
17
+ header = b'4c' + _opcat_labs_scrypt_ts_opcat_2_0_2__rs__StdUtils.toLEUnsigned(n, 1);
18
18
  } else if(n < 0x10000) {
19
- header = b'4d' + _opcat_labs_scrypt_ts_opcat_2_0_0__rs__StdUtils.toLEUnsigned(n, 2);
19
+ header = b'4d' + _opcat_labs_scrypt_ts_opcat_2_0_2__rs__StdUtils.toLEUnsigned(n, 2);
20
20
  } else if(n < 0x100000000) {
21
- header = b'4e' + _opcat_labs_scrypt_ts_opcat_2_0_0__rs__StdUtils.toLEUnsigned(n, 4);
21
+ header = b'4e' + _opcat_labs_scrypt_ts_opcat_2_0_2__rs__StdUtils.toLEUnsigned(n, 4);
22
22
  } else {
23
23
  require(false);
24
24
  }
@@ -44,7 +44,7 @@ library _opcat_labs_scrypt_ts_opcat_2_0_0__rs__ByteStringWriter {
44
44
  size = 8;
45
45
  this.buf += b'ff';
46
46
  }
47
- this.buf += _opcat_labs_scrypt_ts_opcat_2_0_0__rs__StdUtils.toLEUnsigned(x, size);
47
+ this.buf += _opcat_labs_scrypt_ts_opcat_2_0_2__rs__StdUtils.toLEUnsigned(x, size);
48
48
  return true;
49
49
  }
50
50
  }
@@ -5,7 +5,7 @@ import "stdUtils.scrypt";
5
5
 
6
6
 
7
7
 
8
- library _opcat_labs_scrypt_ts_opcat_2_0_0__rs__ContextUtils {
8
+ library _opcat_labs_scrypt_ts_opcat_2_0_2__rs__ContextUtils {
9
9
  static const PrivKey privKey = PrivKey(0x26f00fe2340a84335ebdf30f57e9bb58487117b29355718f5e46bf5168d7df97);
10
10
  static const PubKey pubKey = PubKey(b'02ba79df5f8ae7604a9830f03c7933028186aede0675a16f025dc4f8be8eec0382');
11
11
  static const int invK = 0xc8ffdbaa05d93aa4ede79ec58f06a72562048b775a3507c2bf44bde4f007c40a;
@@ -18,7 +18,7 @@ library _opcat_labs_scrypt_ts_opcat_2_0_0__rs__ContextUtils {
18
18
  static function sign(int h, PrivKey privKey, int inverseK, int r, bytes rBigEndian, bytes sigHashType) : Sig {
19
19
  int s = inverseK * (h + r * privKey);
20
20
 
21
- s = _opcat_labs_scrypt_ts_opcat_2_0_0__rs__ContextUtils.normalize(s, 115792089237316195423570985008687907852837564279074904382605163141518161494337);
21
+ s = _opcat_labs_scrypt_ts_opcat_2_0_2__rs__ContextUtils.normalize(s, 115792089237316195423570985008687907852837564279074904382605163141518161494337);
22
22
  if(s > 115792089237316195423570985008687907852837564279074904382605163141518161494337 / 2) {
23
23
  s = 115792089237316195423570985008687907852837564279074904382605163141518161494337 - s;
24
24
  }
@@ -32,13 +32,13 @@ library _opcat_labs_scrypt_ts_opcat_2_0_0__rs__ContextUtils {
32
32
  static function fromBEUnsigned(bytes b) : int {
33
33
  return unpack(reverseBytes(b, 32) + b'00');
34
34
  }
35
- static function checkSHPreimage(_opcat_labs_scrypt_ts_opcat_2_0_0__rs__SHPreimage shPreimage, bytes sigHashType) : Sig {
36
- SigHashPreimage preimage = _opcat_labs_scrypt_ts_opcat_2_0_0__rs__ContextUtils.serializeSHPreimage(shPreimage);
35
+ static function checkSHPreimage(_opcat_labs_scrypt_ts_opcat_2_0_2__rs__SHPreimage shPreimage, bytes sigHashType) : Sig {
36
+ SigHashPreimage preimage = _opcat_labs_scrypt_ts_opcat_2_0_2__rs__ContextUtils.serializeSHPreimage(shPreimage);
37
37
  bytes h = hash256(preimage);
38
- Sig sig = _opcat_labs_scrypt_ts_opcat_2_0_0__rs__ContextUtils.sign(_opcat_labs_scrypt_ts_opcat_2_0_0__rs__ContextUtils.fromBEUnsigned(h), _opcat_labs_scrypt_ts_opcat_2_0_0__rs__ContextUtils.privKey, 90914631784428570546048907090666684794265392153046400654824470772421497439242, 7252565254521500021189571868467740368187828957595681190666767817830690399852, _opcat_labs_scrypt_ts_opcat_2_0_0__rs__ContextUtils.rBigEndian, sigHashType);
38
+ Sig sig = _opcat_labs_scrypt_ts_opcat_2_0_2__rs__ContextUtils.sign(_opcat_labs_scrypt_ts_opcat_2_0_2__rs__ContextUtils.fromBEUnsigned(h), _opcat_labs_scrypt_ts_opcat_2_0_2__rs__ContextUtils.privKey, 90914631784428570546048907090666684794265392153046400654824470772421497439242, 7252565254521500021189571868467740368187828957595681190666767817830690399852, _opcat_labs_scrypt_ts_opcat_2_0_2__rs__ContextUtils.rBigEndian, sigHashType);
39
39
  return sig;
40
40
  }
41
- static function serializeSHPreimage(_opcat_labs_scrypt_ts_opcat_2_0_0__rs__SHPreimage shPreimage) : SigHashPreimage {
41
+ static function serializeSHPreimage(_opcat_labs_scrypt_ts_opcat_2_0_2__rs__SHPreimage shPreimage) : SigHashPreimage {
42
42
  require(len(shPreimage.nVersion) == 4);
43
43
  require(len(shPreimage.hashPrevouts) == 32);
44
44
  require(len(shPreimage.spentScriptHash) == 32);
@@ -53,41 +53,41 @@ library _opcat_labs_scrypt_ts_opcat_2_0_0__rs__ContextUtils {
53
53
  require(shPreimage.inputIndex >= 0);
54
54
  require(shPreimage.nLockTime >= 0);
55
55
  require(shPreimage.sigHashType == 1 || shPreimage.sigHashType == 2 || shPreimage.sigHashType == 3 || shPreimage.sigHashType == 0x81 || shPreimage.sigHashType == 0x82 || shPreimage.sigHashType == 0x83);
56
- bytes preimage = shPreimage.nVersion + shPreimage.hashPrevouts + shPreimage.spentScriptHash + shPreimage.spentDataHash + _opcat_labs_scrypt_ts_opcat_2_0_0__rs__TxUtils.satoshisToByteString(shPreimage.value) + shPreimage.nSequence + shPreimage.hashSpentAmounts + shPreimage.hashSpentScriptHashes + shPreimage.hashSpentDataHashes + shPreimage.hashSequences + shPreimage.hashOutputs + _opcat_labs_scrypt_ts_opcat_2_0_0__rs__StdUtils.toLEUnsigned(shPreimage.inputIndex, 4) + _opcat_labs_scrypt_ts_opcat_2_0_0__rs__StdUtils.toLEUnsigned(shPreimage.nLockTime, 4) + num2bin(shPreimage.sigHashType, 4);
56
+ bytes preimage = shPreimage.nVersion + shPreimage.hashPrevouts + shPreimage.spentScriptHash + shPreimage.spentDataHash + _opcat_labs_scrypt_ts_opcat_2_0_2__rs__TxUtils.satoshisToByteString(shPreimage.value) + shPreimage.nSequence + shPreimage.hashSpentAmounts + shPreimage.hashSpentScriptHashes + shPreimage.hashSpentDataHashes + shPreimage.hashSequences + shPreimage.hashOutputs + _opcat_labs_scrypt_ts_opcat_2_0_2__rs__StdUtils.toLEUnsigned(shPreimage.inputIndex, 4) + _opcat_labs_scrypt_ts_opcat_2_0_2__rs__StdUtils.toLEUnsigned(shPreimage.nLockTime, 4) + num2bin(shPreimage.sigHashType, 4);
57
57
  return SigHashPreimage(preimage);
58
58
  }
59
- static function checkPrevouts(bytes prevouts, bytes t_hashPrevouts, int t_inputIndex, int t_inputCount) : _opcat_labs_scrypt_ts_opcat_2_0_0__rs__Outpoint {
59
+ static function checkPrevouts(bytes prevouts, bytes t_hashPrevouts, int t_inputIndex, int t_inputCount) : _opcat_labs_scrypt_ts_opcat_2_0_2__rs__Outpoint {
60
60
  require(hash256(prevouts) == t_hashPrevouts);
61
61
  require(t_inputIndex < t_inputCount);
62
- require(t_inputCount == _opcat_labs_scrypt_ts_opcat_2_0_0__rs__StdUtils.checkLenDivisibleBy(prevouts, 36));
62
+ require(t_inputCount == _opcat_labs_scrypt_ts_opcat_2_0_2__rs__StdUtils.checkLenDivisibleBy(prevouts, 36));
63
63
  bytes b = prevouts[t_inputIndex * 36 : (t_inputIndex + 1) * 36];
64
- return {b[0 : 32], _opcat_labs_scrypt_ts_opcat_2_0_0__rs__StdUtils.byteStringToUInt32(b[32 : 36])};
64
+ return {b[0 : 32], _opcat_labs_scrypt_ts_opcat_2_0_2__rs__StdUtils.byteStringToUInt32(b[32 : 36])};
65
65
  }
66
66
  static function checkSpentScripts(bytes spentScriptHashes, bytes t_hashSpentScripts, int t_inputCount) : bool {
67
67
  require(hash256(spentScriptHashes) == t_hashSpentScripts);
68
- require(t_inputCount == _opcat_labs_scrypt_ts_opcat_2_0_0__rs__StdUtils.checkLenDivisibleBy(spentScriptHashes, 32));
68
+ require(t_inputCount == _opcat_labs_scrypt_ts_opcat_2_0_2__rs__StdUtils.checkLenDivisibleBy(spentScriptHashes, 32));
69
69
  return true;
70
70
  }
71
71
  static function checkSpentAmounts(bytes spentAmounts, bytes hashSpentAmounts) : int {
72
72
  require(hash256(spentAmounts) == hashSpentAmounts);
73
- return _opcat_labs_scrypt_ts_opcat_2_0_0__rs__StdUtils.checkLenDivisibleBy(spentAmounts, 8);
73
+ return _opcat_labs_scrypt_ts_opcat_2_0_2__rs__StdUtils.checkLenDivisibleBy(spentAmounts, 8);
74
74
  }
75
75
  static function checkSpentDataHashes(bytes spentDataHashes, bytes hashSpentDataHashes, int inputCount) : bool {
76
76
  require(hash256(spentDataHashes) == hashSpentDataHashes);
77
- require(inputCount == _opcat_labs_scrypt_ts_opcat_2_0_0__rs__StdUtils.checkLenDivisibleBy(spentDataHashes, 32));
77
+ require(inputCount == _opcat_labs_scrypt_ts_opcat_2_0_2__rs__StdUtils.checkLenDivisibleBy(spentDataHashes, 32));
78
78
  return true;
79
79
  }
80
80
  static function getSpentScriptHash(bytes spentScriptHashes, int inputIndex) : bytes {
81
81
  return spentScriptHashes[inputIndex * 32 : (inputIndex + 1) * 32];
82
82
  }
83
83
  static function getSpentAmount(bytes spentAmounts, int inputIndex) : int {
84
- return _opcat_labs_scrypt_ts_opcat_2_0_0__rs__StdUtils.fromLEUnsigned(spentAmounts[inputIndex * 8 : (inputIndex + 1) * 8]);
84
+ return _opcat_labs_scrypt_ts_opcat_2_0_2__rs__StdUtils.fromLEUnsigned(spentAmounts[inputIndex * 8 : (inputIndex + 1) * 8]);
85
85
  }
86
86
  static function getSpentDataHash(bytes spentDataHashes, int inputIndex) : bytes {
87
87
  return spentDataHashes[inputIndex * 32 : (inputIndex + 1) * 32];
88
88
  }
89
- static function checknLockTime(_opcat_labs_scrypt_ts_opcat_2_0_0__rs__SHPreimage shPreimage, int nlockTime) : bool {
90
- int nSequence = _opcat_labs_scrypt_ts_opcat_2_0_0__rs__StdUtils.fromLEUnsigned(shPreimage.nSequence);
89
+ static function checknLockTime(_opcat_labs_scrypt_ts_opcat_2_0_2__rs__SHPreimage shPreimage, int nlockTime) : bool {
90
+ int nSequence = _opcat_labs_scrypt_ts_opcat_2_0_2__rs__StdUtils.fromLEUnsigned(shPreimage.nSequence);
91
91
  return (nSequence < 4294967295 && (nlockTime < 500000000 ? shPreimage.nLockTime < 500000000 : true) && shPreimage.nLockTime >= nlockTime);
92
92
  }
93
93
  }
@@ -1,10 +1,7 @@
1
- import "txUtils.scrypt";
2
- import "contextUtils.scrypt";
3
1
 
4
2
 
5
3
 
6
-
7
- contract _opcat_labs_scrypt_ts_opcat_2_0_0__rs__P2PK {
4
+ contract _opcat_labs_scrypt_ts_opcat_2_0_2__rs__P2PK {
8
5
  const PubKey pubKey;
9
6
  public function unlock(Sig sig) {
10
7
  require(checkSig(sig, this.pubKey));
@@ -1,10 +1,7 @@
1
- import "txUtils.scrypt";
2
- import "contextUtils.scrypt";
3
1
 
4
2
 
5
3
 
6
-
7
- contract _opcat_labs_scrypt_ts_opcat_2_0_0__rs__P2PKH {
4
+ contract _opcat_labs_scrypt_ts_opcat_2_0_2__rs__P2PKH {
8
5
  const Ripemd160 addr;
9
6
  public function unlock(Sig sig, PubKey pubkey) {
10
7
  require(hash160(pubkey) == this.addr);
@@ -1,5 +1,5 @@
1
1
 
2
2
 
3
3
 
4
- library _opcat_labs_scrypt_ts_opcat_2_0_0__rs__StateLib {
4
+ library _opcat_labs_scrypt_ts_opcat_2_0_2__rs__StateLib {
5
5
  }
@@ -1,7 +1,7 @@
1
1
 
2
2
 
3
3
 
4
- library _opcat_labs_scrypt_ts_opcat_2_0_0__rs__StateUtils {
4
+ library _opcat_labs_scrypt_ts_opcat_2_0_2__rs__StateUtils {
5
5
  static function checkInputState(int t_inputIndex, bytes stateHash, bytes t_spentDataHashes) : bool {
6
6
  require(t_spentDataHashes[t_inputIndex * 32 : (t_inputIndex + 1) * 32] == stateHash);
7
7
  return true;
@@ -1,12 +1,12 @@
1
1
 
2
2
 
3
3
 
4
- struct _opcat_labs_scrypt_ts_opcat_2_0_0__rs__ReadVarintResult {
4
+ struct _opcat_labs_scrypt_ts_opcat_2_0_2__rs__ReadVarintResult {
5
5
  bytes data;
6
6
  int nextPos;
7
7
  }
8
8
 
9
- library _opcat_labs_scrypt_ts_opcat_2_0_0__rs__StdUtils {
9
+ library _opcat_labs_scrypt_ts_opcat_2_0_2__rs__StdUtils {
10
10
  static function checkLenDivisibleBy(bytes b, int n) : int {
11
11
  int l = len(b);
12
12
  require(l % n == 0);
@@ -14,15 +14,15 @@ library _opcat_labs_scrypt_ts_opcat_2_0_0__rs__StdUtils {
14
14
  }
15
15
  static function uint64ToByteString(int n) : bytes {
16
16
  require(n >= 0 && n <= 18446744073709551615);
17
- return _opcat_labs_scrypt_ts_opcat_2_0_0__rs__StdUtils.toLEUnsigned(n, 8);
17
+ return _opcat_labs_scrypt_ts_opcat_2_0_2__rs__StdUtils.toLEUnsigned(n, 8);
18
18
  }
19
19
  static function uint32ToByteString(int n) : bytes {
20
20
  require(n >= 0 && n <= 4294967295);
21
- return _opcat_labs_scrypt_ts_opcat_2_0_0__rs__StdUtils.toLEUnsigned(n, 4);
21
+ return _opcat_labs_scrypt_ts_opcat_2_0_2__rs__StdUtils.toLEUnsigned(n, 4);
22
22
  }
23
23
  static function byteStringToUInt32(bytes b) : int {
24
24
  require(len(b) == 4);
25
- return _opcat_labs_scrypt_ts_opcat_2_0_0__rs__StdUtils.fromLEUnsigned(b);
25
+ return _opcat_labs_scrypt_ts_opcat_2_0_2__rs__StdUtils.fromLEUnsigned(b);
26
26
  }
27
27
  static function toLEUnsigned(int n, int l) : bytes {
28
28
  bytes m = num2bin(n, l + 1);
@@ -46,7 +46,7 @@ library _opcat_labs_scrypt_ts_opcat_2_0_0__rs__StdUtils {
46
46
  b = b'ff';
47
47
  size = 8;
48
48
  }
49
- return b + _opcat_labs_scrypt_ts_opcat_2_0_0__rs__StdUtils.toLEUnsigned(n, size);
49
+ return b + _opcat_labs_scrypt_ts_opcat_2_0_2__rs__StdUtils.toLEUnsigned(n, size);
50
50
  }
51
51
  static function pushData(bytes buf) : bytes {
52
52
  int n = len(buf);
@@ -67,27 +67,27 @@ library _opcat_labs_scrypt_ts_opcat_2_0_0__rs__StdUtils {
67
67
  } else {
68
68
  require(false);
69
69
  }
70
- return header + _opcat_labs_scrypt_ts_opcat_2_0_0__rs__StdUtils.toLEUnsigned(n, size);
70
+ return header + _opcat_labs_scrypt_ts_opcat_2_0_2__rs__StdUtils.toLEUnsigned(n, size);
71
71
  }
72
- static function readVarint(bytes buf, int pos) : _opcat_labs_scrypt_ts_opcat_2_0_0__rs__ReadVarintResult {
72
+ static function readVarint(bytes buf, int pos) : _opcat_labs_scrypt_ts_opcat_2_0_2__rs__ReadVarintResult {
73
73
  int l = 0;
74
74
  bytes ret = b'';
75
75
  int nextPos = pos;
76
76
  bytes header = buf[pos : pos + 1];
77
77
  if(header == b'fd') {
78
- l = _opcat_labs_scrypt_ts_opcat_2_0_0__rs__StdUtils.fromLEUnsigned(buf[pos + 1 : pos + 3]);
78
+ l = _opcat_labs_scrypt_ts_opcat_2_0_2__rs__StdUtils.fromLEUnsigned(buf[pos + 1 : pos + 3]);
79
79
  ret = buf[3 : 3 + l];
80
80
  nextPos = pos + 3 + l;
81
81
  } else if(header == b'fe') {
82
- l = _opcat_labs_scrypt_ts_opcat_2_0_0__rs__StdUtils.fromLEUnsigned(buf[pos + 1 : pos + 5]);
82
+ l = _opcat_labs_scrypt_ts_opcat_2_0_2__rs__StdUtils.fromLEUnsigned(buf[pos + 1 : pos + 5]);
83
83
  ret = buf[pos + 5 : pos + 5 + l];
84
84
  nextPos = pos + 5 + l;
85
85
  } else if(header == b'ff') {
86
- l = _opcat_labs_scrypt_ts_opcat_2_0_0__rs__StdUtils.fromLEUnsigned(buf[pos + 1 : pos + 9]);
86
+ l = _opcat_labs_scrypt_ts_opcat_2_0_2__rs__StdUtils.fromLEUnsigned(buf[pos + 1 : pos + 9]);
87
87
  ret = buf[pos + 9 : pos + 9 + l];
88
88
  nextPos = pos + 9 + l;
89
89
  } else {
90
- l = _opcat_labs_scrypt_ts_opcat_2_0_0__rs__StdUtils.fromLEUnsigned(buf[pos : pos + 1]);
90
+ l = _opcat_labs_scrypt_ts_opcat_2_0_2__rs__StdUtils.fromLEUnsigned(buf[pos : pos + 1]);
91
91
  ret = buf[pos + 1 : pos + 1 + l];
92
92
  nextPos = pos + 1 + l;
93
93
  }
@@ -4,17 +4,17 @@ import "stdUtils.scrypt";
4
4
 
5
5
 
6
6
 
7
- library _opcat_labs_scrypt_ts_opcat_2_0_0__rs__TxHashPreimageUtils {
8
- static function getTxHashFromTxHashPreimage(_opcat_labs_scrypt_ts_opcat_2_0_0__rs__TxHashPreimage txHashPreimage) : bytes {
7
+ library _opcat_labs_scrypt_ts_opcat_2_0_2__rs__TxHashPreimageUtils {
8
+ static function getTxHashFromTxHashPreimage(_opcat_labs_scrypt_ts_opcat_2_0_2__rs__TxHashPreimage txHashPreimage) : bytes {
9
9
  require(len(txHashPreimage.version) == 4);
10
- int inputCount = _opcat_labs_scrypt_ts_opcat_2_0_0__rs__StdUtils.checkLenDivisibleBy(txHashPreimage.inputList, 72);
11
- int outputCount = _opcat_labs_scrypt_ts_opcat_2_0_0__rs__StdUtils.checkLenDivisibleBy(txHashPreimage.outputList, 72);
12
- return hash256(txHashPreimage.version + _opcat_labs_scrypt_ts_opcat_2_0_0__rs__StdUtils.writeVarInt(inputCount) + txHashPreimage.inputList + _opcat_labs_scrypt_ts_opcat_2_0_0__rs__StdUtils.writeVarInt(outputCount) + txHashPreimage.outputList + txHashPreimage.nLockTime);
10
+ int inputCount = _opcat_labs_scrypt_ts_opcat_2_0_2__rs__StdUtils.checkLenDivisibleBy(txHashPreimage.inputList, 72);
11
+ int outputCount = _opcat_labs_scrypt_ts_opcat_2_0_2__rs__StdUtils.checkLenDivisibleBy(txHashPreimage.outputList, 72);
12
+ return hash256(txHashPreimage.version + _opcat_labs_scrypt_ts_opcat_2_0_2__rs__StdUtils.writeVarInt(inputCount) + txHashPreimage.inputList + _opcat_labs_scrypt_ts_opcat_2_0_2__rs__StdUtils.writeVarInt(outputCount) + txHashPreimage.outputList + txHashPreimage.nLockTime);
13
13
  }
14
- static function getInputByteString(_opcat_labs_scrypt_ts_opcat_2_0_0__rs__TxHashPreimage txHashPreimage, int inputIndex) : bytes {
14
+ static function getInputByteString(_opcat_labs_scrypt_ts_opcat_2_0_2__rs__TxHashPreimage txHashPreimage, int inputIndex) : bytes {
15
15
  return txHashPreimage.inputList[inputIndex * 72 : (inputIndex + 1) * 72];
16
16
  }
17
- static function getOutputByteString(_opcat_labs_scrypt_ts_opcat_2_0_0__rs__TxHashPreimage txHashPreimage, int outputIndex) : bytes {
17
+ static function getOutputByteString(_opcat_labs_scrypt_ts_opcat_2_0_2__rs__TxHashPreimage txHashPreimage, int outputIndex) : bytes {
18
18
  return txHashPreimage.outputList[outputIndex * 72 : (outputIndex + 1) * 72];
19
19
  }
20
20
  }
@@ -4,10 +4,10 @@ import "stdUtils.scrypt";
4
4
 
5
5
 
6
6
 
7
- library _opcat_labs_scrypt_ts_opcat_2_0_0__rs__TxUtils {
7
+ library _opcat_labs_scrypt_ts_opcat_2_0_2__rs__TxUtils {
8
8
  static const int ZERO_SATS = 0;
9
9
  static function buildOutput(bytes scriptHash, int satoshis) : bytes {
10
- return _opcat_labs_scrypt_ts_opcat_2_0_0__rs__TxUtils.buildDataOutput(scriptHash, satoshis, sha256(b''));
10
+ return _opcat_labs_scrypt_ts_opcat_2_0_2__rs__TxUtils.buildDataOutput(scriptHash, satoshis, sha256(b''));
11
11
  }
12
12
  static function buildDataOutput(bytes scriptHash, int satoshis, bytes dataHash) : bytes {
13
13
  int scriptHashLen = len(scriptHash);
@@ -15,34 +15,34 @@ library _opcat_labs_scrypt_ts_opcat_2_0_0__rs__TxUtils {
15
15
  require(scriptHashLen == 32);
16
16
  require(dataHashLen == 32);
17
17
  require(satoshis >= 0);
18
- return _opcat_labs_scrypt_ts_opcat_2_0_0__rs__TxUtils.satoshisToByteString(satoshis) + scriptHash + dataHash;
18
+ return _opcat_labs_scrypt_ts_opcat_2_0_2__rs__TxUtils.satoshisToByteString(satoshis) + scriptHash + dataHash;
19
19
  }
20
- static function buildChangeOutput(_opcat_labs_scrypt_ts_opcat_2_0_0__rs__TxOut change) : bytes {
21
- return change.satoshis > 0 ? _opcat_labs_scrypt_ts_opcat_2_0_0__rs__TxUtils.buildDataOutput(change.scriptHash, change.satoshis, change.dataHash) : b'';
20
+ static function buildChangeOutput(_opcat_labs_scrypt_ts_opcat_2_0_2__rs__TxOut change) : bytes {
21
+ return change.satoshis > 0 ? _opcat_labs_scrypt_ts_opcat_2_0_2__rs__TxUtils.buildDataOutput(change.scriptHash, change.satoshis, change.dataHash) : b'';
22
22
  }
23
- static function mergeInput(_opcat_labs_scrypt_ts_opcat_2_0_0__rs__TxIn txInput) : bytes {
23
+ static function mergeInput(_opcat_labs_scrypt_ts_opcat_2_0_2__rs__TxIn txInput) : bytes {
24
24
  require(len(txInput.prevTxHash) == 32);
25
25
  require(len(txInput.scriptHash) == 32);
26
- return (txInput.prevTxHash + _opcat_labs_scrypt_ts_opcat_2_0_0__rs__StdUtils.uint32ToByteString(txInput.prevOutputIndex) + txInput.scriptHash + _opcat_labs_scrypt_ts_opcat_2_0_0__rs__StdUtils.uint32ToByteString(txInput.sequence));
26
+ return (txInput.prevTxHash + _opcat_labs_scrypt_ts_opcat_2_0_2__rs__StdUtils.uint32ToByteString(txInput.prevOutputIndex) + txInput.scriptHash + _opcat_labs_scrypt_ts_opcat_2_0_2__rs__StdUtils.uint32ToByteString(txInput.sequence));
27
27
  }
28
28
  static function buildOpReturnOutput(bytes data) : bytes {
29
29
  bytes script = b'6a' + pack(len(data)) + data;
30
- return _opcat_labs_scrypt_ts_opcat_2_0_0__rs__TxUtils.satoshisToByteString(0) + sha256(script) + sha256(b'');
30
+ return _opcat_labs_scrypt_ts_opcat_2_0_2__rs__TxUtils.satoshisToByteString(0) + sha256(script) + sha256(b'');
31
31
  }
32
32
  static function buildP2PKHScript(Ripemd160 addr) : bytes {
33
33
  return (OpCode.OP_DUP + OpCode.OP_HASH160 + pack(20) + addr + OpCode.OP_EQUALVERIFY + OpCode.OP_CHECKSIG);
34
34
  }
35
35
  static function buildP2PKHOutput(int amount, Ripemd160 addr) : bytes {
36
- return _opcat_labs_scrypt_ts_opcat_2_0_0__rs__TxUtils.buildDataOutput(sha256(_opcat_labs_scrypt_ts_opcat_2_0_0__rs__TxUtils.buildP2PKHScript(addr)), amount, sha256(b''));
36
+ return _opcat_labs_scrypt_ts_opcat_2_0_2__rs__TxUtils.buildDataOutput(sha256(_opcat_labs_scrypt_ts_opcat_2_0_2__rs__TxUtils.buildP2PKHScript(addr)), amount, sha256(b''));
37
37
  }
38
38
  static function buildOpreturnScript(bytes data) : bytes {
39
- return OpCode.OP_FALSE + OpCode.OP_RETURN + _opcat_labs_scrypt_ts_opcat_2_0_0__rs__StdUtils.pushData(data);
39
+ return OpCode.OP_FALSE + OpCode.OP_RETURN + _opcat_labs_scrypt_ts_opcat_2_0_2__rs__StdUtils.pushData(data);
40
40
  }
41
41
  static function satoshisToByteString(int n) : bytes {
42
- return _opcat_labs_scrypt_ts_opcat_2_0_0__rs__StdUtils.uint64ToByteString(n);
42
+ return _opcat_labs_scrypt_ts_opcat_2_0_2__rs__StdUtils.uint64ToByteString(n);
43
43
  }
44
44
  static function byteStringToSatoshis(bytes bs) : int {
45
45
  require(len(bs) == 8);
46
- return _opcat_labs_scrypt_ts_opcat_2_0_0__rs__StdUtils.fromLEUnsigned(bs);
46
+ return _opcat_labs_scrypt_ts_opcat_2_0_2__rs__StdUtils.fromLEUnsigned(bs);
47
47
  }
48
48
  }
@@ -1,33 +1,33 @@
1
1
 
2
2
 
3
3
 
4
- struct _opcat_labs_scrypt_ts_opcat_2_0_0__rs__TxOut {
4
+ struct _opcat_labs_scrypt_ts_opcat_2_0_2__rs__TxOut {
5
5
  bytes scriptHash;
6
6
  bytes dataHash;
7
7
  int satoshis;
8
8
  }
9
9
 
10
- struct _opcat_labs_scrypt_ts_opcat_2_0_0__rs__TxIn {
10
+ struct _opcat_labs_scrypt_ts_opcat_2_0_2__rs__TxIn {
11
11
  bytes prevTxHash;
12
12
  int prevOutputIndex;
13
13
  int sequence;
14
14
  bytes scriptHash;
15
15
  }
16
16
 
17
- struct _opcat_labs_scrypt_ts_opcat_2_0_0__rs__TxHashPreimage {
17
+ struct _opcat_labs_scrypt_ts_opcat_2_0_2__rs__TxHashPreimage {
18
18
  bytes version;
19
19
  bytes inputList;
20
20
  bytes outputList;
21
21
  bytes nLockTime;
22
22
  }
23
23
 
24
- struct _opcat_labs_scrypt_ts_opcat_2_0_0__rs__BacktraceInfo {
25
- _opcat_labs_scrypt_ts_opcat_2_0_0__rs__TxIn prevTxInput;
24
+ struct _opcat_labs_scrypt_ts_opcat_2_0_2__rs__BacktraceInfo {
25
+ _opcat_labs_scrypt_ts_opcat_2_0_2__rs__TxIn prevTxInput;
26
26
  int prevTxInputIndex;
27
- _opcat_labs_scrypt_ts_opcat_2_0_0__rs__TxHashPreimage prevPrevTxPreimage;
27
+ _opcat_labs_scrypt_ts_opcat_2_0_2__rs__TxHashPreimage prevPrevTxPreimage;
28
28
  }
29
29
 
30
- struct _opcat_labs_scrypt_ts_opcat_2_0_0__rs__SHPreimage {
30
+ struct _opcat_labs_scrypt_ts_opcat_2_0_2__rs__SHPreimage {
31
31
  bytes nVersion;
32
32
  bytes hashPrevouts;
33
33
  bytes spentScriptHash;
@@ -44,7 +44,7 @@ struct _opcat_labs_scrypt_ts_opcat_2_0_0__rs__SHPreimage {
44
44
  int sigHashType;
45
45
  }
46
46
 
47
- struct _opcat_labs_scrypt_ts_opcat_2_0_0__rs__Outpoint {
47
+ struct _opcat_labs_scrypt_ts_opcat_2_0_2__rs__Outpoint {
48
48
  bytes txHash;
49
49
  int outputIndex;
50
50
  }
@@ -27,7 +27,6 @@ exports.DummyProvider = void 0;
27
27
  const utxoProvider_js_1 = require('./utxoProvider.cjs');
28
28
  const utils = __importStar(require("@noble/hashes/utils"));
29
29
  const opcat_1 = require("@opcat-labs/opcat");
30
- const extPsbt_js_1 = require('../psbt/extPsbt.cjs');
31
30
  /**
32
31
  * A DummyProvider is build for test purpose only, it always returns a dummy utxo for `getUtxos` request.
33
32
  * @category Provider
@@ -93,11 +92,6 @@ class DummyProvider {
93
92
  this.broadcastedTxs.set(tx.id, txHex);
94
93
  return tx.id;
95
94
  }
96
- async broadcastPsbt(psbtBase64, metadata) {
97
- const psbt = extPsbt_js_1.ExtPsbt.fromBase64(psbtBase64);
98
- const txHex = psbt.extractTransaction().toHex();
99
- return this.broadcast(txHex);
100
- }
101
95
  async getRawTransaction(txId) {
102
96
  const txHex = this.broadcastedTxs.get(txId);
103
97
  if (!txHex) {
@@ -105,10 +99,6 @@ class DummyProvider {
105
99
  }
106
100
  return txHex;
107
101
  }
108
- async getMedianTime() {
109
- // Return current timestamp minus 10 minutes (600 seconds)
110
- return Math.floor(Date.now() / 1000) - 600;
111
- }
112
102
  }
113
103
  exports.DummyProvider = DummyProvider;
114
104
  //# sourceMappingURL=dummyProvider.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"dummyProvider.js","sourceRoot":"","sources":["../../../src/providers/dummyProvider.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,uDAA+E;AAC/E,2DAA6C;AAC7C,6CAAwD;AACxD,mDAA6C;AAE7C;;;GAGG;AACH,MAAa,aAAa;IAMxB,YAA6B,UAA4B,eAAe;QAA3C,YAAO,GAAP,OAAO,CAAoC;QALhE,mBAAc,GAAwB,IAAI,GAAG,EAAE,CAAC;QAChD,eAAU,GAAG,IAAI,GAAG,EAAU,CAAC;QAE/B,aAAQ,GAAG,IAAI,GAAG,EAAgB,CAAC;IAG3C,CAAC;IACD,KAAK,CAAC,UAAU;QACd,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IACD,KAAK,CAAC,QAAQ,CAAC,OAAe,EAAE,QAA2B;QACzD,MAAM,MAAM,GAAG,cAAM,CAAC,WAAW,CAAC,OAAO,CAAC,CAAA;QAE1C,MAAM,OAAO,GAAG,IAAI,mBAAW,EAAE,CAAC;QAClC,OAAO,CAAC,QAAQ,CAAC,IAAI,mBAAW,CAAC,KAAK,CAAC;YACrC,QAAQ,EAAE,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;YAC5C,WAAW,EAAE,CAAC;YACd,MAAM,EAAE,cAAM,CAAC,KAAK,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CAAC;QAC5C,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,MAAM,IAAI,KAAK,CACb,+BAA+B,IAAI,uDAAuD,CAC3F,CAAC;QACJ,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;CACF;AA7ED,sCA6EC"}
@@ -8,7 +8,6 @@ const cross_fetch_1 = __importDefault(require("cross-fetch"));
8
8
  const utxoProvider_js_1 = require('./utxoProvider.cjs');
9
9
  const common_js_1 = require('../utils/common.cjs');
10
10
  const opcat_1 = require("@opcat-labs/opcat");
11
- const extPsbt_js_1 = require('../psbt/extPsbt.cjs');
12
11
  /**
13
12
  * The MempoolProvider is backed by [Mempool]{@link https://opcatlabs.io}
14
13
  * @category Provider
@@ -177,11 +176,6 @@ class MempoolProvider {
177
176
  this.broadcastedTxs.set(res, txHex);
178
177
  return res;
179
178
  }
180
- async broadcastPsbt(psbtBase64, metadata) {
181
- const psbt = extPsbt_js_1.ExtPsbt.fromBase64(psbtBase64);
182
- const txHex = psbt.extractTransaction().toHex();
183
- return this.broadcast(txHex);
184
- }
185
179
  async getRawTransaction(txId) {
186
180
  let txHex = this.broadcastedTxs.get(txId);
187
181
  if (!txHex) {
@@ -209,44 +203,6 @@ class MempoolProvider {
209
203
  return e;
210
204
  });
211
205
  }
212
- async getMedianTime() {
213
- // First get the tip block hash
214
- const tipHashUrl = `${this.getMempoolApiHost()}/api/blocks/tip/hash`;
215
- const tipHash = await (0, cross_fetch_1.default)(tipHashUrl, {})
216
- .then((res) => {
217
- if (res.status !== 200) {
218
- throw new Error(`invalid http response code: ${res.status}`);
219
- }
220
- return res.text();
221
- })
222
- .catch((e) => {
223
- throw new Error(`Failed to get tip block hash: ${e.message}`);
224
- });
225
- // Then get the block data to extract mediantime
226
- const blockUrl = `${this.getMempoolApiHost()}/api/block/${tipHash}`;
227
- return (0, cross_fetch_1.default)(blockUrl, {})
228
- .then((res) => {
229
- if (res.status !== 200) {
230
- throw new Error(`invalid http response code: ${res.status}`);
231
- }
232
- const contentType = res.headers.get('content-type');
233
- if (contentType.includes('json')) {
234
- return res.json();
235
- }
236
- else {
237
- throw new Error(`invalid http content type: ${contentType}`);
238
- }
239
- })
240
- .then((blockData) => {
241
- if (typeof blockData.mediantime !== 'number') {
242
- throw new Error(`Invalid block data: mediantime not found`);
243
- }
244
- return blockData.mediantime;
245
- })
246
- .catch((e) => {
247
- throw new Error(`Failed to get median time: ${e.message}`);
248
- });
249
- }
250
206
  }
251
207
  exports.MempoolProvider = MempoolProvider;
252
208
  //# sourceMappingURL=mempoolProvider.js.map