wowok 1.4.16 → 1.4.19

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.16",
3
+ "version": "1.4.19",
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/exception.ts CHANGED
@@ -22,6 +22,7 @@ export enum Errors {
22
22
  isValidHttpUrl = 'invalid url',
23
23
  IsValidUserDefinedIndex = 'invalid user defined permission index',
24
24
  bcsTypeInvalid = 'invalid bcs type',
25
+ IsValidServiceItemName = 'invalid service item name',
25
26
  }
26
27
 
27
28
  export const ERROR = (error:Errors, info?:any) => {
package/src/guard.ts CHANGED
@@ -108,110 +108,144 @@ export class Guard {
108
108
  [MODULES.permission, 'Number of Entities', 8, [], ValueType.TYPE_U64, 'Number of entities in the personnel permission table.'],
109
109
  [MODULES.permission, 'Number of Admin', 9, [], ValueType.TYPE_U64, 'Number of administrators.'],
110
110
 
111
- [MODULES.repository, 'Permission', 11, [], ValueType.TYPE_ADDRESS, 'Permission object address.'],
112
- [MODULES.repository, 'Contains Policy', 12, [ValueType.TYPE_STRING], ValueType.TYPE_BOOL, 'Is a consensus policy included?', 'Input:the filed name'],
113
- [MODULES.repository, 'Is Permission set of Policy', 13, [ValueType.TYPE_STRING], ValueType.TYPE_BOOL, 'Does a certain consensus policy set data operation permissions?', 'Input:the policy name'],
114
- [MODULES.repository, 'Permission of Policy', 14, [ValueType.TYPE_STRING], ValueType.TYPE_U64, 'The permission index of a certain consensus policy in the Permission object.', 'Input:the policy name'],
115
- [MODULES.repository, 'Value Type of Policy', 15, [ValueType.TYPE_STRING], ValueType.TYPE_U8, 'Data types defined by consensus policy.', 'Input:the policy name'],
116
- [MODULES.repository, 'Contains Data for An Address', 16, [ValueType.TYPE_ADDRESS], ValueType.TYPE_BOOL, 'Whether data exists at a certain address?', 'Input:address'],
117
- [MODULES.repository, 'Contains Data', 17, [ValueType.TYPE_ADDRESS, ValueType.TYPE_STRING], ValueType.TYPE_BOOL, 'Does it contain data for a certain field of an address?', 'Input 1:address, Input 2:the field name'],
118
- [MODULES.repository, 'Raw data without Type', 18, [ValueType.TYPE_ADDRESS, ValueType.TYPE_STRING], ValueType.TYPE_VEC_U8, 'Data for a field at an address and does not contain data type information.', 'Input 1:address, Input 2:the field name'],
119
- [MODULES.repository, 'Raw data', 19, [ValueType.TYPE_ADDRESS, ValueType.TYPE_STRING], ValueType.TYPE_VEC_U8, 'Data for a field at an address, and the first byte contains data type information.', 'Input 1:address, Input 2:the field name'],
120
- [MODULES.repository, 'Type', 20, [], ValueType.TYPE_U8, 'The repository Type. 0: Normal; 1: Wowok greenee.'],
121
- [MODULES.repository, 'Policy Mode', 21, [], ValueType.TYPE_U8, 'Policy Mode. 0: Free mode; 1: Strict mode.'],
122
- [MODULES.repository, 'Reference Count', 22, [], ValueType.TYPE_U64, 'The number of times it is referenced by other objects.'],
123
- [MODULES.repository, 'Is Referenced by An Object', 23, [ValueType.TYPE_ADDRESS], ValueType.TYPE_BOOL, 'Is it referenced by an object?', 'Input:address'],
124
- [MODULES.repository, 'Data Number', 24, [ValueType.TYPE_ADDRESS, ValueType.TYPE_STRING], ValueType.TYPE_U256, 'Data for a field at an address and get unsigned integer type data.', 'Input 1:address, Input 2:the field name'],
125
- [MODULES.repository, 'Data String', 25, [ValueType.TYPE_ADDRESS, ValueType.TYPE_STRING], ValueType.TYPE_STRING, 'Data for a field at an address and get string type data.', 'Input 1:address, Input 2:the field name'],
126
- [MODULES.repository, 'Data Address', 26, [ValueType.TYPE_ADDRESS, ValueType.TYPE_STRING], ValueType.TYPE_ADDRESS, 'Data for a field at an address and get address type data.', 'Input 1:address, Input 2:the field name'],
127
- [MODULES.repository, 'Data Bool', 27, [ValueType.TYPE_ADDRESS, ValueType.TYPE_STRING], ValueType.TYPE_BOOL, 'Data for a field at an address and get bool type data.', 'Input 1:address, Input 2:the field name'],
128
- [MODULES.repository, 'Data Number Vector', 28, [ValueType.TYPE_ADDRESS, ValueType.TYPE_STRING], ValueType.TYPE_VEC_U256, 'Data for a field at an address and get unsigned integer vector type data.', 'Input 1:address, Input 2:the field name'],
129
- [MODULES.repository, 'Data String Vector', 29, [ValueType.TYPE_ADDRESS, ValueType.TYPE_STRING], ValueType.TYPE_VEC_STRING, 'Data for a field at an address and get string vector type data.', 'Input 1:address, Input 2:the field name'],
130
- [MODULES.repository, 'Data Address Vector', 30, [ValueType.TYPE_ADDRESS, ValueType.TYPE_STRING], ValueType.TYPE_VEC_ADDRESS, 'Data for a field at an address and get address vector type data.', 'Input 1:address, Input 2:the field name'],
131
- [MODULES.repository, 'Data Bool Vector', 31, [ValueType.TYPE_ADDRESS, ValueType.TYPE_STRING], ValueType.TYPE_VEC_BOOL, 'Data for a field at an address and get bool vector type data.', 'Input 1:address, Input 2:the field name'],
132
-
111
+ [MODULES.repository, 'Permission', 100, [], ValueType.TYPE_ADDRESS, 'Permission object address.'],
112
+ [MODULES.repository, 'Contains Policy', 101, [ValueType.TYPE_STRING], ValueType.TYPE_BOOL, 'Is a consensus policy included?', 'Input:the filed name'],
113
+ [MODULES.repository, 'Is Permission set of Policy', 102, [ValueType.TYPE_STRING], ValueType.TYPE_BOOL, 'Does a certain consensus policy set data operation permissions?', 'Input:the policy name'],
114
+ [MODULES.repository, 'Permission of Policy', 103, [ValueType.TYPE_STRING], ValueType.TYPE_U64, 'The permission index of a certain consensus policy in the Permission object.', 'Input:the policy name'],
115
+ [MODULES.repository, 'Value Type of Policy', 104, [ValueType.TYPE_STRING], ValueType.TYPE_U8, 'Data types defined by consensus policy.', 'Input:the policy name'],
116
+ [MODULES.repository, 'Contains Data for An Address', 105, [ValueType.TYPE_ADDRESS], ValueType.TYPE_BOOL, 'Whether data exists at a certain address?', 'Input:address'],
117
+ [MODULES.repository, 'Contains Data', 106, [ValueType.TYPE_ADDRESS, ValueType.TYPE_STRING], ValueType.TYPE_BOOL, 'Does it contain data for a certain field of an address?', 'Input 1:address, Input 2:the field name'],
118
+ [MODULES.repository, 'Raw data without Type', 107, [ValueType.TYPE_ADDRESS, ValueType.TYPE_STRING], ValueType.TYPE_VEC_U8, 'Data for a field at an address and does not contain data type information.', 'Input 1:address, Input 2:the field name'],
119
+ [MODULES.repository, 'Raw data', 108, [ValueType.TYPE_ADDRESS, ValueType.TYPE_STRING], ValueType.TYPE_VEC_U8, 'Data for a field at an address, and the first byte contains data type information.', 'Input 1:address, Input 2:the field name'],
120
+ [MODULES.repository, 'Type', 109, [], ValueType.TYPE_U8, 'The repository Type. 0: Normal; 1: Wowok greenee.'],
121
+ [MODULES.repository, 'Policy Mode', 110, [], ValueType.TYPE_U8, 'Policy Mode. 0: Free mode; 1: Strict mode.'],
122
+ [MODULES.repository, 'Reference Count', 111, [], ValueType.TYPE_U64, 'The number of times it is referenced by other objects.'],
123
+ [MODULES.repository, 'Is Referenced by An Object', 112, [ValueType.TYPE_ADDRESS], ValueType.TYPE_BOOL, 'Is it referenced by an object?', 'Input:address'],
124
+ [MODULES.repository, 'Data Number', 113, [ValueType.TYPE_ADDRESS, ValueType.TYPE_STRING], ValueType.TYPE_U256, 'Data for a field at an address and get unsigned integer type data.', 'Input 1:address, Input 2:the field name'],
125
+ [MODULES.repository, 'Data String', 114, [ValueType.TYPE_ADDRESS, ValueType.TYPE_STRING], ValueType.TYPE_STRING, 'Data for a field at an address and get string type data.', 'Input 1:address, Input 2:the field name'],
126
+ [MODULES.repository, 'Data Address', 115, [ValueType.TYPE_ADDRESS, ValueType.TYPE_STRING], ValueType.TYPE_ADDRESS, 'Data for a field at an address and get address type data.', 'Input 1:address, Input 2:the field name'],
127
+ [MODULES.repository, 'Data Bool', 116, [ValueType.TYPE_ADDRESS, ValueType.TYPE_STRING], ValueType.TYPE_BOOL, 'Data for a field at an address and get bool type data.', 'Input 1:address, Input 2:the field name'],
128
+ [MODULES.repository, 'Data Number Vector', 117, [ValueType.TYPE_ADDRESS, ValueType.TYPE_STRING], ValueType.TYPE_VEC_U256, 'Data for a field at an address and get unsigned integer vector type data.', 'Input 1:address, Input 2:the field name'],
129
+ [MODULES.repository, 'Data String Vector', 118, [ValueType.TYPE_ADDRESS, ValueType.TYPE_STRING], ValueType.TYPE_VEC_STRING, 'Data for a field at an address and get string vector type data.', 'Input 1:address, Input 2:the field name'],
130
+ [MODULES.repository, 'Data Address Vector', 119, [ValueType.TYPE_ADDRESS, ValueType.TYPE_STRING], ValueType.TYPE_VEC_ADDRESS, 'Data for a field at an address and get address vector type data.', 'Input 1:address, Input 2:the field name'],
131
+ [MODULES.repository, 'Data Bool Vector', 120, [ValueType.TYPE_ADDRESS, ValueType.TYPE_STRING], ValueType.TYPE_VEC_BOOL, 'Data for a field at an address and get bool vector type data.', 'Input 1:address, Input 2:the field name'],
132
+
133
+ [MODULES.entity, 'Contains Entity?', 200, [ValueType.TYPE_ADDRESS], ValueType.TYPE_BOOL, 'Is an entity already registered?', 'Input:address'],
134
+ [MODULES.entity, 'Likes', 201, [ValueType.TYPE_ADDRESS], ValueType.TYPE_U64, 'The number of likes for an address by other addresses.', 'Input:address'],
135
+ [MODULES.entity, 'Dislikes', 202, [ValueType.TYPE_ADDRESS], ValueType.TYPE_U64, 'The number of dislikes for an address by other addresses.', 'Input:address'],
136
+ [MODULES.entity, 'Entity Info', 203, [ValueType.TYPE_ADDRESS], ValueType.TYPE_VEC_U8, 'Public information about an entity.', 'Input:address'],
137
+ [MODULES.entity, 'Has Resource by Entity?', 204, [ValueType.TYPE_ADDRESS], ValueType.TYPE_BOOL, 'Whether an entity created a resource?', 'Input:address'],
138
+ [MODULES.entity, 'Entity Resource', 205, [ValueType.TYPE_ADDRESS], ValueType.TYPE_ADDRESS, 'The address of a resource object created by an entity.', 'Input:address'],
139
+
140
+ [MODULES.demand, 'Permission', 300, [], ValueType.TYPE_ADDRESS, 'Permission object address.'],
141
+ [MODULES.demand, 'Has Deadline', 301, [], ValueType.TYPE_BOOL, 'Whether to set the expiration time of presenting?'],
142
+ [MODULES.demand, 'Deadline', 302, [], ValueType.TYPE_U64, 'The expiration time of presenting.'],
143
+ [MODULES.demand, 'Bounty Count', 303, [], ValueType.TYPE_U64, 'Number of Bounties.'],
144
+ [MODULES.demand, 'Has Guard', 304, [], ValueType.TYPE_BOOL, 'Whether the present guard is set?'],
145
+ [MODULES.demand, 'Guard', 305, [], ValueType.TYPE_ADDRESS, 'The present guard address.'],
146
+ [MODULES.demand, 'Has Service Picked', 306, [], ValueType.TYPE_BOOL, 'Whether a service has been picked and bounties given?'],
147
+ [MODULES.demand, 'Service Picked', 307, [], ValueType.TYPE_ADDRESS, 'Service address that has been picked.'],
148
+ [MODULES.demand, 'Presenter Count', 308, [], ValueType.TYPE_U64, 'Number of presenters.'],
149
+ [MODULES.demand, 'Has Presenter', 309, [ValueType.TYPE_ADDRESS], ValueType.TYPE_BOOL, 'Is a certain address a presenter?', 'Input:address'],
150
+ [MODULES.demand, 'Who Got Bounty', 310, [ValueType.TYPE_ADDRESS], ValueType.TYPE_ADDRESS, 'The address that bounties given.', 'Input:address'],
151
+
152
+ [MODULES.service, 'Permission', 400, [], ValueType.TYPE_ADDRESS, 'Permission object address.'],
153
+ [MODULES.service, 'Payee', 401, [], ValueType.TYPE_ADDRESS, 'Payee address, that all order withdrawals will be collected to this address.'],
154
+ [MODULES.service, 'Has Buying Guard', 402, [], ValueType.TYPE_BOOL, 'Is the guard condition of buying set?'],
155
+ [MODULES.service, 'Buying Guard', 403, [], ValueType.TYPE_ADDRESS, 'Buying guard, that Purchase only if you meet the conditions of the guard.'],
156
+ [MODULES.service, 'Contains Repository', 404, [ValueType.TYPE_ADDRESS], ValueType.TYPE_BOOL, "Is a certain repository one of the service's consensus repositories?", 'Input:address'],
157
+ [MODULES.service, 'Has Withdrawing Guard', 405, [ValueType.TYPE_ADDRESS], ValueType.TYPE_BOOL, 'Whether a certain guard is set when withdrawing money?', 'Input:address'],
158
+ [MODULES.service, 'Withdrawing Guard Percent', 406, [ValueType.TYPE_ADDRESS], ValueType.TYPE_U64, 'The percentage of withdrawals allowed by a certain withdrawal guard.', 'Input:address'],
159
+ [MODULES.service, 'Has Refunding Guard', 407, [ValueType.TYPE_ADDRESS], ValueType.TYPE_BOOL, 'Whether a certain guard is set when refunding money?', 'Input:address'],
160
+ [MODULES.service, 'Refunding Guard Percent', 408, [ValueType.TYPE_ADDRESS], ValueType.TYPE_U64, 'The percentage of refund allowed by a certain refund guard.', 'Input:address'],
161
+ [MODULES.service, 'Has Sales Item', 409, [ValueType.TYPE_STRING], ValueType.TYPE_BOOL, 'Is there a sales item for the service?', 'Input:the item name'],
162
+ [MODULES.service, 'Sale Item Price', 410, [ValueType.TYPE_STRING], ValueType.TYPE_U64, 'What is the price of a certain sale item?', 'Input:the item name'],
163
+ [MODULES.service, 'Sale Item Inventory', 411, [ValueType.TYPE_STRING], ValueType.TYPE_U64, 'How much inventory is there for a certain sales item?', 'Input:the item name'],
164
+ [MODULES.service, 'Has Machine', 412, [], ValueType.TYPE_BOOL, "Has the machine(progress generator) that serves the order been set up?"],
165
+ [MODULES.service, 'Machine', 413, [], ValueType.TYPE_ADDRESS, 'Machine address, that generate progresses serving the execution process of order.'],
166
+ [MODULES.service, 'Paused', 414, [], ValueType.TYPE_BOOL, 'Pause the creation of new order?'],
167
+ [MODULES.service, 'Published', 415, [], ValueType.TYPE_BOOL, 'Is it allowed to create orders?'],
168
+ [MODULES.service, 'Has Required Info', 416, [], ValueType.TYPE_BOOL, 'Whether the necessary information that needs to be provided by the customer is set?'],
169
+ [MODULES.service, 'Required Info of Service-Pubkey', 417, [], ValueType.TYPE_STRING, 'The public key used to encrypt customer information, and only the service provider can decrypt and view customer information.'],
170
+ [MODULES.service, 'Required Info', 418, [], ValueType.TYPE_VEC_STRING, 'Names of the required information item that needs to be provided by the customer.'],
171
+
172
+ [MODULES.order, 'Amount', 500, [], ValueType.TYPE_U64, 'Order amount.'],
173
+ [MODULES.order, 'Payer', 501, [], ValueType.TYPE_ADDRESS, 'Order payer.'],
174
+ [MODULES.order, 'Service', 502, [], ValueType.TYPE_ADDRESS, 'Service for creating orders.'],
175
+ [MODULES.order, 'Has Progress', 503, [], ValueType.TYPE_BOOL, 'Is there a Progress for executing the order process?'],
176
+ [MODULES.order, 'Progress', 504, [], ValueType.TYPE_ADDRESS, 'Progress address for executing the order process.'],
177
+ [MODULES.order, 'Required Info Counts', 505, [], ValueType.TYPE_U64, 'How much customer information is required for this order?'],
178
+ [MODULES.order, 'Discount Used', 506, [], ValueType.TYPE_BOOL, 'Discount coupon used for this order?'],
179
+ [MODULES.order, 'Discount', 507, [], ValueType.TYPE_ADDRESS, 'Discount address that already used.'],
180
+ [MODULES.order, 'Balance', 508, [], ValueType.TYPE_U64, 'The amount currently in the order.'],
181
+ [MODULES.order, 'Refunded', 509, [], ValueType.TYPE_BOOL, 'Whether a refund has occurred?'],
182
+ [MODULES.order, 'Withdrawed', 510, [], ValueType.TYPE_BOOL, 'Whether a service provider withdrawal has occurred?'],
183
+
184
+ [MODULES.reward, 'Permission', 600, [], ValueType.TYPE_ADDRESS, 'Permission object address.'],
185
+ [MODULES.reward, 'Rewards Remaining', 601, [], ValueType.TYPE_U64, 'Number of rewards to be claimed.'],
186
+ [MODULES.reward, 'Reward Count Supplied', 602, [], ValueType.TYPE_U64, 'Total rewards supplied.'],
187
+ [MODULES.reward, 'Guard Count', 603, [], ValueType.TYPE_U64, 'The number of claiming guards.'],
188
+ [MODULES.reward, 'Has Guard', 604, [ValueType.TYPE_ADDRESS], ValueType.TYPE_BOOL, 'Whether a claiming guard is set up?', 'Input:address'],
189
+ [MODULES.reward, 'Guard Portion', 605, [ValueType.TYPE_ADDRESS], ValueType.TYPE_U64, 'The portions of rewards, that can be claimed if a certain guard condition is met.', 'Input:address'],
190
+ [MODULES.reward, 'Deadline', 606, [], ValueType.TYPE_U64, 'The expiration time of claiming.'],
191
+ [MODULES.reward, 'Has Claimed by An Address', 607, [ValueType.TYPE_ADDRESS], ValueType.TYPE_BOOL, 'Whether a certain address has claimed rewards?', 'Input:address'],
192
+ [MODULES.reward, 'Portions Claimed by An Address', 608, [ValueType.TYPE_ADDRESS], ValueType.TYPE_U64, 'The portions of rewards that have been claimed by a certain address.'],
193
+ [MODULES.reward, 'Number of Addresses Claimed', 609, [], ValueType.TYPE_U64, 'Number of addresses that have claimed rewards.'],
194
+ [MODULES.reward, 'Is Sponsor', 620, [ValueType.TYPE_ADDRESS], ValueType.TYPE_BOOL, 'Whether an address is a sponsor of the reward pool?', 'Input:address'],
195
+ [MODULES.reward, 'Portions by A Sponsor', 611, [ValueType.TYPE_ADDRESS], ValueType.TYPE_U64, 'The portions of sponsorship reward pools for a certain address.', 'Input:address'],
196
+ [MODULES.reward, 'Number of Sponsors', 612, [], ValueType.TYPE_U64, 'Number of sponsors in the sponsorship reward pool.'],
197
+ [MODULES.reward, 'Allow Repeated Claims', 613, [], ValueType.TYPE_BOOL, 'Whether to allow repeated claims?'],
198
+
133
199
  // , means that data fields and data outside the consensus policy definition are allowed to be written
134
200
  // , means that only data fields and data defined by the consensus policy are allowed to be written.
135
- [MODULES.machine, 'Permission', 41, [], ValueType.TYPE_ADDRESS, 'Permission object address.'],
136
- [MODULES.machine, 'Paused', 42, [], ValueType.TYPE_BOOL, 'Pause the creation of new Progress?'],
137
- [MODULES.machine, 'Published', 43, [], ValueType.TYPE_BOOL, 'Is it allowed to create Progress?'],
138
- [MODULES.machine, 'Is Consensus Repository', 44, [ValueType.TYPE_ADDRESS], ValueType.TYPE_BOOL, 'Whether an address is a consensus repository?', 'Input:adddress'],
139
- [MODULES.machine, 'Has Endpoint', 45, [], ValueType.TYPE_BOOL, 'Is the endpoint set?'],
140
- [MODULES.machine, 'Endpoint', 46, [], ValueType.TYPE_STRING, 'Endpoint url/ipfs.'],
141
-
142
- [MODULES.progress, 'Machine', 51, [], ValueType.TYPE_ADDRESS, 'The Machine object that created this Progress.'],
143
- [MODULES.progress, 'Current Node', 52, [], ValueType.TYPE_STRING, 'The name of the currently running node.'],
144
- [MODULES.progress, 'Has Parent', 53, [], ValueType.TYPE_BOOL, 'Is the parent Progress defined?'],
145
- [MODULES.progress, 'Parent', 54, [], ValueType.TYPE_ADDRESS, 'The parent Progress, that contains some child Progress.'],
146
- [MODULES.progress, 'Has Task', 55, [], ValueType.TYPE_BOOL, 'Does it contain clear task(eg. an Order)?'],
147
- [MODULES.progress, 'Task', 56, [], ValueType.TYPE_ADDRESS, 'Task object address.'],
148
- [MODULES.progress, 'Has Unique Permission', 57, [ValueType.TYPE_STRING], ValueType.TYPE_BOOL, 'Does Progress define a unique operation permission?', 'Input:opertor name'],
149
- [MODULES.progress, 'Is Unique Permission Operator', 58, [ValueType.TYPE_STRING, ValueType.TYPE_ADDRESS], ValueType.TYPE_BOOL, 'Is an address an operator with unique permissions?', 'Input 1:operator name; Input 2:address'],
150
- [MODULES.progress, 'Has Context Repository', 59, [], ValueType.TYPE_BOOL, 'Whether the repository reference for Progress is set?'],
151
- [MODULES.progress, 'Context Repository', 60, [], ValueType.TYPE_ADDRESS, 'Repository reference for Progress.'],
152
- [MODULES.progress, 'Last Session Time', 61, [], ValueType.TYPE_U64, 'Time when the previous session was completed.'],
153
- [MODULES.progress, 'Session Time', 62, [ValueType.TYPE_STRING], ValueType.TYPE_U64, 'Time a node completes its session.', 'Input:the node name'],
154
-
155
- [MODULES.demand, 'Permission', 71, [], ValueType.TYPE_ADDRESS, 'Permission object address.'],
156
- [MODULES.demand, 'Has Deadline', 72, [], ValueType.TYPE_BOOL, 'Whether to set the expiration time of presenting?'],
157
- [MODULES.demand, 'Deadline', 73, [], ValueType.TYPE_U64, 'The expiration time of presenting.'],
158
- [MODULES.demand, 'Bounty Count', 74, [], ValueType.TYPE_U64, 'Number of Bounties.'],
159
- [MODULES.demand, 'Has Guard', 75, [], ValueType.TYPE_BOOL, 'Whether the present guard is set?'],
160
- [MODULES.demand, 'Guard', 76, [], ValueType.TYPE_ADDRESS, 'The present guard address.'],
161
- [MODULES.demand, 'Has Service Picked', 77, [], ValueType.TYPE_BOOL, 'Whether a service has been picked and bounties given?'],
162
- [MODULES.demand, 'Service Picked', 78, [], ValueType.TYPE_ADDRESS, 'Service address that has been picked.'],
163
- [MODULES.demand, 'Presenter Count', 79, [], ValueType.TYPE_U64, 'Number of presenters.'],
164
- [MODULES.demand, 'Has Presenter', 80, [ValueType.TYPE_ADDRESS], ValueType.TYPE_BOOL, 'Is a certain address a presenter?', 'Input:address'],
165
- [MODULES.demand, 'Who Got Bounty', 81, [ValueType.TYPE_ADDRESS], ValueType.TYPE_ADDRESS, 'The address that bounties given.', 'Input:address'],
166
-
167
- [MODULES.order, 'Amount', 91, [], ValueType.TYPE_U64, 'Order amount.'],
168
- [MODULES.order, 'Payer', 92, [], ValueType.TYPE_ADDRESS, 'Order payer.'],
169
- [MODULES.order, 'Service', 93, [], ValueType.TYPE_ADDRESS, 'Service for creating orders.'],
170
- [MODULES.order, 'Has Progress', 94, [], ValueType.TYPE_BOOL, 'Is there a Progress for executing the order process?'],
171
- [MODULES.order, 'Progress', 95, [], ValueType.TYPE_ADDRESS, 'Progress address for executing the order process.'],
172
- [MODULES.order, 'Required Info Counts', 96, [], ValueType.TYPE_U64, 'How much customer information is required for this order?'],
173
- [MODULES.order, 'Discount Used', 97, [], ValueType.TYPE_BOOL, 'Discount coupon used for this order?'],
174
- [MODULES.order, 'Discount', 98, [], ValueType.TYPE_ADDRESS, 'Discount address that already used.'],
175
- [MODULES.order, 'Balance', 99, [], ValueType.TYPE_U64, 'The amount currently in the order.'],
176
- [MODULES.order, 'Refunded', 100, [], ValueType.TYPE_BOOL, 'Whether a refund has occurred?'],
177
- [MODULES.order, 'Withdrawed', 101, [], ValueType.TYPE_BOOL, 'Whether a service provider withdrawal has occurred?'],
178
-
179
- [MODULES.service, 'Permission', 111, [], ValueType.TYPE_ADDRESS, 'Permission object address.'],
180
- [MODULES.service, 'Payee', 112, [], ValueType.TYPE_ADDRESS, 'Payee address, that all order withdrawals will be collected to this address.'],
181
- [MODULES.service, 'Has Buying Guard', 113, [], ValueType.TYPE_BOOL, 'Is the guard condition of buying set?'],
182
- [MODULES.service, 'Buying Guard', 114, [], ValueType.TYPE_ADDRESS, 'Buying guard, that Purchase only if you meet the conditions of the guard.'],
183
- [MODULES.service, 'Contains Repository', 115, [ValueType.TYPE_ADDRESS], ValueType.TYPE_BOOL, "Is a certain repository one of the service's consensus repositories?", 'Input:address'],
184
- [MODULES.service, 'Has Withdrawing Guard', 116, [ValueType.TYPE_ADDRESS], ValueType.TYPE_BOOL, 'Whether a certain guard is set when withdrawing money?', 'Input:address'],
185
- [MODULES.service, 'Withdrawing Guard Percent', 117, [ValueType.TYPE_ADDRESS], ValueType.TYPE_U64, 'The percentage of withdrawals allowed by a certain withdrawal guard.', 'Input:address'],
186
- [MODULES.service, 'Has Refunding Guard', 118, [ValueType.TYPE_ADDRESS], ValueType.TYPE_BOOL, 'Whether a certain guard is set when refunding money?', 'Input:address'],
187
- [MODULES.service, 'Refunding Guard Percent', 119, [ValueType.TYPE_ADDRESS], ValueType.TYPE_U64, 'The percentage of refund allowed by a certain refund guard.', 'Input:address'],
188
- [MODULES.service, 'Has Sales Item', 120, [ValueType.TYPE_STRING], ValueType.TYPE_BOOL, 'Is there a sales item for the service?', 'Input:the item name'],
189
- [MODULES.service, 'Sale Item Price', 121, [ValueType.TYPE_STRING], ValueType.TYPE_U64, 'What is the price of a certain sale item?', 'Input:the item name'],
190
- [MODULES.service, 'Sale Item Inventory', 122, [ValueType.TYPE_STRING], ValueType.TYPE_U64, 'How much inventory is there for a certain sales item?', 'Input:the item name'],
191
- [MODULES.service, 'Has Machine', 123, [], ValueType.TYPE_BOOL, "Has the machine(progress generator) that serves the order been set up?"],
192
- [MODULES.service, 'Machine', 124, [], ValueType.TYPE_ADDRESS, 'Machine address, that generate progresses serving the execution process of order.'],
193
- [MODULES.service, 'Paused', 125, [], ValueType.TYPE_BOOL, 'Pause the creation of new order?'],
194
- [MODULES.service, 'Published', 126, [], ValueType.TYPE_BOOL, 'Is it allowed to create orders?'],
195
- [MODULES.service, 'Has Required Info', 127, [], ValueType.TYPE_BOOL, 'Whether the necessary information that needs to be provided by the customer is set?'],
196
- [MODULES.service, 'Required Info of Service-Pubkey', 128, [], ValueType.TYPE_STRING, 'The public key used to encrypt customer information, and only the service provider can decrypt and view customer information.'],
197
- [MODULES.service, 'Required Info', 129, [], ValueType.TYPE_VEC_STRING, 'Names of the required information item that needs to be provided by the customer.'],
201
+ [MODULES.machine, 'Permission', 700, [], ValueType.TYPE_ADDRESS, 'Permission object address.'],
202
+ [MODULES.machine, 'Paused', 701, [], ValueType.TYPE_BOOL, 'Pause the creation of new Progress?'],
203
+ [MODULES.machine, 'Published', 702, [], ValueType.TYPE_BOOL, 'Is it allowed to create Progress?'],
204
+ [MODULES.machine, 'Is Consensus Repository', 703, [ValueType.TYPE_ADDRESS], ValueType.TYPE_BOOL, 'Whether an address is a consensus repository?', 'Input:adddress'],
205
+ [MODULES.machine, 'Has Endpoint', 704, [], ValueType.TYPE_BOOL, 'Is the endpoint set?'],
206
+ [MODULES.machine, 'Endpoint', 705, [], ValueType.TYPE_STRING, 'Endpoint url/ipfs.'],
198
207
 
199
- [MODULES.reward, 'Permission', 151, [], ValueType.TYPE_ADDRESS, 'Permission object address.'],
200
- [MODULES.reward, 'Rewards Remaining', 152, [], ValueType.TYPE_U64, 'Number of rewards to be claimed.'],
201
- [MODULES.reward, 'Reward Count Supplied', 153, [], ValueType.TYPE_U64, 'Total rewards supplied.'],
202
- [MODULES.reward, 'Guard Count', 154, [], ValueType.TYPE_U64, 'The number of claiming guards.'],
203
- [MODULES.reward, 'Has Guard', 155, [ValueType.TYPE_ADDRESS], ValueType.TYPE_BOOL, 'Whether a claiming guard is set up?', 'Input:address'],
204
- [MODULES.reward, 'Guard Portion', 156, [ValueType.TYPE_ADDRESS], ValueType.TYPE_U64, 'The portions of rewards, that can be claimed if a certain guard condition is met.', 'Input:address'],
205
- [MODULES.reward, 'Deadline', 157, [], ValueType.TYPE_U64, 'The expiration time of claiming.'],
206
- [MODULES.reward, 'Has Claimed by An Address', 158, [ValueType.TYPE_ADDRESS], ValueType.TYPE_BOOL, 'Whether a certain address has claimed rewards?', 'Input:address'],
207
- [MODULES.reward, 'Portions Claimed by An Address', 159, [ValueType.TYPE_ADDRESS], ValueType.TYPE_U64, 'The portions of rewards that have been claimed by a certain address.'],
208
- [MODULES.reward, 'Number of Addresses Claimed', 160, [], ValueType.TYPE_U64, 'Number of addresses that have claimed rewards.'],
209
- [MODULES.reward, 'Is Sponsor', 161, [ValueType.TYPE_ADDRESS], ValueType.TYPE_BOOL, 'Whether an address is a sponsor of the reward pool?', 'Input:address'],
210
- [MODULES.reward, 'Portions by A Sponsor', 162, [ValueType.TYPE_ADDRESS], ValueType.TYPE_U64, 'The portions of sponsorship reward pools for a certain address.', 'Input:address'],
211
- [MODULES.reward, 'Number of Sponsors', 163, [], ValueType.TYPE_U64, 'Number of sponsors in the sponsorship reward pool.'],
212
- [MODULES.reward, 'Allow Repeated Claims', 164, [], ValueType.TYPE_BOOL, 'Whether to allow repeated claims?'],
208
+ [MODULES.progress, 'Machine', 800, [], ValueType.TYPE_ADDRESS, 'The Machine object that created this Progress.'],
209
+ [MODULES.progress, 'Current Node', 801, [], ValueType.TYPE_STRING, 'The name of the currently running node.'],
210
+ [MODULES.progress, 'Has Parent', 802, [], ValueType.TYPE_BOOL, 'Is the parent Progress defined?'],
211
+ [MODULES.progress, 'Parent', 803, [], ValueType.TYPE_ADDRESS, 'The parent Progress, that contains some child Progress.'],
212
+ [MODULES.progress, 'Has Task', 804, [], ValueType.TYPE_BOOL, 'Does it contain clear task(eg. an Order)?'],
213
+ [MODULES.progress, 'Task', 805, [], ValueType.TYPE_ADDRESS, 'Task object address.'],
214
+ [MODULES.progress, 'Has Unique Permission', 806, [ValueType.TYPE_STRING], ValueType.TYPE_BOOL, 'Does Progress define a unique operation permission?', 'Input:opertor name'],
215
+ [MODULES.progress, 'Is Unique Permission Operator', 807, [ValueType.TYPE_STRING, ValueType.TYPE_ADDRESS], ValueType.TYPE_BOOL, 'Is an address an operator with unique permissions?', 'Input 1:operator name; Input 2:address'],
216
+ [MODULES.progress, 'Has Context Repository', 808, [], ValueType.TYPE_BOOL, 'Whether the repository reference for Progress is set?'],
217
+ [MODULES.progress, 'Context Repository', 809, [], ValueType.TYPE_ADDRESS, 'Repository reference for Progress.'],
218
+ [MODULES.progress, 'Last Session Time', 810, [], ValueType.TYPE_U64, 'Time when the previous session was completed.'],
219
+ [MODULES.progress, 'Last Session Node', 811, [], ValueType.TYPE_STRING, 'The name of the last completed node.'],
220
+ [MODULES.progress, 'Current Session-id', 812, [], ValueType.TYPE_U64, 'The session id of ongoing node.'],
221
+ [MODULES.progress, 'Parent Session-id', 813, [], ValueType.TYPE_U64, 'The child process was started in the Session-id phase of the parent process.'],
222
+ [MODULES.progress, 'Parent Next Node', 814, [], ValueType.TYPE_STRING, 'The child process is started at the next node stage of the parent process.'],
223
+ [MODULES.progress, 'Parent Forward', 815, [], ValueType.TYPE_STRING, 'The child process is started in the Forward phase of the next node of the parent process.'],
224
+ [MODULES.progress, 'Parent Node', 816, [], ValueType.TYPE_STRING, 'The node name of the parent process where the child process is located.'],
225
+ [MODULES.progress, 'Forward Accomplished', 817, [ValueType.TYPE_U64, ValueType.TYPE_STRING, ValueType.TYPE_STRING], ValueType.TYPE_BOOL, 'Has a forward been accomplished?', 'Input 1:session-id; Input 2:next node name; Input 3:forward name'],
226
+ [MODULES.progress, 'Forward Operator', 818, [ValueType.TYPE_U64, ValueType.TYPE_STRING, ValueType.TYPE_STRING], ValueType.TYPE_ADDRESS, 'The forward operator.', 'Input 1:session-id; Input 2:next node name; Input 3:forward name'],
227
+ [MODULES.progress, 'Forward Sub-progress', 819, [ValueType.TYPE_U64, ValueType.TYPE_STRING, ValueType.TYPE_STRING], ValueType.TYPE_ADDRESS, 'The forward child process address(if set).', 'Input 1:session-id; Input 2:next node name; Input 3:forward name'],
228
+ [MODULES.progress, 'Forward Deliverables', 820, [ValueType.TYPE_U64, ValueType.TYPE_STRING, ValueType.TYPE_STRING], ValueType.TYPE_ADDRESS, 'The forward deliverable(if set).', 'Input 1:session-id; Input 2:next node name; Input 3:forward name'],
229
+ [MODULES.progress, 'Forward time', 821, [ValueType.TYPE_U64, ValueType.TYPE_STRING, ValueType.TYPE_STRING], ValueType.TYPE_U64, 'The time when the forward was last triggered.', 'Input 1:session-id; Input 2:next node name; Input 3:forward name'],
230
+ [MODULES.progress, 'Closest Session Time', 822, [ValueType.TYPE_STRING], ValueType.TYPE_U64, 'The time a node that closest time to the current node completes its session.', 'Input:the node name'],
231
+ [MODULES.progress, 'Closest Forward Accomplished', 823, [ValueType.TYPE_STRING, ValueType.TYPE_STRING, ValueType.TYPE_STRING], ValueType.TYPE_BOOL, 'Has a forward been accomplished?', 'Input 1:node name; Input 2:next node name; Input 3:forward name'],
232
+ [MODULES.progress, 'Closest Forward Operator', 824, [ValueType.TYPE_STRING, ValueType.TYPE_STRING, ValueType.TYPE_STRING], ValueType.TYPE_ADDRESS, 'The operator of the forward that closest time to the current node.', 'Input 1:node name; Input 2:next node name; Input 3:forward name'],
233
+ [MODULES.progress, 'Closest Forward Sub-progress', 825, [ValueType.TYPE_STRING, ValueType.TYPE_STRING, ValueType.TYPE_STRING], ValueType.TYPE_ADDRESS, 'The child process address(if set) of the forward that closest time to the current node.', 'Input 1:node name; Input 2:next node name; Input 3:forward name'],
234
+ [MODULES.progress, 'Closest Forward Deliverables', 826, [ValueType.TYPE_STRING, ValueType.TYPE_STRING, ValueType.TYPE_STRING], ValueType.TYPE_ADDRESS, 'The deliverable(if set) of the forward that closest time to the current node.', 'Input 1:node name; Input 2:next node name; Input 3:forward name'],
235
+ [MODULES.progress, 'Closest Forward time', 827, [ValueType.TYPE_STRING, ValueType.TYPE_STRING, ValueType.TYPE_STRING], ValueType.TYPE_U64, 'The time when the forward that closest time to the current node was last triggered.', 'Input 1:node name; Input 2:next node name; Input 3:forward name'],
236
+
237
+ [MODULES.wowok, 'Builder', 900, [], ValueType.TYPE_ADDRESS, 'Builder address of Wowok.'],
238
+ [MODULES.wowok, 'Everyone Guard', 901, [], ValueType.TYPE_ADDRESS, 'A guard that all addresses can pass through.'],
239
+ [MODULES.wowok, 'Object of Entities', 902, [], ValueType.TYPE_ADDRESS, 'The address of entity information object.'],
240
+ [MODULES.wowok, 'Grantor Count', 903, [], ValueType.TYPE_U64, 'Number of registered grantors.'],
241
+ [MODULES.wowok, 'Has Grantor', 904, [ValueType.TYPE_ADDRESS], ValueType.TYPE_BOOL, 'Whether an address has been registered as a grantor?', , 'Input:address'],
242
+ [MODULES.wowok, 'Grantor Name', 905, [ValueType.TYPE_ADDRESS], ValueType.TYPE_STRING, "Name of a grantor.", 'Input:address'],
243
+ [MODULES.wowok, 'Grantor Registration Time', 906, [ValueType.TYPE_ADDRESS], ValueType.TYPE_U64, 'Registration time of a grantor.', 'Input:address'],
244
+ [MODULES.wowok, 'Grantor Expired Time', 907, [ValueType.TYPE_ADDRESS], ValueType.TYPE_U64, 'The expiration time of a grantor.', 'Input:address'],
245
+ [MODULES.wowok, 'Grantee Object for Grantor', 908, [ValueType.TYPE_ADDRESS], ValueType.TYPE_ADDRESS, 'Grantee repository address of a grantor.', 'Input:address'],
213
246
 
214
- /* [MODULES.vote, 'Permission', 171, [], ValueType.TYPE_ADDRESS],
247
+
248
+ /* [MODULES.vote, 'Permission', 171, [], ValueType.TYPE_ADDRESS],
215
249
  [MODULES.vote, 'Options Locked', 172, [], ValueType.TYPE_BOOL],
216
250
  [MODULES.vote, 'Deadline Locked', 173, [], ValueType.TYPE_BOOL],
217
251
  [MODULES.vote, 'Vote-Guard Locked', 174, [], ValueType.TYPE_BOOL],
@@ -233,23 +267,6 @@ export class Guard {
233
267
  [MODULES.vote, 'Top1 Count by Addresses', 190, [], ValueType.TYPE_U64],
234
268
  [MODULES.vote, 'Top1 Option by Votes', 191, [], ValueType.TYPE_STRING],
235
269
  [MODULES.vote, 'Top1 Count by Votes', 192, [], ValueType.TYPE_U64], */
236
-
237
- [MODULES.wowok, 'Builder', 210, [], ValueType.TYPE_ADDRESS, 'Builder address of Wowok.'],
238
- [MODULES.wowok, 'Everyone Guard', 211, [], ValueType.TYPE_ADDRESS, 'A guard that all addresses can pass through.'],
239
- [MODULES.wowok, 'Object of Entities', 212, [], ValueType.TYPE_ADDRESS, 'The address of entity information object.'],
240
- [MODULES.wowok, 'Grantor Count', 213, [], ValueType.TYPE_U64, 'Number of registered grantors.'],
241
- [MODULES.wowok, 'Has Grantor', 214, [ValueType.TYPE_ADDRESS], ValueType.TYPE_BOOL, 'Whether an address has been registered as a grantor?', , 'Input:address'],
242
- [MODULES.wowok, 'Grantor Name', 215, [ValueType.TYPE_ADDRESS], ValueType.TYPE_STRING, "Name of a grantor.", 'Input:address'],
243
- [MODULES.wowok, 'Grantor Registration Time', 216, [ValueType.TYPE_ADDRESS], ValueType.TYPE_U64, 'Registration time of a grantor.', 'Input:address'],
244
- [MODULES.wowok, 'Grantor Expired Time', 217, [ValueType.TYPE_ADDRESS], ValueType.TYPE_U64, 'The expiration time of a grantor.', 'Input:address'],
245
- [MODULES.wowok, 'Grantee Object for Grantor', 218, [ValueType.TYPE_ADDRESS], ValueType.TYPE_ADDRESS, 'Grantee repository address of a grantor.', 'Input:address'],
246
-
247
- [MODULES.entity, 'Contains Entity?', 230, [ValueType.TYPE_ADDRESS], ValueType.TYPE_BOOL, 'Is an entity already registered?', 'Input:address'],
248
- [MODULES.entity, 'Likes', 231, [ValueType.TYPE_ADDRESS], ValueType.TYPE_U64, 'The number of likes for an address by other addresses.', 'Input:address'],
249
- [MODULES.entity, 'Dislikes', 232, [ValueType.TYPE_ADDRESS], ValueType.TYPE_U64, 'The number of dislikes for an address by other addresses.', 'Input:address'],
250
- [MODULES.entity, 'Entity Info', 233, [ValueType.TYPE_ADDRESS], ValueType.TYPE_VEC_U8, 'Public information about an entity.', 'Input:address'],
251
- [MODULES.entity, 'Has Resource by Entity?', 234, [ValueType.TYPE_ADDRESS], ValueType.TYPE_BOOL, 'Whether an entity created a resource?', 'Input:address'],
252
- [MODULES.entity, 'Entity Resource', 235, [ValueType.TYPE_ADDRESS], ValueType.TYPE_ADDRESS, 'The address of a resource object created by an entity.', 'Input:address'],
253
270
  ];
254
271
 
255
272
  static BoolCmd = Guard.QUERIES.filter(q => q[4] === ValueType.TYPE_BOOL);
@@ -422,10 +439,10 @@ export class GuardMaker {
422
439
  protected type_validator : Data_Type[] = [];
423
440
  protected constant : GuardConstant = new Map<number, Guard_Variable>();
424
441
 
425
- private static index: number = 0;
442
+ private static index: number = 1;
426
443
  private static get_index() {
427
444
  if (GuardMaker.index == 256) {
428
- GuardMaker.index = 0;
445
+ GuardMaker.index = 1;
429
446
  }
430
447
  return GuardMaker.index++
431
448
  }
@@ -455,7 +472,6 @@ export class GuardMaker {
455
472
  // serialize const & data
456
473
  add_param(type:ValueType | ContextType, param?:any) : GuardMaker {
457
474
  const e = SER_VALUE.find((v:any)=>v.type===type)?.name ?? '' + ' invalid';
458
-
459
475
  switch(type) {
460
476
  case ValueType.TYPE_ADDRESS:
461
477
  case ValueType.TYPE_BOOL:
@@ -502,7 +518,7 @@ export class GuardMaker {
502
518
  this.data.push(Bcs.getInstance().ser(ValueType.TYPE_ADDRESS, param));
503
519
  this.type_validator.push(ValueType.TYPE_ADDRESS);
504
520
  break;
505
- case ContextType.TYPE_CONSTANT:
521
+ case ContextType.TYPE_CONSTANT:
506
522
  if (!param) {
507
523
  ERROR(Errors.InvalidParam, 'param invalid:'+e);
508
524
  }
@@ -512,9 +528,13 @@ export class GuardMaker {
512
528
 
513
529
  var v = this.constant.get(param);
514
530
  if (!v) ERROR(Errors.Fail, 'identifier not in constant:'+e);
515
- this.type_validator.push(v!.type);
516
- this.data.push(Bcs.getInstance().ser(ValueType.TYPE_U8, type));
517
- this.data.push(Bcs.getInstance().ser(ValueType.TYPE_U8, param));
531
+ var t = v!.type;
532
+ if (v?.type === ContextType.TYPE_WITNESS_ID) {
533
+ t = ValueType.TYPE_ADDRESS;
534
+ }
535
+ this.type_validator.push(t); //@ type validator convert
536
+ this.data.push(Bcs.getInstance().ser(ValueType.TYPE_U8, type)); // constant flag
537
+ this.data.push(Bcs.getInstance().ser(ValueType.TYPE_U8, param)); // identifier
518
538
  break;
519
539
  default:
520
540
  ERROR(Errors.InvalidParam, 'add_param type:'+e);
@@ -565,13 +585,13 @@ export class GuardMaker {
565
585
  }
566
586
  }
567
587
 
568
- this.data.push(Bcs.getInstance().ser(ValueType.TYPE_U8, Guard.QUERIES[query_index][2])); // cmd
588
+ this.data.push(Bcs.getInstance().ser('u16', Guard.QUERIES[query_index][2])); // cmd(u16)
569
589
  this.type_validator.splice(offset, Guard.QUERIES[query_index][3].length); // delete type stack
570
590
  this.type_validator.push(Guard.QUERIES[query_index][4]); // add the return value type to type stack
571
591
  return this;
572
592
  }
573
593
 
574
- add_logic(type:OperatorType, param:number=2) : GuardMaker {
594
+ add_logic(type:OperatorType, logic_count:number=2) : GuardMaker {
575
595
  var e:any = LogicsInfo.find((v:any) => v[0] === type);
576
596
  if (e) { e=e[1] }
577
597
 
@@ -612,8 +632,8 @@ export class GuardMaker {
612
632
  break;
613
633
  case OperatorType.TYPE_LOGIC_AND:
614
634
  case OperatorType.TYPE_LOGIC_OR: //@ logics count
615
- if (!param || param < 2) ERROR(Errors.Fail, 'logic param invalid:'+e);
616
- splice_len = param!;
635
+ if (!logic_count || logic_count < 2) ERROR(Errors.Fail, 'logic param invalid:'+e);
636
+ splice_len = logic_count!;
617
637
  if (this.type_validator.length < splice_len) { ERROR(Errors.Fail, 'type_validator.length:'+e) }
618
638
  for (let i = 1; i <= splice_len; ++i) {
619
639
  if (this.type_validator[this.type_validator.length -i] != ValueType.TYPE_BOOL) { ERROR(Errors.Fail, 'type_validator check:'+e) }
@@ -637,7 +657,7 @@ export class GuardMaker {
637
657
 
638
658
  this.data.push(Bcs.getInstance().ser(ValueType.TYPE_U8, type)); // TYPE
639
659
  if (type === OperatorType.TYPE_LOGIC_AND || type === OperatorType.TYPE_LOGIC_OR) {
640
- this.data.push((Bcs.getInstance().ser(ValueType.TYPE_U8, param))); //@ logics
660
+ this.data.push((Bcs.getInstance().ser(ValueType.TYPE_U8, logic_count))); //@ logics
641
661
  }
642
662
  this.type_validator.splice(this.type_validator.length - splice_len); // delete type stack
643
663
  this.type_validator.push(ret); // add bool to type stack
@@ -683,7 +703,7 @@ export class GuardMaker {
683
703
  maker.constant.set(k, {type:v.type, value:v.value, witness:v.witness});
684
704
  })
685
705
  let op = bAnd ? OperatorType.TYPE_LOGIC_AND : OperatorType.TYPE_LOGIC_OR;
686
- maker.data.push(concatenate(Uint8Array, ...this.data, ...otherBuilt.data, Bcs.getInstance().ser(ValueType.TYPE_U8, 2), Bcs.getInstance().ser(ValueType.TYPE_U8, op)));
706
+ maker.data.push(concatenate(Uint8Array, ...this.data, ...otherBuilt.data, Bcs.getInstance().ser(ValueType.TYPE_U8, op), Bcs.getInstance().ser(ValueType.TYPE_U8, 2)));
687
707
  this.data.splice(0, this.data.length-1);
688
708
  maker.type_validator = this.type_validator;
689
709
  return maker
@@ -695,7 +715,7 @@ export class GuardMaker {
695
715
  // and/or + logics count
696
716
  static input_combine(input1:Uint8Array, input2:Uint8Array, bAnd:boolean = true) : Uint8Array {
697
717
  let op = bAnd ? OperatorType.TYPE_LOGIC_AND : OperatorType.TYPE_LOGIC_OR;
698
- return concatenate(Uint8Array, input1, input2, Bcs.getInstance().ser(ValueType.TYPE_U8, 2), Bcs.getInstance().ser(ValueType.TYPE_U8, op)) as Uint8Array;
718
+ return concatenate(Uint8Array, input1, input2, Bcs.getInstance().ser(ValueType.TYPE_U8, op), Bcs.getInstance().ser(ValueType.TYPE_U8, 2), ) as Uint8Array;
699
719
  }
700
720
  static input_not(input:Uint8Array) : Uint8Array {
701
721
  return concatenate(Uint8Array, input, Bcs.getInstance().ser(ValueType.TYPE_U8, OperatorType.TYPE_LOGIC_NOT)) as Uint8Array;
package/src/passport.ts CHANGED
@@ -210,7 +210,7 @@ export class GuardParser {
210
210
  let addr = '0x' + Bcs.getInstance().de(ValueType.TYPE_ADDRESS, Uint8Array.from(arr)).toString();
211
211
  arr.splice(0, 32); // address
212
212
  value = addr;
213
- cmd = arr.shift()! as number; // cmd
213
+ cmd = Bcs.getInstance().de('u16', Uint8Array.from(arr.splice(0, 2))) as number; // cmd(u16)
214
214
  } else if (t[0] == ContextType.TYPE_CONSTANT) {
215
215
  let id = arr.splice(0, 1); // key
216
216
  let v = constants.find((v) =>
@@ -218,7 +218,7 @@ export class GuardParser {
218
218
  ((v.type == ValueType.TYPE_ADDRESS) || (v.type == ContextType.TYPE_WITNESS_ID)));
219
219
  if (!v) { ERROR(Errors.Fail, 'GuardObject: indentifier not in constant')}
220
220
  identifier = id[0];
221
- cmd = arr.shift()! as number; // cmd
221
+ cmd = Bcs.getInstance().de('u16', Uint8Array.from(arr.splice(0, 2))) as number; // cmd(u16)
222
222
  } else {
223
223
  ERROR(Errors.Fail, 'GuardObject: constant type invalid');
224
224
  }
@@ -258,7 +258,7 @@ export class GuardParser {
258
258
  value = read.value;
259
259
  break;
260
260
  default:
261
- ERROR(Errors.Fail, 'GuardObject: parse_bcs types')
261
+ ERROR(Errors.Fail, 'GuardObject: parse_bcs types ' + type)
262
262
  }
263
263
  data.push({type:type as number, value:value, cmd:cmd, identifier:identifier, child:[]});
264
264
  }
@@ -611,14 +611,15 @@ export class GuardParser {
611
611
  let type = arr.splice(0, 1);
612
612
  if (type[0] == ValueType.TYPE_ADDRESS || type[0] == ContextType.TYPE_WITNESS_ID) {
613
613
  let addr = '0x' + Bcs.getInstance().de(ValueType.TYPE_ADDRESS, Uint8Array.from(arr)).toString();
614
- const offset = arr.splice(0, 33); // address + cmd
614
+ const offset = arr.splice(0, 34); // address + cmd(U16)
615
615
  if (type[0] == ValueType.TYPE_ADDRESS) {
616
616
  info.query_list.push(addr);
617
617
  } else if (type[0] == ContextType.TYPE_WITNESS_ID){
618
618
  info.query_list.push({index:this.get_index(), type:type[0], value_or_witness:addr, cmd:offset[offset.length-1]});
619
619
  }
620
620
  } else if (type[0] == ContextType.TYPE_CONSTANT) {
621
- const identifer = arr.splice(0, 2); // key + cmd
621
+ const identifer = arr.splice(0, 1); // key
622
+ const cmd:number = Bcs.getInstance().de('u16', Uint8Array.from(arr.splice(0, 2)));
622
623
  let constant = info.constant.find((v) =>
623
624
  (v.identifier == identifer[0]) &&
624
625
  ((v.type == ValueType.TYPE_ADDRESS) || (v.type == ContextType.TYPE_WITNESS_ID)));
@@ -628,17 +629,17 @@ export class GuardParser {
628
629
  } else if (constant?.type == ContextType.TYPE_WITNESS_ID) {
629
630
  const index = this.get_index();
630
631
  info.query_list.push({identifier:identifer[0], type:constant.type, value_or_witness:constant.value_or_witness,
631
- index:index, cmd:identifer[identifer.length-1]}); // query witness in constant
632
- constant.cmd = identifer[identifer.length-1]; // mark this is a cmd in querylist(avoid multi input future by singer)
632
+ index:index, cmd:cmd}); // query witness in constant
633
+ constant.cmd = cmd; // mark this is a cmd in querylist(avoid multi input future by singer)
633
634
  constant.index = index;
634
635
  }
635
636
  } else {
636
- ERROR(Errors.Fail, 'constant type invalid');
637
+ ERROR(Errors.Fail, 'constant type invalid ' + type);
637
638
  }
638
639
 
639
640
  break;
640
641
  default:
641
- ERROR(Errors.Fail, 'parse_bcs types')
642
+ ERROR(Errors.Fail, 'parse_bcs types ' + arr)
642
643
  }
643
644
  }
644
645
  }
@@ -765,6 +766,7 @@ export class Passport {
765
766
  });
766
767
  })
767
768
 
769
+ console.log(query)
768
770
  // witness
769
771
  query?.witness.forEach((w) => {
770
772
  this.txb.moveCall({
package/src/permission.ts CHANGED
@@ -273,7 +273,7 @@ export class Permission {
273
273
  ERROR(Errors.IsValidArray, 'add_entity2');
274
274
  }
275
275
 
276
- if (index) {
276
+ if (index !== undefined) {
277
277
  this.txb.moveCall({
278
278
  target:Protocol.Instance().PermissionFn('add_with_index') as FnCallType,
279
279
  arguments:[Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.u64(index),
@@ -288,9 +288,7 @@ export class Permission {
288
288
  }
289
289
 
290
290
  add_entity(entities:Permission_Entity[]) {
291
- if (!entities) {
292
- ERROR(Errors.InvalidParam, 'add_entity');
293
- }
291
+ if (entities.length === 0) return
294
292
 
295
293
  let bValid = true;
296
294
  let e = entities.forEach((v) => {
@@ -322,13 +320,14 @@ export class Permission {
322
320
  }
323
321
  }
324
322
  }
325
- //if (indexes.length > 0) {
323
+
324
+ if (indexes.length > 0) {
326
325
  this.txb.moveCall({
327
326
  target:Protocol.Instance().PermissionFn('add_batch') as FnCallType,
328
327
  arguments:[Protocol.TXB_OBJECT(this.txb, this.object), this.txb.pure.address(entity.entity_address),
329
328
  this.txb.pure.vector('u64', indexes)]
330
329
  })
331
- //}
330
+ }
332
331
  }
333
332
  // set guards
334
333
  guards.forEach(({entity_address, index, guard}) => {
@@ -368,7 +367,8 @@ export class Permission {
368
367
  if (!IsValidAddress(entity_address)) {
369
368
  ERROR(Errors.IsValidAddress)
370
369
  }
371
- if (!index || !(IsValidArray(index, Permission.IsValidPermissionIndex))) {
370
+ if (index.length === 0) return ;
371
+ if (!(IsValidArray(index, Permission.IsValidPermissionIndex))) {
372
372
  ERROR(Errors.InvalidParam, 'index')
373
373
  }
374
374
 
@@ -379,7 +379,8 @@ export class Permission {
379
379
  })
380
380
  }
381
381
  remove_entity(entity_address:string[]) {
382
- if (!entity_address || !IsValidArray(entity_address, IsValidAddress)) {
382
+ if (entity_address.length === 0) return ;
383
+ if (!IsValidArray(entity_address, IsValidAddress)) {
383
384
  ERROR(Errors.IsValidArray)
384
385
  }
385
386
 
package/src/progress.ts CHANGED
@@ -188,24 +188,25 @@ export class Progress {
188
188
  }
189
189
  }
190
190
  unhold(next:ProgressNext, passport?:PassportObject) {
191
- console.log(next)
192
191
  if (!Progress.IsValidProgressNext(next)) {
193
192
  ERROR(Errors.InvalidParam, 'unhold')
194
193
  }
195
194
 
195
+ const clock = this.txb.sharedObjectRef(Protocol.CLOCK_OBJECT);
196
+
196
197
  if (passport) {
197
198
  this.txb.moveCall({
198
199
  target:Protocol.Instance().ProgressFn('unhold_with_passport') as FnCallType,
199
200
  arguments: [passport, Protocol.TXB_OBJECT(this.txb, this.object),
200
201
  Protocol.TXB_OBJECT(this.txb, this.machine), this.txb.pure.string(next.next_node_name),
201
- this.txb.pure.string(next.forward), Protocol.TXB_OBJECT(this.txb, this.permission)],
202
+ this.txb.pure.string(next.forward), Protocol.TXB_OBJECT(this.txb, this.permission), this.txb.object(clock)],
202
203
  })
203
204
  } else {
204
205
  this.txb.moveCall({
205
206
  target:Protocol.Instance().ProgressFn('unhold') as FnCallType,
206
207
  arguments: [Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, this.machine),
207
208
  this.txb.pure.string(next.next_node_name), this.txb.pure.string(next.forward),
208
- Protocol.TXB_OBJECT(this.txb, this.permission)],
209
+ Protocol.TXB_OBJECT(this.txb, this.permission), this.txb.object(clock)],
209
210
  })
210
211
  }
211
212
  }
@@ -237,7 +238,7 @@ export class Progress {
237
238
  this.txb.moveCall({
238
239
  target:Protocol.Instance().ProgressFn('parent_set_with_passport') as FnCallType,
239
240
  arguments: [passport, Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, this.machine),
240
- this.txb.pure.address(parent.parent_id),
241
+ this.txb.object(parent.parent_id),
241
242
  this.txb.pure.u64(parent.parent_session_id),
242
243
  this.txb.pure.string(parent.next_node),
243
244
  this.txb.pure.string(parent.forward),
@@ -247,7 +248,7 @@ export class Progress {
247
248
  this.txb.moveCall({
248
249
  target:Protocol.Instance().ProgressFn('parent_set') as FnCallType,
249
250
  arguments: [Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, this.machine),
250
- this.txb.pure.address(parent.parent_id),
251
+ this.txb.object(parent.parent_id),
251
252
  this.txb.pure.u64(parent.parent_session_id),
252
253
  this.txb.pure.string(parent.next_node),
253
254
  this.txb.pure.string(parent.forward),
@@ -257,7 +258,6 @@ export class Progress {
257
258
  }
258
259
 
259
260
  next(next:ProgressNext, deliverables_address?:string, sub_id?:string, passport?:PassportObject) {
260
- console.log(next)
261
261
  if (!Progress.IsValidProgressNext(next)) {
262
262
  ERROR(Errors.InvalidParam, 'next')
263
263
  }
@@ -293,11 +293,11 @@ export class Progress {
293
293
  if (!Progress.IsValidProgressNext(next)) {
294
294
  ERROR(Errors.InvalidParam, 'hold')
295
295
  }
296
-
296
+ const clock = this.txb.sharedObjectRef(Protocol.CLOCK_OBJECT);
297
297
  this.txb.moveCall({
298
298
  target:Protocol.Instance().ProgressFn('hold') as FnCallType,
299
299
  arguments: [Protocol.TXB_OBJECT(this.txb, this.object), Protocol.TXB_OBJECT(this.txb, this.machine), this.txb.pure.string(next.next_node_name),
300
- this.txb.pure.string(next.forward), this.txb.pure.bool(hold), Protocol.TXB_OBJECT(this.txb, this.permission)],
300
+ this.txb.pure.string(next.forward), this.txb.pure.bool(hold), Protocol.TXB_OBJECT(this.txb, this.permission), this.txb.object(clock)],
301
301
  })
302
302
  }
303
303
 
package/src/protocol.ts CHANGED
@@ -165,7 +165,7 @@ interface ValueTypeString {
165
165
  export const SER_VALUE: ValueTypeString[] = [
166
166
  {type: ValueType.TYPE_BOOL, name: 'bool', description:'boolean. eg:true or false', validator:(value:any) => { return (value === true || value === false)}},
167
167
  {type: ValueType.TYPE_ADDRESS, name: 'address', description:'address or object-id. eg:0x6789af', validator:IsValidAddress},
168
- {type: ContextType.TYPE_WITNESS_ID, name: 'future address', description:"eg: address of the Machine that will generate future Progress, address of the Service that will generate future Order", 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
169
  {type: ContextType.TYPE_SIGNER, name: 'txn signer', description:"signer address of the transaction, "},
170
170
  {type: ContextType.TYPE_CLOCK, name: 'txn time', description:"unsigned-64 number for the transaction time"},
171
171
  {type: ValueType.TYPE_U64, name: 'number', description:'unsigned-64 number. eg:23870233', validator:IsValidU64},
@@ -208,10 +208,10 @@ const TESTNET = {
208
208
  }
209
209
  */
210
210
  const TESTNET = {
211
- package: "0x4ce36e03ef9cd230f1158e48293ee01cb572cdcd2f9cab7ac7b2fd2251bfe51e",
212
- wowok_object: '0xd3639daf1daa300bbf694b21e42cecac6be242ad038fe48a7a1212e93f3845f6',
213
- entity_object: '0x8de1e01e6baca0990ca18de3ec51b57183512deaeb76076be9161ca38988c74f',
214
- treasury_cap:'0x2e05eda6ee5b0773854be6eb48c6cee2b5ca8aaa13ee810434d66232005b40ef',
211
+ package: "0x46e9a55686124138132d83098a1ae0b9d63d91e93d96d636c47b5e6f7f00a3d4",
212
+ wowok_object: '0xa78e02dd7d537ddeab3a33bb9b40df4663f58b4e835dfa5dc430f5ae4e71b4fe',
213
+ entity_object: '0x487524f61ed9dd3f4a02ae7311b2879f3b0ebeef1a9a4cd36f291dcd351e8e56',
214
+ treasury_cap:'0xf5ecc294e9e5524c55a5775c7fb3e8aa8e7d4b6bb4fc2f91712f8610d02e0287',
215
215
  }
216
216
  const MAINNET = {
217
217
  package: "",
package/src/service.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { IsValidArray, IsValidPercent, IsValidName_AllowEmpty, Bcs, array_unique, IsValidTokenType, IsValidDesription,
2
- IsValidAddress, IsValidEndpoint, IsValidU64, IsValidName,} from './utils'
2
+ IsValidAddress, IsValidEndpoint, IsValidU64, } from './utils'
3
3
  import { FnCallType, GuardObject, PassportObject, PermissionObject, RepositoryObject, MachineObject, ServiceAddress,
4
4
  ServiceObject, DiscountObject, OrderObject, OrderAddress, CoinObject, Protocol, ValueType,
5
5
  TxbObject} from './protocol';
@@ -155,10 +155,11 @@ export class Service {
155
155
  }
156
156
  set_price(item:string, price:bigint, bNotFoundAssert:boolean=true, passport?:PassportObject) {
157
157
  if (!IsValidU64(price)) {
158
- ERROR(Errors.IsValidU64, 'price')
158
+ ERROR(Errors.IsValidU64, 'set_price price')
159
159
  }
160
- if (!IsValidName(item)) {
161
- ERROR(Errors.IsValidName, 'item')
160
+
161
+ if (!Service.IsValidItemName(item)) {
162
+ ERROR(Errors.IsValidServiceItemName, 'set_price item')
162
163
  }
163
164
 
164
165
  if (passport) {
@@ -180,8 +181,8 @@ export class Service {
180
181
  }
181
182
  }
182
183
  set_stock(item:string, stock:bigint, bNotFoundAssert:boolean=true, passport?:PassportObject) {
183
- if (!IsValidName(item)) {
184
- ERROR(Errors.IsValidName, 'item')
184
+ if (!Service.IsValidItemName(item)) {
185
+ ERROR(Errors.IsValidServiceItemName, 'item')
185
186
  }
186
187
  if (!IsValidU64(stock)) {
187
188
  ERROR(Errors.IsValidU64, 'stock')
@@ -206,11 +207,11 @@ export class Service {
206
207
  }
207
208
  }
208
209
  add_stock(item:string, stock_add:bigint, bNotFoundAssert:boolean=true, passport?:PassportObject) {
209
- if (!IsValidName(item)) {
210
- ERROR(Errors.IsValidName, 'item')
210
+ if (!Service.IsValidItemName(item)) {
211
+ ERROR(Errors.IsValidServiceItemName, 'add_stock item')
211
212
  }
212
213
  if (!IsValidU64(stock_add)) {
213
- ERROR(Errors.IsValidUint, 'stock_add')
214
+ ERROR(Errors.IsValidUint, 'add_stock stock_add')
214
215
  }
215
216
 
216
217
  if (passport) {
@@ -232,11 +233,11 @@ export class Service {
232
233
  }
233
234
  }
234
235
  reduce_stock(item:string, stock_reduce:bigint, bNotFoundAssert:boolean=true, passport?:PassportObject) {
235
- if (!IsValidName(item)) {
236
- ERROR(Errors.IsValidName, 'item')
236
+ if (!Service.IsValidItemName(item)) {
237
+ ERROR(Errors.IsValidServiceItemName, 'reduce_stock item')
237
238
  }
238
239
  if (!IsValidU64(stock_reduce)) {
239
- ERROR(Errors.IsValidUint, 'stock_reduce')
240
+ ERROR(Errors.IsValidUint, 'reduce_stock stock_reduce')
240
241
  }
241
242
 
242
243
  if (passport) {
@@ -259,11 +260,11 @@ export class Service {
259
260
  }
260
261
 
261
262
  set_sale_endpoint(item:string, endpoint?:string|null, bNotFoundAssert:boolean=true, passport?:PassportObject) {
262
- if (!IsValidName(item)) {
263
- ERROR(Errors.IsValidName, 'set_sale_endpoint')
263
+ if (!Service.IsValidItemName(item)) {
264
+ ERROR(Errors.IsValidServiceItemName, 'set_sale_endpoint item')
264
265
  }
265
266
  if (endpoint && !IsValidEndpoint(endpoint)) {
266
- ERROR(Errors.IsValidEndpoint, 'set_sale_endpoint')
267
+ ERROR(Errors.IsValidEndpoint, 'set_sale_endpoint endpoint')
267
268
  }
268
269
 
269
270
  let ep = this.txb.pure.option('string', endpoint ? endpoint : undefined);
@@ -505,7 +506,7 @@ export class Service {
505
506
  is_valid_sale(sales:Service_Sale[]) {
506
507
  let bValid = true; let names:string[] = [];
507
508
  sales.forEach((v) => {
508
- if (!IsValidName(v.item)) bValid = false;
509
+ if (!Service.IsValidItemName(v.item)) bValid = false;
509
510
  if (!IsValidU64(v.price)) bValid = false;
510
511
  if (!IsValidU64(v.stock)) bValid = false;
511
512
  if (names.includes(v.item)) bValid = false;
@@ -555,7 +556,7 @@ export class Service {
555
556
  remove_sales(sales:string[], passport?:PassportObject) {
556
557
  if (sales.length === 0) return;
557
558
 
558
- if (!IsValidArray(sales, IsValidName)) {
559
+ if (!IsValidArray(sales, Service.IsValidItemName)) {
559
560
  ERROR(Errors.IsValidArray, 'remove_sales')
560
561
  }
561
562
 
@@ -913,7 +914,7 @@ export class Service {
913
914
 
914
915
  let bValid = true; let names:string[] = [];
915
916
  buy_items.forEach((v) => {
916
- if (!IsValidName(v.item)) bValid = false;
917
+ if (!Service.IsValidItemName(v.item)) bValid = false;
917
918
  if (!IsValidU64(v.max_price)) bValid = false;
918
919
  if (!IsValidU64(v.count)) bValid = false;
919
920
  if (names.includes(v.item)) bValid = false;
@@ -1010,8 +1011,14 @@ export class Service {
1010
1011
  static MAX_DISCOUNT_COUNT_ONCE = 200;
1011
1012
  static MAX_DISCOUNT_RECEIVER_COUNT = 20;
1012
1013
  static MAX_GUARD_COUNT = 16;
1013
- static MAX_REPOSITORY_COUNT = 16;
1014
-
1014
+ static MAX_REPOSITORY_COUNT = 32;
1015
+ static MAX_ITEM_NAME_LENGTH = 256;
1016
+
1017
+ static IsValidItemName(name:string) : boolean {
1018
+ if (!name) return false;
1019
+ return new TextEncoder().encode(name).length <= Service.MAX_ITEM_NAME_LENGTH;
1020
+ }
1021
+
1015
1022
  static parseObjectType = (chain_type:string | undefined | null) : string => {
1016
1023
  if (chain_type) {
1017
1024
  const s = 'service::Service<'
package/src/utils.ts CHANGED
@@ -120,7 +120,6 @@ export const concatenate = (resultConstructor:any, ...arrays:any[]) => {
120
120
  }
121
121
 
122
122
  export const array_equal = (arr1: any[], arr2: any[]) => {
123
- // Array.some(): 有一项不满足,返回false
124
123
  if (arr1.length !== arr2.length) {
125
124
  return false;
126
125
  }