@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
package/src/molecule/codec.ts
CHANGED
|
@@ -102,7 +102,7 @@ export function fixedItemVec<Encodable, Decoded>(
|
|
|
102
102
|
|
|
103
103
|
try {
|
|
104
104
|
const decodedArray: Array<Decoded> = [];
|
|
105
|
-
for (let offset =
|
|
105
|
+
for (let offset = 4; offset < byteLength; offset += itemByteLength) {
|
|
106
106
|
decodedArray.push(
|
|
107
107
|
itemCodec.decode(value.slice(offset, offset + itemByteLength)),
|
|
108
108
|
);
|
|
@@ -151,16 +151,20 @@ export function dynItemVec<Encodable, Decoded>(
|
|
|
151
151
|
},
|
|
152
152
|
decode(buffer) {
|
|
153
153
|
const value = bytesFrom(buffer);
|
|
154
|
+
if (value.byteLength < 4) {
|
|
155
|
+
throw new Error(
|
|
156
|
+
`dynItemVec: too short buffer, expected at least 4 bytes, but got ${value.byteLength}`,
|
|
157
|
+
);
|
|
158
|
+
}
|
|
154
159
|
const byteLength = uint32From(value.slice(0, 4));
|
|
155
160
|
if (byteLength !== value.byteLength) {
|
|
156
161
|
throw new Error(
|
|
157
162
|
`dynItemVec: invalid buffer size, expected ${byteLength}, but got ${value.byteLength}`,
|
|
158
163
|
);
|
|
159
164
|
}
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
);
|
|
165
|
+
|
|
166
|
+
if (byteLength === 4) {
|
|
167
|
+
return [];
|
|
164
168
|
}
|
|
165
169
|
|
|
166
170
|
const offset = uint32From(value.slice(4, 8));
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import { Bytes, bytesEq, BytesLike } from "../bytes/index.js";
|
|
2
|
+
import { hashCkb } from "../hasher/index.js";
|
|
3
|
+
import { Hex } from "../hex/index.js";
|
|
4
|
+
import { Codec } from "./codec.js";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The base class of CCC to create a serializable instance
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
10
|
+
export abstract class Entity {
|
|
11
|
+
static Base<SubTypeLike, SubType = SubTypeLike>() {
|
|
12
|
+
abstract class Impl {
|
|
13
|
+
/**
|
|
14
|
+
* The bytes length of the entity, if it is fixed, otherwise undefined
|
|
15
|
+
* @public
|
|
16
|
+
* @static
|
|
17
|
+
*/
|
|
18
|
+
static byteLength?: number;
|
|
19
|
+
/**
|
|
20
|
+
* Encode the entity into bytes
|
|
21
|
+
* @public
|
|
22
|
+
* @static
|
|
23
|
+
* @param _ - The entity to encode
|
|
24
|
+
* @returns The encoded bytes
|
|
25
|
+
* @throws Will throw an error if the entity is not serializable
|
|
26
|
+
*/
|
|
27
|
+
static encode(_: SubTypeLike): Bytes {
|
|
28
|
+
throw new Error(
|
|
29
|
+
"encode not implemented, use @ccc.mol.codec to decorate your type",
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Decode the entity from bytes
|
|
34
|
+
* @public
|
|
35
|
+
* @static
|
|
36
|
+
* @param _ - The bytes to decode
|
|
37
|
+
* @returns The decoded entity
|
|
38
|
+
* @throws Will throw an error if the entity is not serializable
|
|
39
|
+
*/
|
|
40
|
+
static decode(_: BytesLike): SubType {
|
|
41
|
+
throw new Error(
|
|
42
|
+
"decode not implemented, use @ccc.mol.codec to decorate your type",
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Create an entity from bytes
|
|
48
|
+
* @public
|
|
49
|
+
* @static
|
|
50
|
+
* @param _ - The bytes to create the entity from
|
|
51
|
+
* @returns The created entity
|
|
52
|
+
* @throws Will throw an error if the entity is not serializable
|
|
53
|
+
*/
|
|
54
|
+
static fromBytes(_bytes: BytesLike): SubType {
|
|
55
|
+
throw new Error(
|
|
56
|
+
"fromBytes not implemented, use @ccc.mol.codec to decorate your type",
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Create an entity from a serializable object
|
|
62
|
+
* @public
|
|
63
|
+
* @static
|
|
64
|
+
* @param _ - The serializable object to create the entity from
|
|
65
|
+
* @returns The created entity
|
|
66
|
+
* @throws Will throw an error if the entity is not serializable
|
|
67
|
+
*/
|
|
68
|
+
static from(_: SubTypeLike): SubType {
|
|
69
|
+
throw new Error("from not implemented");
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Convert the entity to bytes
|
|
74
|
+
* @public
|
|
75
|
+
* @returns The bytes representation of the entity
|
|
76
|
+
*/
|
|
77
|
+
toBytes(): Bytes {
|
|
78
|
+
return (this.constructor as typeof Impl).encode(
|
|
79
|
+
this as unknown as SubTypeLike,
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Create a clone of the entity
|
|
85
|
+
* @public
|
|
86
|
+
* @returns A clone of the entity
|
|
87
|
+
*/
|
|
88
|
+
clone(): SubType {
|
|
89
|
+
return (this.constructor as typeof Impl).fromBytes(
|
|
90
|
+
this.toBytes(),
|
|
91
|
+
) as unknown as SubType;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Check if the entity is equal to another entity
|
|
96
|
+
* @public
|
|
97
|
+
* @param other - The other entity to compare with
|
|
98
|
+
* @returns True if the entities are equal, false otherwise
|
|
99
|
+
*/
|
|
100
|
+
eq(other: SubTypeLike | SubType): boolean {
|
|
101
|
+
if (this === (other as unknown as this)) {
|
|
102
|
+
return true;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
return bytesEq(
|
|
106
|
+
this.toBytes(),
|
|
107
|
+
/* eslint-disable @typescript-eslint/no-unsafe-call, @typescript-eslint/no-explicit-any */
|
|
108
|
+
(
|
|
109
|
+
((this.constructor as any)?.from(other) ?? other) as unknown as Impl
|
|
110
|
+
).toBytes(),
|
|
111
|
+
/* eslint-enable @typescript-eslint/no-unsafe-call, @typescript-eslint/no-explicit-any */
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Calculate the hash of the entity
|
|
117
|
+
* @public
|
|
118
|
+
* @returns The hash of the entity
|
|
119
|
+
*/
|
|
120
|
+
hash(): Hex {
|
|
121
|
+
return hashCkb(this.toBytes());
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
return Impl;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
abstract toBytes(): Bytes;
|
|
129
|
+
abstract hash(): Hex;
|
|
130
|
+
abstract clone(): Entity;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export function codec<
|
|
134
|
+
Encodable,
|
|
135
|
+
TypeLike extends Encodable,
|
|
136
|
+
Decoded extends TypeLike,
|
|
137
|
+
Type extends object & TypeLike,
|
|
138
|
+
ConstructorType extends {
|
|
139
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
140
|
+
new (...args: any[]): Type;
|
|
141
|
+
from(decoded: TypeLike): Type;
|
|
142
|
+
byteLength?: number;
|
|
143
|
+
encode(encodable: TypeLike): Bytes;
|
|
144
|
+
decode(bytesLike: BytesLike): TypeLike;
|
|
145
|
+
fromBytes(bytes: BytesLike): Type;
|
|
146
|
+
},
|
|
147
|
+
>(codec: Codec<Encodable, Decoded>) {
|
|
148
|
+
return function (Constructor: ConstructorType) {
|
|
149
|
+
return class Extended extends Constructor {
|
|
150
|
+
static byteLength = codec.byteLength;
|
|
151
|
+
static encode(encodable: TypeLike): Bytes {
|
|
152
|
+
return codec.encode(encodable);
|
|
153
|
+
}
|
|
154
|
+
static decode(bytesLike: BytesLike): Type {
|
|
155
|
+
return Constructor.from(codec.decode(bytesLike));
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
static fromBytes(bytes: BytesLike): Type {
|
|
159
|
+
return Constructor.from(codec.decode(bytes));
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
};
|
|
163
|
+
}
|
package/src/molecule/index.ts
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export * from "./
|
|
2
|
-
export * from "./predefined.js";
|
|
1
|
+
export * as mol from "./barrel.js";
|
|
@@ -1,44 +1,46 @@
|
|
|
1
1
|
import { bytesFrom, bytesTo } from "../bytes/index.js";
|
|
2
|
-
import * as ckb from "../ckb/index.js";
|
|
3
2
|
import { Hex, hexFrom, HexLike } from "../hex/index.js";
|
|
4
|
-
import {
|
|
5
|
-
byteVec,
|
|
6
|
-
Codec,
|
|
7
|
-
option,
|
|
8
|
-
struct,
|
|
9
|
-
table,
|
|
10
|
-
uint,
|
|
11
|
-
uintNumber,
|
|
12
|
-
vector,
|
|
13
|
-
} from "./codec.js";
|
|
3
|
+
import { byteVec, Codec, option, uint, uintNumber, vector } from "./codec.js";
|
|
14
4
|
|
|
15
5
|
export const Uint8 = uintNumber(1, true);
|
|
6
|
+
export const Uint8Opt = option(Uint8);
|
|
7
|
+
export const Uint8Vec = vector(Uint8);
|
|
8
|
+
|
|
16
9
|
export const Uint16LE = uintNumber(2, true);
|
|
17
10
|
export const Uint16BE = uintNumber(2);
|
|
18
11
|
export const Uint16 = Uint16LE;
|
|
12
|
+
export const Uint16Opt = option(Uint16);
|
|
13
|
+
export const Uint16Vec = vector(Uint16);
|
|
14
|
+
|
|
19
15
|
export const Uint32LE = uintNumber(4, true);
|
|
20
16
|
export const Uint32BE = uintNumber(4);
|
|
21
17
|
export const Uint32 = Uint32LE;
|
|
18
|
+
export const Uint32Opt = option(Uint32);
|
|
19
|
+
export const Uint32Vec = vector(Uint32);
|
|
20
|
+
|
|
22
21
|
export const Uint64LE = uint(8, true);
|
|
23
22
|
export const Uint64BE = uint(8);
|
|
24
23
|
export const Uint64 = Uint64LE;
|
|
24
|
+
export const Uint64Opt = option(Uint64);
|
|
25
|
+
export const Uint64Vec = vector(Uint64);
|
|
26
|
+
|
|
25
27
|
export const Uint128LE = uint(16, true);
|
|
26
28
|
export const Uint128BE = uint(16);
|
|
27
29
|
export const Uint128 = Uint128LE;
|
|
30
|
+
export const Uint128Opt = option(Uint128);
|
|
31
|
+
export const Uint128Vec = vector(Uint128);
|
|
32
|
+
|
|
28
33
|
export const Uint256LE = uint(32, true);
|
|
29
34
|
export const Uint256BE = uint(32);
|
|
30
35
|
export const Uint256 = Uint256LE;
|
|
36
|
+
export const Uint256Opt = option(Uint256);
|
|
37
|
+
export const Uint256Vec = vector(Uint256);
|
|
38
|
+
|
|
31
39
|
export const Uint512LE = uint(64, true);
|
|
32
40
|
export const Uint512BE = uint(64);
|
|
33
41
|
export const Uint512 = Uint512LE;
|
|
34
|
-
|
|
35
|
-
export const Uint8Opt = option(Uint8);
|
|
36
|
-
export const Uint16Opt = option(Uint16);
|
|
37
|
-
export const Uint32Opt = option(Uint32);
|
|
38
|
-
export const Uint64Opt = option(Uint64);
|
|
39
|
-
export const Uint128Opt = option(Uint128);
|
|
40
|
-
export const Uint256Opt = option(Uint256);
|
|
41
42
|
export const Uint512Opt = option(Uint512);
|
|
43
|
+
export const Uint512Vec = vector(Uint512);
|
|
42
44
|
|
|
43
45
|
export const Bytes: Codec<HexLike, Hex> = byteVec({
|
|
44
46
|
encode: (value) => bytesFrom(value),
|
|
@@ -61,54 +63,3 @@ export const String = byteVec({
|
|
|
61
63
|
});
|
|
62
64
|
export const StringVec = vector(String);
|
|
63
65
|
export const StringOpt = option(String);
|
|
64
|
-
|
|
65
|
-
export const Hash = Byte32;
|
|
66
|
-
export const HashType: Codec<ckb.HashTypeLike, ckb.HashType> = Codec.from({
|
|
67
|
-
byteLength: 1,
|
|
68
|
-
encode: ckb.hashTypeToBytes,
|
|
69
|
-
decode: ckb.hashTypeFromBytes,
|
|
70
|
-
});
|
|
71
|
-
export const Script: Codec<ckb.ScriptLike, ckb.Script> = table({
|
|
72
|
-
codeHash: Hash,
|
|
73
|
-
hashType: HashType,
|
|
74
|
-
args: Bytes,
|
|
75
|
-
}).map({ outMap: ckb.Script.from });
|
|
76
|
-
export const ScriptOpt = option(Script);
|
|
77
|
-
|
|
78
|
-
export const OutPoint: Codec<ckb.OutPointLike, ckb.OutPoint> = struct({
|
|
79
|
-
txHash: Hash,
|
|
80
|
-
index: Uint32,
|
|
81
|
-
}).map({ outMap: ckb.OutPoint.from });
|
|
82
|
-
export const CellInput: Codec<ckb.CellInputLike, ckb.CellInput> = struct({
|
|
83
|
-
previousOutput: OutPoint,
|
|
84
|
-
since: Uint64,
|
|
85
|
-
}).map({ outMap: ckb.CellInput.from });
|
|
86
|
-
export const CellInputVec = vector(CellInput);
|
|
87
|
-
|
|
88
|
-
export const CellOutput: Codec<ckb.CellOutputLike, ckb.CellOutput> = table({
|
|
89
|
-
capacity: Uint64,
|
|
90
|
-
lock: Script,
|
|
91
|
-
type: ScriptOpt,
|
|
92
|
-
}).map({ outMap: ckb.CellOutput.from });
|
|
93
|
-
export const CellOutputVec = vector(CellOutput);
|
|
94
|
-
|
|
95
|
-
export const DepType: Codec<ckb.DepTypeLike, ckb.DepType> = Codec.from({
|
|
96
|
-
byteLength: 1,
|
|
97
|
-
encode: ckb.depTypeToBytes,
|
|
98
|
-
decode: ckb.depTypeFromBytes,
|
|
99
|
-
});
|
|
100
|
-
export const CellDep: Codec<ckb.CellDepLike, ckb.CellDep> = struct({
|
|
101
|
-
outPoint: OutPoint,
|
|
102
|
-
depType: DepType,
|
|
103
|
-
}).map({ outMap: ckb.CellDep.from });
|
|
104
|
-
export const CellDepVec = vector(CellDep);
|
|
105
|
-
|
|
106
|
-
export const Transaction: Codec<ckb.TransactionLike, ckb.Transaction> = table({
|
|
107
|
-
version: Uint32,
|
|
108
|
-
cellDeps: CellDepVec,
|
|
109
|
-
headerDeps: Byte32Vec,
|
|
110
|
-
inputs: CellInputVec,
|
|
111
|
-
outputs: CellOutputVec,
|
|
112
|
-
outputsData: BytesVec,
|
|
113
|
-
witnesses: BytesVec,
|
|
114
|
-
}).map({ outMap: ckb.Transaction.from });
|
package/src/utils/index.ts
CHANGED
|
@@ -172,6 +172,11 @@ export function sleep(ms: NumLike) {
|
|
|
172
172
|
return new Promise((resolve) => setTimeout(resolve, Number(numFrom(ms))));
|
|
173
173
|
}
|
|
174
174
|
|
|
175
|
+
export type Constructor<T> = {
|
|
176
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
177
|
+
new (...args: any[]): T;
|
|
178
|
+
};
|
|
179
|
+
|
|
175
180
|
/**
|
|
176
181
|
* @public
|
|
177
182
|
*/
|
|
@@ -1,355 +0,0 @@
|
|
|
1
|
-
export function SerializeUint32(value: any): ArrayBuffer;
|
|
2
|
-
export function SerializeUint64(value: any): ArrayBuffer;
|
|
3
|
-
export function SerializeUint128(value: any): ArrayBuffer;
|
|
4
|
-
export function SerializeByte32(value: any): ArrayBuffer;
|
|
5
|
-
export function SerializeUint256(value: any): ArrayBuffer;
|
|
6
|
-
export function SerializeBytes(value: any): ArrayBufferLike;
|
|
7
|
-
export function SerializeBytesOpt(value: any): ArrayBufferLike;
|
|
8
|
-
export function SerializeBytesOptVec(value: any): ArrayBuffer;
|
|
9
|
-
export function SerializeBytesVec(value: any): ArrayBuffer;
|
|
10
|
-
export function SerializeByte32Vec(value: any): ArrayBufferLike;
|
|
11
|
-
export function SerializeScriptOpt(value: any): ArrayBuffer;
|
|
12
|
-
export function SerializeProposalShortId(value: any): ArrayBuffer;
|
|
13
|
-
export function SerializeUncleBlockVec(value: any): ArrayBuffer;
|
|
14
|
-
export function SerializeTransactionVec(value: any): ArrayBuffer;
|
|
15
|
-
export function SerializeProposalShortIdVec(value: any): ArrayBufferLike;
|
|
16
|
-
export function SerializeCellDepVec(value: any): ArrayBufferLike;
|
|
17
|
-
export function SerializeCellInputVec(value: any): ArrayBufferLike;
|
|
18
|
-
export function SerializeCellOutputVec(value: any): ArrayBuffer;
|
|
19
|
-
export function SerializeScript(value: any): ArrayBuffer;
|
|
20
|
-
export function SerializeOutPoint(value: any): ArrayBufferLike;
|
|
21
|
-
export function SerializeCellInput(value: any): ArrayBufferLike;
|
|
22
|
-
export function SerializeCellOutput(value: any): ArrayBuffer;
|
|
23
|
-
export function SerializeCellDep(value: any): ArrayBufferLike;
|
|
24
|
-
export function SerializeRawTransaction(value: any): ArrayBuffer;
|
|
25
|
-
export function SerializeTransaction(value: any): ArrayBuffer;
|
|
26
|
-
export function SerializeRawHeader(value: any): ArrayBufferLike;
|
|
27
|
-
export function SerializeHeader(value: any): ArrayBufferLike;
|
|
28
|
-
export function SerializeUncleBlock(value: any): ArrayBuffer;
|
|
29
|
-
export function SerializeBlock(value: any): ArrayBuffer;
|
|
30
|
-
export function SerializeBlockV1(value: any): ArrayBuffer;
|
|
31
|
-
export function SerializeCellbaseWitness(value: any): ArrayBuffer;
|
|
32
|
-
export function SerializeWitnessArgs(value: any): ArrayBuffer;
|
|
33
|
-
export class Uint32 {
|
|
34
|
-
static size(): number;
|
|
35
|
-
constructor(reader: any, { validate }?: {
|
|
36
|
-
validate?: boolean | undefined;
|
|
37
|
-
});
|
|
38
|
-
view: DataView;
|
|
39
|
-
validate(compatible?: boolean): void;
|
|
40
|
-
indexAt(i: any): number;
|
|
41
|
-
raw(): ArrayBuffer;
|
|
42
|
-
toBigEndianUint32(): number;
|
|
43
|
-
toLittleEndianUint32(): number;
|
|
44
|
-
}
|
|
45
|
-
export class Uint64 {
|
|
46
|
-
static size(): number;
|
|
47
|
-
constructor(reader: any, { validate }?: {
|
|
48
|
-
validate?: boolean | undefined;
|
|
49
|
-
});
|
|
50
|
-
view: DataView;
|
|
51
|
-
validate(compatible?: boolean): void;
|
|
52
|
-
indexAt(i: any): number;
|
|
53
|
-
raw(): ArrayBuffer;
|
|
54
|
-
}
|
|
55
|
-
export class Uint128 {
|
|
56
|
-
static size(): number;
|
|
57
|
-
constructor(reader: any, { validate }?: {
|
|
58
|
-
validate?: boolean | undefined;
|
|
59
|
-
});
|
|
60
|
-
view: DataView;
|
|
61
|
-
validate(compatible?: boolean): void;
|
|
62
|
-
indexAt(i: any): number;
|
|
63
|
-
raw(): ArrayBuffer;
|
|
64
|
-
}
|
|
65
|
-
export class Byte32 {
|
|
66
|
-
static size(): number;
|
|
67
|
-
constructor(reader: any, { validate }?: {
|
|
68
|
-
validate?: boolean | undefined;
|
|
69
|
-
});
|
|
70
|
-
view: DataView;
|
|
71
|
-
validate(compatible?: boolean): void;
|
|
72
|
-
indexAt(i: any): number;
|
|
73
|
-
raw(): ArrayBuffer;
|
|
74
|
-
}
|
|
75
|
-
export class Uint256 {
|
|
76
|
-
static size(): number;
|
|
77
|
-
constructor(reader: any, { validate }?: {
|
|
78
|
-
validate?: boolean | undefined;
|
|
79
|
-
});
|
|
80
|
-
view: DataView;
|
|
81
|
-
validate(compatible?: boolean): void;
|
|
82
|
-
indexAt(i: any): number;
|
|
83
|
-
raw(): ArrayBuffer;
|
|
84
|
-
}
|
|
85
|
-
export class Bytes {
|
|
86
|
-
constructor(reader: any, { validate }?: {
|
|
87
|
-
validate?: boolean | undefined;
|
|
88
|
-
});
|
|
89
|
-
view: DataView;
|
|
90
|
-
validate(compatible?: boolean): void;
|
|
91
|
-
raw(): ArrayBuffer;
|
|
92
|
-
indexAt(i: any): number;
|
|
93
|
-
length(): number;
|
|
94
|
-
}
|
|
95
|
-
export class BytesOpt {
|
|
96
|
-
constructor(reader: any, { validate }?: {
|
|
97
|
-
validate?: boolean | undefined;
|
|
98
|
-
});
|
|
99
|
-
view: DataView;
|
|
100
|
-
validate(compatible?: boolean): void;
|
|
101
|
-
value(): Bytes;
|
|
102
|
-
hasValue(): boolean;
|
|
103
|
-
}
|
|
104
|
-
export class BytesOptVec {
|
|
105
|
-
constructor(reader: any, { validate }?: {
|
|
106
|
-
validate?: boolean | undefined;
|
|
107
|
-
});
|
|
108
|
-
view: DataView;
|
|
109
|
-
validate(compatible?: boolean): void;
|
|
110
|
-
length(): number;
|
|
111
|
-
indexAt(i: any): BytesOpt;
|
|
112
|
-
}
|
|
113
|
-
export class BytesVec {
|
|
114
|
-
constructor(reader: any, { validate }?: {
|
|
115
|
-
validate?: boolean | undefined;
|
|
116
|
-
});
|
|
117
|
-
view: DataView;
|
|
118
|
-
validate(compatible?: boolean): void;
|
|
119
|
-
length(): number;
|
|
120
|
-
indexAt(i: any): Bytes;
|
|
121
|
-
}
|
|
122
|
-
export class Byte32Vec {
|
|
123
|
-
constructor(reader: any, { validate }?: {
|
|
124
|
-
validate?: boolean | undefined;
|
|
125
|
-
});
|
|
126
|
-
view: DataView;
|
|
127
|
-
validate(compatible?: boolean): void;
|
|
128
|
-
indexAt(i: any): Byte32;
|
|
129
|
-
length(): number;
|
|
130
|
-
}
|
|
131
|
-
export class ScriptOpt {
|
|
132
|
-
constructor(reader: any, { validate }?: {
|
|
133
|
-
validate?: boolean | undefined;
|
|
134
|
-
});
|
|
135
|
-
view: DataView;
|
|
136
|
-
validate(compatible?: boolean): void;
|
|
137
|
-
value(): Script;
|
|
138
|
-
hasValue(): boolean;
|
|
139
|
-
}
|
|
140
|
-
export class ProposalShortId {
|
|
141
|
-
static size(): number;
|
|
142
|
-
constructor(reader: any, { validate }?: {
|
|
143
|
-
validate?: boolean | undefined;
|
|
144
|
-
});
|
|
145
|
-
view: DataView;
|
|
146
|
-
validate(compatible?: boolean): void;
|
|
147
|
-
indexAt(i: any): number;
|
|
148
|
-
raw(): ArrayBuffer;
|
|
149
|
-
}
|
|
150
|
-
export class UncleBlockVec {
|
|
151
|
-
constructor(reader: any, { validate }?: {
|
|
152
|
-
validate?: boolean | undefined;
|
|
153
|
-
});
|
|
154
|
-
view: DataView;
|
|
155
|
-
validate(compatible?: boolean): void;
|
|
156
|
-
length(): number;
|
|
157
|
-
indexAt(i: any): UncleBlock;
|
|
158
|
-
}
|
|
159
|
-
export class TransactionVec {
|
|
160
|
-
constructor(reader: any, { validate }?: {
|
|
161
|
-
validate?: boolean | undefined;
|
|
162
|
-
});
|
|
163
|
-
view: DataView;
|
|
164
|
-
validate(compatible?: boolean): void;
|
|
165
|
-
length(): number;
|
|
166
|
-
indexAt(i: any): Transaction;
|
|
167
|
-
}
|
|
168
|
-
export class ProposalShortIdVec {
|
|
169
|
-
constructor(reader: any, { validate }?: {
|
|
170
|
-
validate?: boolean | undefined;
|
|
171
|
-
});
|
|
172
|
-
view: DataView;
|
|
173
|
-
validate(compatible?: boolean): void;
|
|
174
|
-
indexAt(i: any): ProposalShortId;
|
|
175
|
-
length(): number;
|
|
176
|
-
}
|
|
177
|
-
export class CellDepVec {
|
|
178
|
-
constructor(reader: any, { validate }?: {
|
|
179
|
-
validate?: boolean | undefined;
|
|
180
|
-
});
|
|
181
|
-
view: DataView;
|
|
182
|
-
validate(compatible?: boolean): void;
|
|
183
|
-
indexAt(i: any): CellDep;
|
|
184
|
-
length(): number;
|
|
185
|
-
}
|
|
186
|
-
export class CellInputVec {
|
|
187
|
-
constructor(reader: any, { validate }?: {
|
|
188
|
-
validate?: boolean | undefined;
|
|
189
|
-
});
|
|
190
|
-
view: DataView;
|
|
191
|
-
validate(compatible?: boolean): void;
|
|
192
|
-
indexAt(i: any): CellInput;
|
|
193
|
-
length(): number;
|
|
194
|
-
}
|
|
195
|
-
export class CellOutputVec {
|
|
196
|
-
constructor(reader: any, { validate }?: {
|
|
197
|
-
validate?: boolean | undefined;
|
|
198
|
-
});
|
|
199
|
-
view: DataView;
|
|
200
|
-
validate(compatible?: boolean): void;
|
|
201
|
-
length(): number;
|
|
202
|
-
indexAt(i: any): CellOutput;
|
|
203
|
-
}
|
|
204
|
-
export class Script {
|
|
205
|
-
constructor(reader: any, { validate }?: {
|
|
206
|
-
validate?: boolean | undefined;
|
|
207
|
-
});
|
|
208
|
-
view: DataView;
|
|
209
|
-
validate(compatible?: boolean): void;
|
|
210
|
-
getCodeHash(): Byte32;
|
|
211
|
-
getHashType(): number;
|
|
212
|
-
getArgs(): Bytes;
|
|
213
|
-
}
|
|
214
|
-
export class OutPoint {
|
|
215
|
-
static size(): number;
|
|
216
|
-
constructor(reader: any, { validate }?: {
|
|
217
|
-
validate?: boolean | undefined;
|
|
218
|
-
});
|
|
219
|
-
view: DataView;
|
|
220
|
-
getTxHash(): Byte32;
|
|
221
|
-
getIndex(): Uint32;
|
|
222
|
-
validate(compatible?: boolean): void;
|
|
223
|
-
}
|
|
224
|
-
export class CellInput {
|
|
225
|
-
static size(): number;
|
|
226
|
-
constructor(reader: any, { validate }?: {
|
|
227
|
-
validate?: boolean | undefined;
|
|
228
|
-
});
|
|
229
|
-
view: DataView;
|
|
230
|
-
getSince(): Uint64;
|
|
231
|
-
getPreviousOutput(): OutPoint;
|
|
232
|
-
validate(compatible?: boolean): void;
|
|
233
|
-
}
|
|
234
|
-
export class CellOutput {
|
|
235
|
-
constructor(reader: any, { validate }?: {
|
|
236
|
-
validate?: boolean | undefined;
|
|
237
|
-
});
|
|
238
|
-
view: DataView;
|
|
239
|
-
validate(compatible?: boolean): void;
|
|
240
|
-
getCapacity(): Uint64;
|
|
241
|
-
getLock(): Script;
|
|
242
|
-
getType(): ScriptOpt;
|
|
243
|
-
}
|
|
244
|
-
export class CellDep {
|
|
245
|
-
static size(): number;
|
|
246
|
-
constructor(reader: any, { validate }?: {
|
|
247
|
-
validate?: boolean | undefined;
|
|
248
|
-
});
|
|
249
|
-
view: DataView;
|
|
250
|
-
getOutPoint(): OutPoint;
|
|
251
|
-
getDepType(): number;
|
|
252
|
-
validate(compatible?: boolean): void;
|
|
253
|
-
}
|
|
254
|
-
export class RawTransaction {
|
|
255
|
-
constructor(reader: any, { validate }?: {
|
|
256
|
-
validate?: boolean | undefined;
|
|
257
|
-
});
|
|
258
|
-
view: DataView;
|
|
259
|
-
validate(compatible?: boolean): void;
|
|
260
|
-
getVersion(): Uint32;
|
|
261
|
-
getCellDeps(): CellDepVec;
|
|
262
|
-
getHeaderDeps(): Byte32Vec;
|
|
263
|
-
getInputs(): CellInputVec;
|
|
264
|
-
getOutputs(): CellOutputVec;
|
|
265
|
-
getOutputsData(): BytesVec;
|
|
266
|
-
}
|
|
267
|
-
export class Transaction {
|
|
268
|
-
constructor(reader: any, { validate }?: {
|
|
269
|
-
validate?: boolean | undefined;
|
|
270
|
-
});
|
|
271
|
-
view: DataView;
|
|
272
|
-
validate(compatible?: boolean): void;
|
|
273
|
-
getRaw(): RawTransaction;
|
|
274
|
-
getWitnesses(): BytesVec;
|
|
275
|
-
}
|
|
276
|
-
export class RawHeader {
|
|
277
|
-
static size(): number;
|
|
278
|
-
constructor(reader: any, { validate }?: {
|
|
279
|
-
validate?: boolean | undefined;
|
|
280
|
-
});
|
|
281
|
-
view: DataView;
|
|
282
|
-
getVersion(): Uint32;
|
|
283
|
-
getCompactTarget(): Uint32;
|
|
284
|
-
getTimestamp(): Uint64;
|
|
285
|
-
getNumber(): Uint64;
|
|
286
|
-
getEpoch(): Uint64;
|
|
287
|
-
getParentHash(): Byte32;
|
|
288
|
-
getTransactionsRoot(): Byte32;
|
|
289
|
-
getProposalsHash(): Byte32;
|
|
290
|
-
getExtraHash(): Byte32;
|
|
291
|
-
getDao(): Byte32;
|
|
292
|
-
validate(compatible?: boolean): void;
|
|
293
|
-
}
|
|
294
|
-
export class Header {
|
|
295
|
-
static size(): number;
|
|
296
|
-
constructor(reader: any, { validate }?: {
|
|
297
|
-
validate?: boolean | undefined;
|
|
298
|
-
});
|
|
299
|
-
view: DataView;
|
|
300
|
-
getRaw(): RawHeader;
|
|
301
|
-
getNonce(): Uint128;
|
|
302
|
-
validate(compatible?: boolean): void;
|
|
303
|
-
}
|
|
304
|
-
export class UncleBlock {
|
|
305
|
-
constructor(reader: any, { validate }?: {
|
|
306
|
-
validate?: boolean | undefined;
|
|
307
|
-
});
|
|
308
|
-
view: DataView;
|
|
309
|
-
validate(compatible?: boolean): void;
|
|
310
|
-
getHeader(): Header;
|
|
311
|
-
getProposals(): ProposalShortIdVec;
|
|
312
|
-
}
|
|
313
|
-
export class Block {
|
|
314
|
-
constructor(reader: any, { validate }?: {
|
|
315
|
-
validate?: boolean | undefined;
|
|
316
|
-
});
|
|
317
|
-
view: DataView;
|
|
318
|
-
validate(compatible?: boolean): void;
|
|
319
|
-
getHeader(): Header;
|
|
320
|
-
getUncles(): UncleBlockVec;
|
|
321
|
-
getTransactions(): TransactionVec;
|
|
322
|
-
getProposals(): ProposalShortIdVec;
|
|
323
|
-
}
|
|
324
|
-
export class BlockV1 {
|
|
325
|
-
constructor(reader: any, { validate }?: {
|
|
326
|
-
validate?: boolean | undefined;
|
|
327
|
-
});
|
|
328
|
-
view: DataView;
|
|
329
|
-
validate(compatible?: boolean): void;
|
|
330
|
-
getHeader(): Header;
|
|
331
|
-
getUncles(): UncleBlockVec;
|
|
332
|
-
getTransactions(): TransactionVec;
|
|
333
|
-
getProposals(): ProposalShortIdVec;
|
|
334
|
-
getExtension(): Bytes;
|
|
335
|
-
}
|
|
336
|
-
export class CellbaseWitness {
|
|
337
|
-
constructor(reader: any, { validate }?: {
|
|
338
|
-
validate?: boolean | undefined;
|
|
339
|
-
});
|
|
340
|
-
view: DataView;
|
|
341
|
-
validate(compatible?: boolean): void;
|
|
342
|
-
getLock(): Script;
|
|
343
|
-
getMessage(): Bytes;
|
|
344
|
-
}
|
|
345
|
-
export class WitnessArgs {
|
|
346
|
-
constructor(reader: any, { validate }?: {
|
|
347
|
-
validate?: boolean | undefined;
|
|
348
|
-
});
|
|
349
|
-
view: DataView;
|
|
350
|
-
validate(compatible?: boolean): void;
|
|
351
|
-
getLock(): BytesOpt;
|
|
352
|
-
getInputType(): BytesOpt;
|
|
353
|
-
getOutputType(): BytesOpt;
|
|
354
|
-
}
|
|
355
|
-
//# sourceMappingURL=generated.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generated.d.ts","sourceRoot":"","sources":["../../../src/ckb/molecule.advanced/generated.js"],"names":[],"mappings":"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"}
|