wowok 1.1.0 → 1.1.2

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.
Files changed (54) hide show
  1. package/README.md +1 -1
  2. package/dist/demand.d.ts +2 -3
  3. package/dist/demand.d.ts.map +1 -1
  4. package/dist/demand.js +19 -11
  5. package/dist/exception.d.ts +2 -1
  6. package/dist/exception.d.ts.map +1 -1
  7. package/dist/exception.js +1 -0
  8. package/dist/graphql.d.ts +2 -0
  9. package/dist/graphql.d.ts.map +1 -1
  10. package/dist/graphql.js +19 -0
  11. package/dist/guard.d.ts +18 -23
  12. package/dist/guard.d.ts.map +1 -1
  13. package/dist/guard.js +220 -199
  14. package/dist/index.d.ts +1 -0
  15. package/dist/index.d.ts.map +1 -1
  16. package/dist/index.js +1 -0
  17. package/dist/machine.d.ts +6 -6
  18. package/dist/machine.d.ts.map +1 -1
  19. package/dist/machine.js +7 -7
  20. package/dist/passport.d.ts +34 -22
  21. package/dist/passport.d.ts.map +1 -1
  22. package/dist/passport.js +124 -214
  23. package/dist/permission.d.ts +3 -0
  24. package/dist/permission.d.ts.map +1 -1
  25. package/dist/permission.js +5 -2
  26. package/dist/progress.js +3 -3
  27. package/dist/protocol.d.ts +11 -5
  28. package/dist/protocol.d.ts.map +1 -1
  29. package/dist/protocol.js +30 -6
  30. package/dist/repository.d.ts +2 -0
  31. package/dist/repository.d.ts.map +1 -1
  32. package/dist/repository.js +73 -5
  33. package/dist/service.d.ts +3 -3
  34. package/dist/service.d.ts.map +1 -1
  35. package/dist/service.js +115 -116
  36. package/dist/utils.d.ts +10 -2
  37. package/dist/utils.d.ts.map +1 -1
  38. package/dist/utils.js +39 -1
  39. package/dist/vote.js +8 -8
  40. package/package.json +1 -1
  41. package/src/exception.ts +1 -0
  42. package/src/graphql.ts +20 -0
  43. package/src/guard.ts +208 -192
  44. package/src/index.ts +1 -0
  45. package/src/machine.ts +10 -10
  46. package/src/passport.ts +139 -251
  47. package/src/permission.ts +5 -2
  48. package/src/progress.ts +3 -3
  49. package/src/protocol.ts +26 -5
  50. package/src/repository.ts +73 -5
  51. package/src/service.ts +25 -25
  52. package/src/utils.ts +44 -4
  53. package/src/vote.ts +8 -8
  54. package/tsconfig.json +3 -2
package/dist/service.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { BCS } from '@mysten/bcs';
2
- import { IsValidArray, IsValidPercent, IsValidName_AllowEmpty, BCS_CONVERT, array_unique, IsValidArgType, IsValidDesription, IsValidAddress, IsValidEndpoint, OptionNone, IsValidUint, IsValidInt, IsValidName, } from './utils';
2
+ import { IsValidArray, IsValidPercent, IsValidName_AllowEmpty, Bcs, array_unique, IsValidArgType, IsValidDesription, IsValidAddress, IsValidEndpoint, OptionNone, IsValidUint, IsValidInt, IsValidName, } from './utils';
3
3
  import { Protocol } from './protocol';
4
4
  import { ERROR, Errors } from './exception';
5
5
  export var Service_Discount_Type;
@@ -15,30 +15,30 @@ export var BuyRequiredEnum;
15
15
  BuyRequiredEnum["postcode"] = "postcode";
16
16
  })(BuyRequiredEnum || (BuyRequiredEnum = {}));
17
17
  export class Service {
18
- pay_type;
18
+ pay_token_type;
19
19
  permission;
20
20
  object;
21
21
  protocol;
22
- get_pay_type() { return this.pay_type; }
22
+ get_pay_type() { return this.pay_token_type; }
23
23
  get_object() { return this.object; }
24
- constructor(protocol, pay_type, permission) {
25
- this.pay_type = pay_type;
24
+ constructor(protocol, pay_token_type, permission) {
25
+ this.pay_token_type = pay_token_type;
26
26
  this.protocol = protocol;
27
27
  this.permission = permission;
28
28
  this.object = '';
29
29
  }
30
- static From(protocol, pay_type, permission, object) {
31
- let s = new Service(protocol, pay_type, permission);
30
+ static From(protocol, pay_token_type, permission, object) {
31
+ let s = new Service(protocol, pay_token_type, permission);
32
32
  s.object = Protocol.TXB_OBJECT(protocol.CurrentSession(), object);
33
33
  return s;
34
34
  }
35
- static New(protocol, pay_type, permission, description, payee_address, endpoint, passport) {
36
- let s = new Service(protocol, pay_type, permission);
35
+ static New(protocol, pay_token_type, permission, description, payee_address, endpoint, passport) {
36
+ let s = new Service(protocol, pay_token_type, permission);
37
37
  if (!Protocol.IsValidObjects([permission])) {
38
38
  ERROR(Errors.IsValidObjects);
39
39
  }
40
- if (!IsValidArgType(pay_type)) {
41
- ERROR(Errors.IsValidArgType, 'this.pay_type');
40
+ if (!IsValidArgType(pay_token_type)) {
41
+ ERROR(Errors.IsValidArgType, 'this.pay_token_type');
42
42
  }
43
43
  if (!IsValidDesription(description)) {
44
44
  ERROR(Errors.IsValidDesription);
@@ -50,19 +50,19 @@ export class Service {
50
50
  ERROR(Errors.IsValidEndpoint);
51
51
  }
52
52
  let txb = protocol.CurrentSession();
53
- let ep = endpoint ? txb.pure(BCS_CONVERT.ser_option_string(endpoint)) : OptionNone(txb);
53
+ let ep = endpoint ? txb.pure(Bcs.getInstance().ser_option_string(endpoint)) : OptionNone(txb);
54
54
  if (passport) {
55
55
  s.object = txb.moveCall({
56
56
  target: protocol.ServiceFn('new_with_passport'),
57
57
  arguments: [passport, txb.pure(description), txb.pure(payee_address, BCS.ADDRESS), ep, Protocol.TXB_OBJECT(txb, permission)],
58
- typeArguments: [pay_type],
58
+ typeArguments: [pay_token_type],
59
59
  });
60
60
  }
61
61
  else {
62
62
  s.object = txb.moveCall({
63
63
  target: protocol.ServiceFn('new'),
64
64
  arguments: [txb.pure(description), txb.pure(payee_address, BCS.ADDRESS), ep, Protocol.TXB_OBJECT(txb, permission)],
65
- typeArguments: [pay_type],
65
+ typeArguments: [pay_token_type],
66
66
  });
67
67
  }
68
68
  return s;
@@ -72,7 +72,7 @@ export class Service {
72
72
  return txb.moveCall({
73
73
  target: this.protocol.ServiceFn('create'),
74
74
  arguments: [Protocol.TXB_OBJECT(txb, this.object)],
75
- typeArguments: [this.pay_type]
75
+ typeArguments: [this.pay_token_type]
76
76
  });
77
77
  }
78
78
  destroy() {
@@ -80,7 +80,7 @@ export class Service {
80
80
  txb.moveCall({
81
81
  target: this.protocol.ServiceFn('destroy'),
82
82
  arguments: [Protocol.TXB_OBJECT(txb, this.object)],
83
- typeArguments: [this.pay_type]
83
+ typeArguments: [this.pay_token_type]
84
84
  });
85
85
  }
86
86
  set_description(description, passport) {
@@ -92,14 +92,14 @@ export class Service {
92
92
  txb.moveCall({
93
93
  target: this.protocol.ServiceFn('description_set_with_passport'),
94
94
  arguments: [passport, Protocol.TXB_OBJECT(txb, this.object), txb.pure(description), Protocol.TXB_OBJECT(txb, this.permission)],
95
- typeArguments: [this.pay_type]
95
+ typeArguments: [this.pay_token_type]
96
96
  });
97
97
  }
98
98
  else {
99
99
  txb.moveCall({
100
100
  target: this.protocol.ServiceFn('description_set'),
101
101
  arguments: [Protocol.TXB_OBJECT(txb, this.object), txb.pure(description), Protocol.TXB_OBJECT(txb, this.permission)],
102
- typeArguments: [this.pay_type]
102
+ typeArguments: [this.pay_token_type]
103
103
  });
104
104
  }
105
105
  }
@@ -116,7 +116,7 @@ export class Service {
116
116
  target: this.protocol.ServiceFn('price_set_with_passport'),
117
117
  arguments: [passport, Protocol.TXB_OBJECT(txb, this.object), txb.pure(item), txb.pure(price, BCS.U64),
118
118
  txb.pure(bNotFoundAssert, BCS.BOOL), Protocol.TXB_OBJECT(txb, this.permission)],
119
- typeArguments: [this.pay_type]
119
+ typeArguments: [this.pay_token_type]
120
120
  });
121
121
  }
122
122
  else {
@@ -124,7 +124,7 @@ export class Service {
124
124
  target: this.protocol.ServiceFn('price_set'),
125
125
  arguments: [Protocol.TXB_OBJECT(txb, this.object), txb.pure(item), txb.pure(price, BCS.U64),
126
126
  txb.pure(bNotFoundAssert, BCS.BOOL), Protocol.TXB_OBJECT(txb, this.permission)],
127
- typeArguments: [this.pay_type]
127
+ typeArguments: [this.pay_token_type]
128
128
  });
129
129
  }
130
130
  }
@@ -141,7 +141,7 @@ export class Service {
141
141
  target: this.protocol.ServiceFn('stock_set_with_passport'),
142
142
  arguments: [passport, Protocol.TXB_OBJECT(txb, this.object), txb.pure(item), txb.pure(stock, BCS.U64),
143
143
  txb.pure(bNotFoundAssert, BCS.BOOL), Protocol.TXB_OBJECT(txb, this.permission)],
144
- typeArguments: [this.pay_type]
144
+ typeArguments: [this.pay_token_type]
145
145
  });
146
146
  }
147
147
  else {
@@ -149,7 +149,7 @@ export class Service {
149
149
  target: this.protocol.ServiceFn('stock_set'),
150
150
  arguments: [Protocol.TXB_OBJECT(txb, this.object), txb.pure(item), txb.pure(stock, BCS.U64),
151
151
  txb.pure(bNotFoundAssert, BCS.BOOL), Protocol.TXB_OBJECT(txb, this.permission)],
152
- typeArguments: [this.pay_type]
152
+ typeArguments: [this.pay_token_type]
153
153
  });
154
154
  }
155
155
  }
@@ -166,7 +166,7 @@ export class Service {
166
166
  target: this.protocol.ServiceFn('stock_add_with_passport'),
167
167
  arguments: [passport, Protocol.TXB_OBJECT(txb, this.object), txb.pure(item), txb.pure(stock_add, BCS.U64),
168
168
  txb.pure(bNotFoundAssert, BCS.BOOL), Protocol.TXB_OBJECT(txb, this.permission)],
169
- typeArguments: [this.pay_type]
169
+ typeArguments: [this.pay_token_type]
170
170
  });
171
171
  }
172
172
  else {
@@ -174,7 +174,7 @@ export class Service {
174
174
  target: this.protocol.ServiceFn('stock_add'),
175
175
  arguments: [Protocol.TXB_OBJECT(txb, this.object), txb.pure(item), txb.pure(stock_add, BCS.U64),
176
176
  txb.pure(bNotFoundAssert, BCS.BOOL), Protocol.TXB_OBJECT(txb, this.permission)],
177
- typeArguments: [this.pay_type]
177
+ typeArguments: [this.pay_token_type]
178
178
  });
179
179
  }
180
180
  }
@@ -191,7 +191,7 @@ export class Service {
191
191
  target: this.protocol.ServiceFn('stock_reduce_with_passport'),
192
192
  arguments: [passport, Protocol.TXB_OBJECT(txb, this.object), txb.pure(item), txb.pure(stock_reduce, BCS.U64),
193
193
  txb.pure(bNotFoundAssert, BCS.BOOL), Protocol.TXB_OBJECT(txb, this.permission)],
194
- typeArguments: [this.pay_type]
194
+ typeArguments: [this.pay_token_type]
195
195
  });
196
196
  }
197
197
  else {
@@ -199,7 +199,7 @@ export class Service {
199
199
  target: this.protocol.ServiceFn('stock_reduce'),
200
200
  arguments: [Protocol.TXB_OBJECT(txb, this.object), txb.pure(item), txb.pure(stock_reduce, BCS.U64),
201
201
  txb.pure(bNotFoundAssert, BCS.BOOL), Protocol.TXB_OBJECT(txb, this.permission)],
202
- typeArguments: [this.pay_type]
202
+ typeArguments: [this.pay_token_type]
203
203
  });
204
204
  }
205
205
  }
@@ -212,35 +212,35 @@ export class Service {
212
212
  txb.moveCall({
213
213
  target: this.protocol.ServiceFn('payee_set_with_passport'),
214
214
  arguments: [passport, Protocol.TXB_OBJECT(txb, this.object), txb.pure(payee, BCS.ADDRESS), Protocol.TXB_OBJECT(txb, this.permission)],
215
- typeArguments: [this.pay_type]
215
+ typeArguments: [this.pay_token_type]
216
216
  });
217
217
  }
218
218
  else {
219
219
  txb.moveCall({
220
220
  target: this.protocol.ServiceFn('payee_set'),
221
221
  arguments: [Protocol.TXB_OBJECT(txb, this.object), txb.pure(payee, BCS.ADDRESS), Protocol.TXB_OBJECT(txb, this.permission)],
222
- typeArguments: [this.pay_type]
222
+ typeArguments: [this.pay_token_type]
223
223
  });
224
224
  }
225
225
  }
226
226
  repository_add(repository, passport) {
227
227
  if (!Protocol.IsValidObjects([this.object, this.permission, repository]))
228
228
  return false;
229
- if (!IsValidArgType(this.pay_type))
229
+ if (!IsValidArgType(this.pay_token_type))
230
230
  return false;
231
231
  let txb = this.protocol.CurrentSession();
232
232
  if (passport) {
233
233
  txb.moveCall({
234
234
  target: this.protocol.ServiceFn('repository_add_with_passport'),
235
235
  arguments: [Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, repository), Protocol.TXB_OBJECT(txb, this.permission)],
236
- typeArguments: [this.pay_type]
236
+ typeArguments: [this.pay_token_type]
237
237
  });
238
238
  }
239
239
  else {
240
240
  txb.moveCall({
241
241
  target: this.protocol.ServiceFn('repository_add'),
242
242
  arguments: [Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, repository), Protocol.TXB_OBJECT(txb, this.permission)],
243
- typeArguments: [this.pay_type]
243
+ typeArguments: [this.pay_token_type]
244
244
  });
245
245
  }
246
246
  }
@@ -257,7 +257,7 @@ export class Service {
257
257
  txb.moveCall({
258
258
  target: this.protocol.ServiceFn('repository_remove_all_with_passport'),
259
259
  arguments: [passport, Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, this.permission)],
260
- typeArguments: [this.pay_type]
260
+ typeArguments: [this.pay_token_type]
261
261
  });
262
262
  }
263
263
  else {
@@ -265,7 +265,7 @@ export class Service {
265
265
  target: this.protocol.ServiceFn('repository_remove_with_passport'),
266
266
  arguments: [passport, Protocol.TXB_OBJECT(txb, this.object), txb.pure(array_unique(repository_address), 'vector<address>'),
267
267
  Protocol.TXB_OBJECT(txb, this.permission)],
268
- typeArguments: [this.pay_type]
268
+ typeArguments: [this.pay_token_type]
269
269
  });
270
270
  }
271
271
  }
@@ -274,7 +274,7 @@ export class Service {
274
274
  txb.moveCall({
275
275
  target: this.protocol.ServiceFn('repository_remove_all'),
276
276
  arguments: [Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, this.permission)],
277
- typeArguments: [this.pay_type]
277
+ typeArguments: [this.pay_token_type]
278
278
  });
279
279
  }
280
280
  else {
@@ -282,7 +282,7 @@ export class Service {
282
282
  target: this.protocol.ServiceFn('repository_remove'),
283
283
  arguments: [Protocol.TXB_OBJECT(txb, this.object), txb.pure(array_unique(repository_address), 'vector<address>'),
284
284
  Protocol.TXB_OBJECT(txb, this.permission)],
285
- typeArguments: [this.pay_type]
285
+ typeArguments: [this.pay_token_type]
286
286
  });
287
287
  }
288
288
  }
@@ -305,7 +305,7 @@ export class Service {
305
305
  target: this.protocol.ServiceFn('withdraw_guard_add_with_passport'),
306
306
  arguments: [passport, Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, guard.guard),
307
307
  txb.pure(guard.percent, BCS.U8), Protocol.TXB_OBJECT(txb, this.permission)],
308
- typeArguments: [this.pay_type]
308
+ typeArguments: [this.pay_token_type]
309
309
  });
310
310
  }
311
311
  else {
@@ -313,7 +313,7 @@ export class Service {
313
313
  target: this.protocol.ServiceFn('withdraw_guard_add'),
314
314
  arguments: [Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, guard.guard), txb.pure(guard.percent, BCS.U8),
315
315
  Protocol.TXB_OBJECT(txb, this.permission)],
316
- typeArguments: [this.pay_type]
316
+ typeArguments: [this.pay_token_type]
317
317
  });
318
318
  }
319
319
  });
@@ -331,7 +331,7 @@ export class Service {
331
331
  txb.moveCall({
332
332
  target: this.protocol.ServiceFn('withdraw_guard_remove_all_with_passport'),
333
333
  arguments: [passport, Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, this.permission)],
334
- typeArguments: [this.pay_type]
334
+ typeArguments: [this.pay_token_type]
335
335
  });
336
336
  }
337
337
  else {
@@ -339,7 +339,7 @@ export class Service {
339
339
  target: this.protocol.ServiceFn('withdraw_guard_remove_with_passport'),
340
340
  arguments: [passport, Protocol.TXB_OBJECT(txb, this.object), txb.pure(array_unique(guard_address), 'vector<address>'),
341
341
  Protocol.TXB_OBJECT(txb, this.permission)],
342
- typeArguments: [this.pay_type]
342
+ typeArguments: [this.pay_token_type]
343
343
  });
344
344
  }
345
345
  }
@@ -348,7 +348,7 @@ export class Service {
348
348
  txb.moveCall({
349
349
  target: this.protocol.ServiceFn('withdraw_guard_remove_all'),
350
350
  arguments: [Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, this.permission)],
351
- typeArguments: [this.pay_type]
351
+ typeArguments: [this.pay_token_type]
352
352
  });
353
353
  }
354
354
  else {
@@ -356,7 +356,7 @@ export class Service {
356
356
  target: this.protocol.ServiceFn('withdraw_guard_remove'),
357
357
  arguments: [Protocol.TXB_OBJECT(txb, this.object), txb.pure(array_unique(guard_address), 'vector<address>'),
358
358
  Protocol.TXB_OBJECT(txb, this.permission)],
359
- typeArguments: [this.pay_type]
359
+ typeArguments: [this.pay_token_type]
360
360
  });
361
361
  }
362
362
  }
@@ -379,7 +379,7 @@ export class Service {
379
379
  target: this.protocol.ServiceFn('refund_guard_add_with_passport'),
380
380
  arguments: [passport, Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, guard.guard),
381
381
  txb.pure(guard.percent, BCS.U8), Protocol.TXB_OBJECT(txb, this.permission)],
382
- typeArguments: [this.pay_type]
382
+ typeArguments: [this.pay_token_type]
383
383
  });
384
384
  }
385
385
  else {
@@ -387,7 +387,7 @@ export class Service {
387
387
  target: this.protocol.ServiceFn('refund_guard_add'),
388
388
  arguments: [Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, guard.guard), txb.pure(guard.percent, BCS.U8),
389
389
  Protocol.TXB_OBJECT(txb, this.permission)],
390
- typeArguments: [this.pay_type]
390
+ typeArguments: [this.pay_token_type]
391
391
  });
392
392
  }
393
393
  });
@@ -405,7 +405,7 @@ export class Service {
405
405
  txb.moveCall({
406
406
  target: this.protocol.ServiceFn('refund_guard_remove_all_with_passport'),
407
407
  arguments: [passport, Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, this.permission)],
408
- typeArguments: [this.pay_type]
408
+ typeArguments: [this.pay_token_type]
409
409
  });
410
410
  }
411
411
  else {
@@ -413,7 +413,7 @@ export class Service {
413
413
  target: this.protocol.ServiceFn('refund_guard_remove_with_passport'),
414
414
  arguments: [passport, Protocol.TXB_OBJECT(txb, this.object), txb.pure(array_unique(guard_address), 'vector<address>'),
415
415
  Protocol.TXB_OBJECT(txb, this.permission)],
416
- typeArguments: [this.pay_type]
416
+ typeArguments: [this.pay_token_type]
417
417
  });
418
418
  }
419
419
  }
@@ -422,7 +422,7 @@ export class Service {
422
422
  txb.moveCall({
423
423
  target: this.protocol.ServiceFn('refund_guard_remove_all'),
424
424
  arguments: [Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, this.permission)],
425
- typeArguments: [this.pay_type]
425
+ typeArguments: [this.pay_token_type]
426
426
  });
427
427
  }
428
428
  else {
@@ -430,7 +430,7 @@ export class Service {
430
430
  target: this.protocol.ServiceFn('refund_guard_remove'),
431
431
  arguments: [Protocol.TXB_OBJECT(txb, this.object), txb.pure(array_unique(guard_address), 'vector<address>'),
432
432
  Protocol.TXB_OBJECT(txb, this.permission)],
433
- typeArguments: [this.pay_type]
433
+ typeArguments: [this.pay_token_type]
434
434
  });
435
435
  }
436
436
  }
@@ -467,19 +467,19 @@ export class Service {
467
467
  if (passport) {
468
468
  txb.moveCall({
469
469
  target: this.protocol.ServiceFn('sales_add_with_passport'),
470
- arguments: [passport, Protocol.TXB_OBJECT(txb, this.object), txb.pure(BCS_CONVERT.ser_vector_string(names)),
471
- txb.pure(BCS_CONVERT.ser_vector_u64(price)), txb.pure(BCS_CONVERT.ser_vector_u64(stock)),
470
+ arguments: [passport, Protocol.TXB_OBJECT(txb, this.object), txb.pure(Bcs.getInstance().ser_vector_string(names)),
471
+ txb.pure(Bcs.getInstance().ser_vector_u64(price)), txb.pure(Bcs.getInstance().ser_vector_u64(stock)),
472
472
  Protocol.TXB_OBJECT(txb, this.permission)],
473
- typeArguments: [this.pay_type]
473
+ typeArguments: [this.pay_token_type]
474
474
  });
475
475
  }
476
476
  else {
477
477
  txb.moveCall({
478
478
  target: this.protocol.ServiceFn('sales_add'),
479
- arguments: [Protocol.TXB_OBJECT(txb, this.object), txb.pure(BCS_CONVERT.ser_vector_string(names)),
480
- txb.pure(BCS_CONVERT.ser_vector_u64(price)), txb.pure(BCS_CONVERT.ser_vector_u64(stock)),
479
+ arguments: [Protocol.TXB_OBJECT(txb, this.object), txb.pure(Bcs.getInstance().ser_vector_string(names)),
480
+ txb.pure(Bcs.getInstance().ser_vector_u64(price)), txb.pure(Bcs.getInstance().ser_vector_u64(stock)),
481
481
  Protocol.TXB_OBJECT(txb, this.permission)],
482
- typeArguments: [this.pay_type]
482
+ typeArguments: [this.pay_token_type]
483
483
  });
484
484
  }
485
485
  }
@@ -496,15 +496,15 @@ export class Service {
496
496
  txb.moveCall({
497
497
  target: this.protocol.ServiceFn('sales_remove_all_with_passport'),
498
498
  arguments: [passport, Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, this.permission)],
499
- typeArguments: [this.pay_type]
499
+ typeArguments: [this.pay_token_type]
500
500
  });
501
501
  }
502
502
  else {
503
503
  txb.moveCall({
504
504
  target: this.protocol.ServiceFn('sales_remove_with_passport'),
505
- arguments: [passport, Protocol.TXB_OBJECT(txb, this.object), txb.pure(BCS_CONVERT.ser_vector_string(array_unique(sales))),
505
+ arguments: [passport, Protocol.TXB_OBJECT(txb, this.object), txb.pure(Bcs.getInstance().ser_vector_string(array_unique(sales))),
506
506
  Protocol.TXB_OBJECT(txb, this.permission)],
507
- typeArguments: [this.pay_type]
507
+ typeArguments: [this.pay_token_type]
508
508
  });
509
509
  }
510
510
  }
@@ -513,15 +513,15 @@ export class Service {
513
513
  txb.moveCall({
514
514
  target: this.protocol.ServiceFn('sales_remove_all'),
515
515
  arguments: [Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, this.permission)],
516
- typeArguments: [this.pay_type]
516
+ typeArguments: [this.pay_token_type]
517
517
  });
518
518
  }
519
519
  else {
520
520
  txb.moveCall({
521
521
  target: this.protocol.ServiceFn('sales_remove'),
522
- arguments: [Protocol.TXB_OBJECT(txb, this.object), txb.pure(BCS_CONVERT.ser_vector_string(array_unique(sales))),
522
+ arguments: [Protocol.TXB_OBJECT(txb, this.object), txb.pure(Bcs.getInstance().ser_vector_string(array_unique(sales))),
523
523
  Protocol.TXB_OBJECT(txb, this.permission)],
524
- typeArguments: [this.pay_type]
524
+ typeArguments: [this.pay_token_type]
525
525
  });
526
526
  }
527
527
  }
@@ -553,9 +553,9 @@ export class Service {
553
553
  let txb = this.protocol.CurrentSession();
554
554
  discount_dispatch.forEach((discount) => {
555
555
  let price_greater = discount.discount?.price_greater ?
556
- txb.pure(BCS_CONVERT.ser_option_u64(discount.discount.price_greater)) : OptionNone(txb);
556
+ txb.pure(Bcs.getInstance().ser_option_u64(discount.discount.price_greater)) : OptionNone(txb);
557
557
  let time_start = discount.discount?.time_start ?
558
- txb.pure(BCS_CONVERT.ser_option_u64(discount.discount.time_start)) : OptionNone(txb);
558
+ txb.pure(Bcs.getInstance().ser_option_u64(discount.discount.time_start)) : OptionNone(txb);
559
559
  if (passport) {
560
560
  txb.moveCall({
561
561
  target: this.protocol.ServiceFn('dicscount_create_with_passport'),
@@ -564,7 +564,7 @@ export class Service {
564
564
  txb.pure(discount.discount.off, BCS.U64), price_greater, time_start,
565
565
  txb.pure(discount.discount.duration_minutes, BCS.U64), txb.pure(discount.count, BCS.U64),
566
566
  Protocol.TXB_OBJECT(txb, this.permission), txb.pure(discount.receiver, BCS.ADDRESS), txb.object(Protocol.CLOCK_OBJECT)],
567
- typeArguments: [this.pay_type]
567
+ typeArguments: [this.pay_token_type]
568
568
  });
569
569
  }
570
570
  else {
@@ -575,7 +575,7 @@ export class Service {
575
575
  txb.pure(discount.discount.off, BCS.U64), price_greater, time_start,
576
576
  txb.pure(discount.discount.duration_minutes, BCS.U64), txb.pure(discount.count, BCS.U64),
577
577
  Protocol.TXB_OBJECT(txb, this.permission), txb.pure(discount.receiver, BCS.ADDRESS), txb.object(Protocol.CLOCK_OBJECT)],
578
- typeArguments: [this.pay_type]
578
+ typeArguments: [this.pay_token_type]
579
579
  });
580
580
  }
581
581
  });
@@ -590,14 +590,14 @@ export class Service {
590
590
  txb.moveCall({
591
591
  target: this.protocol.ServiceFn('withdraw_with_passport'),
592
592
  arguments: [passport, Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, order), Protocol.TXB_OBJECT(txb, this.permission)],
593
- typeArguments: [this.pay_type]
593
+ typeArguments: [this.pay_token_type]
594
594
  });
595
595
  }
596
596
  else {
597
597
  txb.moveCall({
598
598
  target: this.protocol.ServiceFn('withdraw'),
599
599
  arguments: [Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, order), Protocol.TXB_OBJECT(txb, this.permission)],
600
- typeArguments: [this.pay_type]
600
+ typeArguments: [this.pay_token_type]
601
601
  });
602
602
  }
603
603
  }
@@ -608,14 +608,14 @@ export class Service {
608
608
  txb.moveCall({
609
609
  target: this.protocol.ServiceFn('buy_guard_set_with_passport'),
610
610
  arguments: [passport, Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, guard), Protocol.TXB_OBJECT(txb, this.permission)],
611
- typeArguments: [this.pay_type]
611
+ typeArguments: [this.pay_token_type]
612
612
  });
613
613
  }
614
614
  else {
615
615
  txb.moveCall({
616
616
  target: this.protocol.ServiceFn('buy_guard_none_with_passport'),
617
617
  arguments: [passport, Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, this.permission)],
618
- typeArguments: [this.pay_type]
618
+ typeArguments: [this.pay_token_type]
619
619
  });
620
620
  }
621
621
  }
@@ -624,14 +624,14 @@ export class Service {
624
624
  txb.moveCall({
625
625
  target: this.protocol.ServiceFn('buy_guard_set'),
626
626
  arguments: [Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, guard), Protocol.TXB_OBJECT(txb, this.permission)],
627
- typeArguments: [this.pay_type]
627
+ typeArguments: [this.pay_token_type]
628
628
  });
629
629
  }
630
630
  else {
631
631
  txb.moveCall({
632
632
  target: this.protocol.ServiceFn('buy_guard_none'),
633
633
  arguments: [Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, this.permission)],
634
- typeArguments: [this.pay_type]
634
+ typeArguments: [this.pay_token_type]
635
635
  });
636
636
  }
637
637
  }
@@ -643,14 +643,14 @@ export class Service {
643
643
  txb.moveCall({
644
644
  target: this.protocol.ServiceFn('machine_set_with_passport'),
645
645
  arguments: [passport, Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, machine), Protocol.TXB_OBJECT(txb, this.permission)],
646
- typeArguments: [this.pay_type]
646
+ typeArguments: [this.pay_token_type]
647
647
  });
648
648
  }
649
649
  else {
650
650
  txb.moveCall({
651
651
  target: this.protocol.ServiceFn('machine_none_with_passport'),
652
652
  arguments: [passport, Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, this.permission)],
653
- typeArguments: [this.pay_type]
653
+ typeArguments: [this.pay_token_type]
654
654
  });
655
655
  }
656
656
  }
@@ -659,14 +659,14 @@ export class Service {
659
659
  txb.moveCall({
660
660
  target: this.protocol.ServiceFn('machine_set'),
661
661
  arguments: [Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, machine), Protocol.TXB_OBJECT(txb, this.permission)],
662
- typeArguments: [this.pay_type]
662
+ typeArguments: [this.pay_token_type]
663
663
  });
664
664
  }
665
665
  else {
666
666
  txb.moveCall({
667
667
  target: this.protocol.ServiceFn('machine_none'),
668
668
  arguments: [Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, this.permission)],
669
- typeArguments: [this.pay_type]
669
+ typeArguments: [this.pay_token_type]
670
670
  });
671
671
  }
672
672
  }
@@ -676,19 +676,19 @@ export class Service {
676
676
  ERROR(Errors.IsValidEndpoint);
677
677
  }
678
678
  let txb = this.protocol.CurrentSession();
679
- let ep = endpoint ? txb.pure(BCS_CONVERT.ser_option_string(endpoint)) : OptionNone(txb);
679
+ let ep = endpoint ? txb.pure(Bcs.getInstance().ser_option_string(endpoint)) : OptionNone(txb);
680
680
  if (passport) {
681
681
  txb.moveCall({
682
682
  target: this.protocol.ServiceFn('endpoint_set_with_passport'),
683
683
  arguments: [passport, Protocol.TXB_OBJECT(txb, this.object), ep, Protocol.TXB_OBJECT(txb, this.permission)],
684
- typeArguments: [this.pay_type]
684
+ typeArguments: [this.pay_token_type]
685
685
  });
686
686
  }
687
687
  else {
688
688
  txb.moveCall({
689
689
  target: this.protocol.ServiceFn('endpoint_set'),
690
690
  arguments: [Protocol.TXB_OBJECT(txb, this.object), ep, Protocol.TXB_OBJECT(txb, this.permission)],
691
- typeArguments: [this.pay_type]
691
+ typeArguments: [this.pay_token_type]
692
692
  });
693
693
  }
694
694
  }
@@ -698,14 +698,14 @@ export class Service {
698
698
  txb.moveCall({
699
699
  target: this.protocol.ServiceFn('publish_with_passport'),
700
700
  arguments: [passport, Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, this.permission)],
701
- typeArguments: [this.pay_type]
701
+ typeArguments: [this.pay_token_type]
702
702
  });
703
703
  }
704
704
  else {
705
705
  txb.moveCall({
706
706
  target: this.protocol.ServiceFn('publish'),
707
707
  arguments: [Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, this.permission)],
708
- typeArguments: [this.pay_type]
708
+ typeArguments: [this.pay_token_type]
709
709
  });
710
710
  }
711
711
  }
@@ -715,14 +715,14 @@ export class Service {
715
715
  return txb.moveCall({
716
716
  target: this.protocol.ServiceFn('clone_withpassport'),
717
717
  arguments: [passport, Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, this.permission)],
718
- typeArguments: [this.pay_type]
718
+ typeArguments: [this.pay_token_type]
719
719
  });
720
720
  }
721
721
  else {
722
722
  return txb.moveCall({
723
723
  target: this.protocol.ServiceFn('clone'),
724
724
  arguments: [Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, this.permission)],
725
- typeArguments: [this.pay_type]
725
+ typeArguments: [this.pay_token_type]
726
726
  });
727
727
  }
728
728
  }
@@ -738,18 +738,18 @@ export class Service {
738
738
  txb.moveCall({
739
739
  target: this.protocol.ServiceFn('required_set_with_passport'),
740
740
  arguments: [passport, Protocol.TXB_OBJECT(txb, this.object),
741
- txb.pure(BCS_CONVERT.ser_vector_vector_u8(array_unique(customer_required))),
741
+ txb.pure(Bcs.getInstance().ser_vector_vector_u8(array_unique(customer_required))),
742
742
  txb.pure(pubkey, 'vector<u8>'), Protocol.TXB_OBJECT(txb, this.permission)],
743
- typeArguments: [this.pay_type]
743
+ typeArguments: [this.pay_token_type]
744
744
  });
745
745
  }
746
746
  else {
747
747
  txb.moveCall({
748
748
  target: this.protocol.ServiceFn('required_set'),
749
749
  arguments: [Protocol.TXB_OBJECT(txb, this.object),
750
- txb.pure(BCS_CONVERT.ser_vector_vector_u8(array_unique(customer_required))),
750
+ txb.pure(Bcs.getInstance().ser_vector_vector_u8(array_unique(customer_required))),
751
751
  txb.pure(pubkey, 'vector<u8>'), Protocol.TXB_OBJECT(txb, this.permission)],
752
- typeArguments: [this.pay_type]
752
+ typeArguments: [this.pay_token_type]
753
753
  });
754
754
  }
755
755
  }
@@ -759,14 +759,14 @@ export class Service {
759
759
  txb.moveCall({
760
760
  target: this.protocol.ServiceFn('required_none_with_passport'),
761
761
  arguments: [passport, Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, this.permission)],
762
- typeArguments: [this.pay_type]
762
+ typeArguments: [this.pay_token_type]
763
763
  });
764
764
  }
765
765
  else {
766
766
  txb.moveCall({
767
767
  target: this.protocol.ServiceFn('required_none'),
768
768
  arguments: [Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, this.permission)],
769
- typeArguments: [this.pay_type]
769
+ typeArguments: [this.pay_token_type]
770
770
  });
771
771
  }
772
772
  }
@@ -780,7 +780,7 @@ export class Service {
780
780
  target: this.protocol.ServiceFn('required_pubkey_set_with_passport'),
781
781
  arguments: [passport, Protocol.TXB_OBJECT(txb, this.object), txb.pure(pubkey, 'vector<u8>'),
782
782
  Protocol.TXB_OBJECT(txb, this.permission)],
783
- typeArguments: [this.pay_type]
783
+ typeArguments: [this.pay_token_type]
784
784
  });
785
785
  }
786
786
  else {
@@ -788,7 +788,7 @@ export class Service {
788
788
  target: this.protocol.ServiceFn('required_pubkey_set'),
789
789
  arguments: [Protocol.TXB_OBJECT(txb, this.object), txb.pure(pubkey, 'vector<u8>'),
790
790
  Protocol.TXB_OBJECT(txb, this.permission)],
791
- typeArguments: [this.pay_type]
791
+ typeArguments: [this.pay_token_type]
792
792
  });
793
793
  }
794
794
  }
@@ -805,7 +805,7 @@ export class Service {
805
805
  target: this.protocol.ServiceFn('order_pubkey_update_with_passport'),
806
806
  arguments: [passport, Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, order), txb.pure(pubkey, 'vector<u8>'),
807
807
  Protocol.TXB_OBJECT(txb, this.permission)],
808
- typeArguments: [this.pay_type]
808
+ typeArguments: [this.pay_token_type]
809
809
  });
810
810
  }
811
811
  else {
@@ -813,7 +813,7 @@ export class Service {
813
813
  target: this.protocol.ServiceFn('order_pubkey_update'),
814
814
  arguments: [Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, order), txb.pure(pubkey, 'vector<u8>'),
815
815
  Protocol.TXB_OBJECT(txb, this.permission)],
816
- typeArguments: [this.pay_type]
816
+ typeArguments: [this.pay_token_type]
817
817
  });
818
818
  }
819
819
  }
@@ -823,14 +823,14 @@ export class Service {
823
823
  txb.moveCall({
824
824
  target: this.protocol.ServiceFn('pause_with_passport'),
825
825
  arguments: [passport, Protocol.TXB_OBJECT(txb, this.object), txb.pure(pause, BCS.BOOL), Protocol.TXB_OBJECT(txb, this.permission)],
826
- typeArguments: [this.pay_type]
826
+ typeArguments: [this.pay_token_type]
827
827
  });
828
828
  }
829
829
  else {
830
830
  txb.moveCall({
831
831
  target: this.protocol.ServiceFn('pause'),
832
832
  arguments: [Protocol.TXB_OBJECT(txb, this.object), txb.pure(pause, BCS.BOOL), Protocol.TXB_OBJECT(txb, this.permission)],
833
- typeArguments: [this.pay_type]
833
+ typeArguments: [this.pay_token_type]
834
834
  });
835
835
  }
836
836
  }
@@ -843,14 +843,14 @@ export class Service {
843
843
  txb.moveCall({
844
844
  target: this.protocol.ServiceFn('refund_with_passport'),
845
845
  arguments: [Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, order), passport],
846
- typeArguments: [this.pay_type]
846
+ typeArguments: [this.pay_token_type]
847
847
  });
848
848
  }
849
849
  else {
850
850
  txb.moveCall({
851
851
  target: this.protocol.ServiceFn('refund'),
852
852
  arguments: [Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, order)],
853
- typeArguments: [this.pay_type]
853
+ typeArguments: [this.pay_token_type]
854
854
  });
855
855
  }
856
856
  }
@@ -867,8 +867,8 @@ export class Service {
867
867
  arguments: [Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, order),
868
868
  txb.pure(customer_info_crypto.pubkey, 'vector<u8>'),
869
869
  txb.pure(customer_info_crypto.customer_pubkey, 'vector<u8>'),
870
- txb.pure(BCS_CONVERT.ser_vector_vector_u8(array_unique(customer_info_crypto.customer_info_crypt)))],
871
- typeArguments: [this.pay_type]
870
+ txb.pure(Bcs.getInstance().ser_vector_vector_u8(array_unique(customer_info_crypto.customer_info_crypt)))],
871
+ typeArguments: [this.pay_token_type]
872
872
  });
873
873
  }
874
874
  buy(buy_items, coin, discount, machine, customer_info_crypto, passport) {
@@ -901,44 +901,43 @@ export class Service {
901
901
  if (discount) {
902
902
  order = txb.moveCall({
903
903
  target: this.protocol.ServiceFn('dicount_buy_with_passport'),
904
- arguments: [passport, Protocol.TXB_OBJECT(txb, this.object), txb.pure(BCS_CONVERT.ser_vector_string(name)),
905
- txb.pure(BCS_CONVERT.ser_vector_u64(price)), txb.pure(BCS_CONVERT.ser_vector_u64(stock)),
904
+ arguments: [passport, Protocol.TXB_OBJECT(txb, this.object), txb.pure(Bcs.getInstance().ser_vector_string(name)),
905
+ txb.pure(Bcs.getInstance().ser_vector_u64(price)), txb.pure(Bcs.getInstance().ser_vector_u64(stock)),
906
906
  Protocol.TXB_OBJECT(txb, coin), Protocol.TXB_OBJECT(txb, discount), txb.object(Protocol.CLOCK_OBJECT)],
907
- typeArguments: [this.pay_type]
907
+ typeArguments: [this.pay_token_type]
908
908
  });
909
909
  }
910
910
  else {
911
911
  order = txb.moveCall({
912
912
  target: this.protocol.ServiceFn('buy_with_passport'),
913
- arguments: [passport, Protocol.TXB_OBJECT(txb, this.object), txb.pure(BCS_CONVERT.ser_vector_string(name)),
914
- txb.pure(BCS_CONVERT.ser_vector_u64(price)),
915
- txb.pure(BCS_CONVERT.ser_vector_u64(stock)),
913
+ arguments: [passport, Protocol.TXB_OBJECT(txb, this.object), txb.pure(Bcs.getInstance().ser_vector_string(name)),
914
+ txb.pure(Bcs.getInstance().ser_vector_u64(price)),
915
+ txb.pure(Bcs.getInstance().ser_vector_u64(stock)),
916
916
  Protocol.TXB_OBJECT(txb, coin)],
917
- typeArguments: [this.pay_type]
917
+ typeArguments: [this.pay_token_type]
918
918
  });
919
919
  }
920
920
  }
921
921
  else {
922
922
  if (discount) {
923
- console.log(name);
924
- console.log(price);
925
- console.log(stock);
926
923
  order = txb.moveCall({
927
924
  target: this.protocol.ServiceFn('disoucnt_buy'),
928
- arguments: [Protocol.TXB_OBJECT(txb, this.object),
925
+ arguments: [Protocol.TXB_OBJECT(txb, this.object), txb.pure(Bcs.getInstance().ser_vector_string(name)),
926
+ txb.pure(Bcs.getInstance().ser_vector_u64(price)),
927
+ txb.pure(Bcs.getInstance().ser_vector_u64(stock)),
929
928
  Protocol.TXB_OBJECT(txb, coin),
930
929
  Protocol.TXB_OBJECT(txb, discount), txb.object(Protocol.CLOCK_OBJECT)],
931
- typeArguments: [this.pay_type]
930
+ typeArguments: [this.pay_token_type]
932
931
  });
933
932
  }
934
933
  else {
935
934
  order = txb.moveCall({
936
935
  target: this.protocol.ServiceFn('buy'),
937
- arguments: [Protocol.TXB_OBJECT(txb, this.object), txb.pure(BCS_CONVERT.ser_vector_string(name)),
938
- txb.pure(BCS_CONVERT.ser_vector_u64(price)),
939
- txb.pure(BCS_CONVERT.ser_vector_u64(stock)),
936
+ arguments: [Protocol.TXB_OBJECT(txb, this.object), txb.pure(Bcs.getInstance().ser_vector_string(name)),
937
+ txb.pure(Bcs.getInstance().ser_vector_u64(price)),
938
+ txb.pure(Bcs.getInstance().ser_vector_u64(stock)),
940
939
  Protocol.TXB_OBJECT(txb, coin)],
941
- typeArguments: [this.pay_type]
940
+ typeArguments: [this.pay_token_type]
942
941
  });
943
942
  }
944
943
  }
@@ -949,14 +948,14 @@ export class Service {
949
948
  return txb.moveCall({
950
949
  target: this.protocol.ServiceFn('order_create_with_machine'),
951
950
  arguments: [Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, order), Protocol.TXB_OBJECT(txb, machine)],
952
- typeArguments: [this.pay_type]
951
+ typeArguments: [this.pay_token_type]
953
952
  });
954
953
  }
955
954
  else {
956
955
  return txb.moveCall({
957
956
  target: this.protocol.ServiceFn('order_create'),
958
957
  arguments: [Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, order)],
959
- typeArguments: [this.pay_type]
958
+ typeArguments: [this.pay_token_type]
960
959
  });
961
960
  }
962
961
  }
@@ -968,7 +967,7 @@ export class Service {
968
967
  txb.moveCall({
969
968
  target: this.protocol.ServiceFn('order_create_with_machine'),
970
969
  arguments: [Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, order), Protocol.TXB_OBJECT(txb, machine)],
971
- typeArguments: [this.pay_type]
970
+ typeArguments: [this.pay_token_type]
972
971
  });
973
972
  }
974
973
  change_permission(new_permission) {
@@ -979,7 +978,7 @@ export class Service {
979
978
  txb.moveCall({
980
979
  target: this.protocol.ServiceFn('permission_set'),
981
980
  arguments: [Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, this.permission), Protocol.TXB_OBJECT(txb, new_permission)],
982
- typeArguments: [this.pay_type]
981
+ typeArguments: [this.pay_token_type]
983
982
  });
984
983
  this.permission = new_permission;
985
984
  }