wowok_agent
Version:
Create, collaborate, and transact on your own terms with the AI-driven web3 collaboration protocol.
1 lines • 34.1 kB
JavaScript
"use strict";(this.webpackChunkwowok_agent=this.webpackChunkwowok_agent||[]).push([[253],{3499:(t,s,e)=>{e.d(s,{P_:()=>i,bU:()=>r,kl:()=>h});var i,r,a=e(1609),n=e(9554),o=e(5337);!function(t){t[t.ratio=0]="ratio",t[t.minus=1]="minus"}(i||(i={})),function(t){t.address="address",t.phone="phone",t.name="name",t.postcode="postcode"}(r||(r={}));class h{pay_token_type;permission;object;txb;get_pay_type(){return this.pay_token_type}get_object(){return this.object}constructor(t,s,e){this.pay_token_type=s,this.txb=t,this.permission=e,this.object=""}static From(t,s,e,i){let r=new h(t,s,e);return r.object=n.Zs.TXB_OBJECT(t,i),r}static New(t,s,e,i,r,_){n.Zs.IsValidObjects([e,r])||(0,o.f)(o.I.IsValidObjects),(0,a.MA)(s)||(0,o.f)(o.I.IsValidTokenType,"New: pay_token_type"),(0,a.yW)(i)||(0,o.f)(o.I.IsValidDesription);let p=s,b=new h(t,p,e);return b.object=_?t.moveCall({target:n.Zs.Instance().serviceFn("new_with_passport"),arguments:[_,t.pure.string(i),t.object(r),n.Zs.TXB_OBJECT(t,e)],typeArguments:[p]}):t.moveCall({target:n.Zs.Instance().serviceFn("new"),arguments:[t.pure.string(i),t.object(r),n.Zs.TXB_OBJECT(t,e)],typeArguments:[p]}),b}launch(){return this.txb.moveCall({target:n.Zs.Instance().serviceFn("create"),arguments:[n.Zs.TXB_OBJECT(this.txb,this.object)],typeArguments:[this.pay_token_type]})}set_description(t,s){(0,a.yW)(t)||(0,o.f)(o.I.IsValidDesription),s?this.txb.moveCall({target:n.Zs.Instance().serviceFn("description_set_with_passport"),arguments:[s,n.Zs.TXB_OBJECT(this.txb,this.object),this.txb.pure.string(t),n.Zs.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]}):this.txb.moveCall({target:n.Zs.Instance().serviceFn("description_set"),arguments:[n.Zs.TXB_OBJECT(this.txb,this.object),this.txb.pure.string(t),n.Zs.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]})}set_price(t,s,e=!0,i){(0,a.Ec)(s)||(0,o.f)(o.I.IsValidU64,"set_price price"),h.IsValidItemName(t)||(0,o.f)(o.I.IsValidServiceItemName,"set_price item"),i?this.txb.moveCall({target:n.Zs.Instance().serviceFn("price_set_with_passport"),arguments:[i,n.Zs.TXB_OBJECT(this.txb,this.object),this.txb.pure.string(t),this.txb.pure.u64(s),this.txb.pure.bool(e),n.Zs.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]}):this.txb.moveCall({target:n.Zs.Instance().serviceFn("price_set"),arguments:[n.Zs.TXB_OBJECT(this.txb,this.object),this.txb.pure.string(t),this.txb.pure.u64(s),this.txb.pure.bool(e),n.Zs.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]})}set_stock(t,s,e=!0,i){h.IsValidItemName(t)||(0,o.f)(o.I.IsValidServiceItemName,"item"),(0,a.Ec)(s)||(0,o.f)(o.I.IsValidU64,"stock"),i?this.txb.moveCall({target:n.Zs.Instance().serviceFn("stock_set_with_passport"),arguments:[i,n.Zs.TXB_OBJECT(this.txb,this.object),this.txb.pure.string(t),this.txb.pure.u64(s),this.txb.pure.bool(e),n.Zs.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]}):this.txb.moveCall({target:n.Zs.Instance().serviceFn("stock_set"),arguments:[n.Zs.TXB_OBJECT(this.txb,this.object),this.txb.pure.string(t),this.txb.pure.u64(s),this.txb.pure.bool(e),n.Zs.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]})}add_stock(t,s,e=!0,i){h.IsValidItemName(t)||(0,o.f)(o.I.IsValidServiceItemName,"add_stock item"),(0,a.Ec)(s)||(0,o.f)(o.I.IsValidUint,"add_stock stock_add"),i?this.txb.moveCall({target:n.Zs.Instance().serviceFn("stock_add_with_passport"),arguments:[i,n.Zs.TXB_OBJECT(this.txb,this.object),this.txb.pure.string(t),this.txb.pure.u64(s),this.txb.pure.bool(e),n.Zs.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]}):this.txb.moveCall({target:n.Zs.Instance().serviceFn("stock_add"),arguments:[n.Zs.TXB_OBJECT(this.txb,this.object),this.txb.pure.string(t),this.txb.pure.u64(s),this.txb.pure.bool(e),n.Zs.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]})}reduce_stock(t,s,e=!0,i){h.IsValidItemName(t)||(0,o.f)(o.I.IsValidServiceItemName,"reduce_stock item"),(0,a.Ec)(s)||(0,o.f)(o.I.IsValidUint,"reduce_stock stock_reduce"),i?this.txb.moveCall({target:n.Zs.Instance().serviceFn("stock_reduce_with_passport"),arguments:[i,n.Zs.TXB_OBJECT(this.txb,this.object),this.txb.pure.string(t),this.txb.pure.u64(s),this.txb.pure.bool(e),n.Zs.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]}):this.txb.moveCall({target:n.Zs.Instance().serviceFn("stock_reduce"),arguments:[n.Zs.TXB_OBJECT(this.txb,this.object),this.txb.pure.string(t),this.txb.pure.u64(s),this.txb.pure.bool(e),n.Zs.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]})}set_sale_endpoint(t,s,e=!0,i){h.IsValidItemName(t)||(0,o.f)(o.I.IsValidServiceItemName,"set_sale_endpoint item"),s&&!(0,a.Eh)(s)&&(0,o.f)(o.I.IsValidEndpoint,"set_sale_endpoint endpoint");let r=this.txb.pure.option("string",s||void 0);i?this.txb.moveCall({target:n.Zs.Instance().serviceFn("sale_endpoint_set_with_passport"),arguments:[i,n.Zs.TXB_OBJECT(this.txb,this.object),this.txb.pure.string(t),r,this.txb.pure.bool(e),n.Zs.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]}):this.txb.moveCall({target:n.Zs.Instance().serviceFn("sale_endpoint_set"),arguments:[n.Zs.TXB_OBJECT(this.txb,this.object),this.txb.pure.string(t),r,this.txb.pure.bool(e),n.Zs.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]})}set_payee(t,s){n.Zs.IsValidObjects([t])||(0,o.f)(o.I.IsValidObjects,"set_payee"),s?this.txb.moveCall({target:n.Zs.Instance().serviceFn("payee_set_with_passport"),arguments:[s,n.Zs.TXB_OBJECT(this.txb,this.object),this.txb.object(t),n.Zs.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]}):this.txb.moveCall({target:n.Zs.Instance().serviceFn("payee_set"),arguments:[n.Zs.TXB_OBJECT(this.txb,this.object),this.txb.object(t),n.Zs.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]})}add_repository(t,s){n.Zs.IsValidObjects([t])||(0,o.f)(o.I.IsValidObjects,"repository_add"),s?this.txb.moveCall({target:n.Zs.Instance().serviceFn("repository_add_with_passport"),arguments:[n.Zs.TXB_OBJECT(this.txb,this.object),n.Zs.TXB_OBJECT(this.txb,t),n.Zs.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]}):this.txb.moveCall({target:n.Zs.Instance().serviceFn("repository_add"),arguments:[n.Zs.TXB_OBJECT(this.txb,this.object),n.Zs.TXB_OBJECT(this.txb,t),n.Zs.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]})}remove_repository(t,s,e){(s||0!==t.length)&&((0,a.ij)(t,a.jE)||(0,o.f)(o.I.IsValidArray,"repository_address"),e?s?this.txb.moveCall({target:n.Zs.Instance().serviceFn("repository_remove_all_with_passport"),arguments:[e,n.Zs.TXB_OBJECT(this.txb,this.object),n.Zs.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]}):this.txb.moveCall({target:n.Zs.Instance().serviceFn("repository_remove_with_passport"),arguments:[e,n.Zs.TXB_OBJECT(this.txb,this.object),this.txb.pure.vector("address",(0,a.SI)(t)),n.Zs.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]}):s?this.txb.moveCall({target:n.Zs.Instance().serviceFn("repository_remove_all"),arguments:[n.Zs.TXB_OBJECT(this.txb,this.object),n.Zs.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]}):this.txb.moveCall({target:n.Zs.Instance().serviceFn("repository_remove"),arguments:[n.Zs.TXB_OBJECT(this.txb,this.object),this.txb.pure.vector("address",(0,a.SI)(t)),n.Zs.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]}))}add_arbitration(t,s,e){n.Zs.IsValidObjects([t])||(0,o.f)(o.I.IsValidObjects,"add_arbitration.arbitraion"),(0,a.MA)(s)||(0,o.f)(o.I.IsValidTokenType,"add_arbitration.arbitraion_token_type"),e?this.txb.moveCall({target:n.Zs.Instance().serviceFn("arbitration_add_with_passport"),arguments:[e,n.Zs.TXB_OBJECT(this.txb,this.object),n.Zs.TXB_OBJECT(this.txb,t),n.Zs.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type,s]}):this.txb.moveCall({target:n.Zs.Instance().serviceFn("arbitration_add"),arguments:[n.Zs.TXB_OBJECT(this.txb,this.object),n.Zs.TXB_OBJECT(this.txb,t),n.Zs.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type,s]})}remove_arbitration(t,s,e){(s||0!==t.length)&&((0,a.ij)(t,a.jE)||(0,o.f)(o.I.IsValidArray,"remove_arbitration.address"),e?s?this.txb.moveCall({target:n.Zs.Instance().serviceFn("arbitration_remove_all_with_passport"),arguments:[e,n.Zs.TXB_OBJECT(this.txb,this.object),n.Zs.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]}):this.txb.moveCall({target:n.Zs.Instance().serviceFn("arbitration_remove_with_passport"),arguments:[e,n.Zs.TXB_OBJECT(this.txb,this.object),this.txb.pure.vector("address",(0,a.SI)(t)),n.Zs.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]}):s?this.txb.moveCall({target:n.Zs.Instance().serviceFn("arbitration_remove_all"),arguments:[n.Zs.TXB_OBJECT(this.txb,this.object),n.Zs.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]}):this.txb.moveCall({target:n.Zs.Instance().serviceFn("arbitration_remove"),arguments:[n.Zs.TXB_OBJECT(this.txb,this.object),this.txb.pure.vector("address",(0,a.SI)(t)),n.Zs.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]}))}add_withdraw_guards(t,s){if(0===t.length)return;let e=!0;t.forEach((t=>{n.Zs.IsValidObjects([t.guard])||(e=!1),(0,a.qF)(t.percent)||(e=!1)})),e||(0,o.f)(o.I.InvalidParam,"guards"),t.forEach((t=>{s?this.txb.moveCall({target:n.Zs.Instance().serviceFn("withdraw_guard_add_with_passport"),arguments:[s,n.Zs.TXB_OBJECT(this.txb,this.object),n.Zs.TXB_OBJECT(this.txb,t.guard),this.txb.pure.u8(t.percent),n.Zs.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]}):this.txb.moveCall({target:n.Zs.Instance().serviceFn("withdraw_guard_add"),arguments:[n.Zs.TXB_OBJECT(this.txb,this.object),n.Zs.TXB_OBJECT(this.txb,t.guard),this.txb.pure.u8(t.percent),n.Zs.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]})}))}remove_withdraw_guards(t,s,e){(s||0!==t.length)&&((0,a.ij)(t,a.jE)||(0,o.f)(o.I.IsValidArray,"guard_address"),e?s?this.txb.moveCall({target:n.Zs.Instance().serviceFn("withdraw_guard_remove_all_with_passport"),arguments:[e,n.Zs.TXB_OBJECT(this.txb,this.object),n.Zs.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]}):this.txb.moveCall({target:n.Zs.Instance().serviceFn("withdraw_guard_remove_with_passport"),arguments:[e,n.Zs.TXB_OBJECT(this.txb,this.object),this.txb.pure.vector("address",(0,a.SI)(t)),n.Zs.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]}):s?this.txb.moveCall({target:n.Zs.Instance().serviceFn("withdraw_guard_remove_all"),arguments:[n.Zs.TXB_OBJECT(this.txb,this.object),n.Zs.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]}):this.txb.moveCall({target:n.Zs.Instance().serviceFn("withdraw_guard_remove"),arguments:[n.Zs.TXB_OBJECT(this.txb,this.object),this.txb.pure.vector("address",(0,a.SI)(t)),n.Zs.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]}))}add_refund_guards(t,s){if(0===t.length)return;let e=!0;t.forEach((t=>{n.Zs.IsValidObjects([t.guard])||(e=!1),(0,a.qF)(t.percent)||(e=!1)})),e||(0,o.f)(o.I.InvalidParam,"guards"),t.forEach((t=>{s?this.txb.moveCall({target:n.Zs.Instance().serviceFn("refund_guard_add_with_passport"),arguments:[s,n.Zs.TXB_OBJECT(this.txb,this.object),n.Zs.TXB_OBJECT(this.txb,t.guard),this.txb.pure.u8(t.percent),n.Zs.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]}):this.txb.moveCall({target:n.Zs.Instance().serviceFn("refund_guard_add"),arguments:[n.Zs.TXB_OBJECT(this.txb,this.object),n.Zs.TXB_OBJECT(this.txb,t.guard),this.txb.pure.u8(t.percent),n.Zs.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]})}))}remove_refund_guards(t,s,e){(0!==t.length||s)&&((0,a.ij)(t,a.jE)||(0,o.f)(o.I.InvalidParam,"guard_address"),e?s?this.txb.moveCall({target:n.Zs.Instance().serviceFn("refund_guard_remove_all_with_passport"),arguments:[e,n.Zs.TXB_OBJECT(this.txb,this.object),n.Zs.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]}):this.txb.moveCall({target:n.Zs.Instance().serviceFn("refund_guard_remove_with_passport"),arguments:[e,n.Zs.TXB_OBJECT(this.txb,this.object),this.txb.pure.vector("address",(0,a.SI)(t)),n.Zs.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]}):s?this.txb.moveCall({target:n.Zs.Instance().serviceFn("refund_guard_remove_all"),arguments:[n.Zs.TXB_OBJECT(this.txb,this.object),n.Zs.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]}):this.txb.moveCall({target:n.Zs.Instance().serviceFn("refund_guard_remove"),arguments:[n.Zs.TXB_OBJECT(this.txb,this.object),this.txb.pure.vector("address",(0,a.SI)(t)),n.Zs.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]}))}is_valid_sale(t){let s=!0,e=[];return t.forEach((t=>{h.IsValidItemName(t.item)||(s=!1),(0,a.Ec)(t.price)||(s=!1),(0,a.Ec)(t.stock)||(s=!1),e.includes(t.item)&&(s=!1),e.push(t.item)})),s}add_sales(t,s=!1,e){if(0===t.length)return;this.is_valid_sale(t)||(0,o.f)(o.I.InvalidParam,"add_sales");let i=[],r=[],h=[],_=[];t.forEach((t=>{t.endpoint&&!(0,a.Eh)(t.endpoint)&&(0,o.f)(o.I.IsValidEndpoint,"add_sales"),i.push(t.item),r.push(t.price),h.push(t.stock),_.push(t.endpoint??"")})),e?this.txb.moveCall({target:n.Zs.Instance().serviceFn("sales_add_with_passport"),arguments:[e,n.Zs.TXB_OBJECT(this.txb,this.object),this.txb.pure.vector("string",i),this.txb.pure.vector("string",_),this.txb.pure.vector("u64",r),this.txb.pure.vector("u64",h),this.txb.pure.bool(s),n.Zs.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]}):this.txb.moveCall({target:n.Zs.Instance().serviceFn("sales_add"),arguments:[n.Zs.TXB_OBJECT(this.txb,this.object),this.txb.pure.vector("string",i),this.txb.pure.vector("string",_),this.txb.pure.vector("u64",r),this.txb.pure.vector("u64",h),this.txb.pure.bool(s),n.Zs.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]})}remove_sales(t,s){0!==t.length&&((0,a.ij)(t,h.IsValidItemName)||(0,o.f)(o.I.IsValidArray,"remove_sales"),s?this.txb.moveCall({target:n.Zs.Instance().serviceFn("sales_remove_with_passport"),arguments:[s,n.Zs.TXB_OBJECT(this.txb,this.object),this.txb.pure.vector("string",(0,a.SI)(t)),n.Zs.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]}):this.txb.moveCall({target:n.Zs.Instance().serviceFn("sales_remove"),arguments:[n.Zs.TXB_OBJECT(this.txb,this.object),this.txb.pure.vector("string",(0,a.SI)(t)),n.Zs.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]}))}discount_transfer(t,s){(!t||t.length>h.MAX_DISCOUNT_RECEIVER_COUNT)&&(0,o.f)(o.I.InvalidParam,"discount_dispatch");let e=!0;t.forEach((t=>{(0,a.jE)(t.receiver)||(e=!1),(!(0,a.Ec)(t.count)||t.count>h.MAX_DISCOUNT_COUNT_ONCE)&&(e=!1),(0,a.Xx)(t.discount.name)||(e=!1),t.discount.type!=i.ratio||(0,a.qF)(t.discount.off)||(e=!1),(0,a.Ec)(t.discount.duration_minutes)||(e=!1),t.discount?.time_start&&!(0,a.Ec)(t.discount.time_start)&&(e=!1),t.discount?.price_greater&&!(0,a.Ec)(t.discount.price_greater)&&(e=!1)})),e||(0,o.f)(o.I.InvalidParam,"discount_dispatch");const r=this.txb.sharedObjectRef(n.Zs.CLOCK_OBJECT);t.forEach((t=>{let e=this.txb.pure.option("u64",t.discount?.price_greater?t.discount?.price_greater:void 0),i=this.txb.pure.option("u64",t.discount?.time_start?t.discount?.time_start:void 0);s?this.txb.moveCall({target:n.Zs.Instance().serviceFn("dicscount_create_with_passport"),arguments:[s,n.Zs.TXB_OBJECT(this.txb,this.object),this.txb.pure.string(t.discount.name),this.txb.pure.u8(t.discount.type),this.txb.pure.u64(t.discount.off),e,i,this.txb.pure.u64(t.discount.duration_minutes),this.txb.pure.u64(t.count),n.Zs.TXB_OBJECT(this.txb,this.permission),this.txb.pure.address(t.receiver),this.txb.object(r)],typeArguments:[this.pay_token_type]}):this.txb.moveCall({target:n.Zs.Instance().serviceFn("dicscount_create"),arguments:[n.Zs.TXB_OBJECT(this.txb,this.object),this.txb.pure.string(t.discount.name),this.txb.pure.u8(t.discount.type),this.txb.pure.u64(t.discount.off),e,i,this.txb.pure.u64(t.discount.duration_minutes),this.txb.pure.u64(t.count),n.Zs.TXB_OBJECT(this.txb,this.permission),this.txb.pure.address(t.receiver),this.txb.object(r)],typeArguments:[this.pay_token_type]})}))}withdraw(t,s,e){n.Zs.IsValidObjects([t,s.treasury,s.withdraw_guard,e])||(0,o.f)(o.I.IsValidObjects),s?.for_guard&&!n.Zs.IsValidObjects([s.for_guard])&&(0,o.f)(o.I.IsValidObjects,"withdraw.param.for_guard"),s?.for_object&&!(0,a.jE)(s.for_object)&&(0,o.f)(o.I.IsValidAddress,"withdraw.param.for_object"),(0,a.Ec)(s.index)||(0,o.f)(o.I.IsValidU64,"withdraw.param.index"),(0,a.yW)(s.remark)||(0,o.f)(o.I.IsValidDesription,"withdraw.param.remark");const i=this.txb.pure.option("address",s.for_object?s.for_object:void 0),r=this.txb.sharedObjectRef(n.Zs.CLOCK_OBJECT);return s.for_guard?this.txb.moveCall({target:n.Zs.Instance().serviceFn("withdraw_forGuard_with_passport"),arguments:[e,n.Zs.TXB_OBJECT(this.txb,this.object),n.Zs.TXB_OBJECT(this.txb,t),this.txb.object(s.withdraw_guard),this.txb.object(s.treasury),i,this.txb.object(s.for_guard),this.txb.pure.u64(s.index),this.txb.pure.string(s.remark),this.txb.object(r),n.Zs.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]}):this.txb.moveCall({target:n.Zs.Instance().serviceFn("withdraw_with_passport"),arguments:[e,n.Zs.TXB_OBJECT(this.txb,this.object),n.Zs.TXB_OBJECT(this.txb,t),this.txb.object(s.withdraw_guard),this.txb.object(s.treasury),i,this.txb.pure.u64(s.index),this.txb.pure.string(s.remark),this.txb.object(r),n.Zs.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]})}set_buy_guard(t,s){s?t?this.txb.moveCall({target:n.Zs.Instance().serviceFn("buy_guard_set_with_passport"),arguments:[s,n.Zs.TXB_OBJECT(this.txb,this.object),n.Zs.TXB_OBJECT(this.txb,t),n.Zs.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]}):this.txb.moveCall({target:n.Zs.Instance().serviceFn("buy_guard_none_with_passport"),arguments:[s,n.Zs.TXB_OBJECT(this.txb,this.object),n.Zs.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]}):t?this.txb.moveCall({target:n.Zs.Instance().serviceFn("buy_guard_set"),arguments:[n.Zs.TXB_OBJECT(this.txb,this.object),n.Zs.TXB_OBJECT(this.txb,t),n.Zs.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]}):this.txb.moveCall({target:n.Zs.Instance().serviceFn("buy_guard_none"),arguments:[n.Zs.TXB_OBJECT(this.txb,this.object),n.Zs.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]})}set_machine(t,s){s?t?this.txb.moveCall({target:n.Zs.Instance().serviceFn("machine_set_with_passport"),arguments:[s,n.Zs.TXB_OBJECT(this.txb,this.object),n.Zs.TXB_OBJECT(this.txb,t),n.Zs.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]}):this.txb.moveCall({target:n.Zs.Instance().serviceFn("machine_none_with_passport"),arguments:[s,n.Zs.TXB_OBJECT(this.txb,this.object),n.Zs.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]}):t?this.txb.moveCall({target:n.Zs.Instance().serviceFn("machine_set"),arguments:[n.Zs.TXB_OBJECT(this.txb,this.object),n.Zs.TXB_OBJECT(this.txb,t),n.Zs.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]}):this.txb.moveCall({target:n.Zs.Instance().serviceFn("machine_none"),arguments:[n.Zs.TXB_OBJECT(this.txb,this.object),n.Zs.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]})}set_endpoint(t,s){t&&!(0,a.Eh)(t)&&(0,o.f)(o.I.IsValidEndpoint);let e=this.txb.pure.option("string",t||void 0);s?this.txb.moveCall({target:n.Zs.Instance().serviceFn("endpoint_set_with_passport"),arguments:[s,n.Zs.TXB_OBJECT(this.txb,this.object),e,n.Zs.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]}):this.txb.moveCall({target:n.Zs.Instance().serviceFn("endpoint_set"),arguments:[n.Zs.TXB_OBJECT(this.txb,this.object),e,n.Zs.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]})}publish(t){t?this.txb.moveCall({target:n.Zs.Instance().serviceFn("publish_with_passport"),arguments:[t,n.Zs.TXB_OBJECT(this.txb,this.object),n.Zs.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]}):this.txb.moveCall({target:n.Zs.Instance().serviceFn("publish"),arguments:[n.Zs.TXB_OBJECT(this.txb,this.object),n.Zs.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]})}clone(t,s,e){let i;return i=e?this.txb.moveCall({target:n.Zs.Instance().serviceFn("clone_withpassport"),arguments:[e,n.Zs.TXB_OBJECT(this.txb,this.object),n.Zs.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type,t||this.pay_token_type]}):this.txb.moveCall({target:n.Zs.Instance().serviceFn("clone"),arguments:[n.Zs.TXB_OBJECT(this.txb,this.object),n.Zs.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type,t||this.pay_token_type]}),s?this.txb.moveCall({target:n.Zs.Instance().serviceFn("create"),arguments:[n.Zs.TXB_OBJECT(this.txb,i)],typeArguments:[t||this.pay_token_type]}):i}set_customer_required(t,s,e){s.length>0&&!t&&(0,o.f)(o.I.InvalidParam,"set_customer_required"),t.length>h.MAX_PUBKEY_SIZE&&(0,o.f)(o.I.InvalidParam,"set_customer_required.pubkey"),s.length>h.MAX_REQUIRES_COUNT&&(0,o.f)(o.I.InvalidParam,"set_customer_required.customer_required"),(0,a.ij)(s,a.S7)||(0,o.f)(o.I.IsValidArray,"set_customer_required.customer_required");let i=(0,a.SI)(s);e?this.txb.moveCall({target:n.Zs.Instance().serviceFn("required_set_with_passport"),arguments:[e,n.Zs.TXB_OBJECT(this.txb,this.object),this.txb.pure.vector("string",i),this.txb.pure.string(t),n.Zs.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]}):this.txb.moveCall({target:n.Zs.Instance().serviceFn("required_set"),arguments:[n.Zs.TXB_OBJECT(this.txb,this.object),this.txb.pure.vector("string",i),this.txb.pure.string(t),n.Zs.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]})}remove_customer_required(t){t?this.txb.moveCall({target:n.Zs.Instance().serviceFn("required_none_with_passport"),arguments:[t,n.Zs.TXB_OBJECT(this.txb,this.object),n.Zs.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]}):this.txb.moveCall({target:n.Zs.Instance().serviceFn("required_none"),arguments:[n.Zs.TXB_OBJECT(this.txb,this.object),n.Zs.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]})}change_required_pubkey(t,s){t||(0,o.f)(o.I.InvalidParam,"pubkey"),s?this.txb.moveCall({target:n.Zs.Instance().serviceFn("required_pubkey_set_with_passport"),arguments:[s,n.Zs.TXB_OBJECT(this.txb,this.object),this.txb.pure.string(t),n.Zs.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]}):this.txb.moveCall({target:n.Zs.Instance().serviceFn("required_pubkey_set"),arguments:[n.Zs.TXB_OBJECT(this.txb,this.object),this.txb.pure.string(t),n.Zs.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]})}pause(t,s){s?this.txb.moveCall({target:n.Zs.Instance().serviceFn("pause_with_passport"),arguments:[s,n.Zs.TXB_OBJECT(this.txb,this.object),this.txb.pure.bool(t),n.Zs.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]}):this.txb.moveCall({target:n.Zs.Instance().serviceFn("pause"),arguments:[n.Zs.TXB_OBJECT(this.txb,this.object),this.txb.pure.bool(t),n.Zs.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]})}refund_withArb(t,s,e){n.Zs.IsValidObjects([t,s])||(0,o.f)(o.I.IsValidObjects,"refund_withArb.order or arb"),(0,a.MA)(e)||(0,o.f)(o.I.IsValidTokenType,"refund_withArb.arb_type");const i=this.txb.sharedObjectRef(n.Zs.CLOCK_OBJECT);this.txb.moveCall({target:n.Zs.Instance().serviceFn("refund_with_arb"),arguments:[n.Zs.TXB_OBJECT(this.txb,this.object),n.Zs.TXB_OBJECT(this.txb,t),this.txb.object(s),this.txb.object(i)],typeArguments:[this.pay_token_type,e]})}refund(t,s,e){n.Zs.IsValidObjects([t])||(0,o.f)(o.I.IsValidObjects,"refund.order"),s&&!n.Zs.IsValidObjects([s])&&(0,o.f)(o.I.IsValidObjects,"refund.refund_guard"),e&&!s&&(0,o.f)(o.I.InvalidParam,"refund.passport need refund_guard");const i=this.txb.sharedObjectRef(n.Zs.CLOCK_OBJECT);e&&s?this.txb.moveCall({target:n.Zs.Instance().serviceFn("refund_with_passport"),arguments:[n.Zs.TXB_OBJECT(this.txb,this.object),n.Zs.TXB_OBJECT(this.txb,t),this.txb.object(s),e,this.txb.object(i)],typeArguments:[this.pay_token_type]}):this.txb.moveCall({target:n.Zs.Instance().serviceFn("refund"),arguments:[n.Zs.TXB_OBJECT(this.txb,this.object),n.Zs.TXB_OBJECT(this.txb,t)],typeArguments:[this.pay_token_type]})}update_order_required_info(t,s){s.customer_pubkey&&0!==s.customer_info_crypt.length&&(n.Zs.IsValidObjects([t])||(0,o.f)(o.I.IsValidObjects,"update_order_required_info.order"),this.txb.moveCall({target:n.Zs.Instance().serviceFn("order_required_info_update"),arguments:[n.Zs.TXB_OBJECT(this.txb,this.object),n.Zs.TXB_OBJECT(this.txb,t),this.txb.pure.string(s.customer_pubkey),this.txb.pure.string(s.customer_info_crypt)],typeArguments:[this.pay_token_type]}))}order(t,s,e,i,r,_){0===t.length&&(0,o.f)(o.I.InvalidParam,"order.buy_items empty");let p=!0,b=[];t.forEach((t=>{h.IsValidItemName(t.item)||(p=!1),(0,a.Ec)(t.max_price)||(p=!1),(0,a.Ec)(t.count)||(p=!1),b.includes(t.item)&&(p=!1),b.push(t.item)})),p||(0,o.f)(o.I.InvalidParam,"buy_items invalid");let c,u=[],m=[],d=[];t.forEach((t=>{u.push(t.item),m.push(BigInt(t.max_price)),d.push(BigInt(t.count))}));const T=this.txb.sharedObjectRef(n.Zs.CLOCK_OBJECT);c=_?e?this.txb.moveCall({target:n.Zs.Instance().serviceFn("dicount_buy_with_passport"),arguments:[_,n.Zs.TXB_OBJECT(this.txb,this.object),this.txb.pure.vector("string",u),this.txb.pure.vector("u64",m),this.txb.pure.vector("u64",d),n.Zs.TXB_OBJECT(this.txb,s),n.Zs.TXB_OBJECT(this.txb,e),this.txb.object(T)],typeArguments:[this.pay_token_type]}):this.txb.moveCall({target:n.Zs.Instance().serviceFn("buy_with_passport"),arguments:[_,n.Zs.TXB_OBJECT(this.txb,this.object),this.txb.pure.vector("string",u),this.txb.pure.vector("u64",m),this.txb.pure.vector("u64",d),n.Zs.TXB_OBJECT(this.txb,s)],typeArguments:[this.pay_token_type]}):e?this.txb.moveCall({target:n.Zs.Instance().serviceFn("disoucnt_buy"),arguments:[n.Zs.TXB_OBJECT(this.txb,this.object),this.txb.pure.vector("string",u),this.txb.pure.vector("u64",m),this.txb.pure.vector("u64",d),n.Zs.TXB_OBJECT(this.txb,s),n.Zs.TXB_OBJECT(this.txb,e),this.txb.object(T)],typeArguments:[this.pay_token_type]}):this.txb.moveCall({target:n.Zs.Instance().serviceFn("buy"),arguments:[n.Zs.TXB_OBJECT(this.txb,this.object),this.txb.pure.vector("string",u),this.txb.pure.vector("u64",m),this.txb.pure.vector("u64",d),n.Zs.TXB_OBJECT(this.txb,s)],typeArguments:[this.pay_token_type]}),r&&this.update_order_required_info(c,r);var g=void 0;return i&&(g=this.order_bind_machine(c,i)),{order:c,progress:g}}order_launch(t){var s;return t.progress&&(s=this.txb.moveCall({target:n.Zs.Instance().progressFn("create"),arguments:[n.Zs.TXB_OBJECT(this.txb,t.progress)]})),{order:this.txb.moveCall({target:n.Zs.Instance().serviceFn("order_create"),arguments:[n.Zs.TXB_OBJECT(this.txb,this.object),n.Zs.TXB_OBJECT(this.txb,t.order)],typeArguments:[this.pay_token_type]}),progress:s}}buy(t,s,e,i,r,a){const n=this.order(t,s,e,i,r,a);return this.order_launch(n)}order_bind_machine(t,s){return n.Zs.IsValidObjects([t,s])||(0,o.f)(o.I.IsValidObjects,"order & machine"),this.txb.moveCall({target:n.Zs.Instance().serviceFn("order_bind_machine"),arguments:[n.Zs.TXB_OBJECT(this.txb,this.object),n.Zs.TXB_OBJECT(this.txb,t),n.Zs.TXB_OBJECT(this.txb,s)],typeArguments:[this.pay_token_type]})}add_treasury(t,s,e){n.Zs.IsValidObjects([s])||(0,o.f)(o.I.IsValidObjects,"add_treasury.treasury"),(0,a.MA)(t)||(0,o.f)(o.I.IsValidTokenType,"add_treasury.treasury_token_type"),e?this.txb.moveCall({target:n.Zs.Instance().serviceFn("treasury_add_with_passport"),arguments:[e,n.Zs.TXB_OBJECT(this.txb,this.object),this.txb.object(s),n.Zs.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type,t]}):this.txb.moveCall({target:n.Zs.Instance().serviceFn("treasury_add"),arguments:[n.Zs.TXB_OBJECT(this.txb,this.object),this.txb.object(s),n.Zs.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type,t]})}remove_treasury(t,s,e){(s||0!==t.length)&&(e?s?this.txb.moveCall({target:n.Zs.Instance().serviceFn("treasury_remove_all_with_passport"),arguments:[e,n.Zs.TXB_OBJECT(this.txb,this.object),n.Zs.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]}):this.txb.moveCall({target:n.Zs.Instance().serviceFn("treasury_remove_with_passport"),arguments:[e,n.Zs.TXB_OBJECT(this.txb,this.object),this.txb.pure.vector("address",t),n.Zs.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]}):s?this.txb.moveCall({target:n.Zs.Instance().serviceFn("treasury_remove_all"),arguments:[n.Zs.TXB_OBJECT(this.txb,this.object),n.Zs.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]}):this.txb.moveCall({target:n.Zs.Instance().serviceFn("treasury_remove"),arguments:[n.Zs.TXB_OBJECT(this.txb,this.object),this.txb.pure.vector("address",t),n.Zs.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]}))}change_permission(t){n.Zs.IsValidObjects([t])||(0,o.f)(o.I.IsValidObjects),this.txb.moveCall({target:n.Zs.Instance().serviceFn("permission_set"),arguments:[n.Zs.TXB_OBJECT(this.txb,this.object),n.Zs.TXB_OBJECT(this.txb,this.permission),n.Zs.TXB_OBJECT(this.txb,t)],typeArguments:[this.pay_token_type]}),this.permission=t}set_order_agent(t,s,e){h.SetOrderAgent(this.txb,this.pay_token_type,t,s,e)}change_order_payer(t,s,e){h.ChangeOrderPayer(this.txb,this.pay_token_type,t,s,e)}static MAX_DISCOUNT_COUNT_ONCE=200;static MAX_DISCOUNT_RECEIVER_COUNT=20;static MAX_GUARD_COUNT=16;static MAX_REPOSITORY_COUNT=32;static MAX_ITEM_NAME_LENGTH=256;static MAX_TREASURY_COUNT=8;static MAX_ORDER_AGENT_COUNT=8;static MAX_ORDER_ARBS_COUNT=8;static MAX_ARBITRATION_COUNT=8;static MAX_REQUIRES_COUNT=16;static MAX_PUBKEY_SIZE=3e3;static IsValidItemName(t){return!!t&&(new TextEncoder).encode(t).length<=h.MAX_ITEM_NAME_LENGTH}static parseObjectType=t=>(0,a.q5)(t,"service::Service<");static parseOrderObjectType=t=>(0,a.q5)(t,"order::Order<");static endpoint=(t,s,e)=>s||(t?t+"/sales/"+encodeURI(e):void 0);static DiscountObjects=(t,s)=>{n.Zs.Client().getOwnedObjects({owner:t,filter:{MoveModule:{module:"order",package:n.Zs.Instance().package("wowok")}},options:{showContent:!0,showType:!0}}).then((e=>{s(t,e.data.map((t=>t.data)))})).catch((t=>{console.log(t)}))};static SetOrderAgent=(t,s,e,i,r)=>{(0,a.MA)(s)||(0,o.f)(o.I.IsValidTokenType,"SetOrderAgent.order_token_type"),n.Zs.IsValidObjects([e])||(0,o.f)(o.I.IsValidObjects,"SetOrderAgent.order"),(0,a.ij)(i,a.jE)||(0,o.f)(o.I.IsValidArray,"SetOrderAgent.agent"),(0,a.SI)(i).length>h.MAX_ORDER_AGENT_COUNT&&(0,o.f)(o.I.Fail,"SetOrderAgent.agent count"),t.moveCall({target:n.Zs.Instance().orderFn("agent_set"),arguments:[t.object(e),t.pure.vector("address",(0,a.SI)(i))],typeArguments:[s]}),r&&t.moveCall({target:n.Zs.Instance().orderFn("order_ops_to_progress"),arguments:[t.object(e),t.object(r)],typeArguments:[s]})};static ChangeOrderPayer=(t,s,e,i,r)=>{(0,a.MA)(s)||(0,o.f)(o.I.IsValidTokenType,"ChangeOrderPayer.order_token_type"),n.Zs.IsValidObjects([e])||(0,o.f)(o.I.IsValidObjects,"ChangeOrderPayer.order"),(0,a.jE)(i)||(0,o.f)(o.I.IsValidAddress,"ChangeOrderPayer.new_addr"),t.moveCall({target:n.Zs.Instance().orderFn("payer_change"),arguments:[t.object(e),t.pure.address(i)],typeArguments:[s]}),r&&t.moveCall({target:n.Zs.Instance().orderFn("order_ops_to_progress"),arguments:[t.object(e),t.object(r)],typeArguments:[s]})}}},3810:(t,s,e)=>{e.d(s,{F:()=>h,K:()=>i});var i,r=e(9554),a=e(1609),n=e(5337),o=e(6601);!function(t){t.Like="like",t.Dislike="dislike",t.Launch="launch",t.Order="order",t.Payment="payment"}(i||(i={}));class h{static MAX_ADDRESS_COUNT_FOR_TAG=1e3;static MAX_TAG_COUNT_FOR_ADDRESS=64;object;txb;get_object(){return this.object}constructor(t){this.txb=t,this.object=""}static From(t,s){let e=new h(t);return e.object=r.Zs.TXB_OBJECT(t,s),e}launch(){return this.object||(0,n.f)(n.I.Fail,"launch object Invalid"),this.txb.moveCall({target:r.Zs.Instance().resourceFn("create"),arguments:[r.Zs.TXB_OBJECT(this.txb,this.object)]})}resolve_add(t,s){return s.find((t=>t===i.Like))&&o.w.From(this.txb).mark(this,t,i.Like),s.find((t=>t===i.Dislike))&&o.w.From(this.txb).mark(this,t,i.Dislike),s.filter((t=>t!==i.Like&&t!==i.Dislike&&(0,a.S7)(t)))}add(t,s,e){"string"!=typeof t||(0,a.jE)(t)||(0,n.f)(n.I.IsValidAddress,"Resource: add.address");var i=this.resolve_add(t,s);(e||0!==i.length)&&(e&&!(0,a.S7)(e)&&(0,n.f)(n.I.IsValidName,"Resource: add.name"),i.length>h.MAX_TAG_COUNT_FOR_ADDRESS&&(i=i.slice(0,h.MAX_TAG_COUNT_FOR_ADDRESS)),this.txb.moveCall({target:r.Zs.Instance().resourceFn("add"),arguments:[r.Zs.TXB_OBJECT(this.txb,this.object),"string"==typeof t?this.txb.pure.address(t):t,this.txb.pure.option("string",e),this.txb.pure.vector("string",i)]}))}remove(t,s){"string"!=typeof t||(0,a.jE)(t)||(0,n.f)(n.I.IsValidAddress,"Resource: remove.address"),this.txb.moveCall({target:r.Zs.Instance().resourceFn("remove"),arguments:[r.Zs.TXB_OBJECT(this.txb,this.object),"string"==typeof t?this.txb.pure.address(t):t,this.txb.pure.vector("string",s)]})}removeall(t){"string"!=typeof t||(0,a.jE)(t)||(0,n.f)(n.I.IsValidAddress,"Resource: removeall.address"),this.txb.moveCall({target:r.Zs.Instance().resourceFn("removeall"),arguments:[r.Zs.TXB_OBJECT(this.txb,this.object),"string"==typeof t?this.txb.pure.address(t):t]})}static TagData(t,s=!0){const e=[];return t.forEach((t=>{t.tags.forEach((s=>{const i=e.find((t=>t.tag===s));i?i.address.find((s=>s===t.address))||i.address.push(t.address):e.push({tag:s,address:[t.address]})}))})),s&&Object.keys(i).forEach((t=>{e.find((s=>s.tag===i[t]))||e.push({tag:i[t],address:[]})})),e}static Tags(t){const s=[];return t.address.forEach((e=>{const i=s.find((t=>t.address===e));i?i.tags.find((s=>s===t.tag))||i.tags.push(t.tag):s.push({address:e,tags:[t.tag]})})),s}}}}]);