wowok 1.0.8 → 1.0.9
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 +2 -1
- package/dist/guard.js +5 -4
- package/dist/passport.js +8 -6
- package/dist/permission.js +4 -4
- package/dist/protocol.js +1 -1
- package/package.json +1 -1
- package/src/permission.ts +4 -4
package/README.md
CHANGED
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
|
|
4
4
|
AI-oriented web3 collaboration protocol, driving innovaion and making it more likely to happen.
|
|
5
5
|
|
|
6
|
-
[
|
|
6
|
+
Github: [https://github.com/wowok-ai/sdk](https://github.com/wowok-ai/sdk)
|
|
7
|
+
Examples: [https://github.com/wowok-ai/sdk-examples](https://github.com/wowok-ai/sdk-examples)
|
|
7
8
|
|
|
8
9
|
### Installation
|
|
9
10
|
|
package/dist/guard.js
CHANGED
|
@@ -513,7 +513,7 @@ class SenseMaker {
|
|
|
513
513
|
//console.log(this.type_validator);
|
|
514
514
|
//this.data.forEach((value:Uint8Array) => console.log(value));
|
|
515
515
|
if (this.type_validator.length != 1 || this.type_validator[0] != protocol_1.ValueType.TYPE_STATIC_bool) {
|
|
516
|
-
|
|
516
|
+
console.log(this.type_validator);
|
|
517
517
|
return false;
|
|
518
518
|
} // ERROR
|
|
519
519
|
let input = (0, utils_1.concatenate)(Uint8Array, ...this.data);
|
|
@@ -566,7 +566,8 @@ function parse_futures(result, guardid, chain_sense_bsc, variable) {
|
|
|
566
566
|
let witness = get_variable_witness(variable, identifer[0], type);
|
|
567
567
|
if (!witness)
|
|
568
568
|
return false;
|
|
569
|
-
result.push({ guardid: guardid, identifier: identifer[0], type: type,
|
|
569
|
+
result.push({ guardid: guardid, identifier: identifer[0], type: type,
|
|
570
|
+
witness: '0x' + utils_2.BCS_CONVERT.de(bcs_1.BCS.ADDRESS, Uint8Array.from(witness)) });
|
|
570
571
|
break;
|
|
571
572
|
case protocol_1.ContextType.TYPE_CONTEXT_address:
|
|
572
573
|
case protocol_1.ContextType.TYPE_CONTEXT_bool:
|
|
@@ -704,10 +705,10 @@ const rpc_sense_objects_fn = (response, param, option) => {
|
|
|
704
705
|
let bret;
|
|
705
706
|
if (variable.type == ((0, protocol_1.OBJECTS_TYPE_PREFIX)()[index] + 'Variable')) { // ...::guard::Variable
|
|
706
707
|
if (variable.fields.type == protocol_1.OperatorType.TYPE_FUTURE_QUERY || variable.fields.type == protocol_1.ContextType.TYPE_CONTEXT_FUTURE_ID) {
|
|
707
|
-
bret = add_future_variable(v, variable.fields.identifier, variable.fields.type, variable.fields?.value, undefined, false);
|
|
708
|
+
bret = add_future_variable(v, variable.fields.identifier, variable.fields.type, variable.fields?.value ? Uint8Array.from(variable.fields.value) : undefined, undefined, false);
|
|
708
709
|
}
|
|
709
710
|
else {
|
|
710
|
-
bret = add_variable(v, variable.fields.identifier, variable.fields.type, variable.fields?.value, false);
|
|
711
|
+
bret = add_variable(v, variable.fields.identifier, variable.fields.type, variable.fields?.value ? Uint8Array.from(variable.fields.value) : undefined, false);
|
|
711
712
|
}
|
|
712
713
|
if (!bret) {
|
|
713
714
|
console.log('rpc_sense_objects_fn add_variable error');
|
package/dist/passport.js
CHANGED
|
@@ -13,10 +13,13 @@ const guard_futures = async (guards) => {
|
|
|
13
13
|
});
|
|
14
14
|
await protocol_1.PROTOCOL.Query(futrue_objects); // future objects
|
|
15
15
|
let future_objects_result = [];
|
|
16
|
-
futrue_objects.forEach((
|
|
17
|
-
|
|
16
|
+
futrue_objects.forEach((futrue) => {
|
|
17
|
+
futrue.data.forEach((f) => {
|
|
18
|
+
if (future_objects_result.findIndex((v) => { return v.guardid == f.guardid && v.identifier == f.identifier; }) == -1) {
|
|
19
|
+
future_objects_result.push(f);
|
|
20
|
+
}
|
|
21
|
+
});
|
|
18
22
|
});
|
|
19
|
-
future_objects_result = (0, utils_1.array_unique)(future_objects_result); // objects in guards
|
|
20
23
|
return future_objects_result;
|
|
21
24
|
};
|
|
22
25
|
exports.guard_futures = guard_futures;
|
|
@@ -34,7 +37,7 @@ const guard_queries = async (guards, futures) => {
|
|
|
34
37
|
let v = new Map();
|
|
35
38
|
futures?.forEach((f) => {
|
|
36
39
|
if (f.guardid == value) {
|
|
37
|
-
(0, guard_1.add_future_variable)(v, f.identifier, f.type, f.witness, f?.value,
|
|
40
|
+
(0, guard_1.add_future_variable)(v, f.identifier, f.type, f.witness.slice(0), f?.value ? f.value.slice(0) : undefined, true);
|
|
38
41
|
}
|
|
39
42
|
});
|
|
40
43
|
return { objectid: value, callback: guard_1.rpc_sense_objects_fn, parser: guard_1.parse_sense_bsc, data: [], variables: futures ? v : undefined };
|
|
@@ -85,11 +88,10 @@ function verify(txb, guards, guard_queries, future_values) {
|
|
|
85
88
|
});
|
|
86
89
|
});
|
|
87
90
|
future_values?.forEach((v) => {
|
|
88
|
-
console.log(v.value);
|
|
89
91
|
txb.moveCall({
|
|
90
92
|
target: protocol_1.PROTOCOL.PassportFn('future_set'),
|
|
91
93
|
arguments: [passport, txb.pure(utils_1.BCS_CONVERT.ser_address(v.guardid)), txb.pure(utils_1.BCS_CONVERT.ser_u8(v.identifier)),
|
|
92
|
-
txb.pure(
|
|
94
|
+
txb.pure(utils_1.BCS_CONVERT.ser_address(v.value))]
|
|
93
95
|
});
|
|
94
96
|
});
|
|
95
97
|
// rules: 'verify' & 'query' in turns;'verify' at final end.
|
package/dist/permission.js
CHANGED
|
@@ -12,10 +12,10 @@ var PermissionIndex;
|
|
|
12
12
|
PermissionIndex[PermissionIndex["repository"] = 100] = "repository";
|
|
13
13
|
PermissionIndex[PermissionIndex["repository_set_description_set"] = 101] = "repository_set_description_set";
|
|
14
14
|
PermissionIndex[PermissionIndex["repository_set_policy_mode"] = 102] = "repository_set_policy_mode";
|
|
15
|
-
PermissionIndex[PermissionIndex["repository_add_policies"] =
|
|
16
|
-
PermissionIndex[PermissionIndex["repository_remove_policies"] =
|
|
17
|
-
PermissionIndex[PermissionIndex["repository_set_policy_description"] =
|
|
18
|
-
PermissionIndex[PermissionIndex["repository_set_policy_permission"] =
|
|
15
|
+
PermissionIndex[PermissionIndex["repository_add_policies"] = 103] = "repository_add_policies";
|
|
16
|
+
PermissionIndex[PermissionIndex["repository_remove_policies"] = 104] = "repository_remove_policies";
|
|
17
|
+
PermissionIndex[PermissionIndex["repository_set_policy_description"] = 105] = "repository_set_policy_description";
|
|
18
|
+
PermissionIndex[PermissionIndex["repository_set_policy_permission"] = 106] = "repository_set_policy_permission";
|
|
19
19
|
PermissionIndex[PermissionIndex["vote"] = 150] = "vote";
|
|
20
20
|
PermissionIndex[PermissionIndex["vote_set_description"] = 151] = "vote_set_description";
|
|
21
21
|
PermissionIndex[PermissionIndex["vote_set_reference"] = 152] = "vote_set_reference";
|
package/dist/protocol.js
CHANGED
|
@@ -162,7 +162,7 @@ class Protocol {
|
|
|
162
162
|
case ENTRYPOINT.devnet:
|
|
163
163
|
break;
|
|
164
164
|
case ENTRYPOINT.testnet:
|
|
165
|
-
this.package = "
|
|
165
|
+
this.package = "0xf4233055f40a9f301c85c020496b58ad761fdd2cd6a5d82da7a912adb4608f7f";
|
|
166
166
|
this.everyone_guard = "0x78a41fcc4f566360839613f6b917fb101ae015e56b43143f496f265b6422fddc";
|
|
167
167
|
this.graphql = 'https://sui-testnet.mystenlabs.com/graphql';
|
|
168
168
|
break;
|
package/package.json
CHANGED
package/src/permission.ts
CHANGED
|
@@ -13,10 +13,10 @@ export enum PermissionIndex {
|
|
|
13
13
|
repository = 100,
|
|
14
14
|
repository_set_description_set = 101,
|
|
15
15
|
repository_set_policy_mode = 102,
|
|
16
|
-
repository_add_policies =
|
|
17
|
-
repository_remove_policies =
|
|
18
|
-
repository_set_policy_description =
|
|
19
|
-
repository_set_policy_permission =
|
|
16
|
+
repository_add_policies = 103,
|
|
17
|
+
repository_remove_policies = 104,
|
|
18
|
+
repository_set_policy_description = 105,
|
|
19
|
+
repository_set_policy_permission = 106,
|
|
20
20
|
vote = 150,
|
|
21
21
|
vote_set_description = 151,
|
|
22
22
|
vote_set_reference = 152,
|