wowok 1.5.41 → 1.5.44
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/demand.ts +2 -11
- package/src/guard.ts +13 -15
- package/src/machine.ts +0 -7
- package/src/passport.ts +2 -2
- package/src/permission.ts +4 -7
- package/src/progress.ts +0 -8
- package/src/protocol.ts +8 -8
- package/src/repository.ts +0 -8
- package/src/service.ts +88 -15
- package/src/treasury.ts +0 -8
package/package.json
CHANGED
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),
|
|
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),
|
|
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
|
|
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
|
|
|
@@ -731,10 +727,12 @@ export class GuardMaker {
|
|
|
731
727
|
type === OperatorType.TYPE_LOGIC_EQUAL ||
|
|
732
728
|
type === OperatorType.TYPE_LOGIC_HAS_SUBSTRING ||
|
|
733
729
|
type === OperatorType.TYPE_LOGIC_AND ||
|
|
734
|
-
type === OperatorType.TYPE_LOGIC_OR
|
|
730
|
+
type === OperatorType.TYPE_LOGIC_OR ||
|
|
731
|
+
type === OperatorType.TYPE_NUMBER_ADD ||
|
|
732
|
+
type === OperatorType.TYPE_NUMBER_DEVIDE ||
|
|
733
|
+
type === OperatorType.TYPE_NUMBER_MULTIPLY ||
|
|
734
|
+
type === OperatorType.TYPE_NUMBER_SUBTRACT ||
|
|
735
|
+
type === OperatorType.TYPE_NUMBER_MOD)
|
|
735
736
|
}
|
|
736
737
|
}
|
|
737
738
|
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
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/passport.ts
CHANGED
|
@@ -67,7 +67,6 @@ export class GuardParser {
|
|
|
67
67
|
// console.log(constants)
|
|
68
68
|
|
|
69
69
|
let inputs : DeGuardInput[] = GuardParser.parse_bcs(constants, guard_input_bytes);
|
|
70
|
-
|
|
71
70
|
// console.log(data);
|
|
72
71
|
if (!inputs || inputs.length == 0) ERROR(Errors.Fail, 'GuardObject: data parsed error');
|
|
73
72
|
let stack: DeGuardData[] = [];
|
|
@@ -149,6 +148,7 @@ export class GuardParser {
|
|
|
149
148
|
current.ret_type = ValueType.TYPE_BOOL;
|
|
150
149
|
if (stack.length < current.value || current.value < 2) ERROR(Errors.Fail, 'ResolveData: ' + current.type);
|
|
151
150
|
var p0 = stack.pop() as DeGuardData;
|
|
151
|
+
current.child.push(p0);
|
|
152
152
|
for (let i = 1; i < current.value; ++i) {
|
|
153
153
|
var p = stack.pop() as DeGuardData;
|
|
154
154
|
if (!p.ret_type || (p.ret_type != p0.ret_type)) ERROR(Errors.Fail, 'ResolveData: ' + current.type + ' INVALID param type');
|
|
@@ -184,7 +184,7 @@ export class GuardParser {
|
|
|
184
184
|
current.ret_type = r[4];
|
|
185
185
|
|
|
186
186
|
if (stack.length < r[3].length) ERROR(Errors.Fail, 'OperateParamCount: cmd param lost ' + current.type);
|
|
187
|
-
r[3].forEach((e:number) => {
|
|
187
|
+
r[3].forEach((e:number) => {
|
|
188
188
|
let d = stack.pop() as DeGuardData;
|
|
189
189
|
if (!d?.ret_type || d.ret_type != e) {
|
|
190
190
|
ERROR(Errors.Fail, 'OperateParamCount: cmd param not match ' + current.type);
|
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: "
|
|
225
|
-
wowok_origin:'
|
|
226
|
-
base: '
|
|
227
|
-
base_origin: '
|
|
228
|
-
|
|
229
|
-
wowok_object: '
|
|
230
|
-
entity_object: '
|
|
231
|
-
treasury_cap:'
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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,66 @@ export class Service {
|
|
|
364
360
|
}
|
|
365
361
|
}
|
|
366
362
|
}
|
|
367
|
-
|
|
363
|
+
add_arbitration(arbitraion:ArbitrationObject, arbitraion_token_type:string, passport?:PassportObject) {
|
|
364
|
+
if (!Protocol.IsValidObjects([arbitraion])) {
|
|
365
|
+
ERROR(Errors.IsValidObjects, 'add_arbitration.arbitraion');
|
|
366
|
+
}
|
|
367
|
+
if (!IsValidTokenType(arbitraion_token_type)) {
|
|
368
|
+
ERROR(Errors.IsValidTokenType, 'add_arbitration.arbitraion_token_type')
|
|
369
|
+
}
|
|
370
|
+
if (passport) {
|
|
371
|
+
this.txb.moveCall({
|
|
372
|
+
target:Protocol.Instance().ServiceFn('arbitration_add_with_passport') as FnCallType,
|
|
373
|
+
arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, arbitraion), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
374
|
+
typeArguments:[this.pay_token_type, arbitraion_token_type]
|
|
375
|
+
})
|
|
376
|
+
} else {
|
|
377
|
+
this.txb.moveCall({
|
|
378
|
+
target:Protocol.Instance().ServiceFn('arbitration_add') as FnCallType,
|
|
379
|
+
arguments:[Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, arbitraion), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
380
|
+
typeArguments:[this.pay_token_type, arbitraion_token_type]
|
|
381
|
+
})
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
remove_arbitration(address:string[], removeall?:boolean, passport?:PassportObject) {
|
|
385
|
+
if (!removeall && address.length===0) return;
|
|
386
|
+
|
|
387
|
+
if (!IsValidArray(address, IsValidAddress)) {
|
|
388
|
+
ERROR(Errors.IsValidArray, 'remove_arbitration.address');
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
if (passport) {
|
|
392
|
+
if (removeall) {
|
|
393
|
+
this.txb.moveCall({
|
|
394
|
+
target:Protocol.Instance().ServiceFn('arbitration_remove_all_with_passport') as FnCallType,
|
|
395
|
+
arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
396
|
+
typeArguments:[this.pay_token_type]
|
|
397
|
+
})
|
|
398
|
+
} else {
|
|
399
|
+
this.txb.moveCall({
|
|
400
|
+
target:Protocol.Instance().ServiceFn('arbitration_remove_with_passport') as FnCallType,
|
|
401
|
+
arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.vector('address', array_unique(address!)),
|
|
402
|
+
Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
403
|
+
typeArguments:[this.pay_token_type]
|
|
404
|
+
})
|
|
405
|
+
}
|
|
406
|
+
} else {
|
|
407
|
+
if (removeall) {
|
|
408
|
+
this.txb.moveCall({
|
|
409
|
+
target:Protocol.Instance().ServiceFn('arbitration_remove_all') as FnCallType,
|
|
410
|
+
arguments:[Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
411
|
+
typeArguments:[this.pay_token_type]
|
|
412
|
+
})
|
|
413
|
+
} else {
|
|
414
|
+
this.txb.moveCall({
|
|
415
|
+
target:Protocol.Instance().ServiceFn('arbitration_remove') as FnCallType,
|
|
416
|
+
arguments:[Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.vector('address', array_unique(address!)),
|
|
417
|
+
Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
418
|
+
typeArguments:[this.pay_token_type]
|
|
419
|
+
})
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
}
|
|
368
423
|
add_withdraw_guards(guards:Service_Guard_Percent[], passport?:PassportObject) {
|
|
369
424
|
if (guards.length === 0) return;
|
|
370
425
|
|
|
@@ -890,20 +945,37 @@ export class Service {
|
|
|
890
945
|
}
|
|
891
946
|
}
|
|
892
947
|
|
|
893
|
-
|
|
948
|
+
refund_withArb(order:OrderObject, arb:ArbObject, arb_type:string) {
|
|
949
|
+
if (!Protocol.IsValidObjects([order, arb])) {
|
|
950
|
+
ERROR(Errors.IsValidObjects, 'refund_withArb.order or arb')
|
|
951
|
+
}
|
|
952
|
+
if (!IsValidTokenType(arb_type)) {
|
|
953
|
+
ERROR(Errors.IsValidTokenType, 'refund_withArb.arb_type')
|
|
954
|
+
}
|
|
955
|
+
const clock = this.txb.sharedObjectRef(Protocol.CLOCK_OBJECT);
|
|
956
|
+
this.txb.moveCall({
|
|
957
|
+
target:Protocol.Instance().ServiceFn('refund_with_arb') as FnCallType,
|
|
958
|
+
arguments:[Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, order), this.txb.object(arb), this.txb.object(clock)],
|
|
959
|
+
typeArguments:[this.pay_token_type, arb_type]
|
|
960
|
+
})
|
|
961
|
+
}
|
|
962
|
+
|
|
963
|
+
refund(order:OrderObject, refund_guard?:GuardObject, passport?:PassportObject) {
|
|
894
964
|
if (!Protocol.IsValidObjects([order])) {
|
|
895
965
|
ERROR(Errors.IsValidObjects, 'refund.order')
|
|
896
966
|
}
|
|
897
|
-
if (refund_guard && !
|
|
898
|
-
ERROR(Errors.
|
|
967
|
+
if (refund_guard && !Protocol.IsValidObjects([refund_guard])) {
|
|
968
|
+
ERROR(Errors.IsValidObjects, 'refund.refund_guard')
|
|
899
969
|
}
|
|
900
970
|
if (passport && !refund_guard) {
|
|
901
971
|
ERROR(Errors.InvalidParam, 'refund.passport need refund_guard')
|
|
902
972
|
}
|
|
973
|
+
const clock = this.txb.sharedObjectRef(Protocol.CLOCK_OBJECT);
|
|
903
974
|
if (passport && refund_guard) {
|
|
904
975
|
this.txb.moveCall({
|
|
905
976
|
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),
|
|
977
|
+
arguments:[Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, order), this.txb.object(refund_guard),
|
|
978
|
+
passport, this.txb.object(clock)],
|
|
907
979
|
typeArguments:[this.pay_token_type]
|
|
908
980
|
})
|
|
909
981
|
} else {
|
|
@@ -1104,6 +1176,7 @@ export class Service {
|
|
|
1104
1176
|
static MAX_TREASURY_COUNT= 8;
|
|
1105
1177
|
static MAX_ORDER_AGENT_COUNT = 8;
|
|
1106
1178
|
static MAX_ORDER_ARBS_COUNT = 8;
|
|
1179
|
+
static MAX_ARBITRATION_COUNT = 8;
|
|
1107
1180
|
|
|
1108
1181
|
static IsValidItemName(name:string) : boolean {
|
|
1109
1182
|
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')
|