wowok 1.6.63 → 1.6.65
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/README.md +7 -6
- package/dist/arbitration.js +217 -219
- package/dist/demand.d.ts +2 -2
- package/dist/demand.d.ts.map +1 -1
- package/dist/demand.js +123 -127
- package/dist/entity.d.ts +2 -4
- package/dist/entity.d.ts.map +1 -1
- package/dist/entity.js +92 -96
- package/dist/exception.d.ts +2 -1
- package/dist/exception.d.ts.map +1 -1
- package/dist/exception.js +5 -8
- package/dist/guard.d.ts.map +1 -1
- package/dist/guard.js +469 -506
- package/dist/index.d.ts +6 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +22 -37
- package/dist/machine.d.ts +1 -2
- package/dist/machine.d.ts.map +1 -1
- package/dist/machine.js +265 -283
- package/dist/passport.d.ts +0 -2
- package/dist/passport.d.ts.map +1 -1
- package/dist/passport.js +444 -569
- package/dist/payment.js +22 -26
- package/dist/permission.d.ts +41 -34
- package/dist/permission.d.ts.map +1 -1
- package/dist/permission.js +265 -264
- package/dist/progress.d.ts +4 -4
- package/dist/progress.d.ts.map +1 -1
- package/dist/progress.js +165 -166
- package/dist/protocol.d.ts +33 -35
- package/dist/protocol.d.ts.map +1 -1
- package/dist/protocol.js +264 -376
- package/dist/repository.d.ts +21 -7
- package/dist/repository.d.ts.map +1 -1
- package/dist/repository.js +315 -290
- package/dist/resource.d.ts +7 -5
- package/dist/resource.d.ts.map +1 -1
- package/dist/resource.js +89 -89
- package/dist/service.d.ts +3 -3
- package/dist/service.d.ts.map +1 -1
- package/dist/service.js +542 -544
- package/dist/treasury.js +183 -184
- package/dist/utils.d.ts +1 -1
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +254 -340
- package/dist/wowok.js +51 -54
- package/package.json +1 -1
- package/src/arbitration.ts +39 -39
- package/src/demand.ts +23 -26
- package/src/entity.ts +15 -16
- package/src/exception.ts +1 -0
- package/src/guard.ts +24 -14
- package/src/index.ts +9 -6
- package/src/machine.ts +47 -69
- package/src/passport.ts +15 -17
- package/src/payment.ts +2 -2
- package/src/permission.ts +47 -62
- package/src/progress.ts +46 -43
- package/src/protocol.ts +68 -69
- 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/dist/agent_call/call.d.ts +0 -30
- package/dist/agent_call/call.d.ts.map +0 -1
- package/dist/agent_call/call.js +0 -83
- package/dist/agent_query/events.d.ts +0 -61
- package/dist/agent_query/events.d.ts.map +0 -1
- package/dist/agent_query/events.js +0 -122
- package/dist/agent_query/objects.d.ts +0 -312
- package/dist/agent_query/objects.d.ts.map +0 -1
- package/dist/agent_query/objects.js +0 -492
- package/dist/agent_query/permission.d.ts +0 -14
- package/dist/agent_query/permission.d.ts.map +0 -1
- package/dist/agent_query/permission.js +0 -110
- package/src/agent_call/call.ts +0 -756
- package/src/agent_query/events.ts +0 -100
- package/src/agent_query/objects.ts +0 -608
- package/src/agent_query/permission.ts +0 -60
package/dist/arbitration.js
CHANGED
|
@@ -1,116 +1,117 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { IsValidArray, array_unique, IsValidTokenType, IsValidDesription, parseObjectType, IsValidAddress, IsValidEndpoint, IsValidU64, IsValidName, } from './utils';
|
|
2
|
+
import { Protocol } from './protocol';
|
|
3
|
+
import { ERROR, Errors } from './exception';
|
|
4
|
+
export class Arbitration {
|
|
5
|
+
pay_token_type;
|
|
6
|
+
permission;
|
|
7
|
+
object;
|
|
8
|
+
txb;
|
|
9
|
+
//static token2coin = (token:string) => { return '0x2::coin::Coin<' + token + '>'};
|
|
10
|
+
get_pay_type() { return this.pay_token_type; }
|
|
11
|
+
get_object() { return this.object; }
|
|
12
|
+
constructor(txb, pay_token_type, permission) {
|
|
9
13
|
this.pay_token_type = pay_token_type;
|
|
10
14
|
this.txb = txb;
|
|
11
15
|
this.permission = permission;
|
|
12
16
|
this.object = '';
|
|
13
17
|
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
Arbitration.From = function (txb, token_type, permission, object) {
|
|
18
|
-
var s = new Arbitration(txb, token_type, permission);
|
|
19
|
-
s.object = protocol_1.Protocol.TXB_OBJECT(txb, object);
|
|
18
|
+
static From(txb, token_type, permission, object) {
|
|
19
|
+
let s = new Arbitration(txb, token_type, permission);
|
|
20
|
+
s.object = Protocol.TXB_OBJECT(txb, object);
|
|
20
21
|
return s;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
if (!
|
|
24
|
-
|
|
22
|
+
}
|
|
23
|
+
static New(txb, token_type, permission, description, fee, withdrawTreasury, passport) {
|
|
24
|
+
if (!Protocol.IsValidObjects([permission, withdrawTreasury])) {
|
|
25
|
+
ERROR(Errors.IsValidObjects);
|
|
25
26
|
}
|
|
26
|
-
if (!
|
|
27
|
-
|
|
27
|
+
if (!IsValidTokenType(token_type)) {
|
|
28
|
+
ERROR(Errors.IsValidTokenType, 'New.token_type');
|
|
28
29
|
}
|
|
29
|
-
if (!
|
|
30
|
-
|
|
30
|
+
if (!IsValidDesription(description)) {
|
|
31
|
+
ERROR(Errors.IsValidDesription);
|
|
31
32
|
}
|
|
32
|
-
if (!
|
|
33
|
-
|
|
33
|
+
if (!IsValidU64(fee)) {
|
|
34
|
+
ERROR(Errors.IsValidU64, 'New.fee');
|
|
34
35
|
}
|
|
35
|
-
|
|
36
|
-
|
|
36
|
+
let pay_token_type = token_type;
|
|
37
|
+
let obj = new Arbitration(txb, pay_token_type, permission);
|
|
37
38
|
if (passport) {
|
|
38
39
|
obj.object = txb.moveCall({
|
|
39
|
-
target:
|
|
40
|
-
arguments: [passport, txb.pure.string(description), txb.pure.u64(fee), txb.object(withdrawTreasury),
|
|
40
|
+
target: Protocol.Instance().arbitrationFn('new_with_passport'),
|
|
41
|
+
arguments: [passport, txb.pure.string(description), txb.pure.u64(fee), txb.object(withdrawTreasury), Protocol.TXB_OBJECT(txb, permission)],
|
|
41
42
|
typeArguments: [pay_token_type],
|
|
42
43
|
});
|
|
43
44
|
}
|
|
44
45
|
else {
|
|
45
46
|
obj.object = txb.moveCall({
|
|
46
|
-
target:
|
|
47
|
-
arguments: [txb.pure.string(description), txb.pure.u64(fee), txb.object(withdrawTreasury),
|
|
47
|
+
target: Protocol.Instance().arbitrationFn('new'),
|
|
48
|
+
arguments: [txb.pure.string(description), txb.pure.u64(fee), txb.object(withdrawTreasury), Protocol.TXB_OBJECT(txb, permission)],
|
|
48
49
|
typeArguments: [pay_token_type],
|
|
49
50
|
});
|
|
50
51
|
}
|
|
51
52
|
return obj;
|
|
52
|
-
}
|
|
53
|
-
|
|
53
|
+
}
|
|
54
|
+
launch() {
|
|
54
55
|
return this.txb.moveCall({
|
|
55
|
-
target:
|
|
56
|
-
arguments: [
|
|
56
|
+
target: Protocol.Instance().arbitrationFn('create'),
|
|
57
|
+
arguments: [Protocol.TXB_OBJECT(this.txb, this.object)],
|
|
57
58
|
typeArguments: [this.pay_token_type]
|
|
58
59
|
});
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
if (!
|
|
62
|
-
|
|
60
|
+
}
|
|
61
|
+
set_description(description, passport) {
|
|
62
|
+
if (!IsValidDesription(description)) {
|
|
63
|
+
ERROR(Errors.IsValidDesription, 'set_description.description');
|
|
63
64
|
}
|
|
64
65
|
if (passport) {
|
|
65
66
|
this.txb.moveCall({
|
|
66
|
-
target:
|
|
67
|
-
arguments: [passport,
|
|
67
|
+
target: Protocol.Instance().arbitrationFn('description_set_with_passport'),
|
|
68
|
+
arguments: [passport, Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.string(description), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
68
69
|
typeArguments: [this.pay_token_type]
|
|
69
70
|
});
|
|
70
71
|
}
|
|
71
72
|
else {
|
|
72
73
|
this.txb.moveCall({
|
|
73
|
-
target:
|
|
74
|
-
arguments: [
|
|
74
|
+
target: Protocol.Instance().arbitrationFn('description_set'),
|
|
75
|
+
arguments: [Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.string(description), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
75
76
|
typeArguments: [this.pay_token_type]
|
|
76
77
|
});
|
|
77
78
|
}
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
if (!
|
|
81
|
-
|
|
79
|
+
}
|
|
80
|
+
set_fee(fee, passport) {
|
|
81
|
+
if (!IsValidU64(fee)) {
|
|
82
|
+
ERROR(Errors.IsValidU64, 'set_fee.fee');
|
|
82
83
|
}
|
|
83
84
|
if (passport) {
|
|
84
85
|
this.txb.moveCall({
|
|
85
|
-
target:
|
|
86
|
-
arguments: [passport,
|
|
86
|
+
target: Protocol.Instance().arbitrationFn('fee_set_with_passport'),
|
|
87
|
+
arguments: [passport, Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.u64(fee), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
87
88
|
typeArguments: [this.pay_token_type]
|
|
88
89
|
});
|
|
89
90
|
}
|
|
90
91
|
else {
|
|
91
92
|
this.txb.moveCall({
|
|
92
|
-
target:
|
|
93
|
-
arguments: [
|
|
93
|
+
target: Protocol.Instance().arbitrationFn('fee_set'),
|
|
94
|
+
arguments: [Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.u64(fee), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
94
95
|
typeArguments: [this.pay_token_type]
|
|
95
96
|
});
|
|
96
97
|
}
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
if (endpoint && !
|
|
100
|
-
|
|
98
|
+
}
|
|
99
|
+
set_endpoint(endpoint, passport) {
|
|
100
|
+
if (endpoint && !IsValidEndpoint(endpoint)) {
|
|
101
|
+
ERROR(Errors.IsValidEndpoint, 'set_endpoint.endpoint');
|
|
101
102
|
}
|
|
102
103
|
if (passport) {
|
|
103
104
|
if (endpoint) {
|
|
104
105
|
this.txb.moveCall({
|
|
105
|
-
target:
|
|
106
|
-
arguments: [passport,
|
|
106
|
+
target: Protocol.Instance().arbitrationFn('endpoint_set_with_passport'),
|
|
107
|
+
arguments: [passport, Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.string(endpoint), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
107
108
|
typeArguments: [this.pay_token_type]
|
|
108
109
|
});
|
|
109
110
|
}
|
|
110
111
|
else {
|
|
111
112
|
this.txb.moveCall({
|
|
112
|
-
target:
|
|
113
|
-
arguments: [passport,
|
|
113
|
+
target: Protocol.Instance().arbitrationFn('endpoint_none_with_passport'),
|
|
114
|
+
arguments: [passport, Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
114
115
|
typeArguments: [this.pay_token_type]
|
|
115
116
|
});
|
|
116
117
|
}
|
|
@@ -118,67 +119,66 @@ var Arbitration = /** @class */ (function () {
|
|
|
118
119
|
else {
|
|
119
120
|
if (endpoint) {
|
|
120
121
|
this.txb.moveCall({
|
|
121
|
-
target:
|
|
122
|
-
arguments: [
|
|
122
|
+
target: Protocol.Instance().arbitrationFn('endpoint_set'),
|
|
123
|
+
arguments: [Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.string(endpoint), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
123
124
|
typeArguments: [this.pay_token_type]
|
|
124
125
|
});
|
|
125
126
|
}
|
|
126
127
|
else {
|
|
127
128
|
this.txb.moveCall({
|
|
128
|
-
target:
|
|
129
|
-
arguments: [
|
|
129
|
+
target: Protocol.Instance().arbitrationFn('endpoint_none'),
|
|
130
|
+
arguments: [Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
130
131
|
typeArguments: [this.pay_token_type]
|
|
131
132
|
});
|
|
132
133
|
}
|
|
133
134
|
}
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
var _this = this;
|
|
135
|
+
}
|
|
136
|
+
add_voting_guard(guard, passport) {
|
|
137
137
|
if (guard.length === 0)
|
|
138
138
|
return;
|
|
139
|
-
if (!
|
|
140
|
-
|
|
139
|
+
if (!IsValidArray(guard, (g) => Protocol.IsValidObjects([g.guard]) && IsValidU64(g.voting_weight))) {
|
|
140
|
+
ERROR(Errors.IsValidArray, 'add_voting_guard.guard');
|
|
141
141
|
}
|
|
142
142
|
if (passport) {
|
|
143
|
-
guard.forEach(
|
|
144
|
-
|
|
145
|
-
target:
|
|
146
|
-
arguments: [passport,
|
|
147
|
-
|
|
148
|
-
typeArguments: [
|
|
143
|
+
guard.forEach(v => {
|
|
144
|
+
this.txb.moveCall({
|
|
145
|
+
target: Protocol.Instance().arbitrationFn('voting_guard_add_with_passport'),
|
|
146
|
+
arguments: [passport, Protocol.TXB_OBJECT(this.txb, this.object), this.txb.object(v.guard),
|
|
147
|
+
this.txb.pure.u64(v.voting_weight), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
148
|
+
typeArguments: [this.pay_token_type]
|
|
149
149
|
});
|
|
150
150
|
});
|
|
151
151
|
}
|
|
152
152
|
else {
|
|
153
|
-
guard.forEach(
|
|
154
|
-
|
|
155
|
-
target:
|
|
156
|
-
arguments: [
|
|
157
|
-
|
|
158
|
-
typeArguments: [
|
|
153
|
+
guard.forEach(v => {
|
|
154
|
+
this.txb.moveCall({
|
|
155
|
+
target: Protocol.Instance().arbitrationFn('voting_guard_add'),
|
|
156
|
+
arguments: [Protocol.TXB_OBJECT(this.txb, this.object), this.txb.object(v.guard),
|
|
157
|
+
this.txb.pure.u64(v.voting_weight), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
158
|
+
typeArguments: [this.pay_token_type]
|
|
159
159
|
});
|
|
160
160
|
});
|
|
161
161
|
}
|
|
162
|
-
}
|
|
163
|
-
|
|
162
|
+
}
|
|
163
|
+
remove_voting_guard(guard, removeall, passport) {
|
|
164
164
|
if (!removeall && guard.length === 0)
|
|
165
165
|
return;
|
|
166
|
-
if (!
|
|
167
|
-
|
|
166
|
+
if (!IsValidArray(guard, IsValidAddress)) {
|
|
167
|
+
ERROR(Errors.IsValidArray, 'remove_voting_guard.guard');
|
|
168
168
|
}
|
|
169
169
|
if (passport) {
|
|
170
170
|
if (removeall) {
|
|
171
171
|
this.txb.moveCall({
|
|
172
|
-
target:
|
|
173
|
-
arguments: [passport,
|
|
172
|
+
target: Protocol.Instance().arbitrationFn('voting_guard_removeall_with_passport'),
|
|
173
|
+
arguments: [passport, Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
174
174
|
typeArguments: [this.pay_token_type]
|
|
175
175
|
});
|
|
176
176
|
}
|
|
177
177
|
else {
|
|
178
178
|
this.txb.moveCall({
|
|
179
|
-
target:
|
|
180
|
-
arguments: [passport,
|
|
181
|
-
|
|
179
|
+
target: Protocol.Instance().arbitrationFn('voting_guard_remove_with_passport'),
|
|
180
|
+
arguments: [passport, Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.vector('address', guard),
|
|
181
|
+
Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
182
182
|
typeArguments: [this.pay_token_type]
|
|
183
183
|
});
|
|
184
184
|
}
|
|
@@ -186,37 +186,37 @@ var Arbitration = /** @class */ (function () {
|
|
|
186
186
|
else {
|
|
187
187
|
if (removeall) {
|
|
188
188
|
this.txb.moveCall({
|
|
189
|
-
target:
|
|
190
|
-
arguments: [
|
|
189
|
+
target: Protocol.Instance().arbitrationFn('voting_guard_removeall'),
|
|
190
|
+
arguments: [Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
191
191
|
typeArguments: [this.pay_token_type]
|
|
192
192
|
});
|
|
193
193
|
}
|
|
194
194
|
else {
|
|
195
195
|
this.txb.moveCall({
|
|
196
|
-
target:
|
|
197
|
-
arguments: [
|
|
198
|
-
|
|
196
|
+
target: Protocol.Instance().arbitrationFn('voting_guard_remove'),
|
|
197
|
+
arguments: [Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.vector('address', guard),
|
|
198
|
+
Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
199
199
|
typeArguments: [this.pay_token_type]
|
|
200
200
|
});
|
|
201
201
|
}
|
|
202
202
|
}
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
if (apply_guard && !
|
|
206
|
-
|
|
203
|
+
}
|
|
204
|
+
set_guard(apply_guard, passport) {
|
|
205
|
+
if (apply_guard && !IsValidAddress(apply_guard)) {
|
|
206
|
+
ERROR(Errors.IsValidAddress, 'set_guard.apply_guard');
|
|
207
207
|
}
|
|
208
208
|
if (passport) {
|
|
209
209
|
if (apply_guard) {
|
|
210
210
|
this.txb.moveCall({
|
|
211
|
-
target:
|
|
212
|
-
arguments: [passport,
|
|
211
|
+
target: Protocol.Instance().arbitrationFn('usage_guard_set_with_passport'),
|
|
212
|
+
arguments: [passport, Protocol.TXB_OBJECT(this.txb, this.object), this.txb.object(apply_guard), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
213
213
|
typeArguments: [this.pay_token_type]
|
|
214
214
|
});
|
|
215
215
|
}
|
|
216
216
|
else {
|
|
217
217
|
this.txb.moveCall({
|
|
218
|
-
target:
|
|
219
|
-
arguments: [passport,
|
|
218
|
+
target: Protocol.Instance().arbitrationFn('usage_guard_none_with_passport'),
|
|
219
|
+
arguments: [passport, Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
220
220
|
typeArguments: [this.pay_token_type]
|
|
221
221
|
});
|
|
222
222
|
}
|
|
@@ -224,136 +224,136 @@ var Arbitration = /** @class */ (function () {
|
|
|
224
224
|
else {
|
|
225
225
|
if (apply_guard) {
|
|
226
226
|
this.txb.moveCall({
|
|
227
|
-
target:
|
|
228
|
-
arguments: [
|
|
227
|
+
target: Protocol.Instance().arbitrationFn('usage_guard_set'),
|
|
228
|
+
arguments: [Protocol.TXB_OBJECT(this.txb, this.object), this.txb.object(apply_guard), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
229
229
|
typeArguments: [this.pay_token_type]
|
|
230
230
|
});
|
|
231
231
|
}
|
|
232
232
|
else {
|
|
233
233
|
this.txb.moveCall({
|
|
234
|
-
target:
|
|
235
|
-
arguments: [
|
|
234
|
+
target: Protocol.Instance().arbitrationFn('usage_guard_none'),
|
|
235
|
+
arguments: [Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
236
236
|
typeArguments: [this.pay_token_type]
|
|
237
237
|
});
|
|
238
238
|
}
|
|
239
239
|
}
|
|
240
|
-
}
|
|
241
|
-
|
|
240
|
+
}
|
|
241
|
+
pause(pause, passport) {
|
|
242
242
|
if (passport) {
|
|
243
243
|
this.txb.moveCall({
|
|
244
|
-
target:
|
|
245
|
-
arguments: [passport,
|
|
244
|
+
target: Protocol.Instance().arbitrationFn('pause_with_passport'),
|
|
245
|
+
arguments: [passport, Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.bool(pause), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
246
246
|
typeArguments: [this.pay_token_type]
|
|
247
247
|
});
|
|
248
248
|
}
|
|
249
249
|
else {
|
|
250
250
|
this.txb.moveCall({
|
|
251
|
-
target:
|
|
252
|
-
arguments: [
|
|
251
|
+
target: Protocol.Instance().arbitrationFn('pause'),
|
|
252
|
+
arguments: [Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.bool(pause), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
253
253
|
typeArguments: [this.pay_token_type]
|
|
254
254
|
});
|
|
255
255
|
}
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
if (param.voting_guard && !
|
|
259
|
-
|
|
256
|
+
}
|
|
257
|
+
vote(param, passport) {
|
|
258
|
+
if (param.voting_guard && !Protocol.IsValidObjects([param.voting_guard])) {
|
|
259
|
+
ERROR(Errors.IsValidObjects, 'vote.param.voting_guard');
|
|
260
260
|
}
|
|
261
|
-
if (!
|
|
262
|
-
|
|
261
|
+
if (!IsValidArray(param.agrees, (v) => IsValidU64(v) && v < Arbitration.MAX_PROPOSITION_COUNT)) {
|
|
262
|
+
ERROR(Errors.IsValidArray, 'vote.param.agrees');
|
|
263
263
|
}
|
|
264
|
-
if (!
|
|
265
|
-
|
|
264
|
+
if (!Protocol.IsValidObjects([param.arb])) {
|
|
265
|
+
ERROR(Errors.IsValidObjects, 'vote.param.arb');
|
|
266
266
|
}
|
|
267
|
-
|
|
267
|
+
const clock = this.txb.sharedObjectRef(Protocol.CLOCK_OBJECT);
|
|
268
268
|
if (passport) {
|
|
269
269
|
if (param.voting_guard) {
|
|
270
270
|
this.txb.moveCall({
|
|
271
|
-
target:
|
|
272
|
-
arguments: [passport, this.txb.object(param.voting_guard),
|
|
271
|
+
target: Protocol.Instance().arbitrationFn('vote_with_passport'),
|
|
272
|
+
arguments: [passport, this.txb.object(param.voting_guard), Protocol.TXB_OBJECT(this.txb, this.object),
|
|
273
273
|
this.txb.object(param.arb), this.txb.pure.vector('u8', param.agrees),
|
|
274
|
-
this.txb.object(clock),
|
|
274
|
+
this.txb.object(clock), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
275
275
|
typeArguments: [this.pay_token_type]
|
|
276
276
|
});
|
|
277
277
|
}
|
|
278
278
|
else {
|
|
279
279
|
this.txb.moveCall({
|
|
280
|
-
target:
|
|
281
|
-
arguments: [passport,
|
|
282
|
-
this.txb.object(clock),
|
|
280
|
+
target: Protocol.Instance().arbitrationFn('vote2_with_passport'),
|
|
281
|
+
arguments: [passport, Protocol.TXB_OBJECT(this.txb, this.object), this.txb.object(param.arb), this.txb.pure.vector('u8', param.agrees),
|
|
282
|
+
this.txb.object(clock), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
283
283
|
typeArguments: [this.pay_token_type]
|
|
284
284
|
});
|
|
285
285
|
}
|
|
286
286
|
}
|
|
287
287
|
else {
|
|
288
288
|
this.txb.moveCall({
|
|
289
|
-
target:
|
|
290
|
-
arguments: [
|
|
291
|
-
this.txb.object(clock),
|
|
289
|
+
target: Protocol.Instance().arbitrationFn('vote'),
|
|
290
|
+
arguments: [Protocol.TXB_OBJECT(this.txb, this.object), this.txb.object(param.arb), this.txb.pure.vector('u8', param.agrees),
|
|
291
|
+
this.txb.object(clock), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
292
292
|
typeArguments: [this.pay_token_type]
|
|
293
293
|
});
|
|
294
294
|
}
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
if (!
|
|
298
|
-
|
|
295
|
+
}
|
|
296
|
+
arbitration(param, passport) {
|
|
297
|
+
if (!IsValidDesription(param.feedback)) {
|
|
298
|
+
ERROR(Errors.IsValidDesription, 'arbitration.param.feedback');
|
|
299
299
|
}
|
|
300
|
-
if (!
|
|
301
|
-
|
|
300
|
+
if (!Protocol.IsValidObjects([param.arb])) {
|
|
301
|
+
ERROR(Errors.IsValidObjects, 'arbitration.param.arb');
|
|
302
302
|
}
|
|
303
|
-
if (param.indemnity && !
|
|
304
|
-
|
|
303
|
+
if (param.indemnity && !IsValidU64(param.indemnity)) {
|
|
304
|
+
ERROR(Errors.IsValidU64, 'arbitration.param.indemnity');
|
|
305
305
|
}
|
|
306
|
-
|
|
306
|
+
let ind = this.txb.pure.option('u64', param.indemnity ? param.indemnity : undefined);
|
|
307
307
|
if (passport) {
|
|
308
308
|
this.txb.moveCall({
|
|
309
|
-
target:
|
|
310
|
-
arguments: [passport,
|
|
311
|
-
this.txb.object(param.arb), this.txb.pure.string(param.feedback), ind,
|
|
309
|
+
target: Protocol.Instance().arbitrationFn('arbitration_with_passport'),
|
|
310
|
+
arguments: [passport, Protocol.TXB_OBJECT(this.txb, this.object),
|
|
311
|
+
this.txb.object(param.arb), this.txb.pure.string(param.feedback), ind, Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
312
312
|
typeArguments: [this.pay_token_type]
|
|
313
313
|
});
|
|
314
314
|
}
|
|
315
315
|
else {
|
|
316
316
|
this.txb.moveCall({
|
|
317
|
-
target:
|
|
318
|
-
arguments: [
|
|
319
|
-
this.txb.object(param.arb), this.txb.pure.string(param.feedback), ind,
|
|
317
|
+
target: Protocol.Instance().arbitrationFn('arbitration'),
|
|
318
|
+
arguments: [Protocol.TXB_OBJECT(this.txb, this.object),
|
|
319
|
+
this.txb.object(param.arb), this.txb.pure.string(param.feedback), ind, Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
320
320
|
typeArguments: [this.pay_token_type]
|
|
321
321
|
});
|
|
322
322
|
}
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
if (!
|
|
326
|
-
|
|
323
|
+
}
|
|
324
|
+
withdraw_fee(arb, param, passport) {
|
|
325
|
+
if (!Protocol.IsValidObjects([arb, param.treasury])) {
|
|
326
|
+
ERROR(Errors.IsValidObjects, 'withdraw_fee.arb or treasury');
|
|
327
327
|
}
|
|
328
|
-
if (
|
|
329
|
-
|
|
328
|
+
if (param?.for_guard && !Protocol.IsValidObjects([param.for_guard])) {
|
|
329
|
+
ERROR(Errors.IsValidObjects, 'withdraw_fee.param.for_guard');
|
|
330
330
|
}
|
|
331
|
-
if (
|
|
332
|
-
|
|
331
|
+
if (param?.for_object && !IsValidAddress(param.for_object)) {
|
|
332
|
+
ERROR(Errors.IsValidAddress, 'withdraw_fee.param.for_object');
|
|
333
333
|
}
|
|
334
|
-
if (!
|
|
335
|
-
|
|
334
|
+
if (!IsValidDesription(param.remark)) {
|
|
335
|
+
ERROR(Errors.IsValidDesription, 'withdraw_fee.param.remark');
|
|
336
336
|
}
|
|
337
|
-
if (!
|
|
338
|
-
|
|
337
|
+
if (!IsValidU64(param.index)) {
|
|
338
|
+
ERROR(Errors.IsValidU64, 'withdraw_fee.param.index');
|
|
339
339
|
}
|
|
340
|
-
|
|
341
|
-
|
|
340
|
+
const for_obj = this.txb.pure.option('address', param.for_object ? param.for_object : undefined);
|
|
341
|
+
const clock = this.txb.sharedObjectRef(Protocol.CLOCK_OBJECT);
|
|
342
342
|
if (passport) {
|
|
343
343
|
if (param.for_guard) {
|
|
344
344
|
return this.txb.moveCall({
|
|
345
|
-
target:
|
|
346
|
-
arguments: [passport,
|
|
345
|
+
target: Protocol.Instance().arbitrationFn('withdraw_forGuard_with_passport'),
|
|
346
|
+
arguments: [passport, Protocol.TXB_OBJECT(this.txb, this.object), this.txb.object(arb), this.txb.object(param.treasury),
|
|
347
347
|
for_obj, this.txb.object(param.for_guard), this.txb.pure.u64(param.index), this.txb.pure.string(param.remark), this.txb.object(clock),
|
|
348
|
-
|
|
348
|
+
Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
349
349
|
typeArguments: [this.pay_token_type]
|
|
350
350
|
});
|
|
351
351
|
}
|
|
352
352
|
else {
|
|
353
353
|
return this.txb.moveCall({
|
|
354
|
-
target:
|
|
355
|
-
arguments: [passport,
|
|
356
|
-
for_obj, this.txb.pure.u64(param.index), this.txb.pure.string(param.remark), this.txb.object(clock),
|
|
354
|
+
target: Protocol.Instance().arbitrationFn('withdraw_with_passport'),
|
|
355
|
+
arguments: [passport, Protocol.TXB_OBJECT(this.txb, this.object), this.txb.object(arb), this.txb.object(param.treasury),
|
|
356
|
+
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)],
|
|
357
357
|
typeArguments: [this.pay_token_type]
|
|
358
358
|
});
|
|
359
359
|
}
|
|
@@ -361,71 +361,71 @@ var Arbitration = /** @class */ (function () {
|
|
|
361
361
|
else {
|
|
362
362
|
if (param.for_guard) {
|
|
363
363
|
return this.txb.moveCall({
|
|
364
|
-
target:
|
|
365
|
-
arguments: [
|
|
364
|
+
target: Protocol.Instance().arbitrationFn('withdraw_forGuard'),
|
|
365
|
+
arguments: [Protocol.TXB_OBJECT(this.txb, this.object), this.txb.object(arb), this.txb.object(param.treasury),
|
|
366
366
|
for_obj, this.txb.object(param.for_guard), this.txb.pure.u64(param.index), this.txb.pure.string(param.remark), this.txb.object(clock),
|
|
367
|
-
|
|
367
|
+
Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
368
368
|
typeArguments: [this.pay_token_type]
|
|
369
369
|
});
|
|
370
370
|
}
|
|
371
371
|
else {
|
|
372
372
|
return this.txb.moveCall({
|
|
373
|
-
target:
|
|
374
|
-
arguments: [
|
|
375
|
-
for_obj, this.txb.pure.u64(param.index), this.txb.pure.string(param.remark), this.txb.object(clock),
|
|
373
|
+
target: Protocol.Instance().arbitrationFn('withdraw'),
|
|
374
|
+
arguments: [Protocol.TXB_OBJECT(this.txb, this.object), this.txb.object(arb), this.txb.object(param.treasury),
|
|
375
|
+
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)],
|
|
376
376
|
typeArguments: [this.pay_token_type]
|
|
377
377
|
});
|
|
378
378
|
}
|
|
379
379
|
}
|
|
380
|
-
}
|
|
381
|
-
|
|
382
|
-
if (!
|
|
383
|
-
|
|
380
|
+
}
|
|
381
|
+
set_withdrawTreasury(treasury, passport) {
|
|
382
|
+
if (!Protocol.IsValidObjects([treasury])) {
|
|
383
|
+
ERROR(Errors.IsValidObjects, 'set_withdrawTreasury.treasury');
|
|
384
384
|
}
|
|
385
385
|
if (passport) {
|
|
386
386
|
this.txb.moveCall({
|
|
387
|
-
target:
|
|
388
|
-
arguments: [passport,
|
|
389
|
-
this.txb.object(treasury),
|
|
387
|
+
target: Protocol.Instance().arbitrationFn('withdraw_treasury_set_with_passport'),
|
|
388
|
+
arguments: [passport, Protocol.TXB_OBJECT(this.txb, this.object),
|
|
389
|
+
this.txb.object(treasury), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
390
390
|
typeArguments: [this.pay_token_type]
|
|
391
391
|
});
|
|
392
392
|
}
|
|
393
393
|
else {
|
|
394
394
|
this.txb.moveCall({
|
|
395
|
-
target:
|
|
396
|
-
arguments: [
|
|
397
|
-
this.txb.object(treasury),
|
|
395
|
+
target: Protocol.Instance().arbitrationFn('withdraw_treasury_set'),
|
|
396
|
+
arguments: [Protocol.TXB_OBJECT(this.txb, this.object),
|
|
397
|
+
this.txb.object(treasury), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
398
398
|
typeArguments: [this.pay_token_type]
|
|
399
399
|
});
|
|
400
400
|
}
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
if (!
|
|
404
|
-
|
|
401
|
+
}
|
|
402
|
+
dispute(param, passport) {
|
|
403
|
+
if (!Protocol.IsValidObjects([param.order])) {
|
|
404
|
+
ERROR(Errors.IsValidObjects, 'dispute.param.order');
|
|
405
405
|
}
|
|
406
|
-
if (!
|
|
407
|
-
|
|
406
|
+
if (!IsValidTokenType(param.order_token_type)) {
|
|
407
|
+
ERROR(Errors.IsValidTokenType, 'dispute.param.order_token_type');
|
|
408
408
|
}
|
|
409
|
-
if (!
|
|
410
|
-
|
|
409
|
+
if (!IsValidDesription(param.description)) {
|
|
410
|
+
ERROR(Errors.IsValidDesription, 'dispute.param.description');
|
|
411
411
|
}
|
|
412
|
-
if (!
|
|
413
|
-
|
|
412
|
+
if (!IsValidArray(param.votable_proposition, IsValidName)) {
|
|
413
|
+
ERROR(Errors.IsValidArray, 'dispute.param.votable_proposition');
|
|
414
414
|
}
|
|
415
415
|
if (passport) {
|
|
416
416
|
if (param.fee) {
|
|
417
417
|
return this.txb.moveCall({
|
|
418
|
-
target:
|
|
419
|
-
arguments: [passport,
|
|
420
|
-
this.txb.pure.vector('string',
|
|
418
|
+
target: Protocol.Instance().arbitrationFn('dispute_with_passport'),
|
|
419
|
+
arguments: [passport, Protocol.TXB_OBJECT(this.txb, this.object), this.txb.object(param.order), this.txb.pure.string(param.description),
|
|
420
|
+
this.txb.pure.vector('string', array_unique(param.votable_proposition)), this.txb.object(param.fee)],
|
|
421
421
|
typeArguments: [this.pay_token_type, param.order_token_type]
|
|
422
422
|
});
|
|
423
423
|
}
|
|
424
424
|
else {
|
|
425
425
|
return this.txb.moveCall({
|
|
426
|
-
target:
|
|
427
|
-
arguments: [passport,
|
|
428
|
-
this.txb.pure.vector('string',
|
|
426
|
+
target: Protocol.Instance().arbitrationFn('free_dispute_with_passport'),
|
|
427
|
+
arguments: [passport, Protocol.TXB_OBJECT(this.txb, this.object), this.txb.object(param.order), this.txb.pure.string(param.description),
|
|
428
|
+
this.txb.pure.vector('string', array_unique(param.votable_proposition))],
|
|
429
429
|
typeArguments: [this.pay_token_type, param.order_token_type]
|
|
430
430
|
});
|
|
431
431
|
}
|
|
@@ -433,43 +433,41 @@ var Arbitration = /** @class */ (function () {
|
|
|
433
433
|
else {
|
|
434
434
|
if (param.fee) {
|
|
435
435
|
return this.txb.moveCall({
|
|
436
|
-
target:
|
|
437
|
-
arguments: [
|
|
438
|
-
this.txb.pure.vector('string',
|
|
436
|
+
target: Protocol.Instance().arbitrationFn('dispute'),
|
|
437
|
+
arguments: [Protocol.TXB_OBJECT(this.txb, this.object), this.txb.object(param.order), this.txb.pure.string(param.description),
|
|
438
|
+
this.txb.pure.vector('string', array_unique(param.votable_proposition)), this.txb.object(param.fee)],
|
|
439
439
|
typeArguments: [this.pay_token_type, param.order_token_type]
|
|
440
440
|
});
|
|
441
441
|
}
|
|
442
442
|
else {
|
|
443
443
|
return this.txb.moveCall({
|
|
444
|
-
target:
|
|
445
|
-
arguments: [
|
|
446
|
-
this.txb.pure.vector('string',
|
|
444
|
+
target: Protocol.Instance().arbitrationFn('free_dispute'),
|
|
445
|
+
arguments: [Protocol.TXB_OBJECT(this.txb, this.object), this.txb.object(param.order), this.txb.pure.string(param.description),
|
|
446
|
+
this.txb.pure.vector('string', array_unique(param.votable_proposition))],
|
|
447
447
|
typeArguments: [this.pay_token_type, param.order_token_type]
|
|
448
448
|
});
|
|
449
449
|
}
|
|
450
450
|
}
|
|
451
|
-
}
|
|
452
|
-
|
|
453
|
-
if (!
|
|
454
|
-
|
|
451
|
+
}
|
|
452
|
+
change_permission(new_permission) {
|
|
453
|
+
if (!Protocol.IsValidObjects([new_permission])) {
|
|
454
|
+
ERROR(Errors.IsValidObjects);
|
|
455
455
|
}
|
|
456
456
|
this.txb.moveCall({
|
|
457
|
-
target:
|
|
458
|
-
arguments: [
|
|
457
|
+
target: Protocol.Instance().arbitrationFn('permission_set'),
|
|
458
|
+
arguments: [Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, this.permission), Protocol.TXB_OBJECT(this.txb, new_permission)],
|
|
459
459
|
typeArguments: [this.pay_token_type]
|
|
460
460
|
});
|
|
461
461
|
this.permission = new_permission;
|
|
462
|
+
}
|
|
463
|
+
static parseObjectType = (chain_type) => {
|
|
464
|
+
return parseObjectType(chain_type, 'arbitration::Arbitration<');
|
|
462
465
|
};
|
|
463
|
-
|
|
464
|
-
return
|
|
465
|
-
};
|
|
466
|
-
Arbitration.parseArbObjectType = function (chain_type) {
|
|
467
|
-
return (0, utils_1.parseObjectType)(chain_type, 'arb::Arb<');
|
|
466
|
+
static parseArbObjectType = (chain_type) => {
|
|
467
|
+
return parseObjectType(chain_type, 'arb::Arb<');
|
|
468
468
|
};
|
|
469
|
-
|
|
469
|
+
static queryArbVoted = () => {
|
|
470
470
|
};
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
}());
|
|
475
|
-
exports.Arbitration = Arbitration;
|
|
471
|
+
static MAX_PROPOSITION_COUNT = 16;
|
|
472
|
+
static MAX_VOTING_GUARD_COUNT = 16;
|
|
473
|
+
}
|