wowok 1.1.4 → 1.2.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/README.md +7 -2
- package/dist/demand.d.ts +6 -6
- package/dist/demand.d.ts.map +1 -1
- package/dist/demand.js +38 -38
- package/dist/entity.d.ts +23 -0
- package/dist/entity.d.ts.map +1 -0
- package/dist/entity.js +71 -0
- package/dist/exception.d.ts +2 -1
- package/dist/exception.d.ts.map +1 -1
- package/dist/exception.js +1 -0
- package/dist/guard.d.ts +12 -12
- package/dist/guard.d.ts.map +1 -1
- package/dist/guard.js +66 -58
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/machine.d.ts.map +1 -1
- package/dist/machine.js +1 -1
- package/dist/passport.d.ts +16 -9
- package/dist/passport.d.ts.map +1 -1
- package/dist/passport.js +69 -59
- package/dist/permission.d.ts.map +1 -1
- package/dist/permission.js +1 -1
- package/dist/progress.d.ts.map +1 -1
- package/dist/progress.js +10 -1
- package/dist/protocol.d.ts +19 -8
- package/dist/protocol.d.ts.map +1 -1
- package/dist/protocol.js +31 -26
- package/dist/repository.d.ts.map +1 -1
- package/dist/repository.js +11 -1
- package/dist/resource.d.ts +16 -0
- package/dist/resource.d.ts.map +1 -0
- package/dist/resource.js +83 -0
- package/dist/reward.d.ts.map +1 -1
- package/dist/reward.js +10 -1
- package/dist/service.d.ts.map +1 -1
- package/dist/service.js +11 -1
- package/dist/utils.d.ts +1 -0
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +10 -0
- package/dist/vote.d.ts.map +1 -1
- package/dist/vote.js +1 -1
- package/dist/wowok.d.ts +12 -0
- package/dist/wowok.d.ts.map +1 -0
- package/dist/wowok.js +48 -0
- package/package.json +10 -3
- package/src/demand.ts +42 -42
- package/src/entity.ts +83 -0
- package/src/exception.ts +1 -0
- package/src/guard.ts +71 -57
- package/src/index.ts +11 -8
- package/src/machine.ts +3 -2
- package/src/passport.ts +70 -65
- package/src/permission.ts +5 -4
- package/src/progress.ts +11 -3
- package/src/protocol.ts +41 -31
- package/src/repository.ts +12 -2
- package/src/resource.ts +90 -0
- package/src/reward.ts +11 -2
- package/src/service.ts +12 -1
- package/src/utils.ts +12 -1
- package/src/vote.ts +2 -1
- package/src/wowok.ts +56 -0
package/dist/guard.js
CHANGED
|
@@ -13,19 +13,19 @@ export class Guard {
|
|
|
13
13
|
ERROR(Errors.IsValidDesription);
|
|
14
14
|
}
|
|
15
15
|
let bcs_input = maker.get_input()[0];
|
|
16
|
-
let
|
|
16
|
+
let constants = maker.get_constant();
|
|
17
17
|
if (bcs_input.length == 0 || bcs_input.length > Guard.MAX_INPUT_LENGTH) {
|
|
18
18
|
ERROR(Errors.InvalidParam, 'launch input');
|
|
19
19
|
}
|
|
20
20
|
let bValid = true;
|
|
21
|
-
|
|
22
|
-
if (!
|
|
21
|
+
constants?.forEach((v, k) => {
|
|
22
|
+
if (!GuardConstantHelper.IsValidIndentifier(k))
|
|
23
23
|
bValid = false;
|
|
24
24
|
if (!v.value && !v.witness)
|
|
25
25
|
bValid = false;
|
|
26
26
|
});
|
|
27
27
|
if (!bValid) {
|
|
28
|
-
ERROR(Errors.InvalidParam, 'launch
|
|
28
|
+
ERROR(Errors.InvalidParam, 'launch constants');
|
|
29
29
|
}
|
|
30
30
|
let txb = protocol.CurrentSession();
|
|
31
31
|
let input = new Uint8Array(bcs_input); // copy new uint8array to reserve!
|
|
@@ -34,22 +34,22 @@ export class Guard {
|
|
|
34
34
|
target: protocol.GuardFn('new'),
|
|
35
35
|
arguments: [txb.pure(description, BCS.STRING), txb.pure([].slice.call(input.reverse()))],
|
|
36
36
|
});
|
|
37
|
-
|
|
37
|
+
constants?.forEach((v, k) => {
|
|
38
38
|
if (v.type == ContextType.TYPE_WITNESS_ID) {
|
|
39
39
|
if (!v.witness) {
|
|
40
|
-
ERROR(Errors.InvalidParam, '
|
|
40
|
+
ERROR(Errors.InvalidParam, 'constants type');
|
|
41
41
|
}
|
|
42
42
|
txb.moveCall({
|
|
43
|
-
target: protocol.GuardFn("
|
|
43
|
+
target: protocol.GuardFn("constant_add"),
|
|
44
44
|
arguments: [guard, txb.pure(k, BCS.U8), txb.pure(v.type, BCS.U8), txb.pure([].slice.call(v.witness)), txb.pure(true, BCS.BOOL)]
|
|
45
45
|
});
|
|
46
46
|
}
|
|
47
47
|
else {
|
|
48
48
|
if (!v.value) {
|
|
49
|
-
ERROR(Errors.InvalidParam, '
|
|
49
|
+
ERROR(Errors.InvalidParam, 'constants type');
|
|
50
50
|
}
|
|
51
51
|
txb.moveCall({
|
|
52
|
-
target: protocol.GuardFn("
|
|
52
|
+
target: protocol.GuardFn("constant_add"),
|
|
53
53
|
arguments: [guard, txb.pure(k, BCS.U8), txb.pure(v.type, BCS.U8), txb.pure([].slice.call(v.value)), txb.pure(true, BCS.BOOL)]
|
|
54
54
|
});
|
|
55
55
|
}
|
|
@@ -192,57 +192,65 @@ export class Guard {
|
|
|
192
192
|
[MODULES.vote, 'top1_count', 190, [], ValueType.TYPE_U64],
|
|
193
193
|
[MODULES.vote, 'top1_name_by_votes', 191, [], ValueType.TYPE_VEC_U8],
|
|
194
194
|
[MODULES.vote, 'top1_votes', 192, [], ValueType.TYPE_U64],
|
|
195
|
+
[MODULES.wowok, 'initor', 210, [], ValueType.TYPE_ADDRESS],
|
|
196
|
+
[MODULES.wowok, 'everyone_guard', 211, [], ValueType.TYPE_ADDRESS],
|
|
197
|
+
[MODULES.wowok, 'entities', 212, [], ValueType.TYPE_ADDRESS],
|
|
198
|
+
[MODULES.wowok, 'grantor_count', 213, [], ValueType.TYPE_U64],
|
|
199
|
+
[MODULES.wowok, 'has_grantor', 214, [ValueType.TYPE_ADDRESS], ValueType.TYPE_BOOL],
|
|
200
|
+
[MODULES.wowok, 'grantor_name', 215, [ValueType.TYPE_ADDRESS], ValueType.TYPE_VEC_U8],
|
|
201
|
+
[MODULES.wowok, 'grantor_register_time', 216, [ValueType.TYPE_ADDRESS], ValueType.TYPE_U64],
|
|
202
|
+
[MODULES.wowok, 'grantor_expired_time', 217, [ValueType.TYPE_ADDRESS], ValueType.TYPE_U64],
|
|
203
|
+
[MODULES.wowok, 'grantor_grantee', 218, [ValueType.TYPE_ADDRESS], ValueType.TYPE_ADDRESS],
|
|
204
|
+
[MODULES.entity, 'has_entity', 230, [ValueType.TYPE_ADDRESS], ValueType.TYPE_BOOL],
|
|
205
|
+
[MODULES.entity, 'entity_like', 231, [ValueType.TYPE_ADDRESS], ValueType.TYPE_U64],
|
|
206
|
+
[MODULES.entity, 'entity_dislike', 232, [ValueType.TYPE_ADDRESS], ValueType.TYPE_U64],
|
|
207
|
+
[MODULES.entity, 'entity_infomation', 233, [ValueType.TYPE_ADDRESS], ValueType.TYPE_VEC_U8],
|
|
195
208
|
];
|
|
196
209
|
static BoolCmd = Guard.QUERIES.filter(q => q[4] == ValueType.TYPE_BOOL);
|
|
197
210
|
static IsBoolCmd = (cmd) => { return Guard.BoolCmd.includes((q) => { return q[2] == cmd; }); };
|
|
198
211
|
static GetCmd = (cmd) => {
|
|
199
|
-
|
|
200
|
-
if (!r) {
|
|
201
|
-
ERROR(Errors.Fail, 'CmdParamCount: not found');
|
|
202
|
-
}
|
|
203
|
-
;
|
|
204
|
-
return r;
|
|
212
|
+
return Guard.QUERIES.find((q) => { return q[2] == cmd; });
|
|
205
213
|
};
|
|
206
214
|
}
|
|
207
|
-
export class
|
|
215
|
+
export class GuardConstantHelper {
|
|
208
216
|
static IsValidIndentifier = (identifier) => {
|
|
209
217
|
if (!IsValidInt(identifier) || identifier > 255)
|
|
210
218
|
return false;
|
|
211
219
|
return true;
|
|
212
220
|
};
|
|
213
|
-
static
|
|
214
|
-
if (
|
|
215
|
-
let v =
|
|
221
|
+
static get_constant_value(constants, identifier, type) {
|
|
222
|
+
if (constants.has(identifier)) {
|
|
223
|
+
let v = constants.get(identifier);
|
|
216
224
|
if (v?.value && v.type == type) {
|
|
217
225
|
return v.value;
|
|
218
226
|
}
|
|
219
227
|
}
|
|
220
228
|
}
|
|
221
|
-
static
|
|
222
|
-
if (
|
|
223
|
-
let v =
|
|
229
|
+
static get_constant_witness(constants, identifier) {
|
|
230
|
+
if (constants.has(identifier)) {
|
|
231
|
+
let v = constants.get(identifier);
|
|
224
232
|
if (v?.witness && v.type == ContextType.TYPE_WITNESS_ID) {
|
|
225
233
|
return v.witness;
|
|
226
234
|
}
|
|
227
235
|
}
|
|
228
236
|
}
|
|
229
|
-
static
|
|
230
|
-
if (!
|
|
231
|
-
ERROR(Errors.IsValidIndentifier, '
|
|
237
|
+
static add_future_constant(constants, identifier, witness, value, bNeedSerialize = true) {
|
|
238
|
+
if (!GuardConstantHelper.IsValidIndentifier(identifier))
|
|
239
|
+
ERROR(Errors.IsValidIndentifier, 'add_future_constant');
|
|
232
240
|
if (!witness && !value)
|
|
233
241
|
ERROR(Errors.InvalidParam, 'both witness and value invalid');
|
|
234
|
-
let v =
|
|
242
|
+
let v = constants.get(identifier);
|
|
235
243
|
if (!v || v.type == ContextType.TYPE_WITNESS_ID) {
|
|
236
244
|
if (bNeedSerialize) {
|
|
237
|
-
|
|
245
|
+
constants.set(identifier, { type: ContextType.TYPE_WITNESS_ID, value: value ? Bcs.getInstance().ser_address(value) : undefined, witness: witness ? Bcs.getInstance().ser_address(witness) : undefined });
|
|
238
246
|
}
|
|
239
247
|
else {
|
|
240
|
-
|
|
248
|
+
constants.set(identifier, { type: ContextType.TYPE_WITNESS_ID, value: value ? value : undefined, witness: witness ? witness : undefined });
|
|
241
249
|
}
|
|
242
250
|
}
|
|
243
251
|
}
|
|
244
|
-
static
|
|
245
|
-
if (!
|
|
252
|
+
static add_constant(constants, identifier, type, value, bNeedSerialize = true) {
|
|
253
|
+
if (!GuardConstantHelper.IsValidIndentifier(identifier))
|
|
246
254
|
return false;
|
|
247
255
|
if (!value)
|
|
248
256
|
return false;
|
|
@@ -267,27 +275,27 @@ export class GuardVariableHelper {
|
|
|
267
275
|
case ValueType.TYPE_VEC_U256:
|
|
268
276
|
let ser = SER_VALUE.find(s => s.type == type);
|
|
269
277
|
if (!ser)
|
|
270
|
-
ERROR(Errors.Fail, '
|
|
271
|
-
bNeedSerialize ?
|
|
272
|
-
|
|
278
|
+
ERROR(Errors.Fail, 'add_constant: invalid type');
|
|
279
|
+
bNeedSerialize ? constants.set(identifier, { type: type, value: Bcs.getInstance().ser(ser.name, value) }) :
|
|
280
|
+
constants.set(identifier, { type: type, value: value });
|
|
273
281
|
return;
|
|
274
282
|
case ValueType.TYPE_VEC_U8:
|
|
275
283
|
if (typeof (value) === 'string') {
|
|
276
|
-
|
|
284
|
+
constants.set(identifier, { type: type, value: Bcs.getInstance().ser_string(value) });
|
|
277
285
|
}
|
|
278
286
|
else {
|
|
279
|
-
|
|
287
|
+
constants.set(identifier, { type: type, value: value });
|
|
280
288
|
}
|
|
281
289
|
return;
|
|
282
290
|
default:
|
|
283
|
-
ERROR(Errors.Fail, '
|
|
291
|
+
ERROR(Errors.Fail, 'add_constant serialize not impl yet');
|
|
284
292
|
}
|
|
285
293
|
}
|
|
286
294
|
}
|
|
287
295
|
export class GuardMaker {
|
|
288
296
|
data = [];
|
|
289
297
|
type_validator = [];
|
|
290
|
-
|
|
298
|
+
constant = new Map();
|
|
291
299
|
static index = 0;
|
|
292
300
|
static get_index() {
|
|
293
301
|
if (GuardMaker.index == 256) {
|
|
@@ -296,14 +304,14 @@ export class GuardMaker {
|
|
|
296
304
|
return GuardMaker.index++;
|
|
297
305
|
}
|
|
298
306
|
constructor() { }
|
|
299
|
-
|
|
307
|
+
add_constant(type, value, bNeedSerialize = true) {
|
|
300
308
|
let identifier = GuardMaker.get_index();
|
|
301
309
|
if (type == ContextType.TYPE_WITNESS_ID) {
|
|
302
|
-
// add witness to
|
|
303
|
-
|
|
310
|
+
// add witness to constant
|
|
311
|
+
GuardConstantHelper.add_future_constant(this.constant, identifier, value, undefined, bNeedSerialize);
|
|
304
312
|
}
|
|
305
313
|
else {
|
|
306
|
-
|
|
314
|
+
GuardConstantHelper.add_constant(this.constant, identifier, type, value, bNeedSerialize);
|
|
307
315
|
}
|
|
308
316
|
return identifier;
|
|
309
317
|
}
|
|
@@ -367,16 +375,16 @@ export class GuardMaker {
|
|
|
367
375
|
this.data.push(Bcs.getInstance().ser_address(param));
|
|
368
376
|
this.type_validator.push(ValueType.TYPE_ADDRESS);
|
|
369
377
|
break;
|
|
370
|
-
case ContextType.
|
|
378
|
+
case ContextType.TYPE_CONSTANT:
|
|
371
379
|
if (!param) {
|
|
372
380
|
ERROR(Errors.InvalidParam, 'param invalid');
|
|
373
381
|
}
|
|
374
382
|
if (typeof (param) != 'number' || !IsValidInt(param) || param > 255) {
|
|
375
383
|
ERROR(Errors.InvalidParam, 'add_param param');
|
|
376
384
|
}
|
|
377
|
-
var v = this.
|
|
385
|
+
var v = this.constant.get(param);
|
|
378
386
|
if (!v)
|
|
379
|
-
ERROR(Errors.Fail, 'identifier not in
|
|
387
|
+
ERROR(Errors.Fail, 'identifier not in constant');
|
|
380
388
|
this.type_validator.push(v.type);
|
|
381
389
|
this.data.push(Bcs.getInstance().ser_u8(type));
|
|
382
390
|
this.data.push(Bcs.getInstance().ser_u8(param));
|
|
@@ -387,14 +395,14 @@ export class GuardMaker {
|
|
|
387
395
|
;
|
|
388
396
|
return this;
|
|
389
397
|
}
|
|
390
|
-
// object_address_from: string for static address; number as identifier
|
|
398
|
+
// object_address_from: string for static address; number as identifier inconstant
|
|
391
399
|
add_query(module, query_name, object_address_from, bWitness = false) {
|
|
392
400
|
let query_index = Guard.QUERIES.findIndex((q) => { return q[0] == module && q[1] == query_name; });
|
|
393
401
|
if (query_index == -1) {
|
|
394
402
|
ERROR(Errors.InvalidParam, 'query_name');
|
|
395
403
|
}
|
|
396
404
|
if (typeof (object_address_from) == 'number') {
|
|
397
|
-
if (!
|
|
405
|
+
if (!GuardConstantHelper.IsValidIndentifier(object_address_from)) {
|
|
398
406
|
ERROR(Errors.InvalidParam, 'object_address_from');
|
|
399
407
|
}
|
|
400
408
|
}
|
|
@@ -418,12 +426,12 @@ export class GuardMaker {
|
|
|
418
426
|
this.data.push(Bcs.getInstance().ser_address(object_address_from)); // object address
|
|
419
427
|
}
|
|
420
428
|
else {
|
|
421
|
-
let v = this.
|
|
429
|
+
let v = this.constant.get(object_address_from);
|
|
422
430
|
if (!v)
|
|
423
|
-
ERROR(Errors.Fail, 'object_address_from not in
|
|
431
|
+
ERROR(Errors.Fail, 'object_address_from not in constant');
|
|
424
432
|
if ((bWitness && v?.type == ContextType.TYPE_WITNESS_ID) || (!bWitness && v?.type == ValueType.TYPE_ADDRESS)) {
|
|
425
|
-
this.data.push(Bcs.getInstance().ser_u8(ContextType.
|
|
426
|
-
this.data.push(Bcs.getInstance().ser_u8(object_address_from)); // object identifer in
|
|
433
|
+
this.data.push(Bcs.getInstance().ser_u8(ContextType.TYPE_CONSTANT));
|
|
434
|
+
this.data.push(Bcs.getInstance().ser_u8(object_address_from)); // object identifer in constants
|
|
427
435
|
}
|
|
428
436
|
else {
|
|
429
437
|
ERROR(Errors.Fail, 'type bWitness not match');
|
|
@@ -507,20 +515,20 @@ export class GuardMaker {
|
|
|
507
515
|
IsReady() {
|
|
508
516
|
return this.type_validator.length == 1 && this.type_validator[0] == ValueType.TYPE_BOOL && this.data.length == 1;
|
|
509
517
|
}
|
|
510
|
-
combine(otherBuilt, bAnd = true,
|
|
518
|
+
combine(otherBuilt, bAnd = true, bCombinConstant = false) {
|
|
511
519
|
if (!otherBuilt.IsReady() || !this.IsReady()) {
|
|
512
520
|
ERROR(Errors.Fail, 'both should built yet');
|
|
513
521
|
}
|
|
514
522
|
;
|
|
515
523
|
let maker = new GuardMaker();
|
|
516
|
-
this.
|
|
517
|
-
maker.
|
|
524
|
+
this.constant.forEach((v, k) => {
|
|
525
|
+
maker.constant.set(k, { type: v.type, value: v.value, witness: v.witness });
|
|
518
526
|
});
|
|
519
|
-
otherBuilt.
|
|
520
|
-
if (maker.
|
|
521
|
-
ERROR(Errors.Fail, '
|
|
527
|
+
otherBuilt.constant.forEach((v, k) => {
|
|
528
|
+
if (maker.constant.has(k) && !bCombinConstant) {
|
|
529
|
+
ERROR(Errors.Fail, 'constant identifier exist');
|
|
522
530
|
}
|
|
523
|
-
maker.
|
|
531
|
+
maker.constant.set(k, { type: v.type, value: v.value, witness: v.witness });
|
|
524
532
|
});
|
|
525
533
|
let op = bAnd ? OperatorType.TYPE_LOGIC_AND : OperatorType.TYPE_LOGIC_OR;
|
|
526
534
|
maker.data.push(concatenate(Uint8Array, ...this.data, ...otherBuilt.data, Bcs.getInstance().ser_u8(op)));
|
|
@@ -528,7 +536,7 @@ export class GuardMaker {
|
|
|
528
536
|
maker.type_validator = this.type_validator;
|
|
529
537
|
return maker;
|
|
530
538
|
}
|
|
531
|
-
|
|
539
|
+
get_constant() { return this.constant; }
|
|
532
540
|
get_input() { return this.data; }
|
|
533
541
|
static input_combine(input1, input2, bAnd = true) {
|
|
534
542
|
let op = bAnd ? OperatorType.TYPE_LOGIC_AND : OperatorType.TYPE_LOGIC_OR;
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA;AACxB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA;AACxB,cAAc,YAAY,CAAA;AAC1B,cAAc,UAAU,CAAA;AACxB,cAAc,SAAS,CAAA;AACvB,cAAc,cAAc,CAAA;AAC5B,cAAc,SAAS,CAAA;AACvB,cAAc,cAAc,CAAA;AAC5B,cAAc,QAAQ,CAAA;AACtB,cAAc,YAAY,CAAA;AAC1B,cAAc,YAAY,CAAA;AAC1B,cAAc,WAAW,CAAA;AACzB,cAAc,WAAW,CAAA;AACzB,cAAc,WAAW,CAAA;AACzB,cAAc,UAAU,CAAA;AACxB,cAAc,SAAS,CAAA;AACvB,cAAc,YAAY,CAAA"}
|
package/dist/index.js
CHANGED
package/dist/machine.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"machine.d.ts","sourceRoot":"","sources":["../src/machine.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,KAAK,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAE/F,OAAO,EAAE,QAAQ,EAAc,gBAAgB,EAAE,gBAAgB,EAAG,cAAc,EAAE,aAAa,EAAE,cAAc,EAAG,WAAW,EAAE,SAAS,EAAC,MAAM,YAAY,CAAC;AAG9J,OAAO,EAAc,mBAAmB,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"machine.d.ts","sourceRoot":"","sources":["../src/machine.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,KAAK,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAE/F,OAAO,EAAE,QAAQ,EAAc,gBAAgB,EAAE,gBAAgB,EAAG,cAAc,EAAE,aAAa,EAAE,cAAc,EAAG,WAAW,EAAE,SAAS,EAAC,MAAM,YAAY,CAAC;AAG9J,OAAO,EAAc,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAK/D,MAAM,MAAM,iBAAiB,GAAG,iBAAiB,GAAG,MAAM,CAAC;AAE3D,MAAM,WAAW,eAAe;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,mBAAmB,CAAC;IACjC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,WAAW,CAAC;CACvB;AACD,MAAM,WAAW,iBAAiB;IAC9B,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,eAAe,EAAE,CAAC;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AACD,MAAM,WAAW,YAAY;IACzB,IAAI,E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AC,OAAO,EAAE,QAAQ,CAAC,EAAC,cAAc;IAc/C,OAAO,CAAC,QAAQ,CAAC,EAAC,cAAc;IAgBhC,iBAAiB,CAAC,cAAc,EAAC,gBAAgB;IAcjD,MAAM,CAAC,iBAAiB,SAAM;IAC9B,MAAM,CAAC,oBAAoB,SAAiB;CAC/C"}
|
package/dist/machine.js
CHANGED
|
@@ -19,7 +19,6 @@ export class Machine {
|
|
|
19
19
|
this.object = '';
|
|
20
20
|
}
|
|
21
21
|
static New(protocol, permission, description, endpoint, passport) {
|
|
22
|
-
let m = new Machine(protocol, permission);
|
|
23
22
|
if (!Protocol.IsValidObjects([permission])) {
|
|
24
23
|
ERROR(Errors.IsValidObjects, 'permission');
|
|
25
24
|
}
|
|
@@ -29,6 +28,7 @@ export class Machine {
|
|
|
29
28
|
if (endpoint && !IsValidEndpoint(endpoint)) {
|
|
30
29
|
ERROR(Errors.IsValidEndpoint);
|
|
31
30
|
}
|
|
31
|
+
let m = new Machine(protocol, permission);
|
|
32
32
|
let txb = protocol.CurrentSession();
|
|
33
33
|
let ep = endpoint ? txb.pure(Bcs.getInstance().ser_option_string(endpoint)) : OptionNone(txb);
|
|
34
34
|
if (passport) {
|
package/dist/passport.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export type Guard_Query_Object = {
|
|
|
6
6
|
types: string[];
|
|
7
7
|
id: string;
|
|
8
8
|
};
|
|
9
|
-
interface QueryInfo {
|
|
9
|
+
export interface QueryInfo {
|
|
10
10
|
identifier?: number;
|
|
11
11
|
index: number;
|
|
12
12
|
type: number;
|
|
@@ -16,15 +16,15 @@ interface QueryInfo {
|
|
|
16
16
|
interface GuardInfo {
|
|
17
17
|
id: string;
|
|
18
18
|
query_list: (string | QueryInfo)[];
|
|
19
|
-
|
|
19
|
+
constant: QueryInfo[];
|
|
20
20
|
input_witness: QueryInfo[];
|
|
21
21
|
}
|
|
22
|
-
interface
|
|
22
|
+
export interface DeGuardConstant {
|
|
23
23
|
type: number;
|
|
24
24
|
value: any;
|
|
25
25
|
identifier?: number;
|
|
26
26
|
}
|
|
27
|
-
interface DeGuardData {
|
|
27
|
+
export interface DeGuardData {
|
|
28
28
|
type: number;
|
|
29
29
|
value?: any;
|
|
30
30
|
identifier?: number;
|
|
@@ -32,12 +32,12 @@ interface DeGuardData {
|
|
|
32
32
|
child: DeGuardData[];
|
|
33
33
|
ret_type?: number;
|
|
34
34
|
}
|
|
35
|
-
interface FutrueFill {
|
|
35
|
+
export interface FutrueFill {
|
|
36
36
|
guard: string;
|
|
37
37
|
index: number;
|
|
38
38
|
future: string;
|
|
39
39
|
}
|
|
40
|
-
interface PassportQuery {
|
|
40
|
+
export interface PassportQuery {
|
|
41
41
|
guard: GuardObject[];
|
|
42
42
|
query: Guard_Query_Object[];
|
|
43
43
|
witness: Guard_Query_Object[];
|
|
@@ -50,10 +50,17 @@ export declare class GuardParser {
|
|
|
50
50
|
private get_index;
|
|
51
51
|
private constructor();
|
|
52
52
|
guardlist: () => GuardInfo[];
|
|
53
|
-
static
|
|
54
|
-
|
|
53
|
+
static DeGuardObject_FromData: (guard_constants: any, guard_input_bytes: any) => {
|
|
54
|
+
object: DeGuardData;
|
|
55
|
+
constant: DeGuardConstant[];
|
|
56
|
+
};
|
|
57
|
+
static DeGuardObject: (protocol: Protocol, guard: string) => Promise<{
|
|
58
|
+
object: DeGuardData;
|
|
59
|
+
constant: DeGuardConstant[];
|
|
60
|
+
}>;
|
|
61
|
+
static ResolveData: (constants: DeGuardConstant[], stack: DeGuardData[], current: DeGuardData) => void;
|
|
55
62
|
static CreateAsync: (protocol: Protocol, guards: string[]) => Promise<GuardParser>;
|
|
56
|
-
|
|
63
|
+
parse_constant: (info: GuardInfo, constants: any) => void;
|
|
57
64
|
parse_bcs: (info: GuardInfo, chain_bytes: Uint8Array) => void;
|
|
58
65
|
private get_object;
|
|
59
66
|
done: (fill?: FutrueFill[]) => Promise<PassportQuery>;
|
package/dist/passport.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"passport.d.ts","sourceRoot":"","sources":["../src/passport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,sBAAsB,EAAU,MAAM,6BAA6B,CAAC;AAClF,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,QAAQ,EACK,MAAM,YAAY,CAAC;AAMlE,MAAM,MAAM,kBAAkB,GAAG;IAC7B,MAAM,EAAE,UAAU,CAAC;IACnB,MAAM,EAAE,sBAAsB,CAAC;IAC/B,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,EAAE,EAAE,MAAM,CAAC;CACd,CAAA;AAED,
|
|
1
|
+
{"version":3,"file":"passport.d.ts","sourceRoot":"","sources":["../src/passport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,sBAAsB,EAAU,MAAM,6BAA6B,CAAC;AAClF,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,QAAQ,EACK,MAAM,YAAY,CAAC;AAMlE,MAAM,MAAM,kBAAkB,GAAG;IAC7B,MAAM,EAAE,UAAU,CAAC;IACnB,MAAM,EAAE,sBAAsB,CAAC;IAC/B,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,EAAE,EAAE,MAAM,CAAC;CACd,CAAA;AAED,MAAM,WAAW,SAAS;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,EAAG,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,gBAAgB,EAAE,MAAM,CAAC;IACzB,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB;AACD,UAAU,SAAS;IACf,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,CAAC,MAAM,GAAG,SAAS,CAAC,EAAE,CAAC;IACnC,QAAQ,EAAE,SAAS,EAAE,CAAC;IACtB,aAAa,EAAE,SAAS,EAAE,CAAC;CAC9B;AAED,MAAM,WAAW,eAAe;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,GAAG,CAAC;IACX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