wowok_agent 0.1.6 → 0.1.7

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.6",
3
+ "version": "0.1.7",
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/cache.ts CHANGED
@@ -19,16 +19,15 @@ export abstract class CacheData {
19
19
 
20
20
  export enum CacheName {
21
21
  object = 'OBJECT',
22
- resource = 'RESOURCE',
22
+ personal = 'PERSONAL',
23
+ table = 'TABLE'
23
24
  }
24
25
 
25
- export const OBJECT_KEY = (object_address: string) : string => {
26
- return object_address + Protocol.Instance().package('wowok_origin') + CacheName.object + '-V2';
27
- }
28
- export const PERSONAL_RESOURCE_KEY = (person_address: string) : string => {
29
- return person_address + Protocol.Instance().package('wowok_origin') + CacheName.resource + '-V2';
26
+ export const OBJECT_KEY = (object_address: string, name:CacheName) : string => {
27
+ return object_address + Protocol.Instance().package('wowok_origin') + name + '-V2';
30
28
  }
31
29
 
30
+
32
31
  export interface PersonalResouceCache {
33
32
  address: string;
34
33
  resource: string;
@@ -1,13 +1,13 @@
1
- import { TransactionBlock, CallResponse, IsValidArgType, TransactionResult} from 'wowok';
1
+ import { TransactionBlock, IsValidArgType, } from 'wowok';
2
2
  import { PassportObject, IsValidAddress, Errors, ERROR, Permission, PermissionIndex, PermissionIndexType, Treasury,
3
3
  Arbitration, Dispute, Feedback, Vote, VotingGuard, WithdrawFee, WitnessFill
4
4
  } from 'wowok';
5
5
  import { query_objects, ObjectArbitration, } from '../objects';
6
- import { CallBase, CallResult, AddressMark } from "./base";
6
+ import { CallBase, CallResult, AddressMark, Namedbject} from "./base";
7
7
 
8
8
  export interface CallArbitration_Data {
9
- object?: string; // undefined for creating a new object
10
- permission?: string;
9
+ object?: {address:string} | {namedNew: Namedbject}; // undefined or {named_new...} for creating a new object
10
+ permission?: {address:string} | {namedNew: Namedbject, description?:string};
11
11
  mark?:AddressMark;
12
12
  type_parameter?: string;
13
13
  permission_new?: string;
@@ -15,10 +15,10 @@ export interface CallArbitration_Data {
15
15
  bPaused?: boolean;
16
16
  endpoint?: string;
17
17
  fee?: string;
18
- fee_treasury?: string;
18
+ fee_treasury?: {address:string} | {namedNew: Namedbject, description?:string};
19
19
  usage_guard?: string;
20
20
  voting_guard?: {op:'add' | 'set'; data:VotingGuard[]} | {op:'remove', guards:string[]} | {op:'removeall'};
21
- arb_new?: {data: Dispute; guard?:string | 'fetch'}; // dispute an order, and a new Arb launched.
21
+ arb_new?: {data: Dispute; guard?:string | 'fetch'; namedNew?: Namedbject}; // dispute an order, and a new Arb launched.
22
22
  arb_withdraw_fee?: {arb:string; data:WithdrawFee};
23
23
  arb_vote?: Vote;
24
24
  arb_arbitration?: Feedback;
@@ -37,15 +37,18 @@ export class CallArbitration extends CallBase {
37
37
 
38
38
  var checkOwner = false; const guards : string[] = [];
39
39
  const perms : PermissionIndexType[] = []; var obj: ObjectArbitration | undefined ;
40
+ const permission_address = (this.data?.permission as any)?.address;
41
+ const object_address = (this.data?.object as any)?.address;
42
+ const treasury_address = (this.data?.fee_treasury as any)?.address;
40
43
 
41
- if (this.data?.permission && IsValidAddress(this.data.permission)) {
44
+ if (permission_address && IsValidAddress(permission_address)) {
42
45
  if (!this.data?.object) {
43
46
  perms.push(PermissionIndex.arbitration)
44
47
  }
45
48
  if (this.data?.permission_new !== undefined) {
46
49
  checkOwner = true;
47
50
  }
48
- if (this.data?.description !== undefined && this.data.object) {
51
+ if (this.data?.description !== undefined && object_address) {
49
52
  perms.push(PermissionIndex.arbitration_description)
50
53
  }
51
54
  if (this.data?.bPaused !== undefined) {
@@ -54,10 +57,10 @@ export class CallArbitration extends CallBase {
54
57
  if (this.data?.endpoint == undefined) { // publish is an irreversible one-time operation
55
58
  perms.push(PermissionIndex.arbitration_endpoint)
56
59
  }
57
- if (this.data?.fee !== undefined && this.data.object) {
60
+ if (this.data?.fee !== undefined && object_address) {
58
61
  perms.push(PermissionIndex.arbitration_fee)
59
62
  }
60
- if (this.data?.fee_treasury !== undefined && this.data.object) {
63
+ if (treasury_address !== undefined && object_address) {
61
64
  perms.push(PermissionIndex.arbitration_treasury)
62
65
  }
63
66
  if (this.data?.usage_guard !== undefined) {
@@ -73,13 +76,13 @@ export class CallArbitration extends CallBase {
73
76
  if (IsValidAddress(this.data.arb_new.guard)) {
74
77
  guards.push(this.data.arb_new.guard)
75
78
  } else {
76
- if (!this.data.object) { // new
79
+ if (!object_address) { // new
77
80
  if (this.data?.usage_guard && IsValidAddress(this.data?.usage_guard)) {
78
81
  guards.push(this.data.usage_guard)
79
82
  }
80
83
  } else {
81
84
  if (!obj) {
82
- const r = await query_objects({objects:[this.data.object!], showContent:true});
85
+ const r = await query_objects({objects:[object_address], showContent:true});
83
86
  if (r?.objects && r.objects[0].type === 'Arbitration') {
84
87
  obj = r.objects[0] as ObjectArbitration;
85
88
  }
@@ -98,29 +101,36 @@ export class CallArbitration extends CallBase {
98
101
  guards.push(this.data?.arb_vote?.voting_guard)
99
102
  }
100
103
 
101
- return await this.check_permission_and_call(this.data.permission, perms, guards, checkOwner, undefined, account)
104
+ return await this.check_permission_and_call(permission_address, perms, guards, checkOwner, undefined, account)
102
105
  }
103
106
  return await this.exec(account);
104
107
  }
105
108
  protected async operate(txb:TransactionBlock, passport?:PassportObject, account?:string) {
106
109
  let obj : Arbitration | undefined ; let permission: any; let withdraw_treasury:any;
107
- if (!this.data.object) {
108
- if (!this.data?.permission || !IsValidAddress(this.data?.permission)) {
109
- permission = Permission.New(txb, '');
110
+ const permission_address = (this.data?.permission as any)?.address;
111
+ const object_address = (this.data?.object as any)?.address;
112
+ const treasury_address = (this.data?.fee_treasury as any)?.address;
113
+
114
+ if (!object_address) {
115
+ if (!permission_address || !IsValidAddress(permission_address)) {
116
+ const d = (this.data?.permission as any)?.description ?? '';
117
+ permission = Permission.New(txb, d);
110
118
  }
111
- if (!this.data?.fee_treasury || !IsValidAddress(this.data?.fee_treasury)) {
112
- withdraw_treasury = Treasury.New(txb, this.data?.type_parameter!, permission ?? this.data?.permission, '', permission?undefined:passport);
119
+ if (!treasury_address || !IsValidAddress(treasury_address)) {
120
+ const d = (this.data?.fee_treasury as any)?.description ?? '';
121
+ withdraw_treasury = Treasury.New(txb, this.data?.type_parameter!, permission ?? permission_address, d, permission?undefined:passport);
113
122
  }
114
- obj = Arbitration.New(txb, this.data.type_parameter!, permission ?? this.data?.permission, this.data?.description??'',
115
- BigInt(this.data?.fee ?? 0), withdraw_treasury??this.data.fee_treasury, permission?undefined:passport);
116
- } else if (this.data.object) {
117
- if (IsValidAddress(this.data.object) && this.data.type_parameter && this.data.permission && IsValidAddress(this.data?.permission)) {
118
- obj = Arbitration.From(txb, this.data.type_parameter, this.data.permission, this.data.object)
123
+
124
+ obj = Arbitration.New(txb, this.data.type_parameter!, permission ?? permission_address, this.data?.description??'',
125
+ BigInt(this.data?.fee ?? 0), withdraw_treasury??treasury_address, permission?undefined:passport);
126
+ } else if (object_address) {
127
+ if (IsValidAddress(object_address) && this.data.type_parameter && permission_address) {
128
+ obj = Arbitration.From(txb, this.data.type_parameter, permission_address, object_address)
119
129
  }
120
130
  }
121
131
 
122
132
  if (obj) {
123
- if (this.data?.description !== undefined && this.data.object) {
133
+ if (this.data?.description !== undefined && object_address) {
124
134
  obj?.set_description(this.data.description, passport);
125
135
  }
126
136
  if (this.data?.bPaused !== undefined) {
@@ -129,11 +139,11 @@ export class CallArbitration extends CallBase {
129
139
  if (this.data?.endpoint !== undefined) {
130
140
  obj?.set_endpoint(this.data.endpoint, passport)
131
141
  }
132
- if (this.data?.fee !== undefined && this.data.object) {
142
+ if (this.data?.fee !== undefined && object_address) {
133
143
  obj?.set_fee(BigInt(this.data.fee), passport)
134
144
  }
135
- if (this.data.fee_treasury !== undefined && this.data.object) {
136
- obj?.set_withdrawTreasury(this.data.fee_treasury, passport)
145
+ if (treasury_address !== undefined && object_address) {
146
+ obj?.set_withdrawTreasury(treasury_address, passport)
137
147
  }
138
148
  if (this.data.usage_guard !== undefined) {
139
149
  obj?.set_guard(this.data.usage_guard, passport)
@@ -157,7 +167,7 @@ export class CallArbitration extends CallBase {
157
167
  }
158
168
 
159
169
  if (this.data?.arb_new !== undefined) {
160
- obj?.dispute(this.data.arb_new.data, passport)
170
+ this.new_with_mark(txb, obj?.dispute(this.data.arb_new.data, passport), (this.data?.arb_new as any)?.namedNew, account);
161
171
  }
162
172
  if (this.data?.arb_arbitration !== undefined) {
163
173
  obj?.arbitration(this.data.arb_arbitration, passport)
@@ -171,22 +181,17 @@ export class CallArbitration extends CallBase {
171
181
  if (this.data?.permission_new !== undefined) {
172
182
  obj?.change_permission(this.data.permission_new);
173
183
  }
184
+
174
185
  if (withdraw_treasury) {
175
- withdraw_treasury.launch();
186
+ this.new_with_mark(txb, withdraw_treasury.launch(), (this.data?.fee_treasury as any)?.namedNew, account);
176
187
  }
177
188
  if (permission) {
178
- permission.launch();
179
- }
180
- var mark : TransactionResult | string | undefined ;
181
- if (!this.data.object) {
182
- mark = obj?.launch();
183
- } else {
184
- mark = this.data.object;
189
+ this.new_with_mark(txb, permission.launch(), (this.data?.permission as any)?.namedNew, account);
185
190
  }
186
191
 
187
- if (this.data?.mark !== undefined) {
188
- this.mark(txb, mark, this.data?.mark, account)
189
- }
192
+ if (!object_address) {
193
+ this.new_with_mark(txb, obj.launch(), (this.data?.object as any)?.namedNew, account);
194
+ }
190
195
  }
191
196
  }
192
197
  }
package/src/call/base.ts CHANGED
@@ -1,18 +1,22 @@
1
1
 
2
2
 
3
- import { Protocol, TransactionBlock, CallResponse, Guard, TransactionArgument, Entity, IsValidAddress, Resource, TxbObject, TransactionResult} from 'wowok';
3
+ import { Protocol, TransactionBlock, CallResponse, Guard, TransactionArgument, Entity, IsValidAddress, Resource, TxbObject, TransactionResult, TxbAddress, array_unique, TagName} from 'wowok';
4
4
  import { PassportObject, Errors, ERROR, Permission,
5
5
  PermissionIndexType, GuardParser, Passport, WitnessFill
6
6
  } from 'wowok';
7
7
  import { query_permission } from '../permission';
8
8
  import { Account } from '../account';
9
- import { ObjectBase} from '../objects';
10
- import { query_entity } from '../entity';
9
+ import { ObjectBase, queryTableItem_Personal} from '../objects';
10
+
11
+ export interface Namedbject {
12
+ name: string;
13
+ tags?: string[];
14
+ }
11
15
 
12
16
  export interface AddressMark {
13
- nick_name?:string;
14
- tags:string[];
15
- groups:string[];
17
+ address: TxbAddress;
18
+ name?: string;
19
+ tags: string[];
16
20
  }
17
21
  export interface ResponseData extends ObjectBase {
18
22
  change:'created' | 'mutated' | string;
@@ -28,7 +32,7 @@ export interface CallWithWitnessParam {
28
32
  }
29
33
  export type CallResult = GuardInfo_forCall | CallResponse | undefined;
30
34
 
31
- export function ResponseData(response: CallResponse | undefined ) : ResponseData[] {
35
+ export function ResponseData(response: CallResponse | undefined) : ResponseData[] {
32
36
  const res : ResponseData[] = [];
33
37
  response?.objectChanges?.forEach(v => {
34
38
  const type_raw: string | undefined = (v as any)?.objectType;
@@ -41,6 +45,20 @@ export function ResponseData(response: CallResponse | undefined ) : ResponseData
41
45
  })
42
46
  return res;
43
47
  }
48
+
49
+ export const mark_address = async (txb:TransactionBlock, mark:AddressMark, account?:string) => {
50
+ const addr = Account.Instance().get_address(account);
51
+ if (addr) {
52
+ const r = await queryTableItem_Personal({address:addr}); //@ use cache
53
+ const resource = r?.mark_object ? Resource.From(txb, r.mark_object) : Resource.From(txb, Entity.From(txb).create_resource2());
54
+ resource.add(mark.address, mark.tags, mark.name);
55
+ if (!r?.mark_object) {
56
+ resource.launch(); // launch new
57
+ }
58
+ } else {
59
+ ERROR(Errors.InvalidParam, 'account - ' + account)
60
+ }
61
+ }
44
62
  export class CallBase {
45
63
  // operation implementation for a call
46
64
  protected async operate(txb:TransactionBlock, passport?:PassportObject, account?:string) {};
@@ -136,19 +154,8 @@ export class CallBase {
136
154
  });
137
155
  }
138
156
 
139
- protected mark = async (txb:TransactionBlock, object: string | TransactionResult, mark:AddressMark, account?:string) => {
140
- const addr = Account.Instance().get_address(account);
141
- if (addr) {
142
- const r = await query_entity(addr);
143
- if (r?.resource) {
144
- const resource = Resource.From(txb, r.resource);
145
- resource.add_tags(object, mark.nick_name??'', mark.tags);
146
- if (mark.groups.length > 0) {
147
- resource.add2(object, mark.groups);
148
- }
149
- }
150
- } else {
151
- ERROR(Errors.InvalidParam, 'account - ' + account)
152
- }
157
+ protected new_with_mark(txb:TransactionBlock, object:TxbAddress, named_new?:Namedbject, account?:string, innerTags:string[]=[TagName.Launch]) {
158
+ const tags = named_new?.tags ? array_unique([...named_new.tags, ...innerTags]) : array_unique([...innerTags]);
159
+ mark_address(txb, {address:object, name:named_new?.name, tags:tags}, account)
153
160
  }
154
161
  }
@@ -2,12 +2,13 @@ import { TransactionBlock, IsValidArgType, IsValidCoinType } from 'wowok';
2
2
  import { PassportObject, IsValidAddress, Errors, ERROR, Permission, PermissionIndex,
3
3
  PermissionIndexType, Demand, } from 'wowok';
4
4
  import { query_objects, ObjectDemand } from '../objects';
5
- import { CallBase, CallResult } from "./base";
5
+ import { CallBase, CallResult, Namedbject } from "./base";
6
6
  import { Account } from '../account';
7
7
 
8
8
  export interface CallDemand_Data {
9
- object?: string; // undefined for creating a new object
10
- permission?: string;
9
+ object?: {address:string} | {namedNew: Namedbject}; // undefined or {named_new...} for creating a new object
10
+ permission?: {address:string} | {namedNew: Namedbject, description?:string};
11
+
11
12
  type_parameter?: string;
12
13
  guard?: {address:string; service_id_in_guard?:number};
13
14
  description?: string;
@@ -30,15 +31,17 @@ export class CallDemand extends CallBase {
30
31
 
31
32
  var checkOwner = false; const guards : string[] = [];
32
33
  const perms : PermissionIndexType[] = [];
34
+ const permission_address = (this.data?.permission as any)?.address;
35
+ const object_address = (this.data?.object as any)?.address;
33
36
 
34
- if (this.data?.permission && IsValidAddress(this.data.permission)) {
37
+ if (permission_address && IsValidAddress(permission_address)) {
35
38
  if (!this.data?.object) {
36
39
  perms.push(PermissionIndex.demand)
37
40
  }
38
- if (this.data?.description !== undefined && this.data.object) {
41
+ if (this.data?.description !== undefined && object_address) {
39
42
  perms.push(PermissionIndex.demand_description)
40
43
  }
41
- if (this.data?.time_expire !== undefined && this.data.object) {
44
+ if (this.data?.time_expire !== undefined && object_address) {
42
45
  perms.push(PermissionIndex.demand_expand_time)
43
46
  }
44
47
  if (this.data?.guard !== undefined) {
@@ -54,12 +57,12 @@ export class CallDemand extends CallBase {
54
57
  if (IsValidAddress(this.data.present.guard)) {
55
58
  guards.push(this.data.present.guard)
56
59
  } else {
57
- if (!this.data.object) { // new
60
+ if (!object_address) { // new
58
61
  if (this.data?.guard?.address && IsValidAddress(this.data?.guard.address)) {
59
62
  guards.push(this.data.guard.address)
60
63
  }
61
64
  } else {
62
- const r = await query_objects({objects:[this.data.object], showContent:true});
65
+ const r = await query_objects({objects:[object_address], showContent:true});
63
66
  if (r?.objects && r?.objects[0]?.type === 'Demand') {
64
67
  const obj = (r?.objects[0] as ObjectDemand);
65
68
  if (obj?.guard) {
@@ -69,37 +72,40 @@ export class CallDemand extends CallBase {
69
72
  }
70
73
  }
71
74
  }
72
- return await this.check_permission_and_call(this.data.permission, perms, guards, checkOwner, undefined, account)
75
+ return await this.check_permission_and_call(permission_address, perms, guards, checkOwner, undefined, account)
73
76
  }
74
77
  return await this.exec(account);
75
78
  }
76
79
  protected async operate(txb:TransactionBlock, passport?:PassportObject, account?:string) {
77
80
  let obj : Demand | undefined ; let permission: any;
81
+ const permission_address = (this.data?.permission as any)?.address;
82
+ const object_address = (this.data?.object as any)?.address;
78
83
 
79
- if (!this.data.object) {
80
- if (!this.data?.permission || !IsValidAddress(this.data?.permission)) {
81
- permission = Permission.New(txb, '');
84
+ if (!object_address) {
85
+ if (!permission_address || !IsValidAddress(permission_address)) {
86
+ const d = (this.data?.permission as any)?.description ?? '';
87
+ permission = Permission.New(txb, d);
82
88
  }
83
89
 
84
90
  if (this.data.time_expire !== undefined) {
85
91
  obj = Demand.New(txb, this.data.type_parameter!, this.data.time_expire?.op === 'duration' ? true : false,
86
92
  this.data.time_expire?.op === 'duration' ? this.data.time_expire.minutes : this.data.time_expire?.time,
87
- permission ? permission.get_object(): this.data?.permission, this.data?.description??'', permission?undefined:passport)
93
+ permission ? permission.get_object(): permission_address, this.data?.description??'', permission?undefined:passport)
88
94
  } else {
89
95
  obj = Demand.New(txb, this.data.type_parameter!, true, 30*24*60, // 30days default
90
- permission ? permission.get_object(): this.data?.permission, this.data?.description??'', permission?undefined:passport)
96
+ permission ? permission.get_object(): permission_address, this.data?.description??'', permission?undefined:passport)
91
97
  }
92
98
  } else {
93
- if (IsValidAddress(this.data.object) && this.data.type_parameter && this.data.permission && IsValidAddress(this.data?.permission)) {
94
- obj = Demand.From(txb, this.data.type_parameter, this.data.permission, this.data.object)
99
+ if (IsValidAddress(object_address) && this.data.type_parameter && this.data.permission && IsValidAddress(permission_address)) {
100
+ obj = Demand.From(txb, this.data.type_parameter, permission_address, object_address)
95
101
  }
96
102
  }
97
103
 
98
104
  if (obj) {
99
- if (this.data?.description !== undefined && this.data.object) {
105
+ if (this.data?.description !== undefined && object_address) {
100
106
  obj?.set_description(this.data.description, passport);
101
107
  }
102
- if (this.data?.time_expire !== undefined && this.data.object) {
108
+ if (this.data?.time_expire !== undefined && object_address) {
103
109
  obj?.expand_time(this.data.time_expire.op === 'duration' ? true : false,
104
110
  this.data.time_expire.op === 'duration' ? this.data.time_expire.minutes : this.data.time_expire.time, passport)
105
111
  }
@@ -128,10 +134,10 @@ export class CallDemand extends CallBase {
128
134
  obj?.set_guard(this.data.guard.address, this.data.guard?.service_id_in_guard ?? undefined, passport)
129
135
  }
130
136
  if (permission) {
131
- permission.launch();
137
+ this.new_with_mark(txb, permission.launch(), (this.data?.permission as any)?.namedNew, account);
132
138
  }
133
139
  if (!this.data.object) {
134
- obj?.launch();
140
+ this.new_with_mark(txb, obj.launch(), (this.data?.object as any)?.namedNew, account);
135
141
  }
136
142
  }
137
143
  }
@@ -1,11 +1,11 @@
1
- import { CallBase, CallResult } from "./base";
1
+ import { CallBase, CallResult, Namedbject } from "./base";
2
2
  import { TransactionBlock, CallResponse} from 'wowok';
3
3
  import { PassportObject, IsValidAddress, Errors, ERROR, Permission, Permission_Entity, Permission_Index, UserDefinedIndex,
4
4
  PermissionIndexType, WitnessFill
5
5
  } from 'wowok';
6
6
 
7
7
  export interface CallEntityPermission_Data {
8
- object?: string; // undefined for creating a new object
8
+ object?: {address:string} | {namedNew: Namedbject}; // undefined or {named_new...} for creating a new object
9
9
  builder?: string;
10
10
  admin?: {op:'add' | 'remove' | 'set', admins:string[]};
11
11
  description?: string;
@@ -23,7 +23,9 @@ export class CallEntityPermission extends CallBase {
23
23
 
24
24
  async call(account?:string) : Promise<CallResult> {
25
25
  var checkOwner = false; var checkAdmin = false;
26
- if (this.data?.object && IsValidAddress(this.data?.object)) {
26
+ const object_address = (this.data?.object as any)?.address;
27
+
28
+ if (object_address && IsValidAddress(object_address)) {
27
29
  if (this.data?.builder !== undefined || this.data?.admin !== undefined) {
28
30
  checkOwner = true;
29
31
  }
@@ -33,18 +35,18 @@ export class CallEntityPermission extends CallBase {
33
35
  if (this.data?.description !== undefined) {
34
36
  checkAdmin = true;
35
37
  }
36
- return await this.check_permission_and_call(this.data.object, [], [], checkOwner, checkAdmin, account)
38
+ return await this.check_permission_and_call(object_address, [], [], checkOwner, checkAdmin, account)
37
39
  }
38
40
  return await this.exec(account)
39
41
  }
40
- protected async operate (txb:TransactionBlock, passport?:PassportObject) {
42
+ protected async operate (txb:TransactionBlock, passport?:PassportObject, account?:string) {
41
43
  let obj : Permission | undefined ;
42
- if (!this.data.object) {
44
+ const object_address = (this.data?.object as any)?.address;
45
+
46
+ if (!object_address || !IsValidAddress(object_address)) {
43
47
  obj = Permission.New(txb, this.data?.description??'');
44
48
  } else {
45
- if (IsValidAddress(this.data.object)) {
46
- obj = Permission.From(txb, this.data.object)
47
- }
49
+ obj = Permission.From(txb, object_address)
48
50
  }
49
51
 
50
52
  if (obj) {
@@ -102,8 +104,8 @@ export class CallEntityPermission extends CallBase {
102
104
  if (this.data?.builder !== undefined ) {
103
105
  obj?.change_owner(this.data.builder);
104
106
  }
105
- if (!this.data.object) {
106
- obj?.launch();
107
+ if (!object_address) {
108
+ this.new_with_mark(txb, obj.launch(), (this.data?.object as any)?.namedNew, account);
107
109
  }
108
110
  }
109
111
  }
package/src/call/guard.ts CHANGED
@@ -7,7 +7,7 @@ import { Bcs, ContextType, ERROR, Errors, IsValidU8, OperatorType, ValueType, GU
7
7
  concatenate, TransactionBlock, Protocol, FnCallType, hasDuplicates, insertAtHead, CallResponse,
8
8
  IsValidDesription} from "wowok";
9
9
  import { Account } from "../account";
10
- import { CallBase, CallResult } from "./base";
10
+ import { CallBase, CallResult, Namedbject } from "./base";
11
11
 
12
12
  export interface GuardConst {
13
13
  identifier: number; // 1-255, the same identifier to represent the same data in different nodes
@@ -30,6 +30,7 @@ export type GuardNode = { identifier: number; } // Data from GuardConst
30
30
  | {context: ContextType.TYPE_CLOCK | ContextType.TYPE_GUARD | ContextType.TYPE_SIGNER }; // Data from run-time environment
31
31
 
32
32
  export interface CallGuard_Data {
33
+ namedNew?: Namedbject;
33
34
  description: string;
34
35
  table: GuardConst[]; // data used by multiple logical guard nodes
35
36
  root: GuardNode; // root must return ValueType.TYPE_BOOL
@@ -84,11 +85,12 @@ export class CallGuard extends CallBase {
84
85
  })
85
86
  }
86
87
  })
87
- txb.moveCall({
88
+ const addr = txb.moveCall({
88
89
  target:Protocol.Instance().guardFn("create") as FnCallType,
89
90
  arguments:[txb.object(obj)]
90
91
  });
91
-
92
+ this.new_with_mark(txb, addr, this.data?.namedNew, account);
93
+
92
94
  const pair = Account.Instance().get_pair(account, true);
93
95
  if (!pair) ERROR(Errors.Fail, 'account invalid')
94
96