@ckb-ccc/core 0.0.2-alpha.3 → 0.0.2
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/address/address.advanced.js +29 -34
- package/dist/address/advanced.js +1 -17
- package/dist/address/index.js +12 -16
- package/dist/advanced.js +2 -31
- package/dist/advancedBarrel.js +4 -20
- package/dist/barrel.js +10 -26
- package/dist/bytes/index.js +8 -15
- package/dist/ckb/advanced.js +3 -32
- package/dist/ckb/index.js +2 -18
- package/dist/ckb/molecule.advanced/generated.js +64 -132
- package/dist/ckb/molecule.advanced/index.js +2 -20
- package/dist/ckb/script.advanced.js +3 -6
- package/dist/ckb/script.js +19 -49
- package/dist/ckb/transaction.advanced.js +3 -6
- package/dist/ckb/transaction.js +54 -89
- package/dist/client/advanced.js +2 -18
- package/dist/client/client.d.ts +1 -0
- package/dist/client/client.d.ts.map +1 -1
- package/dist/client/client.js +2 -5
- package/dist/client/clientPublicMainnet.advanced.js +7 -10
- package/dist/client/clientPublicMainnet.js +4 -8
- package/dist/client/clientPublicTestnet.advanced.js +7 -10
- package/dist/client/clientPublicTestnet.js +4 -8
- package/dist/client/clientTypes.js +1 -2
- package/dist/client/index.js +4 -20
- package/dist/client/jsonRpc/advanced.js +13 -17
- package/dist/client/jsonRpc/index.js +5 -12
- package/dist/fixedPoint/index.js +4 -9
- package/dist/hasher/advanced.js +1 -4
- package/dist/hasher/index.js +8 -16
- package/dist/hex/index.js +4 -8
- package/dist/index.js +2 -31
- package/dist/num/index.js +15 -26
- package/dist/signer/helpers.js +7 -11
- package/dist/signer/index.js +4 -20
- package/dist/signer/signer.js +1 -5
- package/dist/signer/signerReadonly.js +2 -6
- package/dist/signer/signerReadonlyCkbScript.js +4 -8
- package/dist/utils/index.js +1 -5
- package/package.json +2 -2
- package/src/client/client.ts +2 -0
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SerializeTransaction = exports.Transaction = exports.SerializeRawTransaction = exports.RawTransaction = exports.SerializeCellDep = exports.CellDep = exports.SerializeCellOutput = exports.CellOutput = exports.SerializeCellInput = exports.CellInput = exports.SerializeOutPoint = exports.OutPoint = exports.SerializeScript = exports.Script = exports.SerializeCellOutputVec = exports.CellOutputVec = exports.SerializeCellInputVec = exports.CellInputVec = exports.SerializeCellDepVec = exports.CellDepVec = exports.SerializeProposalShortIdVec = exports.ProposalShortIdVec = exports.SerializeTransactionVec = exports.TransactionVec = exports.SerializeUncleBlockVec = exports.UncleBlockVec = exports.SerializeProposalShortId = exports.ProposalShortId = exports.SerializeScriptOpt = exports.ScriptOpt = exports.SerializeByte32Vec = exports.Byte32Vec = exports.SerializeBytesVec = exports.BytesVec = exports.SerializeBytesOptVec = exports.BytesOptVec = exports.SerializeBytesOpt = exports.BytesOpt = exports.SerializeBytes = exports.Bytes = exports.SerializeUint256 = exports.Uint256 = exports.SerializeByte32 = exports.Byte32 = exports.SerializeUint128 = exports.Uint128 = exports.SerializeUint64 = exports.Uint64 = exports.SerializeUint32 = exports.Uint32 = void 0;
|
|
4
|
-
exports.SerializeWitnessArgs = exports.WitnessArgs = exports.SerializeCellbaseWitness = exports.CellbaseWitness = exports.SerializeBlockV1 = exports.BlockV1 = exports.SerializeBlock = exports.Block = exports.SerializeUncleBlock = exports.UncleBlock = exports.SerializeHeader = exports.Header = exports.SerializeRawHeader = exports.RawHeader = void 0;
|
|
5
1
|
function dataLengthError(actual, required) {
|
|
6
2
|
throw new Error(`Invalid data length! Required: ${required}, actual: ${actual}`);
|
|
7
3
|
}
|
|
@@ -79,7 +75,7 @@ function serializeTable(buffers) {
|
|
|
79
75
|
}
|
|
80
76
|
return buffer;
|
|
81
77
|
}
|
|
82
|
-
class Uint32 {
|
|
78
|
+
export class Uint32 {
|
|
83
79
|
constructor(reader, { validate = true } = {}) {
|
|
84
80
|
this.view = new DataView(assertArrayBuffer(reader));
|
|
85
81
|
if (validate) {
|
|
@@ -105,14 +101,12 @@ class Uint32 {
|
|
|
105
101
|
return 4;
|
|
106
102
|
}
|
|
107
103
|
}
|
|
108
|
-
|
|
109
|
-
function SerializeUint32(value) {
|
|
104
|
+
export function SerializeUint32(value) {
|
|
110
105
|
const buffer = assertArrayBuffer(value);
|
|
111
106
|
assertDataLength(buffer.byteLength, 4);
|
|
112
107
|
return buffer;
|
|
113
108
|
}
|
|
114
|
-
|
|
115
|
-
class Uint64 {
|
|
109
|
+
export class Uint64 {
|
|
116
110
|
constructor(reader, { validate = true } = {}) {
|
|
117
111
|
this.view = new DataView(assertArrayBuffer(reader));
|
|
118
112
|
if (validate) {
|
|
@@ -132,14 +126,12 @@ class Uint64 {
|
|
|
132
126
|
return 8;
|
|
133
127
|
}
|
|
134
128
|
}
|
|
135
|
-
|
|
136
|
-
function SerializeUint64(value) {
|
|
129
|
+
export function SerializeUint64(value) {
|
|
137
130
|
const buffer = assertArrayBuffer(value);
|
|
138
131
|
assertDataLength(buffer.byteLength, 8);
|
|
139
132
|
return buffer;
|
|
140
133
|
}
|
|
141
|
-
|
|
142
|
-
class Uint128 {
|
|
134
|
+
export class Uint128 {
|
|
143
135
|
constructor(reader, { validate = true } = {}) {
|
|
144
136
|
this.view = new DataView(assertArrayBuffer(reader));
|
|
145
137
|
if (validate) {
|
|
@@ -159,14 +151,12 @@ class Uint128 {
|
|
|
159
151
|
return 16;
|
|
160
152
|
}
|
|
161
153
|
}
|
|
162
|
-
|
|
163
|
-
function SerializeUint128(value) {
|
|
154
|
+
export function SerializeUint128(value) {
|
|
164
155
|
const buffer = assertArrayBuffer(value);
|
|
165
156
|
assertDataLength(buffer.byteLength, 16);
|
|
166
157
|
return buffer;
|
|
167
158
|
}
|
|
168
|
-
|
|
169
|
-
class Byte32 {
|
|
159
|
+
export class Byte32 {
|
|
170
160
|
constructor(reader, { validate = true } = {}) {
|
|
171
161
|
this.view = new DataView(assertArrayBuffer(reader));
|
|
172
162
|
if (validate) {
|
|
@@ -186,14 +176,12 @@ class Byte32 {
|
|
|
186
176
|
return 32;
|
|
187
177
|
}
|
|
188
178
|
}
|
|
189
|
-
|
|
190
|
-
function SerializeByte32(value) {
|
|
179
|
+
export function SerializeByte32(value) {
|
|
191
180
|
const buffer = assertArrayBuffer(value);
|
|
192
181
|
assertDataLength(buffer.byteLength, 32);
|
|
193
182
|
return buffer;
|
|
194
183
|
}
|
|
195
|
-
|
|
196
|
-
class Uint256 {
|
|
184
|
+
export class Uint256 {
|
|
197
185
|
constructor(reader, { validate = true } = {}) {
|
|
198
186
|
this.view = new DataView(assertArrayBuffer(reader));
|
|
199
187
|
if (validate) {
|
|
@@ -213,14 +201,12 @@ class Uint256 {
|
|
|
213
201
|
return 32;
|
|
214
202
|
}
|
|
215
203
|
}
|
|
216
|
-
|
|
217
|
-
function SerializeUint256(value) {
|
|
204
|
+
export function SerializeUint256(value) {
|
|
218
205
|
const buffer = assertArrayBuffer(value);
|
|
219
206
|
assertDataLength(buffer.byteLength, 32);
|
|
220
207
|
return buffer;
|
|
221
208
|
}
|
|
222
|
-
|
|
223
|
-
class Bytes {
|
|
209
|
+
export class Bytes {
|
|
224
210
|
constructor(reader, { validate = true } = {}) {
|
|
225
211
|
this.view = new DataView(assertArrayBuffer(reader));
|
|
226
212
|
if (validate) {
|
|
@@ -244,16 +230,14 @@ class Bytes {
|
|
|
244
230
|
return this.view.getUint32(0, true);
|
|
245
231
|
}
|
|
246
232
|
}
|
|
247
|
-
|
|
248
|
-
function SerializeBytes(value) {
|
|
233
|
+
export function SerializeBytes(value) {
|
|
249
234
|
const item = assertArrayBuffer(value);
|
|
250
235
|
const array = new Uint8Array(4 + item.byteLength);
|
|
251
236
|
new DataView(array.buffer).setUint32(0, item.byteLength, true);
|
|
252
237
|
array.set(new Uint8Array(item), 4);
|
|
253
238
|
return array.buffer;
|
|
254
239
|
}
|
|
255
|
-
|
|
256
|
-
class BytesOpt {
|
|
240
|
+
export class BytesOpt {
|
|
257
241
|
constructor(reader, { validate = true } = {}) {
|
|
258
242
|
this.view = new DataView(assertArrayBuffer(reader));
|
|
259
243
|
if (validate) {
|
|
@@ -272,8 +256,7 @@ class BytesOpt {
|
|
|
272
256
|
return this.view.byteLength > 0;
|
|
273
257
|
}
|
|
274
258
|
}
|
|
275
|
-
|
|
276
|
-
function SerializeBytesOpt(value) {
|
|
259
|
+
export function SerializeBytesOpt(value) {
|
|
277
260
|
if (value) {
|
|
278
261
|
return SerializeBytes(value);
|
|
279
262
|
}
|
|
@@ -281,8 +264,7 @@ function SerializeBytesOpt(value) {
|
|
|
281
264
|
return new ArrayBuffer(0);
|
|
282
265
|
}
|
|
283
266
|
}
|
|
284
|
-
|
|
285
|
-
class BytesOptVec {
|
|
267
|
+
export class BytesOptVec {
|
|
286
268
|
constructor(reader, { validate = true } = {}) {
|
|
287
269
|
this.view = new DataView(assertArrayBuffer(reader));
|
|
288
270
|
if (validate) {
|
|
@@ -317,12 +299,10 @@ class BytesOptVec {
|
|
|
317
299
|
});
|
|
318
300
|
}
|
|
319
301
|
}
|
|
320
|
-
|
|
321
|
-
function SerializeBytesOptVec(value) {
|
|
302
|
+
export function SerializeBytesOptVec(value) {
|
|
322
303
|
return serializeTable(value.map((item) => SerializeBytesOpt(item)));
|
|
323
304
|
}
|
|
324
|
-
|
|
325
|
-
class BytesVec {
|
|
305
|
+
export class BytesVec {
|
|
326
306
|
constructor(reader, { validate = true } = {}) {
|
|
327
307
|
this.view = new DataView(assertArrayBuffer(reader));
|
|
328
308
|
if (validate) {
|
|
@@ -357,12 +337,10 @@ class BytesVec {
|
|
|
357
337
|
});
|
|
358
338
|
}
|
|
359
339
|
}
|
|
360
|
-
|
|
361
|
-
function SerializeBytesVec(value) {
|
|
340
|
+
export function SerializeBytesVec(value) {
|
|
362
341
|
return serializeTable(value.map((item) => SerializeBytes(item)));
|
|
363
342
|
}
|
|
364
|
-
|
|
365
|
-
class Byte32Vec {
|
|
343
|
+
export class Byte32Vec {
|
|
366
344
|
constructor(reader, { validate = true } = {}) {
|
|
367
345
|
this.view = new DataView(assertArrayBuffer(reader));
|
|
368
346
|
if (validate) {
|
|
@@ -387,8 +365,7 @@ class Byte32Vec {
|
|
|
387
365
|
return this.view.getUint32(0, true);
|
|
388
366
|
}
|
|
389
367
|
}
|
|
390
|
-
|
|
391
|
-
function SerializeByte32Vec(value) {
|
|
368
|
+
export function SerializeByte32Vec(value) {
|
|
392
369
|
const array = new Uint8Array(4 + Byte32.size() * value.length);
|
|
393
370
|
new DataView(array.buffer).setUint32(0, value.length, true);
|
|
394
371
|
for (let i = 0; i < value.length; i++) {
|
|
@@ -397,8 +374,7 @@ function SerializeByte32Vec(value) {
|
|
|
397
374
|
}
|
|
398
375
|
return array.buffer;
|
|
399
376
|
}
|
|
400
|
-
|
|
401
|
-
class ScriptOpt {
|
|
377
|
+
export class ScriptOpt {
|
|
402
378
|
constructor(reader, { validate = true } = {}) {
|
|
403
379
|
this.view = new DataView(assertArrayBuffer(reader));
|
|
404
380
|
if (validate) {
|
|
@@ -417,8 +393,7 @@ class ScriptOpt {
|
|
|
417
393
|
return this.view.byteLength > 0;
|
|
418
394
|
}
|
|
419
395
|
}
|
|
420
|
-
|
|
421
|
-
function SerializeScriptOpt(value) {
|
|
396
|
+
export function SerializeScriptOpt(value) {
|
|
422
397
|
if (value) {
|
|
423
398
|
return SerializeScript(value);
|
|
424
399
|
}
|
|
@@ -426,8 +401,7 @@ function SerializeScriptOpt(value) {
|
|
|
426
401
|
return new ArrayBuffer(0);
|
|
427
402
|
}
|
|
428
403
|
}
|
|
429
|
-
|
|
430
|
-
class ProposalShortId {
|
|
404
|
+
export class ProposalShortId {
|
|
431
405
|
constructor(reader, { validate = true } = {}) {
|
|
432
406
|
this.view = new DataView(assertArrayBuffer(reader));
|
|
433
407
|
if (validate) {
|
|
@@ -447,14 +421,12 @@ class ProposalShortId {
|
|
|
447
421
|
return 10;
|
|
448
422
|
}
|
|
449
423
|
}
|
|
450
|
-
|
|
451
|
-
function SerializeProposalShortId(value) {
|
|
424
|
+
export function SerializeProposalShortId(value) {
|
|
452
425
|
const buffer = assertArrayBuffer(value);
|
|
453
426
|
assertDataLength(buffer.byteLength, 10);
|
|
454
427
|
return buffer;
|
|
455
428
|
}
|
|
456
|
-
|
|
457
|
-
class UncleBlockVec {
|
|
429
|
+
export class UncleBlockVec {
|
|
458
430
|
constructor(reader, { validate = true } = {}) {
|
|
459
431
|
this.view = new DataView(assertArrayBuffer(reader));
|
|
460
432
|
if (validate) {
|
|
@@ -489,12 +461,10 @@ class UncleBlockVec {
|
|
|
489
461
|
});
|
|
490
462
|
}
|
|
491
463
|
}
|
|
492
|
-
|
|
493
|
-
function SerializeUncleBlockVec(value) {
|
|
464
|
+
export function SerializeUncleBlockVec(value) {
|
|
494
465
|
return serializeTable(value.map((item) => SerializeUncleBlock(item)));
|
|
495
466
|
}
|
|
496
|
-
|
|
497
|
-
class TransactionVec {
|
|
467
|
+
export class TransactionVec {
|
|
498
468
|
constructor(reader, { validate = true } = {}) {
|
|
499
469
|
this.view = new DataView(assertArrayBuffer(reader));
|
|
500
470
|
if (validate) {
|
|
@@ -529,12 +499,10 @@ class TransactionVec {
|
|
|
529
499
|
});
|
|
530
500
|
}
|
|
531
501
|
}
|
|
532
|
-
|
|
533
|
-
function SerializeTransactionVec(value) {
|
|
502
|
+
export function SerializeTransactionVec(value) {
|
|
534
503
|
return serializeTable(value.map((item) => SerializeTransaction(item)));
|
|
535
504
|
}
|
|
536
|
-
|
|
537
|
-
class ProposalShortIdVec {
|
|
505
|
+
export class ProposalShortIdVec {
|
|
538
506
|
constructor(reader, { validate = true } = {}) {
|
|
539
507
|
this.view = new DataView(assertArrayBuffer(reader));
|
|
540
508
|
if (validate) {
|
|
@@ -559,8 +527,7 @@ class ProposalShortIdVec {
|
|
|
559
527
|
return this.view.getUint32(0, true);
|
|
560
528
|
}
|
|
561
529
|
}
|
|
562
|
-
|
|
563
|
-
function SerializeProposalShortIdVec(value) {
|
|
530
|
+
export function SerializeProposalShortIdVec(value) {
|
|
564
531
|
const array = new Uint8Array(4 + ProposalShortId.size() * value.length);
|
|
565
532
|
new DataView(array.buffer).setUint32(0, value.length, true);
|
|
566
533
|
for (let i = 0; i < value.length; i++) {
|
|
@@ -569,8 +536,7 @@ function SerializeProposalShortIdVec(value) {
|
|
|
569
536
|
}
|
|
570
537
|
return array.buffer;
|
|
571
538
|
}
|
|
572
|
-
|
|
573
|
-
class CellDepVec {
|
|
539
|
+
export class CellDepVec {
|
|
574
540
|
constructor(reader, { validate = true } = {}) {
|
|
575
541
|
this.view = new DataView(assertArrayBuffer(reader));
|
|
576
542
|
if (validate) {
|
|
@@ -595,8 +561,7 @@ class CellDepVec {
|
|
|
595
561
|
return this.view.getUint32(0, true);
|
|
596
562
|
}
|
|
597
563
|
}
|
|
598
|
-
|
|
599
|
-
function SerializeCellDepVec(value) {
|
|
564
|
+
export function SerializeCellDepVec(value) {
|
|
600
565
|
const array = new Uint8Array(4 + CellDep.size() * value.length);
|
|
601
566
|
new DataView(array.buffer).setUint32(0, value.length, true);
|
|
602
567
|
for (let i = 0; i < value.length; i++) {
|
|
@@ -605,8 +570,7 @@ function SerializeCellDepVec(value) {
|
|
|
605
570
|
}
|
|
606
571
|
return array.buffer;
|
|
607
572
|
}
|
|
608
|
-
|
|
609
|
-
class CellInputVec {
|
|
573
|
+
export class CellInputVec {
|
|
610
574
|
constructor(reader, { validate = true } = {}) {
|
|
611
575
|
this.view = new DataView(assertArrayBuffer(reader));
|
|
612
576
|
if (validate) {
|
|
@@ -631,8 +595,7 @@ class CellInputVec {
|
|
|
631
595
|
return this.view.getUint32(0, true);
|
|
632
596
|
}
|
|
633
597
|
}
|
|
634
|
-
|
|
635
|
-
function SerializeCellInputVec(value) {
|
|
598
|
+
export function SerializeCellInputVec(value) {
|
|
636
599
|
const array = new Uint8Array(4 + CellInput.size() * value.length);
|
|
637
600
|
new DataView(array.buffer).setUint32(0, value.length, true);
|
|
638
601
|
for (let i = 0; i < value.length; i++) {
|
|
@@ -641,8 +604,7 @@ function SerializeCellInputVec(value) {
|
|
|
641
604
|
}
|
|
642
605
|
return array.buffer;
|
|
643
606
|
}
|
|
644
|
-
|
|
645
|
-
class CellOutputVec {
|
|
607
|
+
export class CellOutputVec {
|
|
646
608
|
constructor(reader, { validate = true } = {}) {
|
|
647
609
|
this.view = new DataView(assertArrayBuffer(reader));
|
|
648
610
|
if (validate) {
|
|
@@ -677,12 +639,10 @@ class CellOutputVec {
|
|
|
677
639
|
});
|
|
678
640
|
}
|
|
679
641
|
}
|
|
680
|
-
|
|
681
|
-
function SerializeCellOutputVec(value) {
|
|
642
|
+
export function SerializeCellOutputVec(value) {
|
|
682
643
|
return serializeTable(value.map((item) => SerializeCellOutput(item)));
|
|
683
644
|
}
|
|
684
|
-
|
|
685
|
-
class Script {
|
|
645
|
+
export class Script {
|
|
686
646
|
constructor(reader, { validate = true } = {}) {
|
|
687
647
|
this.view = new DataView(assertArrayBuffer(reader));
|
|
688
648
|
if (validate) {
|
|
@@ -724,8 +684,7 @@ class Script {
|
|
|
724
684
|
});
|
|
725
685
|
}
|
|
726
686
|
}
|
|
727
|
-
|
|
728
|
-
function SerializeScript(value) {
|
|
687
|
+
export function SerializeScript(value) {
|
|
729
688
|
const buffers = [];
|
|
730
689
|
buffers.push(SerializeByte32(value.codeHash));
|
|
731
690
|
const hashTypeView = new DataView(new ArrayBuffer(1));
|
|
@@ -734,8 +693,7 @@ function SerializeScript(value) {
|
|
|
734
693
|
buffers.push(SerializeBytes(value.args));
|
|
735
694
|
return serializeTable(buffers);
|
|
736
695
|
}
|
|
737
|
-
|
|
738
|
-
class OutPoint {
|
|
696
|
+
export class OutPoint {
|
|
739
697
|
constructor(reader, { validate = true } = {}) {
|
|
740
698
|
this.view = new DataView(assertArrayBuffer(reader));
|
|
741
699
|
if (validate) {
|
|
@@ -759,16 +717,14 @@ class OutPoint {
|
|
|
759
717
|
return 0 + Byte32.size() + Uint32.size();
|
|
760
718
|
}
|
|
761
719
|
}
|
|
762
|
-
|
|
763
|
-
function SerializeOutPoint(value) {
|
|
720
|
+
export function SerializeOutPoint(value) {
|
|
764
721
|
const array = new Uint8Array(0 + Byte32.size() + Uint32.size());
|
|
765
722
|
const view = new DataView(array.buffer);
|
|
766
723
|
array.set(new Uint8Array(SerializeByte32(value.txHash)), 0);
|
|
767
724
|
array.set(new Uint8Array(SerializeUint32(value.index)), 0 + Byte32.size());
|
|
768
725
|
return array.buffer;
|
|
769
726
|
}
|
|
770
|
-
|
|
771
|
-
class CellInput {
|
|
727
|
+
export class CellInput {
|
|
772
728
|
constructor(reader, { validate = true } = {}) {
|
|
773
729
|
this.view = new DataView(assertArrayBuffer(reader));
|
|
774
730
|
if (validate) {
|
|
@@ -792,16 +748,14 @@ class CellInput {
|
|
|
792
748
|
return 0 + Uint64.size() + OutPoint.size();
|
|
793
749
|
}
|
|
794
750
|
}
|
|
795
|
-
|
|
796
|
-
function SerializeCellInput(value) {
|
|
751
|
+
export function SerializeCellInput(value) {
|
|
797
752
|
const array = new Uint8Array(0 + Uint64.size() + OutPoint.size());
|
|
798
753
|
const view = new DataView(array.buffer);
|
|
799
754
|
array.set(new Uint8Array(SerializeUint64(value.since)), 0);
|
|
800
755
|
array.set(new Uint8Array(SerializeOutPoint(value.previousOutput)), 0 + Uint64.size());
|
|
801
756
|
return array.buffer;
|
|
802
757
|
}
|
|
803
|
-
|
|
804
|
-
class CellOutput {
|
|
758
|
+
export class CellOutput {
|
|
805
759
|
constructor(reader, { validate = true } = {}) {
|
|
806
760
|
this.view = new DataView(assertArrayBuffer(reader));
|
|
807
761
|
if (validate) {
|
|
@@ -845,16 +799,14 @@ class CellOutput {
|
|
|
845
799
|
});
|
|
846
800
|
}
|
|
847
801
|
}
|
|
848
|
-
|
|
849
|
-
function SerializeCellOutput(value) {
|
|
802
|
+
export function SerializeCellOutput(value) {
|
|
850
803
|
const buffers = [];
|
|
851
804
|
buffers.push(SerializeUint64(value.capacity));
|
|
852
805
|
buffers.push(SerializeScript(value.lock));
|
|
853
806
|
buffers.push(SerializeScriptOpt(value.type));
|
|
854
807
|
return serializeTable(buffers);
|
|
855
808
|
}
|
|
856
|
-
|
|
857
|
-
class CellDep {
|
|
809
|
+
export class CellDep {
|
|
858
810
|
constructor(reader, { validate = true } = {}) {
|
|
859
811
|
this.view = new DataView(assertArrayBuffer(reader));
|
|
860
812
|
if (validate) {
|
|
@@ -877,16 +829,14 @@ class CellDep {
|
|
|
877
829
|
return 0 + OutPoint.size() + 1;
|
|
878
830
|
}
|
|
879
831
|
}
|
|
880
|
-
|
|
881
|
-
function SerializeCellDep(value) {
|
|
832
|
+
export function SerializeCellDep(value) {
|
|
882
833
|
const array = new Uint8Array(0 + OutPoint.size() + 1);
|
|
883
834
|
const view = new DataView(array.buffer);
|
|
884
835
|
array.set(new Uint8Array(SerializeOutPoint(value.outPoint)), 0);
|
|
885
836
|
view.setUint8(0 + OutPoint.size(), value.depType);
|
|
886
837
|
return array.buffer;
|
|
887
838
|
}
|
|
888
|
-
|
|
889
|
-
class RawTransaction {
|
|
839
|
+
export class RawTransaction {
|
|
890
840
|
constructor(reader, { validate = true } = {}) {
|
|
891
841
|
this.view = new DataView(assertArrayBuffer(reader));
|
|
892
842
|
if (validate) {
|
|
@@ -963,8 +913,7 @@ class RawTransaction {
|
|
|
963
913
|
});
|
|
964
914
|
}
|
|
965
915
|
}
|
|
966
|
-
|
|
967
|
-
function SerializeRawTransaction(value) {
|
|
916
|
+
export function SerializeRawTransaction(value) {
|
|
968
917
|
const buffers = [];
|
|
969
918
|
buffers.push(SerializeUint32(value.version));
|
|
970
919
|
buffers.push(SerializeCellDepVec(value.cellDeps));
|
|
@@ -974,8 +923,7 @@ function SerializeRawTransaction(value) {
|
|
|
974
923
|
buffers.push(SerializeBytesVec(value.outputsData));
|
|
975
924
|
return serializeTable(buffers);
|
|
976
925
|
}
|
|
977
|
-
|
|
978
|
-
class Transaction {
|
|
926
|
+
export class Transaction {
|
|
979
927
|
constructor(reader, { validate = true } = {}) {
|
|
980
928
|
this.view = new DataView(assertArrayBuffer(reader));
|
|
981
929
|
if (validate) {
|
|
@@ -1008,15 +956,13 @@ class Transaction {
|
|
|
1008
956
|
});
|
|
1009
957
|
}
|
|
1010
958
|
}
|
|
1011
|
-
|
|
1012
|
-
function SerializeTransaction(value) {
|
|
959
|
+
export function SerializeTransaction(value) {
|
|
1013
960
|
const buffers = [];
|
|
1014
961
|
buffers.push(SerializeRawTransaction(value.raw));
|
|
1015
962
|
buffers.push(SerializeBytesVec(value.witnesses));
|
|
1016
963
|
return serializeTable(buffers);
|
|
1017
964
|
}
|
|
1018
|
-
|
|
1019
|
-
class RawHeader {
|
|
965
|
+
export class RawHeader {
|
|
1020
966
|
constructor(reader, { validate = true } = {}) {
|
|
1021
967
|
this.view = new DataView(assertArrayBuffer(reader));
|
|
1022
968
|
if (validate) {
|
|
@@ -1162,8 +1108,7 @@ class RawHeader {
|
|
|
1162
1108
|
Byte32.size());
|
|
1163
1109
|
}
|
|
1164
1110
|
}
|
|
1165
|
-
|
|
1166
|
-
function SerializeRawHeader(value) {
|
|
1111
|
+
export function SerializeRawHeader(value) {
|
|
1167
1112
|
const array = new Uint8Array(0 +
|
|
1168
1113
|
Uint32.size() +
|
|
1169
1114
|
Uint32.size() +
|
|
@@ -1223,8 +1168,7 @@ function SerializeRawHeader(value) {
|
|
|
1223
1168
|
Byte32.size());
|
|
1224
1169
|
return array.buffer;
|
|
1225
1170
|
}
|
|
1226
|
-
|
|
1227
|
-
class Header {
|
|
1171
|
+
export class Header {
|
|
1228
1172
|
constructor(reader, { validate = true } = {}) {
|
|
1229
1173
|
this.view = new DataView(assertArrayBuffer(reader));
|
|
1230
1174
|
if (validate) {
|
|
@@ -1248,16 +1192,14 @@ class Header {
|
|
|
1248
1192
|
return 0 + RawHeader.size() + Uint128.size();
|
|
1249
1193
|
}
|
|
1250
1194
|
}
|
|
1251
|
-
|
|
1252
|
-
function SerializeHeader(value) {
|
|
1195
|
+
export function SerializeHeader(value) {
|
|
1253
1196
|
const array = new Uint8Array(0 + RawHeader.size() + Uint128.size());
|
|
1254
1197
|
const view = new DataView(array.buffer);
|
|
1255
1198
|
array.set(new Uint8Array(SerializeRawHeader(value.raw)), 0);
|
|
1256
1199
|
array.set(new Uint8Array(SerializeUint128(value.nonce)), 0 + RawHeader.size());
|
|
1257
1200
|
return array.buffer;
|
|
1258
1201
|
}
|
|
1259
|
-
|
|
1260
|
-
class UncleBlock {
|
|
1202
|
+
export class UncleBlock {
|
|
1261
1203
|
constructor(reader, { validate = true } = {}) {
|
|
1262
1204
|
this.view = new DataView(assertArrayBuffer(reader));
|
|
1263
1205
|
if (validate) {
|
|
@@ -1290,15 +1232,13 @@ class UncleBlock {
|
|
|
1290
1232
|
});
|
|
1291
1233
|
}
|
|
1292
1234
|
}
|
|
1293
|
-
|
|
1294
|
-
function SerializeUncleBlock(value) {
|
|
1235
|
+
export function SerializeUncleBlock(value) {
|
|
1295
1236
|
const buffers = [];
|
|
1296
1237
|
buffers.push(SerializeHeader(value.header));
|
|
1297
1238
|
buffers.push(SerializeProposalShortIdVec(value.proposals));
|
|
1298
1239
|
return serializeTable(buffers);
|
|
1299
1240
|
}
|
|
1300
|
-
|
|
1301
|
-
class Block {
|
|
1241
|
+
export class Block {
|
|
1302
1242
|
constructor(reader, { validate = true } = {}) {
|
|
1303
1243
|
this.view = new DataView(assertArrayBuffer(reader));
|
|
1304
1244
|
if (validate) {
|
|
@@ -1353,8 +1293,7 @@ class Block {
|
|
|
1353
1293
|
});
|
|
1354
1294
|
}
|
|
1355
1295
|
}
|
|
1356
|
-
|
|
1357
|
-
function SerializeBlock(value) {
|
|
1296
|
+
export function SerializeBlock(value) {
|
|
1358
1297
|
const buffers = [];
|
|
1359
1298
|
buffers.push(SerializeHeader(value.header));
|
|
1360
1299
|
buffers.push(SerializeUncleBlockVec(value.uncles));
|
|
@@ -1362,8 +1301,7 @@ function SerializeBlock(value) {
|
|
|
1362
1301
|
buffers.push(SerializeProposalShortIdVec(value.proposals));
|
|
1363
1302
|
return serializeTable(buffers);
|
|
1364
1303
|
}
|
|
1365
|
-
|
|
1366
|
-
class BlockV1 {
|
|
1304
|
+
export class BlockV1 {
|
|
1367
1305
|
constructor(reader, { validate = true } = {}) {
|
|
1368
1306
|
this.view = new DataView(assertArrayBuffer(reader));
|
|
1369
1307
|
if (validate) {
|
|
@@ -1429,8 +1367,7 @@ class BlockV1 {
|
|
|
1429
1367
|
});
|
|
1430
1368
|
}
|
|
1431
1369
|
}
|
|
1432
|
-
|
|
1433
|
-
function SerializeBlockV1(value) {
|
|
1370
|
+
export function SerializeBlockV1(value) {
|
|
1434
1371
|
const buffers = [];
|
|
1435
1372
|
buffers.push(SerializeHeader(value.header));
|
|
1436
1373
|
buffers.push(SerializeUncleBlockVec(value.uncles));
|
|
@@ -1439,8 +1376,7 @@ function SerializeBlockV1(value) {
|
|
|
1439
1376
|
buffers.push(SerializeBytes(value.extension));
|
|
1440
1377
|
return serializeTable(buffers);
|
|
1441
1378
|
}
|
|
1442
|
-
|
|
1443
|
-
class CellbaseWitness {
|
|
1379
|
+
export class CellbaseWitness {
|
|
1444
1380
|
constructor(reader, { validate = true } = {}) {
|
|
1445
1381
|
this.view = new DataView(assertArrayBuffer(reader));
|
|
1446
1382
|
if (validate) {
|
|
@@ -1473,15 +1409,13 @@ class CellbaseWitness {
|
|
|
1473
1409
|
});
|
|
1474
1410
|
}
|
|
1475
1411
|
}
|
|
1476
|
-
|
|
1477
|
-
function SerializeCellbaseWitness(value) {
|
|
1412
|
+
export function SerializeCellbaseWitness(value) {
|
|
1478
1413
|
const buffers = [];
|
|
1479
1414
|
buffers.push(SerializeScript(value.lock));
|
|
1480
1415
|
buffers.push(SerializeBytes(value.message));
|
|
1481
1416
|
return serializeTable(buffers);
|
|
1482
1417
|
}
|
|
1483
|
-
|
|
1484
|
-
class WitnessArgs {
|
|
1418
|
+
export class WitnessArgs {
|
|
1485
1419
|
constructor(reader, { validate = true } = {}) {
|
|
1486
1420
|
this.view = new DataView(assertArrayBuffer(reader));
|
|
1487
1421
|
if (validate) {
|
|
@@ -1525,12 +1459,10 @@ class WitnessArgs {
|
|
|
1525
1459
|
});
|
|
1526
1460
|
}
|
|
1527
1461
|
}
|
|
1528
|
-
|
|
1529
|
-
function SerializeWitnessArgs(value) {
|
|
1462
|
+
export function SerializeWitnessArgs(value) {
|
|
1530
1463
|
const buffers = [];
|
|
1531
1464
|
buffers.push(SerializeBytesOpt(value.lock));
|
|
1532
1465
|
buffers.push(SerializeBytesOpt(value.inputType));
|
|
1533
1466
|
buffers.push(SerializeBytesOpt(value.outputType));
|
|
1534
1467
|
return serializeTable(buffers);
|
|
1535
1468
|
}
|
|
1536
|
-
exports.SerializeWitnessArgs = SerializeWitnessArgs;
|
|
@@ -1,25 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.molOptional = void 0;
|
|
18
|
-
__exportStar(require("./generated"), exports);
|
|
19
|
-
function molOptional(mol) {
|
|
1
|
+
export * from "./generated";
|
|
2
|
+
export function molOptional(mol) {
|
|
20
3
|
if (mol.hasValue()) {
|
|
21
4
|
return mol.value();
|
|
22
5
|
}
|
|
23
6
|
return;
|
|
24
7
|
}
|
|
25
|
-
exports.molOptional = molOptional;
|
|
@@ -1,16 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.HASH_TYPES = exports.NUM_TO_HASH_TYPE = exports.HASH_TYPE_TO_NUM = void 0;
|
|
4
|
-
exports.HASH_TYPE_TO_NUM = {
|
|
1
|
+
export const HASH_TYPE_TO_NUM = {
|
|
5
2
|
type: 0x01,
|
|
6
3
|
data: 0x00,
|
|
7
4
|
data1: 0x02,
|
|
8
5
|
data2: 0x04,
|
|
9
6
|
};
|
|
10
|
-
|
|
7
|
+
export const NUM_TO_HASH_TYPE = {
|
|
11
8
|
0x01: "type",
|
|
12
9
|
0x00: "data",
|
|
13
10
|
0x02: "data1",
|
|
14
11
|
0x04: "data2",
|
|
15
12
|
};
|
|
16
|
-
|
|
13
|
+
export const HASH_TYPES = Object.keys(HASH_TYPE_TO_NUM);
|