@canton-network/example-portfolio 0.18.0 → 0.18.2

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.
@@ -0,0 +1 @@
1
+ import{A as ue,Q as ge,C as fe,r as b,g as me,a as be,u as ye,E as Z,c as ve,j as e,F as j,b as je,s as ee,G as Ce,H as Ie,w as Ae,f as We,J as Oe,K as Re,L as Le,M as re,N as ne,T as o,O as te,B as s,R as se,k as A,S as O,P as U,U as T,t as S,V as Se,W as Te,X as ke,v as we,y as G,x as Pe}from"./index--XTC7grR.js";import{c as ze,d as De,u as $e,a as Be,b as Ee}from"./useWithdrawAllocation-Dnpsc_8O.js";import{C as R}from"./copyable-identifier-DwUkznZR.js";import{A as oe,S as X}from"./Avatar-D-MTnORs.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 Y(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:Y(d),color:m,overlap:f,variant:C,badgeContent:L}),I=E||z==null&&C!=="dot",{color:D=m,overlap:ie=f,anchorOrigin:le,variant:K=C}=I?g:a,ce=Y(le),H=K!=="dot"?i:void 0,F={...a,badgeContent:z,invisible:I,max:M,displayValue:H,showZero:k,anchorOrigin:ce,color:D,overlap:ie,variant:K},_=qe(F),J={slots:{root:w?.root??c.Root,badge:w?.badge??c.Badge},slotProps:{root:P?.root??x.root,badge:P?.badge??x.badge}},[de,xe]=Z("root",{elementType:Ue,externalForwardedProps:{...J,...B},ownerState:F,className:ve(_.root,h),ref:t,additionalProps:{as:l}}),[pe,he]=Z("badge",{elementType:Ne,externalForwardedProps:J,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,$=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),Je=n=>n.transferLegs.filter(r=>Q(n.currentPartyId,r)&&r.allocations.length>0),Ze=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:$(r).label}),e.jsx(s,{sx:{display:"flex",alignItems:"center",gap:1},children:e.jsx(R,{value:$(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:$(r).label}),e.jsx(R,{value:$(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"})})]})},Xe=n=>{const{item:r,isLoading:t,onClick:a}=n,d=_e(r),h=Je(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()})]})]})})},Ye=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=De(),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:D=>S.error(`Failed to withdraw allocation: ${D instanceof Error?D.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(Xe,{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(Ze,{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(Ye,{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(X,{variant:"rectangular",height:40}),e.jsx(X,{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($e(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};
@@ -0,0 +1 @@
1
+ import{n as R,j as e,p as P,r as m,q as I,v as x,w as y,f as b,x as C,e as H,y as f,z as D}from"./index--XTC7grR.js";import{u as V,a as N,b as U,c as E,d as M}from"./useWithdrawAllocation-Dnpsc_8O.js";import{u as O,a as q}from"./useTransactionHistory-dF8VUKzG.js";const p=({name:t,amount:s,instrument:o})=>{const i=R(o),a=`${o.id} from admin ${o.admin}`;return e.jsxs("span",{children:[t&&e.jsx("span",{children:t}),e.jsx("strong",{children:s}),i?e.jsxs("span",{title:a,children:[" ",i.instrument.symbol]}):e.jsxs("span",{title:a,children:[" ",o.id," (warning: unknown instrument)"]})]})},w=({value:t,onChange:s})=>{const o=P(),i=new Map;let a="";for(const[c,u]of o)for(const d of u){if(i.has(d.symbol))throw new Error(`duplicate symbol: ${d.symbol}`);i.set(d.symbol,{admin:c,id:d.id}),d.id===t?.id&&c===t?.admin&&(a=d.symbol)}const l=[...i.keys()].sort(),[r,n]=m.useState(a);return e.jsxs("select",{className:"select-instrument",value:r,onChange:c=>{n(c.target.value),s(i.get(c.target.value))},children:[e.jsx("option",{value:"",children:"Select an option..."},""),l.map(c=>e.jsx("option",{value:c,children:c},c))]})},F=()=>{const t=I().status?.session?.accessToken,s=x()?.partyId,{listHoldings:o,tap:i}=y(),a=b(),[l,r]=m.useState(void 0),[n,c]=m.useState(void 0),[u,d]=m.useState(1e4),g=new Date,j=m.useCallback(async()=>{if(s){const h=await o({party:s});r(h)}else r(void 0)},[s,o]);return m.useEffect(()=>{let h=!1;return(async()=>{if(s){const k=await o({party:s});h||r(k)}else r(void 0)})(),()=>{h=!0}},[s,o]),e.jsxs("div",{children:[e.jsxs("form",{onSubmit:h=>h.preventDefault(),className:"tap",children:[e.jsx(w,{value:n,onChange:h=>c(h)}),e.jsx("input",{type:"number",value:u,onChange:h=>d(Number(h.target.value))}),e.jsx("button",{type:"submit",disabled:!t||!s||!n,onClick:()=>{i({registryUrls:a,party:s,sessionToken:t,instrumentId:n,amount:u}).then(()=>j())},children:"TAP"})]}),e.jsx("ul",{children:l?.map(h=>e.jsxs("li",{children:[C.isHoldingLocked(h,g)&&e.jsx("span",{children:"🔒"}),e.jsx(p,{amount:h.amount,instrument:h.instrumentId})]},h.contractId))})]})},B=()=>{const t=H(),s=b(),[o,i]=m.useState(""),[a,l]=m.useState(""),r=[...s.keys()];return r.sort(),e.jsxs("div",{children:[e.jsx("h2",{children:"Registries"}),e.jsxs("table",{children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Party ID"}),e.jsx("th",{children:"Registry URL"})]})}),e.jsx("tbody",{children:r.map(n=>e.jsxs("tr",{children:[e.jsx("td",{children:n}),e.jsx("td",{children:s.get(n)}),e.jsx("td",{children:e.jsx("button",{type:"submit",onClick:()=>t.deleteRegistryUrl(n),children:"🗑️"})})]},n))})]}),e.jsx("h2",{children:"Add new registry"}),e.jsxs("form",{onSubmit:n=>n.preventDefault(),children:[e.jsx("p",{children:"The party ID is optional and will be retrieved from the URL if not specified. Note that in this case you need to trust the URL to provide the right information."}),e.jsx("label",{htmlFor:"partyId",children:"Party ID: "}),e.jsx("input",{id:"partyId",value:o,onChange:n=>i(n.target.value)}),e.jsx("br",{}),e.jsx("label",{htmlFor:"url",children:"Registry URL: "}),e.jsx("input",{id:"url",value:a,onChange:n=>l(n.target.value)}),e.jsx("br",{}),e.jsx("button",{type:"submit",onClick:async()=>t.setRegistryUrl(o&&void 0,a),children:"Add registry"})]})]})},L=()=>{const t=x()?.partyId;return f(V(t))},T=({party:t,contractId:s,transferInstructionView:o})=>{const i=b(),{exerciseTransfer:a}=y(),l=o.transfer,r=o.status,{meta:n}=l,c=n.values[C.MEMO_KEY],u="tag"in r?r.tag:r.current?.tag;return e.jsxs("div",{children:["status: ",e.jsx("strong",{children:u})," ",e.jsx("br",{}),"sender: ",e.jsx("strong",{children:l.sender})," ",e.jsx("br",{}),"receiver: ",e.jsx("strong",{children:l.receiver})," ",e.jsx("br",{}),c&&e.jsxs("span",{children:["message: ",e.jsx("strong",{children:c})," ",e.jsx("br",{})]}),e.jsx(p,{amount:l.amount,instrument:l.instrumentId}),u==="TransferPendingReceiverAcceptance"&&l.receiver===t&&e.jsxs("div",{children:[e.jsx("button",{disabled:!s,onClick:()=>{a({registryUrls:i,party:t,contractId:s,instrumentId:l.instrumentId,instructionChoice:"Accept"})},children:"Accept"}),e.jsx("button",{disabled:!s,onClick:()=>{a({registryUrls:i,party:t,contractId:s,instrumentId:l.instrumentId,instructionChoice:"Reject"})},children:"Reject"})]}),l.status=="pending"&&!l.incoming&&e.jsx("button",{onClick:()=>{a({registryUrls:i,party:t,contractId:l.contractId,instrumentId:l.instrumentId,instructionChoice:"Withdraw"})},children:"Withdraw"})]})},W=()=>{const t=x()?.partyId,{data:s}=L();return e.jsxs("div",{children:[e.jsx("h2",{children:"Pending transfers"}),t&&e.jsx("ul",{children:s?.map(o=>e.jsx("li",{children:e.jsx(T,{party:t,contractId:o.contractId,transferInstructionView:o.interfaceViewValue})},o.contractId))})]})},$=()=>{const t=x()?.partyId,{mutate:s}=D(),[o,i]=m.useState(""),[a,l]=m.useState(100),[r,n]=m.useState(""),[c,u]=m.useState(void 0);return e.jsxs("form",{onSubmit:d=>d.preventDefault(),children:[e.jsx("label",{htmlFor:"instrument",children:"Instrument "}),e.jsx(w,{value:c,onChange:d=>u(d)}),e.jsx("br",{}),e.jsx("label",{htmlFor:"receiver",children:"Receiver: "}),e.jsx("input",{id:"receiver",value:o,onChange:d=>i(d.target.value)}),e.jsx("br",{}),e.jsx("label",{htmlFor:"amount",children:"Amount to transfer: "}),e.jsx("input",{id:"amount",type:"number",value:a,onChange:d=>l(Number(d.target.value))}),e.jsx("br",{}),e.jsx("label",{htmlFor:"memo",children:"Message for receiver: "}),e.jsx("input",{id:"memo",value:r,onChange:d=>n(d.target.value)}),e.jsx("br",{}),e.jsx("button",{type:"submit",disabled:!t||!c,onClick:()=>{s({instrumentId:c,sender:t,receiver:o,amount:`${a}`,expiry:new Date(Date.now()+1440*60*1e3),memo:r||void 0})},children:"Transfer"})]})},v=({change:t})=>e.jsxs("span",{children:["In:",e.jsx(p,{instrument:t.instrumentId,amount:t.inputAmount}),", Out:",e.jsx(p,{instrument:t.instrumentId,amount:t.outputAmount}),", Change:",e.jsx(p,{instrument:t.instrumentId,amount:t.amountChange})]}),Q=()=>{const t=x()?.partyId,{status:s,fetchNextPage:o,isFetchingNextPage:i,hasNextPage:a}=O(),l=q();return e.jsxs("div",{children:[e.jsx("h2",{children:"Transaction History"}),t&&l.map(r=>e.jsxs("div",{children:[e.jsxs("code",{children:["At ",r.offset," (",r.recordTime,")"]}),e.jsx("br",{}),r.events.map((n,c)=>e.jsx("div",{children:n.transferInstruction?e.jsx(T,{party:t,transferInstructionView:n.transferInstruction}):e.jsxs("div",{children:[e.jsx("strong",{children:n.label.type}),n.lockedHoldingsChangeSummaries.length>0&&e.jsxs("div",{children:[e.jsx("strong",{children:"Locked:"}),n.lockedHoldingsChangeSummaries.map((u,d)=>e.jsx(v,{change:u},d))]}),n.unlockedHoldingsChangeSummaries.length>0&&e.jsxs("div",{children:[e.jsx("strong",{children:"Locked:"}),n.unlockedHoldingsChangeSummaries.map((u,d)=>e.jsx(v,{change:u},d))]})]})},c))]},r.updateId)),!a&&e.jsx("span",{children:"(end)"}),s==="pending"&&e.jsx("span",{children:"⏳"}),!i&&a&&t&&e.jsx("button",{disabled:i||!a||!t,onClick:()=>o(),children:"load more"})]})},G=()=>{const{error:t,status:s,connect:o,open:i,disconnect:a}=I(),l=s?.isConnected,r=x()?.partyId;return e.jsxs("div",{className:"card",children:[!l&&e.jsx("button",{onClick:()=>o(),children:"connect to Wallet Gateway"}),l&&e.jsx("button",{onClick:()=>a(),children:"disconnect"}),e.jsx("button",{onClick:()=>i(),children:"open Wallet Gateway"}),t&&e.jsxs("p",{className:"error",children:[e.jsx("b",{children:"Error:"})," ",e.jsx("i",{children:t})]}),e.jsx("br",{}),l&&e.jsxs("div",{children:["Party: ",r,e.jsx("br",{}),"SessionToken: ",s?.session?.accessToken?"ok":"nope"]})]})},K=()=>{const t=x()?.partyId;return f(N(t))},A=()=>{const t=x()?.partyId;return f(U(t))},S=({transferLegId:t,transferLeg:s})=>e.jsxs("div",{children:[e.jsxs("h3",{children:["Transfer leg ",t]}),e.jsx("strong",{children:"sender:"})," ",s.sender,e.jsx("br",{}),e.jsx("strong",{children:"receiver:"})," ",s.receiver,e.jsx("br",{}),e.jsx(p,{amount:s.amount,instrument:s.instrumentId})]}),X=({party:t,contractId:s,allocation:o})=>{const{settlement:i,transferLeg:a,transferLegId:l}=o.allocation,r=b(),{withdrawAllocation:n}=y(),{refetch:c}=A();return e.jsxs("div",{children:[e.jsx("h3",{children:"Settlement"}),e.jsx("strong",{children:"executor:"})," ",i.executor,e.jsx("br",{}),e.jsx("strong",{children:"allocateBefore:"})," ",i.allocateBefore,new Date(i.allocateBefore)<=new Date&&"(EXPIRED!)",e.jsx("br",{}),e.jsx(S,{transferLegId:l,transferLeg:a}),a.sender===t&&e.jsx("button",{onClick:async()=>{await n({registryUrls:r,party:t,instrumentId:a.instrumentId,contractId:s}),c()},children:"Withdraw"})]})},z=({settlementInfo:t})=>e.jsxs("div",{children:[e.jsx("h3",{children:"Settlement"}),e.jsx("strong",{children:"executor:"})," ",t.executor,e.jsx("br",{}),e.jsx("strong",{children:"allocateBefore:"})," ",t.allocateBefore,new Date(t.allocateBefore)<=new Date&&"(EXPIRED!)",e.jsx("br",{})]}),J=({party:t,allocationRequest:s,allocationsByTransferLegId:o})=>{const{settlement:i,transferLegs:a}=s,{mutate:l}=E(),{mutate:r}=M();return e.jsxs("div",{children:[e.jsx(z,{settlementInfo:i}),e.jsx("h3",{children:"Transfer Legs"}),Object.entries(a).map(([n,c])=>e.jsxs("div",{children:[e.jsx(S,{transferLegId:n,transferLeg:c}),c.sender===t&&e.jsx("button",{onClick:()=>l({party:t,allocationSpecification:{settlement:i,transferLegId:n,transferLeg:c}}),children:"Create Allocation"}),o?.get(n)?.map(u=>e.jsxs("div",{children:[e.jsx("span",{children:"Allocation Made"}),c.sender===t&&e.jsx("button",{onClick:()=>r({party:t,instrumentId:c.instrumentId,contractId:u.contractId}),children:"Withdraw Allocation"})]},u.contractId))]},n))]})},Y=()=>{const t=y(),s=x()?.partyId,{data:o}=K(),{data:i}=A(),a=m.useCallback((n,c)=>JSON.stringify([n.settlementRef.id,n.settlementRef.cid,c]),[]),[l,r]=m.useMemo(()=>{const n=new Map,c=[];for(const u of o??[]){const{settlement:d,transferLegs:g}=u.interfaceViewValue;for(const j in g){const h=a(d,j);n.set(h,[])}}for(const u of i??[]){const{settlement:d,transferLegId:g}=u.interfaceViewValue.allocation,j=a(d,g);n.has(j)?n.get(j).push(u):(console.log(n),c.push(u))}return[n,c]},[o,i,a]);return m.useEffect(()=>{s&&(async()=>{const n=await t.listAllocationInstructions({party:s});console.log("allocationInstructions",n)})()},[t,s]),e.jsxs("div",{children:[e.jsx("h2",{children:"Allocation requests"}),s&&o?.map(n=>e.jsx("div",{children:e.jsx(J,{party:s,allocationRequest:n.interfaceViewValue,allocationsByTransferLegId:new Map(Object.keys(n.interfaceViewValue.transferLegs).map(c=>[c,l.get(a(n.interfaceViewValue.settlement,c))??[]]))})},n.contractId)),e.jsx("h2",{children:"Unknown Allocations"}),s&&r?.map(n=>e.jsx("div",{children:e.jsx(X,{party:s,contractId:n.contractId,allocation:n.interfaceViewValue})},n.contractId))]})},_=({tabs:t,initialValue:s})=>{const o=s??t[0]?.value,[i,a]=m.useState(o),l=t.find(r=>r.value===i);return e.jsxs("div",{children:[e.jsx("div",{role:"tablist",className:"flex gap-2 border-b",children:t.map(r=>e.jsx("button",{role:"tab","aria-selected":i===r.value,className:`${i===r.value?"bg-blue-500":"opacity-60"}`,onClick:()=>a(r.value),children:i===r.value?`[${r.label}]`:r.label},r.value))}),e.jsx("div",{role:"tabpanel",children:l?.content})]})};function se(){return e.jsxs(e.Fragment,{children:[e.jsx("h1",{children:"dApp Portfolio"}),e.jsx(G,{}),e.jsx(_,{tabs:[{label:"Holdings",value:"holdings",content:e.jsx(F,{})},{label:"Transfer",value:"twoStepTransfer",content:e.jsx($,{})},{label:"Pending Transfers",value:"pendingTransfers",content:e.jsx(W,{})},{label:"Transaction History",value:"transactionHistory",content:e.jsx(Q,{})},{label:"Allocations",value:"allocations",content:e.jsx(Y,{})},{label:"Registry Settings",value:"registries",content:e.jsx(B,{})}]})]})}export{se as component};
@@ -0,0 +1 @@
1
+ import{g,a as y,r as C,u as j,j as s,c as b,b as v,s as R,P as U,d as f,e as I,f as S,h as T,t as m,T as u,B as d,i as p,k as B,D as M,I as P,o as z,l as D,m as L}from"./index--XTC7grR.js";import{C as w}from"./copyable-identifier-DwUkznZR.js";import{T as k,a as A,b as F,c as h,d as i,e as N}from"./TableRow-DBABwwVa.js";function W(r){return g("MuiCard",r)}y("MuiCard",["root"]);const H=r=>{const{classes:n}=r;return v({root:["root"]},W,n)},E=R(U,{name:"MuiCard",slot:"Root"})({overflow:"hidden"}),V=C.forwardRef(function(n,o){const a=j({props:n,name:"MuiCard"}),{className:l,raised:e=!1,...t}=a,c={...a,raised:e},x=H(c);return s.jsx(E,{className:b(x.root,l),elevation:e?8:void 0,ref:o,ownerState:c,...t})});function q(r){return g("MuiCardContent",r)}y("MuiCardContent",["root"]);const $=r=>{const{classes:n}=r;return v({root:["root"]},q,n)},G=R("div",{name:"MuiCardContent",slot:"Root"})({padding:16,"&:last-child":{paddingBottom:24}}),J=C.forwardRef(function(n,o){const a=j({props:n,name:"MuiCardContent"}),{className:l,component:e="div",...t}=a,c={...a,component:e},x=$(c);return s.jsx(G,{as:e,className:b(x.root,l),ownerState:c,ref:o,...t})}),K=f(s.jsx("path",{d:"M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6zM19 4h-3.5l-1-1h-5l-1 1H5v2h14z"})),O=z({partyId:L().min(1,"Party ID is required"),registryUrl:D("Must be a valid URL")});function Q(){const r=I(),n=S(),o=Array.from(n.entries()).map(([e,t])=>({partyId:e,registryUrl:t})),a=T({defaultValues:{partyId:"",registryUrl:""},onSubmit:async({value:e})=>{const t=e.partyId.trim()===""?void 0:e.partyId;r.setRegistryUrl(t,e.registryUrl),m.success("Registry URL set"),a.reset()},validators:{onChange:O}}),l=e=>{r.deleteRegistryUrl(e),m.success("Registry URL deleted")};return s.jsx(V,{sx:{mb:3},children:s.jsxs(J,{children:[s.jsx(u,{variant:"h6",component:"h2",gutterBottom:!0,children:"Registries"}),s.jsx(u,{variant:"body2",color:"text.secondary",sx:{mb:3},children:"The API URLs provided by the party managing the token standard compliant instruments"}),s.jsx(d,{sx:{mb:3},children:s.jsx("form",{onSubmit:e=>{e.preventDefault(),e.stopPropagation(),a.handleSubmit()},children:s.jsxs(d,{sx:{display:"flex",gap:2,mb:2},children:[s.jsx(a.Field,{name:"partyId",children:e=>s.jsx(p,{label:"Party ID",value:e.state.value,onChange:t=>e.handleChange(t.target.value),onBlur:e.handleBlur,error:e.state.meta.isTouched&&e.state.meta.errors.length>0,helperText:e.state.meta.isTouched&&e.state.meta.errors[0]?.message,fullWidth:!0,size:"small"})}),s.jsx(a.Field,{name:"registryUrl",children:e=>s.jsx(p,{label:"Registry URL",value:e.state.value,onChange:t=>e.handleChange(t.target.value),onBlur:e.handleBlur,error:e.state.meta.isTouched&&e.state.meta.errors.length>0,helperText:e.state.meta.isTouched&&e.state.meta.errors[0]?.message,fullWidth:!0,size:"small"})}),s.jsx(a.Subscribe,{selector:e=>({canSubmit:e.canSubmit,isSubmitting:e.isSubmitting}),children:({canSubmit:e,isSubmitting:t})=>s.jsx(B,{type:"submit",variant:"contained",disabled:!e||t,children:t?"Submitting...":"Add"})})]})})}),s.jsx(M,{sx:{mb:3}}),s.jsx(k,{component:U,variant:"outlined",sx:{borderRadius:1},children:s.jsxs(A,{size:"medium",children:[s.jsx(F,{children:s.jsxs(h,{sx:{backgroundColor:"action.hover"},children:[s.jsx(i,{sx:{py:2,px:3,fontWeight:"medium"},children:"Party ID"}),s.jsx(i,{sx:{py:2,px:3,fontWeight:"medium"},children:"Registry URL"}),s.jsx(i,{sx:{py:2,px:3,fontWeight:"medium"},children:"Actions"})]})}),s.jsx(N,{children:o.length>0?o.map(e=>s.jsxs(h,{sx:{"&:hover":{backgroundColor:"action.hover"}},children:[s.jsx(i,{sx:{py:2.5,px:3},children:s.jsx(w,{value:e.partyId,maxLength:30})}),s.jsx(i,{sx:{py:2.5,px:3},children:e.registryUrl}),s.jsx(i,{sx:{py:2.5,px:3},children:s.jsx(d,{sx:{display:"flex",gap:1},children:s.jsx(P,{size:"small",onClick:()=>l(e.partyId),color:"error",children:s.jsx(K,{fontSize:"small"})})})})]},e.partyId)):s.jsx(h,{children:s.jsx(i,{colSpan:3,sx:{py:4,px:3},children:s.jsx(d,{sx:{textAlign:"center"},children:s.jsx(u,{variant:"body1",color:"text.secondary",children:"No registries configured"})})})})})]})})]})})}function _(){return s.jsxs(d,{sx:{mt:4},children:[s.jsx(u,{variant:"h4",component:"h1",gutterBottom:!0,children:"Settings"}),s.jsx(Q,{})]})}export{_ as component};
@@ -0,0 +1 @@
1
+ import{Q as p,a9 as P,aa as l,ab as b,A as x,v as d,w as m,r as N,ac as g,L as R}from"./index--XTC7grR.js";var w=class extends p{constructor(e,r){super(e,r)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){super.setOptions({...e,behavior:P()})}getOptimisticResult(e){return e.behavior=P(),super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"backward"}}})}createResult(e,r){const{state:t}=e,a=super.createResult(e,r),{isFetching:i,isRefetching:s,isError:o,isRefetchError:v}=a,n=t.fetchMeta?.fetchMore?.direction,c=o&&n==="forward",u=i&&n==="forward",h=o&&n==="backward",f=i&&n==="backward";return{...a,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:b(r,t.data),hasPreviousPage:l(r,t.data),isFetchNextPageError:c,isFetchingNextPage:u,isFetchPreviousPageError:h,isFetchingPreviousPage:f,isRefetchError:v&&!c&&!h,isRefetching:s&&!u&&!f}}};function F(e,r){return x(e,w)}const y=e=>{const{getTransactionHistory:r}=m();return F({initialPageParam:null,queryKey:R.getTransactionHistory.forParty(e),queryFn:({pageParam:t})=>e?r({party:e,request:t}):g,getNextPageParam:t=>{if(t!==g&&!t.beginIsLedgerStart)return{endInclusive:t.beginExclusive}},staleTime:1/0})},H=()=>{const e=d()?.partyId;return y(e)},T=e=>{const{data:r}=y(e);return N.useMemo(()=>{const t=new Set,a=[];for(const i of r?.pages??[])for(const s of i?.transactions??[])t.has(s.offset)||(t.add(s.offset),s.events.length>0&&a.push(s));return a},[r])},O=()=>{const e=d()?.partyId;return T(e)};export{O as a,y as b,T as c,H as u};
@@ -1 +1 @@
1
- import{E as n,K as r,h as a,O as l,R as u}from"./index-CYRjFua4.js";const y=s=>{const{listPendingTransfers:e}=n();return{retry:10,queryKey:r.listPendingTransfers.forParty(s),queryFn:async()=>s?e({party:s}):[]}},q=s=>{const{listAllocationRequests:e}=n();return{queryKey:r.listAllocationRequests.forParty(s),queryFn:()=>e({party:s}),enabled:!!s}},A=s=>{const{listAllocations:e}=n();return{queryKey:r.listAllocations.forParty(s),queryFn:()=>e({party:s}),enabled:!!s}},f=()=>{const{createAllocation:s}=n(),e=a(),o=l();return u({mutationFn:t=>s({registryUrls:e,...t}),onSuccess:async(t,i)=>{await o.invalidateQueries({queryKey:r.listAllocations.forParty(i.party)})}})},d=()=>{const{withdrawAllocation:s}=n(),e=a(),o=l();return u({mutationFn:async t=>s({registryUrls:e,...t}),onSuccess:async(t,i)=>{await o.invalidateQueries({queryKey:r.listAllocations.forParty(i.party)})}})};export{q as a,A as b,f as c,d,y as u};
1
+ import{w as n,L as r,f as a,J as l,K as u}from"./index--XTC7grR.js";const y=s=>{const{listPendingTransfers:e}=n();return{retry:10,queryKey:r.listPendingTransfers.forParty(s),queryFn:async()=>s?e({party:s}):[]}},q=s=>{const{listAllocationRequests:e}=n();return{queryKey:r.listAllocationRequests.forParty(s),queryFn:()=>e({party:s}),enabled:!!s}},f=s=>{const{listAllocations:e}=n();return{queryKey:r.listAllocations.forParty(s),queryFn:()=>e({party:s}),enabled:!!s}},A=()=>{const{createAllocation:s}=n(),e=a(),o=l();return u({mutationFn:t=>s({registryUrls:e,...t}),onSuccess:async(t,i)=>{await o.invalidateQueries({queryKey:r.listAllocations.forParty(i.party)})}})},d=()=>{const{withdrawAllocation:s}=n(),e=a(),o=l();return u({mutationFn:async t=>s({registryUrls:e,...t}),onSuccess:async(t,i)=>{await o.invalidateQueries({queryKey:r.listAllocations.forParty(i.party)})}})};export{q as a,f as b,A as c,d,y as u};
@@ -0,0 +1 @@
1
+ import{g as tt,a as et,r as h,u as nt,Y as Wt,Z as Et,_ as $t,$ as Mt,a0 as zt,E as I,c as Q,j as e,b as ot,s as R,G as U,a1 as ut,a2 as Dt,P as J,a3 as Ht,d as ct,p as Lt,y as Nt,a4 as Ft,a5 as Bt,a6 as Gt,L as Ut,x as Ot,B as u,T as b,k as ft,a7 as Vt,a8 as qt,X as Kt,W as Qt}from"./index--XTC7grR.js";import{b as Xt,c as Yt}from"./useTransactionHistory-dF8VUKzG.js";import{C as dt}from"./copyable-identifier-DwUkznZR.js";import{A as Zt,S as G}from"./Avatar-D-MTnORs.js";import{T as xt,a as mt,b as ht,c as Y,d,e as gt}from"./TableRow-DBABwwVa.js";function _t(t){return tt("MuiCollapse",t)}et("MuiCollapse",["root","horizontal","vertical","entered","hidden","wrapper","wrapperInner"]);const Jt=t=>{const{orientation:n,classes:o}=t,s={root:["root",`${n}`],entered:["entered"],hidden:["hidden"],wrapper:["wrapper",`${n}`],wrapperInner:["wrapperInner",`${n}`]};return ot(s,_t,o)},te=R("div",{name:"MuiCollapse",slot:"Root",overridesResolver:(t,n)=>{const{ownerState:o}=t;return[n.root,n[o.orientation],o.state==="entered"&&n.entered,o.state==="exited"&&!o.in&&o.collapsedSize==="0px"&&n.hidden]}})(U(({theme:t})=>({height:0,overflow:"hidden",transition:t.transitions.create("height"),variants:[{props:{orientation:"horizontal"},style:{height:"auto",width:0,transition:t.transitions.create("width")}},{props:{state:"entered"},style:{height:"auto",overflow:"visible"}},{props:{state:"entered",orientation:"horizontal"},style:{width:"auto"}},{props:({ownerState:n})=>n.state==="exited"&&!n.in&&n.collapsedSize==="0px",style:{visibility:"hidden"}}]}))),ee=R("div",{name:"MuiCollapse",slot:"Wrapper"})({display:"flex",width:"100%",variants:[{props:{orientation:"horizontal"},style:{width:"auto",height:"100%"}}]}),ne=R("div",{name:"MuiCollapse",slot:"WrapperInner"})({width:"100%",variants:[{props:{orientation:"horizontal"},style:{width:"auto",height:"100%"}}]}),at=h.forwardRef(function(n,o){const s=nt({props:n,name:"MuiCollapse"}),{addEndListener:i,children:c,className:l,collapsedSize:a="0px",component:g,easing:C,in:x,onEnter:j,onEntered:f,onEntering:A,onExit:p,onExited:P,onExiting:y,orientation:T="vertical",slots:k={},slotProps:W={},style:L,timeout:v=Wt.standard,TransitionComponent:E=Et,...N}=s,$={...s,orientation:T,collapsedSize:a},M=Jt($),m=$t(),O=Mt(),z=h.useRef(null),X=h.useRef(),V=typeof a=="number"?`${a}px`:a,F=T==="horizontal",B=F?"width":"height",q=h.useRef(null),st=zt(o,q),H=r=>w=>{if(r){const S=q.current;w===void 0?r(S):r(S,w)}},rt=()=>z.current?z.current[F?"clientWidth":"clientHeight"]:0,bt=H((r,w)=>{z.current&&F&&(z.current.style.position="absolute"),r.style[B]=V,j&&j(r,w)}),jt=H((r,w)=>{const S=rt();z.current&&F&&(z.current.style.position="");const{duration:D,easing:Z}=ut({style:L,timeout:v,easing:C},{mode:"enter"});if(v==="auto"){const pt=m.transitions.getAutoHeightDuration(S);r.style.transitionDuration=`${pt}ms`,X.current=pt}else r.style.transitionDuration=typeof D=="string"?D:`${D}ms`;r.style[B]=`${S}px`,r.style.transitionTimingFunction=Z,A&&A(r,w)}),vt=H((r,w)=>{r.style[B]="auto",f&&f(r,w)}),wt=H(r=>{r.style[B]=`${rt()}px`,p&&p(r)}),St=H(P),Ct=H(r=>{const w=rt(),{duration:S,easing:D}=ut({style:L,timeout:v,easing:C},{mode:"exit"});if(v==="auto"){const Z=m.transitions.getAutoHeightDuration(w);r.style.transitionDuration=`${Z}ms`,X.current=Z}else r.style.transitionDuration=typeof S=="string"?S:`${S}ms`;r.style[B]=V,r.style.transitionTimingFunction=D,y&&y(r)}),At=r=>{v==="auto"&&O.start(X.current||0,r),i&&i(q.current,r)},it={slots:k,slotProps:W,component:g},[Tt,lt]=I("root",{ref:st,className:Q(M.root,l),elementType:te,externalForwardedProps:it,ownerState:$,additionalProps:{style:{[F?"minWidth":"minHeight"]:V,...L}}}),[It,Rt]=I("wrapper",{ref:z,className:M.wrapper,elementType:ee,externalForwardedProps:it,ownerState:$}),[Pt,kt]=I("wrapperInner",{className:M.wrapperInner,elementType:ne,externalForwardedProps:it,ownerState:$});return e.jsx(E,{in:x,onEnter:bt,onEntered:vt,onEntering:jt,onExit:wt,onExited:St,onExiting:Ct,addEndListener:At,nodeRef:q,timeout:v==="auto"?null:v,...N,children:(r,{ownerState:w,...S})=>{const D={...$,state:r};return e.jsx(Tt,{...lt,className:Q(lt.className,{entered:M.entered,exited:!x&&V==="0px"&&M.hidden}[r]),ownerState:D,...S,children:e.jsx(It,{...Rt,ownerState:D,children:e.jsx(Pt,{...kt,ownerState:D,children:c})})})}})});at&&(at.muiSupportAuto=!0);const yt=h.createContext({});function oe(t){return tt("MuiAccordion",t)}const _=et("MuiAccordion",["root","heading","rounded","expanded","disabled","gutters","region"]),se=t=>{const{classes:n,square:o,expanded:s,disabled:i,disableGutters:c}=t;return ot({root:["root",!o&&"rounded",s&&"expanded",i&&"disabled",!c&&"gutters"],heading:["heading"],region:["region"]},oe,n)},re=R(J,{name:"MuiAccordion",slot:"Root",overridesResolver:(t,n)=>{const{ownerState:o}=t;return[{[`& .${_.region}`]:n.region},n.root,!o.square&&n.rounded,!o.disableGutters&&n.gutters]}})(U(({theme:t})=>{const n={duration:t.transitions.duration.shortest};return{position:"relative",transition:t.transitions.create(["margin"],n),overflowAnchor:"none","&::before":{position:"absolute",left:0,top:-1,right:0,height:1,content:'""',opacity:1,backgroundColor:(t.vars||t).palette.divider,transition:t.transitions.create(["opacity","background-color"],n)},"&:first-of-type":{"&::before":{display:"none"}},[`&.${_.expanded}`]:{"&::before":{opacity:0},"&:first-of-type":{marginTop:0},"&:last-of-type":{marginBottom:0},"& + &":{"&::before":{display:"none"}}},[`&.${_.disabled}`]:{backgroundColor:(t.vars||t).palette.action.disabledBackground}}}),U(({theme:t})=>({variants:[{props:n=>!n.square,style:{borderRadius:0,"&:first-of-type":{borderTopLeftRadius:(t.vars||t).shape.borderRadius,borderTopRightRadius:(t.vars||t).shape.borderRadius},"&:last-of-type":{borderBottomLeftRadius:(t.vars||t).shape.borderRadius,borderBottomRightRadius:(t.vars||t).shape.borderRadius,"@supports (-ms-ime-align: auto)":{borderBottomLeftRadius:0,borderBottomRightRadius:0}}}},{props:n=>!n.disableGutters,style:{[`&.${_.expanded}`]:{margin:"16px 0"}}}]}))),ie=R("h3",{name:"MuiAccordion",slot:"Heading"})({all:"unset"}),ae=R("div",{name:"MuiAccordion",slot:"Region"})({}),ce=h.forwardRef(function(n,o){const s=nt({props:n,name:"MuiAccordion"}),{children:i,className:c,defaultExpanded:l=!1,disabled:a=!1,disableGutters:g=!1,expanded:C,onChange:x,slots:j={},slotProps:f={},TransitionComponent:A,TransitionProps:p,...P}=s,[y,T]=Dt({controlled:C,default:l,name:"Accordion",state:"expanded"}),k=h.useCallback(H=>{T(!y),x&&x(H,!y)},[y,x,T]),[W,...L]=h.Children.toArray(i),v=h.useMemo(()=>({expanded:y,disabled:a,disableGutters:g,toggle:k}),[y,a,g,k]),E={...s,disabled:a,disableGutters:g,expanded:y},N=se(E),$={transition:A,...j},M={transition:p,...f},m={slots:$,slotProps:M},[O,z]=I("root",{elementType:re,externalForwardedProps:{...m,...P},className:Q(N.root,c),shouldForwardComponentProp:!0,ownerState:E,ref:o}),[X,V]=I("heading",{elementType:ie,externalForwardedProps:m,className:N.heading,ownerState:E}),[F,B]=I("transition",{elementType:at,externalForwardedProps:m,ownerState:E}),[q,st]=I("region",{elementType:ae,externalForwardedProps:m,ownerState:E,className:N.region,additionalProps:{"aria-labelledby":W.props.id,id:W.props["aria-controls"],role:"region"}});return e.jsxs(O,{...z,children:[e.jsx(X,{...V,children:e.jsx(yt.Provider,{value:v,children:W})}),e.jsx(F,{in:y,timeout:"auto",...B,children:e.jsx(q,{...st,children:L})})]})});function de(t){return tt("MuiAccordionDetails",t)}et("MuiAccordionDetails",["root"]);const le=t=>{const{classes:n}=t;return ot({root:["root"]},de,n)},pe=R("div",{name:"MuiAccordionDetails",slot:"Root"})(U(({theme:t})=>({padding:t.spacing(1,2,2)}))),ue=h.forwardRef(function(n,o){const s=nt({props:n,name:"MuiAccordionDetails"}),{className:i,...c}=s,l=s,a=le(l);return e.jsx(pe,{className:Q(a.root,i),ref:o,ownerState:l,...c})});function xe(t){return tt("MuiAccordionSummary",t)}const K=et("MuiAccordionSummary",["root","expanded","focusVisible","disabled","gutters","contentGutters","content","expandIconWrapper"]),me=t=>{const{classes:n,expanded:o,disabled:s,disableGutters:i}=t;return ot({root:["root",o&&"expanded",s&&"disabled",!i&&"gutters"],focusVisible:["focusVisible"],content:["content",o&&"expanded",!i&&"contentGutters"],expandIconWrapper:["expandIconWrapper",o&&"expanded"]},xe,n)},he=R(Ht,{name:"MuiAccordionSummary",slot:"Root"})(U(({theme:t})=>{const n={duration:t.transitions.duration.shortest};return{display:"flex",width:"100%",minHeight:48,padding:t.spacing(0,2),transition:t.transitions.create(["min-height","background-color"],n),[`&.${K.focusVisible}`]:{backgroundColor:(t.vars||t).palette.action.focus},[`&.${K.disabled}`]:{opacity:(t.vars||t).palette.action.disabledOpacity},[`&:hover:not(.${K.disabled})`]:{cursor:"pointer"},variants:[{props:o=>!o.disableGutters,style:{[`&.${K.expanded}`]:{minHeight:64}}}]}})),ge=R("span",{name:"MuiAccordionSummary",slot:"Content"})(U(({theme:t})=>({display:"flex",textAlign:"start",flexGrow:1,margin:"12px 0",variants:[{props:n=>!n.disableGutters,style:{transition:t.transitions.create(["margin"],{duration:t.transitions.duration.shortest}),[`&.${K.expanded}`]:{margin:"20px 0"}}}]}))),fe=R("span",{name:"MuiAccordionSummary",slot:"ExpandIconWrapper"})(U(({theme:t})=>({display:"flex",color:(t.vars||t).palette.action.active,transform:"rotate(0deg)",transition:t.transitions.create("transform",{duration:t.transitions.duration.shortest}),[`&.${K.expanded}`]:{transform:"rotate(180deg)"}}))),ye=h.forwardRef(function(n,o){const s=nt({props:n,name:"MuiAccordionSummary"}),{children:i,className:c,expandIcon:l,focusVisibleClassName:a,onClick:g,slots:C,slotProps:x,...j}=s,{disabled:f=!1,disableGutters:A,expanded:p,toggle:P}=h.useContext(yt),y=m=>{P&&P(m),g&&g(m)},T={...s,expanded:p,disabled:f,disableGutters:A},k=me(T),W={slots:C,slotProps:x},[L,v]=I("root",{ref:o,shouldForwardComponentProp:!0,className:Q(k.root,c),elementType:he,externalForwardedProps:{...W,...j},ownerState:T,additionalProps:{focusRipple:!1,disableRipple:!0,disabled:f,"aria-expanded":p,focusVisibleClassName:Q(k.focusVisible,a)},getSlotProps:m=>({...m,onClick:O=>{m.onClick?.(O),y(O)}})}),[E,N]=I("content",{className:k.content,elementType:ge,externalForwardedProps:W,ownerState:T}),[$,M]=I("expandIconWrapper",{className:k.expandIconWrapper,elementType:fe,externalForwardedProps:W,ownerState:T});return e.jsxs(L,{...v,children:[e.jsx(E,{...N,children:i}),l&&e.jsx($,{...M,children:l})]})}),be=ct(e.jsx("path",{d:"M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20z"})),je=t=>{const n=Lt(),o=Nt({queryKey:Ut.listHoldings.forParty(t),queryFn:()=>Gt({party:t}),enabled:!!t});return{instruments:h.useMemo(()=>o.data?Ft(Bt(o.data),n):[],[o.data,n]),holdings:o.data??[],isLoading:o.isLoading,isError:o.isError,error:o.error,refetch:o.refetch}},ve=ct(e.jsx("path",{d:"M16.59 8.59 12 13.17 7.41 8.59 6 10l6 6 6-6z"})),we=ct(e.jsx("path",{d:"M18 8h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2m-6 9c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2m3.1-9H8.9V6c0-1.71 1.39-3.1 3.1-3.1s3.1 1.39 3.1 3.1z"})),Se=({holding:t,symbol:n})=>{const o=Ot.isHoldingLocked(t,new Date);return e.jsxs(u,{sx:{py:1.5,px:2,display:"flex",alignItems:"center",justifyContent:"space-between","&:not(:last-child)":{borderBottom:s=>`1px solid ${s.palette.divider}`}},children:[e.jsxs(u,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsxs(b,{variant:"body2",children:[t.amount," ",n]}),o&&e.jsx(we,{fontSize:"small",color:"warning",sx:{fontSize:16}})]}),e.jsx(dt,{value:t.contractId,maxLength:12})]})},Ce=({aggregatedHolding:t,holdings:n})=>{const o=t.instrument?.symbol??t.instrumentId.id,s=t.instrument?.name??t.instrumentId.id,i=t.lockedAmount!=="0";return e.jsxs(ce,{disableGutters:!0,sx:{"&:before":{display:"none"},boxShadow:"none","&:not(:last-child)":{borderBottom:c=>`1px solid ${c.palette.divider}`}},children:[e.jsx(ye,{expandIcon:e.jsx(ve,{}),sx:{"&:hover":{backgroundColor:"action.hover"}},children:e.jsxs(u,{sx:{display:"flex",alignItems:"center",gap:2,width:"100%",pr:2},children:[e.jsx(Zt,{sx:{width:32,height:32,fontSize:14},children:o[0]}),e.jsxs(u,{sx:{flexGrow:1},children:[e.jsx(b,{variant:"body2",color:"textSecondary",sx:{maxWidth:"150px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:s}),e.jsxs(b,{variant:"body1",fontWeight:"bold",children:[t.totalAmount," ",o]})]}),i&&e.jsxs(u,{sx:{textAlign:"right"},children:[e.jsxs(b,{variant:"body2",color:"success.main",children:[t.availableAmount," available"]}),e.jsxs(b,{variant:"body2",color:"textSecondary",children:[t.lockedAmount," locked"]})]})]})}),e.jsxs(ue,{sx:{p:0,pl:6},children:[e.jsxs(b,{variant:"caption",color:"textSecondary",sx:{px:2,pt:1,display:"block",textTransform:"uppercase",letterSpacing:.5},children:[t.numOfHoldings," holding",t.numOfHoldings!==1?"s":""]}),e.jsx(u,{children:n.map(c=>e.jsx(Se,{holding:c,symbol:o},c.contractId))})]})]})},Ae=t=>new Date(t).toLocaleString(),Te=t=>{const n=t.events[0];return n?n.label.type:"Unknown"},Ie=t=>{const n=t.events[0];if(!n)return"-";if(n.transferInstruction?.transfer?.instrumentId){const{admin:s,id:i}=n.transferInstruction.transfer.instrumentId;return i||s}const o=n.unlockedHoldingsChangeSummaries[0]||n.lockedHoldingsChangeSummaries[0];return o?.instrumentId?o.instrumentId.id||o.instrumentId.admin:"-"},Re=(t,n)=>{const o=t.events[0];if(!o)return{amount:"-",isOutgoing:!1};if(o.transferInstruction?.transfer){const i=o.transferInstruction.transfer,c=i.amount||"0",l=i.sender===n;return{amount:c,isOutgoing:l}}const s=o.unlockedHoldingsChangeSummaries[0]||o.lockedHoldingsChangeSummaries[0];if(s){const i=s.amountChange||"0",l=new Vt(i).isNegative();return{amount:i,isOutgoing:l}}return{amount:"-",isOutgoing:!1}},Pe=(t,n)=>{const o=t.events[0];if(!o)return"-";if(o.transferInstruction?.transfer){const s=o.transferInstruction.transfer;if(s.sender===n)return s.receiver||"-";if(s.receiver===n)return s.sender||"-"}return"-"},ke=({transactions:t,walletId:n,hasNextPage:o,isFetching:s,isFetchingNextPage:i,onLoadMore:c})=>{const l=t.length>0;return console.log("transactions",t),s&&!l?e.jsx(xt,{component:J,variant:"outlined",sx:{borderRadius:1,overflow:"hidden"},children:e.jsxs(mt,{size:"medium",children:[e.jsx(ht,{children:e.jsxs(Y,{sx:{backgroundColor:"action.hover"},children:[e.jsx(d,{sx:{py:2,px:3,fontWeight:"medium"},children:"Type"}),e.jsx(d,{sx:{py:2,px:3,fontWeight:"medium"},children:"Date"}),e.jsx(d,{sx:{py:2,px:3,fontWeight:"medium"},children:"Asset"}),e.jsx(d,{sx:{py:2,px:3,fontWeight:"medium"},children:"Amount"}),e.jsx(d,{sx:{py:2,px:3,fontWeight:"medium"},children:"Counterparty"})]})}),e.jsx(gt,{children:[1,2,3].map(a=>e.jsxs(Y,{children:[e.jsx(d,{sx:{py:2.5,px:3},children:e.jsx(G,{variant:"text",width:80})}),e.jsx(d,{sx:{py:2.5,px:3},children:e.jsx(G,{variant:"text",width:120})}),e.jsx(d,{sx:{py:2.5,px:3},children:e.jsx(G,{variant:"text",width:60})}),e.jsx(d,{sx:{py:2.5,px:3},children:e.jsx(G,{variant:"text",width:80})}),e.jsx(d,{sx:{py:2.5,px:3},children:e.jsx(G,{variant:"text",width:150})})]},a))})]})}):e.jsxs(u,{children:[e.jsx(xt,{component:J,variant:"outlined",sx:{borderRadius:1,overflow:"hidden"},children:e.jsxs(mt,{size:"medium",children:[e.jsx(ht,{children:e.jsxs(Y,{sx:{backgroundColor:"action.hover"},children:[e.jsx(d,{sx:{py:2,px:3,fontWeight:"medium"},children:"Type"}),e.jsx(d,{sx:{py:2,px:3,fontWeight:"medium"},children:"Date"}),e.jsx(d,{sx:{py:2,px:3,fontWeight:"medium"},children:"Asset"}),e.jsx(d,{sx:{py:2,px:3,fontWeight:"medium"},children:"Amount"}),e.jsx(d,{sx:{py:2,px:3,fontWeight:"medium"},children:"Counterparty"})]})}),e.jsx(gt,{children:l?t.map(a=>{const g=Te(a),C=Ie(a),{amount:x,isOutgoing:j}=Re(a,n),f=Pe(a,n),A=j?"-":"+",p=j?"error.main":"success.main";return e.jsxs(Y,{sx:{"&:hover":{backgroundColor:"action.hover"},"&:last-child td":{border:0}},children:[e.jsx(d,{component:"th",scope:"row",sx:{py:2.5,px:3},children:g}),e.jsx(d,{sx:{py:2.5,px:3},children:Ae(a.recordTime)}),e.jsx(d,{sx:{py:2.5,px:3},children:e.jsx(u,{component:"span",sx:{px:1.5,py:.5,backgroundColor:"action.selected",color:"text.primary",borderRadius:1,fontSize:"0.875rem",display:"inline-block"},children:C})}),e.jsx(d,{sx:{py:2.5,px:3,color:p,fontWeight:"medium"},children:x==="-"?"-":`${A}${x}`}),e.jsx(d,{sx:{py:2.5,px:3},children:f==="-"?"-":e.jsx(dt,{value:f})})]},a.updateId)}):e.jsx(Y,{children:e.jsx(d,{colSpan:5,sx:{py:4,px:3},children:e.jsx(u,{sx:{textAlign:"center"},children:e.jsx(b,{variant:"body1",color:"text.secondary",children:"There are currently no transactions in this wallet"})})})})})]})}),o&&e.jsx(u,{sx:{mt:2,textAlign:"center"},children:e.jsx(ft,{variant:"outlined",onClick:c,disabled:i,size:"small",children:i?"Loading...":"Load more"})})]})};function De(){const{walletId:t}=qt.useParams(),s=Kt().find(p=>p.partyId===t)?.hint??"Unknown Wallet",{instruments:i,holdings:c,isLoading:l,isError:a}=je(t),{status:g,fetchNextPage:C,isFetchingNextPage:x,hasNextPage:j}=Xt(t),f=Yt(t),A=p=>c.filter(P=>P.instrumentId.admin===p.admin&&P.instrumentId.id===p.id);return e.jsxs(u,{sx:{my:4},children:[e.jsx(ft,{component:Qt,to:"/",startIcon:e.jsx(be,{}),sx:{mb:2},children:"Back to Dashboard"}),e.jsxs(u,{sx:{mb:4},children:[e.jsx(b,{variant:"h4",component:"h1",fontWeight:"bold",children:s}),e.jsx(u,{sx:{mt:1},children:e.jsx(dt,{value:t,maxLength:16})})]}),e.jsx(b,{variant:"h6",sx:{mb:2,textTransform:"uppercase"},fontWeight:"bold",children:"Holdings"}),e.jsx(J,{variant:"outlined",children:l?e.jsxs(u,{sx:{p:2},children:[e.jsx(G,{variant:"rectangular",height:60}),e.jsx(G,{variant:"rectangular",height:60,sx:{mt:1}})]}):a?e.jsx(u,{sx:{p:4,textAlign:"center"},children:e.jsx(b,{color:"error",children:"Failed to load holdings"})}):i.length===0?e.jsx(u,{sx:{p:4,textAlign:"center"},children:e.jsx(b,{color:"textSecondary",children:"No holdings in this wallet"})}):i.map(p=>e.jsx(Ce,{aggregatedHolding:p,holdings:A(p.instrumentId)},`${p.instrumentId.admin}::${p.instrumentId.id}`))}),e.jsx(b,{variant:"h6",sx:{mb:2,mt:4,textTransform:"uppercase"},fontWeight:"bold",children:"Transaction History"}),e.jsx(ke,{transactions:f,walletId:t,hasNextPage:j,isFetching:g==="pending",isFetchingNextPage:x,onLoadMore:C})]})}export{De as component};
package/dist/index.html CHANGED
@@ -4,7 +4,7 @@
4
4
  <meta charset="UTF-8" />
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
6
  <title>dApp Portfolio</title>
7
- <script type="module" crossorigin src="/assets/index-CYRjFua4.js"></script>
7
+ <script type="module" crossorigin src="/assets/index--XTC7grR.js"></script>
8
8
  <link rel="stylesheet" crossorigin href="/assets/index-Cs7nV1m0.css">
9
9
  </head>
10
10
  <body>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@canton-network/example-portfolio",
3
- "version": "0.18.0",
3
+ "version": "0.18.2",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "dev": "vite",
@@ -10,11 +10,11 @@
10
10
  "otc-trade": "tsx ./scripts/otc-trade.ts"
11
11
  },
12
12
  "dependencies": {
13
- "@canton-network/core-ledger-client": "^0.27.0",
14
- "@canton-network/core-splice-client": "^0.21.0",
15
- "@canton-network/core-token-standard": "^0.19.0",
16
- "@canton-network/core-types": "^0.18.0",
17
- "@canton-network/dapp-sdk": "^0.21.0",
13
+ "@canton-network/core-ledger-client": "^0.27.1",
14
+ "@canton-network/core-splice-client": "^0.21.1",
15
+ "@canton-network/core-token-standard": "^0.19.1",
16
+ "@canton-network/core-types": "^0.18.1",
17
+ "@canton-network/dapp-sdk": "^0.21.2",
18
18
  "@emotion/react": "^11.14.0",
19
19
  "@emotion/styled": "^11.14.1",
20
20
  "@mui/icons-material": "^7.3.7",
@@ -40,7 +40,7 @@
40
40
  "zod": "^4.3.5"
41
41
  },
42
42
  "devDependencies": {
43
- "@canton-network/core-wallet-test-utils": "^0.3.0",
43
+ "@canton-network/core-wallet-test-utils": "^0.3.1",
44
44
  "@canton-network/wallet-sdk": "^0.20.0",
45
45
  "@eslint/js": "^9.39.2",
46
46
  "@playwright/test": "^1.57.0",
@@ -1 +0,0 @@
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 +0,0 @@
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};
@@ -1 +0,0 @@
1
- import{Q as H,q as v,v as E,w as D,x as M,y as V,j as e,z as F,r as x,A as w,C as m,E as p,h as y,F as C,f as O,G as b,H as U,J as I,K as q}from"./index-CYRjFua4.js";import{u as Q,a as B,b as L,c as W,d as $}from"./useWithdrawAllocation-B9p5ztjm.js";var K=class extends H{constructor(t,s){super(t,s)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(t){super.setOptions({...t,behavior:v()})}getOptimisticResult(t){return t.behavior=v(),super.getOptimisticResult(t)}fetchNextPage(t){return this.fetch({...t,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(t){return this.fetch({...t,meta:{fetchMore:{direction:"backward"}}})}createResult(t,s){const{state:r}=t,a=super.createResult(t,s),{isFetching:i,isRefetching:l,isError:o,isRefetchError:n}=a,c=r.fetchMeta?.fetchMore?.direction,u=o&&c==="forward",d=i&&c==="forward",g=o&&c==="backward",j=i&&c==="backward";return{...a,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:D(s,r.data),hasPreviousPage:E(s,r.data),isFetchNextPageError:u,isFetchingNextPage:d,isFetchPreviousPageError:g,isFetchingPreviousPage:j,isRefetchError:n&&!u&&!g,isRefetching:l&&!d&&!j}}};function G(t,s){return M(t,K)}const f=({name:t,amount:s,instrument:r})=>{const a=V(r),i=`${r.id} from admin ${r.admin}`;return e.jsxs("span",{children:[t&&e.jsx("span",{children:t}),e.jsx("strong",{children:s}),a?e.jsxs("span",{title:i,children:[" ",a.instrument.symbol]}):e.jsxs("span",{title:i,children:[" ",r.id," (warning: unknown instrument)"]})]})},T=({value:t,onChange:s})=>{const r=F(),a=new Map;let i="";for(const[c,u]of r)for(const d of u){if(a.has(d.symbol))throw new Error(`duplicate symbol: ${d.symbol}`);a.set(d.symbol,{admin:c,id:d.id}),d.id===t?.id&&c===t?.admin&&(i=d.symbol)}const l=[...a.keys()].sort(),[o,n]=x.useState(i);return e.jsxs("select",{className:"select-instrument",value:o,onChange:c=>{n(c.target.value),s(a.get(c.target.value))},children:[e.jsx("option",{value:"",children:"Select an option..."},""),l.map(c=>e.jsx("option",{value:c,children:c},c))]})},J=()=>{const t=w().status?.session?.accessToken,s=m()?.partyId,{listHoldings:r,tap:a}=p(),i=y(),[l,o]=x.useState(void 0),[n,c]=x.useState(void 0),[u,d]=x.useState(1e4),g=new Date,j=x.useCallback(async()=>{if(s){const h=await r({party:s});o(h)}else o(void 0)},[s,r]);return x.useEffect(()=>{let h=!1;return(async()=>{if(s){const N=await r({party:s});h||o(N)}else o(void 0)})(),()=>{h=!0}},[s,r]),e.jsxs("div",{children:[e.jsxs("form",{onSubmit:h=>h.preventDefault(),className:"tap",children:[e.jsx(T,{value:n,onChange:h=>c(h)}),e.jsx("input",{type:"number",value:u,onChange:h=>d(Number(h.target.value))}),e.jsx("button",{type:"submit",disabled:!t||!s||!n,onClick:()=>{a({registryUrls:i,party:s,sessionToken:t,instrumentId:n,amount:u}).then(()=>j())},children:"TAP"})]}),e.jsx("ul",{children:l?.map(h=>e.jsxs("li",{children:[C.isHoldingLocked(h,g)&&e.jsx("span",{children:"🔒"}),e.jsx(f,{amount:h.amount,instrument:h.instrumentId})]},h.contractId))})]})},X=()=>{const t=O(),s=y(),[r,a]=x.useState(""),[i,l]=x.useState(""),o=[...s.keys()];return o.sort(),e.jsxs("div",{children:[e.jsx("h2",{children:"Registries"}),e.jsxs("table",{children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Party ID"}),e.jsx("th",{children:"Registry URL"})]})}),e.jsx("tbody",{children:o.map(n=>e.jsxs("tr",{children:[e.jsx("td",{children:n}),e.jsx("td",{children:s.get(n)}),e.jsx("td",{children:e.jsx("button",{type:"submit",onClick:()=>t.deleteRegistryUrl(n),children:"🗑️"})})]},n))})]}),e.jsx("h2",{children:"Add new registry"}),e.jsxs("form",{onSubmit:n=>n.preventDefault(),children:[e.jsx("p",{children:"The party ID is optional and will be retrieved from the URL if not specified. Note that in this case you need to trust the URL to provide the right information."}),e.jsx("label",{htmlFor:"partyId",children:"Party ID: "}),e.jsx("input",{id:"partyId",value:r,onChange:n=>a(n.target.value)}),e.jsx("br",{}),e.jsx("label",{htmlFor:"url",children:"Registry URL: "}),e.jsx("input",{id:"url",value:i,onChange:n=>l(n.target.value)}),e.jsx("br",{}),e.jsx("button",{type:"submit",onClick:async()=>t.setRegistryUrl(r&&void 0,i),children:"Add registry"})]})]})},z=()=>{const t=m()?.partyId;return b(Q(t))},A=({party:t,contractId:s,transferInstructionView:r})=>{const a=y(),{exerciseTransfer:i}=p(),l=r.transfer,o=r.status,{meta:n}=l,c=n.values[C.MEMO_KEY],u="tag"in o?o.tag:o.current?.tag;return e.jsxs("div",{children:["status: ",e.jsx("strong",{children:u})," ",e.jsx("br",{}),"sender: ",e.jsx("strong",{children:l.sender})," ",e.jsx("br",{}),"receiver: ",e.jsx("strong",{children:l.receiver})," ",e.jsx("br",{}),c&&e.jsxs("span",{children:["message: ",e.jsx("strong",{children:c})," ",e.jsx("br",{})]}),e.jsx(f,{amount:l.amount,instrument:l.instrumentId}),u==="TransferPendingReceiverAcceptance"&&l.receiver===t&&e.jsxs("div",{children:[e.jsx("button",{disabled:!s,onClick:()=>{i({registryUrls:a,party:t,contractId:s,instrumentId:l.instrumentId,instructionChoice:"Accept"})},children:"Accept"}),e.jsx("button",{disabled:!s,onClick:()=>{i({registryUrls:a,party:t,contractId:s,instrumentId:l.instrumentId,instructionChoice:"Reject"})},children:"Reject"})]}),l.status=="pending"&&!l.incoming&&e.jsx("button",{onClick:()=>{i({registryUrls:a,party:t,contractId:l.contractId,instrumentId:l.instrumentId,instructionChoice:"Withdraw"})},children:"Withdraw"})]})},Y=()=>{const t=m()?.partyId,{data:s}=z();return e.jsxs("div",{children:[e.jsx("h2",{children:"Pending transfers"}),t&&e.jsx("ul",{children:s?.map(r=>e.jsx("li",{children:e.jsx(A,{party:t,contractId:r.contractId,transferInstructionView:r.interfaceViewValue})},r.contractId))})]})},_=()=>{const t=m()?.partyId,{mutate:s}=U(),[r,a]=x.useState(""),[i,l]=x.useState(100),[o,n]=x.useState(""),[c,u]=x.useState(void 0);return e.jsxs("form",{onSubmit:d=>d.preventDefault(),children:[e.jsx("label",{htmlFor:"instrument",children:"Instrument "}),e.jsx(T,{value:c,onChange:d=>u(d)}),e.jsx("br",{}),e.jsx("label",{htmlFor:"receiver",children:"Receiver: "}),e.jsx("input",{id:"receiver",value:r,onChange:d=>a(d.target.value)}),e.jsx("br",{}),e.jsx("label",{htmlFor:"amount",children:"Amount to transfer: "}),e.jsx("input",{id:"amount",type:"number",value:i,onChange:d=>l(Number(d.target.value))}),e.jsx("br",{}),e.jsx("label",{htmlFor:"memo",children:"Message for receiver: "}),e.jsx("input",{id:"memo",value:o,onChange:d=>n(d.target.value)}),e.jsx("br",{}),e.jsx("button",{type:"submit",disabled:!t||!c,onClick:()=>{s({instrumentId:c,sender:t,receiver:r,amount:`${i}`,expiry:new Date(Date.now()+1440*60*1e3),memo:o||void 0})},children:"Transfer"})]})},S=()=>{const t=m()?.partyId,{getTransactionHistory:s}=p();return G({initialPageParam:null,queryKey:q.getTransactionHistory.forParty(t),queryFn:({pageParam:r})=>t?s({party:t,request:r}):I,getNextPageParam:r=>{if(r!==I&&!r.beginIsLedgerStart)return{endInclusive:r.beginExclusive}},staleTime:1/0})},Z=()=>{const{data:t}=S();return x.useMemo(()=>{const s=new Set,r=[];for(const a of t?.pages??[])for(const i of a?.transactions??[])s.has(i.offset)||(s.add(i.offset),i.events.length>0&&r.push(i));return r},[t])},P=({change:t})=>e.jsxs("span",{children:["In:",e.jsx(f,{instrument:t.instrumentId,amount:t.inputAmount}),", Out:",e.jsx(f,{instrument:t.instrumentId,amount:t.outputAmount}),", Change:",e.jsx(f,{instrument:t.instrumentId,amount:t.amountChange})]}),ee=()=>{const t=m()?.partyId,{status:s,fetchNextPage:r,isFetchingNextPage:a,hasNextPage:i}=S(),l=Z();return e.jsxs("div",{children:[e.jsx("h2",{children:"Transaction History"}),t&&l.map(o=>e.jsxs("div",{children:[e.jsxs("code",{children:["At ",o.offset," (",o.recordTime,")"]}),e.jsx("br",{}),o.events.map((n,c)=>e.jsx("div",{children:n.transferInstruction?e.jsx(A,{party:t,transferInstructionView:n.transferInstruction}):e.jsxs("div",{children:[e.jsx("strong",{children:n.label.type}),n.lockedHoldingsChangeSummaries.length>0&&e.jsxs("div",{children:[e.jsx("strong",{children:"Locked:"}),n.lockedHoldingsChangeSummaries.map((u,d)=>e.jsx(P,{change:u},d))]}),n.unlockedHoldingsChangeSummaries.length>0&&e.jsxs("div",{children:[e.jsx("strong",{children:"Locked:"}),n.unlockedHoldingsChangeSummaries.map((u,d)=>e.jsx(P,{change:u},d))]})]})},c))]},o.updateId)),!i&&e.jsx("span",{children:"(end)"}),s==="pending"&&e.jsx("span",{children:"⏳"}),!a&&i&&t&&e.jsx("button",{disabled:a||!i||!t,onClick:()=>r(),children:"load more"})]})},te=()=>{const{error:t,status:s,connect:r,open:a,disconnect:i}=w(),l=s?.isConnected,o=m()?.partyId;return e.jsxs("div",{className:"card",children:[!l&&e.jsx("button",{onClick:()=>r(),children:"connect to Wallet Gateway"}),l&&e.jsx("button",{onClick:()=>i(),children:"disconnect"}),e.jsx("button",{onClick:()=>a(),children:"open Wallet Gateway"}),t&&e.jsxs("p",{className:"error",children:[e.jsx("b",{children:"Error:"})," ",e.jsx("i",{children:t})]}),e.jsx("br",{}),l&&e.jsxs("div",{children:["Party: ",o,e.jsx("br",{}),"SessionToken: ",s?.session?.accessToken?"ok":"nope"]})]})},se=()=>{const t=m()?.partyId;return b(B(t))},k=()=>{const t=m()?.partyId;return b(L(t))},R=({transferLegId:t,transferLeg:s})=>e.jsxs("div",{children:[e.jsxs("h3",{children:["Transfer leg ",t]}),e.jsx("strong",{children:"sender:"})," ",s.sender,e.jsx("br",{}),e.jsx("strong",{children:"receiver:"})," ",s.receiver,e.jsx("br",{}),e.jsx(f,{amount:s.amount,instrument:s.instrumentId})]}),ne=({party:t,contractId:s,allocation:r})=>{const{settlement:a,transferLeg:i,transferLegId:l}=r.allocation,o=y(),{withdrawAllocation:n}=p(),{refetch:c}=k();return e.jsxs("div",{children:[e.jsx("h3",{children:"Settlement"}),e.jsx("strong",{children:"executor:"})," ",a.executor,e.jsx("br",{}),e.jsx("strong",{children:"allocateBefore:"})," ",a.allocateBefore,new Date(a.allocateBefore)<=new Date&&"(EXPIRED!)",e.jsx("br",{}),e.jsx(R,{transferLegId:l,transferLeg:i}),i.sender===t&&e.jsx("button",{onClick:async()=>{await n({registryUrls:o,party:t,instrumentId:i.instrumentId,contractId:s}),c()},children:"Withdraw"})]})},re=({settlementInfo:t})=>e.jsxs("div",{children:[e.jsx("h3",{children:"Settlement"}),e.jsx("strong",{children:"executor:"})," ",t.executor,e.jsx("br",{}),e.jsx("strong",{children:"allocateBefore:"})," ",t.allocateBefore,new Date(t.allocateBefore)<=new Date&&"(EXPIRED!)",e.jsx("br",{})]}),ie=({party:t,allocationRequest:s,allocationsByTransferLegId:r})=>{const{settlement:a,transferLegs:i}=s,{mutate:l}=W(),{mutate:o}=$();return e.jsxs("div",{children:[e.jsx(re,{settlementInfo:a}),e.jsx("h3",{children:"Transfer Legs"}),Object.entries(i).map(([n,c])=>e.jsxs("div",{children:[e.jsx(R,{transferLegId:n,transferLeg:c}),c.sender===t&&e.jsx("button",{onClick:()=>l({party:t,allocationSpecification:{settlement:a,transferLegId:n,transferLeg:c}}),children:"Create Allocation"}),r?.get(n)?.map(u=>e.jsxs("div",{children:[e.jsx("span",{children:"Allocation Made"}),c.sender===t&&e.jsx("button",{onClick:()=>o({party:t,instrumentId:c.instrumentId,contractId:u.contractId}),children:"Withdraw Allocation"})]},u.contractId))]},n))]})},oe=()=>{const t=p(),s=m()?.partyId,{data:r}=se(),{data:a}=k(),i=x.useCallback((n,c)=>JSON.stringify([n.settlementRef.id,n.settlementRef.cid,c]),[]),[l,o]=x.useMemo(()=>{const n=new Map,c=[];for(const u of r??[]){const{settlement:d,transferLegs:g}=u.interfaceViewValue;for(const j in g){const h=i(d,j);n.set(h,[])}}for(const u of a??[]){const{settlement:d,transferLegId:g}=u.interfaceViewValue.allocation,j=i(d,g);n.has(j)?n.get(j).push(u):(console.log(n),c.push(u))}return[n,c]},[r,a,i]);return x.useEffect(()=>{s&&(async()=>{const n=await t.listAllocationInstructions({party:s});console.log("allocationInstructions",n)})()},[t,s]),e.jsxs("div",{children:[e.jsx("h2",{children:"Allocation requests"}),s&&r?.map(n=>e.jsx("div",{children:e.jsx(ie,{party:s,allocationRequest:n.interfaceViewValue,allocationsByTransferLegId:new Map(Object.keys(n.interfaceViewValue.transferLegs).map(c=>[c,l.get(i(n.interfaceViewValue.settlement,c))??[]]))})},n.contractId)),e.jsx("h2",{children:"Unknown Allocations"}),s&&o?.map(n=>e.jsx("div",{children:e.jsx(ne,{party:s,contractId:n.contractId,allocation:n.interfaceViewValue})},n.contractId))]})},ae=({tabs:t,initialValue:s})=>{const r=s??t[0]?.value,[a,i]=x.useState(r),l=t.find(o=>o.value===a);return e.jsxs("div",{children:[e.jsx("div",{role:"tablist",className:"flex gap-2 border-b",children:t.map(o=>e.jsx("button",{role:"tab","aria-selected":a===o.value,className:`${a===o.value?"bg-blue-500":"opacity-60"}`,onClick:()=>i(o.value),children:a===o.value?`[${o.label}]`:o.label},o.value))}),e.jsx("div",{role:"tabpanel",children:l?.content})]})};function ue(){return e.jsxs(e.Fragment,{children:[e.jsx("h1",{children:"dApp Portfolio"}),e.jsx(te,{}),e.jsx(ae,{tabs:[{label:"Holdings",value:"holdings",content:e.jsx(J,{})},{label:"Transfer",value:"twoStepTransfer",content:e.jsx(_,{})},{label:"Pending Transfers",value:"pendingTransfers",content:e.jsx(Y,{})},{label:"Transaction History",value:"transactionHistory",content:e.jsx(ee,{})},{label:"Allocations",value:"allocations",content:e.jsx(oe,{})},{label:"Registry Settings",value:"registries",content:e.jsx(X,{})}]})]})}export{ue as component};
@@ -1,2 +0,0 @@
1
- import{g as y,a as x,r as d,u as b,j as s,c as h,b as m,s as v,P as E,m as $,d as f,e as J,f as X,h as G,i as K,t as P,T as U,B as j,k as A,l as Q,D as Y,I as Z,o as _,n as tt,p as et}from"./index-CYRjFua4.js";import{C as ot}from"./copyable-identifier-ItJqhPOL.js";function st(t){return y("MuiCard",t)}x("MuiCard",["root"]);const at=t=>{const{classes:o}=t;return m({root:["root"]},st,o)},rt=v(E,{name:"MuiCard",slot:"Root"})({overflow:"hidden"}),nt=d.forwardRef(function(o,a){const r=b({props:o,name:"MuiCard"}),{className:i,raised:e=!1,...n}=r,l={...r,raised:e},c=at(l);return s.jsx(rt,{className:h(c.root,i),elevation:e?8:void 0,ref:a,ownerState:l,...n})});function lt(t){return y("MuiCardContent",t)}x("MuiCardContent",["root"]);const it=t=>{const{classes:o}=t;return m({root:["root"]},lt,o)},ct=v("div",{name:"MuiCardContent",slot:"Root"})({padding:16,"&:last-child":{paddingBottom:24}}),dt=d.forwardRef(function(o,a){const r=b({props:o,name:"MuiCardContent"}),{className:i,component:e="div",...n}=r,l={...r,component:e},c=it(l);return s.jsx(ct,{as:e,className:h(c.root,i),ownerState:l,ref:a,...n})}),V=d.createContext();function pt(t){return y("MuiTable",t)}x("MuiTable",["root","stickyHeader"]);const ut=t=>{const{classes:o,stickyHeader:a}=t;return m({root:["root",a&&"stickyHeader"]},pt,o)},gt=v("table",{name:"MuiTable",slot:"Root",overridesResolver:(t,o)=>{const{ownerState:a}=t;return[o.root,a.stickyHeader&&o.stickyHeader]}})($(({theme:t})=>({display:"table",width:"100%",borderCollapse:"collapse",borderSpacing:0,"& caption":{...t.typography.body2,padding:t.spacing(2),color:(t.vars||t).palette.text.secondary,textAlign:"left",captionSide:"bottom"},variants:[{props:({ownerState:o})=>o.stickyHeader,style:{borderCollapse:"separate"}}]}))),D="table",yt=d.forwardRef(function(o,a){const r=b({props:o,name:"MuiTable"}),{className:i,component:e=D,padding:n="normal",size:l="medium",stickyHeader:c=!1,...u}=r,p={...r,component:e,padding:n,size:l,stickyHeader:c},T=ut(p),k=d.useMemo(()=>({padding:n,size:l,stickyHeader:c}),[n,l,c]);return s.jsx(V.Provider,{value:k,children:s.jsx(gt,{as:e,role:e===D?null:"table",ref:a,className:h(T.root,i),ownerState:p,...u})})}),S=d.createContext();function xt(t){return y("MuiTableBody",t)}x("MuiTableBody",["root"]);const bt=t=>{const{classes:o}=t;return m({root:["root"]},xt,o)},ht=v("tbody",{name:"MuiTableBody",slot:"Root"})({display:"table-row-group"}),mt={variant:"body"},L="tbody",vt=d.forwardRef(function(o,a){const r=b({props:o,name:"MuiTableBody"}),{className:i,component:e=L,...n}=r,l={...r,component:e},c=bt(l);return s.jsx(S.Provider,{value:mt,children:s.jsx(ht,{className:h(c.root,i),as:e,ref:a,role:e===L?null:"rowgroup",ownerState:l,...n})})});function Ct(t){return y("MuiTableCell",t)}const ft=x("MuiTableCell",["root","head","body","footer","sizeSmall","sizeMedium","paddingCheckbox","paddingNone","alignLeft","alignCenter","alignRight","alignJustify","stickyHeader"]),Tt=t=>{const{classes:o,variant:a,align:r,padding:i,size:e,stickyHeader:n}=t,l={root:["root",a,n&&"stickyHeader",r!=="inherit"&&`align${f(r)}`,i!=="normal"&&`padding${f(i)}`,`size${f(e)}`]};return m(l,Ct,o)},Rt=v("td",{name:"MuiTableCell",slot:"Root",overridesResolver:(t,o)=>{const{ownerState:a}=t;return[o.root,o[a.variant],o[`size${f(a.size)}`],a.padding!=="normal"&&o[`padding${f(a.padding)}`],a.align!=="inherit"&&o[`align${f(a.align)}`],a.stickyHeader&&o.stickyHeader]}})($(({theme:t})=>({...t.typography.body2,display:"table-cell",verticalAlign:"inherit",borderBottom:t.vars?`1px solid ${t.vars.palette.TableCell.border}`:`1px solid
2
- ${t.palette.mode==="light"?t.lighten(t.alpha(t.palette.divider,1),.88):t.darken(t.alpha(t.palette.divider,1),.68)}`,textAlign:"left",padding:16,variants:[{props:{variant:"head"},style:{color:(t.vars||t).palette.text.primary,lineHeight:t.typography.pxToRem(24),fontWeight:t.typography.fontWeightMedium}},{props:{variant:"body"},style:{color:(t.vars||t).palette.text.primary}},{props:{variant:"footer"},style:{color:(t.vars||t).palette.text.secondary,lineHeight:t.typography.pxToRem(21),fontSize:t.typography.pxToRem(12)}},{props:{size:"small"},style:{padding:"6px 16px",[`&.${ft.paddingCheckbox}`]:{width:24,padding:"0 12px 0 16px","& > *":{padding:0}}}},{props:{padding:"checkbox"},style:{width:48,padding:"0 0 0 4px"}},{props:{padding:"none"},style:{padding:0}},{props:{align:"left"},style:{textAlign:"left"}},{props:{align:"center"},style:{textAlign:"center"}},{props:{align:"right"},style:{textAlign:"right",flexDirection:"row-reverse"}},{props:{align:"justify"},style:{textAlign:"justify"}},{props:({ownerState:o})=>o.stickyHeader,style:{position:"sticky",top:0,zIndex:2,backgroundColor:(t.vars||t).palette.background.default}}]}))),C=d.forwardRef(function(o,a){const r=b({props:o,name:"MuiTableCell"}),{align:i="inherit",className:e,component:n,padding:l,scope:c,size:u,sortDirection:p,variant:T,...k}=r,g=d.useContext(V),w=d.useContext(S),z=w&&w.variant==="head";let R;n?R=n:R=z?"th":"td";let M=c;R==="td"?M=void 0:!M&&z&&(M="col");const B=T||w&&w.variant,I={...r,align:i,component:R,padding:l||(g&&g.padding?g.padding:"normal"),size:u||(g&&g.size?g.size:"medium"),sortDirection:p,stickyHeader:B==="head"&&g&&g.stickyHeader,variant:B},q=Tt(I);let N=null;return p&&(N=p==="asc"?"ascending":"descending"),s.jsx(Rt,{as:R,ref:a,className:h(q.root,e),"aria-sort":N,scope:M,ownerState:I,...k})});function jt(t){return y("MuiTableContainer",t)}x("MuiTableContainer",["root"]);const wt=t=>{const{classes:o}=t;return m({root:["root"]},jt,o)},Mt=v("div",{name:"MuiTableContainer",slot:"Root"})({width:"100%",overflowX:"auto"}),Ut=d.forwardRef(function(o,a){const r=b({props:o,name:"MuiTableContainer"}),{className:i,component:e="div",...n}=r,l={...r,component:e},c=wt(l);return s.jsx(Mt,{ref:a,as:e,className:h(c.root,i),ownerState:l,...n})});function St(t){return y("MuiTableHead",t)}x("MuiTableHead",["root"]);const kt=t=>{const{classes:o}=t;return m({root:["root"]},St,o)},Ht=v("thead",{name:"MuiTableHead",slot:"Root"})({display:"table-header-group"}),$t={variant:"head"},W="thead",zt=d.forwardRef(function(o,a){const r=b({props:o,name:"MuiTableHead"}),{className:i,component:e=W,...n}=r,l={...r,component:e},c=kt(l);return s.jsx(S.Provider,{value:$t,children:s.jsx(Ht,{as:e,className:h(c.root,i),ref:a,role:e===W?null:"rowgroup",ownerState:l,...n})})});function Bt(t){return y("MuiTableRow",t)}const F=x("MuiTableRow",["root","selected","hover","head","footer"]),It=t=>{const{classes:o,selected:a,hover:r,head:i,footer:e}=t;return m({root:["root",a&&"selected",r&&"hover",i&&"head",e&&"footer"]},Bt,o)},Nt=v("tr",{name:"MuiTableRow",slot:"Root",overridesResolver:(t,o)=>{const{ownerState:a}=t;return[o.root,a.head&&o.head,a.footer&&o.footer]}})($(({theme:t})=>({color:"inherit",display:"table-row",verticalAlign:"middle",outline:0,[`&.${F.hover}:hover`]:{backgroundColor:(t.vars||t).palette.action.hover},[`&.${F.selected}`]:{backgroundColor:t.alpha((t.vars||t).palette.primary.main,(t.vars||t).palette.action.selectedOpacity),"&:hover":{backgroundColor:t.alpha((t.vars||t).palette.primary.main,`${(t.vars||t).palette.action.selectedOpacity} + ${(t.vars||t).palette.action.hoverOpacity}`)}}}))),O="tr",H=d.forwardRef(function(o,a){const r=b({props:o,name:"MuiTableRow"}),{className:i,component:e=O,hover:n=!1,selected:l=!1,...c}=r,u=d.useContext(S),p={...r,component:e,hover:n,selected:l,head:u&&u.variant==="head",footer:u&&u.variant==="footer"},T=It(p);return s.jsx(Nt,{as:e,ref:a,className:h(T.root,i),role:e===O?null:"row",ownerState:p,...c})}),Pt=J(s.jsx("path",{d:"M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6zM19 4h-3.5l-1-1h-5l-1 1H5v2h14z"})),At=_({partyId:et().min(1,"Party ID is required"),registryUrl:tt("Must be a valid URL")});function Dt(){const t=X(),o=G(),a=Array.from(o.entries()).map(([e,n])=>({partyId:e,registryUrl:n})),r=K({defaultValues:{partyId:"",registryUrl:""},onSubmit:async({value:e})=>{const n=e.partyId.trim()===""?void 0:e.partyId;t.setRegistryUrl(n,e.registryUrl),P.success("Registry URL set"),r.reset()},validators:{onChange:At}}),i=e=>{t.deleteRegistryUrl(e),P.success("Registry URL deleted")};return s.jsx(nt,{sx:{mb:3},children:s.jsxs(dt,{children:[s.jsx(U,{variant:"h6",component:"h2",gutterBottom:!0,children:"Registries"}),s.jsx(U,{variant:"body2",color:"text.secondary",sx:{mb:3},children:"The API URLs provided by the party managing the token standard compliant instruments"}),s.jsx(j,{sx:{mb:3},children:s.jsx("form",{onSubmit:e=>{e.preventDefault(),e.stopPropagation(),r.handleSubmit()},children:s.jsxs(j,{sx:{display:"flex",gap:2,mb:2},children:[s.jsx(r.Field,{name:"partyId",children:e=>s.jsx(A,{label:"Party ID",value:e.state.value,onChange:n=>e.handleChange(n.target.value),onBlur:e.handleBlur,error:e.state.meta.isTouched&&e.state.meta.errors.length>0,helperText:e.state.meta.isTouched&&e.state.meta.errors[0]?.message,fullWidth:!0,size:"small"})}),s.jsx(r.Field,{name:"registryUrl",children:e=>s.jsx(A,{label:"Registry URL",value:e.state.value,onChange:n=>e.handleChange(n.target.value),onBlur:e.handleBlur,error:e.state.meta.isTouched&&e.state.meta.errors.length>0,helperText:e.state.meta.isTouched&&e.state.meta.errors[0]?.message,fullWidth:!0,size:"small"})}),s.jsx(r.Subscribe,{selector:e=>({canSubmit:e.canSubmit,isSubmitting:e.isSubmitting}),children:({canSubmit:e,isSubmitting:n})=>s.jsx(Q,{type:"submit",variant:"contained",disabled:!e||n,children:n?"Submitting...":"Add"})})]})})}),s.jsx(Y,{sx:{mb:3}}),s.jsx(Ut,{component:E,variant:"outlined",sx:{borderRadius:1},children:s.jsxs(yt,{size:"medium",children:[s.jsx(zt,{children:s.jsxs(H,{sx:{backgroundColor:"action.hover"},children:[s.jsx(C,{sx:{py:2,px:3,fontWeight:"medium"},children:"Party ID"}),s.jsx(C,{sx:{py:2,px:3,fontWeight:"medium"},children:"Registry URL"}),s.jsx(C,{sx:{py:2,px:3,fontWeight:"medium"},children:"Actions"})]})}),s.jsx(vt,{children:a.length>0?a.map(e=>s.jsxs(H,{sx:{"&:hover":{backgroundColor:"action.hover"}},children:[s.jsx(C,{sx:{py:2.5,px:3},children:s.jsx(ot,{value:e.partyId,maxLength:30})}),s.jsx(C,{sx:{py:2.5,px:3},children:e.registryUrl}),s.jsx(C,{sx:{py:2.5,px:3},children:s.jsx(j,{sx:{display:"flex",gap:1},children:s.jsx(Z,{size:"small",onClick:()=>i(e.partyId),color:"error",children:s.jsx(Pt,{fontSize:"small"})})})})]},e.partyId)):s.jsx(H,{children:s.jsx(C,{colSpan:3,sx:{py:4,px:3},children:s.jsx(j,{sx:{textAlign:"center"},children:s.jsx(U,{variant:"body1",color:"text.secondary",children:"No registries configured"})})})})})]})})]})})}function Ft(){return s.jsxs(j,{sx:{mt:4},children:[s.jsx(U,{variant:"h4",component:"h1",gutterBottom:!0,children:"Settings"}),s.jsx(Dt,{})]})}export{Ft as component};
@@ -1 +0,0 @@
1
- import{g as J,a as X,r as p,u as Y,a0 as jt,a1 as At,a2 as Rt,a3 as It,a4 as Pt,M as v,c as O,j as o,b as Z,s as C,m as L,a5 as at,a6 as Tt,P as ct,a7 as Et,e as st,z as Mt,G as $t,a8 as kt,a9 as Wt,aa as zt,K as Dt,F as Nt,B as m,T as S,ab as Lt,$ as Ft,l as Ht,_ as Bt}from"./index-CYRjFua4.js";import{C as dt}from"./copyable-identifier-ItJqhPOL.js";import{A as Gt,S as lt}from"./Avatar-CeFJWY-s.js";function Ut(t){return J("MuiCollapse",t)}X("MuiCollapse",["root","horizontal","vertical","entered","hidden","wrapper","wrapperInner"]);const Vt=t=>{const{orientation:e,classes:n}=t,r={root:["root",`${e}`],entered:["entered"],hidden:["hidden"],wrapper:["wrapper",`${e}`],wrapperInner:["wrapperInner",`${e}`]};return Z(r,Ut,n)},qt=C("div",{name:"MuiCollapse",slot:"Root",overridesResolver:(t,e)=>{const{ownerState:n}=t;return[e.root,e[n.orientation],n.state==="entered"&&e.entered,n.state==="exited"&&!n.in&&n.collapsedSize==="0px"&&e.hidden]}})(L(({theme:t})=>({height:0,overflow:"hidden",transition:t.transitions.create("height"),variants:[{props:{orientation:"horizontal"},style:{height:"auto",width:0,transition:t.transitions.create("width")}},{props:{state:"entered"},style:{height:"auto",overflow:"visible"}},{props:{state:"entered",orientation:"horizontal"},style:{width:"auto"}},{props:({ownerState:e})=>e.state==="exited"&&!e.in&&e.collapsedSize==="0px",style:{visibility:"hidden"}}]}))),Ot=C("div",{name:"MuiCollapse",slot:"Wrapper"})({display:"flex",width:"100%",variants:[{props:{orientation:"horizontal"},style:{width:"auto",height:"100%"}}]}),Kt=C("div",{name:"MuiCollapse",slot:"WrapperInner"})({width:"100%",variants:[{props:{orientation:"horizontal"},style:{width:"auto",height:"100%"}}]}),nt=p.forwardRef(function(e,n){const r=Y({props:e,name:"MuiCollapse"}),{addEndListener:i,children:a,className:u,collapsedSize:c="0px",component:b,easing:l,in:h,onEnter:F,onEntered:$,onEntering:H,onExit:k,onExited:B,onExiting:x,orientation:w="vertical",slots:j={},slotProps:A={},style:W,timeout:g=jt.standard,TransitionComponent:R=At,...z}=r,I={...r,orientation:w,collapsedSize:c},P=Vt(I),d=Rt(),G=It(),T=p.useRef(null),K=p.useRef(),U=typeof c=="number"?`${c}px`:c,D=w==="horizontal",N=D?"width":"height",V=p.useRef(null),tt=Pt(n,V),M=s=>f=>{if(s){const y=V.current;f===void 0?s(y):s(y,f)}},ot=()=>T.current?T.current[D?"clientWidth":"clientHeight"]:0,ut=M((s,f)=>{T.current&&D&&(T.current.style.position="absolute"),s.style[N]=U,F&&F(s,f)}),xt=M((s,f)=>{const y=ot();T.current&&D&&(T.current.style.position="");const{duration:E,easing:Q}=at({style:W,timeout:g,easing:l},{mode:"enter"});if(g==="auto"){const it=d.transitions.getAutoHeightDuration(y);s.style.transitionDuration=`${it}ms`,K.current=it}else s.style.transitionDuration=typeof E=="string"?E:`${E}ms`;s.style[N]=`${y}px`,s.style.transitionTimingFunction=Q,H&&H(s,f)}),mt=M((s,f)=>{s.style[N]="auto",$&&$(s,f)}),ht=M(s=>{s.style[N]=`${ot()}px`,k&&k(s)}),gt=M(B),ft=M(s=>{const f=ot(),{duration:y,easing:E}=at({style:W,timeout:g,easing:l},{mode:"exit"});if(g==="auto"){const Q=d.transitions.getAutoHeightDuration(f);s.style.transitionDuration=`${Q}ms`,K.current=Q}else s.style.transitionDuration=typeof y=="string"?y:`${y}ms`;s.style[N]=U,s.style.transitionTimingFunction=E,x&&x(s)}),yt=s=>{g==="auto"&&G.start(K.current||0,s),i&&i(V.current,s)},et={slots:j,slotProps:A,component:b},[bt,rt]=v("root",{ref:tt,className:O(P.root,u),elementType:qt,externalForwardedProps:et,ownerState:I,additionalProps:{style:{[D?"minWidth":"minHeight"]:U,...W}}}),[wt,St]=v("wrapper",{ref:T,className:P.wrapper,elementType:Ot,externalForwardedProps:et,ownerState:I}),[vt,Ct]=v("wrapperInner",{className:P.wrapperInner,elementType:Kt,externalForwardedProps:et,ownerState:I});return o.jsx(R,{in:h,onEnter:ut,onEntered:mt,onEntering:xt,onExit:ht,onExited:gt,onExiting:ft,addEndListener:yt,nodeRef:V,timeout:g==="auto"?null:g,...z,children:(s,{ownerState:f,...y})=>{const E={...I,state:s};return o.jsx(bt,{...rt,className:O(rt.className,{entered:P.entered,exited:!h&&U==="0px"&&P.hidden}[s]),ownerState:E,...y,children:o.jsx(wt,{...St,ownerState:E,children:o.jsx(vt,{...Ct,ownerState:E,children:a})})})}})});nt&&(nt.muiSupportAuto=!0);const pt=p.createContext({});function Qt(t){return J("MuiAccordion",t)}const _=X("MuiAccordion",["root","heading","rounded","expanded","disabled","gutters","region"]),_t=t=>{const{classes:e,square:n,expanded:r,disabled:i,disableGutters:a}=t;return Z({root:["root",!n&&"rounded",r&&"expanded",i&&"disabled",!a&&"gutters"],heading:["heading"],region:["region"]},Qt,e)},Jt=C(ct,{name:"MuiAccordion",slot:"Root",overridesResolver:(t,e)=>{const{ownerState:n}=t;return[{[`& .${_.region}`]:e.region},e.root,!n.square&&e.rounded,!n.disableGutters&&e.gutters]}})(L(({theme:t})=>{const e={duration:t.transitions.duration.shortest};return{position:"relative",transition:t.transitions.create(["margin"],e),overflowAnchor:"none","&::before":{position:"absolute",left:0,top:-1,right:0,height:1,content:'""',opacity:1,backgroundColor:(t.vars||t).palette.divider,transition:t.transitions.create(["opacity","background-color"],e)},"&:first-of-type":{"&::before":{display:"none"}},[`&.${_.expanded}`]:{"&::before":{opacity:0},"&:first-of-type":{marginTop:0},"&:last-of-type":{marginBottom:0},"& + &":{"&::before":{display:"none"}}},[`&.${_.disabled}`]:{backgroundColor:(t.vars||t).palette.action.disabledBackground}}}),L(({theme:t})=>({variants:[{props:e=>!e.square,style:{borderRadius:0,"&:first-of-type":{borderTopLeftRadius:(t.vars||t).shape.borderRadius,borderTopRightRadius:(t.vars||t).shape.borderRadius},"&:last-of-type":{borderBottomLeftRadius:(t.vars||t).shape.borderRadius,borderBottomRightRadius:(t.vars||t).shape.borderRadius,"@supports (-ms-ime-align: auto)":{borderBottomLeftRadius:0,borderBottomRightRadius:0}}}},{props:e=>!e.disableGutters,style:{[`&.${_.expanded}`]:{margin:"16px 0"}}}]}))),Xt=C("h3",{name:"MuiAccordion",slot:"Heading"})({all:"unset"}),Yt=C("div",{name:"MuiAccordion",slot:"Region"})({}),Zt=p.forwardRef(function(e,n){const r=Y({props:e,name:"MuiAccordion"}),{children:i,className:a,defaultExpanded:u=!1,disabled:c=!1,disableGutters:b=!1,expanded:l,onChange:h,slots:F={},slotProps:$={},TransitionComponent:H,TransitionProps:k,...B}=r,[x,w]=Tt({controlled:l,default:u,name:"Accordion",state:"expanded"}),j=p.useCallback(M=>{w(!x),h&&h(M,!x)},[x,h,w]),[A,...W]=p.Children.toArray(i),g=p.useMemo(()=>({expanded:x,disabled:c,disableGutters:b,toggle:j}),[x,c,b,j]),R={...r,disabled:c,disableGutters:b,expanded:x},z=_t(R),I={transition:H,...F},P={transition:k,...$},d={slots:I,slotProps:P},[G,T]=v("root",{elementType:Jt,externalForwardedProps:{...d,...B},className:O(z.root,a),shouldForwardComponentProp:!0,ownerState:R,ref:n}),[K,U]=v("heading",{elementType:Xt,externalForwardedProps:d,className:z.heading,ownerState:R}),[D,N]=v("transition",{elementType:nt,externalForwardedProps:d,ownerState:R}),[V,tt]=v("region",{elementType:Yt,externalForwardedProps:d,ownerState:R,className:z.region,additionalProps:{"aria-labelledby":A.props.id,id:A.props["aria-controls"],role:"region"}});return o.jsxs(G,{...T,children:[o.jsx(K,{...U,children:o.jsx(pt.Provider,{value:g,children:A})}),o.jsx(D,{in:x,timeout:"auto",...N,children:o.jsx(V,{...tt,children:W})})]})});function to(t){return J("MuiAccordionDetails",t)}X("MuiAccordionDetails",["root"]);const oo=t=>{const{classes:e}=t;return Z({root:["root"]},to,e)},eo=C("div",{name:"MuiAccordionDetails",slot:"Root"})(L(({theme:t})=>({padding:t.spacing(1,2,2)}))),no=p.forwardRef(function(e,n){const r=Y({props:e,name:"MuiAccordionDetails"}),{className:i,...a}=r,u=r,c=oo(u);return o.jsx(eo,{className:O(c.root,i),ref:n,ownerState:u,...a})});function so(t){return J("MuiAccordionSummary",t)}const q=X("MuiAccordionSummary",["root","expanded","focusVisible","disabled","gutters","contentGutters","content","expandIconWrapper"]),ro=t=>{const{classes:e,expanded:n,disabled:r,disableGutters:i}=t;return Z({root:["root",n&&"expanded",r&&"disabled",!i&&"gutters"],focusVisible:["focusVisible"],content:["content",n&&"expanded",!i&&"contentGutters"],expandIconWrapper:["expandIconWrapper",n&&"expanded"]},so,e)},io=C(Et,{name:"MuiAccordionSummary",slot:"Root"})(L(({theme:t})=>{const e={duration:t.transitions.duration.shortest};return{display:"flex",width:"100%",minHeight:48,padding:t.spacing(0,2),transition:t.transitions.create(["min-height","background-color"],e),[`&.${q.focusVisible}`]:{backgroundColor:(t.vars||t).palette.action.focus},[`&.${q.disabled}`]:{opacity:(t.vars||t).palette.action.disabledOpacity},[`&:hover:not(.${q.disabled})`]:{cursor:"pointer"},variants:[{props:n=>!n.disableGutters,style:{[`&.${q.expanded}`]:{minHeight:64}}}]}})),ao=C("span",{name:"MuiAccordionSummary",slot:"Content"})(L(({theme:t})=>({display:"flex",textAlign:"start",flexGrow:1,margin:"12px 0",variants:[{props:e=>!e.disableGutters,style:{transition:t.transitions.create(["margin"],{duration:t.transitions.duration.shortest}),[`&.${q.expanded}`]:{margin:"20px 0"}}}]}))),lo=C("span",{name:"MuiAccordionSummary",slot:"ExpandIconWrapper"})(L(({theme:t})=>({display:"flex",color:(t.vars||t).palette.action.active,transform:"rotate(0deg)",transition:t.transitions.create("transform",{duration:t.transitions.duration.shortest}),[`&.${q.expanded}`]:{transform:"rotate(180deg)"}}))),co=p.forwardRef(function(e,n){const r=Y({props:e,name:"MuiAccordionSummary"}),{children:i,className:a,expandIcon:u,focusVisibleClassName:c,onClick:b,slots:l,slotProps:h,...F}=r,{disabled:$=!1,disableGutters:H,expanded:k,toggle:B}=p.useContext(pt),x=d=>{B&&B(d),b&&b(d)},w={...r,expanded:k,disabled:$,disableGutters:H},j=ro(w),A={slots:l,slotProps:h},[W,g]=v("root",{ref:n,shouldForwardComponentProp:!0,className:O(j.root,a),elementType:io,externalForwardedProps:{...A,...F},ownerState:w,additionalProps:{focusRipple:!1,disableRipple:!0,disabled:$,"aria-expanded":k,focusVisibleClassName:O(j.focusVisible,c)},getSlotProps:d=>({...d,onClick:G=>{d.onClick?.(G),x(G)}})}),[R,z]=v("content",{className:j.content,elementType:ao,externalForwardedProps:A,ownerState:w}),[I,P]=v("expandIconWrapper",{className:j.expandIconWrapper,elementType:lo,externalForwardedProps:A,ownerState:w});return o.jsxs(W,{...g,children:[o.jsx(R,{...z,children:i}),u&&o.jsx(I,{...P,children:u})]})}),po=st(o.jsx("path",{d:"M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20z"})),uo=t=>{const e=Mt(),n=$t({queryKey:Dt.listHoldings.forParty(t),queryFn:()=>zt({party:t}),enabled:!!t});return{instruments:p.useMemo(()=>n.data?kt(Wt(n.data),e):[],[n.data,e]),holdings:n.data??[],isLoading:n.isLoading,isError:n.isError,error:n.error,refetch:n.refetch}},xo=st(o.jsx("path",{d:"M16.59 8.59 12 13.17 7.41 8.59 6 10l6 6 6-6z"})),mo=st(o.jsx("path",{d:"M18 8h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2m-6 9c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2m3.1-9H8.9V6c0-1.71 1.39-3.1 3.1-3.1s3.1 1.39 3.1 3.1z"})),ho=({holding:t,symbol:e})=>{const n=Nt.isHoldingLocked(t,new Date);return o.jsxs(m,{sx:{py:1.5,px:2,display:"flex",alignItems:"center",justifyContent:"space-between","&:not(:last-child)":{borderBottom:r=>`1px solid ${r.palette.divider}`}},children:[o.jsxs(m,{sx:{display:"flex",alignItems:"center",gap:1},children:[o.jsxs(S,{variant:"body2",children:[t.amount," ",e]}),n&&o.jsx(mo,{fontSize:"small",color:"warning",sx:{fontSize:16}})]}),o.jsx(dt,{value:t.contractId,maxLength:12})]})},go=({aggregatedHolding:t,holdings:e})=>{const n=t.instrument?.symbol??t.instrumentId.id,r=t.instrument?.name??t.instrumentId.id,i=t.lockedAmount!=="0";return o.jsxs(Zt,{disableGutters:!0,sx:{"&:before":{display:"none"},boxShadow:"none","&:not(:last-child)":{borderBottom:a=>`1px solid ${a.palette.divider}`}},children:[o.jsx(co,{expandIcon:o.jsx(xo,{}),sx:{"&:hover":{backgroundColor:"action.hover"}},children:o.jsxs(m,{sx:{display:"flex",alignItems:"center",gap:2,width:"100%",pr:2},children:[o.jsx(Gt,{sx:{width:32,height:32,fontSize:14},children:n[0]}),o.jsxs(m,{sx:{flexGrow:1},children:[o.jsx(S,{variant:"body2",color:"textSecondary",sx:{maxWidth:"150px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:r}),o.jsxs(S,{variant:"body1",fontWeight:"bold",children:[t.totalAmount," ",n]})]}),i&&o.jsxs(m,{sx:{textAlign:"right"},children:[o.jsxs(S,{variant:"body2",color:"success.main",children:[t.availableAmount," available"]}),o.jsxs(S,{variant:"body2",color:"textSecondary",children:[t.lockedAmount," locked"]})]})]})}),o.jsxs(no,{sx:{p:0,pl:6},children:[o.jsxs(S,{variant:"caption",color:"textSecondary",sx:{px:2,pt:1,display:"block",textTransform:"uppercase",letterSpacing:.5},children:[t.numOfHoldings," holding",t.numOfHoldings!==1?"s":""]}),o.jsx(m,{children:e.map(a=>o.jsx(ho,{holding:a,symbol:n},a.contractId))})]})]})};function wo(){const{walletId:t}=Lt.useParams(),r=Ft().find(l=>l.partyId===t)?.hint??"Unknown Wallet",{instruments:i,holdings:a,isLoading:u,isError:c}=uo(t),b=l=>a.filter(h=>h.instrumentId.admin===l.admin&&h.instrumentId.id===l.id);return o.jsxs(m,{sx:{my:4},children:[o.jsx(Ht,{component:Bt,to:"/",startIcon:o.jsx(po,{}),sx:{mb:2},children:"Back to Dashboard"}),o.jsxs(m,{sx:{mb:4},children:[o.jsx(S,{variant:"h4",component:"h1",fontWeight:"bold",children:r}),o.jsx(m,{sx:{mt:1},children:o.jsx(dt,{value:t,maxLength:16})})]}),o.jsx(S,{variant:"h6",sx:{mb:2,textTransform:"uppercase"},fontWeight:"bold",children:"Holdings"}),o.jsx(ct,{variant:"outlined",children:u?o.jsxs(m,{sx:{p:2},children:[o.jsx(lt,{variant:"rectangular",height:60}),o.jsx(lt,{variant:"rectangular",height:60,sx:{mt:1}})]}):c?o.jsx(m,{sx:{p:4,textAlign:"center"},children:o.jsx(S,{color:"error",children:"Failed to load holdings"})}):i.length===0?o.jsx(m,{sx:{p:4,textAlign:"center"},children:o.jsx(S,{color:"textSecondary",children:"No holdings in this wallet"})}):i.map(l=>o.jsx(go,{aggregatedHolding:l,holdings:b(l.instrumentId)},`${l.instrumentId.admin}::${l.instrumentId.id}`))})]})}export{wo as component};