@ckb-ccc/core 0.1.2 → 1.0.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.
- package/CHANGELOG.md +6 -0
- package/dist/barrel.d.ts +1 -1
- package/dist/barrel.d.ts.map +1 -1
- package/dist/barrel.js +1 -1
- package/dist/bytes/index.d.ts +14 -0
- package/dist/bytes/index.d.ts.map +1 -1
- package/dist/bytes/index.js +29 -0
- package/dist/ckb/advanced.d.ts +0 -1
- package/dist/ckb/advanced.d.ts.map +1 -1
- package/dist/ckb/advanced.js +0 -1
- package/dist/ckb/script.d.ts +17 -58
- package/dist/ckb/script.d.ts.map +1 -1
- package/dist/ckb/script.js +31 -78
- package/dist/ckb/transaction.d.ts +114 -260
- package/dist/ckb/transaction.d.ts.map +1 -1
- package/dist/ckb/transaction.js +162 -358
- package/dist/molecule/barrel.d.ts +4 -0
- package/dist/molecule/barrel.d.ts.map +1 -0
- package/dist/molecule/barrel.js +3 -0
- package/dist/molecule/codec.d.ts.map +1 -1
- package/dist/molecule/codec.js +6 -3
- package/dist/molecule/entity.d.ts +98 -0
- package/dist/molecule/entity.d.ts.map +1 -0
- package/dist/molecule/entity.js +113 -0
- package/dist/molecule/index.d.ts +1 -2
- package/dist/molecule/index.d.ts.map +1 -1
- package/dist/molecule/index.js +1 -2
- package/dist/molecule/predefined.d.ts +13 -20
- package/dist/molecule/predefined.d.ts.map +1 -1
- package/dist/molecule/predefined.js +14 -54
- package/dist/utils/index.d.ts +3 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist.commonjs/barrel.d.ts +1 -1
- package/dist.commonjs/barrel.d.ts.map +1 -1
- package/dist.commonjs/barrel.js +1 -14
- package/dist.commonjs/bytes/index.d.ts +14 -0
- package/dist.commonjs/bytes/index.d.ts.map +1 -1
- package/dist.commonjs/bytes/index.js +30 -0
- package/dist.commonjs/ckb/advanced.d.ts +0 -1
- package/dist.commonjs/ckb/advanced.d.ts.map +1 -1
- package/dist.commonjs/ckb/advanced.js +0 -14
- package/dist.commonjs/ckb/script.d.ts +17 -58
- package/dist.commonjs/ckb/script.d.ts.map +1 -1
- package/dist.commonjs/ckb/script.js +31 -102
- package/dist.commonjs/ckb/transaction.d.ts +114 -260
- package/dist.commonjs/ckb/transaction.d.ts.map +1 -1
- package/dist.commonjs/ckb/transaction.js +182 -408
- package/dist.commonjs/molecule/barrel.d.ts +4 -0
- package/dist.commonjs/molecule/barrel.d.ts.map +1 -0
- package/dist.commonjs/{ckb/molecule.advanced/index.js → molecule/barrel.js} +3 -8
- package/dist.commonjs/molecule/codec.d.ts.map +1 -1
- package/dist.commonjs/molecule/codec.js +6 -3
- package/dist.commonjs/molecule/entity.d.ts +98 -0
- package/dist.commonjs/molecule/entity.d.ts.map +1 -0
- package/dist.commonjs/molecule/entity.js +118 -0
- package/dist.commonjs/molecule/index.d.ts +1 -2
- package/dist.commonjs/molecule/index.d.ts.map +1 -1
- package/dist.commonjs/molecule/index.js +13 -4
- package/dist.commonjs/molecule/predefined.d.ts +13 -20
- package/dist.commonjs/molecule/predefined.d.ts.map +1 -1
- package/dist.commonjs/molecule/predefined.js +14 -77
- package/dist.commonjs/utils/index.d.ts +3 -0
- package/dist.commonjs/utils/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/barrel.ts +1 -1
- package/src/bytes/index.ts +34 -0
- package/src/ckb/advanced.ts +0 -1
- package/src/ckb/script.ts +22 -85
- package/src/ckb/transaction.ts +134 -412
- package/src/molecule/barrel.ts +3 -0
- package/src/molecule/codec.ts +9 -5
- package/src/molecule/entity.ts +163 -0
- package/src/molecule/index.ts +1 -2
- package/src/molecule/predefined.ts +20 -69
- package/src/utils/index.ts +5 -0
- package/dist/ckb/molecule.advanced/generated.d.ts +0 -355
- package/dist/ckb/molecule.advanced/generated.d.ts.map +0 -1
- package/dist/ckb/molecule.advanced/generated.js +0 -1468
- package/dist/ckb/molecule.advanced/index.d.ts +0 -6
- package/dist/ckb/molecule.advanced/index.d.ts.map +0 -1
- package/dist/ckb/molecule.advanced/index.js +0 -7
- package/dist.commonjs/ckb/molecule.advanced/generated.d.ts +0 -355
- package/dist.commonjs/ckb/molecule.advanced/generated.d.ts.map +0 -1
- package/dist.commonjs/ckb/molecule.advanced/generated.js +0 -1535
- package/dist.commonjs/ckb/molecule.advanced/index.d.ts +0 -6
- package/dist.commonjs/ckb/molecule.advanced/index.d.ts.map +0 -1
- package/src/ckb/molecule.advanced/blockchain.mol +0 -118
- package/src/ckb/molecule.advanced/generated.d.ts +0 -444
- package/src/ckb/molecule.advanced/generated.js +0 -1804
- package/src/ckb/molecule.advanced/index.ts +0 -11
|
@@ -10,23 +10,9 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
|
|
|
10
10
|
if (k2 === undefined) k2 = k;
|
|
11
11
|
o[k2] = m[k];
|
|
12
12
|
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
13
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
26
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
27
15
|
};
|
|
28
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.moleculeCodecCkb = void 0;
|
|
30
|
-
exports.moleculeCodecCkb = __importStar(require("./molecule.advanced/index.js"));
|
|
31
17
|
__exportStar(require("./script.advanced.js"), exports);
|
|
32
18
|
__exportStar(require("./transaction.advanced.js"), exports);
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { Bytes, BytesLike } from "../bytes/index.js";
|
|
2
2
|
import { Client, KnownScript } from "../client/index.js";
|
|
3
3
|
import { Hex, HexLike } from "../hex/index.js";
|
|
4
|
-
import
|
|
4
|
+
import { mol } from "../molecule/index.js";
|
|
5
|
+
export declare const HashTypeCodec: mol.Codec<HashTypeLike, HashType>;
|
|
5
6
|
/**
|
|
6
7
|
* @public
|
|
7
8
|
*/
|
|
@@ -62,10 +63,22 @@ export type ScriptLike = {
|
|
|
62
63
|
hashType: HashTypeLike;
|
|
63
64
|
args: BytesLike;
|
|
64
65
|
};
|
|
66
|
+
declare const Script_base: (abstract new () => {
|
|
67
|
+
toBytes(): Bytes;
|
|
68
|
+
clone(): Script;
|
|
69
|
+
eq(other: ScriptLike | Script): boolean;
|
|
70
|
+
hash(): Hex;
|
|
71
|
+
}) & {
|
|
72
|
+
byteLength?: number;
|
|
73
|
+
encode(_: ScriptLike): Bytes;
|
|
74
|
+
decode(_: BytesLike): Script;
|
|
75
|
+
fromBytes(_bytes: BytesLike): Script;
|
|
76
|
+
from(_: ScriptLike): Script;
|
|
77
|
+
};
|
|
65
78
|
/**
|
|
66
79
|
* @public
|
|
67
80
|
*/
|
|
68
|
-
export declare class Script {
|
|
81
|
+
export declare class Script extends Script_base {
|
|
69
82
|
codeHash: Hex;
|
|
70
83
|
hashType: HashType;
|
|
71
84
|
args: Hex;
|
|
@@ -123,61 +136,7 @@ export declare class Script {
|
|
|
123
136
|
* ```
|
|
124
137
|
*/
|
|
125
138
|
static fromKnownScript(client: Client, knownScript: KnownScript, args: HexLike): Promise<Script>;
|
|
126
|
-
/**
|
|
127
|
-
* Converts the Script instance to molecule data format.
|
|
128
|
-
*
|
|
129
|
-
* @returns An object representing the script in molecule data format.
|
|
130
|
-
*/
|
|
131
|
-
_toMolData(): {
|
|
132
|
-
codeHash: Uint8Array;
|
|
133
|
-
hashType: Uint8Array;
|
|
134
|
-
args: Uint8Array;
|
|
135
|
-
};
|
|
136
|
-
/**
|
|
137
|
-
* Converts the Script instance to bytes.
|
|
138
|
-
*
|
|
139
|
-
* @returns A Uint8Array containing the script bytes.
|
|
140
|
-
*
|
|
141
|
-
* @example
|
|
142
|
-
* ```typescript
|
|
143
|
-
* const scriptBytes = script.toBytes();
|
|
144
|
-
* ```
|
|
145
|
-
*/
|
|
146
|
-
toBytes(): Bytes;
|
|
147
|
-
/**
|
|
148
|
-
* Get hash of a script
|
|
149
|
-
*
|
|
150
|
-
* @returns Hash of this script
|
|
151
|
-
*
|
|
152
|
-
* @example
|
|
153
|
-
* ```typescript
|
|
154
|
-
* const hash = script.hash();
|
|
155
|
-
* ```
|
|
156
|
-
*/
|
|
157
|
-
hash(): Hex;
|
|
158
|
-
/**
|
|
159
|
-
* Creates a Script instance from a byte-like value or molecule Script.
|
|
160
|
-
*
|
|
161
|
-
* @param bytes - The byte-like value or molecule Script to convert.
|
|
162
|
-
* @returns A Script instance.
|
|
163
|
-
*
|
|
164
|
-
* @example
|
|
165
|
-
* ```typescript
|
|
166
|
-
* const script = Script.fromBytes(new Uint8Array([/* script bytes *\/]));
|
|
167
|
-
* ```
|
|
168
|
-
*/
|
|
169
|
-
static fromBytes(bytes: BytesLike | mol.Script): Script;
|
|
170
|
-
/**
|
|
171
|
-
* Compares the current Script instance with another ScriptLike object for equality.
|
|
172
|
-
*
|
|
173
|
-
* @param val - The ScriptLike object to compare with.
|
|
174
|
-
* @returns True if the scripts are equal, otherwise false.
|
|
175
|
-
*
|
|
176
|
-
* @example
|
|
177
|
-
* ```typescript
|
|
178
|
-
* const isEqual = script.eq(anotherScript);
|
|
179
|
-
* ```
|
|
180
|
-
*/
|
|
181
|
-
eq(val: ScriptLike): boolean;
|
|
182
139
|
}
|
|
140
|
+
export declare const ScriptOpt: mol.Codec<ScriptLike | null | undefined, Script | undefined>;
|
|
141
|
+
export {};
|
|
183
142
|
//# sourceMappingURL=script.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"script.d.ts","sourceRoot":"","sources":["../../src/ckb/script.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,SAAS,EAAa,MAAM,mBAAmB,CAAC;AAChE,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"script.d.ts","sourceRoot":"","sources":["../../src/ckb/script.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,SAAS,EAAa,MAAM,mBAAmB,CAAC;AAChE,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,GAAG,EAAE,OAAO,EAAW,MAAM,iBAAiB,CAAC;AACxD,OAAO,EAAE,GAAG,EAAE,MAAM,sBAAsB,CAAC;AAO3C,eAAO,MAAM,aAAa,EAAE,GAAG,CAAC,KAAK,CAAC,YAAY,EAAE,QAAQ,CAI1D,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;AACpD;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO,CAAC;AAE3D;;;;;;;;;;;;;;GAcG;AAEH,wBAAgB,YAAY,CAAC,GAAG,EAAE,YAAY,GAAG,QAAQ,CAmBxD;AAED;;;;;;;;;;;GAWG;AAEH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,YAAY,GAAG,KAAK,CAE7D;AAED;;;;;;;;;;;;;GAaG;AAEH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,SAAS,GAAG,QAAQ,CAE5D;AAED;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB,QAAQ,EAAE,SAAS,CAAC;IACpB,QAAQ,EAAE,YAAY,CAAC;IACvB,IAAI,EAAE,SAAS,CAAC;CACjB,CAAC;;;;;;;;;;;;;AACF;;GAEG;AACH,qBASa,MAAO,SAAQ,WAAqC;IAStD,QAAQ,EAAE,GAAG;IACb,QAAQ,EAAE,QAAQ;IAClB,IAAI,EAAE,GAAG;IAVlB;;;;;;OAMG;gBAEM,QAAQ,EAAE,GAAG,EACb,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE,GAAG;IAKlB,IAAI,YAAY,IAAI,MAAM,CAEzB;IAED;;;;;;;;;OASG;IACH,KAAK,IAAI,MAAM;IAIf;;;;;;;;;;;;;;OAcG;IAEH,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,UAAU,GAAG,MAAM;IAYvC;;;;;;;;;;;;;;;;OAgBG;WAEU,eAAe,CAC1B,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,WAAW,EACxB,IAAI,EAAE,OAAO,GACZ,OAAO,CAAC,MAAM,CAAC;CAUnB;AAED,eAAO,MAAM,SAAS,8DAAqB,CAAC"}
|
|
@@ -1,37 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
if (
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
24
7
|
};
|
|
8
|
+
var Script_1;
|
|
25
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.Script = void 0;
|
|
10
|
+
exports.ScriptOpt = exports.Script = exports.HashTypeCodec = void 0;
|
|
27
11
|
exports.hashTypeFrom = hashTypeFrom;
|
|
28
12
|
exports.hashTypeToBytes = hashTypeToBytes;
|
|
29
13
|
exports.hashTypeFromBytes = hashTypeFromBytes;
|
|
30
14
|
const index_js_1 = require("../bytes/index.js");
|
|
31
|
-
const index_js_2 = require("../
|
|
32
|
-
const index_js_3 = require("../
|
|
33
|
-
const mol = __importStar(require("./molecule.advanced/index.js"));
|
|
15
|
+
const index_js_2 = require("../hex/index.js");
|
|
16
|
+
const index_js_3 = require("../molecule/index.js");
|
|
34
17
|
const script_advanced_js_1 = require("./script.advanced.js");
|
|
18
|
+
exports.HashTypeCodec = index_js_3.mol.Codec.from({
|
|
19
|
+
byteLength: 1,
|
|
20
|
+
encode: hashTypeToBytes,
|
|
21
|
+
decode: hashTypeFromBytes,
|
|
22
|
+
});
|
|
35
23
|
/**
|
|
36
24
|
* Converts a HashTypeLike value to a HashType.
|
|
37
25
|
* @public
|
|
@@ -100,7 +88,7 @@ function hashTypeFromBytes(bytes) {
|
|
|
100
88
|
/**
|
|
101
89
|
* @public
|
|
102
90
|
*/
|
|
103
|
-
class Script {
|
|
91
|
+
let Script = Script_1 = class Script extends index_js_3.mol.Entity.Base() {
|
|
104
92
|
/**
|
|
105
93
|
* Creates an instance of Script.
|
|
106
94
|
*
|
|
@@ -109,6 +97,7 @@ class Script {
|
|
|
109
97
|
* @param args - The arguments for the script.
|
|
110
98
|
*/
|
|
111
99
|
constructor(codeHash, hashType, args) {
|
|
100
|
+
super();
|
|
112
101
|
this.codeHash = codeHash;
|
|
113
102
|
this.hashType = hashType;
|
|
114
103
|
this.args = args;
|
|
@@ -127,7 +116,7 @@ class Script {
|
|
|
127
116
|
* ```
|
|
128
117
|
*/
|
|
129
118
|
clone() {
|
|
130
|
-
return new
|
|
119
|
+
return new Script_1(this.codeHash, this.hashType, this.args);
|
|
131
120
|
}
|
|
132
121
|
/**
|
|
133
122
|
* Creates a Script instance from a ScriptLike object.
|
|
@@ -145,10 +134,10 @@ class Script {
|
|
|
145
134
|
* ```
|
|
146
135
|
*/
|
|
147
136
|
static from(script) {
|
|
148
|
-
if (script instanceof
|
|
137
|
+
if (script instanceof Script_1) {
|
|
149
138
|
return script;
|
|
150
139
|
}
|
|
151
|
-
return new
|
|
140
|
+
return new Script_1((0, index_js_2.hexFrom)(script.codeHash), hashTypeFrom(script.hashType), (0, index_js_2.hexFrom)(script.args));
|
|
152
141
|
}
|
|
153
142
|
/**
|
|
154
143
|
* Creates a Script instance from client and known script.
|
|
@@ -169,77 +158,17 @@ class Script {
|
|
|
169
158
|
*/
|
|
170
159
|
static async fromKnownScript(client, knownScript, args) {
|
|
171
160
|
const script = await client.getKnownScript(knownScript);
|
|
172
|
-
return new
|
|
173
|
-
}
|
|
174
|
-
/**
|
|
175
|
-
* Converts the Script instance to molecule data format.
|
|
176
|
-
*
|
|
177
|
-
* @returns An object representing the script in molecule data format.
|
|
178
|
-
*/
|
|
179
|
-
_toMolData() {
|
|
180
|
-
return {
|
|
181
|
-
codeHash: (0, index_js_1.bytesFrom)(this.codeHash),
|
|
182
|
-
hashType: hashTypeToBytes(this.hashType),
|
|
183
|
-
args: (0, index_js_1.bytesFrom)(this.args),
|
|
184
|
-
};
|
|
185
|
-
}
|
|
186
|
-
/**
|
|
187
|
-
* Converts the Script instance to bytes.
|
|
188
|
-
*
|
|
189
|
-
* @returns A Uint8Array containing the script bytes.
|
|
190
|
-
*
|
|
191
|
-
* @example
|
|
192
|
-
* ```typescript
|
|
193
|
-
* const scriptBytes = script.toBytes();
|
|
194
|
-
* ```
|
|
195
|
-
*/
|
|
196
|
-
toBytes() {
|
|
197
|
-
return (0, index_js_1.bytesFrom)(mol.SerializeScript(this._toMolData()));
|
|
198
|
-
}
|
|
199
|
-
/**
|
|
200
|
-
* Get hash of a script
|
|
201
|
-
*
|
|
202
|
-
* @returns Hash of this script
|
|
203
|
-
*
|
|
204
|
-
* @example
|
|
205
|
-
* ```typescript
|
|
206
|
-
* const hash = script.hash();
|
|
207
|
-
* ```
|
|
208
|
-
*/
|
|
209
|
-
hash() {
|
|
210
|
-
return (0, index_js_2.hashCkb)(this.toBytes());
|
|
211
|
-
}
|
|
212
|
-
/**
|
|
213
|
-
* Creates a Script instance from a byte-like value or molecule Script.
|
|
214
|
-
*
|
|
215
|
-
* @param bytes - The byte-like value or molecule Script to convert.
|
|
216
|
-
* @returns A Script instance.
|
|
217
|
-
*
|
|
218
|
-
* @example
|
|
219
|
-
* ```typescript
|
|
220
|
-
* const script = Script.fromBytes(new Uint8Array([/* script bytes *\/]));
|
|
221
|
-
* ```
|
|
222
|
-
*/
|
|
223
|
-
static fromBytes(bytes) {
|
|
224
|
-
const view = bytes instanceof mol.Script ? bytes : new mol.Script((0, index_js_1.bytesFrom)(bytes));
|
|
225
|
-
return new Script((0, index_js_3.hexFrom)(view.getCodeHash().raw()), hashTypeFromBytes([view.getHashType()]), (0, index_js_3.hexFrom)(view.getArgs().raw()));
|
|
161
|
+
return new Script_1(script.codeHash, script.hashType, (0, index_js_2.hexFrom)(args));
|
|
226
162
|
}
|
|
227
|
-
|
|
228
|
-
* Compares the current Script instance with another ScriptLike object for equality.
|
|
229
|
-
*
|
|
230
|
-
* @param val - The ScriptLike object to compare with.
|
|
231
|
-
* @returns True if the scripts are equal, otherwise false.
|
|
232
|
-
*
|
|
233
|
-
* @example
|
|
234
|
-
* ```typescript
|
|
235
|
-
* const isEqual = script.eq(anotherScript);
|
|
236
|
-
* ```
|
|
237
|
-
*/
|
|
238
|
-
eq(val) {
|
|
239
|
-
const script = Script.from(val);
|
|
240
|
-
return (this.codeHash === script.codeHash &&
|
|
241
|
-
this.args === script.args &&
|
|
242
|
-
this.hashType === script.hashType);
|
|
243
|
-
}
|
|
244
|
-
}
|
|
163
|
+
};
|
|
245
164
|
exports.Script = Script;
|
|
165
|
+
exports.Script = Script = Script_1 = __decorate([
|
|
166
|
+
index_js_3.mol.codec(index_js_3.mol
|
|
167
|
+
.table({
|
|
168
|
+
codeHash: index_js_3.mol.Byte32,
|
|
169
|
+
hashType: exports.HashTypeCodec,
|
|
170
|
+
args: index_js_3.mol.Bytes,
|
|
171
|
+
})
|
|
172
|
+
.map({ outMap: (decoded) => Script.from(decoded) }))
|
|
173
|
+
], Script);
|
|
174
|
+
exports.ScriptOpt = index_js_3.mol.option(Script);
|