wowok 1.4.27 → 1.4.28

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.4.27",
3
+ "version": "1.4.28",
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/passport.ts CHANGED
@@ -255,7 +255,6 @@ export class GuardParser {
255
255
  res.forEach((r) => {
256
256
  const c = r.data?.content as any;
257
257
  if (!c) ERROR(Errors.Fail, 'Parse_Guard_Helper invalid content');
258
-
259
258
  const index = protocol.WOWOK_OBJECTS_TYPE().findIndex(v => {return v.includes('guard::Guard') && v == c.type});
260
259
  if (index === -1) ERROR(Errors.Fail, 'Parse_Guard_Helper invalid type: ' + c.type);
261
260
 
package/src/permission.ts CHANGED
@@ -84,6 +84,7 @@ export enum PermissionIndex {
84
84
  treasury_withdraw = 703,
85
85
  treasury_descritption = 704,
86
86
  treasury_free_deposit_set = 705,
87
+
87
88
  user_defined_start = 1000,
88
89
  }
89
90
 
package/src/protocol.ts CHANGED
@@ -9,7 +9,6 @@ import { isValidSuiAddress, isValidSuiObjectId } from '@mysten/sui/utils'
9
9
 
10
10
  export enum MODULES {
11
11
  machine = 'machine',
12
- node = 'node',
13
12
  progress = 'progress',
14
13
  repository = 'repository',
15
14
  permission = 'permission',
@@ -215,11 +214,12 @@ const TESTNET = {
215
214
  }
216
215
  */
217
216
  const TESTNET = {
218
- wowok: "0xb82ef16ea48fb4f732310c3a0c86c34d0b8711f4dac1c4ca693005345047bfa4",
219
- base: '0x74fb58a0b148f19852a721293a797fdeb59dec5da71ca31838fc810af2d32fdd',
220
- wowok_object: '0x41c93c2903227632a33394d37fd3b7f62a33bc72b16a7f9aafc8161b78b232be',
221
- entity_object: '0x0b34c975a4b179755dabdec5c50505bd21c0439c463d171a54fa44f215e3bb57',
222
- treasury_cap:'0xacb8b1d380d4f75a802dd7412142290bebd7f6266785690de2daf68f6a7ba9ce',
217
+ wowok: "0x6c0d4f3c5f1ceb981721cd44c516bbeadf22f53791906ed00893a64bb788d56c",
218
+ wowok_origin:'0xa487291ecede9b713400360ce81d242ad227af8184f07ace1a3dab1bfc920660' ,
219
+ base: '0x7efcdab72af2351e5915e34ad2ac8d4ea7f4f408e08138d3498af35a362db782',
220
+ wowok_object: '0xb56d70321b3205e994eb8e7664eabc91f361a55d75f363a321c8d4cf012fd6b2',
221
+ entity_object: '0x33881b1d2a65886c3068917a20d849e3956771df1bceb7a05678e40bcff30aa2',
222
+ treasury_cap:'0x538cf8f32d59f58c0450a3a97c1eeed3096f4ce63e07e0bdf343a5cc1464887c',
223
223
  }
224
224
  const MAINNET = {
225
225
  wowok: "",
@@ -270,6 +270,7 @@ export class Protocol {
270
270
  case ENTRYPOINT.testnet:
271
271
  this.package.set('wowok', TESTNET.wowok);
272
272
  this.package.set('base', TESTNET.base);
273
+ this.package.set('wowok_origin', TESTNET.wowok_origin); //@ orgin package!!!
273
274
  this.wowok_object = TESTNET.wowok_object;
274
275
  this.entity_object= TESTNET.entity_object;
275
276
  this.treasury_cap = TESTNET.treasury_cap;
@@ -312,7 +313,6 @@ export class Protocol {
312
313
  RepositoryFn = (fn:any) => { return `${this.package.get('wowok')}::${MODULES.repository}::${fn}`};
313
314
  PermissionFn = (fn: any) => { return `${this.package.get('wowok')}::${MODULES.permission}::${fn}`};
314
315
  PassportFn = (fn:any) => { return `${this.package.get('wowok')}::${MODULES.passport}::${fn}`};
315
- GuardFn = (fn: any) => { return `${this.package.get('base')}::${MODULES.guard}::${fn}`};
316
316
  VoteFn = (fn:any) => { return `${this.package.get('wowok')}::${MODULES.vote}::${fn}`};
317
317
  DemandFn = (fn: any) => { return `${this.package.get('wowok')}::${MODULES.demand}::${fn}`};
318
318
  OrderFn = (fn:any) => { return `${this.package.get('wowok')}::${MODULES.order}::${fn}`};
@@ -324,6 +324,8 @@ export class Protocol {
324
324
  TreasuryFn = (fn: any) => { return `${this.package.get('wowok')}::${MODULES.treasury}::${fn}`};
325
325
  PaymentFn = (fn: any) => { return `${this.package.get('wowok')}::${MODULES.payment}::${fn}`};
326
326
  WithholdingFn = (fn: any) => { return `${this.package.get('wowok')}::${MODULES.withholding}::${fn}`};
327
+ GuardFn = (fn: any) => { return `${this.package.get('base')}::${MODULES.guard}::${fn}`};
328
+ MintFn = (fn: any) => { return `${this.package.get('base')}::${MODULES.wowok}::${fn}`};
327
329
 
328
330
  Query = async (objects: Query_Param[], options:SuiObjectDataOptions={showContent:true}) : Promise<SuiObjectResponse[]> => {
329
331
  const client = new SuiClient({ url: this.NetworkUrl() });
@@ -367,8 +369,8 @@ export class Protocol {
367
369
  static SUI_TOKEN_TYPE = '0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI'; // TOKEN_TYPE
368
370
  // used in demand, reward, ...
369
371
  static SUI_COIN_TYPE = '0x0000000000000000000000000000000000000000000000000000000000000002::coin::Coin<0x2::sui::SUI>'; // COIN TYPE
370
- WOWOK_TOKEN_TYPE = () => { return this.package.get('wowok') + '::wowok::WOWOK' }
371
- WOWOK_COIN_TYPE = () => { return '0x2::coin::Coin<' + this.package.get('wowok') + '::wowok::WOWOK>'}
372
+ WOWOK_TOKEN_TYPE = () => { return this.package.get('base') + '::wowok::WOWOK' }
373
+ WOWOK_COIN_TYPE = () => { return '0x2::coin::Coin<' + this.package.get('base') + '::wowok::WOWOK>'}
372
374
  COINS_TYPE = () => {
373
375
  switch(this.network) {
374
376
  case ENTRYPOINT.testnet:
@@ -403,13 +405,13 @@ export class Protocol {
403
405
  CoinTypes_Testnet:CoinTypeInfo[] = [
404
406
  {symbol:'SUI', type:'0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI', decimals:9, alias:true},
405
407
  {symbol:'SUI', type:'0x2::sui::SUI', decimals:9, },
406
- {symbol:'WOW', type:TESTNET.wowok + '::wowok::WOWOK', decimals:9},
408
+ {symbol:'WOW', type:TESTNET.base + '::wowok::WOWOK', decimals:9},
407
409
  ];
408
410
 
409
411
  CoinTypes_Mainnet:CoinTypeInfo[] = [
410
412
  {symbol:'SUI', type:'0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI', decimals:9, alias:true},
411
413
  {symbol:'SUI', type:'0x2::sui::SUI', decimals:9, },
412
- {symbol:'WOW', type:TESTNET.wowok + '::wowok::WOWOK', decimals:9},
414
+ {symbol:'WOW', type:TESTNET.base + '::wowok::WOWOK', decimals:9},
413
415
  {symbol:'USDT', type:'0xc060006111016b8a020ad5b33834984a437aaa7d3c74c18e09a95d48aceab08c::coin::COIN', decimals:6},
414
416
  {symbol:'USDC', type:'0x5d4b302506645c37ff133b98c4b50a5ae14841659738d6d733d59d0d217a93bf::coin::COIN', decimals:6},
415
417
  {symbol:'WETH', type:'0xaf8cd5edc19c4512f4259f0bee101a40d41ebed738ade5874359610ef8eeced5::coin::COIN', decimals:8},
@@ -449,9 +451,9 @@ export class Protocol {
449
451
  })
450
452
  }
451
453
  WOWOK_OBJECTS_TYPE = () => (Object.keys(MODULES) as Array<keyof typeof MODULES>).map((key) =>
452
- { let i = this.package.get('wowok') + '::' + key + '::'; return i + capitalize(key); })
454
+ { let i = (key === MODULES.guard ? this.package.get('base') : this.package.get('wowok')) + '::' + key + '::'; return i + capitalize(key); })
453
455
  WOWOK_OBJECTS_PREFIX_TYPE = () => (Object.keys(MODULES) as Array<keyof typeof MODULES>).map((key) =>
454
- { return this.package.get('wowok') + '::' + key + '::'; })
456
+ { return (key === MODULES.guard ? this.package.get('base') : this.package.get('wowok')) + '::' + key + '::'; })
455
457
  private hasPackage(pack:string) : boolean {
456
458
  for (let value of this.package.values()) {
457
459
  if (value === pack) {
package/src/treasury.ts CHANGED
@@ -47,10 +47,10 @@ export class Treasury {
47
47
  static New(txb:TransactionBlock, token_type:string, permission:PermissionObject, description:string,
48
48
  bFreeDeposit:boolean=false, passport?:PassportObject) : Treasury {
49
49
  if (!Protocol.IsValidObjects([permission])) {
50
- ERROR(Errors.IsValidObjects, 'permission, bounty');
50
+ ERROR(Errors.IsValidObjects, 'Treasury.New permission, bounty');
51
51
  }
52
52
  if (!IsValidDesription(description)) {
53
- ERROR(Errors.IsValidDesription);
53
+ ERROR(Errors.IsValidDesription, 'Treasury.New.description');
54
54
  }
55
55
  if (!IsValidArgType(token_type)) {
56
56
  ERROR(Errors.IsValidArgType, token_type);
@@ -1,5 +1,5 @@
1
1
  import { FnCallType, PaymentObject, ReceivedObject, PaymentAddress, Protocol, TxbObject, CoinObject, PassportObject} from './protocol';
2
- import { IsValidDesription, IsValidAddress, Bcs, array_unique, IsValidArray, IsValidName, IsValidU64, IsValidU256, IsValidU8 } from './utils';
2
+ import { IsValidDesription, IsValidAddress, IsValidArray, IsValidU64, parseObjectType } from './utils';
3
3
  import { ERROR, Errors } from './exception';
4
4
  import { DepositParam, WithdrawParam, WithdrawItem } from './treasury';
5
5
  import { Transaction as TransactionBlock} from '@mysten/sui/transactions';
@@ -9,7 +9,8 @@ export interface WithholdingGuard {
9
9
  amount: bigint,
10
10
  }
11
11
  export interface WithholdingParam {
12
- guards: WithholdingGuard[]
12
+ guards: WithholdingGuard[],
13
+ description: string,
13
14
  }
14
15
 
15
16
  export class Withholding {
@@ -34,6 +35,8 @@ export class Withholding {
34
35
 
35
36
  static New(txb:TransactionBlock, pay_token_type:string, param:WithholdingParam) : Withholding {
36
37
  if (!pay_token_type) ERROR(Errors.InvalidParam, 'Withholding.New_fromAddress.pay_token_type');
38
+ if (!IsValidDesription(param.description)) ERROR(Errors.IsValidDesription, 'Withholding.New.param')
39
+
37
40
  if (param.guards.length === 0 || param.guards.length > Withholding.MAX_GUARD_COUNT) {
38
41
  ERROR(Errors.InvalidParam, 'Withholding.New.param.guards length')
39
42
  }
@@ -42,16 +45,14 @@ export class Withholding {
42
45
  }
43
46
 
44
47
  let v = new Withholding(txb, pay_token_type);
45
- const clock = txb.sharedObjectRef(Protocol.CLOCK_OBJECT);
46
-
47
48
  v.object = txb.moveCall({
48
49
  target:Protocol.Instance().WithholdingFn('new') as FnCallType,
49
- arguments:[],
50
+ arguments:[txb.pure.string(param.description)],
50
51
  typeArguments:[pay_token_type],
51
52
  })
52
53
 
53
- param.guards.forEach((i) => {
54
- txb.moveCall({
54
+ param.guards.forEach((i) => {
55
+ v.object = txb.moveCall({
55
56
  target:Protocol.Instance().WithholdingFn('add_guard') as FnCallType,
56
57
  arguments:[txb.object(v.object), txb.object(i.guard), txb.pure.u64(i.amount)],
57
58
  typeArguments:[pay_token_type],
@@ -159,6 +160,8 @@ export class Withholding {
159
160
  })
160
161
  }
161
162
  }
162
-
163
+ static parseObjectType = (chain_type:string) : string => {
164
+ return parseObjectType(chain_type, 'withholding::Withholding<')
165
+ }
163
166
  static MAX_GUARD_COUNT = 16;
164
167
  }
package/src/wowok.ts CHANGED
@@ -52,7 +52,7 @@ export class Wowok {
52
52
  if (!IsValidAddress(recipient)) ERROR(Errors.IsValidAddress, 'mint');
53
53
  if (!IsValidU64(amount)) ERROR(Errors.IsValidU64, 'mint');
54
54
  this.txb.moveCall({
55
- target:Protocol.Instance().WowokFn('mint') as FnCallType,
55
+ target:Protocol.Instance().MintFn('mint') as FnCallType, //@ base package
56
56
  arguments:[Protocol.TXB_OBJECT(this.txb, Protocol.Instance().TreasuryCap()), this.txb.pure.u64(amount),
57
57
  this.txb.pure.address(recipient)]
58
58
  })