@ckb-ccc/core 0.1.0-alpha.6 → 0.1.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 +34 -0
- package/dist/barrel.d.ts +1 -0
- package/dist/barrel.d.ts.map +1 -1
- package/dist/barrel.js +1 -0
- package/dist/ckb/transactionLumos.d.ts +2 -1
- package/dist/ckb/transactionLumos.d.ts.map +1 -1
- package/dist/client/client.js +1 -1
- package/dist/molecule/codec.d.ts +118 -0
- package/dist/molecule/codec.d.ts.map +1 -0
- package/dist/molecule/codec.js +446 -0
- package/dist/molecule/index.d.ts +3 -0
- package/dist/molecule/index.d.ts.map +1 -0
- package/dist/molecule/index.js +2 -0
- package/dist/molecule/predefined.d.ts +52 -0
- package/dist/molecule/predefined.d.ts.map +1 -0
- package/dist/molecule/predefined.js +95 -0
- package/dist/signer/btc/signerBtc.d.ts.map +1 -1
- package/dist/signer/btc/signerBtc.js +2 -3
- package/dist/signer/btc/verify.d.ts +14 -1
- package/dist/signer/btc/verify.d.ts.map +1 -1
- package/dist/signer/btc/verify.js +22 -1
- package/dist/signer/doge/index.d.ts +5 -0
- package/dist/signer/doge/index.d.ts.map +1 -0
- package/dist/signer/doge/index.js +4 -0
- package/dist/signer/doge/signerDoge.d.ts +52 -0
- package/dist/signer/doge/signerDoge.d.ts.map +1 -0
- package/dist/signer/doge/signerDoge.js +82 -0
- package/dist/signer/doge/signerDogeAddressReadonly.d.ts +41 -0
- package/dist/signer/doge/signerDogeAddressReadonly.d.ts.map +1 -0
- package/dist/signer/doge/signerDogeAddressReadonly.js +45 -0
- package/dist/signer/doge/signerDogePrivateKey.d.ts +52 -0
- package/dist/signer/doge/signerDogePrivateKey.d.ts.map +1 -0
- package/dist/signer/doge/signerDogePrivateKey.js +68 -0
- package/dist/signer/doge/verify.d.ts +6 -0
- package/dist/signer/doge/verify.d.ts.map +1 -0
- package/dist/signer/doge/verify.js +17 -0
- package/dist/signer/index.d.ts +1 -0
- package/dist/signer/index.d.ts.map +1 -1
- package/dist/signer/index.js +1 -0
- package/dist/signer/nostr/index.d.ts +1 -0
- package/dist/signer/nostr/index.d.ts.map +1 -1
- package/dist/signer/nostr/index.js +1 -0
- package/dist/signer/signer/index.d.ts +4 -2
- package/dist/signer/signer/index.d.ts.map +1 -1
- package/dist/signer/signer/index.js +5 -0
- package/dist.commonjs/address/address.advanced.js +23 -28
- package/dist.commonjs/address/advanced.js +1 -17
- package/dist.commonjs/address/index.js +11 -15
- package/dist.commonjs/advanced.js +2 -31
- package/dist.commonjs/advancedBarrel.js +5 -21
- package/dist.commonjs/barrel.d.ts +1 -0
- package/dist.commonjs/barrel.d.ts.map +1 -1
- package/dist.commonjs/barrel.js +12 -27
- package/dist.commonjs/bytes/advanced.js +1 -2
- package/dist.commonjs/bytes/index.js +7 -12
- package/dist.commonjs/ckb/advanced.js +3 -32
- package/dist.commonjs/ckb/index.js +3 -19
- package/dist.commonjs/ckb/molecule.advanced/generated.js +64 -131
- package/dist.commonjs/ckb/molecule.advanced/index.js +2 -19
- package/dist.commonjs/ckb/script.advanced.js +3 -6
- package/dist.commonjs/ckb/script.js +23 -53
- package/dist.commonjs/ckb/transaction.advanced.js +3 -6
- package/dist.commonjs/ckb/transaction.js +122 -163
- package/dist.commonjs/ckb/transactionLumos.d.ts +2 -1
- package/dist.commonjs/ckb/transactionLumos.d.ts.map +1 -1
- package/dist.commonjs/ckb/transactionLumos.js +1 -2
- package/dist.commonjs/client/advanced.js +6 -22
- package/dist.commonjs/client/cache/advanced.js +1 -17
- package/dist.commonjs/client/cache/cache.js +3 -7
- package/dist.commonjs/client/cache/index.js +2 -18
- package/dist.commonjs/client/cache/memory.advanced.js +21 -28
- package/dist.commonjs/client/cache/memory.js +19 -23
- package/dist.commonjs/client/client.js +22 -26
- package/dist.commonjs/client/clientPublicMainnet.advanced.js +22 -25
- package/dist.commonjs/client/clientPublicMainnet.js +8 -15
- package/dist.commonjs/client/clientPublicTestnet.advanced.js +22 -25
- package/dist.commonjs/client/clientPublicTestnet.js +8 -15
- package/dist.commonjs/client/clientTypes.advanced.js +3 -6
- package/dist.commonjs/client/clientTypes.js +29 -43
- package/dist.commonjs/client/index.js +6 -22
- package/dist.commonjs/client/jsonRpc/advanced.js +2 -18
- package/dist.commonjs/client/jsonRpc/index.js +37 -41
- package/dist.commonjs/client/jsonRpc/transformers.js +57 -61
- package/dist.commonjs/client/jsonRpc/types.js +1 -2
- package/dist.commonjs/client/transports/advanced.js +8 -25
- package/dist.commonjs/client/transports/http.js +1 -5
- package/dist.commonjs/client/transports/transport.js +1 -2
- package/dist.commonjs/client/transports/webSocket.js +3 -10
- package/dist.commonjs/fixedPoint/index.js +4 -9
- package/dist.commonjs/hasher/advanced.js +1 -4
- package/dist.commonjs/hasher/hasher.js +1 -2
- package/dist.commonjs/hasher/hasherCkb.js +14 -20
- package/dist.commonjs/hasher/hasherKeecak256.js +7 -11
- package/dist.commonjs/hasher/index.js +3 -19
- package/dist.commonjs/hex/index.js +3 -6
- package/dist.commonjs/index.js +2 -31
- package/dist.commonjs/keystore/index.js +21 -25
- package/dist.commonjs/molecule/codec.d.ts +118 -0
- package/dist.commonjs/molecule/codec.d.ts.map +1 -0
- package/dist.commonjs/molecule/codec.js +446 -0
- package/dist.commonjs/molecule/index.d.ts +3 -0
- package/dist.commonjs/molecule/index.d.ts.map +1 -0
- package/dist.commonjs/molecule/index.js +2 -0
- package/dist.commonjs/molecule/predefined.d.ts +52 -0
- package/dist.commonjs/molecule/predefined.d.ts.map +1 -0
- package/dist.commonjs/molecule/predefined.js +95 -0
- package/dist.commonjs/num/index.js +17 -29
- package/dist.commonjs/signer/btc/index.js +3 -19
- package/dist.commonjs/signer/btc/signerBtc.d.ts.map +1 -1
- package/dist.commonjs/signer/btc/signerBtc.js +20 -25
- package/dist.commonjs/signer/btc/signerBtcPublicKeyReadonly.js +4 -8
- package/dist.commonjs/signer/btc/verify.d.ts +14 -1
- package/dist.commonjs/signer/btc/verify.d.ts.map +1 -1
- package/dist.commonjs/signer/btc/verify.js +29 -11
- package/dist.commonjs/signer/ckb/index.js +5 -21
- package/dist.commonjs/signer/ckb/signerCkbPrivateKey.js +16 -20
- package/dist.commonjs/signer/ckb/signerCkbPublicKey.js +20 -24
- package/dist.commonjs/signer/ckb/signerCkbScriptReadonly.js +8 -12
- package/dist.commonjs/signer/ckb/verifyCkbSecp256k1.js +12 -16
- package/dist.commonjs/signer/ckb/verifyJoyId.js +5 -8
- package/dist.commonjs/signer/doge/index.d.ts +5 -0
- package/dist.commonjs/signer/doge/index.d.ts.map +1 -0
- package/dist.commonjs/signer/doge/index.js +4 -0
- package/dist.commonjs/signer/doge/signerDoge.d.ts +52 -0
- package/dist.commonjs/signer/doge/signerDoge.d.ts.map +1 -0
- package/dist.commonjs/signer/doge/signerDoge.js +82 -0
- package/dist.commonjs/signer/doge/signerDogeAddressReadonly.d.ts +41 -0
- package/dist.commonjs/signer/doge/signerDogeAddressReadonly.d.ts.map +1 -0
- package/dist.commonjs/signer/doge/signerDogeAddressReadonly.js +45 -0
- package/dist.commonjs/signer/doge/signerDogePrivateKey.d.ts +52 -0
- package/dist.commonjs/signer/doge/signerDogePrivateKey.d.ts.map +1 -0
- package/dist.commonjs/signer/doge/signerDogePrivateKey.js +68 -0
- package/dist.commonjs/signer/doge/verify.d.ts +6 -0
- package/dist.commonjs/signer/doge/verify.d.ts.map +1 -0
- package/dist.commonjs/signer/doge/verify.js +17 -0
- package/dist.commonjs/signer/dummy/alwaysError.js +2 -6
- package/dist.commonjs/signer/dummy/dummy.js +3 -7
- package/dist.commonjs/signer/dummy/index.js +3 -19
- package/dist.commonjs/signer/dummy/openLink.js +2 -6
- package/dist.commonjs/signer/evm/index.js +3 -19
- package/dist.commonjs/signer/evm/signerEvm.js +31 -35
- package/dist.commonjs/signer/evm/signerEvmAddressReadonly.js +4 -8
- package/dist.commonjs/signer/evm/verify.js +4 -7
- package/dist.commonjs/signer/index.d.ts +1 -0
- package/dist.commonjs/signer/index.d.ts.map +1 -1
- package/dist.commonjs/signer/index.js +7 -22
- package/dist.commonjs/signer/nostr/index.d.ts +1 -0
- package/dist.commonjs/signer/nostr/index.d.ts.map +1 -1
- package/dist.commonjs/signer/nostr/index.js +2 -17
- package/dist.commonjs/signer/nostr/signerNostr.js +21 -25
- package/dist.commonjs/signer/nostr/verify.js +12 -16
- package/dist.commonjs/signer/signer/index.d.ts +4 -2
- package/dist.commonjs/signer/signer/index.d.ts.map +1 -1
- package/dist.commonjs/signer/signer/index.js +22 -23
- package/dist.commonjs/utils/index.js +6 -12
- package/package.json +3 -1
- package/src/barrel.ts +1 -0
- package/src/ckb/transactionLumos.ts +2 -1
- package/src/client/client.ts +1 -1
- package/src/molecule/codec.ts +610 -0
- package/src/molecule/index.ts +2 -0
- package/src/molecule/predefined.ts +114 -0
- package/src/signer/btc/signerBtc.ts +2 -3
- package/src/signer/btc/verify.ts +31 -2
- package/src/signer/doge/index.ts +4 -0
- package/src/signer/doge/signerDoge.ts +116 -0
- package/src/signer/doge/signerDogeAddressReadonly.ts +52 -0
- package/src/signer/doge/signerDogePrivateKey.ts +97 -0
- package/src/signer/doge/verify.ts +38 -0
- package/src/signer/index.ts +1 -0
- package/src/signer/nostr/index.ts +1 -0
- package/src/signer/signer/index.ts +9 -0
|
@@ -1,38 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.WitnessArgs = exports.CellbaseWitness = exports.BlockV1 = exports.Block = exports.UncleBlock = exports.Header = exports.RawHeader = exports.Transaction = exports.RawTransaction = exports.CellDep = exports.CellOutput = exports.CellInput = exports.OutPoint = exports.Script = exports.CellOutputVec = exports.CellInputVec = exports.CellDepVec = exports.ProposalShortIdVec = exports.TransactionVec = exports.UncleBlockVec = exports.ProposalShortId = exports.ScriptOpt = exports.Byte32Vec = exports.BytesVec = exports.BytesOptVec = exports.BytesOpt = exports.Bytes = exports.Uint256 = exports.Byte32 = exports.Uint128 = exports.Uint64 = exports.Uint32 = void 0;
|
|
4
|
-
exports.SerializeUint32 = SerializeUint32;
|
|
5
|
-
exports.SerializeUint64 = SerializeUint64;
|
|
6
|
-
exports.SerializeUint128 = SerializeUint128;
|
|
7
|
-
exports.SerializeByte32 = SerializeByte32;
|
|
8
|
-
exports.SerializeUint256 = SerializeUint256;
|
|
9
|
-
exports.SerializeBytes = SerializeBytes;
|
|
10
|
-
exports.SerializeBytesOpt = SerializeBytesOpt;
|
|
11
|
-
exports.SerializeBytesOptVec = SerializeBytesOptVec;
|
|
12
|
-
exports.SerializeBytesVec = SerializeBytesVec;
|
|
13
|
-
exports.SerializeByte32Vec = SerializeByte32Vec;
|
|
14
|
-
exports.SerializeScriptOpt = SerializeScriptOpt;
|
|
15
|
-
exports.SerializeProposalShortId = SerializeProposalShortId;
|
|
16
|
-
exports.SerializeUncleBlockVec = SerializeUncleBlockVec;
|
|
17
|
-
exports.SerializeTransactionVec = SerializeTransactionVec;
|
|
18
|
-
exports.SerializeProposalShortIdVec = SerializeProposalShortIdVec;
|
|
19
|
-
exports.SerializeCellDepVec = SerializeCellDepVec;
|
|
20
|
-
exports.SerializeCellInputVec = SerializeCellInputVec;
|
|
21
|
-
exports.SerializeCellOutputVec = SerializeCellOutputVec;
|
|
22
|
-
exports.SerializeScript = SerializeScript;
|
|
23
|
-
exports.SerializeOutPoint = SerializeOutPoint;
|
|
24
|
-
exports.SerializeCellInput = SerializeCellInput;
|
|
25
|
-
exports.SerializeCellOutput = SerializeCellOutput;
|
|
26
|
-
exports.SerializeCellDep = SerializeCellDep;
|
|
27
|
-
exports.SerializeRawTransaction = SerializeRawTransaction;
|
|
28
|
-
exports.SerializeTransaction = SerializeTransaction;
|
|
29
|
-
exports.SerializeRawHeader = SerializeRawHeader;
|
|
30
|
-
exports.SerializeHeader = SerializeHeader;
|
|
31
|
-
exports.SerializeUncleBlock = SerializeUncleBlock;
|
|
32
|
-
exports.SerializeBlock = SerializeBlock;
|
|
33
|
-
exports.SerializeBlockV1 = SerializeBlockV1;
|
|
34
|
-
exports.SerializeCellbaseWitness = SerializeCellbaseWitness;
|
|
35
|
-
exports.SerializeWitnessArgs = SerializeWitnessArgs;
|
|
36
1
|
function dataLengthError(actual, required) {
|
|
37
2
|
throw new Error(`Invalid data length! Required: ${required}, actual: ${actual}`);
|
|
38
3
|
}
|
|
@@ -110,7 +75,7 @@ function serializeTable(buffers) {
|
|
|
110
75
|
}
|
|
111
76
|
return buffer;
|
|
112
77
|
}
|
|
113
|
-
class Uint32 {
|
|
78
|
+
export class Uint32 {
|
|
114
79
|
constructor(reader, { validate = true } = {}) {
|
|
115
80
|
this.view = new DataView(assertArrayBuffer(reader));
|
|
116
81
|
if (validate) {
|
|
@@ -136,13 +101,12 @@ class Uint32 {
|
|
|
136
101
|
return 4;
|
|
137
102
|
}
|
|
138
103
|
}
|
|
139
|
-
|
|
140
|
-
function SerializeUint32(value) {
|
|
104
|
+
export function SerializeUint32(value) {
|
|
141
105
|
const buffer = assertArrayBuffer(value);
|
|
142
106
|
assertDataLength(buffer.byteLength, 4);
|
|
143
107
|
return buffer;
|
|
144
108
|
}
|
|
145
|
-
class Uint64 {
|
|
109
|
+
export class Uint64 {
|
|
146
110
|
constructor(reader, { validate = true } = {}) {
|
|
147
111
|
this.view = new DataView(assertArrayBuffer(reader));
|
|
148
112
|
if (validate) {
|
|
@@ -162,13 +126,12 @@ class Uint64 {
|
|
|
162
126
|
return 8;
|
|
163
127
|
}
|
|
164
128
|
}
|
|
165
|
-
|
|
166
|
-
function SerializeUint64(value) {
|
|
129
|
+
export function SerializeUint64(value) {
|
|
167
130
|
const buffer = assertArrayBuffer(value);
|
|
168
131
|
assertDataLength(buffer.byteLength, 8);
|
|
169
132
|
return buffer;
|
|
170
133
|
}
|
|
171
|
-
class Uint128 {
|
|
134
|
+
export class Uint128 {
|
|
172
135
|
constructor(reader, { validate = true } = {}) {
|
|
173
136
|
this.view = new DataView(assertArrayBuffer(reader));
|
|
174
137
|
if (validate) {
|
|
@@ -188,13 +151,12 @@ class Uint128 {
|
|
|
188
151
|
return 16;
|
|
189
152
|
}
|
|
190
153
|
}
|
|
191
|
-
|
|
192
|
-
function SerializeUint128(value) {
|
|
154
|
+
export function SerializeUint128(value) {
|
|
193
155
|
const buffer = assertArrayBuffer(value);
|
|
194
156
|
assertDataLength(buffer.byteLength, 16);
|
|
195
157
|
return buffer;
|
|
196
158
|
}
|
|
197
|
-
class Byte32 {
|
|
159
|
+
export class Byte32 {
|
|
198
160
|
constructor(reader, { validate = true } = {}) {
|
|
199
161
|
this.view = new DataView(assertArrayBuffer(reader));
|
|
200
162
|
if (validate) {
|
|
@@ -214,13 +176,12 @@ class Byte32 {
|
|
|
214
176
|
return 32;
|
|
215
177
|
}
|
|
216
178
|
}
|
|
217
|
-
|
|
218
|
-
function SerializeByte32(value) {
|
|
179
|
+
export function SerializeByte32(value) {
|
|
219
180
|
const buffer = assertArrayBuffer(value);
|
|
220
181
|
assertDataLength(buffer.byteLength, 32);
|
|
221
182
|
return buffer;
|
|
222
183
|
}
|
|
223
|
-
class Uint256 {
|
|
184
|
+
export class Uint256 {
|
|
224
185
|
constructor(reader, { validate = true } = {}) {
|
|
225
186
|
this.view = new DataView(assertArrayBuffer(reader));
|
|
226
187
|
if (validate) {
|
|
@@ -240,13 +201,12 @@ class Uint256 {
|
|
|
240
201
|
return 32;
|
|
241
202
|
}
|
|
242
203
|
}
|
|
243
|
-
|
|
244
|
-
function SerializeUint256(value) {
|
|
204
|
+
export function SerializeUint256(value) {
|
|
245
205
|
const buffer = assertArrayBuffer(value);
|
|
246
206
|
assertDataLength(buffer.byteLength, 32);
|
|
247
207
|
return buffer;
|
|
248
208
|
}
|
|
249
|
-
class Bytes {
|
|
209
|
+
export class Bytes {
|
|
250
210
|
constructor(reader, { validate = true } = {}) {
|
|
251
211
|
this.view = new DataView(assertArrayBuffer(reader));
|
|
252
212
|
if (validate) {
|
|
@@ -270,15 +230,14 @@ class Bytes {
|
|
|
270
230
|
return this.view.getUint32(0, true);
|
|
271
231
|
}
|
|
272
232
|
}
|
|
273
|
-
|
|
274
|
-
function SerializeBytes(value) {
|
|
233
|
+
export function SerializeBytes(value) {
|
|
275
234
|
const item = assertArrayBuffer(value);
|
|
276
235
|
const array = new Uint8Array(4 + item.byteLength);
|
|
277
236
|
new DataView(array.buffer).setUint32(0, item.byteLength, true);
|
|
278
237
|
array.set(new Uint8Array(item), 4);
|
|
279
238
|
return array.buffer;
|
|
280
239
|
}
|
|
281
|
-
class BytesOpt {
|
|
240
|
+
export class BytesOpt {
|
|
282
241
|
constructor(reader, { validate = true } = {}) {
|
|
283
242
|
this.view = new DataView(assertArrayBuffer(reader));
|
|
284
243
|
if (validate) {
|
|
@@ -297,8 +256,7 @@ class BytesOpt {
|
|
|
297
256
|
return this.view.byteLength > 0;
|
|
298
257
|
}
|
|
299
258
|
}
|
|
300
|
-
|
|
301
|
-
function SerializeBytesOpt(value) {
|
|
259
|
+
export function SerializeBytesOpt(value) {
|
|
302
260
|
if (value) {
|
|
303
261
|
return SerializeBytes(value);
|
|
304
262
|
}
|
|
@@ -306,7 +264,7 @@ function SerializeBytesOpt(value) {
|
|
|
306
264
|
return new ArrayBuffer(0);
|
|
307
265
|
}
|
|
308
266
|
}
|
|
309
|
-
class BytesOptVec {
|
|
267
|
+
export class BytesOptVec {
|
|
310
268
|
constructor(reader, { validate = true } = {}) {
|
|
311
269
|
this.view = new DataView(assertArrayBuffer(reader));
|
|
312
270
|
if (validate) {
|
|
@@ -341,11 +299,10 @@ class BytesOptVec {
|
|
|
341
299
|
});
|
|
342
300
|
}
|
|
343
301
|
}
|
|
344
|
-
|
|
345
|
-
function SerializeBytesOptVec(value) {
|
|
302
|
+
export function SerializeBytesOptVec(value) {
|
|
346
303
|
return serializeTable(value.map((item) => SerializeBytesOpt(item)));
|
|
347
304
|
}
|
|
348
|
-
class BytesVec {
|
|
305
|
+
export class BytesVec {
|
|
349
306
|
constructor(reader, { validate = true } = {}) {
|
|
350
307
|
this.view = new DataView(assertArrayBuffer(reader));
|
|
351
308
|
if (validate) {
|
|
@@ -380,11 +337,10 @@ class BytesVec {
|
|
|
380
337
|
});
|
|
381
338
|
}
|
|
382
339
|
}
|
|
383
|
-
|
|
384
|
-
function SerializeBytesVec(value) {
|
|
340
|
+
export function SerializeBytesVec(value) {
|
|
385
341
|
return serializeTable(value.map((item) => SerializeBytes(item)));
|
|
386
342
|
}
|
|
387
|
-
class Byte32Vec {
|
|
343
|
+
export class Byte32Vec {
|
|
388
344
|
constructor(reader, { validate = true } = {}) {
|
|
389
345
|
this.view = new DataView(assertArrayBuffer(reader));
|
|
390
346
|
if (validate) {
|
|
@@ -409,8 +365,7 @@ class Byte32Vec {
|
|
|
409
365
|
return this.view.getUint32(0, true);
|
|
410
366
|
}
|
|
411
367
|
}
|
|
412
|
-
|
|
413
|
-
function SerializeByte32Vec(value) {
|
|
368
|
+
export function SerializeByte32Vec(value) {
|
|
414
369
|
const array = new Uint8Array(4 + Byte32.size() * value.length);
|
|
415
370
|
new DataView(array.buffer).setUint32(0, value.length, true);
|
|
416
371
|
for (let i = 0; i < value.length; i++) {
|
|
@@ -419,7 +374,7 @@ function SerializeByte32Vec(value) {
|
|
|
419
374
|
}
|
|
420
375
|
return array.buffer;
|
|
421
376
|
}
|
|
422
|
-
class ScriptOpt {
|
|
377
|
+
export class ScriptOpt {
|
|
423
378
|
constructor(reader, { validate = true } = {}) {
|
|
424
379
|
this.view = new DataView(assertArrayBuffer(reader));
|
|
425
380
|
if (validate) {
|
|
@@ -438,8 +393,7 @@ class ScriptOpt {
|
|
|
438
393
|
return this.view.byteLength > 0;
|
|
439
394
|
}
|
|
440
395
|
}
|
|
441
|
-
|
|
442
|
-
function SerializeScriptOpt(value) {
|
|
396
|
+
export function SerializeScriptOpt(value) {
|
|
443
397
|
if (value) {
|
|
444
398
|
return SerializeScript(value);
|
|
445
399
|
}
|
|
@@ -447,7 +401,7 @@ function SerializeScriptOpt(value) {
|
|
|
447
401
|
return new ArrayBuffer(0);
|
|
448
402
|
}
|
|
449
403
|
}
|
|
450
|
-
class ProposalShortId {
|
|
404
|
+
export class ProposalShortId {
|
|
451
405
|
constructor(reader, { validate = true } = {}) {
|
|
452
406
|
this.view = new DataView(assertArrayBuffer(reader));
|
|
453
407
|
if (validate) {
|
|
@@ -467,13 +421,12 @@ class ProposalShortId {
|
|
|
467
421
|
return 10;
|
|
468
422
|
}
|
|
469
423
|
}
|
|
470
|
-
|
|
471
|
-
function SerializeProposalShortId(value) {
|
|
424
|
+
export function SerializeProposalShortId(value) {
|
|
472
425
|
const buffer = assertArrayBuffer(value);
|
|
473
426
|
assertDataLength(buffer.byteLength, 10);
|
|
474
427
|
return buffer;
|
|
475
428
|
}
|
|
476
|
-
class UncleBlockVec {
|
|
429
|
+
export class UncleBlockVec {
|
|
477
430
|
constructor(reader, { validate = true } = {}) {
|
|
478
431
|
this.view = new DataView(assertArrayBuffer(reader));
|
|
479
432
|
if (validate) {
|
|
@@ -508,11 +461,10 @@ class UncleBlockVec {
|
|
|
508
461
|
});
|
|
509
462
|
}
|
|
510
463
|
}
|
|
511
|
-
|
|
512
|
-
function SerializeUncleBlockVec(value) {
|
|
464
|
+
export function SerializeUncleBlockVec(value) {
|
|
513
465
|
return serializeTable(value.map((item) => SerializeUncleBlock(item)));
|
|
514
466
|
}
|
|
515
|
-
class TransactionVec {
|
|
467
|
+
export class TransactionVec {
|
|
516
468
|
constructor(reader, { validate = true } = {}) {
|
|
517
469
|
this.view = new DataView(assertArrayBuffer(reader));
|
|
518
470
|
if (validate) {
|
|
@@ -547,11 +499,10 @@ class TransactionVec {
|
|
|
547
499
|
});
|
|
548
500
|
}
|
|
549
501
|
}
|
|
550
|
-
|
|
551
|
-
function SerializeTransactionVec(value) {
|
|
502
|
+
export function SerializeTransactionVec(value) {
|
|
552
503
|
return serializeTable(value.map((item) => SerializeTransaction(item)));
|
|
553
504
|
}
|
|
554
|
-
class ProposalShortIdVec {
|
|
505
|
+
export class ProposalShortIdVec {
|
|
555
506
|
constructor(reader, { validate = true } = {}) {
|
|
556
507
|
this.view = new DataView(assertArrayBuffer(reader));
|
|
557
508
|
if (validate) {
|
|
@@ -576,8 +527,7 @@ class ProposalShortIdVec {
|
|
|
576
527
|
return this.view.getUint32(0, true);
|
|
577
528
|
}
|
|
578
529
|
}
|
|
579
|
-
|
|
580
|
-
function SerializeProposalShortIdVec(value) {
|
|
530
|
+
export function SerializeProposalShortIdVec(value) {
|
|
581
531
|
const array = new Uint8Array(4 + ProposalShortId.size() * value.length);
|
|
582
532
|
new DataView(array.buffer).setUint32(0, value.length, true);
|
|
583
533
|
for (let i = 0; i < value.length; i++) {
|
|
@@ -586,7 +536,7 @@ function SerializeProposalShortIdVec(value) {
|
|
|
586
536
|
}
|
|
587
537
|
return array.buffer;
|
|
588
538
|
}
|
|
589
|
-
class CellDepVec {
|
|
539
|
+
export class CellDepVec {
|
|
590
540
|
constructor(reader, { validate = true } = {}) {
|
|
591
541
|
this.view = new DataView(assertArrayBuffer(reader));
|
|
592
542
|
if (validate) {
|
|
@@ -611,8 +561,7 @@ class CellDepVec {
|
|
|
611
561
|
return this.view.getUint32(0, true);
|
|
612
562
|
}
|
|
613
563
|
}
|
|
614
|
-
|
|
615
|
-
function SerializeCellDepVec(value) {
|
|
564
|
+
export function SerializeCellDepVec(value) {
|
|
616
565
|
const array = new Uint8Array(4 + CellDep.size() * value.length);
|
|
617
566
|
new DataView(array.buffer).setUint32(0, value.length, true);
|
|
618
567
|
for (let i = 0; i < value.length; i++) {
|
|
@@ -621,7 +570,7 @@ function SerializeCellDepVec(value) {
|
|
|
621
570
|
}
|
|
622
571
|
return array.buffer;
|
|
623
572
|
}
|
|
624
|
-
class CellInputVec {
|
|
573
|
+
export class CellInputVec {
|
|
625
574
|
constructor(reader, { validate = true } = {}) {
|
|
626
575
|
this.view = new DataView(assertArrayBuffer(reader));
|
|
627
576
|
if (validate) {
|
|
@@ -646,8 +595,7 @@ class CellInputVec {
|
|
|
646
595
|
return this.view.getUint32(0, true);
|
|
647
596
|
}
|
|
648
597
|
}
|
|
649
|
-
|
|
650
|
-
function SerializeCellInputVec(value) {
|
|
598
|
+
export function SerializeCellInputVec(value) {
|
|
651
599
|
const array = new Uint8Array(4 + CellInput.size() * value.length);
|
|
652
600
|
new DataView(array.buffer).setUint32(0, value.length, true);
|
|
653
601
|
for (let i = 0; i < value.length; i++) {
|
|
@@ -656,7 +604,7 @@ function SerializeCellInputVec(value) {
|
|
|
656
604
|
}
|
|
657
605
|
return array.buffer;
|
|
658
606
|
}
|
|
659
|
-
class CellOutputVec {
|
|
607
|
+
export class CellOutputVec {
|
|
660
608
|
constructor(reader, { validate = true } = {}) {
|
|
661
609
|
this.view = new DataView(assertArrayBuffer(reader));
|
|
662
610
|
if (validate) {
|
|
@@ -691,11 +639,10 @@ class CellOutputVec {
|
|
|
691
639
|
});
|
|
692
640
|
}
|
|
693
641
|
}
|
|
694
|
-
|
|
695
|
-
function SerializeCellOutputVec(value) {
|
|
642
|
+
export function SerializeCellOutputVec(value) {
|
|
696
643
|
return serializeTable(value.map((item) => SerializeCellOutput(item)));
|
|
697
644
|
}
|
|
698
|
-
class Script {
|
|
645
|
+
export class Script {
|
|
699
646
|
constructor(reader, { validate = true } = {}) {
|
|
700
647
|
this.view = new DataView(assertArrayBuffer(reader));
|
|
701
648
|
if (validate) {
|
|
@@ -737,8 +684,7 @@ class Script {
|
|
|
737
684
|
});
|
|
738
685
|
}
|
|
739
686
|
}
|
|
740
|
-
|
|
741
|
-
function SerializeScript(value) {
|
|
687
|
+
export function SerializeScript(value) {
|
|
742
688
|
const buffers = [];
|
|
743
689
|
buffers.push(SerializeByte32(value.codeHash));
|
|
744
690
|
const hashTypeView = new DataView(new ArrayBuffer(1));
|
|
@@ -747,7 +693,7 @@ function SerializeScript(value) {
|
|
|
747
693
|
buffers.push(SerializeBytes(value.args));
|
|
748
694
|
return serializeTable(buffers);
|
|
749
695
|
}
|
|
750
|
-
class OutPoint {
|
|
696
|
+
export class OutPoint {
|
|
751
697
|
constructor(reader, { validate = true } = {}) {
|
|
752
698
|
this.view = new DataView(assertArrayBuffer(reader));
|
|
753
699
|
if (validate) {
|
|
@@ -771,15 +717,14 @@ class OutPoint {
|
|
|
771
717
|
return 0 + Byte32.size() + Uint32.size();
|
|
772
718
|
}
|
|
773
719
|
}
|
|
774
|
-
|
|
775
|
-
function SerializeOutPoint(value) {
|
|
720
|
+
export function SerializeOutPoint(value) {
|
|
776
721
|
const array = new Uint8Array(0 + Byte32.size() + Uint32.size());
|
|
777
722
|
const view = new DataView(array.buffer);
|
|
778
723
|
array.set(new Uint8Array(SerializeByte32(value.txHash)), 0);
|
|
779
724
|
array.set(new Uint8Array(SerializeUint32(value.index)), 0 + Byte32.size());
|
|
780
725
|
return array.buffer;
|
|
781
726
|
}
|
|
782
|
-
class CellInput {
|
|
727
|
+
export class CellInput {
|
|
783
728
|
constructor(reader, { validate = true } = {}) {
|
|
784
729
|
this.view = new DataView(assertArrayBuffer(reader));
|
|
785
730
|
if (validate) {
|
|
@@ -803,15 +748,14 @@ class CellInput {
|
|
|
803
748
|
return 0 + Uint64.size() + OutPoint.size();
|
|
804
749
|
}
|
|
805
750
|
}
|
|
806
|
-
|
|
807
|
-
function SerializeCellInput(value) {
|
|
751
|
+
export function SerializeCellInput(value) {
|
|
808
752
|
const array = new Uint8Array(0 + Uint64.size() + OutPoint.size());
|
|
809
753
|
const view = new DataView(array.buffer);
|
|
810
754
|
array.set(new Uint8Array(SerializeUint64(value.since)), 0);
|
|
811
755
|
array.set(new Uint8Array(SerializeOutPoint(value.previousOutput)), 0 + Uint64.size());
|
|
812
756
|
return array.buffer;
|
|
813
757
|
}
|
|
814
|
-
class CellOutput {
|
|
758
|
+
export class CellOutput {
|
|
815
759
|
constructor(reader, { validate = true } = {}) {
|
|
816
760
|
this.view = new DataView(assertArrayBuffer(reader));
|
|
817
761
|
if (validate) {
|
|
@@ -855,15 +799,14 @@ class CellOutput {
|
|
|
855
799
|
});
|
|
856
800
|
}
|
|
857
801
|
}
|
|
858
|
-
|
|
859
|
-
function SerializeCellOutput(value) {
|
|
802
|
+
export function SerializeCellOutput(value) {
|
|
860
803
|
const buffers = [];
|
|
861
804
|
buffers.push(SerializeUint64(value.capacity));
|
|
862
805
|
buffers.push(SerializeScript(value.lock));
|
|
863
806
|
buffers.push(SerializeScriptOpt(value.type));
|
|
864
807
|
return serializeTable(buffers);
|
|
865
808
|
}
|
|
866
|
-
class CellDep {
|
|
809
|
+
export class CellDep {
|
|
867
810
|
constructor(reader, { validate = true } = {}) {
|
|
868
811
|
this.view = new DataView(assertArrayBuffer(reader));
|
|
869
812
|
if (validate) {
|
|
@@ -886,15 +829,14 @@ class CellDep {
|
|
|
886
829
|
return 0 + OutPoint.size() + 1;
|
|
887
830
|
}
|
|
888
831
|
}
|
|
889
|
-
|
|
890
|
-
function SerializeCellDep(value) {
|
|
832
|
+
export function SerializeCellDep(value) {
|
|
891
833
|
const array = new Uint8Array(0 + OutPoint.size() + 1);
|
|
892
834
|
const view = new DataView(array.buffer);
|
|
893
835
|
array.set(new Uint8Array(SerializeOutPoint(value.outPoint)), 0);
|
|
894
836
|
view.setUint8(0 + OutPoint.size(), value.depType);
|
|
895
837
|
return array.buffer;
|
|
896
838
|
}
|
|
897
|
-
class RawTransaction {
|
|
839
|
+
export class RawTransaction {
|
|
898
840
|
constructor(reader, { validate = true } = {}) {
|
|
899
841
|
this.view = new DataView(assertArrayBuffer(reader));
|
|
900
842
|
if (validate) {
|
|
@@ -971,8 +913,7 @@ class RawTransaction {
|
|
|
971
913
|
});
|
|
972
914
|
}
|
|
973
915
|
}
|
|
974
|
-
|
|
975
|
-
function SerializeRawTransaction(value) {
|
|
916
|
+
export function SerializeRawTransaction(value) {
|
|
976
917
|
const buffers = [];
|
|
977
918
|
buffers.push(SerializeUint32(value.version));
|
|
978
919
|
buffers.push(SerializeCellDepVec(value.cellDeps));
|
|
@@ -982,7 +923,7 @@ function SerializeRawTransaction(value) {
|
|
|
982
923
|
buffers.push(SerializeBytesVec(value.outputsData));
|
|
983
924
|
return serializeTable(buffers);
|
|
984
925
|
}
|
|
985
|
-
class Transaction {
|
|
926
|
+
export class Transaction {
|
|
986
927
|
constructor(reader, { validate = true } = {}) {
|
|
987
928
|
this.view = new DataView(assertArrayBuffer(reader));
|
|
988
929
|
if (validate) {
|
|
@@ -1015,14 +956,13 @@ class Transaction {
|
|
|
1015
956
|
});
|
|
1016
957
|
}
|
|
1017
958
|
}
|
|
1018
|
-
|
|
1019
|
-
function SerializeTransaction(value) {
|
|
959
|
+
export function SerializeTransaction(value) {
|
|
1020
960
|
const buffers = [];
|
|
1021
961
|
buffers.push(SerializeRawTransaction(value.raw));
|
|
1022
962
|
buffers.push(SerializeBytesVec(value.witnesses));
|
|
1023
963
|
return serializeTable(buffers);
|
|
1024
964
|
}
|
|
1025
|
-
class RawHeader {
|
|
965
|
+
export class RawHeader {
|
|
1026
966
|
constructor(reader, { validate = true } = {}) {
|
|
1027
967
|
this.view = new DataView(assertArrayBuffer(reader));
|
|
1028
968
|
if (validate) {
|
|
@@ -1168,8 +1108,7 @@ class RawHeader {
|
|
|
1168
1108
|
Byte32.size());
|
|
1169
1109
|
}
|
|
1170
1110
|
}
|
|
1171
|
-
|
|
1172
|
-
function SerializeRawHeader(value) {
|
|
1111
|
+
export function SerializeRawHeader(value) {
|
|
1173
1112
|
const array = new Uint8Array(0 +
|
|
1174
1113
|
Uint32.size() +
|
|
1175
1114
|
Uint32.size() +
|
|
@@ -1229,7 +1168,7 @@ function SerializeRawHeader(value) {
|
|
|
1229
1168
|
Byte32.size());
|
|
1230
1169
|
return array.buffer;
|
|
1231
1170
|
}
|
|
1232
|
-
class Header {
|
|
1171
|
+
export class Header {
|
|
1233
1172
|
constructor(reader, { validate = true } = {}) {
|
|
1234
1173
|
this.view = new DataView(assertArrayBuffer(reader));
|
|
1235
1174
|
if (validate) {
|
|
@@ -1253,15 +1192,14 @@ class Header {
|
|
|
1253
1192
|
return 0 + RawHeader.size() + Uint128.size();
|
|
1254
1193
|
}
|
|
1255
1194
|
}
|
|
1256
|
-
|
|
1257
|
-
function SerializeHeader(value) {
|
|
1195
|
+
export function SerializeHeader(value) {
|
|
1258
1196
|
const array = new Uint8Array(0 + RawHeader.size() + Uint128.size());
|
|
1259
1197
|
const view = new DataView(array.buffer);
|
|
1260
1198
|
array.set(new Uint8Array(SerializeRawHeader(value.raw)), 0);
|
|
1261
1199
|
array.set(new Uint8Array(SerializeUint128(value.nonce)), 0 + RawHeader.size());
|
|
1262
1200
|
return array.buffer;
|
|
1263
1201
|
}
|
|
1264
|
-
class UncleBlock {
|
|
1202
|
+
export class UncleBlock {
|
|
1265
1203
|
constructor(reader, { validate = true } = {}) {
|
|
1266
1204
|
this.view = new DataView(assertArrayBuffer(reader));
|
|
1267
1205
|
if (validate) {
|
|
@@ -1294,14 +1232,13 @@ class UncleBlock {
|
|
|
1294
1232
|
});
|
|
1295
1233
|
}
|
|
1296
1234
|
}
|
|
1297
|
-
|
|
1298
|
-
function SerializeUncleBlock(value) {
|
|
1235
|
+
export function SerializeUncleBlock(value) {
|
|
1299
1236
|
const buffers = [];
|
|
1300
1237
|
buffers.push(SerializeHeader(value.header));
|
|
1301
1238
|
buffers.push(SerializeProposalShortIdVec(value.proposals));
|
|
1302
1239
|
return serializeTable(buffers);
|
|
1303
1240
|
}
|
|
1304
|
-
class Block {
|
|
1241
|
+
export class Block {
|
|
1305
1242
|
constructor(reader, { validate = true } = {}) {
|
|
1306
1243
|
this.view = new DataView(assertArrayBuffer(reader));
|
|
1307
1244
|
if (validate) {
|
|
@@ -1356,8 +1293,7 @@ class Block {
|
|
|
1356
1293
|
});
|
|
1357
1294
|
}
|
|
1358
1295
|
}
|
|
1359
|
-
|
|
1360
|
-
function SerializeBlock(value) {
|
|
1296
|
+
export function SerializeBlock(value) {
|
|
1361
1297
|
const buffers = [];
|
|
1362
1298
|
buffers.push(SerializeHeader(value.header));
|
|
1363
1299
|
buffers.push(SerializeUncleBlockVec(value.uncles));
|
|
@@ -1365,7 +1301,7 @@ function SerializeBlock(value) {
|
|
|
1365
1301
|
buffers.push(SerializeProposalShortIdVec(value.proposals));
|
|
1366
1302
|
return serializeTable(buffers);
|
|
1367
1303
|
}
|
|
1368
|
-
class BlockV1 {
|
|
1304
|
+
export class BlockV1 {
|
|
1369
1305
|
constructor(reader, { validate = true } = {}) {
|
|
1370
1306
|
this.view = new DataView(assertArrayBuffer(reader));
|
|
1371
1307
|
if (validate) {
|
|
@@ -1431,8 +1367,7 @@ class BlockV1 {
|
|
|
1431
1367
|
});
|
|
1432
1368
|
}
|
|
1433
1369
|
}
|
|
1434
|
-
|
|
1435
|
-
function SerializeBlockV1(value) {
|
|
1370
|
+
export function SerializeBlockV1(value) {
|
|
1436
1371
|
const buffers = [];
|
|
1437
1372
|
buffers.push(SerializeHeader(value.header));
|
|
1438
1373
|
buffers.push(SerializeUncleBlockVec(value.uncles));
|
|
@@ -1441,7 +1376,7 @@ function SerializeBlockV1(value) {
|
|
|
1441
1376
|
buffers.push(SerializeBytes(value.extension));
|
|
1442
1377
|
return serializeTable(buffers);
|
|
1443
1378
|
}
|
|
1444
|
-
class CellbaseWitness {
|
|
1379
|
+
export class CellbaseWitness {
|
|
1445
1380
|
constructor(reader, { validate = true } = {}) {
|
|
1446
1381
|
this.view = new DataView(assertArrayBuffer(reader));
|
|
1447
1382
|
if (validate) {
|
|
@@ -1474,14 +1409,13 @@ class CellbaseWitness {
|
|
|
1474
1409
|
});
|
|
1475
1410
|
}
|
|
1476
1411
|
}
|
|
1477
|
-
|
|
1478
|
-
function SerializeCellbaseWitness(value) {
|
|
1412
|
+
export function SerializeCellbaseWitness(value) {
|
|
1479
1413
|
const buffers = [];
|
|
1480
1414
|
buffers.push(SerializeScript(value.lock));
|
|
1481
1415
|
buffers.push(SerializeBytes(value.message));
|
|
1482
1416
|
return serializeTable(buffers);
|
|
1483
1417
|
}
|
|
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,8 +1459,7 @@ 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));
|
|
@@ -1,22 +1,5 @@
|
|
|
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 = molOptional;
|
|
18
|
-
__exportStar(require("./generated.js"), exports);
|
|
19
|
-
function molOptional(mol) {
|
|
1
|
+
export * from "./generated.js";
|
|
2
|
+
export function molOptional(mol) {
|
|
20
3
|
if (mol.hasValue()) {
|
|
21
4
|
return mol.value();
|
|
22
5
|
}
|
|
@@ -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);
|