wowok_agent 0.1.13 → 0.1.14

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wowok_agent",
3
- "version": "0.1.13",
3
+ "version": "0.1.14",
4
4
  "description": "Create, collaborate, and transact on your own terms with the AI-driven web3 collaboration protocol.",
5
5
  "main": "./src/index.ts",
6
6
  "types": "./src/index.ts",
package/src/account.ts CHANGED
@@ -49,12 +49,11 @@ export class Account {
49
49
  }
50
50
  data.push({name:name, key:key, default:bDefault})
51
51
  }
52
- } else {
53
- data = [{name:name, key:key, default:bDefault}];
52
+ return data
54
53
  }
55
- return data
56
54
  }
57
- } catch(e) { console.log(e) }
55
+ } catch(e) { /*console.log(e)*/ }
56
+ return [{name:name, key:key, default:bDefault}]
58
57
  }
59
58
 
60
59
  private _default(buffer:string | null | undefined) : AccountData | undefined {
@@ -69,7 +68,7 @@ export class Account {
69
68
  }
70
69
  }
71
70
  }
72
- } catch(e) { console.log(e) }
71
+ } catch(e) { /*console.log(e)*/ }
73
72
  }
74
73
  private _get(buffer:string | null | undefined, name?:string, bNotFoundReturnDefault?:boolean) : AccountData | undefined {
75
74
  var data : AccountData[] | undefined;
@@ -86,7 +85,7 @@ export class Account {
86
85
  }
87
86
  }
88
87
  }
89
- } catch(e) { console.log(e) }
88
+ } catch(e) { /*console.log(e)*/ }
90
89
  }
91
90
  private _rename(buffer:string | null | undefined, oldName:string, newName:string, bSwapIfExisted:boolean=true) : AccountData[] | undefined {
92
91
  var data : AccountData[] | undefined;
@@ -111,7 +110,7 @@ export class Account {
111
110
  return data;
112
111
  }
113
112
  }
114
- } catch(e) { console.log(e) }
113
+ } catch(e) { /*console.log(e)*/ }
115
114
  }
116
115
 
117
116
  set_storage(storage: 'File' | 'Explorer' = 'File') {
@@ -130,7 +129,7 @@ export class Account {
130
129
  const data = this._add(localStorage.getItem(Account_Key), name, bDefault);
131
130
  localStorage.setItem(Account_Key, JSON.stringify(data))
132
131
  }
133
- } catch (e) { console.log(e) }
132
+ } catch (e) { /*console.log(e)*/ }
134
133
  }
135
134
  default() : AccountData | undefined {
136
135
  try {
@@ -140,7 +139,7 @@ export class Account {
140
139
  } else if (this.storage === 'Explorer') {
141
140
  return this._default(localStorage.getItem(Account_Key));
142
141
  }
143
- } catch (e) { console.log(e) }
142
+ } catch (e) { /*console.log(e)*/ }
144
143
  }
145
144
  get(name?: string, bNotFoundReturnDefault:boolean=true) : AccountData | undefined {
146
145
  try {
@@ -150,7 +149,7 @@ export class Account {
150
149
  } else if (this.storage === 'Explorer') {
151
150
  return this._get(localStorage.getItem(Account_Key), name, bNotFoundReturnDefault);
152
151
  }
153
- } catch (e) { console.log(e) }
152
+ } catch (e) { /*console.log(e)*/ }
154
153
  }
155
154
  rename(oldName:string, newName:string, bSwapIfExisted:boolean=true) : boolean {
156
155
  var res : AccountData[] | undefined;
@@ -163,7 +162,7 @@ export class Account {
163
162
  res = this._rename(localStorage.getItem(Account_Key), oldName, newName, bSwapIfExisted);
164
163
  if (res) localStorage.setItem(Account_Key, JSON.stringify(res));
165
164
  }
166
- } catch (e) { console.log(e) }
165
+ } catch (e) { /*console.log(e)*/ }
167
166
  return res ? true : false
168
167
  }
169
168
 
@@ -200,16 +199,15 @@ export class Account {
200
199
  return {name:v.name, default:v?.default, address:Ed25519Keypair.fromSecretKey(fromHEX(v.key)).getPublicKey().toSuiAddress()}
201
200
  })
202
201
  }
203
- } catch (e) { console.log(e) }
202
+ } catch (e) { /*console.log(e)*/ }
204
203
  return []
205
204
  }
206
205
 
207
- faucet(name?:string) {
206
+ async faucet(name?:string) {
208
207
  const address = this.get_address(name, true);
209
208
  if (address) {
210
- requestSuiFromFaucetV0({host:getFaucetHost('testnet'), recipient:address}).catch(e => {
211
- console.log(e)
212
- requestSuiFromFaucetV1({host:getFaucetHost('testnet'), recipient:address}).catch(e => console.log(e));
209
+ await requestSuiFromFaucetV0({host:getFaucetHost('testnet'), recipient:address}).catch(e => {
210
+ //console.log(e)
213
211
  })
214
212
  }
215
213
  }
@@ -4,6 +4,7 @@ import { TransactionBlock, IsValidArgType, PassportObject, IsValidAddress, Error
4
4
  import { query_objects, ObjectArbitration, } from '../objects';
5
5
  import { CallBase, CallResult, Namedbject} from "./base";
6
6
 
7
+ /// The execution priority is determined by the order in which the object attributes are arranged
7
8
  export interface CallArbitration_Data {
8
9
  type_parameter: string;
9
10
  object?: {address:string} | {namedNew: Namedbject}; // undefined or {named_new...} for creating a new object
package/src/call/base.ts CHANGED
@@ -71,7 +71,7 @@ export class CallBase {
71
71
  return await this.sign_and_commit(txb, param.account);
72
72
  }
73
73
  } else {
74
- ERROR(Errors.Fail, 'guard finish_passport')
74
+ ERROR(Errors.Fail, 'guard verify')
75
75
  }
76
76
  }
77
77
  }
package/src/call/guard.ts CHANGED
@@ -22,8 +22,7 @@ export type GuardNode = { identifier: number; } // Data from GuardConst
22
22
  | {logic: OperatorType.TYPE_LOGIC_AS_U256_GREATER | OperatorType.TYPE_LOGIC_AS_U256_GREATER_EQUAL
23
23
  | OperatorType.TYPE_LOGIC_AS_U256_LESSER | OperatorType.TYPE_LOGIC_AS_U256_LESSER_EQUAL
24
24
  | OperatorType.TYPE_LOGIC_AS_U256_EQUAL | OperatorType.TYPE_LOGIC_EQUAL | OperatorType.TYPE_LOGIC_HAS_SUBSTRING
25
- | OperatorType.TYPE_LOGIC_ALWAYS_TRUE | OperatorType.TYPE_LOGIC_NOT
26
- | OperatorType.TYPE_LOGIC_AND | OperatorType.TYPE_LOGIC_OR; parameters: GuardNode[];}
25
+ | OperatorType.TYPE_LOGIC_NOT | OperatorType.TYPE_LOGIC_AND | OperatorType.TYPE_LOGIC_OR; parameters: GuardNode[];}
27
26
  | {calc: OperatorType.TYPE_NUMBER_ADD | OperatorType.TYPE_NUMBER_DEVIDE | OperatorType.TYPE_NUMBER_MOD
28
27
  | OperatorType.TYPE_NUMBER_MULTIPLY | OperatorType.TYPE_NUMBER_SUBTRACT; parameters: GuardNode[];}
29
28
  | {value_type: ValueType; value:any; } // Data
@@ -149,10 +148,6 @@ const buildNode = (guard_node:GuardNode, type_required:ValueType | 'number' | 'v
149
148
  } else if (node?.logic !== undefined) {
150
149
  checkType(ValueType.TYPE_BOOL, type_required, node); // bool
151
150
  switch (node?.logic) {
152
- case OperatorType.TYPE_LOGIC_ALWAYS_TRUE:
153
- if (node.parameters.length !== 0) ERROR(Errors.InvalidParam, 'node logic parameters length must be 0'+ JSON.stringify(node));
154
- output.push(Bcs.getInstance().ser(ValueType.TYPE_U8, node.logic)); // TYPE
155
- break;
156
151
  case OperatorType.TYPE_LOGIC_AND:
157
152
  case OperatorType.TYPE_LOGIC_OR:
158
153
  if (node.parameters.length < 2) ERROR(Errors.InvalidParam, 'node logic parameters length must >= 2'+ JSON.stringify(node));