wowok 1.5.43 → 1.5.45

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.5.43",
3
+ "version": "1.5.45",
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",
@@ -1,7 +1,8 @@
1
1
  import { IsValidArray, array_unique, IsValidTokenType, IsValidDesription, parseObjectType,
2
2
  IsValidAddress, IsValidEndpoint, IsValidU64, IsValidName, } from './utils'
3
3
  import { FnCallType, GuardObject, PassportObject, PermissionObject, CoinObject, Protocol,
4
- TxbObject, ArbitrationAddress, OrderObject, ArbObject, PaymentAddress, TreasuryObject} from './protocol';
4
+ TxbObject, ArbitrationAddress, OrderObject, ArbObject, PaymentAddress, TreasuryObject,
5
+ ArbAddress} from './protocol';
5
6
  import { ERROR, Errors } from './exception';
6
7
  import { Transaction as TransactionBlock, } from '@mysten/sui/transactions';
7
8
 
@@ -438,7 +439,7 @@ export class Arbitration {
438
439
  }
439
440
  }
440
441
 
441
- dispute(param:Dispute, passport?:PassportObject) {
442
+ dispute(param:Dispute, passport?:PassportObject) : ArbAddress {
442
443
  if (!Protocol.IsValidObjects([param.order])) {
443
444
  ERROR(Errors.IsValidObjects, 'dispute.param.order')
444
445
  }
@@ -454,14 +455,14 @@ export class Arbitration {
454
455
 
455
456
  if (passport) {
456
457
  if (param.fee) {
457
- this.txb.moveCall({
458
+ return this.txb.moveCall({
458
459
  target:Protocol.Instance().ArbitrationFn('dispute_with_passport') as FnCallType,
459
460
  arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object), this.txb.object(param.order), this.txb.pure.string(param.description),
460
461
  this.txb.pure.vector('string', array_unique(param.votable_proposition)), this.txb.object(param.fee)],
461
462
  typeArguments:[this.pay_token_type, param.order_token_type]
462
463
  })
463
464
  } else {
464
- this.txb.moveCall({
465
+ return this.txb.moveCall({
465
466
  target:Protocol.Instance().ArbitrationFn('free_dispute_with_passport') as FnCallType,
466
467
  arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object), this.txb.object(param.order), this.txb.pure.string(param.description),
467
468
  this.txb.pure.vector('string', array_unique(param.votable_proposition))],
@@ -470,14 +471,14 @@ export class Arbitration {
470
471
  }
471
472
  } else {
472
473
  if (param.fee) {
473
- this.txb.moveCall({
474
+ return this.txb.moveCall({
474
475
  target:Protocol.Instance().ArbitrationFn('dispute') as FnCallType,
475
476
  arguments:[Protocol.TXB_OBJECT(this.txb, this.object), this.txb.object(param.order), this.txb.pure.string(param.description),
476
477
  this.txb.pure.vector('string', array_unique(param.votable_proposition)), this.txb.object(param.fee)],
477
478
  typeArguments:[this.pay_token_type, param.order_token_type]
478
479
  })
479
480
  } else {
480
- this.txb.moveCall({
481
+ return this.txb.moveCall({
481
482
  target:Protocol.Instance().ArbitrationFn('free_dispute') as FnCallType,
482
483
  arguments:[Protocol.TXB_OBJECT(this.txb, this.object), this.txb.object(param.order), this.txb.pure.string(param.description),
483
484
  this.txb.pure.vector('string', array_unique(param.votable_proposition))],
package/src/guard.ts CHANGED
@@ -727,10 +727,12 @@ export class GuardMaker {
727
727
  type === OperatorType.TYPE_LOGIC_EQUAL ||
728
728
  type === OperatorType.TYPE_LOGIC_HAS_SUBSTRING ||
729
729
  type === OperatorType.TYPE_LOGIC_AND ||
730
- type === OperatorType.TYPE_LOGIC_OR)
730
+ type === OperatorType.TYPE_LOGIC_OR ||
731
+ type === OperatorType.TYPE_NUMBER_ADD ||
732
+ type === OperatorType.TYPE_NUMBER_DEVIDE ||
733
+ type === OperatorType.TYPE_NUMBER_MULTIPLY ||
734
+ type === OperatorType.TYPE_NUMBER_SUBTRACT ||
735
+ type === OperatorType.TYPE_NUMBER_MOD)
731
736
  }
732
737
  }
733
738
 
734
-
735
-
736
-
package/src/passport.ts CHANGED
@@ -67,7 +67,6 @@ export class GuardParser {
67
67
  // console.log(constants)
68
68
 
69
69
  let inputs : DeGuardInput[] = GuardParser.parse_bcs(constants, guard_input_bytes);
70
-
71
70
  // console.log(data);
72
71
  if (!inputs || inputs.length == 0) ERROR(Errors.Fail, 'GuardObject: data parsed error');
73
72
  let stack: DeGuardData[] = [];
@@ -149,6 +148,7 @@ export class GuardParser {
149
148
  current.ret_type = ValueType.TYPE_BOOL;
150
149
  if (stack.length < current.value || current.value < 2) ERROR(Errors.Fail, 'ResolveData: ' + current.type);
151
150
  var p0 = stack.pop() as DeGuardData;
151
+ current.child.push(p0);
152
152
  for (let i = 1; i < current.value; ++i) {
153
153
  var p = stack.pop() as DeGuardData;
154
154
  if (!p.ret_type || (p.ret_type != p0.ret_type)) ERROR(Errors.Fail, 'ResolveData: ' + current.type + ' INVALID param type');
@@ -184,7 +184,7 @@ export class GuardParser {
184
184
  current.ret_type = r[4];
185
185
 
186
186
  if (stack.length < r[3].length) ERROR(Errors.Fail, 'OperateParamCount: cmd param lost ' + current.type);
187
- r[3].forEach((e:number) => {
187
+ r[3].forEach((e:number) => {
188
188
  let d = stack.pop() as DeGuardData;
189
189
  if (!d?.ret_type || d.ret_type != e) {
190
190
  ERROR(Errors.Fail, 'OperateParamCount: cmd param not match ' + current.type);
package/src/service.ts CHANGED
@@ -360,22 +360,24 @@ export class Service {
360
360
  }
361
361
  }
362
362
  }
363
- add_arbitration(arbitraion:ArbitrationObject, passport?:PassportObject) {
363
+ add_arbitration(arbitraion:ArbitrationObject, arbitraion_token_type:string, passport?:PassportObject) {
364
364
  if (!Protocol.IsValidObjects([arbitraion])) {
365
- ERROR(Errors.IsValidObjects, 'arbitration_add');
365
+ ERROR(Errors.IsValidObjects, 'add_arbitration.arbitraion');
366
+ }
367
+ if (!IsValidTokenType(arbitraion_token_type)) {
368
+ ERROR(Errors.IsValidTokenType, 'add_arbitration.arbitraion_token_type')
366
369
  }
367
-
368
370
  if (passport) {
369
371
  this.txb.moveCall({
370
372
  target:Protocol.Instance().ServiceFn('arbitration_add_with_passport') as FnCallType,
371
- arguments:[Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, arbitraion), Protocol.TXB_OBJECT(this.txb, this.permission)],
372
- typeArguments:[this.pay_token_type]
373
+ arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, arbitraion), Protocol.TXB_OBJECT(this.txb, this.permission)],
374
+ typeArguments:[this.pay_token_type, arbitraion_token_type]
373
375
  })
374
376
  } else {
375
377
  this.txb.moveCall({
376
- target:Protocol.Instance().ServiceFn('repository_add') as FnCallType,
378
+ target:Protocol.Instance().ServiceFn('arbitration_add') as FnCallType,
377
379
  arguments:[Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, arbitraion), Protocol.TXB_OBJECT(this.txb, this.permission)],
378
- typeArguments:[this.pay_token_type]
380
+ typeArguments:[this.pay_token_type, arbitraion_token_type]
379
381
  })
380
382
  }
381
383
  }
@@ -383,7 +385,7 @@ export class Service {
383
385
  if (!removeall && address.length===0) return;
384
386
 
385
387
  if (!IsValidArray(address, IsValidAddress)) {
386
- ERROR(Errors.IsValidArray, 'arbitration_remove.address');
388
+ ERROR(Errors.IsValidArray, 'remove_arbitration.address');
387
389
  }
388
390
 
389
391
  if (passport) {