wowok 2.2.9 → 2.2.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/w/call/guard-ins.js +1 -1
- package/dist/cjs/w/call/guard.d.ts +1 -1
- package/dist/cjs/w/call/guard.js +1 -1
- package/dist/cjs/w/call/permission.js +1 -1
- package/dist/cjs/w/call/service.d.ts +3 -3
- package/dist/cjs/w/call/service.js +1 -1
- package/dist/cjs/w/exception.js +1 -1
- package/dist/cjs/w/query/object.d.ts +1 -1
- package/dist/cjs/w/query/object.js +1 -1
- package/dist/esm/w/call/guard-ins.js +1 -1
- package/dist/esm/w/call/guard.d.ts +1 -1
- package/dist/esm/w/call/guard.js +1 -1
- package/dist/esm/w/call/permission.js +1 -1
- package/dist/esm/w/call/service.d.ts +3 -3
- package/dist/esm/w/call/service.js +1 -1
- package/dist/esm/w/exception.js +1 -1
- package/dist/esm/w/query/object.d.ts +1 -1
- package/dist/esm/w/query/object.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{toTxObject,toTxString,isValidDescription,MAX_DESCRIPTION_LENGTH,isValidName,isValidLongName,isValidU16,isValidU64,PackageAddress,MAX_LONG_NAME_LENGTH,isValidArray,IsValidArgType,GetObjectExisted,GetObject,GetObjectDescription,serviceFn,MAX_NAME_LENGTH,isValidHttpUrl}from'../common.js';import{W_ERROR,WErrors}from'../exception.js';import{ObjectType}from'../query/object.js';import{owner_receive,parseObjectType,validObjects}from'../util.js';import{allocators}from'./allocation.js';import{CallBase,getCoinParam}from'./base.js';import{BuiltinPermissionIndex,newPermission}from'./permission.js';import{GetManyAccountOrMark_Address,verify_wip}from'../local/index.js';import{WIP}from'../local/wip.js';import{LocalMark}from'../local/local.js';import{agent_set,order_required_info_update,owner_change}from'./order.js';import{create as a165a}from'./progress.js';import{create as a165b}from'./order.js';import{create as a165c}from'./permission.js';import{queryObjectsWithType}from'../query/util.js';import{query_received}from'../query/received.js';export const NAMED_OPERATOR_ORDER_PAYER='';export class CallService extends CallBase{['data'];['object_address']=undefined;['permission_address']=undefined;['new_permission_description']=undefined;['parameter_type']=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']));if(this['object_address']){this['content']=undefined,await this['update_content'](a,ObjectType['Service'],this['object_address']);if(!this['content'])W_ERROR(WErrors['InvalidParam'],'CallService_Data.data.object:'+this['object_address']);this['permission_address']=this['content']['permission'],this['parameter_type']=parseObjectType(this['content']['type_raw'],'service::Service'),!this['permission_address']&&W_ERROR(WErrors['InvalidParam'],'CallService_Data.data.object.permission\x20is\x20empty'),!IsValidArgType(this['parameter_type'])&&W_ERROR(WErrors['IsValidArgType'],'CallService_Data.data.object.type_parameter\x20is\x20empty');}else{const b=GetObject(this['data']['object']);this['permission_address']=await GetObjectExisted(b?.['permission']),this['new_permission_description']=GetObjectDescription(b?.['permission']),this['parameter_type']=b?.['type_parameter'],!IsValidArgType(this['parameter_type'])&&W_ERROR(WErrors['IsValidArgType'],'CallService_Data.data.object.type_parameter\x20invalid');}}async['call'](a){await this['prepare'](a);const b=[],c=[],d=f=>{!b['includes'](f)&&b['push'](f);},e=f=>{this['permission_address']&&!c['includes'](f)&&c['push'](f);};this['permission_address']&&!this['object_address']&&e(BuiltinPermissionIndex['SERVICE_NEW']);this['data']?.['order_new']&&(!this['content']&&W_ERROR(WErrors['InvalidParam'],'CallService_Data.data.order_new\x20fail\x20because\x20the\x20Service\x20'+JSON['stringify'](this['data']['object'])+'\x20content\x20not\x20ready'),this['order_allowed'](),this['content']['buy_guard']!=null&&d(this['content']['buy_guard']));this['permission_address']&&this['data']?.['description']!=null&&this['object_address']&&e(BuiltinPermissionIndex['SERVICE_DESCRIPTION']);this['permission_address']&&this['data']?.['location']!=null&&e(BuiltinPermissionIndex['SERVICE_LOCATION']);this['permission_address']&&this['data']?.['repositories']!=null&&e(BuiltinPermissionIndex['SERVICE_REPOSITORY']);this['permission_address']&&this['data']?.['sales']!=null&&e(BuiltinPermissionIndex['SERVICE_SALES']);this['permission_address']&&this['data']?.['machine']!==undefined&&(this['checkNotPublished']('machine'),e(BuiltinPermissionIndex['SERVICE_MACHINE']));this['permission_address']&&this['data']?.['discount']!=null&&e(BuiltinPermissionIndex['SERVICE_DISCOUNT']);this['permission_address']&&this['data']?.['arbitrations']!=null&&(this['checkNotPublished']('arbitrations'),e(BuiltinPermissionIndex['SERVICE_ARBITRATION']));this['permission_address']&&this['data']?.['customer_required']!=null&&e(BuiltinPermissionIndex['SERVICE_CUSTOMER_INFO_REQUIRED']);this['permission_address']&&this['data']?.['pause']!==undefined&&e(BuiltinPermissionIndex['SERVICE_PAUSE']);this['permission_address']&&this['data']?.['publish']&&e(BuiltinPermissionIndex['SERVICE_PUBLISH']);this['permission_address']&&this['data']?.['order_allocators']!==undefined&&(this['checkNotPublished']('order_allocators'),e(BuiltinPermissionIndex['SERVICE_ORDER_ALLOCATOR']));if(this['permission_address']&&this['data']?.['buy_guard']!=null){const f=await LocalMark['Instance']()['get_address'](this['data']?.['buy_guard']);!f&&W_ERROR(WErrors['InvalidParam'],'CallService_Data.data.buy_guard:'+this['data']?.['buy_guard']),this['data']['buy_guard']=f,e(BuiltinPermissionIndex['SERVICE_BUY_GUARD']);}this['permission_address']&&this['data']?.['compensation_fund_add']!=null&&e(BuiltinPermissionIndex['SERVICE_COMPENSATION_FUND_DEPOSIT']);this['permission_address']&&this['data']?.['compensation_locked_time_add']!==undefined&&e(BuiltinPermissionIndex['SERVICE_COMPENSATION_LOCKED_TIME_ADD']);this['permission_address']&&this['data']?.['rewards']!=null&&e(BuiltinPermissionIndex['SERVICE_REWARD']);this['permission_address']&&this['data']?.['compensation_fund_receive']!=null&&e(BuiltinPermissionIndex['SERVICE_COMPENSATION_FUND_RECEIVE']);this['permission_address']&&this['data']?.['owner_receive']!=null&&e(BuiltinPermissionIndex['SERVICE_OWNER_RECEIVE']);this['permission_address']&&this['data']?.['um']!==undefined&&e(BuiltinPermissionIndex['SERVICE_UM']);if(this['permission_address']||b['length']>0x0)return await this['check_permission_and_call'](a,this['permission_address'],c,b);return await this['exec'](a);}async['operate'](a,b,c,d){let e=this['permission_address'],f=this['object_address'];!this['object_address']&&(!e&&(e=newPermission(b,this['new_permission_description']??'')),e&&this['parameter_type']&&(f=newService(b,this['parameter_type'],e,this['data']?.['description']??'',c)));(!f||!e)&&W_ERROR(WErrors['InvalidParam'],'CallService_Data.data.object:'+this['object_address']);let g;if(this['data']?.['order_new']!=null&&this['content']){this['order_allowed']();const h=this['data']?.['order_new'],i=this['content']['sales'],j=new Set();for(const k of h['buy']['items']){const l=i['find'](q=>q['name']===k['name']);!l&&W_ERROR(WErrors['InvalidParam'],'Product\x20\x22'+k['name']+'\x22\x20not\x20found\x20in\x20Service\x20sales');if(j['has'](l['wip']))continue;if(l['wip']==='')continue;const o=await verify_wip(l['wip'],k['wip_hash']);!o['valid']&&W_ERROR(WErrors['InvalidParam'],'WIP\x20file\x20verification\x20failed\x20for\x20product\x20\x22'+k['name']+'\x22\x20at\x20'+l['wip']+':\x20'+o['error']),j['add'](l['wip']);}h['buy']['discount']=await LocalMark['Instance']()['get_address'](this['data']['order_new']['buy']['discount']),g=await buy(a,b,f,this['parameter_type'],this['content']['machine'],h['buy'],c);!g&&W_ERROR(WErrors['Fail'],'Buy\x20failed,\x20no\x20order\x20created');h?.['agents']!=null&&agent_set(b,{'order':g['order'],'agents':await GetManyAccountOrMark_Address(h['agents'])});h?.['order_required_info']!==undefined&&h['order_required_info']['length']>0x0&&await order_required_info_update(b,g['order'],h['order_required_info']);h?.['transfer']!=null&&await owner_change(b,{'order':g['order'],'new_owner':h['transfer']});h?.['namedNewAllocation']!=null&&g?.['allocation']&&await this['new_with_mark'](a,b,ObjectType['Allocation'],g?.['allocation'],GetObject(h['namedNewAllocation']));g?.['progress']&&(h?.['namedNewProgress']!=null?await this['new_with_mark'](a,b,ObjectType['Progress'],a165a(b,g?.['progress']),GetObject(h['namedNewProgress'])):a165a(b,g?.['progress']));if(g?.['order']){const q=a165b(b,g?.['order']);h?.['namedNewOrder']!=null&&await this['new_with_mark'](a,b,ObjectType['Order'],q,GetObject(h['namedNewOrder']));}}this['data']['description']!=null&&!this['object_address']&&description_set(b,f,this['parameter_type'],e,this['data']['description'],c);this['data']['location']!=null&&location_set(b,f,this['parameter_type'],e,this['data']['location'],c);if(this['data']['sales']!=null)switch(this['data']['sales']['op']){case'add':case'set':{for(const s of this['data']['sales']['sales']){if(s['wip']!==''){const t=await verify_wip(s['wip'],s['wip_hash']!==''?s['wip_hash']:undefined);!t['valid']&&W_ERROR(WErrors['InvalidParam'],'WIP\x20file\x20verification\x20failed\x20for\x20product\x20\x22'+s['name']+'\x22\x20at\x20'+s['wip']+':\x20'+t['error']);const u=new WIP(),v=await u['load'](s['wip']);s['wip_hash']=u['getHash'](v);}}this['data']['sales']['op']==='add'?sales_add(b,f,this['parameter_type'],e,this['data']['sales']['sales'],c):sales_set(b,f,this['parameter_type'],e,this['data']['sales']['sales'],c);break;}case'remove':{sales_remove(b,f,this['parameter_type'],e,this['data']['sales']['sales_name'],c);break;}case'clear':{sales_clear(b,f,this['parameter_type'],e,c);break;}}if(this['data']['repositories']!=null)switch(this['data']['repositories']['op']){case'add':case'set':{this['data']['repositories']['objects']['length']>MAX_REPOSITORY_COUNT&&W_ERROR(WErrors['InvalidParam'],'CallService_Data.data.repositories.objects:'+this['data']['repositories']['objects']);this['data']['repositories']['op']==='set'&&repository_clear(b,f,this['parameter_type'],e,c);const w=await LocalMark['Instance']()['get_many_address_availables'](this['data']['repositories']['objects']);w['forEach'](x=>{repository_add(b,f,this['parameter_type'],e,x,c);});break;}case'remove':{this['data']['repositories']['objects']['length']>MAX_REPOSITORY_COUNT&&W_ERROR(WErrors['InvalidParam'],'CallService_Data.data.repositories.objects:'+this['data']['repositories']['objects']);const x=await LocalMark['Instance']()['get_many_address_availables'](this['data']['repositories']['objects']);repository_remove(b,f,this['parameter_type'],e,x,c);break;}case'clear':{repository_clear(b,f,this['parameter_type'],e,c);break;}}if(this['data']['rewards']!=null)switch(this['data']['rewards']['op']){case'add':case'set':{this['data']['rewards']['objects']['length']>MAX_REWARD_COUNT&&W_ERROR(WErrors['InvalidParam'],'rewards\x20count\x20exceeds\x20maximum\x20limit\x20'+MAX_REWARD_COUNT);this['data']['rewards']['op']==='set'&&reward_clear(b,f,this['parameter_type'],e,c);const y=await queryObjectsWithType(a,this['data']['rewards']['objects'],ObjectType['Reward'],'reward::Reward',!![]);y['forEach'](z=>{reward_add(b,f,this['parameter_type'],e,z['object'],z['type'],c);});break;}case'remove':{this['data']['rewards']['objects']['length']>MAX_REWARD_COUNT&&W_ERROR(WErrors['InvalidParam'],'rewards\x20count\x20exceeds\x20maximum\x20limit\x20'+MAX_REWARD_COUNT);const z=await LocalMark['Instance']()['get_many_address_availables'](this['data']['rewards']['objects']);reward_remove(b,f,this['parameter_type'],e,z,c);break;}case'clear':{reward_clear(b,f,this['parameter_type'],e,c);break;}}if(this['data']['arbitrations']!=null)switch(this['data']['arbitrations']['op']){case'add':case'set':{this['data']['arbitrations']['objects']['length']>MAX_ARBITRATION_COUNT&&W_ERROR(WErrors['InvalidParam'],'arbitrations\x20count\x20exceeds\x20maximum\x20limit\x20'+MAX_ARBITRATION_COUNT);this['data']['arbitrations']['op']==='set'&&arbitration_clear(b,f,this['parameter_type'],e,c);const A=await queryObjectsWithType(a,this['data']['arbitrations']['objects'],ObjectType['Arbitration'],'arbitration::Arbitration',!![]);A['forEach'](B=>{arbitrations_add(b,f,this['parameter_type'],e,B['object'],B['type'],c);});break;}case'remove':{this['data']['arbitrations']['objects']['length']>MAX_ARBITRATION_COUNT&&W_ERROR(WErrors['InvalidParam'],'arbitrations\x20count\x20exceeds\x20maximum\x20limit\x20'+MAX_ARBITRATION_COUNT);const B=await LocalMark['Instance']()['get_many_address_availables'](this['data']['arbitrations']['objects']);arbitrations_remove(b,f,this['parameter_type'],e,B,c);break;}case'clear':{arbitration_clear(b,f,this['parameter_type'],e,c);break;}}this['data']['discount']!=null&&await discount(b,f,this['parameter_type'],e,this['data']['discount'],c);if(this['data']['discount_destroy']!=null){const C=await LocalMark['Instance']()['get_many_address_availables'](this['data']['discount_destroy']);discount_destroy(b,C);}if(this['data']['machine']!==undefined){if(this['data']['machine']){const D=await LocalMark['Instance']()['get_address'](this['data']['machine']);D?this['data']['machine']=D:W_ERROR(WErrors['IsValidArgType'],'Machine\x20not\x20found\x20'+this['data']['machine']);}machine_set(b,f,this['parameter_type'],e,this['data']['machine'],c);}this['data']['customer_required']!=null&&customer_required_set(b,f,this['parameter_type'],e,this['data']['customer_required'],c);this['data']['order_allocators']!==undefined&&order_allocators_set(b,f,this['parameter_type'],e,this['data']['order_allocators']?await allocators(b,this['data']['order_allocators']):null,c);this['data']['buy_guard']!==undefined&&buy_guard_set(b,f,this['parameter_type'],e,this['data']['buy_guard'],c);this['data']['compensation_fund_add']!=null&&await compensation_fund_add(a,b,f,this['parameter_type'],e,this['data']['compensation_fund_add'],c);this['data']['compensation_locked_time_add']!==undefined&&compensation_lock_duration_set(b,f,this['parameter_type'],e,this['data']['compensation_locked_time_add'],c);if(this['data']['compensation_fund_receive']!=null&&this['object_address']){if(this['data']['compensation_fund_receive']==='recently'){const E=await query_received({'name_or_address':{'name_or_address':this['object_address'],'local_mark_first':!![]},'network':a['network'],'no_cache':a['no_cache']});Array['isArray'](E)?W_ERROR(WErrors['InvalidParam'],'CallAllocation_Data.data.received_coins:\x20received\x20is\x20ReceivedNormal[]'):this['data']['compensation_fund_receive']=E;}if(typeof this['data']['compensation_fund_receive']==='object'&&'received'in this['data']['compensation_fund_receive']&&this['data']['compensation_fund_receive']['received']?.['length']>0x0){this['data']['compensation_fund_receive']['token_type']!==this['parameter_type']&&W_ERROR(WErrors['InvalidParam'],'token_type\x20'+this['data']['compensation_fund_receive']['token_type']+'\x20is\x20not\x20equal\x20to\x20parameter_type\x20'+this['parameter_type']);for(const F of this['data']['compensation_fund_receive']['received']){const [G,H]=await Promise['all']([LocalMark['Instance']()['get_address'](F['id']),LocalMark['Instance']()['get_address'](F['payment'])]);(!G||!H)&&W_ERROR(WErrors['IsValidArgType'],'Compensation\x20fund\x20receive\x20object\x20'+F['id']+'\x20or\x20payment\x20object\x20'+F['payment']+'\x20not\x20found'),compensation_fund_receive(b,f,this['parameter_type'],e,F['id'],F['payment'],c);}}}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':!![],'network':a['network'],'no_cache':a['no_cache']})),await owner_receive(b,f,e,this['data']['owner_receive'],this['parameter_type'],I=>PackageAddress+'::service::'+I,c));if(this['data']['um']!==undefined){let I=null;this['data']['um']&&(I=await LocalMark['Instance']()['get_address'](this['data']['um'])||null,!I&&W_ERROR(WErrors['InvalidParam'],'CallService_Data.data.um:'+this['data']['um'])),um_set(b,f,this['parameter_type'],e,I,c);}this['data']['pause']!=null&&pause(b,f,this['parameter_type'],e,this['data']['pause'],c);this['data']['publish']&&publish(b,f,this['parameter_type'],e,c);if(!this['permission_address']){const J=GetObject(this['data']?.['object']);await this['new_with_mark'](a,b,ObjectType['Permission'],a165c(b,e),GetObject(J['permission']));}!this['object_address']&&await this['new_with_mark'](a,b,ObjectType['Service'],create(b,f,this['parameter_type']),GetObject(this['data']?.['object']));}['checkPublished']=a=>{this['content']&&!this['content']['bPublished']&&W_ERROR(WErrors['Fail'],'Service\x20object\x20has\x20not\x20been\x20published\x20yet,\x20so\x20the\x20operation\x20('+a+')\x20cannot\x20proceed.');};['checkNotPublished']=a=>{this['content']&&this['content']['bPublished']&&W_ERROR(WErrors['Fail'],'Service\x20object\x20has\x20been\x20published\x20and\x20operation\x20('+a+')\x20cannot\x20proceed.\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20If\x20further\x20modifications\x20are\x20needed,\x20you\x20can\x20\x27clone\x27\x20a\x20new\x20Service\x20and\x20then\x20proceed\x20with\x20the\x20operation.');};['checkNotPaused']=a=>{this['content']&&this['content']['bPaused']&&W_ERROR(WErrors['Fail'],'Service\x20object\x20has\x20been\x20paused\x20and\x20operation\x20('+a+')\x20cannot\x20proceed.');};['order_allowed'](){if(this['content']?.['bPaused'])return W_ERROR(WErrors['InvalidParam'],'Service\x20is\x20paused'),![];if(this['content']?.['bPublished']!==!![])return W_ERROR(WErrors['InvalidParam'],'Service\x20is\x20not\x20published'),![];return!![];}}export const MAX_SALE_COUNT=0x32;export const MAX_REPOSITORY_COUNT=0x64;export const MAX_ARBITRATION_COUNT=0x14;export const MAX_REWARD_COUNT=0x14;export const MAX_CUSTOMER_REQUIRED_INFO_COUNT=0xa;export const MAX_PUBKEY_LENGTH=0x400;export const MAX_DISCOUNT_COUNT_ONCE=0x3e8;export const MAX_DISCOUNT_RECEIVER_ONCE=0x3e8;export const MAX_DISCOUNT_TOTAL_COUNT=0x4e20;export const MAX_REQUIRED_INFO_SIZE=0x14;export const DEFAULT_COMPENSATION_LOCK_DURATION=0x9a7ec800;export const DISCOUNT_TYPE_RATES=0x0;export const DISCOUNT_TYPE_MINUS=0x1;const MAX_WIP_LENGTH=0x400,MAX_WIP_HASH_LENGTH=0x40;function sale(a,b){typeof b['name']==='string'&&!isValidLongName(b['name'])&&W_ERROR(WErrors['InvalidParam'],'Name\x20'+b['name']+'\x20exceeds\x20maximum\x20length\x20'+MAX_LONG_NAME_LENGTH);b['wip']['length']>MAX_WIP_LENGTH&&W_ERROR(WErrors['InvalidParam'],'WIP\x20'+b['wip']+'\x20exceeds\x20maximum\x20length\x20'+MAX_WIP_LENGTH);const c=b['wip'];b['wip']['length']>0x0&&!isValidHttpUrl(b['wip'])&&W_ERROR(WErrors['IsValidHttpUrl'],'WIP\x20'+b['wip']+'\x20is\x20not\x20a\x20valid\x20HTTP/HTTPS\x20URL');const d=b['wip_hash']['includes'](':')?b['wip_hash']['split'](':')[0x1]:b['wip_hash'];return d['length']>MAX_WIP_HASH_LENGTH&&W_ERROR(WErrors['InvalidParam'],'WIP\x20hash\x20'+d+'\x20exceeds\x20maximum\x20length\x20'+MAX_WIP_HASH_LENGTH),a['moveCall']({'target':serviceFn('sale'),'arguments':[toTxString(a,b['name']),a['pure']['u64'](b['price']),a['pure']['u64'](b['stock']),a['pure']['bool'](b['suspension']),toTxString(a,c),toTxString(a,d)]});}function quote_item(a,b){!isValidLongName(b['name'])&&W_ERROR(WErrors['InvalidParam'],'Quote\x20item\x20name\x20'+b['name']+'\x20is\x20not\x20valid');!isValidU64(b['stock'])&&W_ERROR(WErrors['IsValidU64'],'Quote\x20item\x20stock\x20'+b['stock']+'\x20is\x20not\x20valid');const c=b['wip_hash']['includes'](':')?b['wip_hash']['split'](':')[0x1]:b['wip_hash'];return c['length']>MAX_WIP_HASH_LENGTH&&W_ERROR(WErrors['InvalidParam'],'Quote\x20item\x20wip_hash\x20'+c+'\x20exceeds\x20maximum\x20length\x20'+MAX_WIP_HASH_LENGTH),a['moveCall']({'target':serviceFn('quote_item'),'arguments':[toTxString(a,b['name']),a['pure']['u64'](b['stock']),toTxString(a,c)]});}export function discount_send(a,b,c){if(b['length']===0x0)return;validObjects([...b,c]);b['length']>MAX_DISCOUNT_COUNT_ONCE&&W_ERROR(WErrors['InvalidParam'],'Discount\x20count\x20'+b['length']+'\x20exceeds\x20maximum\x20limit\x20'+MAX_DISCOUNT_COUNT_ONCE);if(b['length']===0x1){a['moveCall']({'target':serviceFn('discount_send_singleton'),'arguments':[toTxObject(a,b[0x0]),a['pure']['address'](c)]});return;}else a['moveCall']({'target':serviceFn('discount_send'),'arguments':[a['makeMoveVec']({'elements':b,'type':PackageAddress+'::service::Discount'}),a['pure']['address'](c)]});}export function discount_destroy(a,b){validObjects([...b]),b['forEach'](c=>{a['moveCall']({'target':serviceFn('discount_destroy'),'arguments':[toTxObject(a,c)]});});}export const buy=async(a,b,c,d,e,f,g)=>{if(f['items']['length']===0x0)return undefined;validObjects([c,f['discount'],e,g]);!IsValidArgType(d)&&W_ERROR(WErrors['InvalidParam'],'Buy\x20service\x20type\x20'+d+'\x20is\x20not\x20valid');!isValidArray(f['items'],l=>{return!isValidLongName(l['name'])&&W_ERROR(WErrors['InvalidParam'],'Buy\x20item\x20name\x20'+l['name']+'\x20is\x20not\x20valid'),!isValidU64(l['stock'])&&W_ERROR(WErrors['IsValidU64'],'Buy\x20item\x20stock\x20'+l['stock']+'\x20is\x20not\x20valid'),!![];})&&W_ERROR(WErrors['InvalidParam'],'Buy\x20items\x20is\x20not\x20valid');typeof f['payment_remark']==='string'&&!isValidName(f['payment_remark'])&&W_ERROR(WErrors['InvalidParam'],'Buy\x20payment\x20remark\x20'+f['payment_remark']+'\x20is\x20not\x20valid');f['payment_remark']=f['payment_remark']||'';f['payment_index']!=null&&!isValidU64(f['payment_index'])&&W_ERROR(WErrors['IsValidU64'],'Buy\x20payment\x20index\x20'+f['payment_index']+'\x20is\x20not\x20valid');const h=await getCoinParam(a,b,f['total_pay'],d);f['discount']=await LocalMark['Instance']()['get_address'](f['discount']);let i=undefined;f['discount']?i=b['moveCall']({'target':serviceFn('quote_with_discount'),'arguments':[toTxObject(b,c),b['makeMoveVec']({'elements':f['items']['map'](l=>quote_item(b,l)),'type':PackageAddress+'::service::QuoteItem'}),toTxObject(b,f['discount'])],'typeArguments':[d]}):i=b['moveCall']({'target':serviceFn('quote'),'arguments':[toTxObject(b,c),b['makeMoveVec']({'elements':f['items']['map'](l=>quote_item(b,l)),'type':PackageAddress+'::service::QuoteItem'})],'typeArguments':[d]});let j;g?j=b['moveCall']({'target':serviceFn('buy_with_passport'),'arguments':[toTxObject(b,c),toTxObject(b,g),i,b['object']['mutRegistrar'](),b['object']['clock']()],'typeArguments':[d]}):j=b['moveCall']({'target':serviceFn('buy'),'arguments':[toTxObject(b,c),i,b['object']['mutRegistrar'](),b['object']['clock']()],'typeArguments':[d]});const k={'order':j};return k['allocation']=b['moveCall']({'target':serviceFn('order_allocation'),'arguments':[toTxObject(b,c),toTxObject(b,j),h,b['pure']['string'](f['payment_remark']??''),b['pure']['u64'](f['payment_index']||0x0),b['object']['mutRegistrar'](),b['object']['clock']()],'typeArguments':[d]}),e&&(k['progress']=b['moveCall']({'target':serviceFn('order_progress'),'arguments':[toTxObject(b,c),toTxObject(b,j),toTxObject(b,e),b['object']['mutRegistrar'](),b['object']['clock']()],'typeArguments':[d]})),k;};export function newService(a,b,c,d,e){return validObjects([c,e]),typeof d==='string'&&!isValidDescription(d)&&W_ERROR(WErrors['IsValidDescription'],'Description\x20exceeds\x20maximum\x20length\x20'+MAX_DESCRIPTION_LENGTH),!IsValidArgType(b)&&W_ERROR(WErrors['InvalidParam'],'New\x20service\x20type\x20'+b+'\x20is\x20not\x20valid'),e?a['moveCall']({'target':serviceFn('new_with_passport'),'arguments':[toTxObject(a,c),toTxObject(a,e),toTxString(a,d),a['object']['mutRegistrar'](),a['object']['clock']()],'typeArguments':[b]}):a['moveCall']({'target':serviceFn('new'),'arguments':[toTxObject(a,c),toTxString(a,d),a['object']['mutRegistrar'](),a['object']['clock']()],'typeArguments':[b]});}export function description_set(a,b,c,d,e,f){validObjects([b,d,f]),typeof e==='string'&&!isValidDescription(e)&&W_ERROR(WErrors['IsValidDescription'],'Description\x20exceeds\x20maximum\x20length\x20'+MAX_DESCRIPTION_LENGTH),!IsValidArgType(c)&&W_ERROR(WErrors['InvalidParam'],'Description\x20set\x20service\x20type\x20'+c+'\x20is\x20not\x20valid'),f?a['moveCall']({'target':serviceFn('description_set_with_passport'),'arguments':[toTxObject(a,b),toTxObject(a,d),toTxObject(a,f),toTxString(a,e)],'typeArguments':[c]}):a['moveCall']({'target':serviceFn('description_set'),'arguments':[toTxObject(a,b),toTxObject(a,d),toTxString(a,e)],'typeArguments':[c]});}export function um_set(a,b,c,d,e,f){validObjects([b,d]),!IsValidArgType(c)&&W_ERROR(WErrors['InvalidParam'],'Service\x20type\x20'+c+'\x20is\x20not\x20valid'),e?f?a['moveCall']({'target':serviceFn('um_set_with_passport'),'arguments':[toTxObject(a,b),toTxObject(a,d),f,toTxObject(a,e),a['object']['mutRegistrar'](),a['object']['clock']()],'typeArguments':[c]}):a['moveCall']({'target':serviceFn('um_set'),'arguments':[toTxObject(a,b),toTxObject(a,d),toTxObject(a,e),a['object']['mutRegistrar'](),a['object']['clock']()],'typeArguments':[c]}):f?a['moveCall']({'target':serviceFn('um_none_with_passport'),'arguments':[toTxObject(a,b),toTxObject(a,d),f,a['object']['mutRegistrar']()],'typeArguments':[c]}):a['moveCall']({'target':serviceFn('um_none'),'arguments':[toTxObject(a,b),toTxObject(a,d),a['object']['mutRegistrar']()],'typeArguments':[c]});}export function location_set(a,b,c,d,e,f){validObjects([b,d,f]),typeof e==='string'&&!isValidLongName(e)&&W_ERROR(WErrors['InvalidParam'],'Location\x20'+e+'\x20exceeds\x20maximum\x20length\x20'+MAX_LONG_NAME_LENGTH),!IsValidArgType(c)&&W_ERROR(WErrors['InvalidParam'],'Location\x20set\x20service\x20type\x20'+c+'\x20is\x20not\x20valid'),f?a['moveCall']({'target':serviceFn('location_set_with_passport'),'arguments':[toTxObject(a,b),toTxObject(a,d),toTxObject(a,f),toTxString(a,e)],'typeArguments':[c]}):a['moveCall']({'target':serviceFn('location_set'),'arguments':[toTxObject(a,b),toTxObject(a,d),toTxString(a,e)],'typeArguments':[c]});}export function create(a,b,c){return validObjects([b]),!IsValidArgType(c)&&W_ERROR(WErrors['InvalidParam'],'Create\x20service\x20type\x20'+c+'\x20is\x20not\x20valid'),a['moveCall']({'target':serviceFn('create'),'arguments':[toTxObject(a,b)],'typeArguments':[c]});}export function sales_add(a,b,c,d,e,f){if(e['length']===0x0)return;validObjects([b,d,f]),!IsValidArgType(c)&&W_ERROR(WErrors['InvalidParam'],'Sales\x20add\x20service\x20type\x20'+c+'\x20is\x20not\x20valid'),f?a['moveCall']({'target':serviceFn('sales_add_with_passport'),'arguments':[toTxObject(a,b),toTxObject(a,d),toTxObject(a,f),a['makeMoveVec']({'elements':e['map'](g=>sale(a,g)),'type':PackageAddress+'::service::Sale'})],'typeArguments':[c]}):a['moveCall']({'target':serviceFn('sales_add'),'arguments':[toTxObject(a,b),toTxObject(a,d),a['makeMoveVec']({'elements':e['map'](g=>sale(a,g)),'type':PackageAddress+'::service::Sale'})],'typeArguments':[c]});}export function sales_remove(a,b,c,d,e,f){if(e['length']===0x0)return;validObjects([b,d,f]),!IsValidArgType(c)&&W_ERROR(WErrors['InvalidParam'],'Sales\x20remove\x20service\x20type\x20'+c+'\x20is\x20not\x20valid'),f?a['moveCall']({'target':serviceFn('sales_remove_with_passport'),'arguments':[toTxObject(a,b),toTxObject(a,d),toTxObject(a,f),a['pure']['vector']('string',e)],'typeArguments':[c]}):a['moveCall']({'target':serviceFn('sales_remove'),'arguments':[toTxObject(a,b),toTxObject(a,d),a['pure']['vector']('string',e)],'typeArguments':[c]});}export function sales_clear(a,b,c,d,e){validObjects([b,d,e]),!IsValidArgType(c)&&W_ERROR(WErrors['InvalidParam'],'Sales\x20clear\x20service\x20type\x20'+c+'\x20is\x20not\x20valid'),e?a['moveCall']({'target':serviceFn('sales_clear_with_passport'),'arguments':[toTxObject(a,b),toTxObject(a,d),toTxObject(a,e)],'typeArguments':[c]}):a['moveCall']({'target':serviceFn('sales_clear'),'arguments':[toTxObject(a,b),toTxObject(a,d)],'typeArguments':[c]});}export function sales_set(a,b,c,d,e,f){if(e['length']===0x0)return;validObjects([b,d,f]),!IsValidArgType(c)&&W_ERROR(WErrors['InvalidParam'],'Sales\x20set\x20service\x20type\x20'+c+'\x20is\x20not\x20valid'),f?a['moveCall']({'target':serviceFn('sales_set_with_passport'),'arguments':[toTxObject(a,b),toTxObject(a,d),toTxObject(a,f),a['makeMoveVec']({'elements':e['map'](g=>sale(a,g)),'type':PackageAddress+'::service::Sale'})],'typeArguments':[c]}):a['moveCall']({'target':serviceFn('sales_set'),'arguments':[toTxObject(a,b),toTxObject(a,d),a['makeMoveVec']({'elements':e['map'](g=>sale(a,g)),'type':PackageAddress+'::service::Sale'})],'typeArguments':[c]});}export function price_add(a,b,c,d,e,f,g){validObjects([b,d,g]),!IsValidArgType(c)&&W_ERROR(WErrors['InvalidParam'],'Price\x20add\x20service\x20type\x20'+c+'\x20is\x20not\x20valid'),typeof e==='string'&&!isValidLongName(e)&&W_ERROR(WErrors['InvalidParam'],'Sale\x20name\x20'+e+'\x20exceeds\x20maximum\x20length\x20'+MAX_LONG_NAME_LENGTH),!isValidU64(f)&&W_ERROR(WErrors['IsValidU64'],'Price\x20add\x20'+f+'\x20is\x20not\x20valid'),g?a['moveCall']({'target':serviceFn('price_add_with_passport'),'arguments':[toTxObject(a,b),toTxObject(a,d),toTxObject(a,g),toTxString(a,e),a['pure']['u64'](f)],'typeArguments':[c]}):a['moveCall']({'target':serviceFn('price_add'),'arguments':[toTxObject(a,b),toTxObject(a,d),toTxString(a,e),a['pure']['u64'](f)],'typeArguments':[c]});}export function price_reduce(a,b,c,d,e,f,g){validObjects([b,d,g]),!IsValidArgType(c)&&W_ERROR(WErrors['InvalidParam'],'Price\x20reduce\x20service\x20type\x20'+c+'\x20is\x20not\x20valid'),typeof e==='string'&&!isValidLongName(e)&&W_ERROR(WErrors['InvalidParam'],'Sale\x20name\x20'+e+'\x20exceeds\x20maximum\x20length\x20'+MAX_LONG_NAME_LENGTH),!isValidU64(f)&&W_ERROR(WErrors['IsValidU64'],'Price\x20reduce\x20'+f+'\x20is\x20not\x20valid'),g?a['moveCall']({'target':serviceFn('price_reduce_with_passport'),'arguments':[toTxObject(a,b),toTxObject(a,d),toTxObject(a,g),toTxString(a,e),a['pure']['u64'](f)],'typeArguments':[c]}):a['moveCall']({'target':serviceFn('price_reduce'),'arguments':[toTxObject(a,b),toTxObject(a,d),toTxString(a,e),a['pure']['u64'](f)],'typeArguments':[c]});}export function stock_add(a,b,c,d,e,f,g){validObjects([b,d,g]),!IsValidArgType(c)&&W_ERROR(WErrors['InvalidParam'],'Stock\x20add\x20service\x20type\x20'+c+'\x20is\x20not\x20valid'),typeof e==='string'&&!isValidLongName(e)&&W_ERROR(WErrors['InvalidParam'],'Sale\x20name\x20'+e+'\x20exceeds\x20maximum\x20length\x20'+MAX_LONG_NAME_LENGTH),!isValidU64(f)&&W_ERROR(WErrors['IsValidU64'],'Stock\x20add\x20'+f+'\x20is\x20not\x20valid'),g?a['moveCall']({'target':serviceFn('stock_add_with_passport'),'arguments':[toTxObject(a,b),toTxObject(a,d),toTxObject(a,g),toTxString(a,e),a['pure']['u64'](f)],'typeArguments':[c]}):a['moveCall']({'target':serviceFn('stock_add'),'arguments':[toTxObject(a,b),toTxObject(a,d),toTxString(a,e),a['pure']['u64'](f)],'typeArguments':[c]});}export function stock_reduce(a,b,c,d,e,f,g){validObjects([b,d,g]),!IsValidArgType(c)&&W_ERROR(WErrors['InvalidParam'],'Stock\x20reduce\x20service\x20type\x20'+c+'\x20is\x20not\x20valid'),typeof e==='string'&&!isValidLongName(e)&&W_ERROR(WErrors['InvalidParam'],'Sale\x20name\x20'+e+'\x20exceeds\x20maximum\x20length\x20'+MAX_LONG_NAME_LENGTH),!isValidU64(f)&&W_ERROR(WErrors['IsValidU64'],'Stock\x20reduce\x20'+f+'\x20is\x20not\x20valid'),g?a['moveCall']({'target':serviceFn('stock_reduce_with_passport'),'arguments':[toTxObject(a,b),toTxObject(a,d),toTxObject(a,g),toTxString(a,e),a['pure']['u64'](f)],'typeArguments':[c]}):a['moveCall']({'target':serviceFn('stock_reduce'),'arguments':[toTxObject(a,b),toTxObject(a,d),toTxString(a,e),a['pure']['u64'](f)],'typeArguments':[c]});}export function sale_suspension(a,b,c,d,e,f,g){validObjects([b,d,g]),!IsValidArgType(c)&&W_ERROR(WErrors['InvalidParam'],'Sale\x20suspension\x20service\x20type\x20'+c+'\x20is\x20not\x20valid'),typeof e==='string'&&!isValidLongName(e)&&W_ERROR(WErrors['InvalidParam'],'Sale\x20name\x20'+e+'\x20exceeds\x20maximum\x20length\x20'+MAX_LONG_NAME_LENGTH),g?a['moveCall']({'target':serviceFn('sale_suspension_with_passport'),'arguments':[toTxObject(a,b),toTxObject(a,d),toTxObject(a,g),toTxString(a,e),a['pure']['bool'](f)],'typeArguments':[c]}):a['moveCall']({'target':serviceFn('sale_suspension'),'arguments':[toTxObject(a,b),toTxObject(a,d),toTxString(a,e),a['pure']['bool'](f)],'typeArguments':[c]});}export function repository_add(a,b,c,d,e,f){validObjects([b,d,e,f]),!IsValidArgType(c)&&W_ERROR(WErrors['InvalidParam'],'Repository\x20add\x20service\x20type\x20'+c+'\x20is\x20not\x20valid'),f?a['moveCall']({'target':serviceFn('repository_add_with_passport'),'arguments':[toTxObject(a,b),toTxObject(a,d),toTxObject(a,f),toTxObject(a,e),a['object']['mutRegistrar'](),a['object']['clock']()],'typeArguments':[c]}):a['moveCall']({'target':serviceFn('repository_add'),'arguments':[toTxObject(a,b),toTxObject(a,d),toTxObject(a,e),a['object']['mutRegistrar'](),a['object']['clock']()],'typeArguments':[c]});}export function repository_remove(a,b,c,d,e,f){if(e['length']===0x0)return;validObjects([b,d,f,...e]),!IsValidArgType(c)&&W_ERROR(WErrors['InvalidParam'],'Repository\x20remove\x20service\x20type\x20'+c+'\x20is\x20not\x20valid'),f?a['moveCall']({'target':serviceFn('repository_remove_with_passport'),'arguments':[toTxObject(a,b),toTxObject(a,d),toTxObject(a,f),a['pure']['vector']('address',e),a['object']['mutRegistrar']()],'typeArguments':[c]}):a['moveCall']({'target':serviceFn('repository_remove'),'arguments':[toTxObject(a,b),toTxObject(a,d),a['pure']['vector']('address',e),a['object']['mutRegistrar']()],'typeArguments':[c]});}export function repository_clear(a,b,c,d,e){validObjects([b,d,e]),!IsValidArgType(c)&&W_ERROR(WErrors['InvalidParam'],'Repository\x20clear\x20service\x20type\x20'+c+'\x20is\x20not\x20valid'),e?a['moveCall']({'target':serviceFn('repository_clear_with_passport'),'arguments':[toTxObject(a,b),toTxObject(a,d),toTxObject(a,e),a['object']['mutRegistrar']()],'typeArguments':[c]}):a['moveCall']({'target':serviceFn('repository_clear'),'arguments':[toTxObject(a,b),toTxObject(a,d),a['object']['mutRegistrar']()],'typeArguments':[c]});}export function buy_guard_set(a,b,c,d,e,f){validObjects([b,d,e,f]),!IsValidArgType(c)&&W_ERROR(WErrors['InvalidParam'],'Buy\x20guard\x20set\x20service\x20type\x20'+c+'\x20is\x20not\x20valid'),f?e?a['moveCall']({'target':serviceFn('buy_guard_set_with_passport'),'arguments':[toTxObject(a,b),toTxObject(a,d),toTxObject(a,f),toTxObject(a,e),a['object']['mutRegistrar'](),a['object']['clock']()],'typeArguments':[c]}):a['moveCall']({'target':serviceFn('buy_guard_none_with_passport'),'arguments':[toTxObject(a,b),toTxObject(a,d),toTxObject(a,f),a['object']['mutRegistrar']()],'typeArguments':[c]}):e?a['moveCall']({'target':serviceFn('buy_guard_set'),'arguments':[toTxObject(a,b),toTxObject(a,d),toTxObject(a,e),a['object']['mutRegistrar'](),a['object']['clock']()],'typeArguments':[c]}):a['moveCall']({'target':serviceFn('buy_guard_none'),'arguments':[toTxObject(a,b),toTxObject(a,d),a['object']['mutRegistrar']()],'typeArguments':[c]});}export function machine_set(a,b,c,d,e,f){validObjects([b,d,e,f]),!IsValidArgType(c)&&W_ERROR(WErrors['InvalidParam'],'Machine\x20set\x20service\x20type\x20'+c+'\x20is\x20not\x20valid'),f?e?a['moveCall']({'target':serviceFn('machine_set_with_passport'),'arguments':[toTxObject(a,b),toTxObject(a,d),toTxObject(a,f),toTxObject(a,e),a['object']['mutRegistrar'](),a['object']['clock']()],'typeArguments':[c]}):a['moveCall']({'target':serviceFn('machine_none_with_passport'),'arguments':[toTxObject(a,b),toTxObject(a,d),toTxObject(a,f),a['object']['mutRegistrar']()],'typeArguments':[c]}):e?a['moveCall']({'target':serviceFn('machine_set'),'arguments':[toTxObject(a,b),toTxObject(a,d),toTxObject(a,e),a['object']['mutRegistrar'](),a['object']['clock']()],'typeArguments':[c]}):a['moveCall']({'target':serviceFn('machine_set_none'),'arguments':[toTxObject(a,b),toTxObject(a,d),a['object']['mutRegistrar']()],'typeArguments':[c]});}export function publish(a,b,c,d,e){validObjects([b,d,e]),!IsValidArgType(c)&&W_ERROR(WErrors['InvalidParam'],'Publish\x20service\x20type\x20'+c+'\x20is\x20not\x20valid'),e?a['moveCall']({'target':serviceFn('publish_with_passport'),'arguments':[toTxObject(a,b),toTxObject(a,d),toTxObject(a,e)],'typeArguments':[c]}):a['moveCall']({'target':serviceFn('publish'),'arguments':[toTxObject(a,b),toTxObject(a,d)],'typeArguments':[c]});}export function pause(a,b,c,d,e,f){validObjects([b,d,f]),!IsValidArgType(c)&&W_ERROR(WErrors['InvalidParam'],'Pause\x20service\x20type\x20'+c+'\x20is\x20not\x20valid'),f?a['moveCall']({'target':serviceFn('pause_with_passport'),'arguments':[toTxObject(a,b),toTxObject(a,d),toTxObject(a,f),a['pure']['bool'](e),a['object']['clock']()],'typeArguments':[c]}):a['moveCall']({'target':serviceFn('pause'),'arguments':[toTxObject(a,b),toTxObject(a,d),a['pure']['bool'](e),a['object']['clock']()],'typeArguments':[c]});}export function customer_required_set(a,b,c,d,e,f){e['length']>MAX_REQUIRED_INFO_SIZE&&W_ERROR(WErrors['InvalidParam'],'Customer\x20required\x20set\x20size\x20'+e['length']+'\x20is\x20exceed\x20maximum\x20size\x20'+MAX_REQUIRED_INFO_SIZE),validObjects([b,d,f]),!IsValidArgType(c)&&W_ERROR(WErrors['InvalidParam'],'Customer\x20required\x20set\x20service\x20type\x20'+c+'\x20is\x20not\x20valid'),e['forEach'](g=>{!isValidName(g)&&W_ERROR(WErrors['InvalidParam'],'Customer\x20required\x20info\x20'+g+'\x20is\x20exceed\x20maximum\x20length\x20'+MAX_NAME_LENGTH+'\x20or\x20start\x20with\x20\x220x\x22');}),f?a['moveCall']({'target':serviceFn('custom_required_info_set_with_passport'),'arguments':[toTxObject(a,b),toTxObject(a,d),toTxObject(a,f),a['pure']['vector']('string',e)],'typeArguments':[c]}):a['moveCall']({'target':serviceFn('custom_required_info_set'),'arguments':[toTxObject(a,b),toTxObject(a,d),a['pure']['vector']('string',e)],'typeArguments':[c]});}export function arbitrations_add(a,b,c,d,e,f,g){validObjects([b,d,e,g]),!IsValidArgType(c)&&W_ERROR(WErrors['InvalidParam'],'Arbitrations\x20add\x20service\x20type\x20'+c+'\x20is\x20not\x20valid'),!IsValidArgType(f)&&W_ERROR(WErrors['InvalidParam'],'Arbitrations\x20add\x20arbitration\x20type\x20'+f+'\x20is\x20not\x20valid'),g?a['moveCall']({'target':serviceFn('arbitration_add_with_passport'),'arguments':[toTxObject(a,b),toTxObject(a,d),toTxObject(a,g),toTxObject(a,e),a['object']['mutRegistrar'](),a['object']['clock']()],'typeArguments':[c]}):a['moveCall']({'target':serviceFn('arbitration_add'),'arguments':[toTxObject(a,b),toTxObject(a,d),toTxObject(a,e),a['object']['mutRegistrar'](),a['object']['clock']()],'typeArguments':[c,f]});}export function arbitrations_remove(a,b,c,d,e,f){if(e['length']===0x0)return;validObjects([b,d,f]),!IsValidArgType(c)&&W_ERROR(WErrors['InvalidParam'],'Arbitrations\x20remove\x20service\x20type\x20'+c+'\x20is\x20not\x20valid'),f?a['moveCall']({'target':serviceFn('arbitration_remove_with_passport'),'arguments':[toTxObject(a,b),toTxObject(a,d),toTxObject(a,f),a['pure']['vector']('address',e),a['object']['mutRegistrar']()],'typeArguments':[c]}):a['moveCall']({'target':serviceFn('arbitration_remove'),'arguments':[toTxObject(a,b),toTxObject(a,d),a['pure']['vector']('address',e),a['object']['mutRegistrar']()],'typeArguments':[c]});}export function arbitration_clear(a,b,c,d,e){validObjects([b,d,e]),!IsValidArgType(c)&&W_ERROR(WErrors['InvalidParam'],'Arbitrations\x20clear\x20service\x20type\x20'+c+'\x20is\x20not\x20valid'),e?a['moveCall']({'target':serviceFn('arbitration_clear_with_passport'),'arguments':[toTxObject(a,b),toTxObject(a,d),toTxObject(a,e),a['object']['mutRegistrar']()],'typeArguments':[c]}):a['moveCall']({'target':serviceFn('arbitration_clear'),'arguments':[toTxObject(a,b),toTxObject(a,d),a['object']['mutRegistrar']()],'typeArguments':[c]});}export async function compensation_fund_add(a,b,c,d,e,f,g){validObjects([c,e,g]);!IsValidArgType(d)&&W_ERROR(WErrors['InvalidParam'],'Compensation\x20fund\x20add\x20service\x20type\x20'+d+'\x20is\x20not\x20valid');const h=await getCoinParam(a,b,f,d);g?b['moveCall']({'target':serviceFn('compensation_fund_add_with_passport'),'arguments':[toTxObject(b,c),toTxObject(b,e),toTxObject(b,g),h],'typeArguments':[d]}):b['moveCall']({'target':serviceFn('compensation_fund_add'),'arguments':[toTxObject(b,c),toTxObject(b,e),h],'typeArguments':[d]});}export function compensation_lock_duration_set(a,b,c,d,e,f){if(!isValidU64(e)||e===0x0)return;validObjects([b,d,f]),!IsValidArgType(c)&&W_ERROR(WErrors['InvalidParam'],'Compensation\x20lock\x20duration\x20set\x20service\x20type\x20'+c+'\x20is\x20not\x20valid'),f?a['moveCall']({'target':serviceFn('compensation_lock_duration_add_with_passport'),'arguments':[toTxObject(a,b),toTxObject(a,d),toTxObject(a,f),a['pure']['u64'](e)],'typeArguments':[c]}):a['moveCall']({'target':serviceFn('compensation_lock_duration_add'),'arguments':[toTxObject(a,b),toTxObject(a,d),a['pure']['u64'](e)],'typeArguments':[c]});}export function order_allocators_set(a,b,c,d,e,f){validObjects([b,d,e,f]),!IsValidArgType(c)&&W_ERROR(WErrors['InvalidParam'],'Order\x20allocators\x20set\x20service\x20type\x20'+c+'\x20is\x20not\x20valid'),f?a['moveCall']({'target':serviceFn('order_allocators_set_with_passport'),'arguments':[toTxObject(a,b),toTxObject(a,d),toTxObject(a,f),a['object']['option']({'type':PackageAddress+'::allocation::Allocators','value':e??null})],'typeArguments':[c]}):a['moveCall']({'target':serviceFn('order_allocators_set'),'arguments':[toTxObject(a,b),toTxObject(a,d),a['object']['option']({'type':PackageAddress+'::allocation::Allocators','value':e??null})],'typeArguments':[c]});}export function reward_add(a,b,c,d,e,f,g){validObjects([b,d,e,g]),!IsValidArgType(c)&&W_ERROR(WErrors['InvalidParam'],'Rewards\x20add\x20service\x20type\x20'+c+'\x20is\x20not\x20valid'),!IsValidArgType(f)&&W_ERROR(WErrors['InvalidParam'],'Rewards\x20add\x20reward\x20type\x20'+f+'\x20is\x20not\x20valid'),g?a['moveCall']({'target':serviceFn('reward_add_with_passport'),'arguments':[toTxObject(a,b),toTxObject(a,d),toTxObject(a,g),toTxObject(a,e),a['object']['mutRegistrar'](),a['object']['clock']()],'typeArguments':[c,f]}):a['moveCall']({'target':serviceFn('reward_add'),'arguments':[toTxObject(a,b),toTxObject(a,d),toTxObject(a,e),a['object']['mutRegistrar'](),a['object']['clock']()],'typeArguments':[c,f]});}export function reward_remove(a,b,c,d,e,f){if(e['length']===0x0)return;validObjects([b,d,f]),!IsValidArgType(c)&&W_ERROR(WErrors['InvalidParam'],'Rewards\x20remove\x20service\x20type\x20'+c+'\x20is\x20not\x20valid'),f?a['moveCall']({'target':serviceFn('reward_remove_with_passport'),'arguments':[toTxObject(a,b),toTxObject(a,d),toTxObject(a,f),a['pure']['vector']('address',e),a['object']['mutRegistrar']()],'typeArguments':[c]}):a['moveCall']({'target':serviceFn('reward_remove'),'arguments':[toTxObject(a,b),toTxObject(a,d),a['pure']['vector']('address',e),a['object']['mutRegistrar']()],'typeArguments':[c]});}export function reward_clear(a,b,c,d,e){validObjects([b,d,e]),!IsValidArgType(c)&&W_ERROR(WErrors['InvalidParam'],'Rewards\x20clear\x20service\x20type\x20'+c+'\x20is\x20not\x20valid'),e?a['moveCall']({'target':serviceFn('reward_clear_with_passport'),'arguments':[toTxObject(a,b),toTxObject(a,d),toTxObject(a,e),a['object']['mutRegistrar']()],'typeArguments':[c]}):a['moveCall']({'target':serviceFn('reward_clear'),'arguments':[toTxObject(a,b),toTxObject(a,d),a['object']['mutRegistrar']()],'typeArguments':[c]});}export function compensation_fund_receive(a,b,c,d,e,f,g){!f&&W_ERROR(WErrors['InvalidParam'],'Compensation\x20fund\x20receive\x20payment\x20is\x20required'),validObjects([b,d,e,f,g]),!IsValidArgType(c)&&W_ERROR(WErrors['InvalidParam'],'Compensation\x20fund\x20receive\x20service\x20type\x20'+c+'\x20is\x20not\x20valid'),g?a['moveCall']({'target':serviceFn('compensation_fund_receive_with_passport'),'arguments':[toTxObject(a,b),toTxObject(a,d),toTxObject(a,g),toTxObject(a,e),toTxObject(a,f)],'typeArguments':[c]}):a['moveCall']({'target':serviceFn('compensation_fund_receive'),'arguments':[toTxObject(a,b),toTxObject(a,d),toTxObject(a,e),toTxObject(a,f)],'typeArguments':[c]});}export function compensation_fund_withdraw(a,b,c,d,e,f,g){validObjects([b,f,e,d,g]),!IsValidArgType(c)&&W_ERROR(WErrors['InvalidParam'],'Compensation\x20fund\x20withdraw\x20service\x20type\x20'+c+'\x20is\x20not\x20valid'),g?a['moveCall']({'target':serviceFn('compensation_fund_withdraw_with_passport'),'arguments':[toTxObject(a,b),toTxObject(a,f),toTxObject(a,g),a['pure']['address'](e),toTxObject(a,d),a['object']['mutRegistrar'](),a['object']['clock']()],'typeArguments':[c]}):a['moveCall']({'target':serviceFn('compensation_fund_withdraw'),'arguments':[toTxObject(a,b),toTxObject(a,f),a['pure']['address'](e),toTxObject(a,d),a['object']['mutRegistrar'](),a['object']['clock']()],'typeArguments':[c]});}export async function discount(a,b,c,d,e,f){let g=[];Array['isArray'](e['recipient'])?g=e['recipient']:g=await GetManyAccountOrMark_Address(e['recipient']);if(g['length']===0x0||e['count']===0x0)return;g['length']>MAX_DISCOUNT_RECEIVER_ONCE&&W_ERROR(WErrors['InvalidParam'],'Discount\x20recipient\x20length\x20'+g['length']+'\x20is\x20exceed\x20max\x20'+MAX_DISCOUNT_RECEIVER_ONCE);!isValidName(e['name'])&&W_ERROR(WErrors['InvalidParam'],'Discount\x20name\x20'+e['name']+'\x20is\x20not\x20valid');(!isValidU16(e['count'])||e['count']>MAX_DISCOUNT_COUNT_ONCE)&&W_ERROR(WErrors['InvalidParam'],'Discount\x20count\x20'+e['count']+'\x20is\x20exceed\x20max\x20'+MAX_DISCOUNT_COUNT_ONCE);g['length']*e['count']>MAX_DISCOUNT_TOTAL_COUNT&&W_ERROR(WErrors['InvalidParam'],'Discount\x20total\x20count\x20'+g['length']*e['count']+'\x20is\x20exceed\x20max\x20'+MAX_DISCOUNT_TOTAL_COUNT);e['benchmark']!=null&&!isValidU64(e['benchmark'])&&W_ERROR(WErrors['InvalidParam'],'Discount\x20benchmark\x20'+e['benchmark']+'\x20is\x20not\x20valid');const h=e['time_ms_start']??Date['now']();e['time_ms_end']<h&&W_ERROR(WErrors['InvalidParam'],'Discount\x20time_ms_end\x20'+e['time_ms_end']+'\x20is\x20not\x20valid'),e['discount_value']!=null&&!isValidU64(e['discount_value'])&&W_ERROR(WErrors['InvalidParam'],'Discount\x20discount_value\x20'+e['discount_value']+'\x20is\x20not\x20valid'),validObjects([b,d,f,...g]),!IsValidArgType(c)&&W_ERROR(WErrors['InvalidParam'],'Discount\x20service\x20type\x20'+c+'\x20is\x20not\x20valid'),f?a['moveCall']({'target':serviceFn('discount_with_passport'),'arguments':[toTxObject(a,b),toTxObject(a,d),toTxObject(a,f),a['pure']['string'](e['name']),a['pure']['u8'](e['discount_type']),a['pure']['u64'](e['discount_value']),a['pure']['option']('u64',e['benchmark']??null),a['pure']['bool'](e['transferable']),a['pure']['option']('u64',e['time_ms_start']??null),a['pure']['u64'](e['time_ms_end']),a['pure']['u16'](e['count']),a['pure']['vector']('address',g),a['object']['clock']()],'typeArguments':[c]}):a['moveCall']({'target':serviceFn('discount'),'arguments':[toTxObject(a,b),toTxObject(a,d),a['pure']['string'](e['name']),a['pure']['u8'](e['discount_type']),a['pure']['u64'](e['discount_value']),a['pure']['option']('u64',e['benchmark']??null),a['pure']['bool'](e['transferable']),a['pure']['option']('u64',e['time_ms_start']??null),a['pure']['u64'](e['time_ms_end']),a['pure']['u16'](e['count']),a['pure']['vector']('address',g),a['object']['clock']()],'typeArguments':[c]});}
|
|
1
|
+
import{toTxObject,toTxString,isValidDescription,MAX_DESCRIPTION_LENGTH,isValidName,isValidLongName,isValidU16,isValidU64,PackageAddress,MAX_LONG_NAME_LENGTH,isValidArray,IsValidArgType,GetObjectExisted,GetObject,GetObjectDescription,serviceFn,MAX_NAME_LENGTH,isValidHttpUrl}from'../common.js';import{W_ERROR,WErrors}from'../exception.js';import{ObjectType}from'../query/object.js';import{owner_receive,parseObjectType,validObjects}from'../util.js';import{allocators}from'./allocation.js';import{CallBase,getCoinParam}from'./base.js';import{BuiltinPermissionIndex,newPermission}from'./permission.js';import{GetManyAccountOrMark_Address,verify_wip}from'../local/index.js';import{WIP}from'../local/wip.js';import{LocalMark}from'../local/local.js';import{agent_set,order_required_info_update,owner_change}from'./order.js';import{create as a165a}from'./progress.js';import{create as a165b}from'./order.js';import{create as a165c}from'./permission.js';import{queryObjectsWithType}from'../query/util.js';import{query_received}from'../query/received.js';export const NAMED_OPERATOR_ORDER_PAYER='';export class CallService extends CallBase{['data'];['object_address']=undefined;['permission_address']=undefined;['new_permission_description']=undefined;['parameter_type']=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']));if(this['object_address']){this['content']=undefined,await this['update_content'](a,ObjectType['Service'],this['object_address']);if(!this['content'])W_ERROR(WErrors['InvalidParam'],'CallService_Data.data.object:'+this['object_address']);this['permission_address']=this['content']['permission'],this['parameter_type']=parseObjectType(this['content']['type_raw'],'service::Service'),!this['permission_address']&&W_ERROR(WErrors['InvalidParam'],'CallService_Data.data.object.permission\x20is\x20empty'),!IsValidArgType(this['parameter_type'])&&W_ERROR(WErrors['IsValidArgType'],'CallService_Data.data.object.type_parameter\x20is\x20empty');}else{const b=GetObject(this['data']['object']);this['permission_address']=await GetObjectExisted(b?.['permission']),this['new_permission_description']=GetObjectDescription(b?.['permission']),this['parameter_type']=b?.['type_parameter'],!IsValidArgType(this['parameter_type'])&&W_ERROR(WErrors['IsValidArgType'],'CallService_Data.data.object.type_parameter\x20invalid');}}async['call'](a){await this['prepare'](a);const b=[],c=[],d=f=>{!b['includes'](f)&&b['push'](f);},e=f=>{this['permission_address']&&!c['includes'](f)&&c['push'](f);};this['permission_address']&&!this['object_address']&&e(BuiltinPermissionIndex['SERVICE_NEW']);this['data']?.['order_new']&&(!this['content']&&W_ERROR(WErrors['InvalidParam'],'CallService_Data.data.order_new\x20fail\x20because\x20the\x20Service\x20'+JSON['stringify'](this['data']['object'])+'\x20content\x20not\x20ready'),this['order_allowed'](),this['content']['buy_guard']!=null&&d(this['content']['buy_guard']));this['permission_address']&&this['data']?.['description']!=null&&this['object_address']&&e(BuiltinPermissionIndex['SERVICE_DESCRIPTION']);this['permission_address']&&this['data']?.['location']!=null&&e(BuiltinPermissionIndex['SERVICE_LOCATION']);this['permission_address']&&this['data']?.['repositories']!=null&&e(BuiltinPermissionIndex['SERVICE_REPOSITORY']);this['permission_address']&&this['data']?.['sales']!=null&&e(BuiltinPermissionIndex['SERVICE_SALES']);this['permission_address']&&this['data']?.['machine']!==undefined&&(this['checkNotPublished']('machine'),e(BuiltinPermissionIndex['SERVICE_MACHINE']));this['permission_address']&&this['data']?.['discount']!=null&&e(BuiltinPermissionIndex['SERVICE_DISCOUNT']);this['permission_address']&&this['data']?.['arbitrations']!=null&&(this['checkNotPublished']('arbitrations'),e(BuiltinPermissionIndex['SERVICE_ARBITRATION']));this['permission_address']&&this['data']?.['customer_required']!=null&&e(BuiltinPermissionIndex['SERVICE_CUSTOMER_INFO_REQUIRED']);this['permission_address']&&this['data']?.['pause']!==undefined&&e(BuiltinPermissionIndex['SERVICE_PAUSE']);this['permission_address']&&this['data']?.['publish']&&e(BuiltinPermissionIndex['SERVICE_PUBLISH']);this['permission_address']&&this['data']?.['order_allocators']!==undefined&&(this['checkNotPublished']('order_allocators'),e(BuiltinPermissionIndex['SERVICE_ORDER_ALLOCATOR']));if(this['permission_address']&&this['data']?.['buy_guard']!=null){const f=await LocalMark['Instance']()['get_address'](this['data']?.['buy_guard']);!f&&W_ERROR(WErrors['InvalidParam'],'CallService_Data.data.buy_guard:'+this['data']?.['buy_guard']),this['data']['buy_guard']=f,e(BuiltinPermissionIndex['SERVICE_BUY_GUARD']);}this['permission_address']&&this['data']?.['compensation_fund_add']!=null&&e(BuiltinPermissionIndex['SERVICE_COMPENSATION_FUND_DEPOSIT']);this['permission_address']&&this['data']?.['setting_locked_time_add']!==undefined&&e(BuiltinPermissionIndex['SERVICE_COMPENSATION_LOCKED_TIME_ADD']);this['permission_address']&&this['data']?.['rewards']!=null&&e(BuiltinPermissionIndex['SERVICE_REWARD']);this['permission_address']&&this['data']?.['compensation_fund_receive']!=null&&e(BuiltinPermissionIndex['SERVICE_COMPENSATION_FUND_RECEIVE']);this['permission_address']&&this['data']?.['owner_receive']!=null&&e(BuiltinPermissionIndex['SERVICE_OWNER_RECEIVE']);this['permission_address']&&this['data']?.['um']!==undefined&&e(BuiltinPermissionIndex['SERVICE_UM']);if(this['permission_address']||b['length']>0x0)return await this['check_permission_and_call'](a,this['permission_address'],c,b);return await this['exec'](a);}async['operate'](a,b,c,d){let e=this['permission_address'],f=this['object_address'];!this['object_address']&&(!e&&(e=newPermission(b,this['new_permission_description']??'')),e&&this['parameter_type']&&(f=newService(b,this['parameter_type'],e,this['data']?.['description']??'',c)));(!f||!e)&&W_ERROR(WErrors['InvalidParam'],'CallService_Data.data.object:'+this['object_address']);let g;if(this['data']?.['order_new']!=null&&this['content']){this['order_allowed']();const h=this['data']?.['order_new'],i=this['content']['sales'],j=new Set();for(const k of h['buy']['items']){const l=i['find'](q=>q['name']===k['name']);!l&&W_ERROR(WErrors['InvalidParam'],'Product\x20\x22'+k['name']+'\x22\x20not\x20found\x20in\x20Service\x20sales');if(j['has'](l['wip']))continue;if(l['wip']==='')continue;const o=await verify_wip(l['wip'],k['wip_hash']);!o['valid']&&W_ERROR(WErrors['InvalidParam'],'WIP\x20file\x20verification\x20failed\x20for\x20product\x20\x22'+k['name']+'\x22\x20at\x20'+l['wip']+':\x20'+o['error']),j['add'](l['wip']);}h['buy']['discount']=await LocalMark['Instance']()['get_address'](this['data']['order_new']['buy']['discount']),g=await buy(a,b,f,this['parameter_type'],this['content']['machine'],h['buy'],c);!g&&W_ERROR(WErrors['Fail'],'Buy\x20failed,\x20no\x20order\x20created');h?.['agents']!=null&&agent_set(b,{'order':g['order'],'agents':await GetManyAccountOrMark_Address(h['agents'])});h?.['order_required_info']!==undefined&&h['order_required_info']['length']>0x0&&await order_required_info_update(b,g['order'],h['order_required_info']);h?.['transfer']!=null&&await owner_change(b,{'order':g['order'],'new_owner':h['transfer']});h?.['namedNewAllocation']!=null&&g?.['allocation']&&await this['new_with_mark'](a,b,ObjectType['Allocation'],g?.['allocation'],GetObject(h['namedNewAllocation']));g?.['progress']&&(h?.['namedNewProgress']!=null?await this['new_with_mark'](a,b,ObjectType['Progress'],a165a(b,g?.['progress']),GetObject(h['namedNewProgress'])):a165a(b,g?.['progress']));if(g?.['order']){const q=a165b(b,g?.['order']);h?.['namedNewOrder']!=null&&await this['new_with_mark'](a,b,ObjectType['Order'],q,GetObject(h['namedNewOrder']));}}this['data']['description']!=null&&!this['object_address']&&description_set(b,f,this['parameter_type'],e,this['data']['description'],c);this['data']['location']!=null&&location_set(b,f,this['parameter_type'],e,this['data']['location'],c);if(this['data']['sales']!=null)switch(this['data']['sales']['op']){case'add':case'set':{for(const s of this['data']['sales']['sales']){if(s['wip']!==''){const t=await verify_wip(s['wip'],s['wip_hash']!==''?s['wip_hash']:undefined);!t['valid']&&W_ERROR(WErrors['InvalidParam'],'WIP\x20file\x20verification\x20failed\x20for\x20product\x20\x22'+s['name']+'\x22\x20at\x20'+s['wip']+':\x20'+t['error']);const u=new WIP(),v=await u['load'](s['wip']);s['wip_hash']=u['getHash'](v);}}this['data']['sales']['op']==='add'?sales_add(b,f,this['parameter_type'],e,this['data']['sales']['sales'],c):sales_set(b,f,this['parameter_type'],e,this['data']['sales']['sales'],c);break;}case'remove':{sales_remove(b,f,this['parameter_type'],e,this['data']['sales']['sales_name'],c);break;}case'clear':{sales_clear(b,f,this['parameter_type'],e,c);break;}}if(this['data']['repositories']!=null)switch(this['data']['repositories']['op']){case'add':case'set':{this['data']['repositories']['objects']['length']>MAX_REPOSITORY_COUNT&&W_ERROR(WErrors['InvalidParam'],'CallService_Data.data.repositories.objects:'+this['data']['repositories']['objects']);this['data']['repositories']['op']==='set'&&repository_clear(b,f,this['parameter_type'],e,c);const w=await LocalMark['Instance']()['get_many_address_availables'](this['data']['repositories']['objects']);w['forEach'](x=>{repository_add(b,f,this['parameter_type'],e,x,c);});break;}case'remove':{this['data']['repositories']['objects']['length']>MAX_REPOSITORY_COUNT&&W_ERROR(WErrors['InvalidParam'],'CallService_Data.data.repositories.objects:'+this['data']['repositories']['objects']);const x=await LocalMark['Instance']()['get_many_address_availables'](this['data']['repositories']['objects']);repository_remove(b,f,this['parameter_type'],e,x,c);break;}case'clear':{repository_clear(b,f,this['parameter_type'],e,c);break;}}if(this['data']['rewards']!=null)switch(this['data']['rewards']['op']){case'add':case'set':{this['data']['rewards']['objects']['length']>MAX_REWARD_COUNT&&W_ERROR(WErrors['InvalidParam'],'rewards\x20count\x20exceeds\x20maximum\x20limit\x20'+MAX_REWARD_COUNT);this['data']['rewards']['op']==='set'&&reward_clear(b,f,this['parameter_type'],e,c);const y=await queryObjectsWithType(a,this['data']['rewards']['objects'],ObjectType['Reward'],'reward::Reward',!![]);y['forEach'](z=>{reward_add(b,f,this['parameter_type'],e,z['object'],z['type'],c);});break;}case'remove':{this['data']['rewards']['objects']['length']>MAX_REWARD_COUNT&&W_ERROR(WErrors['InvalidParam'],'rewards\x20count\x20exceeds\x20maximum\x20limit\x20'+MAX_REWARD_COUNT);const z=await LocalMark['Instance']()['get_many_address_availables'](this['data']['rewards']['objects']);reward_remove(b,f,this['parameter_type'],e,z,c);break;}case'clear':{reward_clear(b,f,this['parameter_type'],e,c);break;}}if(this['data']['arbitrations']!=null)switch(this['data']['arbitrations']['op']){case'add':case'set':{this['data']['arbitrations']['objects']['length']>MAX_ARBITRATION_COUNT&&W_ERROR(WErrors['InvalidParam'],'arbitrations\x20count\x20exceeds\x20maximum\x20limit\x20'+MAX_ARBITRATION_COUNT);this['data']['arbitrations']['op']==='set'&&arbitration_clear(b,f,this['parameter_type'],e,c);const A=await queryObjectsWithType(a,this['data']['arbitrations']['objects'],ObjectType['Arbitration'],'arbitration::Arbitration',!![]);A['forEach'](B=>{arbitrations_add(b,f,this['parameter_type'],e,B['object'],B['type'],c);});break;}case'remove':{this['data']['arbitrations']['objects']['length']>MAX_ARBITRATION_COUNT&&W_ERROR(WErrors['InvalidParam'],'arbitrations\x20count\x20exceeds\x20maximum\x20limit\x20'+MAX_ARBITRATION_COUNT);const B=await LocalMark['Instance']()['get_many_address_availables'](this['data']['arbitrations']['objects']);arbitrations_remove(b,f,this['parameter_type'],e,B,c);break;}case'clear':{arbitration_clear(b,f,this['parameter_type'],e,c);break;}}this['data']['discount']!=null&&await discount(b,f,this['parameter_type'],e,this['data']['discount'],c);if(this['data']['discount_destroy']!=null){const C=await LocalMark['Instance']()['get_many_address_availables'](this['data']['discount_destroy']);discount_destroy(b,C);}if(this['data']['machine']!==undefined){if(this['data']['machine']){const D=await LocalMark['Instance']()['get_address'](this['data']['machine']);D?this['data']['machine']=D:W_ERROR(WErrors['IsValidArgType'],'Machine\x20not\x20found\x20'+this['data']['machine']);}machine_set(b,f,this['parameter_type'],e,this['data']['machine'],c);}this['data']['customer_required']!=null&&customer_required_set(b,f,this['parameter_type'],e,this['data']['customer_required'],c);this['data']['order_allocators']!==undefined&&order_allocators_set(b,f,this['parameter_type'],e,this['data']['order_allocators']?await allocators(b,this['data']['order_allocators']):null,c);this['data']['buy_guard']!==undefined&&buy_guard_set(b,f,this['parameter_type'],e,this['data']['buy_guard'],c);this['data']['compensation_fund_add']!=null&&await compensation_fund_add(a,b,f,this['parameter_type'],e,this['data']['compensation_fund_add'],c);this['data']['setting_locked_time_add']!==undefined&&setting_lock_duration_set(b,f,this['parameter_type'],e,this['data']['setting_locked_time_add'],c);if(this['data']['compensation_fund_receive']!=null&&this['object_address']){if(this['data']['compensation_fund_receive']==='recently'){const E=await query_received({'name_or_address':{'name_or_address':this['object_address'],'local_mark_first':!![]},'network':a['network'],'no_cache':a['no_cache']});Array['isArray'](E)?W_ERROR(WErrors['InvalidParam'],'CallAllocation_Data.data.received_coins:\x20received\x20is\x20ReceivedNormal[]'):this['data']['compensation_fund_receive']=E;}if(typeof this['data']['compensation_fund_receive']==='object'&&'received'in this['data']['compensation_fund_receive']&&this['data']['compensation_fund_receive']['received']?.['length']>0x0){this['data']['compensation_fund_receive']['token_type']!==this['parameter_type']&&W_ERROR(WErrors['InvalidParam'],'token_type\x20'+this['data']['compensation_fund_receive']['token_type']+'\x20is\x20not\x20equal\x20to\x20parameter_type\x20'+this['parameter_type']);for(const F of this['data']['compensation_fund_receive']['received']){const [G,H]=await Promise['all']([LocalMark['Instance']()['get_address'](F['id']),LocalMark['Instance']()['get_address'](F['payment'])]);(!G||!H)&&W_ERROR(WErrors['IsValidArgType'],'Compensation\x20fund\x20receive\x20object\x20'+F['id']+'\x20or\x20payment\x20object\x20'+F['payment']+'\x20not\x20found'),compensation_fund_receive(b,f,this['parameter_type'],e,F['id'],F['payment'],c);}}}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':!![],'network':a['network'],'no_cache':a['no_cache']})),await owner_receive(b,f,e,this['data']['owner_receive'],this['parameter_type'],I=>PackageAddress+'::service::'+I,c));if(this['data']['um']!==undefined){let I=null;this['data']['um']&&(I=await LocalMark['Instance']()['get_address'](this['data']['um'])||null,!I&&W_ERROR(WErrors['InvalidParam'],'CallService_Data.data.um:'+this['data']['um'])),um_set(b,f,this['parameter_type'],e,I,c);}this['data']['pause']!=null&&pause(b,f,this['parameter_type'],e,this['data']['pause'],c);this['data']['publish']&&publish(b,f,this['parameter_type'],e,c);if(!this['permission_address']){const J=GetObject(this['data']?.['object']);await this['new_with_mark'](a,b,ObjectType['Permission'],a165c(b,e),GetObject(J['permission']));}!this['object_address']&&await this['new_with_mark'](a,b,ObjectType['Service'],create(b,f,this['parameter_type']),GetObject(this['data']?.['object']));}['checkPublished']=a=>{this['content']&&!this['content']['bPublished']&&W_ERROR(WErrors['Fail'],'Service\x20object\x20has\x20not\x20been\x20published\x20yet,\x20so\x20the\x20operation\x20('+a+')\x20cannot\x20proceed.');};['checkNotPublished']=a=>{this['content']&&this['content']['bPublished']&&W_ERROR(WErrors['Fail'],'Service\x20object\x20has\x20been\x20published\x20and\x20operation\x20('+a+')\x20cannot\x20proceed.\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20If\x20further\x20modifications\x20are\x20needed,\x20you\x20can\x20\x27clone\x27\x20a\x20new\x20Service\x20and\x20then\x20proceed\x20with\x20the\x20operation.');};['checkNotPaused']=a=>{this['content']&&this['content']['bPaused']&&W_ERROR(WErrors['Fail'],'Service\x20object\x20has\x20been\x20paused\x20and\x20operation\x20('+a+')\x20cannot\x20proceed.');};['order_allowed'](){if(this['content']?.['bPaused'])return W_ERROR(WErrors['InvalidParam'],'Service\x20is\x20paused'),![];if(this['content']?.['bPublished']!==!![])return W_ERROR(WErrors['InvalidParam'],'Service\x20is\x20not\x20published'),![];return!![];}}export const MAX_SALE_COUNT=0x32;export const MAX_REPOSITORY_COUNT=0x64;export const MAX_ARBITRATION_COUNT=0x14;export const MAX_REWARD_COUNT=0x14;export const MAX_CUSTOMER_REQUIRED_INFO_COUNT=0xa;export const MAX_PUBKEY_LENGTH=0x400;export const MAX_DISCOUNT_COUNT_ONCE=0x3e8;export const MAX_DISCOUNT_RECEIVER_ONCE=0x3e8;export const MAX_DISCOUNT_TOTAL_COUNT=0x4e20;export const MAX_REQUIRED_INFO_SIZE=0x14;export const DEFAULT_SETTING_LOCK_DURATION=0x9a7ec800;export const DISCOUNT_TYPE_RATES=0x0;export const DISCOUNT_TYPE_MINUS=0x1;const MAX_WIP_LENGTH=0x400,MAX_WIP_HASH_LENGTH=0x40;function sale(a,b){typeof b['name']==='string'&&!isValidLongName(b['name'])&&W_ERROR(WErrors['InvalidParam'],'Name\x20'+b['name']+'\x20exceeds\x20maximum\x20length\x20'+MAX_LONG_NAME_LENGTH);b['wip']['length']>MAX_WIP_LENGTH&&W_ERROR(WErrors['InvalidParam'],'WIP\x20'+b['wip']+'\x20exceeds\x20maximum\x20length\x20'+MAX_WIP_LENGTH);const c=b['wip'];b['wip']['length']>0x0&&!isValidHttpUrl(b['wip'])&&W_ERROR(WErrors['IsValidHttpUrl'],'WIP\x20'+b['wip']+'\x20is\x20not\x20a\x20valid\x20HTTP/HTTPS\x20URL');const d=b['wip_hash']['includes'](':')?b['wip_hash']['split'](':')[0x1]:b['wip_hash'];return d['length']>MAX_WIP_HASH_LENGTH&&W_ERROR(WErrors['InvalidParam'],'WIP\x20hash\x20'+d+'\x20exceeds\x20maximum\x20length\x20'+MAX_WIP_HASH_LENGTH),a['moveCall']({'target':serviceFn('sale'),'arguments':[toTxString(a,b['name']),a['pure']['u64'](b['price']),a['pure']['u64'](b['stock']),a['pure']['bool'](b['suspension']),toTxString(a,c),toTxString(a,d)]});}function quote_item(a,b){!isValidLongName(b['name'])&&W_ERROR(WErrors['InvalidParam'],'Quote\x20item\x20name\x20'+b['name']+'\x20is\x20not\x20valid');!isValidU64(b['stock'])&&W_ERROR(WErrors['IsValidU64'],'Quote\x20item\x20stock\x20'+b['stock']+'\x20is\x20not\x20valid');const c=b['wip_hash']['includes'](':')?b['wip_hash']['split'](':')[0x1]:b['wip_hash'];return c['length']>MAX_WIP_HASH_LENGTH&&W_ERROR(WErrors['InvalidParam'],'Quote\x20item\x20wip_hash\x20'+c+'\x20exceeds\x20maximum\x20length\x20'+MAX_WIP_HASH_LENGTH),a['moveCall']({'target':serviceFn('quote_item'),'arguments':[toTxString(a,b['name']),a['pure']['u64'](b['stock']),toTxString(a,c)]});}export function discount_send(a,b,c){if(b['length']===0x0)return;validObjects([...b,c]);b['length']>MAX_DISCOUNT_COUNT_ONCE&&W_ERROR(WErrors['InvalidParam'],'Discount\x20count\x20'+b['length']+'\x20exceeds\x20maximum\x20limit\x20'+MAX_DISCOUNT_COUNT_ONCE);if(b['length']===0x1){a['moveCall']({'target':serviceFn('discount_send_singleton'),'arguments':[toTxObject(a,b[0x0]),a['pure']['address'](c)]});return;}else a['moveCall']({'target':serviceFn('discount_send'),'arguments':[a['makeMoveVec']({'elements':b,'type':PackageAddress+'::service::Discount'}),a['pure']['address'](c)]});}export function discount_destroy(a,b){validObjects([...b]),b['forEach'](c=>{a['moveCall']({'target':serviceFn('discount_destroy'),'arguments':[toTxObject(a,c)]});});}export const buy=async(a,b,c,d,e,f,g)=>{if(f['items']['length']===0x0)return undefined;validObjects([c,f['discount'],e,g]);!IsValidArgType(d)&&W_ERROR(WErrors['InvalidParam'],'Buy\x20service\x20type\x20'+d+'\x20is\x20not\x20valid');!isValidArray(f['items'],l=>{return!isValidLongName(l['name'])&&W_ERROR(WErrors['InvalidParam'],'Buy\x20item\x20name\x20'+l['name']+'\x20is\x20not\x20valid'),!isValidU64(l['stock'])&&W_ERROR(WErrors['IsValidU64'],'Buy\x20item\x20stock\x20'+l['stock']+'\x20is\x20not\x20valid'),!![];})&&W_ERROR(WErrors['InvalidParam'],'Buy\x20items\x20is\x20not\x20valid');typeof f['payment_remark']==='string'&&!isValidName(f['payment_remark'])&&W_ERROR(WErrors['InvalidParam'],'Buy\x20payment\x20remark\x20'+f['payment_remark']+'\x20is\x20not\x20valid');f['payment_remark']=f['payment_remark']||'';f['payment_index']!=null&&!isValidU64(f['payment_index'])&&W_ERROR(WErrors['IsValidU64'],'Buy\x20payment\x20index\x20'+f['payment_index']+'\x20is\x20not\x20valid');const h=await getCoinParam(a,b,f['total_pay'],d);f['discount']=await LocalMark['Instance']()['get_address'](f['discount']);let i=undefined;f['discount']?i=b['moveCall']({'target':serviceFn('quote_with_discount'),'arguments':[toTxObject(b,c),b['makeMoveVec']({'elements':f['items']['map'](l=>quote_item(b,l)),'type':PackageAddress+'::service::QuoteItem'}),toTxObject(b,f['discount'])],'typeArguments':[d]}):i=b['moveCall']({'target':serviceFn('quote'),'arguments':[toTxObject(b,c),b['makeMoveVec']({'elements':f['items']['map'](l=>quote_item(b,l)),'type':PackageAddress+'::service::QuoteItem'})],'typeArguments':[d]});let j;g?j=b['moveCall']({'target':serviceFn('buy_with_passport'),'arguments':[toTxObject(b,c),toTxObject(b,g),i,b['object']['mutRegistrar'](),b['object']['clock']()],'typeArguments':[d]}):j=b['moveCall']({'target':serviceFn('buy'),'arguments':[toTxObject(b,c),i,b['object']['mutRegistrar'](),b['object']['clock']()],'typeArguments':[d]});const k={'order':j};return k['allocation']=b['moveCall']({'target':serviceFn('order_allocation'),'arguments':[toTxObject(b,c),toTxObject(b,j),h,b['pure']['string'](f['payment_remark']??''),b['pure']['u64'](f['payment_index']||0x0),b['object']['mutRegistrar'](),b['object']['clock']()],'typeArguments':[d]}),e&&(k['progress']=b['moveCall']({'target':serviceFn('order_progress'),'arguments':[toTxObject(b,c),toTxObject(b,j),toTxObject(b,e),b['object']['mutRegistrar'](),b['object']['clock']()],'typeArguments':[d]})),k;};export function newService(a,b,c,d,e){return validObjects([c,e]),typeof d==='string'&&!isValidDescription(d)&&W_ERROR(WErrors['IsValidDescription'],'Description\x20exceeds\x20maximum\x20length\x20'+MAX_DESCRIPTION_LENGTH),!IsValidArgType(b)&&W_ERROR(WErrors['InvalidParam'],'New\x20service\x20type\x20'+b+'\x20is\x20not\x20valid'),e?a['moveCall']({'target':serviceFn('new_with_passport'),'arguments':[toTxObject(a,c),toTxObject(a,e),toTxString(a,d),a['object']['mutRegistrar'](),a['object']['clock']()],'typeArguments':[b]}):a['moveCall']({'target':serviceFn('new'),'arguments':[toTxObject(a,c),toTxString(a,d),a['object']['mutRegistrar'](),a['object']['clock']()],'typeArguments':[b]});}export function description_set(a,b,c,d,e,f){validObjects([b,d,f]),typeof e==='string'&&!isValidDescription(e)&&W_ERROR(WErrors['IsValidDescription'],'Description\x20exceeds\x20maximum\x20length\x20'+MAX_DESCRIPTION_LENGTH),!IsValidArgType(c)&&W_ERROR(WErrors['InvalidParam'],'Description\x20set\x20service\x20type\x20'+c+'\x20is\x20not\x20valid'),f?a['moveCall']({'target':serviceFn('description_set_with_passport'),'arguments':[toTxObject(a,b),toTxObject(a,d),toTxObject(a,f),toTxString(a,e)],'typeArguments':[c]}):a['moveCall']({'target':serviceFn('description_set'),'arguments':[toTxObject(a,b),toTxObject(a,d),toTxString(a,e)],'typeArguments':[c]});}export function um_set(a,b,c,d,e,f){validObjects([b,d]),!IsValidArgType(c)&&W_ERROR(WErrors['InvalidParam'],'Service\x20type\x20'+c+'\x20is\x20not\x20valid'),e?f?a['moveCall']({'target':serviceFn('um_set_with_passport'),'arguments':[toTxObject(a,b),toTxObject(a,d),f,toTxObject(a,e),a['object']['mutRegistrar'](),a['object']['clock']()],'typeArguments':[c]}):a['moveCall']({'target':serviceFn('um_set'),'arguments':[toTxObject(a,b),toTxObject(a,d),toTxObject(a,e),a['object']['mutRegistrar'](),a['object']['clock']()],'typeArguments':[c]}):f?a['moveCall']({'target':serviceFn('um_none_with_passport'),'arguments':[toTxObject(a,b),toTxObject(a,d),f,a['object']['mutRegistrar']()],'typeArguments':[c]}):a['moveCall']({'target':serviceFn('um_none'),'arguments':[toTxObject(a,b),toTxObject(a,d),a['object']['mutRegistrar']()],'typeArguments':[c]});}export function location_set(a,b,c,d,e,f){validObjects([b,d,f]),typeof e==='string'&&!isValidLongName(e)&&W_ERROR(WErrors['InvalidParam'],'Location\x20'+e+'\x20exceeds\x20maximum\x20length\x20'+MAX_LONG_NAME_LENGTH),!IsValidArgType(c)&&W_ERROR(WErrors['InvalidParam'],'Location\x20set\x20service\x20type\x20'+c+'\x20is\x20not\x20valid'),f?a['moveCall']({'target':serviceFn('location_set_with_passport'),'arguments':[toTxObject(a,b),toTxObject(a,d),toTxObject(a,f),toTxString(a,e)],'typeArguments':[c]}):a['moveCall']({'target':serviceFn('location_set'),'arguments':[toTxObject(a,b),toTxObject(a,d),toTxString(a,e)],'typeArguments':[c]});}export function create(a,b,c){return validObjects([b]),!IsValidArgType(c)&&W_ERROR(WErrors['InvalidParam'],'Create\x20service\x20type\x20'+c+'\x20is\x20not\x20valid'),a['moveCall']({'target':serviceFn('create'),'arguments':[toTxObject(a,b)],'typeArguments':[c]});}export function sales_add(a,b,c,d,e,f){if(e['length']===0x0)return;validObjects([b,d,f]),!IsValidArgType(c)&&W_ERROR(WErrors['InvalidParam'],'Sales\x20add\x20service\x20type\x20'+c+'\x20is\x20not\x20valid'),f?a['moveCall']({'target':serviceFn('sales_add_with_passport'),'arguments':[toTxObject(a,b),toTxObject(a,d),toTxObject(a,f),a['makeMoveVec']({'elements':e['map'](g=>sale(a,g)),'type':PackageAddress+'::service::Sale'})],'typeArguments':[c]}):a['moveCall']({'target':serviceFn('sales_add'),'arguments':[toTxObject(a,b),toTxObject(a,d),a['makeMoveVec']({'elements':e['map'](g=>sale(a,g)),'type':PackageAddress+'::service::Sale'})],'typeArguments':[c]});}export function sales_remove(a,b,c,d,e,f){if(e['length']===0x0)return;validObjects([b,d,f]),!IsValidArgType(c)&&W_ERROR(WErrors['InvalidParam'],'Sales\x20remove\x20service\x20type\x20'+c+'\x20is\x20not\x20valid'),f?a['moveCall']({'target':serviceFn('sales_remove_with_passport'),'arguments':[toTxObject(a,b),toTxObject(a,d),toTxObject(a,f),a['pure']['vector']('string',e)],'typeArguments':[c]}):a['moveCall']({'target':serviceFn('sales_remove'),'arguments':[toTxObject(a,b),toTxObject(a,d),a['pure']['vector']('string',e)],'typeArguments':[c]});}export function sales_clear(a,b,c,d,e){validObjects([b,d,e]),!IsValidArgType(c)&&W_ERROR(WErrors['InvalidParam'],'Sales\x20clear\x20service\x20type\x20'+c+'\x20is\x20not\x20valid'),e?a['moveCall']({'target':serviceFn('sales_clear_with_passport'),'arguments':[toTxObject(a,b),toTxObject(a,d),toTxObject(a,e)],'typeArguments':[c]}):a['moveCall']({'target':serviceFn('sales_clear'),'arguments':[toTxObject(a,b),toTxObject(a,d)],'typeArguments':[c]});}export function sales_set(a,b,c,d,e,f){if(e['length']===0x0)return;validObjects([b,d,f]),!IsValidArgType(c)&&W_ERROR(WErrors['InvalidParam'],'Sales\x20set\x20service\x20type\x20'+c+'\x20is\x20not\x20valid'),f?a['moveCall']({'target':serviceFn('sales_set_with_passport'),'arguments':[toTxObject(a,b),toTxObject(a,d),toTxObject(a,f),a['makeMoveVec']({'elements':e['map'](g=>sale(a,g)),'type':PackageAddress+'::service::Sale'})],'typeArguments':[c]}):a['moveCall']({'target':serviceFn('sales_set'),'arguments':[toTxObject(a,b),toTxObject(a,d),a['makeMoveVec']({'elements':e['map'](g=>sale(a,g)),'type':PackageAddress+'::service::Sale'})],'typeArguments':[c]});}export function price_add(a,b,c,d,e,f,g){validObjects([b,d,g]),!IsValidArgType(c)&&W_ERROR(WErrors['InvalidParam'],'Price\x20add\x20service\x20type\x20'+c+'\x20is\x20not\x20valid'),typeof e==='string'&&!isValidLongName(e)&&W_ERROR(WErrors['InvalidParam'],'Sale\x20name\x20'+e+'\x20exceeds\x20maximum\x20length\x20'+MAX_LONG_NAME_LENGTH),!isValidU64(f)&&W_ERROR(WErrors['IsValidU64'],'Price\x20add\x20'+f+'\x20is\x20not\x20valid'),g?a['moveCall']({'target':serviceFn('price_add_with_passport'),'arguments':[toTxObject(a,b),toTxObject(a,d),toTxObject(a,g),toTxString(a,e),a['pure']['u64'](f)],'typeArguments':[c]}):a['moveCall']({'target':serviceFn('price_add'),'arguments':[toTxObject(a,b),toTxObject(a,d),toTxString(a,e),a['pure']['u64'](f)],'typeArguments':[c]});}export function price_reduce(a,b,c,d,e,f,g){validObjects([b,d,g]),!IsValidArgType(c)&&W_ERROR(WErrors['InvalidParam'],'Price\x20reduce\x20service\x20type\x20'+c+'\x20is\x20not\x20valid'),typeof e==='string'&&!isValidLongName(e)&&W_ERROR(WErrors['InvalidParam'],'Sale\x20name\x20'+e+'\x20exceeds\x20maximum\x20length\x20'+MAX_LONG_NAME_LENGTH),!isValidU64(f)&&W_ERROR(WErrors['IsValidU64'],'Price\x20reduce\x20'+f+'\x20is\x20not\x20valid'),g?a['moveCall']({'target':serviceFn('price_reduce_with_passport'),'arguments':[toTxObject(a,b),toTxObject(a,d),toTxObject(a,g),toTxString(a,e),a['pure']['u64'](f)],'typeArguments':[c]}):a['moveCall']({'target':serviceFn('price_reduce'),'arguments':[toTxObject(a,b),toTxObject(a,d),toTxString(a,e),a['pure']['u64'](f)],'typeArguments':[c]});}export function stock_add(a,b,c,d,e,f,g){validObjects([b,d,g]),!IsValidArgType(c)&&W_ERROR(WErrors['InvalidParam'],'Stock\x20add\x20service\x20type\x20'+c+'\x20is\x20not\x20valid'),typeof e==='string'&&!isValidLongName(e)&&W_ERROR(WErrors['InvalidParam'],'Sale\x20name\x20'+e+'\x20exceeds\x20maximum\x20length\x20'+MAX_LONG_NAME_LENGTH),!isValidU64(f)&&W_ERROR(WErrors['IsValidU64'],'Stock\x20add\x20'+f+'\x20is\x20not\x20valid'),g?a['moveCall']({'target':serviceFn('stock_add_with_passport'),'arguments':[toTxObject(a,b),toTxObject(a,d),toTxObject(a,g),toTxString(a,e),a['pure']['u64'](f)],'typeArguments':[c]}):a['moveCall']({'target':serviceFn('stock_add'),'arguments':[toTxObject(a,b),toTxObject(a,d),toTxString(a,e),a['pure']['u64'](f)],'typeArguments':[c]});}export function stock_reduce(a,b,c,d,e,f,g){validObjects([b,d,g]),!IsValidArgType(c)&&W_ERROR(WErrors['InvalidParam'],'Stock\x20reduce\x20service\x20type\x20'+c+'\x20is\x20not\x20valid'),typeof e==='string'&&!isValidLongName(e)&&W_ERROR(WErrors['InvalidParam'],'Sale\x20name\x20'+e+'\x20exceeds\x20maximum\x20length\x20'+MAX_LONG_NAME_LENGTH),!isValidU64(f)&&W_ERROR(WErrors['IsValidU64'],'Stock\x20reduce\x20'+f+'\x20is\x20not\x20valid'),g?a['moveCall']({'target':serviceFn('stock_reduce_with_passport'),'arguments':[toTxObject(a,b),toTxObject(a,d),toTxObject(a,g),toTxString(a,e),a['pure']['u64'](f)],'typeArguments':[c]}):a['moveCall']({'target':serviceFn('stock_reduce'),'arguments':[toTxObject(a,b),toTxObject(a,d),toTxString(a,e),a['pure']['u64'](f)],'typeArguments':[c]});}export function sale_suspension(a,b,c,d,e,f,g){validObjects([b,d,g]),!IsValidArgType(c)&&W_ERROR(WErrors['InvalidParam'],'Sale\x20suspension\x20service\x20type\x20'+c+'\x20is\x20not\x20valid'),typeof e==='string'&&!isValidLongName(e)&&W_ERROR(WErrors['InvalidParam'],'Sale\x20name\x20'+e+'\x20exceeds\x20maximum\x20length\x20'+MAX_LONG_NAME_LENGTH),g?a['moveCall']({'target':serviceFn('sale_suspension_with_passport'),'arguments':[toTxObject(a,b),toTxObject(a,d),toTxObject(a,g),toTxString(a,e),a['pure']['bool'](f)],'typeArguments':[c]}):a['moveCall']({'target':serviceFn('sale_suspension'),'arguments':[toTxObject(a,b),toTxObject(a,d),toTxString(a,e),a['pure']['bool'](f)],'typeArguments':[c]});}export function repository_add(a,b,c,d,e,f){validObjects([b,d,e,f]),!IsValidArgType(c)&&W_ERROR(WErrors['InvalidParam'],'Repository\x20add\x20service\x20type\x20'+c+'\x20is\x20not\x20valid'),f?a['moveCall']({'target':serviceFn('repository_add_with_passport'),'arguments':[toTxObject(a,b),toTxObject(a,d),toTxObject(a,f),toTxObject(a,e),a['object']['mutRegistrar'](),a['object']['clock']()],'typeArguments':[c]}):a['moveCall']({'target':serviceFn('repository_add'),'arguments':[toTxObject(a,b),toTxObject(a,d),toTxObject(a,e),a['object']['mutRegistrar'](),a['object']['clock']()],'typeArguments':[c]});}export function repository_remove(a,b,c,d,e,f){if(e['length']===0x0)return;validObjects([b,d,f,...e]),!IsValidArgType(c)&&W_ERROR(WErrors['InvalidParam'],'Repository\x20remove\x20service\x20type\x20'+c+'\x20is\x20not\x20valid'),f?a['moveCall']({'target':serviceFn('repository_remove_with_passport'),'arguments':[toTxObject(a,b),toTxObject(a,d),toTxObject(a,f),a['pure']['vector']('address',e),a['object']['mutRegistrar']()],'typeArguments':[c]}):a['moveCall']({'target':serviceFn('repository_remove'),'arguments':[toTxObject(a,b),toTxObject(a,d),a['pure']['vector']('address',e),a['object']['mutRegistrar']()],'typeArguments':[c]});}export function repository_clear(a,b,c,d,e){validObjects([b,d,e]),!IsValidArgType(c)&&W_ERROR(WErrors['InvalidParam'],'Repository\x20clear\x20service\x20type\x20'+c+'\x20is\x20not\x20valid'),e?a['moveCall']({'target':serviceFn('repository_clear_with_passport'),'arguments':[toTxObject(a,b),toTxObject(a,d),toTxObject(a,e),a['object']['mutRegistrar']()],'typeArguments':[c]}):a['moveCall']({'target':serviceFn('repository_clear'),'arguments':[toTxObject(a,b),toTxObject(a,d),a['object']['mutRegistrar']()],'typeArguments':[c]});}export function buy_guard_set(a,b,c,d,e,f){validObjects([b,d,e,f]),!IsValidArgType(c)&&W_ERROR(WErrors['InvalidParam'],'Buy\x20guard\x20set\x20service\x20type\x20'+c+'\x20is\x20not\x20valid'),f?e?a['moveCall']({'target':serviceFn('buy_guard_set_with_passport'),'arguments':[toTxObject(a,b),toTxObject(a,d),toTxObject(a,f),toTxObject(a,e),a['object']['mutRegistrar'](),a['object']['clock']()],'typeArguments':[c]}):a['moveCall']({'target':serviceFn('buy_guard_none_with_passport'),'arguments':[toTxObject(a,b),toTxObject(a,d),toTxObject(a,f),a['object']['mutRegistrar']()],'typeArguments':[c]}):e?a['moveCall']({'target':serviceFn('buy_guard_set'),'arguments':[toTxObject(a,b),toTxObject(a,d),toTxObject(a,e),a['object']['mutRegistrar'](),a['object']['clock']()],'typeArguments':[c]}):a['moveCall']({'target':serviceFn('buy_guard_none'),'arguments':[toTxObject(a,b),toTxObject(a,d),a['object']['mutRegistrar']()],'typeArguments':[c]});}export function machine_set(a,b,c,d,e,f){validObjects([b,d,e,f]),!IsValidArgType(c)&&W_ERROR(WErrors['InvalidParam'],'Machine\x20set\x20service\x20type\x20'+c+'\x20is\x20not\x20valid'),f?e?a['moveCall']({'target':serviceFn('machine_set_with_passport'),'arguments':[toTxObject(a,b),toTxObject(a,d),toTxObject(a,f),toTxObject(a,e),a['object']['mutRegistrar'](),a['object']['clock']()],'typeArguments':[c]}):a['moveCall']({'target':serviceFn('machine_none_with_passport'),'arguments':[toTxObject(a,b),toTxObject(a,d),toTxObject(a,f),a['object']['mutRegistrar']()],'typeArguments':[c]}):e?a['moveCall']({'target':serviceFn('machine_set'),'arguments':[toTxObject(a,b),toTxObject(a,d),toTxObject(a,e),a['object']['mutRegistrar'](),a['object']['clock']()],'typeArguments':[c]}):a['moveCall']({'target':serviceFn('machine_set_none'),'arguments':[toTxObject(a,b),toTxObject(a,d),a['object']['mutRegistrar']()],'typeArguments':[c]});}export function publish(a,b,c,d,e){validObjects([b,d,e]),!IsValidArgType(c)&&W_ERROR(WErrors['InvalidParam'],'Publish\x20service\x20type\x20'+c+'\x20is\x20not\x20valid'),e?a['moveCall']({'target':serviceFn('publish_with_passport'),'arguments':[toTxObject(a,b),toTxObject(a,d),toTxObject(a,e)],'typeArguments':[c]}):a['moveCall']({'target':serviceFn('publish'),'arguments':[toTxObject(a,b),toTxObject(a,d)],'typeArguments':[c]});}export function pause(a,b,c,d,e,f){validObjects([b,d,f]),!IsValidArgType(c)&&W_ERROR(WErrors['InvalidParam'],'Pause\x20service\x20type\x20'+c+'\x20is\x20not\x20valid'),f?a['moveCall']({'target':serviceFn('pause_with_passport'),'arguments':[toTxObject(a,b),toTxObject(a,d),toTxObject(a,f),a['pure']['bool'](e),a['object']['clock']()],'typeArguments':[c]}):a['moveCall']({'target':serviceFn('pause'),'arguments':[toTxObject(a,b),toTxObject(a,d),a['pure']['bool'](e),a['object']['clock']()],'typeArguments':[c]});}export function customer_required_set(a,b,c,d,e,f){e['length']>MAX_REQUIRED_INFO_SIZE&&W_ERROR(WErrors['InvalidParam'],'Customer\x20required\x20set\x20size\x20'+e['length']+'\x20is\x20exceed\x20maximum\x20size\x20'+MAX_REQUIRED_INFO_SIZE),validObjects([b,d,f]),!IsValidArgType(c)&&W_ERROR(WErrors['InvalidParam'],'Customer\x20required\x20set\x20service\x20type\x20'+c+'\x20is\x20not\x20valid'),e['forEach'](g=>{!isValidName(g)&&W_ERROR(WErrors['InvalidParam'],'Customer\x20required\x20info\x20'+g+'\x20is\x20exceed\x20maximum\x20length\x20'+MAX_NAME_LENGTH+'\x20or\x20start\x20with\x20\x220x\x22');}),f?a['moveCall']({'target':serviceFn('custom_required_info_set_with_passport'),'arguments':[toTxObject(a,b),toTxObject(a,d),toTxObject(a,f),a['pure']['vector']('string',e)],'typeArguments':[c]}):a['moveCall']({'target':serviceFn('custom_required_info_set'),'arguments':[toTxObject(a,b),toTxObject(a,d),a['pure']['vector']('string',e)],'typeArguments':[c]});}export function arbitrations_add(a,b,c,d,e,f,g){validObjects([b,d,e,g]),!IsValidArgType(c)&&W_ERROR(WErrors['InvalidParam'],'Arbitrations\x20add\x20service\x20type\x20'+c+'\x20is\x20not\x20valid'),!IsValidArgType(f)&&W_ERROR(WErrors['InvalidParam'],'Arbitrations\x20add\x20arbitration\x20type\x20'+f+'\x20is\x20not\x20valid'),g?a['moveCall']({'target':serviceFn('arbitration_add_with_passport'),'arguments':[toTxObject(a,b),toTxObject(a,d),toTxObject(a,g),toTxObject(a,e),a['object']['mutRegistrar'](),a['object']['clock']()],'typeArguments':[c]}):a['moveCall']({'target':serviceFn('arbitration_add'),'arguments':[toTxObject(a,b),toTxObject(a,d),toTxObject(a,e),a['object']['mutRegistrar'](),a['object']['clock']()],'typeArguments':[c,f]});}export function arbitrations_remove(a,b,c,d,e,f){if(e['length']===0x0)return;validObjects([b,d,f]),!IsValidArgType(c)&&W_ERROR(WErrors['InvalidParam'],'Arbitrations\x20remove\x20service\x20type\x20'+c+'\x20is\x20not\x20valid'),f?a['moveCall']({'target':serviceFn('arbitration_remove_with_passport'),'arguments':[toTxObject(a,b),toTxObject(a,d),toTxObject(a,f),a['pure']['vector']('address',e),a['object']['mutRegistrar'](),a['object']['clock']()],'typeArguments':[c]}):a['moveCall']({'target':serviceFn('arbitration_remove'),'arguments':[toTxObject(a,b),toTxObject(a,d),a['pure']['vector']('address',e),a['object']['mutRegistrar'](),a['object']['clock']()],'typeArguments':[c]});}export function arbitration_clear(a,b,c,d,e){validObjects([b,d,e]),!IsValidArgType(c)&&W_ERROR(WErrors['InvalidParam'],'Arbitrations\x20clear\x20service\x20type\x20'+c+'\x20is\x20not\x20valid'),e?a['moveCall']({'target':serviceFn('arbitration_clear_with_passport'),'arguments':[toTxObject(a,b),toTxObject(a,d),toTxObject(a,e),a['object']['mutRegistrar'](),a['object']['clock']()],'typeArguments':[c]}):a['moveCall']({'target':serviceFn('arbitration_clear'),'arguments':[toTxObject(a,b),toTxObject(a,d),a['object']['mutRegistrar'](),a['object']['clock']()],'typeArguments':[c]});}export async function compensation_fund_add(a,b,c,d,e,f,g){validObjects([c,e,g]);!IsValidArgType(d)&&W_ERROR(WErrors['InvalidParam'],'Compensation\x20fund\x20add\x20service\x20type\x20'+d+'\x20is\x20not\x20valid');const h=await getCoinParam(a,b,f,d);g?b['moveCall']({'target':serviceFn('compensation_fund_add_with_passport'),'arguments':[toTxObject(b,c),toTxObject(b,e),toTxObject(b,g),h],'typeArguments':[d]}):b['moveCall']({'target':serviceFn('compensation_fund_add'),'arguments':[toTxObject(b,c),toTxObject(b,e),h],'typeArguments':[d]});}export function setting_lock_duration_set(a,b,c,d,e,f){if(!isValidU64(e)||e===0x0)return;validObjects([b,d,f]),!IsValidArgType(c)&&W_ERROR(WErrors['InvalidParam'],'Compensation\x20lock\x20duration\x20set\x20service\x20type\x20'+c+'\x20is\x20not\x20valid'),f?a['moveCall']({'target':serviceFn('setting_lock_duration_add_with_passport'),'arguments':[toTxObject(a,b),toTxObject(a,d),toTxObject(a,f),a['pure']['u64'](e)],'typeArguments':[c]}):a['moveCall']({'target':serviceFn('setting_lock_duration_add'),'arguments':[toTxObject(a,b),toTxObject(a,d),a['pure']['u64'](e)],'typeArguments':[c]});}export function order_allocators_set(a,b,c,d,e,f){validObjects([b,d,e,f]),!IsValidArgType(c)&&W_ERROR(WErrors['InvalidParam'],'Order\x20allocators\x20set\x20service\x20type\x20'+c+'\x20is\x20not\x20valid'),f?a['moveCall']({'target':serviceFn('order_allocators_set_with_passport'),'arguments':[toTxObject(a,b),toTxObject(a,d),toTxObject(a,f),a['object']['option']({'type':PackageAddress+'::allocation::Allocators','value':e??null})],'typeArguments':[c]}):a['moveCall']({'target':serviceFn('order_allocators_set'),'arguments':[toTxObject(a,b),toTxObject(a,d),a['object']['option']({'type':PackageAddress+'::allocation::Allocators','value':e??null})],'typeArguments':[c]});}export function reward_add(a,b,c,d,e,f,g){validObjects([b,d,e,g]),!IsValidArgType(c)&&W_ERROR(WErrors['InvalidParam'],'Rewards\x20add\x20service\x20type\x20'+c+'\x20is\x20not\x20valid'),!IsValidArgType(f)&&W_ERROR(WErrors['InvalidParam'],'Rewards\x20add\x20reward\x20type\x20'+f+'\x20is\x20not\x20valid'),g?a['moveCall']({'target':serviceFn('reward_add_with_passport'),'arguments':[toTxObject(a,b),toTxObject(a,d),toTxObject(a,g),toTxObject(a,e),a['object']['mutRegistrar'](),a['object']['clock']()],'typeArguments':[c,f]}):a['moveCall']({'target':serviceFn('reward_add'),'arguments':[toTxObject(a,b),toTxObject(a,d),toTxObject(a,e),a['object']['mutRegistrar'](),a['object']['clock']()],'typeArguments':[c,f]});}export function reward_remove(a,b,c,d,e,f){if(e['length']===0x0)return;validObjects([b,d,f]),!IsValidArgType(c)&&W_ERROR(WErrors['InvalidParam'],'Rewards\x20remove\x20service\x20type\x20'+c+'\x20is\x20not\x20valid'),f?a['moveCall']({'target':serviceFn('reward_remove_with_passport'),'arguments':[toTxObject(a,b),toTxObject(a,d),toTxObject(a,f),a['pure']['vector']('address',e),a['object']['mutRegistrar'](),a['object']['clock']()],'typeArguments':[c]}):a['moveCall']({'target':serviceFn('reward_remove'),'arguments':[toTxObject(a,b),toTxObject(a,d),a['pure']['vector']('address',e),a['object']['mutRegistrar'](),a['object']['clock']()],'typeArguments':[c]});}export function reward_clear(a,b,c,d,e){validObjects([b,d,e]),!IsValidArgType(c)&&W_ERROR(WErrors['InvalidParam'],'Rewards\x20clear\x20service\x20type\x20'+c+'\x20is\x20not\x20valid'),e?a['moveCall']({'target':serviceFn('reward_clear_with_passport'),'arguments':[toTxObject(a,b),toTxObject(a,d),toTxObject(a,e),a['object']['mutRegistrar'](),a['object']['clock']()],'typeArguments':[c]}):a['moveCall']({'target':serviceFn('reward_clear'),'arguments':[toTxObject(a,b),toTxObject(a,d),a['object']['mutRegistrar'](),a['object']['clock']()],'typeArguments':[c]});}export function compensation_fund_receive(a,b,c,d,e,f,g){!f&&W_ERROR(WErrors['InvalidParam'],'Compensation\x20fund\x20receive\x20payment\x20is\x20required'),validObjects([b,d,e,f,g]),!IsValidArgType(c)&&W_ERROR(WErrors['InvalidParam'],'Compensation\x20fund\x20receive\x20service\x20type\x20'+c+'\x20is\x20not\x20valid'),g?a['moveCall']({'target':serviceFn('compensation_fund_receive_with_passport'),'arguments':[toTxObject(a,b),toTxObject(a,d),toTxObject(a,g),toTxObject(a,e),toTxObject(a,f)],'typeArguments':[c]}):a['moveCall']({'target':serviceFn('compensation_fund_receive'),'arguments':[toTxObject(a,b),toTxObject(a,d),toTxObject(a,e),toTxObject(a,f)],'typeArguments':[c]});}export function compensation_fund_withdraw(a,b,c,d,e,f,g){validObjects([b,f,e,d,g]),!IsValidArgType(c)&&W_ERROR(WErrors['InvalidParam'],'Compensation\x20fund\x20withdraw\x20service\x20type\x20'+c+'\x20is\x20not\x20valid'),g?a['moveCall']({'target':serviceFn('compensation_fund_withdraw_with_passport'),'arguments':[toTxObject(a,b),toTxObject(a,f),toTxObject(a,g),a['pure']['address'](e),toTxObject(a,d),a['object']['mutRegistrar'](),a['object']['clock']()],'typeArguments':[c]}):a['moveCall']({'target':serviceFn('compensation_fund_withdraw'),'arguments':[toTxObject(a,b),toTxObject(a,f),a['pure']['address'](e),toTxObject(a,d),a['object']['mutRegistrar'](),a['object']['clock']()],'typeArguments':[c]});}export async function discount(a,b,c,d,e,f){let g=[];Array['isArray'](e['recipient'])?g=e['recipient']:g=await GetManyAccountOrMark_Address(e['recipient']);if(g['length']===0x0||e['count']===0x0)return;g['length']>MAX_DISCOUNT_RECEIVER_ONCE&&W_ERROR(WErrors['InvalidParam'],'Discount\x20recipient\x20length\x20'+g['length']+'\x20is\x20exceed\x20max\x20'+MAX_DISCOUNT_RECEIVER_ONCE);!isValidName(e['name'])&&W_ERROR(WErrors['InvalidParam'],'Discount\x20name\x20'+e['name']+'\x20is\x20not\x20valid');(!isValidU16(e['count'])||e['count']>MAX_DISCOUNT_COUNT_ONCE)&&W_ERROR(WErrors['InvalidParam'],'Discount\x20count\x20'+e['count']+'\x20is\x20exceed\x20max\x20'+MAX_DISCOUNT_COUNT_ONCE);g['length']*e['count']>MAX_DISCOUNT_TOTAL_COUNT&&W_ERROR(WErrors['InvalidParam'],'Discount\x20total\x20count\x20'+g['length']*e['count']+'\x20is\x20exceed\x20max\x20'+MAX_DISCOUNT_TOTAL_COUNT);e['benchmark']!=null&&!isValidU64(e['benchmark'])&&W_ERROR(WErrors['InvalidParam'],'Discount\x20benchmark\x20'+e['benchmark']+'\x20is\x20not\x20valid');const h=e['time_ms_start']??Date['now']();e['time_ms_end']<h&&W_ERROR(WErrors['InvalidParam'],'Discount\x20time_ms_end\x20'+e['time_ms_end']+'\x20is\x20not\x20valid'),e['discount_value']!=null&&!isValidU64(e['discount_value'])&&W_ERROR(WErrors['InvalidParam'],'Discount\x20discount_value\x20'+e['discount_value']+'\x20is\x20not\x20valid'),validObjects([b,d,f,...g]),!IsValidArgType(c)&&W_ERROR(WErrors['InvalidParam'],'Discount\x20service\x20type\x20'+c+'\x20is\x20not\x20valid'),f?a['moveCall']({'target':serviceFn('discount_with_passport'),'arguments':[toTxObject(a,b),toTxObject(a,d),toTxObject(a,f),a['pure']['string'](e['name']),a['pure']['u8'](e['discount_type']),a['pure']['u64'](e['discount_value']),a['pure']['option']('u64',e['benchmark']??null),a['pure']['bool'](e['transferable']),a['pure']['option']('u64',e['time_ms_start']??null),a['pure']['u64'](e['time_ms_end']),a['pure']['u16'](e['count']),a['pure']['vector']('address',g),a['object']['clock']()],'typeArguments':[c]}):a['moveCall']({'target':serviceFn('discount'),'arguments':[toTxObject(a,b),toTxObject(a,d),a['pure']['string'](e['name']),a['pure']['u8'](e['discount_type']),a['pure']['u64'](e['discount_value']),a['pure']['option']('u64',e['benchmark']??null),a['pure']['bool'](e['transferable']),a['pure']['option']('u64',e['time_ms_start']??null),a['pure']['u64'](e['time_ms_end']),a['pure']['u16'](e['count']),a['pure']['vector']('address',g),a['object']['clock']()],'typeArguments':[c]});}
|
package/dist/cjs/w/exception.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export var WErrors;(function(a){a['AccountNotFound']='account\x20not\x20found',a['AddressNotFound']='address\x20not\x20found',a['IsValidDescription']='invalid\x20description',a['IsValidName']='invalid\x20name',a['IsValidName_AllowEmpty']='invalid\x20name',a['IsValidEndpoint']='invalid\x20endpoint',a['IsValidAddress']='invalid\x20address',a['IsValidArgType']='invalid\x20argument\x20type',a['IsValidTokenType']='invalid\x20token\x20type',a['IsValidUint']='invalid\x20uint',a['IsValidInt']='invalid\x20int',a['IsValidU8']='invalid\x20u8',a['IsValidU16']='invalid\x20u16',a['IsValidU32']='invalid\x20u32',a['IsValidU64']='invalid\x20u64',a['IsValidU128']='invalid\x20u128',a['IsValidU256']='invalid\x20u256',a['IsValidRate']='invalid\x20rate[0-10000]',a['IsValidArray']='invalid\x20array',a['IsValidObjects']='invalid\x20objects',a['AllInvalid']='one\x20valid\x20at\x20least',a['InvalidParam']='invalid\x20parameter',a['IsValidPermissionIndex']='invalid\x20permission\x20index',a['IsValidKey']='invalid\x20key',a['Fail']='fail',a['IsValidIdentifier']='identifier\x20invalid',a['IsValidHttpUrl']='invalid\x20url',a['IsValidBizPermissionIndex']='invalid\x20biz-permission\x20id[1000\x20-\x2065535]',a['BcsTypeInvalid']='invalid\x20bcs\x20type',a['IsValidServiceItemName']='invalid\x20service\x20item\x20name',a['IsValidCoinType']='not\x20the\x20coin\x20type',a['IsValidGuardIdentifier']='guard\x20identifier\x20invalid',a['NoPermission']='no\x20permission',a['IsValidValue']='invalid\x20value',a['IsValidValueType']='invalid\x20value\x20type',a['IsValidLocation']='invalid\x20location',a['NetworkInvalid']='protocol\x20network\x20not\x20specified',a['WitnessTypeInvalid']='witness\x20type\x20invalid',a['AddressCountExceeded']='address\x20count\x20exceeded',a['NumberCountExceeded']='number\x20count\x20exceeded',a['NewGuardCheckFailed']='new\x20guard\x20check\x20failed',a['GuardTableItemLengthExceeded']='guard\x20table\x20item\x20length\x20exceeded',a['AccountPersistentStorageNotSet']='account\x20persistent\x20storage\x20not\x20set',a['AccountPersistentStorageNotFound']='account\x20persistent\x20storage\x20not\x20found',a['AccountNameExist']='account\x20name\x20exist',a['ConfigPersistentStorageNotSet']='config\x20persistent\x20storage\x20not\x20set',a['TokenNotFoundLocally']='token\x20not\x20found',a['LocalMarkNameExist']='local\x20mark\x20name\x20exist',a['MaxObjectsPerQuery']='max\x20objects\x20per\x20query',a['ResourceTagCountExceeded']='resource\x20tag\x20count\x20exceeded',a['ParseObjectContentFailed']='parse\x20object\x20content\x20failed';}(WErrors||(WErrors={})));export class WException extends Error{['code'];['details'];constructor(a,b){const c=a['toString']()+(b?':'+b:'');super(c),this['code']=a,this['details']=b,Object['setPrototypeOf'](this,WException['prototype']);}['getErrorMessage'](){return this['message'];}['getErrorCode'](){return this['code'];}['getDetails'](){return this['details'];}}export const W_ERROR=(a,b)=>{throw new WException(a,b);};export const W_SUCCESS=a=>({'success':!![],'data':a});export const W_FAILURE=(a,b)=>({'success':![],'error':new WException(a,b)});export function WValidate(a){return function(...b){try{return a['apply'](this,b);}catch(c){if(c instanceof WException)throw c;throw new WException(WErrors['Fail'],c);}};}export const W_SAFE=(a,b,c)=>{try{const d=a();return W_SUCCESS(d);}catch(e){if(e instanceof WException)return W_FAILURE(e['code'],e['details']);return W_FAILURE(b||WErrors['Fail'],c||e);}};export const W_ENSURE=(a,b,c)=>{!a&&W_ERROR(b,c);};export const W_VALIDATE_PARAM=(a,b,c,d)=>{!b(a)&&W_ERROR(c,d);};export const MoveErrors=[{'module':'service','code':0x1,'description':'Maximum\x20sale\x20count\x20exceeded'},{'module':'service','code':0x2,'description':'Maximum\x20repository\x20count\x20exceeded'},{'module':'service','code':0x3,'description':'Maximum\x20arbitration\x20count\x20exceeded'},{'module':'service','code':0x4,'description':'Maximum\x20WIP\x20length\x20exceeded'},{'module':'service','code':0x5,'description':'Maximum\x20WIP\x20hash\x20length\x20exceeded'},{'module':'service','code':0x6,'description':'Service\x20already\x20published'},{'module':'service','code':0x7,'description':'Service\x20not\x20published'},{'module':'service','code':0x8,'description':'Invalid\x20off-on\x20discount\x20rates'},{'module':'service','code':0x9,'description':'Maximum\x20discount\x20count\x20per\x20operation\x20exceeded'},{'module':'service','code':0xa,'description':'Discount\x20not\x20transferable'},{'module':'service','code':0xb,'description':'Discount\x20receiver\x20empty'},{'module':'service','code':0xc,'description':'Discount\x20count\x20empty'},{'module':'service','code':0xd,'description':'Maximum\x20discount\x20receiver\x20per\x20operation\x20exceeded'},{'module':'service','code':0xe,'description':'Maximum\x20total\x20discount\x20count\x20exceeded'},{'module':'service','code':0xf,'description':'Service\x20discount\x20does\x20not\x20match'},{'module':'service','code':0x10,'description':'Stock\x20not\x20enough'},{'module':'service','code':0x11,'description':'Invalid\x20quote'},{'module':'service','code':0x12,'description':'Buyer\x20guard\x20passport\x20required'},{'module':'service','code':0x13,'description':'Service\x20is\x20paused'},{'module':'service','code':0x14,'description':'Coin\x20not\x20enough'},{'module':'service','code':0x15,'description':'Maximum\x20required\x20info\x20size\x20exceeded'},{'module':'service','code':0x16,'description':'Machine\x20does\x20not\x20match'},{'module':'service','code':0x17,'description':'No\x20allocator\x20configured'},{'module':'service','code':0x18,'description':'Compensation\x20withdraw\x20time\x20not\x20enough'},{'module':'service','code':0x19,'description':'Arbitration\x20not\x20set\x20with\x20compensation\x20fund'},{'module':'service','code':0x1a,'description':'Order\x20service\x20does\x20not\x20match'},{'module':'service','code':0x1b,'description':'Compensation\x20does\x20not\x20match'},{'module':'service','code':0x1c,'description':'Maximum\x20reward\x20count\x20exceeded'},{'module':'service','code':0x1d,'description':'Invalid\x20discount\x20type'},{'module':'service','code':0x1e,'description':'Invalid\x20timestamp\x20ms\x20end'},{'module':'service','code':0x1f,'description':'WIP\x20hash\x20not\x20match'},{'module':'service','code':0x20,'description':'Sale\x20item\x20not\x20found'},{'module':'permission','code':0x1,'description':'Not\x20the\x20builder'},{'module':'permission','code':0x2,'description':'Not\x20admin'},{'module':'permission','code':0x3,'description':'Address\x20count\x20in\x20permission\x20exceeded\x20limit'},{'module':'permission','code':0x4,'description':'Permission\x20count\x20exceeded\x20limit'},{'module':'permission','code':0x5,'description':'Permission\x20denied'},{'module':'permission','code':0x6,'description':'Admin\x20count\x20exceeded\x20limit'},{'module':'permission','code':0x7,'description':'Permission\x20index\x20not\x20found'},{'module':'permission','code':0x8,'description':'Permission\x20does\x20not\x20match'},{'module':'permission','code':0x9,'description':'Not\x20user\x20address'},{'module':'passport','code':0x1,'description':'Guard\x20count\x20exceeded\x20limit'},{'module':'passport','code':0x2,'description':'Relies\x20guard\x20not\x20added'},{'module':'passport','code':0x3,'description':'Submission\x20size\x20exceeded\x20limit'},{'module':'passport','code':0x4,'description':'Already\x20verified'},{'module':'passport','code':0x5,'description':'Not\x20verified'},{'module':'passport','code':0x6,'description':'Not\x20impact\x20guard'},{'module':'passport','code':0x7,'description':'Verification\x20failed'},{'module':'passport','code':0x8,'description':'Transaction\x20does\x20not\x20match'},{'module':'passport','code':0x9,'description':'Impact\x20guard\x20not\x20found'},{'module':'passport','code':0xa,'description':'Submission\x20not\x20found'},{'module':'passport','code':0xb,'description':'Digest\x20not\x20match'},{'module':'reward','code':0x1,'description':'Guard\x20locked\x20time\x20not\x20increasing'},{'module':'reward','code':0x2,'description':'Guard\x20expired'},{'module':'reward','code':0x3,'description':'Guard\x20count\x20exceeded\x20limit'},{'module':'reward','code':0x4,'description':'Recipient\x20identifier\x20not\x20address\x20type'},{'module':'reward','code':0x5,'description':'Amount\x20not\x20u64\x20type'},{'module':'reward','code':0x6,'description':'Insufficient\x20balance'},{'module':'reward','code':0x7,'description':'Guard\x20not\x20found'},{'module':'reward','code':0x8,'description':'Record\x20count\x20exceeded\x20limit'},{'module':'reward','code':0xa,'description':'Invalid\x20guard\x20locked\x20time'},{'module':'reward','code':0xb,'description':'Guard\x20locked\x20time\x20invalid'},{'module':'reward','code':0xc,'description':'Store\x20from\x20ID\x20not\x20compatible'},{'module':'arbitration','code':0x1,'description':'Guard\x20identifier\x20not\x20number\x20type'},{'module':'arbitration','code':0x2,'description':'Voting\x20guard\x20already\x20used'},{'module':'arbitration','code':0x3,'description':'Arbitration\x20does\x20not\x20match'},{'module':'arbitration','code':0x4,'description':'Arbitration\x20is\x20paused'},{'module':'arbitration','code':0x5,'description':'Fee\x20not\x20enough'},{'module':'arbitration','code':0x6,'description':'Passport\x20required'},{'module':'arbitration','code':0x7,'description':'Guard\x20identifier\x20number\x20invalid'},{'module':'arbitration','code':0x8,'description':'Voting\x20guard\x20not\x20found'},{'module':'arbitration','code':0x9,'description':'Maximum\x20voting\x20guard\x20count\x20exceeded'},{'module':'demand','code':0x1,'description':'Maximum\x20reward\x20count\x20exceeded'},{'module':'demand','code':0x2,'description':'Maximum\x20guard\x20count\x20exceeded'},{'module':'demand','code':0x3,'description':'Passport\x20required'},{'module':'demand','code':0x4,'description':'Guard\x20not\x20found'},{'module':'progress','code':0x1,'description':'Maximum\x20context\x20repository\x20count\x20exceeded'},{'module':'progress','code':0x2,'description':'Maximum\x20named\x20operator\x20count\x20exceeded'},{'module':'progress','code':0x3,'description':'Maximum\x20named\x20operator\x20address\x20count\x20exceeded'},{'module':'progress','code':0x4,'description':'Machine\x20does\x20not\x20match'},{'module':'progress','code':0x5,'description':'Task\x20already\x20set'},{'module':'progress','code':0x6,'description':'Not\x20the\x20holder'},{'module':'progress','code':0x7,'description':'Forward\x20already\x20accomplished'},{'module':'progress','code':0x8,'description':'Permission\x20not\x20defined\x20when\x20hold'},{'module':'progress','code':0x9,'description':'Passport\x20required'},{'module':'progress','code':0xa,'description':'Order\x20does\x20not\x20match'},{'module':'guard','code':0x1,'description':'Input\x20empty'},{'module':'guard','code':0x2,'description':'Input\x20size\x20exceeded\x20limit'},{'module':'guard','code':0x3,'description':'Table\x20size\x20exceeded\x20limit'},{'module':'guard','code':0x5,'description':'Dependent\x20count\x20exceeded\x20limit'},{'module':'guard','code':0x6,'description':'Not\x20dependent\x20guard'},{'module':'guard','code':0x7,'description':'Guard\x20cannot\x20depend\x20on\x20itself'},{'module':'guard','code':0x8,'description':'Guard\x20IDs\x20parse\x20error'},{'module':'guard','code':0x9,'description':'Guard\x20IDs\x20type\x20error'},{'module':'guard','code':0xa,'description':'ID\x20value\x20count\x20not\x20equal\x20to\x20guard\x20count'},{'module':'guard','code':0xb,'description':'Submission\x20ID\x20not\x20found'},{'module':'guard','code':0xc,'description':'Submission\x20value\x20type\x20error'},{'module':'order','code':0x1,'description':'Not\x20the\x20owner'},{'module':'order','code':0x2,'description':'Maximum\x20agent\x20count\x20exceeded'},{'module':'order','code':0x3,'description':'Progress\x20not\x20specified'},{'module':'order','code':0x5,'description':'No\x20operation\x20permission'},{'module':'order','code':0x6,'description':'Maximum\x20dispute\x20count\x20exceeded'},{'module':'order','code':0x7,'description':'Order\x20already\x20claimed'},{'module':'order','code':0x8,'description':'Invalid\x20customer\x20info'},{'module':'order','code':0x9,'description':'Allocation\x20not\x20specified'},{'module':'order','code':0xa,'description':'Allocation\x20already\x20specified'},{'module':'order','code':0xb,'description':'Progress\x20already\x20specified'},{'module':'machine','code':0x1,'description':'Maximum\x20consensus\x20repositories\x20exceeded'},{'module':'machine','code':0x2,'description':'Machine\x20not\x20published'},{'module':'machine','code':0x3,'description':'Machine\x20already\x20published'},{'module':'machine','code':0x4,'description':'Maximum\x20forward\x20order\x20count\x20exceeded'},{'module':'machine','code':0x5,'description':'Maximum\x20node\x20count\x20exceeded'},{'module':'machine','code':0x6,'description':'Duplicate\x20forward\x20name'},{'module':'machine','code':0x7,'description':'Duplicate\x20node\x20previous'},{'module':'machine','code':0x8,'description':'Old\x20node\x20name\x20does\x20not\x20exist'},{'module':'machine','code':0x9,'description':'New\x20node\x20name\x20already\x20exists'},{'module':'machine','code':0xa,'description':'Node\x20not\x20found'},{'module':'machine','code':0xb,'description':'Machine\x20is\x20paused'},{'module':'machine','code':0xc,'description':'Retained\x20submission\x20error'},{'module':'machine','code':0xd,'description':'Info\x20not\x20found'},{'module':'machine','code':0xe,'description':'Permission\x20not\x20defined'},{'module':'machine','code':0xf,'description':'Maximum\x20node\x20pair\x20count\x20exceeded'},{'module':'machine','code':0x10,'description':'Maximum\x20forward\x20count\x20exceeded'},{'module':'treasury','code':0x1,'description':'Maximum\x20external\x20deposit\x20guard\x20count\x20exceeded'},{'module':'treasury','code':0x2,'description':'Maximum\x20external\x20withdraw\x20guard\x20count\x20exceeded'},{'module':'treasury','code':0x3,'description':'External\x20deposit\x20guard\x20not\x20found'},{'module':'treasury','code':0x4,'description':'External\x20withdraw\x20guard\x20not\x20found'},{'module':'treasury','code':0x5,'description':'Identifier\x20not\x20number\x20type'},{'module':'treasury','code':0x6,'description':'Deposit\x20insufficient\x20amount'},{'module':'treasury','code':0x7,'description':'Withdraw\x20insufficient\x20amount'},{'module':'treasury','code':0x8,'description':'Store\x20from\x20ID\x20not\x20compatible'},{'module':'arb','code':0x1,'description':'Maximum\x20proposition\x20count\x20exceeded'},{'module':'arb','code':0x2,'description':'Arbitration\x20order\x20does\x20not\x20match'},{'module':'arb','code':0x3,'description':'Status\x20does\x20not\x20match'},{'module':'arb','code':0x4,'description':'Voting\x20deadline\x20not\x20passed'},{'module':'arb','code':0x5,'description':'Proposition\x20not\x20found'},{'module':'arb','code':0x6,'description':'Maximum\x20voter\x20count\x20exceeded'},{'module':'arb','code':0x7,'description':'Voting\x20deadline\x20passed'},{'module':'arb','code':0x8,'description':'Withdraw\x20duration\x20time\x20not\x20passed'},{'module':'repository','code':0x1,'description':'Policy\x20description\x20length\x20exceeded'},{'module':'repository','code':0x2,'description':'Policy\x20guard\x20count\x20exceeded'},{'module':'repository','code':0x3,'description':'Policy\x20count\x20exceeded'},{'module':'repository','code':0x4,'description':'Data\x20size\x20exceeded\x20limit'},{'module':'repository','code':0x5,'description':'ID\x20count\x20exceeded\x20limit'},{'module':'repository','code':0x6,'description':'Quantities\x20not\x20equal'},{'module':'repository','code':0x7,'description':'Policy\x20not\x20found'},{'module':'repository','code':0x8,'description':'Policy\x20ID\x20from\x20none'},{'module':'repository','code':0x9,'description':'Passport\x20required'},{'module':'repository','code':0xa,'description':'Data\x20type\x20does\x20not\x20match'},{'module':'repository','code':0xb,'description':'Guard\x20specified\x20ID\x20from\x20submission'},{'module':'repository','code':0xc,'description':'Not\x20impact\x20guard\x20in\x20passport'},{'module':'repository','code':0xd,'description':'Guard\x20specified\x20not\x20in\x20policy'},{'module':'repository','code':0xe,'description':'ID\x20vector\x20not\x20enough'},{'module':'repository','code':0xf,'description':'Data\x20vector\x20not\x20enough'},{'module':'repository','code':0x10,'description':'Invalid\x20ID\x20in\x20guard\x20table'},{'module':'repository','code':0x11,'description':'Invalid\x20data\x20in\x20guard\x20table'},{'module':'repository','code':0x12,'description':'Invalid\x20ID\x20from'},{'module':'repository','code':0x13,'description':'Maximum\x20reward\x20count\x20exceeded'},{'module':'repository','code':0x14,'description':'Guard\x20not\x20specified\x20ID\x20from\x20submission'},{'module':'repository','code':0x15,'description':'Need\x20dependent\x20guard'},{'module':'common','code':0x1,'description':'Name\x20length\x20exceeded\x20limit'},{'module':'common','code':0x2,'description':'Name\x20is\x20empty'},{'module':'common','code':0x3,'description':'Description\x20length\x20exceeded\x20limit'},{'module':'common','code':0x6,'description':'Invalid\x20value\x20type'},{'module':'common','code':0x7,'description':'Address\x20type\x20does\x20not\x20match'},{'module':'common','code':0x8,'description':'Number\x20type\x20does\x20not\x20match'},{'module':'common','code':0x9,'description':'Invalid\x20data\x20value'},{'module':'common','code':0xa,'description':'Invalid\x20string\x20value'},{'module':'common','code':0xb,'description':'Long\x20name\x20length\x20exceeded\x20limit'},{'module':'common','code':0xc,'description':'Not\x20u64\x20type'},{'module':'common','code':0xd,'description':'Invalid\x20service\x20object\x20type'},{'module':'resource','code':0x1,'description':'Tags\x20count\x20exceeded\x20limit'},{'module':'allocation','code':0x1,'description':'Recipient\x20identifier\x20not\x20address\x20type'},{'module':'allocation','code':0x2,'description':'Allocator\x20count\x20exceeded'},{'module':'allocation','code':0x3,'description':'No\x20allocator'},{'module':'allocation','code':0x4,'description':'Rate\x20not\x2010000'},{'module':'allocation','code':0x5,'description':'Multiple\x20surplus'},{'module':'allocation','code':0x6,'description':'Rate\x20exceeds\x2010000'},{'module':'allocation','code':0x7,'description':'Insufficient\x20balance'},{'module':'allocation','code':0x8,'description':'Allocators\x20empty'},{'module':'allocation','code':0x9,'description':'No\x20payment\x20info'},{'module':'allocation','code':0xa,'description':'Sharing\x20count\x20exceeded'},{'module':'allocation','code':0xb,'description':'Sharing\x20mode\x20invalid'},{'module':'allocation','code':0xc,'description':'Amount\x20below\x20threshold'},{'module':'allocation','code':0xd,'description':'Amount\x20exceeds\x20max'},{'module':'proof','code':0x1,'description':'Maximum\x20proof\x20size\x20exceeded'},{'module':'proof','code':0x2,'description':'Maximum\x20server\x20pubkey\x20size\x20exceeded'},{'module':'proof','code':0x3,'description':'Maximum\x20server\x20signature\x20size\x20exceeded'},{'module':'payment','code':0x1,'description':'Recipient\x20count\x20exceeded'},{'module':'payment','code':0x2,'description':'Vector\x20count\x20not\x20equal'},{'module':'payment','code':0x3,'description':'Payment\x20not\x20match'},{'module':'payment','code':0x4,'description':'Recipient\x20empty'},{'module':'contact','code':0x1,'description':'IM\x20count\x20exceeded'},{'module':'registrar','code':0x0,'description':'Not\x20system\x20address'},{'module':'registrar','code':0x1,'description':'Record\x20count\x20exceeded'},{'module':'registrar','code':0x2,'description':'Record\x20length\x20exceeded'},{'module':'registrar','code':0x3,'description':'Record\x20type\x20empty'},{'module':'transfer','code':0x0,'description':'Shared\x20non-new\x20object'},{'module':'transfer','code':0x1,'description':'BCS\x20serialization\x20failure'},{'module':'transfer','code':0x2,'description':'Receiving\x20object\x20type\x20mismatch'},{'module':'transfer','code':0x3,'description':'Unable\x20to\x20receive\x20object'},{'module':'transfer','code':0x4,'description':'Shared\x20object\x20operation\x20not\x20supported'},{'module':'transfer','code':0x5,'description':'Operation\x20not\x20supported'},{'module':'transfer','code':0x6,'description':'Invalid\x20party\x20permissions'},{'module':'tx_context','code':0x0,'description':'Bad\x20transaction\x20hash\x20length'},{'module':'coin','code':0x0,'description':'Bad\x20witness'},{'module':'coin','code':0x1,'description':'Invalid\x20argument'},{'module':'coin','code':0x2,'description':'Not\x20enough\x20balance'},{'module':'coin','code':0x3,'description':'Global\x20pause\x20not\x20allowed'},{'module':'borrow','code':0x0,'description':'Wrong\x20borrow'},{'module':'borrow','code':0x1,'description':'Wrong\x20value'},{'module':'bcs','code':0x0,'description':'Out\x20of\x20range'},{'module':'bcs','code':0x1,'description':'Not\x20bool'},{'module':'bcs','code':0x2,'description':'Length\x20out\x20of\x20range'},{'module':'balance','code':0x0,'description':'Non-zero\x20balance'},{'module':'balance','code':0x1,'description':'Overflow'},{'module':'balance','code':0x2,'description':'Not\x20enough'},{'module':'balance','code':0x3,'description':'Not\x20system\x20address'},{'module':'balance','code':0x4,'description':'Not\x20WOW'},{'module':'parent_table','code':0x0,'description':'Parent\x20table\x20not\x20match'},{'module':'parent_table_vec','code':0x0,'description':'Index\x20out\x20of\x20bound'},{'module':'parent_linked_table','code':0x0,'description':'Table\x20is\x20empty'},{'module':'parent_linked_table','code':0x1,'description':'Table\x20not\x20match'}];export function getMoveErrorDescription(a,b){const c=MoveErrors['find'](d=>d['module']===a&&d['code']===b);return c?c['description']:null;}export function enrichMoveError(a){if(!a||typeof a!=='string')return a;const b=/MoveAbort\([^,]+,\s*(\d+)\)/,c=/name:\s*Identifier\("([^"]+)"\)/,d=/address:\s*([0-9a-fA-Fx]+)/,e=a['match'](b),f=a['match'](c),g=a['match'](d),h='0x0000000000000000000000000000000000000000000000000000000000000002';if(e&&f&&g){const i=parseInt(e[0x1],0xa),j=f[0x1]['toLowerCase'](),k=g[0x1]['toLowerCase']();if(k===h||k==='0x2'){const l=MoveErrors['find'](m=>m['module']['toLowerCase']()===j&&m['code']===i);if(l)return'Error\x20Description:\x20'+l['description']+'\x0a'+a;}}return a;}
|
|
1
|
+
export var WErrors;(function(a){a['AccountNotFound']='account\x20not\x20found',a['AddressNotFound']='address\x20not\x20found',a['IsValidDescription']='invalid\x20description',a['IsValidName']='invalid\x20name',a['IsValidName_AllowEmpty']='invalid\x20name',a['IsValidEndpoint']='invalid\x20endpoint',a['IsValidAddress']='invalid\x20address',a['IsValidArgType']='invalid\x20argument\x20type',a['IsValidTokenType']='invalid\x20token\x20type',a['IsValidUint']='invalid\x20uint',a['IsValidInt']='invalid\x20int',a['IsValidU8']='invalid\x20u8',a['IsValidU16']='invalid\x20u16',a['IsValidU32']='invalid\x20u32',a['IsValidU64']='invalid\x20u64',a['IsValidU128']='invalid\x20u128',a['IsValidU256']='invalid\x20u256',a['IsValidRate']='invalid\x20rate[0-10000]',a['IsValidArray']='invalid\x20array',a['IsValidObjects']='invalid\x20objects',a['AllInvalid']='one\x20valid\x20at\x20least',a['InvalidParam']='invalid\x20parameter',a['IsValidPermissionIndex']='invalid\x20permission\x20index',a['IsValidKey']='invalid\x20key',a['Fail']='fail',a['IsValidIdentifier']='identifier\x20invalid',a['IsValidHttpUrl']='invalid\x20url',a['IsValidBizPermissionIndex']='invalid\x20biz-permission\x20id[1000\x20-\x2065535]',a['BcsTypeInvalid']='invalid\x20bcs\x20type',a['IsValidServiceItemName']='invalid\x20service\x20item\x20name',a['IsValidCoinType']='not\x20the\x20coin\x20type',a['IsValidGuardIdentifier']='guard\x20identifier\x20invalid',a['NoPermission']='no\x20permission',a['IsValidValue']='invalid\x20value',a['IsValidValueType']='invalid\x20value\x20type',a['IsValidLocation']='invalid\x20location',a['NetworkInvalid']='protocol\x20network\x20not\x20specified',a['WitnessTypeInvalid']='witness\x20type\x20invalid',a['AddressCountExceeded']='address\x20count\x20exceeded',a['NumberCountExceeded']='number\x20count\x20exceeded',a['NewGuardCheckFailed']='new\x20guard\x20check\x20failed',a['GuardTableItemLengthExceeded']='guard\x20table\x20item\x20length\x20exceeded',a['AccountPersistentStorageNotSet']='account\x20persistent\x20storage\x20not\x20set',a['AccountPersistentStorageNotFound']='account\x20persistent\x20storage\x20not\x20found',a['AccountNameExist']='account\x20name\x20exist',a['ConfigPersistentStorageNotSet']='config\x20persistent\x20storage\x20not\x20set',a['TokenNotFoundLocally']='token\x20not\x20found',a['LocalMarkNameExist']='local\x20mark\x20name\x20exist',a['MaxObjectsPerQuery']='max\x20objects\x20per\x20query',a['ResourceTagCountExceeded']='resource\x20tag\x20count\x20exceeded',a['ParseObjectContentFailed']='parse\x20object\x20content\x20failed';}(WErrors||(WErrors={})));export class WException extends Error{['code'];['details'];constructor(a,b){const c=a['toString']()+(b?':'+b:'');super(c),this['code']=a,this['details']=b,Object['setPrototypeOf'](this,WException['prototype']);}['getErrorMessage'](){return this['message'];}['getErrorCode'](){return this['code'];}['getDetails'](){return this['details'];}}export const W_ERROR=(a,b)=>{throw new WException(a,b);};export const W_SUCCESS=a=>({'success':!![],'data':a});export const W_FAILURE=(a,b)=>({'success':![],'error':new WException(a,b)});export function WValidate(a){return function(...b){try{return a['apply'](this,b);}catch(c){if(c instanceof WException)throw c;throw new WException(WErrors['Fail'],c);}};}export const W_SAFE=(a,b,c)=>{try{const d=a();return W_SUCCESS(d);}catch(e){if(e instanceof WException)return W_FAILURE(e['code'],e['details']);return W_FAILURE(b||WErrors['Fail'],c||e);}};export const W_ENSURE=(a,b,c)=>{!a&&W_ERROR(b,c);};export const W_VALIDATE_PARAM=(a,b,c,d)=>{!b(a)&&W_ERROR(c,d);};export const MoveErrors=[{'module':'service','code':0x1,'description':'Maximum\x20sale\x20count\x20exceeded'},{'module':'service','code':0x2,'description':'Maximum\x20repository\x20count\x20exceeded'},{'module':'service','code':0x3,'description':'Maximum\x20arbitration\x20count\x20exceeded'},{'module':'service','code':0x4,'description':'Maximum\x20WIP\x20length\x20exceeded'},{'module':'service','code':0x5,'description':'Maximum\x20WIP\x20hash\x20length\x20exceeded'},{'module':'service','code':0x6,'description':'Service\x20already\x20published'},{'module':'service','code':0x7,'description':'Service\x20not\x20published'},{'module':'service','code':0x8,'description':'Invalid\x20off-on\x20discount\x20rates'},{'module':'service','code':0x9,'description':'Maximum\x20discount\x20count\x20per\x20operation\x20exceeded'},{'module':'service','code':0xa,'description':'Discount\x20not\x20transferable'},{'module':'service','code':0xb,'description':'Discount\x20receiver\x20empty'},{'module':'service','code':0xc,'description':'Discount\x20count\x20empty'},{'module':'service','code':0xd,'description':'Maximum\x20discount\x20receiver\x20per\x20operation\x20exceeded'},{'module':'service','code':0xe,'description':'Maximum\x20total\x20discount\x20count\x20exceeded'},{'module':'service','code':0xf,'description':'Service\x20discount\x20does\x20not\x20match'},{'module':'service','code':0x10,'description':'Stock\x20not\x20enough'},{'module':'service','code':0x11,'description':'Invalid\x20quote'},{'module':'service','code':0x12,'description':'Buyer\x20guard\x20passport\x20required'},{'module':'service','code':0x13,'description':'Service\x20is\x20paused'},{'module':'service','code':0x14,'description':'Coin\x20not\x20enough'},{'module':'service','code':0x15,'description':'Maximum\x20required\x20info\x20size\x20exceeded'},{'module':'service','code':0x16,'description':'Machine\x20does\x20not\x20match'},{'module':'service','code':0x17,'description':'No\x20allocator\x20configured'},{'module':'service','code':0x18,'description':'Critical\x20setting\x20lock\x20duration\x20not\x20exceeded.\x20After\x20Service\x20is\x20published,\x20modifications\x20to\x20\x27order_allocators\x27,\x20\x27rewards\x27,\x20\x27arbitrations\x27,\x20\x27machine\x27,\x20and\x20withdrawal\x20from\x20\x27compensation_fund\x27\x20must\x20exceed\x20the\x20\x27setting_lock_duration\x27\x20lock\x20time'},{'module':'service','code':0x19,'description':'Arbitration\x20not\x20set\x20with\x20compensation\x20fund'},{'module':'service','code':0x1a,'description':'Order\x20service\x20does\x20not\x20match'},{'module':'service','code':0x1b,'description':'Compensation\x20does\x20not\x20match'},{'module':'service','code':0x1c,'description':'Maximum\x20reward\x20count\x20exceeded'},{'module':'service','code':0x1d,'description':'Invalid\x20discount\x20type'},{'module':'service','code':0x1e,'description':'Invalid\x20timestamp\x20ms\x20end'},{'module':'service','code':0x1f,'description':'WIP\x20hash\x20not\x20match'},{'module':'service','code':0x20,'description':'Sale\x20item\x20not\x20found'},{'module':'permission','code':0x1,'description':'Not\x20the\x20builder'},{'module':'permission','code':0x2,'description':'Not\x20admin'},{'module':'permission','code':0x3,'description':'Address\x20count\x20in\x20permission\x20exceeded\x20limit'},{'module':'permission','code':0x4,'description':'Permission\x20count\x20exceeded\x20limit'},{'module':'permission','code':0x5,'description':'Permission\x20denied'},{'module':'permission','code':0x6,'description':'Admin\x20count\x20exceeded\x20limit'},{'module':'permission','code':0x7,'description':'Permission\x20index\x20not\x20found'},{'module':'permission','code':0x8,'description':'Permission\x20does\x20not\x20match'},{'module':'permission','code':0x9,'description':'Not\x20user\x20address'},{'module':'passport','code':0x1,'description':'Guard\x20count\x20exceeded\x20limit'},{'module':'passport','code':0x2,'description':'Relies\x20guard\x20not\x20added'},{'module':'passport','code':0x3,'description':'Submission\x20size\x20exceeded\x20limit'},{'module':'passport','code':0x4,'description':'Already\x20verified'},{'module':'passport','code':0x5,'description':'Not\x20verified'},{'module':'passport','code':0x6,'description':'Not\x20impact\x20guard'},{'module':'passport','code':0x7,'description':'Verification\x20failed'},{'module':'passport','code':0x8,'description':'Transaction\x20does\x20not\x20match'},{'module':'passport','code':0x9,'description':'Impact\x20guard\x20not\x20found'},{'module':'passport','code':0xa,'description':'Submission\x20not\x20found'},{'module':'passport','code':0xb,'description':'Digest\x20not\x20match'},{'module':'reward','code':0x1,'description':'Guard\x20locked\x20time\x20not\x20increasing'},{'module':'reward','code':0x2,'description':'Guard\x20expired'},{'module':'reward','code':0x3,'description':'Guard\x20count\x20exceeded\x20limit'},{'module':'reward','code':0x4,'description':'Recipient\x20identifier\x20not\x20address\x20type'},{'module':'reward','code':0x5,'description':'Amount\x20not\x20u64\x20type'},{'module':'reward','code':0x6,'description':'Insufficient\x20balance'},{'module':'reward','code':0x7,'description':'Guard\x20not\x20found'},{'module':'reward','code':0x8,'description':'Record\x20count\x20exceeded\x20limit'},{'module':'reward','code':0xa,'description':'Invalid\x20guard\x20locked\x20time'},{'module':'reward','code':0xb,'description':'Guard\x20locked\x20time\x20invalid'},{'module':'reward','code':0xc,'description':'Store\x20from\x20ID\x20not\x20compatible'},{'module':'arbitration','code':0x1,'description':'Guard\x20identifier\x20not\x20number\x20type'},{'module':'arbitration','code':0x2,'description':'Voting\x20guard\x20already\x20used'},{'module':'arbitration','code':0x3,'description':'Arbitration\x20does\x20not\x20match'},{'module':'arbitration','code':0x4,'description':'Arbitration\x20is\x20paused'},{'module':'arbitration','code':0x5,'description':'Fee\x20not\x20enough'},{'module':'arbitration','code':0x6,'description':'Passport\x20required'},{'module':'arbitration','code':0x7,'description':'Guard\x20identifier\x20number\x20invalid'},{'module':'arbitration','code':0x8,'description':'Voting\x20guard\x20not\x20found'},{'module':'arbitration','code':0x9,'description':'Maximum\x20voting\x20guard\x20count\x20exceeded'},{'module':'demand','code':0x1,'description':'Maximum\x20reward\x20count\x20exceeded'},{'module':'demand','code':0x2,'description':'Maximum\x20guard\x20count\x20exceeded'},{'module':'demand','code':0x3,'description':'Passport\x20required'},{'module':'demand','code':0x4,'description':'Guard\x20not\x20found'},{'module':'progress','code':0x1,'description':'Maximum\x20context\x20repository\x20count\x20exceeded'},{'module':'progress','code':0x2,'description':'Maximum\x20named\x20operator\x20count\x20exceeded'},{'module':'progress','code':0x3,'description':'Maximum\x20named\x20operator\x20address\x20count\x20exceeded'},{'module':'progress','code':0x4,'description':'Machine\x20does\x20not\x20match'},{'module':'progress','code':0x5,'description':'Task\x20already\x20set'},{'module':'progress','code':0x6,'description':'Not\x20the\x20holder'},{'module':'progress','code':0x7,'description':'Forward\x20already\x20accomplished'},{'module':'progress','code':0x8,'description':'Permission\x20not\x20defined\x20when\x20hold'},{'module':'progress','code':0x9,'description':'Passport\x20required'},{'module':'progress','code':0xa,'description':'Order\x20does\x20not\x20match'},{'module':'guard','code':0x1,'description':'Input\x20empty'},{'module':'guard','code':0x2,'description':'Input\x20size\x20exceeded\x20limit'},{'module':'guard','code':0x3,'description':'Table\x20size\x20exceeded\x20limit'},{'module':'guard','code':0x5,'description':'Dependent\x20count\x20exceeded\x20limit'},{'module':'guard','code':0x6,'description':'Not\x20dependent\x20guard'},{'module':'guard','code':0x7,'description':'Guard\x20cannot\x20depend\x20on\x20itself'},{'module':'guard','code':0x8,'description':'Guard\x20IDs\x20parse\x20error'},{'module':'guard','code':0x9,'description':'Guard\x20IDs\x20type\x20error'},{'module':'guard','code':0xa,'description':'ID\x20value\x20count\x20not\x20equal\x20to\x20guard\x20count'},{'module':'guard','code':0xb,'description':'Submission\x20ID\x20not\x20found'},{'module':'guard','code':0xc,'description':'Submission\x20value\x20type\x20error'},{'module':'order','code':0x1,'description':'Not\x20the\x20owner'},{'module':'order','code':0x2,'description':'Maximum\x20agent\x20count\x20exceeded'},{'module':'order','code':0x3,'description':'Progress\x20not\x20specified'},{'module':'order','code':0x5,'description':'No\x20operation\x20permission'},{'module':'order','code':0x6,'description':'Maximum\x20dispute\x20count\x20exceeded'},{'module':'order','code':0x7,'description':'Order\x20already\x20claimed'},{'module':'order','code':0x8,'description':'Invalid\x20customer\x20info'},{'module':'order','code':0x9,'description':'Allocation\x20not\x20specified'},{'module':'order','code':0xa,'description':'Allocation\x20already\x20specified'},{'module':'order','code':0xb,'description':'Progress\x20already\x20specified'},{'module':'machine','code':0x1,'description':'Maximum\x20consensus\x20repositories\x20exceeded'},{'module':'machine','code':0x2,'description':'Machine\x20not\x20published'},{'module':'machine','code':0x3,'description':'Machine\x20already\x20published'},{'module':'machine','code':0x4,'description':'Maximum\x20forward\x20order\x20count\x20exceeded'},{'module':'machine','code':0x5,'description':'Maximum\x20node\x20count\x20exceeded'},{'module':'machine','code':0x6,'description':'Duplicate\x20forward\x20name'},{'module':'machine','code':0x7,'description':'Duplicate\x20node\x20previous'},{'module':'machine','code':0x8,'description':'Old\x20node\x20name\x20does\x20not\x20exist'},{'module':'machine','code':0x9,'description':'New\x20node\x20name\x20already\x20exists'},{'module':'machine','code':0xa,'description':'Node\x20not\x20found'},{'module':'machine','code':0xb,'description':'Machine\x20is\x20paused'},{'module':'machine','code':0xc,'description':'Retained\x20submission\x20error'},{'module':'machine','code':0xd,'description':'Info\x20not\x20found'},{'module':'machine','code':0xe,'description':'Permission\x20not\x20defined'},{'module':'machine','code':0xf,'description':'Maximum\x20node\x20pair\x20count\x20exceeded'},{'module':'machine','code':0x10,'description':'Maximum\x20forward\x20count\x20exceeded'},{'module':'treasury','code':0x1,'description':'Maximum\x20external\x20deposit\x20guard\x20count\x20exceeded'},{'module':'treasury','code':0x2,'description':'Maximum\x20external\x20withdraw\x20guard\x20count\x20exceeded'},{'module':'treasury','code':0x3,'description':'External\x20deposit\x20guard\x20not\x20found'},{'module':'treasury','code':0x4,'description':'External\x20withdraw\x20guard\x20not\x20found'},{'module':'treasury','code':0x5,'description':'Identifier\x20not\x20number\x20type'},{'module':'treasury','code':0x6,'description':'Deposit\x20insufficient\x20amount'},{'module':'treasury','code':0x7,'description':'Withdraw\x20insufficient\x20amount'},{'module':'treasury','code':0x8,'description':'Store\x20from\x20ID\x20not\x20compatible'},{'module':'arb','code':0x1,'description':'Maximum\x20proposition\x20count\x20exceeded'},{'module':'arb','code':0x2,'description':'Arbitration\x20order\x20does\x20not\x20match'},{'module':'arb','code':0x3,'description':'Status\x20does\x20not\x20match'},{'module':'arb','code':0x4,'description':'Voting\x20deadline\x20not\x20passed'},{'module':'arb','code':0x5,'description':'Proposition\x20not\x20found'},{'module':'arb','code':0x6,'description':'Maximum\x20voter\x20count\x20exceeded'},{'module':'arb','code':0x7,'description':'Voting\x20deadline\x20passed'},{'module':'arb','code':0x8,'description':'Withdraw\x20duration\x20time\x20not\x20passed'},{'module':'repository','code':0x1,'description':'Policy\x20description\x20length\x20exceeded'},{'module':'repository','code':0x2,'description':'Policy\x20guard\x20count\x20exceeded'},{'module':'repository','code':0x3,'description':'Policy\x20count\x20exceeded'},{'module':'repository','code':0x4,'description':'Data\x20size\x20exceeded\x20limit'},{'module':'repository','code':0x5,'description':'ID\x20count\x20exceeded\x20limit'},{'module':'repository','code':0x6,'description':'Quantities\x20not\x20equal'},{'module':'repository','code':0x7,'description':'Policy\x20not\x20found'},{'module':'repository','code':0x8,'description':'Policy\x20ID\x20from\x20none'},{'module':'repository','code':0x9,'description':'Passport\x20required'},{'module':'repository','code':0xa,'description':'Data\x20type\x20does\x20not\x20match'},{'module':'repository','code':0xb,'description':'Guard\x20specified\x20ID\x20from\x20submission'},{'module':'repository','code':0xc,'description':'Not\x20impact\x20guard\x20in\x20passport'},{'module':'repository','code':0xd,'description':'Guard\x20specified\x20not\x20in\x20policy'},{'module':'repository','code':0xe,'description':'ID\x20vector\x20not\x20enough'},{'module':'repository','code':0xf,'description':'Data\x20vector\x20not\x20enough'},{'module':'repository','code':0x10,'description':'Invalid\x20ID\x20in\x20guard\x20table'},{'module':'repository','code':0x11,'description':'Invalid\x20data\x20in\x20guard\x20table'},{'module':'repository','code':0x12,'description':'Invalid\x20ID\x20from'},{'module':'repository','code':0x13,'description':'Maximum\x20reward\x20count\x20exceeded'},{'module':'repository','code':0x14,'description':'Guard\x20not\x20specified\x20ID\x20from\x20submission'},{'module':'repository','code':0x15,'description':'Need\x20dependent\x20guard'},{'module':'common','code':0x1,'description':'Name\x20length\x20exceeded\x20limit'},{'module':'common','code':0x2,'description':'Name\x20is\x20empty'},{'module':'common','code':0x3,'description':'Description\x20length\x20exceeded\x20limit'},{'module':'common','code':0x6,'description':'Invalid\x20value\x20type'},{'module':'common','code':0x7,'description':'Address\x20type\x20does\x20not\x20match'},{'module':'common','code':0x8,'description':'Number\x20type\x20does\x20not\x20match'},{'module':'common','code':0x9,'description':'Invalid\x20data\x20value'},{'module':'common','code':0xa,'description':'Invalid\x20string\x20value'},{'module':'common','code':0xb,'description':'Long\x20name\x20length\x20exceeded\x20limit'},{'module':'common','code':0xc,'description':'Not\x20u64\x20type'},{'module':'common','code':0xd,'description':'Invalid\x20service\x20object\x20type'},{'module':'resource','code':0x1,'description':'Tags\x20count\x20exceeded\x20limit'},{'module':'allocation','code':0x1,'description':'Recipient\x20identifier\x20not\x20address\x20type'},{'module':'allocation','code':0x2,'description':'Allocator\x20count\x20exceeded'},{'module':'allocation','code':0x3,'description':'No\x20allocator'},{'module':'allocation','code':0x4,'description':'Rate\x20not\x2010000'},{'module':'allocation','code':0x5,'description':'Multiple\x20surplus'},{'module':'allocation','code':0x6,'description':'Rate\x20exceeds\x2010000'},{'module':'allocation','code':0x7,'description':'Insufficient\x20balance'},{'module':'allocation','code':0x8,'description':'Allocators\x20empty'},{'module':'allocation','code':0x9,'description':'No\x20payment\x20info'},{'module':'allocation','code':0xa,'description':'Sharing\x20count\x20exceeded'},{'module':'allocation','code':0xb,'description':'Sharing\x20mode\x20invalid'},{'module':'allocation','code':0xc,'description':'Amount\x20below\x20threshold'},{'module':'allocation','code':0xd,'description':'Amount\x20exceeds\x20max'},{'module':'proof','code':0x1,'description':'Maximum\x20proof\x20size\x20exceeded'},{'module':'proof','code':0x2,'description':'Maximum\x20server\x20pubkey\x20size\x20exceeded'},{'module':'proof','code':0x3,'description':'Maximum\x20server\x20signature\x20size\x20exceeded'},{'module':'payment','code':0x1,'description':'Recipient\x20count\x20exceeded'},{'module':'payment','code':0x2,'description':'Vector\x20count\x20not\x20equal'},{'module':'payment','code':0x3,'description':'Payment\x20not\x20match'},{'module':'payment','code':0x4,'description':'Recipient\x20empty'},{'module':'contact','code':0x1,'description':'IM\x20count\x20exceeded'},{'module':'registrar','code':0x0,'description':'Not\x20system\x20address'},{'module':'registrar','code':0x1,'description':'Record\x20count\x20exceeded'},{'module':'registrar','code':0x2,'description':'Record\x20length\x20exceeded'},{'module':'registrar','code':0x3,'description':'Record\x20type\x20empty'},{'module':'transfer','code':0x0,'description':'Shared\x20non-new\x20object'},{'module':'transfer','code':0x1,'description':'BCS\x20serialization\x20failure'},{'module':'transfer','code':0x2,'description':'Receiving\x20object\x20type\x20mismatch'},{'module':'transfer','code':0x3,'description':'Unable\x20to\x20receive\x20object'},{'module':'transfer','code':0x4,'description':'Shared\x20object\x20operation\x20not\x20supported'},{'module':'transfer','code':0x5,'description':'Operation\x20not\x20supported'},{'module':'transfer','code':0x6,'description':'Invalid\x20party\x20permissions'},{'module':'tx_context','code':0x0,'description':'Bad\x20transaction\x20hash\x20length'},{'module':'coin','code':0x0,'description':'Bad\x20witness'},{'module':'coin','code':0x1,'description':'Invalid\x20argument'},{'module':'coin','code':0x2,'description':'Not\x20enough\x20balance'},{'module':'coin','code':0x3,'description':'Global\x20pause\x20not\x20allowed'},{'module':'borrow','code':0x0,'description':'Wrong\x20borrow'},{'module':'borrow','code':0x1,'description':'Wrong\x20value'},{'module':'bcs','code':0x0,'description':'Out\x20of\x20range'},{'module':'bcs','code':0x1,'description':'Not\x20bool'},{'module':'bcs','code':0x2,'description':'Length\x20out\x20of\x20range'},{'module':'balance','code':0x0,'description':'Non-zero\x20balance'},{'module':'balance','code':0x1,'description':'Overflow'},{'module':'balance','code':0x2,'description':'Not\x20enough'},{'module':'balance','code':0x3,'description':'Not\x20system\x20address'},{'module':'balance','code':0x4,'description':'Not\x20WOW'},{'module':'parent_table','code':0x0,'description':'Parent\x20table\x20not\x20match'},{'module':'parent_table_vec','code':0x0,'description':'Index\x20out\x20of\x20bound'},{'module':'parent_linked_table','code':0x0,'description':'Table\x20is\x20empty'},{'module':'parent_linked_table','code':0x1,'description':'Table\x20not\x20match'}];export function getMoveErrorDescription(a,b){const c=MoveErrors['find'](d=>d['module']===a&&d['code']===b);return c?c['description']:null;}export function enrichMoveError(a){if(!a||typeof a!=='string')return a;const b=/MoveAbort\([^,]+,\s*(\d+)\)/,c=/name:\s*Identifier\("([^"]+)"\)/,d=/address:\s*([0-9a-fA-Fx]+)/,e=a['match'](b),f=a['match'](c),g=a['match'](d),h='0x0000000000000000000000000000000000000000000000000000000000000002';if(e&&f&&g){const i=parseInt(e[0x1],0xa),j=f[0x1]['toLowerCase'](),k=g[0x1]['toLowerCase']();if(k===h||k==='0x2'){const l=MoveErrors['find'](m=>m['module']['toLowerCase']()===j&&m['code']===i);if(l)return'Error\x20Description:\x20'+l['description']+'\x0a'+a;}}return a;}
|
|
@@ -202,7 +202,7 @@ export interface ObjectService extends ObjectBase {
|
|
|
202
202
|
arbitrations: string[];
|
|
203
203
|
compensation_fund: BalanceType;
|
|
204
204
|
paused_time: number | null;
|
|
205
|
-
|
|
205
|
+
setting_lock_duration: string | number | bigint;
|
|
206
206
|
order_allocators: Allocators | null;
|
|
207
207
|
rewards: string[];
|
|
208
208
|
um: string | null;
|