wowok 1.6.63 → 1.6.64
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 +1 -1
- package/src/agent_call/call.ts +150 -12
- package/src/agent_query/events.ts +5 -5
- package/src/agent_query/objects.ts +66 -4
- package/src/agent_query/permission.ts +4 -7
- package/src/arbitration.ts +39 -39
- package/src/cache.ts +54 -0
- package/src/demand.ts +20 -20
- package/src/entity.ts +15 -16
- package/src/guard.ts +6 -6
- package/src/machine.ts +48 -48
- package/src/passport.ts +15 -15
- package/src/payment.ts +2 -2
- package/src/permission.ts +25 -28
- package/src/progress.ts +22 -38
- package/src/protocol.ts +60 -61
- package/src/repository.ts +31 -31
- package/src/resource.ts +17 -16
- package/src/service.ts +96 -96
- package/src/treasury.ts +30 -30
- package/src/utils.ts +11 -5
- package/src/wowok.ts +8 -8
package/src/arbitration.ts
CHANGED
|
@@ -80,13 +80,13 @@ export class Arbitration {
|
|
|
80
80
|
|
|
81
81
|
if (passport) {
|
|
82
82
|
obj.object = txb.moveCall({
|
|
83
|
-
target:Protocol.Instance().
|
|
83
|
+
target:Protocol.Instance().arbitrationFn('new_with_passport') as FnCallType,
|
|
84
84
|
arguments:[passport, txb.pure.string(description), txb.pure.u64(fee), txb.object(withdrawTreasury), Protocol.TXB_OBJECT(txb, permission)],
|
|
85
85
|
typeArguments:[pay_token_type],
|
|
86
86
|
})
|
|
87
87
|
} else {
|
|
88
88
|
obj.object = txb.moveCall({
|
|
89
|
-
target:Protocol.Instance().
|
|
89
|
+
target:Protocol.Instance().arbitrationFn('new') as FnCallType,
|
|
90
90
|
arguments:[txb.pure.string(description), txb.pure.u64(fee), txb.object(withdrawTreasury), Protocol.TXB_OBJECT(txb, permission)],
|
|
91
91
|
typeArguments:[pay_token_type],
|
|
92
92
|
})
|
|
@@ -96,7 +96,7 @@ export class Arbitration {
|
|
|
96
96
|
|
|
97
97
|
launch() : ArbitrationAddress {
|
|
98
98
|
return this.txb.moveCall({
|
|
99
|
-
target:Protocol.Instance().
|
|
99
|
+
target:Protocol.Instance().arbitrationFn('create') as FnCallType,
|
|
100
100
|
arguments:[Protocol.TXB_OBJECT(this.txb, this.object)],
|
|
101
101
|
typeArguments:[this.pay_token_type]
|
|
102
102
|
})
|
|
@@ -109,13 +109,13 @@ export class Arbitration {
|
|
|
109
109
|
|
|
110
110
|
if (passport) {
|
|
111
111
|
this.txb.moveCall({
|
|
112
|
-
target:Protocol.Instance().
|
|
112
|
+
target:Protocol.Instance().arbitrationFn('description_set_with_passport') as FnCallType,
|
|
113
113
|
arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.string(description), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
114
114
|
typeArguments:[this.pay_token_type]
|
|
115
115
|
})
|
|
116
116
|
} else {
|
|
117
117
|
this.txb.moveCall({
|
|
118
|
-
target:Protocol.Instance().
|
|
118
|
+
target:Protocol.Instance().arbitrationFn('description_set') as FnCallType,
|
|
119
119
|
arguments:[Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.string(description), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
120
120
|
typeArguments:[this.pay_token_type]
|
|
121
121
|
})
|
|
@@ -129,13 +129,13 @@ export class Arbitration {
|
|
|
129
129
|
|
|
130
130
|
if (passport) {
|
|
131
131
|
this.txb.moveCall({
|
|
132
|
-
target:Protocol.Instance().
|
|
132
|
+
target:Protocol.Instance().arbitrationFn('fee_set_with_passport') as FnCallType,
|
|
133
133
|
arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.u64(fee), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
134
134
|
typeArguments:[this.pay_token_type]
|
|
135
135
|
})
|
|
136
136
|
} else {
|
|
137
137
|
this.txb.moveCall({
|
|
138
|
-
target:Protocol.Instance().
|
|
138
|
+
target:Protocol.Instance().arbitrationFn('fee_set') as FnCallType,
|
|
139
139
|
arguments:[Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.u64(fee), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
140
140
|
typeArguments:[this.pay_token_type]
|
|
141
141
|
})
|
|
@@ -150,13 +150,13 @@ export class Arbitration {
|
|
|
150
150
|
if (passport) {
|
|
151
151
|
if (endpoint) {
|
|
152
152
|
this.txb.moveCall({
|
|
153
|
-
target:Protocol.Instance().
|
|
153
|
+
target:Protocol.Instance().arbitrationFn('endpoint_set_with_passport') as FnCallType,
|
|
154
154
|
arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.string(endpoint), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
155
155
|
typeArguments:[this.pay_token_type]
|
|
156
156
|
})
|
|
157
157
|
} else {
|
|
158
158
|
this.txb.moveCall({
|
|
159
|
-
target:Protocol.Instance().
|
|
159
|
+
target:Protocol.Instance().arbitrationFn('endpoint_none_with_passport') as FnCallType,
|
|
160
160
|
arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
161
161
|
typeArguments:[this.pay_token_type]
|
|
162
162
|
})
|
|
@@ -164,13 +164,13 @@ export class Arbitration {
|
|
|
164
164
|
} else {
|
|
165
165
|
if (endpoint) {
|
|
166
166
|
this.txb.moveCall({
|
|
167
|
-
target:Protocol.Instance().
|
|
167
|
+
target:Protocol.Instance().arbitrationFn('endpoint_set') as FnCallType,
|
|
168
168
|
arguments:[Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.string(endpoint), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
169
169
|
typeArguments:[this.pay_token_type]
|
|
170
170
|
})
|
|
171
171
|
} else {
|
|
172
172
|
this.txb.moveCall({
|
|
173
|
-
target:Protocol.Instance().
|
|
173
|
+
target:Protocol.Instance().arbitrationFn('endpoint_none') as FnCallType,
|
|
174
174
|
arguments:[Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
175
175
|
typeArguments:[this.pay_token_type]
|
|
176
176
|
})
|
|
@@ -186,7 +186,7 @@ export class Arbitration {
|
|
|
186
186
|
if (passport) {
|
|
187
187
|
guard.forEach(v => {
|
|
188
188
|
this.txb.moveCall({
|
|
189
|
-
target:Protocol.Instance().
|
|
189
|
+
target:Protocol.Instance().arbitrationFn('voting_guard_add_with_passport') as FnCallType,
|
|
190
190
|
arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object), this.txb.object(v.guard),
|
|
191
191
|
this.txb.pure.u64(v.voting_weight), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
192
192
|
typeArguments:[this.pay_token_type]
|
|
@@ -195,7 +195,7 @@ export class Arbitration {
|
|
|
195
195
|
} else {
|
|
196
196
|
guard.forEach(v => {
|
|
197
197
|
this.txb.moveCall({
|
|
198
|
-
target:Protocol.Instance().
|
|
198
|
+
target:Protocol.Instance().arbitrationFn('voting_guard_add') as FnCallType,
|
|
199
199
|
arguments:[Protocol.TXB_OBJECT(this.txb, this.object), this.txb.object(v.guard),
|
|
200
200
|
this.txb.pure.u64(v.voting_weight), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
201
201
|
typeArguments:[this.pay_token_type]
|
|
@@ -213,13 +213,13 @@ export class Arbitration {
|
|
|
213
213
|
if (passport) {
|
|
214
214
|
if (removeall) {
|
|
215
215
|
this.txb.moveCall({
|
|
216
|
-
target:Protocol.Instance().
|
|
216
|
+
target:Protocol.Instance().arbitrationFn('voting_guard_removeall_with_passport') as FnCallType,
|
|
217
217
|
arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
218
218
|
typeArguments:[this.pay_token_type]
|
|
219
219
|
})
|
|
220
220
|
} else {
|
|
221
221
|
this.txb.moveCall({
|
|
222
|
-
target:Protocol.Instance().
|
|
222
|
+
target:Protocol.Instance().arbitrationFn('voting_guard_remove_with_passport') as FnCallType,
|
|
223
223
|
arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.vector('address', guard),
|
|
224
224
|
Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
225
225
|
typeArguments:[this.pay_token_type]
|
|
@@ -228,13 +228,13 @@ export class Arbitration {
|
|
|
228
228
|
} else {
|
|
229
229
|
if (removeall) {
|
|
230
230
|
this.txb.moveCall({
|
|
231
|
-
target:Protocol.Instance().
|
|
231
|
+
target:Protocol.Instance().arbitrationFn('voting_guard_removeall') as FnCallType,
|
|
232
232
|
arguments:[Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
233
233
|
typeArguments:[this.pay_token_type]
|
|
234
234
|
})
|
|
235
235
|
} else {
|
|
236
236
|
this.txb.moveCall({
|
|
237
|
-
target:Protocol.Instance().
|
|
237
|
+
target:Protocol.Instance().arbitrationFn('voting_guard_remove') as FnCallType,
|
|
238
238
|
arguments:[Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.vector('address', guard),
|
|
239
239
|
Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
240
240
|
typeArguments:[this.pay_token_type]
|
|
@@ -251,13 +251,13 @@ export class Arbitration {
|
|
|
251
251
|
if (passport) {
|
|
252
252
|
if (apply_guard) {
|
|
253
253
|
this.txb.moveCall({
|
|
254
|
-
target:Protocol.Instance().
|
|
254
|
+
target:Protocol.Instance().arbitrationFn('usage_guard_set_with_passport') as FnCallType,
|
|
255
255
|
arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object), this.txb.object(apply_guard), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
256
256
|
typeArguments:[this.pay_token_type]
|
|
257
257
|
})
|
|
258
258
|
} else {
|
|
259
259
|
this.txb.moveCall({
|
|
260
|
-
target:Protocol.Instance().
|
|
260
|
+
target:Protocol.Instance().arbitrationFn('usage_guard_none_with_passport') as FnCallType,
|
|
261
261
|
arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
262
262
|
typeArguments:[this.pay_token_type]
|
|
263
263
|
})
|
|
@@ -265,13 +265,13 @@ export class Arbitration {
|
|
|
265
265
|
} else {
|
|
266
266
|
if (apply_guard) {
|
|
267
267
|
this.txb.moveCall({
|
|
268
|
-
target:Protocol.Instance().
|
|
268
|
+
target:Protocol.Instance().arbitrationFn('usage_guard_set') as FnCallType,
|
|
269
269
|
arguments:[Protocol.TXB_OBJECT(this.txb, this.object), this.txb.object(apply_guard), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
270
270
|
typeArguments:[this.pay_token_type]
|
|
271
271
|
})
|
|
272
272
|
} else {
|
|
273
273
|
this.txb.moveCall({
|
|
274
|
-
target:Protocol.Instance().
|
|
274
|
+
target:Protocol.Instance().arbitrationFn('usage_guard_none') as FnCallType,
|
|
275
275
|
arguments:[Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
276
276
|
typeArguments:[this.pay_token_type]
|
|
277
277
|
})
|
|
@@ -281,13 +281,13 @@ export class Arbitration {
|
|
|
281
281
|
pause(pause:boolean, passport?:PassportObject) {
|
|
282
282
|
if (passport) {
|
|
283
283
|
this.txb.moveCall({
|
|
284
|
-
target:Protocol.Instance().
|
|
284
|
+
target:Protocol.Instance().arbitrationFn('pause_with_passport') as FnCallType,
|
|
285
285
|
arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.bool(pause), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
286
286
|
typeArguments:[this.pay_token_type]
|
|
287
287
|
})
|
|
288
288
|
} else {
|
|
289
289
|
this.txb.moveCall({
|
|
290
|
-
target:Protocol.Instance().
|
|
290
|
+
target:Protocol.Instance().arbitrationFn('pause') as FnCallType,
|
|
291
291
|
arguments:[Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.bool(pause), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
292
292
|
typeArguments:[this.pay_token_type]
|
|
293
293
|
})
|
|
@@ -308,7 +308,7 @@ export class Arbitration {
|
|
|
308
308
|
if (passport) {
|
|
309
309
|
if (param.voting_guard) {
|
|
310
310
|
this.txb.moveCall({
|
|
311
|
-
target:Protocol.Instance().
|
|
311
|
+
target:Protocol.Instance().arbitrationFn('vote_with_passport') as FnCallType,
|
|
312
312
|
arguments:[passport, this.txb.object(param.voting_guard), Protocol.TXB_OBJECT(this.txb, this.object),
|
|
313
313
|
this.txb.object(param.arb), this.txb.pure.vector('u8', param.agrees),
|
|
314
314
|
this.txb.object(clock), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
@@ -316,7 +316,7 @@ export class Arbitration {
|
|
|
316
316
|
})
|
|
317
317
|
} else {
|
|
318
318
|
this.txb.moveCall({
|
|
319
|
-
target:Protocol.Instance().
|
|
319
|
+
target:Protocol.Instance().arbitrationFn('vote2_with_passport') as FnCallType,
|
|
320
320
|
arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object), this.txb.object(param.arb), this.txb.pure.vector('u8', param.agrees),
|
|
321
321
|
this.txb.object(clock), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
322
322
|
typeArguments:[this.pay_token_type]
|
|
@@ -324,7 +324,7 @@ export class Arbitration {
|
|
|
324
324
|
}
|
|
325
325
|
} else {
|
|
326
326
|
this.txb.moveCall({
|
|
327
|
-
target:Protocol.Instance().
|
|
327
|
+
target:Protocol.Instance().arbitrationFn('vote') as FnCallType,
|
|
328
328
|
arguments:[Protocol.TXB_OBJECT(this.txb, this.object), this.txb.object(param.arb), this.txb.pure.vector('u8', param.agrees),
|
|
329
329
|
this.txb.object(clock), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
330
330
|
typeArguments:[this.pay_token_type]
|
|
@@ -347,14 +347,14 @@ export class Arbitration {
|
|
|
347
347
|
|
|
348
348
|
if (passport) {
|
|
349
349
|
this.txb.moveCall({
|
|
350
|
-
target:Protocol.Instance().
|
|
350
|
+
target:Protocol.Instance().arbitrationFn('arbitration_with_passport') as FnCallType,
|
|
351
351
|
arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object),
|
|
352
352
|
this.txb.object(param.arb), this.txb.pure.string(param.feedback), ind, Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
353
353
|
typeArguments:[this.pay_token_type]
|
|
354
354
|
})
|
|
355
355
|
} else {
|
|
356
356
|
this.txb.moveCall({
|
|
357
|
-
target:Protocol.Instance().
|
|
357
|
+
target:Protocol.Instance().arbitrationFn('arbitration') as FnCallType,
|
|
358
358
|
arguments:[Protocol.TXB_OBJECT(this.txb, this.object),
|
|
359
359
|
this.txb.object(param.arb), this.txb.pure.string(param.feedback), ind, Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
360
360
|
typeArguments:[this.pay_token_type]
|
|
@@ -384,7 +384,7 @@ export class Arbitration {
|
|
|
384
384
|
if (passport) {
|
|
385
385
|
if (param.for_guard) {
|
|
386
386
|
return this.txb.moveCall({
|
|
387
|
-
target:Protocol.Instance().
|
|
387
|
+
target:Protocol.Instance().arbitrationFn('withdraw_forGuard_with_passport') as FnCallType,
|
|
388
388
|
arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object), this.txb.object(arb), this.txb.object(param.treasury),
|
|
389
389
|
for_obj, this.txb.object(param.for_guard), this.txb.pure.u64(param.index), this.txb.pure.string(param.remark), this.txb.object(clock),
|
|
390
390
|
Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
@@ -392,7 +392,7 @@ export class Arbitration {
|
|
|
392
392
|
})
|
|
393
393
|
} else {
|
|
394
394
|
return this.txb.moveCall({
|
|
395
|
-
target:Protocol.Instance().
|
|
395
|
+
target:Protocol.Instance().arbitrationFn('withdraw_with_passport') as FnCallType,
|
|
396
396
|
arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object), this.txb.object(arb), this.txb.object(param.treasury),
|
|
397
397
|
for_obj, this.txb.pure.u64(param.index), this.txb.pure.string(param.remark), this.txb.object(clock), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
398
398
|
typeArguments:[this.pay_token_type]
|
|
@@ -401,7 +401,7 @@ export class Arbitration {
|
|
|
401
401
|
} else {
|
|
402
402
|
if (param.for_guard) {
|
|
403
403
|
return this.txb.moveCall({
|
|
404
|
-
target:Protocol.Instance().
|
|
404
|
+
target:Protocol.Instance().arbitrationFn('withdraw_forGuard') as FnCallType,
|
|
405
405
|
arguments:[Protocol.TXB_OBJECT(this.txb, this.object), this.txb.object(arb), this.txb.object(param.treasury),
|
|
406
406
|
for_obj, this.txb.object(param.for_guard), this.txb.pure.u64(param.index), this.txb.pure.string(param.remark), this.txb.object(clock),
|
|
407
407
|
Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
@@ -409,7 +409,7 @@ export class Arbitration {
|
|
|
409
409
|
})
|
|
410
410
|
} else {
|
|
411
411
|
return this.txb.moveCall({
|
|
412
|
-
target:Protocol.Instance().
|
|
412
|
+
target:Protocol.Instance().arbitrationFn('withdraw') as FnCallType,
|
|
413
413
|
arguments:[Protocol.TXB_OBJECT(this.txb, this.object), this.txb.object(arb), this.txb.object(param.treasury),
|
|
414
414
|
for_obj, this.txb.pure.u64(param.index), this.txb.pure.string(param.remark), this.txb.object(clock), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
415
415
|
typeArguments:[this.pay_token_type]
|
|
@@ -424,14 +424,14 @@ export class Arbitration {
|
|
|
424
424
|
}
|
|
425
425
|
if (passport) {
|
|
426
426
|
this.txb.moveCall({
|
|
427
|
-
target:Protocol.Instance().
|
|
427
|
+
target:Protocol.Instance().arbitrationFn('withdraw_treasury_set_with_passport') as FnCallType,
|
|
428
428
|
arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object),
|
|
429
429
|
this.txb.object(treasury), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
430
430
|
typeArguments:[this.pay_token_type]
|
|
431
431
|
})
|
|
432
432
|
} else {
|
|
433
433
|
this.txb.moveCall({
|
|
434
|
-
target:Protocol.Instance().
|
|
434
|
+
target:Protocol.Instance().arbitrationFn('withdraw_treasury_set') as FnCallType,
|
|
435
435
|
arguments:[Protocol.TXB_OBJECT(this.txb, this.object),
|
|
436
436
|
this.txb.object(treasury), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
437
437
|
typeArguments:[this.pay_token_type]
|
|
@@ -456,14 +456,14 @@ export class Arbitration {
|
|
|
456
456
|
if (passport) {
|
|
457
457
|
if (param.fee) {
|
|
458
458
|
return this.txb.moveCall({
|
|
459
|
-
target:Protocol.Instance().
|
|
459
|
+
target:Protocol.Instance().arbitrationFn('dispute_with_passport') as FnCallType,
|
|
460
460
|
arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object), this.txb.object(param.order), this.txb.pure.string(param.description),
|
|
461
461
|
this.txb.pure.vector('string', array_unique(param.votable_proposition)), this.txb.object(param.fee)],
|
|
462
462
|
typeArguments:[this.pay_token_type, param.order_token_type]
|
|
463
463
|
})
|
|
464
464
|
} else {
|
|
465
465
|
return this.txb.moveCall({
|
|
466
|
-
target:Protocol.Instance().
|
|
466
|
+
target:Protocol.Instance().arbitrationFn('free_dispute_with_passport') as FnCallType,
|
|
467
467
|
arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object), this.txb.object(param.order), this.txb.pure.string(param.description),
|
|
468
468
|
this.txb.pure.vector('string', array_unique(param.votable_proposition))],
|
|
469
469
|
typeArguments:[this.pay_token_type, param.order_token_type]
|
|
@@ -472,14 +472,14 @@ export class Arbitration {
|
|
|
472
472
|
} else {
|
|
473
473
|
if (param.fee) {
|
|
474
474
|
return this.txb.moveCall({
|
|
475
|
-
target:Protocol.Instance().
|
|
475
|
+
target:Protocol.Instance().arbitrationFn('dispute') as FnCallType,
|
|
476
476
|
arguments:[Protocol.TXB_OBJECT(this.txb, this.object), this.txb.object(param.order), this.txb.pure.string(param.description),
|
|
477
477
|
this.txb.pure.vector('string', array_unique(param.votable_proposition)), this.txb.object(param.fee)],
|
|
478
478
|
typeArguments:[this.pay_token_type, param.order_token_type]
|
|
479
479
|
})
|
|
480
480
|
} else {
|
|
481
481
|
return this.txb.moveCall({
|
|
482
|
-
target:Protocol.Instance().
|
|
482
|
+
target:Protocol.Instance().arbitrationFn('free_dispute') as FnCallType,
|
|
483
483
|
arguments:[Protocol.TXB_OBJECT(this.txb, this.object), this.txb.object(param.order), this.txb.pure.string(param.description),
|
|
484
484
|
this.txb.pure.vector('string', array_unique(param.votable_proposition))],
|
|
485
485
|
typeArguments:[this.pay_token_type, param.order_token_type]
|
|
@@ -494,7 +494,7 @@ export class Arbitration {
|
|
|
494
494
|
}
|
|
495
495
|
|
|
496
496
|
this.txb.moveCall({
|
|
497
|
-
target:Protocol.Instance().
|
|
497
|
+
target:Protocol.Instance().arbitrationFn('permission_set') as FnCallType,
|
|
498
498
|
arguments: [Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, this.permission), Protocol.TXB_OBJECT(this.txb, new_permission)],
|
|
499
499
|
typeArguments:[this.pay_token_type]
|
|
500
500
|
})
|
package/src/cache.ts
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
|
|
2
|
+
import { Protocol } from "./protocol";
|
|
3
|
+
|
|
4
|
+
export abstract class CacheData {
|
|
5
|
+
constructor(expire: number) { this.expire = expire; } // 10m default
|
|
6
|
+
abstract load(key: string) : string | null | undefined;
|
|
7
|
+
abstract save(key: string, data:string) : void;
|
|
8
|
+
expire_time() {return this.expire};
|
|
9
|
+
protected expire;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export const OBJECT_KEY = (object: string) : string => {
|
|
13
|
+
return object + Protocol.Instance().package('wowok_origin') + 'V2';
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export class MemeryCache extends CacheData {
|
|
17
|
+
constructor(expire: number = 10000) {super(expire)}
|
|
18
|
+
protected data = new Map<string, string>;
|
|
19
|
+
load(key: string) : string | null | undefined {
|
|
20
|
+
return this.data.get(key)
|
|
21
|
+
}
|
|
22
|
+
save(key: string, data:string) : void {
|
|
23
|
+
this.data.set(key, data);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export class LocalStorageCache extends CacheData {
|
|
28
|
+
constructor(expire: number = 10000) {super(expire)}
|
|
29
|
+
load(key: string) : string | null | undefined {
|
|
30
|
+
return localStorage.getItem(key)
|
|
31
|
+
}
|
|
32
|
+
save(key: string, data:string) : void {
|
|
33
|
+
return localStorage.setItem(key, data)
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export class WowokCache {
|
|
38
|
+
static _instance: any;
|
|
39
|
+
private cache: any;
|
|
40
|
+
|
|
41
|
+
constructor() {}
|
|
42
|
+
static Instance() : WowokCache {
|
|
43
|
+
if (!WowokCache._instance) {
|
|
44
|
+
WowokCache._instance = new WowokCache();
|
|
45
|
+
}; return WowokCache._instance
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
set(cache:CacheData) {
|
|
49
|
+
this.cache = cache;
|
|
50
|
+
}
|
|
51
|
+
get() : CacheData {
|
|
52
|
+
return this.cache;
|
|
53
|
+
}
|
|
54
|
+
}
|
package/src/demand.ts
CHANGED
|
@@ -43,14 +43,14 @@ export class Demand {
|
|
|
43
43
|
const clock = txb.sharedObjectRef(Protocol.CLOCK_OBJECT);
|
|
44
44
|
if (passport) {
|
|
45
45
|
d.object = txb.moveCall({
|
|
46
|
-
target:Protocol.Instance().
|
|
46
|
+
target:Protocol.Instance().demandFn('new_with_passport') as FnCallType,
|
|
47
47
|
arguments:[passport, txb.pure.string(description), txb.object(bounty), txb.pure.bool(ms_expand), txb.pure.u64(time),
|
|
48
48
|
txb.object(clock), Protocol.TXB_OBJECT(txb, permission)],
|
|
49
49
|
typeArguments:[bounty_type],
|
|
50
50
|
})
|
|
51
51
|
} else {
|
|
52
52
|
d.object = txb.moveCall({
|
|
53
|
-
target:Protocol.Instance().
|
|
53
|
+
target:Protocol.Instance().demandFn('new') as FnCallType,
|
|
54
54
|
arguments:[txb.pure.string(description), txb.object(bounty), txb.pure.bool(ms_expand), txb.pure.u64(time),
|
|
55
55
|
txb.object(clock), Protocol.TXB_OBJECT(txb, permission)],
|
|
56
56
|
typeArguments:[bounty_type],
|
|
@@ -61,7 +61,7 @@ export class Demand {
|
|
|
61
61
|
|
|
62
62
|
launch() : DemandAddress {
|
|
63
63
|
return this.txb.moveCall({
|
|
64
|
-
target:Protocol.Instance().
|
|
64
|
+
target:Protocol.Instance().demandFn('create') as FnCallType,
|
|
65
65
|
arguments:[Protocol.TXB_OBJECT(this.txb, this.object)],
|
|
66
66
|
typeArguments:[this.bounty_type],
|
|
67
67
|
})
|
|
@@ -71,14 +71,14 @@ export class Demand {
|
|
|
71
71
|
const clock = this.txb.sharedObjectRef(Protocol.CLOCK_OBJECT);
|
|
72
72
|
if (passport) {
|
|
73
73
|
this.txb.moveCall({
|
|
74
|
-
target:Protocol.Instance().
|
|
74
|
+
target:Protocol.Instance().demandFn('refund_with_passport') as FnCallType,
|
|
75
75
|
arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object),
|
|
76
76
|
this.txb.object(clock), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
77
77
|
typeArguments:[this.bounty_type],
|
|
78
78
|
})
|
|
79
79
|
} else {
|
|
80
80
|
this.txb.moveCall({
|
|
81
|
-
target:Protocol.Instance().
|
|
81
|
+
target:Protocol.Instance().demandFn('refund') as FnCallType,
|
|
82
82
|
arguments:[Protocol.TXB_OBJECT(this.txb, this.object), this.txb.object(clock), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
83
83
|
typeArguments:[this.bounty_type],
|
|
84
84
|
})
|
|
@@ -92,14 +92,14 @@ export class Demand {
|
|
|
92
92
|
}
|
|
93
93
|
if (passport) {
|
|
94
94
|
this.txb.moveCall({
|
|
95
|
-
target:Protocol.Instance().
|
|
95
|
+
target:Protocol.Instance().demandFn('time_expand_with_passport') as FnCallType,
|
|
96
96
|
arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.bool(minutes_duration),
|
|
97
97
|
this.txb.pure.u64(time), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
98
98
|
typeArguments:[this.bounty_type],
|
|
99
99
|
})
|
|
100
100
|
} else {
|
|
101
101
|
this.txb.moveCall({
|
|
102
|
-
target:Protocol.Instance().
|
|
102
|
+
target:Protocol.Instance().demandFn('time_expand') as FnCallType,
|
|
103
103
|
arguments:[Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.bool(minutes_duration),
|
|
104
104
|
this.txb.pure.u64(time), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
105
105
|
typeArguments:[this.bounty_type],
|
|
@@ -119,14 +119,14 @@ export class Demand {
|
|
|
119
119
|
if (passport) {
|
|
120
120
|
if (guard) {
|
|
121
121
|
this.txb.moveCall({
|
|
122
|
-
target:Protocol.Instance().
|
|
122
|
+
target:Protocol.Instance().demandFn('guard_set_with_passport') as FnCallType,
|
|
123
123
|
arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, guard), id,
|
|
124
124
|
Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
125
125
|
typeArguments:[this.bounty_type],
|
|
126
126
|
})
|
|
127
127
|
} else {
|
|
128
128
|
this.txb.moveCall({
|
|
129
|
-
target:Protocol.Instance().
|
|
129
|
+
target:Protocol.Instance().demandFn('guard_none_with_passport') as FnCallType,
|
|
130
130
|
arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
131
131
|
typeArguments:[this.bounty_type],
|
|
132
132
|
})
|
|
@@ -134,14 +134,14 @@ export class Demand {
|
|
|
134
134
|
} else {
|
|
135
135
|
if (guard) {
|
|
136
136
|
this.txb.moveCall({
|
|
137
|
-
target:Protocol.Instance().
|
|
137
|
+
target:Protocol.Instance().demandFn('guard_set') as FnCallType,
|
|
138
138
|
arguments:[Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, guard), id,
|
|
139
139
|
Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
140
140
|
typeArguments:[this.bounty_type],
|
|
141
141
|
})
|
|
142
142
|
} else {
|
|
143
143
|
this.txb.moveCall({
|
|
144
|
-
target:Protocol.Instance().
|
|
144
|
+
target:Protocol.Instance().demandFn('guard_none') as FnCallType,
|
|
145
145
|
arguments:[Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
146
146
|
typeArguments:[this.bounty_type],
|
|
147
147
|
})
|
|
@@ -156,14 +156,14 @@ export class Demand {
|
|
|
156
156
|
|
|
157
157
|
if (passport) {
|
|
158
158
|
this.txb.moveCall({
|
|
159
|
-
target:Protocol.Instance().
|
|
159
|
+
target:Protocol.Instance().demandFn('description_set_with_passport') as FnCallType,
|
|
160
160
|
arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.string(description),
|
|
161
161
|
Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
162
162
|
typeArguments:[this.bounty_type],
|
|
163
163
|
})
|
|
164
164
|
} else {
|
|
165
165
|
this.txb.moveCall({
|
|
166
|
-
target:Protocol.Instance().
|
|
166
|
+
target:Protocol.Instance().demandFn('description_set') as FnCallType,
|
|
167
167
|
arguments:[Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.string(description), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
168
168
|
typeArguments:[this.bounty_type],
|
|
169
169
|
})
|
|
@@ -177,7 +177,7 @@ export class Demand {
|
|
|
177
177
|
|
|
178
178
|
if (passport) {
|
|
179
179
|
this.txb.moveCall({
|
|
180
|
-
target:Protocol.Instance().
|
|
180
|
+
target:Protocol.Instance().demandFn('yes_with_passport') as FnCallType,
|
|
181
181
|
arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object),
|
|
182
182
|
this.txb.pure.address(service_address),
|
|
183
183
|
Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
@@ -185,7 +185,7 @@ export class Demand {
|
|
|
185
185
|
})
|
|
186
186
|
} else {
|
|
187
187
|
this.txb.moveCall({
|
|
188
|
-
target:Protocol.Instance().
|
|
188
|
+
target:Protocol.Instance().demandFn('yes') as FnCallType,
|
|
189
189
|
arguments:[Protocol.TXB_OBJECT(this.txb, this.object),
|
|
190
190
|
this.txb.pure.address(service_address),
|
|
191
191
|
Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
@@ -200,7 +200,7 @@ export class Demand {
|
|
|
200
200
|
}
|
|
201
201
|
|
|
202
202
|
this.txb.moveCall({
|
|
203
|
-
target:Protocol.Instance().
|
|
203
|
+
target:Protocol.Instance().demandFn('deposit') as FnCallType,
|
|
204
204
|
arguments:[Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, bounty)],
|
|
205
205
|
typeArguments:[this.bounty_type],
|
|
206
206
|
})
|
|
@@ -226,13 +226,13 @@ export class Demand {
|
|
|
226
226
|
if (passport) {
|
|
227
227
|
if (typeof(service) === 'number') {
|
|
228
228
|
this.txb.moveCall({
|
|
229
|
-
target:Protocol.Instance().
|
|
229
|
+
target:Protocol.Instance().demandFn('present_with_passport2') as FnCallType,
|
|
230
230
|
arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.string(tips)],
|
|
231
231
|
typeArguments:[this.bounty_type],
|
|
232
232
|
})
|
|
233
233
|
} else {
|
|
234
234
|
this.txb.moveCall({
|
|
235
|
-
target:Protocol.Instance().
|
|
235
|
+
target:Protocol.Instance().demandFn('present_with_passport') as FnCallType,
|
|
236
236
|
arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, service),
|
|
237
237
|
this.txb.pure.string(tips)],
|
|
238
238
|
typeArguments:[this.bounty_type, service_pay_type],
|
|
@@ -242,7 +242,7 @@ export class Demand {
|
|
|
242
242
|
} else {
|
|
243
243
|
if (typeof(service) !== 'number') {
|
|
244
244
|
this.txb.moveCall({
|
|
245
|
-
target:Protocol.Instance().
|
|
245
|
+
target:Protocol.Instance().demandFn('present') as FnCallType,
|
|
246
246
|
arguments:[Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, service),
|
|
247
247
|
this.txb.pure.string(tips)],
|
|
248
248
|
typeArguments:[this.bounty_type, service_pay_type],
|
|
@@ -256,7 +256,7 @@ export class Demand {
|
|
|
256
256
|
}
|
|
257
257
|
|
|
258
258
|
this.txb.moveCall({
|
|
259
|
-
target:Protocol.Instance().
|
|
259
|
+
target:Protocol.Instance().demandFn('permission_set') as FnCallType,
|
|
260
260
|
arguments: [Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, this.permission), Protocol.TXB_OBJECT(this.txb, new_permission)],
|
|
261
261
|
typeArguments:[this.bounty_type]
|
|
262
262
|
})
|