wowok 1.1.0 → 1.1.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/README.md +1 -1
- package/dist/demand.d.ts +2 -3
- package/dist/demand.d.ts.map +1 -1
- package/dist/demand.js +19 -11
- package/dist/exception.d.ts +2 -1
- package/dist/exception.d.ts.map +1 -1
- package/dist/exception.js +1 -0
- package/dist/graphql.d.ts +2 -0
- package/dist/graphql.d.ts.map +1 -1
- package/dist/graphql.js +19 -0
- package/dist/guard.d.ts +18 -23
- package/dist/guard.d.ts.map +1 -1
- package/dist/guard.js +220 -199
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/machine.d.ts +6 -6
- package/dist/machine.d.ts.map +1 -1
- package/dist/machine.js +7 -7
- package/dist/passport.d.ts +34 -22
- package/dist/passport.d.ts.map +1 -1
- package/dist/passport.js +124 -214
- package/dist/permission.d.ts +3 -0
- package/dist/permission.d.ts.map +1 -1
- package/dist/permission.js +5 -2
- package/dist/progress.js +3 -3
- package/dist/protocol.d.ts +11 -5
- package/dist/protocol.d.ts.map +1 -1
- package/dist/protocol.js +30 -6
- package/dist/repository.d.ts +2 -0
- package/dist/repository.d.ts.map +1 -1
- package/dist/repository.js +73 -5
- package/dist/service.d.ts +3 -3
- package/dist/service.d.ts.map +1 -1
- package/dist/service.js +115 -116
- package/dist/utils.d.ts +10 -2
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +39 -1
- package/dist/vote.js +8 -8
- package/package.json +1 -1
- package/src/exception.ts +1 -0
- package/src/graphql.ts +20 -0
- package/src/guard.ts +208 -192
- package/src/index.ts +1 -0
- package/src/machine.ts +10 -10
- package/src/passport.ts +139 -251
- package/src/permission.ts +5 -2
- package/src/progress.ts +3 -3
- package/src/protocol.ts +26 -5
- package/src/repository.ts +73 -5
- package/src/service.ts +25 -25
- package/src/utils.ts +44 -4
- package/src/vote.ts +8 -8
- package/tsconfig.json +3 -2
package/dist/machine.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BCS } from '@mysten/bcs';
|
|
2
2
|
import { Protocol } from './protocol';
|
|
3
|
-
import { IsValidInt, IsValidUint,
|
|
3
|
+
import { IsValidInt, IsValidUint, Bcs, array_unique, IsValidArray, IsValidAddress, IsValidName, IsValidName_AllowEmpty, IsValidEndpoint, OptionNone, IsValidDesription } from './utils';
|
|
4
4
|
import { Permission } from './permission';
|
|
5
5
|
import { Errors, ERROR } from './exception';
|
|
6
6
|
export class Machine {
|
|
@@ -30,7 +30,7 @@ export class Machine {
|
|
|
30
30
|
ERROR(Errors.IsValidEndpoint);
|
|
31
31
|
}
|
|
32
32
|
let txb = protocol.CurrentSession();
|
|
33
|
-
let ep = endpoint ? txb.pure(
|
|
33
|
+
let ep = endpoint ? txb.pure(Bcs.getInstance().ser_option_string(endpoint)) : OptionNone(txb);
|
|
34
34
|
if (passport) {
|
|
35
35
|
m.object = txb.moveCall({
|
|
36
36
|
target: protocol.MachineFn('new_with_passport'),
|
|
@@ -89,10 +89,10 @@ export class Machine {
|
|
|
89
89
|
arguments: [txb.pure(node.name), txb.pure(node.description)]
|
|
90
90
|
});
|
|
91
91
|
node.pairs.forEach((pair) => {
|
|
92
|
-
let threshold = pair?.threshold ? txb.pure(
|
|
92
|
+
let threshold = pair?.threshold ? txb.pure(Bcs.getInstance().ser_option_u64(pair.threshold)) : OptionNone(txb);
|
|
93
93
|
pair.forwards.forEach((forward) => {
|
|
94
94
|
let weight = forward?.weight ? forward.weight : 1;
|
|
95
|
-
let perm = forward?.permission ? txb.pure(
|
|
95
|
+
let perm = forward?.permission ? txb.pure(Bcs.getInstance().ser_option_u64(forward.permission)) : OptionNone(txb);
|
|
96
96
|
let namedOperator = forward?.namedOperator ? txb.pure(forward.namedOperator) : txb.pure('');
|
|
97
97
|
let f;
|
|
98
98
|
if (forward?.guard) {
|
|
@@ -149,14 +149,14 @@ export class Machine {
|
|
|
149
149
|
if (passport) {
|
|
150
150
|
txb.moveCall({
|
|
151
151
|
target: this.protocol.MachineFn('node_remove_with_passport'),
|
|
152
|
-
arguments: [passport, Protocol.TXB_OBJECT(txb, this.object), txb.pure(
|
|
152
|
+
arguments: [passport, Protocol.TXB_OBJECT(txb, this.object), txb.pure(Bcs.getInstance().ser_vector_string(nodes_name)),
|
|
153
153
|
txb.pure(bTransferMyself, BCS.BOOL), Protocol.TXB_OBJECT(txb, this.permission)],
|
|
154
154
|
});
|
|
155
155
|
}
|
|
156
156
|
else {
|
|
157
157
|
txb.moveCall({
|
|
158
158
|
target: this.protocol.MachineFn('node_remove'),
|
|
159
|
-
arguments: [Protocol.TXB_OBJECT(txb, this.object), txb.pure(
|
|
159
|
+
arguments: [Protocol.TXB_OBJECT(txb, this.object), txb.pure(Bcs.getInstance().ser_vector_string(nodes_name)), txb.pure(bTransferMyself, BCS.BOOL), Protocol.TXB_OBJECT(txb, this.permission)],
|
|
160
160
|
});
|
|
161
161
|
}
|
|
162
162
|
}
|
|
@@ -266,7 +266,7 @@ export class Machine {
|
|
|
266
266
|
ERROR(Errors.IsValidEndpoint);
|
|
267
267
|
}
|
|
268
268
|
let txb = this.protocol.CurrentSession();
|
|
269
|
-
let ep = endpoint ? txb.pure(
|
|
269
|
+
let ep = endpoint ? txb.pure(Bcs.getInstance().ser_option_string(endpoint)) : OptionNone(txb);
|
|
270
270
|
if (passport) {
|
|
271
271
|
txb.moveCall({
|
|
272
272
|
target: this.protocol.MachineFn('endpoint_set_with_passport'),
|
package/dist/passport.d.ts
CHANGED
|
@@ -1,42 +1,54 @@
|
|
|
1
|
-
import { SuiObjectResponse, SuiObjectDataOptions } from '@mysten/sui.js/client';
|
|
2
1
|
import { type TransactionObjectInput } from '@mysten/sui.js/transactions';
|
|
3
|
-
import { FnCallType,
|
|
4
|
-
import { VariableType } from './guard';
|
|
2
|
+
import { FnCallType, GuardObject, Protocol } from './protocol';
|
|
5
3
|
export type Guard_Query_Object = {
|
|
6
4
|
target: FnCallType;
|
|
7
5
|
object: TransactionObjectInput;
|
|
8
6
|
types: string[];
|
|
9
7
|
id: string;
|
|
10
8
|
};
|
|
11
|
-
|
|
12
|
-
module: MODULES;
|
|
13
|
-
name: string;
|
|
14
|
-
cmd: number;
|
|
15
|
-
params: Data_Type[];
|
|
16
|
-
result: Data_Type;
|
|
17
|
-
};
|
|
18
|
-
export type FutureValueRequest = {
|
|
19
|
-
guardid: string;
|
|
9
|
+
interface FutrueInfo {
|
|
20
10
|
identifier: number;
|
|
21
|
-
type:
|
|
11
|
+
type: number;
|
|
22
12
|
witness: string;
|
|
23
|
-
|
|
24
|
-
}
|
|
13
|
+
futrue?: string;
|
|
14
|
+
}
|
|
15
|
+
interface GuardInfo {
|
|
16
|
+
id: string;
|
|
17
|
+
query_list: (string | {
|
|
18
|
+
identifier: number;
|
|
19
|
+
type: number;
|
|
20
|
+
witness: string;
|
|
21
|
+
})[];
|
|
22
|
+
futrue_list: FutrueInfo[];
|
|
23
|
+
}
|
|
24
|
+
interface FutrueFill {
|
|
25
|
+
guard: string;
|
|
26
|
+
identifier: number;
|
|
27
|
+
future: string;
|
|
28
|
+
}
|
|
29
|
+
interface PassportQuery {
|
|
30
|
+
query: Guard_Query_Object[];
|
|
31
|
+
witness: Guard_Query_Object[];
|
|
32
|
+
}
|
|
25
33
|
export declare class GuardParser {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
static
|
|
31
|
-
|
|
34
|
+
protected guard_list: GuardInfo[];
|
|
35
|
+
protected protocol: Protocol;
|
|
36
|
+
private constructor();
|
|
37
|
+
guardlist: () => GuardInfo[];
|
|
38
|
+
static CreateAsync: (protocol: Protocol, guards: string[]) => Promise<GuardParser>;
|
|
39
|
+
private parse_future;
|
|
40
|
+
private parse_bcs;
|
|
41
|
+
done: (fill?: FutrueFill[]) => Promise<PassportQuery>;
|
|
42
|
+
private object_query;
|
|
32
43
|
}
|
|
33
44
|
export declare class Passport {
|
|
34
45
|
static MAX_GUARD_COUNT: number;
|
|
35
46
|
protected passport: import("@mysten/sui.js/transactions").TransactionResult;
|
|
36
47
|
protected protocol: Protocol;
|
|
37
48
|
get_object(): import("@mysten/sui.js/transactions").TransactionResult;
|
|
38
|
-
constructor(protocol: Protocol, guards: GuardObject[],
|
|
49
|
+
constructor(protocol: Protocol, guards: GuardObject[], query?: PassportQuery);
|
|
39
50
|
destroy(): void;
|
|
40
51
|
freeze(): void;
|
|
41
52
|
}
|
|
53
|
+
export {};
|
|
42
54
|
//# sourceMappingURL=passport.d.ts.map
|
package/dist/passport.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"passport.d.ts","sourceRoot":"","sources":["../src/passport.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"passport.d.ts","sourceRoot":"","sources":["../src/passport.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,sBAAsB,EAAU,MAAM,6BAA6B,CAAC;AAClF,OAAO,EAAE,UAAU,EAAe,WAAW,EAAE,QAAQ,EAC/B,MAAM,YAAY,CAAC;AAM3C,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,UAAU,UAAU;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAG,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB;AACD,UAAU,SAAS;IACf,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,CAAC,MAAM,GAAG;QAAC,UAAU,EAAC,MAAM,CAAC;QAAC,IAAI,EAAC,MAAM,CAAC;QAAC,OAAO,EAAC,MAAM,CAAA;KAAC,CAAC,EAAE,CAAC;IAC1E,WAAW,EAAE,UAAU,EAAE,CAAC;CAC7B;AACD,UAAU,UAAU;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;CAClB;AAED,UAAU,aAAa;IACnB,KAAK,EAAE,kBAAkB,EAAE,CAAC;IAC5B,OAAO,EAAE,kBAAkB,EAAE,CAAC;CACjC;AACD,qBAAa,WAAW;IACpB,SAAS,CAAC,UAAU,EAAE,SAAS,EAAE,CAAM;IACvC,SAAS,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC7B,OAAO;IACP,SAAS,oBAAmC;IAE5C,MAAM,CAAC,WAAW,aAAoB,QAAQ,UAAU,MAAM,EAAE,0BAwB/D;IAED,OAAO,CAAC,YAAY,CASnB;IAED,OAAO,CAAC,SAAS,CA+DhB;IAED,IAAI,UAAgB,UAAU,EAAE,KAAI,QAAQ,aAAa,CAAC,CA4CzD;IAED,OAAO,CAAC,YAAY,CAcnB;CACJ;AAED,qBAAa,QAAQ;IACjB,MAAM,CAAC,eAAe,SAAK;IAC3B,SAAS,CAAC,QAAQ,0DAAC;IACnB,SAAS,CAAC,QAAQ,WAAC;IAEnB,UAAU;gBAEG,QAAQ,EAAC,QAAQ,EAAE,MAAM,EAAC,WAAW,EAAE,EAAE,KAAK,CAAC,EAAC,aAAa;IAmD1E,OAAO;IAQP,MAAM;CAOT"}
|
package/dist/passport.js
CHANGED
|
@@ -1,29 +1,48 @@
|
|
|
1
1
|
import { Inputs } from '@mysten/sui.js/transactions';
|
|
2
|
-
import { Protocol, ContextType, OperatorType, ValueType
|
|
3
|
-
import { parse_object_type, array_unique,
|
|
4
|
-
import { Guard } from './guard';
|
|
2
|
+
import { Protocol, ContextType, OperatorType, ValueType } from './protocol';
|
|
3
|
+
import { parse_object_type, array_unique, Bcs, ulebDecode, IsValidAddress, IsValidArray } from './utils';
|
|
5
4
|
import { BCS } from '@mysten/bcs';
|
|
6
5
|
import { ERROR, Errors } from './exception';
|
|
7
6
|
export class GuardParser {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
guard_list = [];
|
|
8
|
+
protocol;
|
|
9
|
+
constructor(protocol) { this.protocol = protocol; }
|
|
10
|
+
guardlist = () => { return this.guard_list; };
|
|
11
|
+
static CreateAsync = async (protocol, guards) => {
|
|
12
|
+
if (!IsValidArray(guards, IsValidAddress)) {
|
|
13
|
+
ERROR(Errors.IsValidArray, 'guards');
|
|
14
|
+
}
|
|
15
|
+
let guard_list = array_unique(guards);
|
|
16
|
+
const me = new GuardParser(protocol);
|
|
17
|
+
let res = await protocol.Query_Raw(guards);
|
|
18
|
+
res.forEach((r) => {
|
|
19
|
+
let c = r.data?.content;
|
|
20
|
+
if (!c)
|
|
21
|
+
return;
|
|
22
|
+
let index = protocol.WOWOK_OBJECTS_TYPE().findIndex(v => v.includes('guard::Guard') && v == c.type);
|
|
23
|
+
if (index == -1)
|
|
24
|
+
return;
|
|
25
|
+
let info = { id: c.fields.id.id, query_list: [], futrue_list: [] };
|
|
26
|
+
me.parse_future(info, c.fields.variables);
|
|
27
|
+
if (c.fields.input.type == (protocol.Package() + '::bcs::BCS')) {
|
|
28
|
+
me.parse_bcs(info, Uint8Array.from(c.fields.input.fields.bytes));
|
|
29
|
+
}
|
|
30
|
+
me.guard_list.push(info);
|
|
12
31
|
});
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
32
|
+
return me;
|
|
33
|
+
};
|
|
34
|
+
parse_future = (info, variables) => {
|
|
35
|
+
variables.forEach((v) => {
|
|
36
|
+
if (v.type == (this.protocol.Package() + '::guard::Variable')) {
|
|
37
|
+
if (v.fields.type == OperatorType.TYPE_FUTURE_QUERY || v.fields.type == ContextType.TYPE_CONTEXT_FUTURE_ID) {
|
|
38
|
+
info.futrue_list.push({ identifier: v.fields.identifier, type: v.fields.type,
|
|
39
|
+
witness: '0x' + Bcs.getInstance().de(BCS.ADDRESS, Uint8Array.from(v.fields.value)) });
|
|
19
40
|
}
|
|
20
|
-
}
|
|
41
|
+
}
|
|
21
42
|
});
|
|
22
|
-
return future_objects_result;
|
|
23
43
|
};
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
var arr = [].slice.call(chain_sense_bsc.reverse());
|
|
44
|
+
parse_bcs = (info, chain_bytes) => {
|
|
45
|
+
var arr = [].slice.call(chain_bytes.reverse());
|
|
27
46
|
while (arr.length > 0) {
|
|
28
47
|
var type = arr.shift();
|
|
29
48
|
// console.log(type);
|
|
@@ -38,20 +57,21 @@ export class GuardParser {
|
|
|
38
57
|
case OperatorType.TYPE_LOGIC_OPERATOR_EQUAL:
|
|
39
58
|
case OperatorType.TYPE_LOGIC_OPERATOR_HAS_SUBSTRING:
|
|
40
59
|
case OperatorType.TYPE_LOGIC_ALWAYS_TRUE:
|
|
60
|
+
case OperatorType.TYPE_LOGIC_NOT:
|
|
61
|
+
case OperatorType.TYPE_LOGIC_AND:
|
|
62
|
+
case OperatorType.TYPE_LOGIC_OR:
|
|
41
63
|
break;
|
|
42
|
-
case ContextType.TYPE_CONTEXT_FUTURE_ID:
|
|
64
|
+
case ContextType.TYPE_CONTEXT_FUTURE_ID:
|
|
43
65
|
case OperatorType.TYPE_FUTURE_QUERY:
|
|
44
66
|
var identifer = arr.splice(0, 1);
|
|
67
|
+
let i = info.futrue_list.find(f => f.identifier == identifer[0]);
|
|
68
|
+
if (!i) {
|
|
69
|
+
ERROR(Errors.Fail, 'futrue_list not found');
|
|
70
|
+
}
|
|
45
71
|
if (type == OperatorType.TYPE_FUTURE_QUERY) {
|
|
72
|
+
info.query_list.push({ identifier: identifer[0], type: type, witness: i.witness }); // query list item
|
|
46
73
|
arr.splice(0, 1); // cmd
|
|
47
74
|
}
|
|
48
|
-
if (!variable || variable?.get(identifer[0])?.type != type)
|
|
49
|
-
return false;
|
|
50
|
-
let witness = Guard.get_variable_witness(variable, identifer[0], type);
|
|
51
|
-
if (!witness)
|
|
52
|
-
return false;
|
|
53
|
-
result.push({ guardid: guardid, identifier: identifer[0], type: type,
|
|
54
|
-
witness: '0x' + BCS_CONVERT.de(BCS.ADDRESS, Uint8Array.from(witness)) });
|
|
55
75
|
break;
|
|
56
76
|
case ContextType.TYPE_CONTEXT_address:
|
|
57
77
|
case ContextType.TYPE_CONTEXT_bool:
|
|
@@ -79,190 +99,79 @@ export class GuardParser {
|
|
|
79
99
|
arr.splice(0, value + length);
|
|
80
100
|
break;
|
|
81
101
|
case OperatorType.TYPE_QUERY:
|
|
102
|
+
info.query_list.push('0x' + Bcs.getInstance().de(BCS.ADDRESS, Uint8Array.from(arr)).toString());
|
|
82
103
|
arr.splice(0, 33); // address + cmd
|
|
83
104
|
break;
|
|
84
105
|
default:
|
|
85
|
-
|
|
86
|
-
console.log(type);
|
|
87
|
-
console.log(arr);
|
|
88
|
-
return false; // error
|
|
106
|
+
ERROR(Errors.Fail, 'parse_bcs types');
|
|
89
107
|
}
|
|
90
108
|
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
// 4. ops using passport(guard set on object)
|
|
100
|
-
// 5. ops using passport(guard set on object)
|
|
101
|
-
// 6. destroy passport
|
|
102
|
-
static guard_queries = async (protocol, guards, futures) => {
|
|
103
|
-
let sense_objects = guards.map((value) => {
|
|
104
|
-
let v = new Map();
|
|
105
|
-
futures?.forEach((f) => {
|
|
106
|
-
if (f.guardid == value) {
|
|
107
|
-
Guard.add_future_variable(v, f.identifier, f.type, f.witness.slice(0), f?.value ? f.value.slice(0) : undefined, true);
|
|
109
|
+
};
|
|
110
|
+
done = async (fill) => {
|
|
111
|
+
let objects = [];
|
|
112
|
+
this.guard_list.forEach((g) => {
|
|
113
|
+
g.futrue_list.forEach((f) => {
|
|
114
|
+
let r = fill?.find(i => i.identifier == f.identifier && g.id == i.guard);
|
|
115
|
+
if (!r && !f.futrue) {
|
|
116
|
+
ERROR(Errors.InvalidParam, 'fill');
|
|
108
117
|
}
|
|
118
|
+
if (r)
|
|
119
|
+
f.futrue = r.future;
|
|
120
|
+
objects.push(f.futrue);
|
|
109
121
|
});
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
sense_objects.forEach((value) => {
|
|
115
|
-
sense_objects_result = sense_objects_result.concat(value.data);
|
|
116
|
-
});
|
|
117
|
-
sense_objects_result = array_unique(sense_objects_result); // objects in guards
|
|
118
|
-
let queries = sense_objects_result.map((value) => {
|
|
119
|
-
return { objectid: value, callback: GuardParser.rpc_query_cmd_fn, data: [] };
|
|
120
|
-
});
|
|
121
|
-
await protocol.Query(queries, { 'showType': true }); // queries for passport verifing
|
|
122
|
-
let res = [];
|
|
123
|
-
sense_objects.forEach((guard) => {
|
|
124
|
-
res = res.concat(guard.data.map((object) => {
|
|
125
|
-
let data = queries.filter((v) => {
|
|
126
|
-
return v.objectid == object;
|
|
127
|
-
});
|
|
128
|
-
if (!data) {
|
|
129
|
-
console.error('error find data');
|
|
130
|
-
console.log(queries);
|
|
131
|
-
console.log(object);
|
|
132
|
-
return;
|
|
122
|
+
g.query_list = g.query_list.map((q) => {
|
|
123
|
+
if (typeof (q) === "string") {
|
|
124
|
+
objects.push(q);
|
|
125
|
+
return q;
|
|
133
126
|
}
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
};
|
|
139
|
-
// parse guard senses input bytes of a guard, return [objectids] for 'query_cmd'
|
|
140
|
-
static parse_sense_bsc(result, guardid, chain_sense_bsc, variable) {
|
|
141
|
-
var arr = [].slice.call(chain_sense_bsc.reverse());
|
|
142
|
-
while (arr.length > 0) {
|
|
143
|
-
var type = arr.shift();
|
|
144
|
-
// console.log(type);
|
|
145
|
-
switch (type) {
|
|
146
|
-
case ContextType.TYPE_CONTEXT_SIGNER:
|
|
147
|
-
case ContextType.TYPE_CONTEXT_CLOCK:
|
|
148
|
-
case OperatorType.TYPE_LOGIC_OPERATOR_U128_GREATER:
|
|
149
|
-
case OperatorType.TYPE_LOGIC_OPERATOR_U128_GREATER_EQUAL:
|
|
150
|
-
case OperatorType.TYPE_LOGIC_OPERATOR_U128_LESSER:
|
|
151
|
-
case OperatorType.TYPE_LOGIC_OPERATOR_U128_LESSER_EQUAL:
|
|
152
|
-
case OperatorType.TYPE_LOGIC_OPERATOR_U128_EQUAL:
|
|
153
|
-
case OperatorType.TYPE_LOGIC_OPERATOR_EQUAL:
|
|
154
|
-
case OperatorType.TYPE_LOGIC_OPERATOR_HAS_SUBSTRING:
|
|
155
|
-
case OperatorType.TYPE_LOGIC_ALWAYS_TRUE:
|
|
156
|
-
break;
|
|
157
|
-
case ContextType.TYPE_CONTEXT_FUTURE_ID: // MACHINE-ID
|
|
158
|
-
var v = arr.splice(0, 1);
|
|
159
|
-
if (!variable || variable?.get(v[0])?.type != type)
|
|
160
|
-
return false;
|
|
161
|
-
break;
|
|
162
|
-
case ContextType.TYPE_CONTEXT_address:
|
|
163
|
-
case ContextType.TYPE_CONTEXT_bool:
|
|
164
|
-
case ContextType.TYPE_CONTEXT_u8:
|
|
165
|
-
case ContextType.TYPE_CONTEXT_u64:
|
|
166
|
-
case ContextType.TYPE_CONTEXT_vec_u8:
|
|
167
|
-
arr.splice(0, 1); // identifier
|
|
168
|
-
break;
|
|
169
|
-
case ValueType.TYPE_STATIC_address:
|
|
170
|
-
//console.log('0x' + bcs.de(BCS.ADDRESS, Uint8Array.from(array)).toString());
|
|
171
|
-
arr.splice(0, 32);
|
|
172
|
-
break;
|
|
173
|
-
case ValueType.TYPE_STATIC_bool:
|
|
174
|
-
case ValueType.TYPE_STATIC_u8:
|
|
175
|
-
arr.splice(0, 1);
|
|
176
|
-
break;
|
|
177
|
-
case ValueType.TYPE_STATIC_u64:
|
|
178
|
-
arr.splice(0, 8);
|
|
179
|
-
break;
|
|
180
|
-
case ValueType.TYPE_STATIC_u128:
|
|
181
|
-
arr.splice(0, 16);
|
|
182
|
-
break;
|
|
183
|
-
case ValueType.TYPE_STATIC_vec_u8:
|
|
184
|
-
let { value, length } = ulebDecode(Uint8Array.from(arr));
|
|
185
|
-
arr.splice(0, value + length);
|
|
186
|
-
break;
|
|
187
|
-
case OperatorType.TYPE_QUERY:
|
|
188
|
-
result.push('0x' + BCS_CONVERT.de(BCS.ADDRESS, Uint8Array.from(arr)).toString());
|
|
189
|
-
arr.splice(0, 33); // address + cmd
|
|
190
|
-
break;
|
|
191
|
-
case OperatorType.TYPE_QUERY_FROM_CONTEXT:
|
|
192
|
-
case OperatorType.TYPE_FUTURE_QUERY:
|
|
193
|
-
var identifer = arr.splice(0, 1);
|
|
194
|
-
if (variable) {
|
|
195
|
-
let v = Guard.get_variable_value(variable, identifer[0], type);
|
|
196
|
-
if (v) {
|
|
197
|
-
result.push('0x' + BCS_CONVERT.de(BCS.ADDRESS, Uint8Array.from(v)).toString());
|
|
198
|
-
arr.splice(0, 1); // splice cmd
|
|
199
|
-
break;
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
;
|
|
203
|
-
return false;
|
|
204
|
-
default:
|
|
205
|
-
console.error('parse_sense_bsc:undefined');
|
|
206
|
-
console.log(type);
|
|
207
|
-
console.log(arr);
|
|
208
|
-
return false; // error
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
return true;
|
|
212
|
-
}
|
|
213
|
-
// callback to parse guard's object-queries into Guard_Query_Object[]
|
|
214
|
-
static rpc_sense_objects_fn = (response, param, option) => {
|
|
215
|
-
if (!response.error) {
|
|
216
|
-
let c = response?.data?.content;
|
|
217
|
-
let index = param.protocol.WOWOK_OBJECTS_TYPE().findIndex(v => v.includes('guard::Guard') && v == c.type);
|
|
218
|
-
if (index >= 0 && c.fields.id.id == param.objectid) { // GUARD OBJECT
|
|
219
|
-
if (!param?.variables) {
|
|
220
|
-
let v = new Map();
|
|
221
|
-
for (let i = 0; i < c.fields.variables.length; i++) {
|
|
222
|
-
let variable = c.fields.variables[i];
|
|
223
|
-
let bret;
|
|
224
|
-
if (variable.type == (param.protocol.WOWOK_OBJECTS_PREFIX_TYPE()[index] + 'Variable')) { // ...::guard::Variable
|
|
225
|
-
if (variable.fields.type == OperatorType.TYPE_FUTURE_QUERY || variable.fields.type == ContextType.TYPE_CONTEXT_FUTURE_ID) {
|
|
226
|
-
bret = Guard.add_future_variable(v, variable.fields.identifier, variable.fields.type, variable.fields?.value ? Uint8Array.from(variable.fields.value) : undefined, undefined, false);
|
|
227
|
-
}
|
|
228
|
-
else {
|
|
229
|
-
bret = Guard.add_variable(v, variable.fields.identifier, variable.fields.type, variable.fields?.value ? Uint8Array.from(variable.fields.value) : undefined, false);
|
|
230
|
-
}
|
|
231
|
-
if (!bret) {
|
|
232
|
-
console.log('rpc_sense_objects_fn add_variable error');
|
|
233
|
-
console.log(variable);
|
|
234
|
-
return;
|
|
235
|
-
}
|
|
236
|
-
}
|
|
127
|
+
else {
|
|
128
|
+
let r = g.futrue_list.find(f => f.identifier == q.identifier && f.type == q.type && f.witness == q.witness);
|
|
129
|
+
if (!r || !r.futrue) {
|
|
130
|
+
ERROR(Errors.Fail, 'query witness not match');
|
|
237
131
|
}
|
|
238
|
-
|
|
132
|
+
objects.push(r.futrue);
|
|
133
|
+
return r.futrue;
|
|
239
134
|
}
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
135
|
+
});
|
|
136
|
+
});
|
|
137
|
+
// objects info
|
|
138
|
+
let res = await this.protocol.Query_Raw(array_unique(objects), { showType: true });
|
|
139
|
+
let query = [];
|
|
140
|
+
let witness = [];
|
|
141
|
+
this.guard_list.forEach(g => {
|
|
142
|
+
g.query_list.forEach(q => {
|
|
143
|
+
let r = res.find(r => r.data?.objectId == q);
|
|
144
|
+
if (!r) {
|
|
145
|
+
ERROR(Errors.Fail, 'query object not match');
|
|
248
146
|
}
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
// construct Guard_Query_Object of wowok objects for passport verify
|
|
253
|
-
static rpc_query_cmd_fn = (response, param, option) => {
|
|
254
|
-
if (!response.error && response.data?.objectId == param.objectid && response.data?.type) {
|
|
255
|
-
for (let k = 0; k < param.protocol.WOWOK_OBJECTS_TYPE().length; k++) {
|
|
256
|
-
if (response?.data?.type.includes(param.protocol.WOWOK_OBJECTS_TYPE()[k])) { // type: pack::m::Object<...>
|
|
257
|
-
param.data = { target: param.protocol.WOWOK_OBJECTS_PREFIX_TYPE()[k] + 'guard_query',
|
|
258
|
-
object: Inputs.SharedObjectRef({
|
|
259
|
-
objectId: response.data.objectId,
|
|
260
|
-
mutable: false,
|
|
261
|
-
initialSharedVersion: response.data.version,
|
|
262
|
-
}),
|
|
263
|
-
types: parse_object_type(response?.data?.type),
|
|
264
|
-
id: param.objectid, };
|
|
147
|
+
let object = this.object_query(r.data);
|
|
148
|
+
if (!object) {
|
|
149
|
+
ERROR(Errors.Fail, 'object fail');
|
|
265
150
|
}
|
|
151
|
+
query.push(object);
|
|
152
|
+
});
|
|
153
|
+
g.futrue_list.forEach(f => {
|
|
154
|
+
let r = res.find(r => r.data?.objectId == f.futrue);
|
|
155
|
+
if (!r) {
|
|
156
|
+
ERROR(Errors.Fail, 'query future not match');
|
|
157
|
+
}
|
|
158
|
+
let object = this.object_query(r.data, 'witness');
|
|
159
|
+
witness.push(object);
|
|
160
|
+
});
|
|
161
|
+
});
|
|
162
|
+
return { query: query, witness: witness };
|
|
163
|
+
};
|
|
164
|
+
object_query = (data, method = 'guard_query') => {
|
|
165
|
+
for (let k = 0; k < this.protocol.WOWOK_OBJECTS_TYPE().length; k++) {
|
|
166
|
+
if (data.type.includes(this.protocol.WOWOK_OBJECTS_TYPE()[k])) { // type: pack::m::Object<...>
|
|
167
|
+
return { target: this.protocol.WOWOK_OBJECTS_PREFIX_TYPE()[k] + method,
|
|
168
|
+
object: Inputs.SharedObjectRef({
|
|
169
|
+
objectId: data.objectId,
|
|
170
|
+
mutable: false,
|
|
171
|
+
initialSharedVersion: data.version,
|
|
172
|
+
}),
|
|
173
|
+
types: parse_object_type(data.type),
|
|
174
|
+
id: data.objectId, };
|
|
266
175
|
}
|
|
267
176
|
}
|
|
268
177
|
};
|
|
@@ -273,7 +182,7 @@ export class Passport {
|
|
|
273
182
|
protocol;
|
|
274
183
|
get_object() { return this.passport; }
|
|
275
184
|
// return passport object used
|
|
276
|
-
constructor(protocol, guards,
|
|
185
|
+
constructor(protocol, guards, query) {
|
|
277
186
|
if (!guards || guards.length > Passport.MAX_GUARD_COUNT) {
|
|
278
187
|
ERROR(Errors.InvalidParam, 'guards');
|
|
279
188
|
}
|
|
@@ -282,7 +191,7 @@ export class Passport {
|
|
|
282
191
|
}
|
|
283
192
|
this.protocol = protocol;
|
|
284
193
|
let txb = protocol.CurrentSession();
|
|
285
|
-
|
|
194
|
+
this.passport = txb.moveCall({
|
|
286
195
|
target: protocol.PassportFn('new'),
|
|
287
196
|
arguments: []
|
|
288
197
|
});
|
|
@@ -290,31 +199,32 @@ export class Passport {
|
|
|
290
199
|
guards.forEach((guard) => {
|
|
291
200
|
txb.moveCall({
|
|
292
201
|
target: protocol.PassportFn('guard_add'),
|
|
293
|
-
arguments: [passport, Protocol.TXB_OBJECT(txb, guard)]
|
|
202
|
+
arguments: [this.passport, Protocol.TXB_OBJECT(txb, guard)]
|
|
294
203
|
});
|
|
295
204
|
});
|
|
296
|
-
|
|
205
|
+
// witness
|
|
206
|
+
query?.witness.forEach((w) => {
|
|
297
207
|
txb.moveCall({
|
|
298
|
-
target:
|
|
299
|
-
arguments: [passport, txb.
|
|
300
|
-
|
|
208
|
+
target: w.target,
|
|
209
|
+
arguments: [this.passport, txb.object(w.object)],
|
|
210
|
+
typeArguments: w.types,
|
|
301
211
|
});
|
|
302
212
|
});
|
|
303
213
|
// rules: 'verify' & 'query' in turns;'verify' at final end.
|
|
304
|
-
|
|
305
|
-
let
|
|
214
|
+
query?.query.forEach((q) => {
|
|
215
|
+
let [type, address] = txb.moveCall({
|
|
306
216
|
target: protocol.PassportFn('passport_verify'),
|
|
307
|
-
arguments: [passport, txb.object(Protocol.CLOCK_OBJECT)
|
|
217
|
+
arguments: [this.passport, txb.object(Protocol.CLOCK_OBJECT)]
|
|
308
218
|
});
|
|
309
219
|
txb.moveCall({
|
|
310
|
-
target:
|
|
311
|
-
arguments: [txb.object(
|
|
312
|
-
typeArguments:
|
|
220
|
+
target: q.target,
|
|
221
|
+
arguments: [txb.object(q.object), this.passport, type, address],
|
|
222
|
+
typeArguments: q.types,
|
|
313
223
|
});
|
|
314
|
-
}
|
|
315
|
-
|
|
224
|
+
});
|
|
225
|
+
txb.moveCall({
|
|
316
226
|
target: protocol.PassportFn('passport_verify'),
|
|
317
|
-
arguments: [passport, txb.object(Protocol.CLOCK_OBJECT)]
|
|
227
|
+
arguments: [this.passport, txb.object(Protocol.CLOCK_OBJECT)]
|
|
318
228
|
});
|
|
319
229
|
}
|
|
320
230
|
destroy() {
|
package/dist/permission.d.ts
CHANGED
|
@@ -7,6 +7,9 @@ export declare enum PermissionIndex {
|
|
|
7
7
|
repository_remove_policies = 104,
|
|
8
8
|
repository_set_policy_description = 105,
|
|
9
9
|
repository_set_policy_permission = 106,
|
|
10
|
+
repository_reference_add = 107,
|
|
11
|
+
repository_reference_remove = 108,
|
|
12
|
+
repository_reference_removeall = 108,
|
|
10
13
|
vote = 150,
|
|
11
14
|
vote_set_description = 151,
|
|
12
15
|
vote_set_reference = 152,
|
package/dist/permission.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"permission.d.ts","sourceRoot":"","sources":["../src/permission.ts"],"names":[],"mappings":"AACA,OAAO,EAAc,SAAS,EAAoB,iBAAiB,EAAE,WAAW,EAAE,QAAQ,EAAC,MAAM,YAAY,CAAC;AAI9G,oBAAY,eAAe;IACvB,UAAU,MAAM;IAChB,8BAA8B,MAAM;IACpC,0BAA0B,MAAM;IAChC,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OAAO;IAIP,MAAM,CAAC,IAAI,CAAC,QAAQ,EAAC,QAAQ,EAAE,MAAM,EAAC,SAAS,GAAI,UAAU;IAM7D,MAAM,CAAC,GAAG,CAAC,QAAQ,EAAC,QAAQ,EAAE,WAAW,EAAC,MAAM,GAAI,UAAU;IAe9D,MAAM,IAAK,iBAAiB;IAO5B,OAAO;IAQP,UAAU,CAAC,QAAQ,EAAC,iBAAiB,EAAE;IAwDvC,SAAS,CAAC,cAAc,EAAC,MAAM,EAAE,KAAK,EAAC,mBAAmB,EAAE,KAAK,CAAC,EAAC,WAAW;IAyB9E,YAAY,CAAC,cAAc,EAAC,MAAM,EAAE,KAAK,EAAC,mBAAmB,EAAE;IAe/D,aAAa,CAAC,cAAc,EAAC,MAAM,EAAE;IAYrC,eAAe,CAAC,WAAW,EAAC,MAAM;IAYlC,SAAS,CAAC,KAAK,EAAC,MAAM,EAAE;IAaxB,YAAY,CAAC,KAAK,CAAC,EAAC,MAAM,EAAE,EAAE,SAAS,CAAC,EAAC,OAAO;IAwBhD,YAAY,CAAC,SAAS,EAAC,MAAM;IAY7B,MAAM,CAAC,eAAe,SAAM;IAC5B,MAAM,CAAC,gBAAgB,SAAQ;IAC/B,MAAM,CAAC,0BAA0B,SAAO;IACxC,MAAM,CAAC,uBAAuB,UAAU,MAAM,aAE7C;IAED,MAAM,CAAC,sBAAsB,UAAU,mBAAmB,KAAI,OAAO,CAOpE;CACJ"}
|
package/dist/permission.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BCS } from '@mysten/bcs';
|
|
2
2
|
import { Protocol } from './protocol';
|
|
3
|
-
import { array_unique, IsValidAddress, IsValidArray, IsValidDesription, IsValidUint,
|
|
3
|
+
import { array_unique, IsValidAddress, IsValidArray, IsValidDesription, IsValidUint, Bcs } from './utils';
|
|
4
4
|
import { ERROR, Errors } from './exception';
|
|
5
5
|
export var PermissionIndex;
|
|
6
6
|
(function (PermissionIndex) {
|
|
@@ -11,6 +11,9 @@ export var PermissionIndex;
|
|
|
11
11
|
PermissionIndex[PermissionIndex["repository_remove_policies"] = 104] = "repository_remove_policies";
|
|
12
12
|
PermissionIndex[PermissionIndex["repository_set_policy_description"] = 105] = "repository_set_policy_description";
|
|
13
13
|
PermissionIndex[PermissionIndex["repository_set_policy_permission"] = 106] = "repository_set_policy_permission";
|
|
14
|
+
PermissionIndex[PermissionIndex["repository_reference_add"] = 107] = "repository_reference_add";
|
|
15
|
+
PermissionIndex[PermissionIndex["repository_reference_remove"] = 108] = "repository_reference_remove";
|
|
16
|
+
PermissionIndex[PermissionIndex["repository_reference_removeall"] = 108] = "repository_reference_removeall";
|
|
14
17
|
PermissionIndex[PermissionIndex["vote"] = 150] = "vote";
|
|
15
18
|
PermissionIndex[PermissionIndex["vote_set_description"] = 151] = "vote_set_description";
|
|
16
19
|
PermissionIndex[PermissionIndex["vote_set_reference"] = 152] = "vote_set_reference";
|
|
@@ -208,7 +211,7 @@ export class Permission {
|
|
|
208
211
|
txb.moveCall({
|
|
209
212
|
target: this.protocol.PermissionFn('remove_index'),
|
|
210
213
|
arguments: [Protocol.TXB_OBJECT(txb, this.object), txb.pure(entity_address, BCS.ADDRESS),
|
|
211
|
-
txb.pure(
|
|
214
|
+
txb.pure(Bcs.getInstance().ser_vector_u64(array_unique(index)))]
|
|
212
215
|
});
|
|
213
216
|
}
|
|
214
217
|
remove_entity(entity_address) {
|
package/dist/progress.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BCS } from '@mysten/bcs';
|
|
2
2
|
import { Protocol } from './protocol';
|
|
3
|
-
import {
|
|
3
|
+
import { Bcs, array_unique, IsValidName, IsValidAddress, IsValidArray, OptionNone, IsValidInt } from './utils';
|
|
4
4
|
import { ERROR, Errors } from './exception';
|
|
5
5
|
export class Progress {
|
|
6
6
|
permission;
|
|
@@ -224,8 +224,8 @@ export class Progress {
|
|
|
224
224
|
ERROR(Errors.IsValidAddress, 'sub_id');
|
|
225
225
|
}
|
|
226
226
|
let txb = this.protocol.CurrentSession();
|
|
227
|
-
let diliverable = deliverables_address ? txb.pure(
|
|
228
|
-
let sub = sub_id ? txb.pure(
|
|
227
|
+
let diliverable = deliverables_address ? txb.pure(Bcs.getInstance().ser_option_address(deliverables_address)) : OptionNone(txb);
|
|
228
|
+
let sub = sub_id ? txb.pure(Bcs.getInstance().ser_option_address(sub_id)) : OptionNone(txb);
|
|
229
229
|
if (passport) {
|
|
230
230
|
txb.moveCall({
|
|
231
231
|
target: this.protocol.ProgressFn('next_with_passport'),
|