wowok 1.3.3 → 1.3.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wowok",
3
- "version": "1.3.3",
3
+ "version": "1.3.6",
4
4
  "description": "Create, collaborate, and transact on your own terms with the AI-driven web3 collaboration protocol.",
5
5
  "main": "./src/index.ts",
6
6
  "types": "./src/index.ts",
package/src/demand.ts CHANGED
@@ -24,7 +24,7 @@ export class Demand {
24
24
  this.txb = txb;
25
25
  this.object = '';
26
26
  }
27
- static New(txb:TransactionBlock, bounty_type:string, permission:PermissionObject, description:string,
27
+ static New(txb:TransactionBlock, bounty_type:string, ms_expand:boolean, time:number, permission:PermissionObject, description:string,
28
28
  bounty:TransactionResult | string, passport?:PassportObject) : Demand {
29
29
  if (!Protocol.IsValidObjects([permission, bounty])) {
30
30
  ERROR(Errors.IsValidObjects, 'permission, bounty');
@@ -35,18 +35,24 @@ export class Demand {
35
35
  if (!IsValidArgType(bounty_type)) {
36
36
  ERROR(Errors.IsValidArgType, bounty_type);
37
37
  }
38
-
38
+ if (!IsValidUintLarge(time)) {
39
+ ERROR(Errors.IsValidUint, 'time')
40
+ }
41
+
39
42
  let d = new Demand(txb, bounty_type, permission);
43
+ const clock = txb.sharedObjectRef(Protocol.CLOCK_OBJECT);
40
44
  if (passport) {
41
45
  d.object = txb.moveCall({
42
46
  target:Protocol.Instance().DemandFn('new_with_passport') as FnCallType,
43
- arguments:[passport, txb.pure.string(description), txb.object(bounty), Protocol.TXB_OBJECT(txb, permission)],
47
+ arguments:[passport, txb.pure.string(description), txb.object(bounty), txb.pure.bool(ms_expand), txb.pure.u64(time),
48
+ txb.object(clock), Protocol.TXB_OBJECT(txb, permission)],
44
49
  typeArguments:[bounty_type],
45
50
  })
46
51
  } else {
47
52
  d.object = txb.moveCall({
48
53
  target:Protocol.Instance().DemandFn('new') as FnCallType,
49
- arguments:[txb.pure.string(description), txb.object(bounty), Protocol.TXB_OBJECT(txb, permission)],
54
+ arguments:[txb.pure.string(description), txb.object(bounty), txb.pure.bool(ms_expand), txb.pure.u64(time),
55
+ txb.object(clock), Protocol.TXB_OBJECT(txb, permission)],
50
56
  typeArguments:[bounty_type],
51
57
  })
52
58
  }
package/src/exception.ts CHANGED
@@ -9,6 +9,7 @@ export enum Errors {
9
9
  IsValidTokenType = 'invalid token type',
10
10
  IsValidUint = 'invalid uint',
11
11
  IsValidInt = 'invalid int',
12
+ IsValidU64 = 'invalid u64',
12
13
  IsValidPercent = 'invalid percent',
13
14
  IsValidArray = 'invalid array',
14
15
  IsValidObjects = 'invalid objects',
package/src/machine.ts CHANGED
@@ -223,13 +223,13 @@ export class Machine {
223
223
  if (passport) {
224
224
  this.txb.moveCall({
225
225
  target:Protocol.Instance().MachineFn('node_remove_with_passport') as FnCallType,
226
- arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure(Bcs.getInstance().ser(ValueType.TYPE_VEC_STRING, nodes_name)),
226
+ arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.vector('string', nodes_name),
227
227
  this.txb.pure.bool(bTransferMyself), Protocol.TXB_OBJECT(this.txb, this.permission)],
228
228
  });
229
229
  } else {
230
230
  this.txb.moveCall({
231
231
  target:Protocol.Instance().MachineFn('node_remove') as FnCallType,
232
- arguments:[Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure(Bcs.getInstance().ser(ValueType.TYPE_VEC_STRING, nodes_name)),
232
+ arguments:[Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.vector('string', nodes_name),
233
233
  this.txb.pure.bool(bTransferMyself), Protocol.TXB_OBJECT(this.txb, this.permission)],
234
234
  });
235
235
  }
package/src/passport.ts CHANGED
@@ -478,11 +478,15 @@ export class GuardParser {
478
478
 
479
479
  let guard_list = array_unique(guards);
480
480
  const protocol = Protocol.Instance();
481
-
481
+
482
482
  if (onGuardInfo) {
483
483
  protocol.Query_Raw(guard_list)
484
- .then((res) => { onGuardInfo(GuardParser.Parse_Guard_Helper(guards, res)); })
485
- .catch((e) => { onGuardInfo(undefined); })
484
+ .then((res) => {
485
+ onGuardInfo(GuardParser.Parse_Guard_Helper(guards, res));
486
+ }).catch((e) => {
487
+ console.log(e);
488
+ onGuardInfo(undefined);
489
+ })
486
490
  } else {
487
491
  const res = await protocol.Query_Raw(guard_list);
488
492
  return GuardParser.Parse_Guard_Helper(guards, res);
@@ -638,7 +642,6 @@ export class GuardParser {
638
642
  objects.push(this.get_object(g.id, q, fill));
639
643
  })
640
644
  })
641
-
642
645
  if (onPassportQueryReady) {
643
646
  Protocol.Instance().Query_Raw(array_unique(objects), {showType:true}).then((res) => {
644
647
  onPassportQueryReady(this.done_helper(res));
package/src/permission.ts CHANGED
@@ -38,7 +38,7 @@ export enum PermissionIndex {
38
38
  service_remove_sales = 213,
39
39
  service_discount_transfer = 214,
40
40
  service_withdraw = 216,
41
- service_buy_guard = 217,
41
+ service_buyer_guard = 217,
42
42
  service_machine = 218,
43
43
  service_endpoint = 219,
44
44
  service_publish = 220,
@@ -135,7 +135,7 @@ export const PermissionInfo : PermissionInfoType[] = [
135
135
  {index:PermissionIndex.service_remove_sales, name:'Remove sales', description:'Remove sale items for Service', module: 'service'},
136
136
  {index:PermissionIndex.service_discount_transfer, name:'Discount', description:'Launch discounts for Service', module: 'service'},
137
137
  {index:PermissionIndex.service_withdraw, name:'Withdraw', description:'Widthraw from Service orders', module: 'service'},
138
- {index:PermissionIndex.service_buy_guard, name:'Buyer Guard', description:'Set Guard of buying for Service', module: 'service'},
138
+ {index:PermissionIndex.service_buyer_guard, name:'Buyer Guard', description:'Set Guard of buying for Service', module: 'service'},
139
139
  {index:PermissionIndex.service_machine, name:'Machine', description:'Set Machine for Service', module: 'service'},
140
140
  {index:PermissionIndex.service_endpoint, name:'Endpoint', description:'Set Service endpoint', module: 'service'},
141
141
  {index:PermissionIndex.service_publish, name:'Publish', description:'Publish Service', module: 'service'},
@@ -375,7 +375,7 @@ export class Permission {
375
375
  this.txb.moveCall({
376
376
  target:Protocol.Instance().PermissionFn('remove_index') as FnCallType,
377
377
  arguments:[Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.address(entity_address),
378
- this.txb.pure(Bcs.getInstance().ser(ValueType.TYPE_VEC_U64, array_unique(index)))]
378
+ this.txb.pure.vector('u64', array_unique(index))]
379
379
  })
380
380
  }
381
381
  remove_entity(entity_address:string[]) {
@@ -444,6 +444,8 @@ export class Permission {
444
444
  arguments:[Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.address(new_owner)]
445
445
  });
446
446
  }
447
+
448
+ // query some permissions for address
447
449
  query_permissions(address_queried:string, permissions:PermissionIndexType[]) {
448
450
  if (!IsValidAddress(address_queried)) {
449
451
  ERROR(Errors.InvalidParam, 'query_permissions');
@@ -460,46 +462,72 @@ export class Permission {
460
462
  })
461
463
  }
462
464
 
463
- QueryPermissions(permission:string, address_queried:string, permissions:PermissionIndexType[], onPermissionAnswer:OnPermissionAnswer, sender?:string) {
465
+ // query all permissions for address
466
+ query_permissions_all(address_queried:string) {
467
+ if (!IsValidAddress(address_queried)) {
468
+ ERROR(Errors.InvalidParam, 'query_permissions');
469
+ }
470
+
471
+ this.txb.moveCall({
472
+ target:Protocol.Instance().PermissionFn('query_permissions_all') as FnCallType,
473
+ arguments:[Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.address(address_queried)]
474
+ })
475
+ }
476
+
477
+ QueryPermissions(permission:string, address_queried:string, permissions:PermissionIndexType[]|'all', onPermissionAnswer:OnPermissionAnswer, sender?:string) {
464
478
  //@ be the same txb
465
- this.query_permissions(address_queried, permissions);
479
+ if (permissions === 'all') {
480
+ this.query_permissions_all(address_queried);
481
+ } else {
482
+ this.query_permissions(address_queried, permissions);
483
+ }
484
+
466
485
  Protocol.Client().devInspectTransactionBlock({sender:sender ?? address_queried, transactionBlock:this.txb}).then((res) => {
467
486
  if (res.results && res.results[0].returnValues && res.results[0].returnValues.length !== 3 ) {
468
487
  onPermissionAnswer({who:address_queried, object:permission});
469
488
  return
470
489
  }
471
-
472
490
  const perm = Bcs.getInstance().de(BCS.U8, Uint8Array.from((res.results as any)[0].returnValues[0][0]));
473
-
474
491
  if (perm === Permission.PERMISSION_ADMIN || perm === Permission.PERMISSION_OWNER_AND_ADMIN) {
475
492
  onPermissionAnswer({who:address_queried, admin:true, owner:perm%2===1, items:[], object:permission})
476
493
  } else {
477
- const perms = Bcs.getInstance().de('vector<u8>', Uint8Array.from((res.results as any)[0].returnValues[1][0]));
478
- const guards = Bcs.getInstance().de('vector<address>', Uint8Array.from((res.results as any)[0].returnValues[2][0]));
479
- if (perms.length !== permissions.length) {
480
- onPermissionAnswer({who:address_queried, object:permission});
481
- return
482
- }
483
-
484
- const items: PermissionAnswerItem[] = permissions.map((v, index) => {
485
- const p = perms[index] === Permission.PERMISSION_QUERY_NONE ? false : true;
486
- let g : any = undefined;
487
- if (p && perms[index] < guards.length) {
488
- g = '0x' + guards[perms[index] as number];
494
+ if (permissions === 'all') {
495
+ const perms = Bcs.getInstance().de('vector<u64>', Uint8Array.from((res.results as any)[0].returnValues[1][0]));
496
+ const guards = Bcs.getInstance().de_guards(Uint8Array.from((res.results as any)[0].returnValues[2][0]));
497
+ const items: PermissionAnswerItem[] = [];
498
+ for(let i = 0; i < perms.length; ++i) {
499
+ items.push({query:perms[i], permission:true, guard:guards[i] ? ('0x'+guards[i]) : undefined})
500
+ }
501
+ onPermissionAnswer({who:address_queried, admin:false, owner:perm%2===1, items:items, object:permission});
502
+ } else {
503
+ const perms = Bcs.getInstance().de('vector<u8>', Uint8Array.from((res.results as any)[0].returnValues[1][0]));
504
+ const guards = Bcs.getInstance().de('vector<address>', Uint8Array.from((res.results as any)[0].returnValues[2][0]));
505
+ if (perms.length !== permissions.length) {
506
+ onPermissionAnswer({who:address_queried, object:permission});
507
+ return
489
508
  }
490
- return {query:v, permission:p, guard:g}
491
- })
492
- onPermissionAnswer({who:address_queried, admin:false, owner:perm%2===1, items:items, object:permission});
509
+
510
+ const items: PermissionAnswerItem[] = (permissions as PermissionIndexType[]).map((v, index) => {
511
+ const p = perms[index] === Permission.PERMISSION_QUERY_NONE ? false : true;
512
+ let g : any = undefined;
513
+ if (p && perms[index] < guards.length) {
514
+ g = '0x' + guards[perms[index] as number];
515
+ }
516
+ return {query:v, permission:p, guard:g}
517
+ })
518
+ onPermissionAnswer({who:address_queried, admin:false, owner:perm%2===1, items:items, object:permission});
519
+ }
493
520
  }
494
521
  }).catch((e) => {
495
522
  console.log(e);
496
523
  onPermissionAnswer({who:address_queried, object:permission});
497
524
  })
498
525
  }
526
+
499
527
  static HasPermission(answer:PermissionAnswer|undefined, index:PermissionIndexType, bStrict:boolean=false) : {has:boolean, guard?:string, owner?:boolean} | undefined {
500
528
  if (answer) {
501
529
  if (answer.admin) return {has:true, owner:answer.owner}; // admin
502
- let i = answer.items?.find((v)=>v.query === index);
530
+ let i = answer.items?.find((v)=>v.query == index); // index maybe string, so ==
503
531
  if (i) {
504
532
  return {has:i.permission, guard:i.guard, owner:answer.owner};
505
533
  }
package/src/progress.ts CHANGED
@@ -272,7 +272,6 @@ export class Progress {
272
272
  let sub = this.txb.pure.option('address', sub_id ? sub_id : undefined);
273
273
 
274
274
  if (passport) {
275
- console.log(11111)
276
275
  this.txb.moveCall({
277
276
  target:Protocol.Instance().ProgressFn('next_with_passport') as FnCallType,
278
277
  arguments: [passport, Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, this.machine),
package/src/protocol.ts CHANGED
@@ -191,9 +191,9 @@ export enum ENTRYPOINT {
191
191
  }
192
192
 
193
193
  const TESTNET = {
194
- package: "0x8f547c4bd00eedc72307d67c8c1c7b22da88c29ac530cce57bbfe7b6add45a91",
195
- wowok_object: '0x1ccee2dbac69f76db35d92869cc4840fb537020a927dd035cdac811803d9d191',
196
- entity_object: '0xb75b6953254cf9a426fb06b1ceb711784031cf7817b66630ba00daf5660ab04e',
194
+ package: "0xa5a2e79de613b6585a584dd9aee8f464a1a1f2826fefc656f44e95ee3c60d673",
195
+ wowok_object: '0x4723d6660029b1d1a70d6ebb7bfed4b3f06c7e811d6b9845b41d7451555fee02',
196
+ entity_object: '0xb91ae0f0e38f205c7d4f90639fa0bd6fc6448889f8de38547dd6fb29304fc89b',
197
197
  }
198
198
 
199
199
  const MAINNET = {
@@ -206,6 +206,7 @@ export interface CoinTypeInfo {
206
206
  symbol: string;
207
207
  type: string;
208
208
  decimals: number;
209
+ alias ?: boolean;
209
210
  }
210
211
  export class Protocol {
211
212
  protected network = '';
@@ -252,7 +253,7 @@ export class Protocol {
252
253
  break;
253
254
  };
254
255
  }
255
- Package(): string { return this.package }
256
+ Package(): string { return this.package }
256
257
  WowokObject(): string { return this.wowok_object }
257
258
  EntityObject(): string { return this.entity_object }
258
259
  GraphqlUrl() : string { return this.graphql }
@@ -334,9 +335,9 @@ export class Protocol {
334
335
  COINS_TYPE = () => {
335
336
  switch(this.network) {
336
337
  case ENTRYPOINT.testnet:
337
- return this.CoinTypes_Testnet;
338
+ return this.CoinTypes_Testnet.filter((v)=>v.alias !== true);
338
339
  case ENTRYPOINT.mainnet:
339
- return this.CoinTypes_Mainnet;
340
+ return this.CoinTypes_Mainnet.filter((v)=>v.alias !== true);
340
341
  }; return [];
341
342
  }
342
343
  Update_CoinType = (token_type: string, decimals:number, symbol: string) => {
@@ -363,8 +364,14 @@ export class Protocol {
363
364
  }
364
365
 
365
366
  CoinTypes_Testnet:CoinTypeInfo[] = [
366
- {symbol:'SUI', type:'0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI', decimals:9},
367
- {symbol:'SUI', type:'0x2::sui::SUI', decimals:9},
367
+ {symbol:'SUI', type:'0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI', decimals:9, alias:true},
368
+ {symbol:'SUI', type:'0x2::sui::SUI', decimals:9, },
369
+ {symbol:'WOW', type:TESTNET.package + '::wowok::WOWOK', decimals:9},
370
+ ];
371
+
372
+ CoinTypes_Mainnet:CoinTypeInfo[] = [
373
+ {symbol:'SUI', type:'0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI', decimals:9, alias:true},
374
+ {symbol:'SUI', type:'0x2::sui::SUI', decimals:9, },
368
375
  {symbol:'WOW', type:TESTNET.package + '::wowok::WOWOK', decimals:9},
369
376
  {symbol:'USDT', type:'0xc060006111016b8a020ad5b33834984a437aaa7d3c74c18e09a95d48aceab08c::coin::COIN', decimals:6},
370
377
  {symbol:'USDC', type:'0x5d4b302506645c37ff133b98c4b50a5ae14841659738d6d733d59d0d217a93bf::coin::COIN', decimals:6},
@@ -372,10 +379,8 @@ export class Protocol {
372
379
  {symbol:'WBNB', type:'0xb848cce11ef3a8f62eccea6eb5b35a12c4c2b1ee1af7755d02d7bd6218e8226f::coin::COIN', decimals:8},
373
380
  ];
374
381
 
375
- CoinTypes_Mainnet:CoinTypeInfo[] = [
376
- ];
377
-
378
382
  GetCoinTypeInfo = (token_type: string, handler:(info:CoinTypeInfo)=>void) : CoinTypeInfo | 'loading' => {
383
+ if (!token_type) return 'loading';
379
384
  let r = this.COINS_TYPE().find((v) => v?.type === token_type);
380
385
  if (!r) {
381
386
  Protocol.Client().getCoinMetadata({coinType:token_type}).then((res) => {
package/src/repository.ts CHANGED
@@ -254,14 +254,14 @@ export class Repository {
254
254
  this.txb.moveCall({
255
255
  target:Protocol.Instance().RepositoryFn('policy_remove_with_passport') as FnCallType,
256
256
  arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object),
257
- this.txb.pure(Bcs.getInstance().ser(ValueType.TYPE_VEC_STRING, array_unique(policy_keys))),
257
+ this.txb.pure.vector('string', array_unique(policy_keys)),
258
258
  Protocol.TXB_OBJECT(this.txb, this.permission)]
259
259
  })
260
260
  } else {
261
261
  this.txb.moveCall({
262
262
  target:Protocol.Instance().RepositoryFn('policy_remove') as FnCallType,
263
263
  arguments:[Protocol.TXB_OBJECT(this.txb, this.object),
264
- this.txb.pure(Bcs.getInstance().ser(ValueType.TYPE_VEC_STRING, array_unique(policy_keys))),
264
+ this.txb.pure.vector('string', array_unique(policy_keys)),
265
265
  Protocol.TXB_OBJECT(this.txb, this.permission)]
266
266
  })
267
267
  }
package/src/resource.ts CHANGED
@@ -3,15 +3,15 @@ import { IsValidDesription, IsValidAddress, IsValidName, IsValidArray, } from '
3
3
  import { ERROR, Errors } from './exception';
4
4
  import { type TransactionResult, Transaction as TransactionBlock } from '@mysten/sui/transactions';
5
5
 
6
- export interface Tags {
7
- address: string;
8
- nick: string;
9
- tags: string[];
6
+ export interface Tags { // tag am address
7
+ address: string; // address to tag
8
+ nick: string; // named address
9
+ tags: string[]; // tags for address
10
10
  }
11
11
 
12
- export interface ResourceData {
13
- name: string;
14
- address: string[];
12
+ export interface ResourceData { // personal folder
13
+ name: string; // folder name
14
+ address: string[]; // objects in folder
15
15
  }
16
16
 
17
17
  export class Resource {
package/src/service.ts CHANGED
@@ -1,10 +1,11 @@
1
1
  import { IsValidArray, IsValidPercent, IsValidName_AllowEmpty, Bcs, array_unique, IsValidTokenType, IsValidDesription,
2
- IsValidAddress, IsValidEndpoint, IsValidUintLarge, IsValidInt, IsValidName, } from './utils'
2
+ IsValidAddress, IsValidEndpoint, IsValidU64, IsValidName,} from './utils'
3
3
  import { FnCallType, GuardObject, PassportObject, PermissionObject, RepositoryObject, MachineObject, ServiceAddress,
4
4
  ServiceObject, DiscountObject, OrderObject, OrderAddress, CoinObject, Protocol, ValueType,
5
5
  TxbObject} from './protocol';
6
6
  import { ERROR, Errors } from './exception';
7
- import { type TransactionResult, Transaction as TransactionBlock } from '@mysten/sui/transactions';
7
+ import { Transaction as TransactionBlock, } from '@mysten/sui/transactions';
8
+ import { SuiObjectData } from '@mysten/sui/client';
8
9
 
9
10
  export type Service_Guard_Percent = {
10
11
  guard:GuardObject;
@@ -12,8 +13,8 @@ export type Service_Guard_Percent = {
12
13
  }
13
14
  export type Service_Sale = {
14
15
  item:string;
15
- price:number;
16
- stock:number;
16
+ price:bigint;
17
+ stock:bigint;
17
18
  endpoint?:string;
18
19
  }
19
20
  export enum Service_Discount_Type {
@@ -26,7 +27,7 @@ export type Service_Discount = {
26
27
  off: number;
27
28
  duration_minutes: number;
28
29
  time_start?: number; // current time if undefined
29
- price_greater?: number;
30
+ price_greater?: bigint;
30
31
  }
31
32
 
32
33
  export type Service_Buy_RequiredInfo = {
@@ -47,16 +48,17 @@ export enum BuyRequiredEnum {
47
48
 
48
49
  export type Service_Buy = {
49
50
  item: string;
50
- max_price: number;
51
- count: number;
51
+ max_price: bigint;
52
+ count: bigint;
52
53
  }
53
54
 
54
55
  export type DicountDispatch = {
55
56
  receiver: string;
56
- count: number;
57
+ count: bigint;
57
58
  discount: Service_Discount;
58
59
  }
59
60
 
61
+ export type handleDiscountObject = (owner:string, objects:(SuiObjectData|null|undefined)[]) => void;
60
62
  export class Service {
61
63
  protected pay_token_type;
62
64
  protected permission;
@@ -152,9 +154,9 @@ export class Service {
152
154
  })
153
155
  }
154
156
  }
155
- set_price(item:string, price:number, bNotFoundAssert:boolean=true, passport?:PassportObject) {
156
- if (!IsValidInt(price)) {
157
- ERROR(Errors.IsValidInt, 'price')
157
+ set_price(item:string, price:bigint, bNotFoundAssert:boolean=true, passport?:PassportObject) {
158
+ if (!IsValidU64(price)) {
159
+ ERROR(Errors.IsValidU64, 'price')
158
160
  }
159
161
  if (!IsValidName(item)) {
160
162
  ERROR(Errors.IsValidName, 'item')
@@ -178,12 +180,12 @@ export class Service {
178
180
  })
179
181
  }
180
182
  }
181
- set_stock(item:string, stock:number, bNotFoundAssert:boolean=true, passport?:PassportObject) {
183
+ set_stock(item:string, stock:bigint, bNotFoundAssert:boolean=true, passport?:PassportObject) {
182
184
  if (!IsValidName(item)) {
183
185
  ERROR(Errors.IsValidName, 'item')
184
186
  }
185
- if (!IsValidInt(stock)) {
186
- ERROR(Errors.IsValidInt, 'stock')
187
+ if (!IsValidU64(stock)) {
188
+ ERROR(Errors.IsValidU64, 'stock')
187
189
  }
188
190
 
189
191
  if (passport) {
@@ -204,11 +206,11 @@ export class Service {
204
206
  })
205
207
  }
206
208
  }
207
- add_stock(item:string, stock_add:number, bNotFoundAssert:boolean=true, passport?:PassportObject) {
209
+ add_stock(item:string, stock_add:bigint, bNotFoundAssert:boolean=true, passport?:PassportObject) {
208
210
  if (!IsValidName(item)) {
209
211
  ERROR(Errors.IsValidName, 'item')
210
212
  }
211
- if (!IsValidUintLarge(stock_add)) {
213
+ if (!IsValidU64(stock_add)) {
212
214
  ERROR(Errors.IsValidUint, 'stock_add')
213
215
  }
214
216
 
@@ -230,11 +232,11 @@ export class Service {
230
232
  })
231
233
  }
232
234
  }
233
- reduce_stock(item:string, stock_reduce:number, bNotFoundAssert:boolean=true, passport?:PassportObject) {
235
+ reduce_stock(item:string, stock_reduce:bigint, bNotFoundAssert:boolean=true, passport?:PassportObject) {
234
236
  if (!IsValidName(item)) {
235
237
  ERROR(Errors.IsValidName, 'item')
236
238
  }
237
- if (!IsValidUintLarge(stock_reduce)) {
239
+ if (!IsValidU64(stock_reduce)) {
238
240
  ERROR(Errors.IsValidUint, 'stock_reduce')
239
241
  }
240
242
 
@@ -505,8 +507,8 @@ export class Service {
505
507
  let bValid = true; let names:string[] = [];
506
508
  sales.forEach((v) => {
507
509
  if (!IsValidName(v.item)) bValid = false;
508
- if (!IsValidInt(v.price)) bValid = false;
509
- if (!IsValidUintLarge(v.stock)) bValid = false;
510
+ if (!IsValidU64(v.price)) bValid = false;
511
+ if (!IsValidU64(v.stock)) bValid = false;
510
512
  if (names.includes(v.item)) bValid = false;
511
513
  names.push(v.item)
512
514
  })
@@ -520,7 +522,7 @@ export class Service {
520
522
  ERROR(Errors.InvalidParam, 'add_sales')
521
523
  }
522
524
 
523
- let names: string[] = []; let price: number[] = []; let stock: number[] = []; let endpoint: string[] = [];
525
+ let names: string[] = []; let price: bigint[] = []; let stock: bigint[] = []; let endpoint: string[] = [];
524
526
  sales.forEach((s) => {
525
527
  if (s.endpoint && !IsValidEndpoint(s.endpoint)) {
526
528
  ERROR(Errors.IsValidEndpoint, 'add_sales')
@@ -531,24 +533,26 @@ export class Service {
531
533
  if (passport) {
532
534
  this.txb.moveCall({
533
535
  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)),
536
+ arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.vector('string', names),
537
+ this.txb.pure.vector('string', endpoint),
538
+ this.txb.pure.vector('u64', price), this.txb.pure.vector('u64', stock),
539
+ this.txb.pure.bool(bExistAssert),
537
540
  Protocol.TXB_OBJECT(this.txb, this.permission)],
538
541
  typeArguments:[this.pay_token_type]
539
542
  })
540
543
  } else {
541
544
  this.txb.moveCall({
542
545
  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)),
546
+ arguments:[Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.vector('string', names),
547
+ this.txb.pure.vector('string', endpoint),
548
+ this.txb.pure.vector('u64', price), this.txb.pure.vector('u64', stock),
549
+ this.txb.pure.bool(bExistAssert),
547
550
  Protocol.TXB_OBJECT(this.txb, this.permission)],
548
551
  typeArguments:[this.pay_token_type]
549
552
  })
550
553
  }
551
554
  }
555
+
552
556
  remove_sales(sales:string[], passport?:PassportObject) {
553
557
  if (sales.length === 0) return;
554
558
 
@@ -559,14 +563,14 @@ export class Service {
559
563
  if (passport) {
560
564
  this.txb.moveCall({
561
565
  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!))),
566
+ arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.vector('string', array_unique(sales!)),
563
567
  Protocol.TXB_OBJECT(this.txb, this.permission)],
564
568
  typeArguments:[this.pay_token_type]
565
569
  })
566
570
  } else {
567
571
  this.txb.moveCall({
568
572
  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!))),
573
+ arguments:[Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.vector('string', array_unique(sales!)),
570
574
  Protocol.TXB_OBJECT(this.txb, this.permission)],
571
575
  typeArguments:[this.pay_token_type]
572
576
  })
@@ -581,12 +585,12 @@ export class Service {
581
585
  let bValid = true;
582
586
  discount_dispatch.forEach((v) => {
583
587
  if (!IsValidAddress(v.receiver)) bValid = false;
584
- if (!IsValidUintLarge(v.count) || v.count > Service.MAX_DISCOUNT_COUNT_ONCE) bValid = false;
588
+ if (!IsValidU64(v.count) || v.count > Service.MAX_DISCOUNT_COUNT_ONCE) bValid = false;
585
589
  if (!IsValidName_AllowEmpty(v.discount.name)) bValid = false;
586
590
  if (v.discount.type == Service_Discount_Type.ratio && !IsValidPercent(v.discount.off)) bValid = false;
587
- if (!IsValidUintLarge(v.discount.duration_minutes)) bValid = false;
588
- if (v.discount?.time_start && !IsValidUintLarge(v.discount.time_start)) bValid = false;
589
- if (v.discount?.price_greater && !IsValidInt(v.discount.price_greater)) bValid = false;
591
+ if (!IsValidU64(v.discount.duration_minutes)) bValid = false;
592
+ if (v.discount?.time_start && !IsValidU64(v.discount.time_start)) bValid = false;
593
+ if (v.discount?.price_greater && !IsValidU64(v.discount.price_greater)) bValid = false;
590
594
  })
591
595
  if (!bValid) {
592
596
  ERROR(Errors.InvalidParam, 'discount_dispatch')
@@ -741,28 +745,25 @@ export class Service {
741
745
  }
742
746
 
743
747
  }
744
- clone(passport?:PassportObject) : ServiceObject {
748
+ clone(new_token_type?:string, passport?:PassportObject) : ServiceObject {
745
749
  if (passport) {
746
750
  return this.txb.moveCall({
747
751
  target:Protocol.Instance().ServiceFn('clone_withpassport') as FnCallType,
748
752
  arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, this.permission)],
749
- typeArguments:[this.pay_token_type]
753
+ typeArguments:[this.pay_token_type, new_token_type ? new_token_type : this.pay_token_type]
750
754
  })
751
755
  } else {
752
756
  return this.txb.moveCall({
753
757
  target:Protocol.Instance().ServiceFn('clone') as FnCallType,
754
758
  arguments:[Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, this.permission)],
755
- typeArguments:[this.pay_token_type]
759
+ typeArguments:[this.pay_token_type, new_token_type ? new_token_type : this.pay_token_type]
756
760
  })
757
761
  }
758
762
  }
759
763
 
760
764
  set_customer_required(pubkey:string, customer_required: BuyRequiredEnum[], passport?:PassportObject) {
761
- if (!pubkey) {
765
+ if(customer_required.length > 0 && !pubkey) {
762
766
  ERROR(Errors.InvalidParam, 'pubkey')
763
- }
764
- if(!customer_required) {
765
- ERROR(Errors.InvalidParam, 'customer_required')
766
767
  }
767
768
 
768
769
  let req = array_unique(customer_required) as string[];
@@ -771,7 +772,7 @@ export class Service {
771
772
  this.txb.moveCall({
772
773
  target:Protocol.Instance().ServiceFn('required_set_with_passport') as FnCallType,
773
774
  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.vector('string', req),
775
776
  this.txb.pure.string(pubkey), Protocol.TXB_OBJECT(this.txb, this.permission)],
776
777
  typeArguments:[this.pay_token_type]
777
778
  })
@@ -779,7 +780,7 @@ export class Service {
779
780
  this.txb.moveCall({
780
781
  target:Protocol.Instance().ServiceFn('required_set') as FnCallType,
781
782
  arguments:[Protocol.TXB_OBJECT(this.txb, this.object),
782
- this.txb.pure(Bcs.getInstance().ser(ValueType.TYPE_VEC_STRING, req)),
783
+ this.txb.pure.vector('string', req),
783
784
  this.txb.pure.string(pubkey), Protocol.TXB_OBJECT(this.txb, this.permission)],
784
785
  typeArguments:[this.pay_token_type]
785
786
  })
@@ -894,7 +895,7 @@ export class Service {
894
895
  arguments:[Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, order),
895
896
  this.txb.pure.string(customer_info_crypto.pubkey),
896
897
  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)))],
898
+ this.txb.pure.vector('vector<u8>', array_unique(customer_info_crypto.customer_info_crypt))],
898
899
  typeArguments:[this.pay_token_type]
899
900
  })
900
901
 
@@ -909,8 +910,8 @@ export class Service {
909
910
  let bValid = true; let names:string[] = [];
910
911
  buy_items.forEach((v) => {
911
912
  if (!IsValidName(v.item)) bValid = false;
912
- if (!IsValidInt(v.max_price)) bValid = false;
913
- if (!IsValidUintLarge(v.count)) bValid = false;
913
+ if (!IsValidU64(v.max_price)) bValid = false;
914
+ if (!IsValidU64(v.count)) bValid = false;
914
915
  if (names.includes(v.item)) bValid = false;
915
916
  names.push(v.item)
916
917
  })
@@ -918,42 +919,45 @@ export class Service {
918
919
  ERROR(Errors.InvalidParam, 'buy_items 2')
919
920
  }
920
921
 
921
- let name:string[] = []; let price:number[] = []; let stock:number[] = []; let order;
922
+ let name:string[] = []; let price:bigint[] = []; let stock:bigint[] = []; let order;
922
923
  buy_items.forEach((b) => { name.push(b.item); price.push(b.max_price); stock.push(b.count)})
923
924
  const clock = this.txb.sharedObjectRef(Protocol.CLOCK_OBJECT);
924
925
  if (passport) {
925
926
  if (discount) {
927
+ console.log(1)
926
928
  order = this.txb.moveCall({
927
929
  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
+ arguments: [passport, Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.vector('string', name),
931
+ this.txb.pure.vector('u64', price), this.txb.pure.vector('u64', stock),
930
932
  Protocol.TXB_OBJECT(this.txb, coin), Protocol.TXB_OBJECT(this.txb, discount), this.txb.object(clock)],
931
933
  typeArguments:[this.pay_token_type]
932
934
  })} else {
935
+ console.log(2)
933
936
  order = this.txb.moveCall({
934
937
  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
+ arguments: [passport, Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.vector('string', name),
939
+ this.txb.pure.vector('u64', price), this.txb.pure.vector('u64', stock),
938
940
  Protocol.TXB_OBJECT(this.txb, coin)],
939
941
  typeArguments:[this.pay_token_type]
940
942
  })}
941
943
  } else {
944
+ console.log(3)
942
945
  if (discount) {
943
946
  order = this.txb.moveCall({
944
947
  target:Protocol.Instance().ServiceFn('disoucnt_buy') as FnCallType,
945
948
  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)),
949
+ this.txb.pure.vector('u64', price),
950
+ this.txb.pure.vector('u64', stock),
948
951
  Protocol.TXB_OBJECT(this.txb, coin),
949
952
  Protocol.TXB_OBJECT(this.txb, discount), this.txb.object(clock)],
950
953
  typeArguments:[this.pay_token_type]
951
954
  })} else {
955
+ console.log(4)
952
956
  order = this.txb.moveCall({
953
957
  target:Protocol.Instance().ServiceFn('buy') as FnCallType,
954
958
  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)),
959
+ this.txb.pure.vector('u64', price),
960
+ this.txb.pure.vector('u64', stock),
957
961
  Protocol.TXB_OBJECT(this.txb, coin)],
958
962
  typeArguments:[this.pay_token_type]
959
963
  })}
@@ -1025,5 +1029,13 @@ export class Service {
1025
1029
  return service_endpoint + '/sales/' + encodeURI(item_name);
1026
1030
  }
1027
1031
  }
1028
-
1032
+ static DiscountObjects = (owner:string, handleDiscountObject:handleDiscountObject) => {
1033
+ Protocol.Client().getOwnedObjects({owner:owner,
1034
+ filter:{MoveModule:{module:'order', package:Protocol.Instance().Package()}},
1035
+ options:{showContent:true, showType:true}}).then((res) => {
1036
+ handleDiscountObject(owner, res.data.map((v)=>v.data));
1037
+ }).catch((e) => {
1038
+ console.log(e);
1039
+ })
1040
+ }
1029
1041
  }
package/src/utils.ts CHANGED
@@ -173,6 +173,12 @@ export class Bcs {
173
173
  'discord': BCS.STRING,
174
174
  'homepage': BCS.STRING,
175
175
  })
176
+ this.bcs.registerStructType('OptionAddress', {
177
+ 'address': 'Option<address>',
178
+ })
179
+ this.bcs.registerStructType('Guards', {
180
+ 'guards':'vector<OptionAddress>',
181
+ })
176
182
  }
177
183
  static getInstance() : Bcs {
178
184
  if (!Bcs._instance) {
@@ -254,7 +260,6 @@ export class Bcs {
254
260
  case ValueType.TYPE_U64:
255
261
  return this.bcs.de(BCS.U64, data);
256
262
  case ValueType.TYPE_U8:
257
- console.log(data)
258
263
  return this.bcs.de(BCS.U8, data);
259
264
  case ValueType.TYPE_VEC_U8:
260
265
  return this.bcs.de('vector<u8>', data);
@@ -297,7 +302,8 @@ export class Bcs {
297
302
  }
298
303
  }
299
304
 
300
- de_ent(data:Uint8Array) : any {
305
+ de_ent(data:Uint8Array | undefined) : any {
306
+ if (!data || data.length < 2) return ''
301
307
  const struct_vec = this.bcs.de('vector<u8>', data);
302
308
  return this.bcs.de('EntStruct', Uint8Array.from(struct_vec));
303
309
  /* const reader = new BcsReader(data);
@@ -321,6 +327,14 @@ export class Bcs {
321
327
  r.description = new TextDecoder().decode(Uint8Array.from(r.description));
322
328
  return r
323
329
  }
330
+ de_guards(data:Uint8Array | undefined) : any {
331
+ if (!data || data.length < 1) return ''
332
+ let r = this.bcs.de('Guards', data);
333
+ return r?.guards?.map((v:any) => {
334
+ if (v?.address?.none) return undefined;
335
+ return v?.address?.some;
336
+ })
337
+ }
324
338
  }
325
339
 
326
340
  export function stringToUint8Array(str:string) : Uint8Array {
@@ -374,35 +388,40 @@ export const MAX_ENDPOINT_LENGTH = 1024;
374
388
  export const IsValidDesription = (description:string) : boolean => { return description?.length <= MAX_DESCRIPTION_LENGTH }
375
389
  export const IsValidName = (name:string) : boolean => { if(!name) return false; return name.length <= MAX_NAME_LENGTH && name.length != 0 }
376
390
  export const IsValidName_AllowEmpty = (name:string) : boolean => { return name.length <= MAX_NAME_LENGTH }
377
- export const IsValidEndpoint = (endpoint:string) : boolean => { if (!endpoint) return false; return endpoint.length <= MAX_ENDPOINT_LENGTH }
391
+ export const IsValidEndpoint = (endpoint:string) : boolean => {
392
+ return (endpoint.length > 0 && endpoint.length <= MAX_ENDPOINT_LENGTH && isValidHttpUrl(endpoint)) ;
393
+ }
378
394
  export const IsValidAddress = (addr:string | undefined) : boolean => {
379
395
  if (!addr || !isValidSuiAddress(addr)) {
380
396
  return false;
381
397
  }
382
398
  return true
383
399
  }
384
- export const IsValidBigint = (value:string | number | undefined, max:bigint=MAX_U256) : boolean => {
400
+ export const IsValidBigint = (value:string | number | undefined | bigint, max:bigint=MAX_U256, min?:bigint) : boolean => {
385
401
  if (value === '' || value === undefined) return false;
386
402
  try {
387
403
  const v = BigInt(value);
388
404
  if (v <= max) {
405
+ if (min !== undefined) {
406
+ return v >= min;
407
+ }
389
408
  return true
390
409
  }
391
410
  } catch (e) {
392
411
  }; return false
393
412
  }
394
413
 
395
- export const IsValidUintLarge = (value:string | number | undefined) : boolean => {
396
- return IsValidBigint(value)
414
+ export const IsValidUintLarge = (value:string | number | undefined | bigint) : boolean => {
415
+ return IsValidBigint(value, MAX_U64, BigInt(0))
397
416
  }
398
- export const IsValidU8 = (value:string | number | undefined) : boolean => {
399
- return IsValidBigint(value, MAX_U8)
417
+ export const IsValidU8 = (value:string | number | undefined | bigint) : boolean => {
418
+ return IsValidBigint(value, MAX_U8, BigInt(0))
400
419
  }
401
- export const IsValidU64 = (value:string | number | undefined) : boolean => {
402
- return IsValidBigint(value, MAX_U64)
420
+ export const IsValidU64 = (value:string | number | undefined | bigint) : boolean => {
421
+ return IsValidBigint(value, MAX_U64, BigInt(0))
403
422
  }
404
- export const IsValidU128 = (value:string | number | undefined) : boolean => {
405
- return IsValidBigint(value, MAX_U128)
423
+ export const IsValidU128 = (value:string | number | undefined | bigint) : boolean => {
424
+ return IsValidBigint(value, MAX_U128, BigInt(0))
406
425
  }
407
426
 
408
427
  export const IsValidTokenType = (argType: string) : boolean => {
@@ -434,14 +453,12 @@ export const IsValidInt = (value: number | string) : boolean => {
434
453
  }
435
454
  return Number.isSafeInteger(value)
436
455
  }
437
- export const IsValidPercent = (value: number | string) : boolean => {
438
- if (typeof(value) === 'string') {
439
- value = parseInt(value as string);
440
- }
441
- return Number.isSafeInteger(value) && value > 0 && value <= 100
456
+ export const IsValidPercent = (value: number | string | bigint) : boolean => {
457
+ return IsValidBigint(value, BigInt(100), BigInt(0))
442
458
  }
443
- export const IsValidArray = (arr: any[], validFunc:any) : boolean => {
444
- for (let i = 0; i < arr.length; ++i) {
459
+
460
+ export const IsValidArray = (arr: any, validFunc:any) : boolean => {
461
+ for (let i = 0; i < arr.length; i++) {
445
462
  if (!validFunc(arr[i])) {
446
463
  return false
447
464
  }
package/src/vote.ts CHANGED
@@ -229,7 +229,7 @@ export class Vote {
229
229
  this.txb.moveCall({
230
230
  target:Protocol.Instance().VoteFn('agrees_remove_with_passport') as FnCallType,
231
231
  arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object),
232
- this.txb.pure(Bcs.getInstance().ser(ValueType.TYPE_VEC_STRING, array_unique(options))),
232
+ this.txb.pure.vector('string', array_unique(options)),
233
233
  Protocol.TXB_OBJECT(this.txb, this.permission)]
234
234
  })
235
235
  }
@@ -243,7 +243,7 @@ export class Vote {
243
243
  this.txb.moveCall({
244
244
  target:Protocol.Instance().VoteFn('agrees_remove') as FnCallType,
245
245
  arguments:[Protocol.TXB_OBJECT(this.txb, this.object),
246
- this.txb.pure(Bcs.getInstance().ser(ValueType.TYPE_VEC_STRING, array_unique(options))),
246
+ this.txb.pure.vector('string', array_unique(options)),
247
247
  Protocol.TXB_OBJECT(this.txb, this.permission)]
248
248
  })
249
249
  }
@@ -341,13 +341,13 @@ export class Vote {
341
341
  this.txb.moveCall({
342
342
  target:Protocol.Instance().VoteFn('with_passport') as FnCallType,
343
343
  arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object),
344
- this.txb.pure(Bcs.getInstance().ser(ValueType.TYPE_VEC_STRING, array_unique(options)))]
344
+ this.txb.pure.vector('string', array_unique(options))]
345
345
  })
346
346
  } else {
347
347
  this.txb.moveCall({
348
348
  target:Protocol.Instance().VoteFn('this.object') as FnCallType,
349
349
  arguments:[Protocol.TXB_OBJECT(this.txb, this.object),
350
- this.txb.pure(Bcs.getInstance().ser(ValueType.TYPE_VEC_STRING, array_unique(options)))]
350
+ this.txb.pure.vector('string', array_unique(options))]
351
351
  })
352
352
  }
353
353
  }