(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[384],{2719:function(e,r,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/execute",function(){return t(2545)}])},2545:function(e,r,t){"use strict";t.r(r);var n=t(4051),a=t.n(n),u=t(5893),i=t(7294),o=t(2962),c=t(514),l=t(646),s=t(1294),f=t(4261),d=t(9441);function p(e,r,t,n,a,u,i){try{var o=e[u](i),c=o.value}catch(l){return void t(l)}o.done?r(c):Promise.resolve(c).then(n,a)}function v(e){return function(){var r=this,t=arguments;return new Promise((function(n,a){var u=e.apply(r,t);function i(e){p(u,n,a,i,o,"next",e)}function o(e){p(u,n,a,i,o,"throw",e)}i(void 0)}))}}function h(e){try{return JSON.parse(e)}catch(r){return e}}var x=function(){var e=(0,s.useWallet)(),r=e.wallet,t=e.publicKey,n=(0,i.useState)(""),c=n[0],p=n[1],x=(0,i.useState)(""),y=x[0],m=x[1],g=(0,i.useState)(""),w=g[0],b=g[1],k=(0,i.useState)(),E=k[0],j=k[1],N=(0,i.useState)(),_=N[0],C=N[1],P=(0,i.useState)(),S=P[0],L=P[1];(0,i.useEffect)((function(){var e;return _&&(e=setInterval((function(){F(_)}),1e3)),function(){e&&clearInterval(e)}}),[_]);var T=function(){var e=v(a().mark((function e(n){var u,i,o,l;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n.preventDefault(),t){e.next=3;break}throw new d.WalletNotConnectedError;case 3:return u=w.split("\n").filter((function(e){return""!==e})),i=u.map((function(e){return h(e)})),o=d.Transaction.createTransaction(t,"mainnet",c,y,i,E,!1),e.next=8,(null===r||void 0===r?void 0:r.adapter).requestTransaction(o);case 8:if(e.t0=e.sent,e.t0){e.next=11;break}e.t0="";case 11:l=e.t0,C(l);case 13:case"end":return e.stop()}}),e)})));return function(r){return e.apply(this,arguments)}}(),F=function(){var e=v(a().mark((function e(t){var n;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(null===r||void 0===r?void 0:r.adapter).transactionStatus(t);case 2:n=e.sent,L(n);case 4:case"end":return e.stop()}}),e)})));return function(r){return e.apply(this,arguments)}}();return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(o.PB,{title:"Execute Function",description:"Execute function with Aleo Wallet"}),(0,u.jsxs)(l.Z,{children:[(0,u.jsxs)("form",{noValidate:!0,role:"search",onSubmit:T,className:"relative flex w-full flex-col rounded-full md:w-auto",children:[(0,u.jsxs)("label",{className:"flex w-full items-center justify-between py-4",children:["Program ID:",(0,u.jsx)("input",{className:"h-11 w-10/12 appearance-none rounded-lg border-2 border-gray-200 bg-transparent py-1 text-sm tracking-tighter text-gray-900 outline-none transition-all placeholder:text-gray-600 focus:border-gray-900 ltr:pr-5 ltr:pl-10 rtl:pr-10 dark:border-gray-600 dark:text-white dark:placeholder:text-gray-500 dark:focus:border-gray-500",placeholder:"credits.aleo",onChange:function(e){return p(e.currentTarget.value)},value:c})]}),(0,u.jsxs)("label",{className:"flex w-full items-center justify-between py-4",children:["Function Name:",(0,u.jsx)("input",{className:"h-11 w-10/12 appearance-none rounded-lg border-2 border-gray-200 bg-transparent py-1 text-sm tracking-tighter text-gray-900 outline-none transition-all placeholder:text-gray-600 focus:border-gray-900 ltr:pr-5 ltr:pl-10 rtl:pr-10 dark:border-gray-600 dark:text-white dark:placeholder:text-gray-500 dark:focus:border-gray-500",placeholder:"join",onChange:function(e){return m(e.currentTarget.value)},value:y})]}),(0,u.jsxs)("label",{className:"flex w-full items-center justify-between py-4",children:["Inputs:",(0,u.jsx)("textarea",{className:"w-10/12 appearance-none rounded-lg border-2 border-gray-200 bg-transparent py-1 text-sm tracking-tighter text-gray-900 outline-none transition-all placeholder:text-gray-600 focus:border-gray-900 ltr:pr-5 ltr:pl-10 rtl:pr-10 dark:border-gray-600 dark:text-white dark:placeholder:text-gray-500 dark:focus:border-gray-500",placeholder:"Input arguments separated by a newline",rows:6,onChange:function(e){return b(e.currentTarget.value)},value:w})]}),(0,u.jsxs)("label",{className:"flex w-full items-center justify-between py-4",children:["Fee:",(0,u.jsx)("input",{className:"h-11 w-10/12 appearance-none rounded-lg border-2 border-gray-200 bg-transparent py-1 text-sm tracking-tighter text-gray-900 outline-none transition-all placeholder:text-gray-600 focus:border-gray-900 ltr:pr-5 ltr:pl-10 rtl:pr-10 dark:border-gray-600 dark:text-white dark:placeholder:text-gray-500 dark:focus:border-gray-500",placeholder:"Fee (in microcredits)",onChange:function(e){var r=parseFloat(e.target.value),t=Number.isNaN(r)?void 0:r;j(t)},value:null!==E&&void 0!==E?E:""})]}),(0,u.jsx)("div",{className:"flex items-center justify-center",children:(0,u.jsx)(f.Z,{disabled:!t||!c||!y||void 0===E,type:"submit",className:"shadow-card dark:bg-gray-700 md:h-10 md:px-5 xl:h-12 xl:px-7",children:t?"Submit":"Connect Your Wallet"})})]}),_&&(0,u.jsx)("div",{children:(0,u.jsx)("div",{children:"Transaction status: ".concat(S)})})]})]})};x.getLayout=function(e){return(0,u.jsx)(c.Z,{children:e})},r.default=x},1558:function(e,r,t){"use strict";var n=t(7294),a=t(8387);r.Z=function(e){return void 0===e&&(e={laptopL:1440,laptop:1024,tablet:768}),function(){var r=n.useState(a.isBrowser?window.innerWidth:0),t=r[0],u=r[1];n.useEffect((function(){var e=function(){u(window.innerWidth)};return e(),a.on(window,"resize",e),function(){a.off(window,"resize",e)}}));var i=n.useMemo((function(){return Object.entries(e).sort((function(e,r){return e[1]>=r[1]?1:-1}))}),[e]),o=i.reduce((function(e,r){var n=r[0],a=r[1];return t>=a?n:e}),i[0][0]);return o}}},1190:function(e,r,t){"use strict";t.d(r,{M:function(){return x}});var n=t(7582),a=t(7294),u=t(4735),i=t(8868);function o(){var e=(0,a.useRef)(!1);return(0,i.L)((function(){return e.current=!0,function(){e.current=!1}}),[]),e}var c=t(240),l=t(6681),s=t(6316),f=function(e){var r=e.children,t=e.initial,u=e.isPresent,i=e.onExitComplete,o=e.custom,f=e.presenceAffectsLayout,p=(0,l.h)(d),v=(0,s.M)(),h=(0,a.useMemo)((function(){return{id:v,initial:t,isPresent:u,custom:o,onExitComplete:function(e){var r,t;p.set(e,!0);try{for(var a=(0,n.__values)(p.values()),u=a.next();!u.done;u=a.next()){if(!u.value)return}}catch(o){r={error:o}}finally{try{u&&!u.done&&(t=a.return)&&t.call(a)}finally{if(r)throw r.error}}null===i||void 0===i||i()},register:function(e){return p.set(e,!1),function(){return p.delete(e)}}}}),f?void 0:[u]);return(0,a.useMemo)((function(){p.forEach((function(e,r){return p.set(r,!1)}))}),[u]),a.useEffect((function(){!u&&!p.size&&(null===i||void 0===i||i())}),[u]),a.createElement(c.O.Provider,{value:h},r)};function d(){return new Map}var p=t(5364),v=t(5411),h=function(e){return e.key||""};var x=function(e){var r=e.children,t=e.custom,c=e.initial,l=void 0===c||c,s=e.onExitComplete,d=e.exitBeforeEnter,x=e.presenceAffectsLayout,y=void 0===x||x,m=(0,n.__read)(function(){var e=o(),r=(0,n.__read)((0,a.useState)(0),2),t=r[0],i=r[1],c=(0,a.useCallback)((function(){e.current&&i(t+1)}),[t]);return[(0,a.useCallback)((function(){return u.ZP.postRender(c)}),[c]),t]}(),1),g=m[0],w=(0,a.useContext)(p.p).forceRender;w&&(g=w);var b=o(),k=function(e){var r=[];return a.Children.forEach(e,(function(e){(0,a.isValidElement)(e)&&r.push(e)})),r}(r),E=k,j=new Set,N=(0,a.useRef)(E),_=(0,a.useRef)(new Map).current,C=(0,a.useRef)(!0);if((0,i.L)((function(){C.current=!1,function(e,r){e.forEach((function(e){var t=h(e);r.set(t,e)}))}(k,_),N.current=E})),(0,v.z)((function(){C.current=!0,_.clear(),j.clear()})),C.current)return a.createElement(a.Fragment,null,E.map((function(e){return a.createElement(f,{key:h(e),isPresent:!0,initial:!!l&&void 0,presenceAffectsLayout:y},e)})));E=(0,n.__spreadArray)([],(0,n.__read)(E),!1);for(var P=N.current.map(h),S=k.map(h),L=P.length,T=0;T<L;T++){var F=P[T];-1===S.indexOf(F)&&j.add(F)}return d&&j.size&&(E=[]),j.forEach((function(e){if(-1===S.indexOf(e)){var r=_.get(e);if(r){var n=P.indexOf(e);E.splice(n,0,a.createElement(f,{key:h(r),isPresent:!1,onExitComplete:function(){_.delete(e),j.delete(e);var r=N.current.findIndex((function(r){return r.key===e}));if(N.current.splice(r,1),!j.size){if(N.current=k,!1===b.current)return;g(),s&&s()}},custom:t,presenceAffectsLayout:y},r))}}})),E=E.map((function(e){var r=e.key;return j.has(r)?e:a.createElement(f,{key:h(e),isPresent:!0,presenceAffectsLayout:y},e)})),a.createElement(a.Fragment,null,j.size?E:E.map((function(e){return(0,a.cloneElement)(e)})))}}},function(e){e.O(0,[351,664,566,12,131,220,109,774,888,179],(function(){return r=2719,e(e.s=r);var r}));var r=e.O();_N_E=r}]);