wowok_agent 0.0.1

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.
@@ -0,0 +1,101 @@
1
+ import { CallBase } from "./call";
2
+ import { TransactionBlock, CallResponse} from 'wowok';
3
+ import { PassportObject, IsValidAddress, Errors, ERROR, Permission, Permission_Entity, Permission_Index, UserDefinedIndex,
4
+ PermissionIndexType, WitnessFill
5
+ } from 'wowok';
6
+
7
+ export class CallPermission extends CallBase {
8
+ builder?: string;
9
+ admin?: {op:'add' | 'remove' | 'set', admins:string[]};
10
+ description?: string;
11
+ entity?: {op:'add entity'; entities:Permission_Entity[]} | {op:'add permission'; permissions:Permission_Index[]}
12
+ | {op:'remove entity'; addresses:string[]} | {op:'remove permission'; address:string; index:PermissionIndexType[]}
13
+ | {op:'transfer permission', from_address: string; to_address: string};
14
+ biz_permission?: {op:'add'; data: UserDefinedIndex[]} | {op:'remove'; permissions: PermissionIndexType[]};
15
+ constructor(object: string | 'new' = 'new') { super(object) }
16
+ async call(account?:string) : Promise<WitnessFill[] | CallResponse | undefined> {
17
+ var checkOwner = false; var checkAdmin = false;
18
+ if (this?.object !== 'new' && IsValidAddress(this?.object)) {
19
+ if (this?.builder !== undefined || this?.admin !== undefined) {
20
+ checkOwner = true;
21
+ }
22
+ if (this?.entity !== undefined || this?.biz_permission !== undefined) {
23
+ checkAdmin = true;
24
+ }
25
+ if (this?.description !== undefined && this?.object !== 'new') {
26
+ checkAdmin = true;
27
+ }
28
+ return await this.check_permission_and_call(this.object, [], [], checkOwner, checkAdmin, account)
29
+ }
30
+ return this.exec(account)
31
+ }
32
+ protected async operate (txb:TransactionBlock, passport?:PassportObject) {
33
+ let obj : Permission | undefined ;
34
+ if (this.object === 'new') {
35
+ obj = Permission.New(txb, this?.description??'');
36
+ } else {
37
+ if (IsValidAddress(this.object)) {
38
+ obj = Permission.From(txb, this.object)
39
+ }
40
+ }
41
+
42
+ if (obj) {
43
+ if (this?.admin !== undefined) {
44
+ switch(this.admin.op) {
45
+ case 'add':
46
+ obj?.add_admin(this.admin.admins);
47
+ break;
48
+ case 'remove':
49
+ obj?.remove_admin(this.admin.admins);
50
+ break;
51
+ case 'set':
52
+ obj?.remove_admin([], true);
53
+ obj?.add_admin(this.admin.admins);
54
+ break
55
+ }
56
+ }
57
+ if (this?.description !== undefined && this.object !== 'new') {
58
+ obj?.set_description(this.description)
59
+ }
60
+ if (this?.entity !== undefined) {
61
+ switch (this.entity.op) {
62
+ case 'add entity':
63
+ obj?.add_entity(this.entity.entities);
64
+ break;
65
+ case 'add permission':
66
+ obj?.add_entity3(this.entity.permissions);
67
+ break;
68
+ case 'remove entity':
69
+ obj?.remove_entity(this.entity.addresses);
70
+ break;
71
+ case 'remove permission':
72
+ obj?.remove_index(this.entity.address, this.entity.index);
73
+ break;
74
+ case 'transfer permission':
75
+ obj?.transfer_permission(this.entity.from_address, this.entity.to_address);
76
+ break;
77
+ }
78
+ }
79
+ if (this?.biz_permission !== undefined) {
80
+ switch(this.biz_permission.op) {
81
+ case 'add':
82
+ this.biz_permission.data.forEach(v => {
83
+ obj?.add_userdefine(v.index, v.name);
84
+ })
85
+ break;
86
+ case 'remove':
87
+ this.biz_permission.permissions.forEach(v => {
88
+ obj?.remove_userdefine(v);
89
+ })
90
+ break;
91
+ }
92
+ }
93
+ if (this?.builder !== undefined ) {
94
+ obj?.change_owner(this.builder);
95
+ }
96
+ if (this.object === 'new') {
97
+ obj?.launch();
98
+ }
99
+ }
100
+ }
101
+ }
@@ -0,0 +1,87 @@
1
+ import { TransactionBlock, CallResponse} from 'wowok';
2
+ import { PassportObject, IsValidAddress, Errors, ERROR, Entity, Entity_Info, MarkName, Resource, WitnessFill} from 'wowok';
3
+ import { CallBase } from "./call";
4
+
5
+ export class CallPersonal extends CallBase {
6
+ information?: Entity_Info;
7
+ transfer_to?: string;
8
+ marks?: {op:'add mark'; data:{mark_name:string; address:string[]}}
9
+ | {op:'add address'; data:{address:string; mark_name:string[]}}
10
+ | {op:'remove mark'; data:{mark_name:string; address:string[]}}
11
+ | {op:'remove address'; data:{address:string; mark_name:string[]}}
12
+ | {op:'clear mark'; mark_name:string};
13
+ tags?: {op:'add'; data:{address:string; nick_name:string; tags:string[]}}
14
+ | {op:'remove'; address:string};
15
+ close?: boolean; // close a personal resource
16
+ constructor(object: string | 'new' = 'new') { super(object) }
17
+ async call(account?:string) : Promise<WitnessFill[] | CallResponse | undefined> {
18
+ return this.exec(account)
19
+ }
20
+ protected async operate (txb:TransactionBlock, passport?:PassportObject) {
21
+ let obj : Resource | undefined ; let entity: Entity = Entity.From(txb);
22
+ if (this.object === 'new') {
23
+ obj = Resource.From(txb, entity.create_resource2());
24
+ } else {
25
+ if (IsValidAddress(this.object)) {
26
+ obj = Resource.From(txb, this.object)
27
+ if (this?.close) {
28
+ entity.destroy_resource(obj)
29
+ return ; //@ return
30
+ }
31
+ }
32
+ }
33
+
34
+ if (this?.information !== undefined ) {
35
+ entity.update(this.information)
36
+ }
37
+
38
+ if (obj && obj?.get_object()) {
39
+ if (this?.marks !== undefined) {
40
+ switch(this.marks.op) {
41
+ case 'add address':
42
+ obj?.add2(this.marks.data.address, this.marks.data.mark_name)
43
+ break;
44
+ case 'add mark':
45
+ if (this.marks.data.mark_name === MarkName.DislikeName || this.marks.data.mark_name === MarkName.LikeName) {
46
+ const n = this.marks.data.mark_name;
47
+ this.marks.data.address.forEach(v => {if (obj) entity.mark(obj, v, n)})
48
+ } else {
49
+ obj?.add(this.marks.data.mark_name, this.marks.data.address)
50
+ }
51
+ break;
52
+ case 'clear mark':
53
+ obj?.remove(this.marks.mark_name, [], true)
54
+ break;
55
+ case 'remove address':
56
+ obj?.remove2(this.marks.data.address, this.marks.data.mark_name)
57
+ break;
58
+ case 'remove mark':
59
+ if (this.marks.data.mark_name === MarkName.DislikeName || this.marks.data.mark_name === MarkName.LikeName) {
60
+ const n = this.marks.data.mark_name;
61
+ this.marks.data.address.forEach(v => {if (obj) entity.mark(obj, v, n)})
62
+ } else {
63
+ obj?.remove(this.marks.data.mark_name, this.marks.data.address)
64
+ }
65
+ break;
66
+ }
67
+ }
68
+ if (this?.tags !== undefined) {
69
+ switch(this.tags.op) {
70
+ case 'add':
71
+ obj?.add_tags(this.tags.data.address, this.tags.data.nick_name, this.tags.data.tags)
72
+ break;
73
+ case 'remove':
74
+ obj?.remove_tags(this.tags.address)
75
+ break;
76
+ }
77
+ }
78
+ if (this?.transfer_to !== undefined && obj) {
79
+ entity.transfer_resource(obj, this.transfer_to);
80
+ }
81
+
82
+ if (this.object === 'new') {
83
+ obj?.launch();
84
+ }
85
+ }
86
+ }
87
+ }
@@ -0,0 +1,129 @@
1
+ import { TransactionBlock, CallResponse} from 'wowok';
2
+ import { PassportObject, IsValidAddress, Errors, ERROR, Permission, PermissionIndex, PermissionIndexType, Repository,
3
+ Repository_Policy, Repository_Policy_Data, Repository_Policy_Data2, Repository_Policy_Data_Remove,
4
+ Repository_Policy_Mode, WitnessFill
5
+ } from 'wowok';
6
+ import { CallBase } from "./call";
7
+
8
+ export class CallRepository extends CallBase {
9
+ permission_new?: string; // change permission or 'new' object with permission specified.
10
+ description?: string;
11
+ mode?: Repository_Policy_Mode; // default: 'Relax' (POLICY_MODE_FREE)
12
+ reference?: {op:'set' | 'add' | 'remove' ; addresses:string[]} | {op:'removeall'};
13
+ policy?: {op:'add' | 'set'; data:Repository_Policy[]} | {op:'remove'; data:string[]} | {op:'removeall'} | {op:'rename'; data:{old:string; new:string}[]};
14
+ data?: {op:'add', data: Repository_Policy_Data | Repository_Policy_Data2} | {op:'remove'; data: Repository_Policy_Data_Remove};
15
+ constructor(object: string | 'new' = 'new') { super(object) }
16
+ async call(account?:string) : Promise<WitnessFill[] | CallResponse | undefined> {
17
+ var checkOwner = false;
18
+ const perms : PermissionIndexType[] = [];
19
+
20
+ if (this?.permission && IsValidAddress(this.permission)) {
21
+ if (this?.object === 'new') {
22
+ perms.push(PermissionIndex.repository)
23
+ }
24
+ if (this?.permission_new !== undefined) {
25
+ checkOwner = true;
26
+ }
27
+ if (this?.description !== undefined && this?.object !== 'new') {
28
+ perms.push(PermissionIndex.repository_description)
29
+ }
30
+ if (this?.mode !== undefined && this?.object !== 'new') {
31
+ perms.push(PermissionIndex.repository_mode)
32
+ }
33
+ if (this?.reference !== undefined) {
34
+ perms.push(PermissionIndex.repository_reference)
35
+ }
36
+ if (this?.policy !== undefined) {
37
+ perms.push(PermissionIndex.repository_policies)
38
+ }
39
+ return await this.check_permission_and_call(this.permission, perms, [], checkOwner, undefined, account)
40
+ }
41
+ return this.exec(account);
42
+ }
43
+
44
+ protected async operate(txb:TransactionBlock, passport?:PassportObject) {
45
+ let obj : Repository | undefined ; let permission: any;
46
+ if (this.object === 'new') {
47
+ if (!this?.permission || !IsValidAddress(this?.permission)) {
48
+ permission = Permission.New(txb, '');
49
+ }
50
+
51
+ obj = Repository.New(txb, permission ?? this?.permission, this?.description??'', this?.mode, permission?undefined:passport)
52
+ } else {
53
+ if (IsValidAddress(this.object) && this.permission && IsValidAddress(this?.permission)) {
54
+ obj = Repository.From(txb, this.permission, this.object)
55
+ }
56
+ }
57
+
58
+ if (obj) {
59
+ if (this?.description !== undefined && this.object !== 'new') {
60
+ obj?.set_description(this.description, passport);
61
+ }
62
+ if (this?.mode !== undefined && this.object !== 'new') {
63
+ obj?.set_policy_mode(this.mode, passport)
64
+ }
65
+ if (this?.reference !== undefined) {
66
+ switch (this.reference.op) {
67
+ case 'set':
68
+ obj?.remove_reference([], true, passport);
69
+ obj?.add_reference(this.reference.addresses, passport);
70
+ break;
71
+ case 'add':
72
+ obj?.add_reference(this.reference.addresses, passport);
73
+ break;
74
+ case 'remove':
75
+ obj?.remove_reference(this.reference.addresses, false, passport);
76
+ break;
77
+ case 'removeall':
78
+ obj?.remove_reference([], true, passport);
79
+ break;
80
+ }
81
+ }
82
+ if (this?.policy !== undefined) {
83
+ switch(this.policy.op) {
84
+ case 'set':
85
+ obj?.remove_policies([], true, passport);
86
+ obj?.add_policies(this.policy.data, passport);
87
+ break;
88
+ case 'add':
89
+ obj?.add_policies(this.policy.data, passport);
90
+ break;
91
+ case 'remove':
92
+ obj?.remove_policies(this.policy.data, false, passport);
93
+ break;
94
+ case 'removeall':
95
+ obj?.remove_policies([], true, passport);
96
+ break;
97
+ case 'rename':
98
+ this.policy.data.forEach((v) => {
99
+ obj?.rename_policy(v.old, v.new, passport);
100
+ })
101
+ break;
102
+ }
103
+ }
104
+ if (this?.data !== undefined) {
105
+ switch(this.data.op) {
106
+ case 'add':
107
+ if ((this.data?.data as any)?.key !== undefined) {
108
+ obj?.add_data(this.data.data as Repository_Policy_Data);
109
+ } else if ((this.data?.data as any)?.address !== undefined) {
110
+ obj?.add_data2(this.data.data as Repository_Policy_Data2);
111
+ }
112
+ break;
113
+ case 'remove':
114
+ obj?.remove(this.data.data.address, this.data.data.key);
115
+ break;
116
+ }
117
+ }
118
+ if (this?.permission_new !== undefined ) {
119
+ obj?.change_permission(this.permission_new);
120
+ }
121
+ if (permission) {
122
+ permission.launch();
123
+ }
124
+ if (this.object === 'new') {
125
+ obj?.launch();
126
+ }
127
+ }
128
+ };
129
+ }
@@ -0,0 +1,334 @@
1
+ import { TransactionBlock, CallResponse} 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
5
+ } from 'wowok';
6
+ import { OBJECT_QUERY, ObjectService } from '../objects';
7
+ import { CallBase } from "./call";
8
+
9
+ export class CallService extends CallBase {
10
+ type_parameter: string;
11
+ permission_new?: string;
12
+ bPaused?: boolean;
13
+ bPublished?: boolean;
14
+ description?: string;
15
+ gen_discount?: DicountDispatch[];
16
+ arbitration?: {op:'set' | 'add'; arbitrations:{address:string, token_type:string}[]}
17
+ | {op:'removeall'} | {op:'remove', addresses:string[]};
18
+ buy_guard?: string;
19
+ endpoint?: string;
20
+ extern_withdraw_treasury?: {op:'set' | 'add'; treasuries:{address:string, token_type:string}[]}
21
+ | {op:'removeall'} | {op:'remove', addresses:string[]};
22
+ machine?: string;
23
+ payee_treasury?:string;
24
+ clone_new?: {token_type_new?:string};
25
+ repository?: {op:'set' | 'add' | 'remove' ; repositories:string[]} | {op:'removeall'};
26
+ withdraw_guard?: {op:'add' | 'set'; guards:Service_Guard_Percent[]}
27
+ | {op:'removeall'} | {op:'remove', addresses:string[]};
28
+ refund_guard?: {op:'add' | 'set'; guards:Service_Guard_Percent[]}
29
+ | {op:'removeall'} | {op:'remove', addresses:string[]};
30
+ customer_required_info?: {pubkey:string; required_info:(string | BuyRequiredEnum)[]};
31
+ sales?: {op:'add', sales:Service_Sale[]} | {op:'remove'; sales_name:string[]}
32
+ order_new?: {buy_items:Service_Buy[], coin_object?:string, discount?:string, machine?:string, customer_info_crypto?: Customer_RequiredInfo, guard?:string | 'fetch'}
33
+ order_required_info?: {order:string; info:Customer_RequiredInfo};
34
+ order_refund?: {order:string; guard?:string;} | {order:string; arb:string; arb_token_type:string}; // guard address
35
+ order_withdrawl?: {order:string; data:WithdrawPayee}; // guard address
36
+ order_payer?: {order:string; payer_new: string}; // transfer the order payer permission to someaddress
37
+ order_agent?: {order:string; agents: string[]; progress?:string};
38
+ constructor(type_parameter:string, object: string | 'new' = 'new') {
39
+ super(object)
40
+ this.type_parameter = type_parameter;
41
+ }
42
+ async call(account?:string) : Promise<WitnessFill[] | CallResponse | undefined> {
43
+ if (!this.type_parameter) ERROR(Errors.InvalidParam, 'type_parameter');
44
+
45
+ var checkOwner = false; const guards : string[] = [];
46
+ const perms : PermissionIndexType[] = []; var obj: ObjectService | undefined;
47
+
48
+ if (this?.permission && IsValidAddress(this.permission)) {
49
+ if (this?.object === 'new') {
50
+ perms.push(PermissionIndex.service)
51
+ }
52
+ if (this?.permission_new !== undefined) {
53
+ checkOwner = true;
54
+ }
55
+ if (this?.description !== undefined && this.object !== 'new') {
56
+ perms.push(PermissionIndex.service_description)
57
+ }
58
+ if (this?.bPaused !== undefined) {
59
+ perms.push(PermissionIndex.service_pause)
60
+ }
61
+ if (this?.bPublished) { // publish is an irreversible one-time operation
62
+ perms.push(PermissionIndex.service_publish)
63
+ }
64
+ if (this?.endpoint !== undefined) {
65
+ perms.push(PermissionIndex.service_endpoint)
66
+ }
67
+ if (this?.repository !== undefined) {
68
+ perms.push(PermissionIndex.service_repository)
69
+ }
70
+ if (this?.clone_new !== undefined) {
71
+ perms.push(PermissionIndex.service_clone)
72
+ }
73
+ if (this?.gen_discount !== undefined) {
74
+ perms.push(PermissionIndex.service_discount_transfer)
75
+ }
76
+ if (this?.arbitration !== undefined) {
77
+ perms.push(PermissionIndex.service_arbitration)
78
+ }
79
+ if (this?.buy_guard !== undefined) {
80
+ perms.push(PermissionIndex.service_buyer_guard)
81
+ }
82
+ if (this?.endpoint !== undefined) {
83
+ perms.push(PermissionIndex.service_endpoint)
84
+ }
85
+ if (this?.extern_withdraw_treasury !== undefined) {
86
+ perms.push(PermissionIndex.service_treasury)
87
+ }
88
+ if (this?.machine !== undefined) {
89
+ perms.push(PermissionIndex.service_machine)
90
+ }
91
+ if (this?.payee_treasury !== undefined && this.object !== 'new') {
92
+ perms.push(PermissionIndex.service_payee)
93
+ }
94
+ if (this?.withdraw_guard !== undefined) {
95
+ perms.push(PermissionIndex.service_withdraw_guards)
96
+ }
97
+ if (this?.refund_guard !== undefined) {
98
+ perms.push(PermissionIndex.service_refund_guards)
99
+ }
100
+ if (this?.customer_required_info !== undefined) {
101
+ perms.push(PermissionIndex.service_customer_required)
102
+ }
103
+ if (this?.sales !== undefined) {
104
+ perms.push(PermissionIndex.service_sales)
105
+ }
106
+ if (this?.order_new?.guard !== undefined) {
107
+ if (IsValidAddress(this.order_new.guard)) {
108
+ guards.push(this.order_new.guard)
109
+ } else if (this?.object && IsValidAddress(this.object)) {
110
+ if (!obj) {
111
+ const r = await OBJECT_QUERY.objects({objects:[this.object], showContent:true});
112
+ if (r?.objects && r.objects[0].type === 'Service') {
113
+ obj = r.objects[0] as ObjectService;
114
+ }
115
+ }
116
+ if (obj?.buy_guard) {
117
+ guards.push(obj?.buy_guard)
118
+ }
119
+ }
120
+ }
121
+ if (IsValidAddress((this?.order_refund as any)?.guard)) {
122
+ guards.push((this?.order_refund as any)?.guard)
123
+ }
124
+ if (this.order_withdrawl !== undefined) { // permission(may be guard) + withdraw_guard
125
+ perms.push(PermissionIndex.service_withdraw)
126
+ }
127
+
128
+ if (typeof(this?.order_withdrawl?.data?.withdraw_guard) === 'string' && IsValidAddress(this?.order_withdrawl?.data?.withdraw_guard)) {
129
+ guards.push(this?.order_withdrawl?.data?.withdraw_guard)
130
+ }
131
+
132
+ return await this.check_permission_and_call(this.permission, perms, guards, checkOwner, undefined, account)
133
+ }
134
+ return this.exec(account);
135
+ }
136
+ protected async operate (txb:TransactionBlock, passport?:PassportObject) {
137
+ let obj : Service | undefined ; let permission: any; let payee: any;
138
+ if (this.object === 'new' && this?.type_parameter) {
139
+ if (!this?.permission || !IsValidAddress(this?.permission)) {
140
+ permission = Permission.New(txb, '');
141
+ }
142
+ if (!this?.payee_treasury || !IsValidAddress(this?.payee_treasury)) {
143
+ payee = Treasury.New(txb, this?.type_parameter, permission ?? this?.permission, '', permission?undefined:passport);
144
+ }
145
+ obj = Service.New(txb, this.type_parameter, permission??this?.permission, this?.description??'', payee??this?.payee_treasury, permission?undefined:passport)
146
+ } else {
147
+ if (IsValidAddress(this.object) && this.type_parameter && this.permission && IsValidAddress(this?.permission)) {
148
+ obj = Service.From(txb, this.type_parameter, this.permission, this.object)
149
+ }
150
+ }
151
+
152
+ if (obj) {
153
+ if (this?.description !== undefined && this.object !== 'new') {
154
+ obj?.set_description(this.description, passport);
155
+ }
156
+ if (this?.payee_treasury !== undefined && this.object !== 'new') {
157
+ obj?.set_payee(this.payee_treasury, passport);
158
+ }
159
+ if (this?.endpoint !== undefined) {
160
+ obj?.set_endpoint(this.endpoint, passport)
161
+ }
162
+ if (this?.buy_guard !== undefined) {
163
+ obj?.set_buy_guard(this.buy_guard, passport)
164
+ }
165
+ if (this?.bPaused !== undefined) {
166
+ obj?.pause(this.bPaused, passport)
167
+ }
168
+ if (this?.bPublished) {
169
+ obj?.publish(passport)
170
+ }
171
+ if (this?.clone_new !== undefined) {
172
+ obj?.clone(this.clone_new?.token_type_new, true, passport)
173
+ }
174
+ if (this?.machine !== undefined) {
175
+ obj?.set_machine(this.machine, passport)
176
+ }
177
+ if (this?.repository !== undefined) {
178
+ switch (this.repository.op) {
179
+ case 'add':
180
+ this.repository.repositories.forEach(v => obj?.add_repository(v, passport))
181
+ break;
182
+ case 'remove':
183
+ obj?.remove_repository(this.repository.repositories, false, passport)
184
+ break;
185
+ case 'set':
186
+ obj?.remove_repository([], true, passport)
187
+ this.repository.repositories.forEach(v => obj?.add_repository(v, passport))
188
+ break;
189
+ case 'removeall':
190
+ obj?.remove_repository([], true, passport)
191
+ break;
192
+ }
193
+ }
194
+ if (this?.extern_withdraw_treasury !== undefined) {
195
+ switch(this.extern_withdraw_treasury.op) {
196
+ case 'add':
197
+ this.extern_withdraw_treasury.treasuries.forEach(v=>obj?.add_treasury(v.token_type, v.address, passport))
198
+ break;
199
+ case 'set':
200
+ obj?.remove_treasury([], true, passport)
201
+ this.extern_withdraw_treasury.treasuries.forEach(v=>obj?.add_treasury(v.token_type, v.address, passport))
202
+ break;
203
+ case 'remove':
204
+ obj?.remove_treasury(this.extern_withdraw_treasury.addresses, false, passport)
205
+ break;
206
+ case 'removeall':
207
+ obj?.remove_treasury([], false, passport)
208
+ break;
209
+ }
210
+ }
211
+ if (this?.arbitration !== undefined) {
212
+ switch(this.arbitration.op) {
213
+ case 'add':
214
+ this.arbitration.arbitrations.forEach(v=>obj?.add_arbitration(v.address, v.token_type, passport))
215
+ break;
216
+ case 'set':
217
+ obj?.remove_arbitration([], true, passport)
218
+ this.arbitration.arbitrations.forEach(v=>obj?.add_arbitration(v.address, v.token_type, passport))
219
+ break;
220
+ case 'remove':
221
+ obj?.remove_arbitration(this.arbitration.addresses, false, passport)
222
+ break;
223
+ case 'removeall':
224
+ obj?.remove_arbitration([], false, passport)
225
+ break;
226
+ }
227
+ }
228
+ if (this?.customer_required_info !== undefined) {
229
+ if (this.customer_required_info.required_info && this.customer_required_info.pubkey) {
230
+ obj?.set_customer_required(this.customer_required_info.pubkey, this.customer_required_info.required_info, passport);
231
+ } else if (this.customer_required_info.pubkey) {
232
+ obj?.change_required_pubkey(this.customer_required_info.pubkey, passport);
233
+ }
234
+ }
235
+ if (this?.refund_guard !== undefined) {
236
+ switch(this.refund_guard.op) {
237
+ case 'add':
238
+ obj?.add_refund_guards(this.refund_guard.guards, passport)
239
+ break;
240
+ case 'set':
241
+ obj?.remove_refund_guards([], true, passport)
242
+ obj?.add_refund_guards(this.refund_guard.guards, passport)
243
+ break;
244
+ case 'remove':
245
+ obj?.remove_refund_guards(this.refund_guard.addresses, false, passport)
246
+ break;
247
+ case 'removeall':
248
+ obj?.remove_refund_guards([], true, passport)
249
+ break;
250
+ }
251
+ }
252
+ if (this?.gen_discount !== undefined) {
253
+ obj?.discount_transfer(this.gen_discount, passport)
254
+ }
255
+ if (this?.withdraw_guard !== undefined) {
256
+ switch(this.withdraw_guard.op) {
257
+ case 'add':
258
+ obj?.add_withdraw_guards(this.withdraw_guard.guards, passport)
259
+ break;
260
+ case 'set':
261
+ obj?.remove_withdraw_guards([], true, passport)
262
+ obj?.add_withdraw_guards(this.withdraw_guard.guards, passport)
263
+ break;
264
+ case 'remove':
265
+ obj?.remove_withdraw_guards(this.withdraw_guard.addresses, false, passport)
266
+ break;
267
+ case 'removeall':
268
+ obj?.remove_withdraw_guards([], true, passport)
269
+ break;
270
+ }
271
+ }
272
+
273
+ if (this?.sales !== undefined) {
274
+ switch(this.sales.op) {
275
+ case 'add':
276
+ obj?.add_sales(this.sales.sales, false, passport)
277
+ break;
278
+ case 'remove':
279
+ obj?.remove_sales(this.sales.sales_name, passport)
280
+ break;
281
+ }
282
+ }
283
+ if (this?.order_new !== undefined) {
284
+ let b = BigInt(0); let coin : any;
285
+ this.order_new.buy_items.forEach(v => {
286
+ b += BigInt(v.max_price) * BigInt(v.count)
287
+ })
288
+ if (b > BigInt(0)) {
289
+ if (this?.type_parameter === '0x2::sui::SUI' || this?.type_parameter === '0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI') {
290
+ coin = txb.splitCoins(txb.gas, [b])[0];
291
+ } else if (this?.order_new.coin_object) {
292
+ coin = txb.splitCoins(this.order_new.coin_object, [b])[0];
293
+ }
294
+ }
295
+
296
+ if (coin) {
297
+ //@ crypto tools support
298
+ obj?.buy(this.order_new.buy_items, coin, this.order_new.discount, this.order_new.machine, this.order_new.customer_info_crypto, passport)
299
+ }
300
+ }
301
+ if (this?.order_payer !== undefined && obj) {
302
+ obj?.change_order_payer(this?.order_payer.order, this.order_payer.payer_new)
303
+ }
304
+ if (this?.order_agent !== undefined) {
305
+ obj?.set_order_agent(this.order_agent.order, this.order_agent.agents, this.order_agent.progress)
306
+ }
307
+ if (this?.order_required_info !== undefined) {
308
+ obj?.update_order_required_info(this.order_required_info.order, this.order_required_info.info)
309
+ }
310
+ if (this?.order_refund !== undefined) {
311
+ if ((this?.order_refund as any)?.arb && (this?.order_refund as any)?.arb_token_type) {
312
+ obj?.refund_withArb(this.order_refund.order, (this?.order_refund as any)?.arb, (this?.order_refund as any)?.arb_token_type)
313
+ } else {
314
+ obj?.refund(this.order_refund.order, (this?.order_refund as any)?.guard, passport)
315
+ }
316
+ }
317
+ if (this?.order_withdrawl !== undefined && passport) { //@ need withdrawal passport
318
+ obj?.withdraw(this.order_withdrawl.order, this.order_withdrawl.data, passport)
319
+ }
320
+ if (this?.permission_new !== undefined) {
321
+ obj?.change_permission(this.permission_new);
322
+ }
323
+ if (permission) {
324
+ permission.launch();
325
+ }
326
+ if (payee) {
327
+ payee.launch();
328
+ }
329
+ if (this.object === 'new') {
330
+ obj?.launch();
331
+ }
332
+ }
333
+ }
334
+ }