wowok 1.1.2 → 1.1.3

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 CHANGED
@@ -4,7 +4,8 @@
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
+ Examples: [https://github.com/wowok-ai/sdk-examples](https://github.com/wowok-ai/sdk-examples)
8
+ Docs: [https://github.com/wowok-ai/sdk/wiki](https://github.com/wowok-ai/sdk/wiki)
8
9
 
9
10
  ### Installation
10
11
 
@@ -12,7 +13,7 @@ Examples: [https://github.com/wowok-ai/sdk-examples](https://github.com/wowok-ai
12
13
  $ npm i wowok
13
14
  ```
14
15
 
15
- ### Documentation
16
16
 
17
17
 
18
18
 
19
+
@@ -14,7 +14,8 @@ export declare enum Errors {
14
14
  InvalidParam = "invalid parameter",
15
15
  IsValidPermissionIndex = "invalid permission index",
16
16
  IsValidKey = "invalid key",
17
- Fail = "fail"
17
+ Fail = "fail",
18
+ IsValidIndentifier = "indentifier invalid"
18
19
  }
19
20
  export declare const ERROR: (error: Errors, info?: any) => never;
20
21
  //# sourceMappingURL=exception.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"exception.d.ts","sourceRoot":"","sources":["../src/exception.ts"],"names":[],"mappings":"AACA,oBAAY,MAAM;IACd,iBAAiB,wBAAwB;IACzC,WAAW,iBAAiB;IAC5B,sBAAsB,iBAAiB;IACvC,eAAe,qBAAqB;IACpC,cAAc,oBAAoB;IAClC,cAAc,yBAAyB;IACvC,WAAW,iBAAiB;IAC5B,UAAU,gBAAgB;IAC1B,cAAc,oBAAoB;IAClC,YAAY,kBAAkB;IAC9B,cAAc,oBAAoB;IAClC,UAAU,uBAAuB;IACjC,YAAY,sBAAuB;IACnC,sBAAsB,6BAA6B;IACnD,UAAU,gBAAgB;IAC1B,IAAI,SAAS;CAChB;AAED,eAAO,MAAM,KAAK,UAAU,MAAM,SAAQ,GAAG,UAG5C,CAAA"}
1
+ {"version":3,"file":"exception.d.ts","sourceRoot":"","sources":["../src/exception.ts"],"names":[],"mappings":"AACA,oBAAY,MAAM;IACd,iBAAiB,wBAAwB;IACzC,WAAW,iBAAiB;IAC5B,sBAAsB,iBAAiB;IACvC,eAAe,qBAAqB;IACpC,cAAc,oBAAoB;IAClC,cAAc,yBAAyB;IACvC,WAAW,iBAAiB;IAC5B,UAAU,gBAAgB;IAC1B,cAAc,oBAAoB;IAClC,YAAY,kBAAkB;IAC9B,cAAc,oBAAoB;IAClC,UAAU,uBAAuB;IACjC,YAAY,sBAAuB;IACnC,sBAAsB,6BAA6B;IACnD,UAAU,gBAAgB;IAC1B,IAAI,SAAS;IACb,kBAAkB,wBAAwB;CAC7C;AAED,eAAO,MAAM,KAAK,UAAU,MAAM,SAAQ,GAAG,UAG5C,CAAA"}
package/dist/exception.js CHANGED
@@ -16,6 +16,7 @@ export var Errors;
16
16
  Errors["IsValidPermissionIndex"] = "invalid permission index";
17
17
  Errors["IsValidKey"] = "invalid key";
18
18
  Errors["Fail"] = "fail";
19
+ Errors["IsValidIndentifier"] = "indentifier invalid";
19
20
  })(Errors || (Errors = {}));
20
21
  export const ERROR = (error, info) => {
21
22
  const e = error + info ? (': ' + info) : '';
package/dist/guard.d.ts CHANGED
@@ -1,42 +1,42 @@
1
- import { Protocol, GuardAddress, Data_Type, MODULES, ContextType, ValueType, OperatorType } from './protocol';
2
- export type VariableType = Map<number, Guard_Vriable>;
1
+ import { Protocol, GuardAddress, Data_Type, MODULES, ContextType, ValueType, OperatorType, VariableType } from './protocol';
2
+ export type GuardVariable = Map<number, Guard_Vriable>;
3
3
  export interface Guard_Vriable {
4
- type: ContextType | OperatorType;
4
+ type: VariableType;
5
5
  value?: Uint8Array;
6
6
  witness?: Uint8Array;
7
7
  }
8
- export type Guard_Creation = {
9
- description: string;
10
- variables?: VariableType;
11
- input: Uint8Array;
12
- };
13
8
  export declare class Guard {
14
9
  static MAX_INPUT_LENGTH: number;
15
- static launch(protocol: Protocol, creation: Guard_Creation): GuardAddress;
10
+ static launch(protocol: Protocol, description: string, maker: GuardMaker): GuardAddress;
16
11
  static signer_guard(protocol: Protocol): GuardAddress;
17
12
  static everyone_guard(protocol: Protocol): GuardAddress;
18
13
  static QUERIES: any[];
19
14
  }
20
- export declare class GuardVariableMaker {
21
- static IsValidGuardVirableType: (type: OperatorType | ContextType) => boolean;
15
+ export declare class GuardVariableHelper {
22
16
  static IsValidIndentifier: (identifier: number) => boolean;
23
- static get_variable_value(variables: VariableType, identifier: number, type: OperatorType | ContextType): Uint8Array | boolean;
24
- static get_variable_witness(variables: VariableType, identifier: number, type: OperatorType | ContextType): Uint8Array | boolean;
25
- static add_future_variable(variables: VariableType, identifier: number, type: OperatorType | ContextType, witness: any, value?: any, bNeedSerialize?: boolean): boolean;
26
- static add_variable(variables: VariableType, identifier: number, type: OperatorType | ContextType, value: any, bNeedSerialize?: boolean): boolean;
17
+ static get_variable_value(variables: GuardVariable, identifier: number, type: VariableType): Uint8Array | undefined;
18
+ static get_variable_witness(variables: GuardVariable, identifier: number): Uint8Array | undefined;
19
+ static add_future_variable(variables: GuardVariable, identifier: number, witness: any, value?: any, bNeedSerialize?: boolean): void;
20
+ static add_variable(variables: GuardVariable, identifier: number, type: ValueType, value: any, bNeedSerialize?: boolean): false | undefined;
27
21
  }
28
- export declare class GuardInputMaker {
22
+ export declare class GuardMaker {
29
23
  protected data: Uint8Array[];
30
24
  protected type_validator: Data_Type[];
25
+ protected variable: GuardVariable;
26
+ private static index;
27
+ private static get_index;
31
28
  constructor();
32
- add_param(type: ValueType | ContextType, param?: any, variable?: VariableType): void;
33
- static query_index(module: MODULES, query_name: string): number;
34
- add_future_query(identifier: number, module: MODULES, query_name: string, variable: VariableType): void;
35
- add_query(module: MODULES, query_name: string, object_address_from: string | number): void;
36
- add_logic(type: OperatorType): void;
37
- make(bNot?: boolean): Uint8Array;
38
- static combine(input1: Uint8Array, input2: Uint8Array, bAnd?: boolean): Uint8Array;
39
- static not(input: Uint8Array): Uint8Array;
29
+ add_variable(type: VariableType, value: any, bNeedSerialize?: boolean): number;
30
+ add_param(type: ValueType | ContextType, param?: any): GuardMaker;
31
+ add_query(module: MODULES, query_name: string, object_address_from: string | number, bWitness?: boolean): GuardMaker;
32
+ add_logic(type: OperatorType): GuardMaker;
33
+ build(bNot?: boolean): GuardMaker;
34
+ IsReady(): boolean;
35
+ combine(otherBuilt: GuardMaker, bAnd?: boolean, bCombinVariable?: boolean): GuardMaker;
36
+ get_variable(): GuardVariable;
37
+ get_input(): Uint8Array[];
38
+ static input_combine(input1: Uint8Array, input2: Uint8Array, bAnd?: boolean): Uint8Array;
39
+ static input_not(input: Uint8Array): Uint8Array;
40
40
  static match_u128(type: number): boolean;
41
41
  }
42
42
  //# sourceMappingURL=guard.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"guard.d.ts","sourceRoot":"","sources":["../src/guard.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAc,SAAS,EAAE,OAAO,EAAE,WAAW,EAAE,SAAS,EAAG,YAAY,EAAC,MAAM,YAAY,CAAC;AAK1H,MAAM,MAAM,YAAY,GAAG,GAAG,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;AAEtD,MAAM,WAAW,aAAa;IAC1B,IAAI,EAAE,WAAW,GAAG,YAAY,CAAC;IACjC,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,OAAO,CAAC,EAAE,UAAU,CAAC;CACxB;AAED,MAAM,MAAM,cAAc,GAAG;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,YAAY,CAAC;IACzB,KAAK,EAAE,UAAU,CAAC;CACrB,CAAA;AAED,qBAAa,KAAK;IACd,MAAM,CAAC,gBAAgB,SAAQ;IAC/B,MAAM,C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