wowok 1.5.41 → 1.5.43

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",
3
- "version": "1.5.41",
3
+ "version": "1.5.43",
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/demand.ts CHANGED
@@ -67,14 +67,6 @@ export class Demand {
67
67
  })
68
68
  }
69
69
 
70
- destroy() {
71
- this.txb.moveCall({
72
- target:Protocol.Instance().DemandFn('destroy') as FnCallType,
73
- arguments: [Protocol.TXB_OBJECT(this.txb, this.object)],
74
- typeArguments:[this.bounty_type]
75
- })
76
- }
77
-
78
70
  refund(passport?:PassportObject) {
79
71
  const clock = this.txb.sharedObjectRef(Protocol.CLOCK_OBJECT);
80
72
  if (passport) {
@@ -98,19 +90,18 @@ export class Demand {
98
90
  if (!IsValidU64(time)) {
99
91
  ERROR(Errors.IsValidUint, 'time');
100
92
  }
101
- const clock = this.txb.sharedObjectRef(Protocol.CLOCK_OBJECT);
102
93
  if (passport) {
103
94
  this.txb.moveCall({
104
95
  target:Protocol.Instance().DemandFn('time_expand_with_passport') as FnCallType,
105
96
  arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.bool(minutes_duration),
106
- this.txb.pure.u64(time), this.txb.object(clock), Protocol.TXB_OBJECT(this.txb, this.permission)],
97
+ this.txb.pure.u64(time), Protocol.TXB_OBJECT(this.txb, this.permission)],
107
98
  typeArguments:[this.bounty_type],
108
99
  })
109
100
  } else {
110
101
  this.txb.moveCall({
111
102
  target:Protocol.Instance().DemandFn('time_expand') as FnCallType,
112
103
  arguments:[Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.bool(minutes_duration),
113
- this.txb.pure.u64(time), this.txb.object(clock), Protocol.TXB_OBJECT(this.txb, this.permission)],
104
+ this.txb.pure.u64(time), Protocol.TXB_OBJECT(this.txb, this.permission)],
114
105
  typeArguments:[this.bounty_type],
115
106
  })
116
107
  }
package/src/guard.ts CHANGED
@@ -23,6 +23,8 @@ export interface Guard_Options {
23
23
 
24
24
  export class Guard {
25
25
  static MAX_INPUT_LENGTH = 10240;
26
+ // static MAX_PAYLOADS_LENGTH = 4096;
27
+
26
28
  protected txb;
27
29
  protected object : TxbObject;
28
30
  get_object() { return this.object }
@@ -96,13 +98,6 @@ export class Guard {
96
98
  });
97
99
  }
98
100
 
99
- static signer_guard(txb: TransactionBlock) : GuardAddress {
100
- return txb.moveCall({
101
- target: Protocol.Instance().GuardFn('signer_guard') as FnCallType,
102
- arguments: []
103
- });
104
- }
105
-
106
101
  static everyone_guard(txb:TransactionBlock) : GuardAddress {
107
102
  return txb.moveCall({
108
103
  target: Protocol.Instance().GuardFn('everyone_guard') as FnCallType,
@@ -151,7 +146,6 @@ export class Guard {
151
146
  [MODULES.entity, 'Entity Resource', 205, [ValueType.TYPE_ADDRESS], ValueType.TYPE_ADDRESS, 'The address of a resource object created by an entity.', ['address']],
152
147
 
153
148
  [MODULES.demand, 'Permission', 300, [], ValueType.TYPE_ADDRESS, 'Permission object address.', []],
154
- [MODULES.demand, 'Has Deadline', 301, [], ValueType.TYPE_BOOL, 'Whether to set the expiration time of presenting?', []],
155
149
  [MODULES.demand, 'Deadline', 302, [], ValueType.TYPE_U64, 'The expiration time of presenting.', []],
156
150
  [MODULES.demand, 'Bounty Count', 303, [], ValueType.TYPE_U64, 'Number of Bounties.', []],
157
151
  [MODULES.demand, 'Has Guard', 304, [], ValueType.TYPE_BOOL, 'Whether the present guard is set?', []],
@@ -183,6 +177,8 @@ export class Guard {
183
177
  [MODULES.service, 'Required Info', 418, [], ValueType.TYPE_VEC_STRING, 'Names of the required information item that needs to be provided by the customer.', []],
184
178
  [MODULES.service, 'Number of Treasuries', 419, [], ValueType.TYPE_U64, 'The number of treasuries that can be externally withdrawn for purposes such as compensation or incentives.', []],
185
179
  [MODULES.service, 'Contains Treasury', 420, [ValueType.TYPE_ADDRESS], ValueType.TYPE_BOOL, 'Does it contain externally withdrawable Treasury for purposes such as compensation or incentives?', ['treasury address']],
180
+ [MODULES.service, 'Number of Arbitrations', 421, [], ValueType.TYPE_U64, 'The number of arbitrations that allows a refund to be made from the order at any time based on the arbitration result.', []],
181
+ [MODULES.service, 'Contains Arbitration', 422, [ValueType.TYPE_ADDRESS], ValueType.TYPE_BOOL, 'Does it contain an arbitration that allows a refund to be made from the order at any time based on the arbitration result.?', ['arbitration address']],
186
182
 
187
183
  [MODULES.order, 'Amount', 500, [], ValueType.TYPE_U64, 'Order amount.', []],
188
184
  [MODULES.order, 'Payer', 501, [], ValueType.TYPE_ADDRESS, 'Order payer.', []],
@@ -193,8 +189,8 @@ export class Guard {
193
189
  [MODULES.order, 'Discount Used', 506, [], ValueType.TYPE_BOOL, 'Discount coupon used for this order?', []],
194
190
  [MODULES.order, 'Discount', 507, [], ValueType.TYPE_ADDRESS, 'Discount address that already used.', []],
195
191
  [MODULES.order, 'Balance', 508, [], ValueType.TYPE_U64, 'The amount currently in the order.', []],
196
- [MODULES.order, 'Refunded', 509, [], ValueType.TYPE_BOOL, 'Whether a refund has occurred?', []],
197
- [MODULES.order, 'Withdrawed', 510, [], ValueType.TYPE_BOOL, 'Whether a service provider withdrawal has occurred?', []],
192
+ // [MODULES.order, 'Refunded', 509, [], ValueType.TYPE_BOOL, 'Whether a refund has occurred?', []],
193
+ // [MODULES.order, 'Withdrawed', 510, [], ValueType.TYPE_BOOL, 'Whether a service provider withdrawal has occurred?', []],
198
194
  [MODULES.order, 'Number of Agents', 511, [], ValueType.TYPE_U64, 'The number of agents for the order.', []],
199
195
  [MODULES.order, 'Has Agent', 512, [ValueType.TYPE_ADDRESS], ValueType.TYPE_BOOL, 'Whether an address is an order agent?', ['agent address']],
200
196
  [MODULES.order, 'Number of Disputes', 513, [], ValueType.TYPE_U64, 'Number of arbitrations for the order.', []],
@@ -587,7 +583,7 @@ export class GuardMaker {
587
583
  return this;
588
584
  }
589
585
 
590
- add_logic(type:OperatorType, logic_count?:number) : GuardMaker {
586
+ add_logic(type:OperatorType, logic_count:number=2) : GuardMaker {
591
587
  var e:any = LogicsInfo.find((v:any) => v[0] === type);
592
588
  if (e) { e=e[1] }
593
589
 
package/src/machine.ts CHANGED
@@ -238,13 +238,6 @@ export class Machine {
238
238
  });
239
239
  }
240
240
  }
241
-
242
- destroy() {
243
- this.txb.moveCall({
244
- target:Protocol.Instance().MachineFn('destroy') as FnCallType,
245
- arguments: [Protocol.TXB_OBJECT(this.txb, this.object)],
246
- })
247
- }
248
241
 
249
242
  launch() : MachineAddress {
250
243
  return this.txb.moveCall({
package/src/permission.ts CHANGED
@@ -46,6 +46,7 @@ export enum PermissionIndex {
46
46
  //service_change_order_required_pubkey = 224,
47
47
  service_pause = 225,
48
48
  service_treasury = 226,
49
+ service_arbitration = 227,
49
50
  /*
50
51
  reward = 240,
51
52
  reward_refund = 241,
@@ -166,7 +167,9 @@ export const PermissionInfo : PermissionInfoType[] = [
166
167
  //{index:PermissionIndex.service_change_order_required_pubkey, name:'Order pubkey', description:'Update Serivce order pubkey', module: 'service'},
167
168
  {index:PermissionIndex.service_pause, name:'Pause', description:'Pause/Unpause Service', module: 'service'},
168
169
  {index:PermissionIndex.service_treasury, name:'Treasury', description:'Externally withdrawable treasury for compensation or rewards', module: 'service'},
169
- /*
170
+ {index:PermissionIndex.service_arbitration, name:'Arbitration', description:'Add/Remove arbitration that allows refunds from orders at any time based on arbitration results', module: 'service'},
171
+
172
+ /*
170
173
  {index:PermissionIndex.reward, name:'reward', description:'Launch new reward', module: 'reward'},
171
174
  {index:PermissionIndex.reward_refund, name:'Refund', description:'Refund from reward', module: 'reward'},
172
175
  {index:PermissionIndex.reward_expand_time, name:'Expand deadline', description:'Expand reward deadline', module: 'reward'},
@@ -267,12 +270,6 @@ export class Permission {
267
270
  })
268
271
  }
269
272
 
270
- destroy() {
271
- this.txb.moveCall({
272
- target:Protocol.Instance().PermissionFn('destroy') as FnCallType,
273
- arguments: [Protocol.TXB_OBJECT(this.txb, this.object)],
274
- })
275
- }
276
273
  add_userdefine(index: number, name:string) {
277
274
  if (!Permission.IsValidUserDefinedIndex(index)) {
278
275
  ERROR(Errors.IsValidUserDefinedIndex, 'add_userdefine');
package/src/progress.ts CHANGED
@@ -99,14 +99,6 @@ export class Progress {
99
99
  })
100
100
  }
101
101
 
102
- destroy() {
103
-
104
- this.txb.moveCall({
105
- target:Protocol.Instance().ProgressFn('destroy') as FnCallType,
106
- arguments: [Protocol.TXB_OBJECT(this.txb, this.object)],
107
- })
108
- }
109
-
110
102
  set_namedOperator(name:string, addresses:string[], passport?:PassportObject) {
111
103
  if (!IsValidName(name)) {
112
104
  ERROR(Errors.IsValidName, 'name')
package/src/protocol.ts CHANGED
@@ -221,14 +221,14 @@ const TESTNET = {
221
221
  }
222
222
  */
223
223
  const TESTNET = {
224
- wowok: "0x95541edbae1f167f8679df2bbee57eafaf09cf81230094ffc196e78a0df200e4",
225
- wowok_origin:'0x95541edbae1f167f8679df2bbee57eafaf09cf81230094ffc196e78a0df200e4' ,
226
- base: '0x7efcdab72af2351e5915e34ad2ac8d4ea7f4f408e08138d3498af35a362db782',
227
- base_origin: '0x7efcdab72af2351e5915e34ad2ac8d4ea7f4f408e08138d3498af35a362db782',
228
-
229
- wowok_object: '0x33917cc62420ba654a0d4a0325e4d31778b12b4f736812d7427904e9911abad3',
230
- entity_object: '0xf6f8ee1a3bc19288ac1067f77eae6e72bd1887b35a0c7996635eee975d758901',
231
- treasury_cap:'0x538cf8f32d59f58c0450a3a97c1eeed3096f4ce63e07e0bdf343a5cc1464887c',
224
+ wowok: "0x5cfe867c71e4e65bbe3a1214567926a5fef8b4206f7f219bb7446bd9630f528f",
225
+ wowok_origin:'0x5cfe867c71e4e65bbe3a1214567926a5fef8b4206f7f219bb7446bd9630f528f' ,
226
+ base: '0xcabc5d750dfacb78550b812531598e02fd83650a0ea804fe48767ecca9e46b51',
227
+ base_origin: '0xcabc5d750dfacb78550b812531598e02fd83650a0ea804fe48767ecca9e46b51',
228
+
229
+ wowok_object: '0xa99cd0ef84bfe5ad9321ef6f2314c529067957fbdff0493f0f59ab7cd68d56e7',
230
+ entity_object: '0xa3fe3a125aaa73b805b65c1ca04f4936f654eed8edabbb972d0f660b1ca83b95',
231
+ treasury_cap:'0xfda28fecf646badf857e60d59797709735af2f7af7eec7a1f5c9c65f5f7554d0',
232
232
  }
233
233
  const MAINNET = {
234
234
  wowok: "",
package/src/repository.ts CHANGED
@@ -82,14 +82,6 @@ export class Repository {
82
82
  })
83
83
  }
84
84
 
85
- destroy() {
86
- if (!Protocol.IsValidObjects([this.object])) return false;
87
- this.txb.moveCall({
88
- target:Protocol.Instance().RepositoryFn('destroy') as FnCallType,
89
- arguments: [Protocol.TXB_OBJECT(this.txb, this.object)],
90
- })
91
- }
92
-
93
85
  add_data(data:Repository_Policy_Data) {
94
86
  if (!Repository.IsValidName(data.key)) {
95
87
  ERROR(Errors.IsValidName)
package/src/service.ts CHANGED
@@ -4,7 +4,9 @@ import { FnCallType, GuardObject, PassportObject, PermissionObject, RepositoryOb
4
4
  ServiceObject, DiscountObject, OrderObject, OrderAddress, CoinObject, Protocol, ValueType,
5
5
  TxbObject,
6
6
  TreasuryObject,
7
- PaymentAddress} from './protocol';
7
+ PaymentAddress,
8
+ ArbObject,
9
+ ArbitrationObject} from './protocol';
8
10
  import { ERROR, Errors } from './exception';
9
11
  import { Transaction as TransactionBlock, } from '@mysten/sui/transactions';
10
12
  import { SuiObjectData } from '@mysten/sui/client';
@@ -67,6 +69,7 @@ export interface WithdrawPayee {
67
69
  for_guard?: GuardObject,
68
70
  }
69
71
 
72
+
70
73
  export type handleDiscountObject = (owner:string, objects:(SuiObjectData|null|undefined)[]) => void;
71
74
  export class Service {
72
75
  protected pay_token_type;
@@ -128,13 +131,6 @@ export class Service {
128
131
  typeArguments:[this.pay_token_type]
129
132
  })
130
133
  }
131
- destroy() {
132
- this.txb.moveCall({
133
- target:Protocol.Instance().ServiceFn('destroy') as FnCallType,
134
- arguments: [Protocol.TXB_OBJECT(this.txb, this.object)],
135
- typeArguments:[this.pay_token_type]
136
- })
137
- }
138
134
 
139
135
  set_description(description:string, passport?:PassportObject) {
140
136
  if (!IsValidDesription(description)) {
@@ -306,7 +302,7 @@ export class Service {
306
302
  })
307
303
  }
308
304
  }
309
- repository_add(repository:RepositoryObject, passport?:PassportObject) {
305
+ add_repository(repository:RepositoryObject, passport?:PassportObject) {
310
306
  if (!Protocol.IsValidObjects([repository])) {
311
307
  ERROR(Errors.IsValidObjects, 'repository_add');
312
308
  }
@@ -325,7 +321,7 @@ export class Service {
325
321
  })
326
322
  }
327
323
  }
328
- repository_remove(repository_address:string[], removeall?:boolean, passport?:PassportObject) {
324
+ remove_repository(repository_address:string[], removeall?:boolean, passport?:PassportObject) {
329
325
  if (!removeall && repository_address.length===0) return;
330
326
 
331
327
  if (!IsValidArray(repository_address, IsValidAddress)) {
@@ -364,7 +360,64 @@ export class Service {
364
360
  }
365
361
  }
366
362
  }
367
-
363
+ add_arbitration(arbitraion:ArbitrationObject, passport?:PassportObject) {
364
+ if (!Protocol.IsValidObjects([arbitraion])) {
365
+ ERROR(Errors.IsValidObjects, 'arbitration_add');
366
+ }
367
+
368
+ if (passport) {
369
+ this.txb.moveCall({
370
+ target:Protocol.Instance().ServiceFn('arbitration_add_with_passport') as FnCallType,
371
+ arguments:[Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, arbitraion), Protocol.TXB_OBJECT(this.txb, this.permission)],
372
+ typeArguments:[this.pay_token_type]
373
+ })
374
+ } else {
375
+ this.txb.moveCall({
376
+ target:Protocol.Instance().ServiceFn('repository_add') as FnCallType,
377
+ arguments:[Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, arbitraion), Protocol.TXB_OBJECT(this.txb, this.permission)],
378
+ typeArguments:[this.pay_token_type]
379
+ })
380
+ }
381
+ }
382
+ remove_arbitration(address:string[], removeall?:boolean, passport?:PassportObject) {
383
+ if (!removeall && address.length===0) return;
384
+
385
+ if (!IsValidArray(address, IsValidAddress)) {
386
+ ERROR(Errors.IsValidArray, 'arbitration_remove.address');
387
+ }
388
+
389
+ if (passport) {
390
+ if (removeall) {
391
+ this.txb.moveCall({
392
+ target:Protocol.Instance().ServiceFn('arbitration_remove_all_with_passport') as FnCallType,
393
+ arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, this.permission)],
394
+ typeArguments:[this.pay_token_type]
395
+ })
396
+ } else {
397
+ this.txb.moveCall({
398
+ target:Protocol.Instance().ServiceFn('arbitration_remove_with_passport') as FnCallType,
399
+ arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.vector('address', array_unique(address!)),
400
+ Protocol.TXB_OBJECT(this.txb, this.permission)],
401
+ typeArguments:[this.pay_token_type]
402
+ })
403
+ }
404
+ } else {
405
+ if (removeall) {
406
+ this.txb.moveCall({
407
+ target:Protocol.Instance().ServiceFn('arbitration_remove_all') as FnCallType,
408
+ arguments:[Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, this.permission)],
409
+ typeArguments:[this.pay_token_type]
410
+ })
411
+ } else {
412
+ this.txb.moveCall({
413
+ target:Protocol.Instance().ServiceFn('arbitration_remove') as FnCallType,
414
+ arguments:[Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.vector('address', array_unique(address!)),
415
+ Protocol.TXB_OBJECT(this.txb, this.permission)],
416
+ typeArguments:[this.pay_token_type]
417
+ })
418
+ }
419
+ }
420
+ }
368
421
  add_withdraw_guards(guards:Service_Guard_Percent[], passport?:PassportObject) {
369
422
  if (guards.length === 0) return;
370
423
 
@@ -890,20 +943,37 @@ export class Service {
890
943
  }
891
944
  }
892
945
 
893
- refund(order:OrderObject, refund_guard?:string, passport?:PassportObject) {
946
+ refund_withArb(order:OrderObject, arb:ArbObject, arb_type:string) {
947
+ if (!Protocol.IsValidObjects([order, arb])) {
948
+ ERROR(Errors.IsValidObjects, 'refund_withArb.order or arb')
949
+ }
950
+ if (!IsValidTokenType(arb_type)) {
951
+ ERROR(Errors.IsValidTokenType, 'refund_withArb.arb_type')
952
+ }
953
+ const clock = this.txb.sharedObjectRef(Protocol.CLOCK_OBJECT);
954
+ this.txb.moveCall({
955
+ target:Protocol.Instance().ServiceFn('refund_with_arb') as FnCallType,
956
+ arguments:[Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, order), this.txb.object(arb), this.txb.object(clock)],
957
+ typeArguments:[this.pay_token_type, arb_type]
958
+ })
959
+ }
960
+
961
+ refund(order:OrderObject, refund_guard?:GuardObject, passport?:PassportObject) {
894
962
  if (!Protocol.IsValidObjects([order])) {
895
963
  ERROR(Errors.IsValidObjects, 'refund.order')
896
964
  }
897
- if (refund_guard && !IsValidAddress(refund_guard)) {
898
- ERROR(Errors.IsValidAddress, 'refund.refund_guard')
965
+ if (refund_guard && !Protocol.IsValidObjects([refund_guard])) {
966
+ ERROR(Errors.IsValidObjects, 'refund.refund_guard')
899
967
  }
900
968
  if (passport && !refund_guard) {
901
969
  ERROR(Errors.InvalidParam, 'refund.passport need refund_guard')
902
970
  }
971
+ const clock = this.txb.sharedObjectRef(Protocol.CLOCK_OBJECT);
903
972
  if (passport && refund_guard) {
904
973
  this.txb.moveCall({
905
974
  target:Protocol.Instance().ServiceFn('refund_with_passport') as FnCallType,
906
- arguments:[Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, order), this.txb.object(refund_guard), passport],
975
+ arguments:[Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, order), this.txb.object(refund_guard),
976
+ passport, this.txb.object(clock)],
907
977
  typeArguments:[this.pay_token_type]
908
978
  })
909
979
  } else {
@@ -1104,6 +1174,7 @@ export class Service {
1104
1174
  static MAX_TREASURY_COUNT= 8;
1105
1175
  static MAX_ORDER_AGENT_COUNT = 8;
1106
1176
  static MAX_ORDER_ARBS_COUNT = 8;
1177
+ static MAX_ARBITRATION_COUNT = 8;
1107
1178
 
1108
1179
  static IsValidItemName(name:string) : boolean {
1109
1180
  if (!name) return false;
package/src/treasury.ts CHANGED
@@ -88,14 +88,6 @@ export class Treasury {
88
88
  })
89
89
  }
90
90
 
91
- destroy() {
92
- this.txb.moveCall({
93
- target:Protocol.Instance().TreasuryFn('destroy') as FnCallType,
94
- arguments: [Protocol.TXB_OBJECT(this.txb, this.object)],
95
- typeArguments:[this.token_type]
96
- })
97
- }
98
-
99
91
  set_deposit_guard(guard?:string, passport?:PassportObject) {
100
92
  if (guard && !IsValidAddress(guard)) {
101
93
  ERROR(Errors.IsValidAddress, 'set_deposit_guard.guard')