wowok 1.5.36 → 1.5.38

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.36",
3
+ "version": "1.5.38",
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",
@@ -38,7 +38,8 @@
38
38
  "move language",
39
39
  "move",
40
40
  "treasury",
41
- "payment"
41
+ "payment",
42
+ "arbitration"
42
43
  ],
43
44
  "author": "wowok",
44
45
  "license": "Apache-2.0",
@@ -0,0 +1,448 @@
1
+ import { IsValidArray, array_unique, IsValidTokenType, IsValidDesription, parseObjectType,
2
+ IsValidAddress, IsValidEndpoint, IsValidU64, IsValidName, } from './utils'
3
+ import { FnCallType, GuardObject, PassportObject, PermissionObject, CoinObject, Protocol,
4
+ TxbObject, ArbitrationAddress, OrderObject, ArbObject} from './protocol';
5
+ import { ERROR, Errors } from './exception';
6
+ import { Transaction as TransactionBlock, } from '@mysten/sui/transactions';
7
+
8
+ export interface VotingGuard {
9
+ guard: GuardObject,
10
+ voting_weight:string, // bigint
11
+ }
12
+
13
+ export interface Vote {
14
+ arb: ArbObject,
15
+ voting_guard?: GuardObject,
16
+ agrees: number[],
17
+ }
18
+
19
+ export interface Feedback {
20
+ arb:ArbObject,
21
+ feedback:string,
22
+ indemnity?:string, // bigint
23
+ }
24
+
25
+ export interface Dispute {
26
+ order: OrderObject,
27
+ order_token_type: string,
28
+ description: string,
29
+ votable_proposition: string[],
30
+ fee?: CoinObject,
31
+ }
32
+
33
+ export class Arbitration {
34
+ protected pay_token_type;
35
+ protected permission;
36
+ protected object : TxbObject;
37
+ protected txb;
38
+
39
+ //static token2coin = (token:string) => { return '0x2::coin::Coin<' + token + '>'};
40
+
41
+ get_pay_type() { return this.pay_token_type }
42
+ get_object() { return this.object }
43
+ private constructor(txb: TransactionBlock, pay_token_type:string, permission:PermissionObject) {
44
+ this.pay_token_type = pay_token_type
45
+ this.txb = txb
46
+ this.permission = permission
47
+ this.object = ''
48
+ }
49
+ static From(txb: TransactionBlock, token_type:string, permission:PermissionObject, object:TxbObject) : Arbitration {
50
+ let s = new Arbitration(txb, token_type, permission);
51
+ s.object = Protocol.TXB_OBJECT(txb, object);
52
+ return s
53
+ }
54
+ static New(txb: TransactionBlock, token_type:string, permission:PermissionObject, description:string,
55
+ fee:bigint, passport?:PassportObject) : Arbitration {
56
+ if (!Protocol.IsValidObjects([permission])) {
57
+ ERROR(Errors.IsValidObjects)
58
+ }
59
+ if (!IsValidTokenType(token_type)) {
60
+ ERROR(Errors.IsValidTokenType, 'New.token_type')
61
+ }
62
+ if (!IsValidDesription(description)) {
63
+ ERROR(Errors.IsValidDesription)
64
+ }
65
+ if (!IsValidU64(fee)) {
66
+ ERROR(Errors.IsValidU64, 'New.fee')
67
+ }
68
+
69
+ let pay_token_type = token_type;
70
+ let obj = new Arbitration(txb, pay_token_type, permission);
71
+
72
+ if (passport) {
73
+ obj.object = txb.moveCall({
74
+ target:Protocol.Instance().ArbitrationFn('new_with_passport') as FnCallType,
75
+ arguments:[passport, txb.pure.string(description), txb.pure.u64(fee), Protocol.TXB_OBJECT(txb, permission)],
76
+ typeArguments:[pay_token_type],
77
+ })
78
+ } else {
79
+ obj.object = txb.moveCall({
80
+ target:Protocol.Instance().ArbitrationFn('new') as FnCallType,
81
+ arguments:[txb.pure.string(description), txb.pure.u64(fee), Protocol.TXB_OBJECT(txb, permission)],
82
+ typeArguments:[pay_token_type],
83
+ })
84
+ }
85
+ return obj
86
+ }
87
+
88
+ launch() : ArbitrationAddress {
89
+ return this.txb.moveCall({
90
+ target:Protocol.Instance().ArbitrationFn('create') as FnCallType,
91
+ arguments:[Protocol.TXB_OBJECT(this.txb, this.object)],
92
+ typeArguments:[this.pay_token_type]
93
+ })
94
+ }
95
+
96
+ set_description(description:string, passport?:PassportObject) {
97
+ if (!IsValidDesription(description)) {
98
+ ERROR(Errors.IsValidDesription, 'set_description.description')
99
+ }
100
+
101
+ if (passport) {
102
+ this.txb.moveCall({
103
+ target:Protocol.Instance().ArbitrationFn('description_set_with_passport') as FnCallType,
104
+ arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.string(description), Protocol.TXB_OBJECT(this.txb, this.permission)],
105
+ typeArguments:[this.pay_token_type]
106
+ })
107
+ } else {
108
+ this.txb.moveCall({
109
+ target:Protocol.Instance().ArbitrationFn('description_set') as FnCallType,
110
+ arguments:[Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.string(description), Protocol.TXB_OBJECT(this.txb, this.permission)],
111
+ typeArguments:[this.pay_token_type]
112
+ })
113
+ }
114
+ }
115
+
116
+ set_fee(fee:bigint, passport?:PassportObject) {
117
+ if (!IsValidU64(fee)) {
118
+ ERROR(Errors.IsValidU64, 'set_fee.fee')
119
+ }
120
+
121
+ if (passport) {
122
+ this.txb.moveCall({
123
+ target:Protocol.Instance().ArbitrationFn('fee_set_with_passport') as FnCallType,
124
+ arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.u64(fee), Protocol.TXB_OBJECT(this.txb, this.permission)],
125
+ typeArguments:[this.pay_token_type]
126
+ })
127
+ } else {
128
+ this.txb.moveCall({
129
+ target:Protocol.Instance().ArbitrationFn('fee_set') as FnCallType,
130
+ arguments:[Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.u64(fee), Protocol.TXB_OBJECT(this.txb, this.permission)],
131
+ typeArguments:[this.pay_token_type]
132
+ })
133
+ }
134
+ }
135
+
136
+ set_endpoint(endpoint?:string, passport?:PassportObject) {
137
+ if (endpoint && !IsValidEndpoint(endpoint)) {
138
+ ERROR(Errors.IsValidEndpoint, 'set_endpoint.endpoint')
139
+ }
140
+
141
+ if (passport) {
142
+ if (endpoint) {
143
+ this.txb.moveCall({
144
+ target:Protocol.Instance().ArbitrationFn('endpoint_set_with_passport') as FnCallType,
145
+ arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.string(endpoint), Protocol.TXB_OBJECT(this.txb, this.permission)],
146
+ typeArguments:[this.pay_token_type]
147
+ })
148
+ } else {
149
+ this.txb.moveCall({
150
+ target:Protocol.Instance().ArbitrationFn('endpoint_none_with_passport') as FnCallType,
151
+ arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, this.permission)],
152
+ typeArguments:[this.pay_token_type]
153
+ })
154
+ }
155
+ } else {
156
+ if (endpoint) {
157
+ this.txb.moveCall({
158
+ target:Protocol.Instance().ArbitrationFn('endpoint_set') as FnCallType,
159
+ arguments:[Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.string(endpoint), Protocol.TXB_OBJECT(this.txb, this.permission)],
160
+ typeArguments:[this.pay_token_type]
161
+ })
162
+ } else {
163
+ this.txb.moveCall({
164
+ target:Protocol.Instance().ArbitrationFn('endpoint_none') as FnCallType,
165
+ arguments:[Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, this.permission)],
166
+ typeArguments:[this.pay_token_type]
167
+ })
168
+ }
169
+ }
170
+ }
171
+
172
+ add_voting_guard(guard: VotingGuard[], passport?:PassportObject) {
173
+ if (guard.length === 0) return ;
174
+ if (!IsValidArray(guard, (g:VotingGuard) => Protocol.IsValidObjects([g.guard]) && IsValidU64(g.voting_weight))) {
175
+ ERROR(Errors.IsValidArray, 'add_voting_guard.guard')
176
+ }
177
+ if (passport) {
178
+ guard.forEach(v => {
179
+ this.txb.moveCall({
180
+ target:Protocol.Instance().ArbitrationFn('voting_guard_add_with_passport') as FnCallType,
181
+ arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object), this.txb.object(v.guard),
182
+ this.txb.pure.u64(v.voting_weight), Protocol.TXB_OBJECT(this.txb, this.permission)],
183
+ typeArguments:[this.pay_token_type]
184
+ })
185
+ })
186
+ } else {
187
+ guard.forEach(v => {
188
+ this.txb.moveCall({
189
+ target:Protocol.Instance().ArbitrationFn('voting_guard_add') as FnCallType,
190
+ arguments:[Protocol.TXB_OBJECT(this.txb, this.object), this.txb.object(v.guard),
191
+ this.txb.pure.u64(v.voting_weight), Protocol.TXB_OBJECT(this.txb, this.permission)],
192
+ typeArguments:[this.pay_token_type]
193
+ })
194
+ })
195
+ }
196
+ }
197
+ remove_voting_guard(guard: string[], removeall?:boolean, passport?:PassportObject) {
198
+ if (!removeall && guard.length===0) return;
199
+
200
+ if (!IsValidArray(guard, IsValidAddress)) {
201
+ ERROR(Errors.IsValidArray, 'remove_voting_guard.guard');
202
+ }
203
+
204
+ if (passport) {
205
+ if (removeall) {
206
+ this.txb.moveCall({
207
+ target:Protocol.Instance().ArbitrationFn('voting_guard_removeall_with_passport') as FnCallType,
208
+ arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, this.permission)],
209
+ typeArguments:[this.pay_token_type]
210
+ })
211
+ } else {
212
+ this.txb.moveCall({
213
+ target:Protocol.Instance().ArbitrationFn('voting_guard_remove_with_passport') as FnCallType,
214
+ arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.vector('address', guard),
215
+ Protocol.TXB_OBJECT(this.txb, this.permission)],
216
+ typeArguments:[this.pay_token_type]
217
+ })
218
+ }
219
+ } else {
220
+ if (removeall) {
221
+ this.txb.moveCall({
222
+ target:Protocol.Instance().ArbitrationFn('voting_guard_removeall') as FnCallType,
223
+ arguments:[Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, this.permission)],
224
+ typeArguments:[this.pay_token_type]
225
+ })
226
+ } else {
227
+ this.txb.moveCall({
228
+ target:Protocol.Instance().ArbitrationFn('voting_guard_remove') as FnCallType,
229
+ arguments:[Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.vector('address', guard),
230
+ Protocol.TXB_OBJECT(this.txb, this.permission)],
231
+ typeArguments:[this.pay_token_type]
232
+ })
233
+ }
234
+ }
235
+ }
236
+
237
+ set_guard(apply_guard?:string, passport?:PassportObject) {
238
+ if (apply_guard && !IsValidAddress(apply_guard)) {
239
+ ERROR(Errors.IsValidAddress, 'set_guard.apply_guard')
240
+ }
241
+
242
+ if (passport) {
243
+ if (apply_guard) {
244
+ this.txb.moveCall({
245
+ target:Protocol.Instance().ArbitrationFn('usage_guard_set_with_passport') as FnCallType,
246
+ arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object), this.txb.object(apply_guard), Protocol.TXB_OBJECT(this.txb, this.permission)],
247
+ typeArguments:[this.pay_token_type]
248
+ })
249
+ } else {
250
+ this.txb.moveCall({
251
+ target:Protocol.Instance().ArbitrationFn('usage_guard_none_with_passport') as FnCallType,
252
+ arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, this.permission)],
253
+ typeArguments:[this.pay_token_type]
254
+ })
255
+ }
256
+ } else {
257
+ if (apply_guard) {
258
+ this.txb.moveCall({
259
+ target:Protocol.Instance().ArbitrationFn('usage_guard_set') as FnCallType,
260
+ arguments:[Protocol.TXB_OBJECT(this.txb, this.object), this.txb.object(apply_guard), Protocol.TXB_OBJECT(this.txb, this.permission)],
261
+ typeArguments:[this.pay_token_type]
262
+ })
263
+ } else {
264
+ this.txb.moveCall({
265
+ target:Protocol.Instance().ArbitrationFn('usage_guard_none') as FnCallType,
266
+ arguments:[Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, this.permission)],
267
+ typeArguments:[this.pay_token_type]
268
+ })
269
+ }
270
+ }
271
+ }
272
+ pause(pause:boolean, passport?:PassportObject) {
273
+ if (passport) {
274
+ this.txb.moveCall({
275
+ target:Protocol.Instance().ArbitrationFn('pause_with_passport') as FnCallType,
276
+ arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.bool(pause), Protocol.TXB_OBJECT(this.txb, this.permission)],
277
+ typeArguments:[this.pay_token_type]
278
+ })
279
+ } else {
280
+ this.txb.moveCall({
281
+ target:Protocol.Instance().ArbitrationFn('pause') as FnCallType,
282
+ arguments:[Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.bool(pause), Protocol.TXB_OBJECT(this.txb, this.permission)],
283
+ typeArguments:[this.pay_token_type]
284
+ })
285
+ }
286
+ }
287
+ vote(param:Vote, passport?:PassportObject) {
288
+ if (param.voting_guard && !Protocol.IsValidObjects([param.voting_guard])) {
289
+ ERROR(Errors.IsValidObjects, 'vote.param.voting_guard')
290
+ }
291
+ if (!IsValidArray(param.agrees, (v:number)=> IsValidU64(v) && v < Arbitration.MAX_PROPOSITION_COUNT)) {
292
+ ERROR(Errors.IsValidArray, 'vote.param.agrees')
293
+ }
294
+ if (!Protocol.IsValidObjects([param.arb])) {
295
+ ERROR(Errors.IsValidObjects, 'vote.param.arb')
296
+ }
297
+
298
+ const clock = this.txb.sharedObjectRef(Protocol.CLOCK_OBJECT);
299
+ if (passport) {
300
+ if (param.voting_guard) {
301
+ this.txb.moveCall({
302
+ target:Protocol.Instance().ArbitrationFn('vote_with_passport') as FnCallType,
303
+ arguments:[passport, this.txb.object(param.voting_guard), Protocol.TXB_OBJECT(this.txb, this.object),
304
+ this.txb.object(param.arb), this.txb.pure.vector('u8', param.agrees),
305
+ this.txb.object(clock), Protocol.TXB_OBJECT(this.txb, this.permission)],
306
+ typeArguments:[this.pay_token_type]
307
+ })
308
+ } else {
309
+ this.txb.moveCall({
310
+ target:Protocol.Instance().ArbitrationFn('vote2_with_passport') as FnCallType,
311
+ arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object), this.txb.object(param.arb), this.txb.pure.vector('u8', param.agrees),
312
+ this.txb.object(clock), Protocol.TXB_OBJECT(this.txb, this.permission)],
313
+ typeArguments:[this.pay_token_type]
314
+ })
315
+ }
316
+ } else {
317
+ this.txb.moveCall({
318
+ target:Protocol.Instance().ArbitrationFn('vote') as FnCallType,
319
+ arguments:[Protocol.TXB_OBJECT(this.txb, this.object), this.txb.object(param.arb), this.txb.pure.vector('u8', param.agrees),
320
+ this.txb.object(clock), Protocol.TXB_OBJECT(this.txb, this.permission)],
321
+ typeArguments:[this.pay_token_type]
322
+ })
323
+ }
324
+ }
325
+
326
+ arbitration(param:Feedback, passport?:PassportObject) {
327
+ if (!IsValidDesription(param.feedback)) {
328
+ ERROR(Errors.IsValidDesription, 'arbitration.param.feedback')
329
+ }
330
+ if (!Protocol.IsValidObjects([param.arb])) {
331
+ ERROR(Errors.IsValidObjects, 'arbitration.param.arb')
332
+ }
333
+
334
+ if (param.indemnity && !IsValidU64(param.indemnity)) {
335
+ ERROR(Errors.IsValidU64, 'arbitration.param.indemnity')
336
+ }
337
+ let ind = this.txb.pure.option('u64', param.indemnity ? param.indemnity : undefined);
338
+
339
+ if (passport) {
340
+ this.txb.moveCall({
341
+ target:Protocol.Instance().ArbitrationFn('arbitration_with_passport') as FnCallType,
342
+ arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object),
343
+ this.txb.object(param.arb), this.txb.pure.string(param.feedback), ind, Protocol.TXB_OBJECT(this.txb, this.permission)],
344
+ typeArguments:[this.pay_token_type]
345
+ })
346
+ } else {
347
+ this.txb.moveCall({
348
+ target:Protocol.Instance().ArbitrationFn('arbitration') as FnCallType,
349
+ arguments:[Protocol.TXB_OBJECT(this.txb, this.object),
350
+ this.txb.object(param.arb), this.txb.pure.string(param.feedback), ind, Protocol.TXB_OBJECT(this.txb, this.permission)],
351
+ typeArguments:[this.pay_token_type]
352
+ })
353
+ }
354
+ }
355
+
356
+ withdraw_fee(arb:ArbObject, passport?:PassportObject) {
357
+ if (!Protocol.IsValidObjects([arb])) {
358
+ ERROR(Errors.IsValidObjects, 'withdraw_fee.arb')
359
+ }
360
+ if (passport) {
361
+ this.txb.moveCall({
362
+ target:Protocol.Instance().ArbitrationFn('withdraw_with_passport') as FnCallType,
363
+ arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object),
364
+ this.txb.object(arb), Protocol.TXB_OBJECT(this.txb, this.permission)],
365
+ typeArguments:[this.pay_token_type]
366
+ })
367
+ } else {
368
+ this.txb.moveCall({
369
+ target:Protocol.Instance().ArbitrationFn('withdraw') as FnCallType,
370
+ arguments:[Protocol.TXB_OBJECT(this.txb, this.object),
371
+ this.txb.object(arb), Protocol.TXB_OBJECT(this.txb, this.permission)],
372
+ typeArguments:[this.pay_token_type]
373
+ })
374
+ }
375
+ }
376
+
377
+ dispute(param:Dispute, passport?:PassportObject) {
378
+ if (!Protocol.IsValidObjects([param.order])) {
379
+ ERROR(Errors.IsValidObjects, 'dispute.param.order')
380
+ }
381
+ if (!IsValidTokenType(param.order_token_type)) {
382
+ ERROR(Errors.IsValidTokenType, 'dispute.param.order_token_type')
383
+ }
384
+ if (!IsValidDesription(param.description)) {
385
+ ERROR(Errors.IsValidDesription, 'dispute.param.description')
386
+ }
387
+ if (!IsValidArray(param.votable_proposition, IsValidName)) {
388
+ ERROR(Errors.IsValidArray, 'dispute.param.votable_proposition')
389
+ }
390
+
391
+ if (passport) {
392
+ if (param.fee) {
393
+ this.txb.moveCall({
394
+ target:Protocol.Instance().ArbitrationFn('dispute_with_passport') as FnCallType,
395
+ arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object), this.txb.object(param.order), this.txb.pure.string(param.description),
396
+ this.txb.pure.vector('string', array_unique(param.votable_proposition)), this.txb.object(param.fee)],
397
+ typeArguments:[this.pay_token_type, param.order_token_type]
398
+ })
399
+ } else {
400
+ this.txb.moveCall({
401
+ target:Protocol.Instance().ArbitrationFn('free_dispute_with_passport') as FnCallType,
402
+ arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object), this.txb.object(param.order), this.txb.pure.string(param.description),
403
+ this.txb.pure.vector('string', array_unique(param.votable_proposition))],
404
+ typeArguments:[this.pay_token_type, param.order_token_type]
405
+ })
406
+ }
407
+ } else {
408
+ if (param.fee) {
409
+ this.txb.moveCall({
410
+ target:Protocol.Instance().ArbitrationFn('dispute') as FnCallType,
411
+ arguments:[Protocol.TXB_OBJECT(this.txb, this.object), this.txb.object(param.order), this.txb.pure.string(param.description),
412
+ this.txb.pure.vector('string', array_unique(param.votable_proposition)), this.txb.object(param.fee)],
413
+ typeArguments:[this.pay_token_type, param.order_token_type]
414
+ })
415
+ } else {
416
+ this.txb.moveCall({
417
+ target:Protocol.Instance().ArbitrationFn('free_dispute') as FnCallType,
418
+ arguments:[Protocol.TXB_OBJECT(this.txb, this.object), this.txb.object(param.order), this.txb.pure.string(param.description),
419
+ this.txb.pure.vector('string', array_unique(param.votable_proposition))],
420
+ typeArguments:[this.pay_token_type, param.order_token_type]
421
+ })
422
+ }
423
+ }
424
+ }
425
+
426
+ change_permission(new_permission:PermissionObject) {
427
+ if (!Protocol.IsValidObjects([new_permission])) {
428
+ ERROR(Errors.IsValidObjects)
429
+ }
430
+
431
+ this.txb.moveCall({
432
+ target:Protocol.Instance().ArbitrationFn('permission_set') as FnCallType,
433
+ arguments: [Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, this.permission), Protocol.TXB_OBJECT(this.txb, new_permission)],
434
+ typeArguments:[this.pay_token_type]
435
+ })
436
+ this.permission = new_permission
437
+ }
438
+
439
+ static parseObjectType = (chain_type:string | undefined | null) : string => {
440
+ return parseObjectType(chain_type, 'arbitration::Arbitration<')
441
+ }
442
+
443
+ static parseArbObjectType = (chain_type:string | undefined | null) : string => {
444
+ return parseObjectType(chain_type, 'arb::Arb<')
445
+ }
446
+ static MAX_PROPOSITION_COUNT = 16;
447
+ static MAX_VOTING_GUARD_COUNT = 16;
448
+ }
package/src/guard.ts CHANGED
@@ -1,7 +1,7 @@
1
1
 
2
2
 
3
3
  import { Protocol, LogicsInfo, GuardAddress, FnCallType, Data_Type, MODULES, ContextType, ValueType, OperatorType, TxbObject, GuardObject} from './protocol';
4
- import { concatenate, array_equal } from './utils';
4
+ import { concatenate, array_equal, ValueTypeConvert } from './utils';
5
5
  import { IsValidDesription, Bcs, IsValidInt, IsValidAddress, FirstLetterUppercase, insertAtHead } from './utils';
6
6
  import { ERROR, Errors } from './exception';
7
7
  import { Transaction as TransactionBlock } from '@mysten/sui/transactions';
@@ -195,7 +195,11 @@ export class Guard {
195
195
  [MODULES.order, 'Balance', 508, [], ValueType.TYPE_U64, 'The amount currently in the order.', []],
196
196
  [MODULES.order, 'Refunded', 509, [], ValueType.TYPE_BOOL, 'Whether a refund has occurred?', []],
197
197
  [MODULES.order, 'Withdrawed', 510, [], ValueType.TYPE_BOOL, 'Whether a service provider withdrawal has occurred?', []],
198
-
198
+ [MODULES.order, 'Number of Agents', 511, [], ValueType.TYPE_U64, 'The number of agents for the order.', []],
199
+ [MODULES.order, 'Has Agent', 512, [ValueType.TYPE_ADDRESS], ValueType.TYPE_BOOL, 'Whether an address is an order agent?', ['agent address']],
200
+ [MODULES.order, 'Number of Disputes', 513, [], ValueType.TYPE_U64, 'Number of arbitrations for the order.', []],
201
+ [MODULES.order, 'Has Arb', 514, [ValueType.TYPE_ADDRESS], ValueType.TYPE_BOOL, 'Does the order contain an Arb for arbitration?', ['arb address']],
202
+ /* @Deprecated
199
203
  [MODULES.reward, 'Permission', 600, [], ValueType.TYPE_ADDRESS, 'Permission object address.', []],
200
204
  [MODULES.reward, 'Rewards Remaining', 601, [], ValueType.TYPE_U64, 'Number of rewards to be claimed.', []],
201
205
  [MODULES.reward, 'Reward Count Supplied', 602, [], ValueType.TYPE_U64, 'Total rewards supplied.', []],
@@ -210,9 +214,8 @@ export class Guard {
210
214
  [MODULES.reward, 'Portions by A Sponsor', 611, [ValueType.TYPE_ADDRESS], ValueType.TYPE_U64, 'The portions of sponsorship reward pools for a certain address.', ['address']],
211
215
  [MODULES.reward, 'Number of Sponsors', 612, [], ValueType.TYPE_U64, 'Number of sponsors in the sponsorship reward pool.', []],
212
216
  [MODULES.reward, 'Allow Repeated Claims', 613, [], ValueType.TYPE_BOOL, 'Whether to allow repeated claims?', []],
213
-
214
- // , means that data fields and data outside the consensus policy definition are allowed to be written
215
- // , means that only data fields and data defined by the consensus policy are allowed to be written.
217
+ */
218
+
216
219
  [MODULES.machine, 'Permission', 700, [], ValueType.TYPE_ADDRESS, 'Permission object address.', []],
217
220
  [MODULES.machine, 'Paused', 701, [], ValueType.TYPE_BOOL, 'Pause the creation of new Progress?', []],
218
221
  [MODULES.machine, 'Published', 702, [], ValueType.TYPE_BOOL, 'Is it allowed to create Progress?', []],
@@ -258,7 +261,7 @@ export class Guard {
258
261
  [MODULES.wowok, 'Grantor Registration Time', 906, [ValueType.TYPE_ADDRESS], ValueType.TYPE_U64, 'Registration time of a grantor.', ['address']],
259
262
  [MODULES.wowok, 'Grantor Expired Time', 907, [ValueType.TYPE_ADDRESS], ValueType.TYPE_U64, 'The expiration time of a grantor.', ['address']],
260
263
  [MODULES.wowok, 'Grantee Object for Grantor', 908, [ValueType.TYPE_ADDRESS], ValueType.TYPE_ADDRESS, 'Grantee repository address of a grantor.', ['address']],
261
-
264
+ /* @Deprecated
262
265
  [MODULES.vote, 'Permission', 1101, [], ValueType.TYPE_ADDRESS, 'Permission object address.', []],
263
266
  [MODULES.vote, 'Be Voting', 1102, [], ValueType.TYPE_BOOL, 'Whether to start voting and options will not be changed?', []],
264
267
  [MODULES.vote, 'Deadline Locked', 1103, [], ValueType.TYPE_BOOL, 'Whether the deadline cannot be modified?', []],
@@ -282,7 +285,7 @@ export class Guard {
282
285
  [MODULES.vote, 'Top1 Option by Votes', 1121, [], ValueType.TYPE_STRING, 'The content of the voting option ranked first by the number of votes.', []],
283
286
  [MODULES.vote, 'Top1 Counts by Votes', 1122, [], ValueType.TYPE_U64, 'Number of votes for the top voting option by number of votes.', []],
284
287
  [MODULES.vote, 'Voted Time by Address', 1113, [ValueType.TYPE_ADDRESS], ValueType.TYPE_U64, 'The time of whether an address has been voted on.', ['adddress']],
285
-
288
+ */
286
289
  [MODULES.payment, 'Sender', 1200, [], ValueType.TYPE_ADDRESS, 'Payment originator address.', []],
287
290
  [MODULES.payment, 'Total Amount', 1201, [], ValueType.TYPE_U128, "Payment amount.", []],
288
291
  [MODULES.payment, 'Remark', 1202, [], ValueType.TYPE_STRING, 'Payment remark.', ['address']],
@@ -298,22 +301,6 @@ export class Guard {
298
301
  [MODULES.payment, 'Treasury Address', 1212, [], ValueType.TYPE_ADDRESS, 'The Treasury from which the payment comes.', []],
299
302
  [MODULES.payment, 'Biz-ID', 1213, [], ValueType.TYPE_U64, 'Bisiness ID number of the payment.', []],
300
303
 
301
- [MODULES.reward, 'Amount', 1300, [], ValueType.TYPE_U64, 'Total amount deposited with reward.' , []],
302
- [MODULES.reward, 'Original Type Deposited', 1301, [], ValueType.TYPE_STRING, "Original type name of asserts deposited.", []],
303
- [MODULES.reward, 'Original Package', 1302, [], ValueType.TYPE_ADDRESS, 'Original package address of asserts deposited.', []],
304
- [MODULES.reward, 'Original Module', 1303, [], ValueType.TYPE_STRING, 'Original module name of asserts deposited.', []],
305
- [MODULES.reward, 'Type Deposited', 1304, [], ValueType.TYPE_STRING, 'Type name of asserts deposited.', []],
306
- [MODULES.reward, 'Package', 1305, [], ValueType.TYPE_ADDRESS, 'Package address of asserts deposited.', , []],
307
- [MODULES.reward, 'Module', 1306, [], ValueType.TYPE_STRING, 'Module name of asserts deposited.', []],
308
- [MODULES.reward, 'Balance', 1307, [], ValueType.TYPE_U64, 'The amount currently remaining in reward.', []],
309
- [MODULES.reward, 'Deposit Time', 1308, [], ValueType.TYPE_U64, 'Deposit time.', []],
310
- [MODULES.reward, 'Be Withdrawable', 1309, [], ValueType.TYPE_BOOL, 'Whether to allow amount withdrawal?' , []],
311
- [MODULES.reward, 'Be Deposited from', 1310, [], ValueType.TYPE_BOOL, 'Is the deposit from source set?', []],
312
- [MODULES.reward, 'Deposited from Object', 1311, [], ValueType.TYPE_ADDRESS, 'The source object set when depositing.', []],
313
- [MODULES.reward, 'Contains Guard', 1312, [ValueType.TYPE_ADDRESS], ValueType.TYPE_BOOL, 'Whether the guard for withdrawal is set up?', []],
314
- [MODULES.reward, 'Withdrawal percentage', 1313, [ValueType.TYPE_ADDRESS], ValueType.TYPE_U8, 'The percentage of withdrawals corresponding to Guard.', ['address']],
315
- [MODULES.reward, 'Number of withdrawals', 1314, [ValueType.TYPE_ADDRESS], ValueType.TYPE_U64, 'Number of withdrawals.'],
316
-
317
304
  [MODULES.treasury, 'Permission', 1400, [], ValueType.TYPE_ADDRESS, 'Permission object address.', []],
318
305
  [MODULES.treasury, 'Balance', 1401, [], ValueType.TYPE_U64, "Treasury balance.", []],
319
306
  [MODULES.treasury, 'Number of Flow Records', 1402, [], ValueType.TYPE_U64, 'Number of treasury transactions.', []],
@@ -344,12 +331,12 @@ export class Guard {
344
331
  [MODULES.treasury, 'Operation at Least Times by a Signer', 1427, [ValueType.TYPE_U8, ValueType.TYPE_ADDRESS, ValueType.TYPE_U8], ValueType.TYPE_BOOL, 'Does it operate at least a certain number of times by a signer?', ['operation', 'signer address', 'at least times']],
345
332
 
346
333
  [MODULES.arbitration, 'Permission', 1500, [], ValueType.TYPE_ADDRESS, 'Permission object address.', []],
347
- [MODULES.arbitration, 'Published', 1501, [], ValueType.TYPE_BOOL, "Is it allowed to create Arb?", []],
334
+ [MODULES.arbitration, 'Paused', 1501, [], ValueType.TYPE_BOOL, "Is it allowed to create Arb?", []],
348
335
  [MODULES.arbitration, 'Fee', 1502, [], ValueType.TYPE_U64, 'Cost of arbitration.', []],
349
336
  [MODULES.arbitration, 'Has Endpoint', 1503, [], ValueType.TYPE_BOOL, 'Is the endpoint set?', []],
350
337
  [MODULES.arbitration, 'Endpoint', 1504, [], ValueType.TYPE_STRING, 'Endpoint url/ipfs.', []],
351
- [MODULES.arbitration, 'Has Guard', 1505, [], ValueType.TYPE_BOOL, 'Is there Guard set to apply for arbitration?', []],
352
- [MODULES.arbitration, 'Guard', 1506, [], ValueType.TYPE_ADDRESS, 'Guard to apply for arbitration.', []],
338
+ [MODULES.arbitration, 'Has Customer Guard', 1505, [], ValueType.TYPE_BOOL, 'Is there Guard set to apply for arbitration?', []],
339
+ [MODULES.arbitration, 'Customer Guard', 1506, [], ValueType.TYPE_ADDRESS, 'Guard to apply for arbitration.', []],
353
340
  [MODULES.arbitration, 'Number of Voting Guard', 1507, [], ValueType.TYPE_U64, 'Number of voting guards.', []],
354
341
  [MODULES.arbitration, 'Has Voting Guard', 1508, [ValueType.TYPE_ADDRESS], ValueType.TYPE_BOOL, 'Has the voting Guard added?', ['guard address']],
355
342
  [MODULES.arbitration, 'Voting Weight', 1509, [ValueType.TYPE_ADDRESS], ValueType.TYPE_U64, 'Voting weight of the voting Guard.', ['guard address']],
package/src/index.ts CHANGED
@@ -4,15 +4,15 @@ export * from './utils'
4
4
  export * from './permission'
5
5
  export * from './guard'
6
6
  export * from './repository'
7
- export * from './vote'
8
7
  export * from './protocol'
9
8
  export * from './passport'
10
9
  export * from './machine'
11
10
  export * from './service'
12
- export * from './graphql'
13
11
  export * from './entity'
14
12
  export * from './wowok'
15
13
  export * from './resource'
16
14
  export * from './treasury'
17
15
  export * from './payment'
18
- export * from './reward'
16
+ export * from './arbitration'
17
+ // export * from './reward'
18
+ // export * from './vote'