wowok 1.2.11 → 1.3.3

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/src/progress.ts CHANGED
@@ -1,10 +1,11 @@
1
- import { BCS } from '@mysten/bcs';
1
+
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, OptionNone, IsValidInt } from './utils'
5
+ import { Bcs, array_unique,IsValidName, IsValidAddress, IsValidArray, IsValidInt } from './utils'
6
6
  import { ERROR, Errors } from './exception';
7
- import { Resource } from './resource';
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 protocol;
43
+ protected txb;
43
44
 
44
45
  get_object() { return this.object }
45
- private constructor(protocol:Protocol, machine:MachineObject, permission:PermissionObject) {
46
+ private constructor(txb:TransactionBlock, machine:MachineObject, permission:PermissionObject) {
46
47
  this.permission = permission;
47
- this.protocol = protocol;
48
+ this.txb = txb;
48
49
  this.machine = machine;
49
50
  this.object = '';
50
51
  }
51
- static From(protocol:Protocol, machine:MachineObject, permission:PermissionObject, object:TxbObject) : Progress{
52
- let p = new Progress(protocol, machine, permission)
53
- p.object = Protocol.TXB_OBJECT(protocol.CurrentSession(), 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(protocol:Protocol, machine:MachineObject, permission:PermissionObject, task?:string, passport?:PassportObject) : Progress {
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(protocol, machine, permission);
62
- let txb = protocol.CurrentSession();
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:protocol.ProgressFn('new_with_passport') as FnCallType,
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:protocol.ProgressFn('new') as FnCallType,
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
- let txb = this.protocol.CurrentSession();
81
- return txb.moveCall({
82
- target:this.protocol.ProgressFn('create') as FnCallType,
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
- let txb = this.protocol.CurrentSession();
95
- return txb.moveCall({
96
- target:this.protocol.ProgressFn('create_as_child') as FnCallType,
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
- let txb = this.protocol.CurrentSession();
104
- txb.moveCall({
105
- target:this.protocol.ProgressFn('destroy') as FnCallType,
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
- let txb = this.protocol.CurrentSession();
118
+
119
119
  if (passport) {
120
- txb.moveCall({
121
- target:this.protocol.ProgressFn('namedOperator_set_with_passport') as FnCallType,
122
- arguments: [passport, Protocol.TXB_OBJECT(txb, this.object), txb.pure(name),
123
- txb.pure(array_unique(addresses), 'vector<address>'),
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:this.protocol.ProgressFn('namedOperator_set') as FnCallType,
129
- arguments: [Protocol.TXB_OBJECT(txb, this.object), txb.pure(name),
130
- txb.pure(array_unique(addresses), 'vector<address>'),
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
- let txb = this.protocol.CurrentSession();
141
+
142
142
  if (passport) {
143
- txb.moveCall({
144
- target:this.protocol.ProgressFn('task_set_with_passport') as FnCallType,
145
- arguments: [passport, Protocol.TXB_OBJECT(txb, this.object),
146
- txb.pure(task_address, BCS.ADDRESS), Protocol.TXB_OBJECT(txb, this.machine), Protocol.TXB_OBJECT(txb, this.permission)],
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:this.protocol.ProgressFn('task_set') as FnCallType,
151
- arguments: [Protocol.TXB_OBJECT(txb, this.object), txb.pure(task_address, BCS.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,70 +158,69 @@ export class Progress {
158
158
  ERROR(Errors.IsValidObjects, 'repository')
159
159
  }
160
160
 
161
- let txb = this.protocol.CurrentSession();
162
161
  if (passport) {
163
162
  if (repository) {
164
- txb.moveCall({
165
- target:this.protocol.ProgressFn('context_repository_set_with_passport') as FnCallType,
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)],
163
+ this.txb.moveCall({
164
+ target:Protocol.Instance().ProgressFn('context_repository_set_with_passport') as FnCallType,
165
+ arguments: [passport, Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, repository),
166
+ Protocol.TXB_OBJECT(this.txb, this.machine), Protocol.TXB_OBJECT(this.txb, this.permission)],
168
167
  })
169
168
  } else {
170
- txb.moveCall({
171
- target:this.protocol.ProgressFn('context_repository_none_with_passport') as FnCallType,
172
- arguments: [passport, Protocol.TXB_OBJECT(txb, this.object),
173
- Protocol.TXB_OBJECT(txb, this.machine), Protocol.TXB_OBJECT(txb, this.permission)],
169
+ this.txb.moveCall({
170
+ target:Protocol.Instance().ProgressFn('context_repository_none_with_passport') as FnCallType,
171
+ arguments: [passport, Protocol.TXB_OBJECT(this.txb, this.object),
172
+ Protocol.TXB_OBJECT(this.txb, this.machine), Protocol.TXB_OBJECT(this.txb, this.permission)],
174
173
  })
175
174
  }
176
175
  } else {
177
176
  if (repository) {
178
- txb.moveCall({
179
- target:this.protocol.ProgressFn('context_repository_set') as FnCallType,
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)],
177
+ this.txb.moveCall({
178
+ target:Protocol.Instance().ProgressFn('context_repository_set') as FnCallType,
179
+ arguments: [Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, repository),
180
+ Protocol.TXB_OBJECT(this.txb, this.machine), Protocol.TXB_OBJECT(this.txb, this.permission)],
182
181
  })
183
182
  } else {
184
- txb.moveCall({
185
- target:this.protocol.ProgressFn('context_repository_none') as FnCallType,
186
- arguments: [Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, this.machine), Protocol.TXB_OBJECT(txb, this.permission)],
183
+ this.txb.moveCall({
184
+ target:Protocol.Instance().ProgressFn('context_repository_none') as FnCallType,
185
+ arguments: [Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, this.machine), Protocol.TXB_OBJECT(this.txb, this.permission)],
187
186
  })
188
187
  }
189
188
  }
190
189
  }
191
190
  unhold(next:ProgressNext, passport?:PassportObject) {
191
+ console.log(next)
192
192
  if (!Progress.IsValidProgressNext(next)) {
193
- ERROR(Errors.InvalidParam, 'next')
193
+ ERROR(Errors.InvalidParam, 'unhold')
194
194
  }
195
- let txb = this.protocol.CurrentSession();
195
+
196
196
  if (passport) {
197
- txb.moveCall({
198
- target:this.protocol.ProgressFn('unhold_with_passport') as FnCallType,
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:this.protocol.ProgressFn('unhold') as FnCallType,
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
- let txb = this.protocol.CurrentSession();
214
213
  if (passport) {
215
- txb.moveCall({
216
- target:this.protocol.ProgressFn('parent_none_with_passport') as FnCallType,
217
- arguments: [passport, Protocol.TXB_OBJECT(txb, this.object),
218
- Protocol.TXB_OBJECT(txb, this.machine), Protocol.TXB_OBJECT(txb, this.permission)],
214
+ this.txb.moveCall({
215
+ target:Protocol.Instance().ProgressFn('parent_none_with_passport') as FnCallType,
216
+ arguments: [passport, Protocol.TXB_OBJECT(this.txb, this.object),
217
+ Protocol.TXB_OBJECT(this.txb, this.machine), Protocol.TXB_OBJECT(this.txb, this.permission)],
219
218
  })
220
219
  } else {
221
- txb.moveCall({
222
- target:this.protocol.ProgressFn('parent_none') as FnCallType,
223
- arguments: [Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, this.machine),
224
- Protocol.TXB_OBJECT(txb, this.permission)],
220
+ this.txb.moveCall({
221
+ target:Protocol.Instance().ProgressFn('parent_none') as FnCallType,
222
+ arguments: [Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, this.machine),
223
+ Protocol.TXB_OBJECT(this.txb, this.permission)],
225
224
  })
226
225
  }
227
226
  }
@@ -234,31 +233,31 @@ export class Progress {
234
233
  ERROR(Errors.InvalidParam, 'parent')
235
234
  }
236
235
 
237
- let txb = this.protocol.CurrentSession();
238
236
  if (passport) {
239
- txb.moveCall({
240
- target:this.protocol.ProgressFn('parent_set_with_passport') as FnCallType,
241
- arguments: [passport, Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, this.machine),
242
- txb.pure(parent.parent_id, BCS.ADDRESS),
243
- txb.pure(parent.parent_session_id, BCS.U64),
244
- txb.pure(parent.next_node),
245
- txb.pure(parent.forward),
246
- Protocol.TXB_OBJECT(txb, this.permission)],
237
+ this.txb.moveCall({
238
+ target:Protocol.Instance().ProgressFn('parent_set_with_passport') as FnCallType,
239
+ arguments: [passport, Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, this.machine),
240
+ this.txb.pure.address(parent.parent_id),
241
+ this.txb.pure.u64(parent.parent_session_id),
242
+ this.txb.pure.string(parent.next_node),
243
+ this.txb.pure.string(parent.forward),
244
+ Protocol.TXB_OBJECT(this.txb, this.permission)],
247
245
  })
248
246
  } else {
249
- txb.moveCall({
250
- target:this.protocol.ProgressFn('parent_set') as FnCallType,
251
- arguments: [Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, this.machine),
252
- txb.pure(parent.parent_id, BCS.ADDRESS),
253
- txb.pure(parent.parent_session_id, BCS.U64),
254
- txb.pure(parent.next_node),
255
- txb.pure(parent.forward),
256
- Protocol.TXB_OBJECT(txb, this.permission)],
247
+ this.txb.moveCall({
248
+ target:Protocol.Instance().ProgressFn('parent_set') as FnCallType,
249
+ arguments: [Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, this.machine),
250
+ this.txb.pure.address(parent.parent_id),
251
+ this.txb.pure.u64(parent.parent_session_id),
252
+ this.txb.pure.string(parent.next_node),
253
+ this.txb.pure.string(parent.forward),
254
+ Protocol.TXB_OBJECT(this.txb, this.permission)],
257
255
  })
258
256
  }
259
257
  }
260
258
 
261
259
  next(next:ProgressNext, deliverables_address?:string, sub_id?:string, passport?:PassportObject) {
260
+ console.log(next)
262
261
  if (!Progress.IsValidProgressNext(next)) {
263
262
  ERROR(Errors.InvalidParam, 'next')
264
263
  }
@@ -268,40 +267,40 @@ export class Progress {
268
267
  if (sub_id && !IsValidAddress(sub_id)) {
269
268
  ERROR(Errors.IsValidAddress, 'sub_id');
270
269
  }
271
-
272
- let txb = this.protocol.CurrentSession();
273
- let diliverable = deliverables_address? txb.pure(Bcs.getInstance().ser(ValueType.TYPE_OPTION_ADDRESS, deliverables_address)) : OptionNone(txb)
274
- let sub = sub_id? txb.pure(Bcs.getInstance().ser(ValueType.TYPE_OPTION_ADDRESS, sub_id)) : OptionNone(txb)
270
+
271
+ let diliverable = this.txb.pure.option('address', deliverables_address ? deliverables_address : undefined);
272
+ let sub = this.txb.pure.option('address', sub_id ? sub_id : undefined);
275
273
 
276
274
  if (passport) {
277
- txb.moveCall({
278
- target:this.protocol.ProgressFn('next_with_passport') as FnCallType,
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)],
275
+ console.log(11111)
276
+ this.txb.moveCall({
277
+ target:Protocol.Instance().ProgressFn('next_with_passport') as FnCallType,
278
+ arguments: [passport, Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, this.machine),
279
+ this.txb.pure.string(next.next_node_name),
280
+ this.txb.pure.string(next.forward), diliverable, sub,
281
+ Protocol.TXB_OBJECT(this.txb, this.permission)],
283
282
  })
284
283
  } else {
285
- txb.moveCall({
286
- target:this.protocol.ProgressFn('next') as FnCallType,
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)],
284
+ this.txb.moveCall({
285
+ target:Protocol.Instance().ProgressFn('next') as FnCallType,
286
+ arguments: [Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, this.machine), this.txb.pure.string(next.next_node_name),
287
+ this.txb.pure.string(next.forward), diliverable, sub, Protocol.TXB_OBJECT(this.txb, this.permission)],
289
288
  })
290
289
  }
291
290
  }
292
291
 
293
292
  hold(next:ProgressNext, hold:boolean) {
294
293
  if (!Progress.IsValidProgressNext(next)) {
295
- ERROR(Errors.InvalidParam, 'next')
294
+ ERROR(Errors.InvalidParam, 'hold')
296
295
  }
297
-
298
- let txb = this.protocol.CurrentSession();
299
- txb.moveCall({
300
- target:this.protocol.ProgressFn('hold') as FnCallType,
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, BCS.BOOL), Protocol.TXB_OBJECT(txb, this.permission)],
296
+
297
+ this.txb.moveCall({
298
+ target:Protocol.Instance().ProgressFn('hold') as FnCallType,
299
+ arguments: [Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, this.machine), this.txb.pure.string(next.next_node_name),
300
+ this.txb.pure.string(next.forward), this.txb.pure.bool(hold), Protocol.TXB_OBJECT(this.txb, this.permission)],
303
301
  })
304
302
  }
303
+
305
304
  static rpc_de_sessions = (session: any) : Session[] => {
306
305
  let sessions : Session[] = [];
307
306
  session?.fields?.contents?.forEach((v:any) => {
package/src/protocol.ts CHANGED
@@ -1,11 +1,11 @@
1
1
  import { SuiClient, SuiObjectResponse, SuiObjectDataOptions, SuiTransactionBlockResponseOptions,
2
- SuiTransactionBlockResponse, SuiObjectChange } from '@mysten/sui.js/client';
3
- import { Ed25519Keypair } from '@mysten/sui.js/keypairs/ed25519';
4
- import { BCS, getSuiMoveConfig, toHEX, fromHEX, BcsReader } from '@mysten/bcs';
5
- import { TransactionBlock, Inputs, TransactionResult, TransactionArgument } from '@mysten/sui.js/transactions';
2
+ SuiTransactionBlockResponse, SuiObjectChange } from '@mysten/sui/client';
3
+ import { Ed25519Keypair } from '@mysten/sui/keypairs/ed25519';
4
+ import { toHEX, fromHEX, BcsReader } from '@mysten/bcs';
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.js/utils'
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: "0xc5bcb215cb4bc861203739b7378199969d4f60f5e8130fa1ebf87987bdee0b6a",
195
- wowok_object: '0xe9fdb9c3ad7aa81ee32d3fc9618d6e69637111253445e864f898d29179d11a4d',
196
- entity_object: '0xe1205f43507c943a82d5a67cb7d2b3b251ff4a80f3b38e815a78291ed53125ce',
194
+ package: "0x8f547c4bd00eedc72307d67c8c1c7b22da88c29ac530cce57bbfe7b6add45a91",
195
+ wowok_object: '0x1ccee2dbac69f76db35d92869cc4840fb537020a927dd035cdac811803d9d191',
196
+ entity_object: '0xb75b6953254cf9a426fb06b1ceb711784031cf7817b66630ba00daf5660ab04e',
197
197
  }
198
198
 
199
199
  const MAINNET = {
@@ -316,11 +316,10 @@ export class Protocol {
316
316
  const privkey = fromHEX(priv_key);
317
317
  const keypair = Ed25519Keypair.fromSecretKey(privkey);
318
318
 
319
- const response = await client.signAndExecuteTransactionBlock({
320
- transactionBlock: this.CurrentSession(),
319
+ const response = await client.signAndExecuteTransaction({
320
+ transaction: this.CurrentSession(),
321
321
  signer: keypair,
322
322
  options,
323
-
324
323
  });
325
324
  this.txb = undefined; // reset the txb to undefine
326
325
  return response;
@@ -392,13 +391,10 @@ export class Protocol {
392
391
  }; return 'loading';
393
392
  }
394
393
 
395
- static CLOCK_OBJECT = Inputs.SharedObjectRef({
396
- objectId:"0x6",
397
- mutable: false,
398
- initialSharedVersion: 1,
399
- });
400
- static TXB_OBJECT(txb:TransactionBlock, arg:TxbObject) : TransactionResult {
401
- if (typeof arg == 'string') return txb.object(arg) as TransactionResult;
394
+ static CLOCK_OBJECT = {objectId:'0x6', mutable:false, initialSharedVersion:1};
395
+
396
+ static TXB_OBJECT(txb:TransactionBlock, arg:TxbObject) : TransactionArgument {
397
+ if (typeof(arg) == 'string') return txb.object(arg) as TransactionArgument;
402
398
  return arg;
403
399
  }
404
400
  static IsValidObjects = (arr:TxbObject[]) : boolean => {