wowok 1.0.3 → 1.0.4

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.
@@ -1,12 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.change_owner = exports.remove_admin = exports.add_admin = exports.set_description = exports.remove_entity = exports.remove_index = exports.add_or_modify = exports.set_guard = exports.add_entity = exports.launch = exports.permission = exports.PermissionIndex = exports.MAX_PERMISSION_INDEX_COUNT = exports.MAX_ENTITY_COUNT = exports.MAX_ADMIN_COUNT = void 0;
3
+ exports.change_owner = exports.remove_admin = exports.add_admin = exports.set_description = exports.remove_entity = exports.remove_index = exports.set_guard = exports.add_entity = exports.destroy = exports.launch = exports.permission = exports.IsValidPermissionIndex = exports.IsValidUserDefinedIndex = exports.PermissionIndex = exports.MAX_PERMISSION_INDEX_COUNT = exports.MAX_ENTITY_COUNT = exports.MAX_ADMIN_COUNT = void 0;
4
4
  const bcs_1 = require("@mysten/bcs");
5
5
  const protocol_1 = require("./protocol");
6
6
  const util_1 = require("./util");
7
7
  exports.MAX_ADMIN_COUNT = 64;
8
- exports.MAX_ENTITY_COUNT = 1024;
9
- exports.MAX_PERMISSION_INDEX_COUNT = 512;
8
+ exports.MAX_ENTITY_COUNT = 2000;
9
+ exports.MAX_PERMISSION_INDEX_COUNT = 200;
10
10
  var PermissionIndex;
11
11
  (function (PermissionIndex) {
12
12
  PermissionIndex[PermissionIndex["repository"] = 100] = "repository";
@@ -84,134 +84,196 @@ var PermissionIndex;
84
84
  PermissionIndex[PermissionIndex["progress_bind_task"] = 652] = "progress_bind_task";
85
85
  PermissionIndex[PermissionIndex["progress_set_context_repository"] = 653] = "progress_set_context_repository";
86
86
  PermissionIndex[PermissionIndex["progress_unhold"] = 654] = "progress_unhold";
87
+ PermissionIndex[PermissionIndex["user_defined_start"] = 10000] = "user_defined_start";
87
88
  })(PermissionIndex || (exports.PermissionIndex = PermissionIndex = {}));
89
+ const IsValidUserDefinedIndex = (index) => {
90
+ return index >= PermissionIndex.user_defined_start && (0, protocol_1.IsValidUint)(index);
91
+ };
92
+ exports.IsValidUserDefinedIndex = IsValidUserDefinedIndex;
93
+ const IsValidPermissionIndex = (index) => {
94
+ if (Object.values(PermissionIndex).includes(index)) {
95
+ return true;
96
+ }
97
+ return (0, exports.IsValidUserDefinedIndex)(index);
98
+ };
99
+ exports.IsValidPermissionIndex = IsValidPermissionIndex;
88
100
  function permission(txb, description) {
101
+ if (!(0, protocol_1.IsValidDesription)(description))
102
+ return false;
89
103
  return txb.moveCall({
90
104
  target: protocol_1.PROTOCOL.PermissionFn('new'),
91
- arguments: [txb.pure((0, protocol_1.description_data)(description))]
105
+ arguments: [txb.pure(description)]
92
106
  });
93
107
  }
94
108
  exports.permission = permission;
95
109
  function launch(txb, permission) {
110
+ if (!(0, protocol_1.IsValidObjects)([permission]))
111
+ return false;
96
112
  return txb.moveCall({
97
113
  target: protocol_1.PROTOCOL.PermissionFn('create'),
98
- arguments: [permission]
114
+ arguments: [(0, protocol_1.TXB_OBJECT)(txb, permission)]
99
115
  });
100
116
  }
101
117
  exports.launch = launch;
118
+ function destroy(txb, permission) {
119
+ if (!(0, protocol_1.IsValidObjects)([permission]))
120
+ return false;
121
+ txb.moveCall({
122
+ target: protocol_1.PROTOCOL.PermissionFn('destroy'),
123
+ arguments: [(0, protocol_1.TXB_OBJECT)(txb, permission)],
124
+ });
125
+ return true;
126
+ }
127
+ exports.destroy = destroy;
102
128
  function add_entity(txb, permission, entities) {
129
+ if (!(0, protocol_1.IsValidObjects)([permission]))
130
+ return false;
131
+ if (!entities)
132
+ return false;
133
+ let bValid = true;
134
+ let e = entities.forEach((v) => {
135
+ if (!(0, protocol_1.IsValidArray)(v.permissions, exports.IsValidPermissionIndex))
136
+ bValid = false;
137
+ if (!(0, protocol_1.IsValidAddress)(v.entity_address))
138
+ bValid = false;
139
+ });
140
+ if (!bValid)
141
+ return false;
103
142
  let guards = [];
104
143
  for (let i = 0; i < entities.length; i++) {
105
144
  let entity = entities[i];
106
145
  let indexes = [];
107
146
  for (let j = 0; j < entity.permissions.length; j++) {
108
147
  let index = entity.permissions[j];
109
- if (index?.guard) {
110
- guards.push({ who: entity.who, index: index.index, guard: index.guard });
148
+ if (!(0, exports.IsValidPermissionIndex)(index.index)) {
149
+ continue;
111
150
  }
112
151
  if (!indexes.includes(index.index)) {
113
152
  indexes.push(index.index);
153
+ if (index?.guard) {
154
+ guards.push({ entity_address: entity.entity_address, index: index.index, guard: index.guard });
155
+ }
114
156
  }
115
157
  }
116
158
  if (indexes.length > 0) {
117
159
  txb.moveCall({
118
160
  target: protocol_1.PROTOCOL.PermissionFn('add_batch'),
119
- arguments: [permission, txb.pure(entity.who, bcs_1.BCS.ADDRESS), txb.pure(indexes, 'vector<u64>')]
161
+ arguments: [(0, protocol_1.TXB_OBJECT)(txb, permission), txb.pure(entity.entity_address, bcs_1.BCS.ADDRESS), txb.pure(indexes, 'vector<u64>')]
120
162
  });
121
163
  }
122
164
  }
123
165
  // set guards
124
- guards.forEach(({ who, index, guard }) => {
166
+ guards.forEach(({ entity_address, index, guard }) => {
125
167
  txb.moveCall({
126
168
  target: protocol_1.PROTOCOL.PermissionFn('guard_set'),
127
- arguments: [permission, txb.pure(who, bcs_1.BCS.ADDRESS), txb.pure(index, bcs_1.BCS.U64), (0, protocol_1.TXB_OBJECT)(txb, guard)]
169
+ arguments: [(0, protocol_1.TXB_OBJECT)(txb, permission), txb.pure(entity_address, bcs_1.BCS.ADDRESS), txb.pure(index, bcs_1.BCS.U64), (0, protocol_1.TXB_OBJECT)(txb, guard)]
128
170
  });
129
171
  });
172
+ return true;
130
173
  }
131
174
  exports.add_entity = add_entity;
132
175
  // guard: undefine to set none
133
- function set_guard(txb, permission, who, index, guard) {
176
+ function set_guard(txb, permission, entity_address, index, guard) {
177
+ if (!(0, protocol_1.IsValidObjects)([permission]))
178
+ return false;
179
+ if (!(0, protocol_1.IsValidAddress)(entity_address) || !(0, exports.IsValidPermissionIndex)(index))
180
+ return false;
134
181
  if (guard) {
135
182
  txb.moveCall({
136
183
  target: protocol_1.PROTOCOL.PermissionFn('guard_set'),
137
- arguments: [permission, txb.pure(who, bcs_1.BCS.ADDRESS), txb.pure(index, bcs_1.BCS.U64), (0, protocol_1.TXB_OBJECT)(txb, guard)]
184
+ arguments: [(0, protocol_1.TXB_OBJECT)(txb, permission), txb.pure(entity_address, bcs_1.BCS.ADDRESS), txb.pure(index, bcs_1.BCS.U64), (0, protocol_1.TXB_OBJECT)(txb, guard)]
138
185
  });
139
186
  }
140
187
  else {
141
188
  txb.moveCall({
142
189
  target: protocol_1.PROTOCOL.PermissionFn('guard_none'),
143
- arguments: [permission, txb.pure(who, bcs_1.BCS.ADDRESS), txb.pure(index, bcs_1.BCS.U64)]
190
+ arguments: [(0, protocol_1.TXB_OBJECT)(txb, permission), txb.pure(entity_address, bcs_1.BCS.ADDRESS), txb.pure(index, bcs_1.BCS.U64)]
144
191
  });
145
192
  }
193
+ return true;
146
194
  }
147
195
  exports.set_guard = set_guard;
148
- function add_or_modify(txb, permission, who, index, modifyIfOldExist, guard) {
149
- if (guard) {
150
- txb.moveCall({
151
- target: protocol_1.PROTOCOL.PermissionFn('add_or_modify'),
152
- arguments: [permission, txb.pure(who, bcs_1.BCS.ADDRESS), txb.pure(index, bcs_1.BCS.U64), (0, protocol_1.TXB_OBJECT)(txb, guard), txb.pure(modifyIfOldExist, bcs_1.BCS.BOOL)]
153
- });
154
- }
155
- else {
156
- txb.moveCall({
157
- target: protocol_1.PROTOCOL.PermissionFn('add_or_modify'),
158
- arguments: [permission, txb.pure(who, bcs_1.BCS.ADDRESS), txb.pure(index, bcs_1.BCS.U64), txb.pure([], bcs_1.BCS.U8), txb.pure(modifyIfOldExist, bcs_1.BCS.BOOL)]
159
- });
160
- }
161
- }
162
- exports.add_or_modify = add_or_modify;
163
- function remove_index(txb, permission, who, index) {
164
- if (index) {
165
- txb.moveCall({
166
- target: protocol_1.PROTOCOL.PermissionFn('remove_index'),
167
- arguments: [permission, txb.pure(who, bcs_1.BCS.ADDRESS), txb.pure(index, 'vector<u64>')]
168
- });
169
- }
196
+ function remove_index(txb, permission, entity_address, index) {
197
+ if (!(0, protocol_1.IsValidObjects)([permission]))
198
+ return false;
199
+ if (!(0, protocol_1.IsValidAddress)(entity_address))
200
+ return false;
201
+ if (!index || !((0, protocol_1.IsValidArray)(index, exports.IsValidPermissionIndex)))
202
+ return false;
203
+ txb.moveCall({
204
+ target: protocol_1.PROTOCOL.PermissionFn('remove_index'),
205
+ arguments: [(0, protocol_1.TXB_OBJECT)(txb, permission), txb.pure(entity_address, bcs_1.BCS.ADDRESS), txb.pure((0, util_1.array_unique)(index), 'vector<u64>')]
206
+ });
207
+ return true;
170
208
  }
171
209
  exports.remove_index = remove_index;
172
- function remove_entity(txb, permission, who) {
173
- if (who) {
174
- txb.moveCall({
175
- target: protocol_1.PROTOCOL.PermissionFn('remove'),
176
- arguments: [permission, txb.pure(who, 'vector<address>')]
177
- });
178
- }
210
+ function remove_entity(txb, permission, entity_address) {
211
+ if (!(0, protocol_1.IsValidObjects)([permission]))
212
+ return false;
213
+ if (!entity_address || !(0, protocol_1.IsValidArray)(entity_address, protocol_1.IsValidAddress))
214
+ return false;
215
+ txb.moveCall({
216
+ target: protocol_1.PROTOCOL.PermissionFn('remove'),
217
+ arguments: [(0, protocol_1.TXB_OBJECT)(txb, permission), txb.pure((0, util_1.array_unique)(entity_address), 'vector<address>')]
218
+ });
219
+ return true;
179
220
  }
180
221
  exports.remove_entity = remove_entity;
181
222
  function set_description(txb, permission, description) {
223
+ if (!(0, protocol_1.IsValidObjects)([permission]))
224
+ return false;
225
+ if (!(0, protocol_1.IsValidDesription)(description))
226
+ return false;
182
227
  txb.moveCall({
183
228
  target: protocol_1.PROTOCOL.PermissionFn('description_set'),
184
- arguments: [permission, txb.pure((0, protocol_1.description_data)(description))]
229
+ arguments: [(0, protocol_1.TXB_OBJECT)(txb, permission), txb.pure(description)]
185
230
  });
231
+ return true;
186
232
  }
187
233
  exports.set_description = set_description;
188
234
  function add_admin(txb, permission, admin) {
189
- let n = (0, util_1.array_unique)(admin);
235
+ if (!(0, protocol_1.IsValidObjects)([permission]))
236
+ return false;
237
+ if (!admin || !(0, protocol_1.IsValidArray)(admin, protocol_1.IsValidAddress))
238
+ return false;
190
239
  txb.moveCall({
191
240
  target: protocol_1.PROTOCOL.PermissionFn('admin_add_batch'),
192
- arguments: [permission, txb.pure(n, 'vector<address>')]
241
+ arguments: [(0, protocol_1.TXB_OBJECT)(txb, permission), txb.pure((0, util_1.array_unique)(admin), 'vector<address>')]
193
242
  });
243
+ return true;
194
244
  }
195
245
  exports.add_admin = add_admin;
196
246
  function remove_admin(txb, permission, admin, removeall) {
247
+ if (!(0, protocol_1.IsValidObjects)([permission]))
248
+ return false;
249
+ if (!removeall && !admin)
250
+ return false;
251
+ if (!(0, protocol_1.IsValidArray)(admin, protocol_1.IsValidAddress))
252
+ return false;
197
253
  if (removeall) {
198
254
  txb.moveCall({
199
255
  target: protocol_1.PROTOCOL.PermissionFn('admins_clear'),
200
- arguments: [permission]
256
+ arguments: [(0, protocol_1.TXB_OBJECT)(txb, permission)]
201
257
  });
202
258
  }
203
- else {
259
+ else if (admin) {
204
260
  txb.moveCall({
205
261
  target: protocol_1.PROTOCOL.PermissionFn('admin_remove_batch'),
206
- arguments: [permission, txb.pure(admin, 'vector<address>')]
262
+ arguments: [(0, protocol_1.TXB_OBJECT)(txb, permission), txb.pure((0, util_1.array_unique)(admin), 'vector<address>')]
207
263
  });
208
264
  }
265
+ return true;
209
266
  }
210
267
  exports.remove_admin = remove_admin;
211
268
  function change_owner(txb, permission, new_owner) {
269
+ if (!(0, protocol_1.IsValidObjects)([permission]))
270
+ return false;
271
+ if (!(0, protocol_1.IsValidAddress)(new_owner))
272
+ return false;
212
273
  txb.moveCall({
213
274
  target: protocol_1.PROTOCOL.PermissionFn('builder_set'),
214
- arguments: [permission, txb.pure(new_owner, bcs_1.BCS.ADDRESS)]
275
+ arguments: [(0, protocol_1.TXB_OBJECT)(txb, permission), txb.pure(new_owner, bcs_1.BCS.ADDRESS)]
215
276
  });
277
+ return true;
216
278
  }
217
279
  exports.change_owner = change_owner;
package/dist/progress.js CHANGED
@@ -3,89 +3,115 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.hold = exports.next = exports.progress_unhold = exports.progress_set_context_repository = exports.progress_bind_task = exports.progress_set_namedOperator = exports.destroy = exports.launch_as_child = exports.launch = exports.progress = exports.MAX_NAMED_OPERATOR_COUNT = void 0;
4
4
  const bcs_1 = require("@mysten/bcs");
5
5
  const protocol_1 = require("./protocol");
6
- exports.MAX_NAMED_OPERATOR_COUNT = 64;
6
+ const util_1 = require("./util");
7
+ exports.MAX_NAMED_OPERATOR_COUNT = 100;
7
8
  function progress(txb, machine, permission, passport) {
9
+ if (!(0, protocol_1.IsValidObjects)([machine, permission]))
10
+ return false;
8
11
  if (passport) {
9
12
  return txb.moveCall({
10
13
  target: protocol_1.PROTOCOL.ProgressFn('new_with_passport'),
11
- arguments: [passport, machine, permission],
14
+ arguments: [passport, (0, protocol_1.TXB_OBJECT)(txb, machine), (0, protocol_1.TXB_OBJECT)(txb, permission)],
12
15
  });
13
16
  }
14
17
  else {
15
18
  return txb.moveCall({
16
19
  target: protocol_1.PROTOCOL.ProgressFn('new'),
17
- arguments: [machine, permission],
20
+ arguments: [(0, protocol_1.TXB_OBJECT)(txb, machine), (0, protocol_1.TXB_OBJECT)(txb, permission)],
18
21
  });
19
22
  }
20
23
  }
21
24
  exports.progress = progress;
22
25
  function launch(txb, progress) {
26
+ if (!(0, protocol_1.IsValidObjects)([progress]))
27
+ return false;
23
28
  return txb.moveCall({
24
29
  target: protocol_1.PROTOCOL.ProgressFn('create'),
25
- arguments: [progress],
30
+ arguments: [(0, protocol_1.TXB_OBJECT)(txb, progress)],
26
31
  });
27
32
  }
28
33
  exports.launch = launch;
29
34
  function launch_as_child(txb, progress, parent, parent_next) {
35
+ if (!(0, protocol_1.IsValidObjects)([progress, parent]))
36
+ return false;
37
+ if (!IsValidProgressNext(parent_next))
38
+ return false;
30
39
  return txb.moveCall({
31
40
  target: protocol_1.PROTOCOL.ProgressFn('create_as_child'),
32
- arguments: [progress, parent, txb.pure(parent_next.next_node_name), txb.pure((0, protocol_1.name_data)(parent_next.forward))],
41
+ arguments: [(0, protocol_1.TXB_OBJECT)(txb, progress), (0, protocol_1.TXB_OBJECT)(txb, parent), txb.pure(parent_next.next_node_name), txb.pure(parent_next.forward)],
33
42
  });
34
43
  }
35
44
  exports.launch_as_child = launch_as_child;
36
45
  function destroy(txb, progress) {
37
- return txb.moveCall({
46
+ if (!(0, protocol_1.IsValidObjects)([progress]))
47
+ return false;
48
+ txb.moveCall({
38
49
  target: protocol_1.PROTOCOL.ProgressFn('destroy'),
39
- arguments: [progress],
50
+ arguments: [(0, protocol_1.TXB_OBJECT)(txb, progress)],
40
51
  });
52
+ return true;
41
53
  }
42
54
  exports.destroy = destroy;
43
55
  function progress_set_namedOperator(txb, machine, permission, progress, name, addresses, passport) {
44
- if (addresses.length == 0 || name.length == 0 || addresses.length > exports.MAX_NAMED_OPERATOR_COUNT)
45
- return undefined;
56
+ if (!(0, protocol_1.IsValidObjects)([machine, permission, progress]))
57
+ return false;
58
+ if (!(0, protocol_1.IsValidName)(name))
59
+ return false;
60
+ if (!addresses || addresses.length > exports.MAX_NAMED_OPERATOR_COUNT)
61
+ return false;
62
+ if (!(0, protocol_1.IsValidArray)(addresses, protocol_1.IsValidAddress))
63
+ return false;
46
64
  if (passport) {
47
65
  txb.moveCall({
48
66
  target: protocol_1.PROTOCOL.ProgressFn('namedOperator_set_with_passport'),
49
- arguments: [passport, progress, txb.pure((0, protocol_1.name_data)(name)), txb.pure(addresses, 'vector<address>'),
50
- machine, permission],
67
+ arguments: [passport, (0, protocol_1.TXB_OBJECT)(txb, progress), txb.pure(name), txb.pure((0, util_1.array_unique)(addresses), 'vector<address>'),
68
+ (0, protocol_1.TXB_OBJECT)(txb, machine), (0, protocol_1.TXB_OBJECT)(txb, permission)],
51
69
  });
52
70
  }
53
71
  else {
54
72
  txb.moveCall({
55
73
  target: protocol_1.PROTOCOL.ProgressFn('namedOperator_set'),
56
- arguments: [progress, txb.pure((0, protocol_1.name_data)(name)), txb.pure(addresses, 'vector<address>'),
57
- machine, permission],
74
+ arguments: [(0, protocol_1.TXB_OBJECT)(txb, progress), txb.pure(name), txb.pure((0, util_1.array_unique)(addresses), 'vector<address>'),
75
+ (0, protocol_1.TXB_OBJECT)(txb, machine), (0, protocol_1.TXB_OBJECT)(txb, permission)],
58
76
  });
59
77
  }
78
+ return true;
60
79
  }
61
80
  exports.progress_set_namedOperator = progress_set_namedOperator;
62
81
  function progress_bind_task(txb, machine, permission, progress, task_address, passport) {
82
+ if (!(0, protocol_1.IsValidObjects)([machine, permission, progress]))
83
+ return false;
84
+ if (!(0, protocol_1.IsValidAddress)(task_address))
85
+ return false;
63
86
  if (passport) {
64
87
  txb.moveCall({
65
88
  target: protocol_1.PROTOCOL.ProgressFn('task_set_with_passport'),
66
- arguments: [passport, progress, txb.pure(task_address, bcs_1.BCS.ADDRESS), machine, permission],
89
+ arguments: [passport, (0, protocol_1.TXB_OBJECT)(txb, progress), txb.pure(task_address, bcs_1.BCS.ADDRESS), (0, protocol_1.TXB_OBJECT)(txb, machine), (0, protocol_1.TXB_OBJECT)(txb, permission)],
67
90
  });
68
91
  }
69
92
  else {
70
93
  txb.moveCall({
71
94
  target: protocol_1.PROTOCOL.ProgressFn('task_set'),
72
- arguments: [progress, txb.pure(task_address, bcs_1.BCS.ADDRESS), machine, permission],
95
+ arguments: [(0, protocol_1.TXB_OBJECT)(txb, progress), txb.pure(task_address, bcs_1.BCS.ADDRESS), (0, protocol_1.TXB_OBJECT)(txb, machine), (0, protocol_1.TXB_OBJECT)(txb, permission)],
73
96
  });
74
97
  }
98
+ return true;
75
99
  }
76
100
  exports.progress_bind_task = progress_bind_task;
77
101
  function progress_set_context_repository(txb, machine, permission, progress, repository, passport) {
102
+ if (!(0, protocol_1.IsValidObjects)([machine, permission, progress]))
103
+ return false;
78
104
  if (passport) {
79
105
  if (repository) {
80
106
  txb.moveCall({
81
107
  target: protocol_1.PROTOCOL.ProgressFn('context_repository_set_with_passport'),
82
- arguments: [passport, progress, repository, machine, permission],
108
+ arguments: [passport, (0, protocol_1.TXB_OBJECT)(txb, progress), (0, protocol_1.TXB_OBJECT)(txb, repository), (0, protocol_1.TXB_OBJECT)(txb, machine), (0, protocol_1.TXB_OBJECT)(txb, permission)],
83
109
  });
84
110
  }
85
111
  else {
86
112
  txb.moveCall({
87
113
  target: protocol_1.PROTOCOL.ProgressFn('context_repository_none_with_passport'),
88
- arguments: [passport, progress, machine, permission],
114
+ arguments: [passport, (0, protocol_1.TXB_OBJECT)(txb, progress), (0, protocol_1.TXB_OBJECT)(txb, machine), (0, protocol_1.TXB_OBJECT)(txb, permission)],
89
115
  });
90
116
  }
91
117
  }
@@ -93,51 +119,69 @@ function progress_set_context_repository(txb, machine, permission, progress, rep
93
119
  if (repository) {
94
120
  txb.moveCall({
95
121
  target: protocol_1.PROTOCOL.ProgressFn('context_repository_set'),
96
- arguments: [progress, repository, machine, permission],
122
+ arguments: [(0, protocol_1.TXB_OBJECT)(txb, progress), (0, protocol_1.TXB_OBJECT)(txb, repository), (0, protocol_1.TXB_OBJECT)(txb, machine), (0, protocol_1.TXB_OBJECT)(txb, permission)],
97
123
  });
98
124
  }
99
125
  else {
100
126
  txb.moveCall({
101
127
  target: protocol_1.PROTOCOL.ProgressFn('context_repository_none'),
102
- arguments: [progress, machine, permission],
128
+ arguments: [(0, protocol_1.TXB_OBJECT)(txb, progress), (0, protocol_1.TXB_OBJECT)(txb, machine), (0, protocol_1.TXB_OBJECT)(txb, permission)],
103
129
  });
104
130
  }
105
131
  }
132
+ return true;
106
133
  }
107
134
  exports.progress_set_context_repository = progress_set_context_repository;
108
135
  function progress_unhold(txb, machine, permission, progress, next) {
136
+ if (!(0, protocol_1.IsValidObjects)([machine, permission, progress]))
137
+ return false;
138
+ if (!IsValidProgressNext(next))
139
+ return false;
109
140
  txb.moveCall({
110
141
  target: protocol_1.PROTOCOL.ProgressFn('unhold'),
111
- arguments: [progress, machine, txb.pure(next.next_node_name), txb.pure((0, protocol_1.name_data)(next.forward)), permission],
142
+ arguments: [(0, protocol_1.TXB_OBJECT)(txb, progress), (0, protocol_1.TXB_OBJECT)(txb, machine), txb.pure(next.next_node_name), txb.pure(next.forward), (0, protocol_1.TXB_OBJECT)(txb, permission)],
112
143
  });
144
+ return true;
113
145
  }
114
146
  exports.progress_unhold = progress_unhold;
147
+ function IsValidProgressNext(next) {
148
+ return (0, protocol_1.IsValidName)(next.forward) && (0, protocol_1.IsValidName)(next.next_node_name);
149
+ }
115
150
  function next(txb, machine, permission, progress, next, deliverables_address, passport) {
116
- let diliverable = txb.pure([], bcs_1.BCS.U8);
117
- if (deliverables_address) {
118
- diliverable = txb.pure(deliverables_address, bcs_1.BCS.ADDRESS);
119
- }
151
+ if (!(0, protocol_1.IsValidObjects)([machine, permission, progress]))
152
+ return false;
153
+ if (!IsValidProgressNext(next))
154
+ return false;
155
+ if (deliverables_address && !(0, protocol_1.IsValidAddress)(deliverables_address))
156
+ return false;
157
+ let diliverable = deliverables_address ? txb.pure(util_1.BCS_CONVERT.ser_option_address(deliverables_address)) : (0, protocol_1.OptionNone)(txb);
120
158
  if (passport) {
121
159
  txb.moveCall({
122
160
  target: protocol_1.PROTOCOL.ProgressFn('run_with_passport'),
123
- arguments: [passport, progress, machine, txb.pure(next.next_node_name),
124
- txb.pure((0, protocol_1.name_data)(next.forward)), diliverable, permission],
161
+ arguments: [passport, (0, protocol_1.TXB_OBJECT)(txb, progress), (0, protocol_1.TXB_OBJECT)(txb, machine), txb.pure(next.next_node_name),
162
+ txb.pure(next.forward), diliverable, (0, protocol_1.TXB_OBJECT)(txb, permission)],
125
163
  });
126
164
  }
127
165
  else {
128
166
  txb.moveCall({
129
167
  target: protocol_1.PROTOCOL.ProgressFn('run'),
130
- arguments: [progress, machine, txb.pure(next.next_node_name),
131
- txb.pure((0, protocol_1.name_data)(next.forward)), diliverable, permission],
168
+ arguments: [(0, protocol_1.TXB_OBJECT)(txb, progress), (0, protocol_1.TXB_OBJECT)(txb, machine), txb.pure(next.next_node_name),
169
+ txb.pure(next.forward), diliverable, (0, protocol_1.TXB_OBJECT)(txb, permission)],
132
170
  });
133
171
  }
172
+ return true;
134
173
  }
135
174
  exports.next = next;
136
175
  function hold(txb, machine, permission, progress, next, hold) {
176
+ if (!(0, protocol_1.IsValidObjects)([machine, permission, progress]))
177
+ return false;
178
+ if (!IsValidProgressNext(next))
179
+ return false;
137
180
  txb.moveCall({
138
181
  target: protocol_1.PROTOCOL.ProgressFn('hold'),
139
- arguments: [progress, machine, txb.pure(next.next_node_name),
140
- txb.pure((0, protocol_1.name_data)(next.forward)), txb.pure(hold, bcs_1.BCS.BOOL), permission],
182
+ arguments: [(0, protocol_1.TXB_OBJECT)(txb, progress), (0, protocol_1.TXB_OBJECT)(txb, machine), txb.pure(next.next_node_name),
183
+ txb.pure(next.forward), txb.pure(hold, bcs_1.BCS.BOOL), (0, protocol_1.TXB_OBJECT)(txb, permission)],
141
184
  });
185
+ return true;
142
186
  }
143
187
  exports.hold = hold;