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/service.ts CHANGED
@@ -1,11 +1,10 @@
1
- import { bcs, BCS, toHEX, fromHEX, getSuiMoveConfig } from '@mysten/bcs';
2
1
  import { IsValidArray, IsValidPercent, IsValidName_AllowEmpty, Bcs, array_unique, IsValidTokenType, IsValidDesription,
3
- IsValidAddress, IsValidEndpoint, OptionNone, IsValidUintLarge, IsValidInt, IsValidName, } from './utils'
2
+ IsValidAddress, IsValidEndpoint, IsValidUintLarge, IsValidInt, IsValidName, } from './utils'
4
3
  import { FnCallType, GuardObject, PassportObject, PermissionObject, RepositoryObject, MachineObject, ServiceAddress,
5
4
  ServiceObject, DiscountObject, OrderObject, OrderAddress, CoinObject, Protocol, ValueType,
6
5
  TxbObject} from './protocol';
7
6
  import { ERROR, Errors } from './exception';
8
- import { Resource } from './resource';
7
+ import { type TransactionResult, Transaction as TransactionBlock } from '@mysten/sui/transactions';
9
8
 
10
9
  export type Service_Guard_Percent = {
11
10
  guard:GuardObject;
@@ -62,24 +61,24 @@ export class Service {
62
61
  protected pay_token_type;
63
62
  protected permission;
64
63
  protected object : TxbObject;
65
- protected protocol;
64
+ protected txb;
66
65
 
67
66
  //static token2coin = (token:string) => { return '0x2::coin::Coin<' + token + '>'};
68
67
 
69
68
  get_pay_type() { return this.pay_token_type }
70
69
  get_object() { return this.object }
71
- private constructor(protocol: Protocol, pay_token_type:string, permission:PermissionObject) {
70
+ private constructor(txb: TransactionBlock, pay_token_type:string, permission:PermissionObject) {
72
71
  this.pay_token_type = pay_token_type
73
- this.protocol = protocol
72
+ this.txb = txb
74
73
  this.permission = permission
75
74
  this.object = ''
76
75
  }
77
- static From(protocol: Protocol, token_type:string, permission:PermissionObject, object:TxbObject) : Service {
78
- let s = new Service(protocol, token_type, permission);
79
- s.object = Protocol.TXB_OBJECT(protocol.CurrentSession(), object);
76
+ static From(txb: TransactionBlock, token_type:string, permission:PermissionObject, object:TxbObject) : Service {
77
+ let s = new Service(txb, token_type, permission);
78
+ s.object = Protocol.TXB_OBJECT(txb, object);
80
79
  return s
81
80
  }
82
- static New(protocol: Protocol, token_type:string, permission:PermissionObject, description:string,
81
+ static New(txb: TransactionBlock, token_type:string, permission:PermissionObject, description:string,
83
82
  payee_address:string, endpoint?:string, passport?:PassportObject) : Service {
84
83
  if (!Protocol.IsValidObjects([permission])) {
85
84
  ERROR(Errors.IsValidObjects)
@@ -99,21 +98,20 @@ export class Service {
99
98
  }
100
99
 
101
100
  let pay_token_type = token_type;
102
- let s = new Service(protocol, pay_token_type, permission);
103
- let txb = protocol.CurrentSession();
104
- let ep = endpoint? txb.pure(Bcs.getInstance().ser(ValueType.TYPE_OPTION_STRING, endpoint)) : OptionNone(txb);
101
+ let s = new Service(txb, pay_token_type, permission);
102
+ let ep = txb.pure.option('string', endpoint ? endpoint : undefined);
105
103
 
106
104
 
107
105
  if (passport) {
108
106
  s.object = txb.moveCall({
109
- target:protocol.ServiceFn('new_with_passport') as FnCallType,
110
- arguments:[passport, txb.pure(description), txb.pure(payee_address, BCS.ADDRESS), ep, Protocol.TXB_OBJECT(txb, permission)],
107
+ target:Protocol.Instance().ServiceFn('new_with_passport') as FnCallType,
108
+ arguments:[passport, txb.pure.string(description), txb.pure.address(payee_address), ep, Protocol.TXB_OBJECT(txb, permission)],
111
109
  typeArguments:[pay_token_type],
112
110
  })
113
111
  } else {
114
112
  s.object = txb.moveCall({
115
- target:protocol.ServiceFn('new') as FnCallType,
116
- arguments:[txb.pure(description), txb.pure(payee_address, BCS.ADDRESS), ep, Protocol.TXB_OBJECT(txb, permission)],
113
+ target:Protocol.Instance().ServiceFn('new') as FnCallType,
114
+ arguments:[txb.pure.string(description), txb.pure.address(payee_address), ep, Protocol.TXB_OBJECT(txb, permission)],
117
115
  typeArguments:[pay_token_type],
118
116
  })
119
117
  }
@@ -121,18 +119,16 @@ export class Service {
121
119
  }
122
120
 
123
121
  launch() : ServiceAddress {
124
- let txb = this.protocol.CurrentSession();
125
- return txb.moveCall({
126
- target:this.protocol.ServiceFn('create') as FnCallType,
127
- arguments:[Protocol.TXB_OBJECT(txb, this.object)],
122
+ return this.txb.moveCall({
123
+ target:Protocol.Instance().ServiceFn('create') as FnCallType,
124
+ arguments:[Protocol.TXB_OBJECT(this.txb, this.object)],
128
125
  typeArguments:[this.pay_token_type]
129
126
  })
130
127
  }
131
128
  destroy() {
132
- let txb = this.protocol.CurrentSession();
133
- txb.moveCall({
134
- target:this.protocol.ServiceFn('destroy') as FnCallType,
135
- arguments: [Protocol.TXB_OBJECT(txb, this.object)],
129
+ this.txb.moveCall({
130
+ target:Protocol.Instance().ServiceFn('destroy') as FnCallType,
131
+ arguments: [Protocol.TXB_OBJECT(this.txb, this.object)],
136
132
  typeArguments:[this.pay_token_type]
137
133
  })
138
134
  }
@@ -142,17 +138,16 @@ export class Service {
142
138
  ERROR(Errors.IsValidDesription)
143
139
  }
144
140
 
145
- let txb = this.protocol.CurrentSession();
146
141
  if (passport) {
147
- txb.moveCall({
148
- target:this.protocol.ServiceFn('description_set_with_passport') as FnCallType,
149
- arguments:[passport, Protocol.TXB_OBJECT(txb, this.object), txb.pure(description), Protocol.TXB_OBJECT(txb, this.permission)],
142
+ this.txb.moveCall({
143
+ target:Protocol.Instance().ServiceFn('description_set_with_passport') as FnCallType,
144
+ arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.string(description), Protocol.TXB_OBJECT(this.txb, this.permission)],
150
145
  typeArguments:[this.pay_token_type]
151
146
  })
152
147
  } else {
153
- txb.moveCall({
154
- target:this.protocol.ServiceFn('description_set') as FnCallType,
155
- arguments:[Protocol.TXB_OBJECT(txb, this.object), txb.pure(description), Protocol.TXB_OBJECT(txb, this.permission)],
148
+ this.txb.moveCall({
149
+ target:Protocol.Instance().ServiceFn('description_set') as FnCallType,
150
+ arguments:[Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.string(description), Protocol.TXB_OBJECT(this.txb, this.permission)],
156
151
  typeArguments:[this.pay_token_type]
157
152
  })
158
153
  }
@@ -164,20 +159,21 @@ export class Service {
164
159
  if (!IsValidName(item)) {
165
160
  ERROR(Errors.IsValidName, 'item')
166
161
  }
167
-
168
- let txb = this.protocol.CurrentSession();
162
+
169
163
  if (passport) {
170
- txb.moveCall({
171
- target:this.protocol.ServiceFn('price_set_with_passport') as FnCallType,
172
- arguments:[passport, Protocol.TXB_OBJECT(txb, this.object), txb.pure(item), txb.pure(price, BCS.U64),
173
- txb.pure(bNotFoundAssert, BCS.BOOL), Protocol.TXB_OBJECT(txb, this.permission)],
164
+ this.txb.moveCall({
165
+ target:Protocol.Instance().ServiceFn('price_set_with_passport') as FnCallType,
166
+ arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.string(item),
167
+ this.txb.pure.u64(price),
168
+ this.txb.pure.bool(bNotFoundAssert), Protocol.TXB_OBJECT(this.txb, this.permission)],
174
169
  typeArguments:[this.pay_token_type]
175
170
  })
176
171
  } else {
177
- txb.moveCall({
178
- target:this.protocol.ServiceFn('price_set') as FnCallType,
179
- arguments:[Protocol.TXB_OBJECT(txb, this.object), txb.pure(item), txb.pure(price, BCS.U64),
180
- txb.pure(bNotFoundAssert, BCS.BOOL), Protocol.TXB_OBJECT(txb, this.permission)],
172
+ this.txb.moveCall({
173
+ target:Protocol.Instance().ServiceFn('price_set') as FnCallType,
174
+ arguments:[Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.string(item),
175
+ this.txb.pure.u64(price),
176
+ this.txb.pure.bool(bNotFoundAssert), Protocol.TXB_OBJECT(this.txb, this.permission)],
181
177
  typeArguments:[this.pay_token_type]
182
178
  })
183
179
  }
@@ -189,20 +185,21 @@ export class Service {
189
185
  if (!IsValidInt(stock)) {
190
186
  ERROR(Errors.IsValidInt, 'stock')
191
187
  }
192
-
193
- let txb = this.protocol.CurrentSession();
188
+
194
189
  if (passport) {
195
- txb.moveCall({
196
- target:this.protocol.ServiceFn('stock_set_with_passport') as FnCallType,
197
- arguments:[passport, Protocol.TXB_OBJECT(txb, this.object), txb.pure(item), txb.pure(stock, BCS.U64),
198
- txb.pure(bNotFoundAssert, BCS.BOOL), Protocol.TXB_OBJECT(txb, this.permission)],
190
+ this.txb.moveCall({
191
+ target:Protocol.Instance().ServiceFn('stock_set_with_passport') as FnCallType,
192
+ arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.string(item),
193
+ this.txb.pure.u64(stock),
194
+ this.txb.pure.bool(bNotFoundAssert), Protocol.TXB_OBJECT(this.txb, this.permission)],
199
195
  typeArguments:[this.pay_token_type]
200
196
  })
201
197
  } else {
202
- txb.moveCall({
203
- target:this.protocol.ServiceFn('stock_set') as FnCallType,
204
- arguments:[Protocol.TXB_OBJECT(txb, this.object), txb.pure(item), txb.pure(stock, BCS.U64),
205
- txb.pure(bNotFoundAssert, BCS.BOOL), Protocol.TXB_OBJECT(txb, this.permission)],
198
+ this.txb.moveCall({
199
+ target:Protocol.Instance().ServiceFn('stock_set') as FnCallType,
200
+ arguments:[Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.string(item),
201
+ this.txb.pure.u64(stock),
202
+ this.txb.pure.bool(bNotFoundAssert), Protocol.TXB_OBJECT(this.txb, this.permission)],
206
203
  typeArguments:[this.pay_token_type]
207
204
  })
208
205
  }
@@ -214,20 +211,21 @@ export class Service {
214
211
  if (!IsValidUintLarge(stock_add)) {
215
212
  ERROR(Errors.IsValidUint, 'stock_add')
216
213
  }
217
-
218
- let txb = this.protocol.CurrentSession();
214
+
219
215
  if (passport) {
220
- txb.moveCall({
221
- target:this.protocol.ServiceFn('stock_add_with_passport') as FnCallType,
222
- arguments:[passport, Protocol.TXB_OBJECT(txb, this.object), txb.pure(item), txb.pure(stock_add, BCS.U64),
223
- txb.pure(bNotFoundAssert, BCS.BOOL), Protocol.TXB_OBJECT(txb, this.permission)],
216
+ this.txb.moveCall({
217
+ target:Protocol.Instance().ServiceFn('stock_add_with_passport') as FnCallType,
218
+ arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.string(item),
219
+ this.txb.pure.u64(stock_add),
220
+ this.txb.pure.bool(bNotFoundAssert), Protocol.TXB_OBJECT(this.txb, this.permission)],
224
221
  typeArguments:[this.pay_token_type]
225
222
  })
226
223
  } else {
227
- txb.moveCall({
228
- target:this.protocol.ServiceFn('stock_add') as FnCallType,
229
- arguments:[Protocol.TXB_OBJECT(txb, this.object), txb.pure(item), txb.pure(stock_add, BCS.U64),
230
- txb.pure(bNotFoundAssert, BCS.BOOL), Protocol.TXB_OBJECT(txb, this.permission)],
224
+ this.txb.moveCall({
225
+ target:Protocol.Instance().ServiceFn('stock_add') as FnCallType,
226
+ arguments:[Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.string(item),
227
+ this.txb.pure.u64(stock_add),
228
+ this.txb.pure.bool(bNotFoundAssert), Protocol.TXB_OBJECT(this.txb, this.permission)],
231
229
  typeArguments:[this.pay_token_type]
232
230
  })
233
231
  }
@@ -240,44 +238,46 @@ export class Service {
240
238
  ERROR(Errors.IsValidUint, 'stock_reduce')
241
239
  }
242
240
 
243
- let txb = this.protocol.CurrentSession();
244
241
  if (passport) {
245
- txb.moveCall({
246
- target:this.protocol.ServiceFn('stock_reduce_with_passport') as FnCallType,
247
- arguments:[passport, Protocol.TXB_OBJECT(txb, this.object), txb.pure(item), txb.pure(stock_reduce, BCS.U64),
248
- txb.pure(bNotFoundAssert, BCS.BOOL), Protocol.TXB_OBJECT(txb, this.permission)],
242
+ this.txb.moveCall({
243
+ target:Protocol.Instance().ServiceFn('stock_reduce_with_passport') as FnCallType,
244
+ arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.string(item),
245
+ this.txb.pure.u64(stock_reduce),
246
+ this.txb.pure.bool(bNotFoundAssert), Protocol.TXB_OBJECT(this.txb, this.permission)],
249
247
  typeArguments:[this.pay_token_type]
250
248
  })
251
249
  } else {
252
- txb.moveCall({
253
- target:this.protocol.ServiceFn('stock_reduce') as FnCallType,
254
- arguments:[Protocol.TXB_OBJECT(txb, this.object), txb.pure(item), txb.pure(stock_reduce, BCS.U64),
255
- txb.pure(bNotFoundAssert, BCS.BOOL), Protocol.TXB_OBJECT(txb, this.permission)],
250
+ this.txb.moveCall({
251
+ target:Protocol.Instance().ServiceFn('stock_reduce') as FnCallType,
252
+ arguments:[Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.string(item),
253
+ this.txb.pure.u64(stock_reduce),
254
+ this.txb.pure.bool(bNotFoundAssert), Protocol.TXB_OBJECT(this.txb, this.permission)],
256
255
  typeArguments:[this.pay_token_type]
257
256
  })
258
257
  }
259
258
  }
260
- set_sale_endpoint(item:string, endpoint?:string, bNotFoundAssert:boolean=true, passport?:PassportObject) {
259
+
260
+ set_sale_endpoint(item:string, endpoint?:string|null, bNotFoundAssert:boolean=true, passport?:PassportObject) {
261
261
  if (!IsValidName(item)) {
262
262
  ERROR(Errors.IsValidName, 'set_sale_endpoint')
263
263
  }
264
264
  if (endpoint && !IsValidEndpoint(endpoint)) {
265
265
  ERROR(Errors.IsValidEndpoint, 'set_sale_endpoint')
266
266
  }
267
- let txb = this.protocol.CurrentSession();
268
- let ep = endpoint? txb.pure(Bcs.getInstance().ser(ValueType.TYPE_OPTION_STRING, endpoint)) : OptionNone(txb);
267
+
268
+ let ep = this.txb.pure.option('string', endpoint ? endpoint : undefined);
269
269
  if (passport) {
270
- txb.moveCall({
271
- target:this.protocol.ServiceFn('sale_endpoint_set_with_passport') as FnCallType,
272
- arguments:[passport, Protocol.TXB_OBJECT(txb, this.object), txb.pure(item), ep,
273
- txb.pure(bNotFoundAssert, BCS.BOOL), Protocol.TXB_OBJECT(txb, this.permission)],
270
+ this.txb.moveCall({
271
+ target:Protocol.Instance().ServiceFn('sale_endpoint_set_with_passport') as FnCallType,
272
+ arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.string(item), ep,
273
+ this.txb.pure.bool(bNotFoundAssert), Protocol.TXB_OBJECT(this.txb, this.permission)],
274
274
  typeArguments:[this.pay_token_type]
275
275
  })
276
276
  } else {
277
- txb.moveCall({
278
- target:this.protocol.ServiceFn('sale_endpoint_set') as FnCallType,
279
- arguments:[Protocol.TXB_OBJECT(txb, this.object), txb.pure(item), ep,
280
- txb.pure(bNotFoundAssert, BCS.BOOL), Protocol.TXB_OBJECT(txb, this.permission)],
277
+ this.txb.moveCall({
278
+ target:Protocol.Instance().ServiceFn('sale_endpoint_set') as FnCallType,
279
+ arguments:[Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.string(item), ep,
280
+ this.txb.pure.bool(bNotFoundAssert), Protocol.TXB_OBJECT(this.txb, this.permission)],
281
281
  typeArguments:[this.pay_token_type]
282
282
  })
283
283
  }
@@ -287,18 +287,17 @@ export class Service {
287
287
  if (!IsValidAddress(payee)) {
288
288
  ERROR(Errors.IsValidAddress, 'payee');
289
289
  }
290
-
291
- let txb = this.protocol.CurrentSession();
290
+
292
291
  if (passport) {
293
- txb.moveCall({
294
- target:this.protocol.ServiceFn('payee_set_with_passport') as FnCallType,
295
- arguments:[passport, Protocol.TXB_OBJECT(txb, this.object), txb.pure(payee, BCS.ADDRESS), Protocol.TXB_OBJECT(txb, this.permission)],
292
+ this.txb.moveCall({
293
+ target:Protocol.Instance().ServiceFn('payee_set_with_passport') as FnCallType,
294
+ arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.address(payee), Protocol.TXB_OBJECT(this.txb, this.permission)],
296
295
  typeArguments:[this.pay_token_type]
297
296
  })
298
297
  } else {
299
- txb.moveCall({
300
- target:this.protocol.ServiceFn('payee_set') as FnCallType,
301
- arguments:[Protocol.TXB_OBJECT(txb, this.object), txb.pure(payee, BCS.ADDRESS), Protocol.TXB_OBJECT(txb, this.permission)],
298
+ this.txb.moveCall({
299
+ target:Protocol.Instance().ServiceFn('payee_set') as FnCallType,
300
+ arguments:[Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.address(payee), Protocol.TXB_OBJECT(this.txb, this.permission)],
302
301
  typeArguments:[this.pay_token_type]
303
302
  })
304
303
  }
@@ -307,18 +306,17 @@ export class Service {
307
306
  if (!Protocol.IsValidObjects([repository])) {
308
307
  ERROR(Errors.IsValidObjects, 'repository_add');
309
308
  }
310
-
311
- let txb = this.protocol.CurrentSession();
309
+
312
310
  if (passport) {
313
- txb.moveCall({
314
- target:this.protocol.ServiceFn('repository_add_with_passport') as FnCallType,
315
- arguments:[Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, repository), Protocol.TXB_OBJECT(txb, this.permission)],
311
+ this.txb.moveCall({
312
+ target:Protocol.Instance().ServiceFn('repository_add_with_passport') as FnCallType,
313
+ arguments:[Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, repository), Protocol.TXB_OBJECT(this.txb, this.permission)],
316
314
  typeArguments:[this.pay_token_type]
317
315
  })
318
316
  } else {
319
- txb.moveCall({
320
- target:this.protocol.ServiceFn('repository_add') as FnCallType,
321
- arguments:[Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, repository), Protocol.TXB_OBJECT(txb, this.permission)],
317
+ this.txb.moveCall({
318
+ target:Protocol.Instance().ServiceFn('repository_add') as FnCallType,
319
+ arguments:[Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, repository), Protocol.TXB_OBJECT(this.txb, this.permission)],
322
320
  typeArguments:[this.pay_token_type]
323
321
  })
324
322
  }
@@ -329,35 +327,34 @@ export class Service {
329
327
  if (!IsValidArray(repository_address, IsValidAddress)) {
330
328
  ERROR(Errors.IsValidArray, 'repository_address');
331
329
  }
332
-
333
- let txb = this.protocol.CurrentSession();
330
+
334
331
  if (passport) {
335
332
  if (removeall) {
336
- txb.moveCall({
337
- target:this.protocol.ServiceFn('repository_remove_all_with_passport') as FnCallType,
338
- arguments:[passport, Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, this.permission)],
333
+ this.txb.moveCall({
334
+ target:Protocol.Instance().ServiceFn('repository_remove_all_with_passport') as FnCallType,
335
+ arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, this.permission)],
339
336
  typeArguments:[this.pay_token_type]
340
337
  })
341
338
  } else {
342
- txb.moveCall({
343
- target:this.protocol.ServiceFn('repository_remove_with_passport') as FnCallType,
344
- arguments:[passport, Protocol.TXB_OBJECT(txb, this.object), txb.pure(array_unique(repository_address!), 'vector<address>'),
345
- Protocol.TXB_OBJECT(txb, this.permission)],
339
+ this.txb.moveCall({
340
+ target:Protocol.Instance().ServiceFn('repository_remove_with_passport') as FnCallType,
341
+ arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.vector('address', array_unique(repository_address!)),
342
+ Protocol.TXB_OBJECT(this.txb, this.permission)],
346
343
  typeArguments:[this.pay_token_type]
347
344
  })
348
345
  }
349
346
  } else {
350
347
  if (removeall) {
351
- txb.moveCall({
352
- target:this.protocol.ServiceFn('repository_remove_all') as FnCallType,
353
- arguments:[Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, this.permission)],
348
+ this.txb.moveCall({
349
+ target:Protocol.Instance().ServiceFn('repository_remove_all') as FnCallType,
350
+ arguments:[Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, this.permission)],
354
351
  typeArguments:[this.pay_token_type]
355
352
  })
356
353
  } else {
357
- txb.moveCall({
358
- target:this.protocol.ServiceFn('repository_remove') as FnCallType,
359
- arguments:[Protocol.TXB_OBJECT(txb, this.object), txb.pure(array_unique(repository_address!), 'vector<address>'),
360
- Protocol.TXB_OBJECT(txb, this.permission)],
354
+ this.txb.moveCall({
355
+ target:Protocol.Instance().ServiceFn('repository_remove') as FnCallType,
356
+ arguments:[Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.vector('address', array_unique(repository_address!)),
357
+ Protocol.TXB_OBJECT(this.txb, this.permission)],
361
358
  typeArguments:[this.pay_token_type]
362
359
  })
363
360
  }
@@ -375,21 +372,20 @@ export class Service {
375
372
  if (!bValid) {
376
373
  ERROR(Errors.InvalidParam, 'guards')
377
374
  }
378
-
379
- let txb = this.protocol.CurrentSession();
375
+
380
376
  guards.forEach((guard) => {
381
377
  if (passport) {
382
- txb.moveCall({
383
- target:this.protocol.ServiceFn('withdraw_guard_add_with_passport') as FnCallType,
384
- arguments:[passport, Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, guard.guard),
385
- txb.pure(guard.percent, BCS.U8), Protocol.TXB_OBJECT(txb, this.permission)],
378
+ this.txb.moveCall({
379
+ target:Protocol.Instance().ServiceFn('withdraw_guard_add_with_passport') as FnCallType,
380
+ arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, guard.guard),
381
+ this.txb.pure.u8(guard.percent), Protocol.TXB_OBJECT(this.txb, this.permission)],
386
382
  typeArguments:[this.pay_token_type]
387
383
  })
388
384
  } else {
389
- txb.moveCall({
390
- target:this.protocol.ServiceFn('withdraw_guard_add') as FnCallType,
391
- arguments:[Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, guard.guard), txb.pure(guard.percent, BCS.U8),
392
- Protocol.TXB_OBJECT(txb, this.permission)],
385
+ this.txb.moveCall({
386
+ target:Protocol.Instance().ServiceFn('withdraw_guard_add') as FnCallType,
387
+ arguments:[Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, guard.guard), this.txb.pure.u8(guard.percent),
388
+ Protocol.TXB_OBJECT(this.txb, this.permission)],
393
389
  typeArguments:[this.pay_token_type]
394
390
  })
395
391
  }
@@ -404,34 +400,33 @@ export class Service {
404
400
  ERROR(Errors.IsValidArray, 'guard_address')
405
401
  }
406
402
 
407
- let txb = this.protocol.CurrentSession();
408
403
  if (passport) {
409
404
  if (removeall) {
410
- txb.moveCall({
411
- target:this.protocol.ServiceFn('withdraw_guard_remove_all_with_passport') as FnCallType,
412
- arguments:[passport, Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, this.permission)],
405
+ this.txb.moveCall({
406
+ target:Protocol.Instance().ServiceFn('withdraw_guard_remove_all_with_passport') as FnCallType,
407
+ arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, this.permission)],
413
408
  typeArguments:[this.pay_token_type]
414
409
  })
415
410
  } else {
416
- txb.moveCall({
417
- target:this.protocol.ServiceFn('withdraw_guard_remove_with_passport') as FnCallType,
418
- arguments:[passport, Protocol.TXB_OBJECT(txb, this.object), txb.pure(array_unique(guard_address!), 'vector<address>'),
419
- Protocol.TXB_OBJECT(txb, this.permission)],
411
+ this.txb.moveCall({
412
+ target:Protocol.Instance().ServiceFn('withdraw_guard_remove_with_passport') as FnCallType,
413
+ arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.vector('address', array_unique(guard_address!)),
414
+ Protocol.TXB_OBJECT(this.txb, this.permission)],
420
415
  typeArguments:[this.pay_token_type]
421
416
  })
422
417
  }
423
418
  } else {
424
419
  if (removeall) {
425
- txb.moveCall({
426
- target:this.protocol.ServiceFn('withdraw_guard_remove_all') as FnCallType,
427
- arguments:[Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, this.permission)],
420
+ this.txb.moveCall({
421
+ target:Protocol.Instance().ServiceFn('withdraw_guard_remove_all') as FnCallType,
422
+ arguments:[Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, this.permission)],
428
423
  typeArguments:[this.pay_token_type]
429
424
  })
430
425
  } else {
431
- txb.moveCall({
432
- target:this.protocol.ServiceFn('withdraw_guard_remove') as FnCallType,
433
- arguments:[Protocol.TXB_OBJECT(txb, this.object), txb.pure(array_unique(guard_address!), 'vector<address>'),
434
- Protocol.TXB_OBJECT(txb, this.permission)],
426
+ this.txb.moveCall({
427
+ target:Protocol.Instance().ServiceFn('withdraw_guard_remove') as FnCallType,
428
+ arguments:[Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.vector('address', array_unique(guard_address!)),
429
+ Protocol.TXB_OBJECT(this.txb, this.permission)],
435
430
  typeArguments:[this.pay_token_type]
436
431
  })
437
432
  }
@@ -449,20 +444,19 @@ export class Service {
449
444
  ERROR(Errors.InvalidParam, 'guards')
450
445
  }
451
446
 
452
- let txb = this.protocol.CurrentSession();
453
447
  guards.forEach((guard) => {
454
448
  if (passport) {
455
- txb.moveCall({
456
- target:this.protocol.ServiceFn('refund_guard_add_with_passport') as FnCallType,
457
- arguments:[passport, Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, guard.guard),
458
- txb.pure(guard.percent, BCS.U8), Protocol.TXB_OBJECT(txb, this.permission)],
449
+ this.txb.moveCall({
450
+ target:Protocol.Instance().ServiceFn('refund_guard_add_with_passport') as FnCallType,
451
+ arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, guard.guard),
452
+ this.txb.pure.u8(guard.percent), Protocol.TXB_OBJECT(this.txb, this.permission)],
459
453
  typeArguments:[this.pay_token_type]
460
454
  })
461
455
  } else {
462
- txb.moveCall({
463
- target:this.protocol.ServiceFn('refund_guard_add') as FnCallType,
464
- arguments:[Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, guard.guard), txb.pure(guard.percent, BCS.U8),
465
- Protocol.TXB_OBJECT(txb, this.permission)],
456
+ this.txb.moveCall({
457
+ target:Protocol.Instance().ServiceFn('refund_guard_add') as FnCallType,
458
+ arguments:[Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, guard.guard), this.txb.pure.u8(guard.percent),
459
+ Protocol.TXB_OBJECT(this.txb, this.permission)],
466
460
  typeArguments:[this.pay_token_type]
467
461
  })
468
462
  }
@@ -474,34 +468,33 @@ export class Service {
474
468
  ERROR(Errors.InvalidParam, 'guard_address')
475
469
  }
476
470
 
477
- let txb = this.protocol.CurrentSession();
478
471
  if (passport) {
479
472
  if (removeall) {
480
- txb.moveCall({
481
- target:this.protocol.ServiceFn('refund_guard_remove_all_with_passport') as FnCallType,
482
- arguments:[passport, Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, this.permission)],
473
+ this.txb.moveCall({
474
+ target:Protocol.Instance().ServiceFn('refund_guard_remove_all_with_passport') as FnCallType,
475
+ arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, this.permission)],
483
476
  typeArguments:[this.pay_token_type]
484
477
  })
485
478
  } else {
486
- txb.moveCall({
487
- target:this.protocol.ServiceFn('refund_guard_remove_with_passport') as FnCallType,
488
- arguments:[passport, Protocol.TXB_OBJECT(txb, this.object), txb.pure(array_unique(guard_address!), 'vector<address>'),
489
- Protocol.TXB_OBJECT(txb, this.permission)],
479
+ this.txb.moveCall({
480
+ target:Protocol.Instance().ServiceFn('refund_guard_remove_with_passport') as FnCallType,
481
+ arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.vector('address', array_unique(guard_address!)),
482
+ Protocol.TXB_OBJECT(this.txb, this.permission)],
490
483
  typeArguments:[this.pay_token_type]
491
484
  })
492
485
  }
493
486
  } else {
494
487
  if (removeall) {
495
- txb.moveCall({
496
- target:this.protocol.ServiceFn('refund_guard_remove_all') as FnCallType,
497
- arguments:[Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, this.permission)],
488
+ this.txb.moveCall({
489
+ target:Protocol.Instance().ServiceFn('refund_guard_remove_all') as FnCallType,
490
+ arguments:[Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, this.permission)],
498
491
  typeArguments:[this.pay_token_type]
499
492
  })
500
493
  } else {
501
- txb.moveCall({
502
- target:this.protocol.ServiceFn('refund_guard_remove') as FnCallType,
503
- arguments:[Protocol.TXB_OBJECT(txb, this.object), txb.pure(array_unique(guard_address!), 'vector<address>'),
504
- Protocol.TXB_OBJECT(txb, this.permission)],
494
+ this.txb.moveCall({
495
+ target:Protocol.Instance().ServiceFn('refund_guard_remove') as FnCallType,
496
+ arguments:[Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.vector('address', array_unique(guard_address!)),
497
+ Protocol.TXB_OBJECT(this.txb, this.permission)],
505
498
  typeArguments:[this.pay_token_type]
506
499
  })
507
500
  }
@@ -534,25 +527,24 @@ export class Service {
534
527
  }
535
528
  names.push(s.item); price.push(s.price); stock.push(s.stock); endpoint.push(s.endpoint ?? '')
536
529
  })
537
-
538
- let txb = this.protocol.CurrentSession();
530
+
539
531
  if (passport) {
540
- txb.moveCall({
541
- target:this.protocol.ServiceFn('sales_add_with_passport') as FnCallType,
542
- arguments:[passport, Protocol.TXB_OBJECT(txb, this.object), txb.pure(Bcs.getInstance().ser(ValueType.TYPE_VEC_STRING, names)),
543
- txb.pure(Bcs.getInstance().ser(ValueType.TYPE_VEC_STRING, endpoint)), txb.pure(Bcs.getInstance().ser(ValueType.TYPE_VEC_U64, price)),
544
- txb.pure(Bcs.getInstance().ser(ValueType.TYPE_VEC_U64, stock)), txb.pure(Bcs.getInstance().ser(ValueType.TYPE_BOOL, bExistAssert)),
545
- Protocol.TXB_OBJECT(txb, this.permission)],
532
+ this.txb.moveCall({
533
+ target:Protocol.Instance().ServiceFn('sales_add_with_passport') as FnCallType,
534
+ arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure(Bcs.getInstance().ser(ValueType.TYPE_VEC_STRING, names)),
535
+ this.txb.pure(Bcs.getInstance().ser(ValueType.TYPE_VEC_STRING, endpoint)), this.txb.pure(Bcs.getInstance().ser(ValueType.TYPE_VEC_U64, price)),
536
+ this.txb.pure(Bcs.getInstance().ser(ValueType.TYPE_VEC_U64, stock)), this.txb.pure(Bcs.getInstance().ser(ValueType.TYPE_BOOL, bExistAssert)),
537
+ Protocol.TXB_OBJECT(this.txb, this.permission)],
546
538
  typeArguments:[this.pay_token_type]
547
539
  })
548
540
  } else {
549
- txb.moveCall({
550
- target:this.protocol.ServiceFn('sales_add') as FnCallType,
551
- arguments:[Protocol.TXB_OBJECT(txb, this.object), txb.pure(Bcs.getInstance().ser(ValueType.TYPE_VEC_STRING, names)),
552
- txb.pure(Bcs.getInstance().ser(ValueType.TYPE_VEC_STRING, endpoint)),
553
- txb.pure(Bcs.getInstance().ser(ValueType.TYPE_VEC_U64, price)), txb.pure(Bcs.getInstance().ser(ValueType.TYPE_VEC_U64, stock)),
554
- txb.pure(Bcs.getInstance().ser(ValueType.TYPE_BOOL, bExistAssert)),
555
- Protocol.TXB_OBJECT(txb, this.permission)],
541
+ this.txb.moveCall({
542
+ target:Protocol.Instance().ServiceFn('sales_add') as FnCallType,
543
+ arguments:[Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure(Bcs.getInstance().ser(ValueType.TYPE_VEC_STRING, names)),
544
+ this.txb.pure(Bcs.getInstance().ser(ValueType.TYPE_VEC_STRING, endpoint)),
545
+ this.txb.pure(Bcs.getInstance().ser(ValueType.TYPE_VEC_U64, price)), this.txb.pure(Bcs.getInstance().ser(ValueType.TYPE_VEC_U64, stock)),
546
+ this.txb.pure(Bcs.getInstance().ser(ValueType.TYPE_BOOL, bExistAssert)),
547
+ Protocol.TXB_OBJECT(this.txb, this.permission)],
556
548
  typeArguments:[this.pay_token_type]
557
549
  })
558
550
  }
@@ -563,20 +555,19 @@ export class Service {
563
555
  if (!IsValidArray(sales, IsValidName)) {
564
556
  ERROR(Errors.IsValidArray, 'remove_sales')
565
557
  }
566
-
567
- let txb = this.protocol.CurrentSession();
558
+
568
559
  if (passport) {
569
- txb.moveCall({
570
- target:this.protocol.ServiceFn('sales_remove_with_passport') as FnCallType,
571
- arguments:[passport, Protocol.TXB_OBJECT(txb, this.object), txb.pure(Bcs.getInstance().ser(ValueType.TYPE_VEC_STRING, array_unique(sales!))),
572
- Protocol.TXB_OBJECT(txb, this.permission)],
560
+ this.txb.moveCall({
561
+ target:Protocol.Instance().ServiceFn('sales_remove_with_passport') as FnCallType,
562
+ arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure(Bcs.getInstance().ser(ValueType.TYPE_VEC_STRING, array_unique(sales!))),
563
+ Protocol.TXB_OBJECT(this.txb, this.permission)],
573
564
  typeArguments:[this.pay_token_type]
574
565
  })
575
566
  } else {
576
- txb.moveCall({
577
- target:this.protocol.ServiceFn('sales_remove') as FnCallType,
578
- arguments:[Protocol.TXB_OBJECT(txb, this.object), txb.pure(Bcs.getInstance().ser(ValueType.TYPE_VEC_STRING, array_unique(sales!))),
579
- Protocol.TXB_OBJECT(txb, this.permission)],
567
+ this.txb.moveCall({
568
+ target:Protocol.Instance().ServiceFn('sales_remove') as FnCallType,
569
+ arguments:[Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure(Bcs.getInstance().ser(ValueType.TYPE_VEC_STRING, array_unique(sales!))),
570
+ Protocol.TXB_OBJECT(this.txb, this.permission)],
580
571
  typeArguments:[this.pay_token_type]
581
572
  })
582
573
  }
@@ -600,32 +591,30 @@ export class Service {
600
591
  if (!bValid) {
601
592
  ERROR(Errors.InvalidParam, 'discount_dispatch')
602
593
  }
603
-
604
- let txb = this.protocol.CurrentSession();
594
+ const clock = this.txb.sharedObjectRef(Protocol.CLOCK_OBJECT);
605
595
  discount_dispatch.forEach((discount) => {
606
- let price_greater = discount.discount?.price_greater ?
607
- txb.pure(Bcs.getInstance().ser(ValueType.TYPE_OPTION_U64, discount.discount.price_greater)) : OptionNone(txb);
608
- let time_start = discount.discount?.time_start ?
609
- txb.pure(Bcs.getInstance().ser(ValueType.TYPE_OPTION_U64, discount.discount.time_start)) : OptionNone(txb);
596
+ let price_greater = this.txb.pure.option('u64', discount.discount?.price_greater ? discount.discount?.price_greater : undefined);
597
+ let time_start = this.txb.pure.option('u64', discount.discount?.time_start ? discount.discount?.time_start : undefined);
610
598
 
611
599
  if (passport) {
612
- txb.moveCall({
613
- target:this.protocol.ServiceFn('dicscount_create_with_passport') as FnCallType,
614
- arguments:[passport, Protocol.TXB_OBJECT(txb, this.object), txb.pure(discount.discount.name),
615
- txb.pure(discount.discount.type, BCS.U8),
616
- txb.pure(discount.discount.off, BCS.U64), price_greater, time_start,
617
- txb.pure(discount.discount.duration_minutes, BCS.U64), txb.pure(discount.count, BCS.U64),
618
- Protocol.TXB_OBJECT(txb, this.permission), txb.pure(discount.receiver, BCS.ADDRESS), txb.object(Protocol.CLOCK_OBJECT)],
600
+ this.txb.moveCall({
601
+ target:Protocol.Instance().ServiceFn('dicscount_create_with_passport') as FnCallType,
602
+ arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.string(discount.discount.name),
603
+ this.txb.pure.u8(discount.discount.type),
604
+ this.txb.pure.u64(discount.discount.off), price_greater, time_start,
605
+ this.txb.pure.u64(discount.discount.duration_minutes), this.txb.pure.u64(discount.count),
606
+ Protocol.TXB_OBJECT(this.txb, this.permission), this.txb.pure.address(discount.receiver), this.txb.object(clock)],
619
607
  typeArguments:[this.pay_token_type]
620
608
  });
621
609
  } else {
622
- txb.moveCall({
623
- target:this.protocol.ServiceFn('dicscount_create') as FnCallType,
624
- arguments:[Protocol.TXB_OBJECT(txb, this.object), txb.pure(discount.discount.name),
625
- txb.pure(discount.discount.type, BCS.U8),
626
- txb.pure(discount.discount.off, BCS.U64), price_greater, time_start,
627
- txb.pure(discount.discount.duration_minutes, BCS.U64), txb.pure(discount.count, BCS.U64),
628
- Protocol.TXB_OBJECT(txb, this.permission), txb.pure(discount.receiver, BCS.ADDRESS), txb.object(Protocol.CLOCK_OBJECT)],
610
+ this.txb.moveCall({
611
+ target:Protocol.Instance().ServiceFn('dicscount_create') as FnCallType,
612
+ arguments:[Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.string(discount.discount.name),
613
+ this.txb.pure.u8(discount.discount.type),
614
+ this.txb.pure.u64(discount.discount.off), price_greater, time_start,
615
+ this.txb.pure.u64(discount.discount.duration_minutes), this.txb.pure.u64(discount.count),
616
+ Protocol.TXB_OBJECT(this.txb, this.permission), this.txb.pure.address(discount.receiver),
617
+ this.txb.object(clock)],
629
618
  typeArguments:[this.pay_token_type]
630
619
  })
631
620
  }
@@ -637,82 +626,79 @@ export class Service {
637
626
  if (!Protocol.IsValidObjects([order])) {
638
627
  ERROR(Errors.IsValidObjects, 'order')
639
628
  }
640
-
641
- let txb = this.protocol.CurrentSession();
629
+
642
630
  if (passport) {
643
- txb.moveCall({
644
- target:this.protocol.ServiceFn('withdraw_with_passport') as FnCallType,
645
- arguments:[passport, Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, order), Protocol.TXB_OBJECT(txb, this.permission)],
631
+ this.txb.moveCall({
632
+ target:Protocol.Instance().ServiceFn('withdraw_with_passport') as FnCallType,
633
+ arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, order), Protocol.TXB_OBJECT(this.txb, this.permission)],
646
634
  typeArguments:[this.pay_token_type]
647
635
  })
648
636
  } else {
649
- txb.moveCall({
650
- target:this.protocol.ServiceFn('withdraw') as FnCallType,
651
- arguments:[Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, order), Protocol.TXB_OBJECT(txb, this.permission)],
637
+ this.txb.moveCall({
638
+ target:Protocol.Instance().ServiceFn('withdraw') as FnCallType,
639
+ arguments:[Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, order), Protocol.TXB_OBJECT(this.txb, this.permission)],
652
640
  typeArguments:[this.pay_token_type]
653
641
  })
654
642
  }
655
643
 
656
644
  }
657
645
  set_buy_guard(guard?:GuardObject, passport?:PassportObject) {
658
- let txb = this.protocol.CurrentSession();
659
646
  if (passport) {
660
647
  if (guard) {
661
- txb.moveCall({
662
- target:this.protocol.ServiceFn('buy_guard_set_with_passport') as FnCallType,
663
- arguments:[passport, Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, guard), Protocol.TXB_OBJECT(txb, this.permission)],
648
+ this.txb.moveCall({
649
+ target:Protocol.Instance().ServiceFn('buy_guard_set_with_passport') as FnCallType,
650
+ arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, guard), Protocol.TXB_OBJECT(this.txb, this.permission)],
664
651
  typeArguments:[this.pay_token_type]
665
652
  })
666
653
  } else {
667
- txb.moveCall({
668
- target:this.protocol.ServiceFn('buy_guard_none_with_passport') as FnCallType,
669
- arguments:[passport, Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, this.permission)],
654
+ this.txb.moveCall({
655
+ target:Protocol.Instance().ServiceFn('buy_guard_none_with_passport') as FnCallType,
656
+ arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, this.permission)],
670
657
  typeArguments:[this.pay_token_type]
671
658
  })
672
659
  }
673
660
  } else {
674
661
  if (guard) {
675
- txb.moveCall({
676
- target:this.protocol.ServiceFn('buy_guard_set') as FnCallType,
677
- arguments:[Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, guard), Protocol.TXB_OBJECT(txb, this.permission)],
662
+ this.txb.moveCall({
663
+ target:Protocol.Instance().ServiceFn('buy_guard_set') as FnCallType,
664
+ arguments:[Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, guard), Protocol.TXB_OBJECT(this.txb, this.permission)],
678
665
  typeArguments:[this.pay_token_type]
679
666
  })
680
667
  } else {
681
- txb.moveCall({
682
- target:this.protocol.ServiceFn('buy_guard_none') as FnCallType,
683
- arguments:[Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, this.permission)],
668
+ this.txb.moveCall({
669
+ target:Protocol.Instance().ServiceFn('buy_guard_none') as FnCallType,
670
+ arguments:[Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, this.permission)],
684
671
  typeArguments:[this.pay_token_type]
685
672
  })
686
673
  }
687
674
  }
688
675
  }
689
676
  set_machine(machine?:MachineObject, passport?:PassportObject) {
690
- let txb = this.protocol.CurrentSession();
691
677
  if (passport) {
692
678
  if (machine) {
693
- txb.moveCall({
694
- target:this.protocol.ServiceFn('machine_set_with_passport') as FnCallType,
695
- arguments:[passport, Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, machine), Protocol.TXB_OBJECT(txb, this.permission)],
679
+ this.txb.moveCall({
680
+ target:Protocol.Instance().ServiceFn('machine_set_with_passport') as FnCallType,
681
+ arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, machine), Protocol.TXB_OBJECT(this.txb, this.permission)],
696
682
  typeArguments:[this.pay_token_type]
697
683
  })
698
684
  } else {
699
- txb.moveCall({
700
- target:this.protocol.ServiceFn('machine_none_with_passport') as FnCallType,
701
- arguments:[passport, Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, this.permission)],
685
+ this.txb.moveCall({
686
+ target:Protocol.Instance().ServiceFn('machine_none_with_passport') as FnCallType,
687
+ arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, this.permission)],
702
688
  typeArguments:[this.pay_token_type]
703
689
  })
704
690
  }
705
691
  } else {
706
692
  if (machine) {
707
- txb.moveCall({
708
- target:this.protocol.ServiceFn('machine_set') as FnCallType,
709
- arguments:[Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, machine), Protocol.TXB_OBJECT(txb, this.permission)],
693
+ this.txb.moveCall({
694
+ target:Protocol.Instance().ServiceFn('machine_set') as FnCallType,
695
+ arguments:[Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, machine), Protocol.TXB_OBJECT(this.txb, this.permission)],
710
696
  typeArguments:[this.pay_token_type]
711
697
  })
712
698
  } else {
713
- txb.moveCall({
714
- target:this.protocol.ServiceFn('machine_none') as FnCallType,
715
- arguments:[Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, this.permission)],
699
+ this.txb.moveCall({
700
+ target:Protocol.Instance().ServiceFn('machine_none') as FnCallType,
701
+ arguments:[Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, this.permission)],
716
702
  typeArguments:[this.pay_token_type]
717
703
  })
718
704
  }
@@ -724,52 +710,48 @@ export class Service {
724
710
  ERROR(Errors.IsValidEndpoint);
725
711
  }
726
712
 
727
- let txb = this.protocol.CurrentSession();
728
- let ep = endpoint? txb.pure(Bcs.getInstance().ser(ValueType.TYPE_OPTION_STRING, endpoint)) : OptionNone(txb);
729
-
713
+ let ep = this.txb.pure.option('string', endpoint ? endpoint : undefined);
730
714
  if (passport) {
731
- txb.moveCall({
732
- target:this.protocol.ServiceFn('endpoint_set_with_passport') as FnCallType,
733
- arguments:[passport, Protocol.TXB_OBJECT(txb, this.object), ep, Protocol.TXB_OBJECT(txb, this.permission)],
715
+ this.txb.moveCall({
716
+ target:Protocol.Instance().ServiceFn('endpoint_set_with_passport') as FnCallType,
717
+ arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object), ep, Protocol.TXB_OBJECT(this.txb, this.permission)],
734
718
  typeArguments:[this.pay_token_type]
735
719
  })
736
720
  } else {
737
- txb.moveCall({
738
- target:this.protocol.ServiceFn('endpoint_set') as FnCallType,
739
- arguments:[Protocol.TXB_OBJECT(txb, this.object), ep, Protocol.TXB_OBJECT(txb, this.permission)],
721
+ this.txb.moveCall({
722
+ target:Protocol.Instance().ServiceFn('endpoint_set') as FnCallType,
723
+ arguments:[Protocol.TXB_OBJECT(this.txb, this.object), ep, Protocol.TXB_OBJECT(this.txb, this.permission)],
740
724
  typeArguments:[this.pay_token_type]
741
725
  })
742
726
  }
743
727
  }
744
728
  publish(passport?:PassportObject) {
745
- let txb = this.protocol.CurrentSession();
746
729
  if (passport) {
747
- txb.moveCall({
748
- target:this.protocol.ServiceFn('publish_with_passport') as FnCallType,
749
- arguments:[passport, Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, this.permission)],
730
+ this.txb.moveCall({
731
+ target:Protocol.Instance().ServiceFn('publish_with_passport') as FnCallType,
732
+ arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, this.permission)],
750
733
  typeArguments:[this.pay_token_type]
751
734
  })
752
735
  } else {
753
- txb.moveCall({
754
- target:this.protocol.ServiceFn('publish') as FnCallType,
755
- arguments:[Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, this.permission)],
736
+ this.txb.moveCall({
737
+ target:Protocol.Instance().ServiceFn('publish') as FnCallType,
738
+ arguments:[Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, this.permission)],
756
739
  typeArguments:[this.pay_token_type]
757
740
  })
758
741
  }
759
742
 
760
743
  }
761
744
  clone(passport?:PassportObject) : ServiceObject {
762
- let txb = this.protocol.CurrentSession();
763
745
  if (passport) {
764
- return txb.moveCall({
765
- target:this.protocol.ServiceFn('clone_withpassport') as FnCallType,
766
- arguments:[passport, Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, this.permission)],
746
+ return this.txb.moveCall({
747
+ target:Protocol.Instance().ServiceFn('clone_withpassport') as FnCallType,
748
+ arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, this.permission)],
767
749
  typeArguments:[this.pay_token_type]
768
750
  })
769
751
  } else {
770
- return txb.moveCall({
771
- target:this.protocol.ServiceFn('clone') as FnCallType,
772
- arguments:[Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, this.permission)],
752
+ return this.txb.moveCall({
753
+ target:Protocol.Instance().ServiceFn('clone') as FnCallType,
754
+ arguments:[Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, this.permission)],
773
755
  typeArguments:[this.pay_token_type]
774
756
  })
775
757
  }
@@ -784,37 +766,36 @@ export class Service {
784
766
  }
785
767
 
786
768
  let req = array_unique(customer_required) as string[];
787
- let txb = this.protocol.CurrentSession();
769
+
788
770
  if (passport) {
789
- txb.moveCall({
790
- target:this.protocol.ServiceFn('required_set_with_passport') as FnCallType,
791
- arguments:[passport, Protocol.TXB_OBJECT(txb, this.object),
792
- txb.pure(Bcs.getInstance().ser(ValueType.TYPE_VEC_STRING, req)),
793
- txb.pure(pubkey, BCS.STRING), Protocol.TXB_OBJECT(txb, this.permission)],
771
+ this.txb.moveCall({
772
+ target:Protocol.Instance().ServiceFn('required_set_with_passport') as FnCallType,
773
+ arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object),
774
+ this.txb.pure(Bcs.getInstance().ser(ValueType.TYPE_VEC_STRING, req)),
775
+ this.txb.pure.string(pubkey), Protocol.TXB_OBJECT(this.txb, this.permission)],
794
776
  typeArguments:[this.pay_token_type]
795
777
  })
796
778
  } else {
797
- txb.moveCall({
798
- target:this.protocol.ServiceFn('required_set') as FnCallType,
799
- arguments:[Protocol.TXB_OBJECT(txb, this.object),
800
- txb.pure(Bcs.getInstance().ser(ValueType.TYPE_VEC_STRING, req)),
801
- txb.pure(pubkey, BCS.STRING), Protocol.TXB_OBJECT(txb, this.permission)],
779
+ this.txb.moveCall({
780
+ target:Protocol.Instance().ServiceFn('required_set') as FnCallType,
781
+ arguments:[Protocol.TXB_OBJECT(this.txb, this.object),
782
+ this.txb.pure(Bcs.getInstance().ser(ValueType.TYPE_VEC_STRING, req)),
783
+ this.txb.pure.string(pubkey), Protocol.TXB_OBJECT(this.txb, this.permission)],
802
784
  typeArguments:[this.pay_token_type]
803
785
  })
804
786
  }
805
787
  }
806
788
  remove_customer_required(passport?:PassportObject) {
807
- let txb = this.protocol.CurrentSession();
808
789
  if (passport) {
809
- txb.moveCall({
810
- target:this.protocol.ServiceFn('required_none_with_passport') as FnCallType,
811
- arguments:[passport, Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, this.permission)],
790
+ this.txb.moveCall({
791
+ target:Protocol.Instance().ServiceFn('required_none_with_passport') as FnCallType,
792
+ arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, this.permission)],
812
793
  typeArguments:[this.pay_token_type]
813
794
  })
814
795
  } else {
815
- txb.moveCall({
816
- target:this.protocol.ServiceFn('required_none') as FnCallType,
817
- arguments:[Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, this.permission)],
796
+ this.txb.moveCall({
797
+ target:Protocol.Instance().ServiceFn('required_none') as FnCallType,
798
+ arguments:[Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, this.permission)],
818
799
  typeArguments:[this.pay_token_type]
819
800
  })
820
801
  }
@@ -823,20 +804,19 @@ export class Service {
823
804
  if (!pubkey) {
824
805
  ERROR(Errors.InvalidParam, 'pubkey')
825
806
  }
826
-
827
- let txb = this.protocol.CurrentSession();
807
+
828
808
  if (passport) {
829
- txb.moveCall({
830
- target:this.protocol.ServiceFn('required_pubkey_set_with_passport') as FnCallType,
831
- arguments:[passport, Protocol.TXB_OBJECT(txb, this.object), txb.pure(pubkey, 'vector<u8>'),
832
- Protocol.TXB_OBJECT(txb, this.permission)],
809
+ this.txb.moveCall({
810
+ target:Protocol.Instance().ServiceFn('required_pubkey_set_with_passport') as FnCallType,
811
+ arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.string(pubkey),
812
+ Protocol.TXB_OBJECT(this.txb, this.permission)],
833
813
  typeArguments:[this.pay_token_type]
834
814
  })
835
815
  } else {
836
- txb.moveCall({
837
- target:this.protocol.ServiceFn('required_pubkey_set') as FnCallType,
838
- arguments:[Protocol.TXB_OBJECT(txb, this.object), txb.pure(pubkey, 'vector<u8>'),
839
- Protocol.TXB_OBJECT(txb, this.permission)],
816
+ this.txb.moveCall({
817
+ target:Protocol.Instance().ServiceFn('required_pubkey_set') as FnCallType,
818
+ arguments:[Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.string(pubkey),
819
+ Protocol.TXB_OBJECT(this.txb, this.permission)],
840
820
  typeArguments:[this.pay_token_type]
841
821
  })
842
822
  }
@@ -848,36 +828,34 @@ export class Service {
848
828
  if (!pubkey) {
849
829
  ERROR(Errors.InvalidParam, 'pubkey')
850
830
  }
851
-
852
- let txb = this.protocol.CurrentSession();
831
+
853
832
  if (passport) {
854
- txb.moveCall({
855
- target:this.protocol.ServiceFn('order_pubkey_update_with_passport') as FnCallType,
856
- arguments:[passport, Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, order), txb.pure(pubkey, 'vector<u8>'),
857
- Protocol.TXB_OBJECT(txb, this.permission)],
833
+ this.txb.moveCall({
834
+ target:Protocol.Instance().ServiceFn('order_pubkey_update_with_passport') as FnCallType,
835
+ arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, order), this.txb.pure.string(pubkey),
836
+ Protocol.TXB_OBJECT(this.txb, this.permission)],
858
837
  typeArguments:[this.pay_token_type]
859
838
  })
860
839
  } else {
861
- txb.moveCall({
862
- target:this.protocol.ServiceFn('order_pubkey_update') as FnCallType,
863
- arguments:[Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, order), txb.pure(pubkey, 'vector<u8>'),
864
- Protocol.TXB_OBJECT(txb, this.permission)],
840
+ this.txb.moveCall({
841
+ target:Protocol.Instance().ServiceFn('order_pubkey_update') as FnCallType,
842
+ arguments:[Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, order), this.txb.pure.string(pubkey),
843
+ Protocol.TXB_OBJECT(this.txb, this.permission)],
865
844
  typeArguments:[this.pay_token_type]
866
845
  })
867
846
  }
868
847
  }
869
848
  pause(pause:boolean, passport?:PassportObject) {
870
- let txb = this.protocol.CurrentSession();
871
849
  if (passport) {
872
- txb.moveCall({
873
- target:this.protocol.ServiceFn('pause_with_passport') as FnCallType,
874
- arguments:[passport, Protocol.TXB_OBJECT(txb, this.object), txb.pure(pause, BCS.BOOL), Protocol.TXB_OBJECT(txb, this.permission)],
850
+ this.txb.moveCall({
851
+ target:Protocol.Instance().ServiceFn('pause_with_passport') as FnCallType,
852
+ arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.bool(pause), Protocol.TXB_OBJECT(this.txb, this.permission)],
875
853
  typeArguments:[this.pay_token_type]
876
854
  })
877
855
  } else {
878
- txb.moveCall({
879
- target:this.protocol.ServiceFn('pause') as FnCallType,
880
- arguments:[Protocol.TXB_OBJECT(txb, this.object), txb.pure(pause, BCS.BOOL), Protocol.TXB_OBJECT(txb, this.permission)],
856
+ this.txb.moveCall({
857
+ target:Protocol.Instance().ServiceFn('pause') as FnCallType,
858
+ arguments:[Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.bool(pause), Protocol.TXB_OBJECT(this.txb, this.permission)],
881
859
  typeArguments:[this.pay_token_type]
882
860
  })
883
861
  }
@@ -888,17 +866,16 @@ export class Service {
888
866
  ERROR(Errors.IsValidObjects, 'order')
889
867
  }
890
868
 
891
- let txb = this.protocol.CurrentSession();
892
869
  if (passport) {
893
- txb.moveCall({
894
- target:this.protocol.ServiceFn('refund_with_passport') as FnCallType,
895
- arguments:[Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, order), passport],
870
+ this.txb.moveCall({
871
+ target:Protocol.Instance().ServiceFn('refund_with_passport') as FnCallType,
872
+ arguments:[Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, order), passport],
896
873
  typeArguments:[this.pay_token_type]
897
874
  })
898
875
  } else {
899
- txb.moveCall({
900
- target:this.protocol.ServiceFn('refund') as FnCallType,
901
- arguments:[Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, order)],
876
+ this.txb.moveCall({
877
+ target:Protocol.Instance().ServiceFn('refund') as FnCallType,
878
+ arguments:[Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, order)],
902
879
  typeArguments:[this.pay_token_type]
903
880
  })
904
881
  }
@@ -911,14 +888,13 @@ export class Service {
911
888
  if (!customer_info_crypto.pubkey || !customer_info_crypto.customer_info_crypt) {
912
889
  ERROR(Errors.InvalidParam, 'customer_info_crypto')
913
890
  }
914
-
915
- let txb = this.protocol.CurrentSession();
916
- txb.moveCall({
917
- target:this.protocol.ServiceFn('order_required_info_update') as FnCallType,
918
- arguments:[Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, order),
919
- txb.pure(customer_info_crypto.pubkey, 'vector<u8>'),
920
- txb.pure(customer_info_crypto.customer_pubkey, 'vector<u8>'),
921
- txb.pure(Bcs.getInstance().ser(ValueType.TYPE_VEC_VEC_U8, array_unique(customer_info_crypto.customer_info_crypt)))],
891
+
892
+ this.txb.moveCall({
893
+ target:Protocol.Instance().ServiceFn('order_required_info_update') as FnCallType,
894
+ arguments:[Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, order),
895
+ this.txb.pure.string(customer_info_crypto.pubkey),
896
+ this.txb.pure.string(customer_info_crypto.customer_pubkey),
897
+ this.txb.pure(Bcs.getInstance().ser(ValueType.TYPE_VEC_VEC_U8, array_unique(customer_info_crypto.customer_info_crypt)))],
922
898
  typeArguments:[this.pay_token_type]
923
899
  })
924
900
 
@@ -944,42 +920,41 @@ export class Service {
944
920
 
945
921
  let name:string[] = []; let price:number[] = []; let stock:number[] = []; let order;
946
922
  buy_items.forEach((b) => { name.push(b.item); price.push(b.max_price); stock.push(b.count)})
947
-
948
- let txb = this.protocol.CurrentSession();
923
+ const clock = this.txb.sharedObjectRef(Protocol.CLOCK_OBJECT);
949
924
  if (passport) {
950
925
  if (discount) {
951
- order = txb.moveCall({
952
- target:this.protocol.ServiceFn('dicount_buy_with_passport') as FnCallType,
953
- arguments: [passport, Protocol.TXB_OBJECT(txb, this.object), txb.pure(Bcs.getInstance().ser(ValueType.TYPE_VEC_STRING, name)),
954
- txb.pure(Bcs.getInstance().ser(ValueType.TYPE_VEC_U64, price)), txb.pure(Bcs.getInstance().ser(ValueType.TYPE_VEC_U64, stock)),
955
- Protocol.TXB_OBJECT(txb, coin), Protocol.TXB_OBJECT(txb, discount), txb.object(Protocol.CLOCK_OBJECT)],
926
+ order = this.txb.moveCall({
927
+ target:Protocol.Instance().ServiceFn('dicount_buy_with_passport') as FnCallType,
928
+ arguments: [passport, Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure(Bcs.getInstance().ser(ValueType.TYPE_VEC_STRING, name)),
929
+ this.txb.pure(Bcs.getInstance().ser(ValueType.TYPE_VEC_U64, price)), this.txb.pure(Bcs.getInstance().ser(ValueType.TYPE_VEC_U64, stock)),
930
+ Protocol.TXB_OBJECT(this.txb, coin), Protocol.TXB_OBJECT(this.txb, discount), this.txb.object(clock)],
956
931
  typeArguments:[this.pay_token_type]
957
932
  })} else {
958
- order = txb.moveCall({
959
- target:this.protocol.ServiceFn('buy_with_passport') as FnCallType,
960
- arguments: [passport, Protocol.TXB_OBJECT(txb, this.object), txb.pure(Bcs.getInstance().ser(ValueType.TYPE_VEC_STRING, name)),
961
- txb.pure(Bcs.getInstance().ser(ValueType.TYPE_VEC_U64, price)),
962
- txb.pure(Bcs.getInstance().ser(ValueType.TYPE_VEC_U64, stock)),
963
- Protocol.TXB_OBJECT(txb, coin)],
933
+ order = this.txb.moveCall({
934
+ target:Protocol.Instance().ServiceFn('buy_with_passport') as FnCallType,
935
+ arguments: [passport, Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure(Bcs.getInstance().ser(ValueType.TYPE_VEC_STRING, name)),
936
+ this.txb.pure(Bcs.getInstance().ser(ValueType.TYPE_VEC_U64, price)),
937
+ this.txb.pure(Bcs.getInstance().ser(ValueType.TYPE_VEC_U64, stock)),
938
+ Protocol.TXB_OBJECT(this.txb, coin)],
964
939
  typeArguments:[this.pay_token_type]
965
940
  })}
966
941
  } else {
967
942
  if (discount) {
968
- order = txb.moveCall({
969
- target:this.protocol.ServiceFn('disoucnt_buy') as FnCallType,
970
- arguments: [Protocol.TXB_OBJECT(txb, this.object), txb.pure(Bcs.getInstance().ser(ValueType.TYPE_VEC_STRING, name)),
971
- txb.pure(Bcs.getInstance().ser(ValueType.TYPE_VEC_U64, price)),
972
- txb.pure(Bcs.getInstance().ser(ValueType.TYPE_VEC_U64, stock)),
973
- Protocol.TXB_OBJECT(txb, coin),
974
- Protocol.TXB_OBJECT(txb, discount), txb.object(Protocol.CLOCK_OBJECT)],
943
+ order = this.txb.moveCall({
944
+ target:Protocol.Instance().ServiceFn('disoucnt_buy') as FnCallType,
945
+ arguments: [Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.vector('string', name),
946
+ this.txb.pure(Bcs.getInstance().ser(ValueType.TYPE_VEC_U64, price)),
947
+ this.txb.pure(Bcs.getInstance().ser(ValueType.TYPE_VEC_U64, stock)),
948
+ Protocol.TXB_OBJECT(this.txb, coin),
949
+ Protocol.TXB_OBJECT(this.txb, discount), this.txb.object(clock)],
975
950
  typeArguments:[this.pay_token_type]
976
951
  })} else {
977
- order = txb.moveCall({
978
- target:this.protocol.ServiceFn('buy') as FnCallType,
979
- arguments: [Protocol.TXB_OBJECT(txb, this.object), txb.pure(Bcs.getInstance().ser(ValueType.TYPE_VEC_STRING, name)),
980
- txb.pure(Bcs.getInstance().ser(ValueType.TYPE_VEC_U64, price)),
981
- txb.pure(Bcs.getInstance().ser(ValueType.TYPE_VEC_U64, stock)),
982
- Protocol.TXB_OBJECT(txb, coin)],
952
+ order = this.txb.moveCall({
953
+ target:Protocol.Instance().ServiceFn('buy') as FnCallType,
954
+ arguments: [Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.vector('string', name),
955
+ this.txb.pure(Bcs.getInstance().ser(ValueType.TYPE_VEC_U64, price)),
956
+ this.txb.pure(Bcs.getInstance().ser(ValueType.TYPE_VEC_U64, stock)),
957
+ Protocol.TXB_OBJECT(this.txb, coin)],
983
958
  typeArguments:[this.pay_token_type]
984
959
  })}
985
960
  }
@@ -989,15 +964,15 @@ export class Service {
989
964
  }
990
965
 
991
966
  if (machine) {
992
- return txb.moveCall({
993
- target:this.protocol.ServiceFn('order_create_with_machine') as FnCallType,
994
- arguments: [Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, order), Protocol.TXB_OBJECT(txb, machine)],
967
+ return this.txb.moveCall({
968
+ target:Protocol.Instance().ServiceFn('order_create_with_machine') as FnCallType,
969
+ arguments: [Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, order), Protocol.TXB_OBJECT(this.txb, machine)],
995
970
  typeArguments:[this.pay_token_type]
996
971
  })
997
972
  } else {
998
- return txb.moveCall({
999
- target:this.protocol.ServiceFn('order_create') as FnCallType,
1000
- arguments: [Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, order)],
973
+ return this.txb.moveCall({
974
+ target:Protocol.Instance().ServiceFn('order_create') as FnCallType,
975
+ arguments: [Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, order)],
1001
976
  typeArguments:[this.pay_token_type]
1002
977
  })
1003
978
  }
@@ -1008,10 +983,9 @@ export class Service {
1008
983
  ERROR(Errors.IsValidObjects, 'order & machine');
1009
984
  }
1010
985
 
1011
- let txb = this.protocol.CurrentSession();
1012
- txb.moveCall({
1013
- target:this.protocol.ServiceFn('order_create_with_machine') as FnCallType,
1014
- arguments: [Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, order), Protocol.TXB_OBJECT(txb, machine)],
986
+ this.txb.moveCall({
987
+ target:Protocol.Instance().ServiceFn('order_create_with_machine') as FnCallType,
988
+ arguments: [Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, order), Protocol.TXB_OBJECT(this.txb, machine)],
1015
989
  typeArguments:[this.pay_token_type]
1016
990
  })
1017
991
  }
@@ -1021,10 +995,9 @@ export class Service {
1021
995
  ERROR(Errors.IsValidObjects)
1022
996
  }
1023
997
 
1024
- let txb = this.protocol.CurrentSession();
1025
- txb.moveCall({
1026
- target:this.protocol.ServiceFn('permission_set') as FnCallType,
1027
- arguments: [Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, this.permission), Protocol.TXB_OBJECT(txb, new_permission)],
998
+ this.txb.moveCall({
999
+ target:Protocol.Instance().ServiceFn('permission_set') as FnCallType,
1000
+ arguments: [Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, this.permission), Protocol.TXB_OBJECT(this.txb, new_permission)],
1028
1001
  typeArguments:[this.pay_token_type]
1029
1002
  })
1030
1003
  this.permission = new_permission