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/src/repository.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { BCS } from '@mysten/bcs';
2
2
  import { Protocol, FnCallType, ValueType, RepositoryObject, RepositoryAddress, PermissionObject, PassportObject, TxbObject} from './protocol';
3
3
  import { PermissionIndexType, Permission } from './permission'
4
- import { BCS_CONVERT, array_unique, IsValidDesription, IsValidAddress, IsValidArray, OptionNone, } from './utils';
4
+ import { Bcs, array_unique, IsValidDesription, IsValidAddress, IsValidArray, OptionNone, } from './utils';
5
5
  import { ERROR, Errors } from './exception';
6
6
 
7
7
  export enum Repository_Policy_Mode {
@@ -139,6 +139,74 @@ export class Repository {
139
139
  ],
140
140
  })
141
141
  }
142
+ add_reference(references:string[], passport?:PassportObject) {
143
+ if (!references) {
144
+ ERROR(Errors.InvalidParam, 'references')
145
+ }
146
+
147
+ if (!IsValidArray(references, IsValidAddress)) {
148
+ ERROR(Errors.IsValidArray, 'references')
149
+ }
150
+
151
+ let txb = this.protocol.CurrentSession();
152
+ if (passport) {
153
+ txb.moveCall({
154
+ target:this.protocol.RepositoryFn('reference_add_with_passport') as FnCallType,
155
+ arguments:[passport, Protocol.TXB_OBJECT(txb, this.object),
156
+ txb.pure(array_unique(references), 'vector<address>'),
157
+ Protocol.TXB_OBJECT(txb, this.permission)]
158
+ })
159
+ } else {
160
+ txb.moveCall({
161
+ target:this.protocol.RepositoryFn('reference_add') as FnCallType,
162
+ arguments:[Protocol.TXB_OBJECT(txb, this.object),
163
+ txb.pure(array_unique(references), 'vector<address>'),
164
+ Protocol.TXB_OBJECT(txb, this.permission)]
165
+ })
166
+ }
167
+ }
168
+ remove_reference(references:string[], removeall?:boolean, passport?:PassportObject) {
169
+ if (!references) {
170
+ ERROR(Errors.InvalidParam, 'references')
171
+ }
172
+
173
+ if (!IsValidArray(references, IsValidAddress)) {
174
+ ERROR(Errors.IsValidArray, 'references')
175
+ }
176
+
177
+ let txb = this.protocol.CurrentSession();
178
+ if (removeall) {
179
+ if (passport) {
180
+ txb.moveCall({
181
+ target:this.protocol.RepositoryFn('reference_removeall_with_passport') as FnCallType,
182
+ arguments:[passport, Protocol.TXB_OBJECT(txb, this.object),
183
+ Protocol.TXB_OBJECT(txb, this.permission)]
184
+ })
185
+ } else {
186
+ txb.moveCall({
187
+ target:this.protocol.RepositoryFn('reference_removeall') as FnCallType,
188
+ arguments:[Protocol.TXB_OBJECT(txb, this.object),
189
+ Protocol.TXB_OBJECT(txb, this.permission)]
190
+ })
191
+ }
192
+ } else {
193
+ if (passport) {
194
+ txb.moveCall({
195
+ target:this.protocol.RepositoryFn('reference_remove_with_passport') as FnCallType,
196
+ arguments:[passport, Protocol.TXB_OBJECT(txb, this.object),
197
+ txb.pure(array_unique(references), 'vector<address>'),
198
+ Protocol.TXB_OBJECT(txb, this.permission)]
199
+ })
200
+ } else {
201
+ txb.moveCall({
202
+ target:this.protocol.RepositoryFn('reference_remove') as FnCallType,
203
+ arguments:[Protocol.TXB_OBJECT(txb, this.object),
204
+ txb.pure(array_unique(references), 'vector<address>'),
205
+ Protocol.TXB_OBJECT(txb, this.permission)]
206
+ })
207
+ }
208
+ }
209
+ }
142
210
  // add or modify the old
143
211
  add_policies(policies:Repository_Policy[], passport?:PassportObject) {
144
212
  if (!policies) {
@@ -157,7 +225,7 @@ export class Repository {
157
225
 
158
226
  let txb = this.protocol.CurrentSession();
159
227
  policies.forEach((policy) => {
160
- let permission_index = policy?.permission ? txb.pure(BCS_CONVERT.ser_option_u64(policy.permission)) : OptionNone(txb);
228
+ let permission_index = policy?.permission ? txb.pure(Bcs.getInstance().ser_option_u64(policy.permission)) : OptionNone(txb);
161
229
  if (passport) {
162
230
  txb.moveCall({
163
231
  target:this.protocol.RepositoryFn('policy_add_with_passport') as FnCallType,
@@ -199,7 +267,7 @@ export class Repository {
199
267
  txb.moveCall({
200
268
  target:this.protocol.RepositoryFn('policy_remove_with_passport') as FnCallType,
201
269
  arguments:[passport, Protocol.TXB_OBJECT(txb, this.object),
202
- txb.pure(BCS_CONVERT.ser_vector_string(array_unique(policy_keys))),
270
+ txb.pure(Bcs.getInstance().ser_vector_string(array_unique(policy_keys))),
203
271
  Protocol.TXB_OBJECT(txb, this.permission)]
204
272
  })
205
273
  }
@@ -213,7 +281,7 @@ export class Repository {
213
281
  txb.moveCall({
214
282
  target:this.protocol.RepositoryFn('policy_remove') as FnCallType,
215
283
  arguments:[Protocol.TXB_OBJECT(txb, this.object),
216
- txb.pure(BCS_CONVERT.ser_vector_string(array_unique(policy_keys))),
284
+ txb.pure(Bcs.getInstance().ser_vector_string(array_unique(policy_keys))),
217
285
  Protocol.TXB_OBJECT(txb, this.permission)]
218
286
  })
219
287
  }
@@ -293,7 +361,7 @@ export class Repository {
293
361
  if(!Permission.IsValidPermissionIndex(permission_index)) {
294
362
  ERROR(Errors.IsValidPermissionIndex)
295
363
  }
296
- index = txb.pure(BCS_CONVERT.ser_option_u64(permission_index));
364
+ index = txb.pure(Bcs.getInstance().ser_option_u64(permission_index));
297
365
  }
298
366
 
299
367
  if (passport) {
package/src/service.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { bcs, BCS, toHEX, fromHEX, getSuiMoveConfig } from '@mysten/bcs';
2
- import { IsValidArray, IsValidPercent, IsValidName_AllowEmpty, BCS_CONVERT, array_unique, IsValidArgType, IsValidDesription,
2
+ import { IsValidArray, IsValidPercent, IsValidName_AllowEmpty, Bcs, array_unique, IsValidArgType, IsValidDesription,
3
3
  IsValidAddress, IsValidEndpoint, OptionNone, IsValidUint, IsValidInt, IsValidName, } from './utils'
4
4
  import { FnCallType, GuardObject, PassportObject, PermissionObject, RepositoryObject, MachineObject, ServiceAddress,
5
5
  ServiceObject, DiscountObject, OrderObject, OrderAddress, CoinObject, Protocol,
@@ -95,7 +95,7 @@ export class Service {
95
95
  }
96
96
 
97
97
  let txb = protocol.CurrentSession();
98
- let ep = endpoint? txb.pure(BCS_CONVERT.ser_option_string(endpoint)) : OptionNone(txb);
98
+ let ep = endpoint? txb.pure(Bcs.getInstance().ser_option_string(endpoint)) : OptionNone(txb);
99
99
 
100
100
  if (passport) {
101
101
  s.object = txb.moveCall({
@@ -499,16 +499,16 @@ export class Service {
499
499
  if (passport) {
500
500
  txb.moveCall({
501
501
  target:this.protocol.ServiceFn('sales_add_with_passport') as FnCallType,
502
- arguments:[passport, Protocol.TXB_OBJECT(txb, this.object), txb.pure(BCS_CONVERT.ser_vector_string(names)),
503
- txb.pure(BCS_CONVERT.ser_vector_u64(price)), txb.pure(BCS_CONVERT.ser_vector_u64(stock)),
502
+ arguments:[passport, Protocol.TXB_OBJECT(txb, this.object), txb.pure(Bcs.getInstance().ser_vector_string(names)),
503
+ txb.pure(Bcs.getInstance().ser_vector_u64(price)), txb.pure(Bcs.getInstance().ser_vector_u64(stock)),
504
504
  Protocol.TXB_OBJECT(txb, this.permission)],
505
505
  typeArguments:[this.pay_token_type]
506
506
  })
507
507
  } else {
508
508
  txb.moveCall({
509
509
  target:this.protocol.ServiceFn('sales_add') as FnCallType,
510
- arguments:[Protocol.TXB_OBJECT(txb, this.object), txb.pure(BCS_CONVERT.ser_vector_string(names)),
511
- txb.pure(BCS_CONVERT.ser_vector_u64(price)), txb.pure(BCS_CONVERT.ser_vector_u64(stock)),
510
+ arguments:[Protocol.TXB_OBJECT(txb, this.object), txb.pure(Bcs.getInstance().ser_vector_string(names)),
511
+ txb.pure(Bcs.getInstance().ser_vector_u64(price)), txb.pure(Bcs.getInstance().ser_vector_u64(stock)),
512
512
  Protocol.TXB_OBJECT(txb, this.permission)],
513
513
  typeArguments:[this.pay_token_type]
514
514
  })
@@ -534,7 +534,7 @@ export class Service {
534
534
  } else {
535
535
  txb.moveCall({
536
536
  target:this.protocol.ServiceFn('sales_remove_with_passport') as FnCallType,
537
- arguments:[passport, Protocol.TXB_OBJECT(txb, this.object), txb.pure(BCS_CONVERT.ser_vector_string(array_unique(sales!))),
537
+ arguments:[passport, Protocol.TXB_OBJECT(txb, this.object), txb.pure(Bcs.getInstance().ser_vector_string(array_unique(sales!))),
538
538
  Protocol.TXB_OBJECT(txb, this.permission)],
539
539
  typeArguments:[this.pay_token_type]
540
540
  })
@@ -549,7 +549,7 @@ export class Service {
549
549
  } else {
550
550
  txb.moveCall({
551
551
  target:this.protocol.ServiceFn('sales_remove') as FnCallType,
552
- arguments:[Protocol.TXB_OBJECT(txb, this.object), txb.pure(BCS_CONVERT.ser_vector_string(array_unique(sales!))),
552
+ arguments:[Protocol.TXB_OBJECT(txb, this.object), txb.pure(Bcs.getInstance().ser_vector_string(array_unique(sales!))),
553
553
  Protocol.TXB_OBJECT(txb, this.permission)],
554
554
  typeArguments:[this.pay_token_type]
555
555
  })
@@ -579,9 +579,9 @@ export class Service {
579
579
  let txb = this.protocol.CurrentSession();
580
580
  discount_dispatch.forEach((discount) => {
581
581
  let price_greater = discount.discount?.price_greater ?
582
- txb.pure(BCS_CONVERT.ser_option_u64(discount.discount.price_greater)) : OptionNone(txb);
582
+ txb.pure(Bcs.getInstance().ser_option_u64(discount.discount.price_greater)) : OptionNone(txb);
583
583
  let time_start = discount.discount?.time_start ?
584
- txb.pure(BCS_CONVERT.ser_option_u64(discount.discount.time_start)) : OptionNone(txb);
584
+ txb.pure(Bcs.getInstance().ser_option_u64(discount.discount.time_start)) : OptionNone(txb);
585
585
 
586
586
  if (passport) {
587
587
  txb.moveCall({
@@ -700,7 +700,7 @@ export class Service {
700
700
  }
701
701
 
702
702
  let txb = this.protocol.CurrentSession();
703
- let ep = endpoint? txb.pure(BCS_CONVERT.ser_option_string(endpoint)) : OptionNone(txb);
703
+ let ep = endpoint? txb.pure(Bcs.getInstance().ser_option_string(endpoint)) : OptionNone(txb);
704
704
 
705
705
  if (passport) {
706
706
  txb.moveCall({
@@ -763,7 +763,7 @@ export class Service {
763
763
  txb.moveCall({
764
764
  target:this.protocol.ServiceFn('required_set_with_passport') as FnCallType,
765
765
  arguments:[passport, Protocol.TXB_OBJECT(txb, this.object),
766
- txb.pure(BCS_CONVERT.ser_vector_vector_u8(array_unique(customer_required))),
766
+ txb.pure(Bcs.getInstance().ser_vector_vector_u8(array_unique(customer_required))),
767
767
  txb.pure(pubkey, 'vector<u8>'), Protocol.TXB_OBJECT(txb, this.permission)],
768
768
  typeArguments:[this.pay_token_type]
769
769
  })
@@ -771,7 +771,7 @@ export class Service {
771
771
  txb.moveCall({
772
772
  target:this.protocol.ServiceFn('required_set') as FnCallType,
773
773
  arguments:[Protocol.TXB_OBJECT(txb, this.object),
774
- txb.pure(BCS_CONVERT.ser_vector_vector_u8(array_unique(customer_required))),
774
+ txb.pure(Bcs.getInstance().ser_vector_vector_u8(array_unique(customer_required))),
775
775
  txb.pure(pubkey, 'vector<u8>'), Protocol.TXB_OBJECT(txb, this.permission)],
776
776
  typeArguments:[this.pay_token_type]
777
777
  })
@@ -892,7 +892,7 @@ export class Service {
892
892
  arguments:[Protocol.TXB_OBJECT(txb, this.object), Protocol.TXB_OBJECT(txb, order),
893
893
  txb.pure(customer_info_crypto.pubkey, 'vector<u8>'),
894
894
  txb.pure(customer_info_crypto.customer_pubkey, 'vector<u8>'),
895
- txb.pure(BCS_CONVERT.ser_vector_vector_u8(array_unique(customer_info_crypto.customer_info_crypt)))],
895
+ txb.pure(Bcs.getInstance().ser_vector_vector_u8(array_unique(customer_info_crypto.customer_info_crypt)))],
896
896
  typeArguments:[this.pay_token_type]
897
897
  })
898
898
 
@@ -924,16 +924,16 @@ export class Service {
924
924
  if (discount) {
925
925
  order = txb.moveCall({
926
926
  target:this.protocol.ServiceFn('dicount_buy_with_passport') as FnCallType,
927
- arguments: [passport, Protocol.TXB_OBJECT(txb, this.object), txb.pure(BCS_CONVERT.ser_vector_string(name)),
928
- txb.pure(BCS_CONVERT.ser_vector_u64(price)), txb.pure(BCS_CONVERT.ser_vector_u64(stock)),
927
+ arguments: [passport, Protocol.TXB_OBJECT(txb, this.object), txb.pure(Bcs.getInstance().ser_vector_string(name)),
928
+ txb.pure(Bcs.getInstance().ser_vector_u64(price)), txb.pure(Bcs.getInstance().ser_vector_u64(stock)),
929
929
  Protocol.TXB_OBJECT(txb, coin), Protocol.TXB_OBJECT(txb, discount), txb.object(Protocol.CLOCK_OBJECT)],
930
930
  typeArguments:[this.pay_token_type]
931
931
  })} else {
932
932
  order = txb.moveCall({
933
933
  target:this.protocol.ServiceFn('buy_with_passport') as FnCallType,
934
- arguments: [passport, Protocol.TXB_OBJECT(txb, this.object), txb.pure(BCS_CONVERT.ser_vector_string(name)),
935
- txb.pure(BCS_CONVERT.ser_vector_u64(price)),
936
- txb.pure(BCS_CONVERT.ser_vector_u64(stock)),
934
+ arguments: [passport, Protocol.TXB_OBJECT(txb, this.object), txb.pure(Bcs.getInstance().ser_vector_string(name)),
935
+ txb.pure(Bcs.getInstance().ser_vector_u64(price)),
936
+ txb.pure(Bcs.getInstance().ser_vector_u64(stock)),
937
937
  Protocol.TXB_OBJECT(txb, coin)],
938
938
  typeArguments:[this.pay_token_type]
939
939
  })}
@@ -941,18 +941,18 @@ export class Service {
941
941
  if (discount) {
942
942
  order = txb.moveCall({
943
943
  target:this.protocol.ServiceFn('disoucnt_buy') as FnCallType,
944
- arguments: [Protocol.TXB_OBJECT(txb, this.object), txb.pure(BCS_CONVERT.ser_vector_string(name)),
945
- txb.pure(BCS_CONVERT.ser_vector_u64(price)),
946
- txb.pure(BCS_CONVERT.ser_vector_u64(stock)),
944
+ arguments: [Protocol.TXB_OBJECT(txb, this.object), txb.pure(Bcs.getInstance().ser_vector_string(name)),
945
+ txb.pure(Bcs.getInstance().ser_vector_u64(price)),
946
+ txb.pure(Bcs.getInstance().ser_vector_u64(stock)),
947
947
  Protocol.TXB_OBJECT(txb, coin),
948
948
  Protocol.TXB_OBJECT(txb, discount), txb.object(Protocol.CLOCK_OBJECT)],
949
949
  typeArguments:[this.pay_token_type]
950
950
  })} else {
951
951
  order = txb.moveCall({
952
952
  target:this.protocol.ServiceFn('buy') as FnCallType,
953
- arguments: [Protocol.TXB_OBJECT(txb, this.object), txb.pure(BCS_CONVERT.ser_vector_string(name)),
954
- txb.pure(BCS_CONVERT.ser_vector_u64(price)),
955
- txb.pure(BCS_CONVERT.ser_vector_u64(stock)),
953
+ arguments: [Protocol.TXB_OBJECT(txb, this.object), txb.pure(Bcs.getInstance().ser_vector_string(name)),
954
+ txb.pure(Bcs.getInstance().ser_vector_u64(price)),
955
+ txb.pure(Bcs.getInstance().ser_vector_u64(stock)),
956
956
  Protocol.TXB_OBJECT(txb, coin)],
957
957
  typeArguments:[this.pay_token_type]
958
958
  })}
package/src/utils.ts CHANGED
@@ -72,12 +72,19 @@ export function parse_object_type(object_data:string) : string[] {
72
72
 
73
73
  export class Bcs {
74
74
  bcs = new BCS(getSuiMoveConfig());
75
- constructor() {
75
+ private static _instance : any;
76
+ private constructor() {
76
77
  this.bcs.registerEnumType('Option<T>', {
77
78
  'none': null,
78
79
  'some': 'T',
79
80
  });
80
81
  }
82
+ static getInstance() : Bcs {
83
+ if (!Bcs._instance) {
84
+ Bcs._instance = new Bcs();
85
+ };
86
+ return Bcs._instance;
87
+ }
81
88
  ser_option_string(data:string) : Uint8Array {
82
89
  return this.bcs.ser('Option<string>', {'some': data}).toBytes();
83
90
  }
@@ -119,9 +126,6 @@ export class Bcs {
119
126
  }
120
127
  }
121
128
 
122
- export const BCS_CONVERT = new Bcs();
123
-
124
-
125
129
  export function stringToUint8Array(str:string) : Uint8Array {
126
130
  var arr = [];
127
131
  for (var i = 0, j = str.length; i < j; ++i) {
@@ -193,3 +197,39 @@ export const IsValidArray = (arr: any[], validFunc:any) : boolean => {
193
197
 
194
198
  export const OptionNone = (txb:TransactionBlock) : TransactionArgument => { return txb.pure([], BCS.U8) };
195
199
 
200
+ export type ArgType = {
201
+ isCoin: boolean;
202
+ coin: string;
203
+ token: string;
204
+ }
205
+ export const ParseType = (type:string) : ArgType => {
206
+ let i = type.indexOf('<');
207
+ if (i > 0 && type.length > 12) {
208
+ let c = type.slice(0, i);
209
+ if (c === '0x2::coin::Coin' || c === '0x0000000000000000000000000000000000000000000000000000000000000002::coin::Coin') {
210
+ let coin = type.slice(i+1, type.length-1); // < >>
211
+ let t = coin.lastIndexOf('::');
212
+ return {isCoin:true, coin:coin, token:coin.slice(t+2)}
213
+ }
214
+ }
215
+ return {isCoin:false, coin:'', token:''}
216
+ }
217
+
218
+ export function toFixed(x:number) {
219
+ let res = '';
220
+ if (Math.abs(x) < 1.0) {
221
+ var e = parseInt(x.toString().split('e-')[1]);
222
+ if (e) {
223
+ x *= Math.pow(10,e-1);
224
+ res = '0.' + (new Array(e)).join('0') + x.toString().substring(2);
225
+ }
226
+ } else {
227
+ var e = parseInt(x.toString().split('+')[1]);
228
+ if (e > 20) {
229
+ e -= 20;
230
+ x /= Math.pow(10,e);
231
+ res = x + (new Array(e+1)).join('0');
232
+ }
233
+ }
234
+ return res;
235
+ }
package/src/vote.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { BCS } from '@mysten/bcs';
2
2
  import { FnCallType, PassportObject, PermissionObject, GuardObject, VoteAddress, Protocol, TxbObject} from './protocol';
3
- import { IsValidDesription, IsValidUint, IsValidAddress, OptionNone, BCS_CONVERT, array_unique, IsValidArray, IsValidName } from './utils';
3
+ import { IsValidDesription, IsValidUint, IsValidAddress, OptionNone, Bcs, array_unique, IsValidArray, IsValidName } from './utils';
4
4
  import { ERROR, Errors } from './exception';
5
5
 
6
6
  export const MAX_AGREES_COUNT = 200;
@@ -50,7 +50,7 @@ export class Vote {
50
50
  }
51
51
 
52
52
  let txb = protocol.CurrentSession();
53
- let reference = reference_address? txb.pure(BCS_CONVERT.ser_option_address(reference_address)) : OptionNone(txb);
53
+ let reference = reference_address? txb.pure(Bcs.getInstance().ser_option_address(reference_address)) : OptionNone(txb);
54
54
  let choice_count = max_choice_count ? max_choice_count : 1;
55
55
 
56
56
  if (passport) {
@@ -111,7 +111,7 @@ export class Vote {
111
111
  }
112
112
 
113
113
  let txb = this.protocol.CurrentSession();
114
- let reference = reference_address? txb.pure(BCS_CONVERT.ser_option_address(reference_address)) : OptionNone(txb);
114
+ let reference = reference_address? txb.pure(Bcs.getInstance().ser_option_address(reference_address)) : OptionNone(txb);
115
115
  if (passport) {
116
116
  txb.moveCall({
117
117
  target:this.protocol.VoteFn('reference_set_with_passport') as FnCallType,
@@ -206,7 +206,7 @@ export class Vote {
206
206
  let txb = this.protocol.CurrentSession();
207
207
  options.forEach((option) => {
208
208
  let reference = option?.reference_address ?
209
- txb.pure(BCS_CONVERT.ser_option_address(option.reference_address)) :
209
+ txb.pure(Bcs.getInstance().ser_option_address(option.reference_address)) :
210
210
  OptionNone(txb);
211
211
 
212
212
  if (passport) {
@@ -243,7 +243,7 @@ export class Vote {
243
243
  txb.moveCall({
244
244
  target:this.protocol.VoteFn('agrees_remove_with_passport') as FnCallType,
245
245
  arguments:[passport, Protocol.TXB_OBJECT(txb, this.object),
246
- txb.pure(BCS_CONVERT.ser_vector_string(array_unique(options))),
246
+ txb.pure(Bcs.getInstance().ser_vector_string(array_unique(options))),
247
247
  Protocol.TXB_OBJECT(txb, this.permission)]
248
248
  })
249
249
  }
@@ -257,7 +257,7 @@ export class Vote {
257
257
  txb.moveCall({
258
258
  target:this.protocol.VoteFn('agrees_remove') as FnCallType,
259
259
  arguments:[Protocol.TXB_OBJECT(txb, this.object),
260
- txb.pure(BCS_CONVERT.ser_vector_string(array_unique(options))),
260
+ txb.pure(Bcs.getInstance().ser_vector_string(array_unique(options))),
261
261
  Protocol.TXB_OBJECT(txb, this.permission)]
262
262
  })
263
263
  }
@@ -359,13 +359,13 @@ export class Vote {
359
359
  txb.moveCall({
360
360
  target:this.protocol.VoteFn('with_passport') as FnCallType,
361
361
  arguments:[passport, Protocol.TXB_OBJECT(txb, this.object),
362
- txb.pure(BCS_CONVERT.ser_vector_string(array_unique(options)))]
362
+ txb.pure(Bcs.getInstance().ser_vector_string(array_unique(options)))]
363
363
  })
364
364
  } else {
365
365
  txb.moveCall({
366
366
  target:this.protocol.VoteFn('this.object') as FnCallType,
367
367
  arguments:[Protocol.TXB_OBJECT(txb, this.object),
368
- txb.pure(BCS_CONVERT.ser_vector_string(array_unique(options)))]
368
+ txb.pure(Bcs.getInstance().ser_vector_string(array_unique(options)))]
369
369
  })
370
370
  }
371
371
 
package/tsconfig.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "compilerOptions": {
3
3
  /* Visit https://aka.ms/tsconfig to read more about this file */
4
- // "outDir": "out", // 输出的文件夹
4
+ // "outDir": "out",
5
5
  // "sourceMap": true,
6
6
  /* Projects */
7
7
  // "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */
@@ -14,7 +14,8 @@
14
14
  /* Language and Environment */
15
15
  "target": "ESNext", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
16
16
  "lib": ["es2020", "DOM"], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
17
- // "jsx": "preserve", /* Specify what JSX code is generated. */
17
+ "downlevelIteration": true,
18
+ // "jsx": "preserve", /* Specify what JSX code is generated. */
18
19
  // "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */
19
20
  // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
20
21
  // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */