wowok 1.3.9 → 1.3.10

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.9",
3
+ "version": "1.3.10",
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/machine.ts CHANGED
@@ -424,9 +424,32 @@ export class Machine {
424
424
  this.add_node2([n], passport);
425
425
  }
426
426
 
427
+ remove_pair(node_prior:string, node_name:string, passport?:PassportObject) {
428
+ if (!IsValidName_AllowEmpty(node_prior)) ERROR(Errors.IsValidName_AllowEmpty, 'remove_pair');
429
+ if (!IsValidName(node_name)) ERROR(Errors.IsValidName, 'remove_pair');
430
+ let n : any;
431
+ if (passport) {
432
+ n = this.txb.moveCall({
433
+ target:Protocol.Instance().MachineFn('node_fetch_with_passport') as FnCallType,
434
+ arguments:[passport, Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.string(node_name), Protocol.TXB_OBJECT(this.txb, this.permission)],
435
+ })
436
+
437
+ } else {
438
+ n = this.txb.moveCall({
439
+ target:Protocol.Instance().MachineFn('node_fetch') as FnCallType,
440
+ arguments:[Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.string(node_name), Protocol.TXB_OBJECT(this.txb, this.permission)],
441
+ })
442
+ }
443
+ this.txb.moveCall({
444
+ target:Protocol.Instance().MachineFn('pair_remove') as FnCallType,
445
+ arguments:[n, this.txb.pure.string(node_prior)],
446
+ })
447
+ this.add_node2([n], passport);
448
+ }
449
+
427
450
  remove_forward(node_prior:string, node_name:string, foward_name: string, passport?:PassportObject) {
428
- if (!IsValidName_AllowEmpty(node_prior)) ERROR(Errors.IsValidName_AllowEmpty, 'add_forward');
429
- if (!IsValidName(node_name)) ERROR(Errors.IsValidName, 'add_forward');
451
+ if (!IsValidName_AllowEmpty(node_prior)) ERROR(Errors.IsValidName_AllowEmpty, 'remove_forward');
452
+ if (!IsValidName(node_name)) ERROR(Errors.IsValidName, 'remove_forward');
430
453
 
431
454
  let n : any;
432
455
  if (passport) {
package/src/protocol.ts CHANGED
@@ -156,8 +156,8 @@ export const SER_VALUE: ValueTypeString[] = [
156
156
  {type: ValueType.TYPE_BOOL, name: 'bool', description:'boolean. eg:true or false', validator:(value:any) => { return (value === true || value === false)}},
157
157
  {type: ValueType.TYPE_ADDRESS, name: 'address', description:'address or object-id. eg:0x6789af', validator:IsValidAddress},
158
158
  {type: ContextType.TYPE_WITNESS_ID, name: 'future address', description:"eg: machine's future progress, service's future order", validator:IsValidAddress},
159
- {type: ContextType.TYPE_SIGNER, name: 'txn signer', description:"signer address of the transaction, ", validator:IsValidAddress},
160
- {type: ContextType.TYPE_CLOCK, name: 'txn time', description:"unsigned-64 number for the transaction time", validator:IsValidU64},
159
+ {type: ContextType.TYPE_SIGNER, name: 'txn signer', description:"signer address of the transaction, "},
160
+ {type: ContextType.TYPE_CLOCK, name: 'txn time', description:"unsigned-64 number for the transaction time"},
161
161
  {type: ValueType.TYPE_U64, name: 'number', description:'unsigned-64 number. eg:23870233', validator:IsValidU64},
162
162
  {type: ValueType.TYPE_U8, name: 'number', description:'unsigned-8 number. eg:255', validator:IsValidU8},
163
163
  {type: ValueType.TYPE_VEC_U8, name: 'string', description:'string or unsigned-8 number array. eg:"[1,2,3]"'},
@@ -191,15 +191,17 @@ export enum ENTRYPOINT {
191
191
  }
192
192
 
193
193
  const TESTNET = {
194
- package: "0x366cbf58452fca91d1028af0bc9709c1826c2d89dce258ddf1d4fe9a95ffa6d7",
195
- wowok_object: '0xadd1755c84aa7e99ecd84a71eed6b7150f097a88f3a60f4770be72a93f03fca4',
196
- entity_object: '0x41b5e7defd512bb098c367c04f2731c81e468365f824b2ab354fb9dbf5a42549',
194
+ package: "0x98e5209cf5cf31a38ebde562681441d7544f38ee6a879266dc7273160635f6ba",
195
+ wowok_object: '0x676243951ed0d32341680b10d888887dfb39603b1af747036164e90fdfed1274',
196
+ entity_object: '0xe32334d663d0e7d058682b5170632672a11df1cdaa3f522859e75b451bdc67d5',
197
+ treasury_cap:'0x10bec6d987cf7fc16fc62246f3c382d84ee285d9ec9f038bc03845fe620bf2d3',
197
198
  }
198
199
 
199
200
  const MAINNET = {
200
201
  package: "",
201
202
  wowok_object: '',
202
203
  entity_object: '',
204
+ treasury_cap:'',
203
205
  }
204
206
 
205
207
  export interface CoinTypeInfo {
@@ -214,6 +216,7 @@ export class Protocol {
214
216
  protected signer = '';
215
217
  protected wowok_object = '';
216
218
  protected entity_object = '';
219
+ protected treasury_cap = '';
217
220
  protected graphql = '';
218
221
  protected txb: TransactionBlock | undefined;
219
222
  static _instance: any;
@@ -243,19 +246,22 @@ export class Protocol {
243
246
  this.package = TESTNET.package;
244
247
  this.wowok_object = TESTNET.wowok_object;
245
248
  this.entity_object= TESTNET.entity_object;
249
+ this.treasury_cap = TESTNET.treasury_cap;
246
250
  this.graphql = 'https://sui-testnet.mystenlabs.com/graphql';
247
251
  break;
248
252
  case ENTRYPOINT.mainnet:
249
253
  this.package = MAINNET.package;
250
254
  this.wowok_object = MAINNET.wowok_object;
251
255
  this.entity_object= MAINNET.entity_object;
256
+ this.treasury_cap = MAINNET.treasury_cap;
252
257
  this.graphql = 'https://sui-mainnet.mystenlabs.com/graphql';
253
258
  break;
254
259
  };
255
260
  }
256
- Package(): string { return this.package }
261
+ Package(): string { return this.package }
257
262
  WowokObject(): string { return this.wowok_object }
258
263
  EntityObject(): string { return this.entity_object }
264
+ TreasuryCap() : string { return this.treasury_cap }
259
265
  GraphqlUrl() : string { return this.graphql }
260
266
 
261
267
  NetworkUrl() : string {
package/src/wowok.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Protocol, FnCallType, TxbObject, ResourceAddress, PermissionObject} from './protocol';
2
- import { IsValidDesription, IsValidAddress, IsValidName, IsValidArray, } from './utils';
2
+ import { IsValidDesription, IsValidAddress, IsValidName, IsValidArray, IsValidU64, } from './utils';
3
3
  import { ERROR, Errors } from './exception';
4
4
  import { Transaction as TransactionBlock} from '@mysten/sui/transactions';
5
5
 
@@ -47,5 +47,15 @@ export class Wowok {
47
47
  arguments:[Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.string(new_name)]
48
48
  })
49
49
  }
50
+
51
+ mint(amount: string, recipient: string) {
52
+ if (!IsValidAddress(recipient)) ERROR(Errors.IsValidAddress, 'mint');
53
+ if (!IsValidU64(amount)) ERROR(Errors.IsValidU64, 'mint');
54
+ this.txb.moveCall({
55
+ target:Protocol.Instance().WowokFn('mint') as FnCallType,
56
+ arguments:[Protocol.TXB_OBJECT(this.txb, Protocol.Instance().TreasuryCap()), this.txb.pure.u64(amount),
57
+ this.txb.pure.address(recipient)]
58
+ })
59
+ }
50
60
  }
51
61