@vbyte/btc-dev 1.1.4 → 1.1.5

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/module.mjs CHANGED
@@ -8311,6 +8311,16 @@ var _const = /*#__PURE__*/Object.freeze({
8311
8311
  TX_SIZE: TX_SIZE
8312
8312
  });
8313
8313
 
8314
+ function is_return_script(script) {
8315
+ const bytes = Buff.bytes(script);
8316
+ return bytes.at(0) === 0x6a;
8317
+ }
8318
+ function get_lock_script_info(script) {
8319
+ return {
8320
+ type: get_lock_script_type(script),
8321
+ version: get_lock_script_version(script)
8322
+ };
8323
+ }
8314
8324
  function get_lock_script_type(script) {
8315
8325
  const hex = Buff.bytes(script).hex;
8316
8326
  for (const [type, regex] of Object.entries(LOCK_SCRIPT_REGEX)) {
@@ -8319,6 +8329,14 @@ function get_lock_script_type(script) {
8319
8329
  }
8320
8330
  return null;
8321
8331
  }
8332
+ function get_lock_script_version(script) {
8333
+ const version = Buff.bytes(script);
8334
+ switch (version.at(0)) {
8335
+ case 0x00: return 0;
8336
+ case 0x51: return 1;
8337
+ default: return null;
8338
+ }
8339
+ }
8322
8340
  function is_p2pkh_script(script) {
8323
8341
  const hex = Buff.bytes(script).hex;
8324
8342
  return LOCK_SCRIPT_REGEX['p2pkh'].test(hex);
@@ -8339,6 +8357,10 @@ function is_p2tr_script(script) {
8339
8357
  const hex = Buff.bytes(script).hex;
8340
8358
  return LOCK_SCRIPT_REGEX['p2tr'].test(hex);
8341
8359
  }
8360
+ function is_opreturn_script(script) {
8361
+ const hex = Buff.bytes(script).hex;
8362
+ return LOCK_SCRIPT_REGEX['opreturn'].test(hex);
8363
+ }
8342
8364
 
8343
8365
  function get_address_script(script_key, script_type) {
8344
8366
  switch (script_type) {
@@ -9393,13 +9415,10 @@ function parse_script_pubkeys(script) {
9393
9415
 
9394
9416
  var ScriptUtil;
9395
9417
  (function (ScriptUtil) {
9396
- ScriptUtil.prefix_size = prefix_script_size;
9397
9418
  ScriptUtil.parse = parse_script;
9398
9419
  ScriptUtil.decode = decode_script;
9399
9420
  ScriptUtil.encode = encode_script;
9400
9421
  ScriptUtil.is_valid = is_valid_script;
9401
- ScriptUtil.get_pubkeys = parse_script_pubkeys;
9402
- ScriptUtil.OPCODES = OPCODE_MAP;
9403
9422
  })(ScriptUtil || (ScriptUtil = {}));
9404
9423
 
9405
9424
  var index$6 = /*#__PURE__*/Object.freeze({
@@ -9410,9 +9429,19 @@ var index$6 = /*#__PURE__*/Object.freeze({
9410
9429
  encode_script: encode_script,
9411
9430
  encode_script_word: encode_script_word,
9412
9431
  get_asm_code: get_asm_code,
9432
+ get_lock_script_info: get_lock_script_info,
9433
+ get_lock_script_type: get_lock_script_type,
9434
+ get_lock_script_version: get_lock_script_version,
9413
9435
  get_op_code: get_op_code,
9414
9436
  get_op_type: get_op_type,
9415
9437
  get_size_varint: get_size_varint,
9438
+ is_opreturn_script: is_opreturn_script,
9439
+ is_p2pkh_script: is_p2pkh_script,
9440
+ is_p2sh_script: is_p2sh_script,
9441
+ is_p2tr_script: is_p2tr_script,
9442
+ is_p2wpkh_script: is_p2wpkh_script,
9443
+ is_p2wsh_script: is_p2wsh_script,
9444
+ is_return_script: is_return_script,
9416
9445
  is_valid_op: is_valid_op,
9417
9446
  is_valid_script: is_valid_script,
9418
9447
  parse_script: parse_script,