@opcat-labs/scrypt-ts-opcat 3.2.0 → 3.4.0

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 (45) hide show
  1. package/assets/.templates/smart-contract/builtin-libs/stdUtils.scrypt.map +1 -1
  2. package/assets/.templates/smart-contract/builtin-libs/stdUtils.scrypt.tpl +1 -1
  3. package/assets/.templates/smart-contract/types/structs.scrypt.tpl +7 -1
  4. package/assets/smart-contract/builtin-libs/backtrace.scrypt +13 -13
  5. package/assets/smart-contract/builtin-libs/byteStringReader.scrypt +5 -5
  6. package/assets/smart-contract/builtin-libs/byteStringWriter.scrypt +6 -6
  7. package/assets/smart-contract/builtin-libs/contextUtils.scrypt +16 -16
  8. package/assets/smart-contract/builtin-libs/genesis.scrypt +8 -8
  9. package/assets/smart-contract/builtin-libs/p2pk.scrypt +1 -1
  10. package/assets/smart-contract/builtin-libs/p2pkh.scrypt +1 -1
  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 +13 -13
  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/psbt/extPsbt.cjs +14 -4
  18. package/dist/cjs/psbt/extPsbt.js.map +1 -1
  19. package/dist/cjs/smart-contract/builtin-libs/stdUtils.cjs +1 -1
  20. package/dist/cjs/smart-contract/builtin-libs/stdUtils.js.map +1 -1
  21. package/dist/cjs/smart-contract/methods/buildOutput.cjs +3 -1
  22. package/dist/cjs/smart-contract/methods/buildOutput.js.map +1 -1
  23. package/dist/cjs/smart-contract/types/index.js.map +1 -1
  24. package/dist/esm/psbt/extPsbt.js +15 -5
  25. package/dist/esm/psbt/extPsbt.js.map +1 -1
  26. package/dist/esm/smart-contract/builtin-libs/stdUtils.js +1 -1
  27. package/dist/esm/smart-contract/builtin-libs/stdUtils.js.map +1 -1
  28. package/dist/esm/smart-contract/methods/buildOutput.js +3 -1
  29. package/dist/esm/smart-contract/methods/buildOutput.js.map +1 -1
  30. package/dist/esm/smart-contract/types/index.js.map +1 -1
  31. package/dist/types/psbt/extPsbt.d.ts +5 -4
  32. package/dist/types/psbt/extPsbt.d.ts.map +1 -1
  33. package/dist/types/smart-contract/methods/buildOutput.d.ts.map +1 -1
  34. package/dist/types/smart-contract/smartContract.d.ts +1 -1
  35. package/dist/types/smart-contract/smartContract.d.ts.map +1 -1
  36. package/dist/types/smart-contract/types/context.d.ts +2 -2
  37. package/dist/types/smart-contract/types/context.d.ts.map +1 -1
  38. package/dist/types/smart-contract/types/index.d.ts +1 -1
  39. package/dist/types/smart-contract/types/index.d.ts.map +1 -1
  40. package/dist/types/smart-contract/types/structs.d.ts +20 -1
  41. package/dist/types/smart-contract/types/structs.d.ts.map +1 -1
  42. package/package.json +2 -2
  43. package/scrypt.index.json +4 -0
  44. package/src/smart-contract/builtin-libs/stdUtils.ts +1 -1
  45. package/src/smart-contract/types/structs.ts +21 -1
@@ -189,7 +189,7 @@ export class StdUtils extends SmartContractLib {
189
189
 
190
190
  if (header == toByteString('fd')) {
191
191
  l = StdUtils.fromLEUnsigned(slice(buf, pos + 1n, pos + 3n));
192
- ret = slice(buf, 3n, 3n + l);
192
+ ret = slice(buf, pos + 3n, pos + 3n + l);
193
193
  nextPos = pos + 3n + l;
194
194
  }
195
195
  else if (header == toByteString('fe')) {
@@ -1,4 +1,4 @@
1
- import { ByteString, Int32, UInt32, UInt64 } from './primitives.js';
1
+ import { ByteString, Int32, UInt32, UInt64, Ripemd160, Sha256 } from './primitives.js';
2
2
 
3
3
  /**
4
4
  * The structure used to refer to a particular transaction output
@@ -241,4 +241,24 @@ export type BacktraceInfo = {
241
241
  prevPrevTxPreimage: TxHashPreimage;
242
242
  };
243
243
 
244
+ /**
245
+ * A structure representing the change output information
246
+ * @category Types
247
+ * @onchain
248
+ */
249
+ export type ChangeInfo = {
250
+ /**
251
+ * 20 bytes. The public key hash (hash160 of public key) for P2PKH output
252
+ */
253
+ pubkeyhash: Ripemd160;
254
+ /**
255
+ * 8 bytes. The satoshi amount for the change output
256
+ */
257
+ satoshis: UInt64;
258
+ /**
259
+ * 32 bytes. The SHA256 hash of the output data
260
+ */
261
+ dataHash: Sha256;
262
+ };
263
+
244
264