create-leo-app 0.8.4 → 0.8.7
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/index.mjs +8 -8
- package/package.json +3 -1
- package/template-extension/package.json +1 -1
- package/template-extension/src/service_worker.js +1 -1
- package/template-nextjs-ts/package.json +2 -2
- package/template-node/package.json +1 -1
- package/template-node-ts/package.json +1 -1
- package/template-offline-public-transaction-ts/README.md +13 -17
- package/template-offline-public-transaction-ts/package.json +1 -1
- package/template-offline-public-transaction-ts/src/helpers.ts +1 -1
- package/template-offline-public-transaction-ts/src/index.ts +59 -39
- package/template-react-leo/package.json +2 -2
- package/template-react-leo/src/App.jsx +1 -1
- package/template-react-managed-worker/package.json +2 -2
- package/template-react-ts/package.json +2 -2
- package/template-react-ts/src/App.tsx +1 -1
- package/template-react-ts/src/components/Sidebar.jsx +47 -0
- package/template-react-ts/src/pages/AuctioneerPage.jsx +144 -0
- package/template-react-ts/src/pages/BidderPage.jsx +142 -0
- package/template-vanilla/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import T from"node:fs";import P from"node:path";import{fileURLToPath as ye}from"node:url";import Se from"readline";import xe from"events";function Pt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var V,Ct;function $e(){if(Ct)return V;Ct=1;function e(t,l){var d=t;l.slice(0,-1).forEach(function(m){d=d[m]||{}});var i=l[l.length-1];return i in d}function r(t){return typeof t=="number"||/^0x[0-9a-f]+$/i.test(t)?!0:/^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(t)}function c(t,l){return l==="constructor"&&typeof t[l]=="function"||l==="__proto__"}return V=function(t,l){l||(l={});var d={bools:{},strings:{},unknownFn:null};typeof l.unknown=="function"&&(d.unknownFn=l.unknown),typeof l.boolean=="boolean"&&l.boolean?d.allBools=!0:[].concat(l.boolean).filter(Boolean).forEach(function(w){d.bools[w]=!0});var i={};function m(w){return i[w].some(function(M){return d.bools[M]})}Object.keys(l.alias||{}).forEach(function(w){i[w]=[].concat(l.alias[w]),i[w].forEach(function(M){i[M]=[w].concat(i[w].filter(function(R){return M!==R}))})}),[].concat(l.string).filter(Boolean).forEach(function(w){d.strings[w]=!0,i[w]&&[].concat(i[w]).forEach(function(M){d.strings[M]=!0})});var o=l.default||{},n={_:[]};function s(w,M){return d.allBools&&/^--[^=]+$/.test(M)||d.strings[w]||d.bools[w]||i[w]}function u(w,M,R){for(var $=w,N=0;N<M.length-1;N++){var E=M[N];if(c($,E))return;$[E]===void 0&&($[E]={}),($[E]===Object.prototype||$[E]===Number.prototype||$[E]===String.prototype)&&($[E]={}),$[E]===Array.prototype&&($[E]=[]),$=$[E]}var I=M[M.length-1];c($,I)||(($===Object.prototype||$===Number.prototype||$===String.prototype)&&($={}),$===Array.prototype&&($=[]),$[I]===void 0||d.bools[I]||typeof $[I]=="boolean"?$[I]=R:Array.isArray($[I])?$[I].push(R):$[I]=[$[I],R])}function p(w,M,R){if(!(R&&d.unknownFn&&!s(w,R)&&d.unknownFn(R)===!1)){var $=!d.strings[w]&&r(M)?Number(M):M;u(n,w.split("."),$),(i[w]||[]).forEach(function(N){u(n,N.split("."),$)})}}Object.keys(d.bools).forEach(function(w){p(w,o[w]===void 0?!1:o[w])});var a=[];t.indexOf("--")!==-1&&(a=t.slice(t.indexOf("--")+1),t=t.slice(0,t.indexOf("--")));for(var h=0;h<t.length;h++){var f=t[h],g,x;if(/^--.+=/.test(f)){var y=f.match(/^--([^=]+)=([\s\S]*)$/);g=y[1];var S=y[2];d.bools[g]&&(S=S!=="false"),p(g,S,f)}else if(/^--no-.+/.test(f))g=f.match(/^--no-(.+)/)[1],p(g,!1,f);else if(/^--.+/.test(f))g=f.match(/^--(.+)/)[1],x=t[h+1],x!==void 0&&!/^(-|--)[^-]/.test(x)&&!d.bools[g]&&!d.allBools&&(!i[g]||!m(g))?(p(g,x,f),h+=1):/^(true|false)$/.test(x)?(p(g,x==="true",f),h+=1):p(g,d.strings[g]?"":!0,f);else if(/^-[^-]+/.test(f)){for(var v=f.slice(1,-1).split(""),b=!1,O=0;O<v.length;O++){if(x=f.slice(O+2),x==="-"){p(v[O],x,f);continue}if(/[A-Za-z]/.test(v[O])&&x[0]==="="){p(v[O],x.slice(1),f),b=!0;break}if(/[A-Za-z]/.test(v[O])&&/-?\d+(\.\d*)?(e-?\d+)?$/.test(x)){p(v[O],x,f),b=!0;break}if(v[O+1]&&v[O+1].match(/\W/)){p(v[O],f.slice(O+2),f),b=!0;break}else p(v[O],d.strings[v[O]]?"":!0,f)}g=f.slice(-1)[0],!b&&g!=="-"&&(t[h+1]&&!/^(-|--)[^-]/.test(t[h+1])&&!d.bools[g]&&(!i[g]||!m(g))?(p(g,t[h+1],f),h+=1):t[h+1]&&/^(true|false)$/.test(t[h+1])?(p(g,t[h+1]==="true",f),h+=1):p(g,d.strings[g]?"":!0,f))}else if((!d.unknownFn||d.unknownFn(f)!==!1)&&n._.push(d.strings._||!r(f)?f:Number(f)),l.stopEarly){n._.push.apply(n._,t.slice(h+1));break}}return Object.keys(o).forEach(function(w){e(n,w.split("."))||(u(n,w.split("."),o[w]),(i[w]||[]).forEach(function(M){u(n,M.split("."),o[w])}))}),l["--"]?n["--"]=a.slice():a.forEach(function(w){n._.push(w)}),n},V}var Me=$e();const Oe=Pt(Me);var B={},U,Dt;function C(){if(Dt)return U;Dt=1;const{FORCE_COLOR:e,NODE_DISABLE_COLORS:r,TERM:c}=process.env,t={enabled:!r&&c!=="dumb"&&e!=="0",reset:i(0,0),bold:i(1,22),dim:i(2,22),italic:i(3,23),underline:i(4,24),inverse:i(7,27),hidden:i(8,28),strikethrough:i(9,29),black:i(30,39),red:i(31,39),green:i(32,39),yellow:i(33,39),blue:i(34,39),magenta:i(35,39),cyan:i(36,39),white:i(37,39),gray:i(90,39),grey:i(90,39),bgBlack:i(40,49),bgRed:i(41,49),bgGreen:i(42,49),bgYellow:i(43,49),bgBlue:i(44,49),bgMagenta:i(45,49),bgCyan:i(46,49),bgWhite:i(47,49)};function l(m,o){let n=0,s,u="",p="";for(;n<m.length;n++)s=m[n],u+=s.open,p+=s.close,o.includes(s.close)&&(o=o.replace(s.rgx,s.close+s.open));return u+o+p}function d(m,o){let n={has:m,keys:o};return n.reset=t.reset.bind(n),n.bold=t.bold.bind(n),n.dim=t.dim.bind(n),n.italic=t.italic.bind(n),n.underline=t.underline.bind(n),n.inverse=t.inverse.bind(n),n.hidden=t.hidden.bind(n),n.strikethrough=t.strikethrough.bind(n),n.black=t.black.bind(n),n.red=t.red.bind(n),n.green=t.green.bind(n),n.yellow=t.yellow.bind(n),n.blue=t.blue.bind(n),n.magenta=t.magenta.bind(n),n.cyan=t.cyan.bind(n),n.white=t.white.bind(n),n.gray=t.gray.bind(n),n.grey=t.grey.bind(n),n.bgBlack=t.bgBlack.bind(n),n.bgRed=t.bgRed.bind(n),n.bgGreen=t.bgGreen.bind(n),n.bgYellow=t.bgYellow.bind(n),n.bgBlue=t.bgBlue.bind(n),n.bgMagenta=t.bgMagenta.bind(n),n.bgCyan=t.bgCyan.bind(n),n.bgWhite=t.bgWhite.bind(n),n}function i(m,o){let n={open:`\x1B[${m}m`,close:`\x1B[${o}m`,rgx:new RegExp(`\\x1b\\[${o}m`,"g")};return function(s){return this!==void 0&&this.has!==void 0?(this.has.includes(m)||(this.has.push(m),this.keys.push(n)),s===void 0?this:t.enabled?l(this.keys,s+""):s+""):s===void 0?d([m],[n]):t.enabled?l([n],s+""):s+""}}return U=t,U}var
|
|
1
|
+
import T from"node:fs";import P from"node:path";import{fileURLToPath as ye}from"node:url";import Se from"readline";import xe from"events";function Pt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var V,Ct;function $e(){if(Ct)return V;Ct=1;function e(t,l){var d=t;l.slice(0,-1).forEach(function(m){d=d[m]||{}});var i=l[l.length-1];return i in d}function r(t){return typeof t=="number"||/^0x[0-9a-f]+$/i.test(t)?!0:/^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(t)}function c(t,l){return l==="constructor"&&typeof t[l]=="function"||l==="__proto__"}return V=function(t,l){l||(l={});var d={bools:{},strings:{},unknownFn:null};typeof l.unknown=="function"&&(d.unknownFn=l.unknown),typeof l.boolean=="boolean"&&l.boolean?d.allBools=!0:[].concat(l.boolean).filter(Boolean).forEach(function(w){d.bools[w]=!0});var i={};function m(w){return i[w].some(function(M){return d.bools[M]})}Object.keys(l.alias||{}).forEach(function(w){i[w]=[].concat(l.alias[w]),i[w].forEach(function(M){i[M]=[w].concat(i[w].filter(function(R){return M!==R}))})}),[].concat(l.string).filter(Boolean).forEach(function(w){d.strings[w]=!0,i[w]&&[].concat(i[w]).forEach(function(M){d.strings[M]=!0})});var o=l.default||{},n={_:[]};function s(w,M){return d.allBools&&/^--[^=]+$/.test(M)||d.strings[w]||d.bools[w]||i[w]}function u(w,M,R){for(var $=w,N=0;N<M.length-1;N++){var E=M[N];if(c($,E))return;$[E]===void 0&&($[E]={}),($[E]===Object.prototype||$[E]===Number.prototype||$[E]===String.prototype)&&($[E]={}),$[E]===Array.prototype&&($[E]=[]),$=$[E]}var I=M[M.length-1];c($,I)||(($===Object.prototype||$===Number.prototype||$===String.prototype)&&($={}),$===Array.prototype&&($=[]),$[I]===void 0||d.bools[I]||typeof $[I]=="boolean"?$[I]=R:Array.isArray($[I])?$[I].push(R):$[I]=[$[I],R])}function p(w,M,R){if(!(R&&d.unknownFn&&!s(w,R)&&d.unknownFn(R)===!1)){var $=!d.strings[w]&&r(M)?Number(M):M;u(n,w.split("."),$),(i[w]||[]).forEach(function(N){u(n,N.split("."),$)})}}Object.keys(d.bools).forEach(function(w){p(w,o[w]===void 0?!1:o[w])});var a=[];t.indexOf("--")!==-1&&(a=t.slice(t.indexOf("--")+1),t=t.slice(0,t.indexOf("--")));for(var h=0;h<t.length;h++){var f=t[h],g,x;if(/^--.+=/.test(f)){var y=f.match(/^--([^=]+)=([\s\S]*)$/);g=y[1];var S=y[2];d.bools[g]&&(S=S!=="false"),p(g,S,f)}else if(/^--no-.+/.test(f))g=f.match(/^--no-(.+)/)[1],p(g,!1,f);else if(/^--.+/.test(f))g=f.match(/^--(.+)/)[1],x=t[h+1],x!==void 0&&!/^(-|--)[^-]/.test(x)&&!d.bools[g]&&!d.allBools&&(!i[g]||!m(g))?(p(g,x,f),h+=1):/^(true|false)$/.test(x)?(p(g,x==="true",f),h+=1):p(g,d.strings[g]?"":!0,f);else if(/^-[^-]+/.test(f)){for(var v=f.slice(1,-1).split(""),b=!1,O=0;O<v.length;O++){if(x=f.slice(O+2),x==="-"){p(v[O],x,f);continue}if(/[A-Za-z]/.test(v[O])&&x[0]==="="){p(v[O],x.slice(1),f),b=!0;break}if(/[A-Za-z]/.test(v[O])&&/-?\d+(\.\d*)?(e-?\d+)?$/.test(x)){p(v[O],x,f),b=!0;break}if(v[O+1]&&v[O+1].match(/\W/)){p(v[O],f.slice(O+2),f),b=!0;break}else p(v[O],d.strings[v[O]]?"":!0,f)}g=f.slice(-1)[0],!b&&g!=="-"&&(t[h+1]&&!/^(-|--)[^-]/.test(t[h+1])&&!d.bools[g]&&(!i[g]||!m(g))?(p(g,t[h+1],f),h+=1):t[h+1]&&/^(true|false)$/.test(t[h+1])?(p(g,t[h+1]==="true",f),h+=1):p(g,d.strings[g]?"":!0,f))}else if((!d.unknownFn||d.unknownFn(f)!==!1)&&n._.push(d.strings._||!r(f)?f:Number(f)),l.stopEarly){n._.push.apply(n._,t.slice(h+1));break}}return Object.keys(o).forEach(function(w){e(n,w.split("."))||(u(n,w.split("."),o[w]),(i[w]||[]).forEach(function(M){u(n,M.split("."),o[w])}))}),l["--"]?n["--"]=a.slice():a.forEach(function(w){n._.push(w)}),n},V}var Me=$e();const Oe=Pt(Me);var B={},U,Dt;function C(){if(Dt)return U;Dt=1;const{FORCE_COLOR:e,NODE_DISABLE_COLORS:r,TERM:c}=process.env,t={enabled:!r&&c!=="dumb"&&e!=="0",reset:i(0,0),bold:i(1,22),dim:i(2,22),italic:i(3,23),underline:i(4,24),inverse:i(7,27),hidden:i(8,28),strikethrough:i(9,29),black:i(30,39),red:i(31,39),green:i(32,39),yellow:i(33,39),blue:i(34,39),magenta:i(35,39),cyan:i(36,39),white:i(37,39),gray:i(90,39),grey:i(90,39),bgBlack:i(40,49),bgRed:i(41,49),bgGreen:i(42,49),bgYellow:i(43,49),bgBlue:i(44,49),bgMagenta:i(45,49),bgCyan:i(46,49),bgWhite:i(47,49)};function l(m,o){let n=0,s,u="",p="";for(;n<m.length;n++)s=m[n],u+=s.open,p+=s.close,o.includes(s.close)&&(o=o.replace(s.rgx,s.close+s.open));return u+o+p}function d(m,o){let n={has:m,keys:o};return n.reset=t.reset.bind(n),n.bold=t.bold.bind(n),n.dim=t.dim.bind(n),n.italic=t.italic.bind(n),n.underline=t.underline.bind(n),n.inverse=t.inverse.bind(n),n.hidden=t.hidden.bind(n),n.strikethrough=t.strikethrough.bind(n),n.black=t.black.bind(n),n.red=t.red.bind(n),n.green=t.green.bind(n),n.yellow=t.yellow.bind(n),n.blue=t.blue.bind(n),n.magenta=t.magenta.bind(n),n.cyan=t.cyan.bind(n),n.white=t.white.bind(n),n.gray=t.gray.bind(n),n.grey=t.grey.bind(n),n.bgBlack=t.bgBlack.bind(n),n.bgRed=t.bgRed.bind(n),n.bgGreen=t.bgGreen.bind(n),n.bgYellow=t.bgYellow.bind(n),n.bgBlue=t.bgBlue.bind(n),n.bgMagenta=t.bgMagenta.bind(n),n.bgCyan=t.bgCyan.bind(n),n.bgWhite=t.bgWhite.bind(n),n}function i(m,o){let n={open:`\x1B[${m}m`,close:`\x1B[${o}m`,rgx:new RegExp(`\\x1b\\[${o}m`,"g")};return function(s){return this!==void 0&&this.has!==void 0?(this.has.includes(m)||(this.has.push(m),this.keys.push(n)),s===void 0?this:t.enabled?l(this.keys,s+""):s+""):s===void 0?d([m],[n]):t.enabled?l([n],s+""):s+""}}return U=t,U}var J,Et;function Re(){return Et||(Et=1,J=(e,r)=>{if(!(e.meta&&e.name!=="escape")){if(e.ctrl){if(e.name==="a")return"first";if(e.name==="c"||e.name==="d")return"abort";if(e.name==="e")return"last";if(e.name==="g")return"reset"}if(r){if(e.name==="j")return"down";if(e.name==="k")return"up"}return e.name==="return"||e.name==="enter"?"submit":e.name==="backspace"?"delete":e.name==="delete"?"deleteForward":e.name==="abort"?"abort":e.name==="escape"?"exit":e.name==="tab"?"next":e.name==="pagedown"?"nextPage":e.name==="pageup"?"prevPage":e.name==="home"?"home":e.name==="end"?"end":e.name==="up"?"up":e.name==="down"?"down":e.name==="right"?"right":e.name==="left"?"left":!1}}),J}var k,qt;function z(){return qt||(qt=1,k=e=>{const r=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))"].join("|"),c=new RegExp(r,"g");return typeof e=="string"?e.replace(c,""):e}),k}var G,It;function D(){if(It)return G;It=1;const e="\x1B",r=`${e}[`,c="\x07",t={to(i,m){return m?`${r}${m+1};${i+1}H`:`${r}${i+1}G`},move(i,m){let o="";return i<0?o+=`${r}${-i}D`:i>0&&(o+=`${r}${i}C`),m<0?o+=`${r}${-m}A`:m>0&&(o+=`${r}${m}B`),o},up:(i=1)=>`${r}${i}A`,down:(i=1)=>`${r}${i}B`,forward:(i=1)=>`${r}${i}C`,backward:(i=1)=>`${r}${i}D`,nextLine:(i=1)=>`${r}E`.repeat(i),prevLine:(i=1)=>`${r}F`.repeat(i),left:`${r}G`,hide:`${r}?25l`,show:`${r}?25h`,save:`${e}7`,restore:`${e}8`},l={up:(i=1)=>`${r}S`.repeat(i),down:(i=1)=>`${r}T`.repeat(i)},d={screen:`${r}2J`,up:(i=1)=>`${r}1J`.repeat(i),down:(i=1)=>`${r}J`.repeat(i),line:`${r}2K`,lineEnd:`${r}K`,lineStart:`${r}1K`,lines(i){let m="";for(let o=0;o<i;o++)m+=this.line+(o<i-1?t.up():"");return i&&(m+=t.left),m}};return G={cursor:t,scroll:l,erase:d,beep:c},G}var K,_t;function Te(){if(_t)return K;_t=1;const e=z(),{erase:r,cursor:c}=D(),t=l=>[...e(l)].length;return K=function(l,d){if(!d)return r.line+c.to(0);let i=0;const m=l.split(/\r?\n/);for(let o of m)i+=1+Math.floor(Math.max(t(o)-1,0)/d);return r.lines(i)},K}var W,At;function jt(){if(At)return W;At=1;const e={arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",radioOn:"\u25C9",radioOff:"\u25EF",tick:"\u2714",cross:"\u2716",ellipsis:"\u2026",pointerSmall:"\u203A",line:"\u2500",pointer:"\u276F"},r={arrowUp:e.arrowUp,arrowDown:e.arrowDown,arrowLeft:e.arrowLeft,arrowRight:e.arrowRight,radioOn:"(*)",radioOff:"( )",tick:"\u221A",cross:"\xD7",ellipsis:"...",pointerSmall:"\xBB",line:"\u2500",pointer:">"};return W=process.platform==="win32"?r:e,W}var Z,Ft;function Pe(){if(Ft)return Z;Ft=1;const e=C(),r=jt(),c=Object.freeze({password:{scale:1,render:o=>"*".repeat(o.length)},emoji:{scale:2,render:o=>"\u{1F603}".repeat(o.length)},invisible:{scale:0,render:o=>""},default:{scale:1,render:o=>`${o}`}}),t=o=>c[o]||c.default,l=Object.freeze({aborted:e.red(r.cross),done:e.green(r.tick),exited:e.yellow(r.cross),default:e.cyan("?")});return Z={styles:c,render:t,symbols:l,symbol:(o,n,s)=>n?l.aborted:s?l.exited:o?l.done:l.default,delimiter:o=>e.gray(o?r.ellipsis:r.pointerSmall),item:(o,n)=>e.gray(o?n?r.pointerSmall:"+":r.line)},Z}var X,Lt;function Ce(){if(Lt)return X;Lt=1;const e=z();return X=function(r,c){let t=String(e(r)||"").split(/\r?\n/);return c?t.map(l=>Math.ceil(l.length/c)).reduce((l,d)=>l+d):t.length},X}var Q,Nt;function De(){return Nt||(Nt=1,Q=(e,r={})=>{const c=Number.isSafeInteger(parseInt(r.margin))?new Array(parseInt(r.margin)).fill(" ").join(""):r.margin||"",t=r.width;return(e||"").split(/\r?\n/g).map(l=>l.split(/\s+/g).reduce((d,i)=>(i.length+c.length>=t||d[d.length-1].length+i.length+1<t?d[d.length-1]+=` ${i}`:d.push(`${c}${i}`),d),[c]).join(`
|
|
2
2
|
`)).join(`
|
|
3
3
|
`)}),Q}var tt,Yt;function Ee(){return Yt||(Yt=1,tt=(e,r,c)=>{c=c||r;let t=Math.min(r-c,e-Math.floor(c/2));t<0&&(t=0);let l=Math.min(t+c,r);return{startIndex:t,endIndex:l}}),tt}var et,Ht;function q(){return Ht||(Ht=1,et={action:Re(),clear:Te(),style:Pe(),strip:z(),figures:jt(),lines:Ce(),wrap:De(),entriesToDisplay:Ee()}),et}var it,Vt;function A(){if(Vt)return it;Vt=1;const e=Se,{action:r}=q(),c=xe,{beep:t,cursor:l}=D(),d=C();class i extends c{constructor(o={}){super(),this.firstRender=!0,this.in=o.stdin||process.stdin,this.out=o.stdout||process.stdout,this.onRender=(o.onRender||(()=>{})).bind(this);const n=e.createInterface({input:this.in,escapeCodeTimeout:50});e.emitKeypressEvents(this.in,n),this.in.isTTY&&this.in.setRawMode(!0);const s=["SelectPrompt","MultiselectPrompt"].indexOf(this.constructor.name)>-1,u=(p,a)=>{let h=r(a,s);h===!1?this._&&this._(p,a):typeof this[h]=="function"?this[h](a):this.bell()};this.close=()=>{this.out.write(l.show),this.in.removeListener("keypress",u),this.in.isTTY&&this.in.setRawMode(!1),n.close(),this.emit(this.aborted?"abort":this.exited?"exit":"submit",this.value),this.closed=!0},this.in.on("keypress",u)}fire(){this.emit("state",{value:this.value,aborted:!!this.aborted,exited:!!this.exited})}bell(){this.out.write(t)}render(){this.onRender(d),this.firstRender&&(this.firstRender=!1)}}return it=i,it}var st,Bt;function qe(){if(Bt)return st;Bt=1;const e=C(),r=A(),{erase:c,cursor:t}=D(),{style:l,clear:d,lines:i,figures:m}=q();class o extends r{constructor(s={}){super(s),this.transform=l.render(s.style),this.scale=this.transform.scale,this.msg=s.message,this.initial=s.initial||"",this.validator=s.validate||(()=>!0),this.value="",this.errorMsg=s.error||"Please Enter A Valid Value",this.cursor=+!!this.initial,this.cursorOffset=0,this.clear=d("",this.out.columns),this.render()}set value(s){!s&&this.initial?(this.placeholder=!0,this.rendered=e.gray(this.transform.render(this.initial))):(this.placeholder=!1,this.rendered=this.transform.render(s)),this._value=s,this.fire()}get value(){return this._value}reset(){this.value="",this.cursor=+!!this.initial,this.cursorOffset=0,this.fire(),this.render()}exit(){this.abort()}abort(){this.value=this.value||this.initial,this.done=this.aborted=!0,this.error=!1,this.red=!1,this.fire(),this.render(),this.out.write(`
|
|
4
4
|
`),this.close()}async validate(){let s=await this.validator(this.value);typeof s=="string"&&(this.errorMsg=s,s=!1),this.error=!s}async submit(){if(this.value=this.value||this.initial,this.cursorOffset=0,this.cursor=this.rendered.length,await this.validate(),this.error){this.red=!0,this.fire(),this.render();return}this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
@@ -9,13 +9,13 @@ ${p?" ":m.pointerSmall} ${e.red().italic(u)}`,"")),this.out.write(c.line+t.to(0)
|
|
|
9
9
|
`),this.close())}first(){this.moveCursor(0),this.render()}last(){this.moveCursor(this.choices.length-1),this.render()}up(){this.cursor===0?this.moveCursor(this.choices.length-1):this.moveCursor(this.cursor-1),this.render()}down(){this.cursor===this.choices.length-1?this.moveCursor(0):this.moveCursor(this.cursor+1),this.render()}next(){this.moveCursor((this.cursor+1)%this.choices.length),this.render()}_(s,u){if(s===" ")return this.submit()}get selection(){return this.choices[this.cursor]}render(){if(this.closed)return;this.firstRender?this.out.write(m.hide):this.out.write(t(this.outputText,this.out.columns)),super.render();let{startIndex:s,endIndex:u}=i(this.cursor,this.choices.length,this.optionsPerPage);if(this.outputText=[c.symbol(this.done,this.aborted),e.bold(this.msg),c.delimiter(!1),this.done?this.selection.title:this.selection.disabled?e.yellow(this.warn):e.gray(this.hint)].join(" "),!this.done){this.outputText+=`
|
|
10
10
|
`;for(let p=s;p<u;p++){let a,h,f="",g=this.choices[p];p===s&&s>0?h=l.arrowUp:p===u-1&&u<this.choices.length?h=l.arrowDown:h=" ",g.disabled?(a=this.cursor===p?e.gray().underline(g.title):e.strikethrough().gray(g.title),h=(this.cursor===p?e.bold().gray(l.pointer)+" ":" ")+h):(a=this.cursor===p?e.cyan().underline(g.title):g.title,h=(this.cursor===p?e.cyan(l.pointer)+" ":" ")+h,g.description&&this.cursor===p&&(f=` - ${g.description}`,(h.length+a.length+f.length>=this.out.columns||g.description.split(/\r?\n/).length>1)&&(f=`
|
|
11
11
|
`+d(g.description,{margin:3,width:this.out.columns})))),this.outputText+=`${h} ${a}${e.gray(f)}
|
|
12
|
-
`}}this.out.write(this.outputText)}}return rt=o,rt}var nt,
|
|
12
|
+
`}}this.out.write(this.outputText)}}return rt=o,rt}var nt,Jt;function _e(){if(Jt)return nt;Jt=1;const e=C(),r=A(),{style:c,clear:t}=q(),{cursor:l,erase:d}=D();class i extends r{constructor(o={}){super(o),this.msg=o.message,this.value=!!o.initial,this.active=o.active||"on",this.inactive=o.inactive||"off",this.initialValue=this.value,this.render()}reset(){this.value=this.initialValue,this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
|
|
13
13
|
`),this.close()}submit(){this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
14
|
-
`),this.close()}deactivate(){if(this.value===!1)return this.bell();this.value=!1,this.render()}activate(){if(this.value===!0)return this.bell();this.value=!0,this.render()}delete(){this.deactivate()}left(){this.deactivate()}right(){this.activate()}down(){this.deactivate()}up(){this.activate()}next(){this.value=!this.value,this.fire(),this.render()}_(o,n){if(o===" ")this.value=!this.value;else if(o==="1")this.value=!0;else if(o==="0")this.value=!1;else return this.bell();this.render()}render(){this.closed||(this.firstRender?this.out.write(l.hide):this.out.write(t(this.outputText,this.out.columns)),super.render(),this.outputText=[c.symbol(this.done,this.aborted),e.bold(this.msg),c.delimiter(this.done),this.value?this.inactive:e.cyan().underline(this.inactive),e.gray("/"),this.value?e.cyan().underline(this.active):this.active].join(" "),this.out.write(d.line+l.to(0)+this.outputText))}}return nt=i,nt}var ot,
|
|
14
|
+
`),this.close()}deactivate(){if(this.value===!1)return this.bell();this.value=!1,this.render()}activate(){if(this.value===!0)return this.bell();this.value=!0,this.render()}delete(){this.deactivate()}left(){this.deactivate()}right(){this.activate()}down(){this.deactivate()}up(){this.activate()}next(){this.value=!this.value,this.fire(),this.render()}_(o,n){if(o===" ")this.value=!this.value;else if(o==="1")this.value=!0;else if(o==="0")this.value=!1;else return this.bell();this.render()}render(){this.closed||(this.firstRender?this.out.write(l.hide):this.out.write(t(this.outputText,this.out.columns)),super.render(),this.outputText=[c.symbol(this.done,this.aborted),e.bold(this.msg),c.delimiter(this.done),this.value?this.inactive:e.cyan().underline(this.inactive),e.gray("/"),this.value?e.cyan().underline(this.active):this.active].join(" "),this.out.write(d.line+l.to(0)+this.outputText))}}return nt=i,nt}var ot,kt;function _(){if(kt)return ot;kt=1;class e{constructor({token:c,date:t,parts:l,locales:d}){this.token=c,this.date=t||new Date,this.parts=l||[this],this.locales=d||{}}up(){}down(){}next(){const c=this.parts.indexOf(this);return this.parts.find((t,l)=>l>c&&t instanceof e)}setTo(c){}prev(){let c=[].concat(this.parts).reverse();const t=c.indexOf(this);return c.find((l,d)=>d>t&&l instanceof e)}toString(){return String(this.date)}}return ot=e,ot}var lt,zt;function Ae(){if(zt)return lt;zt=1;const e=_();class r extends e{constructor(t={}){super(t)}up(){this.date.setHours((this.date.getHours()+12)%24)}down(){this.up()}toString(){let t=this.date.getHours()>12?"pm":"am";return/\A/.test(this.token)?t.toUpperCase():t}}return lt=r,lt}var ht,Gt;function je(){if(Gt)return ht;Gt=1;const e=_(),r=t=>(t=t%10,t===1?"st":t===2?"nd":t===3?"rd":"th");class c extends e{constructor(l={}){super(l)}up(){this.date.setDate(this.date.getDate()+1)}down(){this.date.setDate(this.date.getDate()-1)}setTo(l){this.date.setDate(parseInt(l.substr(-2)))}toString(){let l=this.date.getDate(),d=this.date.getDay();return this.token==="DD"?String(l).padStart(2,"0"):this.token==="Do"?l+r(l):this.token==="d"?d+1:this.token==="ddd"?this.locales.weekdaysShort[d]:this.token==="dddd"?this.locales.weekdays[d]:l}}return ht=c,ht}var at,Kt;function Fe(){if(Kt)return at;Kt=1;const e=_();class r extends e{constructor(t={}){super(t)}up(){this.date.setHours(this.date.getHours()+1)}down(){this.date.setHours(this.date.getHours()-1)}setTo(t){this.date.setHours(parseInt(t.substr(-2)))}toString(){let t=this.date.getHours();return/h/.test(this.token)&&(t=t%12||12),this.token.length>1?String(t).padStart(2,"0"):t}}return at=r,at}var ut,Wt;function Le(){if(Wt)return ut;Wt=1;const e=_();class r extends e{constructor(t={}){super(t)}up(){this.date.setMilliseconds(this.date.getMilliseconds()+1)}down(){this.date.setMilliseconds(this.date.getMilliseconds()-1)}setTo(t){this.date.setMilliseconds(parseInt(t.substr(-this.token.length)))}toString(){return String(this.date.getMilliseconds()).padStart(4,"0").substr(0,this.token.length)}}return ut=r,ut}var ct,Zt;function Ne(){if(Zt)return ct;Zt=1;const e=_();class r extends e{constructor(t={}){super(t)}up(){this.date.setMinutes(this.date.getMinutes()+1)}down(){this.date.setMinutes(this.date.getMinutes()-1)}setTo(t){this.date.setMinutes(parseInt(t.substr(-2)))}toString(){let t=this.date.getMinutes();return this.token.length>1?String(t).padStart(2,"0"):t}}return ct=r,ct}var dt,Xt;function Ye(){if(Xt)return dt;Xt=1;const e=_();class r extends e{constructor(t={}){super(t)}up(){this.date.setMonth(this.date.getMonth()+1)}down(){this.date.setMonth(this.date.getMonth()-1)}setTo(t){t=parseInt(t.substr(-2))-1,this.date.setMonth(t<0?0:t)}toString(){let t=this.date.getMonth(),l=this.token.length;return l===2?String(t+1).padStart(2,"0"):l===3?this.locales.monthsShort[t]:l===4?this.locales.months[t]:String(t+1)}}return dt=r,dt}var ft,Qt;function He(){if(Qt)return ft;Qt=1;const e=_();class r extends e{constructor(t={}){super(t)}up(){this.date.setSeconds(this.date.getSeconds()+1)}down(){this.date.setSeconds(this.date.getSeconds()-1)}setTo(t){this.date.setSeconds(parseInt(t.substr(-2)))}toString(){let t=this.date.getSeconds();return this.token.length>1?String(t).padStart(2,"0"):t}}return ft=r,ft}var pt,te;function Ve(){if(te)return pt;te=1;const e=_();class r extends e{constructor(t={}){super(t)}up(){this.date.setFullYear(this.date.getFullYear()+1)}down(){this.date.setFullYear(this.date.getFullYear()-1)}setTo(t){this.date.setFullYear(t.substr(-4))}toString(){let t=String(this.date.getFullYear()).padStart(4,"0");return this.token.length===2?t.substr(-2):t}}return pt=r,pt}var mt,ee;function Be(){return ee||(ee=1,mt={DatePart:_(),Meridiem:Ae(),Day:je(),Hours:Fe(),Milliseconds:Le(),Minutes:Ne(),Month:Ye(),Seconds:He(),Year:Ve()}),mt}var gt,ie;function Ue(){if(ie)return gt;ie=1;const e=C(),r=A(),{style:c,clear:t,figures:l}=q(),{erase:d,cursor:i}=D(),{DatePart:m,Meridiem:o,Day:n,Hours:s,Milliseconds:u,Minutes:p,Month:a,Seconds:h,Year:f}=Be(),g=/\\(.)|"((?:\\["\\]|[^"])+)"|(D[Do]?|d{3,4}|d)|(M{1,4})|(YY(?:YY)?)|([aA])|([Hh]{1,2})|(m{1,2})|(s{1,2})|(S{1,4})|./g,x={1:({token:v})=>v.replace(/\\(.)/g,"$1"),2:v=>new n(v),3:v=>new a(v),4:v=>new f(v),5:v=>new o(v),6:v=>new s(v),7:v=>new p(v),8:v=>new h(v),9:v=>new u(v)},y={months:"January,February,March,April,May,June,July,August,September,October,November,December".split(","),monthsShort:"Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec".split(","),weekdays:"Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday".split(","),weekdaysShort:"Sun,Mon,Tue,Wed,Thu,Fri,Sat".split(",")};class S extends r{constructor(b={}){super(b),this.msg=b.message,this.cursor=0,this.typed="",this.locales=Object.assign(y,b.locales),this._date=b.initial||new Date,this.errorMsg=b.error||"Please Enter A Valid Value",this.validator=b.validate||(()=>!0),this.mask=b.mask||"YYYY-MM-DD HH:mm:ss",this.clear=t("",this.out.columns),this.render()}get value(){return this.date}get date(){return this._date}set date(b){b&&this._date.setTime(b.getTime())}set mask(b){let O;for(this.parts=[];O=g.exec(b);){let M=O.shift(),R=O.findIndex($=>$!=null);this.parts.push(R in x?x[R]({token:O[R]||M,date:this.date,parts:this.parts,locales:this.locales}):O[R]||M)}let w=this.parts.reduce((M,R)=>(typeof R=="string"&&typeof M[M.length-1]=="string"?M[M.length-1]+=R:M.push(R),M),[]);this.parts.splice(0),this.parts.push(...w),this.reset()}moveCursor(b){this.typed="",this.cursor=b,this.fire()}reset(){this.moveCursor(this.parts.findIndex(b=>b instanceof m)),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
|
|
15
15
|
`),this.close()}async validate(){let b=await this.validator(this.value);typeof b=="string"&&(this.errorMsg=b,b=!1),this.error=!b}async submit(){if(await this.validate(),this.error){this.color="red",this.fire(),this.render();return}this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
16
16
|
`),this.close()}up(){this.typed="",this.parts[this.cursor].up(),this.render()}down(){this.typed="",this.parts[this.cursor].down(),this.render()}left(){let b=this.parts[this.cursor].prev();if(b==null)return this.bell();this.moveCursor(this.parts.indexOf(b)),this.render()}right(){let b=this.parts[this.cursor].next();if(b==null)return this.bell();this.moveCursor(this.parts.indexOf(b)),this.render()}next(){let b=this.parts[this.cursor].next();this.moveCursor(b?this.parts.indexOf(b):this.parts.findIndex(O=>O instanceof m)),this.render()}_(b){/\d/.test(b)&&(this.typed+=b,this.parts[this.cursor].setTo(this.typed),this.render())}render(){this.closed||(this.firstRender?this.out.write(i.hide):this.out.write(t(this.outputText,this.out.columns)),super.render(),this.outputText=[c.symbol(this.done,this.aborted),e.bold(this.msg),c.delimiter(!1),this.parts.reduce((b,O,w)=>b.concat(w===this.cursor&&!this.done?e.cyan().underline(O.toString()):O),[]).join("")].join(" "),this.error&&(this.outputText+=this.errorMsg.split(`
|
|
17
17
|
`).reduce((b,O,w)=>b+`
|
|
18
|
-
${w?" ":l.pointerSmall} ${e.red().italic(O)}`,"")),this.out.write(d.line+i.to(0)+this.outputText))}}return gt=S,gt}var vt,se;function
|
|
18
|
+
${w?" ":l.pointerSmall} ${e.red().italic(O)}`,"")),this.out.write(d.line+i.to(0)+this.outputText))}}return gt=S,gt}var vt,se;function Je(){if(se)return vt;se=1;const e=C(),r=A(),{cursor:c,erase:t}=D(),{style:l,figures:d,clear:i,lines:m}=q(),o=/[0-9]/,n=p=>p!==void 0,s=(p,a)=>{let h=Math.pow(10,a);return Math.round(p*h)/h};class u extends r{constructor(a={}){super(a),this.transform=l.render(a.style),this.msg=a.message,this.initial=n(a.initial)?a.initial:"",this.float=!!a.float,this.round=a.round||2,this.inc=a.increment||1,this.min=n(a.min)?a.min:-1/0,this.max=n(a.max)?a.max:1/0,this.errorMsg=a.error||"Please Enter A Valid Value",this.validator=a.validate||(()=>!0),this.color="cyan",this.value="",this.typed="",this.lastHit=0,this.render()}set value(a){!a&&a!==0?(this.placeholder=!0,this.rendered=e.gray(this.transform.render(`${this.initial}`)),this._value=""):(this.placeholder=!1,this.rendered=this.transform.render(`${s(a,this.round)}`),this._value=s(a,this.round)),this.fire()}get value(){return this._value}parse(a){return this.float?parseFloat(a):parseInt(a)}valid(a){return a==="-"||a==="."&&this.float||o.test(a)}reset(){this.typed="",this.value="",this.fire(),this.render()}exit(){this.abort()}abort(){let a=this.value;this.value=a!==""?a:this.initial,this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
|
|
19
19
|
`),this.close()}async validate(){let a=await this.validator(this.value);typeof a=="string"&&(this.errorMsg=a,a=!1),this.error=!a}async submit(){if(await this.validate(),this.error){this.color="red",this.fire(),this.render();return}let a=this.value;this.value=a!==""?a:this.initial,this.done=!0,this.aborted=!1,this.error=!1,this.fire(),this.render(),this.out.write(`
|
|
20
20
|
`),this.close()}up(){if(this.typed="",this.value===""&&(this.value=this.min-this.inc),this.value>=this.max)return this.bell();this.value+=this.inc,this.color="cyan",this.fire(),this.render()}down(){if(this.typed="",this.value===""&&(this.value=this.min+this.inc),this.value<=this.min)return this.bell();this.value-=this.inc,this.color="cyan",this.fire(),this.render()}delete(){let a=this.value.toString();if(a.length===0)return this.bell();this.value=this.parse(a=a.slice(0,-1))||"",this.value!==""&&this.value<this.min&&(this.value=this.min),this.color="cyan",this.fire(),this.render()}next(){this.value=this.initial,this.fire(),this.render()}_(a,h){if(!this.valid(a))return this.bell();const f=Date.now();if(f-this.lastHit>1e3&&(this.typed=""),this.typed+=a,this.lastHit=f,this.color="cyan",a===".")return this.fire();this.value=Math.min(this.parse(this.typed),this.max),this.value>this.max&&(this.value=this.max),this.value<this.min&&(this.value=this.min),this.fire(),this.render()}render(){this.closed||(this.firstRender||(this.outputError&&this.out.write(c.down(m(this.outputError,this.out.columns)-1)+i(this.outputError,this.out.columns)),this.out.write(i(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[l.symbol(this.done,this.aborted),e.bold(this.msg),l.delimiter(this.done),!this.done||!this.done&&!this.placeholder?e[this.color]().underline(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
|
|
21
21
|
`).reduce((a,h,f)=>a+`
|
|
@@ -29,7 +29,7 @@ Instructions:
|
|
|
29
29
|
`:"")+" enter/return: Complete answer":""}renderOption(s,u,p,a){const h=(u.selected?e.green(l.radioOn):l.radioOff)+" "+a+" ";let f,g;return u.disabled?f=s===p?e.gray().underline(u.title):e.strikethrough().gray(u.title):(f=s===p?e.cyan().underline(u.title):u.title,s===p&&u.description&&(g=` - ${u.description}`,(h.length+f.length+g.length>=this.out.columns||u.description.split(/\r?\n/).length>1)&&(g=`
|
|
30
30
|
`+i(u.description,{margin:h.length,width:this.out.columns})))),h+f+e.gray(g||"")}paginateOptions(s){if(s.length===0)return e.red("No matches for this query.");let{startIndex:u,endIndex:p}=m(this.cursor,s.length,this.optionsPerPage),a,h=[];for(let f=u;f<p;f++)f===u&&u>0?a=l.arrowUp:f===p-1&&p<s.length?a=l.arrowDown:a=" ",h.push(this.renderOption(this.cursor,s[f],f,a));return`
|
|
31
31
|
`+h.join(`
|
|
32
|
-
`)}renderOptions(s){return this.done?"":this.paginateOptions(s)}renderDoneOrInstructions(){if(this.done)return this.value.filter(u=>u.selected).map(u=>u.title).join(", ");const s=[e.gray(this.hint),this.renderInstructions()];return this.value[this.cursor].disabled&&s.push(e.yellow(this.warn)),s.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(r.hide),super.render();let s=[d.symbol(this.done,this.aborted),e.bold(this.msg),d.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(s+=e.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),s+=this.renderOptions(this.value),this.out.write(this.clear+s),this.clear=t(s,this.out.columns)}}return bt=o,bt}var wt,oe;function
|
|
32
|
+
`)}renderOptions(s){return this.done?"":this.paginateOptions(s)}renderDoneOrInstructions(){if(this.done)return this.value.filter(u=>u.selected).map(u=>u.title).join(", ");const s=[e.gray(this.hint),this.renderInstructions()];return this.value[this.cursor].disabled&&s.push(e.yellow(this.warn)),s.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(r.hide),super.render();let s=[d.symbol(this.done,this.aborted),e.bold(this.msg),d.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(s+=e.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),s+=this.renderOptions(this.value),this.out.write(this.clear+s),this.clear=t(s,this.out.columns)}}return bt=o,bt}var wt,oe;function ke(){if(oe)return wt;oe=1;const e=C(),r=A(),{erase:c,cursor:t}=D(),{style:l,clear:d,figures:i,wrap:m,entriesToDisplay:o}=q(),n=(a,h)=>a[h]&&(a[h].value||a[h].title||a[h]),s=(a,h)=>a[h]&&(a[h].title||a[h].value||a[h]),u=(a,h)=>{const f=a.findIndex(g=>g.value===h||g.title===h);return f>-1?f:void 0};class p extends r{constructor(h={}){super(h),this.msg=h.message,this.suggest=h.suggest,this.choices=h.choices,this.initial=typeof h.initial=="number"?h.initial:u(h.choices,h.initial),this.select=this.initial||h.cursor||0,this.i18n={noMatches:h.noMatches||"no matches found"},this.fallback=h.fallback||this.initial,this.clearFirst=h.clearFirst||!1,this.suggestions=[],this.input="",this.limit=h.limit||10,this.cursor=0,this.transform=l.render(h.style),this.scale=this.transform.scale,this.render=this.render.bind(this),this.complete=this.complete.bind(this),this.clear=d("",this.out.columns),this.complete(this.render),this.render()}set fallback(h){this._fb=Number.isSafeInteger(parseInt(h))?parseInt(h):h}get fallback(){let h;return typeof this._fb=="number"?h=this.choices[this._fb]:typeof this._fb=="string"&&(h={title:this._fb}),h||this._fb||{title:this.i18n.noMatches}}moveSelect(h){this.select=h,this.suggestions.length>0?this.value=n(this.suggestions,h):this.value=this.fallback.value,this.fire()}async complete(h){const f=this.completing=this.suggest(this.input,this.choices),g=await f;if(this.completing!==f)return;this.suggestions=g.map((y,S,v)=>({title:s(v,S),value:n(v,S),description:y.description})),this.completing=!1;const x=Math.max(g.length-1,0);this.moveSelect(Math.min(x,this.select)),h&&h()}reset(){this.input="",this.complete(()=>{this.moveSelect(this.initial!==void 0?this.initial:0),this.render()}),this.render()}exit(){this.clearFirst&&this.input.length>0?this.reset():(this.done=this.exited=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
33
33
|
`),this.close())}abort(){this.done=this.aborted=!0,this.exited=!1,this.fire(),this.render(),this.out.write(`
|
|
34
34
|
`),this.close()}submit(){this.done=!0,this.aborted=this.exited=!1,this.fire(),this.render(),this.out.write(`
|
|
35
35
|
`),this.close()}_(h,f){let g=this.input.slice(0,this.cursor),x=this.input.slice(this.cursor);this.input=`${g}${h}${x}`,this.cursor=g.length+1,this.complete(this.render),this.render()}delete(){if(this.cursor===0)return this.bell();let h=this.input.slice(0,this.cursor-1),f=this.input.slice(this.cursor);this.input=`${h}${f}`,this.complete(this.render),this.cursor=this.cursor-1,this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();let h=this.input.slice(0,this.cursor),f=this.input.slice(this.cursor+1);this.input=`${h}${f}`,this.complete(this.render),this.render()}first(){this.moveSelect(0),this.render()}last(){this.moveSelect(this.suggestions.length-1),this.render()}up(){this.select===0?this.moveSelect(this.suggestions.length-1):this.moveSelect(this.select-1),this.render()}down(){this.select===this.suggestions.length-1?this.moveSelect(0):this.moveSelect(this.select+1),this.render()}next(){this.select===this.suggestions.length-1?this.moveSelect(0):this.moveSelect(this.select+1),this.render()}nextPage(){this.moveSelect(Math.min(this.select+this.limit,this.suggestions.length-1)),this.render()}prevPage(){this.moveSelect(Math.max(this.select-this.limit,0)),this.render()}left(){if(this.cursor<=0)return this.bell();this.cursor=this.cursor-1,this.render()}right(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();this.cursor=this.cursor+1,this.render()}renderOption(h,f,g,x){let y,S=g?i.arrowUp:x?i.arrowDown:" ",v=f?e.cyan().underline(h.title):h.title;return S=(f?e.cyan(i.pointer)+" ":" ")+S,h.description&&(y=` - ${h.description}`,(S.length+v.length+y.length>=this.out.columns||h.description.split(/\r?\n/).length>1)&&(y=`
|
|
@@ -45,8 +45,8 @@ Instructions:
|
|
|
45
45
|
Filtered results for: ${this.inputValue?this.inputValue:e.gray("Enter something to filter")}
|
|
46
46
|
`}renderOption(o,n,s){let u;return n.disabled?u=o===s?e.gray().underline(n.title):e.strikethrough().gray(n.title):u=o===s?e.cyan().underline(n.title):n.title,(n.selected?e.green(d.radioOn):d.radioOff)+" "+u}renderDoneOrInstructions(){if(this.done)return this.value.filter(n=>n.selected).map(n=>n.title).join(", ");const o=[e.gray(this.hint),this.renderInstructions(),this.renderCurrentInput()];return this.filteredOptions.length&&this.filteredOptions[this.cursor].disabled&&o.push(e.yellow(this.warn)),o.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(r.hide),super.render();let o=[l.symbol(this.done,this.aborted),e.bold(this.msg),l.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(o+=e.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),o+=this.renderOptions(this.filteredOptions),this.out.write(this.clear+o),this.clear=t(o,this.out.columns)}}return yt=i,yt}var St,he;function Ge(){if(he)return St;he=1;const e=C(),r=A(),{style:c,clear:t}=q(),{erase:l,cursor:d}=D();class i extends r{constructor(o={}){super(o),this.msg=o.message,this.value=o.initial,this.initialValue=!!o.initial,this.yesMsg=o.yes||"yes",this.yesOption=o.yesOption||"(Y/n)",this.noMsg=o.no||"no",this.noOption=o.noOption||"(y/N)",this.render()}reset(){this.value=this.initialValue,this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
|
|
47
47
|
`),this.close()}submit(){this.value=this.value||!1,this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
48
|
-
`),this.close()}_(o,n){return o.toLowerCase()==="y"?(this.value=!0,this.submit()):o.toLowerCase()==="n"?(this.value=!1,this.submit()):this.bell()}render(){this.closed||(this.firstRender?this.out.write(d.hide):this.out.write(t(this.outputText,this.out.columns)),super.render(),this.outputText=[c.symbol(this.done,this.aborted),e.bold(this.msg),c.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:e.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(l.line+d.to(0)+this.outputText))}}return St=i,St}var xt,ae;function Ke(){return ae||(ae=1,xt={TextPrompt:qe(),SelectPrompt:Ie(),TogglePrompt:_e(),DatePrompt:Ue(),NumberPrompt:
|
|
48
|
+
`),this.close()}_(o,n){return o.toLowerCase()==="y"?(this.value=!0,this.submit()):o.toLowerCase()==="n"?(this.value=!1,this.submit()):this.bell()}render(){this.closed||(this.firstRender?this.out.write(d.hide):this.out.write(t(this.outputText,this.out.columns)),super.render(),this.outputText=[c.symbol(this.done,this.aborted),e.bold(this.msg),c.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:e.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(l.line+d.to(0)+this.outputText))}}return St=i,St}var xt,ae;function Ke(){return ae||(ae=1,xt={TextPrompt:qe(),SelectPrompt:Ie(),TogglePrompt:_e(),DatePrompt:Ue(),NumberPrompt:Je(),MultiselectPrompt:ne(),AutocompletePrompt:ke(),AutocompleteMultiselectPrompt:ze(),ConfirmPrompt:Ge()}),xt}var ue;function We(){return ue||(ue=1,function(e){const r=e,c=Ke(),t=i=>i;function l(i,m,o={}){return new Promise((n,s)=>{const u=new c[i](m),p=o.onAbort||t,a=o.onSubmit||t,h=o.onExit||t;u.on("state",m.onState||t),u.on("submit",f=>n(a(f))),u.on("exit",f=>n(h(f))),u.on("abort",f=>s(p(f)))})}r.text=i=>l("TextPrompt",i),r.password=i=>(i.style="password",r.text(i)),r.invisible=i=>(i.style="invisible",r.text(i)),r.number=i=>l("NumberPrompt",i),r.date=i=>l("DatePrompt",i),r.confirm=i=>l("ConfirmPrompt",i),r.list=i=>{const m=i.separator||",";return l("TextPrompt",i,{onSubmit:o=>o.split(m).map(n=>n.trim())})},r.toggle=i=>l("TogglePrompt",i),r.select=i=>l("SelectPrompt",i),r.multiselect=i=>{i.choices=[].concat(i.choices||[]);const m=o=>o.filter(n=>n.selected).map(n=>n.value);return l("MultiselectPrompt",i,{onAbort:m,onSubmit:m})},r.autocompleteMultiselect=i=>{i.choices=[].concat(i.choices||[]);const m=o=>o.filter(n=>n.selected).map(n=>n.value);return l("AutocompleteMultiselectPrompt",i,{onAbort:m,onSubmit:m})};const d=(i,m)=>Promise.resolve(m.filter(o=>o.title.slice(0,i.length).toLowerCase()===i.toLowerCase()));r.autocomplete=i=>(i.suggest=i.suggest||d,i.choices=[].concat(i.choices||[]),l("AutocompletePrompt",i))}(B)),B}var $t,ce;function Ze(){if(ce)return $t;ce=1;const e=We(),r=["suggest","format","onState","validate","onRender","type"],c=()=>{};async function t(m=[],{onSubmit:o=c,onCancel:n=c}={}){const s={},u=t._override||{};m=[].concat(m);let p,a,h,f,g,x;const y=async(S,v,b=!1)=>{if(!(!b&&S.validate&&S.validate(v)!==!0))return S.format?await S.format(v,s):v};for(a of m)if({name:f,type:g}=a,typeof g=="function"&&(g=await g(p,{...s},a),a.type=g),!!g){for(let S in a){if(r.includes(S))continue;let v=a[S];a[S]=typeof v=="function"?await v(p,{...s},x):v}if(x=a,typeof a.message!="string")throw new Error("prompt message is required");if({name:f,type:g}=a,e[g]===void 0)throw new Error(`prompt type (${g}) is not defined`);if(u[a.name]!==void 0&&(p=await y(a,u[a.name]),p!==void 0)){s[f]=p;continue}try{p=t._injected?l(t._injected,a.initial):await e[g](a),s[f]=p=await y(a,p,!0),h=await o(a,p,s)}catch{h=!await n(a,s)}if(h)return s}return s}function l(m,o){const n=m.shift();if(n instanceof Error)throw n;return n===void 0?o:n}function d(m){t._injected=(t._injected||[]).concat(m)}function i(m){t._override=Object.assign({},m)}return $t=Object.assign(t,{prompt:t,prompts:e,inject:d,override:i}),$t}var Xe=Ze();const Qe=Pt(Xe);let j=!0;const L=typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{};let Y=0;if(L.process&&L.process.env&&L.process.stdout){const{FORCE_COLOR:e,NODE_DISABLE_COLORS:r,NO_COLOR:c,TERM:t,COLORTERM:l}=L.process.env;r||c||e==="0"?j=!1:e==="1"||e==="2"||e==="3"?j=!0:t==="dumb"?j=!1:"CI"in L.process.env&&["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE","DRONE"].some(d=>d in L.process.env)?j=!0:j=process.stdout.isTTY,j&&(process.platform==="win32"||l&&(l==="truecolor"||l==="24bit")?Y=3:t&&(t.endsWith("-256color")||t.endsWith("256"))?Y=2:Y=1)}let de={enabled:j,supportLevel:Y};function F(e,r,c=1){const t=`\x1B[${e}m`,l=`\x1B[${r}m`,d=new RegExp(`\\x1b\\[${r}m`,"g");return i=>de.enabled&&de.supportLevel>=c?t+(""+i).replace(d,t)+l:""+i}const H=F(0,0),Mt=F(31,39),fe=F(32,39),pe=F(33,39),ti=F(36,39),ei=F(37,39),ii=F(92,39),Ot=Oe(process.argv.slice(2),{string:["_"]}),Rt=process.cwd(),me=[{name:"vanilla",display:"Vanilla",color:pe,variants:[{name:"vanilla",display:"JavaScript",color:pe}]},{name:"react",display:"React",color:ti,variants:[{name:"react-leo",display:"JavaScript + Leo",color:ii},{name:"react-ts",display:"React + TypeScript",color:Mt},{name:"nextjs-ts",display:"TypeScript + Next.js",color:ei}]},{name:"node",display:"Node.js",color:fe,variants:[{name:"node",display:"Node.js",color:fe}]}],ge=me.map(e=>e.variants&&e.variants.map(r=>r.name)||[e.name]).reduce((e,r)=>e.concat(r),[]),si={_gitignore:".gitignore"},Tt="aleo-project";async function ri(){const e=ve(Ot._[0]),r=Ot.template||Ot.t;let c=e||Tt;const t=()=>c==="."?P.basename(P.resolve()):c;let l;try{l=await Qe([{type:e?null:"text",name:"projectName",message:H("Project name:"),initial:Tt,onState:y=>{c=ve(y.value)||Tt}},{type:()=>!T.existsSync(c)||li(c)?null:"confirm",name:"overwrite",message:()=>(c==="."?"Current directory":`Target directory "${c}"`)+" is not empty. Remove existing files and continue?"},{type:(y,{overwrite:S})=>{if(S===!1)throw new Error(Mt("\u2716")+" Operation cancelled");return null},name:"overwriteChecker"},{type:()=>we(t())?null:"text",name:"packageName",message:H("Package name:"),initial:()=>ni(t()),validate:y=>we(y)||"Invalid package.json name"},{type:r&&ge.includes(r)?null:"select",name:"framework",message:typeof r=="string"&&!ge.includes(r)?H(`"${r}" isn't a valid template. Please choose from below: `):H("Select a framework:"),initial:0,choices:me.map(y=>{const S=y.color;return{title:S(y.display||y.name),value:y}})},{type:y=>y&&y.variants?"select":null,name:"variant",message:H("Select a variant:"),choices:y=>y.variants.map(S=>{const v=S.color;return{title:v(S.display||S.name),value:S.name}})}],{onCancel:()=>{throw new Error(Mt("\u2716")+" Operation cancelled")}})}catch(y){console.log(y.message);return}const{framework:d,overwrite:i,packageName:m,variant:o}=l,n=P.join(Rt,c);i?hi(n):T.existsSync(n)||T.mkdirSync(n,{recursive:!0});let s=o||d?.name||r;const u=ai(process.env.npm_config_user_agent),p=u?u.name:"npm";console.log(`
|
|
49
49
|
Scaffolding project in ${n}...`);const a=P.resolve(ye(import.meta.url),"../..",`template-${s}`),h=(y,S)=>{const v=P.join(n,si[y]??y);S?T.writeFileSync(v,S):be(P.join(a,y),v)},f=T.readdirSync(a);for(const y of f.filter(S=>S!=="package.json"))h(y);const g=JSON.parse(T.readFileSync(P.join(a,"package.json"),"utf-8"));g.name=m||t(),h("package.json",JSON.stringify(g,null,2)+`
|
|
50
|
-
`);const x=P.relative(Rt,n);
|
|
50
|
+
`);const x=P.relative(Rt,n);console.log(`
|
|
51
51
|
Done. Now run:
|
|
52
|
-
`),n!==Rt&&console.log(` cd ${x.includes(" ")?`"${x}"`:x}`),
|
|
52
|
+
`),n!==Rt&&console.log(` cd ${x.includes(" ")?`"${x}"`:x}`),console.log(` ${p} install`),console.log(` ${p} run dev`),console.log()}function ve(e){return e?.trim().replace(/\/+$/g,"")}function be(e,r){T.statSync(e).isDirectory()?oi(e,r):T.copyFileSync(e,r)}function we(e){return/^(?:@[a-z\d\-*~][a-z\d\-*._~]*\/)?[a-z\d\-~][a-z\d\-._~]*$/.test(e)}function ni(e){return e.trim().toLowerCase().replace(/\s+/g,"-").replace(/^[._]/,"").replace(/[^a-z\d\-~]+/g,"-")}function oi(e,r){T.mkdirSync(r,{recursive:!0});for(const c of T.readdirSync(e)){const t=P.resolve(e,c),l=P.resolve(r,c);be(t,l)}}function li(e){const r=T.readdirSync(e);return r.length===0||r.length===1&&r[0]===".git"}function hi(e){if(T.existsSync(e))for(const r of T.readdirSync(e))r!==".git"&&T.rmSync(P.resolve(e,r),{recursive:!0,force:!0})}function ai(e){if(!e)return;const r=e.split(" ")[0].split("/");return{name:r[0],version:r[1]}}ri().catch(e=>{console.error(e)});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-leo-app",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.7",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "GPL-3.0",
|
|
6
6
|
"collaborators": [
|
|
@@ -34,6 +34,8 @@
|
|
|
34
34
|
"kolorist": "^1.8.0",
|
|
35
35
|
"minimist": "^1.2.8",
|
|
36
36
|
"prompts": "^2.4.2",
|
|
37
|
+
"ts-node": "^10.9.2",
|
|
38
|
+
"typescript": "^5.8.2",
|
|
37
39
|
"unbuild": "^3.3.1"
|
|
38
40
|
}
|
|
39
41
|
}
|
|
@@ -13,7 +13,7 @@ async function createOffscreen(path) {
|
|
|
13
13
|
await chrome.offscreen.createDocument({
|
|
14
14
|
url: offscreenUrl,
|
|
15
15
|
reasons: ["WORKERS"],
|
|
16
|
-
justification: "Top-level await and Workers cannot be used in service workers, but they are necessary to use the
|
|
16
|
+
justification: "Top-level await and Workers cannot be used in service workers, but they are necessary to use the Provable SDK.",
|
|
17
17
|
});
|
|
18
18
|
}
|
|
19
19
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
# Offline Transaction Builder
|
|
2
2
|
|
|
3
3
|
## 1. Overview
|
|
4
|
-
### 1.1 Proving Keys for Zero
|
|
5
|
-
To achieve zero
|
|
6
|
-
zero
|
|
4
|
+
### 1.1 Proving Keys for Zero-Knowledge Function Execution
|
|
5
|
+
To achieve zero-knowledge execution, all Aleo functions require a `ProvingKey` and `VerifyingKey` in order to build a
|
|
6
|
+
zero-knowledge zk-SNARK proof of execution. If a user does not possess these keys for a function, they are normally
|
|
7
7
|
downloaded from the internet when the function is called.
|
|
8
8
|
|
|
9
9
|
### 1.2 Key Providers
|
|
@@ -21,31 +21,27 @@ the internet for it. This provides a way to build Aleo execution transactions wi
|
|
|
21
21
|
This pathway is suitable for use-cases such as hardware wallets or air-gapped machines used
|
|
22
22
|
for building secure transactions.
|
|
23
23
|
|
|
24
|
-
### 1.4
|
|
24
|
+
### 1.4 Transaction Types
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
Several types of transactions can be built and executed using this template:
|
|
27
|
+
|
|
28
|
+
`bond_public`
|
|
29
|
+
`unbond_public`
|
|
30
|
+
`claim_unbond_public`
|
|
28
31
|
|
|
29
32
|
## 2. Usage
|
|
30
33
|
|
|
31
|
-
|
|
32
|
-
First run this command online to download the key material to disk:
|
|
34
|
+
`npm run build`
|
|
33
35
|
|
|
34
|
-
`npm
|
|
36
|
+
`npm run dev`
|
|
35
37
|
|
|
36
38
|
Once this command is run, all proving keys for the `transfer_public`, `bond_public`, `unbond_public`, and
|
|
37
|
-
`claim_unbond_public` functions will be downloaded to the
|
|
39
|
+
`claim_unbond_public` functions will be downloaded to the `dist/keys` folder. The machine can then be disconnected from
|
|
38
40
|
the internet and the `OfflineKeyProvider` will search this directory for the function proving keys when building the
|
|
39
41
|
transaction instead of connecting to the internet. Alternatively you can skip the online step entirely by adding the proving key creating this directory manually and
|
|
40
42
|
adding the key material yourself.
|
|
41
43
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
Once the key material is downloaded, turn off your internet connection and run the following command:
|
|
45
|
-
|
|
46
|
-
`npm start`
|
|
47
|
-
|
|
48
|
-
You should see the transactions being built and the resulting transaction IDs printed to the console.
|
|
44
|
+
Once the keys are downloaded to your local machine, the offline transactions will be built without requiring an internet connection.
|
|
49
45
|
|
|
50
46
|
## 3. Notes
|
|
51
47
|
|
|
@@ -28,7 +28,7 @@ async function preDownloadTransferKeys() {
|
|
|
28
28
|
const keysDirPath = path.join(__dirname, "keys");
|
|
29
29
|
await fsPromises.mkdir(keysDirPath, { recursive: true });
|
|
30
30
|
|
|
31
|
-
for (const keyData of [CREDITS_PROGRAM_KEYS.transfer_public, CREDITS_PROGRAM_KEYS.fee_public]) {
|
|
31
|
+
for (const keyData of [CREDITS_PROGRAM_KEYS.transfer_public, CREDITS_PROGRAM_KEYS.fee_public, CREDITS_PROGRAM_KEYS.transfer_public_as_signer]) {
|
|
32
32
|
try {
|
|
33
33
|
keyPaths[keyData.locator] = await downloadAndSaveKey(keyData, keysDirPath);
|
|
34
34
|
} catch (error) {
|
|
@@ -15,10 +15,11 @@ async function buildTransferPublicTxOffline(recipientAddress: Address, amount: n
|
|
|
15
15
|
// Create the proving keys from the key bytes on the offline machine
|
|
16
16
|
console.log("Creating proving keys from local key files");
|
|
17
17
|
const feePublicKeyBytes = await getLocalKey(<string>keyPaths[CREDITS_PROGRAM_KEYS.fee_public.locator]);
|
|
18
|
-
const transferPublicAsSignerKeyBytes = await getLocalKey(<string>keyPaths[CREDITS_PROGRAM_KEYS.transfer_public_as_signer.locator]);
|
|
19
18
|
const feePublicProvingKey = ProvingKey.fromBytes(feePublicKeyBytes);
|
|
20
|
-
const transferPublicProvingKey = ProvingKey.fromBytes(
|
|
21
|
-
|
|
19
|
+
const transferPublicProvingKey = ProvingKey.fromBytes(
|
|
20
|
+
await getLocalKey(<string>keyPaths[CREDITS_PROGRAM_KEYS.transfer_public.locator])
|
|
21
|
+
);
|
|
22
|
+
|
|
22
23
|
// Create an offline key provider
|
|
23
24
|
console.log("Creating offline key provider");
|
|
24
25
|
const offlineKeyProvider = new OfflineKeyProvider();
|
|
@@ -27,10 +28,25 @@ async function buildTransferPublicTxOffline(recipientAddress: Address, amount: n
|
|
|
27
28
|
// keys into the key manager.
|
|
28
29
|
console.log("Inserting proving keys into key provider");
|
|
29
30
|
offlineKeyProvider.insertFeePublicKeys(feePublicProvingKey);
|
|
31
|
+
|
|
32
|
+
try {
|
|
30
33
|
offlineKeyProvider.insertTransferPublicKeys(transferPublicProvingKey);
|
|
34
|
+
console.log("Successfully inserted proving key");
|
|
35
|
+
} catch (err) {
|
|
36
|
+
console.error("Failed to insert proving key:", err);
|
|
37
|
+
}
|
|
38
|
+
|
|
31
39
|
|
|
32
40
|
// Create an offline query to complete the inclusion proof
|
|
33
|
-
|
|
41
|
+
let offlineQuery: OfflineQuery;
|
|
42
|
+
const blockHeight = 0;
|
|
43
|
+
// TODO this is a placeholder block height for now, which offlineQuery now requires
|
|
44
|
+
try {
|
|
45
|
+
const offlineQuery = new OfflineQuery(blockHeight, latestStateRoot);
|
|
46
|
+
console.log("Successfully created OfflineQuery", offlineQuery);
|
|
47
|
+
} catch (err) {
|
|
48
|
+
console.error("Failed to create OfflineQuery:", err);
|
|
49
|
+
}
|
|
34
50
|
|
|
35
51
|
// Insert the key provider into the program manager
|
|
36
52
|
programManager.setKeyProvider(offlineKeyProvider);
|
|
@@ -47,7 +63,13 @@ async function buildTransferPublicTxOffline(recipientAddress: Address, amount: n
|
|
|
47
63
|
}
|
|
48
64
|
|
|
49
65
|
/// Build bonding and unbonding transactions without connection to the internet
|
|
50
|
-
async function buildBondingTxOffline(
|
|
66
|
+
async function buildBondingTxOffline(
|
|
67
|
+
validatorAddress: Address,
|
|
68
|
+
withdrawalAddress: Address,
|
|
69
|
+
amount: number,
|
|
70
|
+
latestStateRoot: string,
|
|
71
|
+
keyPaths: {}
|
|
72
|
+
): Promise<Transaction[]> {
|
|
51
73
|
// Create an offline program manager
|
|
52
74
|
const programManager = new ProgramManager();
|
|
53
75
|
|
|
@@ -70,8 +92,7 @@ async function buildBondingTxOffline(stakerAddress: Address, validatorAddress:
|
|
|
70
92
|
console.log("Creating offline key provider");
|
|
71
93
|
const offlineKeyProvider = new OfflineKeyProvider();
|
|
72
94
|
|
|
73
|
-
// Insert the proving keys into the offline key provider
|
|
74
|
-
// keys into the key manager.
|
|
95
|
+
// Insert the proving keys into the offline key provider
|
|
75
96
|
console.log("Inserting proving keys into key provider");
|
|
76
97
|
offlineKeyProvider.insertFeePublicKeys(feePublicProvingKey);
|
|
77
98
|
offlineKeyProvider.insertBondPublicKeys(bondPublicProvingKey);
|
|
@@ -83,49 +104,48 @@ async function buildBondingTxOffline(stakerAddress: Address, validatorAddress:
|
|
|
83
104
|
|
|
84
105
|
// Build the bonding transactions offline
|
|
85
106
|
console.log("Building a bond_public execution transaction offline");
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
},
|
|
90
|
-
offlineParams: {
|
|
91
|
-
offlineQuery: new OfflineQuery(latestStateRoot)
|
|
92
|
-
}
|
|
107
|
+
|
|
108
|
+
if (!latestStateRoot) {
|
|
109
|
+
throw new Error("latestStateRoot is undefined");
|
|
93
110
|
}
|
|
94
111
|
|
|
112
|
+
const bondPublicOptions = {
|
|
113
|
+
keySearchParams: OfflineSearchParams.bondPublicKeyParams(),
|
|
114
|
+
offlineQuery: new OfflineQuery(0, latestStateRoot)
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
|
|
95
118
|
const bondTx = <Transaction>await programManager.buildBondPublicTransaction(
|
|
96
|
-
stakerAddress.to_string(),
|
|
97
119
|
validatorAddress.to_string(),
|
|
98
120
|
withdrawalAddress.to_string(),
|
|
99
121
|
amount,
|
|
100
|
-
bondPublicOptions
|
|
101
|
-
)
|
|
122
|
+
bondPublicOptions
|
|
123
|
+
);
|
|
124
|
+
|
|
102
125
|
console.log("\nbond_public transaction built!\n");
|
|
103
126
|
|
|
104
|
-
console.log("Building an unbond_public execution transaction offline")
|
|
105
127
|
const unbondPublicOptions = {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
offlineParams: {
|
|
110
|
-
offlineQuery: new OfflineQuery(latestStateRoot)
|
|
111
|
-
}
|
|
112
|
-
}
|
|
128
|
+
keySearchParams: OfflineSearchParams.unbondPublicKeyParams(),
|
|
129
|
+
offlineQuery: new OfflineQuery(0, latestStateRoot)
|
|
130
|
+
};
|
|
113
131
|
|
|
114
|
-
const unBondTx = <Transaction>await programManager.buildUnbondPublicTransaction(
|
|
132
|
+
const unBondTx = <Transaction>await programManager.buildUnbondPublicTransaction(
|
|
133
|
+
stakerAddress.to_string(),
|
|
134
|
+
amount,
|
|
135
|
+
unbondPublicOptions
|
|
136
|
+
);
|
|
115
137
|
console.log("\nunbond_public transaction built!\n");
|
|
116
138
|
|
|
117
|
-
console.log("Building a claim_unbond_public transaction offline")
|
|
118
|
-
// Build the claim unbonding transaction offline
|
|
139
|
+
console.log("Building a claim_unbond_public transaction offline");
|
|
119
140
|
const claimUnbondPublicOptions = {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
offlineParams: {
|
|
124
|
-
offlineQuery: new OfflineQuery(latestStateRoot)
|
|
125
|
-
}
|
|
126
|
-
}
|
|
141
|
+
keySearchParams: OfflineSearchParams.claimUnbondPublicKeyParams(),
|
|
142
|
+
offlineQuery: new OfflineQuery(0, latestStateRoot)
|
|
143
|
+
};
|
|
127
144
|
|
|
128
|
-
const claimUnbondTx = <Transaction>await programManager.buildClaimUnbondPublicTransaction(
|
|
145
|
+
const claimUnbondTx = <Transaction>await programManager.buildClaimUnbondPublicTransaction(
|
|
146
|
+
stakerAddress.to_string(),
|
|
147
|
+
claimUnbondPublicOptions
|
|
148
|
+
);
|
|
129
149
|
console.log("\nclaim_unbond_public transaction built!\n");
|
|
130
150
|
return [bondTx, unBondTx, claimUnbondTx];
|
|
131
151
|
}
|
|
@@ -153,13 +173,13 @@ console.log(`\n---------------transfer_public transaction---------------\n${tran
|
|
|
153
173
|
console.log(`---------------------------------------------------------`);
|
|
154
174
|
|
|
155
175
|
// Build bonding & unbonding transactions
|
|
156
|
-
const bondTransactions = await buildBondingTxOffline(
|
|
176
|
+
const bondTransactions = await buildBondingTxOffline(validatorAddress, withdrawalAddress, 100, latestStateRoot, bondingKeyPaths);
|
|
157
177
|
console.log("Bonding transactions built offline!");
|
|
158
178
|
console.log(`\n-----------------bond_public transaction-----------------\n${bondTransactions[0]}`);
|
|
159
179
|
console.log(`---------------------------------------------------------`);
|
|
160
180
|
console.log(`\n----------------unbond_public transaction:---------------\n${bondTransactions[1]}`);
|
|
161
181
|
console.log(`---------------------------------------------------------`);
|
|
162
|
-
console.log(`\n-----------------
|
|
182
|
+
console.log(`\n-----------------claim_unbond_public transaction:---------------\n${bondTransactions[2]}`);
|
|
163
183
|
console.log(`---------------------------------------------------------`);
|
|
164
184
|
//---------------------------------------------------------
|
|
165
185
|
|
|
@@ -168,4 +188,4 @@ console.log(`---------------------------------------------------------`);
|
|
|
168
188
|
// ONLINE COMPONENT (Uncomment this part to send the transaction to the Aleo Network on an internet connected machine)
|
|
169
189
|
// Submit the transaction to the network
|
|
170
190
|
// const transferTxId = await networkClient.submitTransaction(transferTx);
|
|
171
|
-
//---------------------------------------------------------
|
|
191
|
+
//---------------------------------------------------------
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"install-leo": "./install.sh"
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@provablehq/sdk": "^0.8.
|
|
15
|
+
"@provablehq/sdk": "^0.8.7",
|
|
16
16
|
"comlink": "^4.4.2",
|
|
17
17
|
"react": "^19.0.0",
|
|
18
18
|
"react-dom": "^19.0.0"
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"raw-loader": "^4.0.2",
|
|
37
37
|
"style-loader": "^4.0.0",
|
|
38
38
|
"svg-url-loader": "^8.0.0",
|
|
39
|
-
"vite": "^6.
|
|
39
|
+
"vite": "^6.1.2",
|
|
40
40
|
"webpack": "^5.97.1",
|
|
41
41
|
"webpack-cli": "^6.0.1",
|
|
42
42
|
"webpack-dev-server": "^5.2.0"
|
|
@@ -34,7 +34,7 @@ function App() {
|
|
|
34
34
|
try {
|
|
35
35
|
const result = await aleoWorker.deployProgram(helloworld_program);
|
|
36
36
|
console.log("Transaction:")
|
|
37
|
-
console.log("https://explorer.
|
|
37
|
+
console.log("https://explorer.provable.com/transaction/" + result)
|
|
38
38
|
alert("Transaction ID: " + result);
|
|
39
39
|
} catch (e) {
|
|
40
40
|
console.log(e)
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"preview": "vite preview"
|
|
12
12
|
},
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@provablehq/sdk": "^0.8.
|
|
14
|
+
"@provablehq/sdk": "^0.8.7",
|
|
15
15
|
"react": "^19.0.0",
|
|
16
16
|
"react-dom": "^19.0.0"
|
|
17
17
|
},
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"html-webpack-plugin": "^5.6.3",
|
|
34
34
|
"style-loader": "^4.0.0",
|
|
35
35
|
"svg-url-loader": "^8.0.0",
|
|
36
|
-
"vite": "^6.
|
|
36
|
+
"vite": "^6.1.2",
|
|
37
37
|
"webpack": "^5.97.1",
|
|
38
38
|
"webpack-cli": "^6.0.1",
|
|
39
39
|
"webpack-dev-server": "^5.2.0"
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"install-leo": "./install.sh"
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@provablehq/sdk": "^0.8.
|
|
15
|
+
"@provablehq/sdk": "^0.8.7",
|
|
16
16
|
"comlink": "^4.4.2",
|
|
17
17
|
"react": "^19.0.0",
|
|
18
18
|
"react-dom": "^19.0.0"
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"svg-url-loader": "^8.0.0",
|
|
42
42
|
"ts-node": "^10.9.2",
|
|
43
43
|
"typescript": "^5.7.3",
|
|
44
|
-
"vite": "^6.
|
|
44
|
+
"vite": "^6.1.2",
|
|
45
45
|
"webpack": "^5.97.1",
|
|
46
46
|
"webpack-cli": "^6.0.1",
|
|
47
47
|
"webpack-dev-server": "^5.2.0"
|
|
@@ -34,7 +34,7 @@ function App() {
|
|
|
34
34
|
try {
|
|
35
35
|
const result = await aleoWorker.deployProgram(helloworld_program);
|
|
36
36
|
console.log("Transaction:")
|
|
37
|
-
console.log("https://explorer.
|
|
37
|
+
console.log("https://explorer.provable.com/transaction/" + result)
|
|
38
38
|
alert("Transaction ID: " + result);
|
|
39
39
|
} catch (e) {
|
|
40
40
|
console.log(e)
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Layout, Menu } from 'antd';
|
|
2
|
+
import { UserOutlined, CrownOutlined } from '@ant-design/icons';
|
|
3
|
+
import { Link, useLocation } from 'react-router-dom';
|
|
4
|
+
|
|
5
|
+
const { Sider } = Layout;
|
|
6
|
+
|
|
7
|
+
export const Sidebar = () => {
|
|
8
|
+
const location = useLocation();
|
|
9
|
+
|
|
10
|
+
const items = [
|
|
11
|
+
{
|
|
12
|
+
key: '/bidder',
|
|
13
|
+
icon: <UserOutlined />,
|
|
14
|
+
label: <Link to="/bidder">Bidder</Link>,
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
key: '/auctioneer',
|
|
18
|
+
icon: <CrownOutlined />,
|
|
19
|
+
label: <Link to="/auctioneer">Auctioneer</Link>,
|
|
20
|
+
}
|
|
21
|
+
];
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<Sider
|
|
25
|
+
width={200}
|
|
26
|
+
theme="light"
|
|
27
|
+
style={{
|
|
28
|
+
position: 'fixed',
|
|
29
|
+
left: 0,
|
|
30
|
+
top: 0,
|
|
31
|
+
bottom: 0,
|
|
32
|
+
background: '#ffffff'
|
|
33
|
+
}}
|
|
34
|
+
>
|
|
35
|
+
<Menu
|
|
36
|
+
mode="inline"
|
|
37
|
+
selectedKeys={[location.pathname]}
|
|
38
|
+
style={{
|
|
39
|
+
height: '100%',
|
|
40
|
+
borderRight: '1px solid #f0f0f0',
|
|
41
|
+
background: '#ffffff'
|
|
42
|
+
}}
|
|
43
|
+
items={items}
|
|
44
|
+
/>
|
|
45
|
+
</Sider>
|
|
46
|
+
);
|
|
47
|
+
};
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { Card, Form, Input, Button, List, Typography, message } from 'antd';
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { AleoWorker } from "../workers/AleoWorker";
|
|
4
|
+
|
|
5
|
+
const aleoWorker = AleoWorker();
|
|
6
|
+
|
|
7
|
+
export const AuctioneerPage = () => {
|
|
8
|
+
const [receivedBids, setReceivedBids] = useState([]);
|
|
9
|
+
const [loading, setLoading] = useState(false);
|
|
10
|
+
const [resolveForm] = Form.useForm();
|
|
11
|
+
const [finishForm] = Form.useForm();
|
|
12
|
+
|
|
13
|
+
const layout = {
|
|
14
|
+
labelCol: { span: 6 },
|
|
15
|
+
wrapperCol: { span: 16 },
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const handleResolveBids = async (values) => {
|
|
19
|
+
try {
|
|
20
|
+
setLoading(true);
|
|
21
|
+
const result = await aleoWorker.resolveBids(values.bid1, values.bid2);
|
|
22
|
+
message.success('Bids resolved successfully');
|
|
23
|
+
resolveForm.resetFields();
|
|
24
|
+
} catch (error) {
|
|
25
|
+
console.error('Error resolving bids:', error);
|
|
26
|
+
message.error('Failed to resolve bids');
|
|
27
|
+
} finally {
|
|
28
|
+
setLoading(false);
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const handleFinishAuction = async (values) => {
|
|
33
|
+
try {
|
|
34
|
+
setLoading(true);
|
|
35
|
+
const result = await aleoWorker.finishAuction(values.winningBid);
|
|
36
|
+
message.success('Auction finished successfully');
|
|
37
|
+
finishForm.resetFields();
|
|
38
|
+
} catch (error) {
|
|
39
|
+
console.error('Error finishing auction:', error);
|
|
40
|
+
message.error('Failed to finish auction');
|
|
41
|
+
} finally {
|
|
42
|
+
setLoading(false);
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
return (
|
|
47
|
+
<div style={{ padding: '24px', maxWidth: '800px', margin: '0 auto' }}>
|
|
48
|
+
<Typography.Title level={2}>Auction Management</Typography.Title>
|
|
49
|
+
|
|
50
|
+
<Card
|
|
51
|
+
title={<Typography.Title level={4}>Current Auction Bids</Typography.Title>}
|
|
52
|
+
style={{ marginBottom: '24px' }}
|
|
53
|
+
>
|
|
54
|
+
<List
|
|
55
|
+
dataSource={receivedBids}
|
|
56
|
+
renderItem={(bid) => (
|
|
57
|
+
<List.Item>
|
|
58
|
+
<Typography.Text>
|
|
59
|
+
Bid ID: {bid.id} - Amount: {bid.amount}
|
|
60
|
+
</Typography.Text>
|
|
61
|
+
</List.Item>
|
|
62
|
+
)}
|
|
63
|
+
locale={{
|
|
64
|
+
emptyText: <Typography.Text type="secondary">No bids received yet</Typography.Text>
|
|
65
|
+
}}
|
|
66
|
+
/>
|
|
67
|
+
</Card>
|
|
68
|
+
|
|
69
|
+
<Card
|
|
70
|
+
title={<Typography.Title level={4}>Compare and Resolve Bids</Typography.Title>}
|
|
71
|
+
style={{ marginBottom: '24px' }}
|
|
72
|
+
>
|
|
73
|
+
<Form
|
|
74
|
+
{...layout}
|
|
75
|
+
form={resolveForm}
|
|
76
|
+
onFinish={handleResolveBids}
|
|
77
|
+
>
|
|
78
|
+
<Form.Item
|
|
79
|
+
label="First Bid Record"
|
|
80
|
+
name="bid1"
|
|
81
|
+
tooltip="Enter the record of the first bid to compare"
|
|
82
|
+
rules={[{ required: true, message: 'Please enter the first bid record' }]}
|
|
83
|
+
>
|
|
84
|
+
<Input.TextArea
|
|
85
|
+
placeholder="Enter the complete bid record"
|
|
86
|
+
rows={3}
|
|
87
|
+
/>
|
|
88
|
+
</Form.Item>
|
|
89
|
+
<Form.Item
|
|
90
|
+
label="Second Bid Record"
|
|
91
|
+
name="bid2"
|
|
92
|
+
tooltip="Enter the record of the second bid to compare"
|
|
93
|
+
rules={[{ required: true, message: 'Please enter the second bid record' }]}
|
|
94
|
+
>
|
|
95
|
+
<Input.TextArea
|
|
96
|
+
placeholder="Enter the complete bid record"
|
|
97
|
+
rows={3}
|
|
98
|
+
/>
|
|
99
|
+
</Form.Item>
|
|
100
|
+
<Form.Item wrapperCol={{ offset: 6, span: 16 }}>
|
|
101
|
+
<Button
|
|
102
|
+
type="primary"
|
|
103
|
+
htmlType="submit"
|
|
104
|
+
loading={loading}
|
|
105
|
+
>
|
|
106
|
+
Compare and Resolve Bids
|
|
107
|
+
</Button>
|
|
108
|
+
</Form.Item>
|
|
109
|
+
</Form>
|
|
110
|
+
</Card>
|
|
111
|
+
|
|
112
|
+
<Card
|
|
113
|
+
title={<Typography.Title level={4}>Finalize Auction</Typography.Title>}
|
|
114
|
+
>
|
|
115
|
+
<Form
|
|
116
|
+
{...layout}
|
|
117
|
+
form={finishForm}
|
|
118
|
+
onFinish={handleFinishAuction}
|
|
119
|
+
>
|
|
120
|
+
<Form.Item
|
|
121
|
+
label="Winning Bid Record"
|
|
122
|
+
name="winningBid"
|
|
123
|
+
tooltip="Enter the record of the winning bid"
|
|
124
|
+
rules={[{ required: true, message: 'Please enter the winning bid record' }]}
|
|
125
|
+
>
|
|
126
|
+
<Input.TextArea
|
|
127
|
+
placeholder="Enter the complete winning bid record"
|
|
128
|
+
rows={3}
|
|
129
|
+
/>
|
|
130
|
+
</Form.Item>
|
|
131
|
+
<Form.Item wrapperCol={{ offset: 6, span: 16 }}>
|
|
132
|
+
<Button
|
|
133
|
+
type="primary"
|
|
134
|
+
htmlType="submit"
|
|
135
|
+
loading={loading}
|
|
136
|
+
>
|
|
137
|
+
Finalize Auction with Winner
|
|
138
|
+
</Button>
|
|
139
|
+
</Form.Item>
|
|
140
|
+
</Form>
|
|
141
|
+
</Card>
|
|
142
|
+
</div>
|
|
143
|
+
);
|
|
144
|
+
};
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { Card, Form, Input, Button, List, Typography, message } from 'antd';
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { AleoWorker } from "../workers/AleoWorker";
|
|
4
|
+
|
|
5
|
+
const aleoWorker = AleoWorker();
|
|
6
|
+
|
|
7
|
+
export const BidderPage = () => {
|
|
8
|
+
const [account, setAccount] = useState(null);
|
|
9
|
+
const [bids, setBids] = useState([]);
|
|
10
|
+
const [loading, setLoading] = useState(false);
|
|
11
|
+
const [bidForm] = Form.useForm();
|
|
12
|
+
|
|
13
|
+
const layout = {
|
|
14
|
+
labelCol: { span: 4 },
|
|
15
|
+
wrapperCol: { span: 20 },
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const handleSetAccount = async (value) => {
|
|
19
|
+
try {
|
|
20
|
+
setLoading(true);
|
|
21
|
+
await aleoWorker.setAccount(value);
|
|
22
|
+
setAccount(value);
|
|
23
|
+
message.success('Account set successfully');
|
|
24
|
+
} catch (error) {
|
|
25
|
+
console.error('Error setting account:', error);
|
|
26
|
+
message.error('Failed to set account');
|
|
27
|
+
setAccount(null);
|
|
28
|
+
} finally {
|
|
29
|
+
setLoading(false);
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const handlePlaceBid = async (values) => {
|
|
34
|
+
if (!account) {
|
|
35
|
+
message.error('Please set your account first');
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
try {
|
|
40
|
+
setLoading(true);
|
|
41
|
+
const result = await aleoWorker.placeBid(values.amount, values.auctionId);
|
|
42
|
+
message.success('Bid placed successfully');
|
|
43
|
+
bidForm.resetFields();
|
|
44
|
+
|
|
45
|
+
// Add the new bid to the list
|
|
46
|
+
setBids(prevBids => [...prevBids, {
|
|
47
|
+
auctionId: values.auctionId,
|
|
48
|
+
amount: values.amount,
|
|
49
|
+
id: result.id // Assuming the worker returns a bid ID
|
|
50
|
+
}]);
|
|
51
|
+
} catch (error) {
|
|
52
|
+
console.error('Error placing bid:', error);
|
|
53
|
+
message.error('Failed to place bid');
|
|
54
|
+
} finally {
|
|
55
|
+
setLoading(false);
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
return (
|
|
60
|
+
<div style={{ padding: '24px' }}>
|
|
61
|
+
<Card
|
|
62
|
+
title="Aleo Account"
|
|
63
|
+
style={{ marginBottom: '24px' }}
|
|
64
|
+
>
|
|
65
|
+
<Form {...layout}>
|
|
66
|
+
<Form.Item
|
|
67
|
+
label="Private Key"
|
|
68
|
+
required
|
|
69
|
+
tooltip="Your Aleo private key is required to place bids"
|
|
70
|
+
>
|
|
71
|
+
<Input.Password
|
|
72
|
+
placeholder="Enter your Aleo private key"
|
|
73
|
+
onChange={(e) => handleSetAccount(e.target.value)}
|
|
74
|
+
value={account}
|
|
75
|
+
disabled={loading}
|
|
76
|
+
/>
|
|
77
|
+
</Form.Item>
|
|
78
|
+
{account && (
|
|
79
|
+
<Form.Item wrapperCol={{ offset: 4 }}>
|
|
80
|
+
<Typography.Text type="success">
|
|
81
|
+
Account set ✓
|
|
82
|
+
</Typography.Text>
|
|
83
|
+
</Form.Item>
|
|
84
|
+
)}
|
|
85
|
+
</Form>
|
|
86
|
+
</Card>
|
|
87
|
+
|
|
88
|
+
<Card
|
|
89
|
+
title="Place Bid"
|
|
90
|
+
style={{ marginBottom: '24px' }}
|
|
91
|
+
>
|
|
92
|
+
<Form
|
|
93
|
+
{...layout}
|
|
94
|
+
form={bidForm}
|
|
95
|
+
onFinish={handlePlaceBid}
|
|
96
|
+
>
|
|
97
|
+
<Form.Item
|
|
98
|
+
label="Amount"
|
|
99
|
+
name="amount"
|
|
100
|
+
rules={[
|
|
101
|
+
{ required: true, message: 'Please enter bid amount' },
|
|
102
|
+
{ pattern: /^\d+$/, message: 'Please enter a valid number' }
|
|
103
|
+
]}
|
|
104
|
+
>
|
|
105
|
+
<Input placeholder="Enter bid amount" disabled={!account || loading} />
|
|
106
|
+
</Form.Item>
|
|
107
|
+
<Form.Item
|
|
108
|
+
label="Auction ID"
|
|
109
|
+
name="auctionId"
|
|
110
|
+
rules={[{ required: true, message: 'Please enter auction ID' }]}
|
|
111
|
+
>
|
|
112
|
+
<Input placeholder="Enter auction ID" disabled={!account || loading} />
|
|
113
|
+
</Form.Item>
|
|
114
|
+
<Form.Item wrapperCol={{ offset: 4 }}>
|
|
115
|
+
<Button
|
|
116
|
+
type="primary"
|
|
117
|
+
htmlType="submit"
|
|
118
|
+
loading={loading}
|
|
119
|
+
disabled={!account}
|
|
120
|
+
>
|
|
121
|
+
Submit Bid
|
|
122
|
+
</Button>
|
|
123
|
+
</Form.Item>
|
|
124
|
+
</Form>
|
|
125
|
+
</Card>
|
|
126
|
+
|
|
127
|
+
<Card title="Open Bids">
|
|
128
|
+
<List
|
|
129
|
+
dataSource={bids}
|
|
130
|
+
renderItem={(bid) => (
|
|
131
|
+
<List.Item>
|
|
132
|
+
<Typography.Text>
|
|
133
|
+
Auction ID: {bid.auctionId} - Amount: {bid.amount}
|
|
134
|
+
</Typography.Text>
|
|
135
|
+
</List.Item>
|
|
136
|
+
)}
|
|
137
|
+
locale={{ emptyText: 'No bids placed yet' }}
|
|
138
|
+
/>
|
|
139
|
+
</Card>
|
|
140
|
+
</div>
|
|
141
|
+
);
|
|
142
|
+
};
|