@ckb-ccc/core 0.1.1 → 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 +12 -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/address/address.advanced.js +28 -23
- package/dist.commonjs/address/advanced.js +17 -1
- package/dist.commonjs/address/index.js +15 -11
- package/dist.commonjs/advanced.js +31 -2
- package/dist.commonjs/advancedBarrel.js +21 -5
- package/dist.commonjs/barrel.d.ts +1 -1
- package/dist.commonjs/barrel.d.ts.map +1 -1
- package/dist.commonjs/barrel.js +28 -12
- package/dist.commonjs/bytes/advanced.js +2 -1
- 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 +42 -7
- 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 +18 -3
- package/dist.commonjs/ckb/index.js +19 -3
- package/dist.commonjs/ckb/script.advanced.js +6 -3
- 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 +49 -90
- package/dist.commonjs/ckb/transaction.advanced.js +6 -3
- 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 +249 -434
- package/dist.commonjs/ckb/transactionLumos.js +2 -1
- package/dist.commonjs/client/advanced.js +22 -6
- package/dist.commonjs/client/cache/advanced.js +17 -1
- package/dist.commonjs/client/cache/cache.js +7 -3
- package/dist.commonjs/client/cache/index.js +18 -2
- package/dist.commonjs/client/cache/memory.advanced.js +28 -21
- package/dist.commonjs/client/cache/memory.js +23 -19
- package/dist.commonjs/client/client.js +25 -21
- package/dist.commonjs/client/clientPublicMainnet.advanced.js +25 -22
- package/dist.commonjs/client/clientPublicMainnet.js +15 -8
- package/dist.commonjs/client/clientPublicTestnet.advanced.js +25 -22
- package/dist.commonjs/client/clientPublicTestnet.js +15 -8
- package/dist.commonjs/client/clientTypes.advanced.js +6 -3
- package/dist.commonjs/client/clientTypes.js +43 -29
- package/dist.commonjs/client/index.js +22 -6
- package/dist.commonjs/client/jsonRpc/advanced.js +18 -2
- package/dist.commonjs/client/jsonRpc/index.js +41 -37
- package/dist.commonjs/client/jsonRpc/transformers.js +61 -57
- package/dist.commonjs/client/jsonRpc/types.js +2 -1
- package/dist.commonjs/client/transports/advanced.js +25 -8
- package/dist.commonjs/client/transports/http.js +5 -1
- package/dist.commonjs/client/transports/transport.js +2 -1
- package/dist.commonjs/client/transports/webSocket.js +10 -3
- package/dist.commonjs/fixedPoint/index.js +9 -4
- package/dist.commonjs/hasher/advanced.js +4 -1
- package/dist.commonjs/hasher/hasher.js +2 -1
- package/dist.commonjs/hasher/hasherCkb.js +20 -14
- package/dist.commonjs/hasher/hasherKeecak256.js +11 -7
- package/dist.commonjs/hasher/index.js +19 -3
- package/dist.commonjs/hex/index.js +6 -3
- package/dist.commonjs/index.js +31 -2
- package/dist.commonjs/keystore/index.js +25 -21
- package/dist.commonjs/molecule/barrel.d.ts +4 -0
- package/dist.commonjs/molecule/barrel.d.ts.map +1 -0
- package/dist.commonjs/molecule/barrel.js +19 -0
- package/dist.commonjs/molecule/codec.d.ts.map +1 -1
- package/dist.commonjs/molecule/codec.js +69 -51
- 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 +27 -2
- 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 +54 -91
- package/dist.commonjs/num/index.js +29 -17
- package/dist.commonjs/signer/btc/index.js +19 -3
- package/dist.commonjs/signer/btc/signerBtc.js +24 -20
- package/dist.commonjs/signer/btc/signerBtcPublicKeyReadonly.js +8 -4
- package/dist.commonjs/signer/btc/verify.js +26 -17
- package/dist.commonjs/signer/ckb/index.js +21 -5
- package/dist.commonjs/signer/ckb/signerCkbPrivateKey.js +20 -16
- package/dist.commonjs/signer/ckb/signerCkbPublicKey.js +24 -20
- package/dist.commonjs/signer/ckb/signerCkbScriptReadonly.js +12 -8
- package/dist.commonjs/signer/ckb/verifyCkbSecp256k1.js +16 -12
- package/dist.commonjs/signer/ckb/verifyJoyId.js +8 -5
- package/dist.commonjs/signer/doge/index.js +20 -4
- package/dist.commonjs/signer/doge/signerDoge.js +26 -19
- package/dist.commonjs/signer/doge/signerDogeAddressReadonly.js +6 -2
- package/dist.commonjs/signer/doge/signerDogePrivateKey.js +17 -13
- package/dist.commonjs/signer/doge/verify.js +15 -12
- package/dist.commonjs/signer/dummy/alwaysError.js +6 -2
- package/dist.commonjs/signer/dummy/dummy.js +7 -3
- package/dist.commonjs/signer/dummy/index.js +19 -3
- package/dist.commonjs/signer/dummy/openLink.js +6 -2
- package/dist.commonjs/signer/evm/index.js +19 -3
- package/dist.commonjs/signer/evm/signerEvm.js +35 -31
- package/dist.commonjs/signer/evm/signerEvmAddressReadonly.js +8 -4
- package/dist.commonjs/signer/evm/verify.js +7 -4
- package/dist.commonjs/signer/index.js +23 -7
- package/dist.commonjs/signer/nostr/index.js +18 -2
- package/dist.commonjs/signer/nostr/signerNostr.js +25 -21
- package/dist.commonjs/signer/nostr/verify.js +16 -12
- package/dist.commonjs/signer/signer/index.js +25 -19
- package/dist.commonjs/utils/index.d.ts +3 -0
- package/dist.commonjs/utils/index.d.ts.map +1 -1
- package/dist.commonjs/utils/index.js +12 -6
- package/package.json +1 -2
- 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 -1468
- package/dist.commonjs/ckb/molecule.advanced/index.d.ts +0 -6
- package/dist.commonjs/ckb/molecule.advanced/index.d.ts.map +0 -1
- package/dist.commonjs/ckb/molecule.advanced/index.js +0 -7
- 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
package/dist/ckb/transaction.js
CHANGED
|
@@ -1,12 +1,24 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
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;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var OutPoint_1, CellOutput_1, Since_1, CellInput_1, CellDep_1, WitnessArgs_1, Transaction_1;
|
|
1
8
|
import { bytesFrom } from "../bytes/index.js";
|
|
2
9
|
import { Zero, fixedPointFrom, fixedPointToString, } from "../fixedPoint/index.js";
|
|
3
10
|
import { HasherCkb, hashCkb } from "../hasher/index.js";
|
|
4
11
|
import { hexFrom } from "../hex/index.js";
|
|
12
|
+
import { mol } from "../molecule/index.js";
|
|
5
13
|
import { numFrom, numFromBytes, numToBytes, numToHex, } from "../num/index.js";
|
|
6
14
|
import { apply, reduceAsync } from "../utils/index.js";
|
|
7
|
-
import
|
|
8
|
-
import { Script } from "./script.js";
|
|
15
|
+
import { Script, ScriptOpt } from "./script.js";
|
|
9
16
|
import { DEP_TYPE_TO_NUM, NUM_TO_DEP_TYPE } from "./transaction.advanced.js";
|
|
17
|
+
export const DepTypeCodec = mol.Codec.from({
|
|
18
|
+
byteLength: 1,
|
|
19
|
+
encode: depTypeToBytes,
|
|
20
|
+
decode: depTypeFromBytes,
|
|
21
|
+
});
|
|
10
22
|
/**
|
|
11
23
|
* Converts a DepTypeLike value to a DepType.
|
|
12
24
|
* @public
|
|
@@ -72,7 +84,7 @@ export function depTypeFromBytes(bytes) {
|
|
|
72
84
|
/**
|
|
73
85
|
* @public
|
|
74
86
|
*/
|
|
75
|
-
|
|
87
|
+
let OutPoint = OutPoint_1 = class OutPoint extends mol.Entity.Base() {
|
|
76
88
|
/**
|
|
77
89
|
* Creates an instance of OutPoint.
|
|
78
90
|
*
|
|
@@ -80,22 +92,10 @@ export class OutPoint {
|
|
|
80
92
|
* @param index - The index of the output in the transaction.
|
|
81
93
|
*/
|
|
82
94
|
constructor(txHash, index) {
|
|
95
|
+
super();
|
|
83
96
|
this.txHash = txHash;
|
|
84
97
|
this.index = index;
|
|
85
98
|
}
|
|
86
|
-
/**
|
|
87
|
-
* Clone an OutPoint.
|
|
88
|
-
*
|
|
89
|
-
* @returns A cloned OutPoint instance.
|
|
90
|
-
*
|
|
91
|
-
* @example
|
|
92
|
-
* ```typescript
|
|
93
|
-
* const outPoint1 = outPoint0.clone();
|
|
94
|
-
* ```
|
|
95
|
-
*/
|
|
96
|
-
clone() {
|
|
97
|
-
return new OutPoint(this.txHash, this.index);
|
|
98
|
-
}
|
|
99
99
|
/**
|
|
100
100
|
* Creates an OutPoint instance from an OutPointLike object.
|
|
101
101
|
*
|
|
@@ -108,72 +108,25 @@ export class OutPoint {
|
|
|
108
108
|
* ```
|
|
109
109
|
*/
|
|
110
110
|
static from(outPoint) {
|
|
111
|
-
if (outPoint instanceof
|
|
111
|
+
if (outPoint instanceof OutPoint_1) {
|
|
112
112
|
return outPoint;
|
|
113
113
|
}
|
|
114
|
-
return new
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
}
|
|
127
|
-
/**
|
|
128
|
-
* Converts the OutPoint instance to bytes.
|
|
129
|
-
*
|
|
130
|
-
* @returns A Uint8Array containing the outpoint bytes.
|
|
131
|
-
*
|
|
132
|
-
* @example
|
|
133
|
-
* ```typescript
|
|
134
|
-
* const outPointBytes = outPoint.toBytes();
|
|
135
|
-
* ```
|
|
136
|
-
*/
|
|
137
|
-
toBytes() {
|
|
138
|
-
return bytesFrom(mol.SerializeOutPoint(this._toMolData()));
|
|
139
|
-
}
|
|
140
|
-
/**
|
|
141
|
-
* Creates an OutPoint instance from a byte-like value or molecule OutPoint.
|
|
142
|
-
*
|
|
143
|
-
* @param bytes - The byte-like value or molecule OutPoint to convert.
|
|
144
|
-
* @returns An OutPoint instance.
|
|
145
|
-
*
|
|
146
|
-
* @example
|
|
147
|
-
* ```typescript
|
|
148
|
-
* const outPoint = OutPoint.fromBytes(new Uint8Array([/* outpoint bytes *\/]));
|
|
149
|
-
* ```
|
|
150
|
-
*/
|
|
151
|
-
static fromBytes(bytes) {
|
|
152
|
-
const view = bytes instanceof mol.OutPoint
|
|
153
|
-
? bytes
|
|
154
|
-
: new mol.OutPoint(bytesFrom(bytes));
|
|
155
|
-
return new OutPoint(hexFrom(view.getTxHash().raw()), numFromBytes(view.getIndex().raw()));
|
|
156
|
-
}
|
|
157
|
-
/**
|
|
158
|
-
* Compares the current OutPoint instance with another OutPointLike object for equality.
|
|
159
|
-
*
|
|
160
|
-
* @param val - The OutPointLike object to compare with.
|
|
161
|
-
* @returns True if the out points are equal, otherwise false.
|
|
162
|
-
*
|
|
163
|
-
* @example
|
|
164
|
-
* ```typescript
|
|
165
|
-
* const isEqual = outPoint.eq(anotherOutPoint);
|
|
166
|
-
* ```
|
|
167
|
-
*/
|
|
168
|
-
eq(val) {
|
|
169
|
-
const outPoint = OutPoint.from(val);
|
|
170
|
-
return this.txHash === outPoint.txHash && this.index === outPoint.index;
|
|
171
|
-
}
|
|
172
|
-
}
|
|
114
|
+
return new OutPoint_1(hexFrom(outPoint.txHash), numFrom(outPoint.index));
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
OutPoint = OutPoint_1 = __decorate([
|
|
118
|
+
mol.codec(mol
|
|
119
|
+
.struct({
|
|
120
|
+
txHash: mol.Byte32,
|
|
121
|
+
index: mol.Uint32,
|
|
122
|
+
})
|
|
123
|
+
.map({ outMap: (decoded) => OutPoint.from(decoded) }))
|
|
124
|
+
], OutPoint);
|
|
125
|
+
export { OutPoint };
|
|
173
126
|
/**
|
|
174
127
|
* @public
|
|
175
128
|
*/
|
|
176
|
-
|
|
129
|
+
let CellOutput = CellOutput_1 = class CellOutput extends mol.Entity.Base() {
|
|
177
130
|
/**
|
|
178
131
|
* Creates an instance of CellOutput.
|
|
179
132
|
*
|
|
@@ -182,6 +135,7 @@ export class CellOutput {
|
|
|
182
135
|
* @param type - The optional type script of the cell.
|
|
183
136
|
*/
|
|
184
137
|
constructor(capacity, lock, type) {
|
|
138
|
+
super();
|
|
185
139
|
this.capacity = capacity;
|
|
186
140
|
this.lock = lock;
|
|
187
141
|
this.type = type;
|
|
@@ -189,19 +143,6 @@ export class CellOutput {
|
|
|
189
143
|
get occupiedSize() {
|
|
190
144
|
return 8 + this.lock.occupiedSize + (this.type?.occupiedSize ?? 0);
|
|
191
145
|
}
|
|
192
|
-
/**
|
|
193
|
-
* Clone a CellOutput.
|
|
194
|
-
*
|
|
195
|
-
* @returns A cloned CellOutput instance.
|
|
196
|
-
*
|
|
197
|
-
* @example
|
|
198
|
-
* ```typescript
|
|
199
|
-
* const cellOutput1 = cellOutput0.clone();
|
|
200
|
-
* ```
|
|
201
|
-
*/
|
|
202
|
-
clone() {
|
|
203
|
-
return new CellOutput(this.capacity, this.lock.clone(), this.type?.clone());
|
|
204
|
-
}
|
|
205
146
|
/**
|
|
206
147
|
* Creates a CellOutput instance from a CellOutputLike object.
|
|
207
148
|
*
|
|
@@ -218,54 +159,23 @@ export class CellOutput {
|
|
|
218
159
|
* ```
|
|
219
160
|
*/
|
|
220
161
|
static from(cellOutput) {
|
|
221
|
-
if (cellOutput instanceof
|
|
162
|
+
if (cellOutput instanceof CellOutput_1) {
|
|
222
163
|
return cellOutput;
|
|
223
164
|
}
|
|
224
|
-
return new
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
/**
|
|
239
|
-
* Converts the CellOutput instance to bytes.
|
|
240
|
-
*
|
|
241
|
-
* @returns A Uint8Array containing the cell output bytes.
|
|
242
|
-
*
|
|
243
|
-
* @example
|
|
244
|
-
* ```typescript
|
|
245
|
-
* const cellOutputBytes = cellOutput.toBytes();
|
|
246
|
-
* ```
|
|
247
|
-
*/
|
|
248
|
-
toBytes() {
|
|
249
|
-
return bytesFrom(mol.SerializeCellOutput(this._toMolData()));
|
|
250
|
-
}
|
|
251
|
-
/**
|
|
252
|
-
* Creates a CellOutput instance from a byte-like value or molecule CellOutput.
|
|
253
|
-
*
|
|
254
|
-
* @param bytes - The byte-like value or molecule CellOutput to convert.
|
|
255
|
-
* @returns A CellOutput instance.
|
|
256
|
-
*
|
|
257
|
-
* @example
|
|
258
|
-
* ```typescript
|
|
259
|
-
* const cellOutput = CellOutput.fromBytes(new Uint8Array([/* cell output bytes *\/]));
|
|
260
|
-
* ```
|
|
261
|
-
*/
|
|
262
|
-
static fromBytes(bytes) {
|
|
263
|
-
const view = bytes instanceof mol.CellOutput
|
|
264
|
-
? bytes
|
|
265
|
-
: new mol.CellOutput(bytesFrom(bytes));
|
|
266
|
-
return new CellOutput(numFromBytes(view.getCapacity().raw()), Script.fromBytes(view.getLock()), apply(Script.fromBytes, mol.molOptional(view.getType())));
|
|
267
|
-
}
|
|
268
|
-
}
|
|
165
|
+
return new CellOutput_1(numFrom(cellOutput.capacity), Script.from(cellOutput.lock), apply(Script.from, cellOutput.type));
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
CellOutput = CellOutput_1 = __decorate([
|
|
169
|
+
mol.codec(mol
|
|
170
|
+
.table({
|
|
171
|
+
capacity: mol.Uint64,
|
|
172
|
+
lock: Script,
|
|
173
|
+
type: ScriptOpt,
|
|
174
|
+
})
|
|
175
|
+
.map({ outMap: (decoded) => CellOutput.from(decoded) }))
|
|
176
|
+
], CellOutput);
|
|
177
|
+
export { CellOutput };
|
|
178
|
+
export const CellOutputVec = mol.vector(CellOutput);
|
|
269
179
|
/**
|
|
270
180
|
* @public
|
|
271
181
|
*/
|
|
@@ -337,7 +247,7 @@ export function epochToHex(epochLike) {
|
|
|
337
247
|
/**
|
|
338
248
|
* @public
|
|
339
249
|
*/
|
|
340
|
-
|
|
250
|
+
let Since = Since_1 = class Since extends mol.Entity.Base() {
|
|
341
251
|
/**
|
|
342
252
|
* Creates an instance of Since.
|
|
343
253
|
*
|
|
@@ -346,6 +256,7 @@ export class Since {
|
|
|
346
256
|
* @param value - The value of since
|
|
347
257
|
*/
|
|
348
258
|
constructor(relative, metric, value) {
|
|
259
|
+
super();
|
|
349
260
|
this.relative = relative;
|
|
350
261
|
this.metric = metric;
|
|
351
262
|
this.value = value;
|
|
@@ -361,7 +272,7 @@ export class Since {
|
|
|
361
272
|
* ```
|
|
362
273
|
*/
|
|
363
274
|
clone() {
|
|
364
|
-
return new
|
|
275
|
+
return new Since_1(this.relative, this.metric, this.value);
|
|
365
276
|
}
|
|
366
277
|
/**
|
|
367
278
|
* Creates a Since instance from a SinceLike object.
|
|
@@ -375,13 +286,13 @@ export class Since {
|
|
|
375
286
|
* ```
|
|
376
287
|
*/
|
|
377
288
|
static from(since) {
|
|
378
|
-
if (since instanceof
|
|
289
|
+
if (since instanceof Since_1) {
|
|
379
290
|
return since;
|
|
380
291
|
}
|
|
381
292
|
if (typeof since === "object" && "relative" in since) {
|
|
382
|
-
return new
|
|
293
|
+
return new Since_1(since.relative, since.metric, numFrom(since.value));
|
|
383
294
|
}
|
|
384
|
-
return
|
|
295
|
+
return Since_1.fromNum(since);
|
|
385
296
|
}
|
|
386
297
|
/**
|
|
387
298
|
* Converts the Since instance to num.
|
|
@@ -418,13 +329,20 @@ export class Since {
|
|
|
418
329
|
const relative = num >> numFrom(63) === Zero ? "absolute" : "relative";
|
|
419
330
|
const metric = ["blockNumber", "epoch", "timestamp"][Number((num >> numFrom(61)) & numFrom(3))];
|
|
420
331
|
const value = num & numFrom("0x00ffffffffffffff");
|
|
421
|
-
return new
|
|
422
|
-
}
|
|
423
|
-
}
|
|
332
|
+
return new Since_1(relative, metric, value);
|
|
333
|
+
}
|
|
334
|
+
};
|
|
335
|
+
Since = Since_1 = __decorate([
|
|
336
|
+
mol.codec(mol.Uint64.map({
|
|
337
|
+
inMap: (encodable) => Since.from(encodable).toNum(),
|
|
338
|
+
outMap: (decoded) => Since.from(decoded),
|
|
339
|
+
}))
|
|
340
|
+
], Since);
|
|
341
|
+
export { Since };
|
|
424
342
|
/**
|
|
425
343
|
* @public
|
|
426
344
|
*/
|
|
427
|
-
|
|
345
|
+
let CellInput = CellInput_1 = class CellInput extends mol.Entity.Base() {
|
|
428
346
|
/**
|
|
429
347
|
* Creates an instance of CellInput.
|
|
430
348
|
*
|
|
@@ -434,24 +352,12 @@ export class CellInput {
|
|
|
434
352
|
* @param outputData - The optional output data associated with the cell input.
|
|
435
353
|
*/
|
|
436
354
|
constructor(previousOutput, since, cellOutput, outputData) {
|
|
355
|
+
super();
|
|
437
356
|
this.previousOutput = previousOutput;
|
|
438
357
|
this.since = since;
|
|
439
358
|
this.cellOutput = cellOutput;
|
|
440
359
|
this.outputData = outputData;
|
|
441
360
|
}
|
|
442
|
-
/**
|
|
443
|
-
* Clone a CellInput.
|
|
444
|
-
*
|
|
445
|
-
* @returns A cloned CellInput instance.
|
|
446
|
-
*
|
|
447
|
-
* @example
|
|
448
|
-
* ```typescript
|
|
449
|
-
* const cellInput1 = cellInput0.clone();
|
|
450
|
-
* ```
|
|
451
|
-
*/
|
|
452
|
-
clone() {
|
|
453
|
-
return new CellInput(this.previousOutput.clone(), this.since, this.cellOutput?.clone(), this.outputData);
|
|
454
|
-
}
|
|
455
361
|
/**
|
|
456
362
|
* Creates a CellInput instance from a CellInputLike object.
|
|
457
363
|
*
|
|
@@ -467,10 +373,10 @@ export class CellInput {
|
|
|
467
373
|
* ```
|
|
468
374
|
*/
|
|
469
375
|
static from(cellInput) {
|
|
470
|
-
if (cellInput instanceof
|
|
376
|
+
if (cellInput instanceof CellInput_1) {
|
|
471
377
|
return cellInput;
|
|
472
378
|
}
|
|
473
|
-
return new
|
|
379
|
+
return new CellInput_1(OutPoint.from(cellInput.previousOutput), Since.from(cellInput.since ?? 0).toNum(), apply(CellOutput.from, cellInput.cellOutput), apply(hexFrom, cellInput.outputData));
|
|
474
380
|
}
|
|
475
381
|
/**
|
|
476
382
|
* Complete extra infos in the input. Like the output of the out point.
|
|
@@ -493,52 +399,24 @@ export class CellInput {
|
|
|
493
399
|
this.cellOutput = cell.cellOutput;
|
|
494
400
|
this.outputData = cell.outputData;
|
|
495
401
|
}
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
}
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
* @returns A Uint8Array containing the cell input bytes.
|
|
511
|
-
*
|
|
512
|
-
* @example
|
|
513
|
-
* ```typescript
|
|
514
|
-
* const cellInputBytes = cellInput.toBytes();
|
|
515
|
-
* ```
|
|
516
|
-
*/
|
|
517
|
-
toBytes() {
|
|
518
|
-
return bytesFrom(mol.SerializeCellInput(this._toMolData()));
|
|
519
|
-
}
|
|
520
|
-
/**
|
|
521
|
-
* Creates a CellInput instance from a byte-like value or molecule CellInput.
|
|
522
|
-
*
|
|
523
|
-
* @param bytes - The byte-like value or molecule CellInput to convert.
|
|
524
|
-
* @returns A CellInput instance.
|
|
525
|
-
*
|
|
526
|
-
* @example
|
|
527
|
-
* ```typescript
|
|
528
|
-
* const cellInput = CellInput.fromBytes(new Uint8Array([/* cell input bytes *\/]));
|
|
529
|
-
* ```
|
|
530
|
-
*/
|
|
531
|
-
static fromBytes(bytes) {
|
|
532
|
-
const view = bytes instanceof mol.CellInput
|
|
533
|
-
? bytes
|
|
534
|
-
: new mol.CellInput(bytesFrom(bytes));
|
|
535
|
-
return new CellInput(OutPoint.fromBytes(view.getPreviousOutput()), numFromBytes(view.getSince().raw()));
|
|
536
|
-
}
|
|
537
|
-
}
|
|
402
|
+
};
|
|
403
|
+
CellInput = CellInput_1 = __decorate([
|
|
404
|
+
mol.codec(mol
|
|
405
|
+
.struct({
|
|
406
|
+
since: Since,
|
|
407
|
+
previousOutput: OutPoint,
|
|
408
|
+
})
|
|
409
|
+
.map({
|
|
410
|
+
inMap: (encodable) => ({ ...encodable, since: encodable.since ?? 0 }),
|
|
411
|
+
outMap: (decoded) => CellInput.from(decoded),
|
|
412
|
+
}))
|
|
413
|
+
], CellInput);
|
|
414
|
+
export { CellInput };
|
|
415
|
+
export const CellInputVec = mol.vector(CellInput);
|
|
538
416
|
/**
|
|
539
417
|
* @public
|
|
540
418
|
*/
|
|
541
|
-
|
|
419
|
+
let CellDep = CellDep_1 = class CellDep extends mol.Entity.Base() {
|
|
542
420
|
/**
|
|
543
421
|
* Creates an instance of CellDep.
|
|
544
422
|
*
|
|
@@ -546,6 +424,7 @@ export class CellDep {
|
|
|
546
424
|
* @param depType - The dependency type.
|
|
547
425
|
*/
|
|
548
426
|
constructor(outPoint, depType) {
|
|
427
|
+
super();
|
|
549
428
|
this.outPoint = outPoint;
|
|
550
429
|
this.depType = depType;
|
|
551
430
|
}
|
|
@@ -560,7 +439,7 @@ export class CellDep {
|
|
|
560
439
|
* ```
|
|
561
440
|
*/
|
|
562
441
|
clone() {
|
|
563
|
-
return new
|
|
442
|
+
return new CellDep_1(this.outPoint.clone(), this.depType);
|
|
564
443
|
}
|
|
565
444
|
/**
|
|
566
445
|
* Creates a CellDep instance from a CellDepLike object.
|
|
@@ -577,70 +456,26 @@ export class CellDep {
|
|
|
577
456
|
* ```
|
|
578
457
|
*/
|
|
579
458
|
static from(cellDep) {
|
|
580
|
-
if (cellDep instanceof
|
|
459
|
+
if (cellDep instanceof CellDep_1) {
|
|
581
460
|
return cellDep;
|
|
582
461
|
}
|
|
583
|
-
return new
|
|
584
|
-
}
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
/**
|
|
597
|
-
* Converts the CellDep instance to bytes.
|
|
598
|
-
*
|
|
599
|
-
* @returns A Uint8Array containing the cell dependency bytes.
|
|
600
|
-
*
|
|
601
|
-
* @example
|
|
602
|
-
* ```typescript
|
|
603
|
-
* const cellDepBytes = cellDep.toBytes();
|
|
604
|
-
* ```
|
|
605
|
-
*/
|
|
606
|
-
toBytes() {
|
|
607
|
-
return bytesFrom(mol.SerializeCellDep(this._toMolData()));
|
|
608
|
-
}
|
|
609
|
-
/**
|
|
610
|
-
* Creates a CellDep instance from a byte-like value or molecule CellDep.
|
|
611
|
-
*
|
|
612
|
-
* @param bytes - The byte-like value or molecule CellDep to convert.
|
|
613
|
-
* @returns A CellDep instance.
|
|
614
|
-
*
|
|
615
|
-
* @example
|
|
616
|
-
* ```typescript
|
|
617
|
-
* const cellDep = CellDep.fromBytes(new Uint8Array([/* cell dep bytes *\/]));
|
|
618
|
-
* ```
|
|
619
|
-
*/
|
|
620
|
-
fromBytes(bytes) {
|
|
621
|
-
const view = bytes instanceof mol.CellDep ? bytes : new mol.CellDep(bytesFrom(bytes));
|
|
622
|
-
return new CellDep(OutPoint.fromBytes(view.getOutPoint()), depTypeFromBytes([view.getDepType()]));
|
|
623
|
-
}
|
|
624
|
-
/**
|
|
625
|
-
* Compares the current CellDep instance with another CellDepLike object for equality.
|
|
626
|
-
*
|
|
627
|
-
* @param val - The CellDepLike object to compare with.
|
|
628
|
-
* @returns True if the cell deps are equal, otherwise false.
|
|
629
|
-
*
|
|
630
|
-
* @example
|
|
631
|
-
* ```typescript
|
|
632
|
-
* const isEqual = cellDep.eq(anotherCellDep);
|
|
633
|
-
* ```
|
|
634
|
-
*/
|
|
635
|
-
eq(val) {
|
|
636
|
-
const cellDep = CellDep.from(val);
|
|
637
|
-
return (this.outPoint.eq(cellDep.outPoint) && this.depType === cellDep.depType);
|
|
638
|
-
}
|
|
639
|
-
}
|
|
462
|
+
return new CellDep_1(OutPoint.from(cellDep.outPoint), depTypeFrom(cellDep.depType));
|
|
463
|
+
}
|
|
464
|
+
};
|
|
465
|
+
CellDep = CellDep_1 = __decorate([
|
|
466
|
+
mol.codec(mol
|
|
467
|
+
.struct({
|
|
468
|
+
outPoint: OutPoint,
|
|
469
|
+
depType: DepTypeCodec,
|
|
470
|
+
})
|
|
471
|
+
.map({ outMap: (decoded) => CellDep.from(decoded) }))
|
|
472
|
+
], CellDep);
|
|
473
|
+
export { CellDep };
|
|
474
|
+
export const CellDepVec = mol.vector(CellDep);
|
|
640
475
|
/**
|
|
641
476
|
* @public
|
|
642
477
|
*/
|
|
643
|
-
|
|
478
|
+
let WitnessArgs = WitnessArgs_1 = class WitnessArgs extends mol.Entity.Base() {
|
|
644
479
|
/**
|
|
645
480
|
* Creates an instance of WitnessArgs.
|
|
646
481
|
*
|
|
@@ -649,6 +484,7 @@ export class WitnessArgs {
|
|
|
649
484
|
* @param outputType - The optional output type field of the witness.
|
|
650
485
|
*/
|
|
651
486
|
constructor(lock, inputType, outputType) {
|
|
487
|
+
super();
|
|
652
488
|
this.lock = lock;
|
|
653
489
|
this.inputType = inputType;
|
|
654
490
|
this.outputType = outputType;
|
|
@@ -669,54 +505,22 @@ export class WitnessArgs {
|
|
|
669
505
|
* ```
|
|
670
506
|
*/
|
|
671
507
|
static from(witnessArgs) {
|
|
672
|
-
if (witnessArgs instanceof
|
|
508
|
+
if (witnessArgs instanceof WitnessArgs_1) {
|
|
673
509
|
return witnessArgs;
|
|
674
510
|
}
|
|
675
|
-
return new
|
|
676
|
-
}
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
}
|
|
689
|
-
/**
|
|
690
|
-
* Converts the WitnessArgs instance to bytes.
|
|
691
|
-
*
|
|
692
|
-
* @returns A Uint8Array containing the witness arguments bytes.
|
|
693
|
-
*
|
|
694
|
-
* @example
|
|
695
|
-
* ```typescript
|
|
696
|
-
* const witnessArgsBytes = witnessArgs.toBytes();
|
|
697
|
-
* ```
|
|
698
|
-
*/
|
|
699
|
-
toBytes() {
|
|
700
|
-
return bytesFrom(mol.SerializeWitnessArgs(this._toMolData()));
|
|
701
|
-
}
|
|
702
|
-
/**
|
|
703
|
-
* Creates a WitnessArgs instance from a byte-like value or molecule WitnessArgs.
|
|
704
|
-
*
|
|
705
|
-
* @param bytes - The byte-like value or molecule WitnessArgs to convert.
|
|
706
|
-
* @returns A WitnessArgs instance.
|
|
707
|
-
*
|
|
708
|
-
* @example
|
|
709
|
-
* ```typescript
|
|
710
|
-
* const witnessArgs = WitnessArgs.fromBytes(new Uint8Array([/* witness args bytes *\/]));
|
|
711
|
-
* ```
|
|
712
|
-
*/
|
|
713
|
-
static fromBytes(bytes) {
|
|
714
|
-
const view = bytes instanceof mol.WitnessArgs
|
|
715
|
-
? bytes
|
|
716
|
-
: new mol.WitnessArgs(bytesFrom(bytes));
|
|
717
|
-
return new WitnessArgs(apply(hexFrom, mol.molOptional(view.getLock())?.raw()), apply(hexFrom, mol.molOptional(view.getInputType())?.raw()), apply(hexFrom, mol.molOptional(view.getOutputType())?.raw()));
|
|
718
|
-
}
|
|
719
|
-
}
|
|
511
|
+
return new WitnessArgs_1(apply(hexFrom, witnessArgs.lock), apply(hexFrom, witnessArgs.inputType), apply(hexFrom, witnessArgs.outputType));
|
|
512
|
+
}
|
|
513
|
+
};
|
|
514
|
+
WitnessArgs = WitnessArgs_1 = __decorate([
|
|
515
|
+
mol.codec(mol
|
|
516
|
+
.table({
|
|
517
|
+
lock: mol.BytesOpt,
|
|
518
|
+
inputType: mol.BytesOpt,
|
|
519
|
+
outputType: mol.BytesOpt,
|
|
520
|
+
})
|
|
521
|
+
.map({ outMap: (decoded) => WitnessArgs.from(decoded) }))
|
|
522
|
+
], WitnessArgs);
|
|
523
|
+
export { WitnessArgs };
|
|
720
524
|
/**
|
|
721
525
|
* @public
|
|
722
526
|
*/
|
|
@@ -727,10 +531,20 @@ export function udtBalanceFrom(dataLike) {
|
|
|
727
531
|
}
|
|
728
532
|
return numFromBytes(data);
|
|
729
533
|
}
|
|
534
|
+
export const RawTransaction = mol
|
|
535
|
+
.table({
|
|
536
|
+
version: mol.Uint32,
|
|
537
|
+
cellDeps: CellDepVec,
|
|
538
|
+
headerDeps: mol.Byte32Vec,
|
|
539
|
+
inputs: CellInputVec,
|
|
540
|
+
outputs: CellOutputVec,
|
|
541
|
+
outputsData: mol.BytesVec,
|
|
542
|
+
})
|
|
543
|
+
.map({ outMap: (decoded) => Transaction.from(decoded) });
|
|
730
544
|
/**
|
|
731
545
|
* @public
|
|
732
546
|
*/
|
|
733
|
-
|
|
547
|
+
let Transaction = Transaction_1 = class Transaction extends mol.Entity.Base() {
|
|
734
548
|
/**
|
|
735
549
|
* Creates an instance of Transaction.
|
|
736
550
|
*
|
|
@@ -743,6 +557,7 @@ export class Transaction {
|
|
|
743
557
|
* @param witnesses - The witnesses of the transaction.
|
|
744
558
|
*/
|
|
745
559
|
constructor(version, cellDeps, headerDeps, inputs, outputs, outputsData, witnesses) {
|
|
560
|
+
super();
|
|
746
561
|
this.version = version;
|
|
747
562
|
this.cellDeps = cellDeps;
|
|
748
563
|
this.headerDeps = headerDeps;
|
|
@@ -762,7 +577,7 @@ export class Transaction {
|
|
|
762
577
|
* ```
|
|
763
578
|
*/
|
|
764
579
|
static default() {
|
|
765
|
-
return new
|
|
580
|
+
return new Transaction_1(0n, [], [], [], [], [], []);
|
|
766
581
|
}
|
|
767
582
|
/**
|
|
768
583
|
* Copy every properties from another transaction.
|
|
@@ -773,7 +588,7 @@ export class Transaction {
|
|
|
773
588
|
* ```
|
|
774
589
|
*/
|
|
775
590
|
copy(txLike) {
|
|
776
|
-
const tx =
|
|
591
|
+
const tx = Transaction_1.from(txLike);
|
|
777
592
|
this.version = tx.version;
|
|
778
593
|
this.cellDeps = tx.cellDeps;
|
|
779
594
|
this.headerDeps = tx.headerDeps;
|
|
@@ -782,19 +597,6 @@ export class Transaction {
|
|
|
782
597
|
this.outputsData = tx.outputsData;
|
|
783
598
|
this.witnesses = tx.witnesses;
|
|
784
599
|
}
|
|
785
|
-
/**
|
|
786
|
-
* Clone a Transaction.
|
|
787
|
-
*
|
|
788
|
-
* @returns A cloned instance
|
|
789
|
-
*
|
|
790
|
-
* @example
|
|
791
|
-
* ```typescript
|
|
792
|
-
* const tx1 = tx0.clone();
|
|
793
|
-
* ```
|
|
794
|
-
*/
|
|
795
|
-
clone() {
|
|
796
|
-
return new Transaction(0n, this.cellDeps.map((c) => c.clone()), [...this.headerDeps], this.inputs.map((i) => i.clone()), this.outputs.map((o) => o.clone()), [...this.outputsData], [...this.witnesses]);
|
|
797
|
-
}
|
|
798
600
|
/**
|
|
799
601
|
* Creates a Transaction instance from a TransactionLike object.
|
|
800
602
|
*
|
|
@@ -815,7 +617,7 @@ export class Transaction {
|
|
|
815
617
|
* ```
|
|
816
618
|
*/
|
|
817
619
|
static from(tx) {
|
|
818
|
-
if (tx instanceof
|
|
620
|
+
if (tx instanceof Transaction_1) {
|
|
819
621
|
return tx;
|
|
820
622
|
}
|
|
821
623
|
const outputs = tx.outputs?.map((output, i) => {
|
|
@@ -833,7 +635,7 @@ export class Transaction {
|
|
|
833
635
|
if (tx.outputsData != null && outputsData.length < tx.outputsData.length) {
|
|
834
636
|
outputsData.push(...tx.outputsData.slice(outputsData.length).map((d) => hexFrom(d)));
|
|
835
637
|
}
|
|
836
|
-
return new
|
|
638
|
+
return new Transaction_1(numFrom(tx.version ?? 0), tx.cellDeps?.map((cellDep) => CellDep.from(cellDep)) ?? [], tx.headerDeps?.map(hexFrom) ?? [], tx.inputs?.map((input) => CellInput.from(input)) ?? [], outputs, outputsData, tx.witnesses?.map(hexFrom) ?? []);
|
|
837
639
|
}
|
|
838
640
|
/**
|
|
839
641
|
* Creates a Transaction instance from a Lumos skeleton.
|
|
@@ -849,7 +651,7 @@ export class Transaction {
|
|
|
849
651
|
* ```
|
|
850
652
|
*/
|
|
851
653
|
static fromLumosSkeleton(skeleton) {
|
|
852
|
-
return
|
|
654
|
+
return Transaction_1.from({
|
|
853
655
|
version: 0n,
|
|
854
656
|
cellDeps: skeleton.cellDeps.toArray(),
|
|
855
657
|
headerDeps: skeleton.headerDeps.toArray(),
|
|
@@ -889,50 +691,34 @@ export class Transaction {
|
|
|
889
691
|
* ```
|
|
890
692
|
*/
|
|
891
693
|
rawToBytes() {
|
|
892
|
-
return
|
|
893
|
-
version: numToBytes(this.version, 4),
|
|
894
|
-
cellDeps: this.cellDeps.map((d) => d._toMolData()),
|
|
895
|
-
headerDeps: this.headerDeps.map((header) => bytesFrom(header)),
|
|
896
|
-
inputs: this.inputs.map((i) => i._toMolData()),
|
|
897
|
-
outputs: this.outputs.map((o) => o._toMolData()),
|
|
898
|
-
outputsData: this.outputsData.map((header) => bytesFrom(header)),
|
|
899
|
-
}));
|
|
694
|
+
return RawTransaction.encode(this);
|
|
900
695
|
}
|
|
901
696
|
/**
|
|
902
|
-
*
|
|
697
|
+
* Calculates the hash of the transaction without witnesses. This is the transaction hash in the usual sense.
|
|
698
|
+
* To calculate the hash of the whole transaction including the witnesses, use transaction.hashFull() instead.
|
|
903
699
|
*
|
|
904
|
-
* @returns
|
|
700
|
+
* @returns The hash of the transaction.
|
|
905
701
|
*
|
|
906
702
|
* @example
|
|
907
703
|
* ```typescript
|
|
908
|
-
* const
|
|
704
|
+
* const txHash = transaction.hash();
|
|
909
705
|
* ```
|
|
910
706
|
*/
|
|
911
|
-
|
|
912
|
-
return
|
|
913
|
-
raw: {
|
|
914
|
-
version: numToBytes(this.version, 4),
|
|
915
|
-
cellDeps: this.cellDeps.map((d) => d._toMolData()),
|
|
916
|
-
headerDeps: this.headerDeps.map((header) => bytesFrom(header)),
|
|
917
|
-
inputs: this.inputs.map((i) => i._toMolData()),
|
|
918
|
-
outputs: this.outputs.map((o) => o._toMolData()),
|
|
919
|
-
outputsData: this.outputsData.map((header) => bytesFrom(header)),
|
|
920
|
-
},
|
|
921
|
-
witnesses: this.witnesses.map((witness) => bytesFrom(witness)),
|
|
922
|
-
}));
|
|
707
|
+
hash() {
|
|
708
|
+
return hashCkb(this.rawToBytes());
|
|
923
709
|
}
|
|
924
710
|
/**
|
|
925
|
-
* Calculates the hash of the transaction.
|
|
711
|
+
* Calculates the hash of the transaction with witnesses.
|
|
926
712
|
*
|
|
927
|
-
* @returns The hash of the transaction.
|
|
713
|
+
* @returns The hash of the transaction with witnesses.
|
|
928
714
|
*
|
|
929
715
|
* @example
|
|
930
716
|
* ```typescript
|
|
931
|
-
* const
|
|
717
|
+
* const txFullHash = transaction.hashFull();
|
|
932
718
|
* ```
|
|
933
719
|
*/
|
|
934
|
-
|
|
935
|
-
return hashCkb(this.
|
|
720
|
+
hashFull() {
|
|
721
|
+
return hashCkb(this.toBytes());
|
|
936
722
|
}
|
|
937
723
|
/**
|
|
938
724
|
* Hashes a witness and updates the hasher.
|
|
@@ -988,7 +774,7 @@ export class Transaction {
|
|
|
988
774
|
if (position === -1) {
|
|
989
775
|
return undefined;
|
|
990
776
|
}
|
|
991
|
-
|
|
777
|
+
Transaction_1.hashWitnessToHasher(this.witnesses[i], hasher);
|
|
992
778
|
}
|
|
993
779
|
if (position === -1) {
|
|
994
780
|
return undefined;
|
|
@@ -1430,4 +1216,22 @@ export class Transaction {
|
|
|
1430
1216
|
return 0;
|
|
1431
1217
|
}, feeRate, filter);
|
|
1432
1218
|
}
|
|
1433
|
-
}
|
|
1219
|
+
};
|
|
1220
|
+
Transaction = Transaction_1 = __decorate([
|
|
1221
|
+
mol.codec(mol
|
|
1222
|
+
.table({
|
|
1223
|
+
raw: RawTransaction,
|
|
1224
|
+
witnesses: mol.BytesVec,
|
|
1225
|
+
})
|
|
1226
|
+
.map({
|
|
1227
|
+
inMap: (txLike) => {
|
|
1228
|
+
const tx = Transaction.from(txLike);
|
|
1229
|
+
return {
|
|
1230
|
+
raw: tx,
|
|
1231
|
+
witnesses: tx.witnesses,
|
|
1232
|
+
};
|
|
1233
|
+
},
|
|
1234
|
+
outMap: (tx) => Transaction.from({ ...tx.raw, witnesses: tx.witnesses }),
|
|
1235
|
+
}))
|
|
1236
|
+
], Transaction);
|
|
1237
|
+
export { Transaction };
|