UNPKG

wowok_agent

Version:

Create, collaborate, and transact on your own terms with the AI-driven web3 collaboration protocol.

1 lines 24 kB
"use strict";(this.webpackChunkwowok_agent=this.webpackChunkwowok_agent||[]).push([[875],{1609:(t,e,s)=>{s.d(e,{$Q:()=>rt,$q:()=>V,Al:()=>j,CT:()=>F,DQ:()=>D,EM:()=>A,Ec:()=>L,Eh:()=>Y,Ep:()=>v,Go:()=>Z,Hn:()=>p,IN:()=>m,Li:()=>ot,Lj:()=>P,Lw:()=>f,MA:()=>H,Mb:()=>U,Mc:()=>h,Mg:()=>it,O_:()=>st,R0:()=>W,S7:()=>S,SI:()=>y,Tg:()=>q,U5:()=>G,U8:()=>nt,UR:()=>R,VP:()=>c,XF:()=>d,Xx:()=>k,Ys:()=>l,ZH:()=>C,_J:()=>u,aH:()=>K,bT:()=>ct,b_:()=>o,ds:()=>M,gV:()=>T,gz:()=>_,ij:()=>Q,jE:()=>N,ji:()=>w,jz:()=>g,oV:()=>$,p_:()=>I,pq:()=>E,q5:()=>B,qF:()=>z,tH:()=>at,u1:()=>O,xI:()=>et,xT:()=>b,x_:()=>x,yW:()=>X});var r=s(9876),i=s(5337),n=s(9298),a=s(9554);const o=BigInt("255"),c=BigInt("18446744073709551615"),h=BigInt("340282366920938463463374607431768211455"),u=BigInt("115792089237316195423570985008687907853269984665640564039457584007913129639935"),b=0,d=t=>t===a.eV.TYPE_U8||t===a.eV.TYPE_U64||t===a.eV.TYPE_U128||t===a.eV.TYPE_U256?a.ml.PositiveNumber:t===a.eV.TYPE_VEC_U8||t===a.eV.TYPE_VEC_U64||t===a.eV.TYPE_VEC_U128||t===a.eV.TYPE_VEC_U256||t===a.eV.TYPE_VEC_BOOL?a.ml.PositiveNumber_Vec:t===a.eV.TYPE_ADDRESS?a.ml.Address:t===a.eV.TYPE_VEC_ADDRESS?a.ml.Address_Vec:t===a.eV.TYPE_STRING?a.ml.String:t===a.eV.TYPE_VEC_STRING?a.ml.String_Vec:t===a.eV.TYPE_BOOL?a.ml.Bool:-1,_=(t,e)=>{let s=t.splice(0,1);return 1==s[0]?{bNone:!1,value:w.getInstance().de(e,Uint8Array.from(t))}:(0==s[0]||(0,i.f)(i.I.Fail,"readOption: option invalid"),{bNone:!0,value:b})},p=t=>{let e=t.splice(0,1);if(1==e[0]){let e=g(Uint8Array.from(t)),s=w.getInstance().de(a.eV.TYPE_STRING,Uint8Array.from(t));return t.splice(0,e.value+e.length),{bNone:!1,value:s}}return 0==e[0]||(0,i.f)(i.I.Fail,"readOption: option invalid"),{bNone:!0,value:b}},g=t=>{let e=0,s=0,r=0;for(;;){let i=t[r];if(r+=1,e|=(127&i)<<s,!(128&i))break;s+=7}return{value:e,length:r}},m=(t,e)=>{let s=g(Uint8Array.from(t));t.splice(0,s.length);let r=[];for(let i=0;i<s.value;i++)r.push(e(t,i,s.value));return r},T=(t,e,s)=>t.shift(),l=(t,e,s)=>t.splice(0,8),x=(t,e,s)=>t.splice(0,16),E=(t,e,s)=>t.splice(0,32),O=(t,...e)=>{let s=0;for(const t of e)s+=t.length;const r=new t(s);let i=0;for(const t of e)r.set(t,i),i+=t.length;return r},B=(t,e="payment::Payment<")=>{if(t){const s=t.indexOf(e);if(s>0)return t.slice(s+e.length,t.length-1)}return""},I=(t,e)=>t.length===e.length&&!t.some((t=>!e.includes(t))),y=t=>{for(var e=[],s=0;s<t.length;s++)-1==e.indexOf(t[s])&&e.push(t[s]);return e};function C(t){return t&&t[0].toUpperCase()+t.slice(1)}function f(t){var e=[];let s=t.indexOf("<");return s>=0&&(e=t.slice(s+1,t.length-1).split(",")),e}class w{bcs=new r.r8((0,r.PN)());static _instance;constructor(){this.bcs.registerEnumType("Option<T>",{none:null,some:"T"}),this.bcs.registerStructType("EntStruct",{avatar:"vector<u8>",resource:"Option<address>",safer_name:"vector<string>",safer_value:"vector<string>",like:r.r8.U32,dislike:r.r8.U32}),this.bcs.registerStructType("TagStruct",{nick:"string",tags:"vector<string>"}),this.bcs.registerStructType("PersonalInfo",{name:"vector<u8>",description:"vector<u8>",avatar:r.r8.STRING,twitter:r.r8.STRING,discord:r.r8.STRING,homepage:r.r8.STRING}),this.bcs.registerStructType("OptionAddress",{address:"Option<address>"}),this.bcs.registerStructType("Guards",{guards:"vector<OptionAddress>"}),this.bcs.registerStructType("Perm",{index:r.r8.U64,guard:"Option<address>"}),this.bcs.registerStructType("Perms",{perms:"vector<Perm>"})}static getInstance(){return w._instance||(w._instance=new w),w._instance}ser_option_u32(t){return this.bcs.ser("Option<u32>",{some:t}).toBytes()}ser(t,e){if("string"==typeof t)return this.bcs.ser(t,e).toBytes();switch(t){case a.eV.TYPE_BOOL:return this.bcs.ser(r.r8.BOOL,e).toBytes();case a.eV.TYPE_ADDRESS:return this.bcs.ser(r.r8.ADDRESS,e).toBytes();case a.eV.TYPE_U64:return this.bcs.ser(r.r8.U64,e).toBytes();case a.eV.TYPE_U8:return this.bcs.ser(r.r8.U8,e).toBytes();case a.eV.TYPE_VEC_U8:return this.bcs.ser("vector<u8>",e).toBytes();case a.eV.TYPE_U128:return this.bcs.ser(r.r8.U128,e).toBytes();case a.eV.TYPE_VEC_ADDRESS:return this.bcs.ser("vector<address>",e).toBytes();case a.eV.TYPE_VEC_BOOL:return this.bcs.ser("vector<bool>",e).toBytes();case a.eV.TYPE_VEC_VEC_U8:return this.bcs.ser("vector<vector<u8>>",e).toBytes();case a.eV.TYPE_VEC_U64:return this.bcs.ser("vector<u64>",e).toBytes();case a.eV.TYPE_VEC_U128:return this.bcs.ser("vector<u128>",e).toBytes();case a.eV.TYPE_OPTION_ADDRESS:return this.bcs.ser("Option<address>",{some:e}).toBytes();case a.eV.TYPE_OPTION_BOOL:return this.bcs.ser("Option<bool>",{some:e}).toBytes();case a.eV.TYPE_OPTION_U8:return this.bcs.ser("Option<u8>",{some:e}).toBytes();case a.eV.TYPE_OPTION_U64:return this.bcs.ser("Option<u64>",{some:e}).toBytes();case a.eV.TYPE_OPTION_U128:return this.bcs.ser("Option<u128>",{some:e}).toBytes();case a.eV.TYPE_OPTION_U256:return this.bcs.ser("Option<u256>",{some:e}).toBytes();case a.eV.TYPE_OPTION_STRING:return this.bcs.ser("Option<string>",{some:e}).toBytes();case a.eV.TYPE_VEC_U256:return this.bcs.ser("vector<u256>",e).toBytes();case a.eV.TYPE_U256:return this.bcs.ser(r.r8.U256,e).toBytes();case a.eV.TYPE_STRING:const t=(new TextEncoder).encode(e);return this.bcs.ser("vector<u8>",t).toBytes();case a.eV.TYPE_VEC_STRING:return this.bcs.ser("vector<vector<u8>>",e.map((t=>(new TextEncoder).encode(t)))).toBytes();default:(0,i.f)(i.I.bcsTypeInvalid,"ser")}return new Uint8Array}de(t,e){if("string"==typeof t)return this.bcs.de(t,e);switch(t){case a.eV.TYPE_BOOL:return this.bcs.de(r.r8.BOOL,e);case a.eV.TYPE_ADDRESS:return this.bcs.de(r.r8.ADDRESS,e);case a.eV.TYPE_U64:return this.bcs.de(r.r8.U64,e);case a.eV.TYPE_U8:return this.bcs.de(r.r8.U8,e);case a.eV.TYPE_VEC_U8:return this.bcs.de("vector<u8>",e);case a.eV.TYPE_U128:return this.bcs.de(r.r8.U128,e);case a.eV.TYPE_VEC_ADDRESS:return this.bcs.de("vector<address>",e);case a.eV.TYPE_VEC_BOOL:return this.bcs.de("vector<bool>",e);case a.eV.TYPE_VEC_VEC_U8:return this.bcs.de("vector<vector<u8>>",e);case a.eV.TYPE_VEC_U64:return this.bcs.de("vector<u64>",e);case a.eV.TYPE_VEC_U128:return this.bcs.de("vector<u128>",e);case a.eV.TYPE_OPTION_ADDRESS:return this.bcs.de("Option<address>",e);case a.eV.TYPE_OPTION_BOOL:return this.bcs.de("Option<bool>",e);case a.eV.TYPE_OPTION_U8:return this.bcs.de("Option<u8>",e);case a.eV.TYPE_OPTION_U64:return this.bcs.de("Option<u64>",e);case a.eV.TYPE_OPTION_U128:return this.bcs.de("Option<u128>",e);case a.eV.TYPE_OPTION_U256:return this.bcs.de("Option<u256>",e);case a.eV.TYPE_OPTION_STRING:return this.bcs.de("Option<string>",e);case a.eV.TYPE_VEC_U256:return this.bcs.de("vector<u256>",e);case a.eV.TYPE_STRING:return(new TextDecoder).decode(Uint8Array.from(this.bcs.de("vector<u8>",e)));case a.eV.TYPE_VEC_STRING:return this.bcs.de("vector<string>",e);case a.eV.TYPE_U256:return this.bcs.de(r.r8.U256,e);default:(0,i.f)(i.I.bcsTypeInvalid,"de")}}de_ent(t){if(!t||t.length<2)return"";const e=this.bcs.de("vector<u8>",t);return this.bcs.de("EntStruct",Uint8Array.from(e))}de_entInfo(t){if(!t||0===t.length)return;let e=this.bcs.de("PersonalInfo",t);return e.name=(new TextDecoder).decode(Uint8Array.from(e.name)),e.description=(new TextDecoder).decode(Uint8Array.from(e.description)),e}de_tags(t){if(!t||0===t.length)return"";const e=this.bcs.de("vector<u8>",t);return this.bcs.de("TagStruct",Uint8Array.from(e))}de_perms(t){return!t||t.length<1?"":this.bcs.de("Perms",t).perms.map((t=>({index:t?.index,guard:t?.guard?.none?void 0:"0x"+t?.guard?.some})))}}function j(t){const e=(new TextEncoder).encode(t);return new Uint8Array(e.buffer)}function V(t){if(!t)return new Uint8Array(0);const e=[];for(e.unshift(255&t);t>=256;)t>>>=8,e.unshift(255&t);return new Uint8Array(e)}const v=t=>"[object Array]"==Object.prototype.toString.call(t),Z=(t,e)=>{let s=e||{};for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&("object"==typeof t[e]&&null!==t[e]?(s[e]=v(t[e])?[]:{},Z(t[e],s[e])):s[e]=t[e]);return s},P=4e3,A=64,U=1024,J=(t,e)=>w.getInstance().ser(a.eV.TYPE_STRING,t).length<=e,X=t=>J(t,P),S=t=>!(!t||0===t.length)&&J(t,A),k=t=>J(t,A),Y=t=>t.length>0&&t.length<=U&&nt(t),N=t=>!(!t||!(0,n.AP)(t)),R=t=>!!t&&(t.startsWith("0x2::coin::Coin")||t.startsWith("0x0000000000000000000000000000000000000000000000000000000000000002")),D=(t=864e5)=>{const e=Date.now();return Math.floor(e/t)*t},F=(t,e=u,s)=>{if(""===t||void 0===t)return!1;try{const r=BigInt(t);if(r<=e)return void 0===s||r>=s}catch(t){}return!1},G=(t,e=0)=>F(t,o,BigInt(e)),L=(t,e=0)=>F(t,c,BigInt(e)),M=(t,e=0)=>F(t,h,BigInt(e)),W=(t,e=0)=>F(t,u,BigInt(e)),H=t=>{if(!t||0===t.length)return!1;let e=t.split("::");return 3===e.length&&!(!N(e[0])&&"0x2"!=e[0]||0===e[1].length||0===e[2].length)},q=t=>!(!t||0===t.length)&&!(t.split("::").length<3),K=t=>("string"==typeof t&&(t=parseInt(t)),Number.isSafeInteger(t)),z=t=>F(t,BigInt(100),BigInt(0)),Q=(t,e)=>{for(let s=0;s<t.length;s++)if(!e(t[s]))return!1;return!0},$=t=>t>c?c:t;function tt(t){const e=t.trim();if(-1!==e.indexOf(".")){let t=e.length-1;for(;"0"===e[t];)t--;return"."===e[t]&&t--,e.slice(0,t+1)}return e}const et=(t,e)=>{if(!t)return"";if("0"===t)return"0";if(e<=0)return t;var s=e-t.length;return tt(0===s?"."+t:s<0?t.slice(0,Math.abs(s))+"."+t.slice(Math.abs(s)):"."+t.padStart(e,"0"))},st=t=>{if(t){const e="0x2::coin::Coin<";let s=t.indexOf(e);if(s>=0){let r=t.slice(s+e.length,t.length-1);if(-1===r.indexOf("<")){for(;">"==r[r.length-1];)r=r.slice(0,-1);let t=r.lastIndexOf("::");return{isCoin:!0,coin:r,token:r.slice(t+2)}}}}return{isCoin:!1,coin:"",token:""}};function rt(t,e){const s=t.length+1,r=new Uint8Array(s);return r.set([e],0),r.set(t,1),r}function it(t){let e="";var s;return Math.abs(t)<1?(s=parseInt(t.toString().split("e-")[1]))&&(t*=Math.pow(10,s-1),e="0."+new Array(s).join("0")+t.toString().substring(2)):(s=parseInt(t.toString().split("+")[1]))>20&&(s-=20,e=(t/=Math.pow(10,s))+new Array(s+1).join("0")),e}function nt(t){let e;try{e=new URL(t)}catch(t){return!1}return"http:"===e.protocol||"https:"===e.protocol||"ipfs:"===e.protocol}const at=t=>{t.id&&(t?.onBegin&&t.onBegin(t.id),a.Zs.Client().getObject({id:t.id,options:{showContent:!0,showType:!0,showOwner:!0}}).then((e=>{e.error?t?.onObjectErr&&t.onObjectErr(t.id,e.error):t?.onObjectRes&&t.onObjectRes(t.id,e)})).catch((e=>{console.log(e),t?.onObjectErr&&t.onObjectErr(t.id,e)})),a.Zs.Client().getDynamicFields({parentId:t.id}).then((e=>{t?.onDynamicRes&&t.onDynamicRes(t.id,e),e.data.length>0&&a.Zs.Client().multiGetObjects({ids:e.data.map((t=>t.objectId)),options:{showContent:!0}}).then((e=>{t?.onFieldsRes&&t.onFieldsRes(t.id,e)})).catch((e=>{console.log(e),t?.onFieldsErr&&t.onFieldsErr(t.id,e)}))})).catch((e=>{console.log(e),t?.onDynamicErr&&t.onDynamicErr(t.id,e)})))},ot=t=>t?t.substring(0,1).toUpperCase()+t.substring(1):"";function ct(t){return t.some(((e,s)=>t.findIndex((t=>t===e))!==s))}},2871:(t,e,s)=>{s.d(e,{_5:()=>i,mE:()=>c,uE:()=>r});var r,i,n=s(9554),a=s(1609),o=s(5337);!function(t){t[t.PERMISSION=0]="PERMISSION",t[t.GUARD_ONLY_AND_IMMUTABLE=1]="GUARD_ONLY_AND_IMMUTABLE",t[t.BOTH_PERMISSION_AND_GUARD=2]="BOTH_PERMISSION_AND_GUARD"}(r||(r={})),function(t){t[t.WITHDRAW=1]="WITHDRAW",t[t.DEPOSIT=2]="DEPOSIT",t[t.RECEIVE=4]="RECEIVE"}(i||(i={}));class c{token_type;permission;object;txb;get_token_type(){return this.token_type}get_object(){return this.object}static From(t,e,s,r){let i=new c(t,e,s);return i.object=n.Zs.TXB_OBJECT(t,r),i}constructor(t,e,s){this.token_type=e,this.permission=s,this.txb=t,this.object=""}static New(t,e,s,r,i){n.Zs.IsValidObjects([s])||(0,o.f)(o.I.IsValidObjects,"Treasury.New permission, bounty"),(0,a.yW)(r)||(0,o.f)(o.I.IsValidDesription,"Treasury.New.description"),(0,a.Tg)(e)||(0,o.f)(o.I.IsValidArgType,e);let h=new c(t,e,s);return h.object=i?t.moveCall({target:n.Zs.Instance().treasuryFn("new_with_passport"),arguments:[i,t.pure.string(r),n.Zs.TXB_OBJECT(t,s)],typeArguments:[e]}):t.moveCall({target:n.Zs.Instance().treasuryFn("new"),arguments:[t.pure.string(r),n.Zs.TXB_OBJECT(t,s)],typeArguments:[e]}),h}launch(){return this.txb.moveCall({target:n.Zs.Instance().treasuryFn("create"),arguments:[n.Zs.TXB_OBJECT(this.txb,this.object)],typeArguments:[this.token_type]})}set_deposit_guard(t,e){t&&!(0,a.jE)(t)&&(0,o.f)(o.I.IsValidAddress,"set_deposit_guard.guard"),e?t?this.txb.moveCall({target:n.Zs.Instance().treasuryFn("deposit_guard_set_with_passport"),arguments:[e,n.Zs.TXB_OBJECT(this.txb,this.object),this.txb.object(t),n.Zs.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.token_type]}):this.txb.moveCall({target:n.Zs.Instance().treasuryFn("deposit_guard_none_with_passport"),arguments:[e,n.Zs.TXB_OBJECT(this.txb,this.object),n.Zs.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.token_type]}):t?this.txb.moveCall({target:n.Zs.Instance().treasuryFn("deposit_guard_set"),arguments:[n.Zs.TXB_OBJECT(this.txb,this.object),this.txb.object(t),n.Zs.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.token_type]}):this.txb.moveCall({target:n.Zs.Instance().treasuryFn("deposit_guard_none"),arguments:[n.Zs.TXB_OBJECT(this.txb,this.object),n.Zs.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.token_type]})}deposit(t,e){n.Zs.IsValidObjects([t.coin])||(0,o.f)(o.I.IsValidObjects,"deposit.param.coin"),(0,a.yW)(t.remark)||(0,o.f)(o.I.IsValidDesription,"deposit.param.remark"),t?.for_object&&!(0,a.jE)(t.for_object)&&(0,o.f)(o.I.IsValidAddress,"deposit.param.for_object"),t?.for_guard&&!(0,a.jE)(t.for_guard)&&(0,o.f)(o.I.IsValidAddress,"deposit.param.for_guard"),void 0===t.index||(0,a.Ec)(t.index)||(0,o.f)(o.I.InvalidParam,"deposit.param.index");const s=this.txb.pure.option("address",t.for_object?t.for_object:void 0),r=this.txb.sharedObjectRef(n.Zs.CLOCK_OBJECT);return e?t.for_guard?this.txb.moveCall({target:n.Zs.Instance().treasuryFn("deposit_forGuard_with_passport"),arguments:[e,n.Zs.TXB_OBJECT(this.txb,this.object),n.Zs.TXB_OBJECT(this.txb,t.coin),this.txb.pure.u64(t.index),this.txb.pure.string(t.remark),s,this.txb.object(t.for_guard),this.txb.object(r),n.Zs.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.token_type]}):this.txb.moveCall({target:n.Zs.Instance().treasuryFn("deposit_with_passport"),arguments:[e,n.Zs.TXB_OBJECT(this.txb,this.object),n.Zs.TXB_OBJECT(this.txb,t.coin),this.txb.pure.u64(t.index),this.txb.pure.string(t.remark),s,this.txb.object(r),n.Zs.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.token_type]}):t.for_guard?this.txb.moveCall({target:n.Zs.Instance().treasuryFn("deposit_forGuard"),arguments:[n.Zs.TXB_OBJECT(this.txb,this.object),n.Zs.TXB_OBJECT(this.txb,t.coin),this.txb.pure.u64(t.index),this.txb.pure.string(t.remark),s,this.txb.object(t.for_guard),this.txb.object(r),n.Zs.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.token_type]}):this.txb.moveCall({target:n.Zs.Instance().treasuryFn("deposit"),arguments:[n.Zs.TXB_OBJECT(this.txb,this.object),n.Zs.TXB_OBJECT(this.txb,t.coin),this.txb.pure.u64(t.index),this.txb.pure.string(t.remark),s,this.txb.object(r),n.Zs.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.token_type]})}receive(t,e,s){n.Zs.IsValidObjects([t,e])||(0,o.f)(o.I.IsValidArray,"receive.payment&received");const r=this.txb.sharedObjectRef(n.Zs.CLOCK_OBJECT);return s?this.txb.moveCall({target:n.Zs.Instance().treasuryFn("receive_with_passport"),arguments:[s,n.Zs.TXB_OBJECT(this.txb,this.object),this.txb.object(e),this.txb.object(t),this.txb.object(r),n.Zs.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.token_type]}):this.txb.moveCall({target:n.Zs.Instance().treasuryFn("receive"),arguments:[n.Zs.TXB_OBJECT(this.txb,this.object),this.txb.object(e),this.txb.object(t),this.txb.object(r),n.Zs.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.token_type]})}withdraw(t,e){if(0===t.items.length)return;(0,a.ij)(t.items,(t=>(0,a.Ec)(t.amount)&&(0,a.jE)(t.address)))||(0,o.f)(o.I.IsValidArray,"withdraw.param.items"),(0,a.yW)(t.remark)||(0,o.f)(o.I.IsValidDesription,"withdraw.param.remark"),(0,a.Ec)(t.index)||(0,o.f)(o.I.IsValidU64,"withdraw.param.index"),t?.for_guard&&!(0,a.jE)(t.for_guard)&&(0,o.f)(o.I.IsValidAddress,"withdraw.param.for_guard"),t?.for_object&&!(0,a.jE)(t.for_object)&&(0,o.f)(o.I.IsValidAddress,"withdraw.param.for_object"),t?.withdraw_guard&&!(0,a.jE)(t.withdraw_guard)&&(0,o.f)(o.I.IsValidAddress,"withdraw.param.withdraw_guard"),t?.withdraw_guard&&!e&&(0,o.f)(o.I.IsValidAddress,"withdraw.param.withdraw_guard");const s=this.txb.pure.option("address",t.for_object?t.for_object:void 0),r=this.txb.sharedObjectRef(n.Zs.CLOCK_OBJECT);return t.withdraw_guard&&e?t.for_guard?this.txb.moveCall({target:n.Zs.Instance().treasuryFn("withdraw_useGuard_forGuard"),arguments:[e,n.Zs.TXB_OBJECT(this.txb,this.object),this.txb.pure.vector("address",t.items.map((t=>t.address))),this.txb.pure.vector("u64",t.items.map((t=>t.amount))),this.txb.pure.u64(t.index),this.txb.pure.string(t.remark),s,this.txb.object(t.for_guard),this.txb.object(r),this.txb.object(t.withdraw_guard)],typeArguments:[this.token_type]}):this.txb.moveCall({target:n.Zs.Instance().treasuryFn("withdraw_useGuard"),arguments:[e,n.Zs.TXB_OBJECT(this.txb,this.object),this.txb.pure.vector("address",t.items.map((t=>t.address))),this.txb.pure.vector("u64",t.items.map((t=>t.amount))),this.txb.pure.u64(t.index),this.txb.pure.string(t.remark),s,this.txb.object(r),this.txb.object(t.withdraw_guard)],typeArguments:[this.token_type]}):e?t.for_guard?this.txb.moveCall({target:n.Zs.Instance().treasuryFn("withdraw_forGuard_with_passport"),arguments:[e,n.Zs.TXB_OBJECT(this.txb,this.object),this.txb.pure.vector("address",t.items.map((t=>t.address))),this.txb.pure.vector("u64",t.items.map((t=>t.amount))),this.txb.pure.u64(t.index),this.txb.pure.string(t.remark),s,this.txb.object(t.for_guard),this.txb.object(r),n.Zs.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.token_type]}):this.txb.moveCall({target:n.Zs.Instance().treasuryFn("withdraw_with_passport"),arguments:[e,n.Zs.TXB_OBJECT(this.txb,this.object),this.txb.pure.vector("address",t.items.map((t=>t.address))),this.txb.pure.vector("u64",t.items.map((t=>t.amount))),this.txb.pure.u64(t.index),this.txb.pure.string(t.remark),s,this.txb.object(r),n.Zs.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.token_type]}):t.for_guard?this.txb.moveCall({target:n.Zs.Instance().treasuryFn("withdraw_forGuard"),arguments:[n.Zs.TXB_OBJECT(this.txb,this.object),this.txb.pure.vector("address",t.items.map((t=>t.address))),this.txb.pure.vector("u64",t.items.map((t=>t.amount))),this.txb.pure.u64(t.index),this.txb.pure.string(t.remark),s,this.txb.object(t.for_guard),this.txb.object(r),n.Zs.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.token_type]}):this.txb.moveCall({target:n.Zs.Instance().treasuryFn("withdraw"),arguments:[n.Zs.TXB_OBJECT(this.txb,this.object),this.txb.pure.vector("address",t.items.map((t=>t.address))),this.txb.pure.vector("u64",t.items.map((t=>t.amount))),this.txb.pure.u64(t.index),this.txb.pure.string(t.remark),s,this.txb.object(r),n.Zs.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.token_type]})}set_description(t,e){(0,a.yW)(t)||(0,o.f)(o.I.IsValidDesription,"set_description.description"),e?this.txb.moveCall({target:n.Zs.Instance().treasuryFn("description_set_with_passport"),arguments:[e,n.Zs.TXB_OBJECT(this.txb,this.object),this.txb.pure.string(t),n.Zs.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.token_type]}):this.txb.moveCall({target:n.Zs.Instance().treasuryFn("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.token_type]})}set_withdraw_mode(t,e){e?this.txb.moveCall({target:n.Zs.Instance().treasuryFn("withdraw_mode_set_with_passport"),arguments:[e,n.Zs.TXB_OBJECT(this.txb,this.object),this.txb.pure.u8(t),n.Zs.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.token_type]}):this.txb.moveCall({target:n.Zs.Instance().treasuryFn("withdraw_mode_set"),arguments:[n.Zs.TXB_OBJECT(this.txb,this.object),this.txb.pure.u8(t),n.Zs.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.token_type]})}add_withdraw_guard(t,e,s){(0,a.jE)(t)||(0,o.f)(o.I.IsValidAddress,"add_withdraw_guard.guard"),(0,a.Ec)(e)||(0,o.f)(o.I.IsValidU64,"add_withdraw_guard.amount"),s?this.txb.moveCall({target:n.Zs.Instance().treasuryFn("withdraw_guard_add_with_passport"),arguments:[s,n.Zs.TXB_OBJECT(this.txb,this.object),this.txb.object(t),this.txb.pure.u64(e),n.Zs.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.token_type]}):this.txb.moveCall({target:n.Zs.Instance().treasuryFn("withdraw_guard_add"),arguments:[n.Zs.TXB_OBJECT(this.txb,this.object),this.txb.object(t),this.txb.pure.u64(e),n.Zs.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.token_type]})}remove_withdraw_guard(t,e,s){(0!==t.length||e)&&((0,a.ij)(t,a.jE)||(0,o.f)(o.I.IsValidArray,"add_withdraw_guard.guard"),s?e?this.txb.moveCall({target:n.Zs.Instance().treasuryFn("withdraw_guard_remove_all_with_passport"),arguments:[s,n.Zs.TXB_OBJECT(this.txb,this.object),n.Zs.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.token_type]}):this.txb.moveCall({target:n.Zs.Instance().treasuryFn("withdraw_guard_remove_with_passport"),arguments:[s,n.Zs.TXB_OBJECT(this.txb,this.object),this.txb.pure.vector("address",t),n.Zs.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.token_type]}):e?this.txb.moveCall({target:n.Zs.Instance().treasuryFn("withdraw_guard_remove_all"),arguments:[n.Zs.TXB_OBJECT(this.txb,this.object),n.Zs.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.token_type]}):this.txb.moveCall({target:n.Zs.Instance().treasuryFn("withdraw_guard_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.token_type]}))}change_permission(t){n.Zs.IsValidObjects([t])||(0,o.f)(o.I.IsValidObjects,"change_permission.new_permission"),this.txb.moveCall({target:n.Zs.Instance().treasuryFn("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.token_type]}),this.permission=t}static parseObjectType=t=>(0,a.q5)(t,"treasury::Treasury<");static MAX_WITHDRAW_GUARD_COUNT=16}},3857:(t,e,s)=>{s.d(e,{S:()=>a});var r=s(9554),i=s(1609),n=s(5337);class a{object;txb;get_object(){return this.object}constructor(t){this.txb=t,this.object=""}static From(t){let e=new a(t);return e.object=r.Zs.TXB_OBJECT(t,r.Zs.Instance().objectWowok()),e}register_grantor(t,e){(0,i.S7)(t)||(0,n.f)(n.I.IsValidName,"register_grantor"),r.Zs.IsValidObjects([e])||(0,n.f)(n.I.IsValidObjects,"register_grantor");const s=this.txb.sharedObjectRef(r.Zs.CLOCK_OBJECT);this.txb.moveCall({target:r.Zs.Instance().wowokFn("grantor_register"),arguments:[r.Zs.TXB_OBJECT(this.txb,this.object),this.txb.pure.string(t),this.txb.object(s),r.Zs.TXB_OBJECT(this.txb,e)]})}grantor_time_expand_1year(t){(0,i.jE)(t)||(0,n.f)(n.I.IsValidAddress,"grantor_time_expand_1year"),this.txb.moveCall({target:r.Zs.Instance().wowokFn("grantor_time_expand_1year"),arguments:[r.Zs.TXB_OBJECT(this.txb,this.object),this.txb.pure.address(t)]})}grantor_rename(t){(0,i.S7)(t)||(0,n.f)(n.I.IsValidName,"grantor_rename"),this.txb.moveCall({target:r.Zs.Instance().wowokFn("grantor_time_expand_1year"),arguments:[r.Zs.TXB_OBJECT(this.txb,this.object),this.txb.pure.string(t)]})}mint(t,e){(0,i.jE)(e)||(0,n.f)(n.I.IsValidAddress,"mint"),(0,i.Ec)(t)||(0,n.f)(n.I.IsValidU64,"mint"),this.txb.moveCall({target:r.Zs.Instance().baseWowokFn("mint"),arguments:[r.Zs.TXB_OBJECT(this.txb,r.Zs.Instance().objectTreasuryCap()),this.txb.pure.u64(t),this.txb.pure.address(e)]})}oracle(t,e){return(0,i.yW)(t)||(0,n.f)(n.I.IsValidDesription,"oracle.description"),r.Zs.IsValidObjects([e])||(0,n.f)(n.I.IsValidObjects,"oracle.permission"),this.txb.moveCall({target:r.Zs.Instance().wowokFn("oracle_repository"),arguments:[r.Zs.TXB_OBJECT(this.txb,r.Zs.Instance().objectOracle()),this.txb.pure.string(t),this.txb.object(e)]})}}}}]);