wowok 1.4.19 → 1.4.21

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/src/permission.ts CHANGED
@@ -78,6 +78,10 @@ export enum PermissionIndex {
78
78
  progress_context_repository = 653,
79
79
  progress_unhold = 654,
80
80
  progress_parent = 655,
81
+
82
+ treasury = 700,
83
+ treasury_deposit = 701,
84
+ treasury_take = 702,
81
85
  user_defined_start = 1000,
82
86
  }
83
87
 
@@ -175,6 +179,10 @@ export const PermissionInfo : PermissionInfoType[] = [
175
179
  {index:PermissionIndex.progress_context_repository, name: 'Repository', description:'Set Progress repository', module: 'progress'},
176
180
  {index:PermissionIndex.progress_unhold, name: 'Unhold', description:'Release Progress holdings', module: 'progress'},
177
181
  {index:PermissionIndex.progress_parent, name: 'Parent', description:'Set Progress parent', module: 'progress'},
182
+
183
+ {index:PermissionIndex.treasury, name: 'Treasury', description:'Launch new Treasury', module: 'treasury'},
184
+ {index:PermissionIndex.treasury_deposit, name: 'Deposit', description:'Deposit coins', module: 'treasury'},
185
+ {index:PermissionIndex.treasury_take, name: 'Take', description:'Take out coins', module: 'treasury'},
178
186
  ]
179
187
 
180
188
  export type PermissionIndexType = PermissionIndex | number;
package/src/progress.ts CHANGED
@@ -19,6 +19,7 @@ export type ParentProgress = {
19
19
  forward: string;
20
20
  }
21
21
 
22
+ export type CurrentSessionId = TransactionResult;
22
23
  export interface Holder {
23
24
  forward: string;
24
25
  who?:string;
@@ -257,7 +258,7 @@ export class Progress {
257
258
  }
258
259
  }
259
260
 
260
- next(next:ProgressNext, deliverables_address?:string, sub_id?:string, passport?:PassportObject) {
261
+ next(next:ProgressNext, deliverables_address?:string, sub_id?:string, passport?:PassportObject) : CurrentSessionId {
261
262
  if (!Progress.IsValidProgressNext(next)) {
262
263
  ERROR(Errors.InvalidParam, 'next')
263
264
  }
@@ -273,7 +274,7 @@ export class Progress {
273
274
  const clock = this.txb.sharedObjectRef(Protocol.CLOCK_OBJECT);
274
275
 
275
276
  if (passport) {
276
- this.txb.moveCall({
277
+ return this.txb.moveCall({
277
278
  target:Protocol.Instance().ProgressFn('next_with_passport') as FnCallType,
278
279
  arguments: [passport, Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, this.machine),
279
280
  this.txb.pure.string(next.next_node_name),
@@ -281,7 +282,7 @@ export class Progress {
281
282
  Protocol.TXB_OBJECT(this.txb, this.permission), this.txb.object(clock)],
282
283
  })
283
284
  } else {
284
- this.txb.moveCall({
285
+ return this.txb.moveCall({
285
286
  target:Protocol.Instance().ProgressFn('next') as FnCallType,
286
287
  arguments: [Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, this.machine), this.txb.pure.string(next.next_node_name),
287
288
  this.txb.pure.string(next.forward), diliverable, sub, Protocol.TXB_OBJECT(this.txb, this.permission), this.txb.object(clock)],
@@ -289,12 +290,12 @@ export class Progress {
289
290
  }
290
291
  }
291
292
 
292
- hold(next:ProgressNext, hold:boolean) {
293
+ hold(next:ProgressNext, hold:boolean) : CurrentSessionId {
293
294
  if (!Progress.IsValidProgressNext(next)) {
294
295
  ERROR(Errors.InvalidParam, 'hold')
295
296
  }
296
297
  const clock = this.txb.sharedObjectRef(Protocol.CLOCK_OBJECT);
297
- this.txb.moveCall({
298
+ return this.txb.moveCall({
298
299
  target:Protocol.Instance().ProgressFn('hold') as FnCallType,
299
300
  arguments: [Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, this.machine), this.txb.pure.string(next.next_node_name),
300
301
  this.txb.pure.string(next.forward), this.txb.pure.bool(hold), Protocol.TXB_OBJECT(this.txb, this.permission), this.txb.object(clock)],
package/src/protocol.ts CHANGED
@@ -24,6 +24,9 @@ export enum MODULES {
24
24
  resource = 'resource',
25
25
  entity = 'entity',
26
26
  wowok = 'wowok',
27
+ treasury = 'treasury',
28
+ payment = 'payment',
29
+ withholding = 'withholding',
27
30
  }
28
31
 
29
32
  export type PermissionAddress = TransactionResult;
@@ -152,7 +155,7 @@ export const IsNumberType = (type:ValueType | any) : boolean => { return type===
152
155
  export enum ContextType {
153
156
  TYPE_SIGNER = 60,
154
157
  TYPE_CLOCK = 61,
155
- TYPE_WITNESS_ID = 62,
158
+ TYPE_GUARD = 62, // current guard address
156
159
  TYPE_CONSTANT = 80,
157
160
  }
158
161
  interface ValueTypeString {
@@ -165,8 +168,8 @@ interface ValueTypeString {
165
168
  export const SER_VALUE: ValueTypeString[] = [
166
169
  {type: ValueType.TYPE_BOOL, name: 'bool', description:'boolean. eg:true or false', validator:(value:any) => { return (value === true || value === false)}},
167
170
  {type: ValueType.TYPE_ADDRESS, name: 'address', description:'address or object-id. eg:0x6789af', validator:IsValidAddress},
168
- {type: ContextType.TYPE_WITNESS_ID, name: 'witness address', description:"For example, the address of the Machine object ensures that the Progress generated in the past or future is verified; the address of the Service object ensures that the Order generated in the past or future is verified.", validator:IsValidAddress},
169
- {type: ContextType.TYPE_SIGNER, name: 'txn signer', description:"signer address of the transaction, "},
171
+ {type: ContextType.TYPE_SIGNER, name: 'txn signer', description:"signer address of the transaction"},
172
+ {type: ContextType.TYPE_GUARD, name: 'guard address', description:"current guard address"},
170
173
  {type: ContextType.TYPE_CLOCK, name: 'txn time', description:"unsigned-64 number for the transaction time"},
171
174
  {type: ValueType.TYPE_U64, name: 'number', description:'unsigned-64 number. eg:23870233', validator:IsValidU64},
172
175
  {type: ValueType.TYPE_U8, name: 'number', description:'unsigned-8 number. eg:255', validator:IsValidU8},
@@ -190,7 +193,7 @@ export const SER_VALUE: ValueTypeString[] = [
190
193
  {type: ValueType.TYPE_U256, name: 'number', description:'unsigned-256 number. eg:12345678901233', validator:IsValidUintLarge},
191
194
  ]
192
195
 
193
- export type ConstantType = ValueType | ContextType.TYPE_WITNESS_ID;
196
+ //export type ConstantType = ValueType | ContextType.TYPE_WITNESS_ID;
194
197
  export type Data_Type = ValueType | OperatorType | ContextType;
195
198
 
196
199
  export enum ENTRYPOINT {
@@ -208,10 +211,10 @@ const TESTNET = {
208
211
  }
209
212
  */
210
213
  const TESTNET = {
211
- package: "0x46e9a55686124138132d83098a1ae0b9d63d91e93d96d636c47b5e6f7f00a3d4",
212
- wowok_object: '0xa78e02dd7d537ddeab3a33bb9b40df4663f58b4e835dfa5dc430f5ae4e71b4fe',
213
- entity_object: '0x487524f61ed9dd3f4a02ae7311b2879f3b0ebeef1a9a4cd36f291dcd351e8e56',
214
- treasury_cap:'0xf5ecc294e9e5524c55a5775c7fb3e8aa8e7d4b6bb4fc2f91712f8610d02e0287',
214
+ package: "0x61dad08ebbda7d4f38223e222a2dcc18cec644d99c66937cde65dd99a9ba93b1",
215
+ wowok_object: '0xed0a7c40db1f8de42e4dd5ecca2e7912701dee0fe9f7b6fe7ebd7205133a80b7',
216
+ entity_object: '0x4a4850bf062bb29fec3b64de337db02f7ccee0ae13b85f287ee5850a568ae330',
217
+ treasury_cap:'0xb33d469f8164eefbf02b260e02194faab5bfad2acafd36088e1e64302bbcd797',
215
218
  }
216
219
  const MAINNET = {
217
220
  package: "",
package/src/utils.ts CHANGED
@@ -244,8 +244,6 @@ export class Bcs {
244
244
  return this.bcs.ser('vector<u8>', d).toBytes();
245
245
  case ValueType.TYPE_VEC_STRING:
246
246
  return this.bcs.ser('vector<vector<u8>>', data.map((v:string)=>{return new TextEncoder().encode(v)})).toBytes();
247
- case ContextType.TYPE_WITNESS_ID:
248
- return this.bcs.ser(BCS.ADDRESS, data).toBytes();
249
247
  default:
250
248
  ERROR(Errors.bcsTypeInvalid, 'ser');
251
249
  }
@@ -589,7 +587,7 @@ export const query_object = (param:query_object_param) => {
589
587
  }
590
588
  }
591
589
 
592
- export const FirstLetterUppercase = (str:string) => {
593
- if (!str) return str;
590
+ export const FirstLetterUppercase = (str:string|undefined|null) : string => {
591
+ if (!str) return '';
594
592
  return str.substring(0, 1).toUpperCase() + str.substring(1);
595
593
  }