@wowok/agent-mcp 3.2.0 → 3.2.2

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.
Files changed (205) hide show
  1. package/dist/communication/wts-attestation.d.ts +34 -0
  2. package/dist/communication/wts-attestation.js +1 -0
  3. package/dist/config/exposure.d.ts +8 -8
  4. package/dist/config/judgment.d.ts +45 -20
  5. package/dist/config/rule-engine.d.ts +30 -20
  6. package/dist/config/rule-engine.js +1 -1
  7. package/dist/evaluation/builtins/graph-service.spec.js +1 -1
  8. package/dist/evaluation/engine.js +1 -1
  9. package/dist/experience/realtime-feedback.js +1 -1
  10. package/dist/extensions/industry-pack.js +1 -1
  11. package/dist/graph/onchain/expand.js +1 -1
  12. package/dist/graph/onchain/exposure.js +1 -1
  13. package/dist/graph/onchain/facts.js +1 -1
  14. package/dist/graph/onchain/sdk-batch.d.ts +1 -0
  15. package/dist/graph/onchain/sdk-batch.js +1 -1
  16. package/dist/graph/onchain/sdk-dataplane.d.ts +1 -0
  17. package/dist/graph/onchain/sdk-dataplane.js +1 -1
  18. package/dist/knowledge/allocation-risk.d.ts +2 -1
  19. package/dist/knowledge/allocation-risk.js +1 -1
  20. package/dist/knowledge/allocation-templates.d.ts +1 -1
  21. package/dist/knowledge/allocation-templates.js +1 -1
  22. package/dist/knowledge/arbitration-ledger.js +1 -1
  23. package/dist/knowledge/audit-rules.d.ts +1 -1
  24. package/dist/knowledge/audit-rules.js +1 -1
  25. package/dist/knowledge/baselines/rules/allocation.json +31 -1
  26. package/dist/knowledge/builtin-templates.d.ts +3 -1
  27. package/dist/knowledge/builtin-templates.js +1 -1
  28. package/dist/knowledge/discount-threshold.d.ts +15 -0
  29. package/dist/knowledge/discount-threshold.js +1 -0
  30. package/dist/knowledge/entity-recipient-guard.d.ts +21 -0
  31. package/dist/knowledge/entity-recipient-guard.js +1 -0
  32. package/dist/knowledge/getting-started.js +1 -1
  33. package/dist/knowledge/guard-design-patterns.js +1 -1
  34. package/dist/knowledge/guard-lint.js +1 -1
  35. package/dist/knowledge/guard-templates.js +1 -1
  36. package/dist/knowledge/guard-translation.js +1 -1
  37. package/dist/knowledge/index.d.ts +2 -2
  38. package/dist/knowledge/index.js +1 -1
  39. package/dist/knowledge/industry-generalizer.d.ts +38 -1
  40. package/dist/knowledge/industry-generalizer.js +1 -1
  41. package/dist/knowledge/industry-registry.js +1 -1
  42. package/dist/knowledge/industry-strategy.js +1 -1
  43. package/dist/knowledge/jsonrpc-enum.js +1 -1
  44. package/dist/knowledge/machine-topology.d.ts +34 -0
  45. package/dist/knowledge/machine-topology.js +1 -1
  46. package/dist/knowledge/onchain-constants.d.ts +2 -2
  47. package/dist/knowledge/onchain-constants.js +1 -1
  48. package/dist/knowledge/scenario-modes.d.ts +11 -0
  49. package/dist/knowledge/scenario-modes.js +1 -1
  50. package/dist/knowledge/strategy-manuals.d.ts +1 -1
  51. package/dist/knowledge/strategy-manuals.js +1 -1
  52. package/dist/knowledge/template-loader.d.ts +41 -0
  53. package/dist/knowledge/template-loader.js +1 -1
  54. package/dist/knowledge/template-registry.js +1 -1
  55. package/dist/knowledge/template-scanner.js +1 -1
  56. package/dist/knowledge/tool-constraints.js +1 -1
  57. package/dist/knowledge/tools-reference.js +1 -1
  58. package/dist/knowledge/workflow-guidance.d.ts +4 -0
  59. package/dist/knowledge/workflow-guidance.js +1 -1
  60. package/dist/monitor/MonitorLoop.js +1 -1
  61. package/dist/participation/arbitrator-interest.js +1 -1
  62. package/dist/participation/customer-interest.js +1 -1
  63. package/dist/participation/merchant-interest.js +1 -1
  64. package/dist/playbooks/service-build/business-puzzle.js +1 -1
  65. package/dist/playbooks/service-build/index.d.ts +1 -0
  66. package/dist/playbooks/service-build/intent-analyzer.d.ts +1 -0
  67. package/dist/playbooks/service-build/intent-analyzer.js +1 -1
  68. package/dist/playbooks/service-build/machine-nodes.d.ts +1 -1
  69. package/dist/playbooks/service-build/machine-nodes.js +1 -1
  70. package/dist/playbooks/service-build/machine-panorama.js +1 -1
  71. package/dist/playbooks/service-build/merchant-guide.js +1 -1
  72. package/dist/playbooks/service-build/mode-actions.d.ts +12 -1
  73. package/dist/playbooks/service-build/mode-actions.js +1 -1
  74. package/dist/playbooks/service-build/object-panorama.d.ts +27 -1
  75. package/dist/playbooks/service-build/object-panorama.js +1 -1
  76. package/dist/playbooks/service-build/participation-radar.js +1 -1
  77. package/dist/playbooks/service-build/pipeline-actions.d.ts +4 -0
  78. package/dist/playbooks/service-build/pipeline-actions.js +1 -1
  79. package/dist/playbooks/service-build/relationship-profile.js +1 -1
  80. package/dist/playbooks/service-build/reverse-mapping-refund-p0-5.spec.d.ts +1 -0
  81. package/dist/playbooks/service-build/reverse-mapping-refund-p0-5.spec.js +1 -0
  82. package/dist/playbooks/service-build/reverse-mapping.js +1 -1
  83. package/dist/playbooks/service-build/semantic-graph.d.ts +1 -0
  84. package/dist/playbooks/service-build/semantic-graph.js +1 -1
  85. package/dist/playbooks/service-build/service-panorama.js +1 -1
  86. package/dist/playbooks/service-build/service-quote.js +1 -1
  87. package/dist/review/index.js +1 -1
  88. package/dist/role/profiles.js +1 -1
  89. package/dist/role/types.d.ts +2 -0
  90. package/dist/role/types.js +1 -1
  91. package/dist/safety/confirm-gate.js +1 -1
  92. package/dist/schema/call/allocation.d.ts +7 -7
  93. package/dist/schema/call/arbitration.d.ts +1 -1
  94. package/dist/schema/call/arbitration.js +1 -1
  95. package/dist/schema/call/base.d.ts +5 -5
  96. package/dist/schema/call/base.js +1 -1
  97. package/dist/schema/call/bridge.d.ts +5 -9
  98. package/dist/schema/call/bridge.js +1 -1
  99. package/dist/schema/call/contact.d.ts +1 -1
  100. package/dist/schema/call/demand.d.ts +1 -1
  101. package/dist/schema/call/guard.d.ts +11 -11
  102. package/dist/schema/call/handler.js +1 -1
  103. package/dist/schema/call/machine.d.ts +3 -2
  104. package/dist/schema/call/machine.js +1 -1
  105. package/dist/schema/call/order.d.ts +1 -1
  106. package/dist/schema/call/payment.d.ts +1 -1
  107. package/dist/schema/call/permission.d.ts +1 -1
  108. package/dist/schema/call/personal.d.ts +1 -1
  109. package/dist/schema/call/progress.d.ts +1 -1
  110. package/dist/schema/call/proof.d.ts +2 -2
  111. package/dist/schema/call/repository.d.ts +1 -1
  112. package/dist/schema/call/reward.d.ts +1 -1
  113. package/dist/schema/call/semantic.js +1 -1
  114. package/dist/schema/call/service.d.ts +5 -5
  115. package/dist/schema/call/service.js +1 -1
  116. package/dist/schema/call/treasury.d.ts +1 -1
  117. package/dist/schema/common/index.js +1 -1
  118. package/dist/schema/evaluation/index.d.ts +6 -2
  119. package/dist/schema/evaluation/index.js +1 -1
  120. package/dist/schema/goal/index.d.ts +8 -8
  121. package/dist/schema/goal/planning.d.ts +22 -15
  122. package/dist/schema/goal/planning.js +1 -1
  123. package/dist/schema/industry-pack/index.d.ts +39 -0
  124. package/dist/schema/industry-pack/index.js +1 -1
  125. package/dist/schema/industry-pack/modes.d.ts +15 -0
  126. package/dist/schema/industry-pack/modes.js +1 -1
  127. package/dist/schema/intent-radar/index.d.ts +3 -0
  128. package/dist/schema/intent-radar/index.js +1 -1
  129. package/dist/schema/local/index.d.ts +577 -18
  130. package/dist/schema/local/index.js +1 -1
  131. package/dist/schema/messenger/index.d.ts +160 -20
  132. package/dist/schema/messenger/index.js +1 -1
  133. package/dist/schema/operations.d.ts +32 -28
  134. package/dist/schema/operations.js +1 -1
  135. package/dist/schema/persona/index.d.ts +818 -708
  136. package/dist/schema/persona/index.js +1 -1
  137. package/dist/schema/query/bi.d.ts +22 -6
  138. package/dist/schema/query/bi.js +1 -1
  139. package/dist/schema/query/index.d.ts +32 -32
  140. package/dist/schema/query/index.js +1 -1
  141. package/dist/schema/schema-query/index.d.ts +3 -3
  142. package/dist/schema/schema-version.js +1 -1
  143. package/dist/schema/utils/node-parser.js +1 -1
  144. package/dist/schema/watch/index.d.ts +2 -2
  145. package/dist/schema/workflow/index.d.ts +2 -2
  146. package/dist/schema-query-impl/index.js +1 -1
  147. package/dist/schemas/account_operation.output.json +6 -2
  148. package/dist/schemas/account_operation.schema.json +1 -1
  149. package/dist/schemas/bridge_operation.schema.json +2 -10
  150. package/dist/schemas/evaluation_operation.output.json +2 -0
  151. package/dist/schemas/evaluation_operation.schema.json +2 -0
  152. package/dist/schemas/index.json +7 -1
  153. package/dist/schemas/industry_pack_operation.output.json +196 -4
  154. package/dist/schemas/industry_pack_operation.schema.json +3 -1
  155. package/dist/schemas/intent_radar.output.json +2 -0
  156. package/dist/schemas/intent_radar.schema.json +1 -0
  157. package/dist/schemas/local_cache_operation.output.json +1536 -0
  158. package/dist/schemas/local_cache_operation.schema.json +101 -0
  159. package/dist/schemas/local_mark_operation.output.json +51 -36
  160. package/dist/schemas/local_mark_operation.schema.json +1 -0
  161. package/dist/schemas/messenger_operation.output.json +42 -4
  162. package/dist/schemas/messenger_operation.schema.json +358 -35
  163. package/dist/schemas/onchain_operations.schema.json +14 -14
  164. package/dist/schemas/onchain_operations_allocation.schema.json +1 -1
  165. package/dist/schemas/onchain_operations_arbitration.schema.json +3 -3
  166. package/dist/schemas/onchain_operations_machine.schema.json +2 -2
  167. package/dist/schemas/onchain_operations_payment.schema.json +1 -1
  168. package/dist/schemas/onchain_operations_reward.schema.json +1 -1
  169. package/dist/schemas/onchain_operations_service.schema.json +5 -5
  170. package/dist/schemas/onchain_operations_treasury.schema.json +1 -1
  171. package/dist/schemas/onchain_table_data.output.json +16 -1
  172. package/dist/schemas/persona_operation.output.json +266 -0
  173. package/dist/schemas/persona_operation.schema.json +42 -0
  174. package/dist/schemas/query_toolkit.output.json +12 -5
  175. package/dist/schemas/query_toolkit.schema.json +18 -3
  176. package/dist/tools/handlers/benchmark-migration.d.ts +17 -0
  177. package/dist/tools/handlers/benchmark-migration.js +1 -1
  178. package/dist/tools/handlers/bridge.js +1 -1
  179. package/dist/tools/handlers/config.js +1 -1
  180. package/dist/tools/handlers/industry-pack.js +1 -1
  181. package/dist/tools/handlers/local.d.ts +1 -0
  182. package/dist/tools/handlers/local.js +1 -1
  183. package/dist/tools/handlers/messenger.d.ts +9 -2
  184. package/dist/tools/handlers/messenger.js +1 -1
  185. package/dist/tools/handlers/name-resolution.d.ts +4 -0
  186. package/dist/tools/handlers/name-resolution.js +1 -0
  187. package/dist/tools/handlers/name-resolution.spec.d.ts +1 -0
  188. package/dist/tools/handlers/name-resolution.spec.js +1 -0
  189. package/dist/tools/handlers/onchain-name-registration.d.ts +37 -0
  190. package/dist/tools/handlers/onchain-name-registration.js +1 -0
  191. package/dist/tools/handlers/onchain-name-registration.spec.d.ts +1 -0
  192. package/dist/tools/handlers/onchain-name-registration.spec.js +1 -0
  193. package/dist/tools/handlers/onchain.d.ts +1 -0
  194. package/dist/tools/handlers/onchain.js +1 -1
  195. package/dist/tools/handlers/query.d.ts +1 -0
  196. package/dist/tools/handlers/query.js +1 -1
  197. package/dist/tools/index.js +1 -1
  198. package/dist/tools/registry/business.js +1 -1
  199. package/dist/tools/registry/local.js +1 -1
  200. package/dist/tools/sanitize-description-roundtrip.spec.d.ts +1 -0
  201. package/dist/tools/sanitize-description-roundtrip.spec.js +1 -0
  202. package/dist/tools/sanitize-output.d.ts +1 -0
  203. package/dist/tools/sanitize-output.js +1 -1
  204. package/dist/tools/wrap.js +1 -1
  205. package/package.json +4 -3
@@ -1 +1 @@
1
- import{bcs,deriveDynamicFieldID,query_events,query_objects,query_table,LocalMark,lastWriteAtAny}from'@wowok/wowok';import{chunk50,mapPool}from'./dataplane.js';const SESSION_CACHE_TTL_MS=0x5*0x3c*0x3e8;let sessionWatermark=lastWriteAtAny();function checkWriteClock(){const a=lastWriteAtAny();a>sessionWatermark&&(sessionWatermark=a,sessionEntries['clear']());}const sessionEntries=new Set();class SessionMap{['map']=new Map();['registered']=![];['get'](a){const b=this['map']['get'](a);if(!b)return undefined;if(Date['now']()-b['at']>SESSION_CACHE_TTL_MS)return this['map']['delete'](a),undefined;return b['value'];}['set'](a,b){!this['registered']&&(sessionEntries['add'](this),this['registered']=!![]),this['map']['set'](a,{'value':b,'at':Date['now']()});}['clear'](){this['map']['clear']();}}export class SdkDataPlane{['network'];['opts'];['objectCache']=new SessionMap();['keyedCache']=new Map();['stats']={'batches':0x0,'byChannel':{'objects':0x0,'keyedFields':0x0,'tables':0x0,'events':0x0},'dedupHits':0x0};constructor(a,b){this['network']=a,this['opts']=b;}async['getObjects'](a,b){const c=a['map'](j=>String(j)['toLowerCase']()),d=await LocalMark['Instance']()['get_many_address'](c),e=[...new Set(d['filter'](j=>!!j))],f=new Map(),g=[],h=this['opts']?.['noCache']===!![];if(!h)checkWriteClock();for(const j of e){const k=h?undefined:this['objectCache']['get'](j);k?(this['stats']['dedupHits']++,f['set'](j,k)):g['push'](j);}if(g['length']===0x0)return f;const i=chunk50(g);return await mapPool(i,this['opts']?.['concurrency']??0x4,async l=>{this['stats']['batches']++,this['stats']['byChannel']['objects']++;try{const m=await query_objects({'objects':l,'no_cache':this['opts']?.['noCache'],'network':this['network']});for(const n of m?.['objects']??[]){const p=String(n?.['object']??'')['toLowerCase']();if(!p)continue;if(!h)this['objectCache']['set'](p,n);f['set'](p,n);}}catch(q){if(b?.['strict'])throw q;}}),f;}async['getKeyedFields'](a,b,c){const d=c?.['keyType']??'address',e=String(a)['toLowerCase'](),f=a+':'+d,g=this['opts']?.['noCache']===!![];if(!g)checkWriteClock();const h=g?undefined:this['keyedCache']['get'](f),i=new Map(),j=[];for(const o of b){const p=String(o)['toLowerCase'](),q=h?.['get'](p);if(q){this['stats']['dedupHits']++,i['set'](p,q);continue;}const r=d==='u64'?bcs['u64']()['serialize'](Number(p))['toBytes']():bcs['Address']['serialize'](p)['toBytes'](),s=deriveDynamicFieldID(e,d,r)['toLowerCase']();j['push']({'key':p,'fieldId':s});}if(j['length']===0x0)return i;const k=new Map();for(const t of j)k['set'](t['fieldId'],t['key']);const l=chunk50(j)['length'],m=await this['getObjects']([...k['keys']()],{'strict':c?.['strict']});this['stats']['byChannel']['objects']=Math['max'](0x0,this['stats']['byChannel']['objects']-l),this['stats']['byChannel']['keyedFields']+=l;const n=h??new SessionMap();for(const [u,v]of k){const x=m['get'](u);if(!x)continue;const y=x['data']??x,z=y;n['set'](v,z),i['set'](v,z);}if(!g)this['keyedCache']['set'](f,n);return i;}async['getTable'](a,b){const c=[];let d=![],f;for(;;){this['stats']['batches']++,this['stats']['byChannel']['tables']++;let g;try{g=await query_table({'parent':a,'cursor':f??undefined,'limit':b?.['pageLimit'],'no_cache':this['opts']?.['noCache'],'network':this['network']});}catch{break;}for(const h of g?.['items']??[]){const i=String(h?.['object']??'')['toLowerCase']();if(i['startsWith']('0x'))c['push']({'key':String(h?.['key']?.['value']??''),'objectId':i});}if(b?.['maxItems']!=null&&c['length']>=b['maxItems']){c['length']=b['maxItems'],d=g?.['hasNextPage']===!![];break;}if(g?.['hasNextPage']!==!![]||!g['nextCursor'])break;f=String(g['nextCursor']);}if(b?.['fetchValues']!==![]&&c['length']>0x0){const j=await this['getObjects'](c['map'](k=>k['objectId']));for(const k of c)k['object']=j['get'](k['objectId']);}return{'items':c,'truncated':d};}async['getEvents'](a,b){const c=[];let d=b?.['cursor']??null;const e=b?.['maxPages']??0x1,f=b?.['limit']??0x32;let g=![];for(let h=0x0;h<e;h++){this['stats']['batches']++,this['stats']['byChannel']['events']++;let i;try{i=await query_events({'type':a,'cursor':d,'limit':f,'order':'descending','no_cache':this['opts']?.['noCache'],'network':this['network']});}catch{g=!![];break;}const j=i?.['data']??[];c['push'](...j);if(i?.['hasNextPage']!==!![]||!i['nextCursor']){d=i?.['nextCursor']??null;break;}d=i['nextCursor'];if(h+0x1===e)g=!![];}return{'events':c,'cursor':d,'truncated':g};}}
1
+ import{bcs,deriveDynamicFieldID,query_events,query_objects,query_table,LocalMark,lastWriteAtAny}from'@wowok/wowok';import{chunk50,mapPool}from'./dataplane.js';const SESSION_CACHE_TTL_MS=0x5*0x3c*0x3e8;let sessionWatermark=lastWriteAtAny();function checkWriteClock(){const a=lastWriteAtAny();a>sessionWatermark&&(sessionWatermark=a,sessionEntries['clear']());}const sessionEntries=new Set();class SessionMap{['map']=new Map();['registered']=![];['get'](a){const b=this['map']['get'](a);if(!b)return undefined;if(Date['now']()-b['at']>SESSION_CACHE_TTL_MS)return this['map']['delete'](a),undefined;return b['value'];}['set'](a,b){!this['registered']&&(sessionEntries['add'](this),this['registered']=!![]),this['map']['set'](a,{'value':b,'at':Date['now']()});}['clear'](){this['map']['clear']();}}export class SdkDataPlane{['network'];['opts'];['objectCache']=new SessionMap();['keyedCache']=new Map();['stats']={'batches':0x0,'byChannel':{'objects':0x0,'keyedFields':0x0,'tables':0x0,'events':0x0},'dedupHits':0x0};constructor(a,b){this['network']=a,this['opts']=b;}['unresolvedInputs']=[];async['getObjects'](a,b){const c=a['map'](j=>String(j)['toLowerCase']()),d=await LocalMark['Instance']()['get_many_address'](c),e=[...new Set(d['filter'](j=>!!j))],f=new Map(),g=[];this['unresolvedInputs']=a['map'](j=>String(j)['toLowerCase']())['filter']((j,k)=>j!==d[k]);const h=this['opts']?.['noCache']===!![];if(!h)checkWriteClock();for(const j of e){const k=h?undefined:this['objectCache']['get'](j);k?(this['stats']['dedupHits']++,f['set'](j,k)):g['push'](j);}if(g['length']===0x0)return f;const i=chunk50(g);return await mapPool(i,this['opts']?.['concurrency']??0x4,async l=>{this['stats']['batches']++,this['stats']['byChannel']['objects']++;try{const m=await query_objects({'objects':l,'no_cache':this['opts']?.['noCache'],'network':this['network']});for(const n of m?.['objects']??[]){const p=String(n?.['object']??'')['toLowerCase']();if(!p)continue;if(!h)this['objectCache']['set'](p,n);f['set'](p,n);}}catch(q){if(b?.['strict'])throw q;}}),f;}async['getKeyedFields'](a,b,c){const d=c?.['keyType']??'address',e=String(a)['toLowerCase'](),f=a+':'+d,g=this['opts']?.['noCache']===!![];if(!g)checkWriteClock();const h=g?undefined:this['keyedCache']['get'](f),i=new Map(),j=[];for(const o of b){const p=String(o)['toLowerCase'](),q=h?.['get'](p);if(q){this['stats']['dedupHits']++,i['set'](p,q);continue;}const r=d==='u64'?bcs['u64']()['serialize'](Number(p))['toBytes']():bcs['Address']['serialize'](p)['toBytes'](),s=deriveDynamicFieldID(e,d,r)['toLowerCase']();j['push']({'key':p,'fieldId':s});}if(j['length']===0x0)return i;const k=new Map();for(const t of j)k['set'](t['fieldId'],t['key']);const l=chunk50(j)['length'],m=await this['getObjects']([...k['keys']()],{'strict':c?.['strict']});this['stats']['byChannel']['objects']=Math['max'](0x0,this['stats']['byChannel']['objects']-l),this['stats']['byChannel']['keyedFields']+=l;const n=h??new SessionMap();for(const [u,v]of k){const x=m['get'](u);if(!x)continue;const y=x['data']??x,z=y;n['set'](v,z),i['set'](v,z);}if(!g)this['keyedCache']['set'](f,n);return i;}async['getTable'](a,b){const c=[];let d=![],f;for(;;){this['stats']['batches']++,this['stats']['byChannel']['tables']++;let g;try{g=await query_table({'parent':a,'cursor':f??undefined,'limit':b?.['pageLimit'],'no_cache':this['opts']?.['noCache'],'network':this['network']});}catch{break;}for(const h of g?.['items']??[]){const i=String(h?.['object']??'')['toLowerCase']();if(i['startsWith']('0x'))c['push']({'key':String(h?.['key']?.['value']??''),'objectId':i});}if(b?.['maxItems']!=null&&c['length']>=b['maxItems']){c['length']=b['maxItems'],d=g?.['hasNextPage']===!![];break;}if(g?.['hasNextPage']!==!![]||!g['nextCursor'])break;f=String(g['nextCursor']);}if(b?.['fetchValues']!==![]&&c['length']>0x0){const j=await this['getObjects'](c['map'](k=>k['objectId']));for(const k of c)k['object']=j['get'](k['objectId']);}return{'items':c,'truncated':d};}async['getEvents'](a,b){const c=[];let d=b?.['cursor']??null;const e=b?.['maxPages']??0x1,f=b?.['limit']??0x32;let g=![];for(let h=0x0;h<e;h++){this['stats']['batches']++,this['stats']['byChannel']['events']++;let i;try{i=await query_events({'type':a,'cursor':d,'limit':f,'order':'descending','no_cache':this['opts']?.['noCache'],'network':this['network']});}catch{g=!![];break;}const j=i?.['data']??[];c['push'](...j);if(i?.['hasNextPage']!==!![]||!i['nextCursor']){d=i?.['nextCursor']??null;break;}d=i['nextCursor'];if(h+0x1===e)g=!![];}return{'events':c,'cursor':d,'truncated':g};}}
@@ -61,9 +61,10 @@ export interface AllocationRiskCheckContext {
61
61
  guard_conditions_mutually_exclusive?: boolean;
62
62
  bound_order?: string;
63
63
  order_already_has_allocation?: boolean;
64
+ builder_address?: string;
64
65
  }
65
66
  export declare function allocationRiskFacts(ctx: AllocationRiskCheckContext): Facts;
66
- export declare const ALLOCATION_RISK_VERSION = "1.1.0";
67
+ export declare const ALLOCATION_RISK_VERSION = "1.2.0";
67
68
  export declare function getAllRiskRules(): AllocationRiskRule[];
68
69
  export interface AllocationRiskAssessment {
69
70
  summary: string;
@@ -1 +1 @@
1
- import{MAX_ALLOCATOR_COUNT,RATE_TOTAL_FULL,ALLOCATION_ERROR_CODES}from'./allocation-ledger.js';import{isUnboundSignerTheft}from'./recipient-constraint.js';import{getJudgmentDoc,factoryRulePack}from'../config/judgment.js';import{evaluateRuleBook,evaluateCondition}from'../config/rule-engine.js';const AUTO_FIXABLE=new Set(['R-A-1-02#0','R-A-1-02#1','R-A-1-02#2','R-A-1-02#3','R-A-1-02#4','R-A-1-03#0','R-A-1-03#2','R-A-2-03#0','R-A-5-03#0']),RELATED_MOVE_ERROR={'R-A-1-01#0':'EALLOCATORS_EMPTY\x20(8)\x20/\x20ENO_ALLOCATOR\x20(3)','R-A-1-01#1':'ENO_ALLOCATOR\x20(3)','R-A-1-02#0':'ERATE_NOT_10000\x20(4)','R-A-1-02#1':'ERATE_EXCEEDS_10000\x20(6)','R-A-1-02#2':'ERATE_EXCEEDS_10000\x20(6)','R-A-1-02#3':'ERATE_EXCEEDS_10000\x20(6)','R-A-1-02#4':'ERATE_EXCEEDS_10000\x20(6)','R-A-1-02#5':'EMIXED_RATE_BASES\x20(17)','R-A-1-03#0':'EMULTIPLE_SURPLUS\x20(5)','R-A-1-03#1':'EAMOUNT_BELOW_THRESHOLD\x20(12)','R-A-1-03#2':'EAMOUNT_EXCEEDS_MAX\x20(13)','R-A-2-02#0':'ERECIPIENT_IDENTIFIER_NOT_ADDRESS\x20(1)','R-A-2-04#0':'ERECIPIENT_NOT_FOR_OBJECT\x20(15)','R-A-2-04#1':'ERECIPIENT_NOT_FOR_OBJECT\x20(15,\x20only\x20fires\x20when\x20a\x20binding\x20is\x20declared)','R-A-5-01#0':'E_ALLOCATION_ALREADY_SPECIFIED','R-A-5-02#0':'ENO_PAYMENT_INFO\x20(9)'},RELATED_GUARD_RISK={'R-A-2-01#0':'R-C3-06','R-A-3-04#0':'R-C3-06\x20(Signer\x20binding)\x20/\x20time-lock\x20patterns','R-A-4-01#0':'R-X1-05','R-A-4-03#0':'reentrancy\x20low'};export function allocationRiskFacts(b){const c=b['allocators_config'],d=!!c,e=d?c['allocators']:[];let f,g;if(d&&e['length']>0x0)for(let Z=0x0;Z<e['length'];Z++){if(e[Z]['sharing']['length']===0x0){f=Z,g=e[Z]['guard'];break;}}let h,j,k,l=![],n=![];if(d)for(let a0=0x0;a0<e['length'];a0++){const a1=e[a0],a2=a1['sharing']['some'](a9=>a9['mode']==='RateGross'),a3=a1['sharing']['filter'](a9=>a9['mode']==='Amount')['reduce']((a9,aa)=>a9+Number(aa['sharing']),0x0);if(a2&&a3>0x0)continue;const a4=a2&&a3===0x0&&a1['sharing']['some'](a9=>a9['mode']==='Rate'),a5=a1['sharing']['filter'](a9=>a9['mode']==='Rate'||a4&&a9['mode']==='RateGross');if(a5['length']===0x0)continue;const a6=a5['map'](a9=>Number(a9['sharing']));if(a6['some'](a9=>!Number['isFinite'](a9)))continue;const a7=a6['reduce']((a9,aa)=>a9+aa,0x0),a8=a1['sharing']['some'](a9=>a9['mode']==='Surplus');if(!a8&&a7!==RATE_TOTAL_FULL){h=a0,j=a1['guard'],k=a7,l=!![];break;}if(a8&&a7>RATE_TOTAL_FULL){h=a0,j=a1['guard'],k=a7,n=!![];break;}}let o,p,q,r,t,u,v=![],w,x;if(d)for(let a9=0x0;a9<e['length'];a9++){const aa=e[a9],ab=aa['sharing']['some'](ah=>ah['mode']==='Rate'),ad=aa['sharing']['filter'](ah=>ah['mode']==='RateGross');if(ad['length']===0x0)continue;const ae=aa['sharing']['filter'](ah=>ah['mode']==='Amount')['reduce']((ah,ai)=>ah+Number(ai['sharing']),0x0);if(ab){if(ae>0x0){v=!![],w=a9,x=aa['guard'];break;}continue;}const af=ad['map'](ah=>Number(ah['sharing']));if(af['some'](ah=>!Number['isFinite'](ah))||!Number['isFinite'](ae))continue;const ag=af['reduce']((ah,ai)=>ah+ai,0x0);if(ag>RATE_TOTAL_FULL){o='sum_exceeds_10000',p=a9,q=aa['guard'],r=ag,t=ae;break;}if(aa['max']!=null){const ah=Number(aa['max']);if(Number['isFinite'](ah)&&ae*RATE_TOTAL_FULL+ag*ah>ah*RATE_TOTAL_FULL){o='cap_fit',p=a9,q=aa['guard'],r=ag,t=ae,u=ah;break;}}else{if(ae>0x0&&ag>=RATE_TOTAL_FULL){o='fixed_full',p=a9,q=aa['guard'],r=ag,t=ae;break;}}}let y,z,A,B,C,D,E;if(d){const ai=Number(c['threshold']);for(let aj=0x0;aj<e['length'];aj++){const ak=e[aj],al=ak['sharing']['filter'](ao=>ao['mode']==='Surplus')['length'];if(al>0x1){y='multiple_surplus',z=aj,A=ak['guard'],B=al;break;}const am=ak['sharing']['filter'](ao=>ao['mode']==='Amount')['reduce']((ao,ap)=>ao+Number(ap['sharing']),0x0),an=ak['sharing']['some'](ao=>ao['mode']==='Rate'||ao['mode']==='Surplus');if(!an&&am>0x0&&am<ai){y='below_threshold',z=aj,A=ak['guard'],C=am,D=ai;break;}if(ak['max']!=null&&am>Number(ak['max'])){y='exceeds_max',z=aj,A=ak['guard'],C=am,E=Number(ak['max']);break;}}}let F=![],G,H,I;if(d)for(let ao=0x0;ao<e['length'];ao++){const ap=e[ao],aq=ap['sharing']['some'](as=>'Signer'in as['who']),ar=b['guard_signer_bindings']?.[ap['guard']]===!![];if(isUnboundSignerTheft({'recipient_is_signer':aq,'caller_identity_constrained':ar})){F=!![],G=ao,H=ap['guard'],I=ar;break;}}let J,K,L;if(d&&b['passport_identifier_types'])for(let as=0x0;as<e['length'];as++){const at=e[as],au=at['sharing']['find'](ax=>'GuardIdentifier'in ax['who']);if(!au)continue;const av=au['who']['GuardIdentifier'],aw=b['passport_identifier_types'][av];if(aw!==undefined&&aw!=='address'){J=av,K=aw,L=as;break;}}let M=![],N,O,P,Q;if(d){const ax=e['map'](az=>az['guard']),ay=new Set(ax);if(ay['size']!==ax['length']){const az=ax['filter']((aA,aB)=>ax['indexOf'](aA)!==aB);M=!![],N=ax['length'],O=ay['size'],P=az['join'](',\x20'),Q=az['join'](',');}}const R=b['payment_info_for_object']!==undefined,S=d&&e['some'](aA=>aA['sharing']['some'](aB=>'GuardIdentifier'in aB['who'])),T=!!b['payment_info_for_object'];let U=![],V,W;if(d&&b['referenced_treasuries_permissions']&&b['host_service_permission'])for(const aA of e){for(const aB of aA['sharing']){if(!(aB['who']!==null&&typeof aB['who']==='object'&&'Entity'in aB['who']))continue;const aC=aB['who']['Entity'],aD=b['referenced_treasuries_permissions'][aC];if(aD&&aD!==b['host_service_permission']){U=!![],V=aC,W=aD;break;}}if(U)break;}let X;if(b['trigger_source']==='standalone'&&d){const aE=[];for(const aF of e){const aG=b['guard_signer_bindings']?.[aF['guard']]===!![],aH=b['guard_has_time_lock']?.[aF['guard']]===!![];if(!aG&&!aH)aE['push'](aF['guard']);}X=aE;}let Y;if(d)for(let aI=0x0;aI<e['length'];aI++){const aJ=e[aI],aK=aJ['sharing']['length']>0x0&&aJ['sharing']['every'](aL=>aL['mode']==='Amount');if(aK){Y=aI;break;}}return{'allocators_config_present':d,'allocators_count':d?e['length']:undefined,'allocators_empty':d&&e['length']===0x0,'empty_sharing_allocator_index':f,'empty_sharing_allocator_guard':g,'rate_rule_index':h,'rate_rule_guard':j,'rate_rule_sum':k,'rate_rule_pure':l,'rate_rule_exceed':n,'rate_total_full':RATE_TOTAL_FULL,'rate_gross_branch':o,'rate_gross_index':p,'rate_gross_guard':q,'rate_gross_sum':r,'rate_gross_fix':t,'rate_gross_max':u,'mixed_rate_bases_present':v,'mixed_rate_bases_index':w,'mixed_rate_bases_guard':x,'amount_rule_branch':y,'amount_rule_index':z,'amount_rule_guard':A,'amount_rule_surplus_count':B,'amount_rule_amount_sum':C,'amount_rule_threshold':D,'amount_rule_max':E,'signer_theft_detected':F,'signer_theft_index':G,'signer_theft_guard':H,'signer_theft_guard_bound':I,'guard_id_bad_identifier':J,'guard_id_bad_type':K,'guard_id_bad_index':L,'duplicate_guards_present':M,'allocators_total':N,'allocators_unique':O,'duplicate_guards_csv_sp':P,'duplicate_guards_csv':Q,'for_object_anchor_known':R,'guard_identifier_recipient_present':S,'for_object_anchor_set':T,'for_object_anchor':R&&T?b['payment_info_for_object']??undefined:undefined,'host_service_published':b['host_service_published'],'treasury_perm_mismatch':U,'treasury_perm_entity':V,'treasury_perm_treasury':W,'host_service_permission':b['host_service_permission'],'allocation_create_op':b['operation_type']==='create','allocation_standalone':b['trigger_source']==='standalone','trigger_source_display':b['trigger_source']??'unknown','standalone_weak_guards_count':X?.['length'],'standalone_weak_guards_csv_sp':X?.['join'](',\x20'),'standalone_weak_guards_csv':X?.['join'](','),'has_fallback_allocator':b['has_fallback_allocator'],'guard_conditions_mutually_exclusive':b['guard_conditions_mutually_exclusive'],'has_fallback_allocator_display':String(b['has_fallback_allocator']??![]),'mutually_exclusive_display':String(b['guard_conditions_mutually_exclusive']??![]),'pure_amount_index':Y,'order_already_has_allocation':b['order_already_has_allocation'],'bound_order_display':b['bound_order']??'unknown','bound_order_paren_display':b['bound_order']??'(unknown)','has_payment_info':b['has_payment_info'],'operation_type':b['operation_type'],'max_allocator_count':MAX_ALLOCATOR_COUNT};}function allocationRuleBook(){const a=getJudgmentDoc()['rules']['domains']['allocation'];if(!a)throw new Error('factory\x20rule\x20pack\x20\x27allocation\x27\x20missing\x20—\x20broken\x20installation');return a['rules'];}function firedCaseKey(a,b,c){const d=a['find'](e=>e['rule_id']===c);if(d)for(let e=0x0;e<d['cases']['length'];e++){if(evaluateCondition(d['cases'][e]['when'],b))return c+'#'+e;}return c+'#0';}function findingToAllocationRisk(a,b){const c=RELATED_MOVE_ERROR[b],d=RELATED_GUARD_RISK[b];return{'id':a['rule_id'],'level':a['level'],'category':a['dimension']??'structural','title':a['title'],'description':a['description'],'affected_stakeholders':a['stakeholders']??[],'scenario':a['scenario']??'','mitigation':a['mitigation']??'','evidence':a['evidence'],...c!==undefined?{'related_move_error':c}:{},...d!==undefined?{'related_guard_risk':d}:{},'auto_fixable':AUTO_FIXABLE['has'](b),...a['exposure']!=null?{'exposure':a['exposure']}:{}};}export const ALLOCATION_RISK_VERSION='1.1.0';export function getAllRiskRules(){const a=factoryRulePack('allocation');if(!a)return[];return a['rules']['map'](b=>({'id':b['rule_id'],'category':b['dimension']??'structural','trigger':b['trigger']??'','check':c=>{const d=allocationRiskFacts(c),{findings:e}=evaluateRuleBook([b],d);return e['length']>0x0?findingToAllocationRisk(e[0x0],firedCaseKey([b],d,b['rule_id'])):null;}}));}export function assessAllocationRisks(a){const b=allocationRuleBook(),c=allocationRiskFacts(a),{findings:d}=evaluateRuleBook(b,c),e=d['map'](j=>findingToAllocationRisk(j,firedCaseKey(b,c,j['rule_id']))),f=e['length']===0x0?'low':e['some'](j=>j['level']==='critical')?'critical':e['some'](j=>j['level']==='high')?'high':e['some'](j=>j['level']==='medium')?'medium':'low',g={},h={};for(const j of e){g[j['category']]=(g[j['category']]??0x0)+0x1,h[j['level']]=(h[j['level']]??0x0)+0x1;}const i={};for(const k of e){for(const l of k['affected_stakeholders']){if(!i[l])i[l]=[];i[l]['push'](k['id']+':\x20'+k['mitigation']);}}return{'summary':'Assessed\x20'+e['length']+'\x20risk(s)\x20across\x20'+Object['keys'](g)['length']+'\x20categories','risks':e,'overall_risk':f,'risks_by_category':g,'risks_by_level':h,'stakeholder_advice':i,'needs_human_review':e['some'](m=>m['level']==='critical'||m['level']==='high'),'blocks_publish':e['some'](m=>m['level']==='critical')};}export{ALLOCATION_ERROR_CODES};
1
+ import{MAX_ALLOCATOR_COUNT,RATE_TOTAL_FULL,ALLOCATION_ERROR_CODES}from'./allocation-ledger.js';import{isUnboundSignerTheft}from'./recipient-constraint.js';import{checkEntityRecipientsSync}from'./entity-recipient-guard.js';import{getJudgmentDoc,factoryRulePack}from'../config/judgment.js';import{evaluateRuleBook,evaluateCondition}from'../config/rule-engine.js';const AUTO_FIXABLE=new Set(['R-A-1-02#0','R-A-1-02#1','R-A-1-02#2','R-A-1-02#3','R-A-1-02#4','R-A-1-03#0','R-A-1-03#2','R-A-2-03#0','R-A-5-03#0']),RELATED_MOVE_ERROR={'R-A-1-01#0':'EALLOCATORS_EMPTY\x20(8)\x20/\x20ENO_ALLOCATOR\x20(3)','R-A-1-01#1':'ENO_ALLOCATOR\x20(3)','R-A-1-02#0':'ERATE_NOT_10000\x20(4)','R-A-1-02#1':'ERATE_EXCEEDS_10000\x20(6)','R-A-1-02#2':'ERATE_EXCEEDS_10000\x20(6)','R-A-1-02#3':'ERATE_EXCEEDS_10000\x20(6)','R-A-1-02#4':'ERATE_EXCEEDS_10000\x20(6)','R-A-1-02#5':'EMIXED_RATE_BASES\x20(17)','R-A-1-03#0':'EMULTIPLE_SURPLUS\x20(5)','R-A-1-03#1':'EAMOUNT_BELOW_THRESHOLD\x20(12)','R-A-1-03#2':'EAMOUNT_EXCEEDS_MAX\x20(13)','R-A-2-02#0':'ERECIPIENT_IDENTIFIER_NOT_ADDRESS\x20(1)','R-A-2-04#0':'ERECIPIENT_NOT_FOR_OBJECT\x20(15)','R-A-2-04#1':'ERECIPIENT_NOT_FOR_OBJECT\x20(15,\x20only\x20fires\x20when\x20a\x20binding\x20is\x20declared)','R-A-5-01#0':'E_ALLOCATION_ALREADY_SPECIFIED','R-A-5-02#0':'ENO_PAYMENT_INFO\x20(9)','R-RECIPIENT-03#0':'NO\x20chain\x20rejection\x20for\x20an\x20Entity\x20recipient\x20of\x20any\x20address\x20—\x20the\x20SDK\x20substitutes\x20the\x20default\x20local\x20account\x20before\x20the\x20address\x20reaches\x20Move,\x20and\x20allocation.move:250-255\x20swallows\x20Recipient::Entity\x20in\x20a\x20(_)\x20catch-all\x20at\x20declaration\x20while\x20allocation.move:451-453\x20/\x20:514\x20forwards\x20the\x20raw\x20address\x20straight\x20to\x20the\x20payout\x20constructor\x20(retracted\x202026-10-06:\x20there\x20is\x20no\x20ERECIPIENT_ZERO_ENTITY\x20constant;\x20grep\x20returns\x200\x20.move\x20hits)'},RELATED_GUARD_RISK={'R-A-2-01#0':'R-C3-06','R-A-3-04#0':'R-C3-06\x20(Signer\x20binding)\x20/\x20time-lock\x20patterns','R-A-4-01#0':'R-X1-05','R-A-4-03#0':'reentrancy\x20low'};export function allocationRiskFacts(b){const c=b['allocators_config'],d=!!c,e=d?c['allocators']:[];let f,g;if(d&&e['length']>0x0)for(let a1=0x0;a1<e['length'];a1++){if(e[a1]['sharing']['length']===0x0){f=a1,g=e[a1]['guard'];break;}}let h,j,k,l=![],n=![];if(d)for(let a2=0x0;a2<e['length'];a2++){const a3=e[a2],a4=a3['sharing']['some'](ab=>ab['mode']==='RateGross'),a5=a3['sharing']['filter'](ab=>ab['mode']==='Amount')['reduce']((ab,ad)=>ab+Number(ad['sharing']),0x0);if(a4&&a5>0x0)continue;const a6=a4&&a5===0x0&&a3['sharing']['some'](ab=>ab['mode']==='Rate'),a7=a3['sharing']['filter'](ab=>ab['mode']==='Rate'||a6&&ab['mode']==='RateGross');if(a7['length']===0x0)continue;const a8=a7['map'](ab=>Number(ab['sharing']));if(a8['some'](ab=>!Number['isFinite'](ab)))continue;const a9=a8['reduce']((ab,ad)=>ab+ad,0x0),aa=a3['sharing']['some'](ab=>ab['mode']==='Surplus');if(!aa&&a9!==RATE_TOTAL_FULL){h=a2,j=a3['guard'],k=a9,l=!![];break;}if(aa&&a9>RATE_TOTAL_FULL){h=a2,j=a3['guard'],k=a9,n=!![];break;}}let o,p,q,r,t,u,v=![],w,x;if(d)for(let ab=0x0;ab<e['length'];ab++){const ad=e[ab],ae=ad['sharing']['some'](aj=>aj['mode']==='Rate'),af=ad['sharing']['filter'](aj=>aj['mode']==='RateGross');if(af['length']===0x0)continue;const ag=ad['sharing']['filter'](aj=>aj['mode']==='Amount')['reduce']((aj,ak)=>aj+Number(ak['sharing']),0x0);if(ae){if(ag>0x0){v=!![],w=ab,x=ad['guard'];break;}continue;}const ah=af['map'](aj=>Number(aj['sharing']));if(ah['some'](aj=>!Number['isFinite'](aj))||!Number['isFinite'](ag))continue;const ai=ah['reduce']((aj,ak)=>aj+ak,0x0);if(ai>RATE_TOTAL_FULL){o='sum_exceeds_10000',p=ab,q=ad['guard'],r=ai,t=ag;break;}if(ad['max']!=null){const aj=Number(ad['max']);if(Number['isFinite'](aj)&&ag*RATE_TOTAL_FULL+ai*aj>aj*RATE_TOTAL_FULL){o='cap_fit',p=ab,q=ad['guard'],r=ai,t=ag,u=aj;break;}}else{if(ag>0x0&&ai>=RATE_TOTAL_FULL){o='fixed_full',p=ab,q=ad['guard'],r=ai,t=ag;break;}}}let y,z,A,B,C,D,E;if(d){const ak=Number(c['threshold']);for(let al=0x0;al<e['length'];al++){const am=e[al],an=am['sharing']['filter'](aq=>aq['mode']==='Surplus')['length'];if(an>0x1){y='multiple_surplus',z=al,A=am['guard'],B=an;break;}const ao=am['sharing']['filter'](aq=>aq['mode']==='Amount')['reduce']((aq,ar)=>aq+Number(ar['sharing']),0x0),ap=am['sharing']['some'](aq=>aq['mode']==='Rate'||aq['mode']==='Surplus');if(!ap&&ao>0x0&&ao<ak){y='below_threshold',z=al,A=am['guard'],C=ao,D=ak;break;}if(am['max']!=null&&ao>Number(am['max'])){y='exceeds_max',z=al,A=am['guard'],C=ao,E=Number(am['max']);break;}}}let F=![],G,H,I;if(d)for(let aq=0x0;aq<e['length'];aq++){const ar=e[aq],as=ar['sharing']['some'](au=>'Signer'in au['who']),at=b['guard_signer_bindings']?.[ar['guard']]===!![];if(isUnboundSignerTheft({'recipient_is_signer':as,'caller_identity_constrained':at})){F=!![],G=aq,H=ar['guard'],I=at;break;}}let J,K,L;if(d&&b['passport_identifier_types'])for(let au=0x0;au<e['length'];au++){const av=e[au],aw=av['sharing']['find'](az=>'GuardIdentifier'in az['who']);if(!aw)continue;const ax=aw['who']['GuardIdentifier'],ay=b['passport_identifier_types'][ax];if(ay!==undefined&&ay!=='address'){J=ax,K=ay,L=au;break;}}let M=![],N,O,P,Q;if(d){const az=e['map'](aB=>aB['guard']),aA=new Set(az);if(aA['size']!==az['length']){const aB=az['filter']((aC,aD)=>az['indexOf'](aC)!==aD);M=!![],N=az['length'],O=aA['size'],P=aB['join'](',\x20'),Q=aB['join'](',');}}const R=b['payment_info_for_object']!==undefined,S=d&&e['some'](aC=>aC['sharing']['some'](aD=>'GuardIdentifier'in aD['who'])),T=!!b['payment_info_for_object'];let U=![],V,W;if(d&&b['referenced_treasuries_permissions']&&b['host_service_permission'])for(const aC of e){for(const aD of aC['sharing']){if(!(aD['who']!==null&&typeof aD['who']==='object'&&'Entity'in aD['who']))continue;const aE=aD['who']['Entity'],aF=b['referenced_treasuries_permissions'][aE];if(aF&&aF!==b['host_service_permission']){U=!![],V=aE,W=aF;break;}}if(U)break;}let X;if(b['trigger_source']==='standalone'&&d){const aG=[];for(const aH of e){const aI=b['guard_signer_bindings']?.[aH['guard']]===!![],aJ=b['guard_has_time_lock']?.[aH['guard']]===!![];if(!aI&&!aJ)aG['push'](aH['guard']);}X=aG;}let Y;if(d)for(let aK=0x0;aK<e['length'];aK++){const aL=e[aK],aM=aL['sharing']['length']>0x0&&aL['sharing']['every'](aN=>aN['mode']==='Amount');if(aM){Y=aK;break;}}const Z=d?checkEntityRecipientsSync(c,{'builderAddress':b['builder_address']}):[],a0=Z['map'](aN=>'Allocator['+aN['allocator_index']+'].sharing['+aN['sharing_index']+']\x20('+aN['reason']+')');return{'allocators_config_present':d,'allocators_count':d?e['length']:undefined,'allocators_empty':d&&e['length']===0x0,'empty_sharing_allocator_index':f,'empty_sharing_allocator_guard':g,'rate_rule_index':h,'rate_rule_guard':j,'rate_rule_sum':k,'rate_rule_pure':l,'rate_rule_exceed':n,'rate_total_full':RATE_TOTAL_FULL,'rate_gross_branch':o,'rate_gross_index':p,'rate_gross_guard':q,'rate_gross_sum':r,'rate_gross_fix':t,'rate_gross_max':u,'mixed_rate_bases_present':v,'mixed_rate_bases_index':w,'mixed_rate_bases_guard':x,'amount_rule_branch':y,'amount_rule_index':z,'amount_rule_guard':A,'amount_rule_surplus_count':B,'amount_rule_amount_sum':C,'amount_rule_threshold':D,'amount_rule_max':E,'signer_theft_detected':F,'signer_theft_index':G,'signer_theft_guard':H,'signer_theft_guard_bound':I,'guard_id_bad_identifier':J,'guard_id_bad_type':K,'guard_id_bad_index':L,'entity_recipient_bad_count':Z['length'],'entity_recipient_bad_count_display':String(Z['length']),'entity_recipient_bad_rows_csv_sp':a0['length']>0x0?a0['join'](',\x20'):undefined,'entity_recipient_bad_rows_csv':a0['length']>0x0?a0['join'](','):undefined,'duplicate_guards_present':M,'allocators_total':N,'allocators_unique':O,'duplicate_guards_csv_sp':P,'duplicate_guards_csv':Q,'for_object_anchor_known':R,'guard_identifier_recipient_present':S,'for_object_anchor_set':T,'for_object_anchor':R&&T?b['payment_info_for_object']??undefined:undefined,'host_service_published':b['host_service_published'],'treasury_perm_mismatch':U,'treasury_perm_entity':V,'treasury_perm_treasury':W,'host_service_permission':b['host_service_permission'],'allocation_create_op':b['operation_type']==='create','allocation_standalone':b['trigger_source']==='standalone','trigger_source_display':b['trigger_source']??'unknown','standalone_weak_guards_count':X?.['length'],'standalone_weak_guards_csv_sp':X?.['join'](',\x20'),'standalone_weak_guards_csv':X?.['join'](','),'has_fallback_allocator':b['has_fallback_allocator'],'guard_conditions_mutually_exclusive':b['guard_conditions_mutually_exclusive'],'has_fallback_allocator_display':String(b['has_fallback_allocator']??![]),'mutually_exclusive_display':String(b['guard_conditions_mutually_exclusive']??![]),'pure_amount_index':Y,'order_already_has_allocation':b['order_already_has_allocation'],'bound_order_display':b['bound_order']??'unknown','bound_order_paren_display':b['bound_order']??'(unknown)','has_payment_info':b['has_payment_info'],'operation_type':b['operation_type'],'max_allocator_count':MAX_ALLOCATOR_COUNT};}function allocationRuleBook(){const a=getJudgmentDoc()['rules']['domains']['allocation'];if(!a)throw new Error('factory\x20rule\x20pack\x20\x27allocation\x27\x20missing\x20—\x20broken\x20installation');return a['rules'];}function firedCaseKey(a,b,c){const d=a['find'](e=>e['rule_id']===c);if(d)for(let e=0x0;e<d['cases']['length'];e++){if(evaluateCondition(d['cases'][e]['when'],b))return c+'#'+e;}return c+'#0';}function findingToAllocationRisk(a,b){const c=RELATED_MOVE_ERROR[b],d=RELATED_GUARD_RISK[b];return{'id':a['rule_id'],'level':a['level'],'category':a['dimension']??'structural','title':a['title'],'description':a['description'],'affected_stakeholders':a['stakeholders']??[],'scenario':a['scenario']??'','mitigation':a['mitigation']??'','evidence':a['evidence'],...c!==undefined?{'related_move_error':c}:{},...d!==undefined?{'related_guard_risk':d}:{},'auto_fixable':AUTO_FIXABLE['has'](b),...a['exposure']!=null?{'exposure':a['exposure']}:{}};}export const ALLOCATION_RISK_VERSION='1.2.0';export function getAllRiskRules(){const a=factoryRulePack('allocation');if(!a)return[];return a['rules']['map'](b=>({'id':b['rule_id'],'category':b['dimension']??'structural','trigger':b['trigger']??'','check':c=>{const d=allocationRiskFacts(c),{findings:e}=evaluateRuleBook([b],d);return e['length']>0x0?findingToAllocationRisk(e[0x0],firedCaseKey([b],d,b['rule_id'])):null;}}));}export function assessAllocationRisks(a){const b=allocationRuleBook(),c=allocationRiskFacts(a),{findings:d}=evaluateRuleBook(b,c),e=d['map'](j=>findingToAllocationRisk(j,firedCaseKey(b,c,j['rule_id']))),f=e['length']===0x0?'low':e['some'](j=>j['level']==='critical')?'critical':e['some'](j=>j['level']==='high')?'high':e['some'](j=>j['level']==='medium')?'medium':'low',g={},h={};for(const j of e){g[j['category']]=(g[j['category']]??0x0)+0x1,h[j['level']]=(h[j['level']]??0x0)+0x1;}const i={};for(const k of e){for(const l of k['affected_stakeholders']){if(!i[l])i[l]=[];i[l]['push'](k['id']+':\x20'+k['mitigation']);}}return{'summary':'Assessed\x20'+e['length']+'\x20risk(s)\x20across\x20'+Object['keys'](g)['length']+'\x20categories','risks':e,'overall_risk':f,'risks_by_category':g,'risks_by_level':h,'stakeholder_advice':i,'needs_human_review':e['some'](m=>m['level']==='critical'||m['level']==='high'),'blocks_publish':e['some'](m=>m['level']==='critical')};}export{ALLOCATION_ERROR_CODES};
@@ -17,7 +17,7 @@ export interface AllocationTemplate {
17
17
  notes?: string[];
18
18
  }
19
19
  export declare const ALLOCATION_TEMPLATES: AllocationTemplate[];
20
- export declare const ALLOCATION_TEMPLATES_VERSION = "1.0.0";
20
+ export declare const ALLOCATION_TEMPLATES_VERSION = "1.1.0";
21
21
  export declare function getAllTemplates(): AllocationTemplate[];
22
22
  export declare function getTemplateById(id: string): AllocationTemplate | undefined;
23
23
  export declare function getTemplatesByScene(sceneId: string): AllocationTemplate[];
@@ -1 +1 @@
1
- export const ALLOCATION_TEMPLATES=[{'id':'T-A-01','name':'Single\x20Rate\x20100%\x20to\x20Treasury','description':'Simplest\x20allocation\x20—\x20single\x20Allocator,\x20single\x20Rate=10000\x20sharing\x20to\x20one\x20Treasury/personal\x20address','applicable_scenes':['allocation_merchant_full_payment'],'industry_tags':['universal','retail','service'],'params':[{'name':'allocation_name','type':'string','description':'Local\x20name\x20for\x20the\x20new\x20Allocation\x20object','required':!![]},{'name':'coin_type','type':'string','description':'Coin<T>\x20type\x20string\x20(e.g.\x20\x270x2::wow::WOW\x27)','required':!![]},{'name':'recipient_address','type':'address','description':'Treasury\x20or\x20personal\x20wallet\x20address\x20to\x20receive\x20100%','required':!![]},{'name':'guard_address','type':'address','description':'Guard\x20object\x20address\x20(verifies\x20order\x20completion)','required':!![]},{'name':'description','type':'string','description':'Allocation\x20description','required':![],'default':'Single\x20Rate\x20100%\x20allocation'}],'body':a=>({'object':{'name':a['allocation_name'],'type_parameter':a['coin_type']},'allocators':{'description':a['description']??'Single\x20Rate\x20100%\x20allocation','threshold':'0','allocators':[{'guard':a['guard_address'],'sharing':[{'who':{'Entity':a['recipient_address']},'sharing':'10000','mode':'Rate'}],'max':null}]},'coin':{'name':a['allocation_name']+'_coin'},'payment_info':{}}),'notes':['Simplest\x20configuration\x20—\x20no\x20multi-party\x20coordination','Guard\x20only\x20needs\x20to\x20verify\x20order\x20status,\x20no\x20complex\x20conditions','Suitable\x20for\x20solo\x20merchants\x20or\x20single-treasury\x20services']},{'id':'T-A-02','name':'Standard\x203-way\x20Rate\x20split','description':'Three-way\x20split:\x20merchant\x20/\x20platform\x20/\x20logistics.\x20Pure\x20Rate\x20mode,\x20sum(rates)\x20MUST\x20equal\x2010000','applicable_scenes':['allocation_standard_three_way_split'],'industry_tags':['retail','ecommerce','logistics'],'params':[{'name':'allocation_name','type':'string','description':'Local\x20name\x20for\x20the\x20new\x20Allocation\x20object','required':!![]},{'name':'coin_type','type':'string','description':'Coin<T>\x20type\x20string','required':!![]},{'name':'merchant_treasury','type':'address','description':'Merchant\x20Treasury\x20address','required':!![]},{'name':'platform_treasury','type':'address','description':'Platform\x20Treasury\x20address','required':!![]},{'name':'logistics_treasury','type':'address','description':'Logistics\x20Treasury\x20address\x20(set\x20to\x20platform_treasury\x20if\x20N/A)','required':!![]},{'name':'merchant_rate','type':'number','description':'Merchant\x20rate\x20in\x20basis\x20points\x20(e.g.\x208000\x20=\x2080%)','required':!![],'default':0x1f40},{'name':'platform_rate','type':'number','description':'Platform\x20rate\x20in\x20basis\x20points\x20(e.g.\x201000\x20=\x2010%)','required':!![],'default':0x3e8},{'name':'logistics_rate','type':'number','description':'Logistics\x20rate\x20in\x20basis\x20points\x20(e.g.\x201000\x20=\x2010%)','required':!![],'default':0x3e8},{'name':'guard_address','type':'address','description':'Guard\x20object\x20address\x20(verifies\x20order\x20completion\x20+\x20service\x20binding)','required':!![]}],'body':a=>{const b=Number(a['merchant_rate']),c=Number(a['platform_rate']),d=Number(a['logistics_rate']),e=b+c+d;if(e!==0x2710)throw new Error('T-A-02:\x20sum(rates)\x20MUST\x20equal\x2010000\x20(RATE_TOTAL_FULL),\x20got\x20'+e+'\x20'+('(merchant='+b+'\x20+\x20platform='+c+'\x20+\x20logistics='+d+')'));return{'object':{'name':a['allocation_name'],'type_parameter':a['coin_type']},'allocators':{'description':'3-way\x20split:\x20merchant\x20'+b+'/10000,\x20platform\x20'+c+'/10000,\x20logistics\x20'+d+'/10000','threshold':'0','allocators':[{'guard':a['guard_address'],'sharing':[{'who':{'Entity':a['merchant_treasury']},'sharing':String(b),'mode':'Rate'},{'who':{'Entity':a['platform_treasury']},'sharing':String(c),'mode':'Rate'},{'who':{'Entity':a['logistics_treasury']},'sharing':String(d),'mode':'Rate'}],'max':null}]},'coin':{'name':a['allocation_name']+'_coin'},'payment_info':{}};},'notes':['F-A-05:\x20sum(rates)\x20MUST\x20equal\x2010000\x20(pure\x20Rate\x20mode,\x20no\x20Surplus)','Treasury\x20Permission\x20should\x20match\x20Service\x20Permission\x20(R-A-3-02)','Guard\x20should\x20verify\x20order.service\x20binding\x20(query\x201563)\x20to\x20prevent\x20cross-project\x20bypass']},{'id':'T-A-03','name':'Refund-first\x20+\x20Surplus-to-merchant\x20(Amount\x20+\x20Surplus\x20hybrid)','description':'Single\x20Allocator\x20with\x202\x20sharing\x20items:\x20Amount=refund_value\x20to\x20customer,\x20Surplus\x20to\x20merchant','applicable_scenes':['allocation_refund_first_surplus_to_merchant'],'industry_tags':['retail','refund','customer_protection'],'params':[{'name':'allocation_name','type':'string','description':'Local\x20name\x20for\x20the\x20new\x20Allocation\x20object','required':!![]},{'name':'coin_type','type':'string','description':'Coin<T>\x20type\x20string','required':!![]},{'name':'customer_address','type':'address','description':'Customer\x20address\x20to\x20receive\x20refund\x20Amount','required':!![]},{'name':'merchant_treasury','type':'address','description':'Merchant\x20Treasury\x20address\x20to\x20receive\x20Surplus','required':!![]},{'name':'refund_amount','type':'number','description':'Refund\x20amount\x20in\x20smallest\x20coin\x20unit\x20(e.g.\x20MIST\x20for\x20WOW)','required':!![]},{'name':'guard_address','type':'address','description':'Guard\x20object\x20address\x20(verifies\x20refund\x20approval)','required':!![]},{'name':'description','type':'string','description':'Allocation\x20description','required':![],'default':'Refund-first\x20+\x20Surplus-to-merchant'}],'body':a=>{const b=Number(a['refund_amount']);if(b<=0x0)throw new Error('T-A-03:\x20refund_amount\x20MUST\x20be\x20>\x200,\x20got\x20'+b);return{'object':{'name':a['allocation_name'],'type_parameter':a['coin_type']},'allocators':{'description':a['description']??'Refund-first\x20+\x20Surplus-to-merchant','threshold':String(b),'allocators':[{'guard':a['guard_address'],'sharing':[{'who':{'Entity':a['customer_address']},'sharing':String(b),'mode':'Amount'},{'who':{'Entity':a['merchant_treasury']},'sharing':'0','mode':'Surplus'}],'max':null}]},'coin':{'name':a['allocation_name']+'_coin'},'payment_info':{}};},'notes':['F-A-04:\x20at\x20most\x201\x20Surplus\x20per\x20Allocator\x20(✓\x20single\x20Surplus\x20here)','F-A-07:\x20threshold\x20=\x20refundAmount\x20(ensure\x20balance\x20covers\x20Amount)','the\x20fix\x20is\x20cached\x20as\x20refundAmount\x20when\x20the\x20Allocator\x20is\x20added','Guard\x20must\x20verify\x20customer\x20refund\x20eligibility\x20(e.g.\x20order\x20status\x20=\x20Refunded)']},{'id':'T-A-04','name':'Treasury\x20+\x20Personal\x20alternative\x20(caller-specified\x20guard,\x202\x20Allocators)','description':'2\x20Allocators\x20as\x20alternative\x20strategies:\x20caller\x20selects\x20Treasury\x20or\x20Personal\x20wallet\x20via\x20alloc_by_guard\x20(hard\x20verification\x20per\x20call)','applicable_scenes':['allocation_treasury_personal_alternatives'],'industry_tags':['universal','alternative','treasury'],'params':[{'name':'allocation_name','type':'string','description':'Local\x20name\x20for\x20the\x20new\x20Allocation\x20object','required':!![]},{'name':'coin_type','type':'string','description':'Coin<T>\x20type\x20string','required':!![]},{'name':'treasury_address','type':'address','description':'Treasury\x20address\x20(primary\x20recipient)','required':!![]},{'name':'personal_address','type':'address','description':'Personal\x20wallet\x20address\x20(alternative\x20recipient)','required':!![]},{'name':'treasury_guard','type':'address','description':'Guard\x20for\x20Treasury\x20path\x20(verifies\x20treasury\x20operational)','required':!![]},{'name':'personal_guard','type':'address','description':'Guard\x20for\x20Personal\x20path\x20(verifies\x20personal\x20wallet\x20active)\x20—\x20MUST\x20differ\x20from\x20treasury_guard','required':!![]}],'body':a=>{if(a['treasury_guard']===a['personal_guard'])throw new Error('T-A-04:\x20treasury_guard\x20and\x20personal_guard\x20MUST\x20be\x20different\x20addresses\x20(F-A-14:\x20allocators[].guard\x20must\x20be\x20unique)');return{'object':{'name':a['allocation_name'],'type_parameter':a['coin_type']},'allocators':{'description':'Treasury\x20/\x20Personal\x20alternative\x20(caller-specified\x20guard)','threshold':'0','allocators':[{'guard':a['treasury_guard'],'sharing':[{'who':{'Entity':a['treasury_address']},'sharing':'10000','mode':'Rate'}],'max':null},{'guard':a['personal_guard'],'sharing':[{'who':{'Entity':a['personal_address']},'sharing':'10000','mode':'Rate'}],'max':null}]},'coin':{'name':a['allocation_name']+'_coin'},'payment_info':{}};},'notes':['F-A-14:\x20treasury_guard\x20!=\x20personal_guard\x20(Allocator\x20Guards\x20must\x20be\x20unique)','caller-specified\x20guard:\x20alloc_by_guard\x20explicitly\x20selects\x20an\x20Allocator;\x20the\x20Passport\x27s\x20guard\x20result\x20is\x20hard-verified\x20(failure\x20aborts\x20E_VERIFY_FAILED)','No\x20auto-fallback:\x20on\x20verification\x20failure\x20the\x20caller\x20must\x20switch\x20guard\x20and\x20retry','R-A-4-02:\x20if\x20the\x20caller\x27s\x20submitted\x20Passport\x20satisfies\x20both\x20Guards\x20simultaneously,\x20the\x20caller\x20may\x20freely\x20choose\x20between\x20the\x20two\x20paths\x20(mutual\x20exclusion\x20is\x20a\x20design\x20clarity\x20recommendation,\x20not\x20a\x20correctness\x20requirement)']},{'id':'T-A-05','name':'Tiered\x20by\x20order\x20amount\x20(mutually\x20exclusive\x20Guard\x20conditions)','description':'2\x20Allocators\x20triggered\x20by\x20mutually\x20exclusive\x20Guard\x20conditions\x20(small\x20order\x20vs\x20large\x20order)','applicable_scenes':['allocation_tiered_by_order_amount'],'industry_tags':['retail','tiered_pricing','volume_discount'],'params':[{'name':'allocation_name','type':'string','description':'Local\x20name\x20for\x20the\x20new\x20Allocation\x20object','required':!![]},{'name':'coin_type','type':'string','description':'Coin<T>\x20type\x20string','required':!![]},{'name':'merchant_treasury','type':'address','description':'Merchant\x20Treasury\x20address','required':!![]},{'name':'platform_treasury','type':'address','description':'Platform\x20Treasury\x20address','required':!![]},{'name':'small_order_guard','type':'address','description':'Guard\x20verifying\x20order.amount\x20<\x20threshold\x20(small\x20order\x20path)','required':!![]},{'name':'large_order_guard','type':'address','description':'Guard\x20verifying\x20order.amount\x20>=\x20threshold\x20(large\x20order\x20path)\x20—\x20MUST\x20differ\x20from\x20small_order_guard','required':!![]},{'name':'small_order_merchant_rate','type':'number','description':'Merchant\x20rate\x20for\x20small\x20orders\x20(e.g.\x2010000\x20=\x20100%)','required':!![],'default':0x2710},{'name':'large_order_merchant_rate','type':'number','description':'Merchant\x20rate\x20for\x20large\x20orders\x20(e.g.\x208000\x20=\x2080%)','required':!![],'default':0x1f40},{'name':'large_order_platform_rate','type':'number','description':'Platform\x20rate\x20for\x20large\x20orders\x20(e.g.\x202000\x20=\x2020%)','required':!![],'default':0x7d0}],'body':a=>{if(a['small_order_guard']===a['large_order_guard'])throw new Error('T-A-05:\x20small_order_guard\x20and\x20large_order_guard\x20MUST\x20be\x20different\x20addresses\x20(F-A-14)');const b=Number(a['small_order_merchant_rate']);if(b!==0x2710)throw new Error('T-A-05:\x20small_order_merchant_rate\x20MUST\x20equal\x2010000\x20(pure\x20Rate,\x20no\x20Surplus\x20in\x20this\x20Allocator),\x20got\x20'+b);const c=Number(a['large_order_merchant_rate']),d=Number(a['large_order_platform_rate']),e=c+d;if(e!==0x2710)throw new Error('T-A-05:\x20large_order\x20rates\x20MUST\x20sum\x20to\x2010000,\x20got\x20'+e+'\x20(merchant='+c+'\x20+\x20platform='+d+')');return{'object':{'name':a['allocation_name'],'type_parameter':a['coin_type']},'allocators':{'description':'Tiered\x20by\x20order\x20amount:\x20small=100%\x20merchant,\x20large=80/20\x20merchant/platform','threshold':'0','allocators':[{'guard':a['small_order_guard'],'sharing':[{'who':{'Entity':a['merchant_treasury']},'sharing':'10000','mode':'Rate'}],'max':null},{'guard':a['large_order_guard'],'sharing':[{'who':{'Entity':a['merchant_treasury']},'sharing':String(c),'mode':'Rate'},{'who':{'Entity':a['platform_treasury']},'sharing':String(d),'mode':'Rate'}],'max':null}]},'coin':{'name':a['allocation_name']+'_coin'},'payment_info':{}};},'notes':['Guard\x20conditions\x20MUST\x20be\x20mutually\x20exclusive\x20(R-A-4-02)','Sequence-sensitive:\x20strict\x20condition\x20(small\x20order)\x20first,\x20relaxed\x20condition\x20(large\x20order)\x20last','Guard\x20queries\x20order.amount\x20(query\x201561)\x20to\x20determine\x20which\x20Allocator\x20fires','If\x20neither\x20Guard\x20passes,\x20funds\x20are\x20silently\x20locked\x20(R-A-4-02)']},{'id':'T-A-06','name':'Dynamic\x20recipient\x20via\x20GuardIdentifier\x20(referrer\x20from\x20Passport)','description':'Single\x20Allocator\x20with\x203\x20Rate\x20sharing\x20items,\x20one\x20recipient\x20resolved\x20from\x20customer\x27s\x20Passport\x20table[0]','applicable_scenes':['allocation_dynamic_recipient'],'industry_tags':['referral','affiliate','marketing'],'params':[{'name':'allocation_name','type':'string','description':'Local\x20name\x20for\x20the\x20new\x20Allocation\x20object','required':!![]},{'name':'coin_type','type':'string','description':'Coin<T>\x20type\x20string','required':!![]},{'name':'merchant_treasury','type':'address','description':'Merchant\x20Treasury\x20address','required':!![]},{'name':'platform_treasury','type':'address','description':'Platform\x20Treasury\x20address','required':!![]},{'name':'guard_address','type':'address','description':'Guard\x20object\x20address\x20(must\x20be\x20configured\x20with\x20identifier=0\x20as\x20address\x20type)','required':!![]},{'name':'passport_identifier','type':'number','description':'Passport\x20table\x20identifier\x20(u8,\x200-255)\x20—\x20customer\x20submits\x20referrer\x20address\x20at\x20this\x20slot','required':!![],'default':0x0},{'name':'merchant_rate','type':'number','description':'Merchant\x20rate\x20in\x20basis\x20points\x20(e.g.\x208000\x20=\x2080%)','required':!![],'default':0x1f40},{'name':'platform_rate','type':'number','description':'Platform\x20rate\x20in\x20basis\x20points\x20(e.g.\x201000\x20=\x2010%)','required':!![],'default':0x3e8},{'name':'referrer_rate','type':'number','description':'Referrer\x20rate\x20in\x20basis\x20points\x20(e.g.\x201000\x20=\x2010%)','required':!![],'default':0x3e8}],'body':a=>{const b=Number(a['merchant_rate']),c=Number(a['platform_rate']),d=Number(a['referrer_rate']),e=b+c+d;if(e!==0x2710)throw new Error('T-A-06:\x20sum(rates)\x20MUST\x20equal\x2010000,\x20got\x20'+e+'\x20(merchant='+b+'\x20+\x20platform='+c+'\x20+\x20referrer='+d+')');const f=Number(a['passport_identifier']);if(f<0x0||f>0xff)throw new Error('T-A-06:\x20passport_identifier\x20MUST\x20be\x20u8\x20(0-255),\x20got\x20'+f);return{'object':{'name':a['allocation_name'],'type_parameter':a['coin_type']},'allocators':{'description':'Dynamic\x20recipient:\x20merchant\x20'+b+'/10000,\x20platform\x20'+c+'/10000,\x20referrer\x20'+d+'/10000\x20(from\x20Passport\x20identifier='+f+')','threshold':'0','allocators':[{'guard':a['guard_address'],'sharing':[{'who':{'Entity':a['merchant_treasury']},'sharing':String(b),'mode':'Rate'},{'who':{'Entity':a['platform_treasury']},'sharing':String(c),'mode':'Rate'},{'who':{'GuardIdentifier':f},'sharing':String(d),'mode':'Rate'}],'max':null}]},'coin':{'name':a['allocation_name']+'_coin'},'payment_info':{}};},'notes':['F-A-13:\x20Passport\x20table[identifier]\x20MUST\x20be\x20address\x20type\x20(else\x20ERECIPIENT_IDENTIFIER_NOT_ADDRESS=1)','The\x20Guard\x20identifier\x20slot\x27s\x20address-type\x20check\x20MUST\x20pass\x20when\x20the\x20Allocator\x20is\x20added\x20(else\x20the\x20Allocator\x20add\x20fails)','Customer\x20must\x20submit\x20Passport\x20with\x20referrer\x20address\x20at\x20the\x20specified\x20identifier\x20slot','Guard\x20should\x20verify\x20Passport\x20completeness\x20before\x20alloc()\x20executes']},{'id':'T-A-07','name':'Refund\x20to\x20the\x20submitted\x20Order\x20(100%\x20delivered\x20to\x20the\x20order\x20as\x20escrow)','description':'Single\x20Allocator,\x201\x20Rate=10000\x20sharing\x20whose\x20recipient\x20is\x20the\x20order\x20submitted\x20at\x20alloc\x20time\x20(Guard\x20table\x20identifier\x200).\x20The\x20funds\x20are\x20delivered\x20to\x20that\x20order\x20and\x20received\x20by\x20its\x20owner.','applicable_scenes':['allocation_refund_to_order'],'industry_tags':['refund','customer_protection','order_lifecycle'],'params':[{'name':'allocation_name','type':'string','description':'Local\x20name\x20for\x20the\x20new\x20Allocation\x20object','required':!![]},{'name':'coin_type','type':'string','description':'Coin<T>\x20type\x20string','required':!![]},{'name':'guard_address','type':'address','description':'Guard\x20verifying\x20the\x20submitted\x20order\x20qualifies\x20(e.g.\x20order\x20at\x20the\x20refund\x20node,\x20order.service\x20==\x20host\x20service).\x20Its\x20table\x20needs\x20an\x20address-typed\x20b_submission\x20slot\x20at\x20identifier\x200.','required':!![]}],'body':a=>({'object':{'name':a['allocation_name'],'type_parameter':a['coin_type']},'allocators':{'description':'Refund\x20to\x20the\x20submitted\x20Order\x20(100%\x20delivered\x20to\x20the\x20order\x20as\x20escrow)','threshold':'0','allocators':[{'guard':a['guard_address'],'sharing':[{'who':{'GuardIdentifier':0x0},'sharing':'10000','mode':'Rate'}],'max':null}]},'coin':{'name':a['allocation_name']+'_coin'},'payment_info':{}}),'notes':['The\x20Guard\x20table\x20MUST\x20have\x20an\x20address-typed\x20b_submission\x20slot\x20at\x20identifier\x200\x20carrying\x20the\x20submitted\x20order\x20(else\x20the\x20Allocator\x20add\x20fails\x20with\x20ERECIPIENT_IDENTIFIER_NOT_ADDRESS).','At\x20alloc\x20time\x20the\x20full\x20Rate\x20is\x20delivered\x20to\x20the\x20submitted\x20order\x20as\x20a\x20CoinWrapper\x20—\x20the\x20order\x20object\x20owns\x20it.\x20Its\x20owner\x20subsequently\x20receives\x20the\x20bare\x20coins\x20through\x20the\x20order\x27s\x20owner-receive\x20entry;\x20unrelated\x20addresses\x20cannot\x20intercept.','The\x20Guard\x20decides\x20which\x20submitted\x20orders\x20qualify:\x20node\x20state\x20plus\x20a\x20service-scope\x20binding\x20(order.service\x20==\x20host\x20service)\x20are\x20the\x20typical\x20conditions;\x20tightening\x20those\x20conditions\x20is\x20how\x20the\x20destination\x20is\x20controlled.','When\x20the\x20per-order\x20Allocation\x20is\x20created\x20through\x20the\x20Service\x20flow,\x20payment_info.for_object\x20is\x20set\x20to\x20the\x20order\x20the\x20allocation\x20belongs\x20to,\x20recording\x20the\x20business\x20context\x20auditors\x20can\x20query.']},{'id':'T-A-08','name':'Arbitration\x20fees\x20split\x20(arbitrator\x2080%\x20/\x20platform\x2020%)','description':'Single\x20Allocator,\x202\x20Rate\x20sharing\x20items.\x20Triggered\x20by\x20the\x20Arbitration\x20fees-distribution\x20operation\x20(permission\x20365),\x20with\x20or\x20without\x20a\x20Passport.','applicable_scenes':['allocation_arbitration_fees'],'industry_tags':['arbitration','dispute','fees'],'params':[{'name':'allocation_name','type':'string','description':'Local\x20name\x20for\x20the\x20new\x20Allocation\x20object','required':!![]},{'name':'coin_type','type':'string','description':'Coin<T>\x20type\x20string\x20(must\x20match\x20Arbitration\x20fee\x20Coin\x20type)','required':!![]},{'name':'arbitrator_treasury','type':'address','description':'Arbitrator\x20Treasury\x20address','required':!![]},{'name':'platform_treasury','type':'address','description':'Platform\x20Treasury\x20address','required':!![]},{'name':'arbitrator_rate','type':'number','description':'Arbitrator\x20rate\x20in\x20basis\x20points\x20(e.g.\x208000\x20=\x2080%)','required':!![],'default':0x1f40},{'name':'platform_rate','type':'number','description':'Platform\x20rate\x20in\x20basis\x20points\x20(e.g.\x202000\x20=\x2020%)','required':!![],'default':0x7d0},{'name':'guard_address','type':'address','description':'Guard\x20object\x20address\x20(verifies\x20Arbitration\x20ruling\x20finalized)','required':!![]}],'body':a=>{const b=Number(a['arbitrator_rate']),c=Number(a['platform_rate']),d=b+c;if(d!==0x2710)throw new Error('T-A-08:\x20sum(rates)\x20MUST\x20equal\x2010000,\x20got\x20'+d+'\x20(arbitrator='+b+'\x20+\x20platform='+c+')');return{'object':{'name':a['allocation_name'],'type_parameter':a['coin_type']},'allocators':{'description':'Arbitration\x20fees\x20split:\x20arbitrator\x20'+b+'/10000,\x20platform\x20'+c+'/10000','threshold':'0','allocators':[{'guard':a['guard_address'],'sharing':[{'who':{'Entity':a['arbitrator_treasury']},'sharing':String(b),'mode':'Rate'},{'who':{'Entity':a['platform_treasury']},'sharing':String(c),'mode':'Rate'}],'max':null}]},'coin':{'name':a['allocation_name']+'_coin'},'payment_info':{}};},'notes':['Triggered\x20by\x20the\x20Arbitration\x20fees-distribution\x20operation\x20(permission\x20ARBITRATION_FEES_ALLOC=365),\x20with\x20or\x20without\x20a\x20Passport','Independent\x20from\x20Service-order\x20Allocation\x20(this\x20Allocation\x20is\x20not\x20bound\x20to\x20Order)','payment_info\x20typically\x20reuses\x20Arbitration\x27s\x20payment_info','Caller\x20MUST\x20hold\x20ARBITRATION_FEES_ALLOC=365\x20permission']},{'id':'T-A-09','name':'Standalone\x20periodic\x20split\x20(investment\x20dividends\x20/\x20shared\x20income)','description':'Standalone\x20Allocation\x20with\x20single\x20Allocator,\x20N\x20Rate\x20sharing\x20items\x20to\x20beneficiary\x20wallets.\x20No\x20Service\x20context.\x20Guard\x20provides\x20time-based\x20or\x20signer-based\x20access\x20control.','applicable_scenes':['allocation_standalone_periodic_split'],'industry_tags':['standalone','investment','dividends','shared_income'],'params':[{'name':'allocation_name','type':'string','description':'Local\x20name\x20for\x20the\x20new\x20Allocation\x20object','required':!![]},{'name':'coin_type','type':'string','description':'Coin<T>\x20type\x20string\x20(e.g.\x20\x270x2::wow::WOW\x27\x20or\x20profit\x20token\x20type)','required':!![]},{'name':'beneficiaries','type':'address[]','description':'Array\x20of\x20beneficiary\x20wallet\x20addresses\x20(NOT\x20Treasury\x20objects\x20—\x20standalone\x20mode\x20has\x20no\x20Service\x20context)','required':!![]},{'name':'rates','type':'string[]','description':'Array\x20of\x20rates\x20in\x20basis\x20points\x20(e.g.\x20[\x275000\x27,\x273000\x27,\x272000\x27]\x20=\x2050%/30%/20%).\x20MUST\x20sum\x20to\x2010000.','required':!![]},{'name':'guard_address','type':'address','description':'Guard\x20object\x20address\x20—\x20MUST\x20bind\x20Signer\x20or\x20verify\x20time-based\x20trigger\x20(R-A-3-04:\x20standalone\x20has\x20no\x20Service-layer\x20access\x20control)','required':!![]},{'name':'description','type':'string','description':'Allocation\x20description','required':![],'default':'Standalone\x20periodic\x20split'}],'body':a=>{const b=a['beneficiaries'],c=a['rates']['map'](e=>Number(e));if(b['length']!==c['length'])throw new Error('T-A-09:\x20beneficiaries\x20('+b['length']+')\x20and\x20rates\x20('+c['length']+')\x20MUST\x20have\x20equal\x20length');if(b['length']===0x0)throw new Error('T-A-09:\x20at\x20least\x201\x20beneficiary\x20required');if(b['length']>0x64)throw new Error('T-A-09:\x20beneficiaries\x20count\x20'+b['length']+'\x20exceeds\x20MAX_SHARING_COUNT\x20(100)');const d=c['reduce']((e,f)=>e+f,0x0);if(d!==0x2710)throw new Error('T-A-09:\x20sum(rates)\x20MUST\x20equal\x2010000\x20(RATE_TOTAL_FULL),\x20got\x20'+d);return{'object':{'name':a['allocation_name'],'type_parameter':a['coin_type']},'allocators':{'description':a['description']??'Standalone\x20periodic\x20split','threshold':'0','allocators':[{'guard':a['guard_address'],'sharing':b['map']((e,f)=>({'who':{'Entity':e},'sharing':String(c[f]),'mode':'Rate'})),'max':null}]},'coin':{'name':a['allocation_name']+'_coin'},'payment_info':{}};},'notes':['Standalone\x20mode\x20(§0):\x20no\x20Service/Order/Arbitration\x20context\x20required','R-A-3-04:\x20Guard\x20MUST\x20bind\x20Signer\x20or\x20verify\x20time-based\x20trigger\x20—\x20no\x20Service-layer\x20access\x20control\x20exists','F-A-05:\x20sum(rates)\x20MUST\x20equal\x2010000\x20(pure\x20Rate\x20mode,\x20no\x20Surplus)','Caller\x20lifecycle:\x20receive()\x20to\x20deposit\x20funds\x20→\x20alloc()\x20to\x20trigger\x20distribution','Guard\x20should\x20bind\x20context(Signer)==authorized\x20to\x20prevent\x20unauthorized\x20alloc()\x20calls','beneficiaries\x20are\x20personal\x20wallets,\x20NOT\x20Treasury\x20objects\x20(no\x20Service\x20context)']},{'id':'T-A-10','name':'Standalone\x20vesting\x20release\x20(time-locked\x20multi-stage\x20unlock)','description':'Standalone\x20Allocation\x20with\x20N\x20Allocators\x20(default\x203\x20stages),\x20each\x20triggered\x20by\x20a\x20time-locked\x20Guard.\x20Stages\x201..N-1\x20use\x20Amount\x20mode;\x20final\x20stage\x20uses\x20Surplus\x20to\x20drain\x20remaining\x20balance.\x20No\x20Service\x20context.','applicable_scenes':['allocation_standalone_vesting'],'industry_tags':['standalone','vesting','time_lock','team_tokens'],'params':[{'name':'allocation_name','type':'string','description':'Local\x20name\x20for\x20the\x20new\x20Allocation\x20object','required':!![]},{'name':'coin_type','type':'string','description':'Coin<T>\x20type\x20string\x20(vested\x20asset,\x20e.g.\x20locked\x20team\x20tokens)','required':!![]},{'name':'beneficiary_address','type':'address','description':'Single\x20beneficiary\x20wallet\x20address\x20(vesting\x20recipient)','required':!![]},{'name':'stage_1_guard','type':'address','description':'Guard\x20for\x20stage\x201\x20(verifies\x20context(Clock).timestamp\x20>=\x20stage_1_unlock)','required':!![]},{'name':'stage_1_amount','type':'number','description':'Amount\x20to\x20release\x20at\x20stage\x201\x20(smallest\x20coin\x20unit,\x20e.g.\x20MIST)','required':!![]},{'name':'stage_2_guard','type':'address','description':'Guard\x20for\x20stage\x202\x20(verifies\x20context(Clock).timestamp\x20>=\x20stage_2_unlock)\x20—\x20MUST\x20differ\x20from\x20stage_1_guard','required':!![]},{'name':'stage_2_amount','type':'number','description':'Amount\x20to\x20release\x20at\x20stage\x202\x20(smallest\x20coin\x20unit)','required':!![]},{'name':'stage_3_guard','type':'address','description':'Guard\x20for\x20stage\x203\x20(final\x20stage,\x20uses\x20Surplus\x20to\x20drain\x20remaining\x20balance)\x20—\x20MUST\x20differ\x20from\x20stage_1_guard\x20and\x20stage_2_guard','required':!![]},{'name':'max_cap','type':'number','description':'Maximum\x20cumulative\x20release\x20cap\x20(applied\x20to\x20stages\x201\x20and\x202\x20via\x20max\x20field).\x20Stage\x203\x20uses\x20Surplus\x20so\x20no\x20max\x20needed.','required':![]},{'name':'description','type':'string','description':'Allocation\x20description','required':![],'default':'Standalone\x20vesting\x20release\x20(3-stage\x20time-locked)'}],'body':a=>{const b=[a['stage_1_guard'],a['stage_2_guard'],a['stage_3_guard']],c=new Set(b);if(c['size']!==b['length']){const h=b['filter']((j,k)=>b['indexOf'](j)!==k);throw new Error('T-A-10:\x20stage\x20guards\x20MUST\x20be\x20unique\x20(F-A-14),\x20duplicates:\x20'+h['join'](',\x20'));}const d=Number(a['stage_1_amount']),e=Number(a['stage_2_amount']);if(d<=0x0||e<=0x0)throw new Error('T-A-10:\x20stage_1_amount\x20and\x20stage_2_amount\x20MUST\x20be\x20>\x200,\x20got\x20stage1='+d+',\x20stage2='+e);const f=d+e,g=a['max_cap']!=null?Number(a['max_cap']):null;if(g!==null&&f>g)throw new Error('T-A-10:\x20stage_1_amount\x20+\x20stage_2_amount\x20('+f+')\x20MUST\x20be\x20<=\x20max_cap\x20('+g+')\x20—\x20F-A-08\x20(EAMOUNT_EXCEEDS_MAX)');return{'object':{'name':a['allocation_name'],'type_parameter':a['coin_type']},'allocators':{'description':a['description']??'Standalone\x20vesting\x20release\x20(3-stage\x20time-locked)','threshold':'0','allocators':[{'guard':a['stage_1_guard'],'sharing':[{'who':{'Entity':a['beneficiary_address']},'sharing':String(d),'mode':'Amount'}],'max':g!=null?String(g):null},{'guard':a['stage_2_guard'],'sharing':[{'who':{'Entity':a['beneficiary_address']},'sharing':String(e),'mode':'Amount'}],'max':g!=null?String(g):null},{'guard':a['stage_3_guard'],'sharing':[{'who':{'Entity':a['beneficiary_address']},'sharing':'0','mode':'Surplus'}],'max':null}]},'coin':{'name':a['allocation_name']+'_coin'},'payment_info':{}};},'notes':['Standalone\x20mode\x20(§0):\x20no\x20Service/Order/Arbitration\x20context\x20required','R-A-3-04:\x20Guard\x20time-lock\x20MUST\x20be\x20enforced\x20—\x20no\x20Service-layer\x20access\x20control\x20exists','F-A-14:\x20stage_1_guard,\x20stage_2_guard,\x20stage_3_guard\x20MUST\x20be\x20unique\x20(duplicate\x20guards\x20are\x20dead\x20code)','F-A-04:\x20at\x20most\x201\x20Surplus\x20per\x20Allocator\x20(stage\x203\x20uses\x20Surplus\x20to\x20drain\x20remainder)','F-A-08:\x20stage_1_amount\x20+\x20stage_2_amount\x20MUST\x20be\x20<=\x20max_cap\x20(if\x20max_cap\x20provided)','R-A-4-01:\x20if\x20caller\x20calls\x20alloc()\x20before\x20stage\x20time-lock\x20expires,\x20alloc()\x20silently\x20returns\x20—\x20caller\x20should\x20check\x20balance==0\x20after\x20alloc()','R-A-4-02:\x20Guard\x20conditions\x20SHOULD\x20be\x20mutually\x20exclusive\x20by\x20timestamp\x20(e.g.\x20stage_1:\x20ts<stage_2_unlock,\x20stage_2:\x20stage_2_unlock<=ts<stage_3_unlock,\x20stage_3:\x20ts>=stage_3_unlock)','Caller\x20lifecycle:\x20receive()\x20to\x20deposit\x20locked\x20tokens\x20→\x20alloc()\x20at\x20each\x20vesting\x20milestone']},{'id':'T-A-11','name':'Standalone\x20payroll\x20/\x20salary\x20distribution\x20(issuer\x20+\x20Repository\x20verified)','description':'Standalone\x20Allocation\x20for\x20periodic\x20payroll:\x20employees\x20receive\x20Rate\x20shares.\x20The\x20Guard\x20binds\x20the\x20issuer\x20Signer\x20identity\x20and\x20cross-checks\x20a\x20Repository\x20payroll\x20record\x20(period\x20and\x20amounts).\x20No\x20Service\x20context.','applicable_scenes':['allocation_standalone_payroll'],'industry_tags':['standalone','payroll','salary','compensation','hr'],'params':[{'name':'allocation_name','type':'string','description':'Local\x20name\x20for\x20the\x20new\x20Allocation\x20object','required':!![]},{'name':'coin_type','type':'string','description':'Coin<T>\x20type\x20string\x20used\x20for\x20payroll\x20(e.g.\x20\x270x2::wow::WOW\x27)','required':!![]},{'name':'employees','type':'address[]','description':'Employee\x20wallet\x20addresses\x20(Recipient::Entity\x20recipients)','required':!![]},{'name':'rates','type':'string[]','description':'Per-employee\x20rates\x20in\x20basis\x20points\x20(e.g.\x20[\x276000\x27,\x274000\x27]).\x20MUST\x20sum\x20to\x2010000.','required':!![]},{'name':'guard_address','type':'address','description':'Guard\x20that\x20binds\x20Signer\x20==\x20issuer\x20AND\x20cross-checks\x20the\x20Repository\x20payroll\x20record\x20(both\x20required)','required':!![]},{'name':'payroll_period','type':'string','description':'Human-readable\x20period\x20label\x20(e.g.\x20\x272025-W26\x27)\x20—\x20recorded\x20in\x20the\x20Allocation\x20description\x20for\x20audit','required':!![]},{'name':'description','type':'string','description':'Allocation\x20description','required':![],'default':'Standalone\x20payroll\x20distribution'}],'body':a=>{const b=a['employees'],c=a['rates']['map'](e=>Number(e));if(b['length']!==c['length'])throw new Error('T-A-11:\x20employees\x20('+b['length']+')\x20and\x20rates\x20('+c['length']+')\x20MUST\x20have\x20equal\x20length');if(b['length']===0x0)throw new Error('T-A-11:\x20at\x20least\x201\x20employee\x20required');if(b['length']>0x64)throw new Error('T-A-11:\x20employees\x20count\x20'+b['length']+'\x20exceeds\x20MAX_SHARING_COUNT\x20(100)');const d=c['reduce']((e,f)=>e+f,0x0);if(d!==0x2710)throw new Error('T-A-11:\x20sum(rates)\x20MUST\x20equal\x2010000\x20(RATE_TOTAL_FULL),\x20got\x20'+d);return{'object':{'name':a['allocation_name'],'type_parameter':a['coin_type']},'allocators':{'description':(a['description']??'Standalone\x20payroll\x20distribution')+'\x20—\x20period:\x20'+a['payroll_period'],'threshold':'0','allocators':[{'guard':a['guard_address'],'sharing':b['map']((e,f)=>({'who':{'Entity':e},'sharing':String(c[f]),'mode':'Rate'})),'max':null}]},'coin':{'name':a['allocation_name']+'_coin'},'payment_info':{}};},'notes':['Standalone\x20mode:\x20no\x20Service/Order/Arbitration\x20context\x20required','RC-FIND-04:\x20the\x20Guard\x20MUST\x20bind\x20the\x20issuer\x20identity\x20(Signer\x20==\x20employer/admin,\x20or\x20a\x20Permission\x20member)\x20—\x20standalone\x20has\x20no\x20Service\x20access-control\x20layer','Repository\x20distinction:\x20the\x20Guard\x20MUST\x20cross-check\x20the\x20Repository\x20payroll\x20record\x20(period\x20hash,\x20amounts\x20and\x20recipients)\x20so\x20the\x20distribution\x20is\x20tied\x20to\x20auditable\x20work/payroll\x20data','Auditability:\x20the\x20Guard\x20rules\x20are\x20public\x20—\x20third\x20parties\x20verify\x20who\x20may\x20distribute\x20and\x20what\x20inputs\x20distinguish\x20a\x20valid\x20payroll','F-A-05:\x20sum(rates)\x20MUST\x20equal\x2010000\x20(pure\x20Rate\x20mode)','Caller\x20lifecycle:\x20issuer\x20receive()\x20to\x20fund\x20payroll\x20→\x20alloc()\x20after\x20the\x20Repository\x20record\x20for\x20the\x20period\x20is\x20committed','Employees\x20are\x20personal\x20wallets\x20(Recipient::Entity),\x20never\x20Recipient::Signer']}];export const ALLOCATION_TEMPLATES_VERSION='1.0.0';export function getAllTemplates(){return[...ALLOCATION_TEMPLATES];}export function getTemplateById(a){return ALLOCATION_TEMPLATES['find'](b=>b['id']===a);}export function getTemplatesByScene(a){return ALLOCATION_TEMPLATES['filter'](b=>b['applicable_scenes']['includes'](a));}export function getTemplatesByIndustry(a){return ALLOCATION_TEMPLATES['filter'](b=>b['industry_tags']['includes'](a)||b['industry_tags']['includes']('universal'));}export function suggestTemplateForScene(a){const b=getTemplatesByScene(a);return b['length']>0x0?b[0x0]:undefined;}export function listTemplates(){return ALLOCATION_TEMPLATES['map'](a=>({'id':a['id'],'name':a['name'],'description':a['description'],'scenes':a['applicable_scenes']}));}export function fillTemplate(a,b){const c=getTemplateById(a);if(!c)return{'ok':![],'error':'Template\x20'+a+'\x20not\x20found'};for(const d of c['params']){if(d['required']&&!(d['name']in b))return{'ok':![],'error':'Missing\x20required\x20param:\x20'+d['name']};}try{return{'ok':!![],'body':c['body'](b)};}catch(f){return{'ok':![],'error':f instanceof Error?f['message']:String(f)};}}
1
+ function assert_declared_share(a,b,c,d){const e=c===undefined||c===null||c===''?d:c,f=Number(e);if(!Number['isInteger'](f))throw new Error('E-RATE-EXPLICIT:\x20'+a+':\x20'+b+'\x20MUST\x20be\x20an\x20explicit\x20integer\x20number\x20of\x20basis\x20points\x20'+('(the\x20buyer\x20must\x20be\x20able\x20to\x20compute\x20it\x20pre-order;\x20never\x20an\x20implicit\x20remainder),\x20got\x20'+String(c)));if(f<0x0||f>0x2710)throw new Error('E-RATE-RANGE:\x20'+a+':\x20'+b+'\x20MUST\x20be\x20within\x20[0,\x2010000],\x20got\x20'+f);return f;}function assert_explicit_recipient(a,b,c,d){if(d<=0x0)return;const e=typeof c==='string'?c['trim']():'';if(e['length']===0x0)throw new Error('E-RECIPIENT-UNDEFINED:\x20'+a+':\x20'+b+'\x20MUST\x20be\x20a\x20non-empty\x20explicit\x20recipient\x20'+('because\x20its\x20rate\x20is\x20'+d+'\x20>\x200.\x20A\x20blank/omitted\x20recipient\x20silently\x20falls\x20back\x20to\x20')+'Account.Instance().get_address(undefined)\x20=\x20the\x20deploying\x20account\x20(ts-sdk/packages/wowok/src/w/local/index.ts:89-91),\x20'+'so\x20the\x20outflow\x20would\x20go\x20to\x20whoever\x20ran\x20the\x20deploy.');if(e['toLowerCase']()['startsWith']('0x')){const f=e['slice'](0x2);if(f['length']===0x0||!/^[0-9a-f]+$/['test'](f)||/^0+$/['test'](f))throw new Error('E-RECIPIENT-UNDEFINED:\x20'+a+':\x20'+b+'\x20looks\x20like\x20an\x20address\x20but\x20carries\x20no\x20'+('identity\x20(\x22'+e+'\x22).\x20Point\x20it\x20at\x20the\x20declared\x20recipient\x20Entity\x20(a\x20Treasury/Entity\x20address\x20the\x20')+'buyer\x20can\x20see\x20pre-order).');}}export const ALLOCATION_TEMPLATES=[{'id':'T-A-01','name':'Single\x20Rate\x20100%\x20to\x20Treasury','description':'Simplest\x20allocation\x20—\x20single\x20Allocator,\x20single\x20Rate=10000\x20sharing\x20to\x20one\x20Treasury/personal\x20address','applicable_scenes':['allocation_merchant_full_payment'],'industry_tags':['universal','retail','service'],'params':[{'name':'allocation_name','type':'string','description':'Local\x20name\x20for\x20the\x20new\x20Allocation\x20object','required':!![]},{'name':'coin_type','type':'string','description':'Coin<T>\x20type\x20string\x20(e.g.\x20\x270x2::wow::WOW\x27)','required':!![]},{'name':'recipient_address','type':'address','description':'Treasury\x20or\x20personal\x20wallet\x20address\x20to\x20receive\x20100%','required':!![]},{'name':'guard_address','type':'address','description':'Guard\x20object\x20address\x20(verifies\x20order\x20completion)','required':!![]},{'name':'description','type':'string','description':'Allocation\x20description','required':![],'default':'Single\x20Rate\x20100%\x20allocation'}],'body':a=>({'object':{'name':a['allocation_name'],'type_parameter':a['coin_type']},'allocators':{'description':a['description']??'Single\x20Rate\x20100%\x20allocation','threshold':'0','allocators':[{'guard':a['guard_address'],'sharing':[{'who':{'Entity':a['recipient_address']},'sharing':'10000','mode':'Rate'}],'max':null}]},'coin':{'name':a['allocation_name']+'_coin'},'payment_info':{}}),'notes':['Simplest\x20configuration\x20—\x20no\x20multi-party\x20coordination','Guard\x20only\x20needs\x20to\x20verify\x20order\x20status,\x20no\x20complex\x20conditions','Suitable\x20for\x20solo\x20merchants\x20or\x20single-treasury\x20services','DIRECT-SALES\x20DEFAULT\x20SHAPE\x20(L2):\x20this\x20IS\x20the\x20default\x20payout\x20form\x20—\x20one\x20Rate\x2010000\x20leg\x20to\x20the\x20merchant\x27s\x20own\x20Entity.\x20No\x20platform\x20leg\x20exists,\x20and\x20nothing\x20is\x20left\x20over','If\x20the\x20merchant\x20declares\x20its\x20OWN\x20fee,\x20use\x20T-A-02\x20(an\x20explicit\x20fee\x20leg\x20to\x20an\x20explicit\x20non-empty\x20recipient)\x20instead\x20of\x20shrinking\x20this\x20leg\x20and\x20routing\x20the\x20difference\x20through\x20an\x20implicit\x20remainder\x20(L3)','A\x20BLANK\x20recipient_address\x20is\x20NOT\x20a\x20no-op:\x20it\x20resolves\x20to\x20Account.Instance().get_address(undefined),\x20the\x20logged-in/deploying\x20account\x20(ts-sdk/packages/wowok/src/w/local/index.ts:89-91)\x20—\x20so\x20this\x20template\x20pays\x20whoever\x20ran\x20the\x20deploy']},{'id':'T-A-02','name':'Merchant\x20payout\x20+\x20optional\x20declared\x20fee\x20/\x20third-party\x20leg\x20(merchant\x20keeps\x20100%\x20by\x20default)','description':'DIRECT-SALES\x20split:\x20the\x20merchant\x20keeps\x20the\x20whole\x20sale\x20by\x20default\x20(one\x20Rate\x2010000\x20leg\x20to\x20its\x20own\x20Entity).\x20Optional\x20extra\x20legs\x20are\x20(a)\x20the\x20merchant\x27s\x20OWN\x20service\x20fee\x20—\x20only\x20when\x20the\x20merchant\x20IS\x20the\x20aggregator\x20—\x20and\x20(b)\x20a\x20genuine\x20third-party\x20payment\x20(logistics\x20provider,\x20arbitrator,\x20partner),\x20which\x20is\x20a\x20payment\x20for\x20a\x20service,\x20not\x20platform\x20extraction.\x20Pure\x20Rate\x20mode:\x20the\x20emitted\x20sharing\x20rows\x20MUST\x20sum\x20to\x20exactly\x2010000,\x20and\x20with\x20the\x20default\x20parameters\x20they\x20are\x20a\x20single\x2010000\x20row.\x20L3\x20fee\x20rule:\x20(1)\x20an\x20EXPLICIT\x20number\x20the\x20buyer\x20can\x20compute\x20BEFORE\x20ordering,\x20never\x20an\x20implicit\x20remainder\x20such\x20as\x20\x27order\x20total\x20-\x20segment\x20sums\x27;\x20(2)\x20an\x20explicit\x20NON-EMPTY\x20recipient\x20Entity\x20the\x20buyer\x20can\x20see\x20pre-order\x20(a\x20blank\x20recipient\x20is\x20NOT\x20a\x20no-op\x20—\x20it\x20falls\x20back\x20to\x20the\x20deploying\x20account,\x20ts-sdk/packages/wowok/src/w/local/index.ts:89-91);\x20(3)\x20no\x20mandatory\x20transit\x20pool\x20on\x20the\x20payout\x20path,\x20and\x20the\x20fee\x20is\x20NEVER\x20taken\x20via\x20a\x20Surplus\x20leg\x20(Surplus\x20calls\x20balance::withdraw_all,\x20so\x20it\x20doubles\x20as\x20draining\x20the\x20pool).\x20WoWok\x20itself\x20takes\x20nothing.','applicable_scenes':['allocation_standard_three_way_split'],'industry_tags':['retail','ecommerce','logistics'],'params':[{'name':'allocation_name','type':'string','description':'Local\x20name\x20for\x20the\x20new\x20Allocation\x20object','required':!![]},{'name':'coin_type','type':'string','description':'Coin<T>\x20type\x20string','required':!![]},{'name':'merchant_treasury','type':'address','description':'Merchant\x20Entity\x20that\x20receives\x20its\x20own\x20sale\x20proceeds\x20—\x20the\x20direct-sales\x20destination.\x20Required\x20and\x20never\x20blank\x20(blank\x20silently\x20routes\x20the\x20payout\x20to\x20the\x20deploying\x20account,\x20ts-sdk/packages/wowok/src/w/local/index.ts:89-91).','required':!![]},{'name':'merchant_fee_treasury','type':'address','description':'Recipient\x20Entity\x20of\x20merchant_service_fee_bps.\x20MUST\x20be\x20an\x20explicit\x20NON-EMPTY\x20address\x20whenever\x20merchant_service_fee_bps\x20>\x200\x20—\x20leaving\x20it\x20blank\x20or\x20omitting\x20it\x20is\x20NOT\x20a\x20no-op:\x20the\x20share\x20silently\x20goes\x20to\x20Account.Instance().get_address(undefined)\x20=\x20the\x20deploying\x20account\x20(ts-sdk/packages/wowok/src/w/local/index.ts:89-91).\x20Pass\x20merchant_treasury\x20if\x20the\x20merchant\x20charges\x20itself.','required':![]},{'name':'third_party_treasury','type':'address','description':'Recipient\x20Entity\x20of\x20third_party_rate\x20(e.g.\x20the\x20logistics\x20provider\x27s\x20own\x20Treasury).\x20MUST\x20be\x20explicit\x20and\x20non-empty\x20whenever\x20third_party_rate\x20>\x200\x20—\x20same\x20blank-fallback\x20hazard\x20as\x20merchant_fee_treasury.','required':![]},{'name':'merchant_rate','type':'number','description':'Merchant\x27s\x20own\x20share\x20in\x20basis\x20points.\x20Default\x2010000\x20=\x20the\x20merchant\x20keeps\x20the\x20whole\x20sale\x20(direct\x20sales:\x20no\x20platform\x20take).','required':![],'default':0x2710},{'name':'merchant_service_fee_bps','type':'number','description':'The\x20MERCHANT\x27S\x20OWN\x20service\x20fee\x20in\x20basis\x20points.\x20KEEP\x20AT\x200\x20unless\x20the\x20merchant\x20IS\x20the\x20aggregator\x20(chain\x20/\x20multi-supplier\x20orchestrator\x20/\x20consortium\x20/\x20an\x20OTA\x20that\x20really\x20is\x20the\x20seller\x27s\x20counterparty).\x20WoWok\x20extracts\x20nothing\x20—\x20this\x20is\x20the\x20merchant\x27s\x20own\x20declared\x20price,\x20never\x20a\x20platform\x20share.\x20Explicit\x20number\x20the\x20buyer\x20can\x20compute\x20before\x20ordering;\x20merchant_rate\x20+\x20merchant_service_fee_bps\x20+\x20third_party_rate\x20MUST\x20sum\x20to\x2010000.','required':![],'default':0x0},{'name':'third_party_rate','type':'number','description':'Rate\x20for\x20a\x20genuine\x20third-party\x20payment\x20(logistics\x20provider\x20/\x20arbitrator\x20/\x20supply-chain\x20partner),\x20default\x200.\x20Kept\x20expressible\x20on\x20purpose\x20—\x20a\x20real\x20provider\x20fee\x20is\x20a\x20payment\x20FOR\x20a\x20service\x20—\x20but\x20it\x20must\x20be\x20an\x20explicit\x20number\x20with\x20an\x20explicit\x20recipient,\x20exactly\x20like\x20the\x20merchant\x20fee.','required':![],'default':0x0},{'name':'guard_address','type':'address','description':'Guard\x20object\x20address\x20(verifies\x20order\x20completion\x20+\x20service\x20binding)','required':!![]}],'body':a=>{const b=assert_declared_share('T-A-02','merchant_rate',a['merchant_rate'],0x2710),c=assert_declared_share('T-A-02','merchant_service_fee_bps',a['merchant_service_fee_bps'],0x0),d=assert_declared_share('T-A-02','third_party_rate',a['third_party_rate'],0x0);assert_explicit_recipient('T-A-02','merchant_treasury',a['merchant_treasury'],b),assert_explicit_recipient('T-A-02','merchant_fee_treasury',a['merchant_fee_treasury'],c),assert_explicit_recipient('T-A-02','third_party_treasury',a['third_party_treasury'],d);const e=b+c+d;if(e!==0x2710)throw new Error('T-A-02:\x20sum(rates)\x20MUST\x20equal\x2010000\x20(RATE_TOTAL_FULL),\x20got\x20'+e+'\x20'+('(merchant='+b+'\x20+\x20merchant_service_fee='+c+'\x20+\x20third_party='+d+')'));const f=[{'who':{'Entity':a['merchant_treasury']},'sharing':String(b),'mode':'Rate'}];return c>0x0&&f['push']({'who':{'Entity':a['merchant_fee_treasury']},'sharing':String(c),'mode':'Rate'}),d>0x0&&f['push']({'who':{'Entity':a['third_party_treasury']},'sharing':String(d),'mode':'Rate'}),{'object':{'name':a['allocation_name'],'type_parameter':a['coin_type']},'allocators':{'description':'Direct-sales\x20payout\x20(platform\x20commission\x200):\x20merchant\x20'+b+'/10000'+(c>0x0?',\x20merchant\x27s\x20own\x20service\x20fee\x20'+c+'/10000':'')+(d>0x0?',\x20third\x20party\x20(e.g.\x20logistics)\x20'+d+'/10000':''),'threshold':'0','allocators':[{'guard':a['guard_address'],'sharing':f,'max':null}]},'coin':{'name':a['allocation_name']+'_coin'},'payment_info':{}};},'notes':['F-A-05:\x20sum(rates)\x20MUST\x20equal\x2010000\x20(pure\x20Rate\x20mode,\x20no\x20Surplus)\x20—\x20a\x20Rate\x20sum\x20<\x2010000\x20with\x20no\x20Surplus\x20recipient\x20leaves\x20residual\x20balance\x20that\x20ANYONE\x20passing\x20the\x20same\x20Guard\x20can\x20claim\x20repeatedly\x20(E-2\x20/\x20finding\x20T-04)','DEFAULT\x20PARAMETERS\x20emit\x20a\x20single\x20Rate\x2010000\x20leg\x20to\x20merchant_treasury:\x20the\x20merchant\x20keeps\x20the\x20whole\x20sale\x20and\x20the\x2010000\x20invariant\x20holds\x20by\x20construction','merchant_service_fee_bps\x20is\x20the\x20MERCHANT\x27s\x20own\x20fee\x20(merchant\x20IS\x20the\x20aggregator),\x20default\x200\x20—\x20WoWok\x20takes\x20no\x20platform\x20commission\x20and\x20there\x20is\x20no\x20platform\x20leg\x20in\x20this\x20template','third_party_rate\x20is\x20a\x20real\x20provider\x20payment\x20(logistics\x20/\x20arbitrator\x20/\x20partner),\x20not\x20platform\x20extraction;\x20keep\x20it\x20expressible,\x20but\x20name\x20the\x20payee\x20explicitly','Never\x20express\x20a\x20fee\x20as\x20an\x20implicit\x20remainder\x20(\x27the\x20merchant\x20keeps\x20whatever\x20is\x20left\x27)\x20and\x20never\x20take\x20one\x20via\x20a\x20Surplus\x20leg\x20(Surplus\x20calls\x20balance::withdraw_all)','Treasury\x20Permission\x20should\x20match\x20Service\x20Permission\x20(R-A-3-02)','Guard\x20should\x20verify\x20order.service\x20binding\x20(query\x201563)\x20to\x20prevent\x20cross-project\x20bypass']},{'id':'T-A-03','name':'Refund-first\x20+\x20Surplus-to-merchant\x20(Amount\x20+\x20Surplus\x20hybrid)','description':'Single\x20Allocator\x20with\x202\x20sharing\x20items:\x20Amount=refund_value\x20to\x20customer,\x20Surplus\x20to\x20merchant.\x20No\x20fee\x20and\x20no\x20platform\x20leg:\x20the\x20Surplus\x20is\x20the\x20merchant\x27s\x20residual\x20of\x20a\x20mixed\x20refund/delivery\x20pool,\x20NOT\x20a\x20fee\x20mechanism','applicable_scenes':['allocation_refund_first_surplus_to_merchant'],'industry_tags':['retail','refund','customer_protection'],'params':[{'name':'allocation_name','type':'string','description':'Local\x20name\x20for\x20the\x20new\x20Allocation\x20object','required':!![]},{'name':'coin_type','type':'string','description':'Coin<T>\x20type\x20string','required':!![]},{'name':'customer_address','type':'address','description':'Customer\x20address\x20to\x20receive\x20refund\x20Amount','required':!![]},{'name':'merchant_treasury','type':'address','description':'Merchant\x20Treasury\x20address\x20to\x20receive\x20Surplus','required':!![]},{'name':'refund_amount','type':'number','description':'Refund\x20amount\x20in\x20smallest\x20coin\x20unit\x20(e.g.\x20MIST\x20for\x20WOW)','required':!![]},{'name':'guard_address','type':'address','description':'Guard\x20object\x20address\x20(verifies\x20refund\x20approval)','required':!![]},{'name':'description','type':'string','description':'Allocation\x20description','required':![],'default':'Refund-first\x20+\x20Surplus-to-merchant'}],'body':a=>{const b=Number(a['refund_amount']);if(b<=0x0)throw new Error('T-A-03:\x20refund_amount\x20MUST\x20be\x20>\x200,\x20got\x20'+b);return{'object':{'name':a['allocation_name'],'type_parameter':a['coin_type']},'allocators':{'description':a['description']??'Refund-first\x20+\x20Surplus-to-merchant','threshold':String(b),'allocators':[{'guard':a['guard_address'],'sharing':[{'who':{'Entity':a['customer_address']},'sharing':String(b),'mode':'Amount'},{'who':{'Entity':a['merchant_treasury']},'sharing':'0','mode':'Surplus'}],'max':null}]},'coin':{'name':a['allocation_name']+'_coin'},'payment_info':{}};},'notes':['F-A-04:\x20at\x20most\x201\x20Surplus\x20per\x20Allocator\x20(✓\x20single\x20Surplus\x20here)','F-A-07:\x20threshold\x20=\x20refundAmount\x20(ensure\x20balance\x20covers\x20Amount)','the\x20fix\x20is\x20cached\x20as\x20refundAmount\x20when\x20the\x20Allocator\x20is\x20added','Guard\x20must\x20verify\x20customer\x20refund\x20eligibility\x20(e.g.\x20order\x20status\x20=\x20Refunded)','SURPLUS\x20IS\x20NOT\x20A\x20FEE:\x20Surplus\x20calls\x20balance::withdraw_all\x20(allocation.move:420),\x20so\x20a\x20fee\x20taken\x20that\x20way\x20doubles\x20as\x20draining\x20the\x20pool\x20(L3\x20constraint\x203).\x20A\x20declared\x20service\x20fee\x20belongs\x20on\x20the\x20purchase-side\x20allocation\x20(T-A-02)\x20as\x20an\x20explicit\x20Rate\x20leg,\x20never\x20here','The\x20Surplus\x20recipient\x20is\x20the\x20merchant\x20(the\x20counterparty\x20of\x20the\x20delivered\x20part),\x20not\x20an\x20unnamed\x20third\x20party\x20—\x20but\x20pin\x20refund_amount\x20to\x20the\x20refund\x20actually\x20owed,\x20or\x20a\x20smaller/empty\x20refund\x20lets\x20the\x20Surplus\x20leg\x20absorb\x20money\x20that\x20is\x20not\x20the\x20merchant\x27s']},{'id':'T-A-04','name':'Treasury\x20+\x20Personal\x20alternative\x20(caller-specified\x20guard,\x202\x20Allocators)','description':'2\x20Allocators\x20as\x20alternative\x20strategies:\x20caller\x20selects\x20Treasury\x20or\x20Personal\x20wallet\x20via\x20alloc_by_guard\x20(hard\x20verification\x20per\x20call)','applicable_scenes':['allocation_treasury_personal_alternatives'],'industry_tags':['universal','alternative','treasury'],'params':[{'name':'allocation_name','type':'string','description':'Local\x20name\x20for\x20the\x20new\x20Allocation\x20object','required':!![]},{'name':'coin_type','type':'string','description':'Coin<T>\x20type\x20string','required':!![]},{'name':'treasury_address','type':'address','description':'Treasury\x20address\x20(primary\x20recipient)','required':!![]},{'name':'personal_address','type':'address','description':'Personal\x20wallet\x20address\x20(alternative\x20recipient)','required':!![]},{'name':'treasury_guard','type':'address','description':'Guard\x20for\x20Treasury\x20path\x20(verifies\x20treasury\x20operational)','required':!![]},{'name':'personal_guard','type':'address','description':'Guard\x20for\x20Personal\x20path\x20(verifies\x20personal\x20wallet\x20active)\x20—\x20MUST\x20differ\x20from\x20treasury_guard','required':!![]}],'body':a=>{if(a['treasury_guard']===a['personal_guard'])throw new Error('T-A-04:\x20treasury_guard\x20and\x20personal_guard\x20MUST\x20be\x20different\x20addresses\x20(F-A-14:\x20allocators[].guard\x20must\x20be\x20unique)');return{'object':{'name':a['allocation_name'],'type_parameter':a['coin_type']},'allocators':{'description':'Treasury\x20/\x20Personal\x20alternative\x20(caller-specified\x20guard)','threshold':'0','allocators':[{'guard':a['treasury_guard'],'sharing':[{'who':{'Entity':a['treasury_address']},'sharing':'10000','mode':'Rate'}],'max':null},{'guard':a['personal_guard'],'sharing':[{'who':{'Entity':a['personal_address']},'sharing':'10000','mode':'Rate'}],'max':null}]},'coin':{'name':a['allocation_name']+'_coin'},'payment_info':{}};},'notes':['F-A-14:\x20treasury_guard\x20!=\x20personal_guard\x20(Allocator\x20Guards\x20must\x20be\x20unique)','caller-specified\x20guard:\x20alloc_by_guard\x20explicitly\x20selects\x20an\x20Allocator;\x20the\x20Passport\x27s\x20guard\x20result\x20is\x20hard-verified\x20(failure\x20aborts\x20E_VERIFY_FAILED)','No\x20auto-fallback:\x20on\x20verification\x20failure\x20the\x20caller\x20must\x20switch\x20guard\x20and\x20retry','R-A-4-02:\x20if\x20the\x20caller\x27s\x20submitted\x20Passport\x20satisfies\x20both\x20Guards\x20simultaneously,\x20the\x20caller\x20may\x20freely\x20choose\x20between\x20the\x20two\x20paths\x20(mutual\x20exclusion\x20is\x20a\x20design\x20clarity\x20recommendation,\x20not\x20a\x20correctness\x20requirement)','Each\x20Allocator\x20sums\x20to\x2010000\x20INDEPENDENTLY\x20—\x20the\x20Rate-total\x20invariant\x20is\x20per\x20Allocator,\x20not\x20across\x20Allocators,\x20and\x20each\x20of\x20the\x20two\x20paths\x20pays\x20ONE\x20recipient\x20the\x20full\x20amount\x20(no\x20split,\x20no\x20platform\x20leg,\x20no\x20residual)']},{'id':'T-A-05','name':'Tiered\x20by\x20order\x20amount\x20(mutually\x20exclusive\x20Guard\x20conditions)','description':'2\x20Allocators\x20triggered\x20by\x20mutually\x20exclusive\x20Guard\x20conditions\x20(small\x20order\x20vs\x20large\x20order).\x20DIRECT-SALES\x20default:\x20BOTH\x20tiers\x20pay\x20the\x20merchant\x20100%\x20—\x20the\x20tier\x20selects\x20the\x20guard,\x20not\x20a\x20cut.\x20The\x20large\x20tier\x20may\x20add\x20the\x20merchant\x27s\x20OWN\x20declared\x20fee,\x20under\x20the\x20L3\x20rule:\x20(1)\x20an\x20EXPLICIT\x20number\x20computable\x20before\x20ordering,\x20never\x20an\x20implicit\x20remainder;\x20(2)\x20an\x20explicit\x20NON-EMPTY\x20recipient\x20Entity\x20(blank\x20silently\x20routes\x20it\x20to\x20the\x20deploying\x20account,\x20ts-sdk/packages/wowok/src/w/local/index.ts:89-91);\x20(3)\x20no\x20mandatory\x20transit\x20pool,\x20and\x20never\x20a\x20Surplus\x20fee\x20leg\x20(Surplus\x20calls\x20balance::withdraw_all).\x20No\x20platform\x20leg\x20exists\x20in\x20this\x20template.','applicable_scenes':['allocation_tiered_by_order_amount'],'industry_tags':['retail','tiered_pricing','volume_discount'],'params':[{'name':'allocation_name','type':'string','description':'Local\x20name\x20for\x20the\x20new\x20Allocation\x20object','required':!![]},{'name':'coin_type','type':'string','description':'Coin<T>\x20type\x20string','required':!![]},{'name':'merchant_treasury','type':'address','description':'Merchant\x20Treasury\x20address\x20(receives\x20the\x20full\x20sale\x20on\x20both\x20tiers\x20by\x20default)','required':!![]},{'name':'merchant_fee_treasury','type':'address','description':'Recipient\x20Entity\x20of\x20large_order_merchant_fee_bps.\x20MUST\x20be\x20an\x20explicit\x20NON-EMPTY\x20address\x20whenever\x20that\x20fee\x20is\x20>\x200\x20—\x20blank\x20or\x20omitted\x20silently\x20pays\x20the\x20deploying\x20account\x20(ts-sdk/packages/wowok/src/w/local/index.ts:89-91),\x20not\x20a\x20no-op.','required':![]},{'name':'small_order_guard','type':'address','description':'Guard\x20verifying\x20order.amount\x20<\x20threshold\x20(small\x20order\x20path)','required':!![]},{'name':'large_order_guard','type':'address','description':'Guard\x20verifying\x20order.amount\x20>=\x20threshold\x20(large\x20order\x20path)\x20—\x20MUST\x20differ\x20from\x20small_order_guard','required':!![]},{'name':'small_order_merchant_rate','type':'number','description':'Merchant\x20rate\x20on\x20the\x20small-order\x20tier.\x20Default\x20(and\x20only)\x20value\x2010000\x20—\x20direct\x20sales:\x20no\x20platform\x20take.','required':![],'default':0x2710},{'name':'large_order_merchant_rate','type':'number','description':'Merchant\x20rate\x20on\x20the\x20large-order\x20tier.\x20Default\x2010000\x20=\x20the\x20merchant\x20keeps\x20the\x20whole\x20sale\x20(there\x20is\x20no\x20platform\x20take\x20to\x20deduct).','required':![],'default':0x2710},{'name':'large_order_merchant_fee_bps','type':'number','description':'The\x20MERCHANT\x27S\x20OWN\x20service\x20fee\x20on\x20the\x20large-order\x20tier,\x20in\x20basis\x20points.\x20KEEP\x20AT\x200\x20unless\x20the\x20merchant\x20IS\x20the\x20aggregator\x20(chain\x20/\x20multi-supplier\x20orchestrator\x20/\x20consortium).\x20Explicit\x20number\x20the\x20buyer\x20can\x20compute\x20pre-order;\x20large_order_merchant_rate\x20+\x20large_order_merchant_fee_bps\x20MUST\x20sum\x20to\x2010000.\x20WoWok\x20takes\x20no\x20platform\x20commission.','required':![],'default':0x0}],'body':a=>{if(a['small_order_guard']===a['large_order_guard'])throw new Error('T-A-05:\x20small_order_guard\x20and\x20large_order_guard\x20MUST\x20be\x20different\x20addresses\x20(F-A-14)');const b=assert_declared_share('T-A-05','small_order_merchant_rate',a['small_order_merchant_rate'],0x2710);if(b!==0x2710)throw new Error('T-A-05:\x20small_order_merchant_rate\x20MUST\x20equal\x2010000\x20(pure\x20Rate,\x20no\x20Surplus\x20in\x20this\x20Allocator),\x20got\x20'+b);const c=assert_declared_share('T-A-05','large_order_merchant_rate',a['large_order_merchant_rate'],0x2710),d=assert_declared_share('T-A-05','large_order_merchant_fee_bps',a['large_order_merchant_fee_bps'],0x0);assert_explicit_recipient('T-A-05','merchant_treasury',a['merchant_treasury'],b),assert_explicit_recipient('T-A-05','merchant_fee_treasury',a['merchant_fee_treasury'],d);const e=c+d;if(e!==0x2710)throw new Error('T-A-05:\x20large_order\x20rates\x20MUST\x20sum\x20to\x2010000,\x20got\x20'+e+'\x20(merchant='+c+'\x20+\x20merchant_fee='+d+')');const f=[{'who':{'Entity':a['merchant_treasury']},'sharing':String(c),'mode':'Rate'}];return d>0x0&&f['push']({'who':{'Entity':a['merchant_fee_treasury']},'sharing':String(d),'mode':'Rate'}),{'object':{'name':a['allocation_name'],'type_parameter':a['coin_type']},'allocators':{'description':'Tiered\x20by\x20order\x20amount\x20(platform\x20commission\x200):\x20small=100%\x20merchant,\x20'+('large='+c+'/10000\x20merchant')+(d>0x0?'\x20+\x20'+d+'/10000\x20merchant\x27s\x20own\x20service\x20fee':''),'threshold':'0','allocators':[{'guard':a['small_order_guard'],'sharing':[{'who':{'Entity':a['merchant_treasury']},'sharing':'10000','mode':'Rate'}],'max':null},{'guard':a['large_order_guard'],'sharing':f,'max':null}]},'coin':{'name':a['allocation_name']+'_coin'},'payment_info':{}};},'notes':['Guard\x20conditions\x20MUST\x20be\x20mutually\x20exclusive\x20(R-A-4-02)','Sequence-sensitive:\x20strict\x20condition\x20(small\x20order)\x20first,\x20relaxed\x20condition\x20(large\x20order)\x20last','Guard\x20queries\x20order.amount\x20(query\x201561)\x20to\x20determine\x20which\x20Allocator\x20fires','If\x20neither\x20Guard\x20passes,\x20funds\x20are\x20silently\x20locked\x20(R-A-4-02)','DIRECT-SALES\x20DEFAULT:\x20both\x20tiers\x20emit\x20a\x20single\x20Rate\x2010000\x20leg\x20to\x20merchant_treasury\x20—\x20the\x20tier\x20picks\x20the\x20guard,\x20not\x20a\x20cut.\x20Each\x20Allocator\x20sums\x20to\x2010000\x20on\x20its\x20own','large_order_merchant_fee_bps\x20is\x20the\x20merchant\x27s\x20OWN\x20large-tier\x20fee\x20(default\x200),\x20only\x20for\x20a\x20merchant\x20that\x20IS\x20the\x20aggregator;\x20it\x20is\x20never\x20a\x20platform\x20take,\x20never\x20an\x20implicit\x20remainder,\x20and\x20its\x20recipient\x20must\x20be\x20explicit\x20and\x20non-empty']},{'id':'T-A-06','name':'Dynamic\x20recipient\x20via\x20GuardIdentifier\x20(referrer\x20from\x20Passport)','description':'Single\x20Allocator\x20whose\x20Rate\x20sharing\x20items\x20include\x20one\x20recipient\x20resolved\x20from\x20the\x20customer\x27s\x20Passport\x20table[identifier].\x20DIRECT-SALES\x20default:\x20merchant_rate\x2010000\x20and\x20every\x20optional\x20leg\x200,\x20so\x20the\x20emitted\x20template\x20is\x20a\x20single\x20Rate\x2010000\x20leg\x20to\x20the\x20merchant.\x20Two\x20optional\x20legs\x20may\x20be\x20switched\x20on,\x20each\x20under\x20the\x20L3\x20rule\x20(explicit\x20number\x20computable\x20pre-order;\x20explicit\x20non-empty\x20recipient\x20—\x20blank\x20silently\x20pays\x20the\x20deploying\x20account,\x20ts-sdk/packages/wowok/src/w/local/index.ts:89-91;\x20no\x20mandatory\x20transit\x20pool,\x20never\x20a\x20Surplus\x20fee\x20leg):\x20the\x20merchant\x27s\x20OWN\x20service\x20fee\x20(only\x20when\x20the\x20merchant\x20IS\x20the\x20aggregator)\x20and\x20a\x20referral/reward\x20to\x20a\x20referrer\x20the\x20buyer\x20names.\x20There\x20is\x20no\x20platform\x20leg\x20in\x20this\x20template.','applicable_scenes':['allocation_dynamic_recipient'],'industry_tags':['referral','affiliate','marketing'],'params':[{'name':'allocation_name','type':'string','description':'Local\x20name\x20for\x20the\x20new\x20Allocation\x20object','required':!![]},{'name':'coin_type','type':'string','description':'Coin<T>\x20type\x20string','required':!![]},{'name':'merchant_treasury','type':'address','description':'Merchant\x20Treasury\x20address\x20(default:\x20the\x20sole\x2010000\x20recipient)','required':!![]},{'name':'merchant_fee_treasury','type':'address','description':'Recipient\x20Entity\x20of\x20merchant_service_fee_bps.\x20MUST\x20be\x20an\x20explicit\x20NON-EMPTY\x20address\x20whenever\x20that\x20fee\x20is\x20>\x200\x20—\x20blank\x20or\x20omitted\x20silently\x20pays\x20the\x20deploying\x20account\x20(ts-sdk/packages/wowok/src/w/local/index.ts:89-91).\x20NEVER\x20route\x20the\x20merchant\x27s\x20own\x20fee\x20through\x20GuardIdentifier:\x20that\x20recipient\x20is\x20buyer-submitted,\x20not\x20merchant-declared.','required':![]},{'name':'guard_address','type':'address','description':'Guard\x20object\x20address\x20(must\x20be\x20configured\x20with\x20identifier=0\x20as\x20address\x20type)','required':!![]},{'name':'passport_identifier','type':'number','description':'Passport\x20table\x20identifier\x20(u8,\x200-255)\x20carrying\x20the\x20referrer\x20address\x20the\x20buyer\x20submits\x20—\x20only\x20consulted\x20when\x20referrer_rate\x20>\x200\x20(default\x200)','required':![],'default':0x0},{'name':'merchant_rate','type':'number','description':'Merchant\x27s\x20own\x20share\x20in\x20basis\x20points.\x20Default\x2010000\x20=\x20the\x20merchant\x20keeps\x20the\x20whole\x20sale\x20(direct\x20sales:\x20no\x20platform\x20take).','required':![],'default':0x2710},{'name':'merchant_service_fee_bps','type':'number','description':'The\x20MERCHANT\x27S\x20OWN\x20service\x20fee\x20in\x20basis\x20points,\x20default\x200.\x20Only\x20for\x20a\x20merchant\x20that\x20IS\x20the\x20aggregator\x20(chain\x20/\x20multi-supplier\x20orchestrator\x20/\x20consortium).\x20Explicit\x20number\x20the\x20buyer\x20can\x20compute\x20pre-order;\x20merchant_rate\x20+\x20merchant_service_fee_bps\x20+\x20referrer_rate\x20MUST\x20sum\x20to\x2010000.','required':![],'default':0x0},{'name':'referrer_rate','type':'number','description':'Referral\x20/\x20reward\x20rate\x20paid\x20to\x20the\x20referrer\x20the\x20BUYER\x20names\x20in\x20its\x20Passport,\x20default\x200.\x20This\x20is\x20the\x20merchant\x27s\x20own\x20declared\x20acquisition\x20price,\x20not\x20a\x20platform\x20share\x20—\x20keep\x20it\x200\x20unless\x20the\x20merchant\x20actually\x20runs\x20a\x20referral\x20programme,\x20and\x20never\x20route\x20the\x20merchant\x27s\x20own\x20fee\x20here.','required':![],'default':0x0}],'body':a=>{const b=assert_declared_share('T-A-06','merchant_rate',a['merchant_rate'],0x2710),c=assert_declared_share('T-A-06','merchant_service_fee_bps',a['merchant_service_fee_bps'],0x0),d=assert_declared_share('T-A-06','referrer_rate',a['referrer_rate'],0x0),e=b+c+d;if(e!==0x2710)throw new Error('T-A-06:\x20sum(rates)\x20MUST\x20equal\x2010000,\x20got\x20'+e+'\x20(merchant='+b+'\x20+\x20merchant_service_fee='+c+'\x20+\x20referrer='+d+')');assert_explicit_recipient('T-A-06','merchant_treasury',a['merchant_treasury'],b),assert_explicit_recipient('T-A-06','merchant_fee_treasury',a['merchant_fee_treasury'],c);const f=Number(a['passport_identifier']??0x0);if(f<0x0||f>0xff)throw new Error('T-A-06:\x20passport_identifier\x20MUST\x20be\x20u8\x20(0-255),\x20got\x20'+f);const g=[{'who':{'Entity':a['merchant_treasury']},'sharing':String(b),'mode':'Rate'}];return c>0x0&&g['push']({'who':{'Entity':a['merchant_fee_treasury']},'sharing':String(c),'mode':'Rate'}),d>0x0&&g['push']({'who':{'GuardIdentifier':f},'sharing':String(d),'mode':'Rate'}),{'object':{'name':a['allocation_name'],'type_parameter':a['coin_type']},'allocators':{'description':'Dynamic\x20recipient\x20(platform\x20commission\x200):\x20merchant\x20'+b+'/10000'+(c>0x0?',\x20merchant\x27s\x20own\x20service\x20fee\x20'+c+'/10000':'')+(d>0x0?',\x20referrer\x20'+d+'/10000\x20(from\x20Passport\x20identifier='+f+')':''),'threshold':'0','allocators':[{'guard':a['guard_address'],'sharing':g,'max':null}]},'coin':{'name':a['allocation_name']+'_coin'},'payment_info':{}};},'notes':['DEFAULT\x20PARAMETERS\x20emit\x20a\x20single\x20Rate\x2010000\x20leg\x20to\x20merchant_treasury;\x20to\x20exercise\x20the\x20GuardIdentifier\x20form\x20set\x20referrer_rate\x20>\x200\x20and\x20lower\x20merchant_rate\x20by\x20exactly\x20that\x20amount\x20(the\x20emitted\x20rows\x20must\x20still\x20total\x2010000)','F-A-13:\x20Passport\x20table[identifier]\x20MUST\x20be\x20address\x20type\x20(else\x20ERECIPIENT_IDENTIFIER_NOT_ADDRESS=1)','The\x20Guard\x20identifier\x20slot\x27s\x20address-type\x20check\x20MUST\x20pass\x20when\x20the\x20Allocator\x20is\x20added\x20(else\x20the\x20Allocator\x20add\x20fails)','Customer\x20must\x20submit\x20Passport\x20with\x20referrer\x20address\x20at\x20the\x20specified\x20identifier\x20slot','Guard\x20should\x20verify\x20Passport\x20completeness\x20before\x20alloc()\x20executes','The\x20GuardIdentifier\x20recipient\x20is\x20CHOSEN\x20BY\x20THE\x20BUYER\x20(the\x20submitted\x20address\x20bound\x20to\x20for_object),\x20so\x20the\x20Guard\x20—\x20not\x20the\x20template\x20—\x20is\x20what\x20makes\x20it\x20trustworthy:\x20bind\x20it\x20(e.g.\x20an\x20allow-listed\x20referrer)\x20before\x20enabling\x20a\x20non-zero\x20referrer_rate,\x20and\x20never\x20use\x20it\x20for\x20the\x20merchant\x27s\x20own\x20fee','merchant_service_fee_bps\x20is\x20the\x20merchant\x27s\x20own\x20declared\x20fee,\x20default\x200,\x20and\x20requires\x20an\x20explicit\x20non-empty\x20recipient\x20—\x20there\x20is\x20no\x20platform\x20leg\x20in\x20this\x20template']},{'id':'T-A-07','name':'Refund\x20to\x20the\x20submitted\x20Order\x20(100%\x20delivered\x20to\x20the\x20order\x20as\x20escrow)','description':'Single\x20Allocator,\x201\x20Rate=10000\x20sharing\x20whose\x20recipient\x20is\x20the\x20order\x20submitted\x20at\x20alloc\x20time\x20(Guard\x20table\x20identifier\x200).\x20The\x20funds\x20are\x20delivered\x20to\x20that\x20order\x20and\x20received\x20by\x20its\x20owner.','applicable_scenes':['allocation_refund_to_order'],'industry_tags':['refund','customer_protection','order_lifecycle'],'params':[{'name':'allocation_name','type':'string','description':'Local\x20name\x20for\x20the\x20new\x20Allocation\x20object','required':!![]},{'name':'coin_type','type':'string','description':'Coin<T>\x20type\x20string','required':!![]},{'name':'guard_address','type':'address','description':'Guard\x20verifying\x20the\x20submitted\x20order\x20qualifies\x20(e.g.\x20order\x20at\x20the\x20refund\x20node,\x20order.service\x20==\x20host\x20service).\x20Its\x20table\x20needs\x20an\x20address-typed\x20b_submission\x20slot\x20at\x20identifier\x200.','required':!![]}],'body':a=>({'object':{'name':a['allocation_name'],'type_parameter':a['coin_type']},'allocators':{'description':'Refund\x20to\x20the\x20submitted\x20Order\x20(100%\x20delivered\x20to\x20the\x20order\x20as\x20escrow)','threshold':'0','allocators':[{'guard':a['guard_address'],'sharing':[{'who':{'GuardIdentifier':0x0},'sharing':'10000','mode':'Rate'}],'max':null}]},'coin':{'name':a['allocation_name']+'_coin'},'payment_info':{}}),'notes':['The\x20Guard\x20table\x20MUST\x20have\x20an\x20address-typed\x20b_submission\x20slot\x20at\x20identifier\x200\x20carrying\x20the\x20submitted\x20order\x20(else\x20the\x20Allocator\x20add\x20fails\x20with\x20ERECIPIENT_IDENTIFIER_NOT_ADDRESS).','At\x20alloc\x20time\x20the\x20full\x20Rate\x20is\x20delivered\x20to\x20the\x20submitted\x20order\x20as\x20a\x20CoinWrapper\x20—\x20the\x20order\x20object\x20owns\x20it.\x20Its\x20owner\x20subsequently\x20receives\x20the\x20bare\x20coins\x20through\x20the\x20order\x27s\x20owner-receive\x20entry;\x20unrelated\x20addresses\x20cannot\x20intercept.','The\x20Guard\x20decides\x20which\x20submitted\x20orders\x20qualify:\x20node\x20state\x20plus\x20a\x20service-scope\x20binding\x20(order.service\x20==\x20host\x20service)\x20are\x20the\x20typical\x20conditions;\x20tightening\x20those\x20conditions\x20is\x20how\x20the\x20destination\x20is\x20controlled.','When\x20the\x20per-order\x20Allocation\x20is\x20created\x20through\x20the\x20Service\x20flow,\x20payment_info.for_object\x20is\x20set\x20to\x20the\x20order\x20the\x20allocation\x20belongs\x20to,\x20recording\x20the\x20business\x20context\x20auditors\x20can\x20query.','No\x20fee\x20leg\x20and\x20no\x20platform\x20leg:\x20a\x20refund\x20path\x20pays\x20the\x20order\x27s\x20owner\x20and\x20nothing\x20else.\x20A\x20declared\x20service\x20fee\x20belongs\x20on\x20the\x20purchase-side\x20allocation\x20(T-A-02)\x20as\x20an\x20explicit\x20Rate\x20leg\x20—\x20never\x20as\x20a\x20leg\x20here,\x20and\x20never\x20as\x20an\x20implicit\x20remainder\x20or\x20a\x20Surplus\x20drain']},{'id':'T-A-08','name':'Arbitration\x20fees\x20payout\x20(arbitrator\x20keeps\x20100%\x20by\x20default\x20/\x20optional\x20declared\x20operator\x20fee)','description':'Single\x20Allocator,\x20Rate\x20sharing\x20items\x20summing\x20to\x20exactly\x2010000.\x20Triggered\x20by\x20the\x20Arbitration\x20fees-distribution\x20operation\x20(permission\x20365),\x20with\x20or\x20without\x20a\x20Passport.\x20DIRECT-SALES\x20default:\x20the\x20arbitrator\x20keeps\x20the\x20whole\x20fee\x20(single\x20Rate\x2010000\x20leg)\x20—\x20WoWok\x20takes\x20no\x20platform\x20commission.\x20An\x20optional\x20fee\x20for\x20the\x20arbitration\x20OPERATOR\x20(the\x20arbitrator\x27s\x20own\x20declared\x20service\x20price,\x20or\x20a\x20third\x20party\x20such\x20as\x20a\x20payments/escrow\x20provider)\x20is\x20allowed\x20only\x20under\x20the\x20L3\x20rule:\x20(1)\x20an\x20EXPLICIT\x20number\x20the\x20parties\x20can\x20compute\x20before\x20the\x20fee\x20is\x20charged,\x20never\x20an\x20implicit\x20remainder;\x20(2)\x20an\x20explicit\x20NON-EMPTY\x20recipient\x20Entity\x20visible\x20to\x20both\x20sides\x20beforehand\x20(blank\x20silently\x20routes\x20the\x20money\x20to\x20the\x20deploying\x20account,\x20ts-sdk/packages/wowok/src/w/local/index.ts:89-91);\x20(3)\x20no\x20mandatory\x20transit\x20pool,\x20and\x20the\x20fee\x20is\x20NEVER\x20taken\x20via\x20a\x20Surplus\x20leg\x20(Surplus\x20calls\x20balance::withdraw_all,\x20so\x20it\x20doubles\x20as\x20draining\x20the\x20pool).','applicable_scenes':['allocation_arbitration_fees'],'industry_tags':['arbitration','dispute','fees'],'params':[{'name':'allocation_name','type':'string','description':'Local\x20name\x20for\x20the\x20new\x20Allocation\x20object','required':!![]},{'name':'coin_type','type':'string','description':'Coin<T>\x20type\x20string\x20(must\x20match\x20Arbitration\x20fee\x20Coin\x20type)','required':!![]},{'name':'arbitrator_treasury','type':'address','description':'Arbitrator\x20Treasury\x20address\x20—\x20default\x20sole\x2010000\x20recipient\x20of\x20the\x20dispute\x20fee','required':!![]},{'name':'arbitration_operator_treasury','type':'address','description':'Recipient\x20Entity\x20of\x20arbitration_operator_fee_bps:\x20the\x20ARBITRATION\x20OPERATOR\x27s\x20own\x20fee\x20treasury\x20(the\x20arbitrator\x27s\x20declared\x20service\x20price)\x20or\x20a\x20genuine\x20third-party\x20treasury\x20(e.g.\x20an\x20escrow\x20/\x20payments\x20provider).\x20MUST\x20be\x20an\x20explicit\x20NON-EMPTY\x20address\x20whenever\x20the\x20fee\x20is\x20>\x200\x20—\x20leaving\x20it\x20blank\x20or\x20omitting\x20it\x20is\x20NOT\x20a\x20no-op:\x20the\x20share\x20silently\x20goes\x20to\x20Account.Instance().get_address(undefined)\x20=\x20the\x20deploying\x20account\x20(ts-sdk/packages/wowok/src/w/local/index.ts:89-91).','required':![]},{'name':'arbitrator_rate','type':'number','description':'Arbitrator\x27s\x20share\x20in\x20basis\x20points.\x20Default\x2010000\x20=\x20the\x20arbitrator\x20keeps\x20the\x20whole\x20dispute\x20fee\x20(direct\x20sales:\x20no\x20platform\x20take).','required':![],'default':0x2710},{'name':'arbitration_operator_fee_bps','type':'number','description':'The\x20ARBITRATION\x20OPERATOR\x27s\x20(or\x20a\x20named\x20third\x20party\x27s)\x20own\x20fee\x20in\x20basis\x20points,\x20default\x200.\x20Explicit\x20number\x20both\x20sides\x20can\x20compute\x20before\x20the\x20fee\x20is\x20charged;\x20arbitrator_rate\x20+\x20arbitration_operator_fee_bps\x20MUST\x20sum\x20to\x2010000.\x20WoWok\x20extracts\x20nothing,\x20so\x20there\x20is\x20no\x20platform\x20share\x20here.','required':![],'default':0x0},{'name':'guard_address','type':'address','description':'Guard\x20object\x20address\x20(verifies\x20Arbitration\x20ruling\x20finalized)','required':!![]}],'body':a=>{const b=assert_declared_share('T-A-08','arbitrator_rate',a['arbitrator_rate'],0x2710),c=assert_declared_share('T-A-08','arbitration_operator_fee_bps',a['arbitration_operator_fee_bps'],0x0);assert_explicit_recipient('T-A-08','arbitrator_treasury',a['arbitrator_treasury'],b),assert_explicit_recipient('T-A-08','arbitration_operator_treasury',a['arbitration_operator_treasury'],c);const d=b+c;if(d!==0x2710)throw new Error('T-A-08:\x20sum(rates)\x20MUST\x20equal\x2010000,\x20got\x20'+d+'\x20(arbitrator='+b+'\x20+\x20operator_fee='+c+')');const e=[{'who':{'Entity':a['arbitrator_treasury']},'sharing':String(b),'mode':'Rate'}];return c>0x0&&e['push']({'who':{'Entity':a['arbitration_operator_treasury']},'sharing':String(c),'mode':'Rate'}),{'object':{'name':a['allocation_name'],'type_parameter':a['coin_type']},'allocators':{'description':'Arbitration\x20fees\x20(platform\x20commission\x200):\x20arbitrator\x20'+b+'/10000'+(c>0x0?',\x20arbitration\x20operator\x27s\x20own\x20fee\x20'+c+'/10000':''),'threshold':'0','allocators':[{'guard':a['guard_address'],'sharing':e,'max':null}]},'coin':{'name':a['allocation_name']+'_coin'},'payment_info':{}};},'notes':['Triggered\x20by\x20the\x20Arbitration\x20fees-distribution\x20operation\x20(permission\x20ARBITRATION_FEES_ALLOC=365),\x20with\x20or\x20without\x20a\x20Passport','Independent\x20from\x20Service-order\x20Allocation\x20(this\x20Allocation\x20is\x20not\x20bound\x20to\x20Order)','payment_info\x20typically\x20reuses\x20Arbitration\x27s\x20payment_info','Caller\x20MUST\x20hold\x20ARBITRATION_FEES_ALLOC=365\x20permission','DIRECT-SALES\x20DEFAULT:\x20the\x20emitted\x20rows\x20are\x20a\x20single\x20Rate\x2010000\x20leg\x20to\x20arbitrator_treasury\x20—\x20the\x20arbitrator\x20keeps\x20the\x20whole\x20dispute\x20fee,\x20and\x20the\x2010000\x20invariant\x20holds\x20by\x20construction','arbitration_operator_fee_bps\x20is\x20the\x20arbitration\x20OPERATOR\x27s\x20own\x20declared\x20fee\x20(or\x20a\x20named\x20third\x20party\x27s),\x20default\x200;\x20it\x20requires\x20an\x20explicit\x20non-empty\x20recipient\x20and\x20is\x20never\x20an\x20implicit\x20remainder\x20or\x20a\x20Surplus\x20drain.\x20There\x20is\x20no\x20platform\x20leg\x20in\x20this\x20template']},{'id':'T-A-09','name':'Standalone\x20periodic\x20split\x20(investment\x20dividends\x20/\x20shared\x20income)','description':'Standalone\x20Allocation\x20with\x20single\x20Allocator,\x20N\x20Rate\x20sharing\x20items\x20to\x20beneficiary\x20wallets.\x20No\x20Service\x20context.\x20Guard\x20provides\x20time-based\x20or\x20signer-based\x20access\x20control.','applicable_scenes':['allocation_standalone_periodic_split'],'industry_tags':['standalone','investment','dividends','shared_income'],'params':[{'name':'allocation_name','type':'string','description':'Local\x20name\x20for\x20the\x20new\x20Allocation\x20object','required':!![]},{'name':'coin_type','type':'string','description':'Coin<T>\x20type\x20string\x20(e.g.\x20\x270x2::wow::WOW\x27\x20or\x20profit\x20token\x20type)','required':!![]},{'name':'beneficiaries','type':'address[]','description':'Array\x20of\x20beneficiary\x20wallet\x20addresses\x20(NOT\x20Treasury\x20objects\x20—\x20standalone\x20mode\x20has\x20no\x20Service\x20context)','required':!![]},{'name':'rates','type':'string[]','description':'Array\x20of\x20rates\x20in\x20basis\x20points\x20(e.g.\x20[\x275000\x27,\x273000\x27,\x272000\x27]\x20=\x2050%/30%/20%).\x20MUST\x20sum\x20to\x2010000.','required':!![]},{'name':'guard_address','type':'address','description':'Guard\x20object\x20address\x20—\x20MUST\x20bind\x20Signer\x20or\x20verify\x20time-based\x20trigger\x20(R-A-3-04:\x20standalone\x20has\x20no\x20Service-layer\x20access\x20control)','required':!![]},{'name':'description','type':'string','description':'Allocation\x20description','required':![],'default':'Standalone\x20periodic\x20split'}],'body':a=>{const b=a['beneficiaries'],c=a['rates']['map'](e=>Number(e));if(b['length']!==c['length'])throw new Error('T-A-09:\x20beneficiaries\x20('+b['length']+')\x20and\x20rates\x20('+c['length']+')\x20MUST\x20have\x20equal\x20length');if(b['length']===0x0)throw new Error('T-A-09:\x20at\x20least\x201\x20beneficiary\x20required');if(b['length']>0x64)throw new Error('T-A-09:\x20beneficiaries\x20count\x20'+b['length']+'\x20exceeds\x20MAX_SHARING_COUNT\x20(100)');const d=c['reduce']((e,f)=>e+f,0x0);if(d!==0x2710)throw new Error('T-A-09:\x20sum(rates)\x20MUST\x20equal\x2010000\x20(RATE_TOTAL_FULL),\x20got\x20'+d);return{'object':{'name':a['allocation_name'],'type_parameter':a['coin_type']},'allocators':{'description':a['description']??'Standalone\x20periodic\x20split','threshold':'0','allocators':[{'guard':a['guard_address'],'sharing':b['map']((e,f)=>({'who':{'Entity':e},'sharing':String(c[f]),'mode':'Rate'})),'max':null}]},'coin':{'name':a['allocation_name']+'_coin'},'payment_info':{}};},'notes':['Standalone\x20mode\x20(§0):\x20no\x20Service/Order/Arbitration\x20context\x20required','R-A-3-04:\x20Guard\x20MUST\x20bind\x20Signer\x20or\x20verify\x20time-based\x20trigger\x20—\x20no\x20Service-layer\x20access\x20control\x20exists','F-A-05:\x20sum(rates)\x20MUST\x20equal\x2010000\x20(pure\x20Rate\x20mode,\x20no\x20Surplus)','Caller\x20lifecycle:\x20receive()\x20to\x20deposit\x20funds\x20→\x20alloc()\x20to\x20trigger\x20distribution','Guard\x20should\x20bind\x20context(Signer)==authorized\x20to\x20prevent\x20unauthorized\x20alloc()\x20calls','beneficiaries\x20are\x20personal\x20wallets,\x20NOT\x20Treasury\x20objects\x20(no\x20Service\x20context)','Every\x20rate\x20is\x20an\x20EXPLICIT\x20declared\x20share\x20to\x20an\x20EXPLICIT\x20non-empty\x20address:\x20nothing\x20here\x20is\x20an\x20implicit\x20platform\x20beneficiary\x20and\x20no\x20leg\x20is\x20left\x20unset\x20(blank\x20silently\x20binds\x20the\x20deploying\x20account,\x20ts-sdk/packages/wowok/src/w/local/index.ts:89-91).\x20A\x20share\x20intended\x20for\x20a\x20third\x20party\x20is\x20the\x20payer\x27s\x20own\x20declared\x20price\x20and\x20must\x20be\x20named\x20on\x20both\x20sides']},{'id':'T-A-10','name':'Standalone\x20vesting\x20release\x20(time-locked\x20multi-stage\x20unlock)','description':'Standalone\x20Allocation\x20with\x20N\x20Allocators\x20(default\x203\x20stages),\x20each\x20triggered\x20by\x20a\x20time-locked\x20Guard.\x20Stages\x201..N-1\x20use\x20Amount\x20mode;\x20final\x20stage\x20uses\x20Surplus\x20to\x20drain\x20remaining\x20balance.\x20No\x20Service\x20context.','applicable_scenes':['allocation_standalone_vesting'],'industry_tags':['standalone','vesting','time_lock','team_tokens'],'params':[{'name':'allocation_name','type':'string','description':'Local\x20name\x20for\x20the\x20new\x20Allocation\x20object','required':!![]},{'name':'coin_type','type':'string','description':'Coin<T>\x20type\x20string\x20(vested\x20asset,\x20e.g.\x20locked\x20team\x20tokens)','required':!![]},{'name':'beneficiary_address','type':'address','description':'Single\x20beneficiary\x20wallet\x20address\x20(vesting\x20recipient)','required':!![]},{'name':'stage_1_guard','type':'address','description':'Guard\x20for\x20stage\x201\x20(verifies\x20context(Clock).timestamp\x20>=\x20stage_1_unlock)','required':!![]},{'name':'stage_1_amount','type':'number','description':'Amount\x20to\x20release\x20at\x20stage\x201\x20(smallest\x20coin\x20unit,\x20e.g.\x20MIST)','required':!![]},{'name':'stage_2_guard','type':'address','description':'Guard\x20for\x20stage\x202\x20(verifies\x20context(Clock).timestamp\x20>=\x20stage_2_unlock)\x20—\x20MUST\x20differ\x20from\x20stage_1_guard','required':!![]},{'name':'stage_2_amount','type':'number','description':'Amount\x20to\x20release\x20at\x20stage\x202\x20(smallest\x20coin\x20unit)','required':!![]},{'name':'stage_3_guard','type':'address','description':'Guard\x20for\x20stage\x203\x20(final\x20stage,\x20uses\x20Surplus\x20to\x20drain\x20remaining\x20balance)\x20—\x20MUST\x20differ\x20from\x20stage_1_guard\x20and\x20stage_2_guard','required':!![]},{'name':'max_cap','type':'number','description':'Maximum\x20cumulative\x20release\x20cap\x20(applied\x20to\x20stages\x201\x20and\x202\x20via\x20max\x20field).\x20Stage\x203\x20uses\x20Surplus\x20so\x20no\x20max\x20needed.','required':![]},{'name':'description','type':'string','description':'Allocation\x20description','required':![],'default':'Standalone\x20vesting\x20release\x20(3-stage\x20time-locked)'}],'body':a=>{const b=[a['stage_1_guard'],a['stage_2_guard'],a['stage_3_guard']],c=new Set(b);if(c['size']!==b['length']){const h=b['filter']((j,k)=>b['indexOf'](j)!==k);throw new Error('T-A-10:\x20stage\x20guards\x20MUST\x20be\x20unique\x20(F-A-14),\x20duplicates:\x20'+h['join'](',\x20'));}const d=Number(a['stage_1_amount']),e=Number(a['stage_2_amount']);if(d<=0x0||e<=0x0)throw new Error('T-A-10:\x20stage_1_amount\x20and\x20stage_2_amount\x20MUST\x20be\x20>\x200,\x20got\x20stage1='+d+',\x20stage2='+e);const f=d+e,g=a['max_cap']!=null?Number(a['max_cap']):null;if(g!==null&&f>g)throw new Error('T-A-10:\x20stage_1_amount\x20+\x20stage_2_amount\x20('+f+')\x20MUST\x20be\x20<=\x20max_cap\x20('+g+')\x20—\x20F-A-08\x20(EAMOUNT_EXCEEDS_MAX)');return{'object':{'name':a['allocation_name'],'type_parameter':a['coin_type']},'allocators':{'description':a['description']??'Standalone\x20vesting\x20release\x20(3-stage\x20time-locked)','threshold':'0','allocators':[{'guard':a['stage_1_guard'],'sharing':[{'who':{'Entity':a['beneficiary_address']},'sharing':String(d),'mode':'Amount'}],'max':g!=null?String(g):null},{'guard':a['stage_2_guard'],'sharing':[{'who':{'Entity':a['beneficiary_address']},'sharing':String(e),'mode':'Amount'}],'max':g!=null?String(g):null},{'guard':a['stage_3_guard'],'sharing':[{'who':{'Entity':a['beneficiary_address']},'sharing':'0','mode':'Surplus'}],'max':null}]},'coin':{'name':a['allocation_name']+'_coin'},'payment_info':{}};},'notes':['Standalone\x20mode\x20(§0):\x20no\x20Service/Order/Arbitration\x20context\x20required','R-A-3-04:\x20Guard\x20time-lock\x20MUST\x20be\x20enforced\x20—\x20no\x20Service-layer\x20access\x20control\x20exists','F-A-14:\x20stage_1_guard,\x20stage_2_guard,\x20stage_3_guard\x20MUST\x20be\x20unique\x20(duplicate\x20guards\x20are\x20dead\x20code)','F-A-04:\x20at\x20most\x201\x20Surplus\x20per\x20Allocator\x20(stage\x203\x20uses\x20Surplus\x20to\x20drain\x20remainder)','F-A-08:\x20stage_1_amount\x20+\x20stage_2_amount\x20MUST\x20be\x20<=\x20max_cap\x20(if\x20max_cap\x20provided)','R-A-4-01:\x20if\x20caller\x20calls\x20alloc()\x20before\x20stage\x20time-lock\x20expires,\x20alloc()\x20silently\x20returns\x20—\x20caller\x20should\x20check\x20balance==0\x20after\x20alloc()','R-A-4-02:\x20Guard\x20conditions\x20SHOULD\x20be\x20mutually\x20exclusive\x20by\x20timestamp\x20(e.g.\x20stage_1:\x20ts<stage_2_unlock,\x20stage_2:\x20stage_2_unlock<=ts<stage_3_unlock,\x20stage_3:\x20ts>=stage_3_unlock)','Caller\x20lifecycle:\x20receive()\x20to\x20deposit\x20locked\x20tokens\x20→\x20alloc()\x20at\x20each\x20vesting\x20milestone','Single\x20beneficiary\x20—\x20no\x20platform\x20leg.\x20The\x20stage-3\x20Surplus\x20is\x20this\x20contract\x27s\x20own\x20vesting\x20remainder,\x20NOT\x20a\x20fee:\x20Surplus\x20calls\x20balance::withdraw_all,\x20so\x20never\x20express\x20a\x20declared\x20fee\x20through\x20a\x20Surplus\x20leg\x20(L3\x20constraint\x203)']},{'id':'T-A-11','name':'Standalone\x20payroll\x20/\x20salary\x20distribution\x20(issuer\x20+\x20Repository\x20verified)','description':'Standalone\x20Allocation\x20for\x20periodic\x20payroll:\x20employees\x20receive\x20Rate\x20shares.\x20The\x20Guard\x20binds\x20the\x20issuer\x20Signer\x20identity\x20and\x20cross-checks\x20a\x20Repository\x20payroll\x20record\x20(period\x20and\x20amounts).\x20No\x20Service\x20context.','applicable_scenes':['allocation_standalone_payroll'],'industry_tags':['standalone','payroll','salary','compensation','hr'],'params':[{'name':'allocation_name','type':'string','description':'Local\x20name\x20for\x20the\x20new\x20Allocation\x20object','required':!![]},{'name':'coin_type','type':'string','description':'Coin<T>\x20type\x20string\x20used\x20for\x20payroll\x20(e.g.\x20\x270x2::wow::WOW\x27)','required':!![]},{'name':'employees','type':'address[]','description':'Employee\x20wallet\x20addresses\x20(Recipient::Entity\x20recipients)','required':!![]},{'name':'rates','type':'string[]','description':'Per-employee\x20rates\x20in\x20basis\x20points\x20(e.g.\x20[\x276000\x27,\x274000\x27]).\x20MUST\x20sum\x20to\x2010000.','required':!![]},{'name':'guard_address','type':'address','description':'Guard\x20that\x20binds\x20Signer\x20==\x20issuer\x20AND\x20cross-checks\x20the\x20Repository\x20payroll\x20record\x20(both\x20required)','required':!![]},{'name':'payroll_period','type':'string','description':'Human-readable\x20period\x20label\x20(e.g.\x20\x272025-W26\x27)\x20—\x20recorded\x20in\x20the\x20Allocation\x20description\x20for\x20audit','required':!![]},{'name':'description','type':'string','description':'Allocation\x20description','required':![],'default':'Standalone\x20payroll\x20distribution'}],'body':a=>{const b=a['employees'],c=a['rates']['map'](e=>Number(e));if(b['length']!==c['length'])throw new Error('T-A-11:\x20employees\x20('+b['length']+')\x20and\x20rates\x20('+c['length']+')\x20MUST\x20have\x20equal\x20length');if(b['length']===0x0)throw new Error('T-A-11:\x20at\x20least\x201\x20employee\x20required');if(b['length']>0x64)throw new Error('T-A-11:\x20employees\x20count\x20'+b['length']+'\x20exceeds\x20MAX_SHARING_COUNT\x20(100)');const d=c['reduce']((e,f)=>e+f,0x0);if(d!==0x2710)throw new Error('T-A-11:\x20sum(rates)\x20MUST\x20equal\x2010000\x20(RATE_TOTAL_FULL),\x20got\x20'+d);return{'object':{'name':a['allocation_name'],'type_parameter':a['coin_type']},'allocators':{'description':(a['description']??'Standalone\x20payroll\x20distribution')+'\x20—\x20period:\x20'+a['payroll_period'],'threshold':'0','allocators':[{'guard':a['guard_address'],'sharing':b['map']((e,f)=>({'who':{'Entity':e},'sharing':String(c[f]),'mode':'Rate'})),'max':null}]},'coin':{'name':a['allocation_name']+'_coin'},'payment_info':{}};},'notes':['Standalone\x20mode:\x20no\x20Service/Order/Arbitration\x20context\x20required','RC-FIND-04:\x20the\x20Guard\x20MUST\x20bind\x20the\x20issuer\x20identity\x20(Signer\x20==\x20employer/admin,\x20or\x20a\x20Permission\x20member)\x20—\x20standalone\x20has\x20no\x20Service\x20access-control\x20layer','Repository\x20distinction:\x20the\x20Guard\x20MUST\x20cross-check\x20the\x20Repository\x20payroll\x20record\x20(period\x20hash,\x20amounts\x20and\x20recipients)\x20so\x20the\x20distribution\x20is\x20tied\x20to\x20auditable\x20work/payroll\x20data','Auditability:\x20the\x20Guard\x20rules\x20are\x20public\x20—\x20third\x20parties\x20verify\x20who\x20may\x20distribute\x20and\x20what\x20inputs\x20distinguish\x20a\x20valid\x20payroll','F-A-05:\x20sum(rates)\x20MUST\x20equal\x2010000\x20(pure\x20Rate\x20mode)','Caller\x20lifecycle:\x20issuer\x20receive()\x20to\x20fund\x20payroll\x20→\x20alloc()\x20after\x20the\x20Repository\x20record\x20for\x20the\x20period\x20is\x20committed','Employees\x20are\x20personal\x20wallets\x20(Recipient::Entity),\x20never\x20Recipient::Signer','The\x20issuer/employer\x20is\x20the\x20payer\x20and\x20keeps\x20the\x20whole\x20payroll\x20pool\x20by\x20default:\x20there\x20is\x20no\x20platform\x20share\x20in\x20this\x20template.\x20Every\x20rate\x20is\x20an\x20explicit\x20per-employee\x20price\x20to\x20an\x20explicit\x20non-empty\x20address\x20(blank\x20silently\x20binds\x20the\x20deploying\x20account,\x20ts-sdk/packages/wowok/src/w/local/index.ts:89-91),\x20and\x20sum(rates)\x20MUST\x20stay\x2010000\x20so\x20no\x20residual\x20stays\x20claimable']}];export const ALLOCATION_TEMPLATES_VERSION='1.1.0';export function getAllTemplates(){return[...ALLOCATION_TEMPLATES];}export function getTemplateById(a){return ALLOCATION_TEMPLATES['find'](b=>b['id']===a);}export function getTemplatesByScene(a){return ALLOCATION_TEMPLATES['filter'](b=>b['applicable_scenes']['includes'](a));}export function getTemplatesByIndustry(a){return ALLOCATION_TEMPLATES['filter'](b=>b['industry_tags']['includes'](a)||b['industry_tags']['includes']('universal'));}export function suggestTemplateForScene(a){const b=getTemplatesByScene(a);return b['length']>0x0?b[0x0]:undefined;}export function listTemplates(){return ALLOCATION_TEMPLATES['map'](a=>({'id':a['id'],'name':a['name'],'description':a['description'],'scenes':a['applicable_scenes']}));}export function fillTemplate(a,b){const c=getTemplateById(a);if(!c)return{'ok':![],'error':'Template\x20'+a+'\x20not\x20found'};for(const d of c['params']){if(d['required']&&!(d['name']in b))return{'ok':![],'error':'Missing\x20required\x20param:\x20'+d['name']};}try{return{'ok':!![],'body':c['body'](b)};}catch(f){return{'ok':![],'error':f instanceof Error?f['message']:String(f)};}}
@@ -1 +1 @@
1
- export const ARB_STATUS_CODE={'Principal_confirming':0x0,'Arbitrator_confirming':0x1,'Voting':0x2,'Arbitrated':0x3,'Objectionable':0x4,'Finished':0x5,'Withdrawn':0x6};export const ARB_TERMINAL_STATUSES=['Finished','Withdrawn'];export const ARB_STATUS_ALIASES={'created':'Principal_confirming','voting':'Voting','feedback':'Arbitrator_confirming','confirmed':'Arbitrated','completed':'Finished','reset':'Objectionable','disputed':'Withdrawn'};export const ARBITRATION_PERMISSIONS=[{'index':0x15e,'name':'ARBITRATION_NEW','description':'Create\x20new\x20Arbitration\x20object','governed_operations':['create\x20a\x20new\x20arbitration\x20service']},{'index':0x15f,'name':'ARBITRATION_DESCRIPTION','description':'Modify\x20Arbitration\x20description','governed_operations':['modify\x20the\x20arbitration\x20description']},{'index':0x160,'name':'ARBITRATION_ENDPOINT','description':'Reserved\x20placeholder\x20—\x20not\x20used\x20on-chain\x20(SDK\x20commented\x20out)','governed_operations':[],'is_reserved':!![]},{'index':0x161,'name':'ARBITRATION_LOCATION','description':'Set\x20Arbitration\x20location','governed_operations':['set\x20the\x20arbitration\x20location']},{'index':0x162,'name':'ARBITRATION_VOTING_GUARD','description':'Manage\x20voting_guard\x20list\x20(add\x20/\x20remove\x20/\x20clear)\x20—\x20controls\x20vote\x20weight','governed_operations':['add\x20a\x20passport-identifier\x20voting\x20guard\x20(dynamic\x20weight)','add\x20a\x20fixed-weight\x20voting\x20guard','remove\x20a\x20voting\x20guard','clear\x20the\x20voting\x20guard\x20list']},{'index':0x163,'name':'ARBITRATION_USAGE_GUARD','description':'Set\x20/\x20clear\x20usage_guard\x20—\x20controls\x20who\x20can\x20file\x20disputes','governed_operations':['set\x20the\x20usage\x20guard\x20(restrict\x20who\x20can\x20file\x20disputes)','clear\x20the\x20usage\x20guard']},{'index':0x164,'name':'ARBITRATION_PAUSE','description':'Pause\x20/\x20resume\x20Arbitration\x20(bPaused\x20default\x20true)','governed_operations':['pause/resume\x20the\x20arbitration\x20service']},{'index':0x165,'name':'ARBITRATION_FEE','description':'Set\x20dispute\x20application\x20fee\x20(u64)','governed_operations':['set\x20the\x20dispute\x20application\x20fee']},{'index':0x166,'name':'ARBITRATION_VOTE','description':'Cast\x20a\x20vote.\x20With\x20an\x20EMPTY\x20voting_guard\x20this\x20is\x20an\x20equal-weight\x20vote\x20(1\x20person\x201\x20vote)\x20—\x20'+'NOT\x20permissionless:\x20vote()\x20asserts\x20permission\x20358\x20unconditionally,\x20so\x20every\x20voter\x20(both\x20disputing\x20'+'parties\x20in\x20open\x20voting)\x20must\x20be\x20GRANTED\x20358\x20first.\x20A\x20fresh\x20Arbitration\x20has\x20no\x20grants\x20at\x20all,\x20so\x20'+'without\x20explicit\x20grants\x20nobody\x20can\x20vote\x20(E-13,\x20test/6)','governed_operations':['cast\x20a\x20vote\x20(empty\x20voting_guard\x20=\x201\x20person\x201\x20vote,\x20permission\x20358\x20still\x20required)','cast\x20a\x20weighted\x20vote\x20via\x20voting_guard\x20(weights\x20resolved\x20per\x20guard)']},{'index':0x167,'name':'ARBITRATION_ARBITRATION','description':'Make\x20definitive\x20arbitration\x20ruling\x20(with\x20indemnity)','governed_operations':['issue\x20the\x20definitive\x20arbitration\x20ruling\x20(with\x20indemnity)']},{'index':0x168,'name':'ARBITRATION_FEEDBACK','description':'Provide\x20feedback\x20on\x20Arb\x20case','governed_operations':['attach\x20feedback\x20to\x20the\x20Arb\x20case']},{'index':0x169,'name':'ARBITRATION_CONFIRM','description':'Confirm\x20materials\x20submitted\x20by\x20principal\x20(starts\x20voting\x20phase)','governed_operations':['confirm\x20the\x20principal\x27s\x20materials\x20(starts\x20the\x20voting\x20phase)']},{'index':0x16a,'name':'ARBITRATION_VOTING_DEADLINE_CHANGE','description':'Change\x20voting\x20deadline\x20for\x20an\x20Arb\x20case','governed_operations':['change\x20the\x20voting\x20deadline\x20for\x20an\x20Arb\x20case']},{'index':0x16b,'name':'ARBITRATION_RESET','description':'Reset\x20arbitration\x20—\x20principal\x20resubmits\x20materials,\x20restart\x20lifecycle','governed_operations':['reset\x20the\x20arbitration\x20(principal\x20resubmits\x20materials)']},{'index':0x16c,'name':'ARBITRATION_ARB_WITHDRAW','description':'Withdraw\x20arbitration\x20fees\x20from\x20Arb\x20into\x20Arbitration.balance','governed_operations':['withdraw\x20arbitration\x20fees\x20from\x20the\x20Arb\x20into\x20Arbitration.balance']},{'index':0x16d,'name':'ARBITRATION_FEES_ALLOC','description':'Allocate\x20arbitration\x20fees\x20to\x20Allocation\x20object','governed_operations':['allocate\x20arbitration\x20fees\x20to\x20an\x20Allocation\x20object']},{'index':0x16e,'name':'ARBITRATION_FEES_TRANSFER','description':'Transfer\x20arbitration\x20fees\x20to\x20Treasury\x20object','governed_operations':['transfer\x20arbitration\x20fees\x20to\x20a\x20Treasury\x20object']},{'index':0x16f,'name':'ARBITRATION_OWNER_RECEIVE','description':'Owner\x20receive\x20(unwrap\x20received\x20Coin/Object\x20and\x20send\x20to\x20Permission\x20owner)','governed_operations':['owner\x20receipt\x20of\x20payments\x20(unwrapped\x20to\x20the\x20owner)','owner\x20receipt\x20of\x20whole\x20objects']},{'index':0x170,'name':'ARBITRATION_UM','description':'Set\x20/\x20clear\x20User\x20Manager\x20(Contact\x20object)','governed_operations':['bind\x20a\x20Contact\x20as\x20the\x20UM\x20coordinator','unbind\x20the\x20UM\x20Contact']}];export const DUAL_GUARD_MATRIX=[{'voting_guard_empty':!![],'usage_guard_empty':!![],'dispute_method':'dispute','vote_method':'vote','scenario':'Open\x20dispute\x20+\x20open\x20voting\x20(1\x20person\x201\x20vote)'},{'voting_guard_empty':!![],'usage_guard_empty':![],'dispute_method':'dispute_via_passport','vote_method':'vote','scenario':'Restricted\x20dispute\x20+\x20open\x20voting'},{'voting_guard_empty':![],'usage_guard_empty':!![],'dispute_method':'dispute','vote_method':'vote_weighted_by_guard','scenario':'Open\x20dispute\x20+\x20weighted\x20voting'},{'voting_guard_empty':![],'usage_guard_empty':![],'dispute_method':'dispute_via_passport','vote_method':'vote_weighted_by_guard','scenario':'Restricted\x20dispute\x20+\x20weighted\x20voting\x20(most\x20controlled)'}];export const ARBITRATION_SCENES=[{'id':'arbitration_create','name':'Create\x20new\x20Arbitration\x20service','operation_category':'lifecycle','permission_index':0x15e,'permission_name':'ARBITRATION_NEW','requires_voting_guard':'any','requires_usage_guard':'any','has_passport_variant':!![],'governed_operations':['create\x20a\x20new\x20arbitration\x20service'],'common_patterns':['Pre-publish\x20config:\x20create\x20Arbitration\x20+\x20Permission\x20together','bPaused\x20defaults\x20to\x20true\x20—\x20must\x20call\x20pause(false)\x20to\x20enable','Generic\x20T:\x20choose\x20Coin\x20type\x20(e.g.\x200x2::wow::WOW)\x20at\x20creation','object-linker\x20binding\x20(core):\x20permission\x20+\x20arbitration\x20linked\x20by\x20an\x20affiliation\x20core\x20binding'],'recommended_templates':['T-AB-01','T-AB-02']},{'id':'arbitration_dispute','name':'File\x20dispute\x20against\x20an\x20Order\x20(creates\x20Arb\x20case)','operation_category':'dispute','permission_index':0x0,'permission_name':'(order\x20op\x20permission\x20—\x20no\x20ARBITRATION_*\x20index)','required_arb_status':[],'resulting_arb_status':'Arbitrator_confirming','requires_voting_guard':'any','requires_usage_guard':'any','has_passport_variant':!![],'governed_operations':['file\x20a\x20dispute\x20against\x20an\x20Order\x20(creates\x20the\x20Arb\x20case)'],'common_patterns':['Fee\x20gate:\x20coin::value(&fee)\x20>=\x20self.fee,\x20else\x20E_FEE_NOT_ENOUGH','Order\x20op\x20permission\x20check\x20required\x20(caller\x20must\x20hold\x20the\x20matching\x20order\x20operation\x20permission)','Creates\x20independent\x20Arb<T>\x20object\x20with\x20its\x20own\x20lifecycle','If\x20usage_guard\x20is\x20Some\x20→\x20the\x20dispute\x20must\x20go\x20through\x20passport\x20verification','Order.dispute\x20list:\x20appends\x20new\x20Arb\x20(max\x2010\x20per\x20Order)','One-shot\x20filing:\x20the\x20Arb\x20is\x20created\x20directly\x20in\x20Arbitrator_confirming\x20status\x20—\x20proposition\x20and\x20description\x20are\x20final\x20at\x20filing;\x20edits\x20require\x20the\x20arbitrator\x20to\x20reset\x20the\x20case\x20back\x20to\x20Principal_confirming\x20first.\x20Assemble\x20the\x20complete\x20proposition\x20before\x20calling\x20dispute.'],'recommended_templates':['T-AB-01','T-AB-03','T-AB-04']},{'id':'arbitration_vote','name':'Vote\x20on\x20Arb\x20propositions','operation_category':'voting','permission_index':0x166,'permission_name':'ARBITRATION_VOTE','required_arb_status':['Voting'],'requires_voting_guard':'any','requires_usage_guard':'not_applicable','has_passport_variant':!![],'governed_operations':['open\x20a\x20vote\x20(1\x20person\x201\x20vote)','cast\x20a\x20weighted\x20vote\x20(weights\x20resolved\x20from\x20the\x20voting\x20guard)'],'common_patterns':['Open\x20vote:\x20voting_guard\x20empty\x20→\x20plain\x20vote\x20(passport\x20variant\x20supported);\x20equal\x20weight\x20'+'(1\x20person\x201\x20vote)\x20but\x20still\x20requires\x20permission\x20358\x20for\x20EVERY\x20voter\x20—\x20grant\x20358\x20to\x20both\x20'+'disputing\x20parties,\x20otherwise\x20no\x20one\x20can\x20vote\x20(E-13)','Weighted\x20vote:\x20voting_guard\x20non-empty\x20→\x20vote\x20weight\x20resolved\x20per\x20voting\x20guard','votes:\x20u8\x20array\x20—\x20index\x20into\x20proposition\x20list\x20(0..N-1)','Mismatch:\x20vote()\x20with\x20non-empty\x20voting_guard\x20→\x20E_VOTING_GUARD_USED','Guard\x20not\x20in\x20list:\x20E_VOTING_GUARD_NOT_FOUND','E-15:\x20the\x20voting_deadline\x20IS\x20the\x20dispute-resolution\x20delay\x20window\x20—\x20the\x20ruling\x20(arbitration)\x20'+'aborts\x20with\x20E_VOTING_DEADLINE_NOT_PASSED\x20until\x20the\x20deadline\x20elapses.\x20Size\x20the\x20window\x20to\x20the\x20'+'business\x20expectation\x20(e.g.\x2010\x20minutes\x20for\x20tests,\x20days\x20for\x20production)'],'recommended_templates':['T-AB-02','T-AB-03']},{'id':'arbitration_confirm','name':'Confirm\x20principal\x20materials\x20and\x20start\x20voting\x20phase','operation_category':'ruling','permission_index':0x169,'permission_name':'ARBITRATION_CONFIRM','required_arb_status':['Arbitrator_confirming'],'resulting_arb_status':'Voting','requires_voting_guard':'any','requires_usage_guard':'not_applicable','has_passport_variant':!![],'governed_operations':['confirm\x20the\x20principal\x27s\x20materials\x20(starts\x20the\x20voting\x20phase)'],'common_patterns':['Transitions\x20Arb\x20from\x20Arbitrator_confirming\x20→\x20Voting','voting_deadline:\x20u64\x20timestamp_ms\x20(null\x20=\x20no\x20deadline)','Once\x20in\x20Voting,\x20only\x20vote\x20/\x20voting_deadline_change\x20/\x20reset\x20allowed'],'recommended_templates':['T-AB-01','T-AB-02']},{'id':'arbitration_feedback','name':'Provide\x20feedback\x20on\x20Arb\x20case','operation_category':'ruling','permission_index':0x168,'permission_name':'ARBITRATION_FEEDBACK','required_arb_status':['Principal_confirming','Arbitrator_confirming','Voting','Arbitrated','Objectionable'],'requires_voting_guard':'not_applicable','requires_usage_guard':'not_applicable','has_passport_variant':!![],'governed_operations':['attach\x20feedback\x20to\x20the\x20Arb\x20case'],'common_patterns':['Feedback\x20is\x20informational\x20—\x20does\x20not\x20change\x20Arb\x20status','Used\x20by\x20principal\x20/\x20arbitrator\x20/\x20voters\x20to\x20attach\x20notes','No\x20state\x20transition;\x20supplements\x20the\x20case\x20record'],'recommended_templates':['T-AB-01','T-AB-07']},{'id':'arbitration_ruling','name':'Make\x20definitive\x20arbitration\x20ruling\x20with\x20indemnity','operation_category':'ruling','permission_index':0x167,'permission_name':'ARBITRATION_ARBITRATION','required_arb_status':['Voting'],'resulting_arb_status':'Arbitrated','requires_voting_guard':'any','requires_usage_guard':'not_applicable','has_passport_variant':!![],'governed_operations':['issue\x20the\x20definitive\x20arbitration\x20ruling\x20(with\x20indemnity)'],'common_patterns':['Ruling\x20produces:\x20feedback\x20(string)\x20+\x20indemnity\x20(u64)','indemnity\x20is\x20compensation\x20amount\x20—\x20paid\x20through\x20the\x20order\x20compensation\x20flow','compensation\x20is\x20package-internal\x20—\x20only\x20the\x20order\x20lifecycle\x20can\x20trigger\x20it','Once\x20Arbitrated,\x20case\x20enters\x20Objectionable\x20window\x20(reset\x20possible)','E-16:\x20the\x20indemnity\x20is\x20paid\x20from\x20the\x20SERVICE\x27s\x20merchant-prepaid\x20compensation_fund\x20pool,\x20'+'NOT\x20from\x20the\x20order\x20escrow.\x20If\x20the\x20pool\x20is\x20smaller\x20than\x20the\x20indemnity,\x20arb_claim_compensation\x20'+'aborts\x20with\x20code\x2027\x20(E_COMPENSATION_NOT_MATCH)\x20—\x20the\x20ruling\x20stands\x20but\x20is\x20unpayable\x20until\x20the\x20'+'merchant\x20tops\x20up\x20(the\x20abort\x20does\x20NOT\x20consume\x20the\x20claim)','E-17/E-17b:\x20the\x20ruling\x20does\x20NOT\x20propagate\x20to\x20the\x20Machine/Allocation\x20escrow\x20—\x20after\x20a\x20claim\x20the\x20'+'order\x20can\x20still\x20be\x20driven\x20to\x20completed\x20and\x20settle\x20the\x20FULL\x20escrow\x20on\x20top\x20of\x20the\x20compensation\x20'+'(claim/objection\x20are\x20orthogonal\x20to\x20the\x20workflow;\x20they\x20are\x20only\x20mutually\x20exclusive\x20with\x20each\x20'+'other).\x20Deliberately\x20gate:\x20hold/adjust\x20the\x20order\x20before\x20settlement,\x20or\x20accept\x20both\x20payouts'],'recommended_templates':['T-AB-01','T-AB-05']},{'id':'arbitration_reset','name':'Reset\x20arbitration\x20—\x20principal\x20resubmits\x20materials','operation_category':'ruling','permission_index':0x16b,'permission_name':'ARBITRATION_RESET','required_arb_status':['Objectionable','Arbitrator_confirming'],'resulting_arb_status':'Principal_confirming','requires_voting_guard':'any','requires_usage_guard':'not_applicable','has_passport_variant':!![],'governed_operations':['reset\x20the\x20arbitration\x20(principal\x20resubmits\x20materials)'],'common_patterns':['Resets\x20Arb\x20from\x20Objectionable/Arbitrator_confirming\x20→\x20Principal_confirming','Used\x20when\x20principal\x20objects\x20to\x20ruling\x20and\x20resubmits\x20materials','Feedback\x20required\x20(string\x20explaining\x20reset\x20reason)','Restart\x20full\x20lifecycle:\x20Principal_confirming\x20→\x20...\x20→\x20Finished'],'recommended_templates':['T-AB-07']},{'id':'arbitration_arb_withdraw','name':'Withdraw\x20arbitration\x20fees\x20from\x20Arb\x20into\x20Arbitration.balance','operation_category':'fund','permission_index':0x16c,'permission_name':'ARBITRATION_ARB_WITHDRAW','required_arb_status':['Finished','Arbitrated'],'requires_voting_guard':'not_applicable','requires_usage_guard':'not_applicable','has_passport_variant':!![],'governed_operations':['withdraw\x20arbitration\x20fees\x20from\x20the\x20Arb\x20into\x20Arbitration.balance'],'common_patterns':['Moves\x20fees\x20from\x20the\x20Arb\x20object\x20into\x20Arbitration.balance\x20(clock-checked)','Finished:\x20withdraw\x20immediately','Arbitrated:\x20must\x20wait\x20WITHDRAW_DURATION_TIME\x20(30d)\x20past\x20indemnity.time\x20—\x20silence\x20=\x20acceptance','Objectionable:\x20NEVER\x20withdrawable\x20(protocol\x20141)\x20—\x20the\x20fee\x20stays\x20escrowed\x20until\x20the\x20objection\x20cycle\x20is\x20closed\x20by\x20the\x20principal\x20re-confirming','Increases\x20Arbitration.balance\x20—\x20funds\x20available\x20for\x20fee\x20allocation/transfer'],'recommended_templates':['T-AB-06']},{'id':'arbitration_fees_alloc','name':'Allocate\x20arbitration\x20fees\x20to\x20Allocation\x20object','operation_category':'fund','permission_index':0x16d,'permission_name':'ARBITRATION_FEES_ALLOC','requires_voting_guard':'not_applicable','requires_usage_guard':'not_applicable','has_passport_variant':!![],'governed_operations':['allocate\x20arbitration\x20fees\x20to\x20an\x20Allocation\x20object'],'common_patterns':['Destination:\x20Allocation\x20object\x20(parameterized\x20fund\x20distribution)','payment_remark\x20+\x20payment_index:\x20bookkeeping\x20for\x20Payment\x20object','May\x20create\x20new\x20Payment\x20object\x20if\x20newPayment\x20name\x20provided','Triggers\x20balance::withdraw_all\x20—\x20extracts\x20ALL\x20balance'],'recommended_templates':['T-AB-06']},{'id':'arbitration_fees_transfer','name':'Transfer\x20arbitration\x20fees\x20to\x20Treasury\x20object','operation_category':'fund','permission_index':0x16e,'permission_name':'ARBITRATION_FEES_TRANSFER','requires_voting_guard':'not_applicable','requires_usage_guard':'not_applicable','has_passport_variant':!![],'governed_operations':['transfer\x20arbitration\x20fees\x20to\x20a\x20Treasury\x20object'],'common_patterns':['Destination:\x20Treasury\x20object\x20(general\x20fund\x20pool)','Same\x20bookkeeping\x20as\x20fee\x20allocation\x20(remark\x20+\x20index\x20+\x20newPayment)','Triggers\x20balance::withdraw_all\x20—\x20extracts\x20ALL\x20balance','Choose\x20Allocation\x20vs\x20Treasury\x20by\x20distribution\x20need'],'recommended_templates':['T-AB-06']},{'id':'arbitration_voting_guard_config','name':'Configure\x20voting_guard\x20list\x20(add\x20/\x20set\x20/\x20remove\x20/\x20clear)','operation_category':'guard','permission_index':0x162,'permission_name':'ARBITRATION_VOTING_GUARD','requires_voting_guard':'any','requires_usage_guard':'not_applicable','has_passport_variant':!![],'governed_operations':['add\x20a\x20passport-identifier\x20voting\x20guard\x20(dynamic\x20weight)','add\x20a\x20fixed-weight\x20voting\x20guard','remove\x20a\x20voting\x20guard','clear\x20the\x20voting\x20guard\x20list'],'common_patterns':['Max\x2050\x20guards:\x20MAX_VOTING_GUARD_COUNT=50\x20(off-by-one-safe:\x20len<50\x20allows\x20add)','GuardIdentifier(u8):\x20dynamic\x20weight\x20from\x20Passport\x20submission\x20value','FixedValue(u32):\x20static\x20weight\x20(e.g.\x20100\x20votes\x20per\x20holder)','Add\x20same\x20guard\x20twice\x20→\x20updates\x20vote_weight\x20(no\x20duplicate)','op=\x27set\x27\x20=\x20clear\x20then\x20add;\x20op=\x27add\x27\x20=\x20append;\x20op=\x27remove\x27\x20=\x20by\x20address'],'recommended_templates':['T-AB-02','T-AB-03']},{'id':'arbitration_usage_guard_config','name':'Configure\x20usage_guard\x20(set\x20/\x20clear)','operation_category':'guard','permission_index':0x163,'permission_name':'ARBITRATION_USAGE_GUARD','requires_voting_guard':'not_applicable','requires_usage_guard':'any','has_passport_variant':!![],'governed_operations':['set\x20the\x20usage\x20guard\x20(restrict\x20who\x20can\x20file\x20disputes)','clear\x20the\x20usage\x20guard'],'common_patterns':['Single\x20guard\x20(Option<address>)\x20—\x20not\x20a\x20list','Some(guard):\x20the\x20dispute\x20must\x20go\x20through\x20passport\x20verification','None:\x20dispute\x20can\x20use\x20either\x20variant\x20(no\x20passport\x20needed)','object-linker\x20affiliation\x20change:\x20updates\x20link\x20when\x20guard\x20changes'],'recommended_templates':['T-AB-04']},{'id':'arbitration_pause','name':'Pause\x20/\x20resume\x20Arbitration\x20service','operation_category':'lifecycle','permission_index':0x164,'permission_name':'ARBITRATION_PAUSE','requires_voting_guard':'not_applicable','requires_usage_guard':'not_applicable','has_passport_variant':!![],'governed_operations':['pause/resume\x20the\x20arbitration\x20service'],'common_patterns':['bPaused\x20default\x20true\x20—\x20new\x20Arbitration\x20cannot\x20accept\x20disputes','pause(false)\x20to\x20enable,\x20pause(true)\x20to\x20disable','Paused\x20Arbitration\x20rejects\x20dispute\x20(E_PAUSED)','Does\x20not\x20affect\x20already-open\x20Arb\x20cases'],'recommended_templates':['T-AB-01']},{'id':'arbitration_service_statement','name':'Service\x20(defendant)\x20appends\x20a\x20text\x20statement\x20to\x20the\x20case\x20record','operation_category':'dispute','permission_index':0x141,'permission_name':'SERVICE_ARB_STATEMENT','requires_voting_guard':'not_applicable','requires_usage_guard':'not_applicable','has_passport_variant':!![],'governed_operations':['append\x20the\x20seller\x27s\x20text\x20statement\x20to\x20a\x20case\x20against\x20an\x20order\x20of\x20the\x20service\x20(ArbStatementEvent)'],'common_patterns':['Defendant-side\x20voice\x20WITHOUT\x20holding\x20the\x20order\x20—\x20the\x20arb/arbitration\x20function\x20family\x20is\x20order-anchored;\x20this\x20entry\x20is\x20service-anchored','PRIMARY\x20evidence\x20channel\x20is\x20Messenger:\x20submit\x20encrypted\x20WTS\x20records\x20of\x20the\x20exchange\x20with\x20the\x20order\x20customer\x20first','This\x20statement\x20is\x20the\x20SECONDARY\x20channel:\x20declare\x20facts\x20or\x20report\x20customer\x20behavior\x20(absence,\x20non-cooperation)\x20on\x20the\x20case\x20record','Event-only:\x20nothing\x20on\x20the\x20Arb\x20object\x20is\x20mutated;\x20the\x20record\x20cannot\x20be\x20rewritten\x20or\x20deleted\x20by\x20any\x20party','Text\x20length\x20cap\x20identical\x20to\x20description/objection\x20(DESCRIPTION\x20bound,\x204000)'],'recommended_templates':[]}];export const ARBITRATION_LEDGER_VERSION='1.0.0';export function getScenesByCategory(a){return ARBITRATION_SCENES['filter'](b=>b['operation_category']===a);}export function findSceneById(a){return ARBITRATION_SCENES['find'](b=>b['id']===a);}export function findSceneByPermissionIndex(a){return ARBITRATION_SCENES['find'](b=>b['permission_index']===a);}export function getPermissionByIndex(a){return ARBITRATION_PERMISSIONS['find'](b=>b['index']===a);}export function getPermissionByName(a){return ARBITRATION_PERMISSIONS['find'](b=>b['name']===a);}export function isReservedIndex(a){const b=getPermissionByIndex(a);return!!b?.['is_reserved'];}export function isUsedPermissionIndex(a){const b=getPermissionByIndex(a);return!!b&&!b['is_reserved'];}export function getActivePermissionCount(){return ARBITRATION_PERMISSIONS['filter'](a=>!a['is_reserved'])['length'];}export function inferSceneFromIntent(a){const b=a['toLowerCase'](),c=[{'keywords':['create','new'],'sceneId':'arbitration_create'},{'keywords':['dispute','file','complaint'],'sceneId':'arbitration_dispute'},{'keywords':['vote','voting','decide'],'sceneId':'arbitration_vote'},{'keywords':['confirm','materials'],'sceneId':'arbitration_confirm'},{'keywords':['feedback','opinion'],'sceneId':'arbitration_feedback'},{'keywords':['ruling','arbitration','verdict'],'sceneId':'arbitration_ruling'},{'keywords':['reset','resubmit'],'sceneId':'arbitration_reset'},{'keywords':['arb_withdraw','withdraw','withdraw\x20fees'],'sceneId':'arbitration_arb_withdraw'},{'keywords':['allocate','allocate\x20fees','fees\x20allocation'],'sceneId':'arbitration_fees_alloc'},{'keywords':['fees_transfer','transfer','transfer\x20in'],'sceneId':'arbitration_fees_transfer'},{'keywords':['voting_guard','voting\x20guard'],'sceneId':'arbitration_voting_guard_config'},{'keywords':['usage_guard','usage\x20guard'],'sceneId':'arbitration_usage_guard_config'},{'keywords':['pause','enable'],'sceneId':'arbitration_pause'}];for(const {keywords:d,sceneId:e}of c){if(d['some'](f=>b['includes'](f['toLowerCase']()))){const f=findSceneById(e);if(f)return f;}}return undefined;}export function getDualGuardMatrixEntry(a,b){return DUAL_GUARD_MATRIX['find'](c=>c['voting_guard_empty']===a&&c['usage_guard_empty']===b);}export function isValidArbStatusTransition(a,b){const c={'Principal_confirming':['Arbitrator_confirming'],'Arbitrator_confirming':['Voting','Principal_confirming'],'Voting':['Arbitrated'],'Arbitrated':['Objectionable','Finished','Withdrawn'],'Objectionable':['Principal_confirming'],'Finished':['Withdrawn'],'Withdrawn':[]};return c[a]?.['includes'](b)??![];}export function isTerminalArbStatus(a){return ARB_TERMINAL_STATUSES['includes'](a);}export function getScenesProducingStatus(a){return ARBITRATION_SCENES['filter'](b=>b['resulting_arb_status']===a);}export function getScenesRequiringStatus(a){return ARBITRATION_SCENES['filter'](b=>b['required_arb_status']?.['includes'](a));}export function getArbitrationScenesCount(){return ARBITRATION_SCENES['length'];}export function getAllArbitrationPermissions(){return[...ARBITRATION_PERMISSIONS];}export function getActiveArbitrationPermissions(){return ARBITRATION_PERMISSIONS['filter'](a=>!a['is_reserved']);}
1
+ export const ARB_STATUS_CODE={'Principal_confirming':0x0,'Arbitrator_confirming':0x1,'Voting':0x2,'Arbitrated':0x3,'Objectionable':0x4,'Finished':0x5,'Withdrawn':0x6};export const ARB_TERMINAL_STATUSES=['Finished','Withdrawn'];export const ARB_STATUS_ALIASES={'created':'Principal_confirming','voting':'Voting','feedback':'Arbitrator_confirming','confirmed':'Arbitrated','completed':'Finished','reset':'Objectionable','disputed':'Withdrawn'};export const ARBITRATION_PERMISSIONS=[{'index':0x15e,'name':'ARBITRATION_NEW','description':'Create\x20new\x20Arbitration\x20object','governed_operations':['create\x20a\x20new\x20arbitration\x20service']},{'index':0x15f,'name':'ARBITRATION_DESCRIPTION','description':'Modify\x20Arbitration\x20description','governed_operations':['modify\x20the\x20arbitration\x20description']},{'index':0x160,'name':'ARBITRATION_ENDPOINT','description':'Reserved\x20placeholder\x20—\x20not\x20used\x20on-chain\x20(SDK\x20commented\x20out)','governed_operations':[],'is_reserved':!![]},{'index':0x161,'name':'ARBITRATION_LOCATION','description':'Set\x20Arbitration\x20location','governed_operations':['set\x20the\x20arbitration\x20location']},{'index':0x162,'name':'ARBITRATION_VOTING_GUARD','description':'Manage\x20voting_guard\x20list\x20(add\x20/\x20remove\x20/\x20clear)\x20—\x20controls\x20vote\x20weight','governed_operations':['add\x20a\x20passport-identifier\x20voting\x20guard\x20(dynamic\x20weight)','add\x20a\x20fixed-weight\x20voting\x20guard','remove\x20a\x20voting\x20guard','clear\x20the\x20voting\x20guard\x20list']},{'index':0x163,'name':'ARBITRATION_USAGE_GUARD','description':'Set\x20/\x20clear\x20usage_guard\x20—\x20controls\x20who\x20can\x20file\x20disputes','governed_operations':['set\x20the\x20usage\x20guard\x20(restrict\x20who\x20can\x20file\x20disputes)','clear\x20the\x20usage\x20guard']},{'index':0x164,'name':'ARBITRATION_PAUSE','description':'Pause\x20/\x20resume\x20Arbitration\x20(bPaused\x20default\x20true)','governed_operations':['pause/resume\x20the\x20arbitration\x20service']},{'index':0x165,'name':'ARBITRATION_FEE','description':'Set\x20dispute\x20application\x20fee\x20(u64)','governed_operations':['set\x20the\x20dispute\x20application\x20fee']},{'index':0x166,'name':'ARBITRATION_VOTE','description':'Cast\x20a\x20vote.\x20With\x20an\x20EMPTY\x20voting_guard\x20this\x20is\x20an\x20equal-weight\x20vote\x20(1\x20person\x201\x20vote)\x20—\x20'+'NOT\x20permissionless:\x20vote()\x20asserts\x20permission\x20358\x20unconditionally,\x20so\x20every\x20voter\x20(both\x20disputing\x20'+'parties\x20in\x20open\x20voting)\x20must\x20be\x20GRANTED\x20358\x20first.\x20A\x20fresh\x20Arbitration\x20has\x20no\x20grants\x20at\x20all,\x20so\x20'+'without\x20explicit\x20grants\x20nobody\x20can\x20vote\x20(E-13,\x20test/6)','governed_operations':['cast\x20a\x20vote\x20(empty\x20voting_guard\x20=\x201\x20person\x201\x20vote,\x20permission\x20358\x20still\x20required)','cast\x20a\x20weighted\x20vote\x20via\x20voting_guard\x20(weights\x20resolved\x20per\x20guard)']},{'index':0x167,'name':'ARBITRATION_ARBITRATION','description':'Make\x20definitive\x20arbitration\x20ruling\x20(with\x20indemnity)','governed_operations':['issue\x20the\x20definitive\x20arbitration\x20ruling\x20(with\x20indemnity)']},{'index':0x168,'name':'ARBITRATION_FEEDBACK','description':'Provide\x20feedback\x20on\x20Arb\x20case','governed_operations':['attach\x20feedback\x20to\x20the\x20Arb\x20case']},{'index':0x169,'name':'ARBITRATION_CONFIRM','description':'Confirm\x20materials\x20submitted\x20by\x20principal\x20(starts\x20voting\x20phase)','governed_operations':['confirm\x20the\x20principal\x27s\x20materials\x20(starts\x20the\x20voting\x20phase)']},{'index':0x16a,'name':'ARBITRATION_VOTING_DEADLINE_CHANGE','description':'Change\x20voting\x20deadline\x20for\x20an\x20Arb\x20case','governed_operations':['change\x20the\x20voting\x20deadline\x20for\x20an\x20Arb\x20case']},{'index':0x16b,'name':'ARBITRATION_RESET','description':'Reset\x20arbitration\x20—\x20principal\x20resubmits\x20materials,\x20restart\x20lifecycle','governed_operations':['reset\x20the\x20arbitration\x20(principal\x20resubmits\x20materials)']},{'index':0x16c,'name':'ARBITRATION_ARB_WITHDRAW','description':'Withdraw\x20arbitration\x20fees\x20from\x20Arb\x20into\x20Arbitration.balance','governed_operations':['withdraw\x20arbitration\x20fees\x20from\x20the\x20Arb\x20into\x20Arbitration.balance']},{'index':0x16d,'name':'ARBITRATION_FEES_ALLOC','description':'Allocate\x20arbitration\x20fees\x20to\x20Allocation\x20object','governed_operations':['allocate\x20arbitration\x20fees\x20to\x20an\x20Allocation\x20object']},{'index':0x16e,'name':'ARBITRATION_FEES_TRANSFER','description':'Transfer\x20arbitration\x20fees\x20to\x20Treasury\x20object','governed_operations':['transfer\x20arbitration\x20fees\x20to\x20a\x20Treasury\x20object']},{'index':0x16f,'name':'ARBITRATION_OWNER_RECEIVE','description':'Owner\x20receive\x20(unwrap\x20received\x20Coin/Object\x20and\x20send\x20to\x20Permission\x20owner)','governed_operations':['owner\x20receipt\x20of\x20payments\x20(unwrapped\x20to\x20the\x20owner)','owner\x20receipt\x20of\x20whole\x20objects']},{'index':0x170,'name':'ARBITRATION_UM','description':'Set\x20/\x20clear\x20User\x20Manager\x20(Contact\x20object)','governed_operations':['bind\x20a\x20Contact\x20as\x20the\x20UM\x20coordinator','unbind\x20the\x20UM\x20Contact']}];export const DUAL_GUARD_MATRIX=[{'voting_guard_empty':!![],'usage_guard_empty':!![],'dispute_method':'dispute','vote_method':'vote','scenario':'Open\x20dispute\x20+\x20open\x20voting\x20(1\x20person\x201\x20vote)'},{'voting_guard_empty':!![],'usage_guard_empty':![],'dispute_method':'dispute_via_passport','vote_method':'vote','scenario':'Restricted\x20dispute\x20+\x20open\x20voting'},{'voting_guard_empty':![],'usage_guard_empty':!![],'dispute_method':'dispute','vote_method':'vote_weighted_by_guard','scenario':'Open\x20dispute\x20+\x20weighted\x20voting'},{'voting_guard_empty':![],'usage_guard_empty':![],'dispute_method':'dispute_via_passport','vote_method':'vote_weighted_by_guard','scenario':'Restricted\x20dispute\x20+\x20weighted\x20voting\x20(most\x20controlled)'}];export const ARBITRATION_SCENES=[{'id':'arbitration_create','name':'Create\x20new\x20Arbitration\x20service','operation_category':'lifecycle','permission_index':0x15e,'permission_name':'ARBITRATION_NEW','requires_voting_guard':'any','requires_usage_guard':'any','has_passport_variant':!![],'governed_operations':['create\x20a\x20new\x20arbitration\x20service'],'common_patterns':['Pre-publish\x20config:\x20create\x20Arbitration\x20+\x20Permission\x20together','bPaused\x20defaults\x20to\x20true\x20—\x20must\x20call\x20pause(false)\x20to\x20enable','Generic\x20T:\x20choose\x20Coin\x20type\x20(e.g.\x200x2::wow::WOW)\x20at\x20creation','object-linker\x20binding\x20(core):\x20permission\x20+\x20arbitration\x20linked\x20by\x20an\x20affiliation\x20core\x20binding'],'recommended_templates':['T-AB-01','T-AB-02']},{'id':'arbitration_dispute','name':'File\x20dispute\x20against\x20an\x20Order\x20(creates\x20Arb\x20case)','operation_category':'dispute','permission_index':0x0,'permission_name':'(order\x20op\x20permission\x20—\x20no\x20ARBITRATION_*\x20index)','required_arb_status':[],'resulting_arb_status':'Arbitrator_confirming','requires_voting_guard':'any','requires_usage_guard':'any','has_passport_variant':!![],'governed_operations':['file\x20a\x20dispute\x20against\x20an\x20Order\x20(creates\x20the\x20Arb\x20case)'],'common_patterns':['Fee\x20gate:\x20coin::value(&fee)\x20>=\x20self.fee,\x20else\x20E_FEE_NOT_ENOUGH','Order\x20op\x20permission\x20check\x20required\x20(caller\x20must\x20hold\x20the\x20matching\x20order\x20operation\x20permission)','Creates\x20independent\x20Arb<T>\x20object\x20with\x20its\x20own\x20lifecycle','If\x20usage_guard\x20is\x20Some\x20→\x20the\x20dispute\x20must\x20go\x20through\x20passport\x20verification','Order.dispute\x20list:\x20appends\x20new\x20Arb\x20(max\x2010\x20per\x20Order)','One-shot\x20filing:\x20the\x20Arb\x20is\x20created\x20directly\x20in\x20Arbitrator_confirming\x20status\x20—\x20proposition\x20and\x20description\x20are\x20final\x20at\x20filing;\x20edits\x20require\x20the\x20arbitrator\x20to\x20reset\x20the\x20case\x20back\x20to\x20Principal_confirming\x20first.\x20Assemble\x20the\x20complete\x20proposition\x20before\x20calling\x20dispute.'],'recommended_templates':['T-AB-01','T-AB-03','T-AB-04']},{'id':'arbitration_vote','name':'Vote\x20on\x20Arb\x20propositions','operation_category':'voting','permission_index':0x166,'permission_name':'ARBITRATION_VOTE','required_arb_status':['Voting'],'requires_voting_guard':'any','requires_usage_guard':'not_applicable','has_passport_variant':!![],'governed_operations':['open\x20a\x20vote\x20(1\x20person\x201\x20vote)','cast\x20a\x20weighted\x20vote\x20(weights\x20resolved\x20from\x20the\x20voting\x20guard)'],'common_patterns':['Open\x20vote:\x20voting_guard\x20empty\x20→\x20plain\x20vote\x20(passport\x20variant\x20supported);\x20equal\x20weight\x20'+'(1\x20person\x201\x20vote)\x20but\x20still\x20requires\x20permission\x20358\x20for\x20EVERY\x20voter\x20—\x20grant\x20358\x20to\x20both\x20'+'disputing\x20parties,\x20otherwise\x20no\x20one\x20can\x20vote\x20(E-13)','Weighted\x20vote:\x20voting_guard\x20non-empty\x20→\x20vote\x20weight\x20resolved\x20per\x20voting\x20guard','votes:\x20u8\x20array\x20—\x20index\x20into\x20proposition\x20list\x20(0..N-1)','Mismatch:\x20vote()\x20with\x20non-empty\x20voting_guard\x20→\x20E_VOTING_GUARD_USED','Guard\x20not\x20in\x20list:\x20E_VOTING_GUARD_NOT_FOUND','E-15:\x20the\x20voting_deadline\x20IS\x20the\x20dispute-resolution\x20delay\x20window\x20—\x20the\x20ruling\x20(arbitration)\x20'+'aborts\x20with\x20E_VOTING_DEADLINE_NOT_PASSED\x20until\x20the\x20deadline\x20elapses.\x20Size\x20the\x20window\x20to\x20the\x20'+'business\x20expectation\x20(e.g.\x2010\x20minutes\x20for\x20tests,\x20days\x20for\x20production)'],'recommended_templates':['T-AB-02','T-AB-03']},{'id':'arbitration_confirm','name':'Confirm\x20principal\x20materials\x20and\x20start\x20voting\x20phase','operation_category':'ruling','permission_index':0x169,'permission_name':'ARBITRATION_CONFIRM','required_arb_status':['Arbitrator_confirming'],'resulting_arb_status':'Voting','requires_voting_guard':'any','requires_usage_guard':'not_applicable','has_passport_variant':!![],'governed_operations':['confirm\x20the\x20principal\x27s\x20materials\x20(starts\x20the\x20voting\x20phase)'],'common_patterns':['Transitions\x20Arb\x20from\x20Arbitrator_confirming\x20→\x20Voting','voting_deadline:\x20u64\x20timestamp_ms\x20(null\x20=\x20no\x20deadline)','Once\x20in\x20Voting,\x20only\x20vote\x20/\x20voting_deadline_change\x20/\x20reset\x20allowed'],'recommended_templates':['T-AB-01','T-AB-02']},{'id':'arbitration_feedback','name':'Provide\x20feedback\x20on\x20Arb\x20case','operation_category':'ruling','permission_index':0x168,'permission_name':'ARBITRATION_FEEDBACK','required_arb_status':['Principal_confirming','Arbitrator_confirming','Voting','Arbitrated','Objectionable'],'requires_voting_guard':'not_applicable','requires_usage_guard':'not_applicable','has_passport_variant':!![],'governed_operations':['attach\x20feedback\x20to\x20the\x20Arb\x20case'],'common_patterns':['Feedback\x20is\x20informational\x20—\x20does\x20not\x20change\x20Arb\x20status','Used\x20by\x20principal\x20/\x20arbitrator\x20/\x20voters\x20to\x20attach\x20notes','No\x20state\x20transition;\x20supplements\x20the\x20case\x20record'],'recommended_templates':['T-AB-01','T-AB-07']},{'id':'arbitration_ruling','name':'Make\x20definitive\x20arbitration\x20ruling\x20with\x20indemnity','operation_category':'ruling','permission_index':0x167,'permission_name':'ARBITRATION_ARBITRATION','required_arb_status':['Voting'],'resulting_arb_status':'Arbitrated','requires_voting_guard':'any','requires_usage_guard':'not_applicable','has_passport_variant':!![],'governed_operations':['issue\x20the\x20definitive\x20arbitration\x20ruling\x20(with\x20indemnity)'],'common_patterns':['Ruling\x20produces:\x20feedback\x20(string)\x20+\x20indemnity\x20(u64)','indemnity\x20is\x20compensation\x20amount\x20—\x20paid\x20through\x20the\x20order\x20compensation\x20flow','compensation\x20is\x20package-internal\x20—\x20only\x20the\x20order\x20lifecycle\x20can\x20trigger\x20it','Once\x20Arbitrated,\x20case\x20enters\x20Objectionable\x20window\x20(reset\x20possible)','E-16:\x20the\x20indemnity\x20is\x20paid\x20from\x20the\x20SERVICE\x27s\x20merchant-prepaid\x20compensation_fund\x20pool,\x20'+'NOT\x20from\x20the\x20order\x20escrow.\x20If\x20the\x20pool\x20is\x20smaller\x20than\x20the\x20indemnity,\x20arb_claim_compensation\x20'+'aborts\x20with\x20code\x2027\x20(E_COMPENSATION_NOT_MATCH)\x20—\x20the\x20ruling\x20stands\x20but\x20is\x20unpayable\x20until\x20the\x20'+'merchant\x20tops\x20up\x20(the\x20abort\x20does\x20NOT\x20consume\x20the\x20claim)','E-17/E-17b:\x20the\x20ruling\x20does\x20NOT\x20propagate\x20to\x20the\x20Machine/Allocation\x20escrow,\x20so\x20a\x20settlement\x20'+'forward\x20can\x20still\x20FIRE\x20after\x20a\x20claim.\x20But\x20the\x20order\x20has\x20SEALED\x20itself:\x20compensate()\x20sets\x20'+'claimed_by\x20(single-use,\x20E_ORDER_ALREADY_CLAIMED),\x20and\x20both\x20owner_receive\x20entries\x20assert\x20'+'claimed_by\x20is\x20none\x20—\x20so\x20any\x20escrow\x20the\x20refund\x20track\x20splits\x20after\x20the\x20claim\x20is\x20UNCLAIMABLE\x20by\x20'+'anyone.\x20The\x20provider\x20release\x20track\x20(direct\x20transfer)\x20stays\x20usable.\x20So\x20\x27accept\x20both\x20payouts\x27\x20is\x20'+'NOT\x20available\x20by\x20default:\x20claim\x20→\x20refund\x20is\x20closed\x20by\x20the\x20seal;\x20only\x20refund\x20→\x20claim\x20stacks,\x20and\x20'+'that\x20direction\x20is\x20the\x20ARBITRATOR\x27S\x20to\x20net\x20(see\x20the\x20netting\x20rule)\x20or\x20the\x20merchant\x27s\x20to\x20gate\x20'+'(refund\x20allocator\x20Guard\x20on\x20order.claimed_by)'],'recommended_templates':['T-AB-01','T-AB-05']},{'id':'arbitration_reset','name':'Reset\x20arbitration\x20—\x20principal\x20resubmits\x20materials','operation_category':'ruling','permission_index':0x16b,'permission_name':'ARBITRATION_RESET','required_arb_status':['Objectionable','Arbitrator_confirming'],'resulting_arb_status':'Principal_confirming','requires_voting_guard':'any','requires_usage_guard':'not_applicable','has_passport_variant':!![],'governed_operations':['reset\x20the\x20arbitration\x20(principal\x20resubmits\x20materials)'],'common_patterns':['Resets\x20Arb\x20from\x20Objectionable/Arbitrator_confirming\x20→\x20Principal_confirming','Used\x20when\x20principal\x20objects\x20to\x20ruling\x20and\x20resubmits\x20materials','Feedback\x20required\x20(string\x20explaining\x20reset\x20reason)','Restart\x20full\x20lifecycle:\x20Principal_confirming\x20→\x20...\x20→\x20Finished'],'recommended_templates':['T-AB-07']},{'id':'arbitration_arb_withdraw','name':'Withdraw\x20arbitration\x20fees\x20from\x20Arb\x20into\x20Arbitration.balance','operation_category':'fund','permission_index':0x16c,'permission_name':'ARBITRATION_ARB_WITHDRAW','required_arb_status':['Finished','Arbitrated'],'requires_voting_guard':'not_applicable','requires_usage_guard':'not_applicable','has_passport_variant':!![],'governed_operations':['withdraw\x20arbitration\x20fees\x20from\x20the\x20Arb\x20into\x20Arbitration.balance'],'common_patterns':['Moves\x20fees\x20from\x20the\x20Arb\x20object\x20into\x20Arbitration.balance\x20(clock-checked)','Finished:\x20withdraw\x20immediately','Arbitrated:\x20must\x20wait\x20WITHDRAW_DURATION_TIME\x20(30d)\x20past\x20indemnity.time\x20—\x20silence\x20=\x20acceptance','Objectionable:\x20NEVER\x20withdrawable\x20(protocol\x20141)\x20—\x20the\x20fee\x20stays\x20escrowed\x20until\x20the\x20objection\x20cycle\x20is\x20closed\x20by\x20the\x20principal\x20re-confirming','Increases\x20Arbitration.balance\x20—\x20funds\x20available\x20for\x20fee\x20allocation/transfer'],'recommended_templates':['T-AB-06']},{'id':'arbitration_fees_alloc','name':'Allocate\x20arbitration\x20fees\x20to\x20Allocation\x20object','operation_category':'fund','permission_index':0x16d,'permission_name':'ARBITRATION_FEES_ALLOC','requires_voting_guard':'not_applicable','requires_usage_guard':'not_applicable','has_passport_variant':!![],'governed_operations':['allocate\x20arbitration\x20fees\x20to\x20an\x20Allocation\x20object'],'common_patterns':['Destination:\x20Allocation\x20object\x20(parameterized\x20fund\x20distribution)','payment_remark\x20+\x20payment_index:\x20bookkeeping\x20for\x20Payment\x20object','May\x20create\x20new\x20Payment\x20object\x20if\x20newPayment\x20name\x20provided','Triggers\x20balance::withdraw_all\x20—\x20extracts\x20ALL\x20balance'],'recommended_templates':['T-AB-06']},{'id':'arbitration_fees_transfer','name':'Transfer\x20arbitration\x20fees\x20to\x20Treasury\x20object','operation_category':'fund','permission_index':0x16e,'permission_name':'ARBITRATION_FEES_TRANSFER','requires_voting_guard':'not_applicable','requires_usage_guard':'not_applicable','has_passport_variant':!![],'governed_operations':['transfer\x20arbitration\x20fees\x20to\x20a\x20Treasury\x20object'],'common_patterns':['Destination:\x20Treasury\x20object\x20(general\x20fund\x20pool)','Same\x20bookkeeping\x20as\x20fee\x20allocation\x20(remark\x20+\x20index\x20+\x20newPayment)','Triggers\x20balance::withdraw_all\x20—\x20extracts\x20ALL\x20balance','Choose\x20Allocation\x20vs\x20Treasury\x20by\x20distribution\x20need'],'recommended_templates':['T-AB-06']},{'id':'arbitration_voting_guard_config','name':'Configure\x20voting_guard\x20list\x20(add\x20/\x20set\x20/\x20remove\x20/\x20clear)','operation_category':'guard','permission_index':0x162,'permission_name':'ARBITRATION_VOTING_GUARD','requires_voting_guard':'any','requires_usage_guard':'not_applicable','has_passport_variant':!![],'governed_operations':['add\x20a\x20passport-identifier\x20voting\x20guard\x20(dynamic\x20weight)','add\x20a\x20fixed-weight\x20voting\x20guard','remove\x20a\x20voting\x20guard','clear\x20the\x20voting\x20guard\x20list'],'common_patterns':['Max\x2050\x20guards:\x20MAX_VOTING_GUARD_COUNT=50\x20(off-by-one-safe:\x20len<50\x20allows\x20add)','GuardIdentifier(u8):\x20dynamic\x20weight\x20from\x20Passport\x20submission\x20value','FixedValue(u32):\x20static\x20weight\x20(e.g.\x20100\x20votes\x20per\x20holder)','Add\x20same\x20guard\x20twice\x20→\x20updates\x20vote_weight\x20(no\x20duplicate)','op=\x27set\x27\x20=\x20clear\x20then\x20add;\x20op=\x27add\x27\x20=\x20append;\x20op=\x27remove\x27\x20=\x20by\x20address'],'recommended_templates':['T-AB-02','T-AB-03']},{'id':'arbitration_usage_guard_config','name':'Configure\x20usage_guard\x20(set\x20/\x20clear)','operation_category':'guard','permission_index':0x163,'permission_name':'ARBITRATION_USAGE_GUARD','requires_voting_guard':'not_applicable','requires_usage_guard':'any','has_passport_variant':!![],'governed_operations':['set\x20the\x20usage\x20guard\x20(restrict\x20who\x20can\x20file\x20disputes)','clear\x20the\x20usage\x20guard'],'common_patterns':['Single\x20guard\x20(Option<address>)\x20—\x20not\x20a\x20list','Some(guard):\x20the\x20dispute\x20must\x20go\x20through\x20passport\x20verification','None:\x20dispute\x20can\x20use\x20either\x20variant\x20(no\x20passport\x20needed)','object-linker\x20affiliation\x20change:\x20updates\x20link\x20when\x20guard\x20changes'],'recommended_templates':['T-AB-04']},{'id':'arbitration_pause','name':'Pause\x20/\x20resume\x20Arbitration\x20service','operation_category':'lifecycle','permission_index':0x164,'permission_name':'ARBITRATION_PAUSE','requires_voting_guard':'not_applicable','requires_usage_guard':'not_applicable','has_passport_variant':!![],'governed_operations':['pause/resume\x20the\x20arbitration\x20service'],'common_patterns':['bPaused\x20default\x20true\x20—\x20new\x20Arbitration\x20cannot\x20accept\x20disputes','pause(false)\x20to\x20enable,\x20pause(true)\x20to\x20disable','Paused\x20Arbitration\x20rejects\x20dispute\x20(E_PAUSED)','Does\x20not\x20affect\x20already-open\x20Arb\x20cases'],'recommended_templates':['T-AB-01']},{'id':'arbitration_service_statement','name':'Service\x20(defendant)\x20appends\x20a\x20text\x20statement\x20to\x20the\x20case\x20record','operation_category':'dispute','permission_index':0x141,'permission_name':'SERVICE_ARB_STATEMENT','requires_voting_guard':'not_applicable','requires_usage_guard':'not_applicable','has_passport_variant':!![],'governed_operations':['append\x20the\x20seller\x27s\x20text\x20statement\x20to\x20a\x20case\x20against\x20an\x20order\x20of\x20the\x20service\x20(ArbStatementEvent)'],'common_patterns':['Defendant-side\x20voice\x20WITHOUT\x20holding\x20the\x20order\x20—\x20the\x20arb/arbitration\x20function\x20family\x20is\x20order-anchored;\x20this\x20entry\x20is\x20service-anchored','PRIMARY\x20evidence\x20channel\x20is\x20Messenger:\x20submit\x20encrypted\x20WTS\x20records\x20of\x20the\x20exchange\x20with\x20the\x20order\x20customer\x20first','This\x20statement\x20is\x20the\x20SECONDARY\x20channel:\x20declare\x20facts\x20or\x20report\x20customer\x20behavior\x20(absence,\x20non-cooperation)\x20on\x20the\x20case\x20record','Event-only:\x20nothing\x20on\x20the\x20Arb\x20object\x20is\x20mutated;\x20the\x20record\x20cannot\x20be\x20rewritten\x20or\x20deleted\x20by\x20any\x20party','Text\x20length\x20cap\x20identical\x20to\x20description/objection\x20(DESCRIPTION\x20bound,\x204000)'],'recommended_templates':[]}];export const ARBITRATION_LEDGER_VERSION='1.0.0';export function getScenesByCategory(a){return ARBITRATION_SCENES['filter'](b=>b['operation_category']===a);}export function findSceneById(a){return ARBITRATION_SCENES['find'](b=>b['id']===a);}export function findSceneByPermissionIndex(a){return ARBITRATION_SCENES['find'](b=>b['permission_index']===a);}export function getPermissionByIndex(a){return ARBITRATION_PERMISSIONS['find'](b=>b['index']===a);}export function getPermissionByName(a){return ARBITRATION_PERMISSIONS['find'](b=>b['name']===a);}export function isReservedIndex(a){const b=getPermissionByIndex(a);return!!b?.['is_reserved'];}export function isUsedPermissionIndex(a){const b=getPermissionByIndex(a);return!!b&&!b['is_reserved'];}export function getActivePermissionCount(){return ARBITRATION_PERMISSIONS['filter'](a=>!a['is_reserved'])['length'];}export function inferSceneFromIntent(a){const b=a['toLowerCase'](),c=[{'keywords':['create','new'],'sceneId':'arbitration_create'},{'keywords':['dispute','file','complaint'],'sceneId':'arbitration_dispute'},{'keywords':['vote','voting','decide'],'sceneId':'arbitration_vote'},{'keywords':['confirm','materials'],'sceneId':'arbitration_confirm'},{'keywords':['feedback','opinion'],'sceneId':'arbitration_feedback'},{'keywords':['ruling','arbitration','verdict'],'sceneId':'arbitration_ruling'},{'keywords':['reset','resubmit'],'sceneId':'arbitration_reset'},{'keywords':['arb_withdraw','withdraw','withdraw\x20fees'],'sceneId':'arbitration_arb_withdraw'},{'keywords':['allocate','allocate\x20fees','fees\x20allocation'],'sceneId':'arbitration_fees_alloc'},{'keywords':['fees_transfer','transfer','transfer\x20in'],'sceneId':'arbitration_fees_transfer'},{'keywords':['voting_guard','voting\x20guard'],'sceneId':'arbitration_voting_guard_config'},{'keywords':['usage_guard','usage\x20guard'],'sceneId':'arbitration_usage_guard_config'},{'keywords':['pause','enable'],'sceneId':'arbitration_pause'}];for(const {keywords:d,sceneId:e}of c){if(d['some'](f=>b['includes'](f['toLowerCase']()))){const f=findSceneById(e);if(f)return f;}}return undefined;}export function getDualGuardMatrixEntry(a,b){return DUAL_GUARD_MATRIX['find'](c=>c['voting_guard_empty']===a&&c['usage_guard_empty']===b);}export function isValidArbStatusTransition(a,b){const c={'Principal_confirming':['Arbitrator_confirming'],'Arbitrator_confirming':['Voting','Principal_confirming'],'Voting':['Arbitrated'],'Arbitrated':['Objectionable','Finished','Withdrawn'],'Objectionable':['Principal_confirming'],'Finished':['Withdrawn'],'Withdrawn':[]};return c[a]?.['includes'](b)??![];}export function isTerminalArbStatus(a){return ARB_TERMINAL_STATUSES['includes'](a);}export function getScenesProducingStatus(a){return ARBITRATION_SCENES['filter'](b=>b['resulting_arb_status']===a);}export function getScenesRequiringStatus(a){return ARBITRATION_SCENES['filter'](b=>b['required_arb_status']?.['includes'](a));}export function getArbitrationScenesCount(){return ARBITRATION_SCENES['length'];}export function getAllArbitrationPermissions(){return[...ARBITRATION_PERMISSIONS];}export function getActiveArbitrationPermissions(){return ARBITRATION_PERMISSIONS['filter'](a=>!a['is_reserved']);}
@@ -39,4 +39,4 @@ export declare function hasBlockingErrors(findings: AuditFinding[]): boolean;
39
39
  export declare function getErrors(findings: AuditFinding[]): AuditFinding[];
40
40
  export declare function getWarnings(findings: AuditFinding[]): AuditFinding[];
41
41
  export declare function summarizeFindings(findings: AuditFinding[]): string;
42
- export declare const AUDIT_RULES_VERSION = 3;
42
+ export declare const AUDIT_RULES_VERSION = 5;