wowok
Version:
Wowok Blockchain TypeScript API
1 lines • 33.1 kB
JavaScript
import{toTxObject,toTxU16,toTxAddress,toTxAddressVec,toTxU16Vec,MAX_DESCRIPTION_LENGTH,isValidLongName,MAX_LONG_NAME_LENGTH,GetObject,GetObjectExisted,PackageAddress,serviceFn,IsValidArgType,contactFn}from'../common.js';import{W_ERROR,WErrors}from'../exception.js';import{isValidDescription,toTxString}from'../common.js';import{CallBase}from'./base.js';import{ObjectType,query_objects}from'../query/object.js';import{GetAccountOrMark_Address,GetManyAccountOrMark_Address,LocalMark}from'../local/index.js';import{parseObjectType,permission_set}from'../util.js';import{demandFn,machineFn,treasuryFn,arbitrationFn,repositoryFn,rewardFn}from'../common.js';import{query_received}from'../query/received.js';export var BuiltinPermissionIndex;(function(a){a[a['REPOSITORY_NEW']=0x64]='REPOSITORY_NEW',a[a['REPOSITORY_DESCRIPTION']=0x65]='REPOSITORY_DESCRIPTION',a[a['REPOSITORY_POLICY']=0x66]='REPOSITORY_POLICY',a[a['REPOSITORY_REWARD']=0x67]='REPOSITORY_REWARD',a[a['REPOSITORY_OWNER_RECEIVE']=0x68]='REPOSITORY_OWNER_RECEIVE',a[a['REPOSITORY_UM']=0x69]='REPOSITORY_UM',a[a['REWARD_NEW']=0x96]='REWARD_NEW',a[a['REWARD_DESCRIPTION']=0x97]='REWARD_DESCRIPTION',a[a['REWARD_GUARD']=0x98]='REWARD_GUARD',a[a['REWARD_COIN_ADD']=0x99]='REWARD_COIN_ADD',a[a['REWARD_RECEIVE']=0x9a]='REWARD_RECEIVE',a[a['REWARD_GUARD_EXPIRATION_TIME_ADD']=0x9b]='REWARD_GUARD_EXPIRATION_TIME_ADD',a[a['REWARD_OWNER_RECEIVE']=0x9c]='REWARD_OWNER_RECEIVE',a[a['REWARD_UM']=0x9d]='REWARD_UM',a[a['MACHINE_NEW']=0xc8]='MACHINE_NEW',a[a['MACHINE_DESCRIPTION']=0xc9]='MACHINE_DESCRIPTION',a[a['MACHINE_CONSENSUS_REPOSITORIES']=0xcb]='MACHINE_CONSENSUS_REPOSITORIES',a[a['MACHINE_PAUSE']=0xcc]='MACHINE_PAUSE',a[a['MACHINE_PUBLISH']=0xcd]='MACHINE_PUBLISH',a[a['MACHINE_NODE']=0xce]='MACHINE_NODE',a[a['MACHINE_OWNER_RECEIVE']=0xcf]='MACHINE_OWNER_RECEIVE',a[a['MACHINE_UM']=0xd0]='MACHINE_UM',a[a['PROGRESS_NEW']=0xdc]='PROGRESS_NEW',a[a['PROGRESS_NAMED_OPERATOR']=0xdd]='PROGRESS_NAMED_OPERATOR',a[a['PROGRESS_TASK']=0xde]='PROGRESS_TASK',a[a['PROGRESS_CONTEXT_REPOSITORY']=0xdf]='PROGRESS_CONTEXT_REPOSITORY',a[a['PROGRESS_UNHOLD']=0xe0]='PROGRESS_UNHOLD',a[a['PROGRESS_OWNER_RECEIVE']=0xe1]='PROGRESS_OWNER_RECEIVE',a[a['TREASURY_NEW']=0xfa]='TREASURY_NEW',a[a['TREASURY_DESCRIPTION']=0xfb]='TREASURY_DESCRIPTION',a[a['TREASURY_DEPOSIT']=0xfc]='TREASURY_DEPOSIT',a[a['TREASURY_RECEIVE']=0xfd]='TREASURY_RECEIVE',a[a['TREASURY_WITHDRAW']=0xfe]='TREASURY_WITHDRAW',a[a['TREASURY_EXTERNAL_DEPOSIT']=0xff]='TREASURY_EXTERNAL_DEPOSIT',a[a['TREASURY_EXTERNAL_WITHDRAW']=0x100]='TREASURY_EXTERNAL_WITHDRAW',a[a['TREASURY_EXTERNAL_DEPOSIT_GUARD']=0x101]='TREASURY_EXTERNAL_DEPOSIT_GUARD',a[a['TREASURY_EXTERNAL_WITHDRAW_GUARD']=0x102]='TREASURY_EXTERNAL_WITHDRAW_GUARD',a[a['TREASURY_OWNER_RECEIVE']=0x103]='TREASURY_OWNER_RECEIVE',a[a['TREASURY_UM']=0x104]='TREASURY_UM',a[a['SERVICE_NEW']=0x12c]='SERVICE_NEW',a[a['SERVICE_DESCRIPTION']=0x12d]='SERVICE_DESCRIPTION',a[a['SERVICE_LOCATION']=0x12f]='SERVICE_LOCATION',a[a['SERVICE_REPOSITORY']=0x130]='SERVICE_REPOSITORY',a[a['SERVICE_SALES']=0x131]='SERVICE_SALES',a[a['SERVICE_MACHINE']=0x132]='SERVICE_MACHINE',a[a['SERVICE_BUY_GUARD']=0x133]='SERVICE_BUY_GUARD',a[a['SERVICE_ARBITRATION']=0x134]='SERVICE_ARBITRATION',a[a['SERVICE_CUSTOMER_INFO_REQUIRED']=0x135]='SERVICE_CUSTOMER_INFO_REQUIRED',a[a['SERVICE_PAUSE']=0x136]='SERVICE_PAUSE',a[a['SERVICE_PUBLISH']=0x137]='SERVICE_PUBLISH',a[a['SERVICE_DISCOUNT']=0x138]='SERVICE_DISCOUNT',a[a['SERVICE_ORDER_ALLOCATOR']=0x139]='SERVICE_ORDER_ALLOCATOR',a[a['SERVICE_COMPENSATION_FUND_WITHDRAW']=0x13a]='SERVICE_COMPENSATION_FUND_WITHDRAW',a[a['SERVICE_COMPENSATION_FUND_DEPOSIT']=0x13b]='SERVICE_COMPENSATION_FUND_DEPOSIT',a[a['SERVICE_COMPENSATION_FUND_RECEIVE']=0x13c]='SERVICE_COMPENSATION_FUND_RECEIVE',a[a['SERVICE_COMPENSATION_LOCKED_TIME_ADD']=0x13d]='SERVICE_COMPENSATION_LOCKED_TIME_ADD',a[a['SERVICE_REWARD']=0x13e]='SERVICE_REWARD',a[a['SERVICE_OWNER_RECEIVE']=0x13f]='SERVICE_OWNER_RECEIVE',a[a['SERVICE_UM']=0x140]='SERVICE_UM',a[a['ARBITRATION_NEW']=0x15e]='ARBITRATION_NEW',a[a['ARBITRATION_DESCRIPTION']=0x15f]='ARBITRATION_DESCRIPTION',a[a['ARBITRATION_LOCATION']=0x161]='ARBITRATION_LOCATION',a[a['ARBITRATION_VOTING_GUARD']=0x162]='ARBITRATION_VOTING_GUARD',a[a['ARBITRATION_USAGE_GUARD']=0x163]='ARBITRATION_USAGE_GUARD',a[a['ARBITRATION_PAUSE']=0x164]='ARBITRATION_PAUSE',a[a['ARBITRATION_FEE']=0x165]='ARBITRATION_FEE',a[a['ARBITRATION_VOTE']=0x166]='ARBITRATION_VOTE',a[a['ARBITRATION_ARBITRATION']=0x167]='ARBITRATION_ARBITRATION',a[a['ARBITRATION_FEEDBACK']=0x168]='ARBITRATION_FEEDBACK',a[a['ARBITRATION_CONFIRM']=0x169]='ARBITRATION_CONFIRM',a[a['ARBITRATION_VOTING_DEADLINE_CHANGE']=0x16a]='ARBITRATION_VOTING_DEADLINE_CHANGE',a[a['ARBITRATION_RESET']=0x16b]='ARBITRATION_RESET',a[a['ARBITRATION_ARB_WITHDRAW']=0x16c]='ARBITRATION_ARB_WITHDRAW',a[a['ARBITRATION_FEES_ALLOC']=0x16d]='ARBITRATION_FEES_ALLOC',a[a['ARBITRATION_FEES_TRANSFER']=0x16e]='ARBITRATION_FEES_TRANSFER',a[a['ARBITRATION_OWNER_RECEIVE']=0x16f]='ARBITRATION_OWNER_RECEIVE',a[a['ARBITRATION_UM']=0x170]='ARBITRATION_UM',a[a['DEMAND_NEW']=0x190]='DEMAND_NEW',a[a['DEMAND_DESCRIPTION']=0x191]='DEMAND_DESCRIPTION',a[a['DEMAND_LOCATION']=0x192]='DEMAND_LOCATION',a[a['DEMAND_GUARD']=0x194]='DEMAND_GUARD',a[a['DEMAND_REWARD']=0x195]='DEMAND_REWARD',a[a['DEMAND_FEEDBACK']=0x196]='DEMAND_FEEDBACK',a[a['DEMAND_OWNER_RECEIVE']=0x197]='DEMAND_OWNER_RECEIVE',a[a['DEMAND_UM']=0x198]='DEMAND_UM',a[a['MESSNGER_NEW']=0x1c2]='MESSNGER_NEW',a[a['MESSNGER_DESCRIPTION']=0x1c3]='MESSNGER_DESCRIPTION',a[a['MESSNGER_LOCATION']=0x1c4]='MESSNGER_LOCATION',a[a['MESSNGER_IM']=0x1c5]='MESSNGER_IM',a[a['MESSNGER_OWNER_RECEIVE']=0x1c6]='MESSNGER_OWNER_RECEIVE';}(BuiltinPermissionIndex||(BuiltinPermissionIndex={})));export const PermissionInfo=[{'index':BuiltinPermissionIndex['REPOSITORY_NEW'],'name':'repository.new','description':'Create\x20new\x20repository','object_type':ObjectType['Repository']},{'index':BuiltinPermissionIndex['REPOSITORY_DESCRIPTION'],'name':'repository.description','description':'Set\x20repository\x20description','object_type':ObjectType['Repository']},{'index':BuiltinPermissionIndex['REPOSITORY_POLICY'],'name':'repository.policy','description':'Manage\x20repository\x20policies','object_type':ObjectType['Repository']},{'index':BuiltinPermissionIndex['REPOSITORY_REWARD'],'name':'repository.reward','description':'Manage\x20repository\x20rewards','object_type':ObjectType['Repository']},{'index':BuiltinPermissionIndex['REPOSITORY_OWNER_RECEIVE'],'name':'repository.owner_receive','description':'Receive\x20objects\x20or\x20payments\x20for\x20repository','object_type':ObjectType['Repository']},{'index':BuiltinPermissionIndex['REPOSITORY_UM'],'name':'repository.um','description':'Manage\x20repository\x20UM\x20(User\x20Manager)','object_type':ObjectType['Repository']},{'index':BuiltinPermissionIndex['REWARD_NEW'],'name':'reward.new','description':'Create\x20new\x20reward','object_type':ObjectType['Reward']},{'index':BuiltinPermissionIndex['REWARD_DESCRIPTION'],'name':'reward.description','description':'Set\x20reward\x20description','object_type':ObjectType['Reward']},{'index':BuiltinPermissionIndex['REWARD_GUARD'],'name':'reward.guard','description':'Manage\x20reward\x20guards','object_type':ObjectType['Reward']},{'index':BuiltinPermissionIndex['REWARD_COIN_ADD'],'name':'reward.coin_add','description':'Add\x20coin\x20to\x20reward','object_type':ObjectType['Reward']},{'index':BuiltinPermissionIndex['REWARD_RECEIVE'],'name':'reward.receive','description':'Receive\x20payment\x20for\x20reward','object_type':ObjectType['Reward']},{'index':BuiltinPermissionIndex['REWARD_GUARD_EXPIRATION_TIME_ADD'],'name':'reward.guard_expiration_time_add','description':'Add\x20guard\x20expiration\x20time','object_type':ObjectType['Reward']},{'index':BuiltinPermissionIndex['REWARD_OWNER_RECEIVE'],'name':'reward.owner_receive','description':'Receive\x20objects\x20or\x20payments\x20for\x20reward','object_type':ObjectType['Reward']},{'index':BuiltinPermissionIndex['REWARD_UM'],'name':'reward.um','description':'Manage\x20reward\x20UM\x20(User\x20Manager)','object_type':ObjectType['Reward']},{'index':BuiltinPermissionIndex['MACHINE_NEW'],'name':'machine.new','description':'Create\x20new\x20machine','object_type':ObjectType['Machine']},{'index':BuiltinPermissionIndex['MACHINE_DESCRIPTION'],'name':'machine.description','description':'Set\x20machine\x20description','object_type':ObjectType['Machine']},{'index':BuiltinPermissionIndex['MACHINE_CONSENSUS_REPOSITORIES'],'name':'machine.consensus_repositories','description':'Manage\x20machine\x20consensus\x20repositories','object_type':ObjectType['Machine']},{'index':BuiltinPermissionIndex['MACHINE_PAUSE'],'name':'machine.pause','description':'Pause\x20or\x20resume\x20machine','object_type':ObjectType['Machine']},{'index':BuiltinPermissionIndex['MACHINE_PUBLISH'],'name':'machine.publish','description':'Publish\x20machine','object_type':ObjectType['Machine']},{'index':BuiltinPermissionIndex['MACHINE_NODE'],'name':'machine.node','description':'Manage\x20machine\x20nodes','object_type':ObjectType['Machine']},{'index':BuiltinPermissionIndex['MACHINE_OWNER_RECEIVE'],'name':'machine.owner_receive','description':'Receive\x20objects\x20or\x20payments\x20for\x20machine','object_type':ObjectType['Machine']},{'index':BuiltinPermissionIndex['MACHINE_UM'],'name':'machine.um','description':'Manage\x20machine\x20UM\x20(User\x20Manager)','object_type':ObjectType['Machine']},{'index':BuiltinPermissionIndex['PROGRESS_NEW'],'name':'progress.new','description':'Create\x20new\x20progress','object_type':ObjectType['Progress']},{'index':BuiltinPermissionIndex['PROGRESS_NAMED_OPERATOR'],'name':'progress.namedOperator','description':'Manage\x20progress\x20named\x20operators\x20(add,\x20remove,\x20set)','object_type':ObjectType['Progress']},{'index':BuiltinPermissionIndex['PROGRESS_TASK'],'name':'progress.task','description':'Set\x20progress\x20task','object_type':ObjectType['Progress']},{'index':BuiltinPermissionIndex['PROGRESS_CONTEXT_REPOSITORY'],'name':'progress.context_repository','description':'Manage\x20progress\x20context\x20repositories\x20(add,\x20remove,\x20clear)','object_type':ObjectType['Progress']},{'index':BuiltinPermissionIndex['PROGRESS_UNHOLD'],'name':'progress.unhold','description':'Unhold\x20progress','object_type':ObjectType['Progress']},{'index':BuiltinPermissionIndex['PROGRESS_OWNER_RECEIVE'],'name':'progress.owner_receive','description':'Receive\x20objects\x20or\x20payments\x20for\x20progress','object_type':ObjectType['Progress']},{'index':BuiltinPermissionIndex['TREASURY_NEW'],'name':'treasury.new','description':'Create\x20new\x20treasury','object_type':ObjectType['Treasury']},{'index':BuiltinPermissionIndex['TREASURY_DESCRIPTION'],'name':'treasury.description','description':'Set\x20treasury\x20description','object_type':ObjectType['Treasury']},{'index':BuiltinPermissionIndex['TREASURY_DEPOSIT'],'name':'treasury.deposit','description':'Deposit\x20coins\x20to\x20treasury','object_type':ObjectType['Treasury']},{'index':BuiltinPermissionIndex['TREASURY_RECEIVE'],'name':'treasury.receive','description':'Receive\x20payment\x20for\x20treasury','object_type':ObjectType['Treasury']},{'index':BuiltinPermissionIndex['TREASURY_WITHDRAW'],'name':'treasury.withdraw','description':'Withdraw\x20coins\x20from\x20treasury','object_type':ObjectType['Treasury']},{'index':BuiltinPermissionIndex['TREASURY_EXTERNAL_DEPOSIT'],'name':'treasury.external_deposit','description':'External\x20deposit\x20to\x20treasury','object_type':ObjectType['Treasury']},{'index':BuiltinPermissionIndex['TREASURY_EXTERNAL_WITHDRAW'],'name':'treasury.external_withdraw','description':'External\x20withdraw\x20from\x20treasury','object_type':ObjectType['Treasury']},{'index':BuiltinPermissionIndex['TREASURY_EXTERNAL_DEPOSIT_GUARD'],'name':'treasury.external_deposit_guard','description':'Manage\x20treasury\x20external\x20deposit\x20guards','object_type':ObjectType['Treasury']},{'index':BuiltinPermissionIndex['TREASURY_EXTERNAL_WITHDRAW_GUARD'],'name':'treasury.external_withdraw_guard','description':'Manage\x20treasury\x20external\x20withdraw\x20guards','object_type':ObjectType['Treasury']},{'index':BuiltinPermissionIndex['TREASURY_OWNER_RECEIVE'],'name':'treasury.owner_receive','description':'Receive\x20objects\x20or\x20payments\x20for\x20treasury','object_type':ObjectType['Treasury']},{'index':BuiltinPermissionIndex['TREASURY_UM'],'name':'treasury.um','description':'Manage\x20treasury\x20UM\x20(User\x20Manager)','object_type':ObjectType['Treasury']},{'index':BuiltinPermissionIndex['SERVICE_NEW'],'name':'service.new','description':'Create\x20new\x20service','object_type':ObjectType['Service']},{'index':BuiltinPermissionIndex['SERVICE_DESCRIPTION'],'name':'service.description','description':'Set\x20service\x20description','object_type':ObjectType['Service']},{'index':BuiltinPermissionIndex['SERVICE_LOCATION'],'name':'service.location','description':'Set\x20service\x20location','object_type':ObjectType['Service']},{'index':BuiltinPermissionIndex['SERVICE_REPOSITORY'],'name':'service.repository','description':'Manage\x20service\x20repositories','object_type':ObjectType['Service']},{'index':BuiltinPermissionIndex['SERVICE_SALES'],'name':'service.sales','description':'Manage\x20service\x20sales','object_type':ObjectType['Service']},{'index':BuiltinPermissionIndex['SERVICE_MACHINE'],'name':'service.machine','description':'Manage\x20service\x20machines','object_type':ObjectType['Service']},{'index':BuiltinPermissionIndex['SERVICE_BUY_GUARD'],'name':'service.buy_guard','description':'Manage\x20service\x20buy\x20guards','object_type':ObjectType['Service']},{'index':BuiltinPermissionIndex['SERVICE_ARBITRATION'],'name':'service.arbitration','description':'Manage\x20service\x20arbitrations','object_type':ObjectType['Service']},{'index':BuiltinPermissionIndex['SERVICE_CUSTOMER_INFO_REQUIRED'],'name':'service.customer_info_required','description':'Manage\x20service\x20customer\x20info\x20requirements','object_type':ObjectType['Service']},{'index':BuiltinPermissionIndex['SERVICE_PAUSE'],'name':'service.pause','description':'Pause\x20or\x20resume\x20service','object_type':ObjectType['Service']},{'index':BuiltinPermissionIndex['SERVICE_PUBLISH'],'name':'service.publish','description':'Publish\x20service','object_type':ObjectType['Service']},{'index':BuiltinPermissionIndex['SERVICE_DISCOUNT'],'name':'service.discount','description':'Manage\x20service\x20discounts','object_type':ObjectType['Service']},{'index':BuiltinPermissionIndex['SERVICE_ORDER_ALLOCATOR'],'name':'service.order_allocator','description':'Manage\x20service\x20order\x20allocators','object_type':ObjectType['Service']},{'index':BuiltinPermissionIndex['SERVICE_COMPENSATION_FUND_WITHDRAW'],'name':'service.compensation_fund_withdraw','description':'Withdraw\x20from\x20service\x20compensation\x20fund','object_type':ObjectType['Service']},{'index':BuiltinPermissionIndex['SERVICE_COMPENSATION_FUND_DEPOSIT'],'name':'service.compensation_fund_deposit','description':'Deposit\x20to\x20service\x20compensation\x20fund','object_type':ObjectType['Service']},{'index':BuiltinPermissionIndex['SERVICE_COMPENSATION_FUND_RECEIVE'],'name':'service.compensation_fund_receive','description':'Receive\x20payments\x20for\x20service\x20compensation\x20fund','object_type':ObjectType['Service']},{'index':BuiltinPermissionIndex['SERVICE_COMPENSATION_LOCKED_TIME_ADD'],'name':'service.compensation_locked_time_add','description':'Add\x20locked\x20time\x20to\x20service\x20compensation','object_type':ObjectType['Service']},{'index':BuiltinPermissionIndex['SERVICE_REWARD'],'name':'service.reward','description':'Manage\x20service\x20rewards','object_type':ObjectType['Service']},{'index':BuiltinPermissionIndex['SERVICE_OWNER_RECEIVE'],'name':'service.owner_receive','description':'Receive\x20objects\x20or\x20payments\x20for\x20service','object_type':ObjectType['Service']},{'index':BuiltinPermissionIndex['SERVICE_UM'],'name':'service.um','description':'Manage\x20service\x20UM\x20(User\x20Manager)','object_type':ObjectType['Service']},{'index':BuiltinPermissionIndex['ARBITRATION_NEW'],'name':'arbitration.new','description':'Create\x20new\x20arbitration','object_type':ObjectType['Arbitration']},{'index':BuiltinPermissionIndex['ARBITRATION_DESCRIPTION'],'name':'arbitration.description','description':'Set\x20arbitration\x20description','object_type':ObjectType['Arbitration']},{'index':BuiltinPermissionIndex['ARBITRATION_LOCATION'],'name':'arbitration.location','description':'Set\x20arbitration\x20location','object_type':ObjectType['Arbitration']},{'index':BuiltinPermissionIndex['ARBITRATION_VOTING_GUARD'],'name':'arbitration.voting_guard','description':'Manage\x20arbitration\x20voting\x20guards','object_type':ObjectType['Arbitration']},{'index':BuiltinPermissionIndex['ARBITRATION_USAGE_GUARD'],'name':'arbitration.usage_guard','description':'Set\x20arbitration\x20usage\x20guard','object_type':ObjectType['Arbitration']},{'index':BuiltinPermissionIndex['ARBITRATION_PAUSE'],'name':'arbitration.pause','description':'Pause\x20or\x20resume\x20arbitration','object_type':ObjectType['Arbitration']},{'index':BuiltinPermissionIndex['ARBITRATION_FEE'],'name':'arbitration.fee','description':'Set\x20arbitration\x20fee','object_type':ObjectType['Arbitration']},{'index':BuiltinPermissionIndex['ARBITRATION_VOTE'],'name':'arbitration.vote','description':'Vote\x20on\x20arbitration','object_type':ObjectType['Arbitration']},{'index':BuiltinPermissionIndex['ARBITRATION_ARBITRATION'],'name':'arbitration.arbitration','description':'Perform\x20arbitration','object_type':ObjectType['Arbitration']},{'index':BuiltinPermissionIndex['ARBITRATION_FEEDBACK'],'name':'arbitration.feedback','description':'Provide\x20arbitration\x20feedback','object_type':ObjectType['Arbitration']},{'index':BuiltinPermissionIndex['ARBITRATION_CONFIRM'],'name':'arbitration.confirm','description':'Confirm\x20arbitration','object_type':ObjectType['Arbitration']},{'index':BuiltinPermissionIndex['ARBITRATION_VOTING_DEADLINE_CHANGE'],'name':'arbitration.voting_deadline_change','description':'Change\x20voting\x20deadline','object_type':ObjectType['Arbitration']},{'index':BuiltinPermissionIndex['ARBITRATION_RESET'],'name':'arbitration.reset','description':'Reset\x20arbitration','object_type':ObjectType['Arbitration']},{'index':BuiltinPermissionIndex['ARBITRATION_ARB_WITHDRAW'],'name':'arbitration.arb_withdraw','description':'Withdraw\x20arbitration','object_type':ObjectType['Arbitration']},{'index':BuiltinPermissionIndex['ARBITRATION_FEES_ALLOC'],'name':'arbitration.fees_alloc','description':'Allocate\x20arbitration\x20fees','object_type':ObjectType['Arbitration']},{'index':BuiltinPermissionIndex['ARBITRATION_FEES_TRANSFER'],'name':'arbitration.fees_transfer','description':'Transfer\x20arbitration\x20fees','object_type':ObjectType['Arbitration']},{'index':BuiltinPermissionIndex['ARBITRATION_OWNER_RECEIVE'],'name':'arbitration.owner_receive','description':'Receive\x20objects\x20or\x20payments\x20for\x20arbitration','object_type':ObjectType['Arbitration']},{'index':BuiltinPermissionIndex['ARBITRATION_UM'],'name':'arbitration.um','description':'Manage\x20arbitration\x20UM\x20(User\x20Manager)','object_type':ObjectType['Arbitration']},{'index':BuiltinPermissionIndex['DEMAND_NEW'],'name':'demand.new','description':'Create\x20new\x20demand','object_type':ObjectType['Demand']},{'index':BuiltinPermissionIndex['DEMAND_DESCRIPTION'],'name':'demand.description','description':'Set\x20demand\x20description','object_type':ObjectType['Demand']},{'index':BuiltinPermissionIndex['DEMAND_LOCATION'],'name':'demand.location','description':'Set\x20demand\x20location','object_type':ObjectType['Demand']},{'index':BuiltinPermissionIndex['DEMAND_GUARD'],'name':'demand.guard','description':'Manage\x20demand\x20guards','object_type':ObjectType['Demand']},{'index':BuiltinPermissionIndex['DEMAND_REWARD'],'name':'demand.reward','description':'Manage\x20demand\x20rewards','object_type':ObjectType['Demand']},{'index':BuiltinPermissionIndex['DEMAND_FEEDBACK'],'name':'demand.feedback','description':'Provide\x20demand\x20feedback','object_type':ObjectType['Demand']},{'index':BuiltinPermissionIndex['DEMAND_OWNER_RECEIVE'],'name':'demand.owner_receive','description':'Receive\x20objects\x20for\x20demand','object_type':ObjectType['Demand']},{'index':BuiltinPermissionIndex['DEMAND_UM'],'name':'demand.um','description':'Manage\x20demand\x20UM\x20(User\x20Manager)','object_type':ObjectType['Demand']},{'index':BuiltinPermissionIndex['MESSNGER_NEW'],'name':'messenger.new','description':'Create\x20new\x20messenger','object_type':ObjectType['Contact']},{'index':BuiltinPermissionIndex['MESSNGER_DESCRIPTION'],'name':'messenger.description','description':'Set\x20messenger\x20description','object_type':ObjectType['Contact']},{'index':BuiltinPermissionIndex['MESSNGER_LOCATION'],'name':'messenger.location','description':'Set\x20messenger\x20location','object_type':ObjectType['Contact']},{'index':BuiltinPermissionIndex['MESSNGER_IM'],'name':'messenger.im','description':'Manager\x20im\x20address','object_type':ObjectType['Contact']},{'index':BuiltinPermissionIndex['MESSNGER_OWNER_RECEIVE'],'name':'messenger.owner_receive','description':'Receive\x20objects\x20or\x20payments\x20for\x20messenger','object_type':ObjectType['Contact']}];export class CallPermission extends CallBase{['data'];['object_address']=undefined;['object_data']=undefined;constructor(a){super(),this['data']=a;}async['prepare'](a){await super['prepare'](a),!this['object_address']&&(this['object_address']=await GetObjectExisted(this['data']?.['object']));}async['call'](a){await this['prepare'](a);let b=![],c=![];if(this['object_address'])return(this['data']?.['builder']!=null||this['data']?.['admin']!=null||this['data']?.['um']!==undefined)&&(b=!![]),(this['data']?.['table']!=null||this['data']?.['entity']!=null||this['data']?.['remark']!=null||this['data']?.['description']!=null)&&(c=!![]),await this['check_permission_and_call'](a,this['object_address'],[],[],b,c);return await this['exec'](a);}async['operate'](a,c,d,e){let f;this['object_address']?f=toTxObject(c,this['object_address']):f=newPermission(c,this['data']?.['description']??'');!f&&W_ERROR(WErrors['InvalidParam'],'CallPermission_Data.data.object');this['data']?.['description']!=null&&this['object_address']&&descriptionSet(c,f,this['data']['description']);if(this['data']?.['remark']!=null)switch(this['data']['remark']['op']){case'set':{const g=this['data']['remark']['index'],h=this['data']['remark']['remark'];remarkSet(c,f,g,h);break;}case'remove':{const i=this['data']['remark']['index'];remarkRemove(c,f,i);break;}case'clear':{remarkClear(c,f);break;}}if(this['data']?.['table']!=null)switch(this['data']['table']['op']){case'add\x20perm\x20by\x20index':{const j=this['data']['table']['index'],k=await GetManyAccountOrMark_Address(this['data']['table']['entity']);permAdd(c,f,j,k);break;}case'remove\x20perm\x20by\x20index':{const l=this['data']['table']['index'],m=await GetManyAccountOrMark_Address(this['data']['table']['entity']);permRemove(c,f,l,m);break;}case'set\x20perm\x20by\x20index':{const n=this['data']['table']['index'],o=await GetManyAccountOrMark_Address(this['data']['table']['entity']);permSet(c,f,n,o);break;}case'add\x20perm\x20by\x20entity':{const q=await GetAccountOrMark_Address(this['data']['table']['entity']);q&&entityAdd(c,f,q,this['data']['table']['index']);break;}case'remove\x20perm\x20by\x20entity':{const s=await GetAccountOrMark_Address(this['data']['table']['entity']);s&&entityRemove(c,f,s,this['data']['table']['index']);break;}case'set\x20perm\x20by\x20entity':{const t=await GetAccountOrMark_Address(this['data']['table']['entity']);t&&entitySet(c,f,t,this['data']['table']['index']);break;}}if(this['data']?.['entity']!=null)switch(this['data']['entity']['op']){case'swap':{const u=await GetAccountOrMark_Address(this['data']['entity']['entity1']),v=await GetAccountOrMark_Address(this['data']['entity']['entity2']);if(u&&v)entitySwap(c,f,u,v);break;}case'replace':{const w=await GetAccountOrMark_Address(this['data']['entity']['entity1']),x=await GetAccountOrMark_Address(this['data']['entity']['entity2']);if(w&&x)entityReplace(c,f,w,x);break;}case'copy':{const y=await GetAccountOrMark_Address(this['data']['entity']['entity1']),z=await GetAccountOrMark_Address(this['data']['entity']['entity2']);if(y&&z)entityCopy(c,f,y,z);break;}case'del':{const A=await GetAccountOrMark_Address(this['data']['entity']['entity']);if(A)entityDel(c,f,A);break;}}if(this['data']?.['admin']!=null){const B=await GetManyAccountOrMark_Address(this['data']['admin']['addresses']);switch(this['data']['admin']?.['op']){case'add':{adminAdd(c,f,B);break;}case'set':{adminSet(c,f,B);break;}case'remove':{adminRemove(c,f,B);break;}}}if(this['data']?.['apply']!=null&&this['data']['apply']['length']>0x0){const C=await query_objects({'objects':this['data']['apply'],'no_cache':a['no_cache'],'network':a['network']});(!C['objects']||C['objects']['length']!==this['data']['apply']['length'])&&W_ERROR(WErrors['InvalidParam'],'CallPermission_Data.data.apply\x20some\x20objects\x20not\x20found\x20'+this['data']['apply']),C['objects']?.['forEach'](D=>{switch(D['type']){case'Demand':const E=D;permission_set(c,E['object'],E['permission'],f,parseObjectType(E['type_raw'],'demand::Demand'),L=>demandFn(L));break;case'Machine':const F=D;permission_set(c,F['object'],F['permission'],f,undefined,L=>machineFn(L));break;case'Service':const G=D;permission_set(c,G['object'],G['permission'],f,parseObjectType(G['type_raw'],'service::Service'),L=>serviceFn(L));break;case'Treasury':const H=D;permission_set(c,H['object'],H['permission'],f,parseObjectType(H['type_raw'],'treasury::Treasury'),L=>treasuryFn(L));break;case'Arbitration':const I=D;permission_set(c,I['object'],I['permission'],f,parseObjectType(I['type_raw'],'arbitration::Arbitration'),L=>arbitrationFn(L));break;case'Repository':const J=D;permission_set(c,J['object'],J['permission'],f,undefined,L=>repositoryFn(L));break;case'Reward':const K=D;permission_set(c,K['object'],K['permission'],f,parseObjectType(K['type_raw'],'reward::Reward'),L=>rewardFn(L));break;}});}if(this['data']?.['builder']!=null){const D=await GetAccountOrMark_Address(this['data']['builder']);if(D)transferPermission(c,f,D);}if(this['data']['owner_receive']!=null&&this['object_address']){this['data']['owner_receive']==='recently'&&(this['data']['owner_receive']=await query_received({'name_or_address':{'name_or_address':this['object_address'],'local_mark_first':!![]},'all_type':!![],'no_cache':a['no_cache'],'network':a['network']}));if(Array['isArray'](this['data']['owner_receive']))for(const E of this['data']['owner_receive']){!IsValidArgType(E['type'])&&W_ERROR(WErrors['IsValidArgType'],'Invalid\x20type:\x20'+E['type']);const F=await LocalMark['Instance']()['get_address'](E['id']);!F&&W_ERROR(WErrors['IsValidArgType'],'Received\x20'+E['id']+'\x20is\x20invalid'),ownerReceiveObject(c,f,F,E['type']);}else for(const G of this['data']['owner_receive']['received']){const [H,I]=await Promise['all']([LocalMark['Instance']()['get_address'](G['id']),LocalMark['Instance']()['get_address'](G['payment'])]);(!H||!I)&&W_ERROR(WErrors['IsValidArgType'],'Received\x20'+G['id']+'\x20or\x20Payment\x20'+G['payment']+'\x20is\x20invalid'),ownerReceive(c,f,H,I,this['data']['owner_receive']['token_type']);}}if(this['data']['um']!==undefined){let J=null;this['data']['um']&&(J=await LocalMark['Instance']()['get_address'](this['data']['um'])||null,!J&&W_ERROR(WErrors['InvalidParam'],'CallPermission_Data.data.um:'+this['data']['um'])),um_set(c,f,J);}!this['object_address']&&await this['new_with_mark'](a,c,ObjectType['Permission'],create(c,f),GetObject(this['data']?.['object']));}}export function permissionFn(a){return PackageAddress+'::permission::'+a;}export const MAX_ENTITY_COUNT=0x3e8;export const MAX_PERM_FOR_ENTITY=0x3e8;export const MAX_ADMIN_COUNT=0x1f4;export const USER_DEFINED_PERM_INDEX_START=0x3e8;export function isBizPermIndex(a){return a>=USER_DEFINED_PERM_INDEX_START;}export function newPermission(a,b){return typeof b==='string'&&!isValidDescription(b)&&W_ERROR(WErrors['IsValidDescription'],'Description\x20exceeds\x20maximum\x20length\x20'+MAX_DESCRIPTION_LENGTH),a['moveCall']({'target':permissionFn('new'),'arguments':[toTxString(a,b)]});}export function create(a,b){return a['moveCall']({'target':permissionFn('create'),'arguments':[toTxObject(a,b)]});}export function descriptionSet(a,b,c){typeof c==='string'&&!isValidDescription(c)&&W_ERROR(WErrors['IsValidDescription'],'Description\x20exceeds\x20maximum\x20length\x20'+MAX_DESCRIPTION_LENGTH),a['moveCall']({'target':permissionFn('description_set'),'arguments':[toTxObject(a,b),toTxString(a,c)]});}export function remarkSet(a,b,c,d){typeof d==='string'&&!isValidLongName(d)&&W_ERROR(WErrors['IsValidDescription'],'Remark\x20exceeds\x20maximum\x20length\x20'+MAX_LONG_NAME_LENGTH),a['moveCall']({'target':permissionFn('remark_set'),'arguments':[toTxObject(a,b),toTxU16(a,c),toTxString(a,d)]});}export function remarkRemove(a,b,c){a['moveCall']({'target':permissionFn('remark_remove'),'arguments':[toTxObject(a,b),toTxU16(a,c)]});}export function remarkClear(a,b){a['moveCall']({'target':permissionFn('remark_clear'),'arguments':[toTxObject(a,b)]});}export function permAdd(a,b,c,d){a['moveCall']({'target':permissionFn('perm_add'),'arguments':[toTxObject(a,b),toTxU16(a,c),toTxAddressVec(a,d,MAX_ENTITY_COUNT),a['object']['mutRegistrar'](),a['object']['clock']()]});}export function permRemove(a,b,c,d){a['moveCall']({'target':permissionFn('perm_remove'),'arguments':[toTxObject(a,b),toTxU16(a,c),toTxAddressVec(a,d,MAX_ENTITY_COUNT)]});}export function permSet(a,b,c,d){a['moveCall']({'target':permissionFn('perm_set'),'arguments':[toTxObject(a,b),toTxU16(a,c),toTxAddressVec(a,d,MAX_ENTITY_COUNT),a['object']['mutRegistrar'](),a['object']['clock']()]});}export function entityAdd(a,b,c,d){a['moveCall']({'target':permissionFn('entity_add'),'arguments':[toTxObject(a,b),toTxAddress(a,c),toTxU16Vec(a,d,MAX_PERM_FOR_ENTITY),a['object']['mutRegistrar'](),a['object']['clock']()]});}export function entityRemove(a,b,c,d){a['moveCall']({'target':permissionFn('entity_remove'),'arguments':[toTxObject(a,b),toTxAddress(a,c),toTxU16Vec(a,d,MAX_PERM_FOR_ENTITY)]});}export function entitySet(a,b,c,d){a['moveCall']({'target':permissionFn('entity_set'),'arguments':[toTxObject(a,b),toTxAddress(a,c),toTxU16Vec(a,d,MAX_PERM_FOR_ENTITY),a['object']['mutRegistrar'](),a['object']['clock']()]});}export function entitySwap(a,b,c,d){a['moveCall']({'target':permissionFn('entity_swap'),'arguments':[toTxObject(a,b),toTxAddress(a,c),toTxAddress(a,d),a['object']['mutRegistrar'](),a['object']['clock']()]});}export function entityReplace(a,b,c,d){a['moveCall']({'target':permissionFn('entity_replace'),'arguments':[toTxObject(a,b),toTxAddress(a,c),toTxAddress(a,d),a['object']['mutRegistrar'](),a['object']['clock']()]});}export function entityDel(a,b,c){a['moveCall']({'target':permissionFn('entity_del'),'arguments':[toTxObject(a,b),toTxAddress(a,c),a['object']['mutRegistrar']()]});}export function entityCopy(a,b,c,d){a['moveCall']({'target':permissionFn('entity_copy'),'arguments':[toTxObject(a,b),toTxAddress(a,c),toTxAddress(a,d),a['object']['mutRegistrar'](),a['object']['clock']()]});}export function adminAdd(a,b,c){a['moveCall']({'target':permissionFn('admin_add'),'arguments':[toTxObject(a,b),toTxAddressVec(a,c,MAX_ADMIN_COUNT)]});}export function adminRemove(a,b,c){a['moveCall']({'target':permissionFn('admin_remove'),'arguments':[toTxObject(a,b),toTxAddressVec(a,c,MAX_ADMIN_COUNT)]});}export function adminSet(a,b,c){a['moveCall']({'target':permissionFn('admin_set'),'arguments':[toTxObject(a,b),toTxAddressVec(a,c,MAX_ADMIN_COUNT)]});}export function transferPermission(a,b,c){a['moveCall']({'target':permissionFn('transfer'),'arguments':[toTxObject(a,b),toTxAddress(a,c)]});}export function um_set(a,b,c){c?a['moveCall']({'target':contactFn('permission_um_set'),'arguments':[toTxObject(a,c),toTxObject(a,b),a['object']['mutRegistrar'](),a['object']['clock']()]}):a['moveCall']({'target':permissionFn('um_none'),'arguments':[toTxObject(a,b),a['object']['mutRegistrar']()]});}export function ownerReceiveObject(a,b,c,d){a['moveCall']({'target':permissionFn('owner_receive_object'),'arguments':[toTxObject(a,b),toTxObject(a,c)],'typeArguments':[d]});}export function ownerReceive(a,b,c,d,e){a['moveCall']({'target':permissionFn('owner_receive'),'arguments':[toTxObject(a,b),toTxObject(a,c),toTxObject(a,d)],'typeArguments':[e]});}export function query_permissions(a){if(!a)return PermissionInfo;return PermissionInfo['filter'](b=>{if(a['objectType']&&b['object_type']!==a['objectType'])return![];if(a['name']&&!b['name']['includes'](a['name']))return![];if(a['index']!==undefined&&b['index']!==a['index'])return![];if(a['description']&&!b['description']['includes'](a['description']))return![];return!![];});}