@canton-network/example-portfolio 0.17.0 → 0.18.0
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/assets/{Avatar-BcrMcSiO.js → Avatar-CeFJWY-s.js} +1 -1
- package/dist/assets/{copyable-identifier-JPGZUjeF.js → copyable-identifier-ItJqhPOL.js} +1 -1
- package/dist/assets/{index-D7ETv8_M.js → index-BVJntUDN.js} +1 -1
- package/dist/assets/{index-JKRS33AS.js → index-CYRjFua4.js} +132 -132
- package/dist/assets/{old-B-z8--Me.js → old-DIQM2Q8a.js} +1 -1
- package/dist/assets/{settings-B2Wf2IRF.js → settings-BggmN-I1.js} +1 -1
- package/dist/assets/{useWithdrawAllocation--Q3GXEV4.js → useWithdrawAllocation-B9p5ztjm.js} +1 -1
- package/dist/assets/{wallet._walletId-am26sWAs.js → wallet._walletId-CM-FawSM.js} +1 -1
- package/dist/index.html +1 -1
- package/package.json +7 -7
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{g as R,a as A,r as v,u as M,j as g,c as P,b as F,s as y,m as I,ac as $,ad as j,e as K,M as k}from"./index-
|
|
1
|
+
import{g as R,a as A,r as v,u as M,j as g,c as P,b as F,s as y,m as I,ac as $,ad as j,e as K,M as k}from"./index-CYRjFua4.js";function L(t){return String(t).match(/[\d.\-+]*\s*(.*)/)[1]||""}function W(t){return parseFloat(t)}function H(t){return R("MuiSkeleton",t)}A("MuiSkeleton",["root","text","rectangular","rounded","circular","pulse","wave","withChildren","fitContent","heightAuto"]);const O=t=>{const{classes:e,variant:a,animation:o,hasChildren:r,width:n,height:i}=t;return F({root:["root",a,o,r&&"withChildren",r&&!n&&"fitContent",r&&!i&&"heightAuto"]},H,e)},w=j`
|
|
2
2
|
0% {
|
|
3
3
|
opacity: 1;
|
|
4
4
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{g as qo,a as Jo,r as s,u as Qo,a2 as Zo,ae as _o,a3 as F,a6 as oe,af as ee,ag as yo,ah as te,a4 as re,ai as pe,c as To,M as z,aj as se,j as n,ak as xo,d as vo,b as ne,s as J,m as Q,al as bo,e as Po,B as ae,T as ie,I as le}from"./index-JKRS33AS.js";function ce(e){return qo("MuiTooltip",e)}const r=Jo("MuiTooltip",["popper","popperInteractive","popperArrow","popperClose","tooltip","tooltipArrow","touch","tooltipPlacementLeft","tooltipPlacementRight","tooltipPlacementTop","tooltipPlacementBottom","arrow"]);function de(e){return Math.round(e*1e5)/1e5}const ue=e=>{const{classes:o,disableInteractive:p,arrow:a,touch:y,placement:d}=e,$={popper:["popper",!p&&"popperInteractive",a&&"popperArrow"],tooltip:["tooltip",a&&"tooltipArrow",y&&"touch",`tooltipPlacement${vo(d.split("-")[0])}`],arrow:["arrow"]};return ne($,ce,o)},me=J(xo,{name:"MuiTooltip",slot:"Popper",overridesResolver:(e,o)=>{const{ownerState:p}=e;return[o.popper,!p.disableInteractive&&o.popperInteractive,p.arrow&&o.popperArrow,!p.open&&o.popperClose]}})(Q(({theme:e})=>({zIndex:(e.vars||e).zIndex.tooltip,pointerEvents:"none",variants:[{props:({ownerState:o})=>!o.disableInteractive,style:{pointerEvents:"auto"}},{props:({open:o})=>!o,style:{pointerEvents:"none"}},{props:({ownerState:o})=>o.arrow,style:{[`&[data-popper-placement*="bottom"] .${r.arrow}`]:{top:0,marginTop:"-0.71em","&::before":{transformOrigin:"0 100%"}},[`&[data-popper-placement*="top"] .${r.arrow}`]:{bottom:0,marginBottom:"-0.71em","&::before":{transformOrigin:"100% 0"}},[`&[data-popper-placement*="right"] .${r.arrow}`]:{height:"1em",width:"0.71em","&::before":{transformOrigin:"100% 100%"}},[`&[data-popper-placement*="left"] .${r.arrow}`]:{height:"1em",width:"0.71em","&::before":{transformOrigin:"0 0"}}}},{props:({ownerState:o})=>o.arrow&&!o.isRtl,style:{[`&[data-popper-placement*="right"] .${r.arrow}`]:{left:0,marginLeft:"-0.71em"}}},{props:({ownerState:o})=>o.arrow&&!!o.isRtl,style:{[`&[data-popper-placement*="right"] .${r.arrow}`]:{right:0,marginRight:"-0.71em"}}},{props:({ownerState:o})=>o.arrow&&!o.isRtl,style:{[`&[data-popper-placement*="left"] .${r.arrow}`]:{right:0,marginRight:"-0.71em"}}},{props:({ownerState:o})=>o.arrow&&!!o.isRtl,style:{[`&[data-popper-placement*="left"] .${r.arrow}`]:{left:0,marginLeft:"-0.71em"}}}]}))),fe=J("div",{name:"MuiTooltip",slot:"Tooltip",overridesResolver:(e,o)=>{const{ownerState:p}=e;return[o.tooltip,p.touch&&o.touch,p.arrow&&o.tooltipArrow,o[`tooltipPlacement${vo(p.placement.split("-")[0])}`]]}})(Q(({theme:e})=>({backgroundColor:e.vars?e.vars.palette.Tooltip.bg:e.alpha(e.palette.grey[700],.92),borderRadius:(e.vars||e).shape.borderRadius,color:(e.vars||e).palette.common.white,fontFamily:e.typography.fontFamily,padding:"4px 8px",fontSize:e.typography.pxToRem(11),maxWidth:300,margin:2,wordWrap:"break-word",fontWeight:e.typography.fontWeightMedium,[`.${r.popper}[data-popper-placement*="left"] &`]:{transformOrigin:"right center"},[`.${r.popper}[data-popper-placement*="right"] &`]:{transformOrigin:"left center"},[`.${r.popper}[data-popper-placement*="top"] &`]:{transformOrigin:"center bottom",marginBottom:"14px"},[`.${r.popper}[data-popper-placement*="bottom"] &`]:{transformOrigin:"center top",marginTop:"14px"},variants:[{props:({ownerState:o})=>o.arrow,style:{position:"relative",margin:0}},{props:({ownerState:o})=>o.touch,style:{padding:"8px 16px",fontSize:e.typography.pxToRem(14),lineHeight:`${de(16/14)}em`,fontWeight:e.typography.fontWeightRegular}},{props:({ownerState:o})=>!o.isRtl,style:{[`.${r.popper}[data-popper-placement*="left"] &`]:{marginRight:"14px"},[`.${r.popper}[data-popper-placement*="right"] &`]:{marginLeft:"14px"}}},{props:({ownerState:o})=>!o.isRtl&&o.touch,style:{[`.${r.popper}[data-popper-placement*="left"] &`]:{marginRight:"24px"},[`.${r.popper}[data-popper-placement*="right"] &`]:{marginLeft:"24px"}}},{props:({ownerState:o})=>!!o.isRtl,style:{[`.${r.popper}[data-popper-placement*="left"] &`]:{marginLeft:"14px"},[`.${r.popper}[data-popper-placement*="right"] &`]:{marginRight:"14px"}}},{props:({ownerState:o})=>!!o.isRtl&&o.touch,style:{[`.${r.popper}[data-popper-placement*="left"] &`]:{marginLeft:"24px"},[`.${r.popper}[data-popper-placement*="right"] &`]:{marginRight:"24px"}}},{props:({ownerState:o})=>o.touch,style:{[`.${r.popper}[data-popper-placement*="top"] &`]:{marginBottom:"24px"}}},{props:({ownerState:o})=>o.touch,style:{[`.${r.popper}[data-popper-placement*="bottom"] &`]:{marginTop:"24px"}}}]}))),he=J("span",{name:"MuiTooltip",slot:"Arrow"})(Q(({theme:e})=>({overflow:"hidden",position:"absolute",width:"1em",height:"0.71em",boxSizing:"border-box",color:e.vars?e.vars.palette.Tooltip.bg:e.alpha(e.palette.grey[700],.9),"&::before":{content:'""',margin:"auto",display:"block",width:"100%",height:"100%",backgroundColor:"currentColor",transform:"rotate(45deg)"}})));let A=!1;const wo=new te;let M={x:0,y:0};function N(e,o){return(p,...a)=>{o&&o(p,...a),e(p,...a)}}const ge=s.forwardRef(function(o,p){const a=Qo({props:o,name:"MuiTooltip"}),{arrow:y=!1,children:d,classes:$,components:x={},componentsProps:T={},describeChild:l=!1,disableFocusListener:h=!1,disableHoverListener:O=!1,disableInteractive:W=!1,disableTouchListener:Ro=!1,enterDelay:Z=100,enterNextDelay:_=0,enterTouchDelay:Co=700,followCursor:D=!1,id:So,leaveDelay:oo=0,leaveTouchDelay:Mo=1500,onClose:eo,onOpen:to,open:$o,placement:ro="bottom",PopperComponent:po,PopperProps:b={},slotProps:u={},slots:Oo={},title:w,TransitionComponent:Io,TransitionProps:Eo,...so}=a,m=s.isValidElement(d)?d:n.jsx("span",{children:d}),no=Zo(),jo=_o(),[v,ao]=s.useState(),[U,Lo]=s.useState(null),I=s.useRef(!1),V=W||D,io=F(),H=F(),E=F(),lo=F(),[ko,co]=oe({controlled:$o,default:!1,name:"Tooltip",state:"open"});let c=ko;const G=ee(So),P=s.useRef(),j=yo(()=>{P.current!==void 0&&(document.body.style.WebkitUserSelect=P.current,P.current=void 0),lo.clear()});s.useEffect(()=>j,[j]);const uo=t=>{wo.clear(),A=!0,co(!0),to&&!c&&to(t)},L=yo(t=>{wo.start(800+oo,()=>{A=!1}),co(!1),eo&&c&&eo(t),io.start(no.transitions.duration.shortest,()=>{I.current=!1})}),k=t=>{I.current&&t.type!=="touchstart"||(v&&v.removeAttribute("title"),H.clear(),E.clear(),Z||A&&_?H.start(A?_:Z,()=>{uo(t)}):uo(t))},K=t=>{H.clear(),E.start(oo,()=>{L(t)})},[,mo]=s.useState(!1),fo=t=>{bo(t.target)||(mo(!1),K(t))},ho=t=>{v||ao(t.currentTarget),bo(t.target)&&(mo(!0),k(t))},go=t=>{I.current=!0;const f=m.props;f.onTouchStart&&f.onTouchStart(t)},Bo=t=>{go(t),E.clear(),io.clear(),j(),P.current=document.body.style.WebkitUserSelect,document.body.style.WebkitUserSelect="none",lo.start(Co,()=>{document.body.style.WebkitUserSelect=P.current,k(t)})},Fo=t=>{m.props.onTouchEnd&&m.props.onTouchEnd(t),j(),E.start(Mo,()=>{L(t)})};s.useEffect(()=>{if(!c)return;function t(f){f.key==="Escape"&&L(f)}return document.addEventListener("keydown",t),()=>{document.removeEventListener("keydown",t)}},[L,c]);const zo=re(pe(m),ao,p);!w&&w!==0&&(c=!1);const X=s.useRef(),Ao=t=>{const f=m.props;f.onMouseMove&&f.onMouseMove(t),M={x:t.clientX,y:t.clientY},X.current&&X.current.update()},R={},Y=typeof w=="string";l?(R.title=!c&&Y&&!O?w:null,R["aria-describedby"]=c?G:null):(R["aria-label"]=Y?w:null,R["aria-labelledby"]=c&&!Y?G:null);const i={...R,...so,...m.props,className:To(so.className,m.props.className),onTouchStart:go,ref:zo,...D?{onMouseMove:Ao}:{}},C={};Ro||(i.onTouchStart=Bo,i.onTouchEnd=Fo),O||(i.onMouseOver=N(k,i.onMouseOver),i.onMouseLeave=N(K,i.onMouseLeave),V||(C.onMouseOver=k,C.onMouseLeave=K)),h||(i.onFocus=N(ho,i.onFocus),i.onBlur=N(fo,i.onBlur),V||(C.onFocus=ho,C.onBlur=fo));const g={...a,isRtl:jo,arrow:y,disableInteractive:V,placement:ro,PopperComponentProp:po,touch:I.current},S=typeof u.popper=="function"?u.popper(g):u.popper,No=s.useMemo(()=>{let t=[{name:"arrow",enabled:!!U,options:{element:U,padding:4}}];return b.popperOptions?.modifiers&&(t=t.concat(b.popperOptions.modifiers)),S?.popperOptions?.modifiers&&(t=t.concat(S.popperOptions.modifiers)),{...b.popperOptions,...S?.popperOptions,modifiers:t}},[U,b.popperOptions,S?.popperOptions]),q=ue(g),Wo=typeof u.transition=="function"?u.transition(g):u.transition,B={slots:{popper:x.Popper,transition:x.Transition??Io,tooltip:x.Tooltip,arrow:x.Arrow,...Oo},slotProps:{arrow:u.arrow??T.arrow,popper:{...b,...S??T.popper},tooltip:u.tooltip??T.tooltip,transition:{...Eo,...Wo??T.transition}}},[Do,Uo]=z("popper",{elementType:me,externalForwardedProps:B,ownerState:g,className:To(q.popper,b?.className)}),[Vo,Ho]=z("transition",{elementType:se,externalForwardedProps:B,ownerState:g}),[Go,Ko]=z("tooltip",{elementType:fe,className:q.tooltip,externalForwardedProps:B,ownerState:g}),[Xo,Yo]=z("arrow",{elementType:he,className:q.arrow,externalForwardedProps:B,ownerState:g,ref:Lo});return n.jsxs(s.Fragment,{children:[s.cloneElement(m,i),n.jsx(Do,{as:po??xo,placement:ro,anchorEl:D?{getBoundingClientRect:()=>({top:M.y,left:M.x,right:M.x,bottom:M.y,width:0,height:0})}:v,popperRef:X,open:v?c:!1,id:G,transition:!0,...C,...Uo,popperOptions:No,children:({TransitionProps:t})=>n.jsx(Vo,{timeout:no.transitions.duration.shorter,...t,...Ho,children:n.jsxs(Go,{...Ko,children:[w,y?n.jsx(Xo,{...Yo}):null]})})})]})}),ye=Po(n.jsx("path",{d:"M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2m0 16H8V7h11z"})),Te=Po(n.jsx("path",{d:"M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"})),we=({value:e,maxLength:o=8})=>{const[p,a]=s.useState(!1),y=async()=>{try{await navigator.clipboard.writeText(e),a(!0),setTimeout(()=>a(!1),2e3)}catch(l){console.error("Failed to copy:",l)}},d=(l,h)=>l.length<=h?l:`${l.slice(0,h)}...`,$=l=>{const h=l.split("::"),O=h[0]||"",W=h[1]||"";return`${O}::${d(W,o)}`},T=e.includes("::")?$(e):d(e,o);return n.jsxs(ae,{sx:{display:"flex",alignItems:"center",gap:1},children:[n.jsx(ie,{variant:"body2",component:"span",children:T}),n.jsx(ge,{title:p?"Copied!":"Copy to clipboard",children:n.jsx(le,{size:"small",onClick:y,sx:{p:.5},children:p?n.jsx(Te,{fontSize:"small"}):n.jsx(ye,{fontSize:"small"})})})]})};export{we as C};
|
|
1
|
+
import{g as qo,a as Jo,r as s,u as Qo,a2 as Zo,ae as _o,a3 as F,a6 as oe,af as ee,ag as yo,ah as te,a4 as re,ai as pe,c as To,M as z,aj as se,j as n,ak as xo,d as vo,b as ne,s as J,m as Q,al as bo,e as Po,B as ae,T as ie,I as le}from"./index-CYRjFua4.js";function ce(e){return qo("MuiTooltip",e)}const r=Jo("MuiTooltip",["popper","popperInteractive","popperArrow","popperClose","tooltip","tooltipArrow","touch","tooltipPlacementLeft","tooltipPlacementRight","tooltipPlacementTop","tooltipPlacementBottom","arrow"]);function de(e){return Math.round(e*1e5)/1e5}const ue=e=>{const{classes:o,disableInteractive:p,arrow:a,touch:y,placement:d}=e,$={popper:["popper",!p&&"popperInteractive",a&&"popperArrow"],tooltip:["tooltip",a&&"tooltipArrow",y&&"touch",`tooltipPlacement${vo(d.split("-")[0])}`],arrow:["arrow"]};return ne($,ce,o)},me=J(xo,{name:"MuiTooltip",slot:"Popper",overridesResolver:(e,o)=>{const{ownerState:p}=e;return[o.popper,!p.disableInteractive&&o.popperInteractive,p.arrow&&o.popperArrow,!p.open&&o.popperClose]}})(Q(({theme:e})=>({zIndex:(e.vars||e).zIndex.tooltip,pointerEvents:"none",variants:[{props:({ownerState:o})=>!o.disableInteractive,style:{pointerEvents:"auto"}},{props:({open:o})=>!o,style:{pointerEvents:"none"}},{props:({ownerState:o})=>o.arrow,style:{[`&[data-popper-placement*="bottom"] .${r.arrow}`]:{top:0,marginTop:"-0.71em","&::before":{transformOrigin:"0 100%"}},[`&[data-popper-placement*="top"] .${r.arrow}`]:{bottom:0,marginBottom:"-0.71em","&::before":{transformOrigin:"100% 0"}},[`&[data-popper-placement*="right"] .${r.arrow}`]:{height:"1em",width:"0.71em","&::before":{transformOrigin:"100% 100%"}},[`&[data-popper-placement*="left"] .${r.arrow}`]:{height:"1em",width:"0.71em","&::before":{transformOrigin:"0 0"}}}},{props:({ownerState:o})=>o.arrow&&!o.isRtl,style:{[`&[data-popper-placement*="right"] .${r.arrow}`]:{left:0,marginLeft:"-0.71em"}}},{props:({ownerState:o})=>o.arrow&&!!o.isRtl,style:{[`&[data-popper-placement*="right"] .${r.arrow}`]:{right:0,marginRight:"-0.71em"}}},{props:({ownerState:o})=>o.arrow&&!o.isRtl,style:{[`&[data-popper-placement*="left"] .${r.arrow}`]:{right:0,marginRight:"-0.71em"}}},{props:({ownerState:o})=>o.arrow&&!!o.isRtl,style:{[`&[data-popper-placement*="left"] .${r.arrow}`]:{left:0,marginLeft:"-0.71em"}}}]}))),fe=J("div",{name:"MuiTooltip",slot:"Tooltip",overridesResolver:(e,o)=>{const{ownerState:p}=e;return[o.tooltip,p.touch&&o.touch,p.arrow&&o.tooltipArrow,o[`tooltipPlacement${vo(p.placement.split("-")[0])}`]]}})(Q(({theme:e})=>({backgroundColor:e.vars?e.vars.palette.Tooltip.bg:e.alpha(e.palette.grey[700],.92),borderRadius:(e.vars||e).shape.borderRadius,color:(e.vars||e).palette.common.white,fontFamily:e.typography.fontFamily,padding:"4px 8px",fontSize:e.typography.pxToRem(11),maxWidth:300,margin:2,wordWrap:"break-word",fontWeight:e.typography.fontWeightMedium,[`.${r.popper}[data-popper-placement*="left"] &`]:{transformOrigin:"right center"},[`.${r.popper}[data-popper-placement*="right"] &`]:{transformOrigin:"left center"},[`.${r.popper}[data-popper-placement*="top"] &`]:{transformOrigin:"center bottom",marginBottom:"14px"},[`.${r.popper}[data-popper-placement*="bottom"] &`]:{transformOrigin:"center top",marginTop:"14px"},variants:[{props:({ownerState:o})=>o.arrow,style:{position:"relative",margin:0}},{props:({ownerState:o})=>o.touch,style:{padding:"8px 16px",fontSize:e.typography.pxToRem(14),lineHeight:`${de(16/14)}em`,fontWeight:e.typography.fontWeightRegular}},{props:({ownerState:o})=>!o.isRtl,style:{[`.${r.popper}[data-popper-placement*="left"] &`]:{marginRight:"14px"},[`.${r.popper}[data-popper-placement*="right"] &`]:{marginLeft:"14px"}}},{props:({ownerState:o})=>!o.isRtl&&o.touch,style:{[`.${r.popper}[data-popper-placement*="left"] &`]:{marginRight:"24px"},[`.${r.popper}[data-popper-placement*="right"] &`]:{marginLeft:"24px"}}},{props:({ownerState:o})=>!!o.isRtl,style:{[`.${r.popper}[data-popper-placement*="left"] &`]:{marginLeft:"14px"},[`.${r.popper}[data-popper-placement*="right"] &`]:{marginRight:"14px"}}},{props:({ownerState:o})=>!!o.isRtl&&o.touch,style:{[`.${r.popper}[data-popper-placement*="left"] &`]:{marginLeft:"24px"},[`.${r.popper}[data-popper-placement*="right"] &`]:{marginRight:"24px"}}},{props:({ownerState:o})=>o.touch,style:{[`.${r.popper}[data-popper-placement*="top"] &`]:{marginBottom:"24px"}}},{props:({ownerState:o})=>o.touch,style:{[`.${r.popper}[data-popper-placement*="bottom"] &`]:{marginTop:"24px"}}}]}))),he=J("span",{name:"MuiTooltip",slot:"Arrow"})(Q(({theme:e})=>({overflow:"hidden",position:"absolute",width:"1em",height:"0.71em",boxSizing:"border-box",color:e.vars?e.vars.palette.Tooltip.bg:e.alpha(e.palette.grey[700],.9),"&::before":{content:'""',margin:"auto",display:"block",width:"100%",height:"100%",backgroundColor:"currentColor",transform:"rotate(45deg)"}})));let A=!1;const wo=new te;let M={x:0,y:0};function N(e,o){return(p,...a)=>{o&&o(p,...a),e(p,...a)}}const ge=s.forwardRef(function(o,p){const a=Qo({props:o,name:"MuiTooltip"}),{arrow:y=!1,children:d,classes:$,components:x={},componentsProps:T={},describeChild:l=!1,disableFocusListener:h=!1,disableHoverListener:O=!1,disableInteractive:W=!1,disableTouchListener:Ro=!1,enterDelay:Z=100,enterNextDelay:_=0,enterTouchDelay:Co=700,followCursor:D=!1,id:So,leaveDelay:oo=0,leaveTouchDelay:Mo=1500,onClose:eo,onOpen:to,open:$o,placement:ro="bottom",PopperComponent:po,PopperProps:b={},slotProps:u={},slots:Oo={},title:w,TransitionComponent:Io,TransitionProps:Eo,...so}=a,m=s.isValidElement(d)?d:n.jsx("span",{children:d}),no=Zo(),jo=_o(),[v,ao]=s.useState(),[U,Lo]=s.useState(null),I=s.useRef(!1),V=W||D,io=F(),H=F(),E=F(),lo=F(),[ko,co]=oe({controlled:$o,default:!1,name:"Tooltip",state:"open"});let c=ko;const G=ee(So),P=s.useRef(),j=yo(()=>{P.current!==void 0&&(document.body.style.WebkitUserSelect=P.current,P.current=void 0),lo.clear()});s.useEffect(()=>j,[j]);const uo=t=>{wo.clear(),A=!0,co(!0),to&&!c&&to(t)},L=yo(t=>{wo.start(800+oo,()=>{A=!1}),co(!1),eo&&c&&eo(t),io.start(no.transitions.duration.shortest,()=>{I.current=!1})}),k=t=>{I.current&&t.type!=="touchstart"||(v&&v.removeAttribute("title"),H.clear(),E.clear(),Z||A&&_?H.start(A?_:Z,()=>{uo(t)}):uo(t))},K=t=>{H.clear(),E.start(oo,()=>{L(t)})},[,mo]=s.useState(!1),fo=t=>{bo(t.target)||(mo(!1),K(t))},ho=t=>{v||ao(t.currentTarget),bo(t.target)&&(mo(!0),k(t))},go=t=>{I.current=!0;const f=m.props;f.onTouchStart&&f.onTouchStart(t)},Bo=t=>{go(t),E.clear(),io.clear(),j(),P.current=document.body.style.WebkitUserSelect,document.body.style.WebkitUserSelect="none",lo.start(Co,()=>{document.body.style.WebkitUserSelect=P.current,k(t)})},Fo=t=>{m.props.onTouchEnd&&m.props.onTouchEnd(t),j(),E.start(Mo,()=>{L(t)})};s.useEffect(()=>{if(!c)return;function t(f){f.key==="Escape"&&L(f)}return document.addEventListener("keydown",t),()=>{document.removeEventListener("keydown",t)}},[L,c]);const zo=re(pe(m),ao,p);!w&&w!==0&&(c=!1);const X=s.useRef(),Ao=t=>{const f=m.props;f.onMouseMove&&f.onMouseMove(t),M={x:t.clientX,y:t.clientY},X.current&&X.current.update()},R={},Y=typeof w=="string";l?(R.title=!c&&Y&&!O?w:null,R["aria-describedby"]=c?G:null):(R["aria-label"]=Y?w:null,R["aria-labelledby"]=c&&!Y?G:null);const i={...R,...so,...m.props,className:To(so.className,m.props.className),onTouchStart:go,ref:zo,...D?{onMouseMove:Ao}:{}},C={};Ro||(i.onTouchStart=Bo,i.onTouchEnd=Fo),O||(i.onMouseOver=N(k,i.onMouseOver),i.onMouseLeave=N(K,i.onMouseLeave),V||(C.onMouseOver=k,C.onMouseLeave=K)),h||(i.onFocus=N(ho,i.onFocus),i.onBlur=N(fo,i.onBlur),V||(C.onFocus=ho,C.onBlur=fo));const g={...a,isRtl:jo,arrow:y,disableInteractive:V,placement:ro,PopperComponentProp:po,touch:I.current},S=typeof u.popper=="function"?u.popper(g):u.popper,No=s.useMemo(()=>{let t=[{name:"arrow",enabled:!!U,options:{element:U,padding:4}}];return b.popperOptions?.modifiers&&(t=t.concat(b.popperOptions.modifiers)),S?.popperOptions?.modifiers&&(t=t.concat(S.popperOptions.modifiers)),{...b.popperOptions,...S?.popperOptions,modifiers:t}},[U,b.popperOptions,S?.popperOptions]),q=ue(g),Wo=typeof u.transition=="function"?u.transition(g):u.transition,B={slots:{popper:x.Popper,transition:x.Transition??Io,tooltip:x.Tooltip,arrow:x.Arrow,...Oo},slotProps:{arrow:u.arrow??T.arrow,popper:{...b,...S??T.popper},tooltip:u.tooltip??T.tooltip,transition:{...Eo,...Wo??T.transition}}},[Do,Uo]=z("popper",{elementType:me,externalForwardedProps:B,ownerState:g,className:To(q.popper,b?.className)}),[Vo,Ho]=z("transition",{elementType:se,externalForwardedProps:B,ownerState:g}),[Go,Ko]=z("tooltip",{elementType:fe,className:q.tooltip,externalForwardedProps:B,ownerState:g}),[Xo,Yo]=z("arrow",{elementType:he,className:q.arrow,externalForwardedProps:B,ownerState:g,ref:Lo});return n.jsxs(s.Fragment,{children:[s.cloneElement(m,i),n.jsx(Do,{as:po??xo,placement:ro,anchorEl:D?{getBoundingClientRect:()=>({top:M.y,left:M.x,right:M.x,bottom:M.y,width:0,height:0})}:v,popperRef:X,open:v?c:!1,id:G,transition:!0,...C,...Uo,popperOptions:No,children:({TransitionProps:t})=>n.jsx(Vo,{timeout:no.transitions.duration.shorter,...t,...Ho,children:n.jsxs(Go,{...Ko,children:[w,y?n.jsx(Xo,{...Yo}):null]})})})]})}),ye=Po(n.jsx("path",{d:"M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2m0 16H8V7h11z"})),Te=Po(n.jsx("path",{d:"M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"})),we=({value:e,maxLength:o=8})=>{const[p,a]=s.useState(!1),y=async()=>{try{await navigator.clipboard.writeText(e),a(!0),setTimeout(()=>a(!1),2e3)}catch(l){console.error("Failed to copy:",l)}},d=(l,h)=>l.length<=h?l:`${l.slice(0,h)}...`,$=l=>{const h=l.split("::"),O=h[0]||"",W=h[1]||"";return`${O}::${d(W,o)}`},T=e.includes("::")?$(e):d(e,o);return n.jsxs(ae,{sx:{display:"flex",alignItems:"center",gap:1},children:[n.jsx(ie,{variant:"body2",component:"span",children:T}),n.jsx(ge,{title:p?"Copied!":"Copy to clipboard",children:n.jsx(le,{size:"small",onClick:y,sx:{p:.5},children:p?n.jsx(Te,{fontSize:"small"}):n.jsx(ye,{fontSize:"small"})})})]})};export{we as C};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{x as ue,Q as ge,L as fe,r as b,g as me,a as be,u as ye,M as Y,c as ve,j as e,d as j,b as je,s as ee,m as Ce,N as Ie,E as Ae,h as We,O as Oe,R as Re,K as Le,S as re,U as ne,T as o,V as te,B as s,W as se,l as A,X as O,P as U,Y as T,t as S,Z as Se,_ as Te,$ as ke,C as we,G,F as Pe}from"./index-JKRS33AS.js";import{c as ze,d as $e,u as De,a as Be,b as Ee}from"./useWithdrawAllocation--Q3GXEV4.js";import{C as R}from"./copyable-identifier-JPGZUjeF.js";import{A as oe,S as J}from"./Avatar-BcrMcSiO.js";function Me(n,r){return ue({...n,enabled:!0,suspense:!0,throwOnError:fe,placeholderData:void 0},ge)}function ae(n){const r=b.useRef({});return b.useEffect(()=>{r.current=n}),r.current}function Fe(n){const{badgeContent:r,invisible:t=!1,max:a=99,showZero:d=!1}=n,h=ae({badgeContent:r,max:a});let p=t;t===!1&&r===0&&!d&&(p=!0);const{badgeContent:l,max:c=a}=p?h:n,x=l&&Number(l)>c?`${c}+`:l;return{badgeContent:l,invisible:p,max:c,displayValue:x}}function Ve(n){return me("MuiBadge",n)}const W=be("MuiBadge",["root","badge","dot","standard","anchorOriginTopRight","anchorOriginBottomRight","anchorOriginTopLeft","anchorOriginBottomLeft","invisible","colorError","colorInfo","colorPrimary","colorSecondary","colorSuccess","colorWarning","overlapRectangular","overlapCircular","anchorOriginTopLeftCircular","anchorOriginTopLeftRectangular","anchorOriginTopRightCircular","anchorOriginTopRightRectangular","anchorOriginBottomLeftCircular","anchorOriginBottomLeftRectangular","anchorOriginBottomRightCircular","anchorOriginBottomRightRectangular"]),V=10,q=4,qe=n=>{const{color:r,anchorOrigin:t,invisible:a,overlap:d,variant:h,classes:p={}}=n,l={root:["root"],badge:["badge",h,a&&"invisible",`anchorOrigin${j(t.vertical)}${j(t.horizontal)}`,`anchorOrigin${j(t.vertical)}${j(t.horizontal)}${j(d)}`,`overlap${j(d)}`,r!=="default"&&`color${j(r)}`]};return je(l,Ve,p)},Ue=ee("span",{name:"MuiBadge",slot:"Root"})({position:"relative",display:"inline-flex",verticalAlign:"middle",flexShrink:0}),Ne=ee("span",{name:"MuiBadge",slot:"Badge",overridesResolver:(n,r)=>{const{ownerState:t}=n;return[r.badge,r[t.variant],r[`anchorOrigin${j(t.anchorOrigin.vertical)}${j(t.anchorOrigin.horizontal)}${j(t.overlap)}`],t.color!=="default"&&r[`color${j(t.color)}`],t.invisible&&r.invisible]}})(Ce(({theme:n})=>({display:"flex",flexDirection:"row",flexWrap:"wrap",justifyContent:"center",alignContent:"center",alignItems:"center",position:"absolute",boxSizing:"border-box",fontFamily:n.typography.fontFamily,fontWeight:n.typography.fontWeightMedium,fontSize:n.typography.pxToRem(12),minWidth:V*2,lineHeight:1,padding:"0 6px",height:V*2,borderRadius:V,zIndex:1,transition:n.transitions.create("transform",{easing:n.transitions.easing.easeInOut,duration:n.transitions.duration.enteringScreen}),variants:[...Object.entries(n.palette).filter(Ie(["contrastText"])).map(([r])=>({props:{color:r},style:{backgroundColor:(n.vars||n).palette[r].main,color:(n.vars||n).palette[r].contrastText}})),{props:{variant:"dot"},style:{borderRadius:q,height:q*2,minWidth:q*2,padding:0}},{props:({ownerState:r})=>r.anchorOrigin.vertical==="top"&&r.anchorOrigin.horizontal==="right"&&r.overlap==="rectangular",style:{top:0,right:0,transform:"scale(1) translate(50%, -50%)",transformOrigin:"100% 0%",[`&.${W.invisible}`]:{transform:"scale(0) translate(50%, -50%)"}}},{props:({ownerState:r})=>r.anchorOrigin.vertical==="bottom"&&r.anchorOrigin.horizontal==="right"&&r.overlap==="rectangular",style:{bottom:0,right:0,transform:"scale(1) translate(50%, 50%)",transformOrigin:"100% 100%",[`&.${W.invisible}`]:{transform:"scale(0) translate(50%, 50%)"}}},{props:({ownerState:r})=>r.anchorOrigin.vertical==="top"&&r.anchorOrigin.horizontal==="left"&&r.overlap==="rectangular",style:{top:0,left:0,transform:"scale(1) translate(-50%, -50%)",transformOrigin:"0% 0%",[`&.${W.invisible}`]:{transform:"scale(0) translate(-50%, -50%)"}}},{props:({ownerState:r})=>r.anchorOrigin.vertical==="bottom"&&r.anchorOrigin.horizontal==="left"&&r.overlap==="rectangular",style:{bottom:0,left:0,transform:"scale(1) translate(-50%, 50%)",transformOrigin:"0% 100%",[`&.${W.invisible}`]:{transform:"scale(0) translate(-50%, 50%)"}}},{props:({ownerState:r})=>r.anchorOrigin.vertical==="top"&&r.anchorOrigin.horizontal==="right"&&r.overlap==="circular",style:{top:"14%",right:"14%",transform:"scale(1) translate(50%, -50%)",transformOrigin:"100% 0%",[`&.${W.invisible}`]:{transform:"scale(0) translate(50%, -50%)"}}},{props:({ownerState:r})=>r.anchorOrigin.vertical==="bottom"&&r.anchorOrigin.horizontal==="right"&&r.overlap==="circular",style:{bottom:"14%",right:"14%",transform:"scale(1) translate(50%, 50%)",transformOrigin:"100% 100%",[`&.${W.invisible}`]:{transform:"scale(0) translate(50%, 50%)"}}},{props:({ownerState:r})=>r.anchorOrigin.vertical==="top"&&r.anchorOrigin.horizontal==="left"&&r.overlap==="circular",style:{top:"14%",left:"14%",transform:"scale(1) translate(-50%, -50%)",transformOrigin:"0% 0%",[`&.${W.invisible}`]:{transform:"scale(0) translate(-50%, -50%)"}}},{props:({ownerState:r})=>r.anchorOrigin.vertical==="bottom"&&r.anchorOrigin.horizontal==="left"&&r.overlap==="circular",style:{bottom:"14%",left:"14%",transform:"scale(1) translate(-50%, 50%)",transformOrigin:"0% 100%",[`&.${W.invisible}`]:{transform:"scale(0) translate(-50%, 50%)"}}},{props:{invisible:!0},style:{transition:n.transitions.create("transform",{easing:n.transitions.easing.easeInOut,duration:n.transitions.duration.leavingScreen})}}]})));function X(n){return{vertical:n?.vertical??"top",horizontal:n?.horizontal??"right"}}const Qe=b.forwardRef(function(r,t){const a=ye({props:r,name:"MuiBadge"}),{anchorOrigin:d,className:h,classes:p,component:l,components:c={},componentsProps:x={},children:u,overlap:f="rectangular",color:m="default",invisible:y=!1,max:v=99,badgeContent:L,slots:w,slotProps:P,showZero:k=!1,variant:C="standard",...B}=a,{badgeContent:z,invisible:E,max:M,displayValue:i}=Fe({max:v,invisible:y,badgeContent:L,showZero:k}),g=ae({anchorOrigin:X(d),color:m,overlap:f,variant:C,badgeContent:L}),I=E||z==null&&C!=="dot",{color:$=m,overlap:ie=f,anchorOrigin:le,variant:K=C}=I?g:a,ce=X(le),H=K!=="dot"?i:void 0,F={...a,badgeContent:z,invisible:I,max:M,displayValue:H,showZero:k,anchorOrigin:ce,color:$,overlap:ie,variant:K},_=qe(F),Z={slots:{root:w?.root??c.Root,badge:w?.badge??c.Badge},slotProps:{root:P?.root??x.root,badge:P?.badge??x.badge}},[de,xe]=Y("root",{elementType:Ue,externalForwardedProps:{...Z,...B},ownerState:F,className:ve(_.root,h),ref:t,additionalProps:{as:l}}),[pe,he]=Y("badge",{elementType:Ne,externalForwardedProps:Z,ownerState:F,className:_.badge});return e.jsxs(de,{...xe,children:[u,e.jsx(pe,{...he,children:H})]})}),Ke=()=>{const{exerciseTransfer:n}=Ae(),r=We(),t=Oe();return Re({mutationFn:async a=>n({registryUrls:r,...a}),onSuccess:async(a,d)=>{await t.invalidateQueries({queryKey:Le.listPendingTransfers.forParty(d.party)})}})},N=n=>n.currentPartyId===n.receiver,D=n=>N(n)?{label:"Sender",value:n.sender}:{label:"Receiver",value:n.receiver},Q=(n,r)=>n===r.transferLeg.sender,He=(n,r)=>n===r.transferLeg.receiver,_e=n=>n.transferLegs.filter(r=>Q(n.currentPartyId,r)&&r.allocations.length===0),Ze=n=>n.transferLegs.filter(r=>Q(n.currentPartyId,r)&&r.allocations.length>0),Ye=n=>{const{item:r,open:t,isLoading:a,onClose:d,onAccept:h,onReject:p,onWithdraw:l}=n,c=()=>{a||d()};return e.jsxs(re,{open:t,onClose:c,maxWidth:"md",fullWidth:!0,disableEscapeKeyDown:a,children:[e.jsx(ne,{sx:{pb:1},children:e.jsx(o,{variant:"h6",component:"div",fontWeight:"bold",children:"Transfer Details"})}),e.jsx(te,{sx:{py:2},children:r&&e.jsxs(s,{sx:{display:"flex",flexDirection:"column",gap:3},children:[e.jsxs(s,{sx:{display:"flex",gap:3,p:2,borderRadius:2,border:"1px solid",borderColor:"divider"},children:[e.jsxs(s,{sx:{flex:1},children:[e.jsx(o,{variant:"caption",color:"text.secondary",sx:{fontWeight:500,textTransform:"uppercase",letterSpacing:.5},children:"Amount"}),e.jsxs(o,{variant:"h6",fontWeight:"bold",children:[r.amount," ",r.instrumentId.id]})]}),e.jsxs(s,{sx:{flex:1},children:[e.jsx(o,{variant:"caption",color:"text.secondary",sx:{fontWeight:500,textTransform:"uppercase",letterSpacing:.5},children:"Type"}),e.jsx(s,{sx:{display:"flex",alignItems:"center",gap:1},children:e.jsx(o,{variant:"body2",fontWeight:"medium",children:"Transfer Offer"})})]})]}),e.jsxs(s,{sx:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:3},children:[e.jsxs(s,{sx:{p:2,borderRadius:1,border:"1px solid",borderColor:"divider"},children:[e.jsx(o,{variant:"caption",color:"text.secondary",sx:{fontWeight:500,textTransform:"uppercase",letterSpacing:.5,mb:1,display:"block"},children:"Created"}),e.jsx(o,{variant:"body1",fontWeight:"medium",children:r.date})]}),e.jsxs(s,{sx:{p:2,borderRadius:1,border:"1px solid",borderColor:"divider"},children:[e.jsx(o,{variant:"caption",color:"text.secondary",sx:{fontWeight:500,textTransform:"uppercase",letterSpacing:.5,mb:1,display:"block"},children:"Expires"}),e.jsx(o,{variant:"body1",fontWeight:"medium",children:r.expiry})]})]}),e.jsxs(s,{sx:{p:2,borderRadius:1,border:"1px solid",borderColor:"divider"},children:[e.jsx(o,{variant:"caption",color:"text.secondary",sx:{fontWeight:500,textTransform:"uppercase",letterSpacing:.5,mb:1,display:"block"},children:D(r).label}),e.jsx(s,{sx:{display:"flex",alignItems:"center",gap:1},children:e.jsx(R,{value:D(r).value,maxLength:60})})]}),e.jsxs(s,{sx:{p:2,borderRadius:1,border:"1px solid",borderColor:"divider"},children:[e.jsx(o,{variant:"caption",color:"text.secondary",sx:{fontWeight:500,textTransform:"uppercase",letterSpacing:.5,mb:1,display:"block"},children:"Message"}),e.jsx(o,{variant:"body1",sx:{wordBreak:"break-word",lineHeight:1.6,color:"text.primary"},children:r.message})]}),e.jsxs(s,{sx:{p:2,borderRadius:1,border:"1px solid",borderColor:"divider"},children:[e.jsx(o,{variant:"caption",color:"text.secondary",sx:{fontWeight:500,textTransform:"uppercase",letterSpacing:.5,mb:1,display:"block"},children:"Contract ID"}),e.jsx(s,{sx:{display:"flex",alignItems:"center",gap:1},children:e.jsx(R,{value:r.id,maxLength:60})})]})]})}),e.jsxs(se,{sx:{px:3,pb:3,gap:2},children:[e.jsx(A,{onClick:c,variant:"outlined",color:"inherit",sx:{minWidth:100},disabled:a,children:"Cancel"}),e.jsx(s,{sx:{flex:1}}),r&&N(r)?e.jsxs(e.Fragment,{children:[e.jsx(A,{variant:"outlined",color:"error",sx:{minWidth:100},disabled:a,onClick:()=>p(r),children:a?e.jsx(O,{size:20,color:"inherit"}):"Reject"}),e.jsx(A,{variant:"contained",sx:{minWidth:100},disabled:a,onClick:()=>h(r),children:a?e.jsx(O,{size:20,color:"inherit"}):"Accept"})]}):e.jsx(A,{variant:"outlined",color:"warning",sx:{minWidth:100},disabled:a,onClick:()=>r&&l(r),children:a?e.jsx(O,{size:20,color:"inherit"}):"Withdraw"})]})]})},Ge=n=>{const{item:r,isLoading:t,onClick:a,onAccept:d,onReject:h,onWithdraw:p}=n;return e.jsxs(U,{elevation:1,variant:"elevation",sx:{p:2,display:"flex",justifyContent:"space-between",alignItems:"center",borderRadius:0,gap:2,cursor:t?"default":"pointer",opacity:t?.7:1,"&:hover":{backgroundColor:t?"inherit":"action.hover"}},onClick:()=>!t&&a(),children:[e.jsxs(s,{sx:{display:"flex",alignItems:"center",gap:3},children:[e.jsxs(s,{sx:{minWidth:120,flexShrink:0},children:[e.jsx(o,{variant:"body2",color:"textSecondary",children:"Type"}),e.jsx(o,{variant:"body1",fontWeight:"medium",children:r.type})]}),e.jsxs(s,{sx:{minWidth:80,flexShrink:0},children:[e.jsx(o,{variant:"body2",color:"textSecondary",children:"Amount"}),e.jsxs(o,{variant:"body1",children:[r.amount," ",r.instrumentId.id]})]}),e.jsxs(s,{sx:{minWidth:100,flexShrink:0},children:[e.jsx(o,{variant:"body2",color:"textSecondary",children:"Expires"}),e.jsx(o,{variant:"body1",children:r.expiry})]}),e.jsxs(s,{sx:{minWidth:100,flexShrink:0},children:[e.jsx(o,{variant:"body2",color:"textSecondary",children:D(r).label}),e.jsx(R,{value:D(r).value})]}),e.jsxs(s,{sx:{flex:1,minWidth:150},children:[e.jsx(o,{variant:"body2",color:"textSecondary",children:"Message"}),e.jsx(o,{variant:"body1",sx:{wordBreak:"break-word"},children:r.message.slice(0,30)+"..."})]})]}),e.jsx(s,{sx:{display:"flex",gap:2},children:N(r)?e.jsxs(e.Fragment,{children:[e.jsx(A,{variant:"contained",size:"small",sx:{minWidth:80},disabled:t,onClick:l=>{l.stopPropagation(),d()},children:t?e.jsx(O,{size:16,color:"inherit"}):"Accept"}),e.jsx(A,{variant:"outlined",size:"small",sx:{minWidth:80},disabled:t,onClick:l=>{l.stopPropagation(),h()},children:t?e.jsx(O,{size:16,color:"inherit"}):"Reject"})]}):e.jsx(A,{variant:"outlined",color:"warning",size:"small",sx:{minWidth:80},disabled:t,onClick:l=>{l.stopPropagation(),p()},children:t?e.jsx(O,{size:16,color:"inherit"}):"Withdraw"})})]})},Je=n=>{const{item:r,isLoading:t,onClick:a}=n,d=_e(r),h=Ze(r),p=d.length>0,l=h.length>0,c=()=>p&&l?`${d.length} pending, ${h.length} allocated`:p?`${d.length} transfer leg${d.length>1?"s":""} requires allocation`:`${h.length} allocated`;return e.jsx(U,{elevation:1,variant:"elevation",sx:{p:2,display:"flex",justifyContent:"space-between",alignItems:"center",borderRadius:0,gap:2,cursor:t?"default":"pointer",opacity:t?.7:1,"&:hover":{backgroundColor:t?"inherit":"action.hover"}},onClick:()=>!t&&a(),children:e.jsxs(s,{sx:{display:"flex",alignItems:"center",gap:3},children:[e.jsxs(s,{sx:{minWidth:120,flexShrink:0},children:[e.jsx(o,{variant:"body2",color:"textSecondary",children:"Type"}),e.jsx(o,{variant:"body1",fontWeight:"medium",children:"Allocation"})]}),e.jsxs(s,{sx:{minWidth:100,flexShrink:0},children:[e.jsx(o,{variant:"body2",color:"textSecondary",children:"Allocate Before"}),e.jsx(o,{variant:"body1",children:r.expiry})]}),e.jsxs(s,{sx:{minWidth:100,flexShrink:0},children:[e.jsx(o,{variant:"body2",color:"textSecondary",children:"Transfer Legs"}),e.jsx(o,{variant:"body1",children:r.transferLegs.length})]}),e.jsxs(s,{sx:{flex:1,minWidth:150},children:[e.jsx(o,{variant:"body2",color:"textSecondary",children:"Status"}),e.jsx(o,{variant:"body1",sx:{color:p?"warning.main":"success.main"},children:c()})]})]})})},Xe=n=>{const{item:r,open:t,isLoading:a,loadingLegId:d,onClose:h,onCreateAllocation:p,onWithdrawAllocation:l}=n,c=()=>{a||h()};return e.jsxs(re,{open:t,onClose:c,maxWidth:"md",fullWidth:!0,disableEscapeKeyDown:a,children:[e.jsx(ne,{sx:{pb:1},children:e.jsx(o,{variant:"h6",component:"div",fontWeight:"bold",children:"Allocation Details"})}),e.jsx(te,{sx:{py:2},children:r&&e.jsxs(s,{sx:{display:"flex",flexDirection:"column",gap:3},children:[e.jsxs(s,{sx:{p:2,borderRadius:2,border:"1px solid",borderColor:"divider"},children:[e.jsx(o,{variant:"caption",color:"text.secondary",sx:{fontWeight:500,textTransform:"uppercase",letterSpacing:.5},children:"Type"}),e.jsx(o,{variant:"body2",fontWeight:"medium",children:"Allocation Request"})]}),e.jsxs(s,{sx:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:3},children:[e.jsxs(s,{sx:{p:2,borderRadius:1,border:"1px solid",borderColor:"divider"},children:[e.jsx(o,{variant:"caption",color:"text.secondary",sx:{fontWeight:500,textTransform:"uppercase",letterSpacing:.5,mb:1,display:"block"},children:"Settlement Reference"}),e.jsx(R,{value:r.settlement.settlementRef.id,maxLength:40})]}),e.jsxs(s,{sx:{p:2,borderRadius:1,border:"1px solid",borderColor:"divider"},children:[e.jsx(o,{variant:"caption",color:"text.secondary",sx:{fontWeight:500,textTransform:"uppercase",letterSpacing:.5,mb:1,display:"block"},children:"Allocate Before"}),e.jsx(o,{variant:"body1",fontWeight:"medium",children:r.expiry})]})]}),e.jsxs(s,{sx:{p:2,borderRadius:1,border:"1px solid",borderColor:"divider"},children:[e.jsx(o,{variant:"caption",color:"text.secondary",sx:{fontWeight:500,textTransform:"uppercase",letterSpacing:.5,mb:1,display:"block"},children:"Executor"}),e.jsx(R,{value:r.settlement.executor,maxLength:60})]}),e.jsxs(s,{children:[e.jsxs(o,{variant:"subtitle1",fontWeight:"bold",sx:{mb:2},children:["Transfer Legs (",r.transferLegs.length,")"]}),e.jsx(s,{sx:{display:"flex",flexDirection:"column",gap:2},children:r.transferLegs.map(x=>e.jsx(er,{leg:x,currentPartyId:r.currentPartyId,isLoading:a,isLegLoading:d===x.transferLegId,onCreateAllocation:()=>p(x),onWithdrawAllocation:u=>l(x,u)},x.transferLegId))})]})]})}),e.jsx(se,{sx:{px:3,pb:3,gap:2},children:e.jsx(A,{onClick:c,variant:"outlined",color:"inherit",sx:{minWidth:100},disabled:a,children:"Close"})})]})},er=({leg:n,currentPartyId:r,isLoading:t,isLegLoading:a,onCreateAllocation:d,onWithdrawAllocation:h})=>{const p=Q(r,n),l=He(r,n),c=n.allocations.length>0,x=()=>p&&l?e.jsx(T,{label:"Self-transfer",size:"small",color:"info"}):p?e.jsx(T,{label:"Sender",size:"small",color:"primary"}):l?e.jsx(T,{label:"Receiver",size:"small",color:"secondary"}):e.jsx(T,{label:"Observer",size:"small"});return e.jsxs(s,{sx:{p:2,borderRadius:1,border:"1px solid",borderColor:c?"success.light":"divider",backgroundColor:c?"success.50":"transparent"},children:[e.jsxs(s,{sx:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",mb:2},children:[e.jsxs(s,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsxs(o,{variant:"body2",fontWeight:"medium",children:["Leg: ",n.transferLegId]}),x(),c&&e.jsx(T,{label:"Allocated",size:"small",color:"success"})]}),p&&e.jsx(s,{sx:{display:"flex",gap:1},children:c?n.allocations.map(u=>e.jsx(A,{variant:"outlined",color:"warning",size:"small",disabled:t,onClick:()=>h(u.contractId),children:a?e.jsx(O,{size:16,color:"inherit"}):"Withdraw"},u.contractId)):e.jsx(A,{variant:"contained",size:"small",disabled:t,onClick:d,children:a?e.jsx(O,{size:16,color:"inherit"}):"Create Allocation"})})]}),e.jsxs(s,{sx:{display:"grid",gridTemplateColumns:"repeat(3, 1fr)",gap:2},children:[e.jsxs(s,{children:[e.jsx(o,{variant:"caption",color:"text.secondary",children:"Amount"}),e.jsxs(o,{variant:"body2",children:[n.transferLeg.amount," ",n.transferLeg.instrumentId.id]})]}),e.jsxs(s,{children:[e.jsx(o,{variant:"caption",color:"text.secondary",children:"Sender"}),e.jsx(R,{value:n.transferLeg.sender,maxLength:20})]}),e.jsxs(s,{children:[e.jsx(o,{variant:"caption",color:"text.secondary",children:"Receiver"}),e.jsx(R,{value:n.transferLeg.receiver,maxLength:20})]})]})]})},rr=({items:n})=>{const[r,t]=b.useState(null),[a,d]=b.useState(!1),[h,p]=b.useState(null),[l,c]=b.useState(!1),[x,u]=b.useState(null),f=b.useMemo(()=>{if(!h)return null;const i=n.find(g=>g.kind==="allocation"&&g.id===h);return i||null},[n,h]),[m,y]=b.useState(null),v=Ke(),L=ze(),w=$e(),P=i=>{t(i),d(!0)},k=()=>{d(!1),t(null)},C=(i,g)=>{y(i.id),v.mutate({party:i.currentPartyId,contractId:i.id,instrumentId:i.instrumentId,instructionChoice:g},{onSuccess:()=>{S.success(`${g} transfer successful`),k()},onError:I=>S.error(`Failed to ${g.toLowerCase()} transfer: ${I instanceof Error?I.message:"Unknown error"}`),onSettled:()=>y(null)})},B=i=>{p(i.id),c(!0)},z=()=>{c(!1),p(null)},E=(i,g)=>{y(i.id),u(g.transferLegId),L.mutate({party:i.currentPartyId,allocationSpecification:{settlement:i.settlement,transferLegId:g.transferLegId,transferLeg:g.transferLeg}},{onSuccess:()=>{S.success("Allocation created successfully")},onError:I=>S.error(`Failed to create allocation: ${I instanceof Error?I.message:"Unknown error"}`),onSettled:()=>{y(null),u(null)}})},M=(i,g,I)=>{y(i.id),u(g.transferLegId),w.mutate({party:i.currentPartyId,contractId:I,instrumentId:g.transferLeg.instrumentId},{onSuccess:()=>{S.success("Allocation withdrawn successfully")},onError:$=>S.error(`Failed to withdraw allocation: ${$ instanceof Error?$.message:"Unknown error"}`),onSettled:()=>{y(null),u(null)}})};return n.length===0?null:e.jsxs(s,{sx:{mb:6},children:[e.jsxs(s,{sx:{display:"flex",mb:2},children:[e.jsx(o,{variant:"h6",sx:{textTransform:"uppercase"},fontWeight:"bold",children:"Action Required"}),e.jsx(Qe,{badgeContent:n.length,color:"error",sx:{ml:2}})]}),e.jsx(s,{sx:{display:"flex",flexDirection:"column",gap:2},children:n.map(i=>{const g=m===i.id;switch(i.kind){case"allocation":return e.jsx(Je,{item:i,isLoading:g,onClick:()=>B(i)},i.id);case"transfer":return e.jsx(Ge,{item:i,isLoading:g,onClick:()=>P(i),onAccept:()=>C(i,"Accept"),onReject:()=>C(i,"Reject"),onWithdraw:()=>C(i,"Withdraw")},i.id)}})}),e.jsx(Ye,{item:r,open:a,isLoading:m!==null,onClose:k,onAccept:i=>C(i,"Accept"),onReject:i=>C(i,"Reject"),onWithdraw:i=>C(i,"Withdraw")}),e.jsx(Xe,{item:f,open:l,isLoading:m!==null,loadingLegId:x,onClose:z,onCreateAllocation:i=>f&&E(f,i),onWithdrawAllocation:(i,g)=>f&&M(f,i,g)})]})},nr=({partyId:n,walletName:r,isPrimary:t})=>{const{instruments:a,isLoading:d}=Se(n),h=a.length>0,p=e.jsxs(s,{sx:{p:1,display:"flex",justifyContent:"center",alignItems:"center",textAlign:"center"},children:[e.jsx(oe,{sx:{visibility:"hidden",m:1,height:25,width:25}}),e.jsx(o,{sx:{position:"absolute"},children:"There are currently no assets in this wallet"})]}),l=e.jsxs(s,{sx:{p:1},children:[e.jsx(J,{variant:"rectangular",height:40}),e.jsx(J,{variant:"rectangular",height:40,sx:{mt:1}})]}),c=a.map(x=>e.jsx(tr,{item:x},`${x.instrumentId.admin}::${x.instrumentId.id}`));return e.jsx(Te,{to:"/wallet/$walletId",params:{walletId:n},style:{textDecoration:"none",color:"inherit"},children:e.jsxs(s,{sx:{display:"flex",flexDirection:"column"},children:[e.jsxs(s,{sx:{mb:1,display:"flex",flexDirection:"row",alignItems:"center",gap:1},children:[e.jsx(o,{sx:{textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap",maxWidth:"200px"},fontWeight:"bold",color:"secondary",children:r}),t&&e.jsx(T,{label:"Primary",size:"small",color:"primary"})]}),e.jsx(s,{component:U,variant:"outlined",sx:{background:x=>x.palette.mode==="dark"?void 0:x.palette.grey[100],display:"flex",flexDirection:"column",cursor:"pointer",transition:"all 0.2s ease-in-out","&:hover":{borderColor:"primary.main",boxShadow:1}},children:d?l:h?c:p})]})})},tr=({item:n})=>{const r=n.instrument?.symbol??n.instrumentId.id,t=n.instrument?.name??n.instrumentId.id,a=n.lockedAmount!=="0";return e.jsxs(s,{borderRadius:0,sx:{"&:not(:first-of-type)":{borderTop:d=>`1px solid ${d.palette.divider}`},p:1,display:"flex",alignItems:"center"},children:[e.jsx(oe,{sx:{m:1,height:25,width:25},children:r[0]}),e.jsxs(s,{children:[e.jsx(o,{sx:{maxWidth:"100px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},color:"textSecondary",variant:"body2",children:t}),e.jsxs(o,{variant:"body2",fontWeight:"700",children:[n.totalAmount," ",r,a&&e.jsxs(o,{component:"span",variant:"body2",color:"textSecondary",sx:{ml:.5},children:["(",n.availableAmount," available)"]})]})]})]})},sr=()=>{const n=ke().slice().sort((r,t)=>Number(r.primary)-Number(t.primary));return e.jsxs(s,{sx:{mt:1},children:[e.jsx(o,{variant:"h6",sx:{textTransform:"uppercase",mb:2},fontWeight:"bold",children:"Wallets"}),e.jsx(s,{sx:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:6},children:n.map(r=>e.jsx(nr,{partyId:r.partyId,walletName:r.hint,isPrimary:r.primary},r.partyId))})]})};function cr(){const n=we()?.partyId,r=Me(De(n)),{data:t}=G(Be(n)),{data:a}=G(Ee(n)),d=b.useCallback((l,c)=>JSON.stringify([l.settlementRef.id,l.settlementRef.cid,c]),[]),h=b.useMemo(()=>{const l=new Map;for(const c of t??[]){const{settlement:x,transferLegs:u}=c.interfaceViewValue;for(const f in u){const m=d(x,f);l.set(m,[])}}for(const c of a??[]){const{settlement:x,transferLegId:u}=c.interfaceViewValue.allocation,f=d(x,u);l.has(f)&&l.get(f).push(c)}return l},[t,a,d]),p=b.useMemo(()=>{if(!n)return[];const l=[];if(r.data)for(const c of r.data){const x=c.interfaceViewValue,u=x.transfer,f=x.status,m="tag"in f?f.tag:f.current?.tag,y=u?.meta?.values?.[Pe.MEMO_KEY]??"",v={kind:"transfer",id:c.contractId,currentPartyId:n,tag:m,type:m?.startsWith("Transfer")?"Transfer":m,date:u.requestedAt,expiry:u.executeBefore,message:y,sender:u.sender,receiver:u.receiver,instrumentId:u.instrumentId,amount:u?.amount};l.push(v)}if(t)for(const c of t){const{settlement:x,transferLegs:u}=c.interfaceViewValue,m=Object.entries(u).map(([v,L])=>({transferLegId:v,transferLeg:L,allocations:h.get(d(x,v))??[]})).filter(v=>v.transferLeg.sender===n||v.transferLeg.receiver===n);if(m.length===0)continue;const y={kind:"allocation",id:c.contractId,currentPartyId:n,expiry:x.allocateBefore,settlement:x,transferLegs:m};l.push(y)}return l},[r.data,t,h,n,d]);return e.jsxs(s,{sx:{my:8},children:[e.jsx(o,{variant:"h3",component:"h1",sx:{mb:6},children:"Dashboard"}),e.jsx(rr,{items:p}),e.jsx(sr,{})]})}export{cr as component};
|
|
1
|
+
import{x as ue,Q as ge,L as fe,r as b,g as me,a as be,u as ye,M as Y,c as ve,j as e,d as j,b as je,s as ee,m as Ce,N as Ie,E as Ae,h as We,O as Oe,R as Re,K as Le,S as re,U as ne,T as o,V as te,B as s,W as se,l as A,X as O,P as U,Y as T,t as S,Z as Se,_ as Te,$ as ke,C as we,G,F as Pe}from"./index-CYRjFua4.js";import{c as ze,d as $e,u as De,a as Be,b as Ee}from"./useWithdrawAllocation-B9p5ztjm.js";import{C as R}from"./copyable-identifier-ItJqhPOL.js";import{A as oe,S as J}from"./Avatar-CeFJWY-s.js";function Me(n,r){return ue({...n,enabled:!0,suspense:!0,throwOnError:fe,placeholderData:void 0},ge)}function ae(n){const r=b.useRef({});return b.useEffect(()=>{r.current=n}),r.current}function Fe(n){const{badgeContent:r,invisible:t=!1,max:a=99,showZero:d=!1}=n,h=ae({badgeContent:r,max:a});let p=t;t===!1&&r===0&&!d&&(p=!0);const{badgeContent:l,max:c=a}=p?h:n,x=l&&Number(l)>c?`${c}+`:l;return{badgeContent:l,invisible:p,max:c,displayValue:x}}function Ve(n){return me("MuiBadge",n)}const W=be("MuiBadge",["root","badge","dot","standard","anchorOriginTopRight","anchorOriginBottomRight","anchorOriginTopLeft","anchorOriginBottomLeft","invisible","colorError","colorInfo","colorPrimary","colorSecondary","colorSuccess","colorWarning","overlapRectangular","overlapCircular","anchorOriginTopLeftCircular","anchorOriginTopLeftRectangular","anchorOriginTopRightCircular","anchorOriginTopRightRectangular","anchorOriginBottomLeftCircular","anchorOriginBottomLeftRectangular","anchorOriginBottomRightCircular","anchorOriginBottomRightRectangular"]),V=10,q=4,qe=n=>{const{color:r,anchorOrigin:t,invisible:a,overlap:d,variant:h,classes:p={}}=n,l={root:["root"],badge:["badge",h,a&&"invisible",`anchorOrigin${j(t.vertical)}${j(t.horizontal)}`,`anchorOrigin${j(t.vertical)}${j(t.horizontal)}${j(d)}`,`overlap${j(d)}`,r!=="default"&&`color${j(r)}`]};return je(l,Ve,p)},Ue=ee("span",{name:"MuiBadge",slot:"Root"})({position:"relative",display:"inline-flex",verticalAlign:"middle",flexShrink:0}),Ne=ee("span",{name:"MuiBadge",slot:"Badge",overridesResolver:(n,r)=>{const{ownerState:t}=n;return[r.badge,r[t.variant],r[`anchorOrigin${j(t.anchorOrigin.vertical)}${j(t.anchorOrigin.horizontal)}${j(t.overlap)}`],t.color!=="default"&&r[`color${j(t.color)}`],t.invisible&&r.invisible]}})(Ce(({theme:n})=>({display:"flex",flexDirection:"row",flexWrap:"wrap",justifyContent:"center",alignContent:"center",alignItems:"center",position:"absolute",boxSizing:"border-box",fontFamily:n.typography.fontFamily,fontWeight:n.typography.fontWeightMedium,fontSize:n.typography.pxToRem(12),minWidth:V*2,lineHeight:1,padding:"0 6px",height:V*2,borderRadius:V,zIndex:1,transition:n.transitions.create("transform",{easing:n.transitions.easing.easeInOut,duration:n.transitions.duration.enteringScreen}),variants:[...Object.entries(n.palette).filter(Ie(["contrastText"])).map(([r])=>({props:{color:r},style:{backgroundColor:(n.vars||n).palette[r].main,color:(n.vars||n).palette[r].contrastText}})),{props:{variant:"dot"},style:{borderRadius:q,height:q*2,minWidth:q*2,padding:0}},{props:({ownerState:r})=>r.anchorOrigin.vertical==="top"&&r.anchorOrigin.horizontal==="right"&&r.overlap==="rectangular",style:{top:0,right:0,transform:"scale(1) translate(50%, -50%)",transformOrigin:"100% 0%",[`&.${W.invisible}`]:{transform:"scale(0) translate(50%, -50%)"}}},{props:({ownerState:r})=>r.anchorOrigin.vertical==="bottom"&&r.anchorOrigin.horizontal==="right"&&r.overlap==="rectangular",style:{bottom:0,right:0,transform:"scale(1) translate(50%, 50%)",transformOrigin:"100% 100%",[`&.${W.invisible}`]:{transform:"scale(0) translate(50%, 50%)"}}},{props:({ownerState:r})=>r.anchorOrigin.vertical==="top"&&r.anchorOrigin.horizontal==="left"&&r.overlap==="rectangular",style:{top:0,left:0,transform:"scale(1) translate(-50%, -50%)",transformOrigin:"0% 0%",[`&.${W.invisible}`]:{transform:"scale(0) translate(-50%, -50%)"}}},{props:({ownerState:r})=>r.anchorOrigin.vertical==="bottom"&&r.anchorOrigin.horizontal==="left"&&r.overlap==="rectangular",style:{bottom:0,left:0,transform:"scale(1) translate(-50%, 50%)",transformOrigin:"0% 100%",[`&.${W.invisible}`]:{transform:"scale(0) translate(-50%, 50%)"}}},{props:({ownerState:r})=>r.anchorOrigin.vertical==="top"&&r.anchorOrigin.horizontal==="right"&&r.overlap==="circular",style:{top:"14%",right:"14%",transform:"scale(1) translate(50%, -50%)",transformOrigin:"100% 0%",[`&.${W.invisible}`]:{transform:"scale(0) translate(50%, -50%)"}}},{props:({ownerState:r})=>r.anchorOrigin.vertical==="bottom"&&r.anchorOrigin.horizontal==="right"&&r.overlap==="circular",style:{bottom:"14%",right:"14%",transform:"scale(1) translate(50%, 50%)",transformOrigin:"100% 100%",[`&.${W.invisible}`]:{transform:"scale(0) translate(50%, 50%)"}}},{props:({ownerState:r})=>r.anchorOrigin.vertical==="top"&&r.anchorOrigin.horizontal==="left"&&r.overlap==="circular",style:{top:"14%",left:"14%",transform:"scale(1) translate(-50%, -50%)",transformOrigin:"0% 0%",[`&.${W.invisible}`]:{transform:"scale(0) translate(-50%, -50%)"}}},{props:({ownerState:r})=>r.anchorOrigin.vertical==="bottom"&&r.anchorOrigin.horizontal==="left"&&r.overlap==="circular",style:{bottom:"14%",left:"14%",transform:"scale(1) translate(-50%, 50%)",transformOrigin:"0% 100%",[`&.${W.invisible}`]:{transform:"scale(0) translate(-50%, 50%)"}}},{props:{invisible:!0},style:{transition:n.transitions.create("transform",{easing:n.transitions.easing.easeInOut,duration:n.transitions.duration.leavingScreen})}}]})));function X(n){return{vertical:n?.vertical??"top",horizontal:n?.horizontal??"right"}}const Qe=b.forwardRef(function(r,t){const a=ye({props:r,name:"MuiBadge"}),{anchorOrigin:d,className:h,classes:p,component:l,components:c={},componentsProps:x={},children:u,overlap:f="rectangular",color:m="default",invisible:y=!1,max:v=99,badgeContent:L,slots:w,slotProps:P,showZero:k=!1,variant:C="standard",...B}=a,{badgeContent:z,invisible:E,max:M,displayValue:i}=Fe({max:v,invisible:y,badgeContent:L,showZero:k}),g=ae({anchorOrigin:X(d),color:m,overlap:f,variant:C,badgeContent:L}),I=E||z==null&&C!=="dot",{color:$=m,overlap:ie=f,anchorOrigin:le,variant:K=C}=I?g:a,ce=X(le),H=K!=="dot"?i:void 0,F={...a,badgeContent:z,invisible:I,max:M,displayValue:H,showZero:k,anchorOrigin:ce,color:$,overlap:ie,variant:K},_=qe(F),Z={slots:{root:w?.root??c.Root,badge:w?.badge??c.Badge},slotProps:{root:P?.root??x.root,badge:P?.badge??x.badge}},[de,xe]=Y("root",{elementType:Ue,externalForwardedProps:{...Z,...B},ownerState:F,className:ve(_.root,h),ref:t,additionalProps:{as:l}}),[pe,he]=Y("badge",{elementType:Ne,externalForwardedProps:Z,ownerState:F,className:_.badge});return e.jsxs(de,{...xe,children:[u,e.jsx(pe,{...he,children:H})]})}),Ke=()=>{const{exerciseTransfer:n}=Ae(),r=We(),t=Oe();return Re({mutationFn:async a=>n({registryUrls:r,...a}),onSuccess:async(a,d)=>{await t.invalidateQueries({queryKey:Le.listPendingTransfers.forParty(d.party)})}})},N=n=>n.currentPartyId===n.receiver,D=n=>N(n)?{label:"Sender",value:n.sender}:{label:"Receiver",value:n.receiver},Q=(n,r)=>n===r.transferLeg.sender,He=(n,r)=>n===r.transferLeg.receiver,_e=n=>n.transferLegs.filter(r=>Q(n.currentPartyId,r)&&r.allocations.length===0),Ze=n=>n.transferLegs.filter(r=>Q(n.currentPartyId,r)&&r.allocations.length>0),Ye=n=>{const{item:r,open:t,isLoading:a,onClose:d,onAccept:h,onReject:p,onWithdraw:l}=n,c=()=>{a||d()};return e.jsxs(re,{open:t,onClose:c,maxWidth:"md",fullWidth:!0,disableEscapeKeyDown:a,children:[e.jsx(ne,{sx:{pb:1},children:e.jsx(o,{variant:"h6",component:"div",fontWeight:"bold",children:"Transfer Details"})}),e.jsx(te,{sx:{py:2},children:r&&e.jsxs(s,{sx:{display:"flex",flexDirection:"column",gap:3},children:[e.jsxs(s,{sx:{display:"flex",gap:3,p:2,borderRadius:2,border:"1px solid",borderColor:"divider"},children:[e.jsxs(s,{sx:{flex:1},children:[e.jsx(o,{variant:"caption",color:"text.secondary",sx:{fontWeight:500,textTransform:"uppercase",letterSpacing:.5},children:"Amount"}),e.jsxs(o,{variant:"h6",fontWeight:"bold",children:[r.amount," ",r.instrumentId.id]})]}),e.jsxs(s,{sx:{flex:1},children:[e.jsx(o,{variant:"caption",color:"text.secondary",sx:{fontWeight:500,textTransform:"uppercase",letterSpacing:.5},children:"Type"}),e.jsx(s,{sx:{display:"flex",alignItems:"center",gap:1},children:e.jsx(o,{variant:"body2",fontWeight:"medium",children:"Transfer Offer"})})]})]}),e.jsxs(s,{sx:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:3},children:[e.jsxs(s,{sx:{p:2,borderRadius:1,border:"1px solid",borderColor:"divider"},children:[e.jsx(o,{variant:"caption",color:"text.secondary",sx:{fontWeight:500,textTransform:"uppercase",letterSpacing:.5,mb:1,display:"block"},children:"Created"}),e.jsx(o,{variant:"body1",fontWeight:"medium",children:r.date})]}),e.jsxs(s,{sx:{p:2,borderRadius:1,border:"1px solid",borderColor:"divider"},children:[e.jsx(o,{variant:"caption",color:"text.secondary",sx:{fontWeight:500,textTransform:"uppercase",letterSpacing:.5,mb:1,display:"block"},children:"Expires"}),e.jsx(o,{variant:"body1",fontWeight:"medium",children:r.expiry})]})]}),e.jsxs(s,{sx:{p:2,borderRadius:1,border:"1px solid",borderColor:"divider"},children:[e.jsx(o,{variant:"caption",color:"text.secondary",sx:{fontWeight:500,textTransform:"uppercase",letterSpacing:.5,mb:1,display:"block"},children:D(r).label}),e.jsx(s,{sx:{display:"flex",alignItems:"center",gap:1},children:e.jsx(R,{value:D(r).value,maxLength:60})})]}),e.jsxs(s,{sx:{p:2,borderRadius:1,border:"1px solid",borderColor:"divider"},children:[e.jsx(o,{variant:"caption",color:"text.secondary",sx:{fontWeight:500,textTransform:"uppercase",letterSpacing:.5,mb:1,display:"block"},children:"Message"}),e.jsx(o,{variant:"body1",sx:{wordBreak:"break-word",lineHeight:1.6,color:"text.primary"},children:r.message})]}),e.jsxs(s,{sx:{p:2,borderRadius:1,border:"1px solid",borderColor:"divider"},children:[e.jsx(o,{variant:"caption",color:"text.secondary",sx:{fontWeight:500,textTransform:"uppercase",letterSpacing:.5,mb:1,display:"block"},children:"Contract ID"}),e.jsx(s,{sx:{display:"flex",alignItems:"center",gap:1},children:e.jsx(R,{value:r.id,maxLength:60})})]})]})}),e.jsxs(se,{sx:{px:3,pb:3,gap:2},children:[e.jsx(A,{onClick:c,variant:"outlined",color:"inherit",sx:{minWidth:100},disabled:a,children:"Cancel"}),e.jsx(s,{sx:{flex:1}}),r&&N(r)?e.jsxs(e.Fragment,{children:[e.jsx(A,{variant:"outlined",color:"error",sx:{minWidth:100},disabled:a,onClick:()=>p(r),children:a?e.jsx(O,{size:20,color:"inherit"}):"Reject"}),e.jsx(A,{variant:"contained",sx:{minWidth:100},disabled:a,onClick:()=>h(r),children:a?e.jsx(O,{size:20,color:"inherit"}):"Accept"})]}):e.jsx(A,{variant:"outlined",color:"warning",sx:{minWidth:100},disabled:a,onClick:()=>r&&l(r),children:a?e.jsx(O,{size:20,color:"inherit"}):"Withdraw"})]})]})},Ge=n=>{const{item:r,isLoading:t,onClick:a,onAccept:d,onReject:h,onWithdraw:p}=n;return e.jsxs(U,{elevation:1,variant:"elevation",sx:{p:2,display:"flex",justifyContent:"space-between",alignItems:"center",borderRadius:0,gap:2,cursor:t?"default":"pointer",opacity:t?.7:1,"&:hover":{backgroundColor:t?"inherit":"action.hover"}},onClick:()=>!t&&a(),children:[e.jsxs(s,{sx:{display:"flex",alignItems:"center",gap:3},children:[e.jsxs(s,{sx:{minWidth:120,flexShrink:0},children:[e.jsx(o,{variant:"body2",color:"textSecondary",children:"Type"}),e.jsx(o,{variant:"body1",fontWeight:"medium",children:r.type})]}),e.jsxs(s,{sx:{minWidth:80,flexShrink:0},children:[e.jsx(o,{variant:"body2",color:"textSecondary",children:"Amount"}),e.jsxs(o,{variant:"body1",children:[r.amount," ",r.instrumentId.id]})]}),e.jsxs(s,{sx:{minWidth:100,flexShrink:0},children:[e.jsx(o,{variant:"body2",color:"textSecondary",children:"Expires"}),e.jsx(o,{variant:"body1",children:r.expiry})]}),e.jsxs(s,{sx:{minWidth:100,flexShrink:0},children:[e.jsx(o,{variant:"body2",color:"textSecondary",children:D(r).label}),e.jsx(R,{value:D(r).value})]}),e.jsxs(s,{sx:{flex:1,minWidth:150},children:[e.jsx(o,{variant:"body2",color:"textSecondary",children:"Message"}),e.jsx(o,{variant:"body1",sx:{wordBreak:"break-word"},children:r.message.slice(0,30)+"..."})]})]}),e.jsx(s,{sx:{display:"flex",gap:2},children:N(r)?e.jsxs(e.Fragment,{children:[e.jsx(A,{variant:"contained",size:"small",sx:{minWidth:80},disabled:t,onClick:l=>{l.stopPropagation(),d()},children:t?e.jsx(O,{size:16,color:"inherit"}):"Accept"}),e.jsx(A,{variant:"outlined",size:"small",sx:{minWidth:80},disabled:t,onClick:l=>{l.stopPropagation(),h()},children:t?e.jsx(O,{size:16,color:"inherit"}):"Reject"})]}):e.jsx(A,{variant:"outlined",color:"warning",size:"small",sx:{minWidth:80},disabled:t,onClick:l=>{l.stopPropagation(),p()},children:t?e.jsx(O,{size:16,color:"inherit"}):"Withdraw"})})]})},Je=n=>{const{item:r,isLoading:t,onClick:a}=n,d=_e(r),h=Ze(r),p=d.length>0,l=h.length>0,c=()=>p&&l?`${d.length} pending, ${h.length} allocated`:p?`${d.length} transfer leg${d.length>1?"s":""} requires allocation`:`${h.length} allocated`;return e.jsx(U,{elevation:1,variant:"elevation",sx:{p:2,display:"flex",justifyContent:"space-between",alignItems:"center",borderRadius:0,gap:2,cursor:t?"default":"pointer",opacity:t?.7:1,"&:hover":{backgroundColor:t?"inherit":"action.hover"}},onClick:()=>!t&&a(),children:e.jsxs(s,{sx:{display:"flex",alignItems:"center",gap:3},children:[e.jsxs(s,{sx:{minWidth:120,flexShrink:0},children:[e.jsx(o,{variant:"body2",color:"textSecondary",children:"Type"}),e.jsx(o,{variant:"body1",fontWeight:"medium",children:"Allocation"})]}),e.jsxs(s,{sx:{minWidth:100,flexShrink:0},children:[e.jsx(o,{variant:"body2",color:"textSecondary",children:"Allocate Before"}),e.jsx(o,{variant:"body1",children:r.expiry})]}),e.jsxs(s,{sx:{minWidth:100,flexShrink:0},children:[e.jsx(o,{variant:"body2",color:"textSecondary",children:"Transfer Legs"}),e.jsx(o,{variant:"body1",children:r.transferLegs.length})]}),e.jsxs(s,{sx:{flex:1,minWidth:150},children:[e.jsx(o,{variant:"body2",color:"textSecondary",children:"Status"}),e.jsx(o,{variant:"body1",sx:{color:p?"warning.main":"success.main"},children:c()})]})]})})},Xe=n=>{const{item:r,open:t,isLoading:a,loadingLegId:d,onClose:h,onCreateAllocation:p,onWithdrawAllocation:l}=n,c=()=>{a||h()};return e.jsxs(re,{open:t,onClose:c,maxWidth:"md",fullWidth:!0,disableEscapeKeyDown:a,children:[e.jsx(ne,{sx:{pb:1},children:e.jsx(o,{variant:"h6",component:"div",fontWeight:"bold",children:"Allocation Details"})}),e.jsx(te,{sx:{py:2},children:r&&e.jsxs(s,{sx:{display:"flex",flexDirection:"column",gap:3},children:[e.jsxs(s,{sx:{p:2,borderRadius:2,border:"1px solid",borderColor:"divider"},children:[e.jsx(o,{variant:"caption",color:"text.secondary",sx:{fontWeight:500,textTransform:"uppercase",letterSpacing:.5},children:"Type"}),e.jsx(o,{variant:"body2",fontWeight:"medium",children:"Allocation Request"})]}),e.jsxs(s,{sx:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:3},children:[e.jsxs(s,{sx:{p:2,borderRadius:1,border:"1px solid",borderColor:"divider"},children:[e.jsx(o,{variant:"caption",color:"text.secondary",sx:{fontWeight:500,textTransform:"uppercase",letterSpacing:.5,mb:1,display:"block"},children:"Settlement Reference"}),e.jsx(R,{value:r.settlement.settlementRef.id,maxLength:40})]}),e.jsxs(s,{sx:{p:2,borderRadius:1,border:"1px solid",borderColor:"divider"},children:[e.jsx(o,{variant:"caption",color:"text.secondary",sx:{fontWeight:500,textTransform:"uppercase",letterSpacing:.5,mb:1,display:"block"},children:"Allocate Before"}),e.jsx(o,{variant:"body1",fontWeight:"medium",children:r.expiry})]})]}),e.jsxs(s,{sx:{p:2,borderRadius:1,border:"1px solid",borderColor:"divider"},children:[e.jsx(o,{variant:"caption",color:"text.secondary",sx:{fontWeight:500,textTransform:"uppercase",letterSpacing:.5,mb:1,display:"block"},children:"Executor"}),e.jsx(R,{value:r.settlement.executor,maxLength:60})]}),e.jsxs(s,{children:[e.jsxs(o,{variant:"subtitle1",fontWeight:"bold",sx:{mb:2},children:["Transfer Legs (",r.transferLegs.length,")"]}),e.jsx(s,{sx:{display:"flex",flexDirection:"column",gap:2},children:r.transferLegs.map(x=>e.jsx(er,{leg:x,currentPartyId:r.currentPartyId,isLoading:a,isLegLoading:d===x.transferLegId,onCreateAllocation:()=>p(x),onWithdrawAllocation:u=>l(x,u)},x.transferLegId))})]})]})}),e.jsx(se,{sx:{px:3,pb:3,gap:2},children:e.jsx(A,{onClick:c,variant:"outlined",color:"inherit",sx:{minWidth:100},disabled:a,children:"Close"})})]})},er=({leg:n,currentPartyId:r,isLoading:t,isLegLoading:a,onCreateAllocation:d,onWithdrawAllocation:h})=>{const p=Q(r,n),l=He(r,n),c=n.allocations.length>0,x=()=>p&&l?e.jsx(T,{label:"Self-transfer",size:"small",color:"info"}):p?e.jsx(T,{label:"Sender",size:"small",color:"primary"}):l?e.jsx(T,{label:"Receiver",size:"small",color:"secondary"}):e.jsx(T,{label:"Observer",size:"small"});return e.jsxs(s,{sx:{p:2,borderRadius:1,border:"1px solid",borderColor:c?"success.light":"divider",backgroundColor:c?"success.50":"transparent"},children:[e.jsxs(s,{sx:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",mb:2},children:[e.jsxs(s,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsxs(o,{variant:"body2",fontWeight:"medium",children:["Leg: ",n.transferLegId]}),x(),c&&e.jsx(T,{label:"Allocated",size:"small",color:"success"})]}),p&&e.jsx(s,{sx:{display:"flex",gap:1},children:c?n.allocations.map(u=>e.jsx(A,{variant:"outlined",color:"warning",size:"small",disabled:t,onClick:()=>h(u.contractId),children:a?e.jsx(O,{size:16,color:"inherit"}):"Withdraw"},u.contractId)):e.jsx(A,{variant:"contained",size:"small",disabled:t,onClick:d,children:a?e.jsx(O,{size:16,color:"inherit"}):"Create Allocation"})})]}),e.jsxs(s,{sx:{display:"grid",gridTemplateColumns:"repeat(3, 1fr)",gap:2},children:[e.jsxs(s,{children:[e.jsx(o,{variant:"caption",color:"text.secondary",children:"Amount"}),e.jsxs(o,{variant:"body2",children:[n.transferLeg.amount," ",n.transferLeg.instrumentId.id]})]}),e.jsxs(s,{children:[e.jsx(o,{variant:"caption",color:"text.secondary",children:"Sender"}),e.jsx(R,{value:n.transferLeg.sender,maxLength:20})]}),e.jsxs(s,{children:[e.jsx(o,{variant:"caption",color:"text.secondary",children:"Receiver"}),e.jsx(R,{value:n.transferLeg.receiver,maxLength:20})]})]})]})},rr=({items:n})=>{const[r,t]=b.useState(null),[a,d]=b.useState(!1),[h,p]=b.useState(null),[l,c]=b.useState(!1),[x,u]=b.useState(null),f=b.useMemo(()=>{if(!h)return null;const i=n.find(g=>g.kind==="allocation"&&g.id===h);return i||null},[n,h]),[m,y]=b.useState(null),v=Ke(),L=ze(),w=$e(),P=i=>{t(i),d(!0)},k=()=>{d(!1),t(null)},C=(i,g)=>{y(i.id),v.mutate({party:i.currentPartyId,contractId:i.id,instrumentId:i.instrumentId,instructionChoice:g},{onSuccess:()=>{S.success(`${g} transfer successful`),k()},onError:I=>S.error(`Failed to ${g.toLowerCase()} transfer: ${I instanceof Error?I.message:"Unknown error"}`),onSettled:()=>y(null)})},B=i=>{p(i.id),c(!0)},z=()=>{c(!1),p(null)},E=(i,g)=>{y(i.id),u(g.transferLegId),L.mutate({party:i.currentPartyId,allocationSpecification:{settlement:i.settlement,transferLegId:g.transferLegId,transferLeg:g.transferLeg}},{onSuccess:()=>{S.success("Allocation created successfully")},onError:I=>S.error(`Failed to create allocation: ${I instanceof Error?I.message:"Unknown error"}`),onSettled:()=>{y(null),u(null)}})},M=(i,g,I)=>{y(i.id),u(g.transferLegId),w.mutate({party:i.currentPartyId,contractId:I,instrumentId:g.transferLeg.instrumentId},{onSuccess:()=>{S.success("Allocation withdrawn successfully")},onError:$=>S.error(`Failed to withdraw allocation: ${$ instanceof Error?$.message:"Unknown error"}`),onSettled:()=>{y(null),u(null)}})};return n.length===0?null:e.jsxs(s,{sx:{mb:6},children:[e.jsxs(s,{sx:{display:"flex",mb:2},children:[e.jsx(o,{variant:"h6",sx:{textTransform:"uppercase"},fontWeight:"bold",children:"Action Required"}),e.jsx(Qe,{badgeContent:n.length,color:"error",sx:{ml:2}})]}),e.jsx(s,{sx:{display:"flex",flexDirection:"column",gap:2},children:n.map(i=>{const g=m===i.id;switch(i.kind){case"allocation":return e.jsx(Je,{item:i,isLoading:g,onClick:()=>B(i)},i.id);case"transfer":return e.jsx(Ge,{item:i,isLoading:g,onClick:()=>P(i),onAccept:()=>C(i,"Accept"),onReject:()=>C(i,"Reject"),onWithdraw:()=>C(i,"Withdraw")},i.id)}})}),e.jsx(Ye,{item:r,open:a,isLoading:m!==null,onClose:k,onAccept:i=>C(i,"Accept"),onReject:i=>C(i,"Reject"),onWithdraw:i=>C(i,"Withdraw")}),e.jsx(Xe,{item:f,open:l,isLoading:m!==null,loadingLegId:x,onClose:z,onCreateAllocation:i=>f&&E(f,i),onWithdrawAllocation:(i,g)=>f&&M(f,i,g)})]})},nr=({partyId:n,walletName:r,isPrimary:t})=>{const{instruments:a,isLoading:d}=Se(n),h=a.length>0,p=e.jsxs(s,{sx:{p:1,display:"flex",justifyContent:"center",alignItems:"center",textAlign:"center"},children:[e.jsx(oe,{sx:{visibility:"hidden",m:1,height:25,width:25}}),e.jsx(o,{sx:{position:"absolute"},children:"There are currently no assets in this wallet"})]}),l=e.jsxs(s,{sx:{p:1},children:[e.jsx(J,{variant:"rectangular",height:40}),e.jsx(J,{variant:"rectangular",height:40,sx:{mt:1}})]}),c=a.map(x=>e.jsx(tr,{item:x},`${x.instrumentId.admin}::${x.instrumentId.id}`));return e.jsx(Te,{to:"/wallet/$walletId",params:{walletId:n},style:{textDecoration:"none",color:"inherit"},children:e.jsxs(s,{sx:{display:"flex",flexDirection:"column"},children:[e.jsxs(s,{sx:{mb:1,display:"flex",flexDirection:"row",alignItems:"center",gap:1},children:[e.jsx(o,{sx:{textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap",maxWidth:"200px"},fontWeight:"bold",color:"secondary",children:r}),t&&e.jsx(T,{label:"Primary",size:"small",color:"primary"})]}),e.jsx(s,{component:U,variant:"outlined",sx:{background:x=>x.palette.mode==="dark"?void 0:x.palette.grey[100],display:"flex",flexDirection:"column",cursor:"pointer",transition:"all 0.2s ease-in-out","&:hover":{borderColor:"primary.main",boxShadow:1}},children:d?l:h?c:p})]})})},tr=({item:n})=>{const r=n.instrument?.symbol??n.instrumentId.id,t=n.instrument?.name??n.instrumentId.id,a=n.lockedAmount!=="0";return e.jsxs(s,{borderRadius:0,sx:{"&:not(:first-of-type)":{borderTop:d=>`1px solid ${d.palette.divider}`},p:1,display:"flex",alignItems:"center"},children:[e.jsx(oe,{sx:{m:1,height:25,width:25},children:r[0]}),e.jsxs(s,{children:[e.jsx(o,{sx:{maxWidth:"100px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},color:"textSecondary",variant:"body2",children:t}),e.jsxs(o,{variant:"body2",fontWeight:"700",children:[n.totalAmount," ",r,a&&e.jsxs(o,{component:"span",variant:"body2",color:"textSecondary",sx:{ml:.5},children:["(",n.availableAmount," available)"]})]})]})]})},sr=()=>{const n=ke().slice().sort((r,t)=>Number(r.primary)-Number(t.primary));return e.jsxs(s,{sx:{mt:1},children:[e.jsx(o,{variant:"h6",sx:{textTransform:"uppercase",mb:2},fontWeight:"bold",children:"Wallets"}),e.jsx(s,{sx:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:6},children:n.map(r=>e.jsx(nr,{partyId:r.partyId,walletName:r.hint,isPrimary:r.primary},r.partyId))})]})};function cr(){const n=we()?.partyId,r=Me(De(n)),{data:t}=G(Be(n)),{data:a}=G(Ee(n)),d=b.useCallback((l,c)=>JSON.stringify([l.settlementRef.id,l.settlementRef.cid,c]),[]),h=b.useMemo(()=>{const l=new Map;for(const c of t??[]){const{settlement:x,transferLegs:u}=c.interfaceViewValue;for(const f in u){const m=d(x,f);l.set(m,[])}}for(const c of a??[]){const{settlement:x,transferLegId:u}=c.interfaceViewValue.allocation,f=d(x,u);l.has(f)&&l.get(f).push(c)}return l},[t,a,d]),p=b.useMemo(()=>{if(!n)return[];const l=[];if(r.data)for(const c of r.data){const x=c.interfaceViewValue,u=x.transfer,f=x.status,m="tag"in f?f.tag:f.current?.tag,y=u?.meta?.values?.[Pe.MEMO_KEY]??"",v={kind:"transfer",id:c.contractId,currentPartyId:n,tag:m,type:m?.startsWith("Transfer")?"Transfer":m,date:u.requestedAt,expiry:u.executeBefore,message:y,sender:u.sender,receiver:u.receiver,instrumentId:u.instrumentId,amount:u?.amount};l.push(v)}if(t)for(const c of t){const{settlement:x,transferLegs:u}=c.interfaceViewValue,m=Object.entries(u).map(([v,L])=>({transferLegId:v,transferLeg:L,allocations:h.get(d(x,v))??[]})).filter(v=>v.transferLeg.sender===n||v.transferLeg.receiver===n);if(m.length===0)continue;const y={kind:"allocation",id:c.contractId,currentPartyId:n,expiry:x.allocateBefore,settlement:x,transferLegs:m};l.push(y)}return l},[r.data,t,h,n,d]);return e.jsxs(s,{sx:{my:8},children:[e.jsx(o,{variant:"h3",component:"h1",sx:{mb:6},children:"Dashboard"}),e.jsx(rr,{items:p}),e.jsx(sr,{})]})}export{cr as component};
|