wowok 1.2.10 → 1.2.12
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 +3 -3
- package/src/demand.ts +85 -98
- package/src/entity.ts +35 -35
- package/src/guard.ts +15 -15
- package/src/machine.ts +150 -174
- package/src/passport.ts +34 -38
- package/src/permission.ts +157 -89
- package/src/progress.ts +118 -118
- package/src/protocol.ts +28 -31
- package/src/repository.ts +147 -160
- package/src/resource.ts +43 -45
- package/src/reward.ts +108 -119
- package/src/service.ts +338 -364
- package/src/utils.ts +9 -5
- package/src/vote.ts +139 -157
- package/src/wowok.ts +19 -23
package/src/progress.ts
CHANGED
|
@@ -2,9 +2,10 @@ import { BCS } from '@mysten/bcs';
|
|
|
2
2
|
import { FnCallType, PermissionObject, RepositoryObject, PassportObject, MachineObject,
|
|
3
3
|
ProgressObject, ProgressAddress, Protocol, ValueType,
|
|
4
4
|
TxbObject} from './protocol';
|
|
5
|
-
import { Bcs, array_unique,IsValidName, IsValidAddress, IsValidArray,
|
|
5
|
+
import { Bcs, array_unique,IsValidName, IsValidAddress, IsValidArray, IsValidInt } from './utils'
|
|
6
6
|
import { ERROR, Errors } from './exception';
|
|
7
|
-
import {
|
|
7
|
+
import { type TransactionResult, Transaction as TransactionBlock } from '@mysten/sui/transactions';
|
|
8
|
+
|
|
8
9
|
|
|
9
10
|
export type ProgressNext = {
|
|
10
11
|
next_node_name: string;
|
|
@@ -39,37 +40,36 @@ export class Progress {
|
|
|
39
40
|
protected permission ;
|
|
40
41
|
protected machine;
|
|
41
42
|
protected object : TxbObject;
|
|
42
|
-
protected
|
|
43
|
+
protected txb;
|
|
43
44
|
|
|
44
45
|
get_object() { return this.object }
|
|
45
|
-
private constructor(
|
|
46
|
+
private constructor(txb:TransactionBlock, machine:MachineObject, permission:PermissionObject) {
|
|
46
47
|
this.permission = permission;
|
|
47
|
-
this.
|
|
48
|
+
this.txb = txb;
|
|
48
49
|
this.machine = machine;
|
|
49
50
|
this.object = '';
|
|
50
51
|
}
|
|
51
|
-
static From(
|
|
52
|
-
let p = new Progress(
|
|
53
|
-
p.object = Protocol.TXB_OBJECT(
|
|
52
|
+
static From(txb:TransactionBlock, machine:MachineObject, permission:PermissionObject, object:TxbObject) : Progress{
|
|
53
|
+
let p = new Progress(txb, machine, permission)
|
|
54
|
+
p.object = Protocol.TXB_OBJECT(txb, object);
|
|
54
55
|
return p
|
|
55
56
|
}
|
|
56
|
-
static New(
|
|
57
|
+
static New(txb:TransactionBlock, machine:MachineObject, permission:PermissionObject, task?:string | null, passport?:PassportObject) : Progress {
|
|
57
58
|
if (!Protocol.IsValidObjects([machine, permission])) {
|
|
58
59
|
ERROR(Errors.IsValidObjects, 'machine & permission')
|
|
59
60
|
}
|
|
60
61
|
|
|
61
|
-
let p = new Progress(
|
|
62
|
-
let
|
|
63
|
-
let t = task? txb.pure(Bcs.getInstance().ser(ValueType.TYPE_OPTION_ADDRESS, task)) : OptionNone(txb);
|
|
62
|
+
let p = new Progress(txb, machine, permission);
|
|
63
|
+
let t = txb.pure.option('address', task ? task : undefined);
|
|
64
64
|
|
|
65
65
|
if (passport) {
|
|
66
66
|
p.object = txb.moveCall({
|
|
67
|
-
target:
|
|
67
|
+
target:Protocol.Instance().ProgressFn('new_with_passport') as FnCallType,
|
|
68
68
|
arguments: [passport, t, Protocol.TXB_OBJECT(txb, machine), Protocol.TXB_OBJECT(txb, permission)],
|
|
69
69
|
})
|
|
70
70
|
} else {
|
|
71
71
|
p.object = txb.moveCall({
|
|
72
|
-
target:
|
|
72
|
+
target:Protocol.Instance().ProgressFn('new') as FnCallType,
|
|
73
73
|
arguments: [t, Protocol.TXB_OBJECT(txb, machine), Protocol.TXB_OBJECT(txb, permission)],
|
|
74
74
|
})
|
|
75
75
|
}
|
|
@@ -77,10 +77,10 @@ export class Progress {
|
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
launch() : ProgressAddress {
|
|
80
|
-
|
|
81
|
-
return txb.moveCall({
|
|
82
|
-
target:
|
|
83
|
-
arguments: [Protocol.TXB_OBJECT(txb, this.object)],
|
|
80
|
+
|
|
81
|
+
return this.txb.moveCall({
|
|
82
|
+
target:Protocol.Instance().ProgressFn('create') as FnCallType,
|
|
83
|
+
arguments: [Protocol.TXB_OBJECT(this.txb, this.object)],
|
|
84
84
|
})
|
|
85
85
|
}
|
|
86
86
|
|
|
@@ -91,19 +91,19 @@ export class Progress {
|
|
|
91
91
|
if (!Progress.IsValidProgressNext(parent_next)) {
|
|
92
92
|
ERROR(Errors.InvalidParam, 'parent_next')
|
|
93
93
|
}
|
|
94
|
-
|
|
95
|
-
return txb.moveCall({
|
|
96
|
-
target:
|
|
97
|
-
arguments: [Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, parent),
|
|
98
|
-
txb.pure(parent_next.next_node_name), txb.pure(parent_next.forward)],
|
|
94
|
+
|
|
95
|
+
return this.txb.moveCall({
|
|
96
|
+
target:Protocol.Instance().ProgressFn('create_as_child') as FnCallType,
|
|
97
|
+
arguments: [Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, parent),
|
|
98
|
+
this.txb.pure.string(parent_next.next_node_name), this.txb.pure.string(parent_next.forward)],
|
|
99
99
|
})
|
|
100
100
|
}
|
|
101
101
|
|
|
102
102
|
destroy() {
|
|
103
|
-
|
|
104
|
-
txb.moveCall({
|
|
105
|
-
target:
|
|
106
|
-
arguments: [Protocol.TXB_OBJECT(txb, this.object)],
|
|
103
|
+
|
|
104
|
+
this.txb.moveCall({
|
|
105
|
+
target:Protocol.Instance().ProgressFn('destroy') as FnCallType,
|
|
106
|
+
arguments: [Protocol.TXB_OBJECT(this.txb, this.object)],
|
|
107
107
|
})
|
|
108
108
|
}
|
|
109
109
|
|
|
@@ -115,20 +115,20 @@ export class Progress {
|
|
|
115
115
|
ERROR(Errors.InvalidParam, 'addresses')
|
|
116
116
|
}
|
|
117
117
|
|
|
118
|
-
|
|
118
|
+
|
|
119
119
|
if (passport) {
|
|
120
|
-
txb.moveCall({
|
|
121
|
-
target:
|
|
122
|
-
arguments: [passport, Protocol.TXB_OBJECT(txb, this.object), txb.pure(name),
|
|
123
|
-
txb.pure(array_unique(addresses)
|
|
124
|
-
Protocol.TXB_OBJECT(txb, this.machine), Protocol.TXB_OBJECT(txb, this.permission)],
|
|
120
|
+
this.txb.moveCall({
|
|
121
|
+
target:Protocol.Instance().ProgressFn('namedOperator_set_with_passport') as FnCallType,
|
|
122
|
+
arguments: [passport, Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.string(name),
|
|
123
|
+
this.txb.pure.vector('address', array_unique(addresses)),
|
|
124
|
+
Protocol.TXB_OBJECT(this.txb, this.machine), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
125
125
|
})
|
|
126
126
|
} else {
|
|
127
|
-
txb.moveCall({
|
|
128
|
-
target:
|
|
129
|
-
arguments: [Protocol.TXB_OBJECT(txb, this.object), txb.pure(name),
|
|
130
|
-
txb.pure(array_unique(addresses)
|
|
131
|
-
Protocol.TXB_OBJECT(txb, this.machine), Protocol.TXB_OBJECT(txb, this.permission)],
|
|
127
|
+
this.txb.moveCall({
|
|
128
|
+
target:Protocol.Instance().ProgressFn('namedOperator_set') as FnCallType,
|
|
129
|
+
arguments: [Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.string(name),
|
|
130
|
+
this.txb.pure.vector('address', array_unique(addresses)),
|
|
131
|
+
Protocol.TXB_OBJECT(this.txb, this.machine), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
132
132
|
})
|
|
133
133
|
}
|
|
134
134
|
}
|
|
@@ -138,18 +138,18 @@ export class Progress {
|
|
|
138
138
|
ERROR(Errors.IsValidAddress)
|
|
139
139
|
}
|
|
140
140
|
|
|
141
|
-
|
|
141
|
+
|
|
142
142
|
if (passport) {
|
|
143
|
-
txb.moveCall({
|
|
144
|
-
target:
|
|
145
|
-
arguments: [passport, Protocol.TXB_OBJECT(txb, this.object),
|
|
146
|
-
txb.pure(task_address
|
|
143
|
+
this.txb.moveCall({
|
|
144
|
+
target:Protocol.Instance().ProgressFn('task_set_with_passport') as FnCallType,
|
|
145
|
+
arguments: [passport, Protocol.TXB_OBJECT(this.txb, this.object),
|
|
146
|
+
this.txb.pure.address(task_address), Protocol.TXB_OBJECT(this.txb, this.machine), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
147
147
|
})
|
|
148
148
|
} else {
|
|
149
|
-
txb.moveCall({
|
|
150
|
-
target:
|
|
151
|
-
arguments: [Protocol.TXB_OBJECT(txb, this.object), txb.pure(task_address
|
|
152
|
-
Protocol.TXB_OBJECT(txb, this.machine), Protocol.TXB_OBJECT(txb, this.permission)],
|
|
149
|
+
this.txb.moveCall({
|
|
150
|
+
target:Protocol.Instance().ProgressFn('task_set') as FnCallType,
|
|
151
|
+
arguments: [Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.address(task_address),
|
|
152
|
+
Protocol.TXB_OBJECT(this.txb, this.machine), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
153
153
|
})
|
|
154
154
|
}
|
|
155
155
|
}
|
|
@@ -158,32 +158,32 @@ export class Progress {
|
|
|
158
158
|
ERROR(Errors.IsValidObjects, 'repository')
|
|
159
159
|
}
|
|
160
160
|
|
|
161
|
-
|
|
161
|
+
|
|
162
162
|
if (passport) {
|
|
163
163
|
if (repository) {
|
|
164
|
-
txb.moveCall({
|
|
165
|
-
target:
|
|
166
|
-
arguments: [passport, Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, repository),
|
|
167
|
-
Protocol.TXB_OBJECT(txb, this.machine), Protocol.TXB_OBJECT(txb, this.permission)],
|
|
164
|
+
this.txb.moveCall({
|
|
165
|
+
target:Protocol.Instance().ProgressFn('context_repository_set_with_passport') as FnCallType,
|
|
166
|
+
arguments: [passport, Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, repository),
|
|
167
|
+
Protocol.TXB_OBJECT(this.txb, this.machine), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
168
168
|
})
|
|
169
169
|
} else {
|
|
170
|
-
txb.moveCall({
|
|
171
|
-
target:
|
|
172
|
-
arguments: [passport, Protocol.TXB_OBJECT(txb, this.object),
|
|
173
|
-
Protocol.TXB_OBJECT(txb, this.machine), Protocol.TXB_OBJECT(txb, this.permission)],
|
|
170
|
+
this.txb.moveCall({
|
|
171
|
+
target:Protocol.Instance().ProgressFn('context_repository_none_with_passport') as FnCallType,
|
|
172
|
+
arguments: [passport, Protocol.TXB_OBJECT(this.txb, this.object),
|
|
173
|
+
Protocol.TXB_OBJECT(this.txb, this.machine), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
174
174
|
})
|
|
175
175
|
}
|
|
176
176
|
} else {
|
|
177
177
|
if (repository) {
|
|
178
|
-
txb.moveCall({
|
|
179
|
-
target:
|
|
180
|
-
arguments: [Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, repository),
|
|
181
|
-
Protocol.TXB_OBJECT(txb, this.machine), Protocol.TXB_OBJECT(txb, this.permission)],
|
|
178
|
+
this.txb.moveCall({
|
|
179
|
+
target:Protocol.Instance().ProgressFn('context_repository_set') as FnCallType,
|
|
180
|
+
arguments: [Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, repository),
|
|
181
|
+
Protocol.TXB_OBJECT(this.txb, this.machine), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
182
182
|
})
|
|
183
183
|
} else {
|
|
184
|
-
txb.moveCall({
|
|
185
|
-
target:
|
|
186
|
-
arguments: [Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, this.machine), Protocol.TXB_OBJECT(txb, this.permission)],
|
|
184
|
+
this.txb.moveCall({
|
|
185
|
+
target:Protocol.Instance().ProgressFn('context_repository_none') as FnCallType,
|
|
186
|
+
arguments: [Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, this.machine), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
187
187
|
})
|
|
188
188
|
}
|
|
189
189
|
}
|
|
@@ -192,36 +192,36 @@ export class Progress {
|
|
|
192
192
|
if (!Progress.IsValidProgressNext(next)) {
|
|
193
193
|
ERROR(Errors.InvalidParam, 'next')
|
|
194
194
|
}
|
|
195
|
-
|
|
195
|
+
|
|
196
196
|
if (passport) {
|
|
197
|
-
txb.moveCall({
|
|
198
|
-
target:
|
|
199
|
-
arguments: [passport, Protocol.TXB_OBJECT(txb, this.object),
|
|
200
|
-
Protocol.TXB_OBJECT(txb, this.machine), txb.pure(next.next_node_name),
|
|
201
|
-
txb.pure(next.forward), Protocol.TXB_OBJECT(txb, this.permission)],
|
|
197
|
+
this.txb.moveCall({
|
|
198
|
+
target:Protocol.Instance().ProgressFn('unhold_with_passport') as FnCallType,
|
|
199
|
+
arguments: [passport, Protocol.TXB_OBJECT(this.txb, this.object),
|
|
200
|
+
Protocol.TXB_OBJECT(this.txb, this.machine), this.txb.pure.string(next.next_node_name),
|
|
201
|
+
this.txb.pure.string(next.forward), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
202
202
|
})
|
|
203
203
|
} else {
|
|
204
|
-
txb.moveCall({
|
|
205
|
-
target:
|
|
206
|
-
arguments: [Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, this.machine),
|
|
207
|
-
txb.pure(next.next_node_name), txb.pure(next.forward),
|
|
208
|
-
Protocol.TXB_OBJECT(txb, this.permission)],
|
|
204
|
+
this.txb.moveCall({
|
|
205
|
+
target:Protocol.Instance().ProgressFn('unhold') as FnCallType,
|
|
206
|
+
arguments: [Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, this.machine),
|
|
207
|
+
this.txb.pure.string(next.next_node_name), this.txb.pure.string(next.forward),
|
|
208
|
+
Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
209
209
|
})
|
|
210
210
|
}
|
|
211
211
|
}
|
|
212
212
|
parent_none(passport?:PassportObject) {
|
|
213
|
-
|
|
213
|
+
|
|
214
214
|
if (passport) {
|
|
215
|
-
txb.moveCall({
|
|
216
|
-
target:
|
|
217
|
-
arguments: [passport, Protocol.TXB_OBJECT(txb, this.object),
|
|
218
|
-
Protocol.TXB_OBJECT(txb, this.machine), Protocol.TXB_OBJECT(txb, this.permission)],
|
|
215
|
+
this.txb.moveCall({
|
|
216
|
+
target:Protocol.Instance().ProgressFn('parent_none_with_passport') as FnCallType,
|
|
217
|
+
arguments: [passport, Protocol.TXB_OBJECT(this.txb, this.object),
|
|
218
|
+
Protocol.TXB_OBJECT(this.txb, this.machine), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
219
219
|
})
|
|
220
220
|
} else {
|
|
221
|
-
txb.moveCall({
|
|
222
|
-
target:
|
|
223
|
-
arguments: [Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, this.machine),
|
|
224
|
-
Protocol.TXB_OBJECT(txb, this.permission)],
|
|
221
|
+
this.txb.moveCall({
|
|
222
|
+
target:Protocol.Instance().ProgressFn('parent_none') as FnCallType,
|
|
223
|
+
arguments: [Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, this.machine),
|
|
224
|
+
Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
225
225
|
})
|
|
226
226
|
}
|
|
227
227
|
}
|
|
@@ -234,26 +234,26 @@ export class Progress {
|
|
|
234
234
|
ERROR(Errors.InvalidParam, 'parent')
|
|
235
235
|
}
|
|
236
236
|
|
|
237
|
-
|
|
237
|
+
|
|
238
238
|
if (passport) {
|
|
239
|
-
txb.moveCall({
|
|
240
|
-
target:
|
|
241
|
-
arguments: [passport, Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, this.machine),
|
|
242
|
-
txb.pure(parent.parent_id
|
|
243
|
-
txb.pure(parent.parent_session_id
|
|
244
|
-
txb.pure(parent.next_node),
|
|
245
|
-
txb.pure(parent.forward),
|
|
246
|
-
Protocol.TXB_OBJECT(txb, this.permission)],
|
|
239
|
+
this.txb.moveCall({
|
|
240
|
+
target:Protocol.Instance().ProgressFn('parent_set_with_passport') as FnCallType,
|
|
241
|
+
arguments: [passport, Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, this.machine),
|
|
242
|
+
this.txb.pure.address(parent.parent_id),
|
|
243
|
+
this.txb.pure.u64(parent.parent_session_id),
|
|
244
|
+
this.txb.pure.string(parent.next_node),
|
|
245
|
+
this.txb.pure.string(parent.forward),
|
|
246
|
+
Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
247
247
|
})
|
|
248
248
|
} else {
|
|
249
|
-
txb.moveCall({
|
|
250
|
-
target:
|
|
251
|
-
arguments: [Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, this.machine),
|
|
252
|
-
txb.pure(parent.parent_id
|
|
253
|
-
txb.pure(parent.parent_session_id
|
|
254
|
-
txb.pure(parent.next_node),
|
|
255
|
-
txb.pure(parent.forward),
|
|
256
|
-
Protocol.TXB_OBJECT(txb, this.permission)],
|
|
249
|
+
this.txb.moveCall({
|
|
250
|
+
target:Protocol.Instance().ProgressFn('parent_set') as FnCallType,
|
|
251
|
+
arguments: [Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, this.machine),
|
|
252
|
+
this.txb.pure.address(parent.parent_id),
|
|
253
|
+
this.txb.pure.u64(parent.parent_session_id),
|
|
254
|
+
this.txb.pure.string(parent.next_node),
|
|
255
|
+
this.txb.pure.string(parent.forward),
|
|
256
|
+
Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
257
257
|
})
|
|
258
258
|
}
|
|
259
259
|
}
|
|
@@ -269,23 +269,23 @@ export class Progress {
|
|
|
269
269
|
ERROR(Errors.IsValidAddress, 'sub_id');
|
|
270
270
|
}
|
|
271
271
|
|
|
272
|
-
|
|
273
|
-
let diliverable =
|
|
274
|
-
let sub =
|
|
272
|
+
|
|
273
|
+
let diliverable = this.txb.pure.option('address', deliverables_address ? deliverables_address : undefined);
|
|
274
|
+
let sub = this.txb.pure.option('address', sub_id ? sub_id : undefined);
|
|
275
275
|
|
|
276
276
|
if (passport) {
|
|
277
|
-
txb.moveCall({
|
|
278
|
-
target:
|
|
279
|
-
arguments: [passport, Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, this.machine),
|
|
280
|
-
txb.pure(next.next_node_name),
|
|
281
|
-
txb.pure(next.forward), diliverable, sub,
|
|
282
|
-
Protocol.TXB_OBJECT(txb, this.permission)],
|
|
277
|
+
this.txb.moveCall({
|
|
278
|
+
target:Protocol.Instance().ProgressFn('next_with_passport') as FnCallType,
|
|
279
|
+
arguments: [passport, Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, this.machine),
|
|
280
|
+
this.txb.pure.string(next.next_node_name),
|
|
281
|
+
this.txb.pure.string(next.forward), diliverable, sub,
|
|
282
|
+
Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
283
283
|
})
|
|
284
284
|
} else {
|
|
285
|
-
txb.moveCall({
|
|
286
|
-
target:
|
|
287
|
-
arguments: [Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, this.machine), txb.pure(next.next_node_name),
|
|
288
|
-
txb.pure(next.forward), diliverable, sub, Protocol.TXB_OBJECT(txb, this.permission)],
|
|
285
|
+
this.txb.moveCall({
|
|
286
|
+
target:Protocol.Instance().ProgressFn('next') as FnCallType,
|
|
287
|
+
arguments: [Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, this.machine), this.txb.pure.string(next.next_node_name),
|
|
288
|
+
this.txb.pure.string(next.forward), diliverable, sub, Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
289
289
|
})
|
|
290
290
|
}
|
|
291
291
|
}
|
|
@@ -295,11 +295,11 @@ export class Progress {
|
|
|
295
295
|
ERROR(Errors.InvalidParam, 'next')
|
|
296
296
|
}
|
|
297
297
|
|
|
298
|
-
|
|
299
|
-
txb.moveCall({
|
|
300
|
-
target:
|
|
301
|
-
arguments: [Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, this.machine), txb.pure(next.next_node_name),
|
|
302
|
-
txb.pure(next.forward), txb.pure(hold
|
|
298
|
+
|
|
299
|
+
this.txb.moveCall({
|
|
300
|
+
target:Protocol.Instance().ProgressFn('hold') as FnCallType,
|
|
301
|
+
arguments: [Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, this.machine), this.txb.pure.string(next.next_node_name),
|
|
302
|
+
this.txb.pure.string(next.forward), this.txb.pure.bool(hold), Protocol.TXB_OBJECT(this.txb, this.permission)],
|
|
303
303
|
})
|
|
304
304
|
}
|
|
305
305
|
static rpc_de_sessions = (session: any) : Session[] => {
|
package/src/protocol.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { SuiClient, SuiObjectResponse, SuiObjectDataOptions, SuiTransactionBlockResponseOptions,
|
|
2
|
-
SuiTransactionBlockResponse, SuiObjectChange } from '@mysten/sui
|
|
3
|
-
import { Ed25519Keypair } from '@mysten/sui
|
|
2
|
+
SuiTransactionBlockResponse, SuiObjectChange } from '@mysten/sui/client';
|
|
3
|
+
import { Ed25519Keypair } from '@mysten/sui/keypairs/ed25519';
|
|
4
4
|
import { BCS, getSuiMoveConfig, toHEX, fromHEX, BcsReader } from '@mysten/bcs';
|
|
5
|
-
import { TransactionBlock, Inputs, TransactionResult, TransactionArgument } from '@mysten/sui
|
|
5
|
+
import { Transaction as TransactionBlock, Inputs, TransactionResult, TransactionArgument } from '@mysten/sui/transactions';
|
|
6
6
|
import { capitalize, IsValidAddress, IsValidArray, IsValidU128, IsValidU64, IsValidU8, IsValidUintLarge } from './utils'
|
|
7
7
|
import { GuardConstant } from './guard';
|
|
8
|
-
import { isValidSuiAddress, isValidSuiObjectId } from '@mysten/sui
|
|
8
|
+
import { isValidSuiAddress, isValidSuiObjectId } from '@mysten/sui/utils'
|
|
9
9
|
|
|
10
10
|
export enum MODULES {
|
|
11
11
|
machine = 'machine',
|
|
@@ -27,34 +27,34 @@ export enum MODULES {
|
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
export type PermissionAddress = TransactionResult;
|
|
30
|
-
export type PermissionObject = TransactionResult | string;
|
|
30
|
+
export type PermissionObject = TransactionResult | string | TransactionArgument;
|
|
31
31
|
export type RepositoryAddress = TransactionResult;
|
|
32
|
-
export type RepositoryObject = TransactionResult | string;
|
|
32
|
+
export type RepositoryObject = TransactionResult | string | TransactionArgument;
|
|
33
33
|
export type GuardAddress = TransactionResult;
|
|
34
|
-
export type GuardObject = TransactionResult | string ;
|
|
34
|
+
export type GuardObject = TransactionResult | string | TransactionArgument ;
|
|
35
35
|
export type MachineAddress = TransactionResult;
|
|
36
|
-
export type MachineObject = TransactionResult | string;
|
|
36
|
+
export type MachineObject = TransactionResult | string | TransactionArgument;
|
|
37
37
|
export type PassportObject = TransactionResult;
|
|
38
38
|
export type DemandAddress = TransactionResult;
|
|
39
|
-
export type DemandObject = TransactionResult | string;
|
|
40
|
-
export type ServiceObject = TransactionResult | string;
|
|
39
|
+
export type DemandObject = TransactionResult | string | TransactionArgument;
|
|
40
|
+
export type ServiceObject = TransactionResult | string | TransactionArgument;
|
|
41
41
|
export type ServiceAddress = TransactionResult;
|
|
42
|
-
export type ProgressObject = TransactionResult | string;
|
|
42
|
+
export type ProgressObject = TransactionResult | string | TransactionArgument;
|
|
43
43
|
export type ProgressAddress = TransactionResult;
|
|
44
|
-
export type RewardObject = TransactionResult | string;
|
|
44
|
+
export type RewardObject = TransactionResult | string | TransactionArgument;
|
|
45
45
|
export type RewardAddress = TransactionResult;
|
|
46
|
-
export type OrderObject = TransactionResult | string;
|
|
46
|
+
export type OrderObject = TransactionResult | string | TransactionArgument;
|
|
47
47
|
export type OrderAddress = TransactionResult;
|
|
48
|
-
export type DiscountObject = TransactionResult | string;
|
|
49
|
-
export type CoinObject = TransactionResult | string;
|
|
50
|
-
export type VoteObject = TransactionResult | string;
|
|
48
|
+
export type DiscountObject = TransactionResult | string | TransactionArgument;
|
|
49
|
+
export type CoinObject = TransactionResult | string | TransactionArgument;
|
|
50
|
+
export type VoteObject = TransactionResult | string | TransactionArgument;
|
|
51
51
|
export type VoteAddress = TransactionResult;
|
|
52
|
-
export type ResourceObject = TransactionResult | string;
|
|
52
|
+
export type ResourceObject = TransactionResult | string | TransactionArgument;
|
|
53
53
|
export type ResourceAddress = TransactionResult;
|
|
54
|
-
export type EntityObject = TransactionResult | string;
|
|
54
|
+
export type EntityObject = TransactionResult | string | TransactionArgument;
|
|
55
55
|
export type EntityAddress = TransactionResult;
|
|
56
56
|
|
|
57
|
-
export type TxbObject = string | TransactionResult | GuardObject | RepositoryObject | PermissionObject | MachineObject | PassportObject |
|
|
57
|
+
export type TxbObject = string | TransactionResult | TransactionArgument | GuardObject | RepositoryObject | PermissionObject | MachineObject | PassportObject |
|
|
58
58
|
DemandObject | ServiceObject | RewardObject | OrderObject | DiscountObject | VoteObject | DemandObject | ResourceObject | EntityObject;
|
|
59
59
|
|
|
60
60
|
export type WowokObject = TransactionResult;
|
|
@@ -191,9 +191,9 @@ export enum ENTRYPOINT {
|
|
|
191
191
|
}
|
|
192
192
|
|
|
193
193
|
const TESTNET = {
|
|
194
|
-
package: "
|
|
195
|
-
wowok_object: '
|
|
196
|
-
entity_object: '
|
|
194
|
+
package: "0xc5bcb215cb4bc861203739b7378199969d4f60f5e8130fa1ebf87987bdee0b6a",
|
|
195
|
+
wowok_object: '0xe9fdb9c3ad7aa81ee32d3fc9618d6e69637111253445e864f898d29179d11a4d',
|
|
196
|
+
entity_object: '0xe1205f43507c943a82d5a67cb7d2b3b251ff4a80f3b38e815a78291ed53125ce',
|
|
197
197
|
}
|
|
198
198
|
|
|
199
199
|
const MAINNET = {
|
|
@@ -316,8 +316,8 @@ export class Protocol {
|
|
|
316
316
|
const privkey = fromHEX(priv_key);
|
|
317
317
|
const keypair = Ed25519Keypair.fromSecretKey(privkey);
|
|
318
318
|
|
|
319
|
-
const response = await client.
|
|
320
|
-
|
|
319
|
+
const response = await client.signAndExecuteTransaction({
|
|
320
|
+
transaction: this.CurrentSession(),
|
|
321
321
|
signer: keypair,
|
|
322
322
|
options,
|
|
323
323
|
|
|
@@ -392,13 +392,10 @@ export class Protocol {
|
|
|
392
392
|
}; return 'loading';
|
|
393
393
|
}
|
|
394
394
|
|
|
395
|
-
static CLOCK_OBJECT =
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
});
|
|
400
|
-
static TXB_OBJECT(txb:TransactionBlock, arg:TxbObject) : TransactionResult {
|
|
401
|
-
if (typeof arg == 'string') return txb.object(arg) as TransactionResult;
|
|
395
|
+
static CLOCK_OBJECT = {objectId:'0x6', mutable:false, initialSharedVersion:1};
|
|
396
|
+
|
|
397
|
+
static TXB_OBJECT(txb:TransactionBlock, arg:TxbObject) : TransactionArgument {
|
|
398
|
+
if (typeof(arg) == 'string') return txb.object(arg) as TransactionArgument;
|
|
402
399
|
return arg;
|
|
403
400
|
}
|
|
404
401
|
static IsValidObjects = (arr:TxbObject[]) : boolean => {
|