wowok_agent 0.1.11 → 0.1.13

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.
@@ -1,17 +1,18 @@
1
1
  import { CallBase, CallResult, Namedbject } from "./base";
2
- import { PassportObject, IsValidAddress, Errors, ERROR, Permission, Permission_Entity, Permission_Index, UserDefinedIndex,
2
+ import { PassportObject, IsValidAddress, Errors, ERROR, Permission, Permission_Entity, Permission_Index, BizPermission,
3
3
  PermissionIndexType, TransactionBlock
4
4
  } from 'wowok';
5
5
 
6
+ /// The execution priority is determined by the order in which the object attributes are arranged
6
7
  export interface CallPermission_Data {
7
8
  object?: {address:string} | {namedNew: Namedbject}; // undefined or {named_new...} for creating a new object
8
- builder?: string;
9
- admin?: {op:'add' | 'remove' | 'set', admins:string[]};
10
9
  description?: string;
10
+ admin?: {op:'add' | 'remove' | 'set', address:string[]};
11
+ biz_permission?: {op:'add'; data: BizPermission[]} | {op:'remove'; permissions: PermissionIndexType[]};
11
12
  permission?: {op:'add entity'; entities:Permission_Entity[]} | {op:'add permission'; permissions:Permission_Index[]}
12
13
  | {op:'remove entity'; addresses:string[]} | {op:'remove permission'; address:string; index:PermissionIndexType[]}
13
14
  | {op:'transfer permission', from_address: string; to_address: string};
14
- biz_permission?: {op:'add'; data: UserDefinedIndex[]} | {op:'remove'; permissions: PermissionIndexType[]};
15
+ builder?: string;
15
16
  }
16
17
  export class CallPermission extends CallBase {
17
18
  data: CallPermission_Data;
@@ -49,23 +50,37 @@ export class CallPermission extends CallBase {
49
50
  }
50
51
 
51
52
  if (obj) {
53
+ if (this.data?.description !== undefined && this.data.object) {
54
+ obj?.set_description(this.data.description)
55
+ }
56
+ if (this.data?.admin !== undefined) {
57
+ switch(this.data.admin.op) {
58
+ case 'add':
59
+ obj?.add_admin(this.data.admin.address);
60
+ break;
61
+ case 'remove':
62
+ obj?.remove_admin(this.data.admin.address);
63
+ break;
64
+ case 'set':
65
+ obj?.remove_admin([], true);
66
+ obj?.add_admin(this.data.admin.address);
67
+ break
68
+ }
69
+ }
52
70
  if (this.data?.biz_permission !== undefined) { // High priority operate
53
71
  switch(this.data.biz_permission.op) {
54
72
  case 'add':
55
73
  this.data.biz_permission.data.forEach(v => {
56
- obj?.add_userdefine(v.index, v.name);
74
+ obj?.add_bizPermission(v.index, v.name);
57
75
  })
58
76
  break;
59
77
  case 'remove':
60
78
  this.data.biz_permission.permissions.forEach(v => {
61
- obj?.remove_userdefine(v);
79
+ obj?.remove_bizPermission(v);
62
80
  })
63
81
  break;
64
82
  }
65
83
  }
66
- if (this.data?.description !== undefined && this.data.object) {
67
- obj?.set_description(this.data.description)
68
- }
69
84
  if (this.data?.permission !== undefined) {
70
85
  switch (this.data.permission.op) {
71
86
  case 'add entity':
@@ -85,20 +100,6 @@ export class CallPermission extends CallBase {
85
100
  break;
86
101
  }
87
102
  }
88
- if (this.data?.admin !== undefined) {
89
- switch(this.data.admin.op) {
90
- case 'add':
91
- obj?.add_admin(this.data.admin.admins);
92
- break;
93
- case 'remove':
94
- obj?.remove_admin(this.data.admin.admins);
95
- break;
96
- case 'set':
97
- obj?.remove_admin([], true);
98
- obj?.add_admin(this.data.admin.admins);
99
- break
100
- }
101
- }
102
103
  if (this.data?.builder !== undefined ) {
103
104
  obj?.change_owner(this.data.builder);
104
105
  }
@@ -2,14 +2,16 @@ import { ResourceObject, TransactionBlock } from 'wowok';
2
2
  import { PassportObject, IsValidAddress, Errors, ERROR, Entity, Entity_Info, TagName, Resource} from 'wowok';
3
3
  import { CallBase, CallResult, Namedbject } from "./base";
4
4
 
5
+ /// The execution priority is determined by the order in which the object attributes are arranged
5
6
  export interface CallPersonal_Data {
6
7
  object?: {address:string} | {namedNew: Namedbject}; // undefined or {named_new...} for creating a new object
7
8
  information?: Entity_Info;
8
- transfer_to?: string;
9
9
  mark?: {op:'add'; data:{address:string; name?:string; tags:string[]}[]}
10
10
  | {op:'remove'; data:{address:string; tags:string[]}[]}
11
- | {op:'removeall'; address:string[]};
12
- close?: boolean; // close a personal resource
11
+ | {op:'removeall'; address:string[],}
12
+ | {op:'transfer'; address: string}
13
+ | {op:'destroy';}
14
+ | {op:'replace'; address: string};
13
15
  }
14
16
 
15
17
  export class CallPersonal extends CallBase {
@@ -31,7 +33,7 @@ export class CallPersonal extends CallBase {
31
33
  obj = Resource.From(txb, object_address)
32
34
  }
33
35
 
34
- if (this.data?.close) {
36
+ if (this.data?.mark?.op === 'destroy') {
35
37
  entity.destroy_resource(obj)
36
38
  return ; //@ return
37
39
  }
@@ -60,8 +62,11 @@ export class CallPersonal extends CallBase {
60
62
  break;
61
63
  }
62
64
  }
63
- if (this.data?.transfer_to !== undefined && obj) {
64
- entity.transfer_resource(obj, this.data.transfer_to);
65
+ if (this.data?.mark?.op === 'transfer' && obj && IsValidAddress(this.data.mark.address)) {
66
+ entity.transfer_resource(obj, this.data.mark.address);
67
+ }
68
+ if (this.data?.mark?.op === 'replace' && IsValidAddress(this.data.mark.address)) {
69
+ entity.use_resource(Resource.From(txb, this.data.mark.address));
65
70
  }
66
71
 
67
72
  if (!object_address && obj) {
@@ -5,12 +5,13 @@ import { PassportObject, IsValidAddress, Errors, ERROR, Permission, PermissionIn
5
5
  } from 'wowok';
6
6
  import { CallBase, CallResult, Namedbject} from "./base";
7
7
 
8
+ /// The execution priority is determined by the order in which the object attributes are arranged
8
9
  export interface CallRepository_Data {
9
10
  object?: {address:string} | {namedNew: Namedbject}; // undefined or {named_new...} for creating a new object
10
11
  permission?: {address:string} | {namedNew: Namedbject, description?:string};
11
12
  description?: string;
12
- mode?: Repository_Policy_Mode; // default: 'Relax' (POLICY_MODE_FREE)
13
13
  reference?: {op:'set' | 'add' | 'remove' ; addresses:string[]} | {op:'removeall'};
14
+ mode?: Repository_Policy_Mode; // default: 'Relax' (POLICY_MODE_FREE)
14
15
  policy?: {op:'add' | 'set'; data:Repository_Policy[]} | {op:'remove'; data:string[]} | {op:'removeall'} | {op:'rename'; data:{old:string; new:string}[]};
15
16
  data?: {op:'add', data: Repository_Policy_Data | Repository_Policy_Data2} | {op:'remove'; data: Repository_Policy_Data_Remove};
16
17
  }
@@ -89,19 +90,8 @@ export class CallRepository extends CallBase {
89
90
  break;
90
91
  }
91
92
  }
92
- if (this.data?.data !== undefined) {
93
- switch(this.data.data.op) {
94
- case 'add':
95
- if ((this.data.data?.data as any)?.key !== undefined) {
96
- obj?.add_data(this.data.data.data as Repository_Policy_Data);
97
- } else if ((this.data.data?.data as any)?.address !== undefined) {
98
- obj?.add_data2(this.data.data.data as Repository_Policy_Data2);
99
- }
100
- break;
101
- case 'remove':
102
- obj?.remove(this.data.data.data.address, this.data.data.data.key);
103
- break;
104
- }
93
+ if (this.data?.mode !== undefined && object_address) { //@ priority??
94
+ obj?.set_policy_mode(this.data.mode, passport)
105
95
  }
106
96
  if (this.data?.policy !== undefined) {
107
97
  switch(this.data.policy.op) {
@@ -125,9 +115,21 @@ export class CallRepository extends CallBase {
125
115
  break;
126
116
  }
127
117
  }
128
- if (this.data?.mode !== undefined && object_address) { //@ priority??
129
- obj?.set_policy_mode(this.data.mode, passport)
118
+ if (this.data?.data !== undefined) {
119
+ switch(this.data.data.op) {
120
+ case 'add':
121
+ if ((this.data.data?.data as any)?.key !== undefined) {
122
+ obj?.add_data(this.data.data.data as Repository_Policy_Data);
123
+ } else if ((this.data.data?.data as any)?.address !== undefined) {
124
+ obj?.add_data2(this.data.data.data as Repository_Policy_Data2);
125
+ }
126
+ break;
127
+ case 'remove':
128
+ obj?.remove(this.data.data.data.address, this.data.data.data.key);
129
+ break;
130
+ }
130
131
  }
132
+
131
133
  if (permission) {
132
134
  await this.new_with_mark(txb, permission.launch(), (this.data?.permission as any)?.namedNew, account);
133
135
  }
@@ -1,43 +1,44 @@
1
- import { TransactionBlock, CallResponse, IsValidArgType, TxbAddress, TagName, Resource, ResourceObject} from 'wowok';
2
- import { PassportObject, IsValidAddress, Errors, ERROR, Permission, PermissionIndex,
3
- PermissionIndexType, BuyRequiredEnum, Customer_RequiredInfo, DicountDispatch, Service, Service_Buy,
4
- Service_Guard_Percent, Service_Sale, WithdrawPayee, Treasury, WitnessFill
1
+ import { TransactionBlock, IsValidArgType, TxbAddress, TagName, PassportObject, IsValidAddress, Errors, ERROR, Permission,
2
+ PermissionIndex, PermissionIndexType, BuyRequiredEnum, Customer_RequiredInfo, DicountDispatch, Service, Service_Buy,
3
+ Service_Guard_Percent, Service_Sale, WithdrawPayee, Treasury,
5
4
  } from 'wowok';
6
5
  import { query_objects, ObjectService } from '../objects';
7
6
  import { CallBase, CallResult, Namedbject } from "./base";
8
7
  import { Account } from '../account';
9
8
 
9
+ /// The execution priority is determined by the order in which the object attributes are arranged
10
10
  export interface CallService_Data {
11
+ type_parameter: string;
11
12
  object?: {address:string} | {namedNew: Namedbject}; // undefined or {named_new...} for creating a new object
12
13
  permission?: {address:string} | {namedNew: Namedbject, description?:string};
13
- type_parameter: string;
14
- bPaused?: boolean;
15
- bPublished?: boolean;
16
14
  description?: string;
17
- gen_discount?: DicountDispatch[];
18
- arbitration?: {op:'set' | 'add'; arbitrations:{address:string, token_type:string}[]}
19
- | {op:'removeall'} | {op:'remove', addresses:string[]};
20
- buy_guard?: string;
21
15
  endpoint?: string;
16
+ payee_treasury?:{address:string} | {namedNew: Namedbject, description?:string};
17
+ gen_discount?: DicountDispatch[];
18
+ repository?: {op:'set' | 'add' | 'remove' ; repositories:string[]} | {op:'removeall'};
22
19
  extern_withdraw_treasury?: {op:'set' | 'add'; treasuries:{address:string, token_type:string}[]}
23
20
  | {op:'removeall'} | {op:'remove', addresses:string[]};
24
21
  machine?: string;
25
- payee_treasury?:{address:string} | {namedNew: Namedbject, description?:string};
26
- clone_new?: {token_type_new?:string; namedNew?: Namedbject};
27
- repository?: {op:'set' | 'add' | 'remove' ; repositories:string[]} | {op:'removeall'};
22
+ arbitration?: {op:'set' | 'add'; arbitrations:{address:string, type_parameter:string}[]}
23
+ | {op:'removeall'} | {op:'remove', addresses:string[]};
24
+ customer_required_info?: {pubkey:string; required_info:(string | BuyRequiredEnum)[]};
25
+ sales?: {op:'add', sales:Service_Sale[]} | {op:'remove'; sales_name:string[]}
28
26
  withdraw_guard?: {op:'add' | 'set'; guards:Service_Guard_Percent[]}
29
27
  | {op:'removeall'} | {op:'remove', addresses:string[]};
30
28
  refund_guard?: {op:'add' | 'set'; guards:Service_Guard_Percent[]}
31
29
  | {op:'removeall'} | {op:'remove', addresses:string[]};
32
- customer_required_info?: {pubkey:string; required_info:(string | BuyRequiredEnum)[]};
33
- sales?: {op:'add', sales:Service_Sale[]} | {op:'remove'; sales_name:string[]}
30
+ bPublished?: boolean;
34
31
  order_new?: {buy_items:Service_Buy[], discount?:string, machine?:string, customer_info_crypto?: Customer_RequiredInfo, guard?:string | 'fetch', namedNew?: Namedbject}
32
+ order_agent?: {order:string; agents: string[]; progress?:string};
35
33
  order_required_info?: {order:string; info:Customer_RequiredInfo};
36
34
  order_refund?: {order:string; guard?:string;} | {order:string; arb:string; arb_token_type:string}; // guard address
37
35
  order_withdrawl?: {order:string; data:WithdrawPayee}; // guard address
38
36
  order_payer?: {order:string; payer_new: string}; // transfer the order payer permission to someaddress
39
- order_agent?: {order:string; agents: string[]; progress?:string};
37
+ buy_guard?: string;
38
+ bPaused?: boolean;
39
+ clone_new?: {token_type_new?:string; namedNew?: Namedbject};
40
40
  }
41
+
41
42
  export class CallService extends CallBase {
42
43
  data: CallService_Data;
43
44
  constructor(data: CallService_Data) {
@@ -175,14 +176,14 @@ export class CallService extends CallBase {
175
176
  if (this.data?.description !== undefined && object_address) {
176
177
  obj?.set_description(this.data.description, passport);
177
178
  }
178
- if (this.data?.payee_treasury !== undefined && object_address) {
179
- obj?.set_payee(treasury_address, passport);
180
- }
181
179
  if (this.data?.endpoint !== undefined) {
182
180
  obj?.set_endpoint(this.data.endpoint, passport)
183
181
  }
184
- if (this.data?.machine !== undefined) {
185
- obj?.set_machine(this.data.machine, passport)
182
+ if (this.data?.payee_treasury !== undefined && object_address) {
183
+ obj?.set_payee(treasury_address, passport);
184
+ }
185
+ if (this.data?.gen_discount !== undefined) {
186
+ obj?.discount_transfer(this.data.gen_discount, passport)
186
187
  }
187
188
  if (this.data?.repository !== undefined) {
188
189
  switch (this.data.repository.op) {
@@ -218,14 +219,17 @@ export class CallService extends CallBase {
218
219
  break;
219
220
  }
220
221
  }
222
+ if (this.data?.machine !== undefined) {
223
+ obj?.set_machine(this.data.machine, passport)
224
+ }
221
225
  if (this.data?.arbitration !== undefined) {
222
226
  switch(this.data.arbitration.op) {
223
227
  case 'add':
224
- this.data.arbitration.arbitrations.forEach(v=>obj?.add_arbitration(v.address, v.token_type, passport))
228
+ this.data.arbitration.arbitrations.forEach(v=>obj?.add_arbitration(v.address, v.type_parameter, passport))
225
229
  break;
226
230
  case 'set':
227
231
  obj?.remove_arbitration([], true, passport)
228
- this.data.arbitration.arbitrations.forEach(v=>obj?.add_arbitration(v.address, v.token_type, passport))
232
+ this.data.arbitration.arbitrations.forEach(v=>obj?.add_arbitration(v.address, v.type_parameter, passport))
229
233
  break;
230
234
  case 'remove':
231
235
  obj?.remove_arbitration(this.data.arbitration.addresses, false, passport)
@@ -235,8 +239,12 @@ export class CallService extends CallBase {
235
239
  break;
236
240
  }
237
241
  }
238
- if (this.data?.gen_discount !== undefined) {
239
- obj?.discount_transfer(this.data.gen_discount, passport)
242
+ if (this.data?.customer_required_info !== undefined) {
243
+ if (this.data.customer_required_info.required_info && this.data.customer_required_info.pubkey) {
244
+ obj?.set_customer_required(this.data.customer_required_info.pubkey, this.data.customer_required_info.required_info, passport);
245
+ } else if (this.data.customer_required_info.pubkey) {
246
+ obj?.change_required_pubkey(this.data.customer_required_info.pubkey, passport);
247
+ }
240
248
  }
241
249
  if (this.data?.sales !== undefined) {
242
250
  switch(this.data.sales.op) {
@@ -248,47 +256,6 @@ export class CallService extends CallBase {
248
256
  break;
249
257
  }
250
258
  }
251
- if (this.data?.order_new !== undefined) {
252
- let b = BigInt(0); let coin : any;
253
- this.data.order_new.buy_items.forEach(v => {
254
- b += BigInt(v.max_price) * BigInt(v.count)
255
- })
256
- if (b > BigInt(0)) {
257
- const coin = await Account.Instance().get_coin_object(txb, b, account, this.data.type_parameter);
258
- if (coin) {
259
- //@ crypto tools support
260
- const addr = obj.buy(this.data.order_new.buy_items, coin, this.data.order_new.discount,
261
- this.data.order_new.machine, this.data.order_new.customer_info_crypto, passport) ;
262
- await this.new_with_mark(txb, addr, (this.data?.order_new as any)?.namedNew, account, [TagName.Launch, TagName.Order]);
263
- }
264
- }
265
- }
266
- if (this.data?.order_payer !== undefined && obj) {
267
- obj?.change_order_payer(this.data?.order_payer.order, this.data.order_payer.payer_new)
268
- }
269
- if (this.data?.order_agent !== undefined) {
270
- obj?.set_order_agent(this.data.order_agent.order, this.data.order_agent.agents, this.data.order_agent.progress)
271
- }
272
- if (this.data?.order_required_info !== undefined) {
273
- obj?.update_order_required_info(this.data.order_required_info.order, this.data.order_required_info.info)
274
- }
275
- if (this.data?.order_refund !== undefined) {
276
- if ((this.data?.order_refund as any)?.arb && (this.data?.order_refund as any)?.arb_token_type) {
277
- obj?.refund_withArb(this.data.order_refund.order, (this.data?.order_refund as any)?.arb, (this.data?.order_refund as any)?.arb_token_type)
278
- } else {
279
- obj?.refund(this.data.order_refund.order, (this.data?.order_refund as any)?.guard, passport)
280
- }
281
- }
282
- if (this.data?.order_withdrawl !== undefined && passport) { //@ need withdrawal passport
283
- obj?.withdraw(this.data.order_withdrawl.order, this.data.order_withdrawl.data, passport)
284
- }
285
- if (this.data?.customer_required_info !== undefined) {
286
- if (this.data.customer_required_info.required_info && this.data.customer_required_info.pubkey) {
287
- obj?.set_customer_required(this.data.customer_required_info.pubkey, this.data.customer_required_info.required_info, passport);
288
- } else if (this.data.customer_required_info.pubkey) {
289
- obj?.change_required_pubkey(this.data.customer_required_info.pubkey, passport);
290
- }
291
- }
292
259
  if (this.data?.withdraw_guard !== undefined) {
293
260
  switch(this.data.withdraw_guard.op) {
294
261
  case 'add':
@@ -323,15 +290,49 @@ export class CallService extends CallBase {
323
290
  break;
324
291
  }
325
292
  }
293
+ if (this.data?.bPublished) {
294
+ obj?.publish(passport)
295
+ }
296
+ if (this.data?.order_new !== undefined) {
297
+ let b = BigInt(0); let coin : any;
298
+ this.data.order_new.buy_items.forEach(v => {
299
+ b += BigInt(v.max_price) * BigInt(v.count)
300
+ })
301
+ if (b > BigInt(0)) {
302
+ const coin = await Account.Instance().get_coin_object(txb, b, account, this.data.type_parameter);
303
+ if (coin) {
304
+ //@ crypto tools support
305
+ const addr = obj.buy(this.data.order_new.buy_items, coin, this.data.order_new.discount,
306
+ this.data.order_new.machine, this.data.order_new.customer_info_crypto, passport) ;
307
+ await this.new_with_mark(txb, addr, (this.data?.order_new as any)?.namedNew, account, [TagName.Launch, TagName.Order]);
308
+ }
309
+ }
310
+ }
311
+ if (this.data?.order_agent !== undefined) {
312
+ obj?.set_order_agent(this.data.order_agent.order, this.data.order_agent.agents, this.data.order_agent.progress)
313
+ }
314
+ if (this.data?.order_required_info !== undefined) {
315
+ obj?.update_order_required_info(this.data.order_required_info.order, this.data.order_required_info.info)
316
+ }
317
+ if (this.data?.order_refund !== undefined) {
318
+ if ((this.data?.order_refund as any)?.arb && (this.data?.order_refund as any)?.arb_token_type) {
319
+ obj?.refund_withArb(this.data.order_refund.order, (this.data?.order_refund as any)?.arb, (this.data?.order_refund as any)?.arb_token_type)
320
+ } else {
321
+ obj?.refund(this.data.order_refund.order, (this.data?.order_refund as any)?.guard, passport)
322
+ }
323
+ }
324
+ if (this.data?.order_withdrawl !== undefined && passport) { //@ need withdrawal passport
325
+ obj?.withdraw(this.data.order_withdrawl.order, this.data.order_withdrawl.data, passport)
326
+ }
327
+ if (this.data?.order_payer !== undefined && obj) {
328
+ obj?.change_order_payer(this.data?.order_payer.order, this.data.order_payer.payer_new)
329
+ }
326
330
  if (this.data?.buy_guard !== undefined) {
327
331
  obj?.set_buy_guard(this.data.buy_guard, passport)
328
332
  }
329
333
  if (this.data?.bPaused !== undefined) {
330
334
  obj?.pause(this.data.bPaused, passport)
331
335
  }
332
- if (this.data?.bPublished) {
333
- obj?.publish(passport)
334
- }
335
336
  if (this.data?.clone_new !== undefined && obj) {
336
337
  await this.new_with_mark(txb, obj.clone(this.data.clone_new?.token_type_new, true, passport) as TxbAddress, (this.data?.clone_new as any)?.namedNew, account);
337
338
  }
@@ -1,22 +1,22 @@
1
- import { TransactionBlock, CallResponse, IsValidArgType, Resource, ResourceObject} from 'wowok';
2
- import { PassportObject, IsValidAddress, Errors, ERROR, Permission, PermissionIndex,
3
- PermissionIndexType, DepositParam, Treasury, Treasury_WithdrawMode, WithdrawParam, WitnessFill
1
+ import { TransactionBlock, IsValidArgType, PassportObject, IsValidAddress, Errors, ERROR, Permission, PermissionIndex,
2
+ PermissionIndexType, Treasury, Treasury_WithdrawMode, WithdrawParam,
4
3
  } from 'wowok';
5
4
  import { query_objects, ObjectTreasury } from '../objects';
6
5
  import { CallBase, CallResult, Namedbject } from "./base";
7
6
  import { Account } from '../account';
8
7
 
8
+ /// The execution priority is determined by the order in which the object attributes are arranged
9
9
  export interface CallTreasury_Data {
10
+ type_parameter: string;
10
11
  object?: {address:string} | {namedNew: Namedbject}; // undefined or {named_new...} for creating a new object
11
12
  permission?: {address:string} | {namedNew: Namedbject, description?:string};
12
- type_parameter: string;
13
13
  description?: string;
14
- withdraw_mode?: Treasury_WithdrawMode;
15
- withdraw_guard?: {op:'add' | 'set'; data:{guard:string, amount:string|number}[]} | {op:'remove', guards:string[]} | {op:'removeall'};
16
- deposit_guard?: string;
17
14
  deposit?: {data:{balance:string|number; index?:number; remark?:string; for_object?:string; for_guard?:string}; guard?:string | 'fetch'};
18
15
  receive?: {payment:string; received_object:string};
19
16
  withdraw?:WithdrawParam;
17
+ deposit_guard?: string;
18
+ withdraw_guard?: {op:'add' | 'set'; data:{guard:string, amount:string|number}[]} | {op:'remove', guards:string[]} | {op:'removeall'};
19
+ withdraw_mode?: Treasury_WithdrawMode;
20
20
  }
21
21
  export class CallTreasury extends CallBase {
22
22
  data: CallTreasury_Data;
@@ -120,6 +120,9 @@ export class CallTreasury extends CallBase {
120
120
  }
121
121
 
122
122
  if (obj) {
123
+ if (this.data?.description !== undefined && object_address) {
124
+ obj?.set_description(this.data.description, passport);
125
+ }
123
126
  if (this.data.deposit !== undefined) {
124
127
  const coin = await Account.Instance().get_coin_object(txb, this.data.deposit.data.balance, account, this.data.type_parameter);
125
128
  if (coin) {
@@ -130,15 +133,13 @@ export class CallTreasury extends CallBase {
130
133
  })
131
134
  }
132
135
  }
133
- if (this.data?.withdraw !== undefined) {
134
- obj?.withdraw(this.data.withdraw, passport)
135
- }
136
136
  if (this.data?.receive !== undefined) {
137
137
  obj?.receive(this.data.receive.payment, this.data.receive.received_object, passport);
138
138
  }
139
- if (this.data?.description !== undefined && object_address) {
140
- obj?.set_description(this.data.description, passport);
139
+ if (this.data?.withdraw !== undefined) {
140
+ obj?.withdraw(this.data.withdraw, passport)
141
141
  }
142
+
142
143
  if (this.data?.deposit_guard !== undefined) {
143
144
  obj?.set_deposit_guard(this.data.deposit_guard, passport);
144
145
  }
package/src/call.ts CHANGED
@@ -1,6 +1,6 @@
1
1
 
2
2
  /**
3
- * Provide a this interface for AI
3
+ * Provide an operate interface for AI
4
4
  * Restrictive prioritization, such as setting a deposit first and setting a deposit guard later (only subsequent deposits are affected).
5
5
  */
6
6
 
@@ -16,25 +16,26 @@ import { CallBase, CallResult, CallWithWitnessParam } from "./call/base";
16
16
  import { CallGuard, CallGuard_Data } from "./call/guard";
17
17
  import { CallObjectPermission, CallObjectPermission_Data } from "./call/object_permission";
18
18
 
19
-
20
- export interface CallObjectData {
21
- type: 'Demand' | 'Service' | 'Machine' | 'Treasury' | 'Arbitration' | 'Guard' | 'Repository' | 'Personal' | 'Permission' | 'ObjectPermission';
22
- data: CallDemand_Data | CallMachine_Data | CallArbitration_Data | CallPermission_Data | CallObjectPermission_Data
23
- | CallTreasury_Data | CallService_Data | CallRepository_Data;
19
+ export type CallObjectType = 'Demand' | 'Service' | 'Machine' | 'Treasury' | 'Arbitration' | 'Guard' | 'Repository' | 'Personal' | 'Permission' | 'ObjectPermission';
20
+ export type CallObjectData = CallDemand_Data | CallMachine_Data | CallArbitration_Data | CallPermission_Data | CallObjectPermission_Data
21
+ | CallTreasury_Data | CallService_Data | CallRepository_Data;
22
+ export interface CallObject {
23
+ type: CallObjectType;
24
+ data: CallObjectData;
24
25
  account?: string;
25
26
  witness?: CallWithWitnessParam;
26
27
  }
27
28
 
28
29
  export const call_object_json = async (json: string) : Promise<string> => {
29
30
  try {
30
- const c : CallObjectData = JSON.parse(json);
31
+ const c : CallObject = JSON.parse(json);
31
32
  return JSON.stringify({data:await call_object(c)});
32
33
  } catch (e) {
33
34
  return JSON.stringify({error:e?.toString()})
34
35
  }
35
36
  }
36
37
 
37
- export const call_object = async (call: CallObjectData) : Promise<CallResult> => {
38
+ export const call_object = async (call: CallObject) : Promise<CallResult> => {
38
39
  var obj = call_object_new(call);
39
40
 
40
41
  if (obj) {
@@ -46,7 +47,7 @@ export const call_object = async (call: CallObjectData) : Promise<CallResult> =>
46
47
  }
47
48
  }
48
49
 
49
- function call_object_new (call: CallObjectData) : CallBase | undefined {
50
+ function call_object_new (call: CallObject) : CallBase | undefined {
50
51
  switch (call.type) {
51
52
  case 'Demand':
52
53
  return new CallDemand(call.data as CallDemand_Data);
package/src/objects.ts CHANGED
@@ -461,7 +461,7 @@ export function raw2type(type_raw:string | undefined) : ObjectBaseType | undefin
461
461
 
462
462
  const t = Protocol.Instance().object_name_from_type_repr(type_raw);
463
463
  if (t === 'Permission' || t === 'Demand' || t === 'Machine' || t === 'Progress' || t === 'Order' || t === 'Service' ||
464
- t === 'Treasury' || t === 'Arb' || t === 'Repository' || t === 'Payment' || t === 'Discount' || t === 'Guard') {
464
+ t === 'Treasury' || t === 'Arb' || t === 'Repository' || t === 'Payment' || t === 'Discount' || t === 'Guard' || t === 'Arbitration') {
465
465
  return t
466
466
  } else if (t === 'Resource') {
467
467
  return 'PersonalMark';
package/src/permission.ts CHANGED
@@ -3,9 +3,7 @@
3
3
  * not only the permission table, but also the administrator or Builder identity.
4
4
  */
5
5
 
6
- import { TransactionBlock, } from 'wowok';
7
- import { Protocol, Bcs, IsValidAddress, Errors, ERROR, Permission, PermissionAnswer, BCS} from 'wowok';
8
-
6
+ import { TransactionBlock, Protocol, Bcs, IsValidAddress, Errors, ERROR, Permission, PermissionAnswer, BCS} from 'wowok';
9
7
 
10
8
  export interface PermissionQuery {
11
9
  permission_object: string;