@ckb-ccc/core 0.0.4-alpha.1 → 0.0.4-alpha.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.
Files changed (104) hide show
  1. package/README.md +12 -7
  2. package/dist/address/address.advanced.d.ts +34 -0
  3. package/dist/address/address.advanced.d.ts.map +1 -1
  4. package/dist/address/address.advanced.js +41 -7
  5. package/dist/address/index.d.ts +36 -0
  6. package/dist/address/index.d.ts.map +1 -1
  7. package/dist/address/index.js +44 -5
  8. package/dist/bytes/advanced.d.ts +3 -0
  9. package/dist/bytes/advanced.d.ts.map +1 -1
  10. package/dist/bytes/index.d.ts +57 -0
  11. package/dist/bytes/index.d.ts.map +1 -1
  12. package/dist/bytes/index.js +57 -0
  13. package/dist/ckb/script.d.ts +98 -1
  14. package/dist/ckb/script.d.ts.map +1 -1
  15. package/dist/ckb/script.js +98 -1
  16. package/dist/ckb/transaction.d.ts +392 -1
  17. package/dist/ckb/transaction.d.ts.map +1 -1
  18. package/dist/ckb/transaction.js +403 -1
  19. package/dist/client/client.d.ts +10 -8
  20. package/dist/client/client.d.ts.map +1 -1
  21. package/dist/client/client.js +18 -0
  22. package/dist/client/clientPublicMainnet.advanced.d.ts +2 -2
  23. package/dist/client/clientPublicMainnet.advanced.d.ts.map +1 -1
  24. package/dist/client/clientPublicMainnet.d.ts +2 -2
  25. package/dist/client/clientPublicMainnet.d.ts.map +1 -1
  26. package/dist/client/clientPublicTestnet.advanced.d.ts +2 -2
  27. package/dist/client/clientPublicTestnet.advanced.d.ts.map +1 -1
  28. package/dist/client/clientPublicTestnet.d.ts +2 -2
  29. package/dist/client/clientPublicTestnet.d.ts.map +1 -1
  30. package/dist/client/clientTypes.d.ts +6 -0
  31. package/dist/client/clientTypes.d.ts.map +1 -1
  32. package/dist/client/jsonRpc/advanced.d.ts +2 -87
  33. package/dist/client/jsonRpc/advanced.d.ts.map +1 -1
  34. package/dist/client/jsonRpc/advanced.js +2 -65
  35. package/dist/client/jsonRpc/index.d.ts +60 -6
  36. package/dist/client/jsonRpc/index.d.ts.map +1 -1
  37. package/dist/client/jsonRpc/index.js +72 -7
  38. package/dist/client/jsonRpc/transformers.d.ts +28 -0
  39. package/dist/client/jsonRpc/transformers.d.ts.map +1 -0
  40. package/dist/client/jsonRpc/transformers.js +122 -0
  41. package/dist/client/jsonRpc/types.d.ts +41 -0
  42. package/dist/client/jsonRpc/types.d.ts.map +1 -0
  43. package/dist/client/jsonRpc/types.js +1 -0
  44. package/dist/fixedPoint/index.d.ts +43 -1
  45. package/dist/fixedPoint/index.d.ts.map +1 -1
  46. package/dist/fixedPoint/index.js +39 -1
  47. package/dist/hasher/index.d.ts +43 -2
  48. package/dist/hasher/index.d.ts.map +1 -1
  49. package/dist/hasher/index.js +42 -0
  50. package/dist/hex/index.d.ts +19 -0
  51. package/dist/hex/index.d.ts.map +1 -1
  52. package/dist/hex/index.js +12 -0
  53. package/dist/num/index.d.ts +99 -0
  54. package/dist/num/index.d.ts.map +1 -1
  55. package/dist/num/index.js +92 -0
  56. package/dist/signer/btc/signerBtc.d.ts +33 -2
  57. package/dist/signer/btc/signerBtc.d.ts.map +1 -1
  58. package/dist/signer/btc/signerBtc.js +25 -3
  59. package/dist/signer/btc/signerBtcPublicKeyReadonly.d.ts +36 -0
  60. package/dist/signer/btc/signerBtcPublicKeyReadonly.d.ts.map +1 -1
  61. package/dist/signer/btc/signerBtcPublicKeyReadonly.js +36 -0
  62. package/dist/signer/ckb/signerCkbScriptReadonly.d.ts +35 -0
  63. package/dist/signer/ckb/signerCkbScriptReadonly.d.ts.map +1 -1
  64. package/dist/signer/ckb/signerCkbScriptReadonly.js +35 -0
  65. package/dist/signer/evm/signerEvm.d.ts +27 -2
  66. package/dist/signer/evm/signerEvm.d.ts.map +1 -1
  67. package/dist/signer/evm/signerEvm.js +24 -3
  68. package/dist/signer/evm/signerEvmAddressReadonly.d.ts +30 -0
  69. package/dist/signer/evm/signerEvmAddressReadonly.d.ts.map +1 -1
  70. package/dist/signer/evm/signerEvmAddressReadonly.js +30 -0
  71. package/dist/signer/helpers.d.ts +19 -1
  72. package/dist/signer/helpers.d.ts.map +1 -1
  73. package/dist/signer/helpers.js +26 -9
  74. package/dist/signer/signer.d.ts +75 -4
  75. package/dist/signer/signer.d.ts.map +1 -1
  76. package/dist/signer/signer.js +53 -0
  77. package/package.json +3 -3
  78. package/src/address/address.advanced.ts +54 -18
  79. package/src/address/index.ts +51 -7
  80. package/src/bytes/advanced.ts +12 -9
  81. package/src/bytes/index.ts +60 -0
  82. package/src/ckb/script.ts +111 -2
  83. package/src/ckb/transaction.ts +455 -2
  84. package/src/client/client.ts +31 -8
  85. package/src/client/clientPublicMainnet.advanced.ts +5 -2
  86. package/src/client/clientPublicMainnet.ts +4 -2
  87. package/src/client/clientPublicTestnet.advanced.ts +5 -2
  88. package/src/client/clientPublicTestnet.ts +4 -2
  89. package/src/client/clientTypes.ts +13 -0
  90. package/src/client/jsonRpc/advanced.ts +2 -93
  91. package/src/client/jsonRpc/index.ts +99 -11
  92. package/src/client/jsonRpc/transformers.ts +159 -0
  93. package/src/client/jsonRpc/types.ts +48 -0
  94. package/src/fixedPoint/index.ts +52 -2
  95. package/src/hasher/index.ts +47 -1
  96. package/src/hex/index.ts +19 -0
  97. package/src/num/index.ts +101 -0
  98. package/src/signer/btc/signerBtc.ts +35 -3
  99. package/src/signer/btc/signerBtcPublicKeyReadonly.ts +36 -0
  100. package/src/signer/ckb/signerCkbScriptReadonly.ts +36 -0
  101. package/src/signer/evm/signerEvm.ts +30 -3
  102. package/src/signer/evm/signerEvmAddressReadonly.ts +31 -0
  103. package/src/signer/helpers.ts +28 -8
  104. package/src/signer/signer.ts +77 -4
@@ -1,8 +1,25 @@
1
1
  import { bech32, bech32m } from "bech32";
2
- import { Script, hashTypeFromBytes } from "../ckb";
2
+ import { hashTypeFromBytes } from "../ckb";
3
3
  import { Client, KnownScript } from "../client";
4
4
  import { hexFrom } from "../hex";
5
- import { type Address } from "./index";
5
+ import { type AddressLike } from "./index";
6
+
7
+ /**
8
+ * Parses an address string into an address information object.
9
+ *
10
+ * @param address - The address string to parse.
11
+ * @returns An object containing the address prefix, address format, and payload array.
12
+ *
13
+ * @throws Will throw an error if the address format is unknown.
14
+ *
15
+ * @example
16
+ * ```typescript
17
+ * const addressInfo = addressPayloadFromString("ckt1112139193129");
18
+ * console.log(addressInfo.prefix); // Outputs the address prefix
19
+ * console.log(addressInfo.format); // Outputs the address format
20
+ * console.log(addressInfo.payload); // Outputs the payload array
21
+ * ```
22
+ */
6
23
 
7
24
  export function addressPayloadFromString(address: string): {
8
25
  prefix: string;
@@ -37,12 +54,31 @@ export function addressPayloadFromString(address: string): {
37
54
  throw Error(`Unknown address format ${address}`);
38
55
  }
39
56
 
57
+ /**
58
+ * Converts an address payload into an address-like object.
59
+ *
60
+ * @param prefix - The address prefix.
61
+ * @param format - The format of the address, as defined by the AddressFormat enum.
62
+ * @param payload - The payload array containing the address data.
63
+ * @param client - The client instance used to fetch known scripts.
64
+ * @returns A promise that resolves to an AddressLike object.
65
+ *
66
+ * @throws Will throw an error if the payload length is insufficient or if the script type is unknown.
67
+ *
68
+ * @example
69
+ * ```typescript
70
+ * const address = await addressFromPayload("ckt", AddressFormat.Full, [/* payload data *\/], client);
71
+ * console.log(address.script); // Outputs the script object
72
+ * console.log(address.prefix); // Outputs the address prefix
73
+ * ```
74
+ */
75
+
40
76
  export async function addressFromPayload(
41
77
  prefix: string,
42
78
  format: AddressFormat,
43
79
  payload: number[],
44
80
  client: Client,
45
- ): Promise<Address> {
81
+ ): Promise<AddressLike> {
46
82
  if (format === AddressFormat.Full) {
47
83
  if (payload.length < 32 + 1) {
48
84
  throw new Error(
@@ -51,11 +87,11 @@ export async function addressFromPayload(
51
87
  }
52
88
 
53
89
  return {
54
- script: Script.from({
55
- codeHash: hexFrom(payload.slice(0, 32)),
90
+ script: {
91
+ codeHash: payload.slice(0, 32),
56
92
  hashType: hashTypeFromBytes(payload.slice(32, 33)),
57
- args: hexFrom(payload.slice(33)),
58
- }),
93
+ args: payload.slice(33),
94
+ },
59
95
  prefix,
60
96
  };
61
97
  }
@@ -68,11 +104,11 @@ export async function addressFromPayload(
68
104
  }
69
105
 
70
106
  return {
71
- script: Script.from({
72
- codeHash: hexFrom(payload.slice(0, 32)),
107
+ script: {
108
+ codeHash: payload.slice(0, 32),
73
109
  hashType: "data",
74
- args: hexFrom(payload.slice(32)),
75
- }),
110
+ args: payload.slice(32),
111
+ },
76
112
  prefix,
77
113
  };
78
114
  }
@@ -85,11 +121,11 @@ export async function addressFromPayload(
85
121
  }
86
122
 
87
123
  return {
88
- script: Script.from({
89
- codeHash: hexFrom(payload.slice(0, 32)),
124
+ script: {
125
+ codeHash: payload.slice(0, 32),
90
126
  hashType: "type",
91
- args: hexFrom(payload.slice(32)),
92
- }),
127
+ args: payload.slice(32),
128
+ },
93
129
  prefix,
94
130
  };
95
131
  }
@@ -112,10 +148,10 @@ export async function addressFromPayload(
112
148
  }
113
149
 
114
150
  return {
115
- script: Script.from({
151
+ script: {
116
152
  ...(await client.getKnownScript(script)),
117
- args: hexFrom(payload.slice(1)),
118
- }),
153
+ args: payload.slice(1),
154
+ },
119
155
  prefix,
120
156
  };
121
157
  }
@@ -14,12 +14,30 @@ export type AddressLike = {
14
14
  script: ScriptLike;
15
15
  prefix: string;
16
16
  };
17
+
18
+ /**
19
+ * Represents a ckb address with associated script and prefix.
20
+ */
21
+
17
22
  export class Address {
23
+ /**
24
+ * Creates an instance of Address.
25
+ *
26
+ * @param script - The script associated with the address.
27
+ * @param prefix - The address prefix.
28
+ */
18
29
  constructor(
19
30
  public script: Script,
20
31
  public prefix: string,
21
32
  ) {}
22
33
 
34
+ /**
35
+ * Creates an Address instance from an AddressLike object.
36
+ *
37
+ * @param address - An AddressLike object or an instance of Address.
38
+ * @returns An Address instance.
39
+ */
40
+
23
41
  static from(address: AddressLike): Address {
24
42
  if (address instanceof Address) {
25
43
  return address;
@@ -28,6 +46,16 @@ export class Address {
28
46
  return new Address(Script.from(address.script), address.prefix);
29
47
  }
30
48
 
49
+ /**
50
+ * Creates an Address instance from an address string.
51
+ *
52
+ * @param address - The address string to parse.
53
+ * @param clients - A Client instance or a record of Client instances keyed by prefix.
54
+ * @returns A promise that resolves to an Address instance.
55
+ *
56
+ * @throws Will throw an error if the address prefix is unknown or mismatched.
57
+ */
58
+
31
59
  static async fromString(
32
60
  address: string,
33
61
  clients: Client | Record<string, Client>,
@@ -45,14 +73,24 @@ export class Address {
45
73
  );
46
74
  }
47
75
 
48
- return addressFromPayload(prefix, format, payload, client);
76
+ return Address.from(
77
+ await addressFromPayload(prefix, format, payload, client),
78
+ );
49
79
  }
50
80
 
81
+ /**
82
+ * Creates an Address instance from a script and client.
83
+ *
84
+ * @param script - The script-like object.
85
+ * @param client - The client instance used to fetch the address prefix.
86
+ * @returns A promise that resolves to an Address instance.
87
+ */
88
+
51
89
  static async fromScript(
52
90
  script: ScriptLike,
53
91
  client: Client,
54
92
  ): Promise<Address> {
55
- return new Address(Script.from(script), await client.getAddressPrefix());
93
+ return Address.from({ script, prefix: await client.getAddressPrefix() });
56
94
  }
57
95
 
58
96
  static async fromKnownScript(
@@ -60,15 +98,21 @@ export class Address {
60
98
  args: HexLike,
61
99
  client: Client,
62
100
  ) {
63
- return new Address(
64
- Script.from({
101
+ return Address.from({
102
+ script: {
65
103
  ...(await client.getKnownScript(script)),
66
104
  args,
67
- }),
68
- await client.getAddressPrefix(),
69
- );
105
+ },
106
+ prefix: await client.getAddressPrefix(),
107
+ });
70
108
  }
71
109
 
110
+ /**
111
+ * Converts the Address instance to a string.
112
+ *
113
+ * @returns The address as a string.
114
+ */
115
+
72
116
  toString(): string {
73
117
  const data = bytesConcat(
74
118
  [AddressFormat.Full],
@@ -1,10 +1,13 @@
1
+ /**
2
+ * Represents the possible encoding formats for converting bytes.
3
+ */
1
4
  export type BytesFromEncoding =
2
- | "utf8"
3
- | "utf16le"
4
- | "latin1"
5
- | "base64"
6
- | "base64url"
7
- | "hex"
8
- | "ascii"
9
- | "binary"
10
- | "ucs2";
5
+ | "utf8" // UTF-8 encoding
6
+ | "utf16le" // UTF-16 Little Endian encoding
7
+ | "latin1" // Latin-1 (ISO-8859-1) encoding
8
+ | "base64" // Base64 encoding
9
+ | "base64url" // Base64 URL encoding
10
+ | "hex" // Hexadecimal encoding
11
+ | "ascii" // ASCII encoding
12
+ | "binary" // Binary encoding
13
+ | "ucs2"; // UCS-2 (alias of UTF-16LE) encoding
@@ -4,6 +4,24 @@ import { BytesFromEncoding } from "./advanced";
4
4
  export type Bytes = Uint8Array;
5
5
  export type BytesLike = string | Uint8Array | ArrayBuffer | number[];
6
6
 
7
+ /**
8
+ * Concatenates multiple byte-like arrays into a single byte array.
9
+ *
10
+ * @param args - The byte-like arrays to concatenate.
11
+ * @returns A Uint8Array containing the concatenated bytes.
12
+ *
13
+ * @example
14
+ * ```typescript
15
+ * const concatenatedBytes = bytesConcat(
16
+ * new Uint8Array([1, 2]),
17
+ * new Uint8Array([3, 4]),
18
+ * "hello",
19
+ * [5, 6, 7]
20
+ * );
21
+ * console.log(concatenatedBytes); // Outputs Uint8Array [1, 2, 3, 4, /* bytes of "hello" *\/, 5, 6, 7]
22
+ * ```
23
+ */
24
+
7
25
  export function bytesConcat(...args: BytesLike[]): Bytes {
8
26
  return new Uint8Array(
9
27
  args.reduce((acc: number[], v) => {
@@ -13,10 +31,52 @@ export function bytesConcat(...args: BytesLike[]): Bytes {
13
31
  );
14
32
  }
15
33
 
34
+ /**
35
+ * Converts a byte-like value to a string using the specified encoding.
36
+ *
37
+ * @param val - The byte-like value to convert.
38
+ * @param encoding - The encoding to use for the conversion, as defined by the BytesFromEncoding type.
39
+ * @returns A string representing the encoded bytes.
40
+ *
41
+ * @example
42
+ * ```typescript
43
+ * const encodedString = bytesTo(new Uint8Array([104, 101, 108, 108, 111]), "utf8");
44
+ * console.log(encodedString); // Outputs "hello"
45
+ *
46
+ * const base64String = bytesTo(new Uint8Array([104, 101, 108, 108, 111]), "base64");
47
+ * console.log(base64String); // Outputs "aGVsbG8="
48
+ * ```
49
+ */
50
+
16
51
  export function bytesTo(val: BytesLike, encoding: BytesFromEncoding): string {
17
52
  return Buffer.from(bytesFrom(val)).toString(encoding);
18
53
  }
19
54
 
55
+ /**
56
+ * Converts various types of byte-like values to a Uint8Array.
57
+ *
58
+ * @param bytes - The byte-like value to convert. It can be a string, Uint8Array, ArrayBuffer, or number array.
59
+ * @param encoding - Optional encoding to use if the input is a string. Defaults to hexadecimal if not specified.
60
+ * @returns A Uint8Array representing the input bytes.
61
+ *
62
+ * @throws Will throw an error if the input bytes are invalid or out of range.
63
+ *
64
+ * @example
65
+ * ```typescript
66
+ * const bytes1 = bytesFrom(new Uint8Array([1, 2, 3]));
67
+ * console.log(bytes1); // Outputs Uint8Array [1, 2, 3]
68
+ *
69
+ * const bytes2 = bytesFrom("68656c6c6f", "hex");
70
+ * console.log(bytes2); // Outputs Uint8Array [104, 101, 108, 108, 111]
71
+ *
72
+ * const bytes3 = bytesFrom("hello", "utf8");
73
+ * console.log(bytes3); // Outputs Uint8Array [104, 101, 108, 108, 111]
74
+ *
75
+ * const bytes4 = bytesFrom([1, 2, 255]);
76
+ * console.log(bytes4); // Outputs Uint8Array [1, 2, 255]
77
+ * ```
78
+ */
79
+
20
80
  export function bytesFrom(
21
81
  bytes: BytesLike,
22
82
  encoding?: BytesFromEncoding,
package/src/ckb/script.ts CHANGED
@@ -9,6 +9,22 @@ import {
9
9
 
10
10
  export type HashTypeLike = string | number | bigint;
11
11
  export type HashType = "type" | "data" | "data1" | "data2";
12
+
13
+ /**
14
+ * Converts a HashTypeLike value to a HashType.
15
+ *
16
+ * @param val - The value to convert, which can be a string, number, or bigint.
17
+ * @returns The corresponding HashType.
18
+ *
19
+ * @throws Will throw an error if the input value is not a valid hash type.
20
+ *
21
+ * @example
22
+ * ```typescript
23
+ * const hashType = hashTypeFrom(1); // Outputs "data"
24
+ * const hashType = hashTypeFrom("type"); // Outputs "type"
25
+ * ```
26
+ */
27
+
12
28
  export function hashTypeFrom(val: HashTypeLike): HashType {
13
29
  const hashType = (() => {
14
30
  if (typeof val === "number") {
@@ -29,9 +45,37 @@ export function hashTypeFrom(val: HashTypeLike): HashType {
29
45
  }
30
46
  return hashType;
31
47
  }
32
- export function hashTypeToBytes(hashType: HashType): Bytes {
33
- return bytesFrom([HASH_TYPE_TO_NUM[hashType]]);
48
+
49
+ /**
50
+ * Converts a HashTypeLike value to its corresponding byte representation.
51
+ *
52
+ * @param hashType - The hash type value to convert.
53
+ * @returns A Uint8Array containing the byte representation of the hash type.
54
+ *
55
+ * @example
56
+ * ```typescript
57
+ * const hashTypeBytes = hashTypeToBytes("type"); // Outputs Uint8Array [0]
58
+ * ```
59
+ */
60
+
61
+ export function hashTypeToBytes(hashType: HashTypeLike): Bytes {
62
+ return bytesFrom([HASH_TYPE_TO_NUM[hashTypeFrom(hashType)]]);
34
63
  }
64
+
65
+ /**
66
+ * Converts a byte-like value to a HashType.
67
+ *
68
+ * @param bytes - The byte-like value to convert.
69
+ * @returns The corresponding HashType.
70
+ *
71
+ * @throws Will throw an error if the input bytes do not correspond to a valid hash type.
72
+ *
73
+ * @example
74
+ * ```typescript
75
+ * const hashType = hashTypeFromBytes(new Uint8Array([0])); // Outputs "type"
76
+ * ```
77
+ */
78
+
35
79
  export function hashTypeFromBytes(bytes: BytesLike): HashType {
36
80
  return NUM_TO_HASH_TYPE[bytesFrom(bytes)[0]];
37
81
  }
@@ -42,12 +86,36 @@ export type ScriptLike = {
42
86
  args: BytesLike;
43
87
  };
44
88
  export class Script {
89
+ /**
90
+ * Creates an instance of Script.
91
+ *
92
+ * @param codeHash - The code hash of the script.
93
+ * @param hashType - The hash type of the script.
94
+ * @param args - The arguments for the script.
95
+ */
96
+
45
97
  constructor(
46
98
  public codeHash: Hex,
47
99
  public hashType: HashType,
48
100
  public args: Hex,
49
101
  ) {}
50
102
 
103
+ /**
104
+ * Creates a Script instance from a ScriptLike object.
105
+ *
106
+ * @param script - A ScriptLike object or an instance of Script.
107
+ * @returns A Script instance.
108
+ *
109
+ * @example
110
+ * ```typescript
111
+ * const script = Script.from({
112
+ * codeHash: "0x1234...",
113
+ * hashType: "type",
114
+ * args: "0xabcd..."
115
+ * });
116
+ * ```
117
+ */
118
+
51
119
  static from(script: ScriptLike): Script {
52
120
  if (script instanceof Script) {
53
121
  return script;
@@ -60,6 +128,12 @@ export class Script {
60
128
  );
61
129
  }
62
130
 
131
+ /**
132
+ * Converts the Script instance to molecule data format.
133
+ *
134
+ * @returns An object representing the script in molecule data format.
135
+ */
136
+
63
137
  _toMolData() {
64
138
  return {
65
139
  codeHash: bytesFrom(this.codeHash),
@@ -68,10 +142,33 @@ export class Script {
68
142
  };
69
143
  }
70
144
 
145
+ /**
146
+ * Converts the Script instance to bytes.
147
+ *
148
+ * @returns A Uint8Array containing the script bytes.
149
+ *
150
+ * @example
151
+ * ```typescript
152
+ * const scriptBytes = script.toBytes();
153
+ * ```
154
+ */
155
+
71
156
  toBytes(): Bytes {
72
157
  return bytesFrom(mol.SerializeScript(this._toMolData()));
73
158
  }
74
159
 
160
+ /**
161
+ * Creates a Script instance from a byte-like value or molecule Script.
162
+ *
163
+ * @param bytes - The byte-like value or molecule Script to convert.
164
+ * @returns A Script instance.
165
+ *
166
+ * @example
167
+ * ```typescript
168
+ * const script = Script.fromBytes(new Uint8Array([/* script bytes *\/]));
169
+ * ```
170
+ */
171
+
75
172
  static fromBytes(bytes: BytesLike | mol.Script): Script {
76
173
  const view =
77
174
  bytes instanceof mol.Script ? bytes : new mol.Script(bytesFrom(bytes));
@@ -83,6 +180,18 @@ export class Script {
83
180
  );
84
181
  }
85
182
 
183
+ /**
184
+ * Compares the current Script instance with another ScriptLike object for equality.
185
+ *
186
+ * @param val - The ScriptLike object to compare with.
187
+ * @returns True if the scripts are equal, otherwise false.
188
+ *
189
+ * @example
190
+ * ```typescript
191
+ * const isEqual = script.eq(anotherScript);
192
+ * ```
193
+ */
194
+
86
195
  eq(val: ScriptLike): boolean {
87
196
  const script = Script.from(val);
88
197
  return (